summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1997-05-04 15:24:23 +0000
committerjoerg <joerg@FreeBSD.org>1997-05-04 15:24:23 +0000
commit8cea5b917d62db9701a7fe2a45c9032aec48325d (patch)
treea2408a8a297df1fa5ba68bcc7ee4bc36c2fc2521 /sys/amd64
parent60343a746abd65c1fe9040ea648287d56be4b871 (diff)
downloadFreeBSD-src-8cea5b917d62db9701a7fe2a45c9032aec48325d.zip
FreeBSD-src-8cea5b917d62db9701a7fe2a45c9032aec48325d.tar.gz
This mega-commit brings the following:
. It makes cd9660 root f/s working again. . It makes CD9660 a new-style option. . It adds support to mount an ISO9660 multi-session CD-ROM as the root filesystem (the last session actually, but that's what is expected behaviour). Sigh. The CDIOREADTOCENTRYS did a copyout() of its own, and thus has been unusable for me for this work. Too bad it didn't simply stuff the max 100 entries into the struct ioc_read_toc_entry, but relied on a user supplied data buffer instead. :-( I now had to reinvent the wheel, and created a CDIOREADTOCENTRY ioctl command that can be used in a kernel context. While doing this, i noticed the following bogosities in existing CD-ROM drivers: wcd: This driver is likely to be totally bogus when someone tries two succeeding CDIOREADTOCENTRYS (or now CDIOREADTOCENTRY) commands with requesting MSF format, since it apparently operates on an internal table. scd: This driver apparently returns just a single TOC entry only for the CDIOREADTOCENTRYS command. I have only been able to test the CDIOREADTOCENTRY command with the cd(4) driver. I hereby request the respective maintainers of the other CD-ROM drivers to verify my code for their driver. When it comes to merging this CD-ROM multisession stuff into RELENG_2_2 i will only consider drivers where i've got a confirmation that it actually works.
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/autoconf.c62
1 files changed, 47 insertions, 15 deletions
diff --git a/sys/amd64/amd64/autoconf.c b/sys/amd64/amd64/autoconf.c
index 7fad268..d18fb01 100644
--- a/sys/amd64/amd64/autoconf.c
+++ b/sys/amd64/amd64/autoconf.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- * $Id: autoconf.c,v 1.65 1997/04/26 11:45:02 peter Exp $
+ * $Id: autoconf.c,v 1.66 1997/04/26 18:57:34 peter Exp $
*/
/*
@@ -46,6 +46,7 @@
* and the drivers are initialized.
*/
#include "opt_smp.h"
+#include "opt_cd9660.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -101,9 +102,17 @@ static void setroot __P((void));
#ifdef CD9660
+#include <sys/fcntl.h>
+#include <sys/proc.h>
+#include <sys/stat.h>
+#include <machine/clock.h>
#include <isofs/cd9660/iso.h>
-/* We need to try out all our potential CDROM drives, so we need a table. */
+/*
+ * XXX All this CD-ROM root stuff is fairly messy. Ick.
+ *
+ * We need to try out all our potential CDROM drives, so we need a table.
+ */
static struct {
char *name;
int major;
@@ -112,25 +121,44 @@ static struct {
{ "mcd", 7 },
{ "scd", 16 },
{ "matcd", 17 },
+ { "wcd", 19 },
{ 0, 0}
};
-static int find_cdrom_root __P((void *));
+static int find_cdrom_root __P((void));
static int
-find_cdrom_root(dummy)
- void *dummy;
+find_cdrom_root()
{
- int i,j,k;
-
- for (j = 0 ; j < 2; j++)
- for (k = 0 ; try_cdrom[k].name ; k++) {
- rootdev = makedev(try_cdrom[k].major,j*8);
- printf("trying rootdev=0x%lx (%s%d)\n",
- rootdev, try_cdrom[k].name,j);
- i = (*cd9660_mountroot)();
- if (!i) return i;
+ int i, j, error;
+ struct bdevsw *bd;
+ dev_t orootdev;
+
+#if CD9660_ROOTDELAY > 0
+ DELAY(CD9660_ROOTDELAY * 1000000);
+#endif
+ orootdev = rootdev;
+ for (i = 0 ; i < 2; i++)
+ for (j = 0 ; try_cdrom[j].name ; j++) {
+ if (try_cdrom[j].major >= nblkdev)
+ continue;
+ rootdev = makedev(try_cdrom[j].major, i * 8);
+ bd = bdevsw[major(rootdev)];
+ if (bd == NULL || bd->d_open == NULL)
+ continue;
+ if (bootverbose)
+ printf("trying %s%d as rootdev (0x%x)\n",
+ try_cdrom[j].name, i, rootdev);
+ error = (bd->d_open)(rootdev, FREAD, S_IFBLK, curproc);
+ if (error == 0) {
+ if (bd->d_close != NULL)
+ (bd->d_close)(rootdev, FREAD, S_IFBLK,
+ curproc);
+ return 0;
+ }
}
+
+ rootdev = orootdev;
return EINVAL;
}
#endif /* CD9660 */
@@ -233,7 +261,11 @@ configure(dummy)
if ((boothowto & RB_CDROM)) {
if (bootverbose)
printf("Considering CD-ROM root f/s.\n");
- mountrootfsname = "cd9660";
+ /* NB: find_cdrom_root() sets rootdev if successful. */
+ if (find_cdrom_root() == 0)
+ mountrootfsname = "cd9660";
+ else if (bootverbose)
+ printf("No CD-ROM available as root f/s.\n");
}
#endif
OpenPOWER on IntegriCloud