Commit 54cdbb65 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Greg Kroah-Hartman

[PATCH] ide-scsi.c: fix ATAPI multi-lun support

ATAPI multi-lun support has been broken for a long time.

It used to be that "(drive->id->last_id & 0x7) + 1" was used as
shost->max_lun and the "hdXlun=" kernel parameter could be used to
override this value.

However it was far from optimal:
- people played with "hdXlun=" and then complained about multiple instances
  of the same device (most ATAPI drives respond to each LUN)
- probably some devices return 7 not 0 in id->last_id (=> 7 x same device)

This patch from Willem Riede <wrlk@riede.org> fixes it w/o need
for "hdXlun=" option.  It was tested by Willem on ATAPI PD/CD drive.
parent 3da04c35
......@@ -1100,7 +1100,16 @@ static int idescsi_attach(ide_drive_t *drive)
return 1;
host->max_id = 1;
#if IDESCSI_DEBUG_LOG
if (drive->id->last_lun)
printk(KERN_NOTICE "%s: id->last_lun=%u\n", drive->name, drive->id->last_lun);
#endif
if ((drive->id->last_lun & 0x7) != 7)
host->max_lun = (drive->id->last_lun & 0x7) + 1;
else
host->max_lun = 1;
drive->driver_data = host;
idescsi = scsihost_to_idescsi(host);
idescsi->drive = drive;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment