Date: Wed, 15 Jul 2009 20:31:57 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 166148 for review Message-ID: <200907152031.n6FKVvpY037171@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=166148 Change 166148 by hselasky@hselasky_laptop001 on 2009/07/15 20:31:45 USB CORE: - Add minimum polling support to drive UMASS and UKBD in case of panic. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/controller/at91dci.c#27 edit .. //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.c#37 edit .. //depot/projects/usb/src/sys/dev/usb/controller/avr32dci.c#12 edit .. //depot/projects/usb/src/sys/dev/usb/controller/ehci.c#31 edit .. //depot/projects/usb/src/sys/dev/usb/controller/musb_otg.c#25 edit .. //depot/projects/usb/src/sys/dev/usb/controller/ohci.c#26 edit .. //depot/projects/usb/src/sys/dev/usb/controller/uhci.c#24 edit .. //depot/projects/usb/src/sys/dev/usb/controller/uss820dci.c#27 edit .. //depot/projects/usb/src/sys/dev/usb/usb_controller.h#17 edit .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#160 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/controller/at91dci.c#27 (text+ko) ==== @@ -2326,4 +2326,5 @@ .set_stall = &at91dci_set_stall, .clear_stall = &at91dci_clear_stall, .roothub_exec = &at91dci_roothub_exec, + .xfer_poll = &at91dci_do_poll, }; ==== //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.c#37 (text+ko) ==== @@ -2143,4 +2143,5 @@ .set_stall = &atmegadci_set_stall, .clear_stall = &atmegadci_clear_stall, .roothub_exec = &atmegadci_roothub_exec, + .xfer_poll = &atmegadci_do_poll, }; ==== //depot/projects/usb/src/sys/dev/usb/controller/avr32dci.c#12 (text+ko) ==== @@ -2081,4 +2081,5 @@ .set_stall = &avr32dci_set_stall, .clear_stall = &avr32dci_clear_stall, .roothub_exec = &avr32dci_roothub_exec, + .xfer_poll = &avr32dci_do_poll, }; ==== //depot/projects/usb/src/sys/dev/usb/controller/ehci.c#31 (text+ko) ==== @@ -3828,4 +3828,5 @@ .device_suspend = ehci_device_suspend, .set_hw_power = ehci_set_hw_power, .roothub_exec = ehci_roothub_exec, + .xfer_poll = ehci_do_poll, }; ==== //depot/projects/usb/src/sys/dev/usb/controller/musb_otg.c#25 (text+ko) ==== @@ -2736,4 +2736,5 @@ .set_stall = &musbotg_set_stall, .clear_stall = &musbotg_clear_stall, .roothub_exec = &musbotg_roothub_exec, + .xfer_poll = &musbotg_do_poll, }; ==== //depot/projects/usb/src/sys/dev/usb/controller/ohci.c#26 (text+ko) ==== @@ -2756,4 +2756,5 @@ .device_suspend = ohci_device_suspend, .set_hw_power = ohci_set_hw_power, .roothub_exec = ohci_roothub_exec, + .xfer_poll = ohci_do_poll, }; ==== //depot/projects/usb/src/sys/dev/usb/controller/uhci.c#24 (text+ko) ==== @@ -3251,4 +3251,5 @@ .device_suspend = uhci_device_suspend, .set_hw_power = uhci_set_hw_power, .roothub_exec = uhci_roothub_exec, + .xfer_poll = uhci_do_poll, }; ==== //depot/projects/usb/src/sys/dev/usb/controller/uss820dci.c#27 (text+ko) ==== @@ -2360,4 +2360,5 @@ .set_stall = &uss820dci_set_stall, .clear_stall = &uss820dci_clear_stall, .roothub_exec = &uss820dci_roothub_exec, + .xfer_poll = &uss820dci_do_poll, }; ==== //depot/projects/usb/src/sys/dev/usb/usb_controller.h#17 (text+ko) ==== @@ -99,6 +99,9 @@ void (*set_stall) (struct usb_device *udev, struct usb_xfer *xfer, struct usb_endpoint *ep, uint8_t *did_stall); void (*clear_stall) (struct usb_device *udev, struct usb_endpoint *ep); + /* Optional transfer polling support */ + + void (*xfer_poll) (struct usb_bus *); }; /* ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#160 (text+ko) ==== @@ -2853,15 +2853,56 @@ return (1); /* Clear Stall Finished */ } +/*------------------------------------------------------------------------* + * usbd_transfer_poll + * + * The following function gets called from the USB keyboard driver and + * UMASS when the system has paniced. + *------------------------------------------------------------------------*/ void usbd_transfer_poll(struct usb_xfer **ppxfer, uint16_t max) { - static uint8_t once = 0; - /* polling is currently not supported */ - if (!once) { - once = 1; - printf("usbd_transfer_poll: USB polling is " - "not supported!\n"); + struct usb_xfer *xfer; + struct usb_xfer_root *xroot; + struct usb_device *udev; + struct usb_proc_msg *pm; + uint16_t n; + + for (n = 0; n != max; n++) { + xfer = ppxfer[n]; + if (xfer == NULL) + continue; + xroot = xfer->xroot; + if (xroot == NULL) + continue; + udev = xroot->udev; + if (udev == NULL) + continue; + if (udev->bus->methods->xfer_poll == NULL) + continue; + + /* poll USB hardware */ + (udev->bus->methods->xfer_poll) (udev->bus); + + USB_BUS_LOCK(xroot->bus); + + /* check for clear stall */ + if (udev->default_xfer[1] != NULL) { + + /* poll clear stall start */ + pm = &udev->cs_msg[0].hdr; + (pm->pm_callback) (pm); + /* poll clear stall done thread */ + pm = &udev->default_xfer[1]-> + xroot->done_m[0].hdr; + (pm->pm_callback) (pm); + } + + /* poll done thread */ + pm = &xroot->done_m[0].hdr; + (pm->pm_callback) (pm); + + USB_BUS_UNLOCK(xroot->bus); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907152031.n6FKVvpY037171>