summaryrefslogtreecommitdiff
path: root/sys/dev/pci/pccbb.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2009-07-25 11:27:27 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2009-07-25 11:27:27 +0000
commite7d864b23704eb225a4baef0139290e9cfba8573 (patch)
treea44fe3a9cc7bb123d7282e5060ca2e8bff5f5c22 /sys/dev/pci/pccbb.c
parentfa095e14de08b033704439a082fd87f2c3996b94 (diff)
Stop using rbus to set up the socket BAR if it has been left unitialized
by the firmware; our PCI code takes care of this now. Also eliminate support for I/O socket BARs. There is no evidence they actually exist. Clean up some unused structure members while there. ok miod@
Diffstat (limited to 'sys/dev/pci/pccbb.c')
-rw-r--r--sys/dev/pci/pccbb.c63
1 files changed, 6 insertions, 57 deletions
diff --git a/sys/dev/pci/pccbb.c b/sys/dev/pci/pccbb.c
index e7987f620a1..04cda441090 100644
--- a/sys/dev/pci/pccbb.c
+++ b/sys/dev/pci/pccbb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pccbb.c,v 1.66 2009/07/21 20:59:45 miod Exp $ */
+/* $OpenBSD: pccbb.c,v 1.67 2009/07/25 11:27:26 kettenis Exp $ */
/* $NetBSD: pccbb.c,v 1.96 2004/03/28 09:49:31 nakayama Exp $ */
/*
@@ -363,10 +363,6 @@ pccbb_shutdown(void *arg)
DPRINTF(("%s: shutdown\n", sc->sc_dev.dv_xname));
- /* Nothing for us to do if we didn't map any registers. */
- if ((sc->sc_flags & CBB_MEMHMAPPED) == 0)
- return;
-
/* turn off power */
pccbb_power((cardbus_chipset_tag_t)sc, CARDBUS_VCC_0V | CARDBUS_VPP_0V);
@@ -407,8 +403,6 @@ pccbbattach(struct device *parent, struct device *self, void *aux)
sc->sc_rbus_iot = rbus_pccbb_parent_io(self, pa);
sc->sc_rbus_memt = rbus_pccbb_parent_mem(self, pa);
- sc->sc_flags &= ~CBB_MEMHMAPPED;
-
/*
* MAP socket registers and ExCA registers on memory-space
* When no valid address is set on socket base registers (on pci
@@ -416,42 +410,14 @@ pccbbattach(struct device *parent, struct device *self, void *aux)
*/
sock_base = pci_conf_read(pc, pa->pa_tag, PCI_SOCKBASE);
- if (PCI_MAPREG_MEM_ADDR(sock_base) >= 0x100000 &&
- PCI_MAPREG_MEM_ADDR(sock_base) != 0xfffffff0) {
- /* The address must be valid. */
- if (pci_mapreg_map(pa, PCI_SOCKBASE, PCI_MAPREG_TYPE_MEM, 0,
- &sc->sc_base_memt, &sc->sc_base_memh, &sockbase, NULL, 0))
- {
- printf("%s: can't map socket base address 0x%x\n",
- sc->sc_dev.dv_xname, sock_base);
- /*
- * I think it's funny: socket base registers must be
- * mapped on memory space, but ...
- */
- if (pci_mapreg_map(pa, PCI_SOCKBASE,
- PCI_MAPREG_TYPE_IO, 0, &sc->sc_base_memt,
- &sc->sc_base_memh, &sockbase, NULL, 0)) {
- printf("%s: can't map socket base address"
- " 0x%lx: io mode\n", sc->sc_dev.dv_xname,
- sockbase);
- /* give up... allocate reg space via rbus. */
- pci_conf_write(pc, pa->pa_tag, PCI_SOCKBASE, 0);
- } else
- sc->sc_flags |= CBB_MEMHMAPPED;
- } else {
- DPRINTF(("%s: socket base address 0x%lx\n",
- sc->sc_dev.dv_xname, sockbase));
- sc->sc_flags |= CBB_MEMHMAPPED;
- }
+ if (pci_mapreg_map(pa, PCI_SOCKBASE, PCI_MAPREG_TYPE_MEM, 0,
+ &sc->sc_base_memt, &sc->sc_base_memh, &sockbase, NULL, 0)) {
+ printf("can't map registers\n");
+ return;
}
- sc->sc_mem_start = 0; /* XXX */
- sc->sc_mem_end = 0xffffffff; /* XXX */
-
busreg = pci_conf_read(pc, pa->pa_tag, PCI_BUSNUM);
- /* pccbb_machdep.c end */
-
#if defined CBB_DEBUG
{
static char *intrname[5] = { "NON", "A", "B", "C", "D" };
@@ -515,7 +481,7 @@ pccbbattach(struct device *parent, struct device *self, void *aux)
/* Disable legacy register mapping. */
switch (sc->sc_chipset) {
- case CB_RX5C46X: /* fallthrough */
+ case CB_RX5C46X:
#if 0
/* The RX5C47X-series requires writes to the PCI_LEGACY register. */
case CB_RX5C47X:
@@ -561,29 +527,12 @@ pccbb_pci_callback(struct device *self)
bus_space_tag_t base_memt;
bus_space_handle_t base_memh;
u_int32_t maskreg;
- bus_addr_t sockbase;
struct cbslot_attach_args cba;
struct pcmciabus_attach_args paa;
struct cardslot_attach_args caa;
struct cardslot_softc *csc;
u_int32_t sockstat;
- if (!(sc->sc_flags & CBB_MEMHMAPPED)) {
- /* The socket registers aren't mapped correctly. */
- if (rbus_space_alloc(sc->sc_rbus_memt, 0, 0x1000, 0x0fff,
- (sc->sc_chipset == CB_RX5C47X
- || sc->sc_chipset == CB_TI113X) ? 0x10000 : 0x1000,
- 0, &sockbase, &sc->sc_base_memh)) {
- return;
- }
- sc->sc_base_memt = sc->sc_memt;
- pci_conf_write(pc, sc->sc_tag, PCI_SOCKBASE, sockbase);
- DPRINTF(("%s: CardBus register address 0x%lx -> 0x%x\n",
- sc->sc_dev.dv_xname, sockbase, pci_conf_read(pc, sc->sc_tag,
- PCI_SOCKBASE)));
- sc->sc_flags |= CBB_MEMHMAPPED;
- }
-
base_memt = sc->sc_base_memt; /* socket regs memory tag */
base_memh = sc->sc_base_memh; /* socket regs memory handle */