From owner-p4-projects@FreeBSD.ORG Sun Apr 26 07:25:04 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 58BBD1065675; Sun, 26 Apr 2009 07:25:04 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 150141065670 for ; Sun, 26 Apr 2009 07:25:04 +0000 (UTC) (envelope-from zec@fer.hr) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 021078FC13 for ; Sun, 26 Apr 2009 07:25:04 +0000 (UTC) (envelope-from zec@fer.hr) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n3Q7P3HT022978 for ; Sun, 26 Apr 2009 07:25:03 GMT (envelope-from zec@fer.hr) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n3Q7P3R6022972 for perforce@freebsd.org; Sun, 26 Apr 2009 07:25:03 GMT (envelope-from zec@fer.hr) Date: Sun, 26 Apr 2009 07:25:03 GMT Message-Id: <200904260725.n3Q7P3R6022972@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@fer.hr using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 161096 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 07:25:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=161096 Change 161096 by zec@zec_tpx32 on 2009/04/26 07:25:02 IFC @ 161094 Affected files ... .. //depot/projects/vimage-commit2/src/sys/conf/files.powerpc#11 integrate .. //depot/projects/vimage-commit2/src/sys/dev/ed/if_ed_pccard.c#9 integrate .. //depot/projects/vimage-commit2/src/sys/dev/pccard/pccarddevs#11 integrate .. //depot/projects/vimage-commit2/src/sys/dev/usb/controller/ehci.c#7 integrate .. //depot/projects/vimage-commit2/src/sys/dev/usb/controller/ohci.c#6 integrate .. //depot/projects/vimage-commit2/src/sys/dev/usb/controller/uhci.c#6 integrate .. //depot/projects/vimage-commit2/src/sys/dev/usb/usb_core.h#7 integrate .. //depot/projects/vimage-commit2/src/sys/dev/usb/usb_device.c#7 integrate .. //depot/projects/vimage-commit2/src/sys/dev/usb/usb_device.h#6 integrate .. //depot/projects/vimage-commit2/src/sys/dev/usb/usb_generic.c#5 integrate .. //depot/projects/vimage-commit2/src/sys/dev/usb/usb_hub.c#7 integrate .. //depot/projects/vimage-commit2/src/sys/dev/usb/usb_request.c#6 integrate .. //depot/projects/vimage-commit2/src/sys/dev/usb/usb_revision.h#2 integrate .. //depot/projects/vimage-commit2/src/sys/dev/usb/usb_transfer.c#6 integrate .. //depot/projects/vimage-commit2/src/sys/ia64/isa/isa.c#2 integrate .. //depot/projects/vimage-commit2/src/sys/kern/kern_vimage.c#18 integrate .. //depot/projects/vimage-commit2/src/sys/kern/tty_pts.c#10 integrate .. //depot/projects/vimage-commit2/src/sys/netgraph/netgraph.h#22 integrate .. //depot/projects/vimage-commit2/src/sys/netgraph/ng_base.c#27 integrate .. //depot/projects/vimage-commit2/src/sys/netgraph/ng_eiface.c#22 integrate .. //depot/projects/vimage-commit2/src/sys/netgraph/ng_ether.c#14 integrate .. //depot/projects/vimage-commit2/src/sys/netgraph/ng_iface.c#21 integrate .. //depot/projects/vimage-commit2/src/sys/netinet/in.c#23 integrate .. //depot/projects/vimage-commit2/src/sys/powerpc/aim/machdep.c#8 integrate .. //depot/projects/vimage-commit2/src/sys/powerpc/booke/pmap.c#8 integrate .. //depot/projects/vimage-commit2/src/sys/powerpc/conf/MPC85XX#4 integrate .. //depot/projects/vimage-commit2/src/sys/powerpc/include/intr_machdep.h#2 integrate .. //depot/projects/vimage-commit2/src/sys/powerpc/include/pte.h#4 integrate .. //depot/projects/vimage-commit2/src/sys/powerpc/mpc85xx/atpic.c#1 branch .. //depot/projects/vimage-commit2/src/sys/powerpc/mpc85xx/isa.c#1 branch .. //depot/projects/vimage-commit2/src/sys/powerpc/mpc85xx/ocpbus.c#5 integrate .. //depot/projects/vimage-commit2/src/sys/powerpc/mpc85xx/pci_ocp.c#2 integrate .. //depot/projects/vimage-commit2/src/sys/powerpc/powerpc/autoconf.c#3 integrate .. //depot/projects/vimage-commit2/src/sys/powerpc/powerpc/bus_machdep.c#3 integrate .. //depot/projects/vimage-commit2/src/sys/powerpc/powerpc/intr_machdep.c#5 integrate .. //depot/projects/vimage-commit2/src/sys/sys/vimage.h#43 integrate .. //depot/projects/vimage-commit2/src/sys/vm/swap_pager.c#7 integrate .. //depot/projects/vimage-commit2/src/sys/vm/vnode_pager.c#7 integrate Differences ... ==== //depot/projects/vimage-commit2/src/sys/conf/files.powerpc#11 (text+ko) ==== @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $FreeBSD: src/sys/conf/files.powerpc,v 1.98 2009/04/05 18:40:15 nwhitehorn Exp $ +# $FreeBSD: src/sys/conf/files.powerpc,v 1.99 2009/04/24 03:51:11 marcel Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -103,6 +103,8 @@ powerpc/fpu/fpu_mul.c optional fpu_emu powerpc/fpu/fpu_sqrt.c optional fpu_emu powerpc/fpu/fpu_subr.c optional fpu_emu +powerpc/mpc85xx/atpic.c optional mpc85xx isa +powerpc/mpc85xx/isa.c optional mpc85xx isa powerpc/mpc85xx/lbc.c optional mpc85xx powerpc/mpc85xx/mpc85xx.c optional mpc85xx powerpc/mpc85xx/nexus.c optional mpc85xx ==== //depot/projects/vimage-commit2/src/sys/dev/ed/if_ed_pccard.c#9 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ed/if_ed_pccard.c,v 1.154 2009/04/22 16:51:01 imp Exp $ + * $FreeBSD: src/sys/dev/ed/if_ed_pccard.c,v 1.155 2009/04/24 17:28:12 imp Exp $ */ /* @@ -210,8 +210,9 @@ { PCMCIA_CARD(NEXTCOM, NEXTHAWK), 0}, { PCMCIA_CARD(NEWMEDIA, LANSURFER), NE2000DVF_ANYFUNC}, { PCMCIA_CARD(NEWMEDIA, LIVEWIRE), 0}, + { PCMCIA_CARD(OEM2, 100BASE), NE2000DVF_AX88X90}, { PCMCIA_CARD(OEM2, ETHERNET), 0}, - { PCMCIA_CARD(OEM2, FAST_ETHERNET), NE2000DVF_AX88X90 }, + { PCMCIA_CARD(OEM2, FAST_ETHERNET), NE2000DVF_AX88X90}, { PCMCIA_CARD(OEM2, NE2000), 0}, { PCMCIA_CARD(PLANET, SMARTCOM2000), 0 }, { PCMCIA_CARD(PREMAX, PE200), 0}, ==== //depot/projects/vimage-commit2/src/sys/dev/pccard/pccarddevs#11 (text+ko) ==== @@ -1,4 +1,4 @@ -$FreeBSD: src/sys/dev/pccard/pccarddevs,v 1.147 2009/04/22 16:50:44 imp Exp $ +$FreeBSD: src/sys/dev/pccard/pccarddevs,v 1.148 2009/04/24 17:27:45 imp Exp $ /* $NetBSD: pcmciadevs,v 1.226 2008/06/19 18:20:33 imp Exp $ */ /* $OpenBSD: pcmciadevs,v 1.93 2002/06/21 08:31:10 henning Exp $ */ @@ -772,6 +772,7 @@ product OEM2 CDROM1 { "PCMCIA", "CD-ROM", NULL, NULL } Generic PCMCIA CD-ROM product OEM2 IDE { "PCMCIA", "IDE&spCARD", NULL, NULL } Generic PCMCIA IDE CARD product OEM2 ETHERNET { "PCMCIA", "Ethernet", NULL, NULL } NE2000 PC Card +product OEM2 100BASE { "PCMCIA", "100BASE", NULL, NULL } NE2000 PC Card product OEM2 FAST_ETHERNET { "PCMCIA", "FAST&spETHERNET&spCARD", NULL, NULL } NE2000 PC Card product OEM2 NE2000 { "NE2000&spCompatible&spPC&spCard", "PCMCIA", NULL, NULL } Generic NE2000 PC Card product PHISON CF_CARD { "PHISON", "CF&spCard", NULL, NULL } Generic CF or SD/MMC/SmartMedia Reader ==== //depot/projects/vimage-commit2/src/sys/dev/usb/controller/ehci.c#7 (text+ko) ==== @@ -44,7 +44,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ehci.c,v 1.14 2009/04/22 17:08:16 thompsa Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ehci.c,v 1.15 2009/04/25 21:10:06 thompsa Exp $"); #include #include @@ -1964,7 +1964,7 @@ usb2_pc_cpu_flush(qh->page_cache); - if (xfer->xroot->udev->pwr_save.suspended == 0) { + if (xfer->xroot->udev->state != USB_STATE_SUSPENDED) { EHCI_APPEND_QH(qh, *qh_last); } } ==== //depot/projects/vimage-commit2/src/sys/dev/usb/controller/ohci.c#6 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ohci.c,v 1.11 2009/04/22 17:08:16 thompsa Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ohci.c,v 1.12 2009/04/25 21:10:06 thompsa Exp $"); /* * USB Open Host Controller driver. @@ -1020,7 +1020,7 @@ * writing the BLF and CLF bits: */ - if (xfer->xroot->udev->pwr_save.suspended) { + if (xfer->xroot->udev->state == USB_STATE_SUSPENDED) { /* nothing to do */ } else if (xfer->pipe->methods == &ohci_device_bulk_methods) { ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); @@ -1589,7 +1589,7 @@ ed->ed_headp = td->td_self; - if (xfer->xroot->udev->pwr_save.suspended == 0) { + if (xfer->xroot->udev->state != USB_STATE_SUSPENDED) { /* the append function will flush the endpoint descriptor */ OHCI_APPEND_QH(ed, *ed_last); ==== //depot/projects/vimage-commit2/src/sys/dev/usb/controller/uhci.c#6 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/usb/controller/uhci.c,v 1.10 2009/04/22 17:08:16 thompsa Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/usb/controller/uhci.c,v 1.11 2009/04/25 21:10:06 thompsa Exp $"); /* * USB Universal Host Controller driver. @@ -1921,7 +1921,7 @@ qh->e_next = td; qh->qh_e_next = td->td_self; - if (xfer->xroot->udev->pwr_save.suspended == 0) { + if (xfer->xroot->udev->state != USB_STATE_SUSPENDED) { UHCI_APPEND_QH(qh, sc->sc_bulk_p_last); uhci_add_loop(sc); xfer->flags_int.bandwidth_reclaimed = 1; @@ -1982,7 +1982,7 @@ * NOTE: some devices choke on bandwidth- reclamation for control * transfers */ - if (xfer->xroot->udev->pwr_save.suspended == 0) { + if (xfer->xroot->udev->state != USB_STATE_SUSPENDED) { if (xfer->xroot->udev->speed == USB_SPEED_LOW) { UHCI_APPEND_QH(qh, sc->sc_ls_ctl_p_last); } else { @@ -2071,7 +2071,7 @@ qh->e_next = td; qh->qh_e_next = td->td_self; - if (xfer->xroot->udev->pwr_save.suspended == 0) { + if (xfer->xroot->udev->state != USB_STATE_SUSPENDED) { /* enter QHs into the controller data structures */ UHCI_APPEND_QH(qh, sc->sc_intr_p_last[xfer->qh_pos]); ==== //depot/projects/vimage-commit2/src/sys/dev/usb/usb_core.h#7 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_core.h,v 1.12 2009/04/22 17:08:16 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_core.h,v 1.14 2009/04/25 21:25:52 thompsa Exp $ */ /*- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * @@ -515,6 +515,7 @@ /* prototypes */ const char *usb2_errstr(usb2_error_t error); +const char *usb2_statestr(enum usb_dev_state state); struct usb2_config_descriptor *usb2_get_config_descriptor( struct usb2_device *udev); struct usb2_device_descriptor *usb2_get_device_descriptor( @@ -552,5 +553,6 @@ uint8_t usb2_get_bus_index(struct usb2_device *udev); uint8_t usb2_get_device_index(struct usb2_device *udev); void usb2_set_power_mode(struct usb2_device *udev, uint8_t power_mode); +int usb2_device_attached(struct usb2_device *udev); #endif /* _USB2_CORE_H_ */ ==== //depot/projects/vimage-commit2/src/sys/dev/usb/usb_device.c#7 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_device.c,v 1.27 2009/04/22 17:08:16 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_device.c,v 1.29 2009/04/25 21:25:52 thompsa Exp $ */ /*- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * @@ -90,6 +90,22 @@ SYSCTL_INT(_hw_usb2, OID_AUTO, template, CTLFLAG_RW, &usb2_template, 0, "Selected USB device side template"); +static const char* statestr[USB_STATE_MAX] = { + [USB_STATE_DETACHED] = "DETACHED", + [USB_STATE_ATTACHED] = "ATTACHED", + [USB_STATE_POWERED] = "POWERED", + [USB_STATE_ADDRESSED] = "ADDRESSED", + [USB_STATE_CONFIGURED] = "CONFIGURED", + [USB_STATE_SUSPENDED] = "SUSPENDED" +}; + +const char * +usb2_statestr(enum usb_dev_state state) +{ + KASSERT(state < USB_STATE_MAX, ("invalid udev state")); + + return (statestr[state]); +} /*------------------------------------------------------------------------* * usb2_get_pipe_by_addr @@ -457,6 +473,8 @@ * the current config number and index. */ err = usb2_req_set_config(udev, NULL, USB_UNCONFIG_NO); + if (udev->state == USB_STATE_CONFIGURED) + usb2_set_device_state(udev, USB_STATE_ADDRESSED); goto done; } /* get the full config descriptor */ @@ -524,6 +542,7 @@ udev->power = power; udev->curr_config_no = cdp->bConfigurationValue; udev->curr_config_index = index; + usb2_set_device_state(udev, USB_STATE_CONFIGURED); /* Set the actual configuration value. */ err = usb2_req_set_config(udev, NULL, cdp->bConfigurationValue); @@ -980,7 +999,7 @@ udev->port_no, udev->address); if (device_is_attached(dev)) { - if (udev->flags.suspended) { + if (udev->state == USB_STATE_SUSPENDED) { err = DEVICE_RESUME(dev); if (err) { device_printf(dev, "Resume failed!\n"); @@ -1120,7 +1139,7 @@ uaa->temp_dev = NULL; device_set_ivars(iface->subdev, NULL); - if (udev->flags.suspended) { + if (udev->state == USB_STATE_SUSPENDED) { err = DEVICE_SUSPEND(iface->subdev); if (err) device_printf(iface->subdev, "Suspend failed\n"); @@ -1341,12 +1360,12 @@ USB_BUS_LOCK(udev->bus); /* filter the suspend events */ - if (udev->flags.suspended == do_suspend) { + if ((udev->state == USB_STATE_SUSPENDED && do_suspend) || + (udev->state != USB_STATE_SUSPENDED && !do_suspend)) { USB_BUS_UNLOCK(udev->bus); /* nothing to do */ return (0); } - udev->flags.suspended = do_suspend; USB_BUS_UNLOCK(udev->bus); /* do the suspend or resume */ @@ -1471,6 +1490,7 @@ udev->bus = bus; udev->address = USB_START_ADDR; /* default value */ udev->plugtime = (usb2_ticks_t)ticks; + usb2_set_device_state(udev, USB_STATE_POWERED); /* * We need to force the power mode to "on" because there are plenty * of USB devices out there that do not work very well with @@ -1572,6 +1592,7 @@ goto done; } } + usb2_set_device_state(udev, USB_STATE_ADDRESSED); /* * Get the first 8 bytes of the device descriptor ! @@ -1927,7 +1948,8 @@ DPRINTFN(4, "udev=%p port=%d\n", udev, udev->port_no); - bus = udev->bus;; + bus = udev->bus; + usb2_set_device_state(udev, USB_STATE_DETACHED); #if USB_HAVE_UGEN usb2_notify_addq("-", udev); @@ -2438,3 +2460,20 @@ } return (0); /* not supported */ } + +void +usb2_set_device_state(struct usb2_device *udev, enum usb_dev_state state) +{ + + KASSERT(state < USB_STATE_MAX, ("invalid udev state")); + + DPRINTF("udev %p state %s -> %s\n", udev, + usb2_statestr(udev->state), usb2_statestr(state)); + udev->state = state; +} + +int +usb2_device_attached(struct usb2_device *udev) +{ + return (udev->state > USB_STATE_DETACHED); +} ==== //depot/projects/vimage-commit2/src/sys/dev/usb/usb_device.h#6 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_device.h,v 1.14 2009/04/22 17:07:53 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_device.h,v 1.15 2009/04/25 21:10:06 thompsa Exp $ */ /*- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * @@ -85,7 +85,6 @@ struct usb2_device_flags { uint8_t usb2_mode:1; /* USB mode (see USB_MODE_XXX) */ uint8_t self_powered:1; /* set if USB device is self powered */ - uint8_t suspended:1; /* set if USB device is suspended */ uint8_t no_strings:1; /* set if USB device does not support * strings */ uint8_t remote_wakeup:1; /* set if remote wakeup is enabled */ @@ -101,7 +100,6 @@ usb2_size_t type_refs[4]; /* transfer reference count */ usb2_size_t read_refs; /* data read references */ usb2_size_t write_refs; /* data write references */ - uint8_t suspended; /* set if USB device is suspended */ }; /* @@ -139,6 +137,7 @@ #endif usb2_ticks_t plugtime; /* copy of "ticks" */ + enum usb_dev_state state; uint16_t refcount; #define USB_DEV_REF_MAX 0xffff @@ -205,5 +204,7 @@ void usb_linux_free_device(struct usb_device *dev); uint8_t usb2_peer_can_wakeup(struct usb2_device *udev); struct usb2_pipe *usb2_pipe_foreach(struct usb2_device *udev, struct usb2_pipe *pipe); +void usb2_set_device_state(struct usb2_device *udev, + enum usb_dev_state state); #endif /* _USB2_DEVICE_H_ */ ==== //depot/projects/vimage-commit2/src/sys/dev/usb/usb_generic.c#5 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_generic.c,v 1.9 2009/04/05 18:20:38 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_generic.c,v 1.10 2009/04/25 21:10:06 thompsa Exp $ */ /*- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * @@ -823,7 +823,7 @@ di->udi_speed = udev->speed; di->udi_mode = udev->flags.usb2_mode; di->udi_power_mode = udev->power_mode; - if (udev->flags.suspended) { + if (udev->state == USB_STATE_SUSPENDED) { di->udi_suspended = 1; } else { di->udi_suspended = 0; ==== //depot/projects/vimage-commit2/src/sys/dev/usb/usb_hub.c#7 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_hub.c,v 1.13 2009/04/22 17:07:56 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_hub.c,v 1.14 2009/04/25 21:10:06 thompsa Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 1998 Lennart Augustsson. All rights reserved. @@ -544,7 +544,7 @@ if (udev->depth > USB_HUB_MAX_DEPTH) { return (USB_ERR_TOO_DEEP); } - if (udev->pwr_save.suspended) { + if (udev->state == USB_STATE_SUSPENDED) { /* need to wait until the child signals resume */ DPRINTF("Device is suspended!\n"); return (0); @@ -1518,7 +1518,7 @@ udev->pwr_save.write_refs += val; } - if (udev->pwr_save.suspended) + if (udev->state == USB_STATE_SUSPENDED) needs_explore = (udev->pwr_save.write_refs != 0) || ((udev->pwr_save.read_refs != 0) && @@ -1600,7 +1600,7 @@ (rem_wakeup == 0))) { /* check if we are suspended */ - if (udev->pwr_save.suspended != 0) { + if (udev->state == USB_STATE_SUSPENDED) { USB_BUS_UNLOCK(bus); usb2_dev_resume_peer(udev); USB_BUS_LOCK(bus); @@ -1608,7 +1608,7 @@ } else if (temp >= limit) { /* check if we are not suspended */ - if (udev->pwr_save.suspended == 0) { + if (udev->state != USB_STATE_SUSPENDED) { USB_BUS_UNLOCK(bus); usb2_dev_suspend_peer(udev); USB_BUS_LOCK(bus); @@ -1647,7 +1647,7 @@ if (temp < mintime) mintime = temp; - if (udev->pwr_save.suspended == 0) { + if (udev->state != USB_STATE_SUSPENDED) { type_refs[0] += udev->pwr_save.type_refs[0]; type_refs[1] += udev->pwr_save.type_refs[1]; type_refs[2] += udev->pwr_save.type_refs[2]; @@ -1697,7 +1697,7 @@ return; /* check if already resumed */ - if (udev->pwr_save.suspended == 0) + if (udev->state != USB_STATE_SUSPENDED) return; /* we need a parent HUB to do resume */ @@ -1737,7 +1737,7 @@ } USB_BUS_LOCK(bus); /* set that this device is now resumed */ - udev->pwr_save.suspended = 0; + usb2_set_device_state(udev, USB_STATE_CONFIGURED); #if USB_HAVE_POWERD /* make sure that we don't go into suspend right away */ udev->pwr_save.last_xfer_time = ticks; @@ -1797,7 +1797,7 @@ return; /* check if already suspended */ - if (udev->pwr_save.suspended) + if (udev->state == USB_STATE_SUSPENDED) return; /* we need a parent HUB to do suspend */ @@ -1819,7 +1819,7 @@ if (child == NULL) continue; - if (child->pwr_save.suspended) + if (child->state == USB_STATE_SUSPENDED) continue; DPRINTFN(1, "Port %u is busy on the HUB!\n", x + 1); @@ -1846,7 +1846,7 @@ * Set that this device is suspended. This variable must be set * before calling USB controller suspend callbacks. */ - udev->pwr_save.suspended = 1; + usb2_set_device_state(udev, USB_STATE_SUSPENDED); USB_BUS_UNLOCK(udev->bus); if (udev->bus->methods->device_suspend != NULL) { ==== //depot/projects/vimage-commit2/src/sys/dev/usb/usb_request.c#6 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_request.c,v 1.13 2009/04/22 17:08:16 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_request.c,v 1.14 2009/04/25 21:10:06 thompsa Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 1998 Lennart Augustsson. All rights reserved. @@ -271,6 +271,12 @@ req->wIndex[1], req->wIndex[0], req->wLength[1], req->wLength[0]); + /* Check if the device is still alive */ + if (udev->state < USB_STATE_POWERED) { + DPRINTF("usb device has gone\n"); + return (USB_ERR_NOT_CONFIGURED); + } + /* * Set "actlen" to a known value in case the caller does not * check the return value: ==== //depot/projects/vimage-commit2/src/sys/dev/usb/usb_revision.h#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_revision.h,v 1.1 2009/02/23 18:31:00 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_revision.h,v 1.2 2009/04/25 21:10:06 thompsa Exp $ */ /*- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * @@ -62,4 +62,16 @@ USB_MODE_MAX }; +/* + * The "USB_MODE" macro defines all the supported device states. + */ +enum usb_dev_state { + USB_STATE_DETACHED, + USB_STATE_ATTACHED, + USB_STATE_POWERED, + USB_STATE_ADDRESSED, + USB_STATE_CONFIGURED, + USB_STATE_SUSPENDED, + USB_STATE_MAX, +}; #endif /* _USB2_REVISION_H_ */ ==== //depot/projects/vimage-commit2/src/sys/dev/usb/usb_transfer.c#6 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/usb/usb_transfer.c,v 1.12 2009/04/22 17:08:10 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/usb/usb_transfer.c,v 1.13 2009/04/25 21:10:06 thompsa Exp $ */ /*- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * @@ -1365,24 +1365,37 @@ void usb2_start_hardware(struct usb2_xfer *xfer) { + struct usb2_xfer_root *info; + struct usb2_bus *bus; usb2_frcount_t x; + info = xfer->xroot; + bus = info->bus; + DPRINTF("xfer=%p, pipe=%p, nframes=%d, dir=%s\n", xfer, xfer->pipe, xfer->nframes, USB_GET_DATA_ISREAD(xfer) ? "read" : "write"); + /* Check if the device is still alive */ + if (info->udev->state < USB_STATE_POWERED) { + USB_BUS_LOCK(bus); + usb2_transfer_done(xfer, USB_ERR_NOT_CONFIGURED); + USB_BUS_UNLOCK(bus); + return; + } + #if USB_DEBUG if (USB_DEBUG_VAR > 0) { - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); usb2_dump_pipe(xfer->pipe); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); } #endif USB_XFER_LOCK_ASSERT(xfer, MA_OWNED); - USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_NOTOWNED); + USB_BUS_LOCK_ASSERT(bus, MA_NOTOWNED); /* Only open the USB transfer once! */ if (!xfer->flags_int.open) { @@ -1390,9 +1403,9 @@ DPRINTF("open\n"); - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); (xfer->pipe->methods->open) (xfer); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); } /* set "transferring" flag */ xfer->flags_int.transferring = 1; @@ -1406,9 +1419,9 @@ * frequently the "done_q": */ if (xfer->wait_queue) { - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); usb2_transfer_dequeue(xfer); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); } /* clear "did_dma_delay" flag */ xfer->flags_int.did_dma_delay = 0; @@ -1441,16 +1454,16 @@ */ DPRINTF("xfer=%p nframes=0: stall " "or clear stall!\n", xfer); - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); xfer->flags_int.can_cancel_immed = 1; /* start the transfer */ usb2_command_wrapper(&xfer->pipe->pipe_q, xfer); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); return; } - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); usb2_transfer_done(xfer, USB_ERR_INVAL); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); return; } /* compute total transfer length */ @@ -1459,9 +1472,9 @@ xfer->sumlen += xfer->frlengths[x]; if (xfer->sumlen < xfer->frlengths[x]) { /* length wrapped around */ - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); usb2_transfer_done(xfer, USB_ERR_INVAL); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); return; } } @@ -1476,9 +1489,9 @@ if (xfer->flags_int.control_xfr) { if (usb2_start_hardware_sub(xfer)) { - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); usb2_transfer_done(xfer, USB_ERR_STALLED); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); return; } } ==== //depot/projects/vimage-commit2/src/sys/ia64/isa/isa.c#2 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/ia64/isa/isa.c,v 1.4 2007/02/24 16:56:22 piso Exp $ + * $FreeBSD: src/sys/ia64/isa/isa.c,v 1.5 2009/04/24 03:43:20 marcel Exp $ */ /* @@ -73,17 +73,6 @@ { } -intrmask_t -isa_irq_pending(void) -{ - u_char irr1; - u_char irr2; - - irr1 = inb(IO_ICU1); - irr2 = inb(IO_ICU2); - return ((irr2 << 8) | irr1); -} - /* * This implementation simply passes the request up to the parent * bus, which in our case is the special i386 nexus, substituting any ==== //depot/projects/vimage-commit2/src/sys/kern/kern_vimage.c#18 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/kern_vimage.c,v 1.2 2009/04/11 05:58:58 zec Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_vimage.c,v 1.3 2009/04/26 07:09:39 zec Exp $"); #include #include @@ -155,6 +155,7 @@ void vnet_mod_deregister(const struct vnet_modinfo *vmi) { + vnet_mod_deregister_multi(vmi, NULL, NULL); } ==== //depot/projects/vimage-commit2/src/sys/kern/tty_pts.c#10 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/tty_pts.c,v 1.30 2009/03/01 09:50:13 ed Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/tty_pts.c,v 1.31 2009/04/25 10:05:55 ed Exp $"); #include "opt_tty.h" @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -58,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -66,8 +68,16 @@ #include +/* + * Our utmp(5) format is limited to 8-byte TTY line names. This means + * we can at most allocate 1000 pseudo-terminals ("pts/999"). Allow + * users to increase this number, assuming they have manually increased + * UT_LINESIZE. + */ static struct unrhdr *pts_pool; -#define MAXPTSDEVS 999 +static unsigned int pts_maxdev = 999; +SYSCTL_UINT(_kern, OID_AUTO, pts_maxdev, CTLFLAG_RW, &pts_maxdev, 0, + "Maximum amount of pts(4) pseudo-terminals"); static MALLOC_DEFINE(M_PTS, "pts", "pseudo tty device"); @@ -716,6 +726,11 @@ chgptscnt(uid, -1, 0); return (EAGAIN); } + if (unit > pts_maxdev) { + free_unr(pts_pool, unit); + chgptscnt(uid, -1, 0); + return (EAGAIN); + } /* Allocate TTY and softc. */ psc = malloc(sizeof(struct pts_softc), M_PTS, M_WAITOK|M_ZERO); @@ -829,7 +844,7 @@ pts_init(void *unused) { - pts_pool = new_unrhdr(0, MAXPTSDEVS, NULL); + pts_pool = new_unrhdr(0, INT_MAX, NULL); #if defined(PTS_COMPAT) || defined(PTS_LINUX) make_dev(&ptmx_cdevsw, 0, UID_ROOT, GID_WHEEL, 0666, "ptmx"); #endif /* PTS_COMPAT || PTS_LINUX */ ==== //depot/projects/vimage-commit2/src/sys/netgraph/netgraph.h#22 (text+ko) ==== @@ -37,7 +37,7 @@ * * Author: Julian Elischer * - * $FreeBSD: src/sys/netgraph/netgraph.h,v 1.80 2008/12/13 22:26:24 mav Exp $ + * $FreeBSD: src/sys/netgraph/netgraph.h,v 1.81 2009/04/26 07:14:50 zec Exp $ * $Whistle: netgraph.h,v 1.29 1999/11/01 07:56:13 julian Exp $ */ ==== //depot/projects/vimage-commit2/src/sys/netgraph/ng_base.c#27 (text+ko) ==== @@ -38,7 +38,7 @@ * Authors: Julian Elischer * Archie Cobbs * - * $FreeBSD: src/sys/netgraph/ng_base.c,v 1.171 2008/12/14 20:15:30 mav Exp $ + * $FreeBSD: src/sys/netgraph/ng_base.c,v 1.172 2009/04/26 07:14:50 zec Exp $ * $Whistle: ng_base.c,v 1.39 1999/01/28 23:54:53 julian Exp $ */ ==== //depot/projects/vimage-commit2/src/sys/netgraph/ng_eiface.c#22 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/netgraph/ng_eiface.c,v 1.46 2009/04/19 22:04:29 rwatson Exp $ + * $FreeBSD: src/sys/netgraph/ng_eiface.c,v 1.47 2009/04/26 07:14:50 zec Exp $ */ #include ==== //depot/projects/vimage-commit2/src/sys/netgraph/ng_ether.c#14 (text+ko) ==== @@ -39,7 +39,7 @@ * Authors: Archie Cobbs * Julian Elischer * - * $FreeBSD: src/sys/netgraph/ng_ether.c,v 1.67 2009/02/27 14:12:05 bz Exp $ + * $FreeBSD: src/sys/netgraph/ng_ether.c,v 1.68 2009/04/26 07:14:50 zec Exp $ */ /* @@ -826,7 +826,7 @@ INIT_VNET_NET(curvnet); struct ifnet *ifp; - /* Create nodes for any already-existing Ethernet interfaces */ + /* Create nodes for any already-existing Ethernet interfaces. */ IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (ifp->if_type == IFT_ETHER ==== //depot/projects/vimage-commit2/src/sys/netgraph/ng_iface.c#21 (text+ko) ==== @@ -37,7 +37,7 @@ * * Author: Archie Cobbs * - * $FreeBSD: src/sys/netgraph/ng_iface.c,v 1.58 2009/04/19 22:05:39 rwatson Exp $ + * $FreeBSD: src/sys/netgraph/ng_iface.c,v 1.59 2009/04/26 07:14:50 zec Exp $ * $Whistle: ng_iface.c,v 1.33 1999/11/01 09:24:51 julian Exp $ */ ==== //depot/projects/vimage-commit2/src/sys/netinet/in.c#23 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/netinet/in.c,v 1.126 2009/04/23 21:41:37 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/netinet/in.c,v 1.129 2009/04/25 23:02:57 rwatson Exp $"); #include "opt_carp.h" @@ -280,6 +280,31 @@ return (EADDRNOTAVAIL); /* + * Security checks before we get involved in any work. + */ + switch (cmd) { + case SIOCAIFADDR: + case SIOCSIFADDR: + case SIOCSIFBRDADDR: + case SIOCSIFNETMASK: + case SIOCSIFDSTADDR: + if (td != NULL) { + error = priv_check(td, PRIV_NET_ADDIFADDR); + if (error) + return (error); + } + break; + + case SIOCDIFADDR: + if (td != NULL) { + error = priv_check(td, PRIV_NET_DELIFADDR); + if (error) + return (error); + } + break; + } + + /* * Find address for this interface, if it exists. * * If an alias address was specified, find that one instead of the @@ -295,6 +320,7 @@ break; } } + IF_ADDR_LOCK(ifp); if (ia == NULL) { TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { iap = ifatoia(ifa); @@ -311,6 +337,7 @@ if (ia == NULL) iaIsFirst = 1; + error = 0; switch (cmd) { case SIOCAIFADDR: case SIOCDIFADDR: @@ -325,31 +352,27 @@ && (cmd == SIOCAIFADDR) && (ifra->ifra_dstaddr.sin_addr.s_addr == INADDR_ANY)) { - return (EDESTADDRREQ); + error = EDESTADDRREQ; + goto out_unlock; } } - if (cmd == SIOCDIFADDR && ia == NULL) - return (EADDRNOTAVAIL); + if (cmd == SIOCDIFADDR && ia == NULL) { + error = EADDRNOTAVAIL; + goto out_unlock; + } /* FALLTHROUGH */ case SIOCSIFADDR: case SIOCSIFNETMASK: case SIOCSIFDSTADDR: - if (td != NULL) { - error = priv_check(td, (cmd == SIOCDIFADDR) ? - PRIV_NET_DELIFADDR : PRIV_NET_ADDIFADDR); - if (error) - return (error); - } - if (ia == NULL) { ia = (struct in_ifaddr *) - malloc(sizeof *ia, M_IFADDR, M_WAITOK | M_ZERO); - if (ia == NULL) - return (ENOBUFS); - /* - * Protect from ipintr() traversing address list - * while we're modifying it. - */ + malloc(sizeof *ia, M_IFADDR, M_NOWAIT | + M_ZERO); + if (ia == NULL) { + error = ENOBUFS; + goto out_unlock; + } + ifa = &ia->ia_ifa; IFA_LOCK_INIT(ifa); ifa->ifa_addr = (struct sockaddr *)&ia->ia_addr; @@ -365,9 +388,7 @@ } ia->ia_ifp = ifp; - IF_ADDR_LOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); s = splnet(); TAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link); splx(s); @@ -376,48 +397,64 @@ break; case SIOCSIFBRDADDR: - if (td != NULL) { - error = priv_check(td, PRIV_NET_ADDIFADDR); - if (error) - return (error); - } - /* FALLTHROUGH */ - case SIOCGIFADDR: case SIOCGIFNETMASK: case SIOCGIFDSTADDR: case SIOCGIFBRDADDR: - if (ia == NULL) - return (EADDRNOTAVAIL); + if (ia == NULL) { + error = EADDRNOTAVAIL; + goto out_unlock; + } break; } + >>> TRUNCATED FOR MAIL (1000 lines) <<<