aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/megaraid
diff options
context:
space:
mode:
authorYang, Bo <Bo.Yang@lsi.com>2009-10-06 16:33:06 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-10-29 13:03:19 -0400
commit044833b572b96afe91506a0edec42efd84ba4939 (patch)
tree51b603f30279efd721690bbf9e7b0763eaf34a1a /drivers/scsi/megaraid
parent81e403ce3c6a34cd705bf54d4cdeefdeb7068a8d (diff)
[SCSI] megaraid_sas: report system PDs to OS
When OS issue inquiry, it will check driver's internal pd_list. Signed-off-by Bo Yang<bo.yang@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/megaraid')
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c91
1 files changed, 65 insertions, 26 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 48c3658d73a7..9967ee72a967 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -1115,24 +1115,76 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *))
1115 return 0; 1115 return 0;
1116} 1116}
1117 1117
1118static struct megasas_instance *megasas_lookup_instance(u16 host_no)
1119{
1120 int i;
1121
1122 for (i = 0; i < megasas_mgmt_info.max_index; i++) {
1123
1124 if ((megasas_mgmt_info.instance[i]) &&
1125 (megasas_mgmt_info.instance[i]->host->host_no == host_no))
1126 return megasas_mgmt_info.instance[i];
1127 }
1128
1129 return NULL;
1130}
1131
1118static int megasas_slave_configure(struct scsi_device *sdev) 1132static int megasas_slave_configure(struct scsi_device *sdev)
1119{ 1133{
1134 u16 pd_index = 0;
1135 struct megasas_instance *instance ;
1136
1137 instance = megasas_lookup_instance(sdev->host->host_no);
1138
1120 /* 1139 /*
1121 * Don't export physical disk devices to the disk driver. 1140 * Don't export physical disk devices to the disk driver.
1122 * 1141 *
1123 * FIXME: Currently we don't export them to the midlayer at all. 1142 * FIXME: Currently we don't export them to the midlayer at all.
1124 * That will be fixed once LSI engineers have audited the 1143 * That will be fixed once LSI engineers have audited the
1125 * firmware for possible issues. 1144 * firmware for possible issues.
1126 */ 1145 */
1127 if (sdev->channel < MEGASAS_MAX_PD_CHANNELS && sdev->type == TYPE_DISK) 1146 if (sdev->channel < MEGASAS_MAX_PD_CHANNELS &&
1147 sdev->type == TYPE_DISK) {
1148 pd_index = (sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL) +
1149 sdev->id;
1150 if (instance->pd_list[pd_index].driveState ==
1151 MR_PD_STATE_SYSTEM) {
1152 blk_queue_rq_timeout(sdev->request_queue,
1153 MEGASAS_DEFAULT_CMD_TIMEOUT * HZ);
1154 return 0;
1155 }
1128 return -ENXIO; 1156 return -ENXIO;
1157 }
1129 1158
1130 /* 1159 /*
1131 * The RAID firmware may require extended timeouts. 1160 * The RAID firmware may require extended timeouts.
1132 */ 1161 */
1133 if (sdev->channel >= MEGASAS_MAX_PD_CHANNELS) 1162 blk_queue_rq_timeout(sdev->request_queue,
1134 blk_queue_rq_timeout(sdev->request_queue, 1163 MEGASAS_DEFAULT_CMD_TIMEOUT * HZ);
1135 MEGASAS_DEFAULT_CMD_TIMEOUT * HZ); 1164 return 0;
1165}
1166
1167static int megasas_slave_alloc(struct scsi_device *sdev)
1168{
1169 u16 pd_index = 0;
1170 struct megasas_instance *instance ;
1171 instance = megasas_lookup_instance(sdev->host->host_no);
1172 if ((sdev->channel < MEGASAS_MAX_PD_CHANNELS) &&
1173 (sdev->type == TYPE_DISK)) {
1174 /*
1175 * Open the OS scan to the SYSTEM PD
1176 */
1177 pd_index =
1178 (sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL) +
1179 sdev->id;
1180 if ((instance->pd_list[pd_index].driveState ==
1181 MR_PD_STATE_SYSTEM) &&
1182 (instance->pd_list[pd_index].driveType ==
1183 TYPE_DISK)) {
1184 return 0;
1185 }
1186 return -ENXIO;
1187 }
1136 return 0; 1188 return 0;
1137} 1189}
1138 1190
@@ -1423,6 +1475,7 @@ static struct scsi_host_template megasas_template = {
1423 .name = "LSI SAS based MegaRAID driver", 1475 .name = "LSI SAS based MegaRAID driver",
1424 .proc_name = "megaraid_sas", 1476 .proc_name = "megaraid_sas",
1425 .slave_configure = megasas_slave_configure, 1477 .slave_configure = megasas_slave_configure,
1478 .slave_alloc = megasas_slave_alloc,
1426 .queuecommand = megasas_queue_command, 1479 .queuecommand = megasas_queue_command,
1427 .eh_device_reset_handler = megasas_reset_device, 1480 .eh_device_reset_handler = megasas_reset_device,
1428 .eh_bus_reset_handler = megasas_reset_bus_host, 1481 .eh_bus_reset_handler = megasas_reset_bus_host,
@@ -3455,20 +3508,6 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
3455 return error; 3508 return error;
3456} 3509}
3457 3510
3458static struct megasas_instance *megasas_lookup_instance(u16 host_no)
3459{
3460 int i;
3461
3462 for (i = 0; i < megasas_mgmt_info.max_index; i++) {
3463
3464 if ((megasas_mgmt_info.instance[i]) &&
3465 (megasas_mgmt_info.instance[i]->host->host_no == host_no))
3466 return megasas_mgmt_info.instance[i];
3467 }
3468
3469 return NULL;
3470}
3471
3472static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg) 3511static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg)
3473{ 3512{
3474 struct megasas_iocpacket __user *user_ioc = 3513 struct megasas_iocpacket __user *user_ioc =