Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 261682
b: refs/heads/master
c: a53becc
h: refs/heads/master
v: v3
  • Loading branch information
Chandra Seetharaman authored and James Bottomley committed Jul 27, 2011
1 parent 7deb0d2 commit 6861f17
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 40 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e466e1c6e14e211e0ece86bdb0810b1b9c1a59a8
refs/heads/master: a53becc9a9dbe4f2961b2bba129b3b2624401021
79 changes: 40 additions & 39 deletions trunk/drivers/scsi/device_handler/scsi_dh_rdac.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,25 +128,7 @@ struct c4_inquiry {
u8 reserved[2];
};

struct rdac_controller {
u8 subsys_id[SUBSYS_ID_LEN];
u8 slot_id[SLOT_ID_LEN];
int use_ms10;
struct kref kref;
struct list_head node; /* list of all controllers */
union {
struct rdac_pg_legacy legacy;
struct rdac_pg_expanded expanded;
} mode_select;
u8 index;
u8 array_name[ARRAY_LABEL_LEN];
spinlock_t ms_lock;
int ms_queued;
struct work_struct ms_work;
struct scsi_device *ms_sdev;
struct list_head ms_head;
};

#define UNIQUE_ID_LEN 16
struct c8_inquiry {
u8 peripheral_info;
u8 page_code; /* 0xC8 */
Expand All @@ -159,12 +141,30 @@ struct c8_inquiry {
u8 vol_user_label_len;
u8 vol_user_label[60];
u8 array_uniq_id_len;
u8 array_unique_id[16];
u8 array_unique_id[UNIQUE_ID_LEN];
u8 array_user_label_len;
u8 array_user_label[60];
u8 lun[8];
};

struct rdac_controller {
u8 array_id[UNIQUE_ID_LEN];
int use_ms10;
struct kref kref;
struct list_head node; /* list of all controllers */
union {
struct rdac_pg_legacy legacy;
struct rdac_pg_expanded expanded;
} mode_select;
u8 index;
u8 array_name[ARRAY_LABEL_LEN];
spinlock_t ms_lock;
int ms_queued;
struct work_struct ms_work;
struct scsi_device *ms_sdev;
struct list_head ms_head;
};

struct c2_inquiry {
u8 peripheral_info;
u8 page_code; /* 0xC2 */
Expand Down Expand Up @@ -369,16 +369,16 @@ static void release_controller(struct kref *kref)
kfree(ctlr);
}

static struct rdac_controller *get_controller(u8 *subsys_id, u8 *slot_id,
char *array_name)
static struct rdac_controller *get_controller(int index, char *array_name,
u8 *array_id)
{
struct rdac_controller *ctlr, *tmp;

spin_lock(&list_lock);

list_for_each_entry(tmp, &ctlr_list, node) {
if ((memcmp(tmp->subsys_id, subsys_id, SUBSYS_ID_LEN) == 0) &&
(memcmp(tmp->slot_id, slot_id, SLOT_ID_LEN) == 0)) {
if ((memcmp(tmp->array_id, array_id, UNIQUE_ID_LEN) == 0) &&
(tmp->index == index)) {
kref_get(&tmp->kref);
spin_unlock(&list_lock);
return tmp;
Expand All @@ -389,16 +389,10 @@ static struct rdac_controller *get_controller(u8 *subsys_id, u8 *slot_id,
goto done;

/* initialize fields of controller */
memcpy(ctlr->subsys_id, subsys_id, SUBSYS_ID_LEN);
memcpy(ctlr->slot_id, slot_id, SLOT_ID_LEN);
memcpy(ctlr->array_id, array_id, UNIQUE_ID_LEN);
ctlr->index = index;
memcpy(ctlr->array_name, array_name, ARRAY_LABEL_LEN);

/* update the controller index */
if (slot_id[1] == 0x31)
ctlr->index = 0;
else
ctlr->index = 1;

kref_init(&ctlr->kref);
ctlr->use_ms10 = -1;
ctlr->ms_queued = 0;
Expand Down Expand Up @@ -444,7 +438,7 @@ static int submit_inquiry(struct scsi_device *sdev, int page_code,
}

static int get_lun_info(struct scsi_device *sdev, struct rdac_dh_data *h,
char *array_name)
char *array_name, u8 *array_id)
{
int err, i;
struct c8_inquiry *inqp;
Expand All @@ -463,6 +457,8 @@ static int get_lun_info(struct scsi_device *sdev, struct rdac_dh_data *h,
*(array_name+i) = inqp->array_user_label[(2*i)+1];

*(array_name+ARRAY_LABEL_LEN-1) = '\0';
memset(array_id, 0, UNIQUE_ID_LEN);
memcpy(array_id, inqp->array_unique_id, inqp->array_uniq_id_len);
}
return err;
}
Expand Down Expand Up @@ -504,16 +500,20 @@ static int check_ownership(struct scsi_device *sdev, struct rdac_dh_data *h)
}

static int initialize_controller(struct scsi_device *sdev,
struct rdac_dh_data *h, char *array_name)
struct rdac_dh_data *h, char *array_name, u8 *array_id)
{
int err;
int err, index;
struct c4_inquiry *inqp;

err = submit_inquiry(sdev, 0xC4, sizeof(struct c4_inquiry), h);
if (err == SCSI_DH_OK) {
inqp = &h->inq.c4;
h->ctlr = get_controller(inqp->subsys_id, inqp->slot_id,
array_name);
/* get the controller index */
if (inqp->slot_id[1] == 0x31)
index = 0;
else
index = 1;
h->ctlr = get_controller(index, array_name, array_id);
if (!h->ctlr)
err = SCSI_DH_RES_TEMP_UNAVAIL;
}
Expand Down Expand Up @@ -835,6 +835,7 @@ static int rdac_bus_attach(struct scsi_device *sdev)
unsigned long flags;
int err;
char array_name[ARRAY_LABEL_LEN];
char array_id[UNIQUE_ID_LEN];

scsi_dh_data = kzalloc(sizeof(*scsi_dh_data)
+ sizeof(*h) , GFP_KERNEL);
Expand All @@ -849,11 +850,11 @@ static int rdac_bus_attach(struct scsi_device *sdev)
h->lun = UNINITIALIZED_LUN;
h->state = RDAC_STATE_ACTIVE;

err = get_lun_info(sdev, h, array_name);
err = get_lun_info(sdev, h, array_name, array_id);
if (err != SCSI_DH_OK)
goto failed;

err = initialize_controller(sdev, h, array_name);
err = initialize_controller(sdev, h, array_name, array_id);
if (err != SCSI_DH_OK)
goto failed;

Expand Down

0 comments on commit 6861f17

Please sign in to comment.