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>
This commit is contained in:
Mike Smith 1998-11-13 23:40:02 +00:00
parent 692c33253b
commit 8f0a6b5b8c
4 changed files with 21 additions and 15 deletions

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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 int
bd_getdev(struct i386_devdesc *dev) bd_getdev(struct i386_devdesc *dev)
@ -682,6 +685,8 @@ bd_getdev(struct i386_devdesc *dev)
int biosdev; int biosdev;
int major; int major;
int rootdev; int rootdev;
char *nip, *cp;
int unitofs = 0;
biosdev = bd_unit2bios(dev->d_kind.biosdisk.unit); biosdev = bd_unit2bios(dev->d_kind.biosdisk.unit);
DEBUG("unit %d BIOS device %d", dev->d_kind.biosdisk.unit, biosdev); 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)) { if ((od->od_flags & BD_LABELOK) && (od->od_disklabel.d_type == DTYPE_SCSI)) {
/* label OK, disk labelled as SCSI */ /* label OK, disk labelled as SCSI */
major = DAMAJOR; 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 { } else {
/* assume an IDE disk */ /* assume an IDE disk */
major = WDMAJOR; major = WDMAJOR;
@ -712,7 +724,7 @@ bd_getdev(struct i386_devdesc *dev)
rootdev = MAKEBOOTDEV(major, rootdev = MAKEBOOTDEV(major,
(dev->d_kind.biosdisk.slice + 1) >> 4, /* XXX slices may be wrong here */ (dev->d_kind.biosdisk.slice + 1) >> 4, /* XXX slices may be wrong here */
(dev->d_kind.biosdisk.slice + 1) & 0xf, (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); dev->d_kind.biosdisk.partition);
DEBUG("dev is 0x%x\n", rootdev); DEBUG("dev is 0x%x\n", rootdev);
return(rootdev); return(rootdev);

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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> #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"); printf("can't determine root device\n");
return(EINVAL); return(EINVAL);
} }
/* Boot from whatever the current device is */
i386_getdev((void **)(&rootdev), NULL, NULL);
switch(rootdev->d_type) { switch(rootdev->d_type) {
case DEVT_DISK: case DEVT_DISK:
/* pass in the BIOS device number of the current disk */ /* pass in the BIOS device number of the current disk */

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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> #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"); printf("can't determine root device\n");
return(EINVAL); return(EINVAL);
} }
/* Boot from whatever the current device is */
i386_getdev((void **)(&rootdev), NULL, NULL);
switch(rootdev->d_type) { switch(rootdev->d_type) {
case DEVT_DISK: case DEVT_DISK:
/* pass in the BIOS device number of the current disk */ /* pass in the BIOS device number of the current disk */

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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> #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"); printf("can't determine root device\n");
return(EINVAL); return(EINVAL);
} }
/* Boot from whatever the current device is */
i386_getdev((void **)(&rootdev), NULL, NULL);
switch(rootdev->d_type) { switch(rootdev->d_type) {
case DEVT_DISK: case DEVT_DISK:
/* pass in the BIOS device number of the current disk */ /* pass in the BIOS device number of the current disk */