Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 107919
b: refs/heads/master
c: 935dc8d
h: refs/heads/master
i:
  107917: 4593de7
  107915: ba0b2be
  107911: 61bdfd5
  107903: 876f998
v: v3
  • Loading branch information
Mike Miller authored and Jens Axboe committed Aug 6, 2008
1 parent 9083568 commit 0f2d277
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 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: f4a93bcda74edfe6977dcf296ed8c86119638871
refs/heads/master: 935dc8d7575e6c1292b057e39045a40f1fbe26e7
40 changes: 37 additions & 3 deletions trunk/drivers/block/cciss_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,16 +371,50 @@ cciss_scsi_add_entry(int ctlr, int hostno,
/* assumes hba[ctlr]->scsi_ctlr->lock is held */
int n = ccissscsi[ctlr].ndevices;
struct cciss_scsi_dev_t *sd;
int i, bus, target, lun;
unsigned char addr1[8], addr2[8];

if (n >= CCISS_MAX_SCSI_DEVS_PER_HBA) {
printk("cciss%d: Too many devices, "
"some will be inaccessible.\n", ctlr);
return -1;
}
sd = &ccissscsi[ctlr].dev[n];
if (find_bus_target_lun(ctlr, &sd->bus, &sd->target, &sd->lun) != 0)
return -1;

bus = target = -1;
lun = 0;
/* Is this device a non-zero lun of a multi-lun device */
/* byte 4 of the 8-byte LUN addr will contain the logical unit no. */
if (scsi3addr[4] != 0) {
/* Search through our list and find the device which */
/* has the same 8 byte LUN address, excepting byte 4. */
/* Assign the same bus and target for this new LUN. */
/* Use the logical unit number from the firmware. */
memcpy(addr1, scsi3addr, 8);
addr1[4] = 0;
for (i = 0; i < n; i++) {
sd = &ccissscsi[ctlr].dev[i];
memcpy(addr2, sd->scsi3addr, 8);
addr2[4] = 0;
/* differ only in byte 4? */
if (memcmp(addr1, addr2, 8) == 0) {
bus = sd->bus;
target = sd->target;
lun = scsi3addr[4];
break;
}
}
}

sd = &ccissscsi[ctlr].dev[n];
if (lun == 0) {
if (find_bus_target_lun(ctlr,
&sd->bus, &sd->target, &sd->lun) != 0)
return -1;
} else {
sd->bus = bus;
sd->target = target;
sd->lun = lun;
}
added[*nadded].bus = sd->bus;
added[*nadded].target = sd->target;
added[*nadded].lun = sd->lun;
Expand Down

0 comments on commit 0f2d277

Please sign in to comment.