1320 | 1320 |
/* Given a IDENTIFY LOGICAL DRIVE data, find the matching /dev/sd* */
|
1321 | 1321 |
/* note. "Matching" means, the one with the same serial number. */
|
1322 | 1322 |
static char *unknown_scsi_device = "/dev/???";
|
1323 | |
static void find_scsi_device_node(char *unique_volume_id, char **scsi_device_node)
|
|
1323 |
static void find_scsi_device_node(unsigned char *unique_volume_id, char **scsi_device_node)
|
1324 | 1324 |
{
|
1325 | 1325 |
struct dirent **namelist = NULL;
|
1326 | 1326 |
int nents, rc, i, fd;
|
|
1399 | 1399 |
int tolerance_type = -1;
|
1400 | 1400 |
char *scsi_device_node;
|
1401 | 1401 |
|
|
1402 |
memset(&drive_id, 0, sizeof(drive_id));
|
1402 | 1403 |
rc = msa1000_passthru_ioctl(fd, ID_LOGICAL_DRIVE, &drive_id,
|
1403 | 1404 |
sizeof(drive_id), logical_drive);
|
1404 | 1405 |
if (rc == 0)
|
1405 | 1406 |
tolerance_type = drive_id.tolerance_type;
|
1406 | 1407 |
|
|
1408 |
memset(&ldstatus, 0, sizeof(ldstatus));
|
1407 | 1409 |
rc = msa1000_passthru_ioctl(fd, ID_LSTATUS, &ldstatus,
|
1408 | 1410 |
sizeof(ldstatus), logical_drive);
|
1409 | 1411 |
if (rc < 0) {
|
|
1452 | 1454 |
int status;
|
1453 | 1455 |
|
1454 | 1456 |
memset(&cmd, 0, sizeof(cmd));
|
|
1457 |
memset(cdb, 0, sizeof(cdb));
|
1455 | 1458 |
cdb[0] = 0x12; /* inquiry */
|
1456 | 1459 |
cdb[1] = inquiry_page ? 1 : 0;
|
1457 | 1460 |
cdb[2] = inquiry_page;
|
|
1554 | 1557 |
int ctlrtype;
|
1555 | 1558 |
|
1556 | 1559 |
memset(&cciss_to_bmic, 0, sizeof(cciss_to_bmic));
|
1557 | |
memset(&controller_lun_list, 0, sizeof(controller_lun_list));
|
1558 | |
num_controllers = 0;
|
|
1560 |
memset(lunlist, 0, sizeof(lunlist));
|
|
1561 |
memset(physlunlist, 0, sizeof(physlunlist));
|
|
1562 |
memset(missed_drive, 0, sizeof(missed_drive));
|
1559 | 1563 |
|
1560 | 1564 |
/* Do report LOGICAL LUNs to get a list of all logical drives */
|
1561 | 1565 |
rc = do_report_luns(file, fd, &luncount, (unsigned char *) lunlist, 0);
|
|
1843 | 1847 |
unsigned char lunaddr[], unsigned char bus,
|
1844 | 1848 |
sense_bus_param *bus_param)
|
1845 | 1849 |
{
|
1846 | |
memset(c, 0, sizeof(c));
|
|
1850 |
memset(c, 0, sizeof(*c));
|
1847 | 1851 |
memcpy(&c->LUN_info, lunaddr, 8);
|
1848 | 1852 |
c->Request.CDBLen = 10;
|
1849 | 1853 |
c->Request.Type.Type = TYPE_CMD;
|
|
1860 | 1864 |
c->buf = (unsigned char *) bus_param;
|
1861 | 1865 |
}
|
1862 | 1866 |
|
|
1867 |
static void print_error_info(IOCTL_Command_struct *c)
|
|
1868 |
{
|
|
1869 |
int i;
|
|
1870 |
printf("Error info:\n");
|
|
1871 |
printf("CDB = ");
|
|
1872 |
for (i = 0; i < 16; i++)
|
|
1873 |
printf("%02x ", c->Request.CDB[i]);
|
|
1874 |
printf("\n");
|
|
1875 |
printf("CommandStatus = %d\n", c->error_info.CommandStatus);
|
|
1876 |
printf("ScsiStatus = %d\n", c->error_info.ScsiStatus);
|
|
1877 |
printf("SenseLen = %d\n", c->error_info.SenseLen);
|
|
1878 |
printf("ResidualCnt = %d\n", c->error_info.ResidualCnt);
|
|
1879 |
printf("SenseInfo = ");
|
|
1880 |
if (c->error_info.SenseLen > SENSEINFOBYTES)
|
|
1881 |
c->error_info.SenseLen = SENSEINFOBYTES;
|
|
1882 |
for (i = 0; i < c->error_info.SenseLen; i++)
|
|
1883 |
printf("%02x ", c->error_info.SenseInfo[i]);
|
|
1884 |
printf("\n\n");
|
|
1885 |
}
|
|
1886 |
|
1863 | 1887 |
int do_sense_bus_parameters(char *file, int fd, unsigned char lunaddr[],
|
1864 | 1888 |
int ctlr, unsigned char bus, sense_bus_param *bus_param)
|
1865 | 1889 |
{
|
|
1883 | 1907 |
/* This happens when we query busses that don't exist. */
|
1884 | 1908 |
if (c.error_info.CommandStatus == 4) /* 4 means "invalid command" */
|
1885 | 1909 |
return -1;
|
|
1910 |
|
|
1911 |
if (c.error_info.CommandStatus == 1)
|
|
1912 |
print_error_info(&c);
|
1886 | 1913 |
|
1887 | 1914 |
if (c.error_info.CommandStatus != 0) {
|
1888 | 1915 |
fprintf(stderr, "Error getting status for %s "
|
|
1979 | 2006 |
|
1980 | 2007 |
/* Construct command to get logical drive status */
|
1981 | 2008 |
memset(&c, 0, sizeof(c));
|
|
2009 |
memset(&ldstatus, 0, sizeof(ldstatus));
|
1982 | 2010 |
memcpy(&c.LUN_info, cciss_to_bmic.addr[volume_number].controller_lun, 8);
|
1983 | 2011 |
c.Request.CDBLen = 10;
|
1984 | 2012 |
c.Request.Type.Type = TYPE_CMD;
|
|
2049 | 2077 |
return bmic_next_disk_bits((uint8_t *) id->big_drive_present_map, 128, bmic_drive_number);
|
2050 | 2078 |
else
|
2051 | 2079 |
return bmic_next_disk_bits((uint8_t *) &id->drive_present_bit_map, 32, bmic_drive_number);
|
2052 | |
uint16_t big_drive_present_bit_map[8];
|
2053 | |
uint16_t big_ext_drive_map[8];
|
2054 | |
uint16_t big_non_disk_map[8];
|
2055 | 2080 |
}
|
2056 | 2081 |
|
2057 | 2082 |
static inline int bmic_next_ext_phy_disk(struct identify_controller *id, int bmic_drive_number)
|
|
2071 | 2096 |
}
|
2072 | 2097 |
|
2073 | 2098 |
static void check_physical_drive(char *file, int fd,
|
2074 | |
char *controller_lun, struct identify_controller *id,
|
|
2099 |
unsigned char *controller_lun, struct identify_controller *id,
|
2075 | 2100 |
int bmic_drive_number)
|
2076 | 2101 |
{
|
2077 | 2102 |
int rc = 0, bus, target;
|
|
2141 | 2166 |
static void check_physical_drives(char *file, int fd)
|
2142 | 2167 |
{
|
2143 | 2168 |
int i;
|
2144 | |
unsigned char *controller_lun;
|
2145 | 2169 |
|
2146 | 2170 |
if (!check_smart_data)
|
2147 | 2171 |
return;
|