kernel-ark/drivers
James Bottomley 9927c68864 [SCSI] ses: add new Enclosure ULD
This adds support to SCSI for enclosure services devices. It also makes
use of the enclosure services added in an earlier patch to display the
enclosure topology in sysfs.

At the moment, the enclosures are SAS specific, but if anyone actually
has a non-SAS enclosure that follows the SES-2 standard, we can add that
as well.

On my Vitesse based system, the enclosures show up like this:

sparkweed:~# ls -l /sys/class/enclosure/0\:0\:1\:0/
total 0
-r--r--r-- 1 root root 4096 2008-02-03 15:44 components
lrwxrwxrwx 1 root root    0 2008-02-03 15:44 device -> ../../../devices/pci0000:01/0000:01:02.0/host0/port-0:0/expander-0:0/port-0:0:12/end_device-0:0:12/target0:0:1/0:0:1:0
drwxr-xr-x 2 root root    0 2008-02-03 15:44 SLOT 000
drwxr-xr-x 2 root root    0 2008-02-03 15:44 SLOT 001
drwxr-xr-x 2 root root    0 2008-02-03 15:44 SLOT 002
drwxr-xr-x 2 root root    0 2008-02-03 15:44 SLOT 003
drwxr-xr-x 2 root root    0 2008-02-03 15:44 SLOT 004
drwxr-xr-x 2 root root    0 2008-02-03 15:44 SLOT 005
lrwxrwxrwx 1 root root    0 2008-02-03 15:44 subsystem -> ../../enclosure
--w------- 1 root root 4096 2008-02-03 15:44 uevent

And the individual occupied slots like this:

sparkweed:~# ls -l /sys/class/enclosure/0\:0\:1\:0/SLOT\ 001/
total 0
-rw-r--r-- 1 root root 4096 2008-02-03 15:45 active
lrwxrwxrwx 1 root root    0 2008-02-03 15:45 device -> ../../../../devices/pci0000:01/0000:01:02.0/host0/port-0:0/expander-0:0/port-0:0:11/end_device-0:0:11/target0:0:0/0:0:0:0
-rw-r--r-- 1 root root 4096 2008-02-03 15:45 fault
-rw-r--r-- 1 root root 4096 2008-02-03 15:45 locate
-rw-r--r-- 1 root root 4096 2008-02-03 15:45 status
lrwxrwxrwx 1 root root    0 2008-02-03 15:45 subsystem -> ../../../enclosure_component
-r--r--r-- 1 root root 4096 2008-02-03 15:45 type
--w------- 1 root root 4096 2008-02-03 15:45 uevent

You can flash the various blinky lights by echoing to the fault and locate files.

>From the device's point of view, you can see it has an enclosure like this:

sparkweed:~# ls /sys/class/scsi_disk/0\:0\:0\:0/device/
block:sda                     generic        queue_depth          state
bsg:0:0:0:0                   iocounterbits  queue_type           subsystem
bus                           iodone_cnt     rescan               timeout
delete                        ioerr_cnt      rev                  type
device_blocked                iorequest_cnt  scsi_device:0:0:0:0  uevent
driver                        modalias       scsi_disk:0:0:0:0    vendor
enclosure_component:SLOT 001  model          scsi_generic:sg0
evt_media_change              power          scsi_level

Note the enclosure_component:SLOT 001 which shows where in the enclosure
this device fits.

The astute will notice that I'm using SCSI VPD Inquiries to identify the
devices.  This, unfortunately, won't work for SATA devices unless we do
some really nasty hacking about on the SAT because the only think that
knows the SAS addresses for SATA devices is libsas, not libata where the
SAT resides.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-02-07 18:04:10 -06:00
..
acorn/char
acpi ACPI: fix build warning 2008-02-07 04:24:01 -05:00
amba
ata
atm
auxdisplay
base Driver core: Revert "Fix Firmware class name collision" 2008-02-07 11:31:46 -08:00
block Merge branch 'for-2.6.25' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-02-07 09:02:26 -08:00
bluetooth
cdrom Merge branch 'for-2.6.25' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-02-07 09:02:26 -08:00
char Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2008-02-07 12:57:44 -08:00
clocksource
connector
cpufreq [CPUFREQ] fix configuration help message 2008-02-06 22:57:58 -05:00
cpuidle Revert "cpuidle: build fix for non-x86" 2008-02-07 04:16:34 -05:00
crypto
dca
dio
dma async_tx: replace 'int_en' with operation preparation flags 2008-02-06 10:12:18 -07:00
edac drivers/edac/i3000: document type promotion 2008-02-07 08:42:23 -08:00
eisa
firewire
firmware Merge branches 'release' and 'dmi' into release 2008-02-07 03:11:31 -05:00
gpio gpio: handle pca953{4,5,6,7,8} too 2008-02-06 10:41:15 -08:00
hid
hwmon leds: Standardise LED naming scheme 2008-02-07 09:47:00 +00:00
i2c
ide Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev 2008-02-06 10:47:46 -08:00
ieee1394
infiniband
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2008-02-07 12:57:44 -08:00
isdn drivers/isdn/hardware/eicon/debug.c: fix uninitialized var warning 2008-02-06 10:41:12 -08:00
leds leds: Add HP Jornada 6xx driver 2008-02-07 10:10:28 +00:00
lguest
macintosh
mca
md md: fix an occasional deadlock in raid5 2008-02-06 10:41:19 -08:00
media Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2008-02-07 12:57:44 -08:00
message
mfd ASIC3 driver 2008-02-07 08:42:23 -08:00
misc [SCSI] enclosure: add support for enclosure services 2008-02-07 18:04:10 -06:00
mmc
mtd Merge git://git.infradead.org/mtd-2.6 2008-02-07 10:20:31 -08:00
net Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds 2008-02-07 09:45:14 -08:00
nubus
of
oprofile
parisc
parport parport_pc: detection for SuperIO IT87XX POST 2008-02-06 10:41:08 -08:00
pci Genericizing iova.[ch] 2008-02-06 10:41:01 -08:00
pcmcia
pnp Merge branches 'release', 'bugzilla-6217', 'bugzilla-6629', 'bugzilla-6933', 'bugzilla-7186', 'bugzilla-8269', 'bugzilla-8570', 'bugzilla-9139', 'bugzilla-9277', 'bugzilla-9341', 'bugzilla-9444', 'bugzilla-9614', 'bugzilla-9643' and 'bugzilla-9644' into release 2008-02-07 03:09:43 -05:00
power Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 2008-02-07 09:45:58 -08:00
ps3 ps3: use symbolic names for video modes 2008-02-06 10:41:17 -08:00
rapidio
rtc rtc: at91sam9 RTC support (RTT and/or RTC) 2008-02-06 10:41:14 -08:00
s390 calibrate_delay() must be __cpuinit 2008-02-06 10:41:08 -08:00
sbus
scsi [SCSI] ses: add new Enclosure ULD 2008-02-07 18:04:10 -06:00
serial Merge branch 'for-2.6.25' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-02-07 09:02:26 -08:00
sh
sn
spi spi: remove more dev->power.power_state usage 2008-02-06 10:41:11 -08:00
ssb
tc
telephony
thermal
uio uio: nopage 2008-02-06 10:41:07 -08:00
usb
video Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight 2008-02-07 09:45:37 -08:00
virtio virtio: add missing #include <linux/delay.h> 2008-02-06 10:41:21 -08:00
w1 DS1WM: decouple host IRQ and INTR active state settings 2008-02-07 08:42:06 -08:00
watchdog
xen
zorro
Kconfig Merge branches 'release' and 'menlo' into release 2008-02-07 03:18:04 -05:00
Makefile Merge branches 'release' and 'menlo' into release 2008-02-07 03:18:04 -05:00