static void pcic_pci_callback(device_t self) { struct pcic_softc *sc = device_private(self); pcic_attach_sockets(sc); }
void pcic_isapnp_attach(struct device *parent, struct device *self, void *aux) { struct pcic_softc *sc = device_private(self); struct pcic_isa_softc *isc = device_private(self); struct isapnp_attach_args *ipa = aux; isa_chipset_tag_t ic = ipa->ipa_ic; bus_space_tag_t iot = ipa->ipa_iot; bus_space_tag_t memt = ipa->ipa_memt; bus_space_handle_t ioh; bus_space_handle_t memh; bus_addr_t maddr; int msize; int tmp1; printf("\n"); if (isapnp_config(iot, memt, ipa)) { aprint_error_dev(&sc->dev, "error in region allocation\n"); return; } printf("%s: %s %s", device_xname(&sc->dev), ipa->ipa_devident, ipa->ipa_devclass); /* sanity check that we get at least one hunk of IO space.. */ if (ipa->ipa_nio < 1) { aprint_error_dev(&sc->dev, "failed to get one chunk of i/o space\n"); return; } /* Find i/o space. */ ioh = ipa->ipa_io[0].h; /* sanity check to make sure we have a real PCIC there.. */ bus_space_write_1(iot, ioh, PCIC_REG_INDEX, C0SA + PCIC_IDENT); tmp1 = bus_space_read_1(iot, ioh, PCIC_REG_DATA); printf("(ident 0x%x", tmp1); if (pcic_ident_ok(tmp1)) { printf(" OK)"); } else { printf(" Not OK)\n"); return; } msize = 0x4000; if (isa_mem_alloc (memt, msize, msize, 0, 0, &maddr, &memh)) { printf(": can't alloc mem space\n"); return; } printf(": using iomem 0x%lx iosiz 0x%x", maddr, msize); sc->membase = maddr; sc->subregionmask = (1 << (msize / PCIC_MEM_PAGESIZE)) - 1; isc->sc_ic = ic; sc->pct = (pcmcia_chipset_tag_t) & pcic_isa_functions; sc->iot = iot; sc->ioh = ioh; sc->memt = memt; sc->memh = memh; /* * allocate an irq. it will be used by both controllers. I could * use two different interrupts, but interrupts are relatively * scarce, shareable, and for PCIC controllers, very infrequent. */ if (ipa->ipa_nirq > 0) sc->irq = ipa->ipa_irq[0].num; else sc->irq = -1; printf("\n"); pcic_attach(sc); pcic_isa_bus_width_probe(sc, iot, ioh, ipa->ipa_io[0].base, ipa->ipa_io[0].length); pcic_attach_sockets(sc); config_interrupts(self, pcic_isa_config_interrupts); }