aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/pci/ohci_pci.c11
-rw-r--r--sys/dev/usb/ohci.c8
2 files changed, 12 insertions, 7 deletions
diff --git a/sys/dev/pci/ohci_pci.c b/sys/dev/pci/ohci_pci.c
index 0d3e325e19b2..30aa1585af98 100644
--- a/sys/dev/pci/ohci_pci.c
+++ b/sys/dev/pci/ohci_pci.c
@@ -1,5 +1,5 @@
/* $NetBSD: ohci_pci.c,v 1.5 1998/11/25 22:32:04 augustss Exp $ */
-/* FreeBSD $Id$ */
+/* FreeBSD $Id: ohci_pci.c,v 1.5 1998/12/14 09:40:14 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -226,6 +226,7 @@ ohci_pci_attach(pcici_t config_id, int unit)
usbd_status r;
ohci_softc_t *sc = NULL;
int rev;
+ vm_offset_t pbase;
sc = malloc(sizeof(ohci_softc_t), M_DEVBUF, M_NOWAIT);
/* Do not free it below, intr might use the sc */
@@ -235,7 +236,11 @@ ohci_pci_attach(pcici_t config_id, int unit)
}
memset(sc, 0, sizeof(ohci_softc_t));
- sc->sc_iobase = pci_conf_read(config_id,PCI_OHCI_BASE_REG) & 0xfffff000;
+ if(!pci_map_mem(config_id, PCI_CBMEM,
+ (vm_offset_t *)&sc->sc_iobase, &pbase)) {
+ printf("usb%d: couldn't map memory\n", unit);
+ return;
+ }
sc->unit = unit;
if ( !pci_map_int(config_id, (pci_inthand_t *)ohci_intr,
@@ -249,7 +254,7 @@ ohci_pci_attach(pcici_t config_id, int unit)
#endif
{
/* XXX is this correct? Does the correct version show up? */
- rev = inw(sc->sc_iobase+OHCI_REVISION);
+ rev = *((unsigned int *)(sc->sc_iobase+OHCI_REVISION));
printf("usb%d: OHCI version %d%d, interrupting at %d\n", unit,
OHCI_REV_HI(rev), OHCI_REV_LO(rev),
(int)pci_conf_read(config_id,PCI_INTERRUPT_REG) & 0xff);
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index ec4973dedb92..90f638a05d7e 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -1,5 +1,5 @@
/* $NetBSD: ohci.c,v 1.12 1998/11/30 21:39:20 augustss Exp $ */
-/* FreeBSD $Id$ */
+/* FreeBSD $Id: ohci.c,v 1.4 1998/12/14 09:32:23 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -144,9 +144,9 @@ void ohci_dump_ed __P((ohci_soft_ed_t *));
#define OREAD4(sc, r) bus_space_read_4((sc)->iot, (sc)->ioh, (r))
#define OREAD2(sc, r) bus_space_read_2((sc)->iot, (sc)->ioh, (r))
#elif defined(__FreeBSD__)
-#define OWRITE4(sc, r, x) outl((sc)->sc_iobase + (r), (x))
-#define OREAD4(sc, r) inl((sc)->sc_iobase + (r))
-#define OREAD2(sc, r) inw((sc)->sc_iobase + (r))
+#define OWRITE4(sc, r, x) *(unsigned int *) ((sc)->sc_iobase + (r)) = x
+#define OREAD4(sc, r) (*(unsigned int *) ((sc)->sc_iobase + (r)))
+#define OREAD2(sc, r) (*(unsigned short *) ((sc)->sc_iobase + (r)))
#endif
/* Reverse the bits in a value 0 .. 31 */