Date: Sun, 26 Apr 2009 07:32:11 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 161097 for review Message-ID: <200904260732.n3Q7WBD9025923@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=161097 Change 161097 by zec@zec_amdx2 on 2009/04/26 07:32:02 IFC @ 161094 Affected files ... .. //depot/projects/vimage/src/share/man/man4/pts.4#2 integrate .. //depot/projects/vimage/src/share/man/man5/rc.conf.5#6 integrate .. //depot/projects/vimage/src/sys/conf/files.powerpc#21 integrate .. //depot/projects/vimage/src/sys/dev/ed/if_ed_pccard.c#11 integrate .. //depot/projects/vimage/src/sys/dev/pccard/pccarddevs#15 integrate .. //depot/projects/vimage/src/sys/dev/usb/controller/ehci.c#8 integrate .. //depot/projects/vimage/src/sys/dev/usb/controller/ohci.c#7 integrate .. //depot/projects/vimage/src/sys/dev/usb/controller/uhci.c#7 integrate .. //depot/projects/vimage/src/sys/dev/usb/usb_core.h#9 integrate .. //depot/projects/vimage/src/sys/dev/usb/usb_device.c#9 integrate .. //depot/projects/vimage/src/sys/dev/usb/usb_device.h#8 integrate .. //depot/projects/vimage/src/sys/dev/usb/usb_generic.c#7 integrate .. //depot/projects/vimage/src/sys/dev/usb/usb_hub.c#9 integrate .. //depot/projects/vimage/src/sys/dev/usb/usb_request.c#7 integrate .. //depot/projects/vimage/src/sys/dev/usb/usb_revision.h#3 integrate .. //depot/projects/vimage/src/sys/dev/usb/usb_transfer.c#7 integrate .. //depot/projects/vimage/src/sys/ia64/isa/isa.c#3 integrate .. //depot/projects/vimage/src/sys/kern/kern_vimage.c#80 integrate .. //depot/projects/vimage/src/sys/kern/tty_pts.c#14 integrate .. //depot/projects/vimage/src/sys/netgraph/netgraph.h#20 integrate .. //depot/projects/vimage/src/sys/netgraph/ng_base.c#55 integrate .. //depot/projects/vimage/src/sys/netgraph/ng_eiface.c#26 integrate .. //depot/projects/vimage/src/sys/netgraph/ng_ether.c#23 integrate .. //depot/projects/vimage/src/sys/netgraph/ng_iface.c#23 integrate .. //depot/projects/vimage/src/sys/netinet/in.c#32 integrate .. //depot/projects/vimage/src/sys/powerpc/aim/machdep.c#11 integrate .. //depot/projects/vimage/src/sys/powerpc/booke/pmap.c#9 integrate .. //depot/projects/vimage/src/sys/powerpc/conf/MPC85XX#5 integrate .. //depot/projects/vimage/src/sys/powerpc/include/intr_machdep.h#7 integrate .. //depot/projects/vimage/src/sys/powerpc/include/pte.h#5 integrate .. //depot/projects/vimage/src/sys/powerpc/mpc85xx/atpic.c#1 branch .. //depot/projects/vimage/src/sys/powerpc/mpc85xx/isa.c#1 branch .. //depot/projects/vimage/src/sys/powerpc/mpc85xx/ocpbus.c#5 integrate .. //depot/projects/vimage/src/sys/powerpc/mpc85xx/pci_ocp.c#2 integrate .. //depot/projects/vimage/src/sys/powerpc/powerpc/autoconf.c#5 integrate .. //depot/projects/vimage/src/sys/powerpc/powerpc/bus_machdep.c#3 integrate .. //depot/projects/vimage/src/sys/powerpc/powerpc/intr_machdep.c#13 integrate .. //depot/projects/vimage/src/sys/sys/vimage.h#88 integrate .. //depot/projects/vimage/src/sys/vm/swap_pager.c#17 integrate .. //depot/projects/vimage/src/sys/vm/vnode_pager.c#13 integrate Differences ... ==== //depot/projects/vimage/src/share/man/man4/pts.4#2 (text+ko) ==== @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)pty.4 8.2 (Berkeley) 11/30/93 -.\" $FreeBSD: src/share/man/man4/pts.4,v 1.2 2008/09/04 16:39:02 ed Exp $ +.\" $FreeBSD: src/share/man/man4/pts.4,v 1.3 2009/04/25 10:05:55 ed Exp $ .\" .Dd August 20, 2008 .Dt PTS 4 @@ -156,6 +156,26 @@ .It Pa /dev/pts/[num] Pseudo-terminal slave devices. .El +.Sh SYSCTL VARIABLES +The following +.Xr sysctl 8 +variables can be used to modify or monitor +.Nm +behavior. +.Bl -tag -width indent +.It Va kern.pts_maxdev +Highest pseudo-terminal unit number to be allocated. +Because +.Xr utmp 5 +is restricted to an 8-byte line name size, +.Nm +will not create any pseudo-terminals with a unit number above 999 by +default. +After increasing +.Dv UT_LINESIZE , +this variable can be changed to allow more than 1000 pseudo-terminals to +be allocated simultaneously. +.El .Sh DIAGNOSTICS None. .Sh SEE ALSO ==== //depot/projects/vimage/src/share/man/man5/rc.conf.5#6 (text+ko) ==== @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man5/rc.conf.5,v 1.357 2009/03/13 07:12:25 brooks Exp $ +.\" $FreeBSD: src/share/man/man5/rc.conf.5,v 1.358 2009/04/24 06:44:58 maxim Exp $ .\" .Dd January 27, 2009 .Dt RC.CONF 5 @@ -1503,7 +1503,7 @@ .Xr geli 8 utility when encrypted GEOM providers for swap partitions are created. The default is -.Dq Li "-a aes -l 256 -s 4096 -d" . +.Dq Li "-e aes -l 256 -s 4096 -d" . .It Va root_rw_mount .Pq Vt bool Set to ==== //depot/projects/vimage/src/sys/conf/files.powerpc#21 (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/src/sys/dev/ed/if_ed_pccard.c#11 (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/src/sys/dev/pccard/pccarddevs#15 (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/src/sys/dev/usb/controller/ehci.c#8 (text+ko) ==== @@ -44,7 +44,7 @@ */ #include <sys/cdefs.h> -__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 <dev/usb/usb.h> #include <dev/usb/usb_mfunc.h> @@ -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/src/sys/dev/usb/controller/ohci.c#7 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__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/src/sys/dev/usb/controller/uhci.c#7 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__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/src/sys/dev/usb/usb_core.h#9 (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/src/sys/dev/usb/usb_device.c#9 (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/src/sys/dev/usb/usb_device.h#8 (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/src/sys/dev/usb/usb_generic.c#7 (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/src/sys/dev/usb/usb_hub.c#9 (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/src/sys/dev/usb/usb_request.c#7 (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/src/sys/dev/usb/usb_revision.h#3 (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/src/sys/dev/usb/usb_transfer.c#7 (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/src/sys/ia64/isa/isa.c#3 (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/src/sys/kern/kern_vimage.c#80 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__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 "opt_ddb.h" @@ -221,6 +221,7 @@ void vnet_mod_deregister(const struct vnet_modinfo *vmi) { + vnet_mod_deregister_multi(vmi, NULL, NULL); } @@ -258,8 +259,10 @@ if (vml->vml_iarg) printf("/%s", vml->vml_iname); printf(": "); +#ifdef VIMAGE if (vmi->vmi_size) printf("malloc(%zu); ", vmi->vmi_size); +#endif if (vmi->vmi_iattach != NULL) printf("iattach()"); printf("\n"); ==== //depot/projects/vimage/src/sys/kern/tty_pts.c#14 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__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 <sys/filedesc.h> #include <sys/filio.h> #include <sys/kernel.h> +#include <sys/limits.h> #include <sys/malloc.h> #include <sys/poll.h> #include <sys/proc.h> @@ -58,6 +59,7 @@ #include <sys/stat.h> #include <sys/syscall.h> #include <sys/syscallsubr.h> +#include <sys/sysctl.h> #include <sys/sysent.h> #include <sys/sysproto.h> #include <sys/systm.h> @@ -66,8 +68,16 @@ #include <machine/stdarg.h> +/* + * 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/src/sys/netgraph/netgraph.h#20 (text+ko) ==== @@ -37,7 +37,7 @@ * * Author: Julian Elischer <julian@freebsd.org> * - * $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/src/sys/netgraph/ng_base.c#55 (text+ko) ==== @@ -38,7 +38,7 @@ * Authors: Julian Elischer <julian@freebsd.org> * Archie Cobbs <archie@freebsd.org> * - * $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 $ */ @@ -84,6 +84,8 @@ /* Mutex to protect topology events. */ static struct mtx ng_topo_mtx; +static vnet_attach_fn vnet_netgraph_iattach; + #ifdef NETGRAPH_DEBUG static struct mtx ng_nodelist_mtx; /* protects global node/hook lists */ static struct mtx ngq_mtx; /* protects the queue item list */ @@ -3088,6 +3090,27 @@ return (error); } +#ifndef VIMAGE_GLOBALS +static const vnet_modinfo_t vnet_netgraph_modinfo = { + .vmi_id = VNET_MOD_NETGRAPH, + .vmi_name = "netgraph", +#ifdef VIMAGE + .vmi_size = sizeof(struct vnet_netgraph), +#endif + .vmi_iattach = vnet_netgraph_iattach +}; +#endif + +static int +vnet_netgraph_iattach(const void *arg __unused) +{ + INIT_VNET_NETGRAPH(curvnet); + + V_nextID = 1; + + return (0); +} + /* * Handle loading and unloading for this code. * The only thing we need to link into is the NETISR strucure. @@ -3106,7 +3129,7 @@ vnet_mod_register(&vnet_netgraph_modinfo); #else vnet_netgraph_iattach(NULL); -#endif /* !VIMAGE */ +#endif NG_WORKLIST_LOCK_INIT(); mtx_init(&ng_typelist_mtx, "netgraph types mutex", NULL, MTX_DEF); ==== //depot/projects/vimage/src/sys/netgraph/ng_eiface.c#26 (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 <sys/param.h> @@ -126,7 +126,7 @@ .vmi_name = "ng_eiface", .vmi_dependson = VNET_MOD_NETGRAPH, .vmi_iattach = ng_eiface_iattach, - .vmi_idetach = ng_eiface_idetach, + .vmi_idetach = ng_eiface_idetach }; #endif @@ -641,7 +641,7 @@ V_ng_eiface_unit = new_unrhdr(0, 0xffff, NULL); - return 0; + return (0); } static int ng_eiface_idetach(const void *unused) @@ -661,5 +661,5 @@ delete_unrhdr(V_ng_eiface_unit); - return 0; + return (0); } ==== //depot/projects/vimage/src/sys/netgraph/ng_ether.c#23 (text+ko) ==== @@ -39,7 +39,7 @@ * Authors: Archie Cobbs <archie@freebsd.org> * Julian Elischer <julian@freebsd.org> * - * $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 $ */ /* @@ -301,8 +301,9 @@ /* * Do not create / attach an ether node to this ifnet if * a netgraph node with the same name already exists. - * This should prevent ether nodes to be attached to - * eiface nodes in the same vnet, which is pointless. + * This should prevent ether nodes to become attached to + * eiface nodes, which may be problematic due to naming + * clashes. */ if ((node = ng_name2noderef(NULL, ifp->if_xname)) != NULL) { NG_NODE_UNREF(node); @@ -798,7 +799,7 @@ * is MOD_UNLOAD, so there's no need to detach any nodes. */ >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904260732.n3Q7WBD9025923>