Re: FWD: Yamaha 4416S CONFIG_SCSI_MULTI_LUN problem

Gadi Oxman (gadio@netvision.net.il)
Wed, 17 Nov 1999 08:36:07 +0200 (IST)


> > Ok, I just tried this.
> >
> > hdc: last-lun: 0
> > hdg: last-lun: 0
> > hdh: last-lun: 0
>
> All positives. Bright news. Can someone with a multi-lun atapi drive also try
> this before it gets stuck into the kernel as a fix

And here is a patch which uses the "last lun" field for ATAPI devices. We
only need feedback from users of multi-lun ATAPI devices to know if it
really works.

Gadi

--- linux/drivers/scsi/ide-scsi.c.old Wed Nov 17 07:35:15 1999
+++ linux/drivers/scsi/ide-scsi.c Wed Nov 17 08:13:57 1999
@@ -604,11 +604,14 @@
{
struct Scsi_Host *host;
int id;
+ int last_lun = 0;

host_template->proc_dir = &idescsi_proc_dir;
host = scsi_register(host_template, 0);
- for (id = 0; id < MAX_HWIFS * MAX_DRIVES && idescsi_drives[id]; id++);
+ for (id = 0; id < MAX_HWIFS * MAX_DRIVES && idescsi_drives[id]; id++)
+ last_lun = IDE_MAX(last_lun, idescsi_drives[id]->last_lun);
host->max_id = id;
+ host->max_lun = last_lun + 1;
host->can_queue = host->cmd_per_lun * id;
return 1;
}
--- linux/drivers/block/ide.h.old Wed Nov 17 07:38:25 1999
+++ linux/drivers/block/ide.h Wed Nov 17 07:53:38 1999
@@ -259,6 +259,8 @@
struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
void *settings; /* /proc/ide/ drive settings */
char driver_req[10]; /* requests specific driver */
+ int last_lun; /* last logical unit */
+ int forced_lun; /* if hdxlun was given at boot */
} ide_drive_t;

/*
--- linux/drivers/block/ide.c.old Wed Nov 17 07:44:16 1999
+++ linux/drivers/block/ide.c Wed Nov 17 08:20:37 1999
@@ -2389,6 +2389,7 @@
*
* "hdx=swapdata" : when the drive is a disk, byte swap all data
* "hdx=bswap" : same as above..........
+ * "hdxlun=xx" : set the drive last logical unit.
*
* "idebus=xx" : inform IDE driver of VESA/PCI bus speed in MHz,
* where "xx" is between 20 and 66 inclusive,
@@ -2456,6 +2457,19 @@
drive = &hwif->drives[unit];
if (strncmp(s + 4, "ide-", 4) == 0) {
strncpy(drive->driver_req, s + 4, 9);
+ goto done;
+ }
+ /*
+ * Look for last lun option: "hdxlun="
+ */
+ if (s[3] == 'l' && s[4] == 'u' && s[5] == 'n') {
+ if (match_parm(&s[6], NULL, vals, 1) != 1)
+ goto bad_option;
+ if (vals[0] >= 0 && vals[0] <= 7) {
+ drive->last_lun = vals[0];
+ drive->forced_lun = 1;
+ } else
+ printk(" -- BAD LAST LUN! Expected value from 0 to 7");
goto done;
}
switch (match_parm(&s[3], hd_words, vals, 3)) {
--- linux/drivers/block/ide-probe.c.old Wed Nov 17 07:55:30 1999
+++ linux/drivers/block/ide-probe.c Wed Nov 17 08:13:43 1999
@@ -52,7 +52,8 @@
ide_input_data(drive, id, SECTOR_WORDS); /* read 512 bytes of id info */
ide__sti(); /* local CPU only */
ide_fix_driveid(id);
-
+ if (!drive->forced_lun)
+ drive->last_lun = id->word126 & 0x7;
#if defined (CONFIG_SCSI_EATA_DMA) || defined (CONFIG_SCSI_EATA_PIO) || defined (CONFIG_SCSI_EATA)
/*
* EATA SCSI controllers do a hardware ATA emulation:
--- linux/Documentation/ide.txt.old Wed Nov 17 08:17:36 1999
+++ linux/Documentation/ide.txt Wed Nov 17 08:18:26 1999
@@ -275,6 +275,7 @@
"hdx=slow" : insert a huge pause after each access to the data
port. Should be used only as a last resort.
"hdx=swapdata" : when the drive is a disk, byte swap all data
+ "hdxlun=xx" : set the drive last logical unit

"idebus=xx" : inform IDE driver of VESA/PCI bus speed in MHz,
where "xx" is between 20 and 66 inclusive,

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/