From 63ec34020998040ea997e29ae91f355a9fb2e11e Mon Sep 17 00:00:00 2001 From: hselasky Date: Mon, 5 Jan 2015 20:22:18 +0000 Subject: Add 64-bit DMA support in the XHCI controller driver. - Fix some comments and whitespace while at it. MFC after: 1 month Submitted by: marius@ --- sys/dev/usb/controller/xhci_pci.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'sys/dev/usb/controller/xhci_pci.c') diff --git a/sys/dev/usb/controller/xhci_pci.c b/sys/dev/usb/controller/xhci_pci.c index c39842c..b39782a 100644 --- a/sys/dev/usb/controller/xhci_pci.c +++ b/sys/dev/usb/controller/xhci_pci.c @@ -181,26 +181,26 @@ xhci_pci_attach(device_t self) struct xhci_softc *sc = device_get_softc(self); int count, err, rid; - /* XXX check for 64-bit capability */ - - if (xhci_init(sc, self)) { - device_printf(self, "Could not initialize softc\n"); - goto error; - } - - pci_enable_busmaster(self); - rid = PCI_XHCI_CBMEM; sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (!sc->sc_io_res) { device_printf(self, "Could not map memory\n"); - goto error; + return (ENOMEM); } sc->sc_io_tag = rman_get_bustag(sc->sc_io_res); sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); sc->sc_io_size = rman_get_size(sc->sc_io_res); + if (xhci_init(sc, self)) { + device_printf(self, "Could not initialize softc\n"); + bus_release_resource(self, SYS_RES_MEMORY, PCI_XHCI_CBMEM, + sc->sc_io_res); + return (ENXIO); + } + + pci_enable_busmaster(self); + usb_callout_init_mtx(&sc->sc_callout, &sc->sc_bus.bus_mtx, 0); rid = 0; @@ -299,10 +299,8 @@ xhci_pci_detach(device_t self) /* during module unload there are lots of children leftover */ device_delete_children(self); - if (sc->sc_io_res) { - usb_callout_drain(&sc->sc_callout); - xhci_halt_controller(sc); - } + usb_callout_drain(&sc->sc_callout); + xhci_halt_controller(sc); pci_disable_busmaster(self); -- cgit v1.1