Loading drivers/scsi/hpsa.c +30 −38 Original line number Original line Diff line number Diff line Loading @@ -1630,35 +1630,30 @@ static int is_msa2xxx(struct ctlr_info *h, struct hpsa_scsi_dev_t *device) * in hpsa_find_target_lun, called by hpsa_scsi_add_entry.) * in hpsa_find_target_lun, called by hpsa_scsi_add_entry.) */ */ static void figure_bus_target_lun(struct ctlr_info *h, static void figure_bus_target_lun(struct ctlr_info *h, u8 *lunaddrbytes, int *bus, int *target, int *lun, u8 *lunaddrbytes, struct hpsa_scsi_dev_t *device) struct hpsa_scsi_dev_t *device) { { u32 lunid; u32 lunid = le32_to_cpu(*((__le32 *) lunaddrbytes)); if (is_logical_dev_addr_mode(lunaddrbytes)) { if (!is_logical_dev_addr_mode(lunaddrbytes)) { /* logical device */ /* physical device, target and lun filled in later */ lunid = le32_to_cpu(*((__le32 *) lunaddrbytes)); if (is_hba_lunid(lunaddrbytes)) hpsa_set_bus_target_lun(device, 3, 0, lunid & 0x3fff); else /* defer target, lun assignment for physical devices */ hpsa_set_bus_target_lun(device, 2, -1, -1); return; } /* It's a logical device */ if (is_msa2xxx(h, device)) { if (is_msa2xxx(h, device)) { /* msa2xxx way, put logicals on bus 1 /* msa2xxx way, put logicals on bus 1 * and match target/lun numbers box * and match target/lun numbers box * reports. * reports, other smart array, bus 0, target 0, match lunid */ */ *bus = 1; hpsa_set_bus_target_lun(device, *target = (lunid >> 16) & 0x3fff; 1, (lunid >> 16) & 0x3fff, lunid & 0x00ff); *lun = lunid & 0x00ff; return; } else { *bus = 0; *target = 0; *lun = (lunid & 0x3fff); } } else { if (is_hba_lunid(lunaddrbytes)) *bus = 3; /* controller */ else *bus = 2; /* physical device */ *target = -1; *lun = -1; /* we will fill these in later. */ } } hpsa_set_bus_target_lun(device, 0, 0, lunid & 0x3fff); } } /* /* Loading @@ -1675,12 +1670,11 @@ static void figure_bus_target_lun(struct ctlr_info *h, static int add_msa2xxx_enclosure_device(struct ctlr_info *h, static int add_msa2xxx_enclosure_device(struct ctlr_info *h, struct hpsa_scsi_dev_t *tmpdevice, struct hpsa_scsi_dev_t *tmpdevice, struct hpsa_scsi_dev_t *this_device, u8 *lunaddrbytes, struct hpsa_scsi_dev_t *this_device, u8 *lunaddrbytes, int bus, int target, int lun, unsigned long lunzerobits[], unsigned long lunzerobits[], int *nmsa2xxx_enclosures) int *nmsa2xxx_enclosures) { { unsigned char scsi3addr[8]; unsigned char scsi3addr[8]; if (test_bit(target, lunzerobits)) if (test_bit(tmpdevice->target, lunzerobits)) return 0; /* There is already a lun 0 on this target. */ return 0; /* There is already a lun 0 on this target. */ if (!is_logical_dev_addr_mode(lunaddrbytes)) if (!is_logical_dev_addr_mode(lunaddrbytes)) Loading @@ -1689,11 +1683,11 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, if (!is_msa2xxx(h, tmpdevice)) if (!is_msa2xxx(h, tmpdevice)) return 0; /* It's only the MSA2xxx that have this problem. */ return 0; /* It's only the MSA2xxx that have this problem. */ if (lun == 0) /* if lun is 0, then obviously we have a lun 0. */ if (tmpdevice->lun == 0) /* if lun is 0, then we have a lun 0. */ return 0; return 0; memset(scsi3addr, 0, 8); memset(scsi3addr, 0, 8); scsi3addr[3] = target; scsi3addr[3] = tmpdevice->target; if (is_hba_lunid(scsi3addr)) if (is_hba_lunid(scsi3addr)) return 0; /* Don't add the RAID controller here. */ return 0; /* Don't add the RAID controller here. */ Loading @@ -1710,8 +1704,9 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, if (hpsa_update_device_info(h, scsi3addr, this_device, NULL)) if (hpsa_update_device_info(h, scsi3addr, this_device, NULL)) return 0; return 0; (*nmsa2xxx_enclosures)++; (*nmsa2xxx_enclosures)++; hpsa_set_bus_target_lun(this_device, bus, target, 0); hpsa_set_bus_target_lun(this_device, set_bit(target, lunzerobits); tmpdevice->bus, tmpdevice->target, 0); set_bit(tmpdevice->target, lunzerobits); return 1; return 1; } } Loading Loading @@ -1806,7 +1801,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) int ncurrent = 0; int ncurrent = 0; int reportlunsize = sizeof(*physdev_list) + HPSA_MAX_PHYS_LUN * 8; int reportlunsize = sizeof(*physdev_list) + HPSA_MAX_PHYS_LUN * 8; int i, nmsa2xxx_enclosures, ndevs_to_allocate; int i, nmsa2xxx_enclosures, ndevs_to_allocate; int bus, target, lun; int raid_ctlr_position; int raid_ctlr_position; DECLARE_BITMAP(lunzerobits, HPSA_MAX_TARGETS_PER_CTLR); DECLARE_BITMAP(lunzerobits, HPSA_MAX_TARGETS_PER_CTLR); Loading Loading @@ -1871,8 +1865,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice, if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice, &is_OBDR)) &is_OBDR)) continue; /* skip it if we can't talk to it. */ continue; /* skip it if we can't talk to it. */ figure_bus_target_lun(h, lunaddrbytes, &bus, &target, &lun, figure_bus_target_lun(h, lunaddrbytes, tmpdevice); tmpdevice); this_device = currentsd[ncurrent]; this_device = currentsd[ncurrent]; /* /* Loading @@ -1883,14 +1876,13 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) * there is no lun 0. * there is no lun 0. */ */ if (add_msa2xxx_enclosure_device(h, tmpdevice, this_device, if (add_msa2xxx_enclosure_device(h, tmpdevice, this_device, lunaddrbytes, bus, target, lun, lunzerobits, lunaddrbytes, lunzerobits, &nmsa2xxx_enclosures)) { &nmsa2xxx_enclosures)) { ncurrent++; ncurrent++; this_device = currentsd[ncurrent]; this_device = currentsd[ncurrent]; } } *this_device = *tmpdevice; *this_device = *tmpdevice; hpsa_set_bus_target_lun(this_device, bus, target, lun); switch (this_device->devtype) { switch (this_device->devtype) { case TYPE_ROM: case TYPE_ROM: Loading Loading
drivers/scsi/hpsa.c +30 −38 Original line number Original line Diff line number Diff line Loading @@ -1630,35 +1630,30 @@ static int is_msa2xxx(struct ctlr_info *h, struct hpsa_scsi_dev_t *device) * in hpsa_find_target_lun, called by hpsa_scsi_add_entry.) * in hpsa_find_target_lun, called by hpsa_scsi_add_entry.) */ */ static void figure_bus_target_lun(struct ctlr_info *h, static void figure_bus_target_lun(struct ctlr_info *h, u8 *lunaddrbytes, int *bus, int *target, int *lun, u8 *lunaddrbytes, struct hpsa_scsi_dev_t *device) struct hpsa_scsi_dev_t *device) { { u32 lunid; u32 lunid = le32_to_cpu(*((__le32 *) lunaddrbytes)); if (is_logical_dev_addr_mode(lunaddrbytes)) { if (!is_logical_dev_addr_mode(lunaddrbytes)) { /* logical device */ /* physical device, target and lun filled in later */ lunid = le32_to_cpu(*((__le32 *) lunaddrbytes)); if (is_hba_lunid(lunaddrbytes)) hpsa_set_bus_target_lun(device, 3, 0, lunid & 0x3fff); else /* defer target, lun assignment for physical devices */ hpsa_set_bus_target_lun(device, 2, -1, -1); return; } /* It's a logical device */ if (is_msa2xxx(h, device)) { if (is_msa2xxx(h, device)) { /* msa2xxx way, put logicals on bus 1 /* msa2xxx way, put logicals on bus 1 * and match target/lun numbers box * and match target/lun numbers box * reports. * reports, other smart array, bus 0, target 0, match lunid */ */ *bus = 1; hpsa_set_bus_target_lun(device, *target = (lunid >> 16) & 0x3fff; 1, (lunid >> 16) & 0x3fff, lunid & 0x00ff); *lun = lunid & 0x00ff; return; } else { *bus = 0; *target = 0; *lun = (lunid & 0x3fff); } } else { if (is_hba_lunid(lunaddrbytes)) *bus = 3; /* controller */ else *bus = 2; /* physical device */ *target = -1; *lun = -1; /* we will fill these in later. */ } } hpsa_set_bus_target_lun(device, 0, 0, lunid & 0x3fff); } } /* /* Loading @@ -1675,12 +1670,11 @@ static void figure_bus_target_lun(struct ctlr_info *h, static int add_msa2xxx_enclosure_device(struct ctlr_info *h, static int add_msa2xxx_enclosure_device(struct ctlr_info *h, struct hpsa_scsi_dev_t *tmpdevice, struct hpsa_scsi_dev_t *tmpdevice, struct hpsa_scsi_dev_t *this_device, u8 *lunaddrbytes, struct hpsa_scsi_dev_t *this_device, u8 *lunaddrbytes, int bus, int target, int lun, unsigned long lunzerobits[], unsigned long lunzerobits[], int *nmsa2xxx_enclosures) int *nmsa2xxx_enclosures) { { unsigned char scsi3addr[8]; unsigned char scsi3addr[8]; if (test_bit(target, lunzerobits)) if (test_bit(tmpdevice->target, lunzerobits)) return 0; /* There is already a lun 0 on this target. */ return 0; /* There is already a lun 0 on this target. */ if (!is_logical_dev_addr_mode(lunaddrbytes)) if (!is_logical_dev_addr_mode(lunaddrbytes)) Loading @@ -1689,11 +1683,11 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, if (!is_msa2xxx(h, tmpdevice)) if (!is_msa2xxx(h, tmpdevice)) return 0; /* It's only the MSA2xxx that have this problem. */ return 0; /* It's only the MSA2xxx that have this problem. */ if (lun == 0) /* if lun is 0, then obviously we have a lun 0. */ if (tmpdevice->lun == 0) /* if lun is 0, then we have a lun 0. */ return 0; return 0; memset(scsi3addr, 0, 8); memset(scsi3addr, 0, 8); scsi3addr[3] = target; scsi3addr[3] = tmpdevice->target; if (is_hba_lunid(scsi3addr)) if (is_hba_lunid(scsi3addr)) return 0; /* Don't add the RAID controller here. */ return 0; /* Don't add the RAID controller here. */ Loading @@ -1710,8 +1704,9 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, if (hpsa_update_device_info(h, scsi3addr, this_device, NULL)) if (hpsa_update_device_info(h, scsi3addr, this_device, NULL)) return 0; return 0; (*nmsa2xxx_enclosures)++; (*nmsa2xxx_enclosures)++; hpsa_set_bus_target_lun(this_device, bus, target, 0); hpsa_set_bus_target_lun(this_device, set_bit(target, lunzerobits); tmpdevice->bus, tmpdevice->target, 0); set_bit(tmpdevice->target, lunzerobits); return 1; return 1; } } Loading Loading @@ -1806,7 +1801,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) int ncurrent = 0; int ncurrent = 0; int reportlunsize = sizeof(*physdev_list) + HPSA_MAX_PHYS_LUN * 8; int reportlunsize = sizeof(*physdev_list) + HPSA_MAX_PHYS_LUN * 8; int i, nmsa2xxx_enclosures, ndevs_to_allocate; int i, nmsa2xxx_enclosures, ndevs_to_allocate; int bus, target, lun; int raid_ctlr_position; int raid_ctlr_position; DECLARE_BITMAP(lunzerobits, HPSA_MAX_TARGETS_PER_CTLR); DECLARE_BITMAP(lunzerobits, HPSA_MAX_TARGETS_PER_CTLR); Loading Loading @@ -1871,8 +1865,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice, if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice, &is_OBDR)) &is_OBDR)) continue; /* skip it if we can't talk to it. */ continue; /* skip it if we can't talk to it. */ figure_bus_target_lun(h, lunaddrbytes, &bus, &target, &lun, figure_bus_target_lun(h, lunaddrbytes, tmpdevice); tmpdevice); this_device = currentsd[ncurrent]; this_device = currentsd[ncurrent]; /* /* Loading @@ -1883,14 +1876,13 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) * there is no lun 0. * there is no lun 0. */ */ if (add_msa2xxx_enclosure_device(h, tmpdevice, this_device, if (add_msa2xxx_enclosure_device(h, tmpdevice, this_device, lunaddrbytes, bus, target, lun, lunzerobits, lunaddrbytes, lunzerobits, &nmsa2xxx_enclosures)) { &nmsa2xxx_enclosures)) { ncurrent++; ncurrent++; this_device = currentsd[ncurrent]; this_device = currentsd[ncurrent]; } } *this_device = *tmpdevice; *this_device = *tmpdevice; hpsa_set_bus_target_lun(this_device, bus, target, lun); switch (this_device->devtype) { switch (this_device->devtype) { case TYPE_ROM: case TYPE_ROM: Loading