diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/device_handler/scsi_dh_rdac.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index c5e4476e912b..9f1c4c2df924 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c | |||
@@ -112,6 +112,7 @@ struct c9_inquiry { | |||
112 | 112 | ||
113 | #define SUBSYS_ID_LEN 16 | 113 | #define SUBSYS_ID_LEN 16 |
114 | #define SLOT_ID_LEN 2 | 114 | #define SLOT_ID_LEN 2 |
115 | #define ARRAY_LABEL_LEN 31 | ||
115 | 116 | ||
116 | struct c4_inquiry { | 117 | struct c4_inquiry { |
117 | u8 peripheral_info; | 118 | u8 peripheral_info; |
@@ -135,6 +136,8 @@ struct rdac_controller { | |||
135 | struct rdac_pg_legacy legacy; | 136 | struct rdac_pg_legacy legacy; |
136 | struct rdac_pg_expanded expanded; | 137 | struct rdac_pg_expanded expanded; |
137 | } mode_select; | 138 | } mode_select; |
139 | u8 index; | ||
140 | u8 array_name[ARRAY_LABEL_LEN]; | ||
138 | }; | 141 | }; |
139 | struct c8_inquiry { | 142 | struct c8_inquiry { |
140 | u8 peripheral_info; | 143 | u8 peripheral_info; |
@@ -303,7 +306,8 @@ static void release_controller(struct kref *kref) | |||
303 | kfree(ctlr); | 306 | kfree(ctlr); |
304 | } | 307 | } |
305 | 308 | ||
306 | static struct rdac_controller *get_controller(u8 *subsys_id, u8 *slot_id) | 309 | static struct rdac_controller *get_controller(u8 *subsys_id, u8 *slot_id, |
310 | char *array_name) | ||
307 | { | 311 | { |
308 | struct rdac_controller *ctlr, *tmp; | 312 | struct rdac_controller *ctlr, *tmp; |
309 | 313 | ||
@@ -324,6 +328,14 @@ static struct rdac_controller *get_controller(u8 *subsys_id, u8 *slot_id) | |||
324 | /* initialize fields of controller */ | 328 | /* initialize fields of controller */ |
325 | memcpy(ctlr->subsys_id, subsys_id, SUBSYS_ID_LEN); | 329 | memcpy(ctlr->subsys_id, subsys_id, SUBSYS_ID_LEN); |
326 | memcpy(ctlr->slot_id, slot_id, SLOT_ID_LEN); | 330 | memcpy(ctlr->slot_id, slot_id, SLOT_ID_LEN); |
331 | memcpy(ctlr->array_name, array_name, ARRAY_LABEL_LEN); | ||
332 | |||
333 | /* update the controller index */ | ||
334 | if (slot_id[1] == 0x31) | ||
335 | ctlr->index = 0; | ||
336 | else | ||
337 | ctlr->index = 1; | ||
338 | |||
327 | kref_init(&ctlr->kref); | 339 | kref_init(&ctlr->kref); |
328 | ctlr->use_ms10 = -1; | 340 | ctlr->use_ms10 = -1; |
329 | list_add(&ctlr->node, &ctlr_list); | 341 | list_add(&ctlr->node, &ctlr_list); |
@@ -363,9 +375,10 @@ done: | |||
363 | return err; | 375 | return err; |
364 | } | 376 | } |
365 | 377 | ||
366 | static int get_lun(struct scsi_device *sdev, struct rdac_dh_data *h) | 378 | static int get_lun_info(struct scsi_device *sdev, struct rdac_dh_data *h, |
379 | char *array_name) | ||
367 | { | 380 | { |
368 | int err; | 381 | int err, i; |
369 | struct c8_inquiry *inqp; | 382 | struct c8_inquiry *inqp; |
370 | 383 | ||
371 | err = submit_inquiry(sdev, 0xC8, sizeof(struct c8_inquiry), h); | 384 | err = submit_inquiry(sdev, 0xC8, sizeof(struct c8_inquiry), h); |
@@ -377,6 +390,11 @@ static int get_lun(struct scsi_device *sdev, struct rdac_dh_data *h) | |||
377 | inqp->page_id[2] != 'i' || inqp->page_id[3] != 'd') | 390 | inqp->page_id[2] != 'i' || inqp->page_id[3] != 'd') |
378 | return SCSI_DH_NOSYS; | 391 | return SCSI_DH_NOSYS; |
379 | h->lun = inqp->lun[7]; /* Uses only the last byte */ | 392 | h->lun = inqp->lun[7]; /* Uses only the last byte */ |
393 | |||
394 | for(i=0; i<ARRAY_LABEL_LEN-1; ++i) | ||
395 | *(array_name+i) = inqp->array_user_label[(2*i)+1]; | ||
396 | |||
397 | *(array_name+ARRAY_LABEL_LEN-1) = '\0'; | ||
380 | } | 398 | } |
381 | return err; | 399 | return err; |
382 | } | 400 | } |
@@ -410,7 +428,7 @@ static int check_ownership(struct scsi_device *sdev, struct rdac_dh_data *h) | |||
410 | } | 428 | } |
411 | 429 | ||
412 | static int initialize_controller(struct scsi_device *sdev, | 430 | static int initialize_controller(struct scsi_device *sdev, |
413 | struct rdac_dh_data *h) | 431 | struct rdac_dh_data *h, char *array_name) |
414 | { | 432 | { |
415 | int err; | 433 | int err; |
416 | struct c4_inquiry *inqp; | 434 | struct c4_inquiry *inqp; |
@@ -418,7 +436,8 @@ static int initialize_controller(struct scsi_device *sdev, | |||
418 | err = submit_inquiry(sdev, 0xC4, sizeof(struct c4_inquiry), h); | 436 | err = submit_inquiry(sdev, 0xC4, sizeof(struct c4_inquiry), h); |
419 | if (err == SCSI_DH_OK) { | 437 | if (err == SCSI_DH_OK) { |
420 | inqp = &h->inq.c4; | 438 | inqp = &h->inq.c4; |
421 | h->ctlr = get_controller(inqp->subsys_id, inqp->slot_id); | 439 | h->ctlr = get_controller(inqp->subsys_id, inqp->slot_id, |
440 | array_name); | ||
422 | if (!h->ctlr) | 441 | if (!h->ctlr) |
423 | err = SCSI_DH_RES_TEMP_UNAVAIL; | 442 | err = SCSI_DH_RES_TEMP_UNAVAIL; |
424 | } | 443 | } |
@@ -652,6 +671,7 @@ static int rdac_bus_attach(struct scsi_device *sdev) | |||
652 | struct rdac_dh_data *h; | 671 | struct rdac_dh_data *h; |
653 | unsigned long flags; | 672 | unsigned long flags; |
654 | int err; | 673 | int err; |
674 | char array_name[ARRAY_LABEL_LEN]; | ||
655 | 675 | ||
656 | scsi_dh_data = kzalloc(sizeof(struct scsi_device_handler *) | 676 | scsi_dh_data = kzalloc(sizeof(struct scsi_device_handler *) |
657 | + sizeof(*h) , GFP_KERNEL); | 677 | + sizeof(*h) , GFP_KERNEL); |
@@ -666,11 +686,11 @@ static int rdac_bus_attach(struct scsi_device *sdev) | |||
666 | h->lun = UNINITIALIZED_LUN; | 686 | h->lun = UNINITIALIZED_LUN; |
667 | h->state = RDAC_STATE_ACTIVE; | 687 | h->state = RDAC_STATE_ACTIVE; |
668 | 688 | ||
669 | err = get_lun(sdev, h); | 689 | err = get_lun_info(sdev, h, array_name); |
670 | if (err != SCSI_DH_OK) | 690 | if (err != SCSI_DH_OK) |
671 | goto failed; | 691 | goto failed; |
672 | 692 | ||
673 | err = initialize_controller(sdev, h); | 693 | err = initialize_controller(sdev, h, array_name); |
674 | if (err != SCSI_DH_OK) | 694 | if (err != SCSI_DH_OK) |
675 | goto failed; | 695 | goto failed; |
676 | 696 | ||