int iq80321_pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp) { struct i80321_softc *sc = pa->pa_pc->pc_intr_v; int b, d, f; uint32_t busno; /* * The IQ80321's interrupts are routed like so: * * XINT0 i82544 Gig-E * * XINT1 UART * * XINT2 INTA# from S-PCI-X slot * * XINT3 INTB# from S-PCI-X slot */ busno = bus_space_read_4(sc->sc_st, sc->sc_atu_sh, ATU_PCIXSR); busno = PCIXSR_BUSNO(busno); if (busno == 0xff) busno = 0; pci_decompose_tag(pa->pa_pc, pa->pa_intrtag, &b, &d, &f); /* No mappings for devices not on our bus. */ if (b != busno) goto no_mapping; switch (d) { case 4: /* i82544 Gig-E */ if (pa->pa_intrpin == 1) { *ihp = ICU_INT_XINT(0); return (0); } goto no_mapping; case 6: /* S-PCI-X slot */ if (pa->pa_intrpin == 1) { *ihp = ICU_INT_XINT(2); return (0); } if (pa->pa_intrpin == 2) { *ihp = ICU_INT_XINT(3); return (0); } goto no_mapping; default: no_mapping: printf("iq80321_pci_intr_map: no mapping for %d/%d/%d\n", pa->pa_bus, pa->pa_device, pa->pa_function); return (1); } return (0); }
int iq80321_pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp) { struct i80321_softc *sc = pa->pa_pc->pc_intr_v; int b, d, f; uint32_t busno; busno = bus_space_read_4(sc->sc_st, sc->sc_atu_sh, ATU_PCIXSR); busno = PCIXSR_BUSNO(busno); if (busno == 0xff) busno = 0; pci_decompose_tag(pa->pa_pc, pa->pa_intrtag, &b, &d, &f); /* No mappings for devices not on our bus. */ if (b != busno) goto no_mapping; switch (d) { case 0: /* i82546EB Dual GigE */ /* * This is a dual-function chip which uses INTA and INTB, * connected to XINT0 and XINT1 respectively. */ if (f != 0 && f != 1) goto no_mapping; *ihp = ICU_INT_XINT(f); return (0); case 1: /* i31244 S-ATA Interface */ *ihp = ICU_INT_XINT(2); return (0); case 2: /* Symbios Logic 53c1010 SCSI Controllers */ case 3: /* * Both controllers share a single pin */ *ihp = ICU_INT_XINT(3); return (0); default: no_mapping: printf("iq80321_pci_intr_map: no mapping for %d/%d/%d/%c\n", pa->pa_bus, pa->pa_device, pa->pa_function, '@' + pa->pa_intrpin); return (1); } return (0); }
int iq80321_pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp) { struct i80321_softc *sc = pa->pa_pc->pc_intr_v; int b, d, f; uint32_t busno; busno = bus_space_read_4(sc->sc_st, sc->sc_atu_sh, ATU_PCIXSR); busno = PCIXSR_BUSNO(busno); if (busno == 0xff) busno = 0; pci_decompose_tag(pa->pa_pc, pa->pa_intrtag, &b, &d, &f); /* No mappings for devices not on our bus. */ if (b != busno) goto no_mapping; switch (d) { case 1: /* PCIX-PCIX bridge */ /* * The S-ATA chips are behind the bridge, and all of * the S-ATA interrupts are wired together. */ *ihp = ICU_INT_XINT(2); return (0); case 2: /* PCI slot */ /* All pins are wired together. */ *ihp = ICU_INT_XINT(3); return (0); case 3: /* i82546 dual Gig-E */ if (pa->pa_intrpin == 1 || pa->pa_intrpin == 2) { *ihp = ICU_INT_XINT(0); return (0); } goto no_mapping; default: no_mapping: printf("iq80321_pci_intr_map: no mapping for %d/%d/%d/%c\n", pa->pa_bus, pa->pa_device, pa->pa_function, '@' + pa->pa_intrpin); return (1); } return (0); }
int iyonix_pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp) { struct i80321_softc *sc = pa->pa_pc->pc_intr_v; int b, d, f; uint32_t busno; busno = bus_space_read_4(sc->sc_st, sc->sc_atu_sh, ATU_PCIXSR); busno = PCIXSR_BUSNO(busno); if (busno == 0xff) busno = 0; pci_decompose_tag(pa->pa_pc, pa->pa_intrtag, &b, &d, &f); /* No mappings for devices not on our bus. */ if (b != busno) goto no_mapping; /* * XXX We currently deal only with the southbridge and with * regular PCI. IOC devices may need further attention. */ /* Devices on the southbridge are all routed through xint 1 */ if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ALI) { switch (PCI_PRODUCT(pa->pa_id)) { case PCI_PRODUCT_ALI_M1543: /* Southbridge */ case PCI_PRODUCT_ALI_M5229: /* ATA */ case PCI_PRODUCT_ALI_M5237: /* ohci */ case PCI_PRODUCT_ALI_M5257: /* Modem */ case PCI_PRODUCT_ALI_M5451: /* AC97 */ case PCI_PRODUCT_ALI_M7101: /* PMC */ *ihp = ICU_INT_XINT(1); return (0); } } /* Route other interrupts with default swizzling rule */ *ihp = ICU_INT_XINT((d + pa->pa_intrpin - 1) % 4); return 0; no_mapping: printf("iyonix_pci_intr_map: no mapping for %d/%d/%d\n", pa->pa_bus, pa->pa_device, pa->pa_function); return (1); }
extern int machdep_pci_route_interrupt(device_t pcib, device_t dev, int pin) { int bus; int device; int func; uint32_t busno; struct i80321_pci_softc *sc = device_get_softc(pcib); bus = pci_get_bus(dev); device = pci_get_slot(dev); func = pci_get_function(dev); busno = bus_space_read_4(sc->sc_st, sc->sc_atu_sh, ATU_PCIXSR); busno = PCIXSR_BUSNO(busno); if (busno == 0xff) busno = 0; if (bus != busno) goto no_mapping; switch (device) { /* IQ31244 PCI */ case 1: /* PCIX-PCIX bridge */ /* * The S-ATA chips are behind the bridge, and all of * the S-ATA interrupts are wired together. */ return (ICU_INT_XINT(2)); case 2: /* PCI slot */ /* All pins are wired together. */ return (ICU_INT_XINT(3)); case 3: /* i82546 dual Gig-E */ if (pin == 1 || pin == 2) return (ICU_INT_XINT(0)); goto no_mapping; /* IQ80321 PCI */ case 4: /* i82544 Gig-E */ case 8: /* * Apparently you can set the device for the ethernet adapter * to 8 with a jumper, so handle that as well */ if (pin == 1) return (ICU_INT_XINT(0)); goto no_mapping; case 6: /* S-PCI-X slot */ if (pin == 1) return (ICU_INT_XINT(2)); if (pin == 2) return (ICU_INT_XINT(3)); goto no_mapping; default: no_mapping: printf("No mapping for %d/%d/%d/%c\n", bus, device, func, pin); } return (0); }
extern int machdep_pci_route_interrupt(device_t pcib, device_t dev, int pin) { int bus; int device; int func; uint32_t busno; struct i80321_pci_softc *sc = device_get_softc(pcib); bus = pci_get_bus(dev); device = pci_get_slot(dev); func = pci_get_function(dev); busno = bus_space_read_4(sc->sc_st, sc->sc_atu_sh, ATU_PCIXSR); busno = PCIXSR_BUSNO(busno); if (busno == 0xff) busno = 0; if (bus != busno) goto no_mapping; switch (device) { /* EP80219 PCI */ case 1: /* Ethernet i82555 10/100 */ printf("Device %d routed to irq %d\n", device, ICU_INT_XINT(0)); return (ICU_INT_XINT(0)); case 2: /* UART */ printf("Device %d routed to irq %d\n", device, ICU_INT_XINT(1)); return (ICU_INT_XINT(1)); case 3: /* * The S-ATA chips are behind the bridge, and all of * the S-ATA interrupts are wired together. */ printf("Device %d routed to irq %d\n", device, ICU_INT_XINT(2)); return (ICU_INT_XINT(2)); case 4: /* MINI-PIC_INT */ printf("Device %d routed to irq %d\n", device, ICU_INT_XINT(3)); return( ICU_INT_XINT(3)); default: no_mapping: printf("No mapping for %d/%d/%d/%c\n", bus, device, func, pin); } return (0); }
int obio_search(struct device *parent, void *v, void *aux) { struct obio_attach_args oba; struct cfdata *cf = v; oba.oba_st = &obio_bs_tag; oba.oba_addr = cf->cf_loc[0]; oba.oba_size = cf->cf_loc[1]; oba.oba_width = cf->cf_loc[2]; if (cf->cf_loc[3] != -1) oba.oba_irq = ICU_INT_XINT(cf->cf_loc[3]); else oba.oba_irq = -1; config_found(parent, &oba, obio_print); return (0); }
uint8_t bus; uint8_t dev; pci_vendor_id_t vend; pci_product_id_t prod; }; struct board_id { char *name; struct irq_map *irq_map; struct pci_id_list list[]; }; struct irq_map *iq80321_irq_map; struct irq_map iq80321_thecus_irq_map[] = { { 1, 1, ICU_INT_XINT(0) }, /* thecus re0 27 */ { 2, 1, ICU_INT_XINT(3) }, /* thecus re1 30 */ { 3, 1, ICU_INT_XINT(2) }, /* thecus sata 29 */ { 4, 1, ICU_INT_XINT(0) }, /* thecus uhci0 27 ??? */ { 4, 2, ICU_INT_XINT(0) }, /* thecus uhci1 27 */ { 4, 3, ICU_INT_XINT(2) }, /* thecus ehci0 29 */ { 5, 1, ICU_INT_XINT(3) }, /* thecus minipci slot */ { 0, 0, 255} }; struct irq_map iq80321_hdlg_irq_map[] = { { 1, 1, ICU_INT_XINT(0) }, /* em0 27 */ { 2, 1, ICU_INT_XINT(1) }, /* wdc0 28 */ { 3, 1, ICU_INT_XINT(2) }, /* ochi0 29 */ { 3, 2, ICU_INT_XINT(2) }, /* ochi0 29 */ { 3, 3, ICU_INT_XINT(2) }, /* echi0 29 */
int hdlg_pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp) { struct i80321_softc *sc = pa->pa_pc->pc_intr_v; uint32_t busno; int b, d, f; /* * GigaLANDISK's interrupts are routed like so: * * XINT0 Intel i82541PI Gig-E * * XINT1 ACARD ATP875-A * * XINT2 NEC echi/ochi * * XINT3 UART */ busno = bus_space_read_4(sc->sc_st, sc->sc_atu_sh, ATU_PCIXSR); busno = PCIXSR_BUSNO(busno); if (busno == 0xff) busno = 0; pci_decompose_tag(pa->pa_pc, pa->pa_intrtag, &b, &d, &f); /* No mappings for devices not on our bus. */ if (b != busno) goto no_mapping; switch (d) { case 1: /* i82541PI Gig-E */ if (pa->pa_intrpin == 1) { *ihp = ICU_INT_XINT(0); return 0; } goto no_mapping; case 2: /* ATP875-A */ if (pa->pa_intrpin == 1) { *ihp = ICU_INT_XINT(1); return 0; } goto no_mapping; case 3: /* echi/ochi */ switch (pa->pa_intrpin) { case 1: /* ohci */ case 2: /* ohci */ case 3: /* ehci */ *ihp = ICU_INT_XINT(2); return 0; } goto no_mapping; default: no_mapping: printf("hdlg_pci_intr_map: no mapping for %d/%d/%d\n", pa->pa_bus, pa->pa_device, pa->pa_function); return 1; } return 0; }