Date: Wed, 8 Oct 2008 15:28:50 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 151138 for review Message-ID: <200810081528.m98FSoX0051263@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=151138 Change 151138 by zec@zec_tca51 on 2008/10/08 15:28:27 IFC @ 151135 Affected files ... .. //depot/projects/vimage/src/sys/amd64/amd64/vm_machdep.c#7 integrate .. //depot/projects/vimage/src/sys/amd64/conf/GENERIC#21 integrate .. //depot/projects/vimage/src/sys/arm/at91/at91_mci.c#8 integrate .. //depot/projects/vimage/src/sys/arm/at91/at91_spi.c#3 integrate .. //depot/projects/vimage/src/sys/arm/at91/if_ate.c#10 integrate .. //depot/projects/vimage/src/sys/arm/at91/uart_dev_at91usart.c#8 integrate .. //depot/projects/vimage/src/sys/boot/arm/at91/boot2/boot2.c#6 integrate .. //depot/projects/vimage/src/sys/boot/arm/at91/boot2/centipad_board.c#2 integrate .. //depot/projects/vimage/src/sys/boot/arm/at91/boot2/kb920x_board.c#3 integrate .. //depot/projects/vimage/src/sys/boot/arm/ixp425/Makefile.inc#1 branch .. //depot/projects/vimage/src/sys/boot/arm/ixp425/boot2/Makefile#1 branch .. //depot/projects/vimage/src/sys/boot/arm/ixp425/boot2/arm_init.S#1 branch .. //depot/projects/vimage/src/sys/boot/arm/ixp425/boot2/boot2.c#1 branch .. //depot/projects/vimage/src/sys/boot/arm/ixp425/boot2/cf_ata.h#1 branch .. //depot/projects/vimage/src/sys/boot/arm/ixp425/boot2/ixp425_board.c#1 branch .. //depot/projects/vimage/src/sys/boot/arm/ixp425/boot2/lib.h#1 branch .. //depot/projects/vimage/src/sys/boot/forth/loader.conf#15 integrate .. //depot/projects/vimage/src/sys/boot/i386/libi386/bootinfo64.c#2 integrate .. //depot/projects/vimage/src/sys/boot/sparc64/loader/main.c#8 integrate .. //depot/projects/vimage/src/sys/boot/uboot/lib/api_public.h#3 integrate .. //depot/projects/vimage/src/sys/boot/uboot/lib/glue.c#4 integrate .. //depot/projects/vimage/src/sys/boot/uboot/lib/glue.h#4 integrate .. //depot/projects/vimage/src/sys/boot/uboot/lib/net.c#4 integrate .. //depot/projects/vimage/src/sys/compat/linprocfs/linprocfs.c#25 integrate .. //depot/projects/vimage/src/sys/compat/linux/linux_misc.c#26 integrate .. //depot/projects/vimage/src/sys/conf/NOTES#32 integrate .. //depot/projects/vimage/src/sys/conf/files#38 integrate .. //depot/projects/vimage/src/sys/conf/newvers.sh#6 integrate .. //depot/projects/vimage/src/sys/contrib/pf/net/pf.c#17 integrate .. //depot/projects/vimage/src/sys/dev/ae/if_ae.c#1 branch .. //depot/projects/vimage/src/sys/dev/ae/if_aereg.h#1 branch .. //depot/projects/vimage/src/sys/dev/ae/if_aevar.h#1 branch .. //depot/projects/vimage/src/sys/dev/aha/aha_isa.c#4 integrate .. //depot/projects/vimage/src/sys/dev/aha/aha_mca.c#4 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm.h#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/drmP.h#4 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_agpsupport.c#5 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_atomic.h#2 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_auth.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_bufs.c#4 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_context.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_dma.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_drawable.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_drv.c#6 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_fops.c#4 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_ioctl.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_irq.c#4 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_lock.c#4 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_memory.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_pci.c#4 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_scatter.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_sysctl.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/drm_vm.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/i915_dma.c#7 integrate .. //depot/projects/vimage/src/sys/dev/drm/i915_drm.h#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/i915_drv.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/i915_drv.h#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/i915_irq.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/i915_suspend.c#2 integrate .. //depot/projects/vimage/src/sys/dev/drm/mach64_drv.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/mga_drv.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/r128_drv.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/radeon_cp.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/radeon_drv.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/savage_drv.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/sis_drv.c#3 integrate .. //depot/projects/vimage/src/sys/dev/drm/tdfx_drv.c#3 integrate .. //depot/projects/vimage/src/sys/dev/hptiop/hptiop.h#3 integrate .. //depot/projects/vimage/src/sys/dev/hwpmc/pmc_events.h#4 integrate .. //depot/projects/vimage/src/sys/dev/if_ndis/if_ndis.c#16 integrate .. //depot/projects/vimage/src/sys/dev/if_ndis/if_ndisvar.h#7 integrate .. //depot/projects/vimage/src/sys/dev/mii/atphy.c#2 integrate .. //depot/projects/vimage/src/sys/dev/mii/miidevs#16 integrate .. //depot/projects/vimage/src/sys/dev/sio/sio.c#6 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_osl_freebsd.c#7 integrate .. //depot/projects/vimage/src/sys/dev/usb/umass.c#13 integrate .. //depot/projects/vimage/src/sys/dev/usb/usbdevs#30 integrate .. //depot/projects/vimage/src/sys/fs/cd9660/cd9660_node.c#2 integrate .. //depot/projects/vimage/src/sys/fs/fdescfs/fdesc_vnops.c#9 integrate .. //depot/projects/vimage/src/sys/fs/portalfs/portal_vnops.c#6 integrate .. //depot/projects/vimage/src/sys/fs/procfs/procfs_map.c#5 integrate .. //depot/projects/vimage/src/sys/i386/conf/GENERIC#24 integrate .. //depot/projects/vimage/src/sys/i386/i386/vm_machdep.c#11 integrate .. //depot/projects/vimage/src/sys/kern/imgact_elf.c#9 integrate .. //depot/projects/vimage/src/sys/kern/subr_firmware.c#4 integrate .. //depot/projects/vimage/src/sys/kern/subr_witness.c#16 integrate .. //depot/projects/vimage/src/sys/kern/sys_socket.c#13 integrate .. //depot/projects/vimage/src/sys/kern/uipc_sockbuf.c#11 integrate .. //depot/projects/vimage/src/sys/kern/uipc_socket.c#24 integrate .. //depot/projects/vimage/src/sys/kern/uipc_usrreq.c#19 integrate .. //depot/projects/vimage/src/sys/modules/Makefile#29 integrate .. //depot/projects/vimage/src/sys/modules/ae/Makefile#1 branch .. //depot/projects/vimage/src/sys/modules/wpifw/Makefile#2 integrate .. //depot/projects/vimage/src/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c#6 integrate .. //depot/projects/vimage/src/sys/netgraph/netflow/netflow.c#5 integrate .. //depot/projects/vimage/src/sys/netgraph/netflow/ng_netflow.c#5 integrate .. //depot/projects/vimage/src/sys/netgraph/netflow/ng_netflow.h#3 integrate .. //depot/projects/vimage/src/sys/netinet/in_pcb.c#35 integrate .. //depot/projects/vimage/src/sys/netinet/in_pcb.h#18 integrate .. //depot/projects/vimage/src/sys/netinet/ip_fw2.c#50 integrate .. //depot/projects/vimage/src/sys/netinet/raw_ip.c#30 integrate .. //depot/projects/vimage/src/sys/netinet/tcp_input.c#39 integrate .. //depot/projects/vimage/src/sys/netinet/tcp_subr.c#54 integrate .. //depot/projects/vimage/src/sys/netinet/udp_usrreq.c#36 integrate .. //depot/projects/vimage/src/sys/netinet6/in6_pcb.c#24 integrate .. //depot/projects/vimage/src/sys/netinet6/udp6_usrreq.c#32 integrate .. //depot/projects/vimage/src/sys/sys/un.h#2 integrate Differences ... ==== //depot/projects/vimage/src/sys/amd64/amd64/vm_machdep.c#7 (text+ko) ==== @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.258 2008/09/11 18:33:57 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.259 2008/10/05 02:03:54 davidxu Exp $"); #include "opt_isa.h" #include "opt_cpu.h" @@ -280,6 +280,14 @@ */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); + /* If the current thread has the trap bit set (i.e. a debugger had + * single stepped the process to the system call), we need to clear + * the trap flag from the new frame. Otherwise, the new thread will + * receive a (likely unexpected) SIGTRAP when it executes the first + * instruction after returning to userland. + */ + td->td_frame->tf_rflags &= ~PSL_T; + /* * Set registers for trampoline to user mode. Leave space for the * return address on stack. These are the kernel mode register values. ==== //depot/projects/vimage/src/sys/amd64/conf/GENERIC#21 (text+ko) ==== @@ -16,7 +16,7 @@ # If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # -# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.507 2008/08/20 08:31:58 ed Exp $ +# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.508 2008/10/03 10:31:31 stas Exp $ cpu HAMMER ident GENERIC @@ -200,6 +200,7 @@ # PCI Ethernet NICs that use the common MII bus controller code. # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support +device ae # Attansic/Atheros L2 FastEthernet device age # Attansic/Atheros L1 Gigabit Ethernet device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet device bfe # Broadcom BCM440x 10/100 Ethernet ==== //depot/projects/vimage/src/sys/arm/at91/at91_mci.c#8 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/at91/at91_mci.c,v 1.7 2008/09/30 02:32:41 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/at91/at91_mci.c,v 1.8 2008/10/07 17:23:16 imp Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -175,9 +175,9 @@ /* * Allocate DMA tags and maps */ - err = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, MAXPHYS, 1, MAXPHYS, - BUS_DMA_ALLOCNOW, NULL, NULL, &sc->dmatag); + err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, US_SPACE_MAXADDR, NULL, NULL, MAXPHYS, 1, + MAXPHYS, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->dmatag); if (err != 0) goto out; ==== //depot/projects/vimage/src/sys/arm/at91/at91_spi.c#3 (text) ==== @@ -23,7 +23,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/at91/at91_spi.c,v 1.6 2007/02/27 17:15:39 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/at91/at91_spi.c,v 1.7 2008/10/07 17:23:16 imp Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -97,9 +97,9 @@ /* * Allocate DMA tags and maps */ - err = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, 2058, 1, 2048, BUS_DMA_ALLOCNOW, - NULL, NULL, &sc->dmatag); + err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 2058, 1, + 2048, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->dmatag); if (err != 0) goto out; for (i = 0; i < 4; i++) { ==== //depot/projects/vimage/src/sys/arm/at91/if_ate.c#10 (text) ==== @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/at91/if_ate.c,v 1.28 2008/08/31 18:20:01 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/at91/if_ate.c,v 1.29 2008/10/07 17:23:16 imp Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -359,9 +359,9 @@ /* * Allocate DMA tags and maps */ - err = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, MCLBYTES, 0, - busdma_lock_mutex, &sc->sc_mtx, &sc->mtag); + err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, + 1, MCLBYTES, 0, busdma_lock_mutex, &sc->sc_mtx, &sc->mtag); if (err != 0) goto errout; for (i = 0; i < ATE_MAX_TX_BUFFERS; i++) { @@ -377,15 +377,15 @@ /* * Allocate DMA tags and maps for RX. */ - err = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, MCLBYTES, 0, - busdma_lock_mutex, &sc->sc_mtx, &sc->rxtag); + err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, + 1, MCLBYTES, 0, busdma_lock_mutex, &sc->sc_mtx, &sc->rxtag); if (err != 0) goto errout; /* Dma TAG and MAP for the rx descriptors. */ - err = bus_dma_tag_create(NULL, sizeof(eth_rx_desc_t), 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + err = bus_dma_tag_create(bus_get_dma_tag(dev), sizeof(eth_rx_desc_t), + 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, ATE_MAX_RX_BUFFERS * sizeof(eth_rx_desc_t), 1, ATE_MAX_RX_BUFFERS * sizeof(eth_rx_desc_t), 0, busdma_lock_mutex, &sc->sc_mtx, &sc->rx_desc_tag); ==== //depot/projects/vimage/src/sys/arm/at91/uart_dev_at91usart.c#8 (text) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/at91/uart_dev_at91usart.c,v 1.15 2008/08/02 08:01:56 ed Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/at91/uart_dev_at91usart.c,v 1.16 2008/10/07 17:23:16 imp Exp $"); #include "opt_comconsole.h" @@ -350,9 +350,10 @@ /* * Allocate DMA tags and maps */ - err = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, USART_BUFFER_SIZE, 1, - USART_BUFFER_SIZE, BUS_DMA_ALLOCNOW, NULL, NULL, &atsc->dmatag); + err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + USART_BUFFER_SIZE, 1, USART_BUFFER_SIZE, BUS_DMA_ALLOCNOW, NULL, + NULL, &atsc->dmatag); if (err != 0) goto errout; err = bus_dmamap_create(atsc->dmatag, 0, &atsc->tx_map); ==== //depot/projects/vimage/src/sys/boot/arm/at91/boot2/boot2.c#6 (text+ko) ==== @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2008 John Hay + * Copyright (c) 2006 Warner Losh * Copyright (c) 1998 Robert Nordier * All rights reserved. * @@ -14,7 +16,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/arm/at91/boot2/boot2.c,v 1.8 2007/10/26 21:02:31 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/arm/at91/boot2/boot2.c,v 1.12 2008/10/07 17:44:04 imp Exp $"); #include <sys/param.h> #include <sys/disklabel.h> @@ -51,7 +53,7 @@ /* 0x13 is reserved for boot programs. */ /* #define RBX_PAUSE 0x14 -p */ /* #define RBX_QUIET 0x15 -q */ -/* #define RBX_NOINTR 0x1c -n */ +#define RBX_NOINTR 0x1c /* -n */ /* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */ /* #define RBX_DUAL 0x1d -D */ /* 0x1f is reserved for log2(RB_BOOTINFO). */ @@ -66,20 +68,21 @@ //#define PATH_KERNEL "/boot/kernel/kernel" #define PATH_KERNEL "/boot/kernel/kernel.gz.tramp" -#define NOPT 5 +extern uint32_t _end; + +#define NOPT 6 #define OPT_SET(opt) (1 << (opt)) #define OPT_CHECK(opt) ((opts) & OPT_SET(opt)) -extern uint32_t _end; - -static const char optstr[NOPT] = "agrsv"; +static const char optstr[NOPT] = "agnrsv"; static const unsigned char flags[NOPT] = { - RBX_ASKNAME, - RBX_GDB, - RBX_DFLTROOT, - RBX_SINGLE, - RBX_VERBOSE + RBX_ASKNAME, + RBX_GDB, + RBX_NOINTR, + RBX_DFLTROOT, + RBX_SINGLE, + RBX_VERBOSE }; unsigned dsk_start; @@ -92,206 +95,299 @@ static int parse(void); static int xfsread(ino_t, void *, size_t); static int dskread(void *, unsigned, unsigned); +#ifdef FIXUP_BOOT_DRV +static void fixup_boot_drv(caddr_t, int, int, int); +#endif #define UFS_SMALL_CGBASE #include "ufsread.c" +#ifdef DEBUG +#define DPRINTF(fmt, ...) printf(fmt, __VA_ARGS__) +#else +#define DPRINTF(fmt, ...) +#endif + static inline int xfsread(ino_t inode, void *buf, size_t nbyte) { - if ((size_t)fsread(inode, buf, nbyte) != nbyte) - return -1; - return 0; + if ((size_t)fsread(inode, buf, nbyte) != nbyte) + return -1; + return 0; } static inline void getstr(int c) { - char *s; + char *s; - s = cmd; - if (c == 0) - c = getc(10000); - for (;;) { - switch (c) { - case 0: - break; - case '\177': - case '\b': - if (s > cmd) { - s--; - printf("\b \b"); - } - break; - case '\n': - case '\r': - *s = 0; - return; - default: - if (s - cmd < sizeof(cmd) - 1) - *s++ = c; - xputchar(c); + s = cmd; + if (c == 0) + c = getc(10000); + for (;;) { + switch (c) { + case 0: + break; + case '\177': + case '\b': + if (s > cmd) { + s--; + printf("\b \b"); + } + break; + case '\n': + case '\r': + *s = 0; + return; + default: + if (s - cmd < sizeof(cmd) - 1) + *s++ = c; + xputchar(c); + } + c = getc(10000); } - c = getc(10000); - } } int main(void) { - int autoboot, c = 0; - ino_t ino; + int autoboot, c = 0; + ino_t ino; - board_init(); + dmadat = (void *)(0x20000000 + (16 << 20)); + board_init(); - dmadat = (void *)(0x20000000 + (16 << 20)); - /* Process configuration file */ + autoboot = 1; - autoboot = 1; + /* Process configuration file */ + if ((ino = lookup(PATH_CONFIG))) + fsread(ino, cmd, sizeof(cmd)); - if ((ino = lookup(PATH_CONFIG))) - fsread(ino, cmd, sizeof(cmd)); + if (*cmd) { + if (parse()) + autoboot = 0; + printf("%s: %s\n", PATH_CONFIG, cmd); + /* Do not process this command twice */ + *cmd = 0; + } - if (*cmd) { - if (parse()) - autoboot = 0; - printf("%s: %s", PATH_CONFIG, cmd); - /* Do not process this command twice */ - *cmd = 0; - } + if (*kname == '\0') + strcpy(kname, PATH_KERNEL); - /* Present the user with the boot2 prompt. */ - - if (*kname == '\0') - strcpy(kname, PATH_KERNEL); - for (;;) { - printf("\nDefault: %s\nboot: ", kname); - if (!autoboot || (c = getc(2)) != -1) - getstr(c); - xputchar('\n'); - autoboot = 0; - c = 0; - if (parse()) - xputchar('\a'); -#ifdef XMODEM_DL - else if (*cmd == '*') - Update(); -#endif - else - load(); - } + /* Present the user with the boot2 prompt. */ + for (;;) { + printf("\nDefault: %s\nboot: ", kname); + if (!autoboot || + (OPT_CHECK(RBX_NOINTR) == 0 && (c = getc(2)) != 0)) + getstr(c); + xputchar('\n'); + autoboot = 0; + c = 0; + if (parse()) + xputchar('\a'); + else + load(); + } } static void load(void) { - Elf32_Ehdr eh; - static Elf32_Phdr ep[2]; - caddr_t p; - ino_t ino; - uint32_t addr; - int i, j; + Elf32_Ehdr eh; + static Elf32_Phdr ep[2]; + caddr_t p; + ino_t ino; + uint32_t addr; + int i, j; +#ifdef FIXUP_BOOT_DRV + caddr_t staddr; + int klen; - if (!(ino = lookup(kname))) { - if (!ls) - printf("No %s\n", kname); - return; - } - if (xfsread(ino, &eh, sizeof(eh))) - return; - if (!IS_ELF(eh)) { - printf("Invalid %s\n", "format"); - return; - } - fs_off = eh.e_phoff; - for (j = i = 0; i < eh.e_phnum && j < 2; i++) { - if (xfsread(ino, ep + j, sizeof(ep[0]))) - return; - if (ep[j].p_type == PT_LOAD) - j++; - } - for (i = 0; i < 2; i++) { - p = (caddr_t)ep[i].p_paddr; - fs_off = ep[i].p_offset; - if (xfsread(ino, p, ep[i].p_filesz)) - return; - } - addr = eh.e_entry; - ((void(*)(int))addr)(opts & RBX_MASK); + staddr = (caddr_t)0xffffffff; + klen = 0; +#endif + if (!(ino = lookup(kname))) { + if (!ls) + printf("No %s\n", kname); + return; + } + if (xfsread(ino, &eh, sizeof(eh))) + return; + if (!IS_ELF(eh)) { + printf("Invalid %s\n", "format"); + return; + } + fs_off = eh.e_phoff; + for (j = i = 0; i < eh.e_phnum && j < 2; i++) { + if (xfsread(ino, ep + j, sizeof(ep[0]))) + return; + if (ep[j].p_type == PT_LOAD) + j++; + } + for (i = 0; i < 2; i++) { + p = (caddr_t)ep[i].p_paddr; + fs_off = ep[i].p_offset; +#ifdef FIXUP_BOOT_DRV + if (staddr == (caddr_t)0xffffffff) + staddr = p; + klen += ep[i].p_filesz; +#endif + if (xfsread(ino, p, ep[i].p_filesz)) + return; + } + addr = eh.e_entry; +#ifdef FIXUP_BOOT_DRV + fixup_boot_drv(staddr, klen, bootslice, bootpart); +#endif + ((void(*)(int))addr)(opts & RBX_MASK); } static int parse() { - char *arg = cmd; - char *ep, *p; - int c, i; + char *arg = cmd; + char *ep, *p; + int c, i; - while ((c = *arg++)) { - if (c == ' ' || c == '\t' || c == '\n') - continue; - for (p = arg; *p && *p != '\n' && *p != ' ' && *p != '\t'; p++); - ep = p; - if (*p) - *p++ = 0; - if (c == '-') { - while ((c = *arg++)) { - for (i = 0; c != optstr[i]; i++) - if (i == NOPT - 1) - return -1; - opts ^= OPT_SET(flags[i]); - } - } else { - arg--; - if ((i = ep - arg)) { - if ((size_t)i >= sizeof(kname)) - return -1; - memcpy(kname, arg, i + 1); - } + while ((c = *arg++)) { + if (c == ' ' || c == '\t' || c == '\n') + continue; + for (p = arg; *p && *p != '\n' && *p != ' ' && *p != '\t'; p++); + ep = p; + if (*p) + *p++ = 0; + if (c == '-') { + while ((c = *arg++)) { + for (i = 0; c != optstr[i]; i++) + if (i == NOPT - 1) + return -1; + opts ^= OPT_SET(flags[i]); + } + } else { + arg--; + if ((i = ep - arg)) { + if ((size_t)i >= sizeof(kname)) + return -1; + memcpy(kname, arg, i + 1); + } + } + arg = p; } - arg = p; - } - return 0; + return 0; } static int dskread(void *buf, unsigned lba, unsigned nblk) { - struct dos_partition *dp; - struct disklabel *d; - char *sec; - int i; + struct dos_partition *dp; + struct disklabel *d; + char *sec; + int i; - if (!dsk_meta) { - sec = dmadat->secbuf; - dsk_start = 0; - if (drvread(sec, DOSBBSECTOR, 1)) - return -1; - dp = (void *)(sec + DOSPARTOFF); - for (i = 0; i < NDOSPART; i++) { - if (dp[i].dp_typ == DOSPTYP_386BSD) - break; + if (!dsk_meta) { + sec = dmadat->secbuf; + dsk_start = 0; + if (drvread(sec, DOSBBSECTOR, 1)) + return -1; + dp = (void *)(sec + DOSPARTOFF); + for (i = 0; i < NDOSPART; i++) { + if (dp[i].dp_typ == DOSPTYP_386BSD) + break; + } + if (i == NDOSPART) + return -1; + /* + * Although dp_start is aligned within the disk + * partition structure, DOSPARTOFF is 446, which is + * only word (2) aligned, not longword (4) aligned. + * Cope by using memcpy to fetch the start of this + * partition. + */ + memcpy(&dsk_start, &dp[1].dp_start, 4); + if (drvread(sec, dsk_start + LABELSECTOR, 1)) + return -1; + d = (void *)(sec + LABELOFFSET); + if (d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) { + printf("Invalid %s\n", "label"); + return -1; + } + if (!d->d_partitions[0].p_size) { + printf("Invalid %s\n", "partition"); + return -1; + } + dsk_start += d->d_partitions[0].p_offset; + dsk_start -= d->d_partitions[RAW_PART].p_offset; + dsk_meta++; } - if (i == NDOSPART) - return -1; - // Although dp_start is aligned within the disk partition structure, - // DOSPARTOFF is 446, which is only word (2) aligned, not longword (4) - // aligned. Cope by using memcpy to fetch the start of this partition. - memcpy(&dsk_start, &dp[1].dp_start, 4); - if (drvread(sec, dsk_start + LABELSECTOR, 1)) - return -1; - d = (void *)(sec + LABELOFFSET); - if (d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) { - printf("Invalid %s\n", "label"); - return -1; + return drvread(buf, dsk_start + lba, nblk); +} + +#ifdef FIXUP_BOOT_DRV +/* + * fixup_boot_drv() will try to find the ROOTDEVNAME spec in the kernel + * and change it to what was specified on the comandline or /boot.conf + * file or to what was encountered on the disk. It will try to handle 3 + * different disk layouts, raw (dangerously dedicated), slice only and + * slice + partition. It will look for the following strings in the + * kernel, but if it is one of the first three, the string in the kernel + * must use the correct form to match the actual disk layout: + * - ufs:ad0a + * - ufs:ad0s1 + * - ufs:ad0s1a + * - ufs:ROOTDEVNAME + * In the case of the first three strings, only the "a" at the end and + * the "1" after the "s" will be modified, if they exist. The string + * length will not be changed. In the case of the last string, the + * whole string will be built up and nul, '\0' terminated. + */ +static void +fixup_boot_drv(caddr_t addr, int klen, int bs, int bp) +{ + const u_int8_t op[] = "ufs:ROOTDEVNAME"; + const u_int8_t op2[] = "ufs:ad0"; + u_int8_t *p, *ps; + + DPRINTF("fixup_boot_drv: 0x%x, %d, slice %d, partition %d\n", + (int)addr, klen, bs, bp); + if (bs > 4) + return; + if (bp > 7) + return; + ps = memmem(addr, klen, op, sizeof(op)); + if (ps != NULL) { + p = ps + 4; /* past ufs: */ + DPRINTF("Found it at 0x%x\n", (int)ps); + p[0] = 'a'; p[1] = 'd'; p[2] = '0'; /* ad0 */ + p += 3; + if (bs > 0) { + /* append slice */ + *p++ = 's'; + *p++ = bs + '0'; + } + if (disk_layout != DL_SLICE) { + /* append partition */ + *p++ = bp + 'a'; + } + *p = '\0'; + } else { + ps = memmem(addr, klen, op2, sizeof(op2) - 1); + if (ps != NULL) { + p = ps + sizeof(op2) - 1; + DPRINTF("Found it at 0x%x\n", (int)ps); + if (*p == 's') { + /* fix slice */ + p++; + *p++ = bs + '0'; + } + if (*p == 'a') + *p = bp + 'a'; + } } - if (!d->d_partitions[0].p_size) { - printf("Invalid %s\n", "partition"); - return -1; + if (ps == NULL) { + printf("Could not locate \"%s\" to fix kernel boot device, " + "check ROOTDEVNAME is set\n", op); + return; } - dsk_start += d->d_partitions[0].p_offset; - dsk_start -= d->d_partitions[RAW_PART].p_offset; - dsk_meta++; - } - return drvread(buf, dsk_start + lba, nblk); + DPRINTF("Changed boot device to %s\n", ps); } +#endif ==== //depot/projects/vimage/src/sys/boot/arm/at91/boot2/centipad_board.c#2 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/arm/at91/boot2/centipad_board.c,v 1.1 2007/07/13 14:27:04 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/arm/at91/boot2/centipad_board.c,v 1.2 2008/10/05 23:39:28 imp Exp $"); #include <sys/param.h> @@ -51,11 +51,6 @@ } void -Update(void) -{ -} - -void board_init(void) { InitEEPROM(); ==== //depot/projects/vimage/src/sys/boot/arm/at91/boot2/kb920x_board.c#3 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/arm/at91/boot2/kb920x_board.c,v 1.4 2007/07/13 14:27:04 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/arm/at91/boot2/kb920x_board.c,v 1.5 2008/10/05 23:39:28 imp Exp $"); #include <sys/param.h> @@ -49,11 +49,6 @@ } void -Update(void) -{ -} - -void board_init(void) { InitEEPROM(); ==== //depot/projects/vimage/src/sys/boot/forth/loader.conf#15 (text+ko) ==== @@ -6,7 +6,7 @@ # # All arguments must be in double quotes. # -# $FreeBSD: src/sys/boot/forth/loader.conf,v 1.133 2008/09/10 18:36:58 jhb Exp $ +# $FreeBSD: src/sys/boot/forth/loader.conf,v 1.134 2008/10/04 11:49:53 stas Exp $ ############################################################## ### Basic configuration options ############################ @@ -208,6 +208,7 @@ ############################################################## miibus_load="NO" # miibus support, needed for some drivers +if_ae_load="NO" # Attansic/Atheros L2 FastEthernet if_age_load="NO" # Attansic/Atheros L1 Gigabit Ethernet if_an_load="NO" # Aironet 4500/4800 802.11 wireless NICs if_ar_load="NO" # Digi SYNC/570i ==== //depot/projects/vimage/src/sys/boot/i386/libi386/bootinfo64.c#2 (text+ko) ==== @@ -25,13 +25,16 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/bootinfo64.c,v 1.37 2006/09/29 20:27:41 ru Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/bootinfo64.c,v 1.38 2008/10/07 14:05:42 jhb Exp $"); #include <stand.h> #include <sys/param.h> #include <sys/reboot.h> #include <sys/linker.h> #include <machine/bootinfo.h> +#include <machine/cpufunc.h> +#include <machine/psl.h> +#include <machine/specialreg.h> #include "bootstrap.h" #include "libi386.h" #include "btxv86.h" @@ -124,7 +127,45 @@ } /* - * Load the information expected by an i386 kernel. + * Check to see if this CPU supports long mode. + */ +static int +bi_checkcpu(void) +{ + char *cpu_vendor; + int vendor[3]; + int eflags, regs[4]; + + /* Check for presence of "cpuid". */ + eflags = read_eflags(); + write_eflags(eflags ^ PSL_ID); + if (!((eflags ^ read_eflags()) & PSL_ID)) + return (0); + + /* Fetch the vendor string. */ + do_cpuid(0, regs); + vendor[0] = regs[1]; + vendor[1] = regs[3]; + vendor[2] = regs[2]; + cpu_vendor = (char *)vendor; + + /* Check for vendors that support AMD features. */ + if (strncmp(cpu_vendor, "GenuineIntel", 12) != 0 && + strncmp(cpu_vendor, "AuthenticAMD", 12) != 0) + return (0); + + /* Has to support AMD features. */ + do_cpuid(0x80000000, regs); + if (!(regs[0] >= 0x80000001)) + return (0); + + /* Check for long mode. */ + do_cpuid(0x80000001, regs); + return (regs[3] & AMDID_LM); +} + +/* + * Load the information expected by an amd64 kernel. * * - The 'boothowto' argument is constructed * - The 'bootdev' argument is constructed @@ -145,6 +186,11 @@ char *rootdevname; int howto; + if (!bi_checkcpu()) { + printf("CPU doesn't support long mode\n"); + return (EINVAL); + } + howto = bi_getboothowto(args); /* ==== //depot/projects/vimage/src/sys/boot/sparc64/loader/main.c#8 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/sparc64/loader/main.c,v 1.38 2008/09/10 20:07:08 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/sparc64/loader/main.c,v 1.39 2008/10/05 14:00:44 marius Exp $"); /* * FreeBSD/sparc64 kernel loader - machine dependent part @@ -261,7 +261,7 @@ sparc64_autoload(void) { - printf("nothing to autoload yet.\n"); + setenv("hw.ata.atapi_dma", "0", 0); return (0); } ==== //depot/projects/vimage/src/sys/boot/uboot/lib/api_public.h#3 (text+ko) ==== @@ -48,7 +48,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/boot/uboot/lib/api_public.h,v 1.3 2008/03/13 17:54:21 obrien Exp $ + * $FreeBSD: src/sys/boot/uboot/lib/api_public.h,v 1.5 2008/10/04 13:19:15 raj Exp $ * * This file needs to be kept in sync with U-Boot reference: * http://www.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=include/api_public.h @@ -62,6 +62,7 @@ #define API_ENOMEM 3 /* no memory */ #define API_EBUSY 4 /* busy, occupied etc. */ #define API_EIO 5 /* I/O error */ +#define API_ESYSC 6 /* syscall error */ typedef int (*scp_t)(int, int *, ...); @@ -117,7 +118,7 @@ #undef CFG_64BIT_LBA #ifdef CFG_64BIT_LBA -typedef u_int64_t lbasize_t; +typedef uint64_t lbasize_t; #else typedef unsigned long lbasize_t; #endif ==== //depot/projects/vimage/src/sys/boot/uboot/lib/glue.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810081528.m98FSoX0051263>