diff options
author | Dan Williams <dan.j.williams@intel.com> | 2014-12-30 14:46:17 -0800 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2015-01-09 15:44:19 +0100 |
commit | 921ce7f5786052749a22a75780f5ce1a456bcdc6 (patch) | |
tree | 88b5aa17bc95e68a8ab7635bbc2a0221718044ca /drivers/scsi/ses.c | |
parent | 967f7bab0eaaa74d7d01a56d45aa309f78fb87dd (diff) | |
download | op-kernel-dev-921ce7f5786052749a22a75780f5ce1a456bcdc6.zip op-kernel-dev-921ce7f5786052749a22a75780f5ce1a456bcdc6.tar.gz |
ses: add reliable slot attribute
The name provided by firmware is in a vendor specific format, publish
the slot number to have a reliable mechanism for identifying slots
across firmware implementations. If the enclosure does not provide a
slot number fallback to the component number which is guaranteed unique,
and usually mirrors the slot number.
Cleaned up the unused ses_component.desc in the process.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Reviewed-by: Jens Axboe <axboe@fb.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/ses.c')
-rw-r--r-- | drivers/scsi/ses.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 1041556..433de8e 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -47,7 +47,6 @@ struct ses_device { struct ses_component { u64 addr; - unsigned char *desc; }; static int ses_probe(struct device *dev) @@ -307,19 +306,26 @@ static void ses_process_descriptor(struct enclosure_component *ecomp, int invalid = desc[0] & 0x80; enum scsi_protocol proto = desc[0] & 0x0f; u64 addr = 0; + int slot = -1; struct ses_component *scomp = ecomp->scratch; unsigned char *d; - scomp->desc = desc; - if (invalid) return; switch (proto) { + case SCSI_PROTOCOL_FCP: + if (eip) { + d = desc + 4; + slot = d[3]; + } + break; case SCSI_PROTOCOL_SAS: - if (eip) + if (eip) { + d = desc + 4; + slot = d[3]; d = desc + 8; - else + } else d = desc + 4; /* only take the phy0 addr */ addr = (u64)d[12] << 56 | @@ -335,6 +341,7 @@ static void ses_process_descriptor(struct enclosure_component *ecomp, /* FIXME: Need to add more protocols than just SAS */ break; } + ecomp->slot = slot; scomp->addr = addr; } |