lkml.org 
[lkml]   [2002]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] root=/dev/scsi/sdcXbXtXuXpX
Hi Linus,

if you accept the /proc/scsi/scsi extension (listing attached high-level
drivers) that caused a lot of discussions because we're heading for a very
general solution, I'd like to offer a second patch as well, which uses the
infrastructure to allow
root=/dev/scsi/sdCXbXtXuXpX
parameter. This currently works already if you enable devfs, but may also be
needed in setups where devfs can not used.
Patch is against 2.5.24-dj1 again.
The patch depends on the /proc/scsi/scsi extensions or /proc/scsi/map.

Regards,
--
Kurt Garloff <kurt@garloff.de> [Eindhoven, NL]
Physics: Plasma simulations <K.Garloff@TUE.NL> [TU Eindhoven, NL]
Linux: SCSI, Security <garloff@suse.de> [SuSE Nuernberg, DE]
(See mail header or public key servers for PGP2 and GPG public keys.)
diff -uNr linux-2.5.24-dj1-scsirephl/drivers/scsi/scsi.c linux-2.5.24-dj1-scsiboot/drivers/scsi/scsi.c
--- linux-2.5.24-dj1-scsirephl/drivers/scsi/scsi.c Wed Jun 19 04:11:55 2002
+++ linux-2.5.24-dj1-scsiboot/drivers/scsi/scsi.c Tue Jun 25 11:59:45 2002
@@ -1544,6 +1544,39 @@
}
}

+int __init scsi_find_bdev(int h, int c, int i, int l, const char* tag,
+ char* name, dev_t *dev)
+{
+ Scsi_Device *scd;
+ struct Scsi_Host *HBA_ptr;
+ struct Scsi_Device_Template *sg_t = scsi_devicelist;
+ kdev_t kdev;
+ /* First look for right high-level driver */
+ while (sg_t &&
+ (!sg_t->find_kdev || !sg_t->blk ||
+ !(sg_t->tag && !strcmp(sg_t->tag, tag))))
+ sg_t = sg_t->next;
+ if (!sg_t)
+ return 1;
+ /* Now find Scsi_Device and call high-level driver's find_kdev() */
+ for (HBA_ptr = scsi_hostlist; HBA_ptr; HBA_ptr = HBA_ptr->next) {
+ for (scd = HBA_ptr->host_queue; scd; scd = scd->next) {
+ if (scd->host->host_no == h &&
+ scd->channel == c &&
+ scd->id == i &&
+ scd->lun == l) {
+ if (sg_t->find_kdev(scd, name, &kdev))
+ return 1;
+ else {
+ *dev = kdev_t_to_nr(kdev);
+ return 0;
+ }
+ }
+ }
+ }
+ return 1;
+}
+
#ifdef CONFIG_PROC_FS
static int scsi_proc_info(char *buffer, char **start, off_t offset, int length)
{
diff -uNr linux-2.5.24-dj1-scsirephl/init/do_mounts.c linux-2.5.24-dj1-scsiboot/init/do_mounts.c
--- linux-2.5.24-dj1-scsirephl/init/do_mounts.c Fri Jun 21 07:51:53 2002
+++ linux-2.5.24-dj1-scsiboot/init/do_mounts.c Tue Jun 25 12:00:20 2002
@@ -128,6 +128,19 @@
{ "sdn", 0x08d0 },
{ "sdo", 0x08e0 },
{ "sdp", 0x08f0 },
+ { "sdq", 0x4100 },
+ { "sdr", 0x4110 },
+ { "sds", 0x4120 },
+ { "sdt", 0x4130 },
+ { "sdu", 0x4140 },
+ { "sdv", 0x4150 },
+ { "sdw", 0x4160 },
+ { "sdx", 0x4170 },
+ { "sdy", 0x4180 },
+ { "sdz", 0x4190 },
+ /* more scsi devs could be added here, but /dev/sdaa would match
+ * /dev/sda before, so it would need to be moved before sda.
+ * Better use /dev/scsi/sdcXbXtXuXpX */
{ "ada", 0x1c00 },
{ "adb", 0x1c10 },
{ "adc", 0x1c20 },
@@ -139,6 +152,7 @@
{ "xdb", 0x0d40 },
{ "ram", 0x0100 },
{ "scd", 0x0b00 },
+ { "sr", 0x0b00 },
{ "mcd", 0x1700 },
{ "cdu535", 0x1800 },
{ "sonycd", 0x1800 },
@@ -231,6 +245,64 @@
{ NULL, 0 }
};

+#if defined(CONFIG_SCSI) && !defined(CONFIG_DEVFS_FS)
+int scsi_find_bdev (int, int, int, int, const char*, char*, dev_t*);
+/* Parse /dev/scsi/sdcXbXtXuXpX names. Makes only sense if scsi is
+ * compiled in. Otherwise the initrd stuff needs to take care ... */
+dev_t __init scsiname_to_dev_t(char* line)
+{
+ dev_t dev = ROOT_DEV;
+ int h, c, i ,l;
+ char *tp = 0;
+ char nmbuf[16];
+
+ if (!strncmp (line, "sd", 2)) {
+ tp = "sd"; line += 2;
+ }
+ else if (!strncmp (line, "sr", 2)) {
+ tp = "sr"; line += 2;
+ }
+ else if (!strncmp (line, "scd", 3)) {
+ tp = "sr"; line += 3;
+ }
+
+ if (strlen (line) < 8 || !tp)
+ goto out;
+
+ if (*line++ != 'c')
+ goto out;
+ h = simple_strtoul(line, &line, 10);
+ if (*line++ != 'b')
+ goto out;
+ c = simple_strtoul(line, &line, 10);
+ if (*line++ != 't')
+ goto out;
+ i = simple_strtoul(line, &line, 10);
+ if (*line++ != 'u')
+ goto out;
+ l = simple_strtoul(line, &line, 10);
+
+ if (!scsi_find_bdev (h, c, i, l, tp, nmbuf, &dev)) {
+ if (line && *line++ == 'p') {
+ int p = simple_strtoul(line, &line, 10);
+ dev = MKDEV(MAJOR(dev),MINOR(dev)+p);
+ sprintf (nmbuf+strlen(nmbuf), "%i", p);
+ printk("found scsi root device %sc%ib%it%iu%ip%i: %s (%02x:%02x)\n",
+ tp, h, c, i, l, p, nmbuf, MAJOR(dev), MINOR(dev));
+ } else
+ printk("found scsi root device %sc%ib%it%iu%i: %s (%02x:%02x)\n",
+ tp, h, c, i, l, nmbuf, MAJOR(dev), MINOR(dev));
+ strcpy (root_device_name, nmbuf);
+ } else
+ printk("did not find scsi root device %sc%ib%it%iu%i\n",
+ tp, h, c, i, l);
+
+ out:
+ return dev;
+
+}
+#endif
+
kdev_t __init name_to_kdev_t(char *line)
{
int base = 0;
@@ -710,6 +782,10 @@
#else
static void __init devfs_make_root(char *name)
{
+# ifdef CONFIG_SCSI
+ if (!strncmp (name, "scsi/", 5))
+ ROOT_DEV = scsiname_to_dev_t (name+5);
+# endif
}
#endif
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:22    [W:0.042 / U:2.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site