diff options
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r-- | drivers/scsi/hpsa.c | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index ec61bdb833ac..1f32f0610bc0 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -1548,10 +1548,17 @@ static inline void hpsa_set_bus_target_lun(struct hpsa_scsi_dev_t *device, | |||
1548 | } | 1548 | } |
1549 | 1549 | ||
1550 | static int hpsa_update_device_info(struct ctlr_info *h, | 1550 | static int hpsa_update_device_info(struct ctlr_info *h, |
1551 | unsigned char scsi3addr[], struct hpsa_scsi_dev_t *this_device) | 1551 | unsigned char scsi3addr[], struct hpsa_scsi_dev_t *this_device, |
1552 | unsigned char *is_OBDR_device) | ||
1552 | { | 1553 | { |
1553 | #define OBDR_TAPE_INQ_SIZE 49 | 1554 | |
1555 | #define OBDR_SIG_OFFSET 43 | ||
1556 | #define OBDR_TAPE_SIG "$DR-10" | ||
1557 | #define OBDR_SIG_LEN (sizeof(OBDR_TAPE_SIG) - 1) | ||
1558 | #define OBDR_TAPE_INQ_SIZE (OBDR_SIG_OFFSET + OBDR_SIG_LEN) | ||
1559 | |||
1554 | unsigned char *inq_buff; | 1560 | unsigned char *inq_buff; |
1561 | unsigned char *obdr_sig; | ||
1555 | 1562 | ||
1556 | inq_buff = kzalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL); | 1563 | inq_buff = kzalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL); |
1557 | if (!inq_buff) | 1564 | if (!inq_buff) |
@@ -1583,6 +1590,16 @@ static int hpsa_update_device_info(struct ctlr_info *h, | |||
1583 | else | 1590 | else |
1584 | this_device->raid_level = RAID_UNKNOWN; | 1591 | this_device->raid_level = RAID_UNKNOWN; |
1585 | 1592 | ||
1593 | if (is_OBDR_device) { | ||
1594 | /* See if this is a One-Button-Disaster-Recovery device | ||
1595 | * by looking for "$DR-10" at offset 43 in inquiry data. | ||
1596 | */ | ||
1597 | obdr_sig = &inq_buff[OBDR_SIG_OFFSET]; | ||
1598 | *is_OBDR_device = (this_device->devtype == TYPE_ROM && | ||
1599 | strncmp(obdr_sig, OBDR_TAPE_SIG, | ||
1600 | OBDR_SIG_LEN) == 0); | ||
1601 | } | ||
1602 | |||
1586 | kfree(inq_buff); | 1603 | kfree(inq_buff); |
1587 | return 0; | 1604 | return 0; |
1588 | 1605 | ||
@@ -1716,7 +1733,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, | |||
1716 | return 0; | 1733 | return 0; |
1717 | } | 1734 | } |
1718 | 1735 | ||
1719 | if (hpsa_update_device_info(h, scsi3addr, this_device)) | 1736 | if (hpsa_update_device_info(h, scsi3addr, this_device, NULL)) |
1720 | return 0; | 1737 | return 0; |
1721 | (*nmsa2xxx_enclosures)++; | 1738 | (*nmsa2xxx_enclosures)++; |
1722 | hpsa_set_bus_target_lun(this_device, bus, target, 0); | 1739 | hpsa_set_bus_target_lun(this_device, bus, target, 0); |
@@ -1808,7 +1825,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
1808 | */ | 1825 | */ |
1809 | struct ReportLUNdata *physdev_list = NULL; | 1826 | struct ReportLUNdata *physdev_list = NULL; |
1810 | struct ReportLUNdata *logdev_list = NULL; | 1827 | struct ReportLUNdata *logdev_list = NULL; |
1811 | unsigned char *inq_buff = NULL; | ||
1812 | u32 nphysicals = 0; | 1828 | u32 nphysicals = 0; |
1813 | u32 nlogicals = 0; | 1829 | u32 nlogicals = 0; |
1814 | u32 ndev_allocated = 0; | 1830 | u32 ndev_allocated = 0; |
@@ -1824,11 +1840,9 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
1824 | GFP_KERNEL); | 1840 | GFP_KERNEL); |
1825 | physdev_list = kzalloc(reportlunsize, GFP_KERNEL); | 1841 | physdev_list = kzalloc(reportlunsize, GFP_KERNEL); |
1826 | logdev_list = kzalloc(reportlunsize, GFP_KERNEL); | 1842 | logdev_list = kzalloc(reportlunsize, GFP_KERNEL); |
1827 | inq_buff = kmalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL); | ||
1828 | tmpdevice = kzalloc(sizeof(*tmpdevice), GFP_KERNEL); | 1843 | tmpdevice = kzalloc(sizeof(*tmpdevice), GFP_KERNEL); |
1829 | 1844 | ||
1830 | if (!currentsd || !physdev_list || !logdev_list || | 1845 | if (!currentsd || !physdev_list || !logdev_list || !tmpdevice) { |
1831 | !inq_buff || !tmpdevice) { | ||
1832 | dev_err(&h->pdev->dev, "out of memory\n"); | 1846 | dev_err(&h->pdev->dev, "out of memory\n"); |
1833 | goto out; | 1847 | goto out; |
1834 | } | 1848 | } |
@@ -1863,7 +1877,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
1863 | /* adjust our table of devices */ | 1877 | /* adjust our table of devices */ |
1864 | nmsa2xxx_enclosures = 0; | 1878 | nmsa2xxx_enclosures = 0; |
1865 | for (i = 0; i < nphysicals + nlogicals + 1; i++) { | 1879 | for (i = 0; i < nphysicals + nlogicals + 1; i++) { |
1866 | u8 *lunaddrbytes; | 1880 | u8 *lunaddrbytes, is_OBDR = 0; |
1867 | 1881 | ||
1868 | /* Figure out where the LUN ID info is coming from */ | 1882 | /* Figure out where the LUN ID info is coming from */ |
1869 | lunaddrbytes = figure_lunaddrbytes(h, raid_ctlr_position, | 1883 | lunaddrbytes = figure_lunaddrbytes(h, raid_ctlr_position, |
@@ -1874,7 +1888,8 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
1874 | continue; | 1888 | continue; |
1875 | 1889 | ||
1876 | /* Get device type, vendor, model, device id */ | 1890 | /* Get device type, vendor, model, device id */ |
1877 | if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice)) | 1891 | if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice, |
1892 | &is_OBDR)) | ||
1878 | continue; /* skip it if we can't talk to it. */ | 1893 | continue; /* skip it if we can't talk to it. */ |
1879 | figure_bus_target_lun(h, lunaddrbytes, &bus, &target, &lun, | 1894 | figure_bus_target_lun(h, lunaddrbytes, &bus, &target, &lun, |
1880 | tmpdevice); | 1895 | tmpdevice); |
@@ -1898,7 +1913,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
1898 | hpsa_set_bus_target_lun(this_device, bus, target, lun); | 1913 | hpsa_set_bus_target_lun(this_device, bus, target, lun); |
1899 | 1914 | ||
1900 | switch (this_device->devtype) { | 1915 | switch (this_device->devtype) { |
1901 | case TYPE_ROM: { | 1916 | case TYPE_ROM: |
1902 | /* We don't *really* support actual CD-ROM devices, | 1917 | /* We don't *really* support actual CD-ROM devices, |
1903 | * just "One Button Disaster Recovery" tape drive | 1918 | * just "One Button Disaster Recovery" tape drive |
1904 | * which temporarily pretends to be a CD-ROM drive. | 1919 | * which temporarily pretends to be a CD-ROM drive. |
@@ -1906,15 +1921,8 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
1906 | * device by checking for "$DR-10" in bytes 43-48 of | 1921 | * device by checking for "$DR-10" in bytes 43-48 of |
1907 | * the inquiry data. | 1922 | * the inquiry data. |
1908 | */ | 1923 | */ |
1909 | char obdr_sig[7]; | 1924 | if (is_OBDR) |
1910 | #define OBDR_TAPE_SIG "$DR-10" | 1925 | ncurrent++; |
1911 | strncpy(obdr_sig, &inq_buff[43], 6); | ||
1912 | obdr_sig[6] = '\0'; | ||
1913 | if (strncmp(obdr_sig, OBDR_TAPE_SIG, 6) != 0) | ||
1914 | /* Not OBDR device, ignore it. */ | ||
1915 | break; | ||
1916 | } | ||
1917 | ncurrent++; | ||
1918 | break; | 1926 | break; |
1919 | case TYPE_DISK: | 1927 | case TYPE_DISK: |
1920 | if (i < nphysicals) | 1928 | if (i < nphysicals) |
@@ -1947,7 +1955,6 @@ out: | |||
1947 | for (i = 0; i < ndev_allocated; i++) | 1955 | for (i = 0; i < ndev_allocated; i++) |
1948 | kfree(currentsd[i]); | 1956 | kfree(currentsd[i]); |
1949 | kfree(currentsd); | 1957 | kfree(currentsd); |
1950 | kfree(inq_buff); | ||
1951 | kfree(physdev_list); | 1958 | kfree(physdev_list); |
1952 | kfree(logdev_list); | 1959 | kfree(logdev_list); |
1953 | } | 1960 | } |