svn commit: r229100 - stable/9/sys/dev/usb/controller
Hans Petter Selasky
hselasky at FreeBSD.org
Sat Dec 31 14:33:16 UTC 2011
Author: hselasky
Date: Sat Dec 31 14:33:15 2011
New Revision: 229100
URL: http://svn.freebsd.org/changeset/base/229100
Log:
MFC r228709, r228711 and r228723:
- Add missing unlock of USB controller's lock, when
doing shutdown, suspend and resume.
- Add code to wait for USB shutdown to be executed at system shutdown.
- Add sysctl which can be used to skip this waiting.
Modified:
stable/9/sys/dev/usb/controller/usb_controller.c
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/amd64/include/xen/ (props changed)
stable/9/sys/boot/ (props changed)
stable/9/sys/boot/i386/efi/ (props changed)
stable/9/sys/boot/ia64/efi/ (props changed)
stable/9/sys/boot/ia64/ski/ (props changed)
stable/9/sys/boot/powerpc/boot1.chrp/ (props changed)
stable/9/sys/boot/powerpc/ofw/ (props changed)
stable/9/sys/cddl/contrib/opensolaris/ (props changed)
stable/9/sys/conf/ (props changed)
stable/9/sys/contrib/dev/acpica/ (props changed)
stable/9/sys/contrib/octeon-sdk/ (props changed)
stable/9/sys/contrib/pf/ (props changed)
stable/9/sys/contrib/x86emu/ (props changed)
Modified: stable/9/sys/dev/usb/controller/usb_controller.c
==============================================================================
--- stable/9/sys/dev/usb/controller/usb_controller.c Sat Dec 31 14:29:01 2011 (r229099)
+++ stable/9/sys/dev/usb/controller/usb_controller.c Sat Dec 31 14:33:15 2011 (r229100)
@@ -87,7 +87,12 @@ SYSCTL_INT(_hw_usb_ctrl, OID_AUTO, debug
static int usb_no_boot_wait = 0;
TUNABLE_INT("hw.usb.no_boot_wait", &usb_no_boot_wait);
SYSCTL_INT(_hw_usb, OID_AUTO, no_boot_wait, CTLFLAG_RDTUN, &usb_no_boot_wait, 0,
- "No device enumerate waiting at boot.");
+ "No USB device enumerate waiting at boot.");
+
+static int usb_no_shutdown_wait = 0;
+TUNABLE_INT("hw.usb.no_shutdown_wait", &usb_no_shutdown_wait);
+SYSCTL_INT(_hw_usb, OID_AUTO, no_shutdown_wait, CTLFLAG_RW|CTLFLAG_TUN, &usb_no_shutdown_wait, 0,
+ "No USB device waiting at system shutdown.");
static devclass_t usb_devclass;
@@ -277,11 +282,20 @@ usb_shutdown(device_t dev)
return (0);
}
+ device_printf(bus->bdev, "Controller shutdown\n");
+
USB_BUS_LOCK(bus);
usb_proc_msignal(&bus->explore_proc,
&bus->shutdown_msg[0], &bus->shutdown_msg[1]);
+ if (usb_no_shutdown_wait == 0) {
+ /* wait for shutdown callback to be executed */
+ usb_proc_mwait(&bus->explore_proc,
+ &bus->shutdown_msg[0], &bus->shutdown_msg[1]);
+ }
USB_BUS_UNLOCK(bus);
+ device_printf(bus->bdev, "Controller shutdown complete\n");
+
return (0);
}
@@ -390,6 +404,8 @@ usb_bus_suspend(struct usb_proc_msg *pm)
if (udev == NULL || bus->bdev == NULL)
return;
+ USB_BUS_UNLOCK(bus);
+
bus_generic_shutdown(bus->bdev);
usbd_enum_lock(udev);
@@ -410,6 +426,8 @@ usb_bus_suspend(struct usb_proc_msg *pm)
(bus->methods->set_hw_power_sleep) (bus, USB_HW_POWER_SUSPEND);
usbd_enum_unlock(udev);
+
+ USB_BUS_LOCK(bus);
}
/*------------------------------------------------------------------------*
@@ -430,6 +448,8 @@ usb_bus_resume(struct usb_proc_msg *pm)
if (udev == NULL || bus->bdev == NULL)
return;
+ USB_BUS_UNLOCK(bus);
+
usbd_enum_lock(udev);
#if 0
DEVMETHOD(usb_take_controller, NULL); /* dummy */
@@ -457,6 +477,8 @@ usb_bus_resume(struct usb_proc_msg *pm)
device_printf(bus->bdev, "Could not configure root HUB\n");
usbd_enum_unlock(udev);
+
+ USB_BUS_LOCK(bus);
}
/*------------------------------------------------------------------------*
@@ -477,6 +499,8 @@ usb_bus_shutdown(struct usb_proc_msg *pm
if (udev == NULL || bus->bdev == NULL)
return;
+ USB_BUS_UNLOCK(bus);
+
bus_generic_shutdown(bus->bdev);
usbd_enum_lock(udev);
@@ -497,6 +521,8 @@ usb_bus_shutdown(struct usb_proc_msg *pm
(bus->methods->set_hw_power_sleep) (bus, USB_HW_POWER_SHUTDOWN);
usbd_enum_unlock(udev);
+
+ USB_BUS_LOCK(bus);
}
static void
More information about the svn-src-stable-9
mailing list