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 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 (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 void eisa_probe_nomatch(device_t dev, device_t child) { u_int32_t eisa_id = eisa_get_id(child); u_int8_t slot = eisa_get_slot(child); device_printf(dev, "%c%c%c%03x%01x (0x%08x) at slot %d (no driver attached)\n", EISA_MFCTR_CHAR0(eisa_id), EISA_MFCTR_CHAR1(eisa_id), EISA_MFCTR_CHAR2(eisa_id), EISA_PRODUCT_ID(eisa_id), EISA_REVISION_ID(eisa_id), eisa_id, slot); return; }
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 mainboard_probe(device_t dev) { char *idstring; eisa_id_t id = eisa_get_id(dev); if (eisa_get_slot(dev) != 0) return (ENXIO); idstring = (char *)malloc(8 + sizeof(" (System Board)") + 1, M_DEVBUF, M_NOWAIT); if (idstring == NULL) panic("Eisa probe unable to malloc"); sprintf(idstring, "%c%c%c%03x%01x (System Board)", EISA_MFCTR_CHAR0(id), EISA_MFCTR_CHAR1(id), EISA_MFCTR_CHAR2(id), EISA_PRODUCT_ID(id), EISA_REVISION_ID(id)); device_set_desc(dev, idstring); return (0); }
static int eisa_print_child(device_t dev, device_t child) { struct eisa_device * e_dev = device_get_ivars(child); int rid; struct irq_node * irq; struct resvaddr * resv; int retval = 0; retval += bus_print_child_header(dev, child); rid = 0; while ((resv = eisa_find_ioaddr(e_dev, rid++))) { if (resv->size == 1 || (resv->flags & RESVADDR_BITMASK)) retval += printf("%s%lx", rid == 1 ? " port 0x" : ",0x", resv->addr); else retval += printf("%s%lx-0x%lx", rid == 1 ? " port 0x" : ",0x", resv->addr, resv->addr + resv->size - 1); } rid = 0; while ((resv = eisa_find_maddr(e_dev, rid++))) { if (resv->size == 1 || (resv->flags & RESVADDR_BITMASK)) retval += printf("%s%lx", rid == 1 ? " mem 0x" : ",0x", resv->addr); else retval += printf("%s%lx-0x%lx", rid == 1 ? " mem 0x" : ",0x", resv->addr, resv->addr + resv->size - 1); } rid = 0; while ((irq = eisa_find_irq(e_dev, rid++)) != NULL) retval += printf(" irq %d (%s)", irq->irq_no, irq->irq_trigger ? "level" : "edge"); retval += printf(" at slot %d on %s\n", eisa_get_slot(child), device_get_nameunit(dev)); return (retval); }
static int vx_eisa_probe(device_t dev) { const char *desc; u_long iobase; u_long port; desc = vx_match(eisa_get_id(dev)); if (!desc) return (ENXIO); device_set_desc(dev, desc); port = eisa_get_slot(dev) * EISA_SLOT_SIZE; iobase = port + VX_EISA_SLOT_OFFSET; eisa_add_iospace(dev, iobase, VX_EISA_IOSIZE, RESVADDR_NONE); eisa_add_iospace(dev, port, VX_IOSIZE, RESVADDR_NONE); /* Set irq */ eisa_add_intr(dev, inw(iobase + VX_RESOURCE_CONFIG) >> 12, EISA_TRIGGER_EDGE); 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); }