summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1998-11-13 23:40:02 +0000
committermsmith <msmith@FreeBSD.org>1998-11-13 23:40:02 +0000
commit20e409b11b3808e461ab3f842735190ac6007522 (patch)
tree58b52605b6497bf5e372bb2743757390bf4f0a43 /sys/boot
parent5a28cf02837de734aa430222b15124cfab8db5b7 (diff)
downloadFreeBSD-src-20e409b11b3808e461ab3f842735190ac6007522.zip
FreeBSD-src-20e409b11b3808e461ab3f842735190ac6007522.tar.gz
Add a new variable $num_ide_disks which is used to offset the unit number
for SCSI disks when converting from BIOS unit numbers to da unit numbers. Prompted by Kevin Street <street@iname.com>
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/i386/libi386/biosdisk.c18
-rw-r--r--sys/boot/i386/libi386/bootinfo.c6
-rw-r--r--sys/boot/i386/libi386/bootinfo32.c6
-rw-r--r--sys/boot/i386/libi386/bootinfo64.c6
4 files changed, 21 insertions, 15 deletions
diff --git a/sys/boot/i386/libi386/biosdisk.c b/sys/boot/i386/libi386/biosdisk.c
index 502d3be..cae6883 100644
--- a/sys/boot/i386/libi386/biosdisk.c
+++ b/sys/boot/i386/libi386/biosdisk.c
@@ -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.16 1998/10/31 02:53:11 msmith Exp $
+ * $Id: biosdisk.c,v 1.17 1998/11/02 23:28:11 msmith Exp $
*/
/*
@@ -673,7 +673,10 @@ bd_getgeom(struct open_disk *od)
}
/*
- * Return a suitable dev_t value for (dev)
+ * Return a suitable dev_t value for (dev).
+ *
+ * In the case where it looks like (dev) is a SCSI disk, we allow the number of
+ * IDE disks to be specified in $num_ide_disks. There should be a Better Way.
*/
int
bd_getdev(struct i386_devdesc *dev)
@@ -682,6 +685,8 @@ bd_getdev(struct i386_devdesc *dev)
int biosdev;
int major;
int rootdev;
+ char *nip, *cp;
+ int unitofs = 0;
biosdev = bd_unit2bios(dev->d_kind.biosdisk.unit);
DEBUG("unit %d BIOS device %d", dev->d_kind.biosdisk.unit, biosdev);
@@ -704,6 +709,13 @@ 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 */
+ if ((nip = getenv("num_ide_disks")) != NULL) {
+ unitofs = strtol(nip, &cp, 0);
+ /* check for parse error */
+ if ((cp == nip) || (*cp != 0))
+ unitofs = 0;
+ }
} else {
/* assume an IDE disk */
major = WDMAJOR;
@@ -712,7 +724,7 @@ bd_getdev(struct i386_devdesc *dev)
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, /* XXX allow/compute shift for da when wd present */
+ (biosdev & 0x7f) - unitofs, /* allow for #wd compenstation in da case */
dev->d_kind.biosdisk.partition);
DEBUG("dev is 0x%x\n", rootdev);
return(rootdev);
diff --git a/sys/boot/i386/libi386/bootinfo.c b/sys/boot/i386/libi386/bootinfo.c
index 5b479cd..77ba8b7 100644
--- a/sys/boot/i386/libi386/bootinfo.c
+++ b/sys/boot/i386/libi386/bootinfo.c
@@ -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.13 1998/10/14 05:07:23 peter Exp $
+ * $Id: bootinfo.c,v 1.14 1998/10/15 17:06:36 peter Exp $
*/
#include <stand.h>
@@ -249,9 +249,7 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
printf("can't determine root device\n");
return(EINVAL);
}
-
- /* Boot from whatever the current device is */
- i386_getdev((void **)(&rootdev), NULL, NULL);
+
switch(rootdev->d_type) {
case DEVT_DISK:
/* pass in the BIOS device number of the current disk */
diff --git a/sys/boot/i386/libi386/bootinfo32.c b/sys/boot/i386/libi386/bootinfo32.c
index 5b479cd..77ba8b7 100644
--- a/sys/boot/i386/libi386/bootinfo32.c
+++ b/sys/boot/i386/libi386/bootinfo32.c
@@ -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.13 1998/10/14 05:07:23 peter Exp $
+ * $Id: bootinfo.c,v 1.14 1998/10/15 17:06:36 peter Exp $
*/
#include <stand.h>
@@ -249,9 +249,7 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
printf("can't determine root device\n");
return(EINVAL);
}
-
- /* Boot from whatever the current device is */
- i386_getdev((void **)(&rootdev), NULL, NULL);
+
switch(rootdev->d_type) {
case DEVT_DISK:
/* pass in the BIOS device number of the current disk */
diff --git a/sys/boot/i386/libi386/bootinfo64.c b/sys/boot/i386/libi386/bootinfo64.c
index 5b479cd..77ba8b7 100644
--- a/sys/boot/i386/libi386/bootinfo64.c
+++ b/sys/boot/i386/libi386/bootinfo64.c
@@ -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.13 1998/10/14 05:07:23 peter Exp $
+ * $Id: bootinfo.c,v 1.14 1998/10/15 17:06:36 peter Exp $
*/
#include <stand.h>
@@ -249,9 +249,7 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
printf("can't determine root device\n");
return(EINVAL);
}
-
- /* Boot from whatever the current device is */
- i386_getdev((void **)(&rootdev), NULL, NULL);
+
switch(rootdev->d_type) {
case DEVT_DISK:
/* pass in the BIOS device number of the current disk */
OpenPOWER on IntegriCloud