FreeBSD/sys/isa/isa_common.c
/*
 * Attempt to find a working set of resources for a device. Return
 * non-zero if a working configuration is found.
 */
Attempt to find a working set of resources for a device. Return
non-zero if a working configuration is found.
Attempt to find a working set of resources for a device . Return non - zero if a working configuration is found .
static int
isa_assign_resources(device_t child)
{
	struct isa_device *idev = DEVTOISA(child);
	struct isa_config_entry *ice;
	struct isa_config *cfg;
	const char *reason;
	reason = "Empty ISA id_configs";
	cfg = malloc(sizeof(struct isa_config), M_TEMP, M_NOWAIT|M_ZERO);
	if (cfg == NULL)
		return(0);
	TAILQ_FOREACH(ice, &idev->id_configs, ice_link) {
		reason = "memory";
		if (!isa_find_memory(child, &ice->ice_config, cfg))
			continue;
		reason = "port";
		if (!isa_find_port(child, &ice->ice_config, cfg))
			continue;
		reason = "irq";
		if (!isa_find_irq(child, &ice->ice_config, cfg))
			continue;
		reason = "drq";
		if (!isa_find_drq(child, &ice->ice_config, cfg))
			continue;
		reason = "no callback";
		if (idev->id_config_cb) {
			idev->id_config_cb(idev->id_config_arg,
					   cfg, 1);
			free(cfg, M_TEMP);
			return (1);
		}
	}
	bus_print_child_header(device_get_parent(child), child);
	printf(" can't assign resources (%s)\n", reason);
	if (bootverbose)
		isa_print_child(device_get_parent(child), child);
	bzero(cfg, sizeof (*cfg));
	if (idev->id_config_cb)
		idev->id_config_cb(idev->id_config_arg, cfg, 0);
	device_disable(child);
	free(cfg, M_TEMP);
	return (0);
}
static int isa_assign_resources ( device_t child ) { struct isa_device * idev = DEVTOISA ( child ) ; struct isa_config_entry * ice ; struct isa_config * cfg ; const char * reason ; reason = " " ; cfg = malloc ( sizeof ( struct isa_config ) , M_TEMP , M_NOWAIT | M_ZERO ) ; if ( cfg == NULL ) return ( 0 ) ; TAILQ_FOREACH ( ice , & idev -> id_configs , ice_link ) { reason = " " ; if ( ! isa_find_memory ( child , & ice -> ice_config , cfg ) ) continue ; reason = " " ; if ( ! isa_find_port ( child , & ice -> ice_config , cfg ) ) continue ; reason = " " ; if ( ! isa_find_irq ( child , & ice -> ice_config , cfg ) ) continue ; reason = " " ; if ( ! isa_find_drq ( child , & ice -> ice_config , cfg ) ) continue ; reason = " " ; if ( idev -> id_config_cb ) { idev -> id_config_cb ( idev -> id_config_arg , cfg , 1 ) ; free ( cfg , M_TEMP ) ; return ( 1 ) ; } } bus_print_child_header ( device_get_parent ( child ) , child ) ; printf ( " \n " , reason ) ; if ( bootverbose ) isa_print_child ( device_get_parent ( child ) , child ) ; bzero ( cfg , sizeof ( * cfg ) ) ; if ( idev -> id_config_cb ) idev -> id_config_cb ( idev -> id_config_arg , cfg , 0 ) ; device_disable ( child ) ; free ( cfg , M_TEMP ) ; return ( 0 ) ; }
Attempt to find a working set of resources for a device.
Attempt to find a working set of resources for a device .
/*
		 * A working configuration was found enable the device 
		 * with this configuration.
		 */ /*
	 * Disable the device.
	 */