From 97f8a313b9ef3b6a82d6883b317bdeda06c98434 Mon Sep 17 00:00:00 2001 From: imp Date: Wed, 20 Jun 2001 06:21:17 +0000 Subject: [PATCH] Add new entries for: TI1210, TI4410 and TI4450 and fix what looks like a typo in the OZ6860 entry. Obtained from: NetBSD --- sys/dev/pccbb/pccbb.c | 68 +++++++++++++++++--------------------- sys/dev/pccbb/pccbbdevid.h | 5 ++- 2 files changed, 35 insertions(+), 38 deletions(-) diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c index 33d7842dc69f..42d4a232289b 100644 --- a/sys/dev/pccbb/pccbb.c +++ b/sys/dev/pccbb/pccbb.c @@ -76,6 +76,7 @@ #include "card_if.h" #include "pcib_if.h" +#define CBB_DEBUG #if defined CBB_DEBUG #define DPRINTF(x) printf x #define DEVPRINTF(x) device_printf x @@ -389,6 +390,8 @@ pccbb_attach(device_t dev) { struct pccbb_softc *sc = (struct pccbb_softc *)device_get_softc(dev); int rid; + struct pccbb_sclist *sclist; + u_int32_t sockbase; u_int32_t tmp; if (!softcs_init) { @@ -407,39 +410,36 @@ pccbb_attach(device_t dev) SLIST_INIT(&sc->rl); /* Ths PCI bus should have given me memory... right? */ - rid=PCCBBR_SOCKBASE; + rid = PCCBBR_SOCKBASE; sc->sc_base_res=bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0,~0,1, RF_ACTIVE); - if (!sc->sc_base_res) { + 0, ~0, 1, RF_ACTIVE); + if (sc->sc_base_res == NULL) { /* * XXX eVILE HACK BAD THING! XXX * The pci bus device should do this for us. * Some BIOSes doesn't assign a memory space properly. * So we try to manually put one in... */ - u_int32_t sockbase; - sockbase = pci_read_config(dev, rid, 4); if (sockbase < 0x100000 || sockbase >= 0xfffffff0) { pci_write_config(dev, rid, 0xffffffff, 4); sockbase = pci_read_config(dev, rid, 4); sockbase = (sockbase & 0xfffffff0) & - -(sockbase & 0xfffffff0); - sc->sc_base_res = bus_generic_alloc_resource( - device_get_parent(dev), dev, SYS_RES_MEMORY, - &rid, CARDBUS_SYS_RES_MEMORY_START, - CARDBUS_SYS_RES_MEMORY_END, sockbase, - RF_ACTIVE|rman_make_alignment_flags(sockbase)); - if (!sc->sc_base_res){ + -(sockbase & 0xfffffff0); + sc->sc_base_res = bus_alloc_resource(dev, + SYS_RES_MEMORY, &rid, CARDBUS_SYS_RES_MEMORY_START, + CARDBUS_SYS_RES_MEMORY_END, sockbase, + RF_ACTIVE | rman_make_alignment_flags(sockbase)); + if (sc->sc_base_res == NULL) { device_printf(dev, - "Could not grab register memory\n"); + "Could not grab register memory\n"); mtx_destroy(&sc->sc_mtx); return ENOMEM; } pci_write_config(dev, PCCBBR_SOCKBASE, - rman_get_start(sc->sc_base_res), 4); + rman_get_start(sc->sc_base_res), 4); DEVPRINTF((dev, "PCI Memory allocated: %08lx\n", - rman_get_start(sc->sc_base_res))); + rman_get_start(sc->sc_base_res))); } else { device_printf(dev, "Could not map register memory\n"); mtx_destroy(&sc->sc_mtx); @@ -448,7 +448,7 @@ pccbb_attach(device_t dev) } sc->sc_socketreg = - (struct pccbb_socketreg *)rman_get_virtual(sc->sc_base_res); + (struct pccbb_socketreg *) rman_get_virtual(sc->sc_base_res); pccbb_chipinit(sc); /* CSC Interrupt: Card detect interrupt on */ @@ -459,63 +459,57 @@ pccbb_attach(device_t dev) sc->sc_socketreg->socket_event = tmp; /* Map and establish the interrupt. */ - rid=0; + rid = 0; sc->sc_irq_res=bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, - RF_SHAREABLE | RF_ACTIVE); + RF_SHAREABLE | RF_ACTIVE); if (sc->sc_irq_res == NULL) { printf("pccbb: Unable to map IRQ...\n"); bus_release_resource(dev, SYS_RES_MEMORY, PCCBBR_SOCKBASE, - sc->sc_base_res); + sc->sc_base_res); mtx_destroy(&sc->sc_mtx); return ENOMEM; } if (bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO, pccbb_intr, sc, - &(sc->sc_intrhand))) { + &sc->sc_intrhand)) { device_printf(dev, "couldn't establish interrupt"); bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); bus_release_resource(dev, SYS_RES_MEMORY, PCCBBR_SOCKBASE, - sc->sc_base_res); + sc->sc_base_res); mtx_destroy(&sc->sc_mtx); return ENOMEM; } /* attach children */ sc->sc_cbdev = device_add_child(dev, "cardbus", -1); - if (sc->sc_cbdev == NULL) + if (sc->sc_cbdev == NULL) { DEVPRINTF((dev, "WARNING: cannot add cardbus bus.\n")); - else if (device_probe_and_attach(sc->sc_cbdev) != 0) { + } else if (device_probe_and_attach(sc->sc_cbdev) != 0) { DEVPRINTF((dev, "WARNING: cannot attach cardbus bus!\n")); sc->sc_cbdev = NULL; } sc->sc_pccarddev = device_add_child(dev, "pccard", -1); - if (sc->sc_pccarddev == NULL) + if (sc->sc_pccarddev == NULL) { DEVPRINTF((dev, "WARNING: cannot add pccard bus.\n")); - else if (device_probe_and_attach(sc->sc_pccarddev) != 0) { + } else if (device_probe_and_attach(sc->sc_pccarddev) != 0) { DEVPRINTF((dev, "WARNING: cannot attach pccard bus.\n")); sc->sc_pccarddev = NULL; } -#ifndef KLD_MODULE if (sc->sc_cbdev == NULL && sc->sc_pccarddev == NULL) { - device_printf(dev, "ERROR: Failed to attach cardbus/pccard bus!\n"); + device_printf(dev, + "ERROR: Failed to attach cardbus/pccard bus!\n"); bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intrhand); bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); bus_release_resource(dev, SYS_RES_MEMORY, PCCBBR_SOCKBASE, - sc->sc_base_res); + sc->sc_base_res); mtx_destroy(&sc->sc_mtx); return ENOMEM; } -#endif - - { - struct pccbb_sclist *sclist; - sclist = malloc(sizeof(struct pccbb_sclist), M_DEVBUF, - M_WAITOK); - sclist->sc = sc; - STAILQ_INSERT_TAIL(&softcs, sclist, entries); - } + sclist = malloc(sizeof(struct pccbb_sclist), M_DEVBUF, M_WAITOK); + sclist->sc = sc; + STAILQ_INSERT_TAIL(&softcs, sclist, entries); return 0; } diff --git a/sys/dev/pccbb/pccbbdevid.h b/sys/dev/pccbb/pccbbdevid.h index 3fe28c3946a5..d0a488c8251a 100644 --- a/sys/dev/pccbb/pccbbdevid.h +++ b/sys/dev/pccbb/pccbbdevid.h @@ -33,7 +33,7 @@ #define PCI_DEVICE_ID_PCIC_OZ6729 0x67291217ul #define PCI_DEVICE_ID_PCIC_OZ6730 0x673A1217ul #define PCI_DEVICE_ID_PCIC_OZ6832 0x68321217ul /* Also 6833 */ -#define PCI_DEVICE_ID_PCIC_OZ6860 0x68361216ul /* Also 6836? */ +#define PCI_DEVICE_ID_PCIC_OZ6860 0x68361217ul /* Also 6836? */ #define PCI_DEVICE_ID_PCIC_OZ6872 0x68721217ul /* Also 6812 */ #define PCI_DEVICE_ID_PCIC_OZ6912 /* Unknown */ #define PCI_DEVICE_ID_PCIC_OZ6922 /* Unknown */ @@ -47,6 +47,7 @@ #define PCI_DEVICE_ID_PCIC_TI1031 0xac13104cul #define PCI_DEVICE_ID_PCIC_TI1130 0xac12104cul #define PCI_DEVICE_ID_PCIC_TI1131 0xac15104cul +#define PCI_DEVICE_ID_PCIC_TI1210 0xac1a104cul #define PCI_DEVICE_ID_PCIC_TI1211 0xac1e104cul #define PCI_DEVICE_ID_PCIC_TI1220 0xac17104cul #define PCI_DEVICE_ID_PCIC_TI1221 0xac19104cul @@ -58,6 +59,8 @@ #define PCI_DEVICE_ID_PCIC_TI1420 0xac51104cul #define PCI_DEVICE_ID_PCIC_TI1450 0xac1b104cul #define PCI_DEVICE_ID_PCIC_TI1451 0xac52104cul +#define PCI_DEVICE_ID_PCIC_TI4410 0xac40104cul +#define PCI_DEVICE_ID_PCIC_TI4450 0xac41104cul #define PCI_DEVICE_ID_PCIC_TI4451 0xac42104cul #define PCI_DEVICE_ID_TOSHIBA_TOPIC95 0x06031179ul #define PCI_DEVICE_ID_TOSHIBA_TOPIC95B 0x060a1179ul