these structs maybe represent 4 methods of booting/possible root device candidates
All the struct below are assigned value by this functionlookup_bootinfo(int type) with particular integer value assigned to device category. they are then Checked with Null object
struct btinfo_rootdevice *biv;
XXXDon't know what device it is maybe bios has recognised root device,can bios even do that
it has following conditions to assign booted* variables value. Also bootspec is ONLY set in this case after condition that devname field is equal to '/0'
.
DV_DISK
cf_name
field of iterating device should be same as contents of devname
field of biv for length of cf_name
&& length of devname field of biv after removing 'a' should be same as unit of device iterating.findroot returns if dv is not Null. or if devname field is equal to '/0'
.
struct btinfo_bootdisk *bid;
Scans all disk devices ,if floppy disk device , and not hard drive and bios number matches then it sets booted_device to bid, scans and finds all disk but chooses lower disk number. makes assumption lowest number disk will be boot disk
struct btinfo_bootwedge *biw;
it scans all the devices and finds all the devices with matching boot info but uses only the first one found.
struct btinfo_biosgeom *big;
Last case to run checks for CD-ROM boot disk. it assumes biosdev will be larger or equal to maximum number of supported disk drive ie cd device will always be assigned number at last.
checks all the devices whooses biosdev is greater than 0x80
+ number of maximun hard disk supported. first cd device is set as booted_device
This is never refferenced in setroot or in x86_autoconf. although set in findroot with booted_device
baduck I believe this is just set for debugging purposes. We can use it for consistency checks in the tests, however.
It is only set after booted_nblks, if 0 then it is null(in findroot()).
set to 0
in all cases except when btinfo_bootwedge *biw is found in that case is set to wedges's field nblks.
only set in case of btinfo_rootdevice, contents are same as devname of root device
rootspec is a interface variable betweeen config and the kernel. following lines in the config file puts them in rootspec.
config netbsd root on ? type ?
config netbsd root on sd0a type ?
this tells us that it is set by config file. the protocol between config and kernel sets this variable using directives defined.
it is set by file in compile directory sys/arch/amd64/compile/GENERIC/swapnetbsd.c
to NULL
called from autoconfig subroutines's config_attach_internal.
it calls one function for isa and one for pci. this function also sets booted_device and booted_method(this is set to "device/register"). First device_isa_register is called and then device_pci_register is called , priority is always given to isa device to be set for booted_device.
device_pci_register returns device_t dev
only if the dev is a network interface device all other cases return NULL
. Same is with device_isa_register.
rootdv is not a output variable but a intermediatary variable helps with assignment of device to root_device.
it is same as root_devive but for disks
dev_t dumpdev; /* dump device /
dev_t dumpcdev; / dump device (character equivalent) /
long dumplo; / offset into dumpdev /
int dumpsize; / size of dump in pages */