static int adv_eisa_probe(device_t dev) { const char *desc; u_int32_t iobase; u_int8_t irq; desc = adv_eisa_match(eisa_get_id(dev)); if (!desc) return (ENXIO); device_set_desc(dev, desc); iobase = (eisa_get_slot(dev) * EISA_SLOT_SIZE) + ADV_EISA_SLOT_OFFSET; eisa_add_iospace(dev, iobase, ADV_EISA_IOSIZE, RESVADDR_NONE); irq = inb(iobase + ADV_EISA_IRQ_BURST_LEN_REG); irq &= ADV_EISA_IRQ_MASK; switch (irq) { case 0: case 1: case 2: case 4: case 5: break; default: printf("adv at slot %d: illegal " "irq setting %d\n", eisa_get_slot(dev), irq); return ENXIO; } eisa_add_intr(dev, irq + 10, EISA_TRIGGER_LEVEL); return 0; }
static int dpt_eisa_probe (device_t dev) { const char * desc; u_int32_t io_base; dpt_conf_t * conf; desc = dpt_eisa_match(eisa_get_id(dev)); if (!desc) return (ENXIO); device_set_desc(dev, desc); io_base = (eisa_get_slot(dev) * EISA_SLOT_SIZE) + DPT_EISA_SLOT_OFFSET + DPT_EISA_EATA_REG_OFFSET; conf = dpt_pio_get_conf(io_base); if (!conf) { printf("dpt: dpt_pio_get_conf() failed.\n"); return (ENXIO); } eisa_add_iospace(dev, io_base, DPT_EISA_IOSIZE, RESVADDR_NONE); eisa_add_intr(dev, conf->IRQ, (conf->IRQ_TR ? EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE)); return 0; }
static int ahbprobe(device_t dev) { const char *desc; u_int32_t iobase; u_int32_t irq; u_int8_t intdef; int shared; desc = ahbmatch(eisa_get_id(dev)); if (!desc) return (ENXIO); device_set_desc(dev, desc); iobase = (eisa_get_slot(dev) * EISA_SLOT_SIZE) + AHB_EISA_SLOT_OFFSET; eisa_add_iospace(dev, iobase, AHB_EISA_IOSIZE, RESVADDR_NONE); intdef = inb(INTDEF + iobase); switch (intdef & 0x7) { case INT9: irq = 9; break; case INT10: irq = 10; break; case INT11: irq = 11; break; case INT12: irq = 12; break; case INT14: irq = 14; break; case INT15: irq = 15; break; default: printf("Adaptec 174X at slot %d: illegal " "irq setting %d\n", eisa_get_slot(dev), (intdef & 0x7)); irq = 0; break; } if (irq == 0) return ENXIO; shared = (inb(INTDEF + iobase) & INTLEVEL) ? EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE; eisa_add_intr(dev, irq, shared); return 0; }
static int dpt_eisa_probe(void) { struct eisa_device *e_dev = NULL; int count; u_int32_t io_base; u_int intdef; u_int irq; e_dev = NULL; count = 0; while ((e_dev = eisa_match_dev(e_dev, dpt_eisa_match))) { io_base = (e_dev->ioconf.slot * EISA_SLOT_SIZE) + DPT_EISA_SLOT_OFFSET; eisa_add_iospace(e_dev, io_base, DPT_EISA_IOSIZE, RESVADDR_NONE); intdef = inb(DPT_EISA_INTDEF + io_base); irq = intdef & DPT_EISA_INT_NUM_MASK; switch (irq) { case DPT_EISA_INT_NUM_11: irq = 11; break; case DPT_EISA_INT_NUM_15: irq = 15; break; case DPT_EISA_INT_NUM_14: irq = 14; break; default: printf("dpt at slot %d: illegal irq setting %d\n", e_dev->ioconf.slot, irq); irq = 0; break; } if (irq == 0) continue; eisa_add_intr(e_dev, irq); eisa_registerdev(e_dev, &dpt_eisa_driver); count++; } return count; }
static int ida_eisa_probe(device_t dev) { struct ida_board *board; u_int32_t io_base; u_int irq = 0; board = ida_eisa_match(eisa_get_id(dev)); if (board == NULL) return (ENXIO); device_set_desc(dev, board->desc); io_base = (eisa_get_slot(dev) * EISA_SLOT_SIZE); switch (IDA_EISA_IRQ_MASK & (inb(IDA_EISA_IRQ_REG + io_base))) { case IDA_EISA_IRQ_15: irq = 15; break; case IDA_EISA_IRQ_14: irq = 14; break; case IDA_EISA_IRQ_11: irq = 11; break; case IDA_EISA_IRQ_10: irq = 10; break; default: device_printf(dev, "slot %d, illegal irq setting.\n", eisa_get_slot(dev)); return (ENXIO); } eisa_add_iospace(dev, (io_base + IDA_EISA_IOPORT_START), IDA_EISA_IOPORT_LEN, RESVADDR_NONE); eisa_add_intr(dev, irq, EISA_TRIGGER_LEVEL); /* XXX ??? */ return (0); }
static int bt_eisa_probe(device_t dev) { const char *desc; u_long iobase; struct bt_probe_info info; u_long port; u_long iosize; u_int ioconf; int result; int shared; desc = bt_match(eisa_get_id(dev)); if (!desc) return (ENXIO); device_set_desc(dev, desc); iobase = (eisa_get_slot(dev) * EISA_SLOT_SIZE); if (eisa_get_id(dev) == EISA_DEVICE_ID_AMI_4801) { u_int ioconf1; iobase += AMI_EISA_SLOT_OFFSET; iosize = AMI_EISA_IOSIZE; ioconf1 = inb(iobase + AMI_EISA_IOCONF1); /* Determine "ISA" I/O port */ switch (ioconf1 & AMI_PORTADDR) { case AMI_PORT_330: port = 0x330; break; case AMI_PORT_334: port = 0x334; break; case AMI_PORT_230: port = 0x230; break; case AMI_PORT_234: port = 0x234; break; case AMI_PORT_134: port = 0x134; break; case AMI_PORT_130: port = 0x130; break; default: /* Disabled */ printf("bt: AMI EISA Adapter at " "slot %d has a disabled I/O " "port. Cannot attach.\n", eisa_get_slot(dev)); return (ENXIO); } shared = (inb(iobase + AMI_EISA_IOCONF1) & AMI_IRQ_LEVEL) ? EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE; } else { iobase += BT_EISA_SLOT_OFFSET; iosize = BT_EISA_IOSIZE; ioconf = inb(iobase + EISA_IOCONF); /* Determine "ISA" I/O port */ switch (ioconf & PORTADDR) { case PORT_330: port = 0x330; break; case PORT_334: port = 0x334; break; case PORT_230: port = 0x230; break; case PORT_234: port = 0x234; break; case PORT_130: port = 0x130; break; case PORT_134: port = 0x134; break; default: /* Disabled */ printf("bt: Buslogic EISA Adapter at " "slot %d has a disabled I/O " "port. Cannot attach.\n", eisa_get_slot(dev)); return (ENXIO); } shared = (inb(iobase + EISA_IRQ_TYPE) & LEVEL) ? EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE; } bt_mark_probed_iop(port); /* Tell parent where our resources are going to be */ eisa_add_iospace(dev, iobase, iosize, RESVADDR_NONE); eisa_add_iospace(dev, port, BT_IOSIZE, RESVADDR_NONE); /* And allocate them */ bt_eisa_alloc_resources(dev); if (bt_port_probe(dev, &info) != 0) { printf("bt_eisa_probe: Probe failed for " "card at slot 0x%x\n", eisa_get_slot(dev)); result = ENXIO; } else { eisa_add_intr(dev, info.irq, shared); result = 0; } bt_eisa_release_resources(dev); return (result); }
static int ep_eisa_probe(device_t dev) { const char *desc; u_long iobase; u_short conf; u_long port; int irq; int int_trig; desc = ep_match(eisa_get_id(dev)); if (!desc) return (ENXIO); device_set_desc(dev, desc); port = (eisa_get_slot(dev) * EISA_SLOT_SIZE); iobase = port + EP_EISA_SLOT_OFFSET; /* We must be in EISA configuration mode */ if ((inw(iobase + EP_W0_ADDRESS_CFG) & 0x1f) != 0x1f) return (ENXIO); eisa_add_iospace(dev, iobase, EP_EISA_IOSIZE, RESVADDR_NONE); eisa_add_iospace(dev, port, EP_IOSIZE, RESVADDR_NONE); conf = inw(iobase + EISA_IOCONF); /* Determine our IRQ */ switch (conf & IRQ_CHANNEL) { case INT_3: irq = 3; break; case INT_5: irq = 5; break; case INT_7: irq = 7; break; case INT_9: irq = 9; break; case INT_10: irq = 10; break; case INT_11: irq = 11; break; case INT_12: irq = 12; break; case INT_15: irq = 15; break; default: /* Disabled */ printf("ep: 3COM Network Adapter at " "slot %d has its IRQ disabled. " "Probe failed.\n", eisa_get_slot(dev)); return (ENXIO); } switch (eisa_get_id(dev)) { case EISA_DEVICE_ID_3COM_3C579_BNC: case EISA_DEVICE_ID_3COM_3C579_TP: int_trig = EISA_TRIGGER_LEVEL; break; default: int_trig = EISA_TRIGGER_EDGE; break; } eisa_add_intr(dev, irq, int_trig); return (0); }
static int aic7770_probe(device_t dev) { struct aic7770_identity *entry; struct resource *regs; uint32_t iobase; bus_space_handle_t bsh; bus_space_tag_t tag; u_int irq; u_int intdef; u_int hcntrl; int shared; int rid; int error; entry = aic7770_find_device(eisa_get_id(dev)); if (entry == NULL) return (ENXIO); device_set_desc(dev, entry->name); iobase = (eisa_get_slot(dev) * EISA_SLOT_SIZE) + AHC_EISA_SLOT_OFFSET; eisa_add_iospace(dev, iobase, AHC_EISA_IOSIZE, RESVADDR_NONE); rid = 0; regs = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); if (regs == NULL) { device_printf(dev, "Unable to map I/O space?!\n"); return ENOMEM; } tag = rman_get_bustag(regs); bsh = rman_get_bushandle(regs); error = 0; /* Pause the card preseving the IRQ type */ hcntrl = bus_space_read_1(tag, bsh, HCNTRL) & IRQMS; bus_space_write_1(tag, bsh, HCNTRL, hcntrl | PAUSE); while ((bus_space_read_1(tag, bsh, HCNTRL) & PAUSE) == 0) ; /* Make sure we have a valid interrupt vector */ intdef = bus_space_read_1(tag, bsh, INTDEF); shared = (intdef & EDGE_TRIG) ? EISA_TRIGGER_EDGE : EISA_TRIGGER_LEVEL; irq = intdef & VECTOR; switch (irq) { case 9: case 10: case 11: case 12: case 14: case 15: break; default: printf("aic7770 at slot %d: illegal irq setting %d\n", eisa_get_slot(dev), intdef); error = ENXIO; } if (error == 0) eisa_add_intr(dev, irq, shared); bus_release_resource(dev, SYS_RES_IOPORT, rid, regs); return (error); }
int dpt_eisa_probe(void) { static int already_announced = 0; u_int32_t io_base; u_int32_t irq; struct eisa_device *e_dev = NULL; dpt_conf_t *config; dpt_softc_t *dpt; int count = 0; if ( bootverbose && !already_announced ) { printf("DPT: EISA SCSI HBA Driver, version %d.%d.%d\n", DPT_RELEASE, DPT_VERSION, DPT_PATCH); ++already_announced; } if ((dpt = (dpt_softc_t *) malloc(sizeof(dpt_softc_t), M_DEVBUF, M_NOWAIT)) == NULL) { printf("dpt_eisa_probe() : Failed to allocate %d bytes for a DPT softc\n", sizeof(dpt_softc_t)); return -1; } bzero(dpt, sizeof(dpt_softc_t)); TAILQ_INIT(&dpt->free_ccbs); TAILQ_INIT(&dpt->waiting_ccbs); TAILQ_INIT(&dpt->submitted_ccbs); TAILQ_INIT(&dpt->completed_ccbs); dpt->queue_status = DPT_QUEUES_NONE_ACTIVE; dpt->commands_processed = 0; dpt->handle_interrupts = 0; dpt->v_membase = NULL; dpt->p_membase = NULL; dpt->unit = -1; while ((e_dev = eisa_match_dev(e_dev, dpt_eisa_match))) { io_base = (e_dev->ioconf.slot * EISA_SLOT_SIZE) + DPT_EISA_SLOT_OFFSET; eisa_add_iospace(e_dev, io_base, DPT_EISA_IOSIZE, RESVADDR_NONE); dpt->io_base = io_base; if ((config = dpt_get_conf(dpt, 0xc1, 7, sizeof(dpt_conf_t), 1)) == NULL) { #ifdef DPT_DEBUG_ERROR printf("eisa0:%d dpt_eisa_probe() : Failed to get board configuration.\n", e_dev->ioconf.slot); #endif continue; } irq = config->IRQ; eisa_add_intr(e_dev, irq); eisa_registerdev(e_dev, &dpt_eisa_driver); count++; } free(dpt, M_DEVBUF); return count; }