Skip to content

Commit 7630b3a

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: hpsa: use bus '3' for legacy HBA devices
Older controllers use SCSI target id '0' for the first internal disk. As the controllers are now placed on the same bus as the internal disks this leads to a clash with the SCSI target id of controller. This patch checks the SCSI revision, and moves older controller to bus '3' to be compatible with older releases and avoid this problem. [mkp: fixed uninitialized variable] Fixes: 09371d6 ("hpsa: Change SAS transport devices to bus 0.") Cc: <stable@vger.kernel.org> # v4.5+ Signed-off-by: Hannes Reinecke <hare@suse.com> Acked-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 208da78 commit 7630b3a

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

drivers/scsi/hpsa.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,7 +2009,7 @@ static struct hpsa_scsi_dev_t *lookup_hpsa_scsi_dev(struct ctlr_info *h,
20092009

20102010
static int hpsa_slave_alloc(struct scsi_device *sdev)
20112011
{
2012-
struct hpsa_scsi_dev_t *sd;
2012+
struct hpsa_scsi_dev_t *sd = NULL;
20132013
unsigned long flags;
20142014
struct ctlr_info *h;
20152015

@@ -2026,7 +2026,8 @@ static int hpsa_slave_alloc(struct scsi_device *sdev)
20262026
sd->target = sdev_id(sdev);
20272027
sd->lun = sdev->lun;
20282028
}
2029-
} else
2029+
}
2030+
if (!sd)
20302031
sd = lookup_hpsa_scsi_dev(h, sdev_channel(sdev),
20312032
sdev_id(sdev), sdev->lun);
20322033

@@ -3840,6 +3841,7 @@ static int hpsa_update_device_info(struct ctlr_info *h,
38403841
sizeof(this_device->vendor));
38413842
memcpy(this_device->model, &inq_buff[16],
38423843
sizeof(this_device->model));
3844+
this_device->rev = inq_buff[2];
38433845
memset(this_device->device_id, 0,
38443846
sizeof(this_device->device_id));
38453847
if (hpsa_get_device_id(h, scsi3addr, this_device->device_id, 8,
@@ -3929,10 +3931,14 @@ static void figure_bus_target_lun(struct ctlr_info *h,
39293931

39303932
if (!is_logical_dev_addr_mode(lunaddrbytes)) {
39313933
/* physical device, target and lun filled in later */
3932-
if (is_hba_lunid(lunaddrbytes))
3934+
if (is_hba_lunid(lunaddrbytes)) {
3935+
int bus = HPSA_HBA_BUS;
3936+
3937+
if (!device->rev)
3938+
bus = HPSA_LEGACY_HBA_BUS;
39333939
hpsa_set_bus_target_lun(device,
3934-
HPSA_HBA_BUS, 0, lunid & 0x3fff);
3935-
else
3940+
bus, 0, lunid & 0x3fff);
3941+
} else
39363942
/* defer target, lun assignment for physical devices */
39373943
hpsa_set_bus_target_lun(device,
39383944
HPSA_PHYSICAL_DEVICE_BUS, -1, -1);

drivers/scsi/hpsa.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ struct hpsa_scsi_dev_t {
6969
u64 sas_address;
7070
unsigned char vendor[8]; /* bytes 8-15 of inquiry data */
7171
unsigned char model[16]; /* bytes 16-31 of inquiry data */
72+
unsigned char rev; /* byte 2 of inquiry data */
7273
unsigned char raid_level; /* from inquiry page 0xC1 */
7374
unsigned char volume_offline; /* discovered via TUR or VPD */
7475
u16 queue_depth; /* max queue_depth for this device */
@@ -402,6 +403,7 @@ struct offline_device_entry {
402403
#define HPSA_RAID_VOLUME_BUS 1
403404
#define HPSA_EXTERNAL_RAID_VOLUME_BUS 2
404405
#define HPSA_HBA_BUS 0
406+
#define HPSA_LEGACY_HBA_BUS 3
405407

406408
/*
407409
Send the command to the hardware

0 commit comments

Comments
 (0)