From alc at FreeBSD.org Sun Nov 1 08:45:45 2009 From: alc at FreeBSD.org (Alan Cox) Date: Sun Nov 1 08:45:52 2009 Subject: svn commit: r198742 - in stable/7/sys: . amd64/include arm/include contrib/pf i386/include ia64/include kern powerpc/include sparc64/include sun4v/include sys Message-ID: <200911010845.nA18jice017741@svn.freebsd.org> Author: alc Date: Sun Nov 1 08:45:44 2009 New Revision: 198742 URL: http://svn.freebsd.org/changeset/base/198742 Log: MFC r197316 Add a new sysctl for reporting all of the supported page sizes. Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/include/param.h stable/7/sys/arm/include/param.h stable/7/sys/contrib/pf/ (props changed) stable/7/sys/i386/include/param.h stable/7/sys/ia64/include/param.h stable/7/sys/kern/kern_mib.c stable/7/sys/powerpc/include/param.h stable/7/sys/sparc64/include/param.h stable/7/sys/sun4v/include/param.h stable/7/sys/sys/systm.h Modified: stable/7/sys/amd64/include/param.h ============================================================================== --- stable/7/sys/amd64/include/param.h Sun Nov 1 08:20:30 2009 (r198741) +++ stable/7/sys/amd64/include/param.h Sun Nov 1 08:45:44 2009 (r198742) @@ -115,6 +115,8 @@ #define NBPML4 (1ul<flags & SCTL_MASK32) { + /* + * Recreate the "pagesizes" array with 32-bit elements. Truncate + * any page size greater than UINT32_MAX to zero. + */ + for (i = 0; i < MAXPAGESIZES; i++) + pagesizes32[i] = (uint32_t)pagesizes[i]; + + error = SYSCTL_OUT(req, pagesizes32, sizeof(pagesizes32)); + } else +#endif + error = SYSCTL_OUT(req, pagesizes, sizeof(pagesizes)); + return (error); +} +SYSCTL_PROC(_hw, OID_AUTO, pagesizes, CTLTYPE_ULONG | CTLFLAG_RD, + NULL, 0, sysctl_hw_pagesizes, "LU", "Supported page sizes"); + static char machine_arch[] = MACHINE_ARCH; SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD, machine_arch, 0, "System architecture"); Modified: stable/7/sys/powerpc/include/param.h ============================================================================== --- stable/7/sys/powerpc/include/param.h Sun Nov 1 08:20:30 2009 (r198741) +++ stable/7/sys/powerpc/include/param.h Sun Nov 1 08:45:44 2009 (r198742) @@ -81,6 +81,8 @@ #define PAGE_MASK (PAGE_SIZE - 1) #define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) +#define MAXPAGESIZES 1 /* maximum number of supported page sizes */ + #ifndef KSTACK_PAGES #define KSTACK_PAGES 4 /* includes pcb */ #endif Modified: stable/7/sys/sparc64/include/param.h ============================================================================== --- stable/7/sys/sparc64/include/param.h Sun Nov 1 08:20:30 2009 (r198741) +++ stable/7/sys/sparc64/include/param.h Sun Nov 1 08:45:44 2009 (r198742) @@ -107,6 +107,8 @@ #define PAGE_SIZE_MAX PAGE_SIZE_4M #define PAGE_MASK_MAX PAGE_MASK_4M +#define MAXPAGESIZES 1 /* maximum number of supported page sizes */ + #ifndef KSTACK_PAGES #define KSTACK_PAGES 4 /* pages of kernel stack (with pcb) */ #endif Modified: stable/7/sys/sun4v/include/param.h ============================================================================== --- stable/7/sys/sun4v/include/param.h Sun Nov 1 08:20:30 2009 (r198741) +++ stable/7/sys/sun4v/include/param.h Sun Nov 1 08:45:44 2009 (r198742) @@ -102,6 +102,8 @@ #define PAGE_SIZE_MAX PAGE_SIZE_4M #define PAGE_MASK_MAX PAGE_MASK_4M +#define MAXPAGESIZES 1 /* maximum number of supported page sizes */ + #ifndef KSTACK_PAGES #define KSTACK_PAGES 4 /* pages of kernel stack (with pcb) */ #endif Modified: stable/7/sys/sys/systm.h ============================================================================== --- stable/7/sys/sys/systm.h Sun Nov 1 08:20:30 2009 (r198741) +++ stable/7/sys/sys/systm.h Sun Nov 1 08:45:44 2009 (r198742) @@ -60,6 +60,7 @@ extern u_int nselcoll; /* select collis extern struct mtx sellock; /* select lock variable */ extern struct cv selwait; /* select conditional variable */ +extern u_long pagesizes[]; /* supported page sizes */ extern long physmem; /* physical memory */ extern long realmem; /* 'real' memory */ From alc at FreeBSD.org Sun Nov 1 08:48:31 2009 From: alc at FreeBSD.org (Alan Cox) Date: Sun Nov 1 08:48:43 2009 Subject: svn commit: r198743 - in stable/7/sys: . amd64/amd64 contrib/pf i386/i386 Message-ID: <200911010848.nA18mUNQ017838@svn.freebsd.org> Author: alc Date: Sun Nov 1 08:48:30 2009 New Revision: 198743 URL: http://svn.freebsd.org/changeset/base/198743 Log: MFC r197317 When superpages are enabled, add the 2 or 4MB page size to the array of supported page sizes. Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/amd64/pmap.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/i386/i386/pmap.c Modified: stable/7/sys/amd64/amd64/pmap.c ============================================================================== --- stable/7/sys/amd64/amd64/pmap.c Sun Nov 1 08:45:44 2009 (r198742) +++ stable/7/sys/amd64/amd64/pmap.c Sun Nov 1 08:48:30 2009 (r198743) @@ -666,6 +666,11 @@ pmap_init(void) * Are large page mappings enabled? */ TUNABLE_INT_FETCH("vm.pmap.pg_ps_enabled", &pg_ps_enabled); + if (pg_ps_enabled) { + KASSERT(MAXPAGESIZES > 1 && pagesizes[1] == 0, + ("pmap_init: can't assign to pagesizes[1]")); + pagesizes[1] = NBPDR; + } /* * Calculate the size of the pv head table for superpages. Modified: stable/7/sys/i386/i386/pmap.c ============================================================================== --- stable/7/sys/i386/i386/pmap.c Sun Nov 1 08:45:44 2009 (r198742) +++ stable/7/sys/i386/i386/pmap.c Sun Nov 1 08:48:30 2009 (r198743) @@ -666,6 +666,11 @@ pmap_init(void) * Are large page mappings enabled? */ TUNABLE_INT_FETCH("vm.pmap.pg_ps_enabled", &pg_ps_enabled); + if (pg_ps_enabled) { + KASSERT(MAXPAGESIZES > 1 && pagesizes[1] == 0, + ("pmap_init: can't assign to pagesizes[1]")); + pagesizes[1] = NBPDR; + } /* * Calculate the size of the pv head table for superpages. From brueffer at FreeBSD.org Sun Nov 1 10:57:07 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Sun Nov 1 10:57:19 2009 Subject: svn commit: r198747 - stable/7/share/man/man4 Message-ID: <200911011057.nA1Av71L021601@svn.freebsd.org> Author: brueffer Date: Sun Nov 1 10:57:07 2009 New Revision: 198747 URL: http://svn.freebsd.org/changeset/base/198747 Log: MFC: r198609 Revert part of r198363, there is no "device cam", it is included in "device scbus". Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/atapicam.4 stable/7/share/man/man4/umass.4 Modified: stable/7/share/man/man4/atapicam.4 ============================================================================== --- stable/7/share/man/man4/atapicam.4 Sun Nov 1 10:56:03 2009 (r198746) +++ stable/7/share/man/man4/atapicam.4 Sun Nov 1 10:57:07 2009 (r198747) @@ -39,7 +39,6 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device scbus" -.Cd "device cam" .Cd "device ata" .Cd "device atapicam" .Ed Modified: stable/7/share/man/man4/umass.4 ============================================================================== --- stable/7/share/man/man4/umass.4 Sun Nov 1 10:56:03 2009 (r198746) +++ stable/7/share/man/man4/umass.4 Sun Nov 1 10:57:07 2009 (r198747) @@ -39,7 +39,6 @@ place the following line in your kernel configuration file: .Bd -ragged -offset indent .Cd "device scbus" -.Cd "device cam" .Cd "device usb" .Cd "device umass" .Ed From avg at FreeBSD.org Sun Nov 1 11:41:20 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Sun Nov 1 11:41:37 2009 Subject: svn commit: r198751 - in stable/7/sys: . contrib/pf pci Message-ID: <200911011141.nA1BfKcP022599@svn.freebsd.org> Author: avg Date: Sun Nov 1 11:41:20 2009 New Revision: 198751 URL: http://svn.freebsd.org/changeset/base/198751 Log: MFC r197128,197325: add support for smbus controller found in AMD SB700 Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/pci/intpm.c stable/7/sys/pci/intpmreg.h Modified: stable/7/sys/pci/intpm.c ============================================================================== --- stable/7/sys/pci/intpm.c Sun Nov 1 11:39:07 2009 (r198750) +++ stable/7/sys/pci/intpm.c Sun Nov 1 11:41:20 2009 (r198751) @@ -53,6 +53,8 @@ struct intsmb_softc { void *irq_hand; device_t smbus; int isbusy; + int cfg_irq9; + int poll; struct mtx lock; }; @@ -96,6 +98,10 @@ intsmb_probe(device_t dev) #endif device_set_desc(dev, "Intel PIIX4 SMBUS Interface"); break; + case 0x43851002: + device_set_desc(dev, "AMD SB600/700/710/750 SMBus Controller"); + /* XXX Maybe force polling right here? */ + break; default: return (ENXIO); } @@ -108,12 +114,24 @@ intsmb_attach(device_t dev) { struct intsmb_softc *sc = device_get_softc(dev); int error, rid, value; + int intr; char *str; sc->dev = dev; mtx_init(&sc->lock, device_get_nameunit(dev), "intsmb", MTX_DEF); + sc->cfg_irq9 = 0; +#ifndef NO_CHANGE_PCICONF + switch (pci_get_devid(dev)) { + case 0x71138086: /* Intel 82371AB */ + case 0x719b8086: /* Intel 82443MX */ + /* Changing configuration is allowed. */ + sc->cfg_irq9 = 1; + break; + } +#endif + rid = PCI_BASE_ADDR_SMB; sc->io_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); @@ -123,27 +141,42 @@ intsmb_attach(device_t dev) goto fail; } -#ifndef NO_CHANGE_PCICONF - pci_write_config(dev, PCIR_INTLINE, 0x9, 1); - pci_write_config(dev, PCI_HST_CFG_SMB, - PCI_INTR_SMB_IRQ9 | PCI_INTR_SMB_ENABLE, 1); -#endif + if (sc->cfg_irq9) { + pci_write_config(dev, PCIR_INTLINE, 0x9, 1); + pci_write_config(dev, PCI_HST_CFG_SMB, + PCI_INTR_SMB_IRQ9 | PCI_INTR_SMB_ENABLE, 1); + } value = pci_read_config(dev, PCI_HST_CFG_SMB, 1); - switch (value & 0xe) { + sc->poll = (value & PCI_INTR_SMB_ENABLE) == 0; + intr = value & PCI_INTR_SMB_MASK; + switch (intr) { case PCI_INTR_SMB_SMI: str = "SMI"; break; case PCI_INTR_SMB_IRQ9: str = "IRQ 9"; break; + case PCI_INTR_SMB_IRQ_PCI: + str = "PCI IRQ"; + break; default: str = "BOGUS"; } + device_printf(dev, "intr %s %s ", str, - (value & 1) ? "enabled" : "disabled"); + sc->poll == 0 ? "enabled" : "disabled"); printf("revision %d\n", pci_read_config(dev, PCI_REVID_SMB, 1)); - if ((value & 0xe) != PCI_INTR_SMB_IRQ9) { + if (!sc->poll && intr == PCI_INTR_SMB_SMI) { + device_printf(dev, + "using polling mode when configured interrupt is SMI\n"); + sc->poll = 1; + } + + if (sc->poll) + goto no_intr; + + if (intr != PCI_INTR_SMB_IRQ9 && intr != PCI_INTR_SMB_IRQ_PCI) { device_printf(dev, "Unsupported interrupt mode\n"); error = ENXIO; goto fail; @@ -151,7 +184,9 @@ intsmb_attach(device_t dev) /* Force IRQ 9. */ rid = 0; - bus_set_resource(dev, SYS_RES_IRQ, rid, 9, 1); + if (sc->cfg_irq9) + bus_set_resource(dev, SYS_RES_IRQ, rid, 9, 1); + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); if (sc->irq_res == NULL) { @@ -167,6 +202,7 @@ intsmb_attach(device_t dev) goto fail; } +no_intr: sc->isbusy = 0; sc->smbus = device_add_child(dev, "smbus", -1); if (sc->smbus == NULL) { @@ -361,7 +397,7 @@ intsmb_start(struct intsmb_softc *sc, un tmp |= PIIX4_SMBHSTCNT_START; /* While not in autoconfiguration enable interrupts. */ - if (!cold && !nointr) + if (!sc->poll && !cold && !nointr) tmp |= PIIX4_SMBHSTCNT_INTREN; bus_write_1(sc->io_res, PIIX4_SMBHSTCNT, tmp); } @@ -411,8 +447,6 @@ intsmb_stop_poll(struct intsmb_softc *sc if (!(status & PIIX4_SMBHSTSTAT_BUSY)) { sc->isbusy = 0; error = intsmb_error(sc->dev, status); - if (error == 0 && !(status & PIIX4_SMBHSTSTAT_INTR)) - device_printf(sc->dev, "unknown cause why?\n"); return (error); } } @@ -434,7 +468,7 @@ intsmb_stop(struct intsmb_softc *sc) INTSMB_LOCK_ASSERT(sc); - if (cold) + if (sc->poll || cold) /* So that it can use device during device probe on SMBus. */ return (intsmb_stop_poll(sc)); Modified: stable/7/sys/pci/intpmreg.h ============================================================================== --- stable/7/sys/pci/intpmreg.h Sun Nov 1 11:39:07 2009 (r198750) +++ stable/7/sys/pci/intpmreg.h Sun Nov 1 11:41:20 2009 (r198751) @@ -35,7 +35,9 @@ #define PCI_BASE_ADDR_SMB 0x90 /* IO BAR. */ #define PCI_BASE_ADDR_PM 0x40 #define PCI_HST_CFG_SMB 0xd2 /* Host Configuration */ +#define PCI_INTR_SMB_MASK 0xe #define PCI_INTR_SMB_SMI 0 +#define PCI_INTR_SMB_IRQ_PCI 2 #define PCI_INTR_SMB_IRQ9 8 #define PCI_INTR_SMB_ENABLE 1 #define PCI_SLV_CMD_SMB 0xd3 /*SLAVE COMMAND*/ From avg at FreeBSD.org Sun Nov 1 17:15:39 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Sun Nov 1 17:15:47 2009 Subject: svn commit: r198755 - stable/7/usr.bin/fstat Message-ID: <200911011715.nA1HFcpG028973@svn.freebsd.org> Author: avg Date: Sun Nov 1 17:15:38 2009 New Revision: 198755 URL: http://svn.freebsd.org/changeset/base/198755 Log: MFC 196399: fstat: fix fsid comparison on systems with 64-bit long Modified: stable/7/usr.bin/fstat/ (props changed) stable/7/usr.bin/fstat/fstat.c stable/7/usr.bin/fstat/zfs.c Modified: stable/7/usr.bin/fstat/fstat.c ============================================================================== --- stable/7/usr.bin/fstat/fstat.c Sun Nov 1 17:05:08 2009 (r198754) +++ stable/7/usr.bin/fstat/fstat.c Sun Nov 1 17:15:38 2009 (r198755) @@ -649,7 +649,7 @@ devfs_filestat(struct vnode *vp, struct (void *)devfs_dirent.de_vnode, Pid); return 0; } - fsp->fsid = (long)mount.mnt_stat.f_fsid.val[0]; + fsp->fsid = (long)(uint32_t)mount.mnt_stat.f_fsid.val[0]; fsp->fileid = devfs_dirent.de_inode; fsp->mode = (devfs_dirent.de_mode & ~S_IFMT) | S_IFCHR; fsp->size = 0; Modified: stable/7/usr.bin/fstat/zfs.c ============================================================================== --- stable/7/usr.bin/fstat/zfs.c Sun Nov 1 17:05:08 2009 (r198754) +++ stable/7/usr.bin/fstat/zfs.c Sun Nov 1 17:15:38 2009 (r198755) @@ -117,7 +117,7 @@ zfs_filestat(struct vnode *vp, struct fi goto bad; } - fsp->fsid = (long)mount.mnt_stat.f_fsid.val[0]; + fsp->fsid = (long)(uint32_t)mount.mnt_stat.f_fsid.val[0]; fsp->fileid = *zid; /* * XXX: Shows up wrong in output, but UFS has this error too. Could From avg at FreeBSD.org Sun Nov 1 17:37:03 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Sun Nov 1 17:37:22 2009 Subject: svn commit: r198757 - in stable/7/sys: . contrib/pf kern Message-ID: <200911011737.nA1Hb3Kl029534@svn.freebsd.org> Author: avg Date: Sun Nov 1 17:37:03 2009 New Revision: 198757 URL: http://svn.freebsd.org/changeset/base/198757 Log: MFC 197641: print_caddr_t: drop incorrect __unused from parameter Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/init_main.c Modified: stable/7/sys/kern/init_main.c ============================================================================== --- stable/7/sys/kern/init_main.c Sun Nov 1 17:36:36 2009 (r198756) +++ stable/7/sys/kern/init_main.c Sun Nov 1 17:37:03 2009 (r198757) @@ -284,7 +284,7 @@ restart: *************************************************************************** */ static void -print_caddr_t(void *data __unused) +print_caddr_t(void *data) { printf("%s", (char *)data); } From avg at FreeBSD.org Sun Nov 1 17:43:00 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Sun Nov 1 17:43:05 2009 Subject: svn commit: r198759 - in stable/7/sys: . contrib/pf kern Message-ID: <200911011742.nA1Hgx0N029751@svn.freebsd.org> Author: avg Date: Sun Nov 1 17:42:59 2009 New Revision: 198759 URL: http://svn.freebsd.org/changeset/base/198759 Log: MFC 197658: print machine in kernel boot version string PR: kern/126926 Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/init_main.c Modified: stable/7/sys/kern/init_main.c ============================================================================== --- stable/7/sys/kern/init_main.c Sun Nov 1 17:40:05 2009 (r198758) +++ stable/7/sys/kern/init_main.c Sun Nov 1 17:42:59 2009 (r198759) @@ -288,11 +288,24 @@ print_caddr_t(void *data) { printf("%s", (char *)data); } + +static void +print_version(void *data __unused) +{ + int len; + + /* Strip a trailing newline from version. */ + len = strlen(version); + while (len > 0 && version[len - 1] == '\n') + len--; + printf("%.*s %s\n", len, version, machine); +} + SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t, copyright); SYSINIT(trademark, SI_SUB_COPYRIGHT, SI_ORDER_SECOND, print_caddr_t, trademark); -SYSINIT(version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, print_caddr_t, version); +SYSINIT(version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, print_version, NULL); #ifdef WITNESS static char wit_warn[] = From avg at FreeBSD.org Sun Nov 1 17:54:49 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Sun Nov 1 17:55:00 2009 Subject: svn commit: r198762 - in stable/7/sys: . contrib/pf i386/conf Message-ID: <200911011754.nA1HsngE030186@svn.freebsd.org> Author: avg Date: Sun Nov 1 17:54:49 2009 New Revision: 198762 URL: http://svn.freebsd.org/changeset/base/198762 Log: MFC 198271: add amdtemp to i386 NOTES Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/i386/conf/NOTES Modified: stable/7/sys/i386/conf/NOTES ============================================================================== --- stable/7/sys/i386/conf/NOTES Sun Nov 1 17:53:33 2009 (r198761) +++ stable/7/sys/i386/conf/NOTES Sun Nov 1 17:54:49 2009 (r198762) @@ -870,8 +870,10 @@ device ichwd # Temperature sensors: # # coretemp: on-die sensor on Intel Core and newer CPUs +# amdtemp: on-die sensor on AMD K8/K10/K11 CPUs # device coretemp +device amdtemp #--------------------------------------------------------------------------- # ISDN4BSD From avg at FreeBSD.org Sun Nov 1 17:58:57 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Sun Nov 1 17:59:13 2009 Subject: svn commit: r198764 - in stable/7/sys: . contrib/pf modules Message-ID: <200911011758.nA1HwvF8030392@svn.freebsd.org> Author: avg Date: Sun Nov 1 17:58:56 2009 New Revision: 198764 URL: http://svn.freebsd.org/changeset/base/198764 Log: MFC 198279: fix sorting of some amd* entries in some makefiles Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/modules/Makefile Modified: stable/7/sys/modules/Makefile ============================================================================== --- stable/7/sys/modules/Makefile Sun Nov 1 17:56:45 2009 (r198763) +++ stable/7/sys/modules/Makefile Sun Nov 1 17:58:56 2009 (r198764) @@ -16,10 +16,10 @@ SUBDIR= ${_3dfx} \ ${_aic} \ aic7xxx \ aio \ - ${_amd} \ - ${_amdtemp} \ alc \ ale \ + ${_amd} \ + ${_amdtemp} \ amr \ ${_an} \ ${_aout} \ From avg at FreeBSD.org Sun Nov 1 18:19:01 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Sun Nov 1 18:19:17 2009 Subject: svn commit: r198767 - stable/7/share/man/man4 Message-ID: <200911011819.nA1IJ0pq031144@svn.freebsd.org> Author: avg Date: Sun Nov 1 18:19:00 2009 New Revision: 198767 URL: http://svn.freebsd.org/changeset/base/198767 Log: MFC 198272, 198288: fix watchdogd(8) reference Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/ichwd.4 Modified: stable/7/share/man/man4/ichwd.4 ============================================================================== --- stable/7/share/man/man4/ichwd.4 Sun Nov 1 18:16:55 2009 (r198766) +++ stable/7/share/man/man4/ichwd.4 Sun Nov 1 18:19:00 2009 (r198767) @@ -66,7 +66,7 @@ it believes the WDT is disabled. .Sh SEE ALSO .Xr watchdog 4 , .Xr watchdog 8 , -.Xr watchdogd 8, +.Xr watchdogd 8 , .Xr watchdog 9 .Rs .%T Using the Intel ICH Family Watchdog Timer (WDT) From avg at FreeBSD.org Sun Nov 1 18:40:03 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Sun Nov 1 18:40:20 2009 Subject: svn commit: r198770 - in stable/7/sys: . amd64/pci contrib/pf dev/pci i386/pci Message-ID: <200911011840.nA1Ie3jC031779@svn.freebsd.org> Author: avg Date: Sun Nov 1 18:40:03 2009 New Revision: 198770 URL: http://svn.freebsd.org/changeset/base/198770 Log: MFC 197450: number of cleanups in i386 and amd64 pci md code Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/pci/pci_cfgreg.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/pci/pcireg.h stable/7/sys/i386/pci/pci_cfgreg.c Modified: stable/7/sys/amd64/pci/pci_cfgreg.c ============================================================================== --- stable/7/sys/amd64/pci/pci_cfgreg.c Sun Nov 1 18:39:26 2009 (r198769) +++ stable/7/sys/amd64/pci/pci_cfgreg.c Sun Nov 1 18:40:03 2009 (r198770) @@ -181,9 +181,9 @@ pci_cfgenable(unsigned bus, unsigned slo { int dataport = 0; - if (bus <= PCI_BUSMAX && slot < 32 && func <= PCI_FUNCMAX && - reg <= PCI_REGMAX && bytes != 3 && (unsigned) bytes <= 4 && - (reg & (bytes - 1)) == 0) { + if (bus <= PCI_BUSMAX && slot <= PCI_SLOTMAX && func <= PCI_FUNCMAX && + (unsigned)reg <= PCI_REGMAX && bytes != 3 && + (unsigned)bytes <= 4 && (reg & (bytes - 1)) == 0) { outl(CONF1_ADDR_PORT, (1 << 31) | (bus << 16) | (slot << 11) | (func << 8) | (reg & ~0x03)); dataport = CONF1_DATA_PORT + (reg & 0x03); @@ -281,7 +281,7 @@ pcie_cfgregopen(uint64_t base, uint8_t m * fall back to using type 1 config access instead. */ if (pci_cfgregopen() != 0) { - for (slot = 0; slot < 32; slot++) { + for (slot = 0; slot <= PCI_SLOTMAX; slot++) { val1 = pcireg_cfgread(0, slot, 0, 0, 4); if (val1 == 0xffffffff) continue; @@ -309,8 +309,8 @@ pciereg_cfgread(int bus, unsigned slot, volatile vm_offset_t va; int data = -1; - if (bus < pcie_minbus || bus > pcie_maxbus || slot >= 32 || - func > PCI_FUNCMAX || reg >= 0x1000) + if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX || + func > PCI_FUNCMAX || reg > PCIE_REGMAX) return (-1); va = PCIE_VADDR(pcie_base, reg, bus, slot, func); @@ -336,8 +336,8 @@ pciereg_cfgwrite(int bus, unsigned slot, { volatile vm_offset_t va; - if (bus < pcie_minbus || bus > pcie_maxbus || slot >= 32 || - func > PCI_FUNCMAX || reg >= 0x1000) + if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX || + func > PCI_FUNCMAX || reg > PCIE_REGMAX) return; va = PCIE_VADDR(pcie_base, reg, bus, slot, func); Modified: stable/7/sys/dev/pci/pcireg.h ============================================================================== --- stable/7/sys/dev/pci/pcireg.h Sun Nov 1 18:39:26 2009 (r198769) +++ stable/7/sys/dev/pci/pcireg.h Sun Nov 1 18:40:03 2009 (r198770) @@ -44,6 +44,7 @@ #define PCI_SLOTMAX 31 /* highest supported slot number */ #define PCI_FUNCMAX 7 /* highest supported function number */ #define PCI_REGMAX 255 /* highest supported config register addr. */ +#define PCIE_REGMAX 4095 /* highest supported config register addr. */ #define PCI_MAXHDRTYPE 2 /* PCI config header registers for all devices */ Modified: stable/7/sys/i386/pci/pci_cfgreg.c ============================================================================== --- stable/7/sys/i386/pci/pci_cfgreg.c Sun Nov 1 18:39:26 2009 (r198769) +++ stable/7/sys/i386/pci/pci_cfgreg.c Sun Nov 1 18:40:03 2009 (r198770) @@ -291,9 +291,9 @@ pci_cfgenable(unsigned bus, unsigned slo if (bus <= PCI_BUSMAX && slot < devmax && func <= PCI_FUNCMAX - && reg <= PCI_REGMAX + && (unsigned)reg <= PCI_REGMAX && bytes != 3 - && (unsigned) bytes <= 4 + && (unsigned)bytes <= 4 && (reg & (bytes - 1)) == 0) { switch (cfgmech) { case CFGMECH_PCIE: @@ -586,7 +586,7 @@ pcie_cfgregopen(uint64_t base, uint8_t m * fall back to using type 1 config access instead. */ if (pci_cfgregopen() != 0) { - for (slot = 0; slot < 32; slot++) { + for (slot = 0; slot <= PCI_SLOTMAX; slot++) { val1 = pcireg_cfgread(0, slot, 0, 0, 4); if (val1 == 0xffffffff) continue; @@ -651,8 +651,8 @@ pciereg_cfgread(int bus, unsigned slot, vm_paddr_t pa, papage; int data = -1; - if (bus < pcie_minbus || bus > pcie_maxbus || slot >= 32 || - func > PCI_FUNCMAX || reg >= 0x1000 || bytes > 4 || bytes == 3) + if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX || + func > PCI_FUNCMAX || reg > PCIE_REGMAX) return (-1); critical_enter(); @@ -685,8 +685,8 @@ pciereg_cfgwrite(int bus, unsigned slot, volatile vm_offset_t va; vm_paddr_t pa, papage; - if (bus < pcie_minbus || bus > pcie_maxbus || slot >= 32 || - func > PCI_FUNCMAX || reg >= 0x1000) + if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX || + func > PCI_FUNCMAX || reg > PCIE_REGMAX) return; critical_enter(); From fjoe at FreeBSD.org Mon Nov 2 09:47:41 2009 From: fjoe at FreeBSD.org (Max Khon) Date: Mon Nov 2 09:47:54 2009 Subject: svn commit: r198784 - stable/7/sys/tools Message-ID: <200911020947.nA29lfNG051881@svn.freebsd.org> Author: fjoe Date: Mon Nov 2 09:47:41 2009 New Revision: 198784 URL: http://svn.freebsd.org/changeset/base/198784 Log: MFC: Allow KMOD with hypens and dots. Modified: stable/7/sys/tools/fw_stub.awk Modified: stable/7/sys/tools/fw_stub.awk ============================================================================== --- stable/7/sys/tools/fw_stub.awk Mon Nov 2 09:47:15 2009 (r198783) +++ stable/7/sys/tools/fw_stub.awk Mon Nov 2 09:47:41 2009 (r198784) @@ -118,6 +118,8 @@ if (!num_files || !opt_m) cfilename = opt_c; ctmpfilename = cfilename ".tmp"; +modname = opt_m; +gsub(/[-\.]/, "_", modname); printc("#include \ #include \ @@ -139,7 +141,7 @@ for (file_i = 0; file_i < num_files; fil } printc("\nstatic int\n"\ -opt_m "_fw_modevent(module_t mod, int type, void *unused)\ +modname "_fw_modevent(module_t mod, int type, void *unused)\ {\ const struct firmware *fp, *parent;\ int error;\ @@ -206,14 +208,14 @@ printc("\t\treturn (error);\ return (EINVAL);\ }\ \ -static moduledata_t " opt_m "_fw_mod = {\ - \"" opt_m "_fw\",\ - " opt_m "_fw_modevent,\ +static moduledata_t " modname "_fw_mod = {\ + \"" modname "_fw\",\ + " modname "_fw_modevent,\ 0\ };\ -DECLARE_MODULE(" opt_m "_fw, " opt_m "_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\ -MODULE_VERSION(" opt_m "_fw, 1);\ -MODULE_DEPEND(" opt_m "_fw, firmware, 1, 1, 1);\ +DECLARE_MODULE(" modname "_fw, " modname "_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\ +MODULE_VERSION(" modname "_fw, 1);\ +MODULE_DEPEND(" modname "_fw, firmware, 1, 1, 1);\ "); if (opt_c) From rnoland at FreeBSD.org Mon Nov 2 15:54:41 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Mon Nov 2 15:55:18 2009 Subject: svn commit: r198793 - in stable/7/sys: . contrib/pf dev/drm Message-ID: <200911021554.nA2FsfbD061435@svn.freebsd.org> Author: rnoland Date: Mon Nov 2 15:54:41 2009 New Revision: 198793 URL: http://svn.freebsd.org/changeset/base/198793 Log: MFC 198691 Fix blitter support for RS880 chips Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/drm/r600_blit.c Modified: stable/7/sys/dev/drm/r600_blit.c ============================================================================== --- stable/7/sys/dev/drm/r600_blit.c Mon Nov 2 15:53:32 2009 (r198792) +++ stable/7/sys/dev/drm/r600_blit.c Mon Nov 2 15:54:41 2009 (r198793) @@ -1367,7 +1367,7 @@ set_vtx_resource(drm_radeon_private_t *d if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780) || - /*((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880) ||*/ + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880) || ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV710)) cp_set_surface_sync(dev_priv, R600_TC_ACTION_ENA, 48, gpu_addr); @@ -1509,7 +1509,7 @@ set_default_state(drm_radeon_private_t * case CHIP_RV610: case CHIP_RV620: case CHIP_RS780: - /*case CHIP_RS880:*/ + case CHIP_RS880: default: num_ps_gprs = 84; num_vs_gprs = 36; @@ -1591,7 +1591,7 @@ set_default_state(drm_radeon_private_t * if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780) || - /*((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880) ||*/ + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880) || ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV710)) sq_config = 0; else From rnoland at FreeBSD.org Mon Nov 2 16:00:20 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Mon Nov 2 16:02:39 2009 Subject: svn commit: r198796 - in stable/7/sys: . contrib/pf dev/drm Message-ID: <200911021600.nA2G01HF061711@svn.freebsd.org> Author: rnoland Date: Mon Nov 2 16:00:01 2009 New Revision: 198796 URL: http://svn.freebsd.org/changeset/base/198796 Log: MFC 198695 A bit of cleanup work on radeon_freelist_get() * Fix the main loop to search all buffers before sleeping. * Remove dead code Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/drm/radeon_cp.c Modified: stable/7/sys/dev/drm/radeon_cp.c ============================================================================== --- stable/7/sys/dev/drm/radeon_cp.c Mon Nov 2 15:59:55 2009 (r198795) +++ stable/7/sys/dev/drm/radeon_cp.c Mon Nov 2 16:00:01 2009 (r198796) @@ -1860,8 +1860,8 @@ struct drm_buf *radeon_freelist_get(stru for (t = 0; t < dev_priv->usec_timeout; t++) { u32 done_age = GET_SCRATCH(dev_priv, 1); DRM_DEBUG("done_age = %d\n", done_age); - for (i = start; i < dma->buf_count; i++) { - buf = dma->buflist[i]; + for (i = 0; i < dma->buf_count; i++) { + buf = dma->buflist[start]; buf_priv = buf->dev_private; if (buf->file_priv == NULL || (buf->pending && buf_priv->age <= @@ -1870,7 +1870,8 @@ struct drm_buf *radeon_freelist_get(stru buf->pending = 0; return buf; } - start = 0; + if (++start >= dma->buf_count) + start = 0; } if (t) { @@ -1879,47 +1880,9 @@ struct drm_buf *radeon_freelist_get(stru } } - DRM_DEBUG("returning NULL!\n"); return NULL; } -#if 0 -struct drm_buf *radeon_freelist_get(struct drm_device * dev) -{ - struct drm_device_dma *dma = dev->dma; - drm_radeon_private_t *dev_priv = dev->dev_private; - drm_radeon_buf_priv_t *buf_priv; - struct drm_buf *buf; - int i, t; - int start; - u32 done_age; - - done_age = radeon_read_ring_rptr(dev_priv, RADEON_SCRATCHOFF(1)); - if (++dev_priv->last_buf >= dma->buf_count) - dev_priv->last_buf = 0; - - start = dev_priv->last_buf; - dev_priv->stats.freelist_loops++; - - for (t = 0; t < 2; t++) { - for (i = start; i < dma->buf_count; i++) { - buf = dma->buflist[i]; - buf_priv = buf->dev_private; - if (buf->file_priv == 0 || (buf->pending && - buf_priv->age <= - done_age)) { - dev_priv->stats.requested_bufs++; - buf->pending = 0; - return buf; - } - } - start = 0; - } - - return NULL; -} -#endif - void radeon_freelist_reset(struct drm_device * dev) { struct drm_device_dma *dma = dev->dma; From rnoland at FreeBSD.org Mon Nov 2 16:02:37 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Mon Nov 2 16:03:37 2009 Subject: svn commit: r198798 - in stable/7/sys: . contrib/pf dev/drm Message-ID: <200911021602.nA2G2a82061875@svn.freebsd.org> Author: rnoland Date: Mon Nov 2 16:02:36 2009 New Revision: 198798 URL: http://svn.freebsd.org/changeset/base/198798 Log: MFC 198696 Cleanup in r600_blit - Don't bother to assign vb until we know we have enough space - Add variables for sx2, sy2, dx2, dy2 so that these aren't calculated over and over, also reduce chance of errors. - Use switch to assign color/format Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/drm/r600_blit.c Modified: stable/7/sys/dev/drm/r600_blit.c ============================================================================== --- stable/7/sys/dev/drm/r600_blit.c Mon Nov 2 16:02:16 2009 (r198797) +++ stable/7/sys/dev/drm/r600_blit.c Mon Nov 2 16:02:36 2009 (r198798) @@ -1719,7 +1719,10 @@ r600_blit_copy(struct drm_device *dev, u32 *vb; vb = (u32 *) ((char *)dev->agp_buffer_map->handle + - dev_priv->blit_vb->offset + dev_priv->blit_vb->used); + dev_priv->blit_vb->offset + dev_priv->blit_vb->used); + DRM_DEBUG("src=0x%016llx, dst=0x%016llx, size=%d\n", + (unsigned long long)src_gpu_addr, + (unsigned long long)dst_gpu_addr, size_bytes); if ((size_bytes & 3) || (src_gpu_addr & 3) || (dst_gpu_addr & 3)) { max_bytes = 8192; @@ -1757,7 +1760,7 @@ r600_blit_copy(struct drm_device *dev, return; set_shaders(dev); vb = (u32 *) ((char *)dev->agp_buffer_map->handle + - dev_priv->blit_vb->offset + dev_priv->blit_vb->used); + dev_priv->blit_vb->offset + dev_priv->blit_vb->used); } vb[0] = i2f(dst_x); @@ -1847,7 +1850,7 @@ r600_blit_copy(struct drm_device *dev, return; set_shaders(dev); vb = (u32 *) ((char *)dev->agp_buffer_map->handle + - dev_priv->blit_vb->offset + dev_priv->blit_vb->used); + dev_priv->blit_vb->offset + dev_priv->blit_vb->used); } vb[0] = i2f(dst_x / 4); @@ -1913,12 +1916,10 @@ r600_blit_swap(struct drm_device *dev, { drm_radeon_private_t *dev_priv = dev->dev_private; int cb_format, tex_format; + int sx2, sy2, dx2, dy2; u64 vb_addr; u32 *vb; - vb = (u32 *) ((char *)dev->agp_buffer_map->handle + - dev_priv->blit_vb->offset + dev_priv->blit_vb->used); - if ((dev_priv->blit_vb->used + 48) > dev_priv->blit_vb->total) { dev_priv->blit_vb->used = 0; radeon_cp_discard_buffer(dev, dev_priv->blit_vb); @@ -1926,20 +1927,14 @@ r600_blit_swap(struct drm_device *dev, if (!dev_priv->blit_vb) return; set_shaders(dev); - vb = (u32 *) ((char *)dev->agp_buffer_map->handle + - dev_priv->blit_vb->offset + dev_priv->blit_vb->used); } + vb = (u32 *) ((char *)dev->agp_buffer_map->handle + + dev_priv->blit_vb->offset + dev_priv->blit_vb->used); - if (cpp == 4) { - cb_format = COLOR_8_8_8_8; - tex_format = FMT_8_8_8_8; - } else if (cpp == 2) { - cb_format = COLOR_5_6_5; - tex_format = FMT_5_6_5; - } else { - cb_format = COLOR_8; - tex_format = FMT_8; - } + sx2 = sx + w; + sy2 = sy + h; + dx2 = dx + w; + dy2 = dy + h; vb[0] = i2f(dx); vb[1] = i2f(dy); @@ -1947,31 +1942,46 @@ r600_blit_swap(struct drm_device *dev, vb[3] = i2f(sy); vb[4] = i2f(dx); - vb[5] = i2f(dy + h); + vb[5] = i2f(dy2); vb[6] = i2f(sx); - vb[7] = i2f(sy + h); + vb[7] = i2f(sy2); + + vb[8] = i2f(dx2); + vb[9] = i2f(dy2); + vb[10] = i2f(sx2); + vb[11] = i2f(sy2); - vb[8] = i2f(dx + w); - vb[9] = i2f(dy + h); - vb[10] = i2f(sx + w); - vb[11] = i2f(sy + h); + switch(cpp) { + case 4: + cb_format = COLOR_8_8_8_8; + tex_format = FMT_8_8_8_8; + break; + case 2: + cb_format = COLOR_5_6_5; + tex_format = FMT_5_6_5; + break; + default: + cb_format = COLOR_8; + tex_format = FMT_8; + break; + } /* src */ set_tex_resource(dev_priv, tex_format, src_pitch / cpp, - sy + h, src_pitch / cpp, + sy2, src_pitch / cpp, src_gpu_addr); cp_set_surface_sync(dev_priv, - R600_TC_ACTION_ENA, (src_pitch * (sy + h)), src_gpu_addr); + R600_TC_ACTION_ENA, src_pitch * sy2, src_gpu_addr); /* dst */ set_render_target(dev_priv, cb_format, - dst_pitch / cpp, dy + h, + dst_pitch / cpp, dy2, dst_gpu_addr); /* scissors */ - set_scissors(dev_priv, dx, dy, dx + w, dy + h); + set_scissors(dev_priv, dx, dy, dx2, dy2); /* Vertex buffer setup */ vb_addr = dev_priv->gart_buffers_offset + @@ -1984,7 +1994,7 @@ r600_blit_swap(struct drm_device *dev, cp_set_surface_sync(dev_priv, R600_CB_ACTION_ENA | R600_CB0_DEST_BASE_ENA, - dst_pitch * (dy + h), dst_gpu_addr); + dst_pitch * dy2, dst_gpu_addr); dev_priv->blit_vb->used += 12 * 4; } From emaste at FreeBSD.org Mon Nov 2 16:25:01 2009 From: emaste at FreeBSD.org (Ed Maste) Date: Mon Nov 2 16:25:08 2009 Subject: svn commit: r198800 - in stable/7/sys: . contrib/pf dev/aac Message-ID: <200911021625.nA2GP1cL062486@svn.freebsd.org> Author: emaste Date: Mon Nov 2 16:25:00 2009 New Revision: 198800 URL: http://svn.freebsd.org/changeset/base/198800 Log: MFC r198541: Do first controller time sync after 1 minute, as in Adaptec's vendor driver. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/aac/aac.c Modified: stable/7/sys/dev/aac/aac.c ============================================================================== --- stable/7/sys/dev/aac/aac.c Mon Nov 2 16:22:59 2009 (r198799) +++ stable/7/sys/dev/aac/aac.c Mon Nov 2 16:25:00 2009 (r198800) @@ -354,7 +354,7 @@ aac_attach(struct aac_softc *sc) } mtx_lock(&sc->aac_io_lock); - callout_reset(&sc->aac_daemontime, 30 * 60 * hz, aac_daemon, sc); + callout_reset(&sc->aac_daemontime, 60 * hz, aac_daemon, sc); mtx_unlock(&sc->aac_io_lock); return(0); From emaste at FreeBSD.org Mon Nov 2 16:29:04 2009 From: emaste at FreeBSD.org (Ed Maste) Date: Mon Nov 2 16:29:15 2009 Subject: svn commit: r198803 - in stable/7/usr.sbin/ntp: . doc Message-ID: <200911021629.nA2GT4jq062726@svn.freebsd.org> Author: emaste Date: Mon Nov 2 16:29:04 2009 New Revision: 198803 URL: http://svn.freebsd.org/changeset/base/198803 Log: MFC r198029: Correct typo: thetime -> the time PR: docs/139447 Submitted by: Guido Falsi mad at madpilot dot net Modified: stable/7/usr.sbin/ntp/ (props changed) stable/7/usr.sbin/ntp/doc/ntpd.8 Modified: stable/7/usr.sbin/ntp/doc/ntpd.8 ============================================================================== --- stable/7/usr.sbin/ntp/doc/ntpd.8 Mon Nov 2 16:27:34 2009 (r198802) +++ stable/7/usr.sbin/ntp/doc/ntpd.8 Mon Nov 2 16:29:04 2009 (r198803) @@ -121,7 +121,7 @@ Normally, .Nm exits with a message to the system log if the offset exceeds the panic threshold, which is 1000 s by default. -This option allows thetime to be set to any value without restriction; +This option allows the time to be set to any value without restriction; however, this can happen only once. If the threshold is exceeded after that, .Nm From emaste at FreeBSD.org Mon Nov 2 16:46:54 2009 From: emaste at FreeBSD.org (Ed Maste) Date: Mon Nov 2 16:47:05 2009 Subject: svn commit: r198807 - in stable/7/sys: . boot/i386/libi386 contrib/pf Message-ID: <200911021646.nA2GkrCk063272@svn.freebsd.org> Author: emaste Date: Mon Nov 2 16:46:53 2009 New Revision: 198807 URL: http://svn.freebsd.org/changeset/base/198807 Log: MFC r197082: If the pxe client is told to use / as the root path, honour that rather of trying to mount /pxeroot instead. PR: i386/106493 Submitted by: Andrey Russev Modified: stable/7/sys/ (props changed) stable/7/sys/boot/i386/libi386/pxe.c stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/i386/libi386/pxe.c ============================================================================== --- stable/7/sys/boot/i386/libi386/pxe.c Mon Nov 2 16:46:06 2009 (r198806) +++ stable/7/sys/boot/i386/libi386/pxe.c Mon Nov 2 16:46:53 2009 (r198807) @@ -282,7 +282,7 @@ pxe_open(struct open_file *f, ...) bootp(pxe_sock, BOOTP_PXE); if (rootip.s_addr == 0) rootip.s_addr = bootplayer.sip; - if (!rootpath[1]) + if (!rootpath[0]) strcpy(rootpath, PXENFSROOTPATH); for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) From emaste at FreeBSD.org Mon Nov 2 16:55:34 2009 From: emaste at FreeBSD.org (Ed Maste) Date: Mon Nov 2 16:56:29 2009 Subject: svn commit: r198810 - in stable/7/sys: . contrib/pf dev/aac Message-ID: <200911021655.nA2GtYrg063605@svn.freebsd.org> Author: emaste Date: Mon Nov 2 16:55:33 2009 New Revision: 198810 URL: http://svn.freebsd.org/changeset/base/198810 Log: MFC r197011: Increase AAC_CMD_TIMEOUT from 30s to 120s to help avoid spurious "COMMAND 0x........ TIMEOUT AFTER .. SECONDS" messages. Any commands that get truly stuck will still trigger the warning and the hardware health check, just a little bit later. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/aac/aacvar.h Modified: stable/7/sys/dev/aac/aacvar.h ============================================================================== --- stable/7/sys/dev/aac/aacvar.h Mon Nov 2 16:54:23 2009 (r198809) +++ stable/7/sys/dev/aac/aacvar.h Mon Nov 2 16:55:33 2009 (r198810) @@ -88,7 +88,7 @@ /* * Timeout for normal commands */ -#define AAC_CMD_TIMEOUT 30 /* seconds */ +#define AAC_CMD_TIMEOUT 120 /* seconds */ /* * Rate at which we periodically check for timed out commands and kick the From edwin at FreeBSD.org Wed Nov 4 10:47:09 2009 From: edwin at FreeBSD.org (Edwin Groothuis) Date: Wed Nov 4 10:47:42 2009 Subject: svn commit: r198880 - stable/7/share/zoneinfo Message-ID: <200911041047.nA4Al91C028857@svn.freebsd.org> Author: edwin Date: Wed Nov 4 10:47:09 2009 New Revision: 198880 URL: http://svn.freebsd.org/changeset/base/198880 Log: MFC of r198825: tzdata2009q - New region: Asia/Novokuznetsk - Kemerovo oblast' (Kemerovo region) in Russia will change current time zone on 29 March 2010 - Add historical data for Hongkong 1941 - 1980 - Syria will go to winter time in the last weekend of October 2009. Modified: stable/7/share/zoneinfo/asia stable/7/share/zoneinfo/europe stable/7/share/zoneinfo/zone.tab Directory Properties: stable/7/share/zoneinfo/ (props changed) Modified: stable/7/share/zoneinfo/asia ============================================================================== --- stable/7/share/zoneinfo/asia Wed Nov 4 10:47:02 2009 (r198879) +++ stable/7/share/zoneinfo/asia Wed Nov 4 10:47:09 2009 (r198880) @@ -1,5 +1,4 @@ -#
-# @(#)asia	8.42
+# @(#)asia	8.44
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -369,14 +368,84 @@ Zone	Asia/Kashgar	5:03:56	-	LMT	1928 # o
 			5:00	-	KAST	1980 May
 			8:00	PRC	C%sT
 
+
+# From Lee Yiu Chung (2009-10-24):
+# I found there are some mistakes for the historial DST rule for Hong
+# Kong. Accoring to the DST record from Hong Kong Observatory (actually,
+# it is not [an] observatory, but the official meteorological agency of HK,
+# and also serves as the official timing agency), there are some missing
+# and incorrect rules. Although the exact switch over time is missing, I
+# think 3:30 is correct. The official DST record for Hong Kong can be
+# obtained from
+# 
+# http://www.hko.gov.hk/gts/time/Summertime.htm
+# .
+
+# From Arthur David Olson (2009-10-28):
+# Here are the dates given at
+# 
+# http://www.hko.gov.hk/gts/time/Summertime.htm
+# 
+# as of 2009-10-28:
+# Year        Period
+# 1941        1 Apr to 30 Sep
+# 1942        Whole year 
+# 1943        Whole year
+# 1944        Whole year
+# 1945        Whole year
+# 1946        20 Apr to 1 Dec
+# 1947        13 Apr to 30 Dec
+# 1948        2 May to 31 Oct
+# 1949        3 Apr to 30 Oct
+# 1950        2 Apr to 29 Oct
+# 1951        1 Apr to 28 Oct
+# 1952        6 Apr to 25 Oct
+# 1953        5 Apr to 1 Nov
+# 1954        21 Mar to 31 Oct
+# 1955        20 Mar to 6 Nov
+# 1956        18 Mar to 4 Nov
+# 1957        24 Mar to 3 Nov
+# 1958        23 Mar to 2 Nov
+# 1959        22 Mar to 1 Nov
+# 1960        20 Mar to 6 Nov
+# 1961        19 Mar to 5 Nov
+# 1962        18 Mar to 4 Nov
+# 1963        24 Mar to 3 Nov
+# 1964        22 Mar to 1 Nov
+# 1965        18 Apr to 17 Oct
+# 1966        17 Apr to 16 Oct
+# 1967        16 Apr to 22 Oct
+# 1968        21 Apr to 20 Oct
+# 1969        20 Apr to 19 Oct
+# 1970        19 Apr to 18 Oct
+# 1971        18 Apr to 17 Oct
+# 1972        16 Apr to 22 Oct
+# 1973        22 Apr to 21 Oct
+# 1973/74     30 Dec 73 to 20 Oct 74
+# 1975        20 Apr to 19 Oct
+# 1976        18 Apr to 17 Oct
+# 1977        Nil
+# 1978        Nil
+# 1979        13 May to 21 Oct
+# 1980 to Now Nil
+# The page does not give start or end times of day.
+# The page does not give a start date for 1942.
+# The page does not givw an end date for 1945.
+# The Japanese occupation of Hong Kong began on 1941-12-25.
+# The Japanese surrender of Hong Kong was signed 1945-09-15.
+# For lack of anything better, use start of those days as the transition times.
+
 # Hong Kong (Xianggang)
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
+Rule	HK	1941	only	-	Apr	1	3:30	1:00	S
+Rule	HK	1941	only	-	Sep	30	3:30	0	-
 Rule	HK	1946	only	-	Apr	20	3:30	1:00	S
 Rule	HK	1946	only	-	Dec	1	3:30	0	-
 Rule	HK	1947	only	-	Apr	13	3:30	1:00	S
 Rule	HK	1947	only	-	Dec	30	3:30	0	-
 Rule	HK	1948	only	-	May	2	3:30	1:00	S
-Rule	HK	1948	1952	-	Oct	lastSun	3:30	0	-
+Rule	HK	1948	1951	-	Oct	lastSun	3:30	0	-
+Rule	HK	1952	only	-	Oct	25	3:30	0	-
 Rule	HK	1949	1953	-	Apr	Sun>=1	3:30	1:00	S
 Rule	HK	1953	only	-	Nov	1	3:30	0	-
 Rule	HK	1954	1964	-	Mar	Sun>=18	3:30	1:00	S
@@ -384,13 +453,15 @@ Rule	HK	1954	only	-	Oct	31	3:30	0	-
 Rule	HK	1955	1964	-	Nov	Sun>=1	3:30	0	-
 Rule	HK	1965	1977	-	Apr	Sun>=16	3:30	1:00	S
 Rule	HK	1965	1977	-	Oct	Sun>=16	3:30	0	-
-Rule	HK	1979	1980	-	May	Sun>=8	3:30	1:00	S
-Rule	HK	1979	1980	-	Oct	Sun>=16	3:30	0	-
+Rule	HK	1973	only	-	Dec	30	3:30	1:00	S
+Rule	HK	1979	only	-	May	Sun>=8	3:30	1:00	S
+Rule	HK	1979	only	-	Oct	Sun>=16	3:30	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Hong_Kong	7:36:36 -	LMT	1904 Oct 30
+			8:00	HK	HK%sT	1941 Dec 25
+			9:00	-	JST	1945 Sep 15
 			8:00	HK	HK%sT
 
-
 ###############################################################################
 
 # Taiwan
@@ -2236,9 +2307,23 @@ Rule	Syria	2007	only	-	Nov	 Fri>=1	0:00	
 # http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html
 # 
 
+# From Steffen Thorsen (2009-10-27):
+# The Syrian Arab News Network on 2009-09-29 reported that Syria will 
+# revert back to winter (standard) time on midnight between Thursday 
+# 2009-10-29 and Friday 2009-10-30:
+# 
+# http://www.sana.sy/ara/2/2009/09/29/247012.htm (Arabic)
+# 
+
+# From Arthur David Olson (2009-10-28):
+# We'll see if future DST switching times turn out to be end of the last
+# Thursday of the month or the start of the last Friday of the month or
+# something else. For now, use the start of the last Friday.
+
 Rule	Syria	2008	only	-	Apr	Fri>=1	0:00	1:00	S
-Rule	Syria	2008	max	-	Nov	1	0:00	0	-
+Rule	Syria	2008	only	-	Nov	1	0:00	0	-
 Rule	Syria	2009	max	-	Mar	lastFri	0:00	1:00	S
+Rule	Syria	2009	max	-	Oct	lastFri	0:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Damascus	2:25:12 -	LMT	1920	# Dimashq

Modified: stable/7/share/zoneinfo/europe
==============================================================================
--- stable/7/share/zoneinfo/europe	Wed Nov  4 10:47:02 2009	(r198879)
+++ stable/7/share/zoneinfo/europe	Wed Nov  4 10:47:09 2009	(r198880)
@@ -1,5 +1,5 @@
 # 
-# @(#)europe	8.22
+# @(#)europe	8.24
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -2072,9 +2072,43 @@ Zone Asia/Novosibirsk	 5:31:40 -	LMT	191
 			 6:00	Russia	NOV%sT	1992 Jan 19 2:00s
 			 7:00	Russia	NOV%sT	1993 May 23 # say Shanks & P.
 			 6:00	Russia	NOV%sT
+
+# From Alexander Krivenyshev (2009-10-13):
+# Kemerovo oblast' (Kemerovo region) in Russia will change current time zone on
+# March 28, 2010:
+# from current Russia Zone 6 - Krasnoyarsk Time Zone (KRA) UTC +0700
+# to Russia Zone 5 - Novosibirsk Time Zone (NOV) UTC +0600
+#
+# This is according to Government of Russia decree # 740, on September
+# 14, 2009 "Application in the territory of the Kemerovo region the Fifth
+# time zone." ("Russia Zone 5" or old "USSR Zone 5" is GMT +0600)
+#
+# Russian Government web site (Russian language)
+# 
+# http://www.government.ru/content/governmentactivity/rfgovernmentdecisions/archive/2009/09/14/991633.htm
+# 
+# or Russian-English translation by WorldTimeZone.com with reference
+# map to local region and new Russia Time Zone map after March 28, 2010
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_russia03.html
+# 
+#
+# Thus, when Russia will switch to DST on the night of March 28, 2010
+# Kemerovo region (Kemerovo oblast') will not change the clock.
+#
+# As a result, Kemerovo oblast' will be in the same time zone as
+# Novosibirsk, Omsk, Tomsk, Barnaul and Altai Republic.
+
+Zone Asia/Novokuznetsk	 5:48:48 -	NMT	1920 Jan  6
+			 6:00	-	KRAT	1930 Jun 21 # Krasnoyarsk Time
+			 7:00	Russia	KRA%sT	1991 Mar 31 2:00s
+			 6:00	Russia	KRA%sT	1992 Jan 19 2:00s
+			 7:00	Russia	KRA%sT	2010 Mar 28 2:00s
+			 6:00	Russia	NOV%sT # Novosibirsk/Novokuznetsk Time
+
 #
 # From Oscar van Vlijmen (2001-08-25): [This region consists of]
-# Kemerovskaya oblast', Krasnoyarskij kraj,
+# Krasnoyarskij kraj,
 # Tajmyrskij (Dolgano-Nenetskij) avtonomnyj okrug,
 # Respublika Tuva, Respublika Khakasiya, Evenkijskij avtonomnyj okrug.
 Zone Asia/Krasnoyarsk	 6:11:20 -	LMT	1920 Jan  6

Modified: stable/7/share/zoneinfo/zone.tab
==============================================================================
--- stable/7/share/zoneinfo/zone.tab	Wed Nov  4 10:47:02 2009	(r198879)
+++ stable/7/share/zoneinfo/zone.tab	Wed Nov  4 10:47:09 2009	(r198880)
@@ -1,5 +1,5 @@
 # 
-# @(#)zone.tab	8.28
+# @(#)zone.tab	8.29
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 #
@@ -330,6 +330,7 @@ RU	+5312+05009	Europe/Samara	Moscow+01 -
 RU	+5651+06036	Asia/Yekaterinburg	Moscow+02 - Urals
 RU	+5500+07324	Asia/Omsk	Moscow+03 - west Siberia
 RU	+5502+08255	Asia/Novosibirsk	Moscow+03 - Novosibirsk
+RU	+5345+08707	Asia/Novokuznetsk	Moscow+03 - Novokuznetsk
 RU	+5601+09250	Asia/Krasnoyarsk	Moscow+04 - Yenisei River
 RU	+5216+10420	Asia/Irkutsk	Moscow+05 - Lake Baikal
 RU	+6200+12940	Asia/Yakutsk	Moscow+06 - Lena River
From brueffer at FreeBSD.org  Wed Nov  4 12:38:21 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Wed Nov  4 12:38:38 2009
Subject: svn commit: r198882 - stable/7/sys/dev/amr
Message-ID: <200911041238.nA4CcLNP031665@svn.freebsd.org>

Author: brueffer
Date: Wed Nov  4 12:38:21 2009
New Revision: 198882
URL: http://svn.freebsd.org/changeset/base/198882

Log:
  MFC: r198546
  
  Remove spurious `)`

Modified:
  stable/7/sys/dev/amr/amr.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/amr/amr.c
==============================================================================
--- stable/7/sys/dev/amr/amr.c	Wed Nov  4 12:35:35 2009	(r198881)
+++ stable/7/sys/dev/amr/amr.c	Wed Nov  4 12:38:21 2009	(r198882)
@@ -231,7 +231,7 @@ amr_attach(struct amr_softc *sc)
     }
 
 #ifdef AMR_BOARD_INIT
-    if ((AMR_IS_QUARTZ(sc) ? amr_quartz_init(sc) : amr_std_init(sc))))
+    if ((AMR_IS_QUARTZ(sc) ? amr_quartz_init(sc) : amr_std_init(sc)))
 	return(ENXIO);
 #endif
 
From brueffer at FreeBSD.org  Wed Nov  4 13:08:57 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Wed Nov  4 13:09:03 2009
Subject: svn commit: r198885 - stable/7/sys/boot/common
Message-ID: <200911041308.nA4D8v4B032430@svn.freebsd.org>

Author: brueffer
Date: Wed Nov  4 13:08:57 2009
New Revision: 198885
URL: http://svn.freebsd.org/changeset/base/198885

Log:
  MFC: r198537
  
  Close a file descriptor leak in an error case.

Modified:
  stable/7/sys/boot/common/commands.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/boot/common/commands.c
==============================================================================
--- stable/7/sys/boot/common/commands.c	Wed Nov  4 13:06:09 2009	(r198884)
+++ stable/7/sys/boot/common/commands.c	Wed Nov  4 13:08:57 2009	(r198885)
@@ -150,6 +150,7 @@ command_help(int argc, char *argv[]) 
 	break;
     default:
 	command_errmsg = "usage is 'help  []";
+	close(hfd);
 	return(CMD_ERROR);
     }
 
From brueffer at FreeBSD.org  Wed Nov  4 13:32:26 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Wed Nov  4 13:32:43 2009
Subject: svn commit: r198887 - stable/7/sys/netinet/libalias
Message-ID: <200911041332.nA4DWPHK032988@svn.freebsd.org>

Author: brueffer
Date: Wed Nov  4 13:32:25 2009
New Revision: 198887
URL: http://svn.freebsd.org/changeset/base/198887

Log:
  MFC: 198539
  
  Close a stream file descriptor leak.

Modified:
  stable/7/sys/netinet/libalias/alias.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/netinet/libalias/alias.c
==============================================================================
--- stable/7/sys/netinet/libalias/alias.c	Wed Nov  4 13:30:32 2009	(r198886)
+++ stable/7/sys/netinet/libalias/alias.c	Wed Nov  4 13:32:25 2009	(r198887)
@@ -1580,6 +1580,7 @@ LibAliasRefreshModules(void)
 			LibAliasLoadModule(buf);
 		}
 	}
+	fclose(fd);
 	return (0);
 }
 
From brueffer at FreeBSD.org  Wed Nov  4 13:40:51 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Wed Nov  4 13:41:02 2009
Subject: svn commit: r198889 - stable/7/lib/libstand
Message-ID: <200911041340.nA4Depix033252@svn.freebsd.org>

Author: brueffer
Date: Wed Nov  4 13:40:50 2009
New Revision: 198889
URL: http://svn.freebsd.org/changeset/base/198889

Log:
  MFC: r198542
  
  Initialize f_rabuf in the raw device case. A subsequent close()
  later on would try to free it, leading to a crash.

Modified:
  stable/7/lib/libstand/open.c
Directory Properties:
  stable/7/lib/libstand/   (props changed)

Modified: stable/7/lib/libstand/open.c
==============================================================================
--- stable/7/lib/libstand/open.c	Wed Nov  4 13:40:04 2009	(r198888)
+++ stable/7/lib/libstand/open.c	Wed Nov  4 13:40:50 2009	(r198889)
@@ -113,6 +113,7 @@ open(const char *fname, int mode)
     /* see if we opened a raw device; otherwise, 'file' is the file name. */
     if (file == (char *)0 || *file == '\0') {
 	f->f_flags |= F_RAW;
+	f->f_rabuf = NULL;
 	return (fd);
     }
 
From jhb at FreeBSD.org  Wed Nov  4 16:03:59 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Wed Nov  4 16:04:15 2009
Subject: svn commit: r198901 - stable/7/sbin/ddb
Message-ID: <200911041603.nA4G3wGd037461@svn.freebsd.org>

Author: jhb
Date: Wed Nov  4 16:03:58 2009
New Revision: 198901
URL: http://svn.freebsd.org/changeset/base/198901

Log:
  MFC 198585:
  When extracting the capture buffer from a crashdump, only read the valid
  portion of the capture buffer.

Modified:
  stable/7/sbin/ddb/ddb_capture.c
Directory Properties:
  stable/7/sbin/ddb/   (props changed)

Modified: stable/7/sbin/ddb/ddb_capture.c
==============================================================================
--- stable/7/sbin/ddb/ddb_capture.c	Wed Nov  4 16:03:47 2009	(r198900)
+++ stable/7/sbin/ddb/ddb_capture.c	Wed Nov  4 16:03:58 2009	(r198901)
@@ -95,24 +95,24 @@ kread_symbol(kvm_t *kvm, int index, void
 static void
 ddb_capture_print_kvm(kvm_t *kvm)
 {
-	u_int db_capture_bufsize;
+	u_int db_capture_bufoff;
 	char *buffer, *db_capture_buf;
 
 	if (kread_symbol(kvm, X_DB_CAPTURE_BUF, &db_capture_buf,
 	    sizeof(db_capture_buf), 0) < 0)
 		errx(-1, "kvm: unable to read db_capture_buf");
 
-	if (kread_symbol(kvm, X_DB_CAPTURE_BUFSIZE, &db_capture_bufsize,
-	    sizeof(db_capture_bufsize), 0) < 0)
-		errx(-1, "kvm: unable to read db_capture_bufsize");
+	if (kread_symbol(kvm, X_DB_CAPTURE_BUFOFF, &db_capture_bufoff,
+	    sizeof(db_capture_bufoff), 0) < 0)
+		errx(-1, "kvm: unable to read db_capture_bufoff");
 
-	buffer = malloc(db_capture_bufsize + 1);
+	buffer = malloc(db_capture_bufoff + 1);
 	if (buffer == NULL)
-		err(-1, "malloc: db_capture_bufsize (%u)",
-		    db_capture_bufsize);
-	bzero(buffer, db_capture_bufsize + 1);
+		err(-1, "malloc: db_capture_bufoff (%u)",
+		    db_capture_bufoff);
+	bzero(buffer, db_capture_bufoff + 1);
 
-	if (kread(kvm, db_capture_buf, buffer, db_capture_bufsize, 0) < 0)
+	if (kread(kvm, db_capture_buf, buffer, db_capture_bufoff, 0) < 0)
 		errx(-1, "kvm: unable to read buffer");
 
 	printf("%s\n", buffer);
@@ -161,7 +161,7 @@ ddb_capture_status_kvm(kvm_t *kvm)
 		errx(-1, "kvm: unable to read db_capture_bufsize");
 	if (kread_symbol(kvm, X_DB_CAPTURE_INPROGRESS,
 	    &db_capture_inprogress, sizeof(db_capture_inprogress), 0) < 0)
-		err(-1, "kvm: unable to read db_capture_inpgoress");
+		err(-1, "kvm: unable to read db_capture_inprogress");
 	printf("%u/%u bytes used\n", db_capture_bufoff, db_capture_bufsize);
 	if (db_capture_inprogress)
 		printf("capture is on\n");
From jhb at FreeBSD.org  Wed Nov  4 16:05:19 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Wed Nov  4 16:05:37 2009
Subject: svn commit: r198903 - stable/7/usr.sbin/crashinfo
Message-ID: <200911041605.nA4G5I57037598@svn.freebsd.org>

Author: jhb
Date: Wed Nov  4 16:05:18 2009
New Revision: 198903
URL: http://svn.freebsd.org/changeset/base/198903

Log:
  MFC 198586: Include the output of the ddb(4) capture buffer.

Modified:
  stable/7/usr.sbin/crashinfo/crashinfo.sh
Directory Properties:
  stable/7/usr.sbin/crashinfo/   (props changed)

Modified: stable/7/usr.sbin/crashinfo/crashinfo.sh
==============================================================================
--- stable/7/usr.sbin/crashinfo/crashinfo.sh	Wed Nov  4 16:05:09 2009	(r198902)
+++ stable/7/usr.sbin/crashinfo/crashinfo.sh	Wed Nov  4 16:05:18 2009	(r198903)
@@ -304,3 +304,10 @@ echo "----------------------------------
 echo "kernel config"
 echo
 config -x $KERNEL
+
+echo
+echo "------------------------------------------------------------------------"
+echo "ddb capture buffer"
+echo
+
+ddb capture -M $VMCORE -N $KERNEL print
From jhb at FreeBSD.org  Wed Nov  4 16:59:21 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Wed Nov  4 16:59:32 2009
Subject: svn commit: r198908 - stable/7/sys/dev/ppbus
Message-ID: <200911041659.nA4GxL7n039244@svn.freebsd.org>

Author: jhb
Date: Wed Nov  4 16:59:21 2009
New Revision: 198908
URL: http://svn.freebsd.org/changeset/base/198908

Log:
  MFC 197772:
  When the timeout backoff hits the maximum value, leave it capped at the
  maximum value rather than setting it to the result of a boolean expression
  that is always true.

Modified:
  stable/7/sys/dev/ppbus/lpt.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/ppbus/lpt.c
==============================================================================
--- stable/7/sys/dev/ppbus/lpt.c	Wed Nov  4 16:58:26 2009	(r198907)
+++ stable/7/sys/dev/ppbus/lpt.c	Wed Nov  4 16:59:21 2009	(r198908)
@@ -437,7 +437,7 @@ lptout(void *arg)
 	if (sc->sc_state & OPEN) {
 		sc->sc_backoff++;
 		if (sc->sc_backoff > hz/LPTOUTMAX)
-			sc->sc_backoff = sc->sc_backoff > hz/LPTOUTMAX;
+			sc->sc_backoff = hz/LPTOUTMAX;
 		timeout(lptout, (caddr_t)dev, sc->sc_backoff);
 	} else
 		sc->sc_state &= ~TOUT;
From yongari at FreeBSD.org  Wed Nov  4 18:03:19 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed Nov  4 18:03:36 2009
Subject: svn commit: r198912 - stable/7/sys/dev/fxp
Message-ID: <200911041803.nA4I3JuB041043@svn.freebsd.org>

Author: yongari
Date: Wed Nov  4 18:03:19 2009
New Revision: 198912
URL: http://svn.freebsd.org/changeset/base/198912

Log:
  MFC r193875:
    Controller will dma SCB command status for a given command and
    driver should read updated status back after issuing a SCB command.
    To send a command to controller and read updated status back,
    driver should synchronize both memory read and write operations
    with device. Fix bus_dmamap_sync operation specifier used in
    fxp_dma_wait() by adding both memory read and memory write
    operations.

Modified:
  stable/7/sys/dev/fxp/if_fxp.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/fxp/if_fxp.c
==============================================================================
--- stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 17:30:48 2009	(r198911)
+++ stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:03:19 2009	(r198912)
@@ -348,12 +348,14 @@ static void
 fxp_dma_wait(struct fxp_softc *sc, volatile uint16_t *status,
     bus_dma_tag_t dmat, bus_dmamap_t map)
 {
-	int i = 10000;
+	int i;
 
-	bus_dmamap_sync(dmat, map, BUS_DMASYNC_POSTREAD);
-	while (!(le16toh(*status) & FXP_CB_STATUS_C) && --i) {
+	for (i = 10000; i > 0; i--) {
 		DELAY(2);
-		bus_dmamap_sync(dmat, map, BUS_DMASYNC_POSTREAD);
+		bus_dmamap_sync(dmat, map,
+		    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+		if ((le16toh(*status) & FXP_CB_STATUS_C) != 0)
+			break;
 	}
 	if (i == 0)
 		device_printf(sc->dev, "DMA timeout\n");
@@ -2222,13 +2224,12 @@ fxp_init_body(struct fxp_softc *sc)
 	 	 * Start the multicast setup command.
 		 */
 		fxp_scb_wait(sc);
-		bus_dmamap_sync(sc->mcs_tag, sc->mcs_map, BUS_DMASYNC_PREWRITE);
+		bus_dmamap_sync(sc->mcs_tag, sc->mcs_map,
+		    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 		CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->mcs_addr);
 		fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
 		/* ...and wait for it to complete. */
 		fxp_dma_wait(sc, &mcsp->cb_status, sc->mcs_tag, sc->mcs_map);
-		bus_dmamap_sync(sc->mcs_tag, sc->mcs_map,
-		    BUS_DMASYNC_POSTWRITE);
 	}
 
 	/*
@@ -2336,12 +2337,12 @@ fxp_init_body(struct fxp_softc *sc)
 	 * Start the config command/DMA.
 	 */
 	fxp_scb_wait(sc);
-	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE);
+	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map,
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->fxp_desc.cbl_addr);
 	fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
 	/* ...and wait for it to complete. */
 	fxp_dma_wait(sc, &cbp->cb_status, sc->cbl_tag, sc->cbl_map);
-	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_POSTWRITE);
 
 	/*
 	 * Now initialize the station address. Temporarily use the TxCB
@@ -2357,11 +2358,11 @@ fxp_init_body(struct fxp_softc *sc)
 	 * Start the IAS (Individual Address Setup) command/DMA.
 	 */
 	fxp_scb_wait(sc);
-	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE);
+	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map,
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
 	/* ...and wait for it to complete. */
 	fxp_dma_wait(sc, &cb_ias->cb_status, sc->cbl_tag, sc->cbl_map);
-	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_POSTWRITE);
 
 	/*
 	 * Initialize transmit control block (TxCB) list.
@@ -3006,12 +3007,12 @@ fxp_load_ucode(struct fxp_softc *sc)
 	 * Download the ucode to the chip.
 	 */
 	fxp_scb_wait(sc);
-	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE);
+	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map,
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->fxp_desc.cbl_addr);
 	fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
 	/* ...and wait for it to complete. */
 	fxp_dma_wait(sc, &cbp->cb_status, sc->cbl_tag, sc->cbl_map);
-	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_POSTWRITE);
 	device_printf(sc->dev,
 	    "Microcode loaded, int_delay: %d usec  bundle_max: %d\n",
 	    sc->tunable_int_delay,
From yongari at FreeBSD.org  Wed Nov  4 18:07:10 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed Nov  4 18:07:16 2009
Subject: svn commit: r198913 - stable/7/sys/dev/fxp
Message-ID: <200911041807.nA4I79MQ041179@svn.freebsd.org>

Author: yongari
Date: Wed Nov  4 18:07:09 2009
New Revision: 198913
URL: http://svn.freebsd.org/changeset/base/198913

Log:
  MFC r194569:
    Introduce Rx mbuf dma tag and use it in Rx path. Previously it used
    common mbuf dma tag for both Tx and Rx path but Rx buffer should
    have single DMA segment and maximum buffer size of the segment
    should be less than MCLBYTES.
    fxp(4) also have to check Tx completion status which was updated by
    DMA so we need BUS_DMASYNC_PREREAD and BUS_DMASYNC_POSTWRITE
    synchronization in Tx path. Fix all misuse of bus_dmamap_sync(9) in
    fxp(4). I guess this change shall fix occasional driver breakage in
    PAE environments.
  
    While I'm here add error messages of dma tag/buffer creation and
    correct messages.

Modified:
  stable/7/sys/dev/fxp/if_fxp.c
  stable/7/sys/dev/fxp/if_fxpvar.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/fxp/if_fxp.c
==============================================================================
--- stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:03:19 2009	(r198912)
+++ stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:07:09 2009	(r198913)
@@ -643,9 +643,18 @@ fxp_attach(device_t dev)
 	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 	    sc->maxsegsize * sc->maxtxseg + sizeof(struct ether_vlan_header),
 	    sc->maxtxseg, sc->maxsegsize, 0,
-	    busdma_lock_mutex, &Giant, &sc->fxp_mtag);
+	    busdma_lock_mutex, &Giant, &sc->fxp_txmtag);
 	if (error) {
-		device_printf(dev, "could not allocate dma tag\n");
+		device_printf(dev, "could not create TX DMA tag\n");
+		goto fail;
+	}
+
+	error = bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0,
+	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+	    MCLBYTES, 1, MCLBYTES, 0,
+	    busdma_lock_mutex, &Giant, &sc->fxp_rxmtag);
+	if (error) {
+		device_printf(dev, "could not create RX DMA tag\n");
 		goto fail;
 	}
 
@@ -654,18 +663,20 @@ fxp_attach(device_t dev)
 	    sizeof(struct fxp_stats), 1, sizeof(struct fxp_stats), 0,
 	    busdma_lock_mutex, &Giant, &sc->fxp_stag);
 	if (error) {
-		device_printf(dev, "could not allocate dma tag\n");
+		device_printf(dev, "could not create stats DMA tag\n");
 		goto fail;
 	}
 
 	error = bus_dmamem_alloc(sc->fxp_stag, (void **)&sc->fxp_stats,
 	    BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->fxp_smap);
-	if (error)
+	if (error) {
+		device_printf(dev, "could not allocate stats DMA memory\n");
 		goto fail;
+	}
 	error = bus_dmamap_load(sc->fxp_stag, sc->fxp_smap, sc->fxp_stats,
 	    sizeof(struct fxp_stats), fxp_dma_map_addr, &sc->stats_addr, 0);
 	if (error) {
-		device_printf(dev, "could not map the stats buffer\n");
+		device_printf(dev, "could not load the stats DMA buffer\n");
 		goto fail;
 	}
 
@@ -674,20 +685,22 @@ fxp_attach(device_t dev)
 	    FXP_TXCB_SZ, 1, FXP_TXCB_SZ, 0,
 	    busdma_lock_mutex, &Giant, &sc->cbl_tag);
 	if (error) {
-		device_printf(dev, "could not allocate dma tag\n");
+		device_printf(dev, "could not create TxCB DMA tag\n");
 		goto fail;
 	}
 
 	error = bus_dmamem_alloc(sc->cbl_tag, (void **)&sc->fxp_desc.cbl_list,
 	    BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->cbl_map);
-	if (error)
+	if (error) {
+		device_printf(dev, "could not allocate TxCB DMA memory\n");
 		goto fail;
+	}
 
 	error = bus_dmamap_load(sc->cbl_tag, sc->cbl_map,
 	    sc->fxp_desc.cbl_list, FXP_TXCB_SZ, fxp_dma_map_addr,
 	    &sc->fxp_desc.cbl_addr, 0);
 	if (error) {
-		device_printf(dev, "could not map DMA memory\n");
+		device_printf(dev, "could not load TxCB DMA buffer\n");
 		goto fail;
 	}
 
@@ -696,18 +709,23 @@ fxp_attach(device_t dev)
 	    sizeof(struct fxp_cb_mcs), 1, sizeof(struct fxp_cb_mcs), 0,
 	    busdma_lock_mutex, &Giant, &sc->mcs_tag);
 	if (error) {
-		device_printf(dev, "could not allocate dma tag\n");
+		device_printf(dev,
+		    "could not create multicast setup DMA tag\n");
 		goto fail;
 	}
 
 	error = bus_dmamem_alloc(sc->mcs_tag, (void **)&sc->mcsp,
-	    BUS_DMA_NOWAIT, &sc->mcs_map);
-	if (error)
+	    BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->mcs_map);
+	if (error) {
+		device_printf(dev,
+		    "could not allocate multicast setup DMA memory\n");
 		goto fail;
+	}
 	error = bus_dmamap_load(sc->mcs_tag, sc->mcs_map, sc->mcsp,
 	    sizeof(struct fxp_cb_mcs), fxp_dma_map_addr, &sc->mcs_addr, 0);
 	if (error) {
-		device_printf(dev, "can't map the multicast setup command\n");
+		device_printf(dev,
+		    "can't load the multicast setup DMA buffer\n");
 		goto fail;
 	}
 
@@ -719,13 +737,13 @@ fxp_attach(device_t dev)
 	tcbp = sc->fxp_desc.cbl_list;
 	for (i = 0; i < FXP_NTXCB; i++) {
 		txp[i].tx_cb = tcbp + i;
-		error = bus_dmamap_create(sc->fxp_mtag, 0, &txp[i].tx_map);
+		error = bus_dmamap_create(sc->fxp_txmtag, 0, &txp[i].tx_map);
 		if (error) {
 			device_printf(dev, "can't create DMA map for TX\n");
 			goto fail;
 		}
 	}
-	error = bus_dmamap_create(sc->fxp_mtag, 0, &sc->spare_map);
+	error = bus_dmamap_create(sc->fxp_rxmtag, 0, &sc->spare_map);
 	if (error) {
 		device_printf(dev, "can't create spare DMA map\n");
 		goto fail;
@@ -737,7 +755,7 @@ fxp_attach(device_t dev)
 	sc->fxp_desc.rx_head = sc->fxp_desc.rx_tail = NULL;
 	for (i = 0; i < FXP_NRFABUFS; i++) {
 		rxp = &sc->fxp_desc.rx_list[i];
-		error = bus_dmamap_create(sc->fxp_mtag, 0, &rxp->rx_map);
+		error = bus_dmamap_create(sc->fxp_rxmtag, 0, &rxp->rx_map);
 		if (error) {
 			device_printf(dev, "can't create DMA map for RX\n");
 			goto fail;
@@ -911,29 +929,32 @@ fxp_release(struct fxp_softc *sc)
 		bus_dmamem_free(sc->mcs_tag, sc->mcsp, sc->mcs_map);
 	}
 	bus_release_resources(sc->dev, sc->fxp_spec, sc->fxp_res);
-	if (sc->fxp_mtag) {
+	if (sc->fxp_rxmtag) {
 		for (i = 0; i < FXP_NRFABUFS; i++) {
 			rxp = &sc->fxp_desc.rx_list[i];
 			if (rxp->rx_mbuf != NULL) {
-				bus_dmamap_sync(sc->fxp_mtag, rxp->rx_map,
+				bus_dmamap_sync(sc->fxp_rxmtag, rxp->rx_map,
 				    BUS_DMASYNC_POSTREAD);
-				bus_dmamap_unload(sc->fxp_mtag, rxp->rx_map);
+				bus_dmamap_unload(sc->fxp_rxmtag, rxp->rx_map);
 				m_freem(rxp->rx_mbuf);
 			}
-			bus_dmamap_destroy(sc->fxp_mtag, rxp->rx_map);
+			bus_dmamap_destroy(sc->fxp_rxmtag, rxp->rx_map);
 		}
-		bus_dmamap_destroy(sc->fxp_mtag, sc->spare_map);
+		bus_dmamap_destroy(sc->fxp_rxmtag, sc->spare_map);
+		bus_dma_tag_destroy(sc->fxp_rxmtag);
+	}
+	if (sc->fxp_txmtag) {
 		for (i = 0; i < FXP_NTXCB; i++) {
 			txp = &sc->fxp_desc.tx_list[i];
 			if (txp->tx_mbuf != NULL) {
-				bus_dmamap_sync(sc->fxp_mtag, txp->tx_map,
+				bus_dmamap_sync(sc->fxp_txmtag, txp->tx_map,
 				    BUS_DMASYNC_POSTWRITE);
-				bus_dmamap_unload(sc->fxp_mtag, txp->tx_map);
+				bus_dmamap_unload(sc->fxp_txmtag, txp->tx_map);
 				m_freem(txp->tx_mbuf);
 			}
-			bus_dmamap_destroy(sc->fxp_mtag, txp->tx_map);
+			bus_dmamap_destroy(sc->fxp_txmtag, txp->tx_map);
 		}
-		bus_dma_tag_destroy(sc->fxp_mtag);
+		bus_dma_tag_destroy(sc->fxp_txmtag);
 	}
 	if (sc->fxp_stag)
 		bus_dma_tag_destroy(sc->fxp_stag);
@@ -1325,7 +1346,8 @@ fxp_start_body(struct ifnet *ifp)
 	 * going again if suspended.
 	 */
 	if (txqueued > 0) {
-		bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE);
+		bus_dmamap_sync(sc->cbl_tag, sc->cbl_map,
+		    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 		fxp_scb_wait(sc);
 		fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_RESUME);
 		/*
@@ -1499,7 +1521,7 @@ fxp_encap(struct fxp_softc *sc, struct m
 		*m_head = m;
 	}
 
-	error = bus_dmamap_load_mbuf_sg(sc->fxp_mtag, txp->tx_map, *m_head,
+	error = bus_dmamap_load_mbuf_sg(sc->fxp_txmtag, txp->tx_map, *m_head,
 	    segs, &nseg, 0);
 	if (error == EFBIG) {
 		m = m_collapse(*m_head, M_DONTWAIT, sc->maxtxseg);
@@ -1509,7 +1531,7 @@ fxp_encap(struct fxp_softc *sc, struct m
 			return (ENOMEM);
 		}
 		*m_head = m;
-		error = bus_dmamap_load_mbuf_sg(sc->fxp_mtag, txp->tx_map,
+		error = bus_dmamap_load_mbuf_sg(sc->fxp_txmtag, txp->tx_map,
 	    	    *m_head, segs, &nseg, 0);
 		if (error != 0) {
 			m_freem(*m_head);
@@ -1525,7 +1547,7 @@ fxp_encap(struct fxp_softc *sc, struct m
 	}
 
 	KASSERT(nseg <= sc->maxtxseg, ("too many DMA segments"));
-	bus_dmamap_sync(sc->fxp_mtag, txp->tx_map, BUS_DMASYNC_PREWRITE);
+	bus_dmamap_sync(sc->fxp_txmtag, txp->tx_map, BUS_DMASYNC_PREWRITE);
 
 	cbp = txp->tx_cb;
 	for (i = 0; i < nseg; i++) {
@@ -1705,14 +1727,15 @@ fxp_txeof(struct fxp_softc *sc)
 	struct fxp_tx *txp;
 
 	ifp = sc->ifp;
-	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREREAD);
+	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map,
+	    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 	for (txp = sc->fxp_desc.tx_first; sc->tx_queued &&
 	    (le16toh(txp->tx_cb->cb_status) & FXP_CB_STATUS_C) != 0;
 	    txp = txp->tx_next) {
 		if (txp->tx_mbuf != NULL) {
-			bus_dmamap_sync(sc->fxp_mtag, txp->tx_map,
+			bus_dmamap_sync(sc->fxp_txmtag, txp->tx_map,
 			    BUS_DMASYNC_POSTWRITE);
-			bus_dmamap_unload(sc->fxp_mtag, txp->tx_map);
+			bus_dmamap_unload(sc->fxp_txmtag, txp->tx_map);
 			m_freem(txp->tx_mbuf);
 			txp->tx_mbuf = NULL;
 			/* clear this to reset csum offload bits */
@@ -1722,7 +1745,8 @@ fxp_txeof(struct fxp_softc *sc)
 		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 	}
 	sc->fxp_desc.tx_first = txp;
-	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE);
+	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map,
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	if (sc->tx_queued == 0) {
 		sc->watchdog_timer = 0;
 		if (sc->need_mcsetup)
@@ -1874,7 +1898,7 @@ fxp_intr_body(struct fxp_softc *sc, stru
 		m = rxp->rx_mbuf;
 		rfa = (struct fxp_rfa *)(m->m_ext.ext_buf +
 		    RFA_ALIGNMENT_FUDGE);
-		bus_dmamap_sync(sc->fxp_mtag, rxp->rx_map,
+		bus_dmamap_sync(sc->fxp_rxmtag, rxp->rx_map,
 		    BUS_DMASYNC_POSTREAD);
 
 #ifdef DEVICE_POLLING /* loop at most count times if count >=0 */
@@ -2107,9 +2131,10 @@ fxp_stop(struct fxp_softc *sc)
 	if (txp != NULL) {
 		for (i = 0; i < FXP_NTXCB; i++) {
  			if (txp[i].tx_mbuf != NULL) {
-				bus_dmamap_sync(sc->fxp_mtag, txp[i].tx_map,
+				bus_dmamap_sync(sc->fxp_txmtag, txp[i].tx_map,
 				    BUS_DMASYNC_POSTWRITE);
-				bus_dmamap_unload(sc->fxp_mtag, txp[i].tx_map);
+				bus_dmamap_unload(sc->fxp_txmtag,
+				    txp[i].tx_map);
 				m_freem(txp[i].tx_mbuf);
 				txp[i].tx_mbuf = NULL;
 				/* clear this to reset csum offload bits */
@@ -2117,7 +2142,8 @@ fxp_stop(struct fxp_softc *sc)
 			}
 		}
 	}
-	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE);
+	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map,
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	sc->tx_queued = 0;
 }
 
@@ -2389,7 +2415,8 @@ fxp_init_body(struct fxp_softc *sc)
 	 * unit. It will execute the NOP and then suspend.
 	 */
 	tcbp->cb_command = htole16(FXP_CB_COMMAND_NOP | FXP_CB_COMMAND_S);
-	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE);
+	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map,
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	sc->fxp_desc.tx_first = sc->fxp_desc.tx_last = txp;
 	sc->tx_queued = 1;
 
@@ -2539,7 +2566,7 @@ fxp_new_rfabuf(struct fxp_softc *sc, str
 	le32enc(&rfa->rbd_addr, 0xffffffff);
 
 	/* Map the RFA into DMA memory. */
-	error = bus_dmamap_load(sc->fxp_mtag, sc->spare_map, rfa,
+	error = bus_dmamap_load(sc->fxp_rxmtag, sc->spare_map, rfa,
 	    MCLBYTES - RFA_ALIGNMENT_FUDGE, fxp_dma_map_addr,
 	    &rxp->rx_addr, 0);
 	if (error) {
@@ -2548,13 +2575,13 @@ fxp_new_rfabuf(struct fxp_softc *sc, str
 	}
 
 	if (rxp->rx_mbuf != NULL)
-		bus_dmamap_unload(sc->fxp_mtag, rxp->rx_map);
+		bus_dmamap_unload(sc->fxp_rxmtag, rxp->rx_map);
 	tmp_map = sc->spare_map;
 	sc->spare_map = rxp->rx_map;
 	rxp->rx_map = tmp_map;
 	rxp->rx_mbuf = m;
 
-	bus_dmamap_sync(sc->fxp_mtag, rxp->rx_map,
+	bus_dmamap_sync(sc->fxp_rxmtag, rxp->rx_map,
 	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	return (0);
 }
@@ -2576,7 +2603,7 @@ fxp_add_rfabuf(struct fxp_softc *sc, str
 		p_rx->rx_next = rxp;
 		le32enc(&p_rfa->link_addr, rxp->rx_addr);
 		p_rfa->rfa_control = 0;
-		bus_dmamap_sync(sc->fxp_mtag, p_rx->rx_map,
+		bus_dmamap_sync(sc->fxp_rxmtag, p_rx->rx_map,
 		    BUS_DMASYNC_PREWRITE);
 	} else {
 		rxp->rx_next = NULL;
@@ -2620,7 +2647,7 @@ fxp_discard_rfabuf(struct fxp_softc *sc,
 	le32enc(&rfa->link_addr, 0xffffffff);
 	le32enc(&rfa->rbd_addr, 0xffffffff);
 
-	bus_dmamap_sync(sc->fxp_mtag, rxp->rx_map,
+	bus_dmamap_sync(sc->fxp_rxmtag, rxp->rx_map,
 	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 }
 
@@ -2939,7 +2966,8 @@ fxp_mc_setup(struct fxp_softc *sc)
 	 * Start the multicast setup command.
 	 */
 	fxp_scb_wait(sc);
-	bus_dmamap_sync(sc->mcs_tag, sc->mcs_map, BUS_DMASYNC_PREWRITE);
+	bus_dmamap_sync(sc->mcs_tag, sc->mcs_map,
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->mcs_addr);
 	fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
 

Modified: stable/7/sys/dev/fxp/if_fxpvar.h
==============================================================================
--- stable/7/sys/dev/fxp/if_fxpvar.h	Wed Nov  4 18:03:19 2009	(r198912)
+++ stable/7/sys/dev/fxp/if_fxpvar.h	Wed Nov  4 18:07:09 2009	(r198913)
@@ -152,7 +152,8 @@ struct fxp_softc {
 	struct resource_spec *fxp_spec;	/* the resource spec we used */
 	void *ih;			/* interrupt handler cookie */
 	struct mtx sc_mtx;
-	bus_dma_tag_t fxp_mtag;		/* bus DMA tag for mbufs */
+	bus_dma_tag_t fxp_txmtag;	/* bus DMA tag for Tx mbufs */
+	bus_dma_tag_t fxp_rxmtag;	/* bus DMA tag for Rx mbufs */
 	bus_dma_tag_t fxp_stag;		/* bus DMA tag for stats */
 	bus_dmamap_t fxp_smap;		/* bus DMA map for stats */
 	bus_dma_tag_t cbl_tag;		/* DMA tag for the TxCB list */
From yongari at FreeBSD.org  Wed Nov  4 18:08:54 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed Nov  4 18:09:11 2009
Subject: svn commit: r198914 - stable/7/sys/dev/fxp
Message-ID: <200911041808.nA4I8raU041265@svn.freebsd.org>

Author: yongari
Date: Wed Nov  4 18:08:53 2009
New Revision: 198914
URL: http://svn.freebsd.org/changeset/base/198914

Log:
  MFC r194570:
    Due to possible PCI bus lock-up issues fxp(4) didn't perform full
    hardware reset in attach phase. Selective reset does not clear
    configured parameters so I think full hardware reset is required.
    To prevent PCI bus lock-up, do selective reset first which will get
    off the controller from PCI bus and request software reset after
    selective reset. Software reset will unmask interrupts so disable
    it after the reset.

Modified:
  stable/7/sys/dev/fxp/if_fxp.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/fxp/if_fxp.c
==============================================================================
--- stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:07:09 2009	(r198913)
+++ stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:08:53 2009	(r198914)
@@ -467,10 +467,14 @@ fxp_attach(device_t dev)
 	}
 
 	/*
-	 * Reset to a stable state.
+	 * Put CU/RU idle state and prepare full reset.
 	 */
 	CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SELECTIVE_RESET);
 	DELAY(10);
+	/* Full reset and disable interrupts. */
+	CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SOFTWARE_RESET);
+	DELAY(10);
+	CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE);
 
 	/*
 	 * Find out how large of an SEEPROM we have.
From yongari at FreeBSD.org  Wed Nov  4 18:14:20 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed Nov  4 18:14:26 2009
Subject: svn commit: r198915 - stable/7/sys/dev/fxp
Message-ID: <200911041814.nA4IEJoY041450@svn.freebsd.org>

Author: yongari
Date: Wed Nov  4 18:14:19 2009
New Revision: 198915
URL: http://svn.freebsd.org/changeset/base/198915

Log:
  MFC r194571:
    Don't blindly enable Rx lock-up workaround. Newer chips do not need
    the Rx lock-up workaround.
  
    Obtained from:        NetBSD

Modified:
  stable/7/sys/dev/fxp/if_fxp.c
  stable/7/sys/dev/fxp/if_fxpvar.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/fxp/if_fxp.c
==============================================================================
--- stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:08:53 2009	(r198914)
+++ stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:14:19 2009	(r198915)
@@ -501,6 +501,13 @@ fxp_attach(device_t dev)
 			sc->flags |= FXP_FLAG_WOLCAP;
 	}
 
+	/* Receiver lock-up workaround detection. */
+	fxp_read_eeprom(sc, &data, 3, 1);
+	if ((data & 0x03) != 0x03) {
+		sc->flags |= FXP_FLAG_RXBUG;
+		device_printf(dev, "Enabling Rx lock-up workaround\n");
+	}
+
 	/*
 	 * Determine whether we must use the 503 serial interface.
 	 */
@@ -2015,7 +2022,7 @@ fxp_tick(void *xsc)
 	if (sp->rx_good) {
 		ifp->if_ipackets += le32toh(sp->rx_good);
 		sc->rx_idle_secs = 0;
-	} else {
+	} else if (sc->flags & FXP_FLAG_RXBUG) {
 		/*
 		 * Receiver's been idle for another second.
 		 */

Modified: stable/7/sys/dev/fxp/if_fxpvar.h
==============================================================================
--- stable/7/sys/dev/fxp/if_fxpvar.h	Wed Nov  4 18:08:53 2009	(r198914)
+++ stable/7/sys/dev/fxp/if_fxpvar.h	Wed Nov  4 18:14:19 2009	(r198915)
@@ -204,6 +204,7 @@ struct fxp_softc {
 #define FXP_FLAG_82559_RXCSUM	0x1000	/* 82559 compatible RX checksum */
 #define FXP_FLAG_WOLCAP		0x2000	/* WOL capability */
 #define FXP_FLAG_WOL		0x4000	/* WOL active */
+#define FXP_FLAG_RXBUG		0x8000	/* Rx lock-up bug */
 
 /* Macros to ease CSR access. */
 #define	CSR_READ_1(sc, reg)		bus_read_1(sc->fxp_res[0], reg)
From yongari at FreeBSD.org  Wed Nov  4 18:18:10 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed Nov  4 18:18:15 2009
Subject: svn commit: r198916 - stable/7/sys/dev/fxp
Message-ID: <200911041818.nA4II9R2041608@svn.freebsd.org>

Author: yongari
Date: Wed Nov  4 18:18:09 2009
New Revision: 198916
URL: http://svn.freebsd.org/changeset/base/198916

Log:
  MFC r194572:
    Always check fxp(4) is running, see if it can accept frames from
    upper stack in fxp_start_body().
    fxp(4) drops driver lock in Rx path so check the fxp(4) is still
    running after reacquiring driver lock in Rx path. Also don't
    invoke fxp_intr_body if fxp(4) is not running. With this change
    there is no need to set suspend bit in device attach phase.

Modified:
  stable/7/sys/dev/fxp/if_fxp.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/fxp/if_fxp.c
==============================================================================
--- stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:14:19 2009	(r198915)
+++ stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:18:09 2009	(r198916)
@@ -993,7 +993,6 @@ fxp_detach(device_t dev)
 #endif
 
 	FXP_LOCK(sc);
-	sc->suspended = 1;	/* Do same thing as we do for suspend */
 	/*
 	 * Stop DMA and drop transmit queue, but disable interrupts first.
 	 */
@@ -1320,6 +1319,10 @@ fxp_start_body(struct ifnet *ifp)
 	if (sc->need_mcsetup)
 		return;
 
+	if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
+	    IFF_DRV_RUNNING)
+		return;
+
 	if (sc->tx_queued > FXP_NTXCB_HIWAT)
 		fxp_txeof(sc);
 	/*
@@ -1726,7 +1729,8 @@ fxp_intr(void *xsc)
 		 * First ACK all the interrupts in this pass.
 		 */
 		CSR_WRITE_1(sc, FXP_CSR_SCB_STATACK, statack);
-		fxp_intr_body(sc, ifp, statack, -1);
+		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+			fxp_intr_body(sc, ifp, statack, -1);
 	}
 	FXP_UNLOCK(sc);
 }
@@ -1982,6 +1986,8 @@ fxp_intr_body(struct fxp_softc *sc, stru
 			FXP_UNLOCK(sc);
 			(*ifp->if_input)(ifp, m);
 			FXP_LOCK(sc);
+			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+				return;
 		} else {
 			/* Reuse RFA and loaded DMA map. */
 			ifp->if_iqdrops++;
@@ -2064,7 +2070,8 @@ fxp_tick(void *xsc)
 	 */
 	if (sc->rx_idle_secs > FXP_MAX_RX_IDLE) {
 		sc->rx_idle_secs = 0;
-		fxp_mc_setup(sc);
+		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+			fxp_mc_setup(sc);
 	}
 	/*
 	 * If there is no pending command, start another stats
From yongari at FreeBSD.org  Wed Nov  4 18:20:32 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed Nov  4 18:20:44 2009
Subject: svn commit: r198917 - stable/7/sys/dev/fxp
Message-ID: <200911041820.nA4IKWXA041711@svn.freebsd.org>

Author: yongari
Date: Wed Nov  4 18:20:31 2009
New Revision: 198917
URL: http://svn.freebsd.org/changeset/base/198917

Log:
  MFC r194573:
    Overhaul fxp(4) multicast filter programming. fxp(4) hardwares do
    not allow multicast filter programming when controller is busy to
    send/receive frames. So it used to mark need_mcsetup bit and defer
    multicast filter programming until controller becomes idle state.
    To detect when the controller is idle fxp(4) relied on Tx
    completion interrupt with NOP command and fxp_start_body and
    fxp_intr_body had to see whether pending multicast filter
    programming was requested. This resulted in very complex logic and
    sometimes it did not work as expected.
    Since the controller should be in idle state before any multicast
    filter modifications I changed it to reinitialize the controller
    whenever multicast filter programming is required. This is the same
    way what OpenBSD and NetBSD does. Also I added IFF_DRV_RUNNING
    check in ioctl handler so controller would be reinitialized only if
    it is absolutely needed.
    With this change I guess we can remove fxp(4) DELAY hack in ifioctl
    for IPv6 case.

Modified:
  stable/7/sys/dev/fxp/if_fxp.c
  stable/7/sys/dev/fxp/if_fxpvar.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/fxp/if_fxp.c
==============================================================================
--- stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:18:09 2009	(r198916)
+++ stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:20:31 2009	(r198917)
@@ -1311,14 +1311,6 @@ fxp_start_body(struct ifnet *ifp)
 
 	FXP_LOCK_ASSERT(sc, MA_OWNED);
 
-	/*
-	 * See if we need to suspend xmit until the multicast filter
-	 * has been reprogrammed (which can only be done at the head
-	 * of the command chain).
-	 */
-	if (sc->need_mcsetup)
-		return;
-
 	if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
 	    IFF_DRV_RUNNING)
 		return;
@@ -1762,11 +1754,8 @@ fxp_txeof(struct fxp_softc *sc)
 	sc->fxp_desc.tx_first = txp;
 	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map,
 	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
-	if (sc->tx_queued == 0) {
+	if (sc->tx_queued == 0)
 		sc->watchdog_timer = 0;
-		if (sc->need_mcsetup)
-			fxp_mc_setup(sc);
-	}
 }
 
 static void
@@ -2071,7 +2060,8 @@ fxp_tick(void *xsc)
 	if (sc->rx_idle_secs > FXP_MAX_RX_IDLE) {
 		sc->rx_idle_secs = 0;
 		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
-			fxp_mc_setup(sc);
+			fxp_init_body(sc);
+		return;
 	}
 	/*
 	 * If there is no pending command, start another stats
@@ -2213,7 +2203,6 @@ fxp_init_body(struct fxp_softc *sc)
 	struct fxp_cb_ias *cb_ias;
 	struct fxp_cb_tx *tcbp;
 	struct fxp_tx *txp;
-	struct fxp_cb_mcs *mcsp;
 	int i, prm;
 
 	FXP_LOCK_ASSERT(sc, MA_OWNED);
@@ -2256,25 +2245,10 @@ fxp_init_body(struct fxp_softc *sc)
 		fxp_load_ucode(sc);
 
 	/*
-	 * Initialize the multicast address list.
+	 * Set IFF_ALLMULTI status. It's needed in configure action
+	 * command.
 	 */
-	if (fxp_mc_addrs(sc)) {
-		mcsp = sc->mcsp;
-		mcsp->cb_status = 0;
-		mcsp->cb_command =
-		    htole16(FXP_CB_COMMAND_MCAS | FXP_CB_COMMAND_EL);
-		mcsp->link_addr = 0xffffffff;
-		/*
-	 	 * Start the multicast setup command.
-		 */
-		fxp_scb_wait(sc);
-		bus_dmamap_sync(sc->mcs_tag, sc->mcs_map,
-		    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
-		CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->mcs_addr);
-		fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
-		/* ...and wait for it to complete. */
-		fxp_dma_wait(sc, &mcsp->cb_status, sc->mcs_tag, sc->mcs_map);
-	}
+	fxp_mc_addrs(sc);
 
 	/*
 	 * We temporarily use memory that contains the TxCB list to
@@ -2348,7 +2322,7 @@ fxp_init_body(struct fxp_softc *sc)
 	cbp->force_fdx =	0;	/* (don't) force full duplex */
 	cbp->fdx_pin_en =	1;	/* (enable) FDX# pin */
 	cbp->multi_ia =		0;	/* (don't) accept multiple IAs */
-	cbp->mc_all =		sc->flags & FXP_FLAG_ALL_MCAST ? 1 : 0;
+	cbp->mc_all =		ifp->if_flags & IFF_ALLMULTI ? 1 : 0;
 	cbp->gamla_rx =		sc->flags & FXP_FLAG_EXT_RFA ? 1 : 0;
 	cbp->vlan_strip_en =	((sc->flags & FXP_FLAG_EXT_RFA) != 0 &&
 	    (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) ? 1 : 0;
@@ -2404,11 +2378,17 @@ fxp_init_body(struct fxp_softc *sc)
 	fxp_scb_wait(sc);
 	bus_dmamap_sync(sc->cbl_tag, sc->cbl_map,
 	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+	CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->fxp_desc.cbl_addr);
 	fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
 	/* ...and wait for it to complete. */
 	fxp_dma_wait(sc, &cb_ias->cb_status, sc->cbl_tag, sc->cbl_map);
 
 	/*
+	 * Initialize the multicast address list.
+	 */
+	fxp_mc_setup(sc);
+
+	/*
 	 * Initialize transmit control block (TxCB) list.
 	 */
 	txp = sc->fxp_desc.tx_list;
@@ -2439,6 +2419,7 @@ fxp_init_body(struct fxp_softc *sc)
 	sc->tx_queued = 1;
 
 	fxp_scb_wait(sc);
+	CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->fxp_desc.cbl_addr);
 	fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
 
 	/*
@@ -2718,11 +2699,6 @@ fxp_ioctl(struct ifnet *ifp, u_long comm
 	switch (command) {
 	case SIOCSIFFLAGS:
 		FXP_LOCK(sc);
-		if (ifp->if_flags & IFF_ALLMULTI)
-			sc->flags |= FXP_FLAG_ALL_MCAST;
-		else
-			sc->flags &= ~FXP_FLAG_ALL_MCAST;
-
 		/*
 		 * If interface is marked up and not running, then start it.
 		 * If it is marked down and running, stop it.
@@ -2730,35 +2706,24 @@ fxp_ioctl(struct ifnet *ifp, u_long comm
 		 * such as IFF_PROMISC are handled.
 		 */
 		if (ifp->if_flags & IFF_UP) {
-			fxp_init_body(sc);
+			if (((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) &&
+			    ((ifp->if_flags ^ sc->if_flags) &
+			    (IFF_PROMISC | IFF_ALLMULTI | IFF_LINK0)) != 0)
+				fxp_init_body(sc);
+			else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+				fxp_init_body(sc);
 		} else {
-			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
 				fxp_stop(sc);
 		}
+		sc->if_flags = ifp->if_flags;
 		FXP_UNLOCK(sc);
 		break;
 
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
-		FXP_LOCK(sc);
-		if (ifp->if_flags & IFF_ALLMULTI)
-			sc->flags |= FXP_FLAG_ALL_MCAST;
-		else
-			sc->flags &= ~FXP_FLAG_ALL_MCAST;
-		/*
-		 * Multicast list has changed; set the hardware filter
-		 * accordingly.
-		 */
-		if ((sc->flags & FXP_FLAG_ALL_MCAST) == 0)
-			fxp_mc_setup(sc);
-		/*
-		 * fxp_mc_setup() can set FXP_FLAG_ALL_MCAST, so check it
-		 * again rather than else {}.
-		 */
-		if (sc->flags & FXP_FLAG_ALL_MCAST)
-			fxp_init_body(sc);
-		FXP_UNLOCK(sc);
-		error = 0;
+		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+			fxp_init(sc);
 		break;
 
 	case SIOCSIFMEDIA:
@@ -2862,13 +2827,13 @@ fxp_mc_addrs(struct fxp_softc *sc)
 	int nmcasts;
 
 	nmcasts = 0;
-	if ((sc->flags & FXP_FLAG_ALL_MCAST) == 0) {
+	if ((ifp->if_flags & IFF_ALLMULTI) == 0) {
 		IF_ADDR_LOCK(ifp);
 		TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 			if (ifma->ifma_addr->sa_family != AF_LINK)
 				continue;
 			if (nmcasts >= MAXMCADDR) {
-				sc->flags |= FXP_FLAG_ALL_MCAST;
+				ifp->if_flags |= IFF_ALLMULTI;
 				nmcasts = 0;
 				break;
 			}
@@ -2893,87 +2858,28 @@ fxp_mc_addrs(struct fxp_softc *sc)
  * points to the TxCB ring, but the mcsetup descriptor itself is not part
  * of it. We then can do 'CU_START' on the mcsetup descriptor and have it
  * lead into the regular TxCB ring when it completes.
- *
- * This function must be called at splimp.
  */
 static void
 fxp_mc_setup(struct fxp_softc *sc)
 {
-	struct fxp_cb_mcs *mcsp = sc->mcsp;
-	struct fxp_tx *txp;
+	struct fxp_cb_mcs *mcsp;
 	int count;
 
 	FXP_LOCK_ASSERT(sc, MA_OWNED);
-	/*
-	 * If there are queued commands, we must wait until they are all
-	 * completed. If we are already waiting, then add a NOP command
-	 * with interrupt option so that we're notified when all commands
-	 * have been completed - fxp_start() ensures that no additional
-	 * TX commands will be added when need_mcsetup is true.
-	 */
-	if (sc->tx_queued) {
-		/*
-		 * need_mcsetup will be true if we are already waiting for the
-		 * NOP command to be completed (see below). In this case, bail.
-		 */
-		if (sc->need_mcsetup)
-			return;
-		sc->need_mcsetup = 1;
-
-		/*
-		 * Add a NOP command with interrupt so that we are notified
-		 * when all TX commands have been processed.
-		 */
-		txp = sc->fxp_desc.tx_last->tx_next;
-		txp->tx_mbuf = NULL;
-		txp->tx_cb->cb_status = 0;
-		txp->tx_cb->cb_command = htole16(FXP_CB_COMMAND_NOP |
-		    FXP_CB_COMMAND_S | FXP_CB_COMMAND_I);
-		/*
-		 * Advance the end of list forward.
-		 */
-		sc->fxp_desc.tx_last->tx_cb->cb_command &=
-		    htole16(~FXP_CB_COMMAND_S);
-		bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE);
-		sc->fxp_desc.tx_last = txp;
-		sc->tx_queued++;
-		/*
-		 * Issue a resume in case the CU has just suspended.
-		 */
-		fxp_scb_wait(sc);
-		fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_RESUME);
-		/*
-		 * Set a 5 second timer just in case we don't hear from the
-		 * card again.
-		 */
-		sc->watchdog_timer = 5;
-
-		return;
-	}
-	sc->need_mcsetup = 0;
 
-	/*
-	 * Initialize multicast setup descriptor.
-	 */
+	mcsp = sc->mcsp;
 	mcsp->cb_status = 0;
-	mcsp->cb_command = htole16(FXP_CB_COMMAND_MCAS |
-	    FXP_CB_COMMAND_S | FXP_CB_COMMAND_I);
-	mcsp->link_addr = htole32(sc->fxp_desc.cbl_addr);
-	txp = &sc->fxp_desc.mcs_tx;
-	txp->tx_mbuf = NULL;
-	txp->tx_cb = (struct fxp_cb_tx *)sc->mcsp;
-	txp->tx_next = sc->fxp_desc.tx_list;
-	(void) fxp_mc_addrs(sc);
-	sc->fxp_desc.tx_first = sc->fxp_desc.tx_last = txp;
-	sc->tx_queued = 1;
+	mcsp->cb_command = htole16(FXP_CB_COMMAND_MCAS | FXP_CB_COMMAND_EL);
+	mcsp->link_addr = 0xffffffff;
+	fxp_mc_addrs(sc);
 
 	/*
-	 * Wait until command unit is not active. This should never
-	 * be the case when nothing is queued, but make sure anyway.
+	 * Wait until command unit is idle. This should never be the
+	 * case when nothing is queued, but make sure anyway.
 	 */
 	count = 100;
-	while ((CSR_READ_1(sc, FXP_CSR_SCB_RUSCUS) >> 6) ==
-	    FXP_SCB_CUS_ACTIVE && --count)
+	while ((CSR_READ_1(sc, FXP_CSR_SCB_RUSCUS) >> 6) !=
+	    FXP_SCB_CUS_IDLE && --count)
 		DELAY(10);
 	if (count == 0) {
 		device_printf(sc->dev, "command queue timeout\n");
@@ -2988,9 +2894,8 @@ fxp_mc_setup(struct fxp_softc *sc)
 	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->mcs_addr);
 	fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
-
-	sc->watchdog_timer = 2;
-	return;
+	/* ...and wait for it to complete. */
+	fxp_dma_wait(sc, &mcsp->cb_status, sc->mcs_tag, sc->mcs_map);
 }
 
 static uint32_t fxp_ucode_d101a[] = D101_A_RCVBUNDLE_UCODE;

Modified: stable/7/sys/dev/fxp/if_fxpvar.h
==============================================================================
--- stable/7/sys/dev/fxp/if_fxpvar.h	Wed Nov  4 18:18:09 2009	(r198916)
+++ stable/7/sys/dev/fxp/if_fxpvar.h	Wed Nov  4 18:20:31 2009	(r198917)
@@ -165,7 +165,6 @@ struct fxp_softc {
 	int maxtxseg;			/* maximum # of TX segments */
 	int maxsegsize;			/* maximum size of a TX segment */
 	int tx_queued;			/* # of active TxCB's */
-	int need_mcsetup;		/* multicast filter needs programming */
 	struct fxp_stats *fxp_stats;	/* Pointer to interface stats */
 	uint32_t stats_addr;		/* DMA address of the stats structure */
 	int rx_idle_secs;		/* # of seconds RX has been idle */
@@ -185,6 +184,7 @@ struct fxp_softc {
 	int cu_resume_bug;
 	int revision;
 	int flags;
+	int if_flags;
 	uint8_t rfa_size;
 	uint32_t tx_cmd;
 };
@@ -195,7 +195,6 @@ struct fxp_softc {
 #define FXP_FLAG_EXT_TXCB	0x0008	/* enable use of extended TXCB */
 #define FXP_FLAG_SERIAL_MEDIA	0x0010	/* 10Mbps serial interface */
 #define FXP_FLAG_LONG_PKT_EN	0x0020	/* enable long packet reception */
-#define FXP_FLAG_ALL_MCAST	0x0040	/* accept all multicast frames */
 #define FXP_FLAG_CU_RESUME_BUG	0x0080	/* requires workaround for CU_RESUME */
 #define FXP_FLAG_UCODE		0x0100	/* ucode is loaded */
 #define FXP_FLAG_DEFERRED_RNR	0x0200	/* DEVICE_POLLING deferred RNR */
From yongari at FreeBSD.org  Wed Nov  4 18:23:00 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed Nov  4 18:23:17 2009
Subject: svn commit: r198918 - stable/7/sys/dev/fxp
Message-ID: <200911041822.nA4IMxkw041833@svn.freebsd.org>

Author: yongari
Date: Wed Nov  4 18:22:59 2009
New Revision: 198918
URL: http://svn.freebsd.org/changeset/base/198918

Log:
  MFC r194574:
    For ICH based fxp(4) controllers treat them as 82559 compatibles.
    To detect which controller is ICH based one, add a new member
    variable ich to struct fxp_ident and move the struct to
    if_fxpvar.h. Since I've faked controller revision, don't allow
    microcode loading for ICH based controllers.
    With this change all ICH based controllers will have WOL and Rx
    checksum offload capability.
  
    PR:		kern/135451
    Tested by:	Alexey Shuvaev ( shuvaev <> physik dot uni-wuerzburg dot de ),
  		pluknet ( pluknet <> gmail dot com ),
  		Gary Jennejohn ( gary.jennejohn <> freenet dot de )

Modified:
  stable/7/sys/dev/fxp/if_fxp.c
  stable/7/sys/dev/fxp/if_fxpvar.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/fxp/if_fxp.c
==============================================================================
--- stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:20:31 2009	(r198917)
+++ stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:22:59 2009	(r198918)
@@ -140,12 +140,6 @@ static u_char fxp_cb_config_template[] =
 	0x5	/* 21 */
 };
 
-struct fxp_ident {
-	uint16_t	devid;
-	int16_t		revid;		/* -1 matches anything */
-	char 		*name;
-};
-
 /*
  * Claim various Intel PCI device identifiers for this driver.  The
  * sub-vendor and sub-device field are extensively used to identify
@@ -153,52 +147,52 @@ struct fxp_ident {
  * them.
  */
 static struct fxp_ident fxp_ident_table[] = {
-    { 0x1029,	-1,	"Intel 82559 PCI/CardBus Pro/100" },
-    { 0x1030,	-1,	"Intel 82559 Pro/100 Ethernet" },
-    { 0x1031,	-1,	"Intel 82801CAM (ICH3) Pro/100 VE Ethernet" },
-    { 0x1032,	-1,	"Intel 82801CAM (ICH3) Pro/100 VE Ethernet" },
-    { 0x1033,	-1,	"Intel 82801CAM (ICH3) Pro/100 VM Ethernet" },
-    { 0x1034,	-1,	"Intel 82801CAM (ICH3) Pro/100 VM Ethernet" },
-    { 0x1035,	-1,	"Intel 82801CAM (ICH3) Pro/100 Ethernet" },
-    { 0x1036,	-1,	"Intel 82801CAM (ICH3) Pro/100 Ethernet" },
-    { 0x1037,	-1,	"Intel 82801CAM (ICH3) Pro/100 Ethernet" },
-    { 0x1038,	-1,	"Intel 82801CAM (ICH3) Pro/100 VM Ethernet" },
-    { 0x1039,	-1,	"Intel 82801DB (ICH4) Pro/100 VE Ethernet" },
-    { 0x103A,	-1,	"Intel 82801DB (ICH4) Pro/100 Ethernet" },
-    { 0x103B,	-1,	"Intel 82801DB (ICH4) Pro/100 VM Ethernet" },
-    { 0x103C,	-1,	"Intel 82801DB (ICH4) Pro/100 Ethernet" },
-    { 0x103D,	-1,	"Intel 82801DB (ICH4) Pro/100 VE Ethernet" },
-    { 0x103E,	-1,	"Intel 82801DB (ICH4) Pro/100 VM Ethernet" },
-    { 0x1050,	-1,	"Intel 82801BA (D865) Pro/100 VE Ethernet" },
-    { 0x1051,	-1,	"Intel 82562ET (ICH5/ICH5R) Pro/100 VE Ethernet" },
-    { 0x1059,	-1,	"Intel 82551QM Pro/100 M Mobile Connection" },
-    { 0x1064,	-1,	"Intel 82562EZ (ICH6)" },
-    { 0x1065,	-1,	"Intel 82562ET/EZ/GT/GZ PRO/100 VE Ethernet" },
-    { 0x1068,	-1,	"Intel 82801FBM (ICH6-M) Pro/100 VE Ethernet" },
-    { 0x1069,	-1,	"Intel 82562EM/EX/GX Pro/100 Ethernet" },
-    { 0x1091,	-1,	"Intel 82562GX Pro/100 Ethernet" },
-    { 0x1092,	-1,	"Intel Pro/100 VE Network Connection" },
-    { 0x1093,	-1,	"Intel Pro/100 VM Network Connection" },
-    { 0x1094,	-1,	"Intel Pro/100 946GZ (ICH7) Network Connection" },
-    { 0x1209,	-1,	"Intel 82559ER Embedded 10/100 Ethernet" },
-    { 0x1229,	0x01,	"Intel 82557 Pro/100 Ethernet" },
-    { 0x1229,	0x02,	"Intel 82557 Pro/100 Ethernet" },
-    { 0x1229,	0x03,	"Intel 82557 Pro/100 Ethernet" },
-    { 0x1229,	0x04,	"Intel 82558 Pro/100 Ethernet" },
-    { 0x1229,	0x05,	"Intel 82558 Pro/100 Ethernet" },
-    { 0x1229,	0x06,	"Intel 82559 Pro/100 Ethernet" },
-    { 0x1229,	0x07,	"Intel 82559 Pro/100 Ethernet" },
-    { 0x1229,	0x08,	"Intel 82559 Pro/100 Ethernet" },
-    { 0x1229,	0x09,	"Intel 82559ER Pro/100 Ethernet" },
-    { 0x1229,	0x0c,	"Intel 82550 Pro/100 Ethernet" },
-    { 0x1229,	0x0d,	"Intel 82550 Pro/100 Ethernet" },
-    { 0x1229,	0x0e,	"Intel 82550 Pro/100 Ethernet" },
-    { 0x1229,	0x0f,	"Intel 82551 Pro/100 Ethernet" },
-    { 0x1229,	0x10,	"Intel 82551 Pro/100 Ethernet" },
-    { 0x1229,	-1,	"Intel 82557/8/9 Pro/100 Ethernet" },
-    { 0x2449,	-1,	"Intel 82801BA/CAM (ICH2/3) Pro/100 Ethernet" },
-    { 0x27dc,	-1,	"Intel 82801GB (ICH7) 10/100 Ethernet" },
-    { 0,	-1,	NULL },
+    { 0x1029,	-1,	0, "Intel 82559 PCI/CardBus Pro/100" },
+    { 0x1030,	-1,	0, "Intel 82559 Pro/100 Ethernet" },
+    { 0x1031,	-1,	3, "Intel 82801CAM (ICH3) Pro/100 VE Ethernet" },
+    { 0x1032,	-1,	3, "Intel 82801CAM (ICH3) Pro/100 VE Ethernet" },
+    { 0x1033,	-1,	3, "Intel 82801CAM (ICH3) Pro/100 VM Ethernet" },
+    { 0x1034,	-1,	3, "Intel 82801CAM (ICH3) Pro/100 VM Ethernet" },
+    { 0x1035,	-1,	3, "Intel 82801CAM (ICH3) Pro/100 Ethernet" },
+    { 0x1036,	-1,	3, "Intel 82801CAM (ICH3) Pro/100 Ethernet" },
+    { 0x1037,	-1,	3, "Intel 82801CAM (ICH3) Pro/100 Ethernet" },
+    { 0x1038,	-1,	3, "Intel 82801CAM (ICH3) Pro/100 VM Ethernet" },
+    { 0x1039,	-1,	4, "Intel 82801DB (ICH4) Pro/100 VE Ethernet" },
+    { 0x103A,	-1,	4, "Intel 82801DB (ICH4) Pro/100 Ethernet" },
+    { 0x103B,	-1,	4, "Intel 82801DB (ICH4) Pro/100 VM Ethernet" },
+    { 0x103C,	-1,	4, "Intel 82801DB (ICH4) Pro/100 Ethernet" },
+    { 0x103D,	-1,	4, "Intel 82801DB (ICH4) Pro/100 VE Ethernet" },
+    { 0x103E,	-1,	4, "Intel 82801DB (ICH4) Pro/100 VM Ethernet" },
+    { 0x1050,	-1,	5, "Intel 82801BA (D865) Pro/100 VE Ethernet" },
+    { 0x1051,	-1,	5, "Intel 82562ET (ICH5/ICH5R) Pro/100 VE Ethernet" },
+    { 0x1059,	-1,	0, "Intel 82551QM Pro/100 M Mobile Connection" },
+    { 0x1064,	-1,	6, "Intel 82562EZ (ICH6)" },
+    { 0x1065,	-1,	6, "Intel 82562ET/EZ/GT/GZ PRO/100 VE Ethernet" },
+    { 0x1068,	-1,	6, "Intel 82801FBM (ICH6-M) Pro/100 VE Ethernet" },
+    { 0x1069,	-1,	6, "Intel 82562EM/EX/GX Pro/100 Ethernet" },
+    { 0x1091,	-1,	7, "Intel 82562GX Pro/100 Ethernet" },
+    { 0x1092,	-1,	7, "Intel Pro/100 VE Network Connection" },
+    { 0x1093,	-1,	7, "Intel Pro/100 VM Network Connection" },
+    { 0x1094,	-1,	7, "Intel Pro/100 946GZ (ICH7) Network Connection" },
+    { 0x1209,	-1,	0, "Intel 82559ER Embedded 10/100 Ethernet" },
+    { 0x1229,	0x01,	0, "Intel 82557 Pro/100 Ethernet" },
+    { 0x1229,	0x02,	0, "Intel 82557 Pro/100 Ethernet" },
+    { 0x1229,	0x03,	0, "Intel 82557 Pro/100 Ethernet" },
+    { 0x1229,	0x04,	0, "Intel 82558 Pro/100 Ethernet" },
+    { 0x1229,	0x05,	0, "Intel 82558 Pro/100 Ethernet" },
+    { 0x1229,	0x06,	0, "Intel 82559 Pro/100 Ethernet" },
+    { 0x1229,	0x07,	0, "Intel 82559 Pro/100 Ethernet" },
+    { 0x1229,	0x08,	0, "Intel 82559 Pro/100 Ethernet" },
+    { 0x1229,	0x09,	0, "Intel 82559ER Pro/100 Ethernet" },
+    { 0x1229,	0x0c,	0, "Intel 82550 Pro/100 Ethernet" },
+    { 0x1229,	0x0d,	0, "Intel 82550 Pro/100 Ethernet" },
+    { 0x1229,	0x0e,	0, "Intel 82550 Pro/100 Ethernet" },
+    { 0x1229,	0x0f,	0, "Intel 82551 Pro/100 Ethernet" },
+    { 0x1229,	0x10,	0, "Intel 82551 Pro/100 Ethernet" },
+    { 0x1229,	-1,	0, "Intel 82557/8/9 Pro/100 Ethernet" },
+    { 0x2449,	-1,	2, "Intel 82801BA/CAM (ICH2/3) Pro/100 Ethernet" },
+    { 0x27dc,	-1,	7, "Intel 82801GB (ICH7) 10/100 Ethernet" },
+    { 0,	-1,	0, NULL },
 };
 
 #ifdef FXP_IP_CSUM_WAR
@@ -214,6 +208,7 @@ static int		fxp_shutdown(device_t dev);
 static int		fxp_suspend(device_t dev);
 static int		fxp_resume(device_t dev);
 
+static struct fxp_ident	*fxp_find_ident(device_t dev);
 static void		fxp_intr(void *xsc);
 static void		fxp_rxcsum(struct fxp_softc *sc, struct ifnet *ifp,
 			    struct mbuf *m, uint16_t status, int pos);
@@ -361,11 +356,8 @@ fxp_dma_wait(struct fxp_softc *sc, volat
 		device_printf(sc->dev, "DMA timeout\n");
 }
 
-/*
- * Return identification string if this device is ours.
- */
-static int
-fxp_probe(device_t dev)
+static struct fxp_ident *
+fxp_find_ident(device_t dev)
 {
 	uint16_t devid;
 	uint8_t revid;
@@ -377,11 +369,26 @@ fxp_probe(device_t dev)
 		for (ident = fxp_ident_table; ident->name != NULL; ident++) {
 			if (ident->devid == devid &&
 			    (ident->revid == revid || ident->revid == -1)) {
-				device_set_desc(dev, ident->name);
-				return (BUS_PROBE_DEFAULT);
+				return (ident);
 			}
 		}
 	}
+	return (NULL);
+}
+
+/*
+ * Return identification string if this device is ours.
+ */
+static int
+fxp_probe(device_t dev)
+{
+	struct fxp_ident *ident;
+
+	ident = fxp_find_ident(dev);
+	if (ident != NULL) {
+		device_set_desc(dev, ident->name);
+		return (BUS_PROBE_DEFAULT);
+	}
 	return (ENXIO);
 }
 
@@ -484,11 +491,17 @@ fxp_attach(device_t dev)
 	/*
 	 * Find out the chip revision; lump all 82557 revs together.
 	 */
-	fxp_read_eeprom(sc, &data, 5, 1);
-	if ((data >> 8) == 1)
-		sc->revision = FXP_REV_82557;
-	else
-		sc->revision = pci_get_revid(dev);
+	sc->ident = fxp_find_ident(dev);
+	if (sc->ident->ich > 0) {
+		/* Assume ICH controllers are 82559. */
+		sc->revision = FXP_REV_82559_A0;
+	} else {
+		fxp_read_eeprom(sc, &data, 5, 1);
+		if ((data >> 8) == 1)
+			sc->revision = FXP_REV_82557;
+		else
+			sc->revision = pci_get_revid(dev);
+	}
 
 	/*
 	 * Check availability of WOL. 82559ER does not support WOL.
@@ -561,9 +574,8 @@ fxp_attach(device_t dev)
 	 *
 	 * See Intel 82801BA/82801BAM Specification Update, Errata #30.
 	 */
-	i = pci_get_device(dev);
-	if (i == 0x2449 || (i > 0x1030 && i < 0x1039) ||
-	    sc->revision >= FXP_REV_82559_A0) {
+	if ((sc->ident->ich >= 2 && sc->ident->ich <= 3) ||
+	    (sc->ident->ich == 0 && sc->revision >= FXP_REV_82559_A0)) {
 		fxp_read_eeprom(sc, &data, 10, 1);
 		if (data & 0x02) {			/* STB enable */
 			uint16_t cksum;
@@ -2240,9 +2252,13 @@ fxp_init_body(struct fxp_softc *sc)
 
 	/*
 	 * Attempt to load microcode if requested.
+	 * For ICH based controllers do not load microcode.
 	 */
-	if (ifp->if_flags & IFF_LINK0 && (sc->flags & FXP_FLAG_UCODE) == 0)
-		fxp_load_ucode(sc);
+	if (sc->ident->ich == 0) {
+		if (ifp->if_flags & IFF_LINK0 &&
+		    (sc->flags & FXP_FLAG_UCODE) == 0)
+			fxp_load_ucode(sc);
+	}
 
 	/*
 	 * Set IFF_ALLMULTI status. It's needed in configure action

Modified: stable/7/sys/dev/fxp/if_fxpvar.h
==============================================================================
--- stable/7/sys/dev/fxp/if_fxpvar.h	Wed Nov  4 18:20:31 2009	(r198917)
+++ stable/7/sys/dev/fxp/if_fxpvar.h	Wed Nov  4 18:22:59 2009	(r198918)
@@ -142,6 +142,13 @@ struct fxp_desc_list {
 	bus_dma_tag_t rx_tag;
 };
 
+struct fxp_ident {
+	uint16_t	devid;
+	int16_t		revid;		/* -1 matches anything */
+	uint8_t		ich;
+	char 		*name;
+};
+
 /*
  * NOTE: Elements are ordered for optimal cacheline behavior, and NOT
  *	 for functional grouping.
@@ -151,6 +158,7 @@ struct fxp_softc {
 	struct resource	*fxp_res[2];	/* I/O and IRQ resources */
 	struct resource_spec *fxp_spec;	/* the resource spec we used */
 	void *ih;			/* interrupt handler cookie */
+	struct fxp_ident *ident;
 	struct mtx sc_mtx;
 	bus_dma_tag_t fxp_txmtag;	/* bus DMA tag for Tx mbufs */
 	bus_dma_tag_t fxp_rxmtag;	/* bus DMA tag for Rx mbufs */
From yongari at FreeBSD.org  Wed Nov  4 18:34:15 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed Nov  4 18:34:26 2009
Subject: svn commit: r198920 - stable/7/sys/dev/fxp
Message-ID: <200911041834.nA4IYEkk042244@svn.freebsd.org>

Author: yongari
Date: Wed Nov  4 18:34:14 2009
New Revision: 198920
URL: http://svn.freebsd.org/changeset/base/198920

Log:
  MFC r197586:
    It seems some 82559ER controllers do not support Rx checksum
    offloading. Datasheet said nothing about the limitation of 82559ER
    except WOL. Explicitly disable Rx checksum offloading for
    controllers that is known to lack the capability.
  
    PR:	kern/138135
    Tested by:	Gooderum, Mark < mgooderum <> websense dot com >

Modified:
  stable/7/sys/dev/fxp/if_fxp.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/fxp/if_fxp.c
==============================================================================
--- stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:31:43 2009	(r198919)
+++ stable/7/sys/dev/fxp/if_fxp.c	Wed Nov  4 18:34:14 2009	(r198920)
@@ -632,8 +632,11 @@ fxp_attach(device_t dev)
 	}
 
 	/* For 82559 or later chips, Rx checksum offload is supported. */
-	if (sc->revision >= FXP_REV_82559_A0)
-		sc->flags |= FXP_FLAG_82559_RXCSUM;
+	if (sc->revision >= FXP_REV_82559_A0) {
+		/* 82559ER does not support Rx checksum offloading. */
+		if (sc->ident->devid != 0x1209)
+			sc->flags |= FXP_FLAG_82559_RXCSUM;
+	}
 	/*
 	 * Enable use of extended RFDs and TCBs for 82550
 	 * and later chips. Note: we need extended TXCB support
From yongari at FreeBSD.org  Wed Nov  4 19:01:36 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed Nov  4 19:01:48 2009
Subject: svn commit: r198922 - stable/7/sys/dev/de
Message-ID: <200911041901.nA4J1ZB2043098@svn.freebsd.org>

Author: yongari
Date: Wed Nov  4 19:01:35 2009
New Revision: 198922
URL: http://svn.freebsd.org/changeset/base/198922

Log:
  MFC r197461:
    Use __NO_STRICT_ALIGNMENT to determine whether de(4) have to apply
    alignment fixup code for received frames on strict alignment
    architectures.
  
  MFC r197463:
   Consistently use bus_addr_t.
  
  MFC r197464:
    Destroy dmamap in dma cleanup.
  
  MFC r197465:
    Align Tx/Rx descriptors on 32 bytes boundary instead of PAGE_SIZE.
    Also align setup descriptor on 32 bytes boundary. Tx buffer have no
    alignment limitation so create dmamap without alignment
    restriction[1]. Rx buffer still seems to require 4 bytes alignment
    limitation but we can simply use MCLBYTES for size to map the
    buffer instead of TULIP_DATA_PER_DESC as the buffer is allocated
    with m_getcl(9).
    de(4) supports up to TULIP_MAX_TXSEG segments for Tx buffers,
    increase maximum dma segment size to TULIP_MAX_TXSEG * MCLBYTES.
    While I'm here remove TULIP_DATA_PER_DESC as it is not used anymore.
  
    This should fix de(4) breakage introduced after r176206.
    Submitted by:	jhb [1]
    Reported by:	WATANABE Kazuhiro < CQG00620 <> nifty dot ne dot jp >
    Tested by:	WATANABE Kazuhiro < CQG00620 <> nifty dot ne dot jp >,
  		Takahashi Yoshihiro < nyan <> jp dot freebsd dot org >

Modified:
  stable/7/sys/dev/de/if_de.c
  stable/7/sys/dev/de/if_devar.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/de/if_de.c
==============================================================================
--- stable/7/sys/dev/de/if_de.c	Wed Nov  4 18:40:05 2009	(r198921)
+++ stable/7/sys/dev/de/if_de.c	Wed Nov  4 19:01:35 2009	(r198922)
@@ -160,7 +160,7 @@ static void	tulip_dma_map_rxbuf(void *, 
 static void
 tulip_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error)
 {
-    u_int32_t *paddr;
+    bus_addr_t *paddr;
 
     if (error)
 	return;
@@ -182,7 +182,7 @@ tulip_dma_map_rxbuf(void *arg, bus_dma_s
     KASSERT(nseg == 1, ("too many DMA segments"));
     KASSERT(segs[0].ds_len >= TULIP_RX_BUFLEN, ("receive buffer too small"));
 
-    desc->d_addr1 = segs[0].ds_addr;
+    desc->d_addr1 = segs[0].ds_addr & 0xffffffff;
     desc->d_length1 = TULIP_RX_BUFLEN;
 #ifdef not_needed
     /* These should already always be zero. */
@@ -3171,8 +3171,8 @@ tulip_reset(tulip_softc_t * const sc)
 	sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
     }
 
-    TULIP_CSR_WRITE(sc, csr_txlist, sc->tulip_txinfo.ri_dma_addr);
-    TULIP_CSR_WRITE(sc, csr_rxlist, sc->tulip_rxinfo.ri_dma_addr);
+    TULIP_CSR_WRITE(sc, csr_txlist, sc->tulip_txinfo.ri_dma_addr & 0xffffffff);
+    TULIP_CSR_WRITE(sc, csr_rxlist, sc->tulip_rxinfo.ri_dma_addr & 0xffffffff);
     TULIP_CSR_WRITE(sc, csr_busmode,
 		    (1 << (3 /*pci_max_burst_len*/ + 8))
 		    |TULIP_BUSMODE_CACHE_ALIGN8
@@ -3488,7 +3488,7 @@ tulip_rx_intr(tulip_softc_t * const sc)
 	    struct mbuf *m0;
 
 	    KASSERT(ms != NULL, ("no packet to accept"));
-#if defined(TULIP_COPY_RXDATA)
+#ifndef	__NO_STRICT_ALIGNMENT
 	    /*
 	     * Copy the data into a new mbuf that is properly aligned.  If
 	     * we fail to allocate a new mbuf, then drop the packet.  We will
@@ -3527,7 +3527,7 @@ tulip_rx_intr(tulip_softc_t * const sc)
 	     */
 	    ms = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
 
-#if defined(TULIP_COPY_RXDATA)
+#ifndef __NO_STRICT_ALIGNMENT
     skip_input:
 #endif
 	if (ms == NULL) {
@@ -4016,9 +4016,9 @@ tulip_txput(tulip_softc_t * const sc, st
 	eop = nextout;
 	eop->di_desc->d_flag   &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN;
 	eop->di_desc->d_status  = d_status;
-	eop->di_desc->d_addr1   = segs[segcnt].ds_addr;
+	eop->di_desc->d_addr1   = segs[segcnt].ds_addr & 0xffffffff;
 	eop->di_desc->d_length1 = segs[segcnt].ds_len;
-	eop->di_desc->d_addr2   = segs[segcnt+1].ds_addr;
+	eop->di_desc->d_addr2   = segs[segcnt+1].ds_addr & 0xffffffff;
 	eop->di_desc->d_length2 = segs[segcnt+1].ds_len;
 	d_status = TULIP_DSTS_OWNER;
 	if (++nextout == ri->ri_last)
@@ -4028,7 +4028,7 @@ tulip_txput(tulip_softc_t * const sc, st
 	eop = nextout;
 	eop->di_desc->d_flag   &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN;
 	eop->di_desc->d_status  = d_status;
-	eop->di_desc->d_addr1   = segs[segcnt].ds_addr;
+	eop->di_desc->d_addr1   = segs[segcnt].ds_addr & 0xffffffff;
 	eop->di_desc->d_length1 = segs[segcnt].ds_len;
 	eop->di_desc->d_addr2   = 0;
 	eop->di_desc->d_length2 = 0;
@@ -4194,7 +4194,7 @@ tulip_txput_setup(tulip_softc_t * const 
     nextout->d_length2 = 0;
     nextout->d_addr2 = 0;
     nextout->d_length1 = sizeof(sc->tulip_setupdata);
-    nextout->d_addr1 = sc->tulip_setup_dma_addr;
+    nextout->d_addr1 = sc->tulip_setup_dma_addr & 0xffffffff;
     bus_dmamap_sync(sc->tulip_setup_tag, sc->tulip_setup_map,
 	BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
     TULIP_TXDESC_PRESYNC(ri);
@@ -4491,7 +4491,7 @@ tulip_busdma_freering(tulip_ringinfo_t *
 /* Allocate memory for a single descriptor ring. */
 static int
 tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count,
-    bus_size_t maxsize, int nsegs, tulip_ringinfo_t *ri, const char *name)
+    bus_size_t align, int nsegs, tulip_ringinfo_t *ri, const char *name)
 {
     size_t size;
     int error, i;
@@ -4499,7 +4499,7 @@ tulip_busdma_allocring(device_t dev, tul
     /* First, setup a tag. */
     ri->ri_max = count;
     size = count * sizeof(tulip_desc_t);
-    error = bus_dma_tag_create(NULL, PAGE_SIZE, 0, BUS_SPACE_MAXADDR_32BIT,
+    error = bus_dma_tag_create(NULL, 32, 0, BUS_SPACE_MAXADDR_32BIT,
 	BUS_SPACE_MAXADDR, NULL, NULL, size, 1, size, 0, NULL, NULL,
 	&ri->ri_ring_tag);
     if (error) {
@@ -4527,9 +4527,9 @@ tulip_busdma_allocring(device_t dev, tul
     }
 
     /* Allocate a tag for the data buffers. */
-    error = bus_dma_tag_create(NULL, 4, 0,
+    error = bus_dma_tag_create(NULL, align, 0,
 	BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
-	maxsize, nsegs, TULIP_DATA_PER_DESC, 0, NULL, NULL, &ri->ri_data_tag);
+	MCLBYTES * nsegs, nsegs, MCLBYTES, 0, NULL, NULL, &ri->ri_data_tag);
     if (error) {
 	device_printf(dev, "failed to allocate %s buffer dma tag\n", name);
 	return (error);
@@ -4563,6 +4563,7 @@ tulip_busdma_cleanup(tulip_softc_t * con
     if (sc->tulip_setupbuf != NULL) {
 	bus_dmamem_free(sc->tulip_setup_tag, sc->tulip_setupdata,
 	    sc->tulip_setup_map);
+	bus_dmamap_destroy(sc->tulip_setup_tag, sc->tulip_setup_map);
 	sc->tulip_setup_map = NULL;
 	sc->tulip_setupbuf = NULL;
     }
@@ -4586,8 +4587,8 @@ tulip_busdma_init(device_t dev, tulip_so
     /*
      * Allocate space and dmamap for transmit ring.
      */
-    error = tulip_busdma_allocring(dev, sc, TULIP_TXDESCS, TULIP_DATA_PER_DESC,
-	TULIP_MAX_TXSEG, &sc->tulip_txinfo, "transmit");
+    error = tulip_busdma_allocring(dev, sc, TULIP_TXDESCS, 1, TULIP_MAX_TXSEG,
+	&sc->tulip_txinfo, "transmit");
     if (error)
 	return (error);
 
@@ -4598,7 +4599,7 @@ tulip_busdma_init(device_t dev, tulip_so
      * a waste in practice though as an ethernet frame can easily fit
      * in TULIP_RX_BUFLEN bytes.
      */
-    error = tulip_busdma_allocring(dev, sc, TULIP_RXDESCS, MCLBYTES, 1,
+    error = tulip_busdma_allocring(dev, sc, TULIP_RXDESCS, 4, 1,
 	&sc->tulip_rxinfo, "receive");
     if (error)
 	return (error);
@@ -4606,7 +4607,7 @@ tulip_busdma_init(device_t dev, tulip_so
     /*
      * Allocate a DMA tag, memory, and map for setup descriptor
      */
-    error = bus_dma_tag_create(NULL, 4, 0,
+    error = bus_dma_tag_create(NULL, 32, 0,
 	BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 	sizeof(sc->tulip_setupdata), 1, sizeof(sc->tulip_setupdata), 0,
 	NULL, NULL, &sc->tulip_setup_tag);

Modified: stable/7/sys/dev/de/if_devar.h
==============================================================================
--- stable/7/sys/dev/de/if_devar.h	Wed Nov  4 18:40:05 2009	(r198921)
+++ stable/7/sys/dev/de/if_devar.h	Wed Nov  4 19:01:35 2009	(r198922)
@@ -104,7 +104,7 @@ typedef struct {
 	tulip_descinfo_t *ri_descinfo;
 	bus_dma_tag_t	ri_ring_tag;
 	bus_dmamap_t	ri_ring_map;
-	uint32_t	ri_dma_addr;
+	bus_addr_t	ri_dma_addr;
 	bus_dma_tag_t	ri_data_tag;
 	bus_dmamap_t	*ri_data_maps;
 } tulip_ringinfo_t;
@@ -134,11 +134,7 @@ typedef struct {
  * architecture which can't handle unaligned accesses) because with
  * 100Mb/s cards the copying is just too much of a hit.
  */
-#if !defined(__i386__)
-#define	TULIP_COPY_RXDATA	1
-#endif
 
-#define	TULIP_DATA_PER_DESC	2032
 #define	TULIP_TXTIMER		4
 #define	TULIP_RXDESCS		48
 #define	TULIP_TXDESCS		128
@@ -560,7 +556,7 @@ struct tulip_softc {
 	 */
 	bus_dma_tag_t		tulip_setup_tag;
 	bus_dmamap_t		tulip_setup_map;
-	uint32_t		tulip_setup_dma_addr;
+	bus_addr_t		tulip_setup_dma_addr;
 	u_int32_t		*tulip_setupbuf;
 	u_int32_t		tulip_setupdata[192 / sizeof(u_int32_t)];
 	char			tulip_boardid[24];
From jhb at FreeBSD.org  Wed Nov  4 20:53:36 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Wed Nov  4 20:53:48 2009
Subject: svn commit: r198926 - in stable/7/sys: amd64/linux32 i386/linux
Message-ID: <200911042053.nA4KrZh8046264@svn.freebsd.org>

Author: jhb
Date: Wed Nov  4 20:53:35 2009
New Revision: 198926
URL: http://svn.freebsd.org/changeset/base/198926

Log:
  MFC 198554:
  Fix some problems with effective mmap() offsets > 32 bits.  This was
  partially fixed on amd64 earlier.  Rather than forcing linux_mmap_common()
  to use a 32-bit offset, have it accept a 64-bit file offset.  This offset
  is then passed to the real mmap() call.  Rather than inventing a structure
  to hold the normal linux_mmap args that has a 64-bit offset, just pass
  each of the arguments individually to linux_mmap_common() since that more
  closes matches the existing style of various kern_foo() functions.

Modified:
  stable/7/sys/amd64/linux32/linux32_machdep.c
  stable/7/sys/i386/linux/linux_machdep.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/amd64/linux32/linux32_machdep.c
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_machdep.c	Wed Nov  4 20:49:14 2009	(r198925)
+++ stable/7/sys/amd64/linux32/linux32_machdep.c	Wed Nov  4 20:53:35 2009	(r198926)
@@ -91,6 +91,10 @@ linux_to_bsd_sigaltstack(int lsa)
 	return (bsa);
 }
 
+static int	linux_mmap_common(struct thread *td, l_uintptr_t addr,
+		    l_size_t len, l_int prot, l_int flags, l_int fd,
+		    l_loff_t pos);
+
 int
 bsd_to_linux_sigaltstack(int bsa)
 {
@@ -759,12 +763,9 @@ linux_clone(struct thread *td, struct li
 #define STACK_SIZE  (2 * 1024 * 1024)
 #define GUARD_SIZE  (4 * PAGE_SIZE)
 
-static int linux_mmap_common(struct thread *, struct l_mmap_argv *);
-
 int
 linux_mmap2(struct thread *td, struct linux_mmap2_args *args)
 {
-	struct l_mmap_argv linux_args;
 
 #ifdef DEBUG
 	if (ldebug(mmap2))
@@ -773,14 +774,9 @@ linux_mmap2(struct thread *td, struct li
 		    args->flags, args->fd, args->pgoff);
 #endif
 
-	linux_args.addr = PTROUT(args->addr);
-	linux_args.len = args->len;
-	linux_args.prot = args->prot;
-	linux_args.flags = args->flags;
-	linux_args.fd = args->fd;
-	linux_args.pgoff = args->pgoff;
-
-	return (linux_mmap_common(td, &linux_args));
+	return (linux_mmap_common(td, PTROUT(args->addr), args->len, args->prot,
+		args->flags, args->fd, (uint64_t)(uint32_t)args->pgoff *
+		PAGE_SIZE));
 }
 
 int
@@ -799,15 +795,15 @@ linux_mmap(struct thread *td, struct lin
 		    linux_args.addr, linux_args.len, linux_args.prot,
 		    linux_args.flags, linux_args.fd, linux_args.pgoff);
 #endif
-	if ((linux_args.pgoff % PAGE_SIZE) != 0)
-		return (EINVAL);
-	linux_args.pgoff /= PAGE_SIZE;
 
-	return (linux_mmap_common(td, &linux_args));
+	return (linux_mmap_common(td, linux_args.addr, linux_args.len,
+	    linux_args.prot, linux_args.flags, linux_args.fd,
+	    (uint32_t)linux_args.pgoff));
 }
 
 static int
-linux_mmap_common(struct thread *td, struct l_mmap_argv *linux_args)
+linux_mmap_common(struct thread *td, l_uintptr_t addr, l_size_t len, l_int prot,
+    l_int flags, l_int fd, l_loff_t pos)
 {
 	struct proc *p = td->td_proc;
 	struct mmap_args /* {
@@ -830,21 +826,20 @@ linux_mmap_common(struct thread *td, str
 	 * Linux mmap(2):
 	 * You must specify exactly one of MAP_SHARED and MAP_PRIVATE
 	 */
-	if (! ((linux_args->flags & LINUX_MAP_SHARED) ^
-	    (linux_args->flags & LINUX_MAP_PRIVATE)))
+	if (!((flags & LINUX_MAP_SHARED) ^ (flags & LINUX_MAP_PRIVATE)))
 		return (EINVAL);
 
-	if (linux_args->flags & LINUX_MAP_SHARED)
+	if (flags & LINUX_MAP_SHARED)
 		bsd_args.flags |= MAP_SHARED;
-	if (linux_args->flags & LINUX_MAP_PRIVATE)
+	if (flags & LINUX_MAP_PRIVATE)
 		bsd_args.flags |= MAP_PRIVATE;
-	if (linux_args->flags & LINUX_MAP_FIXED)
+	if (flags & LINUX_MAP_FIXED)
 		bsd_args.flags |= MAP_FIXED;
-	if (linux_args->flags & LINUX_MAP_ANON)
+	if (flags & LINUX_MAP_ANON)
 		bsd_args.flags |= MAP_ANON;
 	else
 		bsd_args.flags |= MAP_NOSYNC;
-	if (linux_args->flags & LINUX_MAP_GROWSDOWN)
+	if (flags & LINUX_MAP_GROWSDOWN)
 		bsd_args.flags |= MAP_STACK;
 
 	/*
@@ -852,12 +847,12 @@ linux_mmap_common(struct thread *td, str
 	 * on Linux/i386. We do this to ensure maximum compatibility.
 	 * Linux/ia64 does the same in i386 emulation mode.
 	 */
-	bsd_args.prot = linux_args->prot;
+	bsd_args.prot = prot;
 	if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC))
 		bsd_args.prot |= PROT_READ | PROT_EXEC;
 
 	/* Linux does not check file descriptor when MAP_ANONYMOUS is set. */
-	bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : linux_args->fd;
+	bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : fd;
 	if (bsd_args.fd != -1) {
 		/*
 		 * Linux follows Solaris mmap(2) description:
@@ -882,7 +877,7 @@ linux_mmap_common(struct thread *td, str
 		fdrop(fp, td);
 	}
 
-	if (linux_args->flags & LINUX_MAP_GROWSDOWN) {
+	if (flags & LINUX_MAP_GROWSDOWN) {
 		/*
 		 * The Linux MAP_GROWSDOWN option does not limit auto
 		 * growth of the region.  Linux mmap with this option
@@ -905,8 +900,7 @@ linux_mmap_common(struct thread *td, str
 		 * fixed size of (STACK_SIZE - GUARD_SIZE).
 		 */
 
-		if ((caddr_t)PTRIN(linux_args->addr) + linux_args->len >
-		    p->p_vmspace->vm_maxsaddr) {
+		if ((caddr_t)PTRIN(addr) + len > p->p_vmspace->vm_maxsaddr) {
 			/*
 			 * Some Linux apps will attempt to mmap
 			 * thread stacks near the top of their
@@ -937,19 +931,19 @@ linux_mmap_common(struct thread *td, str
 		 * we map the full stack, since we don't have a way
 		 * to autogrow it.
 		 */
-		if (linux_args->len > STACK_SIZE - GUARD_SIZE) {
-			bsd_args.addr = (caddr_t)PTRIN(linux_args->addr);
-			bsd_args.len = linux_args->len;
+		if (len > STACK_SIZE - GUARD_SIZE) {
+			bsd_args.addr = (caddr_t)PTRIN(addr);
+			bsd_args.len = len;
 		} else {
-			bsd_args.addr = (caddr_t)PTRIN(linux_args->addr) -
-			    (STACK_SIZE - GUARD_SIZE - linux_args->len);
+			bsd_args.addr = (caddr_t)PTRIN(addr) -
+			    (STACK_SIZE - GUARD_SIZE - len);
 			bsd_args.len = STACK_SIZE - GUARD_SIZE;
 		}
 	} else {
-		bsd_args.addr = (caddr_t)PTRIN(linux_args->addr);
-		bsd_args.len  = linux_args->len;
+		bsd_args.addr = (caddr_t)PTRIN(addr);
+		bsd_args.len  = len;
 	}
-	bsd_args.pos = (off_t)linux_args->pgoff * PAGE_SIZE;
+	bsd_args.pos = pos;
 
 #ifdef DEBUG
 	if (ldebug(mmap))

Modified: stable/7/sys/i386/linux/linux_machdep.c
==============================================================================
--- stable/7/sys/i386/linux/linux_machdep.c	Wed Nov  4 20:49:14 2009	(r198925)
+++ stable/7/sys/i386/linux/linux_machdep.c	Wed Nov  4 20:53:35 2009	(r198926)
@@ -93,6 +93,10 @@ struct l_old_select_argv {
 	struct l_timeval	*timeout;
 };
 
+static int	linux_mmap_common(struct thread *td, l_uintptr_t addr,
+		    l_size_t len, l_int prot, l_int flags, l_int fd,
+		    l_loff_t pos);
+
 int
 linux_to_bsd_sigaltstack(int lsa)
 {
@@ -591,12 +595,9 @@ linux_clone(struct thread *td, struct li
 #define STACK_SIZE  (2 * 1024 * 1024)
 #define GUARD_SIZE  (4 * PAGE_SIZE)
 
-static int linux_mmap_common(struct thread *, struct l_mmap_argv *);
-
 int
 linux_mmap2(struct thread *td, struct linux_mmap2_args *args)
 {
-	struct l_mmap_argv linux_args;
 
 #ifdef DEBUG
 	if (ldebug(mmap2))
@@ -605,14 +606,9 @@ linux_mmap2(struct thread *td, struct li
 		    args->flags, args->fd, args->pgoff);
 #endif
 
-	linux_args.addr = args->addr;
-	linux_args.len = args->len;
-	linux_args.prot = args->prot;
-	linux_args.flags = args->flags;
-	linux_args.fd = args->fd;
-	linux_args.pgoff = args->pgoff * PAGE_SIZE;
-
-	return (linux_mmap_common(td, &linux_args));
+	return (linux_mmap_common(td, args->addr, args->len, args->prot,
+		args->flags, args->fd, (uint64_t)(uint32_t)args->pgoff *
+		PAGE_SIZE));
 }
 
 int
@@ -632,11 +628,14 @@ linux_mmap(struct thread *td, struct lin
 		    linux_args.flags, linux_args.fd, linux_args.pgoff);
 #endif
 
-	return (linux_mmap_common(td, &linux_args));
+	return (linux_mmap_common(td, linux_args.addr, linux_args.len,
+	    linux_args.prot, linux_args.flags, linux_args.fd,
+	    (uint32_t)linux_args.pgoff));
 }
 
 static int
-linux_mmap_common(struct thread *td, struct l_mmap_argv *linux_args)
+linux_mmap_common(struct thread *td, l_uintptr_t addr, l_size_t len, l_int prot,
+    l_int flags, l_int fd, l_loff_t pos)
 {
 	struct proc *p = td->td_proc;
 	struct mmap_args /* {
@@ -659,21 +658,20 @@ linux_mmap_common(struct thread *td, str
 	 * Linux mmap(2):
 	 * You must specify exactly one of MAP_SHARED and MAP_PRIVATE
 	 */
-	if (! ((linux_args->flags & LINUX_MAP_SHARED) ^
-	    (linux_args->flags & LINUX_MAP_PRIVATE)))
+	if (!((flags & LINUX_MAP_SHARED) ^ (flags & LINUX_MAP_PRIVATE)))
 		return (EINVAL);
 
-	if (linux_args->flags & LINUX_MAP_SHARED)
+	if (flags & LINUX_MAP_SHARED)
 		bsd_args.flags |= MAP_SHARED;
-	if (linux_args->flags & LINUX_MAP_PRIVATE)
+	if (flags & LINUX_MAP_PRIVATE)
 		bsd_args.flags |= MAP_PRIVATE;
-	if (linux_args->flags & LINUX_MAP_FIXED)
+	if (flags & LINUX_MAP_FIXED)
 		bsd_args.flags |= MAP_FIXED;
-	if (linux_args->flags & LINUX_MAP_ANON)
+	if (flags & LINUX_MAP_ANON)
 		bsd_args.flags |= MAP_ANON;
 	else
 		bsd_args.flags |= MAP_NOSYNC;
-	if (linux_args->flags & LINUX_MAP_GROWSDOWN)
+	if (flags & LINUX_MAP_GROWSDOWN)
 		bsd_args.flags |= MAP_STACK;
 
 	/*
@@ -681,12 +679,12 @@ linux_mmap_common(struct thread *td, str
 	 * on Linux/i386. We do this to ensure maximum compatibility.
 	 * Linux/ia64 does the same in i386 emulation mode.
 	 */
-	bsd_args.prot = linux_args->prot;
+	bsd_args.prot = prot;
 	if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC))
 		bsd_args.prot |= PROT_READ | PROT_EXEC;
 
 	/* Linux does not check file descriptor when MAP_ANONYMOUS is set. */
-	bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : linux_args->fd;
+	bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : fd;
 	if (bsd_args.fd != -1) {
 		/*
 		 * Linux follows Solaris mmap(2) description:
@@ -711,9 +709,9 @@ linux_mmap_common(struct thread *td, str
 		fdrop(fp, td);
 	}
 
-	if (linux_args->flags & LINUX_MAP_GROWSDOWN) {
+	if (flags & LINUX_MAP_GROWSDOWN) {
 		/* 
-		 * The linux MAP_GROWSDOWN option does not limit auto
+		 * The Linux MAP_GROWSDOWN option does not limit auto
 		 * growth of the region.  Linux mmap with this option
 		 * takes as addr the inital BOS, and as len, the initial
 		 * region size.  It can then grow down from addr without
@@ -734,8 +732,7 @@ linux_mmap_common(struct thread *td, str
 		 * fixed size of (STACK_SIZE - GUARD_SIZE).
 		 */
 
-		if ((caddr_t)PTRIN(linux_args->addr) + linux_args->len >
-		    p->p_vmspace->vm_maxsaddr) {
+		if ((caddr_t)PTRIN(addr) + len > p->p_vmspace->vm_maxsaddr) {
 			/* 
 			 * Some linux apps will attempt to mmap
 			 * thread stacks near the top of their
@@ -766,19 +763,19 @@ linux_mmap_common(struct thread *td, str
 		 * we map the full stack, since we don't have a way
 		 * to autogrow it.
 		 */
-		if (linux_args->len > STACK_SIZE - GUARD_SIZE) {
-			bsd_args.addr = (caddr_t)PTRIN(linux_args->addr);
-			bsd_args.len = linux_args->len;
+		if (len > STACK_SIZE - GUARD_SIZE) {
+			bsd_args.addr = (caddr_t)PTRIN(addr);
+			bsd_args.len = len;
 		} else {
-			bsd_args.addr = (caddr_t)PTRIN(linux_args->addr) -
-			    (STACK_SIZE - GUARD_SIZE - linux_args->len);
+			bsd_args.addr = (caddr_t)PTRIN(addr) -
+			    (STACK_SIZE - GUARD_SIZE - len);
 			bsd_args.len = STACK_SIZE - GUARD_SIZE;
 		}
 	} else {
-		bsd_args.addr = (caddr_t)PTRIN(linux_args->addr);
-		bsd_args.len  = linux_args->len;
+		bsd_args.addr = (caddr_t)PTRIN(addr);
+		bsd_args.len  = len;
 	}
-	bsd_args.pos = linux_args->pgoff;
+	bsd_args.pos = pos;
 
 #ifdef DEBUG
 	if (ldebug(mmap))
From emaste at FreeBSD.org  Thu Nov  5 02:29:46 2009
From: emaste at FreeBSD.org (Ed Maste)
Date: Thu Nov  5 02:29:57 2009
Subject: svn commit: r198936 - stable/7/usr.bin/gcore
Message-ID: <200911050229.nA52TkIr054385@svn.freebsd.org>

Author: emaste
Date: Thu Nov  5 02:29:45 2009
New Revision: 198936
URL: http://svn.freebsd.org/changeset/base/198936

Log:
  MFC r197437:
  
    Use %zu for size_t, not %zd.

Modified:
  stable/7/usr.bin/gcore/elfcore.c
Directory Properties:
  stable/7/usr.bin/gcore/   (props changed)

Modified: stable/7/usr.bin/gcore/elfcore.c
==============================================================================
--- stable/7/usr.bin/gcore/elfcore.c	Thu Nov  5 02:27:56 2009	(r198935)
+++ stable/7/usr.bin/gcore/elfcore.c	Thu Nov  5 02:29:45 2009	(r198936)
@@ -158,7 +158,7 @@ elf_coredump(int efd __unused, int fd, p
 				err(1, "read from %s", memname);
 			if ((size_t)ngot < nwant)
 				errx(1, "short read from %s:"
-				    " wanted %zd, got %zd", memname,
+				    " wanted %zu, got %zd", memname,
 				    nwant, ngot);
 			ngot = write(fd, buf, nwant);
 			if (ngot == -1)
@@ -414,7 +414,7 @@ readhdrinfo(pid_t pid, prstatus_t *statu
 	if ((n = read(fd, &status->pr_reg, sizeof status->pr_reg)) == -1)
 		err(1, "read error from %s", name);
 	if ((size_t)n < sizeof(status->pr_reg))
-		errx(1, "short read from %s: wanted %zd, got %d", name,
+		errx(1, "short read from %s: wanted %zu, got %d", name,
 		    sizeof status->pr_reg, n);
 	close(fd);
 
@@ -425,7 +425,7 @@ readhdrinfo(pid_t pid, prstatus_t *statu
 	if ((n = read(fd, fpregset, sizeof *fpregset)) == -1)
 		err(1, "read error from %s", name);
 	if ((size_t)n < sizeof(*fpregset))
-		errx(1, "short read from %s: wanted %zd, got %d", name,
+		errx(1, "short read from %s: wanted %zu, got %d", name,
 		    sizeof *fpregset, n);
 	close(fd);
 
From emaste at FreeBSD.org  Thu Nov  5 18:38:12 2009
From: emaste at FreeBSD.org (Ed Maste)
Date: Thu Nov  5 18:38:24 2009
Subject: svn commit: r198961 - stable/7/sys/dev/aac
Message-ID: <200911051838.nA5IcCVD087301@svn.freebsd.org>

Author: emaste
Date: Thu Nov  5 18:38:12 2009
New Revision: 198961
URL: http://svn.freebsd.org/changeset/base/198961

Log:
  MFC r198525:
  
    Whitespace fixup: 8 spaces -> tab

Modified:
  stable/7/sys/dev/aac/aac.c
  stable/7/sys/dev/aac/aac_cam.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/aac/aac.c
==============================================================================
--- stable/7/sys/dev/aac/aac.c	Thu Nov  5 18:34:01 2009	(r198960)
+++ stable/7/sys/dev/aac/aac.c	Thu Nov  5 18:38:12 2009	(r198961)
@@ -229,7 +229,7 @@ static int		aac_query_disk(struct aac_so
 static int		aac_get_pci_info(struct aac_softc *sc, caddr_t uptr);
 static int		aac_supported_features(struct aac_softc *sc, caddr_t uptr);
 static void		aac_ioctl_event(struct aac_softc *sc,
-				        struct aac_event *event, void *arg);
+					struct aac_event *event, void *arg);
 static struct aac_mntinforesp *
 	aac_get_container_info(struct aac_softc *sc, struct aac_fib *fib, int cid);
 
@@ -3618,7 +3618,7 @@ aac_query_disk(struct aac_softc *sc, cad
 		query_disk.Lun = 0;
 		query_disk.UnMapped = 0;
 		sprintf(&query_disk.diskDeviceName[0], "%s%d",
-		        disk->ad_disk->d_name, disk->ad_disk->d_unit);
+			disk->ad_disk->d_name, disk->ad_disk->d_unit);
 	}
 	mtx_unlock(&sc->aac_container_lock);
 

Modified: stable/7/sys/dev/aac/aac_cam.c
==============================================================================
--- stable/7/sys/dev/aac/aac_cam.c	Thu Nov  5 18:34:01 2009	(r198960)
+++ stable/7/sys/dev/aac/aac_cam.c	Thu Nov  5 18:38:12 2009	(r198961)
@@ -272,10 +272,10 @@ aac_cam_action(struct cam_sim *sim, unio
 		strncpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
 		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
-                cpi->transport = XPORT_SPI;
-                cpi->transport_version = 2;
-                cpi->protocol = PROTO_SCSI;
-                cpi->protocol_version = SCSI_REV_2;
+		cpi->transport = XPORT_SPI;
+		cpi->transport_version = 2;
+		cpi->protocol = PROTO_SCSI;
+		cpi->protocol_version = SCSI_REV_2;
 		ccb->ccb_h.status = CAM_REQ_CMP;
 		xpt_done(ccb);
 		return;
From brueffer at FreeBSD.org  Fri Nov  6 06:57:04 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Fri Nov  6 06:57:10 2009
Subject: svn commit: r198971 - stable/7/sys/dev/aic7xxx
Message-ID: <200911060657.nA66v3D2005999@svn.freebsd.org>

Author: brueffer
Date: Fri Nov  6 06:57:03 2009
New Revision: 198971
URL: http://svn.freebsd.org/changeset/base/198971

Log:
  MFC: r198684
  
  Add support for Adaptec 39320LPE adapters.

Modified:
  stable/7/sys/dev/aic7xxx/aic79xx_pci.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/aic7xxx/aic79xx_pci.c
==============================================================================
--- stable/7/sys/dev/aic7xxx/aic79xx_pci.c	Fri Nov  6 06:50:45 2009	(r198970)
+++ stable/7/sys/dev/aic7xxx/aic79xx_pci.c	Fri Nov  6 06:57:03 2009	(r198971)
@@ -89,6 +89,7 @@ ahd_compose_id(u_int device, u_int vendo
 #define ID_AHA_39320D_B			0x801C900500419005ull
 #define ID_AHA_39320D_HP		0x8011900500AC0E11ull
 #define ID_AHA_39320D_B_HP		0x801C900500AC0E11ull
+#define ID_AHA_39320LPE 		0x8017900500459005ull
 #define ID_AIC7902_PCI_REV_A4		0x3
 #define ID_AIC7902_PCI_REV_B0		0x10
 #define SUBID_HP			0x0E11
@@ -204,6 +205,12 @@ struct ahd_pci_identity ahd_pci_ident_ta
 		"Adaptec (HP OEM) 39320D Ultra320 SCSI adapter",
 		ahd_aic7902_setup
 	},
+	{
+		ID_AHA_39320LPE,
+		ID_ALL_MASK,
+		"Adaptec 39320LPE Ultra320 SCSI adapter",
+		ahd_aic7902_setup
+	},
 	/* Generic chip probes for devices we don't know 'exactly' */
 	{
 		ID_AIC7901 & ID_9005_GENERIC_MASK,
From attilio at FreeBSD.org  Fri Nov  6 10:38:33 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Fri Nov  6 10:38:45 2009
Subject: svn commit: r198979 - in stable/7/sys: amd64/amd64 i386/i386
Message-ID: <200911061038.nA6AcXgU013645@svn.freebsd.org>

Author: attilio
Date: Fri Nov  6 10:38:33 2009
New Revision: 198979
URL: http://svn.freebsd.org/changeset/base/198979

Log:
  MFC r198868, r198950:
  Opteron rev E family of processor expose a bug where acq memory barriers
  can be broken, resulting in random breakages.
  Printout a warning message if affected family and model are found.

Modified:
  stable/7/sys/amd64/amd64/identcpu.c
  stable/7/sys/i386/i386/identcpu.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/amd64/amd64/identcpu.c
==============================================================================
--- stable/7/sys/amd64/amd64/identcpu.c	Fri Nov  6 10:17:08 2009	(r198978)
+++ stable/7/sys/amd64/amd64/identcpu.c	Fri Nov  6 10:38:33 2009	(r198979)
@@ -627,6 +627,21 @@ print_AMD_info(void)
 		printf(", %d lines/tag", (regs[2] >> 8) & 0x0f);
 		print_AMD_l2_assoc((regs[2] >> 12) & 0x0f);	
 	}
+
+	/*
+	 * Opteron Rev E shows a bug as in very rare occasions a read memory 
+	 * barrier is not performed as expected if it is followed by a 
+	 * non-atomic read-modify-write instruction.  
+	 * As long as that bug pops up very rarely (intensive machine usage
+	 * on other operating systems generally generates one unexplainable 
+	 * crash any 2 months) and as long as a model specific fix would be
+	 * impratical at this stage, print out a warning string if the broken
+	 * model and family are identified.
+	 */
+	if (AMD64_CPU_FAMILY(cpu_id) == 0xf &&
+	    AMD64_CPU_MODEL(cpu_id) >= 0x20 && AMD64_CPU_MODEL(cpu_id) <= 0x3f)
+		printf("WARNING: This architecture revision has known SMP "
+		    "hardware bugs which may cause random instability\n");
 }
 
 static void

Modified: stable/7/sys/i386/i386/identcpu.c
==============================================================================
--- stable/7/sys/i386/i386/identcpu.c	Fri Nov  6 10:17:08 2009	(r198978)
+++ stable/7/sys/i386/i386/identcpu.c	Fri Nov  6 10:38:33 2009	(r198979)
@@ -1320,6 +1320,21 @@ print_AMD_info(void)
 			    (amd_whcr & 0x0100) ? "Enable" : "Disable");
 		}
 	}
+
+	/*
+	 * Opteron Rev E shows a bug as in very rare occasions a read memory
+	 * barrier is not performed as expected if it is followed by a
+	 * non-atomic read-modify-write instruction.
+	 * As long as that bug pops up very rarely (intensive machine usage
+	 * on other operating systems generally generates one unexplainable
+	 * crash any 2 months) and as long as a model specific fix would be
+	 * impratical at this stage, print out a warning string if the broken
+	 * model and family are identified.
+	 */
+	if (I386_CPU_FAMILY(cpu_id) == 0xf && I386_CPU_MODEL(cpu_id) >= 0x20 &&
+	    I386_CPU_MODEL(cpu_id) <= 0x3f)
+		printf("WARNING: This architecture revision has known SMP "
+		    "hardware bugs which may cause random instability\n");
 }
 
 static void
From jhb at FreeBSD.org  Fri Nov  6 20:23:43 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri Nov  6 20:24:02 2009
Subject: svn commit: r199001 - in stable/7/sys: kern sys
Message-ID: <200911062023.nA6KNgLt027659@svn.freebsd.org>

Author: jhb
Date: Fri Nov  6 20:23:42 2009
New Revision: 199001
URL: http://svn.freebsd.org/changeset/base/199001

Log:
  MFC 198367:
  Set the devclass_t pointer specified in the DRIVER_MODULE() macro
  sooner so it is always valid when a driver's identify routine is
  called.

Modified:
  stable/7/sys/kern/subr_bus.c
  stable/7/sys/sys/bus.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/subr_bus.c
==============================================================================
--- stable/7/sys/kern/subr_bus.c	Fri Nov  6 20:23:16 2009	(r199000)
+++ stable/7/sys/kern/subr_bus.c	Fri Nov  6 20:23:42 2009	(r199001)
@@ -858,9 +858,10 @@ devclass_find(const char *classname)
  * @param driver	the driver to register
  */
 int
-devclass_add_driver(devclass_t dc, driver_t *driver)
+devclass_add_driver(devclass_t dc, driver_t *driver, devclass_t *dcp)
 {
 	driverlink_t dl;
+	const char *parentname;
 	int i;
 
 	PDEBUG(("%s", DRIVERNAME(driver)));
@@ -878,9 +879,17 @@ devclass_add_driver(devclass_t dc, drive
 	kobj_class_compile((kobj_class_t) driver);
 
 	/*
-	 * Make sure the devclass which the driver is implementing exists.
+	 * If the driver has any base classes, make the
+	 * devclass inherit from the devclass of the driver's
+	 * first base class. This will allow the system to
+	 * search for drivers in both devclasses for children
+	 * of a device using this driver.
 	 */
-	devclass_find_internal(driver->name, NULL, TRUE);
+	if (driver->baseclasses)
+		parentname = driver->baseclasses[0]->name;
+	else
+		parentname = NULL;
+	*dcp = devclass_find_internal(driver->name, parentname, TRUE);
 
 	dl->driver = driver;
 	TAILQ_INSERT_TAIL(&dc->drivers, dl, link);
@@ -3853,27 +3862,8 @@ driver_module_handler(module_t mod, int 
 		driver = dmd->dmd_driver;
 		PDEBUG(("Loading module: driver %s on bus %s",
 		    DRIVERNAME(driver), dmd->dmd_busname));
-		error = devclass_add_driver(bus_devclass, driver);
-		if (error)
-			break;
-
-		/*
-		 * If the driver has any base classes, make the
-		 * devclass inherit from the devclass of the driver's
-		 * first base class. This will allow the system to
-		 * search for drivers in both devclasses for children
-		 * of a device using this driver.
-		 */
-		if (driver->baseclasses) {
-			const char *parentname;
-			parentname = driver->baseclasses[0]->name;
-			*dmd->dmd_devclass =
-				devclass_find_internal(driver->name,
-				    parentname, TRUE);
-		} else {
-			*dmd->dmd_devclass =
-				devclass_find_internal(driver->name, NULL, TRUE);
-		}
+		error = devclass_add_driver(bus_devclass, driver,
+		    dmd->dmd_devclass);
 		break;
 
 	case MOD_UNLOAD:

Modified: stable/7/sys/sys/bus.h
==============================================================================
--- stable/7/sys/sys/bus.h	Fri Nov  6 20:23:16 2009	(r199000)
+++ stable/7/sys/sys/bus.h	Fri Nov  6 20:23:42 2009	(r199001)
@@ -432,7 +432,8 @@ void	device_verbose(device_t dev);
 /*
  * Access functions for devclass.
  */
-int	devclass_add_driver(devclass_t dc, kobj_class_t driver);
+int	devclass_add_driver(devclass_t dc, kobj_class_t driver,
+			    devclass_t *dcp);
 int	devclass_delete_driver(devclass_t dc, kobj_class_t driver);
 devclass_t	devclass_create(const char *classname);
 devclass_t	devclass_find(const char *classname);
From jhb at FreeBSD.org  Fri Nov  6 20:33:54 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri Nov  6 20:34:14 2009
Subject: svn commit: r199004 - stable/7/usr.bin/vmstat
Message-ID: <200911062033.nA6KXr20028001@svn.freebsd.org>

Author: jhb
Date: Fri Nov  6 20:33:53 2009
New Revision: 199004
URL: http://svn.freebsd.org/changeset/base/199004

Log:
  MFC 198620:
  When fetching sum stats (vmstat -s) from a crash dump, fetch per-CPU counts
  and sum them to form the total counts.

Modified:
  stable/7/usr.bin/vmstat/vmstat.c
Directory Properties:
  stable/7/usr.bin/vmstat/   (props changed)

Modified: stable/7/usr.bin/vmstat/vmstat.c
==============================================================================
--- stable/7/usr.bin/vmstat/vmstat.c	Fri Nov  6 20:33:40 2009	(r199003)
+++ stable/7/usr.bin/vmstat/vmstat.c	Fri Nov  6 20:33:53 2009	(r199004)
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -420,10 +421,90 @@ getuptime(void)
 }
 
 static void
+fill_pcpu(struct pcpu ***pcpup, int* maxcpup)
+{
+	struct pcpu **pcpu;
+	
+	int maxcpu, size, i;
+
+	*pcpup = NULL;
+	
+	if (kd == NULL)
+		return;
+
+	maxcpu = kvm_getmaxcpu(kd);
+	if (maxcpu < 0)
+		errx(1, "kvm_getmaxcpu: %s", kvm_geterr(kd));
+
+	pcpu = calloc(maxcpu, sizeof(struct pcpu *));
+	if (pcpu == NULL)
+		err(1, "calloc");
+
+	for (i = 0; i < maxcpu; i++) {
+		pcpu[i] = kvm_getpcpu(kd, i);
+		if (pcpu[i] == (struct pcpu *)-1)
+			errx(1, "kvm_getpcpu: %s", kvm_geterr(kd));
+	}
+
+	*maxcpup = maxcpu;
+	*pcpup = pcpu;
+}
+
+static void
+free_pcpu(struct pcpu **pcpu, int maxcpu)
+{
+	int i;
+
+	for (i = 0; i < maxcpu; i++)
+		free(pcpu[i]);
+	free(pcpu);
+}
+
+static void
 fill_vmmeter(struct vmmeter *vmmp)
 {
+	struct pcpu **pcpu;
+	int maxcpu, i;
+
 	if (kd != NULL) {
 		kread(X_SUM, vmmp, sizeof(*vmmp));
+		fill_pcpu(&pcpu, &maxcpu);
+		for (i = 0; i < maxcpu; i++) {
+			if (pcpu[i] == NULL)
+				continue;
+#define ADD_FROM_PCPU(i, name) \
+			vmmp->name += pcpu[i]->pc_cnt.name
+			ADD_FROM_PCPU(i, v_swtch);
+			ADD_FROM_PCPU(i, v_trap);
+			ADD_FROM_PCPU(i, v_syscall);
+			ADD_FROM_PCPU(i, v_intr);
+			ADD_FROM_PCPU(i, v_soft);
+			ADD_FROM_PCPU(i, v_vm_faults);
+			ADD_FROM_PCPU(i, v_cow_faults);
+			ADD_FROM_PCPU(i, v_cow_optim);
+			ADD_FROM_PCPU(i, v_zfod);
+			ADD_FROM_PCPU(i, v_ozfod);
+			ADD_FROM_PCPU(i, v_swapin);
+			ADD_FROM_PCPU(i, v_swapout);
+			ADD_FROM_PCPU(i, v_swappgsin);
+			ADD_FROM_PCPU(i, v_swappgsout);
+			ADD_FROM_PCPU(i, v_vnodein);
+			ADD_FROM_PCPU(i, v_vnodeout);
+			ADD_FROM_PCPU(i, v_vnodepgsin);
+			ADD_FROM_PCPU(i, v_vnodepgsout);
+			ADD_FROM_PCPU(i, v_intrans);
+			ADD_FROM_PCPU(i, v_tfree);
+			ADD_FROM_PCPU(i, v_forks);
+			ADD_FROM_PCPU(i, v_vforks);
+			ADD_FROM_PCPU(i, v_rforks);
+			ADD_FROM_PCPU(i, v_kthreads);
+			ADD_FROM_PCPU(i, v_forkpages);
+			ADD_FROM_PCPU(i, v_vforkpages);
+			ADD_FROM_PCPU(i, v_rforkpages);
+			ADD_FROM_PCPU(i, v_kthreadpages);
+#undef ADD_FROM_PCPU
+		}
+		free_pcpu(pcpu, maxcpu);
 	} else {
 		size_t size = sizeof(unsigned int);
 #define GET_VM_STATS(cat, name) \
From rwatson at FreeBSD.org  Sat Nov  7 10:44:46 2009
From: rwatson at FreeBSD.org (Robert Watson)
Date: Sat Nov  7 10:45:38 2009
Subject: svn commit: r199004 - stable/7/usr.bin/vmstat
In-Reply-To: <200911062033.nA6KXr20028001@svn.freebsd.org>
References: <200911062033.nA6KXr20028001@svn.freebsd.org>
Message-ID: 


On Fri, 6 Nov 2009, John Baldwin wrote:

>  MFC 198620:
>  When fetching sum stats (vmstat -s) from a crash dump, fetch per-CPU counts
>  and sum them to form the total counts.

At some point, we need to complete the migration to per-CPU stats for most of 
our statistics counters, as well as a migration to DPCPU to store them. 
Among other things, this will reduce the endemic problem we have with per-CPU 
stats from different CPUs being packed into the same cache line.  Once we do 
that, we'll probably want a libkvm utility routine for managing DPCPU 
retrievals.

Robert N M Watson
Computer Laboratory
University of Cambridge

>
> Modified:
>  stable/7/usr.bin/vmstat/vmstat.c
> Directory Properties:
>  stable/7/usr.bin/vmstat/   (props changed)
>
> Modified: stable/7/usr.bin/vmstat/vmstat.c
> ==============================================================================
> --- stable/7/usr.bin/vmstat/vmstat.c	Fri Nov  6 20:33:40 2009	(r199003)
> +++ stable/7/usr.bin/vmstat/vmstat.c	Fri Nov  6 20:33:53 2009	(r199004)
> @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
> #include 
> #include 
> #include 
> +#include 
>
> #include 
>
> @@ -420,10 +421,90 @@ getuptime(void)
> }
>
> static void
> +fill_pcpu(struct pcpu ***pcpup, int* maxcpup)
> +{
> +	struct pcpu **pcpu;
> +
> +	int maxcpu, size, i;
> +
> +	*pcpup = NULL;
> +
> +	if (kd == NULL)
> +		return;
> +
> +	maxcpu = kvm_getmaxcpu(kd);
> +	if (maxcpu < 0)
> +		errx(1, "kvm_getmaxcpu: %s", kvm_geterr(kd));
> +
> +	pcpu = calloc(maxcpu, sizeof(struct pcpu *));
> +	if (pcpu == NULL)
> +		err(1, "calloc");
> +
> +	for (i = 0; i < maxcpu; i++) {
> +		pcpu[i] = kvm_getpcpu(kd, i);
> +		if (pcpu[i] == (struct pcpu *)-1)
> +			errx(1, "kvm_getpcpu: %s", kvm_geterr(kd));
> +	}
> +
> +	*maxcpup = maxcpu;
> +	*pcpup = pcpu;
> +}
> +
> +static void
> +free_pcpu(struct pcpu **pcpu, int maxcpu)
> +{
> +	int i;
> +
> +	for (i = 0; i < maxcpu; i++)
> +		free(pcpu[i]);
> +	free(pcpu);
> +}
> +
> +static void
> fill_vmmeter(struct vmmeter *vmmp)
> {
> +	struct pcpu **pcpu;
> +	int maxcpu, i;
> +
> 	if (kd != NULL) {
> 		kread(X_SUM, vmmp, sizeof(*vmmp));
> +		fill_pcpu(&pcpu, &maxcpu);
> +		for (i = 0; i < maxcpu; i++) {
> +			if (pcpu[i] == NULL)
> +				continue;
> +#define ADD_FROM_PCPU(i, name) \
> +			vmmp->name += pcpu[i]->pc_cnt.name
> +			ADD_FROM_PCPU(i, v_swtch);
> +			ADD_FROM_PCPU(i, v_trap);
> +			ADD_FROM_PCPU(i, v_syscall);
> +			ADD_FROM_PCPU(i, v_intr);
> +			ADD_FROM_PCPU(i, v_soft);
> +			ADD_FROM_PCPU(i, v_vm_faults);
> +			ADD_FROM_PCPU(i, v_cow_faults);
> +			ADD_FROM_PCPU(i, v_cow_optim);
> +			ADD_FROM_PCPU(i, v_zfod);
> +			ADD_FROM_PCPU(i, v_ozfod);
> +			ADD_FROM_PCPU(i, v_swapin);
> +			ADD_FROM_PCPU(i, v_swapout);
> +			ADD_FROM_PCPU(i, v_swappgsin);
> +			ADD_FROM_PCPU(i, v_swappgsout);
> +			ADD_FROM_PCPU(i, v_vnodein);
> +			ADD_FROM_PCPU(i, v_vnodeout);
> +			ADD_FROM_PCPU(i, v_vnodepgsin);
> +			ADD_FROM_PCPU(i, v_vnodepgsout);
> +			ADD_FROM_PCPU(i, v_intrans);
> +			ADD_FROM_PCPU(i, v_tfree);
> +			ADD_FROM_PCPU(i, v_forks);
> +			ADD_FROM_PCPU(i, v_vforks);
> +			ADD_FROM_PCPU(i, v_rforks);
> +			ADD_FROM_PCPU(i, v_kthreads);
> +			ADD_FROM_PCPU(i, v_forkpages);
> +			ADD_FROM_PCPU(i, v_vforkpages);
> +			ADD_FROM_PCPU(i, v_rforkpages);
> +			ADD_FROM_PCPU(i, v_kthreadpages);
> +#undef ADD_FROM_PCPU
> +		}
> +		free_pcpu(pcpu, maxcpu);
> 	} else {
> 		size_t size = sizeof(unsigned int);
> #define GET_VM_STATS(cat, name) \
>
From dougb at FreeBSD.org  Sat Nov  7 22:40:15 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sat Nov  7 22:40:28 2009
Subject: svn commit: r199027 - stable/7/games/fortune/datfiles
Message-ID: <200911072240.nA7MeDDU065687@svn.freebsd.org>

Author: dougb
Date: Sat Nov  7 22:40:13 2009
New Revision: 199027
URL: http://svn.freebsd.org/changeset/base/199027

Log:
  Mass MFC of older commits to bring these files up to date with HEAD:
  r174581, r174597, r174897, r175017, r175129, r175213, r176638, r176639,
  r176764, r177781, r177879, r178604, r178605, r178662, r179960, r179987,
  r180286, r180341, r181207, r183691, r183707, r189448
  
  MFC r197797:
  s/Putluck Pogo/Potluck Pogo/
  
  MFC r198921:
  Grammar/formatting fix
  
  MFC 199021:
  Remove svn:executable from datfiles/gerrold.limerick
  
  MFC r199023:
  Move VCS fortune to fortunes-o
  
  MFC 199025:
  Sort fortune

Modified:
  stable/7/games/fortune/datfiles/fortunes
  stable/7/games/fortune/datfiles/fortunes-o.real
  stable/7/games/fortune/datfiles/fortunes.sp.ok
  stable/7/games/fortune/datfiles/gerrold.limerick   (contents, props changed)
  stable/7/games/fortune/datfiles/limerick
Directory Properties:
  stable/7/games/fortune/   (props changed)
  stable/7/games/fortune/datfiles/   (props changed)
  stable/7/games/fortune/datfiles/freebsd-tips   (props changed)

Modified: stable/7/games/fortune/datfiles/fortunes
==============================================================================
--- stable/7/games/fortune/datfiles/fortunes	Sat Nov  7 22:27:34 2009	(r199026)
+++ stable/7/games/fortune/datfiles/fortunes	Sat Nov  7 22:40:13 2009	(r199027)
@@ -69,6 +69,17 @@ either.  If you need some help, give us 
 
 		-- CommUNIXque 1:1, ASCAR Business Systems
 %
+			   1/2
+	12 + 144 + 20 + 3*4                    2
+	----------------------  +  5 * 11  =  9  +  0
+		  7
+
+A dozen, a gross and a score,
+Plus three times the square root of four,
+	Divided by seven,
+	Plus five times eleven,
+Equals nine squared plus zero, no more!
+%
 			-- Gifts for Children --
 
 This is easy.  You never have to figure out what to get for children,
@@ -674,17 +685,6 @@ Liza Minnelli.
 %
 	... with liberty and justice for all who can afford it.
 %
-			   1/2
-	12 + 144 + 20 + 3*4                    2
-	----------------------  +  5 * 11  =  9  +  0
-		  7
-
-A dozen, a gross and a score,
-Plus three times the square root of four,
-	Divided by seven,
-	Plus five times eleven,
-Equals nine squared plus zero, no more!
-%
 	7,140	pounds on the Sun
 	   97	pounds on Mercury or Mars
 	  255	pounds on Earth
@@ -2605,7 +2605,7 @@ man.  Mud-as-man alone could speak.
 	"Certainly," said man.
 	"Then I leave it to you to think of one for all of this," said God.
 	And He went away.
-		-- Kurt Vonnegut, Between Time and Timbuktu"
+		-- Kurt Vonnegut, "Between Time and Timbuktu"
 %
 	In the beginning there was data.  The data was without form and
 null, and darkness was upon the face of the console; and the Spirit of
@@ -10544,6 +10544,10 @@ Another day, another dollar.
 		   upon Hinckley's acquittal for shooting President Ronald
 		   Reagan.
 %
+Another flaw in the human character is that everybody wants to build
+and nobody wants to do maintenance.
+		-- Kurt Vonnegut, "Hocus Pocus"
+%
 Another good night not to sleep in a eucalyptus tree.
 %
 Another megabytes the dust.
@@ -11478,6 +11482,14 @@ As you will see, I told them, in no unce
 %
 As Zeus said to Narcissus, "Watch yourself."
 %
+Ascend to the high mountain pass,
+Cross the shallow side of the wide ocean.
+Do not give up to the great distance:
+It's by going that you will reach your aim.
+Be not discouraged by human frailty:
+You will overcome it if you try to.
+		-- Chinggis (Genghis) Khan 
+%
 ASCII:
 	The control code for all beginning programmers and those who would
 	become computer literate.  Etymologically, the term has come down as
@@ -13301,6 +13313,10 @@ were not hard, and money not scarce?
 Can anything be sadder than work left unfinished?
 Yes, work never begun.
 %
+"Can you be more stupid than aggravating the judge AND your lawyer?
+No? Oh yes you can: You can aggravate the whole kernel community."
+		-- Alexander Lyamin (about Hans Reisers murder trial)
+%
 Can you buy friendship?  You not only can, you must.  It's the
 only way to obtain friends.  Everything worthwhile has a price.
 		-- Robert J. Ringer
@@ -14234,6 +14250,12 @@ Computers are useless.  They can only gi
 Computers can figure out all kinds of problems, except the things in
 the world that just don't add up.
 %
+Computers can't cruise.  Meandering is a foreign concept to them.
+The computer assumes that all behavior is in pursuit of an ultimate
+goal.  Whenever a motorist changes his or her mind and veers off
+course, the GPS lady issues that snippy announcement: "Recalculating!"
+		-- Joel Achenbach (www.slate.com, 20 Jun 2008)
+%
 Computers don't actually think.
 	You just think they think.
 		(We think.)
@@ -15974,6 +15996,9 @@ Don't marry for money; you can borrow it
 %
 Don't mind him; politicians always sound like that.
 %
+Don't patch bad code -- rewrite it.
+		-- "The Elements of Programming Style", Kernighan and Plauger
+%
 Don't plan any hasty moves.
 You'll be evicted soon anyway.
 %
@@ -18095,7 +18120,7 @@ tail on me, go ahead.  They'd be very bo
 		   commenting on rumors of womanizing.
 %
 Food for thought is no substitute for the real thing.
-		-- Walt Kelly, "Putluck Pogo"
+		-- Walt Kelly, "Potluck Pogo"
 %
 Foolproof Operation:
 	No provision for adjustment.
@@ -19475,20 +19500,6 @@ engaging a suitable stereotype protagoni
 president, political party, etc.) to consummate the act of social
 schizophrenia in mass genocide.
 %
-From dusk till dawn
-I gathered people and their crown
-Conquered the hearts of
-Not too few
-United the heads of
-Now too humble.
-When weaken your mind
-Don?t get weakened
-When tired of thinking
-Don?t get tired
-My sons and descendants
-Don?t get exhausted in mind and thought and but get experienced.
-		-- Chinggis (Genghis) Khan
-%
 From Italian tourist guide:
 
 	"Non stop trains to Roma Termini Station leave from 7.38
@@ -22722,6 +22733,10 @@ steer clear of me at parties.  Often, as
 they don't even invite me.
 		-- Dave Barry
 %
+I asked a teacher what the opposite of a miracle was and she, without
+thinking, I assume, said it was an act of God.
+			-- Terry Prachett (Daily Mail 21 june 2008)
+%
 I asked the engineer who designed the communication terminal's keyboards
 why these were not manufactured in a central facility, in view of the
 small number needed [1 per month] in his factory.  He explained that this
@@ -23934,6 +23949,9 @@ I like myself, but I won't say I'm as ha
 that kidnaped Europa.
 		-- Marcus Tullius Cicero
 %
+I like paying taxes.  With them I buy civilization.
+		-- Oliver Wendell Holmes
+%
 I like to believe that people in the long run are going to do more to
 promote peace than our governments.  Indeed, I think that people want
 peace so much that one of these days governments had better get out of
@@ -25207,7 +25225,8 @@ them scream.
 		-- Sylvestre Matuschka, "the Hungarian Train Wreck Freak",
 		   escaped prison 1937, not heard from since
 %
-Iam
+I
+am
 not
 very
 happy
@@ -26017,16 +26036,6 @@ If Karl, instead of writing a lot about 
 had made a lot of Capital, it would have been much better.
 		-- Karl Marx's Mother
 %
-If Khaan behaves as serfs
-Lose entire states and all estates.
-If serfs behave as Khaan
-He will regret for his head.
-In time of friendship and harmony
-Befriend as closely
-In time of conflict with enemies
-Be falcon of advance and attacks
-		-- Chinggis (Genghis) Khan
-%
 If life gives you lemons, make lemonade.
 %
 If life is a stage, I want some better lighting.
@@ -26576,6 +26585,9 @@ theirs, then you clearly don't understan
 %
 If you can lead it to water and force it to drink, it isn't a horse.
 %
+If you can not say it, you can not whistle it, either.
+		-- Wittgenstein
+%
 If you can read this, you're too close.
 %
 If you can survive death, you can probably survive anything.
@@ -27145,6 +27157,15 @@ I guess you do have a problem.
 %
 If your life was a horse, you'd have to shoot it.
 %
+If your mind grows weak,
+Don't yield to the weakness.
+Even if tired of thought,
+Never stop thinking.
+My sons and descendants,
+Don't get exhausted in reason--
+But become experienced.
+		-- Chinggis (Genghis) Khan
+%
 If your mother knew what you're doing,
 she'd probably hang her head and cry.
 %
@@ -28096,6 +28117,10 @@ _s_e_e the high-water mark -- the pla
 rolled back.
 		-- Hunter S. Thompson, "Fear and Loathing in Las Vegas"
 %
+"In the age of the internet attaching a famous name to your personal
+opinion to give more weight to it is a very valid strategy."
+		-- Benjamin Franklin
+%
 In the beginning there was nothing.  And the Lord said "Let There Be Light!"
 And still there was nothing, but at least now you could see it.
 %
@@ -28245,6 +28270,12 @@ different kinds of weather inside of 24 
 %
 In the stairway of life, you'd best take the elevator.
 %
+In the time of peace and harmony
+Be a kind-hearted friend.
+In the time of conflict with enemies
+Be a falcon of advance and attack.
+		-- Chinggis (Genghis) Khan
+%
 In the Top 40, half the songs are secret messages to the teen world to drop
 out, turn on, and groove with the chemicals and light shows at discotheques.
 		-- Art Linkletter
@@ -29420,15 +29451,6 @@ they'll come out for it.
 		-- Red Skelton, surveying the funeral of Hollywood
 		   mogul Harry Cohn
 %
-
-It ruins mind
-It exhausts wealth
-When it reaches to the tongue
-It is like a mosquito
-When it relives from tongue
-It is like an elephant.
-		-- Boorchi (first of 9 knights of Chinggis (Genghis) Khan)
-%
 It runs like _x, where _x is something unsavory.
 		-- Prof. Romas Aleliunas, CS 435
 %
@@ -31219,11 +31241,10 @@ for Loeb, George came back to the fold, 
 around his neck.
 		-- Dave Barry
 %
-
-Let my petty body exhausted,
-But not my state nature.
-Let my whole body exhausted
-But not my entire state
+Let my own body be exhausted,
+But not the wealth of my state.
+Let my mortal body vanish,
+But not the power of my state.
 		-- Chinggis (Genghis) Khan
 %
 Let no guilty man escape.
@@ -31238,7 +31259,7 @@ Let sleeping dogs lie.
 		-- Charles Dickens
 %
 Let the machine do the dirty work.
-		-- "Elements of Programming Style", Kernighan and Ritchie
+		-- "The Elements of Programming Style", Kernighan and Plauger
 %
 Let the meek inherit the earth -- they have it coming to them.
 		-- James Thurber
@@ -33047,6 +33068,10 @@ versions of songs from The Wizard of Oz.
 %
 May a Misguided Platypus lay its Eggs in your Jockey Shorts
 %
+May all your Emus lay soft boiled eggs, and may all your
+Kangaroos be born with iPods already fitted.
+		-- Aussie New Years wish, found on hasselbladinfo.com
+%
 May all your PUSHes be POPped.
 %
 May Euell Gibbons eat your only copy of the manual!
@@ -34277,6 +34302,11 @@ My own dear love, he is all my world --
 	And I wish I'd never met him.
 		-- Dorothy Parker, part 1
 %
+My own feelings are perhaps best described by saying that I am
+perfectly aware that there is no Royal Road to Mathematics, in other
+words, that I have only a very small head and must live with it.
+		-- Edsger W. Dijkstra
+%
 My own life has been spent chronicling the rise and fall of human systems,
 and I am convinced that we are terribly vulnerable.  ...  We should be
 reluctant to turn back upon the frontier of this epoch. Space is indifferent
@@ -43297,14 +43327,6 @@ the "Gaslight" treatment, the "Are you t
 implication.  Advance to manipulation and humiliation.  Above all, relax
 and have a nice day.
 %
-Strive to the pass of high mountain
-Cross in the shallow side of the wide ocean
-Do not give up because of distance
-Will certainly reach if walks
-Do not discourage of human
-Shall overcome if you try
-		-- Chinggis (Genghis) Khan
-%
 Stuckness shouldn't be avoided.  It's the psychic predecessor of all
 real understanding.  An egoless acceptance of stuckness is a key to an
 understanding of all Quality, in mechanical work as in other endeavors.
@@ -43827,10 +43849,10 @@ Technological progress has merely provid
 with more efficient means for going backwards.
 		-- Aldous Huxley
 %
-Teeth for meat is in mouth
-Teeth for human is in soul.
-Win one with your body strength
-Win many with your mind strength
+Teeth for meat are in the mouth --
+Teeth for humans are in the soul.
+A strong body defeats one,
+A strong soul conquers many.
 		-- Chinggis (Genghis) Khan
 %
 Tehee quod she, and clapte the wyndow to.
@@ -45337,6 +45359,9 @@ endow them with any special qualities of
 compassion.
 		-- Saul Alinsky
 %
+The fall of the USSR proves you wrong.
+		-- Aryeh M. Friedman
+%
 The famous politician was trying to save both his faces.
 %
 The farther you go, the less you know.
@@ -49231,7 +49256,7 @@ round in the worst cars available," he s
 admit it, I tell him, `Forget it'.  If they bring a car back late we
 overlook it.  If they've had a crash and it doesn't involve another vehicle
 we might overlook that too."
-	"Where's the ashtray?" asked on Los Angeles wife, as she settled
+	"Where's the ashtray?" asked one Los Angeles wife, as she settled
 into the ripped interior.  "Honey," said her husband, "the whole car's the
 ash tray."
 		-- Stephen Pile, "The Book of Heroic Failures"
@@ -50777,6 +50802,14 @@ Things are more like they used to be tha
 Things are not always what they seem.
 		-- Phaedrus
 %
+Things Charles Darwin did not say:
+
+Finches, eh ? Seen one, seem 'em all.
+%
+Things Charles Darwin did not say:
+
+Nah, it's only a theory - I don't think it should be taught in schools.
+%
 Things equal to nothing else are equal to each other.
 %
 Things fall apart; the centre cannot hold.
@@ -52167,6 +52200,9 @@ the Thanksgiving festivities of that cit
 the affair," and of course be sadly disappointed thereby.
 		-- Sacramento Daily Union, November 29, 1861
 %
+Too many of his [Mozart's] works sound like interoffice memos.
+		-- Glenn Gould
+%
 Too many people are thinking of security instead of opportunity.
 They seem more afraid of life than death.
 		-- James F. Byrnes
@@ -53841,7 +53877,7 @@ but we always respect their good judgmen
 ...we must be wary of granting too much power to natural selection
 by viewing all basic capacities of our brain as direct adaptations.
 I do not doubt that natural selection acted in building our oversized
-brains -- and I am equally confidant that our brains became large as
+brains -- and I am equally confident that our brains became large as
 an adaptation for definite roles (probably a complex set of interacting
 functions).  But these assumptions do not lead to the notion, often
 uncritically embraced by strict Darwinians, that all major capacities
@@ -53858,7 +53894,7 @@ We must die because we have known them.
 We must finish once and for all with the neutrality of chess.  We must
 condemn once and for all the formula 'chess for the sake of chess,' like
 the formula 'art for art's sake.'  We must organize shock-brigades of
-chess-play ers, and begin the immediate realization of a Five-Year Plan
+chess-players, and begin the immediate realization of a Five-Year Plan
 for chess.
 		-- Nikolai V. Krylenko, People's Commissar for Justice
 		   (of RFSFR, later of USSR), speaking at a 1932 Congress
@@ -55469,6 +55505,12 @@ winter with slightly over half that quan
 %
 When I kill, the only thing I feel is recoil.
 %
+When I look at the horse heads and men's faces, the immense
+live torrent once raised by my will and now whirling to
+nowhere through the red sunset desert, I often wonder where
+I am in this torrent.
+		-- Chinggis (Genghis) Khan
+%
 When I said "we", officer, I was referring to
 myself, the four young ladies, and, of course, the goat.
 %
@@ -56260,6 +56302,9 @@ and perhaps weigh 1 1/2 tons.
 %
 Where am I?  Who am I?  Am I?  I
 %
+Where am I, and what am I doing in this handbasket?
+		-- Mark A. Matthews, to Wes Peters, circa 1996
+%
 Where are the calculations that go with a calculated risk?
 %
 WHERE CAN THE MATTER BE
@@ -59726,6 +59771,17 @@ You've been telling me to relax all the 
 and now you're telling me just to be myself?
 		-- The Return of the Secaucus Seven
 %
+You've decked the halls with a dozen miles' length of electric lights. 
+Your front lawn is a gleaming testament of incandescent wonder. The neighbors 
+wear sunglasses 24/7,  and orbiting satellites have officially picked up 
+and pinpointed your house as the brightest spot on earth.
+        
+You've finally put together the Christmas wonderland of your dreams... now 
+if only you could get a good picture of it.
+        
+Photographing holiday lights is no easy task. 
+		-- from an email sent by photojojo.com
+%
 You've got to have a gimmick if your band sucks.
 		-- Gary Giddens
 %

Modified: stable/7/games/fortune/datfiles/fortunes-o.real
==============================================================================
--- stable/7/games/fortune/datfiles/fortunes-o.real	Sat Nov  7 22:27:34 2009	(r199026)
+++ stable/7/games/fortune/datfiles/fortunes-o.real	Sat Nov  7 22:40:13 2009	(r199027)
@@ -755,7 +755,7 @@ see Sir Lancelot riding hard to catch up
 	"What is amiss, my friend?" asked the king.
 	"My lord," gasped Lancelot, "you have given me the wrong key!"
 %
-	"Before we get married," said the young woman to her fiancee,
+	"Before we get married," said the young woman to her fiance,
 "I want to confess some affairs that I've had in the past."
 	"But you told me all about those a few weeks ago," her young man
 replied.
@@ -1153,6 +1153,12 @@ and stuck it in my back."
 	"Gabriel's trumpet will produce you from the ass of a pig."
 		-- Al Swearingen, E. B. Farnum, _Deadwood_
 %
+	I'd say that VCS is more like the anal sex of the software
+world: Everybody talks about it, some people do it, some people enjoy
+it, but typically only vague implications about the best techniques
+are ever voiced in public.
+              -- Warner Losh, on Version Control Systems
+%
 	"I'll tell ya, Jeb," Wilbur said to his friend, "the tractor
 business ain't doin' too well.  I ain't sold one all month.
 	"You think you've got problems?" Jeb replied.  "The other day, I went

Modified: stable/7/games/fortune/datfiles/fortunes.sp.ok
==============================================================================
--- stable/7/games/fortune/datfiles/fortunes.sp.ok	Sat Nov  7 22:27:34 2009	(r199026)
+++ stable/7/games/fortune/datfiles/fortunes.sp.ok	Sat Nov  7 22:40:13 2009	(r199027)
@@ -3300,6 +3300,7 @@ postjudice
 Postnews
 Postpetroleum
 potholes
+Potluck
 potty
 Poul
 Pournelle
@@ -3376,7 +3377,6 @@ Purshottam
 PUSHes
 pushy
 pussycats
-Putluck
 Putt's
 PVLC
 PxP

Modified: stable/7/games/fortune/datfiles/gerrold.limerick
==============================================================================
--- stable/7/games/fortune/datfiles/gerrold.limerick	Sat Nov  7 22:27:34 2009	(r199026)
+++ stable/7/games/fortune/datfiles/gerrold.limerick	Sat Nov  7 22:40:13 2009	(r199027)
@@ -39,7 +39,7 @@ rights reserved, used with permission of
 I have written some limericks quite fateful,
 malicious and vicious and hateful;
 	but I've torn up the jokes
-	that will sicken most folks,
+	that would sicken most folks,
 and humanity ought to be grateful.
 
 From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
@@ -215,7 +215,7 @@ rights reserved, used with permission of
 %
 There was a young lady quite tearful.
 Of sucking a cock, she was fearful.
-	In a moment of dreard,
+	In a moment of dread,
 	she just turned her head.
 And, boy! Did she get an earful!
 
@@ -499,7 +499,7 @@ Rick promised to gently deflower
 a maiden who lived on South Gower,
 	(The truth is, he spread
 	her legs wide on the bed,
-and finsihed her off in an hour.)
+and finished her off in an hour.)
 
 From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
 rights reserved, used with permission of the author.
@@ -531,15 +531,6 @@ and left her all dried up and squinty.
 From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
 rights reserved, used with permission of the author.
 %
-I have written some limericks quite fateful,
-malicious and vicious and hateful;
-	but I've torn up the jokes
-	that would sicken most folks,
-and humanity ought ot be grateful;
-
-From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
-rights reserved, used with permission of the author.
-%
 Here's the tale of Benjamin Sneed:
 Where others were two'd he was three'd
 	and when they unmasked it,
@@ -552,7 +543,7 @@ rights reserved, used with permission of
 A maiden who had a third breast
 always kept her hand close to her chest,
 	and I promised her well
-	that I never woudl tell.
+	that I never would tell.
 (Write me privately. Name on request.)
 
 From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
@@ -741,7 +732,7 @@ tie me up in some chains that are clinky
 Just get the straps and the slings and a shipment
 	of high-grade Vaseline,
 	and a strong trampoline,
-and allof the other equipment!"
+and all of the other equipment!"
 
 "Now, when we get all the bedsprings a-drummin',
 that's when I'll start in a-hummin',
@@ -769,7 +760,7 @@ rights reserved, used with permission of
 %
 The speed of Ed's seed is unclocked
 whenever a lady's unfrocked.
-	Tho' his spirit is willin,
+	Tho' his spirit is willin',
 	when a pussy needs fillin',
 he's a man who goes off half-cocked.
 
@@ -815,7 +806,7 @@ rights reserved, used with permission of
 A king who was mad at the time,
 decreed limerick writing a crime.
 	but late in the night
-	all the poets woudl write
+	all the poets would write
 verses without any rhyme or meter.
 
 From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all

Modified: stable/7/games/fortune/datfiles/limerick
==============================================================================
--- stable/7/games/fortune/datfiles/limerick	Sat Nov  7 22:27:34 2009	(r199026)
+++ stable/7/games/fortune/datfiles/limerick	Sat Nov  7 22:40:13 2009	(r199027)
@@ -4421,7 +4421,7 @@ And secretly finger his dong.
 There was an old man of St. Bees,
 Who was stung in the arm by a wasp.
 	When asked, "Does it hurt?"
-	He relied, "No, it doesn't.
+	He replied, "No, it doesn't.
 I'm so glad that it wasn't a hornet."
 		-- W.S. Gilbert
 %
From dougb at FreeBSD.org  Sat Nov  7 22:47:14 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sat Nov  7 22:47:31 2009
Subject: svn commit: r199028 - stable/7/games/fortune/datfiles
Message-ID: <200911072247.nA7MlCDT065874@svn.freebsd.org>

Author: dougb
Date: Sat Nov  7 22:47:12 2009
New Revision: 199028
URL: http://svn.freebsd.org/changeset/base/199028

Log:
  Manually remove a duplicate fortune that I cannot find the commit log for

Modified:
  stable/7/games/fortune/datfiles/fortunes

Modified: stable/7/games/fortune/datfiles/fortunes
==============================================================================
--- stable/7/games/fortune/datfiles/fortunes	Sat Nov  7 22:40:13 2009	(r199027)
+++ stable/7/games/fortune/datfiles/fortunes	Sat Nov  7 22:47:12 2009	(r199028)
@@ -23567,9 +23567,6 @@ but I can't prove it.
 I have a very firm grasp on reality!  I can reach out and strangle it
 any time!
 %
-I have a very small mind and must live with it.
-		-- Edsger W. Dijkstra
-%
 I have a very strange feeling about this...
 		-- Luke Skywalker
 %
From dougb at FreeBSD.org  Sat Nov  7 23:19:37 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sat Nov  7 23:19:49 2009
Subject: svn commit: r199030 - stable/7/etc
Message-ID: <200911072319.nA7NJbU7066694@svn.freebsd.org>

Author: dougb
Date: Sat Nov  7 23:19:36 2009
New Revision: 199030
URL: http://svn.freebsd.org/changeset/base/199030

Log:
  Pull mergeinfo for r194088 and r194107 up from termcap.small into etc/

Modified:
Directory Properties:
  stable/7/etc/   (props changed)
From dougb at FreeBSD.org  Sat Nov  7 23:24:18 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sat Nov  7 23:24:35 2009
Subject: svn commit: r199031 - stable/7/etc
Message-ID: <200911072324.nA7NOHeX066843@svn.freebsd.org>

Author: dougb
Date: Sat Nov  7 23:24:17 2009
New Revision: 199031
URL: http://svn.freebsd.org/changeset/base/199031

Log:
  Forcibly remove the svn:mergeinfo on this file now that it's been
  pulled up into etc/

Modified:
Directory Properties:
  stable/7/etc/termcap.small   (props changed)
From dougb at FreeBSD.org  Sat Nov  7 23:37:29 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sat Nov  7 23:37:36 2009
Subject: svn commit: r199032 - stable/7/etc
Message-ID: <200911072337.nA7NbTE0067122@svn.freebsd.org>

Author: dougb
Date: Sat Nov  7 23:37:29 2009
New Revision: 199032
URL: http://svn.freebsd.org/changeset/base/199032

Log:
  MFC r198162:
  
  Allow $name_program to override $command in a more robust way that
  will not cause the value to be null if $command is not set.

Modified:
  stable/7/etc/rc.subr
Directory Properties:
  stable/7/etc/   (props changed)

Modified: stable/7/etc/rc.subr
==============================================================================
--- stable/7/etc/rc.subr	Sat Nov  7 23:24:17 2009	(r199031)
+++ stable/7/etc/rc.subr	Sat Nov  7 23:37:29 2009	(r199032)
@@ -565,7 +565,7 @@ run_rc_command()
 	esac
 
 	eval _override_command=\$${name}_program
-	command=${command:+${_override_command:-$command}}
+	command=${_override_command:-$command}
 
 	_keywords="start stop restart rcvar $extra_commands"
 	rc_pid=
From edwin at FreeBSD.org  Mon Nov  9 11:32:35 2009
From: edwin at FreeBSD.org (Edwin Groothuis)
Date: Mon Nov  9 11:32:55 2009
Subject: svn commit: r199078 - stable/7/usr.sbin/zic
Message-ID: <200911091132.nA9BWYdG019687@svn.freebsd.org>

Author: edwin
Date: Mon Nov  9 11:32:34 2009
New Revision: 199078
URL: http://svn.freebsd.org/changeset/base/199078

Log:
  MFC of 198831, tzcode2009q
  
  - Cleanup unnecessary local variables in zdump.
  - Fix man-page

Modified:
  stable/7/usr.sbin/zic/zdump.c
  stable/7/usr.sbin/zic/zic.8
Directory Properties:
  stable/7/usr.sbin/zic/   (props changed)

Modified: stable/7/usr.sbin/zic/zdump.c
==============================================================================
--- stable/7/usr.sbin/zic/zdump.c	Mon Nov  9 11:32:18 2009	(r199077)
+++ stable/7/usr.sbin/zic/zdump.c	Mon Nov  9 11:32:34 2009	(r199078)
@@ -6,7 +6,7 @@
 #ifndef lint
 static const char rcsid[] =
   "$FreeBSD$";
-static char	elsieid[] = "@(#)zdump.c	8.9";
+static char	elsieid[] = "@(#)zdump.c	8.10";
 #endif /* not lint */
 
 /*
@@ -152,7 +152,7 @@ static size_t	longest;
 static char *	progname;
 static int	warned;
 
-static void	usage(const char *progname, FILE *stream, int status);
+static void	usage(FILE *stream, int status);
 static char *	abbr(struct tm * tmp);
 static void	abbrok(const char * abbrp, const char * zone);
 static long	delta(struct tm * newp, struct tm * oldp);
@@ -273,7 +273,7 @@ char *	argv[];
 		if (strcmp(argv[i], "--version") == 0) {
 			errx(EXIT_SUCCESS, "%s", elsieid);
 		} else if (strcmp(argv[i], "--help") == 0) {
-			usage(progname, stdout, EXIT_SUCCESS);
+			usage(stdout, EXIT_SUCCESS);
 		}
 	vflag = 0;
 	cutarg = NULL;
@@ -283,7 +283,7 @@ char *	argv[];
 		else	cutarg = optarg;
 	if ((c != EOF && c != -1) ||
 		(optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
-			usage(progname, stderr, EXIT_FAILURE);
+			usage(stderr, EXIT_FAILURE);
 	}
 	if (vflag) {
 		if (cutarg != NULL) {
@@ -468,7 +468,7 @@ const long	y;
 }
 
 static void
-usage(const char *progname, FILE *stream, int status)
+usage(FILE *stream, int status)
 {
 	fprintf(stream,
 _("usage: %s [--version] [-v] [--help] [-c [loyear,]hiyear] zonename ...\n\

Modified: stable/7/usr.sbin/zic/zic.8
==============================================================================
--- stable/7/usr.sbin/zic/zic.8	Mon Nov  9 11:32:18 2009	(r199077)
+++ stable/7/usr.sbin/zic/zic.8	Mon Nov  9 11:32:34 2009	(r199078)
@@ -260,7 +260,7 @@ the variable part is null.
 .El
 .Pp
 A zone line has the form:
-.Dl "Zone	NAME	GMTOFF	RULES/SAVE	FORMAT	[UNTILYEAR [MONTH [DAY [TIME]]]]
+.Dl "Zone	NAME	GMTOFF	RULES/SAVE	FORMAT	[UNTILYEAR [MONTH [DAY [TIME]]]]"
 For example:
 .Dl "Zone	Australia/Adelaide	9:30	Aus	CST	1971 Oct 31 2:00
 The fields that make up a zone line are:
From delphij at FreeBSD.org  Tue Nov 10 01:12:01 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Tue Nov 10 01:12:07 2009
Subject: svn commit: r199126 - stable/7/sys/dev/arcmsr
Message-ID: <200911100112.nAA1C0BZ041334@svn.freebsd.org>

Author: delphij
Date: Tue Nov 10 01:12:00 2009
New Revision: 199126
URL: http://svn.freebsd.org/changeset/base/199126

Log:
  MFC revision 199069:
  
  Initialize the whole message unit's DMA buffer to zero, this fixes a panic
  during boot when ARC1200 is being used with certain motherboard models.
  
  This commit brings the driver to the same state of vendor's 1.20.00.16
  release.  Many thanks to Areca for their continued support to FreeBSD.

Modified:
  stable/7/sys/dev/arcmsr/arcmsr.c
  stable/7/sys/dev/arcmsr/arcmsr.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/arcmsr/arcmsr.c
==============================================================================
--- stable/7/sys/dev/arcmsr/arcmsr.c	Tue Nov 10 00:55:00 2009	(r199125)
+++ stable/7/sys/dev/arcmsr/arcmsr.c	Tue Nov 10 01:12:00 2009	(r199126)
@@ -55,6 +55,8 @@
 **     1.20.00.14   02/05/2007         Erich Chen        bug fix for incorrect ccb_h.status report
 **                                                       and cause g_vfs_done() read write error
 **     1.20.00.15   10/10/2007         Erich Chen        support new RAID adapter type ARC120x
+**     1.20.00.16   10/10/2009         Erich Chen        Bug fix for RAID adapter type ARC120x
+**                                                       bus_dmamem_alloc() with BUS_DMA_ZERO
 ******************************************************************************************
 * $FreeBSD$
 */
@@ -2903,7 +2905,7 @@ static u_int32_t arcmsr_initialize(devic
 	}
 	/* Allocation for our srbs */
 	if(bus_dmamem_alloc(acb->srb_dmat, (void **)&acb->uncacheptr
-		, BUS_DMA_WAITOK | BUS_DMA_COHERENT, &acb->srb_dmamap) != 0) {
+		, BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_ZERO, &acb->srb_dmamap) != 0) {
 		bus_dma_tag_destroy(acb->srb_dmat);
 		bus_dma_tag_destroy(acb->dm_segs_dmat);
 		bus_dma_tag_destroy(acb->parent_dmat);

Modified: stable/7/sys/dev/arcmsr/arcmsr.h
==============================================================================
--- stable/7/sys/dev/arcmsr/arcmsr.h	Tue Nov 10 00:55:00 2009	(r199125)
+++ stable/7/sys/dev/arcmsr/arcmsr.h	Tue Nov 10 01:12:00 2009	(r199126)
@@ -37,7 +37,7 @@
 **************************************************************************
 * $FreeBSD$
 */
-#define ARCMSR_DRIVER_VERSION                        "Driver Version 1.20.00.15 2007-10-07"
+#define ARCMSR_DRIVER_VERSION                        "Driver Version 1.20.00.16 2009-10-10"
 #define ARCMSR_SCSI_INITIATOR_ID                                              255
 #define ARCMSR_DEV_SECTOR_SIZE                                                512
 #define ARCMSR_MAX_XFER_SECTORS                                              4096
From mav at FreeBSD.org  Tue Nov 10 22:56:06 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Tue Nov 10 22:56:28 2009
Subject: svn commit: r199159 - in stable/7/sys: conf dev/ata
Message-ID: <200911102256.nAAMu5VG074391@svn.freebsd.org>

Author: mav
Date: Tue Nov 10 22:56:05 2009
New Revision: 199159
URL: http://svn.freebsd.org/changeset/base/199159

Log:
  MFC r188740, r198486, r199050:
  Increase ATA command timeouts. Introduce define and kernel option
  ATA_REQUEST_TIMEOUT to control it.
  
  PR:		kern/111023

Modified:
  stable/7/sys/conf/NOTES
  stable/7/sys/conf/options
  stable/7/sys/dev/ata/ata-all.h
  stable/7/sys/dev/ata/ata-disk.c
  stable/7/sys/dev/ata/ata-queue.c
  stable/7/sys/dev/ata/ata-raid.c
  stable/7/sys/dev/ata/atapi-cd.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/conf/NOTES
==============================================================================
--- stable/7/sys/conf/NOTES	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/conf/NOTES	Tue Nov 10 22:56:05 2009	(r199159)
@@ -1621,8 +1621,11 @@ hint.ata.1.irq="15"
 #
 # ATA_STATIC_ID:	controller numbering is static ie depends on location
 #			else the device numbers are dynamically allocated.
+# ATA_REQUEST_TIMEOUT:	the number of seconds to wait for an ATA request
+#			before timing out.
 
 options 	ATA_STATIC_ID
+#options 	ATA_REQUEST_TIMEOUT=10
 
 #
 # Standard floppy disk controllers and floppy tapes, supports

Modified: stable/7/sys/conf/options
==============================================================================
--- stable/7/sys/conf/options	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/conf/options	Tue Nov 10 22:56:05 2009	(r199159)
@@ -338,6 +338,7 @@ ISCSI_INITIATOR_DEBUG	opt_iscsi_initiato
 # Options used in the 'ata' ATA/ATAPI driver
 ATA_STATIC_ID		opt_ata.h
 ATA_NOPCI		opt_ata.h
+ATA_REQUEST_TIMEOUT	opt_ata.h
 
 # Net stuff.
 ACCEPT_FILTER_DATA

Modified: stable/7/sys/dev/ata/ata-all.h
==============================================================================
--- stable/7/sys/dev/ata/ata-all.h	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/dev/ata/ata-all.h	Tue Nov 10 22:56:05 2009	(r199159)
@@ -308,6 +308,10 @@ struct ata_ahci_cmd_list {
 #define ATA_OP_FINISHED                 1
 #define ATA_MAX_28BIT_LBA               268435455UL
 
+#ifndef	ATA_REQUEST_TIMEOUT
+#define	ATA_REQUEST_TIMEOUT		10
+#endif
+
 /* structure used for composite atomic operations */
 #define MAX_COMPOSITES          32              /* u_int32_t bits */
 struct ata_composite {

Modified: stable/7/sys/dev/ata/ata-disk.c
==============================================================================
--- stable/7/sys/dev/ata/ata-disk.c	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/dev/ata/ata-disk.c	Tue Nov 10 22:56:05 2009	(r199159)
@@ -259,7 +259,7 @@ ad_spindown(void *priv)
     }
     request->flags = ATA_R_CONTROL;
     request->dev = dev;
-    request->timeout = 5;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 1;
     request->callback = ad_power_callback;
     request->u.ata.command = ATA_STANDBY_IMMEDIATE;
@@ -291,9 +291,9 @@ ad_strategy(struct bio *bp)
     if (atadev->spindown_state) {
 	device_printf(dev, "request while spun down, starting.\n");
 	atadev->spindown_state = 0;
-	request->timeout = 31;
+	request->timeout = MAX(ATA_REQUEST_TIMEOUT, 31);
     } else {
-	request->timeout = 5;
+	request->timeout = ATA_REQUEST_TIMEOUT;
     }
     request->retries = 2;
     request->data = bp->bio_data;

Modified: stable/7/sys/dev/ata/ata-queue.c
==============================================================================
--- stable/7/sys/dev/ata/ata-queue.c	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/dev/ata/ata-queue.c	Tue Nov 10 22:56:05 2009	(r199159)
@@ -119,6 +119,7 @@ int
 ata_controlcmd(device_t dev, u_int8_t command, u_int16_t feature,
 	       u_int64_t lba, u_int16_t count)
 {
+    struct ata_device *atadev = device_get_softc(dev);
     struct ata_request *request = ata_alloc_request();
     int error = ENOMEM;
 
@@ -129,7 +130,13 @@ ata_controlcmd(device_t dev, u_int8_t co
 	request->u.ata.count = count;
 	request->u.ata.feature = feature;
 	request->flags = ATA_R_CONTROL;
-	request->timeout = 1;
+	if (atadev->spindown_state) {
+	    device_printf(dev, "request while spun down, starting.\n");
+	    atadev->spindown_state = 0;
+	    request->timeout = MAX(ATA_REQUEST_TIMEOUT, 31);
+	} else {
+	    request->timeout = ATA_REQUEST_TIMEOUT;
+	}
 	request->retries = 0;
 	ata_queue_request(request);
 	error = request->result;
@@ -389,7 +396,7 @@ ata_completed(void *context, int dummy)
 	    request->bytecount = sizeof(struct atapi_sense);
 	    request->donecount = 0;
 	    request->transfersize = sizeof(struct atapi_sense);
-	    request->timeout = 5;
+	    request->timeout = ATA_REQUEST_TIMEOUT;
 	    request->flags &= (ATA_R_ATAPI | ATA_R_QUIET | ATA_R_DEBUG);
 	    request->flags |= (ATA_R_READ | ATA_R_AT_HEAD | ATA_R_REQUEUE);
 	    ATA_DEBUG_RQ(request, "autoissue request sense");

Modified: stable/7/sys/dev/ata/ata-raid.c
==============================================================================
--- stable/7/sys/dev/ata/ata-raid.c	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/dev/ata/ata-raid.c	Tue Nov 10 22:56:05 2009	(r199159)
@@ -273,7 +273,7 @@ ata_raid_flush(struct bio *bp)
 	request->u.ata.lba = 0;
 	request->u.ata.count = 0;
 	request->u.ata.feature = 0;
-	request->timeout = 1;
+	request->timeout = ATA_REQUEST_TIMEOUT;
 	request->retries = 0;
 	request->flags |= ATA_R_ORDERED | ATA_R_DIRECT;
 	ata_queue_request(request);
@@ -4358,7 +4358,7 @@ ata_raid_init_request(struct ar_softc *r
 	printf("FAILURE - out of memory in ata_raid_init_request\n");
 	return NULL;
     }
-    request->timeout = 5;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 2;
     request->callback = ata_raid_done;
     request->driver = rdp;
@@ -4432,7 +4432,7 @@ ata_raid_rw(device_t dev, u_int64_t lba,
 
     /* setup request */
     request->dev = dev;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 0;
     request->data = data;
     request->bytecount = bcount;

Modified: stable/7/sys/dev/ata/atapi-cd.c
==============================================================================
--- stable/7/sys/dev/ata/atapi-cd.c	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/dev/ata/atapi-cd.c	Tue Nov 10 22:56:05 2009	(r199159)
@@ -703,7 +703,7 @@ acd_geom_access(struct g_provider *pp, i
 	request->dev = dev;
 	bcopy(ccb, request->u.atapi.ccb, 16);
 	request->flags = ATA_R_ATAPI;
-	request->timeout = 5;
+	request->timeout = ATA_REQUEST_TIMEOUT;
 	ata_queue_request(request);
 	if (!request->error &&
 	    (request->u.atapi.sense.key == 2 ||
From mav at FreeBSD.org  Tue Nov 10 23:03:51 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Tue Nov 10 23:03:58 2009
Subject: svn commit: r199160 - stable/7/sys/dev/ata
Message-ID: <200911102303.nAAN3peE074611@svn.freebsd.org>

Author: mav
Date: Tue Nov 10 23:03:51 2009
New Revision: 199160
URL: http://svn.freebsd.org/changeset/base/199160

Log:
  MFC r198488:
  Report SATA speeds to CAM, to not confuse users with low numbers logged.

Modified:
  stable/7/sys/dev/ata/atapi-cam.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/ata/atapi-cam.c
==============================================================================
--- stable/7/sys/dev/ata/atapi-cam.c	Tue Nov 10 22:56:05 2009	(r199159)
+++ stable/7/sys/dev/ata/atapi-cam.c	Tue Nov 10 23:03:51 2009	(r199160)
@@ -414,6 +414,12 @@ atapi_action(struct cam_sim *sim, union 
 	    case ATA_UDMA6:
 		cpi->base_transfer_speed = 133000;
 		break;
+	    case ATA_SA150:
+		cpi->base_transfer_speed = 150000;
+		break;
+	    case ATA_SA300:
+		cpi->base_transfer_speed = 300000;
+		break;
 	    default:
 		break;
 	    }
From np at FreeBSD.org  Wed Nov 11 19:00:12 2009
From: np at FreeBSD.org (Navdeep Parhar)
Date: Wed Nov 11 19:00:29 2009
Subject: svn commit: r199191 - stable/7/lib/libdwarf
Message-ID: <200911111900.nABJ0CEq003913@svn.freebsd.org>

Author: np
Date: Wed Nov 11 19:00:12 2009
New Revision: 199191
URL: http://svn.freebsd.org/changeset/base/199191

Log:
  MFC r195747

Modified:
  stable/7/lib/libdwarf/dwarf_loc.c
Directory Properties:
  stable/7/lib/libdwarf/   (props changed)

Modified: stable/7/lib/libdwarf/dwarf_loc.c
==============================================================================
--- stable/7/lib/libdwarf/dwarf_loc.c	Wed Nov 11 18:28:12 2009	(r199190)
+++ stable/7/lib/libdwarf/dwarf_loc.c	Wed Nov 11 19:00:12 2009	(r199191)
@@ -236,7 +236,7 @@ dwarf_op_num(uint8_t pointer_size, uint8
 		case DW_OP_plus_uconst:
 		case DW_OP_regx:
 		case DW_OP_piece:
-			uval = dwarf_decode_sleb128(&p);
+			uval = dwarf_decode_uleb128(&p);
 			break;
 
 		/* Operations with a signed LEB128 operand. */
@@ -458,7 +458,7 @@ dwarf_loc_fill(Dwarf_Locdesc *lbuf, uint
 		case DW_OP_plus_uconst:
 		case DW_OP_regx:
 		case DW_OP_piece:
-			operand1 = dwarf_decode_sleb128(&p);
+			operand1 = dwarf_decode_uleb128(&p);
 			break;
 
 		/* Operations with a signed LEB128 operand. */
From edwin at FreeBSD.org  Thu Nov 12 10:44:26 2009
From: edwin at FreeBSD.org (Edwin Groothuis)
Date: Thu Nov 12 10:44:54 2009
Subject: svn commit: r199217 - stable/7/share/zoneinfo
Message-ID: <200911121044.nACAiP7E028082@svn.freebsd.org>

Author: edwin
Date: Thu Nov 12 10:44:25 2009
New Revision: 199217
URL: http://svn.freebsd.org/changeset/base/199217

Log:
  MFC of r199107, tzdata2009r:
  
  - Three Australian stations in Antarctica have changed their time zone:
    Casey moved from UTC+8 to UTC+11
    Davis moved from UTC+7 to UTC+5
    Mawson moved from UTC+6 to UTC+5
    The changes occurred on 2009-10-18 at 02:00 (local times).

Modified:
  stable/7/share/zoneinfo/antarctica
Directory Properties:
  stable/7/share/zoneinfo/   (props changed)

Modified: stable/7/share/zoneinfo/antarctica
==============================================================================
--- stable/7/share/zoneinfo/antarctica	Thu Nov 12 10:44:18 2009	(r199216)
+++ stable/7/share/zoneinfo/antarctica	Thu Nov 12 10:44:25 2009	(r199217)
@@ -1,5 +1,5 @@
 # 
-# @(#)antarctica	8.5
+# @(#)antarctica	8.6
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -80,15 +80,38 @@ Rule	ChileAQ	2000	max	-	Mar	Sun>=9	3:00u
 # Davis, Vestfold Hills, -6835+07759, since 1957-01-13
 #	(except 1964-11 - 1969-02)
 # Mawson, Holme Bay, -6736+06253, since 1954-02-13
+
+# From Steffen Thorsen (2009-03-11):
+# Three Australian stations in Antarctica have changed their time zone:
+# Casey moved from UTC+8 to UTC+11
+# Davis moved from UTC+7 to UTC+5
+# Mawson moved from UTC+6 to UTC+5
+# The changes occurred on 2009-10-18 at 02:00 (local times).
+#
+# Government source: (Australian Antarctic Division)
+# 
+# http://www.aad.gov.au/default.asp?casid=37079
+# 
+#
+# We have more background information here:
+# 
+# http://www.timeanddate.com/news/time/antarctica-new-times.html
+# 
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Casey	0	-	zzz	1969
-			8:00	-	WST	# Western (Aus) Standard Time
+			8:00	-	WST	2009 Oct 18 2:00
+						# Western (Aus) Standard Time
+			11:00	-	CAST	# Casey Time
 Zone Antarctica/Davis	0	-	zzz	1957 Jan 13
 			7:00	-	DAVT	1964 Nov # Davis Time
 			0	-	zzz	1969 Feb
-			7:00	-	DAVT
+			7:00	-	DAVT	2009 Oct 18 2:0
+			5:00	-	DAVT
 Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
-			6:00	-	MAWT	# Mawson Time
+			6:00	-	MAWT	2009 Oct 18 2:00
+						# Mawson Time
+			5:00	-	MAWT
 # References:
 # 
 # Casey Weather (1998-02-26)
From netchild at FreeBSD.org  Thu Nov 12 14:27:10 2009
From: netchild at FreeBSD.org (Alexander Leidinger)
Date: Thu Nov 12 14:27:22 2009
Subject: svn commit: r199224 - stable/7/sys/compat/linux
Message-ID: <200911121427.nACER93X032827@svn.freebsd.org>

Author: netchild
Date: Thu Nov 12 14:27:09 2009
New Revision: 199224
URL: http://svn.freebsd.org/changeset/base/199224

Log:
  MFC r198945:
    Fix typo in kernel message. The fix is based upon the patch in the PR.
  
    PR:		kern/140279
    Submitted by:	Alexander Best 

Modified:
  stable/7/sys/compat/linux/linux_ipc.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/compat/linux/linux_ipc.c
==============================================================================
--- stable/7/sys/compat/linux/linux_ipc.c	Thu Nov 12 14:22:12 2009	(r199223)
+++ stable/7/sys/compat/linux/linux_ipc.c	Thu Nov 12 14:27:09 2009	(r199224)
@@ -856,7 +856,7 @@ linux_shmctl(struct thread *td, struct l
     case LINUX_SHM_LOCK:
     case LINUX_SHM_UNLOCK:
     default:
-	linux_msg(td, "ipc typ=%d not implemented", args->cmd & ~LINUX_IPC_64);
+	linux_msg(td, "ipc type %d not implemented", args->cmd & ~LINUX_IPC_64);
 	return EINVAL;
     }
 }
From rnoland at FreeBSD.org  Sat Nov 14 18:53:44 2009
From: rnoland at FreeBSD.org (Robert Noland)
Date: Sat Nov 14 18:53:56 2009
Subject: svn commit: r199276 - stable/7/sys/cddl/boot/zfs
Message-ID: <200911141853.nAEIriJA010422@svn.freebsd.org>

Author: rnoland
Date: Sat Nov 14 18:53:44 2009
New Revision: 199276
URL: http://svn.freebsd.org/changeset/base/199276

Log:
  MFC r199241
  
  This patch addresses an overflow in the the zfs boot code and allows
  users to boot from zfs raidz volumes.  This has been tested by a number
  of users and does not impact those which are not booting from zfs raidz
  volumes.
  
  Submitted by:	Matt Reimer 

Modified:
  stable/7/sys/cddl/boot/zfs/zfssubr.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/cddl/boot/zfs/zfssubr.c
==============================================================================
--- stable/7/sys/cddl/boot/zfs/zfssubr.c	Sat Nov 14 18:42:09 2009	(r199275)
+++ stable/7/sys/cddl/boot/zfs/zfssubr.c	Sat Nov 14 18:53:44 2009	(r199276)
@@ -550,7 +550,8 @@ vdev_raidz_read(vdev_t *vdev, const blkp
 	uint64_t s = psize >> unit_shift;
 	uint64_t f = b % dcols;
 	uint64_t o = (b / dcols) << unit_shift;
-	int q, r, c, c1, bc, col, acols, coff, devidx, asize, n;
+	uint64_t q, r, coff;
+	int c, c1, bc, col, acols, devidx, asize, n;
 	static raidz_col_t cols[16];
 	raidz_col_t *rc, *rc1;
 
From stas at FreeBSD.org  Sun Nov 15 11:43:29 2009
From: stas at FreeBSD.org (Stanislav Sedov)
Date: Sun Nov 15 11:43:41 2009
Subject: svn commit: r199289 - in stable/7/sys: conf dev/bce
Message-ID: <200911151143.nAFBhTSD036619@svn.freebsd.org>

Author: stas
Date: Sun Nov 15 11:43:28 2009
New Revision: 199289
URL: http://svn.freebsd.org/changeset/base/199289

Log:
  - MFC r198320:
    Introduce new option BCE_JUMBO_HDRSPLIT that allows user to enable header
    in bce(4) instead of (ab)using ZERO_COPY_SOCKETS that was not
    into if_bce.c anyway.  It is disabled by default.
  > PR:            If a GNATS PR is affected by the change.
  > Submitted by:  If someone else sent in the change.
  > Reviewed by:   If someone else reviewed your modification.
  > Approved by:   If you needed approval for this commit.
  > Obtained from: If the change is from a third party.
  > MFC after:     N [day[s]|week[s]|month[s]].  Request a reminder email.
  > Security:      Vulnerability reference (one per line) or description.
  > Empty fields above will be automatically removed.
  
  _M   7/sys
  M    7/sys/conf/NOTES
  M    7/sys/conf/options
  M    7/sys/dev/bce/if_bce.c
  M    7/sys/dev/bce/if_bcereg.h
  _M   7/sys/contrib/pf

Modified:
  stable/7/sys/conf/NOTES
  stable/7/sys/conf/options
  stable/7/sys/dev/bce/if_bce.c
  stable/7/sys/dev/bce/if_bcereg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/conf/NOTES
==============================================================================
--- stable/7/sys/conf/NOTES	Sun Nov 15 11:30:59 2009	(r199288)
+++ stable/7/sys/conf/NOTES	Sun Nov 15 11:43:28 2009	(r199289)
@@ -1929,6 +1929,12 @@ device		lmc
 # only works for Tigon II chips, and has no effect for Tigon I chips.
 options 	TI_JUMBO_HDRSPLIT
 
+#
+# Use header splitting feature on bce(4) adapters.
+# This may help to reduce the amount of jumbo-sized memory buffers used.
+#
+options		BCE_JUMBO_HDRSPLIT
+
 # These two options allow manipulating the mbuf cluster size and mbuf size,
 # respectively.  Be very careful with NIC driver modules when changing
 # these from their default values, because that can potentially cause a

Modified: stable/7/sys/conf/options
==============================================================================
--- stable/7/sys/conf/options	Sun Nov 15 11:30:59 2009	(r199288)
+++ stable/7/sys/conf/options	Sun Nov 15 11:43:28 2009	(r199289)
@@ -493,6 +493,7 @@ DRM_DEBUG		opt_drm.h
 ZERO_COPY_SOCKETS	opt_zero.h
 TI_PRIVATE_JUMBOS	opt_ti.h
 TI_JUMBO_HDRSPLIT	opt_ti.h
+BCE_JUMBO_HDRSPLIT	opt_bce.h
 
 # XXX Conflict: # of devices vs network protocol (Native ATM).
 # This makes "atm.h" unusable.

Modified: stable/7/sys/dev/bce/if_bce.c
==============================================================================
--- stable/7/sys/dev/bce/if_bce.c	Sun Nov 15 11:30:59 2009	(r199288)
+++ stable/7/sys/dev/bce/if_bce.c	Sun Nov 15 11:43:28 2009	(r199289)
@@ -293,12 +293,12 @@ static void bce_dump_enet           (str
 static void bce_dump_mbuf 			(struct bce_softc *, struct mbuf *);
 static void bce_dump_tx_mbuf_chain	(struct bce_softc *, u16, int);
 static void bce_dump_rx_mbuf_chain	(struct bce_softc *, u16, int);
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 static void bce_dump_pg_mbuf_chain	(struct bce_softc *, u16, int);
 #endif
 static void bce_dump_txbd			(struct bce_softc *, int, struct tx_bd *);
 static void bce_dump_rxbd			(struct bce_softc *, int, struct rx_bd *);
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 static void bce_dump_pgbd			(struct bce_softc *, int, struct rx_bd *);
 #endif
 static void bce_dump_l2fhdr			(struct bce_softc *, int, struct l2_fhdr *);
@@ -306,7 +306,7 @@ static void bce_dump_ctx			(struct bce_s
 static void bce_dump_ftqs			(struct bce_softc *);
 static void bce_dump_tx_chain		(struct bce_softc *, u16, int);
 static void bce_dump_rx_chain		(struct bce_softc *, u16, int);
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 static void bce_dump_pg_chain		(struct bce_softc *, u16, int);
 #endif
 static void bce_dump_status_block	(struct bce_softc *);
@@ -391,7 +391,7 @@ static int  bce_init_rx_chain		(struct b
 static void bce_fill_rx_chain		(struct bce_softc *);
 static void bce_free_rx_chain		(struct bce_softc *);
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 static int  bce_get_pg_buf			(struct bce_softc *, struct mbuf *, u16 *, u16 *);
 static int  bce_init_pg_chain		(struct bce_softc *);
 static void bce_fill_pg_chain		(struct bce_softc *);
@@ -597,7 +597,7 @@ bce_print_adapter_info(struct bce_softc 
 
 	/* Firmware version and device features. */
 	printf("B/C (0x%08X); Flags( ", sc->bce_bc_ver);
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	printf("SPLT ");
 #endif
 	if (sc->bce_flags & BCE_MFW_ENABLE_FLAG)
@@ -1013,7 +1013,7 @@ bce_attach(device_t dev)
 	 * This may change later if the MTU size is set to
 	 * something other than 1500.
 	 */
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	sc->rx_bd_mbuf_alloc_size = MHLEN;
 	/* Make sure offset is 16 byte aligned for hardware. */
 	sc->rx_bd_mbuf_align_pad  = roundup2((MSIZE - MHLEN), 16) -
@@ -2753,7 +2753,7 @@ bce_dma_free(struct bce_softc *sc)
 	}
 
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	/* Free, unmap and destroy all page buffer descriptor chain pages. */
 	for (i = 0; i < PG_PAGES; i++ ) {
 		if (sc->pg_bd_chain[i] != NULL) {
@@ -2817,7 +2817,7 @@ bce_dma_free(struct bce_softc *sc)
 		sc->rx_mbuf_tag = NULL;
 	}
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	/* Unload and destroy the page mbuf maps. */
 	for (i = 0; i < TOTAL_PG_BD; i++) {
 		if (sc->pg_mbuf_map[i] != NULL) {
@@ -3263,7 +3263,7 @@ bce_dma_alloc(device_t dev)
 	/*
 	 * Create a DMA tag for RX mbufs.
 	 */
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	max_size = max_seg_size = ((sc->rx_bd_mbuf_alloc_size < MCLBYTES) ?
 		MCLBYTES : sc->rx_bd_mbuf_alloc_size);
 #else
@@ -3304,7 +3304,7 @@ bce_dma_alloc(device_t dev)
 		}
 	}
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	/*
 	 * Create a DMA tag for the page buffer descriptor chain,
 	 * allocate and clear the memory, and fetch the physical
@@ -4393,7 +4393,7 @@ bce_stop(struct bce_softc *sc)
 	bce_disable_intr(sc);
 
 	/* Free RX buffers. */
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	bce_free_pg_chain(sc);
 #endif
 	bce_free_rx_chain(sc);
@@ -4831,7 +4831,7 @@ bce_get_rx_buf(struct bce_softc *sc, str
 			goto bce_get_rx_buf_exit);
 
 		/* This is a new mbuf allocation. */
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 		MGETHDR(m_new, M_DONTWAIT, MT_DATA);
 #else
 		if (sc->rx_bd_mbuf_alloc_size <= MCLBYTES)
@@ -4912,7 +4912,7 @@ bce_get_rx_buf_exit:
 }
 
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 /****************************************************************************/
 /* Encapsulate an mbuf cluster into the page chain.                        */
 /*                                                                          */
@@ -5021,7 +5021,7 @@ bce_get_pg_buf_exit:
 
 	return(rc);
 }
-#endif /* ZERO_COPY_SOCKETS */
+#endif /* BCE_JUMBO_HDRSPLIT */
 
 /****************************************************************************/
 /* Initialize the TX context memory.                                        */
@@ -5377,7 +5377,7 @@ bce_free_rx_chain(struct bce_softc *sc)
 }
 
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 /****************************************************************************/
 /* Allocate memory and initialize the page data structures.                 */
 /* Assumes that bce_init_rx_chain() has not already been called.            */
@@ -5541,7 +5541,7 @@ bce_free_pg_chain(struct bce_softc *sc)
 
 	DBEXIT(BCE_VERBOSE_RESET | BCE_VERBOSE_RECV | BCE_VERBOSE_UNLOAD);
 }
-#endif /* ZERO_COPY_SOCKETS */
+#endif /* BCE_JUMBO_HDRSPLIT */
 
 
 /****************************************************************************/
@@ -5714,7 +5714,7 @@ bce_rx_intr(struct bce_softc *sc)
 	unsigned int pkt_len;
 	u16 sw_rx_cons, sw_rx_cons_idx, hw_rx_cons;
 	u32 status;
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	unsigned int rem_len;
 	u16 sw_pg_cons, sw_pg_cons_idx;
 #endif
@@ -5730,7 +5730,7 @@ bce_rx_intr(struct bce_softc *sc)
 		bus_dmamap_sync(sc->rx_bd_chain_tag,
 		    sc->rx_bd_chain_map[i], BUS_DMASYNC_POSTREAD);
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	/* Prepare the page chain pages to be accessed by the host CPU. */
 	for (int i = 0; i < PG_PAGES; i++)
 		bus_dmamap_sync(sc->pg_bd_chain_tag,
@@ -5742,7 +5742,7 @@ bce_rx_intr(struct bce_softc *sc)
 
 	/* Get working copies of the driver's view of the consumer indices. */
 	sw_rx_cons = sc->rx_cons;
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	sw_pg_cons = sc->pg_cons;
 #endif
 
@@ -5803,7 +5803,7 @@ bce_rx_intr(struct bce_softc *sc)
 		 */
 		m_adj(m0, sizeof(struct l2_fhdr) + ETHER_ALIGN);
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 		/*
 		 * Check whether the received frame fits in a single
 		 * mbuf or not (i.e. packet data + FCS <=
@@ -5977,7 +5977,7 @@ bce_rx_int_next_rx:
 		if (m0) {
 			/* Make sure we don't lose our place when we release the lock. */
 			sc->rx_cons = sw_rx_cons;
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 			sc->pg_cons = sw_pg_cons;
 #endif
 
@@ -5987,7 +5987,7 @@ bce_rx_int_next_rx:
 
 			/* Recover our place. */
 			sw_rx_cons = sc->rx_cons;
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 			sw_pg_cons = sc->pg_cons;
 #endif
 		}
@@ -5998,7 +5998,7 @@ bce_rx_int_next_rx:
 	}
 
 	/* No new packets to process.  Refill the RX and page chains and exit. */
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	sc->pg_cons = sw_pg_cons;
 	bce_fill_pg_chain(sc);
 #endif
@@ -6011,7 +6011,7 @@ bce_rx_int_next_rx:
 		bus_dmamap_sync(sc->rx_bd_chain_tag,
 		    sc->rx_bd_chain_map[i], BUS_DMASYNC_PREWRITE);
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	for (int i = 0; i < PG_PAGES; i++)
 		bus_dmamap_sync(sc->pg_bd_chain_tag,
 		    sc->pg_bd_chain_map[i], BUS_DMASYNC_PREWRITE);
@@ -6257,7 +6257,7 @@ bce_init_locked(struct bce_softc *sc)
 	 * Calculate and program the hardware Ethernet MTU
 	 * size. Be generous on the receive if we have room.
 	 */
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	if (ifp->if_mtu <= (sc->rx_bd_mbuf_data_len + sc->pg_bd_mbuf_alloc_size))
 		ether_mtu = sc->rx_bd_mbuf_data_len + sc->pg_bd_mbuf_alloc_size;
 #else
@@ -6289,7 +6289,7 @@ bce_init_locked(struct bce_softc *sc)
 	/* Program appropriate promiscuous/multicast filtering. */
 	bce_set_rx_mode(sc);
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	DBPRINT(sc, BCE_INFO_LOAD, "%s(): pg_bd_mbuf_alloc_size = %d\n",
 		__FUNCTION__, sc->pg_bd_mbuf_alloc_size);
 
@@ -6802,7 +6802,7 @@ bce_ioctl(struct ifnet *ifp, u_long comm
 			BCE_LOCK(sc);
 			ifp->if_mtu = ifr->ifr_mtu;
 			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 			/* No buffer allocation size changes are necessary. */
 #else
 			/* Recalculate our buffer allocation sizes. */
@@ -7505,7 +7505,7 @@ bce_tick(void *xsc)
 	bce_stats_update(sc);
 
 	/* Top off the receive and page chains. */
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	bce_fill_pg_chain(sc);
 #endif
 	bce_fill_rx_chain(sc);
@@ -7685,7 +7685,7 @@ bce_sysctl_dump_tx_chain(SYSCTL_HANDLER_
 }
 
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 /****************************************************************************/
 /* Provides a sysctl interface to allow dumping the page chain.             */
 /*                                                                          */
@@ -8313,7 +8313,7 @@ bce_add_sysctls(struct bce_softc *sc)
 		(void *)sc, 0,
 		bce_sysctl_dump_tx_chain, "I", "Dump tx_bd chain");
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	SYSCTL_ADD_PROC(ctx, children, OID_AUTO,
 		"dump_pg_chain", CTLTYPE_INT | CTLFLAG_RW,
 		(void *)sc, 0,
@@ -8608,7 +8608,7 @@ bce_dump_rx_mbuf_chain(struct bce_softc 
 }
 
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 /****************************************************************************/
 /* Prints out the mbufs in the mbuf page chain.                             */
 /*                                                                          */
@@ -8732,7 +8732,7 @@ bce_dump_rxbd(struct bce_softc *sc, int 
 }
 
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 /****************************************************************************/
 /* Prints out a rx_bd structure in the page chain.                          */
 /*                                                                          */
@@ -9219,7 +9219,7 @@ bce_dump_rx_chain(struct bce_softc *sc, 
 }
 
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 /****************************************************************************/
 /* Prints out the page chain.                                               */
 /*                                                                          */
@@ -9700,7 +9700,7 @@ bce_dump_driver_state(struct bce_softc *
 		"0x%08X:%08X - (sc->rx_bd_chain) rx_bd chain virtual address\n",
 		val_hi, val_lo);
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	val_hi = BCE_ADDR_HI(sc->pg_bd_chain);
 	val_lo = BCE_ADDR_LO(sc->pg_bd_chain);
 	BCE_PRINTF(
@@ -9720,7 +9720,7 @@ bce_dump_driver_state(struct bce_softc *
 		"0x%08X:%08X - (sc->rx_mbuf_ptr) rx mbuf chain virtual address\n",
 		val_hi, val_lo);
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	val_hi = BCE_ADDR_HI(sc->pg_mbuf_ptr);
 	val_lo = BCE_ADDR_LO(sc->pg_mbuf_ptr);
 	BCE_PRINTF(
@@ -9773,7 +9773,7 @@ bce_dump_driver_state(struct bce_softc *
 	BCE_PRINTF("         0x%08X - (sc->free_rx_bd) free rx_bd's\n",
 		sc->free_rx_bd);
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	BCE_PRINTF("     0x%04X(0x%04X) - (sc->pg_prod) page producer index\n",
 		sc->pg_prod, (u16) PG_CHAIN_IDX(sc->pg_prod));
 
@@ -10279,7 +10279,7 @@ bce_breakpoint(struct bce_softc *sc)
 		bce_dump_tpat_state(sc, 0);
 		bce_dump_cp_state(sc, 0);
 		bce_dump_com_state(sc, 0);
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 		bce_dump_pgbd(sc, 0, NULL);
 		bce_dump_pg_mbuf_chain(sc, 0, USABLE_PG_BD);
 		bce_dump_pg_chain(sc, 0, USABLE_PG_BD);

Modified: stable/7/sys/dev/bce/if_bcereg.h
==============================================================================
--- stable/7/sys/dev/bce/if_bcereg.h	Sun Nov 15 11:30:59 2009	(r199288)
+++ stable/7/sys/dev/bce/if_bcereg.h	Sun Nov 15 11:43:28 2009	(r199289)
@@ -6205,7 +6205,7 @@ struct l2_fhdr {
 #define RX_PAGE(x) (((x) & ~USABLE_RX_BD_PER_PAGE) >> (BCM_PAGE_BITS - 4))
 #define RX_IDX(x) ((x) & USABLE_RX_BD_PER_PAGE)
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 /*
  * To accomodate jumbo frames, the page chain should
  * be 4 times larger than the receive chain.
@@ -6227,7 +6227,7 @@ struct l2_fhdr {
 #define PG_PAGE(x) (((x) & ~USABLE_PG_BD_PER_PAGE) >> (BCM_PAGE_BITS - 4))
 #define PG_IDX(x) ((x) & USABLE_PG_BD_PER_PAGE)
 
-#endif /* ZERO_COPY_SOCKETS */
+#endif /* BCE_JUMBO_HDRSPLIT */
 
 #define CTX_INIT_RETRY_COUNT        10
 
@@ -6505,7 +6505,7 @@ struct bce_softc
 	u16					tx_cons;
 	u32					tx_prod_bseq;	/* Counts the bytes used.  */
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	u16					pg_prod;
 	u16					pg_cons;
 #endif
@@ -6522,7 +6522,7 @@ struct bce_softc
 	int					rx_bd_mbuf_data_len;
 	int					rx_bd_mbuf_align_pad;
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	int					pg_bd_mbuf_alloc_size;
 #endif
 
@@ -6544,7 +6544,7 @@ struct bce_softc
 	struct rx_bd		*rx_bd_chain[RX_PAGES];
 	bus_addr_t			rx_bd_chain_paddr[RX_PAGES];
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	/* H/W maintained page buffer descriptor chain structure. */
 	bus_dma_tag_t		pg_bd_chain_tag;
 	bus_dmamap_t		pg_bd_chain_map[PG_PAGES];
@@ -6581,7 +6581,7 @@ struct bce_softc
 	bus_dma_tag_t		rx_mbuf_tag;
 	bus_dma_tag_t		tx_mbuf_tag;
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	bus_dma_tag_t		pg_mbuf_tag;
 #endif
 
@@ -6593,7 +6593,7 @@ struct bce_softc
 	bus_dmamap_t		rx_mbuf_map[TOTAL_RX_BD];
 	struct mbuf			*rx_mbuf_ptr[TOTAL_RX_BD];
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	/* S/W maintained mbuf page chain structure. */
 	bus_dmamap_t		pg_mbuf_map[TOTAL_PG_BD];
 	struct mbuf			*pg_mbuf_ptr[TOTAL_PG_BD];
@@ -6605,7 +6605,7 @@ struct bce_softc
 	u16 used_tx_bd;
 	u16 max_tx_bd;
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	u16 free_pg_bd;
 	u16 max_pg_bd;
 #endif
@@ -6693,7 +6693,7 @@ struct bce_softc
 	int	debug_tx_mbuf_alloc;
 	int debug_rx_mbuf_alloc;
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	int debug_pg_mbuf_alloc;
 #endif
 
@@ -6710,7 +6710,7 @@ struct bce_softc
 	u32	rx_low_watermark;			/* Lowest number of rx_bd's free. */
 	u32 rx_empty_count;				/* Number of times the RX chain was empty. */
 
-#ifdef ZERO_COPY_SOCKETS
+#ifdef BCE_JUMBO_HDRSPLIT
 	u32	pg_low_watermark;			/* Lowest number of pages free. */
 	u32 pg_empty_count; 			/* Number of times the page chain was empty. */
 #endif
From dougb at FreeBSD.org  Sun Nov 15 23:51:59 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sun Nov 15 23:52:06 2009
Subject: svn commit: r199302 - stable/7/share/man/man5
Message-ID: <200911152351.nAFNpxWb051569@svn.freebsd.org>

Author: dougb
Date: Sun Nov 15 23:51:59 2009
New Revision: 199302
URL: http://svn.freebsd.org/changeset/base/199302

Log:
  MFC r199127:
  Add a note about no hostname leading to "Amnesiac" on the console
  
  The text is inspired by the PR, but more in line with the existing text
  
  PR:		docs/140434
  Submitted by:	Jason Helfman 
  
  MFC r199152:
  s/a default/the default/
  
  Submitted by:	remko
  
  MFC r199299:
  In r199127/r199152 I forgot to bump .Dd

Modified:
  stable/7/share/man/man5/rc.conf.5   (contents, props changed)
Directory Properties:
  stable/7/share/man/man5/   (props changed)

Modified: stable/7/share/man/man5/rc.conf.5
==============================================================================
--- stable/7/share/man/man5/rc.conf.5	Sun Nov 15 23:49:28 2009	(r199301)
+++ stable/7/share/man/man5/rc.conf.5	Sun Nov 15 23:51:59 2009	(r199302)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 25, 2009
+.Dd November 11, 2009
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -344,6 +344,9 @@ If
 .Xr dhclient 8
 is used to set the hostname via DHCP,
 this variable should be set to an empty string.
+If this value remains unset when the system is done booting
+your console login will display the default hostname of
+.Dq Amnesiac.
 .It Va ipv6_enable
 .Pq Vt bool
 Enable support for IPv6 networking.
From brueffer at FreeBSD.org  Mon Nov 16 08:27:55 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Mon Nov 16 08:28:01 2009
Subject: svn commit: r199315 - stable/7/lib/libc/gen
Message-ID: <200911160827.nAG8RsRM062654@svn.freebsd.org>

Author: brueffer
Date: Mon Nov 16 08:27:54 2009
New Revision: 199315
URL: http://svn.freebsd.org/changeset/base/199315

Log:
  MFC: r199046
  
  Fix a copy+paste error by checking the correct variable against MM_NULLACT.

Modified:
  stable/7/lib/libc/gen/fmtmsg.c
Directory Properties:
  stable/7/lib/libc/   (props changed)

Modified: stable/7/lib/libc/gen/fmtmsg.c
==============================================================================
--- stable/7/lib/libc/gen/fmtmsg.c	Mon Nov 16 08:26:56 2009	(r199314)
+++ stable/7/lib/libc/gen/fmtmsg.c	Mon Nov 16 08:27:54 2009	(r199315)
@@ -128,7 +128,7 @@ printfmt(char *msgverb, long class, cons
 		size += strlen(sevname);
 	if (text != MM_NULLTXT)
 		size += strlen(text);
-	if (text != MM_NULLACT)
+	if (act != MM_NULLACT)
 		size += strlen(act);
 	if (tag != MM_NULLTAG)
 		size += strlen(tag);
From bz at FreeBSD.org  Mon Nov 16 20:34:54 2009
From: bz at FreeBSD.org (Bjoern A. Zeeb)
Date: Mon Nov 16 20:35:10 2009
Subject: svn commit: r199330 - stable/7/sys/compat/pecoff
Message-ID: <200911162034.nAGKYrJW080684@svn.freebsd.org>

Author: bz
Date: Mon Nov 16 20:34:53 2009
New Revision: 199330
URL: http://svn.freebsd.org/changeset/base/199330

Log:
  As we pass the 'offset' unvalidated to vn_rdwr() make sure
  that it is unsigned rather than possibly set to something negative
  by a malicious binary.
  
  This is just the immediate fix to the problem mentioned in
  PR kern/80742 and by http://milw0rm.com/exploits/9206 but does
  not fix all possible problems imgact_pecoff has.
  
  As this feature does not work and is not compiled in by default,
  the security team considers this vulnerability to be of low risk
  to the user population and will not be issuing an advisory.
  
  Note that this is a direct commit to stable/7 as pecoff support has
  been removed from head and stable/8 already.
  
  PR:		kern/80742
  Reported by:	Oliver Pinter (oliver.pntr gmail.com) via freebsd-security
  Help reproducing and testing by: Damian Weber (dweber htw-saarland.de)
  MFC After:	3 days

Modified:
  stable/7/sys/compat/pecoff/imgact_pecoff.c

Modified: stable/7/sys/compat/pecoff/imgact_pecoff.c
==============================================================================
--- stable/7/sys/compat/pecoff/imgact_pecoff.c	Mon Nov 16 19:10:09 2009	(r199329)
+++ stable/7/sys/compat/pecoff/imgact_pecoff.c	Mon Nov 16 20:34:53 2009	(r199330)
@@ -136,7 +136,7 @@ exec_pecoff_coff_makecmds(struct image_p
 			  struct coff_filehdr *, int);
 
 static int      pecoff_signature(struct thread *, struct vnode *, const struct pecoff_dos_filehdr *);
-static int      pecoff_read_from(struct thread *, struct vnode *, int, caddr_t, int);
+static int      pecoff_read_from(struct thread *, struct vnode *, unsigned int, caddr_t, int);
 static int 
 pecoff_load_section(struct thread * td,
 		    struct vmspace * vmspace, struct vnode * vp,
@@ -292,7 +292,7 @@ pecoff_load_file(struct thread * td, con
 	struct vmspace *vmspace = td->td_proc->p_vmspace;
 	struct vattr    attr;
 	struct image_params image_params, *imgp;
-	int             peofs;
+	unsigned int peofs;
 	int             error, i, scnsiz;
 
 	imgp = &image_params;
@@ -554,7 +554,7 @@ int
 pecoff_read_from(td, vp, pos, buf, siz)
 	struct thread  *td;
 	struct vnode   *vp;
-	int             pos;
+	unsigned int    pos;
 	caddr_t         buf;
 	int             siz;
 {
From avg at FreeBSD.org  Tue Nov 17 09:37:44 2009
From: avg at FreeBSD.org (Andriy Gapon)
Date: Tue Nov 17 09:38:00 2009
Subject: svn commit: r199353 - in stable/7/sys: dev/ichwd modules/ichwd
Message-ID: <200911170937.nAH9bhUW098771@svn.freebsd.org>

Author: avg
Date: Tue Nov 17 09:37:43 2009
New Revision: 199353
URL: http://svn.freebsd.org/changeset/base/199353

Log:
  MFC r199015: ichwd: don't attach to isa pnp device(s) by accident

Modified:
  stable/7/sys/dev/ichwd/ichwd.c
  stable/7/sys/modules/ichwd/Makefile
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/ichwd/ichwd.c
==============================================================================
--- stable/7/sys/dev/ichwd/ichwd.c	Tue Nov 17 09:35:13 2009	(r199352)
+++ stable/7/sys/dev/ichwd/ichwd.c	Tue Nov 17 09:37:43 2009	(r199353)
@@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -393,7 +394,9 @@ static int
 ichwd_probe(device_t dev)
 {
 
-	(void)dev;
+	/* Do not claim some ISA PnP device by accident. */
+	if (isa_get_logicalid(dev) != 0)
+		return (ENXIO);
 	return (0);
 }
 

Modified: stable/7/sys/modules/ichwd/Makefile
==============================================================================
--- stable/7/sys/modules/ichwd/Makefile	Tue Nov 17 09:35:13 2009	(r199352)
+++ stable/7/sys/modules/ichwd/Makefile	Tue Nov 17 09:37:43 2009	(r199353)
@@ -3,6 +3,6 @@
 .PATH: ${.CURDIR}/../../dev/ichwd
 
 KMOD=	ichwd
-SRCS=	ichwd.c device_if.h bus_if.h pci_if.h
+SRCS=	ichwd.c device_if.h bus_if.h pci_if.h isa_if.h
 
 .include 
From kib at FreeBSD.org  Tue Nov 17 12:09:22 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Tue Nov 17 12:09:33 2009
Subject: svn commit: r199358 - stable/7/sys/kern
Message-ID: <200911171209.nAHC9Lm7006111@svn.freebsd.org>

Author: kib
Date: Tue Nov 17 12:09:21 2009
New Revision: 199358
URL: http://svn.freebsd.org/changeset/base/199358

Log:
  MFC r198853:
  If socket buffer space appears to be lower then sum of count of
  already prepared bytes and next portion of transfer, inner loop of
  kern_sendfile() aborts, not preparing next mbuf for socket buffer, and
  not modifying any outer loop invariants. The thread loops in the outer
  loop forever.
  
  Instead of breaking from inner loop, prepare only bytes that fit into
  the socket buffer space.

Modified:
  stable/7/sys/kern/uipc_syscalls.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/uipc_syscalls.c
==============================================================================
--- stable/7/sys/kern/uipc_syscalls.c	Tue Nov 17 11:46:55 2009	(r199357)
+++ stable/7/sys/kern/uipc_syscalls.c	Tue Nov 17 12:09:21 2009	(r199358)
@@ -2027,20 +2027,12 @@ retry_space:
 				rem = obj->un_pager.vnp.vnp_size -
 				    uap->offset - fsbytes - loopbytes;
 			xfsize = omin(rem, xfsize);
+			xfsize = omin(space - loopbytes, xfsize);
 			if (xfsize <= 0) {
 				VM_OBJECT_UNLOCK(obj);
 				done = 1;		/* all data sent */
 				break;
 			}
-			/*
-			 * Don't overflow the send buffer.
-			 * Stop here and send out what we've
-			 * already got.
-			 */
-			if (space < loopbytes + xfsize) {
-				VM_OBJECT_UNLOCK(obj);
-				break;
-			}
 
 			/*
 			 * Attempt to look up the page.  Allocate
From kib at FreeBSD.org  Tue Nov 17 12:11:13 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Tue Nov 17 12:11:29 2009
Subject: svn commit: r199359 - stable/7/sys/kern
Message-ID: <200911171211.nAHCBCxB006216@svn.freebsd.org>

Author: kib
Date: Tue Nov 17 12:11:12 2009
New Revision: 199359
URL: http://svn.freebsd.org/changeset/base/199359

Log:
  MFC r199137:
  Detect the slashdot lookup for RENAME or REMOVE in lookup(), and return
  EINVAL.

Modified:
  stable/7/sys/kern/vfs_lookup.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/vfs_lookup.c
==============================================================================
--- stable/7/sys/kern/vfs_lookup.c	Tue Nov 17 12:09:21 2009	(r199358)
+++ stable/7/sys/kern/vfs_lookup.c	Tue Nov 17 12:11:12 2009	(r199359)
@@ -464,6 +464,12 @@ dirloop:
 	else
 		cnp->cn_flags &= ~ISLASTCN;
 
+	if ((cnp->cn_flags & ISLASTCN) != 0 &&
+	    cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.' &&
+	    (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) {
+		error = EINVAL;
+		goto bad;
+	}
 
 	/*
 	 * Check for degenerate name (e.g. / or "")
From jhb at FreeBSD.org  Tue Nov 17 15:28:25 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue Nov 17 15:28:47 2009
Subject: svn commit: r199392 - stable/7/sbin/ddb
Message-ID: <200911171528.nAHFSPkP017360@svn.freebsd.org>

Author: jhb
Date: Tue Nov 17 15:28:25 2009
New Revision: 199392
URL: http://svn.freebsd.org/changeset/base/199392

Log:
  MFC 198820:
  Ensure 'kvm' is always initialized.  If "-M" was not specified and the
  garbage value on the stack was not zero, then 'ddb capture' would try to
  use the garbage value as a kvm_t pointer.

Modified:
  stable/7/sbin/ddb/ddb_capture.c
Directory Properties:
  stable/7/sbin/ddb/   (props changed)

Modified: stable/7/sbin/ddb/ddb_capture.c
==============================================================================
--- stable/7/sbin/ddb/ddb_capture.c	Tue Nov 17 15:28:14 2009	(r199391)
+++ stable/7/sbin/ddb/ddb_capture.c	Tue Nov 17 15:28:25 2009	(r199392)
@@ -204,6 +204,7 @@ ddb_capture(int argc, char *argv[])
 
 	mflag = NULL;
 	nflag = NULL;
+	kvm = NULL;
 	while ((ch = getopt(argc, argv, "M:N:")) != -1) {
 		switch (ch) {
 		case 'M':
From jhb at FreeBSD.org  Tue Nov 17 15:30:23 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue Nov 17 15:30:43 2009
Subject: svn commit: r199394 - stable/7/secure/usr.bin/bdes
Message-ID: <200911171530.nAHFUMux017600@svn.freebsd.org>

Author: jhb
Date: Tue Nov 17 15:30:22 2009
New Revision: 199394
URL: http://svn.freebsd.org/changeset/base/199394

Log:
  MFC 198856: Fix a couple of comment typos.

Modified:
  stable/7/secure/usr.bin/bdes/bdes.c
Directory Properties:
  stable/7/secure/usr.bin/bdes/   (props changed)

Modified: stable/7/secure/usr.bin/bdes/bdes.c
==============================================================================
--- stable/7/secure/usr.bin/bdes/bdes.c	Tue Nov 17 15:30:16 2009	(r199393)
+++ stable/7/secure/usr.bin/bdes/bdes.c	Tue Nov 17 15:30:22 2009	(r199394)
@@ -170,11 +170,11 @@ main(int argc, char *argv[])
 	int i;				/* counter in a for loop */
 	char *p;			/* used to obtain the key */
 	DES_cblock msgbuf;		/* I/O buffer */
-	int kflag;			/* command-line encryptiooon key */
+	int kflag;			/* command-line encryption key */
 
 	setproctitle("-");		/* Hide command-line arguments */
 
-	/* initialize the initialization vctor */
+	/* initialize the initialization vector */
 	MEMZERO(ivec, 8);
 
 	/* process the argument list */
From jhb at FreeBSD.org  Tue Nov 17 15:59:27 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue Nov 17 15:59:44 2009
Subject: svn commit: r199397 - in stable/7/sys: amd64/conf i386/conf
	pc98/conf
Message-ID: <200911171559.nAHFxRjO019573@svn.freebsd.org>

Author: jhb
Date: Tue Nov 17 15:59:26 2009
New Revision: 199397
URL: http://svn.freebsd.org/changeset/base/199397

Log:
  MFC 198043:
  Move the USB wireless drivers down into their own section next to the USB
  ethernet drivers.

Modified:
  stable/7/sys/amd64/conf/GENERIC
  stable/7/sys/i386/conf/GENERIC
  stable/7/sys/pc98/conf/GENERIC
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/amd64/conf/GENERIC
==============================================================================
--- stable/7/sys/amd64/conf/GENERIC	Tue Nov 17 15:56:45 2009	(r199396)
+++ stable/7/sys/amd64/conf/GENERIC	Tue Nov 17 15:59:26 2009	(r199397)
@@ -280,7 +280,6 @@ device		ukbd		# Keyboard
 device		ulpt		# Printer
 device		umass		# Disks/Mass storage - Requires scbus and da
 device		ums		# Mouse
-device		ural		# Ralink Technology RT2500USB wireless NICs
 device		urio		# Diamond Rio 500 MP3 player
 device		uscanner	# Scanners
 # USB Serial devices
@@ -301,6 +300,9 @@ device		cdce		# Generic USB over Etherne
 device		cue		# CATC USB Ethernet
 device		kue		# Kawasaki LSI USB Ethernet
 device		rue		# RealTek RTL8150 USB Ethernet
+# USB Wireless
+device		rum		# Ralink Technology RT2501USB wireless NICs
+device		ural		# Ralink Technology RT2500USB wireless NICs
 
 # FireWire support
 device		firewire	# FireWire bus code

Modified: stable/7/sys/i386/conf/GENERIC
==============================================================================
--- stable/7/sys/i386/conf/GENERIC	Tue Nov 17 15:56:45 2009	(r199396)
+++ stable/7/sys/i386/conf/GENERIC	Tue Nov 17 15:59:26 2009	(r199397)
@@ -294,8 +294,6 @@ device		ukbd		# Keyboard
 device		ulpt		# Printer
 device		umass		# Disks/Mass storage - Requires scbus and da
 device		ums		# Mouse
-device		ural		# Ralink Technology RT2500USB wireless NICs
-device		rum		# Ralink Technology RT2501USB wireless NICs
 device		urio		# Diamond Rio 500 MP3 player
 device		uscanner	# Scanners
 # USB Serial devices
@@ -316,6 +314,9 @@ device		cdce		# Generic USB over Etherne
 device		cue		# CATC USB Ethernet
 device		kue		# Kawasaki LSI USB Ethernet
 device		rue		# RealTek RTL8150 USB Ethernet
+# USB Wireless
+device		rum		# Ralink Technology RT2501USB wireless NICs
+device		ural		# Ralink Technology RT2500USB wireless NICs
 
 # FireWire support
 device		firewire	# FireWire bus code

Modified: stable/7/sys/pc98/conf/GENERIC
==============================================================================
--- stable/7/sys/pc98/conf/GENERIC	Tue Nov 17 15:56:45 2009	(r199396)
+++ stable/7/sys/pc98/conf/GENERIC	Tue Nov 17 15:59:26 2009	(r199397)
@@ -248,7 +248,6 @@ device		bpf		# Berkeley packet filter
 #device		ulpt		# Printer
 #device		umass		# Disks/Mass storage - Requires scbus and da
 #device		ums		# Mouse
-#device		ural		# Ralink Technology RT2500USB wireless NICs
 #device		urio		# Diamond Rio 500 MP3 player
 #device		uscanner	# Scanners
 # USB Serial devices
@@ -269,6 +268,9 @@ device		bpf		# Berkeley packet filter
 #device		cue		# CATC USB Ethernet
 #device		kue		# Kawasaki LSI USB Ethernet
 #device		rue		# RealTek RTL8150 USB Ethernet
+# USB Wireless
+#device		rum		# Ralink Technology RT2501USB wireless NICs
+#device		ural		# Ralink Technology RT2500USB wireless NICs
 
 # FireWire support
 #device		firewire	# FireWire bus code
From jhb at FreeBSD.org  Tue Nov 17 16:17:40 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue Nov 17 16:17:47 2009
Subject: svn commit: r199401 - stable/7/sys/netinet
Message-ID: <200911171617.nAHGHeCM020886@svn.freebsd.org>

Author: jhb
Date: Tue Nov 17 16:17:39 2009
New Revision: 199401
URL: http://svn.freebsd.org/changeset/base/199401

Log:
  MFC 198990:
  Several years ago a feature was added to TCP that casued soreceive() to
  send an ACK right away if data was drained from a TCP socket that had
  previously advertised a zero-sized window.  The current code requires the
  receive window to be exactly zero for this to kick in.  If window scaling is
  enabled and the window is smaller than the scale, then the effective window
  that is advertised is zero.  However, in that case the zero-sized window
  handling is not enabled because the window is not exactly zero.  The fix
  changes the code to check the raw window value against zero.

Modified:
  stable/7/sys/netinet/tcp_output.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/netinet/tcp_output.c
==============================================================================
--- stable/7/sys/netinet/tcp_output.c	Tue Nov 17 16:17:11 2009	(r199400)
+++ stable/7/sys/netinet/tcp_output.c	Tue Nov 17 16:17:39 2009	(r199401)
@@ -939,7 +939,7 @@ send:
 	 * to read more data then can be buffered prior to transmitting on
 	 * the connection.
 	 */
-	if (recwin == 0)
+	if (th->th_win == 0)
 		tp->t_flags |= TF_RXWIN0SENT;
 	else
 		tp->t_flags &= ~TF_RXWIN0SENT;
From jhb at FreeBSD.org  Tue Nov 17 16:51:39 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue Nov 17 16:51:50 2009
Subject: svn commit: r199409 - stable/7/lib/libkvm
Message-ID: <200911171651.nAHGpcLf023258@svn.freebsd.org>

Author: jhb
Date: Tue Nov 17 16:51:38 2009
New Revision: 199409
URL: http://svn.freebsd.org/changeset/base/199409

Log:
  MFC 198986:
  Fix a copy-paste bug when reading data from the last 3 (7 for PAE) bytes of
  a page mapped by a large page in the kernel.

Modified:
  stable/7/lib/libkvm/kvm_i386.c
Directory Properties:
  stable/7/lib/libkvm/   (props changed)

Modified: stable/7/lib/libkvm/kvm_i386.c
==============================================================================
--- stable/7/lib/libkvm/kvm_i386.c	Tue Nov 17 16:50:57 2009	(r199408)
+++ stable/7/lib/libkvm/kvm_i386.c	Tue Nov 17 16:51:38 2009	(r199409)
@@ -294,9 +294,9 @@ _kvm_vatop(kvm_t *kd, u_long va, off_t *
 #define	PG_FRAME4M	(~PAGE4M_MASK)
 		pde_pa = ((u_long)pde & PG_FRAME4M) + (va & PAGE4M_MASK);
 		s = _kvm_pa2off(kd, pde_pa, &ofs);
-		if (s < sizeof pde) {
-			_kvm_syserr(kd, kd->program,
-			    "_kvm_vatop: pde_pa not found");
+		if (s == 0) {
+			_kvm_err(kd, kd->program,
+			    "_kvm_vatop: 4MB page address not in dump");
 			goto invalid;
 		}
 		*pa = ofs;
@@ -390,9 +390,9 @@ _kvm_vatop_pae(kvm_t *kd, u_long va, off
 #define	PG_FRAME2M	(~PAGE2M_MASK)
 		pde_pa = ((u_long)pde & PG_FRAME2M) + (va & PAGE2M_MASK);
 		s = _kvm_pa2off(kd, pde_pa, &ofs);
-		if (s < sizeof pde) {
-			_kvm_syserr(kd, kd->program,
-			    "_kvm_vatop_pae: pde_pa not found");
+		if (s == 0) {
+			_kvm_err(kd, kd->program,
+			    "_kvm_vatop: 2MB page address not in dump");
 			goto invalid;
 		}
 		*pa = ofs;
From bz at FreeBSD.org  Tue Nov 17 20:48:33 2009
From: bz at FreeBSD.org (Bjoern A. Zeeb)
Date: Tue Nov 17 20:48:40 2009
Subject: svn commit: r199433 - stable/7/sys/dev/bge
Message-ID: <200911172048.nAHKmWPP037548@svn.freebsd.org>

Author: bz
Date: Tue Nov 17 20:48:32 2009
New Revision: 199433
URL: http://svn.freebsd.org/changeset/base/199433

Log:
  MFC r198049:
  
    Immediately after clearing a pending callout that didn't make it due
    to the lock we hold, disable interrupts, and announce to the firmware
    that we are shutting down. Especially do this before disabling blocks.
  
    This makes some types of machines with asf enabled no longer hang upon
    boot, when we start configuring the interface.
  
  PR:	i386/96382, kern/100410, kern/122252, kern/116328

Modified:
  stable/7/sys/dev/bge/if_bge.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/bge/if_bge.c
==============================================================================
--- stable/7/sys/dev/bge/if_bge.c	Tue Nov 17 20:45:49 2009	(r199432)
+++ stable/7/sys/dev/bge/if_bge.c	Tue Nov 17 20:48:32 2009	(r199433)
@@ -4213,6 +4213,16 @@ bge_stop(struct bge_softc *sc)
 
 	callout_stop(&sc->bge_stat_ch);
 
+	/* Disable host interrupts. */
+	BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR);
+	bge_writembx(sc, BGE_MBX_IRQ0_LO, 1);
+
+	/*
+	 * Tell firmware we're shutting down.
+	 */
+	bge_stop_fw(sc);
+	bge_sig_pre_reset(sc, BGE_RESET_STOP);
+
 	/*
 	 * Disable all of the receiver blocks.
 	 */
@@ -4252,16 +4262,6 @@ bge_stop(struct bge_softc *sc)
 		BGE_CLRBIT(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE);
 	}
 
-	/* Disable host interrupts. */
-	BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR);
-	bge_writembx(sc, BGE_MBX_IRQ0_LO, 1);
-
-	/*
-	 * Tell firmware we're shutting down.
-	 */
-
-	bge_stop_fw(sc);
-	bge_sig_pre_reset(sc, BGE_RESET_STOP);
 	bge_reset(sc);
 	bge_sig_legacy(sc, BGE_RESET_STOP);
 	bge_sig_post_reset(sc, BGE_RESET_STOP);
From nyan at FreeBSD.org  Thu Nov 19 12:08:17 2009
From: nyan at FreeBSD.org (Takahashi Yoshihiro)
Date: Thu Nov 19 12:08:27 2009
Subject: svn commit: r199520 - stable/7/sys/i386/i386
Message-ID: <200911191208.nAJC8GeS005934@svn.freebsd.org>

Author: nyan
Date: Thu Nov 19 12:08:16 2009
New Revision: 199520
URL: http://svn.freebsd.org/changeset/base/199520

Log:
  MFC: revision 199219
  
    Fix cpu model for PODP5V83.  It is P24T, not P54T.
    Also remove redundant 'Overdrive' word.

Modified:
  stable/7/sys/i386/i386/identcpu.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/i386/i386/identcpu.c
==============================================================================
--- stable/7/sys/i386/i386/identcpu.c	Thu Nov 19 12:07:00 2009	(r199519)
+++ stable/7/sys/i386/i386/identcpu.c	Thu Nov 19 12:08:16 2009	(r199520)
@@ -265,7 +265,7 @@ printcpuinfo(void)
 				        strcat(cpu_model, "/P54C");
 					break;
 				case 0x30:
-				        strcat(cpu_model, "/P54T Overdrive");
+				        strcat(cpu_model, "/P24T");
 					break;
 				case 0x40:
 				        strcat(cpu_model, "/P55C");
From np at FreeBSD.org  Thu Nov 19 20:30:19 2009
From: np at FreeBSD.org (Navdeep Parhar)
Date: Thu Nov 19 20:30:35 2009
Subject: svn commit: r199544 - stable/7/sys/dev/cxgb
Message-ID: <200911192030.nAJKUIdc018121@svn.freebsd.org>

Author: np
Date: Thu Nov 19 20:30:18 2009
New Revision: 199544
URL: http://svn.freebsd.org/changeset/base/199544

Log:
  Fix cxgb(4)'s LRO in stable/7
  
  Submitted by:	matthew.fleming at isilon.com
  Reviewed by:	gnn

Modified:
  stable/7/sys/dev/cxgb/cxgb_main.c

Modified: stable/7/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- stable/7/sys/dev/cxgb/cxgb_main.c	Thu Nov 19 19:35:15 2009	(r199543)
+++ stable/7/sys/dev/cxgb/cxgb_main.c	Thu Nov 19 20:30:18 2009	(r199544)
@@ -981,13 +981,6 @@ cxgb_makedev(struct port_info *pi)
 	return (0);
 }
 
-#ifndef LRO_SUPPORTED
-#ifdef IFCAP_LRO
-#undef IFCAP_LRO
-#endif
-#define IFCAP_LRO 0x0
-#endif
-
 #ifdef TSO_SUPPORTED
 #define CXGB_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO)
 /* Don't enable TSO6 yet */
@@ -1994,7 +1987,6 @@ cxgb_set_mtu(struct port_info *p, int mt
 	return (error);
 }
 
-#ifdef LRO_SUPPORTED
 /*
  * Mark lro enabled or disabled in all qsets for this port
  */
@@ -2012,7 +2004,6 @@ cxgb_set_lro(struct port_info *p, int en
 	}
 	return (0);
 }
-#endif
 
 static int
 cxgb_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data)
@@ -2105,14 +2096,14 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l
 				error = EINVAL;
 			}
 		}
-#ifdef LRO_SUPPORTED
+
 		if (mask & IFCAP_LRO) {
 			ifp->if_capenable ^= IFCAP_LRO;
 
 			/* Safe to do this even if cxgb_up not called yet */
 			cxgb_set_lro(p, ifp->if_capenable & IFCAP_LRO);
 		}
-#endif
+
 		if (mask & IFCAP_VLAN_HWTAGGING) {
 			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
 			reinit = ifp->if_drv_flags & IFF_DRV_RUNNING;
From edwin at FreeBSD.org  Thu Nov 19 20:40:52 2009
From: edwin at FreeBSD.org (Edwin Groothuis)
Date: Thu Nov 19 20:41:09 2009
Subject: svn commit: r199546 - stable/7/share/zoneinfo
Message-ID: <200911192040.nAJKeqN8018507@svn.freebsd.org>

Author: edwin
Date: Thu Nov 19 20:40:52 2009
New Revision: 199546
URL: http://svn.freebsd.org/changeset/base/199546

Log:
  MFC of r199336
  MFV of tzdata2009s, r199334
  
  - Fix (harmless) typo in the definitions of Antarctica/David
  - Fiji will go into DST from 29 November 2009 to 25 April 2010.

Modified:
  stable/7/share/zoneinfo/antarctica
  stable/7/share/zoneinfo/australasia
Directory Properties:
  stable/7/share/zoneinfo/   (props changed)

Modified: stable/7/share/zoneinfo/antarctica
==============================================================================
--- stable/7/share/zoneinfo/antarctica	Thu Nov 19 20:40:11 2009	(r199545)
+++ stable/7/share/zoneinfo/antarctica	Thu Nov 19 20:40:52 2009	(r199546)
@@ -1,5 +1,5 @@
 # 
-# @(#)antarctica	8.6
+# @(#)antarctica	8.7
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -106,7 +106,7 @@ Zone Antarctica/Casey	0	-	zzz	1969
 Zone Antarctica/Davis	0	-	zzz	1957 Jan 13
 			7:00	-	DAVT	1964 Nov # Davis Time
 			0	-	zzz	1969 Feb
-			7:00	-	DAVT	2009 Oct 18 2:0
+			7:00	-	DAVT	2009 Oct 18 2:00
 			5:00	-	DAVT
 Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
 			6:00	-	MAWT	2009 Oct 18 2:00

Modified: stable/7/share/zoneinfo/australasia
==============================================================================
--- stable/7/share/zoneinfo/australasia	Thu Nov 19 20:40:11 2009	(r199545)
+++ stable/7/share/zoneinfo/australasia	Thu Nov 19 20:40:52 2009	(r199546)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.14
+# @(#)australasia	8.15
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -248,9 +248,30 @@ Zone	Indian/Cocos	6:27:40	-	LMT	1900
 			6:30	-	CCT	# Cocos Islands Time
 
 # Fiji
+# From Alexander Krivenyshev (2009-11-10):
+# According to Fiji Broadcasting Corporation,  Fiji plans to re-introduce DST
+# from November 29th 2009  to April 25th 2010.
+#
+# "Daylight savings to commence this month"
+# 
+# http://www.radiofiji.com.fj/fullstory.php?id=23719
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_fiji01.html
+# 
+
+# From Steffen Thorsen (2009-11-10):
+# The Fiji Government has posted some more details about the approved
+# amendments:
+# 
+# http://www.fiji.gov.fj/publish/page_16198.shtml
+# 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	S
 Rule	Fiji	1999	2000	-	Feb	lastSun	3:00	0	-
+Rule	Fiji	2009	only	-	Nov	29	2:00	1:00	S
+Rule	Fiji	2010	only	-	Apr	25	3:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:53:40 -	LMT	1915 Oct 26	# Suva
 			12:00	Fiji	FJ%sT	# Fiji Time
From tuexen at FreeBSD.org  Thu Nov 19 22:59:35 2009
From: tuexen at FreeBSD.org (Michael Tuexen)
Date: Thu Nov 19 22:59:52 2009
Subject: svn commit: r199562 - stable/7/sys/netinet
Message-ID: <200911192259.nAJMxZBc022613@svn.freebsd.org>

Author: tuexen
Date: Thu Nov 19 22:59:35 2009
New Revision: 199562
URL: http://svn.freebsd.org/changeset/base/199562

Log:
  MFC 199477
  Fix a bug where the system panics when a SHUTDOWN is received with an
  illegal TSN.
  This bug was reported by Irene Ruengeler.
  
  Approved by: rrs (mentor)

Modified:
  stable/7/sys/netinet/sctp_input.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/netinet/sctp_input.c
==============================================================================
--- stable/7/sys/netinet/sctp_input.c	Thu Nov 19 22:53:41 2009	(r199561)
+++ stable/7/sys/netinet/sctp_input.c	Thu Nov 19 22:59:35 2009	(r199562)
@@ -816,6 +816,9 @@ sctp_handle_shutdown(struct sctp_shutdow
 		return;
 	} else {
 		sctp_update_acked(stcb, cp, net, abort_flag);
+		if (*abort_flag) {
+			return;
+		}
 	}
 	if (asoc->control_pdapi) {
 		/*
From brueffer at FreeBSD.org  Fri Nov 20 07:00:41 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Fri Nov 20 07:00:57 2009
Subject: svn commit: r199569 - stable/7/lib/libc/sys
Message-ID: <200911200700.nAK70f1v032314@svn.freebsd.org>

Author: brueffer
Date: Fri Nov 20 07:00:40 2009
New Revision: 199569
URL: http://svn.freebsd.org/changeset/base/199569

Log:
  MFC: r199255, r199257
  
  Improved the manpage description.  The committed wording
  was provided by jhb.
  
  Remove a note about vfork(4) going to be eliminated, it's here to stay.

Modified:
  stable/7/lib/libc/sys/vfork.2
Directory Properties:
  stable/7/lib/libc/   (props changed)

Modified: stable/7/lib/libc/sys/vfork.2
==============================================================================
--- stable/7/lib/libc/sys/vfork.2	Fri Nov 20 06:55:35 2009	(r199568)
+++ stable/7/lib/libc/sys/vfork.2	Fri Nov 20 07:00:40 2009	(r199569)
@@ -28,12 +28,12 @@
 .\"     @(#)vfork.2	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 4, 1993
+.Dd November 13, 2009
 .Dt VFORK 2
 .Os
 .Sh NAME
 .Nm vfork
-.Nd spawn new process in a virtual memory efficient way
+.Nd create a new process without copying the address space
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -113,14 +113,6 @@ The
 system call appeared in
 .Bx 2.9 .
 .Sh BUGS
-This system call will be eliminated when proper system sharing
-mechanisms are implemented.
-Users should not depend on the memory
-sharing semantics of
-.Fn vfork
-as it will, in that case, be made synonymous to
-.Xr fork 2 .
-.Pp
 To avoid a possible deadlock situation,
 processes that are children in the middle
 of a
From brueffer at FreeBSD.org  Fri Nov 20 07:19:47 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Fri Nov 20 07:19:58 2009
Subject: svn commit: r199572 - stable/7/share/man/man3
Message-ID: <200911200719.nAK7JkpQ032860@svn.freebsd.org>

Author: brueffer
Date: Fri Nov 20 07:19:46 2009
New Revision: 199572
URL: http://svn.freebsd.org/changeset/base/199572

Log:
  MFC: r199349
  
  Fix typo.

Modified:
  stable/7/share/man/man3/queue.3
Directory Properties:
  stable/7/share/man/man3/   (props changed)

Modified: stable/7/share/man/man3/queue.3
==============================================================================
--- stable/7/share/man/man3/queue.3	Fri Nov 20 07:19:09 2009	(r199571)
+++ stable/7/share/man/man3/queue.3	Fri Nov 20 07:19:46 2009	(r199572)
@@ -229,7 +229,7 @@ O(1) removal of any entry in the list.
 However:
 .Bl -enum -compact -offset indent
 .It
-Each elements requires two pointers rather than one.
+Each element requires two pointers rather than one.
 .It
 Code size and execution time of operations (except for removal) is about
 twice that of the singly-linked data-structures.
From rnoland at FreeBSD.org  Sat Nov 21 14:54:46 2009
From: rnoland at FreeBSD.org (Robert Noland)
Date: Sat Nov 21 14:55:04 2009
Subject: svn commit: r199633 - stable/7/sys/geom/part
Message-ID: <200911211454.nALEsk8n082758@svn.freebsd.org>

Author: rnoland
Date: Sat Nov 21 14:54:45 2009
New Revision: 199633
URL: http://svn.freebsd.org/changeset/base/199633

Log:
  MFC r199017,199228
  
  Fix handling of GPT headers when size is > 92 bytes.
  
  This should address reading GPT headers written by opensolaris.

Modified:
  stable/7/sys/geom/part/g_part_gpt.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/geom/part/g_part_gpt.c
==============================================================================
--- stable/7/sys/geom/part/g_part_gpt.c	Sat Nov 21 14:54:35 2009	(r199632)
+++ stable/7/sys/geom/part/g_part_gpt.c	Sat Nov 21 14:54:45 2009	(r199633)
@@ -73,7 +73,7 @@ enum gpt_state {
 struct g_part_gpt_table {
 	struct g_part_table	base;
 	u_char			mbr[MBRSIZE];
-	struct gpt_hdr		hdr;
+	struct gpt_hdr		*hdr;
 	quad_t			lba[GPT_ELT_COUNT];
 	enum gpt_state		state[GPT_ELT_COUNT];
 };
@@ -142,13 +142,12 @@ static struct uuid gpt_uuid_linux_swap =
 static struct uuid gpt_uuid_mbr = GPT_ENT_TYPE_MBR;
 static struct uuid gpt_uuid_unused = GPT_ENT_TYPE_UNUSED;
 
-static void
+static struct gpt_hdr *
 gpt_read_hdr(struct g_part_gpt_table *table, struct g_consumer *cp,
-    enum gpt_elt elt, struct gpt_hdr *hdr)
+    enum gpt_elt elt)
 {
-	struct uuid uuid;
+	struct gpt_hdr *buf, *hdr;
 	struct g_provider *pp;
-	char *buf;
 	quad_t lba, last;
 	int error;
 	uint32_t crc, sz;
@@ -160,63 +159,75 @@ gpt_read_hdr(struct g_part_gpt_table *ta
 	buf = g_read_data(cp, table->lba[elt] * pp->sectorsize, pp->sectorsize,
 	    &error);
 	if (buf == NULL)
-		return;
-	bcopy(buf, hdr, sizeof(*hdr));
-	if (memcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) != 0)
-		return;
+		return (NULL);
+	hdr = NULL;
+	if (memcmp(buf->hdr_sig, GPT_HDR_SIG, sizeof(buf->hdr_sig)) != 0)
+		goto fail;
 
 	table->state[elt] = GPT_STATE_CORRUPT;
-	sz = le32toh(hdr->hdr_size);
+	sz = le32toh(buf->hdr_size);
 	if (sz < 92 || sz > pp->sectorsize)
-		return;
-	crc = le32toh(hdr->hdr_crc_self);
-	hdr->hdr_crc_self = 0;
-	if (crc32(hdr, sz) != crc)
-		return;
+		goto fail;
+
+	hdr = g_malloc(sz, M_WAITOK | M_ZERO);
+	bcopy(buf, hdr, sz);
 	hdr->hdr_size = sz;
+
+	crc = le32toh(buf->hdr_crc_self);
+	buf->hdr_crc_self = 0;
+	if (crc32(buf, sz) != crc)
+		goto fail;
 	hdr->hdr_crc_self = crc;
 
 	table->state[elt] = GPT_STATE_INVALID;
-	hdr->hdr_revision = le32toh(hdr->hdr_revision);
+	hdr->hdr_revision = le32toh(buf->hdr_revision);
 	if (hdr->hdr_revision < 0x00010000)
-		return;
-	hdr->hdr_lba_self = le64toh(hdr->hdr_lba_self);
+		goto fail;
+	hdr->hdr_lba_self = le64toh(buf->hdr_lba_self);
 	if (hdr->hdr_lba_self != table->lba[elt])
-		return;
-	hdr->hdr_lba_alt = le64toh(hdr->hdr_lba_alt);
+		goto fail;
+	hdr->hdr_lba_alt = le64toh(buf->hdr_lba_alt);
 
 	/* Check the managed area. */
-	hdr->hdr_lba_start = le64toh(hdr->hdr_lba_start);
+	hdr->hdr_lba_start = le64toh(buf->hdr_lba_start);
 	if (hdr->hdr_lba_start < 2 || hdr->hdr_lba_start >= last)
-		return;
-	hdr->hdr_lba_end = le64toh(hdr->hdr_lba_end);
+		goto fail;
+	hdr->hdr_lba_end = le64toh(buf->hdr_lba_end);
 	if (hdr->hdr_lba_end < hdr->hdr_lba_start || hdr->hdr_lba_end >= last)
-		return;
+		goto fail;
 
 	/* Check the table location and size of the table. */
-	hdr->hdr_entries = le32toh(hdr->hdr_entries);
-	hdr->hdr_entsz = le32toh(hdr->hdr_entsz);
+	hdr->hdr_entries = le32toh(buf->hdr_entries);
+	hdr->hdr_entsz = le32toh(buf->hdr_entsz);
 	if (hdr->hdr_entries == 0 || hdr->hdr_entsz < 128 ||
 	    (hdr->hdr_entsz & 7) != 0)
-		return;
-	hdr->hdr_lba_table = le64toh(hdr->hdr_lba_table);
+		goto fail;
+	hdr->hdr_lba_table = le64toh(buf->hdr_lba_table);
 	if (hdr->hdr_lba_table < 2 || hdr->hdr_lba_table >= last)
-		return;
+		goto fail;
 	if (hdr->hdr_lba_table >= hdr->hdr_lba_start &&
 	    hdr->hdr_lba_table <= hdr->hdr_lba_end)
-		return;
+		goto fail;
 	lba = hdr->hdr_lba_table +
 	    (hdr->hdr_entries * hdr->hdr_entsz + pp->sectorsize - 1) /
 	    pp->sectorsize - 1;
 	if (lba >= last)
-		return;
+		goto fail;
 	if (lba >= hdr->hdr_lba_start && lba <= hdr->hdr_lba_end)
-		return;
+		goto fail;
 
 	table->state[elt] = GPT_STATE_OK;
-	le_uuid_dec(&hdr->hdr_uuid, &uuid);
-	hdr->hdr_uuid = uuid;
-	hdr->hdr_crc_table = le32toh(hdr->hdr_crc_table);
+	le_uuid_dec(&buf->hdr_uuid, &hdr->hdr_uuid);
+	hdr->hdr_crc_table = le32toh(buf->hdr_crc_table);
+
+	g_free(buf);
+	return (hdr);
+
+ fail:
+	if (hdr != NULL)
+		g_free(hdr);
+	g_free(buf);
+	return (NULL);
 }
 
 static struct gpt_ent *
@@ -229,6 +240,9 @@ gpt_read_tbl(struct g_part_gpt_table *ta
 	unsigned int idx, sectors, tblsz;
 	int error;
 
+	if (hdr == NULL)
+		return (NULL);
+
 	pp = cp->provider;
 	table->lba[elt] = hdr->hdr_lba_table;
 
@@ -270,6 +284,9 @@ static int
 gpt_matched_hdrs(struct gpt_hdr *pri, struct gpt_hdr *sec)
 {
 
+	if (pri == NULL || sec == NULL)
+		return (0);
+
 	if (!EQUUID(&pri->hdr_uuid, &sec->hdr_uuid))
 		return (0);
 	return ((pri->hdr_revision == sec->hdr_revision &&
@@ -417,17 +434,20 @@ g_part_gpt_create(struct g_part_table *b
 	table->lba[GPT_ELT_SECHDR] = last;
 	table->lba[GPT_ELT_SECTBL] = last - tblsz;
 
-	bcopy(GPT_HDR_SIG, table->hdr.hdr_sig, sizeof(table->hdr.hdr_sig));
-	table->hdr.hdr_revision = GPT_HDR_REVISION;
-	table->hdr.hdr_size = offsetof(struct gpt_hdr, padding);
-	table->hdr.hdr_lba_start = 2 + tblsz;
-	table->hdr.hdr_lba_end = last - tblsz - 1;
-	kern_uuidgen(&table->hdr.hdr_uuid, 1);
-	table->hdr.hdr_entries = basetable->gpt_entries;
-	table->hdr.hdr_entsz = sizeof(struct gpt_ent);
+	/* Allocate space for the header */
+	table->hdr = g_malloc(sizeof(struct gpt_hdr), M_WAITOK | M_ZERO);
+
+	bcopy(GPT_HDR_SIG, table->hdr->hdr_sig, sizeof(table->hdr->hdr_sig));
+	table->hdr->hdr_revision = GPT_HDR_REVISION;
+	table->hdr->hdr_size = offsetof(struct gpt_hdr, padding);
+	table->hdr->hdr_lba_start = 2 + tblsz;
+	table->hdr->hdr_lba_end = last - tblsz - 1;
+	kern_uuidgen(&table->hdr->hdr_uuid, 1);
+	table->hdr->hdr_entries = basetable->gpt_entries;
+	table->hdr->hdr_entsz = sizeof(struct gpt_ent);
 
-	basetable->gpt_first = table->hdr.hdr_lba_start;
-	basetable->gpt_last = table->hdr.hdr_lba_end;
+	basetable->gpt_first = table->hdr->hdr_lba_start;
+	basetable->gpt_last = table->hdr->hdr_lba_end;
 	return (0);
 }
 
@@ -572,7 +592,7 @@ g_part_gpt_probe(struct g_part_table *ta
 static int
 g_part_gpt_read(struct g_part_table *basetable, struct g_consumer *cp)
 {
-	struct gpt_hdr prihdr, sechdr;
+	struct gpt_hdr *prihdr, *sechdr;
 	struct gpt_ent *tbl, *pritbl, *sectbl;
 	struct g_provider *pp;
 	struct g_part_gpt_table *table;
@@ -591,18 +611,18 @@ g_part_gpt_read(struct g_part_table *bas
 	g_free(buf);
 
 	/* Read the primary header and table. */
-	gpt_read_hdr(table, cp, GPT_ELT_PRIHDR, &prihdr);
+	prihdr = gpt_read_hdr(table, cp, GPT_ELT_PRIHDR);
 	if (table->state[GPT_ELT_PRIHDR] == GPT_STATE_OK) {
-		pritbl = gpt_read_tbl(table, cp, GPT_ELT_PRITBL, &prihdr);
+		pritbl = gpt_read_tbl(table, cp, GPT_ELT_PRITBL, prihdr);
 	} else {
 		table->state[GPT_ELT_PRITBL] = GPT_STATE_MISSING;
 		pritbl = NULL;
 	}
 
 	/* Read the secondary header and table. */
-	gpt_read_hdr(table, cp, GPT_ELT_SECHDR, &sechdr);
+	sechdr = gpt_read_hdr(table, cp, GPT_ELT_SECHDR);
 	if (table->state[GPT_ELT_SECHDR] == GPT_STATE_OK) {
-		sectbl = gpt_read_tbl(table, cp, GPT_ELT_SECTBL, &sechdr);
+		sectbl = gpt_read_tbl(table, cp, GPT_ELT_SECTBL, sechdr);
 	} else {
 		table->state[GPT_ELT_SECTBL] = GPT_STATE_MISSING;
 		sectbl = NULL;
@@ -625,13 +645,17 @@ g_part_gpt_read(struct g_part_table *bas
 	 */
 	if (table->state[GPT_ELT_PRIHDR] == GPT_STATE_OK &&
 	    table->state[GPT_ELT_SECHDR] == GPT_STATE_OK &&
-	    !gpt_matched_hdrs(&prihdr, &sechdr)) {
+	    !gpt_matched_hdrs(prihdr, sechdr)) {
 		if (table->state[GPT_ELT_PRITBL] == GPT_STATE_OK) {
 			table->state[GPT_ELT_SECHDR] = GPT_STATE_INVALID;
 			table->state[GPT_ELT_SECTBL] = GPT_STATE_MISSING;
+			g_free(sechdr);
+			sechdr = NULL;
 		} else {
 			table->state[GPT_ELT_PRIHDR] = GPT_STATE_INVALID;
 			table->state[GPT_ELT_PRITBL] = GPT_STATE_MISSING;
+			g_free(prihdr);
+			prihdr = NULL;
 		}
 	}
 
@@ -641,6 +665,8 @@ g_part_gpt_read(struct g_part_table *bas
 		printf("GEOM: %s: using the secondary instead -- recovery "
 		    "strongly advised.\n", pp->name);
 		table->hdr = sechdr;
+		if (prihdr != NULL)
+			g_free(prihdr);
 		tbl = sectbl;
 		if (pritbl != NULL)
 			g_free(pritbl);
@@ -652,14 +678,16 @@ g_part_gpt_read(struct g_part_table *bas
 			    "suggested.\n", pp->name);
 		}
 		table->hdr = prihdr;
+		if (sechdr != NULL)
+			g_free(sechdr);
 		tbl = pritbl;
 		if (sectbl != NULL)
 			g_free(sectbl);
 	}
 
-	basetable->gpt_first = table->hdr.hdr_lba_start;
-	basetable->gpt_last = table->hdr.hdr_lba_end;
-	basetable->gpt_entries = table->hdr.hdr_entries;
+	basetable->gpt_first = table->hdr->hdr_lba_start;
+	basetable->gpt_last = table->hdr->hdr_lba_end;
+	basetable->gpt_entries = table->hdr->hdr_entries;
 
 	for (index = basetable->gpt_entries - 1; index >= 0; index--) {
 		if (EQUUID(&tbl[index].ent_type, &gpt_uuid_unused))
@@ -717,7 +745,7 @@ g_part_gpt_write(struct g_part_table *ba
 
 	pp = cp->provider;
 	table = (struct g_part_gpt_table *)basetable;
-	tlbsz = (table->hdr.hdr_entries * table->hdr.hdr_entsz +
+	tlbsz = (table->hdr->hdr_entries * table->hdr->hdr_entsz +
 	    pp->sectorsize - 1) / pp->sectorsize;
 
 	/* Write the PMBR */
@@ -731,21 +759,21 @@ g_part_gpt_write(struct g_part_table *ba
 	/* Allocate space for the header and entries. */
 	buf = g_malloc((tlbsz + 1) * pp->sectorsize, M_WAITOK | M_ZERO);
 
-	memcpy(buf, table->hdr.hdr_sig, sizeof(table->hdr.hdr_sig));
-	le32enc(buf + 8, table->hdr.hdr_revision);
-	le32enc(buf + 12, table->hdr.hdr_size);
-	le64enc(buf + 40, table->hdr.hdr_lba_start);
-	le64enc(buf + 48, table->hdr.hdr_lba_end);
-	le_uuid_enc(buf + 56, &table->hdr.hdr_uuid);
-	le32enc(buf + 80, table->hdr.hdr_entries);
-	le32enc(buf + 84, table->hdr.hdr_entsz);
+	memcpy(buf, table->hdr->hdr_sig, sizeof(table->hdr->hdr_sig));
+	le32enc(buf + 8, table->hdr->hdr_revision);
+	le32enc(buf + 12, table->hdr->hdr_size);
+	le64enc(buf + 40, table->hdr->hdr_lba_start);
+	le64enc(buf + 48, table->hdr->hdr_lba_end);
+	le_uuid_enc(buf + 56, &table->hdr->hdr_uuid);
+	le32enc(buf + 80, table->hdr->hdr_entries);
+	le32enc(buf + 84, table->hdr->hdr_entsz);
 
 	LIST_FOREACH(baseentry, &basetable->gpt_entry, gpe_entry) {
 		if (baseentry->gpe_deleted)
 			continue;
 		entry = (struct g_part_gpt_entry *)baseentry;
 		index = baseentry->gpe_index - 1;
-		bp = buf + pp->sectorsize + table->hdr.hdr_entsz * index;
+		bp = buf + pp->sectorsize + table->hdr->hdr_entsz * index;
 		le_uuid_enc(bp, &entry->ent.ent_type);
 		le_uuid_enc(bp + 16, &entry->ent.ent_uuid);
 		le64enc(bp + 32, entry->ent.ent_lba_start);
@@ -756,7 +784,7 @@ g_part_gpt_write(struct g_part_table *ba
 	}
 
 	crc = crc32(buf + pp->sectorsize,
-	    table->hdr.hdr_entries * table->hdr.hdr_entsz);
+	    table->hdr->hdr_entries * table->hdr->hdr_entsz);
 	le32enc(buf + 88, crc);
 
 	/* Write primary meta-data. */
@@ -764,7 +792,7 @@ g_part_gpt_write(struct g_part_table *ba
 	le64enc(buf + 24, table->lba[GPT_ELT_PRIHDR]);	/* hdr_lba_self. */
 	le64enc(buf + 32, table->lba[GPT_ELT_SECHDR]);	/* hdr_lba_alt. */
 	le64enc(buf + 72, table->lba[GPT_ELT_PRITBL]);	/* hdr_lba_table. */
-	crc = crc32(buf, table->hdr.hdr_size);
+	crc = crc32(buf, table->hdr->hdr_size);
 	le32enc(buf + 16, crc);
 
 	error = g_write_data(cp, table->lba[GPT_ELT_PRITBL] * pp->sectorsize,
@@ -781,7 +809,7 @@ g_part_gpt_write(struct g_part_table *ba
 	le64enc(buf + 24, table->lba[GPT_ELT_SECHDR]);	/* hdr_lba_self. */
 	le64enc(buf + 32, table->lba[GPT_ELT_PRIHDR]);	/* hdr_lba_alt. */
 	le64enc(buf + 72, table->lba[GPT_ELT_SECTBL]);	/* hdr_lba_table. */
-	crc = crc32(buf, table->hdr.hdr_size);
+	crc = crc32(buf, table->hdr->hdr_size);
 	le32enc(buf + 16, crc);
 
 	error = g_write_data(cp, table->lba[GPT_ELT_SECTBL] * pp->sectorsize,
From rnoland at FreeBSD.org  Sat Nov 21 15:04:02 2009
From: rnoland at FreeBSD.org (Robert Noland)
Date: Sat Nov 21 15:04:14 2009
Subject: svn commit: r199635 - in stable/7/sys: boot/i386/zfsboot boot/zfs
	cddl/boot/zfs
Message-ID: <200911211504.nALF41Xa083148@svn.freebsd.org>

Author: rnoland
Date: Sat Nov 21 15:04:01 2009
New Revision: 199635
URL: http://svn.freebsd.org/changeset/base/199635

Log:
  MFC 198420
  
    Correct some issues with zfs boot.
  
     - Teach it to read gang blocks. (essentially untested)
       If you see "ZFS: gang block detected!", please let
       me know, so we can either remove the printf if it
       works, or fix it if it doesn't.
  
     - If multiple partitions exist on a disk, probe them all.
       We also need to reset dsk->start to 0 to read the right
       sector here.
  
     - With GPT, we can have 128 partitions.
  
     - If the bootfs property has ever been set on a pool
       it seems that it never goes away.  zpool won't allow
       you to add to the pool with the bootfs property set.
       However, if you clear the property back to default
       we end up getting 0 for the object number and read
       a bogus block pointer and fail to boot.
  
     - Fix some error printfs. The printf in the loader is
       only capable of c,s and u formats.
  
     - Teach printf how to display %llu

Modified:
  stable/7/sys/boot/i386/zfsboot/zfsboot.c
  stable/7/sys/boot/zfs/zfs.c
  stable/7/sys/boot/zfs/zfsimpl.c
  stable/7/sys/cddl/boot/zfs/zfsimpl.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/boot/i386/zfsboot/zfsboot.c
==============================================================================
--- stable/7/sys/boot/i386/zfsboot/zfsboot.c	Sat Nov 21 15:02:35 2009	(r199634)
+++ stable/7/sys/boot/i386/zfsboot/zfsboot.c	Sat Nov 21 15:04:01 2009	(r199635)
@@ -474,6 +474,7 @@ probe_drive(struct dsk *dsk, spa_t **spa
     slba = hdr.hdr_lba_table;
     elba = slba + hdr.hdr_entries / entries_per_sec;
     while (slba < elba) {
+	dsk->start = 0;
 	if (drvread(dsk, sec, slba, 1))
 	    return;
 	for (part = 0; part < entries_per_sec; part++) {
@@ -494,7 +495,6 @@ probe_drive(struct dsk *dsk, spa_t **spa
 		     */
 		    dsk = copy_dsk(dsk);
 		}
-		break;
 	    }
 	}
 	slba++;
@@ -857,12 +857,13 @@ static void
 printf(const char *fmt,...)
 {
     va_list ap;
-    char buf[10];
+    char buf[20];
     char *s;
-    unsigned u;
+    unsigned long long u;
     int c;
     int minus;
     int prec;
+    int l;
     int len;
     int pad;
 
@@ -871,6 +872,7 @@ printf(const char *fmt,...)
 	if (c == '%') {
 	    minus = 0;
 	    prec = 0;
+	    l = 0;
 	nextfmt:
 	    c = *fmt++;
 	    switch (c) {
@@ -892,6 +894,9 @@ printf(const char *fmt,...)
 	    case 'c':
 		putchar(va_arg(ap, int));
 		continue;
+	    case 'l':
+		l++;
+		goto nextfmt;
 	    case 's':
 		s = va_arg(ap, char *);
 		if (prec) {
@@ -914,7 +919,17 @@ printf(const char *fmt,...)
 		}
 		continue;
 	    case 'u':
-		u = va_arg(ap, unsigned);
+		switch (l) {
+		case 2:
+		    u = va_arg(ap, unsigned long long);
+		    break;
+		case 1:
+		    u = va_arg(ap, unsigned long);
+		    break;
+		default:
+		    u = va_arg(ap, unsigned);
+		    break;
+		}
 		s = buf;
 		do
 		    *s++ = '0' + u % 10U;

Modified: stable/7/sys/boot/zfs/zfs.c
==============================================================================
--- stable/7/sys/boot/zfs/zfs.c	Sat Nov 21 15:02:35 2009	(r199634)
+++ stable/7/sys/boot/zfs/zfs.c	Sat Nov 21 15:04:01 2009	(r199635)
@@ -100,7 +100,7 @@ zfs_open(const char *upath, struct open_
 	f->f_fsdata = (void *)fp;
 
 	if (spa->spa_root_objset.os_type != DMU_OST_ZFS) {
-		printf("Unexpected object set type %lld\n",
+		printf("Unexpected object set type %llu\n",
 		    spa->spa_root_objset.os_type);
 		rc = EIO;
 		goto out;
@@ -413,7 +413,7 @@ zfs_dev_init(void) 
 		if (vdev_probe(vdev_read, (void*) (uintptr_t) fd, 0))
 			close(fd);
 
-		for (slice = 1; slice <= 4; slice++) {
+		for (slice = 1; slice <= 128; slice++) {
 			sprintf(devname, "disk%dp%d:", unit, slice);
 			fd = open(devname, O_RDONLY);
 			if (fd == -1) {

Modified: stable/7/sys/boot/zfs/zfsimpl.c
==============================================================================
--- stable/7/sys/boot/zfs/zfsimpl.c	Sat Nov 21 15:02:35 2009	(r199634)
+++ stable/7/sys/boot/zfs/zfsimpl.c	Sat Nov 21 15:04:01 2009	(r199635)
@@ -53,6 +53,8 @@ static char *zfs_temp_buf, *zfs_temp_end
 
 #define TEMP_SIZE	(1*SPA_MAXBLOCKSIZE)
 
+static int zio_read(spa_t *spa, const blkptr_t *bp, void *buf);
+
 static void
 zfs_init(void)
 {
@@ -897,6 +899,33 @@ ilog2(int n)
 }
 
 static int
+zio_read_gang(spa_t *spa, const blkptr_t *bp, const dva_t *dva, void *buf)
+{
+	zio_gbh_phys_t zio_gb;
+	vdev_t *vdev;
+	int vdevid;
+	off_t offset;
+	int i;
+
+	vdevid = DVA_GET_VDEV(dva);
+	offset = DVA_GET_OFFSET(dva);
+	STAILQ_FOREACH(vdev, &spa->spa_vdevs, v_childlink)
+		if (vdev->v_id == vdevid)
+			break;
+	if (!vdev || !vdev->v_read)
+		return (EIO);
+	if (vdev->v_read(vdev, bp, &zio_gb, offset, SPA_GANGBLOCKSIZE))
+		return (EIO);
+
+	for (i = 0; i < SPA_GBH_NBLKPTRS; i++) {
+		if (zio_read(spa, &zio_gb.zg_blkptr[i], buf))
+			return (EIO);
+	}
+ 
+	return (0);
+}
+
+static int
 zio_read(spa_t *spa, const blkptr_t *bp, void *buf)
 {
 	int cpfunc = BP_GET_COMPRESS(bp);
@@ -920,20 +949,27 @@ zio_read(spa_t *spa, const blkptr_t *bp,
 		if (!dva->dva_word[0] && !dva->dva_word[1])
 			continue;
 
-		vdevid = DVA_GET_VDEV(dva);
-		offset = DVA_GET_OFFSET(dva);
-		STAILQ_FOREACH(vdev, &spa->spa_vdevs, v_childlink)
-			if (vdev->v_id == vdevid)
-				break;
-		if (!vdev || !vdev->v_read)
-			continue;
-		if (vdev->v_read(vdev, bp, pbuf, offset, psize))
-			continue;
+		if (DVA_GET_GANG(dva)) {
+			printf("ZFS: gang block detected!\n");
+			if (zio_read_gang(spa, bp, dva, buf))
+				return (EIO); 
+		} else {
+			vdevid = DVA_GET_VDEV(dva);
+			offset = DVA_GET_OFFSET(dva);
+			STAILQ_FOREACH(vdev, &spa->spa_vdevs, v_childlink)
+				if (vdev->v_id == vdevid)
+					break;
+			if (!vdev || !vdev->v_read) {
+				continue;
+			}
+			if (vdev->v_read(vdev, bp, pbuf, offset, psize))
+				continue;
 
-		if (cpfunc != ZIO_COMPRESS_OFF) {
-			if (zio_decompress_data(cpfunc, pbuf, psize,
-				buf, lsize))
-				return (EIO);
+			if (cpfunc != ZIO_COMPRESS_OFF) {
+				if (zio_decompress_data(cpfunc, pbuf, psize,
+				    buf, lsize))
+					return (EIO);
+			}
 		}
 
 		return (0);
@@ -1331,13 +1367,13 @@ zfs_mount_dataset(spa_t *spa, uint64_t o
 	dsl_dataset_phys_t *ds;
 
 	if (objset_get_dnode(spa, &spa->spa_mos, objnum, &dataset)) {
-		printf("ZFS: can't find dataset %lld\n", objnum);
+		printf("ZFS: can't find dataset %llu\n", objnum);
 		return (EIO);
 	}
 
 	ds = (dsl_dataset_phys_t *) &dataset.dn_bonus;
 	if (zio_read(spa, &ds->ds_bp, objset)) {
-		printf("ZFS: can't read object set for dataset %lld\n", objnum);
+		printf("ZFS: can't read object set for dataset %llu\n", objnum);
 		return (EIO);
 	}
 
@@ -1367,7 +1403,8 @@ zfs_mount_root(spa_t *spa, objset_phys_t
 	 */
 	if (zap_lookup(spa, &dir, DMU_POOL_PROPS, &props) == 0
 	     && objset_get_dnode(spa, &spa->spa_mos, props, &propdir) == 0
-	     && zap_lookup(spa, &propdir, "bootfs", &bootfs) == 0)
+	     && zap_lookup(spa, &propdir, "bootfs", &bootfs) == 0
+	     && bootfs != 0)
 		return zfs_mount_dataset(spa, bootfs, objset);
 
 	/*
@@ -1425,7 +1462,7 @@ zfs_lookup(spa_t *spa, const char *upath
 	int symlinks_followed = 0;
 
 	if (spa->spa_root_objset.os_type != DMU_OST_ZFS) {
-		printf("ZFS: unexpected object set type %lld\n",
+		printf("ZFS: unexpected object set type %llu\n",
 		       spa->spa_root_objset.os_type);
 		return (EIO);
 	}

Modified: stable/7/sys/cddl/boot/zfs/zfsimpl.h
==============================================================================
--- stable/7/sys/cddl/boot/zfs/zfsimpl.h	Sat Nov 21 15:02:35 2009	(r199634)
+++ stable/7/sys/cddl/boot/zfs/zfsimpl.h	Sat Nov 21 15:04:01 2009	(r199635)
@@ -374,6 +374,24 @@ typedef struct vdev_label {
 #define	VDEV_LABEL_END_SIZE	(2 * sizeof (vdev_label_t))
 #define	VDEV_LABELS		4
 
+/*
+ * Gang block headers are self-checksumming and contain an array
+ * of block pointers.
+ */
+#define SPA_GANGBLOCKSIZE	SPA_MINBLOCKSIZE
+#define SPA_GBH_NBLKPTRS	((SPA_GANGBLOCKSIZE - \
+	sizeof (zio_block_tail_t)) / sizeof (blkptr_t))
+#define SPA_GBH_FILLER		((SPA_GANGBLOCKSIZE - \
+	sizeof (zio_block_tail_t) - \
+	(SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\
+	sizeof (uint64_t))
+
+typedef struct zio_gbh {
+	blkptr_t		zg_blkptr[SPA_GBH_NBLKPTRS];
+	uint64_t		zg_filler[SPA_GBH_FILLER];
+	zio_block_tail_t	zg_tail;
+} zio_gbh_phys_t;
+
 enum zio_checksum {
 	ZIO_CHECKSUM_INHERIT = 0,
 	ZIO_CHECKSUM_ON,
From attilio at FreeBSD.org  Sun Nov 22 23:46:44 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Sun Nov 22 23:46:55 2009
Subject: svn commit: r199682 - stable/7/sys/fs/fifofs
Message-ID: <200911222346.nAMNkiTe033370@svn.freebsd.org>

Author: attilio
Date: Sun Nov 22 23:46:44 2009
New Revision: 199682
URL: http://svn.freebsd.org/changeset/base/199682

Log:
  MFC r199007:
  Fix a memory leak.

Modified:
  stable/7/sys/fs/fifofs/fifo_vnops.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/fs/fifofs/fifo_vnops.c
==============================================================================
--- stable/7/sys/fs/fifofs/fifo_vnops.c	Sun Nov 22 21:58:06 2009	(r199681)
+++ stable/7/sys/fs/fifofs/fifo_vnops.c	Sun Nov 22 23:46:44 2009	(r199682)
@@ -76,6 +76,10 @@ struct fileops fifo_ops_f = {
 /*
  * This structure is associated with the FIFO vnode and stores
  * the state associated with the FIFO.
+ * Notes about locking:
+ *   - fi_readsock and fi_writesock are invariant since init time.
+ *   - fi_readers and fi_writers are vnode lock protected.
+ *   - fi_wgen is fif_mtx lock protected.
  */
 struct fifoinfo {
 	struct socket	*fi_readsock;
@@ -210,14 +214,9 @@ fail1:
 	}
 
 	/*
-	 * General access to fi_readers and fi_writers is protected using
-	 * the vnode lock.
-	 *
-	 * Protect the increment of fi_readers and fi_writers and the
-	 * associated calls to wakeup() with the fifo mutex in addition
-	 * to the vnode lock.  This allows the vnode lock to be dropped
-	 * for the msleep() calls below, and using the fifo mutex with
-	 * msleep() prevents the wakeup from being missed.
+	 * Use the fifo_mtx lock here, in addition to the vnode lock,
+	 * in order to allow vnode lock dropping before msleep() calls
+	 * and still avoiding missed wakeups.
 	 */
 	mtx_lock(&fifo_mtx);
 	if (ap->a_mode & FREAD) {
@@ -235,6 +234,8 @@ fail1:
 	if (ap->a_mode & FWRITE) {
 		if ((ap->a_mode & O_NONBLOCK) && fip->fi_readers == 0) {
 			mtx_unlock(&fifo_mtx);
+			if (fip->fi_writers == 0)
+				fifo_cleanup(vp);
 			return (ENXIO);
 		}
 		fip->fi_writers++;
From attilio at FreeBSD.org  Sun Nov 22 23:51:52 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Sun Nov 22 23:52:04 2009
Subject: svn commit: r199683 - stable/7/sys/kern
Message-ID: <200911222351.nAMNpp5c033502@svn.freebsd.org>

Author: attilio
Date: Sun Nov 22 23:51:51 2009
New Revision: 199683
URL: http://svn.freebsd.org/changeset/base/199683

Log:
  MFC r199209:
  Fix a potential buffer boundaries overflow in devclass_add_device() by
  using all available int lenghts digits for storing the information.

Modified:
  stable/7/sys/kern/subr_bus.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/subr_bus.c
==============================================================================
--- stable/7/sys/kern/subr_bus.c	Sun Nov 22 23:46:44 2009	(r199682)
+++ stable/7/sys/kern/subr_bus.c	Sun Nov 22 23:51:51 2009	(r199683)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1394,7 +1395,7 @@ devclass_add_device(devclass_t dc, devic
 
 	PDEBUG(("%s in devclass %s", DEVICENAME(dev), DEVCLANAME(dc)));
 
-	buflen = snprintf(NULL, 0, "%s%d$", dc->name, dev->unit);
+	buflen = snprintf(NULL, 0, "%s%d$", dc->name, INT_MAX);
 	if (buflen < 0)
 		return (ENOMEM);
 	dev->nameunit = malloc(buflen, M_BUS, M_NOWAIT|M_ZERO);
From attilio at FreeBSD.org  Sun Nov 22 23:54:20 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Sun Nov 22 23:54:26 2009
Subject: svn commit: r199684 - stable/7/usr.bin/kdump
Message-ID: <200911222354.nAMNsKvX033588@svn.freebsd.org>

Author: attilio
Date: Sun Nov 22 23:54:19 2009
New Revision: 199684
URL: http://svn.freebsd.org/changeset/base/199684

Log:
  MFC r199024:
  Use a safety belt for cases where corrupted narg can be passed to the
  ktrsyscall().

Modified:
  stable/7/usr.bin/kdump/kdump.c
Directory Properties:
  stable/7/usr.bin/kdump/   (props changed)

Modified: stable/7/usr.bin/kdump/kdump.c
==============================================================================
--- stable/7/usr.bin/kdump/kdump.c	Sun Nov 22 23:51:51 2009	(r199683)
+++ stable/7/usr.bin/kdump/kdump.c	Sun Nov 22 23:54:19 2009	(r199684)
@@ -802,7 +802,7 @@ ktrsyscall(struct ktr_syscall *ktr)
 				narg--;
 			}
 		}
-		while (narg) {
+		while (narg > 0) {
 			print_number(ip,narg,c);
 		}
 		(void)putchar(')');
From brueffer at FreeBSD.org  Mon Nov 23 09:15:17 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Mon Nov 23 09:15:28 2009
Subject: svn commit: r199702 - stable/7/lib/libc/posix1e
Message-ID: <200911230915.nAN9FG5h047202@svn.freebsd.org>

Author: brueffer
Date: Mon Nov 23 09:15:16 2009
New Revision: 199702
URL: http://svn.freebsd.org/changeset/base/199702

Log:
  MFC: r199317
  
  Fix a memory leak in acl_from_text() in case the conversion succeeded.

Modified:
  stable/7/lib/libc/posix1e/acl_from_text.c
Directory Properties:
  stable/7/lib/libc/   (props changed)

Modified: stable/7/lib/libc/posix1e/acl_from_text.c
==============================================================================
--- stable/7/lib/libc/posix1e/acl_from_text.c	Mon Nov 23 09:13:32 2009	(r199701)
+++ stable/7/lib/libc/posix1e/acl_from_text.c	Mon Nov 23 09:15:16 2009	(r199702)
@@ -229,6 +229,7 @@ acl_from_text(const char *buf_p)
 	}
 #endif
 
+	free(mybuf_p);
 	return(acl);
 
 error_label:
From brueffer at FreeBSD.org  Mon Nov 23 09:45:11 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Mon Nov 23 09:45:27 2009
Subject: svn commit: r199710 - stable/7/lib/libc/locale
Message-ID: <200911230945.nAN9jBRa048426@svn.freebsd.org>

Author: brueffer
Date: Mon Nov 23 09:45:11 2009
New Revision: 199710
URL: http://svn.freebsd.org/changeset/base/199710

Log:
  MFC: r199320
  
  Fix grammar.

Modified:
  stable/7/lib/libc/locale/nl_langinfo.3
Directory Properties:
  stable/7/lib/libc/   (props changed)

Modified: stable/7/lib/libc/locale/nl_langinfo.3
==============================================================================
--- stable/7/lib/libc/locale/nl_langinfo.3	Mon Nov 23 09:44:08 2009	(r199709)
+++ stable/7/lib/libc/locale/nl_langinfo.3	Mon Nov 23 09:45:11 2009	(r199710)
@@ -53,7 +53,7 @@ with a category corresponding to the cat
 or to the
 category
 .Dv LC_ALL ,
-may overwrite buffer pointed by the return value.
+may overwrite the buffer pointed to by the return value.
 .Sh RETURN VALUES
 In a locale where langinfo data is not defined,
 .Fn nl_langinfo
From marius at FreeBSD.org  Tue Nov 24 22:13:07 2009
From: marius at FreeBSD.org (Marius Strobl)
Date: Tue Nov 24 22:13:12 2009
Subject: svn commit: r199768 - stable/7/sys/sparc64/sparc64
Message-ID: <200911242213.nAOMD6Yk030922@svn.freebsd.org>

Author: marius
Date: Tue Nov 24 22:13:06 2009
New Revision: 199768
URL: http://svn.freebsd.org/changeset/base/199768

Log:
  MFC: r199442
  
  Unroll copying of the registers in {g,s}et_mcontext() and limit it
  to the set actually restored by tl0_ret() instead of using the whole
  trapframe. Additionally skip %g7 as that register is used as the
  userland TLS pointer.
  
  PR:		140523

Modified:
  stable/7/sys/sparc64/sparc64/machdep.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/sparc64/machdep.c
==============================================================================
--- stable/7/sys/sparc64/sparc64/machdep.c	Tue Nov 24 21:06:41 2009	(r199767)
+++ stable/7/sys/sparc64/sparc64/machdep.c	Tue Nov 24 22:13:06 2009	(r199768)
@@ -695,12 +695,39 @@ get_mcontext(struct thread *td, mcontext
 
 	tf = td->td_frame;
 	pcb = td->td_pcb;
-	bcopy(tf, mc, sizeof(*tf));
+	/*
+	 * Copy the registers which will be restored by tl0_ret() from the
+	 * trapframe.
+	 * Note that we skip %g7 which is used as the userland TLS register
+	 * and %wstate.
+	 */
+	mc->mc_flags = _MC_VERSION;
+	mc->mc_global[1] = tf->tf_global[1];
+	mc->mc_global[2] = tf->tf_global[2];
+	mc->mc_global[3] = tf->tf_global[3];
+	mc->mc_global[4] = tf->tf_global[4];
+	mc->mc_global[5] = tf->tf_global[5];
+	mc->mc_global[6] = tf->tf_global[6];
 	if (flags & GET_MC_CLEAR_RET) {
 		mc->mc_out[0] = 0;
 		mc->mc_out[1] = 0;
+	} else {
+		mc->mc_out[0] = tf->tf_out[0];
+		mc->mc_out[1] = tf->tf_out[1];
 	}
-	mc->mc_flags = _MC_VERSION;
+	mc->mc_out[2] = tf->tf_out[2];
+	mc->mc_out[3] = tf->tf_out[3];
+	mc->mc_out[4] = tf->tf_out[4];
+	mc->mc_out[5] = tf->tf_out[5];
+	mc->mc_out[6] = tf->tf_out[6];
+	mc->mc_out[7] = tf->tf_out[7];
+	mc->mc_fprs = tf->tf_fprs;
+	mc->mc_fsr = tf->tf_fsr;
+	mc->mc_gsr = tf->tf_gsr;
+	mc->mc_tnpc = tf->tf_tnpc;
+	mc->mc_tpc = tf->tf_tpc;
+	mc->mc_tstate = tf->tf_tstate;
+	mc->mc_y = tf->tf_y;
 	critical_enter();
 	if ((tf->tf_fprs & FPRS_FEF) != 0) {
 		savefpctx(pcb->pcb_ufp);
@@ -720,7 +747,6 @@ set_mcontext(struct thread *td, const mc
 {
 	struct trapframe *tf;
 	struct pcb *pcb;
-	uint64_t wstate;
 
 	if (!TSTATE_SECURE(mc->mc_tstate) ||
 	    (mc->mc_flags & ((1L << _MC_VERSION_BITS) - 1)) != _MC_VERSION)
@@ -729,9 +755,33 @@ set_mcontext(struct thread *td, const mc
 	pcb = td->td_pcb;
 	/* Make sure the windows are spilled first. */
 	flushw();
-	wstate = tf->tf_wstate;
-	bcopy(mc, tf, sizeof(*tf));
-	tf->tf_wstate = wstate;
+	/*
+	 * Copy the registers which will be restored by tl0_ret() to the
+	 * trapframe.
+	 * Note that we skip %g7 which is used as the userland TLS register
+	 * and %wstate.
+	 */
+	tf->tf_global[1] = mc->mc_global[1];
+	tf->tf_global[2] = mc->mc_global[2];
+	tf->tf_global[3] = mc->mc_global[3];
+	tf->tf_global[4] = mc->mc_global[4];
+	tf->tf_global[5] = mc->mc_global[5];
+	tf->tf_global[6] = mc->mc_global[6];
+	tf->tf_out[0] = mc->mc_out[0];
+	tf->tf_out[1] = mc->mc_out[1];
+	tf->tf_out[2] = mc->mc_out[2];
+	tf->tf_out[3] = mc->mc_out[3];
+	tf->tf_out[4] = mc->mc_out[4];
+	tf->tf_out[5] = mc->mc_out[5];
+	tf->tf_out[6] = mc->mc_out[6];
+	tf->tf_out[7] = mc->mc_out[7];
+	tf->tf_fprs = mc->mc_fprs;
+	tf->tf_fsr = mc->mc_fsr;
+	tf->tf_gsr = mc->mc_gsr;
+	tf->tf_tnpc = mc->mc_tnpc;
+	tf->tf_tpc = mc->mc_tpc;
+	tf->tf_tstate = mc->mc_tstate;
+	tf->tf_y = mc->mc_y;
 	if ((mc->mc_fprs & FPRS_FEF) != 0) {
 		tf->tf_fprs = 0;
 		bcopy(mc->mc_fp, pcb->pcb_ufp, sizeof(pcb->pcb_ufp));
From roam at FreeBSD.org  Wed Nov 25 11:16:39 2009
From: roam at FreeBSD.org (Peter Pentchev)
Date: Wed Nov 25 11:16:51 2009
Subject: svn commit: r199794 - stable/7/lib/libc/locale
Message-ID: <200911251116.nAPBGdC9049032@svn.freebsd.org>

Author: roam (doc,ports committer)
Date: Wed Nov 25 11:16:39 2009
New Revision: 199794
URL: http://svn.freebsd.org/changeset/base/199794

Log:
  Merge rev. 199180 to 7.x-STABLE, the change to isblank(3):
  Fix the grammar as in the PR, and then some.
  
  PR:             140454
  Submitted by:   Jeremy Huddleston 

Modified:
  stable/7/lib/libc/locale/isblank.3
Directory Properties:
  stable/7/lib/libc/   (props changed)

Modified: stable/7/lib/libc/locale/isblank.3
==============================================================================
--- stable/7/lib/libc/locale/isblank.3	Wed Nov 25 10:56:50 2009	(r199793)
+++ stable/7/lib/libc/locale/isblank.3	Wed Nov 25 11:16:39 2009	(r199794)
@@ -50,9 +50,9 @@ For any locale, this includes the follow
 .It "\&``\et''\t`` ''"
 .El
 .Pp
-In the "C" locale
+In the "C" locale, a successful
 .Fn isblank
-successful test is limited to this characters only.
+test is limited to these characters only.
 The value of the argument must be representable as an
 .Vt "unsigned char"
 or the value of
From roam at FreeBSD.org  Wed Nov 25 11:25:06 2009
From: roam at FreeBSD.org (Peter Pentchev)
Date: Wed Nov 25 11:25:22 2009
Subject: svn commit: r199797 - stable/7/share/misc
Message-ID: <200911251125.nAPBP5l8049356@svn.freebsd.org>

Author: roam (doc,ports committer)
Date: Wed Nov 25 11:25:05 2009
New Revision: 199797
URL: http://svn.freebsd.org/changeset/base/199797

Log:
  Merge rev. 199181 to 7.x-STABLE:
    Correct the information about the doceng@ team members - Murray Stokely
    stepped down some time ago, about the same time as Giorgos Keramidas
    joined the team.
  
    PR:           140465
    Submitted by: Denny Lin 

Modified:
  stable/7/share/misc/organization.dot
Directory Properties:
  stable/7/share/misc/   (props changed)
  stable/7/share/misc/iso639   (props changed)
  stable/7/share/misc/pci_vendors   (props changed)

Modified: stable/7/share/misc/organization.dot
==============================================================================
--- stable/7/share/misc/organization.dot	Wed Nov 25 11:23:44 2009	(r199796)
+++ stable/7/share/misc/organization.dot	Wed Nov 25 11:25:05 2009	(r199797)
@@ -28,7 +28,7 @@ _misc [label="Miscellaneous Hats"]
 core [label="Core Team\ncore@FreeBSD.org\nwilko, brooks, keramida, imp,\ngnn, wes, hrs, murray,\nrwatson"]
 coresecretary [label="Core Team Secretary\ncore-secretary@FreeBSD.org\njoel"]
 doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"]
-doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\nnik, blackend, hrs,\nmurray"]
+doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\nnik, blackend, hrs,\nkeramida"]
 portscommitters [label="Ports Committers\nports-committers@FreeBSD.org"]
 portmgr [label="Port Management Team\nportmgr@FreeBSD.org\nmarcus, kris, erwin,\nlinimon, pav, krion"]
 portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\nerwin"]
From marius at FreeBSD.org  Wed Nov 25 18:31:59 2009
From: marius at FreeBSD.org (Marius Strobl)
Date: Wed Nov 25 18:32:11 2009
Subject: svn commit: r199810 - stable/7/sys/sparc64/include
Message-ID: <200911251831.nAPIVx2G058305@svn.freebsd.org>

Author: marius
Date: Wed Nov 25 18:31:58 2009
New Revision: 199810
URL: http://svn.freebsd.org/changeset/base/199810

Log:
  MFC: r198502
  
  Sync with the other archs and wrap the prototype of in_cksum_skip(9)
  in #ifdef _KERNEL.
  
  Submitted by:	Ulrich Spoerlein

Modified:
  stable/7/sys/sparc64/include/in_cksum.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/include/in_cksum.h
==============================================================================
--- stable/7/sys/sparc64/include/in_cksum.h	Wed Nov 25 18:31:34 2009	(r199809)
+++ stable/7/sys/sparc64/include/in_cksum.h	Wed Nov 25 18:31:58 2009	(r199810)
@@ -164,6 +164,8 @@ in_cksum_hdr(struct ip *ip)
 	return (__ret);
 }
 
+#ifdef _KERNEL
 u_short	in_cksum_skip(struct mbuf *m, int len, int skip);
+#endif
 
 #endif /* _MACHINE_IN_CKSUM_H_ */