diff options
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_transport.c')
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_transport.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index 742324a0a11e..eb98188c7f3f 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_transport.c +++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * SAS Transport Layer for MPT (Message Passing Technology) based controllers | 2 | * SAS Transport Layer for MPT (Message Passing Technology) based controllers |
3 | * | 3 | * |
4 | * This code is based on drivers/scsi/mpt2sas/mpt2_transport.c | 4 | * This code is based on drivers/scsi/mpt2sas/mpt2_transport.c |
5 | * Copyright (C) 2007-2008 LSI Corporation | 5 | * Copyright (C) 2007-2009 LSI Corporation |
6 | * (mailto:DL-MPTFusionLinux@lsi.com) | 6 | * (mailto:DL-MPTFusionLinux@lsi.com) |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |
@@ -212,25 +212,26 @@ _transport_set_identify(struct MPT2SAS_ADAPTER *ioc, u16 handle, | |||
212 | * mpt2sas_transport_done - internal transport layer callback handler. | 212 | * mpt2sas_transport_done - internal transport layer callback handler. |
213 | * @ioc: per adapter object | 213 | * @ioc: per adapter object |
214 | * @smid: system request message index | 214 | * @smid: system request message index |
215 | * @VF_ID: virtual function id | 215 | * @msix_index: MSIX table index supplied by the OS |
216 | * @reply: reply message frame(lower 32bit addr) | 216 | * @reply: reply message frame(lower 32bit addr) |
217 | * | 217 | * |
218 | * Callback handler when sending internal generated transport cmds. | 218 | * Callback handler when sending internal generated transport cmds. |
219 | * The callback index passed is `ioc->transport_cb_idx` | 219 | * The callback index passed is `ioc->transport_cb_idx` |
220 | * | 220 | * |
221 | * Return nothing. | 221 | * Return 1 meaning mf should be freed from _base_interrupt |
222 | * 0 means the mf is freed from this function. | ||
222 | */ | 223 | */ |
223 | void | 224 | u8 |
224 | mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, | 225 | mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
225 | u32 reply) | 226 | u32 reply) |
226 | { | 227 | { |
227 | MPI2DefaultReply_t *mpi_reply; | 228 | MPI2DefaultReply_t *mpi_reply; |
228 | 229 | ||
229 | mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply); | 230 | mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply); |
230 | if (ioc->transport_cmds.status == MPT2_CMD_NOT_USED) | 231 | if (ioc->transport_cmds.status == MPT2_CMD_NOT_USED) |
231 | return; | 232 | return 1; |
232 | if (ioc->transport_cmds.smid != smid) | 233 | if (ioc->transport_cmds.smid != smid) |
233 | return; | 234 | return 1; |
234 | ioc->transport_cmds.status |= MPT2_CMD_COMPLETE; | 235 | ioc->transport_cmds.status |= MPT2_CMD_COMPLETE; |
235 | if (mpi_reply) { | 236 | if (mpi_reply) { |
236 | memcpy(ioc->transport_cmds.reply, mpi_reply, | 237 | memcpy(ioc->transport_cmds.reply, mpi_reply, |
@@ -239,6 +240,7 @@ mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, | |||
239 | } | 240 | } |
240 | ioc->transport_cmds.status &= ~MPT2_CMD_PENDING; | 241 | ioc->transport_cmds.status &= ~MPT2_CMD_PENDING; |
241 | complete(&ioc->transport_cmds.done); | 242 | complete(&ioc->transport_cmds.done); |
243 | return 1; | ||
242 | } | 244 | } |
243 | 245 | ||
244 | /* report manufacture request structure */ | 246 | /* report manufacture request structure */ |
@@ -369,6 +371,8 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc, | |||
369 | memset(mpi_request, 0, sizeof(Mpi2SmpPassthroughRequest_t)); | 371 | memset(mpi_request, 0, sizeof(Mpi2SmpPassthroughRequest_t)); |
370 | mpi_request->Function = MPI2_FUNCTION_SMP_PASSTHROUGH; | 372 | mpi_request->Function = MPI2_FUNCTION_SMP_PASSTHROUGH; |
371 | mpi_request->PhysicalPort = 0xFF; | 373 | mpi_request->PhysicalPort = 0xFF; |
374 | mpi_request->VF_ID = 0; /* TODO */ | ||
375 | mpi_request->VP_ID = 0; | ||
372 | sas_address_le = (u64 *)&mpi_request->SASAddress; | 376 | sas_address_le = (u64 *)&mpi_request->SASAddress; |
373 | *sas_address_le = cpu_to_le64(sas_address); | 377 | *sas_address_le = cpu_to_le64(sas_address); |
374 | mpi_request->RequestDataLength = sizeof(struct rep_manu_request); | 378 | mpi_request->RequestDataLength = sizeof(struct rep_manu_request); |
@@ -396,7 +400,8 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc, | |||
396 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT "report_manufacture - " | 400 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT "report_manufacture - " |
397 | "send to sas_addr(0x%016llx)\n", ioc->name, | 401 | "send to sas_addr(0x%016llx)\n", ioc->name, |
398 | (unsigned long long)sas_address)); | 402 | (unsigned long long)sas_address)); |
399 | mpt2sas_base_put_smid_default(ioc, smid, 0 /* VF_ID */); | 403 | mpt2sas_base_put_smid_default(ioc, smid); |
404 | init_completion(&ioc->transport_cmds.done); | ||
400 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, | 405 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, |
401 | 10*HZ); | 406 | 10*HZ); |
402 | 407 | ||
@@ -1106,6 +1111,8 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1106 | memset(mpi_request, 0, sizeof(Mpi2SmpPassthroughRequest_t)); | 1111 | memset(mpi_request, 0, sizeof(Mpi2SmpPassthroughRequest_t)); |
1107 | mpi_request->Function = MPI2_FUNCTION_SMP_PASSTHROUGH; | 1112 | mpi_request->Function = MPI2_FUNCTION_SMP_PASSTHROUGH; |
1108 | mpi_request->PhysicalPort = 0xFF; | 1113 | mpi_request->PhysicalPort = 0xFF; |
1114 | mpi_request->VF_ID = 0; /* TODO */ | ||
1115 | mpi_request->VP_ID = 0; | ||
1109 | *((u64 *)&mpi_request->SASAddress) = (rphy) ? | 1116 | *((u64 *)&mpi_request->SASAddress) = (rphy) ? |
1110 | cpu_to_le64(rphy->identify.sas_address) : | 1117 | cpu_to_le64(rphy->identify.sas_address) : |
1111 | cpu_to_le64(ioc->sas_hba.sas_address); | 1118 | cpu_to_le64(ioc->sas_hba.sas_address); |
@@ -1147,7 +1154,8 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1147 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s - " | 1154 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s - " |
1148 | "sending smp request\n", ioc->name, __func__)); | 1155 | "sending smp request\n", ioc->name, __func__)); |
1149 | 1156 | ||
1150 | mpt2sas_base_put_smid_default(ioc, smid, 0 /* VF_ID */); | 1157 | mpt2sas_base_put_smid_default(ioc, smid); |
1158 | init_completion(&ioc->transport_cmds.done); | ||
1151 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, | 1159 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, |
1152 | 10*HZ); | 1160 | 10*HZ); |
1153 | 1161 | ||