File:  [Apple Darwin 0.x] / driverkit / notes / autoconfigScan
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:37:50 2018 UTC (8 years, 3 months ago) by root
Branches: MAIN, Apple
CVS tags: HEAD, Darwin03, Darwin02
Darwin 0.2 Driver Kit

struct device_slot {
	dev_num
	slot_id
	dev_type
	link
}

config_scan(
	boolean_t all_devices,
	slot_id_t slot_id,
	dev_type_t dev_type) 
{
	dev_num = 0;
	
	/*
	 * Scan hardware
	 */
	do {
		get_dev_type(dev_num);
		if error
			continue;
		if all_devices or dev_type and slot_id match our args
			make a new device_slot, add to dev_slot_list;	
	} while drtn != no more devices;
	
	/*
	 * Create new dev_entry's
	 */
	for each entry in dev_slot_list {
		if get_driver_entry(dev_num) != NULL
			continue;		// already have it
		if(fid = get_driver_file(device_slot) != NULL) {
			if(get_driver_entry(fid) != NULL) {
				create_dev_entry(driver_entry, dev_num,
					dev_type, slot_id);
			}
			else {
				driver_entry = create_driver_entry(fid,
					filename);
				create_dev_entry(driver_entry, dev_num,
					dev_type, slot_id);
			}
		}
		else log no driver for this device;
	}
	
	/*
	 * exec new drivers. have to do after last loop complete so each 
	 * driver sees all of its dev_ports.
	 */
	for each entry in driver_list {
		if(!running)
			exec_driver(driver_entry);
	}
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.