aboutsummaryrefslogtreecommitdiff
path: root/stand/i386/loader
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2018-03-12 21:39:49 +0000
committerWarner Losh <imp@FreeBSD.org>2018-03-12 21:39:49 +0000
commitde04d704a98a7d2e9e57ebd83d2dd7a19fc11dab (patch)
tree8b2a7c70182f66162f89a183d74cd3d07bb9ffa6 /stand/i386/loader
parentf264386b3233a7eba03e0afe0e01e39c509d597d (diff)
downloadsrc-de04d704a98a7d2e9e57ebd83d2dd7a19fc11dab.tar.gz
src-de04d704a98a7d2e9e57ebd83d2dd7a19fc11dab.zip
Use the actual struct devdesc at the start of all *_devdesc structs
The current system is fragile and requires very careful layout of all *_devdesc structures. It also makes it hard to change the base devdesc. Take a page from CAM and put the 'header' in all the derived classes and adjust the code to match. For OFW, move the iHandle h_handle out of a slot conflicting with d_opendata. Due to quirks in the alignment rules, this worked. However changing the code to use d_opendata storage now that it's a pointer is hard, so just have a separate field for it. All other cleanups were to make the *_devdesc structures match where they'd taken some liberties that were none-the-less compatible enough to work.
Notes
Notes: svn path=/head/; revision=330809
Diffstat (limited to 'stand/i386/loader')
-rw-r--r--stand/i386/loader/chain.c2
-rw-r--r--stand/i386/loader/main.c22
2 files changed, 12 insertions, 12 deletions
diff --git a/stand/i386/loader/chain.c b/stand/i386/loader/chain.c
index d6810ef67fce..5b615288de0c 100644
--- a/stand/i386/loader/chain.c
+++ b/stand/i386/loader/chain.c
@@ -111,7 +111,7 @@ command_chain(int argc, char *argv[])
relocater_data[0].dest = 0x7C00;
relocater_data[0].size = SECTOR_SIZE;
- relocator_edx = bd_unit2bios(rootdev->d_unit);
+ relocator_edx = bd_unit2bios(rootdev->dd.d_unit);
relocator_esi = relocater_size;
relocator_ds = 0;
relocator_es = 0;
diff --git a/stand/i386/loader/main.c b/stand/i386/loader/main.c
index 635f16088988..dfa173be1557 100644
--- a/stand/i386/loader/main.c
+++ b/stand/i386/loader/main.c
@@ -254,18 +254,18 @@ extract_currdev(void)
int biosdev = -1;
/* Assume we are booting from a BIOS disk by default */
- new_currdev.d_dev = &biosdisk;
+ new_currdev.dd.d_dev = &biosdisk;
/* new-style boot loaders such as pxeldr and cdldr */
if (kargs->bootinfo == 0) {
if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) {
/* we are booting from a CD with cdboot */
- new_currdev.d_dev = &bioscd;
- new_currdev.d_unit = bc_bios2unit(initial_bootdev);
+ new_currdev.dd.d_dev = &bioscd;
+ new_currdev.dd.d_unit = bc_bios2unit(initial_bootdev);
} else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) {
/* we are booting from pxeldr */
- new_currdev.d_dev = &pxedisk;
- new_currdev.d_unit = 0;
+ new_currdev.dd.d_dev = &pxedisk;
+ new_currdev.dd.d_unit = 0;
} else {
/* we don't know what our boot device is */
new_currdev.d_kind.biosdisk.slice = -1;
@@ -295,7 +295,7 @@ extract_currdev(void)
new_currdev.d_kind.zfs.pool_guid = kargs->zfspool;
new_currdev.d_kind.zfs.root_guid = 0;
}
- new_currdev.d_dev = &zfs_dev;
+ new_currdev.dd.d_dev = &zfs_dev;
#endif
} else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) {
/* The passed-in boot device is bad */
@@ -316,21 +316,21 @@ extract_currdev(void)
if ((biosdev == 0) && (B_TYPE(initial_bootdev) != 2)) /* biosdev doesn't match major */
biosdev = 0x80 + B_UNIT(initial_bootdev); /* assume harddisk */
}
- new_currdev.d_type = new_currdev.d_dev->dv_type;
+ new_currdev.dd.d_type = new_currdev.dd.d_dev->dv_type;
/*
* If we are booting off of a BIOS disk and we didn't succeed in determining
* which one we booted off of, just use disk0: as a reasonable default.
*/
- if ((new_currdev.d_type == biosdisk.dv_type) &&
- ((new_currdev.d_unit = bd_bios2unit(biosdev)) == -1)) {
+ if ((new_currdev.dd.d_type == biosdisk.dv_type) &&
+ ((new_currdev.dd.d_unit = bd_bios2unit(biosdev)) == -1)) {
printf("Can't work out which disk we are booting from.\n"
"Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev);
- new_currdev.d_unit = 0;
+ new_currdev.dd.d_unit = 0;
}
#ifdef LOADER_ZFS_SUPPORT
- if (new_currdev.d_type == DEVT_ZFS)
+ if (new_currdev.dd.d_type == DEVT_ZFS)
init_zfs_bootenv(zfs_fmtdev(&new_currdev));
#endif