void * isa_intr_establish(isa_chipset_tag_t ic, int intr, int type, int level, int (*ih_fun)(void*), void *ih_arg) { struct vrisab_softc *sc = ic->ic_sc; int port, irq, mode; static int intr_modes[8] = { HPCIO_INTR_LEVEL_HIGH_THROUGH, HPCIO_INTR_LEVEL_HIGH_HOLD, HPCIO_INTR_LEVEL_LOW_THROUGH, HPCIO_INTR_LEVEL_LOW_HOLD, HPCIO_INTR_EDGE_THROUGH, HPCIO_INTR_EDGE_HOLD, HPCIO_INTR_EDGE_THROUGH, HPCIO_INTR_EDGE_HOLD, }; #ifdef VRISADEBUG static const char* intr_mode_names[8] = { "level high through", "level high hold", "level low through", "level low hold", "edge through", "edge hold", "edge through", "edge hold", }; #endif /* VRISADEBUG */ /* * ISA IRQ <-> GPIO port mapping */ irq = INTR_IRQ(intr); if (sc->sc_intr_map[irq] != -1) { /* already mapped */ intr = sc->sc_intr_map[irq]; } else { /* not mapped yet */ sc->sc_intr_map[irq] = intr; /* Register it */ } mode = INTR_MODE(intr); port = INTR_PORT(intr); VPRINTF(("ISA IRQ %d -> %s port %d, %s\n", irq, sc->sc_hc->hc_name, port, intr_mode_names[mode])); /* Call Vr routine */ return (hpcio_intr_establish(sc->sc_hc, port, intr_modes[mode], ih_fun, ih_arg)); }
static void vrc4172pci_attach(struct device *parent, struct device *self, void *aux) { struct vrc4172pci_softc *sc = (struct vrc4172pci_softc *)self; pci_chipset_tag_t pc = &sc->sc_pc; struct vrip_attach_args *va = aux; #if NPCI > 0 struct pcibus_attach_args pba; #endif sc->sc_iot = va->va_iot; if (bus_space_map(sc->sc_iot, va->va_addr, va->va_size, 0, &sc->sc_ioh)) { printf(": couldn't map io space\n"); return; } printf("\n"); #ifdef VRC4172PCI_MCR700_SUPPORT if (platid_match(&platid, &platid_mask_MACH_NEC_MCR_700) || platid_match(&platid, &platid_mask_MACH_NEC_MCR_700A) || platid_match(&platid, &platid_mask_MACH_NEC_MCR_730) || platid_match(&platid, &platid_mask_MACH_NEC_MCR_730A)) { /* power USB controller on MC-R700 */ sc->sc_iochip = va->va_gpio_chips[VRIP_IOCHIP_VRGIU]; hpcio_portwrite(sc->sc_iochip, 45, 1); sc->sc_fake_baseaddr = 0x0afe0000; #if 0 sc->sc_ih = hpcio_intr_establish(sc->sc_iochip, 1, HPCIO_INTR_EDGE|HPCIO_INTR_HOLD, vrc4172pci_mcr700_intr, sc); #endif } #endif /* VRC4172PCI_MCR700_SUPPORT */ pc->pc_dev = &sc->sc_dev; pc->pc_attach_hook = vrc4172pci_attach_hook; pc->pc_bus_maxdevs = vrc4172pci_bus_maxdevs; pc->pc_bus_devorder = vrc4172pci_bus_devorder; pc->pc_make_tag = vrc4172pci_make_tag; pc->pc_decompose_tag = vrc4172pci_decompose_tag; pc->pc_conf_read = vrc4172pci_conf_read; pc->pc_conf_write = vrc4172pci_conf_write; pc->pc_intr_map = vrc4172pci_intr_map; pc->pc_intr_string = vrc4172pci_intr_string; pc->pc_intr_evcnt = vrc4172pci_intr_evcnt; pc->pc_intr_establish = vrc4172pci_intr_establish; pc->pc_intr_disestablish = vrc4172pci_intr_disestablish; #if 0 { int i; for (i = 0; i < 2; i++) printf("%s: ID_REG(0, 0, %d) = 0x%08x\n", sc->sc_dev.dv_xname, i, pci_conf_read(pc, pci_make_tag(pc, 0, 0, i), PCI_ID_REG)); } #endif #if NPCI > 0 memset(&pba, 0, sizeof(pba)); pba.pba_iot = sc->sc_iot; pba.pba_memt = sc->sc_iot; pba.pba_dmat = &hpcmips_default_bus_dma_tag.bdt; pba.pba_dmat64 = NULL; pba.pba_bus = 0; pba.pba_bridgetag = NULL; pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED | PCI_FLAGS_MRL_OKAY; pba.pba_pc = pc; config_found_ia(self, "pcibus", &pba, pcibusprint); #endif }