From owner-p4-projects@FreeBSD.ORG Thu Jan 8 21:06:10 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9B0EB1065672; Thu, 8 Jan 2009 21:06:10 +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 54EFF106564A for ; Thu, 8 Jan 2009 21:06:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 415D48FC0A for ; Thu, 8 Jan 2009 21:06:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n08L6AhF093924 for ; Thu, 8 Jan 2009 21:06:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n08L6ANa093922 for perforce@freebsd.org; Thu, 8 Jan 2009 21:06:10 GMT (envelope-from hselasky@FreeBSD.org) Date: Thu, 8 Jan 2009 21:06:10 GMT Message-Id: <200901082106.n08L6ANa093922@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 155834 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: Thu, 08 Jan 2009 21:06:11 -0000 http://perforce.freebsd.org/chv.cgi?CH=155834 Change 155834 by hselasky@hselasky_laptop001 on 2009/01/08 21:05:55 Factor out roothub process into the USB bus structure for all USB controller drivers. Essentially I am trying to save some processes on the root HUB and get away from the config thread pradigm. There will be a follow up commit where the root HUB control and interrupt callback will be moved over to run from the roothub process. Total win: 3 processes become 1 for every USB controller. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/controller/at91dci.c#20 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/at91dci.h#7 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/at91dci_atmelarm.c#16 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.c#26 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.h#12 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/ehci2_pci.c#19 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg.c#21 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg.h#11 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg_atmelarm.c#13 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/ohci2.c#23 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/ohci2.h#8 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/ohci2_atmelarm.c#15 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/ohci2_pci.c#16 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.c#20 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.h#10 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/uhci2_pci.c#17 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/usb2_bus.h#11 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/usb2_controller.c#22 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/usb2_controller.h#8 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/usb2_pci.h#5 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/uss820dci.c#18 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/uss820dci.h#7 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/uss820dci_atmelarm.c#8 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/controller/at91dci.c#20 (text+ko) ==== @@ -50,14 +50,11 @@ #include #define USB_DEBUG_VAR at91dcidebug -#define usb2_config_td_cc at91dci_config_copy -#define usb2_config_td_softc at91dci_softc #include #include #include #include -#include #include #include #include @@ -106,7 +103,6 @@ static usb2_sw_transfer_func_t at91dci_root_intr_done; static usb2_sw_transfer_func_t at91dci_root_ctrl_done; -static usb2_config_td_command_t at91dci_root_ctrl_task; /* * NOTE: Some of the bits in the CSR register have inverse meaning so @@ -1817,15 +1813,13 @@ sc->sc_root_ctrl.xfer = xfer; - usb2_config_td_queue_command( - &sc->sc_config_td, NULL, &at91dci_root_ctrl_task, 0, 0); + usb2_bus_roothub_exec(xfer->udev->bus); } static void -at91dci_root_ctrl_task(struct at91dci_softc *sc, - struct at91dci_config_copy *cc, uint16_t refcount) +at91dci_root_ctrl_task(struct usb2_bus *bus) { - at91dci_root_ctrl_poll(sc); + at91dci_root_ctrl_poll(AT9100_DCI_BUS2SC(bus)); } static void @@ -2478,4 +2472,5 @@ .set_stall = &at91dci_set_stall, .clear_stall = &at91dci_clear_stall, .vbus_interrupt = &at91dci_vbus_interrupt, + .roothub_exec = &at91dci_root_ctrl_task, }; ==== //depot/projects/usb/src/sys/dev/usb2/controller/at91dci.h#7 (text+ko) ==== @@ -206,7 +206,6 @@ LIST_HEAD(, usb2_xfer) sc_interrupt_list_head; struct usb2_sw_transfer sc_root_ctrl; struct usb2_sw_transfer sc_root_intr; - struct usb2_config_td sc_config_td; struct usb2_device *sc_devices[AT91_MAX_DEVICES]; struct resource *sc_io_res; ==== //depot/projects/usb/src/sys/dev/usb2/controller/at91dci_atmelarm.c#16 (text+ko) ==== @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -208,12 +207,6 @@ } device_set_ivars(sc->sc_dci.sc_bus.bdev, &sc->sc_dci.sc_bus); - err = usb2_config_td_setup(&sc->sc_dci.sc_config_td, sc, - &sc->sc_dci.sc_bus.bus_mtx, NULL, 0, 4); - if (err) { - device_printf(dev, "could not setup config thread!\n"); - goto error; - } #if (__FreeBSD_version >= 700031) err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, NULL, (void *)at91dci_interrupt, sc, &sc->sc_dci.sc_intr_hdl); @@ -308,8 +301,6 @@ sc->sc_dci.sc_io_res); sc->sc_dci.sc_io_res = NULL; } - usb2_config_td_unsetup(&sc->sc_dci.sc_config_td); - usb2_bus_mem_free_all(&sc->sc_dci.sc_bus, NULL); /* disable clocks */ ==== //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.c#26 (text+ko) ==== @@ -52,14 +52,11 @@ #include #define USB_DEBUG_VAR ehcidebug -#define usb2_config_td_cc ehci_config_copy -#define usb2_config_td_softc ehci_softc #include #include #include #include -#include #include #include #include @@ -99,7 +96,6 @@ extern struct usb2_pipe_methods ehci_root_ctrl_methods; extern struct usb2_pipe_methods ehci_root_intr_methods; -static usb2_config_td_command_t ehci_root_ctrl_task; static void ehci_do_poll(struct usb2_bus *bus); static void ehci_root_ctrl_poll(ehci_softc_t *sc); static void ehci_device_done(struct usb2_xfer *xfer, usb2_error_t error); @@ -3031,15 +3027,13 @@ sc->sc_root_ctrl.xfer = xfer; - usb2_config_td_queue_command - (&sc->sc_config_td, NULL, &ehci_root_ctrl_task, 0, 0); + usb2_bus_roothub_exec(xfer->udev->bus); } static void -ehci_root_ctrl_task(ehci_softc_t *sc, - struct usb2_config_td_cc *cc, uint16_t refcount) +ehci_root_ctrl_task(struct usb2_bus *bus) { - ehci_root_ctrl_poll(sc); + ehci_root_ctrl_poll(EHCI_BUS2SC(bus)); } static void @@ -3969,4 +3963,5 @@ .device_resume = ehci_device_resume, .device_suspend = ehci_device_suspend, .set_hw_power = ehci_set_hw_power, + .roothub_exec = ehci_root_ctrl_task, }; ==== //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.h#12 (text+ko) ==== @@ -455,7 +455,6 @@ typedef struct ehci_softc { struct ehci_hw_softc sc_hw; struct usb2_bus sc_bus; /* base device */ - struct usb2_config_td sc_config_td; struct usb2_callout sc_tmo_pcd; union ehci_hub_desc sc_hub_desc; struct usb2_sw_transfer sc_root_ctrl; ==== //depot/projects/usb/src/sys/dev/usb2/controller/ehci2_pci.c#19 (text+ko) ==== @@ -59,7 +59,6 @@ #include #include #include -#include #include #include @@ -341,12 +340,6 @@ sprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self)); } - err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.bus_mtx, - NULL, 0, 4); - if (err) { - device_printf(self, "could not setup config thread!\n"); - goto error; - } #if (__FreeBSD_version >= 700031) err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, NULL, (void *)(void *)ehci_interrupt, sc, &sc->sc_intr_hdl); @@ -381,8 +374,6 @@ ehci_softc_t *sc = device_get_softc(self); device_t bdev; - usb2_config_td_drain(&sc->sc_config_td); - if (sc->sc_bus.bdev) { bdev = sc->sc_bus.bdev; device_detach(bdev); @@ -422,8 +413,6 @@ sc->sc_io_res); sc->sc_io_res = NULL; } - usb2_config_td_unsetup(&sc->sc_config_td); - usb2_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc); return (0); ==== //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg.c#21 (text+ko) ==== @@ -42,14 +42,11 @@ #include #define USB_DEBUG_VAR musbotgdebug -#define usb2_config_td_cc musbotg_config_copy -#define usb2_config_td_softc musbotg_softc #include #include #include #include -#include #include #include #include @@ -101,7 +98,6 @@ static usb2_sw_transfer_func_t musbotg_root_intr_done; static usb2_sw_transfer_func_t musbotg_root_ctrl_done; -static usb2_config_td_command_t musbotg_root_ctrl_task; /* * Here is a configuration that the chip supports. @@ -2222,15 +2218,13 @@ sc->sc_root_ctrl.xfer = xfer; - usb2_config_td_queue_command( - &sc->sc_config_td, NULL, &musbotg_root_ctrl_task, 0, 0); + usb2_bus_roothub_exec(xfer->udev->bus); } static void -musbotg_root_ctrl_task(struct musbotg_softc *sc, - struct musbotg_config_copy *cc, uint16_t refcount) +musbotg_root_ctrl_task(struct usb2_bus *bus) { - musbotg_root_ctrl_poll(sc); + musbotg_root_ctrl_poll(MUSBOTG_BUS2SC(bus)); } static void @@ -2885,4 +2879,5 @@ .set_stall = &musbotg_set_stall, .clear_stall = &musbotg_clear_stall, .vbus_interrupt = &musbotg_vbus_interrupt, + .roothub_exec = &musbotg_root_ctrl_task, }; ==== //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg.h#11 (text+ko) ==== @@ -365,7 +365,6 @@ union musbotg_hub_temp sc_hub_temp; struct usb2_sw_transfer sc_root_ctrl; struct usb2_sw_transfer sc_root_intr; - struct usb2_config_td sc_config_td; struct usb2_hw_ep_profile sc_hw_ep_profile[16]; struct usb2_device *sc_devices[MUSB2_MAX_DEVICES]; ==== //depot/projects/usb/src/sys/dev/usb2/controller/musb2_otg_atmelarm.c#13 (text+ko) ==== @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -136,12 +135,6 @@ } device_set_ivars(sc->sc_otg.sc_bus.bdev, &sc->sc_otg.sc_bus); - err = usb2_config_td_setup(&sc->sc_otg.sc_config_td, sc, - &sc->sc_otg.sc_bus.bus_mtx, NULL, 0, 4); - if (err) { - device_printf(dev, "could not setup config thread!\n"); - goto error; - } #if (__FreeBSD_version >= 700031) err = bus_setup_intr(dev, sc->sc_otg.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, NULL, (void *)musbotg_interrupt, sc, &sc->sc_otg.sc_intr_hdl); @@ -207,8 +200,6 @@ sc->sc_otg.sc_io_res); sc->sc_otg.sc_io_res = NULL; } - usb2_config_td_unsetup(&sc->sc_otg.sc_config_td); - usb2_bus_mem_free_all(&sc->sc_otg.sc_bus, NULL); return (0); ==== //depot/projects/usb/src/sys/dev/usb2/controller/ohci2.c#23 (text+ko) ==== @@ -41,14 +41,11 @@ #include #define USB_DEBUG_VAR ohcidebug -#define usb2_config_td_cc ohci_config_copy -#define usb2_config_td_softc ohci_softc #include #include #include #include -#include #include #include #include @@ -99,7 +96,6 @@ extern struct usb2_pipe_methods ohci_root_ctrl_methods; extern struct usb2_pipe_methods ohci_root_intr_methods; -static usb2_config_td_command_t ohci_root_ctrl_task; static void ohci_root_ctrl_poll(struct ohci_softc *sc); static void ohci_do_poll(struct usb2_bus *bus); static void ohci_device_done(struct usb2_xfer *xfer, usb2_error_t error); @@ -2135,15 +2131,13 @@ sc->sc_root_ctrl.xfer = xfer; - usb2_config_td_queue_command - (&sc->sc_config_td, NULL, &ohci_root_ctrl_task, 0, 0); + usb2_bus_roothub_exec(xfer->udev->bus); } static void -ohci_root_ctrl_task(struct ohci_softc *sc, - struct ohci_config_copy *cc, uint16_t refcount) +ohci_root_ctrl_task(struct usb2_bus *bus) { - ohci_root_ctrl_poll(sc); + ohci_root_ctrl_poll(OHCI_BUS2SC(bus)); } static void @@ -2864,4 +2858,5 @@ .device_resume = ohci_device_resume, .device_suspend = ohci_device_suspend, .set_hw_power = ohci_set_hw_power, + .roothub_exec = ohci_root_ctrl_task, }; ==== //depot/projects/usb/src/sys/dev/usb2/controller/ohci2.h#8 (text+ko) ==== @@ -320,7 +320,6 @@ typedef struct ohci_softc { struct ohci_hw_softc sc_hw; struct usb2_bus sc_bus; /* base device */ - struct usb2_config_td sc_config_td; struct usb2_callout sc_tmo_rhsc; union ohci_hub_desc sc_hub_desc; struct usb2_sw_transfer sc_root_ctrl; ==== //depot/projects/usb/src/sys/dev/usb2/controller/ohci2_atmelarm.c#15 (text) ==== @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -114,12 +113,6 @@ strlcpy(sc->sc_ohci.sc_vendor, "Atmel", sizeof(sc->sc_ohci.sc_vendor)); - err = usb2_config_td_setup(&sc->sc_ohci.sc_config_td, sc, - &sc->sc_ohci.sc_bus.bus_mtx, NULL, 0, 4); - if (err) { - device_printf(dev, "could not setup config thread!\n"); - goto error; - } #if (__FreeBSD_version >= 700031) err = bus_setup_intr(dev, sc->sc_ohci.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, NULL, (void *)ohci_interrupt, sc, &sc->sc_ohci.sc_intr_hdl); @@ -203,8 +196,6 @@ sc->sc_ohci.sc_io_res); sc->sc_ohci.sc_io_res = NULL; } - usb2_config_td_unsetup(&sc->sc_ohci.sc_config_td); - usb2_bus_mem_free_all(&sc->sc_ohci.sc_bus, &ohci_iterate_hw_softc); return (0); ==== //depot/projects/usb/src/sys/dev/usb2/controller/ohci2_pci.c#16 (text+ko) ==== @@ -57,7 +57,6 @@ #include #include #include -#include #include #include @@ -291,12 +290,6 @@ sprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self)); } - err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.bus_mtx, - NULL, 0, 4); - if (err) { - device_printf(self, "could not setup config thread!\n"); - goto error; - } /* sc->sc_bus.usbrev; set by ohci_init() */ #if (__FreeBSD_version >= 700031) @@ -332,8 +325,6 @@ ohci_softc_t *sc = device_get_softc(self); device_t bdev; - usb2_config_td_drain(&sc->sc_config_td); - if (sc->sc_bus.bdev) { bdev = sc->sc_bus.bdev; device_detach(bdev); @@ -368,8 +359,6 @@ sc->sc_io_res); sc->sc_io_res = NULL; } - usb2_config_td_unsetup(&sc->sc_config_td); - usb2_bus_mem_free_all(&sc->sc_bus, &ohci_iterate_hw_softc); return (0); ==== //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.c#20 (text+ko) ==== @@ -44,14 +44,11 @@ #include #define USB_DEBUG_VAR uhcidebug -#define usb2_config_td_cc uhci_config_copy -#define usb2_config_td_softc uhci_softc #include #include #include #include -#include #include #include #include @@ -138,7 +135,6 @@ extern struct usb2_pipe_methods uhci_root_ctrl_methods; extern struct usb2_pipe_methods uhci_root_intr_methods; -static usb2_config_td_command_t uhci_root_ctrl_task; static void uhci_root_ctrl_poll(struct uhci_softc *); static void uhci_do_poll(struct usb2_bus *); static void uhci_device_done(struct usb2_xfer *, usb2_error_t); @@ -2502,15 +2498,13 @@ sc->sc_root_ctrl.xfer = xfer; - usb2_config_td_queue_command - (&sc->sc_config_td, NULL, &uhci_root_ctrl_task, 0, 0); + usb2_bus_roothub_exec(xfer->udev->bus); } static void -uhci_root_ctrl_task(struct uhci_softc *sc, - struct uhci_config_copy *cc, uint16_t refcount) +uhci_root_ctrl_task(struct usb2_bus *bus) { - uhci_root_ctrl_poll(sc); + uhci_root_ctrl_poll(UHCI_BUS2SC(bus)); } static void @@ -3361,4 +3355,5 @@ .device_resume = uhci_device_resume, .device_suspend = uhci_device_suspend, .set_hw_power = uhci_set_hw_power, + .roothub_exec = uhci_root_ctrl_task, }; ==== //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.h#10 (text+ko) ==== @@ -270,7 +270,6 @@ typedef struct uhci_softc { struct uhci_hw_softc sc_hw; struct usb2_bus sc_bus; /* base device */ - struct usb2_config_td sc_config_td; union uhci_hub_desc sc_hub_desc; struct usb2_sw_transfer sc_root_ctrl; struct usb2_sw_transfer sc_root_intr; ==== //depot/projects/usb/src/sys/dev/usb2/controller/uhci2_pci.c#17 (text+ko) ==== @@ -55,7 +55,6 @@ #include #include #include -#include #include #include #include @@ -325,12 +324,6 @@ break; } - err = usb2_config_td_setup(&sc->sc_config_td, sc, &sc->sc_bus.bus_mtx, - NULL, 0, 4); - if (err) { - device_printf(self, "could not setup config thread!\n"); - goto error; - } #if (__FreeBSD_version >= 700031) err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, NULL, (void *)(void *)uhci_interrupt, sc, &sc->sc_intr_hdl); @@ -379,8 +372,6 @@ uhci_softc_t *sc = device_get_softc(self); device_t bdev; - usb2_config_td_drain(&sc->sc_config_td); - if (sc->sc_bus.bdev) { bdev = sc->sc_bus.bdev; device_detach(bdev); @@ -422,8 +413,6 @@ sc->sc_io_res); sc->sc_io_res = NULL; } - usb2_config_td_unsetup(&sc->sc_config_td); - usb2_bus_mem_free_all(&sc->sc_bus, &uhci_iterate_hw_softc); return (0); ==== //depot/projects/usb/src/sys/dev/usb2/controller/usb2_bus.h#11 (text+ko) ==== @@ -52,9 +52,11 @@ struct usb2_bus_stat stats_err; struct usb2_bus_stat stats_ok; struct usb2_process explore_proc; + struct usb2_process roothub_proc; struct usb2_bus_msg explore_msg[2]; struct usb2_bus_msg detach_msg[2]; struct usb2_bus_msg attach_msg[2]; + struct usb2_bus_msg roothub_msg[2]; /* * This mutex protects the USB hardware: */ ==== //depot/projects/usb/src/sys/dev/usb2/controller/usb2_controller.c#22 (text+ko) ==== @@ -59,6 +59,7 @@ static void usb2_bus_mem_free_all_cb(struct usb2_bus *, struct usb2_page_cache *, struct usb2_page *, uint32_t, uint32_t); +static void usb2_bus_roothub(struct usb2_proc_msg *pm); /* static variables */ @@ -165,6 +166,10 @@ USB_BUS_UNLOCK(bus); + /* Get rid of USB roothub process */ + + usb2_proc_unsetup(&bus->roothub_proc); + /* Get rid of USB explore process */ usb2_proc_unsetup(&bus->explore_proc); @@ -381,10 +386,20 @@ bus->attach_msg[1].hdr.pm_callback = &usb2_bus_attach; bus->attach_msg[1].bus = bus; - /* Create a new USB process */ - if (usb2_proc_setup(&bus->explore_proc, + bus->roothub_msg[0].hdr.pm_callback = &usb2_bus_roothub; + bus->roothub_msg[0].bus = bus; + bus->roothub_msg[1].hdr.pm_callback = &usb2_bus_roothub; + bus->roothub_msg[1].bus = bus; + + /* Create USB explore and roothub processes */ + if (usb2_proc_setup(&bus->roothub_proc, + &bus->bus_mtx, USB_PRI_HIGH)) { + printf("WARNING: Creation of USB roothub " + "process failed.\n"); + } else if (usb2_proc_setup(&bus->explore_proc, &bus->bus_mtx, USB_PRI_MED)) { - printf("WARNING: Creation of USB explore process failed.\n"); + printf("WARNING: Creation of USB explore " + "process failed.\n"); } else { /* Get final attach going */ USB_BUS_LOCK(bus); @@ -543,3 +558,38 @@ mtx_destroy(&bus->bus_mtx); } + +/*------------------------------------------------------------------------* + * usb2_bus_roothub + * + * This function is used to execute roothub control requests on the + * roothub and is called from the roothub process. + *------------------------------------------------------------------------*/ +static void +usb2_bus_roothub(struct usb2_proc_msg *pm) +{ + struct usb2_bus *bus; + + bus = ((struct usb2_bus_msg *)pm)->bus; + + USB_BUS_LOCK_ASSERT(bus, MA_OWNED); + + (bus->methods->roothub_exec) (bus); +} + +/*------------------------------------------------------------------------* + * usb2_bus_roothub_exec + * + * This function is used to schedule the "roothub_done" bus callback + * method. The bus lock must be locked when calling this function. + *------------------------------------------------------------------------*/ +void +usb2_bus_roothub_exec(struct usb2_bus *bus) +{ + USB_BUS_LOCK_ASSERT(bus, MA_OWNED); + + if (usb2_proc_msignal(&bus->roothub_proc, + &bus->roothub_msg[0], &bus->roothub_msg[1])) { + /* ignore */ + } +} ==== //depot/projects/usb/src/sys/dev/usb2/controller/usb2_controller.h#8 (text+ko) ==== @@ -94,6 +94,10 @@ /* USB Device mode only - Optional */ void (*vbus_interrupt) (struct usb2_bus *, uint8_t is_on); + + /* USB Device and Host mode - Optional */ + + void (*roothub_exec) (struct usb2_bus *); }; /* @@ -186,6 +190,7 @@ void usb2_bus_mem_flush_all(struct usb2_bus *bus, usb2_bus_mem_cb_t *cb); uint8_t usb2_bus_mem_alloc_all(struct usb2_bus *bus, bus_dma_tag_t dmat, usb2_bus_mem_cb_t *cb); void usb2_bus_mem_free_all(struct usb2_bus *bus, usb2_bus_mem_cb_t *cb); +void usb2_bus_roothub_exec(struct usb2_bus *bus); uint16_t usb2_isoc_time_expand(struct usb2_bus *bus, uint16_t isoc_time_curr); uint16_t usb2_fs_isoc_schedule_isoc_time_expand(struct usb2_device *udev, struct usb2_fs_isoc_schedule **pp_start, struct usb2_fs_isoc_schedule **pp_end, uint16_t isoc_time); uint8_t usb2_fs_isoc_schedule_alloc(struct usb2_fs_isoc_schedule *fss, uint8_t *pstart, uint16_t len); ==== //depot/projects/usb/src/sys/dev/usb2/controller/usb2_pci.h#5 (text+ko) ==== ==== //depot/projects/usb/src/sys/dev/usb2/controller/uss820dci.c#18 (text+ko) ==== @@ -39,14 +39,11 @@ #include #define USB_DEBUG_VAR uss820dcidebug -#define usb2_config_td_cc uss820dci_config_copy -#define usb2_config_td_softc uss820dci_softc #include #include #include #include -#include #include #include #include @@ -98,7 +95,6 @@ static usb2_sw_transfer_func_t uss820dci_root_intr_done; static usb2_sw_transfer_func_t uss820dci_root_ctrl_done; -static usb2_config_td_command_t uss820dci_root_ctrl_task; /* * Here is a list of what the USS820D chip can support. The main @@ -1832,15 +1828,13 @@ sc->sc_root_ctrl.xfer = xfer; - usb2_config_td_queue_command( - &sc->sc_config_td, NULL, &uss820dci_root_ctrl_task, 0, 0); + usb2_bus_roothub_exec(xfer->udev->bus); } static void -uss820dci_root_ctrl_task(struct uss820dci_softc *sc, - struct uss820dci_config_copy *cc, uint16_t refcount) +uss820dci_root_ctrl_task(struct usb2_bus *bus) { - uss820dci_root_ctrl_poll(sc); + uss820dci_root_ctrl_poll(USS820_DCI_BUS2SC(bus)); } static void @@ -2496,4 +2490,5 @@ .get_hw_ep_profile = &uss820dci_get_hw_ep_profile, .set_stall = &uss820dci_set_stall, .clear_stall = &uss820dci_clear_stall, + .roothub_exec = &uss820dci_root_ctrl_task, }; ==== //depot/projects/usb/src/sys/dev/usb2/controller/uss820dci.h#7 (text+ko) ==== @@ -347,7 +347,6 @@ LIST_HEAD(, usb2_xfer) sc_interrupt_list_head; struct usb2_sw_transfer sc_root_ctrl; struct usb2_sw_transfer sc_root_intr; - struct usb2_config_td sc_config_td; struct usb2_device *sc_devices[USS820_MAX_DEVICES]; struct resource *sc_io_res; ==== //depot/projects/usb/src/sys/dev/usb2/controller/uss820dci_atmelarm.c#8 (text+ko) ==== @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -175,12 +174,6 @@ } device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus); - err = usb2_config_td_setup(&sc->sc_config_td, sc, - &sc->sc_bus.bus_mtx, NULL, 0, 4); - if (err) { - device_printf(dev, "could not setup config thread!\n"); - goto error; - } #if (__FreeBSD_version >= 700031) err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, NULL, (void *)uss820dci_interrupt, sc, &sc->sc_intr_hdl); @@ -244,8 +237,6 @@ sc->sc_io_res); sc->sc_io_res = NULL; } - usb2_config_td_unsetup(&sc->sc_config_td); - usb2_bus_mem_free_all(&sc->sc_bus, NULL); return (0);