Slightly cleanup the 'bootdev' concept on x86 by changing the various
macros to treat the 'slice' field as a real part of the bootdev instead of as hack that spans two other fields (adaptor (sic) and controller) that are not used in any modern FreeBSD boot code. MFC after: 1 week
This commit is contained in:
parent
6fa30d2b87
commit
5c5b5d4607
|
@ -395,7 +395,7 @@ load(void)
|
||||||
bootinfo.bi_kernelname = VTOP(kname);
|
bootinfo.bi_kernelname = VTOP(kname);
|
||||||
bootinfo.bi_bios_dev = dsk.drive;
|
bootinfo.bi_bios_dev = dsk.drive;
|
||||||
__exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
|
__exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
|
||||||
MAKEBOOTDEV(dev_maj[dsk.type], 0, dsk.slice, dsk.unit, dsk.part),
|
MAKEBOOTDEV(dev_maj[dsk.type], dsk.slice, dsk.unit, dsk.part),
|
||||||
0, 0, 0, VTOP(&bootinfo));
|
0, 0, 0, VTOP(&bootinfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -395,7 +395,7 @@ load(void)
|
||||||
bootinfo.bi_kernelname = VTOP(kname);
|
bootinfo.bi_kernelname = VTOP(kname);
|
||||||
bootinfo.bi_bios_dev = dsk.drive;
|
bootinfo.bi_bios_dev = dsk.drive;
|
||||||
__exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
|
__exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
|
||||||
MAKEBOOTDEV(dev_maj[dsk.type], 0, dsk.slice, dsk.unit, dsk.part),
|
MAKEBOOTDEV(dev_maj[dsk.type], dsk.slice, dsk.unit, dsk.part),
|
||||||
0, 0, 0, VTOP(&bootinfo));
|
0, 0, 0, VTOP(&bootinfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -350,7 +350,7 @@ bc_getdev(struct i386_devdesc *dev)
|
||||||
unit = 0; /* XXX */
|
unit = 0; /* XXX */
|
||||||
|
|
||||||
/* XXX: Assume partition 'a'. */
|
/* XXX: Assume partition 'a'. */
|
||||||
rootdev = MAKEBOOTDEV(major, 0, 0, unit, 0);
|
rootdev = MAKEBOOTDEV(major, 0, unit, 0);
|
||||||
DEBUG("dev is 0x%x\n", rootdev);
|
DEBUG("dev is 0x%x\n", rootdev);
|
||||||
return(rootdev);
|
return(rootdev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1221,11 +1221,8 @@ bd_getdev(struct i386_devdesc *dev)
|
||||||
unit = i;
|
unit = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
rootdev = MAKEBOOTDEV(major,
|
rootdev = MAKEBOOTDEV(major, dev->d_kind.biosdisk.slice + 1, unit,
|
||||||
(dev->d_kind.biosdisk.slice + 1) >> 4, /* XXX slices may be wrong here */
|
dev->d_kind.biosdisk.partition);
|
||||||
(dev->d_kind.biosdisk.slice + 1) & 0xf,
|
|
||||||
unit,
|
|
||||||
dev->d_kind.biosdisk.partition);
|
|
||||||
DEBUG("dev is 0x%x\n", rootdev);
|
DEBUG("dev is 0x%x\n", rootdev);
|
||||||
return(rootdev);
|
return(rootdev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,8 +218,7 @@ extract_currdev(void)
|
||||||
new_currdev.d_kind.biosdisk.partition = 0;
|
new_currdev.d_kind.biosdisk.partition = 0;
|
||||||
biosdev = -1;
|
biosdev = -1;
|
||||||
} else {
|
} else {
|
||||||
new_currdev.d_kind.biosdisk.slice = (B_ADAPTOR(initial_bootdev) << 4) +
|
new_currdev.d_kind.biosdisk.slice = B_SLICE(initial_bootdev) - 1;
|
||||||
B_CONTROLLER(initial_bootdev) - 1;
|
|
||||||
new_currdev.d_kind.biosdisk.partition = B_PARTITION(initial_bootdev);
|
new_currdev.d_kind.biosdisk.partition = B_PARTITION(initial_bootdev);
|
||||||
biosdev = initial_bootinfo->bi_bios_dev;
|
biosdev = initial_bootinfo->bi_bios_dev;
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ loadprog(void)
|
||||||
* For backwards compatibility, use the previously-unused adaptor
|
* For backwards compatibility, use the previously-unused adaptor
|
||||||
* and controller bitfields to hold the slice number.
|
* and controller bitfields to hold the slice number.
|
||||||
*/
|
*/
|
||||||
bootdev = MAKEBOOTDEV(maj, (slice >> 4), slice & 0xf, unit, part);
|
bootdev = MAKEBOOTDEV(maj, slice, unit, part);
|
||||||
|
|
||||||
bootinfo.bi_version = BOOTINFO_VERSION;
|
bootinfo.bi_version = BOOTINFO_VERSION;
|
||||||
bootinfo.bi_kernelname = (u_int32_t)(name + ouraddr);
|
bootinfo.bi_kernelname = (u_int32_t)(name + ouraddr);
|
||||||
|
|
|
@ -338,7 +338,7 @@ bc_getdev(struct i386_devdesc *dev)
|
||||||
unit = 0; /* XXX */
|
unit = 0; /* XXX */
|
||||||
|
|
||||||
/* XXX: Assume partition 'a'. */
|
/* XXX: Assume partition 'a'. */
|
||||||
rootdev = MAKEBOOTDEV(major, 0, 0, unit, 0);
|
rootdev = MAKEBOOTDEV(major, 0, unit, 0);
|
||||||
DEBUG("dev is 0x%x\n", rootdev);
|
DEBUG("dev is 0x%x\n", rootdev);
|
||||||
return(rootdev);
|
return(rootdev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1105,11 +1105,8 @@ bd_getdev(struct i386_devdesc *dev)
|
||||||
unit = i;
|
unit = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
rootdev = MAKEBOOTDEV(major,
|
rootdev = MAKEBOOTDEV(major, dev->d_kind.biosdisk.slice + 1, unit,
|
||||||
(dev->d_kind.biosdisk.slice + 1) >> 4, /* XXX slices may be wrong here */
|
dev->d_kind.biosdisk.partition);
|
||||||
(dev->d_kind.biosdisk.slice + 1) & 0xf,
|
|
||||||
unit,
|
|
||||||
dev->d_kind.biosdisk.partition);
|
|
||||||
DEBUG("dev is 0x%x\n", rootdev);
|
DEBUG("dev is 0x%x\n", rootdev);
|
||||||
return(rootdev);
|
return(rootdev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,17 +78,11 @@ extern struct bootinfo bootinfo;
|
||||||
* for backward compatibility. Except for that of the "magic
|
* for backward compatibility. Except for that of the "magic
|
||||||
* number", each mask applies to the shifted value.
|
* number", each mask applies to the shifted value.
|
||||||
* Format:
|
* Format:
|
||||||
* (4) (4) (4) (4) (8) (8)
|
* (4) (8) (4) (8) (8)
|
||||||
* --------------------------------
|
* --------------------------------
|
||||||
* |MA | AD| CT| UN| PART | TYPE |
|
* |MA | SLICE | UN| PART | TYPE |
|
||||||
* --------------------------------
|
* --------------------------------
|
||||||
*/
|
*/
|
||||||
#define B_ADAPTORSHIFT 24
|
|
||||||
#define B_ADAPTORMASK 0x0f
|
|
||||||
#define B_ADAPTOR(val) (((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK)
|
|
||||||
#define B_CONTROLLERSHIFT 20
|
|
||||||
#define B_CONTROLLERMASK 0xf
|
|
||||||
#define B_CONTROLLER(val) (((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK)
|
|
||||||
#define B_SLICESHIFT 20
|
#define B_SLICESHIFT 20
|
||||||
#define B_SLICEMASK 0xff
|
#define B_SLICEMASK 0xff
|
||||||
#define B_SLICE(val) (((val)>>B_SLICESHIFT) & B_SLICEMASK)
|
#define B_SLICE(val) (((val)>>B_SLICESHIFT) & B_SLICEMASK)
|
||||||
|
@ -105,10 +99,10 @@ extern struct bootinfo bootinfo;
|
||||||
#define B_MAGICMASK 0xf0000000
|
#define B_MAGICMASK 0xf0000000
|
||||||
#define B_DEVMAGIC 0xa0000000
|
#define B_DEVMAGIC 0xa0000000
|
||||||
|
|
||||||
#define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \
|
#define MAKEBOOTDEV(type, slice, unit, partition) \
|
||||||
(((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \
|
(((type) << B_TYPESHIFT) | ((slice) << B_SLICESHIFT) | \
|
||||||
((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \
|
((unit) << B_UNITSHIFT) | ((partition) << B_PARTITIONSHIFT) | \
|
||||||
((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC)
|
B_DEVMAGIC)
|
||||||
|
|
||||||
#define BASE_SLICE 2
|
#define BASE_SLICE 2
|
||||||
#define COMPATIBILITY_SLICE 0
|
#define COMPATIBILITY_SLICE 0
|
||||||
|
|
Loading…
Reference in New Issue