PERFORCE change 113478 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Wed Jan 24 14:06:08 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=113478
Change 113478 by hselasky at hselasky_mini_itx on 2007/01/24 14:05:37
Style changes:
- s/iot/sc_io_tag/g
- s/ioh/sc_io_hdl/g
- s/sc_size/sc_io_size/g
- s/ios/sc_io_size/g
- s/irq_res/sc_irq_res/g
- s/ih/sc_intr_hdl/g
Ininitialized "sc_io_size".
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/ehci.c#20 edit
.. //depot/projects/usb/src/sys/dev/usb/ehci.h#8 edit
.. //depot/projects/usb/src/sys/dev/usb/ehci_pci.c#13 edit
.. //depot/projects/usb/src/sys/dev/usb/ohci.c#16 edit
.. //depot/projects/usb/src/sys/dev/usb/ohci.h#7 edit
.. //depot/projects/usb/src/sys/dev/usb/ohci_pci.c#13 edit
.. //depot/projects/usb/src/sys/dev/usb/uhci.c#17 edit
.. //depot/projects/usb/src/sys/dev/usb/uhci.h#7 edit
.. //depot/projects/usb/src/sys/dev/usb/uhci_pci.c#12 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/ehci.c#20 (text+ko) ====
==== //depot/projects/usb/src/sys/dev/usb/ehci.h#8 (text+ko) ====
@@ -395,71 +395,62 @@
typedef struct ehci_softc {
struct usbd_page sc_hw_page;
- struct ehci_hw_softc *sc_hw_ptr;
-
- ehci_qh_t *sc_async_p_last;
- ehci_qh_t *sc_intr_p_last[EHCI_VIRTUAL_FRAMELIST_COUNT];
- u_int16_t sc_intr_stat[EHCI_VIRTUAL_FRAMELIST_COUNT];
- ehci_sitd_t *sc_isoc_fs_p_last[EHCI_VIRTUAL_FRAMELIST_COUNT];
- ehci_itd_t *sc_isoc_hs_p_last[EHCI_VIRTUAL_FRAMELIST_COUNT];
struct usbd_bus sc_bus; /* base device */
+ struct __callout sc_tmo_pcd;
+ LIST_HEAD(, usbd_xfer) sc_interrupt_list_head;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- bus_size_t sc_size;
+ struct ehci_hw_softc *sc_hw_ptr;
+ struct resource *sc_io_res;
+ struct resource *sc_irq_res;
+ struct usbd_xfer *sc_intrxfer;
+ struct ehci_qh *sc_async_p_last;
+ struct ehci_qh *sc_intr_p_last[EHCI_VIRTUAL_FRAMELIST_COUNT];
+ struct ehci_sitd *sc_isoc_fs_p_last[EHCI_VIRTUAL_FRAMELIST_COUNT];
+ struct ehci_itd *sc_isoc_hs_p_last[EHCI_VIRTUAL_FRAMELIST_COUNT];
+ void *sc_intr_hdl;
+ device_t sc_dev;
+ bus_size_t sc_io_size;
+ bus_space_tag_t sc_io_tag;
+ bus_space_handle_t sc_io_hdl;
- void *ih;
+ uint32_t sc_eintrs;
+ uint32_t sc_cmd; /* shadow of cmd register during suspend */
- struct resource *io_res;
- struct resource *irq_res;
+ uint16_t sc_intr_stat[EHCI_VIRTUAL_FRAMELIST_COUNT];
+ uint16_t sc_id_vendor; /* vendor ID for root hub */
- device_t sc_dev;
-
uint8_t sc_offs; /* offset to operational registers */
uint8_t sc_doorbell_disable; /* set on doorbell failure */
-
- char sc_vendor[16]; /* vendor string for root hub */
- int sc_id_vendor; /* vendor ID for root hub */
-
-#if defined(__NetBSD__)
- void *sc_powerhook; /* cookie from power hook */
- void *sc_shutdownhook; /* cookie from shutdown hook */
-#endif
- LIST_HEAD(, usbd_xfer) sc_interrupt_list_head;
-
uint8_t sc_noport;
uint8_t sc_addr; /* device address */
uint8_t sc_conf; /* device configuration */
- struct usbd_xfer *sc_intrxfer;
uint8_t sc_isreset;
- uint32_t sc_eintrs;
- uint32_t sc_cmd; /* shadow of cmd register during suspend */
+ char sc_vendor[16]; /* vendor string for root hub */
- struct __callout sc_tmo_pcd;
} ehci_softc_t;
-#define EREAD1(sc, a) bus_space_read_1((sc)->iot, (sc)->ioh, (a))
-#define EREAD2(sc, a) bus_space_read_2((sc)->iot, (sc)->ioh, (a))
-#define EREAD4(sc, a) bus_space_read_4((sc)->iot, (sc)->ioh, (a))
+#define EREAD1(sc, a) bus_space_read_1((sc)->sc_io_tag, (sc)->sc_io_hdl, (a))
+#define EREAD2(sc, a) bus_space_read_2((sc)->sc_io_tag, (sc)->sc_io_hdl, (a))
+#define EREAD4(sc, a) bus_space_read_4((sc)->sc_io_tag, (sc)->sc_io_hdl, (a))
#define EWRITE1(sc, a, x) \
- bus_space_write_1((sc)->iot, (sc)->ioh, (a), (x))
+ bus_space_write_1((sc)->sc_io_tag, (sc)->sc_io_hdl, (a), (x))
#define EWRITE2(sc, a, x) \
- bus_space_write_2((sc)->iot, (sc)->ioh, (a), (x))
+ bus_space_write_2((sc)->sc_io_tag, (sc)->sc_io_hdl, (a), (x))
#define EWRITE4(sc, a, x) \
- bus_space_write_4((sc)->iot, (sc)->ioh, (a), (x))
+ bus_space_write_4((sc)->sc_io_tag, (sc)->sc_io_hdl, (a), (x))
#define EOREAD1(sc, a) \
- bus_space_read_1((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a))
+ bus_space_read_1((sc)->sc_io_tag, (sc)->sc_io_hdl, (sc)->sc_offs+(a))
#define EOREAD2(sc, a) \
- bus_space_read_2((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a))
+ bus_space_read_2((sc)->sc_io_tag, (sc)->sc_io_hdl, (sc)->sc_offs+(a))
#define EOREAD4(sc, a) \
- bus_space_read_4((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a))
+ bus_space_read_4((sc)->sc_io_tag, (sc)->sc_io_hdl, (sc)->sc_offs+(a))
#define EOWRITE1(sc, a, x) \
- bus_space_write_1((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x))
+ bus_space_write_1((sc)->sc_io_tag, (sc)->sc_io_hdl, (sc)->sc_offs+(a), (x))
#define EOWRITE2(sc, a, x) \
- bus_space_write_2((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x))
+ bus_space_write_2((sc)->sc_io_tag, (sc)->sc_io_hdl, (sc)->sc_offs+(a), (x))
#define EOWRITE4(sc, a, x) \
- bus_space_write_4((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x))
+ bus_space_write_4((sc)->sc_io_tag, (sc)->sc_io_hdl, (sc)->sc_offs+(a), (x))
usbd_status ehci_init(ehci_softc_t *sc);
void ehci_detach(struct ehci_softc *sc);
==== //depot/projects/usb/src/sys/dev/usb/ehci_pci.c#13 (text+ko) ====
@@ -262,21 +262,20 @@
}
rid = PCI_CBMEM;
- sc->io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid,
+ sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid,
RF_ACTIVE);
- if(!sc->io_res)
- {
+ if (!sc->sc_io_res) {
device_printf(self, "Could not map memory\n");
goto error;
}
- sc->iot = rman_get_bustag(sc->io_res);
- sc->ioh = rman_get_bushandle(sc->io_res);
+ 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);
rid = 0;
- sc->irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
+ sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
RF_SHAREABLE | RF_ACTIVE);
- if (sc->irq_res == NULL)
- {
+ if (sc->sc_irq_res == NULL) {
device_printf(self, "Could not allocate irq\n");
goto error;
}
@@ -338,12 +337,12 @@
sprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self));
}
- err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_BIO|INTR_MPSAFE,
- (void *)(void *)ehci_interrupt, sc, &sc->ih);
+ err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO|INTR_MPSAFE,
+ (void *)(void *)ehci_interrupt, sc, &sc->sc_intr_hdl);
if(err)
{
device_printf(self, "Could not setup irq, %d\n", err);
- sc->ih = NULL;
+ sc->sc_intr_hdl = NULL;
goto error;
}
@@ -384,34 +383,32 @@
/*
* disable interrupts that might have been switched on in ehci_init
*/
- if(sc->io_res)
- {
- bus_space_write_4(sc->iot, sc->ioh, EHCI_USBINTR, 0);
+ if (sc->sc_io_res) {
+ EWRITE4(sc, EHCI_USBINTR, 0);
}
- if(sc->irq_res && sc->ih)
- {
+ if (sc->sc_irq_res && sc->sc_intr_hdl) {
/* only call ehci_detach()
* after ehci_init()
*/
ehci_detach(sc);
- int err = bus_teardown_intr(self, sc->irq_res, sc->ih);
+ int err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl);
if (err)
/* XXX or should we panic? */
device_printf(self, "Could not tear down irq, %d\n",
err);
- sc->ih = NULL;
+ sc->sc_intr_hdl = NULL;
}
- if (sc->irq_res) {
- bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res);
- sc->irq_res = NULL;
+ if (sc->sc_irq_res) {
+ bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res);
+ sc->sc_irq_res = NULL;
}
- if (sc->io_res) {
+ if (sc->sc_io_res) {
bus_release_resource(self, SYS_RES_MEMORY, PCI_CBMEM,
- sc->io_res);
- sc->io_res = NULL;
+ sc->sc_io_res);
+ sc->sc_io_res = NULL;
}
if (sc->sc_bus.dma_tag) {
==== //depot/projects/usb/src/sys/dev/usb/ohci.c#16 (text+ko) ====
@@ -95,17 +95,17 @@
static void ohci_dump_itds(ohci_itd_t *);
#endif
-#define OBARR(sc) bus_space_barrier((sc)->iot, (sc)->ioh, 0, (sc)->sc_size, \
+#define OBARR(sc) bus_space_barrier((sc)->sc_io_tag, (sc)->sc_io_hdl, 0, (sc)->sc_io_size, \
BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE)
#define OWRITE1(sc, r, x) \
- do { OBARR(sc); bus_space_write_1((sc)->iot, (sc)->ioh, (r), (x)); } while (0)
+ do { OBARR(sc); bus_space_write_1((sc)->sc_io_tag, (sc)->sc_io_hdl, (r), (x)); } while (0)
#define OWRITE2(sc, r, x) \
- do { OBARR(sc); bus_space_write_2((sc)->iot, (sc)->ioh, (r), (x)); } while (0)
+ do { OBARR(sc); bus_space_write_2((sc)->sc_io_tag, (sc)->sc_io_hdl, (r), (x)); } while (0)
#define OWRITE4(sc, r, x) \
- do { OBARR(sc); bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x)); } while (0)
-#define OREAD1(sc, r) (OBARR(sc), bus_space_read_1((sc)->iot, (sc)->ioh, (r)))
-#define OREAD2(sc, r) (OBARR(sc), bus_space_read_2((sc)->iot, (sc)->ioh, (r)))
-#define OREAD4(sc, r) (OBARR(sc), bus_space_read_4((sc)->iot, (sc)->ioh, (r)))
+ do { OBARR(sc); bus_space_write_4((sc)->sc_io_tag, (sc)->sc_io_hdl, (r), (x)); } while (0)
+#define OREAD1(sc, r) (OBARR(sc), bus_space_read_1((sc)->sc_io_tag, (sc)->sc_io_hdl, (r)))
+#define OREAD2(sc, r) (OBARR(sc), bus_space_read_2((sc)->sc_io_tag, (sc)->sc_io_hdl, (r)))
+#define OREAD4(sc, r) (OBARR(sc), bus_space_read_4((sc)->sc_io_tag, (sc)->sc_io_hdl, (r)))
#define OHCI_INTR_ENDPT 1
==== //depot/projects/usb/src/sys/dev/usb/ohci.h#7 (text+ko) ====
@@ -276,48 +276,37 @@
typedef struct ohci_softc {
struct usbd_page sc_hw_page;
- struct ohci_hw_softc *sc_hw_ptr;
-
- ohci_ed_t *sc_ctrl_p_last;
- ohci_ed_t *sc_bulk_p_last;
- ohci_ed_t *sc_isoc_p_last;
- ohci_ed_t *sc_intr_p_last[OHCI_NO_EDS];
- uint16_t sc_intr_stat[OHCI_NO_EDS];
-
struct usbd_bus sc_bus; /* base device */
- uint32_t sc_physaddr;
+ struct __callout sc_tmo_rhsc;
+ LIST_HEAD(, usbd_xfer) sc_interrupt_list_head;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- bus_size_t sc_size;
+ struct ohci_hw_softc *sc_hw_ptr;
+ struct usbd_xfer *sc_intrxfer;
+ struct resource *sc_io_res;
+ struct resource *sc_irq_res;
+ struct ohci_ed *sc_ctrl_p_last;
+ struct ohci_ed *sc_bulk_p_last;
+ struct ohci_ed *sc_isoc_p_last;
+ struct ohci_ed *sc_intr_p_last[OHCI_NO_EDS];
+ void *sc_intr_hdl;
+ device_t sc_dev;
+ bus_size_t sc_io_size;
+ bus_space_tag_t sc_io_tag;
+ bus_space_handle_t sc_io_hdl;
- void *ih;
+ uint32_t sc_eintrs; /* enabled interrupts */
+ uint32_t sc_control; /* Preserved during suspend/standby */
+ uint32_t sc_intre;
- struct resource *io_res;
- struct resource *irq_res;
-
- uint32_t sc_eintrs; /* enabled interrupts */
+ uint16_t sc_intr_stat[OHCI_NO_EDS];
+ uint16_t sc_id_vendor;
uint8_t sc_noport;
uint8_t sc_addr; /* device address */
uint8_t sc_conf; /* device configuration */
- device_t sc_dev;
-
- struct usbd_xfer *sc_intrxfer;
+ char sc_vendor[16];
- uint8_t sc_vendor[16];
- int sc_id_vendor;
-#if defined(__NetBSD__)
- void *sc_powerhook; /* cookie from power hook */
- void *sc_shutdownhook; /* cookie from shutdown hook */
-#endif
- uint32_t sc_control; /* Preserved during suspend/standby */
- uint32_t sc_intre;
-
- LIST_HEAD(, usbd_xfer) sc_interrupt_list_head;
-
- struct __callout sc_tmo_rhsc;
} ohci_softc_t;
usbd_status ohci_init(ohci_softc_t *sc);
==== //depot/projects/usb/src/sys/dev/usb/ohci_pci.c#13 (text+ko) ====
@@ -226,21 +226,20 @@
}
rid = PCI_CBMEM;
- sc->io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid,
+ sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid,
RF_ACTIVE);
- if(!sc->io_res)
- {
+ if (!sc->sc_io_res) {
device_printf(self, "Could not map memory\n");
goto error;
}
- sc->iot = rman_get_bustag(sc->io_res);
- sc->ioh = rman_get_bushandle(sc->io_res);
+ 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);
rid = 0;
- sc->irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
+ sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
RF_SHAREABLE | RF_ACTIVE);
- if(sc->irq_res == NULL)
- {
+ if (sc->sc_irq_res == NULL) {
device_printf(self, "Could not allocate irq\n");
goto error;
}
@@ -300,12 +299,12 @@
/* sc->sc_bus.usbrev; set by ohci_init() */
- err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_BIO|INTR_MPSAFE,
- (void *)(void *)ohci_interrupt, sc, &sc->ih);
+ err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO|INTR_MPSAFE,
+ (void *)(void *)ohci_interrupt, sc, &(sc->sc_intr_hdl));
if(err)
{
device_printf(self, "Could not setup irq, %d\n", err);
- sc->ih = NULL;
+ sc->sc_intr_hdl = NULL;
goto error;
}
@@ -344,14 +343,13 @@
pci_disable_busmaster(self);
- if(sc->irq_res && sc->ih)
- {
+ if(sc->sc_irq_res && sc->sc_intr_hdl) {
/* only call ohci_detach()
* after ohci_init()
*/
ohci_detach(sc);
- int err = bus_teardown_intr(self, sc->irq_res, sc->ih);
+ int err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl);
if(err)
{
@@ -359,18 +357,18 @@
device_printf(self, "Could not tear down irq, %d\n",
err);
}
- sc->ih = NULL;
+ sc->sc_intr_hdl = NULL;
}
- if(sc->irq_res)
- {
- bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res);
- sc->irq_res = NULL;
+
+ if (sc->sc_irq_res) {
+ bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res);
+ sc->sc_irq_res = NULL;
}
- if(sc->io_res)
- {
+
+ if (sc->sc_io_res) {
bus_release_resource(self, SYS_RES_MEMORY, PCI_CBMEM,
- sc->io_res);
- sc->io_res = NULL;
+ sc->sc_io_res);
+ sc->sc_io_res = NULL;
}
if(sc->sc_bus.dma_tag)
==== //depot/projects/usb/src/sys/dev/usb/uhci.c#17 (text+ko) ====
@@ -98,21 +98,20 @@
uhci_dump_tds(uhci_td_t *td);
#endif
-/* NOTE: ``(sc)->ios'' is not setup */
-#define UBARR(sc) bus_space_barrier((sc)->iot, (sc)->ioh, 0, (sc)->ios, \
+#define UBARR(sc) bus_space_barrier((sc)->sc_io_tag, (sc)->sc_io_hdl, 0, (sc)->sc_io_size, \
BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE)
#define UWRITE1(sc, r, x) \
- do { UBARR(sc); bus_space_write_1((sc)->iot, (sc)->ioh, (r), (x)); \
+ do { UBARR(sc); bus_space_write_1((sc)->sc_io_tag, (sc)->sc_io_hdl, (r), (x)); \
} while (/*CONSTCOND*/0)
#define UWRITE2(sc, r, x) \
- do { UBARR(sc); bus_space_write_2((sc)->iot, (sc)->ioh, (r), (x)); \
+ do { UBARR(sc); bus_space_write_2((sc)->sc_io_tag, (sc)->sc_io_hdl, (r), (x)); \
} while (/*CONSTCOND*/0)
#define UWRITE4(sc, r, x) \
- do { UBARR(sc); bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x)); \
+ do { UBARR(sc); bus_space_write_4((sc)->sc_io_tag, (sc)->sc_io_hdl, (r), (x)); \
} while (/*CONSTCOND*/0)
-#define UREAD1(sc, r) (UBARR(sc), bus_space_read_1((sc)->iot, (sc)->ioh, (r)))
-#define UREAD2(sc, r) (UBARR(sc), bus_space_read_2((sc)->iot, (sc)->ioh, (r)))
-#define UREAD4(sc, r) (UBARR(sc), bus_space_read_4((sc)->iot, (sc)->ioh, (r)))
+#define UREAD1(sc, r) (UBARR(sc), bus_space_read_1((sc)->sc_io_tag, (sc)->sc_io_hdl, (r)))
+#define UREAD2(sc, r) (UBARR(sc), bus_space_read_2((sc)->sc_io_tag, (sc)->sc_io_hdl, (r)))
+#define UREAD4(sc, r) (UBARR(sc), bus_space_read_4((sc)->sc_io_tag, (sc)->sc_io_hdl, (r)))
#define UHCICMD(sc, cmd) UWRITE2(sc, UHCI_CMD, cmd)
#define UHCISTS(sc) UREAD2(sc, UHCI_STS)
==== //depot/projects/usb/src/sys/dev/usb/uhci.h#7 (text+ko) ====
@@ -236,39 +236,32 @@
typedef struct uhci_softc {
struct usbd_page sc_hw_page;
+ struct usbd_bus sc_bus; /* base device */
+ LIST_HEAD(, usbd_xfer) sc_interrupt_list_head;
+
struct uhci_hw_softc *sc_hw_ptr;
-
struct uhci_td *sc_isoc_p_last[UHCI_VFRAMELIST_COUNT]; /* pointer to last TD for isochronous */
struct uhci_qh *sc_intr_p_last[UHCI_IFRAMELIST_COUNT]; /* pointer to last QH for interrupt */
-
- uint16_t sc_intr_stat[UHCI_IFRAMELIST_COUNT];
-
struct uhci_qh *sc_ls_ctl_p_last; /* pointer to last QH for low speed control */
struct uhci_qh *sc_hs_ctl_p_last; /* pointer to last QH for high speed control */
struct uhci_qh *sc_bulk_p_last; /* pointer to last QH for bulk */
+ struct resource *sc_io_res;
+ struct resource *sc_irq_res;
+ void *sc_intr_hdl;
+ device_t sc_dev;
+ bus_size_t sc_io_size;
+ bus_space_tag_t sc_io_tag;
+ bus_space_handle_t sc_io_hdl;
- struct usbd_bus sc_bus; /* base device */
+ uint32_t sc_loops; /* number of QHs that wants looping */
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- bus_size_t ios;
-
- void *ih;
-
- struct resource *io_res;
- struct resource *irq_res;
-
- device_t sc_dev;
+ uint16_t sc_intr_stat[UHCI_IFRAMELIST_COUNT];
+ uint16_t sc_saved_frnum;
- uint32_t sc_loops; /* number of QHs that wants looping */
uint8_t sc_addr; /* device address */
uint8_t sc_conf; /* device configuration */
uint8_t sc_isreset;
-
uint8_t sc_saved_sof;
- uint16_t sc_saved_frnum;
-
- LIST_HEAD(, usbd_xfer) sc_interrupt_list_head;
char sc_vendor[16]; /* vendor string for root hub */
} uhci_softc_t;
==== //depot/projects/usb/src/sys/dev/usb/uhci_pci.c#12 (text+ko) ====
@@ -225,24 +225,23 @@
}
rid = PCI_UHCI_BASE_REG;
- sc->io_res = bus_alloc_resource_any(self, SYS_RES_IOPORT, &rid,
+ sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_IOPORT, &rid,
RF_ACTIVE);
- if(!sc->io_res)
- {
+ if (!sc->sc_io_res) {
device_printf(self, "Could not map ports\n");
goto error;
}
- sc->iot = rman_get_bustag(sc->io_res);
- sc->ioh = rman_get_bushandle(sc->io_res);
+ 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);
/* disable interrupts */
- bus_space_write_2(sc->iot, sc->ioh, UHCI_INTR, 0);
+ bus_space_write_2(sc->sc_io_tag, sc->sc_io_hdl, UHCI_INTR, 0);
rid = 0;
- sc->irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
+ sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
RF_SHAREABLE | RF_ACTIVE);
- if(sc->irq_res == NULL)
- {
+ if (sc->sc_irq_res == NULL) {
device_printf(self, "Could not allocate irq\n");
goto error;
}
@@ -286,13 +285,13 @@
break;
}
- err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_BIO|INTR_MPSAFE,
- (void *)(void *)uhci_interrupt, sc, &sc->ih);
+ err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO|INTR_MPSAFE,
+ (void *)(void *)uhci_interrupt, sc, &(sc->sc_intr_hdl));
if(err)
{
device_printf(self, "Could not setup irq, %d\n", err);
- sc->ih = NULL;
+ sc->sc_intr_hdl = NULL;
goto error;
}
/*
@@ -346,8 +345,7 @@
* disable interrupts that might have been switched on in
* uhci_init.
*/
- if(sc->io_res)
- {
+ if (sc->sc_io_res) {
mtx_lock(&sc->sc_bus.mtx);
/* stop the controller */
@@ -358,9 +356,8 @@
pci_disable_busmaster(self);
- if(sc->irq_res && sc->ih)
- {
- int err = bus_teardown_intr(self, sc->irq_res, sc->ih);
+ if (sc->sc_irq_res && sc->sc_intr_hdl) {
+ int err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl);
if(err)
{
@@ -368,18 +365,18 @@
device_printf(self, "Could not tear down irq, %d\n",
err);
}
- sc->ih = NULL;
+ sc->sc_intr_hdl = NULL;
}
- if(sc->irq_res)
- {
- bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res);
- sc->irq_res = NULL;
+
+ if (sc->sc_irq_res) {
+ bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res);
+ sc->sc_irq_res = NULL;
}
- if(sc->io_res)
- {
+
+ if(sc->sc_io_res) {
bus_release_resource(self, SYS_RES_IOPORT, PCI_UHCI_BASE_REG,
- sc->io_res);
- sc->io_res = NULL;
+ sc->sc_io_res);
+ sc->sc_io_res = NULL;
}
if(sc->sc_bus.dma_tag)
More information about the p4-projects
mailing list