Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 292897
b: refs/heads/master
c: 4f4eb9f
h: refs/heads/master
i:
  292895: c10c2a6
v: v3
  • Loading branch information
Scott Teel authored and James Bottomley committed Feb 19, 2012
1 parent 616f790 commit e5a911b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 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: aca4a5200dc2b0835f5477d6609a05b0401a91f3
refs/heads/master: 4f4eb9f1d8f8eb91d0dd486deafd4800b425f289
43 changes: 22 additions & 21 deletions trunk/drivers/scsi/hpsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ static int check_for_unit_attention(struct ctlr_info *h,
dev_warn(&h->pdev->dev, HPSA "%d: report LUN data "
"changed, action required\n", h->ctlr);
/*
* Note: this REPORT_LUNS_CHANGED condition only occurs on the MSA2012.
* Note: this REPORT_LUNS_CHANGED condition only occurs on the external
* target (array) devices.
*/
break;
case POWER_OR_RESET:
Expand Down Expand Up @@ -1602,7 +1603,7 @@ static int hpsa_update_device_info(struct ctlr_info *h,
return 1;
}

static unsigned char *msa2xxx_model[] = {
static unsigned char *ext_target_model[] = {
"MSA2012",
"MSA2024",
"MSA2312",
Expand All @@ -1611,19 +1612,19 @@ static unsigned char *msa2xxx_model[] = {
NULL,
};

static int is_msa2xxx(struct ctlr_info *h, struct hpsa_scsi_dev_t *device)
static int is_ext_target(struct ctlr_info *h, struct hpsa_scsi_dev_t *device)
{
int i;

for (i = 0; msa2xxx_model[i]; i++)
if (strncmp(device->model, msa2xxx_model[i],
strlen(msa2xxx_model[i])) == 0)
for (i = 0; ext_target_model[i]; i++)
if (strncmp(device->model, ext_target_model[i],
strlen(ext_target_model[i])) == 0)
return 1;
return 0;
}

/* Helper function to assign bus, target, lun mapping of devices.
* Puts non-msa2xxx logical volumes on bus 0, msa2xxx logical
* Puts non-external target logical volumes on bus 0, external target logical
* volumes on bus 1, physical devices on bus 2. and the hba on bus 3.
* Logical drive target and lun are assigned at this time, but
* physical device lun and target assignment are deferred (assigned
Expand All @@ -1644,8 +1645,8 @@ static void figure_bus_target_lun(struct ctlr_info *h,
return;
}
/* It's a logical device */
if (is_msa2xxx(h, device)) {
/* msa2xxx way, put logicals on bus 1
if (is_ext_target(h, device)) {
/* external target way, put logicals on bus 1
* and match target/lun numbers box
* reports, other smart array, bus 0, target 0, match lunid
*/
Expand All @@ -1658,7 +1659,7 @@ static void figure_bus_target_lun(struct ctlr_info *h,

/*
* If there is no lun 0 on a target, linux won't find any devices.
* For the MSA2xxx boxes, we have to manually detect the enclosure
* For the external targets (arrays), we have to manually detect the enclosure
* which is at lun zero, as CCISS_REPORT_PHYSICAL_LUNS doesn't report
* it for some reason. *tmpdevice is the target we're adding,
* this_device is a pointer into the current element of currentsd[]
Expand All @@ -1667,10 +1668,10 @@ static void figure_bus_target_lun(struct ctlr_info *h,
* lun 0 assigned.
* Returns 1 if an enclosure was added, 0 if not.
*/
static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
static int add_ext_target_dev(struct ctlr_info *h,
struct hpsa_scsi_dev_t *tmpdevice,
struct hpsa_scsi_dev_t *this_device, u8 *lunaddrbytes,
unsigned long lunzerobits[], int *nmsa2xxx_enclosures)
unsigned long lunzerobits[], int *n_ext_target_devs)
{
unsigned char scsi3addr[8];

Expand All @@ -1680,8 +1681,8 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
if (!is_logical_dev_addr_mode(lunaddrbytes))
return 0; /* It's the logical targets that may lack lun 0. */

if (!is_msa2xxx(h, tmpdevice))
return 0; /* It's only the MSA2xxx that have this problem. */
if (!is_ext_target(h, tmpdevice))
return 0; /* Only external target devices have this problem. */

if (tmpdevice->lun == 0) /* if lun is 0, then we have a lun 0. */
return 0;
Expand All @@ -1694,7 +1695,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
if (is_scsi_rev_5(h))
return 0; /* p1210m doesn't need to do this. */

if (*nmsa2xxx_enclosures >= MAX_EXT_TARGETS) {
if (*n_ext_target_devs >= MAX_EXT_TARGETS) {
dev_warn(&h->pdev->dev, "Maximum number of external "
"target devices exceeded. Check your hardware "
"configuration.");
Expand All @@ -1703,7 +1704,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,

if (hpsa_update_device_info(h, scsi3addr, this_device, NULL))
return 0;
(*nmsa2xxx_enclosures)++;
(*n_ext_target_devs)++;
hpsa_set_bus_target_lun(this_device,
tmpdevice->bus, tmpdevice->target, 0);
set_bit(tmpdevice->target, lunzerobits);
Expand Down Expand Up @@ -1800,7 +1801,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
struct hpsa_scsi_dev_t **currentsd, *this_device, *tmpdevice;
int ncurrent = 0;
int reportlunsize = sizeof(*physdev_list) + HPSA_MAX_PHYS_LUN * 8;
int i, nmsa2xxx_enclosures, ndevs_to_allocate;
int i, n_ext_target_devs, ndevs_to_allocate;
int raid_ctlr_position;
DECLARE_BITMAP(lunzerobits, MAX_EXT_TARGETS);

Expand Down Expand Up @@ -1849,7 +1850,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
raid_ctlr_position = nphysicals + nlogicals;

/* adjust our table of devices */
nmsa2xxx_enclosures = 0;
n_ext_target_devs = 0;
for (i = 0; i < nphysicals + nlogicals + 1; i++) {
u8 *lunaddrbytes, is_OBDR = 0;

Expand All @@ -1869,15 +1870,15 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
this_device = currentsd[ncurrent];

/*
* For the msa2xxx boxes, we have to insert a LUN 0 which
* For external target devices, we have to insert a LUN 0 which
* doesn't show up in CCISS_REPORT_PHYSICAL data, but there
* is nonetheless an enclosure device there. We have to
* present that otherwise linux won't find anything if
* there is no lun 0.
*/
if (add_msa2xxx_enclosure_device(h, tmpdevice, this_device,
if (add_ext_target_dev(h, tmpdevice, this_device,
lunaddrbytes, lunzerobits,
&nmsa2xxx_enclosures)) {
&n_ext_target_devs)) {
ncurrent++;
this_device = currentsd[ncurrent];
}
Expand Down

0 comments on commit e5a911b

Please sign in to comment.