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:
John Baldwin 2007-10-24 04:03:25 +00:00
parent 6fa30d2b87
commit 5c5b5d4607
9 changed files with 16 additions and 29 deletions

View File

@ -395,7 +395,7 @@ load(void)
bootinfo.bi_kernelname = VTOP(kname);
bootinfo.bi_bios_dev = dsk.drive;
__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));
}

View File

@ -395,7 +395,7 @@ load(void)
bootinfo.bi_kernelname = VTOP(kname);
bootinfo.bi_bios_dev = dsk.drive;
__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));
}

View File

@ -350,7 +350,7 @@ bc_getdev(struct i386_devdesc *dev)
unit = 0; /* XXX */
/* XXX: Assume partition 'a'. */
rootdev = MAKEBOOTDEV(major, 0, 0, unit, 0);
rootdev = MAKEBOOTDEV(major, 0, unit, 0);
DEBUG("dev is 0x%x\n", rootdev);
return(rootdev);
}

View File

@ -1221,11 +1221,8 @@ bd_getdev(struct i386_devdesc *dev)
unit = i;
}
rootdev = MAKEBOOTDEV(major,
(dev->d_kind.biosdisk.slice + 1) >> 4, /* XXX slices may be wrong here */
(dev->d_kind.biosdisk.slice + 1) & 0xf,
unit,
dev->d_kind.biosdisk.partition);
rootdev = MAKEBOOTDEV(major, dev->d_kind.biosdisk.slice + 1, unit,
dev->d_kind.biosdisk.partition);
DEBUG("dev is 0x%x\n", rootdev);
return(rootdev);
}

View File

@ -218,8 +218,7 @@ extract_currdev(void)
new_currdev.d_kind.biosdisk.partition = 0;
biosdev = -1;
} else {
new_currdev.d_kind.biosdisk.slice = (B_ADAPTOR(initial_bootdev) << 4) +
B_CONTROLLER(initial_bootdev) - 1;
new_currdev.d_kind.biosdisk.slice = B_SLICE(initial_bootdev) - 1;
new_currdev.d_kind.biosdisk.partition = B_PARTITION(initial_bootdev);
biosdev = initial_bootinfo->bi_bios_dev;

View File

@ -294,7 +294,7 @@ loadprog(void)
* For backwards compatibility, use the previously-unused adaptor
* 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_kernelname = (u_int32_t)(name + ouraddr);

View File

@ -338,7 +338,7 @@ bc_getdev(struct i386_devdesc *dev)
unit = 0; /* XXX */
/* XXX: Assume partition 'a'. */
rootdev = MAKEBOOTDEV(major, 0, 0, unit, 0);
rootdev = MAKEBOOTDEV(major, 0, unit, 0);
DEBUG("dev is 0x%x\n", rootdev);
return(rootdev);
}

View File

@ -1105,11 +1105,8 @@ bd_getdev(struct i386_devdesc *dev)
unit = i;
}
rootdev = MAKEBOOTDEV(major,
(dev->d_kind.biosdisk.slice + 1) >> 4, /* XXX slices may be wrong here */
(dev->d_kind.biosdisk.slice + 1) & 0xf,
unit,
dev->d_kind.biosdisk.partition);
rootdev = MAKEBOOTDEV(major, dev->d_kind.biosdisk.slice + 1, unit,
dev->d_kind.biosdisk.partition);
DEBUG("dev is 0x%x\n", rootdev);
return(rootdev);
}

View File

@ -78,17 +78,11 @@ extern struct bootinfo bootinfo;
* for backward compatibility. Except for that of the "magic
* number", each mask applies to the shifted value.
* 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_SLICEMASK 0xff
#define B_SLICE(val) (((val)>>B_SLICESHIFT) & B_SLICEMASK)
@ -105,10 +99,10 @@ extern struct bootinfo bootinfo;
#define B_MAGICMASK 0xf0000000
#define B_DEVMAGIC 0xa0000000
#define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \
(((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \
((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \
((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC)
#define MAKEBOOTDEV(type, slice, unit, partition) \
(((type) << B_TYPESHIFT) | ((slice) << B_SLICESHIFT) | \
((unit) << B_UNITSHIFT) | ((partition) << B_PARTITIONSHIFT) | \
B_DEVMAGIC)
#define BASE_SLICE 2
#define COMPATIBILITY_SLICE 0