Beispiel #1
0
/*
** Detect the controller and register the SIM with the CAM layer.
** returns the number of controllers installed...
*/
static int
sim_install_symbios(void)
{
    int i, j, iobase, irq;
    int cardcount = 0;
    pci_info h;
    CAM_SIM_ENTRY entry;

    dprintf("symbios: sim_install()\n");

    for (i = 0; ; i++) {
		if ((*pci->get_nth_pci_info) (i, &h) != B_NO_ERROR) {
			/*if(!cardcount) d_printf("symbios: no controller found\n");*/
			break;
		}

//		d_printf("scan: %04x %04x %02x\n", h.device_id, h.vendor_id, h.revision);

#define PCI_VENDOR_SYMBIOS 0x1000

		if(h.vendor_id == PCI_VENDOR_SYMBIOS) {
			for(j=0;devinfo[j].id;j++){
				if((devinfo[j].id == h.device_id) && (h.revision >= devinfo[j].rev)){
					iobase = h.u.h0.base_registers[0];
					irq = h.u.h0.interrupt_line;
					d_printf("symbios%d: %s controller @ 0x%08x, irq %d\n",
							 cardcount, devinfo[j].name, iobase, irq);

					if(cardcount == MAXCARDS){
						d_printf("symbios: too many controllers!\n");
						return cardcount;
					}

					if((cardinfo[cardcount]=create_cardinfo(cardcount,&h,devinfo[j].flags)) != NULL){
						cardinfo[cardcount]->name = devinfo[j].name;
						entry.sim_init = sim_init_funcs[cardcount];
						entry.sim_action = sim_action_funcs[cardcount];
						cardinfo[cardcount]->registered = 0;
						register_stats(cardinfo[cardcount]);

						(*cam->xpt_bus_register)(&entry);
						cardcount++;
					} else {
						d_printf("symbios%d: cannot allocate cardinfo\n",cardcount);
					}
					break;
				}
			}
		}
    }

    return cardcount;
}
Beispiel #2
0
/*
** Detect the controller and register the SIM with the CAM layer.
** returns the number of controllers installed...
*/
static int
sim_install_buslogic(void)
{
    int i, iobase, irq;
    int cardcount = 0;
    pci_info h;
    CAM_SIM_ENTRY entry;

    /* d_printf("buslogic: sim_install()\n"); */

    for (i = 0; ; i++) {
        if ((*pci->get_nth_pci_info) (i, &h) != B_NO_ERROR) {
            /* if(!cardcount) d_printf("buslogic: no controller found\n"); */
            break;
        }

        if ((h.vendor_id == PCI_VENDOR_BUSLOGIC) &&
                (h.device_id == PCI_DEVICE_MULTIMASTER)) {

#ifdef __INTEL__
            iobase = h.u.h0.base_registers[0];
#else
            iobase = h.u.h0.base_registers[1];
#endif
            irq = h.u.h0.interrupt_line;

            d_printf("buslogic%d: controller @ 0x%08x, irq %d\n",
                     cardcount, iobase, irq);
            if((irq == 0) || (irq > 128)) {
                dprintf("buslogic%d: bad irq %d\n",cardcount,irq);
                continue;
            }

            if(cardcount == MAXCARDS) {
                d_printf("buslogic: too many controllers!\n");
                return cardcount;
            }

            if((cardinfo[cardcount] = create_cardinfo(cardcount,iobase,irq))) {
                entry.sim_init = sim_init_funcs[cardcount];
                entry.sim_action = sim_action_funcs[cardcount];
                (*cam->xpt_bus_register)(&entry);
                cardcount++;
            } else {
                d_printf("buslogic: cannot allocate cardinfo\n");
            }
        }
    }

    return cardcount;
}