aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2014-12-30 17:46:17 -0500
committerChristoph Hellwig <hch@lst.de>2015-01-09 09:44:19 -0500
commit921ce7f5786052749a22a75780f5ce1a456bcdc6 (patch)
tree88b5aa17bc95e68a8ab7635bbc2a0221718044ca /drivers/scsi
parent967f7bab0eaaa74d7d01a56d45aa309f78fb87dd (diff)
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')
-rw-r--r--drivers/scsi/ses.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index 1041556cdbf3..433de8e6f538 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -47,7 +47,6 @@ struct ses_device {
47 47
48struct ses_component { 48struct ses_component {
49 u64 addr; 49 u64 addr;
50 unsigned char *desc;
51}; 50};
52 51
53static int ses_probe(struct device *dev) 52static int ses_probe(struct device *dev)
@@ -307,19 +306,26 @@ static void ses_process_descriptor(struct enclosure_component *ecomp,
307 int invalid = desc[0] & 0x80; 306 int invalid = desc[0] & 0x80;
308 enum scsi_protocol proto = desc[0] & 0x0f; 307 enum scsi_protocol proto = desc[0] & 0x0f;
309 u64 addr = 0; 308 u64 addr = 0;
309 int slot = -1;
310 struct ses_component *scomp = ecomp->scratch; 310 struct ses_component *scomp = ecomp->scratch;
311 unsigned char *d; 311 unsigned char *d;
312 312
313 scomp->desc = desc;
314
315 if (invalid) 313 if (invalid)
316 return; 314 return;
317 315
318 switch (proto) { 316 switch (proto) {
317 case SCSI_PROTOCOL_FCP:
318 if (eip) {
319 d = desc + 4;
320 slot = d[3];
321 }
322 break;
319 case SCSI_PROTOCOL_SAS: 323 case SCSI_PROTOCOL_SAS:
320 if (eip) 324 if (eip) {
325 d = desc + 4;
326 slot = d[3];
321 d = desc + 8; 327 d = desc + 8;
322 else 328 } else
323 d = desc + 4; 329 d = desc + 4;
324 /* only take the phy0 addr */ 330 /* only take the phy0 addr */
325 addr = (u64)d[12] << 56 | 331 addr = (u64)d[12] << 56 |
@@ -335,6 +341,7 @@ static void ses_process_descriptor(struct enclosure_component *ecomp,
335 /* FIXME: Need to add more protocols than just SAS */ 341 /* FIXME: Need to add more protocols than just SAS */
336 break; 342 break;
337 } 343 }
344 ecomp->slot = slot;
338 scomp->addr = addr; 345 scomp->addr = addr;
339} 346}
340 347