Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Feb 1999 07:24:55 +1100
From:      Peter Jeremy <peter.jeremy@auss2.alcatel.com.au>
To:        "Santiago Perez-Cacho Jr." <sanper@pcfa.es.eu.org>
Cc:        current@FreeBSD.ORG, dcs@newsguy.com
Subject:   Re: Can't boot from 1st disk on 2nd IDE controller
Message-ID:  <99Feb2.071509est.40330@border.alcanet.com.au>

next in thread | raw e-mail | index | archive | help
"Daniel C. Sobral" <dcs@newsguy.com> wrote:
>"Santiago Perez-Cacho Jr." wrote:
>> 
>> changing root device to wd1s1a
>>                         ^^^^^^
>> changing root device to wd1a
>>                         ^^^^
>> error 6: panic : cannot mount root (2)
>> 
>> It doesn't matter what I set as num_ide_disks and rootdev, the system
>> always tries to mount partitions on wd1. Is this a known issue or am I
>> doing something wrong?

It is a known problem and was discussed here last month.  The issue is
basically that BIOS uses a different algorithm to the kernel to count
disks.  For various reasons, it's not practical for the kernel to use
the same algorithm as the BIOS.  Someone (I think it's Mike Smith) is
looking at a reasonably general kludge to resolve the problem.

>Someone here had the same problem, and modified the source code to
>deal with it.

I wrote the following kludge.  This treats an IDE disk number supplied
by the BIOS as the Nth IDE disk found by the kernel probe.  You'll
have to read the original thread for reasons why this solution may not
work in all cases.

Index: i386/i386/autoconf.c
===================================================================
RCS file: /home/CVSROOT/./src/sys/i386/i386/autoconf.c,v
retrieving revision 1.110
diff -b -u -r1.110 autoconf.c
--- autoconf.c	1998/10/26 07:05:34	1.110
+++ autoconf.c	1999/01/21 23:18:18
@@ -433,6 +433,10 @@
 #define FDMAJOR 2
 #define FDUNITSHIFT     6
 
+/* KLUDGE for bios handling of multiple devices */
+#define	WDMAJOR 0
+int	wd_mask = 0;		/* mask of WD devices found during probe */
+
 /*
  * Attempt to find the device from which we were booted.
  * If we can do so, and not instructed not to do so,
@@ -467,6 +471,18 @@
 		slice = COMPATIBILITY_SLICE;
 		part = RAW_PART;
 		mindev = unit << FDUNITSHIFT;
+	} else if (majdev == WDMAJOR) {
+		/*
+		 * XXX kludge to handle holes in numbering
+		 */
+		for (part = 0, mindev = unit; part < 32 && mindev >= 0; part++)
+			if (wd_mask & (1 << part))
+				mindev--;
+		if (mindev == -1)
+			unit = part - 1;
+
+		part = B_PARTITION(bootdev);
+		mindev = dkmakeminor(unit, slice, part);
 	} else {
 		part = B_PARTITION(bootdev);
 		mindev = dkmakeminor(unit, slice, part);
Index: i386/isa/wd.c
===================================================================
RCS file: /home/CVSROOT/./src/sys/i386/isa/wd.c,v
retrieving revision 1.186
diff -b -u -r1.186 wd.c
--- wd.c	1999/01/17 05:46:24	1.186
+++ wd.c	1999/01/21 23:18:18
@@ -223,6 +223,8 @@
 static struct buf rwdbuf[NWD];	/* buffers for raw IO */
 #endif
 
+extern int wd_mask;	/* This is a KLUDGE */
+
 static int wdprobe(struct isa_device *dvp);
 static int wdattach(struct isa_device *dvp);
 static void wdustart(struct disk *du);
@@ -551,6 +553,8 @@
 					  DEVSTAT_NO_ORDERED_TAGS,
 					  DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_IDE);
 
+			/* KLUDGE: mark drive as present */
+			wd_mask |= 1 << lunit;
 		} else {
 			free(du, M_TEMP);
 			wddrives[lunit] = NULL;

Peter
--
Peter Jeremy (VK2PJ)                    peter.jeremy@alcatel.com.au
Alcatel Australia Limited
41 Mandible St                          Phone: +61 2 9690 5019
ALEXANDRIA  NSW  2015                   Fax:   +61 2 9690 5982

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?99Feb2.071509est.40330>