From imp at bsdimp.com Sun Nov 1 01:08:56 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Sun Nov 1 01:09:02 2009 Subject: svn commit: r198706 - head/sys/sys In-Reply-To: <200910311035.n9VAZfIb082932@svn.freebsd.org> References: <200910311035.n9VAZfIb082932@svn.freebsd.org> Message-ID: <20091031.190353.-332187386.imp@bsdimp.com> In message: <200910311035.n9VAZfIb082932@svn.freebsd.org> Ed Schouten writes: : Author: ed : Date: Sat Oct 31 10:35:41 2009 : New Revision: 198706 : URL: http://svn.freebsd.org/changeset/base/198706 : : Log: : Turn unused structure fields of cdevsw into spares. : : d_uid, d_gid and d_mode are unused, because permissions are stored in : cdevpriv nowadays. d_kind doesn't seem to be used at all. We no longer : keep a list of cdevsw's, so d_list is also unused. : : uid_t and gid_t are 32 bits, but mode_t is 16 bits, Because of alignment : constraints of d_kind, we can safely turn it into three 32-bit integers. : d_kind and d_list is equal in size to three pointers. : : Discussed with: kib Don't we need a D_VERSION bump for this? Warner : Modified: : head/sys/sys/conf.h : : Modified: head/sys/sys/conf.h : ============================================================================== : --- head/sys/sys/conf.h Sat Oct 31 09:03:48 2009 (r198705) : +++ head/sys/sys/conf.h Sat Oct 31 10:35:41 2009 (r198706) : @@ -210,15 +210,13 @@ struct cdevsw { : d_kqfilter_t *d_kqfilter; : d_purge_t *d_purge; : d_mmap_single_t *d_mmap_single; : - uid_t d_uid; : - gid_t d_gid; : - mode_t d_mode; : - const char *d_kind; : + : + int32_t d_spare0[3]; : + void *d_spare1[3]; : : /* These fields should not be messed with by drivers */ : - LIST_ENTRY(cdevsw) d_list; : LIST_HEAD(, cdev) d_devs; : - int d_spare3; : + int d_spare2; : union { : struct cdevsw *gianttrick; : SLIST_ENTRY(cdevsw) postfree_list; : From ed at 80386.nl Sun Nov 1 01:12:13 2009 From: ed at 80386.nl (Ed Schouten) Date: Sun Nov 1 01:12:25 2009 Subject: svn commit: r198706 - head/sys/sys In-Reply-To: <20091031.190353.-332187386.imp@bsdimp.com> References: <200910311035.n9VAZfIb082932@svn.freebsd.org> <20091031.190353.-332187386.imp@bsdimp.com> Message-ID: <20091101011212.GG1293@hoeg.nl> Hi Warner, * M. Warner Losh wrote: > Don't we need a D_VERSION bump for this? No, we don't. All these fields are not used by drivers, just some old version of the devfs code. I made sure struct cdevsw didn't change in size, so there should be no API nor ABI conflicts. -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091101/6e42fac5/attachment.pgp From imp at bsdimp.com Sun Nov 1 03:02:36 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Sun Nov 1 03:02:43 2009 Subject: svn commit: r198706 - head/sys/sys In-Reply-To: <20091101011212.GG1293@hoeg.nl> References: <200910311035.n9VAZfIb082932@svn.freebsd.org> <20091031.190353.-332187386.imp@bsdimp.com> <20091101011212.GG1293@hoeg.nl> Message-ID: <20091031.205704.-79135471.imp@bsdimp.com> In message: <20091101011212.GG1293@hoeg.nl> Ed Schouten writes: : Hi Warner, : : * M. Warner Losh wrote: : > Don't we need a D_VERSION bump for this? : : No, we don't. All these fields are not used by drivers, just some old : version of the devfs code. I made sure struct cdevsw didn't change in : size, so there should be no API nor ABI conflicts. On all platforms? A version bump is trivial... Warner From rdivacky at FreeBSD.org Sun Nov 1 08:20:30 2009 From: rdivacky at FreeBSD.org (Roman Divacky) Date: Sun Nov 1 08:20:42 2009 Subject: svn commit: r198741 - head Message-ID: <200911010820.nA18KUj4017208@svn.freebsd.org> Author: rdivacky Date: Sun Nov 1 08:20:30 2009 New Revision: 198741 URL: http://svn.freebsd.org/changeset/base/198741 Log: Replace -iprefix with -isystem. We only need alternative header files search path and thus -isystem is sufficient. -iprefix is meant to do something entirely different. Approved by: ed (mentor) OKed by: ru, kan Tested by: make universe Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sun Nov 1 04:57:41 2009 (r198740) +++ head/Makefile.inc1 Sun Nov 1 08:20:30 2009 (r198741) @@ -272,7 +272,7 @@ LIB32CPUFLAGS= -march=i686 -mmmx -msse - LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} .endif LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -mfancy-math-387 -DCOMPAT_32BIT \ - -iprefix ${LIB32TMP}/usr/ \ + -isystem ${LIB32TMP}/usr/include/ \ -L${LIB32TMP}/usr/lib32 \ -B${LIB32TMP}/usr/lib32 From mav at FreeBSD.org Sun Nov 1 11:31:07 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Nov 1 11:31:13 2009 Subject: svn commit: r198748 - in head/sys/cam: . ata scsi Message-ID: <200911011131.nA1BV6lO022276@svn.freebsd.org> Author: mav Date: Sun Nov 1 11:31:06 2009 New Revision: 198748 URL: http://svn.freebsd.org/changeset/base/198748 Log: MFp4: Fix reference counting bug, when device unreferenced before then invalidated. To do it, do not handle validity flag as another reference, but explicitly modify reference count each time flag is modified. Discovered by: thompsa Modified: head/sys/cam/ata/ata_xpt.c head/sys/cam/cam_xpt.c head/sys/cam/cam_xpt_internal.h head/sys/cam/scsi/scsi_xpt.c Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Sun Nov 1 10:57:07 2009 (r198747) +++ head/sys/cam/ata/ata_xpt.c Sun Nov 1 11:31:06 2009 (r198748) @@ -733,6 +733,7 @@ noerror: case PROBE_SET_MULTI: if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) { path->device->flags &= ~CAM_DEV_UNCONFIGURED; + xpt_acquire_device(path->device); done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, @@ -777,6 +778,7 @@ noerror: ata_device_transport(path); if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) { path->device->flags &= ~CAM_DEV_UNCONFIGURED; + xpt_acquire_device(path->device); done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, done_ccb); @@ -810,6 +812,7 @@ noerror: path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID; if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) { path->device->flags &= ~CAM_DEV_UNCONFIGURED; + xpt_acquire_device(path->device); done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, @@ -1485,8 +1488,10 @@ ata_dev_async(u_int32_t async_code, stru CAM_EXPECT_INQ_CHANGE, NULL); } xpt_release_path(&newpath); - } else if (async_code == AC_LOST_DEVICE) { + } else if (async_code == AC_LOST_DEVICE && + (device->flags & CAM_DEV_UNCONFIGURED) == 0) { device->flags |= CAM_DEV_UNCONFIGURED; + xpt_release_device(device); } else if (async_code == AC_TRANSFER_NEG) { struct ccb_trans_settings *settings; Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Nov 1 10:57:07 2009 (r198747) +++ head/sys/cam/cam_xpt.c Sun Nov 1 11:31:06 2009 (r198748) @@ -217,9 +217,7 @@ static void xpt_release_devq_device(str int run_queue); static struct cam_et* xpt_alloc_target(struct cam_eb *bus, target_id_t target_id); -static void xpt_release_target(struct cam_eb *bus, struct cam_et *target); -static void xpt_release_device(struct cam_eb *bus, struct cam_et *target, - struct cam_ed *device); +static void xpt_release_target(struct cam_et *target); static struct cam_eb* xpt_find_bus(path_id_t path_id); static struct cam_et* @@ -3521,9 +3519,9 @@ xpt_compile_path(struct cam_path *new_pa CAM_DEBUG(new_path, CAM_DEBUG_TRACE, ("xpt_compile_path\n")); } else { if (device != NULL) - xpt_release_device(bus, target, device); + xpt_release_device(device); if (target != NULL) - xpt_release_target(bus, target); + xpt_release_target(target); if (bus != NULL) xpt_release_bus(bus); } @@ -3535,11 +3533,11 @@ xpt_release_path(struct cam_path *path) { CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_release_path\n")); if (path->device != NULL) { - xpt_release_device(path->bus, path->target, path->device); + xpt_release_device(path->device); path->device = NULL; } if (path->target != NULL) { - xpt_release_target(path->bus, path->target); + xpt_release_target(path->target); path->target = NULL; } if (path->bus != NULL) { @@ -4375,15 +4373,15 @@ xpt_alloc_target(struct cam_eb *bus, tar } static void -xpt_release_target(struct cam_eb *bus, struct cam_et *target) +xpt_release_target(struct cam_et *target) { if ((--target->refcount == 0) && (TAILQ_FIRST(&target->ed_entries) == NULL)) { - TAILQ_REMOVE(&bus->et_entries, target, links); - bus->generation++; + TAILQ_REMOVE(&target->bus->et_entries, target, links); + target->bus->generation++; + xpt_release_bus(target->bus); free(target, M_CAMXPT); - xpt_release_bus(bus); } } @@ -4470,13 +4468,18 @@ xpt_alloc_device(struct cam_eb *bus, str return (device); } -static void -xpt_release_device(struct cam_eb *bus, struct cam_et *target, - struct cam_ed *device) +void +xpt_acquire_device(struct cam_ed *device) +{ + + device->refcount++; +} + +void +xpt_release_device(struct cam_ed *device) { - if ((--device->refcount == 0) - && ((device->flags & CAM_DEV_UNCONFIGURED) != 0)) { + if (--device->refcount == 0) { struct cam_devq *devq; if (device->alloc_ccb_entry.pinfo.index != CAM_UNQUEUED_INDEX @@ -4486,16 +4489,16 @@ xpt_release_device(struct cam_eb *bus, s if ((device->flags & CAM_DEV_REL_TIMEOUT_PENDING) != 0) callout_stop(&device->callout); - TAILQ_REMOVE(&target->ed_entries, device,links); - target->generation++; - bus->sim->max_ccbs -= device->ccbq.devq_openings; + TAILQ_REMOVE(&device->target->ed_entries, device,links); + device->target->generation++; + device->target->bus->sim->max_ccbs -= device->ccbq.devq_openings; /* Release our slot in the devq */ - devq = bus->sim->devq; + devq = device->target->bus->sim->devq; cam_devq_resize(devq, devq->alloc_queue.array_size - 1); camq_fini(&device->drvq); cam_ccbq_fini(&device->ccbq); + xpt_release_target(device->target); free(device, M_CAMXPT); - xpt_release_target(bus, target); } } Modified: head/sys/cam/cam_xpt_internal.h ============================================================================== --- head/sys/cam/cam_xpt_internal.h Sun Nov 1 10:57:07 2009 (r198747) +++ head/sys/cam/cam_xpt_internal.h Sun Nov 1 11:31:06 2009 (r198748) @@ -37,9 +37,7 @@ struct cam_ed; typedef struct cam_ed * (*xpt_alloc_device_func)(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id); -typedef void (*xpt_release_device_func)(struct cam_eb *bus, - struct cam_et *target, - struct cam_ed *device); +typedef void (*xpt_release_device_func)(struct cam_ed *device); typedef void (*xpt_action_func)(union ccb *start_ccb); typedef void (*xpt_dev_async_func)(u_int32_t async_code, struct cam_eb *bus, @@ -172,6 +170,8 @@ struct xpt_xport * ata_get_xport(void); struct cam_ed * xpt_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id); +void xpt_acquire_device(struct cam_ed *device); +void xpt_release_device(struct cam_ed *device); void xpt_run_dev_sendq(struct cam_eb *bus); int xpt_schedule_dev(struct camq *queue, cam_pinfo *dev_pinfo, u_int32_t new_priority); Modified: head/sys/cam/scsi/scsi_xpt.c ============================================================================== --- head/sys/cam/scsi/scsi_xpt.c Sun Nov 1 10:57:07 2009 (r198747) +++ head/sys/cam/scsi/scsi_xpt.c Sun Nov 1 11:31:06 2009 (r198748) @@ -1076,8 +1076,10 @@ probedone(struct cam_periph *periph, uni else PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0); - path->device->flags &= ~CAM_DEV_UNCONFIGURED; - + if (path->device->flags & CAM_DEV_UNCONFIGURED) { + path->device->flags &= ~CAM_DEV_UNCONFIGURED; + xpt_acquire_device(path->device); + } xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; @@ -1336,8 +1338,12 @@ probedone(struct cam_periph *periph, uni CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Leave Domain Validation\n")); } + if (path->device->flags & CAM_DEV_UNCONFIGURED) { + path->device->flags &= ~CAM_DEV_UNCONFIGURED; + xpt_acquire_device(path->device); + } path->device->flags &= - ~(CAM_DEV_UNCONFIGURED|CAM_DEV_IN_DV|CAM_DEV_DV_HIT_BOTTOM); + ~(CAM_DEV_IN_DV|CAM_DEV_DV_HIT_BOTTOM); if ((softc->flags & PROBE_NO_ANNOUNCE) == 0) { /* Inform the XPT that a new device has been found */ done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; @@ -1387,8 +1393,12 @@ probedone(struct cam_periph *periph, uni CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Leave Domain Validation Successfully\n")); } + if (path->device->flags & CAM_DEV_UNCONFIGURED) { + path->device->flags &= ~CAM_DEV_UNCONFIGURED; + xpt_acquire_device(path->device); + } path->device->flags &= - ~(CAM_DEV_UNCONFIGURED|CAM_DEV_IN_DV|CAM_DEV_DV_HIT_BOTTOM); + ~(CAM_DEV_IN_DV|CAM_DEV_DV_HIT_BOTTOM); if ((softc->flags & PROBE_NO_ANNOUNCE) == 0) { /* Inform the XPT that a new device has been found */ done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; @@ -2375,8 +2385,10 @@ scsi_dev_async(u_int32_t async_code, str CAM_EXPECT_INQ_CHANGE, NULL); } xpt_release_path(&newpath); - } else if (async_code == AC_LOST_DEVICE) { + } else if (async_code == AC_LOST_DEVICE && + (device->flags & CAM_DEV_UNCONFIGURED) == 0) { device->flags |= CAM_DEV_UNCONFIGURED; + xpt_release_device(device); } else if (async_code == AC_TRANSFER_NEG) { struct ccb_trans_settings *settings; From brueffer at FreeBSD.org Sun Nov 1 11:39:08 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Sun Nov 1 11:39:14 2009 Subject: svn commit: r198750 - head/usr.sbin/usbconfig Message-ID: <200911011139.nA1Bd8nf022525@svn.freebsd.org> Author: brueffer Date: Sun Nov 1 11:39:07 2009 New Revision: 198750 URL: http://svn.freebsd.org/changeset/base/198750 Log: Expand DESCRIPTION and a basic EXAMPLES section. PR: 139605 Submitted by: Warren Block MFC after: 1 week Modified: head/usr.sbin/usbconfig/usbconfig.8 Modified: head/usr.sbin/usbconfig/usbconfig.8 ============================================================================== --- head/usr.sbin/usbconfig/usbconfig.8 Sun Nov 1 11:34:13 2009 (r198749) +++ head/usr.sbin/usbconfig/usbconfig.8 Sun Nov 1 11:39:07 2009 (r198750) @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd Sep 28, 2008 +.Dd November 1, 2009 .Dt USBCONFIG 8 .Os .Sh NAME @@ -49,5 +49,13 @@ Should only be used in conjunction with .It Fl h Show help and available commands. .El +.Pp +When called without options, +.Nm +prints a list of all available USB devices. +.Sh EXAMPLES +Show information about the device on USB bus 1 at address 2: +.Pp +.Dl usbconfig -u 1 -a 2 dump_info .Sh SEE ALSO .Xr usb 4 From mav at FreeBSD.org Sun Nov 1 13:06:15 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Nov 1 13:06:27 2009 Subject: svn commit: r198752 - head/sys/dev/ata/chipsets Message-ID: <200911011306.nA1D6F4x024211@svn.freebsd.org> Author: mav Date: Sun Nov 1 13:06:15 2009 New Revision: 198752 URL: http://svn.freebsd.org/changeset/base/198752 Log: MFp4: Allow SATA1 SiI chips to do full-sized DMA. Specification tells that we may release DMA constrants even more, but it require some additional handling. Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-siliconimage.c Sun Nov 1 11:41:20 2009 (r198751) +++ head/sys/dev/ata/chipsets/ata-siliconimage.c Sun Nov 1 13:06:15 2009 (r198752) @@ -340,6 +340,7 @@ ata_sii_ch_attach(device_t dev) ATA_OUTL(ctlr->r_res2, 0x148 + (unit01 << 7) + (unit10 << 8),(1 << 16)); } + ch->dma.max_iosize = (ATA_DMA_ENTRIES - 1) * PAGE_SIZE; if (ctlr->chip->cfg2 & SII_BUG) { /* work around errata in early chips */ ch->dma.boundary = 8192; From rwatson at FreeBSD.org Sun Nov 1 15:15:45 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Nov 1 15:15:56 2009 Subject: svn commit: r198706 - head/sys/sys In-Reply-To: <200910311035.n9VAZfIb082932@svn.freebsd.org> References: <200910311035.n9VAZfIb082932@svn.freebsd.org> Message-ID: On Sat, 31 Oct 2009, Ed Schouten wrote: > Turn unused structure fields of cdevsw into spares. > > d_uid, d_gid and d_mode are unused, because permissions are stored in > cdevpriv nowadays. d_kind doesn't seem to be used at all. We no longer > keep a list of cdevsw's, so d_list is also unused. > > uid_t and gid_t are 32 bits, but mode_t is 16 bits, Because of alignment > constraints of d_kind, we can safely turn it into three 32-bit integers. > d_kind and d_list is equal in size to three pointers. The underlying change seems fine, especially in -CURRENT, but I'm confused by the paragraph here on alignment and safety. What do you mean by safe, and does it matter? From a casual glance (perhaps mistaken), it looks like this changes the KBI, so all modules declaring struct cdevsw will need to be rebuilt. Robert N M Watson Computer Laboratory University of Cambridge > > Discussed with: kib > > Modified: > head/sys/sys/conf.h > > Modified: head/sys/sys/conf.h > ============================================================================== > --- head/sys/sys/conf.h Sat Oct 31 09:03:48 2009 (r198705) > +++ head/sys/sys/conf.h Sat Oct 31 10:35:41 2009 (r198706) > @@ -210,15 +210,13 @@ struct cdevsw { > d_kqfilter_t *d_kqfilter; > d_purge_t *d_purge; > d_mmap_single_t *d_mmap_single; > - uid_t d_uid; > - gid_t d_gid; > - mode_t d_mode; > - const char *d_kind; > + > + int32_t d_spare0[3]; > + void *d_spare1[3]; > > /* These fields should not be messed with by drivers */ > - LIST_ENTRY(cdevsw) d_list; > LIST_HEAD(, cdev) d_devs; > - int d_spare3; > + int d_spare2; > union { > struct cdevsw *gianttrick; > SLIST_ENTRY(cdevsw) postfree_list; > From ed at 80386.nl Sun Nov 1 15:33:41 2009 From: ed at 80386.nl (Ed Schouten) Date: Sun Nov 1 15:33:47 2009 Subject: svn commit: r198706 - head/sys/sys In-Reply-To: References: <200910311035.n9VAZfIb082932@svn.freebsd.org> Message-ID: <20091101153339.GH1293@hoeg.nl> Hi Robert, * Robert Watson wrote: > The underlying change seems fine, especially in -CURRENT, but I'm > confused by the paragraph here on alignment and safety. What do you > mean by safe, and does it matter? With safe I mean that all useful members still begin at the same offset within the structure. I'm not sure whether it matters at all, because I can imagine d_devs could be moved around without having any effect, but I'm not going to make any predictions on that. > From a casual glance (perhaps mistaken), it looks like this changes > the KBI, so all modules declaring struct cdevsw will need to be > rebuilt. It shouldn't, right? - uid_t d_uid; - gid_t d_gid; - mode_t d_mode; - const char *d_kind; + + int32_t d_spare0[3]; + void *d_spare1[3]; /* These fields should not be messed with by drivers */ - LIST_ENTRY(cdevsw) d_list; d_uid, d_gid and d_mode is equal to: int32_t d_uid; int32_t d_gid; int16_t d_mode; Because d_kind is a pointer, there will be a hole in the structure of at least 2 bytes (maybe even 6), which means we can safely extend d_mode to 32 bits as well. I could have decided to leave it at uint16_t, but that would only obfuscate it even more when we would try to reclaim some space there. d_list is just two pointers, so I merged it with d_kind into an array of three pointers. -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091101/e1ea844e/attachment.pgp From rwatson at FreeBSD.org Sun Nov 1 16:15:22 2009 From: rwatson at FreeBSD.org (Robert N. M. Watson) Date: Sun Nov 1 16:15:27 2009 Subject: svn commit: r198706 - head/sys/sys In-Reply-To: <20091101153339.GH1293@hoeg.nl> References: <200910311035.n9VAZfIb082932@svn.freebsd.org> <20091101153339.GH1293@hoeg.nl> Message-ID: On 1 Nov 2009, at 15:33, Ed Schouten wrote: > Because d_kind is a pointer, there will be a hole in the structure > of at > least 2 bytes (maybe even 6), which means we can safely extend > d_mode to > 32 bits as well. I could have decided to leave it at uint16_t, but > that > would only obfuscate it even more when we would try to reclaim some > space there. > > d_list is just two pointers, so I merged it with d_kind into an > array of > three pointers No, you're right, and I was mistaken, it seems fine on i386 and amd64. And, at least here, d_devs is at the same offset on both architectures. The only really "weird" architecture is arm, which I believe aligns char and short to 32-bit, but that should be OK here I think as well. Robert From brueffer at FreeBSD.org Sun Nov 1 18:25:11 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Sun Nov 1 18:25:18 2009 Subject: svn commit: r198768 - head/sbin/mknod Message-ID: <200911011825.nA1IPBQ2031333@svn.freebsd.org> Author: brueffer Date: Sun Nov 1 18:25:11 2009 New Revision: 198768 URL: http://svn.freebsd.org/changeset/base/198768 Log: Refine r198714, it's not as easy as just leaving the major number zero. Submitted by: ed MFC after: 1 week Modified: head/sbin/mknod/mknod.8 Modified: head/sbin/mknod/mknod.8 ============================================================================== --- head/sbin/mknod/mknod.8 Sun Nov 1 18:19:00 2009 (r198767) +++ head/sbin/mknod/mknod.8 Sun Nov 1 18:25:11 2009 (r198768) @@ -74,7 +74,6 @@ and pseudo devices, and are type .It Ar major The major device number is an integer number which tells the kernel which device driver entry point to use. -This is a compatibility shim and should be left zero. .It Ar minor The minor device number tells the kernel which subunit the node corresponds to on the device; for example, From kostikbel at gmail.com Sun Nov 1 18:43:37 2009 From: kostikbel at gmail.com (Kostik Belousov) Date: Sun Nov 1 18:43:44 2009 Subject: svn commit: r198768 - head/sbin/mknod In-Reply-To: <200911011825.nA1IPBQ2031333@svn.freebsd.org> References: <200911011825.nA1IPBQ2031333@svn.freebsd.org> Message-ID: <20091101184322.GP2147@deviant.kiev.zoral.com.ua> On Sun, Nov 01, 2009 at 06:25:11PM +0000, Christian Brueffer wrote: > Author: brueffer > Date: Sun Nov 1 18:25:11 2009 > New Revision: 198768 > URL: http://svn.freebsd.org/changeset/base/198768 > > Log: > Refine r198714, it's not as easy as just leaving the major number zero. > > Submitted by: ed > MFC after: 1 week > > Modified: > head/sbin/mknod/mknod.8 > > Modified: head/sbin/mknod/mknod.8 > ============================================================================== > --- head/sbin/mknod/mknod.8 Sun Nov 1 18:19:00 2009 (r198767) > +++ head/sbin/mknod/mknod.8 Sun Nov 1 18:25:11 2009 (r198768) > @@ -74,7 +74,6 @@ and pseudo devices, and are type > .It Ar major > The major device number is an integer number which tells the kernel > which device driver entry point to use. > -This is a compatibility shim and should be left zero. > .It Ar minor > The minor device number tells the kernel which subunit > the node corresponds to on the device; for example, It seems that description of majors/minors there is absolutely irrelevant to the freebsd device nodes. Devfs simply does not work this way anymore for long time. Moreover, you cannot create special node that would become a node used to access device driver in the freebsd. The only use that is left for mknod c|b is to create special nodes on the filesystems exported by NFS for other un*xes. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091101/39a7501e/attachment.pgp From kientzle at freebsd.org Sun Nov 1 20:14:29 2009 From: kientzle at freebsd.org (Tim Kientzle) Date: Sun Nov 1 20:14:40 2009 Subject: svn commit: r198768 - head/sbin/mknod In-Reply-To: <20091101184322.GP2147@deviant.kiev.zoral.com.ua> References: <200911011825.nA1IPBQ2031333@svn.freebsd.org> <20091101184322.GP2147@deviant.kiev.zoral.com.ua> Message-ID: <4AEDEC24.2000206@freebsd.org> Kostik Belousov wrote: > On Sun, Nov 01, 2009 at 06:25:11PM +0000, Christian Brueffer wrote: >> Author: brueffer >> Date: Sun Nov 1 18:25:11 2009 >> New Revision: 198768 >> URL: http://svn.freebsd.org/changeset/base/198768 >> >> Log: >> Refine r198714, it's not as easy as just leaving the major number zero. >> >> Submitted by: ed >> MFC after: 1 week >> > > Moreover, you cannot create special node that would become a node used to > access device driver in the freebsd. > > The only use that is left for mknod c|b is to create special nodes on > the filesystems exported by NFS for other un*xes. I wonder if mknod c|b should print a warning? Tim From ed at 80386.nl Sun Nov 1 20:22:43 2009 From: ed at 80386.nl (Ed Schouten) Date: Sun Nov 1 20:22:55 2009 Subject: svn commit: r198768 - head/sbin/mknod In-Reply-To: <20091101184322.GP2147@deviant.kiev.zoral.com.ua> References: <200911011825.nA1IPBQ2031333@svn.freebsd.org> <20091101184322.GP2147@deviant.kiev.zoral.com.ua> Message-ID: <20091101202242.GK1293@hoeg.nl> * Kostik Belousov wrote: > It seems that description of majors/minors there is absolutely irrelevant > to the freebsd device nodes. Devfs simply does not work this way anymore > for long time. Which is why I proposed changing these sentences to the past tense, i.e.: The major device number is an integer number which tells the kernel which device driver entry point to use. should become: The major device number is an integer number which used to tell the kernel which device driver entry point to use. and: The minor device number tells the kernel which subunit the node corresponds to on the device; for example, should become: The minor device number used to tell the kernel which subunit the node corresponds to on the device; for example, Because there are also various discrepancies between how FreeBSD and not-FreeBSD divide dev_t's into major and minor numbers, I would almost suggest merging mknod(8)'s major and minor argument into one, namely a (hexa)decimal 32-bit value. -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091101/8a0a4055/attachment.pgp From thompsa at FreeBSD.org Sun Nov 1 21:03:51 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Nov 1 21:04:29 2009 Subject: svn commit: r198748 - in head/sys/cam: . ata scsi In-Reply-To: <200911011131.nA1BV6lO022276@svn.freebsd.org> References: <200911011131.nA1BV6lO022276@svn.freebsd.org> Message-ID: <1280352d0911011303g1c07ec48o7782fc8974e65fa7@mail.gmail.com> 2009/11/2 Alexander Motin : > Author: mav > Date: Sun Nov ?1 11:31:06 2009 > New Revision: 198748 > URL: http://svn.freebsd.org/changeset/base/198748 > > Log: > ?MFp4: > ?Fix reference counting bug, when device unreferenced before then > ?invalidated. To do it, do not handle validity flag as another > ?reference, but explicitly modify reference count each time flag is > ?modified. > > ?Discovered by: ? ? ? ?thompsa Thanks! From thompsa at FreeBSD.org Sun Nov 1 21:41:44 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Nov 1 21:41:56 2009 Subject: svn commit: r198774 - head/sys/dev/usb/serial Message-ID: <200911012141.nA1Lfi8r036062@svn.freebsd.org> Author: thompsa Date: Sun Nov 1 21:41:44 2009 New Revision: 198774 URL: http://svn.freebsd.org/changeset/base/198774 Log: Check unit number and provide string name for consdev. Submitted by: HPS Modified: head/sys/dev/usb/serial/usb_serial.c Modified: head/sys/dev/usb/serial/usb_serial.c ============================================================================== --- head/sys/dev/usb/serial/usb_serial.c Sun Nov 1 20:24:17 2009 (r198773) +++ head/sys/dev/usb/serial/usb_serial.c Sun Nov 1 21:41:44 2009 (r198774) @@ -1300,7 +1300,12 @@ CONSOLE_DRIVER(ucom); static void ucom_cnprobe(struct consdev *cp) { - cp->cn_pri = CN_NORMAL; + if (ucom_cons_unit != -1) + cp->cn_pri = CN_NORMAL; + else + cp->cn_pri = CN_DEAD; + + strlcpy(cp->cn_name, "ucom", sizeof(cp->cn_name)); } static void From thompsa at FreeBSD.org Sun Nov 1 21:44:38 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Nov 1 21:44:51 2009 Subject: svn commit: r198775 - head/sys/dev/usb Message-ID: <200911012144.nA1LiboX036178@svn.freebsd.org> Author: thompsa Date: Sun Nov 1 21:44:37 2009 New Revision: 198775 URL: http://svn.freebsd.org/changeset/base/198775 Log: Fix a corner case where usbd_transfer_drain() can return too early if the callback has dropped the mutex, leading to a panic. Submitted by: HPS MFC after: 3 days Modified: head/sys/dev/usb/usb_core.h head/sys/dev/usb/usb_transfer.c Modified: head/sys/dev/usb/usb_core.h ============================================================================== --- head/sys/dev/usb/usb_core.h Sun Nov 1 21:41:44 2009 (r198774) +++ head/sys/dev/usb/usb_core.h Sun Nov 1 21:44:37 2009 (r198775) @@ -112,6 +112,7 @@ struct usb_xfer_flags_int { uint8_t curr_dma_set:1; /* used by USB HC/DC driver */ uint8_t can_cancel_immed:1; /* set if USB transfer can be * cancelled immediately */ + uint8_t doing_callback:1; /* set if executing the callback */ }; /* Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Sun Nov 1 21:41:44 2009 (r198774) +++ head/sys/dev/usb/usb_transfer.c Sun Nov 1 21:44:37 2009 (r198775) @@ -1797,8 +1797,18 @@ usbd_transfer_drain(struct usb_xfer *xfe usbd_transfer_stop(xfer); - while (usbd_transfer_pending(xfer)) { + while (usbd_transfer_pending(xfer) || + xfer->flags_int.doing_callback) { + + /* + * It is allowed that the callback can drop its + * transfer mutex. In that case checking only + * "usbd_transfer_pending()" is not enough to tell if + * the USB transfer is fully drained. We also need to + * check the internal "doing_callback" flag. + */ xfer->flags_int.draining = 1; + /* * Wait until the current outstanding USB * transfer is complete ! @@ -2043,6 +2053,9 @@ usbd_callback_wrapper(struct usb_xfer_qu /* get next USB transfer in the queue */ info->done_q.curr = NULL; + /* set flag in case of drain */ + xfer->flags_int.doing_callback = 1; + USB_BUS_UNLOCK(info->bus); USB_BUS_LOCK_ASSERT(info->bus, MA_NOTOWNED); @@ -2095,12 +2108,17 @@ usbd_callback_wrapper(struct usb_xfer_qu if ((!xfer->flags_int.open) && (xfer->flags_int.started) && (xfer->usb_state == USB_ST_ERROR)) { + /* clear flag in case of drain */ + xfer->flags_int.doing_callback = 0; /* try to loop, but not recursivly */ usb_command_wrapper(&info->done_q, xfer); return; } done: + /* clear flag in case of drain */ + xfer->flags_int.doing_callback = 0; + /* * Check if we are draining. */ From thompsa at FreeBSD.org Sun Nov 1 21:48:19 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Nov 1 21:48:30 2009 Subject: svn commit: r198776 - head/sys/dev/usb Message-ID: <200911012148.nA1LmI6R036292@svn.freebsd.org> Author: thompsa Date: Sun Nov 1 21:48:18 2009 New Revision: 198776 URL: http://svn.freebsd.org/changeset/base/198776 Log: - Add usb_fill_bulk_urb() and usb_bulk_msg() linux compat functions [1] - Don't write actual length if the actual length pointer is NULL [2] - correct Linux Compatibility error codes for short isochronous IN transfers and make status field signed. Submitted by: Leunam Elebek [1], Manuel Gebele [2] Modified: head/sys/dev/usb/usb_compat_linux.c head/sys/dev/usb/usb_compat_linux.h Modified: head/sys/dev/usb/usb_compat_linux.c ============================================================================== --- head/sys/dev/usb/usb_compat_linux.c Sun Nov 1 21:44:37 2009 (r198775) +++ head/sys/dev/usb/usb_compat_linux.c Sun Nov 1 21:48:18 2009 (r198776) @@ -624,10 +624,11 @@ usb_start_wait_urb(struct urb *urb, usb_ done: if (do_unlock) mtx_unlock(&Giant); - if (err) { - *p_actlen = 0; - } else { - *p_actlen = urb->actual_length; + if (p_actlen != NULL) { + if (err) + *p_actlen = 0; + else + *p_actlen = urb->actual_length; } return (err); } @@ -1362,8 +1363,17 @@ usb_linux_isoc_callback(struct usb_xfer for (x = 0; x < urb->number_of_packets; x++) { uipd = urb->iso_frame_desc + x; + if (uipd->length > xfer->frlengths[x]) { + if (urb->transfer_flags & URB_SHORT_NOT_OK) { + /* XXX should be EREMOTEIO */ + uipd->status = -EPIPE; + } else { + uipd->status = 0; + } + } else { + uipd->status = 0; + } uipd->actual_length = xfer->frlengths[x]; - uipd->status = 0; if (!xfer->flags.ext_buffer) { usbd_copy_out(xfer->frbuffers, offset, USB_ADD_BYTES(urb->transfer_buffer, @@ -1385,8 +1395,8 @@ usb_linux_isoc_callback(struct usb_xfer if (xfer->actlen < xfer->sumlen) { /* short transfer */ if (urb->transfer_flags & URB_SHORT_NOT_OK) { - urb->status = -EPIPE; /* XXX should be - * EREMOTEIO */ + /* XXX should be EREMOTEIO */ + urb->status = -EPIPE; } else { urb->status = 0; } @@ -1482,6 +1492,7 @@ tr_setup: /* Set zero for "actual_length" */ for (x = 0; x < urb->number_of_packets; x++) { urb->iso_frame_desc[x].actual_length = 0; + urb->iso_frame_desc[x].status = urb->status; } /* call callback */ @@ -1663,3 +1674,58 @@ setup_bulk: goto tr_setup; } } + +/*------------------------------------------------------------------------* + * usb_fill_bulk_urb + *------------------------------------------------------------------------*/ +void +usb_fill_bulk_urb(struct urb *urb, struct usb_device *udev, + struct usb_host_endpoint *uhe, void *buf, + int length, usb_complete_t callback, void *arg) +{ + urb->dev = udev; + urb->endpoint = uhe; + urb->transfer_buffer = buf; + urb->transfer_buffer_length = length; + urb->complete = callback; + urb->context = arg; +} + +/*------------------------------------------------------------------------* + * usb_bulk_msg + * + * NOTE: This function can also be used for interrupt endpoints! + * + * Return values: + * 0: Success + * Else: Failure + *------------------------------------------------------------------------*/ +int +usb_bulk_msg(struct usb_device *udev, struct usb_host_endpoint *uhe, + void *data, int len, uint16_t *pactlen, usb_timeout_t timeout) +{ + struct urb *urb; + int err; + + if (uhe == NULL) + return (-EINVAL); + if (len < 0) + return (-EINVAL); + + err = usb_setup_endpoint(udev, uhe, 4096 /* bytes */); + if (err) + return (err); + + urb = usb_alloc_urb(0, 0); + if (urb == NULL) + return (-ENOMEM); + + usb_fill_bulk_urb(urb, udev, uhe, data, len, + usb_linux_wait_complete, NULL); + + err = usb_start_wait_urb(urb, timeout, pactlen); + + usb_free_urb(urb); + + return (err); +} Modified: head/sys/dev/usb/usb_compat_linux.h ============================================================================== --- head/sys/dev/usb/usb_compat_linux.h Sun Nov 1 21:44:37 2009 (r198775) +++ head/sys/dev/usb/usb_compat_linux.h Sun Nov 1 21:48:18 2009 (r198776) @@ -217,7 +217,7 @@ struct usb_iso_packet_descriptor { * packets are usually back to back) */ uint16_t length; /* expected length */ uint16_t actual_length; - uint16_t status; + int16_t status; /* transfer status */ }; /* @@ -299,6 +299,11 @@ void usb_set_intfdata(struct usb_interfa void usb_linux_register(void *arg); void usb_linux_deregister(void *arg); +void usb_fill_bulk_urb(struct urb *, struct usb_device *, + struct usb_host_endpoint *, void *, int, usb_complete_t, void *); +int usb_bulk_msg(struct usb_device *, struct usb_host_endpoint *, + void *, int, uint16_t *, usb_timeout_t); + #define interface_to_usbdev(intf) (intf)->linux_udev #define interface_to_bsddev(intf) (intf)->linux_udev From des at des.no Sun Nov 1 21:55:21 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Sun Nov 1 21:55:30 2009 Subject: svn commit: r198768 - head/sbin/mknod In-Reply-To: <20091101202242.GK1293@hoeg.nl> (Ed Schouten's message of "Sun, 1 Nov 2009 21:22:42 +0100") References: <200911011825.nA1IPBQ2031333@svn.freebsd.org> <20091101184322.GP2147@deviant.kiev.zoral.com.ua> <20091101202242.GK1293@hoeg.nl> Message-ID: <86y6mpj4fs.fsf@ds4.des.no> Ed Schouten writes: > Which is why I proposed changing these sentences to the past tense, > i.e.: > > The major device number is an integer number which tells the > kernel which device driver entry point to use. > > should become: > > The major device number is an integer number which used to tell > the kernel which device driver entry point to use. > > and: > > The minor device number tells the kernel which subunit the node > corresponds to on the device; for example, > > should become: > > The minor device number used to tell the kernel which subunit > the node corresponds to on the device; for example, How about replacing both paragraphs with major, minor Historically, a device number consisted of two parts: the major number, which identified a device driver, and the minor number, which identified an individual device handled by that driver. FreeBSD no longer makes that distinction; each device has a unique system-wide minor number, and the major number is always zero. However, the distinction is still important when creating device nodes on a file system intended for use by an older system. (modulo errors in grammar and style) The paragraph about b | c should be altered in a similar manner, to emphasize that FreeBSD does not have block devices, but that block device nodes can still be created for use by older systems. DES -- Dag-Erling Sm?rgrav - des@des.no From ed at 80386.nl Sun Nov 1 22:05:36 2009 From: ed at 80386.nl (Ed Schouten) Date: Sun Nov 1 22:05:42 2009 Subject: svn commit: r198768 - head/sbin/mknod In-Reply-To: <86y6mpj4fs.fsf@ds4.des.no> References: <200911011825.nA1IPBQ2031333@svn.freebsd.org> <20091101184322.GP2147@deviant.kiev.zoral.com.ua> <20091101202242.GK1293@hoeg.nl> <86y6mpj4fs.fsf@ds4.des.no> Message-ID: <20091101220533.GL1293@hoeg.nl> Hi Dag-Erling, * Dag-Erling Sm?rgrav wrote: > identified an individual device handled by that driver. FreeBSD no > longer makes that distinction; each device has a unique system-wide > minor number, and the major number is always zero. However, the ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ As pointed out earlier, this is not true. Major numbers can be non-zero. | #define major(x) ((int)(((u_int)(x) >> 8)&0xff)) Devices 256-511 will have a major number of 1, etc. Apart from that, I think there is also a fair amount of overlap with the COMPATIBILITY section of the same manpage. -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091101/23293445/attachment.pgp From des at des.no Sun Nov 1 22:37:39 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Sun Nov 1 22:37:46 2009 Subject: svn commit: r198768 - head/sbin/mknod In-Reply-To: <20091101220533.GL1293@hoeg.nl> (Ed Schouten's message of "Sun, 1 Nov 2009 23:05:33 +0100") References: <200911011825.nA1IPBQ2031333@svn.freebsd.org> <20091101184322.GP2147@deviant.kiev.zoral.com.ua> <20091101202242.GK1293@hoeg.nl> <86y6mpj4fs.fsf@ds4.des.no> <20091101220533.GL1293@hoeg.nl> Message-ID: <86tyxdj2h9.fsf@ds4.des.no> Ed Schouten writes: > > Dag-Erling Sm?rgrav writes: > > identified an individual device handled by that driver. FreeBSD no > > longer makes that distinction; each device has a unique system-wide > > minor number, and the major number is always zero. However, the > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > As pointed out earlier, this is not true. Major numbers can be non-zero. > > | #define major(x) ((int)(((u_int)(x) >> 8)&0xff)) > > Devices 256-511 will have a major number of 1, etc. So: Each device has a unique system-wide device number; the minor number contains the eight least-significant bits, and the major number contains the rest. (device numbers are currently unsigned int; is there a reason not to make them explicitly 32 bits wide, i.e. uint32_t?) > Apart from that, I think there is also a fair amount of overlap with the > COMPATIBILITY section of the same manpage. Yeah, but who reads those? :) DES -- Dag-Erling Sm?rgrav - des@des.no From ed at 80386.nl Sun Nov 1 22:39:49 2009 From: ed at 80386.nl (Ed Schouten) Date: Sun Nov 1 22:40:01 2009 Subject: svn commit: r198768 - head/sbin/mknod In-Reply-To: <86tyxdj2h9.fsf@ds4.des.no> References: <200911011825.nA1IPBQ2031333@svn.freebsd.org> <20091101184322.GP2147@deviant.kiev.zoral.com.ua> <20091101202242.GK1293@hoeg.nl> <86y6mpj4fs.fsf@ds4.des.no> <20091101220533.GL1293@hoeg.nl> <86tyxdj2h9.fsf@ds4.des.no> Message-ID: <20091101223948.GN1293@hoeg.nl> * Dag-Erling Sm?rgrav wrote: > (device numbers are currently unsigned int; is there a reason not to > make them explicitly 32 bits wide, i.e. uint32_t?) I think it should explicitly use dev_t or something, right? -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091101/e72d1a39/attachment.pgp From des at des.no Sun Nov 1 23:59:18 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Sun Nov 1 23:59:25 2009 Subject: svn commit: r198768 - head/sbin/mknod In-Reply-To: <20091101223948.GN1293@hoeg.nl> (Ed Schouten's message of "Sun, 1 Nov 2009 23:39:48 +0100") References: <200911011825.nA1IPBQ2031333@svn.freebsd.org> <20091101184322.GP2147@deviant.kiev.zoral.com.ua> <20091101202242.GK1293@hoeg.nl> <86y6mpj4fs.fsf@ds4.des.no> <20091101220533.GL1293@hoeg.nl> <86tyxdj2h9.fsf@ds4.des.no> <20091101223948.GN1293@hoeg.nl> Message-ID: <86pr81iyp7.fsf@ds4.des.no> Ed Schouten writes: > Dag-Erling Sm?rgrav writes: > > (device numbers are currently unsigned int; is there a reason not to > > make them explicitly 32 bits wide, i.e. uint32_t?) > I think it should explicitly use dev_t or something, right? Ah, I was looking in the wrong header; it is indeed a uint32_t. So: b | c Type of device. Historically, block devices were provided to allow byte-level access to hardware that required data to be read or written in fixed-sized blocks. FreeBSD no longer has block devices, and all device nodes should be created as character devices. However, the distinction between block and character devices is still important when creating device nodes on a filesystem intended for use by older systems. (it's been so long since we dropped block devices that I actually had to look up the details in an old copy of D&I) major, minor Historically, a device number consisted of two parts: the major number, which identified a device driver, and the minor number, which identified an individual device handled by that driver. FreeBSD no longer makes that distinction. Instead, every device in the system has a unique 32-bit device number. For compatibility with software that still expects separate major and minor numbers, this 32-bit device number is split into a 24-bit major number and an 8-bit minor number. However, the distinction between major and minor numbers is still important when creating device nodes on a filesystem intended for use by older systems. DES -- Dag-Erling Sm?rgrav - des@des.no From thompsa at FreeBSD.org Mon Nov 2 03:28:41 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Mon Nov 2 03:29:14 2009 Subject: svn commit: r198748 - in head/sys/cam: . ata scsi In-Reply-To: <1280352d0911011907k34498c71g5b49ffb7220c377b@mail.gmail.com> References: <200911011131.nA1BV6lO022276@svn.freebsd.org> <1280352d0911011907k34498c71g5b49ffb7220c377b@mail.gmail.com> Message-ID: <20091102031318.GB49898@citylink.fud.org.nz> > Author: mav > Date: Sun Nov 1 11:31:06 2009 > New Revision: 198748 > URL: http://svn.freebsd.org/changeset/base/198748 > > Log: > MFp4: > Fix reference counting bug, when device unreferenced before then > invalidated. To do it, do not handle validity flag as another > reference, but explicitly modify reference count each time flag is > modified. There is still one problem with this. In xpt_async() we go through the device list on the target and call the async function followed by xpt_async_bcast(). With the above change its possible for scsi_dev_async() to free the device due to dropping the CAM_DEV_UNCONFIGURED flag, leading to a panic in xpt_async_bcast() on freed memory. This fixes it for me. Index: cam/cam_xpt.c =================================================================== --- cam/cam_xpt.c (revision 198779) +++ cam/cam_xpt.c (working copy) @@ -4023,12 +4023,15 @@ xpt_async(u_int32_t async_code, struct cam_path *p && device->lun_id != CAM_LUN_WILDCARD) continue; + /* The async callback could free the device */ + xpt_acquire_device(device); (*(bus->xport->async))(async_code, bus, target, device, async_arg); xpt_async_bcast(&device->asyncs, async_code, path, async_arg); + xpt_release_device(device); } } From cperciva at FreeBSD.org Mon Nov 2 07:21:14 2009 From: cperciva at FreeBSD.org (Colin Percival) Date: Mon Nov 2 07:21:19 2009 Subject: svn commit: r198781 - head/lib/libc/sys Message-ID: <200911020721.nA27LDq1048764@svn.freebsd.org> Author: cperciva Date: Mon Nov 2 07:21:13 2009 New Revision: 198781 URL: http://svn.freebsd.org/changeset/base/198781 Log: Attempt to reduce accidental foot-shooting by pointing out that accept(2)ed sockets do not necessarily inherit O_NONBLOCK from listening sockets on non-FreeBSD platforms. Feet shot: cperciva MFC after: 1 month Modified: head/lib/libc/sys/accept.2 Modified: head/lib/libc/sys/accept.2 ============================================================================== --- head/lib/libc/sys/accept.2 Mon Nov 2 06:36:54 2009 (r198780) +++ head/lib/libc/sys/accept.2 Mon Nov 2 07:21:13 2009 (r198781) @@ -126,6 +126,10 @@ new socket. For some applications, performance may be enhanced by using an .Xr accept_filter 9 to pre-process incoming connections. +.Pp +Portable programs should not rely on the +.Dv O_NONBLOCK +property being inherited. .Sh RETURN VALUES The call returns \-1 on error. If it succeeds, it returns a non-negative From mav at FreeBSD.org Mon Nov 2 08:31:01 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Mon Nov 2 08:31:07 2009 Subject: svn commit: r198782 - head/sys/cam Message-ID: <200911020831.nA28V0iI050188@svn.freebsd.org> Author: mav Date: Mon Nov 2 08:31:00 2009 New Revision: 198782 URL: http://svn.freebsd.org/changeset/base/198782 Log: The async callback could free the device. If it is a broadcast async, it doesn't hold device reference, so take our own reference. Submitted by: thompsa Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Mon Nov 2 07:21:13 2009 (r198781) +++ head/sys/cam/cam_xpt.c Mon Nov 2 08:31:00 2009 (r198782) @@ -4022,13 +4022,19 @@ xpt_async(u_int32_t async_code, struct c && path->device->lun_id != CAM_LUN_WILDCARD && device->lun_id != CAM_LUN_WILDCARD) continue; - + /* + * The async callback could free the device. + * If it is a broadcast async, it doesn't hold + * device reference, so take our own reference. + */ + xpt_acquire_device(device); (*(bus->xport->async))(async_code, bus, target, device, async_arg); xpt_async_bcast(&device->asyncs, async_code, path, async_arg); + xpt_release_device(device); } } From remko at FreeBSD.org Mon Nov 2 09:56:47 2009 From: remko at FreeBSD.org (Remko Lodder) Date: Mon Nov 2 09:56:58 2009 Subject: svn commit: r198785 - head/etc/rc.d Message-ID: <200911020956.nA29ukQo052099@svn.freebsd.org> Author: remko Date: Mon Nov 2 09:56:46 2009 New Revision: 198785 URL: http://svn.freebsd.org/changeset/base/198785 Log: Execute the start/stop process of a jail in the background. This will prevent that the script hangs during startup, which could cause annoying effects after rebooting for example. PR: kern/139422 Submitted by: Andrey Groshev Approved by: imp (mentor, implicit) MFC after: 3 days Facilitated by: Snow B.V. Modified: head/etc/rc.d/jail Modified: head/etc/rc.d/jail ============================================================================== --- head/etc/rc.d/jail Mon Nov 2 09:47:41 2009 (r198784) +++ head/etc/rc.d/jail Mon Nov 2 09:56:46 2009 (r198785) @@ -728,4 +728,4 @@ fi if [ -n "$*" ]; then jail_list="$*" fi -run_rc_command "${cmd}" +run_rc_command "${cmd}" & From dwmalone at maths.tcd.ie Mon Nov 2 10:04:39 2009 From: dwmalone at maths.tcd.ie (David Malone) Date: Mon Nov 2 10:04:45 2009 Subject: svn commit: r198706 - head/sys/sys In-Reply-To: <20091101011212.GG1293@hoeg.nl> References: <200910311035.n9VAZfIb082932@svn.freebsd.org> <20091031.190353.-332187386.imp@bsdimp.com> <20091101011212.GG1293@hoeg.nl> Message-ID: <20091102100435.GA67211@walton.maths.tcd.ie> On Sun, Nov 01, 2009 at 02:12:12AM +0100, Ed Schouten wrote: > No, we don't. All these fields are not used by drivers, just some old > version of the devfs code. I made sure struct cdevsw didn't change in > size, so there should be no API nor ABI conflicts. Surely it is an API change, but not an ABI change? Code that used to do: d.d_uid = 3; will no longer compile, but code that was comipled with the old version will still run. I understand that the assignment doesn't do anything useful, but I suppose there still could be code that does it? David. From ed at 80386.nl Mon Nov 2 10:24:05 2009 From: ed at 80386.nl (Ed Schouten) Date: Mon Nov 2 10:24:12 2009 Subject: svn commit: r198706 - head/sys/sys In-Reply-To: <20091102100435.GA67211@walton.maths.tcd.ie> References: <200910311035.n9VAZfIb082932@svn.freebsd.org> <20091031.190353.-332187386.imp@bsdimp.com> <20091101011212.GG1293@hoeg.nl> <20091102100435.GA67211@walton.maths.tcd.ie> Message-ID: <20091102102404.GP1293@hoeg.nl> Hello David, * David Malone wrote: > Surely it is an API change, but not an ABI change? Code that used > to do: > > d.d_uid = 3; > > will no longer compile, but code that was comipled with the old > version will still run. I understand that the assignment doesn't > do anything useful, but I suppose there still could be code that > does it? Yes, in theory there could be pieces of code that do that, but keep in mind that d_uid was never meant to be used by device drivers. It was used by devfs internally, before cdevpriv existed. Looking at the SVN logs, it was introduced in March 2005, but it was already rendered useless in September that same year, when devfs was modified to just obtain the ownership/modes from the cdevpriv instead of the cdevsw. Interesting commits: - http://svn.freebsd.org/viewvc/base?view=revision&revision=143746 - http://svn.freebsd.org/viewvc/base?view=revision&revision=150342 -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091102/c136ef04/attachment.pgp From rpaulo at FreeBSD.org Mon Nov 2 11:07:42 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Mon Nov 2 11:10:37 2009 Subject: svn commit: r198786 - in head/sys: compat/ndis dev/if_ndis Message-ID: <200911021107.nA2B7gP4054855@svn.freebsd.org> Author: rpaulo Date: Mon Nov 2 11:07:42 2009 New Revision: 198786 URL: http://svn.freebsd.org/changeset/base/198786 Log: Big style cleanup. While there remove references to FreeBSD versions older than 6.0. Submitted by: Paul B Mahol Modified: head/sys/compat/ndis/kern_ndis.c head/sys/compat/ndis/kern_windrv.c head/sys/compat/ndis/subr_hal.c head/sys/compat/ndis/subr_ndis.c head/sys/compat/ndis/subr_ntoskrnl.c head/sys/compat/ndis/subr_pe.c head/sys/compat/ndis/subr_usbd.c head/sys/dev/if_ndis/if_ndis.c head/sys/dev/if_ndis/if_ndis_usb.c Modified: head/sys/compat/ndis/kern_ndis.c ============================================================================== --- head/sys/compat/ndis/kern_ndis.c Mon Nov 2 09:56:46 2009 (r198785) +++ head/sys/compat/ndis/kern_ndis.c Mon Nov 2 11:07:42 2009 (r198786) @@ -184,7 +184,7 @@ ndis_modevent(module_t mod, int cmd, voi break; } - return(error); + return (error); } DEV_MODULE(ndisapi, ndis_modevent, NULL); MODULE_VERSION(ndisapi, 1); @@ -193,7 +193,6 @@ static void ndis_sendrsrcavail_func(adapter) ndis_handle adapter; { - return; } static void @@ -211,8 +210,7 @@ ndis_status_func(adapter, status, sbuf, sc = device_get_softc(block->nmb_physdeviceobj->do_devext); ifp = sc->ifp; if (ifp->if_flags & IFF_DEBUG) - device_printf (sc->ndis_dev, "status: %x\n", status); - return; + device_printf(sc->ndis_dev, "status: %x\n", status); } static void @@ -227,8 +225,7 @@ ndis_statusdone_func(adapter) sc = device_get_softc(block->nmb_physdeviceobj->do_devext); ifp = sc->ifp; if (ifp->if_flags & IFF_DEBUG) - device_printf (sc->ndis_dev, "status complete\n"); - return; + device_printf(sc->ndis_dev, "status complete\n"); } static void @@ -241,7 +238,6 @@ ndis_setdone_func(adapter, status) block->nmb_setstat = status; KeSetEvent(&block->nmb_setevent, IO_NO_INCREMENT, FALSE); - return; } static void @@ -254,7 +250,6 @@ ndis_getdone_func(adapter, status) block->nmb_getstat = status; KeSetEvent(&block->nmb_getevent, IO_NO_INCREMENT, FALSE); - return; } static void @@ -270,10 +265,8 @@ ndis_resetdone_func(ndis_handle adapter, ifp = sc->ifp; if (ifp->if_flags & IFF_DEBUG) - device_printf (sc->ndis_dev, "reset done...\n"); + device_printf(sc->ndis_dev, "reset done...\n"); KeSetEvent(&block->nmb_resetevent, IO_NO_INCREMENT, FALSE); - - return; } int @@ -287,7 +280,7 @@ ndis_create_sysctls(arg) struct sysctl_ctx_entry *e; if (arg == NULL) - return(EINVAL); + return (EINVAL); sc = arg; vals = sc->ndis_regvals; @@ -367,7 +360,7 @@ ndis_create_sysctls(arg) "Interrupt Number", buf, CTLFLAG_RD); } - return(0); + return (0); } int @@ -388,7 +381,7 @@ ndis_add_sysctl(arg, key, desc, val, fla if (cfg == NULL) { printf("failed for %s\n", key); - return(ENOMEM); + return (ENOMEM); } cfg->ndis_cfg.nc_cfgkey = strdup(key, M_DEVBUF); @@ -415,7 +408,7 @@ ndis_add_sysctl(arg, key, desc, val, fla cfg->ndis_cfg.nc_cfgdesc); #endif - return(0); + return (0); } /* @@ -451,7 +444,7 @@ ndis_flush_sysctls(arg) free(cfg, M_DEVBUF); } - return(0); + return (0); } static void @@ -488,8 +481,6 @@ ndis_return(dobj, arg) KeAcquireSpinLock(&block->nmb_returnlock, &irql); } KeReleaseSpinLock(&block->nmb_returnlock, irql); - - return; } void @@ -522,8 +513,6 @@ ndis_return_packet(buf, arg) IoQueueWorkItem(block->nmb_returnitem, (io_workitem_func)kernndis_functbl[7].ipt_wrap, WORKQUEUE_CRITICAL, block); - - return; } void @@ -540,8 +529,6 @@ ndis_free_bufs(b0) IoFreeMdl(b0); b0 = next; } - - return; } void @@ -553,7 +540,6 @@ ndis_free_packet(p) ndis_free_bufs(p->np_private.npp_head); NdisFreePacket(p); - return; } int @@ -567,26 +553,18 @@ ndis_convert_res(arg) device_t dev; struct resource_list *brl; struct resource_list_entry *brle; -#if __FreeBSD_version < 600022 - struct resource_list brl_rev; - struct resource_list_entry *n; -#endif int error = 0; sc = arg; block = sc->ndis_block; dev = sc->ndis_dev; -#if __FreeBSD_version < 600022 - SLIST_INIT(&brl_rev); -#endif - rl = malloc(sizeof(ndis_resource_list) + (sizeof(cm_partial_resource_desc) * (sc->ndis_rescnt - 1)), M_DEVBUF, M_NOWAIT|M_ZERO); if (rl == NULL) - return(ENOMEM); + return (ENOMEM); rl->cprl_version = 5; rl->cprl_version = 1; @@ -597,37 +575,7 @@ ndis_convert_res(arg) if (brl != NULL) { -#if __FreeBSD_version < 600022 - /* - * We have a small problem. Some PCI devices have - * multiple I/O ranges. Windows orders them starting - * from lowest numbered BAR to highest. We discover - * them in that order too, but insert them into a singly - * linked list head first, which means when time comes - * to traverse the list, we enumerate them in reverse - * order. This screws up some drivers which expect the - * BARs to be in ascending order so that they can choose - * the "first" one as their register space. Unfortunately, - * in order to fix this, we have to create our own - * temporary list with the entries in reverse order. - */ - - SLIST_FOREACH(brle, brl, link) { - n = malloc(sizeof(struct resource_list_entry), - M_TEMP, M_NOWAIT); - if (n == NULL) { - error = ENOMEM; - goto bad; - } - bcopy((char *)brle, (char *)n, - sizeof(struct resource_list_entry)); - SLIST_INSERT_HEAD(&brl_rev, n, link); - } - - SLIST_FOREACH(brle, &brl_rev, link) { -#else STAILQ_FOREACH(brle, brl, link) { -#endif switch (brle->type) { case SYS_RES_IOPORT: prd->cprd_type = CmResourceTypePort; @@ -671,17 +619,7 @@ ndis_convert_res(arg) block->nmb_rlist = rl; -#if __FreeBSD_version < 600022 -bad: - - while (!SLIST_EMPTY(&brl_rev)) { - n = SLIST_FIRST(&brl_rev); - SLIST_REMOVE_HEAD(&brl_rev, link); - free (n, M_TEMP); - } -#endif - - return(error); + return (error); } /* @@ -711,7 +649,7 @@ ndis_ptom(m0, p) int diff; if (p == NULL || m0 == NULL) - return(EINVAL); + return (EINVAL); priv = &p->np_private; buf = priv->npp_head; @@ -729,7 +667,7 @@ ndis_ptom(m0, p) if (m == NULL) { m_freem(*m0); *m0 = NULL; - return(ENOBUFS); + return (ENOBUFS); } m->m_len = MmGetMdlByteCount(buf); m->m_data = MmGetMdlVirtualAddress(buf); @@ -765,7 +703,7 @@ ndis_ptom(m0, p) } (*m0)->m_pkthdr.len = totlen; - return(0); + return (0); } /* @@ -793,7 +731,7 @@ ndis_mtop(m0, p) ndis_packet_private *priv; if (p == NULL || *p == NULL || m0 == NULL) - return(EINVAL); + return (EINVAL); priv = &(*p)->np_private; priv->npp_totlen = m0->m_pkthdr.len; @@ -805,7 +743,7 @@ ndis_mtop(m0, p) if (buf == NULL) { ndis_free_packet(*p); *p = NULL; - return(ENOMEM); + return (ENOMEM); } MmBuildMdlForNonPagedPool(buf); @@ -818,7 +756,7 @@ ndis_mtop(m0, p) priv->npp_tail = buf; - return(0); + return (0); } int @@ -831,25 +769,25 @@ ndis_get_supported_oids(arg, oids, oidcn ndis_oid *o; if (arg == NULL || oids == NULL || oidcnt == NULL) - return(EINVAL); + return (EINVAL); len = 0; ndis_get_info(arg, OID_GEN_SUPPORTED_LIST, NULL, &len); o = malloc(len, M_DEVBUF, M_NOWAIT); if (o == NULL) - return(ENOMEM); + return (ENOMEM); rval = ndis_get_info(arg, OID_GEN_SUPPORTED_LIST, o, &len); if (rval) { free(o, M_DEVBUF); - return(rval); + return (rval); } *oids = o; *oidcnt = len / 4; - return(0); + return (0); } int @@ -893,7 +831,7 @@ ndis_set_info(arg, oid, buf, buflen) sc->ndis_block->nmb_devicectx == NULL) { sc->ndis_block->nmb_pendingreq = NULL; KeReleaseSpinLock(&sc->ndis_block->nmb_lock, irql); - return(ENXIO); + return (ENXIO); } rval = MSCALL6(setfunc, adapter, oid, buf, *buflen, @@ -917,19 +855,19 @@ ndis_set_info(arg, oid, buf, buflen) *buflen = bytesneeded; if (rval == NDIS_STATUS_INVALID_LENGTH) - return(ENOSPC); + return (ENOSPC); if (rval == NDIS_STATUS_INVALID_OID) - return(EINVAL); + return (EINVAL); if (rval == NDIS_STATUS_NOT_SUPPORTED || rval == NDIS_STATUS_NOT_ACCEPTED) - return(ENOTSUP); + return (ENOTSUP); if (rval != NDIS_STATUS_SUCCESS) - return(ENODEV); + return (ENODEV); - return(0); + return (0); } typedef void (*ndis_senddone_func)(ndis_handle, ndis_packet *, ndis_status); @@ -951,7 +889,7 @@ ndis_send_packets(arg, packets, cnt) sc = arg; adapter = sc->ndis_block->nmb_miniportadapterctx; if (adapter == NULL) - return(ENXIO); + return (ENXIO); sendfunc = sc->ndis_chars->nmc_sendmulti_func; senddonefunc = sc->ndis_block->nmb_senddone_func; @@ -976,7 +914,7 @@ ndis_send_packets(arg, packets, cnt) if (NDIS_SERIALIZED(sc->ndis_block)) KeReleaseSpinLock(&sc->ndis_block->nmb_lock, irql); - return(0); + return (0); } int @@ -994,7 +932,7 @@ ndis_send_packet(arg, packet) sc = arg; adapter = sc->ndis_block->nmb_miniportadapterctx; if (adapter == NULL) - return(ENXIO); + return (ENXIO); sendfunc = sc->ndis_chars->nmc_sendsingle_func; senddonefunc = sc->ndis_block->nmb_senddone_func; @@ -1006,7 +944,7 @@ ndis_send_packet(arg, packet) if (status == NDIS_STATUS_PENDING) { if (NDIS_SERIALIZED(sc->ndis_block)) KeReleaseSpinLock(&sc->ndis_block->nmb_lock, irql); - return(0); + return (0); } MSCALL3(senddonefunc, sc->ndis_block, packet, status); @@ -1014,7 +952,7 @@ ndis_send_packet(arg, packet) if (NDIS_SERIALIZED(sc->ndis_block)) KeReleaseSpinLock(&sc->ndis_block->nmb_lock, irql); - return(0); + return (0); } int @@ -1030,18 +968,18 @@ ndis_init_dma(arg) M_DEVBUF, M_NOWAIT|M_ZERO); if (sc->ndis_tmaps == NULL) - return(ENOMEM); + return (ENOMEM); for (i = 0; i < sc->ndis_maxpkts; i++) { error = bus_dmamap_create(sc->ndis_ttag, 0, &sc->ndis_tmaps[i]); if (error) { free(sc->ndis_tmaps, M_DEVBUF); - return(ENODEV); + return (ENODEV); } } - return(0); + return (0); } int @@ -1070,7 +1008,7 @@ ndis_destroy_dma(arg) bus_dma_tag_destroy(sc->ndis_ttag); - return(0); + return (0); } int @@ -1093,7 +1031,7 @@ ndis_reset_nic(arg) if (adapter == NULL || resetfunc == NULL || sc->ndis_block->nmb_devicectx == NULL) { NDIS_UNLOCK(sc); - return(EIO); + return (EIO); } NDIS_UNLOCK(sc); @@ -1112,7 +1050,7 @@ ndis_reset_nic(arg) KeWaitForSingleObject(&sc->ndis_block->nmb_resetevent, 0, 0, FALSE, NULL); - return(0); + return (0); } int @@ -1149,7 +1087,7 @@ ndis_halt_nic(arg) adapter = sc->ndis_block->nmb_miniportadapterctx; if (adapter == NULL) { NDIS_UNLOCK(sc); - return(EIO); + return (EIO); } sc->ndis_block->nmb_devicectx = NULL; @@ -1169,7 +1107,7 @@ ndis_halt_nic(arg) sc->ndis_block->nmb_miniportadapterctx = NULL; NDIS_UNLOCK(sc); - return(0); + return (0); } int @@ -1186,7 +1124,7 @@ ndis_shutdown_nic(arg) shutdownfunc = sc->ndis_chars->nmc_shutdown_handler; NDIS_UNLOCK(sc); if (adapter == NULL || shutdownfunc == NULL) - return(EIO); + return (EIO); if (sc->ndis_chars->nmc_rsvd0 == NULL) MSCALL1(shutdownfunc, adapter); @@ -1195,7 +1133,7 @@ ndis_shutdown_nic(arg) TAILQ_REMOVE(&ndis_devhead, sc->ndis_block, link); - return(0); + return (0); } int @@ -1215,7 +1153,7 @@ ndis_pnpevent_nic(arg, type) pnpeventfunc = sc->ndis_chars->nmc_pnpevent_handler; NDIS_UNLOCK(sc); if (adapter == NULL || pnpeventfunc == NULL) - return(EIO); + return (EIO); if (sc->ndis_chars->nmc_rsvd0 == NULL) MSCALL4(pnpeventfunc, adapter, type, NULL, 0); @@ -1237,7 +1175,7 @@ ndis_init_nic(arg) uint32_t chosenmedium, i; if (arg == NULL) - return(EINVAL); + return (EINVAL); sc = arg; NDIS_LOCK(sc); @@ -1262,7 +1200,7 @@ ndis_init_nic(arg) NDIS_LOCK(sc); sc->ndis_block->nmb_miniportadapterctx = NULL; NDIS_UNLOCK(sc); - return(ENXIO); + return (status); } /* @@ -1281,7 +1219,7 @@ ndis_init_nic(arg) sc->ndis_block->nmb_devicectx = sc; NDIS_UNLOCK(sc); - return(0); + return (0); } static void @@ -1305,8 +1243,6 @@ ndis_intrsetup(dpc, dobj, ip, sc) if (KeInsertQueueDpc(&intr->ni_dpc, NULL, NULL) == TRUE) intr->ni_dpccnt++; KeReleaseSpinLockFromDpcLevel(&intr->ni_dpccountlock); - - return; } int @@ -1343,7 +1279,7 @@ ndis_get_info(arg, oid, buf, buflen) sc->ndis_block->nmb_devicectx == NULL) { sc->ndis_block->nmb_pendingreq = NULL; KeReleaseSpinLock(&sc->ndis_block->nmb_lock, irql); - return(ENXIO); + return (ENXIO); } rval = MSCALL6(queryfunc, adapter, oid, buf, *buflen, @@ -1370,19 +1306,19 @@ ndis_get_info(arg, oid, buf, buflen) if (rval == NDIS_STATUS_INVALID_LENGTH || rval == NDIS_STATUS_BUFFER_TOO_SHORT) - return(ENOSPC); + return (ENOSPC); if (rval == NDIS_STATUS_INVALID_OID) - return(EINVAL); + return (EINVAL); if (rval == NDIS_STATUS_NOT_SUPPORTED || rval == NDIS_STATUS_NOT_ACCEPTED) - return(ENOTSUP); + return (ENOTSUP); if (rval != NDIS_STATUS_SUCCESS) - return(ENODEV); + return (ENODEV); - return(0); + return (0); } uint32_t @@ -1403,14 +1339,14 @@ NdisAddDevice(drv, pdo) INTR_TYPE_NET | INTR_MPSAFE, NULL, ntoskrnl_intr, NULL, &sc->ndis_intrhand); if (error) - return(NDIS_STATUS_FAILURE); + return (NDIS_STATUS_FAILURE); } status = IoCreateDevice(drv, sizeof(ndis_miniport_block), NULL, FILE_DEVICE_UNKNOWN, 0, FALSE, &fdo); if (status != STATUS_SUCCESS) - return(status); + return (status); block = fdo->do_devext; @@ -1446,7 +1382,7 @@ NdisAddDevice(drv, pdo) if (status != NDIS_STATUS_SUCCESS) { IoDetachDevice(block->nmb_nextdeviceobj); IoDeleteDevice(fdo); - return(status); + return (status); } InitializeListHead((&block->nmb_packetlist)); } @@ -1498,5 +1434,5 @@ ndis_unload_driver(arg) IoDetachDevice(sc->ndis_block->nmb_nextdeviceobj); IoDeleteDevice(fdo); - return(0); + return (0); } Modified: head/sys/compat/ndis/kern_windrv.c ============================================================================== --- head/sys/compat/ndis/kern_windrv.c Mon Nov 2 09:56:46 2009 (r198785) +++ head/sys/compat/ndis/kern_windrv.c Mon Nov 2 11:07:42 2009 (r198786) @@ -123,7 +123,7 @@ windrv_libinit(void) panic("failed to allocate thread info blocks"); smp_rendezvous(NULL, x86_newldt, NULL, NULL); #endif - return(0); + return (0); } int @@ -148,7 +148,7 @@ windrv_libfini(void) smp_rendezvous(NULL, x86_oldldt, NULL, NULL); ExFreePool(my_tids); #endif - return(0); + return (0); } /* @@ -172,7 +172,7 @@ windrv_lookup(img, name) if (name != NULL) { RtlInitAnsiString(&as, name); if (RtlAnsiStringToUnicodeString(&us, &as, TRUE)) - return(NULL); + return (NULL); } mtx_lock(&drvdb_mtx); @@ -183,7 +183,7 @@ windrv_lookup(img, name) mtx_unlock(&drvdb_mtx); if (name != NULL) ExFreePool(us.us_buf); - return(d->windrv_object); + return (d->windrv_object); } } mtx_unlock(&drvdb_mtx); @@ -191,7 +191,7 @@ windrv_lookup(img, name) if (name != NULL) RtlFreeUnicodeString(&us); - return(NULL); + return (NULL); } struct drvdb_ent * @@ -209,12 +209,12 @@ windrv_match(matchfunc, ctx) match = matchfunc(d->windrv_bustype, d->windrv_devlist, ctx); if (match == TRUE) { mtx_unlock(&drvdb_mtx); - return(d); + return (d); } } mtx_unlock(&drvdb_mtx); - return(NULL); + return (NULL); } /* @@ -283,7 +283,7 @@ windrv_unload(mod, img, len) return (ENOENT); if (drv == NULL) - return(ENOENT); + return (ENOENT); /* * Destroy any custom extensions that may have been added. @@ -306,7 +306,7 @@ windrv_unload(mod, img, len) /* Free our DB handle */ free(r, M_DEVBUF); - return(0); + return (0); } #define WINDRV_LOADED htonl(0x42534F44) @@ -345,28 +345,28 @@ windrv_load(mod, img, len, bustype, devl /* Perform text relocation */ if (pe_relocate(img)) - return(ENOEXEC); + return (ENOEXEC); /* Dynamically link the NDIS.SYS routines -- required. */ if (pe_patch_imports(img, "NDIS", ndis_functbl)) - return(ENOEXEC); + return (ENOEXEC); /* Dynamically link the HAL.dll routines -- optional. */ if (pe_get_import_descriptor(img, &imp_desc, "HAL") == 0) { if (pe_patch_imports(img, "HAL", hal_functbl)) - return(ENOEXEC); + return (ENOEXEC); } /* Dynamically link ntoskrnl.exe -- optional. */ if (pe_get_import_descriptor(img, &imp_desc, "ntoskrnl") == 0) { if (pe_patch_imports(img, "ntoskrnl", ntoskrnl_functbl)) - return(ENOEXEC); + return (ENOEXEC); } /* Dynamically link USBD.SYS -- optional */ if (pe_get_import_descriptor(img, &imp_desc, "USBD") == 0) { if (pe_patch_imports(img, "USBD", usbd_functbl)) - return(ENOEXEC); + return (ENOEXEC); } *ptr = WINDRV_LOADED; @@ -398,7 +398,7 @@ skipreloc: if (drv->dro_driverext == NULL) { free(new, M_DEVBUF); free(drv, M_DEVBUF); - return(ENOMEM); + return (ENOMEM); } InitializeListHead((&drv->dro_driverext->dre_usrext)); @@ -410,7 +410,7 @@ skipreloc: if (RtlAnsiStringToUnicodeString(&drv->dro_drivername, &as, TRUE)) { free(new, M_DEVBUF); free(drv, M_DEVBUF); - return(ENOMEM); + return (ENOMEM); } new->windrv_object = drv; @@ -426,7 +426,7 @@ skipreloc: RtlFreeUnicodeString(&drv->dro_drivername); free(drv, M_DEVBUF); free(new, M_DEVBUF); - return(ENODEV); + return (ENODEV); } mtx_lock(&drvdb_mtx); @@ -463,7 +463,7 @@ windrv_create_pdo(drv, bsddev) dev->do_devext = bsddev; - return(STATUS_SUCCESS); + return (STATUS_SUCCESS); } void @@ -482,8 +482,6 @@ windrv_destroy_pdo(drv, bsddev) mtx_lock(&drvdb_mtx); IoDeleteDevice(pdo); mtx_unlock(&drvdb_mtx); - - return; } /* @@ -503,13 +501,13 @@ windrv_find_pdo(drv, bsddev) while (pdo != NULL) { if (pdo->do_devext == bsddev) { mtx_unlock(&drvdb_mtx); - return(pdo); + return (pdo); } pdo = pdo->do_nextdev; } mtx_unlock(&drvdb_mtx); - return(NULL); + return (NULL); } /* @@ -533,7 +531,7 @@ windrv_bus_attach(drv, name) if (RtlAnsiStringToUnicodeString(&drv->dro_drivername, &as, TRUE)) { free(new, M_DEVBUF); - return(ENOMEM); + return (ENOMEM); } /* @@ -550,7 +548,7 @@ windrv_bus_attach(drv, name) STAILQ_INSERT_HEAD(&drvdb_head, new, link); mtx_unlock(&drvdb_mtx); - return(0); + return (0); } #ifdef __amd64__ @@ -578,7 +576,7 @@ windrv_wrap(func, wrap, argcnt, ftype) p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT); if (p == NULL) - return(ENOMEM); + return (ENOMEM); /* Copy over the code. */ @@ -591,7 +589,7 @@ windrv_wrap(func, wrap, argcnt, ftype) *wrap = p; - return(0); + return (0); } #endif /* __amd64__ */ @@ -695,8 +693,6 @@ ctxsw_utow(void) x86_critical_exit(); /* Now entering Windows land, population: you. */ - - return; } /* @@ -722,7 +718,6 @@ ctxsw_wtou(void) if (t->tid_cpu != curthread->td_oncpu) panic("ctxsw GOT MOVED TO OTHER CPU!"); #endif - return; } static int windrv_wrap_stdcall(funcptr, funcptr *, int); @@ -754,7 +749,7 @@ windrv_wrap_fastcall(func, wrap, argcnt) p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT); if (p == NULL) - return(ENOMEM); + return (ENOMEM); /* Copy over the code. */ @@ -774,7 +769,7 @@ windrv_wrap_fastcall(func, wrap, argcnt) *wrap = p; - return(0); + return (0); } extern void x86_stdcall_wrap(void); @@ -802,7 +797,7 @@ windrv_wrap_stdcall(func, wrap, argcnt) p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT); if (p == NULL) - return(ENOMEM); + return (ENOMEM); /* Copy over the code. */ @@ -818,7 +813,7 @@ windrv_wrap_stdcall(func, wrap, argcnt) *wrap = p; - return(0); + return (0); } extern void x86_regparm_wrap(void); @@ -842,7 +837,7 @@ windrv_wrap_regparm(func, wrap) p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT); if (p == NULL) - return(ENOMEM); + return (ENOMEM); /* Copy over the code. */ @@ -855,7 +850,7 @@ windrv_wrap_regparm(func, wrap) *wrap = p; - return(0); + return (0); } int @@ -867,18 +862,18 @@ windrv_wrap(func, wrap, argcnt, ftype) { switch(ftype) { case WINDRV_WRAP_FASTCALL: - return(windrv_wrap_fastcall(func, wrap, argcnt)); + return (windrv_wrap_fastcall(func, wrap, argcnt)); case WINDRV_WRAP_STDCALL: - return(windrv_wrap_stdcall(func, wrap, argcnt)); + return (windrv_wrap_stdcall(func, wrap, argcnt)); case WINDRV_WRAP_REGPARM: - return(windrv_wrap_regparm(func, wrap)); + return (windrv_wrap_regparm(func, wrap)); case WINDRV_WRAP_CDECL: - return(windrv_wrap_stdcall(func, wrap, 0)); + return (windrv_wrap_stdcall(func, wrap, 0)); default: break; } - return(EINVAL); + return (EINVAL); } static void @@ -909,8 +904,6 @@ x86_oldldt(dummy) x86_setldt(>able, ltable); mtx_unlock_spin(&dt_lock); - - return; } static void @@ -959,8 +952,6 @@ x86_newldt(dummy) mtx_unlock_spin(&dt_lock); /* Whew. */ - - return; } #endif /* __i386__ */ @@ -971,5 +962,5 @@ windrv_unwrap(func) { free(func, M_DEVBUF); - return(0); + return (0); } Modified: head/sys/compat/ndis/subr_hal.c ============================================================================== --- head/sys/compat/ndis/subr_hal.c Mon Nov 2 09:56:46 2009 (r198785) +++ head/sys/compat/ndis/subr_hal.c Mon Nov 2 11:07:42 2009 (r198786) @@ -102,8 +102,7 @@ hal_libinit() patch++; } - - return(0); + return (0); } int @@ -121,7 +120,7 @@ hal_libfini() patch++; } - return(0); + return (0); } static void @@ -129,7 +128,6 @@ KeStallExecutionProcessor(usecs) uint32_t usecs; { DELAY(usecs); - return; } static void @@ -138,21 +136,18 @@ WRITE_PORT_ULONG(port, val) uint32_t val; { bus_space_write_4(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val); - return; } static void WRITE_PORT_USHORT(uint16_t *port, uint16_t val) { bus_space_write_2(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val); - return; } static void WRITE_PORT_UCHAR(uint8_t *port, uint8_t val) { bus_space_write_1(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val); - return; } static void @@ -163,7 +158,6 @@ WRITE_PORT_BUFFER_ULONG(port, val, cnt) { bus_space_write_multi_4(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val, cnt); - return; } static void @@ -174,7 +168,6 @@ WRITE_PORT_BUFFER_USHORT(port, val, cnt) { bus_space_write_multi_2(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val, cnt); - return; } static void @@ -185,28 +178,27 @@ WRITE_PORT_BUFFER_UCHAR(port, val, cnt) { bus_space_write_multi_1(NDIS_BUS_SPACE_IO, 0x0, (bus_size_t)port, val, cnt); - return; } static uint16_t READ_PORT_USHORT(port) uint16_t *port; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From remko at FreeBSD.org Mon Nov 2 12:03:05 2009 From: remko at FreeBSD.org (Remko Lodder) Date: Mon Nov 2 12:03:20 2009 Subject: svn commit: r198787 - head/share/man/man5 Message-ID: <200911021203.nA2C34EL056037@svn.freebsd.org> Author: remko Date: Mon Nov 2 12:03:04 2009 New Revision: 198787 URL: http://svn.freebsd.org/changeset/base/198787 Log: Document the WWWSUPFILE variable. PR: 137723 Submitted by: Sofian Brabez Approved by: imp (mentor, implicit) MFC after: 3 days Facilitated by: Snow B.V. Modified: head/share/man/man5/make.conf.5 Modified: head/share/man/man5/make.conf.5 ============================================================================== --- head/share/man/man5/make.conf.5 Mon Nov 2 11:07:42 2009 (r198786) +++ head/share/man/man5/make.conf.5 Mon Nov 2 12:03:04 2009 (r198787) @@ -318,6 +318,14 @@ Set this to use .Xr cvsup 1 to update your ports with .Dq Li "make update" . +.It Va WWWSUPFILE +.Pq Vt str +The www +.Ar supfile +to use when doing a +.Dq Li "make update" +This defaults to +.Pa /usr/share/examples/cvsup/www\-supfile . .El .Ss "BUILDING THE KERNEL" The following list provides a name and short description for variables From brueffer at FreeBSD.org Mon Nov 2 12:35:39 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Mon Nov 2 12:35:46 2009 Subject: svn commit: r198788 - in head: bin/getfacl lib/libc/gen lib/libpmc share/man/man4 share/man/man5 share/man/man7 usr.bin/tail usr.sbin/i2c usr.sbin/nfsd usr.sbin/wake Message-ID: <200911021235.nA2CZc1R056811@svn.freebsd.org> Author: brueffer Date: Mon Nov 2 12:35:38 2009 New Revision: 198788 URL: http://svn.freebsd.org/changeset/base/198788 Log: Use our canonical .Dd format. Submitted by: Ulrich Spoerlein Modified: head/bin/getfacl/getfacl.1 head/lib/libc/gen/posix_spawn.3 head/lib/libc/gen/posix_spawn_file_actions_addopen.3 head/lib/libc/gen/posix_spawn_file_actions_init.3 head/lib/libc/gen/posix_spawnattr_getflags.3 head/lib/libc/gen/posix_spawnattr_getpgroup.3 head/lib/libc/gen/posix_spawnattr_getschedparam.3 head/lib/libc/gen/posix_spawnattr_getschedpolicy.3 head/lib/libc/gen/posix_spawnattr_getsigdefault.3 head/lib/libc/gen/posix_spawnattr_getsigmask.3 head/lib/libc/gen/posix_spawnattr_init.3 head/lib/libpmc/pmc_attach.3 head/share/man/man4/tty.4 head/share/man/man5/ar.5 head/share/man/man5/msdosfs.5 head/share/man/man7/adding_user.7 head/usr.bin/tail/tail.1 head/usr.sbin/i2c/i2c.8 head/usr.sbin/nfsd/stablerestart.5 head/usr.sbin/wake/wake.8 Modified: head/bin/getfacl/getfacl.1 ============================================================================== --- head/bin/getfacl/getfacl.1 Mon Nov 2 12:03:04 2009 (r198787) +++ head/bin/getfacl/getfacl.1 Mon Nov 2 12:35:38 2009 (r198788) @@ -30,7 +30,7 @@ .\" Developed by the TrustedBSD Project. .\" Support for POSIX.1e access control lists. .\" -.Dd September 04, 2009 +.Dd September 4, 2009 .Dt GETFACL 1 .Os .Sh NAME Modified: head/lib/libc/gen/posix_spawn.3 ============================================================================== --- head/lib/libc/gen/posix_spawn.3 Mon Nov 2 12:03:04 2009 (r198787) +++ head/lib/libc/gen/posix_spawn.3 Mon Nov 2 12:35:38 2009 (r198788) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Mar 24, 2008 +.Dd March 24, 2008 .Dt POSIX_SPAWN 3 .Os .Sh NAME Modified: head/lib/libc/gen/posix_spawn_file_actions_addopen.3 ============================================================================== --- head/lib/libc/gen/posix_spawn_file_actions_addopen.3 Mon Nov 2 12:03:04 2009 (r198787) +++ head/lib/libc/gen/posix_spawn_file_actions_addopen.3 Mon Nov 2 12:35:38 2009 (r198788) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Mar 24, 2008 +.Dd March 24, 2008 .Dt POSIX_SPAWN_FILE_ACTIONS_ADDOPEN 3 .Os .Sh NAME Modified: head/lib/libc/gen/posix_spawn_file_actions_init.3 ============================================================================== --- head/lib/libc/gen/posix_spawn_file_actions_init.3 Mon Nov 2 12:03:04 2009 (r198787) +++ head/lib/libc/gen/posix_spawn_file_actions_init.3 Mon Nov 2 12:35:38 2009 (r198788) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Mar 24, 2008 +.Dd March 24, 2008 .Dt POSIX_SPAWN_FILE_ACTIONS_INIT 3 .Os .Sh NAME Modified: head/lib/libc/gen/posix_spawnattr_getflags.3 ============================================================================== --- head/lib/libc/gen/posix_spawnattr_getflags.3 Mon Nov 2 12:03:04 2009 (r198787) +++ head/lib/libc/gen/posix_spawnattr_getflags.3 Mon Nov 2 12:35:38 2009 (r198788) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Mar 24, 2008 +.Dd March 24, 2008 .Dt POSIX_SPAWNATTR_GETFLAGS 3 .Os .Sh NAME Modified: head/lib/libc/gen/posix_spawnattr_getpgroup.3 ============================================================================== --- head/lib/libc/gen/posix_spawnattr_getpgroup.3 Mon Nov 2 12:03:04 2009 (r198787) +++ head/lib/libc/gen/posix_spawnattr_getpgroup.3 Mon Nov 2 12:35:38 2009 (r198788) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Mar 24, 2008 +.Dd March 24, 2008 .Dt POSIX_SPAWNATTR_GETPGROUP 3 .Os .Sh NAME Modified: head/lib/libc/gen/posix_spawnattr_getschedparam.3 ============================================================================== --- head/lib/libc/gen/posix_spawnattr_getschedparam.3 Mon Nov 2 12:03:04 2009 (r198787) +++ head/lib/libc/gen/posix_spawnattr_getschedparam.3 Mon Nov 2 12:35:38 2009 (r198788) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Mar 24, 2008 +.Dd March 24, 2008 .Dt POSIX_SPAWNATTR_GETSCHEDPARAM 3 .Os .Sh NAME Modified: head/lib/libc/gen/posix_spawnattr_getschedpolicy.3 ============================================================================== --- head/lib/libc/gen/posix_spawnattr_getschedpolicy.3 Mon Nov 2 12:03:04 2009 (r198787) +++ head/lib/libc/gen/posix_spawnattr_getschedpolicy.3 Mon Nov 2 12:35:38 2009 (r198788) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Mar 24, 2008 +.Dd March 24, 2008 .Dt POSIX_SPAWNATTR_GETSCHEDPOLICY 3 .Os .Sh NAME Modified: head/lib/libc/gen/posix_spawnattr_getsigdefault.3 ============================================================================== --- head/lib/libc/gen/posix_spawnattr_getsigdefault.3 Mon Nov 2 12:03:04 2009 (r198787) +++ head/lib/libc/gen/posix_spawnattr_getsigdefault.3 Mon Nov 2 12:35:38 2009 (r198788) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Mar 24, 2008 +.Dd March 24, 2008 .Dt POSIX_SPAWNATTR_GETSIGDEFAULT 3 .Os .Sh NAME Modified: head/lib/libc/gen/posix_spawnattr_getsigmask.3 ============================================================================== --- head/lib/libc/gen/posix_spawnattr_getsigmask.3 Mon Nov 2 12:03:04 2009 (r198787) +++ head/lib/libc/gen/posix_spawnattr_getsigmask.3 Mon Nov 2 12:35:38 2009 (r198788) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Mar 24, 2008 +.Dd March 24, 2008 .Dt POSIX_SPAWNATTR_GETSIGMASK 3 .Os .Sh NAME Modified: head/lib/libc/gen/posix_spawnattr_init.3 ============================================================================== --- head/lib/libc/gen/posix_spawnattr_init.3 Mon Nov 2 12:03:04 2009 (r198787) +++ head/lib/libc/gen/posix_spawnattr_init.3 Mon Nov 2 12:35:38 2009 (r198788) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Mar 24, 2008 +.Dd March 24, 2008 .Dt POSIX_SPAWNATTR_INIT 3 .Os .Sh NAME Modified: head/lib/libpmc/pmc_attach.3 ============================================================================== --- head/lib/libpmc/pmc_attach.3 Mon Nov 2 12:03:04 2009 (r198787) +++ head/lib/libpmc/pmc_attach.3 Mon Nov 2 12:35:38 2009 (r198788) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 25 2007 +.Dd November 25, 2007 .Os .Dt PMC_ATTACH 3 .Sh NAME Modified: head/share/man/man4/tty.4 ============================================================================== --- head/share/man/man4/tty.4 Mon Nov 2 12:03:04 2009 (r198787) +++ head/share/man/man4/tty.4 Mon Nov 2 12:35:38 2009 (r198788) @@ -32,7 +32,7 @@ .\" @(#)tty.4 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd Jun 27, 2007 +.Dd June 27, 2007 .Dt TTY 4 .Os .Sh NAME Modified: head/share/man/man5/ar.5 ============================================================================== --- head/share/man/man5/ar.5 Mon Nov 2 12:03:04 2009 (r198787) +++ head/share/man/man5/ar.5 Mon Nov 2 12:35:38 2009 (r198788) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 07, 2007 +.Dd September 7, 2007 .Os .Dt AR 5 .Sh NAME Modified: head/share/man/man5/msdosfs.5 ============================================================================== --- head/share/man/man5/msdosfs.5 Mon Nov 2 12:03:04 2009 (r198787) +++ head/share/man/man5/msdosfs.5 Mon Nov 2 12:35:38 2009 (r198788) @@ -2,7 +2,7 @@ .\" Written by Tom Rhodes .\" This file is in the public domain. .\" -.Dd Aug 22, 2007 +.Dd August 22, 2007 .Dt MSDOSFS 5 .Os .Sh NAME Modified: head/share/man/man7/adding_user.7 ============================================================================== --- head/share/man/man7/adding_user.7 Mon Nov 2 12:03:04 2009 (r198787) +++ head/share/man/man7/adding_user.7 Mon Nov 2 12:35:38 2009 (r198788) @@ -32,7 +32,7 @@ .\" @(#)adduser.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd Jan 30, 2009 +.Dd January 30, 2009 .Dt ADDING_USER 8 .Os .Sh NAME Modified: head/usr.bin/tail/tail.1 ============================================================================== --- head/usr.bin/tail/tail.1 Mon Nov 2 12:03:04 2009 (r198787) +++ head/usr.bin/tail/tail.1 Mon Nov 2 12:35:38 2009 (r198788) @@ -35,7 +35,7 @@ .\" @(#)tail.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 05, 2009 +.Dd June 5, 2009 .Dt TAIL 1 .Os .Sh NAME Modified: head/usr.sbin/i2c/i2c.8 ============================================================================== --- head/usr.sbin/i2c/i2c.8 Mon Nov 2 12:03:04 2009 (r198787) +++ head/usr.sbin/i2c/i2c.8 Mon Nov 2 12:35:38 2009 (r198788) @@ -26,7 +26,7 @@ .\" $FreeBSD$ .\" -.Dd Jan 23, 2009 +.Dd January 23, 2009 .Dt I2C 8 .Os .Sh NAME Modified: head/usr.sbin/nfsd/stablerestart.5 ============================================================================== --- head/usr.sbin/nfsd/stablerestart.5 Mon Nov 2 12:03:04 2009 (r198787) +++ head/usr.sbin/nfsd/stablerestart.5 Mon Nov 2 12:35:38 2009 (r198788) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Sept 7, 2007 +.Dd September 7, 2007 .Dt STABLERESTART 5 .Os .Sh NAME Modified: head/usr.sbin/wake/wake.8 ============================================================================== --- head/usr.sbin/wake/wake.8 Mon Nov 2 12:03:04 2009 (r198787) +++ head/usr.sbin/wake/wake.8 Mon Nov 2 12:35:38 2009 (r198788) @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd June 27 2009 +.Dd June 27, 2009 .Dt WAKE 8 .Os .Sh NAME From rwatson at FreeBSD.org Mon Nov 2 15:00:40 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Nov 2 15:00:51 2009 Subject: svn commit: r198781 - head/lib/libc/sys In-Reply-To: <200911020721.nA27LDq1048764@svn.freebsd.org> References: <200911020721.nA27LDq1048764@svn.freebsd.org> Message-ID: On Mon, 2 Nov 2009, Colin Percival wrote: > Attempt to reduce accidental foot-shooting by pointing out that > accept(2)ed sockets do not necessarily inherit O_NONBLOCK from > listening sockets on non-FreeBSD platforms. I wonder how much trouble we should go to to document bugs in other systems as non-portabilities for features that work in our system. This bug in Linux was brought to my attention recently: SO_RCVLOWAT and SO_SNDLOWAT Specify the minimum number of bytes in the buffer until the socket layer will pass the data to the protocol (SO_SNDLOWAT) or the user on receiving (SO_RCVLOWAT). These two values are ini? tialized to 1. SO_SNDLOWAT is not changeable on Linux (setsock? opt(2) fails with the error ENOPROTOOPT). SO_RCVLOWAT is changeable only since Linux 2.4. The select(2) and poll(2) sys? tem calls currently do not respect the SO_RCVLOWAT setting on Linux, and mark a socket readable when even a single byte of data is available. A subsequent read from the socket will block until SO_RCVLOWAT bytes are available. I think a more general caution for accept(2) might instead be: BUGS The inheritence of socket options from a listen socket to a newly accepted socket is inconsistent across protocols, and non-portable. Robert > > Feet shot: cperciva > MFC after: 1 month > > Modified: > head/lib/libc/sys/accept.2 > > Modified: head/lib/libc/sys/accept.2 > ============================================================================== > --- head/lib/libc/sys/accept.2 Mon Nov 2 06:36:54 2009 (r198780) > +++ head/lib/libc/sys/accept.2 Mon Nov 2 07:21:13 2009 (r198781) > @@ -126,6 +126,10 @@ new socket. > For some applications, performance may be enhanced by using an > .Xr accept_filter 9 > to pre-process incoming connections. > +.Pp > +Portable programs should not rely on the > +.Dv O_NONBLOCK > +property being inherited. > .Sh RETURN VALUES > The call returns \-1 on error. > If it succeeds, it returns a non-negative > From rnoland at FreeBSD.org Mon Nov 2 15:09:04 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Mon Nov 2 15:09:16 2009 Subject: svn commit: r198781 - head/lib/libc/sys In-Reply-To: References: <200911020721.nA27LDq1048764@svn.freebsd.org> Message-ID: <1257174533.73292.10.camel@balrog.2hip.net> On Mon, 2009-11-02 at 15:00 +0000, Robert Watson wrote: > On Mon, 2 Nov 2009, Colin Percival wrote: > > > Attempt to reduce accidental foot-shooting by pointing out that > > accept(2)ed sockets do not necessarily inherit O_NONBLOCK from > > listening sockets on non-FreeBSD platforms. > > I wonder how much trouble we should go to to document bugs in other systems as > non-portabilities for features that work in our system. This bug in Linux was > brought to my attention recently: > > SO_RCVLOWAT and SO_SNDLOWAT > Specify the minimum number of bytes in the buffer until the > socket layer will pass the data to the protocol (SO_SNDLOWAT) or > the user on receiving (SO_RCVLOWAT). These two values are ini? > tialized to 1. SO_SNDLOWAT is not changeable on Linux (setsock? > opt(2) fails with the error ENOPROTOOPT). SO_RCVLOWAT is > changeable only since Linux 2.4. The select(2) and poll(2) sys? > tem calls currently do not respect the SO_RCVLOWAT setting on > Linux, and mark a socket readable when even a single byte of > data is available. A subsequent read from the socket will block > until SO_RCVLOWAT bytes are available. > > I think a more general caution for accept(2) might instead be: > > BUGS > The inheritence of socket options from a listen socket to a newly > accepted socket is inconsistent across protocols, and non-portable. I don't think we have any business documenting what linux does or does not do. As much as I would hate to see someone wasting time finding this linux bug, we should only document our own behavior. Hopefully we at least have a hope of keeping that information accurate. robert. > Robert > > > > > Feet shot: cperciva > > MFC after: 1 month > > > > Modified: > > head/lib/libc/sys/accept.2 > > > > Modified: head/lib/libc/sys/accept.2 > > ============================================================================== > > --- head/lib/libc/sys/accept.2 Mon Nov 2 06:36:54 2009 (r198780) > > +++ head/lib/libc/sys/accept.2 Mon Nov 2 07:21:13 2009 (r198781) > > @@ -126,6 +126,10 @@ new socket. > > For some applications, performance may be enhanced by using an > > .Xr accept_filter 9 > > to pre-process incoming connections. > > +.Pp > > +Portable programs should not rely on the > > +.Dv O_NONBLOCK > > +property being inherited. > > .Sh RETURN VALUES > > The call returns \-1 on error. > > If it succeeds, it returns a non-negative > > -- Robert Noland FreeBSD From imp at bsdimp.com Mon Nov 2 15:51:09 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Mon Nov 2 15:51:15 2009 Subject: svn commit: r198706 - head/sys/sys In-Reply-To: <20091102102404.GP1293@hoeg.nl> References: <20091101011212.GG1293@hoeg.nl> <20091102100435.GA67211@walton.maths.tcd.ie> <20091102102404.GP1293@hoeg.nl> Message-ID: <20091102.084616.-1258100553.imp@bsdimp.com> In message: <20091102102404.GP1293@hoeg.nl> Ed Schouten writes: : Hello David, : : * David Malone wrote: : > Surely it is an API change, but not an ABI change? Code that used : > to do: : > : > d.d_uid = 3; : > : > will no longer compile, but code that was comipled with the old : > version will still run. I understand that the assignment doesn't : > do anything useful, but I suppose there still could be code that : > does it? : : Yes, in theory there could be pieces of code that do that, but keep in : mind that d_uid was never meant to be used by device drivers. It was : used by devfs internally, before cdevpriv existed. : : Looking at the SVN logs, it was introduced in March 2005, but it was : already rendered useless in September that same year, when devfs was : modified to just obtain the ownership/modes from the cdevpriv instead of : the cdevsw. : : Interesting commits: : : - http://svn.freebsd.org/viewvc/base?view=revision&revision=143746 : - http://svn.freebsd.org/viewvc/base?view=revision&revision=150342 True, but you've now spent way more time than a version bump would have taken on this. The first of these also does a version bump. :) And you haven't answered my question: Have you confirmed that there's no ABI changes on all platforms? Warner From ed at 80386.nl Mon Nov 2 15:54:15 2009 From: ed at 80386.nl (Ed Schouten) Date: Mon Nov 2 15:54:21 2009 Subject: svn commit: r198706 - head/sys/sys In-Reply-To: <20091102.084616.-1258100553.imp@bsdimp.com> References: <20091101011212.GG1293@hoeg.nl> <20091102100435.GA67211@walton.maths.tcd.ie> <20091102102404.GP1293@hoeg.nl> <20091102.084616.-1258100553.imp@bsdimp.com> Message-ID: <20091102155414.GR1293@hoeg.nl> * M. Warner Losh wrote: > And you haven't answered my question: Have you confirmed that there's > no ABI changes on all platforms? Confirmed on all platforms? No. I've only tested it on i386 and amd64. I think someone also tested it on arm, so this makes me believe other architectures will also work as expected. -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091102/a12e2e77/attachment.pgp From ivoras at FreeBSD.org Mon Nov 2 16:56:59 2009 From: ivoras at FreeBSD.org (Ivan Voras) Date: Mon Nov 2 16:57:39 2009 Subject: svn commit: r198811 - head/sys/vm Message-ID: <200911021656.nA2GuxK1063687@svn.freebsd.org> Author: ivoras Date: Mon Nov 2 16:56:59 2009 New Revision: 198811 URL: http://svn.freebsd.org/changeset/base/198811 Log: Add sysctl documentation strings. The descriptions are derived from tuning(7). One of the descriptions references tuning(7) because it is too complex to adequatly describe here (it is not a simple boolean sysctl) and users should be warned to that. Reviewed by: alc, kib Approved by: gnn (mentor) Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Mon Nov 2 16:55:33 2009 (r198810) +++ head/sys/vm/swap_pager.c Mon Nov 2 16:56:59 2009 (r198811) @@ -155,11 +155,15 @@ int swap_pager_avail; static int swdev_syscall_active = 0; /* serialize swap(on|off) */ static vm_ooffset_t swap_total; -SYSCTL_QUAD(_vm, OID_AUTO, swap_total, CTLFLAG_RD, &swap_total, 0, ""); +SYSCTL_QUAD(_vm, OID_AUTO, swap_total, CTLFLAG_RD, &swap_total, 0, + "Total amount of available swap storage."); static vm_ooffset_t swap_reserved; -SYSCTL_QUAD(_vm, OID_AUTO, swap_reserved, CTLFLAG_RD, &swap_reserved, 0, ""); +SYSCTL_QUAD(_vm, OID_AUTO, swap_reserved, CTLFLAG_RD, &swap_reserved, 0, + "Amount of swap storage needed to back all allocated anonymous memory."); static int overcommit = 0; -SYSCTL_INT(_vm, OID_AUTO, overcommit, CTLFLAG_RW, &overcommit, 0, ""); +SYSCTL_INT(_vm, OID_AUTO, overcommit, CTLFLAG_RW, &overcommit, 0, + "Configure virtual memory overcommit behavior. See tuning(7) " + "for details."); /* bits from overcommit */ #define SWAP_RESERVE_FORCE_ON (1 << 0) From alc at FreeBSD.org Mon Nov 2 17:45:40 2009 From: alc at FreeBSD.org (Alan Cox) Date: Mon Nov 2 17:46:07 2009 Subject: svn commit: r198812 - head/sys/vm Message-ID: <200911021745.nA2Hjewx064713@svn.freebsd.org> Author: alc Date: Mon Nov 2 17:45:39 2009 New Revision: 198812 URL: http://svn.freebsd.org/changeset/base/198812 Log: Avoid pointless calls to pmap_protect(). Reviewed by: kib Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Mon Nov 2 16:56:59 2009 (r198811) +++ head/sys/vm/vm_map.c Mon Nov 2 17:45:39 2009 (r198812) @@ -1914,10 +1914,10 @@ vm_map_protect(vm_map_t map, vm_offset_t } /* - * Update physical map if necessary. Worry about copy-on-write - * here. + * When restricting access, update the physical map. Worry + * about copy-on-write here. */ - if (current->protection != old_prot) { + if ((old_prot & ~current->protection) != 0) { #define MASK(entry) (((entry)->eflags & MAP_ENTRY_COW) ? ~VM_PROT_WRITE : \ VM_PROT_ALL) pmap_protect(map->pmap, current->start, From xcllnt at mac.com Mon Nov 2 18:08:21 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Mon Nov 2 18:08:26 2009 Subject: svn commit: r198706 - head/sys/sys In-Reply-To: <20091102155414.GR1293@hoeg.nl> References: <20091101011212.GG1293@hoeg.nl> <20091102100435.GA67211@walton.maths.tcd.ie> <20091102102404.GP1293@hoeg.nl> <20091102.084616.-1258100553.imp@bsdimp.com> <20091102155414.GR1293@hoeg.nl> Message-ID: On Nov 2, 2009, at 7:54 AM, Ed Schouten wrote: > * M. Warner Losh wrote: >> And you haven't answered my question: Have you confirmed that there's >> no ABI changes on all platforms? > > Confirmed on all platforms? No. I've only tested it on i386 and > amd64. I > think someone also tested it on arm, so this makes me believe other > architectures will also work as expected. When you bank on alignment, don't just test i386 and amd64. Please put in the extra effort to contact platform owners to give you a thumbs up. While I'm responding: please do a version bump as Warner suggested. The pain of needing one without having done so, is infinitely more than the effort or repo bloat can be together. Oh, and no, I don't think this changes the ABI :-) For a change that does change the ABI: revision 198506 tcsh(1) dumps core with a sig 11... Trick or treat... -- Marcel Moolenaar xcllnt@mac.com From yongari at FreeBSD.org Mon Nov 2 18:15:11 2009 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Mon Nov 2 18:15:23 2009 Subject: svn commit: r198813 - head/sys/dev/mii Message-ID: <200911021815.nA2IFBPr065404@svn.freebsd.org> Author: yongari Date: Mon Nov 2 18:15:11 2009 New Revision: 198813 URL: http://svn.freebsd.org/changeset/base/198813 Log: Add BCM5761 PHY id. Modified: head/sys/dev/mii/brgphy.c head/sys/dev/mii/miidevs Modified: head/sys/dev/mii/brgphy.c ============================================================================== --- head/sys/dev/mii/brgphy.c Mon Nov 2 17:45:39 2009 (r198812) +++ head/sys/dev/mii/brgphy.c Mon Nov 2 18:15:11 2009 (r198813) @@ -134,6 +134,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709CAX), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5722), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709C), + MII_PHY_DESC(xxBROADCOM_ALT1, BCM5761), MII_PHY_DESC(BROADCOM2, BCM5906), MII_PHY_END }; Modified: head/sys/dev/mii/miidevs ============================================================================== --- head/sys/dev/mii/miidevs Mon Nov 2 17:45:39 2009 (r198812) +++ head/sys/dev/mii/miidevs Mon Nov 2 18:15:11 2009 (r198813) @@ -154,6 +154,7 @@ model xxBROADCOM_ALT1 BCM5708S 0x0015 BC model xxBROADCOM_ALT1 BCM5709CAX 0x002c BCM5709C(AX) 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5722 0x002d BCM5722 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5709C 0x003c BCM5709C 10/100/1000baseTX PHY +model xxBROADCOM_ALT1 BCM5761 0x003d BCM5761 10/100/1000baseTX PHY model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX PHY /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ From cperciva at freebsd.org Mon Nov 2 18:20:25 2009 From: cperciva at freebsd.org (Colin Percival) Date: Mon Nov 2 18:20:31 2009 Subject: svn commit: r198781 - head/lib/libc/sys In-Reply-To: References: <200911020721.nA27LDq1048764@svn.freebsd.org> Message-ID: <4AEF22E3.5070701@freebsd.org> Robert Watson wrote: > On Mon, 2 Nov 2009, Colin Percival wrote: >> Attempt to reduce accidental foot-shooting by pointing out that >> accept(2)ed sockets do not necessarily inherit O_NONBLOCK from >> listening sockets on non-FreeBSD platforms. > > I wonder how much trouble we should go to to document bugs in other > systems as non-portabilities for features that work in our system. I don't think there's any simple rule to apply here except "use common sense". One can argue that FreeBSD man pages exist for the purpose of documenting FreeBSD; but I'd also like to think that FreeBSD is a good development platform for writing portable applications, so alerting our users to potentially non-portable code certainly has some value. (And there are many other examples of "portable programs should not..." in our man pages, not just the one I added.) The non-portability I just documented was a particularly obnoxious one, since in event-driven code it can go unnoticed for a long time -- as I just recently discovered. > I think a more general caution for accept(2) might instead be: > > BUGS > The inheritence of socket options from a listen socket to a newly > accepted socket is inconsistent across protocols, and non-portable. I was originally going to write it that way, but when I looked at the existing text I saw that it only mentioned inheriting O_NONBLOCK and said nothing about other options -- so I figured that it was appropriate to follow suit and only mention O_NONBLOCK in saying what was non-portable. -- Colin Percival Security Officer, FreeBSD | freebsd.org | The power to serve Founder / author, Tarsnap | tarsnap.com | Online backups for the truly paranoid From rwatson at FreeBSD.org Mon Nov 2 18:29:16 2009 From: rwatson at FreeBSD.org (Robert N. M. Watson) Date: Mon Nov 2 18:29:23 2009 Subject: svn commit: r198781 - head/lib/libc/sys In-Reply-To: <4AEF22E3.5070701@freebsd.org> References: <200911020721.nA27LDq1048764@svn.freebsd.org> <4AEF22E3.5070701@freebsd.org> Message-ID: On 2 Nov 2009, at 18:20, Colin Percival wrote: >> I think a more general caution for accept(2) might instead be: >> >> BUGS >> The inheritence of socket options from a listen socket to a newly >> accepted socket is inconsistent across protocols, and non- >> portable. > > I was originally going to write it that way, but when I looked at the > existing text I saw that it only mentioned inheriting O_NONBLOCK and > said > nothing about other options -- so I figured that it was appropriate to > follow suit and only mention O_NONBLOCK in saying what was non- > portable. We preserve a number of socket options and other properties across accept(2), but not all. For example, we do preserve most socket-level options, linger state, routing fib number, and socket buffer sizing/ watermarks, as well as many connection properties such as TCP_NODELAY. However, if history is anything to go by, we also fail to preserve quite a few properties, and we've had a number of bug fixes over the years topping up the list of things inherited over accept. Robert From yongari at FreeBSD.org Mon Nov 2 18:35:07 2009 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Mon Nov 2 18:35:19 2009 Subject: svn commit: r198814 - head/sys/dev/re Message-ID: <200911021835.nA2IZ6WI065996@svn.freebsd.org> Author: yongari Date: Mon Nov 2 18:35:05 2009 New Revision: 198814 URL: http://svn.freebsd.org/changeset/base/198814 Log: Add a check to know whether driver is still running after reacquiring driver lock in Rx handler. re(4) drops a driver lock before passing received frame to upper stack and reacquire the lock. During the time window ioctl calls could be executed and if the ioctl was interface down request, driver will stop the controller and free allocated mbufs. After that when driver comes back to Rx handler again it does not know what was happend so it could access free mbufs which in turn cause panic. Reported by: Norbert Papke < npapk <> acm dot org > Tested by: Norbert Papke < npapk <> acm dot org > Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Mon Nov 2 18:15:11 2009 (r198813) +++ head/sys/dev/re/if_re.c Mon Nov 2 18:35:05 2009 (r198814) @@ -1817,6 +1817,8 @@ re_rxeof(struct rl_softc *sc, int *rx_np for (i = sc->rl_ldata.rl_rx_prodidx; maxpkt > 0; i = RL_RX_DESC_NXT(sc, i)) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + break; cur_rx = &sc->rl_ldata.rl_rx_list[i]; rxstat = le32toh(cur_rx->rl_cmdstat); if ((rxstat & RL_RDESC_STAT_OWN) != 0) From rpaulo at FreeBSD.org Mon Nov 2 18:51:24 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Mon Nov 2 18:51:30 2009 Subject: svn commit: r198816 - head/sys/compat/ndis Message-ID: <200911021851.nA2IpOZ4066444@svn.freebsd.org> Author: rpaulo Date: Mon Nov 2 18:51:24 2009 New Revision: 198816 URL: http://svn.freebsd.org/changeset/base/198816 Log: Fix a non-style change that snuck in. Spotted by: danfe Modified: head/sys/compat/ndis/kern_ndis.c Modified: head/sys/compat/ndis/kern_ndis.c ============================================================================== --- head/sys/compat/ndis/kern_ndis.c Mon Nov 2 18:44:01 2009 (r198815) +++ head/sys/compat/ndis/kern_ndis.c Mon Nov 2 18:51:24 2009 (r198816) @@ -1200,7 +1200,7 @@ ndis_init_nic(arg) NDIS_LOCK(sc); sc->ndis_block->nmb_miniportadapterctx = NULL; NDIS_UNLOCK(sc); - return (status); + return (ENXIO); } /* From max at love2party.net Mon Nov 2 18:55:05 2009 From: max at love2party.net (Max Laier) Date: Mon Nov 2 18:55:11 2009 Subject: svn commit: r198781 - head/lib/libc/sys In-Reply-To: <4AEF22E3.5070701@freebsd.org> References: <200911020721.nA27LDq1048764@svn.freebsd.org> <4AEF22E3.5070701@freebsd.org> Message-ID: <200911021955.02459.max@love2party.net> On Monday 02 November 2009 19:20:19 Colin Percival wrote: > Robert Watson wrote: > > On Mon, 2 Nov 2009, Colin Percival wrote: > >> Attempt to reduce accidental foot-shooting by pointing out that > >> accept(2)ed sockets do not necessarily inherit O_NONBLOCK from > >> listening sockets on non-FreeBSD platforms. > > > > I wonder how much trouble we should go to to document bugs in other > > systems as non-portabilities for features that work in our system. > > I don't think there's any simple rule to apply here except "use common > sense". One can argue that FreeBSD man pages exist for the purpose of > documenting FreeBSD; but I'd also like to think that FreeBSD is a good > development platform for writing portable applications, so alerting our > users to potentially non-portable code certainly has some value. (And +1 ... FreeBSD is such a great development platform specifically because of the complete man page collection. I'd argue, however, that we should keep the portability notes to the fact that there might be a difference - without going into too much detail what/where and why that difference is. In addition, the more detail we add, the more likely it is that the information grows stale as others realize that they should follow our lead ;) > there are many other examples of "portable programs should not..." in > our man pages, not just the one I added.) > > The non-portability I just documented was a particularly obnoxious one, > since in event-driven code it can go unnoticed for a long time -- as I > just recently discovered. > > > I think a more general caution for accept(2) might instead be: > > > > BUGS > > The inheritence of socket options from a listen socket to a newly > > accepted socket is inconsistent across protocols, and non-portable. > > I was originally going to write it that way, but when I looked at the > existing text I saw that it only mentioned inheriting O_NONBLOCK and said > nothing about other options -- so I figured that it was appropriate to > follow suit and only mention O_NONBLOCK in saying what was non-portable. > -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News From mav at FreeBSD.org Mon Nov 2 19:02:32 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Mon Nov 2 19:02:39 2009 Subject: svn commit: r198818 - in head/sys/dev/ata: . chipsets Message-ID: <200911021902.nA2J2Vvb066782@svn.freebsd.org> Author: mav Date: Mon Nov 2 19:02:31 2009 New Revision: 198818 URL: http://svn.freebsd.org/changeset/base/198818 Log: Add IDs for nVidia MCP65/77/79/89 SATA conntrollers. Modified: head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-nvidia.c Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Mon Nov 2 19:01:20 2009 (r198817) +++ head/sys/dev/ata/ata-pci.h Mon Nov 2 19:02:31 2009 (r198818) @@ -260,6 +260,15 @@ struct ata_pci_controller { #define ATA_NFORCE_MCP61_S2 0x03f610de #define ATA_NFORCE_MCP61_S3 0x03f710de #define ATA_NFORCE_MCP65 0x044810de +#define ATA_NFORCE_MCP65_A0 0x044c10de +#define ATA_NFORCE_MCP65_A1 0x044d10de +#define ATA_NFORCE_MCP65_A2 0x044e10de +#define ATA_NFORCE_MCP65_A3 0x044f10de +#define ATA_NFORCE_MCP65_A4 0x045c10de +#define ATA_NFORCE_MCP65_A5 0x045d10de +#define ATA_NFORCE_MCP65_A6 0x045e10de +#define ATA_NFORCE_MCP65_A7 0x045f10de +#define ATA_NFORCE_MCP67 0x056010de #define ATA_NFORCE_MCP67_A0 0x055010de #define ATA_NFORCE_MCP67_A1 0x055110de #define ATA_NFORCE_MCP67_A2 0x055210de @@ -273,7 +282,6 @@ struct ata_pci_controller { #define ATA_NFORCE_MCP67_AA 0x055A10de #define ATA_NFORCE_MCP67_AB 0x055B10de #define ATA_NFORCE_MCP67_AC 0x058410de -#define ATA_NFORCE_MCP67 0x056010de #define ATA_NFORCE_MCP73 0x056c10de #define ATA_NFORCE_MCP73_A0 0x07f010de #define ATA_NFORCE_MCP73_A1 0x07f110de @@ -288,6 +296,42 @@ struct ata_pci_controller { #define ATA_NFORCE_MCP73_AA 0x07fa10de #define ATA_NFORCE_MCP73_AB 0x07fb10de #define ATA_NFORCE_MCP77 0x075910de +#define ATA_NFORCE_MCP77_A0 0x0ad010de +#define ATA_NFORCE_MCP77_A1 0x0ad110de +#define ATA_NFORCE_MCP77_A2 0x0ad210de +#define ATA_NFORCE_MCP77_A3 0x0ad310de +#define ATA_NFORCE_MCP77_A4 0x0ad410de +#define ATA_NFORCE_MCP77_A5 0x0ad510de +#define ATA_NFORCE_MCP77_A6 0x0ad610de +#define ATA_NFORCE_MCP77_A7 0x0ad710de +#define ATA_NFORCE_MCP77_A8 0x0ad810de +#define ATA_NFORCE_MCP77_A9 0x0ad910de +#define ATA_NFORCE_MCP77_AA 0x0ada10de +#define ATA_NFORCE_MCP77_AB 0x0adb10de +#define ATA_NFORCE_MCP79_A0 0x0ab410de +#define ATA_NFORCE_MCP79_A1 0x0ab510de +#define ATA_NFORCE_MCP79_A2 0x0ab610de +#define ATA_NFORCE_MCP79_A3 0x0ab710de +#define ATA_NFORCE_MCP79_A4 0x0ab810de +#define ATA_NFORCE_MCP79_A5 0x0ab910de +#define ATA_NFORCE_MCP79_A6 0x0aba10de +#define ATA_NFORCE_MCP79_A7 0x0abb10de +#define ATA_NFORCE_MCP79_A8 0x0abc10de +#define ATA_NFORCE_MCP79_A9 0x0abd10de +#define ATA_NFORCE_MCP79_AA 0x0abe10de +#define ATA_NFORCE_MCP79_AB 0x0abf10de +#define ATA_NFORCE_MCP89_A0 0x0d8410de +#define ATA_NFORCE_MCP89_A1 0x0d8510de +#define ATA_NFORCE_MCP89_A2 0x0d8610de +#define ATA_NFORCE_MCP89_A3 0x0d8710de +#define ATA_NFORCE_MCP89_A4 0x0d8810de +#define ATA_NFORCE_MCP89_A5 0x0d8910de +#define ATA_NFORCE_MCP89_A6 0x0d8a10de +#define ATA_NFORCE_MCP89_A7 0x0d8b10de +#define ATA_NFORCE_MCP89_A8 0x0d8c10de +#define ATA_NFORCE_MCP89_A9 0x0d8d10de +#define ATA_NFORCE_MCP89_AA 0x0d8e10de +#define ATA_NFORCE_MCP89_AB 0x0d8f10de #define ATA_PROMISE_ID 0x105a #define ATA_PDC20246 0x4d33105a Modified: head/sys/dev/ata/chipsets/ata-nvidia.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-nvidia.c Mon Nov 2 19:01:20 2009 (r198817) +++ head/sys/dev/ata/chipsets/ata-nvidia.c Mon Nov 2 19:02:31 2009 (r198818) @@ -97,6 +97,14 @@ ata_nvidia_probe(device_t dev) { ATA_NFORCE_MCP61_S2, 0, NV4|NVQ, 0, ATA_SA300, "nForce MCP61" }, { ATA_NFORCE_MCP61_S3, 0, NV4|NVQ, 0, ATA_SA300, "nForce MCP61" }, { ATA_NFORCE_MCP65, 0, 0, 0, ATA_UDMA6, "nForce MCP65" }, + { ATA_NFORCE_MCP65_A0, 0, NVAHCI, 0, ATA_SA300, "nForce MCP65" }, + { ATA_NFORCE_MCP65_A1, 0, NVAHCI, 0, ATA_SA300, "nForce MCP65" }, + { ATA_NFORCE_MCP65_A2, 0, NVAHCI, 0, ATA_SA300, "nForce MCP65" }, + { ATA_NFORCE_MCP65_A3, 0, NVAHCI, 0, ATA_SA300, "nForce MCP65" }, + { ATA_NFORCE_MCP65_A4, 0, NVAHCI, 0, ATA_SA300, "nForce MCP65" }, + { ATA_NFORCE_MCP65_A5, 0, NVAHCI, 0, ATA_SA300, "nForce MCP65" }, + { ATA_NFORCE_MCP65_A6, 0, NVAHCI, 0, ATA_SA300, "nForce MCP65" }, + { ATA_NFORCE_MCP65_A7, 0, NVAHCI, 0, ATA_SA300, "nForce MCP65" }, { ATA_NFORCE_MCP67, 0, 0, 0, ATA_UDMA6, "nForce MCP67" }, { ATA_NFORCE_MCP67_A0, 0, NVAHCI, 0, ATA_SA300, "nForce MCP67" }, { ATA_NFORCE_MCP67_A1, 0, NVAHCI, 0, ATA_SA300, "nForce MCP67" }, @@ -125,6 +133,42 @@ ata_nvidia_probe(device_t dev) { ATA_NFORCE_MCP73_AA, 0, NVAHCI, 0, ATA_SA300, "nForce MCP73" }, { ATA_NFORCE_MCP73_AB, 0, NVAHCI, 0, ATA_SA300, "nForce MCP73" }, { ATA_NFORCE_MCP77, 0, 0, 0, ATA_UDMA6, "nForce MCP77" }, + { ATA_NFORCE_MCP77_A0, 0, NVAHCI, 0, ATA_SA300, "nForce MCP77" }, + { ATA_NFORCE_MCP77_A1, 0, NVAHCI, 0, ATA_SA300, "nForce MCP77" }, + { ATA_NFORCE_MCP77_A2, 0, NVAHCI, 0, ATA_SA300, "nForce MCP77" }, + { ATA_NFORCE_MCP77_A3, 0, NVAHCI, 0, ATA_SA300, "nForce MCP77" }, + { ATA_NFORCE_MCP77_A4, 0, NVAHCI, 0, ATA_SA300, "nForce MCP77" }, + { ATA_NFORCE_MCP77_A5, 0, NVAHCI, 0, ATA_SA300, "nForce MCP77" }, + { ATA_NFORCE_MCP77_A6, 0, NVAHCI, 0, ATA_SA300, "nForce MCP77" }, + { ATA_NFORCE_MCP77_A7, 0, NVAHCI, 0, ATA_SA300, "nForce MCP77" }, + { ATA_NFORCE_MCP77_A8, 0, NVAHCI, 0, ATA_SA300, "nForce MCP77" }, + { ATA_NFORCE_MCP77_A9, 0, NVAHCI, 0, ATA_SA300, "nForce MCP77" }, + { ATA_NFORCE_MCP77_AA, 0, NVAHCI, 0, ATA_SA300, "nForce MCP77" }, + { ATA_NFORCE_MCP77_AB, 0, NVAHCI, 0, ATA_SA300, "nForce MCP77" }, + { ATA_NFORCE_MCP79_A0, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, + { ATA_NFORCE_MCP79_A1, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, + { ATA_NFORCE_MCP79_A2, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, + { ATA_NFORCE_MCP79_A3, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, + { ATA_NFORCE_MCP79_A4, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, + { ATA_NFORCE_MCP79_A5, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, + { ATA_NFORCE_MCP79_A6, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, + { ATA_NFORCE_MCP79_A7, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, + { ATA_NFORCE_MCP79_A8, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, + { ATA_NFORCE_MCP79_A9, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, + { ATA_NFORCE_MCP79_AA, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, + { ATA_NFORCE_MCP79_AB, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, + { ATA_NFORCE_MCP89_A0, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, + { ATA_NFORCE_MCP89_A1, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, + { ATA_NFORCE_MCP89_A2, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, + { ATA_NFORCE_MCP89_A3, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, + { ATA_NFORCE_MCP89_A4, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, + { ATA_NFORCE_MCP89_A5, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, + { ATA_NFORCE_MCP89_A6, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, + { ATA_NFORCE_MCP89_A7, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, + { ATA_NFORCE_MCP89_A8, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, + { ATA_NFORCE_MCP89_A9, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, + { ATA_NFORCE_MCP89_AA, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, + { ATA_NFORCE_MCP89_AB, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, { 0, 0, 0, 0, 0, 0}} ; if (pci_get_vendor(dev) != ATA_NVIDIA_ID) From rpaulo at FreeBSD.org Mon Nov 2 19:13:13 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Mon Nov 2 19:13:19 2009 Subject: svn commit: r198819 - head/sys/compat/ndis Message-ID: <200911021913.nA2JDDA8067089@svn.freebsd.org> Author: rpaulo Date: Mon Nov 2 19:13:12 2009 New Revision: 198819 URL: http://svn.freebsd.org/changeset/base/198819 Log: Revert a functional change that snuck in. Modified: head/sys/compat/ndis/subr_ndis.c Modified: head/sys/compat/ndis/subr_ndis.c ============================================================================== --- head/sys/compat/ndis/subr_ndis.c Mon Nov 2 19:02:31 2009 (r198818) +++ head/sys/compat/ndis/subr_ndis.c Mon Nov 2 19:13:12 2009 (r198819) @@ -1246,7 +1246,7 @@ NdisMQueryAdapterResources(status, adapt { ndis_miniport_block *block; struct ndis_softc *sc; - uint32_t rsclen; + int rsclen; block = (ndis_miniport_block *)adapter; sc = device_get_softc(block->nmb_physdeviceobj->do_devext); From jhb at FreeBSD.org Mon Nov 2 20:18:52 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Nov 2 20:19:03 2009 Subject: svn commit: r198820 - head/sbin/ddb Message-ID: <200911022018.nA2KIp6Q068433@svn.freebsd.org> Author: jhb Date: Mon Nov 2 20:18:50 2009 New Revision: 198820 URL: http://svn.freebsd.org/changeset/base/198820 Log: 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. MFC after: 1 week Modified: head/sbin/ddb/ddb_capture.c Modified: head/sbin/ddb/ddb_capture.c ============================================================================== --- head/sbin/ddb/ddb_capture.c Mon Nov 2 19:13:12 2009 (r198819) +++ head/sbin/ddb/ddb_capture.c Mon Nov 2 20:18:50 2009 (r198820) @@ -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 kostikbel at gmail.com Mon Nov 2 20:34:35 2009 From: kostikbel at gmail.com (Kostik Belousov) Date: Mon Nov 2 20:34:41 2009 Subject: svn commit: r198706 - head/sys/sys In-Reply-To: References: <20091101011212.GG1293@hoeg.nl> <20091102100435.GA67211@walton.maths.tcd.ie> <20091102102404.GP1293@hoeg.nl> <20091102.084616.-1258100553.imp@bsdimp.com> <20091102155414.GR1293@hoeg.nl> Message-ID: <20091102203419.GV2147@deviant.kiev.zoral.com.ua> On Mon, Nov 02, 2009 at 10:08:17AM -0800, Marcel Moolenaar wrote: > For a change that does change the ABI: revision 198506 > tcsh(1) dumps core with a sig 11... Can you provide some details ? Which architecture is it ? What is the backtrace ? What is the ktrace before SIGSEGV ? -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091102/50931b2a/attachment.pgp From xcllnt at mac.com Mon Nov 2 20:45:42 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Mon Nov 2 20:45:53 2009 Subject: svn commit: r198706 - head/sys/sys In-Reply-To: <20091102203419.GV2147@deviant.kiev.zoral.com.ua> References: <20091101011212.GG1293@hoeg.nl> <20091102100435.GA67211@walton.maths.tcd.ie> <20091102102404.GP1293@hoeg.nl> <20091102.084616.-1258100553.imp@bsdimp.com> <20091102155414.GR1293@hoeg.nl> <20091102203419.GV2147@deviant.kiev.zoral.com.ua> Message-ID: <5537A11F-92AC-4D73-BBE7-297A1575BE1B@mac.com> On Nov 2, 2009, at 12:34 PM, Kostik Belousov wrote: > On Mon, Nov 02, 2009 at 10:08:17AM -0800, Marcel Moolenaar wrote: >> For a change that does change the ABI: revision 198506 >> tcsh(1) dumps core with a sig 11... > > Can you provide some details ? Which architecture is it ? > What is the backtrace ? What is the ktrace before SIGSEGV ? I'm working on it. I see it on ia64, so the root cause may be an ia64-specific bug. The sig 11 happens when csh calls sigsuspend: (gdb) l *$b0 0x20000000000483a0 is in pjwait (/nfs/freebsd/base/head/bin/csh/../../ contrib/tcsh/sh.proc.c:513). 508 while ((fp = (fp->p_friends)) != pp); 509 if ((jobflags & PRUNNING) == 0) 510 break; 511 jobdebug_xprintf(("%d starting to sigsuspend for SIGCHLD on %d\n", 512 getpid(), fp->p_procid)); 513 sigsuspend(&pause_mask); 514 } 515 cleanup_until(&oset); 516 jobdebug_xprintf(("%d returned from sigsuspend loop\n", getpid ())); 517 #ifdef BSDJOBS (gdb) FYI, -- Marcel Moolenaar xcllnt@mac.com From mjacob at FreeBSD.org Mon Nov 2 21:22:31 2009 From: mjacob at FreeBSD.org (Matt Jacob) Date: Mon Nov 2 21:22:43 2009 Subject: svn commit: r198822 - head/sys/dev/isp Message-ID: <200911022122.nA2LMUtt070116@svn.freebsd.org> Author: mjacob Date: Mon Nov 2 21:22:30 2009 New Revision: 198822 URL: http://svn.freebsd.org/changeset/base/198822 Log: Unbreak SBus cards which have been broken (apparently) for a while. Most of the pieces came from Marius- correct settings for channels and resource management. The one piece missing was that you cannot for SBus cards replace 32 bit operations with A64 operations- not supported. Submitted by: marius MFC after: 3 days Modified: head/sys/dev/isp/isp_sbus.c Directory Properties: Modified: head/sys/dev/isp/isp_sbus.c ============================================================================== --- head/sys/dev/isp/isp_sbus.c Mon Nov 2 20:37:49 2009 (r198821) +++ head/sys/dev/isp/isp_sbus.c Mon Nov 2 21:22:30 2009 (r198822) @@ -193,6 +193,8 @@ isp_sbus_attach(device_t dev) isp->isp_param = &sbs->sbus_param; isp->isp_osinfo.pc.ptr = &sbs->sbus_spi; isp->isp_revision = 0; /* XXX */ + isp->isp_dev = dev; + isp->isp_nchan = 1; ISP_SET_PC(isp, 0, role, role); /* @@ -316,18 +318,16 @@ isp_sbus_attach(device_t dev) goto bad; } isp_init(isp); - if (role != ISP_ROLE_NONE && isp->isp_state != ISP_INITSTATE) { - isp_uninit(isp); - ISP_UNLOCK(isp); - goto bad; + if (isp->isp_state == ISP_INITSTATE) { + isp->isp_state = ISP_RUNSTATE; } - isp_attach(isp); - if (role != ISP_ROLE_NONE && isp->isp_state != ISP_RUNSTATE) { + ISP_UNLOCK(isp); + if (isp_attach(isp)) { + ISP_LOCK(isp); isp_uninit(isp); ISP_UNLOCK(isp); goto bad; } - ISP_UNLOCK(isp); return (0); bad: @@ -345,13 +345,10 @@ bad: } if (regs) { - (void) bus_release_resource(dev, 0, 0, regs); + (void) bus_release_resource(dev, SYS_RES_MEMORY, 0, regs); } if (sbs) { - if (sbs->sbus_isp.isp_param) { - free(sbs->sbus_isp.isp_param, M_DEVBUF); - } free(sbs, M_DEVBUF); } return (ENXIO); @@ -584,13 +581,6 @@ dma2(void *arg, bus_dma_segment_t *dm_se isp = mp->isp; rq = mp->rq; if (nseg) { - if (sizeof (bus_addr_t) > 4) { - if (rq->req_header.rqs_entry_type == RQSTYPE_T2RQS) { - rq->req_header.rqs_entry_type = RQSTYPE_T3RQS; - } else if (rq->req_header.rqs_entry_type == RQSTYPE_REQUEST) { - rq->req_header.rqs_entry_type = RQSTYPE_A64; - } - } if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); ddir = ISP_FROM_DEVICE; From edwin at FreeBSD.org Mon Nov 2 21:44:10 2009 From: edwin at FreeBSD.org (Edwin Groothuis) Date: Mon Nov 2 21:44:22 2009 Subject: svn commit: r198825 - head/share/zoneinfo Message-ID: <200911022144.nA2LiAIx070736@svn.freebsd.org> Author: edwin Date: Mon Nov 2 21:44:10 2009 New Revision: 198825 URL: http://svn.freebsd.org/changeset/base/198825 Log: MFV of 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. MFC after: 2 days Modified: head/share/zoneinfo/asia head/share/zoneinfo/europe head/share/zoneinfo/zone.tab Directory Properties: head/share/zoneinfo/ (props changed) Modified: head/share/zoneinfo/asia ============================================================================== --- head/share/zoneinfo/asia Mon Nov 2 21:40:50 2009 (r198824) +++ head/share/zoneinfo/asia Mon Nov 2 21:44:10 2009 (r198825) @@ -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: head/share/zoneinfo/europe
==============================================================================
--- head/share/zoneinfo/europe	Mon Nov  2 21:40:50 2009	(r198824)
+++ head/share/zoneinfo/europe	Mon Nov  2 21:44:10 2009	(r198825)
@@ -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: head/share/zoneinfo/zone.tab
==============================================================================
--- head/share/zoneinfo/zone.tab	Mon Nov  2 21:40:50 2009	(r198824)
+++ head/share/zoneinfo/zone.tab	Mon Nov  2 21:44:10 2009	(r198825)
@@ -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 edwin at FreeBSD.org  Mon Nov  2 23:02:12 2009
From: edwin at FreeBSD.org (Edwin Groothuis)
Date: Mon Nov  2 23:02:33 2009
Subject: svn commit: r198831 - head/usr.sbin/zic
Message-ID: <200911022302.nA2N2BBA072716@svn.freebsd.org>

Author: edwin
Date: Mon Nov  2 23:02:11 2009
New Revision: 198831
URL: http://svn.freebsd.org/changeset/base/198831

Log:
  MFV of r198828, tzcode2009q
  
  - Cleanup unnecessary local variables in zdump.
  - Fix man-page
  
  MFC after:	1 week

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

Modified: head/usr.sbin/zic/zdump.c
==============================================================================
--- head/usr.sbin/zic/zdump.c	Mon Nov  2 22:50:39 2009	(r198830)
+++ head/usr.sbin/zic/zdump.c	Mon Nov  2 23:02:11 2009	(r198831)
@@ -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 != -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: head/usr.sbin/zic/zic.8
==============================================================================
--- head/usr.sbin/zic/zic.8	Mon Nov  2 22:50:39 2009	(r198830)
+++ head/usr.sbin/zic/zic.8	Mon Nov  2 23:02:11 2009	(r198831)
@@ -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 thompsa at FreeBSD.org  Mon Nov  2 23:30:16 2009
From: thompsa at FreeBSD.org (Andrew Thompson)
Date: Mon Nov  2 23:30:22 2009
Subject: svn commit: r198832 - head/sys/cam/scsi
Message-ID: <200911022330.nA2NUF3b073300@svn.freebsd.org>

Author: thompsa
Date: Mon Nov  2 23:30:15 2009
New Revision: 198832
URL: http://svn.freebsd.org/changeset/base/198832

Log:
  Provide the same sanity check on the sector size in dagetcapacity as when the
  disk is first probed. dagetcapacity is called whenever the disk is opened from
  geom via d_open(), a zero sector size will cause geom to panic later on.

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==============================================================================
--- head/sys/cam/scsi/scsi_da.c	Mon Nov  2 23:02:11 2009	(r198831)
+++ head/sys/cam/scsi/scsi_da.c	Mon Nov  2 23:30:15 2009	(r198832)
@@ -1948,8 +1948,15 @@ dagetcapacity(struct cam_periph *periph)
 
 done:
 
-	if (error == 0)
-		dasetgeom(periph, block_len, maxsector);
+	if (error == 0) {
+		if (block_len >= MAXPHYS || block_len == 0) {
+			xpt_print(periph->path,
+			    "unsupportable block size %ju\n",
+			    (uintmax_t) block_len);
+			error = EINVAL;
+		} else
+			dasetgeom(periph, block_len, maxsector);
+	}
 
 	xpt_release_ccb(ccb);
 
From thompsa at FreeBSD.org  Mon Nov  2 23:50:13 2009
From: thompsa at FreeBSD.org (Andrew Thompson)
Date: Mon Nov  2 23:50:19 2009
Subject: svn commit: r198833 - head/usr.sbin/usbconfig
Message-ID: <200911022350.nA2NoCcr073693@svn.freebsd.org>

Author: thompsa
Date: Mon Nov  2 23:50:12 2009
New Revision: 198833
URL: http://svn.freebsd.org/changeset/base/198833

Log:
  Add more verbose output when dumping the configuration descriptor.
  
  Submitted by:	Hans Petter Selasky

Modified:
  head/usr.sbin/usbconfig/dump.c

Modified: head/usr.sbin/usbconfig/dump.c
==============================================================================
--- head/usr.sbin/usbconfig/dump.c	Mon Nov  2 23:30:15 2009	(r198832)
+++ head/usr.sbin/usbconfig/dump.c	Mon Nov  2 23:50:12 2009	(r198833)
@@ -100,21 +100,66 @@ dump_field(struct libusb20_device *pdev,
 
 	printf("%s%s = 0x%04x ", plevel, field, value);
 
-	if ((field[0] != 'i') || (field[1] == 'd')) {
-		printf("\n");
-		return;
-	}
-	if (value == 0) {
-		printf(" \n");
-		return;
+	if (strlen(plevel) == 8) {
+		/* Endpoint Descriptor */
+
+		if (strcmp(field, "bEndpointAddress") == 0) {
+			if (value & 0x80)
+				printf(" \n");
+			else
+				printf(" \n");
+			return;
+		}
+
+		if (strcmp(field, "bmAttributes") == 0) {
+			switch (value & 0x03) {
+			case 0:
+				printf(" \n");
+				break;
+			case 1:
+				switch (value & 0x0C) {
+				case 0x00:
+					printf(" \n");
+					break;
+				case 0x04:
+					printf(" \n");
+					break;
+				case 0x08:
+					printf(" \n");
+					break;
+				default:
+					printf(" \n");
+					break;
+				}
+				break;
+			case 2:
+				printf(" \n");
+				break;
+			default:
+				printf(" \n");
+				break;
+			}
+			return;
+		}
 	}
-	if (libusb20_dev_req_string_simple_sync(pdev, value,
-	    temp_string, sizeof(temp_string))) {
-		printf(" \n");
+
+	if ((field[0] == 'i') && (field[1] != 'd')) {
+		/* Indirect String Descriptor */
+		if (value == 0) {
+			printf(" \n");
+			return;
+		}
+		if (libusb20_dev_req_string_simple_sync(pdev, value,
+		    temp_string, sizeof(temp_string))) {
+			printf(" \n");
+			return;
+		}
+		printf(" <%s>\n", temp_string);
 		return;
 	}
-	printf(" <%s>\n", temp_string);
-	return;
+
+	/* No additional information */
+	printf("\n");
 }
 
 static void
From oleg at FreeBSD.org  Tue Nov  3 08:41:15 2009
From: oleg at FreeBSD.org (Oleg Bulyzhin)
Date: Tue Nov  3 08:41:24 2009
Subject: svn commit: r198845 - head/sys/netinet/ipfw
Message-ID: <200911030841.nA38fEg3084563@svn.freebsd.org>

Author: oleg
Date: Tue Nov  3 08:41:14 2009
New Revision: 198845
URL: http://svn.freebsd.org/changeset/base/198845

Log:
  Fix two issues that can lead to exceeding configured pipe bandwidth:
  - do not expire queues which are not ready to be expired.
  - properly calculate available burst size.
  
  MFC after:	3 days

Modified:
  head/sys/netinet/ipfw/ip_dummynet.c

Modified: head/sys/netinet/ipfw/ip_dummynet.c
==============================================================================
--- head/sys/netinet/ipfw/ip_dummynet.c	Tue Nov  3 07:29:58 2009	(r198844)
+++ head/sys/netinet/ipfw/ip_dummynet.c	Tue Nov  3 08:41:14 2009	(r198845)
@@ -244,6 +244,17 @@ void		dummynet_drain(void);
 static int	dummynet_io(struct mbuf **, int , struct ip_fw_args *);
 
 /*
+ * Flow queue is idle if:
+ *   1) it's empty for at least 1 tick
+ *   2) it has invalid timestamp (WF2Q case)
+ *   3) parent pipe has no 'exhausted' burst.
+ */
+#define QUEUE_IS_IDLE(q) ((q)->head == NULL && (q)->S == (q)->F + 1 && \
+	curr_time > (q)->idle_time + 1 && \
+	((q)->numbytes + (curr_time - (q)->idle_time - 1) * \
+	(q)->fs->pipe->bandwidth >= q->fs->pipe->burst))
+
+/*
  * Heap management functions.
  *
  * In the heap, first node is element 0. Children of i are 2i+1 and 2i+2.
@@ -1004,7 +1015,7 @@ expire_queues(struct dn_flow_set *fs)
     fs->last_expired = time_uptime ;
     for (i = 0 ; i <= fs->rq_size ; i++) /* last one is overflow */
 	for (prev=NULL, q = fs->rq[i] ; q != NULL ; )
-	    if (q->head != NULL || q->S != q->F+1) {
+	    if (!QUEUE_IS_IDLE(q)) {
   		prev = q ;
   	        q = q->next ;
   	    } else { /* entry is idle, expire it */
@@ -1134,7 +1145,7 @@ find_queue(struct dn_flow_set *fs, struc
 		break ; /* found */
 
 	    /* No match. Check if we can expire the entry */
-	    if (pipe_expire && q->head == NULL && q->S == q->F+1 ) {
+	    if (pipe_expire && QUEUE_IS_IDLE(q)) {
 		/* entry is idle and not in any heap, expire it */
 		struct dn_flow_queue *old_q = q ;
 
@@ -1408,7 +1419,7 @@ dummynet_io(struct mbuf **m0, int dir, s
 		if (q->idle_time < curr_time) {
 			/* Calculate available burst size. */
 			q->numbytes +=
-			    (curr_time - q->idle_time) * pipe->bandwidth;
+			    (curr_time - q->idle_time - 1) * pipe->bandwidth;
 			if (q->numbytes > pipe->burst)
 				q->numbytes = pipe->burst;
 			if (io_fast)
@@ -1418,8 +1429,8 @@ dummynet_io(struct mbuf **m0, int dir, s
 		if (pipe->idle_time < curr_time) {
 			/* Calculate available burst size. */
 			pipe->numbytes +=
-			    (curr_time - pipe->idle_time) * pipe->bandwidth;
-			if (pipe->numbytes > pipe->burst)
+			    (curr_time - pipe->idle_time - 1) * pipe->bandwidth;
+			if (pipe->numbytes > 0 && pipe->numbytes > pipe->burst)
 				pipe->numbytes = pipe->burst;
 			if (io_fast)
 				pipe->numbytes += pipe->bandwidth;
From oleg at FreeBSD.org  Tue Nov  3 09:04:04 2009
From: oleg at FreeBSD.org (Oleg Bulyzhin)
Date: Tue Nov  3 09:04:10 2009
Subject: svn commit: r198845 - head/sys/netinet/ipfw
In-Reply-To: <200911030841.nA38fEg3084563@svn.freebsd.org>
References: <200911030841.nA38fEg3084563@svn.freebsd.org>
Message-ID: <20091103084518.GA45306@lath.rinet.ru>

On Tue, Nov 03, 2009 at 08:41:14AM +0000, Oleg Bulyzhin wrote:
> Author: oleg
> Date: Tue Nov  3 08:41:14 2009
> New Revision: 198845
> URL: http://svn.freebsd.org/changeset/base/198845
> 
> Log:
>   Fix two issues that can lead to exceeding configured pipe bandwidth:
>   - do not expire queues which are not ready to be expired.
>   - properly calculate available burst size.
>   
>   MFC after:	3 days
> 
> Modified:
>   head/sys/netinet/ipfw/ip_dummynet.c


Reviews are welcome, since i'm going to push this into 8.0-RELEASE.
Thanks.

-- 
Oleg.

================================================================
=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- oleg@rinet.ru ===
================================================================

From delphij at FreeBSD.org  Tue Nov  3 09:17:24 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Tue Nov  3 09:17:35 2009
Subject: svn commit: r198846 - head/usr.sbin/crashinfo
Message-ID: <200911030917.nA39HNCF085239@svn.freebsd.org>

Author: delphij
Date: Tue Nov  3 09:17:23 2009
New Revision: 198846
URL: http://svn.freebsd.org/changeset/base/198846

Log:
  Set umask to 0x077 instead of the default.  This prevents non-root user
  from reading crashinfo output, which could contain some sensitive
  information.
  
  Reviewed by:	jhb
  MFC after:	1 week

Modified:
  head/usr.sbin/crashinfo/crashinfo.sh

Modified: head/usr.sbin/crashinfo/crashinfo.sh
==============================================================================
--- head/usr.sbin/crashinfo/crashinfo.sh	Tue Nov  3 08:41:14 2009	(r198845)
+++ head/usr.sbin/crashinfo/crashinfo.sh	Tue Nov  3 09:17:23 2009	(r198846)
@@ -147,6 +147,8 @@ fi
 
 echo "Writing crash summary to $FILE."
 
+umask 077
+
 # Simulate uname
 ostype=$(echo -e printf '"%s", ostype' | gdb -x /dev/stdin -batch $KERNEL)
 osrelease=$(echo -e printf '"%s", osrelease' | gdb -x /dev/stdin -batch $KERNEL)
From delphij at FreeBSD.org  Tue Nov  3 09:25:08 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Tue Nov  3 09:25:20 2009
Subject: svn commit: r198847 - head/usr.bin/leave
Message-ID: <200911030925.nA39P8EM085486@svn.freebsd.org>

Author: delphij
Date: Tue Nov  3 09:25:08 2009
New Revision: 198847
URL: http://svn.freebsd.org/changeset/base/198847

Log:
  Static'ify signal handler which is not called from outside.

Modified:
  head/usr.bin/leave/leave.c

Modified: head/usr.bin/leave/leave.c
==============================================================================
--- head/usr.bin/leave/leave.c	Tue Nov  3 09:17:23 2009	(r198846)
+++ head/usr.bin/leave/leave.c	Tue Nov  3 09:25:08 2009	(r198847)
@@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-void doalarm(u_int);
+static void doalarm(u_int);
 static void usage(void);
 
 /*
From delphij at FreeBSD.org  Tue Nov  3 09:28:46 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Tue Nov  3 09:28:52 2009
Subject: svn commit: r198848 - head/bin/ps
Message-ID: <200911030928.nA39SjLx085597@svn.freebsd.org>

Author: delphij
Date: Tue Nov  3 09:28:45 2009
New Revision: 198848
URL: http://svn.freebsd.org/changeset/base/198848

Log:
  Increase width for %CPU, RSS and VSZ columns for now.  Modern systems
  tend to have larger memory, larger process, and more CPU.

Modified:
  head/bin/ps/keyword.c

Modified: head/bin/ps/keyword.c
==============================================================================
--- head/bin/ps/keyword.c	Tue Nov  3 09:25:08 2009	(r198847)
+++ head/bin/ps/keyword.c	Tue Nov  3 09:28:45 2009	(r198848)
@@ -70,7 +70,7 @@ static int  vcmp(const void *, const voi
 
 /* PLEASE KEEP THE TABLE BELOW SORTED ALPHABETICALLY!!! */
 static VAR var[] = {
-	{"%cpu", "%CPU", NULL, 0, pcpu, NULL, 4, 0, CHAR, NULL, 0},
+	{"%cpu", "%CPU", NULL, 0, pcpu, NULL, 5, 0, CHAR, NULL, 0},
 	{"%mem", "%MEM", NULL, 0, pmem, NULL, 4, 0, CHAR, NULL, 0},
 	{"acflag", "ACFLG", NULL, 0, kvar, NULL, 3, KOFF(ki_acflag), USHORT,
 		"x", 0},
@@ -159,7 +159,7 @@ static VAR var[] = {
 		UINT, UIDFMT, 0},
 	{"rgroup", "RGROUP", NULL, LJUST|DSIZ, rgroupname, s_rgroupname,
 		USERLEN, 0, CHAR, NULL, 0},
-	{"rss", "RSS", NULL, 0, kvar, NULL, 5, KOFF(ki_rssize), PGTOK, "ld", 0},
+	{"rss", "RSS", NULL, 0, kvar, NULL, 6, KOFF(ki_rssize), PGTOK, "ld", 0},
 	{"rtprio", "RTPRIO", NULL, 0, priorityr, NULL, 7, KOFF(ki_pri), CHAR,
 		NULL, 0},
 	{"ruid", "RUID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_ruid),
@@ -207,7 +207,7 @@ static VAR var[] = {
 		NULL, 0},
 	{"usrpri", "", "upr", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
 	{"vsize", "", "vsz", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
-	{"vsz", "VSZ", NULL, 0, vsize, NULL, 5, 0, CHAR, NULL, 0},
+	{"vsz", "VSZ", NULL, 0, vsize, NULL, 6, 0, CHAR, NULL, 0},
 	{"wchan", "WCHAN", NULL, LJUST, wchan, NULL, 6, 0, CHAR, NULL, 0},
 	{"xstat", "XSTAT", NULL, 0, kvar, NULL, 4, KOFF(ki_xstat), USHORT,
 		"x", 0},
From mav at FreeBSD.org  Tue Nov  3 11:19:06 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Tue Nov  3 11:19:12 2009
Subject: svn commit: r198849 - in head/sys/cam: . ata
Message-ID: <200911031119.nA3BJ50K090039@svn.freebsd.org>

Author: mav
Date: Tue Nov  3 11:19:05 2009
New Revision: 198849
URL: http://svn.freebsd.org/changeset/base/198849

Log:
  MFp4:
  Improve reporting ATA Status error details.

Modified:
  head/sys/cam/ata/ata_all.c
  head/sys/cam/ata/ata_all.h
  head/sys/cam/cam.c
  head/sys/cam/cam.h
  head/sys/cam/cam_periph.c

Modified: head/sys/cam/ata/ata_all.c
==============================================================================
--- head/sys/cam/ata/ata_all.c	Tue Nov  3 09:28:45 2009	(r198848)
+++ head/sys/cam/ata/ata_all.c	Tue Nov  3 11:19:05 2009	(r198849)
@@ -68,6 +68,185 @@ ata_version(int ver)
 	return 0;
 }
 
+char *
+ata_op_string(struct ata_cmd *cmd)
+{
+
+	switch (cmd->command) {
+	case 0x00: return ("NOP");
+	case 0x03: return ("CFA_REQUEST_EXTENDED_ERROR");
+	case 0x08: return ("DEVICE_RESET");
+	case 0x20: return ("READ");
+	case 0x24: return ("READ48");
+	case 0x25: return ("READ_DMA48");
+	case 0x26: return ("READ_DMA_QUEUED48");
+	case 0x27: return ("READ_NATIVE_MAX_ADDRESS48");
+	case 0x29: return ("READ_MUL48");
+	case 0x2a: return ("READ_STREAM_DMA48");
+	case 0x2b: return ("READ_STREAM48");
+	case 0x2f: return ("READ_LOG_EXT");
+	case 0x30: return ("WRITE");
+	case 0x34: return ("WRITE48");
+	case 0x35: return ("WRITE_DMA48");
+	case 0x36: return ("WRITE_DMA_QUEUED48");
+	case 0x37: return ("SET_MAX_ADDRESS48");
+	case 0x39: return ("WRITE_MUL48");
+	case 0x3a: return ("WRITE_STREAM_DMA48");
+	case 0x3b: return ("WRITE_STREAM48");
+	case 0x3d: return ("WRITE_DMA_FUA");
+	case 0x3e: return ("WRITE_DMA_FUA48");
+	case 0x3f: return ("WRITE_LOG_EXT");
+	case 0x40: return ("READ_VERIFY");
+	case 0x42: return ("READ_VERIFY48");
+	case 0x51: return ("CONFIGURE_STREAM");
+	case 0x60: return ("READ_FPDMA_QUEUED");
+	case 0x61: return ("WRITE_FPDMA_QUEUED");
+	case 0x70: return ("SEEK");
+	case 0x87: return ("CFA_TRANSLATE_SECTOR");
+	case 0x90: return ("EXECUTE_DEVICE_DIAGNOSTIC");
+	case 0x92: return ("DOWNLOAD_MICROCODE");
+	case 0xa0: return ("PACKET");
+	case 0xa1: return ("ATAPI_IDENTIFY");
+	case 0xa2: return ("SERVICE");
+	case 0xb0: return ("SMART");
+	case 0xb1: return ("DEVICE CONFIGURATION");
+	case 0xc0: return ("CFA_ERASE");
+	case 0xc4: return ("READ_MUL");
+	case 0xc5: return ("WRITE_MUL");
+	case 0xc6: return ("SET_MULTI");
+	case 0xc7: return ("READ_DMA_QUEUED");
+	case 0xc8: return ("READ_DMA");
+	case 0xca: return ("WRITE_DMA");
+	case 0xcc: return ("WRITE_DMA_QUEUED");
+	case 0xcd: return ("CFA_WRITE_MULTIPLE_WITHOUT_ERASE");
+	case 0xce: return ("WRITE_MULTIPLE_FUA48");
+	case 0xd1: return ("CHECK_MEDIA_CARD_TYPE");
+	case 0xda: return ("GET_MEDIA_STATUS");
+	case 0xde: return ("MEDIA_LOCK");
+	case 0xdf: return ("MEDIA_UNLOCK");
+	case 0xe0: return ("STANDBY_IMMEDIATE");
+	case 0xe1: return ("IDLE_IMMEDIATE");
+	case 0xe2: return ("STANDBY");
+	case 0xe3: return ("IDLE");
+	case 0xe4: return ("READ_BUFFER/PM");
+	case 0xe5: return ("CHECK_POWER_MODE");
+	case 0xe6: return ("SLEEP");
+	case 0xe7: return ("FLUSHCACHE");
+	case 0xe8: return ("WRITE_PM");
+	case 0xea: return ("FLUSHCACHE48");
+	case 0xec: return ("ATA_IDENTIFY");
+	case 0xed: return ("MEDIA_EJECT");
+	case 0xef:
+		switch (cmd->features) {
+	        case 0x03: return ("SETFEATURES SET TRANSFER MODE");
+	        case 0x02: return ("SETFEATURES ENABLE WCACHE");
+	        case 0x82: return ("SETFEATURES DISABLE WCACHE");
+	        case 0xaa: return ("SETFEATURES ENABLE RCACHE");
+	        case 0x55: return ("SETFEATURES DISABLE RCACHE");
+	        }
+	        return "SETFEATURES";
+	case 0xf1: return ("SECURITY_SET_PASSWORD");
+	case 0xf2: return ("SECURITY_UNLOCK");
+	case 0xf3: return ("SECURITY_ERASE_PREPARE");
+	case 0xf4: return ("SECURITY_ERASE_UNIT");
+	case 0xf5: return ("SECURITY_FREE_LOCK");
+	case 0xf6: return ("SECURITY DISABLE PASSWORD");
+	case 0xf8: return ("READ_NATIVE_MAX_ADDRESS");
+	case 0xf9: return ("SET_MAX_ADDRESS");
+	}
+	return "UNKNOWN";
+}
+
+char *
+ata_cmd_string(struct ata_cmd *cmd, char *cmd_string, size_t len)
+{
+
+	snprintf(cmd_string, len, "%02x %02x %02x %02x "
+	    "%02x %02x %02x %02x %02x %02x %02x %02x",
+	    cmd->command, cmd->features,
+	    cmd->lba_low, cmd->lba_mid, cmd->lba_high, cmd->device,
+	    cmd->lba_low_exp, cmd->lba_mid_exp, cmd->lba_high_exp,
+	    cmd->features_exp, cmd->sector_count, cmd->sector_count_exp);
+
+	return(cmd_string);
+}
+
+char *
+ata_res_string(struct ata_res *res, char *res_string, size_t len)
+{
+
+	snprintf(res_string, len, "%02x %02x %02x %02x "
+	    "%02x %02x %02x %02x %02x %02x %02x",
+	    res->status, res->error,
+	    res->lba_low, res->lba_mid, res->lba_high, res->device,
+	    res->lba_low_exp, res->lba_mid_exp, res->lba_high_exp,
+	    res->sector_count, res->sector_count_exp);
+
+	return(res_string);
+}
+
+/*
+ * ata_command_sbuf() returns 0 for success and -1 for failure.
+ */
+int
+ata_command_sbuf(struct ccb_ataio *ataio, struct sbuf *sb)
+{
+	char cmd_str[(12 * 3) + 1];
+
+	sbuf_printf(sb, "CMD: %s: %s",
+	    ata_op_string(&ataio->cmd),
+	    ata_cmd_string(&ataio->cmd, cmd_str, sizeof(cmd_str)));
+
+	return(0);
+}
+
+/*
+ * ata_status_abuf() returns 0 for success and -1 for failure.
+ */
+int
+ata_status_sbuf(struct ccb_ataio *ataio, struct sbuf *sb)
+{
+
+	sbuf_printf(sb, "ATA Status: %02x (%s%s%s%s%s%s%s%s)",
+	    ataio->res.status,
+	    (ataio->res.status & 0x80) ? "BSY " : "",
+	    (ataio->res.status & 0x40) ? "DRDY " : "",
+	    (ataio->res.status & 0x20) ? "DF " : "",
+	    (ataio->res.status & 0x10) ? "SERV " : "",
+	    (ataio->res.status & 0x08) ? "DRQ " : "",
+	    (ataio->res.status & 0x04) ? "CORR " : "",
+	    (ataio->res.status & 0x02) ? "IDX " : "",
+	    (ataio->res.status & 0x01) ? "ERR" : "");
+	if (ataio->res.status & 1) {
+	    sbuf_printf(sb, ", Error: %02x (%s%s%s%s%s%s%s%s)",
+		ataio->res.error,
+		(ataio->res.error & 0x80) ? "ICRC " : "",
+		(ataio->res.error & 0x40) ? "UNC " : "",
+		(ataio->res.error & 0x20) ? "MC " : "",
+		(ataio->res.error & 0x10) ? "IDNF " : "",
+		(ataio->res.error & 0x08) ? "MCR " : "",
+		(ataio->res.error & 0x04) ? "ABRT " : "",
+		(ataio->res.error & 0x02) ? "NM " : "",
+		(ataio->res.error & 0x01) ? "ILI" : "");
+	}
+
+	return(0);
+}
+
+/*
+ * ata_res_sbuf() returns 0 for success and -1 for failure.
+ */
+int
+ata_res_sbuf(struct ccb_ataio *ataio, struct sbuf *sb)
+{
+	char res_str[(11 * 3) + 1];
+
+	sbuf_printf(sb, "RES: %s",
+	    ata_res_string(&ataio->res, res_str, sizeof(res_str)));
+
+	return(0);
+}
+
 void
 ata_print_ident(struct ata_params *ident_data)
 {

Modified: head/sys/cam/ata/ata_all.h
==============================================================================
--- head/sys/cam/ata/ata_all.h	Tue Nov  3 09:28:45 2009	(r198848)
+++ head/sys/cam/ata/ata_all.h	Tue Nov  3 11:19:05 2009	(r198849)
@@ -81,6 +81,14 @@ struct ata_res {
 };
 
 int	ata_version(int ver);
+
+char *	ata_op_string(struct ata_cmd *cmd);
+char *	ata_cmd_string(struct ata_cmd *cmd, char *cmd_string, size_t len);
+char *	ata_res_string(struct ata_res *res, char *res_string, size_t len);
+int	ata_command_sbuf(struct ccb_ataio *ataio, struct sbuf *sb);
+int	ata_status_sbuf(struct ccb_ataio *ataio, struct sbuf *sb);
+int	ata_res_sbuf(struct ccb_ataio *ataio, struct sbuf *sb);
+
 void	ata_print_ident(struct ata_params *ident_data);
 
 void	ata_28bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint8_t features,

Modified: head/sys/cam/cam.c
==============================================================================
--- head/sys/cam/cam.c	Tue Nov  3 09:28:45 2009	(r198848)
+++ head/sys/cam/cam.c	Tue Nov  3 11:19:05 2009	(r198849)
@@ -229,6 +229,21 @@ cam_error_string(struct cam_device *devi
 		return(NULL);
 
 	switch (ccb->ccb_h.func_code) {
+		case XPT_ATA_IO:
+			switch (proto_flags & CAM_EPF_LEVEL_MASK) {
+			case CAM_EPF_NONE:
+				break;
+			case CAM_EPF_ALL:
+			case CAM_EPF_NORMAL:
+				proto_flags |= CAM_EAF_PRINT_RESULT;
+				/* FALLTHROUGH */
+			case CAM_EPF_MINIMAL:
+				proto_flags |= CAM_EAF_PRINT_STATUS;
+				/* FALLTHROUGH */
+			default:
+				break;
+			}
+			break;
 		case XPT_SCSI_IO:
 			switch (proto_flags & CAM_EPF_LEVEL_MASK) {
 			case CAM_EPF_NONE:
@@ -256,10 +271,12 @@ cam_error_string(struct cam_device *devi
 	sbuf_new(&sb, str, str_len, 0);
 
 	if (flags & CAM_ESF_COMMAND) {
-
 		sbuf_cat(&sb, path_str);
-
 		switch (ccb->ccb_h.func_code) {
+		case XPT_ATA_IO:
+			ata_command_sbuf(&ccb->ataio, &sb);
+			sbuf_printf(&sb, "\n");
+			break;
 		case XPT_SCSI_IO:
 #ifdef _KERNEL
 			scsi_command_string(&ccb->csio, &sb);
@@ -267,7 +284,6 @@ cam_error_string(struct cam_device *devi
 			scsi_command_string(device, &ccb->csio, &sb);
 #endif /* _KERNEL/!_KERNEL */
 			sbuf_printf(&sb, "\n");
-			
 			break;
 		default:
 			break;
@@ -295,6 +311,22 @@ cam_error_string(struct cam_device *devi
 	if (flags & CAM_ESF_PROTO_STATUS) {
   
 		switch (ccb->ccb_h.func_code) {
+		case XPT_ATA_IO:
+			if ((ccb->ccb_h.status & CAM_STATUS_MASK) !=
+			     CAM_ATA_STATUS_ERROR)
+				break;
+			if (proto_flags & CAM_EAF_PRINT_STATUS) {
+				sbuf_cat(&sb, path_str);
+				ata_status_sbuf(&ccb->ataio, &sb);
+				sbuf_printf(&sb, "\n");
+			}
+			if (proto_flags & CAM_EAF_PRINT_RESULT) {
+				sbuf_cat(&sb, path_str);
+				ata_res_sbuf(&ccb->ataio, &sb);
+				sbuf_printf(&sb, "\n");
+			}
+
+			break;
 		case XPT_SCSI_IO:
 			if ((ccb->ccb_h.status & CAM_STATUS_MASK) !=
 			     CAM_SCSI_STATUS_ERROR)
@@ -302,10 +334,6 @@ cam_error_string(struct cam_device *devi
 
 			if (proto_flags & CAM_ESF_PRINT_STATUS) {
 				sbuf_cat(&sb, path_str);
-				/*
-				 * Print out the SCSI status byte as long as
-				 * the user wants some protocol output.
-				 */
 				sbuf_printf(&sb, "SCSI Status: %s\n",
 					    scsi_status_string(&ccb->csio));
 			}

Modified: head/sys/cam/cam.h
==============================================================================
--- head/sys/cam/cam.h	Tue Nov  3 09:28:45 2009	(r198848)
+++ head/sys/cam/cam.h	Tue Nov  3 11:19:05 2009	(r198849)
@@ -184,6 +184,12 @@ typedef enum {
 	CAM_ESF_PRINT_SENSE	= 0x20
 } cam_error_scsi_flags;
 
+typedef enum {
+	CAM_EAF_PRINT_NONE	= 0x00,
+	CAM_EAF_PRINT_STATUS	= 0x10,
+	CAM_EAF_PRINT_RESULT	= 0x20
+} cam_error_ata_flags;
+
 struct cam_status_entry
 {
 	cam_status  status_code;

Modified: head/sys/cam/cam_periph.c
==============================================================================
--- head/sys/cam/cam_periph.c	Tue Nov  3 09:28:45 2009	(r198848)
+++ head/sys/cam/cam_periph.c	Tue Nov  3 11:19:05 2009	(r198849)
@@ -1612,6 +1612,7 @@ cam_periph_error(union ccb *ccb, cam_fla
 		if (bootverbose && printed == 0) {
 			xpt_print(ccb->ccb_h.path,
 			    "Request completed with CAM_ATA_STATUS_ERROR\n");
+			cam_error_print(ccb, CAM_ESF_ALL, CAM_EPF_ALL);
 			printed++;
 		}
 		/* FALLTHROUGH */
From brde at optusnet.com.au  Tue Nov  3 11:31:55 2009
From: brde at optusnet.com.au (Bruce Evans)
Date: Tue Nov  3 11:32:01 2009
Subject: svn commit: r198848 - head/bin/ps
In-Reply-To: <200911030928.nA39SjLx085597@svn.freebsd.org>
References: <200911030928.nA39SjLx085597@svn.freebsd.org>
Message-ID: <20091103214231.H23957@delplex.bde.org>

On Tue, 3 Nov 2009, Xin LI wrote:

> Log:
>  Increase width for %CPU, RSS and VSZ columns for now.  Modern systems
>  tend to have larger memory, larger process, and more CPU.

This uses space that is not available.  Command names(+args) are now
truncated to 9 columns in "ps l" output :-(.  They used to be truncated to
11 columns recently (down from 12 columns in FreeBSD-5.2).

%CPU != CPU.  Modern systems don't really have more %CPU.  The maximum
percentage of anything is still 100.0.  However, there are various bugs
that result in a percentage of 100.0 being misdisplayed and "percentages"
of more than 100.0 occurring:
- ps used %4.1f format.  This works for all percentages <= 99.9 (after
   rounding), but not for 100.0.  Now ps uses %5.1 format, so 100.0 is
   displayed correctly, but all normal percentages are displayed worse
   than before (space that is not available is used to make them harder
   to read).
- %CPU is not divided by the number of CPUs.  Thus a multi-threaded
   process can have %CPU almost as large as  * 100.0.
   This might be a feature.  E.g., on mostly-idle systems, the idle
   process consists of  threads which take akmost
   100.0% CPU each, so the total %CPU for the idle process is almost
   the above maximum (it is now 799.2 on ref8.freebsd.org due to ref8
   having 8 mostly-idle CPUs).  Since ps now uses %5.1 format, it can
   display %CPU correctly on all systems with <= 9 CPUs, and on most
   systems with 10 CPUs (since the value of 1000.0 which is too wide
   for %5.1 format is even harder to reach on a 10-CPU system than
   the value of 100.0 which is too wide for %4.1 format is to reach on
   1 a-CPU system).  The format is still broken on systems with >= 11 CPUs.
- perhaps schedular bugs can result in %CPU being transiently slightly
   greater than 100.0 for an individual thread.

Expanding %CPU doesn't truncate "ps l" since "ps l" doesn't print %CPU.
Thus the recent truncation is only from 11 COMMAND columns to 9 instead
of to 8.

There seems to be no better fix than to further granulate and dehumanize
the numbers so that they fit in the available space.  E.g., a %CPU of
>= 100 and < 9999 should be displayed in %4.0f format; this only
involvues granulation, but above 9999 it needs to be dehumanized as
well and displayed in k or M or larger granularity (it can be > 9999
with 100 CPUs and > 999k with 10000 CPUs).  A VSZ of >= 10000 (k
implicit) needs to be displayed in M or larger granularity (M explicit).

Bruce
From ed at FreeBSD.org  Tue Nov  3 11:41:21 2009
From: ed at FreeBSD.org (Ed Schouten)
Date: Tue Nov  3 11:41:28 2009
Subject: svn commit: r198850 - head/sbin/sysctl
Message-ID: <200911031141.nA3BfLNB090451@svn.freebsd.org>

Author: ed
Date: Tue Nov  3 11:41:21 2009
New Revision: 198850
URL: http://svn.freebsd.org/changeset/base/198850

Log:
  Just use devname(3) to print device names.
  
  Right now sysctl just prints the major/minor numbers of a device.
  Instead of rolling our own routine for this, we'd better just call
  devname(3) to perform a translation to a device name for us.

Modified:
  head/sbin/sysctl/sysctl.c

Modified: head/sbin/sysctl/sysctl.c
==============================================================================
--- head/sbin/sysctl/sysctl.c	Tue Nov  3 11:19:05 2009	(r198849)
+++ head/sbin/sysctl/sysctl.c	Tue Nov  3 11:41:21 2009	(r198850)
@@ -419,14 +419,7 @@ T_dev_t(int l2, void *p)
 		warnx("T_dev_T %d != %d", l2, sizeof(*d));
 		return (1);
 	}
-	if ((int)(*d) != -1) {
-		if (minor(*d) > 255 || minor(*d) < 0)
-			printf("{ major = %d, minor = 0x%x }",
-				major(*d), minor(*d));
-		else
-			printf("{ major = %d, minor = %d }",
-				major(*d), minor(*d));
-	}
+	printf("%s", devname(*d, S_IFCHR));
 	return (0);
 }
 
From mav at FreeBSD.org  Tue Nov  3 11:47:07 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Tue Nov  3 11:47:17 2009
Subject: svn commit: r198851 - head/sys/dev/ahci
Message-ID: <200911031147.nA3Bl7PF090601@svn.freebsd.org>

Author: mav
Date: Tue Nov  3 11:47:07 2009
New Revision: 198851
URL: http://svn.freebsd.org/changeset/base/198851

Log:
  MFp4:
  - Handle timeouts and fatal errors with port hard-reset. The rest of
  recovery will be done by XPT on receiving async event. More gracefull
  per-device soft-reset recovery can be implemented later.
  - Add workaround for ATI SB600/SB700 PMP probe related bug, to speedup boot.

Modified:
  head/sys/dev/ahci/ahci.c
  head/sys/dev/ahci/ahci.h

Modified: head/sys/dev/ahci/ahci.c
==============================================================================
--- head/sys/dev/ahci/ahci.c	Tue Nov  3 11:41:21 2009	(r198850)
+++ head/sys/dev/ahci/ahci.c	Tue Nov  3 11:47:07 2009	(r198851)
@@ -1221,6 +1221,13 @@ ahci_execute_transaction(struct ahci_slo
 				et = AHCI_ERR_TFE;
 				break;
 			}
+			/* Workaround for ATI SB600/SB700 chipsets. */
+			if (ccb->ccb_h.target_id == 15 &&
+			    pci_get_vendor(device_get_parent(dev)) == 0x1002 &&
+			    (ATA_INL(ch->r_mem, AHCI_P_IS) & AHCI_P_IX_IPM)) {
+				et = AHCI_ERR_TIMEOUT;
+				break;
+			}
 		}
 		if (timeout && (count >= timeout)) {
 			device_printf(ch->dev,
@@ -1275,10 +1282,8 @@ ahci_timeout(struct ahci_slot *slot)
 	    ATA_INL(ch->r_mem, AHCI_P_IS), ATA_INL(ch->r_mem, AHCI_P_CI),
 	    ATA_INL(ch->r_mem, AHCI_P_SACT), ch->rslots,
 	    ATA_INL(ch->r_mem, AHCI_P_TFD), ATA_INL(ch->r_mem, AHCI_P_SERR));
-	/* Kick controller into sane state. */
-	ahci_stop(ch->dev);
-	ahci_start(ch->dev);
 
+	ch->fatalerr = 1;
 	/* Handle frozen command. */
 	if (ch->frozen) {
 		union ccb *fccb = ch->frozen;
@@ -1360,6 +1365,7 @@ ahci_end_transaction(struct ahci_slot *s
 			ccb->csio.scsi_status = SCSI_STATUS_OK;
 		break;
 	case AHCI_ERR_INVALID:
+		ch->fatalerr = 1;
 		ccb->ccb_h.status |= CAM_REQ_INVALID;
 		break;
 	case AHCI_ERR_INNOCENT:
@@ -1375,6 +1381,7 @@ ahci_end_transaction(struct ahci_slot *s
 		}
 		break;
 	case AHCI_ERR_SATA:
+		ch->fatalerr = 1;
 		if (!ch->readlog) {
 			xpt_freeze_simq(ch->sim, 1);
 			ccb->ccb_h.status &= ~CAM_STATUS_MASK;
@@ -1383,6 +1390,10 @@ ahci_end_transaction(struct ahci_slot *s
 		ccb->ccb_h.status |= CAM_UNCOR_PARITY;
 		break;
 	case AHCI_ERR_TIMEOUT:
+		/* Do no treat soft-reset timeout as fatal here. */
+		if (ccb->ccb_h.func_code != XPT_ATA_IO ||
+	            !(ccb->ataio.cmd.flags & CAM_ATAIO_CONTROL))
+			ch->fatalerr = 1;
 		if (!ch->readlog) {
 			xpt_freeze_simq(ch->sim, 1);
 			ccb->ccb_h.status &= ~CAM_STATUS_MASK;
@@ -1391,6 +1402,7 @@ ahci_end_transaction(struct ahci_slot *s
 		ccb->ccb_h.status |= CAM_CMD_TIMEOUT;
 		break;
 	default:
+		ch->fatalerr = 1;
 		ccb->ccb_h.status |= CAM_REQ_CMP_ERR;
 	}
 	/* Free slot. */
@@ -1414,12 +1426,13 @@ ahci_end_transaction(struct ahci_slot *s
 		ahci_begin_transaction(dev, ccb);
 		return;
 	}
+	/* If it was our READ LOG command - process it. */
+	if (ch->readlog) {
+		ahci_process_read_log(dev, ccb);
 	/* If it was NCQ command error, put result on hold. */
-	if (et == AHCI_ERR_NCQ) {
+	} else if (et == AHCI_ERR_NCQ) {
 		ch->hold[slot->slot] = ccb;
-	} else if (ch->readlog)	/* If it was our READ LOG command - process it. */
-		ahci_process_read_log(dev, ccb);
-	else
+	} else
 		xpt_done(ccb);
 	/* Unfreeze frozen command. */
 	if (ch->frozen && ch->numrslots == 0) {
@@ -1428,6 +1441,13 @@ ahci_end_transaction(struct ahci_slot *s
 		ahci_begin_transaction(dev, fccb);
 		xpt_release_simq(ch->sim, TRUE);
 	}
+	/* If we have no other active commands, ... */
+	if (ch->rslots == 0) {
+		/* if there was fatal error - reset port. */
+		if (ch->fatalerr) {
+			ahci_reset(dev);
+		}
+	}
 	/* Start PM timer. */
 	if (ch->numrslots == 0 && ch->pm_level > 3) {
 		callout_schedule(&ch->pm_timer,
@@ -1674,6 +1694,13 @@ ahci_reset(device_t dev)
 		/* XXX; Commands in loading state. */
 		ahci_end_transaction(&ch->slot[i], AHCI_ERR_INNOCENT);
 	}
+	for (i = 0; i < ch->numslots; i++) {
+		if (!ch->hold[i])
+			continue;
+		xpt_done(ch->hold[i]);
+		ch->hold[i] = NULL;
+	}
+	ch->fatalerr = 0;
 	/* Tell the XPT about the event */
 	xpt_async(AC_BUS_RESET, ch->path, NULL);
 	/* Disable port interrupts */

Modified: head/sys/dev/ahci/ahci.h
==============================================================================
--- head/sys/dev/ahci/ahci.h	Tue Nov  3 11:41:21 2009	(r198850)
+++ head/sys/dev/ahci/ahci.h	Tue Nov  3 11:47:07 2009	(r198851)
@@ -366,6 +366,7 @@ struct ahci_channel {
 	int			numrslots;	/* Number of running slots */
 	int			numtslots;	/* Number of tagged slots */
 	int			readlog;	/* Our READ LOG active */
+	int			fatalerr;	/* Fatal error happend */
 	int			lastslot;	/* Last used slot */
 	int			taggedtarget;	/* Last tagged target */
 	union ccb		*frozen;	/* Frozen command */
From mav at FreeBSD.org  Tue Nov  3 12:03:13 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Tue Nov  3 12:03:19 2009
Subject: svn commit: r198852 - head/sys/dev/siis
Message-ID: <200911031203.nA3C3DGn090939@svn.freebsd.org>

Author: mav
Date: Tue Nov  3 12:03:13 2009
New Revision: 198852
URL: http://svn.freebsd.org/changeset/base/198852

Log:
  MFp4:
  - Rework timeout handling, to make it more graceful for devices sharing
  controller port (with PMP). Wait for other commands completion/timeout
  before initiating recovery.
  - Handle timeouts and fatal errors with port hard-reset. The rest of
  recovery will be done by XPT on receiving async event. More gracefull
  per-device soft-reset recovery can be implemented later.

Modified:
  head/sys/dev/siis/siis.c
  head/sys/dev/siis/siis.h

Modified: head/sys/dev/siis/siis.c
==============================================================================
--- head/sys/dev/siis/siis.c	Tue Nov  3 11:47:07 2009	(r198851)
+++ head/sys/dev/siis/siis.c	Tue Nov  3 12:03:13 2009	(r198852)
@@ -511,7 +511,10 @@ siis_ch_resume(device_t dev)
 	/* Get port out of reset state. */
 	ATA_OUTL(ch->r_mem, SIIS_P_CTLCLR, SIIS_P_CTL_PORT_RESET);
 	ATA_OUTL(ch->r_mem, SIIS_P_CTLCLR, SIIS_P_CTL_32BIT);
-	ATA_OUTL(ch->r_mem, SIIS_P_CTLCLR, SIIS_P_CTL_PME);
+	if (ch->pm_present)
+		ATA_OUTL(ch->r_mem, SIIS_P_CTLSET, SIIS_P_CTL_PME);
+	else
+		ATA_OUTL(ch->r_mem, SIIS_P_CTLCLR, SIIS_P_CTL_PME);
 	/* Enable port interrupts */
 	ATA_OUTL(ch->r_mem, SIIS_P_IESET, SIIS_P_IX_ENABLED);
 	return (0);
@@ -764,7 +767,7 @@ siis_ch_intr(void *data)
 		    estatus == SIIS_P_CMDERR_DATAFIS) {
 			tslots = ch->numtslots[port];
 			for (i = 0; i < SIIS_MAX_SLOTS; i++) {
-				/* XXX: reqests in loading state. */
+				/* XXX: requests in loading state. */
 				if (((ch->rslots >> i) & 1) == 0)
 					continue;
 				if (ch->slot[i].ccb->ccb_h.target_id != port)
@@ -796,7 +799,7 @@ siis_ch_intr(void *data)
 			} else
 				et = SIIS_ERR_INVALID;
 			for (i = 0; i < SIIS_MAX_SLOTS; i++) {
-				/* XXX: reqests in loading state. */
+				/* XXX: requests in loading state. */
 				if (((ch->rslots >> i) & 1) == 0)
 					continue;
 				siis_end_transaction(&ch->slot[i], et);
@@ -967,48 +970,51 @@ siis_execute_transaction(struct siis_slo
 	return;
 }
 
-/* Locked by callout mechanism. */
+/* Must be called with channel locked. */
 static void
-siis_timeout(struct siis_slot *slot)
+siis_process_timeout(device_t dev)
 {
-	device_t dev = slot->dev;
 	struct siis_channel *ch = device_get_softc(dev);
 	int i;
 
 	mtx_assert(&ch->mtx, MA_OWNED);
-	device_printf(dev, "Timeout on slot %d\n", slot->slot);
-device_printf(dev, "%s is %08x ss %08x rs %08x es %08x sts %08x serr %08x\n",
-    __func__, ATA_INL(ch->r_mem, SIIS_P_IS), ATA_INL(ch->r_mem, SIIS_P_SS), ch->rslots,
-    ATA_INL(ch->r_mem, SIIS_P_CMDERR), ATA_INL(ch->r_mem, SIIS_P_STS),
-    ATA_INL(ch->r_mem, SIIS_P_SERR));
-	/* Kick controller into sane state. */
-	siis_portinit(ch->dev);
-
-	if (!ch->readlog)
+	if (!ch->readlog && !ch->recovery) {
 		xpt_freeze_simq(ch->sim, ch->numrslots);
-	/* Handle frozen command. */
-	if (ch->frozen) {
-		union ccb *fccb = ch->frozen;
-		ch->frozen = NULL;
-		fccb->ccb_h.status &= ~CAM_STATUS_MASK;
-		fccb->ccb_h.status |= CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ;
-		if (!(fccb->ccb_h.status & CAM_DEV_QFRZN)) {
-			xpt_freeze_devq(fccb->ccb_h.path, 1);
-			fccb->ccb_h.status |= CAM_DEV_QFRZN;
-		}
-		xpt_done(fccb);
+		ch->recovery = 1;
 	}
-	/* Handle command with timeout. */
-	siis_end_transaction(&ch->slot[slot->slot], SIIS_ERR_TIMEOUT);
 	/* Handle the rest of commands. */
 	for (i = 0; i < SIIS_MAX_SLOTS; i++) {
 		/* Do we have a running request on slot? */
 		if (ch->slot[i].state < SIIS_SLOT_RUNNING)
 			continue;
-		siis_end_transaction(&ch->slot[i], SIIS_ERR_INNOCENT);
+		siis_end_transaction(&ch->slot[i], SIIS_ERR_TIMEOUT);
 	}
 }
 
+/* Locked by callout mechanism. */
+static void
+siis_timeout(struct siis_slot *slot)
+{
+	device_t dev = slot->dev;
+	struct siis_channel *ch = device_get_softc(dev);
+
+	mtx_assert(&ch->mtx, MA_OWNED);
+	device_printf(dev, "Timeout on slot %d\n", slot->slot);
+device_printf(dev, "%s is %08x ss %08x rs %08x es %08x sts %08x serr %08x\n",
+    __func__, ATA_INL(ch->r_mem, SIIS_P_IS), ATA_INL(ch->r_mem, SIIS_P_SS), ch->rslots,
+    ATA_INL(ch->r_mem, SIIS_P_CMDERR), ATA_INL(ch->r_mem, SIIS_P_STS),
+    ATA_INL(ch->r_mem, SIIS_P_SERR));
+
+	if (ch->toslots == 0)
+		xpt_freeze_simq(ch->sim, 1);
+	ch->toslots |= (1 << slot->slot);
+	if ((ch->rslots & ~ch->toslots) == 0)
+		siis_process_timeout(dev);
+	else
+		device_printf(dev, " ... waiting for slots %08x\n",
+		    ch->rslots & ~ch->toslots);
+}
+
 /* Must be called with channel locked. */
 static void
 siis_end_transaction(struct siis_slot *slot, enum siis_err_type et)
@@ -1071,6 +1077,7 @@ siis_end_transaction(struct siis_slot *s
 			ccb->csio.scsi_status = SCSI_STATUS_OK;
 		break;
 	case SIIS_ERR_INVALID:
+		ch->fatalerr = 1;
 		ccb->ccb_h.status |= CAM_REQ_INVALID;
 		break;
 	case SIIS_ERR_INNOCENT:
@@ -1086,9 +1093,11 @@ siis_end_transaction(struct siis_slot *s
 		}
 		break;
 	case SIIS_ERR_SATA:
+		ch->fatalerr = 1;
 		ccb->ccb_h.status |= CAM_UNCOR_PARITY;
 		break;
 	case SIIS_ERR_TIMEOUT:
+		ch->fatalerr = 1;
 		ccb->ccb_h.status |= CAM_CMD_TIMEOUT;
 		break;
 	default:
@@ -1097,6 +1106,11 @@ siis_end_transaction(struct siis_slot *s
 	/* Free slot. */
 	ch->rslots &= ~(1 << slot->slot);
 	ch->aslots &= ~(1 << slot->slot);
+	if (et != SIIS_ERR_TIMEOUT) {
+		if (ch->toslots == (1 << slot->slot))
+			xpt_release_simq(ch->sim, TRUE);
+		ch->toslots &= ~(1 << slot->slot);
+	}
 	slot->state = SIIS_SLOT_EMPTY;
 	slot->ccb = NULL;
 	/* Update channel stats. */
@@ -1105,13 +1119,14 @@ siis_end_transaction(struct siis_slot *s
 	    (ccb->ataio.cmd.flags & CAM_ATAIO_FPDMA)) {
 		ch->numtslots[ccb->ccb_h.target_id]--;
 	}
+	/* If it was our READ LOG command - process it. */
+	if (ch->readlog) {
+		siis_process_read_log(dev, ccb);
 	/* If it was NCQ command error, put result on hold. */
-	if (et == SIIS_ERR_NCQ) {
+	} else if (et == SIIS_ERR_NCQ) {
 		ch->hold[slot->slot] = ccb;
 		ch->numhslots++;
-	} else if (ch->readlog)	/* If it was our READ LOG command - process it. */
-		siis_process_read_log(dev, ccb);
-	else
+	} else
 		xpt_done(ccb);
 	/* Unfreeze frozen command. */
 	if (ch->frozen && ch->numrslots == 0) {
@@ -1122,13 +1137,20 @@ siis_end_transaction(struct siis_slot *s
 	}
 	/* If we have no other active commands, ... */
 	if (ch->rslots == 0) {
-		/* if we have slots in error, we can reinit port. */
-		if (ch->eslots != 0)
-			siis_portinit(dev);
-		/* if there commands on hold, we can do READ LOG. */
-		if (!ch->readlog && ch->numhslots)
-			siis_issue_read_log(dev);
-	}
+		/* if there were timeouts or fatal error - reset port. */
+		if (ch->toslots != 0 || ch->fatalerr) {
+			siis_reset(dev);
+		} else {
+			/* if we have slots in error, we can reinit port. */
+			if (ch->eslots != 0)
+				siis_portinit(dev);
+			/* if there commands on hold, we can do READ LOG. */
+			if (!ch->readlog && ch->numhslots)
+				siis_issue_read_log(dev);
+		}
+	/* If all the reset of commands are in timeout - abort them. */
+	} else if ((ch->rslots & ~ch->toslots) == 0)
+		siis_process_timeout(dev);
 }
 
 static void
@@ -1296,13 +1318,14 @@ static void
 siis_reset(device_t dev)
 {
 	struct siis_channel *ch = device_get_softc(dev);
-	int i;
+	int i, retry = 0;
 	uint32_t val;
 
 	if (bootverbose)
 		device_printf(dev, "SIIS reset...\n");
-	xpt_freeze_simq(ch->sim, ch->numrslots);
-	/* Requeue freezed command. */
+	if (!ch->readlog && !ch->recovery)
+		xpt_freeze_simq(ch->sim, ch->numrslots);
+	/* Requeue frozen command. */
 	if (ch->frozen) {
 		union ccb *fccb = ch->frozen;
 		ch->frozen = NULL;
@@ -1322,6 +1345,20 @@ siis_reset(device_t dev)
 		/* XXX; Commands in loading state. */
 		siis_end_transaction(&ch->slot[i], SIIS_ERR_INNOCENT);
 	}
+	/* Finish all holden commands as-is. */
+	for (i = 0; i < SIIS_MAX_SLOTS; i++) {
+		if (!ch->hold[i])
+			continue;
+		xpt_done(ch->hold[i]);
+		ch->hold[i] = NULL;
+		ch->numhslots--;
+	}
+	if (ch->toslots != 0)
+		xpt_release_simq(ch->sim, TRUE);
+	ch->eslots = 0;
+	ch->recovery = 0;
+	ch->toslots = 0;
+	ch->fatalerr = 0;
 	/* Disable port interrupts */
 	ATA_OUTL(ch->r_mem, SIIS_P_IECLR, 0x0000FFFF);
 	/* Set speed limit. */
@@ -1336,6 +1373,7 @@ siis_reset(device_t dev)
 	ATA_OUTL(ch->r_mem, SIIS_P_SCTL,
 	    ATA_SC_DET_IDLE | val | ((ch->pm_level > 0) ? 0 :
 	    (ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER)));
+retry:
 	siis_devreset(dev);
 	/* Reset and reconnect PHY, */
 	if (!siis_sata_connect(ch)) {
@@ -1350,8 +1388,25 @@ siis_reset(device_t dev)
 		return;
 	}
 	/* Wait for clearing busy status. */
-	if (siis_wait_ready(dev, 10000))
+	if (siis_wait_ready(dev, 10000)) {
 		device_printf(dev, "device ready timeout\n");
+		if (!retry) {
+			device_printf(dev, "trying full port reset ...\n");
+			/* Get port to the reset state. */
+			ATA_OUTL(ch->r_mem, SIIS_P_CTLSET, SIIS_P_CTL_PORT_RESET);
+			DELAY(10000);
+			/* Get port out of reset state. */
+			ATA_OUTL(ch->r_mem, SIIS_P_CTLCLR, SIIS_P_CTL_PORT_RESET);
+			ATA_OUTL(ch->r_mem, SIIS_P_CTLCLR, SIIS_P_CTL_32BIT);
+			if (ch->pm_present)
+				ATA_OUTL(ch->r_mem, SIIS_P_CTLSET, SIIS_P_CTL_PME);
+			else
+				ATA_OUTL(ch->r_mem, SIIS_P_CTLCLR, SIIS_P_CTL_PME);
+			siis_wait_ready(dev, 5000);
+			retry = 1;
+			goto retry;
+		}
+	}
 	ch->devices = 1;
 	/* Enable port interrupts */
 	ATA_OUTL(ch->r_mem, SIIS_P_IS, 0xFFFFFFFF);
@@ -1487,7 +1542,8 @@ siisaction(struct cam_sim *sim, union cc
 		struct	ccb_trans_settings *cts = &ccb->cts;
 
 		if (cts->xport_specific.sata.valid & CTS_SATA_VALID_PM) {
-			if (cts->xport_specific.sata.pm_present)
+			ch->pm_present = cts->xport_specific.sata.pm_present;
+			if (ch->pm_present)
 				ATA_OUTL(ch->r_mem, SIIS_P_CTLSET, SIIS_P_CTL_PME);
 			else
 				ATA_OUTL(ch->r_mem, SIIS_P_CTLCLR, SIIS_P_CTL_PME);
@@ -1522,9 +1578,7 @@ siisaction(struct cam_sim *sim, union cc
 			cts->xport_specific.sata.bitrate = 150000;
 			cts->xport_specific.sata.valid |= CTS_SATA_VALID_SPEED;
 		}
-		cts->xport_specific.sata.pm_present =
-			(ATA_INL(ch->r_mem, SIIS_P_STS) & SIIS_P_CTL_PME) ?
-			    1 : 0;
+		cts->xport_specific.sata.pm_present = ch->pm_present;
 		cts->xport_specific.sata.valid |= CTS_SATA_VALID_PM;
 		ccb->ccb_h.status = CAM_REQ_CMP;
 		xpt_done(ccb);

Modified: head/sys/dev/siis/siis.h
==============================================================================
--- head/sys/dev/siis/siis.h	Tue Nov  3 11:47:07 2009	(r198851)
+++ head/sys/dev/siis/siis.h	Tue Nov  3 12:03:13 2009	(r198852)
@@ -373,13 +373,14 @@ struct siis_channel {
 	uint32_t		rslots;		/* Running slots */
 	uint32_t		aslots;		/* Slots with atomic commands */
 	uint32_t		eslots;		/* Slots in error */
+	uint32_t		toslots;	/* Slots in timeout */
 	int			numrslots;	/* Number of running slots */
 	int			numtslots[SIIS_MAX_SLOTS]; /* Number of tagged slots */
 	int			numhslots;	/* Number of holden slots */
 	int			readlog;	/* Our READ LOG active */
+	int			fatalerr;	/* Fatal error happend */
 	int			recovery;	/* Some slots are in error */
 	int			lastslot;	/* Last used slot */
-	int			taggedtarget;	/* Last tagged target */
 	union ccb		*frozen;	/* Frozen command */
 };
 
From kib at FreeBSD.org  Tue Nov  3 12:52:35 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Tue Nov  3 12:52:42 2009
Subject: svn commit: r198853 - head/sys/kern
Message-ID: <200911031252.nA3CqZdj092015@svn.freebsd.org>

Author: kib
Date: Tue Nov  3 12:52:35 2009
New Revision: 198853
URL: http://svn.freebsd.org/changeset/base/198853

Log:
  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.
  
  In collaboration with:	pho
  Reviewed by:	bz
  PR:	kern/138999
  MFC after:	2 weeks

Modified:
  head/sys/kern/uipc_syscalls.c

Modified: head/sys/kern/uipc_syscalls.c
==============================================================================
--- head/sys/kern/uipc_syscalls.c	Tue Nov  3 12:03:13 2009	(r198852)
+++ head/sys/kern/uipc_syscalls.c	Tue Nov  3 12:52:35 2009	(r198853)
@@ -2037,20 +2037,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 attilio at FreeBSD.org  Tue Nov  3 16:46:52 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Tue Nov  3 16:47:08 2009
Subject: svn commit: r198854 - in head/sys: kern sys vm
Message-ID: <200911031646.nA3GkqB4096838@svn.freebsd.org>

Author: attilio
Date: Tue Nov  3 16:46:52 2009
New Revision: 198854
URL: http://svn.freebsd.org/changeset/base/198854

Log:
  Split P_NOLOAD into a per-thread flag (TDF_NOLOAD).
  This improvements aims for avoiding further cache-misses in scheduler
  specific functions which need to keep track of average thread running
  time and further locking in places setting for this flag.
  
  Reported by:	jeff (originally), kris (currently)
  Reviewed by:	jhb
  Tested by:	Giuseppe Cocomazzi 

Modified:
  head/sys/kern/kern_idle.c
  head/sys/kern/kern_intr.c
  head/sys/kern/sched_4bsd.c
  head/sys/kern/sched_ule.c
  head/sys/sys/proc.h
  head/sys/vm/vm_zeroidle.c

Modified: head/sys/kern/kern_idle.c
==============================================================================
--- head/sys/kern/kern_idle.c	Tue Nov  3 12:52:35 2009	(r198853)
+++ head/sys/kern/kern_idle.c	Tue Nov  3 16:46:52 2009	(r198854)
@@ -74,10 +74,9 @@ idle_setup(void *dummy)
 		if (error)
 			panic("idle_setup: kproc_create error %d\n", error);
 
-		p->p_flag |= P_NOLOAD;
 		thread_lock(td);
 		TD_SET_CAN_RUN(td);
-		td->td_flags |= TDF_IDLETD;
+		td->td_flags |= TDF_IDLETD | TDF_NOLOAD;
 		sched_class(td, PRI_IDLE);
 		sched_prio(td, PRI_MAX_IDLE);
 		thread_unlock(td);

Modified: head/sys/kern/kern_intr.c
==============================================================================
--- head/sys/kern/kern_intr.c	Tue Nov  3 12:52:35 2009	(r198853)
+++ head/sys/kern/kern_intr.c	Tue Nov  3 16:46:52 2009	(r198854)
@@ -1061,6 +1061,7 @@ int
 swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler,
 	    void *arg, int pri, enum intr_type flags, void **cookiep)
 {
+	struct thread *td;
 	struct intr_event *ie;
 	int error;
 
@@ -1085,11 +1086,10 @@ swi_add(struct intr_event **eventp, cons
 	if (error)
 		return (error);
 	if (pri == SWI_CLOCK) {
-		struct proc *p;
-		p = ie->ie_thread->it_thread->td_proc;
-		PROC_LOCK(p);
-		p->p_flag |= P_NOLOAD;
-		PROC_UNLOCK(p);
+		td = ie->ie_thread->it_thread;
+		thread_lock(td);
+		td->td_flags |= TDF_NOLOAD;
+		thread_unlock(td);
 	}
 	return (0);
 }

Modified: head/sys/kern/sched_4bsd.c
==============================================================================
--- head/sys/kern/sched_4bsd.c	Tue Nov  3 12:52:35 2009	(r198853)
+++ head/sys/kern/sched_4bsd.c	Tue Nov  3 16:46:52 2009	(r198854)
@@ -728,10 +728,10 @@ sched_exit_thread(struct thread *td, str
 	thread_lock(td);
 	td->td_estcpu = ESTCPULIM(td->td_estcpu + child->td_estcpu);
 	thread_unlock(td);
-	mtx_lock_spin(&sched_lock);
-	if ((child->td_proc->p_flag & P_NOLOAD) == 0)
+	thread_lock(child);
+	if ((child->td_flags & TDF_NOLOAD) == 0)
 		sched_load_rem();
-	mtx_unlock_spin(&sched_lock);
+	thread_unlock(child);
 }
 
 void
@@ -937,7 +937,7 @@ sched_switch(struct thread *td, struct t
 		thread_unlock(td);
 	}
 
-	if ((p->p_flag & P_NOLOAD) == 0)
+	if ((td->td_flags & TDF_NOLOAD) == 0)
 		sched_load_rem();
 
 	if (newtd)
@@ -980,7 +980,7 @@ sched_switch(struct thread *td, struct t
 			("trying to run inhibited thread"));
 		newtd->td_flags |= TDF_DIDRUN;
         	TD_SET_RUNNING(newtd);
-		if ((newtd->td_proc->p_flag & P_NOLOAD) == 0)
+		if ((newtd->td_flags & TDF_NOLOAD) == 0)
 			sched_load_add();
 	} else {
 		newtd = choosethread();
@@ -1289,7 +1289,7 @@ sched_add(struct thread *td, int flags)
 		}
 	}
 
-	if ((td->td_proc->p_flag & P_NOLOAD) == 0)
+	if ((td->td_flags & TDF_NOLOAD) == 0)
 		sched_load_add();
 	runq_add(ts->ts_runq, td, flags);
 	if (cpu != NOCPU)
@@ -1338,7 +1338,7 @@ sched_add(struct thread *td, int flags)
 		if (maybe_preempt(td))
 			return;
 	}
-	if ((td->td_proc->p_flag & P_NOLOAD) == 0)
+	if ((td->td_flags & TDF_NOLOAD) == 0)
 		sched_load_add();
 	runq_add(ts->ts_runq, td, flags);
 	maybe_resched(td);
@@ -1360,7 +1360,7 @@ sched_rem(struct thread *td)
 	    "prio:%d", td->td_priority, KTR_ATTR_LINKED,
 	    sched_tdname(curthread));
 
-	if ((td->td_proc->p_flag & P_NOLOAD) == 0)
+	if ((td->td_flags & TDF_NOLOAD) == 0)
 		sched_load_rem();
 #ifdef SMP
 	if (ts->ts_runq != &runq)

Modified: head/sys/kern/sched_ule.c
==============================================================================
--- head/sys/kern/sched_ule.c	Tue Nov  3 12:52:35 2009	(r198853)
+++ head/sys/kern/sched_ule.c	Tue Nov  3 16:46:52 2009	(r198854)
@@ -495,7 +495,7 @@ tdq_load_add(struct tdq *tdq, struct thr
 	THREAD_LOCK_ASSERT(td, MA_OWNED);
 
 	tdq->tdq_load++;
-	if ((td->td_proc->p_flag & P_NOLOAD) == 0)
+	if ((td->td_flags & TDF_NOLOAD) == 0)
 		tdq->tdq_sysload++;
 	KTR_COUNTER0(KTR_SCHED, "load", tdq->tdq_loadname, tdq->tdq_load);
 }
@@ -514,7 +514,7 @@ tdq_load_rem(struct tdq *tdq, struct thr
 	    ("tdq_load_rem: Removing with 0 load on queue %d", TDQ_ID(tdq)));
 
 	tdq->tdq_load--;
-	if ((td->td_proc->p_flag & P_NOLOAD) == 0)
+	if ((td->td_flags & TDF_NOLOAD) == 0)
 		tdq->tdq_sysload--;
 	KTR_COUNTER0(KTR_SCHED, "load", tdq->tdq_loadname, tdq->tdq_load);
 }

Modified: head/sys/sys/proc.h
==============================================================================
--- head/sys/sys/proc.h	Tue Nov  3 12:52:35 2009	(r198853)
+++ head/sys/sys/proc.h	Tue Nov  3 16:46:52 2009	(r198854)
@@ -322,7 +322,7 @@ do {									\
 #define	TDF_NEEDSUSPCHK	0x00008000 /* Thread may need to suspend. */
 #define	TDF_NEEDRESCHED	0x00010000 /* Thread needs to yield. */
 #define	TDF_NEEDSIGCHK	0x00020000 /* Thread may need signal delivery. */
-#define	TDF_UNUSED18	0x00040000 /* --available-- */
+#define	TDF_NOLOAD	0x00040000 /* Ignore during load avg calculations. */
 #define	TDF_UNUSED19	0x00080000 /* Thread is sleeping on a umtx. */
 #define	TDF_THRWAKEUP	0x00100000 /* Libthr thread must not suspend itself. */
 #define	TDF_UNUSED21	0x00200000 /* --available-- */
@@ -558,7 +558,7 @@ struct proc {
 #define	P_ADVLOCK	0x00001	/* Process may hold a POSIX advisory lock. */
 #define	P_CONTROLT	0x00002	/* Has a controlling terminal. */
 #define	P_KTHREAD	0x00004	/* Kernel thread (*). */
-#define	P_NOLOAD	0x00008	/* Ignore during load avg calculations. */
+#define	P_UNUSED0	0x00008	/* available. */
 #define	P_PPWAIT	0x00010	/* Parent is waiting for child to exec/exit. */
 #define	P_PROFIL	0x00020	/* Has started profiling. */
 #define	P_STOPPROF	0x00040	/* Has thread requesting to stop profiling. */

Modified: head/sys/vm/vm_zeroidle.c
==============================================================================
--- head/sys/vm/vm_zeroidle.c	Tue Nov  3 12:52:35 2009	(r198853)
+++ head/sys/vm/vm_zeroidle.c	Tue Nov  3 16:46:52 2009	(r198854)
@@ -139,26 +139,21 @@ vm_pagezero(void __unused *arg)
 	}
 }
 
-static struct proc *pagezero_proc;
-
 static void
 pagezero_start(void __unused *arg)
 {
 	int error;
+	struct proc *p;
 	struct thread *td;
 
-	error = kproc_create(vm_pagezero, NULL, &pagezero_proc, RFSTOPPED, 0,
-	    "pagezero");
+	error = kproc_create(vm_pagezero, NULL, &p, RFSTOPPED, 0, "pagezero");
 	if (error)
 		panic("pagezero_start: error %d\n", error);
-	/*
-	 * We're an idle task, don't count us in the load.
-	 */
-	PROC_LOCK(pagezero_proc);
-	pagezero_proc->p_flag |= P_NOLOAD;
-	PROC_UNLOCK(pagezero_proc);
-	td = FIRST_THREAD_IN_PROC(pagezero_proc);
+	td = FIRST_THREAD_IN_PROC(p);
 	thread_lock(td);
+
+	/* We're an idle task, don't count us in the load. */
+	td->td_flags |= TDF_NOLOAD;
 	sched_class(td, PRI_IDLE);
 	sched_prio(td, PRI_MAX_IDLE);
 	sched_add(td, SRQ_BORING);
From alc at FreeBSD.org  Tue Nov  3 17:15:16 2009
From: alc at FreeBSD.org (Alan Cox)
Date: Tue Nov  3 17:15:25 2009
Subject: svn commit: r198855 - head/sys/vm
Message-ID: <200911031715.nA3HFG7T097552@svn.freebsd.org>

Author: alc
Date: Tue Nov  3 17:15:15 2009
New Revision: 198855
URL: http://svn.freebsd.org/changeset/base/198855

Log:
  Eliminate a bit of hackery from vm_fault().  The operations that this
  hackery sought to prevent are now properly supported by vm_map_protect().
  (See r198505.)
  
  Reviewed by:	kib

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Tue Nov  3 16:46:52 2009	(r198854)
+++ head/sys/vm/vm_fault.c	Tue Nov  3 17:15:15 2009	(r198855)
@@ -264,17 +264,6 @@ RetryFault:;
 			&fs.entry, &fs.first_object, &fs.first_pindex, &prot, &wired);
 		if (result != KERN_SUCCESS)
 			return (result);
-
-		/*
-		 * If we don't COW now, on a user wire, the user will never
-		 * be able to write to the mapping.  If we don't make this
-		 * restriction, the bookkeeping would be nearly impossible.
-		 *
-		 * XXX The following assignment modifies the map without
-		 * holding a write lock on it.
-		 */
-		if ((fs.entry->protection & VM_PROT_WRITE) == 0)
-			fs.entry->max_protection &= ~VM_PROT_WRITE;
 	}
 
 	map_generation = fs.map->timestamp;
From jhb at FreeBSD.org  Tue Nov  3 18:40:43 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue Nov  3 18:40:54 2009
Subject: svn commit: r198856 - head/secure/usr.bin/bdes
Message-ID: <200911031840.nA3Iegir099750@svn.freebsd.org>

Author: jhb
Date: Tue Nov  3 18:40:42 2009
New Revision: 198856
URL: http://svn.freebsd.org/changeset/base/198856

Log:
  Fix a couple of comment typos.
  
  MFC after:	1 week

Modified:
  head/secure/usr.bin/bdes/bdes.c

Modified: head/secure/usr.bin/bdes/bdes.c
==============================================================================
--- head/secure/usr.bin/bdes/bdes.c	Tue Nov  3 17:15:15 2009	(r198855)
+++ head/secure/usr.bin/bdes/bdes.c	Tue Nov  3 18:40:42 2009	(r198856)
@@ -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 jh at FreeBSD.org  Tue Nov  3 19:05:06 2009
From: jh at FreeBSD.org (Jaakko Heinonen)
Date: Tue Nov  3 19:05:12 2009
Subject: svn commit: r198857 - head/sys/dev/fdc
Message-ID: <200911031905.nA3J55Wo000741@svn.freebsd.org>

Author: jh
Date: Tue Nov  3 19:05:05 2009
New Revision: 198857
URL: http://svn.freebsd.org/changeset/base/198857

Log:
  fdc(4) module unload fixes:
  
  - Tear down the interrupt handler before killing the worker thread.
  - Do geom withering as GEOM event to avoid acquiring the GEOM topology
    lock under Giant.
  
  PR:		kern/104079
  Reviewed by:	joerg
  Approved by:	trasz (mentor)

Modified:
  head/sys/dev/fdc/fdc.c

Modified: head/sys/dev/fdc/fdc.c
==============================================================================
--- head/sys/dev/fdc/fdc.c	Tue Nov  3 18:40:42 2009	(r198856)
+++ head/sys/dev/fdc/fdc.c	Tue Nov  3 19:05:05 2009	(r198857)
@@ -1734,6 +1734,10 @@ fdc_detach(device_t dev)
 	if ((error = bus_generic_detach(dev)))
 		return (error);
 
+	if (fdc->fdc_intr)
+		bus_teardown_intr(dev, fdc->res_irq, fdc->fdc_intr);
+	fdc->fdc_intr = NULL;
+
 	/* kill worker thread */
 	mtx_lock(&fdc->fdc_mtx);
 	fdc->flags |= FDC_KTHREAD_EXIT;
@@ -2031,15 +2035,22 @@ fd_attach(device_t dev)
 	return (0);
 }
 
+static void
+fd_detach_geom(void *arg, int flag)
+{
+	struct	fd_data *fd = arg;
+
+	g_topology_assert();
+	g_wither_geom(fd->fd_geom, ENXIO);
+}
+
 static int
 fd_detach(device_t dev)
 {
 	struct	fd_data *fd;
 
 	fd = device_get_softc(dev);
-	g_topology_lock();
-	g_wither_geom(fd->fd_geom, ENXIO);
-	g_topology_unlock();
+	g_waitfor_event(fd_detach_geom, fd, M_WAITOK, NULL);
 	while (device_get_state(dev) == DS_BUSY)
 		tsleep(fd, PZERO, "fdd", hz/10);
 	callout_drain(&fd->toffhandle);
From tom at tomjudge.com  Tue Nov  3 19:30:36 2009
From: tom at tomjudge.com (Tom Judge)
Date: Tue Nov  3 19:30:48 2009
Subject: svn commit: r198320 - in head/sys: conf dev/bce
In-Reply-To: <200910211247.n9LCl9Ab099426@svn.freebsd.org>
References: <200910211247.n9LCl9Ab099426@svn.freebsd.org>
Message-ID: <4AF08495.5040507@tomjudge.com>

Hi Stanislav,

Any chance this can be MFC'd to stable/8, stable/7 and releng/8.0?

Tom


Stanislav Sedov wrote:
> Author: stas
> Date: Wed Oct 21 12:47:09 2009
> New Revision: 198320
> URL: http://svn.freebsd.org/changeset/base/198320
> 
> Log:
>   - Introduce new option BCE_JUMBO_HDRSPLIT that allows user to enable header
>     splitting in bce(4) instead of (ab)using ZERO_COPY_SOCKETS that was not
>     propagated into if_bce.c anyway.  It is disabled by default.
>   
>   Approved by:	davidch
>   MFC after:	3 days
> 
> Modified:
>   head/sys/conf/NOTES
>   head/sys/conf/options
>   head/sys/dev/bce/if_bce.c
>   head/sys/dev/bce/if_bcereg.h
> 
> Modified: head/sys/conf/NOTES
> ==============================================================================
> --- head/sys/conf/NOTES	Wed Oct 21 12:42:25 2009	(r198319)
> +++ head/sys/conf/NOTES	Wed Oct 21 12:47:09 2009	(r198320)
> @@ -1985,6 +1985,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: head/sys/conf/options
> ==============================================================================
> --- head/sys/conf/options	Wed Oct 21 12:42:25 2009	(r198319)
> +++ head/sys/conf/options	Wed Oct 21 12:47:09 2009	(r198320)
> @@ -511,6 +511,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: head/sys/dev/bce/if_bce.c
> ==============================================================================
> --- head/sys/dev/bce/if_bce.c	Wed Oct 21 12:42:25 2009	(r198319)
> +++ head/sys/dev/bce/if_bce.c	Wed Oct 21 12:47:09 2009	(r198320)
> @@ -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 *);
> @@ -393,7 +393,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 *);
> @@ -602,7 +602,7 @@ bce_print_adapter_info(struct bce_softc 
>  	/* Firmware version and device features. */
>  	printf("B/C (%s); Flags (", sc->bce_bc_ver);
>  
> -#ifdef ZERO_COPY_SOCKETS
> +#ifdef BCE_JUMBO_HDRSPLIT
>  	printf("SPLT ");
>      i++;
>  #endif
> @@ -1066,7 +1066,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) -
> @@ -2835,7 +2835,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) {
> @@ -2899,7 +2899,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) {
> @@ -3345,7 +3345,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
> @@ -3386,7 +3386,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
> @@ -4473,7 +4473,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);
> @@ -4910,7 +4910,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)
> @@ -4991,7 +4991,7 @@ bce_get_rx_buf_exit:
>  }
>  
>  
> -#ifdef ZERO_COPY_SOCKETS
> +#ifdef BCE_JUMBO_HDRSPLIT
>  /****************************************************************************/
>  /* Encapsulate an mbuf cluster into the page chain.                        */
>  /*                                                                          */
> @@ -5100,7 +5100,7 @@ bce_get_pg_buf_exit:
>  
>  	return(rc);
>  }
> -#endif /* ZERO_COPY_SOCKETS */
> +#endif /* BCE_JUMBO_HDRSPLIT */
>  
>  /****************************************************************************/
>  /* Initialize the TX context memory.                                        */
> @@ -5456,7 +5456,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.            */
> @@ -5620,7 +5620,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 */
>  
>  
>  /****************************************************************************/
> @@ -5793,7 +5793,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
> @@ -5809,7 +5809,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,
> @@ -5821,7 +5821,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
>  
> @@ -5882,7 +5882,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 <=
> @@ -6056,7 +6056,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
>  
> @@ -6066,7 +6066,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
>  		}
> @@ -6077,7 +6077,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
> @@ -6090,7 +6090,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);
> @@ -6336,7 +6336,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
> @@ -6368,7 +6368,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);
>  
> @@ -6881,7 +6881,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. */
> @@ -7584,7 +7584,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);
> @@ -7764,7 +7764,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.             */
>  /*                                                                          */
> @@ -8392,7 +8392,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,
> @@ -8687,7 +8687,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.                             */
>  /*                                                                          */
> @@ -8811,7 +8811,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.                          */
>  /*                                                                          */
> @@ -9298,7 +9298,7 @@ bce_dump_rx_chain(struct bce_softc *sc, 
>  }
>  
>  
> -#ifdef ZERO_COPY_SOCKETS
> +#ifdef BCE_JUMBO_HDRSPLIT
>  /****************************************************************************/
>  /* Prints out the page chain.                                               */
>  /*                                                                          */
> @@ -9779,7 +9779,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(
> @@ -9799,7 +9799,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(
> @@ -9852,7 +9852,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));
>  
> @@ -10358,7 +10358,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: head/sys/dev/bce/if_bcereg.h
> ==============================================================================
> --- head/sys/dev/bce/if_bcereg.h	Wed Oct 21 12:42:25 2009	(r198319)
> +++ head/sys/dev/bce/if_bcereg.h	Wed Oct 21 12:47:09 2009	(r198320)
> @@ -6216,7 +6216,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.
> @@ -6238,7 +6238,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
>  
> @@ -6517,7 +6517,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
> @@ -6534,7 +6534,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
>  
> @@ -6556,7 +6556,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];
> @@ -6593,7 +6593,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
>  
> @@ -6605,7 +6605,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];
> @@ -6617,7 +6617,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
> @@ -6705,7 +6705,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
>  
> @@ -6722,7 +6722,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
> _______________________________________________
> svn-src-all@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"

From jkim at FreeBSD.org  Tue Nov  3 20:22:09 2009
From: jkim at FreeBSD.org (Jung-uk Kim)
Date: Tue Nov  3 20:22:16 2009
Subject: svn commit: r198858 - in head/sys: dev/fb dev/syscons sys
Message-ID: <200911032022.nA3KM96H003434@svn.freebsd.org>

Author: jkim
Date: Tue Nov  3 20:22:09 2009
New Revision: 198858
URL: http://svn.freebsd.org/changeset/base/198858

Log:
  Fix VESA color palette corruption:
  
  - VBE 3.0 says palette format resets to 6-bit mode when video mode changes.
  We simply set 8-bit mode when we switch modes if the adapter supports it.
  - VBE 3.0 also says if the mode is not VGA compatible, we must use VBE
  function to save/restore palette.  Otherwise, VGA function may be used.
  Thus, reinstate the save/load palette functions only for non-VGA compatible
  modes regardless of its palette format.
  - Let vesa(4) set VESA modes even if vga(4) claims to support it.
  - Reset default palette if VESA pixel mode is set initially.
  - Fix more style nits.

Modified:
  head/sys/dev/fb/vesa.c
  head/sys/dev/syscons/syscons.c
  head/sys/sys/fbio.h

Modified: head/sys/dev/fb/vesa.c
==============================================================================
--- head/sys/dev/fb/vesa.c	Tue Nov  3 19:05:05 2009	(r198857)
+++ head/sys/dev/fb/vesa.c	Tue Nov  3 20:22:09 2009	(r198858)
@@ -174,10 +174,8 @@ static int vesa_bios_save_palette2(int s
 				   u_char *b, int bits);
 static int vesa_bios_load_palette(int start, int colors, u_char *palette,
 				  int bits);
-#ifdef notyet
 static int vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g,
 				   u_char *b, int bits);
-#endif
 #define STATE_SIZE	0
 #define STATE_SAVE	1
 #define STATE_LOAD	2
@@ -415,9 +413,9 @@ vesa_bios_save_palette(int start, int co
 
 	bits = 8 - bits;
 	for (i = 0; i < colors; ++i) {
-		palette[i*3]     = p[i*4 + 2] << bits;
-		palette[i*3 + 1] = p[i*4 + 1] << bits;
-		palette[i*3 + 2] = p[i*4] << bits;
+		palette[i * 3] = p[i * 4 + 2] << bits;
+		palette[i * 3 + 1] = p[i * 4 + 1] << bits;
+		palette[i * 3 + 2] = p[i * 4] << bits;
 	}
 	x86bios_free(p, colors * 4);
 
@@ -455,9 +453,9 @@ vesa_bios_save_palette2(int start, int c
 
 	bits = 8 - bits;
 	for (i = 0; i < colors; ++i) {
-		r[i] = p[i*4 + 2] << bits;
-		g[i] = p[i*4 + 1] << bits;
-		b[i] = p[i*4] << bits;
+		r[i] = p[i * 4 + 2] << bits;
+		g[i] = p[i * 4 + 1] << bits;
+		b[i] = p[i * 4] << bits;
 	}
 	x86bios_free(p, colors * 4);
 
@@ -487,10 +485,10 @@ vesa_bios_load_palette(int start, int co
 
 	bits = 8 - bits;
 	for (i = 0; i < colors; ++i) {
-		p[i*4]	   = palette[i*3 + 2] >> bits;
-		p[i*4 + 1] = palette[i*3 + 1] >> bits;
-		p[i*4 + 2] = palette[i*3] >> bits;
-		p[i*4 + 3] = 0;
+		p[i * 4] = palette[i * 3 + 2] >> bits;
+		p[i * 4 + 1] = palette[i * 3 + 1] >> bits;
+		p[i * 4 + 2] = palette[i * 3] >> bits;
+		p[i * 4 + 3] = 0;
 	}
 	x86bios_intr(®s, 0x10);
 	x86bios_free(p, colors * 4);
@@ -498,7 +496,6 @@ vesa_bios_load_palette(int start, int co
 	return (regs.R_AX != 0x004f);
 }
 
-#ifdef notyet
 static int
 vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
 			int bits)
@@ -523,17 +520,16 @@ vesa_bios_load_palette2(int start, int c
 
 	bits = 8 - bits;
 	for (i = 0; i < colors; ++i) {
-		p[i*4]	   = b[i] >> bits;
-		p[i*4 + 1] = g[i] >> bits;
-		p[i*4 + 2] = r[i] >> bits;
-		p[i*4 + 3] = 0;
+		p[i * 4] = b[i] >> bits;
+		p[i * 4 + 1] = g[i] >> bits;
+		p[i * 4 + 2] = r[i] >> bits;
+		p[i * 4 + 3] = 0;
 	}
 	x86bios_intr(®s, 0x10);
 	x86bios_free(p, colors * 4);
 
 	return (regs.R_AX != 0x004f);
 }
-#endif
 
 static ssize_t
 vesa_bios_state_buf_size(void)
@@ -702,6 +698,7 @@ vesa_translate_flags(u_int16_t vflags)
 		{ V_MODECOLOR, V_INFO_COLOR, 0 },
 		{ V_MODEGRAPHICS, V_INFO_GRAPHICS, 0 },
 		{ V_MODELFB, V_INFO_LINEAR, 0 },
+		{ V_MODENONVGA, V_INFO_NONVGA, 0 },
 	};
 	int flags;
 	int i;
@@ -1275,7 +1272,8 @@ vesa_set_mode(video_adapter_t *adp, int 
 	 * the new mode correctly.
 	 */
 	if (VESA_MODE(adp->va_mode)) {
-		if ((*prevvidsw->get_info)(adp, mode, &info) == 0) {
+		if (!VESA_MODE(mode) &&
+		    (*prevvidsw->get_info)(adp, mode, &info) == 0) {
 			int10_set_mode(adp->va_initial_bios_mode);
 			if (adp->va_info.vi_flags & V_INFO_LINEAR)
 				vesa_unmap_buffer(adp->va_buffer,
@@ -1288,7 +1286,7 @@ vesa_set_mode(video_adapter_t *adp, int 
 	}
 
 	/* we may not need to handle this mode after all... */
-	if ((*prevvidsw->set_mode)(adp, mode) == 0)
+	if (!VESA_MODE(mode) && (*prevvidsw->set_mode)(adp, mode) == 0)
 		return (0);
 
 	/* is the new mode supported? */
@@ -1306,6 +1304,9 @@ vesa_set_mode(video_adapter_t *adp, int 
 	if (vesa_bios_set_mode(mode | ((info.vi_flags & V_INFO_LINEAR) ? 0x4000 : 0)))
 		return (1);
 
+	if ((vesa_adp_info->v_flags & V_DAC8) != 0)
+		vesa_bios_set_dac(8);
+
 	if (adp->va_info.vi_flags & V_INFO_LINEAR)
 		vesa_unmap_buffer(adp->va_buffer,
 				  vesa_adp_info->v_memsize*64*1024);
@@ -1382,17 +1383,11 @@ static int
 vesa_save_palette(video_adapter_t *adp, u_char *palette)
 {
 	int bits;
-	int error;
 
-	if ((adp == vesa_adp) && (vesa_adp_info->v_flags & V_DAC8)
-	    && VESA_MODE(adp->va_mode)) {
-		bits = vesa_bios_get_dac();
-		error = vesa_bios_save_palette(0, 256, palette, bits);
-		if (error == 0)
-			return (0);
-		if (bits != 6)
-			return (error);
-	}
+	if ((adp == vesa_adp) &&
+	    (adp->va_info.vi_flags & V_INFO_NONVGA) != 0 &&
+	    (bits = vesa_bios_get_dac()) >= 6)
+		return (vesa_bios_save_palette(0, 256, palette, bits));
 
 	return ((*prevvidsw->save_palette)(adp, palette));
 }
@@ -1400,19 +1395,12 @@ vesa_save_palette(video_adapter_t *adp, 
 static int
 vesa_load_palette(video_adapter_t *adp, u_char *palette)
 {
-#ifdef notyet
 	int bits;
-	int error;
 
-	if ((adp == vesa_adp) && (vesa_adp_info->v_flags & V_DAC8) 
-	    && VESA_MODE(adp->va_mode) && ((bits = vesa_bios_set_dac(8)) > 6)) {
-		error = vesa_bios_load_palette(0, 256, palette, bits);
-		if (error == 0)
-			return (0);
-		if (vesa_bios_set_dac(6) != 6)
-			return (1);
-	}
-#endif /* notyet */
+	if ((adp == vesa_adp) &&
+	    (adp->va_info.vi_flags & V_INFO_NONVGA) != 0 &&
+	    (bits = vesa_bios_get_dac()) >= 6)
+		return (vesa_bios_load_palette(0, 256, palette, bits));
 
 	return ((*prevvidsw->load_palette)(adp, palette));
 }
@@ -1637,14 +1625,11 @@ get_palette(video_adapter_t *adp, int ba
 		return (1);
 	if ((base + count) > 256)
 		return (1);
-	if (!(vesa_adp_info->v_flags & V_DAC8) || !VESA_MODE(adp->va_mode))
+	if ((adp->va_info.vi_flags & V_INFO_NONVGA) == 0 ||
+	    (bits = vesa_bios_get_dac()) < 6)
 		return (1);
 
-	bits = vesa_bios_get_dac();
-	if (bits <= 6)
-		return (1);
-
-	r = malloc(count*3, M_DEVBUF, M_WAITOK);
+	r = malloc(count * 3, M_DEVBUF, M_WAITOK);
 	g = r + count;
 	b = g + count;
 	error = vesa_bios_save_palette2(base, count, r, g, b, bits);
@@ -1659,7 +1644,6 @@ get_palette(video_adapter_t *adp, int ba
 	}
 	free(r, M_DEVBUF);
 
-	/* if error && bits != 6 at this point, we are in trouble... XXX */
 	return (error);
 }
 
@@ -1667,8 +1651,6 @@ static int
 set_palette(video_adapter_t *adp, int base, int count,
 	    u_char *red, u_char *green, u_char *blue, u_char *trans)
 {
-	return (1);
-#ifdef notyet
 	u_char *r;
 	u_char *g;
 	u_char *b;
@@ -1677,11 +1659,11 @@ set_palette(video_adapter_t *adp, int ba
 
 	if ((base < 0) || (base >= 256) || (base + count > 256))
 		return (1);
-	if (!(vesa_adp_info->v_flags & V_DAC8) || !VESA_MODE(adp->va_mode)
-		|| ((bits = vesa_bios_set_dac(8)) <= 6))
+	if ((adp->va_info.vi_flags & V_INFO_NONVGA) == 0 ||
+	    (bits = vesa_bios_get_dac()) < 6)
 		return (1);
 
-	r = malloc(count*3, M_DEVBUF, M_WAITOK);
+	r = malloc(count * 3, M_DEVBUF, M_WAITOK);
 	g = r + count;
 	b = g + count;
 	copyin(red, r, count);
@@ -1690,13 +1672,8 @@ set_palette(video_adapter_t *adp, int ba
 
 	error = vesa_bios_load_palette2(base, count, r, g, b, bits);
 	free(r, M_DEVBUF);
-	if (error == 0)
-		return (0);
 
-	/* if the following call fails, we are in trouble... XXX */
-	vesa_bios_set_dac(6);
-	return (1);
-#endif /* notyet */
+	return (error);
 }
 
 static int

Modified: head/sys/dev/syscons/syscons.c
==============================================================================
--- head/sys/dev/syscons/syscons.c	Tue Nov  3 19:05:05 2009	(r198857)
+++ head/sys/dev/syscons/syscons.c	Tue Nov  3 20:22:09 2009	(r198858)
@@ -414,6 +414,9 @@ sc_attach_unit(int unit, int flags)
 #endif
 	    sc_set_graphics_mode(scp, NULL, vmode);
 	    sc_set_pixel_mode(scp, NULL, 0, 0, 16, 8);
+#ifndef SC_NO_PALETTE_LOADING
+	    vidd_save_palette(sc->adp, sc->palette);
+#endif
 	    sc->initial_mode = vmode;
 #ifdef DEV_SPLASH
 	    /* put up the splash again! */

Modified: head/sys/sys/fbio.h
==============================================================================
--- head/sys/sys/fbio.h	Tue Nov  3 19:05:05 2009	(r198857)
+++ head/sys/sys/fbio.h	Tue Nov  3 20:22:09 2009	(r198858)
@@ -269,6 +269,7 @@ struct video_info {
 #define V_INFO_GRAPHICS	(1 << 1)
 #define V_INFO_LINEAR	(1 << 2)
 #define V_INFO_VESA	(1 << 3)
+#define	V_INFO_NONVGA	(1 << 4)
     int			vi_width;
     int			vi_height;
     int			vi_cwidth;
From thompsa at FreeBSD.org  Tue Nov  3 21:06:19 2009
From: thompsa at FreeBSD.org (Andrew Thompson)
Date: Tue Nov  3 21:06:25 2009
Subject: svn commit: r198859 - head
Message-ID: <200911032106.nA3L6JCn004918@svn.freebsd.org>

Author: thompsa
Date: Tue Nov  3 21:06:19 2009
New Revision: 198859
URL: http://svn.freebsd.org/changeset/base/198859

Log:
  Belatedly add an UPDATING message for the usb ethernet ifnet naming in r188412.
  
  MFC after:	3 days

Modified:
  head/UPDATING

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Tue Nov  3 20:22:09 2009	(r198858)
+++ head/UPDATING	Tue Nov  3 21:06:19 2009	(r198859)
@@ -537,6 +537,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.
 		# Map old usb library to new one for usb2 stack
 		libusb-0.1.so.8	libusb20.so.1
 
+20090209:
+	All USB ethernet devices now attach as interfaces under the name ueN
+	(eg. ue0). This is to provide a predictable name as vendors often
+	change usb chipsets in a product without notice.
+
 20090203:
 	The ichsmb(4) driver has been changed to require SMBus slave
 	addresses be left-justified (xxxxxxx0b) rather than right-justified.
From ed at FreeBSD.org  Tue Nov  3 21:06:20 2009
From: ed at FreeBSD.org (Ed Schouten)
Date: Tue Nov  3 21:06:41 2009
Subject: svn commit: r198860 - in head/sys: kern sys
Message-ID: <200911032106.nA3L6Jhq004939@svn.freebsd.org>

Author: ed
Date: Tue Nov  3 21:06:19 2009
New Revision: 198860
URL: http://svn.freebsd.org/changeset/base/198860

Log:
  Make /dev/klog and kern.msgbuf* MPSAFE.
  
  Normally msgbufp is locked using Giant. Switch it to use the
  msgbuf_lock. Instead of changing the tsleep() calls to msleep(), just
  convert it to condvar(9).
  
  In my opinion the locking around msgbuf_peekbytes() still remains
  questionable. It looks like locks are dropped while performing copies of
  multiple blocks to userspace, which may cause the msgbuf to be reset in
  the mean time. At least getting it underneath from Giant should make it
  a little easier for us to figure out how to solve that.
  
  Reminded by:	rdivacky

Modified:
  head/sys/kern/subr_log.c
  head/sys/kern/subr_prf.c
  head/sys/sys/msgbuf.h

Modified: head/sys/kern/subr_log.c
==============================================================================
--- head/sys/kern/subr_log.c	Tue Nov  3 21:06:19 2009	(r198859)
+++ head/sys/kern/subr_log.c	Tue Nov  3 21:06:19 2009	(r198860)
@@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$");
 #define LOG_RDPRI	(PZERO + 1)
 
 #define LOG_ASYNC	0x04
-#define LOG_RDWAIT	0x08
 
 static	d_open_t	logopen;
 static	d_close_t	logclose;
@@ -65,7 +64,6 @@ static	void logtimeout(void *arg);
 
 static struct cdevsw log_cdevsw = {
 	.d_version =	D_VERSION,
-	.d_flags =	D_NEEDGIANT,
 	.d_open =	logopen,
 	.d_close =	logclose,
 	.d_read =	logread,
@@ -81,7 +79,10 @@ static struct logsoftc {
 	struct	callout sc_callout;	/* callout to wakeup syslog  */
 } logsoftc;
 
-int	log_open;			/* also used in log() */
+int			log_open;	/* also used in log() */
+static struct cv	log_wakeup;
+struct mtx		msgbuf_lock;
+MTX_SYSINIT(msgbuf_lock, &msgbuf_lock, "msgbuf lock", MTX_DEF);
 
 /* Times per second to check for a pending syslog wakeup. */
 static int	log_wakeups_per_second = 5;
@@ -92,17 +93,23 @@ SYSCTL_INT(_kern, OID_AUTO, log_wakeups_
 static	int
 logopen(struct cdev *dev, int flags, int mode, struct thread *td)
 {
-	if (log_open)
-		return (EBUSY);
-	log_open = 1;
-	callout_init(&logsoftc.sc_callout, 0);
-	fsetown(td->td_proc->p_pid, &logsoftc.sc_sigio);	/* signal process only */
+
 	if (log_wakeups_per_second < 1) {
 		printf("syslog wakeup is less than one.  Adjusting to 1.\n");
 		log_wakeups_per_second = 1;
 	}
+
+	mtx_lock(&msgbuf_lock);
+	if (log_open) {
+		mtx_unlock(&msgbuf_lock);
+		return (EBUSY);
+	}
+	log_open = 1;
 	callout_reset(&logsoftc.sc_callout, hz / log_wakeups_per_second,
 	    logtimeout, NULL);
+	mtx_unlock(&msgbuf_lock);
+
+	fsetown(td->td_proc->p_pid, &logsoftc.sc_sigio);	/* signal process only */
 	return (0);
 }
 
@@ -111,10 +118,14 @@ static	int
 logclose(struct cdev *dev, int flag, int mode, struct thread *td)
 {
 
-	log_open = 0;
+	funsetown(&logsoftc.sc_sigio);
+
+	mtx_lock(&msgbuf_lock);
 	callout_stop(&logsoftc.sc_callout);
 	logsoftc.sc_state = 0;
-	funsetown(&logsoftc.sc_sigio);
+	log_open = 0;
+	mtx_unlock(&msgbuf_lock);
+
 	return (0);
 }
 
@@ -124,32 +135,32 @@ logread(struct cdev *dev, struct uio *ui
 {
 	char buf[128];
 	struct msgbuf *mbp = msgbufp;
-	int error = 0, l, s;
+	int error = 0, l;
 
-	s = splhigh();
+	mtx_lock(&msgbuf_lock);
 	while (msgbuf_getcount(mbp) == 0) {
 		if (flag & IO_NDELAY) {
-			splx(s);
+			mtx_unlock(&msgbuf_lock);
 			return (EWOULDBLOCK);
 		}
-		logsoftc.sc_state |= LOG_RDWAIT;
-		if ((error = tsleep(mbp, LOG_RDPRI | PCATCH, "klog", 0))) {
-			splx(s);
+		if ((error = cv_wait_sig(&log_wakeup, &msgbuf_lock)) != 0) {
+			mtx_unlock(&msgbuf_lock);
 			return (error);
 		}
 	}
-	splx(s);
-	logsoftc.sc_state &= ~LOG_RDWAIT;
 
 	while (uio->uio_resid > 0) {
 		l = imin(sizeof(buf), uio->uio_resid);
 		l = msgbuf_getbytes(mbp, buf, l);
 		if (l == 0)
 			break;
+		mtx_unlock(&msgbuf_lock);
 		error = uiomove(buf, l, uio);
-		if (error)
-			break;
+		if (error || uio->uio_resid == 0)
+			return (error);
+		mtx_lock(&msgbuf_lock);
 	}
+	mtx_unlock(&msgbuf_lock);
 	return (error);
 }
 
@@ -157,18 +168,16 @@ logread(struct cdev *dev, struct uio *ui
 static	int
 logpoll(struct cdev *dev, int events, struct thread *td)
 {
-	int s;
 	int revents = 0;
 
-	s = splhigh();
-
 	if (events & (POLLIN | POLLRDNORM)) {
+		mtx_lock(&msgbuf_lock);
 		if (msgbuf_getcount(msgbufp) > 0)
 			revents |= events & (POLLIN | POLLRDNORM);
 		else
 			selrecord(td, &logsoftc.sc_selp);
+		mtx_unlock(&msgbuf_lock);
 	}
-	splx(s);
 	return (revents);
 }
 
@@ -183,20 +192,16 @@ logtimeout(void *arg)
 		log_wakeups_per_second = 1;
 	}
 	if (msgbuftrigger == 0) {
-		callout_reset(&logsoftc.sc_callout,
-		    hz / log_wakeups_per_second, logtimeout, NULL);
+		callout_schedule(&logsoftc.sc_callout,
+		    hz / log_wakeups_per_second);
 		return;
 	}
 	msgbuftrigger = 0;
 	selwakeuppri(&logsoftc.sc_selp, LOG_RDPRI);
 	if ((logsoftc.sc_state & LOG_ASYNC) && logsoftc.sc_sigio != NULL)
 		pgsigio(&logsoftc.sc_sigio, SIGIO, 0);
-	if (logsoftc.sc_state & LOG_RDWAIT) {
-		wakeup(msgbufp);
-		logsoftc.sc_state &= ~LOG_RDWAIT;
-	}
-	callout_reset(&logsoftc.sc_callout, hz / log_wakeups_per_second,
-	    logtimeout, NULL);
+	cv_broadcastpri(&log_wakeup, LOG_RDPRI);
+	callout_schedule(&logsoftc.sc_callout, hz / log_wakeups_per_second);
 }
 
 /*ARGSUSED*/
@@ -215,10 +220,12 @@ logioctl(struct cdev *dev, u_long com, c
 		break;
 
 	case FIOASYNC:
+		mtx_lock(&msgbuf_lock);
 		if (*(int *)data)
 			logsoftc.sc_state |= LOG_ASYNC;
 		else
 			logsoftc.sc_state &= ~LOG_ASYNC;
+		mtx_unlock(&msgbuf_lock);
 		break;
 
 	case FIOSETOWN:
@@ -247,6 +254,8 @@ static void
 log_drvinit(void *unused)
 {
 
+	cv_init(&log_wakeup, "klog");
+	callout_init_mtx(&logsoftc.sc_callout, &msgbuf_lock, 0);
 	make_dev(&log_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "klog");
 }
 

Modified: head/sys/kern/subr_prf.c
==============================================================================
--- head/sys/kern/subr_prf.c	Tue Nov  3 21:06:19 2009	(r198859)
+++ head/sys/kern/subr_prf.c	Tue Nov  3 21:06:19 2009	(r198860)
@@ -923,16 +923,24 @@ sysctl_kern_msgbuf(SYSCTL_HANDLER_ARGS)
 	}
 
 	/* Read the whole buffer, one chunk at a time. */
+	mtx_lock(&msgbuf_lock);
 	msgbuf_peekbytes(msgbufp, NULL, 0, &seq);
-	while ((len = msgbuf_peekbytes(msgbufp, buf, sizeof(buf), &seq)) > 0) {
+	for (;;) {
+		len = msgbuf_peekbytes(msgbufp, buf, sizeof(buf), &seq);
+		mtx_unlock(&msgbuf_lock);
+		if (len == 0)
+			return (0);
+
 		error = sysctl_handle_opaque(oidp, buf, len, req);
 		if (error)
 			return (error);
+
+		mtx_lock(&msgbuf_lock);
 	}
-	return (0);
 }
 
-SYSCTL_PROC(_kern, OID_AUTO, msgbuf, CTLTYPE_STRING | CTLFLAG_RD,
+SYSCTL_PROC(_kern, OID_AUTO, msgbuf,
+    CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
     NULL, 0, sysctl_kern_msgbuf, "A", "Contents of kernel message buffer");
 
 static int msgbuf_clearflag;
@@ -943,15 +951,18 @@ sysctl_kern_msgbuf_clear(SYSCTL_HANDLER_
 	int error;
 	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
 	if (!error && req->newptr) {
+		mtx_lock(&msgbuf_lock);
 		msgbuf_clear(msgbufp);
+		mtx_unlock(&msgbuf_lock);
 		msgbuf_clearflag = 0;
 	}
 	return (error);
 }
 
 SYSCTL_PROC(_kern, OID_AUTO, msgbuf_clear,
-    CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE, &msgbuf_clearflag, 0,
-    sysctl_kern_msgbuf_clear, "I", "Clear kernel message buffer");
+    CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE,
+    &msgbuf_clearflag, 0, sysctl_kern_msgbuf_clear, "I",
+    "Clear kernel message buffer");
 
 #ifdef DDB
 

Modified: head/sys/sys/msgbuf.h
==============================================================================
--- head/sys/sys/msgbuf.h	Tue Nov  3 21:06:19 2009	(r198859)
+++ head/sys/sys/msgbuf.h	Tue Nov  3 21:06:19 2009	(r198860)
@@ -54,6 +54,7 @@ struct msgbuf {
 #ifdef _KERNEL
 extern int	msgbuftrigger;
 extern struct	msgbuf *msgbufp;
+extern struct	mtx msgbuf_lock;
 
 void	msgbufinit(void *ptr, int size);
 void	msgbuf_addchar(struct msgbuf *mbp, int c);
From weongyo at FreeBSD.org  Tue Nov  3 21:47:08 2009
From: weongyo at FreeBSD.org (Weongyo Jeong)
Date: Tue Nov  3 21:47:13 2009
Subject: svn commit: r198862 - head/sys/dev/usb/wlan
Message-ID: <200911032147.nA3Ll7AA006232@svn.freebsd.org>

Author: weongyo
Date: Tue Nov  3 21:47:07 2009
New Revision: 198862
URL: http://svn.freebsd.org/changeset/base/198862

Log:
  fixes a typo that value should be 0 not 10.

Modified:
  head/sys/dev/usb/wlan/if_urtw.c

Modified: head/sys/dev/usb/wlan/if_urtw.c
==============================================================================
--- head/sys/dev/usb/wlan/if_urtw.c	Tue Nov  3 21:24:37 2009	(r198861)
+++ head/sys/dev/usb/wlan/if_urtw.c	Tue Nov  3 21:47:07 2009	(r198862)
@@ -1688,7 +1688,7 @@ urtw_tx_start(struct urtw_softc *sc, str
 		ieee80211_radiotap_tx(vap, m0);
 	}
 
-	if ((wh->i_fc[10] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_MGT ||
+	if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_MGT ||
 	    (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) {
 		tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
 		rate = tp->mgmtrate;
From mav at FreeBSD.org  Tue Nov  3 23:26:58 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Tue Nov  3 23:27:05 2009
Subject: svn commit: r198865 - head/sys/sys
Message-ID: <200911032326.nA3NQwqJ009239@svn.freebsd.org>

Author: mav
Date: Tue Nov  3 23:26:58 2009
New Revision: 198865
URL: http://svn.freebsd.org/changeset/base/198865

Log:
  Fix constants.

Modified:
  head/sys/sys/ata.h

Modified: head/sys/sys/ata.h
==============================================================================
--- head/sys/sys/ata.h	Tue Nov  3 23:26:31 2009	(r198864)
+++ head/sys/sys/ata.h	Tue Nov  3 23:26:58 2009	(r198865)
@@ -207,8 +207,8 @@ struct ata_params {
 	u_int16_t       reserved104[2];
 /*106*/	u_int16_t       pss;
 #define ATA_PSS_LSPPS			0x000F
-#define ATA_PSS_LSSABOVE512		0x2000
-#define ATA_PSS_MULTLS			0x4000
+#define ATA_PSS_LSSABOVE512		0x1000
+#define ATA_PSS_MULTLS			0x2000
 /*107*/ u_int16_t       isd;
 /*108*/ u_int16_t       wwn[4];
 	u_int16_t       reserved112[5];
From jkim at FreeBSD.org  Wed Nov  4 00:58:22 2009
From: jkim at FreeBSD.org (Jung-uk Kim)
Date: Wed Nov  4 00:58:27 2009
Subject: svn commit: r198866 - in head/sys: dev/fb isa
Message-ID: <200911040058.nA40wKZp011756@svn.freebsd.org>

Author: jkim
Date: Wed Nov  4 00:58:20 2009
New Revision: 198866
URL: http://svn.freebsd.org/changeset/base/198866

Log:
  Save/restore VGA color palette while suspending and resuming.

Modified:
  head/sys/dev/fb/vgareg.h
  head/sys/isa/vga_isa.c

Modified: head/sys/dev/fb/vgareg.h
==============================================================================
--- head/sys/dev/fb/vgareg.h	Tue Nov  3 23:26:58 2009	(r198865)
+++ head/sys/dev/fb/vgareg.h	Wed Nov  4 00:58:20 2009	(r198866)
@@ -70,6 +70,7 @@ struct video_adapter;
 typedef struct vga_softc {
 	struct video_adapter	*adp;
 	void			*state_buf;
+	void			*pal_buf;
 #ifdef FB_INSTALL_CDEV
 	genfb_softc_t		gensc;
 #endif

Modified: head/sys/isa/vga_isa.c
==============================================================================
--- head/sys/isa/vga_isa.c	Tue Nov  3 23:26:58 2009	(r198865)
+++ head/sys/isa/vga_isa.c	Wed Nov  4 00:58:20 2009	(r198866)
@@ -179,17 +179,33 @@ isavga_suspend(device_t dev)
 	nbytes = vidd_save_state(sc->adp, NULL, 0);
 	if (nbytes <= 0)
 		return (0);
-	sc->state_buf = malloc(nbytes, M_TEMP, M_NOWAIT | M_ZERO);
-	if (sc->state_buf == NULL)
-		return (0);
-	if (bootverbose)
-		device_printf(dev, "saving %d bytes of video state\n", nbytes);
-	if (vidd_save_state(sc->adp, sc->state_buf, nbytes) != 0) {
-		device_printf(dev, "failed to save state (nbytes=%d)\n",
-		    nbytes);
-		free(sc->state_buf, M_TEMP);
-		sc->state_buf = NULL;
+	sc->state_buf = malloc(nbytes, M_TEMP, M_NOWAIT);
+	if (sc->state_buf != NULL) {
+		if (bootverbose)
+			device_printf(dev, "saving %d bytes of video state\n",
+			    nbytes);
+		if (vidd_save_state(sc->adp, sc->state_buf, nbytes) != 0) {
+			device_printf(dev, "failed to save state (nbytes=%d)\n",
+			    nbytes);
+			free(sc->state_buf, M_TEMP);
+			sc->state_buf = NULL;
+		}
 	}
+
+	/* Save the color palette across the suspend. */
+	if (sc->pal_buf != NULL)
+		free(sc->pal_buf, M_TEMP);
+	sc->pal_buf = malloc(256 * 3, M_TEMP, M_NOWAIT);
+	if (sc->pal_buf != NULL) {
+		if (bootverbose)
+			device_printf(dev, "saving color palette\n");
+		if (vidd_save_palette(sc->adp, sc->pal_buf) != 0) {
+			device_printf(dev, "failed to save palette\n");
+			free(sc->pal_buf, M_TEMP);
+			sc->pal_buf = NULL;
+		}
+	}
+
 	return (0);
 }
 
@@ -205,6 +221,12 @@ isavga_resume(device_t dev)
 		free(sc->state_buf, M_TEMP);
 		sc->state_buf = NULL;
 	}
+	if (sc->pal_buf != NULL) {
+		if (vidd_load_palette(sc->adp, sc->pal_buf) != 0)
+			device_printf(dev, "failed to reload palette\n");
+		free(sc->pal_buf, M_TEMP);
+		sc->pal_buf = NULL;
+	}
 
 	bus_generic_resume(dev);
 	return 0;
From jkim at FreeBSD.org  Wed Nov  4 01:00:28 2009
From: jkim at FreeBSD.org (Jung-uk Kim)
Date: Wed Nov  4 01:00:36 2009
Subject: svn commit: r198867 - head/sys/dev/fb
Message-ID: <200911040100.nA410SsC011883@svn.freebsd.org>

Author: jkim
Date: Wed Nov  4 01:00:28 2009
New Revision: 198867
URL: http://svn.freebsd.org/changeset/base/198867

Log:
  Restore color palette format if we reset video mode.

Modified:
  head/sys/dev/fb/vesa.c

Modified: head/sys/dev/fb/vesa.c
==============================================================================
--- head/sys/dev/fb/vesa.c	Wed Nov  4 00:58:20 2009	(r198866)
+++ head/sys/dev/fb/vesa.c	Wed Nov  4 01:00:28 2009	(r198867)
@@ -1470,6 +1470,8 @@ vesa_load_state(video_adapter_t *adp, vo
 		    (flags & V_INFO_LINEAR) != 0)
 			mode |= 0x4000;
 		(void)vesa_bios_set_mode(mode);
+		if ((vesa_adp_info->v_flags & V_DAC8) != 0)
+			(void)vesa_bios_set_dac(8);
 		(void)(*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1);
 	}
 
From attilio at FreeBSD.org  Wed Nov  4 01:33:00 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Wed Nov  4 01:33:12 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
Message-ID: <200911040132.nA41WxtQ012750@svn.freebsd.org>

Author: attilio
Date: Wed Nov  4 01:32:59 2009
New Revision: 198868
URL: http://svn.freebsd.org/changeset/base/198868

Log:
  Opteron rev E family of processor expose a bug where, in very rare
  ocassions, memory barriers semantic is not honoured by the hardware
  itself. As a result, some random breakage can happen in uninvestigable
  ways (for further explanation see at the content of the commit itself).
  
  As long as just a specific familly is bugged of an entire architecture
  is broken, a complete fix-up is impratical without harming to some
  extents the other correct cases.
  Considering that (and considering the frequency of the bug exposure)
  just print out a warning message if the affected machine is identified.
  
  Pointed out by:	Samy Al Bahra 
  Help on wordings by:	jeff
  MFC:	3 days

Modified:
  head/sys/amd64/amd64/identcpu.c
  head/sys/i386/i386/identcpu.c

Modified: head/sys/amd64/amd64/identcpu.c
==============================================================================
--- head/sys/amd64/amd64/identcpu.c	Wed Nov  4 01:00:28 2009	(r198867)
+++ head/sys/amd64/amd64/identcpu.c	Wed Nov  4 01:32:59 2009	(r198868)
@@ -607,6 +607,24 @@ 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 (CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x20 &&
+	    CPUID_TO_MODEL(cpu_id) <= 0x3f) {
+		printf("WARNING: This architecture revision has known SMP "
+		    "hardware bugs which may cause random instability\n");
+		printf("WARNING: For details see: "
+		    "http://bugzilla.kernel.org/show_bug.cgi?id=11305\n");
+	}
 }
 
 static void

Modified: head/sys/i386/i386/identcpu.c
==============================================================================
--- head/sys/i386/i386/identcpu.c	Wed Nov  4 01:00:28 2009	(r198867)
+++ head/sys/i386/i386/identcpu.c	Wed Nov  4 01:32:59 2009	(r198868)
@@ -1303,6 +1303,24 @@ 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 (CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x20 &&
+	    CPUID_TO_MODEL(cpu_id) <= 0x3f) {
+		printf("WARNING: This architecture revision has known SMP "
+		    "hardware bugs which may cause random instability\n");
+		printf("WARNING: For details see: "
+		    "http://bugzilla.kernel.org/show_bug.cgi?id=11305\n");
+	}
 }
 
 static void
From alc at FreeBSD.org  Wed Nov  4 03:12:57 2009
From: alc at FreeBSD.org (Alan Cox)
Date: Wed Nov  4 03:13:03 2009
Subject: svn commit: r198870 - head/sys/vm
Message-ID: <200911040312.nA43CvCu015910@svn.freebsd.org>

Author: alc
Date: Wed Nov  4 03:12:56 2009
New Revision: 198870
URL: http://svn.freebsd.org/changeset/base/198870

Log:
  Eliminate an unnecessary #include.  (This #include should have been removed
  in r188331 when vnode_pager_lock() was eliminated.)

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Wed Nov  4 01:50:25 2009	(r198869)
+++ head/sys/vm/vm_fault.c	Wed Nov  4 03:12:56 2009	(r198870)
@@ -96,7 +96,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 	/* XXX Temporary for VFS_LOCK_GIANT() */
From benno at FreeBSD.org  Wed Nov  4 04:12:56 2009
From: benno at FreeBSD.org (Benno Rice)
Date: Wed Nov  4 04:13:03 2009
Subject: svn commit: r198871 - head/share/man/man3
Message-ID: <200911040412.nA44CuSq017605@svn.freebsd.org>

Author: benno
Date: Wed Nov  4 04:12:56 2009
New Revision: 198871
URL: http://svn.freebsd.org/changeset/base/198871

Log:
  Fix typo (noded -> nodes).

Modified:
  head/share/man/man3/tree.3

Modified: head/share/man/man3/tree.3
==============================================================================
--- head/share/man/man3/tree.3	Wed Nov  4 03:12:56 2009	(r198870)
+++ head/share/man/man3/tree.3	Wed Nov  4 04:12:56 2009	(r198871)
@@ -384,7 +384,7 @@ macros, but should be used only once.
 Finally,
 the
 .Fa CMP
-argument is the name of a function used to compare tree noded
+argument is the name of a function used to compare tree nodes
 with each other.
 The function takes two arguments of type
 .Vt "struct TYPE *" .
From alc at FreeBSD.org  Wed Nov  4 04:41:03 2009
From: alc at FreeBSD.org (Alan Cox)
Date: Wed Nov  4 04:41:09 2009
Subject: svn commit: r198872 - in head/sys/arm: arm at91 mv sa11x0
Message-ID: <200911040441.nA44f3HN018343@svn.freebsd.org>

Author: alc
Date: Wed Nov  4 04:41:03 2009
New Revision: 198872
URL: http://svn.freebsd.org/changeset/base/198872

Log:
  Eliminate an unnecessary vm include file.

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/mv/mv_machdep.c
  head/sys/arm/sa11x0/assabet_machdep.c

Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c	Wed Nov  4 04:12:56 2009	(r198871)
+++ head/sys/arm/arm/machdep.c	Wed Nov  4 04:41:03 2009	(r198872)
@@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 

Modified: head/sys/arm/at91/at91_machdep.c
==============================================================================
--- head/sys/arm/at91/at91_machdep.c	Wed Nov  4 04:12:56 2009	(r198871)
+++ head/sys/arm/at91/at91_machdep.c	Wed Nov  4 04:41:03 2009	(r198872)
@@ -79,7 +79,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/arm/mv/mv_machdep.c
==============================================================================
--- head/sys/arm/mv/mv_machdep.c	Wed Nov  4 04:12:56 2009	(r198871)
+++ head/sys/arm/mv/mv_machdep.c	Wed Nov  4 04:41:03 2009	(r198872)
@@ -72,7 +72,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/arm/sa11x0/assabet_machdep.c
==============================================================================
--- head/sys/arm/sa11x0/assabet_machdep.c	Wed Nov  4 04:12:56 2009	(r198871)
+++ head/sys/arm/sa11x0/assabet_machdep.c	Wed Nov  4 04:41:03 2009	(r198872)
@@ -82,7 +82,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
From ed at 80386.nl  Wed Nov  4 05:58:14 2009
From: ed at 80386.nl (Ed Schouten)
Date: Wed Nov  4 05:58:20 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <200911040132.nA41WxtQ012750@svn.freebsd.org>
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
Message-ID: <20091104055811.GY1293@hoeg.nl>

Hi Attilio,

* Attilio Rao  wrote:
> Opteron rev E family of processor expose a bug where, in very rare
> ocassions, memory barriers semantic is not honoured by the hardware
> itself. As a result, some random breakage can happen in uninvestigable
> ways (for further explanation see at the content of the commit itself).

Ooh. Sounds like an interesting bug.

The bug doesn't manifest itself on UP, right? If so, maybe we should add
some very short instructions to the warning on how to disable SMP.

-- 
 Ed Schouten 
 WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091104/d1db4814/attachment.pgp
From trasz at FreeBSD.org  Wed Nov  4 06:47:14 2009
From: trasz at FreeBSD.org (Edward Tomasz Napierala)
Date: Wed Nov  4 06:47:26 2009
Subject: svn commit: r198873 - head/sys/kern
Message-ID: <200911040647.nA46lEUg021790@svn.freebsd.org>

Author: trasz
Date: Wed Nov  4 06:47:14 2009
New Revision: 198873
URL: http://svn.freebsd.org/changeset/base/198873

Log:
  While VAPPEND without VWRITE makes sense for VOP_ACCESSX(9) (e.g. to check
  for the permission to create subdirectory (ACE4_ADD_SUBDIRECTORY)), it doesn't
  really make sense for VOP_ACCESS(9).  Also, many VOP_ACCESS(9) implementations
  don't expect that.  Make sure we don't confuse them.

Modified:
  head/sys/kern/vfs_default.c

Modified: head/sys/kern/vfs_default.c
==============================================================================
--- head/sys/kern/vfs_default.c	Wed Nov  4 04:41:03 2009	(r198872)
+++ head/sys/kern/vfs_default.c	Wed Nov  4 06:47:14 2009	(r198873)
@@ -353,6 +353,14 @@ vop_stdaccessx(struct vop_accessx_args *
 	if (accmode == 0)
 		return (0);
 
+	/*
+	 * Many VOP_APPEND implementations don't expect VAPPEND without VWRITE
+	 * being set, e.g. they check whether the filesystem is read-only only
+	 * when VWRITE is set.  Make sure we don't confuse them.
+	 */
+	if (accmode & VAPPEND)
+		accmode |= VWRITE;
+
 	return (VOP_ACCESS(ap->a_vp, accmode, ap->a_cred, ap->a_td));
 }
 
From trasz at FreeBSD.org  Wed Nov  4 06:48:34 2009
From: trasz at FreeBSD.org (Edward Tomasz Napierala)
Date: Wed Nov  4 06:48:46 2009
Subject: svn commit: r198874 - head/sys/kern
Message-ID: <200911040648.nA46mYrb021862@svn.freebsd.org>

Author: trasz
Date: Wed Nov  4 06:48:34 2009
New Revision: 198874
URL: http://svn.freebsd.org/changeset/base/198874

Log:
  Make sure we don't end up with VAPPEND without VWRITE, if someone calls open(2)
  like this: open(..., O_APPEND).

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c	Wed Nov  4 06:47:14 2009	(r198873)
+++ head/sys/kern/vfs_vnops.c	Wed Nov  4 06:48:34 2009	(r198874)
@@ -213,7 +213,7 @@ restart:
 	if (fmode & FEXEC)
 		accmode |= VEXEC;
 	if (fmode & O_APPEND)
-		accmode |= VAPPEND;
+		accmode |= VWRITE | VAPPEND;
 #ifdef MAC
 	error = mac_vnode_check_open(cred, vp, accmode);
 	if (error)
From trasz at FreeBSD.org  Wed Nov  4 07:04:16 2009
From: trasz at FreeBSD.org (Edward Tomasz Napierala)
Date: Wed Nov  4 07:04:22 2009
Subject: svn commit: r198875 - head/sys/kern
Message-ID: <200911040704.nA474FDo022330@svn.freebsd.org>

Author: trasz
Date: Wed Nov  4 07:04:15 2009
New Revision: 198875
URL: http://svn.freebsd.org/changeset/base/198875

Log:
  Style fixes.

Modified:
  head/sys/kern/vfs_acl.c

Modified: head/sys/kern/vfs_acl.c
==============================================================================
--- head/sys/kern/vfs_acl.c	Wed Nov  4 06:48:34 2009	(r198874)
+++ head/sys/kern/vfs_acl.c	Wed Nov  4 07:04:15 2009	(r198875)
@@ -213,7 +213,7 @@ vacl_set_acl(struct thread *td, struct v
 
 	inkernelacl = acl_alloc(M_WAITOK);
 	error = acl_copyin(aclp, inkernelacl, type);
-	if (error)
+	if (error != 0)
 		goto out;
 	error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
 	if (error != 0)
@@ -233,7 +233,7 @@ out_unlock:
 	vn_finished_write(mp);
 out:
 	acl_free(inkernelacl);
-	return(error);
+	return (error);
 }
 
 /*
@@ -276,12 +276,12 @@ vacl_delete(struct thread *td, struct vn
 	int error;
 
 	error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
-	if (error)
+	if (error != 0)
 		return (error);
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 #ifdef MAC
 	error = mac_vnode_check_deleteacl(td->td_ucred, vp, type);
-	if (error)
+	if (error != 0)
 		goto out;
 #endif
 	error = VOP_SETACL(vp, acl_type_unold(type), 0, td->td_ucred, td);
@@ -305,7 +305,7 @@ vacl_aclcheck(struct thread *td, struct 
 
 	inkernelacl = acl_alloc(M_WAITOK);
 	error = acl_copyin(aclp, inkernelacl, type);
-	if (error)
+	if (error != 0)
 		goto out;
 	error = VOP_ACLCHECK(vp, type, inkernelacl, td->td_ucred, td);
 out:
@@ -501,7 +501,7 @@ __acl_delete_fd(struct thread *td, struc
 int
 __acl_aclcheck_file(struct thread *td, struct __acl_aclcheck_file_args *uap)
 {
-	struct nameidata	nd;
+	struct nameidata nd;
 	int vfslocked, error;
 
 	NDINIT(&nd, LOOKUP, MPSAFE|FOLLOW, UIO_USERSPACE, uap->path, td);
@@ -521,7 +521,7 @@ __acl_aclcheck_file(struct thread *td, s
 int
 __acl_aclcheck_link(struct thread *td, struct __acl_aclcheck_link_args *uap)
 {
-	struct nameidata	nd;
+	struct nameidat nd;
 	int vfslocked, error;
 
 	NDINIT(&nd, LOOKUP, MPSAFE|NOFOLLOW, UIO_USERSPACE, uap->path, td);
From pjd at FreeBSD.org  Wed Nov  4 07:04:35 2009
From: pjd at FreeBSD.org (Pawel Jakub Dawidek)
Date: Wed Nov  4 07:04:46 2009
Subject: svn commit: r198874 - head/sys/kern
In-Reply-To: <200911040648.nA46mYrb021862@svn.freebsd.org>
References: <200911040648.nA46mYrb021862@svn.freebsd.org>
Message-ID: <20091104070427.GE2073@garage.freebsd.pl>

On Wed, Nov 04, 2009 at 06:48:34AM +0000, Edward Tomasz Napierala wrote:
> Author: trasz
> Date: Wed Nov  4 06:48:34 2009
> New Revision: 198874
> URL: http://svn.freebsd.org/changeset/base/198874
> 
> Log:
>   Make sure we don't end up with VAPPEND without VWRITE, if someone calls open(2)
>   like this: open(..., O_APPEND).
> 
> Modified:
>   head/sys/kern/vfs_vnops.c
> 
> Modified: head/sys/kern/vfs_vnops.c
> ==============================================================================
> --- head/sys/kern/vfs_vnops.c	Wed Nov  4 06:47:14 2009	(r198873)
> +++ head/sys/kern/vfs_vnops.c	Wed Nov  4 06:48:34 2009	(r198874)
> @@ -213,7 +213,7 @@ restart:
>  	if (fmode & FEXEC)
>  		accmode |= VEXEC;
>  	if (fmode & O_APPEND)
> -		accmode |= VAPPEND;
> +		accmode |= VWRITE | VAPPEND;
>  #ifdef MAC
>  	error = mac_vnode_check_open(cred, vp, accmode);
>  	if (error)

Why? If someone does O_APPEND only we don't want to give him write
access...

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091104/6c520118/attachment.pgp
From pjd at FreeBSD.org  Wed Nov  4 07:07:50 2009
From: pjd at FreeBSD.org (Pawel Jakub Dawidek)
Date: Wed Nov  4 07:08:01 2009
Subject: svn commit: r198873 - head/sys/kern
In-Reply-To: <200911040647.nA46lEUg021790@svn.freebsd.org>
References: <200911040647.nA46lEUg021790@svn.freebsd.org>
Message-ID: <20091104070741.GF2073@garage.freebsd.pl>

On Wed, Nov 04, 2009 at 06:47:14AM +0000, Edward Tomasz Napierala wrote:
> Author: trasz
> Date: Wed Nov  4 06:47:14 2009
> New Revision: 198873
> URL: http://svn.freebsd.org/changeset/base/198873
> 
> Log:
>   While VAPPEND without VWRITE makes sense for VOP_ACCESSX(9) (e.g. to check
>   for the permission to create subdirectory (ACE4_ADD_SUBDIRECTORY)), it doesn't
>   really make sense for VOP_ACCESS(9).  Also, many VOP_ACCESS(9) implementations
>   don't expect that.  Make sure we don't confuse them.
> 
> Modified:
>   head/sys/kern/vfs_default.c
> 
> Modified: head/sys/kern/vfs_default.c
> ==============================================================================
> --- head/sys/kern/vfs_default.c	Wed Nov  4 04:41:03 2009	(r198872)
> +++ head/sys/kern/vfs_default.c	Wed Nov  4 06:47:14 2009	(r198873)
> @@ -353,6 +353,14 @@ vop_stdaccessx(struct vop_accessx_args *
>  	if (accmode == 0)
>  		return (0);
>  
> +	/*
> +	 * Many VOP_APPEND implementations don't expect VAPPEND without VWRITE
> +	 * being set, e.g. they check whether the filesystem is read-only only
> +	 * when VWRITE is set.  Make sure we don't confuse them.

But O_APPEND alone is legal and doesn't provide write access. This is
fine for file systems to only check for read-only in VWRITE case.
If file system you're talking about is ZFS it was simply a bug in ZFS.

> +	 */
> +	if (accmode & VAPPEND)
> +		accmode |= VWRITE;
>  	return (VOP_ACCESS(ap->a_vp, accmode, ap->a_cred, ap->a_td));

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091104/741e15fc/attachment-0001.pgp
From trasz at FreeBSD.org  Wed Nov  4 07:14:18 2009
From: trasz at FreeBSD.org (Edward Tomasz Napierala)
Date: Wed Nov  4 07:14:30 2009
Subject: svn commit: r198876 - head/sys/kern
Message-ID: <200911040714.nA47EGDc022619@svn.freebsd.org>

Author: trasz
Date: Wed Nov  4 07:14:16 2009
New Revision: 198876
URL: http://svn.freebsd.org/changeset/base/198876

Log:
  Revert r198874, pending further discussion.

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c	Wed Nov  4 07:04:15 2009	(r198875)
+++ head/sys/kern/vfs_vnops.c	Wed Nov  4 07:14:16 2009	(r198876)
@@ -213,7 +213,7 @@ restart:
 	if (fmode & FEXEC)
 		accmode |= VEXEC;
 	if (fmode & O_APPEND)
-		accmode |= VWRITE | VAPPEND;
+		accmode |= VAPPEND;
 #ifdef MAC
 	error = mac_vnode_check_open(cred, vp, accmode);
 	if (error)
From trasz at FreeBSD.org  Wed Nov  4 08:25:59 2009
From: trasz at FreeBSD.org (Edward Tomasz Napierala)
Date: Wed Nov  4 08:26:08 2009
Subject: svn commit: r198877 - head/sys/kern
Message-ID: <200911040825.nA48PwuI024360@svn.freebsd.org>

Author: trasz
Date: Wed Nov  4 08:25:58 2009
New Revision: 198877
URL: http://svn.freebsd.org/changeset/base/198877

Log:
  Fix build.
  
  Submitted by:	Andrius Mork?nas 

Modified:
  head/sys/kern/vfs_acl.c

Modified: head/sys/kern/vfs_acl.c
==============================================================================
--- head/sys/kern/vfs_acl.c	Wed Nov  4 07:14:16 2009	(r198876)
+++ head/sys/kern/vfs_acl.c	Wed Nov  4 08:25:58 2009	(r198877)
@@ -521,7 +521,7 @@ __acl_aclcheck_file(struct thread *td, s
 int
 __acl_aclcheck_link(struct thread *td, struct __acl_aclcheck_link_args *uap)
 {
-	struct nameidat nd;
+	struct nameidata nd;
 	int vfslocked, error;
 
 	NDINIT(&nd, LOOKUP, MPSAFE|NOFOLLOW, UIO_USERSPACE, uap->path, td);
From attilio at freebsd.org  Wed Nov  4 12:49:43 2009
From: attilio at freebsd.org (Attilio Rao)
Date: Wed Nov  4 12:50:25 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <20091104055811.GY1293@hoeg.nl>
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
	<20091104055811.GY1293@hoeg.nl>
Message-ID: <3bbf2fe10911040449j5938ca7eqca5829ceced66f48@mail.gmail.com>

2009/11/4 Ed Schouten :
> Hi Attilio,
>
> * Attilio Rao  wrote:
>> Opteron rev E family of processor expose a bug where, in very rare
>> ocassions, memory barriers semantic is not honoured by the hardware
>> itself. As a result, some random breakage can happen in uninvestigable
>> ways (for further explanation see at the content of the commit itself).
>
> Ooh. Sounds like an interesting bug.
>
> The bug doesn't manifest itself on UP, right? If so, maybe we should add
> some very short instructions to the warning on how to disable SMP.

Due to the semantic of the bug, I think that it can manifest itself on
UP and a memory barrier failing on UP means that PREEMPTION can blow
up. Considering this I wouldn't suggest anything different between the
UP vs SMP case.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
From kostikbel at gmail.com  Wed Nov  4 14:43:21 2009
From: kostikbel at gmail.com (Kostik Belousov)
Date: Wed Nov  4 14:43:32 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <3bbf2fe10911040449j5938ca7eqca5829ceced66f48@mail.gmail.com>
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
	<20091104055811.GY1293@hoeg.nl>
	<3bbf2fe10911040449j5938ca7eqca5829ceced66f48@mail.gmail.com>
Message-ID: <20091104144315.GH2331@deviant.kiev.zoral.com.ua>

On Wed, Nov 04, 2009 at 01:49:41PM +0100, Attilio Rao wrote:
> 2009/11/4 Ed Schouten :
> > Hi Attilio,
> >
> > * Attilio Rao  wrote:
> >> Opteron rev E family of processor expose a bug where, in very rare
> >> ocassions, memory barriers semantic is not honoured by the hardware
> >> itself. As a result, some random breakage can happen in uninvestigable
> >> ways (for further explanation see at the content of the commit itself).
> >
> > Ooh. Sounds like an interesting bug.
> >
> > The bug doesn't manifest itself on UP, right? If so, maybe we should add
> > some very short instructions to the warning on how to disable SMP.
> 
> Due to the semantic of the bug, I think that it can manifest itself on
> UP and a memory barrier failing on UP means that PREEMPTION can blow
> up. Considering this I wouldn't suggest anything different between the
> UP vs SMP case.

CPU is always self-consistent, isn't it ?

Also, I very much dislike idea of making our kernel a collection of
references to the man pages and URLs, esp. when URL point to the
resource not controlled by the project.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091104/c85a4b99/attachment.pgp
From rwatson at FreeBSD.org  Wed Nov  4 15:07:56 2009
From: rwatson at FreeBSD.org (Robert Watson)
Date: Wed Nov  4 15:08:14 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <200911040132.nA41WxtQ012750@svn.freebsd.org>
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
Message-ID: 


On Wed, 4 Nov 2009, Attilio Rao wrote:

> +	if (CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x20 &&
> +	    CPUID_TO_MODEL(cpu_id) <= 0x3f) {
> +		printf("WARNING: This architecture revision has known SMP "
> +		    "hardware bugs which may cause random instability\n");
> +		printf("WARNING: For details see: "
> +		    "http://bugzilla.kernel.org/show_bug.cgi?id=11305\n");

I think the warning is a good idea, but I don't think we should include the 
URL.  We have no control over where it points or what information it will 
contain in the future.  Is there a hardware vendor errata number/document that 
we can point at instead, or alternatively, can we just leave it with the first 
warning line?

Robert
From mav at FreeBSD.org  Wed Nov  4 15:10:47 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Wed Nov  4 15:10:58 2009
Subject: svn commit: r198896 - head/sys/dev/siis
Message-ID: <200911041510.nA4FAkCA035763@svn.freebsd.org>

Author: mav
Date: Wed Nov  4 15:10:46 2009
New Revision: 198896
URL: http://svn.freebsd.org/changeset/base/198896

Log:
  Do not unarm callout on request completion and change slot selection
  algorithm as done in ahci(4). This saves some CPU time on high request
  rates.

Modified:
  head/sys/dev/siis/siis.c

Modified: head/sys/dev/siis/siis.c
==============================================================================
--- head/sys/dev/siis/siis.c	Wed Nov  4 15:05:51 2009	(r198895)
+++ head/sys/dev/siis/siis.c	Wed Nov  4 15:10:46 2009	(r198896)
@@ -641,6 +641,7 @@ siis_slotsfree(device_t dev)
 	for (i = 0; i < SIIS_MAX_SLOTS; i++) {
 		struct siis_slot *slot = &ch->slot[i];
 
+		callout_drain(&slot->timeout);
 		if (slot->dma.data_map) {
 			bus_dmamap_destroy(ch->dma.data_tag, slot->dma.data_map);
 			slot->dma.data_map = NULL;
@@ -838,15 +839,11 @@ siis_begin_transaction(device_t dev, uni
 	mtx_assert(&ch->mtx, MA_OWNED);
 	/* Choose empty slot. */
 	tag = ch->lastslot;
-	do {
-		tag++;
-		if (tag >= SIIS_MAX_SLOTS)
+	while (ch->slot[tag].state != SIIS_SLOT_EMPTY) {
+		if (++tag >= SIIS_MAX_SLOTS)
 			tag = 0;
-		if (ch->slot[tag].state == SIIS_SLOT_EMPTY)
-			break;
-	} while (tag != ch->lastslot);
-	if (ch->slot[tag].state != SIIS_SLOT_EMPTY)
-		device_printf(ch->dev, "ALL SLOTS BUSY!\n");
+		KASSERT(tag != ch->lastslot, ("siis: ALL SLOTS BUSY!"));
+	}
 	ch->lastslot = tag;
 	/* Occupy chosen slot. */
 	slot = &ch->slot[tag];
@@ -999,6 +996,9 @@ siis_timeout(struct siis_slot *slot)
 	struct siis_channel *ch = device_get_softc(dev);
 
 	mtx_assert(&ch->mtx, MA_OWNED);
+	/* Check for stale timeout. */
+	if (slot->state < SIIS_SLOT_RUNNING)
+		return;
 	device_printf(dev, "Timeout on slot %d\n", slot->slot);
 device_printf(dev, "%s is %08x ss %08x rs %08x es %08x sts %08x serr %08x\n",
     __func__, ATA_INL(ch->r_mem, SIIS_P_IS), ATA_INL(ch->r_mem, SIIS_P_SS), ch->rslots,
@@ -1024,8 +1024,6 @@ siis_end_transaction(struct siis_slot *s
 	union ccb *ccb = slot->ccb;
 
 	mtx_assert(&ch->mtx, MA_OWNED);
-	/* Cancel command execution timeout */
-	callout_stop(&slot->timeout);
 	bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
 	    BUS_DMASYNC_POSTWRITE);
 	/* Read result registers to the result struct
From mav at FreeBSD.org  Wed Nov  4 15:24:33 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Wed Nov  4 15:24:45 2009
Subject: svn commit: r198897 - in head: sbin/camcontrol sys/cam/ata sys/sys
Message-ID: <200911041524.nA4FOWP0036215@svn.freebsd.org>

Author: mav
Date: Wed Nov  4 15:24:32 2009
New Revision: 198897
URL: http://svn.freebsd.org/changeset/base/198897

Log:
  MFp4:
  - Add support for sector size > 512 bytes and physical sector of several
  logical sectors, introduced by ATA-7 specification.
  - Remove some obsoleted code.

Modified:
  head/sbin/camcontrol/camcontrol.c
  head/sys/cam/ata/ata_all.c
  head/sys/cam/ata/ata_all.h
  head/sys/cam/ata/ata_da.c
  head/sys/cam/ata/ata_xpt.c
  head/sys/sys/ata.h

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Wed Nov  4 15:10:46 2009	(r198896)
+++ head/sbin/camcontrol/camcontrol.c	Wed Nov  4 15:24:32 2009	(r198897)
@@ -1061,6 +1061,10 @@ atacapprint(struct ata_params *parm)
 	printf("cylinders             %d\n", parm->cylinders);
 	printf("heads                 %d\n", parm->heads);
 	printf("sectors/track         %d\n", parm->sectors);
+	printf("sector size           logical %u, physical %lu, offset %lu\n",
+	    ata_logical_sector_size(parm),
+	    (unsigned long)ata_physical_sector_size(parm),
+	    (unsigned long)ata_logical_sector_offset(parm));
 
 	if (parm->config == ATA_PROTO_CFA ||
 	    (parm->support.command2 & ATA_SUPPORT_CFA))

Modified: head/sys/cam/ata/ata_all.c
==============================================================================
--- head/sys/cam/ata/ata_all.c	Wed Nov  4 15:10:46 2009	(r198896)
+++ head/sys/cam/ata/ata_all.c	Wed Nov  4 15:24:32 2009	(r198897)
@@ -271,6 +271,38 @@ ata_print_ident(struct ata_params *ident
 	printf(" device\n");
 }
 
+uint32_t
+ata_logical_sector_size(struct ata_params *ident_data)
+{
+	if ((ident_data->pss & 0xc000) == 0x4000 &&
+	    (ident_data->pss & ATA_PSS_LSSABOVE512)) {
+		return ((u_int32_t)ident_data->lss_1 |
+		    ((u_int32_t)ident_data->lss_2 << 16));
+	}
+	return (512);
+}
+
+uint64_t
+ata_physical_sector_size(struct ata_params *ident_data)
+{
+	if ((ident_data->pss & 0xc000) == 0x4000 &&
+	    (ident_data->pss & ATA_PSS_MULTLS)) {
+		return ((uint64_t)ata_logical_sector_size(ident_data) *
+		    (1 << (ident_data->pss & ATA_PSS_LSPPS)));
+	}
+	return (512);
+}
+
+uint64_t
+ata_logical_sector_offset(struct ata_params *ident_data)
+{
+	if ((ident_data->lsalign & 0xc000) == 0x4000) {
+		return ((uint64_t)ata_logical_sector_size(ident_data) *
+		    (ident_data->lsalign & 0x3fff));
+	}
+	return (0);
+}
+
 void
 ata_28bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint8_t features,
     uint32_t lba, uint8_t sector_count)

Modified: head/sys/cam/ata/ata_all.h
==============================================================================
--- head/sys/cam/ata/ata_all.h	Wed Nov  4 15:10:46 2009	(r198896)
+++ head/sys/cam/ata/ata_all.h	Wed Nov  4 15:24:32 2009	(r198897)
@@ -91,6 +91,10 @@ int	ata_res_sbuf(struct ccb_ataio *ataio
 
 void	ata_print_ident(struct ata_params *ident_data);
 
+uint32_t	ata_logical_sector_size(struct ata_params *ident_data);
+uint64_t	ata_physical_sector_size(struct ata_params *ident_data);
+uint64_t	ata_logical_sector_offset(struct ata_params *ident_data);
+
 void	ata_28bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint8_t features,
     uint32_t lba, uint8_t sector_count);
 void	ata_48bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint16_t features,

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c	Wed Nov  4 15:10:46 2009	(r198896)
+++ head/sys/cam/ata/ata_da.c	Wed Nov  4 15:24:32 2009	(r198897)
@@ -95,16 +95,14 @@ typedef enum {
 
 struct disk_params {
 	u_int8_t  heads;
-	u_int32_t cylinders;
 	u_int8_t  secs_per_track;
-	u_int32_t secsize;	/* Number of bytes/sector */
-	u_int64_t sectors;	/* total number sectors */
+	u_int32_t cylinders;
+	u_int32_t secsize;	/* Number of bytes/logical sector */
+	u_int64_t sectors;	/* Total number sectors */
 };
 
 struct ada_softc {
 	struct	 bio_queue_head bio_queue;
-	SLIST_ENTRY(ada_softc) links;
-	LIST_HEAD(, ccb_hdr) pending_ccbs;
 	ada_state state;
 	ada_flags flags;	
 	ada_quirks quirks;
@@ -142,7 +140,7 @@ static	void		adadone(struct cam_periph *
 			       union ccb *done_ccb);
 static  int		adaerror(union ccb *ccb, u_int32_t cam_flags,
 				u_int32_t sense_flags);
-static void		adasetgeom(struct cam_periph *periph,
+static void		adagetparams(struct cam_periph *periph,
 				struct ccb_getdev *cgd);
 static timeout_t	adasendorderedtag;
 static void		adashutdown(void *arg, int howto);
@@ -613,7 +611,6 @@ adaregister(struct cam_periph *periph, v
 		return(CAM_REQ_CMP_ERR);
 	}
 
-	LIST_INIT(&softc->pending_ccbs);
 	bioq_init(&softc->bio_queue);
 
 	if (cgd->ident_data.capabilities1 & ATA_SUPPORT_DMA)
@@ -658,6 +655,7 @@ adaregister(struct cam_periph *periph, v
 	 * Register this media as a disk
 	 */
 	mtx_unlock(periph->sim->mtx);
+	adagetparams(periph, cgd);
 	softc->disk = disk_alloc();
 	softc->disk->d_open = adaopen;
 	softc->disk->d_close = adaclose;
@@ -671,9 +669,9 @@ adaregister(struct cam_periph *periph, v
 	else if (maxio > MAXPHYS)
 		maxio = MAXPHYS;	/* for safety */
 	if (cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48)
-		maxio = min(maxio, 65536 * 512);
+		maxio = min(maxio, 65536 * softc->params.secsize);
 	else					/* 28bit ATA command limit */
-		maxio = min(maxio, 256 * 512);
+		maxio = min(maxio, 256 * softc->params.secsize);
 	softc->disk->d_maxsize = maxio;
 	softc->disk->d_unit = periph->unit_number;
 	softc->disk->d_flags = 0;
@@ -682,9 +680,12 @@ adaregister(struct cam_periph *periph, v
 	strlcpy(softc->disk->d_ident, cgd->serial_num,
 	    MIN(sizeof(softc->disk->d_ident), cgd->serial_num_len + 1));
 
-	adasetgeom(periph, cgd);
 	softc->disk->d_sectorsize = softc->params.secsize;
-	softc->disk->d_mediasize = softc->params.secsize * (off_t)softc->params.sectors;
+	softc->disk->d_mediasize = (off_t)softc->params.sectors *
+	    softc->params.secsize;
+	softc->disk->d_stripesize = ata_physical_sector_size(&cgd->ident_data);
+	softc->disk->d_stripeoffset = softc->disk->d_stripesize -
+	    ata_logical_sector_offset(&cgd->ident_data);
 	/* XXX: these are not actually "firmware" values, so they may be wrong */
 	softc->disk->d_fwsectors = softc->params.secs_per_track;
 	softc->disk->d_fwheads = softc->params.heads;
@@ -852,19 +853,10 @@ adastart(struct cam_periph *periph, unio
 				break;
 			}
 			start_ccb->ccb_h.ccb_state = ADA_CCB_BUFFER_IO;
-
-			/*
-			 * Block out any asyncronous callbacks
-			 * while we touch the pending ccb list.
-			 */
-			LIST_INSERT_HEAD(&softc->pending_ccbs,
-					 &start_ccb->ccb_h, periph_links.le);
-			softc->outstanding_cmds++;
-
 			start_ccb->ccb_h.ccb_bp = bp;
-			bp = bioq_first(&softc->bio_queue);
-
+			softc->outstanding_cmds++;
 			xpt_action(start_ccb);
+			bp = bioq_first(&softc->bio_queue);
 		}
 		
 		if (bp != NULL) {
@@ -941,12 +933,6 @@ adadone(struct cam_periph *periph, union
 			if (ataio->resid > 0)
 				bp->bio_flags |= BIO_ERROR;
 		}
-
-		/*
-		 * Block out any asyncronous callbacks
-		 * while we touch the pending ccb list.
-		 */
-		LIST_REMOVE(&done_ccb->ccb_h, periph_links.le);
 		softc->outstanding_cmds--;
 		if (softc->outstanding_cmds == 0)
 			softc->flags |= ADA_FLAG_WENT_IDLE;
@@ -983,14 +969,14 @@ adaerror(union ccb *ccb, u_int32_t cam_f
 }
 
 static void
-adasetgeom(struct cam_periph *periph, struct ccb_getdev *cgd)
+adagetparams(struct cam_periph *periph, struct ccb_getdev *cgd)
 {
 	struct ada_softc *softc = (struct ada_softc *)periph->softc;
 	struct disk_params *dp = &softc->params;
 	u_int64_t lbasize48;
 	u_int32_t lbasize;
 
-	dp->secsize = 512;
+	dp->secsize = ata_logical_sector_size(&cgd->ident_data);
 	if ((cgd->ident_data.atavalid & ATA_FLAG_54_58) &&
 		cgd->ident_data.current_heads && cgd->ident_data.current_sectors) {
 		dp->heads = cgd->ident_data.current_heads;

Modified: head/sys/cam/ata/ata_xpt.c
==============================================================================
--- head/sys/cam/ata/ata_xpt.c	Wed Nov  4 15:10:46 2009	(r198896)
+++ head/sys/cam/ata/ata_xpt.c	Wed Nov  4 15:24:32 2009	(r198897)
@@ -363,10 +363,12 @@ probestart(struct cam_periph *periph, un
 		cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
 		cts.type = CTS_TYPE_CURRENT_SETTINGS;
 		if (path->device->transport == XPORT_ATA) {
-			cts.xport_specific.ata.bytecount = sectors * 512;
+			cts.xport_specific.ata.bytecount = sectors *
+			    ata_logical_sector_size(ident_buf);
 			cts.xport_specific.ata.valid = CTS_ATA_VALID_BYTECOUNT;
 		} else {
-			cts.xport_specific.sata.bytecount = sectors * 512;
+			cts.xport_specific.sata.bytecount = sectors *
+			    ata_logical_sector_size(ident_buf);
 			cts.xport_specific.sata.valid = CTS_SATA_VALID_BYTECOUNT;
 		}
 		xpt_action((union ccb *)&cts);

Modified: head/sys/sys/ata.h
==============================================================================
--- head/sys/sys/ata.h	Wed Nov  4 15:10:46 2009	(r198896)
+++ head/sys/sys/ata.h	Wed Nov  4 15:24:32 2009	(r198897)
@@ -234,7 +234,7 @@ struct ata_params {
 /*176*/ u_int8_t        media_serial[60];
 /*206*/ u_int16_t       sct;
 	u_int16_t       reserved206[2];
-/*209*/ u_int16_t       lbalign;
+/*209*/ u_int16_t       lsalign;
 /*210*/ u_int16_t       wrv_sectors_m3_1;
 	u_int16_t       wrv_sectors_m3_2;
 /*212*/ u_int16_t       wrv_sectors_m2_1;
From des at des.no  Wed Nov  4 15:25:27 2009
From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=)
Date: Wed Nov  4 15:25:33 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <200911040132.nA41WxtQ012750@svn.freebsd.org> (Attilio Rao's
	message of "Wed, 4 Nov 2009 01:32:59 +0000 (UTC)")
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
Message-ID: <863a4ugvmi.fsf@ds4.des.no>

Attilio Rao  writes:
> Log:
>   Opteron rev E family of processor expose a bug where, in very rare
>   ocassions, memory barriers semantic is not honoured by the hardware
>   itself. As a result, some random breakage can happen in uninvestigable
>   ways (for further explanation see at the content of the commit itself).

According to the reference you gave, OpenSolaris has a workaround for
this issue.  Perhaps we should adopt it?

DES
-- 
Dag-Erling Sm?rgrav - des@des.no
From mav at FreeBSD.org  Wed Nov  4 15:40:20 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Wed Nov  4 15:40:26 2009
Subject: svn commit: r198899 - in head/sys/cam: . ata scsi
Message-ID: <200911041540.nA4FeKu3036739@svn.freebsd.org>

Author: mav
Date: Wed Nov  4 15:40:19 2009
New Revision: 198899
URL: http://svn.freebsd.org/changeset/base/198899

Log:
  MFp4:
  - Remove CAM_PERIPH_POLLED flag. It is broken by design. Polling can't be
  periph flag. May be SIM, may be CCB, but now it works fine just without it.
  - Remove check unused for at least five years. If we will ever have non-BIO
  devices in CAM, this check is smallest of what we will need.
  - If several controllers complete requests same time, call swi_sched()
  only once.

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/cam_periph.h
  head/sys/cam/cam_xpt.c
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c	Wed Nov  4 15:27:27 2009	(r198898)
+++ head/sys/cam/ata/ata_da.c	Wed Nov  4 15:40:19 2009	(r198899)
@@ -371,7 +371,6 @@ adadump(void *arg, void *virtual, vm_off
 	}
 
 	if (length > 0) {
-		periph->flags |= CAM_PERIPH_POLLED;
 		xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
 		ccb.ccb_h.ccb_state = ADA_CCB_DUMP;
 		cam_fill_ataio(&ccb.ataio,
@@ -431,7 +430,6 @@ adadump(void *arg, void *virtual, vm_off
 					 /*timeout*/0,
 					 /*getcount_only*/0);
 	}
-	periph->flags &= ~CAM_PERIPH_POLLED;
 	cam_periph_unlock(periph);
 	return (0);
 }

Modified: head/sys/cam/cam_periph.h
==============================================================================
--- head/sys/cam/cam_periph.h	Wed Nov  4 15:27:27 2009	(r198898)
+++ head/sys/cam/cam_periph.h	Wed Nov  4 15:40:19 2009	(r198899)
@@ -117,7 +117,6 @@ struct cam_periph {
 #define CAM_PERIPH_INVALID		0x08
 #define CAM_PERIPH_NEW_DEV_FOUND	0x10
 #define CAM_PERIPH_RECOVERY_INPROG	0x20
-#define CAM_PERIPH_POLLED		0x40
 	u_int32_t		 immediate_priority;
 	u_int32_t		 refcount;
 	SLIST_HEAD(, ccb_hdr)	 ccb_list;	/* For "immediate" requests */

Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c	Wed Nov  4 15:27:27 2009	(r198898)
+++ head/sys/cam/cam_xpt.c	Wed Nov  4 15:40:19 2009	(r198899)
@@ -4238,6 +4238,7 @@ void
 xpt_done(union ccb *done_ccb)
 {
 	struct cam_sim *sim;
+	int	first;
 
 	CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_done\n"));
 	if ((done_ccb->ccb_h.func_code & XPT_FC_QUEUED) != 0) {
@@ -4246,25 +4247,17 @@ xpt_done(union ccb *done_ccb)
 		 * any of the "non-immediate" type of ccbs.
 		 */
 		sim = done_ccb->ccb_h.path->bus->sim;
-		switch (done_ccb->ccb_h.path->periph->type) {
-		case CAM_PERIPH_BIO:
-			TAILQ_INSERT_TAIL(&sim->sim_doneq, &done_ccb->ccb_h,
-					  sim_links.tqe);
-			done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX;
-			if ((sim->flags & CAM_SIM_ON_DONEQ) == 0) {
-				mtx_lock(&cam_simq_lock);
-				TAILQ_INSERT_TAIL(&cam_simq, sim,
-						  links);
-				mtx_unlock(&cam_simq_lock);
-				sim->flags |= CAM_SIM_ON_DONEQ;
-				if ((done_ccb->ccb_h.path->periph->flags &
-				    CAM_PERIPH_POLLED) == 0)
-					swi_sched(cambio_ih, 0);
-			}
-			break;
-		default:
-			panic("unknown periph type %d",
-			    done_ccb->ccb_h.path->periph->type);
+		TAILQ_INSERT_TAIL(&sim->sim_doneq, &done_ccb->ccb_h,
+		    sim_links.tqe);
+		done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX;
+		if ((sim->flags & CAM_SIM_ON_DONEQ) == 0) {
+			mtx_lock(&cam_simq_lock);
+			first = TAILQ_EMPTY(&cam_simq);
+			TAILQ_INSERT_TAIL(&cam_simq, sim, links);
+			mtx_unlock(&cam_simq_lock);
+			sim->flags |= CAM_SIM_ON_DONEQ;
+			if (first)
+				swi_sched(cambio_ih, 0);
 		}
 	}
 }

Modified: head/sys/cam/scsi/scsi_da.c
==============================================================================
--- head/sys/cam/scsi/scsi_da.c	Wed Nov  4 15:27:27 2009	(r198898)
+++ head/sys/cam/scsi/scsi_da.c	Wed Nov  4 15:40:19 2009	(r198899)
@@ -859,7 +859,6 @@ dadump(void *arg, void *virtual, vm_offs
 	}
 
 	if (length > 0) {
-		periph->flags |= CAM_PERIPH_POLLED;
 		xpt_setup_ccb(&csio.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
 		csio.ccb_h.ccb_state = DA_CCB_DUMP;
 		scsi_read_write(&csio,
@@ -885,7 +884,6 @@ dadump(void *arg, void *virtual, vm_offs
 			else
 				printf("status == 0x%x, scsi status == 0x%x\n",
 				       csio.ccb_h.status, csio.scsi_status);
-			periph->flags |= CAM_PERIPH_POLLED;
 			return(EIO);
 		}
 		cam_periph_unlock(periph);
@@ -929,7 +927,6 @@ dadump(void *arg, void *virtual, vm_offs
 			}
 		}
 	}
-	periph->flags &= ~CAM_PERIPH_POLLED;
 	cam_periph_unlock(periph);
 	return (0);
 }
From attilio at freebsd.org  Wed Nov  4 16:04:02 2009
From: attilio at freebsd.org (Attilio Rao)
Date: Wed Nov  4 16:04:26 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: 
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
	
Message-ID: <3bbf2fe10911040804p6419778bgc363951104adb76e@mail.gmail.com>

2009/11/4, Robert Watson :
>
> On Wed, 4 Nov 2009, Attilio Rao wrote:
>
> > +       if (CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >=
> 0x20 &&
> > +           CPUID_TO_MODEL(cpu_id) <= 0x3f) {
> > +               printf("WARNING: This architecture revision has known SMP
> "
> > +                   "hardware bugs which may cause random instability\n");
> > +               printf("WARNING: For details see: "
> > +
> "http://bugzilla.kernel.org/show_bug.cgi?id=11305\n");
> >
>
> I think the warning is a good idea, but I don't think we should include the
> URL.  We have no control over where it points or what information it will
> contain in the future.  Is there a hardware vendor errata number/document
> that we can point at instead, or alternatively, can we just leave it with
> the first warning line?

I tried to look for an errata pdf from AMD, but I've been unable to
locate one and that's the only 'close' reference I could find.
I'm fine with stripping the link, through, I actually wasn't very
eager to add it, I just did for a complete reference.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
From attilio at freebsd.org  Wed Nov  4 16:06:02 2009
From: attilio at freebsd.org (Attilio Rao)
Date: Wed Nov  4 16:06:09 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <863a4ugvmi.fsf@ds4.des.no>
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
	<863a4ugvmi.fsf@ds4.des.no>
Message-ID: <3bbf2fe10911040806l7293ab6l99cce51ea9d7a64c@mail.gmail.com>

2009/11/4, Dag-Erling Sm?rgrav :
> Attilio Rao  writes:
> > Log:
> >   Opteron rev E family of processor expose a bug where, in very rare
> >   ocassions, memory barriers semantic is not honoured by the hardware
> >   itself. As a result, some random breakage can happen in uninvestigable
> >   ways (for further explanation see at the content of the commit itself).
>
> According to the reference you gave, OpenSolaris has a workaround for
> this issue.  Perhaps we should adopt it?

IIRC, based on what I readed on-line, it could be still a WARNING msg,
but I didn't double-check for it.
On the other side, a possible complete solution would involve a
boot-time patching mechanism, but we don't have it right now
(differently from Linux) or disabling the SMP support, but it seems
mostly a too heavy loss of performance due to the rarely appearence of
the bug itself.

I think the WARNING msg is a good compromise to all these other approaches.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
From attilio at freebsd.org  Wed Nov  4 16:06:38 2009
From: attilio at freebsd.org (Attilio Rao)
Date: Wed Nov  4 16:06:50 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <20091104144315.GH2331@deviant.kiev.zoral.com.ua>
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
	<20091104055811.GY1293@hoeg.nl>
	<3bbf2fe10911040449j5938ca7eqca5829ceced66f48@mail.gmail.com>
	<20091104144315.GH2331@deviant.kiev.zoral.com.ua>
Message-ID: <3bbf2fe10911040806r37f00a8dq2aa3ccd1e5c7b241@mail.gmail.com>

2009/11/4, Kostik Belousov :
> On Wed, Nov 04, 2009 at 01:49:41PM +0100, Attilio Rao wrote:
> > 2009/11/4 Ed Schouten :
> > > Hi Attilio,
> > >
> > > * Attilio Rao  wrote:
> > >> Opteron rev E family of processor expose a bug where, in very rare
> > >> ocassions, memory barriers semantic is not honoured by the hardware
> > >> itself. As a result, some random breakage can happen in uninvestigable
> > >> ways (for further explanation see at the content of the commit itself).
> > >
> > > Ooh. Sounds like an interesting bug.
> > >
> > > The bug doesn't manifest itself on UP, right? If so, maybe we should add
> > > some very short instructions to the warning on how to disable SMP.
> >
> > Due to the semantic of the bug, I think that it can manifest itself on
> > UP and a memory barrier failing on UP means that PREEMPTION can blow
> > up. Considering this I wouldn't suggest anything different between the
> > UP vs SMP case.
>
> CPU is always self-consistent, isn't it ?
>
> Also, I very much dislike idea of making our kernel a collection of
> references to the man pages and URLs, esp. when URL point to the
> resource not controlled by the project.

Ok, as long as you are in favor of stripping the URL, I'm fine with it.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
From des at des.no  Wed Nov  4 16:09:07 2009
From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=)
Date: Wed Nov  4 16:09:19 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <3bbf2fe10911040806l7293ab6l99cce51ea9d7a64c@mail.gmail.com>
	(Attilio Rao's message of "Wed, 4 Nov 2009 17:06:00 +0100")
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
	<863a4ugvmi.fsf@ds4.des.no>
	<3bbf2fe10911040806l7293ab6l99cce51ea9d7a64c@mail.gmail.com>
Message-ID: <86y6mmff1a.fsf@ds4.des.no>

Attilio Rao  writes:
> Dag-Erling Sm?rgrav  writes:
> > According to the reference you gave, OpenSolaris has a workaround for
> > this issue.  Perhaps we should adopt it?
> IIRC, based on what I readed on-line, it could be still a WARNING msg,
> but I didn't double-check for it.

Uh, apparently, it can be worked around with an additional lfence
instruction...  See the first couple of comments on that bugzilla page
you linked to.  If the cost is too high, we could make it conditional on
"options BROKEN_OPTERON_E" or something.

DES
-- 
Dag-Erling Sm?rgrav - des@des.no
From rwatson at FreeBSD.org  Wed Nov  4 16:11:21 2009
From: rwatson at FreeBSD.org (Robert Watson)
Date: Wed Nov  4 16:11:33 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <3bbf2fe10911040804p6419778bgc363951104adb76e@mail.gmail.com>
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
	
	<3bbf2fe10911040804p6419778bgc363951104adb76e@mail.gmail.com>
Message-ID: 


On Wed, 4 Nov 2009, Attilio Rao wrote:

>> I think the warning is a good idea, but I don't think we should include the 
>> URL.  We have no control over where it points or what information it will 
>> contain in the future.  Is there a hardware vendor errata number/document 
>> that we can point at instead, or alternatively, can we just leave it with 
>> the first warning line?
>
> I tried to look for an errata pdf from AMD, but I've been unable to locate 
> one and that's the only 'close' reference I could find. I'm fine with 
> stripping the link, through, I actually wasn't very eager to add it, I just 
> did for a complete reference.

I'm fine with it in a source comment, just not sure about kernel output.

Robert
From attilio at freebsd.org  Wed Nov  4 16:15:30 2009
From: attilio at freebsd.org (Attilio Rao)
Date: Wed Nov  4 16:15:37 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <86y6mmff1a.fsf@ds4.des.no>
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
	<863a4ugvmi.fsf@ds4.des.no>
	<3bbf2fe10911040806l7293ab6l99cce51ea9d7a64c@mail.gmail.com>
	<86y6mmff1a.fsf@ds4.des.no>
Message-ID: <3bbf2fe10911040815u780ea5d5h8252b46ddf0c5de7@mail.gmail.com>

2009/11/4, Dag-Erling Sm?rgrav :
> Attilio Rao  writes:
> > Dag-Erling Sm?rgrav  writes:
> > > According to the reference you gave, OpenSolaris has a workaround for
> > > this issue.  Perhaps we should adopt it?
> > IIRC, based on what I readed on-line, it could be still a WARNING msg,
> > but I didn't double-check for it.
>
> Uh, apparently, it can be worked around with an additional lfence
> instruction...  See the first couple of comments on that bugzilla page
> you linked to.  If the cost is too high, we could make it conditional on
> "options BROKEN_OPTERON_E" or something.

Yeah but the lfence is completely impratical from the overhead POV --
and actually I don't like the idea to add a compile time option based
on family/model.
We could maybe do a mixed approach: printout the WARNING msg only if
the BROKEN_OPTERON_E is not used otherwise be ok.
I still don't like it because it is going to dirty the atomic.h code a
bit, but it can be an acceptable compromise.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
From mav at FreeBSD.org  Wed Nov  4 16:16:51 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Wed Nov  4 16:16:57 2009
Subject: svn commit: r198904 - head/sys/cam/ata
Message-ID: <200911041616.nA4GGo1B037970@svn.freebsd.org>

Author: mav
Date: Wed Nov  4 16:16:50 2009
New Revision: 198904
URL: http://svn.freebsd.org/changeset/base/198904

Log:
  PMP commands use short format. PMP write doesn't return result.

Modified:
  head/sys/cam/ata/ata_all.c

Modified: head/sys/cam/ata/ata_all.c
==============================================================================
--- head/sys/cam/ata/ata_all.c	Wed Nov  4 16:05:18 2009	(r198903)
+++ head/sys/cam/ata/ata_all.c	Wed Nov  4 16:16:50 2009	(r198904)
@@ -368,30 +368,24 @@ void
 ata_pm_read_cmd(struct ccb_ataio *ataio, int reg, int port)
 {
 	bzero(&ataio->cmd, sizeof(ataio->cmd));
-	ataio->cmd.flags = CAM_ATAIO_48BIT | CAM_ATAIO_NEEDRESULT;
+	ataio->cmd.flags = CAM_ATAIO_NEEDRESULT;
 	ataio->cmd.command = ATA_READ_PM;
 	ataio->cmd.features = reg;
-	ataio->cmd.features_exp = reg >> 8;
 	ataio->cmd.device = port & 0x0f;
 }
 
 void
-ata_pm_write_cmd(struct ccb_ataio *ataio, int reg, int port, uint64_t val)
+ata_pm_write_cmd(struct ccb_ataio *ataio, int reg, int port, uint32_t val)
 {
 	bzero(&ataio->cmd, sizeof(ataio->cmd));
-	ataio->cmd.flags = CAM_ATAIO_48BIT | CAM_ATAIO_NEEDRESULT;
+	ataio->cmd.flags = 0;
 	ataio->cmd.command = ATA_WRITE_PM;
 	ataio->cmd.features = reg;
+	ataio->cmd.sector_count = val;
 	ataio->cmd.lba_low = val >> 8;
 	ataio->cmd.lba_mid = val >> 16;
 	ataio->cmd.lba_high = val >> 24;
 	ataio->cmd.device = port & 0x0f;
-	ataio->cmd.lba_low_exp = val >> 40;
-	ataio->cmd.lba_mid_exp = val >> 48;
-	ataio->cmd.lba_high_exp = val >> 56;
-	ataio->cmd.features_exp = reg >> 8;
-	ataio->cmd.sector_count = val;
-	ataio->cmd.sector_count_exp = val >> 32;
 }
 
 void
From mav at FreeBSD.org  Wed Nov  4 16:37:13 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Wed Nov  4 16:37:24 2009
Subject: svn commit: r198905 - head/sys/cam/ata
Message-ID: <200911041637.nA4GbDCk038522@svn.freebsd.org>

Author: mav
Date: Wed Nov  4 16:37:13 2009
New Revision: 198905
URL: http://svn.freebsd.org/changeset/base/198905

Log:
  Fix protype.

Modified:
  head/sys/cam/ata/ata_all.h

Modified: head/sys/cam/ata/ata_all.h
==============================================================================
--- head/sys/cam/ata/ata_all.h	Wed Nov  4 16:16:50 2009	(r198904)
+++ head/sys/cam/ata/ata_all.h	Wed Nov  4 16:37:13 2009	(r198905)
@@ -103,7 +103,7 @@ void	ata_ncq_cmd(struct ccb_ataio *ataio
     uint64_t lba, uint16_t sector_count);
 void	ata_reset_cmd(struct ccb_ataio *ataio);
 void	ata_pm_read_cmd(struct ccb_ataio *ataio, int reg, int port);
-void	ata_pm_write_cmd(struct ccb_ataio *ataio, int reg, int port, uint64_t val);
+void	ata_pm_write_cmd(struct ccb_ataio *ataio, int reg, int port, uint32_t val);
 
 void	ata_bswap(int8_t *buf, int len);
 void	ata_btrim(int8_t *buf, int len);
From jkim at FreeBSD.org  Wed Nov  4 17:30:49 2009
From: jkim at FreeBSD.org (Jung-uk Kim)
Date: Wed Nov  4 17:30:55 2009
Subject: svn commit: r198911 - head/sys/dev/fb
Message-ID: <200911041730.nA4HUnjW040150@svn.freebsd.org>

Author: jkim
Date: Wed Nov  4 17:30:48 2009
New Revision: 198911
URL: http://svn.freebsd.org/changeset/base/198911

Log:
  Do not probe video mode if we are not going to use it.

Modified:
  head/sys/dev/fb/vesa.c

Modified: head/sys/dev/fb/vesa.c
==============================================================================
--- head/sys/dev/fb/vesa.c	Wed Nov  4 17:00:24 2009	(r198910)
+++ head/sys/dev/fb/vesa.c	Wed Nov  4 17:30:48 2009	(r198911)
@@ -1450,10 +1450,11 @@ vesa_load_state(video_adapter_t *adp, vo
 	 * If the current mode is not the same, probably it was powered down.
 	 * Try BIOS POST to restore a sane state.
 	 */
-	mode = vesa_bios_get_current_mode();
-	if (mode >= 0 && (mode & 0x1ff) != adp->va_mode &&
-	    VESA_MODE(adp->va_mode))
-		(void)vesa_bios_post();
+	if (VESA_MODE(adp->va_mode)) {
+		mode = vesa_bios_get_current_mode();
+		if (mode >= 0 && (mode & 0x1ff) != adp->va_mode)
+			(void)vesa_bios_post();
+	}
 
 	ret = vesa_bios_save_restore(STATE_LOAD, ((adp_state_t *)p)->regs,
 	    vesa_state_buf_size);
@@ -1461,9 +1462,10 @@ vesa_load_state(video_adapter_t *adp, vo
 	/*
 	 * If the desired mode is not restored, force setting the mode.
 	 */
-	mode = vesa_bios_get_current_mode();
-	if (mode >= 0 && (mode & 0x1ff) != adp->va_mode &&
-	    VESA_MODE(adp->va_mode)) {
+	if (VESA_MODE(adp->va_mode)) {
+		mode = vesa_bios_get_current_mode();
+		if (mode < 0 || (mode & 0x1ff) == adp->va_mode)
+			return (ret);
 		mode = adp->va_mode;
 		flags = adp->va_info.vi_flags;
 		if ((flags & V_INFO_GRAPHICS) != 0 &&
From trasz at FreeBSD.org  Wed Nov  4 18:16:13 2009
From: trasz at FreeBSD.org (=?iso-8859-2?Q?Edward_Tomasz_Napiera=B3a?=)
Date: Wed Nov  4 18:16:36 2009
Subject: svn commit: r198874 - head/sys/kern
In-Reply-To: <20091104070427.GE2073@garage.freebsd.pl>
References: <200911040648.nA46mYrb021862@svn.freebsd.org>
	<20091104070427.GE2073@garage.freebsd.pl>
Message-ID: <32B76852-3EA3-4814-A8B8-954CC510DAA3@FreeBSD.org>

Wiadomo?? napisana przez Pawel Jakub Dawidek w dniu 2009-11-04, o  
godz. 08:04:
> On Wed, Nov 04, 2009 at 06:48:34AM +0000, Edward Tomasz Napierala  
> wrote:
>> Author: trasz
>> Date: Wed Nov  4 06:48:34 2009
>> New Revision: 198874
>> URL: http://svn.freebsd.org/changeset/base/198874
>>
>> Log:
>>  Make sure we don't end up with VAPPEND without VWRITE, if someone  
>> calls open(2)
>>  like this: open(..., O_APPEND).
>>
>> Modified:
>>  head/sys/kern/vfs_vnops.c
>>
>> Modified: head/sys/kern/vfs_vnops.c
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- head/sys/kern/vfs_vnops.c	Wed Nov  4 06:47:14 2009	(r198873)
>> +++ head/sys/kern/vfs_vnops.c	Wed Nov  4 06:48:34 2009	(r198874)
>> @@ -213,7 +213,7 @@ restart:
>> 	if (fmode & FEXEC)
>> 		accmode |= VEXEC;
>> 	if (fmode & O_APPEND)
>> -		accmode |= VAPPEND;
>> +		accmode |= VWRITE | VAPPEND;
>> #ifdef MAC
>> 	error = mac_vnode_check_open(cred, vp, accmode);
>> 	if (error)
>
> Why? If someone does O_APPEND only we don't want to give him write
> access...

As it is now, VAPPEND is not a real V* flag - it's a kind of modifier  
to VWRITE.
Which means that it doesn't really make sense, from the conceptual  
point of view,
to have VAPPEND without VWRITE being set at the same time.  This  
doesn't break
things right now - at least I don't know about any such breakage - but  
in the
future I'd like to have a few KASSERTs to verify that VAPPEND is never  
specified
without VWRITE, just to make sure something unexpected doesn't happen  
somewhere.

As it is now, doing open(..., O_APPEND) will result in a  
filedescriptor open
for... reading.  So, the change above would change the behaviour.   
What about
something like this instead:

Index: vfs_vnops.c
===================================================================
--- vfs_vnops.c (revision 198876)
+++ vfs_vnops.c (working copy)
@@ -212,7 +212,7 @@
                 accmode |= VREAD;
         if (fmode & FEXEC)
                 accmode |= VEXEC;
-       if (fmode & O_APPEND)
+       if ((fmode & O_APPEND) && (fmode & FWRITE))
                 accmode |= VAPPEND;
  #ifdef MAC
         error = mac_vnode_check_open(cred, vp, accmode);

--
If you cut off my head, what would I say?  Me and my head, or me and  
my body?

From jhb at freebsd.org  Wed Nov  4 18:17:23 2009
From: jhb at freebsd.org (John Baldwin)
Date: Wed Nov  4 18:17:36 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <3bbf2fe10911040815u780ea5d5h8252b46ddf0c5de7@mail.gmail.com>
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
	<86y6mmff1a.fsf@ds4.des.no>
	<3bbf2fe10911040815u780ea5d5h8252b46ddf0c5de7@mail.gmail.com>
Message-ID: <200911041312.37676.jhb@freebsd.org>

On Wednesday 04 November 2009 11:15:28 am Attilio Rao wrote:
> 2009/11/4, Dag-Erling Sm?rgrav :
> > Attilio Rao  writes:
> > > Dag-Erling Sm?rgrav  writes:
> > > > According to the reference you gave, OpenSolaris has a workaround for
> > > > this issue.  Perhaps we should adopt it?
> > > IIRC, based on what I readed on-line, it could be still a WARNING msg,
> > > but I didn't double-check for it.
> >
> > Uh, apparently, it can be worked around with an additional lfence
> > instruction...  See the first couple of comments on that bugzilla page
> > you linked to.  If the cost is too high, we could make it conditional on
> > "options BROKEN_OPTERON_E" or something.
> 
> Yeah but the lfence is completely impratical from the overhead POV --
> and actually I don't like the idea to add a compile time option based
> on family/model.
> We could maybe do a mixed approach: printout the WARNING msg only if
> the BROKEN_OPTERON_E is not used otherwise be ok.
> I still don't like it because it is going to dirty the atomic.h code a
> bit, but it can be an acceptable compromise.

We have had family/model specific hacks with an associated #ifdef in the past, 
see NO_F00F_HACK (though that is probably less invasive).  Also, if it 
affects atomic.h then you may need to leave it always enabled in userland to 
be truly safe.

-- 
John Baldwin
From dougb at FreeBSD.org  Wed Nov  4 18:40:07 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Wed Nov  4 18:40:14 2009
Subject: svn commit: r198921 - head/games/fortune/datfiles
Message-ID: <200911041840.nA4Ie5o4042431@svn.freebsd.org>

Author: dougb
Date: Wed Nov  4 18:40:05 2009
New Revision: 198921
URL: http://svn.freebsd.org/changeset/base/198921

Log:
  Fix not only the grammar, but also the formatting that makes the gag

Modified:
  head/games/fortune/datfiles/fortunes

Modified: head/games/fortune/datfiles/fortunes
==============================================================================
--- head/games/fortune/datfiles/fortunes	Wed Nov  4 18:34:14 2009	(r198920)
+++ head/games/fortune/datfiles/fortunes	Wed Nov  4 18:40:05 2009	(r198921)
@@ -25228,7 +25228,8 @@ them scream.
 		-- Sylvestre Matuschka, "the Hungarian Train Wreck Freak",
 		   escaped prison 1937, not heard from since
 %
-Iam
+I
+am
 not
 very
 happy
From kostikbel at gmail.com  Wed Nov  4 19:59:05 2009
From: kostikbel at gmail.com (Kostik Belousov)
Date: Wed Nov  4 19:59:16 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <3bbf2fe10911040806r37f00a8dq2aa3ccd1e5c7b241@mail.gmail.com>
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
	<20091104055811.GY1293@hoeg.nl>
	<3bbf2fe10911040449j5938ca7eqca5829ceced66f48@mail.gmail.com>
	<20091104144315.GH2331@deviant.kiev.zoral.com.ua>
	<3bbf2fe10911040806r37f00a8dq2aa3ccd1e5c7b241@mail.gmail.com>
Message-ID: <20091104195857.GJ2331@deviant.kiev.zoral.com.ua>

On Wed, Nov 04, 2009 at 05:06:36PM +0100, Attilio Rao wrote:
> 2009/11/4, Kostik Belousov :
> > On Wed, Nov 04, 2009 at 01:49:41PM +0100, Attilio Rao wrote:
> > > 2009/11/4 Ed Schouten :
> > > > Hi Attilio,
> > > >
> > > > * Attilio Rao  wrote:
> > > >> Opteron rev E family of processor expose a bug where, in very rare
> > > >> ocassions, memory barriers semantic is not honoured by the hardware
> > > >> itself. As a result, some random breakage can happen in uninvestigable
> > > >> ways (for further explanation see at the content of the commit itself).
> > > >
> > > > Ooh. Sounds like an interesting bug.
> > > >
> > > > The bug doesn't manifest itself on UP, right? If so, maybe we should add
> > > > some very short instructions to the warning on how to disable SMP.
> > >
> > > Due to the semantic of the bug, I think that it can manifest itself on
> > > UP and a memory barrier failing on UP means that PREEMPTION can blow
> > > up. Considering this I wouldn't suggest anything different between the
> > > UP vs SMP case.
> >
> > CPU is always self-consistent, isn't it ?
> >
> > Also, I very much dislike idea of making our kernel a collection of
> > references to the man pages and URLs, esp. when URL point to the
> > resource not controlled by the project.
> 
> Ok, as long as you are in favor of stripping the URL, I'm fine with it.

I like des' proposal to have kernel config option to enable compile-time
workaround. This is how freebsd handled cyrix CPUs and Pentium f0 0f bug.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091104/5aedb4a5/attachment.pgp
From yongari at FreeBSD.org  Wed Nov  4 20:19:21 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed Nov  4 20:19:33 2009
Subject: svn commit: r198923 - head/sys/dev/bge
Message-ID: <200911042019.nA4KJLYw045222@svn.freebsd.org>

Author: yongari
Date: Wed Nov  4 20:19:21 2009
New Revision: 198923
URL: http://svn.freebsd.org/changeset/base/198923

Log:
  Use correct dma tag for jumbo buffer.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Wed Nov  4 19:01:35 2009	(r198922)
+++ head/sys/dev/bge/if_bge.c	Wed Nov  4 20:19:21 2009	(r198923)
@@ -1031,7 +1031,7 @@ bge_newbuf_jumbo(struct bge_softc *sc, i
 		panic("%s: %d segments\n", __func__, nsegs);
 	}
 
-	bus_dmamap_sync(sc->bge_cdata.bge_mtag,
+	bus_dmamap_sync(sc->bge_cdata.bge_mtag_jumbo,
 	    sc->bge_cdata.bge_rx_jumbo_dmamap[i],
 	    BUS_DMASYNC_PREREAD);
 
From yongari at FreeBSD.org  Wed Nov  4 20:40:38 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed Nov  4 20:40:50 2009
Subject: svn commit: r198924 - head/sys/dev/bge
Message-ID: <200911042040.nA4KecVN045810@svn.freebsd.org>

Author: yongari
Date: Wed Nov  4 20:40:38 2009
New Revision: 198924
URL: http://svn.freebsd.org/changeset/base/198924

Log:
  Covert bge_newbuf_std to use bus_dmamap_load_mbuf_sg(9). Note,
  bge_newbuf_std still has a bug for handling dma map load failure
  under high network load. Just reusing mbuf is not enough as driver
  already unloaded the dma map of the mbuf. Graceful recovery needs
  more work.
  Ideally we can just update dma address part of a Rx descriptor
  because the controller never overwrite the Rx descriptor. This
  requires some Rx initialization code changes and it would be done
  later after fixing other incorrect bus_dma(9) usages.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Wed Nov  4 20:19:21 2009	(r198923)
+++ head/sys/dev/bge/if_bge.c	Wed Nov  4 20:40:38 2009	(r198924)
@@ -916,8 +916,8 @@ bge_newbuf_std(struct bge_softc *sc, int
 {
 	struct mbuf *m_new = NULL;
 	struct bge_rx_bd *r;
-	struct bge_dmamap_arg ctx;
-	int error;
+	bus_dma_segment_t segs[1];
+	int error, nsegs;
 
 	if (m == NULL) {
 		m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
@@ -932,24 +932,21 @@ bge_newbuf_std(struct bge_softc *sc, int
 
 	if ((sc->bge_flags & BGE_FLAG_RX_ALIGNBUG) == 0)
 		m_adj(m_new, ETHER_ALIGN);
-	sc->bge_cdata.bge_rx_std_chain[i] = m_new;
-	r = &sc->bge_ldata.bge_rx_std_ring[i];
-	ctx.bge_maxsegs = 1;
-	ctx.sc = sc;
-	error = bus_dmamap_load(sc->bge_cdata.bge_mtag,
-	    sc->bge_cdata.bge_rx_std_dmamap[i], mtod(m_new, void *),
-	    m_new->m_len, bge_dma_map_addr, &ctx, BUS_DMA_NOWAIT);
-	if (error || ctx.bge_maxsegs == 0) {
+	error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_mtag,
+	    sc->bge_cdata.bge_rx_std_dmamap[i], m_new, segs, &nsegs, 0);
+	if (error != 0) {
 		if (m == NULL) {
 			sc->bge_cdata.bge_rx_std_chain[i] = NULL;
 			m_freem(m_new);
 		}
-		return (ENOMEM);
+		return (error);
 	}
-	r->bge_addr.bge_addr_lo = BGE_ADDR_LO(ctx.bge_busaddr);
-	r->bge_addr.bge_addr_hi = BGE_ADDR_HI(ctx.bge_busaddr);
+	sc->bge_cdata.bge_rx_std_chain[i] = m_new;
+	r = &sc->bge_ldata.bge_rx_std_ring[i];
+	r->bge_addr.bge_addr_lo = BGE_ADDR_LO(segs[0].ds_addr);
+	r->bge_addr.bge_addr_hi = BGE_ADDR_HI(segs[0].ds_addr);
 	r->bge_flags = BGE_RXBDFLAG_END;
-	r->bge_len = m_new->m_len;
+	r->bge_len = segs[0].ds_len;
 	r->bge_idx = i;
 
 	bus_dmamap_sync(sc->bge_cdata.bge_mtag,
From yongari at FreeBSD.org  Wed Nov  4 20:57:52 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed Nov  4 20:57:59 2009
Subject: svn commit: r198927 - head/sys/dev/bge
Message-ID: <200911042057.nA4KvqSo046414@svn.freebsd.org>

Author: yongari
Date: Wed Nov  4 20:57:52 2009
New Revision: 198927
URL: http://svn.freebsd.org/changeset/base/198927

Log:
  Remove common DMA tag used for TX/RX mbufs and create Tx DMA tag
  and Rx DMA tag separately. Previously it used a common mbuf DMA tag
  for both Tx and Rx path but Rx buffer(standard ring case) should
  have a single DMA segment and maximum buffer size of the segment
  should be less than or equal to MCLBYTES. This change also make it
  possible to add TSO with minor changes.

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bge/if_bgereg.h

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Wed Nov  4 20:53:35 2009	(r198926)
+++ head/sys/dev/bge/if_bge.c	Wed Nov  4 20:57:52 2009	(r198927)
@@ -932,7 +932,7 @@ bge_newbuf_std(struct bge_softc *sc, int
 
 	if ((sc->bge_flags & BGE_FLAG_RX_ALIGNBUG) == 0)
 		m_adj(m_new, ETHER_ALIGN);
-	error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_mtag,
+	error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_rx_mtag,
 	    sc->bge_cdata.bge_rx_std_dmamap[i], m_new, segs, &nsegs, 0);
 	if (error != 0) {
 		if (m == NULL) {
@@ -949,7 +949,7 @@ bge_newbuf_std(struct bge_softc *sc, int
 	r->bge_len = segs[0].ds_len;
 	r->bge_idx = i;
 
-	bus_dmamap_sync(sc->bge_cdata.bge_mtag,
+	bus_dmamap_sync(sc->bge_cdata.bge_rx_mtag,
 	    sc->bge_cdata.bge_rx_std_dmamap[i],
 	    BUS_DMASYNC_PREREAD);
 
@@ -1068,10 +1068,10 @@ bge_free_rx_ring_std(struct bge_softc *s
 
 	for (i = 0; i < BGE_STD_RX_RING_CNT; i++) {
 		if (sc->bge_cdata.bge_rx_std_chain[i] != NULL) {
-			bus_dmamap_sync(sc->bge_cdata.bge_mtag,
+			bus_dmamap_sync(sc->bge_cdata.bge_rx_mtag,
 			    sc->bge_cdata.bge_rx_std_dmamap[i],
 			    BUS_DMASYNC_POSTREAD);
-			bus_dmamap_unload(sc->bge_cdata.bge_mtag,
+			bus_dmamap_unload(sc->bge_cdata.bge_rx_mtag,
 			    sc->bge_cdata.bge_rx_std_dmamap[i]);
 			m_freem(sc->bge_cdata.bge_rx_std_chain[i]);
 			sc->bge_cdata.bge_rx_std_chain[i] = NULL;
@@ -1138,10 +1138,10 @@ bge_free_tx_ring(struct bge_softc *sc)
 
 	for (i = 0; i < BGE_TX_RING_CNT; i++) {
 		if (sc->bge_cdata.bge_tx_chain[i] != NULL) {
-			bus_dmamap_sync(sc->bge_cdata.bge_mtag,
+			bus_dmamap_sync(sc->bge_cdata.bge_tx_mtag,
 			    sc->bge_cdata.bge_tx_dmamap[i],
 			    BUS_DMASYNC_POSTWRITE);
-			bus_dmamap_unload(sc->bge_cdata.bge_mtag,
+			bus_dmamap_unload(sc->bge_cdata.bge_tx_mtag,
 			    sc->bge_cdata.bge_tx_dmamap[i]);
 			m_freem(sc->bge_cdata.bge_tx_chain[i]);
 			sc->bge_cdata.bge_tx_chain[i] = NULL;
@@ -1976,7 +1976,7 @@ bge_dma_free(struct bge_softc *sc)
 	/* Destroy DMA maps for RX buffers. */
 	for (i = 0; i < BGE_STD_RX_RING_CNT; i++) {
 		if (sc->bge_cdata.bge_rx_std_dmamap[i])
-			bus_dmamap_destroy(sc->bge_cdata.bge_mtag,
+			bus_dmamap_destroy(sc->bge_cdata.bge_rx_mtag,
 			    sc->bge_cdata.bge_rx_std_dmamap[i]);
 	}
 
@@ -1990,12 +1990,14 @@ bge_dma_free(struct bge_softc *sc)
 	/* Destroy DMA maps for TX buffers. */
 	for (i = 0; i < BGE_TX_RING_CNT; i++) {
 		if (sc->bge_cdata.bge_tx_dmamap[i])
-			bus_dmamap_destroy(sc->bge_cdata.bge_mtag,
+			bus_dmamap_destroy(sc->bge_cdata.bge_tx_mtag,
 			    sc->bge_cdata.bge_tx_dmamap[i]);
 	}
 
-	if (sc->bge_cdata.bge_mtag)
-		bus_dma_tag_destroy(sc->bge_cdata.bge_mtag);
+	if (sc->bge_cdata.bge_rx_mtag)
+		bus_dma_tag_destroy(sc->bge_cdata.bge_rx_mtag);
+	if (sc->bge_cdata.bge_tx_mtag)
+		bus_dma_tag_destroy(sc->bge_cdata.bge_tx_mtag);
 
 
 	/* Destroy standard RX ring. */
@@ -2106,21 +2108,33 @@ bge_dma_alloc(device_t dev)
 	}
 
 	/*
-	 * Create tag for mbufs.
+	 * Create tag for Tx mbufs.
 	 */
 	error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, 1,
 	    0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL,
 	    NULL, MCLBYTES * BGE_NSEG_NEW, BGE_NSEG_NEW, MCLBYTES,
-	    BUS_DMA_ALLOCNOW, NULL, NULL, &sc->bge_cdata.bge_mtag);
+	    BUS_DMA_ALLOCNOW, NULL, NULL, &sc->bge_cdata.bge_tx_mtag);
 
 	if (error) {
-		device_printf(sc->bge_dev, "could not allocate dma tag\n");
+		device_printf(sc->bge_dev, "could not allocate TX dma tag\n");
+		return (ENOMEM);
+	}
+
+	/*
+	 * Create tag for Rx mbufs.
+	 */
+	error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, 1, 0,
+	    BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1,
+	    MCLBYTES, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->bge_cdata.bge_rx_mtag);
+
+	if (error) {
+		device_printf(sc->bge_dev, "could not allocate RX dma tag\n");
 		return (ENOMEM);
 	}
 
 	/* Create DMA maps for RX buffers. */
 	for (i = 0; i < BGE_STD_RX_RING_CNT; i++) {
-		error = bus_dmamap_create(sc->bge_cdata.bge_mtag, 0,
+		error = bus_dmamap_create(sc->bge_cdata.bge_rx_mtag, 0,
 			    &sc->bge_cdata.bge_rx_std_dmamap[i]);
 		if (error) {
 			device_printf(sc->bge_dev,
@@ -2131,11 +2145,11 @@ bge_dma_alloc(device_t dev)
 
 	/* Create DMA maps for TX buffers. */
 	for (i = 0; i < BGE_TX_RING_CNT; i++) {
-		error = bus_dmamap_create(sc->bge_cdata.bge_mtag, 0,
+		error = bus_dmamap_create(sc->bge_cdata.bge_tx_mtag, 0,
 			    &sc->bge_cdata.bge_tx_dmamap[i]);
 		if (error) {
 			device_printf(sc->bge_dev,
-			    "can't create DMA map for RX\n");
+			    "can't create DMA map for TX\n");
 			return (ENOMEM);
 		}
 	}
@@ -3173,10 +3187,10 @@ bge_rxeof(struct bge_softc *sc)
 			}
 		} else {
 			BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT);
-			bus_dmamap_sync(sc->bge_cdata.bge_mtag,
+			bus_dmamap_sync(sc->bge_cdata.bge_rx_mtag,
 			    sc->bge_cdata.bge_rx_std_dmamap[rxidx],
 			    BUS_DMASYNC_POSTREAD);
-			bus_dmamap_unload(sc->bge_cdata.bge_mtag,
+			bus_dmamap_unload(sc->bge_cdata.bge_rx_mtag,
 			    sc->bge_cdata.bge_rx_std_dmamap[rxidx]);
 			m = sc->bge_cdata.bge_rx_std_chain[rxidx];
 			sc->bge_cdata.bge_rx_std_chain[rxidx] = NULL;
@@ -3306,10 +3320,10 @@ bge_txeof(struct bge_softc *sc)
 		if (cur_tx->bge_flags & BGE_TXBDFLAG_END)
 			ifp->if_opackets++;
 		if (sc->bge_cdata.bge_tx_chain[idx] != NULL) {
-			bus_dmamap_sync(sc->bge_cdata.bge_mtag,
+			bus_dmamap_sync(sc->bge_cdata.bge_tx_mtag,
 			    sc->bge_cdata.bge_tx_dmamap[idx],
 			    BUS_DMASYNC_POSTWRITE);
-			bus_dmamap_unload(sc->bge_cdata.bge_mtag,
+			bus_dmamap_unload(sc->bge_cdata.bge_tx_mtag,
 			    sc->bge_cdata.bge_tx_dmamap[idx]);
 			m_freem(sc->bge_cdata.bge_tx_chain[idx]);
 			sc->bge_cdata.bge_tx_chain[idx] = NULL;
@@ -3642,7 +3656,7 @@ bge_encap(struct bge_softc *sc, struct m
 	}
 
 	map = sc->bge_cdata.bge_tx_dmamap[idx];
-	error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_mtag, map, m, segs,
+	error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_tx_mtag, map, m, segs,
 	    &nsegs, BUS_DMA_NOWAIT);
 	if (error == EFBIG) {
 		m = m_collapse(m, M_DONTWAIT, BGE_NSEG_NEW);
@@ -3652,8 +3666,8 @@ bge_encap(struct bge_softc *sc, struct m
 			return (ENOBUFS);
 		}
 		*m_head = m;
-		error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_mtag, map, m,
-		    segs, &nsegs, BUS_DMA_NOWAIT);
+		error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_tx_mtag, map,
+		    m, segs, &nsegs, BUS_DMA_NOWAIT);
 		if (error) {
 			m_freem(m);
 			*m_head = NULL;
@@ -3667,11 +3681,11 @@ bge_encap(struct bge_softc *sc, struct m
 	 * of the end of the ring.
 	 */
 	if (nsegs > (BGE_TX_RING_CNT - sc->bge_txcnt - 16)) {
-		bus_dmamap_unload(sc->bge_cdata.bge_mtag, map);
+		bus_dmamap_unload(sc->bge_cdata.bge_tx_mtag, map);
 		return (ENOBUFS);
 	}
 
-	bus_dmamap_sync(sc->bge_cdata.bge_mtag, map, BUS_DMASYNC_PREWRITE);
+	bus_dmamap_sync(sc->bge_cdata.bge_tx_mtag, map, BUS_DMASYNC_PREWRITE);
 
 	for (i = 0; ; i++) {
 		d = &sc->bge_ldata.bge_tx_ring[idx];

Modified: head/sys/dev/bge/if_bgereg.h
==============================================================================
--- head/sys/dev/bge/if_bgereg.h	Wed Nov  4 20:53:35 2009	(r198926)
+++ head/sys/dev/bge/if_bgereg.h	Wed Nov  4 20:57:52 2009	(r198927)
@@ -2543,8 +2543,9 @@ struct bge_chain_data {
 	bus_dma_tag_t		bge_tx_ring_tag;
 	bus_dma_tag_t		bge_status_tag;
 	bus_dma_tag_t		bge_stats_tag;
-	bus_dma_tag_t		bge_mtag;	/* mbuf mapping tag */
-	bus_dma_tag_t		bge_mtag_jumbo;	/* mbuf mapping tag */
+	bus_dma_tag_t		bge_rx_mtag;	/* Rx mbuf mapping tag */
+	bus_dma_tag_t		bge_tx_mtag;	/* Tx mbuf mapping tag */
+	bus_dma_tag_t		bge_mtag_jumbo;	/* Jumbo mbuf mapping tag */
 	bus_dmamap_t		bge_tx_dmamap[BGE_TX_RING_CNT];
 	bus_dmamap_t		bge_rx_std_dmamap[BGE_STD_RX_RING_CNT];
 	bus_dmamap_t		bge_rx_jumbo_dmamap[BGE_JUMBO_RX_RING_CNT];
From yongari at FreeBSD.org  Wed Nov  4 21:06:54 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed Nov  4 21:07:32 2009
Subject: svn commit: r198928 - head/sys/dev/bge
Message-ID: <200911042106.nA4L6s43046692@svn.freebsd.org>

Author: yongari
Date: Wed Nov  4 21:06:54 2009
New Revision: 198928
URL: http://svn.freebsd.org/changeset/base/198928

Log:
  Make bge_newbuf_std()/bge_newbuf_jumbo() returns actual error code
  for buffer allocation. If driver know we are out of Rx buffers let
  controller stop. This should fix panic when interface is run even
  if it had no configured Rx buffers.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Wed Nov  4 20:57:52 2009	(r198927)
+++ head/sys/dev/bge/if_bge.c	Wed Nov  4 21:06:54 2009	(r198928)
@@ -1044,11 +1044,11 @@ bge_newbuf_jumbo(struct bge_softc *sc, i
 static int
 bge_init_rx_ring_std(struct bge_softc *sc)
 {
-	int i;
+	int error, i;
 
 	for (i = 0; i < BGE_SSLOTS; i++) {
-		if (bge_newbuf_std(sc, i, NULL) == ENOBUFS)
-			return (ENOBUFS);
+		if ((error = bge_newbuf_std(sc, i, NULL)) != 0)
+			return (error);
 	};
 
 	bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag,
@@ -1085,11 +1085,11 @@ static int
 bge_init_rx_ring_jumbo(struct bge_softc *sc)
 {
 	struct bge_rcb *rcb;
-	int i;
+	int error, i;
 
 	for (i = 0; i < BGE_JUMBO_RX_RING_CNT; i++) {
-		if (bge_newbuf_jumbo(sc, i, NULL) == ENOBUFS)
-			return (ENOBUFS);
+		if ((error = bge_newbuf_jumbo(sc, i, NULL)) != 0)
+			return (error);
 	};
 
 	bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag,
@@ -3179,8 +3179,7 @@ bge_rxeof(struct bge_softc *sc)
 				bge_newbuf_jumbo(sc, sc->bge_jumbo, m);
 				continue;
 			}
-			if (bge_newbuf_jumbo(sc,
-			    sc->bge_jumbo, NULL) == ENOBUFS) {
+			if (bge_newbuf_jumbo(sc, sc->bge_jumbo, NULL) != 0) {
 				ifp->if_ierrors++;
 				bge_newbuf_jumbo(sc, sc->bge_jumbo, m);
 				continue;
@@ -3200,8 +3199,7 @@ bge_rxeof(struct bge_softc *sc)
 				bge_newbuf_std(sc, sc->bge_std, m);
 				continue;
 			}
-			if (bge_newbuf_std(sc, sc->bge_std,
-			    NULL) == ENOBUFS) {
+			if (bge_newbuf_std(sc, sc->bge_std, NULL) != 0) {
 				ifp->if_ierrors++;
 				bge_newbuf_std(sc, sc->bge_std, m);
 				continue;
@@ -3897,7 +3895,11 @@ bge_init_locked(struct bge_softc *sc)
 	bge_setvlan(sc);
 
 	/* Init RX ring. */
-	bge_init_rx_ring_std(sc);
+	if (bge_init_rx_ring_std(sc) != 0) {
+		device_printf(sc->bge_dev, "no memory for std Rx buffers.\n");
+		bge_stop(sc);
+		return;
+	}
 
 	/*
 	 * Workaround for a bug in 5705 ASIC rev A0. Poll the NIC's
@@ -3918,8 +3920,13 @@ bge_init_locked(struct bge_softc *sc)
 	}
 
 	/* Init jumbo RX ring. */
-	if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN))
-		bge_init_rx_ring_jumbo(sc);
+	if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) {
+		if (bge_init_rx_ring_jumbo(sc) != 0) {
+			device_printf(sc->bge_dev, "no memory for std Rx buffers.\n");
+			bge_stop(sc);
+			return;
+		}
+	}
 
 	/* Init our RX return ring index. */
 	sc->bge_rx_saved_considx = 0;
From delphij at FreeBSD.org  Wed Nov  4 21:12:34 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Wed Nov  4 21:12:40 2009
Subject: svn commit: r198929 - head/share/examples/ses/srcs
Message-ID: <200911042112.nA4LCXla046881@svn.freebsd.org>

Author: delphij
Date: Wed Nov  4 21:12:33 2009
New Revision: 198929
URL: http://svn.freebsd.org/changeset/base/198929

Log:
  Include string.h for prototype of strcmp().

Modified:
  head/share/examples/ses/srcs/getencstat.c

Modified: head/share/examples/ses/srcs/getencstat.c
==============================================================================
--- head/share/examples/ses/srcs/getencstat.c	Wed Nov  4 21:06:54 2009	(r198928)
+++ head/share/examples/ses/srcs/getencstat.c	Wed Nov  4 21:12:33 2009	(r198929)
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include SESINC
From jkim at FreeBSD.org  Wed Nov  4 22:39:19 2009
From: jkim at FreeBSD.org (Jung-uk Kim)
Date: Wed Nov  4 22:39:24 2009
Subject: svn commit: r198931 - in head/sys/amd64: acpica amd64
Message-ID: <200911042239.nA4MdILx049170@svn.freebsd.org>

Author: jkim
Date: Wed Nov  4 22:39:18 2009
New Revision: 198931
URL: http://svn.freebsd.org/changeset/base/198931

Log:
  Tweak memory allocation for amd64 suspend/resume CPU context.

Modified:
  head/sys/amd64/acpica/acpi_wakeup.c
  head/sys/amd64/amd64/mp_machdep.c

Modified: head/sys/amd64/acpica/acpi_wakeup.c
==============================================================================
--- head/sys/amd64/acpica/acpi_wakeup.c	Wed Nov  4 21:28:50 2009	(r198930)
+++ head/sys/amd64/acpica/acpi_wakeup.c	Wed Nov  4 22:39:18 2009	(r198931)
@@ -65,9 +65,9 @@ extern int		acpi_resume_beep;
 extern int		acpi_reset_video;
 
 #ifdef SMP
-extern struct xpcb	*stopxpcbs;
+extern struct xpcb	**stopxpcbs;
 #else
-static struct xpcb	*stopxpcbs;
+static struct xpcb	**stopxpcbs;
 #endif
 
 int			acpi_restorecpu(struct xpcb *, vm_offset_t);
@@ -104,10 +104,10 @@ acpi_wakeup_ap(struct acpi_softc *sc, in
 	int		apic_id = cpu_apic_ids[cpu];
 	int		ms;
 
-	WAKECODE_FIXUP(wakeup_xpcb, struct xpcb *, &stopxpcbs[cpu]);
-	WAKECODE_FIXUP(wakeup_gdt, uint16_t, stopxpcbs[cpu].xpcb_gdt.rd_limit);
+	WAKECODE_FIXUP(wakeup_xpcb, struct xpcb *, stopxpcbs[cpu]);
+	WAKECODE_FIXUP(wakeup_gdt, uint16_t, stopxpcbs[cpu]->xpcb_gdt.rd_limit);
 	WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t,
-	    stopxpcbs[cpu].xpcb_gdt.rd_base);
+	    stopxpcbs[cpu]->xpcb_gdt.rd_base);
 	WAKECODE_FIXUP(wakeup_cpu, int, cpu);
 
 	/* do an INIT IPI: assert RESET */
@@ -245,8 +245,8 @@ acpi_sleep_machdep(struct acpi_softc *sc
 	cr3 = rcr3();
 	load_cr3(KPML4phys);
 
-	stopfpu = &stopxpcbs[0].xpcb_pcb.pcb_save;
-	if (acpi_savecpu(&stopxpcbs[0])) {
+	stopfpu = &stopxpcbs[0]->xpcb_pcb.pcb_save;
+	if (acpi_savecpu(stopxpcbs[0])) {
 		fpugetregs(curthread, stopfpu);
 
 #ifdef SMP
@@ -261,11 +261,11 @@ acpi_sleep_machdep(struct acpi_softc *sc
 		WAKECODE_FIXUP(resume_beep, uint8_t, (acpi_resume_beep != 0));
 		WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0));
 
-		WAKECODE_FIXUP(wakeup_xpcb, struct xpcb *, &stopxpcbs[0]);
+		WAKECODE_FIXUP(wakeup_xpcb, struct xpcb *, stopxpcbs[0]);
 		WAKECODE_FIXUP(wakeup_gdt, uint16_t,
-		    stopxpcbs[0].xpcb_gdt.rd_limit);
+		    stopxpcbs[0]->xpcb_gdt.rd_limit);
 		WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t,
-		    stopxpcbs[0].xpcb_gdt.rd_base);
+		    stopxpcbs[0]->xpcb_gdt.rd_base);
 		WAKECODE_FIXUP(wakeup_cpu, int, 0);
 
 		/* Call ACPICA to enter the desired sleep state */
@@ -320,6 +320,7 @@ static void *
 acpi_alloc_wakeup_handler(void)
 {
 	void		*wakeaddr;
+	int		i;
 
 	/*
 	 * Specify the region for our wakeup code.  We want it in the low 1 MB
@@ -334,12 +335,9 @@ acpi_alloc_wakeup_handler(void)
 		printf("%s: can't alloc wake memory\n", __func__);
 		return (NULL);
 	}
-	stopxpcbs = malloc(mp_ncpus * sizeof(*stopxpcbs), M_DEVBUF, M_NOWAIT);
-	if (stopxpcbs == NULL) {
-		contigfree(wakeaddr, 4 * PAGE_SIZE, M_DEVBUF);
-		printf("%s: can't alloc CPU state memory\n", __func__);
-		return (NULL);
-	}
+	stopxpcbs = malloc(mp_ncpus * sizeof(*stopxpcbs), M_DEVBUF, M_WAITOK);
+	for (i = 0; i < mp_ncpus; i++)
+		stopxpcbs[i] = malloc(sizeof(**stopxpcbs), M_DEVBUF, M_WAITOK);
 
 	return (wakeaddr);
 }

Modified: head/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- head/sys/amd64/amd64/mp_machdep.c	Wed Nov  4 21:28:50 2009	(r198930)
+++ head/sys/amd64/amd64/mp_machdep.c	Wed Nov  4 22:39:18 2009	(r198931)
@@ -105,7 +105,7 @@ extern pt_entry_t *KPTphys;
 extern pt_entry_t *SMPpt;
 
 struct pcb stoppcbs[MAXCPU];
-struct xpcb *stopxpcbs = NULL;
+struct xpcb **stopxpcbs = NULL;
 
 /* Variables needed for SMP tlb shootdown. */
 vm_offset_t smp_tlb_addr1;
@@ -1256,8 +1256,8 @@ cpususpend_handler(void)
 
 	rf = intr_disable();
 	cr3 = rcr3();
-	stopfpu = &stopxpcbs[cpu].xpcb_pcb.pcb_save;
-	if (savectx2(&stopxpcbs[cpu])) {
+	stopfpu = &stopxpcbs[cpu]->xpcb_pcb.pcb_save;
+	if (savectx2(stopxpcbs[cpu])) {
 		fpugetregs(curthread, stopfpu);
 		wbinvd();
 		atomic_set_int(&stopped_cpus, cpumask);
From imp at bsdimp.com  Wed Nov  4 23:03:19 2009
From: imp at bsdimp.com (M. Warner Losh)
Date: Wed Nov  4 23:03:25 2009
Subject: svn commit: r198868 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <20091104055811.GY1293@hoeg.nl>
References: <200911040132.nA41WxtQ012750@svn.freebsd.org>
	<20091104055811.GY1293@hoeg.nl>
Message-ID: <20091104.155759.-545558145.imp@bsdimp.com>

In message: <20091104055811.GY1293@hoeg.nl>
            Ed Schouten  writes:
: Hi Attilio,
: 
: * Attilio Rao  wrote:
: > Opteron rev E family of processor expose a bug where, in very rare
: > ocassions, memory barriers semantic is not honoured by the hardware
: > itself. As a result, some random breakage can happen in uninvestigable
: > ways (for further explanation see at the content of the commit itself).
: 
: Ooh. Sounds like an interesting bug.
: 
: The bug doesn't manifest itself on UP, right? If so, maybe we should add
: some very short instructions to the warning on how to disable SMP.

Or better yet: disable it unless specifically enabled...

Warner
From delphij at FreeBSD.org  Wed Nov  4 23:36:23 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Wed Nov  4 23:36:36 2009
Subject: svn commit: r198934 - head/share/examples/ses/srcs
Message-ID: <200911042336.nA4NaN8Q050439@svn.freebsd.org>

Author: delphij
Date: Wed Nov  4 23:36:23 2009
New Revision: 198934
URL: http://svn.freebsd.org/changeset/base/198934

Log:
  Cleanup code to make it WARNS=6 clean:
  
   - ANSIfy prototypes;
   - Add __unused for parameters that is not being currently used;
   - Add a header for subrountines being called from other modules.
  
  Reviewed by:	mjacob

Added:
  head/share/examples/ses/srcs/eltsub.h   (contents, props changed)
Modified:
  head/share/examples/ses/srcs/chpmon.c
  head/share/examples/ses/srcs/eltsub.c
  head/share/examples/ses/srcs/getencstat.c
  head/share/examples/ses/srcs/getnobj.c
  head/share/examples/ses/srcs/getobjmap.c
  head/share/examples/ses/srcs/getobjstat.c
  head/share/examples/ses/srcs/inienc.c
  head/share/examples/ses/srcs/sesd.c
  head/share/examples/ses/srcs/setencstat.c
  head/share/examples/ses/srcs/setobjstat.c

Modified: head/share/examples/ses/srcs/chpmon.c
==============================================================================
--- head/share/examples/ses/srcs/chpmon.c	Wed Nov  4 23:34:58 2009	(r198933)
+++ head/share/examples/ses/srcs/chpmon.c	Wed Nov  4 23:36:23 2009	(r198934)
@@ -47,9 +47,7 @@
 #define	BADSTAT	\
 	(SES_ENCSTAT_UNRECOV|SES_ENCSTAT_CRITICAL|SES_ENCSTAT_NONCRITICAL)
 int
-main(a, v)
-	int a;
-	char **v;
+main(int a, char **v)
 {
 	int fd, delay, dev;
 	ses_encstat stat, *carray;

Modified: head/share/examples/ses/srcs/eltsub.c
==============================================================================
--- head/share/examples/ses/srcs/eltsub.c	Wed Nov  4 23:34:58 2009	(r198933)
+++ head/share/examples/ses/srcs/eltsub.c	Wed Nov  4 23:36:23 2009	(r198934)
@@ -38,9 +38,10 @@
 #include 
 #include SESINC
 
+#include "eltsub.h"
+
 char *
-geteltnm(type)
-	int type;
+geteltnm(int type)
 {
 	static char rbuf[132];
 
@@ -116,8 +117,7 @@ geteltnm(type)
 }
 
 static char *
-scode2ascii(code)
-	u_char code;
+scode2ascii(u_char code)
 {
 	static char rbuf[32];
 	switch (code & 0xf) {
@@ -154,9 +154,7 @@ scode2ascii(code)
 
 
 char *
-stat2ascii(eletype, cstat)
-	int eletype;
-	u_char *cstat;
+stat2ascii(int eletype __unused, u_char *cstat)
 {
 	static char ebuf[256], *scode;
 

Added: head/share/examples/ses/srcs/eltsub.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/examples/ses/srcs/eltsub.h	Wed Nov  4 23:36:23 2009	(r198934)
@@ -0,0 +1,36 @@
+/* $FreeBSD$ */
+/*
+ * Copyright (c) 2000 by Matthew Jacob
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification, immediately at the beginning of the file.
+ * 2. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * the GNU Public License ("GPL").
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * 
+ * Matthew Jacob
+ * Feral Software
+ * mjacob@feral.com
+ */
+
+char * geteltnm(int);
+char * stat2ascii(int, u_char *);

Modified: head/share/examples/ses/srcs/getencstat.c
==============================================================================
--- head/share/examples/ses/srcs/getencstat.c	Wed Nov  4 23:34:58 2009	(r198933)
+++ head/share/examples/ses/srcs/getencstat.c	Wed Nov  4 23:36:23 2009	(r198934)
@@ -40,13 +40,10 @@
 #include 
 #include SESINC
 
-extern char *geteltnm __P((int));
-extern char *stat2ascii __P((int, u_char *));
+#include "eltsub.h"
 
 int
-main(a, v)
-	int a;
-	char **v;
+main(int a, char **v)
 {
 	ses_object *objp;
 	ses_objstat ob;

Modified: head/share/examples/ses/srcs/getnobj.c
==============================================================================
--- head/share/examples/ses/srcs/getnobj.c	Wed Nov  4 23:34:58 2009	(r198933)
+++ head/share/examples/ses/srcs/getnobj.c	Wed Nov  4 23:36:23 2009	(r198934)
@@ -41,9 +41,7 @@
 #include SESINC
 
 int
-main(argc, argv)
-	int argc;
-	char **argv;
+main(int argc, char **argv)
 {
 	unsigned int nobj;
 	int fd;

Modified: head/share/examples/ses/srcs/getobjmap.c
==============================================================================
--- head/share/examples/ses/srcs/getobjmap.c	Wed Nov  4 23:34:58 2009	(r198933)
+++ head/share/examples/ses/srcs/getobjmap.c	Wed Nov  4 23:36:23 2009	(r198934)
@@ -39,12 +39,10 @@
 #include 
 #include SESINC
 
-extern char *geteltnm __P((int));
+#include "eltsub.h"
 
 int
-main(a, v)
-	int a;
-	char **v;
+main(int a, char **v)
 {
 	ses_object *objp;
 	int nobj, fd, i;

Modified: head/share/examples/ses/srcs/getobjstat.c
==============================================================================
--- head/share/examples/ses/srcs/getobjstat.c	Wed Nov  4 23:34:58 2009	(r198933)
+++ head/share/examples/ses/srcs/getobjstat.c	Wed Nov  4 23:36:23 2009	(r198934)
@@ -39,9 +39,7 @@
 #include SESINC
 
 int
-main(a, v)
-	int a;
-	char **v;
+main(int a, char **v)
 {
 	int fd;
 	int i;

Modified: head/share/examples/ses/srcs/inienc.c
==============================================================================
--- head/share/examples/ses/srcs/inienc.c	Wed Nov  4 23:34:58 2009	(r198933)
+++ head/share/examples/ses/srcs/inienc.c	Wed Nov  4 23:36:23 2009	(r198934)
@@ -40,9 +40,7 @@
 #include SESINC
 
 int
-main(a, v)
-	int a;
-	char **v;
+main(int a, char **v)
 {
 	int fd;
 

Modified: head/share/examples/ses/srcs/sesd.c
==============================================================================
--- head/share/examples/ses/srcs/sesd.c	Wed Nov  4 23:34:58 2009	(r198933)
+++ head/share/examples/ses/srcs/sesd.c	Wed Nov  4 23:36:23 2009	(r198934)
@@ -49,13 +49,11 @@
  */
 
 int
-main(a, v)
-	int a;
-	char **v;
+main(int a, char **v)
 {
-	static char *usage =
+	static const char *usage =
 	    "usage: %s [ -d ] [ -t pollinterval ] device [ device ]\n";
-	int fd, polltime, dev, devbase, nodaemon, bpri;
+	int fd, polltime, dev, devbase, nodaemon;
 	ses_encstat stat, *carray;
 
 	if (a < 2) {
@@ -115,7 +113,6 @@ main(a, v)
 
 	for (;;) {
 		for (dev = devbase; dev < a; dev++) {
-			char buf[128];
 			fd = open(v[dev], O_RDWR);
 			if (fd < 0) {
 				syslog(LOG_ERR, "%s: %m", v[dev]);

Modified: head/share/examples/ses/srcs/setencstat.c
==============================================================================
--- head/share/examples/ses/srcs/setencstat.c	Wed Nov  4 23:34:58 2009	(r198933)
+++ head/share/examples/ses/srcs/setencstat.c	Wed Nov  4 23:36:23 2009	(r198934)
@@ -40,9 +40,7 @@
 #include SESINC
 
 int
-main(a, v)
-	int a;
-	char **v;
+main(int a, char **v)
 {
 	int fd;
 	long val;

Modified: head/share/examples/ses/srcs/setobjstat.c
==============================================================================
--- head/share/examples/ses/srcs/setobjstat.c	Wed Nov  4 23:34:58 2009	(r198933)
+++ head/share/examples/ses/srcs/setobjstat.c	Wed Nov  4 23:36:23 2009	(r198934)
@@ -40,9 +40,7 @@
 #include SESINC
 
 int
-main(a, v)
-	int a;
-	char **v;
+main(int a, char **v)
 {
 	int fd;
 	int i;
From jh at FreeBSD.org  Thu Nov  5 04:51:39 2009
From: jh at FreeBSD.org (Jaakko Heinonen)
Date: Thu Nov  5 04:51:50 2009
Subject: svn commit: r198940 - head/sys/gnu/fs/ext2fs
Message-ID: <200911050451.nA54pdgo058337@svn.freebsd.org>

Author: jh
Date: Thu Nov  5 04:51:38 2009
New Revision: 198940
URL: http://svn.freebsd.org/changeset/base/198940

Log:
  File flags handling fixes for ext2fs:
  
  - Disallow setting of flags not supported by ext2fs.
  - Map EXT2_APPEND_FL to SF_APPEND.
  - Map EXT2_IMMUTABLE_FL to SF_IMMUTABLE.
  - Map EXT2_NODUMP_FL to UF_NODUMP.
  
  Note that ext2fs doesn't support user settable append and immutable flags.
  EXT2_NODUMP_FL is an user settable flag also on Linux.
  
  PR:		kern/122047
  Reported by:	Ighighi
  Submitted by:	Aditya Sarawgi (original version)
  Reviewed by:	bde
  Approved by:	trasz (mentor)

Modified:
  head/sys/gnu/fs/ext2fs/ext2_inode_cnv.c
  head/sys/gnu/fs/ext2fs/ext2_vnops.c

Modified: head/sys/gnu/fs/ext2fs/ext2_inode_cnv.c
==============================================================================
--- head/sys/gnu/fs/ext2fs/ext2_inode_cnv.c	Thu Nov  5 03:54:03 2009	(r198939)
+++ head/sys/gnu/fs/ext2fs/ext2_inode_cnv.c	Thu Nov  5 04:51:38 2009	(r198940)
@@ -83,8 +83,9 @@ ext2_ei2i(ei, ip)
 	ip->i_mtime = ei->i_mtime;
 	ip->i_ctime = ei->i_ctime;
 	ip->i_flags = 0;
-	ip->i_flags |= (ei->i_flags & EXT2_APPEND_FL) ? APPEND : 0;
-	ip->i_flags |= (ei->i_flags & EXT2_IMMUTABLE_FL) ? IMMUTABLE : 0;
+	ip->i_flags |= (ei->i_flags & EXT2_APPEND_FL) ? SF_APPEND : 0;
+	ip->i_flags |= (ei->i_flags & EXT2_IMMUTABLE_FL) ? SF_IMMUTABLE : 0;
+	ip->i_flags |= (ei->i_flags & EXT2_NODUMP_FL) ? UF_NODUMP : 0;
 	ip->i_blocks = ei->i_blocks;
 	ip->i_gen = ei->i_generation;
 	ip->i_uid = ei->i_uid;
@@ -121,8 +122,9 @@ ext2_i2ei(ip, ei)
 	ei->i_ctime = ip->i_ctime;
 	ei->i_flags = ip->i_flags;
 	ei->i_flags = 0;
-	ei->i_flags |= (ip->i_flags & APPEND) ? EXT2_APPEND_FL: 0;
-	ei->i_flags |= (ip->i_flags & IMMUTABLE) ? EXT2_IMMUTABLE_FL: 0;
+	ei->i_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND_FL: 0;
+	ei->i_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE_FL: 0;
+	ei->i_flags |= (ip->i_flags & UF_NODUMP) ? EXT2_NODUMP_FL : 0;
 	ei->i_blocks = ip->i_blocks;
 	ei->i_generation = ip->i_gen;
 	ei->i_uid = ip->i_uid;

Modified: head/sys/gnu/fs/ext2fs/ext2_vnops.c
==============================================================================
--- head/sys/gnu/fs/ext2fs/ext2_vnops.c	Thu Nov  5 03:54:03 2009	(r198939)
+++ head/sys/gnu/fs/ext2fs/ext2_vnops.c	Thu Nov  5 04:51:38 2009	(r198940)
@@ -391,6 +391,10 @@ ext2_setattr(ap)
 		return (EINVAL);
 	}
 	if (vap->va_flags != VNOVAL) {
+		/* Disallow flags not supported by ext2fs. */
+		if (vap->va_flags & ~(SF_APPEND | SF_IMMUTABLE | UF_NODUMP))
+			return (EOPNOTSUPP);
+
 		if (vp->v_mount->mnt_flag & MNT_RDONLY)
 			return (EROFS);
 		/*
From marcel at FreeBSD.org  Thu Nov  5 06:08:05 2009
From: marcel at FreeBSD.org (Marcel Moolenaar)
Date: Thu Nov  5 06:08:11 2009
Subject: svn commit: r198941 - head/lib/libstand
Message-ID: <200911050608.nA5684TK064364@svn.freebsd.org>

Author: marcel
Date: Thu Nov  5 06:08:04 2009
New Revision: 198941
URL: http://svn.freebsd.org/changeset/base/198941

Log:
  IP_TTL is an IP socket option, not a TTL value. Use IPDEFTTL
  instead.

Modified:
  head/lib/libstand/udp.c

Modified: head/lib/libstand/udp.c
==============================================================================
--- head/lib/libstand/udp.c	Thu Nov  5 04:51:38 2009	(r198940)
+++ head/lib/libstand/udp.c	Thu Nov  5 06:08:04 2009	(r198941)
@@ -90,7 +90,7 @@ sendudp(d, pkt, len)
 	ip->ip_hl = sizeof(*ip) >> 2;		/* half-char */
 	ip->ip_len = htons(len);
 	ip->ip_p = IPPROTO_UDP;			/* char */
-	ip->ip_ttl = IP_TTL;			/* char */
+	ip->ip_ttl = IPDEFTTL;			/* char */
 	ip->ip_src = d->myip;
 	ip->ip_dst = d->destip;
 	ip->ip_sum = in_cksum(ip, sizeof(*ip));	 /* short, but special */
From marcel at FreeBSD.org  Thu Nov  5 06:23:02 2009
From: marcel at FreeBSD.org (Marcel Moolenaar)
Date: Thu Nov  5 06:23:09 2009
Subject: svn commit: r198942 - head/sys/arm/arm
Message-ID: <200911050623.nA56N2PU064766@svn.freebsd.org>

Author: marcel
Date: Thu Nov  5 06:23:02 2009
New Revision: 198942
URL: http://svn.freebsd.org/changeset/base/198942

Log:
  Implement db_trace_self() by calling db_stack_trace_cmd()
  and not db_trace_thread().

Modified:
  head/sys/arm/arm/db_trace.c

Modified: head/sys/arm/arm/db_trace.c
==============================================================================
--- head/sys/arm/arm/db_trace.c	Thu Nov  5 06:08:04 2009	(r198941)
+++ head/sys/arm/arm/db_trace.c	Thu Nov  5 06:23:02 2009	(r198942)
@@ -207,5 +207,8 @@ db_trace_thread(struct thread *thr, int 
 void
 db_trace_self(void)
 {
-	db_trace_thread(curthread, -1);
+	db_addr_t addr;
+
+	addr = (db_addr_t)__builtin_frame_address(1);
+	db_stack_trace_cmd(addr, -1);
 }
From marcel at FreeBSD.org  Thu Nov  5 06:27:46 2009
From: marcel at FreeBSD.org (Marcel Moolenaar)
Date: Thu Nov  5 06:27:58 2009
Subject: svn commit: r198943 - head/sys/arm/arm
Message-ID: <200911050627.nA56RkZP064907@svn.freebsd.org>

Author: marcel
Date: Thu Nov  5 06:27:46 2009
New Revision: 198943
URL: http://svn.freebsd.org/changeset/base/198943

Log:
  Implement db_trace_thread() by calling db_stack_trace_cmd() and
  passing a frame pointer that comes from the thread context. This
  fixes DDB backtraces by not unwinding debugger functions first.

Modified:
  head/sys/arm/arm/db_trace.c

Modified: head/sys/arm/arm/db_trace.c
==============================================================================
--- head/sys/arm/arm/db_trace.c	Thu Nov  5 06:23:02 2009	(r198942)
+++ head/sys/arm/arm/db_trace.c	Thu Nov  5 06:27:46 2009	(r198943)
@@ -194,13 +194,10 @@ db_md_set_watchpoint(db_expr_t addr, db_
 int
 db_trace_thread(struct thread *thr, int count)
 {
-	uint32_t addr;
+	struct pcb *ctx;
 
-	if (thr == curthread)
-		addr = (uint32_t)__builtin_frame_address(0);
-	else
-		addr = thr->td_pcb->un_32.pcb32_r11;
-	db_stack_trace_cmd(addr, -1);
+	ctx = kdb_thr_ctx(thr);
+	db_stack_trace_cmd(ctx->un_32.pcb32_r11, -1);
 	return (0);
 }
 
From marcel at FreeBSD.org  Thu Nov  5 06:31:51 2009
From: marcel at FreeBSD.org (Marcel Moolenaar)
Date: Thu Nov  5 06:32:03 2009
Subject: svn commit: r198944 - head/sys/arm/arm
Message-ID: <200911050631.nA56VocI065092@svn.freebsd.org>

Author: marcel
Date: Thu Nov  5 06:31:50 2009
New Revision: 198944
URL: http://svn.freebsd.org/changeset/base/198944

Log:
  Fix gdb_cpu_getreg() to actually match GDB's register
  definition.

Modified:
  head/sys/arm/arm/gdb_machdep.c

Modified: head/sys/arm/arm/gdb_machdep.c
==============================================================================
--- head/sys/arm/arm/gdb_machdep.c	Thu Nov  5 06:27:46 2009	(r198943)
+++ head/sys/arm/arm/gdb_machdep.c	Thu Nov  5 06:31:50 2009	(r198944)
@@ -53,12 +53,15 @@ gdb_cpu_getreg(int regnum, size_t *regsz
 
 	*regsz = gdb_cpu_regsz(regnum);
 
-	if (kdb_thread  == curthread) {
-		if (regnum < 16)
-			return (&kdb_frame->tf_r0 + 4 * regnum);
+	if (kdb_thread == curthread) {
+		if (regnum < 15)
+			return (&kdb_frame->tf_r0 + regnum);
+		if (regnum == 15)
+			return (&kdb_frame->tf_pc);
 		if (regnum == 25)
 			return (&kdb_frame->tf_spsr);
 	}
+
 	switch (regnum) {
 	case 8:  return (&kdb_thrctx->un_32.pcb32_r8);
 	case 9:  return (&kdb_thrctx->un_32.pcb32_r9);
@@ -78,6 +81,7 @@ gdb_cpu_getreg(int regnum, size_t *regsz
 			  return (&kdb_thrctx->un_32.pcb32_pc);
 		  }
 	}
+
 	return (NULL);
 }
 
From netchild at FreeBSD.org  Thu Nov  5 07:37:49 2009
From: netchild at FreeBSD.org (Alexander Leidinger)
Date: Thu Nov  5 07:38:01 2009
Subject: svn commit: r198945 - head/sys/compat/linux
Message-ID: <200911050737.nA57bnpG066817@svn.freebsd.org>

Author: netchild
Date: Thu Nov  5 07:37:48 2009
New Revision: 198945
URL: http://svn.freebsd.org/changeset/base/198945

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

Modified:
  head/sys/compat/linux/linux_ipc.c

Modified: head/sys/compat/linux/linux_ipc.c
==============================================================================
--- head/sys/compat/linux/linux_ipc.c	Thu Nov  5 06:31:50 2009	(r198944)
+++ head/sys/compat/linux/linux_ipc.c	Thu Nov  5 07:37:48 2009	(r198945)
@@ -872,7 +872,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 mav at FreeBSD.org  Thu Nov  5 08:55:24 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Thu Nov  5 08:55:36 2009
Subject: svn commit: r198947 - head/sys/cam
Message-ID: <200911050855.nA58tO43068934@svn.freebsd.org>

Author: mav
Date: Thu Nov  5 08:55:24 2009
New Revision: 198947
URL: http://svn.freebsd.org/changeset/base/198947

Log:
  MFp4:
  Implement device stats accounting for ATA commands.

Modified:
  head/sys/cam/cam_periph.c

Modified: head/sys/cam/cam_periph.c
==============================================================================
--- head/sys/cam/cam_periph.c	Thu Nov  5 08:31:42 2009	(r198946)
+++ head/sys/cam/cam_periph.c	Thu Nov  5 08:55:24 2009	(r198947)
@@ -898,7 +898,8 @@ cam_periph_runccb(union ccb *ccb,
 	 * If the user has supplied a stats structure, and if we understand
 	 * this particular type of ccb, record the transaction start.
 	 */
-	if ((ds != NULL) && (ccb->ccb_h.func_code == XPT_SCSI_IO))
+	if ((ds != NULL) && (ccb->ccb_h.func_code == XPT_SCSI_IO ||
+	    ccb->ccb_h.func_code == XPT_ATA_IO))
 		devstat_start_transaction(ds, NULL);
 
 	xpt_action(ccb);
@@ -921,15 +922,27 @@ cam_periph_runccb(union ccb *ccb,
 				 /* timeout */0,
 				 /* getcount_only */ FALSE);
 
-	if ((ds != NULL) && (ccb->ccb_h.func_code == XPT_SCSI_IO))
-		devstat_end_transaction(ds,
+	if (ds != NULL) {
+		if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
+			devstat_end_transaction(ds,
 					ccb->csio.dxfer_len,
-					ccb->csio.tag_action & 0xf,
+					ccb->csio.tag_action & 0x3,
 					((ccb->ccb_h.flags & CAM_DIR_MASK) ==
 					CAM_DIR_NONE) ?  DEVSTAT_NO_DATA : 
 					(ccb->ccb_h.flags & CAM_DIR_OUT) ?
 					DEVSTAT_WRITE : 
 					DEVSTAT_READ, NULL, NULL);
+		} else if (ccb->ccb_h.func_code == XPT_ATA_IO) {
+			devstat_end_transaction(ds,
+					ccb->ataio.dxfer_len,
+					ccb->ataio.tag_action & 0x3,
+					((ccb->ccb_h.flags & CAM_DIR_MASK) ==
+					CAM_DIR_NONE) ?  DEVSTAT_NO_DATA : 
+					(ccb->ccb_h.flags & CAM_DIR_OUT) ?
+					DEVSTAT_WRITE : 
+					DEVSTAT_READ, NULL, NULL);
+		}
+	}
 
 	return(error);
 }
From ru at FreeBSD.org  Thu Nov  5 10:01:16 2009
From: ru at FreeBSD.org (Ruslan Ermilov)
Date: Thu Nov  5 10:01:28 2009
Subject: svn commit: r198948 - head/share/misc
Message-ID: <200911051001.nA5A1GSx071241@svn.freebsd.org>

Author: ru
Date: Thu Nov  5 10:01:15 2009
New Revision: 198948
URL: http://svn.freebsd.org/changeset/base/198948

Log:
  Revert the spelling of Taiwan to be politically neutral in accordance
  with the policy published at http://www.freebsd.org/internal/i18n.html.
  
  Requested by:	core (murray)

Modified:
  head/share/misc/iso3166

Modified: head/share/misc/iso3166
==============================================================================
--- head/share/misc/iso3166	Thu Nov  5 08:55:24 2009	(r198947)
+++ head/share/misc/iso3166	Thu Nov  5 10:01:15 2009	(r198948)
@@ -1,5 +1,8 @@
 # $FreeBSD$
 #
+# Please consult with http://www.FreeBSD.org/internal/i18n.html before
+# making changes to this file.
+#
 # ISO 3166 country codes
 # This includes many places that are not legally independent countries,
 # but which is it convenient to refer to separately from their
@@ -230,7 +233,7 @@ SZ	SWZ	748	Swaziland
 SE	SWE	752	Sweden
 CH	CHE	756	Switzerland
 SY	SYR	760	Syrian Arab Republic
-TW	TWN	158	Taiwan, Province of China
+TW	TWN	158	Taiwan
 TJ	TJK	762	Tajikistan
 TZ	TZA	834	Tanzania, United Republic of
 TH	THA	764	Thailand
From rpaulo at FreeBSD.org  Thu Nov  5 13:28:09 2009
From: rpaulo at FreeBSD.org (Rui Paulo)
Date: Thu Nov  5 13:28:15 2009
Subject: svn commit: r198943 - head/sys/arm/arm
In-Reply-To: <200911050627.nA56RkZP064907@svn.freebsd.org>
References: <200911050627.nA56RkZP064907@svn.freebsd.org>
Message-ID: <253E61DA-2F55-4801-8C08-E5C95DEF94BC@FreeBSD.org>

On 5 Nov 2009, at 06:27, Marcel Moolenaar wrote:

> Author: marcel
> Date: Thu Nov  5 06:27:46 2009
> New Revision: 198943
> URL: http://svn.freebsd.org/changeset/base/198943
>
> Log:
>  Implement db_trace_thread() by calling db_stack_trace_cmd() and
>  passing a frame pointer that comes from the thread context. This
>  fixes DDB backtraces by not unwinding debugger functions first.

Woot! Nice :-) I've been wondering for ages why DDB bt would print  
wrong function names.

--
Rui Paulo

From attilio at FreeBSD.org  Thu Nov  5 14:34:40 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Thu Nov  5 14:34:46 2009
Subject: svn commit: r198950 - in head/sys: amd64/amd64 i386/i386
Message-ID: <200911051434.nA5EYcCV080800@svn.freebsd.org>

Author: attilio
Date: Thu Nov  5 14:34:38 2009
New Revision: 198950
URL: http://svn.freebsd.org/changeset/base/198950

Log:
  Strip from messages for users external URLs the project cannot directly
  control.
  
  Requested by:	kib, rwatson

Modified:
  head/sys/amd64/amd64/identcpu.c
  head/sys/i386/i386/identcpu.c

Modified: head/sys/amd64/amd64/identcpu.c
==============================================================================
--- head/sys/amd64/amd64/identcpu.c	Thu Nov  5 13:54:35 2009	(r198949)
+++ head/sys/amd64/amd64/identcpu.c	Thu Nov  5 14:34:38 2009	(r198950)
@@ -619,12 +619,9 @@ print_AMD_info(void)
 	 * model and family are identified.
 	 */
 	if (CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x20 &&
-	    CPUID_TO_MODEL(cpu_id) <= 0x3f) {
+	    CPUID_TO_MODEL(cpu_id) <= 0x3f)
 		printf("WARNING: This architecture revision has known SMP "
 		    "hardware bugs which may cause random instability\n");
-		printf("WARNING: For details see: "
-		    "http://bugzilla.kernel.org/show_bug.cgi?id=11305\n");
-	}
 }
 
 static void

Modified: head/sys/i386/i386/identcpu.c
==============================================================================
--- head/sys/i386/i386/identcpu.c	Thu Nov  5 13:54:35 2009	(r198949)
+++ head/sys/i386/i386/identcpu.c	Thu Nov  5 14:34:38 2009	(r198950)
@@ -1315,12 +1315,9 @@ print_AMD_info(void)
 	 * model and family are identified.
 	 */
 	if (CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x20 &&
-	    CPUID_TO_MODEL(cpu_id) <= 0x3f) {
+	    CPUID_TO_MODEL(cpu_id) <= 0x3f)
 		printf("WARNING: This architecture revision has known SMP "
 		    "hardware bugs which may cause random instability\n");
-		printf("WARNING: For details see: "
-		    "http://bugzilla.kernel.org/show_bug.cgi?id=11305\n");
-	}
 }
 
 static void
From vanilla at fatpipi.com  Thu Nov  5 15:19:22 2009
From: vanilla at fatpipi.com (Vanilla Hsu)
Date: Thu Nov  5 15:19:33 2009
Subject: svn commit: r198948 - head/share/misc
In-Reply-To: <200911051001.nA5A1GSx071241@svn.freebsd.org>
References: <200911051001.nA5A1GSx071241@svn.freebsd.org>
Message-ID: 

Thanks.
--
I payed the tax to Taiwan's government, not China's government.

2009/11/5 Ruslan Ermilov 

> Author: ru
> Date: Thu Nov  5 10:01:15 2009
> New Revision: 198948
> URL: http://svn.freebsd.org/changeset/base/198948
>
> Log:
>  Revert the spelling of Taiwan to be politically neutral in accordance
>  with the policy published at http://www.freebsd.org/internal/i18n.html.
>
>  Requested by: core (murray)
>
> Modified:
>  head/share/misc/iso3166
>
> Modified: head/share/misc/iso3166
>
> ==============================================================================
> --- head/share/misc/iso3166     Thu Nov  5 08:55:24 2009        (r198947)
> +++ head/share/misc/iso3166     Thu Nov  5 10:01:15 2009        (r198948)
> @@ -1,5 +1,8 @@
>  # $FreeBSD$
>  #
> +# Please consult with http://www.FreeBSD.org/internal/i18n.html before
> +# making changes to this file.
> +#
>  # ISO 3166 country codes
>  # This includes many places that are not legally independent countries,
>  # but which is it convenient to refer to separately from their
> @@ -230,7 +233,7 @@ SZ  SWZ     748     Swaziland
>  SE     SWE     752     Sweden
>  CH     CHE     756     Switzerland
>  SY     SYR     760     Syrian Arab Republic
> -TW     TWN     158     Taiwan, Province of China
> +TW     TWN     158     Taiwan
>  TJ     TJK     762     Tajikistan
>  TZ     TZA     834     Tanzania, United Republic of
>  TH     THA     764     Thailand
> _______________________________________________
> svn-src-all@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
>
From brueffer at FreeBSD.org  Thu Nov  5 16:30:16 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Thu Nov  5 16:30:28 2009
Subject: svn commit: r198952 - head/sys/contrib/altq/altq
Message-ID: <200911051630.nA5GUGui083623@svn.freebsd.org>

Author: brueffer
Date: Thu Nov  5 16:30:16 2009
New Revision: 198952
URL: http://svn.freebsd.org/changeset/base/198952

Log:
  Fix two memory leaks in error cases.
  
  PR:		138378
  Submitted by:	Patroklos Argyroudis 
  Approved by:	mlaier
  MFC after:	1 week

Modified:
  head/sys/contrib/altq/altq/altq_hfsc.c

Modified: head/sys/contrib/altq/altq/altq_hfsc.c
==============================================================================
--- head/sys/contrib/altq/altq/altq_hfsc.c	Thu Nov  5 16:16:56 2009	(r198951)
+++ head/sys/contrib/altq/altq/altq_hfsc.c	Thu Nov  5 16:30:16 2009	(r198952)
@@ -1809,15 +1809,20 @@ hfsc_class_modify(cl, rsc, fsc, usc)
 	    cl->cl_fsc == NULL) {
 		fsc_tmp = malloc(sizeof(struct internal_sc),
 		    M_DEVBUF, M_WAITOK);
-		if (fsc_tmp == NULL)
+		if (fsc_tmp == NULL) {
+			free(rsc_tmp);
 			return (ENOMEM);
+		}
 	}
 	if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0) &&
 	    cl->cl_usc == NULL) {
 		usc_tmp = malloc(sizeof(struct internal_sc),
 		    M_DEVBUF, M_WAITOK);
-		if (usc_tmp == NULL)
+		if (usc_tmp == NULL) {
+			free(rsc_tmp);
+			free(fsc_tmp);
 			return (ENOMEM);
+		}
 	}
 
 	cur_time = read_machclk();
From jilles at FreeBSD.org  Thu Nov  5 20:44:39 2009
From: jilles at FreeBSD.org (Jilles Tjoelker)
Date: Thu Nov  5 20:44:45 2009
Subject: svn commit: r198963 - head/bin/sh
Message-ID: <200911052044.nA5KidiH090202@svn.freebsd.org>

Author: jilles
Date: Thu Nov  5 20:44:39 2009
New Revision: 198963
URL: http://svn.freebsd.org/changeset/base/198963

Log:
  sh: Fix memory leak when using a variable in arithmetic like $((x)).
  
  MFC after:	3 weeks

Modified:
  head/bin/sh/arith_lex.l

Modified: head/bin/sh/arith_lex.l
==============================================================================
--- head/bin/sh/arith_lex.l	Thu Nov  5 19:55:42 2009	(r198962)
+++ head/bin/sh/arith_lex.l	Thu Nov  5 20:44:39 2009	(r198963)
@@ -51,6 +51,13 @@ __FBSDID("$FreeBSD$");
 
 int yylex(void);
 
+struct varname
+{
+	struct varname *next;
+	char name[1];
+};
+static struct varname *varnames;
+
 #undef YY_INPUT
 #define YY_INPUT(buf,result,max) \
 	result = (*buf = *arith_buf++) ? 1 : YY_NULL;
@@ -80,11 +87,14 @@ int yylex(void);
 			 * If variable doesn't exist, we should initialize
 			 * it to zero.
 			 */
-			char *temp;
+			struct varname *temp;
 			if (lookupvar(yytext) == NULL)
 				setvarsafe(yytext, "0", 0);
-			temp = (char *)ckmalloc(strlen(yytext) + 1);
-			yylval.s_value = strcpy(temp, yytext);
+			temp = ckmalloc(sizeof(struct varname) +
+			    strlen(yytext));
+			temp->next = varnames;
+			varnames = temp;
+			yylval.s_value = strcpy(temp->name, yytext);
 
 			return ARITH_VAR;
 		}
@@ -130,5 +140,15 @@ int yylex(void);
 void
 arith_lex_reset(void)
 {
+	struct varname *name, *next;
+
 	YY_NEW_FILE;
+
+	name = varnames;
+	while (name != NULL) {
+		next = name->next;
+		ckfree(name);
+		name = next;
+	}
+	varnames = NULL;
 }
From jkim at FreeBSD.org  Thu Nov  5 22:58:50 2009
From: jkim at FreeBSD.org (Jung-uk Kim)
Date: Thu Nov  5 22:59:03 2009
Subject: svn commit: r198964 - in head/sys: dev/fb dev/pci isa
Message-ID: <200911052258.nA5Mwo0S093646@svn.freebsd.org>

Author: jkim
Date: Thu Nov  5 22:58:50 2009
New Revision: 198964
URL: http://svn.freebsd.org/changeset/base/198964

Log:
  Save/restore VGA state from vga_pci.c instead of relying on vga_isa.c.
  It was not working because we were saving its state after the device was
  powered down.  Simplify vesa_load_state() as the culprit is fixed now.

Modified:
  head/sys/dev/fb/vesa.c
  head/sys/dev/pci/vga_pci.c
  head/sys/isa/vga_isa.c

Modified: head/sys/dev/fb/vesa.c
==============================================================================
--- head/sys/dev/fb/vesa.c	Thu Nov  5 20:44:39 2009	(r198963)
+++ head/sys/dev/fb/vesa.c	Thu Nov  5 22:58:50 2009	(r198964)
@@ -164,7 +164,6 @@ static char *vesa_revstr = NULL;
 static int int10_set_mode(int mode);
 static int vesa_bios_post(void);
 static int vesa_bios_get_mode(int mode, struct vesa_mode *vmode);
-static int vesa_bios_get_current_mode(void);
 static int vesa_bios_set_mode(int mode);
 static int vesa_bios_get_dac(void);
 static int vesa_bios_set_dac(int bits);
@@ -319,22 +318,6 @@ vesa_bios_get_mode(int mode, struct vesa
 }
 
 static int
-vesa_bios_get_current_mode(void)
-{
-	x86regs_t regs;
-
-	x86bios_init_regs(®s);
-	regs.R_AX = 0x4f03;
-
-	x86bios_intr(®s, 0x10);
-
-	if (regs.R_AX != 0x004f)
-		return (-1);
-
-	return (regs.R_BX);
-}
-
-static int
 vesa_bios_set_mode(int mode)
 {
 	x86regs_t regs;
@@ -1438,7 +1421,6 @@ vesa_save_state(video_adapter_t *adp, vo
 static int
 vesa_load_state(video_adapter_t *adp, void *p)
 {
-	int flags, mode, ret;
 
 	if ((adp != vesa_adp) || (((adp_state_t *)p)->sig != V_STATE_SIG))
 		return ((*prevvidsw->load_state)(adp, p));
@@ -1446,38 +1428,12 @@ vesa_load_state(video_adapter_t *adp, vo
 	if (vesa_state_buf_size <= 0)
 		return (1);
 
-	/*
-	 * If the current mode is not the same, probably it was powered down.
-	 * Try BIOS POST to restore a sane state.
-	 */
-	if (VESA_MODE(adp->va_mode)) {
-		mode = vesa_bios_get_current_mode();
-		if (mode >= 0 && (mode & 0x1ff) != adp->va_mode)
-			(void)vesa_bios_post();
-	}
-
-	ret = vesa_bios_save_restore(STATE_LOAD, ((adp_state_t *)p)->regs,
-	    vesa_state_buf_size);
+	/* Try BIOS POST to restore a sane state. */
+	(void)vesa_bios_post();
+	(void)int10_set_mode(adp->va_initial_bios_mode);
 
-	/*
-	 * If the desired mode is not restored, force setting the mode.
-	 */
-	if (VESA_MODE(adp->va_mode)) {
-		mode = vesa_bios_get_current_mode();
-		if (mode < 0 || (mode & 0x1ff) == adp->va_mode)
-			return (ret);
-		mode = adp->va_mode;
-		flags = adp->va_info.vi_flags;
-		if ((flags & V_INFO_GRAPHICS) != 0 &&
-		    (flags & V_INFO_LINEAR) != 0)
-			mode |= 0x4000;
-		(void)vesa_bios_set_mode(mode);
-		if ((vesa_adp_info->v_flags & V_DAC8) != 0)
-			(void)vesa_bios_set_dac(8);
-		(void)(*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1);
-	}
-
-	return (ret);
+	return (vesa_bios_save_restore(STATE_LOAD, ((adp_state_t *)p)->regs,
+	    vesa_state_buf_size));
 }
 
 #if 0

Modified: head/sys/dev/pci/vga_pci.c
==============================================================================
--- head/sys/dev/pci/vga_pci.c	Thu Nov  5 20:44:39 2009	(r198963)
+++ head/sys/dev/pci/vga_pci.c	Thu Nov  5 22:58:50 2009	(r198964)
@@ -40,12 +40,17 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -63,7 +68,7 @@ SYSCTL_DECL(_hw_pci);
 
 int vga_pci_default_unit = -1;
 TUNABLE_INT("hw.pci.default_vgapci_unit", &vga_pci_default_unit);
-SYSCTL_INT(_hw_pci, OID_AUTO, default_vgapci_unit, CTLFLAG_RD,
+SYSCTL_INT(_hw_pci, OID_AUTO, default_vgapci_unit, CTLFLAG_RDTUN,
     &vga_pci_default_unit, -1, "Default VGA-compatible display");
 
 static int
@@ -112,13 +117,86 @@ vga_pci_attach(device_t dev)
 static int
 vga_pci_suspend(device_t dev)
 {
+	vga_softc_t *sc;
+	devclass_t dc;
+	int err, nbytes;
+
+	err = bus_generic_suspend(dev);
+	if (err)
+		return (err);
+
+	sc = NULL;
+	if (device_get_unit(dev) == vga_pci_default_unit) {
+		dc = devclass_find(VGA_DRIVER_NAME);
+		if (dc != NULL)
+			sc = devclass_get_softc(dc, 0);
+	}
+	if (sc == NULL)
+		return (0);
+
+	/* Save the video state across the suspend. */
+	if (sc->state_buf != NULL)
+		goto save_palette;
+	nbytes = vidd_save_state(sc->adp, NULL, 0);
+	if (nbytes <= 0)
+		goto save_palette;
+	sc->state_buf = malloc(nbytes, M_TEMP, M_NOWAIT);
+	if (sc->state_buf == NULL)
+		goto save_palette;
+	if (bootverbose)
+		device_printf(dev, "saving %d bytes of video state\n", nbytes);
+	if (vidd_save_state(sc->adp, sc->state_buf, nbytes) != 0) {
+		device_printf(dev, "failed to save state (nbytes=%d)\n",
+		    nbytes);
+		free(sc->state_buf, M_TEMP);
+		sc->state_buf = NULL;
+	}
+
+save_palette:
+	/* Save the color palette across the suspend. */
+	if (sc->pal_buf != NULL)
+		return (0);
+	sc->pal_buf = malloc(256 * 3, M_TEMP, M_NOWAIT);
+	if (sc->pal_buf != NULL) {
+		if (bootverbose)
+			device_printf(dev, "saving color palette\n");
+		if (vidd_save_palette(sc->adp, sc->pal_buf) != 0) {
+			device_printf(dev, "failed to save palette\n");
+			free(sc->pal_buf, M_TEMP);
+			sc->pal_buf = NULL;
+		}
+	}
 
-	return (bus_generic_suspend(dev));
+	return (0);
 }
 
 static int
 vga_pci_resume(device_t dev)
 {
+	vga_softc_t *sc;
+	devclass_t dc;
+
+	sc = NULL;
+	if (device_get_unit(dev) == vga_pci_default_unit) {
+		dc = devclass_find(VGA_DRIVER_NAME);
+		if (dc != NULL)
+			sc = devclass_get_softc(dc, 0);
+	}
+	if (sc == NULL)
+		return (bus_generic_resume(dev));
+
+	if (sc->state_buf != NULL) {
+		if (vidd_load_state(sc->adp, sc->state_buf) != 0)
+			device_printf(dev, "failed to reload state\n");
+		free(sc->state_buf, M_TEMP);
+		sc->state_buf = NULL;
+	}
+	if (sc->pal_buf != NULL) {
+		if (vidd_load_palette(sc->adp, sc->pal_buf) != 0)
+			device_printf(dev, "failed to reload palette\n");
+		free(sc->pal_buf, M_TEMP);
+		sc->pal_buf = NULL;
+	}
 
 	return (bus_generic_resume(dev));
 }

Modified: head/sys/isa/vga_isa.c
==============================================================================
--- head/sys/isa/vga_isa.c	Thu Nov  5 20:44:39 2009	(r198963)
+++ head/sys/isa/vga_isa.c	Thu Nov  5 22:58:50 2009	(r198964)
@@ -166,35 +166,34 @@ isavga_suspend(device_t dev)
 	vga_softc_t *sc;
 	int err, nbytes;
 
-	sc = device_get_softc(dev);
 	err = bus_generic_suspend(dev);
 	if (err)
 		return (err);
 
+	sc = device_get_softc(dev);
+
 	/* Save the video state across the suspend. */
-	if (sc->state_buf != NULL) {
-		free(sc->state_buf, M_TEMP);
-		sc->state_buf = NULL;
-	}
+	if (sc->state_buf != NULL)
+		goto save_palette;
 	nbytes = vidd_save_state(sc->adp, NULL, 0);
 	if (nbytes <= 0)
-		return (0);
+		goto save_palette;
 	sc->state_buf = malloc(nbytes, M_TEMP, M_NOWAIT);
-	if (sc->state_buf != NULL) {
-		if (bootverbose)
-			device_printf(dev, "saving %d bytes of video state\n",
-			    nbytes);
-		if (vidd_save_state(sc->adp, sc->state_buf, nbytes) != 0) {
-			device_printf(dev, "failed to save state (nbytes=%d)\n",
-			    nbytes);
-			free(sc->state_buf, M_TEMP);
-			sc->state_buf = NULL;
-		}
+	if (sc->state_buf == NULL)
+		goto save_palette;
+	if (bootverbose)
+		device_printf(dev, "saving %d bytes of video state\n", nbytes);
+	if (vidd_save_state(sc->adp, sc->state_buf, nbytes) != 0) {
+		device_printf(dev, "failed to save state (nbytes=%d)\n",
+		    nbytes);
+		free(sc->state_buf, M_TEMP);
+		sc->state_buf = NULL;
 	}
 
+save_palette:
 	/* Save the color palette across the suspend. */
 	if (sc->pal_buf != NULL)
-		free(sc->pal_buf, M_TEMP);
+		return (0);
 	sc->pal_buf = malloc(256 * 3, M_TEMP, M_NOWAIT);
 	if (sc->pal_buf != NULL) {
 		if (bootverbose)
@@ -215,6 +214,7 @@ isavga_resume(device_t dev)
 	vga_softc_t *sc;
 
 	sc = device_get_softc(dev);
+
 	if (sc->state_buf != NULL) {
 		if (vidd_load_state(sc->adp, sc->state_buf) != 0)
 			device_printf(dev, "failed to reload state\n");
@@ -228,8 +228,7 @@ isavga_resume(device_t dev)
 		sc->pal_buf = NULL;
 	}
 
-	bus_generic_resume(dev);
-	return 0;
+	return (bus_generic_resume(dev));
 }
 
 #ifdef FB_INSTALL_CDEV
From yongari at FreeBSD.org  Fri Nov  6 01:12:01 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Fri Nov  6 01:12:12 2009
Subject: svn commit: r198967 - head/sys/dev/bge
Message-ID: <200911060112.nA61C067097045@svn.freebsd.org>

Author: yongari
Date: Fri Nov  6 01:11:59 2009
New Revision: 198967
URL: http://svn.freebsd.org/changeset/base/198967

Log:
  Correct MSI mode register bits.

Modified:
  head/sys/dev/bge/if_bgereg.h

Modified: head/sys/dev/bge/if_bgereg.h
==============================================================================
--- head/sys/dev/bge/if_bgereg.h	Fri Nov  6 00:03:48 2009	(r198966)
+++ head/sys/dev/bge/if_bgereg.h	Fri Nov  6 01:11:59 2009	(r198967)
@@ -1705,11 +1705,8 @@
 /* MSI mode register */
 #define	BGE_MSIMODE_RESET		0x00000001
 #define	BGE_MSIMODE_ENABLE		0x00000002
-#define	BGE_MSIMODE_PCI_TGT_ABRT_ATTN	0x00000004
-#define	BGE_MSIMODE_PCI_MSTR_ABRT_ATTN	0x00000008
-#define	BGE_MSIMODE_PCI_PERR_ATTN	0x00000010
-#define	BGE_MSIMODE_MSI_FIFOUFLOW_ATTN	0x00000020
-#define	BGE_MSIMODE_MSI_FIFOOFLOW_ATTN	0x00000040
+#define	BGE_MSIMODE_ONE_SHOT_DISABLE	0x00000020
+#define	BGE_MSIMODE_MULTIVEC_ENABLE	0x00000080
 
 /* MSI status register */
 #define	BGE_MSISTAT_PCI_TGT_ABRT_ATTN	0x00000004
From marcel at FreeBSD.org  Fri Nov  6 06:09:06 2009
From: marcel at FreeBSD.org (Marcel Moolenaar)
Date: Fri Nov  6 06:09:15 2009
Subject: svn commit: r198968 - head/sys/powerpc/powerpc
Message-ID: <200911060609.nA6695t4004666@svn.freebsd.org>

Author: marcel
Date: Fri Nov  6 06:09:04 2009
New Revision: 198968
URL: http://svn.freebsd.org/changeset/base/198968

Log:
  Unbreak E500 builds. The inline assembly for the 970 CPUs
  is invalid when compiling for BookE.

Modified:
  head/sys/powerpc/powerpc/cpu.c

Modified: head/sys/powerpc/powerpc/cpu.c
==============================================================================
--- head/sys/powerpc/powerpc/cpu.c	Fri Nov  6 01:11:59 2009	(r198967)
+++ head/sys/powerpc/powerpc/cpu.c	Fri Nov  6 06:09:04 2009	(r198968)
@@ -118,7 +118,9 @@ static void	cpu_print_speed(void);
 static void	cpu_6xx_setup(int cpuid, uint16_t vers);
 static void	cpu_6xx_print_cacheinfo(u_int, uint16_t);
 static void	cpu_e500_setup(int cpuid, uint16_t vers);
+#ifndef E500
 static void	cpu_970_setup(int cpuid, uint16_t vers);
+#endif
 
 void
 cpu_setup(u_int cpuid)
@@ -195,12 +197,14 @@ cpu_setup(u_int cpuid)
 			cpu_6xx_setup(cpuid, vers);
 			break;
 
+#ifndef E500
 		case IBM970:
 		case IBM970FX:
 		case IBM970GX:
 		case IBM970MP:
 			cpu_970_setup(cpuid, vers);
 			break;
+#endif
 
 		case FSL_E500v1:
 		case FSL_E500v2:
@@ -429,6 +433,7 @@ cpu_e500_setup(int cpuid, uint16_t vers)
 	printf("cpu%d: HID0 %b", cpuid, (int)hid0, HID0_E500_BITMASK);
 }
 
+#ifndef E500
 static void
 cpu_970_setup(int cpuid, uint16_t vers)
 {
@@ -458,4 +463,4 @@ cpu_970_setup(int cpuid, uint16_t vers)
 	    : "=r" (hid0_hi) : "K" (SPR_HID0));
 	printf("cpu%d: HID0 %b", cpuid, (int)(hid0_hi), HID0_970_BITMASK);
 }
-
+#endif
From ed at FreeBSD.org  Fri Nov  6 07:17:32 2009
From: ed at FreeBSD.org (Ed Schouten)
Date: Fri Nov  6 07:17:43 2009
Subject: svn commit: r198973 - in head: lib/libc/sys sys/sys
Message-ID: <200911060717.nA67HVou006550@svn.freebsd.org>

Author: ed
Date: Fri Nov  6 07:17:31 2009
New Revision: 198973
URL: http://svn.freebsd.org/changeset/base/198973

Log:
  Add MAP_ANONYMOUS.
  
  Many operating systems also provide MAP_ANONYMOUS. It's not hard to
  support this ourselves, we'd better add it to make it more likely for
  applications to work out of the box.
  
  Reviewed by:	alc (mman.h)

Modified:
  head/lib/libc/sys/mmap.2
  head/sys/sys/mman.h

Modified: head/lib/libc/sys/mmap.2
==============================================================================
--- head/lib/libc/sys/mmap.2	Fri Nov  6 07:02:16 2009	(r198972)
+++ head/lib/libc/sys/mmap.2	Fri Nov  6 07:17:31 2009	(r198973)
@@ -28,7 +28,7 @@
 .\"	@(#)mmap.2	8.4 (Berkeley) 5/11/95
 .\" $FreeBSD$
 .\"
-.Dd July 26, 2009
+.Dd November 6, 2009
 .Dt MMAP 2
 .Os
 .Sh NAME
@@ -108,6 +108,10 @@ The
 argument is ignored.
 .\".It Dv MAP_FILE
 .\"Mapped from a regular file or character-special device memory.
+.It Dv MAP_ANONYMOUS
+This flag is identical to
+.Dv MAP_ANON
+and is provided for compatibility.
 .It Dv MAP_FIXED
 Do not permit the system to select a different address than the one
 specified.

Modified: head/sys/sys/mman.h
==============================================================================
--- head/sys/sys/mman.h	Fri Nov  6 07:02:16 2009	(r198972)
+++ head/sys/sys/mman.h	Fri Nov  6 07:17:31 2009	(r198973)
@@ -82,6 +82,9 @@
  */
 #define	MAP_FILE	 0x0000	/* map from file (default) */
 #define	MAP_ANON	 0x1000	/* allocated from memory, swap space */
+#ifndef _KERNEL
+#define	MAP_ANONYMOUS	 MAP_ANON /* For compatibility. */
+#endif /* !_KERNEL */
 
 /*
  * Extended flags
From ume at FreeBSD.org  Fri Nov  6 10:07:39 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Fri Nov  6 10:07:51 2009
Subject: svn commit: r198976 - head/sys/netinet6
Message-ID: <200911061007.nA6A7cLg012625@svn.freebsd.org>

Author: ume
Date: Fri Nov  6 10:07:38 2009
New Revision: 198976
URL: http://svn.freebsd.org/changeset/base/198976

Log:
  Don't call LLE_FREE() after nd6_free().
  
  MFC after:	3 days

Modified:
  head/sys/netinet6/nd6.c

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c	Fri Nov  6 09:39:35 2009	(r198975)
+++ head/sys/netinet6/nd6.c	Fri Nov  6 10:07:38 2009	(r198976)
@@ -513,6 +513,7 @@ nd6_llinfo_timer(void *arg)
 
 	if (ln->la_flags & LLE_DELETED) {
 		(void)nd6_free(ln, 0);
+		ln = NULL;
 		goto done;
 	}
 
From mav at FreeBSD.org  Fri Nov  6 11:17:34 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Fri Nov  6 11:17:45 2009
Subject: svn commit: r198983 - head/share/man/man4
Message-ID: <200911061117.nA6BHY9M014921@svn.freebsd.org>

Author: mav
Date: Fri Nov  6 11:17:33 2009
New Revision: 198983
URL: http://svn.freebsd.org/changeset/base/198983

Log:
  Document support for more chips.

Modified:
  head/share/man/man4/ata.4

Modified: head/share/man/man4/ata.4
==============================================================================
--- head/share/man/man4/ata.4	Fri Nov  6 10:56:43 2009	(r198982)
+++ head/share/man/man4/ata.4	Fri Nov  6 11:17:33 2009	(r198983)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 24, 2009
+.Dd November 6, 2009
 .Dt ATA 4
 .Os
 .Sh NAME
@@ -129,7 +129,7 @@ M5229, M5281, M5287, M5288, M5289.
 .It AMD:
 AMD756, AMD766, AMD768, AMD8111, CS5536.
 .It ATI:
-IXP200, IXP300, IXP400.
+IXP200, IXP300, IXP400, IXP600, IXP700, IXP800.
 .It CMD:
 CMD646, CMD646U2, CMD648, CMD649.
 .It Cypress:
@@ -145,13 +145,15 @@ IT8211F, IT8212F, IT8213F.
 .It JMicron:
 JMB360, JMB361, JMB363, JMB365, JMB366, JMB368.
 .It Marvell
-88SX5040, 88SX5041, 88SX5080, 88SX5081, 88SX6041, 88SX6081, 88SX6101, 88SX6141.
+88SX5040, 88SX5041, 88SX5080, 88SX5081, 88SX6041, 88SX6042, 88SX6081, 88SX6101,
+88SX6141, 88SX7042.
 .It National:
 SC1100.
 .It NetCell:
 NC3000, NC5000.
 .It nVidia:
-nForce, nForce2, nForce2 MCP, nForce3, nForce3 MCP, nForce3 Pro, nForce4.
+nForce, nForce2, nForce2 MCP, nForce3, nForce3 MCP, nForce3 Pro, nForce4,
+MCP51, MCP55, MCP61, MCP65, MCP67, MCP73, MCP77, MCP79, MCP89.
 .It Promise:
 PDC20246, PDC20262, PDC20263, PDC20265, PDC20267, PDC20268, PDC20269, PDC20270, PDC20271, PDC20275, PDC20276, PDC20277, PDC20318, PDC20319, PDC20371, PDC20375, PDC20376, PDC20377, PDC20378, PDC20379, PDC20571, PDC20575, PDC20579, PDC20580, PDC20617, PDC20618, PDC20619, PDC20620, PDC20621, PDC20622, PDC40518, PDC40519, PDC40718, PDC40719.
 .It ServerWorks:
From jhb at FreeBSD.org  Fri Nov  6 13:10:13 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri Nov  6 13:10:22 2009
Subject: svn commit: r198986 - head/lib/libkvm
Message-ID: <200911061310.nA6DACnm017666@svn.freebsd.org>

Author: jhb
Date: Fri Nov  6 13:10:12 2009
New Revision: 198986
URL: http://svn.freebsd.org/changeset/base/198986

Log:
  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.
  
  Submitted by:	Dorr H. Clark  dclark of engr.scu.edu
  MFC after:	1 week

Modified:
  head/lib/libkvm/kvm_i386.c

Modified: head/lib/libkvm/kvm_i386.c
==============================================================================
--- head/lib/libkvm/kvm_i386.c	Fri Nov  6 12:52:51 2009	(r198985)
+++ head/lib/libkvm/kvm_i386.c	Fri Nov  6 13:10:12 2009	(r198986)
@@ -295,9 +295,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;
@@ -391,9 +391,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 jhb at FreeBSD.org  Fri Nov  6 14:52:38 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri Nov  6 14:52:50 2009
Subject: svn commit: r198987 - in head/sys/dev: an ixgb vge
Message-ID: <200911061452.nA6Eqbxm020072@svn.freebsd.org>

Author: jhb
Date: Fri Nov  6 14:52:37 2009
New Revision: 198987
URL: http://svn.freebsd.org/changeset/base/198987

Log:
  Use device_printf() and if_printf() instead of printf() with an explicit
  unit number and remove 'unit' members from softc.

Modified:
  head/sys/dev/an/if_an.c
  head/sys/dev/an/if_anreg.h
  head/sys/dev/ixgb/if_ixgb.c
  head/sys/dev/ixgb/if_ixgb.h
  head/sys/dev/vge/if_vge.c
  head/sys/dev/vge/if_vgevar.h

Modified: head/sys/dev/an/if_an.c
==============================================================================
--- head/sys/dev/an/if_an.c	Fri Nov  6 13:10:12 2009	(r198986)
+++ head/sys/dev/an/if_an.c	Fri Nov  6 14:52:37 2009	(r198987)
@@ -349,7 +349,6 @@ an_probe(device_t dev)
 	 */
 	sc->an_bhandle = rman_get_bushandle(sc->port_res);
 	sc->an_btag = rman_get_bustag(sc->port_res);
-	sc->an_unit = device_get_unit(dev);
 
 	ssid.an_len = sizeof(ssid);
 	ssid.an_type = AN_RID_SSIDLIST;
@@ -600,8 +599,7 @@ an_init_mpi350_desc(struct an_softc *sc)
 	cmd_struct.an_parm1 = AN_RX_DESC_OFFSET;
 	cmd_struct.an_parm2 = AN_MAX_RX_DESC;
 	if (an_cmd_struct(sc, &cmd_struct, &reply)) {
-		printf("an%d: failed to allocate RX descriptor\n",
-		       sc->an_unit);
+		if_printf(sc->an_ifp, "failed to allocate RX descriptor\n");
 		return(EIO);
 	}
 
@@ -629,8 +627,7 @@ an_init_mpi350_desc(struct an_softc *sc)
 	cmd_struct.an_parm1 = AN_TX_DESC_OFFSET;
 	cmd_struct.an_parm2 = AN_MAX_TX_DESC;
 	if (an_cmd_struct(sc, &cmd_struct, &reply)) {
-		printf("an%d: failed to allocate TX descriptor\n",
-		       sc->an_unit);
+		if_printf(sc->an_ifp, "failed to allocate TX descriptor\n");
 		return(EIO);
 	}
 
@@ -659,8 +656,7 @@ an_init_mpi350_desc(struct an_softc *sc)
 	cmd_struct.an_parm1 = AN_HOST_DESC_OFFSET;
 	cmd_struct.an_parm2 = 1;
 	if (an_cmd_struct(sc, &cmd_struct, &reply)) {
-		printf("an%d: failed to allocate host descriptor\n",
-		       sc->an_unit);
+		if_printf(sc->an_ifp, "failed to allocate host descriptor\n");
 		return(EIO);
 	}
 
@@ -687,7 +683,7 @@ an_attach(struct an_softc *sc, int unit,
 
 	ifp = sc->an_ifp = if_alloc(IFT_ETHER);
 	if (ifp == NULL) {
-		printf("an%d: can not if_alloc()\n", sc->an_unit);
+		device_printf(sc->an_dev, "can not if_alloc()\n");
 		goto fail;
 	}
 
@@ -708,7 +704,7 @@ an_attach(struct an_softc *sc, int unit,
 
 	/* Load factory config */
 	if (an_cmd(sc, AN_CMD_READCFG, 0)) {
-		printf("an%d: failed to load config data\n", sc->an_unit);
+		device_printf(sc->an_dev, "failed to load config data\n");
 		goto fail;
 	}
 
@@ -716,7 +712,7 @@ an_attach(struct an_softc *sc, int unit,
 	sc->an_config.an_type = AN_RID_GENCONFIG;
 	sc->an_config.an_len = sizeof(struct an_ltv_genconfig);
 	if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_config)) {
-		printf("an%d: read record failed\n", sc->an_unit);
+		device_printf(sc->an_dev, "read record failed\n");
 		goto fail;
 	}
 
@@ -724,7 +720,7 @@ an_attach(struct an_softc *sc, int unit,
 	sc->an_caps.an_type = AN_RID_CAPABILITIES;
 	sc->an_caps.an_len = sizeof(struct an_ltv_caps);
 	if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_caps)) {
-		printf("an%d: read record failed\n", sc->an_unit);
+		device_printf(sc->an_dev, "read record failed\n");
 		goto fail;
 	}
 
@@ -732,7 +728,7 @@ an_attach(struct an_softc *sc, int unit,
 	sc->an_ssidlist.an_type = AN_RID_SSIDLIST;
 	sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist_new);
 	if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_ssidlist)) {
-		printf("an%d: read record failed\n", sc->an_unit);
+		device_printf(sc->an_dev, "read record failed\n");
 		goto fail;
 	}
 
@@ -740,7 +736,7 @@ an_attach(struct an_softc *sc, int unit,
 	sc->an_aplist.an_type = AN_RID_APLIST;
 	sc->an_aplist.an_len = sizeof(struct an_ltv_aplist);
 	if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_aplist)) {
-		printf("an%d: read record failed\n", sc->an_unit);
+		device_printf(sc->an_dev, "read record failed\n");
 		goto fail;
 	}
 
@@ -751,19 +747,19 @@ an_attach(struct an_softc *sc, int unit,
 		sc->an_rssimap.an_type = AN_RID_RSSI_MAP;
 		sc->an_rssimap.an_len = sizeof(struct an_ltv_rssi_map);
 		if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_rssimap)) {
-			printf("an%d: unable to get RSSI <-> dBM map\n", sc->an_unit);
+			device_printf(sc->an_dev,
+			    "unable to get RSSI <-> dBM map\n");
 		} else {
-			printf("an%d: got RSSI <-> dBM map\n", sc->an_unit);
+			device_printf(sc->an_dev, "got RSSI <-> dBM map\n");
 			sc->an_have_rssimap = 1;
 		}
 	} else {
-		printf("an%d: no RSSI <-> dBM map\n", sc->an_unit);
+		device_printf(sc->an_dev, "no RSSI <-> dBM map\n");
 	}
 #endif
 	AN_UNLOCK(sc);
 
 	ifp->if_softc = sc;
-	sc->an_unit = unit;
 	if_initname(ifp, device_get_name(sc->an_dev),
 	    device_get_unit(sc->an_dev));
 	ifp->if_mtu = ETHERMTU;
@@ -907,9 +903,9 @@ an_rxeof(struct an_softc *sc)
 					+ sizeof(rx_frame);
 				/* Check for insane frame length */
 				if (len > sizeof(sc->buf_802_11)) {
-					printf("an%d: oversized packet "
+					if_printf(ifp, "oversized packet "
 					       "received (%d, %d)\n",
-					       sc->an_unit, len, MCLBYTES);
+					       len, MCLBYTES);
 					ifp->if_ierrors++;
 					return;
 				}
@@ -933,9 +929,9 @@ an_rxeof(struct an_softc *sc)
 					+ ieee80211_header_len;
 				/* Check for insane frame length */
 				if (len > sizeof(sc->buf_802_11)) {
-					printf("an%d: oversized packet "
+					if_printf(ifp, "oversized packet "
 					       "received (%d, %d)\n",
-					       sc->an_unit, len, MCLBYTES);
+					       len, MCLBYTES);
 					ifp->if_ierrors++;
 					return;
 				}
@@ -993,9 +989,9 @@ an_rxeof(struct an_softc *sc)
 			len = rx_frame_802_3.an_rx_802_3_payload_len;
 			if (len > sizeof(sc->buf_802_11)) {
 				m_freem(m);
-				printf("an%d: oversized packet "
+				if_printf(ifp, "oversized packet "
 				       "received (%d, %d)\n",
-				       sc->an_unit, len, MCLBYTES);
+				       len, MCLBYTES);
 				ifp->if_ierrors++;
 				return;
 			}
@@ -1073,9 +1069,9 @@ an_rxeof(struct an_softc *sc)
 				len = an_rx_desc.an_len + 12;
 				if (len > MCLBYTES) {
 					m_freem(m);
-					printf("an%d: oversized packet "
+					if_printf(ifp, "oversized packet "
 					       "received (%d, %d)\n",
-					       sc->an_unit, len, MCLBYTES);
+					       len, MCLBYTES);
 					ifp->if_ierrors++;
 					return;
 				}
@@ -1116,9 +1112,8 @@ an_rxeof(struct an_softc *sc)
 					    ((u_int32_t *)(void *)&an_rx_desc)[i]);
 
 			} else {
-				printf("an%d: Didn't get valid RX packet "
+				if_printf(ifp, "Didn't get valid RX packet "
 				       "%x %x %d\n",
-				       sc->an_unit,
 				       an_rx_desc.an_done,
 				       an_rx_desc.an_valid, an_rx_desc.an_len);
 			}
@@ -1393,7 +1388,7 @@ an_reset(struct an_softc *sc)
 	an_cmd(sc, AN_CMD_NOOP2, 0);
 
 	if (an_cmd(sc, AN_CMD_FORCE_SYNCLOSS, 0) == ETIMEDOUT)
-		printf("an%d: reset failed\n", sc->an_unit);
+		if_printf(sc->an_ifp, "reset failed\n");
 
 	an_cmd(sc, AN_CMD_DISABLE, 0);
 
@@ -1410,6 +1405,7 @@ an_read_record(struct an_softc *sc, stru
 	struct an_card_rid_desc an_rid_desc;
 	struct an_command	cmd;
 	struct an_reply		reply;
+	struct ifnet		*ifp;
 	u_int16_t		*ptr;
 	u_int8_t		*ptr2;
 	int			i, len;
@@ -1418,16 +1414,17 @@ an_read_record(struct an_softc *sc, stru
 	if (ltv->an_len < 4 || ltv->an_type == 0)
 		return(EINVAL);
 
+	ifp = sc->an_ifp;
 	if (!sc->mpi350){
 		/* Tell the NIC to enter record read mode. */
 		if (an_cmd(sc, AN_CMD_ACCESS|AN_ACCESS_READ, ltv->an_type)) {
-			printf("an%d: RID access failed\n", sc->an_unit);
+			if_printf(ifp, "RID access failed\n");
 			return(EIO);
 		}
 
 		/* Seek to the record. */
 		if (an_seek(sc, ltv->an_type, 0, AN_BAP1)) {
-			printf("an%d: seek to record failed\n", sc->an_unit);
+			if_printf(ifp, "seek to record failed\n");
 			return(EIO);
 		}
 
@@ -1439,8 +1436,8 @@ an_read_record(struct an_softc *sc, stru
 		 */
 		len = CSR_READ_2(sc, AN_DATA1);
 		if (len > (ltv->an_len - 2)) {
-			printf("an%d: record length mismatch -- expected %d, "
-			       "got %d for Rid %x\n", sc->an_unit,
+			if_printf(ifp, "record length mismatch -- expected %d, "
+			       "got %d for Rid %x\n",
 			       ltv->an_len - 2, len, ltv->an_type);
 			len = ltv->an_len - 2;
 		} else {
@@ -1476,8 +1473,8 @@ an_read_record(struct an_softc *sc, stru
 
 		if (an_cmd_struct(sc, &cmd, &reply)
 		    || reply.an_status & AN_CMD_QUAL_MASK) {
-			printf("an%d: failed to read RID %x %x %x %x %x, %d\n",
-			       sc->an_unit, ltv->an_type,
+			if_printf(ifp, "failed to read RID %x %x %x %x %x, %d\n",
+			       ltv->an_type,
 			       reply.an_status,
 			       reply.an_resp0,
 			       reply.an_resp1,
@@ -1493,8 +1490,8 @@ an_read_record(struct an_softc *sc, stru
 
 		len = an_rid_desc.an_len;
 		if (len > (ltv->an_len - 2)) {
-			printf("an%d: record length mismatch -- expected %d, "
-			       "got %d for Rid %x\n", sc->an_unit,
+			if_printf(ifp, "record length mismatch -- expected %d, "
+			       "got %d for Rid %x\n",
 			       ltv->an_len - 2, len, ltv->an_type);
 			len = ltv->an_len - 2;
 		} else {
@@ -1586,8 +1583,9 @@ an_write_record(struct an_softc *sc, str
 		DELAY(100000);
 
 		if ((i = an_cmd_struct(sc, &cmd, &reply))) {
-			printf("an%d: failed to write RID 1 %x %x %x %x %x, %d\n",
-			    sc->an_unit, ltv->an_type,
+			if_printf(sc->an_ifp,
+			    "failed to write RID 1 %x %x %x %x %x, %d\n",
+			    ltv->an_type,
 			    reply.an_status,
 			    reply.an_resp0,
 			    reply.an_resp1,
@@ -1598,8 +1596,9 @@ an_write_record(struct an_softc *sc, str
 
 
 		if (reply.an_status & AN_CMD_QUAL_MASK) {
-			printf("an%d: failed to write RID 2 %x %x %x %x %x, %d\n",
-			    sc->an_unit, ltv->an_type,
+			if_printf(sc->an_ifp,
+			    "failed to write RID 2 %x %x %x %x %x, %d\n",
+			    ltv->an_type,
 			    reply.an_status,
 			    reply.an_resp0,
 			    reply.an_resp1,
@@ -1623,11 +1622,11 @@ an_dump_record(struct an_softc *sc, stru
 	char			buf[17], temp;
 
 	len = ltv->an_len - 4;
-	printf("an%d: RID %4x, Length %4d, Mode %s\n",
-		sc->an_unit, ltv->an_type, ltv->an_len - 4, string);
+	if_printf(sc->an_ifp, "RID %4x, Length %4d, Mode %s\n",
+		ltv->an_type, ltv->an_len - 4, string);
 
 	if (an_dump == 1 || (an_dump == ltv->an_type)) {
-		printf("an%d:\t", sc->an_unit);
+		if_printf(sc->an_ifp, "\t");
 		bzero(buf,sizeof(buf));
 
 		ptr2 = (u_int8_t *)<v->an_val;
@@ -1642,7 +1641,7 @@ an_dump_record(struct an_softc *sc, stru
 			if (++count == 16) {
 				count = 0;
 				printf("%s\n",buf);
-				printf("an%d:\t", sc->an_unit);
+				if_printf(sc->an_ifp, "\t");
 				bzero(buf,sizeof(buf));
 			}
 		}
@@ -1669,7 +1668,7 @@ an_seek(struct an_softc *sc, int id, int
 		offreg = AN_OFF1;
 		break;
 	default:
-		printf("an%d: invalid data path: %x\n", sc->an_unit, chan);
+		if_printf(sc->an_ifp, "invalid data path: %x\n", chan);
 		return(EIO);
 	}
 
@@ -1743,8 +1742,8 @@ an_alloc_nicmem(struct an_softc *sc, int
 	int			i;
 
 	if (an_cmd(sc, AN_CMD_ALLOC_MEM, len)) {
-		printf("an%d: failed to allocate %d bytes on NIC\n",
-		    sc->an_unit, len);
+		if_printf(sc->an_ifp, "failed to allocate %d bytes on NIC\n",
+		    len);
 		return(ENOMEM);
 	}
 
@@ -1863,7 +1862,7 @@ an_setdef(struct an_softc *sc, struct an
 		}
 		break;
 	default:
-		printf("an%d: unknown RID: %x\n", sc->an_unit, areq->an_type);
+		if_printf(ifp, "unknown RID: %x\n", areq->an_type);
 		return;
 	}
 
@@ -2653,8 +2652,7 @@ an_init(void *xsc)
 		if (sc->mpi350)
 			an_init_mpi350_desc(sc);
 		if (an_init_tx_ring(sc)) {
-			printf("an%d: tx buffer allocation "
-			    "failed\n", sc->an_unit);
+			if_printf(ifp, "tx buffer allocation failed\n");
 			AN_UNLOCK(sc);
 			return;
 		}
@@ -2695,7 +2693,7 @@ an_init(void *xsc)
 	sc->an_ssidlist.an_type = AN_RID_SSIDLIST;
 	sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist_new);
 	if (an_write_record(sc, (struct an_ltv_gen *)&sc->an_ssidlist)) {
-		printf("an%d: failed to set ssid list\n", sc->an_unit);
+		if_printf(ifp, "failed to set ssid list\n");
 		AN_UNLOCK(sc);
 		return;
 	}
@@ -2704,7 +2702,7 @@ an_init(void *xsc)
 	sc->an_aplist.an_type = AN_RID_APLIST;
 	sc->an_aplist.an_len = sizeof(struct an_ltv_aplist);
 	if (an_write_record(sc, (struct an_ltv_gen *)&sc->an_aplist)) {
-		printf("an%d: failed to set AP list\n", sc->an_unit);
+		if_printf(ifp, "failed to set AP list\n");
 		AN_UNLOCK(sc);
 		return;
 	}
@@ -2713,14 +2711,14 @@ an_init(void *xsc)
 	sc->an_config.an_len = sizeof(struct an_ltv_genconfig);
 	sc->an_config.an_type = AN_RID_GENCONFIG;
 	if (an_write_record(sc, (struct an_ltv_gen *)&sc->an_config)) {
-		printf("an%d: failed to set configuration\n", sc->an_unit);
+		if_printf(ifp, "failed to set configuration\n");
 		AN_UNLOCK(sc);
 		return;
 	}
 
 	/* Enable the MAC */
 	if (an_cmd(sc, AN_CMD_ENABLE, 0)) {
-		printf("an%d: failed to enable MAC\n", sc->an_unit);
+		if_printf(ifp, "failed to enable MAC\n");
 		AN_UNLOCK(sc);
 		return;
 	}
@@ -2827,7 +2825,7 @@ an_start(struct ifnet *ifp)
 
 			sc->an_rdata.an_tx_ring[idx] = id;
 			if (an_cmd(sc, AN_CMD_TX, id))
-				printf("an%d: xmit failed\n", sc->an_unit);
+				if_printf(ifp, "xmit failed\n");
 
 			AN_INC(idx, AN_TX_RING_CNT);
 
@@ -2976,7 +2974,7 @@ an_watchdog(struct ifnet *ifp)
 		return;
 	}
 
-	printf("an%d: device timeout\n", sc->an_unit);
+	if_printf(ifp, "device timeout\n");
 
 	an_reset(sc);
 	if (sc->mpi350)
@@ -3127,7 +3125,7 @@ an_cache_store(struct an_softc *sc, stru
 	}
 
 #ifdef SIGDEBUG
-	printf("an: q value %x (MSB=0x%x, LSB=0x%x) \n",
+	if_printf(sc->an_ifp, "q value %x (MSB=0x%x, LSB=0x%x) \n",
 		rx_rssi & 0xffff, rx_rssi >> 8, rx_rssi & 0xff);
 #endif
 
@@ -3567,8 +3565,7 @@ cmdreset(struct ifnet *ifp)
 	an_cmd(sc, AN_CMD_DISABLE, 0);
 
 	if (!(status = WaitBusy(ifp, AN_TIMEOUT))) {
-		printf("an%d: Waitbusy hang b4 RESET =%d\n",
-		       sc->an_unit, status);
+		if_printf(ifp, "Waitbusy hang b4 RESET =%d\n", status);
 		AN_UNLOCK(sc);
 		return -EBUSY;
 	}
@@ -3578,8 +3575,7 @@ cmdreset(struct ifnet *ifp)
 
 
 	if (!(status = WaitBusy(ifp, 100))) {
-		printf("an%d: Waitbusy hang AFTER RESET =%d\n",
-		       sc->an_unit, status);
+		if_printf(ifp, "Waitbusy hang AFTER RESET =%d\n", status);
 		AN_UNLOCK(sc);
 		return -EBUSY;
 	}
@@ -3687,8 +3683,7 @@ flashpchar(struct ifnet *ifp, int byte, 
 	/* timeout for busy clear wait */
 
 	if (waittime <= 0) {
-		printf("an%d: flash putchar busywait timeout! \n",
-		       sc->an_unit);
+		if_printf(ifp, "flash putchar busywait timeout!\n");
 		return -1;
 	}
 	/*
@@ -3774,8 +3769,7 @@ flashcard(struct ifnet *ifp, struct airo
 
 	sc = ifp->if_softc;
 	if (sc->mpi350) {
-		printf("an%d: flashing not supported on MPI 350 yet\n",
-		       sc->an_unit);
+		if_printf(ifp, "flashing not supported on MPI 350 yet\n");
 		return(-1);
 	}
 	status = l_ioctl->command;
@@ -3820,7 +3814,7 @@ flashcard(struct ifnet *ifp, struct airo
 		break;
 	case AIROFLPUTBUF:	/* Send 32k to card */
 		if (l_ioctl->len > FLASH_SIZE) {
-			printf("an%d: Buffer to big, %x %x\n", sc->an_unit,
+			if_printf(ifp, "Buffer to big, %x %x\n",
 			       l_ioctl->len, FLASH_SIZE);
 			return -EINVAL;
 		}
@@ -3837,8 +3831,7 @@ flashcard(struct ifnet *ifp, struct airo
 		break;
 	case AIRORESTART:
 		if ((status = flashrestart(ifp)) != 0) {
-			printf("an%d: FLASHRESTART returned %d\n",
-			       sc->an_unit, status);
+			if_printf(ifp, "FLASHRESTART returned %d\n", status);
 			return -EIO;
 		} else
 			return 0;

Modified: head/sys/dev/an/if_anreg.h
==============================================================================
--- head/sys/dev/an/if_anreg.h	Fri Nov  6 13:10:12 2009	(r198986)
+++ head/sys/dev/an/if_anreg.h	Fri Nov  6 14:52:37 2009	(r198987)
@@ -442,8 +442,6 @@ struct an_tx_ring_data {
 struct an_softc	{
 	struct ifnet		*an_ifp;
 
-        int                     an_unit;
-
 	int	port_rid;	/* resource id for port range */
 	struct resource* port_res; /* resource for port range */
 	int     mem_rid;	/* resource id for memory range */

Modified: head/sys/dev/ixgb/if_ixgb.c
==============================================================================
--- head/sys/dev/ixgb/if_ixgb.c	Fri Nov  6 13:10:12 2009	(r198986)
+++ head/sys/dev/ixgb/if_ixgb.c	Fri Nov  6 14:52:37 2009	(r198987)
@@ -249,18 +249,17 @@ ixgb_attach(device_t dev)
 	int             tsize, rsize;
 	int             error = 0;
 
-	printf("ixgb%d: %s\n", device_get_unit(dev), ixgb_copyright);
+	device_printf(dev, "%s\n", ixgb_copyright);
 	INIT_DEBUGOUT("ixgb_attach: begin");
 
 	/* Allocate, clear, and link in our adapter structure */
 	if (!(adapter = device_get_softc(dev))) {
-		printf("ixgb: adapter structure allocation failed\n");
+		device_printf(dev, "adapter structure allocation failed\n");
 		return (ENOMEM);
 	}
 	bzero(adapter, sizeof(struct adapter));
 	adapter->dev = dev;
 	adapter->osdep.dev = dev;
-	adapter->unit = device_get_unit(dev);
 	IXGB_LOCK_INIT(adapter, device_get_nameunit(dev));
 
 	if (ixgb_adapter_list != NULL)
@@ -299,8 +298,7 @@ ixgb_attach(device_t dev)
 		ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN;
 
 	if (ixgb_allocate_pci_resources(adapter)) {
-		printf("ixgb%d: Allocation of PCI resources failed\n",
-		       adapter->unit);
+		device_printf(dev, "Allocation of PCI resources failed\n");
 		error = ENXIO;
 		goto err_pci;
 	}
@@ -309,8 +307,7 @@ ixgb_attach(device_t dev)
 
 	/* Allocate Transmit Descriptor ring */
 	if (ixgb_dma_malloc(adapter, tsize, &adapter->txdma, BUS_DMA_NOWAIT)) {
-		printf("ixgb%d: Unable to allocate TxDescriptor memory\n",
-		       adapter->unit);
+		device_printf(dev, "Unable to allocate TxDescriptor memory\n");
 		error = ENOMEM;
 		goto err_tx_desc;
 	}
@@ -321,8 +318,7 @@ ixgb_attach(device_t dev)
 
 	/* Allocate Receive Descriptor ring */
 	if (ixgb_dma_malloc(adapter, rsize, &adapter->rxdma, BUS_DMA_NOWAIT)) {
-		printf("ixgb%d: Unable to allocate rx_desc memory\n",
-		       adapter->unit);
+		device_printf(dev, "Unable to allocate rx_desc memory\n");
 		error = ENOMEM;
 		goto err_rx_desc;
 	}
@@ -330,8 +326,7 @@ ixgb_attach(device_t dev)
 
 	/* Initialize the hardware */
 	if (ixgb_hardware_init(adapter)) {
-		printf("ixgb%d: Unable to initialize the hardware\n",
-		       adapter->unit);
+		device_printf(dev, "Unable to initialize the hardware\n");
 		error = EIO;
 		goto err_hw_init;
 	}
@@ -628,7 +623,7 @@ ixgb_watchdog(struct ifnet * ifp)
 		ifp->if_timer = IXGB_TX_TIMEOUT;
 		return;
 	}
-	printf("ixgb%d: watchdog timeout -- resetting\n", adapter->unit);
+	if_printf(ifp, "watchdog timeout -- resetting\n");
 
 	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 
@@ -663,23 +658,22 @@ ixgb_init_locked(struct adapter *adapter
 	IXGB_LOCK_ASSERT(adapter);
 
 	ixgb_stop(adapter);
+	ifp = adapter->ifp;
 
 	/* Get the latest mac address, User can use a LAA */
-	bcopy(IF_LLADDR(adapter->ifp), adapter->hw.curr_mac_addr,
-	      IXGB_ETH_LENGTH_OF_ADDRESS);
+	bcopy(IF_LLADDR(ifp), adapter->hw.curr_mac_addr,
+	    IXGB_ETH_LENGTH_OF_ADDRESS);
 
 	/* Initialize the hardware */
 	if (ixgb_hardware_init(adapter)) {
-		printf("ixgb%d: Unable to initialize the hardware\n",
-		       adapter->unit);
+		if_printf(ifp, "Unable to initialize the hardware\n");
 		return;
 	}
 	ixgb_enable_vlans(adapter);
 
 	/* Prepare transmit descriptors and buffers */
 	if (ixgb_setup_transmit_structures(adapter)) {
-		printf("ixgb%d: Could not setup transmit structures\n",
-		       adapter->unit);
+		if_printf(ifp, "Could not setup transmit structures\n");
 		ixgb_stop(adapter);
 		return;
 	}
@@ -690,8 +684,7 @@ ixgb_init_locked(struct adapter *adapter
 
 	/* Prepare receive descriptors and buffers */
 	if (ixgb_setup_receive_structures(adapter)) {
-		printf("ixgb%d: Could not setup receive structures\n",
-		       adapter->unit);
+		if_printf(ifp, "Could not setup receive structures\n");
 		ixgb_stop(adapter);
 		return;
 	}
@@ -959,8 +952,8 @@ ixgb_encap(struct adapter * adapter, str
 					&nsegs, BUS_DMA_NOWAIT);
 	if (error != 0) {
 		adapter->no_tx_dma_setup++;
-		printf("ixgb%d: ixgb_encap: bus_dmamap_load_mbuf failed; "
-		       "error %u\n", adapter->unit, error);
+		if_printf(ifp, "ixgb_encap: bus_dmamap_load_mbuf failed; "
+		       "error %u\n", error);
 		bus_dmamap_destroy(adapter->txtag, map);
 		return (error);
 	}
@@ -1149,15 +1142,14 @@ ixgb_print_link_status(struct adapter * 
 {
 	if (adapter->hw.link_up) {
 		if (!adapter->link_active) {
-			printf("ixgb%d: Link is up %d Mbps %s \n",
-			       adapter->unit,
+			if_printf(adapter->ifp, "Link is up %d Mbps %s \n",
 			       10000,
 			       "Full Duplex");
 			adapter->link_active = 1;
 		}
 	} else {
 		if (adapter->link_active) {
-			printf("ixgb%d: Link is Down \n", adapter->unit);
+			if_printf(adapter->ifp, "Link is Down \n");
 			adapter->link_active = 0;
 		}
 	}
@@ -1213,8 +1205,8 @@ ixgb_identify_hardware(struct adapter * 
 	adapter->hw.pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2);
 	if (!((adapter->hw.pci_cmd_word & PCIM_CMD_BUSMASTEREN) &&
 	      (adapter->hw.pci_cmd_word & PCIM_CMD_MEMEN))) {
-		printf("ixgb%d: Memory Access and/or Bus Master bits were not set!\n",
-		       adapter->unit);
+		device_printf(dev,
+		    "Memory Access and/or Bus Master bits were not set!\n");
 		adapter->hw.pci_cmd_word |=
 			(PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN);
 		pci_write_config(dev, PCIR_COMMAND, adapter->hw.pci_cmd_word, 2);
@@ -1234,7 +1226,8 @@ ixgb_identify_hardware(struct adapter * 
 		break;
 	default:
 		INIT_DEBUGOUT1("Unknown device if 0x%x", adapter->hw.device_id);
-		printf("ixgb%d: unsupported device id 0x%x\n", adapter->unit, adapter->hw.device_id);
+		device_printf(dev, "unsupported device id 0x%x\n",
+		    adapter->hw.device_id);
 	}
 
 	return;
@@ -1251,8 +1244,7 @@ ixgb_allocate_pci_resources(struct adapt
 						 &rid, 0, ~0, 1,
 						 RF_ACTIVE);
 	if (!(adapter->res_memory)) {
-		printf("ixgb%d: Unable to allocate bus resource: memory\n",
-		       adapter->unit);
+		device_printf(dev, "Unable to allocate bus resource: memory\n");
 		return (ENXIO);
 	}
 	adapter->osdep.mem_bus_space_tag =
@@ -1266,16 +1258,15 @@ ixgb_allocate_pci_resources(struct adapt
 						    &rid, 0, ~0, 1,
 						  RF_SHAREABLE | RF_ACTIVE);
 	if (!(adapter->res_interrupt)) {
-		printf("ixgb%d: Unable to allocate bus resource: interrupt\n",
-		       adapter->unit);
+		device_printf(dev,
+		    "Unable to allocate bus resource: interrupt\n");
 		return (ENXIO);
 	}
 	if (bus_setup_intr(dev, adapter->res_interrupt,
 			   INTR_TYPE_NET | INTR_MPSAFE,
 			   NULL, (void (*) (void *))ixgb_intr, adapter,
 			   &adapter->int_handler_tag)) {
-		printf("ixgb%d: Error registering interrupt handler!\n",
-		       adapter->unit);
+		device_printf(dev, "Error registering interrupt handler!\n");
 		return (ENXIO);
 	}
 	adapter->hw.back = &adapter->osdep;
@@ -1322,13 +1313,12 @@ ixgb_hardware_init(struct adapter * adap
 
 	/* Make sure we have a good EEPROM before we read from it */
 	if (!ixgb_validate_eeprom_checksum(&adapter->hw)) {
-		printf("ixgb%d: The EEPROM Checksum Is Not Valid\n",
-		       adapter->unit);
+		device_printf(adapter->dev,
+		    "The EEPROM Checksum Is Not Valid\n");
 		return (EIO);
 	}
 	if (!ixgb_init_hw(&adapter->hw)) {
-		printf("ixgb%d: Hardware Initialization Failed",
-		       adapter->unit);
+		device_printf(adapter->dev, "Hardware Initialization Failed");
 		return (EIO);
 	}
 
@@ -1352,7 +1342,7 @@ ixgb_setup_interface(device_t dev, struc
 #if __FreeBSD_version >= 502000
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
 #else
-	ifp->if_unit = adapter->unit;
+	ifp->if_unit = device_get_unit(dev);
 	ifp->if_name = "ixgb";
 #endif
 	ifp->if_mtu = ETHERMTU;
@@ -1420,8 +1410,10 @@ static int
 ixgb_dma_malloc(struct adapter * adapter, bus_size_t size,
 		struct ixgb_dma_alloc * dma, int mapflags)
 {
+	device_t dev;
 	int             r;
 
+	dev = adapter->dev;
 	r = bus_dma_tag_create(NULL,	/* parent */
 			       PAGE_SIZE, 0,	/* alignment, bounds */
 			       BUS_SPACE_MAXADDR,	/* lowaddr */
@@ -1437,15 +1429,15 @@ ixgb_dma_malloc(struct adapter * adapter
 #endif
 			       &dma->dma_tag);
 	if (r != 0) {
-		printf("ixgb%d: ixgb_dma_malloc: bus_dma_tag_create failed; "
-		       "error %u\n", adapter->unit, r);
+		device_printf(dev, "ixgb_dma_malloc: bus_dma_tag_create failed; "
+		       "error %u\n", r);
 		goto fail_0;
 	}
 	r = bus_dmamem_alloc(dma->dma_tag, (void **)&dma->dma_vaddr,
 			     BUS_DMA_NOWAIT, &dma->dma_map);
 	if (r != 0) {
-		printf("ixgb%d: ixgb_dma_malloc: bus_dmamem_alloc failed; "
-		       "error %u\n", adapter->unit, r);
+		device_printf(dev, "ixgb_dma_malloc: bus_dmamem_alloc failed; "
+		       "error %u\n", r);
 		goto fail_1;
 	}
 	r = bus_dmamap_load(dma->dma_tag, dma->dma_map, dma->dma_vaddr,
@@ -1454,8 +1446,8 @@ ixgb_dma_malloc(struct adapter * adapter
 			    &dma->dma_paddr,
 			    mapflags | BUS_DMA_NOWAIT);
 	if (r != 0) {
-		printf("ixgb%d: ixgb_dma_malloc: bus_dmamap_load failed; "
-		       "error %u\n", adapter->unit, r);
+		device_printf(dev, "ixgb_dma_malloc: bus_dmamap_load failed; "
+		       "error %u\n", r);
 		goto fail_2;
 	}
 	dma->dma_size = size;
@@ -1493,8 +1485,8 @@ ixgb_allocate_transmit_structures(struct
 	      (struct ixgb_buffer *) malloc(sizeof(struct ixgb_buffer) *
 					    adapter->num_tx_desc, M_DEVBUF,
 					    M_NOWAIT | M_ZERO))) {
-		printf("ixgb%d: Unable to allocate tx_buffer memory\n",
-		       adapter->unit);
+		device_printf(adapter->dev,
+		    "Unable to allocate tx_buffer memory\n");
 		return ENOMEM;
 	}
 	bzero(adapter->tx_buffer_area,
@@ -1528,7 +1520,7 @@ ixgb_setup_transmit_structures(struct ad
 			       NULL,	/* lockfuncarg */
 #endif
 			       &adapter->txtag)) {
-		printf("ixgb%d: Unable to allocate TX DMA tag\n", adapter->unit);
+		device_printf(adapter->dev, "Unable to allocate TX DMA tag\n");
 		return (ENOMEM);
 	}
 	if (ixgb_allocate_transmit_structures(adapter))
@@ -1845,8 +1837,8 @@ ixgb_allocate_receive_structures(struct 
 	      (struct ixgb_buffer *) malloc(sizeof(struct ixgb_buffer) *
 					    adapter->num_rx_desc, M_DEVBUF,
 					    M_NOWAIT | M_ZERO))) {
-		printf("ixgb%d: Unable to allocate rx_buffer memory\n",
-		       adapter->unit);
+		device_printf(adapter->dev,
+		    "Unable to allocate rx_buffer memory\n");
 		return (ENOMEM);
 	}
 	bzero(adapter->rx_buffer_area,
@@ -1867,9 +1859,9 @@ ixgb_allocate_receive_structures(struct 
 #endif
 				   &adapter->rxtag);
 	if (error != 0) {
-		printf("ixgb%d: ixgb_allocate_receive_structures: "
+		device_printf(adapter->dev, "ixgb_allocate_receive_structures: "
 		       "bus_dma_tag_create failed; error %u\n",
-		       adapter->unit, error);
+		       error);
 		goto fail_0;
 	}
 	rx_buffer = adapter->rx_buffer_area;
@@ -1877,9 +1869,10 @@ ixgb_allocate_receive_structures(struct 
 		error = bus_dmamap_create(adapter->rxtag, BUS_DMA_NOWAIT,
 					  &rx_buffer->map);
 		if (error != 0) {
-			printf("ixgb%d: ixgb_allocate_receive_structures: "
+			device_printf(adapter->dev,
+			       "ixgb_allocate_receive_structures: "
 			       "bus_dmamap_create failed; error %u\n",
-			       adapter->unit, error);
+			       error);
 			goto fail_1;
 		}
 	}
@@ -2431,20 +2424,21 @@ ixgb_print_hw_stats(struct adapter * ada
 	char            buf_speed[100], buf_type[100];
 	ixgb_bus_speed  bus_speed;
 	ixgb_bus_type   bus_type;
-	int             unit = adapter->unit;
+	device_t dev;
 
+	dev = adapter->dev;
 #ifdef _SV_
-	printf("ixgb%d: Packets not Avail = %ld\n", unit,
+	device_printf(dev, "Packets not Avail = %ld\n",
 	       adapter->no_pkts_avail);
-	printf("ixgb%d: CleanTxInterrupts = %ld\n", unit,
+	device_printf(dev, "CleanTxInterrupts = %ld\n",
 	       adapter->clean_tx_interrupts);
-	printf("ixgb%d: ICR RXDMT0 = %lld\n", unit,
+	device_printf(dev, "ICR RXDMT0 = %lld\n",
 	       (long long)adapter->sv_stats.icr_rxdmt0);
-	printf("ixgb%d: ICR RXO = %lld\n", unit,
+	device_printf(dev, "ICR RXO = %lld\n",
 	       (long long)adapter->sv_stats.icr_rxo);
-	printf("ixgb%d: ICR RXT0 = %lld\n", unit,
+	device_printf(dev, "ICR RXT0 = %lld\n",
 	       (long long)adapter->sv_stats.icr_rxt0);
-	printf("ixgb%d: ICR TXDW = %lld\n", unit,
+	device_printf(dev, "ICR TXDW = %lld\n",
 	       (long long)adapter->sv_stats.icr_TXDW);
 #endif				/* _SV_ */
 
@@ -2456,55 +2450,55 @@ ixgb_print_hw_stats(struct adapter * ada
 		bus_speed == ixgb_bus_speed_100 ? "100MHz" :
 		bus_speed == ixgb_bus_speed_133 ? "133MHz" :
 		"UNKNOWN");
-	printf("ixgb%d: PCI_Bus_Speed = %s\n", unit,
+	device_printf(dev, "PCI_Bus_Speed = %s\n",
 	       buf_speed);
 
 	sprintf(buf_type,
 		bus_type == ixgb_bus_type_pci ? "PCI" :
 		bus_type == ixgb_bus_type_pcix ? "PCI-X" :
 		"UNKNOWN");
-	printf("ixgb%d: PCI_Bus_Type = %s\n", unit,
+	device_printf(dev, "PCI_Bus_Type = %s\n",
 	       buf_type);
 
-	printf("ixgb%d: Tx Descriptors not Avail1 = %ld\n", unit,
+	device_printf(dev, "Tx Descriptors not Avail1 = %ld\n",
 	       adapter->no_tx_desc_avail1);
-	printf("ixgb%d: Tx Descriptors not Avail2 = %ld\n", unit,
+	device_printf(dev, "Tx Descriptors not Avail2 = %ld\n",
 	       adapter->no_tx_desc_avail2);
-	printf("ixgb%d: Std Mbuf Failed = %ld\n", unit,
+	device_printf(dev, "Std Mbuf Failed = %ld\n",
 	       adapter->mbuf_alloc_failed);
-	printf("ixgb%d: Std Cluster Failed = %ld\n", unit,
+	device_printf(dev, "Std Cluster Failed = %ld\n",
 	       adapter->mbuf_cluster_failed);
 
-	printf("ixgb%d: Defer count = %lld\n", unit,
+	device_printf(dev, "Defer count = %lld\n",
 	       (long long)adapter->stats.dc);
-	printf("ixgb%d: Missed Packets = %lld\n", unit,
+	device_printf(dev, "Missed Packets = %lld\n",
 	       (long long)adapter->stats.mpc);
-	printf("ixgb%d: Receive No Buffers = %lld\n", unit,
+	device_printf(dev, "Receive No Buffers = %lld\n",
 	       (long long)adapter->stats.rnbc);
-	printf("ixgb%d: Receive length errors = %lld\n", unit,
+	device_printf(dev, "Receive length errors = %lld\n",
 	       (long long)adapter->stats.rlec);
-	printf("ixgb%d: Crc errors = %lld\n", unit,
+	device_printf(dev, "Crc errors = %lld\n",
 	       (long long)adapter->stats.crcerrs);
-	printf("ixgb%d: Driver dropped packets = %ld\n", unit,
+	device_printf(dev, "Driver dropped packets = %ld\n",
 	       adapter->dropped_pkts);
 
-	printf("ixgb%d: XON Rcvd = %lld\n", unit,
+	device_printf(dev, "XON Rcvd = %lld\n",
 	       (long long)adapter->stats.xonrxc);
-	printf("ixgb%d: XON Xmtd = %lld\n", unit,
+	device_printf(dev, "XON Xmtd = %lld\n",
 	       (long long)adapter->stats.xontxc);
-	printf("ixgb%d: XOFF Rcvd = %lld\n", unit,
+	device_printf(dev, "XOFF Rcvd = %lld\n",
 	       (long long)adapter->stats.xoffrxc);
-	printf("ixgb%d: XOFF Xmtd = %lld\n", unit,
+	device_printf(dev, "XOFF Xmtd = %lld\n",
 	       (long long)adapter->stats.xofftxc);
 
-	printf("ixgb%d: Good Packets Rcvd = %lld\n", unit,
+	device_printf(dev, "Good Packets Rcvd = %lld\n",
 	       (long long)adapter->stats.gprcl);
-	printf("ixgb%d: Good Packets Xmtd = %lld\n", unit,
+	device_printf(dev, "Good Packets Xmtd = %lld\n",
 	       (long long)adapter->stats.gptcl);
 
-	printf("ixgb%d: Jumbo frames recvd = %lld\n", unit,
+	device_printf(dev, "Jumbo frames recvd = %lld\n",
 	       (long long)adapter->stats.jprcl);
-	printf("ixgb%d: Jumbo frames Xmtd = %lld\n", unit,
+	device_printf(dev, "Jumbo frames Xmtd = %lld\n",
 	       (long long)adapter->stats.jptcl);
 
 	return;

Modified: head/sys/dev/ixgb/if_ixgb.h
==============================================================================
--- head/sys/dev/ixgb/if_ixgb.h	Fri Nov  6 13:10:12 2009	(r198986)
+++ head/sys/dev/ixgb/if_ixgb.h	Fri Nov  6 14:52:37 2009	(r198987)
@@ -284,7 +284,6 @@ struct adapter {
 	struct ifmedia  media;
 	struct callout 	timer;
 	int             io_rid;
-	u_int8_t        unit;
 	struct mtx	mtx;
 
 	/* Info about the board itself */

Modified: head/sys/dev/vge/if_vge.c
==============================================================================
--- head/sys/dev/vge/if_vge.c	Fri Nov  6 13:10:12 2009	(r198986)
+++ head/sys/dev/vge/if_vge.c	Fri Nov  6 14:52:37 2009	(r198987)
@@ -967,8 +967,6 @@ vge_attach(dev)
 	 */
 	vge_read_eeprom(sc, (caddr_t)eaddr, VGE_EE_EADDR, 3, 0);
 
-	sc->vge_unit = unit;
-
 	/*
 	 * Allocate the parent bus DMA tag appropriate for PCI.
 	 */
@@ -993,7 +991,7 @@ vge_attach(dev)
 
 	ifp = sc->vge_ifp = if_alloc(IFT_ETHER);
 	if (ifp == NULL) {
-		printf("vge%d: can not if_alloc()\n", sc->vge_unit);
+		device_printf(dev, "can not if_alloc()\n");
 		error = ENOSPC;
 		goto fail;
 	}
@@ -1001,7 +999,7 @@ vge_attach(dev)
 	/* Do MII setup */
 	if (mii_phy_probe(dev, &sc->vge_miibus,
 	    vge_ifmedia_upd, vge_ifmedia_sts)) {
-		printf("vge%d: MII without any phy!\n", sc->vge_unit);
+		device_printf(dev, "MII without any phy!\n");
 		error = ENXIO;
 		goto fail;
 	}
@@ -1736,8 +1734,7 @@ vge_encap(sc, m_head, idx)
 	    m_head, vge_dma_map_tx_desc, &arg, BUS_DMA_NOWAIT);
 
 	if (error && error != EFBIG) {
-		printf("vge%d: can't map mbuf (error %d)\n",
-		    sc->vge_unit, error);
+		if_printf(sc->vge_ifp, "can't map mbuf (error %d)\n", error);
 		return (ENOBUFS);
 	}
 
@@ -1758,8 +1755,8 @@ vge_encap(sc, m_head, idx)
 		error = bus_dmamap_load_mbuf(sc->vge_ldata.vge_mtag, map,
 		    m_head, vge_dma_map_tx_desc, &arg, BUS_DMA_NOWAIT);
 		if (error) {
-			printf("vge%d: can't map mbuf (error %d)\n",
-			    sc->vge_unit, error);
+			if_printf(sc->vge_ifp, "can't map mbuf (error %d)\n",
+			    error);
 			return (EFBIG);
 		}
 	}
@@ -2254,7 +2251,7 @@ vge_watchdog(ifp)
 
 	sc = ifp->if_softc;
 	VGE_LOCK(sc);
-	printf("vge%d: watchdog timeout\n", sc->vge_unit);
+	if_printf(ifp, "watchdog timeout\n");
 	ifp->if_oerrors++;
 
 	vge_txeof(sc);

Modified: head/sys/dev/vge/if_vgevar.h
==============================================================================
--- head/sys/dev/vge/if_vgevar.h	Fri Nov  6 13:10:12 2009	(r198986)
+++ head/sys/dev/vge/if_vgevar.h	Fri Nov  6 14:52:37 2009	(r198987)
@@ -108,7 +108,6 @@ struct vge_softc {
 	device_t		vge_miibus;
 	bus_dma_tag_t		vge_parent_tag;
 	bus_dma_tag_t		vge_tag;
-	u_int8_t		vge_unit;	/* interface number */
 	u_int8_t		vge_type;
 	int			vge_if_flags;
 	int			vge_rx_consumed;
From jhb at FreeBSD.org  Fri Nov  6 14:55:02 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri Nov  6 14:55:14 2009
Subject: svn commit: r198988 - in head/sys: dev/ath dev/cxgb dev/hatm
	dev/ixgbe dev/nfe dev/patm dev/sk dev/stge net net80211 netgraph
Message-ID: <200911061455.nA6Et1Pu020171@svn.freebsd.org>

Author: jhb
Date: Fri Nov  6 14:55:01 2009
New Revision: 198988
URL: http://svn.freebsd.org/changeset/base/198988

Log:
  Take a step towards removing if_watchdog/if_timer.  Don't explicitly set
  if_watchdog/if_timer to NULL/0 when initializing an ifnet.  if_alloc()
  sets those members to NULL/0 already.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/cxgb/cxgb_main.c
  head/sys/dev/hatm/if_hatm.c
  head/sys/dev/ixgbe/ixgbe.c
  head/sys/dev/nfe/if_nfe.c
  head/sys/dev/patm/if_patm_attach.c
  head/sys/dev/sk/if_sk.c
  head/sys/dev/stge/if_stge.c
  head/sys/net/if_ef.c
  head/sys/net80211/ieee80211.c
  head/sys/netgraph/ng_eiface.c
  head/sys/netgraph/ng_fec.c
  head/sys/netgraph/ng_iface.c
  head/sys/netgraph/ng_sppp.c

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/dev/ath/if_ath.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -560,7 +560,6 @@ ath_attach(u_int16_t devid, struct ath_s
 	ifp->if_softc = sc;
 	ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
 	ifp->if_start = ath_start;
-	ifp->if_watchdog = NULL;
 	ifp->if_ioctl = ath_ioctl;
 	ifp->if_init = ath_init;
 	IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);

Modified: head/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- head/sys/dev/cxgb/cxgb_main.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/dev/cxgb/cxgb_main.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -1054,10 +1054,6 @@ cxgb_port_attach(device_t dev)
 	ifp->if_ioctl = cxgb_ioctl;
 	ifp->if_start = cxgb_start;
 
-
-	ifp->if_timer = 0;	/* Disable ifnet watchdog */
-	ifp->if_watchdog = NULL;
-
 	ifp->if_snd.ifq_drv_maxlen = cxgb_snd_queue_len;
 	IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen);
 	IFQ_SET_READY(&ifp->if_snd);

Modified: head/sys/dev/hatm/if_hatm.c
==============================================================================
--- head/sys/dev/hatm/if_hatm.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/dev/hatm/if_hatm.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -1928,7 +1928,6 @@ hatm_attach(device_t dev)
 	ifp->if_flags = IFF_SIMPLEX;
 	ifp->if_ioctl = hatm_ioctl;
 	ifp->if_start = hatm_start;
-	ifp->if_watchdog = NULL;
 	ifp->if_init = hatm_init;
 
 	utopia_attach(&sc->utopia, IFP2IFATM(sc->ifp), &sc->media, &sc->mtx,

Modified: head/sys/dev/ixgbe/ixgbe.c
==============================================================================
--- head/sys/dev/ixgbe/ixgbe.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/dev/ixgbe/ixgbe.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -2508,8 +2508,6 @@ ixgbe_setup_interface(device_t dev, stru
 	ifp->if_transmit = ixgbe_mq_start;
 	ifp->if_qflush = ixgbe_qflush;
 #endif
-	ifp->if_timer = 0;
-	ifp->if_watchdog = NULL;
 	ifp->if_snd.ifq_maxlen = adapter->num_tx_desc - 2;
 
 	ether_ifattach(ifp, adapter->hw.mac.addr);

Modified: head/sys/dev/nfe/if_nfe.c
==============================================================================
--- head/sys/dev/nfe/if_nfe.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/dev/nfe/if_nfe.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -567,7 +567,6 @@ nfe_attach(device_t dev)
 	ifp->if_start = nfe_start;
 	ifp->if_hwassist = 0;
 	ifp->if_capabilities = 0;
-	ifp->if_watchdog = NULL;
 	ifp->if_init = nfe_init;
 	IFQ_SET_MAXLEN(&ifp->if_snd, NFE_TX_RING_COUNT - 1);
 	ifp->if_snd.ifq_drv_maxlen = NFE_TX_RING_COUNT - 1;

Modified: head/sys/dev/patm/if_patm_attach.c
==============================================================================
--- head/sys/dev/patm/if_patm_attach.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/dev/patm/if_patm_attach.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -197,11 +197,9 @@ patm_attach(device_t dev)
 	ifp->if_softc = sc;
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
 	ifp->if_flags = IFF_SIMPLEX;
-	ifp->if_watchdog = NULL;
 	ifp->if_init = patm_init;
 	ifp->if_ioctl = patm_ioctl;
 	ifp->if_start = patm_start;
-	ifp->if_watchdog = NULL;
 
 	/* do this early so we can destroy unconditionally */
 	mtx_init(&sc->mtx, device_get_nameunit(dev),

Modified: head/sys/dev/sk/if_sk.c
==============================================================================
--- head/sys/dev/sk/if_sk.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/dev/sk/if_sk.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -1372,8 +1372,6 @@ sk_attach(dev)
 	ifp->if_capenable = ifp->if_capabilities;
 	ifp->if_ioctl = sk_ioctl;
 	ifp->if_start = sk_start;
-	ifp->if_timer = 0;
-	ifp->if_watchdog = NULL;
 	ifp->if_init = sk_init;
 	IFQ_SET_MAXLEN(&ifp->if_snd, SK_TX_RING_CNT - 1);
 	ifp->if_snd.ifq_drv_maxlen = SK_TX_RING_CNT - 1;

Modified: head/sys/dev/stge/if_stge.c
==============================================================================
--- head/sys/dev/stge/if_stge.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/dev/stge/if_stge.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -722,8 +722,6 @@ stge_attach(device_t dev)
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = stge_ioctl;
 	ifp->if_start = stge_start;
-	ifp->if_timer = 0;
-	ifp->if_watchdog = NULL;
 	ifp->if_init = stge_init;
 	ifp->if_mtu = ETHERMTU;
 	ifp->if_snd.ifq_drv_maxlen = STGE_TX_RING_CNT - 1;

Modified: head/sys/net/if_ef.c
==============================================================================
--- head/sys/net/if_ef.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/net/if_ef.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -128,7 +128,6 @@ ef_attach(struct efnet *sc)
 	struct ifnet *ifp = sc->ef_ifp;
 
 	ifp->if_start = ef_start;
-	ifp->if_watchdog = NULL;
 	ifp->if_init = ef_init;
 	ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
 	ifp->if_flags = (IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);

Modified: head/sys/net80211/ieee80211.c
==============================================================================
--- head/sys/net80211/ieee80211.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/net80211/ieee80211.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -391,7 +391,6 @@ ieee80211_vap_setup(struct ieee80211com 
 	ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
 	ifp->if_start = ieee80211_start;
 	ifp->if_ioctl = ieee80211_ioctl;
-	ifp->if_watchdog = NULL;		/* NB: no watchdog routine */
 	ifp->if_init = ieee80211_init;
 	/* NB: input+output filled in by ether_ifattach */
 	IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);

Modified: head/sys/netgraph/ng_eiface.c
==============================================================================
--- head/sys/netgraph/ng_eiface.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/netgraph/ng_eiface.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -369,7 +369,6 @@ ng_eiface_constructor(node_p node)
 	ifp->if_output = ether_output;
 	ifp->if_start = ng_eiface_start;
 	ifp->if_ioctl = ng_eiface_ioctl;
-	ifp->if_watchdog = NULL;
 	ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
 	ifp->if_flags = (IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST);
 

Modified: head/sys/netgraph/ng_fec.c
==============================================================================
--- head/sys/netgraph/ng_fec.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/netgraph/ng_fec.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -1226,7 +1226,6 @@ ng_fec_constructor(node_p node)
 	ifp->if_start = ng_fec_start;
 	ifp->if_ioctl = ng_fec_ioctl;
 	ifp->if_init = ng_fec_init;
-	ifp->if_watchdog = NULL;
 	ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
 	ifp->if_mtu = NG_FEC_MTU_DEFAULT;
 	ifp->if_flags = (IFF_SIMPLEX|IFF_BROADCAST|IFF_MULTICAST);

Modified: head/sys/netgraph/ng_iface.c
==============================================================================
--- head/sys/netgraph/ng_iface.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/netgraph/ng_iface.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -558,7 +558,6 @@ ng_iface_constructor(node_p node)
 	ifp->if_output = ng_iface_output;
 	ifp->if_start = ng_iface_start;
 	ifp->if_ioctl = ng_iface_ioctl;
-	ifp->if_watchdog = NULL;
 	ifp->if_mtu = NG_IFACE_MTU_DEFAULT;
 	ifp->if_flags = (IFF_SIMPLEX|IFF_POINTOPOINT|IFF_NOARP|IFF_MULTICAST);
 	ifp->if_type = IFT_PROPVIRTUAL;		/* XXX */

Modified: head/sys/netgraph/ng_sppp.c
==============================================================================
--- head/sys/netgraph/ng_sppp.c	Fri Nov  6 14:52:37 2009	(r198987)
+++ head/sys/netgraph/ng_sppp.c	Fri Nov  6 14:55:01 2009	(r198988)
@@ -279,7 +279,6 @@ ng_sppp_constructor (node_p node)
 	if_initname (SP2IFP(pp), NG_SPPP_IFACE_NAME, priv->unit);
 	ifp->if_start = ng_sppp_start;
 	ifp->if_ioctl = ng_sppp_ioctl;
-	ifp->if_watchdog = NULL;
 	ifp->if_flags = (IFF_POINTOPOINT|IFF_MULTICAST);
 
 	/* Give this node the same name as the interface (if possible) */
From jhb at FreeBSD.org  Fri Nov  6 16:55:06 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri Nov  6 16:55:17 2009
Subject: svn commit: r198990 - head/sys/netinet
Message-ID: <200911061655.nA6Gt5HW022830@svn.freebsd.org>

Author: jhb
Date: Fri Nov  6 16:55:05 2009
New Revision: 198990
URL: http://svn.freebsd.org/changeset/base/198990

Log:
  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.
  
  Reviewed by:	bz
  MFC after:	1 week

Modified:
  head/sys/netinet/tcp_output.c

Modified: head/sys/netinet/tcp_output.c
==============================================================================
--- head/sys/netinet/tcp_output.c	Fri Nov  6 15:24:48 2009	(r198989)
+++ head/sys/netinet/tcp_output.c	Fri Nov  6 16:55:05 2009	(r198990)
@@ -992,7 +992,7 @@ send:
 	 * to read more data than 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 ume at FreeBSD.org  Fri Nov  6 17:34:27 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Fri Nov  6 17:34:38 2009
Subject: svn commit: r198993 - head/sys/netinet6
Message-ID: <200911061734.nA6HYQsZ023824@svn.freebsd.org>

Author: ume
Date: Fri Nov  6 17:34:26 2009
New Revision: 198993
URL: http://svn.freebsd.org/changeset/base/198993

Log:
  Make nd6_llinfo_timer() does its job, again.  ln->la_expire was
  greater than time_second, in most cases.
  
  MFC after:	3 days

Modified:
  head/sys/netinet6/nd6.c

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c	Fri Nov  6 17:11:58 2009	(r198992)
+++ head/sys/netinet6/nd6.c	Fri Nov  6 17:34:26 2009	(r198993)
@@ -507,7 +507,7 @@ nd6_llinfo_timer(void *arg)
 
 	ndi = ND_IFINFO(ifp);
 	dst = &L3_ADDR_SIN6(ln)->sin6_addr;
-	if ((ln->la_flags & LLE_STATIC) || (ln->la_expire > time_second)) {
+	if (ln->la_flags & LLE_STATIC) {
 		goto done;
 	}
 
From jhb at FreeBSD.org  Fri Nov  6 18:28:14 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri Nov  6 18:28:26 2009
Subject: svn commit: r198995 - head/sys/dev/an
Message-ID: <200911061828.nA6ISD8a025098@svn.freebsd.org>

Author: jhb
Date: Fri Nov  6 18:28:13 2009
New Revision: 198995
URL: http://svn.freebsd.org/changeset/base/198995

Log:
  - Use device_printf() instead of printf() with an explicit unit number
    in the PCI attach routine.
  - Simplify PCI probe.
  - Remove no-longer-used 'unit' from an_attach() parameters.
  
  PR:		kern/126924
  Submitted by:	gavin

Modified:
  head/sys/dev/an/if_an.c
  head/sys/dev/an/if_an_isa.c
  head/sys/dev/an/if_an_pccard.c
  head/sys/dev/an/if_an_pci.c
  head/sys/dev/an/if_anreg.h

Modified: head/sys/dev/an/if_an.c
==============================================================================
--- head/sys/dev/an/if_an.c	Fri Nov  6 17:58:44 2009	(r198994)
+++ head/sys/dev/an/if_an.c	Fri Nov  6 18:28:13 2009	(r198995)
@@ -674,7 +674,7 @@ an_init_mpi350_desc(struct an_softc *sc)
 }
 
 int
-an_attach(struct an_softc *sc, int unit, int flags)
+an_attach(struct an_softc *sc, int flags)
 {
 	struct ifnet		*ifp;
 	int			error = EIO;

Modified: head/sys/dev/an/if_an_isa.c
==============================================================================
--- head/sys/dev/an/if_an_isa.c	Fri Nov  6 17:58:44 2009	(r198994)
+++ head/sys/dev/an/if_an_isa.c	Fri Nov  6 18:28:13 2009	(r198995)
@@ -115,7 +115,7 @@ an_attach_isa(device_t dev)
 	sc->an_btag = rman_get_bustag(sc->port_res);
 	sc->an_dev = dev;
 
-	error = an_attach(sc, device_get_unit(dev), flags);
+	error = an_attach(sc, flags);
 	if (error) {
 		an_release_resources(dev);
 		return (error);

Modified: head/sys/dev/an/if_an_pccard.c
==============================================================================
--- head/sys/dev/an/if_an_pccard.c	Fri Nov  6 17:58:44 2009	(r198994)
+++ head/sys/dev/an/if_an_pccard.c	Fri Nov  6 18:28:13 2009	(r198995)
@@ -145,7 +145,7 @@ an_pccard_attach(device_t dev)
 	sc->an_btag = rman_get_bustag(sc->port_res);
 	sc->an_dev = dev;
 
-	error = an_attach(sc, device_get_unit(dev), flags);
+	error = an_attach(sc, flags);
 	if (error)
 		goto fail;
 	

Modified: head/sys/dev/an/if_an_pci.c
==============================================================================
--- head/sys/dev/an/if_an_pci.c	Fri Nov  6 17:58:44 2009	(r198994)
+++ head/sys/dev/an/if_an_pci.c	Fri Nov  6 18:28:13 2009	(r198995)
@@ -103,6 +103,7 @@ struct an_type {
 
 static struct an_type an_devs[] = {
 	{ AIRONET_VENDORID, AIRONET_DEVICEID_35x, "Cisco Aironet 350 Series" },
+	{ AIRONET_VENDORID, AIRONET_DEVICEID_MPI350, "Cisco Aironet MPI350" },
 	{ AIRONET_VENDORID, AIRONET_DEVICEID_4500, "Aironet PCI4500" },
 	{ AIRONET_VENDORID, AIRONET_DEVICEID_4800, "Aironet PCI4800" },
 	{ AIRONET_VENDORID, AIRONET_DEVICEID_4xxx, "Aironet PCI4500/PCI4800" },
@@ -133,13 +134,6 @@ an_probe_pci(device_t dev)
 		t++;
 	}
 
-	if (pci_get_vendor(dev) == AIRONET_VENDORID &&
-	    pci_get_device(dev) == AIRONET_DEVICEID_MPI350) {
-		device_set_desc(dev, "Cisco Aironet MPI350");
-		an_pci_probe(dev);
-		return(BUS_PROBE_DEFAULT);
-	}
-
 	return(ENXIO);
 }
 
@@ -149,10 +143,9 @@ an_attach_pci(dev)
 {
 	u_int32_t		command;
 	struct an_softc		*sc;
-	int 			unit, flags, error = 0;
+	int 			flags, error = 0;
 
 	sc = device_get_softc(dev);
-	unit = device_get_unit(dev);
 	flags = device_get_flags(dev);
 
 	if (pci_get_vendor(dev) == AIRONET_VENDORID &&
@@ -169,7 +162,7 @@ an_attach_pci(dev)
 		command = pci_read_config(dev, PCIR_COMMAND, 4);
 
 		if (!(command & PCIM_CMD_PORTEN)) {
-			printf("an%d: failed to enable I/O ports!\n", unit);
+			device_printf(dev, "failed to enable I/O ports!\n");
 			error = ENXIO;
 			goto fail;
 		}
@@ -178,7 +171,7 @@ an_attach_pci(dev)
 	error = an_alloc_port(dev, sc->port_rid, 1);
 
 	if (error) {
-		printf("an%d: couldn't map ports\n", unit);
+		device_printf(dev, "couldn't map ports\n");
 		goto fail;
 	}
 
@@ -191,7 +184,7 @@ an_attach_pci(dev)
 		sc->mem_rid = PCIR_BAR(1);
 		error = an_alloc_memory(dev, sc->mem_rid, 1);
 		if (error) {
-			printf("an%d: couldn't map memory\n", unit);
+			device_printf(dev, "couldn't map memory\n");
 			goto fail;
 		}
 		sc->an_mem_btag = rman_get_bustag(sc->mem_res);
@@ -202,7 +195,7 @@ an_attach_pci(dev)
 		error = an_alloc_aux_memory(dev, sc->mem_aux_rid, 
 		    AN_AUX_MEM_SIZE);
 		if (error) {
-			printf("an%d: couldn't map aux memory\n", unit);
+			device_printf(dev, "couldn't map aux memory\n");
 			goto fail;
 		}
 		sc->an_mem_aux_btag = rman_get_bustag(sc->mem_aux_res);
@@ -222,7 +215,7 @@ an_attach_pci(dev)
 			       NULL,			/* lockarg */
 			       &sc->an_dtag);
 		if (error) {
-			printf("an%d: couldn't get DMA region\n", unit);
+			device_printf(dev, "couldn't get DMA region\n");
 			goto fail;
 		}
 	}
@@ -230,12 +223,14 @@ an_attach_pci(dev)
 	/* Allocate interrupt */
 	error = an_alloc_irq(dev, 0, RF_SHAREABLE);
 	if (error) {
+		device_printf(dev, "couldn't get interrupt\n");
 		goto fail;
 	}
 
 	sc->an_dev = dev;
-	error = an_attach(sc, device_get_unit(dev), flags);
+	error = an_attach(sc, flags);
 	if (error) {
+		device_printf(dev, "couldn't attach\n");
 		goto fail;
 	}
 
@@ -244,6 +239,8 @@ an_attach_pci(dev)
 	 */
 	error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET,
 	    NULL, an_intr, sc, &sc->irq_handle);
+	if (error)
+		device_printf(dev, "couldn't setup interrupt\n");
 
 fail:
 	if (error)

Modified: head/sys/dev/an/if_anreg.h
==============================================================================
--- head/sys/dev/an/if_anreg.h	Fri Nov  6 17:58:44 2009	(r198994)
+++ head/sys/dev/an/if_anreg.h	Fri Nov  6 18:28:13 2009	(r198995)
@@ -511,7 +511,7 @@ int	an_pci_probe	(device_t);
 int	an_probe	(device_t);
 int	an_shutdown	(device_t);
 void	an_resume	(device_t);
-int	an_attach		(struct an_softc *, int, int);
+int	an_attach		(struct an_softc *, int);
 int	an_detach	(device_t);
 void    an_stop		(struct an_softc *);
 
From yongari at FreeBSD.org  Fri Nov  6 18:36:10 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Fri Nov  6 18:36:17 2009
Subject: svn commit: r198996 - head/sys/dev/msk
Message-ID: <200911061836.nA6Ia98Z025387@svn.freebsd.org>

Author: yongari
Date: Fri Nov  6 18:36:09 2009
New Revision: 198996
URL: http://svn.freebsd.org/changeset/base/198996

Log:
  Remove unnecessary header file.

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==============================================================================
--- head/sys/dev/msk/if_msk.c	Fri Nov  6 18:28:13 2009	(r198995)
+++ head/sys/dev/msk/if_msk.c	Fri Nov  6 18:36:09 2009	(r198996)
@@ -137,7 +137,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 
 #include 
 #include 
From yongari at FreeBSD.org  Fri Nov  6 18:51:06 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Fri Nov  6 18:51:13 2009
Subject: svn commit: r198997 - head/sys/dev/msk
Message-ID: <200911061851.nA6Ip5XF025690@svn.freebsd.org>

Author: yongari
Date: Fri Nov  6 18:51:05 2009
New Revision: 198997
URL: http://svn.freebsd.org/changeset/base/198997

Log:
  It's normal to see Rx FIFO overruns under high network load and
  showing the message creates other side-effects. Remove the Rx
  FIFO overrun message in interrupt handler. msk(4) should recover
  from the FIFO overruns without any user intervention. Users can
  still check the Rx FIFO overrun counter from MAC MIB statistics
  maintained in driver(dev.msk.0.stats.rx.overflows).

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==============================================================================
--- head/sys/dev/msk/if_msk.c	Fri Nov  6 18:36:09 2009	(r198996)
+++ head/sys/dev/msk/if_msk.c	Fri Nov  6 18:51:05 2009	(r198997)
@@ -3217,11 +3217,9 @@ msk_intr_gmac(struct msk_if_softc *sc_if
 	status = CSR_READ_1(sc, MR_ADDR(sc_if->msk_port, GMAC_IRQ_SRC));
 
 	/* GMAC Rx FIFO overrun. */
-	if ((status & GM_IS_RX_FF_OR) != 0) {
+	if ((status & GM_IS_RX_FF_OR) != 0)
 		CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_CTRL_T),
 		    GMF_CLI_RX_FO);
-		device_printf(sc_if->msk_if_dev, "Rx FIFO overrun!\n");
-	}
 	/* GMAC Tx FIFO underrun. */
 	if ((status & GM_IS_TX_FF_UR) != 0) {
 		CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
From jhb at FreeBSD.org  Fri Nov  6 20:07:16 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri Nov  6 20:07:59 2009
Subject: svn commit: r198999 - head/sys/dev/msk
Message-ID: <200911062007.nA6K7GJ1027261@svn.freebsd.org>

Author: jhb
Date: Fri Nov  6 20:07:16 2009
New Revision: 198999
URL: http://svn.freebsd.org/changeset/base/198999

Log:
  Take a step towards removing if_watchdog/if_timer.  Don't explicitly set
  if_watchdog/if_timer to NULL/0 when initializing an ifnet.  if_alloc()
  sets those members to NULL/0 already.
  
  (Missed this driver in the earlier commit.)

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==============================================================================
--- head/sys/dev/msk/if_msk.c	Fri Nov  6 19:16:33 2009	(r198998)
+++ head/sys/dev/msk/if_msk.c	Fri Nov  6 20:07:16 2009	(r198999)
@@ -1518,8 +1518,6 @@ msk_attach(device_t dev)
 	ifp->if_capenable = ifp->if_capabilities;
 	ifp->if_ioctl = msk_ioctl;
 	ifp->if_start = msk_start;
-	ifp->if_timer = 0;
-	ifp->if_watchdog = NULL;
 	ifp->if_init = msk_init;
 	IFQ_SET_MAXLEN(&ifp->if_snd, MSK_TX_RING_CNT - 1);
 	ifp->if_snd.ifq_drv_maxlen = MSK_TX_RING_CNT - 1;
From jkim at FreeBSD.org  Fri Nov  6 20:32:27 2009
From: jkim at FreeBSD.org (Jung-uk Kim)
Date: Fri Nov  6 20:32:40 2009
Subject: svn commit: r199002 - in head/sys: dev/fb dev/pci isa
Message-ID: <200911062032.nA6KWRXb027876@svn.freebsd.org>

Author: jkim
Date: Fri Nov  6 20:32:26 2009
New Revision: 199002
URL: http://svn.freebsd.org/changeset/base/199002

Log:
  Remove duplicate suspend/resume code from vga_pci.c and let vga(4) register
  itself to an associated PCI device if it exists.  It is little bit hackish
  but it should fix build without frame buffer driver since r198964.
  Fix some style(9) nits in vga_isa.c while we are here.

Modified:
  head/sys/dev/fb/vgareg.h
  head/sys/dev/pci/vga_pci.c
  head/sys/isa/vga_isa.c

Modified: head/sys/dev/fb/vgareg.h
==============================================================================
--- head/sys/dev/fb/vgareg.h	Fri Nov  6 20:23:42 2009	(r199001)
+++ head/sys/dev/fb/vgareg.h	Fri Nov  6 20:32:26 2009	(r199002)
@@ -69,6 +69,7 @@
 struct video_adapter;
 typedef struct vga_softc {
 	struct video_adapter	*adp;
+	device_t		pci_dev;
 	void			*state_buf;
 	void			*pal_buf;
 #ifdef FB_INSTALL_CDEV

Modified: head/sys/dev/pci/vga_pci.c
==============================================================================
--- head/sys/dev/pci/vga_pci.c	Fri Nov  6 20:23:42 2009	(r199001)
+++ head/sys/dev/pci/vga_pci.c	Fri Nov  6 20:32:26 2009	(r199002)
@@ -40,15 +40,12 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 
-#include 
 #include 
 
 #include 
@@ -60,6 +57,7 @@ struct vga_resource {
 };
 
 struct vga_pci_softc {
+	device_t	vga_isa_dev;	/* Sister isavga driver. */
 	device_t	vga_msi_child;	/* Child driver using MSI. */
 	struct vga_resource vga_res[PCIR_MAX_BAR_0 + 1];
 };
@@ -117,86 +115,23 @@ vga_pci_attach(device_t dev)
 static int
 vga_pci_suspend(device_t dev)
 {
-	vga_softc_t *sc;
-	devclass_t dc;
-	int err, nbytes;
-
-	err = bus_generic_suspend(dev);
-	if (err)
-		return (err);
-
-	sc = NULL;
-	if (device_get_unit(dev) == vga_pci_default_unit) {
-		dc = devclass_find(VGA_DRIVER_NAME);
-		if (dc != NULL)
-			sc = devclass_get_softc(dc, 0);
-	}
-	if (sc == NULL)
-		return (0);
-
-	/* Save the video state across the suspend. */
-	if (sc->state_buf != NULL)
-		goto save_palette;
-	nbytes = vidd_save_state(sc->adp, NULL, 0);
-	if (nbytes <= 0)
-		goto save_palette;
-	sc->state_buf = malloc(nbytes, M_TEMP, M_NOWAIT);
-	if (sc->state_buf == NULL)
-		goto save_palette;
-	if (bootverbose)
-		device_printf(dev, "saving %d bytes of video state\n", nbytes);
-	if (vidd_save_state(sc->adp, sc->state_buf, nbytes) != 0) {
-		device_printf(dev, "failed to save state (nbytes=%d)\n",
-		    nbytes);
-		free(sc->state_buf, M_TEMP);
-		sc->state_buf = NULL;
-	}
+	struct vga_pci_softc *sc;
 
-save_palette:
-	/* Save the color palette across the suspend. */
-	if (sc->pal_buf != NULL)
-		return (0);
-	sc->pal_buf = malloc(256 * 3, M_TEMP, M_NOWAIT);
-	if (sc->pal_buf != NULL) {
-		if (bootverbose)
-			device_printf(dev, "saving color palette\n");
-		if (vidd_save_palette(sc->adp, sc->pal_buf) != 0) {
-			device_printf(dev, "failed to save palette\n");
-			free(sc->pal_buf, M_TEMP);
-			sc->pal_buf = NULL;
-		}
-	}
+	sc = device_get_softc(dev);
+	if (sc->vga_isa_dev != NULL)
+		(void)DEVICE_SUSPEND(sc->vga_isa_dev);
 
-	return (0);
+	return (bus_generic_suspend(dev));
 }
 
 static int
 vga_pci_resume(device_t dev)
 {
-	vga_softc_t *sc;
-	devclass_t dc;
-
-	sc = NULL;
-	if (device_get_unit(dev) == vga_pci_default_unit) {
-		dc = devclass_find(VGA_DRIVER_NAME);
-		if (dc != NULL)
-			sc = devclass_get_softc(dc, 0);
-	}
-	if (sc == NULL)
-		return (bus_generic_resume(dev));
+	struct vga_pci_softc *sc;
 
-	if (sc->state_buf != NULL) {
-		if (vidd_load_state(sc->adp, sc->state_buf) != 0)
-			device_printf(dev, "failed to reload state\n");
-		free(sc->state_buf, M_TEMP);
-		sc->state_buf = NULL;
-	}
-	if (sc->pal_buf != NULL) {
-		if (vidd_load_palette(sc->adp, sc->pal_buf) != 0)
-			device_printf(dev, "failed to reload palette\n");
-		free(sc->pal_buf, M_TEMP);
-		sc->pal_buf = NULL;
-	}
+	sc = device_get_softc(dev);
+	if (sc->vga_isa_dev != NULL)
+		(void)DEVICE_RESUME(sc->vga_isa_dev);
 
 	return (bus_generic_resume(dev));
 }

Modified: head/sys/isa/vga_isa.c
==============================================================================
--- head/sys/isa/vga_isa.c	Fri Nov  6 20:23:42 2009	(r199001)
+++ head/sys/isa/vga_isa.c	Fri Nov  6 20:32:26 2009	(r199002)
@@ -117,13 +117,17 @@ isavga_probe(device_t dev)
 		isa_set_msize(dev, adp.va_mem_size);
 #endif
 	}
-	return error;
+	return (error);
 }
 
 static int
 isavga_attach(device_t dev)
 {
 	vga_softc_t *sc;
+	devclass_t dc;
+	device_t *devs;
+	void *vgapci_sc;
+	int count, i;
 	int unit;
 	int rid;
 	int error;
@@ -140,13 +144,13 @@ isavga_attach(device_t dev)
 
 	error = vga_attach_unit(unit, sc, device_get_flags(dev));
 	if (error)
-		return error;
+		return (error);
 
 #ifdef FB_INSTALL_CDEV
 	/* attach a virtual frame buffer device */
 	error = fb_attach(VGA_MKMINOR(unit), sc->adp, &isavga_cdevsw);
 	if (error)
-		return error;
+		return (error);
 #endif /* FB_INSTALL_CDEV */
 
 	if (0 && bootverbose)
@@ -157,20 +161,43 @@ isavga_attach(device_t dev)
 	bus_generic_attach(dev);
 #endif
 
-	return 0;
+	/* Find the matching PCI video controller. */
+	if (unit == 0) {
+		dc = devclass_find("vgapci");
+		if (dc != NULL &&
+		    devclass_get_devices(dc, &devs, &count) == 0) {
+			for (i = 0; i < count; i++)
+				if (device_get_flags(devs[i]) != 0) {
+					sc->pci_dev = devs[i];
+					break;
+				}
+			free(devs, M_TEMP);
+		}
+		if (sc->pci_dev != NULL) {
+			vgapci_sc = device_get_softc(sc->pci_dev);
+			*(device_t *)vgapci_sc = dev;
+			device_printf(dev, "associated with %s\n",
+			    device_get_nameunit(sc->pci_dev));
+		}
+	}
+
+	return (0);
 }
 
 static int
 isavga_suspend(device_t dev)
 {
 	vga_softc_t *sc;
+	device_t isa_dev;
 	int err, nbytes;
 
-	err = bus_generic_suspend(dev);
-	if (err)
-		return (err);
-
-	sc = device_get_softc(dev);
+	err = 0;
+	isa_dev = dev;
+	sc = device_get_softc(isa_dev);
+	if (sc->pci_dev != NULL)
+		dev = sc->pci_dev;
+	else
+		err = bus_generic_suspend(isa_dev);
 
 	/* Save the video state across the suspend. */
 	if (sc->state_buf != NULL)
@@ -193,7 +220,7 @@ isavga_suspend(device_t dev)
 save_palette:
 	/* Save the color palette across the suspend. */
 	if (sc->pal_buf != NULL)
-		return (0);
+		return (err);
 	sc->pal_buf = malloc(256 * 3, M_TEMP, M_NOWAIT);
 	if (sc->pal_buf != NULL) {
 		if (bootverbose)
@@ -205,15 +232,19 @@ save_palette:
 		}
 	}
 
-	return (0);
+	return (err);
 }
 
 static int
 isavga_resume(device_t dev)
 {
 	vga_softc_t *sc;
+	device_t isa_dev;
 
-	sc = device_get_softc(dev);
+	isa_dev = dev;
+	sc = device_get_softc(isa_dev);
+	if (sc->pci_dev != NULL)
+		dev = sc->pci_dev;
 
 	if (sc->state_buf != NULL) {
 		if (vidd_load_state(sc->adp, sc->state_buf) != 0)
@@ -228,7 +259,10 @@ isavga_resume(device_t dev)
 		sc->pal_buf = NULL;
 	}
 
-	return (bus_generic_resume(dev));
+	if (isa_dev != dev)
+		return (0);
+
+	return (bus_generic_resume(isa_dev));
 }
 
 #ifdef FB_INSTALL_CDEV
@@ -236,37 +270,37 @@ isavga_resume(device_t dev)
 static int
 isavga_open(struct cdev *dev, int flag, int mode, struct thread *td)
 {
-	return vga_open(dev, VGA_SOFTC(VGA_UNIT(dev)), flag, mode, td);
+	return (vga_open(dev, VGA_SOFTC(VGA_UNIT(dev)), flag, mode, td));
 }
 
 static int
 isavga_close(struct cdev *dev, int flag, int mode, struct thread *td)
 {
-	return vga_close(dev, VGA_SOFTC(VGA_UNIT(dev)), flag, mode, td);
+	return (vga_close(dev, VGA_SOFTC(VGA_UNIT(dev)), flag, mode, td));
 }
 
 static int
 isavga_read(struct cdev *dev, struct uio *uio, int flag)
 {
-	return vga_read(dev, VGA_SOFTC(VGA_UNIT(dev)), uio, flag);
+	return (vga_read(dev, VGA_SOFTC(VGA_UNIT(dev)), uio, flag));
 }
 
 static int
 isavga_write(struct cdev *dev, struct uio *uio, int flag)
 {
-	return vga_write(dev, VGA_SOFTC(VGA_UNIT(dev)), uio, flag);
+	return (vga_write(dev, VGA_SOFTC(VGA_UNIT(dev)), uio, flag));
 }
 
 static int
 isavga_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td)
 {
-	return vga_ioctl(dev, VGA_SOFTC(VGA_UNIT(dev)), cmd, arg, flag, td);
+	return (vga_ioctl(dev, VGA_SOFTC(VGA_UNIT(dev)), cmd, arg, flag, td));
 }
 
 static int
 isavga_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot)
 {
-	return vga_mmap(dev, VGA_SOFTC(VGA_UNIT(dev)), offset, paddr, prot);
+	return (vga_mmap(dev, VGA_SOFTC(VGA_UNIT(dev)), offset, paddr, prot));
 }
 
 #endif /* FB_INSTALL_CDEV */
From jhb at freebsd.org  Fri Nov  6 21:50:56 2009
From: jhb at freebsd.org (John Baldwin)
Date: Fri Nov  6 21:51:02 2009
Subject: svn commit: r199002 - in head/sys: dev/fb dev/pci isa
In-Reply-To: <200911062032.nA6KWRXb027876@svn.freebsd.org>
References: <200911062032.nA6KWRXb027876@svn.freebsd.org>
Message-ID: <200911061647.00983.jhb@freebsd.org>

On Friday 06 November 2009 3:32:26 pm Jung-uk Kim wrote:
> Author: jkim
> Date: Fri Nov  6 20:32:26 2009
> New Revision: 199002
> URL: http://svn.freebsd.org/changeset/base/199002
> 
> Log:
>   Remove duplicate suspend/resume code from vga_pci.c and let vga(4) 
register
>   itself to an associated PCI device if it exists.  It is little bit hackish
>   but it should fix build without frame buffer driver since r198964.
>   Fix some style(9) nits in vga_isa.c while we are here.

Hmm, did you consider having vga_isa use an identify routine to attach itself 
as a child of vgapci0?  The hack of knowing the first thing in the softc is
a pointer is really gross and I'd rather avoid it.  Just creating a child of 
vgapci0 will automatically cause suspend and resume to work w/o vgapci having 
to have any special knowledge about vga_isa.

> Modified:
>   head/sys/dev/fb/vgareg.h
>   head/sys/dev/pci/vga_pci.c
>   head/sys/isa/vga_isa.c
> 
> Modified: head/sys/dev/fb/vgareg.h
> 
==============================================================================
> --- head/sys/dev/fb/vgareg.h	Fri Nov  6 20:23:42 2009	(r199001)
> +++ head/sys/dev/fb/vgareg.h	Fri Nov  6 20:32:26 2009	(r199002)
> @@ -69,6 +69,7 @@
>  struct video_adapter;
>  typedef struct vga_softc {
>  	struct video_adapter	*adp;
> +	device_t		pci_dev;
>  	void			*state_buf;
>  	void			*pal_buf;
>  #ifdef FB_INSTALL_CDEV
> 
> Modified: head/sys/dev/pci/vga_pci.c
> 
==============================================================================
> --- head/sys/dev/pci/vga_pci.c	Fri Nov  6 20:23:42 2009	(r199001)
> +++ head/sys/dev/pci/vga_pci.c	Fri Nov  6 20:32:26 2009	(r199002)
> @@ -40,15 +40,12 @@ __FBSDID("$FreeBSD$");
>  
>  #include 
>  #include 
> -#include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
>  #include 
>  
> -#include 
>  #include 
>  
>  #include 
> @@ -60,6 +57,7 @@ struct vga_resource {
>  };
>  
>  struct vga_pci_softc {
> +	device_t	vga_isa_dev;	/* Sister isavga driver. */
>  	device_t	vga_msi_child;	/* Child driver using MSI. */
>  	struct vga_resource vga_res[PCIR_MAX_BAR_0 + 1];
>  };
> @@ -117,86 +115,23 @@ vga_pci_attach(device_t dev)
>  static int
>  vga_pci_suspend(device_t dev)
>  {
> -	vga_softc_t *sc;
> -	devclass_t dc;
> -	int err, nbytes;
> -
> -	err = bus_generic_suspend(dev);
> -	if (err)
> -		return (err);
> -
> -	sc = NULL;
> -	if (device_get_unit(dev) == vga_pci_default_unit) {
> -		dc = devclass_find(VGA_DRIVER_NAME);
> -		if (dc != NULL)
> -			sc = devclass_get_softc(dc, 0);
> -	}
> -	if (sc == NULL)
> -		return (0);
> -
> -	/* Save the video state across the suspend. */
> -	if (sc->state_buf != NULL)
> -		goto save_palette;
> -	nbytes = vidd_save_state(sc->adp, NULL, 0);
> -	if (nbytes <= 0)
> -		goto save_palette;
> -	sc->state_buf = malloc(nbytes, M_TEMP, M_NOWAIT);
> -	if (sc->state_buf == NULL)
> -		goto save_palette;
> -	if (bootverbose)
> -		device_printf(dev, "saving %d bytes of video state\n", nbytes);
> -	if (vidd_save_state(sc->adp, sc->state_buf, nbytes) != 0) {
> -		device_printf(dev, "failed to save state (nbytes=%d)\n",
> -		    nbytes);
> -		free(sc->state_buf, M_TEMP);
> -		sc->state_buf = NULL;
> -	}
> +	struct vga_pci_softc *sc;
>  
> -save_palette:
> -	/* Save the color palette across the suspend. */
> -	if (sc->pal_buf != NULL)
> -		return (0);
> -	sc->pal_buf = malloc(256 * 3, M_TEMP, M_NOWAIT);
> -	if (sc->pal_buf != NULL) {
> -		if (bootverbose)
> -			device_printf(dev, "saving color palette\n");
> -		if (vidd_save_palette(sc->adp, sc->pal_buf) != 0) {
> -			device_printf(dev, "failed to save palette\n");
> -			free(sc->pal_buf, M_TEMP);
> -			sc->pal_buf = NULL;
> -		}
> -	}
> +	sc = device_get_softc(dev);
> +	if (sc->vga_isa_dev != NULL)
> +		(void)DEVICE_SUSPEND(sc->vga_isa_dev);
>  
> -	return (0);
> +	return (bus_generic_suspend(dev));
>  }
>  
>  static int
>  vga_pci_resume(device_t dev)
>  {
> -	vga_softc_t *sc;
> -	devclass_t dc;
> -
> -	sc = NULL;
> -	if (device_get_unit(dev) == vga_pci_default_unit) {
> -		dc = devclass_find(VGA_DRIVER_NAME);
> -		if (dc != NULL)
> -			sc = devclass_get_softc(dc, 0);
> -	}
> -	if (sc == NULL)
> -		return (bus_generic_resume(dev));
> +	struct vga_pci_softc *sc;
>  
> -	if (sc->state_buf != NULL) {
> -		if (vidd_load_state(sc->adp, sc->state_buf) != 0)
> -			device_printf(dev, "failed to reload state\n");
> -		free(sc->state_buf, M_TEMP);
> -		sc->state_buf = NULL;
> -	}
> -	if (sc->pal_buf != NULL) {
> -		if (vidd_load_palette(sc->adp, sc->pal_buf) != 0)
> -			device_printf(dev, "failed to reload palette\n");
> -		free(sc->pal_buf, M_TEMP);
> -		sc->pal_buf = NULL;
> -	}
> +	sc = device_get_softc(dev);
> +	if (sc->vga_isa_dev != NULL)
> +		(void)DEVICE_RESUME(sc->vga_isa_dev);
>  
>  	return (bus_generic_resume(dev));
>  }
> 
> Modified: head/sys/isa/vga_isa.c
> 
==============================================================================
> --- head/sys/isa/vga_isa.c	Fri Nov  6 20:23:42 2009	(r199001)
> +++ head/sys/isa/vga_isa.c	Fri Nov  6 20:32:26 2009	(r199002)
> @@ -117,13 +117,17 @@ isavga_probe(device_t dev)
>  		isa_set_msize(dev, adp.va_mem_size);
>  #endif
>  	}
> -	return error;
> +	return (error);
>  }
>  
>  static int
>  isavga_attach(device_t dev)
>  {
>  	vga_softc_t *sc;
> +	devclass_t dc;
> +	device_t *devs;
> +	void *vgapci_sc;
> +	int count, i;
>  	int unit;
>  	int rid;
>  	int error;
> @@ -140,13 +144,13 @@ isavga_attach(device_t dev)
>  
>  	error = vga_attach_unit(unit, sc, device_get_flags(dev));
>  	if (error)
> -		return error;
> +		return (error);
>  
>  #ifdef FB_INSTALL_CDEV
>  	/* attach a virtual frame buffer device */
>  	error = fb_attach(VGA_MKMINOR(unit), sc->adp, &isavga_cdevsw);
>  	if (error)
> -		return error;
> +		return (error);
>  #endif /* FB_INSTALL_CDEV */
>  
>  	if (0 && bootverbose)
> @@ -157,20 +161,43 @@ isavga_attach(device_t dev)
>  	bus_generic_attach(dev);
>  #endif
>  
> -	return 0;
> +	/* Find the matching PCI video controller. */
> +	if (unit == 0) {
> +		dc = devclass_find("vgapci");
> +		if (dc != NULL &&
> +		    devclass_get_devices(dc, &devs, &count) == 0) {
> +			for (i = 0; i < count; i++)
> +				if (device_get_flags(devs[i]) != 0) {
> +					sc->pci_dev = devs[i];
> +					break;
> +				}
> +			free(devs, M_TEMP);
> +		}
> +		if (sc->pci_dev != NULL) {
> +			vgapci_sc = device_get_softc(sc->pci_dev);
> +			*(device_t *)vgapci_sc = dev;
> +			device_printf(dev, "associated with %s\n",
> +			    device_get_nameunit(sc->pci_dev));
> +		}
> +	}
> +
> +	return (0);
>  }
>  
>  static int
>  isavga_suspend(device_t dev)
>  {
>  	vga_softc_t *sc;
> +	device_t isa_dev;
>  	int err, nbytes;
>  
> -	err = bus_generic_suspend(dev);
> -	if (err)
> -		return (err);
> -
> -	sc = device_get_softc(dev);
> +	err = 0;
> +	isa_dev = dev;
> +	sc = device_get_softc(isa_dev);
> +	if (sc->pci_dev != NULL)
> +		dev = sc->pci_dev;
> +	else
> +		err = bus_generic_suspend(isa_dev);
>  
>  	/* Save the video state across the suspend. */
>  	if (sc->state_buf != NULL)
> @@ -193,7 +220,7 @@ isavga_suspend(device_t dev)
>  save_palette:
>  	/* Save the color palette across the suspend. */
>  	if (sc->pal_buf != NULL)
> -		return (0);
> +		return (err);
>  	sc->pal_buf = malloc(256 * 3, M_TEMP, M_NOWAIT);
>  	if (sc->pal_buf != NULL) {
>  		if (bootverbose)
> @@ -205,15 +232,19 @@ save_palette:
>  		}
>  	}
>  
> -	return (0);
> +	return (err);
>  }
>  
>  static int
>  isavga_resume(device_t dev)
>  {
>  	vga_softc_t *sc;
> +	device_t isa_dev;
>  
> -	sc = device_get_softc(dev);
> +	isa_dev = dev;
> +	sc = device_get_softc(isa_dev);
> +	if (sc->pci_dev != NULL)
> +		dev = sc->pci_dev;
>  
>  	if (sc->state_buf != NULL) {
>  		if (vidd_load_state(sc->adp, sc->state_buf) != 0)
> @@ -228,7 +259,10 @@ isavga_resume(device_t dev)
>  		sc->pal_buf = NULL;
>  	}
>  
> -	return (bus_generic_resume(dev));
> +	if (isa_dev != dev)
> +		return (0);
> +
> +	return (bus_generic_resume(isa_dev));
>  }
>  
>  #ifdef FB_INSTALL_CDEV
> @@ -236,37 +270,37 @@ isavga_resume(device_t dev)
>  static int
>  isavga_open(struct cdev *dev, int flag, int mode, struct thread *td)
>  {
> -	return vga_open(dev, VGA_SOFTC(VGA_UNIT(dev)), flag, mode, td);
> +	return (vga_open(dev, VGA_SOFTC(VGA_UNIT(dev)), flag, mode, td));
>  }
>  
>  static int
>  isavga_close(struct cdev *dev, int flag, int mode, struct thread *td)
>  {
> -	return vga_close(dev, VGA_SOFTC(VGA_UNIT(dev)), flag, mode, td);
> +	return (vga_close(dev, VGA_SOFTC(VGA_UNIT(dev)), flag, mode, td));
>  }
>  
>  static int
>  isavga_read(struct cdev *dev, struct uio *uio, int flag)
>  {
> -	return vga_read(dev, VGA_SOFTC(VGA_UNIT(dev)), uio, flag);
> +	return (vga_read(dev, VGA_SOFTC(VGA_UNIT(dev)), uio, flag));
>  }
>  
>  static int
>  isavga_write(struct cdev *dev, struct uio *uio, int flag)
>  {
> -	return vga_write(dev, VGA_SOFTC(VGA_UNIT(dev)), uio, flag);
> +	return (vga_write(dev, VGA_SOFTC(VGA_UNIT(dev)), uio, flag));
>  }
>  
>  static int
>  isavga_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct 
thread *td)
>  {
> -	return vga_ioctl(dev, VGA_SOFTC(VGA_UNIT(dev)), cmd, arg, flag, td);
> +	return (vga_ioctl(dev, VGA_SOFTC(VGA_UNIT(dev)), cmd, arg, flag, td));
>  }
>  
>  static int
>  isavga_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int 
prot)
>  {
> -	return vga_mmap(dev, VGA_SOFTC(VGA_UNIT(dev)), offset, paddr, prot);
> +	return (vga_mmap(dev, VGA_SOFTC(VGA_UNIT(dev)), offset, paddr, prot));
>  }
>  
>  #endif /* FB_INSTALL_CDEV */
> 



-- 
John Baldwin
From attilio at FreeBSD.org  Fri Nov  6 22:29:47 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Fri Nov  6 22:31:08 2009
Subject: svn commit: r199007 - head/sys/fs/fifofs
Message-ID: <200911062229.nA6MTld2030248@svn.freebsd.org>

Author: attilio
Date: Fri Nov  6 22:29:46 2009
New Revision: 199007
URL: http://svn.freebsd.org/changeset/base/199007

Log:
  - Improve comments about locking of the "struct fifoinfo" which is a bit
    unclear.
  - Fix a memory leak [0]
  
  [0] Diagnosed by:	Dorr H. Clark 
  MFC:	1 week

Modified:
  head/sys/fs/fifofs/fifo_vnops.c

Modified: head/sys/fs/fifofs/fifo_vnops.c
==============================================================================
--- head/sys/fs/fifofs/fifo_vnops.c	Fri Nov  6 22:13:39 2009	(r199006)
+++ head/sys/fs/fifofs/fifo_vnops.c	Fri Nov  6 22:29:46 2009	(r199007)
@@ -78,6 +78,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;
@@ -223,14 +227,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) {
@@ -249,6 +248,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  Fri Nov  6 22:33:04 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Fri Nov  6 22:33:10 2009
Subject: svn commit: r199008 - head/sys/kern
Message-ID: <200911062233.nA6MX4v1030364@svn.freebsd.org>

Author: attilio
Date: Fri Nov  6 22:33:03 2009
New Revision: 199008
URL: http://svn.freebsd.org/changeset/base/199008

Log:
  Save the sack when doing a lockmgr_disown() call.
  
  Requested by:	kib
  MFC:		3 days

Modified:
  head/sys/kern/kern_lock.c

Modified: head/sys/kern/kern_lock.c
==============================================================================
--- head/sys/kern/kern_lock.c	Fri Nov  6 22:29:46 2009	(r199007)
+++ head/sys/kern/kern_lock.c	Fri Nov  6 22:33:03 2009	(r199008)
@@ -1086,6 +1086,7 @@ _lockmgr_disown(struct lock *lk, const c
 	LOCK_LOG_LOCK("XDISOWN", &lk->lock_object, 0, 0, file, line);
 	WITNESS_UNLOCK(&lk->lock_object, LOP_EXCLUSIVE, file, line);
 	TD_LOCKS_DEC(curthread);
+	STACK_SAVE(lk);
 
 	/*
 	 * In order to preserve waiters flags, just spin.
From yongari at FreeBSD.org  Fri Nov  6 22:37:29 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Fri Nov  6 22:37:35 2009
Subject: svn commit: r199009 - head/sys/dev/bge
Message-ID: <200911062237.nA6MbTvk030496@svn.freebsd.org>

Author: yongari
Date: Fri Nov  6 22:37:29 2009
New Revision: 199009
URL: http://svn.freebsd.org/changeset/base/199009

Log:
  bge(4) already switched to use UMA backed page allocator and local
  memory allocator for jumbo frame was removed long time ago. Remove
  no more used macros.

Modified:
  head/sys/dev/bge/if_bgereg.h

Modified: head/sys/dev/bge/if_bgereg.h
==============================================================================
--- head/sys/dev/bge/if_bgereg.h	Fri Nov  6 22:33:03 2009	(r199008)
+++ head/sys/dev/bge/if_bgereg.h	Fri Nov  6 22:37:29 2009	(r199009)
@@ -2481,13 +2481,6 @@ struct bge_gib {
 #define	BGE_MSLOTS	256
 #define	BGE_JSLOTS	384
 
-#define	BGE_JRAWLEN (BGE_JUMBO_FRAMELEN + ETHER_ALIGN)
-#define	BGE_JLEN (BGE_JRAWLEN + (sizeof(uint64_t) - \
-	(BGE_JRAWLEN % sizeof(uint64_t))))
-#define	BGE_JPAGESZ PAGE_SIZE
-#define	BGE_RESID (BGE_JPAGESZ - (BGE_JLEN * BGE_JSLOTS) % BGE_JPAGESZ)
-#define	BGE_JMEM ((BGE_JLEN * BGE_JSLOTS) + BGE_RESID)
-
 #define	BGE_NSEG_JUMBO	4
 #define	BGE_NSEG_NEW 32
 
From yongari at FreeBSD.org  Fri Nov  6 23:49:21 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Fri Nov  6 23:49:27 2009
Subject: svn commit: r199010 - head/sys/dev/bge
Message-ID: <200911062349.nA6NnKMM032015@svn.freebsd.org>

Author: yongari
Date: Fri Nov  6 23:49:20 2009
New Revision: 199010
URL: http://svn.freebsd.org/changeset/base/199010

Log:
  Do bus_dmamap_sync call only if frame size is greater than
  standard buffer size. If controller is not capable of handling
  jumbo frame, interface MTU couldn't be larger than standard MTU
  which in turn the received should be fit in standard buffer. This
  fixes bus_dmamap_sync call for jumbo ring is called even if
  interface is configured to use standard MTU.
  Also if total frame size could be fit into standard buffer don't
  use jumbo buffers.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Fri Nov  6 22:37:29 2009	(r199009)
+++ head/sys/dev/bge/if_bge.c	Fri Nov  6 23:49:20 2009	(r199010)
@@ -3134,7 +3134,8 @@ bge_rxeof(struct bge_softc *sc)
 	    sc->bge_cdata.bge_rx_return_ring_map, BUS_DMASYNC_POSTREAD);
 	bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag,
 	    sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_POSTWRITE);
-	if (BGE_IS_JUMBO_CAPABLE(sc))
+	if (ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN >
+	    (MCLBYTES - ETHER_ALIGN))
 		bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag,
 		    sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_POSTWRITE);
 
@@ -3266,7 +3267,7 @@ bge_rxeof(struct bge_softc *sc)
 		bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag,
 		    sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREWRITE);
 
-	if (BGE_IS_JUMBO_CAPABLE(sc) && jumbocnt > 0)
+	if (jumbocnt > 0)
 		bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag,
 		    sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE);
 
@@ -3920,7 +3921,8 @@ bge_init_locked(struct bge_softc *sc)
 	}
 
 	/* Init jumbo RX ring. */
-	if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) {
+	if (ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN >
+	    (MCLBYTES - ETHER_ALIGN)) {
 		if (bge_init_rx_ring_jumbo(sc) != 0) {
 			device_printf(sc->bge_dev, "no memory for std Rx buffers.\n");
 			bge_stop(sc);
From delphij at delphij.net  Fri Nov  6 23:52:38 2009
From: delphij at delphij.net (Xin LI)
Date: Fri Nov  6 23:52:50 2009
Subject: svn commit: r198848 - head/bin/ps
In-Reply-To: <20091103214231.H23957@delplex.bde.org>
References: <200911030928.nA39SjLx085597@svn.freebsd.org>
	<20091103214231.H23957@delplex.bde.org>
Message-ID: <4AF4B6B2.3090706@delphij.net>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bruce Evans wrote:
> On Tue, 3 Nov 2009, Xin LI wrote:
> 
>> Log:
>>  Increase width for %CPU, RSS and VSZ columns for now.  Modern systems
>>  tend to have larger memory, larger process, and more CPU.
> 
> This uses space that is not available.  Command names(+args) are now
> truncated to 9 columns in "ps l" output :-(.  They used to be truncated to
> 11 columns recently (down from 12 columns in FreeBSD-5.2).

I think we may have to live with this, even if we can cut down CPU
percentage part, the memory column's width is still too narrow for
modern systems.  I have actually thought about having the numbers
humanized but I'm afraid it would break some existing scripts :(

[...]
> There seems to be no better fix than to further granulate and dehumanize
> the numbers so that they fit in the available space.  E.g., a %CPU of
>> = 100 and < 9999 should be displayed in %4.0f format; this only
> involvues granulation, but above 9999 it needs to be dehumanized as
> well and displayed in k or M or larger granularity (it can be > 9999
> with 100 CPUs and > 999k with 10000 CPUs).  A VSZ of >= 10000 (k
> implicit) needs to be displayed in M or larger granularity (M explicit).

Will it sound reasonable to divide pcpu by ncpu and cap the number at 100?

Cheers,
- --
Xin LI 	http://www.delphij.net/
FreeBSD - The Power to Serve!	       Live free or die
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (FreeBSD)

iEYEARECAAYFAkr0trIACgkQi+vbBBjt66CxkwCeLjSGhfB438LAsqFcK6vCgdmY
0OIAn2OmQLRttIhvMYVjqQvYviLzgVBc
=C87q
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: keyword.c
===================================================================
--- keyword.c	(revision 199006)
+++ keyword.c	(working copy)
@@ -70,7 +70,7 @@
 
 /* PLEASE KEEP THE TABLE BELOW SORTED ALPHABETICALLY!!! */
 static VAR var[] = {
-	{"%cpu", "%CPU", NULL, 0, pcpu, NULL, 5, 0, CHAR, NULL, 0},
+	{"%cpu", "%CPU", NULL, 0, pcpu, NULL, 4, 0, CHAR, NULL, 0},
 	{"%mem", "%MEM", NULL, 0, pmem, NULL, 4, 0, CHAR, NULL, 0},
 	{"acflag", "ACFLG", NULL, 0, kvar, NULL, 3, KOFF(ki_acflag), USHORT,
 		"x", 0},
Index: nlist.c
===================================================================
--- nlist.c	(revision 199006)
+++ nlist.c	(working copy)
@@ -47,6 +47,7 @@
 int	nlistread;			/* if nlist already read. */
 unsigned long	mempages;		/* number of pages of phys. memory */
 int	fscale;				/* kernel _fscale variable */
+int	ncpu;				/* number of cpus */
 
 int
 donlist(void)
@@ -62,6 +63,9 @@
 	oldlen = sizeof(mempages);
 	if (sysctlbyname("hw.availpages", &mempages, &oldlen, NULL, 0) == -1)
 		return (1);
+	oldlen = sizeof(ncpu);
+	if (sysctlbyname("hw.ncpu", &ncpu, &oldlen, NULL, 0) == -1)
+		return (1);
 	nlistread = 1;
 	return (0);
 }
Index: extern.h
===================================================================
--- extern.h	(revision 199006)
+++ extern.h	(working copy)
@@ -36,7 +36,7 @@
 struct varent;
 
 extern fixpt_t ccpu;
-extern int cflag, eval, fscale, nlistread, rawcpu;
+extern int cflag, eval, fscale, ncpu, nlistread, rawcpu;
 extern unsigned long mempages;
 extern time_t now;
 extern int showthreads, sumrusage, termwidth, totwidth;
Index: print.c
===================================================================
--- print.c	(revision 199006)
+++ print.c	(working copy)
@@ -642,10 +642,13 @@
 void
 pcpu(KINFO *k, VARENT *ve)
 {
-	VAR *v;
+	VAR *v = ve->var;
+	double pctcpu = getpcpu(k);
 
-	v = ve->var;
-	(void)printf("%*.1f", v->width, getpcpu(k));
+	if (pctcpu / ncpu >= 100.0)
+		(void)printf(" 100");
+	else
+		(void)printf("%*.1f", v->width, pctcpu / ncpu);
 }
 
 static double
From yongari at FreeBSD.org  Sat Nov  7 01:01:34 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Sat Nov  7 01:01:46 2009
Subject: svn commit: r199011 - head/sys/dev/bge
Message-ID: <200911070101.nA711Xnh033382@svn.freebsd.org>

Author: yongari
Date: Sat Nov  7 01:01:33 2009
New Revision: 199011
URL: http://svn.freebsd.org/changeset/base/199011

Log:
  Reimplement Rx buffer allocation to handle dma map load failure.
  Introduce two spare dma maps for standard buffer and jumbo buffer
  respectively. If loading a dma map failed reuse previously loaded
  dma map. This should fix unloaded dma map is used in case of dma
  map load failure. Also don't blindly unload dma map and defer
  dma map sync and unloading operation until we know dma map for new
  buffer is successfully loaded. This change saves unnecessary dma
  load/unload operation. Previously bge(4) tried to reuse mbuf
  with unloaded dma map which is really bad thing in bus_dma(9)
  perspective.
  While I'm here update if_iqdrops if we can't allocate Rx buffers.

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bge/if_bgereg.h

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Fri Nov  6 23:49:20 2009	(r199010)
+++ head/sys/dev/bge/if_bge.c	Sat Nov  7 01:01:33 2009	(r199011)
@@ -393,8 +393,8 @@ static void bge_setpromisc(struct bge_so
 static void bge_setmulti(struct bge_softc *);
 static void bge_setvlan(struct bge_softc *);
 
-static int bge_newbuf_std(struct bge_softc *, int, struct mbuf *);
-static int bge_newbuf_jumbo(struct bge_softc *, int, struct mbuf *);
+static int bge_newbuf_std(struct bge_softc *, int);
+static int bge_newbuf_jumbo(struct bge_softc *, int);
 static int bge_init_rx_ring_std(struct bge_softc *);
 static void bge_free_rx_ring_std(struct bge_softc *);
 static int bge_init_rx_ring_jumbo(struct bge_softc *);
@@ -912,37 +912,38 @@ bge_miibus_statchg(device_t dev)
  * Intialize a standard receive ring descriptor.
  */
 static int
-bge_newbuf_std(struct bge_softc *sc, int i, struct mbuf *m)
+bge_newbuf_std(struct bge_softc *sc, int i)
 {
-	struct mbuf *m_new = NULL;
+	struct mbuf *m;
 	struct bge_rx_bd *r;
 	bus_dma_segment_t segs[1];
+	bus_dmamap_t map;
 	int error, nsegs;
 
-	if (m == NULL) {
-		m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
-		if (m_new == NULL)
-			return (ENOBUFS);
-		m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
-	} else {
-		m_new = m;
-		m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
-		m_new->m_data = m_new->m_ext.ext_buf;
-	}
-
+	m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
+	if (m == NULL)
+		return (ENOBUFS);
+	m->m_len = m->m_pkthdr.len = MCLBYTES;
 	if ((sc->bge_flags & BGE_FLAG_RX_ALIGNBUG) == 0)
-		m_adj(m_new, ETHER_ALIGN);
+		m_adj(m, ETHER_ALIGN);
+
 	error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_rx_mtag,
-	    sc->bge_cdata.bge_rx_std_dmamap[i], m_new, segs, &nsegs, 0);
+	    sc->bge_cdata.bge_rx_std_sparemap, m, segs, &nsegs, 0);
 	if (error != 0) {
-		if (m == NULL) {
-			sc->bge_cdata.bge_rx_std_chain[i] = NULL;
-			m_freem(m_new);
-		}
+		m_freem(m);
 		return (error);
 	}
-	sc->bge_cdata.bge_rx_std_chain[i] = m_new;
-	r = &sc->bge_ldata.bge_rx_std_ring[i];
+	if (sc->bge_cdata.bge_rx_std_chain[i] != NULL) {
+		bus_dmamap_sync(sc->bge_cdata.bge_rx_mtag,
+		    sc->bge_cdata.bge_rx_std_dmamap[i], BUS_DMASYNC_POSTREAD);
+		bus_dmamap_unload(sc->bge_cdata.bge_rx_mtag,
+		    sc->bge_cdata.bge_rx_std_dmamap[i]);
+	}
+	map = sc->bge_cdata.bge_rx_std_dmamap[i];
+	sc->bge_cdata.bge_rx_std_dmamap[i] = sc->bge_cdata.bge_rx_std_sparemap;
+	sc->bge_cdata.bge_rx_std_sparemap = map;
+	sc->bge_cdata.bge_rx_std_chain[i] = m;
+	r = &sc->bge_ldata.bge_rx_std_ring[sc->bge_std];
 	r->bge_addr.bge_addr_lo = BGE_ADDR_LO(segs[0].ds_addr);
 	r->bge_addr.bge_addr_hi = BGE_ADDR_HI(segs[0].ds_addr);
 	r->bge_flags = BGE_RXBDFLAG_END;
@@ -950,8 +951,7 @@ bge_newbuf_std(struct bge_softc *sc, int
 	r->bge_idx = i;
 
 	bus_dmamap_sync(sc->bge_cdata.bge_rx_mtag,
-	    sc->bge_cdata.bge_rx_std_dmamap[i],
-	    BUS_DMASYNC_PREREAD);
+	    sc->bge_cdata.bge_rx_std_dmamap[i], BUS_DMASYNC_PREREAD);
 
 	return (0);
 }
@@ -961,48 +961,49 @@ bge_newbuf_std(struct bge_softc *sc, int
  * a jumbo buffer from the pool managed internally by the driver.
  */
 static int
-bge_newbuf_jumbo(struct bge_softc *sc, int i, struct mbuf *m)
+bge_newbuf_jumbo(struct bge_softc *sc, int i)
 {
 	bus_dma_segment_t segs[BGE_NSEG_JUMBO];
+	bus_dmamap_t map;
 	struct bge_extrx_bd *r;
-	struct mbuf *m_new = NULL;
-	int nsegs;
-	int error;
+	struct mbuf *m;
+	int error, nsegs;
 
-	if (m == NULL) {
-		MGETHDR(m_new, M_DONTWAIT, MT_DATA);
-		if (m_new == NULL)
-			return (ENOBUFS);
+	MGETHDR(m, M_DONTWAIT, MT_DATA);
+	if (m == NULL)
+		return (ENOBUFS);
 
-		m_cljget(m_new, M_DONTWAIT, MJUM9BYTES);
-		if (!(m_new->m_flags & M_EXT)) {
-			m_freem(m_new);
-			return (ENOBUFS);
-		}
-		m_new->m_len = m_new->m_pkthdr.len = MJUM9BYTES;
-	} else {
-		m_new = m;
-		m_new->m_len = m_new->m_pkthdr.len = MJUM9BYTES;
-		m_new->m_data = m_new->m_ext.ext_buf;
+	m_cljget(m, M_DONTWAIT, MJUM9BYTES);
+	if (!(m->m_flags & M_EXT)) {
+		m_freem(m);
+		return (ENOBUFS);
 	}
-
+	m->m_len = m->m_pkthdr.len = MJUM9BYTES;
 	if ((sc->bge_flags & BGE_FLAG_RX_ALIGNBUG) == 0)
-		m_adj(m_new, ETHER_ALIGN);
+		m_adj(m, ETHER_ALIGN);
 
 	error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_mtag_jumbo,
-	    sc->bge_cdata.bge_rx_jumbo_dmamap[i],
-	    m_new, segs, &nsegs, BUS_DMA_NOWAIT);
-	if (error) {
-		if (m == NULL)
-			m_freem(m_new);
+	    sc->bge_cdata.bge_rx_jumbo_sparemap, m, segs, &nsegs, 0);
+	if (error != 0) {
+		m_freem(m);
 		return (error);
 	}
-	sc->bge_cdata.bge_rx_jumbo_chain[i] = m_new;
 
+	if (sc->bge_cdata.bge_rx_jumbo_chain[i] == NULL) {
+		bus_dmamap_sync(sc->bge_cdata.bge_mtag_jumbo,
+		    sc->bge_cdata.bge_rx_jumbo_dmamap[i], BUS_DMASYNC_POSTREAD);
+		bus_dmamap_unload(sc->bge_cdata.bge_mtag_jumbo,
+		    sc->bge_cdata.bge_rx_jumbo_dmamap[i]);
+	}
+	map = sc->bge_cdata.bge_rx_jumbo_dmamap[i];
+	sc->bge_cdata.bge_rx_jumbo_dmamap[i] =
+	    sc->bge_cdata.bge_rx_jumbo_sparemap;
+	sc->bge_cdata.bge_rx_jumbo_sparemap = map;
+	sc->bge_cdata.bge_rx_jumbo_chain[i] = m;
 	/*
 	 * Fill in the extended RX buffer descriptor.
 	 */
-	r = &sc->bge_ldata.bge_rx_jumbo_ring[i];
+	r = &sc->bge_ldata.bge_rx_jumbo_ring[sc->bge_jumbo];
 	r->bge_flags = BGE_RXBDFLAG_JUMBO_RING | BGE_RXBDFLAG_END;
 	r->bge_idx = i;
 	r->bge_len3 = r->bge_len2 = r->bge_len1 = 0;
@@ -1029,8 +1030,7 @@ bge_newbuf_jumbo(struct bge_softc *sc, i
 	}
 
 	bus_dmamap_sync(sc->bge_cdata.bge_mtag_jumbo,
-	    sc->bge_cdata.bge_rx_jumbo_dmamap[i],
-	    BUS_DMASYNC_PREREAD);
+	    sc->bge_cdata.bge_rx_jumbo_dmamap[i], BUS_DMASYNC_PREREAD);
 
 	return (0);
 }
@@ -1047,7 +1047,7 @@ bge_init_rx_ring_std(struct bge_softc *s
 	int error, i;
 
 	for (i = 0; i < BGE_SSLOTS; i++) {
-		if ((error = bge_newbuf_std(sc, i, NULL)) != 0)
+		if ((error = bge_newbuf_std(sc, i)) != 0)
 			return (error);
 	};
 
@@ -1088,7 +1088,7 @@ bge_init_rx_ring_jumbo(struct bge_softc 
 	int error, i;
 
 	for (i = 0; i < BGE_JUMBO_RX_RING_CNT; i++) {
-		if ((error = bge_newbuf_jumbo(sc, i, NULL)) != 0)
+		if ((error = bge_newbuf_jumbo(sc, i)) != 0)
 			return (error);
 	};
 
@@ -1979,6 +1979,9 @@ bge_dma_free(struct bge_softc *sc)
 			bus_dmamap_destroy(sc->bge_cdata.bge_rx_mtag,
 			    sc->bge_cdata.bge_rx_std_dmamap[i]);
 	}
+	if (sc->bge_cdata.bge_rx_std_sparemap)
+		bus_dmamap_destroy(sc->bge_cdata.bge_rx_mtag,
+		    sc->bge_cdata.bge_rx_std_sparemap);
 
 	/* Destroy DMA maps for jumbo RX buffers. */
 	for (i = 0; i < BGE_JUMBO_RX_RING_CNT; i++) {
@@ -1986,6 +1989,9 @@ bge_dma_free(struct bge_softc *sc)
 			bus_dmamap_destroy(sc->bge_cdata.bge_mtag_jumbo,
 			    sc->bge_cdata.bge_rx_jumbo_dmamap[i]);
 	}
+	if (sc->bge_cdata.bge_rx_jumbo_sparemap)
+		bus_dmamap_destroy(sc->bge_cdata.bge_mtag_jumbo,
+		    sc->bge_cdata.bge_rx_jumbo_sparemap);
 
 	/* Destroy DMA maps for TX buffers. */
 	for (i = 0; i < BGE_TX_RING_CNT; i++) {
@@ -2133,6 +2139,13 @@ bge_dma_alloc(device_t dev)
 	}
 
 	/* Create DMA maps for RX buffers. */
+	error = bus_dmamap_create(sc->bge_cdata.bge_rx_mtag, 0,
+	    &sc->bge_cdata.bge_rx_std_sparemap);
+	if (error) {
+		device_printf(sc->bge_dev,
+		    "can't create spare DMA map for RX\n");
+		return (ENOMEM);
+	}
 	for (i = 0; i < BGE_STD_RX_RING_CNT; i++) {
 		error = bus_dmamap_create(sc->bge_cdata.bge_rx_mtag, 0,
 			    &sc->bge_cdata.bge_rx_std_dmamap[i]);
@@ -2234,6 +2247,13 @@ bge_dma_alloc(device_t dev)
 		sc->bge_ldata.bge_rx_jumbo_ring_paddr = ctx.bge_busaddr;
 
 		/* Create DMA maps for jumbo RX buffers. */
+		error = bus_dmamap_create(sc->bge_cdata.bge_mtag_jumbo,
+		    0, &sc->bge_cdata.bge_rx_jumbo_sparemap);
+		if (error) {
+			device_printf(sc->bge_dev,
+			    "can't create sapre DMA map for jumbo RX\n");
+			return (ENOMEM);
+		}
 		for (i = 0; i < BGE_JUMBO_RX_RING_CNT; i++) {
 			error = bus_dmamap_create(sc->bge_cdata.bge_mtag_jumbo,
 				    0, &sc->bge_cdata.bge_rx_jumbo_dmamap[i]);
@@ -3166,43 +3186,29 @@ bge_rxeof(struct bge_softc *sc)
 		}
 
 		if (cur_rx->bge_flags & BGE_RXBDFLAG_JUMBO_RING) {
-			BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT);
-			bus_dmamap_sync(sc->bge_cdata.bge_mtag_jumbo,
-			    sc->bge_cdata.bge_rx_jumbo_dmamap[rxidx],
-			    BUS_DMASYNC_POSTREAD);
-			bus_dmamap_unload(sc->bge_cdata.bge_mtag_jumbo,
-			    sc->bge_cdata.bge_rx_jumbo_dmamap[rxidx]);
-			m = sc->bge_cdata.bge_rx_jumbo_chain[rxidx];
-			sc->bge_cdata.bge_rx_jumbo_chain[rxidx] = NULL;
 			jumbocnt++;
+			m = sc->bge_cdata.bge_rx_jumbo_chain[rxidx];
 			if (cur_rx->bge_flags & BGE_RXBDFLAG_ERROR) {
+				BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT);
 				ifp->if_ierrors++;
-				bge_newbuf_jumbo(sc, sc->bge_jumbo, m);
 				continue;
 			}
-			if (bge_newbuf_jumbo(sc, sc->bge_jumbo, NULL) != 0) {
-				ifp->if_ierrors++;
-				bge_newbuf_jumbo(sc, sc->bge_jumbo, m);
+			if (bge_newbuf_jumbo(sc, rxidx) != 0) {
+				BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT);
+				ifp->if_iqdrops++;
 				continue;
 			}
 		} else {
-			BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT);
-			bus_dmamap_sync(sc->bge_cdata.bge_rx_mtag,
-			    sc->bge_cdata.bge_rx_std_dmamap[rxidx],
-			    BUS_DMASYNC_POSTREAD);
-			bus_dmamap_unload(sc->bge_cdata.bge_rx_mtag,
-			    sc->bge_cdata.bge_rx_std_dmamap[rxidx]);
-			m = sc->bge_cdata.bge_rx_std_chain[rxidx];
-			sc->bge_cdata.bge_rx_std_chain[rxidx] = NULL;
 			stdcnt++;
 			if (cur_rx->bge_flags & BGE_RXBDFLAG_ERROR) {
+				BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT);
 				ifp->if_ierrors++;
-				bge_newbuf_std(sc, sc->bge_std, m);
 				continue;
 			}
-			if (bge_newbuf_std(sc, sc->bge_std, NULL) != 0) {
-				ifp->if_ierrors++;
-				bge_newbuf_std(sc, sc->bge_std, m);
+			m = sc->bge_cdata.bge_rx_std_chain[rxidx];
+			if (bge_newbuf_std(sc, rxidx) != 0) {
+				BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT);
+				ifp->if_iqdrops++;
 				continue;
 			}
 		}

Modified: head/sys/dev/bge/if_bgereg.h
==============================================================================
--- head/sys/dev/bge/if_bgereg.h	Fri Nov  6 23:49:20 2009	(r199010)
+++ head/sys/dev/bge/if_bgereg.h	Sat Nov  7 01:01:33 2009	(r199011)
@@ -2537,7 +2537,9 @@ struct bge_chain_data {
 	bus_dma_tag_t		bge_tx_mtag;	/* Tx mbuf mapping tag */
 	bus_dma_tag_t		bge_mtag_jumbo;	/* Jumbo mbuf mapping tag */
 	bus_dmamap_t		bge_tx_dmamap[BGE_TX_RING_CNT];
+	bus_dmamap_t		bge_rx_std_sparemap;
 	bus_dmamap_t		bge_rx_std_dmamap[BGE_STD_RX_RING_CNT];
+	bus_dmamap_t		bge_rx_jumbo_sparemap;
 	bus_dmamap_t		bge_rx_jumbo_dmamap[BGE_JUMBO_RX_RING_CNT];
 	bus_dmamap_t		bge_rx_std_ring_map;
 	bus_dmamap_t		bge_rx_jumbo_ring_map;
From yongari at FreeBSD.org  Sat Nov  7 01:14:10 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Sat Nov  7 01:14:22 2009
Subject: svn commit: r199012 - head/sys/dev/msk
Message-ID: <200911070114.nA71E9e5033624@svn.freebsd.org>

Author: yongari
Date: Sat Nov  7 01:14:09 2009
New Revision: 199012
URL: http://svn.freebsd.org/changeset/base/199012

Log:
  Add preliminary Yukon Ultra 2 support(88E8057). The controller
  looks very similar to Yukon EC Ultra.
  
  Tested by:	 kalin m ( kalin <> el dot net )

Modified:
  head/sys/dev/msk/if_msk.c
  head/sys/dev/msk/if_mskreg.h

Modified: head/sys/dev/msk/if_msk.c
==============================================================================
--- head/sys/dev/msk/if_msk.c	Sat Nov  7 01:01:33 2009	(r199011)
+++ head/sys/dev/msk/if_msk.c	Sat Nov  7 01:14:09 2009	(r199012)
@@ -222,6 +222,8 @@ static struct msk_product {
 	    "Marvell Yukon 88E8071 Gigabit Ethernet" },
 	{ VENDORID_MARVELL, DEVICEID_MRVL_436C,
 	    "Marvell Yukon 88E8072 Gigabit Ethernet" },
+	{ VENDORID_MARVELL, DEVICEID_MRVL_4380,
+	    "Marvell Yukon 88E8057 Gigabit Ethernet" },
 	{ VENDORID_DLINK, DEVICEID_DLINK_DGE550SX,
 	    "D-Link 550SX Gigabit Ethernet" },
 	{ VENDORID_DLINK, DEVICEID_DLINK_DGE560SX,
@@ -236,7 +238,9 @@ static const char *model_name[] = {
         "Yukon EX",
         "Yukon EC",
         "Yukon FE",
-        "Yukon FE+"
+        "Yukon FE+",
+        "Yukon Supreme",
+        "Yukon Ultra 2"
 };
 
 static int mskc_probe(device_t);
@@ -1143,6 +1147,7 @@ msk_phy_power(struct msk_softc *sc, int 
 		case CHIP_ID_YUKON_EC_U:
 		case CHIP_ID_YUKON_EX:
 		case CHIP_ID_YUKON_FE_P:
+		case CHIP_ID_YUKON_UL_2:
 			CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF);
 
 			/* Enable all clocks. */
@@ -1644,7 +1649,8 @@ mskc_attach(device_t dev)
 	sc->msk_hw_rev = (CSR_READ_1(sc, B2_MAC_CFG) >> 4) & 0x0f;
 	/* Bail out if chip is not recognized. */
 	if (sc->msk_hw_id < CHIP_ID_YUKON_XL ||
-	    sc->msk_hw_id > CHIP_ID_YUKON_FE_P) {
+	    sc->msk_hw_id > CHIP_ID_YUKON_UL_2 ||
+	    sc->msk_hw_id == CHIP_ID_YUKON_SUPR) {
 		device_printf(dev, "unknown device: id=0x%02x, rev=0x%02x\n",
 		    sc->msk_hw_id, sc->msk_hw_rev);
 		mtx_destroy(&sc->msk_mtx);
@@ -1743,6 +1749,10 @@ mskc_attach(device_t dev)
 		sc->msk_clock = 156;	/* 156 Mhz */
 		sc->msk_pflags |= MSK_FLAG_JUMBO;
 		break;
+	case CHIP_ID_YUKON_UL_2:
+		sc->msk_clock = 156;	/* 156 Mhz */
+		sc->msk_pflags |= MSK_FLAG_JUMBO;
+		break;
 	default:
 		sc->msk_clock = 156;	/* 156 Mhz */
 		break;

Modified: head/sys/dev/msk/if_mskreg.h
==============================================================================
--- head/sys/dev/msk/if_mskreg.h	Sat Nov  7 01:01:33 2009	(r199011)
+++ head/sys/dev/msk/if_mskreg.h	Sat Nov  7 01:14:09 2009	(r199012)
@@ -144,6 +144,7 @@
 #define DEVICEID_MRVL_436A	0x436A
 #define DEVICEID_MRVL_436B	0x436B
 #define DEVICEID_MRVL_436C	0x436C
+#define DEVICEID_MRVL_4380	0x4380
 
 /*
  * D-Link gigabit ethernet device ID
@@ -891,6 +892,8 @@
 #define CHIP_ID_YUKON_EC	0xb6 /* Chip ID for YUKON-2 EC */
 #define CHIP_ID_YUKON_FE	0xb7 /* Chip ID for YUKON-2 FE */
 #define CHIP_ID_YUKON_FE_P	0xb8 /* Chip ID for YUKON-2 FE+ */
+#define CHIP_ID_YUKON_SUPR	0xb9 /* Chip ID for YUKON-2 Supreme */
+#define CHIP_ID_YUKON_UL_2	0xba /* Chip ID for YUKON-2 Ultra 2 */
 
 #define	CHIP_REV_YU_XL_A0	0 /* Chip Rev. for Yukon-2 A0 */
 #define	CHIP_REV_YU_XL_A1	1 /* Chip Rev. for Yukon-2 A1 */
From yongari at FreeBSD.org  Sat Nov  7 01:18:03 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Sat Nov  7 01:18:09 2009
Subject: svn commit: r199013 - head/share/man/man4
Message-ID: <200911070118.nA71I33M033744@svn.freebsd.org>

Author: yongari
Date: Sat Nov  7 01:18:03 2009
New Revision: 199013
URL: http://svn.freebsd.org/changeset/base/199013

Log:
  88E8057(Ultra 2) is now supported.

Modified:
  head/share/man/man4/msk.4

Modified: head/share/man/man4/msk.4
==============================================================================
--- head/share/man/man4/msk.4	Sat Nov  7 01:14:09 2009	(r199012)
+++ head/share/man/man4/msk.4	Sat Nov  7 01:18:03 2009	(r199013)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 28, 2009
+.Dd November 6, 2009
 .Dt MSK 4
 .Os
 .Sh NAME
@@ -204,6 +204,8 @@ Marvell Yukon 88E8055 Gigabit Ethernet
 .It
 Marvell Yukon 88E8056 Gigabit Ethernet
 .It
+Marvell Yukon 88E8057 Gigabit Ethernet
+.It
 Marvell Yukon 88E8058 Gigabit Ethernet
 .It
 Marvell Yukon 88E8070 Gigabit Ethernet
From yongari at FreeBSD.org  Sat Nov  7 02:10:59 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Sat Nov  7 02:11:10 2009
Subject: svn commit: r199014 - head/sys/dev/bge
Message-ID: <200911070210.nA72AxTm034701@svn.freebsd.org>

Author: yongari
Date: Sat Nov  7 02:10:59 2009
New Revision: 199014
URL: http://svn.freebsd.org/changeset/base/199014

Log:
  Fix I mssied in r199011. Rx ring index also should be updated.
  If we fill Rx ring full instead of half we can simplify this logic
  but this requires more experimentation.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Sat Nov  7 01:18:03 2009	(r199013)
+++ head/sys/dev/bge/if_bge.c	Sat Nov  7 02:10:59 2009	(r199014)
@@ -1046,9 +1046,11 @@ bge_init_rx_ring_std(struct bge_softc *s
 {
 	int error, i;
 
+	sc->bge_std = 0;
 	for (i = 0; i < BGE_SSLOTS; i++) {
 		if ((error = bge_newbuf_std(sc, i)) != 0)
 			return (error);
+		BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT);
 	};
 
 	bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag,
@@ -1087,9 +1089,11 @@ bge_init_rx_ring_jumbo(struct bge_softc 
 	struct bge_rcb *rcb;
 	int error, i;
 
+	sc->bge_jumbo = 0;
 	for (i = 0; i < BGE_JUMBO_RX_RING_CNT; i++) {
 		if ((error = bge_newbuf_jumbo(sc, i)) != 0)
 			return (error);
+		BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT);
 	};
 
 	bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag,
@@ -3198,6 +3202,7 @@ bge_rxeof(struct bge_softc *sc)
 				ifp->if_iqdrops++;
 				continue;
 			}
+			BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT);
 		} else {
 			stdcnt++;
 			if (cur_rx->bge_flags & BGE_RXBDFLAG_ERROR) {
@@ -3211,6 +3216,7 @@ bge_rxeof(struct bge_softc *sc)
 				ifp->if_iqdrops++;
 				continue;
 			}
+			BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT);
 		}
 
 		ifp->if_ipackets++;
From avg at FreeBSD.org  Sat Nov  7 11:41:23 2009
From: avg at FreeBSD.org (Andriy Gapon)
Date: Sat Nov  7 11:41:30 2009
Subject: svn commit: r199015 - in head/sys: dev/ichwd modules/ichwd
Message-ID: <200911071141.nA7BfNXX046817@svn.freebsd.org>

Author: avg
Date: Sat Nov  7 11:41:23 2009
New Revision: 199015
URL: http://svn.freebsd.org/changeset/base/199015

Log:
  ichwd: don't attach to isa pnp device(s) by accident
  
  Reviewed by:	imp, des
  MFC after:	1 week

Modified:
  head/sys/dev/ichwd/ichwd.c
  head/sys/modules/ichwd/Makefile

Modified: head/sys/dev/ichwd/ichwd.c
==============================================================================
--- head/sys/dev/ichwd/ichwd.c	Sat Nov  7 02:10:59 2009	(r199014)
+++ head/sys/dev/ichwd/ichwd.c	Sat Nov  7 11:41:23 2009	(r199015)
@@ -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: head/sys/modules/ichwd/Makefile
==============================================================================
--- head/sys/modules/ichwd/Makefile	Sat Nov  7 02:10:59 2009	(r199014)
+++ head/sys/modules/ichwd/Makefile	Sat Nov  7 11:41:23 2009	(r199015)
@@ -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 avg at FreeBSD.org  Sat Nov  7 11:46:41 2009
From: avg at FreeBSD.org (Andriy Gapon)
Date: Sat Nov  7 11:46:47 2009
Subject: svn commit: r199016 - head/sys/dev/acpica
Message-ID: <200911071146.nA7BkcJn046957@svn.freebsd.org>

Author: avg
Date: Sat Nov  7 11:46:38 2009
New Revision: 199016
URL: http://svn.freebsd.org/changeset/base/199016

Log:
  acpi: remove 'magic' ivar
  
  o acpi_hpet: auto-added 'wildcard' devices can be identified by
    non-NULL handle attribute.
  o acpi_ec: auto-add 'wildcard' devices can be identified by
    unset (NULL) private attribute.
  o acpi_cpu: use private instead of magic to store cpu id.
  
  Reviewed by:	jhb
  Silence from:	acpi@
  MFC after:	2 weeks
  X-MFC-Note:	perhaps the ivar should stay for ABI stability

Modified:
  head/sys/dev/acpica/acpi.c
  head/sys/dev/acpica/acpi_cpu.c
  head/sys/dev/acpica/acpi_ec.c
  head/sys/dev/acpica/acpi_hpet.c
  head/sys/dev/acpica/acpivar.h

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Sat Nov  7 11:41:23 2009	(r199015)
+++ head/sys/dev/acpica/acpi.c	Sat Nov  7 11:46:38 2009	(r199016)
@@ -900,9 +900,6 @@ acpi_read_ivar(device_t dev, device_t ch
     case ACPI_IVAR_HANDLE:
 	*(ACPI_HANDLE *)result = ad->ad_handle;
 	break;
-    case ACPI_IVAR_MAGIC:
-	*(uintptr_t *)result = ad->ad_magic;
-	break;
     case ACPI_IVAR_PRIVATE:
 	*(void **)result = ad->ad_private;
 	break;
@@ -938,9 +935,6 @@ acpi_write_ivar(device_t dev, device_t c
     case ACPI_IVAR_HANDLE:
 	ad->ad_handle = (ACPI_HANDLE)value;
 	break;
-    case ACPI_IVAR_MAGIC:
-	ad->ad_magic = (uintptr_t)value;
-	break;
     case ACPI_IVAR_PRIVATE:
 	ad->ad_private = (void *)value;
 	break;

Modified: head/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- head/sys/dev/acpica/acpi_cpu.c	Sat Nov  7 11:41:23 2009	(r199015)
+++ head/sys/dev/acpica/acpi_cpu.c	Sat Nov  7 11:46:38 2009	(r199016)
@@ -255,7 +255,7 @@ acpi_cpu_probe(device_t dev)
 
     /* Mark this processor as in-use and save our derived id for attach. */
     cpu_softc[cpu_id] = (void *)1;
-    acpi_set_magic(dev, cpu_id);
+    acpi_set_private(dev, (void*)(intptr_t)cpu_id);
     device_set_desc(dev, "ACPI CPU");
 
     return (0);
@@ -286,7 +286,7 @@ acpi_cpu_attach(device_t dev)
     sc = device_get_softc(dev);
     sc->cpu_dev = dev;
     sc->cpu_handle = acpi_get_handle(dev);
-    cpu_id = acpi_get_magic(dev);
+    cpu_id = (int)(intptr_t)acpi_get_private(dev);
     cpu_softc[cpu_id] = sc;
     pcpu_data = pcpu_find(cpu_id);
     pcpu_data->pc_device = dev;

Modified: head/sys/dev/acpica/acpi_ec.c
==============================================================================
--- head/sys/dev/acpica/acpi_ec.c	Sat Nov  7 11:41:23 2009	(r199015)
+++ head/sys/dev/acpica/acpi_ec.c	Sat Nov  7 11:46:38 2009	(r199016)
@@ -129,9 +129,6 @@ struct acpi_ec_params {
     int		uid;
 };
 
-/* Indicate that this device has already been probed via ECDT. */
-#define DEV_ECDT(x)	(acpi_get_magic(x) == (uintptr_t)&acpi_ec_devclass)
-
 /*
  * Driver softc.
  */
@@ -332,7 +329,6 @@ acpi_ec_ecdt_probe(device_t parent)
     params->uid = ecdt->Uid;
     acpi_GetInteger(h, "_GLK", ¶ms->glk);
     acpi_set_private(child, params);
-    acpi_set_magic(child, (uintptr_t)&acpi_ec_devclass);
 
     /* Finish the attach process. */
     if (device_probe_and_attach(child) != 0)
@@ -348,6 +344,7 @@ acpi_ec_probe(device_t dev)
     ACPI_STATUS status;
     device_t	peer;
     char	desc[64];
+    int		ecdt;
     int		ret;
     struct acpi_ec_params *params;
     static char *ec_ids[] = { "PNP0C09", NULL };
@@ -362,11 +359,12 @@ acpi_ec_probe(device_t dev)
      * duplicate probe.
      */
     ret = ENXIO;
-    params = NULL;
+    ecdt = 0;
     buf.Pointer = NULL;
     buf.Length = ACPI_ALLOCATE_BUFFER;
-    if (DEV_ECDT(dev)) {
-	params = acpi_get_private(dev);
+    params = acpi_get_private(dev);
+    if (params != NULL) {
+	ecdt = 1;
 	ret = 0;
     } else if (!acpi_disabled("ec") &&
 	ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids)) {
@@ -439,7 +437,7 @@ out:
     if (ret == 0) {
 	snprintf(desc, sizeof(desc), "Embedded Controller: GPE %#x%s%s",
 		 params->gpe_bit, (params->glk) ? ", GLK" : "",
-		 DEV_ECDT(dev) ? ", ECDT" : "");
+		 ecdt ? ", ECDT" : "");
 	device_set_desc_copy(dev, desc);
     }
 

Modified: head/sys/dev/acpica/acpi_hpet.c
==============================================================================
--- head/sys/dev/acpica/acpi_hpet.c	Sat Nov  7 11:41:23 2009	(r199015)
+++ head/sys/dev/acpica/acpi_hpet.c	Sat Nov  7 11:46:38 2009	(r199016)
@@ -61,8 +61,6 @@ static void acpi_hpet_test(struct acpi_h
 
 static char *hpet_ids[] = { "PNP0103", NULL };
 
-#define DEV_HPET(x)	(acpi_get_magic(x) == (uintptr_t)&acpi_hpet_devclass)
-
 struct timecounter hpet_timecounter = {
 	.tc_get_timecount =	hpet_get_timecount,
 	.tc_counter_mask =	~0u,
@@ -133,8 +131,6 @@ acpi_hpet_identify(driver_t *driver, dev
 		return;
 	}
 
-	/* Record a magic value so we can detect this device later. */
-	acpi_set_magic(child, (uintptr_t)&acpi_hpet_devclass);
 	bus_set_resource(child, SYS_RES_MEMORY, 0, hpet->Address.Address,
 	    HPET_MEM_WIDTH);
 }
@@ -146,7 +142,7 @@ acpi_hpet_probe(device_t dev)
 
 	if (acpi_disabled("hpet"))
 		return (ENXIO);
-	if (!DEV_HPET(dev) &&
+	if (acpi_get_handle(dev) != NULL &&
 	    (ACPI_ID_PROBE(device_get_parent(dev), dev, hpet_ids) == NULL ||
 	    device_get_unit(dev) != 0))
 		return (ENXIO);

Modified: head/sys/dev/acpica/acpivar.h
==============================================================================
--- head/sys/dev/acpica/acpivar.h	Sat Nov  7 11:41:23 2009	(r199015)
+++ head/sys/dev/acpica/acpivar.h	Sat Nov  7 11:46:38 2009	(r199016)
@@ -88,7 +88,6 @@ struct acpi_softc {
 struct acpi_device {
     /* ACPI ivars */
     ACPI_HANDLE			ad_handle;
-    uintptr_t			ad_magic;
     void			*ad_private;
     int				ad_flags;
 
@@ -224,7 +223,7 @@ extern int	acpi_quirks;
  * attach to ACPI.
  */
 #define ACPI_IVAR_HANDLE	0x100
-#define ACPI_IVAR_MAGIC		0x101
+#define ACPI_IVAR_UNUSED	0x101	/* Unused/reserved. */
 #define ACPI_IVAR_PRIVATE	0x102
 #define ACPI_IVAR_FLAGS		0x103
 
@@ -250,7 +249,6 @@ static __inline void varp ## _set_ ## va
 }
 
 __ACPI_BUS_ACCESSOR(acpi, handle, ACPI, HANDLE, ACPI_HANDLE)
-__ACPI_BUS_ACCESSOR(acpi, magic, ACPI, MAGIC, uintptr_t)
 __ACPI_BUS_ACCESSOR(acpi, private, ACPI, PRIVATE, void *)
 __ACPI_BUS_ACCESSOR(acpi, flags, ACPI, FLAGS, int)
 
From rnoland at FreeBSD.org  Sat Nov  7 17:29:03 2009
From: rnoland at FreeBSD.org (Robert Noland)
Date: Sat Nov  7 17:29:10 2009
Subject: svn commit: r199017 - head/sys/geom/part
Message-ID: <200911071729.nA7HT3Gn059027@svn.freebsd.org>

Author: rnoland
Date: Sat Nov  7 17:29:03 2009
New Revision: 199017
URL: http://svn.freebsd.org/changeset/base/199017

Log:
  Fix handling of GPT headers when size is > 92 bytes.
  
  It is valid for an on-disk GPT header to report a header size which is
  greater than 92 bytes.  Previously, we would read in the sector and copy
  only the 92 bytes that we know how to deal with before calculating the
  checksum for comparison.  This meant that when we did the checksum, we
  overshot the buffer and took in random memory, so the checksum would fail.
  
  We now determine the size of the header and allocate enough space to
  preserve the entire on-disk contents.  This allows us to be correctly
  calculate the checksum and be able to modify and write the header back
  to the disk, while preserving data that we might not understand.
  
  Reported by:	Kris Weston
  Approved by:	marcel@
  MFC after:	2 weeks

Modified:
  head/sys/geom/part/g_part_gpt.c

Modified: head/sys/geom/part/g_part_gpt.c
==============================================================================
--- head/sys/geom/part/g_part_gpt.c	Sat Nov  7 11:46:38 2009	(r199016)
+++ head/sys/geom/part/g_part_gpt.c	Sat Nov  7 17:29:03 2009	(r199017)
@@ -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];
 };
@@ -143,13 +143,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;
@@ -161,63 +160,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 *
@@ -230,6 +241,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;
 
@@ -271,6 +285,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 &&
@@ -427,17 +444,17 @@ 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);
+	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);
 }
 
@@ -582,7 +599,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;
@@ -601,18 +618,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;
@@ -635,13 +652,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;
 		}
 	}
 
@@ -651,6 +672,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);
@@ -662,14 +685,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))
@@ -727,7 +752,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 */
@@ -741,21 +766,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);
@@ -766,7 +791,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. */
@@ -774,7 +799,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,
@@ -791,7 +816,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 xcllnt at mac.com  Sat Nov  7 18:25:38 2009
From: xcllnt at mac.com (Marcel Moolenaar)
Date: Sat Nov  7 18:25:50 2009
Subject: svn commit: r199017 - head/sys/geom/part
In-Reply-To: <200911071729.nA7HT3Gn059027@svn.freebsd.org>
References: <200911071729.nA7HT3Gn059027@svn.freebsd.org>
Message-ID: <537B322D-426E-4876-94FF-902EE9E3826D@mac.com>


On Nov 7, 2009, at 9:29 AM, Robert Noland wrote:

> Author: rnoland
> Date: Sat Nov  7 17:29:03 2009
> New Revision: 199017
> URL: http://svn.freebsd.org/changeset/base/199017
>
> Log:
>  Fix handling of GPT headers when size is > 92 bytes.

Thanks!

-- 
Marcel Moolenaar
xcllnt@mac.com



From dougb at FreeBSD.org  Sat Nov  7 18:42:54 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sat Nov  7 18:43:01 2009
Subject: svn commit: r199018 - head/sys/dev/wpi
Message-ID: <200911071842.nA7IgsNn060380@svn.freebsd.org>

Author: dougb
Date: Sat Nov  7 18:42:53 2009
New Revision: 199018
URL: http://svn.freebsd.org/changeset/base/199018

Log:
  Turn off WPI_DEBUG by default as the driver seems sufficiently stable
  at this point.
  
  Reviewed by:	benjsc, thompsa

Modified:
  head/sys/dev/wpi/if_wpi.c

Modified: head/sys/dev/wpi/if_wpi.c
==============================================================================
--- head/sys/dev/wpi/if_wpi.c	Sat Nov  7 17:29:03 2009	(r199017)
+++ head/sys/dev/wpi/if_wpi.c	Sat Nov  7 18:42:53 2009	(r199018)
@@ -103,8 +103,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#define WPI_DEBUG
-
 #ifdef WPI_DEBUG
 #define DPRINTF(x)	do { if (wpi_debug != 0) printf x; } while (0)
 #define DPRINTFN(n, x)	do { if (wpi_debug & n) printf x; } while (0)
From dougb at FreeBSD.org  Sat Nov  7 18:55:40 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sat Nov  7 18:55:46 2009
Subject: svn commit: r199019 - head/contrib/bind9/bin/dig
Message-ID: <200911071855.nA7Itd9b060744@svn.freebsd.org>

Author: dougb
Date: Sat Nov  7 18:55:39 2009
New Revision: 199019
URL: http://svn.freebsd.org/changeset/base/199019

Log:
  Wrap some socket handling code in a !NULL bow
  
  This patch or something similar will likely be included in a future
  BIND release.
  
  PR:		bin/138061
  Submitted by:	Michael Baker 
  Original patch submitted by:	Volker 
  Patch reviewed and tweaked by:	ISC

Modified:
  head/contrib/bind9/bin/dig/dighost.c

Modified: head/contrib/bind9/bin/dig/dighost.c
==============================================================================
--- head/contrib/bind9/bin/dig/dighost.c	Sat Nov  7 18:42:53 2009	(r199018)
+++ head/contrib/bind9/bin/dig/dighost.c	Sat Nov  7 18:55:39 2009	(r199019)
@@ -2604,10 +2604,12 @@ connect_done(isc_task_t *task, isc_event
 
 	if (sevent->result == ISC_R_CANCELED) {
 		debug("in cancel handler");
-		isc_socket_detach(&query->sock);
-		sockcount--;
-		INSIST(sockcount >= 0);
-		debug("sockcount=%d", sockcount);
+		if (query->sock != NULL) {
+			isc_socket_detach(&query->sock);
+			sockcount--;
+			INSIST(sockcount >= 0);
+			debug("sockcount=%d", sockcount);
+		}
 		query->waiting_connect = ISC_FALSE;
 		isc_event_free(&event);
 		l = query->lookup;
From sam at freebsd.org  Sat Nov  7 19:00:24 2009
From: sam at freebsd.org (Sam Leffler)
Date: Sat Nov  7 19:00:30 2009
Subject: svn commit: r199018 - head/sys/dev/wpi
In-Reply-To: <200911071842.nA7IgsNn060380@svn.freebsd.org>
References: <200911071842.nA7IgsNn060380@svn.freebsd.org>
Message-ID: <4AF5C3C7.1020806@freebsd.org>

Doug Barton wrote:
> Author: dougb
> Date: Sat Nov  7 18:42:53 2009
> New Revision: 199018
> URL: http://svn.freebsd.org/changeset/base/199018
> 
> Log:
>   Turn off WPI_DEBUG by default as the driver seems sufficiently stable
>   at this point.
>   
>   Reviewed by:	benjsc, thompsa
> 
> Modified:
>   head/sys/dev/wpi/if_wpi.c
> 
> Modified: head/sys/dev/wpi/if_wpi.c
> ==============================================================================
> --- head/sys/dev/wpi/if_wpi.c	Sat Nov  7 17:29:03 2009	(r199017)
> +++ head/sys/dev/wpi/if_wpi.c	Sat Nov  7 18:42:53 2009	(r199018)
> @@ -103,8 +103,6 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  
> -#define WPI_DEBUG
> -
>  #ifdef WPI_DEBUG
>  #define DPRINTF(x)	do { if (wpi_debug != 0) printf x; } while (0)
>  #define DPRINTFN(n, x)	do { if (wpi_debug & n) printf x; } while (0)
> 
> 

The right thing to do is to set wpi_debug to 0 and leave the messages
compiled in.

	Sam

From yongari at FreeBSD.org  Sat Nov  7 20:37:39 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Sat Nov  7 20:37:50 2009
Subject: svn commit: r199020 - head/sys/dev/bge
Message-ID: <200911072037.nA7KbcWH062580@svn.freebsd.org>

Author: yongari
Date: Sat Nov  7 20:37:38 2009
New Revision: 199020
URL: http://svn.freebsd.org/changeset/base/199020

Log:
  Tell upper layer we support long frames. ether_ifattach()
  initializes it to ETHER_HDR_LEN so we have to override it after
  calling ether_ifattch().
  While I'm here remove setting if_mtu value, it's initialized in
  ether_ifattach().

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Sat Nov  7 18:55:39 2009	(r199019)
+++ head/sys/dev/bge/if_bge.c	Sat Nov  7 20:37:38 2009	(r199020)
@@ -2723,7 +2723,6 @@ bge_attach(device_t dev)
 	ifp->if_ioctl = bge_ioctl;
 	ifp->if_start = bge_start;
 	ifp->if_init = bge_init;
-	ifp->if_mtu = ETHERMTU;
 	ifp->if_snd.ifq_drv_maxlen = BGE_TX_RING_CNT - 1;
 	IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen);
 	IFQ_SET_READY(&ifp->if_snd);
@@ -2838,6 +2837,9 @@ again:
 	ether_ifattach(ifp, eaddr);
 	callout_init_mtx(&sc->bge_stat_ch, &sc->bge_mtx, 0);
 
+	/* Tell upper layer we support long frames. */
+	ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
+
 	/*
 	 * Hookup IRQ last.
 	 */
From dougb at FreeBSD.org  Sat Nov  7 20:52:06 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sat Nov  7 20:52:12 2009
Subject: svn commit: r199018 - head/sys/dev/wpi
In-Reply-To: <4AF5C3C7.1020806@freebsd.org>
References: <200911071842.nA7IgsNn060380@svn.freebsd.org>
	<4AF5C3C7.1020806@freebsd.org>
Message-ID: <4AF5DDFB.10107@FreeBSD.org>

Sam Leffler wrote:
> The right thing to do is to set wpi_debug to 0 and leave the messages
> compiled in.

Well as you can see from the diff I did leave the messages in the
source so that anyone who wants to enable debugging again can just
define WPI_DEBUG at build time to get it.

However defining WPI_DEBUG to 0 resulted in the debug messages being
printed on the console again so if I'm understanding what you're
suggesting correctly it seems that it would require a lot more changes
in the code to accomplish. (I did see other examples of what I think
you're suggesting in sys/ but this driver doesn't seem to have that
support.)

If I'm not understanding something or you have a better solution feel
free to implement it. My goal was just to get a less noisy console at
boot time.


Doug

-- 

	Improve the effectiveness of your Internet presence with
	a domain name makeover!    http://SupersetSolutions.com/

From dougb at FreeBSD.org  Sat Nov  7 21:02:41 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sat Nov  7 21:02:53 2009
Subject: svn commit: r199021 - head/games/fortune/datfiles
Message-ID: <200911072102.nA7L2e6H063173@svn.freebsd.org>

Author: dougb
Date: Sat Nov  7 21:02:40 2009
New Revision: 199021
URL: http://svn.freebsd.org/changeset/base/199021

Log:
  Remove the svn:executable property from this file

Modified:
Directory Properties:
  head/games/fortune/datfiles/gerrold.limerick   (props changed)
From dougb at FreeBSD.org  Sat Nov  7 21:28:23 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sat Nov  7 21:28:29 2009
Subject: svn commit: r199023 - head/games/fortune/datfiles
Message-ID: <200911072128.nA7LSLYX063800@svn.freebsd.org>

Author: dougb
Date: Sat Nov  7 21:28:21 2009
New Revision: 199023
URL: http://svn.freebsd.org/changeset/base/199023

Log:
  Move Warner's very funny comparison of VCS to anal sex into fortunes-o

Modified:
  head/games/fortune/datfiles/fortunes
  head/games/fortune/datfiles/fortunes-o.real

Modified: head/games/fortune/datfiles/fortunes
==============================================================================
--- head/games/fortune/datfiles/fortunes	Sat Nov  7 21:10:48 2009	(r199022)
+++ head/games/fortune/datfiles/fortunes	Sat Nov  7 21:28:21 2009	(r199023)
@@ -2516,12 +2516,6 @@ other people to screw things up when you
 yourself for far less money.  This article can help you.
 		-- Dave Barry, "The Taming of the Screw"
 %
-	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 you what I know, then," he decided.  "The pin I'm wearing
 means I'm a member of the IA.  That's Inamorati Anonymous.  An inamorato is
 somebody in love.  That's the worst addiction of all."

Modified: head/games/fortune/datfiles/fortunes-o.real
==============================================================================
--- head/games/fortune/datfiles/fortunes-o.real	Sat Nov  7 21:10:48 2009	(r199022)
+++ head/games/fortune/datfiles/fortunes-o.real	Sat Nov  7 21:28:21 2009	(r199023)
@@ -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
From attilio at FreeBSD.org  Sat Nov  7 21:46:34 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Sat Nov  7 21:46:46 2009
Subject: svn commit: r199024 - head/usr.bin/kdump
Message-ID: <200911072146.nA7LkYAr064300@svn.freebsd.org>

Author: attilio
Date: Sat Nov  7 21:46:34 2009
New Revision: 199024
URL: http://svn.freebsd.org/changeset/base/199024

Log:
  Use a safety belt for cases where corrupted narg can be passed to the
  ktrsyscall(). print_number() does decrement the number of arguments,
  leading to infinite loops for negative values.
  
  Reported by:	Patrick Lamaiziere ,
  		Jonathan Pascal 
  Submitted by:	jh
  PR:		bin/120055, kern/119564
  MFC:		1 week

Modified:
  head/usr.bin/kdump/kdump.c

Modified: head/usr.bin/kdump/kdump.c
==============================================================================
--- head/usr.bin/kdump/kdump.c	Sat Nov  7 21:28:21 2009	(r199023)
+++ head/usr.bin/kdump/kdump.c	Sat Nov  7 21:46:34 2009	(r199024)
@@ -799,7 +799,7 @@ ktrsyscall(struct ktr_syscall *ktr)
 				narg--;
 			}
 		}
-		while (narg) {
+		while (narg > 0) {
 			print_number(ip,narg,c);
 		}
 		(void)putchar(')');
From dougb at FreeBSD.org  Sat Nov  7 22:13:32 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sat Nov  7 22:13:48 2009
Subject: svn commit: r199025 - head/games/fortune/datfiles
Message-ID: <200911072213.nA7MDU4W064988@svn.freebsd.org>

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

Log:
  Properly sort a math fortune after the changes in r193486
  
  Properly sort fortunes added in r174879 and r174959

Modified:
  head/games/fortune/datfiles/fortunes

Modified: head/games/fortune/datfiles/fortunes
==============================================================================
--- head/games/fortune/datfiles/fortunes	Sat Nov  7 21:46:34 2009	(r199024)
+++ head/games/fortune/datfiles/fortunes	Sat Nov  7 22:13:29 2009	(r199025)
@@ -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
@@ -33065,6 +33065,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!
@@ -59764,6 +59768,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
 %
@@ -59804,18 +59819,3 @@ since I first called my brother's father
 Zymurgy's Law of Volunteer Labor:
 	People are always available for work in the past tense.
 %
-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
-%
-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
-%
From sam at freebsd.org  Sun Nov  8 00:39:50 2009
From: sam at freebsd.org (Sam Leffler)
Date: Sun Nov  8 00:39:57 2009
Subject: svn commit: r199018 - head/sys/dev/wpi
In-Reply-To: <4AF5DDFB.10107@FreeBSD.org>
References: <200911071842.nA7IgsNn060380@svn.freebsd.org>
	<4AF5C3C7.1020806@freebsd.org> <4AF5DDFB.10107@FreeBSD.org>
Message-ID: <4AF61355.2080903@freebsd.org>

Doug Barton wrote:
> Sam Leffler wrote:
>> The right thing to do is to set wpi_debug to 0 and leave the messages
>> compiled in.
> 
> Well as you can see from the diff I did leave the messages in the
> source so that anyone who wants to enable debugging again can just
> define WPI_DEBUG at build time to get it.
> 
> However defining WPI_DEBUG to 0 resulted in the debug messages being
> printed on the console again so if I'm understanding what you're
> suggesting correctly it seems that it would require a lot more changes
> in the code to accomplish. (I did see other examples of what I think
> you're suggesting in sys/ but this driver doesn't seem to have that
> support.)
> 
> If I'm not understanding something or you have a better solution feel
> free to implement it. My goal was just to get a less noisy console at
> boot time.

Try the attached

	Sam

-------------- next part --------------
Index: if_wpi.c
===================================================================
--- if_wpi.c	(revision 199033)
+++ if_wpi.c	(working copy)
@@ -103,6 +103,8 @@
 #include 
 #include 
 
+#define WPI_DEBUG
+
 #ifdef WPI_DEBUG
 #define DPRINTF(x)	do { if (wpi_debug != 0) printf x; } while (0)
 #define DPRINTFN(n, x)	do { if (wpi_debug & n) printf x; } while (0)
@@ -124,7 +126,7 @@
 	WPI_DEBUG_ANY		= 0xffffffff
 };
 
-static int wpi_debug = 1;
+static int wpi_debug = 0;
 SYSCTL_INT(_debug, OID_AUTO, wpi, CTLFLAG_RW, &wpi_debug, 0, "wpi debug level");
 TUNABLE_INT("debug.wpi", &wpi_debug);
 
From yongari at FreeBSD.org  Sun Nov  8 01:13:39 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Sun Nov  8 01:13:50 2009
Subject: svn commit: r199035 - head/sys/dev/bge
Message-ID: <200911080113.nA81Dcfe068996@svn.freebsd.org>

Author: yongari
Date: Sun Nov  8 01:13:38 2009
New Revision: 199035
URL: http://svn.freebsd.org/changeset/base/199035

Log:
  Don't count input errors twice, we always read input errors from
  MAC in bge_tick. Previously it used to show more number of input
  errors. I noticed actual input errors were less than 8% even for
  64 bytes UDP frames generated by netperf.
  Since we always access BGE_RXLP_LOCSTAT_IFIN_DROPS register in
  bge_tick, remove useless code protected by #ifdef notyet.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Sun Nov  8 00:50:12 2009	(r199034)
+++ head/sys/dev/bge/if_bge.c	Sun Nov  8 01:13:38 2009	(r199035)
@@ -3196,7 +3196,6 @@ bge_rxeof(struct bge_softc *sc)
 			m = sc->bge_cdata.bge_rx_jumbo_chain[rxidx];
 			if (cur_rx->bge_flags & BGE_RXBDFLAG_ERROR) {
 				BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT);
-				ifp->if_ierrors++;
 				continue;
 			}
 			if (bge_newbuf_jumbo(sc, rxidx) != 0) {
@@ -3209,7 +3208,6 @@ bge_rxeof(struct bge_softc *sc)
 			stdcnt++;
 			if (cur_rx->bge_flags & BGE_RXBDFLAG_ERROR) {
 				BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT);
-				ifp->if_ierrors++;
 				continue;
 			}
 			m = sc->bge_cdata.bge_rx_std_chain[rxidx];
@@ -3291,14 +3289,6 @@ bge_rxeof(struct bge_softc *sc)
 		bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std);
 	if (jumbocnt)
 		bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo);
-#ifdef notyet
-	/*
-	 * This register wraps very quickly under heavy packet drops.
-	 * If you need correct statistics, you can enable this check.
-	 */
-	if (BGE_IS_5705_PLUS(sc))
-		ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS);
-#endif
 	return (rx_npkts);
 }
 
From yongari at FreeBSD.org  Sun Nov  8 01:30:35 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Sun Nov  8 01:30:42 2009
Subject: svn commit: r199036 - head/sys/dev/bge
Message-ID: <200911080130.nA81UZq4069339@svn.freebsd.org>

Author: yongari
Date: Sun Nov  8 01:30:35 2009
New Revision: 199036
URL: http://svn.freebsd.org/changeset/base/199036

Log:
  Count number of inbound packets which were chosen to be discarded
  as input errors. Also count out of receive BDs as input errors.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Sun Nov  8 01:13:38 2009	(r199035)
+++ head/sys/dev/bge/if_bge.c	Sun Nov  8 01:30:35 2009	(r199036)
@@ -3547,7 +3547,9 @@ bge_stats_update_regs(struct bge_softc *
 	ifp->if_collisions += CSR_READ_4(sc, BGE_MAC_STATS +
 	    offsetof(struct bge_mac_stats_regs, etherStatsCollisions));
 
+	ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS);
 	ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS);
+	ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS);
 }
 
 static void
From dougb at FreeBSD.org  Sun Nov  8 02:33:34 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sun Nov  8 02:33:45 2009
Subject: svn commit: r199037 - head/sys/dev/wpi
Message-ID: <200911080233.nA82XXWG070635@svn.freebsd.org>

Author: dougb
Date: Sun Nov  8 02:33:33 2009
New Revision: 199037
URL: http://svn.freebsd.org/changeset/base/199037

Log:
  Properly turn off debugging
  
  LART applied (gently) by:	sam

Modified:
  head/sys/dev/wpi/if_wpi.c

Modified: head/sys/dev/wpi/if_wpi.c
==============================================================================
--- head/sys/dev/wpi/if_wpi.c	Sun Nov  8 01:30:35 2009	(r199036)
+++ head/sys/dev/wpi/if_wpi.c	Sun Nov  8 02:33:33 2009	(r199037)
@@ -103,6 +103,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#define WPI_DEBUG
+
 #ifdef WPI_DEBUG
 #define DPRINTF(x)	do { if (wpi_debug != 0) printf x; } while (0)
 #define DPRINTFN(n, x)	do { if (wpi_debug & n) printf x; } while (0)
@@ -124,7 +126,7 @@ enum {
 	WPI_DEBUG_ANY		= 0xffffffff
 };
 
-static int wpi_debug = 1;
+static int wpi_debug = 0;
 SYSCTL_INT(_debug, OID_AUTO, wpi, CTLFLAG_RW, &wpi_debug, 0, "wpi debug level");
 TUNABLE_INT("debug.wpi", &wpi_debug);
 
From dougb at FreeBSD.org  Sun Nov  8 02:34:24 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sun Nov  8 02:34:30 2009
Subject: svn commit: r199018 - head/sys/dev/wpi
In-Reply-To: <4AF61355.2080903@freebsd.org>
References: <200911071842.nA7IgsNn060380@svn.freebsd.org>
	<4AF5C3C7.1020806@freebsd.org> <4AF5DDFB.10107@FreeBSD.org>
	<4AF61355.2080903@freebsd.org>
Message-ID: <4AF62E36.6080203@FreeBSD.org>

Sam Leffler wrote:
> Try the attached

Ok, I'm an idiot, thanks. :)


Doug

-- 

	Improve the effectiveness of your Internet presence with
	a domain name makeover!    http://SupersetSolutions.com/

From dougb at FreeBSD.org  Sun Nov  8 02:55:58 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Sun Nov  8 02:56:04 2009
Subject: svn commit: r198781 - head/lib/libc/sys
In-Reply-To: <200911021955.02459.max@love2party.net>
References: <200911020721.nA27LDq1048764@svn.freebsd.org>
	
	<4AEF22E3.5070701@freebsd.org>
	<200911021955.02459.max@love2party.net>
Message-ID: <4AF63344.6080803@FreeBSD.org>

Max Laier wrote:
> On Monday 02 November 2009 19:20:19 Colin Percival wrote:
>> Robert Watson wrote:
>>> On Mon, 2 Nov 2009, Colin Percival wrote:
>>>>  Attempt to reduce accidental foot-shooting by pointing out that
>>>>  accept(2)ed sockets do not necessarily inherit O_NONBLOCK from
>>>>  listening sockets on non-FreeBSD platforms.
>>> I wonder how much trouble we should go to to document bugs in other
>>> systems as non-portabilities for features that work in our system.
>> I don't think there's any simple rule to apply here except "use common
>> sense".  One can argue that FreeBSD man pages exist for the purpose of
>> documenting FreeBSD; but I'd also like to think that FreeBSD is a good
>> development platform for writing portable applications, so alerting our
>> users to potentially non-portable code certainly has some value.  (And
> 
> +1 ... FreeBSD is such a great development platform specifically because of 
> the complete man page collection.  I'd argue, however, that we should keep the 
> portability notes to the fact that there might be a difference - without going 
> into too much detail what/where and why that difference is.  In addition, the 
> more detail we add, the more likely it is that the information grows stale

FWIW I agree here. Portability notes == good, details == bad; although
I would include enough information in the notes so that an interested
party can find the appropriate external reference(s).


Doug

-- 

	Improve the effectiveness of your Internet presence with
	a domain name makeover!    http://SupersetSolutions.com/

From luigi at FreeBSD.org  Sun Nov  8 08:59:41 2009
From: luigi at FreeBSD.org (Luigi Rizzo)
Date: Sun Nov  8 08:59:52 2009
Subject: svn commit: r199040 - head/release/picobsd/bridge
Message-ID: <200911080859.nA88xe2M079375@svn.freebsd.org>

Author: luigi
Date: Sun Nov  8 08:59:40 2009
New Revision: 199040
URL: http://svn.freebsd.org/changeset/base/199040

Log:
  create an SMP kernel by default in picobsd

Modified:
  head/release/picobsd/bridge/PICOBSD

Modified: head/release/picobsd/bridge/PICOBSD
==============================================================================
--- head/release/picobsd/bridge/PICOBSD	Sun Nov  8 07:31:42 2009	(r199039)
+++ head/release/picobsd/bridge/PICOBSD	Sun Nov  8 08:59:40 2009	(r199040)
@@ -11,11 +11,14 @@ hints	"PICOBSD.hints"
 # values accessible through getenv()
 # env		"PICOBSD.env"
 
-cpu		I486_CPU
+#cpu		I486_CPU
 cpu		I586_CPU
 cpu		I686_CPU
 ident		PICOBSD
 
+options		SMP
+device	apic
+
 options		SCHED_4BSD		# mandatory to have one scheduler
 #options	MATH_EMULATE		#Support for x87 emulation
 options 	INET			#InterNETworking
From trasz at FreeBSD.org  Sun Nov  8 09:54:26 2009
From: trasz at FreeBSD.org (Edward Tomasz Napierala)
Date: Sun Nov  8 09:54:32 2009
Subject: svn commit: r199041 - head/sys/kern
Message-ID: <200911080954.nA89sPUX080619@svn.freebsd.org>

Author: trasz
Date: Sun Nov  8 09:54:25 2009
New Revision: 199041
URL: http://svn.freebsd.org/changeset/base/199041

Log:
  Add suggestion for zfs root.

Modified:
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c	Sun Nov  8 08:59:40 2009	(r199040)
+++ head/sys/kern/vfs_mount.c	Sun Nov  8 09:54:25 2009	(r199041)
@@ -1892,6 +1892,7 @@ vfs_mountroot_ask(void)
 		freeenv(options);
 		printf("\nManual root filesystem specification:\n");
 		printf("  :  Mount  using filesystem \n");
+		printf("                       eg. zfs:tank\n");
 		printf("                       eg. ufs:/dev/da0s1a\n");
 		printf("                       eg. cd9660:/dev/acd0\n");
 		printf("                       This is equivalent to: ");
From gabor at FreeBSD.org  Sun Nov  8 11:32:40 2009
From: gabor at FreeBSD.org (Gabor Kovesdan)
Date: Sun Nov  8 11:32:46 2009
Subject: svn commit: r199042 - head/lib/libc/nls
Message-ID: <200911081132.nA8BWerU084097@svn.freebsd.org>

Author: gabor (doc,ports committer)
Date: Sun Nov  8 11:32:39 2009
New Revision: 199042
URL: http://svn.freebsd.org/changeset/base/199042

Log:
  - Update Ukranian catalog
  
  Submitted by:	Alex Kozlov  (via private mail)

Modified:
  head/lib/libc/nls/uk_UA.UTF-8.msg   (contents, props changed)

Modified: head/lib/libc/nls/uk_UA.UTF-8.msg
==============================================================================
--- head/lib/libc/nls/uk_UA.UTF-8.msg	Sun Nov  8 09:54:25 2009	(r199041)
+++ head/lib/libc/nls/uk_UA.UTF-8.msg	Sun Nov  8 11:32:39 2009	(r199042)
@@ -181,6 +181,16 @@ $ ENOATTR
 87 ??????? ?? ????????
 $ EDOOFUS
 88 ??????? ?????????????
+$ EBADMSG
+89 ??????? ?????? ????????????
+$ EMULTIHOP XXX
+90 ?????? ?????????
+$ ENOLINK
+91 ????????? ????? ?????????
+$ EPROTO
+92 ??????? ?????????
+$ ENOTCAPABLE
+93 ?????????? ??????????
 $
 $ strsignal() support catalog
 $
From mav at FreeBSD.org  Sun Nov  8 11:33:51 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Sun Nov  8 11:33:58 2009
Subject: svn commit: r199043 - in head: share/man/man4 sys/dev/hptrr
Message-ID: <200911081133.nA8BXpa5084169@svn.freebsd.org>

Author: mav
Date: Sun Nov  8 11:33:51 2009
New Revision: 199043
URL: http://svn.freebsd.org/changeset/base/199043

Log:
  Introduce hw.hptrr.attach_generic loader tunable to deny hptrr driver
  attach chips with generic Marvell (non-HighPoint) PCI identification.
  These chips are also supported by ata(4). Some vendors, like Supermicro,
  are using same chips without providing HPT RAID BIOS.
  
  PR:		kern/120842, kern/136750

Modified:
  head/share/man/man4/hptrr.4
  head/sys/dev/hptrr/hptrr_osm_bsd.c

Modified: head/share/man/man4/hptrr.4
==============================================================================
--- head/share/man/man4/hptrr.4	Sun Nov  8 11:32:39 2009	(r199042)
+++ head/share/man/man4/hptrr.4	Sun Nov  8 11:33:51 2009	(r199043)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 14, 2007
+.Dd November 8, 2009
 .Dt HPTRR 4
 .Os
 .Sh NAME
@@ -46,6 +46,14 @@ module at boot time, place the following
 .Bd -literal -offset indent
 hptrr_load="YES"
 .Ed
+.Pp
+The following tunables are settable from the loader:
+.Bl -ohang
+.It Va hw.hptrr.attach_generic
+set to 0 to deny driver attach to chips with generic Marvell (non-HighPoint)
+PCI identification. These chips are also supported by ata(4).
+Some vendors are using same chips, but without providing RAID BIOS.
+.El
 .Sh DESCRIPTION
 The
 .Nm
@@ -101,6 +109,7 @@ manual page for details on support.
 .Pp
 This driver supersedes the older rr232x driver.
 .Sh SEE ALSO
+.Xr ata 4 ,
 .Xr cam 4 ,
 .Xr hptmv 4 ,
 .Xr loader 8

Modified: head/sys/dev/hptrr/hptrr_osm_bsd.c
==============================================================================
--- head/sys/dev/hptrr/hptrr_osm_bsd.c	Sun Nov  8 11:32:39 2009	(r199042)
+++ head/sys/dev/hptrr/hptrr_osm_bsd.c	Sun Nov  8 11:33:51 2009	(r199043)
@@ -34,6 +34,9 @@
 #include 
 #include 
 
+static int attach_generic = 1;
+TUNABLE_INT("hw.hptrr.attach_generic", &attach_generic);
+
 static int hpt_probe(device_t dev)
 {
 	PCI_ID pci_id;
@@ -41,6 +44,9 @@ static int hpt_probe(device_t dev)
 	int i;
 	PHBA hba;
 
+	/* Some of supported chips are used not only by HPT. */
+	if (pci_get_vendor(dev) != 0x1103 && !attach_generic)
+		return (ENXIO);
 	for (him = him_list; him; him = him->next) {
 		for (i=0; him->get_supported_device_id(i, &pci_id); i++) {
 			if ((pci_get_vendor(dev) == pci_id.vid) &&
From gabor at FreeBSD.org  Sun Nov  8 11:55:04 2009
From: gabor at FreeBSD.org (Gabor Kovesdan)
Date: Sun Nov  8 11:55:10 2009
Subject: svn commit: r199044 - head/lib/libc/nls
Message-ID: <200911081155.nA8Bt3gP084689@svn.freebsd.org>

Author: gabor (doc,ports committer)
Date: Sun Nov  8 11:55:03 2009
New Revision: 199044
URL: http://svn.freebsd.org/changeset/base/199044

Log:
  - Strip trailing CRs
  
  Requested by:	Alex Kozlov  (via private mail)

Modified:
  head/lib/libc/nls/uk_UA.UTF-8.msg

Modified: head/lib/libc/nls/uk_UA.UTF-8.msg
==============================================================================
--- head/lib/libc/nls/uk_UA.UTF-8.msg	Sun Nov  8 11:33:51 2009	(r199043)
+++ head/lib/libc/nls/uk_UA.UTF-8.msg	Sun Nov  8 11:55:03 2009	(r199044)
@@ -1,259 +1,259 @@
-$ $FreeBSD$
-$
-$ Message catalog for uk_UA.UTF-8 locale
-$
-$ strerror() support catalog
-$
-$set 1
-$ EPERM
-1 ???????? ?? ?????????
-$ ENOENT
-2 ????? ?????? ????? ??? ????????
-$ ESRCH
-3 ????? ?????? ???????
-$ EINTR
-4 ????????? ?????? ???????
-$ EIO
-5 ??????? ?????-??????
-$ ENXIO
-6 ????? ?????? ???????? ??? ??????
-$ E2BIG
-7 ??????? ?????????? ????? ??????
-$ ENOEXEC
-8 ??????? ??????? ???????????? ?????
-$ EBADF
-9 ???????? ?????????? ?????
-$ ECHILD
-10 ????? ?????????? ???????
-$ EDEADLK
-11 ???????? ??????? ?????????? ????????
-$ ENOMEM
-12 ?? ????????? ???'???
-$ EACCES
-13 ??????? ? ???????
-$ EFAULT
-14 ??????? ??????
-$ ENOTBLK
-15 ???????? ??????? ????????
-$ EBUSY
-16 ?????? ????????
-$ EEXIST
-17 ???? ??? ?????
-$ EXDEV
-18 ????????? ?? ???? ????????
-$ ENODEV
-19 ????? ?????? ????????
-$ ENOTDIR
-20 ?? ?? ???????
-$ EISDIR
-21 ?? ???????
-$ EINVAL
-22 ???????????? ????????
-$ ENFILE
-23 ???????? ????????? ?????? ? ???????
-$ EMFILE
-24 ???????? ????????? ??????
-$ ENOTTY
-25 ?? ?? ????????
-$ ETXTBSY
-26 ????????? ???? ????????
-$ EFBIG
-27 ???? ????? ???????
-$ ENOSPC
-28 ?? ?????????? ????? ?? ????????
-$ ESPIPE
-29 ??????????? ??????????????
-$ EROFS
-30 ??????? ??????? ???? ??? ???????
-$ EMLINK
-31 ???????? ????????
-$ EPIPE
-32 ????? ??????????
-$ EDOM
-33 ??????? ??????? ??????????
-$ ERANGE
-34 ????????? ????? ???????
-$ EAGAIN, EWOULDBLOCK
-35 ?????? ????????? ?? ?????????
-$ EINPROGRESS
-36 ???????? ? ??????? ?????????
-$ EALREADY
-37 ???????? ??? ???????????
-$ ENOTSOCK
-38 ?? ?? ?????
-$ EDESTADDRREQ
-39 ????????? ?????? ???????????
-$ EMSGSIZE
-40 ???????????? ????? ?????
-$ EPROTOTYPE
-41 ?????????? ??? ????????? ??? ??????
-$ ENOPROTOOPT
-42 ????? ?????? ?????????
-$ EPROTONOSUPPORT
-43 ???????? ?? ?????????????
-$ ESOCKTNOSUPPORT
-44 ??? ??? ?????? ?? ?????????????
-$ EOPNOTSUPP
-45 ???????? ?? ?????????????
-$ EPFNOSUPPORT
-46 ?????? ?????????? ?? ?????????????
-$ EAFNOSUPPORT
-47 ?????? ????? ?? ????????????? ??????????
-$ EADDRINUSE
-48 ?????? ??? ????????????????
-$ EADDRNOTAVAIL
-49 ?????? ?????????
-$ ENETDOWN
-50 ?????? ?? ??????
-$ ENETUNREACH
-51 ?????? ?????????
-$ ENETRESET
-52 ?'??????? ????????? ???????
-$ ECONNABORTED
-53 ?'??????? ?????????
-$ ECONNRESET
-54 ?'??????? ????????? ??????????? ????????
-$ ENOBUFS
-55 ????? ??????? ???????
-$ EISCONN
-56 ????? ??? ???'??????
-$ ENOTCONN
-57 ????? ?? ???'??????
-$ ESHUTDOWN
-58 ?? ???? ????????? ????? ???????? ?????? ??????????? ????????
-$ ETOOMANYREFS
-59 ???????? ????????: ?? ???? ?'??????
-$ ETIMEDOUT
-60 ?????? ????? ???? ??? ?'???????
-$ ECONNREFUSED
-61 ??????? ? ?'???????
-$ ELOOP
-62 ???????? ?????? ??????????? ????????
-$ ENAMETOOLONG
-63 ??'? ????? ????? ?????
-$ EHOSTDOWN
-64 ???? ?? ??????
-$ EHOSTUNREACH
-65 ???? ??????????
-$ ENOTEMPTY
-66 ??????? ?? ????????
-$ EPROCLIM
-67 ???????? ????????
-$ EUSERS
-68 ???????? ????????????
-$ EDQUOT
-69 ?????????? ??????? ?????
-$ ESTALE
-70 ?????????? ?????????? ????? NFS
-$ EREMOTE
-71 ?????????? ??'???
-$ EBADRPC
-72 ?????? ????????? RPC
-$ ERPCMISMATCH
-73 ??????? ?????? RPC
-$ EPROGUNAVAIL
-74 ???????? RPC ?????????
-$ EPROGMISMATCH
-75 ??????? ?????? ????????
-$ EPROCUNAVAIL
-76 ?????? ????????? ??? ????????
-$ ENOLCK
-77 ?????????? ?? ????????
-$ ENOSYS
-78 ??????? ?? ???????????
-$ EFTYPE
-79 ??????????? ??? ?? ?????? ?????
-$ EAUTH
-80 ??????? ??????????????
-$ ENEEDAUTH
-81 ???????? ??????????????
-$ EIDRM
-82 ????????????? ????????
-$ ENOMSG
-83 ????? ???????????? ???????? ????
-$ EOVERFLOW
-84 ???????? ???????? ??? ????? ???? ?????
-$ ECANCELED
-85 ???????? ?????????
-$ EILSEQ
-86 ??????????? ????????????? ??????
-$ ENOATTR
-87 ??????? ?? ????????
-$ EDOOFUS
-88 ??????? ?????????????
-$ EBADMSG
-89 ??????? ?????? ????????????
-$ EMULTIHOP XXX
-90 ?????? ?????????
-$ ENOLINK
-91 ????????? ????? ?????????
-$ EPROTO
-92 ??????? ?????????
-$ ENOTCAPABLE
-93 ?????????? ??????????
-$
-$ strsignal() support catalog
-$
-$set 2
-$ SIGHUP
-1 ???????????
-$ SIGINT
-2 ???????????
-$ SIGQUIT
-3 ?????
-$ SIGILL
-4 ???????????? ??????????
-$ SIGTRAP
-5 ?????? ??????????
-$ SIGABRT
-6 ???????? ??????????
-$ SIGEMT
-7 ???????????? ??????????? ??????????
-$ SIGFPE
-8 ??????? ?????? ? ????????? ???????
-$ SIGKILL
-9 ?????
-$ SIGBUS
-10 ??????? ????
-$ SIGSEGV
-11 ????????? ???????????
-$ SIGSYS
-12 ??????? ????????? ??????
-$ SIGPIPE
-13 ????? ??????????
-$ SIGALRM
-14 ?????? ?????????
-$ SIGTERM
-15 ??????????
-$ SIGURG
-16 ???????????? ???? ?? ??????
-$ SIGSTOP
-17 ??????????? (??????)
-$ SIGTSTP
-18 ???????????
-$ SIGCONT
-19 ??????????? ??????
-$ SIGCHLD
-20 ????? ??????? ?????????? ???????
-$ SIGTTIN
-21 ???????? (???? ? ?????????)
-$ SIGTTOU
-22 ???????? (????? ?? ????????)
-$ SIGIO
-23 ????-????? ????????
-$ SIGXCPU
-24 ?????????? ????? ???????????? ????
-$ SIGXFSZ
-25 ?????????? ????? ????????????? ??????? ?????
-$ SIGVTALRM
-26 ??????????? ?????? ?????????
-$ SIGPROF
-27 ?????? ???????????? ?????????
-$ SIGWINCH
-28 ?????? ????? ???????
-$ SIGINFO
-29 ????? ??????????
-$ SIGUSR1
-30 ?????? ??????????? 1
-$ SIGUSR2
-31 ?????? ??????????? 2
+$ $FreeBSD$
+$
+$ Message catalog for uk_UA.UTF-8 locale
+$
+$ strerror() support catalog
+$
+$set 1
+$ EPERM
+1 ???????? ?? ?????????
+$ ENOENT
+2 ????? ?????? ????? ??? ????????
+$ ESRCH
+3 ????? ?????? ???????
+$ EINTR
+4 ????????? ?????? ???????
+$ EIO
+5 ??????? ?????-??????
+$ ENXIO
+6 ????? ?????? ???????? ??? ??????
+$ E2BIG
+7 ??????? ?????????? ????? ??????
+$ ENOEXEC
+8 ??????? ??????? ???????????? ?????
+$ EBADF
+9 ???????? ?????????? ?????
+$ ECHILD
+10 ????? ?????????? ???????
+$ EDEADLK
+11 ???????? ??????? ?????????? ????????
+$ ENOMEM
+12 ?? ????????? ???'???
+$ EACCES
+13 ??????? ? ???????
+$ EFAULT
+14 ??????? ??????
+$ ENOTBLK
+15 ???????? ??????? ????????
+$ EBUSY
+16 ?????? ????????
+$ EEXIST
+17 ???? ??? ?????
+$ EXDEV
+18 ????????? ?? ???? ????????
+$ ENODEV
+19 ????? ?????? ????????
+$ ENOTDIR
+20 ?? ?? ???????
+$ EISDIR
+21 ?? ???????
+$ EINVAL
+22 ???????????? ????????
+$ ENFILE
+23 ???????? ????????? ?????? ? ???????
+$ EMFILE
+24 ???????? ????????? ??????
+$ ENOTTY
+25 ?? ?? ????????
+$ ETXTBSY
+26 ????????? ???? ????????
+$ EFBIG
+27 ???? ????? ???????
+$ ENOSPC
+28 ?? ?????????? ????? ?? ????????
+$ ESPIPE
+29 ??????????? ??????????????
+$ EROFS
+30 ??????? ??????? ???? ??? ???????
+$ EMLINK
+31 ???????? ????????
+$ EPIPE
+32 ????? ??????????
+$ EDOM
+33 ??????? ??????? ??????????
+$ ERANGE
+34 ????????? ????? ???????
+$ EAGAIN, EWOULDBLOCK
+35 ?????? ????????? ?? ?????????
+$ EINPROGRESS
+36 ???????? ? ??????? ?????????
+$ EALREADY
+37 ???????? ??? ???????????
+$ ENOTSOCK
+38 ?? ?? ?????
+$ EDESTADDRREQ
+39 ????????? ?????? ???????????
+$ EMSGSIZE
+40 ???????????? ????? ?????
+$ EPROTOTYPE
+41 ?????????? ??? ????????? ??? ??????
+$ ENOPROTOOPT
+42 ????? ?????? ?????????
+$ EPROTONOSUPPORT
+43 ???????? ?? ?????????????
+$ ESOCKTNOSUPPORT
+44 ??? ??? ?????? ?? ?????????????
+$ EOPNOTSUPP
+45 ???????? ?? ?????????????
+$ EPFNOSUPPORT
+46 ?????? ?????????? ?? ?????????????
+$ EAFNOSUPPORT
+47 ?????? ????? ?? ????????????? ??????????
+$ EADDRINUSE
+48 ?????? ??? ????????????????
+$ EADDRNOTAVAIL
+49 ?????? ?????????
+$ ENETDOWN
+50 ?????? ?? ??????
+$ ENETUNREACH
+51 ?????? ?????????
+$ ENETRESET
+52 ?'??????? ????????? ???????
+$ ECONNABORTED
+53 ?'??????? ?????????
+$ ECONNRESET
+54 ?'??????? ????????? ??????????? ????????
+$ ENOBUFS
+55 ????? ??????? ???????
+$ EISCONN
+56 ????? ??? ???'??????
+$ ENOTCONN
+57 ????? ?? ???'??????
+$ ESHUTDOWN
+58 ?? ???? ????????? ????? ???????? ?????? ??????????? ????????
+$ ETOOMANYREFS
+59 ???????? ????????: ?? ???? ?'??????
+$ ETIMEDOUT
+60 ?????? ????? ???? ??? ?'???????
+$ ECONNREFUSED
+61 ??????? ? ?'???????
+$ ELOOP
+62 ???????? ?????? ??????????? ????????
+$ ENAMETOOLONG
+63 ??'? ????? ????? ?????
+$ EHOSTDOWN
+64 ???? ?? ??????
+$ EHOSTUNREACH
+65 ???? ??????????
+$ ENOTEMPTY
+66 ??????? ?? ????????
+$ EPROCLIM
+67 ???????? ????????
+$ EUSERS
+68 ???????? ????????????
+$ EDQUOT
+69 ?????????? ??????? ?????
+$ ESTALE
+70 ?????????? ?????????? ????? NFS
+$ EREMOTE
+71 ?????????? ??'???
+$ EBADRPC
+72 ?????? ????????? RPC
+$ ERPCMISMATCH
+73 ??????? ?????? RPC
+$ EPROGUNAVAIL
+74 ???????? RPC ?????????
+$ EPROGMISMATCH
+75 ??????? ?????? ????????
+$ EPROCUNAVAIL
+76 ?????? ????????? ??? ????????
+$ ENOLCK
+77 ?????????? ?? ????????
+$ ENOSYS
+78 ??????? ?? ???????????
+$ EFTYPE
+79 ??????????? ??? ?? ?????? ?????
+$ EAUTH
+80 ??????? ??????????????
+$ ENEEDAUTH
+81 ???????? ??????????????
+$ EIDRM
+82 ????????????? ????????
+$ ENOMSG
+83 ????? ???????????? ???????? ????
+$ EOVERFLOW
+84 ???????? ???????? ??? ????? ???? ?????
+$ ECANCELED
+85 ???????? ?????????
+$ EILSEQ
+86 ??????????? ????????????? ??????
+$ ENOATTR
+87 ??????? ?? ????????
+$ EDOOFUS
+88 ??????? ?????????????
+$ EBADMSG
+89 ??????? ?????? ????????????
+$ EMULTIHOP XXX
+90 ?????? ?????????
+$ ENOLINK
+91 ????????? ????? ?????????
+$ EPROTO
+92 ??????? ?????????
+$ ENOTCAPABLE
+93 ?????????? ??????????
+$
+$ strsignal() support catalog
+$
+$set 2
+$ SIGHUP
+1 ???????????
+$ SIGINT
+2 ???????????
+$ SIGQUIT
+3 ?????
+$ SIGILL
+4 ???????????? ??????????
+$ SIGTRAP
+5 ?????? ??????????
+$ SIGABRT
+6 ???????? ??????????
+$ SIGEMT
+7 ???????????? ??????????? ??????????
+$ SIGFPE
+8 ??????? ?????? ? ????????? ???????
+$ SIGKILL
+9 ?????
+$ SIGBUS
+10 ??????? ????
+$ SIGSEGV
+11 ????????? ???????????
+$ SIGSYS
+12 ??????? ????????? ??????
+$ SIGPIPE
+13 ????? ??????????
+$ SIGALRM
+14 ?????? ?????????
+$ SIGTERM
+15 ??????????
+$ SIGURG
+16 ???????????? ???? ?? ??????
+$ SIGSTOP
+17 ??????????? (??????)
+$ SIGTSTP
+18 ???????????
+$ SIGCONT
+19 ??????????? ??????
+$ SIGCHLD
+20 ????? ??????? ?????????? ???????
+$ SIGTTIN
+21 ???????? (???? ? ?????????)
+$ SIGTTOU
+22 ???????? (????? ?? ????????)
+$ SIGIO
+23 ????-????? ????????
+$ SIGXCPU
+24 ?????????? ????? ???????????? ????
+$ SIGXFSZ
+25 ?????????? ????? ????????????? ??????? ?????
+$ SIGVTALRM
+26 ??????????? ?????? ?????????
+$ SIGPROF
+27 ?????? ???????????? ?????????
+$ SIGWINCH
+28 ?????? ????? ???????
+$ SIGINFO
+29 ????? ??????????
+$ SIGUSR1
+30 ?????? ??????????? 1
+$ SIGUSR2
+31 ?????? ??????????? 2
From brueffer at FreeBSD.org  Sun Nov  8 14:02:55 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Sun Nov  8 14:03:01 2009
Subject: svn commit: r199046 - head/lib/libc/gen
Message-ID: <200911081402.nA8E2s04087811@svn.freebsd.org>

Author: brueffer
Date: Sun Nov  8 14:02:54 2009
New Revision: 199046
URL: http://svn.freebsd.org/changeset/base/199046

Log:
  Fix a copy+paste error by checking the correct variable against MM_NULLACT.
  
  PR:		140386
  Submitted by:	soulcatcher 

Author: mav
Date: Sun Nov  8 14:33:19 2009
New Revision: 199050
URL: http://svn.freebsd.org/changeset/base/199050

Log:
  Introduce define and kernel option ATA_REQUEST_TIMEOUT to control ATA(4)
  command timeout.
  
  Submitted by:	keramida

Modified:
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/dev/ata/ata-all.h
  head/sys/dev/ata/ata-disk.c
  head/sys/dev/ata/ata-queue.c
  head/sys/dev/ata/ata-raid.c
  head/sys/dev/ata/atapi-cd.c

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/conf/NOTES	Sun Nov  8 14:33:19 2009	(r199050)
@@ -1715,8 +1715,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: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/conf/options	Sun Nov  8 14:33:19 2009	(r199050)
@@ -350,6 +350,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: head/sys/dev/ata/ata-all.h
==============================================================================
--- head/sys/dev/ata/ata-all.h	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/dev/ata/ata-all.h	Sun Nov  8 14:33:19 2009	(r199050)
@@ -345,6 +345,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: head/sys/dev/ata/ata-disk.c
==============================================================================
--- head/sys/dev/ata/ata-disk.c	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/dev/ata/ata-disk.c	Sun Nov  8 14:33:19 2009	(r199050)
@@ -230,7 +230,7 @@ ad_spindown(void *priv)
     }
     request->dev = dev;
     request->flags = ATA_R_CONTROL;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 1;
     request->callback = ad_power_callback;
     request->u.ata.command = ATA_STANDBY_IMMEDIATE;
@@ -262,10 +262,10 @@ 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 = 10;
+	request->timeout = ATA_REQUEST_TIMEOUT;
     }
     request->retries = 2;
     request->data = bp->bio_data;
@@ -468,7 +468,7 @@ ad_set_geometry(device_t dev)
     request->u.ata.count = 0;
     request->u.ata.feature = 0;
     request->flags = ATA_R_CONTROL | ATA_R_QUIET;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 0;
     ata_queue_request(request);
     if (request->status & ATA_S_ERROR)
@@ -487,7 +487,7 @@ ad_set_geometry(device_t dev)
     request->u.ata.count = 1;
     request->u.ata.feature = 0;
     request->flags = ATA_R_CONTROL;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 0;
     ata_queue_request(request);
     if (request->status & ATA_S_ERROR)

Modified: head/sys/dev/ata/ata-queue.c
==============================================================================
--- head/sys/dev/ata/ata-queue.c	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/dev/ata/ata-queue.c	Sun Nov  8 14:33:19 2009	(r199050)
@@ -141,9 +141,9 @@ ata_controlcmd(device_t dev, u_int8_t co
 	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 = 10;
+	    request->timeout = ATA_REQUEST_TIMEOUT;
 	}
 	request->retries = 0;
 	ata_queue_request(request);
@@ -397,7 +397,7 @@ ata_completed(void *context, int dummy)
 	    request->bytecount = sizeof(struct atapi_sense);
 	    request->donecount = 0;
 	    request->transfersize = sizeof(struct atapi_sense);
-	    request->timeout = 10;
+	    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: head/sys/dev/ata/ata-raid.c
==============================================================================
--- head/sys/dev/ata/ata-raid.c	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/dev/ata/ata-raid.c	Sun Nov  8 14:33:19 2009	(r199050)
@@ -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 = 10;
+	request->timeout = ATA_REQUEST_TIMEOUT;
 	request->retries = 0;
 	request->flags |= ATA_R_ORDERED | ATA_R_DIRECT;
 	ata_queue_request(request);
@@ -4371,7 +4371,7 @@ ata_raid_init_request(device_t dev, stru
 	return NULL;
     }
     request->dev = dev;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 2;
     request->callback = ata_raid_done;
     request->driver = rdp;
@@ -4445,7 +4445,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: head/sys/dev/ata/atapi-cd.c
==============================================================================
--- head/sys/dev/ata/atapi-cd.c	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/dev/ata/atapi-cd.c	Sun Nov  8 14:33:19 2009	(r199050)
@@ -700,7 +700,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 = 10;
+	request->timeout = ATA_REQUEST_TIMEOUT;
 	ata_queue_request(request);
 	if (!request->error &&
 	    (request->u.atapi.sense.key == 2 ||
From kostikbel at gmail.com  Sun Nov  8 14:37:50 2009
From: kostikbel at gmail.com (Kostik Belousov)
Date: Sun Nov  8 14:37:56 2009
Subject: svn commit: r199050 - in head/sys: conf dev/ata
In-Reply-To: <200911081433.nA8EXJnp088767@svn.freebsd.org>
References: <200911081433.nA8EXJnp088767@svn.freebsd.org>
Message-ID: <20091108143633.GR2331@deviant.kiev.zoral.com.ua>

On Sun, Nov 08, 2009 at 02:33:19PM +0000, Alexander Motin wrote:
> Author: mav
> Date: Sun Nov  8 14:33:19 2009
> New Revision: 199050
> URL: http://svn.freebsd.org/changeset/base/199050
> 
> Log:
>   Introduce define and kernel option ATA_REQUEST_TIMEOUT to control ATA(4)
>   command timeout.

Why is this a compile-time option ? Having to recompile kernel for this
is too much, IMHO. It should be loader tunable + sysctl, isn't it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091108/b34b9052/attachment.pgp
From mav at FreeBSD.org  Sun Nov  8 14:40:32 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Sun Nov  8 14:40:38 2009
Subject: svn commit: r199050 - in head/sys: conf dev/ata
In-Reply-To: <20091108143633.GR2331@deviant.kiev.zoral.com.ua>
References: <200911081433.nA8EXJnp088767@svn.freebsd.org>
	<20091108143633.GR2331@deviant.kiev.zoral.com.ua>
Message-ID: <4AF6D85B.4040905@FreeBSD.org>

Kostik Belousov wrote:
> On Sun, Nov 08, 2009 at 02:33:19PM +0000, Alexander Motin wrote:
>> Author: mav
>> Date: Sun Nov  8 14:33:19 2009
>> New Revision: 199050
>> URL: http://svn.freebsd.org/changeset/base/199050
>>
>> Log:
>>   Introduce define and kernel option ATA_REQUEST_TIMEOUT to control ATA(4)
>>   command timeout.
> 
> Why is this a compile-time option ? Having to recompile kernel for this
> is too much, IMHO. It should be loader tunable + sysctl, isn't it.

As I have told once, I think it is not a thing that should be often
tuned by end-user, especially in real-time. I just turned it into macro,
as some people complain about using numerous equal numeric constants.

-- 
Alexander Motin
From kostikbel at gmail.com  Sun Nov  8 15:20:10 2009
From: kostikbel at gmail.com (Kostik Belousov)
Date: Sun Nov  8 15:20:17 2009
Subject: svn commit: r199050 - in head/sys: conf dev/ata
In-Reply-To: <4AF6D85B.4040905@FreeBSD.org>
References: <200911081433.nA8EXJnp088767@svn.freebsd.org>
	<20091108143633.GR2331@deviant.kiev.zoral.com.ua>
	<4AF6D85B.4040905@FreeBSD.org>
Message-ID: <20091108152006.GS2331@deviant.kiev.zoral.com.ua>

On Sun, Nov 08, 2009 at 04:40:27PM +0200, Alexander Motin wrote:
> Kostik Belousov wrote:
> > On Sun, Nov 08, 2009 at 02:33:19PM +0000, Alexander Motin wrote:
> >> Author: mav
> >> Date: Sun Nov  8 14:33:19 2009
> >> New Revision: 199050
> >> URL: http://svn.freebsd.org/changeset/base/199050
> >>
> >> Log:
> >>   Introduce define and kernel option ATA_REQUEST_TIMEOUT to control ATA(4)
> >>   command timeout.
> > 
> > Why is this a compile-time option ? Having to recompile kernel for this
> > is too much, IMHO. It should be loader tunable + sysctl, isn't it.
> 
> As I have told once, I think it is not a thing that should be often
> tuned by end-user, especially in real-time. I just turned it into macro,
Absolutely. I agree with that most users never need this tunable.

> as some people complain about using numerous equal numeric constants.
But, why not be somewhat more friendly to a user that already has a
problam, and force him to recompile the kernel only to check whether
it helps or not ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091108/464db1af/attachment.pgp
From rmacklem at FreeBSD.org  Sun Nov  8 19:02:13 2009
From: rmacklem at FreeBSD.org (Rick Macklem)
Date: Sun Nov  8 19:02:25 2009
Subject: svn commit: r199053 - head/sys/rpc
Message-ID: <200911081902.nA8J2D9k094894@svn.freebsd.org>

Author: rmacklem
Date: Sun Nov  8 19:02:13 2009
New Revision: 199053
URL: http://svn.freebsd.org/changeset/base/199053

Log:
  Add a check for the connection being shut down to the krpc
  client just before queuing a request for the connection. The
  code already had a check for the connection being shut down
  while the request was queued, but not one for the shut down
  having been initiated by the server before the request was
  in the queue. This appears to fix the problem of slow reconnects
  against an NFS server that drops inactive connections reported
  by Olaf Seibert, but does not fix the case
  where the FreeBSD client generates RST segments at about the
  same time as ACKs. This is still a problem that is being
  investigated. This patch does not cause a regression for this
  case.
  
  Tested by:	Olaf Seibert, Daniel Braniss
  Reviewed by:	dfr
  MFC after:	5 days

Modified:
  head/sys/rpc/clnt_vc.c

Modified: head/sys/rpc/clnt_vc.c
==============================================================================
--- head/sys/rpc/clnt_vc.c	Sun Nov  8 17:59:55 2009	(r199052)
+++ head/sys/rpc/clnt_vc.c	Sun Nov  8 19:02:13 2009	(r199053)
@@ -413,6 +413,22 @@ call_again:
 
 	cr->cr_xid = xid;
 	mtx_lock(&ct->ct_lock);
+	/*
+	 * Check to see if the other end has already started to close down
+	 * the connection. The upcall will have set ct_error.re_status
+	 * to RPC_CANTRECV if this is the case.
+	 * If the other end starts to close down the connection after this
+	 * point, it will be detected later when cr_error is checked,
+	 * since the request is in the ct_pending queue.
+	 */
+	if (ct->ct_error.re_status == RPC_CANTRECV) {
+		if (errp != &ct->ct_error) {
+			errp->re_errno = ct->ct_error.re_errno;
+			errp->re_status = RPC_CANTRECV;
+		}
+		stat = RPC_CANTRECV;
+		goto out;
+	}
 	TAILQ_INSERT_TAIL(&ct->ct_pending, cr, cr_link);
 	mtx_unlock(&ct->ct_lock);
 
From yongari at FreeBSD.org  Sun Nov  8 19:59:54 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Sun Nov  8 20:00:01 2009
Subject: svn commit: r199054 - head/sys/dev/bge
Message-ID: <200911081959.nA8Jxso0096200@svn.freebsd.org>

Author: yongari
Date: Sun Nov  8 19:59:54 2009
New Revision: 199054
URL: http://svn.freebsd.org/changeset/base/199054

Log:
  Partially revert r199035.
  Revision 1.158 says only lower ten bits of
  BGE_RXLP_LOCSTAT_IFIN_DROPS register is valid. For BCM5761 case it
  seems the controller maintains 16bits value for the register.
  However 16bits are still too small to count all dropped packets
  happened in a second. To get a correct counter we have to read the
  register in bge_rxeof() which would be too expensive.
  
  Pointed out by:	bde

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Sun Nov  8 19:02:13 2009	(r199053)
+++ head/sys/dev/bge/if_bge.c	Sun Nov  8 19:59:54 2009	(r199054)
@@ -3289,6 +3289,14 @@ bge_rxeof(struct bge_softc *sc)
 		bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std);
 	if (jumbocnt)
 		bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo);
+#ifdef notyet
+	/*
+	 * This register wraps very quickly under heavy packet drops.
+	 * If you need correct statistics, you can enable this check.
+	 */
+	if (BGE_IS_5705_PLUS(sc))
+		ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS);
+#endif
 	return (rx_npkts);
 }
 
From thompsa at FreeBSD.org  Sun Nov  8 20:03:52 2009
From: thompsa at FreeBSD.org (Andrew Thompson)
Date: Sun Nov  8 20:04:05 2009
Subject: svn commit: r199055 - head/lib/libusb
Message-ID: <200911082003.nA8K3qe7096339@svn.freebsd.org>

Author: thompsa
Date: Sun Nov  8 20:03:52 2009
New Revision: 199055
URL: http://svn.freebsd.org/changeset/base/199055

Log:
  - fix refcounting error during data transfer
  - fix a memory leak on the USB backend
  - fix invalid pointer computations (in one case memory outside the allocated
    area was written in LibUSB v1.0)
  - make sure memory is always initialised, also in failing cases
  - add missing functions from v1.0.4
  
  PR:		usb/140325
  Reported by:	Robert Jenssen
  Submitted by:	Hans Petter Selasky
  MFC After:	3 days

Modified:
  head/lib/libusb/libusb.h
  head/lib/libusb/libusb10.c
  head/lib/libusb/libusb10_desc.c
  head/lib/libusb/libusb10_io.c
  head/lib/libusb/libusb20.c
  head/lib/libusb/libusb20_desc.c
  head/lib/libusb/libusb20_ugen20.c

Modified: head/lib/libusb/libusb.h
==============================================================================
--- head/lib/libusb/libusb.h	Sun Nov  8 19:59:54 2009	(r199054)
+++ head/lib/libusb/libusb.h	Sun Nov  8 20:03:52 2009	(r199055)
@@ -271,9 +271,11 @@ typedef struct libusb_control_setup {
 	uint16_t wLength;
 }	libusb_control_setup;
 
+#define	LIBUSB_CONTROL_SETUP_SIZE	8	/* bytes */
+
 typedef struct libusb_iso_packet_descriptor {
-	unsigned int length;
-	unsigned int actual_length;
+	uint32_t length;
+	uint32_t actual_length;
 	enum libusb_transfer_status status;
 }	libusb_iso_packet_descriptor __aligned(sizeof(void *));
 
@@ -282,9 +284,9 @@ typedef void (*libusb_transfer_cb_fn) (s
 typedef struct libusb_transfer {
 	libusb_device_handle *dev_handle;
 	uint8_t	flags;
-	unsigned int endpoint;
+	uint32_t endpoint;
 	uint8_t type;
-	unsigned int timeout;
+	uint32_t timeout;
 	enum libusb_transfer_status status;
 	int	length;
 	int	actual_length;
@@ -320,7 +322,7 @@ int	libusb_get_configuration(libusb_devi
 int	libusb_set_configuration(libusb_device_handle * devh, int configuration);
 int	libusb_claim_interface(libusb_device_handle * devh, int interface_number);
 int	libusb_release_interface(libusb_device_handle * devh, int interface_number);
-int	libusb_reset_device(libusb_device_handle * dev);
+int	libusb_reset_device(libusb_device_handle * devh);
 int 	libusb_kernel_driver_active(libusb_device_handle * devh, int interface);
 int 	libusb_detach_kernel_driver(libusb_device_handle * devh, int interface);
 int 	libusb_attach_kernel_driver(libusb_device_handle * devh, int interface);
@@ -333,7 +335,8 @@ int	libusb_get_active_config_descriptor(
 int	libusb_get_config_descriptor(libusb_device * dev, uint8_t config_index, struct libusb_config_descriptor **config);
 int	libusb_get_config_descriptor_by_value(libusb_device * dev, uint8_t bConfigurationValue, struct libusb_config_descriptor **config);
 void	libusb_free_config_descriptor(struct libusb_config_descriptor *config);
-int	libusb_get_string_descriptor_ascii(libusb_device_handle * dev, uint8_t desc_index, uint8_t *data, int length);
+int	libusb_get_string_descriptor_ascii(libusb_device_handle * devh, uint8_t desc_index, uint8_t *data, int length);
+int	libusb_get_descriptor(libusb_device_handle * devh, uint8_t desc_type, uint8_t desc_index, uint8_t *data, int length);
 
 /* Asynchronous device I/O */
 
@@ -341,7 +344,16 @@ struct libusb_transfer *libusb_alloc_tra
 void	libusb_free_transfer(struct libusb_transfer *transfer);
 int	libusb_submit_transfer(struct libusb_transfer *transfer);
 int	libusb_cancel_transfer(struct libusb_transfer *transfer);
-uint8_t *libusb_get_iso_packet_buffer_simple(struct libusb_transfer *transfer, unsigned int packet);
+uint8_t *libusb_get_iso_packet_buffer(struct libusb_transfer *transfer, uint32_t index);
+uint8_t *libusb_get_iso_packet_buffer_simple(struct libusb_transfer *transfer, uint32_t index);
+void	libusb_set_iso_packet_lengths(struct libusb_transfer *transfer, uint32_t length);
+uint8_t *libusb_control_transfer_get_data(struct libusb_transfer *transfer);
+struct libusb_control_setup *libusb_control_transfer_get_setup(struct libusb_transfer *transfer);
+void	libusb_fill_control_setup(uint8_t *buf, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint16_t wLength);
+void	libusb_fill_control_transfer(struct libusb_transfer *transfer, libusb_device_handle *devh, uint8_t *buf, libusb_transfer_cb_fn callback, void *user_data, uint32_t timeout);
+void	libusb_fill_bulk_transfer(struct libusb_transfer *transfer, libusb_device_handle *devh, uint8_t endpoint, uint8_t *buf, int length, libusb_transfer_cb_fn callback, void *user_data, uint32_t timeout);
+void	libusb_fill_interrupt_transfer(struct libusb_transfer *transfer, libusb_device_handle *devh, uint8_t endpoint, uint8_t *buf, int length, libusb_transfer_cb_fn callback, void *user_data, uint32_t timeout);
+void	libusb_fill_iso_transfer(struct libusb_transfer *transfer, libusb_device_handle *devh, uint8_t endpoint, uint8_t *buf, int length, int npacket, libusb_transfer_cb_fn callback, void *user_data, uint32_t timeout);
 
 /* Polling and timing */
 
@@ -362,9 +374,14 @@ struct libusb_pollfd **libusb_get_pollfd
 
 /* Synchronous device I/O */
 
-int	libusb_control_transfer(libusb_device_handle * devh, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint8_t *data, uint16_t wLength, unsigned int timeout);
-int	libusb_bulk_transfer(libusb_device_handle *devh, uint8_t endpoint, uint8_t *data, int length, int *transferred, unsigned int timeout);
-int	libusb_interrupt_transfer(libusb_device_handle *devh, uint8_t endpoint, uint8_t *data, int length, int *transferred, unsigned int timeout);
+int	libusb_control_transfer(libusb_device_handle * devh, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint8_t *data, uint16_t wLength, uint32_t timeout);
+int	libusb_bulk_transfer(libusb_device_handle * devh, uint8_t endpoint, uint8_t *data, int length, int *transferred, uint32_t timeout);
+int	libusb_interrupt_transfer(libusb_device_handle * devh, uint8_t endpoint, uint8_t *data, int length, int *transferred, uint32_t timeout);
+
+/* Byte-order */
+
+uint16_t libusb_cpu_to_le16(uint16_t x);
+uint16_t libusb_le16_to_cpu(uint16_t x);
 
 #if 0
 {					/* indent fix */

Modified: head/lib/libusb/libusb10.c
==============================================================================
--- head/lib/libusb/libusb10.c	Sun Nov  8 19:59:54 2009	(r199054)
+++ head/lib/libusb/libusb10.c	Sun Nov  8 20:03:52 2009	(r199055)
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "libusb20.h"
 #include "libusb20_desc.h"
@@ -185,8 +186,6 @@ libusb_get_device_list(libusb_context *c
 	/* create libusb v1.0 compliant devices */
 	i = 0;
 	while ((pdev = libusb20_be_device_foreach(usb_backend, NULL))) {
-		/* get device into libUSB v1.0 list */
-		libusb20_be_dequeue_device(usb_backend, pdev);
 
 		dev = malloc(sizeof(*dev));
 		if (dev == NULL) {
@@ -199,6 +198,10 @@ libusb_get_device_list(libusb_context *c
 			libusb20_be_free(usb_backend);
 			return (LIBUSB_ERROR_NO_MEM);
 		}
+
+		/* get device into libUSB v1.0 list */
+		libusb20_be_dequeue_device(usb_backend, pdev);
+
 		memset(dev, 0, sizeof(*dev));
 
 		/* init transfer queues */
@@ -416,6 +419,8 @@ libusb_close(struct libusb20_device *pde
 	libusb10_remove_pollfd(ctx, &dev->dev_poll);
 
 	libusb20_dev_close(pdev);
+
+	/* unref will free the "pdev" when the refcount reaches zero */
 	libusb_unref_device(dev);
 
 	/* make sure our event loop detects the closed device */
@@ -1195,7 +1200,7 @@ libusb_submit_transfer(struct libusb_tra
 	struct libusb20_transfer *pxfer1;
 	struct libusb_super_transfer *sxfer;
 	struct libusb_device *dev;
-	unsigned int endpoint;
+	uint32_t endpoint;
 	int err;
 
 	if (uxfer == NULL)
@@ -1252,7 +1257,7 @@ libusb_cancel_transfer(struct libusb_tra
 	struct libusb20_transfer *pxfer1;
 	struct libusb_super_transfer *sxfer;
 	struct libusb_device *dev;
-	unsigned int endpoint;
+	uint32_t endpoint;
 
 	if (uxfer == NULL)
 		return (LIBUSB_ERROR_INVALID_PARAM);
@@ -1312,3 +1317,16 @@ libusb10_cancel_all_transfer(libusb_devi
 {
 	/* TODO */
 }
+
+uint16_t
+libusb_cpu_to_le16(uint16_t x)
+{
+	return (htole16(x));
+}
+
+uint16_t
+libusb_le16_to_cpu(uint16_t x)
+{
+	return (le16toh(x));
+}
+

Modified: head/lib/libusb/libusb10_desc.c
==============================================================================
--- head/lib/libusb/libusb10_desc.c	Sun Nov  8 19:59:54 2009	(r199054)
+++ head/lib/libusb/libusb10_desc.c	Sun Nov  8 20:03:52 2009	(r199055)
@@ -35,6 +35,8 @@
 #include "libusb.h"
 #include "libusb10.h"
 
+#define	N_ALIGN(n) (-((-(n)) & (-8UL)))
+
 /* USB descriptors */
 
 int
@@ -114,17 +116,17 @@ libusb_get_config_descriptor(libusb_devi
 
 	nalt = nif = pconf->num_interface;
 	nep = 0;
-	nextra = pconf->extra.len;
+	nextra = N_ALIGN(pconf->extra.len);
 
 	for (i = 0; i < nif; i++) {
 
 		pinf = pconf->interface + i;
-		nextra += pinf->extra.len;
+		nextra += N_ALIGN(pinf->extra.len);
 		nep += pinf->num_endpoints;
 		k = pinf->num_endpoints;
 		pend = pinf->endpoints;
 		while (k--) {
-			nextra += pend->extra.len;
+			nextra += N_ALIGN(pend->extra.len);
 			pend++;
 		}
 
@@ -132,12 +134,12 @@ libusb_get_config_descriptor(libusb_devi
 		nalt += pinf->num_altsetting;
 		pinf = pinf->altsetting;
 		while (j--) {
-			nextra += pinf->extra.len;
+			nextra += N_ALIGN(pinf->extra.len);
 			nep += pinf->num_endpoints;
 			k = pinf->num_endpoints;
 			pend = pinf->endpoints;
 			while (k--) {
-				nextra += pend->extra.len;
+				nextra += N_ALIGN(pend->extra.len);
 				pend++;
 			}
 			pinf++;
@@ -150,17 +152,18 @@ libusb_get_config_descriptor(libusb_devi
 	    (nalt * sizeof(libusb_interface_descriptor)) +
 	    (nep * sizeof(libusb_endpoint_descriptor));
 
+	nextra = N_ALIGN(nextra);
+
 	pconfd = malloc(nextra);
 
 	if (pconfd == NULL) {
 		free(pconf);
 		return (LIBUSB_ERROR_NO_MEM);
 	}
-	/* make sure memory is clean */
+	/* make sure memory is initialised */
 	memset(pconfd, 0, nextra);
 
-	pconfd->interface = (libusb_interface *) (pconfd +
-	    sizeof(libusb_config_descriptor));
+	pconfd->interface = (libusb_interface *) (pconfd + 1);
 
 	ifd = (libusb_interface_descriptor *) (pconfd->interface + nif);
 	endd = (libusb_endpoint_descriptor *) (ifd + nalt);
@@ -181,7 +184,7 @@ libusb_get_config_descriptor(libusb_devi
 		pconfd->extra_length = pconf->extra.len;
 		pconfd->extra = pextra;
 		memcpy(pextra, pconf->extra.ptr, pconfd->extra_length);
-		pextra += pconfd->extra_length;
+		pextra += N_ALIGN(pconfd->extra_length);
 	}
 	/* setup all interface and endpoint pointers */
 
@@ -221,7 +224,7 @@ libusb_get_config_descriptor(libusb_devi
 				ifd->extra_length = pinf->extra.len;
 				ifd->extra = pextra;
 				memcpy(pextra, pinf->extra.ptr, pinf->extra.len);
-				pextra += pinf->extra.len;
+				pextra += N_ALIGN(pinf->extra.len);
 			}
 			for (k = 0; k < pinf->num_endpoints; k++) {
 				pend = &pinf->endpoints[k];
@@ -238,7 +241,7 @@ libusb_get_config_descriptor(libusb_devi
 					endd->extra_length = pend->extra.len;
 					endd->extra = pextra;
 					memcpy(pextra, pend->extra.ptr, pend->extra.len);
-					pextra += pend->extra.len;
+					pextra += N_ALIGN(pend->extra.len);
 				}
 			}
 		}
@@ -304,3 +307,12 @@ libusb_get_string_descriptor_ascii(libus
 
 	return (LIBUSB_ERROR_OTHER);
 }
+
+int
+libusb_get_descriptor(libusb_device_handle * devh, uint8_t desc_type, 
+    uint8_t desc_index, uint8_t *data, int length)
+{
+	return (libusb_control_transfer(devh, LIBUSB_ENDPOINT_IN,
+	    LIBUSB_REQUEST_GET_DESCRIPTOR, (desc_type << 8) | desc_index, 0, data,
+	    length, 1000));
+}

Modified: head/lib/libusb/libusb10_io.c
==============================================================================
--- head/lib/libusb/libusb10_io.c	Sun Nov  8 19:59:54 2009	(r199054)
+++ head/lib/libusb/libusb10_io.c	Sun Nov  8 20:03:52 2009	(r199055)
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "libusb20.h"
 #include "libusb20_desc.h"
@@ -148,19 +149,19 @@ libusb10_handle_events_sub(struct libusb
 		goto do_done;
 	}
 	for (i = 0; i != nfds; i++) {
-		if (fds[i].revents == 0)
-			continue;
 		if (ppdev[i] != NULL) {
 			dev = libusb_get_device(ppdev[i]);
 
-			err = libusb20_dev_process(ppdev[i]);
+			if (fds[i].revents == 0)
+				err = 0;	/* nothing to do */
+			else
+				err = libusb20_dev_process(ppdev[i]);
+
 			if (err) {
 				/* cancel all transfers - device is gone */
 				libusb10_cancel_all_transfer(dev);
-				/*
-				 * make sure we don't go into an infinite
-				 * loop
-				 */
+
+				/* remove USB device from polling loop */
 				libusb10_remove_pollfd(dev->ctx, &dev->dev_poll);
 			}
 			CTX_UNLOCK(ctx);
@@ -573,3 +574,160 @@ libusb_interrupt_transfer(libusb_device_
 	DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_interrupt_transfer leave");
 	return (ret);
 }
+
+uint8_t *
+libusb_get_iso_packet_buffer(struct libusb_transfer *transfer, uint32_t index)
+{
+	uint8_t *ptr;
+	uint32_t n;
+
+	if (transfer->num_iso_packets < 0)
+		return (NULL);
+
+	if (index >= (uint32_t)transfer->num_iso_packets)
+		return (NULL);
+
+	ptr = transfer->buffer;
+	if (ptr == NULL)
+		return (NULL);
+
+	for (n = 0; n != index; n++) {
+		ptr += transfer->iso_packet_desc[n].length;
+	}
+	return (ptr);
+}
+
+uint8_t *
+libusb_get_iso_packet_buffer_simple(struct libusb_transfer *transfer, uint32_t index)
+{
+	uint8_t *ptr;
+
+	if (transfer->num_iso_packets < 0)
+		return (NULL);
+
+	if (index >= (uint32_t)transfer->num_iso_packets)
+		return (NULL);
+
+	ptr = transfer->buffer;
+	if (ptr == NULL)
+		return (NULL);
+
+	ptr += transfer->iso_packet_desc[0].length * index;
+
+	return (ptr);
+}
+
+void
+libusb_set_iso_packet_lengths(struct libusb_transfer *transfer, uint32_t length)
+{
+	int n;
+
+	if (transfer->num_iso_packets < 0)
+		return;
+
+	for (n = 0; n != transfer->num_iso_packets; n++)
+		transfer->iso_packet_desc[n].length = length;
+}
+
+uint8_t *
+libusb_control_transfer_get_data(struct libusb_transfer *transfer)
+{
+	if (transfer->buffer == NULL)
+		return (NULL);
+
+	return (transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE);
+}
+
+struct libusb_control_setup *
+libusb_control_transfer_get_setup(struct libusb_transfer *transfer)
+{
+	return ((struct libusb_control_setup *)transfer->buffer);
+}
+
+void
+libusb_fill_control_setup(uint8_t *buf, uint8_t bmRequestType,
+    uint8_t bRequest, uint16_t wValue,
+    uint16_t wIndex, uint16_t wLength)
+{
+	struct libusb_control_setup *req = (struct libusb_control_setup *)buf;
+
+	/* The alignment is OK for all fields below. */
+	req->bmRequestType = bmRequestType;
+	req->bRequest = bRequest;
+	req->wValue = htole16(wValue);
+	req->wIndex = htole16(wIndex);
+	req->wLength = htole16(wLength);
+}
+
+void
+libusb_fill_control_transfer(struct libusb_transfer *transfer, 
+    libusb_device_handle *devh, uint8_t *buf,
+    libusb_transfer_cb_fn callback, void *user_data,
+    uint32_t timeout)
+{
+	struct libusb_control_setup *setup = (struct libusb_control_setup *)buf;
+
+	transfer->dev_handle = devh;
+	transfer->endpoint = 0;
+	transfer->type = LIBUSB_TRANSFER_TYPE_CONTROL;
+	transfer->timeout = timeout;
+	transfer->buffer = buf;
+	if (setup != NULL)
+		transfer->length = LIBUSB_CONTROL_SETUP_SIZE
+			+ le16toh(setup->wLength);
+	else
+		transfer->length = 0;
+	transfer->user_data = user_data;
+	transfer->callback = callback;
+
+}
+
+void
+libusb_fill_bulk_transfer(struct libusb_transfer *transfer, 
+    libusb_device_handle *devh, uint8_t endpoint, uint8_t *buf, 
+    int length, libusb_transfer_cb_fn callback, void *user_data,
+    uint32_t timeout)
+{
+	transfer->dev_handle = devh;
+	transfer->endpoint = endpoint;
+	transfer->type = LIBUSB_TRANSFER_TYPE_BULK;
+	transfer->timeout = timeout;
+	transfer->buffer = buf;
+	transfer->length = length;
+	transfer->user_data = user_data;
+	transfer->callback = callback;
+}
+
+void
+libusb_fill_interrupt_transfer(struct libusb_transfer *transfer,
+    libusb_device_handle *devh, uint8_t endpoint, uint8_t *buf,
+    int length, libusb_transfer_cb_fn callback, void *user_data,
+    uint32_t timeout)
+{
+	transfer->dev_handle = devh;
+	transfer->endpoint = endpoint;
+	transfer->type = LIBUSB_TRANSFER_TYPE_INTERRUPT;
+	transfer->timeout = timeout;
+	transfer->buffer = buf;
+	transfer->length = length;
+	transfer->user_data = user_data;
+	transfer->callback = callback;
+}
+
+void
+libusb_fill_iso_transfer(struct libusb_transfer *transfer, 
+    libusb_device_handle *devh, uint8_t endpoint, uint8_t *buf,
+    int length, int npacket, libusb_transfer_cb_fn callback,
+    void *user_data, uint32_t timeout)
+{
+	transfer->dev_handle = devh;
+	transfer->endpoint = endpoint;
+	transfer->type = LIBUSB_TRANSFER_TYPE_ISOCHRONOUS;
+	transfer->timeout = timeout;
+	transfer->buffer = buf;
+	transfer->length = length;
+	transfer->num_iso_packets = npacket;
+	transfer->user_data = user_data;
+	transfer->callback = callback;
+}
+

Modified: head/lib/libusb/libusb20.c
==============================================================================
--- head/lib/libusb/libusb20.c	Sun Nov  8 19:59:54 2009	(r199054)
+++ head/lib/libusb/libusb20.c	Sun Nov  8 20:03:52 2009	(r199055)
@@ -630,6 +630,9 @@ libusb20_dev_req_string_sync(struct libu
 	struct LIBUSB20_CONTROL_SETUP_DECODED req;
 	int error;
 
+	/* make sure memory is initialised */
+	memset(ptr, 0, len);
+
 	if (len < 4) {
 		/* invalid length */
 		return (LIBUSB20_ERROR_INVALID_PARAM);
@@ -1093,7 +1096,8 @@ libusb20_be_free(struct libusb20_backend
 	if (pbe->methods->exit_backend) {
 		pbe->methods->exit_backend(pbe);
 	}
-	return;
+	/* free backend */
+	free(pbe);
 }
 
 void
@@ -1101,7 +1105,6 @@ libusb20_be_enqueue_device(struct libusb
 {
 	pdev->beMethods = pbe->methods;	/* copy backend methods */
 	TAILQ_INSERT_TAIL(&(pbe->usb_devs), pdev, dev_entry);
-	return;
 }
 
 void
@@ -1109,5 +1112,4 @@ libusb20_be_dequeue_device(struct libusb
     struct libusb20_device *pdev)
 {
 	TAILQ_REMOVE(&(pbe->usb_devs), pdev, dev_entry);
-	return;
 }

Modified: head/lib/libusb/libusb20_desc.c
==============================================================================
--- head/lib/libusb/libusb20_desc.c	Sun Nov  8 19:59:54 2009	(r199054)
+++ head/lib/libusb/libusb20_desc.c	Sun Nov  8 20:03:52 2009	(r199055)
@@ -118,6 +118,9 @@ libusb20_parse_config_desc(const void *c
 	if (lub_config == NULL) {
 		return (NULL);		/* out of memory */
 	}
+	/* make sure memory is initialised */
+	memset(lub_config, 0, size);
+
 	lub_interface = (void *)(lub_config + 1);
 	lub_alt_interface = (void *)(lub_interface + niface_no_alt);
 	lub_endpoint = (void *)(lub_interface + niface);

Modified: head/lib/libusb/libusb20_ugen20.c
==============================================================================
--- head/lib/libusb/libusb20_ugen20.c	Sun Nov  8 19:59:54 2009	(r199054)
+++ head/lib/libusb/libusb20_ugen20.c	Sun Nov  8 20:03:52 2009	(r199055)
@@ -449,6 +449,8 @@ ugen20_get_config_desc_full(struct libus
 	uint16_t len;
 	int error;
 
+	/* make sure memory is initialised */
+	memset(&cdesc, 0, sizeof(cdesc));
 	memset(&gen_desc, 0, sizeof(gen_desc));
 
 	gen_desc.ugd_data = &cdesc;
@@ -468,6 +470,10 @@ ugen20_get_config_desc_full(struct libus
 	if (!ptr) {
 		return (LIBUSB20_ERROR_NO_MEM);
 	}
+
+	/* make sure memory is initialised */
+	memset(ptr, 0, len);
+
 	gen_desc.ugd_data = ptr;
 	gen_desc.ugd_maxlen = len;
 
From thompsa at FreeBSD.org  Sun Nov  8 20:44:56 2009
From: thompsa at FreeBSD.org (Andrew Thompson)
Date: Sun Nov  8 20:45:02 2009
Subject: svn commit: r199057 - head/sys/dev/usb/controller
Message-ID: <200911082044.nA8Kius8097253@svn.freebsd.org>

Author: thompsa
Date: Sun Nov  8 20:44:55 2009
New Revision: 199057
URL: http://svn.freebsd.org/changeset/base/199057

Log:
  ehci_init() will do reset and set the usbrev flag.  Fix problem where
  ehci_reset() was called before ehci_init().
  
  PR:		usb/140242
  Submitted by:	Sebastian Huber

Modified:
  head/sys/dev/usb/controller/ehci_ixp4xx.c
  head/sys/dev/usb/controller/ehci_mbus.c
  head/sys/dev/usb/controller/ehci_pci.c

Modified: head/sys/dev/usb/controller/ehci_ixp4xx.c
==============================================================================
--- head/sys/dev/usb/controller/ehci_ixp4xx.c	Sun Nov  8 20:17:15 2009	(r199056)
+++ head/sys/dev/usb/controller/ehci_ixp4xx.c	Sun Nov  8 20:44:55 2009	(r199057)
@@ -157,8 +157,6 @@ ehci_ixp_attach(device_t self)
 		return (ENOMEM);
 	}
 
-	sc->sc_bus.usbrev = USB_REV_2_0;
-
 	/* NB: hints fix the memory location and irq */
 
 	rid = 0;
@@ -230,7 +228,6 @@ ehci_ixp_attach(device_t self)
 		     | EHCI_SCFLG_BIGEMMIO
 		     | EHCI_SCFLG_NORESTERM
 		     ;
-	(void) ehci_reset(sc);
 
 	err = ehci_init(sc);
 	if (!err) {

Modified: head/sys/dev/usb/controller/ehci_mbus.c
==============================================================================
--- head/sys/dev/usb/controller/ehci_mbus.c	Sun Nov  8 20:17:15 2009	(r199056)
+++ head/sys/dev/usb/controller/ehci_mbus.c	Sun Nov  8 20:44:55 2009	(r199057)
@@ -166,8 +166,6 @@ ehci_mbus_attach(device_t self)
 		return (ENOMEM);
 	}
 
-	sc->sc_bus.usbrev = USB_REV_2_0;
-
 	rid = 0;
 	sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE);
 	if (!sc->sc_io_res) {

Modified: head/sys/dev/usb/controller/ehci_pci.c
==============================================================================
--- head/sys/dev/usb/controller/ehci_pci.c	Sun Nov  8 20:17:15 2009	(r199056)
+++ head/sys/dev/usb/controller/ehci_pci.c	Sun Nov  8 20:44:55 2009	(r199057)
@@ -318,13 +318,11 @@ ehci_pci_attach(device_t self)
 		device_printf(self, "pre-2.0 USB revision (ignored)\n");
 		/* fallthrough */
 	case PCI_USB_REV_2_0:
-		sc->sc_bus.usbrev = USB_REV_2_0;
 		break;
 	default:
 		/* Quirk for Parallels Desktop 4.0 */
 		device_printf(self, "USB revision is unknown. Assuming v2.0.\n");
-		sc->sc_bus.usbrev = USB_REV_2_0;
-                break;
+		break;
 	}
 
 	rid = PCI_CBMEM;
From thompsa at FreeBSD.org  Sun Nov  8 20:51:16 2009
From: thompsa at FreeBSD.org (Andrew Thompson)
Date: Sun Nov  8 20:51:27 2009
Subject: svn commit: r199058 - head/sys/dev/usb/controller
Message-ID: <200911082051.nA8KpF63097431@svn.freebsd.org>

Author: thompsa
Date: Sun Nov  8 20:51:15 2009
New Revision: 199058
URL: http://svn.freebsd.org/changeset/base/199058

Log:
  Integrate lost interrupts patch from the old USB stack.
  
  Some EHCI chips from VIA / ATI seem to trigger interrupts before writing back
  the qTD status, or miss signalling occasionally under heavy load.  If the host
  machine is too fast, we can miss transaction completion - when we scan the
  active list the transaction still seems to be active. This generally exhibits
  itself as a umass stall that never recovers.
  
  We work around this behaviour by setting up this callback after any softintr
  that completes with transactions still pending, giving us another chance to
  check for completion after the writeback has taken place
  
  Submitted by:	Alexander Nedotsuko
  MFC after:	3 days

Modified:
  head/sys/dev/usb/controller/ehci.c
  head/sys/dev/usb/controller/ehci.h
  head/sys/dev/usb/controller/ehci_pci.c

Modified: head/sys/dev/usb/controller/ehci.c
==============================================================================
--- head/sys/dev/usb/controller/ehci.c	Sun Nov  8 20:44:55 2009	(r199057)
+++ head/sys/dev/usb/controller/ehci.c	Sun Nov  8 20:51:15 2009	(r199058)
@@ -113,10 +113,12 @@ extern struct usb_pipe_methods ehci_devi
 extern struct usb_pipe_methods ehci_device_isoc_fs_methods;
 extern struct usb_pipe_methods ehci_device_isoc_hs_methods;
 
-static void ehci_do_poll(struct usb_bus *bus);
-static void ehci_device_done(struct usb_xfer *xfer, usb_error_t error);
-static uint8_t ehci_check_transfer(struct usb_xfer *xfer);
-static void ehci_timeout(void *arg);
+static void ehci_do_poll(struct usb_bus *);
+static void ehci_device_done(struct usb_xfer *, usb_error_t);
+static uint8_t ehci_check_transfer(struct usb_xfer *);
+static void ehci_timeout(void *);
+static void ehci_poll_timeout(void *);
+
 static void ehci_root_intr(ehci_softc_t *sc);
 
 struct ehci_std_temp {
@@ -243,6 +245,7 @@ ehci_init(ehci_softc_t *sc)
 	DPRINTF("start\n");
 
 	usb_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, 0);
+	usb_callout_init_mtx(&sc->sc_tmo_poll, &sc->sc_bus.bus_mtx, 0);
 
 #if USB_DEBUG
 	if (ehcidebug > 2) {
@@ -520,6 +523,7 @@ ehci_detach(ehci_softc_t *sc)
 	USB_BUS_LOCK(&sc->sc_bus);
 
 	usb_callout_stop(&sc->sc_tmo_pcd);
+	usb_callout_stop(&sc->sc_tmo_poll);
 
 	EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
 	USB_BUS_UNLOCK(&sc->sc_bus);
@@ -532,6 +536,7 @@ ehci_detach(ehci_softc_t *sc)
 	usb_pause_mtx(NULL, hz / 20);
 
 	usb_callout_drain(&sc->sc_tmo_pcd);
+	usb_callout_drain(&sc->sc_tmo_poll);
 }
 
 void
@@ -1472,6 +1477,28 @@ repeat:
 	}
 }
 
+/*
+ * Some EHCI chips from VIA / ATI seem to trigger interrupts before
+ * writing back the qTD status, or miss signalling occasionally under
+ * heavy load.  If the host machine is too fast, we can miss
+ * transaction completion - when we scan the active list the
+ * transaction still seems to be active. This generally exhibits
+ * itself as a umass stall that never recovers.
+ *
+ * We work around this behaviour by setting up this callback after any
+ * softintr that completes with transactions still pending, giving us
+ * another chance to check for completion after the writeback has
+ * taken place.
+ */
+static void
+ehci_poll_timeout(void *arg)
+{
+	ehci_softc_t *sc = arg;
+
+	DPRINTFN(3, "\n");
+	ehci_interrupt_poll(sc);
+}
+
 /*------------------------------------------------------------------------*
  *	ehci_interrupt - EHCI interrupt handler
  *
@@ -1539,6 +1566,11 @@ ehci_interrupt(ehci_softc_t *sc)
 	/* poll all the USB transfers */
 	ehci_interrupt_poll(sc);
 
+	if (sc->sc_flags & EHCI_SCFLG_LOSTINTRBUG) {
+		usb_callout_reset(&sc->sc_tmo_poll, hz / 128,
+		    (void *)&ehci_poll_timeout, sc);
+	}
+
 done:
 	USB_BUS_UNLOCK(&sc->sc_bus);
 }

Modified: head/sys/dev/usb/controller/ehci.h
==============================================================================
--- head/sys/dev/usb/controller/ehci.h	Sun Nov  8 20:44:55 2009	(r199057)
+++ head/sys/dev/usb/controller/ehci.h	Sun Nov  8 20:51:15 2009	(r199058)
@@ -321,6 +321,7 @@ typedef struct ehci_softc {
 	struct ehci_hw_softc sc_hw;
 	struct usb_bus sc_bus;		/* base device */
 	struct usb_callout sc_tmo_pcd;
+	struct usb_callout sc_tmo_poll;
 	union ehci_hub_desc sc_hub_desc;
 
 	struct usb_device *sc_devices[EHCI_MAX_DEVICES];
@@ -348,6 +349,7 @@ typedef struct ehci_softc {
 #define	EHCI_SCFLG_BIGEDESC	0x0008	/* big-endian byte order descriptors */
 #define	EHCI_SCFLG_BIGEMMIO	0x0010	/* big-endian byte order MMIO */
 #define	EHCI_SCFLG_TT		0x0020	/* transaction translator present */
+#define	EHCI_SCFLG_LOSTINTRBUG	0x0040	/* workaround for VIA / ATI chipsets */
 
 	uint8_t	sc_offs;		/* offset to operational registers */
 	uint8_t	sc_doorbell_disable;	/* set on doorbell failure */

Modified: head/sys/dev/usb/controller/ehci_pci.c
==============================================================================
--- head/sys/dev/usb/controller/ehci_pci.c	Sun Nov  8 20:44:55 2009	(r199057)
+++ head/sys/dev/usb/controller/ehci_pci.c	Sun Nov  8 20:51:15 2009	(r199058)
@@ -439,6 +439,19 @@ ehci_pci_attach(device_t self)
 		break;
 	}
 
+	/* Dropped interrupts workaround */
+	switch (pci_get_vendor(self)) {
+	case PCI_EHCI_VENDORID_ATI:
+	case PCI_EHCI_VENDORID_VIA:
+		sc->sc_flags |= EHCI_SCFLG_LOSTINTRBUG;
+		if (bootverbose)
+			device_printf(self,
+			    "Dropped interrupts workaround enabled\n");
+		break;
+	default:
+		break;
+	}
+
 	err = ehci_init(sc);
 	if (!err) {
 		err = device_probe_and_attach(sc->sc_bus.bdev);
From thompsa at FreeBSD.org  Sun Nov  8 20:54:03 2009
From: thompsa at FreeBSD.org (Andrew Thompson)
Date: Sun Nov  8 20:54:10 2009
Subject: svn commit: r199059 - in head/sys/dev/usb: . controller
Message-ID: <200911082054.nA8Ks30X097596@svn.freebsd.org>

Author: thompsa
Date: Sun Nov  8 20:54:03 2009
New Revision: 199059
URL: http://svn.freebsd.org/changeset/base/199059

Log:
  improve support for high speed isochronous endpoints which does not run 1:1,
  but needs intervalling 1:2, 1:4 or 1:8
  
  Submitted by:	Hans Petter Selasky

Modified:
  head/sys/dev/usb/controller/ehci.c
  head/sys/dev/usb/usb_core.h
  head/sys/dev/usb/usb_transfer.c
  head/sys/dev/usb/usbdi.h

Modified: head/sys/dev/usb/controller/ehci.c
==============================================================================
--- head/sys/dev/usb/controller/ehci.c	Sun Nov  8 20:51:15 2009	(r199058)
+++ head/sys/dev/usb/controller/ehci.c	Sun Nov  8 20:54:03 2009	(r199059)
@@ -2140,7 +2140,7 @@ ehci_isoc_hs_done(ehci_softc_t *sc, stru
 	DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
 	    xfer, xfer->endpoint);
 
-	while (nframes--) {
+	while (nframes) {
 		if (td == NULL) {
 			panic("%s:%d: out of TD's\n",
 			    __FUNCTION__, __LINE__);
@@ -2162,21 +2162,26 @@ ehci_isoc_hs_done(ehci_softc_t *sc, stru
 
 		DPRINTFN(2, "status=0x%08x, len=%u\n", status, len);
 
-		if (*plen >= len) {
-			/*
-			 * The length is valid. NOTE: The complete
-			 * length is written back into the status
-			 * field, and not the remainder like with
-			 * other transfer descriptor types.
-			 */
-		} else {
-			/* Invalid length - truncate */
-			len = 0;
-		}
+		if (xfer->usb_smask & (1 << td_no)) {
 
-		*plen = len;
+			if (*plen >= len) {
+				/*
+				 * The length is valid. NOTE: The
+				 * complete length is written back
+				 * into the status field, and not the
+				 * remainder like with other transfer
+				 * descriptor types.
+				 */
+			} else {
+				/* Invalid length - truncate */
+				len = 0;
+			}
+
+			*plen = len;
+			plen++;
+			nframes--;
+		}
 
-		plen++;
 		td_no++;
 
 		if ((td_no == 8) || (nframes == 0)) {
@@ -2393,10 +2398,9 @@ static void
 ehci_device_intr_close(struct usb_xfer *xfer)
 {
 	ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
-	uint8_t slot;
 
-	slot = usb_intr_schedule_adjust
-	    (xfer->xroot->udev, -(xfer->max_frame_size), xfer->usb_uframe);
+	usb_intr_schedule_adjust(xfer->xroot->udev,
+	    -(xfer->max_frame_size), xfer->usb_uframe);
 
 	sc->sc_intr_stat[xfer->qh_pos]--;
 
@@ -2722,6 +2726,28 @@ ehci_device_isoc_hs_open(struct usb_xfer
 	ehci_itd_t *td;
 	uint32_t temp;
 	uint8_t ds;
+	uint8_t slot;
+
+	slot = usb_intr_schedule_adjust(xfer->xroot->udev, xfer->max_frame_size,
+	    USB_HS_MICRO_FRAMES_MAX);
+
+	xfer->usb_uframe = slot;
+	xfer->usb_cmask = 0;
+
+	switch (usbd_xfer_get_fps_shift(xfer)) {
+	case 0:
+		xfer->usb_smask = 0xFF;
+		break;
+	case 1:
+		xfer->usb_smask = 0x55 << (slot & 1);
+		break;
+	case 2:
+		xfer->usb_smask = 0x11 << (slot & 3);
+		break;
+	default:
+		xfer->usb_smask = 0x01 << (slot & 7);
+		break;
+	}
 
 	/* initialize all TD's */
 
@@ -2765,6 +2791,10 @@ ehci_device_isoc_hs_open(struct usb_xfer
 static void
 ehci_device_isoc_hs_close(struct usb_xfer *xfer)
 {
+
+	usb_intr_schedule_adjust(xfer->xroot->udev,
+	    -(xfer->max_frame_size), xfer->usb_uframe);
+
 	ehci_device_done(xfer, USB_ERR_CANCELLED);
 }
 
@@ -2854,7 +2884,7 @@ ehci_device_isoc_hs_enter(struct usb_xfe
 
 	xfer->qh_pos = xfer->endpoint->isoc_next;
 
-	while (nframes--) {
+	while (nframes) {
 		if (td == NULL) {
 			panic("%s:%d: out of TD's\n",
 			    __FUNCTION__, __LINE__);
@@ -2874,13 +2904,21 @@ ehci_device_isoc_hs_enter(struct usb_xfe
 #endif
 			*plen = xfer->max_frame_size;
 		}
-		status = (EHCI_ITD_SET_LEN(*plen) |
-		    EHCI_ITD_ACTIVE |
-		    EHCI_ITD_SET_PG(0));
-		td->itd_status[td_no] = htohc32(sc, status);
-		itd_offset[td_no] = buf_offset;
-		buf_offset += *plen;
-		plen++;
+
+		if (xfer->usb_smask & (1 << td_no)) {
+			status = (EHCI_ITD_SET_LEN(*plen) |
+			    EHCI_ITD_ACTIVE |
+			    EHCI_ITD_SET_PG(0));
+			td->itd_status[td_no] = htohc32(sc, status);
+			itd_offset[td_no] = buf_offset;
+			buf_offset += *plen;
+			plen++;
+			nframes --;
+		} else {
+			td->itd_status[td_no] = 0;	/* not active */
+			itd_offset[td_no] = buf_offset;
+		}
+
 		td_no++;
 
 		if ((td_no == 8) || (nframes == 0)) {
@@ -2937,7 +2975,7 @@ ehci_device_isoc_hs_enter(struct usb_xfe
 			}
 			/* set IOC bit if we are complete */
 			if (nframes == 0) {
-				td->itd_status[7] |= htohc32(sc, EHCI_ITD_IOC);
+				td->itd_status[td_no - 1] |= htohc32(sc, EHCI_ITD_IOC);
 			}
 			usb_pc_cpu_flush(td->page_cache);
 #if USB_DEBUG
@@ -3583,7 +3621,8 @@ ehci_xfer_setup(struct usb_setup_params 
 
 		usbd_transfer_setup_sub(parm);
 
-		nitd = (xfer->nframes + 7) / 8;
+		nitd = ((xfer->nframes + 7) / 8) <<
+		    usbd_xfer_get_fps_shift(xfer);
 
 	} else {
 

Modified: head/sys/dev/usb/usb_core.h
==============================================================================
--- head/sys/dev/usb/usb_core.h	Sun Nov  8 20:51:15 2009	(r199058)
+++ head/sys/dev/usb/usb_core.h	Sun Nov  8 20:54:03 2009	(r199059)
@@ -165,6 +165,7 @@ struct usb_xfer {
 	uint8_t	usb_cmask;
 	uint8_t	usb_uframe;
 	uint8_t	usb_state;
+	uint8_t fps_shift;		/* down shift of FPS, 0..3 */
 
 	usb_error_t error;
 

Modified: head/sys/dev/usb/usb_transfer.c
==============================================================================
--- head/sys/dev/usb/usb_transfer.c	Sun Nov  8 20:51:15 2009	(r199058)
+++ head/sys/dev/usb/usb_transfer.c	Sun Nov  8 20:54:03 2009	(r199059)
@@ -416,9 +416,15 @@ usbd_transfer_setup_sub(struct usb_setup
 		case USB_SPEED_LOW:
 		case USB_SPEED_FULL:
 			frame_limit = USB_MAX_FS_ISOC_FRAMES_PER_XFER;
+			xfer->fps_shift = 0;
 			break;
 		default:
 			frame_limit = USB_MAX_HS_ISOC_FRAMES_PER_XFER;
+			xfer->fps_shift = edesc->bInterval;
+			if (xfer->fps_shift > 0)
+				xfer->fps_shift--;
+			if (xfer->fps_shift > 3)
+				xfer->fps_shift = 3;
 			break;
 		}
 
@@ -1826,6 +1832,23 @@ usbd_xfer_get_frame(struct usb_xfer *xfe
 	return (&xfer->frbuffers[frindex]);
 }
 
+/*------------------------------------------------------------------------*
+ *	usbd_xfer_get_fps_shift
+ *
+ * The following function is only useful for isochronous transfers. It
+ * returns how many times the frame execution rate has been shifted
+ * down.
+ *
+ * Return value:
+ * Success: 0..3
+ * Failure: 0
+ *------------------------------------------------------------------------*/
+uint8_t
+usbd_xfer_get_fps_shift(struct usb_xfer *xfer)
+{
+	return (xfer->fps_shift);
+}
+
 usb_frlength_t
 usbd_xfer_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex)
 {

Modified: head/sys/dev/usb/usbdi.h
==============================================================================
--- head/sys/dev/usb/usbdi.h	Sun Nov  8 20:51:15 2009	(r199058)
+++ head/sys/dev/usb/usbdi.h	Sun Nov  8 20:54:03 2009	(r199059)
@@ -478,6 +478,7 @@ void	usbd_xfer_set_frame_offset(struct u
 usb_frlength_t usbd_xfer_max_len(struct usb_xfer *xfer);
 usb_frlength_t usbd_xfer_max_framelen(struct usb_xfer *xfer);
 usb_frcount_t usbd_xfer_max_frames(struct usb_xfer *xfer);
+uint8_t	usbd_xfer_get_fps_shift(struct usb_xfer *xfer);
 usb_frlength_t usbd_xfer_frame_len(struct usb_xfer *xfer,
 	    usb_frcount_t frindex);
 void	usbd_xfer_set_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex,
From thompsa at FreeBSD.org  Sun Nov  8 21:00:50 2009
From: thompsa at FreeBSD.org (Andrew Thompson)
Date: Sun Nov  8 21:00:56 2009
Subject: svn commit: r199060 - head/sys/dev/sound/usb
Message-ID: <200911082100.nA8L0o9w097805@svn.freebsd.org>

Author: thompsa
Date: Sun Nov  8 21:00:50 2009
New Revision: 199060
URL: http://svn.freebsd.org/changeset/base/199060

Log:
  Improve support for High-speed USB audio devices.
  - fix issues regarding the mixer, where the interface number was not set in
    time.
  - fix wrong use of resolution parameter.
  
  Submitted by:	Hans Petter Selasky

Modified:
  head/sys/dev/sound/usb/uaudio.c

Modified: head/sys/dev/sound/usb/uaudio.c
==============================================================================
--- head/sys/dev/sound/usb/uaudio.c	Sun Nov  8 20:54:03 2009	(r199059)
+++ head/sys/dev/sound/usb/uaudio.c	Sun Nov  8 21:00:50 2009	(r199060)
@@ -105,10 +105,9 @@ SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, def
     &uaudio_default_channels, 0, "uaudio default sample channels");
 #endif
 
-#define	UAUDIO_MINFRAMES       16	/* must be factor of 8 due HS-USB */
+#define	UAUDIO_NFRAMES		64	/* must be factor of 8 due HS-USB */
 #define	UAUDIO_NCHANBUFS        2	/* number of outstanding request */
 #define	UAUDIO_RECURSE_LIMIT   24	/* rounds */
-#define	UAUDIO_MINFRAMES_ALIGN(x) ((x) & ~(UAUDIO_MINFRAMES - 1))
 
 #define	MAKE_WORD(h,l) (((h) << 8) | (l))
 #define	BIT_TEST(bm,bno) (((bm)[(bno) / 8] >> (7 - ((bno) % 8))) & 1)
@@ -119,7 +118,7 @@ struct uaudio_mixer_node {
 	int32_t	maxval;
 #define	MIX_MAX_CHAN 8
 	int32_t	wValue[MIX_MAX_CHAN];	/* using nchan */
-	uint32_t delta;
+	uint32_t mod;		/* modulus */
 	uint32_t mul;
 	uint32_t ctl;
 
@@ -169,7 +168,7 @@ struct uaudio_chan {
 					 * buffer */
 
 	uint32_t intr_size;		/* in bytes */
-	uint32_t block_size;
+	uint32_t intr_frames;		/* in units */
 	uint32_t sample_rate;
 	uint32_t format;
 	uint32_t pcm_format[2];
@@ -410,7 +409,7 @@ static const struct usb_config
 		.endpoint = UE_ADDR_ANY,
 		.direction = UE_DIR_IN,
 		.bufsize = 0,	/* use "wMaxPacketSize * frames" */
-		.frames = UAUDIO_MINFRAMES,
+		.frames = UAUDIO_NFRAMES,
 		.flags = {.short_xfer_ok = 1,},
 		.callback = &uaudio_chan_record_callback,
 	},
@@ -420,7 +419,7 @@ static const struct usb_config
 		.endpoint = UE_ADDR_ANY,
 		.direction = UE_DIR_IN,
 		.bufsize = 0,	/* use "wMaxPacketSize * frames" */
-		.frames = UAUDIO_MINFRAMES,
+		.frames = UAUDIO_NFRAMES,
 		.flags = {.short_xfer_ok = 1,},
 		.callback = &uaudio_chan_record_callback,
 	},
@@ -433,7 +432,7 @@ static const struct usb_config
 		.endpoint = UE_ADDR_ANY,
 		.direction = UE_DIR_OUT,
 		.bufsize = 0,	/* use "wMaxPacketSize * frames" */
-		.frames = UAUDIO_MINFRAMES,
+		.frames = UAUDIO_NFRAMES,
 		.flags = {.short_xfer_ok = 1,},
 		.callback = &uaudio_chan_play_callback,
 	},
@@ -443,7 +442,7 @@ static const struct usb_config
 		.endpoint = UE_ADDR_ANY,
 		.direction = UE_DIR_OUT,
 		.bufsize = 0,	/* use "wMaxPacketSize * frames" */
-		.frames = UAUDIO_MINFRAMES,
+		.frames = UAUDIO_NFRAMES,
 		.flags = {.short_xfer_ok = 1,},
 		.callback = &uaudio_chan_play_callback,
 	},
@@ -506,7 +505,6 @@ static const struct usb_config
 		.endpoint = 0x00,	/* Control pipe */
 		.direction = UE_DIR_ANY,
 		.bufsize = sizeof(struct usb_device_request),
-		.flags = {},
 		.callback = &umidi_write_clear_stall_callback,
 		.timeout = 1000,	/* 1 second */
 		.interval = 50,	/* 50ms */
@@ -517,7 +515,6 @@ static const struct usb_config
 		.endpoint = 0x00,	/* Control pipe */
 		.direction = UE_DIR_ANY,
 		.bufsize = sizeof(struct usb_device_request),
-		.flags = {},
 		.callback = &umidi_read_clear_stall_callback,
 		.timeout = 1000,	/* 1 second */
 		.interval = 50,	/* 50ms */
@@ -577,6 +574,8 @@ uaudio_attach(device_t dev)
 	sc->sc_play_chan.priv_sc = sc;
 	sc->sc_rec_chan.priv_sc = sc;
 	sc->sc_udev = uaa->device;
+	sc->sc_mixer_iface_index = uaa->info.bIfaceIndex;
+	sc->sc_mixer_iface_no = uaa->info.bIfaceNum;
 
 	if (usb_test_quirk(uaa, UQ_AUDIO_SWAP_LR))
 		sc->sc_uq_audio_swap_lr = 1;
@@ -600,9 +599,6 @@ uaudio_attach(device_t dev)
 
 	uaudio_mixer_fill_info(sc, uaa->device, id);
 
-	sc->sc_mixer_iface_index = uaa->info.bIfaceIndex;
-	sc->sc_mixer_iface_no = uaa->info.bIfaceNum;
-
 	DPRINTF("audio rev %d.%02x\n",
 	    sc->sc_audio_rev >> 8,
 	    sc->sc_audio_rev & 0xff);
@@ -1119,34 +1115,11 @@ done:
  * next audio transfer.
  */
 static void
-uaudio_setup_blockcount(struct uaudio_chan *ch, usb_frcount_t max_frames,
+uaudio_setup_blockcount(struct uaudio_chan *ch,
     uint32_t *total, uint32_t *blockcount)
 {
-	uint32_t temp;
-	uint32_t isiz;
-
-	/* allow dynamic sizing of play buffer */
-	isiz = ch->intr_size;
-
-	/* allow dynamic sizing of play buffer */
-	temp = isiz / ch->bytes_per_frame;
-
-	/* align units */
-	temp = UAUDIO_MINFRAMES_ALIGN(temp);
-
-	/* range check - min */
-	if (temp == 0)
-		temp = UAUDIO_MINFRAMES;
-
-	/* range check - max */
-	if (temp > max_frames)
-		temp = max_frames;
-
-	/* store blockcount */
-	*blockcount = temp;
-
-	/* compute the total length */
-	*total = temp * ch->bytes_per_frame;
+	*total = ch->intr_size;
+	*blockcount = ch->intr_frames;
 }
 
 static void
@@ -1162,8 +1135,12 @@ uaudio_chan_play_callback(struct usb_xfe
 
 	usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL);
 
-	uaudio_setup_blockcount(ch, usbd_xfer_max_frames(xfer),
-		&total, &blockcount);
+	uaudio_setup_blockcount(ch, &total, &blockcount);
+
+	if (ch->end == ch->start) {
+		DPRINTF("no buffer!\n");
+		return;
+	}
 
 	switch (USB_GET_STATE(xfer)) {
 	case USB_ST_TRANSFERRED:
@@ -1187,10 +1164,6 @@ tr_transferred:
 		for (n = 0; n != blockcount; n++)
 			usbd_xfer_set_frame_len(xfer, n, ch->bytes_per_frame);
 
-		if (ch->end == ch->start) {
-			DPRINTF("no buffer!\n");
-			break;
-		}
 		DPRINTFN(6, "transfer %d bytes\n", total);
 
 		offset = 0;
@@ -1235,17 +1208,23 @@ uaudio_chan_record_callback(struct usb_x
 	uint32_t blockcount;
 	uint32_t offset0;
 	uint32_t offset1;
+	uint32_t mfl;
 	int len;
-	int actlen, nframes;
+	int actlen;
+	int nframes;
 
 	usbd_xfer_status(xfer, &actlen, NULL, NULL, &nframes);
+	mfl = usbd_xfer_max_framelen(xfer);
 
-	uaudio_setup_blockcount(ch, usbd_xfer_max_frames(xfer),
-		&total, &blockcount);
+	uaudio_setup_blockcount(ch, &total, &blockcount);
+
+	if (ch->end == ch->start) {
+		DPRINTF("no buffer!\n");
+		return;
+	}
 
 	switch (USB_GET_STATE(xfer)) {
 	case USB_ST_TRANSFERRED:
-tr_transferred:
 		if (actlen < total) {
 			DPRINTF("short transfer, "
 			    "%d of %d bytes\n", actlen, total);
@@ -1254,11 +1233,11 @@ tr_transferred:
 		}
 
 		offset0 = 0;
+		pc = usbd_xfer_get_frame(xfer, 0);
 
 		for (n = 0; n != nframes; n++) {
 
 			offset1 = offset0;
-			pc = usbd_xfer_get_frame(xfer, 0);
 			len = usbd_xfer_frame_len(xfer, n);
 
 			while (len > 0) {
@@ -1279,36 +1258,26 @@ tr_transferred:
 				}
 			}
 
-			offset0 += ch->bytes_per_frame;
+			offset0 += mfl;
 		}
 
 		chn_intr(ch->pcm_ch);
 
 	case USB_ST_SETUP:
-		if (ch->bytes_per_frame > usbd_xfer_max_framelen(xfer)) {
-			DPRINTF("bytes per transfer, %d, "
-			    "exceeds maximum, %d!\n",
-			    ch->bytes_per_frame,
-			    usbd_xfer_max_framelen(xfer));
-			return;
-		}
+tr_setup:
 		usbd_xfer_set_frames(xfer, blockcount);
 		for (n = 0; n < blockcount; n++) {
-			usbd_xfer_set_frame_len(xfer, n, ch->bytes_per_frame);
+			usbd_xfer_set_frame_len(xfer, n, mfl);
 		}
 
-		if (ch->end == ch->start) {
-			DPRINTF("no buffer!\n");
-			return;
-		}
 		usbd_transfer_submit(xfer);
-		return;
+		break;
 
 	default:			/* Error */
 		if (error == USB_ERR_CANCELLED) {
-			return;
+			break;
 		}
-		goto tr_transferred;
+		goto tr_setup;
 	}
 }
 
@@ -1319,38 +1288,26 @@ uaudio_chan_init(struct uaudio_softc *sc
 	struct uaudio_chan *ch = ((dir == PCMDIR_PLAY) ?
 	    &sc->sc_play_chan : &sc->sc_rec_chan);
 	uint32_t buf_size;
+	uint32_t frames;
 	uint8_t endpoint;
+	uint8_t blocks;
 	uint8_t iface_index;
 	uint8_t alt_index;
+	uint8_t fps_shift;
 	usb_error_t err;
 
-	/* compute required buffer size */
-	buf_size = (ch->bytes_per_frame * UAUDIO_MINFRAMES);
-
-	/* setup interrupt interval */
-	ch->intr_size = buf_size;
+	if (usbd_get_isoc_fps(sc->sc_udev) < 8000) {
+		/* FULL speed USB */
+		frames = 8;
+	} else {
+		/* HIGH speed USB */
+		frames = UAUDIO_NFRAMES;
+	}
 
-	/* double buffering */
-	buf_size *= 2;
+	/* compute required buffer size */
 
-	ch->buf = malloc(buf_size, M_DEVBUF, M_WAITOK | M_ZERO);
-	if (ch->buf == NULL) {
-		goto error;
-	}
-	if (sndbuf_setup(b, ch->buf, buf_size) != 0) {
-		goto error;
-	}
-	ch->start = ch->buf;
-	ch->end = ch->buf + buf_size;
-	ch->cur = ch->buf;
-	ch->pcm_ch = c;
-	ch->pcm_mtx = c->lock;
-	ch->pcm_buf = b;
+	buf_size = (ch->bytes_per_frame * frames);
 
-	if (ch->pcm_mtx == NULL) {
-		DPRINTF("ERROR: PCM channels does not have a mutex!\n");
-		goto error;
-	}
 	/* setup play/record format */
 
 	ch->pcm_cap.fmtlist = ch->pcm_format;
@@ -1370,7 +1327,6 @@ uaudio_chan_init(struct uaudio_softc *sc
 
 	ch->pcm_cap.fmtlist[1] = 0;
 
-
 	/* set alternate interface corresponding to the mode */
 
 	endpoint = ch->p_ed1->bEndpointAddress;
@@ -1407,6 +1363,43 @@ uaudio_chan_init(struct uaudio_softc *sc
 		DPRINTF("could not allocate USB transfers!\n");
 		goto error;
 	}
+
+	fps_shift = usbd_xfer_get_fps_shift(ch->xfer[0]);
+
+	/* setup frame sizes */
+	ch->intr_size = buf_size;
+	ch->intr_frames = (frames >> fps_shift);
+	ch->bytes_per_frame <<= fps_shift;
+
+	if (ch->intr_frames == 0) {
+		DPRINTF("frame shift is too high!\n");
+		goto error;
+	}
+
+	/* setup double buffering */
+	buf_size *= 2;
+	blocks = 2;
+
+	ch->buf = malloc(buf_size, M_DEVBUF, M_WAITOK | M_ZERO);
+	if (ch->buf == NULL)
+		goto error;
+	if (sndbuf_setup(b, ch->buf, buf_size) != 0)
+		goto error;
+	if (sndbuf_resize(b, blocks, ch->intr_size)) 
+		goto error;
+
+	ch->start = ch->buf;
+	ch->end = ch->buf + buf_size;
+	ch->cur = ch->buf;
+	ch->pcm_ch = c;
+	ch->pcm_mtx = c->lock;
+	ch->pcm_buf = b;
+
+	if (ch->pcm_mtx == NULL) {
+		DPRINTF("ERROR: PCM channels does not have a mutex!\n");
+		goto error;
+	}
+
 	return (ch);
 
 error:
@@ -1431,30 +1424,13 @@ uaudio_chan_free(struct uaudio_chan *ch)
 int
 uaudio_chan_set_param_blocksize(struct uaudio_chan *ch, uint32_t blocksize)
 {
-	uaudio_chan_set_param_fragments(ch, blocksize, 0 - 1);
-
-	return (ch->block_size);
+	return (ch->intr_size);
 }
 
 int
 uaudio_chan_set_param_fragments(struct uaudio_chan *ch, uint32_t blocksize,
     uint32_t blockcount)
 {
-	/* we only support one size */
-	blocksize = ch->intr_size;
-	blockcount = 2;
-
-	if ((sndbuf_getblksz(ch->pcm_buf) != blocksize) ||
-	    (sndbuf_getblkcnt(ch->pcm_buf) != blockcount)) {
-		DPRINTFN(1, "resizing to %u x "
-		    "%u bytes\n", blockcount, blocksize);
-		if (sndbuf_resize(ch->pcm_buf, blockcount, blocksize)) {
-			DPRINTFN(0, "failed to resize sound buffer, count=%u, "
-			    "size=%u\n", blockcount, blocksize);
-		}
-	}
-	ch->block_size = sndbuf_getblksz(ch->pcm_buf);
-
 	return (1);
 }
 
@@ -1591,12 +1567,12 @@ uaudio_mixer_add_ctl(struct uaudio_softc
 		DPRINTF("adding %d\n", mc->ctl);
 	}
 
-	mc->delta = 0;
 	if (mc->type == MIX_ON_OFF) {
 		mc->minval = 0;
 		mc->maxval = 1;
+		mc->mod = 1;
 	} else if (mc->type == MIX_SELECTOR) {
-
+		mc->mod = 1;
 	} else {
 
 		/* determine min and max values */
@@ -1607,21 +1583,30 @@ uaudio_mixer_add_ctl(struct uaudio_softc
 
 		mc->maxval = uaudio_mixer_get(sc->sc_udev, GET_MAX, mc);
 
-		mc->maxval = 1 + uaudio_mixer_signext(mc->type, mc->maxval);
+		mc->maxval = uaudio_mixer_signext(mc->type, mc->maxval);
+
+		/* check if max and min was swapped */
+
+		if (mc->maxval < mc->minval) {
+			res = mc->maxval;
+			mc->maxval = mc->minval;
+			mc->minval = res;
+		}
 
+		/* compute value range */
 		mc->mul = mc->maxval - mc->minval;
-		if (mc->mul == 0) {
+		if (mc->mul == 0)
 			mc->mul = 1;
-		}
+
+		/* compute value alignment */
 		res = uaudio_mixer_get(sc->sc_udev, GET_RES, mc);
-		if (res > 0) {
-			mc->delta = ((res * 255) + (mc->mul / 2)) / mc->mul;
-		}
+		if (res == 0)
+			res = 1;
+		mc->mod = mc->mul / res;
+		if (mc->mod == 0)
+			mc->mod = 1;
 	}
 
-	if (mc->maxval < mc->minval) {
-		mc->maxval = mc->minval;
-	}
 	uaudio_mixer_add_ctl_sub(sc, mc);
 
 #if USB_DEBUG
@@ -3108,7 +3093,21 @@ uaudio_mixer_bsd2value(struct uaudio_mix
 			val = mc->minval;
 		}
 	} else {
-		val = (((val + (mc->delta / 2)) * mc->mul) / 255) + mc->minval;
+
+		/* compute actual volume */
+		val = (val * mc->mul) / 255;
+
+		/* align volume level */
+		val = val - (val % mc->mod);
+
+		/* add lower offset */
+		val = val + mc->minval;
+
+		/* make sure we don't write a value out of range */
+		if (val > mc->maxval)
+			val = mc->maxval;
+		else if (val < mc->minval)
+			val = mc->minval;
 	}
 
 	DPRINTFN(6, "type=0x%03x val=%d min=%d max=%d val=%d\n",
From thompsa at FreeBSD.org  Sun Nov  8 21:07:47 2009
From: thompsa at FreeBSD.org (Andrew Thompson)
Date: Sun Nov  8 21:07:54 2009
Subject: svn commit: r199061 - head/sys/dev/usb/storage
Message-ID: <200911082107.nA8L7l4m098002@svn.freebsd.org>

Author: thompsa
Date: Sun Nov  8 21:07:47 2009
New Revision: 199061
URL: http://svn.freebsd.org/changeset/base/199061

Log:
  Add missing mtx_destroy().
  
  Submitted by:	Sebastian Huber

Modified:
  head/sys/dev/usb/storage/umass.c

Modified: head/sys/dev/usb/storage/umass.c
==============================================================================
--- head/sys/dev/usb/storage/umass.c	Sun Nov  8 21:00:50 2009	(r199060)
+++ head/sys/dev/usb/storage/umass.c	Sun Nov  8 21:07:47 2009	(r199061)
@@ -1669,6 +1669,7 @@ umass_detach(device_t dev)
 #if (__FreeBSD_version >= 700037)
 	mtx_unlock(&sc->sc_mtx);
 #endif
+	mtx_destroy(&sc->sc_mtx);
 
 	return (0);			/* success */
 }
From thompsa at FreeBSD.org  Sun Nov  8 21:08:50 2009
From: thompsa at FreeBSD.org (Andrew Thompson)
Date: Sun Nov  8 21:08:57 2009
Subject: svn commit: r199062 - head/sys/dev/usb/storage
Message-ID: <200911082108.nA8L8oKO098071@svn.freebsd.org>

Author: thompsa
Date: Sun Nov  8 21:08:50 2009
New Revision: 199062
URL: http://svn.freebsd.org/changeset/base/199062

Log:
  Correct Olympus quirk.
  
  Submitted by:	Pavel Gubin

Modified:
  head/sys/dev/usb/storage/umass.c

Modified: head/sys/dev/usb/storage/umass.c
==============================================================================
--- head/sys/dev/usb/storage/umass.c	Sun Nov  8 21:07:47 2009	(r199061)
+++ head/sys/dev/usb/storage/umass.c	Sun Nov  8 21:08:50 2009	(r199062)
@@ -679,7 +679,7 @@ static const struct umass_devdescr umass
 		WRONG_CSWSIG
 	},
 	{USB_VENDOR_OLYMPUS, USB_PRODUCT_OLYMPUS_C700, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
+		UMASS_PROTO_DEFAULT,
 		NO_GETMAXLUN
 	},
 	{USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_SDS_HOTFIND_D, RID_WILDCARD,
From yongari at FreeBSD.org  Mon Nov  9 00:16:51 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Mon Nov  9 00:16:57 2009
Subject: svn commit: r199065 - head/sys/dev/bge
Message-ID: <200911090016.nA90GpCL002412@svn.freebsd.org>

Author: yongari
Date: Mon Nov  9 00:16:50 2009
New Revision: 199065
URL: http://svn.freebsd.org/changeset/base/199065

Log:
  Correct disabling checksum offloading for BCM5700 B0.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Sun Nov  8 21:42:00 2009	(r199064)
+++ head/sys/dev/bge/if_bge.c	Mon Nov  9 00:16:50 2009	(r199065)
@@ -2743,7 +2743,7 @@ bge_attach(device_t dev)
 	 */
 	if (sc->bge_chipid == BGE_CHIPID_BCM5700_B0) {
 		ifp->if_capabilities &= ~IFCAP_HWCSUM;
-		ifp->if_capenable &= IFCAP_HWCSUM;
+		ifp->if_capenable &= ~IFCAP_HWCSUM;
 		ifp->if_hwassist = 0;
 	}
 
From delphij at FreeBSD.org  Mon Nov  9 02:37:02 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Mon Nov  9 02:37:09 2009
Subject: svn commit: r199066 - head/usr.bin/gzip
Message-ID: <200911090237.nA92b2m7005471@svn.freebsd.org>

Author: delphij
Date: Mon Nov  9 02:37:02 2009
New Revision: 199066
URL: http://svn.freebsd.org/changeset/base/199066

Log:
  Apply a NetBSD fix (revision 1.12) to handle multi-session bzip2 files
  as created by pbzip2.
  
  Submitted by:	mrg (NetBSD.org)
  MFC after:	1 week

Modified:
  head/usr.bin/gzip/unbzip2.c

Modified: head/usr.bin/gzip/unbzip2.c
==============================================================================
--- head/usr.bin/gzip/unbzip2.c	Mon Nov  9 00:16:50 2009	(r199065)
+++ head/usr.bin/gzip/unbzip2.c	Mon Nov  9 02:37:02 2009	(r199066)
@@ -1,4 +1,4 @@
-/*	$NetBSD: unbzip2.c,v 1.11 2008/04/28 20:24:13 martin Exp $	*/
+/*	$NetBSD: unbzip2.c,v 1.12 2009/10/11 05:17:20 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@ unbzip2(int in, int out, char *pre, size
 	if (bytes_in)
 		*bytes_in = prelen;
 
-	while (ret >= BZ_OK && ret != BZ_STREAM_END) {
+	while (ret == BZ_OK) {
 	        if (bzs.avail_in == 0 && !end_of_file) {
 			ssize_t	n;
 
@@ -88,7 +88,7 @@ unbzip2(int in, int out, char *pre, size
 	        case BZ_OK:
 	                if (ret == BZ_OK && end_of_file)
 	                        maybe_err("read");
-	                if (!tflag) {
+	                if (!tflag && bzs.avail_out != BUFLEN) {
 				ssize_t	n;
 
 	                        n = write(out, outbuf, BUFLEN - bzs.avail_out);
@@ -96,7 +96,13 @@ unbzip2(int in, int out, char *pre, size
 	                                maybe_err("write");
 	                	bytes_out += n;
 	                }
-	                break;
+			if (ret == BZ_STREAM_END && !end_of_file) {
+				if (BZ2_bzDecompressEnd(&bzs) != BZ_OK ||
+				    BZ2_bzDecompressInit(&bzs, 0, 0) != BZ_OK)
+					maybe_errx("bzip2 re-init");
+				ret = BZ_OK;
+			}
+			break;
 
 	        case BZ_DATA_ERROR:
 	                maybe_warnx("bzip2 data integrity error");
@@ -109,7 +115,10 @@ unbzip2(int in, int out, char *pre, size
 	        case BZ_MEM_ERROR:
 	                maybe_warnx("bzip2 out of memory");
 			break;
-
+		
+		default:	
+			maybe_warnx("unknown bzip2 error: %d", ret);
+			break;
 	        }
 	}
 
From kuriyama at FreeBSD.org  Mon Nov  9 02:54:17 2009
From: kuriyama at FreeBSD.org (Jun Kuriyama)
Date: Mon Nov  9 02:54:28 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
Message-ID: <200911090254.nA92sG1G005921@svn.freebsd.org>

Author: kuriyama
Date: Mon Nov  9 02:54:16 2009
New Revision: 199067
URL: http://svn.freebsd.org/changeset/base/199067

Log:
  - Add hw.clflush_disable loader tunable to avoid panic (trap 9) at
    map_invalidate_cache_range() even if CPU is not Intel.
  - This tunable can be set to -1 (default), 0 and 1.  -1 is same as
    current behavior, which automatically disable CLFLUSH on Intel CPUs
    without CPUID_SS (should be occured on Xen only).  You can specify 1
    when this panic happened on non-Intel CPUs (such as AMD's).  Because
    disabling CLFLUSH may reduce performance, you can try with setting 0
    on Intel CPUs without SS to use CLFLUSH feature.
  
  Reviewed by:	kib
  Reported by:	karl, kuriyama
  Related to:	kern/138863

Modified:
  head/sys/amd64/amd64/initcpu.c
  head/sys/i386/i386/initcpu.c

Modified: head/sys/amd64/amd64/initcpu.c
==============================================================================
--- head/sys/amd64/amd64/initcpu.c	Mon Nov  9 02:37:02 2009	(r199066)
+++ head/sys/amd64/amd64/initcpu.c	Mon Nov  9 02:54:16 2009	(r199067)
@@ -47,6 +47,13 @@ __FBSDID("$FreeBSD$");
 static int	hw_instruction_sse;
 SYSCTL_INT(_hw, OID_AUTO, instruction_sse, CTLFLAG_RD,
     &hw_instruction_sse, 0, "SIMD/MMX2 instructions available in CPU");
+/*
+ * -1: automatic (default)
+ *  0: keep enable CLFLUSH
+ *  1: force disable CLFLUSH
+ */
+static int	hw_clflush_disable = -1;
+TUNABLE_INT("hw.clflush_disable", &hw_clflush_disable);
 
 int	cpu;			/* Are we 386, 386sx, 486, etc? */
 u_int	cpu_feature;		/* Feature flags */
@@ -169,6 +176,16 @@ initializecpu(void)
 	 * XXXKIB: (temporary) hack to work around traps generated when
 	 * CLFLUSHing APIC registers window.
 	 */
-	if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS))
+	TUNABLE_INT_FETCH("hw.clflush_disable", &hw_clflush_disable);
+	if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS) &&
+	    hw_clflush_disable == -1)
+		cpu_feature &= ~CPUID_CLFSH;
+	/*
+	 * Allow to disable CLFLUSH feature manually by
+	 * hw.clflush_disable tunable.  This may help Xen guest on some AMD
+	 * CPUs.
+	 */
+	if (hw_clflush_disable == 1) {
 		cpu_feature &= ~CPUID_CLFSH;
+	}
 }

Modified: head/sys/i386/i386/initcpu.c
==============================================================================
--- head/sys/i386/i386/initcpu.c	Mon Nov  9 02:37:02 2009	(r199066)
+++ head/sys/i386/i386/initcpu.c	Mon Nov  9 02:54:16 2009	(r199067)
@@ -75,6 +75,13 @@ static void	init_mendocino(void);
 static int	hw_instruction_sse;
 SYSCTL_INT(_hw, OID_AUTO, instruction_sse, CTLFLAG_RD,
     &hw_instruction_sse, 0, "SIMD/MMX2 instructions available in CPU");
+/*
+ * -1: automatic (default)
+ *  0: keep enable CLFLUSH
+ *  1: force disable CLFLUSH
+ */
+static int	hw_clflush_disable = -1;
+TUNABLE_INT("hw.clflush_disable", &hw_clflush_disable);
 
 /* Must *NOT* be BSS or locore will bzero these after setting them */
 int	cpu = 0;		/* Are we 386, 386sx, 486, etc? */
@@ -721,8 +728,18 @@ initializecpu(void)
 	 * XXXKIB: (temporary) hack to work around traps generated when
 	 * CLFLUSHing APIC registers window.
 	 */
-	if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS))
+	TUNABLE_INT_FETCH("hw.clflush_disable", &hw_clflush_disable);
+	if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS) &&
+	    hw_clflush_disable == -1)
+		cpu_feature &= ~CPUID_CLFSH;
+	/*
+	 * Allow to disable CLFLUSH feature manually by
+	 * hw.clflush_disable tunable.  This may help Xen guest on some AMD
+	 * CPUs.
+	 */
+	if (hw_clflush_disable == 1) {
 		cpu_feature &= ~CPUID_CLFSH;
+	}
 
 #if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE)
 	/*
From delphij at FreeBSD.org  Mon Nov  9 07:28:30 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Mon Nov  9 07:28:40 2009
Subject: svn commit: r199069 - head/sys/dev/arcmsr
Message-ID: <200911090728.nA97STW8011960@svn.freebsd.org>

Author: delphij
Date: Mon Nov  9 07:28:29 2009
New Revision: 199069
URL: http://svn.freebsd.org/changeset/base/199069

Log:
  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.
  
  Reported by:	Jirka Mikulas 
  Submitted by:	Erich Chen (Areca)
  Obtained from:	ftp://ftp.areca.com.tw/RaidCards/AP_Drivers/FreeBSD/DRIVER/SourceCode/arcmsr-freebsd-1.20.00.16-91010.zip
  MFC after:	3 days

Modified:
  head/sys/dev/arcmsr/arcmsr.c
  head/sys/dev/arcmsr/arcmsr.h

Modified: head/sys/dev/arcmsr/arcmsr.c
==============================================================================
--- head/sys/dev/arcmsr/arcmsr.c	Mon Nov  9 07:19:25 2009	(r199068)
+++ head/sys/dev/arcmsr/arcmsr.c	Mon Nov  9 07:28:29 2009	(r199069)
@@ -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: head/sys/dev/arcmsr/arcmsr.h
==============================================================================
--- head/sys/dev/arcmsr/arcmsr.h	Mon Nov  9 07:19:25 2009	(r199068)
+++ head/sys/dev/arcmsr/arcmsr.h	Mon Nov  9 07:28:29 2009	(r199069)
@@ -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 oleg at FreeBSD.org  Mon Nov  9 09:12:46 2009
From: oleg at FreeBSD.org (Oleg Bulyzhin)
Date: Mon Nov  9 09:12:51 2009
Subject: svn commit: r199073 - head/sys/netinet/ipfw
Message-ID: <200911090912.nA99CjGm014447@svn.freebsd.org>

Author: oleg
Date: Mon Nov  9 09:12:45 2009
New Revision: 199073
URL: http://svn.freebsd.org/changeset/base/199073

Log:
  style(9): add missing parentheses

Modified:
  head/sys/netinet/ipfw/ip_dummynet.c

Modified: head/sys/netinet/ipfw/ip_dummynet.c
==============================================================================
--- head/sys/netinet/ipfw/ip_dummynet.c	Mon Nov  9 08:54:47 2009	(r199072)
+++ head/sys/netinet/ipfw/ip_dummynet.c	Mon Nov  9 09:12:45 2009	(r199073)
@@ -252,7 +252,7 @@ static int	dummynet_io(struct mbuf **, i
 #define QUEUE_IS_IDLE(q) ((q)->head == NULL && (q)->S == (q)->F + 1 && \
 	curr_time > (q)->idle_time + 1 && \
 	((q)->numbytes + (curr_time - (q)->idle_time - 1) * \
-	(q)->fs->pipe->bandwidth >= q->fs->pipe->burst))
+	(q)->fs->pipe->bandwidth >= (q)->fs->pipe->burst))
 
 /*
  * Heap management functions.
From mav at FreeBSD.org  Mon Nov  9 09:27:10 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Mon Nov  9 09:27:21 2009
Subject: svn commit: r199074 - in head/sys/dev/ata: . chipsets
Message-ID: <200911090927.nA99R91d014842@svn.freebsd.org>

Author: mav
Date: Mon Nov  9 09:27:09 2009
New Revision: 199074
URL: http://svn.freebsd.org/changeset/base/199074

Log:
  Add more ICH10 chip IDs.
  
  Submitted by:	Dmitry S. Luhtionov 

Modified:
  head/sys/dev/ata/ata-pci.h
  head/sys/dev/ata/chipsets/ata-intel.c

Modified: head/sys/dev/ata/ata-pci.h
==============================================================================
--- head/sys/dev/ata/ata-pci.h	Mon Nov  9 09:12:45 2009	(r199073)
+++ head/sys/dev/ata/ata-pci.h	Mon Nov  9 09:27:09 2009	(r199074)
@@ -196,6 +196,10 @@ struct ata_pci_controller {
 #define ATA_I82801JD_AH         0x3a028086
 #define ATA_I82801JD_R1         0x3a058086
 #define ATA_I82801JD_S2         0x3a068086
+#define ATA_I82801JI_S1         0x3a208086
+#define ATA_I82801JI_AH         0x3a228086
+#define ATA_I82801JI_R1         0x3a258086
+#define ATA_I82801JI_S2         0x3a268086
 #define ATA_I31244              0x32008086
 
 #define ATA_ITE_ID              0x1283

Modified: head/sys/dev/ata/chipsets/ata-intel.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-intel.c	Mon Nov  9 09:12:45 2009	(r199073)
+++ head/sys/dev/ata/chipsets/ata-intel.c	Mon Nov  9 09:27:09 2009	(r199074)
@@ -135,6 +135,10 @@ ata_intel_probe(device_t dev)
      { ATA_I82801JD_AH,  0, INTEL_AHCI, 0, ATA_SA300, "ICH10" },
      { ATA_I82801JD_R1,  0, INTEL_AHCI, 0, ATA_SA300, "ICH10" },
      { ATA_I82801JD_S2,  0, INTEL_AHCI, 0, ATA_SA300, "ICH10" },
+     { ATA_I82801JI_S1,  0, INTEL_AHCI, 0, ATA_SA300, "ICH10" },
+     { ATA_I82801JI_AH,  0, INTEL_AHCI, 0, ATA_SA300, "ICH10" },
+     { ATA_I82801JI_R1,  0, INTEL_AHCI, 0, ATA_SA300, "ICH10" },
+     { ATA_I82801JI_S2,  0, INTEL_AHCI, 0, ATA_SA300, "ICH10" },
      { ATA_I31244,       0,          0, 2, ATA_SA150, "31244" },
      { 0, 0, 0, 0, 0, 0}};
 
From rpaulo at FreeBSD.org  Mon Nov  9 11:23:38 2009
From: rpaulo at FreeBSD.org (Rui Paulo)
Date: Mon Nov  9 11:23:44 2009
Subject: svn commit: r199076 - head/sys/net80211
Message-ID: <200911091123.nA9BNcxk019378@svn.freebsd.org>

Author: rpaulo
Date: Mon Nov  9 11:23:37 2009
New Revision: 199076
URL: http://svn.freebsd.org/changeset/base/199076

Log:
  The isr_intval in ieee80211req_scan_result structure should be 16 bit.
  This makes ifconfig list scan display the correct beacon interval
  (previously it would int overflow). As a side effect, this makes the
  ieee80211req_scan_result word aligned.
  
  Submitted by:	Paul B Mahol 

Modified:
  head/sys/net80211/ieee80211_ioctl.h

Modified: head/sys/net80211/ieee80211_ioctl.h
==============================================================================
--- head/sys/net80211/ieee80211_ioctl.h	Mon Nov  9 10:13:24 2009	(r199075)
+++ head/sys/net80211/ieee80211_ioctl.h	Mon Nov  9 11:23:37 2009	(r199076)
@@ -790,7 +790,7 @@ struct ieee80211req_scan_result {
 	uint16_t	isr_flags;		/* channel flags */
 	int8_t		isr_noise;
 	int8_t		isr_rssi;
-	uint8_t		isr_intval;		/* beacon interval */
+	uint16_t	isr_intval;		/* beacon interval */
 	uint8_t		isr_capinfo;		/* capabilities */
 	uint8_t		isr_erp;		/* ERP element */
 	uint8_t		isr_bssid[IEEE80211_ADDR_LEN];
From mav at FreeBSD.org  Mon Nov  9 11:39:51 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Mon Nov  9 11:40:03 2009
Subject: svn commit: r199079 - head/sbin/camcontrol
Message-ID: <200911091139.nA9BdpAU019880@svn.freebsd.org>

Author: mav
Date: Mon Nov  9 11:39:51 2009
New Revision: 199079
URL: http://svn.freebsd.org/changeset/base/199079

Log:
  Add support for ATA Power Management.

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.8
==============================================================================
--- head/sbin/camcontrol/camcontrol.8	Mon Nov  9 11:32:34 2009	(r199078)
+++ head/sbin/camcontrol/camcontrol.8	Mon Nov  9 11:39:51 2009	(r199079)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 4, 2009
+.Dd November 9, 2009
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -165,6 +165,20 @@
 .Op Fl w
 .Op Fl y
 .Nm
+.Ic idle
+.Op device id
+.Op generic args
+.Op Fl t Ar time
+.Nm
+.Ic standby
+.Op device id
+.Op generic args
+.Op Fl t Ar time
+.Nm
+.Ic sleep
+.Op device id
+.Op generic args
+.Nm
 .Ic help
 .Sh DESCRIPTION
 The
@@ -821,6 +835,15 @@ The user
 will not be asked about the timeout if a timeout is specified on the
 command line.
 .El
+.It Ic idle
+Put ATA device into IDLE state. Optional parameter specifies automatic
+idle timer value in seconds.
+.It Ic standby
+Put ATA device into STANDBY state. Optional parameter specifies automatic
+standby timer value in seconds.
+.It Ic sleep
+Put ATA device into SLEEP state. Note that the only way get device out of
+this state may be reset.
 .It Ic help
 Print out verbose usage information.
 .El

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Mon Nov  9 11:32:34 2009	(r199078)
+++ head/sbin/camcontrol/camcontrol.c	Mon Nov  9 11:39:51 2009	(r199079)
@@ -74,7 +74,10 @@ typedef enum {
 	CAM_CMD_DETACH		= 0x00000010,
 	CAM_CMD_REPORTLUNS	= 0x00000011,
 	CAM_CMD_READCAP		= 0x00000012,
-	CAM_CMD_IDENTIFY	= 0x00000013
+	CAM_CMD_IDENTIFY	= 0x00000013,
+	CAM_CMD_IDLE		= 0x00000014,
+	CAM_CMD_STANDBY		= 0x00000015,
+	CAM_CMD_SLEEP		= 0x00000016
 } cam_cmdmask;
 
 typedef enum {
@@ -154,6 +157,9 @@ struct camcontrol_opts option_table[] = 
 	{"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts},
 	{"debug", CAM_CMD_DEBUG, CAM_ARG_NONE, "IPTSXc"},
 	{"format", CAM_CMD_FORMAT, CAM_ARG_NONE, "qrwy"},
+	{"idle", CAM_CMD_IDLE, CAM_ARG_NONE, "t:"},
+	{"standby", CAM_CMD_STANDBY, CAM_ARG_NONE, "t:"},
+	{"sleep", CAM_CMD_SLEEP, CAM_ARG_NONE, ""},
 #endif /* MINIMALISTIC */
 	{"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL},
 	{"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL},
@@ -217,6 +223,8 @@ static int scsireportluns(struct cam_dev
 			  char *combinedopt, int retry_count, int timeout);
 static int scsireadcapacity(struct cam_device *device, int argc, char **argv,
 			    char *combinedopt, int retry_count, int timeout);
+static int atapm(struct cam_device *device, int argc, char **argv,
+			    char *combinedopt, int retry_count, int timeout);
 #endif /* MINIMALISTIC */
 
 camcontrol_optret
@@ -4128,6 +4136,91 @@ bailout:
 	return (retval);
 }
 
+static int
+atapm(struct cam_device *device, int argc, char **argv,
+		 char *combinedopt, int retry_count, int timeout)
+{
+	union ccb *ccb;
+	int retval = 0;
+	int t = -1;
+	char c;
+	u_char cmd, sc;
+
+	ccb = cam_getccb(device);
+
+	if (ccb == NULL) {
+		warnx("%s: error allocating ccb", __func__);
+		return (1);
+	}
+
+	while ((c = getopt(argc, argv, combinedopt)) != -1) {
+		switch (c) {
+		case 't':
+			t = atoi(optarg);
+			break;
+		default:
+			break;
+		}
+	}
+	if (strcmp(argv[1], "idle") == 0) {
+		if (t == -1)
+			cmd = ATA_IDLE_IMMEDIATE;
+		else
+			cmd = ATA_IDLE_CMD;
+	} else if (strcmp(argv[1], "standby") == 0) {
+		if (t == -1)
+			cmd = ATA_STANDBY_IMMEDIATE;
+		else
+			cmd = ATA_STANDBY_CMD;
+	} else {
+		cmd = ATA_SLEEP;
+		t = -1;
+	}
+	if (t < 0)
+		sc = 0;
+	else if (t <= (240 * 5))
+		sc = t / 5;
+	else if (t <= (11 * 30 * 60))
+		sc = t / (30 * 60) + 241;
+	else
+		sc = 253;
+	cam_fill_ataio(&ccb->ataio,
+		      retry_count,
+		      NULL,
+		      /*flags*/CAM_DIR_NONE,
+		      MSG_SIMPLE_Q_TAG,
+		      /*data_ptr*/NULL,
+		      /*dxfer_len*/0,
+		      timeout ? timeout : 30 * 1000);
+	ata_28bit_cmd(&ccb->ataio, cmd, 0, 0, sc);
+
+	/* Disable freezing the device queue */
+	ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
+
+	if (arglist & CAM_ARG_ERR_RECOVER)
+		ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
+
+	if (cam_send_ccb(device, ccb) < 0) {
+		warn("error sending command");
+
+		if (arglist & CAM_ARG_VERBOSE)
+			cam_error_print(device, ccb, CAM_ESF_ALL,
+					CAM_EPF_ALL, stderr);
+
+		retval = 1;
+		goto bailout;
+	}
+
+	if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+		cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr);
+		retval = 1;
+		goto bailout;
+	}
+bailout:
+	cam_freeccb(ccb);
+	return (retval);
+}
+
 #endif /* MINIMALISTIC */
 
 void 
@@ -4166,6 +4259,9 @@ usage(int verbose)
 "                              [-R syncrate][-v][-T ]\n"
 "                              [-U][-W bus_width]\n"
 "        camcontrol format     [dev_id][generic args][-q][-r][-w][-y]\n"
+"        camcontrol idle       [dev_id][generic args][-t time]\n"
+"        camcontrol standby    [dev_id][generic args][-t time]\n"
+"        camcontrol sleep      [dev_id][generic args]\n"
 #endif /* MINIMALISTIC */
 "        camcontrol help\n");
 	if (!verbose)
@@ -4193,6 +4289,9 @@ usage(int verbose)
 "tags        report or set the number of transaction slots for a device\n"
 "negotiate   report or set device negotiation parameters\n"
 "format      send the SCSI FORMAT UNIT command to the named device\n"
+"idle        send the ATA IDLE command to the named device\n"
+"standby     send the ATA STANDBY command to the named device\n"
+"sleep       send the ATA SLEEP command to the named device\n"
 "help        this message\n"
 "Device Identifiers:\n"
 "bus:target        specify the bus and target, lun defaults to 0\n"
@@ -4259,7 +4358,9 @@ usage(int verbose)
 "-q                be quiet, don't print status messages\n"
 "-r                run in report only mode\n"
 "-w                don't send immediate format command\n"
-"-y                don't ask any questions\n");
+"-y                don't ask any questions\n"
+"idle/standby arguments:\n"
+"-t           number of seconds before respective state.\n");
 #endif /* MINIMALISTIC */
 }
 
@@ -4555,6 +4656,13 @@ main(int argc, char **argv)
 						 combinedopt, retry_count,
 						 timeout);
 			break;
+		case CAM_CMD_IDLE:
+		case CAM_CMD_STANDBY:
+		case CAM_CMD_SLEEP:
+			error = atapm(cam_dev, argc, argv,
+						 combinedopt, retry_count,
+						 timeout);
+			break;
 #endif /* MINIMALISTIC */
 		case CAM_CMD_USAGE:
 			usage(1);
From spamwhole at gmail.com  Mon Nov  9 12:14:05 2009
From: spamwhole at gmail.com (Robert Kent)
Date: Mon Nov  9 12:14:11 2009
Subject: svn commit: r199074 - in head/sys/dev/ata: . chipsets
Message-ID: <6a3f63de0911090353h21201f05we3c3fe0cc0b8ab9a@mail.gmail.com>

On Mon, 9 Nov 2009 09:27:09 +0000 (UTC)
Alexander Motin  wrote:

> Author: mav
> Date: Mon Nov  9 09:27:09 2009
> New Revision: 199074
> URL: http://svn.freebsd.org/changeset/base/199074
>
> Log:
>   Add more ICH10 chip IDs.
>
>   Submitted by:	Dmitry S. Luhtionov 
>
> Modified:
>   head/sys/dev/ata/ata-pci.h
>   head/sys/dev/ata/chipsets/ata-intel.c

What are the chances of getting some ICH9-M chip IDs?

The chipset, according to Intel, is a SATA300 type, but the AHCI driver
only picks this up as 1.5gbps.


The PCI details are:

ahci0@pci0:0:31:2:      class=0x010601 card=0x833810f7 chip=0x29298086
rev=0x03 hdr=0x00 vendor     = 'Intel Corporation'
    device     = '82801IB/IR/IH (ICH9 Family) Mobile SATA AHCI
Controller' class      = mass storage
    subclass   = SATA
    cap 05[80] = MSI supports 16 messages enabled with 1 message
    cap 01[70] = powerspec 3  supports D0 D3  current D0
    cap 12[a8] = SATA Index-Data Pair
    cap 13[b0] = PCI Advanced Features: FLR TP


-- 
--
http://rob.tel
From mav at FreeBSD.org  Mon Nov  9 12:18:46 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Mon Nov  9 12:19:27 2009
Subject: svn commit: r199074 - in head/sys/dev/ata: . chipsets
In-Reply-To: <6a3f63de0911090353h21201f05we3c3fe0cc0b8ab9a@mail.gmail.com>
References: <6a3f63de0911090353h21201f05we3c3fe0cc0b8ab9a@mail.gmail.com>
Message-ID: <4AF808A1.6050309@FreeBSD.org>

Robert Kent wrote:
> On Mon, 9 Nov 2009 09:27:09 +0000 (UTC)
> Alexander Motin  wrote:
> 
>> Author: mav
>> Date: Mon Nov  9 09:27:09 2009
>> New Revision: 199074
>> URL: http://svn.freebsd.org/changeset/base/199074
>>
>> Log:
>>   Add more ICH10 chip IDs.
>>
>>   Submitted by:	Dmitry S. Luhtionov 
>>
>> Modified:
>>   head/sys/dev/ata/ata-pci.h
>>   head/sys/dev/ata/chipsets/ata-intel.c
> 
> What are the chances of getting some ICH9-M chip IDs?

Data welcome.

> The chipset, according to Intel, is a SATA300 type, but the AHCI driver
> only picks this up as 1.5gbps.

Some mobile chipsets limited to 1.5Gbps by hardware, second by BIOS,
third by drive capabilities. First is inevitable, second is difficult to
override, as these registers are write-once, third depends from drive.

> The PCI details are:

Please for every mode: Legacy, RAID, AHCI, ... And better in private.

-- 
Alexander Motin
From ume at FreeBSD.org  Mon Nov  9 12:29:00 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Mon Nov  9 12:29:13 2009
Subject: svn commit: r199080 - head/lib/libc/nls
Message-ID: <200911091229.nA9CT0Bp021040@svn.freebsd.org>

Author: ume
Date: Mon Nov  9 12:28:59 2009
New Revision: 199080
URL: http://svn.freebsd.org/changeset/base/199080

Log:
  Add ja_JP.UTF-8 catalog.
  
  Reviewed by:	hrs, nork, takawata
  MFC after:	1 week

Added:
  head/lib/libc/nls/ja_JP.UTF-8.msg   (contents, props changed)
Modified:
  head/lib/libc/nls/Makefile.inc

Modified: head/lib/libc/nls/Makefile.inc
==============================================================================
--- head/lib/libc/nls/Makefile.inc	Mon Nov  9 11:39:51 2009	(r199079)
+++ head/lib/libc/nls/Makefile.inc	Mon Nov  9 12:28:59 2009	(r199080)
@@ -23,6 +23,7 @@ NLS+=	fr_FR.ISO8859-1
 NLS+=	gl_ES.ISO8859-1
 NLS+=	hu_HU.ISO8859-2
 NLS+=	it_IT.ISO8859-15
+NLS+=	ja_JP.UTF-8
 NLS+=	ko_KR.UTF-8
 NLS+=	ko_KR.eucKR
 NLS+=	mn_MN.UTF-8

Added: head/lib/libc/nls/ja_JP.UTF-8.msg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/nls/ja_JP.UTF-8.msg	Mon Nov  9 12:28:59 2009	(r199080)
@@ -0,0 +1,249 @@
+$ $FreeBSD$
+$
+$ Message catalog for C locale (template)
+$
+$ strerror() support catalog
+$
+$set 1
+$ EPERM
+1 ????????????
+$ ENOENT
+2 ????????????????????????
+$ ESRCH
+3 ???????????????
+$ EINTR
+4 ???????????????
+$ EIO
+5 ????????
+$ ENXIO
+6 ??????????????
+$ E2BIG
+7 ????????????
+$ ENOEXEC
+8 ?????????
+$ EBADF
+9 ????????????
+$ ECHILD
+10 ???????????
+$ EDEADLK
+11 ?????????????????
+$ ENOMEM
+12 ??????????????
+$ EACCES
+13 ???????????????
+$ EFAULT
+14 ?????????
+$ ENOTBLK
+15 ?????????????????
+$ EBUSY
+16 ????????????
+$ EEXIST
+17 ??????????
+$ EXDEV
+18 ?????????????
+$ ENODEV
+19 ???????????????
+$ ENOTDIR
+20 ?????????????
+$ EISDIR
+21 ????????
+$ EINVAL
+22 ???????
+$ ENFILE
+23 ?????????????????????????
+$ EMFILE
+24 ??????????????????
+$ ENOTTY
+25 ???????????? ioctl ??
+$ ETXTBSY
+26 ????????????????
+$ EFBIG
+27 ???????????
+$ ENOSPC
+28 ?????????????
+$ ESPIPE
+29 ????????
+$ EROFS
+30 ????????????????
+$ EMLINK
+31 ??????????
+$ EPIPE
+32 ????????????
+$ EDOM
+33 ??????????
+$ ERANGE
+34 ?????????
+$ EAGAIN, EWOULDBLOCK
+35 ????????????????
+$ EINPROGRESS
+36 ??????????
+$ EALREADY
+37 ??????????
+$ ENOTSOCK
+38 ?????????????????????????
+$ EDESTADDRREQ
+39 ???????????????
+$ EMSGSIZE
+40 ???????????
+$ EPROTOTYPE
+41 ??????????????????????
+$ ENOPROTOOPT
+42 ?????????????
+$ EPROTONOSUPPORT
+43 ??????????????
+$ ESOCKTNOSUPPORT
+44 ????????????????
+$ EOPNOTSUPP
+45 ???????????
+$ EPFNOSUPPORT
+46 ??????????????????
+$ EAFNOSUPPORT
+47 ?????????????????????????????????
+$ EADDRINUSE
+48 ????????????
+$ EADDRNOTAVAIL
+49 ???????????????????
+$ ENETDOWN
+50 ???????????????
+$ ENETUNREACH
+51 ??????????????
+$ ENETRESET
+52 ???????????????????????
+$ ECONNABORTED
+53 ????????????????????
+$ ECONNRESET
+54 ????????????????????
+$ ENOBUFS
+55 ???????????
+$ EISCONN
+56 ???????????????
+$ ENOTCONN
+57 ??????????????
+$ ESHUTDOWN
+58 ???????????????????????
+$ ETOOMANYREFS
+59 ??????????????
+$ ETIMEDOUT
+60 ?????????????
+$ ECONNREFUSED
+61 ??????????
+$ ELOOP
+62 ??????????????????????
+$ ENAMETOOLONG
+63 ???????????
+$ EHOSTDOWN
+64 ????????????
+$ EHOSTUNREACH
+65 ?????????????
+$ ENOTEMPTY
+66 ???????????????
+$ EPROCLIM
+67 ??????????
+$ EUSERS
+68 ?????????
+$ EDQUOT
+69 ???????????????
+$ ESTALE
+70 ???? NFS ??????????
+$ EREMOTE
+71 ??????????????????
+$ EBADRPC
+72 ??? RPC ?????
+$ ERPCMISMATCH
+73 RPC ?????????????
+$ EPROGUNAVAIL
+74 RPC ?????????????
+$ EPROGMISMATCH
+75 ???????????????????
+$ EPROCUNAVAIL
+76 ????????????? procedure ??
+$ ENOLCK
+77 ???????????
+$ ENOSYS
+78 ????????????
+$ EFTYPE
+79 ?????????????????
+$ EAUTH
+80 ???????
+$ ENEEDAUTH
+81 ????????
+$ EIDRM
+82 ???????????
+$ ENOMSG
+83 ??????????????????
+$ EOVERFLOW
+84 ???????????????????
+$ ECANCELED
+85 ?????????????
+$ EILSEQ
+86 ?????????
+$ ENOATTR
+87 ?????????????
+$ EDOOFUS
+88 ????????????
+$
+$ strsignal() support catalog
+$
+$set 2
+$ SIGHUP
+1 ??????
+$ SIGINT
+2 ????
+$ SIGQUIT
+3 ??
+$ SIGILL
+4 ????
+$ SIGTRAP
+5 ????/BPT ????
+$ SIGABRT
+6 ????????
+$ SIGEMT
+7 EMT ????
+$ SIGFPE
+8 ???????
+$ SIGKILL
+9 Kill ???
+$ SIGBUS
+10 ?????
+$ SIGSEGV
+11 ???????????
+$ SIGSYS
+12 ????????????
+$ SIGPIPE
+13 ?????
+$ SIGALRM
+14 ????????
+$ SIGTERM
+15 ??
+$ SIGURG
+16 ???????
+$ SIGSTOP
+17 ???? (????)
+$ SIGTSTP
+18 ????
+$ SIGCONT
+19 ??
+$ SIGCHLD
+20 ????????
+$ SIGTTIN
+21 ???? (tty ??)
+$ SIGTTOU
+22 ???? (tty ??)
+$ SIGIO
+23 ?????
+$ SIGXCPU
+24 CPU ???????
+$ SIGXFSZ
+25 ????????????
+$ SIGVTALRM
+26 ??????????
+$ SIGPROF
+27 ??????????????
+$ SIGWINCH
+28 ???????????
+$ SIGINFO
+29 ????
+$ SIGUSR1
+30 ????????? 1
+$ SIGUSR2
+31 ????????? 2
From ume at FreeBSD.org  Mon Nov  9 12:33:47 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Mon Nov  9 12:34:03 2009
Subject: svn commit: r199081 - head/lib/libc/nls
Message-ID: <200911091233.nA9CXlmU021186@svn.freebsd.org>

Author: ume
Date: Mon Nov  9 12:33:47 2009
New Revision: 199081
URL: http://svn.freebsd.org/changeset/base/199081

Log:
  Add ja_JP.eucJP catalog.
  
  Reviewed by:	hrs, nork, takawata
  MFC after:	1 week

Added:
  head/lib/libc/nls/ja_JP.eucJP.msg   (contents, props changed)
Modified:
  head/lib/libc/nls/Makefile.inc

Modified: head/lib/libc/nls/Makefile.inc
==============================================================================
--- head/lib/libc/nls/Makefile.inc	Mon Nov  9 12:28:59 2009	(r199080)
+++ head/lib/libc/nls/Makefile.inc	Mon Nov  9 12:33:47 2009	(r199081)
@@ -24,6 +24,7 @@ NLS+=	gl_ES.ISO8859-1
 NLS+=	hu_HU.ISO8859-2
 NLS+=	it_IT.ISO8859-15
 NLS+=	ja_JP.UTF-8
+NLS+=	ja_JP.eucJP
 NLS+=	ko_KR.UTF-8
 NLS+=	ko_KR.eucKR
 NLS+=	mn_MN.UTF-8

Added: head/lib/libc/nls/ja_JP.eucJP.msg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/nls/ja_JP.eucJP.msg	Mon Nov  9 12:33:47 2009	(r199081)
@@ -0,0 +1,249 @@
+$ $FreeBSD$
+$
+$ Message catalog for C locale (template)
+$
+$ strerror() support catalog
+$
+$set 1
+$ EPERM
+1 µö²Ä¤µ¤ì¤Æ¤¤¤Ê¤¤Áàºî¤Ç¤¹
+$ ENOENT
+2 ¤½¤Î¤è¤¦¤Ê¥Õ¥¡¥¤¥ë¤Þ¤¿¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤Ï¤¢¤ê¤Þ¤»¤ó
+$ ESRCH
+3 ¤½¤Î¤è¤¦¤Ê¥×¥í¥»¥¹¤Ï¤¢¤ê¤Þ¤»¤ó
+$ EINTR
+4 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤¬ÃæÃǤµ¤ì¤Þ¤·¤¿
+$ EIO
+5 Æþ½ÐÎÏ¥¨¥é¡¼¤Ç¤¹
+$ ENXIO
+6 ¥Ç¥Ð¥¤¥¹¤¬½àÈ÷¤µ¤ì¤Æ¤¤¤Þ¤»¤ó
+$ E2BIG
+7 °ú¿ô¤Î¥ê¥¹¥È¤¬Ä¹¤¹¤®¤Þ¤¹
+$ ENOEXEC
+8 ̵¸ú¤Ê¼Â¹Ô·Á¼°¤Ç¤¹
+$ EBADF
+9 ̵¸ú¤Ê¥Õ¥¡¥¤¥ëµ­½Ò»Ò¤Ç¤¹
+$ ECHILD
+10 »Ò¥×¥í¥»¥¹¤¬¤¢¤ê¤Þ¤»¤ó
+$ EDEADLK
+11 ¥ê¥½¡¼¥¹¥Ç¥Ã¥É¥í¥Ã¥¯¤ò²óÈò¤·¤Þ¤·¤¿
+$ ENOMEM
+12 ¥á¥â¥ê¤Î³ä¤êÅö¤Æ¤¬¤Ç¤­¤Þ¤»¤ó
+$ EACCES
+13 ¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤¬µñÀ䤵¤ì¤Þ¤·¤¿
+$ EFAULT
+14 ̵¸ú¤Ê¥¢¥É¥ì¥¹¤Ç¤¹
+$ ENOTBLK
+15 ¥Ö¥í¥Ã¥¯¥Ç¥Ð¥¤¥¹¤¬Í׵ᤵ¤ì¤Æ¤¤¤Þ¤¹
+$ EBUSY
+16 ¥Ç¥Ð¥¤¥¹¤¬¥Ó¥¸¡¼¾õÂ֤Ǥ¹
+$ EEXIST
+17 ¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Þ¤¹
+$ EXDEV
+18 ¥Ç¥Ð¥¤¥¹¤ò¤Þ¤¿¤°¥ê¥ó¥¯¤Ç¤¹
+$ ENODEV
+19 ¥Ç¥Ð¥¤¥¹¤¬Âбþ¤·¤Æ¤Ê¤¤Áàºî¤Ç¤¹
+$ ENOTDIR
+20 ¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó
+$ EISDIR
+21 ¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¹
+$ EINVAL
+22 ̵¸ú¤Ê°ú¿ô¤Ç¤¹
+$ ENFILE
+23 ¥·¥¹¥Æ¥àÆâ¤Ç¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤¬Â¿¤¹¤®¤Þ¤¹
+$ EMFILE
+24 ¥ª¡¼¥×¥ó¤·¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤¬Â¿¤¹¤®¤Þ¤¹
+$ ENOTTY
+25 ¥Ç¥Ð¥¤¥¹¤¬Âбþ¤·¤Æ¤¤¤Ê¤¤ ioctl ¤Ç¤¹
+$ ETXTBSY
+26 ¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ë¤¬¥Ó¥¸¡¼¾õÂ֤Ǥ¹
+$ EFBIG
+27 ¥Õ¥¡¥¤¥ë¤¬Â礭¤¹¤®¤Þ¤¹
+$ ENOSPC
+28 ¥Ç¥Ð¥¤¥¹¤Î¶õ¤­ÎΰèÉÔ­¤Ç¤¹
+$ ESPIPE
+29 ̵¸ú¤Ê¥·¡¼¥¯¤Ç¤¹
+$ EROFS
+30 ÆÉ¤ß¹þ¤ßÀìÍÑ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ç¤¹
+$ EMLINK
+31 ¥ê¥ó¥¯¿ô¤¬Â¿¤¹¤®¤Þ¤¹
+$ EPIPE
+32 ¥Ñ¥¤¥×¤¬Ç˲õ¤µ¤ì¤Æ¤Þ¤·¤¿
+$ EDOM
+33 ¿ôÃͰú¿ô¤¬Èϰϳ°¤Ç¤¹
+$ ERANGE
+34 ·ë²Ì¤¬Â礭²á¤®¤Þ¤¹
+$ EAGAIN, EWOULDBLOCK
+35 ¥ê¥½¡¼¥¹¤¬°ì»þŪ¤ËÍøÍѤǤ­¤Þ¤»¤ó
+$ EINPROGRESS
+36 Áàºî¤¬¸½ºß¿Ê¹ÔÃæ¤Ç¤¹
+$ EALREADY
+37 Áàºî¤Ï´û¤Ë¿Ê¹ÔÃæ¤Ç¤¹
+$ ENOTSOCK
+38 ¥½¥±¥Ã¥È¤Ç¤Ê¤¤¤â¤Î¤Ë¤Ä¤¤¤Æ¥½¥±¥Ã¥ÈÁàºî¤ò¹Ô¤¤¤Þ¤·¤¿
+$ EDESTADDRREQ
+39 °¸À襢¥É¥ì¥¹¤¬Í׵ᤵ¤ì¤Æ¤¤¤Þ¤¹
+$ EMSGSIZE
+40 ¥á¥Ã¥»¡¼¥¸¤¬Ä¹¤¹¤®¤Þ¤¹
+$ EPROTOTYPE
+41 ¥½¥±¥Ã¥È¤¬Âбþ¤·¤Æ¤¤¤Ê¤¤¥×¥í¥È¥³¥ë¥¿¥¤¥×¤Ç¤¹
+$ ENOPROTOOPT
+42 ÍøÍѤǤ­¤Ê¤¤¥×¥í¥È¥³¥ë¤Ç¤¹
+$ EPROTONOSUPPORT
+43 Âбþ¤·¤Æ¤¤¤Ê¤¤¥×¥í¥È¥³¥ë¤Ç¤¹
+$ ESOCKTNOSUPPORT
+44 Âбþ¤·¤Æ¤¤¤Ê¤¤¥½¥±¥Ã¥È¥¿¥¤¥×¤Ç¤¹
+$ EOPNOTSUPP
+45 Âбþ¤·¤Æ¤¤¤Ê¤¤Áàºî¤Ç¤¹
+$ EPFNOSUPPORT
+46 Âбþ¤·¤Æ¤¤¤Ê¤¤¥×¥í¥È¥³¥ë¥Õ¥¡¥ß¥ê¤Ç¤¹
+$ EAFNOSUPPORT
+47 ¥×¥í¥È¥³¥ë¥Õ¥¡¥ß¥ê¤¬Âбþ¤·¤Æ¤¤¤Ê¤¤¥¢¥É¥ì¥¹¥Õ¥¡¥ß¥ê¤¬»ØÄꤵ¤ì¤Þ¤·¤¿
+$ EADDRINUSE
+48 ¥¢¥É¥ì¥¹¤¬´û¤Ë»ÈÍÑÃæ¤Ç¤¹
+$ EADDRNOTAVAIL
+49 Í׵ᤵ¤ì¤¿¥¢¥É¥ì¥¹¤ò³ä¤êÅö¤Æ¤Ç¤­¤Þ¤»¤ó
+$ ENETDOWN
+50 ¥Í¥Ã¥È¥ï¡¼¥¯¤¬¥À¥¦¥ó¤·¤Æ¤¤¤Þ¤¹
+$ ENETUNREACH
+51 ¥Í¥Ã¥È¥ï¡¼¥¯¤ËÅþã¤Ç¤­¤Þ¤»¤ó
+$ ENETRESET
+52 ¥ê¥»¥Ã¥È¤Ë¤è¤ê¥Í¥Ã¥È¥ï¡¼¥¯¤ÎÀܳ¤¬¼º¤ï¤ì¤Þ¤·¤¿
+$ ECONNABORTED
+53 ¥½¥Õ¥È¥¦¥§¥¢¤Ë¤è¤Ã¤ÆÀܳ¤¬ÀÚÃǤµ¤ì¤Þ¤·¤¿
+$ ECONNRESET
+54 Àܳ¤¬ÄÌ¿®Áê¼ê¤Ë¤è¤Ã¤Æ¥ê¥»¥Ã¥È¤µ¤ì¤Þ¤·¤¿
+$ ENOBUFS
+55 ¥Ð¥Ã¥Õ¥¡¤ÎÍÆÎÌÉÔ­¤Ç¤¹
+$ EISCONN
+56 ¥½¥±¥Ã¥È¤Ï´û¤ËÀܳ¤µ¤ì¤Æ¤¤¤Þ¤¹
+$ ENOTCONN
+57 ¥½¥±¥Ã¥È¤ÏÀܳ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó
+$ ESHUTDOWN
+58 ¥½¥±¥Ã¥È¤Î¥·¥ã¥Ã¥È¥À¥¦¥ó¤Î¸å¤ÇÁ÷¿®¤¬¤Ç¤­¤Þ¤»¤ó
+$ ETOOMANYREFS
+59 ½èÍý¸Â³¦¤òͤ¨¤ë¿½Å»²¾È¤Ç¤¹
+$ ETIMEDOUT
+60 Áàºî¤¬¥¿¥¤¥à¥¢¥¦¥È¤·¤Þ¤·¤¿
+$ ECONNREFUSED
+61 Àܳ¤¬µñÀ䤵¤ì¤Þ¤·¤¿
+$ ELOOP
+62 ½èÍý¸Â³¦¤òͤ¨¤ë¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¥ì¥Ù¥ë¤Ç¤¹
+$ ENAMETOOLONG
+63 ¥Õ¥¡¥¤¥ë̾¤¬Ä¹¤¹¤®¤Þ¤¹
+$ EHOSTDOWN
+64 ¥Û¥¹¥È¤¬¥À¥¦¥ó¤·¤Æ¤¤¤Þ¤¹
+$ EHOSTUNREACH
+65 ¥Û¥¹¥È¤Ø¤Î·ÐÏ©¤¬¤¢¤ê¤Þ¤»¤ó
+$ ENOTEMPTY
+66 ¥Ç¥£¥ì¥¯¥È¥ê¤¬¶õ¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó
+$ EPROCLIM
+67 ¥×¥í¥»¥¹¤¬Â¿¤¹¤®¤Þ¤¹
+$ EUSERS
+68 ¥æ¡¼¥¶¤¬Â¿¤¹¤®¤Þ¤¹
+$ EDQUOT
+69 ¥Ç¥£¥¹¥¯¥¯¥©¡¼¥¿¤¬Ä¶²á¤·¤Þ¤·¤¿
+$ ESTALE
+70 ¼º¸ú¤·¤¿ NFS ¥Õ¥¡¥¤¥ë¥Ï¥ó¥É¥ë¤Ç¤¹
+$ EREMOTE
+71 ¥Ñ¥¹Ãæ¤Î¥ê¥â¡¼¥È¤Î¥ì¥Ù¥ë¤¬Â¿¤¹¤®¤Þ¤¹
+$ EBADRPC
+72 ̵¸ú¤Ê RPC ¹½Â¤ÂΤǤ¹
+$ ERPCMISMATCH
+73 RPC ¥Ð¡¼¥¸¥ç¥ó¤¬´Ö°ã¤Ã¤Æ¤¤¤Þ¤¹
+$ EPROGUNAVAIL
+74 RPC ¥×¥í¥°¥é¥à¤¬ÍøÍѤǤ­¤Þ¤»¤ó
+$ EPROGMISMATCH
+75 ¥×¥í¥°¥é¥à¤Î¥Ð¡¼¥¸¥ç¥ó¤¬¹ç¤Ã¤Æ¤¤¤Þ¤»¤ó
+$ EPROCUNAVAIL
+76 ¥×¥í¥°¥é¥à¤Ç¤ÏÍøÍѤǤ­¤Ê¤¤ procedure ¤Ç¤¹
+$ ENOLCK
+77 ¥í¥Ã¥¯¤¬ÍøÍѤǤ­¤Þ¤»¤ó
+$ ENOSYS
+78 ´Ø¿ô¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó
+$ EFTYPE
+79 ¥Õ¥¡¥¤¥ë¤Î·¿¤Þ¤¿¤Ï·Á¼°¤¬ÉÔŬÀڤǤ¹
+$ EAUTH
+80 ǧ¾Ú¥¨¥é¡¼¤Ç¤¹
+$ ENEEDAUTH
+81 ǧ¾Úʪ¤¬É¬ÍפǤ¹
+$ EIDRM
+82 ¼±Ê̻ҤϺï½ü¤µ¤ì¤Þ¤·¤¿
+$ ENOMSG
+83 Í׵ᤵ¤ì¤¿·¿¤Î¥á¥Ã¥»¡¼¥¸¤¬¤¢¤ê¤Þ¤»¤ó
+$ EOVERFLOW
+84 ¥Ç¡¼¥¿·¿¤Ë³ÊǼ¤¹¤ë¤Ë¤ÏÂ礭¤¹¤®¤ëÃͤǤ¹
+$ ECANCELED
+85 ½èÍý¤¬¥­¥ã¥ó¥»¥ë¤µ¤ì¤Þ¤·¤¿
+$ EILSEQ
+86 ÉÔÀµ¤Ê¥Ð¥¤¥ÈÎó¤Ç¤¹
+$ ENOATTR
+87 ¤½¤Î¤è¤¦¤Ê°À­¤Ï¤¢¤ê¤Þ¤»¤ó
+$ EDOOFUS
+88 ¥×¥í¥°¥é¥ß¥ó¥°¥¨¥é¡¼¤Ç¤¹
+$
+$ strsignal() support catalog
+$
+$set 2
+$ SIGHUP
+1 ¥Ï¥ó¥°¥¢¥Ã¥×
+$ SIGINT
+2 ³ä¤ê¹þ¤ß
+$ SIGQUIT
+3 ̾̂
+$ SIGILL
+4 ÉÔÀµÌ¿Îá
+$ SIGTRAP
+5 ¥È¥ì¡¼¥¹/BPT ¥È¥é¥Ã¥×
+$ SIGABRT
+6 ¥¢¥Ü¡¼¥È¥È¥é¥Ã¥×
+$ SIGEMT
+7 EMT ¥È¥é¥Ã¥×
+$ SIGFPE
+8 ÉâÆ°¾®¿ôÅÀÎã³°
+$ SIGKILL
+9 Kill ¤µ¤ì¤¿
+$ SIGBUS
+10 ¥Ð¥¹¥¨¥é¡¼
+$ SIGSEGV
+11 ¥»¥°¥á¥ó¥Æ¡¼¥·¥ç¥ó°ãÈ¿
+$ SIGSYS
+12 ¸ºß¤·¤Ê¤¤¥·¥¹¥Æ¥à¥³¡¼¥ë
+$ SIGPIPE
+13 ¥Ñ¥¤¥×Ç˲õ
+$ SIGALRM
+14 ¥¢¥é¡¼¥à¥¯¥í¥Ã¥¯
+$ SIGTERM
+15 ½ªÎ»
+$ SIGURG
+16 ¶ÛµÞÆþ½ÐÎϾõ¶·
+$ SIGSTOP
+17 °ì»þÄä»ß (¥·¥°¥Ê¥ë)
+$ SIGTSTP
+18 °ì»þÄä»ß
+$ SIGCONT
+19 ·Ñ³
+$ SIGCHLD
+20 »Ò¥×¥í¥»¥¹¤Î½ªÎ»
+$ SIGTTIN
+21 °ì»þÄä»ß (tty ÆþÎÏ)
+$ SIGTTOU
+22 °ì»þÄä»ß (tty ½ÐÎÏ)
+$ SIGIO
+23 Æþ½ÐÎϲÄǽ
+$ SIGXCPU
+24 CPU »þ´Ö¤ÎÀ©¸ÂͲá
+$ SIGXFSZ
+25 ¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤ÎÀ©¸ÂͲá
+$ SIGVTALRM
+26 ²¾ÁÛ¥¿¥¤¥Þ¤Î´ü¸ÂͲá
+$ SIGPROF
+27 ¥×¥í¥Õ¥¡¥¤¥ë¥¿¥¤¥Þ¤Î´ü¸ÂͲá
+$ SIGWINCH
+28 ¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤ÎÊѲ½
+$ SIGINFO
+29 ¾ðÊóÍ×µá
+$ SIGUSR1
+30 ¥æ¡¼¥¶ÄêµÁ¥·¥°¥Ê¥ë 1
+$ SIGUSR2
+31 ¥æ¡¼¥¶ÄêµÁ¥·¥°¥Ê¥ë 2
From ume at FreeBSD.org  Mon Nov  9 12:38:13 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Mon Nov  9 12:38:19 2009
Subject: svn commit: r199082 - head/lib/libc/nls
Message-ID: <200911091238.nA9CcD4b021377@svn.freebsd.org>

Author: ume
Date: Mon Nov  9 12:38:13 2009
New Revision: 199082
URL: http://svn.freebsd.org/changeset/base/199082

Log:
  Fix comment.
  
  Pointed out by:	nyan
  MFC after:	1 week

Modified:
  head/lib/libc/nls/ja_JP.UTF-8.msg
  head/lib/libc/nls/ja_JP.eucJP.msg

Modified: head/lib/libc/nls/ja_JP.UTF-8.msg
==============================================================================
--- head/lib/libc/nls/ja_JP.UTF-8.msg	Mon Nov  9 12:33:47 2009	(r199081)
+++ head/lib/libc/nls/ja_JP.UTF-8.msg	Mon Nov  9 12:38:13 2009	(r199082)
@@ -1,6 +1,6 @@
 $ $FreeBSD$
 $
-$ Message catalog for C locale (template)
+$ Message catalog for ja_JP.UTF-8 locale
 $
 $ strerror() support catalog
 $

Modified: head/lib/libc/nls/ja_JP.eucJP.msg
==============================================================================
--- head/lib/libc/nls/ja_JP.eucJP.msg	Mon Nov  9 12:33:47 2009	(r199081)
+++ head/lib/libc/nls/ja_JP.eucJP.msg	Mon Nov  9 12:38:13 2009	(r199082)
@@ -1,6 +1,6 @@
 $ $FreeBSD$
 $
-$ Message catalog for C locale (template)
+$ Message catalog for ja_JP.eucJP locale
 $
 $ strerror() support catalog
 $
From gabor at FreeBSD.org  Mon Nov  9 12:42:32 2009
From: gabor at FreeBSD.org (Gabor Kovesdan)
Date: Mon Nov  9 12:42:37 2009
Subject: svn commit: r199081 - head/lib/libc/nls
In-Reply-To: <200911091233.nA9CXlmU021186@svn.freebsd.org>
References: <200911091233.nA9CXlmU021186@svn.freebsd.org>
Message-ID: <4AF80E2D.9060704@FreeBSD.org>

Hajimu UMEMOTO escribi?:
> Author: ume
> Date: Mon Nov  9 12:33:47 2009
> New Revision: 199081
> URL: http://svn.freebsd.org/changeset/base/199081
>
> Log:
>   Add ja_JP.eucJP catalog.
>   
>   Reviewed by:	hrs, nork, takawata
>   MFC after:	1 week
>   
When iconv hits HEAD, I plan to add some Makefile magic to just have the 
catalogs in one encoding and convert that to all the encodings of the 
locale. But for now, I think we cannot do anything, so the dulicate 
catalogs are the only solution I think.

-- 
Gabor Kovesdan
FreeBSD Volunteer

EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org
WEB:   http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org

From ume at FreeBSD.org  Mon Nov  9 12:46:59 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Mon Nov  9 12:47:05 2009
Subject: svn commit: r199083 - in head/lib/libc: net nls
Message-ID: <200911091246.nA9Ckxhk021614@svn.freebsd.org>

Author: ume
Date: Mon Nov  9 12:46:59 2009
New Revision: 199083
URL: http://svn.freebsd.org/changeset/base/199083

Log:
  Add NLS catalogs support to gai_strerror(3).
  Controlled by NLS define.

Modified:
  head/lib/libc/net/gai_strerror.c
  head/lib/libc/nls/C.msg

Modified: head/lib/libc/net/gai_strerror.c
==============================================================================
--- head/lib/libc/net/gai_strerror.c	Mon Nov  9 12:38:13 2009	(r199082)
+++ head/lib/libc/net/gai_strerror.c	Mon Nov  9 12:46:59 2009	(r199083)
@@ -30,7 +30,17 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "namespace.h"
 #include 
+#if defined(NLS)
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "reentrant.h"
+#endif
+#include "un-namespace.h"
 
 /* Entries EAI_ADDRFAMILY (1) and EAI_NODATA (7) are obsoleted, but left */
 /* for backward compatibility with userland code prior to 2553bis-02 */
@@ -52,9 +62,57 @@ static const char *ai_errlist[] = {
 	"Argument buffer overflow"			/* EAI_OVERFLOW */
 };
 
+#if defined(NLS)
+static char		gai_buf[NL_TEXTMAX];
+static once_t		gai_init_once = ONCE_INITIALIZER;
+static thread_key_t	gai_key;
+static int		gai_keycreated = 0;
+
+static void
+gai_keycreate(void)
+{
+	gai_keycreated = (thr_keycreate(&gai_key, free) == 0);
+}
+#endif
+
 const char *
 gai_strerror(int ecode)
 {
+#if defined(NLS)
+	nl_catd catd;
+	char *buf;
+
+	if (thr_main() != 0)
+		buf = gai_buf;
+	else {
+		if (thr_once(&gai_init_once, gai_keycreate) != 0 ||
+		    !gai_keycreated)
+			goto thr_err;
+		if ((buf = thr_getspecific(gai_key)) == NULL) {
+			if ((buf = malloc(sizeof(gai_buf))) == NULL)
+				goto thr_err;
+			if (thr_setspecific(gai_key, buf) != 0) {
+				free(buf);
+				goto thr_err;
+			}
+		}
+	}
+
+	catd = catopen("libc", NL_CAT_LOCALE);
+	if (ecode > 0 && ecode < EAI_MAX)
+		strlcpy(buf, catgets(catd, 3, ecode, ai_errlist[ecode]),
+		    sizeof(gai_buf));
+	else if (ecode == 0)
+		strlcpy(buf, catgets(catd, 3, NL_MSGMAX - 1, "Success"),
+		    sizeof(gai_buf));
+	else
+		strlcpy(buf, catgets(catd, 3, NL_MSGMAX, "Unknown error"),
+		    sizeof(gai_buf));
+	catclose(catd);
+	return buf;
+
+thr_err:
+#endif
 	if (ecode >= 0 && ecode < EAI_MAX)
 		return ai_errlist[ecode];
 	return "Unknown error";

Modified: head/lib/libc/nls/C.msg
==============================================================================
--- head/lib/libc/nls/C.msg	Mon Nov  9 12:38:13 2009	(r199082)
+++ head/lib/libc/nls/C.msg	Mon Nov  9 12:46:59 2009	(r199083)
@@ -257,3 +257,39 @@ $ SIGUSR1
 30 User defined signal 1
 $ SIGUSR2
 31 User defined signal 2
+$
+$ gai_strerror() support catalog
+$
+$set 3
+$ 1 (obsolete)
+1 Address family for hostname not supported
+$ EAI_AGAIN
+2 Temporary failure in name resolution
+$ EAI_BADFLAGS
+3 Invalid value for ai_flags
+$ EAI_FAIL
+4 Non-recoverable failure in name resolution
+$ EAI_FAMILY
+5 ai_family not supported
+$ EAI_MEMORY
+6 Memory allocation failure
+$ 7 (obsolete)
+7 No address associated with hostname
+$ EAI_NONAME
+8 hostname nor servname provided, or not known
+$ EAI_SERVICE
+9 servname not supported for ai_socktype
+$ EAI_SOCKTYPE
+10 ai_socktype not supported
+$ EAI_SYSTEM
+11 System error returned in errno
+$ EAI_BADHINTS
+12 Invalid value for hints
+$ EAI_PROTOCOL
+13 Resolved protocol is unknown
+$ EAI_OVERFLOW
+14 Argument buffer overflow
+$ 0
+32766 Success
+$ NL_MSGMAX
+32767 Unknown error
From Alexander at Leidinger.net  Mon Nov  9 12:59:21 2009
From: Alexander at Leidinger.net (Alexander Leidinger)
Date: Mon Nov  9 13:00:08 2009
Subject: svn commit: r199050 - in head/sys: conf dev/ata
In-Reply-To: <200911081433.nA8EXJnp088767@svn.freebsd.org>
References: <200911081433.nA8EXJnp088767@svn.freebsd.org>
Message-ID: <20091109135909.19604fhtvmaw7yg4@webmail.leidinger.net>

Quoting Alexander Motin  (from Sun, 8 Nov 2009  
14:33:19 +0000 (UTC)):

> Log:
>   Introduce define and kernel option ATA_REQUEST_TIMEOUT to control ATA(4)
>   command timeout.

> Modified: head/sys/conf/NOTES
> ==============================================================================
> --- head/sys/conf/NOTES	Sun Nov  8 14:28:23 2009	(r199049)
> +++ head/sys/conf/NOTES	Sun Nov  8 14:33:19 2009	(r199050)
> @@ -1715,8 +1715,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

Don't we use "$default_value + 1" in NOTES?

Bye,
Alexander.

-- 
: is not an identifier

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID = 72077137
From ume at FreeBSD.org  Mon Nov  9 13:00:30 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Mon Nov  9 13:00:36 2009
Subject: svn commit: r199081 - head/lib/libc/nls
In-Reply-To: <4AF80E2D.9060704@FreeBSD.org>
References: <200911091233.nA9CXlmU021186@svn.freebsd.org>
	<4AF80E2D.9060704@FreeBSD.org>
Message-ID: 

Hi,

>>>>> On Mon, 09 Nov 2009 13:42:21 +0100
>>>>> Gabor Kovesdan  said:

gabor> When iconv hits HEAD, I plan to add some Makefile magic to just have the 
gabor> catalogs in one encoding and convert that to all the encodings of the 
gabor> locale. But for now, I think we cannot do anything, so the dulicate 
gabor> catalogs are the only solution I think.

Oh, it's great!  I'm looking forward to see it happen.
Tcsh does similar thing at runtime using iconv.  Our csh has some
trick to load libiconv dynamically.
BTW, gencat(1) doesn't like ja_JP.SJIS catalog.  So, I could not add
ja_JP.SJIS one.

Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@mahoroba.org  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/
From nwhitehorn at FreeBSD.org  Mon Nov  9 14:26:23 2009
From: nwhitehorn at FreeBSD.org (Nathan Whitehorn)
Date: Mon Nov  9 14:26:35 2009
Subject: svn commit: r199084 - head/sys/powerpc/aim
Message-ID: <200911091426.nA9EQNnH023799@svn.freebsd.org>

Author: nwhitehorn
Date: Mon Nov  9 14:26:23 2009
New Revision: 199084
URL: http://svn.freebsd.org/changeset/base/199084

Log:
  Increase the size of the OFW translations buffer to handle G5 systems
  that use many translation regions in firmware, and add bounds checking
  to prevent buffer overflows in case even the new value is exceeded.
  
  Reported by:	Jacob Lambert
  MFC after:	3 days

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Mon Nov  9 12:46:59 2009	(r199083)
+++ head/sys/powerpc/aim/mmu_oea64.c	Mon Nov  9 14:26:23 2009	(r199084)
@@ -264,7 +264,7 @@ static struct	mem_region *pregions;
 extern u_int	phys_avail_count;
 extern int	regions_sz, pregions_sz;
 extern int	ofw_real_mode;
-static struct	ofw_map translations[64];
+static struct	ofw_map translations[96];
 
 extern struct pmap ofw_pmap;
 
@@ -897,6 +897,9 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o
 		panic("moea64_bootstrap: can't get mmu package");
 	    if ((sz = OF_getproplen(mmu, "translations")) == -1)
 		panic("moea64_bootstrap: can't get ofw translation count");
+	    if (size > sizeof(translations))
+		panic("moea64_bootstrap: too many ofw translations (%d)",
+		      sz/sizeof(*translations));
 
 	    bzero(translations, sz);
 	    if (OF_getprop(mmu, "translations", translations, sz) == -1)
From rpaulo at FreeBSD.org  Mon Nov  9 15:59:10 2009
From: rpaulo at FreeBSD.org (Rui Paulo)
Date: Mon Nov  9 15:59:17 2009
Subject: svn commit: r199086 - in head/sys: conf dev/usb/input modules/usb
	modules/usb/atp
Message-ID: <200911091559.nA9FxArx026087@svn.freebsd.org>

Author: rpaulo
Date: Mon Nov  9 15:59:09 2009
New Revision: 199086
URL: http://svn.freebsd.org/changeset/base/199086

Log:
  Driver for the Apple Touchpad present on MacBook (non-Pro & Pro).
  
  Submitted by:	Rohit Grover 
  MFC after:	2 months

Added:
  head/sys/dev/usb/input/atp.c   (contents, props changed)
  head/sys/modules/usb/atp/
  head/sys/modules/usb/atp/Makefile   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/modules/usb/Makefile

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Mon Nov  9 15:11:37 2009	(r199085)
+++ head/sys/conf/files	Mon Nov  9 15:59:09 2009	(r199086)
@@ -1698,6 +1698,7 @@ dev/usb/misc/udbp.c		optional udbp
 #
 # USB input drivers
 #
+dev/usb/input/atp.c		optional atp
 dev/usb/input/uhid.c		optional uhid
 dev/usb/input/ukbd.c		optional ukbd
 dev/usb/input/ums.c		optional ums

Added: head/sys/dev/usb/input/atp.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/usb/input/atp.c	Mon Nov  9 15:59:09 2009	(r199086)
@@ -0,0 +1,2047 @@
+/*-
+ * Copyright (c) 2009 Rohit Grover
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include "usbdevs.h"
+
+#define USB_DEBUG_VAR atp_debug
+#include 
+
+#include 
+
+#define ATP_DRIVER_NAME "atp"
+
+/*
+ * Driver specific options: the following options may be set by
+ * `options' statements in the kernel configuration file.
+ */
+
+/* The multiplier used to translate sensor reported positions to mickeys. */
+#ifndef ATP_SCALE_FACTOR
+#define ATP_SCALE_FACTOR 48
+#endif
+
+/*
+ * This is the age (in microseconds) beyond which a touch is
+ * considered to be a slide; and therefore a tap event isn't registered.
+ */
+#ifndef ATP_TOUCH_TIMEOUT
+#define ATP_TOUCH_TIMEOUT 125000
+#endif
+
+/*
+ * A double-tap followed by a single-finger slide is treated as a
+ * special gesture. The driver responds to this gesture by assuming a
+ * virtual button-press for the lifetime of the slide. The following
+ * threshold is the maximum time gap (in microseconds) between the two
+ * tap events preceding the slide for such a gesture.
+ */
+#ifndef ATP_DOUBLE_TAP_N_DRAG_THRESHOLD
+#define ATP_DOUBLE_TAP_N_DRAG_THRESHOLD 200000
+#endif
+
+/*
+ * The device provides us only with pressure readings from an array of
+ * X and Y sensors; for our algorithms, we need to interpret groups
+ * (typically pairs) of X and Y readings as being related to a single
+ * finger stroke. We can relate X and Y readings based on their times
+ * of incidence. The coincidence window should be at least 10000us
+ * since it is used against values from getmicrotime(), which has a
+ * precision of around 10ms.
+ */
+#ifndef ATP_COINCIDENCE_THRESHOLD
+#define ATP_COINCIDENCE_THRESHOLD  40000 /* unit: microseconds */
+#if ATP_COINCIDENCE_THRESHOLD > 100000
+#error "ATP_COINCIDENCE_THRESHOLD too large"
+#endif
+#endif /* #ifndef ATP_COINCIDENCE_THRESHOLD */
+
+/*
+ * The wait duration (in microseconds) after losing a touch contact
+ * before zombied strokes are reaped and turned into button events.
+ */
+#define ATP_ZOMBIE_STROKE_REAP_WINDOW   50000
+#if ATP_ZOMBIE_STROKE_REAP_WINDOW > 100000
+#error "ATP_ZOMBIE_STROKE_REAP_WINDOW too large"
+#endif
+
+/* end of driver specific options */
+
+
+/* Tunables */
+SYSCTL_NODE(_hw_usb, OID_AUTO, atp, CTLFLAG_RW, 0, "USB atp");
+
+#if USB_DEBUG
+enum atp_log_level {
+	ATP_LLEVEL_DISABLED = 0,
+	ATP_LLEVEL_ERROR,
+	ATP_LLEVEL_DEBUG,       /* for troubleshooting */
+	ATP_LLEVEL_INFO,        /* for diagnostics */
+};
+static int atp_debug = ATP_LLEVEL_ERROR; /* the default is to only log errors */
+SYSCTL_INT(_hw_usb_atp, OID_AUTO, debug, CTLFLAG_RW,
+    &atp_debug, ATP_LLEVEL_ERROR, "ATP debug level");
+#endif /* #if USB_DEBUG */
+
+static u_int atp_touch_timeout = ATP_TOUCH_TIMEOUT;
+SYSCTL_INT(_hw_usb_atp, OID_AUTO, touch_timeout, CTLFLAG_RW, &atp_touch_timeout,
+    125000, "age threshold (in micros) for a touch");
+
+static u_int atp_double_tap_threshold = ATP_DOUBLE_TAP_N_DRAG_THRESHOLD;
+SYSCTL_INT(_hw_usb_atp, OID_AUTO, double_tap_threshold, CTLFLAG_RW,
+    &atp_double_tap_threshold, ATP_DOUBLE_TAP_N_DRAG_THRESHOLD,
+    "maximum time (in micros) between a double-tap");
+
+static u_int atp_mickeys_scale_factor = ATP_SCALE_FACTOR;
+static int atp_sysctl_scale_factor_handler(SYSCTL_HANDLER_ARGS);
+SYSCTL_PROC(_hw_usb_atp, OID_AUTO, scale_factor, CTLTYPE_UINT | CTLFLAG_RW,
+    &atp_mickeys_scale_factor, sizeof(atp_mickeys_scale_factor),
+    atp_sysctl_scale_factor_handler, "IU", "movement scale factor");
+
+static u_int atp_small_movement_threshold = ATP_SCALE_FACTOR >> 3;
+SYSCTL_UINT(_hw_usb_atp, OID_AUTO, small_movement, CTLFLAG_RW,
+    &atp_small_movement_threshold, ATP_SCALE_FACTOR >> 3,
+    "the small movement black-hole for filtering noise");
+/*
+ * The movement threshold for a stroke; this is the maximum difference
+ * in position which will be resolved as a continuation of a stroke
+ * component.
+ */
+static u_int atp_max_delta_mickeys = ((3 * ATP_SCALE_FACTOR) >> 1);
+SYSCTL_UINT(_hw_usb_atp, OID_AUTO, max_delta_mickeys, CTLFLAG_RW,
+    &atp_max_delta_mickeys, ((3 * ATP_SCALE_FACTOR) >> 1),
+    "max. mickeys-delta which will match against an existing stroke");
+/*
+ * Strokes which accumulate at least this amount of absolute movement
+ * from the aggregate of their components are considered as
+ * slides. Unit: mickeys.
+ */
+static u_int atp_slide_min_movement = (ATP_SCALE_FACTOR >> 3);
+SYSCTL_UINT(_hw_usb_atp, OID_AUTO, slide_min_movement, CTLFLAG_RW,
+    &atp_slide_min_movement, (ATP_SCALE_FACTOR >> 3),
+    "strokes with at least this amt. of movement are considered slides");
+
+/*
+ * The minimum age of a stroke for it to be considered mature; this
+ * helps filter movements (noise) from immature strokes. Units: interrupts.
+ */
+static u_int atp_stroke_maturity_threshold = 2;
+SYSCTL_UINT(_hw_usb_atp, OID_AUTO, stroke_maturity_threshold, CTLFLAG_RW,
+    &atp_stroke_maturity_threshold, 2,
+    "the minimum age of a stroke for it to be considered mature");
+
+/* Accept pressure readings from sensors only if above this value. */
+static u_int atp_sensor_noise_threshold = 2;
+SYSCTL_UINT(_hw_usb_atp, OID_AUTO, sensor_noise_threshold, CTLFLAG_RW,
+    &atp_sensor_noise_threshold, 2,
+    "accept pressure readings from sensors only if above this value");
+
+/* Ignore pressure spans with cumulative press. below this value. */
+static u_int atp_pspan_min_cum_pressure = 10;
+SYSCTL_UINT(_hw_usb_atp, OID_AUTO, pspan_min_cum_pressure, CTLFLAG_RW,
+    &atp_pspan_min_cum_pressure, 10,
+    "ignore pressure spans with cumulative press. below this value");
+
+/* Maximum allowed width for pressure-spans.*/
+static u_int atp_pspan_max_width = 4;
+SYSCTL_UINT(_hw_usb_atp, OID_AUTO, pspan_max_width, CTLFLAG_RW,
+    &atp_pspan_max_width, 4,
+    "maximum allowed width (in sensors) for pressure-spans");
+
+
+/* Define the various flavours of devices supported by this driver. */
+enum {
+	ATP_DEV_PARAMS_0,
+	ATP_N_DEV_PARAMS
+};
+struct atp_dev_params {
+	u_int            data_len;   /* for sensor data */
+	u_int            n_xsensors;
+	u_int            n_ysensors;
+} atp_dev_params[ATP_N_DEV_PARAMS] = {
+	[ATP_DEV_PARAMS_0] = {
+		.data_len   = 64,
+		.n_xsensors = 20,
+		.n_ysensors = 10
+	},
+};
+
+static const struct usb_device_id atp_devs[] = {
+	/* Core Duo MacBook & MacBook Pro */
+	{ USB_VPI(USB_VENDOR_APPLE, 0x0217, ATP_DEV_PARAMS_0) },
+	{ USB_VPI(USB_VENDOR_APPLE, 0x0218, ATP_DEV_PARAMS_0) },
+	{ USB_VPI(USB_VENDOR_APPLE, 0x0219, ATP_DEV_PARAMS_0) },
+
+	/* Core2 Duo MacBook & MacBook Pro */
+	{ USB_VPI(USB_VENDOR_APPLE, 0x021a, ATP_DEV_PARAMS_0) },
+	{ USB_VPI(USB_VENDOR_APPLE, 0x021b, ATP_DEV_PARAMS_0) },
+	{ USB_VPI(USB_VENDOR_APPLE, 0x021c, ATP_DEV_PARAMS_0) },
+
+	/* Core2 Duo MacBook3,1 */
+	{ USB_VPI(USB_VENDOR_APPLE, 0x0229, ATP_DEV_PARAMS_0) },
+	{ USB_VPI(USB_VENDOR_APPLE, 0x022a, ATP_DEV_PARAMS_0) },
+	{ USB_VPI(USB_VENDOR_APPLE, 0x022b, ATP_DEV_PARAMS_0) },
+};
+
+/*
+ * The following structure captures the state of a pressure span along
+ * an axis. Each contact with the touchpad results in separate
+ * pressure spans along the two axes.
+ */
+typedef struct atp_pspan {
+	u_int width;   /* in units of sensors */
+	u_int cum;     /* cumulative compression (from all sensors) */
+	u_int cog;     /* center of gravity */
+	u_int loc;     /* location (scaled using the mickeys factor) */
+	boolean_t matched; /* to track pspans as they match against strokes. */
+} atp_pspan;
+
+typedef enum atp_stroke_type {
+	ATP_STROKE_TOUCH,
+	ATP_STROKE_SLIDE,
+} atp_stroke_type;
+
+#define ATP_MAX_PSPANS_PER_AXIS 3
+
+typedef struct atp_stroke_component {
+	/* Fields encapsulating the pressure-span. */
+	u_int loc;              /* location (scaled) */
+	u_int cum_pressure;     /* cumulative compression */
+	u_int max_cum_pressure; /* max cumulative compression */
+	boolean_t matched; /*to track components as they match against pspans.*/
+
+	/* Fields containing information about movement. */
+	int   delta_mickeys;    /* change in location (un-smoothened movement)*/
+	int   pending;          /* cum. of pending short movements */
+	int   movement;         /* current smoothened movement */
+} atp_stroke_component;
+
+typedef enum atp_axis {
+	X = 0,
+	Y = 1
+} atp_axis;
+
+#define ATP_MAX_STROKES         (2 * ATP_MAX_PSPANS_PER_AXIS)
+
+/*
+ * The following structure captures a finger contact with the
+ * touchpad. A stroke comprises two p-span components and some state.
+ */
+typedef struct atp_stroke {
+	atp_stroke_type      type;
+	struct timeval       ctime; /* create time; for coincident siblings. */
+	u_int                age;   /*
+				     * Unit: interrupts; we maintain
+				     * this value in addition to
+				     * 'ctime' in order to avoid the
+				     * expensive call to microtime()
+				     * at every interrupt.
+				     */
+
+	atp_stroke_component components[2];
+	u_int                velocity_squared; /*
+						* Average magnitude (squared)
+						* of recent velocity.
+						*/
+	u_int                cum_movement; /* cum. absolute movement so far */
+
+	uint32_t             flags;  /* the state of this stroke */
+#define ATSF_ZOMBIE          0x1
+} atp_stroke;
+
+#define ATP_FIFO_BUF_SIZE        8 /* bytes */
+#define ATP_FIFO_QUEUE_MAXLEN   50 /* units */
+
+enum {
+	ATP_INTR_DT,
+	ATP_N_TRANSFER,
+};
+
+struct atp_softc {
+	device_t               sc_dev;
+	struct usb_device     *sc_usb_device;
+#define MODE_LENGTH 8
+	char                   sc_mode_bytes[MODE_LENGTH]; /* device mode */
+	struct mtx             sc_mutex; /* for synchronization */
+	struct usb_xfer       *sc_xfer[ATP_N_TRANSFER];
+	struct usb_fifo_sc     sc_fifo;
+
+	struct atp_dev_params *sc_params;
+
+	mousehw_t              sc_hw;
+	mousemode_t            sc_mode;
+	u_int                  sc_pollrate;
+	mousestatus_t          sc_status;
+	u_int                  sc_state;
+#define ATP_ENABLED            0x01
+#define ATP_ZOMBIES_EXIST      0x02
+#define ATP_DOUBLE_TAP_DRAG    0x04
+
+	u_int                  sc_left_margin;
+	u_int                  sc_right_margin;
+
+	atp_stroke             sc_strokes[ATP_MAX_STROKES];
+	u_int                  sc_n_strokes;
+
+	int8_t                *sensor_data; /* from interrupt packet */
+	int                   *base_x;      /* base sensor readings */
+	int                   *base_y;
+	int                   *cur_x;       /* current sensor readings */
+	int                   *cur_y;
+	int                   *pressure_x;  /* computed pressures */
+	int                   *pressure_y;
+
+	u_int                  sc_idlecount; /* preceding idle interrupts */
+#define ATP_IDLENESS_THRESHOLD 10
+
+	struct timeval         sc_reap_time;
+	struct timeval         sc_reap_ctime; /*ctime of siblings to be reaped*/
+};
+
+/*
+ * The last byte of the sensor data contains status bits; the
+ * following values define the meanings of these bits.
+ */
+enum atp_status_bits {
+	ATP_STATUS_BUTTON      = (uint8_t)0x01, /* The button was pressed */
+	ATP_STATUS_BASE_UPDATE = (uint8_t)0x04, /* Data from an untouched pad.*/
+};
+
+typedef enum interface_mode {
+	RAW_SENSOR_MODE = (uint8_t)0x04,
+	HID_MODE        = (uint8_t)0x08
+} interface_mode;
+
+/*
+ * function prototypes
+ */
+static usb_fifo_cmd_t   atp_start_read;
+static usb_fifo_cmd_t   atp_stop_read;
+static usb_fifo_open_t  atp_open;
+static usb_fifo_close_t atp_close;
+static usb_fifo_ioctl_t atp_ioctl;
+
+static struct usb_fifo_methods atp_fifo_methods = {
+	.f_open       = &atp_open,
+	.f_close      = &atp_close,
+	.f_ioctl      = &atp_ioctl,
+	.f_start_read = &atp_start_read,
+	.f_stop_read  = &atp_stop_read,
+	.basename[0]  = ATP_DRIVER_NAME,
+};
+
+/* device initialization and shutdown */
+static usb_error_t   atp_req_get_report(struct usb_device *udev, void *data);
+static int           atp_set_device_mode(device_t dev, interface_mode mode);
+static int           atp_enable(struct atp_softc *sc);
+static void          atp_disable(struct atp_softc *sc);
+static int           atp_softc_populate(struct atp_softc *);
+static void          atp_softc_unpopulate(struct atp_softc *);
+
+/* sensor interpretation */
+static __inline void atp_interpret_sensor_data(const int8_t *, u_int, u_int,
+			 int *);
+static __inline void atp_get_pressures(int *, const int *, const int *, int);
+static void          atp_detect_pspans(int *, u_int, u_int, atp_pspan *,
+			 u_int *);
+
+/* movement detection */
+static boolean_t     atp_match_stroke_component(atp_stroke_component *,
+			 const atp_pspan *);
+static void          atp_match_strokes_against_pspans(struct atp_softc *,
+			 atp_axis, atp_pspan *, u_int, u_int);
+static boolean_t     atp_update_strokes(struct atp_softc *,
+			 atp_pspan *, u_int, atp_pspan *, u_int);
+static __inline void atp_add_stroke(struct atp_softc *, const atp_pspan *,
+			 const atp_pspan *);
+static void          atp_add_new_strokes(struct atp_softc *, atp_pspan *,
+			 u_int, atp_pspan *, u_int);
+static void          atp_advance_stroke_state(struct atp_softc *,
+			 atp_stroke *, boolean_t *);
+static void          atp_terminate_stroke(struct atp_softc *, u_int);
+static __inline boolean_t atp_stroke_has_small_movement(const atp_stroke *);
+static __inline void atp_update_pending_mickeys(atp_stroke_component *);
+static void          atp_compute_smoothening_scale_ratio(atp_stroke *, int *,
+			 int *);
+static boolean_t     atp_compute_stroke_movement(atp_stroke *);
+
+/* tap detection */
+static __inline void atp_setup_reap_time(struct atp_softc *, struct timeval *);
+static void          atp_reap_zombies(struct atp_softc *, u_int *, u_int *);
+
+/* updating fifo */
+static void          atp_reset_buf(struct atp_softc *sc);
+static void          atp_add_to_queue(struct atp_softc *, int, int, uint32_t);
+
+
+usb_error_t
+atp_req_get_report(struct usb_device *udev, void *data)
+{
+	struct usb_device_request req;
+
+	req.bmRequestType = UT_READ_CLASS_INTERFACE;
+	req.bRequest = UR_GET_REPORT;
+	USETW2(req.wValue, (uint8_t)0x03 /* type */, (uint8_t)0x00 /* id */);
+	USETW(req.wIndex, 0);
+	USETW(req.wLength, MODE_LENGTH);
+
+	return (usbd_do_request(udev, NULL /* mutex */, &req, data));
+}
+
+static int
+atp_set_device_mode(device_t dev, interface_mode mode)
+{
+	struct atp_softc     *sc;
+	usb_device_request_t  req;
+	usb_error_t           err;
+
+	if ((mode != RAW_SENSOR_MODE) && (mode != HID_MODE))
+		return (ENXIO);
+
+	sc = device_get_softc(dev);
+
+	sc->sc_mode_bytes[0] = mode;
+	req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
+	req.bRequest = UR_SET_REPORT;
+	USETW2(req.wValue, (uint8_t)0x03 /* type */, (uint8_t)0x00 /* id */);
+	USETW(req.wIndex, 0);
+	USETW(req.wLength, MODE_LENGTH);
+	err = usbd_do_request(sc->sc_usb_device, NULL, &req, sc->sc_mode_bytes);
+	if (err != USB_ERR_NORMAL_COMPLETION)
+		return (ENXIO);
+
+	return (0);
+}
+
+static int
+atp_enable(struct atp_softc *sc)
+{
+	/* Allocate the dynamic buffers */
+	if (atp_softc_populate(sc) != 0) {
+		atp_softc_unpopulate(sc);
+		return (ENOMEM);
+	}
+
+	/* reset status */
+	memset(sc->sc_strokes, 0, sizeof(sc->sc_strokes));
+	sc->sc_n_strokes = 0;
+	memset(&sc->sc_status, 0, sizeof(sc->sc_status));
+	sc->sc_idlecount = 0;
+	sc->sc_state |= ATP_ENABLED;
+
+	DPRINTFN(ATP_LLEVEL_INFO, "enabled atp\n");
+	return (0);
+}
+
+static void
+atp_disable(struct atp_softc *sc)
+{
+	atp_softc_unpopulate(sc);
+
+	sc->sc_state &= ~ATP_ENABLED;
+	DPRINTFN(ATP_LLEVEL_INFO, "disabled atp\n");
+}
+
+/* Allocate dynamic memory for some fields in softc. */
+static int
+atp_softc_populate(struct atp_softc *sc)
+{
+	const struct atp_dev_params *params = sc->sc_params;
+
+	if (params == NULL) {
+		DPRINTF("params uninitialized!\n");
+		return (ENXIO);
+	}
+	if (params->data_len) {
+		sc->sensor_data = malloc(params->data_len * sizeof(int8_t),
+		    M_USB, M_WAITOK);
+		if (sc->sensor_data == NULL) {
+			DPRINTF("mem for sensor_data\n");
+			return (ENXIO);
+		}
+	}
+
+	if (params->n_xsensors != 0) {
+		sc->base_x = malloc(params->n_xsensors * sizeof(*(sc->base_x)),
+		    M_USB, M_WAITOK);
+		if (sc->base_x == NULL) {
+			DPRINTF("mem for sc->base_x\n");
+			return (ENXIO);
+		}
+
+		sc->cur_x = malloc(params->n_xsensors * sizeof(*(sc->cur_x)),
+		    M_USB, M_WAITOK);
+		if (sc->cur_x == NULL) {
+			DPRINTF("mem for sc->cur_x\n");
+			return (ENXIO);
+		}
+
+		sc->pressure_x =
+			malloc(params->n_xsensors * sizeof(*(sc->pressure_x)),
+			    M_USB, M_WAITOK);
+		if (sc->pressure_x == NULL) {
+			DPRINTF("mem. for pressure_x\n");
+			return (ENXIO);
+		}
+	}
+
+	if (params->n_ysensors != 0) {
+		sc->base_y = malloc(params->n_ysensors * sizeof(*(sc->base_y)),
+		    M_USB, M_WAITOK);
+		if (sc->base_y == NULL) {
+			DPRINTF("mem for base_y\n");
+			return (ENXIO);
+		}
+
+		sc->cur_y = malloc(params->n_ysensors * sizeof(*(sc->cur_y)),
+		    M_USB, M_WAITOK);
+		if (sc->cur_y == NULL) {
+			DPRINTF("mem for cur_y\n");
+			return (ENXIO);
+		}
+
+		sc->pressure_y =
+			malloc(params->n_ysensors * sizeof(*(sc->pressure_y)),
+			    M_USB, M_WAITOK);
+		if (sc->pressure_y == NULL) {
+			DPRINTF("mem. for pressure_y\n");
+			return (ENXIO);
+		}
+	}
+
+	return (0);
+}
+
+/* Free dynamic memory allocated for some fields in softc. */
+static void
+atp_softc_unpopulate(struct atp_softc *sc)
+{
+	const struct atp_dev_params *params = sc->sc_params;
+
+	if (params == NULL) {
+		return;
+	}
+	if (params->n_xsensors != 0) {
+		if (sc->base_x != NULL) {
+			free(sc->base_x, M_USB);
+			sc->base_x = NULL;
+		}
+
+		if (sc->cur_x != NULL) {
+			free(sc->cur_x, M_USB);
+			sc->cur_x = NULL;
+		}
+
+		if (sc->pressure_x != NULL) {
+			free(sc->pressure_x, M_USB);
+			sc->pressure_x = NULL;
+		}
+	}
+	if (params->n_ysensors != 0) {
+		if (sc->base_y != NULL) {
+			free(sc->base_y, M_USB);
+			sc->base_y = NULL;
+		}
+
+		if (sc->cur_y != NULL) {
+			free(sc->cur_y, M_USB);
+			sc->cur_y = NULL;
+		}
+
+		if (sc->pressure_y != NULL) {
+			free(sc->pressure_y, M_USB);
+			sc->pressure_y = NULL;
+		}
+	}
+	if (sc->sensor_data != NULL) {
+		free(sc->sensor_data, M_USB);
+		sc->sensor_data = NULL;
+	}
+}
+
+/*
+ * Interpret the data from the X and Y pressure sensors. This function
+ * is called separately for the X and Y sensor arrays. The data in the
+ * USB packet is laid out in the following manner:
+ *
+ * sensor_data:
+ *            --,--,Y1,Y2,--,Y3,Y4,--,Y5,...,Y10, ... X1,X2,--,X3,X4
+ *  indices:   0  1  2  3  4  5  6  7  8 ...  15  ... 20 21 22 23 24
+ *
+ * '--' (in the above) indicates that the value is unimportant.
+ *
+ * Information about the above layout was obtained from the
+ * implementation of the AppleTouch driver in Linux.
+ *
+ * parameters:
+ *   sensor_data
+ *       raw sensor data from the USB packet.
+ *   num
+ *       The number of elements in the array 'arr'.
+ *   di_start
+ *       The index of the first data element to be interpreted for
+ *       this sensor array--i.e. when called to interpret the Y
+ *       sensors, di_start passed in as 2, which is the index of Y1 in
+ *       the raw data.
+ *   arr
+ *       The array to be initialized with the readings.
+ */
+static __inline void
+atp_interpret_sensor_data(const int8_t *sensor_data, u_int num, u_int di_start,
+    int	*arr)
+{
+	u_int i;
+	u_int di;   /* index into sensor data */
+
+	for (i = 0, di = di_start; i < num; /* empty */ ) {
+		arr[i++] = sensor_data[di++];
+		arr[i++] = sensor_data[di++];
+		di++;
+	}
+}
+
+static __inline void
+atp_get_pressures(int *p, const int *cur, const int *base, int n)
+{
+	int i;
+
+	for (i = 0; i < n; i++) {
+		p[i] = cur[i] - base[i];
+		if (p[i] > 127)
+			p[i] -= 256;
+		if (p[i] < -127)
+			p[i] += 256;
+		if (p[i] < 0)
+			p[i] = 0;
+
+		/*
+		 * Shave off pressures below the noise-pressure
+		 * threshold; this will reduce the contribution from
+		 * lower pressure readings.
+		 */
+		if (p[i] <= atp_sensor_noise_threshold)
+			p[i] = 0; /* filter away noise */
+		else
+			p[i] -= atp_sensor_noise_threshold;
+	}
+}
+
+static void
+atp_detect_pspans(int *p, u_int num_sensors,
+    u_int       max_spans, /* max # of pspans permitted */
+    atp_pspan  *spans,     /* finger spans */
+    u_int      *nspans_p)  /* num spans detected */
+{
+	u_int i;
+	int   maxp;             /* max pressure seen within a span */
+	u_int num_spans = 0;
+
+	enum atp_pspan_state {
+		ATP_PSPAN_INACTIVE,
+		ATP_PSPAN_INCREASING,
+		ATP_PSPAN_DECREASING,
+	} state; /* state of the pressure span */
+
+	/*
+	 * The following is a simple state machine to track
+	 * the phase of the pressure span.
+	 */
+	memset(spans, 0, max_spans * sizeof(atp_pspan));
+	maxp = 0;
+	state = ATP_PSPAN_INACTIVE;
+	for (i = 0; i < num_sensors; i++) {
+		if (num_spans >= max_spans)
+			break;
+
+		if (p[i] == 0) {
+			if (state == ATP_PSPAN_INACTIVE) {
+				/*
+				 * There is no pressure information for this
+				 * sensor, and we aren't tracking a finger.
+				 */
+				continue;
+			} else {
+				state = ATP_PSPAN_INACTIVE;
+				maxp = 0;
+				num_spans++;
+			}
+		} else {
+			switch (state) {
+			case ATP_PSPAN_INACTIVE:
+				state = ATP_PSPAN_INCREASING;
+				maxp  = p[i];
+				break;
+
+			case ATP_PSPAN_INCREASING:
+				if (p[i] > maxp)
+					maxp = p[i];
+				else if (p[i] <= (maxp >> 1))
+					state = ATP_PSPAN_DECREASING;
+				break;
+
+			case ATP_PSPAN_DECREASING:
+				if (p[i] > p[i - 1]) {
+					/*
+					 * This is the beginning of
+					 * another span; change state
+					 * to give the appearance that
+					 * we're starting from an
+					 * inactive span, and then
+					 * re-process this reading in
+					 * the next iteration.
+					 */
+					num_spans++;
+					state = ATP_PSPAN_INACTIVE;
+					maxp  = 0;
+					i--;
+					continue;
+				}
+				break;
+			}
+
+			/* Update the finger span with this reading. */
+			spans[num_spans].width++;
+			spans[num_spans].cum += p[i];
+			spans[num_spans].cog += p[i] * (i + 1);
+		}
+	}
+	if (state != ATP_PSPAN_INACTIVE)
+		num_spans++;    /* close the last finger span */
+
+	/* post-process the spans */
+	for (i = 0; i < num_spans; i++) {
+		/* filter away unwanted pressure spans */
+		if ((spans[i].cum < atp_pspan_min_cum_pressure) ||
+		    (spans[i].width > atp_pspan_max_width)) {
+			if ((i + 1) < num_spans) {
+				memcpy(&spans[i], &spans[i + 1],
+				    (num_spans - i - 1) * sizeof(atp_pspan));
+				i--;
+			}
+			num_spans--;
+			continue;
+		}
+
+		/* compute this span's representative location */
+		spans[i].loc = spans[i].cog * atp_mickeys_scale_factor /
+			spans[i].cum;
+
+		spans[i].matched = FALSE; /* not yet matched against a stroke */
+	}
+
+	*nspans_p = num_spans;
+}
+
+/*
+ * Match a pressure-span against a stroke-component. If there is a
+ * match, update the component's state and return TRUE.
+ */
+static boolean_t
+atp_match_stroke_component(atp_stroke_component *component,
+    const atp_pspan *pspan)
+{
+	int delta_mickeys = pspan->loc - component->loc;
+
+	if (abs(delta_mickeys) > atp_max_delta_mickeys)
+		return (FALSE); /* the finger span is too far out; no match */
+
+	component->loc          = pspan->loc;
+	component->cum_pressure = pspan->cum;
+	if (pspan->cum > component->max_cum_pressure)
+		component->max_cum_pressure = pspan->cum;
+
+	/*
+	 * If the cumulative pressure drops below a quarter of the max,
+	 * then disregard the component's movement.
+	 */
+	if (component->cum_pressure < (component->max_cum_pressure >> 2))
+		delta_mickeys = 0;
+
+	component->delta_mickeys = delta_mickeys;
+	return (TRUE);
+}
+
+static void
+atp_match_strokes_against_pspans(struct atp_softc *sc, atp_axis axis,
+    atp_pspan *pspans, u_int n_pspans, u_int repeat_count)
+{
+	u_int i, j;
+	u_int repeat_index = 0;
+
+	/* Determine the index of the multi-span. */
+	if (repeat_count) {
+		u_int cum = 0;
+		for (i = 0; i < n_pspans; i++) {
+			if (pspans[i].cum > cum) {
+				repeat_index = i;
+				cum = pspans[i].cum;
+			}
+		}
+	}
+
+	for (i = 0; i < sc->sc_n_strokes; i++) {
+		atp_stroke *stroke  = &sc->sc_strokes[i];
+		if (stroke->components[axis].matched)
+			continue; /* skip matched components */
+
+		for (j = 0; j < n_pspans; j++) {
+			if (pspans[j].matched)
+				continue; /* skip matched pspans */
+
+			if (atp_match_stroke_component(
+				    &stroke->components[axis], &pspans[j])) {
+				/* There is a match. */
+				stroke->components[axis].matched = TRUE;
+
+				/* Take care to repeat at the multi-span. */
+				if ((repeat_count > 0) && (j == repeat_index))
+					repeat_count--;
+				else
+					pspans[j].matched = TRUE;
+
+				break; /* skip to the next stroke */
+			}
+		} /* loop over pspans */
+	} /* loop over strokes */
+}
+
+/*
+ * Update strokes by matching against current pressure-spans.
+ * Return TRUE if any movement is detected.
+ */
+static boolean_t
+atp_update_strokes(struct atp_softc *sc, atp_pspan *pspans_x,
+    u_int n_xpspans, atp_pspan *pspans_y, u_int n_ypspans)
+{
+	u_int       i, j;
+	atp_stroke *stroke;
+	boolean_t   movement = FALSE;
+	u_int       repeat_count = 0;
+
+	/* Reset X and Y components of all strokes as unmatched. */
+	for (i = 0; i < sc->sc_n_strokes; i++) {
+		stroke = &sc->sc_strokes[i];
+		stroke->components[X].matched = FALSE;
+		stroke->components[Y].matched = FALSE;
+	}
+
+	/*
+	 * Usually, the X and Y pspans come in pairs (the common case
+	 * being a single pair). It is possible, however, that
+	 * multiple contacts resolve to a single pspan along an
+	 * axis, as illustrated in the following:
+	 *
+	 *   F = finger-contact
+	 *
+	 *                pspan  pspan
+	 *        +-----------------------+
+	 *        |         .      .      |
+	 *        |         .      .      |
+	 *        |         .      .      |
+	 *        |         .      .      |
+	 *  pspan |.........F......F      |
+	 *        |                       |
+	 *        |                       |
+	 *        |                       |
+	 *        +-----------------------+
+	 *
+	 *
+	 * The above case can be detected by a difference in the
+	 * number of X and Y pspans. When this happens, X and Y pspans
+	 * aren't easy to pair or match against strokes.
+	 *
+	 * When X and Y pspans differ in number, the axis with the
+	 * smaller number of pspans is regarded as having a repeating
+	 * pspan (or a multi-pspan)--in the above illustration, the
+	 * Y-axis has a repeating pspan. Our approach is to try to
+	 * match the multi-pspan repeatedly against strokes. The
+	 * difference between the number of X and Y pspans gives us a
+	 * crude repeat_count for matching multi-pspans--i.e. the
+	 * multi-pspan along the Y axis (above) has a repeat_count of 1.
+	 */
+	repeat_count = abs(n_xpspans - n_ypspans);
+
+	atp_match_strokes_against_pspans(sc, X, pspans_x, n_xpspans,
+	    (((repeat_count != 0) && ((n_xpspans < n_ypspans))) ?
+		repeat_count : 0));
+	atp_match_strokes_against_pspans(sc, Y, pspans_y, n_ypspans,
+	    (((repeat_count != 0) && (n_ypspans < n_xpspans)) ?
+		repeat_count : 0));
+
+	/* Update the state of strokes based on the above pspan matches. */
+	for (i = 0; i < sc->sc_n_strokes; i++) {
+		stroke = &sc->sc_strokes[i];
+		if (stroke->components[X].matched &&
+		    stroke->components[Y].matched) {
+			atp_advance_stroke_state(sc, stroke, &movement);
+		} else {
+			/*
+			 * At least one component of this stroke
+			 * didn't match against current pspans;
+			 * terminate it.
+			 */
+			atp_terminate_stroke(sc, i);
+		}
+	}
+
+	/* Add new strokes for pairs of unmatched pspans */
+	for (i = 0; i < n_xpspans; i++) {
+		if (pspans_x[i].matched == FALSE) break;
+	}
+	for (j = 0; j < n_ypspans; j++) {
+		if (pspans_y[j].matched == FALSE) break;
+	}
+	if ((i < n_xpspans) && (j < n_ypspans)) {
+#if USB_DEBUG
+		if (atp_debug >= ATP_LLEVEL_INFO) {
+			printf("unmatched pspans:");
+			for (; i < n_xpspans; i++) {
+				if (pspans_x[i].matched)
+					continue;
+				printf(" X:[loc:%u,cum:%u]",
+				    pspans_x[i].loc, pspans_x[i].cum);
+			}
+			for (; j < n_ypspans; j++) {
+				if (pspans_y[j].matched)
+					continue;
+				printf(" Y:[loc:%u,cum:%u]",
+				    pspans_y[j].loc, pspans_y[j].cum);
+			}
+			printf("\n");
+		}
+#endif /* #if USB_DEBUG */
+		if ((n_xpspans == 1) && (n_ypspans == 1))
+			/* The common case of a single pair of new pspans. */
+			atp_add_stroke(sc, &pspans_x[0], &pspans_y[0]);
+		else
+			atp_add_new_strokes(sc,
+			    pspans_x, n_xpspans,
+			    pspans_y, n_ypspans);
+	}
+
+#if USB_DEBUG
+	if (atp_debug >= ATP_LLEVEL_INFO) {
+		for (i = 0; i < sc->sc_n_strokes; i++) {
+			atp_stroke *stroke = &sc->sc_strokes[i];
+
+			printf(" %s%clc:%u,dm:%d,pnd:%d,mv:%d%c"
+			    ",%clc:%u,dm:%d,pnd:%d,mv:%d%c",
+			    (stroke->flags & ATSF_ZOMBIE) ? "zomb:" : "",
+			    (stroke->type == ATP_STROKE_TOUCH) ? '[' : '<',
+			    stroke->components[X].loc,
+			    stroke->components[X].delta_mickeys,
+			    stroke->components[X].pending,
+			    stroke->components[X].movement,
+			    (stroke->type == ATP_STROKE_TOUCH) ? ']' : '>',
+			    (stroke->type == ATP_STROKE_TOUCH) ? '[' : '<',
+			    stroke->components[Y].loc,
+			    stroke->components[Y].delta_mickeys,
+			    stroke->components[Y].pending,
+			    stroke->components[Y].movement,
+			    (stroke->type == ATP_STROKE_TOUCH) ? ']' : '>');
+		}

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
From rpaulo at FreeBSD.org  Mon Nov  9 16:05:33 2009
From: rpaulo at FreeBSD.org (Rui Paulo)
Date: Mon Nov  9 16:05:44 2009
Subject: svn commit: r199087 - head
Message-ID: <200911091605.nA9G5XLQ026346@svn.freebsd.org>

Author: rpaulo
Date: Mon Nov  9 16:05:32 2009
New Revision: 199087
URL: http://svn.freebsd.org/changeset/base/199087

Log:
  Mention the layout change of ieee80211req_scan_result.

Modified:
  head/UPDATING

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Mon Nov  9 15:59:09 2009	(r199086)
+++ head/UPDATING	Mon Nov  9 16:05:32 2009	(r199087)
@@ -22,6 +22,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.
 	machines to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
 
+20091109:
+	The layout of the structure ieee80211req_scan_result has changed.
+	Applications that require wireless scan results (e.g. ifconfig(8))
+	from net80211 need to be recompiled.
+
 20091025:
 	The iwn(4) driver has been updated to support the 5000 and 5150 series.
 	There's one kernel module for each firmware. Adding "device iwnfw"
From ume at FreeBSD.org  Mon Nov  9 17:26:17 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Mon Nov  9 17:26:30 2009
Subject: svn commit: r199092 - head/lib/libc/nls
Message-ID: <200911091726.nA9HQGuJ028254@svn.freebsd.org>

Author: ume
Date: Mon Nov  9 17:26:16 2009
New Revision: 199092
URL: http://svn.freebsd.org/changeset/base/199092

Log:
  Add gai_strerror() catalog for ja_JP.UTF-8 and ja_JP.eucJP.

Modified:
  head/lib/libc/nls/ja_JP.UTF-8.msg
  head/lib/libc/nls/ja_JP.eucJP.msg

Modified: head/lib/libc/nls/ja_JP.UTF-8.msg
==============================================================================
--- head/lib/libc/nls/ja_JP.UTF-8.msg	Mon Nov  9 16:43:50 2009	(r199091)
+++ head/lib/libc/nls/ja_JP.UTF-8.msg	Mon Nov  9 17:26:16 2009	(r199092)
@@ -247,3 +247,39 @@ $ SIGUSR1
 30 ユーザ定義シグナル 1
 $ SIGUSR2
 31 ユーザ定義シグナル 2
+$
+$ gai_strerror() support catalog
+$
+$set 3
+$ 1 (obsolete)
+1 ホストåã®ã‚¢ãƒ‰ãƒ¬ã‚¹ãƒ•ァミリーã¯ã‚µãƒãƒ¼ãƒˆã•れã¾ã›ã‚“
+$ EAI_AGAIN
+2 åå‰è§£æ±ºã§ã®ä¸€æ™‚çš„ãªå¤±æ•—
+$ EAI_BADFLAGS
+3 ai_flags ã®å€¤ãŒç„¡åй
+$ EAI_FAIL
+4 åå‰è§£æ±ºã§ã®å›žå¾©ä¸èƒ½ãªå¤±æ•—
+$ EAI_FAMILY
+5 ai_family ã¯ã‚µãƒãƒ¼ãƒˆã•れã¾ã›ã‚“
+$ EAI_MEMORY
+6 メモリ割り当ã¦å¤±æ•—
+$ 7 (obsolete)
+7 ホストåã«å¯¾å¿œã™ã‚‹ã‚¢ãƒ‰ãƒ¬ã‚¹ã¯ã‚りã¾ã›ã‚“
+$ EAI_NONAME
+8 ホストåã‹ã‚µãƒ¼ãƒ“スåãŒæŒ‡å®šã•れãªã„ã€ã¾ãŸã¯ä¸æ˜Ž
+$ EAI_SERVICE
+9 サービスå㯠ai_socktype ã«å¯¾ã—ã¦ã‚µãƒãƒ¼ãƒˆã•れã¾ã›ã‚“
+$ EAI_SOCKTYPE
+10 ai_socktype ã¯ã‚µãƒãƒ¼ãƒˆã•れã¾ã›ã‚“
+$ EAI_SYSTEM
+11 システムエラーã€errno å‚ç…§
+$ EAI_BADHINTS
+12 hints ã®å€¤ãŒç„¡åй
+$ EAI_PROTOCOL
+13 解決ã•れãŸãƒ—ロトコルã¯ä¸æ˜Žã§ã™
+$ EAI_OVERFLOW
+14 引数ãƒãƒƒãƒ•ァオーãƒãƒ•ロー
+$ 0
+32766 æˆåŠŸ
+$ NL_MSGMAX
+32767 䏿˜Žãªã‚¨ãƒ©ãƒ¼

Modified: head/lib/libc/nls/ja_JP.eucJP.msg
==============================================================================
--- head/lib/libc/nls/ja_JP.eucJP.msg	Mon Nov  9 16:43:50 2009	(r199091)
+++ head/lib/libc/nls/ja_JP.eucJP.msg	Mon Nov  9 17:26:16 2009	(r199092)
@@ -247,3 +247,39 @@ $ SIGUSR1
 30 ¥æ¡¼¥¶ÄêµÁ¥·¥°¥Ê¥ë 1
 $ SIGUSR2
 31 ¥æ¡¼¥¶ÄêµÁ¥·¥°¥Ê¥ë 2
+$
+$ gai_strerror() support catalog
+$
+$set 3
+$ 1 (obsolete)
+1 ¥Û¥¹¥È̾¤Î¥¢¥É¥ì¥¹¥Õ¥¡¥ß¥ê¡¼¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó
+$ EAI_AGAIN
+2 ̾Á°²ò·è¤Ç¤Î°ì»þŪ¤Ê¼ºÇÔ
+$ EAI_BADFLAGS
+3 ai_flags ¤ÎÃͤ¬Ìµ¸ú
+$ EAI_FAIL
+4 ̾Á°²ò·è¤Ç¤Î²óÉüÉÔǽ¤Ê¼ºÇÔ
+$ EAI_FAMILY
+5 ai_family ¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó
+$ EAI_MEMORY
+6 ¥á¥â¥ê³ä¤êÅö¤Æ¼ºÇÔ
+$ 7 (obsolete)
+7 ¥Û¥¹¥È̾¤ËÂбþ¤¹¤ë¥¢¥É¥ì¥¹¤Ï¤¢¤ê¤Þ¤»¤ó
+$ EAI_NONAME
+8 ¥Û¥¹¥È̾¤«¥µ¡¼¥Ó¥¹Ì¾¤¬»ØÄꤵ¤ì¤Ê¤¤¡¢¤Þ¤¿¤ÏÉÔÌÀ
+$ EAI_SERVICE
+9 ¥µ¡¼¥Ó¥¹Ì¾¤Ï ai_socktype ¤ËÂФ·¤Æ¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó
+$ EAI_SOCKTYPE
+10 ai_socktype ¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó
+$ EAI_SYSTEM
+11 ¥·¥¹¥Æ¥à¥¨¥é¡¼¡¢errno »²¾È
+$ EAI_BADHINTS
+12 hints ¤ÎÃͤ¬Ìµ¸ú
+$ EAI_PROTOCOL
+13 ²ò·è¤µ¤ì¤¿¥×¥í¥È¥³¥ë¤ÏÉÔÌÀ¤Ç¤¹
+$ EAI_OVERFLOW
+14 °ú¿ô¥Ð¥Ã¥Õ¥¡¥ª¡¼¥Ð¥Õ¥í¡¼
+$ 0
+32766 À®¸ù
+$ NL_MSGMAX
+32767 ÉÔÌÀ¤Ê¥¨¥é¡¼
From nwhitehorn at freebsd.org  Mon Nov  9 18:20:38 2009
From: nwhitehorn at freebsd.org (Nathan Whitehorn)
Date: Mon Nov  9 18:20:53 2009
Subject: svn commit: r199079 - head/sbin/camcontrol
In-Reply-To: <200911091139.nA9BdpAU019880@svn.freebsd.org>
References: <200911091139.nA9BdpAU019880@svn.freebsd.org>
Message-ID: <4AF85D75.1010605@freebsd.org>

Alexander Motin wrote:
> Author: mav
> Date: Mon Nov  9 11:39:51 2009
> New Revision: 199079
> URL: http://svn.freebsd.org/changeset/base/199079
>
> Log:
>   Add support for ATA Power Management.
>
> Modified:
>   head/sbin/camcontrol/camcontrol.8
>   head/sbin/camcontrol/camcontrol.c
>   
[...]
> +static int
> +atapm(struct cam_device *device, int argc, char **argv,
> +		 char *combinedopt, int retry_count, int timeout)
> +{
> +	union ccb *ccb;
> +	int retval = 0;
> +	int t = -1;
> +	char c;
>
>   
[...]
> +
> +	while ((c = getopt(argc, argv, combinedopt)) != -1) {
> +		switch (c) {
> +		case 't':
> +			t = atoi(optarg);
> +			break;
> +		default:
> +			break;
> +		}
> +	}
This broke world on PowerPC, where char is unsigned. Could you change 
the type of c to int, or explicitly mark it signed?
-Nathan
From jkim at FreeBSD.org  Mon Nov  9 18:22:59 2009
From: jkim at FreeBSD.org (Jung-uk Kim)
Date: Mon Nov  9 18:23:11 2009
Subject: svn commit: r199002 - in head/sys: dev/fb dev/pci isa
In-Reply-To: <200911061647.00983.jhb@freebsd.org>
References: <200911062032.nA6KWRXb027876@svn.freebsd.org>
	<200911061647.00983.jhb@freebsd.org>
Message-ID: <200911091322.40212.jkim@FreeBSD.org>

On Friday 06 November 2009 04:47 pm, John Baldwin wrote:
> On Friday 06 November 2009 3:32:26 pm Jung-uk Kim wrote:
> > Author: jkim
> > Date: Fri Nov  6 20:32:26 2009
> > New Revision: 199002
> > URL: http://svn.freebsd.org/changeset/base/199002
> >
> > Log:
> >   Remove duplicate suspend/resume code from vga_pci.c and let
> > vga(4)
>
> register
>
> >   itself to an associated PCI device if it exists.  It is little
> > bit hackish but it should fix build without frame buffer driver
> > since r198964. Fix some style(9) nits in vga_isa.c while we are
> > here.
>
> Hmm, did you consider having vga_isa use an identify routine to
> attach itself as a child of vgapci0? The hack of knowing the first
> thing in the softc is a pointer is really gross and I'd rather avoid
> it.  Just creating a child of vgapci0 will automatically cause
> suspend and resume to work w/o vgapci having to have any special
> knowledge about vga_isa. 

In fact, I did consider it.  However, lack of my new bus foo prevented 
me from doing the right thing AND fixing the build breakage at the 
same.  I'll try little harder today.

BTW, syscons <-> fb <-> vga <-> vgapci <-> etc. relationship is 
amazingly confusing. :-(

Jung-uk Kim
From rnoland at FreeBSD.org  Mon Nov  9 18:24:35 2009
From: rnoland at FreeBSD.org (Robert Noland)
Date: Mon Nov  9 18:24:41 2009
Subject: svn commit: r199002 - in head/sys: dev/fb dev/pci isa
In-Reply-To: <200911091322.40212.jkim@FreeBSD.org>
References: <200911062032.nA6KWRXb027876@svn.freebsd.org>
	<200911061647.00983.jhb@freebsd.org>
	<200911091322.40212.jkim@FreeBSD.org>
Message-ID: <1257791067.27939.25.camel@balrog.2hip.net>

On Mon, 2009-11-09 at 13:22 -0500, Jung-uk Kim wrote:
> On Friday 06 November 2009 04:47 pm, John Baldwin wrote:
> > On Friday 06 November 2009 3:32:26 pm Jung-uk Kim wrote:
> > > Author: jkim
> > > Date: Fri Nov  6 20:32:26 2009
> > > New Revision: 199002
> > > URL: http://svn.freebsd.org/changeset/base/199002
> > >
> > > Log:
> > >   Remove duplicate suspend/resume code from vga_pci.c and let
> > > vga(4)
> >
> > register
> >
> > >   itself to an associated PCI device if it exists.  It is little
> > > bit hackish but it should fix build without frame buffer driver
> > > since r198964. Fix some style(9) nits in vga_isa.c while we are
> > > here.
> >
> > Hmm, did you consider having vga_isa use an identify routine to
> > attach itself as a child of vgapci0? The hack of knowing the first
> > thing in the softc is a pointer is really gross and I'd rather avoid
> > it.  Just creating a child of vgapci0 will automatically cause
> > suspend and resume to work w/o vgapci having to have any special
> > knowledge about vga_isa. 
> 
> In fact, I did consider it.  However, lack of my new bus foo prevented 
> me from doing the right thing AND fixing the build breakage at the 
> same.  I'll try little harder today.
> 
> BTW, syscons <-> fb <-> vga <-> vgapci <-> etc. relationship is 
> amazingly confusing. :-(

Agreed, this is one of the things that has kept me from working on
kms...

robert.

> Jung-uk Kim
-- 
Robert Noland 
FreeBSD

From jkim at FreeBSD.org  Mon Nov  9 18:40:20 2009
From: jkim at FreeBSD.org (Jung-uk Kim)
Date: Mon Nov  9 18:40:27 2009
Subject: svn commit: r199002 - in head/sys: dev/fb dev/pci isa
In-Reply-To: <1257791067.27939.25.camel@balrog.2hip.net>
References: <200911062032.nA6KWRXb027876@svn.freebsd.org>
	<200911091322.40212.jkim@FreeBSD.org>
	<1257791067.27939.25.camel@balrog.2hip.net>
Message-ID: <200911091340.06459.jkim@FreeBSD.org>

On Monday 09 November 2009 01:24 pm, Robert Noland wrote:
> On Mon, 2009-11-09 at 13:22 -0500, Jung-uk Kim wrote:
> > On Friday 06 November 2009 04:47 pm, John Baldwin wrote:
> > > On Friday 06 November 2009 3:32:26 pm Jung-uk Kim wrote:
> > > > Author: jkim
> > > > Date: Fri Nov  6 20:32:26 2009
> > > > New Revision: 199002
> > > > URL: http://svn.freebsd.org/changeset/base/199002
> > > >
> > > > Log:
> > > >   Remove duplicate suspend/resume code from vga_pci.c and let
> > > > vga(4)
> > >
> > > register
> > >
> > > >   itself to an associated PCI device if it exists.  It is
> > > > little bit hackish but it should fix build without frame
> > > > buffer driver since r198964. Fix some style(9) nits in
> > > > vga_isa.c while we are here.
> > >
> > > Hmm, did you consider having vga_isa use an identify routine to
> > > attach itself as a child of vgapci0? The hack of knowing the
> > > first thing in the softc is a pointer is really gross and I'd
> > > rather avoid it.  Just creating a child of vgapci0 will
> > > automatically cause suspend and resume to work w/o vgapci
> > > having to have any special knowledge about vga_isa.
> >
> > In fact, I did consider it.  However, lack of my new bus foo
> > prevented me from doing the right thing AND fixing the build
> > breakage at the same.  I'll try little harder today.
> >
> > BTW, syscons <-> fb <-> vga <-> vgapci <-> etc. relationship is
> > amazingly confusing. :-(
>
> Agreed, this is one of the things that has kept me from working on
> kms...

Oh, are you actually thinking about implementing KMS?

How about KGI?

http://www.kgi-project.org/

Whatever we do in this area, we will stall this newly resurrected 
project again, unfortunately.  In fact, I am afraid I might have 
already. :-(

Jung-uk Kim
From jhb at FreeBSD.org  Mon Nov  9 18:50:35 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Mon Nov  9 18:50:41 2009
Subject: svn commit: r199096 - in head/lib/libc: stdio string
Message-ID: <200911091850.nA9IoYWB030547@svn.freebsd.org>

Author: jhb
Date: Mon Nov  9 18:50:34 2009
New Revision: 199096
URL: http://svn.freebsd.org/changeset/base/199096

Log:
  Purge some duplicate mergeinfo.

Modified:
Directory Properties:
  head/lib/libc/stdio/asprintf.c   (props changed)
  head/lib/libc/string/ffsll.c   (props changed)
  head/lib/libc/string/flsll.c   (props changed)
  head/lib/libc/string/wcpcpy.c   (props changed)
  head/lib/libc/string/wcpncpy.c   (props changed)
From rnoland at FreeBSD.org  Mon Nov  9 19:21:09 2009
From: rnoland at FreeBSD.org (Robert Noland)
Date: Mon Nov  9 19:21:21 2009
Subject: svn commit: r199002 - in head/sys: dev/fb dev/pci isa
In-Reply-To: <200911091340.06459.jkim@FreeBSD.org>
References: <200911062032.nA6KWRXb027876@svn.freebsd.org>
	<200911091322.40212.jkim@FreeBSD.org>
	<1257791067.27939.25.camel@balrog.2hip.net>
	<200911091340.06459.jkim@FreeBSD.org>
Message-ID: <1257794460.27939.33.camel@balrog.2hip.net>

On Mon, 2009-11-09 at 13:39 -0500, Jung-uk Kim wrote:
> On Monday 09 November 2009 01:24 pm, Robert Noland wrote:
> > On Mon, 2009-11-09 at 13:22 -0500, Jung-uk Kim wrote:
> > > On Friday 06 November 2009 04:47 pm, John Baldwin wrote:
> > > > On Friday 06 November 2009 3:32:26 pm Jung-uk Kim wrote:
> > > > > Author: jkim
> > > > > Date: Fri Nov  6 20:32:26 2009
> > > > > New Revision: 199002
> > > > > URL: http://svn.freebsd.org/changeset/base/199002
> > > > >
> > > > > Log:
> > > > >   Remove duplicate suspend/resume code from vga_pci.c and let
> > > > > vga(4)
> > > >
> > > > register
> > > >
> > > > >   itself to an associated PCI device if it exists.  It is
> > > > > little bit hackish but it should fix build without frame
> > > > > buffer driver since r198964. Fix some style(9) nits in
> > > > > vga_isa.c while we are here.
> > > >
> > > > Hmm, did you consider having vga_isa use an identify routine to
> > > > attach itself as a child of vgapci0? The hack of knowing the
> > > > first thing in the softc is a pointer is really gross and I'd
> > > > rather avoid it.  Just creating a child of vgapci0 will
> > > > automatically cause suspend and resume to work w/o vgapci
> > > > having to have any special knowledge about vga_isa.
> > >
> > > In fact, I did consider it.  However, lack of my new bus foo
> > > prevented me from doing the right thing AND fixing the build
> > > breakage at the same.  I'll try little harder today.
> > >
> > > BTW, syscons <-> fb <-> vga <-> vgapci <-> etc. relationship is
> > > amazingly confusing. :-(
> >
> > Agreed, this is one of the things that has kept me from working on
> > kms...
> 
> Oh, are you actually thinking about implementing KMS?

It is going to become more and more difficult to maintain drm without
it.  Intel does at least somewhat support GEM w/o KMS, but radeon has
opted to simplify the approach and only support TTM/KMS as a single code
path.  They are technically seperate features, but we will mostly be on
our own if we do one without the other.  Nouveau also has KMS support
now, though I am not certain if they are supporting the non-KMS path as
well.

As more and more functionality is incorporated in KMS, the legacy paths
in Xorg will start to bit rot and we will be left in more of a
predicament than I am now...

robert.

> How about KGI?
> 
> http://www.kgi-project.org/
> 
> Whatever we do in this area, we will stall this newly resurrected 
> project again, unfortunately.  In fact, I am afraid I might have 
> already. :-(
> 
> Jung-uk Kim
-- 
Robert Noland 
FreeBSD

From mav at FreeBSD.org  Mon Nov  9 19:47:47 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Mon Nov  9 19:47:58 2009
Subject: svn commit: r199101 - head/sbin/camcontrol
Message-ID: <200911091947.nA9JlljR032154@svn.freebsd.org>

Author: mav
Date: Mon Nov  9 19:47:46 2009
New Revision: 199101
URL: http://svn.freebsd.org/changeset/base/199101

Log:
  Fix variable type.

Modified:
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Mon Nov  9 19:26:28 2009	(r199100)
+++ head/sbin/camcontrol/camcontrol.c	Mon Nov  9 19:47:46 2009	(r199101)
@@ -4143,7 +4143,7 @@ atapm(struct cam_device *device, int arg
 	union ccb *ccb;
 	int retval = 0;
 	int t = -1;
-	char c;
+	int c;
 	u_char cmd, sc;
 
 	ccb = cam_getccb(device);
From trasz at FreeBSD.org  Mon Nov  9 19:53:34 2009
From: trasz at FreeBSD.org (Edward Tomasz Napierala)
Date: Mon Nov  9 19:53:40 2009
Subject: svn commit: r199102 - head/sys/netinet
Message-ID: <200911091953.nA9JrYTL032315@svn.freebsd.org>

Author: trasz
Date: Mon Nov  9 19:53:34 2009
New Revision: 199102
URL: http://svn.freebsd.org/changeset/base/199102

Log:
  Remove ifdefed out part of code, which seems to have originated a decade ago
  in OpenBSD.  As it is now, there is no way for this to be useful, since IPsec
  is free to forward packets via whatever interface it wants, so checking
  capabilities of the interface passed from ip_output (fetched from the routing
  table) serves no purpose.
  
  Discussed with:	sam@

Modified:
  head/sys/netinet/ip_ipsec.c
  head/sys/netinet/ip_ipsec.h
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_ipsec.c
==============================================================================
--- head/sys/netinet/ip_ipsec.c	Mon Nov  9 19:47:46 2009	(r199101)
+++ head/sys/netinet/ip_ipsec.c	Mon Nov  9 19:53:34 2009	(r199102)
@@ -260,8 +260,7 @@ ip_ipsec_mtu(struct mbuf *m, int mtu)
  * -1 = packet was reinjected and stop processing packet
  */
 int
-ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error,
-    struct ifnet **ifp)
+ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error)
 {
 #ifdef IPSEC
 	struct secpolicy *sp = NULL;
@@ -390,20 +389,6 @@ ip_ipsec_output(struct mbuf **m, struct 
 		} else {
 			/* No IPsec processing for this packet. */
 		}
-#ifdef notyet
-		/*
-		 * If deferred crypto processing is needed, check that
-		 * the interface supports it.
-		 */ 
-		mtag = m_tag_find(*m, PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED, NULL);
-		if (mtag != NULL && ifp != NULL &&
-		    ((*ifp)->if_capenable & IFCAP_IPSEC) == 0) {
-			/* notify IPsec to do its own crypto */
-			ipsp_skipcrypto_unmark((struct tdb_ident *)(mtag + 1));
-			*error = EHOSTUNREACH;
-			goto bad;
-		}
-#endif
 	}
 done:
 	if (sp != NULL)

Modified: head/sys/netinet/ip_ipsec.h
==============================================================================
--- head/sys/netinet/ip_ipsec.h	Mon Nov  9 19:47:46 2009	(r199101)
+++ head/sys/netinet/ip_ipsec.h	Mon Nov  9 19:53:34 2009	(r199102)
@@ -36,6 +36,5 @@ int	ip_ipsec_filtertunnel(struct mbuf *)
 int	ip_ipsec_fwd(struct mbuf *);
 int	ip_ipsec_input(struct mbuf *);
 int	ip_ipsec_mtu(struct mbuf *, int);
-int	ip_ipsec_output(struct mbuf **, struct inpcb *, int *, int *,
-	    struct ifnet **);
+int	ip_ipsec_output(struct mbuf **, struct inpcb *, int *, int *);
 #endif

Modified: head/sys/netinet/ip_output.c
==============================================================================
--- head/sys/netinet/ip_output.c	Mon Nov  9 19:47:46 2009	(r199101)
+++ head/sys/netinet/ip_output.c	Mon Nov  9 19:53:34 2009	(r199102)
@@ -466,7 +466,7 @@ again:
 
 sendit:
 #ifdef IPSEC
-	switch(ip_ipsec_output(&m, inp, &flags, &error, &ifp)) {
+	switch(ip_ipsec_output(&m, inp, &flags, &error)) {
 	case 1:
 		goto bad;
 	case -1:
From rdivacky at FreeBSD.org  Mon Nov  9 20:29:11 2009
From: rdivacky at FreeBSD.org (Roman Divacky)
Date: Mon Nov  9 20:29:23 2009
Subject: svn commit: r199104 - in head/sys: amd64/isa dev/fdc dev/ieee488
	i386/isa
Message-ID: <200911092029.nA9KTAj1033145@svn.freebsd.org>

Author: rdivacky
Date: Mon Nov  9 20:29:10 2009
New Revision: 199104
URL: http://svn.freebsd.org/changeset/base/199104

Log:
  Make isa_dma functions MPSAFE by introducing its own private lock. These
  functions are selfcontained (ie. they touch only isa_dma.c static variables
  and hardware) so a private lock is sufficient to prevent races. This changes
  only i386/amd64 while there are also isa_dma functions for ia64/sparc64.
  Sparc64 are ones empty stubs and ia64 ones are unused as ia64 does not
  have isa (says marcel).
  
  This patch removes explicit locking of Giant from a few drivers (there
  are some that requires this but lack ones - this patch fixes this) and
  also removes the need for implicit locking of Giant from attach routines
  where it's provided by newbus.
  
  Approved by:	ed (mentor, implicit)
  Reviewed by:	jhb, attilio (glanced by)
  Tested by:	Giovanni Trematerra 
  IA64 clue:	marcel

Modified:
  head/sys/amd64/isa/isa_dma.c
  head/sys/dev/fdc/fdc.c
  head/sys/dev/ieee488/ibfoo.c
  head/sys/i386/isa/isa_dma.c

Modified: head/sys/amd64/isa/isa_dma.c
==============================================================================
--- head/sys/amd64/isa/isa_dma.c	Mon Nov  9 19:56:53 2009	(r199103)
+++ head/sys/amd64/isa/isa_dma.c	Mon Nov  9 20:29:10 2009	(r199104)
@@ -71,6 +71,8 @@ static u_int8_t	dma_bounced = 0;
 static u_int8_t	dma_busy = 0;		/* Used in isa_dmastart() */
 static u_int8_t	dma_inuse = 0;		/* User for acquire/release */
 static u_int8_t dma_auto_mode = 0;
+static struct mtx isa_dma_lock;
+MTX_SYSINIT(isa_dma_lock, &isa_dma_lock, "isa DMA lock", MTX_DEF);
 
 #define VALID_DMA_MASK (7)
 
@@ -84,39 +86,56 @@ int
 isa_dma_init(int chan, u_int bouncebufsize, int flag)
 {
 	void *buf;
-
-	/*
-	 * If a DMA channel is shared, both drivers have to call isa_dma_init
-	 * since they don't know that the other driver will do it.
-	 * Just return if we're already set up good.
-	 * XXX: this only works if they agree on the bouncebuf size.  This
-	 * XXX: is typically the case since they are multiple instances of
-	 * XXX: the same driver.
-	 */
-	if (dma_bouncebuf[chan] != NULL)
-		return (0);
+	int contig;
 
 #ifdef DIAGNOSTIC
 	if (chan & ~VALID_DMA_MASK)
 		panic("isa_dma_init: channel out of range");
 #endif
 
-	dma_bouncebufsize[chan] = bouncebufsize;
 
 	/* Try malloc() first.  It works better if it works. */
 	buf = malloc(bouncebufsize, M_DEVBUF, flag);
 	if (buf != NULL) {
-		if (isa_dmarangecheck(buf, bouncebufsize, chan) == 0) {
-			dma_bouncebuf[chan] = buf;
-			return (0);
+		if (isa_dmarangecheck(buf, bouncebufsize, chan) != 0) {
+			free(buf, M_DEVBUF);
+			buf = NULL;
 		}
-		free(buf, M_DEVBUF);
+		contig = 0;
 	}
-	buf = contigmalloc(bouncebufsize, M_DEVBUF, flag, 0ul, 0xfffffful,
+
+	if (buf == NULL) {
+		buf = contigmalloc(bouncebufsize, M_DEVBUF, flag, 0ul, 0xfffffful,
 			   1ul, chan & 4 ? 0x20000ul : 0x10000ul);
+		contig = 1;
+	}
+
 	if (buf == NULL)
 		return (ENOMEM);
+
+	mtx_lock(&isa_dma_lock);
+	/*
+	 * If a DMA channel is shared, both drivers have to call isa_dma_init
+	 * since they don't know that the other driver will do it.
+	 * Just return if we're already set up good.
+	 * XXX: this only works if they agree on the bouncebuf size.  This
+	 * XXX: is typically the case since they are multiple instances of
+	 * XXX: the same driver.
+	 */
+	if (dma_bouncebuf[chan] != NULL) {
+		if (contig)
+			contigfree(buf, bouncebufsize, M_DEVBUF);
+		else
+			free(buf, M_DEVBUF);
+		mtx_unlock(&isa_dma_lock);
+		return (0);
+	}
+
+	dma_bouncebufsize[chan] = bouncebufsize;
 	dma_bouncebuf[chan] = buf;
+
+	mtx_unlock(&isa_dma_lock);
+
 	return (0);
 }
 
@@ -133,12 +152,15 @@ isa_dma_acquire(chan)
 		panic("isa_dma_acquire: channel out of range");
 #endif
 
+	mtx_lock(&isa_dma_lock);
 	if (dma_inuse & (1 << chan)) {
 		printf("isa_dma_acquire: channel %d already in use\n", chan);
+		mtx_unlock(&isa_dma_lock);
 		return (EBUSY);
 	}
 	dma_inuse |= (1 << chan);
 	dma_auto_mode &= ~(1 << chan);
+	mtx_unlock(&isa_dma_lock);
 
 	return (0);
 }
@@ -155,8 +177,11 @@ isa_dma_release(chan)
 	if (chan & ~VALID_DMA_MASK)
 		panic("isa_dma_release: channel out of range");
 
+	mtx_lock(&isa_dma_lock);
 	if ((dma_inuse & (1 << chan)) == 0)
 		printf("isa_dma_release: channel %d not in use\n", chan);
+#else
+	mtx_lock(&isa_dma_lock);
 #endif
 
 	if (dma_busy & (1 << chan)) {
@@ -171,6 +196,8 @@ isa_dma_release(chan)
 
 	dma_inuse &= ~(1 << chan);
 	dma_auto_mode &= ~(1 << chan);
+
+	mtx_unlock(&isa_dma_lock);
 }
 
 /*
@@ -186,6 +213,7 @@ isa_dmacascade(chan)
 		panic("isa_dmacascade: channel out of range");
 #endif
 
+	mtx_lock(&isa_dma_lock);
 	/* set dma channel mode, and set dma channel mode */
 	if ((chan & 4) == 0) {
 		outb(DMA1_MODE, DMA37MD_CASCADE | chan);
@@ -194,6 +222,7 @@ isa_dmacascade(chan)
 		outb(DMA2_MODE, DMA37MD_CASCADE | (chan & 3));
 		outb(DMA2_SMSK, chan & 3);
 	}
+	mtx_unlock(&isa_dma_lock);
 }
 
 /*
@@ -206,8 +235,11 @@ isa_dmastart(int flags, caddr_t addr, u_
 	vm_paddr_t phys;
 	int waport;
 	caddr_t newaddr;
+	int dma_range_checked;
 
-	GIANT_REQUIRED;
+	/* translate to physical */
+	phys = pmap_extract(kernel_pmap, (vm_offset_t)addr);
+	dma_range_checked = isa_dmarangecheck(addr, nbytes, chan);
 
 #ifdef DIAGNOSTIC
 	if (chan & ~VALID_DMA_MASK)
@@ -217,8 +249,11 @@ isa_dmastart(int flags, caddr_t addr, u_
 	    || (chan >= 4 && (nbytes > (1<<17) || (uintptr_t)addr & 1)))
 		panic("isa_dmastart: impossible request");
 
+	mtx_lock(&isa_dma_lock);
 	if ((dma_inuse & (1 << chan)) == 0)
 		printf("isa_dmastart: channel %d not acquired\n", chan);
+#else
+	mtx_lock(&isa_dma_lock);
 #endif
 
 #if 0
@@ -233,7 +268,7 @@ isa_dmastart(int flags, caddr_t addr, u_
 
 	dma_busy |= (1 << chan);
 
-	if (isa_dmarangecheck(addr, nbytes, chan)) {
+	if (dma_range_checked) {
 		if (dma_bouncebuf[chan] == NULL
 		    || dma_bouncebufsize[chan] < nbytes)
 			panic("isa_dmastart: bad bounce buffer"); 
@@ -246,9 +281,6 @@ isa_dmastart(int flags, caddr_t addr, u_
 		addr = newaddr;
 	}
 
-	/* translate to physical */
-	phys = pmap_extract(kernel_pmap, (vm_offset_t)addr);
-
 	if (flags & ISADMA_RAW) {
 	    dma_auto_mode |= (1 << chan);
 	} else { 
@@ -323,6 +355,7 @@ isa_dmastart(int flags, caddr_t addr, u_
 		/* unmask channel */
 		outb(DMA2_SMSK, chan & 3);
 	}
+	mtx_unlock(&isa_dma_lock);
 }
 
 void
@@ -336,6 +369,7 @@ isa_dmadone(int flags, caddr_t addr, int
 		printf("isa_dmadone: channel %d not acquired\n", chan);
 #endif
 
+	mtx_lock(&isa_dma_lock);
 	if (((dma_busy & (1 << chan)) == 0) && 
 	    (dma_auto_mode & (1 << chan)) == 0 )
 		printf("isa_dmadone: channel %d not busy\n", chan);
@@ -351,6 +385,7 @@ isa_dmadone(int flags, caddr_t addr, int
 		dma_bounced &= ~(1 << chan);
 	}
 	dma_busy &= ~(1 << chan);
+	mtx_unlock(&isa_dma_lock);
 }
 
 /*
@@ -367,8 +402,6 @@ isa_dmarangecheck(caddr_t va, u_int leng
 	vm_offset_t endva;
 	u_int dma_pgmsk = (chan & 4) ?  ~(128*1024-1) : ~(64*1024-1);
 
-	GIANT_REQUIRED;
-
 	endva = (vm_offset_t)round_page((vm_offset_t)va + length);
 	for (; va < (caddr_t) endva ; va += PAGE_SIZE) {
 		phys = trunc_page(pmap_extract(kernel_pmap, (vm_offset_t)va));
@@ -420,13 +453,15 @@ isa_dmarangecheck(caddr_t va, u_int leng
  * or -1 if the channel requested is not active.
  *
  */
-int
-isa_dmastatus(int chan)
+static int
+isa_dmastatus_locked(int chan)
 {
 	u_long	cnt = 0;
 	int	ffport, waport;
 	u_long	low1, high1, low2, high2;
 
+	mtx_assert(&isa_dma_lock, MA_OWNED);
+
 	/* channel active? */
 	if ((dma_inuse & (1 << chan)) == 0) {
 		printf("isa_dmastatus: channel %d not active\n", chan);
@@ -472,6 +507,18 @@ isa_dmastatus(int chan)
 	return(cnt);
 }
 
+int
+isa_dmastatus(int chan)
+{
+	int status;
+
+	mtx_lock(&isa_dma_lock);
+	status = isa_dmastatus_locked(chan);
+	mtx_unlock(&isa_dma_lock);
+
+	return (status);
+}
+
 /*
  * Reached terminal count yet ?
  */
@@ -491,12 +538,16 @@ isa_dmatc(int chan)
 int
 isa_dmastop(int chan) 
 {
+	int status;
+
+	mtx_lock(&isa_dma_lock);
 	if ((dma_inuse & (1 << chan)) == 0)
 		printf("isa_dmastop: channel %d not acquired\n", chan);  
 
 	if (((dma_busy & (1 << chan)) == 0) &&
 	    ((dma_auto_mode & (1 << chan)) == 0)) {
 		printf("chan %d not busy\n", chan);
+		mtx_unlock(&isa_dma_lock);
 		return -2 ;
 	}
     
@@ -505,7 +556,12 @@ isa_dmastop(int chan) 
 	} else {
 		outb(DMA2_SMSK, (chan & 3) | 4 /* disable mask */);
 	}
-	return(isa_dmastatus(chan));
+
+	status = isa_dmastatus_locked(chan);
+
+	mtx_unlock(&isa_dma_lock);
+
+	return (status);
 }
 
 /*

Modified: head/sys/dev/fdc/fdc.c
==============================================================================
--- head/sys/dev/fdc/fdc.c	Mon Nov  9 19:56:53 2009	(r199103)
+++ head/sys/dev/fdc/fdc.c	Mon Nov  9 20:29:10 2009	(r199104)
@@ -781,11 +781,9 @@ fdc_worker(struct fdc_data *fdc)
 
 	/* Disable ISADMA if we bailed while it was active */
 	if (fd != NULL && (fd->flags & FD_ISADMA)) {
-		mtx_lock(&Giant);
 		isa_dmadone(
 		    bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE,
 		    fd->fd_ioptr, fd->fd_iosize, fdc->dmachan);
-		mtx_unlock(&Giant);
 		mtx_lock(&fdc->fdc_mtx);
 		fd->flags &= ~FD_ISADMA;
 		mtx_unlock(&fdc->fdc_mtx);
@@ -958,11 +956,9 @@ fdc_worker(struct fdc_data *fdc)
 	/* Setup ISADMA if we need it and have it */
 	if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_FMT))
 	     && !(fdc->flags & FDC_NODMA)) {
-		mtx_lock(&Giant);
 		isa_dmastart(
 		    bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE,
 		    fd->fd_ioptr, fd->fd_iosize, fdc->dmachan);
-		mtx_unlock(&Giant);
 		mtx_lock(&fdc->fdc_mtx);
 		fd->flags |= FD_ISADMA;
 		mtx_unlock(&fdc->fdc_mtx);
@@ -1040,11 +1036,9 @@ fdc_worker(struct fdc_data *fdc)
 
 	/* Finish DMA */
 	if (fd->flags & FD_ISADMA) {
-		mtx_lock(&Giant);
 		isa_dmadone(
 		    bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE,
 		    fd->fd_ioptr, fd->fd_iosize, fdc->dmachan);
-		mtx_unlock(&Giant);
 		mtx_lock(&fdc->fdc_mtx);
 		fd->flags &= ~FD_ISADMA;
 		mtx_unlock(&fdc->fdc_mtx);

Modified: head/sys/dev/ieee488/ibfoo.c
==============================================================================
--- head/sys/dev/ieee488/ibfoo.c	Mon Nov  9 19:56:53 2009	(r199103)
+++ head/sys/dev/ieee488/ibfoo.c	Mon Nov  9 20:29:10 2009	(r199104)
@@ -397,18 +397,14 @@ dma_idata(struct upd7210 *u, u_char *dat
 	KASSERT(u->dmachan >= 0, ("Bogus dmachan %d", u->dmachan));
 	ib = u->ibfoo;
 	ib->mode = DMA_IDATA;
-	mtx_lock(&Giant);
 	isa_dmastart(ISADMA_READ, data, len, u->dmachan);
-	mtx_unlock(&Giant);
 	mtx_lock(&u->mutex);
 	upd7210_wr(u, IMR1, IXR1_ENDRX);
 	upd7210_wr(u, IMR2, IMR2_DMAI);
 	gpib_ib_wait_xfer(u, ib);
 	mtx_unlock(&u->mutex);
-	mtx_lock(&Giant);
 	j = isa_dmastatus(u->dmachan);
 	isa_dmadone(ISADMA_READ, data, len, u->dmachan);
-	mtx_unlock(&Giant);
 	return (len - j);
 }
 
@@ -790,14 +786,12 @@ gpib_ib_open(struct cdev *dev, int oflag
 	mtx_unlock(&u->mutex);
 
 	if (u->dmachan >= 0) {
-		mtx_lock(&Giant);
 		error = isa_dma_acquire(u->dmachan);
 		if (!error) {
 			error = isa_dma_init(u->dmachan, PAGE_SIZE, M_WAITOK);
 			if (error)
 				isa_dma_release(u->dmachan);
 		}
-		mtx_unlock(&Giant);
 	}
 
 	if (error) {
@@ -855,9 +849,7 @@ gpib_ib_close(struct cdev *dev, int ofla
 	free(ib, M_IBFOO);
 
 	if (u->dmachan >= 0) {
-		mtx_lock(&Giant);
 		isa_dma_release(u->dmachan);
-		mtx_unlock(&Giant);
 	}
 	mtx_lock(&u->mutex);
 	u->busy = 0;

Modified: head/sys/i386/isa/isa_dma.c
==============================================================================
--- head/sys/i386/isa/isa_dma.c	Mon Nov  9 19:56:53 2009	(r199103)
+++ head/sys/i386/isa/isa_dma.c	Mon Nov  9 20:29:10 2009	(r199104)
@@ -69,6 +69,8 @@ static u_int8_t	dma_bounced = 0;
 static u_int8_t	dma_busy = 0;		/* Used in isa_dmastart() */
 static u_int8_t	dma_inuse = 0;		/* User for acquire/release */
 static u_int8_t dma_auto_mode = 0;
+static struct mtx isa_dma_lock;
+MTX_SYSINIT(isa_dma_lock, &isa_dma_lock, "isa DMA lock", MTX_DEF);
 
 #define VALID_DMA_MASK (7)
 
@@ -82,39 +84,56 @@ int
 isa_dma_init(int chan, u_int bouncebufsize, int flag)
 {
 	void *buf;
-
-	/*
-	 * If a DMA channel is shared, both drivers have to call isa_dma_init
-	 * since they don't know that the other driver will do it.
-	 * Just return if we're already set up good.
-	 * XXX: this only works if they agree on the bouncebuf size.  This
-	 * XXX: is typically the case since they are multiple instances of
-	 * XXX: the same driver.
-	 */
-	if (dma_bouncebuf[chan] != NULL)
-		return (0);
+	int contig;
 
 #ifdef DIAGNOSTIC
 	if (chan & ~VALID_DMA_MASK)
 		panic("isa_dma_init: channel out of range");
 #endif
 
-	dma_bouncebufsize[chan] = bouncebufsize;
 
 	/* Try malloc() first.  It works better if it works. */
 	buf = malloc(bouncebufsize, M_DEVBUF, flag);
 	if (buf != NULL) {
-		if (isa_dmarangecheck(buf, bouncebufsize, chan) == 0) {
-			dma_bouncebuf[chan] = buf;
-			return (0);
+		if (isa_dmarangecheck(buf, bouncebufsize, chan) != 0) {
+			free(buf, M_DEVBUF);
+			buf = NULL;
 		}
-		free(buf, M_DEVBUF);
+		contig = 0;
 	}
-	buf = contigmalloc(bouncebufsize, M_DEVBUF, flag, 0ul, 0xfffffful,
+
+	if (buf == NULL) {
+		buf = contigmalloc(bouncebufsize, M_DEVBUF, flag, 0ul, 0xfffffful,
 			   1ul, chan & 4 ? 0x20000ul : 0x10000ul);
+		contig = 1;
+	}
+
 	if (buf == NULL)
 		return (ENOMEM);
+
+	mtx_lock(&isa_dma_lock);
+	/*
+	 * If a DMA channel is shared, both drivers have to call isa_dma_init
+	 * since they don't know that the other driver will do it.
+	 * Just return if we're already set up good.
+	 * XXX: this only works if they agree on the bouncebuf size.  This
+	 * XXX: is typically the case since they are multiple instances of
+	 * XXX: the same driver.
+	 */
+	if (dma_bouncebuf[chan] != NULL) {
+		if (contig)
+			contigfree(buf, bouncebufsize, M_DEVBUF);
+		else
+			free(buf, M_DEVBUF);
+		mtx_unlock(&isa_dma_lock);
+		return (0);
+	}
+
+	dma_bouncebufsize[chan] = bouncebufsize;
 	dma_bouncebuf[chan] = buf;
+
+	mtx_unlock(&isa_dma_lock);
+
 	return (0);
 }
 
@@ -131,12 +150,15 @@ isa_dma_acquire(chan)
 		panic("isa_dma_acquire: channel out of range");
 #endif
 
+	mtx_lock(&isa_dma_lock);
 	if (dma_inuse & (1 << chan)) {
 		printf("isa_dma_acquire: channel %d already in use\n", chan);
+		mtx_unlock(&isa_dma_lock);
 		return (EBUSY);
 	}
 	dma_inuse |= (1 << chan);
 	dma_auto_mode &= ~(1 << chan);
+	mtx_unlock(&isa_dma_lock);
 
 	return (0);
 }
@@ -153,8 +175,11 @@ isa_dma_release(chan)
 	if (chan & ~VALID_DMA_MASK)
 		panic("isa_dma_release: channel out of range");
 
+	mtx_lock(&isa_dma_lock);
 	if ((dma_inuse & (1 << chan)) == 0)
 		printf("isa_dma_release: channel %d not in use\n", chan);
+#else
+	mtx_lock(&isa_dma_lock);
 #endif
 
 	if (dma_busy & (1 << chan)) {
@@ -169,6 +194,8 @@ isa_dma_release(chan)
 
 	dma_inuse &= ~(1 << chan);
 	dma_auto_mode &= ~(1 << chan);
+
+	mtx_unlock(&isa_dma_lock);
 }
 
 /*
@@ -184,6 +211,7 @@ isa_dmacascade(chan)
 		panic("isa_dmacascade: channel out of range");
 #endif
 
+	mtx_lock(&isa_dma_lock);
 	/* set dma channel mode, and set dma channel mode */
 	if ((chan & 4) == 0) {
 		outb(DMA1_MODE, DMA37MD_CASCADE | chan);
@@ -192,6 +220,7 @@ isa_dmacascade(chan)
 		outb(DMA2_MODE, DMA37MD_CASCADE | (chan & 3));
 		outb(DMA2_SMSK, chan & 3);
 	}
+	mtx_unlock(&isa_dma_lock);
 }
 
 /*
@@ -204,8 +233,11 @@ isa_dmastart(int flags, caddr_t addr, u_
 	vm_paddr_t phys;
 	int waport;
 	caddr_t newaddr;
+	int dma_range_checked;
 
-	GIANT_REQUIRED;
+	/* translate to physical */
+	phys = pmap_extract(kernel_pmap, (vm_offset_t)addr);
+	dma_range_checked = isa_dmarangecheck(addr, nbytes, chan);
 
 #ifdef DIAGNOSTIC
 	if (chan & ~VALID_DMA_MASK)
@@ -215,8 +247,11 @@ isa_dmastart(int flags, caddr_t addr, u_
 	    || (chan >= 4 && (nbytes > (1<<17) || (u_int)addr & 1)))
 		panic("isa_dmastart: impossible request");
 
+	mtx_lock(&isa_dma_lock);
 	if ((dma_inuse & (1 << chan)) == 0)
 		printf("isa_dmastart: channel %d not acquired\n", chan);
+#else
+	mtx_lock(&isa_dma_lock);
 #endif
 
 #if 0
@@ -231,7 +266,7 @@ isa_dmastart(int flags, caddr_t addr, u_
 
 	dma_busy |= (1 << chan);
 
-	if (isa_dmarangecheck(addr, nbytes, chan)) {
+	if (dma_range_checked) {
 		if (dma_bouncebuf[chan] == NULL
 		    || dma_bouncebufsize[chan] < nbytes)
 			panic("isa_dmastart: bad bounce buffer"); 
@@ -244,9 +279,6 @@ isa_dmastart(int flags, caddr_t addr, u_
 		addr = newaddr;
 	}
 
-	/* translate to physical */
-	phys = pmap_extract(kernel_pmap, (vm_offset_t)addr);
-
 	if (flags & ISADMA_RAW) {
 	    dma_auto_mode |= (1 << chan);
 	} else { 
@@ -321,6 +353,7 @@ isa_dmastart(int flags, caddr_t addr, u_
 		/* unmask channel */
 		outb(DMA2_SMSK, chan & 3);
 	}
+	mtx_unlock(&isa_dma_lock);
 }
 
 void
@@ -334,6 +367,7 @@ isa_dmadone(int flags, caddr_t addr, int
 		printf("isa_dmadone: channel %d not acquired\n", chan);
 #endif
 
+	mtx_lock(&isa_dma_lock);
 	if (((dma_busy & (1 << chan)) == 0) && 
 	    (dma_auto_mode & (1 << chan)) == 0 )
 		printf("isa_dmadone: channel %d not busy\n", chan);
@@ -349,6 +383,7 @@ isa_dmadone(int flags, caddr_t addr, int
 		dma_bounced &= ~(1 << chan);
 	}
 	dma_busy &= ~(1 << chan);
+	mtx_unlock(&isa_dma_lock);
 }
 
 /*
@@ -365,8 +400,6 @@ isa_dmarangecheck(caddr_t va, u_int leng
 	vm_offset_t endva;
 	u_int dma_pgmsk = (chan & 4) ?  ~(128*1024-1) : ~(64*1024-1);
 
-	GIANT_REQUIRED;
-
 	endva = (vm_offset_t)round_page((vm_offset_t)va + length);
 	for (; va < (caddr_t) endva ; va += PAGE_SIZE) {
 		phys = trunc_page(pmap_extract(kernel_pmap, (vm_offset_t)va));
@@ -419,13 +452,15 @@ isa_dmarangecheck(caddr_t va, u_int leng
  * or -1 if the channel requested is not active.
  *
  */
-int
-isa_dmastatus(int chan)
+static int
+isa_dmastatus_locked(int chan)
 {
 	u_long	cnt = 0;
 	int	ffport, waport;
 	u_long	low1, high1, low2, high2;
 
+	mtx_assert(&isa_dma_lock, MA_OWNED);
+
 	/* channel active? */
 	if ((dma_inuse & (1 << chan)) == 0) {
 		printf("isa_dmastatus: channel %d not active\n", chan);
@@ -471,6 +506,18 @@ isa_dmastatus(int chan)
 	return(cnt);
 }
 
+int
+isa_dmastatus(int chan)
+{
+	int status;
+
+	mtx_lock(&isa_dma_lock);
+	status = isa_dmastatus_locked(chan);
+	mtx_unlock(&isa_dma_lock);
+
+	return (status);
+}
+
 /*
  * Reached terminal count yet ?
  */
@@ -490,12 +537,16 @@ isa_dmatc(int chan)
 int
 isa_dmastop(int chan) 
 {
+	int status;
+
+	mtx_lock(&isa_dma_lock);
 	if ((dma_inuse & (1 << chan)) == 0)
 		printf("isa_dmastop: channel %d not acquired\n", chan);  
 
 	if (((dma_busy & (1 << chan)) == 0) &&
 	    ((dma_auto_mode & (1 << chan)) == 0)) {
 		printf("chan %d not busy\n", chan);
+		mtx_unlock(&isa_dma_lock);
 		return -2 ;
 	}
     
@@ -504,7 +555,12 @@ isa_dmastop(int chan) 
 	} else {
 		outb(DMA2_SMSK, (chan & 3) | 4 /* disable mask */);
 	}
-	return(isa_dmastatus(chan));
+
+	status = isa_dmastatus_locked(chan);
+
+	mtx_unlock(&isa_dma_lock);
+
+	return (status);
 }
 
 /*
From edwin at FreeBSD.org  Mon Nov  9 20:49:13 2009
From: edwin at FreeBSD.org (Edwin Groothuis)
Date: Mon Nov  9 20:49:28 2009
Subject: svn commit: r199107 - head/share/zoneinfo
Message-ID: <200911092049.nA9KnDNL033845@svn.freebsd.org>

Author: edwin
Date: Mon Nov  9 20:49:12 2009
New Revision: 199107
URL: http://svn.freebsd.org/changeset/base/199107

Log:
  MFV of r199105, 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).
  
  MFC after:	3 days

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

Modified: head/share/zoneinfo/antarctica
==============================================================================
--- head/share/zoneinfo/antarctica	Mon Nov  9 20:45:25 2009	(r199106)
+++ head/share/zoneinfo/antarctica	Mon Nov  9 20:49:12 2009	(r199107)
@@ -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 nwhitehorn at FreeBSD.org  Mon Nov  9 21:12:29 2009
From: nwhitehorn at FreeBSD.org (Nathan Whitehorn)
Date: Mon Nov  9 21:12:40 2009
Subject: svn commit: r199108 - head/sys/powerpc/aim
Message-ID: <200911092112.nA9LCTxX034474@svn.freebsd.org>

Author: nwhitehorn
Date: Mon Nov  9 21:12:28 2009
New Revision: 199108
URL: http://svn.freebsd.org/changeset/base/199108

Log:
  Spell sz correctly.
  
  Pointed out by:	jmallett

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Mon Nov  9 20:49:12 2009	(r199107)
+++ head/sys/powerpc/aim/mmu_oea64.c	Mon Nov  9 21:12:28 2009	(r199108)
@@ -897,7 +897,7 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o
 		panic("moea64_bootstrap: can't get mmu package");
 	    if ((sz = OF_getproplen(mmu, "translations")) == -1)
 		panic("moea64_bootstrap: can't get ofw translation count");
-	    if (size > sizeof(translations))
+	    if (sz > sizeof(translations))
 		panic("moea64_bootstrap: too many ofw translations (%d)",
 		      sz/sizeof(*translations));
 
From gonzo at FreeBSD.org  Mon Nov  9 22:01:59 2009
From: gonzo at FreeBSD.org (Oleksandr Tymoshenko)
Date: Mon Nov  9 22:02:10 2009
Subject: svn commit: r199114 - head/sys/mips/mips
Message-ID: <200911092201.nA9M1w3a036290@svn.freebsd.org>

Author: gonzo
Date: Mon Nov  9 22:01:58 2009
New Revision: 199114
URL: http://svn.freebsd.org/changeset/base/199114

Log:
  Unbreak booting of FreeBSD/mips by merging r195429 from projects/mips:
  - Move dpcpu initialization to mips_proc0_init. It's
      more appropriate place for it. Besides dpcpu_init
      requires pmap module to be initialized and calling it
      int pmap.c hangs the system

Modified:
  head/sys/mips/mips/machdep.c
  head/sys/mips/mips/pmap.c

Modified: head/sys/mips/mips/machdep.c
==============================================================================
--- head/sys/mips/mips/machdep.c	Mon Nov  9 21:54:34 2009	(r199113)
+++ head/sys/mips/mips/machdep.c	Mon Nov  9 22:01:58 2009	(r199114)
@@ -274,6 +274,9 @@ mips_proc0_init(void)
 	    (thread0.td_kstack_pages - 1) * PAGE_SIZE) - 1;
 	thread0.td_frame = &thread0.td_pcb->pcb_regs;
 
+	/* Steal memory for the dynamic per-cpu area. */
+	dpcpu_init((void *)pmap_steal_memory(DPCPU_SIZE), 0);
+
 	/*
 	 * There is no need to initialize md_upte array for thread0 as it's
 	 * located in .bss section and should be explicitly zeroed during 

Modified: head/sys/mips/mips/pmap.c
==============================================================================
--- head/sys/mips/mips/pmap.c	Mon Nov  9 21:54:34 2009	(r199113)
+++ head/sys/mips/mips/pmap.c	Mon Nov  9 22:01:58 2009	(r199114)
@@ -331,9 +331,6 @@ again:
 	msgbufp = (struct msgbuf *)pmap_steal_memory(MSGBUF_SIZE);
 	msgbufinit(msgbufp, MSGBUF_SIZE);
 
-	/* Steal memory for the dynamic per-cpu area. */
-	dpcpu_init((void *)pmap_steal_memory(DPCPU_SIZE), 0);
-
 	/*
 	 * Steal thread0 kstack.
 	 */
From ed at 80386.nl  Mon Nov  9 22:52:48 2009
From: ed at 80386.nl (Ed Schouten)
Date: Mon Nov  9 22:52:54 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <200911090254.nA92sG1G005921@svn.freebsd.org>
References: <200911090254.nA92sG1G005921@svn.freebsd.org>
Message-ID: <20091109225244.GB64905@hoeg.nl>

Hi Jun,

* Jun Kuriyama  wrote:
>   - Add hw.clflush_disable loader tunable to avoid panic (trap 9) at
>     map_invalidate_cache_range() even if CPU is not Intel.
>   - This tunable can be set to -1 (default), 0 and 1.  -1 is same as
>     current behavior, which automatically disable CLFLUSH on Intel CPUs
>     without CPUID_SS (should be occured on Xen only).  You can specify 1
>     when this panic happened on non-Intel CPUs (such as AMD's).  Because
>     disabling CLFLUSH may reduce performance, you can try with setting 0
>     on Intel CPUs without SS to use CLFLUSH feature.
>   
>   Reviewed by:	kib
>   Reported by:	karl, kuriyama
>   Related to:	kern/138863

Unfortunately it seems to lock up my Intel Core 2 Duo boxes.

Systems affected:

- Apple MacBook3,1
- Dell SC440

-- 
 Ed Schouten 
 WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091109/efb85ce6/attachment.pgp
From yongari at FreeBSD.org  Mon Nov  9 22:58:30 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Mon Nov  9 22:58:42 2009
Subject: svn commit: r199115 - head/sys/dev/bge
Message-ID: <200911092258.nA9MwUDj037658@svn.freebsd.org>

Author: yongari
Date: Mon Nov  9 22:58:30 2009
New Revision: 199115
URL: http://svn.freebsd.org/changeset/base/199115

Log:
  Add missing bus_dmamap_sync(9) before issuing kick command.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Mon Nov  9 22:01:58 2009	(r199114)
+++ head/sys/dev/bge/if_bge.c	Mon Nov  9 22:58:30 2009	(r199115)
@@ -3826,6 +3826,9 @@ bge_start_locked(struct ifnet *ifp)
 		/* No packets were dequeued. */
 		return;
 
+	bus_dmamap_sync(sc->bge_cdata.bge_tx_ring_tag,
+	    sc->bge_cdata.bge_tx_ring_map,
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	/* Transmit. */
 	bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx);
 	/* 5700 b2 errata */
From yongari at FreeBSD.org  Mon Nov  9 23:09:18 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Mon Nov  9 23:09:31 2009
Subject: svn commit: r199116 - head/sys/dev/bge
Message-ID: <200911092309.nA9N9IKY037909@svn.freebsd.org>

Author: yongari
Date: Mon Nov  9 23:09:18 2009
New Revision: 199116
URL: http://svn.freebsd.org/changeset/base/199116

Log:
  Zero out Tx/Rx descriptors before using them. Also add missing
  bus_dmamap_sync(9) after Tx descriptor initialization.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Mon Nov  9 22:58:30 2009	(r199115)
+++ head/sys/dev/bge/if_bge.c	Mon Nov  9 23:09:18 2009	(r199116)
@@ -1046,6 +1046,7 @@ bge_init_rx_ring_std(struct bge_softc *s
 {
 	int error, i;
 
+	bzero(sc->bge_ldata.bge_rx_std_ring, BGE_STD_RX_RING_SZ);
 	sc->bge_std = 0;
 	for (i = 0; i < BGE_SSLOTS; i++) {
 		if ((error = bge_newbuf_std(sc, i)) != 0)
@@ -1089,6 +1090,7 @@ bge_init_rx_ring_jumbo(struct bge_softc 
 	struct bge_rcb *rcb;
 	int error, i;
 
+	bzero(sc->bge_ldata.bge_rx_jumbo_ring, BGE_JUMBO_RX_RING_SZ);
 	sc->bge_jumbo = 0;
 	for (i = 0; i < BGE_JUMBO_RX_RING_CNT; i++) {
 		if ((error = bge_newbuf_jumbo(sc, i)) != 0)
@@ -1161,6 +1163,11 @@ bge_init_tx_ring(struct bge_softc *sc)
 	sc->bge_txcnt = 0;
 	sc->bge_tx_saved_considx = 0;
 
+	bzero(sc->bge_ldata.bge_tx_ring, BGE_TX_RING_SZ);
+	bus_dmamap_sync(sc->bge_cdata.bge_tx_ring_tag,
+	    sc->bge_cdata.bge_tx_ring_map,
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+
 	/* Initialize transmit producer index for host-memory send ring. */
 	sc->bge_tx_prodidx = 0;
 	bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx);
From kuriyama at FreeBSD.org  Tue Nov 10 00:14:02 2009
From: kuriyama at FreeBSD.org (Jun Kuriyama)
Date: Tue Nov 10 00:14:40 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <20091109225244.GB64905@hoeg.nl>
References: <200911090254.nA92sG1G005921@svn.freebsd.org>
	<20091109225244.GB64905@hoeg.nl>
Message-ID: <7mbpjbgt0n.wl%kuriyama@s2factory.co.jp>

At Mon, 9 Nov 2009 23:52:44 +0100,
ed@80386.nl wrote:
> * Jun Kuriyama  wrote:
> >   - Add hw.clflush_disable loader tunable to avoid panic (trap 9) at
> >     map_invalidate_cache_range() even if CPU is not Intel.
> >   - This tunable can be set to -1 (default), 0 and 1.  -1 is same as
> >     current behavior, which automatically disable CLFLUSH on Intel CPUs
> >     without CPUID_SS (should be occured on Xen only).  You can specify 1
> >     when this panic happened on non-Intel CPUs (such as AMD's).  Because
> >     disabling CLFLUSH may reduce performance, you can try with setting 0
> >     on Intel CPUs without SS to use CLFLUSH feature.
> >   
> >   Reviewed by:	kib
> >   Reported by:	karl, kuriyama
> >   Related to:	kern/138863
> 
> Unfortunately it seems to lock up my Intel Core 2 Duo boxes.
> 
> Systems affected:
> 
> - Apple MacBook3,1
> - Dell SC440

Thank you for your report!

(1) On MacBook, lock up occured on real hardware?  Not on hypervisor?
(2) On both system, is there no problem before this commit?


-- 
Jun Kuriyama  // FreeBSD Project
          // S2 Factory, Inc.
From delphij at FreeBSD.org  Tue Nov 10 00:48:25 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Tue Nov 10 00:48:36 2009
Subject: svn commit: r199123 - head/contrib/ee
Message-ID: <200911100048.nAA0mOdT040377@svn.freebsd.org>

Author: delphij
Date: Tue Nov 10 00:48:24 2009
New Revision: 199123
URL: http://svn.freebsd.org/changeset/base/199123

Log:
  Add a minimal change to prevent NULL deference in ee(1).
  
  To repeat the problem, one can press "Ctrl+C" and then enter "0".
  
  Submitted by:	Alexander Best 

Modified:
  head/contrib/ee/ee.c

Modified: head/contrib/ee/ee.c
==============================================================================
--- head/contrib/ee/ee.c	Tue Nov 10 00:46:08 2009	(r199122)
+++ head/contrib/ee/ee.c	Tue Nov 10 00:48:24 2009	(r199123)
@@ -1989,7 +1989,7 @@ char *cmd_str;
 	int number;
 	int i;
 	char *ptr;
-	char *direction = NULL;
+	char *direction = "d";
 	struct text *t_line;
 
 	ptr = cmd_str;
From dougb at FreeBSD.org  Tue Nov 10 03:18:50 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Tue Nov 10 03:18:56 2009
Subject: svn commit: r199127 - head/share/man/man5
Message-ID: <200911100318.nAA3Inqe045258@svn.freebsd.org>

Author: dougb
Date: Tue Nov 10 03:18:49 2009
New Revision: 199127
URL: http://svn.freebsd.org/changeset/base/199127

Log:
  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 

Modified:
  head/share/man/man5/rc.conf.5

Modified: head/share/man/man5/rc.conf.5
==============================================================================
--- head/share/man/man5/rc.conf.5	Tue Nov 10 01:12:00 2009	(r199126)
+++ head/share/man/man5/rc.conf.5	Tue Nov 10 03:18:49 2009	(r199127)
@@ -351,6 +351,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 a default hostname of
+.Dq Amnesiac.
 .It Va nisdomainname
 .Pq Vt str
 The NIS domain name of this host, or
From ume at FreeBSD.org  Tue Nov 10 03:56:51 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Tue Nov 10 03:57:03 2009
Subject: svn commit: r199128 - head/lib/libc/nls
Message-ID: <200911100356.nAA3upWS046057@svn.freebsd.org>

Author: ume
Date: Tue Nov 10 03:56:51 2009
New Revision: 199128
URL: http://svn.freebsd.org/changeset/base/199128

Log:
  Add Japanese catalogue entries for newer errnos: EBADMSG, EMULTIHOP,
  ENOLINK, EPROTO, ENOTCAPABLE.

Modified:
  head/lib/libc/nls/ja_JP.UTF-8.msg
  head/lib/libc/nls/ja_JP.eucJP.msg

Modified: head/lib/libc/nls/ja_JP.UTF-8.msg
==============================================================================
--- head/lib/libc/nls/ja_JP.UTF-8.msg	Tue Nov 10 03:18:49 2009	(r199127)
+++ head/lib/libc/nls/ja_JP.UTF-8.msg	Tue Nov 10 03:56:51 2009	(r199128)
@@ -181,6 +181,16 @@ $ ENOATTR
 87 ãã®ã‚ˆã†ãªå±žæ€§ã¯ã‚りã¾ã›ã‚“
 $ EDOOFUS
 88 プログラミングエラーã§ã™
+$ EBADMSG
+89 無効ãªãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã§ã™
+$ EMULTIHOP
+90 マルãƒãƒ›ãƒƒãƒ—ãŒè©¦ã¿ã‚‰ã‚Œã¾ã—ãŸ
+$ ENOLINK
+91 リンクãŒåˆ‡æ–­ã•れã¦ã„ã¾ã™
+$ EPROTO
+92 プロトコルエラーã§ã™
+$ ENOTCAPABLE
+93 ケーパビリティãŒä¸è¶³ã§ã™
 $
 $ strsignal() support catalog
 $

Modified: head/lib/libc/nls/ja_JP.eucJP.msg
==============================================================================
--- head/lib/libc/nls/ja_JP.eucJP.msg	Tue Nov 10 03:18:49 2009	(r199127)
+++ head/lib/libc/nls/ja_JP.eucJP.msg	Tue Nov 10 03:56:51 2009	(r199128)
@@ -181,6 +181,16 @@ $ ENOATTR
 87 ¤½¤Î¤è¤¦¤Ê°À­¤Ï¤¢¤ê¤Þ¤»¤ó
 $ EDOOFUS
 88 ¥×¥í¥°¥é¥ß¥ó¥°¥¨¥é¡¼¤Ç¤¹
+$ EBADMSG
+89 ̵¸ú¤Ê¥á¥Ã¥»¡¼¥¸¤Ç¤¹
+$ EMULTIHOP
+90 ¥Þ¥ë¥Á¥Û¥Ã¥×¤¬»î¤ß¤é¤ì¤Þ¤·¤¿
+$ ENOLINK
+91 ¥ê¥ó¥¯¤¬ÀÚÃǤµ¤ì¤Æ¤¤¤Þ¤¹
+$ EPROTO
+92 ¥×¥í¥È¥³¥ë¥¨¥é¡¼¤Ç¤¹
+$ ENOTCAPABLE
+93 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤¬ÉÔ­¤Ç¤¹
 $
 $ strsignal() support catalog
 $
From ed at 80386.nl  Tue Nov 10 05:59:13 2009
From: ed at 80386.nl (Ed Schouten)
Date: Tue Nov 10 05:59:19 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <7mbpjbgt0n.wl%kuriyama@s2factory.co.jp>
References: <200911090254.nA92sG1G005921@svn.freebsd.org>
	<20091109225244.GB64905@hoeg.nl>
	<7mbpjbgt0n.wl%kuriyama@s2factory.co.jp>
Message-ID: <20091110055910.GC64905@hoeg.nl>

Hello Jun,

* Jun Kuriyama  wrote:
> (1) On MacBook, lock up occured on real hardware?  Not on hypervisor?

Nope. The MacBook does use Apple's Boot Camp, but I can't say whether
that can be considered to be a hypervisor. What happens, is that the
system just locks up after probing all the device. It doesn't mount the
root device anymore.

> (2) On both system, is there no problem before this commit?

I bisected it and the revision before this one does boot. I'll
experiment with the tunables this afternoon. I really had to get some
sleep last night, so I couldn't investigate it any further.

-- 
 Ed Schouten 
 WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091110/f0355af6/attachment.pgp
From kuriyama at FreeBSD.org  Tue Nov 10 06:11:19 2009
From: kuriyama at FreeBSD.org (Jun Kuriyama)
Date: Tue Nov 10 06:11:30 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <20091110055910.GC64905@hoeg.nl>
References: <200911090254.nA92sG1G005921@svn.freebsd.org>
	<20091109225244.GB64905@hoeg.nl>
	<7mbpjbgt0n.wl%kuriyama@s2factory.co.jp>
	<20091110055910.GC64905@hoeg.nl>
Message-ID: <7mvdhigb96.wl%kuriyama@s2factory.co.jp>

At Tue, 10 Nov 2009 06:59:11 +0100,
ed@80386.nl wrote:
> > (1) On MacBook, lock up occured on real hardware?  Not on hypervisor?
> 
> Nope. The MacBook does use Apple's Boot Camp, but I can't say whether
> that can be considered to be a hypervisor. What happens, is that the
> system just locks up after probing all the device. It doesn't mount the
> root device anymore.

Hmm, I think Boot Camp is not hypervisor, and should be treated as
real hardware.  Which architecture (i386/amd64) you are using?

> > (2) On both system, is there no problem before this commit?
> 
> I bisected it and the revision before this one does boot. I'll
> experiment with the tunables this afternoon. I really had to get some
> sleep last night, so I couldn't investigate it any further.

You can try with hw.clflush_disable="1" in loader.conf.  If you can
boot with it, I must be mistaken something (anyway its my fault).

Can you show me CPUID line at boot message (of course from the kernel
you can boot) like this?

> CPU: Dual-Core AMD Opteron(tm) Processor 2210 (1800.07-MHz K8-class CPU)
>   Origin = "AuthenticAMD"  Id = 0x40f12  Stepping = 2
>   Features=0x178bfbff
>   Features2=0x2001
>   AMD Features=0xea500800


-- 
Jun Kuriyama  // FreeBSD Project
          // S2 Factory, Inc.
From ed at 80386.nl  Tue Nov 10 07:20:52 2009
From: ed at 80386.nl (Ed Schouten)
Date: Tue Nov 10 07:21:25 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <7mvdhigb96.wl%kuriyama@s2factory.co.jp>
References: <200911090254.nA92sG1G005921@svn.freebsd.org>
	<20091109225244.GB64905@hoeg.nl>
	<7mbpjbgt0n.wl%kuriyama@s2factory.co.jp>
	<20091110055910.GC64905@hoeg.nl>
	<7mvdhigb96.wl%kuriyama@s2factory.co.jp>
Message-ID: <5523DBB0-28C6-46DD-83F9-AE135CEA1793@80386.nl>

Both systems run amd64. I'll try the tunable when I get back home.  
Thanks!

-- 
  Ed Schouten  (from iPod)
  WWW: http://80386.nl/

On 10 nov 2009, at 07:11, Jun Kuriyama  wrote:

> At Tue, 10 Nov 2009 06:59:11 +0100,
> ed@80386.nl wrote:
>>> (1) On MacBook, lock up occured on real hardware?  Not on  
>>> hypervisor?
>>
>> Nope. The MacBook does use Apple's Boot Camp, but I can't say whether
>> that can be considered to be a hypervisor. What happens, is that the
>> system just locks up after probing all the device. It doesn't mount  
>> the
>> root device anymore.
>
> Hmm, I think Boot Camp is not hypervisor, and should be treated as
> real hardware.  Which architecture (i386/amd64) you are using?
>
>>> (2) On both system, is there no problem before this commit?
>>
>> I bisected it and the revision before this one does boot. I'll
>> experiment with the tunables this afternoon. I really had to get some
>> sleep last night, so I couldn't investigate it any further.
>
> You can try with hw.clflush_disable="1" in loader.conf.  If you can
> boot with it, I must be mistaken something (anyway its my fault).
>
> Can you show me CPUID line at boot message (of course from the kernel
> you can boot) like this?
>
>> CPU: Dual-Core AMD Opteron(tm) Processor 2210 (1800.07-MHz K8-class  
>> CPU)
>>  Origin = "AuthenticAMD"  Id = 0x40f12  Stepping = 2
>>   
>> Features= 
>> 0x178bfbff< 
>> FPU, 
>> VME, 
>> DE, 
>> PSE, 
>> TSC, 
>> MSR, 
>> PAE, 
>> MCE, 
>> CX8, 
>> APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
>>  Features2=0x2001
>>  AMD Features=0xea500800> 3DNow!>
>
>
> -- 
> Jun Kuriyama  // FreeBSD Project
>          // S2 Factory, Inc.
>
From des at FreeBSD.org  Tue Nov 10 09:44:57 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Tue Nov 10 09:45:08 2009
Subject: svn commit: r199130 - head/sbin/reboot
Message-ID: <200911100944.nAA9iupI053397@svn.freebsd.org>

Author: des
Date: Tue Nov 10 09:44:55 2009
New Revision: 199130
URL: http://svn.freebsd.org/changeset/base/199130

Log:
  More rational usage()

Modified:
  head/sbin/reboot/reboot.c

Modified: head/sbin/reboot/reboot.c
==============================================================================
--- head/sbin/reboot/reboot.c	Tue Nov 10 04:02:03 2009	(r199129)
+++ head/sbin/reboot/reboot.c	Tue Nov 10 09:44:55 2009	(r199130)
@@ -216,10 +216,12 @@ restart:
 }
 
 static void
-usage()
+usage(void)
 {
-	(void)fprintf(stderr, "usage: %s [-%slnpq] [-k kernel]\n",
-	    getprogname(), dohalt ? "" : "d");
+
+	(void)fprintf(stderr, dohalt ?
+	    "usage: halt [-lnpq] [-k kernel]\n" :
+	    "usage: reboot [-dlnpq] [-k kernel]\n");
 	exit(1);
 }
 
From des at FreeBSD.org  Tue Nov 10 09:45:44 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Tue Nov 10 09:45:55 2009
Subject: svn commit: r199131 - in head: crypto/openssh secure/lib/libssh
Message-ID: <200911100945.nAA9jhGH053459@svn.freebsd.org>

Author: des
Date: Tue Nov 10 09:45:43 2009
New Revision: 199131
URL: http://svn.freebsd.org/changeset/base/199131

Log:
  Fix globbing
  
  Noticed by:	delphij, David Cornejo 
  Forgotten by:	des

Modified:
  head/crypto/openssh/ssh_namespace.h
  head/secure/lib/libssh/Makefile

Modified: head/crypto/openssh/ssh_namespace.h
==============================================================================
--- head/crypto/openssh/ssh_namespace.h	Tue Nov 10 09:44:55 2009	(r199130)
+++ head/crypto/openssh/ssh_namespace.h	Tue Nov 10 09:45:43 2009	(r199131)
@@ -223,6 +223,8 @@
 #define get_u32					ssh_get_u32
 #define get_u64					ssh_get_u64
 #define getrrsetbyname				ssh_getrrsetbyname
+#define glob					ssh_glob
+#define globfree				ssh_globfree
 #define host_hash				ssh_host_hash
 #define hostfile_read_key			ssh_hostfile_read_key
 #define hpdelim					ssh_hpdelim

Modified: head/secure/lib/libssh/Makefile
==============================================================================
--- head/secure/lib/libssh/Makefile	Tue Nov 10 09:44:55 2009	(r199130)
+++ head/secure/lib/libssh/Makefile	Tue Nov 10 09:45:43 2009	(r199131)
@@ -19,7 +19,7 @@ SRCS=	acss.c authfd.c authfile.c bufaux.
 # compiled directly into sshd instead.
 
 # Portability layer
-SRCS+=	bsd-misc.c fmt_scaled.c getrrsetbyname.c \
+SRCS+=	bsd-misc.c fmt_scaled.c getrrsetbyname.c glob.c \
 	openssl-compat.c port-tun.c strtonum.c vis.c xcrypt.c xmmap.c
 # FreeBSD additions
 SRCS+=	version.c
From mav at FreeBSD.org  Tue Nov 10 09:46:53 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Tue Nov 10 09:47:05 2009
Subject: svn commit: r199132 - head/sys/dev/siis
Message-ID: <200911100946.nAA9krUT053517@svn.freebsd.org>

Author: mav
Date: Tue Nov 10 09:46:52 2009
New Revision: 199132
URL: http://svn.freebsd.org/changeset/base/199132

Log:
  MFp4:
  Organize device IDs and add some more of them.

Modified:
  head/sys/dev/siis/siis.c
  head/sys/dev/siis/siis.h

Modified: head/sys/dev/siis/siis.c
==============================================================================
--- head/sys/dev/siis/siis.c	Tue Nov 10 09:45:43 2009	(r199131)
+++ head/sys/dev/siis/siis.c	Tue Nov 10 09:46:52 2009	(r199132)
@@ -89,24 +89,37 @@ static void siispoll(struct cam_sim *sim
 
 MALLOC_DEFINE(M_SIIS, "SIIS driver", "SIIS driver data buffers");
 
+static struct {
+	uint32_t	id;
+	const char	*name;
+	int		ports;
+} siis_ids[] = {
+	{0x31241095,	"SiI3124",	4},
+	{0x31248086,	"SiI3124",	4},
+	{0x31321095,	"SiI3132",	2},
+	{0x02421095,	"SiI3132",	2},
+	{0x02441095,	"SiI3132",	2},
+	{0x31311095,	"SiI3131",	1},
+	{0x35311095,	"SiI3531",	1},
+	{0,		NULL,		0}
+};
+
 static int
 siis_probe(device_t dev)
 {
+	char buf[64];
+	int i;
 	uint32_t devid = pci_get_devid(dev);
 
-	if (devid == SIIS_SII3124) {
-		device_set_desc_copy(dev, "SiI3124 SATA2 controller");
-	} else if (devid == SIIS_SII3132 ||
-		   devid == SIIS_SII3132_1 ||
-		   devid == SIIS_SII3132_2) {
-		device_set_desc_copy(dev, "SiI3132 SATA2 controller");
-	} else if (devid == SIIS_SII3531) {
-		device_set_desc_copy(dev, "SiI3531 SATA2 controller");
-	} else {
-		return (ENXIO);
+	for (i = 0; siis_ids[i].id != 0; i++) {
+		if (siis_ids[i].id == devid) {
+			snprintf(buf, sizeof(buf), "%s SATA2 controller",
+			    siis_ids[i].name);
+			device_set_desc_copy(dev, buf);
+			return (BUS_PROBE_VENDOR);
+		}
 	}
-
-	return (BUS_PROBE_VENDOR);
+	return (ENXIO);
 }
 
 static int
@@ -115,8 +128,12 @@ siis_attach(device_t dev)
 	struct siis_controller *ctlr = device_get_softc(dev);
 	uint32_t devid = pci_get_devid(dev);
 	device_t child;
-	int	error, unit;
+	int	error, i, unit;
 
+	for (i = 0; siis_ids[i].id != 0; i++) {
+		if (siis_ids[i].id == devid)
+			break;
+	}
 	ctlr->dev = dev;
 	/* Global memory */
 	ctlr->r_grid = PCIR_BAR(0);
@@ -146,8 +163,7 @@ siis_attach(device_t dev)
 	/* Reset controller */
 	siis_resume(dev);
 	/* Number of HW channels */
-	ctlr->channels = (devid == SIIS_SII3124) ? 4 :
-	    (devid == SIIS_SII3531 ? 1 : 2);
+	ctlr->channels = siis_ids[i].ports;
 	/* Setup interrupts. */
 	if (siis_setup_interrupt(dev)) {
 		bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem);

Modified: head/sys/dev/siis/siis.h
==============================================================================
--- head/sys/dev/siis/siis.h	Tue Nov 10 09:45:43 2009	(r199131)
+++ head/sys/dev/siis/siis.h	Tue Nov 10 09:46:52 2009	(r199132)
@@ -137,12 +137,6 @@
 
 #define ATA_SACTIVE                     16
 
-#define SIIS_SII3124		0x31241095
-#define SIIS_SII3132		0x31321095
-#define SIIS_SII3132_1		0x02421095
-#define SIIS_SII3132_2		0x02441095
-#define SIIS_SII3531		0x35311095
-
 /*
  * Global registers
  */
From des at FreeBSD.org  Tue Nov 10 10:34:44 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Tue Nov 10 10:34:50 2009
Subject: svn commit: r199133 - head/usr.sbin/sysinstall
Message-ID: <200911101034.nAAAYia3055971@svn.freebsd.org>

Author: des
Date: Tue Nov 10 10:34:44 2009
New Revision: 199133
URL: http://svn.freebsd.org/changeset/base/199133

Log:
  Remove a bunch of code used to detect SMP on ((i386 && !pc98) || amd64) and
  offer to install an SMP kernel.  The way this worked was: on supported
  platforms, code to read ACPI tables and BIOS MP tables was compiled into
  sysinstall, and if an SMP kernel config was present in the source tree when
  sysinstall was built, code that called it was also compiled.  Since we
  haven't had SMP kernel configs in years, the latter was never compiled and
  the former never ran.
  
  This only removes dead and unreachable code; it does *not* remove the NCpus
  variable, nor the code that sets it to 1, nor the code that asks the user to
  select a kernel from a list.
  
  Discussed with:	re@, randi@ and others

Deleted:
  head/usr.sbin/sysinstall/acpi.c
  head/usr.sbin/sysinstall/acpidump.h
  head/usr.sbin/sysinstall/biosmptable.c
Modified:
  head/usr.sbin/sysinstall/Makefile
  head/usr.sbin/sysinstall/dist.c
  head/usr.sbin/sysinstall/install.c
  head/usr.sbin/sysinstall/menus.c
  head/usr.sbin/sysinstall/sysinstall.8

Modified: head/usr.sbin/sysinstall/Makefile
==============================================================================
--- head/usr.sbin/sysinstall/Makefile	Tue Nov 10 09:46:52 2009	(r199132)
+++ head/usr.sbin/sysinstall/Makefile	Tue Nov 10 10:34:44 2009	(r199133)
@@ -23,37 +23,6 @@ CFLAGS+= -I${.CURDIR}/../../gnu/lib/libd
 DPADD=	${LIBDIALOG} ${LIBNCURSES} ${LIBUTIL} ${LIBDISK} ${LIBFTPIO}
 LDADD=	-ldialog -lncurses -lutil -ldisk -lftpio
 
-#
-# When distributions have both UP and SMP kernels sysinstall
-# will probe for the number of cpus on the target machine and
-# automatically select which is appropriate.  This can be overridden
-# through the menus or both kernels can be installed (with the
-# most "appropriate" one setup as /boot/kernel).  For now this
-# is done for i386 and amd64; for other systems support must be
-# added to identify the cpu count if acpi and MPTable probing
-# is insufficient.
-#
-# The unmber of cpus probed is passed through the environment in
-# VAR_NCPUS ("ncpus") to scripts.
-#
-# Note that WITH_SMP is a compile time option that enables the
-# builtin menus for the SMP kernel configuration.  If this kernel
-# is not built (see release/Makefile) then this should not be
-# enabled as sysinstall may try to select an SMP kernel config
-# where none is available.  This option should not be needed--we
-# should probe for an SMP kernel in the distribution but doing
-# that is painful because of media changes and the structure of
-# sysinstall so for now it's a priori.
-#
-.if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "amd64"
-SRCS+=	acpi.c biosmptable.c
-.if exists(${.CURDIR}/../../sys/${MACHINE}/conf/SMP)
-CFLAGS+=-DWITH_SMP	
-.endif
-DPADD+=	${LIBDEVINFO}
-LDADD+=	-ldevinfo
-.endif
-
 CLEANFILES=	makedevs.c rtermcap
 CLEANFILES+=	keymap.tmp keymap.h countries.tmp countries.h
 

Modified: head/usr.sbin/sysinstall/dist.c
==============================================================================
--- head/usr.sbin/sysinstall/dist.c	Tue Nov 10 09:46:52 2009	(r199132)
+++ head/usr.sbin/sysinstall/dist.c	Tue Nov 10 10:34:44 2009	(r199133)
@@ -99,9 +99,6 @@ static Distribution DistTable[] = {
 /* The kernel distributions */
 static Distribution KernelDistTable[] = {
     DTE_TARBALL("GENERIC",  &KernelDists, KERNEL_GENERIC, "/boot"),
-#ifdef WITH_SMP
-    DTE_TARBALL("SMP", 	    &KernelDists, KERNEL_SMP,	  "/boot"),
-#endif
     DTE_END,
 };
 
@@ -207,12 +204,7 @@ distConfig(dialogMenuItem *self)
 int
 selectKernel(void)
 {
-#ifdef WITH_SMP
-    /* select default kernel based on deduced cpu count */
-    return NCpus > 1 ? DIST_KERNEL_SMP : DIST_KERNEL_GENERIC;
-#else
     return DIST_KERNEL_GENERIC;
-#endif
 }
 
 int

Modified: head/usr.sbin/sysinstall/install.c
==============================================================================
--- head/usr.sbin/sysinstall/install.c	Tue Nov 10 09:46:52 2009	(r199132)
+++ head/usr.sbin/sysinstall/install.c	Tue Nov 10 10:34:44 2009	(r199133)
@@ -938,20 +938,12 @@ installFixupKernel(dialogMenuItem *self,
     /* All of this is done only as init, just to be safe */
     if (RunningAsInit) {
 	/*
-	 * Install something as /boot/kernel.  Prefer SMP
-	 * over GENERIC--this should handle the case where
-	 * both SMP and GENERIC are installed (otherwise we
-	 * select the one kernel that was installed).
+	 * Install something as /boot/kernel.
 	 *
 	 * NB: we assume any existing kernel has been saved
 	 *     already and the /boot/kernel we remove is empty.
 	 */
 	vsystem("rm -rf /boot/kernel");
-#if WITH_SMP
-	if (dists & DIST_KERNEL_SMP)
-		vsystem("mv /boot/SMP /boot/kernel");
-	else
-#endif
 		vsystem("mv /boot/GENERIC /boot/kernel");
     }
     return DITEM_SUCCESS | DITEM_RESTORE;
@@ -1255,11 +1247,6 @@ installVarDefaults(dialogMenuItem *self)
 	variable_set2(SYSTEM_STATE,		"init", 0);
     variable_set2(VAR_NEWFS_ARGS,		"-b 16384 -f 2048", 0);
     variable_set2(VAR_CONSTERM,                 "NO", 0);
-#if (defined(__i386__) && !defined(PC98)) || defined(__amd64__)
-    NCpus = acpi_detect();
-    if (NCpus == -1)
-	NCpus = biosmptable_detect();
-#endif
     if (NCpus <= 0)
 	NCpus = 1;
     snprintf(ncpus, sizeof(ncpus), "%u", NCpus);

Modified: head/usr.sbin/sysinstall/menus.c
==============================================================================
--- head/usr.sbin/sysinstall/menus.c	Tue Nov 10 09:46:52 2009	(r199132)
+++ head/usr.sbin/sysinstall/menus.c	Tue Nov 10 10:34:44 2009	(r199133)
@@ -1031,10 +1031,6 @@ DMenu MenuKernelDistributions = {
 	NULL,		clearKernel, NULL, NULL, ' ', ' ', ' ' },
       { " GENERIC",	"GENERIC kernel configuration",
 	dmenuFlagCheck,	dmenuSetFlag, NULL, &KernelDists, '[', 'X', ']', DIST_KERNEL_GENERIC },
-#ifdef WITH_SMP
-      { " SMP",		"GENERIC symmetric multiprocessor kernel configuration",
-	dmenuFlagCheck,	dmenuSetFlag,	NULL, &KernelDists, '[', 'X', ']', DIST_KERNEL_SMP },
-#endif
       { NULL } },
 };
 

Modified: head/usr.sbin/sysinstall/sysinstall.8
==============================================================================
--- head/usr.sbin/sysinstall/sysinstall.8	Tue Nov 10 09:46:52 2009	(r199132)
+++ head/usr.sbin/sysinstall/sysinstall.8	Tue Nov 10 10:34:44 2009	(r199133)
@@ -413,8 +413,6 @@ Possible distribution values are:
 The base binary distribution.
 .It Li GENERIC
 The GENERIC kernel.
-.It Li SMP
-A kernel suitable for multiple processor systems.
 .It Li doc
 Miscellaneous documentation
 .It Li games
From des at FreeBSD.org  Tue Nov 10 10:42:48 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Tue Nov 10 10:43:00 2009
Subject: svn commit: r199134 - head/tools/regression/lib/libutil
Message-ID: <200911101042.nAAAgmWN056191@svn.freebsd.org>

Author: des
Date: Tue Nov 10 10:42:48 2009
New Revision: 199134
URL: http://svn.freebsd.org/changeset/base/199134

Log:
  Check fork() return value

Modified:
  head/tools/regression/lib/libutil/test-flopen.c

Modified: head/tools/regression/lib/libutil/test-flopen.c
==============================================================================
--- head/tools/regression/lib/libutil/test-flopen.c	Tue Nov 10 10:34:44 2009	(r199133)
+++ head/tools/regression/lib/libutil/test-flopen.c	Tue Nov 10 10:42:48 2009	(r199134)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2007-2009 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 2007-2009 Dag-Erling Coïdan Smørgrav
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -161,7 +161,10 @@ test_flopen_lock_child(void)
 	if (fd1 < 0) {
 		result = strerror(errno);
 	} else {
-		if ((pid = fork()) == 0) {
+		pid = fork();
+		if (pid == -1) {
+			result = strerror(errno);
+		} else if (pid == 0) {
 			select(0, 0, 0, 0, 0);
 			_exit(0);
 		}
From keramida at freebsd.org  Tue Nov 10 11:39:18 2009
From: keramida at freebsd.org (Giorgos Keramidas)
Date: Tue Nov 10 11:39:24 2009
Subject: svn commit: r199050 - in head/sys: conf dev/ata
In-Reply-To: <200911081433.nA8EXJnp088767@svn.freebsd.org> (Alexander Motin's
	message of "Sun, 8 Nov 2009 14:33:19 +0000 (UTC)")
References: <200911081433.nA8EXJnp088767@svn.freebsd.org>
Message-ID: <87my2uip7h.fsf@kobe.laptop>

On Sun, 8 Nov 2009 14:33:19 +0000 (UTC), Alexander Motin  wrote:
> Author: mav
> Date: Sun Nov  8 14:33:19 2009
> New Revision: 199050
> URL: http://svn.freebsd.org/changeset/base/199050
>
> Log:
>   Introduce define and kernel option ATA_REQUEST_TIMEOUT to control ATA(4)
>   command timeout.
>
>   Submitted by:	keramida

Neat.  One more local patch I can delete now.  Thanks :-)

From kib at FreeBSD.org  Tue Nov 10 11:43:08 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Tue Nov 10 11:43:16 2009
Subject: svn commit: r199135 - in head/sys: amd64/amd64 arm/arm i386/i386
	ia64/ia64 mips/include mips/mips powerpc/aim powerpc/booke
	sparc64/include sparc64/sparc64 sun4v/sun4v sys
Message-ID: <200911101143.nAABh7Kg057874@svn.freebsd.org>

Author: kib
Date: Tue Nov 10 11:43:07 2009
New Revision: 199135
URL: http://svn.freebsd.org/changeset/base/199135

Log:
  Extract the code that records syscall results in the frame into MD
  function cpu_set_syscall_retval().
  
  Suggested by:	marcel
  Reviewed by:	marcel, davidxu
  PowerPC, ARM, ia64 changes:	marcel
  Sparc64 tested and reviewed by:	marius, also sunv reviewed
  MIPS tested by:	gonzo
  MFC after:	1 month

Modified:
  head/sys/amd64/amd64/trap.c
  head/sys/amd64/amd64/vm_machdep.c
  head/sys/arm/arm/trap.c
  head/sys/arm/arm/vm_machdep.c
  head/sys/i386/i386/trap.c
  head/sys/i386/i386/vm_machdep.c
  head/sys/ia64/ia64/trap.c
  head/sys/ia64/ia64/vm_machdep.c
  head/sys/mips/include/pcb.h
  head/sys/mips/mips/trap.c
  head/sys/mips/mips/vm_machdep.c
  head/sys/powerpc/aim/trap.c
  head/sys/powerpc/aim/vm_machdep.c
  head/sys/powerpc/booke/trap.c
  head/sys/powerpc/booke/vm_machdep.c
  head/sys/sparc64/include/pcb.h
  head/sys/sparc64/sparc64/trap.c
  head/sys/sparc64/sparc64/vm_machdep.c
  head/sys/sun4v/sun4v/trap.c
  head/sys/sun4v/sun4v/vm_machdep.c
  head/sys/sys/proc.h

Modified: head/sys/amd64/amd64/trap.c
==============================================================================
--- head/sys/amd64/amd64/trap.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/amd64/amd64/trap.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -1007,39 +1007,7 @@ syscall(struct trapframe *frame)
 #endif
 	}
 
-	switch (error) {
-	case 0:
-		frame->tf_rax = td->td_retval[0];
-		frame->tf_rdx = td->td_retval[1];
-		frame->tf_rflags &= ~PSL_C;
-		break;
-
-	case ERESTART:
-		/*
-		 * Reconstruct pc, we know that 'syscall' is 2 bytes.
-		 * We have to do a full context restore so that %r10
-		 * (which was holding the value of %rcx) is restored for
-		 * the next iteration.
-		 */
-		frame->tf_rip -= frame->tf_err;
-		frame->tf_r10 = frame->tf_rcx;
-		td->td_pcb->pcb_flags |= PCB_FULLCTX;
-		break;
-
-	case EJUSTRETURN:
-		break;
-
-	default:
- 		if (p->p_sysent->sv_errsize) {
- 			if (error >= p->p_sysent->sv_errsize)
-  				error = -1;	/* XXX */
-   			else
-  				error = p->p_sysent->sv_errtbl[error];
-		}
-		frame->tf_rax = error;
-		frame->tf_rflags |= PSL_C;
-		break;
-	}
+	cpu_set_syscall_retval(td, error);
 
 	/*
 	 * Traced syscall.

Modified: head/sys/amd64/amd64/vm_machdep.c
==============================================================================
--- head/sys/amd64/amd64/vm_machdep.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/amd64/amd64/vm_machdep.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -317,6 +317,45 @@ cpu_thread_free(struct thread *td)
 	cpu_thread_clean(td);
 }
 
+void
+cpu_set_syscall_retval(struct thread *td, int error)
+{
+
+	switch (error) {
+	case 0:
+		td->td_frame->tf_rax = td->td_retval[0];
+		td->td_frame->tf_rdx = td->td_retval[1];
+		td->td_frame->tf_rflags &= ~PSL_C;
+		break;
+
+	case ERESTART:
+		/*
+		 * Reconstruct pc, we know that 'syscall' is 2 bytes.
+		 * We have to do a full context restore so that %r10
+		 * (which was holding the value of %rcx) is restored
+		 * for the next iteration.
+		 */
+		td->td_frame->tf_rip -= td->td_frame->tf_err;
+		td->td_frame->tf_r10 = td->td_frame->tf_rcx;
+		td->td_pcb->pcb_flags |= PCB_FULLCTX;
+		break;
+
+	case EJUSTRETURN:
+		break;
+
+	default:
+		if (td->td_proc->p_sysent->sv_errsize) {
+			if (error >= td->td_proc->p_sysent->sv_errsize)
+				error = -1;	/* XXX */
+			else
+				error = td->td_proc->p_sysent->sv_errtbl[error];
+		}
+		td->td_frame->tf_rax = error;
+		td->td_frame->tf_rflags |= PSL_C;
+		break;
+	}
+}
+
 /*
  * Initialize machine state (pcb and trap frame) for a new thread about to
  * upcall. Put enough state in the new thread's PCB to get it to go back 

Modified: head/sys/arm/arm/trap.c
==============================================================================
--- head/sys/arm/arm/trap.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/arm/arm/trap.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -932,43 +932,8 @@ syscall(struct thread *td, trapframe_t *
 		KASSERT(td->td_ar == NULL, 
 		    ("returning from syscall with td_ar set!"));
 	}
-	switch (error) {
-	case 0: 
-#ifdef __ARMEB__
-		if ((insn & 0x000fffff) == SYS___syscall &&
-		    code != SYS_freebsd6_lseek && code != SYS_lseek) {
-			/*
-			 * 64-bit return, 32-bit syscall. Fixup byte order
-			 */ 
-			frame->tf_r0 = 0;
-			frame->tf_r1 = td->td_retval[0];
-		} else {
-			frame->tf_r0 = td->td_retval[0];
-			frame->tf_r1 = td->td_retval[1];
-		}
-#else
-		frame->tf_r0 = td->td_retval[0];
-	  	frame->tf_r1 = td->td_retval[1];
-#endif
-					      
-		frame->tf_spsr &= ~PSR_C_bit;   /* carry bit */
-		break;
-		
-	case ERESTART:
-		/*
-		 * Reconstruct the pc to point at the swi.
-		 */
-		frame->tf_pc -= INSN_SIZE;
-		break;
-	case EJUSTRETURN:                                       
-		/* nothing to do */  
-		break;
-	default:
 bad:
-		frame->tf_r0 = error;
-		frame->tf_spsr |= PSR_C_bit;    /* carry bit */
-		break;
-	}
+	cpu_set_syscall_retval(td, error);
 
 	WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning",
 	    (code >= 0 && code < SYS_MAXSYSCALL) ? syscallnames[code] : "???");

Modified: head/sys/arm/arm/vm_machdep.c
==============================================================================
--- head/sys/arm/arm/vm_machdep.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/arm/arm/vm_machdep.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -261,6 +263,57 @@ done:
 #endif
 }
 
+void
+cpu_set_syscall_retval(struct thread *td, int error)
+{
+	trapframe_t *frame;
+	int fixup;
+#ifdef __ARMEB__
+	uint32_t insn;
+#endif
+
+	frame = td->td_frame;
+	fixup = 0;
+
+#ifdef __ARMEB__
+	insn = *(u_int32_t *)(frame->tf_pc - INSN_SIZE);
+	if ((insn & 0x000fffff) == SYS___syscall) {
+		register_t *ap = &frame->tf_r0;
+		register_t code = ap[_QUAD_LOWWORD];
+		if (td->td_proc->p_sysent->sv_mask)
+			code &= td->td_proc->p_sysent->sv_mask;
+		fixup = (code != SYS_freebsd6_lseek && code != SYS_lseek)
+		    ? 1 : 0;
+	}
+#endif
+
+	switch (error) {
+	case 0:
+		if (fixup) {
+			frame->tf_r0 = 0;
+			frame->tf_r1 = td->td_retval[0];
+		} else {
+			frame->tf_r0 = td->td_retval[0];
+			frame->tf_r1 = td->td_retval[1];
+		}
+		frame->tf_spsr &= ~PSR_C_bit;   /* carry bit */
+		break;
+	case ERESTART:
+		/*
+		 * Reconstruct the pc to point at the swi.
+		 */
+		frame->tf_pc -= INSN_SIZE;
+		break;
+	case EJUSTRETURN:
+		/* nothing to do */
+		break;
+	default:
+		frame->tf_r0 = error;
+		frame->tf_spsr |= PSR_C_bit;    /* carry bit */
+		break;
+	}
+}
+
 /*
  * Initialize machine state (pcb and trap frame) for a new thread about to
  * upcall. Put enough state in the new thread's PCB to get it to go back 

Modified: head/sys/i386/i386/trap.c
==============================================================================
--- head/sys/i386/i386/trap.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/i386/i386/trap.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -1093,35 +1093,7 @@ syscall(struct trapframe *frame)
 #endif
 	}
 
-	switch (error) {
-	case 0:
-		frame->tf_eax = td->td_retval[0];
-		frame->tf_edx = td->td_retval[1];
-		frame->tf_eflags &= ~PSL_C;
-		break;
-
-	case ERESTART:
-		/*
-		 * Reconstruct pc, assuming lcall $X,y is 7 bytes,
-		 * int 0x80 is 2 bytes. We saved this in tf_err.
-		 */
-		frame->tf_eip -= frame->tf_err;
-		break;
-
-	case EJUSTRETURN:
-		break;
-
-	default:
- 		if (p->p_sysent->sv_errsize) {
- 			if (error >= p->p_sysent->sv_errsize)
-  				error = -1;	/* XXX */
-   			else
-  				error = p->p_sysent->sv_errtbl[error];
-		}
-		frame->tf_eax = error;
-		frame->tf_eflags |= PSL_C;
-		break;
-	}
+	cpu_set_syscall_retval(td, error);
 
 	/*
 	 * Traced syscall.

Modified: head/sys/i386/i386/vm_machdep.c
==============================================================================
--- head/sys/i386/i386/vm_machdep.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/i386/i386/vm_machdep.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -380,6 +381,41 @@ cpu_thread_free(struct thread *td)
 	cpu_thread_clean(td);
 }
 
+void
+cpu_set_syscall_retval(struct thread *td, int error)
+{
+
+	switch (error) {
+	case 0:
+		td->td_frame->tf_eax = td->td_retval[0];
+		td->td_frame->tf_edx = td->td_retval[1];
+		td->td_frame->tf_eflags &= ~PSL_C;
+		break;
+
+	case ERESTART:
+		/*
+		 * Reconstruct pc, assuming lcall $X,y is 7 bytes, int
+		 * 0x80 is 2 bytes. We saved this in tf_err.
+		 */
+		td->td_frame->tf_eip -= td->td_frame->tf_err;
+		break;
+
+	case EJUSTRETURN:
+		break;
+
+	default:
+		if (td->td_proc->p_sysent->sv_errsize) {
+			if (error >= td->td_proc->p_sysent->sv_errsize)
+				error = -1;	/* XXX */
+			else
+				error = td->td_proc->p_sysent->sv_errtbl[error];
+		}
+		td->td_frame->tf_eax = error;
+		td->td_frame->tf_eflags |= PSL_C;
+		break;
+	}
+}
+
 /*
  * Initialize machine state (pcb and trap frame) for a new thread about to
  * upcall. Put enough state in the new thread's PCB to get it to go back 

Modified: head/sys/ia64/ia64/trap.c
==============================================================================
--- head/sys/ia64/ia64/trap.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/ia64/ia64/trap.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -976,26 +976,7 @@ syscall(struct trapframe *tf)
 	error = (*callp->sy_call)(td, args);
 	AUDIT_SYSCALL_EXIT(error, td);
 
-	if (error != EJUSTRETURN) {
-		/*
-		 * Save the "raw" error code in r10. We use this to handle
-		 * syscall restarts (see do_ast()).
-		 */
-		tf->tf_scratch.gr10 = error;
-		if (error == 0) {
-			tf->tf_scratch.gr8 = td->td_retval[0];
-			tf->tf_scratch.gr9 = td->td_retval[1];
-		} else if (error != ERESTART) {
-			if (error < p->p_sysent->sv_errsize)
-				error = p->p_sysent->sv_errtbl[error];
-			/*
-			 * Translated error codes are returned in r8. User
-			 * processes use the translated error code.
-			 */
-			tf->tf_scratch.gr8 = error;
-		}
-	}
-
+	cpu_set_syscall_retval(td, error);
 	td->td_syscalls++;
 
 	/*

Modified: head/sys/ia64/ia64/vm_machdep.c
==============================================================================
--- head/sys/ia64/ia64/vm_machdep.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/ia64/ia64/vm_machdep.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -73,6 +73,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -140,6 +141,36 @@ cpu_thread_swapout(struct thread *td)
 }
 
 void
+cpu_set_syscall_retval(struct thread *td, int error)
+{
+	struct proc *p;
+	struct trapframe *tf;
+
+	if (error == EJUSTRETURN)
+		return;
+
+	tf = td->td_frame;
+
+	/*
+	 * Save the "raw" error code in r10. We use this to handle
+	 * syscall restarts (see do_ast()).
+	 */
+	tf->tf_scratch.gr10 = error;
+	if (error == 0) {
+		tf->tf_scratch.gr8 = td->td_retval[0];
+		tf->tf_scratch.gr9 = td->td_retval[1];
+	} else if (error != ERESTART) {
+		p = td->td_proc;
+		if (error < p->p_sysent->sv_errsize)
+			error = p->p_sysent->sv_errtbl[error];
+		/*
+		 * Translated error codes are returned in r8. User
+		 */
+		tf->tf_scratch.gr8 = error;
+	}
+}
+
+void
 cpu_set_upcall(struct thread *td, struct thread *td0)
 {
 	struct pcb *pcb;

Modified: head/sys/mips/include/pcb.h
==============================================================================
--- head/sys/mips/include/pcb.h	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/mips/include/pcb.h	Tue Nov 10 11:43:07 2009	(r199135)
@@ -52,6 +52,7 @@ struct pcb
 	struct trapframe pcb_regs;	/* saved CPU and registers */
 	label_t pcb_context;		/* kernel context for resume */
 	int	pcb_onfault;		/* for copyin/copyout faults */
+	register_t pcb_tpc;
 };
 
 /* these match the regnum's in regnum.h

Modified: head/sys/mips/mips/trap.c
==============================================================================
--- head/sys/mips/mips/trap.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/mips/mips/trap.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -644,7 +644,6 @@ dofault:
 			struct trapframe *locr0 = td->td_frame;
 			struct sysent *callp;
 			unsigned int code;
-			unsigned int tpc;
 			int nargs, nsaved;
 			register_t args[8];
 
@@ -660,7 +659,7 @@ dofault:
 				thread_user_enter(td);
 #endif
 			/* compute next PC after syscall instruction */
-			tpc = trapframe->pc;	/* Remember if restart */
+			td->td_pcb->pcb_tpc = trapframe->pc;	/* Remember if restart */
 			if (DELAYBRANCH(trapframe->cause)) {	/* Check BD bit */
 				locr0->pc = MipsEmulateBranch(locr0, trapframe->pc, 0,
 				    0);
@@ -761,44 +760,7 @@ dofault:
 			locr0 = td->td_frame;
 #endif
 			trapdebug_enter(locr0, -code);
-			switch (i) {
-			case 0:
-				if (quad_syscall && code != SYS_lseek) {
-					/*
-					 * System call invoked through the
-					 * SYS___syscall interface but the
-					 * return value is really just 32
-					 * bits.
-					 */
-					locr0->v0 = td->td_retval[0];
-					if (_QUAD_LOWWORD)
-						locr0->v1 = td->td_retval[0];
-					locr0->a3 = 0;
-				} else {
-					locr0->v0 = td->td_retval[0];
-					locr0->v1 = td->td_retval[1];
-					locr0->a3 = 0;
-				}
-				break;
-
-			case ERESTART:
-				locr0->pc = tpc;
-				break;
-
-			case EJUSTRETURN:
-				break;	/* nothing to do */
-
-			default:
-				if (quad_syscall && code != SYS_lseek) {
-					locr0->v0 = i;
-					if (_QUAD_LOWWORD)
-						locr0->v1 = i;
-					locr0->a3 = 1;
-				} else {
-					locr0->v0 = i;
-					locr0->a3 = 1;
-				}
-			}
+			cpu_set_syscall_retval(td, i);
 
 			/*
 			 * The sync'ing of I & D caches for SYS_ptrace() is

Modified: head/sys/mips/mips/vm_machdep.c
==============================================================================
--- head/sys/mips/mips/vm_machdep.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/mips/mips/vm_machdep.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -256,6 +257,62 @@ cpu_thread_alloc(struct thread *td)
 	}
 }
 
+void
+cpu_set_syscall_retval(struct thread *td, int error)
+{
+	struct trapframe *locr0 = td->td_frame;
+	unsigned int code;
+	int quad_syscall;
+
+	code = locr0->v0;
+	quad_syscall = 0;
+	if (code == SYS_syscall)
+		code = locr0->a0;
+	else if (code == SYS___syscall) {
+		code = _QUAD_LOWWORD ? locr0->a1 : locr0->a0;
+		quad_syscall = 1;
+	}
+
+	switch (error) {
+	case 0:
+		if (quad_syscall && code != SYS_lseek) {
+			/*
+			 * System call invoked through the
+			 * SYS___syscall interface but the
+			 * return value is really just 32
+			 * bits.
+			 */
+			locr0->v0 = td->td_retval[0];
+			if (_QUAD_LOWWORD)
+				locr0->v1 = td->td_retval[0];
+			locr0->a3 = 0;
+		} else {
+			locr0->v0 = td->td_retval[0];
+			locr0->v1 = td->td_retval[1];
+			locr0->a3 = 0;
+		}
+		break;
+
+	case ERESTART:
+		locr0->pc = td->td_pcb->pcb_tpc;
+		break;
+
+	case EJUSTRETURN:
+		break;	/* nothing to do */
+
+	default:
+		if (quad_syscall && code != SYS_lseek) {
+			locr0->v0 = error;
+			if (_QUAD_LOWWORD)
+				locr0->v1 = error;
+			locr0->a3 = 1;
+		} else {
+			locr0->v0 = error;
+			locr0->a3 = 1;
+		}
+	}
+}
+
 /*
  * Initialize machine state (pcb and trap frame) for a new thread about to
  * upcall. Put enough state in the new thread's PCB to get it to go back

Modified: head/sys/powerpc/aim/trap.c
==============================================================================
--- head/sys/powerpc/aim/trap.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/powerpc/aim/trap.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -415,43 +415,8 @@ syscall(struct trapframe *frame)
 		CTR3(KTR_SYSC, "syscall: p=%s %s ret=%x", td->td_name,
 		     syscallnames[code], td->td_retval[0]);
 	}
-	switch (error) {
-	case 0:
-		if (frame->fixreg[0] == SYS___syscall &&
-		    code != SYS_freebsd6_lseek && code != SYS_lseek) {
-			/*
-			 * 64-bit return, 32-bit syscall. Fixup byte order
-			 */
-			frame->fixreg[FIRSTARG] = 0;
-			frame->fixreg[FIRSTARG + 1] = td->td_retval[0];
-		} else {
-			frame->fixreg[FIRSTARG] = td->td_retval[0];
-			frame->fixreg[FIRSTARG + 1] = td->td_retval[1];
-		}
-		/* XXX: Magic number */
-		frame->cr &= ~0x10000000;
-		break;
-	case ERESTART:
-		/*
-		 * Set user's pc back to redo the system call.
-		 */
-		frame->srr0 -= 4;
-		break;
-	case EJUSTRETURN:
-		/* nothing to do */
-		break;
-	default:
-		if (p->p_sysent->sv_errsize) {
-			if (error >= p->p_sysent->sv_errsize)
-				error = -1;	/* XXX */
-			else
-				error = p->p_sysent->sv_errtbl[error];
-		}
-		frame->fixreg[FIRSTARG] = error;
-		/* XXX: Magic number: Carry Flag Equivalent? */
-		frame->cr |= 0x10000000;
-		break;
-	}
+
+	cpu_set_syscall_retval(td, error);
 
 	/*
 	 * Check for misbehavior.

Modified: head/sys/powerpc/aim/vm_machdep.c
==============================================================================
--- head/sys/powerpc/aim/vm_machdep.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/powerpc/aim/vm_machdep.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -81,7 +81,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 
 #include 
@@ -422,6 +424,59 @@ cpu_thread_swapout(struct thread *td)
 }
 
 void
+cpu_set_syscall_retval(struct thread *td, int error)
+{
+	struct proc *p;
+	struct trapframe *tf;
+	int fixup;
+
+	if (error == EJUSTRETURN)
+		return;
+
+	p = td->td_proc;
+	tf = td->td_frame;
+
+	if (tf->fixreg[0] == SYS___syscall) {
+		int code = tf->fixreg[FIRSTARG + 1];
+		if (p->p_sysent->sv_mask)
+			code &= p->p_sysent->sv_mask;
+		fixup = (code != SYS_freebsd6_lseek && code != SYS_lseek) ?
+		    1 : 0;
+	} else
+		fixup = 0;
+
+	switch (error) {
+	case 0:
+		if (fixup) {
+			/*
+			 * 64-bit return, 32-bit syscall. Fixup byte order
+			 */
+			tf->fixreg[FIRSTARG] = 0;
+			tf->fixreg[FIRSTARG + 1] = td->td_retval[0];
+		} else {
+			tf->fixreg[FIRSTARG] = td->td_retval[0];
+			tf->fixreg[FIRSTARG + 1] = td->td_retval[1];
+		}
+		tf->cr &= ~0x10000000;		/* XXX: Magic number */
+		break;
+	case ERESTART:
+		/*
+		 * Set user's pc back to redo the system call.
+		 */
+		tf->srr0 -= 4;
+		break;
+	default:
+		if (p->p_sysent->sv_errsize) {
+			error = (error < p->p_sysent->sv_errsize) ?
+			    p->p_sysent->sv_errtbl[error] : -1;
+		}
+		tf->fixreg[FIRSTARG] = error;
+		tf->cr |= 0x10000000;		/* XXX: Magic number */
+		break;
+	}
+}
+
+void
 cpu_set_upcall(struct thread *td, struct thread *td0)
 {
 	struct pcb *pcb2;

Modified: head/sys/powerpc/booke/trap.c
==============================================================================
--- head/sys/powerpc/booke/trap.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/powerpc/booke/trap.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -417,42 +417,7 @@ syscall(struct trapframe *frame)
 		     syscallnames[code], td->td_retval[0]);
 	}
 
-	switch (error) {
-	case 0:
-		if (frame->fixreg[0] == SYS___syscall && SYS_lseek) {
-			/*
-			 * 64-bit return, 32-bit syscall. Fixup byte order
-			 */
-			frame->fixreg[FIRSTARG] = 0;
-			frame->fixreg[FIRSTARG + 1] = td->td_retval[0];
-		} else {
-			frame->fixreg[FIRSTARG] = td->td_retval[0];
-			frame->fixreg[FIRSTARG + 1] = td->td_retval[1];
-		}
-		/* XXX: Magic number */
-		frame->cr &= ~0x10000000;
-		break;
-	case ERESTART:
-		/*
-		 * Set user's pc back to redo the system call.
-		 */
-		frame->srr0 -= 4;
-		break;
-	case EJUSTRETURN:
-		/* nothing to do */
-		break;
-	default:
-		if (p->p_sysent->sv_errsize) {
-			if (error >= p->p_sysent->sv_errsize)
-				error = -1;	/* XXX */
-			else
-				error = p->p_sysent->sv_errtbl[error];
-		}
-		frame->fixreg[FIRSTARG] = error;
-		/* XXX: Magic number: Carry Flag Equivalent? */
-		frame->cr |= 0x10000000;
-		break;
-	}
+	cpu_set_syscall_retval(td, error);
 
 	/*
 	 * Check for misbehavior.

Modified: head/sys/powerpc/booke/vm_machdep.c
==============================================================================
--- head/sys/powerpc/booke/vm_machdep.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/powerpc/booke/vm_machdep.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -113,7 +113,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 
 #include 
@@ -423,6 +425,59 @@ cpu_thread_swapout(struct thread *td)
 }
 
 void
+cpu_set_syscall_retval(struct thread *td, int error)
+{
+	struct proc *p;
+	struct trapframe *tf;
+	int fixup;
+
+	p = td->td_proc;
+	tf = td->td_frame;
+
+	if (tf->fixreg[0] == SYS___syscall) {
+		int code = tf->fixreg[FIRSTARG + 1];
+		if (p->p_sysent->sv_mask)
+			code &= p->p_sysent->sv_mask;
+		fixup = (code != SYS_freebsd6_lseek && code != SYS_lseek) ?
+		    1 : 0;
+	} else
+		fixup = 0;
+
+	switch (error) {
+	case 0:
+		if (fixup) {
+			/*
+			 * 64-bit return, 32-bit syscall. Fixup byte order
+			 */
+			tf->fixreg[FIRSTARG] = 0;
+			tf->fixreg[FIRSTARG + 1] = td->td_retval[0];
+		} else {
+			tf->fixreg[FIRSTARG] = td->td_retval[0];
+			tf->fixreg[FIRSTARG + 1] = td->td_retval[1];
+		}
+		tf->cr &= ~0x10000000;		/* XXX: Magic number */
+		break;
+	case ERESTART:
+		/*
+		 * Set user's pc back to redo the system call.
+		 */
+		tf->srr0 -= 4;
+		break;
+	case EJUSTRETURN:
+		/* nothing to do */
+		break;
+	default:
+		if (p->p_sysent->sv_errsize) {
+			error = (error < p->p_sysent->sv_errsize) ?
+			    p->p_sysent->sv_errtbl[error] : -1;
+		}
+		tf->fixreg[FIRSTARG] = error;
+		tf->cr |= 0x10000000;		/* XXX: Magic number */
+		break;
+	}
+}
+
+void
 cpu_set_upcall(struct thread *td, struct thread *td0)
 {
 	struct pcb *pcb2;

Modified: head/sys/sparc64/include/pcb.h
==============================================================================
--- head/sys/sparc64/include/pcb.h	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/sparc64/include/pcb.h	Tue Nov 10 11:43:07 2009	(r199135)
@@ -49,7 +49,8 @@ struct pcb {
 	uint64_t pcb_nsaved;
 	uint64_t pcb_pc;
 	uint64_t pcb_sp;
-	uint64_t pcb_pad[4];
+	uint64_t pcb_tpc;
+	uint64_t pcb_pad[3];
 } __aligned(64);
 
 #ifdef _KERNEL

Modified: head/sys/sparc64/sparc64/trap.c
==============================================================================
--- head/sys/sparc64/sparc64/trap.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/sparc64/sparc64/trap.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -538,7 +538,6 @@ syscall(struct trapframe *tf)
 	register_t *argp;
 	struct proc *p;
 	u_long code;
-	u_long tpc;
 	int reg;
 	int regcnt;
 	int narg;
@@ -562,7 +561,7 @@ syscall(struct trapframe *tf)
 	 * For syscalls, we don't want to retry the faulting instruction
 	 * (usually), instead we need to advance one instruction.
 	 */
-	tpc = tf->tf_tpc;
+	td->td_pcb->pcb_tpc = tf->tf_tpc;
 	TF_DONE(tf);
 
 	reg = 0;
@@ -626,39 +625,7 @@ syscall(struct trapframe *tf)
 		    td->td_retval[1]);
 	}
 
-	/*
-	 * MP SAFE (we may or may not have the MP lock at this point)
-	 */
-	switch (error) {
-	case 0:
-		tf->tf_out[0] = td->td_retval[0];
-		tf->tf_out[1] = td->td_retval[1];
-		tf->tf_tstate &= ~TSTATE_XCC_C;
-		break;
-
-	case ERESTART:
-		/*
-		 * Undo the tpc advancement we have done above, we want to
-		 * reexecute the system call.
-		 */
-		tf->tf_tpc = tpc;
-		tf->tf_tnpc -= 4;
-		break;
-
-	case EJUSTRETURN:
-		break;
-
-	default:
-		if (p->p_sysent->sv_errsize) {
-			if (error >= p->p_sysent->sv_errsize)
-				error = -1;	/* XXX */
-			else
-				error = p->p_sysent->sv_errtbl[error];
-		}
-		tf->tf_out[0] = error;
-		tf->tf_tstate |= TSTATE_XCC_C;
-		break;
-	}
+	cpu_set_syscall_retval(td, error);
 
 	/*
 	 * Check for misbehavior.

Modified: head/sys/sparc64/sparc64/vm_machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/vm_machdep.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/sparc64/sparc64/vm_machdep.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -166,6 +167,42 @@ cpu_thread_swapout(struct thread *td)
 }
 
 void
+cpu_set_syscall_retval(struct thread *td, int error)
+{
+
+	switch (error) {
+	case 0:
+		td->td_frame->tf_out[0] = td->td_retval[0];
+		td->td_frame->tf_out[1] = td->td_retval[1];
+		td->td_frame->tf_tstate &= ~TSTATE_XCC_C;
+		break;
+
+	case ERESTART:
+		/*
+		 * Undo the tpc advancement we have done on syscall
+		 * enter, we want to reexecute the system call.
+		 */
+		td->td_frame->tf_tpc = td->td_pcb->pcb_tpc;
+		td->td_frame->tf_tnpc -= 4;
+		break;
+
+	case EJUSTRETURN:
+		break;
+
+	default:
+		if (td->td_proc->p_sysent->sv_errsize) {
+			if (error >= td->td_proc->p_sysent->sv_errsize)
+				error = -1;	/* XXX */
+			else
+				error = td->td_proc->p_sysent->sv_errtbl[error];
+		}
+		td->td_frame->tf_out[0] = error;
+		td->td_frame->tf_tstate |= TSTATE_XCC_C;
+		break;
+	}
+}
+
+void
 cpu_set_upcall(struct thread *td, struct thread *td0)
 {
 	struct trapframe *tf;

Modified: head/sys/sun4v/sun4v/trap.c
==============================================================================
--- head/sys/sun4v/sun4v/trap.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/sun4v/sun4v/trap.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -81,6 +81,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -582,7 +583,6 @@ syscall(struct trapframe *tf)
 	register_t *argp;
 	struct proc *p;
 	u_long code;
-	u_long tpc;
 	int reg;
 	int regcnt;
 	int narg;
@@ -606,7 +606,7 @@ syscall(struct trapframe *tf)
 	 * For syscalls, we don't want to retry the faulting instruction
 	 * (usually), instead we need to advance one instruction.
 	 */
-	tpc = tf->tf_tpc;
+	td->td_pcb->pcb_tpc = tf->tf_tpc;
 	TF_DONE(tf);
 
 	reg = 0;
@@ -673,40 +673,8 @@ syscall(struct trapframe *tf)
 		    error, syscallnames[code], td->td_retval[0],
 		    td->td_retval[1]);
 	}
-	
-	/*
-	 * MP SAFE (we may or may not have the MP lock at this point)
-	 */
-	switch (error) {
-	case 0:
-		tf->tf_out[0] = td->td_retval[0];
-		tf->tf_out[1] = td->td_retval[1];
-		tf->tf_tstate &= ~TSTATE_XCC_C;
-		break;
 
-	case ERESTART:
-		/*
-		 * Undo the tpc advancement we have done above, we want to
-		 * reexecute the system call.
-		 */
-		tf->tf_tpc = tpc;
-		tf->tf_tnpc -= 4;
-		break;
-
-	case EJUSTRETURN:
-		break;
-
-	default:
- 		if (p->p_sysent->sv_errsize) {
- 			if (error >= p->p_sysent->sv_errsize)
-  				error = -1;	/* XXX */
-   			else
-  				error = p->p_sysent->sv_errtbl[error];
-		}
-		tf->tf_out[0] = error;
-		tf->tf_tstate |= TSTATE_XCC_C;
-		break;
-	}
+	cpu_set_syscall_retval(td, error);
 
 	/*
 	 * Handle reschedule and other end-of-syscall issues

Modified: head/sys/sun4v/sun4v/vm_machdep.c
==============================================================================
--- head/sys/sun4v/sun4v/vm_machdep.c	Tue Nov 10 10:42:48 2009	(r199134)
+++ head/sys/sun4v/sun4v/vm_machdep.c	Tue Nov 10 11:43:07 2009	(r199135)
@@ -57,6 +57,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -142,6 +143,42 @@ cpu_thread_swapout(struct thread *td)
 }
 
 void
+cpu_set_syscall_retval(struct thread *td, int error)
+{
+
+	switch (error) {
+	case 0:
+		td->td_frame->tf_out[0] = td->td_retval[0];
+		td->td_frame->tf_out[1] = td->td_retval[1];
+		td->td_frame->tf_tstate &= ~TSTATE_XCC_C;
+		break;
+
+	case ERESTART:
+		/*
+		 * Undo the tpc advancement we have done on syscall
+		 * enter, we want to reexecute the system call.
+		 */
+		td->td_frame->tf_tpc = td->td_pcb->pcb_tpc;
+		td->td_frame->tf_tnpc -= 4;
+		break;
+
+	case EJUSTRETURN:
+		break;
+
+	default:
+		if (td->td_proc->p_sysent->sv_errsize) {
+			if (error >= td->td_proc->p_sysent->sv_errsize)
+				error = -1;	/* XXX */
+			else
+				error = td->td_proc->p_sysent->sv_errtbl[error];
+		}
+		td->td_frame->tf_out[0] = error;
+		td->td_frame->tf_tstate |= TSTATE_XCC_C;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
From kib at FreeBSD.org  Tue Nov 10 11:46:55 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Tue Nov 10 11:47:01 2009
Subject: svn commit: r199136 - in head/sys: kern sys
Message-ID: <200911101146.nAABksqs058013@svn.freebsd.org>

Author: kib
Date: Tue Nov 10 11:46:53 2009
New Revision: 199136
URL: http://svn.freebsd.org/changeset/base/199136

Log:
  In r198506, kern_sigsuspend() started doing cursig/postsig loop to make
  sure that a signal was delivered to the thread before returning from
  syscall. Signal delivery puts new return frame on the user stack, and
  modifies trap frame to enter signal handler. As a consequence, syscall
  return code sets EINTR as error return for signal frame, instead of the
  syscall return.
  
  Also, for ia64, due to different registers layout for those two kind of
  frames, usermode sigsegfaulted when returned from signal handler.
  
  Use newly-introduced cpu_set_syscall_retval(9) to set syscall result,
  and return EJUSTRETURN from kern_sigsuspend() to prevent syscall return
  code from modifying this frame [1].
  
  Another issue is that pending SIGCONT might be cancelled by SIGSTOP,
  causing postsig() not to deliver any catched signal [2]. Modify
  postsig() to return 1 if signal was posted, and 0 otherwise, and use
  this in the kern_sigsuspend loop.
  
  Proposed by:	marcel [1]
  Noted by:	davidxu [2]
  Reviewed by:	marcel, davidxu
  MFC after:	1 month

Modified:
  head/sys/kern/kern_sig.c
  head/sys/sys/signalvar.h

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Tue Nov 10 11:43:07 2009	(r199135)
+++ head/sys/kern/kern_sig.c	Tue Nov 10 11:46:53 2009	(r199136)
@@ -1471,21 +1471,19 @@ kern_sigsuspend(struct thread *td, sigse
 	 * thread. But sigsuspend should return only on signal
 	 * delivery.
 	 */
+	cpu_set_syscall_retval(td, EINTR);
 	for (has_sig = 0; !has_sig;) {
 		while (msleep(&p->p_sigacts, &p->p_mtx, PPAUSE|PCATCH, "pause",
 			0) == 0)
 			/* void */;
 		thread_suspend_check(0);
 		mtx_lock(&p->p_sigacts->ps_mtx);
-		while ((sig = cursig(td, SIG_STOP_ALLOWED)) != 0) {
-			postsig(sig);
-			has_sig = 1;
-		}
+		while ((sig = cursig(td, SIG_STOP_ALLOWED)) != 0)
+			has_sig += postsig(sig);
 		mtx_unlock(&p->p_sigacts->ps_mtx);
 	}
 	PROC_UNLOCK(p);
-	/* always return EINTR rather than ERESTART... */
-	return (EINTR);
+	return (EJUSTRETURN);
 }
 
 #ifdef COMPAT_43	/* XXX - COMPAT_FBSD3 */
@@ -2670,7 +2668,7 @@ thread_stopped(struct proc *p)
  * Take the action for the specified signal
  * from the current set of pending signals.
  */
-void
+int
 postsig(sig)
 	register int sig;
 {
@@ -2689,7 +2687,7 @@ postsig(sig)
 	ksiginfo_init(&ksi);
 	if (sigqueue_get(&td->td_sigqueue, sig, &ksi) == 0 &&
 	    sigqueue_get(&p->p_sigqueue, sig, &ksi) == 0)
-		return;
+		return (0);
 	ksi.ksi_signo = sig;
 	if (ksi.ksi_code == SI_TIMER)
 		itimer_accept(p, ksi.ksi_timerid, &ksi);
@@ -2757,6 +2755,7 @@ postsig(sig)
 		}
 		(*p->p_sysent->sv_sendsig)(action, &ksi, &returnmask);
 	}
+	return (1);
 }
 
 /*

Modified: head/sys/sys/signalvar.h
==============================================================================
--- head/sys/sys/signalvar.h	Tue Nov 10 11:43:07 2009	(r199135)
+++ head/sys/sys/signalvar.h	Tue Nov 10 11:46:53 2009	(r199136)
@@ -330,7 +330,7 @@ void	gsignal(int pgid, int sig);
 void	killproc(struct proc *p, char *why);
 void	pgsigio(struct sigio **, int signum, int checkctty);
 void	pgsignal(struct pgrp *pgrp, int sig, int checkctty);
-void	postsig(int sig);
+int	postsig(int sig);
 void	psignal(struct proc *p, int sig);
 int	psignal_event(struct proc *p, struct sigevent *, ksiginfo_t *);
 struct sigacts *sigacts_alloc(void);
From kib at FreeBSD.org  Tue Nov 10 11:50:37 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Tue Nov 10 11:50:48 2009
Subject: svn commit: r199137 - head/sys/kern
Message-ID: <200911101150.nAABobP6058139@svn.freebsd.org>

Author: kib
Date: Tue Nov 10 11:50:37 2009
New Revision: 199137
URL: http://svn.freebsd.org/changeset/base/199137

Log:
  When rename("a", "b/.") is performed, target namei() call returns
  dvp == vp. Rename syscall does not check for the case, and at least
  ufs_rename() cannot deal with it. POSIX explicitely requires that both
  rename(2) and rmdir(2) return EINVAL when any of the pathes end in "/.".
  
  Detect the slashdot lookup for RENAME or REMOVE in lookup(), and return
  EINVAL.
  
  Reported by:	Jim Meyering 
  Tested by:	simon, pho
  MFC after:	1 week

Modified:
  head/sys/kern/vfs_lookup.c

Modified: head/sys/kern/vfs_lookup.c
==============================================================================
--- head/sys/kern/vfs_lookup.c	Tue Nov 10 11:46:53 2009	(r199136)
+++ head/sys/kern/vfs_lookup.c	Tue Nov 10 11:50:37 2009	(r199137)
@@ -552,6 +552,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 rpaulo at freebsd.org  Tue Nov 10 12:08:51 2009
From: rpaulo at freebsd.org (Rui Paulo)
Date: Tue Nov 10 12:09:29 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <7mvdhigb96.wl%kuriyama@s2factory.co.jp>
References: <200911090254.nA92sG1G005921@svn.freebsd.org>
	<20091109225244.GB64905@hoeg.nl>
	<7mbpjbgt0n.wl%kuriyama@s2factory.co.jp>
	<20091110055910.GC64905@hoeg.nl>
	<7mvdhigb96.wl%kuriyama@s2factory.co.jp>
Message-ID: <38E7F3F6-0660-43BF-B3A9-8E62E337BE78@freebsd.org>

On 10 Nov 2009, at 06:11, Jun Kuriyama wrote:
> Hmm, I think Boot Camp is not hypervisor, and should be treated as
> real hardware.

Correct.

--
Rui Paulo

From jhb at FreeBSD.org  Tue Nov 10 14:32:10 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue Nov 10 14:32:16 2009
Subject: svn commit: r199141 - in head: tools/regression/usr.bin/pkill
	tools/tools/termcap usr.sbin/dumpcis
Message-ID: <200911101432.nAAEWATF062105@svn.freebsd.org>

Author: jhb
Date: Tue Nov 10 14:32:09 2009
New Revision: 199141
URL: http://svn.freebsd.org/changeset/base/199141

Log:
  Purge some useless mergeinfo.

Modified:
Directory Properties:
  head/tools/regression/usr.bin/pkill/pgrep-_g.t   (props changed)
  head/tools/regression/usr.bin/pkill/pgrep-_s.t   (props changed)
  head/tools/regression/usr.bin/pkill/pkill-_g.t   (props changed)
  head/tools/tools/termcap/termcap.pl   (props changed)
  head/usr.sbin/dumpcis/cardinfo.h   (props changed)
  head/usr.sbin/dumpcis/cis.h   (props changed)
From ed at 80386.nl  Tue Nov 10 16:03:01 2009
From: ed at 80386.nl (Ed Schouten)
Date: Tue Nov 10 16:03:13 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <7mvdhigb96.wl%kuriyama@s2factory.co.jp>
References: <200911090254.nA92sG1G005921@svn.freebsd.org>
	<20091109225244.GB64905@hoeg.nl>
	<7mbpjbgt0n.wl%kuriyama@s2factory.co.jp>
	<20091110055910.GC64905@hoeg.nl>
	<7mvdhigb96.wl%kuriyama@s2factory.co.jp>
Message-ID: <20091110160300.GD64905@hoeg.nl>

Hi Jun,

* Jun Kuriyama  wrote:
> You can try with hw.clflush_disable="1" in loader.conf.  If you can
> boot with it, I must be mistaken something (anyway its my fault).

For some reason that switch doesn't seem to have any effect. Reverting the
patch makes my system boot again.

> Can you show me CPUID line at boot message (of course from the kernel
> you can boot) like this?

Sure. These two systems seem to lock up:

Apple MacBook3,1:

| CPU: Intel(R) Core(TM)2 Duo CPU     T7500  @ 2.20GHz (2194.52-MHz K8-class CPU)
|   Origin = "GenuineIntel"  Id = 0x6fb  Stepping = 11
|   Features=0xbfebfbff
|   Features2=0xe3bd
|   AMD Features=0x20100800
|   AMD Features2=0x1
|   TSC: P-state invariant

Dell SC440:

| CPU: Intel(R) Pentium(R) Dual  CPU  E2160  @ 1.80GHz (1795.51-MHz K8-class CPU)
|   Origin = "GenuineIntel"  Id = 0x6fd  Stepping = 13
|   Features=0xbfebfbff
|   Features2=0xe39d
|   AMD Features=0x20100800
|   AMD Features2=0x1
|   TSC: P-state invariant

-- 
 Ed Schouten 
 WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091110/61009fec/attachment.pgp
From xcllnt at mac.com  Tue Nov 10 16:38:34 2009
From: xcllnt at mac.com (Marcel Moolenaar)
Date: Tue Nov 10 16:38:40 2009
Subject: svn commit: r199136 - in head/sys: kern sys
In-Reply-To: <200911101146.nAABksqs058013@svn.freebsd.org>
References: <200911101146.nAABksqs058013@svn.freebsd.org>
Message-ID: <87148C88-A068-4512-845C-F72FE190F4B5@mac.com>


On Nov 10, 2009, at 3:46 AM, Konstantin Belousov wrote:

>  Also, for ia64, due to different registers layout for those two kind of
>  frames, usermode sigsegfaulted when returned from signal handler.

Actually, the problem was caused by sigsuspend() returning EINTR,
which causes the trapframe to be updated with the error code and
thereby clobbering the same registers in the trapframe that are
used for hand-off to the signal handler. The kernel was jumping
to the signal handler at address 4 (=EINTR).

In any case: thanks for your exemplary co-operation in resolving
the issue!

-- 
Marcel Moolenaar
xcllnt@mac.com



From imp at bsdimp.com  Tue Nov 10 16:45:24 2009
From: imp at bsdimp.com (M. Warner Losh)
Date: Tue Nov 10 16:45:35 2009
Subject: svn commit: r199079 - head/sbin/camcontrol
In-Reply-To: <4AF85D75.1010605@freebsd.org>
References: <200911091139.nA9BdpAU019880@svn.freebsd.org>
	<4AF85D75.1010605@freebsd.org>
Message-ID: <20091110.093956.2069119515.imp@bsdimp.com>

In message: <4AF85D75.1010605@freebsd.org>
            Nathan Whitehorn  writes:
: Alexander Motin wrote:
: > Author: mav
: > Date: Mon Nov  9 11:39:51 2009
: > New Revision: 199079
: > URL: http://svn.freebsd.org/changeset/base/199079
: >
: > Log:
: >   Add support for ATA Power Management.
: >
: > Modified:
: >   head/sbin/camcontrol/camcontrol.8
: >   head/sbin/camcontrol/camcontrol.c
: >   
: [...]
: > +static int
: > +atapm(struct cam_device *device, int argc, char **argv,
: > +		 char *combinedopt, int retry_count, int timeout)
: > +{
: > +	union ccb *ccb;
: > +	int retval = 0;
: > +	int t = -1;
: > +	char c;
: >
: >   
: [...]
: > +
: > +	while ((c = getopt(argc, argv, combinedopt)) != -1) {
: > +		switch (c) {
: > +		case 't':
: > +			t = atoi(optarg);
: > +			break;
: > +		default:
: > +			break;
: > +		}
: > +	}
: This broke world on PowerPC, where char is unsigned. Could you change 
: the type of c to int, or explicitly mark it signed?

Since it is the result of getopt, it must be int.  It can't be signed
char.

Warner
From nwhitehorn at FreeBSD.org  Tue Nov 10 19:14:06 2009
From: nwhitehorn at FreeBSD.org (Nathan Whitehorn)
Date: Tue Nov 10 19:14:19 2009
Subject: svn commit: r199151 - head/sys/dev/usb/input
Message-ID: <200911101914.nAAJE6RW069109@svn.freebsd.org>

Author: nwhitehorn
Date: Tue Nov 10 19:14:06 2009
New Revision: 199151
URL: http://svn.freebsd.org/changeset/base/199151

Log:
  Add support for the touchpads found in later models of iBook and
  Powerbook.
  
  Reviewed by:	Rohit Grover 

Modified:
  head/sys/dev/usb/input/atp.c

Modified: head/sys/dev/usb/input/atp.c
==============================================================================
--- head/sys/dev/usb/input/atp.c	Tue Nov 10 17:45:54 2009	(r199150)
+++ head/sys/dev/usb/input/atp.c	Tue Nov 10 19:14:06 2009	(r199151)
@@ -193,21 +193,50 @@ SYSCTL_UINT(_hw_usb_atp, OID_AUTO, pspan
     &atp_pspan_max_width, 4,
     "maximum allowed width (in sensors) for pressure-spans");
 
+/* We support three payload protocols */
+typedef enum {
+	ATP_PROT_GEYSER1,
+	ATP_PROT_GEYSER2,
+	ATP_PROT_GEYSER3,
+} atp_protocol;
 
 /* Define the various flavours of devices supported by this driver. */
 enum {
 	ATP_DEV_PARAMS_0,
+	ATP_DEV_PARAMS_PBOOK,
+	ATP_DEV_PARAMS_PBOOK_15A,
+	ATP_DEV_PARAMS_PBOOK_17,
 	ATP_N_DEV_PARAMS
 };
 struct atp_dev_params {
 	u_int            data_len;   /* for sensor data */
 	u_int            n_xsensors;
 	u_int            n_ysensors;
+	atp_protocol     prot;
 } atp_dev_params[ATP_N_DEV_PARAMS] = {
 	[ATP_DEV_PARAMS_0] = {
 		.data_len   = 64,
 		.n_xsensors = 20,
-		.n_ysensors = 10
+		.n_ysensors = 10,
+		.prot       = ATP_PROT_GEYSER3
+	},
+	[ATP_DEV_PARAMS_PBOOK] = {
+		.data_len   = 81,
+		.n_xsensors = 16,
+		.n_ysensors = 16,
+		.prot       = ATP_PROT_GEYSER1
+	},
+	[ATP_DEV_PARAMS_PBOOK_15A] = {
+		.data_len   = 64,
+		.n_xsensors = 15,
+		.n_ysensors = 9,
+		.prot       = ATP_PROT_GEYSER2
+	},
+	[ATP_DEV_PARAMS_PBOOK_17] = {
+		.data_len   = 81,
+		.n_xsensors = 26,
+		.n_ysensors = 16,
+		.prot       = ATP_PROT_GEYSER1
 	},
 };
 
@@ -226,6 +255,19 @@ static const struct usb_device_id atp_de
 	{ USB_VPI(USB_VENDOR_APPLE, 0x0229, ATP_DEV_PARAMS_0) },
 	{ USB_VPI(USB_VENDOR_APPLE, 0x022a, ATP_DEV_PARAMS_0) },
 	{ USB_VPI(USB_VENDOR_APPLE, 0x022b, ATP_DEV_PARAMS_0) },
+
+	/* 12 inch PowerBook and iBook */
+	{ USB_VPI(USB_VENDOR_APPLE, 0x030a, ATP_DEV_PARAMS_PBOOK) },
+	{ USB_VPI(USB_VENDOR_APPLE, 0x030b, ATP_DEV_PARAMS_PBOOK) },
+
+	/* 15 inch PowerBook */
+	{ USB_VPI(USB_VENDOR_APPLE, 0x020e, ATP_DEV_PARAMS_PBOOK) },
+	{ USB_VPI(USB_VENDOR_APPLE, 0x020f, ATP_DEV_PARAMS_PBOOK) },
+	{ USB_VPI(USB_VENDOR_APPLE, 0x0215, ATP_DEV_PARAMS_PBOOK_15A) },
+
+	/* 17 inch PowerBook */
+	{ USB_VPI(USB_VENDOR_APPLE, 0x020d, ATP_DEV_PARAMS_PBOOK_17) },
+
 };
 
 /*
@@ -321,6 +363,7 @@ struct atp_softc {
 #define ATP_ENABLED            0x01
 #define ATP_ZOMBIES_EXIST      0x02
 #define ATP_DOUBLE_TAP_DRAG    0x04
+#define ATP_VALID              0x08
 
 	u_int                  sc_left_margin;
 	u_int                  sc_right_margin;
@@ -384,8 +427,8 @@ static int           atp_softc_populate(
 static void          atp_softc_unpopulate(struct atp_softc *);
 
 /* sensor interpretation */
-static __inline void atp_interpret_sensor_data(const int8_t *, u_int, u_int,
-			 int *);
+static __inline void atp_interpret_sensor_data(const int8_t *, u_int, atp_axis,
+			 int *, atp_protocol);
 static __inline void atp_get_pressures(int *, const int *, const int *, int);
 static void          atp_detect_pspans(int *, u_int, u_int, atp_pspan *,
 			 u_int *);
@@ -483,7 +526,7 @@ atp_disable(struct atp_softc *sc)
 {
 	atp_softc_unpopulate(sc);
 
-	sc->sc_state &= ~ATP_ENABLED;
+	sc->sc_state &= ~(ATP_ENABLED | ATP_VALID);
 	DPRINTFN(ATP_LLEVEL_INFO, "disabled atp\n");
 }
 
@@ -623,25 +666,42 @@ atp_softc_unpopulate(struct atp_softc *s
  *       raw sensor data from the USB packet.
  *   num
  *       The number of elements in the array 'arr'.
- *   di_start
- *       The index of the first data element to be interpreted for
- *       this sensor array--i.e. when called to interpret the Y
- *       sensors, di_start passed in as 2, which is the index of Y1 in
- *       the raw data.
+ *   axis
+ *       Axis of data to fetch
  *   arr
  *       The array to be initialized with the readings.
+ *   prot
+ *       The protocol to use to interpret the data
  */
 static __inline void
-atp_interpret_sensor_data(const int8_t *sensor_data, u_int num, u_int di_start,
-    int	*arr)
+atp_interpret_sensor_data(const int8_t *sensor_data, u_int num, atp_axis axis,
+    int	*arr, atp_protocol prot)
 {
 	u_int i;
 	u_int di;   /* index into sensor data */
 
-	for (i = 0, di = di_start; i < num; /* empty */ ) {
-		arr[i++] = sensor_data[di++];
-		arr[i++] = sensor_data[di++];
-		di++;
+	switch (prot) {
+	case ATP_PROT_GEYSER1:
+		/*
+		 * For Geyser 1, the sensors are laid out in pairs
+		 * every 5 bytes.
+		 */
+		for (i = 0, di = (axis == Y) ? 1 : 2; i < 8; di += 5, i++) {
+			arr[i] = sensor_data[di];
+			arr[i+8] = sensor_data[di+2];
+			if (axis == X && num > 16) 
+				arr[i+16] = sensor_data[di+40];
+		}
+
+		break;
+	case ATP_PROT_GEYSER2:
+	case ATP_PROT_GEYSER3:
+		for (i = 0, di = (axis == Y) ? 2 : 20; i < num; /* empty */ ) {
+			arr[i++] = sensor_data[di++];
+			arr[i++] = sensor_data[di++];
+			di++;
+		}
+		break;
 	}
 }
 
@@ -1613,7 +1673,7 @@ atp_intr(struct usb_xfer *xfer, usb_erro
 			    len, sc->sc_params->data_len);
 			len = sc->sc_params->data_len;
 		}
-		if (len == 0)
+		if (len < sc->sc_params->data_len)
 			goto tr_setup;
 
 		pc = usbd_xfer_get_frame(xfer, 0);
@@ -1621,9 +1681,11 @@ atp_intr(struct usb_xfer *xfer, usb_erro
 
 		/* Interpret sensor data */
 		atp_interpret_sensor_data(sc->sensor_data,
-		    sc->sc_params->n_xsensors, 20, sc->cur_x);
+		    sc->sc_params->n_xsensors, X, sc->cur_x,
+		    sc->sc_params->prot);
 		atp_interpret_sensor_data(sc->sensor_data,
-		    sc->sc_params->n_ysensors, 2,  sc->cur_y);
+		    sc->sc_params->n_ysensors, Y,  sc->cur_y,
+		    sc->sc_params->prot);
 
 		/*
 		 * If this is the initial update (from an untouched
@@ -1632,11 +1694,14 @@ atp_intr(struct usb_xfer *xfer, usb_erro
 		 * be used as pressure readings subsequently.
 		 */
 		status_bits = sc->sensor_data[sc->sc_params->data_len - 1];
-		if (status_bits & ATP_STATUS_BASE_UPDATE) {
+		if ((sc->sc_params->prot == ATP_PROT_GEYSER3 &&
+		    (status_bits & ATP_STATUS_BASE_UPDATE)) || 
+		    !(sc->sc_state & ATP_VALID)) {
 			memcpy(sc->base_x, sc->cur_x,
 			    sc->sc_params->n_xsensors * sizeof(*(sc->base_x)));
 			memcpy(sc->base_y, sc->cur_y,
 			    sc->sc_params->n_ysensors * sizeof(*(sc->base_y)));
+			sc->sc_state |= ATP_VALID;
 			goto tr_setup;
 		}
 
@@ -1757,8 +1822,11 @@ atp_intr(struct usb_xfer *xfer, usb_erro
 			sc->sc_idlecount++;
 			if (sc->sc_idlecount >= ATP_IDLENESS_THRESHOLD) {
 				DPRINTFN(ATP_LLEVEL_INFO, "idle\n");
-				atp_set_device_mode(sc->sc_dev,RAW_SENSOR_MODE);
 				sc->sc_idlecount = 0;
+
+				mtx_unlock(&sc->sc_mutex);
+				atp_set_device_mode(sc->sc_dev,RAW_SENSOR_MODE);
+				mtx_lock(&sc->sc_mutex);
 			}
 		} else {
 			sc->sc_idlecount = 0;
@@ -1770,7 +1838,7 @@ atp_intr(struct usb_xfer *xfer, usb_erro
 		if (usb_fifo_put_bytes_max(
 			    sc->sc_fifo.fp[USB_FIFO_RX]) != 0) {
 			usbd_xfer_set_frame_len(xfer, 0,
-			    usbd_xfer_max_len(xfer));
+			    sc->sc_params->data_len);
 			usbd_transfer_submit(xfer);
 		}
 		break;
From dougb at FreeBSD.org  Tue Nov 10 19:50:29 2009
From: dougb at FreeBSD.org (Doug Barton)
Date: Tue Nov 10 19:50:41 2009
Subject: svn commit: r199152 - head/share/man/man5
Message-ID: <200911101950.nAAJoSVL069980@svn.freebsd.org>

Author: dougb
Date: Tue Nov 10 19:50:28 2009
New Revision: 199152
URL: http://svn.freebsd.org/changeset/base/199152

Log:
  s/a default/the default/
  
  Submitted by:	remko

Modified:
  head/share/man/man5/rc.conf.5

Modified: head/share/man/man5/rc.conf.5
==============================================================================
--- head/share/man/man5/rc.conf.5	Tue Nov 10 19:14:06 2009	(r199151)
+++ head/share/man/man5/rc.conf.5	Tue Nov 10 19:50:28 2009	(r199152)
@@ -352,7 +352,7 @@ If
 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 a default hostname of
+your console login will display the default hostname of
 .Dq Amnesiac.
 .It Va nisdomainname
 .Pq Vt str
From yongari at FreeBSD.org  Tue Nov 10 20:29:21 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Tue Nov 10 20:29:51 2009
Subject: svn commit: r199153 - head/sys/dev/bge
Message-ID: <200911102029.nAAKTKI3070783@svn.freebsd.org>

Author: yongari
Date: Tue Nov 10 20:29:20 2009
New Revision: 199153
URL: http://svn.freebsd.org/changeset/base/199153

Log:
  Controller does not update Tx descriptors(send BDs) after sending
  frames so remove unnecessary BUS_DMASYNC_PREREAD and
  BUS_DMASYNC_POSTREAD of bus_dmamap_sync(9).

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Tue Nov 10 19:50:28 2009	(r199152)
+++ head/sys/dev/bge/if_bge.c	Tue Nov 10 20:29:20 2009	(r199153)
@@ -1165,8 +1165,7 @@ bge_init_tx_ring(struct bge_softc *sc)
 
 	bzero(sc->bge_ldata.bge_tx_ring, BGE_TX_RING_SZ);
 	bus_dmamap_sync(sc->bge_cdata.bge_tx_ring_tag,
-	    sc->bge_cdata.bge_tx_ring_map,
-	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+	    sc->bge_cdata.bge_tx_ring_map, BUS_DMASYNC_PREWRITE);
 
 	/* Initialize transmit producer index for host-memory send ring. */
 	sc->bge_tx_prodidx = 0;
@@ -3323,8 +3322,7 @@ bge_txeof(struct bge_softc *sc)
 	ifp = sc->bge_ifp;
 
 	bus_dmamap_sync(sc->bge_cdata.bge_tx_ring_tag,
-	    sc->bge_cdata.bge_tx_ring_map,
-	    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+	    sc->bge_cdata.bge_tx_ring_map, BUS_DMASYNC_POSTWRITE);
 	/*
 	 * Go through our tx ring and free mbufs for those
 	 * frames that have been sent.
@@ -3834,8 +3832,7 @@ bge_start_locked(struct ifnet *ifp)
 		return;
 
 	bus_dmamap_sync(sc->bge_cdata.bge_tx_ring_tag,
-	    sc->bge_cdata.bge_tx_ring_map,
-	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+	    sc->bge_cdata.bge_tx_ring_map, BUS_DMASYNC_PREWRITE);
 	/* Transmit. */
 	bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx);
 	/* 5700 b2 errata */
From jhb at FreeBSD.org  Tue Nov 10 22:04:20 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue Nov 10 22:04:32 2009
Subject: svn commit: r199154 - head/sys/dev/an
Message-ID: <200911102204.nAAM4KgB072959@svn.freebsd.org>

Author: jhb
Date: Tue Nov 10 22:04:19 2009
New Revision: 199154
URL: http://svn.freebsd.org/changeset/base/199154

Log:
  - Locking fixes to not do silly things like drop the lock only to call a
    function that immediately reacquires the lock.  Also removes recursive
    locking.
  - Use the statistics timer to drive the transmit watchdog instead of using
    if_watchdog and if_timer.
  
  Tested by:	gavin

Modified:
  head/sys/dev/an/if_an.c
  head/sys/dev/an/if_anreg.h

Modified: head/sys/dev/an/if_an.c
==============================================================================
--- head/sys/dev/an/if_an.c	Tue Nov 10 20:29:20 2009	(r199153)
+++ head/sys/dev/an/if_an.c	Tue Nov 10 22:04:19 2009	(r199154)
@@ -140,9 +140,11 @@ static void an_reset(struct an_softc *);
 static int an_init_mpi350_desc(struct an_softc *);
 static int an_ioctl(struct ifnet *, u_long, caddr_t);
 static void an_init(void *);
+static void an_init_locked(struct an_softc *);
 static int an_init_tx_ring(struct an_softc *);
 static void an_start(struct ifnet *);
-static void an_watchdog(struct ifnet *);
+static void an_start_locked(struct ifnet *);
+static void an_watchdog(struct an_softc *);
 static void an_rxeof(struct an_softc *);
 static void an_txeof(struct an_softc *, int);
 
@@ -314,7 +316,7 @@ an_pci_probe(device_t dev)
 	struct an_softc *sc = device_get_softc(dev);
 
 	mtx_init(&sc->an_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
-	    MTX_DEF | MTX_RECURSE);
+	    MTX_DEF);
 
 	return(0);
 }
@@ -359,7 +361,7 @@ an_probe(device_t dev)
 	CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), 0xFFFF);
 
 	mtx_init(&sc->an_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
-	    MTX_DEF | MTX_RECURSE);
+	    MTX_DEF);
 	AN_LOCK(sc);
 	an_reset(sc);
 
@@ -766,7 +768,6 @@ an_attach(struct an_softc *sc, int flags
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = an_ioctl;
 	ifp->if_start = an_start;
-	ifp->if_watchdog = an_watchdog;
 	ifp->if_init = an_init;
 	ifp->if_baudrate = 10000000;
 	IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
@@ -1130,7 +1131,7 @@ an_txeof(struct an_softc *sc, int status
 	AN_LOCK_ASSERT(sc);
 	ifp = sc->an_ifp;
 
-	ifp->if_timer = 0;
+	sc->an_timer = 0;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 
 	if (!sc->mpi350) {
@@ -1183,6 +1184,8 @@ an_stats_update(void *xsc)
 	sc = xsc;
 	AN_LOCK_ASSERT(sc);
 	ifp = sc->an_ifp;
+	if (sc->an_timer > 0 && --sc->an_timer == 0)
+		an_watchdog(sc);
 
 	sc->an_status.an_type = AN_RID_STATUS;
 	sc->an_status.an_len = sizeof(struct an_ltv_status);
@@ -1274,7 +1277,7 @@ an_intr(void *xsc)
 	CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), AN_INTRS(sc->mpi350));
 
 	if ((ifp->if_flags & IFF_UP) && !IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-		an_start(ifp);
+		an_start_locked(ifp);
 
 	AN_UNLOCK(sc);
 
@@ -1825,9 +1828,7 @@ an_setdef(struct an_softc *sc, struct an
 	case AN_RID_WEP_PERM:
 	case AN_RID_LEAPUSERNAME:
 	case AN_RID_LEAPPASSWORD:
-		AN_UNLOCK(sc);
-		an_init(sc);
-		AN_LOCK(sc);
+		an_init_locked(sc);
 
 		/* Disable the MAC. */
 		an_cmd(sc, AN_CMD_DISABLE, 0);
@@ -1868,11 +1869,8 @@ an_setdef(struct an_softc *sc, struct an
 
 
 	/* Reinitialize the card. */
-	if (ifp->if_flags) {
-		AN_UNLOCK(sc);
-		an_init(sc);
-		AN_LOCK(sc);
-	}
+	if (ifp->if_flags)
+		an_init_locked(sc);
 
 	return;
 }
@@ -1890,11 +1888,8 @@ an_promisc(struct an_softc *sc, int prom
 		if (sc->mpi350)
 			an_init_mpi350_desc(sc);
 	}
-	if (sc->an_monitor || sc->an_was_monitor) {
-		AN_UNLOCK(sc);
-		an_init(sc);
-		AN_LOCK(sc);
-	}
+	if (sc->an_monitor || sc->an_was_monitor)
+		an_init_locked(sc);
 
 	sc->an_was_monitor = sc->an_monitor;
 	an_cmd(sc, AN_CMD_SET_MODE, promisc ? 0xffff : 0);
@@ -1948,20 +1943,14 @@ an_ioctl(struct ifnet *ifp, u_long comma
 			    !(ifp->if_flags & IFF_PROMISC) &&
 			    sc->an_if_flags & IFF_PROMISC) {
 				an_promisc(sc, 0);
-			} else {
-				AN_UNLOCK(sc);
-				an_init(sc);
-				AN_LOCK(sc);
-			}
+			} else
+				an_init_locked(sc);
 		} else {
-			if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-				AN_UNLOCK(sc);
+			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
 				an_stop(sc);
-				AN_LOCK(sc);
-			}
 		}
-		AN_UNLOCK(sc);
 		sc->an_if_flags = ifp->if_flags;
+		AN_UNLOCK(sc);
 		error = 0;
 		break;
 	case SIOCSIFMEDIA:
@@ -2485,7 +2474,6 @@ an_ioctl(struct ifnet *ifp, u_long comma
 				AN_UNLOCK(sc);
 				break;
 			}
-			AN_UNLOCK(sc);
 			if (ireq->i_val ==  4) {
 				config->an_home_product |= AN_HOME_NETWORK;
 				ireq->i_val = 0;
@@ -2497,10 +2485,9 @@ an_ioctl(struct ifnet *ifp, u_long comma
 				= config->an_home_product;
 
 			/* update configuration */
-			an_init(sc);
+			an_init_locked(sc);
 
 			bzero(&sc->areq, sizeof(struct an_ltv_key));
-			AN_LOCK(sc);
 			sc->areq.an_len = sizeof(struct an_ltv_key);
 			sc->areq.an_type = AN_RID_WEP_PERM;
 			key->kindex = 0xffff;
@@ -2583,6 +2570,9 @@ an_ioctl(struct ifnet *ifp, u_long comma
 			an_setdef(sc, &sc->areq);
 			AN_UNLOCK(sc);
 			break;
+		default:
+			AN_UNLOCK(sc);
+			break;
 		}
 
 		/*
@@ -2632,14 +2622,21 @@ static void
 an_init(void *xsc)
 {
 	struct an_softc		*sc = xsc;
-	struct ifnet		*ifp = sc->an_ifp;
 
 	AN_LOCK(sc);
+	an_init_locked(sc);
+	AN_UNLOCK(sc);
+}
 
-	if (sc->an_gone) {
-		AN_UNLOCK(sc);
+static void
+an_init_locked(struct an_softc *sc)
+{
+	struct ifnet *ifp;
+
+	AN_LOCK_ASSERT(sc);
+	ifp = sc->an_ifp;
+	if (sc->an_gone)
 		return;
-	}
 
 	if (ifp->if_drv_flags & IFF_DRV_RUNNING)
 		an_stop(sc);
@@ -2653,7 +2650,6 @@ an_init(void *xsc)
 			an_init_mpi350_desc(sc);
 		if (an_init_tx_ring(sc)) {
 			if_printf(ifp, "tx buffer allocation failed\n");
-			AN_UNLOCK(sc);
 			return;
 		}
 	}
@@ -2694,7 +2690,6 @@ an_init(void *xsc)
 	sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist_new);
 	if (an_write_record(sc, (struct an_ltv_gen *)&sc->an_ssidlist)) {
 		if_printf(ifp, "failed to set ssid list\n");
-		AN_UNLOCK(sc);
 		return;
 	}
 
@@ -2703,7 +2698,6 @@ an_init(void *xsc)
 	sc->an_aplist.an_len = sizeof(struct an_ltv_aplist);
 	if (an_write_record(sc, (struct an_ltv_gen *)&sc->an_aplist)) {
 		if_printf(ifp, "failed to set AP list\n");
-		AN_UNLOCK(sc);
 		return;
 	}
 
@@ -2712,14 +2706,12 @@ an_init(void *xsc)
 	sc->an_config.an_type = AN_RID_GENCONFIG;
 	if (an_write_record(sc, (struct an_ltv_gen *)&sc->an_config)) {
 		if_printf(ifp, "failed to set configuration\n");
-		AN_UNLOCK(sc);
 		return;
 	}
 
 	/* Enable the MAC */
 	if (an_cmd(sc, AN_CMD_ENABLE, 0)) {
 		if_printf(ifp, "failed to enable MAC\n");
-		AN_UNLOCK(sc);
 		return;
 	}
 
@@ -2733,7 +2725,6 @@ an_init(void *xsc)
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 
 	callout_reset(&sc->an_stat_ch, hz, an_stats_update, sc);
-	AN_UNLOCK(sc);
 
 	return;
 }
@@ -2742,6 +2733,17 @@ static void
 an_start(struct ifnet *ifp)
 {
 	struct an_softc		*sc;
+
+	sc = ifp->if_softc;
+	AN_LOCK(sc);
+	an_start_locked(ifp);
+	AN_UNLOCK(sc);
+}
+
+static void
+an_start_locked(struct ifnet *ifp)
+{
+	struct an_softc		*sc;
 	struct mbuf		*m0 = NULL;
 	struct an_txframe_802_3	tx_frame_802_3;
 	struct ether_header	*eh;
@@ -2752,6 +2754,7 @@ an_start(struct ifnet *ifp)
 
 	sc = ifp->if_softc;
 
+	AN_LOCK_ASSERT(sc);
 	if (sc->an_gone)
 		return;
 
@@ -2774,7 +2777,6 @@ an_start(struct ifnet *ifp)
 
 	idx = sc->an_rdata.an_tx_prod;
 
-	AN_LOCK(sc);
 	if (!sc->mpi350) {
 		bzero((char *)&tx_frame_802_3, sizeof(tx_frame_802_3));
 
@@ -2832,7 +2834,7 @@ an_start(struct ifnet *ifp)
 			/*
 			 * Set a timeout in case the chip goes out to lunch.
 			 */
-			ifp->if_timer = 5;
+			sc->an_timer = 5;
 		}
 	} else { /* MPI-350 */
 		/* Disable interrupts. */
@@ -2909,13 +2911,12 @@ an_start(struct ifnet *ifp)
 			/*
 			 * Set a timeout in case the chip goes out to lunch.
 			 */
-			ifp->if_timer = 5;
+			sc->an_timer = 5;
 		}
 
 		/* Re-enable interrupts. */
 		CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), AN_INTRS(sc->mpi350));
 	}
-	AN_UNLOCK(sc);
 
 	if (m0 != NULL)
 		ifp->if_drv_flags |= IFF_DRV_OACTIVE;
@@ -2931,12 +2932,10 @@ an_stop(struct an_softc *sc)
 	struct ifnet		*ifp;
 	int			i;
 
-	AN_LOCK(sc);
+	AN_LOCK_ASSERT(sc);
 
-	if (sc->an_gone) {
-		AN_UNLOCK(sc);
+	if (sc->an_gone)
 		return;
-	}
 
 	ifp = sc->an_ifp;
 
@@ -2955,36 +2954,27 @@ an_stop(struct an_softc *sc)
 		free(sc->an_flash_buffer, M_DEVBUF);
 		sc->an_flash_buffer = NULL;
 	}
-
-	AN_UNLOCK(sc);
-
-	return;
 }
 
 static void
-an_watchdog(struct ifnet *ifp)
+an_watchdog(struct an_softc *sc)
 {
-	struct an_softc		*sc;
+	struct ifnet *ifp;
 
-	sc = ifp->if_softc;
-	AN_LOCK(sc);
+	AN_LOCK_ASSERT(sc);
 
-	if (sc->an_gone) {
-		AN_UNLOCK(sc);
+	if (sc->an_gone)
 		return;
-	}
 
+	ifp = sc->an_ifp;
 	if_printf(ifp, "device timeout\n");
 
 	an_reset(sc);
 	if (sc->mpi350)
 		an_init_mpi350_desc(sc);
-	AN_UNLOCK(sc);
-	an_init(sc);
+	an_init_locked(sc);
 
 	ifp->if_oerrors++;
-
-	return;
 }
 
 int
@@ -2993,10 +2983,12 @@ an_shutdown(device_t dev)
 	struct an_softc		*sc;
 
 	sc = device_get_softc(dev);
+	AN_LOCK(sc);
 	an_stop(sc);
 	sc->an_gone = 1;
+	AN_UNLOCK(sc);
 
-	return 0;
+	return (0);
 }
 
 void
@@ -3014,7 +3006,7 @@ an_resume(device_t dev)
 	an_reset(sc);
 	if (sc->mpi350)
 		an_init_mpi350_desc(sc);
-	an_init(sc);
+	an_init_locked(sc);
 
 	/* Recovery temporary keys */
 	for (i = 0; i < 4; i++) {
@@ -3026,7 +3018,7 @@ an_resume(device_t dev)
 	}
 
 	if (ifp->if_flags & IFF_UP)
-		an_start(ifp);
+		an_start_locked(ifp);
 	AN_UNLOCK(sc);
 
 	return;
@@ -3251,12 +3243,12 @@ an_media_change(struct ifnet *ifp)
 	int otype = sc->an_config.an_opmode;
 	int orate = sc->an_tx_rate;
 
+	AN_LOCK(sc);
 	sc->an_tx_rate = ieee80211_media2rate(
 		IFM_SUBTYPE(sc->an_ifmedia.ifm_cur->ifm_media));
 	if (sc->an_tx_rate < 0)
 		sc->an_tx_rate = 0;
 
-	AN_LOCK(sc);
 	if (orate != sc->an_tx_rate) {
 		/* Read the current configuration */
 		sc->an_config.an_type = AN_RID_GENCONFIG;
@@ -3277,11 +3269,11 @@ an_media_change(struct ifnet *ifp)
 		sc->an_config.an_opmode &= ~AN_OPMODE_INFRASTRUCTURE_STATION;
 	else
 		sc->an_config.an_opmode |= AN_OPMODE_INFRASTRUCTURE_STATION;
-	AN_UNLOCK(sc);
 
 	if (otype != sc->an_config.an_opmode ||
 	    orate != sc->an_tx_rate)
-		an_init(sc);
+		an_init_locked(sc);
+	AN_UNLOCK(sc);
 
 	return(0);
 }
@@ -3302,7 +3294,6 @@ an_media_status(struct ifnet *ifp, struc
 		imr->ifm_active = sc->an_ifmedia.ifm_cur->ifm_media;
 		imr->ifm_status = IFM_AVALID|IFM_ACTIVE;
 	}
-	AN_UNLOCK(sc);
 
 	if (sc->an_tx_rate == 0) {
 		imr->ifm_active = IFM_IEEE80211|IFM_AUTO;
@@ -3315,6 +3306,7 @@ an_media_status(struct ifnet *ifp, struc
 	imr->ifm_status = IFM_AVALID;
 	if (status.an_opmode & AN_STATUS_OPMODE_ASSOCIATED)
 		imr->ifm_status |= IFM_ACTIVE;
+	AN_UNLOCK(sc);
 }
 
 /********************** Cisco utility support routines *************/
@@ -3559,9 +3551,9 @@ cmdreset(struct ifnet *ifp)
 	int		status;
 	struct an_softc	*sc = ifp->if_softc;
 
+	AN_LOCK(sc);
 	an_stop(sc);
 
-	AN_LOCK(sc);
 	an_cmd(sc, AN_CMD_DISABLE, 0);
 
 	if (!(status = WaitBusy(ifp, AN_TIMEOUT))) {
@@ -3749,9 +3741,7 @@ flashrestart(struct ifnet *ifp)
 
 	FLASH_DELAY(sc, 1024);		/* Added 12/7/00 */
 
-	AN_UNLOCK(sc);
-	an_init(sc);
-	AN_LOCK(sc);
+	an_init_locked(sc);
 
 	FLASH_DELAY(sc, 1024);		/* Added 12/7/00 */
 	return status;

Modified: head/sys/dev/an/if_anreg.h
==============================================================================
--- head/sys/dev/an/if_anreg.h	Tue Nov 10 20:29:20 2009	(r199153)
+++ head/sys/dev/an/if_anreg.h	Tue Nov 10 22:04:19 2009	(r199154)
@@ -489,6 +489,7 @@ struct an_softc	{
 	struct ifmedia		an_ifmedia;
 	int		        an_monitor;
 	int		        an_was_monitor;
+	int			an_timer;
 	u_char			buf_802_11[MCLBYTES];
 	struct an_req		areq;
 	unsigned short*		an_flash_buffer;
From jhb at FreeBSD.org  Tue Nov 10 22:07:38 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue Nov 10 22:07:49 2009
Subject: svn commit: r199155 - head/sys/conf
Message-ID: <200911102207.nAAM7bS5073061@svn.freebsd.org>

Author: jhb
Date: Tue Nov 10 22:07:37 2009
New Revision: 199155
URL: http://svn.freebsd.org/changeset/base/199155

Log:
  Add ixgb(4) to NOTES.
  
  Approved by:	jfv

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Tue Nov 10 22:04:19 2009	(r199154)
+++ head/sys/conf/NOTES	Tue Nov 10 22:07:37 2009	(r199155)
@@ -2003,6 +2003,7 @@ device		bwi		# Broadcom BCM430* BCM431*
 device		de		# DEC/Intel DC21x4x (``Tulip'')
 device		em		# Intel Pro/1000 Gigabit Ethernet
 device		igb		# Intel Pro/1000 PCIE Gigabit Ethernet
+device		ixgb		# Intel Pro/10Gbe PCI-X Ethernet
 device		ixgbe		# Intel Pro/10Gbe PCIE Ethernet
 device		le		# AMD Am7900 LANCE and Am79C9xx PCnet
 device		mxge		# Myricom Myri-10G 10GbE NIC
From pjd at FreeBSD.org  Tue Nov 10 22:25:46 2009
From: pjd at FreeBSD.org (Pawel Jakub Dawidek)
Date: Tue Nov 10 22:25:53 2009
Subject: svn commit: r199156 -
	head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID: <200911102225.nAAMPkpP073522@svn.freebsd.org>

Author: pjd
Date: Tue Nov 10 22:25:46 2009
New Revision: 199156
URL: http://svn.freebsd.org/changeset/base/199156

Log:
  Avoid passing invalid mountpoint to getnewvnode().
  
  Reported by:	rwatson
  Tested by:	rwatson
  MFC after:	3 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c	Tue Nov 10 22:07:37 2009	(r199155)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c	Tue Nov 10 22:25:46 2009	(r199156)
@@ -143,16 +143,19 @@ zfs_znode_cache_constructor(void *buf, v
 
 	POINTER_INVALIDATE(&zp->z_zfsvfs);
 	ASSERT(!POINTER_IS_VALID(zp->z_zfsvfs));
-	ASSERT(vfsp != NULL);
 
-	error = getnewvnode("zfs", vfsp, &zfs_vnodeops, &vp);
-	if (error != 0 && (kmflags & KM_NOSLEEP))
-		return (-1);
-	ASSERT(error == 0);
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-	zp->z_vnode = vp;
-	vp->v_data = (caddr_t)zp;
-	VN_LOCK_AREC(vp);
+	if (vfsp != NULL) {
+		error = getnewvnode("zfs", vfsp, &zfs_vnodeops, &vp);
+		if (error != 0 && (kmflags & KM_NOSLEEP))
+			return (-1);
+		ASSERT(error == 0);
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+		zp->z_vnode = vp;
+		vp->v_data = (caddr_t)zp;
+		VN_LOCK_AREC(vp);
+	} else {
+		zp->z_vnode = NULL;
+	}
 
 	list_link_init(&zp->z_link_node);
 
@@ -1435,7 +1438,7 @@ zfs_create_fs(objset_t *os, cred_t *cr, 
 	nvpair_t	*elem;
 	int		error;
 	znode_t		*rootzp = NULL;
-	vnode_t		*vp;
+	vnode_t		vnode;
 	vattr_t		vattr;
 	znode_t		*zp;
 
@@ -1504,13 +1507,13 @@ zfs_create_fs(objset_t *os, cred_t *cr, 
 	vattr.va_gid = crgetgid(cr);
 
 	rootzp = kmem_cache_alloc(znode_cache, KM_SLEEP);
-	zfs_znode_cache_constructor(rootzp, &zfsvfs, 0);
+	zfs_znode_cache_constructor(rootzp, NULL, 0);
 	rootzp->z_unlinked = 0;
 	rootzp->z_atime_dirty = 0;
 
-	vp = ZTOV(rootzp);
-	vp->v_type = VDIR;
-	VN_LOCK_ASHARE(vp);
+	vnode.v_type = VDIR;
+	vnode.v_data = rootzp;
+	rootzp->z_vnode = &vnode;
 
 	bzero(&zfsvfs, sizeof (zfsvfs_t));
 
@@ -1539,16 +1542,10 @@ zfs_create_fs(objset_t *os, cred_t *cr, 
 	ASSERT(error == 0);
 	POINTER_INVALIDATE(&rootzp->z_zfsvfs);
 
-	VI_LOCK(vp);
-	ZTOV(rootzp)->v_data = NULL;
-	ZTOV(rootzp)->v_count = 0;
-	ZTOV(rootzp)->v_holdcnt = 0;
-	rootzp->z_vnode = NULL;
-	VOP_UNLOCK(vp, 0);
-	vdestroy(vp);
 	dmu_buf_rele(rootzp->z_dbuf, NULL);
 	rootzp->z_dbuf = NULL;
 	mutex_destroy(&zfsvfs.z_znodes_lock);
+	rootzp->z_vnode = NULL;
 	kmem_cache_free(znode_cache, rootzp);
 }
 
From pjd at FreeBSD.org  Tue Nov 10 22:27:33 2009
From: pjd at FreeBSD.org (Pawel Jakub Dawidek)
Date: Tue Nov 10 22:27:44 2009
Subject: svn commit: r199157 -
	head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID: <200911102227.nAAMRXTf073603@svn.freebsd.org>

Author: pjd
Date: Tue Nov 10 22:27:33 2009
New Revision: 199157
URL: http://svn.freebsd.org/changeset/base/199157

Log:
  Be careful which vattr fields are set during setattr replay.
  Without this fix strange things can appear after unclean shutdown like
  files with mode set to 07777.
  
  Reported by:	des
  MFC after:	3 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c	Tue Nov 10 22:25:46 2009	(r199156)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c	Tue Nov 10 22:27:33 2009	(r199157)
@@ -60,10 +60,14 @@ zfs_init_vattr(vattr_t *vap, uint64_t ma
 {
 	VATTR_NULL(vap);
 	vap->va_mask = (uint_t)mask;
-	vap->va_type = IFTOVT(mode);
-	vap->va_mode = mode & MODEMASK;
-	vap->va_uid = (uid_t)(IS_EPHEMERAL(uid)) ? -1 : uid;
-	vap->va_gid = (gid_t)(IS_EPHEMERAL(gid)) ? -1 : gid;
+	if (mask & AT_TYPE)
+		vap->va_type = IFTOVT(mode);
+	if (mask & AT_MODE)
+		vap->va_mode = mode & MODEMASK;
+	if (mask & AT_UID)
+		vap->va_uid = (uid_t)(IS_EPHEMERAL(uid)) ? -1 : uid;
+	if (mask & AT_GID)
+		vap->va_gid = (gid_t)(IS_EPHEMERAL(gid)) ? -1 : gid;
 	vap->va_rdev = zfs_cmpldev(rdev);
 	vap->va_nodeid = nodeid;
 }
From kuriyama at FreeBSD.org  Wed Nov 11 02:39:21 2009
From: kuriyama at FreeBSD.org (Jun Kuriyama)
Date: Wed Nov 11 02:39:32 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <20091110160300.GD64905@hoeg.nl>
References: <200911090254.nA92sG1G005921@svn.freebsd.org>
	<20091109225244.GB64905@hoeg.nl>
	<7mbpjbgt0n.wl%kuriyama@s2factory.co.jp>
	<20091110055910.GC64905@hoeg.nl>
	<7mvdhigb96.wl%kuriyama@s2factory.co.jp>
	<20091110160300.GD64905@hoeg.nl>
Message-ID: <7meio5g4yx.wl%kuriyama@s2factory.co.jp>

At Tue, 10 Nov 2009 17:03:00 +0100,
ed@80386.nl wrote:
> > You can try with hw.clflush_disable="1" in loader.conf.  If you can
> > boot with it, I must be mistaken something (anyway its my fault).
> 
> For some reason that switch doesn't seem to have any effect.

Okay, something wrong...

> Apple MacBook3,1:
> |   Features=0xbfebfbff
> 
> Dell SC440:
> |   Features=0xbfebfbff

Both system has CLFUSH and SS, so CLFLUSH tweak should not executed.

Can you test with these patches?  Testing on only one of both system
is enough.  "patch-1" forces disabling CLFLUSH feature even if SS bit
exists.  "patch-2" forces no CLFLUSH tweak.  I'd like to know with
which patch your system can live.


-- 
Jun Kuriyama  // FreeBSD Project
          // S2 Factory, Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-1
Type: application/octet-stream
Size: 723 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091111/a0705337/patch-1.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-2
Type: application/octet-stream
Size: 723 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091111/a0705337/patch-2.obj
From nwhitehorn at FreeBSD.org  Wed Nov 11 03:17:52 2009
From: nwhitehorn at FreeBSD.org (Nathan Whitehorn)
Date: Wed Nov 11 03:17:58 2009
Subject: svn commit: r199169 - head/sys/dev/usb/input
Message-ID: <200911110317.nAB3HpZ3080934@svn.freebsd.org>

Author: nwhitehorn
Date: Wed Nov 11 03:17:51 2009
New Revision: 199169
URL: http://svn.freebsd.org/changeset/base/199169

Log:
  Reduce probe priority of USB input devices to BUS_PROBE_GENERIC from
  BUS_PROBE_SPECIFIC. This allows device-specific drivers like atp to
  attach reliably.
  
  Reviewed by:	hps

Modified:
  head/sys/dev/usb/input/uhid.c
  head/sys/dev/usb/input/ukbd.c
  head/sys/dev/usb/input/ums.c

Modified: head/sys/dev/usb/input/uhid.c
==============================================================================
--- head/sys/dev/usb/input/uhid.c	Wed Nov 11 02:25:27 2009	(r199168)
+++ head/sys/dev/usb/input/uhid.c	Wed Nov 11 03:17:51 2009	(r199169)
@@ -633,7 +633,7 @@ uhid_probe(device_t dev)
 	if (usb_test_quirk(uaa, UQ_HID_IGNORE)) {
 		return (ENXIO);
 	}
-	return (0);
+	return (BUS_PROBE_GENERIC);
 }
 
 static int

Modified: head/sys/dev/usb/input/ukbd.c
==============================================================================
--- head/sys/dev/usb/input/ukbd.c	Wed Nov 11 02:25:27 2009	(r199168)
+++ head/sys/dev/usb/input/ukbd.c	Wed Nov 11 03:17:51 2009	(r199169)
@@ -749,7 +749,7 @@ ukbd_probe(device_t dev)
 		if (usb_test_quirk(uaa, UQ_KBD_IGNORE))
 			return (ENXIO);
 		else
-			return (0);
+			return (BUS_PROBE_GENERIC);
 	}
 
 	error = usbd_req_get_hid_desc(uaa->device, NULL,
@@ -771,7 +771,7 @@ ukbd_probe(device_t dev)
 		if (usb_test_quirk(uaa, UQ_KBD_IGNORE))
 			error = ENXIO;
 		else
-			error = 0;
+			error = BUS_PROBE_GENERIC;
 	} else
 		error = ENXIO;
 

Modified: head/sys/dev/usb/input/ums.c
==============================================================================
--- head/sys/dev/usb/input/ums.c	Wed Nov 11 02:25:27 2009	(r199168)
+++ head/sys/dev/usb/input/ums.c	Wed Nov 11 03:17:51 2009	(r199169)
@@ -375,7 +375,7 @@ ums_probe(device_t dev)
 
 	if ((uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) &&
 	    (uaa->info.bInterfaceProtocol == UIPROTO_MOUSE))
-		return (0);
+		return (BUS_PROBE_GENERIC);
 
 	error = usbd_req_get_hid_desc(uaa->device, NULL,
 	    &d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex);
@@ -385,7 +385,7 @@ ums_probe(device_t dev)
 
 	if (hid_is_collection(d_ptr, d_len,
 	    HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE)))
-		error = 0;
+		error = BUS_PROBE_GENERIC;
 	else
 		error = ENXIO;
 
From ed at FreeBSD.org  Wed Nov 11 08:11:22 2009
From: ed at FreeBSD.org (Ed Schouten)
Date: Wed Nov 11 08:11:34 2009
Subject: svn commit: r199170 - head/sys/teken
Message-ID: <200911110811.nAB8BMxv086882@svn.freebsd.org>

Author: ed
Date: Wed Nov 11 08:11:21 2009
New Revision: 199170
URL: http://svn.freebsd.org/changeset/base/199170

Log:
  Always home the cursor when changing the scrolling region.
  
  I thought this only had to be done when in origin mode, to ensure that
  the cursor is not placed outside the origin, but it seems this is also
  done when not in origin mode.
  
  This fixes some artifacts when pressing ^L while running irssi in tmux.
  (Almost) nobody noticed this, because cons25 doesn't have scrolling
  regions.

Modified:
  head/sys/teken/teken_subr.h

Modified: head/sys/teken/teken_subr.h
==============================================================================
--- head/sys/teken/teken_subr.h	Wed Nov 11 03:17:51 2009	(r199169)
+++ head/sys/teken/teken_subr.h	Wed Nov 11 08:11:21 2009	(r199170)
@@ -1237,16 +1237,17 @@ teken_subr_set_top_and_bottom_margins(te
 		bottom = t->t_winsize.tp_row;
 	}
 
+	/* Apply scrolling region. */
 	t->t_scrollreg.ts_begin = top;
 	t->t_scrollreg.ts_end = bottom;
-	if (t->t_stateflags & TS_ORIGIN) {
-		/* XXX: home cursor? */
+	if (t->t_stateflags & TS_ORIGIN)
 		t->t_originreg = t->t_scrollreg;
-		t->t_cursor.tp_row = t->t_originreg.ts_begin;
-		t->t_cursor.tp_col = 0;
-		t->t_stateflags &= ~TS_WRAPPED;
-		teken_funcs_cursor(t);
-	}
+
+	/* Home cursor to the top left of the scrolling region. */
+	t->t_cursor.tp_row = t->t_originreg.ts_begin;
+	t->t_cursor.tp_col = 0;
+	t->t_stateflags &= ~TS_WRAPPED;
+	teken_funcs_cursor(t);
 }
 
 static void
From ed at FreeBSD.org  Wed Nov 11 08:20:20 2009
From: ed at FreeBSD.org (Ed Schouten)
Date: Wed Nov 11 08:20:32 2009
Subject: svn commit: r199171 - in head/sys: dev/syscons pc98/cbus teken
Message-ID: <200911110820.nAB8KJeu087092@svn.freebsd.org>

Author: ed
Date: Wed Nov 11 08:20:19 2009
New Revision: 199171
URL: http://svn.freebsd.org/changeset/base/199171

Log:
  Allow Syscons terminal emulators to provide function key strings.
  
  xterm and cons25 have some incompatibilities when it comes to escape
  sequences for special keys, such as F1 to F12, home, end, etc. Add a new
  te_fkeystr() that can be used to override the strings.
  
  scterm-sck won't do anything with this, but scterm-teken will use
  teken_get_sequences() to obtain the proper sequence.

Modified:
  head/sys/dev/syscons/scterm-teken.c
  head/sys/dev/syscons/syscons.c
  head/sys/dev/syscons/syscons.h
  head/sys/pc98/cbus/scterm-sck.c
  head/sys/teken/teken.c
  head/sys/teken/teken.h
  head/sys/teken/teken_subr.h

Modified: head/sys/dev/syscons/scterm-teken.c
==============================================================================
--- head/sys/dev/syscons/scterm-teken.c	Wed Nov 11 08:11:21 2009	(r199170)
+++ head/sys/dev/syscons/scterm-teken.c	Wed Nov 11 08:20:19 2009	(r199171)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #if defined(__sparc64__) || defined(__powerpc__)
 #include 
@@ -52,14 +53,15 @@ __FBSDID("$FreeBSD$");
 static void scteken_revattr(unsigned char, teken_attr_t *);
 static unsigned int scteken_attr(const teken_attr_t *);
 
-static sc_term_init_t	scteken_init;
-static sc_term_term_t	scteken_term;
-static sc_term_puts_t	scteken_puts;
-static sc_term_ioctl_t	scteken_ioctl;
-static sc_term_default_attr_t scteken_default_attr;
-static sc_term_clear_t	scteken_clear;
-static sc_term_input_t	scteken_input;
-static void		scteken_nop(void);
+static sc_term_init_t		scteken_init;
+static sc_term_term_t		scteken_term;
+static sc_term_puts_t		scteken_puts;
+static sc_term_ioctl_t		scteken_ioctl;
+static sc_term_default_attr_t	scteken_default_attr;
+static sc_term_clear_t		scteken_clear;
+static sc_term_input_t		scteken_input;
+static sc_term_fkeystr_t	scteken_fkeystr;
+static void			scteken_nop(void);
 
 typedef struct {
 	teken_t		ts_teken;
@@ -84,6 +86,7 @@ static sc_term_sw_t sc_term_scteken = {
 	scteken_clear,
 	(sc_term_notify_t *)scteken_nop,
 	scteken_input,
+	scteken_fkeystr,
 };
 
 SCTERM_MODULE(scteken, sc_term_scteken);
@@ -241,6 +244,56 @@ scteken_input(scr_stat *scp, int c, stru
 	return FALSE;
 }
 
+static const char *
+scteken_fkeystr(scr_stat *scp, int c)
+{
+	teken_stat *ts = scp->ts;
+	unsigned int k;
+
+	switch (c) {
+	case FKEY | F(1):  case FKEY | F(2):  case FKEY | F(3):
+	case FKEY | F(4):  case FKEY | F(5):  case FKEY | F(6):
+	case FKEY | F(7):  case FKEY | F(8):  case FKEY | F(9):
+	case FKEY | F(10): case FKEY | F(11): case FKEY | F(12):
+		k = TKEY_F1 + c - (FKEY | F(1));
+		break;
+	case FKEY | F(49):
+		k = TKEY_HOME;
+		break;
+	case FKEY | F(50):
+		k = TKEY_UP;
+		break;
+	case FKEY | F(51):
+		k = TKEY_PAGE_UP;
+		break;
+	case FKEY | F(53):
+		k = TKEY_LEFT;
+		break;
+	case FKEY | F(55):
+		k = TKEY_RIGHT;
+		break;
+	case FKEY | F(57):
+		k = TKEY_END;
+		break;
+	case FKEY | F(58):
+		k = TKEY_DOWN;
+		break;
+	case FKEY | F(59):
+		k = TKEY_PAGE_DOWN;
+		break;
+	case FKEY | F(60):
+		k = TKEY_INSERT;
+		break;
+	case FKEY | F(61):
+		k = TKEY_DELETE;
+		break;
+	default:
+		return (NULL);
+	}
+
+	return (teken_get_sequence(&ts->ts_teken, k));
+}
+
 static void
 scteken_nop(void)
 {

Modified: head/sys/dev/syscons/syscons.c
==============================================================================
--- head/sys/dev/syscons/syscons.c	Wed Nov 11 08:11:21 2009	(r199170)
+++ head/sys/dev/syscons/syscons.c	Wed Nov 11 08:20:19 2009	(r199171)
@@ -625,7 +625,7 @@ sckbdevent(keyboard_t *thiskbd, int even
     struct tty *cur_tty;
     int c, error = 0; 
     size_t len;
-    u_char *cp;
+    const u_char *cp;
 
     sc = (sc_softc_t *)arg;
     /* assert(thiskbd == sc->kbd) */
@@ -664,6 +664,11 @@ sckbdevent(keyboard_t *thiskbd, int even
 	    ttydisc_rint(cur_tty, KEYCHAR(c), 0);
 	    break;
 	case FKEY:  /* function key, return string */
+	    cp = (*sc->cur_scp->tsw->te_fkeystr)(sc->cur_scp, c);
+	    if (cp != NULL) {
+	    	ttydisc_rint_simple(cur_tty, cp, strlen(cp));
+		break;
+	    }
 	    cp = kbdd_get_fkeystr(thiskbd, KEYCHAR(c), &len);
 	    if (cp != NULL)
 	    	ttydisc_rint_simple(cur_tty, cp, len);
@@ -673,9 +678,7 @@ sckbdevent(keyboard_t *thiskbd, int even
 	    ttydisc_rint(cur_tty, KEYCHAR(c), 0);
 	    break;
 	case BKEY:  /* backtab fixed sequence (esc [ Z) */
-	    ttydisc_rint(cur_tty, 0x1b, 0);
-	    ttydisc_rint(cur_tty, '[', 0);
-	    ttydisc_rint(cur_tty, 'Z', 0);
+	    ttydisc_rint_simple(cur_tty, "\x1B[Z", 3);
 	    break;
 	}
 
@@ -1572,7 +1575,7 @@ sc_cngetc(struct consdev *cd)
     static struct fkeytab fkey;
     static int fkeycp;
     scr_stat *scp;
-    u_char *p;
+    const u_char *p;
     int cur_mode;
     int s = spltty();	/* block sckbdevent and scrn_timer while we poll */
     int c;
@@ -1621,6 +1624,13 @@ sc_cngetc(struct consdev *cd)
     case 0:	/* normal char */
 	return KEYCHAR(c);
     case FKEY:	/* function key */
+	p = (*scp->tsw->te_fkeystr)(scp, c);
+	if (p != NULL) {
+	    fkey.len = strlen(p);
+	    bcopy(p, fkey.str, fkey.len);
+	    fkeycp = 1;
+	    return fkey.str[0];
+	}
 	p = kbdd_get_fkeystr(scp->sc->kbd, KEYCHAR(c), (size_t *)&fkeycp);
 	fkey.len = fkeycp;
 	if ((p != NULL) && (fkey.len > 0)) {

Modified: head/sys/dev/syscons/syscons.h
==============================================================================
--- head/sys/dev/syscons/syscons.h	Wed Nov 11 08:11:21 2009	(r199170)
+++ head/sys/dev/syscons/syscons.h	Wed Nov 11 08:20:19 2009	(r199171)
@@ -381,6 +381,7 @@ typedef void	sc_term_notify_t(scr_stat *
 #define SC_TE_NOTIFY_VTSWITCH_IN	0
 #define SC_TE_NOTIFY_VTSWITCH_OUT	1
 typedef int	sc_term_input_t(scr_stat *scp, int c, struct tty *tp);
+typedef const char *sc_term_fkeystr_t(scr_stat *scp, int c);
 
 typedef struct sc_term_sw {
 	LIST_ENTRY(sc_term_sw)	link;
@@ -398,6 +399,7 @@ typedef struct sc_term_sw {
 	sc_term_clear_t		*te_clear;
 	sc_term_notify_t	*te_notify;
 	sc_term_input_t		*te_input;
+	sc_term_fkeystr_t	*te_fkeystr;
 } sc_term_sw_t;
 
 #define SCTERM_MODULE(name, sw)					\

Modified: head/sys/pc98/cbus/scterm-sck.c
==============================================================================
--- head/sys/pc98/cbus/scterm-sck.c	Wed Nov 11 08:11:21 2009	(r199170)
+++ head/sys/pc98/cbus/scterm-sck.c	Wed Nov 11 08:20:19 2009	(r199171)
@@ -94,15 +94,16 @@ typedef struct {
 	color_t		dflt_rev_color;		/* default reverse color */
 } term_stat;
 
-static sc_term_init_t	scterm_init;
-static sc_term_term_t	scterm_term;
-static sc_term_puts_t	scterm_puts;
-static sc_term_ioctl_t	scterm_ioctl;
-static sc_term_reset_t	scterm_reset;
+static sc_term_init_t		scterm_init;
+static sc_term_term_t		scterm_term;
+static sc_term_puts_t		scterm_puts;
+static sc_term_ioctl_t		scterm_ioctl;
+static sc_term_reset_t		scterm_reset;
 static sc_term_default_attr_t	scterm_default_attr;
-static sc_term_clear_t	scterm_clear;
-static sc_term_notify_t	scterm_notify;
-static sc_term_input_t	scterm_input;
+static sc_term_clear_t		scterm_clear;
+static sc_term_notify_t		scterm_notify;
+static sc_term_input_t		scterm_input;
+static sc_term_fkeystr_t	scterm_fkeystr;
 
 static sc_term_sw_t sc_term_sc = {
 	{ NULL, NULL },
@@ -120,6 +121,7 @@ static sc_term_sw_t sc_term_sc = {
 	scterm_clear,
 	scterm_notify,
 	scterm_input,
+	scterm_fkeystr,
 };
 
 SCTERM_MODULE(sc, sc_term_sc);
@@ -1191,6 +1193,13 @@ scterm_input(scr_stat *scp, int c, struc
 	return FALSE;
 }
 
+static const char *
+scterm_fkeystr(scr_stat *scp, int c)
+{
+
+	return (NULL);
+}
+
 /*
  * Calculate hardware attributes word using logical attributes mask and
  * hardware colors

Modified: head/sys/teken/teken.c
==============================================================================
--- head/sys/teken/teken.c	Wed Nov 11 08:11:21 2009	(r199170)
+++ head/sys/teken/teken.c	Wed Nov 11 08:20:19 2009	(r199171)
@@ -49,14 +49,15 @@ static FILE *df;
 #endif /* __FreeBSD__ && _KERNEL */
 
 /* Private flags for t_stateflags. */
-#define	TS_FIRSTDIGIT	0x01	/* First numeric digit in escape sequence. */
-#define	TS_INSERT	0x02	/* Insert mode. */
-#define	TS_AUTOWRAP	0x04	/* Autowrap. */
-#define	TS_ORIGIN	0x08	/* Origin mode. */
-#define	TS_WRAPPED	0x10	/* Next character should be printed on col 0. */
-#define	TS_8BIT		0x20	/* UTF-8 disabled. */
-#define	TS_CONS25	0x40	/* cons25 emulation. */
-#define	TS_INSTRING	0x80	/* Inside string. */
+#define	TS_FIRSTDIGIT	0x0001	/* First numeric digit in escape sequence. */
+#define	TS_INSERT	0x0002	/* Insert mode. */
+#define	TS_AUTOWRAP	0x0004	/* Autowrap. */
+#define	TS_ORIGIN	0x0008	/* Origin mode. */
+#define	TS_WRAPPED	0x0010	/* Next character should be printed on col 0. */
+#define	TS_8BIT		0x0020	/* UTF-8 disabled. */
+#define	TS_CONS25	0x0040	/* cons25 emulation. */
+#define	TS_INSTRING	0x0080	/* Inside string. */
+#define	TS_CURSORKEYS	0x0100	/* Cursor keys mode. */
 
 /* Character that blanks a cell. */
 #define	BLANK	' '
@@ -479,4 +480,64 @@ teken_256to8(teken_color_t c)
 	}
 }
 
+static const char * const special_strings_cons25[] = {
+	[TKEY_UP] = "\x1B[A",		[TKEY_DOWN] = "\x1B[B",
+	[TKEY_LEFT] = "\x1B[D",		[TKEY_RIGHT] = "\x1B[C",
+
+	[TKEY_INSERT] = "\x1B[L",	[TKEY_DELETE] = "\x7F",
+	[TKEY_HOME] = "\x1B[H",		[TKEY_END] = "\x1B[F",
+	[TKEY_PAGE_UP] = "\x1B[I",	[TKEY_PAGE_DOWN] = "\x1B[G",
+
+	[TKEY_F1] = "\x1B[M",		[TKEY_F2] = "\x1B[N",
+	[TKEY_F3] = "\x1B[O",		[TKEY_F4] = "\x1B[P",
+	[TKEY_F5] = "\x1B[Q",		[TKEY_F6] = "\x1B[R",
+	[TKEY_F7] = "\x1B[S",		[TKEY_F8] = "\x1B[T",
+	[TKEY_F9] = "\x1B[U",		[TKEY_F10] = "\x1B[V",
+	[TKEY_F11] = "\x1B[W",		[TKEY_F12] = "\x1B[X",
+};
+
+static const char * const special_strings_ckeys[] = {
+	[TKEY_UP] = "\x1BOA",		[TKEY_DOWN] = "\x1BOB",
+	[TKEY_LEFT] = "\x1BOD",		[TKEY_RIGHT] = "\x1BOC",
+
+	[TKEY_HOME] = "\x1BOH",		[TKEY_END] = "\x1BOF",
+};
+
+static const char * const special_strings_normal[] = {
+	[TKEY_UP] = "\x1B[A",		[TKEY_DOWN] = "\x1B[B",
+	[TKEY_LEFT] = "\x1B[D",		[TKEY_RIGHT] = "\x1B[C",
+
+	[TKEY_INSERT] = "\x1B[2~",	[TKEY_DELETE] = "\x1B[3~",
+	[TKEY_HOME] = "\x1B[H",		[TKEY_END] = "\x1B[F",
+	[TKEY_PAGE_UP] = "\x1B[5~",	[TKEY_PAGE_DOWN] = "\x1B[6~",
+
+	[TKEY_F1] = "\x1BOP",		[TKEY_F2] = "\x1BOQ",
+	[TKEY_F3] = "\x1BOR",		[TKEY_F4] = "\x1BOS",
+	[TKEY_F5] = "\x1B[15~",		[TKEY_F6] = "\x1B[17~",
+	[TKEY_F7] = "\x1B[18~",		[TKEY_F8] = "\x1B[19~",
+	[TKEY_F9] = "\x1B[20~",		[TKEY_F10] = "\x1B[21~",
+	[TKEY_F11] = "\x1B[23~",	[TKEY_F12] = "\x1B[24~",
+};
+
+const char *
+teken_get_sequence(teken_t *t, unsigned int k)
+{
+
+	/* Cons25 mode. */
+	if (t->t_stateflags & TS_CONS25 &&
+	    k < sizeof special_strings_cons25 / sizeof(char *))
+		return (special_strings_cons25[k]);
+
+	/* Cursor keys mode. */
+	if (t->t_stateflags & TS_CURSORKEYS &&
+	    k < sizeof special_strings_ckeys / sizeof(char *))
+		return (special_strings_ckeys[k]);
+
+	/* Default xterm sequences. */
+	if (k < sizeof special_strings_normal / sizeof(char *))
+		return (special_strings_normal[k]);
+	
+	return (NULL);
+}
+
 #include "teken_state.h"

Modified: head/sys/teken/teken.h
==============================================================================
--- head/sys/teken/teken.h	Wed Nov 11 08:11:21 2009	(r199170)
+++ head/sys/teken/teken.h	Wed Nov 11 08:20:19 2009	(r199171)
@@ -89,15 +89,14 @@ typedef void tf_fill_t(void *, const tek
 typedef void tf_copy_t(void *, const teken_rect_t *, const teken_pos_t *);
 typedef void tf_param_t(void *, int, unsigned int);
 #define	TP_SHOWCURSOR	0
-#define	TP_CURSORKEYS	1
-#define	TP_KEYPADAPP	2
-#define	TP_AUTOREPEAT	3
-#define	TP_SWITCHVT	4
-#define	TP_132COLS	5
-#define	TP_SETBELLPD	6
+#define	TP_KEYPADAPP	1
+#define	TP_AUTOREPEAT	2
+#define	TP_SWITCHVT	3
+#define	TP_132COLS	4
+#define	TP_SETBELLPD	5
 #define	TP_SETBELLPD_PITCH(pd)		((pd) >> 16)
 #define	TP_SETBELLPD_DURATION(pd)	((pd) & 0xffff)
-#define	TP_MOUSE	7
+#define	TP_MOUSE	6
 typedef void tf_respond_t(void *, const void *, size_t);
 
 typedef struct {
@@ -168,6 +167,33 @@ void	teken_set_curattr(teken_t *, const 
 void	teken_set_defattr(teken_t *, const teken_attr_t *);
 void	teken_set_winsize(teken_t *, const teken_pos_t *);
 
+/* Key input escape sequences. */
+#define	TKEY_UP		0x00
+#define	TKEY_DOWN	0x01
+#define	TKEY_LEFT	0x02
+#define	TKEY_RIGHT	0x03
+
+#define	TKEY_INSERT	0x04
+#define	TKEY_DELETE	0x05
+#define	TKEY_HOME	0x06
+#define	TKEY_END	0x07
+#define	TKEY_PAGE_UP	0x08
+#define	TKEY_PAGE_DOWN	0x09
+
+#define	TKEY_F1		0x0a
+#define	TKEY_F2		0x0b
+#define	TKEY_F3		0x0c
+#define	TKEY_F4		0x0d
+#define	TKEY_F5		0x0e
+#define	TKEY_F6		0x0f
+#define	TKEY_F7		0x10
+#define	TKEY_F8		0x11
+#define	TKEY_F9		0x12
+#define	TKEY_F10	0x13
+#define	TKEY_F11	0x14
+#define	TKEY_F12	0x15
+const char *teken_get_sequence(teken_t *, unsigned int);
+
 /* Legacy features. */
 void	teken_set_8bit(teken_t *);
 void	teken_set_cons25(teken_t *);

Modified: head/sys/teken/teken_subr.h
==============================================================================
--- head/sys/teken/teken_subr.h	Wed Nov 11 08:11:21 2009	(r199170)
+++ head/sys/teken/teken_subr.h	Wed Nov 11 08:20:19 2009	(r199171)
@@ -903,7 +903,7 @@ teken_subr_reset_dec_mode(teken_t *t, un
 
 	switch (cmd) {
 	case 1: /* Cursor keys mode. */
-		teken_funcs_param(t, TP_CURSORKEYS, 0);
+		t->t_stateflags &= ~TS_CURSORKEYS;
 		break;
 	case 2: /* DECANM: ANSI/VT52 mode. */
 		teken_printf("DECRST VT52\n");
@@ -1052,7 +1052,7 @@ teken_subr_set_dec_mode(teken_t *t, unsi
 
 	switch (cmd) {
 	case 1: /* Cursor keys mode. */
-		teken_funcs_param(t, TP_CURSORKEYS, 1);
+		t->t_stateflags |= TS_CURSORKEYS;
 		break;
 	case 2: /* DECANM: ANSI/VT52 mode. */
 		teken_printf("DECSET VT52\n");
From ume at FreeBSD.org  Wed Nov 11 08:28:18 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Wed Nov 11 08:28:27 2009
Subject: svn commit: r199173 - head/sys/netinet6
Message-ID: <200911110828.nAB8SI7Z087344@svn.freebsd.org>

Author: ume
Date: Wed Nov 11 08:28:18 2009
New Revision: 199173
URL: http://svn.freebsd.org/changeset/base/199173

Log:
  CURVNET_RESTORE() was not called in certain cases.
  
  MFC after:	3 days

Modified:
  head/sys/netinet6/nd6.c

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c	Wed Nov 11 08:27:09 2009	(r199172)
+++ head/sys/netinet6/nd6.c	Wed Nov 11 08:28:18 2009	(r199173)
@@ -582,10 +582,10 @@ nd6_llinfo_timer(void *arg)
 		}
 		break;
 	}
-	CURVNET_RESTORE();
 done:
 	if (ln != NULL)
 		LLE_FREE(ln);
+	CURVNET_RESTORE();
 }
 
 
From ed at FreeBSD.org  Wed Nov 11 08:39:58 2009
From: ed at FreeBSD.org (Ed Schouten)
Date: Wed Nov 11 08:40:05 2009
Subject: svn commit: r199174 - head/usr.sbin/vidcontrol
Message-ID: <200911110839.nAB8dvAE087672@svn.freebsd.org>

Author: ed
Date: Wed Nov 11 08:39:57 2009
New Revision: 199174
URL: http://svn.freebsd.org/changeset/base/199174

Log:
  Add a new flag to vidcontrol, -T, that allows terminal mode switching.
  
  This will make it more easy for people to experiment with TERM=xterm.
  Instead of echoing these strange escape sequences, I can just instruct
  them to run `vidcontrol -T xterm'.

Modified:
  head/usr.sbin/vidcontrol/vidcontrol.1
  head/usr.sbin/vidcontrol/vidcontrol.c

Modified: head/usr.sbin/vidcontrol/vidcontrol.1
==============================================================================
--- head/usr.sbin/vidcontrol/vidcontrol.1	Wed Nov 11 08:28:18 2009	(r199173)
+++ head/usr.sbin/vidcontrol/vidcontrol.1	Wed Nov 11 08:39:57 2009	(r199174)
@@ -38,6 +38,7 @@
 .Op Fl r Ar foreground Ar background
 .Op Fl S Cm on | off
 .Op Fl s Ar number
+.Op Fl T Cm xterm | cons25
 .Op Fl t Ar N | Cm off
 .Op Ar mode
 .Op Ar foreground Op Ar background
@@ -243,6 +244,8 @@ is supposed to be physically secure.
 .It Fl s Ar number
 Set the current vty to
 .Ar number .
+.It Fl T Cm xterm | cons25
+Switch between xterm and cons25 style terminal emulation.
 .It Fl t Ar N | Cm off
 Set the screensaver timeout to
 .Ar N

Modified: head/usr.sbin/vidcontrol/vidcontrol.c
==============================================================================
--- head/usr.sbin/vidcontrol/vidcontrol.c	Wed Nov 11 08:28:18 2009	(r199173)
+++ head/usr.sbin/vidcontrol/vidcontrol.c	Wed Nov 11 08:39:57 2009	(r199174)
@@ -185,8 +185,8 @@ usage(void)
 "usage: vidcontrol [-CdHLPpx] [-b color] [-c appearance] [-f [size] file]",
 "                  [-g geometry] [-h size] [-i adapter | mode] [-l screen_map]",
 "                  [-M char] [-m on | off] [-r foreground background]",
-"                  [-S on | off] [-s number] [-t N | off] [mode]",
-"                  [foreground [background]] [show]");
+"                  [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]",
+"                  [mode] [foreground [background]] [show]");
 	exit(1);
 }
 
@@ -1159,6 +1159,18 @@ clear_history(void)
 	}
 }
 
+static void
+set_terminal_mode(char *arg)
+{
+
+	if (strcmp(arg, "xterm") == 0)
+		fprintf(stderr, "\033[=T");
+	else if (strcmp(arg, "cons25") == 0)
+		fprintf(stderr, "\033[=1T");
+	else
+		usage();
+}
+
 
 int
 main(int argc, char **argv)
@@ -1175,7 +1187,8 @@ main(int argc, char **argv)
 		err(1, "must be on a virtual console");
 	dumpmod = 0;
 	dumpopt = DUMP_FBF;
-	while((opt = getopt(argc, argv, "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:t:x")) != -1)
+	while ((opt = getopt(argc, argv,
+	    "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:T:t:x")) != -1)
 		switch(opt) {
 		case 'b':
 			set_border_color(optarg);
@@ -1244,6 +1257,9 @@ main(int argc, char **argv)
 		case 's':
 			set_console(optarg);
 			break;
+		case 'T':
+			set_terminal_mode(optarg);
+			break;
 		case 't':
 			set_screensaver_timeout(optarg);
 			break;
From ed at FreeBSD.org  Wed Nov 11 09:43:26 2009
From: ed at FreeBSD.org (Ed Schouten)
Date: Wed Nov 11 09:43:37 2009
Subject: svn commit: r199175 - head/sys/teken
Message-ID: <200911110943.nAB9hQde088980@svn.freebsd.org>

Author: ed
Date: Wed Nov 11 09:43:26 2009
New Revision: 199175
URL: http://svn.freebsd.org/changeset/base/199175

Log:
  Place home and end before insert and delete.
  
  These keys have different sequences when using cursorkeys, while insert
  and delete stay the same. If they are placed like this, libteken will
  return NULL instead of a proper sequence for these characters.

Modified:
  head/sys/teken/teken.c
  head/sys/teken/teken.h

Modified: head/sys/teken/teken.c
==============================================================================
--- head/sys/teken/teken.c	Wed Nov 11 08:39:57 2009	(r199174)
+++ head/sys/teken/teken.c	Wed Nov 11 09:43:26 2009	(r199175)
@@ -484,8 +484,8 @@ static const char * const special_string
 	[TKEY_UP] = "\x1B[A",		[TKEY_DOWN] = "\x1B[B",
 	[TKEY_LEFT] = "\x1B[D",		[TKEY_RIGHT] = "\x1B[C",
 
-	[TKEY_INSERT] = "\x1B[L",	[TKEY_DELETE] = "\x7F",
 	[TKEY_HOME] = "\x1B[H",		[TKEY_END] = "\x1B[F",
+	[TKEY_INSERT] = "\x1B[L",	[TKEY_DELETE] = "\x7F",
 	[TKEY_PAGE_UP] = "\x1B[I",	[TKEY_PAGE_DOWN] = "\x1B[G",
 
 	[TKEY_F1] = "\x1B[M",		[TKEY_F2] = "\x1B[N",
@@ -507,8 +507,8 @@ static const char * const special_string
 	[TKEY_UP] = "\x1B[A",		[TKEY_DOWN] = "\x1B[B",
 	[TKEY_LEFT] = "\x1B[D",		[TKEY_RIGHT] = "\x1B[C",
 
-	[TKEY_INSERT] = "\x1B[2~",	[TKEY_DELETE] = "\x1B[3~",
 	[TKEY_HOME] = "\x1B[H",		[TKEY_END] = "\x1B[F",
+	[TKEY_INSERT] = "\x1B[2~",	[TKEY_DELETE] = "\x1B[3~",
 	[TKEY_PAGE_UP] = "\x1B[5~",	[TKEY_PAGE_DOWN] = "\x1B[6~",
 
 	[TKEY_F1] = "\x1BOP",		[TKEY_F2] = "\x1BOQ",

Modified: head/sys/teken/teken.h
==============================================================================
--- head/sys/teken/teken.h	Wed Nov 11 08:39:57 2009	(r199174)
+++ head/sys/teken/teken.h	Wed Nov 11 09:43:26 2009	(r199175)
@@ -173,10 +173,10 @@ void	teken_set_winsize(teken_t *, const 
 #define	TKEY_LEFT	0x02
 #define	TKEY_RIGHT	0x03
 
-#define	TKEY_INSERT	0x04
-#define	TKEY_DELETE	0x05
-#define	TKEY_HOME	0x06
-#define	TKEY_END	0x07
+#define	TKEY_HOME	0x04
+#define	TKEY_END	0x05
+#define	TKEY_INSERT	0x06
+#define	TKEY_DELETE	0x07
 #define	TKEY_PAGE_UP	0x08
 #define	TKEY_PAGE_DOWN	0x09
 
From mav at FreeBSD.org  Wed Nov 11 10:44:10 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Wed Nov 11 10:44:16 2009
Subject: svn commit: r199176 - head/sys/dev/ahci
Message-ID: <200911111044.nABAiAvV092181@svn.freebsd.org>

Author: mav
Date: Wed Nov 11 10:44:09 2009
New Revision: 199176
URL: http://svn.freebsd.org/changeset/base/199176

Log:
  MFp4:
  Add set of chip IDs, known to support AHCI.

Modified:
  head/sys/dev/ahci/ahci.c

Modified: head/sys/dev/ahci/ahci.c
==============================================================================
--- head/sys/dev/ahci/ahci.c	Wed Nov 11 09:43:26 2009	(r199175)
+++ head/sys/dev/ahci/ahci.c	Wed Nov 11 10:44:09 2009	(r199176)
@@ -96,23 +96,154 @@ static void ahcipoll(struct cam_sim *sim
 
 MALLOC_DEFINE(M_AHCI, "AHCI driver", "AHCI driver data buffers");
 
-/*
- * AHCI v1.x compliant SATA chipset support functions
- */
+static struct {
+	uint32_t	id;
+	const char	*name;
+	int		flags;
+} ahci_ids[] = {
+	{0x43801002, "ATI IXP600",	0},
+	{0x43901002, "ATI IXP700",	0},
+	{0x43911002, "ATI IXP700",	0},
+	{0x43921002, "ATI IXP700",	0},
+	{0x43931002, "ATI IXP700",	0},
+	{0x43941002, "ATI IXP800",	0},
+	{0x43951002, "ATI IXP800",	0},
+	{0x26528086, "Intel ICH6",	0},
+	{0x26538086, "Intel ICH6M",	0},
+	{0x26818086, "Intel ESB2",	0},
+	{0x26828086, "Intel ESB2",	0},
+	{0x26838086, "Intel ESB2",	0},
+	{0x27c18086, "Intel ICH7",	0},
+	{0x27c38086, "Intel ICH7",	0},
+	{0x27c58086, "Intel ICH7M",	0},
+	{0x27c68086, "Intel ICH7M",	0},
+	{0x28218086, "Intel ICH8",	0},
+	{0x28228086, "Intel ICH8",	0},
+	{0x28248086, "Intel ICH8",	0},
+	{0x28298086, "Intel ICH8M",	0},
+	{0x282a8086, "Intel ICH8M",	0},
+	{0x29228086, "Intel ICH9",	0},
+	{0x29238086, "Intel ICH9",	0},
+	{0x29248086, "Intel ICH9",	0},
+	{0x29258086, "Intel ICH9",	0},
+	{0x29278086, "Intel ICH9",	0},
+	{0x29298086, "Intel ICH9M",	0},
+	{0x292a8086, "Intel ICH9M",	0},
+	{0x292b8086, "Intel ICH9M",	0},
+	{0x292c8086, "Intel ICH9M",	0},
+	{0x292f8086, "Intel ICH9M",	0},
+	{0x294d8086, "Intel ICH9",	0},
+	{0x294e8086, "Intel ICH9M",	0},
+	{0x3a058086, "Intel ICH10",	0},
+	{0x3a228086, "Intel ICH10",	0},
+	{0x3a258086, "Intel ICH10",	0},
+	{0x3b228086, "Intel PCH",	0},
+	{0x3b238086, "Intel PCH",	0},
+	{0x3b248086, "Intel PCH",	0},
+	{0x3b258086, "Intel PCH",	0},
+	{0x3b298086, "Intel PCH",	0},
+	{0x3b2b8086, "Intel PCH",	0},
+	{0x3b2c8086, "Intel PCH",	0},
+	{0x3b2f8086, "Intel PCH",	0},
+	{0x044c10de, "NVIDIA MCP65",	0},
+	{0x044d10de, "NVIDIA MCP65",	0},
+	{0x044e10de, "NVIDIA MCP65",	0},
+	{0x044f10de, "NVIDIA MCP65",	0},
+	{0x045c10de, "NVIDIA MCP65",	0},
+	{0x045d10de, "NVIDIA MCP65",	0},
+	{0x045e10de, "NVIDIA MCP65",	0},
+	{0x045f10de, "NVIDIA MCP65",	0},
+	{0x055010de, "NVIDIA MCP67",	0},
+	{0x055110de, "NVIDIA MCP67",	0},
+	{0x055210de, "NVIDIA MCP67",	0},
+	{0x055310de, "NVIDIA MCP67",	0},
+	{0x055410de, "NVIDIA MCP67",	0},
+	{0x055510de, "NVIDIA MCP67",	0},
+	{0x055610de, "NVIDIA MCP67",	0},
+	{0x055710de, "NVIDIA MCP67",	0},
+	{0x055810de, "NVIDIA MCP67",	0},
+	{0x055910de, "NVIDIA MCP67",	0},
+	{0x055A10de, "NVIDIA MCP67",	0},
+	{0x055B10de, "NVIDIA MCP67",	0},
+	{0x058410de, "NVIDIA MCP67",	0},
+	{0x07f010de, "NVIDIA MCP73",	0},
+	{0x07f110de, "NVIDIA MCP73",	0},
+	{0x07f210de, "NVIDIA MCP73",	0},
+	{0x07f310de, "NVIDIA MCP73",	0},
+	{0x07f410de, "NVIDIA MCP73",	0},
+	{0x07f510de, "NVIDIA MCP73",	0},
+	{0x07f610de, "NVIDIA MCP73",	0},
+	{0x07f710de, "NVIDIA MCP73",	0},
+	{0x07f810de, "NVIDIA MCP73",	0},
+	{0x07f910de, "NVIDIA MCP73",	0},
+	{0x07fa10de, "NVIDIA MCP73",	0},
+	{0x07fb10de, "NVIDIA MCP73",	0},
+	{0x0ad010de, "NVIDIA MCP77",	0},
+	{0x0ad110de, "NVIDIA MCP77",	0},
+	{0x0ad210de, "NVIDIA MCP77",	0},
+	{0x0ad310de, "NVIDIA MCP77",	0},
+	{0x0ad410de, "NVIDIA MCP77",	0},
+	{0x0ad510de, "NVIDIA MCP77",	0},
+	{0x0ad610de, "NVIDIA MCP77",	0},
+	{0x0ad710de, "NVIDIA MCP77",	0},
+	{0x0ad810de, "NVIDIA MCP77",	0},
+	{0x0ad910de, "NVIDIA MCP77",	0},
+	{0x0ada10de, "NVIDIA MCP77",	0},
+	{0x0adb10de, "NVIDIA MCP77",	0},
+	{0x0ab410de, "NVIDIA MCP79",	0},
+	{0x0ab510de, "NVIDIA MCP79",	0},
+	{0x0ab610de, "NVIDIA MCP79",	0},
+	{0x0ab710de, "NVIDIA MCP79",	0},
+	{0x0ab810de, "NVIDIA MCP79",	0},
+	{0x0ab910de, "NVIDIA MCP79",	0},
+	{0x0aba10de, "NVIDIA MCP79",	0},
+	{0x0abb10de, "NVIDIA MCP79",	0},
+	{0x0abc10de, "NVIDIA MCP79",	0},
+	{0x0abd10de, "NVIDIA MCP79",	0},
+	{0x0abe10de, "NVIDIA MCP79",	0},
+	{0x0abf10de, "NVIDIA MCP79",	0},
+	{0x0d8410de, "NVIDIA MCP89",	0},
+	{0x0d8510de, "NVIDIA MCP89",	0},
+	{0x0d8610de, "NVIDIA MCP89",	0},
+	{0x0d8710de, "NVIDIA MCP89",	0},
+	{0x0d8810de, "NVIDIA MCP89",	0},
+	{0x0d8910de, "NVIDIA MCP89",	0},
+	{0x0d8a10de, "NVIDIA MCP89",	0},
+	{0x0d8b10de, "NVIDIA MCP89",	0},
+	{0x0d8c10de, "NVIDIA MCP89",	0},
+	{0x0d8d10de, "NVIDIA MCP89",	0},
+	{0x0d8e10de, "NVIDIA MCP89",	0},
+	{0x0d8f10de, "NVIDIA MCP89",	0},
+	{0x33491106, "VIA VT8251",	0},
+	{0x62871106, "VIA VT8251",	0},
+	{0x11841039, "SiS 966",		0},
+	{0x11851039, "SiS 968",		0},
+	{0x01861039, "SiS 968",		0},
+	{0,	     NULL,		0}
+};
+
 static int
 ahci_probe(device_t dev)
 {
+	char buf[64];
+	int i;
+	uint32_t devid = pci_get_devid(dev);
 
-	/* is this a possible AHCI candidate ? */
+	/* Is this a known AHCI chip? */
+	for (i = 0; ahci_ids[i].id != 0; i++) {
+		if (ahci_ids[i].id == devid) {
+			snprintf(buf, sizeof(buf), "%s AHCI SATA controller",
+			    ahci_ids[i].name);
+			device_set_desc_copy(dev, buf);
+			return (BUS_PROBE_VENDOR);
+		}
+	}
+	/* Is this a possible AHCI candidate? */
 	if (pci_get_class(dev) != PCIC_STORAGE ||
-	    pci_get_subclass(dev) != PCIS_STORAGE_SATA)
+	    pci_get_subclass(dev) != PCIS_STORAGE_SATA ||
+	    pci_get_progif(dev) != PCIP_STORAGE_SATA_AHCI_1_0)
 		return (ENXIO);
-
-	/* is this PCI device flagged as an AHCI compliant chip ? */
-	if (pci_get_progif(dev) != PCIP_STORAGE_SATA_AHCI_1_0)
-		return (ENXIO);
-
-	device_set_desc_copy(dev, "AHCI controller");
+	device_set_desc_copy(dev, "AHCI SATA controller");
 	return (BUS_PROBE_VENDOR);
 }
 
From ru at FreeBSD.org  Wed Nov 11 11:07:31 2009
From: ru at FreeBSD.org (Ruslan Ermilov)
Date: Wed Nov 11 11:07:37 2009
Subject: svn commit: r199177 - head/sys/conf
Message-ID: <200911111107.nABB7Vnl092694@svn.freebsd.org>

Author: ru
Date: Wed Nov 11 11:07:30 2009
New Revision: 199177
URL: http://svn.freebsd.org/changeset/base/199177

Log:
  Added option NETGRAPH_VLAN.
  
  Submitted by:	pluknet

Modified:
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/options

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Wed Nov 11 10:44:09 2009	(r199176)
+++ head/sys/conf/NOTES	Wed Nov 11 11:07:30 2009	(r199177)
@@ -706,6 +706,7 @@ options 	NETGRAPH_TCPMSS
 options 	NETGRAPH_TEE
 options 	NETGRAPH_UI
 options 	NETGRAPH_VJC
+options 	NETGRAPH_VLAN
 
 # NgATM - Netgraph ATM
 options 	NGATM_ATM

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Wed Nov 11 10:44:09 2009	(r199176)
+++ head/sys/conf/files	Wed Nov 11 11:07:30 2009	(r199177)
@@ -2399,6 +2399,7 @@ netgraph/ng_tcpmss.c		optional netgraph_
 netgraph/ng_tee.c		optional netgraph_tee
 netgraph/ng_tty.c		optional netgraph_tty
 netgraph/ng_vjc.c		optional netgraph_vjc
+netgraph/ng_vlan.c		optional netgraph_vlan
 netinet/accf_data.c		optional accept_filter_data inet
 netinet/accf_dns.c		optional accept_filter_dns inet
 netinet/accf_http.c		optional accept_filter_http inet

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Wed Nov 11 10:44:09 2009	(r199176)
+++ head/sys/conf/options	Wed Nov 11 11:07:30 2009	(r199177)
@@ -497,6 +497,7 @@ NETGRAPH_TEE		opt_netgraph.h
 NETGRAPH_TTY		opt_netgraph.h
 NETGRAPH_UI		opt_netgraph.h
 NETGRAPH_VJC		opt_netgraph.h
+NETGRAPH_VLAN		opt_netgraph.h
 
 # NgATM options
 NGATM_ATM		opt_netgraph.h
From mav at FreeBSD.org  Wed Nov 11 11:10:37 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Wed Nov 11 11:10:50 2009
Subject: svn commit: r199178 - in head/sys: cam cam/ata cam/scsi dev/ahci
	dev/siis
Message-ID: <200911111110.nABBAbHc092802@svn.freebsd.org>

Author: mav
Date: Wed Nov 11 11:10:36 2009
New Revision: 199178
URL: http://svn.freebsd.org/changeset/base/199178

Log:
  MFp4:
  - Move tagged queueing control from ADA to ATA XPT. It allows to control
    device command queue length correctly. First step to support < 32 tags.
  - Limit queue for non-tagged devices by 2 slots for ahci(4) and siis(4).
  - Implement quirk matching for ATA devices.
  - Move xpt_schedule_dev_sendq() from header to source file.
  - Move delayed queue shrinking to the more expected place - element freeing.
  - Remove some SCSIsms in ATA.

Modified:
  head/sys/cam/ata/ata_all.c
  head/sys/cam/ata/ata_all.h
  head/sys/cam/ata/ata_da.c
  head/sys/cam/ata/ata_xpt.c
  head/sys/cam/cam.c
  head/sys/cam/cam_ccb.h
  head/sys/cam/cam_xpt.c
  head/sys/cam/cam_xpt_internal.h
  head/sys/cam/scsi/scsi_xpt.c
  head/sys/dev/ahci/ahci.c
  head/sys/dev/siis/siis.c

Modified: head/sys/cam/ata/ata_all.c
==============================================================================
--- head/sys/cam/ata/ata_all.c	Wed Nov 11 11:07:30 2009	(r199177)
+++ head/sys/cam/ata/ata_all.c	Wed Nov 11 11:10:36 2009	(r199178)
@@ -509,3 +509,38 @@ ata_max_mode(struct ata_params *ap, int 
     return (mode);
 }
 
+int
+ata_identify_match(caddr_t identbuffer, caddr_t table_entry)
+{
+	struct scsi_inquiry_pattern *entry;
+	struct ata_params *ident;
+ 
+	entry = (struct scsi_inquiry_pattern *)table_entry;
+	ident = (struct ata_params *)identbuffer;
+
+	if ((cam_strmatch(ident->model, entry->product,
+			  sizeof(ident->model)) == 0)
+	 && (cam_strmatch(ident->revision, entry->revision,
+			  sizeof(ident->revision)) == 0)) {
+		return (0);
+	}
+        return (-1);
+}
+
+int
+ata_static_identify_match(caddr_t identbuffer, caddr_t table_entry)
+{
+	struct scsi_static_inquiry_pattern *entry;
+	struct ata_params *ident;
+ 
+	entry = (struct scsi_static_inquiry_pattern *)table_entry;
+	ident = (struct ata_params *)identbuffer;
+
+	if ((cam_strmatch(ident->model, entry->product,
+			  sizeof(ident->model)) == 0)
+	 && (cam_strmatch(ident->revision, entry->revision,
+			  sizeof(ident->revision)) == 0)) {
+		return (0);
+	}
+        return (-1);
+}

Modified: head/sys/cam/ata/ata_all.h
==============================================================================
--- head/sys/cam/ata/ata_all.h	Wed Nov 11 11:07:30 2009	(r199177)
+++ head/sys/cam/ata/ata_all.h	Wed Nov 11 11:10:36 2009	(r199178)
@@ -114,4 +114,7 @@ int	ata_max_wmode(struct ata_params *ap)
 int	ata_max_umode(struct ata_params *ap);
 int	ata_max_mode(struct ata_params *ap, int mode, int maxmode);
 
+int	ata_identify_match(caddr_t identbuffer, caddr_t table_entry);
+int	ata_static_identify_match(caddr_t identbuffer, caddr_t table_entry);
+
 #endif

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c	Wed Nov 11 11:07:30 2009	(r199177)
+++ head/sys/cam/ata/ata_da.c	Wed Nov 11 11:10:36 2009	(r199178)
@@ -122,9 +122,17 @@ struct ada_quirk_entry {
 	ada_quirks quirks;
 };
 
-//static struct ada_quirk_entry ada_quirk_table[] =
-//{
-//};
+static struct ada_quirk_entry ada_quirk_table[] =
+{
+	{
+		/* Default */
+		{
+		  T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED,
+		  /*vendor*/"*", /*product*/"*", /*revision*/"*"
+		},
+		/*quirks*/0
+	},
+};
 
 static	disk_strategy_t	adastrategy;
 static	dumper_t	adadump;
@@ -618,7 +626,7 @@ adaregister(struct cam_periph *periph, v
 	if (cgd->ident_data.support.command2 & ATA_SUPPORT_FLUSHCACHE)
 		softc->flags |= ADA_FLAG_CAN_FLUSHCACHE;
 	if (cgd->ident_data.satacapabilities & ATA_SUPPORT_NCQ &&
-	    cgd->ident_data.queue >= 31)
+	    cgd->inq_flags & SID_CmdQue)
 		softc->flags |= ADA_FLAG_CAN_NCQ;
 	softc->state = ADA_STATE_NORMAL;
 
@@ -627,12 +635,10 @@ adaregister(struct cam_periph *periph, v
 	/*
 	 * See if this device has any quirks.
 	 */
-//	match = cam_quirkmatch((caddr_t)&cgd->inq_data,
-//			       (caddr_t)ada_quirk_table,
-//			       sizeof(ada_quirk_table)/sizeof(*ada_quirk_table),
-//			       sizeof(*ada_quirk_table), scsi_inquiry_match);
-	match = NULL;
-
+	match = cam_quirkmatch((caddr_t)&cgd->ident_data,
+			       (caddr_t)ada_quirk_table,
+			       sizeof(ada_quirk_table)/sizeof(*ada_quirk_table),
+			       sizeof(*ada_quirk_table), ata_identify_match);
 	if (match != NULL)
 		softc->quirks = ((struct ada_quirk_entry *)match)->quirks;
 	else
@@ -700,11 +706,6 @@ adaregister(struct cam_periph *periph, v
 		dp->secsize, dp->heads,
 		dp->secs_per_track, dp->cylinders);
 	xpt_announce_periph(periph, announce_buf);
-	if (softc->flags & ADA_FLAG_CAN_NCQ) {
-		printf("%s%d: Native Command Queueing enabled\n",
-		       periph->periph_name, periph->unit_number);
-	}
-
 	/*
 	 * Add async callbacks for bus reset and
 	 * bus device reset calls.  I don't bother

Modified: head/sys/cam/ata/ata_xpt.c
==============================================================================
--- head/sys/cam/ata/ata_xpt.c	Wed Nov 11 11:07:30 2009	(r199177)
+++ head/sys/cam/ata/ata_xpt.c	Wed Nov 11 11:10:36 2009	(r199178)
@@ -66,17 +66,12 @@ __FBSDID("$FreeBSD$");
 #include 	/* for xpt_print below */
 #include "opt_cam.h"
 
-struct scsi_quirk_entry {
+struct ata_quirk_entry {
 	struct scsi_inquiry_pattern inq_pat;
 	u_int8_t quirks;
-#define	CAM_QUIRK_NOLUNS	0x01
-#define	CAM_QUIRK_NOSERIAL	0x02
-#define	CAM_QUIRK_HILUNS	0x04
-#define	CAM_QUIRK_NOHILUNS	0x08
-	u_int mintags;
+#define	CAM_QUIRK_MAXTAGS	0x01
 	u_int maxtags;
 };
-#define SCSI_QUIRK(dev)	((struct scsi_quirk_entry *)((dev)->quirk))
 
 static periph_init_t probe_periph_init;
 
@@ -138,7 +133,7 @@ typedef struct {
 	struct cam_periph *periph;
 } probe_softc;
 
-static struct scsi_quirk_entry scsi_quirk_table[] =
+static struct ata_quirk_entry ata_quirk_table[] =
 {
 	{
 		/* Default tagged queuing parameters for all devices */
@@ -146,12 +141,12 @@ static struct scsi_quirk_entry scsi_quir
 		  T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED,
 		  /*vendor*/"*", /*product*/"*", /*revision*/"*"
 		},
-		/*quirks*/0, /*mintags*/2, /*maxtags*/32
+		/*quirks*/0, /*maxtags*/0
 	},
 };
 
-static const int scsi_quirk_table_size =
-	sizeof(scsi_quirk_table) / sizeof(*scsi_quirk_table);
+static const int ata_quirk_table_size =
+	sizeof(ata_quirk_table) / sizeof(*ata_quirk_table);
 
 static cam_status	proberegister(struct cam_periph *periph,
 				      void *arg);
@@ -162,7 +157,7 @@ static void	 probestart(struct cam_perip
 //				     struct cam_ed *device);
 static void	 probedone(struct cam_periph *periph, union ccb *done_ccb);
 static void	 probecleanup(struct cam_periph *periph);
-static void	 scsi_find_quirk(struct cam_ed *device);
+static void	 ata_find_quirk(struct cam_ed *device);
 static void	 ata_scan_bus(struct cam_periph *periph, union ccb *ccb);
 static void	 ata_scan_lun(struct cam_periph *periph,
 			       struct cam_path *path, cam_flags flags,
@@ -172,10 +167,9 @@ static struct cam_ed *
 		 ata_alloc_device(struct cam_eb *bus, struct cam_et *target,
 				   lun_id_t lun_id);
 static void	 ata_device_transport(struct cam_path *path);
-static void	 scsi_set_transfer_settings(struct ccb_trans_settings *cts,
+static void	 ata_set_transfer_settings(struct ccb_trans_settings *cts,
 					    struct cam_ed *device,
 					    int async_update);
-static void	 scsi_toggle_tags(struct cam_path *path);
 static void	 ata_dev_async(u_int32_t async_code,
 				struct cam_eb *bus,
 				struct cam_et *target,
@@ -717,6 +711,17 @@ noerror:
 
 			path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID;
 		}
+		if (ident_buf->satacapabilities & ATA_SUPPORT_NCQ) {
+			path->device->mintags = path->device->maxtags =
+			    ATA_QUEUE_LEN(ident_buf->queue) + 1;
+		}
+		ata_find_quirk(path->device);
+		/* XXX: If not all tags allowed, we must to tell SIM which are. */
+		if (path->device->mintags < path->bus->sim->max_tagged_dev_openings)
+			path->device->mintags = path->device->maxtags = 0;
+		if (path->device->mintags != 0) {
+			xpt_start_tags(path);
+		}
 		ata_device_transport(path);
 		PROBE_SET_ACTION(softc, PROBE_SETMODE);
 		xpt_release_ccb(done_ccb);
@@ -776,7 +781,6 @@ noerror:
 			return;
 		}
 
-		scsi_find_quirk(path->device);
 		ata_device_transport(path);
 		if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) {
 			path->device->flags &= ~CAM_DEV_UNCONFIGURED;
@@ -853,24 +857,23 @@ probecleanup(struct cam_periph *periph)
 }
 
 static void
-scsi_find_quirk(struct cam_ed *device)
+ata_find_quirk(struct cam_ed *device)
 {
-	struct scsi_quirk_entry *quirk;
+	struct ata_quirk_entry *quirk;
 	caddr_t	match;
 
-	match = cam_quirkmatch((caddr_t)&device->inq_data,
-			       (caddr_t)scsi_quirk_table,
-			       sizeof(scsi_quirk_table) /
-			       sizeof(*scsi_quirk_table),
-			       sizeof(*scsi_quirk_table), scsi_inquiry_match);
+	match = cam_quirkmatch((caddr_t)&device->ident_data,
+			       (caddr_t)ata_quirk_table,
+			       ata_quirk_table_size,
+			       sizeof(*ata_quirk_table), ata_identify_match);
 
 	if (match == NULL)
 		panic("xpt_find_quirk: device didn't match wildcard entry!!");
 
-	quirk = (struct scsi_quirk_entry *)match;
+	quirk = (struct ata_quirk_entry *)match;
 	device->quirk = quirk;
-	device->mintags = quirk->mintags;
-	device->maxtags = quirk->maxtags;
+	if (quirk->quirks & CAM_QUIRK_MAXTAGS)
+		device->mintags = device->maxtags = quirk->maxtags;
 }
 
 typedef struct {
@@ -1101,7 +1104,7 @@ static struct cam_ed *
 ata_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id)
 {
 	struct cam_path path;
-	struct scsi_quirk_entry *quirk;
+	struct ata_quirk_entry *quirk;
 	struct cam_ed *device;
 	struct cam_ed *cur_device;
 
@@ -1113,10 +1116,10 @@ ata_alloc_device(struct cam_eb *bus, str
 	 * Take the default quirk entry until we have inquiry
 	 * data and can determine a better quirk to use.
 	 */
-	quirk = &scsi_quirk_table[scsi_quirk_table_size - 1];
+	quirk = &ata_quirk_table[ata_quirk_table_size - 1];
 	device->quirk = (void *)quirk;
-	device->mintags = quirk->mintags;
-	device->maxtags = quirk->maxtags;
+	device->mintags = 0;
+	device->maxtags = 0;
 	bzero(&device->inq_data, sizeof(device->inq_data));
 	device->inq_flags = 0;
 	device->queue_flags = 0;
@@ -1199,7 +1202,7 @@ ata_action(union ccb *start_ccb)
 	switch (start_ccb->ccb_h.func_code) {
 	case XPT_SET_TRAN_SETTINGS:
 	{
-		scsi_set_transfer_settings(&start_ccb->cts,
+		ata_set_transfer_settings(&start_ccb->cts,
 					   start_ccb->ccb_h.path->device,
 					   /*async_update*/FALSE);
 		break;
@@ -1227,7 +1230,7 @@ ata_action(union ccb *start_ccb)
 }
 
 static void
-scsi_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device,
+ata_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device,
 			   int async_update)
 {
 	struct	ccb_pathinq cpi;
@@ -1379,24 +1382,7 @@ scsi_set_transfer_settings(struct ccb_tr
 				device->tag_delay_count = CAM_TAG_DELAY_COUNT;
 				device->flags |= CAM_DEV_TAG_AFTER_COUNT;
 			} else {
-				struct ccb_relsim crs;
-
-				xpt_freeze_devq(cts->ccb_h.path, /*count*/1);
-		  		device->inq_flags &= ~SID_CmdQue;
-				xpt_dev_ccbq_resize(cts->ccb_h.path,
-						    sim->max_dev_openings);
-				device->flags &= ~CAM_DEV_TAG_AFTER_COUNT;
-				device->tag_delay_count = 0;
-
-				xpt_setup_ccb(&crs.ccb_h, cts->ccb_h.path,
-				    CAM_PRIORITY_NORMAL);
-				crs.ccb_h.func_code = XPT_REL_SIMQ;
-				crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY;
-				crs.openings
-				    = crs.release_timeout
-				    = crs.qfrozen_cnt
-				    = 0;
-				xpt_action((union ccb *)&crs);
+				xpt_stop_tags(cts->ccb_h.path);
 			}
 		}
 	}
@@ -1404,39 +1390,6 @@ scsi_set_transfer_settings(struct ccb_tr
 		(*(sim->sim_action))(sim, (union ccb *)cts);
 }
 
-static void
-scsi_toggle_tags(struct cam_path *path)
-{
-	struct cam_ed *dev;
-
-	/*
-	 * Give controllers a chance to renegotiate
-	 * before starting tag operations.  We
-	 * "toggle" tagged queuing off then on
-	 * which causes the tag enable command delay
-	 * counter to come into effect.
-	 */
-	dev = path->device;
-	if ((dev->flags & CAM_DEV_TAG_AFTER_COUNT) != 0
-	 || ((dev->inq_flags & SID_CmdQue) != 0
- 	  && (dev->inq_flags & (SID_Sync|SID_WBus16|SID_WBus32)) != 0)) {
-		struct ccb_trans_settings cts;
-
-		xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL);
-		cts.protocol = PROTO_SCSI;
-		cts.protocol_version = PROTO_VERSION_UNSPECIFIED;
-		cts.transport = XPORT_UNSPECIFIED;
-		cts.transport_version = XPORT_VERSION_UNSPECIFIED;
-		cts.proto_specific.scsi.flags = 0;
-		cts.proto_specific.scsi.valid = CTS_SCSI_VALID_TQ;
-		scsi_set_transfer_settings(&cts, path->device,
-					  /*async_update*/TRUE);
-		cts.proto_specific.scsi.flags = CTS_SCSI_FLAGS_TAG_ENB;
-		scsi_set_transfer_settings(&cts, path->device,
-					  /*async_update*/TRUE);
-	}
-}
-
 /*
  * Handle any per-device event notifications that require action by the XPT.
  */
@@ -1469,15 +1422,6 @@ ata_dev_async(u_int32_t async_code, stru
 		status = CAM_REQ_CMP_ERR;
 
 	if (status == CAM_REQ_CMP) {
-
-		/*
-		 * Allow transfer negotiation to occur in a
-		 * tag free environment.
-		 */
-		if (async_code == AC_SENT_BDR
-		 || async_code == AC_BUS_RESET)
-			scsi_toggle_tags(&newpath);
-
 		if (async_code == AC_INQ_CHANGED) {
 			/*
 			 * We've sent a start unit command, or
@@ -1498,7 +1442,7 @@ ata_dev_async(u_int32_t async_code, stru
 		struct ccb_trans_settings *settings;
 
 		settings = (struct ccb_trans_settings *)async_arg;
-		scsi_set_transfer_settings(settings, device,
+		ata_set_transfer_settings(settings, device,
 					  /*async_update*/TRUE);
 	}
 }

Modified: head/sys/cam/cam.c
==============================================================================
--- head/sys/cam/cam.c	Wed Nov 11 11:07:30 2009	(r199177)
+++ head/sys/cam/cam.c	Wed Nov 11 11:10:36 2009	(r199178)
@@ -165,8 +165,12 @@ cam_strmatch(const u_int8_t *str, const 
 		str++;
 		str_len--;
 	}
-	while (str_len > 0 && *str++ == ' ')
+	while (str_len > 0 && *str == ' ') {
+		str++;
 		str_len--;
+	}
+	if (str_len > 0 && *str == 0)
+		str_len = 0;
 
 	return (str_len);
 }

Modified: head/sys/cam/cam_ccb.h
==============================================================================
--- head/sys/cam/cam_ccb.h	Wed Nov 11 11:07:30 2009	(r199177)
+++ head/sys/cam/cam_ccb.h	Wed Nov 11 11:10:36 2009	(r199178)
@@ -307,7 +307,7 @@ struct ccb_getdev {
 	struct scsi_inquiry_data inq_data;
 	struct ata_params ident_data;
 	u_int8_t  serial_num[252];
-	u_int8_t  reserved;
+	u_int8_t  inq_flags;
 	u_int8_t  serial_num_len;
 };
 

Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c	Wed Nov 11 11:07:30 2009	(r199177)
+++ head/sys/cam/cam_xpt.c	Wed Nov 11 11:10:36 2009	(r199178)
@@ -285,7 +285,6 @@ static xpt_devicefunc_t	xptsetasyncfunc;
 static xpt_busfunc_t	xptsetasyncbusfunc;
 static cam_status	xptregister(struct cam_periph *periph,
 				    void *arg);
-static void	 xpt_start_tags(struct cam_path *path);
 static __inline int xpt_schedule_dev_allocq(struct cam_eb *bus,
 					    struct cam_ed *dev);
 static __inline int periph_is_queued(struct cam_periph *periph);
@@ -299,12 +298,6 @@ xpt_schedule_dev_allocq(struct cam_eb *b
 	int retval;
 
 	if (dev->ccbq.devq_openings > 0) {
-		if ((dev->flags & CAM_DEV_RESIZE_QUEUE_NEEDED) != 0) {
-			cam_ccbq_resize(&dev->ccbq,
-					dev->ccbq.dev_openings
-					+ dev->ccbq.dev_active);
-			dev->flags &= ~CAM_DEV_RESIZE_QUEUE_NEEDED;
-		}
 		/*
 		 * The priority of a device waiting for CCB resources
 		 * is that of the the highest priority peripheral driver
@@ -321,6 +314,27 @@ xpt_schedule_dev_allocq(struct cam_eb *b
 }
 
 static __inline int
+xpt_schedule_dev_sendq(struct cam_eb *bus, struct cam_ed *dev)
+{
+	int	retval;
+
+	if (dev->ccbq.dev_openings > 0) {
+		/*
+		 * The priority of a device waiting for controller
+		 * resources is that of the the highest priority CCB
+		 * enqueued.
+		 */
+		retval =
+		    xpt_schedule_dev(&bus->sim->devq->send_queue,
+				     &dev->send_ccb_entry.pinfo,
+				     CAMQ_GET_HEAD(&dev->ccbq.queue)->priority);
+	} else {
+		retval = 0;
+	}
+	return (retval);
+}
+
+static __inline int
 periph_is_queued(struct cam_periph *periph)
 {
 	return (periph->pinfo.index != CAM_UNQUEUED_INDEX);
@@ -2657,6 +2671,7 @@ xpt_action_default(union ccb *start_ccb)
 			cgd->protocol = dev->protocol;
 			cgd->inq_data = dev->inq_data;
 			cgd->ident_data = dev->ident_data;
+			cgd->inq_flags = dev->inq_flags;
 			cgd->ccb_h.status = CAM_REQ_CMP;
 			cgd->serial_num_len = dev->serial_num_len;
 			if ((dev->serial_num_len > 0)
@@ -3747,6 +3762,11 @@ xpt_release_ccb(union ccb *free_ccb)
 	mtx_assert(sim->mtx, MA_OWNED);
 
 	cam_ccbq_release_opening(&device->ccbq);
+	if (device->flags & CAM_DEV_RESIZE_QUEUE_NEEDED) {
+		device->flags &= ~CAM_DEV_RESIZE_QUEUE_NEEDED;
+		cam_ccbq_resize(&device->ccbq,
+		    device->ccbq.dev_openings + device->ccbq.dev_active);
+	}
 	if (sim->ccb_count > sim->max_ccbs) {
 		xpt_free_ccb(free_ccb);
 		sim->ccb_count--;
@@ -4573,7 +4593,7 @@ xpt_find_device(struct cam_et *target, l
 	return (device);
 }
 
-static void
+void
 xpt_start_tags(struct cam_path *path)
 {
 	struct ccb_relsim crs;
@@ -4602,6 +4622,30 @@ xpt_start_tags(struct cam_path *path)
 	xpt_action((union ccb *)&crs);
 }
 
+void
+xpt_stop_tags(struct cam_path *path)
+{
+	struct ccb_relsim crs;
+	struct cam_ed *device;
+	struct cam_sim *sim;
+
+	device = path->device;
+	sim = path->bus->sim;
+	device->flags &= ~CAM_DEV_TAG_AFTER_COUNT;
+	device->tag_delay_count = 0;
+	xpt_freeze_devq(path, /*count*/1);
+	device->inq_flags &= ~SID_CmdQue;
+	xpt_dev_ccbq_resize(path, sim->max_dev_openings);
+	xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL);
+	crs.ccb_h.func_code = XPT_REL_SIMQ;
+	crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY;
+	crs.openings
+	    = crs.release_timeout
+	    = crs.qfrozen_cnt
+	    = 0;
+	xpt_action((union ccb *)&crs);
+}
+
 static int busses_to_config;
 static int busses_to_reset;
 

Modified: head/sys/cam/cam_xpt_internal.h
==============================================================================
--- head/sys/cam/cam_xpt_internal.h	Wed Nov 11 11:07:30 2009	(r199177)
+++ head/sys/cam/cam_xpt_internal.h	Wed Nov 11 11:10:36 2009	(r199178)
@@ -176,29 +176,8 @@ void			xpt_run_dev_sendq(struct cam_eb *
 int			xpt_schedule_dev(struct camq *queue, cam_pinfo *dev_pinfo,
 					 u_int32_t new_priority);
 u_int32_t		xpt_dev_ccbq_resize(struct cam_path *path, int newopenings);
-
-
-
-static __inline int
-xpt_schedule_dev_sendq(struct cam_eb *bus, struct cam_ed *dev)
-{
-	int	retval;
-
-	if (dev->ccbq.dev_openings > 0) {
-		/*
-		 * The priority of a device waiting for controller
-		 * resources is that of the the highest priority CCB
-		 * enqueued.
-		 */
-		retval =
-		    xpt_schedule_dev(&bus->sim->devq->send_queue,
-				     &dev->send_ccb_entry.pinfo,
-				     CAMQ_GET_HEAD(&dev->ccbq.queue)->priority);
-	} else {
-		retval = 0;
-	}
-	return (retval);
-}
+void			xpt_start_tags(struct cam_path *path);
+void			xpt_stop_tags(struct cam_path *path);
 
 MALLOC_DECLARE(M_CAMXPT);
 

Modified: head/sys/cam/scsi/scsi_xpt.c
==============================================================================
--- head/sys/cam/scsi/scsi_xpt.c	Wed Nov 11 11:07:30 2009	(r199177)
+++ head/sys/cam/scsi/scsi_xpt.c	Wed Nov 11 11:10:36 2009	(r199178)
@@ -2274,24 +2274,7 @@ scsi_set_transfer_settings(struct ccb_tr
 				device->tag_delay_count = CAM_TAG_DELAY_COUNT;
 				device->flags |= CAM_DEV_TAG_AFTER_COUNT;
 			} else {
-				struct ccb_relsim crs;
-
-				xpt_freeze_devq(cts->ccb_h.path, /*count*/1);
-		  		device->inq_flags &= ~SID_CmdQue;
-				xpt_dev_ccbq_resize(cts->ccb_h.path,
-						    sim->max_dev_openings);
-				device->flags &= ~CAM_DEV_TAG_AFTER_COUNT;
-				device->tag_delay_count = 0;
-
-				xpt_setup_ccb(&crs.ccb_h, cts->ccb_h.path,
-				    CAM_PRIORITY_NORMAL);
-				crs.ccb_h.func_code = XPT_REL_SIMQ;
-				crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY;
-				crs.openings
-				    = crs.release_timeout
-				    = crs.qfrozen_cnt
-				    = 0;
-				xpt_action((union ccb *)&crs);
+				xpt_stop_tags(cts->ccb_h.path);
 			}
 		}
 	}

Modified: head/sys/dev/ahci/ahci.c
==============================================================================
--- head/sys/dev/ahci/ahci.c	Wed Nov 11 11:07:30 2009	(r199177)
+++ head/sys/dev/ahci/ahci.c	Wed Nov 11 11:10:36 2009	(r199178)
@@ -733,7 +733,8 @@ ahci_ch_attach(device_t dev)
 	}
 	/* Construct SIM entry */
 	ch->sim = cam_sim_alloc(ahciaction, ahcipoll, "ahcich", ch,
-	    device_get_unit(dev), &ch->mtx, ch->numslots, 0, devq);
+	    device_get_unit(dev), &ch->mtx,
+	    min(2, ch->numslots), ch->numslots, devq);
 	if (ch->sim == NULL) {
 		device_printf(dev, "unable to allocate sim\n");
 		error = ENOMEM;

Modified: head/sys/dev/siis/siis.c
==============================================================================
--- head/sys/dev/siis/siis.c	Wed Nov 11 11:07:30 2009	(r199177)
+++ head/sys/dev/siis/siis.c	Wed Nov 11 11:10:36 2009	(r199178)
@@ -454,7 +454,7 @@ siis_ch_attach(device_t dev)
 	}
 	/* Construct SIM entry */
 	ch->sim = cam_sim_alloc(siisaction, siispoll, "siisch", ch,
-	    device_get_unit(dev), &ch->mtx, SIIS_MAX_SLOTS, 0, devq);
+	    device_get_unit(dev), &ch->mtx, 2, SIIS_MAX_SLOTS, devq);
 	if (ch->sim == NULL) {
 		device_printf(dev, "unable to allocate sim\n");
 		error = ENOMEM;
From ume at FreeBSD.org  Wed Nov 11 11:24:03 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Wed Nov 11 11:24:09 2009
Subject: svn commit: r199179 - head/share/timedef
Message-ID: <200911111124.nABBO3xY093199@svn.freebsd.org>

Author: ume
Date: Wed Nov 11 11:24:02 2009
New Revision: 199179
URL: http://svn.freebsd.org/changeset/base/199179

Log:
  Add unit to the short month names for Japanese locales.
  Without unit, the output of the application like ls(1)
  is complicated.
  
  Reviewed by:	nork
  MFC after:	1 week

Modified:
  head/share/timedef/ja_JP.SJIS.src
  head/share/timedef/ja_JP.UTF-8.src
  head/share/timedef/ja_JP.eucJP.src

Modified: head/share/timedef/ja_JP.SJIS.src
==============================================================================
--- head/share/timedef/ja_JP.SJIS.src	Wed Nov 11 11:10:36 2009	(r199178)
+++ head/share/timedef/ja_JP.SJIS.src	Wed Nov 11 11:24:02 2009	(r199179)
@@ -5,18 +5,18 @@
 #
 # Short month names
 #
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
+ 1ŒŽ
+ 2ŒŽ
+ 3ŒŽ
+ 4ŒŽ
+ 5ŒŽ
+ 6ŒŽ
+ 7ŒŽ
+ 8ŒŽ
+ 9ŒŽ
+10ŒŽ
+11ŒŽ
+12ŒŽ
 #
 # Long month names (as in a date)
 #

Modified: head/share/timedef/ja_JP.UTF-8.src
==============================================================================
--- head/share/timedef/ja_JP.UTF-8.src	Wed Nov 11 11:10:36 2009	(r199178)
+++ head/share/timedef/ja_JP.UTF-8.src	Wed Nov 11 11:24:02 2009	(r199179)
@@ -4,18 +4,18 @@
 # WARNING: empty lines are essential too
 #
 # Short month names
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
+ 1月
+ 2月
+ 3月
+ 4月
+ 5月
+ 6月
+ 7月
+ 8月
+ 9月
+10月
+11月
+12月
 #
 # Long month names (as in a date)
 #

Modified: head/share/timedef/ja_JP.eucJP.src
==============================================================================
--- head/share/timedef/ja_JP.eucJP.src	Wed Nov 11 11:10:36 2009	(r199178)
+++ head/share/timedef/ja_JP.eucJP.src	Wed Nov 11 11:24:02 2009	(r199179)
@@ -4,18 +4,18 @@
 # WARNING: empty lines are essential too
 #
 # Short month names
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
+ 1·î
+ 2·î
+ 3·î
+ 4·î
+ 5·î
+ 6·î
+ 7·î
+ 8·î
+ 9·î
+10·î
+11·î
+12·î
 #
 # Long month names (as in a date)
 #
From roam at FreeBSD.org  Wed Nov 11 11:31:03 2009
From: roam at FreeBSD.org (Peter Pentchev)
Date: Wed Nov 11 11:31:15 2009
Subject: svn commit: r199180 - head/lib/libc/locale
Message-ID: <200911111131.nABBV2G7093392@svn.freebsd.org>

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

Log:
  Fix the grammar as in the PR, and then some.
  
  PR:		140454
  Submitted by:	Jeremy Huddleston 
  MFC after:	2 weeks

Modified:
  head/lib/libc/locale/isblank.3

Modified: head/lib/libc/locale/isblank.3
==============================================================================
--- head/lib/libc/locale/isblank.3	Wed Nov 11 11:24:02 2009	(r199179)
+++ head/lib/libc/locale/isblank.3	Wed Nov 11 11:31:02 2009	(r199180)
@@ -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 11 11:37:44 2009
From: roam at FreeBSD.org (Peter Pentchev)
Date: Wed Nov 11 11:37:51 2009
Subject: svn commit: r199181 - head/share/misc
Message-ID: <200911111137.nABBbhWu093567@svn.freebsd.org>

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

Log:
  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 
  MFC after:	2 weeks

Modified:
  head/share/misc/organization.dot

Modified: head/share/misc/organization.dot
==============================================================================
--- head/share/misc/organization.dot	Wed Nov 11 11:31:02 2009	(r199180)
+++ head/share/misc/organization.dot	Wed Nov 11 11:37:43 2009	(r199181)
@@ -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 brde at optusnet.com.au  Wed Nov 11 12:23:20 2009
From: brde at optusnet.com.au (Bruce Evans)
Date: Wed Nov 11 12:23:27 2009
Subject: svn commit: r198848 - head/bin/ps
In-Reply-To: <4AF4B6B2.3090706@delphij.net>
References: <200911030928.nA39SjLx085597@svn.freebsd.org>
	<20091103214231.H23957@delplex.bde.org> <4AF4B6B2.3090706@delphij.net>
Message-ID: <20091111230915.B3510@besplex.bde.org>

On Fri, 6 Nov 2009, Xin LI wrote:

> Bruce Evans wrote:
>> On Tue, 3 Nov 2009, Xin LI wrote:
>>
>>> Log:
>>>  Increase width for %CPU, RSS and VSZ columns for now.  Modern systems
>>>  tend to have larger memory, larger process, and more CPU.
>>
>> This uses space that is not available.  Command names(+args) are now
>> truncated to 9 columns in "ps l" output :-(.  They used to be truncated to
>> 11 columns recently (down from 12 columns in FreeBSD-5.2).
>
> I think we may have to live with this, even if we can cut down CPU
> percentage part, the memory column's width is still too narrow for
> modern systems.

Still only for modern systems running bloatware, and ps looking at the
bloatware.

> I have actually thought about having the numbers
> humanized but I'm afraid it would break some existing scripts :(

Maybe there should be a special mode for scripts.  Scripts shouldn't
care about the whitespace formatting (they should detect fields using
field separators and not specific columns).

> [...]
>> There seems to be no better fix than to further granulate and dehumanize
>> the numbers so that they fit in the available space.  E.g., a %CPU of
>>> = 100 and < 9999 should be displayed in %4.0f format; this only
>> involvues granulation, but above 9999 it needs to be dehumanized as
>> well and displayed in k or M or larger granularity (it can be > 9999
>> with 100 CPUs and > 999k with 10000 CPUs).  A VSZ of >= 10000 (k
>> implicit) needs to be displayed in M or larger granularity (M explicit).
>
> Will it sound reasonable to divide pcpu by ncpu and cap the number at 100?

I don't like that.  It would break scripts even more than units changes.
It is hard for users to interpret too.  Suddenly, processes taking
100% of 1 CPU would take 12.5% of 8 CPUs on a system with 8 CPUs, and
different %CPU on systems with a different number of CPUs.  Users would
need to know the number of CPUs and convert back.  This is too surprising,
especially for unthreaded processes.  OTOH, users must already be used
to seeing %CPU > 100 and dividing by the number of CPUs to get a more
easy to understand number for threaded processes.

Just print %CPU in %4.0f format when it is >= 99.5 (or whatever rounds
to 100.0).  This works up to 999.5 %CPU.

Bruce
From trasz at FreeBSD.org  Wed Nov 11 12:55:59 2009
From: trasz at FreeBSD.org (Edward Tomasz Napierala)
Date: Wed Nov 11 12:56:10 2009
Subject: svn commit: r199182 - head/sbin/mount
Message-ID: <200911111255.nABCtxUV095274@svn.freebsd.org>

Author: trasz
Date: Wed Nov 11 12:55:58 2009
New Revision: 199182
URL: http://svn.freebsd.org/changeset/base/199182

Log:
  Add links to zfs(8) and zpool(8) to mount(8) manual page.

Modified:
  head/sbin/mount/mount.8

Modified: head/sbin/mount/mount.8
==============================================================================
--- head/sbin/mount/mount.8	Wed Nov 11 11:37:43 2009	(r199181)
+++ head/sbin/mount/mount.8	Wed Nov 11 12:55:58 2009	(r199182)
@@ -527,7 +527,9 @@ support for a particular file system mig
 .Xr mount_smbfs 8 ,
 .Xr mount_udf 8 ,
 .Xr mount_unionfs 8 ,
-.Xr umount 8
+.Xr umount 8 ,
+.Xr zfs 8 ,
+.Xr zpool 8
 .Sh CAVEATS
 After a successful
 .Nm ,
From trasz at FreeBSD.org  Wed Nov 11 13:49:23 2009
From: trasz at FreeBSD.org (Edward Tomasz Napierala)
Date: Wed Nov 11 13:49:30 2009
Subject: svn commit: r199183 - head/sys/kern
Message-ID: <200911111349.nABDnMQh096358@svn.freebsd.org>

Author: trasz
Date: Wed Nov 11 13:49:22 2009
New Revision: 199183
URL: http://svn.freebsd.org/changeset/base/199183

Log:
  Revert r198873.  Having different VAPPEND semantics for VOP_ACCESS(9)
  and VOP_ACCESSX(9) is not a good idea.

Modified:
  head/sys/kern/vfs_default.c

Modified: head/sys/kern/vfs_default.c
==============================================================================
--- head/sys/kern/vfs_default.c	Wed Nov 11 12:55:58 2009	(r199182)
+++ head/sys/kern/vfs_default.c	Wed Nov 11 13:49:22 2009	(r199183)
@@ -353,14 +353,6 @@ vop_stdaccessx(struct vop_accessx_args *
 	if (accmode == 0)
 		return (0);
 
-	/*
-	 * Many VOP_APPEND implementations don't expect VAPPEND without VWRITE
-	 * being set, e.g. they check whether the filesystem is read-only only
-	 * when VWRITE is set.  Make sure we don't confuse them.
-	 */
-	if (accmode & VAPPEND)
-		accmode |= VWRITE;
-
 	return (VOP_ACCESS(ap->a_vp, accmode, ap->a_cred, ap->a_td));
 }
 
From avg at FreeBSD.org  Wed Nov 11 14:21:32 2009
From: avg at FreeBSD.org (Andriy Gapon)
Date: Wed Nov 11 14:21:39 2009
Subject: svn commit: r199184 - in head/sys: amd64/amd64 i386/i386 i386/xen
Message-ID: <200911111421.nABELWKu097089@svn.freebsd.org>

Author: avg
Date: Wed Nov 11 14:21:31 2009
New Revision: 199184
URL: http://svn.freebsd.org/changeset/base/199184

Log:
  reflect that pg_ps_enabled is a tunable, not just a read-only sysctl
  
  Nod from:	jhb

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c
  head/sys/i386/xen/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Wed Nov 11 13:49:22 2009	(r199183)
+++ head/sys/amd64/amd64/pmap.c	Wed Nov 11 14:21:31 2009	(r199184)
@@ -183,7 +183,7 @@ static int pat_works = 0;		/* Is page at
 SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters");
 
 static int pg_ps_enabled = 1;
-SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RD, &pg_ps_enabled, 0,
+SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0,
     "Are large page mappings enabled?");
 
 static u_int64_t	KPTphys;	/* phys addr of kernel level 1 */

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Wed Nov 11 13:49:22 2009	(r199183)
+++ head/sys/i386/i386/pmap.c	Wed Nov 11 14:21:31 2009	(r199184)
@@ -217,7 +217,7 @@ static int pat_works = 0;		/* Is page at
 SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters");
 
 static int pg_ps_enabled;
-SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RD, &pg_ps_enabled, 0,
+SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0,
     "Are large page mappings enabled?");
 
 /*

Modified: head/sys/i386/xen/pmap.c
==============================================================================
--- head/sys/i386/xen/pmap.c	Wed Nov 11 13:49:22 2009	(r199183)
+++ head/sys/i386/xen/pmap.c	Wed Nov 11 14:21:31 2009	(r199184)
@@ -279,7 +279,7 @@ static struct mtx PMAP2mutex;
 
 SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters");
 static int pg_ps_enabled;
-SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RD, &pg_ps_enabled, 0,
+SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0,
     "Are large page mappings enabled?");
 
 SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_max, CTLFLAG_RD, &pv_entry_max, 0,
From antoine at FreeBSD.org  Wed Nov 11 14:58:49 2009
From: antoine at FreeBSD.org (Antoine Brodin)
Date: Wed Nov 11 14:58:55 2009
Subject: svn commit: r199186 - head/sys/net80211
Message-ID: <200911111458.nABEwnVr098185@svn.freebsd.org>

Author: antoine
Date: Wed Nov 11 14:58:48 2009
New Revision: 199186
URL: http://svn.freebsd.org/changeset/base/199186

Log:
  Fix off by one in ieee80211_send_action_register
  
  Found by:	phk's FlexeLint in September
  Reviewed by:	rpaulo@
  MFC after:	1 month

Modified:
  head/sys/net80211/ieee80211_action.c

Modified: head/sys/net80211/ieee80211_action.c
==============================================================================
--- head/sys/net80211/ieee80211_action.c	Wed Nov 11 14:38:45 2009	(r199185)
+++ head/sys/net80211/ieee80211_action.c	Wed Nov 11 14:58:48 2009	(r199186)
@@ -105,7 +105,7 @@ ieee80211_send_action_register(int cat, 
 		meshlm_send_action[act] = f;
 		return 0;
 	case IEEE80211_ACTION_CAT_MESHPATH:
-		if (act > N(hwmp_send_action))
+		if (act >= N(hwmp_send_action))
 			break;
 		hwmp_send_action[act] = f;
 		return 0;
From antoine at FreeBSD.org  Wed Nov 11 15:00:56 2009
From: antoine at FreeBSD.org (Antoine Brodin)
Date: Wed Nov 11 15:01:02 2009
Subject: svn commit: r199187 - head/sys/net80211
Message-ID: <200911111500.nABF0u6T098315@svn.freebsd.org>

Author: antoine
Date: Wed Nov 11 15:00:56 2009
New Revision: 199187
URL: http://svn.freebsd.org/changeset/base/199187

Log:
  Remove trailing ";" in struct ieee80211_beacon_offsets declaration
  
  Found by:	phk's FlexeLint in September
  Reviewed by:	rpaulo@
  MFC after:	1 month

Modified:
  head/sys/net80211/ieee80211_proto.h

Modified: head/sys/net80211/ieee80211_proto.h
==============================================================================
--- head/sys/net80211/ieee80211_proto.h	Wed Nov 11 14:58:48 2009	(r199186)
+++ head/sys/net80211/ieee80211_proto.h	Wed Nov 11 15:00:56 2009	(r199187)
@@ -315,7 +315,7 @@ struct ieee80211_beacon_offsets {
 	uint8_t		*bo_ath;	/* start of ATH parameters */
 	uint8_t		*bo_appie;	/* start of AppIE element */
 	uint16_t	bo_appie_len;	/* AppIE length in bytes */
-	uint16_t	bo_csa_trailer_len;;
+	uint16_t	bo_csa_trailer_len;
 	uint8_t		*bo_csa;	/* start of CSA element */
 	uint8_t		*bo_meshconf;	/* start of MESHCONF element */
 	uint8_t		*bo_spare[3];
From ume at FreeBSD.org  Wed Nov 11 15:21:07 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Wed Nov 11 15:21:17 2009
Subject: svn commit: r199188 - head/lib/libc/net
Message-ID: <200911111521.nABFL7tD098771@svn.freebsd.org>

Author: ume
Date: Wed Nov 11 15:21:06 2009
New Revision: 199188
URL: http://svn.freebsd.org/changeset/base/199188

Log:
  ANSIfy.
  
  MFC after:	1 week

Modified:
  head/lib/libc/net/ip6opt.c

Modified: head/lib/libc/net/ip6opt.c
==============================================================================
--- head/lib/libc/net/ip6opt.c	Wed Nov 11 15:00:56 2009	(r199187)
+++ head/lib/libc/net/ip6opt.c	Wed Nov 11 15:21:06 2009	(r199188)
@@ -55,8 +55,7 @@ static void inet6_insert_padopt(u_char *
  * byte, the length byte, and the option data.
  */
 int
-inet6_option_space(nbytes)
-	int nbytes;
+inet6_option_space(int nbytes)
 {
 	nbytes += 2;	/* we need space for nxt-hdr and length fields */
 	return(CMSG_SPACE((nbytes + 7) & ~7));
@@ -68,10 +67,7 @@ inet6_option_space(nbytes)
  * success or -1 on an error.
  */
 int
-inet6_option_init(bp, cmsgp, type)
-	void *bp;
-	struct cmsghdr **cmsgp;
-	int type;
+inet6_option_init(void *bp, struct cmsghdr **cmsgp, int type)
 {
 	struct cmsghdr *ch = (struct cmsghdr *)bp;
 
@@ -98,11 +94,8 @@ inet6_option_init(bp, cmsgp, type)
  * earlier.  It must have a value between 0 and 7, inclusive.
  */
 int
-inet6_option_append(cmsg, typep, multx, plusy)
-	struct cmsghdr *cmsg;
-	const u_int8_t *typep;
-	int multx;
-	int plusy;
+inet6_option_append(struct cmsghdr *cmsg, const u_int8_t *typep, int multx,
+    int plusy)
 {
 	int padlen, optlen, off;
 	u_char *bp = (u_char *)cmsg + cmsg->cmsg_len;
@@ -171,11 +164,7 @@ inet6_option_append(cmsg, typep, multx, 
  * 
  */
 u_int8_t *
-inet6_option_alloc(cmsg, datalen, multx, plusy)
-	struct cmsghdr *cmsg;
-	int datalen;
-	int multx;
-	int plusy;
+inet6_option_alloc(struct cmsghdr *cmsg, int datalen, int multx, int plusy)
 {
 	int padlen, off;
 	u_int8_t *bp = (u_char *)cmsg + cmsg->cmsg_len;
@@ -238,9 +227,7 @@ inet6_option_alloc(cmsg, datalen, multx,
  * (RFC 2292, 6.3.5)
  */
 int
-inet6_option_next(cmsg, tptrp)
-	const struct cmsghdr *cmsg;
-	u_int8_t **tptrp;
+inet6_option_next(const struct cmsghdr *cmsg, u_int8_t **tptrp)
 {
 	struct ip6_ext *ip6e;
 	int hdrlen, optlen;
@@ -296,10 +283,7 @@ inet6_option_next(cmsg, tptrp)
  *       it's a typo. The variable should be type of u_int8_t **.
  */
 int
-inet6_option_find(cmsg, tptrp, type)
-	const struct cmsghdr *cmsg;
-	u_int8_t **tptrp;
-	int type;
+inet6_option_find(const struct cmsghdr *cmsg, u_int8_t **tptrp, int type)
 {
 	struct ip6_ext *ip6e;
 	int hdrlen, optlen;
@@ -352,8 +336,7 @@ inet6_option_find(cmsg, tptrp, type)
  * calculated length and the limitation of the buffer.
  */
 static int
-ip6optlen(opt, lim)
-	u_int8_t *opt, *lim;
+ip6optlen(u_int8_t *opt, u_int8_t *lim)
 {
 	int optlen;
 
From jh at FreeBSD.org  Wed Nov 11 15:43:08 2009
From: jh at FreeBSD.org (Jaakko Heinonen)
Date: Wed Nov 11 15:43:20 2009
Subject: svn commit: r199189 - head/sys/fs/nfsclient
Message-ID: <200911111543.nABFh7NU099306@svn.freebsd.org>

Author: jh
Date: Wed Nov 11 15:43:07 2009
New Revision: 199189
URL: http://svn.freebsd.org/changeset/base/199189

Log:
  Create verifier used by FreeBSD NFS client is suboptimal because the
  first part of a verifier is set to the first IP address from
  V_in_ifaddrhead list. This address is typically the loopback address
  making the first part of the verifier practically non-unique. The second
  part of the verifier is initialized to zero making its initial value
  non-unique too.
  
  This commit changes the strategy for create verifier initialization:
  just initialize it to a random value. Also move verifier handling into
  its own function and use a mutex to protect the variable.
  
  This change is a candidate for porting to sys/nfsclient.
  
  Reviewed by:	jhb, rmacklem
  Approved by:	trasz (mentor)

Modified:
  head/sys/fs/nfsclient/nfs_clvnops.c

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvnops.c	Wed Nov 11 15:21:06 2009	(r199188)
+++ head/sys/fs/nfsclient/nfs_clvnops.c	Wed Nov 11 15:43:07 2009	(r199189)
@@ -1365,7 +1365,30 @@ nfs_mknod(struct vop_mknod_args *ap)
 	return (nfs_mknodrpc(ap->a_dvp, ap->a_vpp, ap->a_cnp, ap->a_vap));
 }
 
-static u_long create_verf;
+static struct mtx nfs_cverf_mtx;
+MTX_SYSINIT(nfs_cverf_mtx, &nfs_cverf_mtx, "NFS create verifier mutex",
+    MTX_DEF);
+
+static nfsquad_t
+nfs_get_cverf(void)
+{
+	static nfsquad_t cverf;
+	nfsquad_t ret;
+	static int cverf_initialized = 0;
+
+	mtx_lock(&nfs_cverf_mtx);
+	if (cverf_initialized == 0) {
+		cverf.lval[0] = arc4random();
+		cverf.lval[1] = arc4random();
+		cverf_initialized = 1;
+	} else
+		cverf.qval++;
+	ret = cverf;
+	mtx_unlock(&nfs_cverf_mtx);
+
+	return (ret);
+}
+
 /*
  * nfs file create call
  */
@@ -1405,19 +1428,7 @@ again:
 	}
 	mtx_unlock(&dnp->n_mtx);
 
-#ifdef INET
-	CURVNET_SET(CRED_TO_VNET(cnp->cn_cred));
-	IN_IFADDR_RLOCK();
-	if (!TAILQ_EMPTY(&V_in_ifaddrhead))
-		cverf.lval[0] = IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr.s_addr;
-	else
-#endif
-		cverf.lval[0] = create_verf;
-#ifdef INET
-	IN_IFADDR_RUNLOCK();
-	CURVNET_RESTORE();
-#endif
-	cverf.lval[1] = ++create_verf;
+	cverf = nfs_get_cverf();
 	error = nfsrpc_create(dvp, cnp->cn_nameptr, cnp->cn_namelen,
 	    vap, cverf, fmode, cnp->cn_cred, cnp->cn_thread, &dnfsva, &nfsva,
 	    &nfhp, &attrflag, &dattrflag, NULL);
From rene at FreeBSD.org  Wed Nov 11 18:28:13 2009
From: rene at FreeBSD.org (Rene Ladan)
Date: Wed Nov 11 18:28:24 2009
Subject: svn commit: r199190 - head/lib/libc/nls
Message-ID: <200911111828.nABISDWD003046@svn.freebsd.org>

Author: rene (doc committer)
Date: Wed Nov 11 18:28:12 2009
New Revision: 199190
URL: http://svn.freebsd.org/changeset/base/199190

Log:
  Synchronize with C.msg revision 199083 and improve some existing messages.
  
  Reviewed by:	remko
  Approved by:	remko

Modified:
  head/lib/libc/nls/nl_NL.ISO8859-1.msg

Modified: head/lib/libc/nls/nl_NL.ISO8859-1.msg
==============================================================================
--- head/lib/libc/nls/nl_NL.ISO8859-1.msg	Wed Nov 11 15:43:07 2009	(r199189)
+++ head/lib/libc/nls/nl_NL.ISO8859-1.msg	Wed Nov 11 18:28:12 2009	(r199190)
@@ -26,7 +26,7 @@ $ EBADF
 $ ECHILD
 10 Geen kindprocessen
 $ EDEADLK
-11 Een deadlock is vermeden
+11 Een deadlock op een bron is vermeden
 $ ENOMEM
 12 Kan geen geheugen meer verkrijgen
 $ EACCES
@@ -40,13 +40,13 @@ $ EBUSY
 $ EEXIST
 17 Bestand bestaat reeds
 $ EXDEV
-18 Verwijzing tussen bestanden op verschillende bestandssystemen
+18 Verwijzing tussen verschillende apparaten
 $ ENODEV
 19 Bewerking wordt niet ondersteund door dit apparaat
 $ ENOTDIR
 20 Dit is geen map
 $ EISDIR
-21 Dit is een map 
+21 Dit is een map
 $ EINVAL
 22 Ongeldig argument
 $ ENFILE
@@ -62,7 +62,7 @@ $ EFBIG
 $ ENOSPC
 28 Geen ruimte meer op dit apparaat
 $ ESPIPE
-29 Onuitvoerbare zoekopdracht
+29 Ongeldige zoekopdracht
 $ EROFS
 30 Van dit bestandssysteem kan alleen worden gelezen
 $ EMLINK
@@ -84,7 +84,7 @@ $ ENOTSOCK
 $ EDESTADDRREQ
 39 Een bestemmingsadres is vereist
 $ EMSGSIZE
-40 Te grote bericht
+40 Te groot bericht
 $ EPROTOTYPE
 41 Protocol past niet bij dit contactpunt
 $ ENOPROTOOPT
@@ -116,7 +116,7 @@ $ ECONNRESET
 $ ENOBUFS
 55 Geen bufferruimte meer beschikbaar
 $ EISCONN
-56 Dit contactpunt is al verbonden
+56 Contactpunt is al verbonden
 $ ENOTCONN
 57 Contactpunt is niet verbonden
 $ ESHUTDOWN
@@ -136,9 +136,9 @@ $ EHOSTDOWN
 $ EHOSTUNREACH
 65 Bestemming niet bereikbaar
 $ ENOTEMPTY
-66 Directory is niet leeg
+66 Map is niet leeg
 $ EPROCLIM
-67 Te veel taken
+67 Te veel processen
 $ EUSERS
 68 Te veel gebruikers
 $ EDQUOT
@@ -160,7 +160,7 @@ $ EPROCUNAVAIL
 $ ENOLCK
 77 Geen sloten beschikbaar
 $ ENOSYS
-78 Deze systeemfunctie is niet geimplementeerd
+78 Systeemfunctie is niet geimplementeerd
 $ EFTYPE
 79 Bestandsformaat niet van toepassing
 $ EAUTH
@@ -173,30 +173,24 @@ $ ENOMSG
 83 Geen bericht van het gewenste type
 $ EOVERFLOW
 84 Waarde te groot om te bewaren in gegevenstype
-$ EILSEQ
-85 Ongeldige bytereeks
-$ ENOTSUP
-86 Niet ondersteund
 $ ECANCELED
-87 Bewerking geannuleerd
-$ EBADMSG
-88 Verkeerd of defect bericht
-$ ENODATA
-89 Geen bericht beschikbaar
-$ ENOSR
-90 Geen STREAM-voorraad
-$ ENOSTR
-91 Dit is geen STREAM
-$ ETIME
-92 STREAM-ioctl verlopen
+85 Bewerking geannuleerd
+$ EILSEQ
+86 Ongeldige bytereeks
 $ ENOATTR
-93 Attribuut niet gevonden
+87 Attribuut niet gevonden
+$ EDOOFUS
+88 Programmeerfout
+$ EBADMSG
+89 Verkeerd of defect bericht
 $ EMULTIHOP
-94 Multihopverzoek
+90 Multihopverzoek
 $ ENOLINK
-95 Verbinding werd verstoord
+91 Verbinding werd verstoord
 $ EPROTO
-96 Protocolfout
+92 Protocolfout
+$ ENOTCAPABLE
+93 Onvoldoende mogelijkheden
 $
 $ strsignal() support catalog
 $
@@ -263,5 +257,38 @@ $ SIGUSR1
 30 Gebruikersignaal 1
 $ SIGUSR2
 31 Gebruikersignaal 2
-$ SIGPWR
-32 Stroomuitval/stroominschakeling
+$
+$ gai_strerror() support catalog
+$set 3
+$ 1 (obsolete)
+1 Adresfamilie voor hostnaam niet ondersteund
+$ EAI_AGAIN
+2 Tijdelijke fout in naamresolutie
+$ EAI_BADFLAGS
+3 Ongeldige waarde voor ai_flags
+$ EAI_FAIL
+4 Onherstelbare fout in naamresolutie
+$ EAI_FAMILY
+5 ai_familie niet ondersteund
+$ EAI_MEMORY
+6 Geheugenallocatiefout
+$ 7 (obsolete)
+7 Geen adres met hostnaam geassocieerd
+$ EAI_NONAME
+8 hostname noch servname gegeven, of onbekend
+$ EAI_SERVICE
+9 servname niet ondersteund voor ai_socktype
+$ EAI_SOCKTYPE
+10 ai_socktype niet ondersteund
+$ EAI_SYSTEM
+11 Systeemfout geretourneerd in errno
+$ EAI_BADHINTS
+12 Ongeldige waarde voor hints
+$ EAI_PROTOCOL
+13 Opgelost protocol is onbekend
+$ EAI_OVERFLOW
+14 Argumentbuffer overstroomd
+$ 0
+32766 Succes
+$ NL_MSGMAX
+32767 Onbekende fout
From jfv at FreeBSD.org  Wed Nov 11 19:13:40 2009
From: jfv at FreeBSD.org (Jack F Vogel)
Date: Wed Nov 11 19:13:52 2009
Subject: svn commit: r199192 - head/sys/dev/e1000
Message-ID: <200911111913.nABJDewR004319@svn.freebsd.org>

Author: jfv
Date: Wed Nov 11 19:13:40 2009
New Revision: 199192
URL: http://svn.freebsd.org/changeset/base/199192

Log:
  With an i386 kernel the igb driver can cause a
  page fault panic on initialization due to a large
  number of bounce pages being allocated. This is due
  to the dma tag requiring page alignment on mbuf mapping.
  This was removed some time back from the ixgbe driver
  and is not needed here either.

Modified:
  head/sys/dev/e1000/if_igb.c

Modified: head/sys/dev/e1000/if_igb.c
==============================================================================
--- head/sys/dev/e1000/if_igb.c	Wed Nov 11 19:00:12 2009	(r199191)
+++ head/sys/dev/e1000/if_igb.c	Wed Nov 11 19:13:40 2009	(r199192)
@@ -2654,7 +2654,7 @@ igb_dma_malloc(struct adapter *adapter, 
 	int error;
 
 	error = bus_dma_tag_create(bus_get_dma_tag(adapter->dev), /* parent */
-				IGB_DBA_ALIGN, 0,	/* alignment, bounds */
+				1, 0,			/* alignment, bounds */
 				BUS_SPACE_MAXADDR,	/* lowaddr */
 				BUS_SPACE_MAXADDR,	/* highaddr */
 				NULL, NULL,		/* filter, filterarg */
@@ -2867,7 +2867,7 @@ igb_allocate_transmit_buffers(struct tx_
 	 * Setup DMA descriptor areas.
 	 */
 	if ((error = bus_dma_tag_create(NULL,		/* parent */
-			       PAGE_SIZE, 0,		/* alignment, bounds */
+			       1, 0,			/* alignment, bounds */
 			       BUS_SPACE_MAXADDR,	/* lowaddr */
 			       BUS_SPACE_MAXADDR,	/* highaddr */
 			       NULL, NULL,		/* filter, filterarg */
@@ -3554,7 +3554,7 @@ igb_allocate_receive_buffers(struct rx_r
 	** it may not always use this.
 	*/
 	if ((error = bus_dma_tag_create(NULL,		/* parent */
-				   PAGE_SIZE, 0,	/* alignment, bounds */
+				   1, 0,		/* alignment, bounds */
 				   BUS_SPACE_MAXADDR,	/* lowaddr */
 				   BUS_SPACE_MAXADDR,	/* highaddr */
 				   NULL, NULL,		/* filter, filterarg */
From antoine at FreeBSD.org  Wed Nov 11 19:39:45 2009
From: antoine at FreeBSD.org (Antoine Brodin)
Date: Wed Nov 11 19:40:35 2009
Subject: svn commit: r199193 - head/sys/boot/uboot/lib
Message-ID: <200911111939.nABJdjFB004854@svn.freebsd.org>

Author: antoine
Date: Wed Nov 11 19:39:45 2009
New Revision: 199193
URL: http://svn.freebsd.org/changeset/base/199193

Log:
  - Remove trailing ";" after if statement
  - Remove #if 0 section that was never needed/used
  
  Reviewed by:	raj@
  MFC after:	1 month

Modified:
  head/sys/boot/uboot/lib/glue.c

Modified: head/sys/boot/uboot/lib/glue.c
==============================================================================
--- head/sys/boot/uboot/lib/glue.c	Wed Nov 11 19:13:40 2009	(r199192)
+++ head/sys/boot/uboot/lib/glue.c	Wed Nov 11 19:39:45 2009	(r199193)
@@ -467,7 +467,7 @@ ub_stor_type(int type)
 	if (type & DT_STOR_USB)
 		return ("USB");
 
-	if (type & DT_STOR_MMC);
+	if (type & DT_STOR_MMC)
 		return ("MMC");
 
 	return ("Unknown");
@@ -581,11 +581,6 @@ ub_env_enum(const char *last)
 	if (!env)
 		/* no more env. variables to enumerate */
 		return (NULL);
-#if 0
-	if (last && strncmp(env, last, strlen(last)) == 0);
-		/* error, trying to enumerate non existing env. variable */
-		return NULL;
-#endif
 
 	/* next enumerated env var */
 	memset(env_name, 0, 256);
From jhb at FreeBSD.org  Wed Nov 11 20:27:53 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Wed Nov 11 20:28:05 2009
Subject: svn commit: r199197 - head/sys/dev/bwi
Message-ID: <200911112027.nABKRriX005987@svn.freebsd.org>

Author: jhb
Date: Wed Nov 11 20:27:53 2009
New Revision: 199197
URL: http://svn.freebsd.org/changeset/base/199197

Log:
  Use a dedicated callout to drive the transmit watchdog timer instead of
  using if_watchdog and if_timer.
  
  Tested by:	gavin

Modified:
  head/sys/dev/bwi/if_bwi.c
  head/sys/dev/bwi/if_bwivar.h

Modified: head/sys/dev/bwi/if_bwi.c
==============================================================================
--- head/sys/dev/bwi/if_bwi.c	Wed Nov 11 20:00:57 2009	(r199196)
+++ head/sys/dev/bwi/if_bwi.c	Wed Nov 11 20:27:53 2009	(r199197)
@@ -106,7 +106,7 @@ static void	bwi_start(struct ifnet *);
 static void	bwi_start_locked(struct ifnet *);
 static int	bwi_raw_xmit(struct ieee80211_node *, struct mbuf *,
 			const struct ieee80211_bpf_params *);
-static void	bwi_watchdog(struct ifnet *);
+static void	bwi_watchdog(void *);
 static void	bwi_scan_start(struct ieee80211com *);
 static void	bwi_set_channel(struct ieee80211com *);
 static void	bwi_scan_end(struct ieee80211com *);
@@ -464,10 +464,10 @@ bwi_attach(struct bwi_softc *sc)
 	ifp->if_init = bwi_init;
 	ifp->if_ioctl = bwi_ioctl;
 	ifp->if_start = bwi_start;
-	ifp->if_watchdog = bwi_watchdog;
 	IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
 	ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
 	IFQ_SET_READY(&ifp->if_snd);
+	callout_init_mtx(&sc->sc_watchdog_timer, &sc->sc_mtx, 0);
 
 	/*
 	 * Setup ratesets, phytype, channels and get MAC address
@@ -581,6 +581,7 @@ bwi_detach(struct bwi_softc *sc)
 	bwi_stop(sc, 1);
 	callout_drain(&sc->sc_led_blink_ch);
 	callout_drain(&sc->sc_calib_ch);
+	callout_drain(&sc->sc_watchdog_timer);
 	ieee80211_ifdetach(ic);
 
 	for (i = 0; i < sc->sc_nmac; ++i)
@@ -1295,6 +1296,7 @@ bwi_init_statechg(struct bwi_softc *sc, 
 	sc->sc_flags &= ~BWI_F_STOP;
 
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
+	callout_reset(&sc->sc_watchdog_timer, hz, bwi_watchdog, sc);
 
 	/* Enable intrs */
 	bwi_enable_intrs(sc, BWI_INIT_INTRS);
@@ -1433,7 +1435,7 @@ bwi_start_locked(struct ifnet *ifp)
 	tbd->tbd_idx = idx;
 
 	if (trans)
-		ifp->if_timer = 5;
+		sc->sc_tx_timer = 5;
 }
 
 static int
@@ -1474,7 +1476,7 @@ bwi_raw_xmit(struct ieee80211_node *ni, 
 		if (++tbd->tbd_used + BWI_TX_NSPRDESC >= BWI_TX_NDESC)
 			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 		tbd->tbd_idx = (idx + 1) % BWI_TX_NDESC;
-		ifp->if_timer = 5;
+		sc->sc_tx_timer = 5;
 	} else {
 		/* NB: m is reclaimed on encap failure */
 		ieee80211_free_node(ni);
@@ -1485,17 +1487,20 @@ bwi_raw_xmit(struct ieee80211_node *ni, 
 }
 
 static void
-bwi_watchdog(struct ifnet *ifp)
+bwi_watchdog(void *arg)
 {
-	struct bwi_softc *sc = ifp->if_softc;
+	struct bwi_softc *sc;
+	struct ifnet *ifp;
 
-	BWI_LOCK(sc);
-	if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+	sc = arg;
+	ifp = sc->sc_ifp;
+	BWI_ASSERT_LOCKED(sc);
+	if (sc->sc_tx_timer != 0 && --sc->sc_tx_timer == 0) {
 		if_printf(ifp, "watchdog timeout\n");
 		ifp->if_oerrors++;
 		taskqueue_enqueue(sc->sc_tq, &sc->sc_restart_task);
 	}
-	BWI_UNLOCK(sc);
+	callout_reset(&sc->sc_watchdog_timer, hz, bwi_watchdog, sc);
 }
 
 static void
@@ -1551,7 +1556,7 @@ bwi_stop_locked(struct bwi_softc *sc, in
 		bwi_bbp_power_off(sc);
 
 	sc->sc_tx_timer = 0;
-	ifp->if_timer = 0;
+	callout_stop(&sc->sc_watchdog_timer);
 	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
 }
 
@@ -3420,7 +3425,7 @@ _bwi_txeof(struct bwi_softc *sc, uint16_
 	tb->tb_mbuf = NULL;
 
 	if (tbd->tbd_used == 0)
-		ifp->if_timer = 0;
+		sc->sc_tx_timer = 0;
 
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 }
@@ -3922,7 +3927,7 @@ bwi_led_attach(struct bwi_softc *sc)
 			"%dth led, act %d, lowact %d\n", i,
 			led->l_act, led->l_flags & BWI_LED_F_ACTLOW);
 	}
-	callout_init(&sc->sc_led_blink_ch, CALLOUT_MPSAFE);
+	callout_init_mtx(&sc->sc_led_blink_ch, &sc->sc_mtx, 0);
 }
 
 static __inline uint16_t

Modified: head/sys/dev/bwi/if_bwivar.h
==============================================================================
--- head/sys/dev/bwi/if_bwivar.h	Wed Nov 11 20:00:57 2009	(r199196)
+++ head/sys/dev/bwi/if_bwivar.h	Wed Nov 11 20:27:53 2009	(r199197)
@@ -578,6 +578,7 @@ struct bwi_softc {
 	bus_space_handle_t	sc_mem_bh;
 
 	struct callout		sc_calib_ch;
+	struct callout	sc_watchdog_timer;
 
 	struct bwi_regwin	*sc_cur_regwin;
 	struct bwi_regwin	sc_com_regwin;
From jhb at FreeBSD.org  Wed Nov 11 20:29:40 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Wed Nov 11 20:29:46 2009
Subject: svn commit: r199198 - head/sys/dev/bwi
Message-ID: <200911112029.nABKTeS7006062@svn.freebsd.org>

Author: jhb
Date: Wed Nov 11 20:29:40 2009
New Revision: 199198
URL: http://svn.freebsd.org/changeset/base/199198

Log:
  More consistent whitespace.

Modified:
  head/sys/dev/bwi/if_bwivar.h

Modified: head/sys/dev/bwi/if_bwivar.h
==============================================================================
--- head/sys/dev/bwi/if_bwivar.h	Wed Nov 11 20:27:53 2009	(r199197)
+++ head/sys/dev/bwi/if_bwivar.h	Wed Nov 11 20:29:40 2009	(r199198)
@@ -578,7 +578,7 @@ struct bwi_softc {
 	bus_space_handle_t	sc_mem_bh;
 
 	struct callout		sc_calib_ch;
-	struct callout	sc_watchdog_timer;
+	struct callout		sc_watchdog_timer;
 
 	struct bwi_regwin	*sc_cur_regwin;
 	struct bwi_regwin	sc_com_regwin;
From delphij at FreeBSD.org  Wed Nov 11 21:30:58 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Wed Nov 11 21:31:04 2009
Subject: svn commit: r199201 - in head: contrib/libpcap sbin/ifconfig
	share/man/man4 sys/kern sys/net sys/sys
Message-ID: <200911112130.nABLUw9b007768@svn.freebsd.org>

Author: delphij
Date: Wed Nov 11 21:30:58 2009
New Revision: 199201
URL: http://svn.freebsd.org/changeset/base/199201

Log:
  Add interface description capability as inspired by OpenBSD.
  
  MFC after:	3 months

Modified:
  head/contrib/libpcap/inet.c
  head/sbin/ifconfig/ifconfig.8
  head/sbin/ifconfig/ifconfig.c
  head/share/man/man4/netintro.4
  head/sys/kern/kern_jail.c
  head/sys/net/if.c
  head/sys/net/if.h
  head/sys/net/if_var.h
  head/sys/sys/param.h
  head/sys/sys/priv.h
  head/sys/sys/sockio.h

Modified: head/contrib/libpcap/inet.c
==============================================================================
--- head/contrib/libpcap/inet.c	Wed Nov 11 21:18:27 2009	(r199200)
+++ head/contrib/libpcap/inet.c	Wed Nov 11 21:30:58 2009	(r199201)
@@ -403,22 +403,30 @@ add_addr_to_iflist(pcap_if_t **alldevs, 
 	pcap_addr_t *curaddr, *prevaddr, *nextaddr;
 #ifdef SIOCGIFDESCR
 	struct ifreq ifrdesc;
+#ifdef __FreeBSD__
+#define _IFDESCRSIZE 64
+	char ifdescr[_IFDESCRSIZE];
+#else
 	char ifdescr[IFDESCRSIZE];
-	int s;
 #endif
+	int s;
 
-#ifdef SIOCGIFDESCR
 	/*
 	 * Get the description for the interface.
 	 */
 	memset(&ifrdesc, 0, sizeof ifrdesc);
 	strlcpy(ifrdesc.ifr_name, name, sizeof ifrdesc.ifr_name);
+#ifdef __FreeBSD__
+	ifrdesc.ifr_buffer.buffer = ifdescr;
+	ifrdesc.ifr_buffer.length = _IFDESCRSIZE;
+#else
 	ifrdesc.ifr_data = (caddr_t)&ifdescr;
+#endif
 	s = socket(AF_INET, SOCK_DGRAM, 0);
 	if (s >= 0) {
 		if (ioctl(s, SIOCGIFDESCR, &ifrdesc) == 0 &&
-		    strlen(ifrdesc.ifr_data) != 0)
-			description = ifrdesc.ifr_data;
+		    strlen(ifdescr) != 0)
+			description = ifdescr;
 		close(s);
 	}
 #endif

Modified: head/sbin/ifconfig/ifconfig.8
==============================================================================
--- head/sbin/ifconfig/ifconfig.8	Wed Nov 11 21:18:27 2009	(r199200)
+++ head/sbin/ifconfig/ifconfig.8	Wed Nov 11 21:30:58 2009	(r199201)
@@ -28,7 +28,7 @@
 .\"     From: @(#)ifconfig.8	8.3 (Berkeley) 1/5/94
 .\" $FreeBSD$
 .\"
-.Dd September 23, 2009
+.Dd November 11, 2009
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -258,6 +258,12 @@ Disable permanently promiscuous mode.
 Another name for the
 .Fl alias
 parameter.
+.It Cm description Ar value
+Specify a description of the interface.
+This can be used to label interfaces in situations where they may
+otherwise be difficult to distinguish.
+.It Cm -description
+Clear the interface description.
 .It Cm down
 Mark an interface
 .Dq down .
@@ -2512,6 +2518,10 @@ Configure the interface
 to use 100baseTX, full duplex Ethernet media options:
 .Dl # ifconfig xl0 media 100baseTX mediaopt full-duplex
 .Pp
+Label the em0 interface as an uplink:
+.Pp
+.Dl # ifconfig em0 description \&"Uplink to Gigabit Switch 2\&"
+.Pp
 Create the software network interface
 .Li gif1 :
 .Dl # ifconfig gif1 create

Modified: head/sbin/ifconfig/ifconfig.c
==============================================================================
--- head/sbin/ifconfig/ifconfig.c	Wed Nov 11 21:18:27 2009	(r199200)
+++ head/sbin/ifconfig/ifconfig.c	Wed Nov 11 21:30:58 2009	(r199201)
@@ -83,6 +83,8 @@ static const char rcsid[] =
 struct	ifreq ifr;
 
 char	name[IFNAMSIZ];
+char	*descr = NULL;
+size_t	descrlen = 64;
 int	setaddr;
 int	setmask;
 int	doalias;
@@ -822,6 +824,36 @@ setifname(const char *val, int dummy __u
 	free(newname);
 }
 
+/* ARGSUSED */
+static void
+setifdescr(const char *val, int dummy __unused, int s, 
+    const struct afswtch *afp)
+{
+	char *newdescr;
+
+	newdescr = strdup(val);
+	if (newdescr == NULL) {
+		warn("no memory to set ifdescr");
+		return;
+	}
+	ifr.ifr_buffer.buffer = newdescr;
+	ifr.ifr_buffer.length = strlen(newdescr);
+	if (ioctl(s, SIOCSIFDESCR, (caddr_t)&ifr) < 0) {
+		warn("ioctl (set descr)");
+		free(newdescr);
+		return;
+	}
+	free(newdescr);
+}
+
+/* ARGSUSED */
+static void
+unsetifdescr(const char *val, int value, int s, const struct afswtch *afp)
+{
+
+	setifdescr("", 0, s, 0);
+}
+
 #define	IFFBITS \
 "\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6SMART\7RUNNING" \
 "\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2" \
@@ -866,6 +898,23 @@ status(const struct afswtch *afp, const 
 		printf(" mtu %d", ifr.ifr_mtu);
 	putchar('\n');
 
+	descr = reallocf(descr, descrlen);
+	if (descr != NULL) {
+		do {
+			ifr.ifr_buffer.buffer = descr;
+			ifr.ifr_buffer.length = descrlen;
+			if (ioctl(s, SIOCGIFDESCR, &ifr) == 0) {
+			    if (strlen(descr) > 0)
+				printf("\tdescription: %s\n", descr);
+			    break;
+			}
+			if (errno == ENAMETOOLONG) {
+				descrlen *= 2;
+				descr = reallocf(descr, descrlen);
+			}
+		} while (errno == ENAMETOOLONG);
+	}
+
 	if (ioctl(s, SIOCGIFCAP, (caddr_t)&ifr) == 0) {
 		if (ifr.ifr_curcap != 0) {
 			printb("\toptions", ifr.ifr_curcap, IFCAPBITS);
@@ -1035,6 +1084,10 @@ static struct cmd basic_cmds[] = {
 	DEF_CMD("-arp",		IFF_NOARP,	setifflags),
 	DEF_CMD("debug",	IFF_DEBUG,	setifflags),
 	DEF_CMD("-debug",	-IFF_DEBUG,	setifflags),
+	DEF_CMD_ARG("description",		setifdescr),
+	DEF_CMD_ARG("descr",			setifdescr),
+	DEF_CMD("-description",	0,		unsetifdescr),
+	DEF_CMD("-descr",	0,		unsetifdescr),
 	DEF_CMD("promisc",	IFF_PPROMISC,	setifflags),
 	DEF_CMD("-promisc",	-IFF_PPROMISC,	setifflags),
 	DEF_CMD("add",		IFF_UP,		notealias),

Modified: head/share/man/man4/netintro.4
==============================================================================
--- head/share/man/man4/netintro.4	Wed Nov 11 21:18:27 2009	(r199200)
+++ head/share/man/man4/netintro.4	Wed Nov 11 21:30:58 2009	(r199201)
@@ -32,7 +32,7 @@
 .\"     @(#)netintro.4	8.2 (Berkeley) 11/30/93
 .\" $FreeBSD$
 .\"
-.Dd June 18, 2004
+.Dd November 11, 2009
 .Dt NETINTRO 4
 .Os
 .Sh NAME
@@ -277,6 +277,25 @@ and
 fields of the
 .Vt ifreq
 structure, respectively.
+.It Dv SIOCGIFDESCR
+Get the interface description, returned in the
+.Va buffer
+field of
+.Va ifru_buffer
+struct.
+The user supplied buffer length should defined in the
+.Va length
+field of
+.Va ifru_buffer
+struct passed in as parameter.
+.It Dv SIOCSIFDESCR
+Set the interface description to the value of the
+.Va buffer
+field of
+.Va ifru_buffer
+struct, with
+.Va length
+field specifying its length.
 .It Dv SIOCSIFFLAGS
 Set interface flags field.
 If the interface is marked down,

Modified: head/sys/kern/kern_jail.c
==============================================================================
--- head/sys/kern/kern_jail.c	Wed Nov 11 21:18:27 2009	(r199200)
+++ head/sys/kern/kern_jail.c	Wed Nov 11 21:30:58 2009	(r199201)
@@ -3467,6 +3467,7 @@ prison_priv_check(struct ucred *cred, in
 	case PRIV_NET_SETIFMTU:
 	case PRIV_NET_SETIFFLAGS:
 	case PRIV_NET_SETIFCAP:
+	case PRIV_NET_SETIFDESCR:
 	case PRIV_NET_SETIFNAME	:
 	case PRIV_NET_SETIFMETRIC:
 	case PRIV_NET_SETIFPHYS:

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c	Wed Nov 11 21:18:27 2009	(r199200)
+++ head/sys/net/if.c	Wed Nov 11 21:30:58 2009	(r199201)
@@ -463,6 +463,8 @@ if_free_internal(struct ifnet *ifp)
 #ifdef MAC
 	mac_ifnet_destroy(ifp);
 #endif /* MAC */
+	if (ifp->if_description != NULL)
+		sbuf_delete(ifp->if_description);
 	IF_AFDATA_DESTROY(ifp);
 	IF_ADDR_LOCK_DESTROY(ifp);
 	ifq_delete(&ifp->if_snd);
@@ -2090,6 +2092,45 @@ ifhwioctl(u_long cmd, struct ifnet *ifp,
 		ifr->ifr_phys = ifp->if_physical;
 		break;
 
+	case SIOCGIFDESCR:
+		IF_AFDATA_RLOCK(ifp);
+		if (ifp->if_description == NULL)
+			error = ENOMSG;
+		else
+			error = copystr(sbuf_data(ifp->if_description),
+					ifr->ifr_buffer.buffer,
+					ifr->ifr_buffer.length, NULL);
+		IF_AFDATA_RUNLOCK(ifp);
+		break;
+
+	case SIOCSIFDESCR:
+		error = priv_check(td, PRIV_NET_SETIFDESCR);
+		if (error)
+			return (error);
+
+		IF_AFDATA_WLOCK(ifp);
+		if (ifp->if_description == NULL) {
+			ifp->if_description = sbuf_new_auto();
+			if (ifp->if_description == NULL) {
+				error = ENOMEM;
+				IF_AFDATA_WUNLOCK(ifp);
+				break;
+			}
+		} else
+			sbuf_clear(ifp->if_description);
+
+		if (sbuf_copyin(ifp->if_description, ifr->ifr_buffer.buffer,
+				ifr->ifr_buffer.length) == -1)
+			error = EFAULT;
+
+		if (error == 0) {
+			sbuf_finish(ifp->if_description);
+			getmicrotime(&ifp->if_lastchange);
+		}
+		IF_AFDATA_WUNLOCK(ifp);
+
+		break;
+
 	case SIOCSIFFLAGS:
 		error = priv_check(td, PRIV_NET_SETIFFLAGS);
 		if (error)

Modified: head/sys/net/if.h
==============================================================================
--- head/sys/net/if.h	Wed Nov 11 21:18:27 2009	(r199200)
+++ head/sys/net/if.h	Wed Nov 11 21:30:58 2009	(r199201)
@@ -294,6 +294,7 @@ struct	ifreq {
 		struct	sockaddr ifru_addr;
 		struct	sockaddr ifru_dstaddr;
 		struct	sockaddr ifru_broadaddr;
+		struct { size_t length; caddr_t	buffer; } ifru_buffer;
 		short	ifru_flags[2];
 		short	ifru_index;
 		int	ifru_jid;
@@ -307,6 +308,7 @@ struct	ifreq {
 #define	ifr_addr	ifr_ifru.ifru_addr	/* address */
 #define	ifr_dstaddr	ifr_ifru.ifru_dstaddr	/* other end of p-to-p link */
 #define	ifr_broadaddr	ifr_ifru.ifru_broadaddr	/* broadcast address */
+#define	ifr_buffer	ifr_ifru.ifru_buffer	/* user supplied buffer with its length */
 #define	ifr_flags	ifr_ifru.ifru_flags[0]	/* flags (low 16 bits) */
 #define	ifr_flagshigh	ifr_ifru.ifru_flags[1]	/* flags (high 16 bits) */
 #define	ifr_jid		ifr_ifru.ifru_jid	/* jail/vnet */

Modified: head/sys/net/if_var.h
==============================================================================
--- head/sys/net/if_var.h	Wed Nov 11 21:18:27 2009	(r199200)
+++ head/sys/net/if_var.h	Wed Nov 11 21:30:58 2009	(r199201)
@@ -198,6 +198,7 @@ struct ifnet {
 	void	*if_pf_kif;
 	void	*if_lagg;		/* lagg glue */
 	u_char	 if_alloctype;		/* if_type at time of allocation */
+	struct sbuf *if_description;	/* interface description */
 
 	/*
 	 * Spare fields are added so that we can modify sensitive data
@@ -205,7 +206,7 @@ struct ifnet {
 	 * be used with care where binary compatibility is required.
 	 */
 	char	 if_cspare[3];
-	void	*if_pspare[8];
+	void	*if_pspare[7];
 	int	if_ispare[4];
 };
 

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Wed Nov 11 21:18:27 2009	(r199200)
+++ head/sys/sys/param.h	Wed Nov 11 21:30:58 2009	(r199201)
@@ -58,7 +58,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 900002	/* Master, propagated to newvers */
+#define __FreeBSD_version 900003	/* Master, propagated to newvers */
 
 #ifndef LOCORE
 #include 

Modified: head/sys/sys/priv.h
==============================================================================
--- head/sys/sys/priv.h	Wed Nov 11 21:18:27 2009	(r199200)
+++ head/sys/sys/priv.h	Wed Nov 11 21:30:58 2009	(r199201)
@@ -335,6 +335,7 @@
 #define	PRIV_NET_LAGG		415	/* Administer lagg interface. */
 #define	PRIV_NET_GIF		416	/* Administer gif interface. */
 #define	PRIV_NET_SETIFVNET	417	/* Move interface to vnet. */
+#define	PRIV_NET_SETIFDESCR	418	/* Set interface description. */
 
 /*
  * 802.11-related privileges.

Modified: head/sys/sys/sockio.h
==============================================================================
--- head/sys/sys/sockio.h	Wed Nov 11 21:18:27 2009	(r199200)
+++ head/sys/sys/sockio.h	Wed Nov 11 21:30:58 2009	(r199201)
@@ -82,6 +82,8 @@
 #define	SIOCGIFMAC	_IOWR('i', 38, struct ifreq)	/* get IF MAC label */
 #define	SIOCSIFMAC	 _IOW('i', 39, struct ifreq)	/* set IF MAC label */
 #define	SIOCSIFNAME	 _IOW('i', 40, struct ifreq)	/* set IF name */
+#define	SIOCSIFDESCR	 _IOW('i', 41, struct ifreq)	/* set ifnet descr */ 
+#define	SIOCGIFDESCR	_IOWR('i', 42, struct ifreq)	/* get ifnet descr */ 
 
 #define	SIOCADDMULTI	 _IOW('i', 49, struct ifreq)	/* add m'cast addr */
 #define	SIOCDELMULTI	 _IOW('i', 50, struct ifreq)	/* del m'cast addr */
From ed at 80386.nl  Wed Nov 11 21:56:54 2009
From: ed at 80386.nl (Ed Schouten)
Date: Wed Nov 11 21:57:05 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <7meio5g4yx.wl%kuriyama@s2factory.co.jp>
References: <7meio5g4yx.wl%kuriyama@s2factory.co.jp>
Message-ID: <20091111215651.GM64905@hoeg.nl>

Hi,

* Jun Kuriyama  wrote:
> Can you test with these patches?  Testing on only one of both system
> is enough.  "patch-1" forces disabling CLFLUSH feature even if SS bit
> exists.  "patch-2" forces no CLFLUSH tweak.  I'd like to know with
> which patch your system can live.

For some reason they both seem to boot. Yikes. I've done some more
testing and it seems the old version even hangs if I add some additional
printf's above and below, which makes me believe the problem is a bit
more complex than we realize...

-- 
 Ed Schouten 
 WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091111/b6e7318b/attachment.pgp
From kostikbel at gmail.com  Wed Nov 11 22:33:49 2009
From: kostikbel at gmail.com (Kostik Belousov)
Date: Wed Nov 11 22:34:01 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <20091111215651.GM64905@hoeg.nl>
References: <7meio5g4yx.wl%kuriyama@s2factory.co.jp>
	<20091111215651.GM64905@hoeg.nl>
Message-ID: <20091111223340.GF2331@deviant.kiev.zoral.com.ua>

On Wed, Nov 11, 2009 at 10:56:51PM +0100, Ed Schouten wrote:
> Hi,
> 
> * Jun Kuriyama  wrote:
> > Can you test with these patches?  Testing on only one of both system
> > is enough.  "patch-1" forces disabling CLFLUSH feature even if SS bit
> > exists.  "patch-2" forces no CLFLUSH tweak.  I'd like to know with
> > which patch your system can live.
> 
> For some reason they both seem to boot. Yikes. I've done some more
> testing and it seems the old version even hangs if I add some additional
> printf's above and below, which makes me believe the problem is a bit
> more complex than we realize...

The only thing I see now is that TUNABLE_INT declaration is not needed,
since SYSINIT is started after hammer_time(), so TUNABLE_FETCH is
processed after everything is done for BSP.

Wait, are your machines SMP ? Hmm, could you, please, remove TUNABLE_INT()
and see how it ends up ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091111/5797309a/attachment.pgp
From jilles at FreeBSD.org  Wed Nov 11 23:13:26 2009
From: jilles at FreeBSD.org (Jilles Tjoelker)
Date: Wed Nov 11 23:13:37 2009
Subject: svn commit: r199205 - head/bin/sh
Message-ID: <200911112313.nABNDOGZ010520@svn.freebsd.org>

Author: jilles
Date: Wed Nov 11 23:13:24 2009
New Revision: 199205
URL: http://svn.freebsd.org/changeset/base/199205

Log:
  sh: Use sigaction instead of signal/siginterrupt combination.

Modified:
  head/bin/sh/trap.c

Modified: head/bin/sh/trap.c
==============================================================================
--- head/bin/sh/trap.c	Wed Nov 11 22:37:17 2009	(r199204)
+++ head/bin/sh/trap.c	Wed Nov 11 23:13:24 2009	(r199205)
@@ -244,7 +244,8 @@ void
 setsignal(int signo)
 {
 	int action;
-	sig_t sig, sigact = SIG_DFL;
+	sig_t sigact = SIG_DFL;
+	struct sigaction sa;
 	char *t;
 
 	if ((t = trap[signo]) == NULL)
@@ -320,9 +321,10 @@ setsignal(int signo)
 		case S_IGN:	sigact = SIG_IGN;	break;
 	}
 	*t = action;
-	sig = signal(signo, sigact);
-	if (sig != SIG_ERR && action == S_CATCH)
-		siginterrupt(signo, 1);
+	sa.sa_handler = sigact;
+	sa.sa_flags = 0;
+	sigemptyset(&sa.sa_mask);
+	sigaction(signo, &sa, NULL);
 }
 
 
From attilio at FreeBSD.org  Thu Nov 12 00:46:28 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Thu Nov 12 00:46:41 2009
Subject: svn commit: r199208 - in head/sys: conf libkern netinet
	netinet/libalias
Message-ID: <200911120046.nAC0kS2V012731@svn.freebsd.org>

Author: attilio
Date: Thu Nov 12 00:46:28 2009
New Revision: 199208
URL: http://svn.freebsd.org/changeset/base/199208

Log:
  Move inet_aton() (specular to inet_ntoa(), already present in libkern)
  into libkern in order to made it usable by other modules than alias_proxy.
  
  Obtained from:	Sandvine Incorporated
  Sponsored by:	Sandvine Incorporated
  MFC:		1 week

Added:
  head/sys/libkern/inet_aton.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/netinet/in.h
  head/sys/netinet/libalias/alias_proxy.c

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Thu Nov 12 00:36:22 2009	(r199207)
+++ head/sys/conf/files	Thu Nov 12 00:46:28 2009	(r199208)
@@ -2193,6 +2193,7 @@ libkern/iconv_converter_if.m	optional li
 libkern/iconv_xlat.c		optional libiconv
 libkern/iconv_xlat16.c		optional libiconv
 libkern/index.c			standard
+libkern/inet_aton.c		standard
 libkern/inet_ntoa.c		standard
 libkern/mcount.c		optional profiling-routine
 libkern/memcmp.c		standard

Added: head/sys/libkern/inet_aton.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/libkern/inet_aton.c	Thu Nov 12 00:46:28 2009	(r199208)
@@ -0,0 +1,136 @@
+/*-
+ * Copyright (c) 2001 Charles Mott 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+int
+inet_aton(const char *cp, struct in_addr *addr)
+{
+	u_long parts[4];
+	in_addr_t val;
+	const char *c;
+	char *endptr;
+	int gotend, n;
+
+	c = (const char *)cp;
+	n = 0;
+
+	/*
+	 * Run through the string, grabbing numbers until
+	 * the end of the string, or some error
+	 */
+	gotend = 0;
+	while (!gotend) {
+		unsigned long l;
+
+		l = strtoul(c, &endptr, 0);
+
+		if (l == ULONG_MAX || (l == 0 && endptr == c))
+			return (0);
+
+		val = (in_addr_t)l;
+
+		/*
+		 * If the whole string is invalid, endptr will equal
+		 * c.. this way we can make sure someone hasn't
+		 * gone '.12' or something which would get past
+		 * the next check.
+		 */
+		if (endptr == c)
+			return (0);
+		parts[n] = val;
+		c = endptr;
+
+		/* Check the next character past the previous number's end */
+		switch (*c) {
+		case '.' :
+
+			/* Make sure we only do 3 dots .. */
+			if (n == 3)	/* Whoops. Quit. */
+				return (0);
+			n++;
+			c++;
+			break;
+
+		case '\0':
+			gotend = 1;
+			break;
+
+		default:
+			if (isspace((unsigned char)*c)) {
+				gotend = 1;
+				break;
+			} else {
+
+				/* Invalid character, then fail. */
+				return (0);
+			}
+		}
+
+	}
+
+	/* Concoct the address according to the number of parts specified. */
+	switch (n) {
+	case 0:				/* a -- 32 bits */
+
+		/*
+		 * Nothing is necessary here.  Overflow checking was
+		 * already done in strtoul().
+		 */
+		break;
+	case 1:				/* a.b -- 8.24 bits */
+		if (val > 0xffffff || parts[0] > 0xff)
+			return (0);
+		val |= parts[0] << 24;
+		break;
+
+	case 2:				/* a.b.c -- 8.8.16 bits */
+		if (val > 0xffff || parts[0] > 0xff || parts[1] > 0xff)
+			return (0);
+		val |= (parts[0] << 24) | (parts[1] << 16);
+		break;
+
+	case 3:				/* a.b.c.d -- 8.8.8.8 bits */
+		if (val > 0xff || parts[0] > 0xff || parts[1] > 0xff ||
+		    parts[2] > 0xff)
+			return (0);
+		val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
+		break;
+	}
+
+	if (addr != NULL)
+		addr->s_addr = htonl(val);
+	return (1);
+}
+

Modified: head/sys/netinet/in.h
==============================================================================
--- head/sys/netinet/in.h	Thu Nov 12 00:36:22 2009	(r199207)
+++ head/sys/netinet/in.h	Thu Nov 12 00:46:28 2009	(r199208)
@@ -713,6 +713,7 @@ int	 in_broadcast(struct in_addr, struct
 int	 in_canforward(struct in_addr);
 int	 in_localaddr(struct in_addr);
 int	 in_localip(struct in_addr);
+int	 inet_aton(const char *, struct in_addr *); /* in libkern */
 char	*inet_ntoa(struct in_addr); /* in libkern */
 char	*inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */
 void	 in_ifdetach(struct ifnet *);

Modified: head/sys/netinet/libalias/alias_proxy.c
==============================================================================
--- head/sys/netinet/libalias/alias_proxy.c	Thu Nov 12 00:36:22 2009	(r199207)
+++ head/sys/netinet/libalias/alias_proxy.c	Thu Nov 12 00:46:28 2009	(r199208)
@@ -137,9 +137,6 @@ struct proxy_entry {
 				destination of a proxied IP packet
 */
 
-#ifdef	_KERNEL		/* XXX: can it be moved to libkern? */
-static int inet_aton(const char *cp, struct in_addr *addr);
-#endif
 static int	IpMask(int, struct in_addr *);
 static int	IpAddr(char *, struct in_addr *);
 static int	IpPort(char *, int, int *);
@@ -149,107 +146,6 @@ static int	RuleNumberDelete(struct libal
 static void	ProxyEncodeTcpStream(struct alias_link *, struct ip *, int);
 static void	ProxyEncodeIpHeader(struct ip *, int);
 
-#ifdef	_KERNEL
-static int
-inet_aton(cp, addr)
-        const char *cp;
-        struct in_addr *addr;
-{
-	u_long parts[4];
-	in_addr_t val;
-	const char *c;
-	char *endptr;
-	int gotend, n;
-
-	c = (const char *)cp;
-	n = 0;
-	/*
-	 * Run through the string, grabbing numbers until
-	 * the end of the string, or some error
-	 */
-	gotend = 0;
-	while (!gotend) {
-		unsigned long l;
-
-		l = strtoul(c, &endptr, 0);
-
-		if (l == ULONG_MAX || (l == 0 && endptr == c))
-			return (0);
-
-		val = (in_addr_t)l;
-		/*
-		 * If the whole string is invalid, endptr will equal
-		 * c.. this way we can make sure someone hasn't
-		 * gone '.12' or something which would get past
-		 * the next check.
-		 */
-		if (endptr == c)
-			return (0);
-		parts[n] = val;
-		c = endptr;
-
-		/* Check the next character past the previous number's end */
-		switch (*c) {
-		case '.' :
-			/* Make sure we only do 3 dots .. */
-			if (n == 3)	/* Whoops. Quit. */
-				return (0);
-			n++;
-			c++;
-			break;
-
-		case '\0':
-			gotend = 1;
-			break;
-
-		default:
-			if (isspace((unsigned char)*c)) {
-				gotend = 1;
-				break;
-			} else
-				return (0);	/* Invalid character, so fail */
-		}
-
-	}
-
-	/*
-	 * Concoct the address according to
-	 * the number of parts specified.
-	 */
-
-	switch (n) {
-	case 0:				/* a -- 32 bits */
-		/*
-		 * Nothing is necessary here.  Overflow checking was
-		 * already done in strtoul().
-		 */
-		break;
-	case 1:				/* a.b -- 8.24 bits */
-		if (val > 0xffffff || parts[0] > 0xff)
-			return (0);
-		val |= parts[0] << 24;
-		break;
-
-	case 2:				/* a.b.c -- 8.8.16 bits */
-		if (val > 0xffff || parts[0] > 0xff || parts[1] > 0xff)
-			return (0);
-		val |= (parts[0] << 24) | (parts[1] << 16);
-		break;
-
-	case 3:				/* a.b.c.d -- 8.8.8.8 bits */
-		if (val > 0xff || parts[0] > 0xff || parts[1] > 0xff ||
-		    parts[2] > 0xff)
-			return (0);
-		val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
-		break;
-	}
-
-	if (addr != NULL)
-		addr->s_addr = htonl(val);
-	return (1);
-}
-#endif
-
 static int
 IpMask(int nbits, struct in_addr *mask)
 {
From attilio at FreeBSD.org  Thu Nov 12 00:52:14 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Thu Nov 12 00:52:20 2009
Subject: svn commit: r199209 - head/sys/kern
Message-ID: <200911120052.nAC0qEjC012881@svn.freebsd.org>

Author: attilio
Date: Thu Nov 12 00:52:14 2009
New Revision: 199209
URL: http://svn.freebsd.org/changeset/base/199209

Log:
  The building the dev nameunit string, in devclass_add_device() is based
  on the assumption that the unit linked with the device is invariant but
  that can change when calling devclass_alloc_unit() (because -1 is passed
  or, more simply, because the unit choosen is beyond the table limits).
  This results in a completely bogus string building.
  
  Fix this by reserving the necessary room for all the possible characters
  printable by a positive integer (we do not allow for negative unit
  number).
  
  Reported by:	Sandvine Incorporated
  Reviewed by:	emaste
  Sponsored by:	Sandvine Incorporated
  MFC:		1 week

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c	Thu Nov 12 00:46:28 2009	(r199208)
+++ head/sys/kern/subr_bus.c	Thu Nov 12 00:52:14 2009	(r199209)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1584,7 +1585,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  Thu Nov 12 01:22:05 2009
From: attilio at freebsd.org (Attilio Rao)
Date: Thu Nov 12 01:22:12 2009
Subject: svn commit: r199209 - head/sys/kern
In-Reply-To: <200911120052.nAC0qEjC012881@svn.freebsd.org>
References: <200911120052.nAC0qEjC012881@svn.freebsd.org>
Message-ID: <3bbf2fe10911111722j436d8b82oa66fb5cb581c7205@mail.gmail.com>

2009/11/12 Attilio Rao :
> Author: attilio
> Date: Thu Nov 12 00:52:14 2009
> New Revision: 199209
> URL: http://svn.freebsd.org/changeset/base/199209
>
> Log:
>  The building the dev nameunit string, in devclass_add_device() is based
>  on the assumption that the unit linked with the device is invariant but
>  that can change when calling devclass_alloc_unit() (because -1 is passed
>  or, more simply, because the unit choosen is beyond the table limits).
>  This results in a completely bogus string building.
>
>  Fix this by reserving the necessary room for all the possible characters
>  printable by a positive integer (we do not allow for negative unit
>  number).
>
>  Reported by:  Sandvine Incorporated
>  Reviewed by:  emaste

Sorry, forgot to add:
reviewed by: jhb, imp

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
From attilio at FreeBSD.org  Thu Nov 12 01:30:18 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Thu Nov 12 01:30:24 2009
Subject: svn commit: r199210 - head/sys/boot/common
Message-ID: <200911120130.nAC1UHbK013749@svn.freebsd.org>

Author: attilio
Date: Thu Nov 12 01:30:17 2009
New Revision: 199210
URL: http://svn.freebsd.org/changeset/base/199210

Log:
  Introduce a new option (BOOT_PROMPT_123) that lets enter the boot prompt
  only when typing the sequence "123" (opposite to the standard 'push any
  button' approach).
  That results useful when using serial lines sending garbage and leading
  to unwilling boot prompt appearence.
  
  Obtained from:	Sandvine Incorporated
  Reviewed by:	emaste, jhb
  Sponsored by:	Sandvine Incorporated
  MFC:		1 week

Modified:
  head/sys/boot/common/Makefile.inc
  head/sys/boot/common/boot.c

Modified: head/sys/boot/common/Makefile.inc
==============================================================================
--- head/sys/boot/common/Makefile.inc	Thu Nov 12 00:52:14 2009	(r199209)
+++ head/sys/boot/common/Makefile.inc	Thu Nov 12 01:30:17 2009	(r199210)
@@ -38,4 +38,8 @@ MAN+=	../forth/loader.conf.5
 MAN+=	../forth/loader.4th.8
 .endif
 
+.if defined(BOOT_PROMPT_123)
+CFLAGS+=	-DBOOT_PROMPT_123
+.endif
+
 MAN+=	loader.8

Modified: head/sys/boot/common/boot.c
==============================================================================
--- head/sys/boot/common/boot.c	Thu Nov 12 00:52:14 2009	(r199209)
+++ head/sys/boot/common/boot.c	Thu Nov 12 01:30:17 2009	(r199210)
@@ -162,6 +162,9 @@ autoboot(int timeout, char *prompt)
     int		c, yes;
     char	*argv[2], *cp, *ep;
     char	*kernelname;
+#ifdef BOOT_PROMPT_123
+    const char	*seq = "123", *p = seq;
+#endif
 
     autoboot_tried = 1;
 
@@ -192,14 +195,29 @@ autoboot(int timeout, char *prompt)
 
         yes = 0;
 
+#ifdef BOOT_PROMPT_123
+        printf("%s\n", (prompt == NULL) ? "Hit [Enter] to boot immediately, or "
+	    "1 2 3 sequence for command prompt." : prompt);
+#else
         printf("%s\n", (prompt == NULL) ? "Hit [Enter] to boot immediately, or any other key for command prompt." : prompt);
+#endif
 
         for (;;) {
 	    if (ischar()) {
 	        c = getchar();
+#ifdef BOOT_PROMPT_123
+		if ((c == '\r') || (c == '\n')) {
+			yes = 1;
+			break;
+		} else if (c != *p++)
+			p = seq;
+		if (*p == 0)
+			break;
+#else
 	        if ((c == '\r') || (c == '\n'))
 		    yes = 1;
 	        break;
+#endif
 	    }
 	    ntime = time(NULL);
 	    if (ntime >= when) {
From des at FreeBSD.org  Thu Nov 12 01:33:58 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu Nov 12 01:34:07 2009
Subject: svn commit: r199211 - head/tools/regression/lib/libutil
Message-ID: <200911120133.nAC1Xvim013866@svn.freebsd.org>

Author: des
Date: Thu Nov 12 01:33:57 2009
New Revision: 199211
URL: http://svn.freebsd.org/changeset/base/199211

Log:
  Fix warnings

Modified:
  head/tools/regression/lib/libutil/test-grp.c
  head/tools/regression/lib/libutil/test-trimdomain-nodomain.c
  head/tools/regression/lib/libutil/test-trimdomain.c

Modified: head/tools/regression/lib/libutil/test-grp.c
==============================================================================
--- head/tools/regression/lib/libutil/test-grp.c	Thu Nov 12 01:30:17 2009	(r199210)
+++ head/tools/regression/lib/libutil/test-grp.c	Thu Nov 12 01:33:57 2009	(r199211)
@@ -64,7 +64,7 @@ build_grp(struct group *grp)
 
 
 int
-main(int argc, char **argv)
+main(void)
 {
 	char *strGrp;
 	int testNdx;

Modified: head/tools/regression/lib/libutil/test-trimdomain-nodomain.c
==============================================================================
--- head/tools/regression/lib/libutil/test-trimdomain-nodomain.c	Thu Nov 12 01:30:17 2009	(r199210)
+++ head/tools/regression/lib/libutil/test-trimdomain-nodomain.c	Thu Nov 12 01:33:57 2009	(r199211)
@@ -47,7 +47,8 @@ int tests = 0;
  * This makes the tests much easier to write and less likely to fail on
  * oddly configured systems.
  */
-int gethostname(char *name, size_t namelen)
+int
+gethostname(char *name, size_t namelen)
 {
 	if (strlcpy(name, TESTFQDN, namelen) > namelen) {
 		errno = ENAMETOOLONG;
@@ -63,7 +64,7 @@ testit(const char *input, int hostsize, 
 	const char *expected = (output == NULL) ? input : output;
 
 	testhost = strdup(input);
-	trimdomain(testhost, hostsize < 0 ? strlen(testhost) : hostsize);
+	trimdomain(testhost, hostsize < 0 ? (int)strlen(testhost) : hostsize);
 	tests++;
 	if (strcmp(testhost, expected) != 0) {
 		printf("not ok %d - %s\n", tests, test);
@@ -75,7 +76,7 @@ testit(const char *input, int hostsize, 
 }
 
 int
-main (int argc, char **argv)
+main(void)
 {
 
 	printf("1..5\n");

Modified: head/tools/regression/lib/libutil/test-trimdomain.c
==============================================================================
--- head/tools/regression/lib/libutil/test-trimdomain.c	Thu Nov 12 01:30:17 2009	(r199210)
+++ head/tools/regression/lib/libutil/test-trimdomain.c	Thu Nov 12 01:33:57 2009	(r199211)
@@ -47,7 +47,8 @@ int tests = 0;
  * This makes the tests much easier to write and less likely to fail on
  * oddly configured systems.
  */
-int gethostname(char *name, size_t namelen)
+int
+gethostname(char *name, size_t namelen)
 {
 	if (strlcpy(name, TESTFQDN, namelen) > namelen) {
 		errno = ENAMETOOLONG;
@@ -63,7 +64,7 @@ testit(const char *input, int hostsize, 
 	const char *expected = (output == NULL) ? input : output;
 
 	testhost = strdup(input);
-	trimdomain(testhost, hostsize < 0 ? strlen(testhost) : hostsize);
+	trimdomain(testhost, hostsize < 0 ? (int)strlen(testhost) : hostsize);
 	tests++;
 	if (strcmp(testhost, expected) != 0) {
 		printf("not ok %d - %s\n", tests, test);
@@ -75,7 +76,7 @@ testit(const char *input, int hostsize, 
 }
 
 int
-main (int argc, char **argv)
+main(void)
 {
 
 	printf("1..5\n");
From des at FreeBSD.org  Thu Nov 12 01:34:55 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu Nov 12 01:35:06 2009
Subject: svn commit: r199212 - head/tools/regression/lib/libutil
Message-ID: <200911120134.nAC1YtCn013922@svn.freebsd.org>

Author: des
Date: Thu Nov 12 01:34:55 2009
New Revision: 199212
URL: http://svn.freebsd.org/changeset/base/199212

Log:
  Fix warnings and remove one unnecessary use of vfork().  The other could
  also be removed with a little more work.

Modified:
  head/tools/regression/lib/libutil/test-flopen.c

Modified: head/tools/regression/lib/libutil/test-flopen.c
==============================================================================
--- head/tools/regression/lib/libutil/test-flopen.c	Thu Nov 12 01:33:57 2009	(r199211)
+++ head/tools/regression/lib/libutil/test-flopen.c	Thu Nov 12 01:34:55 2009	(r199212)
@@ -28,11 +28,11 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
 #include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -169,16 +169,10 @@ test_flopen_lock_child(void)
 			_exit(0);
 		}
 		close(fd1);
-		fd2 = -42;
-		if (vfork() == 0) {
-			fd2 = flopen(fn, O_RDWR|O_NONBLOCK);
+		if ((fd2 = flopen(fn, O_RDWR|O_NONBLOCK)) != -1) {
+			result = "second open succeeded";
 			close(fd2);
-			_exit(0);
 		}
-		if (fd2 == -42)
-			result = "vfork() doesn't work as expected";
-		if (fd2 >= 0)
-			result = "second open succeeded";
 		kill(pid, SIGINT);
 	}
 	unlink(fn);
From des at FreeBSD.org  Thu Nov 12 01:37:03 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu Nov 12 01:37:09 2009
Subject: svn commit: r199213 - head/tools/regression/lib/libutil
Message-ID: <200911120137.nAC1b3wX014020@svn.freebsd.org>

Author: des
Date: Thu Nov 12 01:37:02 2009
New Revision: 199213
URL: http://svn.freebsd.org/changeset/base/199213

Log:
  Test cases for pidfile(3) - including two designed to catch issues arising
  from the incorrect use of fcntl(2) instead of flock(2).

Added:
  head/tools/regression/lib/libutil/test-pidfile.c   (contents, props changed)

Added: head/tools/regression/lib/libutil/test-pidfile.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/lib/libutil/test-pidfile.c	Thu Nov 12 01:37:02 2009	(r199213)
@@ -0,0 +1,280 @@
+/*-
+ * Copyright (c) 2007-2009 Dag-Erling Co?dan Sm?rgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer
+ *    in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/*
+ * We need a signal handler so kill(2) will interrupt our child's
+ * select(2) instead of killing it.
+ */
+static void
+signal_handler(int sig)
+{
+	(void)sig;
+}
+
+/*
+ * Test that pidfile_open() can create a pidfile and that pidfile_write()
+ * can write to it.
+ */
+static const char *
+test_pidfile_uncontested(void)
+{
+	const char *fn = "test_pidfile_uncontested";
+	struct pidfh *pf;
+	pid_t other = 0;
+
+	unlink(fn);
+	pf = pidfile_open(fn, 0600, &other);
+	if (pf == NULL && other != 0)
+		return ("pidfile exists and is locked");
+	if (pf == NULL)
+		return (strerror(errno));
+	if (pidfile_write(pf) != 0) {
+		pidfile_close(pf);
+		unlink(fn);
+		return ("failed to write PID");
+	}
+	pidfile_close(pf);
+	unlink(fn);
+	return (NULL);
+}
+
+/*
+ * Test that pidfile_open() locks against self.
+ */
+static const char *
+test_pidfile_self(void)
+{
+	const char *fn = "test_pidfile_self";
+	struct pidfh *pf1, *pf2;
+	pid_t other = 0;
+	int serrno;
+
+	unlink(fn);
+	pf1 = pidfile_open(fn, 0600, &other);
+	if (pf1 == NULL && other != 0)
+		return ("pidfile exists and is locked");
+	if (pf1 == NULL)
+		return (strerror(errno));
+	if (pidfile_write(pf1) != 0) {
+		serrno = errno;
+		pidfile_close(pf1);
+		unlink(fn);
+		return (strerror(serrno));
+	}
+	// second open should fail
+	pf2 = pidfile_open(fn, 0600, &other);
+	if (pf2 != NULL) {
+		pidfile_close(pf1);
+		pidfile_close(pf2);
+		unlink(fn);
+		return ("managed to opened pidfile twice");
+	}
+	if (other != getpid()) {
+		pidfile_close(pf1);
+		unlink(fn);
+		return ("pidfile contained wrong PID");
+	}
+	pidfile_close(pf1);
+	unlink(fn);
+	return (NULL);
+}
+
+/*
+ * Common code for test_pidfile_{contested,inherited}.
+ */
+static const char *
+common_test_pidfile_child(const char *fn, int parent_open)
+{
+	struct pidfh *pf = NULL;
+	pid_t other = 0, pid = 0;
+	int fd[2], serrno, status;
+	char ch;
+
+	unlink(fn);
+	if (pipe(fd) != 0)
+		return (strerror(errno));
+
+	if (parent_open) {
+		pf = pidfile_open(fn, 0600, &other);
+		if (pf == NULL && other != 0)
+			return ("pidfile exists and is locked");
+		if (pf == NULL)
+			return (strerror(errno));
+	}
+
+	pid = fork();
+	if (pid == -1)
+		return (strerror(errno));
+	if (pid == 0) {
+		// child
+		close(fd[0]);
+		signal(SIGINT, signal_handler);
+		if (!parent_open) {
+			pf = pidfile_open(fn, 0600, &other);
+			if (pf == NULL && other != 0)
+				return ("pidfile exists and is locked");
+			if (pf == NULL)
+				return (strerror(errno));
+		}
+		if (pidfile_write(pf) != 0) {
+			serrno = errno;
+			pidfile_close(pf);
+			unlink(fn);
+			return (strerror(serrno));
+		}
+		if (pf == NULL)
+			_exit(1);
+		if (pidfile_write(pf) != 0)
+			_exit(1);
+		if (write(fd[1], "*", 1) != 1)
+			_exit(1);
+		select(0, 0, 0, 0, 0);
+		_exit(0);
+	}
+	// parent
+	close(fd[1]);
+	if (pf)
+		pidfile_close(pf);
+
+	// wait for the child to signal us
+	if (read(fd[0], &ch, 1) != 1) {
+		serrno = errno;
+		unlink(fn);
+		kill(pid, SIGTERM);
+		errno = serrno;
+		return (strerror(errno));
+	}
+
+	// We shouldn't be able to lock the same pidfile as our child
+	pf = pidfile_open(fn, 0600, &other);
+	if (pf != NULL) {
+		pidfile_close(pf);
+		unlink(fn);
+		return ("managed to lock contested pidfile");
+	}
+
+	// Failed to lock, but not because it was contested
+	if (other == 0) {
+		unlink(fn);
+		return (strerror(errno));
+	}
+
+	// Locked by the wrong process
+	if (other != pid) {
+		unlink(fn);
+		return ("pidfile contained wrong PID");
+	}
+
+	// check our child's fate
+	if (pf)
+		pidfile_close(pf);
+	unlink(fn);
+	if (kill(pid, SIGINT) != 0)
+		return (strerror(errno));
+	if (waitpid(pid, &status, 0) == -1)
+		return (strerror(errno));
+	if (WIFSIGNALED(status))
+		return ("child caught signal");
+	if (WEXITSTATUS(status) != 0) 
+		return ("child returned non-zero status");
+
+	// success
+	return (NULL);
+}
+
+/*
+ * Test that pidfile_open() fails when attempting to open a pidfile that
+ * is already locked, and that it returns the correct PID.
+ */
+static const char *
+test_pidfile_contested(void)
+{
+	const char *fn = "test_pidfile_contested";
+	const char *result;
+
+	result = common_test_pidfile_child(fn, 0);
+	return (result);
+}
+
+/*
+ * Test that the pidfile lock is inherited.
+ */
+static const char *
+test_pidfile_inherited(void)
+{
+	const char *fn = "test_pidfile_inherited";
+	const char *result;
+
+	result = common_test_pidfile_child(fn, 1);
+	return (result);
+}
+
+static struct test {
+	const char *name;
+	const char *(*func)(void);
+} t[] = {
+	{ "pidfile_uncontested", test_pidfile_uncontested },
+	{ "pidfile_self", test_pidfile_self },
+	{ "pidfile_contested", test_pidfile_contested },
+	{ "pidfile_inherited", test_pidfile_inherited },
+};
+
+int
+main(void)
+{
+	const char *result;
+	int i, nt;
+
+	nt = sizeof(t) / sizeof(*t);
+	printf("1..%d\n", nt);
+	for (i = 0; i < nt; ++i) {
+		if ((result = t[i].func()) != NULL)
+			printf("not ok %d - %s # %s\n", i + 1,
+			    t[i].name, result);
+		else
+			printf("ok %d - %s\n", i + 1,
+			    t[i].name);
+	}
+	exit(0);
+}
From des at FreeBSD.org  Thu Nov 12 01:37:25 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu Nov 12 01:37:37 2009
Subject: svn commit: r199214 - head/tools/regression/lib/libutil
Message-ID: <200911120137.nAC1bP3Y014062@svn.freebsd.org>

Author: des
Date: Thu Nov 12 01:37:25 2009
New Revision: 199214
URL: http://svn.freebsd.org/changeset/base/199214

Log:
  Add test-pidfile.c and increase warning level.

Modified:
  head/tools/regression/lib/libutil/Makefile

Modified: head/tools/regression/lib/libutil/Makefile
==============================================================================
--- head/tools/regression/lib/libutil/Makefile	Thu Nov 12 01:37:02 2009	(r199213)
+++ head/tools/regression/lib/libutil/Makefile	Thu Nov 12 01:37:25 2009	(r199214)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
-TESTS=	test-trimdomain test-trimdomain-nodomain test-flopen test-grp
-CFLAGS+= -g -Wall -lutil
+TESTS=	test-trimdomain test-trimdomain-nodomain test-flopen test-grp test-pidfile
+CFLAGS+= -g -Wall -Wextra -Werror -lutil
 
 .PHONY: tests
 tests: ${TESTS}
From kuriyama at FreeBSD.org  Thu Nov 12 03:31:20 2009
From: kuriyama at FreeBSD.org (Jun Kuriyama)
Date: Thu Nov 12 03:31:31 2009
Subject: svn commit: r199215 - in head/sys: amd64/amd64 i386/i386
Message-ID: <200911120331.nAC3VJtJ016610@svn.freebsd.org>

Author: kuriyama
Date: Thu Nov 12 03:31:19 2009
New Revision: 199215
URL: http://svn.freebsd.org/changeset/base/199215

Log:
  - Style nits.
  - Remove unneeded TUNABLE_INT().
  
  Suggested by:	avg, kib

Modified:
  head/sys/amd64/amd64/initcpu.c
  head/sys/i386/i386/initcpu.c

Modified: head/sys/amd64/amd64/initcpu.c
==============================================================================
--- head/sys/amd64/amd64/initcpu.c	Thu Nov 12 01:37:25 2009	(r199214)
+++ head/sys/amd64/amd64/initcpu.c	Thu Nov 12 03:31:19 2009	(r199215)
@@ -53,7 +53,6 @@ SYSCTL_INT(_hw, OID_AUTO, instruction_ss
  *  1: force disable CLFLUSH
  */
 static int	hw_clflush_disable = -1;
-TUNABLE_INT("hw.clflush_disable", &hw_clflush_disable);
 
 int	cpu;			/* Are we 386, 386sx, 486, etc? */
 u_int	cpu_feature;		/* Feature flags */
@@ -185,7 +184,6 @@ initializecpu(void)
 	 * hw.clflush_disable tunable.  This may help Xen guest on some AMD
 	 * CPUs.
 	 */
-	if (hw_clflush_disable == 1) {
+	if (hw_clflush_disable == 1)
 		cpu_feature &= ~CPUID_CLFSH;
-	}
 }

Modified: head/sys/i386/i386/initcpu.c
==============================================================================
--- head/sys/i386/i386/initcpu.c	Thu Nov 12 01:37:25 2009	(r199214)
+++ head/sys/i386/i386/initcpu.c	Thu Nov 12 03:31:19 2009	(r199215)
@@ -81,7 +81,6 @@ SYSCTL_INT(_hw, OID_AUTO, instruction_ss
  *  1: force disable CLFLUSH
  */
 static int	hw_clflush_disable = -1;
-TUNABLE_INT("hw.clflush_disable", &hw_clflush_disable);
 
 /* Must *NOT* be BSS or locore will bzero these after setting them */
 int	cpu = 0;		/* Are we 386, 386sx, 486, etc? */
@@ -737,9 +736,8 @@ initializecpu(void)
 	 * hw.clflush_disable tunable.  This may help Xen guest on some AMD
 	 * CPUs.
 	 */
-	if (hw_clflush_disable == 1) {
+	if (hw_clflush_disable == 1)
 		cpu_feature &= ~CPUID_CLFSH;
-	}
 
 #if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE)
 	/*
From nparhar at gmail.com  Thu Nov 12 03:55:41 2009
From: nparhar at gmail.com (Navdeep Parhar)
Date: Thu Nov 12 03:55:49 2009
Subject: svn commit: r199208 - in head/sys: conf libkern netinet 
	netinet/libalias
In-Reply-To: <200911120046.nAC0kS2V012731@svn.freebsd.org>
References: <200911120046.nAC0kS2V012731@svn.freebsd.org>
Message-ID: 

This seems to break kernel builds.  Throwing away the private
inet_aton implementation inside krping.c will probably fix it.

/usr/src/sys/modules/rdma/krping/../../../contrib/rdma/krping/krping.c:117:
error: static declaration of 'inet_aton' follows non-static
declaration
@/netinet/in.h:716: error: previous declaration of 'inet_aton' was here
*** Error code 1

Regards,
Navdeep

On Wed, Nov 11, 2009 at 4:46 PM, Attilio Rao  wrote:
> Author: attilio
> Date: Thu Nov 12 00:46:28 2009
> New Revision: 199208
> URL: http://svn.freebsd.org/changeset/base/199208
>
> Log:
> ?Move inet_aton() (specular to inet_ntoa(), already present in libkern)
> ?into libkern in order to made it usable by other modules than alias_proxy.
>
> ?Obtained from: ? ? ? ?Sandvine Incorporated
> ?Sponsored by: Sandvine Incorporated
> ?MFC: ? ? ? ? ?1 week
>
> Added:
> ?head/sys/libkern/inet_aton.c ? (contents, props changed)
> Modified:
> ?head/sys/conf/files
> ?head/sys/netinet/in.h
> ?head/sys/netinet/libalias/alias_proxy.c
>
> Modified: head/sys/conf/files
> ==============================================================================
> --- head/sys/conf/files Thu Nov 12 00:36:22 2009 ? ? ? ?(r199207)
> +++ head/sys/conf/files Thu Nov 12 00:46:28 2009 ? ? ? ?(r199208)
> @@ -2193,6 +2193,7 @@ libkern/iconv_converter_if.m ? ? ?optional li
> ?libkern/iconv_xlat.c ? ? ? ? ? optional libiconv
> ?libkern/iconv_xlat16.c ? ? ? ? optional libiconv
> ?libkern/index.c ? ? ? ? ? ? ? ? ? ? ? ?standard
> +libkern/inet_aton.c ? ? ? ? ? ?standard
> ?libkern/inet_ntoa.c ? ? ? ? ? ?standard
> ?libkern/mcount.c ? ? ? ? ? ? ? optional profiling-routine
> ?libkern/memcmp.c ? ? ? ? ? ? ? standard
>
> Added: head/sys/libkern/inet_aton.c
> ==============================================================================
> --- /dev/null ? 00:00:00 1970 ? (empty, because file is newly added)
> +++ head/sys/libkern/inet_aton.c ? ? ? ?Thu Nov 12 00:46:28 2009 ? ? ? ?(r199208)
> @@ -0,0 +1,136 @@
> +/*-
> + * Copyright (c) 2001 Charles Mott 
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + * ? ?notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + * ? ?notice, this list of conditions and the following disclaimer in the
> + * ? ?documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. ?IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + */
> +
> +#include 
> +__FBSDID("$FreeBSD$");
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +int
> +inet_aton(const char *cp, struct in_addr *addr)
> +{
> + ? ? ? u_long parts[4];
> + ? ? ? in_addr_t val;
> + ? ? ? const char *c;
> + ? ? ? char *endptr;
> + ? ? ? int gotend, n;
> +
> + ? ? ? c = (const char *)cp;
> + ? ? ? n = 0;
> +
> + ? ? ? /*
> + ? ? ? ?* Run through the string, grabbing numbers until
> + ? ? ? ?* the end of the string, or some error
> + ? ? ? ?*/
> + ? ? ? gotend = 0;
> + ? ? ? while (!gotend) {
> + ? ? ? ? ? ? ? unsigned long l;
> +
> + ? ? ? ? ? ? ? l = strtoul(c, &endptr, 0);
> +
> + ? ? ? ? ? ? ? if (l == ULONG_MAX || (l == 0 && endptr == c))
> + ? ? ? ? ? ? ? ? ? ? ? return (0);
> +
> + ? ? ? ? ? ? ? val = (in_addr_t)l;
> +
> + ? ? ? ? ? ? ? /*
> + ? ? ? ? ? ? ? ?* If the whole string is invalid, endptr will equal
> + ? ? ? ? ? ? ? ?* c.. this way we can make sure someone hasn't
> + ? ? ? ? ? ? ? ?* gone '.12' or something which would get past
> + ? ? ? ? ? ? ? ?* the next check.
> + ? ? ? ? ? ? ? ?*/
> + ? ? ? ? ? ? ? if (endptr == c)
> + ? ? ? ? ? ? ? ? ? ? ? return (0);
> + ? ? ? ? ? ? ? parts[n] = val;
> + ? ? ? ? ? ? ? c = endptr;
> +
> + ? ? ? ? ? ? ? /* Check the next character past the previous number's end */
> + ? ? ? ? ? ? ? switch (*c) {
> + ? ? ? ? ? ? ? case '.' :
> +
> + ? ? ? ? ? ? ? ? ? ? ? /* Make sure we only do 3 dots .. */
> + ? ? ? ? ? ? ? ? ? ? ? if (n == 3) ? ? /* Whoops. Quit. */
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return (0);
> + ? ? ? ? ? ? ? ? ? ? ? n++;
> + ? ? ? ? ? ? ? ? ? ? ? c++;
> + ? ? ? ? ? ? ? ? ? ? ? break;
> +
> + ? ? ? ? ? ? ? case '\0':
> + ? ? ? ? ? ? ? ? ? ? ? gotend = 1;
> + ? ? ? ? ? ? ? ? ? ? ? break;
> +
> + ? ? ? ? ? ? ? default:
> + ? ? ? ? ? ? ? ? ? ? ? if (isspace((unsigned char)*c)) {
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? gotend = 1;
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
> + ? ? ? ? ? ? ? ? ? ? ? } else {
> +
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* Invalid character, then fail. */
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return (0);
> + ? ? ? ? ? ? ? ? ? ? ? }
> + ? ? ? ? ? ? ? }
> +
> + ? ? ? }
> +
> + ? ? ? /* Concoct the address according to the number of parts specified. */
> + ? ? ? switch (n) {
> + ? ? ? case 0: ? ? ? ? ? ? ? ? ? ? ? ? /* a -- 32 bits */
> +
> + ? ? ? ? ? ? ? /*
> + ? ? ? ? ? ? ? ?* Nothing is necessary here. ?Overflow checking was
> + ? ? ? ? ? ? ? ?* already done in strtoul().
> + ? ? ? ? ? ? ? ?*/
> + ? ? ? ? ? ? ? break;
> + ? ? ? case 1: ? ? ? ? ? ? ? ? ? ? ? ? /* a.b -- 8.24 bits */
> + ? ? ? ? ? ? ? if (val > 0xffffff || parts[0] > 0xff)
> + ? ? ? ? ? ? ? ? ? ? ? return (0);
> + ? ? ? ? ? ? ? val |= parts[0] << 24;
> + ? ? ? ? ? ? ? break;
> +
> + ? ? ? case 2: ? ? ? ? ? ? ? ? ? ? ? ? /* a.b.c -- 8.8.16 bits */
> + ? ? ? ? ? ? ? if (val > 0xffff || parts[0] > 0xff || parts[1] > 0xff)
> + ? ? ? ? ? ? ? ? ? ? ? return (0);
> + ? ? ? ? ? ? ? val |= (parts[0] << 24) | (parts[1] << 16);
> + ? ? ? ? ? ? ? break;
> +
> + ? ? ? case 3: ? ? ? ? ? ? ? ? ? ? ? ? /* a.b.c.d -- 8.8.8.8 bits */
> + ? ? ? ? ? ? ? if (val > 0xff || parts[0] > 0xff || parts[1] > 0xff ||
> + ? ? ? ? ? ? ? ? ? parts[2] > 0xff)
> + ? ? ? ? ? ? ? ? ? ? ? return (0);
> + ? ? ? ? ? ? ? val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
> + ? ? ? ? ? ? ? break;
> + ? ? ? }
> +
> + ? ? ? if (addr != NULL)
> + ? ? ? ? ? ? ? addr->s_addr = htonl(val);
> + ? ? ? return (1);
> +}
> +
>
> Modified: head/sys/netinet/in.h
> ==============================================================================
> --- head/sys/netinet/in.h ? ? ? Thu Nov 12 00:36:22 2009 ? ? ? ?(r199207)
> +++ head/sys/netinet/in.h ? ? ? Thu Nov 12 00:46:28 2009 ? ? ? ?(r199208)
> @@ -713,6 +713,7 @@ int ?in_broadcast(struct in_addr, struct
> ?int ? ? in_canforward(struct in_addr);
> ?int ? ? in_localaddr(struct in_addr);
> ?int ? ? in_localip(struct in_addr);
> +int ? ? inet_aton(const char *, struct in_addr *); /* in libkern */
> ?char ? *inet_ntoa(struct in_addr); /* in libkern */
> ?char ? *inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */
> ?void ? ?in_ifdetach(struct ifnet *);
>
> Modified: head/sys/netinet/libalias/alias_proxy.c
> ==============================================================================
> --- head/sys/netinet/libalias/alias_proxy.c ? ? Thu Nov 12 00:36:22 2009 ? ? ? ?(r199207)
> +++ head/sys/netinet/libalias/alias_proxy.c ? ? Thu Nov 12 00:46:28 2009 ? ? ? ?(r199208)
> @@ -137,9 +137,6 @@ struct proxy_entry {
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?destination of a proxied IP packet
> ?*/
>
> -#ifdef _KERNEL ? ? ? ? /* XXX: can it be moved to libkern? */
> -static int inet_aton(const char *cp, struct in_addr *addr);
> -#endif
> ?static int ? ? IpMask(int, struct in_addr *);
> ?static int ? ? IpAddr(char *, struct in_addr *);
> ?static int ? ? IpPort(char *, int, int *);
> @@ -149,107 +146,6 @@ static int ? ? ? ?RuleNumberDelete(struct libal
> ?static void ? ?ProxyEncodeTcpStream(struct alias_link *, struct ip *, int);
> ?static void ? ?ProxyEncodeIpHeader(struct ip *, int);
>
> -#ifdef _KERNEL
> -static int
> -inet_aton(cp, addr)
> - ? ? ? ?const char *cp;
> - ? ? ? ?struct in_addr *addr;
> -{
> - ? ? ? u_long parts[4];
> - ? ? ? in_addr_t val;
> - ? ? ? const char *c;
> - ? ? ? char *endptr;
> - ? ? ? int gotend, n;
> -
> - ? ? ? c = (const char *)cp;
> - ? ? ? n = 0;
> - ? ? ? /*
> - ? ? ? ?* Run through the string, grabbing numbers until
> - ? ? ? ?* the end of the string, or some error
> - ? ? ? ?*/
> - ? ? ? gotend = 0;
> - ? ? ? while (!gotend) {
> - ? ? ? ? ? ? ? unsigned long l;
> -
> - ? ? ? ? ? ? ? l = strtoul(c, &endptr, 0);
> -
> - ? ? ? ? ? ? ? if (l == ULONG_MAX || (l == 0 && endptr == c))
> - ? ? ? ? ? ? ? ? ? ? ? return (0);
> -
> - ? ? ? ? ? ? ? val = (in_addr_t)l;
> - ? ? ? ? ? ? ? /*
> - ? ? ? ? ? ? ? ?* If the whole string is invalid, endptr will equal
> - ? ? ? ? ? ? ? ?* c.. this way we can make sure someone hasn't
> - ? ? ? ? ? ? ? ?* gone '.12' or something which would get past
> - ? ? ? ? ? ? ? ?* the next check.
> - ? ? ? ? ? ? ? ?*/
> - ? ? ? ? ? ? ? if (endptr == c)
> - ? ? ? ? ? ? ? ? ? ? ? return (0);
> - ? ? ? ? ? ? ? parts[n] = val;
> - ? ? ? ? ? ? ? c = endptr;
> -
> - ? ? ? ? ? ? ? /* Check the next character past the previous number's end */
> - ? ? ? ? ? ? ? switch (*c) {
> - ? ? ? ? ? ? ? case '.' :
> - ? ? ? ? ? ? ? ? ? ? ? /* Make sure we only do 3 dots .. */
> - ? ? ? ? ? ? ? ? ? ? ? if (n == 3) ? ? /* Whoops. Quit. */
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return (0);
> - ? ? ? ? ? ? ? ? ? ? ? n++;
> - ? ? ? ? ? ? ? ? ? ? ? c++;
> - ? ? ? ? ? ? ? ? ? ? ? break;
> -
> - ? ? ? ? ? ? ? case '\0':
> - ? ? ? ? ? ? ? ? ? ? ? gotend = 1;
> - ? ? ? ? ? ? ? ? ? ? ? break;
> -
> - ? ? ? ? ? ? ? default:
> - ? ? ? ? ? ? ? ? ? ? ? if (isspace((unsigned char)*c)) {
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? gotend = 1;
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
> - ? ? ? ? ? ? ? ? ? ? ? } else
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return (0); ? ? /* Invalid character, so fail */
> - ? ? ? ? ? ? ? }
> -
> - ? ? ? }
> -
> - ? ? ? /*
> - ? ? ? ?* Concoct the address according to
> - ? ? ? ?* the number of parts specified.
> - ? ? ? ?*/
> -
> - ? ? ? switch (n) {
> - ? ? ? case 0: ? ? ? ? ? ? ? ? ? ? ? ? /* a -- 32 bits */
> - ? ? ? ? ? ? ? /*
> - ? ? ? ? ? ? ? ?* Nothing is necessary here. ?Overflow checking was
> - ? ? ? ? ? ? ? ?* already done in strtoul().
> - ? ? ? ? ? ? ? ?*/
> - ? ? ? ? ? ? ? break;
> - ? ? ? case 1: ? ? ? ? ? ? ? ? ? ? ? ? /* a.b -- 8.24 bits */
> - ? ? ? ? ? ? ? if (val > 0xffffff || parts[0] > 0xff)
> - ? ? ? ? ? ? ? ? ? ? ? return (0);
> - ? ? ? ? ? ? ? val |= parts[0] << 24;
> - ? ? ? ? ? ? ? break;
> -
> - ? ? ? case 2: ? ? ? ? ? ? ? ? ? ? ? ? /* a.b.c -- 8.8.16 bits */
> - ? ? ? ? ? ? ? if (val > 0xffff || parts[0] > 0xff || parts[1] > 0xff)
> - ? ? ? ? ? ? ? ? ? ? ? return (0);
> - ? ? ? ? ? ? ? val |= (parts[0] << 24) | (parts[1] << 16);
> - ? ? ? ? ? ? ? break;
> -
> - ? ? ? case 3: ? ? ? ? ? ? ? ? ? ? ? ? /* a.b.c.d -- 8.8.8.8 bits */
> - ? ? ? ? ? ? ? if (val > 0xff || parts[0] > 0xff || parts[1] > 0xff ||
> - ? ? ? ? ? ? ? ? ? parts[2] > 0xff)
> - ? ? ? ? ? ? ? ? ? ? ? return (0);
> - ? ? ? ? ? ? ? val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
> - ? ? ? ? ? ? ? break;
> - ? ? ? }
> -
> - ? ? ? if (addr != NULL)
> - ? ? ? ? ? ? ? addr->s_addr = htonl(val);
> - ? ? ? return (1);
> -}
> -#endif
> -
> ?static int
> ?IpMask(int nbits, struct in_addr *mask)
> ?{
> _______________________________________________
> svn-src-all@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
>
From peterjeremy at acm.org  Thu Nov 12 05:06:04 2009
From: peterjeremy at acm.org (Peter Jeremy)
Date: Thu Nov 12 05:06:16 2009
Subject: svn commit: r198848 - head/bin/ps
In-Reply-To: <20091111230915.B3510@besplex.bde.org>
References: <200911030928.nA39SjLx085597@svn.freebsd.org>
	<20091103214231.H23957@delplex.bde.org>
	<4AF4B6B2.3090706@delphij.net>
	<20091111230915.B3510@besplex.bde.org>
Message-ID: <20091112050515.GA15002@server.vk2pj.dyndns.org>

On 2009-Nov-11 23:22:36 +1100, Bruce Evans  wrote:
>On Fri, 6 Nov 2009, Xin LI wrote:
>> Will it sound reasonable to divide pcpu by ncpu and cap the number at 100?
>
>I don't like that.  It would break scripts even more than units changes.
>It is hard for users to interpret too.  Suddenly, processes taking
>100% of 1 CPU would take 12.5% of 8 CPUs on a system with 8 CPUs, and
>different %CPU on systems with a different number of CPUs.

Solaris does this.  I found it particularly annoying for identifying
spinning, single-threaded processes - it's not as immediately obvious
that 1.6% CPU means a spinning process on a T5000, and the granularity
gets worse.

>Just print %CPU in %4.0f format when it is >= 99.5 (or whatever rounds
>to 100.0).  This works up to 999.5 %CPU.

Actually, %4.0f works up to 9999.5 %CPU because there's no '.' in the
result.  I think this is an excellent solution.  And since FreeBSD
currently has a hard limit of 64 CPUs, it's unlikely to be exceeded
for a while.

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091112/58c98939/attachment.pgp
From antoine at FreeBSD.org  Thu Nov 12 06:48:16 2009
From: antoine at FreeBSD.org (Antoine Brodin)
Date: Thu Nov 12 06:48:58 2009
Subject: svn commit: r199201 - in head: contrib/libpcap sbin/ifconfig 
	share/man/man4 sys/kern sys/net sys/sys
In-Reply-To: <200911112130.nABLUw9b007768@svn.freebsd.org>
References: <200911112130.nABLUw9b007768@svn.freebsd.org>
Message-ID: 

On Wed, Nov 11, 2009 at 10:30 PM, Xin LI  wrote:
> Author: delphij
> Date: Wed Nov 11 21:30:58 2009
> New Revision: 199201
> URL: http://svn.freebsd.org/changeset/base/199201
>
> Log:
> ?Add interface description capability as inspired by OpenBSD.
>
> ?MFC after: ? ?3 months
>
> Modified:
> ?head/contrib/libpcap/inet.c
> ?head/sbin/ifconfig/ifconfig.8
> ?head/sbin/ifconfig/ifconfig.c
> ?head/share/man/man4/netintro.4
> ?head/sys/kern/kern_jail.c
> ?head/sys/net/if.c
> ?head/sys/net/if.h
> ?head/sys/net/if_var.h
> ?head/sys/sys/param.h
> ?head/sys/sys/priv.h
> ?head/sys/sys/sockio.h
...
> Modified: head/sys/net/if_var.h
> ==============================================================================
> --- head/sys/net/if_var.h ? ? ? Wed Nov 11 21:18:27 2009 ? ? ? ?(r199200)
> +++ head/sys/net/if_var.h ? ? ? Wed Nov 11 21:30:58 2009 ? ? ? ?(r199201)
> @@ -198,6 +198,7 @@ struct ifnet {
> ? ? ? ?void ? ?*if_pf_kif;
> ? ? ? ?void ? ?*if_lagg; ? ? ? ? ? ? ? /* lagg glue */
> ? ? ? ?u_char ? if_alloctype; ? ? ? ? ?/* if_type at time of allocation */
> + ? ? ? struct sbuf *if_description; ? ?/* interface description */
>
> ? ? ? ?/*
> ? ? ? ? * Spare fields are added so that we can modify sensitive data
> @@ -205,7 +206,7 @@ struct ifnet {
> ? ? ? ? * be used with care where binary compatibility is required.
> ? ? ? ? */
> ? ? ? ?char ? ? if_cspare[3];
> - ? ? ? void ? ?*if_pspare[8];
> + ? ? ? void ? ?*if_pspare[7];
> ? ? ? ?int ? ? if_ispare[4];
> ?};

Hi Delphij,

Doesn't this break ABI gratuitously?  (I think it changes the size of
struct ifnet)

Cheers,

Antoine
From flo at smeets.im  Thu Nov 12 07:51:59 2009
From: flo at smeets.im (Florian Smeets)
Date: Thu Nov 12 07:52:05 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <20091111215651.GM64905@hoeg.nl>
References: <7meio5g4yx.wl%kuriyama@s2factory.co.jp>
	<20091111215651.GM64905@hoeg.nl>
Message-ID: <4AFBBC15.8080101@smeets.im>

On 11/11/09 10:56 PM, Ed Schouten wrote:
> Hi,
>
> * Jun Kuriyama  wrote:
>> Can you test with these patches?  Testing on only one of both system
>> is enough.  "patch-1" forces disabling CLFLUSH feature even if SS bit
>> exists.  "patch-2" forces no CLFLUSH tweak.  I'd like to know with
>> which patch your system can live.
>
> For some reason they both seem to boot. Yikes. I've done some more
> testing and it seems the old version even hangs if I add some additional
> printf's above and below, which makes me believe the problem is a bit
> more complex than we realize...
>

FWIW, this also breaks my Intel Atom 330 setup.

CPU: Intel(R) Atom(TM) CPU  330   @ 1.60GHz (1606.47-MHz K8-class CPU)
   Origin = "GenuineIntel"  Id = 0x106c2  Stepping = 2
 
Features=0xbfe9fbff
   Features2=0x40e31d>
   AMD Features=0x20100800
   AMD Features2=0x1

r199066 boots, r199067 does not.

I get a page fault:

SMP: AP CPU #1 Launched!
SMP: AP CPU #2 Launched!
SMP: AP CPU #3 Launched!


Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address	= 0x288
fault code		= supervisor read data, page not present
instruction pointer	= 0x20:0xffffffff802b014e
stack pointer	        = 0x28:0xffffffff8083db30
frame pointer	        = 0x28:0xffffffff8083db50
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 0 (swapper)

You can have a look at the backtrace here: 
http://smeets.im/~flo/panic_20091109.jpg

I also tried r199215, it does not help. The back trace looks almost the 
same (http://smeets.im/~flo/panic_20091112.JPG)

I can try the proposed patches tonight if it helps.

Cheers,
Florian
From nyan at FreeBSD.org  Thu Nov 12 10:59:01 2009
From: nyan at FreeBSD.org (Takahashi Yoshihiro)
Date: Thu Nov 12 10:59:07 2009
Subject: svn commit: r199219 - head/sys/i386/i386
Message-ID: <200911121059.nACAx0LE028572@svn.freebsd.org>

Author: nyan
Date: Thu Nov 12 10:59:00 2009
New Revision: 199219
URL: http://svn.freebsd.org/changeset/base/199219

Log:
  Fix cpu model for PODP5V83.  It is P24T, not P54T.
  Also remove redundant 'Overdrive' word.
  
  Pointed out by:	SATOU Tomokazu (tomo1770 at maple ocn ne jp)
  MFC after:	1 week

Modified:
  head/sys/i386/i386/identcpu.c

Modified: head/sys/i386/i386/identcpu.c
==============================================================================
--- head/sys/i386/i386/identcpu.c	Thu Nov 12 10:44:29 2009	(r199218)
+++ head/sys/i386/i386/identcpu.c	Thu Nov 12 10:59:00 2009	(r199219)
@@ -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 nyan at FreeBSD.org  Thu Nov 12 11:27:08 2009
From: nyan at FreeBSD.org (Takahashi Yoshihiro)
Date: Thu Nov 12 11:27:20 2009
Subject: svn commit: r199220 - head/sys/pc98/cbus
Message-ID: <200911121127.nACBR7gn029232@svn.freebsd.org>

Author: nyan
Date: Thu Nov 12 11:27:07 2009
New Revision: 199220
URL: http://svn.freebsd.org/changeset/base/199220

Log:
  MFi386: revision 199104
  
    Make isa_dma functions MPSAFE by introducing its own private lock.

Modified:
  head/sys/pc98/cbus/cbus_dma.c

Modified: head/sys/pc98/cbus/cbus_dma.c
==============================================================================
--- head/sys/pc98/cbus/cbus_dma.c	Thu Nov 12 10:59:00 2009	(r199219)
+++ head/sys/pc98/cbus/cbus_dma.c	Thu Nov 12 11:27:07 2009	(r199220)
@@ -72,6 +72,8 @@ static u_int8_t	dma_bounced = 0;
 static u_int8_t	dma_busy = 0;		/* Used in isa_dmastart() */
 static u_int8_t	dma_inuse = 0;		/* User for acquire/release */
 static u_int8_t dma_auto_mode = 0;
+static struct mtx isa_dma_lock;
+MTX_SYSINIT(isa_dma_lock, &isa_dma_lock, "isa DMA lock", MTX_DEF);
 
 #define VALID_DMA_MASK (3)
 
@@ -93,22 +95,31 @@ isa_dma_init(int chan, u_int bouncebufsi
 		panic("isa_dma_init: impossible request"); 
 #endif
 
-	dma_bouncebufsize[chan] = bouncebufsize;
 
 	/* Try malloc() first.  It works better if it works. */
 	buf = malloc(bouncebufsize, M_DEVBUF, flag);
 	if (buf != NULL) {
-		if (isa_dmarangecheck(buf, bouncebufsize, chan) == 0) {
-			dma_bouncebuf[chan] = buf;
-			return (0);
+		if (isa_dmarangecheck(buf, bouncebufsize, chan) != 0) {
+			free(buf, M_DEVBUF);
+			buf = NULL;
 		}
-		free(buf, M_DEVBUF);
 	}
-	buf = contigmalloc(bouncebufsize, M_DEVBUF, flag, 0ul, 0xfffffful,
+
+	if (buf == NULL) {
+		buf = contigmalloc(bouncebufsize, M_DEVBUF, flag, 0ul, 0xfffffful,
 			   1ul, chan & 4 ? 0x20000ul : 0x10000ul);
+	}
+
 	if (buf == NULL)
 		return (ENOMEM);
+
+	mtx_lock(&isa_dma_lock);
+
+	dma_bouncebufsize[chan] = bouncebufsize;
 	dma_bouncebuf[chan] = buf;
+
+	mtx_unlock(&isa_dma_lock);
+
 	return (0);
 }
 
@@ -125,12 +136,15 @@ isa_dma_acquire(chan)
 		panic("isa_dma_acquire: channel out of range");
 #endif
 
+	mtx_lock(&isa_dma_lock);
 	if (dma_inuse & (1 << chan)) {
 		printf("isa_dma_acquire: channel %d already in use\n", chan);
+		mtx_unlock(&isa_dma_lock);
 		return (EBUSY);
 	}
 	dma_inuse |= (1 << chan);
 	dma_auto_mode &= ~(1 << chan);
+	mtx_unlock(&isa_dma_lock);
 
 	return (0);
 }
@@ -147,8 +161,11 @@ isa_dma_release(chan)
 	if (chan & ~VALID_DMA_MASK)
 		panic("isa_dma_release: channel out of range");
 
+	mtx_lock(&isa_dma_lock);
 	if ((dma_inuse & (1 << chan)) == 0)
 		printf("isa_dma_release: channel %d not in use\n", chan);
+#else
+	mtx_lock(&isa_dma_lock);
 #endif
 
 	if (dma_busy & (1 << chan)) {
@@ -163,6 +180,8 @@ isa_dma_release(chan)
 
 	dma_inuse &= ~(1 << chan);
 	dma_auto_mode &= ~(1 << chan);
+
+	mtx_unlock(&isa_dma_lock);
 }
 
 /*
@@ -175,8 +194,11 @@ isa_dmastart(int flags, caddr_t addr, u_
 	vm_paddr_t phys;
 	int waport;
 	caddr_t newaddr;
+	int dma_range_checked;
 
-	GIANT_REQUIRED;
+	/* translate to physical */
+	phys = pmap_extract(kernel_pmap, (vm_offset_t)addr);
+	dma_range_checked = isa_dmarangecheck(addr, nbytes, chan);
 
 #ifdef DIAGNOSTIC
 	if (chan & ~VALID_DMA_MASK)
@@ -186,8 +208,11 @@ isa_dmastart(int flags, caddr_t addr, u_
 	    || (chan >= 4 && (nbytes > (1<<17) || (u_int)addr & 1)))
 		panic("isa_dmastart: impossible request");
 
+	mtx_lock(&isa_dma_lock);
 	if ((dma_inuse & (1 << chan)) == 0)
 		printf("isa_dmastart: channel %d not acquired\n", chan);
+#else
+	mtx_lock(&isa_dma_lock);
 #endif
 
 #if 0
@@ -202,7 +227,7 @@ isa_dmastart(int flags, caddr_t addr, u_
 
 	dma_busy |= (1 << chan);
 
-	if (isa_dmarangecheck(addr, nbytes, chan)) {
+	if (dma_range_checked) {
 		if (dma_bouncebuf[chan] == NULL
 		    || dma_bouncebufsize[chan] < nbytes)
 			panic("isa_dmastart: bad bounce buffer"); 
@@ -215,9 +240,6 @@ isa_dmastart(int flags, caddr_t addr, u_
 		addr = newaddr;
 	}
 
-	/* translate to physical */
-	phys = pmap_extract(kernel_pmap, (vm_offset_t)addr);
-
 	if (flags & ISADMA_RAW) {
 	    dma_auto_mode |= (1 << chan);
 	} else { 
@@ -255,6 +277,8 @@ isa_dmastart(int flags, caddr_t addr, u_
 
 	/* unmask channel */
 	outb(DMA1_SMSK, chan);
+
+	mtx_unlock(&isa_dma_lock);
 }
 
 void
@@ -275,6 +299,7 @@ isa_dmadone(int flags, caddr_t addr, int
 		printf("isa_dmadone: channel %d not acquired\n", chan);
 #endif
 
+	mtx_lock(&isa_dma_lock);
 	if (((dma_busy & (1 << chan)) == 0) && 
 	    (dma_auto_mode & (1 << chan)) == 0 )
 		printf("isa_dmadone: channel %d not busy\n", chan);
@@ -290,6 +315,7 @@ isa_dmadone(int flags, caddr_t addr, int
 		dma_bounced &= ~(1 << chan);
 	}
 	dma_busy &= ~(1 << chan);
+	mtx_unlock(&isa_dma_lock);
 }
 
 /*
@@ -306,8 +332,6 @@ isa_dmarangecheck(caddr_t va, u_int leng
 	vm_offset_t endva;
 	u_int dma_pgmsk = (chan & 4) ?  ~(128*1024-1) : ~(64*1024-1);
 
-	GIANT_REQUIRED;
-
 	endva = (vm_offset_t)round_page((vm_offset_t)va + length);
 	for (; va < (caddr_t) endva ; va += PAGE_SIZE) {
 		phys = trunc_page(pmap_extract(kernel_pmap, (vm_offset_t)va));
@@ -364,13 +388,15 @@ isa_dmarangecheck(caddr_t va, u_int leng
  * or -1 if the channel requested is not active.
  *
  */
-int
-isa_dmastatus(int chan)
+static int
+isa_dmastatus_locked(int chan)
 {
 	u_long	cnt = 0;
 	int	ffport, waport;
 	u_long	low1, high1, low2, high2;
 
+	mtx_assert(&isa_dma_lock, MA_OWNED);
+
 	/* channel active? */
 	if ((dma_inuse & (1 << chan)) == 0) {
 		printf("isa_dmastatus: channel %d not active\n", chan);
@@ -411,6 +437,18 @@ isa_dmastatus(int chan)
 	return(cnt);
 }
 
+int
+isa_dmastatus(int chan)
+{
+	int status;
+
+	mtx_lock(&isa_dma_lock);
+	status = isa_dmastatus_locked(chan);
+	mtx_unlock(&isa_dma_lock);
+
+	return (status);
+}
+
 /*
  * Reached terminal count yet ?
  */
@@ -427,19 +465,27 @@ isa_dmatc(int chan)
 int
 isa_dmastop(int chan) 
 {
+	int status;
+
+	mtx_lock(&isa_dma_lock);
 	if ((dma_inuse & (1 << chan)) == 0)
 		printf("isa_dmastop: channel %d not acquired\n", chan);  
 
 	if (((dma_busy & (1 << chan)) == 0) &&
 	    ((dma_auto_mode & (1 << chan)) == 0)) {
 		printf("chan %d not busy\n", chan);
+		mtx_unlock(&isa_dma_lock);
 		return -2 ;
 	}
     
 	if ((chan & 4) == 0)
 		outb(DMA1_SMSK, (chan & 3) | 4 /* disable mask */);
 
-	return(isa_dmastatus(chan));
+	status = isa_dmastatus_locked(chan);
+
+	mtx_unlock(&isa_dma_lock);
+
+	return (status);
 }
 
 /*
From bzeeb-lists at lists.zabbadoz.net  Thu Nov 12 11:40:07 2009
From: bzeeb-lists at lists.zabbadoz.net (Bjoern A. Zeeb)
Date: Thu Nov 12 11:40:13 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <200911090254.nA92sG1G005921@svn.freebsd.org>
References: <200911090254.nA92sG1G005921@svn.freebsd.org>
Message-ID: <20091112113708.I37440@maildrop.int.zabbadoz.net>

On Mon, 9 Nov 2009, Jun Kuriyama wrote:

Hi,

> Author: kuriyama
> Date: Mon Nov  9 02:54:16 2009
> New Revision: 199067
> URL: http://svn.freebsd.org/changeset/base/199067
>
> Log:
>  - Add hw.clflush_disable loader tunable to avoid panic (trap 9) at
>    map_invalidate_cache_range() even if CPU is not Intel.
>  - This tunable can be set to -1 (default), 0 and 1.  -1 is same as
>    current behavior, which automatically disable CLFLUSH on Intel CPUs
>    without CPUID_SS (should be occured on Xen only).  You can specify 1
>    when this panic happened on non-Intel CPUs (such as AMD's).  Because
>    disabling CLFLUSH may reduce performance, you can try with setting 0
>    on Intel CPUs without SS to use CLFLUSH feature.

I wasn't able to boot dual Xeon machines anymore.

 	svn merge -c -199067 $FBDSVN/head/sys sys

fixed this problem.


-- 
Bjoern A. Zeeb         It will not break if you know what you are doing.
From ume at FreeBSD.org  Thu Nov 12 11:54:13 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Thu Nov 12 11:54:19 2009
Subject: svn commit: r199221 - head/lib/libc/net
Message-ID: <200911121154.nACBsDX7029775@svn.freebsd.org>

Author: ume
Date: Thu Nov 12 11:54:12 2009
New Revision: 199221
URL: http://svn.freebsd.org/changeset/base/199221

Log:
  Add missing IEEE1394 support dropped during merge from NetBSD.

Modified:
  head/lib/libc/net/getnameinfo.c

Modified: head/lib/libc/net/getnameinfo.c
==============================================================================
--- head/lib/libc/net/getnameinfo.c	Thu Nov 12 11:27:07 2009	(r199220)
+++ head/lib/libc/net/getnameinfo.c	Thu Nov 12 11:54:12 2009	(r199221)
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -385,6 +386,7 @@ getnameinfo_link(const struct sockaddr *
 {
 	const struct sockaddr_dl *sdl =
 	    (const struct sockaddr_dl *)(const void *)sa;
+	const struct fw_hwaddr *iha;
 	int n;
 
 	if (serv != NULL && servlen > 0)
@@ -400,6 +402,15 @@ getnameinfo_link(const struct sockaddr *
 	}
 
 	switch (sdl->sdl_type) {
+	case IFT_IEEE1394:
+		if (sdl->sdl_alen < sizeof(iha->sender_unique_ID_hi) +
+		    sizeof(iha->sender_unique_ID_lo))
+			return EAI_FAMILY;
+		iha = (const struct fw_hwaddr *)(const void *)LLADDR(sdl);
+		return hexname((const u_int8_t *)&iha->sender_unique_ID_hi,
+		    sizeof(iha->sender_unique_ID_hi) +
+		    sizeof(iha->sender_unique_ID_lo),
+		    host, hostlen);
 	/*
 	 * The following have zero-length addresses.
 	 * IFT_ATM	(net/if_atmsubr.c)
From ed at 80386.nl  Thu Nov 12 13:52:12 2009
From: ed at 80386.nl (Ed Schouten)
Date: Thu Nov 12 13:52:26 2009
Subject: svn commit: r199201 - in head: contrib/libpcap sbin/ifconfig
 share/man/man4 sys/kern sys/net sys/sys
In-Reply-To: <200911112130.nABLUw9b007768@svn.freebsd.org>
References: <200911112130.nABLUw9b007768@svn.freebsd.org>
Message-ID: <20091112135211.GT64905@hoeg.nl>

Hi,

* Xin LI  wrote:
> Modified: head/sys/net/if_var.h
> ==============================================================================
> --- head/sys/net/if_var.h	Wed Nov 11 21:18:27 2009	(r199200)
> +++ head/sys/net/if_var.h	Wed Nov 11 21:30:58 2009	(r199201)
> @@ -198,6 +198,7 @@ struct ifnet {
>  	void	*if_pf_kif;
>  	void	*if_lagg;		/* lagg glue */
>  	u_char	 if_alloctype;		/* if_type at time of allocation */
> +	struct sbuf *if_description;	/* interface description */
>  
>  	/*
>  	 * Spare fields are added so that we can modify sensitive data
> @@ -205,7 +206,7 @@ struct ifnet {
>  	 * be used with care where binary compatibility is required.
>  	 */
>  	char	 if_cspare[3];
> -	void	*if_pspare[8];
> +	void	*if_pspare[7];
>  	int	if_ispare[4];
>  };

So there used to be four chars in a row here (between if_description and
if_cspare). Are you sure moving the pointer in between doesn't increase
the structure size?

-- 
 Ed Schouten 
 WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091112/8e9dbc3f/attachment.pgp
From rwatson at FreeBSD.org  Thu Nov 12 13:52:42 2009
From: rwatson at FreeBSD.org (Robert Watson)
Date: Thu Nov 12 13:53:20 2009
Subject: svn commit: r199201 - in head: contrib/libpcap sbin/ifconfig
 share/man/man4 sys/kern sys/net sys/sys
In-Reply-To: <200911112130.nABLUw9b007768@svn.freebsd.org>
References: <200911112130.nABLUw9b007768@svn.freebsd.org>
Message-ID: 


On Wed, 11 Nov 2009, Xin LI wrote:

> Author: delphij
> Date: Wed Nov 11 21:30:58 2009
> New Revision: 199201
> URL: http://svn.freebsd.org/changeset/base/199201
>
> Log:
>  Add interface description capability as inspired by OpenBSD.

Patches like this keep being proposed and rejected, so I was a bit surprised 
to see it hit the tree (but also see that I missed yet another thread on it on 
net@ in August, apparently).  Most of my thoughts on it are here:

   http://www.freebsd.org/cgi/query-pr.cgi?pr=83622

This commit seems to have quite a few problems, and would likely have 
benefited from further review before being committed.

> Modified: head/contrib/libpcap/inet.c
> ==============================================================================
> --- head/contrib/libpcap/inet.c	Wed Nov 11 21:18:27 2009	(r199200)
> +++ head/contrib/libpcap/inet.c	Wed Nov 11 21:30:58 2009	(r199201)
> @@ -403,22 +403,30 @@ add_addr_to_iflist(pcap_if_t **alldevs,
> 	pcap_addr_t *curaddr, *prevaddr, *nextaddr;
> #ifdef SIOCGIFDESCR
> 	struct ifreq ifrdesc;
> +#ifdef __FreeBSD__
> +#define _IFDESCRSIZE 64

Seems like this should be #ifdef IFDESCRSIZE rather than ifdef FreeBSD?  Also, 
have you checked with upstream to see if autoconf foo wouldn't be preferred?

> +	char ifdescr[_IFDESCRSIZE];
> +#else
> 	char ifdescr[IFDESCRSIZE];
> -	int s;
> #endif
> +	int s;
>
> -#ifdef SIOCGIFDESCR
> 	/*
> 	 * Get the description for the interface.
> 	 */
> 	memset(&ifrdesc, 0, sizeof ifrdesc);
> 	strlcpy(ifrdesc.ifr_name, name, sizeof ifrdesc.ifr_name);
> +#ifdef __FreeBSD__
> +	ifrdesc.ifr_buffer.buffer = ifdescr;
> +	ifrdesc.ifr_buffer.length = _IFDESCRSIZE;
> +#else
> 	ifrdesc.ifr_data = (caddr_t)&ifdescr;

sizeof(ifdescr) would be more robust in the presence of future code changes.

> @@ -258,6 +258,12 @@ Disable permanently promiscuous mode.
> Another name for the
> .Fl alias
> parameter.
> +.It Cm description Ar value
> +Specify a description of the interface.
> +This can be used to label interfaces in situations where they may
> +otherwise be difficult to distinguish.
> +.It Cm -description
> +Clear the interface description.

Possibly a comment on length limits would be appropriate?

> Modified: head/sbin/ifconfig/ifconfig.c
> ==============================================================================
> --- head/sbin/ifconfig/ifconfig.c	Wed Nov 11 21:18:27 2009	(r199200)
> +++ head/sbin/ifconfig/ifconfig.c	Wed Nov 11 21:30:58 2009	(r199201)
> @@ -83,6 +83,8 @@ static const char rcsid[] =
> struct	ifreq ifr;
>
> char	name[IFNAMSIZ];
> +char	*descr = NULL;
> +size_t	descrlen = 64;
> int	setaddr;
> int	setmask;
> int	doalias;
> @@ -822,6 +824,36 @@ setifname(const char *val, int dummy __u
> 	free(newname);
> }
>
> +/* ARGSUSED */
> +static void
> +setifdescr(const char *val, int dummy __unused, int s,
> +    const struct afswtch *afp)
> +{
> +	char *newdescr;
> +
> +	newdescr = strdup(val);
> +	if (newdescr == NULL) {
> +		warn("no memory to set ifdescr");
> +		return;
> +	}
> +	ifr.ifr_buffer.buffer = newdescr;
> +	ifr.ifr_buffer.length = strlen(newdescr);
> +	if (ioctl(s, SIOCSIFDESCR, (caddr_t)&ifr) < 0) {
> +		warn("ioctl (set descr)");
> +		free(newdescr);
> +		return;

I'm confused about the semantics here: is ifr_buffer.buffer guaranteed to be 
nul-terminated or not?  In some cases the code seems to imply nul-termination 
(especially on the string coming back to userspace), but in other places (such 
as here), the nul termination is not included in the buffer.  It would be nice 
to consistently do one or the other, and given the way the code is written, I 
suggest always having the nul termination.

> @@ -866,6 +898,23 @@ status(const struct afswtch *afp, const
> 		printf(" mtu %d", ifr.ifr_mtu);
> 	putchar('\n');
>
> +	descr = reallocf(descr, descrlen);
> +	if (descr != NULL) {
> +		do {
> +			ifr.ifr_buffer.buffer = descr;
> +			ifr.ifr_buffer.length = descrlen;
> +			if (ioctl(s, SIOCGIFDESCR, &ifr) == 0) {
> +			    if (strlen(descr) > 0)
> +				printf("\tdescription: %s\n", descr);

Here, we seem to assume that the buffer is nul-terminated.

> +			    break;
> +			}
> +			if (errno == ENAMETOOLONG) {
> +				descrlen *= 2;
> +				descr = reallocf(descr, descrlen);
> +			}
> +		} while (errno == ENAMETOOLONG);
> +	}

Shouldn't we be erroring out if reallocf() fails?  That seems to be normal 
practice elsewhere in ifconfig.

> Modified: head/sys/net/if.c
> ==============================================================================
> --- head/sys/net/if.c	Wed Nov 11 21:18:27 2009	(r199200)
> +++ head/sys/net/if.c	Wed Nov 11 21:30:58 2009	(r199201)
> @@ -463,6 +463,8 @@ if_free_internal(struct ifnet *ifp)
> #ifdef MAC
> 	mac_ifnet_destroy(ifp);
> #endif /* MAC */
> +	if (ifp->if_description != NULL)
> +		sbuf_delete(ifp->if_description);
> 	IF_AFDATA_DESTROY(ifp);
> 	IF_ADDR_LOCK_DESTROY(ifp);
> 	ifq_delete(&ifp->if_snd);
> @@ -2090,6 +2092,45 @@ ifhwioctl(u_long cmd, struct ifnet *ifp,
> 		ifr->ifr_phys = ifp->if_physical;
> 		break;
>
> +	case SIOCGIFDESCR:
> +		IF_AFDATA_RLOCK(ifp);
> +		if (ifp->if_description == NULL)
> +			error = ENOMSG;
> +		else
> +			error = copystr(sbuf_data(ifp->if_description),
> +					ifr->ifr_buffer.buffer,
> +					ifr->ifr_buffer.length, NULL);
> +		IF_AFDATA_RUNLOCK(ifp);

Isn't copystr() for use only on kernel addresses, and isn't ifr_buffer a user 
address?  And if this is a user address, you can't access it while the 
IF_AFDATA lock is held.

> +	case SIOCSIFDESCR:
> +		error = priv_check(td, PRIV_NET_SETIFDESCR);
> +		if (error)
> +			return (error);
> +
> +		IF_AFDATA_WLOCK(ifp);

This is not really what this lock is for, perhaps it's time to introduce an 
actual per-if lock.

> +		if (ifp->if_description == NULL) {
> +			ifp->if_description = sbuf_new_auto();

Can't do potentially sleeping memory allocations with the afdata lock held.

> +			if (ifp->if_description == NULL) {
> +				error = ENOMEM;
> +				IF_AFDATA_WUNLOCK(ifp);
> +				break;
> +			}
> +		} else
> +			sbuf_clear(ifp->if_description);
> +
> +		if (sbuf_copyin(ifp->if_description, ifr->ifr_buffer.buffer,
> +				ifr->ifr_buffer.length) == -1)

Access to user addresses while holding the afdata lock isn't allowed.

Here, ifr_buffer.buffer is treated as non-nul-terminated.

Some administrative limit on string length here would be appropriate; perhaps 
128 bytes or 1024 bytes -- panicking because someone passes in a 1GB string by 
mistake in some C code is not what we want to do.

> Modified: head/sys/net/if.h
> ==============================================================================
> --- head/sys/net/if.h	Wed Nov 11 21:18:27 2009	(r199200)
> +++ head/sys/net/if.h	Wed Nov 11 21:30:58 2009	(r199201)
> @@ -294,6 +294,7 @@ struct	ifreq {
> 		struct	sockaddr ifru_addr;
> 		struct	sockaddr ifru_dstaddr;
> 		struct	sockaddr ifru_broadaddr;
> +		struct { size_t length; caddr_t	buffer; } ifru_buffer;

While ifreq already contains a pointer, this adds two more fields that vary in 
size across 32/64-bit, making it more difficult to support in 32-bit processes 
on a 64-bit kernel.

> Modified: head/sys/net/if_var.h
> ==============================================================================
> --- head/sys/net/if_var.h	Wed Nov 11 21:18:27 2009	(r199200)
> +++ head/sys/net/if_var.h	Wed Nov 11 21:30:58 2009	(r199201)
> @@ -198,6 +198,7 @@ struct ifnet {
> 	void	*if_pf_kif;
> 	void	*if_lagg;		/* lagg glue */
> 	u_char	 if_alloctype;		/* if_type at time of allocation */
> +	struct sbuf *if_description;	/* interface description */
>
> 	/*
> 	 * Spare fields are added so that we can modify sensitive data
> @@ -205,7 +206,7 @@ struct ifnet {
> 	 * be used with care where binary compatibility is required.
> 	 */
> 	char	 if_cspare[3];
> -	void	*if_pspare[8];
> +	void	*if_pspare[7];
> 	int	if_ispare[4];
> };

Could you confirm that ifnet hasn't changed size on arm, i386, and amd64? 
This looks like fairly dubious use of a spare field -- normally I'd expect to 
see if_cspare, which is 3 bytes long, remain after if_alloctype, and that 
pspare[0] be replaced in-place to prevent alignment decisions in the compiler 
from spacing out the structure further (i.e., adding another byte of padding 
on i386 and another 5 bytes of padding on amd64 after if_cspare and before 
if_pspare).

Robert N M Watson
Computer Laboratory
University of Cambridge
From brde at optusnet.com.au  Thu Nov 12 14:14:05 2009
From: brde at optusnet.com.au (Bruce Evans)
Date: Thu Nov 12 14:14:17 2009
Subject: svn commit: r198848 - head/bin/ps
In-Reply-To: <20091112050515.GA15002@server.vk2pj.dyndns.org>
References: <200911030928.nA39SjLx085597@svn.freebsd.org>
	<20091103214231.H23957@delplex.bde.org> <4AF4B6B2.3090706@delphij.net>
	<20091111230915.B3510@besplex.bde.org>
	<20091112050515.GA15002@server.vk2pj.dyndns.org>
Message-ID: <20091113010924.M1122@besplex.bde.org>

On Thu, 12 Nov 2009, Peter Jeremy wrote:

> On 2009-Nov-11 23:22:36 +1100, Bruce Evans  wrote:
>> On Fri, 6 Nov 2009, Xin LI wrote:
>>> Will it sound reasonable to divide pcpu by ncpu and cap the number at 100?
>>
>> I don't like that.  It would break scripts even more than units changes.
>> It is hard for users to interpret too.  Suddenly, processes taking
>> 100% of 1 CPU would take 12.5% of 8 CPUs on a system with 8 CPUs, and
>> different %CPU on systems with a different number of CPUs.
>
> Solaris does this.  I found it particularly annoying for identifying
> spinning, single-threaded processes - it's not as immediately obvious
> that 1.6% CPU means a spinning process on a T5000, and the granularity
> gets worse.

We might eventually need an option for bug for bug compatibility with
Solaris(Olaris?)/POSIX.  A %cpu format could give the divided %CPU for
anyone that wants it sooner.

>> Just print %CPU in %4.0f format when it is >= 99.5 (or whatever rounds
>> to 100.0).  This works up to 999.5 %CPU.
>
> Actually, %4.0f works up to 9999.5 %CPU because there's no '.' in the
> result.  I think this is an excellent solution.  And since FreeBSD
> currently has a hard limit of 64 CPUs, it's unlikely to be exceeded
> for a while.

Oops.

Bruce
From rwatson at FreeBSD.org  Thu Nov 12 14:18:28 2009
From: rwatson at FreeBSD.org (Robert Watson)
Date: Thu Nov 12 14:18:39 2009
Subject: svn commit: r198848 - head/bin/ps
In-Reply-To: <20091113010924.M1122@besplex.bde.org>
References: <200911030928.nA39SjLx085597@svn.freebsd.org>
	<20091103214231.H23957@delplex.bde.org>
	<4AF4B6B2.3090706@delphij.net>
	<20091111230915.B3510@besplex.bde.org>
	<20091112050515.GA15002@server.vk2pj.dyndns.org>
	<20091113010924.M1122@besplex.bde.org>
Message-ID: 


On Fri, 13 Nov 2009, Bruce Evans wrote:

>>> Just print %CPU in %4.0f format when it is >= 99.5 (or whatever rounds to 
>>> 100.0).  This works up to 999.5 %CPU.
>> 
>> Actually, %4.0f works up to 9999.5 %CPU because there's no '.' in the 
>> result.  I think this is an excellent solution.  And since FreeBSD 
>> currently has a hard limit of 64 CPUs, it's unlikely to be exceeded for a 
>> while.
>
> Oops.

With 128-thread hardware just around the corner, we should be working to scrub 
assumption of 32 or 64 core limits wherever we find them.  I don't know what 
the next "reasonable" limit is, perhaps 1024, but arrays indexed by MAXCPU are 
becoming decreasingly useful in that light.  The dynamic per-CPU stuff for the 
kernel addresses some but not all of these problems.

Robert N M Watson
Computer Laboratory
University of Cambridge
From attilio at FreeBSD.org  Thu Nov 12 14:22:13 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Thu Nov 12 14:22:19 2009
Subject: svn commit: r199223 - head/sys/contrib/rdma/krping
Message-ID: <200911121422.nACEMCAA032694@svn.freebsd.org>

Author: attilio
Date: Thu Nov 12 14:22:12 2009
New Revision: 199223
URL: http://svn.freebsd.org/changeset/base/199223

Log:
  Remove the explicit definition of inet_aton() as it was introduced as a
  general function in r199208.
  
  Reported by:	np
  Sponsored by:	Sandvine Incorporated
  MFC:		1 week

Modified:
  head/sys/contrib/rdma/krping/krping.c

Modified: head/sys/contrib/rdma/krping/krping.c
==============================================================================
--- head/sys/contrib/rdma/krping/krping.c	Thu Nov 12 13:09:36 2009	(r199222)
+++ head/sys/contrib/rdma/krping/krping.c	Thu Nov 12 14:22:12 2009	(r199223)
@@ -112,109 +112,6 @@ struct krping_cb_list krping_cbs;
 #define RPING_BUFSIZE 128*1024
 #define RPING_SQ_DEPTH 32
 
-
-/* lifted from netinet/libalias/alias_proxy.c */
-static int inet_aton(const char *cp, struct in_addr *addr);
-static int
-inet_aton(cp, addr)
-        const char *cp;
-        struct in_addr *addr;
-{
-	u_long parts[4];
-	in_addr_t val;
-	const char *c;
-	char *endptr;
-	int gotend, n;
-
-	c = (const char *)cp;
-	n = 0;
-	/*
-	 * Run through the string, grabbing numbers until
-	 * the end of the string, or some error
-	 */
-	gotend = 0;
-	while (!gotend) {
-		unsigned long l;
-
-		l = strtoul(c, &endptr, 0);
-
-		if (l == ULONG_MAX || (l == 0 && endptr == c))
-			return (0);
-
-		val = (in_addr_t)l;
-		/*
-		 * If the whole string is invalid, endptr will equal
-		 * c.. this way we can make sure someone hasn't
-		 * gone '.12' or something which would get past
-		 * the next check.
-		 */
-		if (endptr == c)
-			return (0);
-		parts[n] = val;
-		c = endptr;
-
-		/* Check the next character past the previous number's end */
-		switch (*c) {
-		case '.' :
-			/* Make sure we only do 3 dots .. */
-			if (n == 3)	/* Whoops. Quit. */
-				return (0);
-			n++;
-			c++;
-			break;
-
-		case '\0':
-			gotend = 1;
-			break;
-
-		default:
-			if (isspace((unsigned char)*c)) {
-				gotend = 1;
-				break;
-			} else
-				return (0);	/* Invalid character, so fail */
-		}
-
-	}
-
-	/*
-	 * Concoct the address according to
-	 * the number of parts specified.
-	 */
-
-	switch (n) {
-	case 0:				/* a -- 32 bits */
-		/*
-		 * Nothing is necessary here.  Overflow checking was
-		 * already done in strtoul().
-		 */
-		break;
-	case 1:				/* a.b -- 8.24 bits */
-		if (val > 0xffffff || parts[0] > 0xff)
-			return (0);
-		val |= parts[0] << 24;
-		break;
-
-	case 2:				/* a.b.c -- 8.8.16 bits */
-		if (val > 0xffff || parts[0] > 0xff || parts[1] > 0xff)
-			return (0);
-		val |= (parts[0] << 24) | (parts[1] << 16);
-		break;
-
-	case 3:				/* a.b.c.d -- 8.8.8.8 bits */
-		if (val > 0xff || parts[0] > 0xff || parts[1] > 0xff ||
-		    parts[2] > 0xff)
-			return (0);
-		val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
-		break;
-	}
-
-	if (addr != NULL)
-		addr->s_addr = htonl(val);
-	return (1);
-}
-
-
 static void krping_wait(struct krping_cb *cb, int state)
 {
 	int rc;
From attilio at freebsd.org  Thu Nov 12 14:22:46 2009
From: attilio at freebsd.org (Attilio Rao)
Date: Thu Nov 12 14:22:58 2009
Subject: svn commit: r199208 - in head/sys: conf libkern netinet 
	netinet/libalias
In-Reply-To: 
References: <200911120046.nAC0kS2V012731@svn.freebsd.org>
	
Message-ID: <3bbf2fe10911120622s7ce9bd0fpa67e3c53a005f148@mail.gmail.com>

2009/11/12 Navdeep Parhar :
> This seems to break kernel builds.  Throwing away the private
> inet_aton implementation inside krping.c will probably fix it.
>
> /usr/src/sys/modules/rdma/krping/../../../contrib/rdma/krping/krping.c:117:
> error: static declaration of 'inet_aton' follows non-static
> declaration
> @/netinet/in.h:716: error: previous declaration of 'inet_aton' was here
> *** Error code 1

This should be fixed in r199223.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
From des at des.no  Thu Nov 12 14:31:19 2009
From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=)
Date: Thu Nov 12 14:31:30 2009
Subject: svn commit: r199201 - in head: contrib/libpcap sbin/ifconfig
	share/man/man4 sys/kern sys/net sys/sys
In-Reply-To: <20091112135211.GT64905@hoeg.nl> (Ed Schouten's message of "Thu, 
	12 Nov 2009 14:52:11 +0100")
References: <200911112130.nABLUw9b007768@svn.freebsd.org>
	<20091112135211.GT64905@hoeg.nl>
Message-ID: <86hbsz24sq.fsf@ds4.des.no>

Ed Schouten  writes:
> Xin LI  writes:
> > @@ -198,6 +198,7 @@ struct ifnet {
> >  	void	*if_pf_kif;
> >  	void	*if_lagg;		/* lagg glue */
> >  	u_char	 if_alloctype;		/* if_type at time of allocation */
> > +	struct sbuf *if_description;	/* interface description */
> >  
> >  	/*
> >  	 * Spare fields are added so that we can modify sensitive data
> > @@ -205,7 +206,7 @@ struct ifnet {
> >  	 * be used with care where binary compatibility is required.
> >  	 */
> >  	char	 if_cspare[3];
> > -	void	*if_pspare[8];
> > +	void	*if_pspare[7];
> >  	int	if_ispare[4];
> So there used to be four chars in a row here (between if_description and
> if_cspare). Are you sure moving the pointer in between doesn't increase
> the structure size?

I can guarantee you that it does.  On i386, for instance, there are now
three bytes of implicit padding between if_alloctype and if_description,
and one more between if_cspare and if_pspare, so struct ifnet has grown
by four bytes.

We should have CASSERTs for sizeof(struct ifnet) and other structs we
really care about.

DES
-- 
Dag-Erling Sm?rgrav - des@des.no
From ume at FreeBSD.org  Thu Nov 12 14:48:37 2009
From: ume at FreeBSD.org (Hajimu UMEMOTO)
Date: Thu Nov 12 14:48:43 2009
Subject: svn commit: r199225 - head/sys/netinet6
Message-ID: <200911121448.nACEma08033442@svn.freebsd.org>

Author: ume
Date: Thu Nov 12 14:48:36 2009
New Revision: 199225
URL: http://svn.freebsd.org/changeset/base/199225

Log:
  - We are not guaranteed that we're not dropping a reference that
    we did not add.  Call LLE_REMREF() only when callout_stop()
    actually canceled a pending callout.
  - callout_reset() may cancel a pending callout.  When
    callout_reset() canceled a pending callout, call LLE_REMREF()
    to drop a reference for the canceled callout.
  
  MFC after:	1 week

Modified:
  head/sys/netinet6/nd6.c

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c	Thu Nov 12 14:27:09 2009	(r199224)
+++ head/sys/netinet6/nd6.c	Thu Nov 12 14:48:36 2009	(r199225)
@@ -439,31 +439,27 @@ skip1:
 void
 nd6_llinfo_settimer_locked(struct llentry *ln, long tick)
 {
+	int canceled;
+
 	if (tick < 0) {
 		ln->la_expire = 0;
 		ln->ln_ntick = 0;
-		callout_stop(&ln->ln_timer_ch);
-		/*
-		 * XXX - do we know that there is
-		 * callout installed? i.e. are we 
-		 * guaranteed that we're not dropping
-		 * a reference that we did not add?
-		 * KMM 
-		 */
-		LLE_REMREF(ln);
+		canceled = callout_stop(&ln->ln_timer_ch);
 	} else {
 		ln->la_expire = time_second + tick / hz;
 		LLE_ADDREF(ln);
 		if (tick > INT_MAX) {
 			ln->ln_ntick = tick - INT_MAX;
-			callout_reset(&ln->ln_timer_ch, INT_MAX,
+			canceled = callout_reset(&ln->ln_timer_ch, INT_MAX,
 			    nd6_llinfo_timer, ln);
 		} else {
 			ln->ln_ntick = 0;
-			callout_reset(&ln->ln_timer_ch, tick,
+			canceled = callout_reset(&ln->ln_timer_ch, tick,
 			    nd6_llinfo_timer, ln);
 		}
 	}
+	if (canceled)
+		LLE_REMREF(ln);
 }
 
 void
@@ -1048,6 +1044,9 @@ nd6_free(struct llentry *ln, int gc)
 			else
 				nd6_llinfo_settimer(ln, (long)V_nd6_gctimer * hz);
 			splx(s);
+			LLE_WLOCK(ln);
+			LLE_REMREF(ln);
+			LLE_WUNLOCK(ln);
 			return (LIST_NEXT(ln, lle_next));
 		}
 
From des at des.no  Thu Nov 12 14:53:58 2009
From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=)
Date: Thu Nov 12 14:54:09 2009
Subject: svn commit: r198848 - head/bin/ps
In-Reply-To: <20091112050515.GA15002@server.vk2pj.dyndns.org> (Peter Jeremy's
	message of "Thu, 12 Nov 2009 16:05:15 +1100")
References: <200911030928.nA39SjLx085597@svn.freebsd.org>
	<20091103214231.H23957@delplex.bde.org> <4AF4B6B2.3090706@delphij.net>
	<20091111230915.B3510@besplex.bde.org>
	<20091112050515.GA15002@server.vk2pj.dyndns.org>
Message-ID: <86d43n23r0.fsf@ds4.des.no>

Peter Jeremy  writes:
> Actually, %4.0f works up to 9999.5 %CPU because there's no '.' in the
> result.  I think this is an excellent solution.  And since FreeBSD
> currently has a hard limit of 64 CPUs, it's unlikely to be exceeded
> for a while.

...if by "a while" you mean "a year or two", because I can't imagine
that restriction surviving much longer than that.  You can already get
off-the-shelf hardware with 64 threads per die.  If screen real-estate
is a concern, we can switch the scale from 100 to 1, so 1.0 is full tilt
on one thread, etc., and use "%.5g", which should work for up to 99999
threads (9999900%)

DES
-- 
Dag-Erling Sm?rgrav - des@des.no
From kostikbel at gmail.com  Thu Nov 12 14:55:13 2009
From: kostikbel at gmail.com (Kostik Belousov)
Date: Thu Nov 12 14:55:26 2009
Subject: svn commit: r199067 - in head/sys: amd64/amd64 i386/i386
In-Reply-To: <20091111223340.GF2331@deviant.kiev.zoral.com.ua>
References: <7meio5g4yx.wl%kuriyama@s2factory.co.jp>
	<20091111215651.GM64905@hoeg.nl>
	<20091111223340.GF2331@deviant.kiev.zoral.com.ua>
Message-ID: <20091112145506.GH2331@deviant.kiev.zoral.com.ua>

On Thu, Nov 12, 2009 at 12:33:40AM +0200, Kostik Belousov wrote:
> On Wed, Nov 11, 2009 at 10:56:51PM +0100, Ed Schouten wrote:
> > Hi,
> > 
> > * Jun Kuriyama  wrote:
> > > Can you test with these patches?  Testing on only one of both system
> > > is enough.  "patch-1" forces disabling CLFLUSH feature even if SS bit
> > > exists.  "patch-2" forces no CLFLUSH tweak.  I'd like to know with
> > > which patch your system can live.
> > 
> > For some reason they both seem to boot. Yikes. I've done some more
> > testing and it seems the old version even hangs if I add some additional
> > printf's above and below, which makes me believe the problem is a bit
> > more complex than we realize...
> 
> The only thing I see now is that TUNABLE_INT declaration is not needed,
> since SYSINIT is started after hammer_time(), so TUNABLE_FETCH is
> processed after everything is done for BSP.
> 
> Wait, are your machines SMP ? Hmm, could you, please, remove TUNABLE_INT()
> and see how it ends up ?

[Selecting random email in the thread].

Luckily, my co-worker has laptop that runs HEAD and exhibited the
problem. Patch below fixed the hang for him. Will be happy to get
confirmation that patch fixes the hung for other people who reported it.

http://people.freebsd.org/~kib/misc/initcache.1.patch

Issue is that TUNABLE_INT_FETCH was called on AP while CPU was not
initialized properly, in particular, curthread was not set etc. But,
kernel environment is already switched to dynamic, so access needs to
lock a mutex.

I am currently looking at i386, that probably needs similar change.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091112/208f6dab/attachment.pgp
From nwhitehorn at FreeBSD.org  Thu Nov 12 15:19:09 2009
From: nwhitehorn at FreeBSD.org (Nathan Whitehorn)
Date: Thu Nov 12 15:19:21 2009
Subject: svn commit: r199226 - head/sys/powerpc/aim
Message-ID: <200911121519.nACFJ9K0034388@svn.freebsd.org>

Author: nwhitehorn
Date: Thu Nov 12 15:19:09 2009
New Revision: 199226
URL: http://svn.freebsd.org/changeset/base/199226

Log:
  Provide a real fix to the too-many-translations problem when booting
  from CD on 64-bit hardware to replace existing band-aids. This occurred
  when the preloaded mdroot required too many mappings for the static
  buffer.
  
  Since we only use the translations buffer once, allocate a dynamic
  buffer on the stack. This early in the boot process, the call chain
  is quite short and we can be assured of having sufficient stack space.
  
  Reviewed by:	grehan

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Thu Nov 12 14:48:36 2009	(r199225)
+++ head/sys/powerpc/aim/mmu_oea64.c	Thu Nov 12 15:19:09 2009	(r199226)
@@ -264,7 +264,6 @@ static struct	mem_region *pregions;
 extern u_int	phys_avail_count;
 extern int	regions_sz, pregions_sz;
 extern int	ofw_real_mode;
-static struct	ofw_map translations[96];
 
 extern struct pmap ofw_pmap;
 
@@ -709,17 +708,73 @@ moea64_bridge_cpu_bootstrap(mmu_t mmup, 
 }
 
 static void
+moea64_add_ofw_mappings(mmu_t mmup, phandle_t mmu, size_t sz)
+{
+	struct ofw_map	translations[sz/sizeof(struct ofw_map)];
+	register_t	msr;
+	vm_offset_t	off;
+	int		i, ofw_mappings;
+
+	bzero(translations, sz);
+	if (OF_getprop(mmu, "translations", translations, sz) == -1)
+		panic("moea64_bootstrap: can't get ofw translations");
+
+	CTR0(KTR_PMAP, "moea64_add_ofw_mappings: translations");
+	sz /= sizeof(*translations);
+	qsort(translations, sz, sizeof (*translations), om_cmp);
+
+	for (i = 0, ofw_mappings = 0; i < sz; i++) {
+		CTR3(KTR_PMAP, "translation: pa=%#x va=%#x len=%#x",
+		    (uint32_t)(translations[i].om_pa_lo), translations[i].om_va,
+		    translations[i].om_len);
+
+		if (translations[i].om_pa_lo % PAGE_SIZE)
+			panic("OFW translation not page-aligned!");
+
+		if (translations[i].om_pa_hi)
+			panic("OFW translations above 32-bit boundary!");
+
+		/* Now enter the pages for this mapping */
+
+		/*
+		 * Lock the ofw pmap. pmap_kenter(), which we use for the
+		 * pages the kernel also needs, does its own locking.
+		 */
+		PMAP_LOCK(&ofw_pmap); 
+		DISABLE_TRANS(msr);
+		for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) {
+			struct vm_page m;
+
+			/* Map low memory mappings into the kernel pmap, too.
+			 * These are typically mappings made by the loader,
+			 * so we need them if we want to keep executing. */
+
+			if (translations[i].om_va + off < SEGMENT_LENGTH)
+				moea64_kenter(mmup, translations[i].om_va + off,
+				    translations[i].om_va + off);
+
+			m.phys_addr = translations[i].om_pa_lo + off;
+			moea64_enter_locked(&ofw_pmap,
+			    translations[i].om_va + off, &m, VM_PROT_ALL, 1);
+
+			ofw_mappings++;
+		}
+		ENABLE_TRANS(msr);
+		PMAP_UNLOCK(&ofw_pmap);
+	}
+}
+
+static void
 moea64_bridge_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend)
 {
 	ihandle_t	mmui;
 	phandle_t	chosen;
 	phandle_t	mmu;
-	int		sz;
+	size_t		sz;
 	int		i, j;
-	int		ofw_mappings;
 	vm_size_t	size, physsz, hwphyssz;
 	vm_offset_t	pa, va, off;
-	uint32_t	msr;
+	register_t	msr;
 	void		*dpcpu;
 
 	/* We don't have a direct map since there is no BAT */
@@ -865,7 +920,6 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o
 	off = (vm_offset_t)(moea64_bpvo_pool);
 	for (pa = off; pa < off + size; pa += PAGE_SIZE) 
 		moea64_kenter(mmup, pa, pa);
-	ENABLE_TRANS(msr);
 
 	/*
 	 * Map certain important things, like ourselves.
@@ -876,7 +930,6 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o
 	 * address.
 	 */
 
-	DISABLE_TRANS(msr);
 	for (pa = kernelstart & ~PAGE_MASK; pa < kernelend; pa += PAGE_SIZE) 
 		moea64_kenter(mmup, pa, pa);
 	ENABLE_TRANS(msr);
@@ -897,57 +950,10 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o
 		panic("moea64_bootstrap: can't get mmu package");
 	    if ((sz = OF_getproplen(mmu, "translations")) == -1)
 		panic("moea64_bootstrap: can't get ofw translation count");
-	    if (sz > sizeof(translations))
-		panic("moea64_bootstrap: too many ofw translations (%d)",
-		      sz/sizeof(*translations));
-
-	    bzero(translations, sz);
-	    if (OF_getprop(mmu, "translations", translations, sz) == -1)
-		panic("moea64_bootstrap: can't get ofw translations");
-
-	    CTR0(KTR_PMAP, "moea64_bootstrap: translations");
-	    sz /= sizeof(*translations);
-	    qsort(translations, sz, sizeof (*translations), om_cmp);
-
-	    for (i = 0, ofw_mappings = 0; i < sz; i++) {
-		CTR3(KTR_PMAP, "translation: pa=%#x va=%#x len=%#x",
-		    (uint32_t)(translations[i].om_pa_lo), translations[i].om_va,
-		    translations[i].om_len);
-
-		if (translations[i].om_pa_lo % PAGE_SIZE)
-			panic("OFW translation not page-aligned!");
-
-		if (translations[i].om_pa_hi)
-			panic("OFW translations above 32-bit boundary!");
-
-		/* Now enter the pages for this mapping */
-
-		/*
-		 * Lock the ofw pmap. pmap_kenter(), which we use for the
-		 * pages the kernel also needs, does its own locking.
-		 */
-		PMAP_LOCK(&ofw_pmap); 
-		DISABLE_TRANS(msr);
-		for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) {
-			struct vm_page m;
-
-			/* Map low memory mappings into the kernel pmap, too.
-			 * These are typically mappings made by the loader,
-			 * so we need them if we want to keep executing. */
-
-			if (translations[i].om_va + off < SEGMENT_LENGTH)
-				moea64_kenter(mmup, translations[i].om_va + off,
-				    translations[i].om_va + off);
+	    if (sz > 6144 /* tmpstksz - 2 KB headroom */)
+		panic("moea64_bootstrap: too many ofw translations");
 
-			m.phys_addr = translations[i].om_pa_lo + off;
-			moea64_enter_locked(&ofw_pmap,
-			    translations[i].om_va + off, &m, VM_PROT_ALL, 1);
-
-			ofw_mappings++;
-		}
-		ENABLE_TRANS(msr);
-		PMAP_UNLOCK(&ofw_pmap);
-	    }
+	    moea64_add_ofw_mappings(mmup, mmu, sz);
 	}
 
 #ifdef SMP
From jhb at freebsd.org  Thu Nov 12 15:19:28 2009
From: jhb at freebsd.org (John Baldwin)
Date: Thu Nov 12 15:19:41 2009
Subject: svn commit: r199201 - in head: contrib/libpcap sbin/ifconfig
	share/man/man4 sys/kern sys/net sys/sys
In-Reply-To: <200911112130.nABLUw9b007768@svn.freebsd.org>
References: <200911112130.nABLUw9b007768@svn.freebsd.org>
Message-ID: <200911121014.12391.jhb@freebsd.org>

On Wednesday 11 November 2009 4:30:58 pm Xin LI wrote:
> Author: delphij
> Date: Wed Nov 11 21:30:58 2009
> New Revision: 199201
> URL: http://svn.freebsd.org/changeset/base/199201
> 
> Log:
>   Add interface description capability as inspired by OpenBSD.
>   
>   MFC after:	3 months
> 
> Modified: head/sys/net/if.c
> ==============================================================================
> --- head/sys/net/if.c	Wed Nov 11 21:18:27 2009	(r199200)
> +++ head/sys/net/if.c	Wed Nov 11 21:30:58 2009	(r199201)
> @@ -2090,6 +2092,45 @@ ifhwioctl(u_long cmd, struct ifnet *ifp,
>  		ifr->ifr_phys = ifp->if_physical;
>  		break;
>  
> +	case SIOCSIFDESCR:
> +		error = priv_check(td, PRIV_NET_SETIFDESCR);
> +		if (error)
> +			return (error);
> +
> +		IF_AFDATA_WLOCK(ifp);
> +		if (ifp->if_description == NULL) {
> +			ifp->if_description = sbuf_new_auto();
> +			if (ifp->if_description == NULL) {
> +				error = ENOMEM;
> +				IF_AFDATA_WUNLOCK(ifp);
> +				break;
> +			}
> +		} else
> +			sbuf_clear(ifp->if_description);
> +
> +		if (sbuf_copyin(ifp->if_description, ifr->ifr_buffer.buffer,
> +				ifr->ifr_buffer.length) == -1)
> +			error = EFAULT;
> +
> +		if (error == 0) {
> +			sbuf_finish(ifp->if_description);
> +			getmicrotime(&ifp->if_lastchange);
> +		}
> +		IF_AFDATA_WUNLOCK(ifp);

Since IF_AFDATA isn't a sleepable lock (e.g. an sx lock), it is not safe
to do a copyin() while holding this lock.  A better approach would probably
be something like:

	struct sbuf *new, *old;

	case SIOCSIFDESCR:
		/* priv check */

		new = sbuf_new_auto();
		if (new == NULL)
			return (ENOMEM);
		if (sbuf_copyin(new, ifr->ifr_buffer.buffer,
		    ifr->ifr_buffer.length) == -1) {
			sbuf_delete(new);
			return (EFAULT);
		}

		IF_AFDATA_WLOCK(ifp);
		old = ifp->if_description;
		ifp->if_description = new;
		getmicrotime(&ifp->if_lastchange);
		IF_AFDATA_WUNLOCK(ifp);
		if (old != NULL)
			sbuf_delete(old);
		break;

-- 
John Baldwin
From rwatson at FreeBSD.org  Thu Nov 12 15:21:41 2009
From: rwatson at FreeBSD.org (Robert Watson)
Date: Thu Nov 12 15:21:52 2009
Subject: svn commit: r199201 - in head: contrib/libpcap sbin/ifconfig
 share/man/man4 sys/kern sys/net sys/sys
In-Reply-To: <86hbsz24sq.fsf@ds4.des.no>
References: <200911112130.nABLUw9b007768@svn.freebsd.org>
	<20091112135211.GT64905@hoeg.nl> <86hbsz24sq.fsf@ds4.des.no>
Message-ID: 


On Thu, 12 Nov 2009, Dag-Erling Sm?rgrav wrote:

>> So there used to be four chars in a row here (between if_description and 
>> if_cspare). Are you sure moving the pointer in between doesn't increase the 
>> structure size?
>
> I can guarantee you that it does.  On i386, for instance, there are now 
> three bytes of implicit padding between if_alloctype and if_description, and 
> one more between if_cspare and if_pspare, so struct ifnet has grown by four 
> bytes.
>
> We should have CASSERTs for sizeof(struct ifnet) and other structs we really 
> care about.

We care less about ifnet than we used to, because ifnet is now allocated by 
the kernel rather than drivers.  However, if we want to take our KPI/KBI more 
seriously, then CTASSERTs on other "public" kernel structures might well be a 
good idea.  On the other hand, CTASSERT errors on build are almost impervious 
to mortal comprehension (if you haven't seen them before, they make little 
sense to the reader), and will make it more difficult for people hacking on 
our kernel to do so casually.  Some sort of other static checker might make 
more sense, and perhaps allow us to do more intelligent checking that just 
"total size" -- we'd also like to detect rearrangement of sensitive structs 
that would be size-preserving.

Robert
From attilio at FreeBSD.org  Thu Nov 12 15:59:05 2009
From: attilio at FreeBSD.org (Attilio Rao)
Date: Thu Nov 12 15:59:12 2009
Subject: svn commit: r199227 - head/sys/kern
Message-ID: <200911121559.nACFx5v0035248@svn.freebsd.org>

Author: attilio
Date: Thu Nov 12 15:59:05 2009
New Revision: 199227
URL: http://svn.freebsd.org/changeset/base/199227

Log:
  Add the possibility for vfs.root.mountfrom tunable to accept a list of
  items rather than a single one. The list is a space separated collection
  of items defined as the current one accepted.
  
  While there fix also a nit in a comment.
  
  Obtained from:	Sandvine Incorporated
  Reviewed by:	emaste
  Tested by:	Giovanni Trematerra
  		
  Sponsored by:	Sandvine Incorporated
  MFC:		2 weeks

Modified:
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c	Thu Nov 12 15:19:09 2009	(r199226)
+++ head/sys/kern/vfs_mount.c	Thu Nov 12 15:59:05 2009	(r199227)
@@ -104,13 +104,17 @@ struct vnode	*rootvnode;
  * The root filesystem is detailed in the kernel environment variable
  * vfs.root.mountfrom, which is expected to be in the general format
  *
- * :[]
+ * :[][	:[] ...]
  * vfsname   := the name of a VFS known to the kernel and capable
  *              of being mounted as root
  * path      := disk device name or other data used by the filesystem
  *              to locate its physical store
  *
- * The environment variable vfs.root.mountfrom options is a comma delimited
+ * If the environment variable vfs.root.mountfrom is a space separated list,
+ * each list element is tried in turn and the root filesystem will be mounted
+ * from the first one that suceeds.
+ *
+ * The environment variable vfs.root.mountfrom.options is a comma delimited
  * set of string mount options.  These mount options must be parseable
  * by nmount() in the kernel.
  */
@@ -1643,7 +1647,7 @@ vfs_opterror(struct vfsoptlist *opts, co
 void
 vfs_mountroot(void)
 {
-	char *cp, *options;
+	char *cp, *cpt, *options, *tmpdev;
 	int error, i, asked = 0;
 
 	options = NULL;
@@ -1695,10 +1699,15 @@ vfs_mountroot(void)
 	 */
 	cp = getenv("vfs.root.mountfrom");
 	if (cp != NULL) {
-		error = vfs_mountroot_try(cp, options);
+		cpt = cp;
+		while ((tmpdev = strsep(&cpt, " \t")) != NULL) {
+			error = vfs_mountroot_try(tmpdev, options);
+			if (error == 0) {
+				freeenv(cp);
+				goto mounted;
+			}
+		}
 		freeenv(cp);
-		if (!error)
-			goto mounted;
 	}
 
 	/*
From brde at optusnet.com.au  Thu Nov 12 16:03:10 2009
From: brde at optusnet.com.au (Bruce Evans)
Date: Thu Nov 12 16:03:21 2009
Subject: svn commit: r198848 - head/bin/ps
In-Reply-To: <86d43n23r0.fsf@ds4.des.no>
References: <200911030928.nA39SjLx085597@svn.freebsd.org>
	<20091103214231.H23957@delplex.bde.org> <4AF4B6B2.3090706@delphij.net>
	<20091111230915.B3510@besplex.bde.org>
	<20091112050515.GA15002@server.vk2pj.dyndns.org>
	<86d43n23r0.fsf@ds4.des.no>
Message-ID: <20091113022937.P1408@besplex.bde.org>

On Thu, 12 Nov 2009, [utf-8] Dag-Erling Smørgrav wrote:

> Peter Jeremy  writes:
>> Actually, %4.0f works up to 9999.5 %CPU because there's no '.' in the
>> result.  I think this is an excellent solution.  And since FreeBSD
>> currently has a hard limit of 64 CPUs, it's unlikely to be exceeded
>> for a while.
>
> ...if by "a while" you mean "a year or two", because I can't imagine
> that restriction surviving much longer than that.  You can already get
> off-the-shelf hardware with 64 threads per die.

Can you imagine NCPU hitting a power wall or other technical barrier at
not much larger than 64?

> If screen real-estate
> is a concern, we can switch the scale from 100 to 1, so 1.0 is full tilt
> on one thread, etc., and use "%.5g", which should work for up to 99999
> threads (9999900%)

The extra character needed for this is one of the smallest problems
resulting from NCPU being huge.  The problem expands like O(log(NCPU))
and causes a non-fatal formatting error when it occurs.  Other problems
expand like O(NCPU).  A nearby one is the "pigs" display in systat.
This wants to display a on single screen without scrolling, so it will
soon take a 6 metre high display to fit just the idle pigs on a 1024-
CPU system.  These take at most 100% CPU each so they will be sorted
after multi-threaded pigs taking more, but they will be sorted before
most single-threaded pigs, thus displacing the latter from the window
except with > 6 meter high displays.

Bruce
From philip at freebsd.org  Thu Nov 12 16:06:35 2009
From: philip at freebsd.org (Philip Paeps)
Date: Thu Nov 12 16:06:41 2009
Subject: svn commit: r199201 - in head: contrib/libpcap sbin/ifconfig
 share/man/man4 sys/kern sys/net sys/sys
In-Reply-To: <200911112130.nABLUw9b007768@svn.freebsd.org>
References: <200911112130.nABLUw9b007768@svn.freebsd.org>
Message-ID: <20091112160634.GN8230@rincewind.paeps.cx>

On 2009-11-11 21:30:58 (+0000), Xin LI  wrote:
> Log:
>   Add interface description capability as inspired by OpenBSD.

In addition to the comments already made, I'd also like to note that it would
make a lot of sense to announce changes in interface descriptions to the
routing socket.  That way, SNMP or other userspace consumers (a daemon sending
CDP announcements, for instance - though arguably the kernel could send those)
can be notified of changes rather than having to poll for them.

 - Philip

-- 
Philip Paeps                                    Please don't Cc me, I am
philip@freebsd.org                               subscribed to the list.

  BOFH Excuse #363:
    Out of cards on drive D:
From brooks at FreeBSD.org  Thu Nov 12 16:10:10 2009
From: brooks at FreeBSD.org (Brooks Davis)
Date: Thu Nov 12 16:10:19 2009
Subject: svn commit: r199201 - in head: contrib/libpcap sbin/ifconfig
	share/man/man4 sys/kern sys/net sys/sys
In-Reply-To: 
References: <200911112130.nABLUw9b007768@svn.freebsd.org>
	<20091112135211.GT64905@hoeg.nl> <86hbsz24sq.fsf@ds4.des.no>
	
Message-ID: <20091112160849.GB65026@lor.one-eyed-alien.net>

On Thu, Nov 12, 2009 at 03:21:40PM +0000, Robert Watson wrote:
> 
> On Thu, 12 Nov 2009, Dag-Erling Sm??rgrav wrote:
> 
>>> So there used to be four chars in a row here (between if_description and 
>>> if_cspare). Are you sure moving the pointer in between doesn't increase 
>>> the structure size?
>> 
>> I can guarantee you that it does.  On i386, for instance, there are now 
>> three bytes of implicit padding between if_alloctype and if_description, 
>> and one more between if_cspare and if_pspare, so struct ifnet has grown by 
>> four bytes.
>> 
>> We should have CASSERTs for sizeof(struct ifnet) and other structs we 
>> really care about.
> 
> We care less about ifnet than we used to, because ifnet is now allocated by 
> the kernel rather than drivers.  However, if we want to take our KPI/KBI 
> more seriously, then CTASSERTs on other "public" kernel structures might 
> well be a good idea.  On the other hand, CTASSERT errors on build are 
> almost impervious to mortal comprehension (if you haven't seen them before, 
> they make little sense to the reader), and will make it more difficult for 
> people hacking on our kernel to do so casually.  Some sort of other static 
> checker might make more sense, and perhaps allow us to do more intelligent 
> checking that just "total size" -- we'd also like to detect rearrangement 
> of sensitive structs that would be size-preserving.

In this specific case, we should remove all the spare pointers since
they don't really add value.  The only rule should be that when you MFC
you have to add to the end rather than inserting in the strictly logical
location.

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091112/0d314d92/attachment.pgp
From des at des.no  Thu Nov 12 16:10:58 2009
From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=)
Date: Thu Nov 12 16:11:05 2009
Subject: svn commit: r199201 - in head: contrib/libpcap sbin/ifconfig
	share/man/man4 sys/kern sys/net sys/sys
In-Reply-To:  (Robert
	Watson's message of "Thu, 12 Nov 2009 15:21:40 +0000 (GMT)")
References: <200911112130.nABLUw9b007768@svn.freebsd.org>
	<20091112135211.GT64905@hoeg.nl> <86hbsz24sq.fsf@ds4.des.no>
	
Message-ID: <86zl6rzpta.fsf@ds4.des.no>

Robert Watson  writes:
> We care less about ifnet than we used to, because ifnet is now
> allocated by the kernel rather than drivers.  However, if we want to
> take our KPI/KBI more seriously, then CTASSERTs on other "public"
> kernel structures might well be a good idea.  On the other hand,
> CTASSERT errors on build are almost impervious to mortal comprehension
> (if you haven't seen them before, they make little sense to the
> reader), and will make it more difficult for people hacking on our
> kernel to do so casually.  Some sort of other static checker might
> make more sense, and perhaps allow us to do more intelligent checking
> that just "total size" -- we'd also like to detect rearrangement of
> sensitive structs that would be size-preserving.

A while ago, I started working on a Perl script that parsed struct
declarations.  The idea was that we could store a reference copy of the
struct layout somewhere, and the script, using its knowledge of
alignment and padding rules on different architectures, would calculate
the current layout and compare it with the reference layout.

I set it aside when I realized how much work it would be to parse
function pointers, but we could dodge the issue by always typedef'ing
them, e.g. instead of

struct sigaction {
        union {
                void    (*__sa_handler)(int);
                void    (*__sa_sigaction)(int, struct __siginfo *, void *);
        } __sigaction_u;                /* signal handler */
        int     sa_flags;               /* see signal options below */
        sigset_t sa_mask;               /* signal mask to apply */
};

we'd have

typedef void (*__sa_handler_func_ptr)(int);
typedef void (*__sa_sigaction_func_ptr)(int, struct __siginfo *, void *);

struct sigaction {
        union {
                __sa_handler_func_ptr __sa_handler;
                __sa_sigaction_func_ptr __sa_sigaction;
        } __sigaction_u;                /* signal handler */
        int     sa_flags;               /* see signal options below */
        sigset_t sa_mask;               /* signal mask to apply */
};

My script understands typedefs, and it should be easy enough to fudge
the typedef parsing bit so it knows that __sa_handler_func_ptr and
__sa_sigaction_func_ptr are function pointers, which is enough to figure
out size and alignment on all architectures we support.

DES
-- 
Dag-Erling Sm?rgrav - des@des.no
From rnoland at FreeBSD.org  Thu Nov 12 16:28:39 2009
From: rnoland at FreeBSD.org (Robert Noland)
Date: Thu Nov 12 16:28:50 2009
Subject: svn commit: r199228 - head/sys/geom/part
Message-ID: <200911121628.nACGSdlv035921@svn.freebsd.org>

Author: rnoland
Date: Thu Nov 12 16:28:39 2009
New Revision: 199228
URL: http://svn.freebsd.org/changeset/base/199228

Log:
  We need to allocate space for the header in the create path also.
  
  This fixes a null pointer dereference with "gpart create -s GPT" after
  the previous commit.
  
  Reported by:	Yuri Pankov
  Pointyhat to:	me
  MFC after:	1 week

Modified:
  head/sys/geom/part/g_part_gpt.c

Modified: head/sys/geom/part/g_part_gpt.c
==============================================================================
--- head/sys/geom/part/g_part_gpt.c	Thu Nov 12 15:59:05 2009	(r199227)
+++ head/sys/geom/part/g_part_gpt.c	Thu Nov 12 16:28:39 2009	(r199228)
@@ -444,6 +444,9 @@ g_part_gpt_create(struct g_part_table *b
 	table->lba[GPT_ELT_SECHDR] = last;
 	table->lba[GPT_ELT_SECTBL] = last - tblsz;
 
+	/* 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);
From des at des.no  Thu Nov 12 16:31:24 2009
From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=)
Date: Thu Nov 12 16:31:31 2009
Subject: svn commit: r198848 - head/bin/ps
In-Reply-To: <20091113022937.P1408@besplex.bde.org> (Bruce Evans's message of
	"Fri, 13 Nov 2009 03:02:45 +1100 (EST)")
References: <200911030928.nA39SjLx085597@svn.freebsd.org>
	<20091103214231.H23957@delplex.bde.org> <4AF4B6B2.3090706@delphij.net>
	<20091111230915.B3510@besplex.bde.org>
	<20091112050515.GA15002@server.vk2pj.dyndns.org>
	<86d43n23r0.fsf@ds4.des.no> <20091113022937.P1408@besplex.bde.org>
Message-ID: <86vdhfzov9.fsf@ds4.des.no>

Bruce Evans  writes:
> Can you imagine NCPU hitting a power wall or other technical barrier at
> not much larger than 64?

Do you have any idea how many threads a modern GPU has?  We're talking
high three to low four digits per die...

SGI built a 51,200-core single system image Itanium cluster for NASA.
Supposedly, it runs a stock Linux kernel.

Closer to home, the Sun T2 has 64 threads per die, and there are
four-way T2 systems (256 threads) on the market already.

DES
-- 
Dag-Erling Sm?rgrav - des@des.no
From jkim at FreeBSD.org  Thu Nov 12 17:56:57 2009
From: jkim at FreeBSD.org (Jung-uk Kim)
Date: Thu Nov 12 17:58:21 2009
Subject: svn commit: r199229 - in head/sys: dev/fb dev/pci isa
Message-ID: <200911121756.nACHuu8l037924@svn.freebsd.org>

Author: jkim
Date: Thu Nov 12 17:56:56 2009
New Revision: 199229
URL: http://svn.freebsd.org/changeset/base/199229

Log:
  - Partially revert hackish r198964 and r199002.
  - Add a proxy driver vgapm to help vgapci to save/load VGA state.
  - Move device_set_desc() to the right place while we are here.
  
  Reviewed by:	jhb

Modified:
  head/sys/dev/fb/vgareg.h
  head/sys/dev/pci/vga_pci.c
  head/sys/isa/vga_isa.c

Modified: head/sys/dev/fb/vgareg.h
==============================================================================
--- head/sys/dev/fb/vgareg.h	Thu Nov 12 16:28:39 2009	(r199228)
+++ head/sys/dev/fb/vgareg.h	Thu Nov 12 17:56:56 2009	(r199229)
@@ -69,7 +69,6 @@
 struct video_adapter;
 typedef struct vga_softc {
 	struct video_adapter	*adp;
-	device_t		pci_dev;
 	void			*state_buf;
 	void			*pal_buf;
 #ifdef FB_INSTALL_CDEV

Modified: head/sys/dev/pci/vga_pci.c
==============================================================================
--- head/sys/dev/pci/vga_pci.c	Thu Nov 12 16:28:39 2009	(r199228)
+++ head/sys/dev/pci/vga_pci.c	Thu Nov 12 17:56:56 2009	(r199229)
@@ -46,8 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-
 #include 
 #include 
 
@@ -57,7 +55,6 @@ struct vga_resource {
 };
 
 struct vga_pci_softc {
-	device_t	vga_isa_dev;	/* Sister isavga driver. */
 	device_t	vga_msi_child;	/* Child driver using MSI. */
 	struct vga_resource vga_res[PCIR_MAX_BAR_0 + 1];
 };
@@ -115,11 +112,6 @@ vga_pci_attach(device_t dev)
 static int
 vga_pci_suspend(device_t dev)
 {
-	struct vga_pci_softc *sc;
-
-	sc = device_get_softc(dev);
-	if (sc->vga_isa_dev != NULL)
-		(void)DEVICE_SUSPEND(sc->vga_isa_dev);
 
 	return (bus_generic_suspend(dev));
 }
@@ -127,11 +119,6 @@ vga_pci_suspend(device_t dev)
 static int
 vga_pci_resume(device_t dev)
 {
-	struct vga_pci_softc *sc;
-
-	sc = device_get_softc(dev);
-	if (sc->vga_isa_dev != NULL)
-		(void)DEVICE_RESUME(sc->vga_isa_dev);
 
 	return (bus_generic_resume(dev));
 }

Modified: head/sys/isa/vga_isa.c
==============================================================================
--- head/sys/isa/vga_isa.c	Thu Nov 12 16:28:39 2009	(r199228)
+++ head/sys/isa/vga_isa.c	Thu Nov 12 17:56:56 2009	(r199229)
@@ -59,6 +59,69 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+static void
+vga_suspend(device_t dev)
+{
+	vga_softc_t *sc;
+	int nbytes;
+
+	sc = device_get_softc(dev);
+
+	/* Save the video state across the suspend. */
+	if (sc->state_buf != NULL)
+		goto save_palette;
+	nbytes = vidd_save_state(sc->adp, NULL, 0);
+	if (nbytes <= 0)
+		goto save_palette;
+	sc->state_buf = malloc(nbytes, M_TEMP, M_NOWAIT);
+	if (sc->state_buf == NULL)
+		goto save_palette;
+	if (bootverbose)
+		device_printf(dev, "saving %d bytes of video state\n", nbytes);
+	if (vidd_save_state(sc->adp, sc->state_buf, nbytes) != 0) {
+		device_printf(dev, "failed to save state (nbytes=%d)\n",
+		    nbytes);
+		free(sc->state_buf, M_TEMP);
+		sc->state_buf = NULL;
+	}
+
+save_palette:
+	/* Save the color palette across the suspend. */
+	if (sc->pal_buf != NULL)
+		return;
+	sc->pal_buf = malloc(256 * 3, M_TEMP, M_NOWAIT);
+	if (sc->pal_buf == NULL)
+		return;
+	if (bootverbose)
+		device_printf(dev, "saving color palette\n");
+	if (vidd_save_palette(sc->adp, sc->pal_buf) != 0) {
+		device_printf(dev, "failed to save palette\n");
+		free(sc->pal_buf, M_TEMP);
+		sc->pal_buf = NULL;
+	}
+}
+
+static void
+vga_resume(device_t dev)
+{
+	vga_softc_t *sc;
+
+	sc = device_get_softc(dev);
+
+	if (sc->state_buf != NULL) {
+		if (vidd_load_state(sc->adp, sc->state_buf) != 0)
+			device_printf(dev, "failed to reload state\n");
+		free(sc->state_buf, M_TEMP);
+		sc->state_buf = NULL;
+	}
+	if (sc->pal_buf != NULL) {
+		if (vidd_load_palette(sc->adp, sc->pal_buf) != 0)
+			device_printf(dev, "failed to reload palette\n");
+		free(sc->pal_buf, M_TEMP);
+		sc->pal_buf = NULL;
+	}
+}
+
 #define VGA_SOFTC(unit)		\
 	((vga_softc_t *)devclass_get_softc(isavga_devclass, unit))
 
@@ -103,9 +166,9 @@ isavga_probe(device_t dev)
 	if (isa_get_vendorid(dev))
 		return (ENXIO);
 
-	device_set_desc(dev, "Generic ISA VGA");
 	error = vga_probe_unit(device_get_unit(dev), &adp, device_get_flags(dev));
 	if (error == 0) {
+		device_set_desc(dev, "Generic ISA VGA");
 		bus_set_resource(dev, SYS_RES_IOPORT, 0,
 				 adp.va_io_base, adp.va_io_size);
 		bus_set_resource(dev, SYS_RES_MEMORY, 0,
@@ -124,10 +187,6 @@ static int
 isavga_attach(device_t dev)
 {
 	vga_softc_t *sc;
-	devclass_t dc;
-	device_t *devs;
-	void *vgapci_sc;
-	int count, i;
 	int unit;
 	int rid;
 	int error;
@@ -161,108 +220,29 @@ isavga_attach(device_t dev)
 	bus_generic_attach(dev);
 #endif
 
-	/* Find the matching PCI video controller. */
-	if (unit == 0) {
-		dc = devclass_find("vgapci");
-		if (dc != NULL &&
-		    devclass_get_devices(dc, &devs, &count) == 0) {
-			for (i = 0; i < count; i++)
-				if (device_get_flags(devs[i]) != 0) {
-					sc->pci_dev = devs[i];
-					break;
-				}
-			free(devs, M_TEMP);
-		}
-		if (sc->pci_dev != NULL) {
-			vgapci_sc = device_get_softc(sc->pci_dev);
-			*(device_t *)vgapci_sc = dev;
-			device_printf(dev, "associated with %s\n",
-			    device_get_nameunit(sc->pci_dev));
-		}
-	}
-
 	return (0);
 }
 
 static int
 isavga_suspend(device_t dev)
 {
-	vga_softc_t *sc;
-	device_t isa_dev;
-	int err, nbytes;
-
-	err = 0;
-	isa_dev = dev;
-	sc = device_get_softc(isa_dev);
-	if (sc->pci_dev != NULL)
-		dev = sc->pci_dev;
-	else
-		err = bus_generic_suspend(isa_dev);
-
-	/* Save the video state across the suspend. */
-	if (sc->state_buf != NULL)
-		goto save_palette;
-	nbytes = vidd_save_state(sc->adp, NULL, 0);
-	if (nbytes <= 0)
-		goto save_palette;
-	sc->state_buf = malloc(nbytes, M_TEMP, M_NOWAIT);
-	if (sc->state_buf == NULL)
-		goto save_palette;
-	if (bootverbose)
-		device_printf(dev, "saving %d bytes of video state\n", nbytes);
-	if (vidd_save_state(sc->adp, sc->state_buf, nbytes) != 0) {
-		device_printf(dev, "failed to save state (nbytes=%d)\n",
-		    nbytes);
-		free(sc->state_buf, M_TEMP);
-		sc->state_buf = NULL;
-	}
+	int error;
 
-save_palette:
-	/* Save the color palette across the suspend. */
-	if (sc->pal_buf != NULL)
-		return (err);
-	sc->pal_buf = malloc(256 * 3, M_TEMP, M_NOWAIT);
-	if (sc->pal_buf != NULL) {
-		if (bootverbose)
-			device_printf(dev, "saving color palette\n");
-		if (vidd_save_palette(sc->adp, sc->pal_buf) != 0) {
-			device_printf(dev, "failed to save palette\n");
-			free(sc->pal_buf, M_TEMP);
-			sc->pal_buf = NULL;
-		}
-	}
+	error = bus_generic_suspend(dev);
+	if (error != 0)
+		return (error);
+	vga_suspend(dev);
 
-	return (err);
+	return (error);
 }
 
 static int
 isavga_resume(device_t dev)
 {
-	vga_softc_t *sc;
-	device_t isa_dev;
 
-	isa_dev = dev;
-	sc = device_get_softc(isa_dev);
-	if (sc->pci_dev != NULL)
-		dev = sc->pci_dev;
+	vga_resume(dev);
 
-	if (sc->state_buf != NULL) {
-		if (vidd_load_state(sc->adp, sc->state_buf) != 0)
-			device_printf(dev, "failed to reload state\n");
-		free(sc->state_buf, M_TEMP);
-		sc->state_buf = NULL;
-	}
-	if (sc->pal_buf != NULL) {
-		if (vidd_load_palette(sc->adp, sc->pal_buf) != 0)
-			device_printf(dev, "failed to reload palette\n");
-		free(sc->pal_buf, M_TEMP);
-		sc->pal_buf = NULL;
-	}
-
-	if (isa_dev != dev)
-		return (0);
-
-	return (bus_generic_resume(isa_dev));
+	return (bus_generic_resume(dev));
 }
 
 #ifdef FB_INSTALL_CDEV
@@ -323,3 +303,76 @@ static driver_t isavga_driver = {
 };
 
 DRIVER_MODULE(vga, isa, isavga_driver, isavga_devclass, 0, 0);
+
+static devclass_t	vgapm_devclass;
+
+static void
+vgapm_identify(driver_t *driver, device_t parent)
+{
+
+	if (device_get_flags(parent) != 0)
+		device_add_child(parent, "vgapm", 0);
+}
+
+static int
+vgapm_probe(device_t dev)
+{
+
+	device_set_desc(dev, "VGA suspend/resume");
+	device_quiet(dev);
+
+	return (BUS_PROBE_DEFAULT);
+}
+
+static int
+vgapm_attach(device_t dev)
+{
+
+	return (0);
+}
+
+static int
+vgapm_suspend(device_t dev)
+{
+	device_t vga_dev;
+	int error;
+
+	error = bus_generic_suspend(dev);
+	if (error != 0)
+		return (error);
+	vga_dev = devclass_get_device(isavga_devclass, 0);
+	if (vga_dev == NULL)
+		return (0);
+	vga_suspend(vga_dev);
+
+	return (0);
+}
+
+static int
+vgapm_resume(device_t dev)
+{
+	device_t vga_dev;
+
+	vga_dev = devclass_get_device(isavga_devclass, 0);
+	if (vga_dev != NULL)
+		vga_resume(vga_dev);
+
+	return (bus_generic_resume(dev));
+}
+
+static device_method_t vgapm_methods[] = {
+	DEVMETHOD(device_identify,	vgapm_identify),
+	DEVMETHOD(device_probe,		vgapm_probe),
+	DEVMETHOD(device_attach,	vgapm_attach),
+	DEVMETHOD(device_suspend,	vgapm_suspend),
+	DEVMETHOD(device_resume,	vgapm_resume),
+	{ 0, 0 }
+};
+
+static driver_t vgapm_driver = {
+	"vgapm",
+	vgapm_methods,
+	0
+};
+
+DRIVER_MODULE(vgapm, vgapci, vgapm_driver, vgapm_devclass, 0, 0);
From imp at bsdimp.com  Thu Nov 12 18:00:24 2009
From: imp at bsdimp.com (M. Warner Losh)
Date: Thu Nov 12 18:01:19 2009
Subject: svn commit: r199201 - in head: contrib/libpcap sbin/ifconfig
 share/man/man4 sys/kern sys/net sys/sys
In-Reply-To: 
References: <200911112130.nABLUw9b007768@svn.freebsd.org>
	
Message-ID: <20091112.105542.643508160.imp@bsdimp.com>

In message: 
            Antoine Brodin  writes:
: On Wed, Nov 11, 2009 at 10:30 PM, Xin LI  wrote:
: > Author: delphij
: > Date: Wed Nov 11 21:30:58 2009
: > New Revision: 199201
: > URL: http://svn.freebsd.org/changeset/base/199201
: >
: > Log:
: > ?Add interface description capability as inspired by OpenBSD.
: >
: > ?MFC after: ? ?3 months
: >
: > Modified:
: > ?head/contrib/libpcap/inet.c
: > ?head/sbin/ifconfig/ifconfig.8
: > ?head/sbin/ifconfig/ifconfig.c
: > ?head/share/man/man4/netintro.4
: > ?head/sys/kern/kern_jail.c
: > ?head/sys/net/if.c
: > ?head/sys/net/if.h
: > ?head/sys/net/if_var.h
: > ?head/sys/sys/param.h
: > ?head/sys/sys/priv.h
: > ?head/sys/sys/sockio.h
: ...
: > Modified: head/sys/net/if_var.h
: > ==============================================================================
: > --- head/sys/net/if_var.h ? ? ? Wed Nov 11 21:18:27 2009 ? ? ? ?(r199200)
: > +++ head/sys/net/if_var.h ? ? ? Wed Nov 11 21:30:58 2009 ? ? ? ?(r199201)
: > @@ -198,6 +198,7 @@ struct ifnet {
: > ? ? ? ?void ? ?*if_pf_kif;
: > ? ? ? ?void ? ?*if_lagg; ? ? ? ? ? ? ? /* lagg glue */
: > ? ? ? ?u_char ? if_alloctype; ? ? ? ? ?/* if_type at time of allocation */
: > + ? ? ? struct sbuf *if_description; ? ?/* interface description */
: >
: > ? ? ? ?/*
: > ? ? ? ? * Spare fields are added so that we can modify sensitive data
: > @@ -205,7 +206,7 @@ struct ifnet {
: > ? ? ? ? * be used with care where binary compatibility is required.
: > ? ? ? ? */
: > ? ? ? ?char ? ? if_cspare[3];
: > - ? ? ? void ? ?*if_pspare[8];
: > + ? ? ? void ? ?*if_pspare[7];
: > ? ? ? ?int ? ? if_ispare[4];
: > ?};
: 
: Hi Delphij,
: 
: Doesn't this break ABI gratuitously?  (I think it changes the size of
: s