FreeBSD/sys/dev/buslogic/bt_isa.c
/*
 * Check if the device can be found at the port given
 * and if so, set it up ready for further work
 * as an argument, takes the isa_device structure from
 * autoconf.c
 */
Check if the device can be found at the port given
and if so, set it up ready for further work
as an argument, takes the isa_device structure from
autoconf.c
Check if the device can be found at the port given and if so set it up ready for further work as an argument takes the isa_device structure from autoconf . c
static int
bt_isa_probe(device_t dev)
{
	int	port_index;
        int	max_port_index;
	if (isa_get_vendorid(dev))
		return (ENXIO);
	port_index = 0;
	max_port_index = BT_NUM_ISAPORTS - 1;
	bt_find_probe_range(isa_get_port(dev), &port_index, &max_port_index);
	if (port_index < 0)
		return (ENXIO);
	for (;port_index <= max_port_index; port_index++) {
		struct bt_probe_info info;
		u_int ioport;
		ioport = bt_iop_from_bio(port_index);
		if (bt_check_probed_iop(ioport) != 0)
			continue;
		if (bt_isa_alloc_resources(dev, ioport,
					   ioport + BT_NREGS -1) != 0)
			continue;
		bt_mark_probed_bio(port_index);
		if (bt_port_probe(dev, &info) != 0) {
			if (bootverbose)
				printf("bt_isa_probe: Probe failed at 0x%x\n",
				       ioport);
			bt_isa_release_resources(dev);
			continue;
		}
		bt_isa_release_resources(dev);
		bus_set_resource(dev, SYS_RES_DRQ, 0, info.drq, 1);
		bus_set_resource(dev, SYS_RES_IRQ, 0, info.irq, 1);
		return (BUS_PROBE_DEFAULT);
	}
	return (ENXIO);
}
static int bt_isa_probe ( device_t dev ) { int port_index ; int max_port_index ; if ( isa_get_vendorid ( dev ) ) return ( ENXIO ) ; port_index = 0 ; max_port_index = BT_NUM_ISAPORTS - 1 ; bt_find_probe_range ( isa_get_port ( dev ) , & port_index , & max_port_index ) ; if ( port_index < 0 ) return ( ENXIO ) ; for ( ; port_index <= max_port_index ; port_index ++ ) { struct bt_probe_info info ; u_int ioport ; ioport = bt_iop_from_bio ( port_index ) ; if ( bt_check_probed_iop ( ioport ) != 0 ) continue ; if ( bt_isa_alloc_resources ( dev , ioport , ioport + BT_NREGS - 1 ) != 0 ) continue ; bt_mark_probed_bio ( port_index ) ; if ( bt_port_probe ( dev , & info ) != 0 ) { if ( bootverbose ) printf ( " \n " , ioport ) ; bt_isa_release_resources ( dev ) ; continue ; } bt_isa_release_resources ( dev ) ; bus_set_resource ( dev , SYS_RES_DRQ , 0 , info . drq , 1 ) ; bus_set_resource ( dev , SYS_RES_IRQ , 0 , info . irq , 1 ) ; return ( BUS_PROBE_DEFAULT ) ; } return ( ENXIO ) ; }
Check if the device can be found at the port given
 and if so, set it up ready for further work
 as an argument, takes the isa_device structure from
 autoconf.c
Check if the device can be found at the port given and if so set it up ready for further work as an argument takes the isa_device structure from autoconf . c
/*
	 * find unit and check we have that many defined
	 */ /* No pnp support */ /*
	 * Bound our board search if the user has
	 * specified an exact port.
	 */ /* Attempt to find an adapter */ /*
		 * Ensure this port has not already been claimed already
		 * by a PCI, EISA or ISA adapter.
		 */ /* Initialise the softc for use during probing */ /* We're going to attempt to probe it now, so mark it probed */