From: Kurt Garloff <garloff@suse.de>
To: Linux kernel list <linux-kernel@vger.kernel.org>,
Linux SCSI list <linux-scsi@vger.kernel.org>
Subject: root=/dev/scsi/sdcXbXtXuXpX support
Date: Sat, 15 Jun 2002 15:43:06 +0200 [thread overview]
Message-ID: <20020615134306.GD11016@gum01m.etpnet.phys.tue.nl> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 680 bytes --]
Hi,
based on the /proc/scsi/map patch, one can add straightforward support
for the root=/dev/scsi/sdcXbXtXuXpX format. Note that the format is
identical to the one used by devfs, but devfs is not needed to achieve this
functionality id this patch is applied.
Together with the scsihosts= boot parameter, one can specify a partition
of a scsi disk based on the physical location.
Patch is against 2.4.19pre10.
Comments are welcome!
Regards,
--
Kurt Garloff <garloff@suse.de> Eindhoven, NL
GPG key: See mail header, key servers Linux kernel development
SuSE Linux AG, Nuernberg, DE SCSI, Security
[-- Attachment #1.2: scsi-map-boot1.diff --]
[-- Type: text/plain, Size: 4297 bytes --]
diff -uNr linux-2.4.18.S18.sdmany/drivers/scsi/scsi.c linux-2.4.18.S18.sdmany2/drivers/scsi/scsi.c
--- linux-2.4.18.S18.sdmany/drivers/scsi/scsi.c Fri Jun 14 12:49:15 2002
+++ linux-2.4.18.S18.sdmany2/drivers/scsi/scsi.c Fri Jun 14 14:18:55 2002
@@ -1554,6 +1554,36 @@
}
}
+int __init scsi_find_bdev(int h, int c, int i, int l, const char* tag,
+ char* name, kdev_t *dev)
+{
+ Scsi_Device *scd;
+ struct Scsi_Host *HBA_ptr;
+ struct Scsi_Device_Template *sg_t = scsi_devicelist;
+ /* 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, dev))
+ return 1;
+ else
+ return 0;
+ }
+ }
+ }
+ return 1;
+}
+
#ifdef CONFIG_PROC_FS
/*
* Output the mapping of physical devices (contorller,channel.id,lun)
diff -uNr linux-2.4.18.S18.sdmany/init/do_mounts.c linux-2.4.18.S18.sdmany2/init/do_mounts.c
--- linux-2.4.18.S18.sdmany/init/do_mounts.c Wed Jun 12 11:37:12 2002
+++ linux-2.4.18.S18.sdmany2/init/do_mounts.c Fri Jun 14 15:53:45 2002
@@ -136,6 +136,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/hXcXiXlXpX */
{ "ada", 0x1c00 },
{ "adb", 0x1c10 },
{ "adc", 0x1c20 },
@@ -147,6 +160,7 @@
{ "xdb", 0x0d40 },
{ "ram", 0x0100 },
{ "scd", 0x0b00 },
+ { "sr", 0x0b00 },
{ "mcd", 0x1700 },
{ "cdu535", 0x1800 },
{ "sonycd", 0x1800 },
@@ -255,6 +269,64 @@
{ NULL, 0 }
};
+#if defined(CONFIG_SCSI) && !defined(CONFIG_DEVFS_FS)
+int scsi_find_bdev (int, int, int, int, const char*, char*, kdev_t*);
+/* Parse /dev/scsi/sdcXbXtXuXpX names. Makes only sense if scsi is
+ * compiled in. Otherwise the initrd stuff needs to take care ... */
+kdev_t __init scsiname_to_kdev_t(char* line)
+{
+ kdev_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;
@@ -732,6 +804,10 @@
#else
static void __init devfs_make_root(char *name)
{
+# ifdef CONFIG_SCSI
+ if (!strncmp (name, "scsi/", 5))
+ ROOT_DEV = scsiname_to_kdev_t (name+5);
+# endif
}
#endif
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
reply other threads:[~2002-06-15 13:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020615134306.GD11016@gum01m.etpnet.phys.tue.nl \
--to=garloff@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®