PATCH: Different SCSI ordering for WIDE SCSI chains.

Rolf Fokkens (rolf@flits102-126.flits.rug.nl)
Wed, 25 Nov 1998 22:42:21 +0100


This is a multi-part message in MIME format.
--------------5660CA4907629B02922D6295
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The nice thing about Wide SCSI (besides the speed) is the fact that a
SCSI ID of a Wide SCSI device can have 16 different values, which gives
the possibility to connect 16 devices on a SCSI chain without using the
"LUN-mechanism". For backward compatibility you can connect non-wide
devices on a wide-chain too, but their ID's range from 0 to 7.
Furhermore I heard that non-wide take actually two ID's when connected
on a WIDE chain: the configured ID and that ID+8. They can be addressed
by their own ID, but the other ID is lost.

The nice thing about SCSI in general is that external devices can easily
be connected. When having some internal wide devices and a non-wide
external device we can get complications however. In my case, I have 2
internal wide devices and 1 (non-wide) CD-ROM player. To be able to
connect as much external devices as possible, I chose ID's 1 and 9 for
the WIDE devices, 6 for the CD-ROM and 7 for the Adapter. This way I can
connect up to 5 external non-wide devices (ID's 0, 2, 3, 4 and 5 are
still free).

Now comes the catch: when I DO connect an external non-wide device, it's
ID is between the ID's of the internal wide devices (unless it hat ID
0). This causes problems during boot when I have connected an external
device: what used to be /dev/sdb has become /dev/sdc. Now /etc/fstab is
no longer accurate!

To avoid this problem, I changed the scanning order for wide scsi
devices in the kernel. I changed it to:
0,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15. This means that wide devices are
always checked in pairs. Now I can use both ID 1 and 9 for my external
wide devices and still connect an external non-wide devices.

On my machine I get the following SCSI order:

Attached devices:
Host: scsi0 Channel: 00 Id: 01 Lun: 00
Vendor: SEAGATE Model: ST34520W Rev: 1206
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 09 Lun: 00
Vendor: SEAGATE Model: ST34520W Rev: 1206
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 03 Lun: 00
Vendor: DEC Model: DSP5400S Rev: 427L
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 06 Lun: 00
Vendor: PLEXTOR Model: CD-ROM PX-32TS Rev: 1.01
Type: CD-ROM ANSI SCSI revision: 02

You can see that first devices 1 and 9 are scanned, and then 3 and 6
are. In this case ID 3 is an external device. Now devices 1 and 9 ALWAYS
will be /dev/sda and /dev/sdb, unless I connect a (bootable) disk at ID
0.

I attached a patch to take care of this in kernel 2.1.129. it should be
applied to drivers/scsi/scsi.c

--------------5660CA4907629B02922D6295
Content-Type: application/octet-stream; name="scsi.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="scsi.patch"

LS0tIHNjc2kuYy5vcmlnCVdlZCBOb3YgMjUgMjE6Mjg6NDMgMTk5OAorKysgc2NzaS5jCVdl
ZCBOb3YgMjUgMjE6MTQ6NTEgMTk5OApAQCAtNTIxLDkgKzUyMSwxMyBAQAogCiAgIH0KICAg
ZWxzZSB7CisgICAgaW50IG9yZGVyX2RldjsKKyAgICBpbnQgaXNfd2lkZSA9IChzaHBudC0+
bWF4X2lkID09IDE2KTsKKwogICAgIGZvciAoY2hhbm5lbCA9IDA7IGNoYW5uZWwgPD0gc2hw
bnQtPm1heF9jaGFubmVsOyBjaGFubmVsKyspIHsKICAgICAgIGZvciAoZGV2ID0gMDsgZGV2
IDwgc2hwbnQtPm1heF9pZDsgKytkZXYpIHsKLSAgICAgICAgaWYgKHNocG50LT50aGlzX2lk
ICE9IGRldikgeworICAgICAgICBvcmRlcl9kZXYgPSAoIGlzX3dpZGUgPyAoKGRldiA8PCAz
KSAmIDgpIHwgKGRldiA+PiAxKSA6IGRldik7CisgICAgICAgIGlmIChzaHBudC0+dGhpc19p
ZCAhPSBvcmRlcl9kZXYpIHsKIAogICAgICAgICAgIC8qCiAgICAgICAgICAgICogV2UgbmVl
ZCB0aGUgZm9yIHNvIG91ciBjb250aW51ZSwgZXRjLiB3b3JrIGZpbmUuIFdlIHB1dCB0aGlz
IGluCkBAIC01MzQsNyArNTM4LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhf
c2NzaV9sdW5zIDogc2hwbnQtPm1heF9sdW4pOwogCSAgc3BhcnNlX2x1biA9IDA7CiAgICAg
ICAgICAgZm9yIChsdW4gPSAwOyBsdW4gPCBtYXhfZGV2X2x1bjsgKytsdW4pIHsKLSAgICAg
ICAgICAgIGlmICghc2Nhbl9zY3Npc19zaW5nbGUgKGNoYW5uZWwsIGRldiwgbHVuLCAmbWF4
X2Rldl9sdW4sCisgICAgICAgICAgICBpZiAoIXNjYW5fc2NzaXNfc2luZ2xlIChjaGFubmVs
LCBvcmRlcl9kZXYsIGx1biwgJm1heF9kZXZfbHVuLAogCQkJCSAgICAmc3BhcnNlX2x1biwg
JlNEcG50LCBTQ3BudCwgc2hwbnQsCiAJCQkJICAgIHNjc2lfcmVzdWx0KQogCQkmJiAhc3Bh
cnNlX2x1bikK
--------------5660CA4907629B02922D6295--

-
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/