1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-18 15:30:21 +00:00

biosdisk.c

Implement a new variable 'root_disk_unit' which supersedes
	'num_ide_disks' and makes it possible to explicitly set the
	root device unit number regardless of type considerations.

bootinfo.c
	If we can't calculate a dev_t for the root disk, complain and
	don't proceed to boot with an invalid boot device.
This commit is contained in:
Mike Smith 1999-01-24 00:12:04 +00:00
parent 5d3d992565
commit c679ae39a8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=43114
4 changed files with 32 additions and 13 deletions

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: biosdisk.c,v 1.19 1999/01/09 02:36:19 msmith Exp $
* $Id: biosdisk.c,v 1.20 1999/01/10 18:22:23 steve Exp $
*/
/*
@ -760,7 +760,7 @@ bd_getdev(struct i386_devdesc *dev)
int major;
int rootdev;
char *nip, *cp;
int unitofs = 0;
int unitofs = 0, i, unit;
biosdev = bd_unit2bios(dev->d_kind.biosdisk.unit);
DEBUG("unit %d BIOS device %d", dev->d_kind.biosdisk.unit, biosdev);
@ -783,22 +783,32 @@ bd_getdev(struct i386_devdesc *dev)
if ((od->od_flags & BD_LABELOK) && (od->od_disklabel.d_type == DTYPE_SCSI)) {
/* label OK, disk labelled as SCSI */
major = DAMAJOR;
/* check for unit number correction hint */
/* check for unit number correction hint, now deprecated */
if ((nip = getenv("num_ide_disks")) != NULL) {
unitofs = strtol(nip, &cp, 0);
i = strtol(nip, &cp, 0);
/* check for parse error */
if ((cp == nip) || (*cp != 0))
unitofs = 0;
if ((cp != nip) && (*cp == 0))
unitofs = i;
}
} else {
/* assume an IDE disk */
major = WDMAJOR;
}
}
/* XXX a better kludge to set the root disk unit number */
if ((nip = getenv("root_disk_unit")) != NULL) {
i = strtol(nip, &cp, 0);
/* check for parse error */
if ((cp != nip) && (*cp == 0))
unit = i;
} else {
(biosdev & 0x7f) - unitofs; /* allow for #wd compenstation in da case */
}
rootdev = MAKEBOOTDEV(major,
(dev->d_kind.biosdisk.slice + 1) >> 4, /* XXX slices may be wrong here */
(dev->d_kind.biosdisk.slice + 1) & 0xf,
(biosdev & 0x7f) - unitofs, /* allow for #wd compenstation in da case */
unit,
dev->d_kind.biosdisk.partition);
DEBUG("dev is 0x%x\n", rootdev);
return(rootdev);

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bootinfo.c,v 1.14 1998/10/15 17:06:36 peter Exp $
* $Id: bootinfo.c,v 1.15 1998/11/13 23:40:02 msmith Exp $
*/
#include <stand.h>
@ -255,7 +255,10 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
/* pass in the BIOS device number of the current disk */
bi.bi_bios_dev = bd_unit2bios(rootdev->d_kind.biosdisk.unit);
bootdevnr = bd_getdev(rootdev);
break;
if (bootdevnr != -1)
break;
printf("root device %s invalid\n", i386_fmtdev(rootdev));
return(EINVAL);
default:
printf("aout_exec: WARNING - don't know how to boot from device type %d\n", rootdev->d_type);

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bootinfo.c,v 1.14 1998/10/15 17:06:36 peter Exp $
* $Id: bootinfo.c,v 1.15 1998/11/13 23:40:02 msmith Exp $
*/
#include <stand.h>
@ -255,7 +255,10 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
/* pass in the BIOS device number of the current disk */
bi.bi_bios_dev = bd_unit2bios(rootdev->d_kind.biosdisk.unit);
bootdevnr = bd_getdev(rootdev);
break;
if (bootdevnr != -1)
break;
printf("root device %s invalid\n", i386_fmtdev(rootdev));
return(EINVAL);
default:
printf("aout_exec: WARNING - don't know how to boot from device type %d\n", rootdev->d_type);

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bootinfo.c,v 1.14 1998/10/15 17:06:36 peter Exp $
* $Id: bootinfo.c,v 1.15 1998/11/13 23:40:02 msmith Exp $
*/
#include <stand.h>
@ -255,7 +255,10 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
/* pass in the BIOS device number of the current disk */
bi.bi_bios_dev = bd_unit2bios(rootdev->d_kind.biosdisk.unit);
bootdevnr = bd_getdev(rootdev);
break;
if (bootdevnr != -1)
break;
printf("root device %s invalid\n", i386_fmtdev(rootdev));
return(EINVAL);
default:
printf("aout_exec: WARNING - don't know how to boot from device type %d\n", rootdev->d_type);