diff options
| author | Warner Losh <imp@FreeBSD.org> | 2019-12-16 21:34:51 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2019-12-16 21:34:51 +0000 |
| commit | 7b9439d081b3a861ab6af2fc94e897c31c61d6ab (patch) | |
| tree | 04118d4fd353b890b9cfc9520b7c799d9476f00f /sys/dev/pccbb | |
| parent | 6ee8575cd71be8ba9ce88a28feddd523cac9f333 (diff) | |
Notes
Diffstat (limited to 'sys/dev/pccbb')
| -rw-r--r-- | sys/dev/pccbb/pccbb.c | 44 | ||||
| -rw-r--r-- | sys/dev/pccbb/pccbb_pci.c | 31 | ||||
| -rw-r--r-- | sys/dev/pccbb/pccbbvar.h | 3 |
3 files changed, 37 insertions, 41 deletions
diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c index 1b7c2f1ea9f4..1f6dd8314f73 100644 --- a/sys/dev/pccbb/pccbb.c +++ b/sys/dev/pccbb/pccbb.c @@ -253,9 +253,9 @@ cbb_disable_func_intr(struct cbb_softc *sc) #if 0 uint8_t reg; - reg = (exca_getb(&sc->exca[0], EXCA_INTR) & ~EXCA_INTR_IRQ_MASK) | + reg = (exca_getb(&sc->exca, EXCA_INTR) & ~EXCA_INTR_IRQ_MASK) | EXCA_INTR_IRQ_RESERVED1; - exca_putb(&sc->exca[0], EXCA_INTR, reg); + exca_putb(&sc->exca, EXCA_INTR, reg); #endif } @@ -271,11 +271,9 @@ cbb_enable_func_intr(struct cbb_softc *sc) { uint8_t reg; - reg = (exca_getb(&sc->exca[0], EXCA_INTR) & ~EXCA_INTR_IRQ_MASK) | + reg = (exca_getb(&sc->exca, EXCA_INTR) & ~EXCA_INTR_IRQ_MASK) | EXCA_INTR_IRQ_NONE; - exca_putb(&sc->exca[0], EXCA_INTR, reg); - PCI_MASK_CONFIG(sc->dev, CBBR_BRIDGECTRL, - & ~CBBM_BRIDGECTRL_INTR_IREQ_ISA_EN, 2); + exca_putb(&sc->exca, EXCA_INTR, reg); } int @@ -322,7 +320,7 @@ cbb_detach(device_t brdev) cbb_set(sc, CBB_SOCKET_MASK, 0); /* reset 16-bit pcmcia bus */ - exca_clrb(&sc->exca[0], EXCA_INTR, EXCA_INTR_RESET); + exca_clrb(&sc->exca, EXCA_INTR, EXCA_INTR_RESET); /* turn off power */ cbb_power(brdev, CARD_OFF); @@ -442,7 +440,7 @@ cbb_child_detached(device_t brdev, device_t child) struct cbb_softc *sc = device_get_softc(brdev); /* I'm not sure we even need this */ - if (child != sc->cbdev && child != sc->exca[0].pccarddev) + if (child != sc->cbdev && child != sc->exca.pccarddev) device_printf(brdev, "Unknown child detached: %s\n", device_get_nameunit(child)); } @@ -549,9 +547,9 @@ cbb_insert(struct cbb_softc *sc) sockevent, sockstate)); if (sockstate & CBB_STATE_R2_CARD) { - if (device_is_attached(sc->exca[0].pccarddev)) { + if (device_is_attached(sc->exca.pccarddev)) { sc->flags |= CBB_16BIT_CARD; - exca_insert(&sc->exca[0]); + exca_insert(&sc->exca); } else { device_printf(sc->dev, "16-bit card inserted, but no pccard bus.\n"); @@ -578,7 +576,7 @@ cbb_removal(struct cbb_softc *sc) { sc->cardok = 0; if (sc->flags & CBB_16BIT_CARD) { - exca_removal(&sc->exca[0]); + exca_removal(&sc->exca); } else { if (device_is_attached(sc->cbdev)) CARD_DETACH_CARD(sc->cbdev); @@ -708,8 +706,8 @@ cbb_o2micro_power_hack(struct cbb_softc *sc) * keyboard controller's interrupts being suppressed occurred when * we did this. */ - reg = exca_getb(&sc->exca[0], EXCA_INTR); - exca_putb(&sc->exca[0], EXCA_INTR, (reg & 0xf0) | 1); + reg = exca_getb(&sc->exca, EXCA_INTR); + exca_putb(&sc->exca, EXCA_INTR, (reg & 0xf0) | 1); return (reg); } @@ -721,7 +719,7 @@ cbb_o2micro_power_hack(struct cbb_softc *sc) static void cbb_o2micro_power_hack2(struct cbb_softc *sc, uint8_t reg) { - exca_putb(&sc->exca[0], EXCA_INTR, reg); + exca_putb(&sc->exca, EXCA_INTR, reg); } int @@ -921,7 +919,7 @@ cbb_do_power(device_t brdev) uint32_t status; /* Don't enable OE (output enable) until power stable */ - exca_clrb(&sc->exca[0], EXCA_PWRCTL, EXCA_PWRCTL_OE); + exca_clrb(&sc->exca, EXCA_PWRCTL, EXCA_PWRCTL_OE); voltage = cbb_detect_voltage(brdev); curpwr = cbb_current_voltage(brdev); @@ -1312,7 +1310,7 @@ cbb_pcic_power_enable_socket(device_t brdev, device_t child) err = cbb_do_power(brdev); if (err) return (err); - exca_reset(&sc->exca[0], child); + exca_reset(&sc->exca, child); return (0); } @@ -1325,18 +1323,18 @@ cbb_pcic_power_disable_socket(device_t brdev, device_t child) DPRINTF(("cbb_pcic_socket_disable\n")); /* Turn off the card's interrupt and leave it in reset, wait 10ms */ - exca_putb(&sc->exca[0], EXCA_INTR, 0); + exca_putb(&sc->exca, EXCA_INTR, 0); pause("cbbP1", hz / 100); /* power down the socket */ cbb_power(brdev, CARD_OFF); - exca_putb(&sc->exca[0], EXCA_PWRCTL, 0); + exca_putb(&sc->exca, EXCA_PWRCTL, 0); /* wait 300ms until power fails (Tpf). */ pause("cbbP2", hz * 300 / 1000); /* enable CSC interrupts */ - exca_putb(&sc->exca[0], EXCA_INTR, EXCA_INTR_ENABLE); + exca_putb(&sc->exca, EXCA_INTR, EXCA_INTR_ENABLE); return (0); } @@ -1370,7 +1368,7 @@ cbb_pcic_activate_resource(device_t brdev, device_t child, int type, int rid, struct cbb_softc *sc = device_get_softc(brdev); int error; - error = exca_activate_resource(&sc->exca[0], child, type, rid, res); + error = exca_activate_resource(&sc->exca, child, type, rid, res); if (error == 0) cbb_activate_window(brdev, type); return (error); @@ -1381,7 +1379,7 @@ cbb_pcic_deactivate_resource(device_t brdev, device_t child, int type, int rid, struct resource *res) { struct cbb_softc *sc = device_get_softc(brdev); - return (exca_deactivate_resource(&sc->exca[0], child, type, rid, res)); + return (exca_deactivate_resource(&sc->exca, child, type, rid, res)); } static struct resource * @@ -1476,7 +1474,7 @@ cbb_pcic_set_res_flags(device_t brdev, device_t child, int type, int rid, "set_res_flags: specified rid not found\n"); return (ENOENT); } - return (exca_mem_set_flags(&sc->exca[0], res, flags)); + return (exca_mem_set_flags(&sc->exca, res, flags)); } int @@ -1492,7 +1490,7 @@ cbb_pcic_set_memory_offset(device_t brdev, device_t child, int rid, "set_memory_offset: specified rid not found\n"); return (ENOENT); } - return (exca_mem_set_offset(&sc->exca[0], res, cardaddr, deltap)); + return (exca_mem_set_offset(&sc->exca, res, cardaddr, deltap)); } /************************************************************************/ diff --git a/sys/dev/pccbb/pccbb_pci.c b/sys/dev/pccbb/pccbb_pci.c index 8288469bd1f0..58c09d840592 100644 --- a/sys/dev/pccbb/pccbb_pci.c +++ b/sys/dev/pccbb/pccbb_pci.c @@ -294,7 +294,6 @@ cbb_pci_attach(device_t brdev) sc->chipset = cbb_chipset(pci_get_devid(brdev), NULL); sc->dev = brdev; sc->cbdev = NULL; - sc->exca[0].pccarddev = NULL; sc->domain = pci_get_domain(brdev); sc->pribus = pcib_get_bus(parent); #if defined(NEW_PCIB) && defined(PCI_RES_BUS) @@ -320,9 +319,9 @@ cbb_pci_attach(device_t brdev) sc->bst = rman_get_bustag(sc->base_res); sc->bsh = rman_get_bushandle(sc->base_res); - exca_init(&sc->exca[0], brdev, sc->bst, sc->bsh, CBB_EXCA_OFFSET); - sc->exca[0].flags |= EXCA_HAS_MEMREG_WIN; - sc->exca[0].chipset = EXCA_CARDBUS; + exca_init(&sc->exca, brdev, sc->bst, sc->bsh, CBB_EXCA_OFFSET); + sc->exca.flags |= EXCA_HAS_MEMREG_WIN; + sc->exca.chipset = EXCA_CARDBUS; sc->chipinit = cbb_chipinit; sc->chipinit(sc); @@ -381,10 +380,10 @@ cbb_pci_attach(device_t brdev) else if (device_probe_and_attach(sc->cbdev) != 0) DEVPRINTF((brdev, "WARNING: cannot attach cardbus bus!\n")); - sc->exca[0].pccarddev = device_add_child(brdev, "pccard", -1); - if (sc->exca[0].pccarddev == NULL) + sc->exca.pccarddev = device_add_child(brdev, "pccard", -1); + if (sc->exca.pccarddev == NULL) DEVPRINTF((brdev, "WARNING: cannot add pccard bus.\n")); - else if (device_probe_and_attach(sc->exca[0].pccarddev) != 0) + else if (device_probe_and_attach(sc->exca.pccarddev) != 0) DEVPRINTF((brdev, "WARNING: cannot attach pccard bus.\n")); /* Map and establish the interrupt. */ @@ -403,7 +402,7 @@ cbb_pci_attach(device_t brdev) } /* reset 16-bit pcmcia bus */ - exca_clrb(&sc->exca[0], EXCA_INTR, EXCA_INTR_RESET); + exca_clrb(&sc->exca, EXCA_INTR, EXCA_INTR_RESET); /* turn off power */ cbb_power(brdev, CARD_OFF); @@ -580,10 +579,10 @@ cbb_chipinit(struct cbb_softc *sc) * still be correctly generated if NO ISA IRQ is * selected (ExCA regs 03h or 05h are cleared). */ - reg = exca_getb(&sc->exca[0], EXCA_O2MICRO_CTRL_C); + reg = exca_getb(&sc->exca, EXCA_O2MICRO_CTRL_C); reg = (reg & 0x0f) | EXCA_O2CC_IREQ_INTC | EXCA_O2CC_STSCHG_INTC; - exca_putb(&sc->exca[0], EXCA_O2MICRO_CTRL_C, reg); + exca_putb(&sc->exca, EXCA_O2MICRO_CTRL_C, reg); break; case CB_TOPIC97: /* @@ -601,7 +600,7 @@ cbb_chipinit(struct cbb_softc *sc) * ToPIC97, 100 * Need to assert support for low voltage cards */ - exca_setb(&sc->exca[0], EXCA_TOPIC97_CTRL, + exca_setb(&sc->exca, EXCA_TOPIC97_CTRL, EXCA_TOPIC97_CTRL_LV_MASK); goto topic_common; case CB_TOPIC95: @@ -644,8 +643,8 @@ cbb_chipinit(struct cbb_softc *sc) * INTR_ENABLE and the other is to set CSC to 0. Since both * methods are mutually compatible, we do both. */ - exca_putb(&sc->exca[0], EXCA_INTR, EXCA_INTR_ENABLE); - exca_putb(&sc->exca[0], EXCA_CSC_INTR, 0); + exca_putb(&sc->exca, EXCA_INTR, EXCA_INTR_ENABLE); + exca_putb(&sc->exca, EXCA_CSC_INTR, 0); cbb_disable_func_intr(sc); @@ -684,7 +683,7 @@ cbb_pci_shutdown(device_t brdev) * down the socket. */ PCI_MASK_CONFIG(brdev, CBBR_BRIDGECTRL, |CBBM_BRIDGECTRL_RESET, 2); - exca_clrb(&sc->exca[0], EXCA_INTR, EXCA_INTR_RESET); + exca_clrb(&sc->exca, EXCA_INTR, EXCA_INTR_RESET); cbb_set(sc, CBB_SOCKET_MASK, 0); cbb_set(sc, CBB_SOCKET_EVENT, 0xffffffff); cbb_power(brdev, CARD_OFF); @@ -693,7 +692,7 @@ cbb_pci_shutdown(device_t brdev) * For paranoia, turn off all address decoding. Really not needed, * it seems, but it can't hurt */ - exca_putb(&sc->exca[0], EXCA_ADDRWIN_ENABLE, 0); + exca_putb(&sc->exca, EXCA_ADDRWIN_ENABLE, 0); pci_write_config(brdev, CBBR_MEMBASE0, 0, 4); pci_write_config(brdev, CBBR_MEMLIMIT0, 0, 4); pci_write_config(brdev, CBBR_MEMBASE1, 0, 4); @@ -733,7 +732,7 @@ cbb_pci_filt(void *arg) * in one place and a double wakeup would be benign there. */ if (sc->flags & CBB_16BIT_CARD) { - csc = exca_getb(&sc->exca[0], EXCA_CSC); + csc = exca_getb(&sc->exca, EXCA_CSC); if (csc & EXCA_CSC_READY) { atomic_add_int(&sc->powerintr, 1); wakeup((void *)&sc->powerintr); diff --git a/sys/dev/pccbb/pccbbvar.h b/sys/dev/pccbb/pccbbvar.h index 451b2c54fcab..c900199c2508 100644 --- a/sys/dev/pccbb/pccbbvar.h +++ b/sys/dev/pccbb/pccbbvar.h @@ -53,11 +53,10 @@ struct cbb_reslist { }; #define CBB_AUTO_OPEN_SMALLHOLE 0x100 -#define CBB_NSLOTS 4 struct cbb_softc { device_t dev; - struct exca_softc exca[CBB_NSLOTS]; + struct exca_softc exca; struct resource *base_res; struct resource *irq_res; void *intrhand; |
