diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_mbox.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_mbox.c | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index ca358355ec9b..65bc8e1a5f7d 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2008 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -272,6 +272,84 @@ lpfc_config_link(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
272 | } | 272 | } |
273 | 273 | ||
274 | /** | 274 | /** |
275 | * lpfc_config_msi: Prepare a mailbox command for configuring msi-x. | ||
276 | * @phba: pointer to lpfc hba data structure. | ||
277 | * @pmb: pointer to the driver internal queue element for mailbox command. | ||
278 | * | ||
279 | * The configure MSI-X mailbox command is used to configure the HBA's SLI-3 | ||
280 | * MSI-X multi-message interrupt vector association to interrupt attention | ||
281 | * conditions. | ||
282 | * | ||
283 | * Return codes | ||
284 | * 0 - Success | ||
285 | * -EINVAL - Failure | ||
286 | **/ | ||
287 | int | ||
288 | lpfc_config_msi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | ||
289 | { | ||
290 | MAILBOX_t *mb = &pmb->mb; | ||
291 | uint32_t attentionConditions[2]; | ||
292 | |||
293 | /* Sanity check */ | ||
294 | if (phba->cfg_use_msi != 2) { | ||
295 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
296 | "0475 Not configured for supporting MSI-X " | ||
297 | "cfg_use_msi: 0x%x\n", phba->cfg_use_msi); | ||
298 | return -EINVAL; | ||
299 | } | ||
300 | |||
301 | if (phba->sli_rev < 3) { | ||
302 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
303 | "0476 HBA not supporting SLI-3 or later " | ||
304 | "SLI Revision: 0x%x\n", phba->sli_rev); | ||
305 | return -EINVAL; | ||
306 | } | ||
307 | |||
308 | /* Clear mailbox command fields */ | ||
309 | memset(pmb, 0, sizeof(LPFC_MBOXQ_t)); | ||
310 | |||
311 | /* | ||
312 | * SLI-3, Message Signaled Interrupt Fearure. | ||
313 | */ | ||
314 | |||
315 | /* Multi-message attention configuration */ | ||
316 | attentionConditions[0] = (HA_R0ATT | HA_R1ATT | HA_R2ATT | HA_ERATT | | ||
317 | HA_LATT | HA_MBATT); | ||
318 | attentionConditions[1] = 0; | ||
319 | |||
320 | mb->un.varCfgMSI.attentionConditions[0] = attentionConditions[0]; | ||
321 | mb->un.varCfgMSI.attentionConditions[1] = attentionConditions[1]; | ||
322 | |||
323 | /* | ||
324 | * Set up message number to HA bit association | ||
325 | */ | ||
326 | #ifdef __BIG_ENDIAN_BITFIELD | ||
327 | /* RA0 (FCP Ring) */ | ||
328 | mb->un.varCfgMSI.messageNumberByHA[HA_R0_POS] = 1; | ||
329 | /* RA1 (Other Protocol Extra Ring) */ | ||
330 | mb->un.varCfgMSI.messageNumberByHA[HA_R1_POS] = 1; | ||
331 | #else /* __LITTLE_ENDIAN_BITFIELD */ | ||
332 | /* RA0 (FCP Ring) */ | ||
333 | mb->un.varCfgMSI.messageNumberByHA[HA_R0_POS^3] = 1; | ||
334 | /* RA1 (Other Protocol Extra Ring) */ | ||
335 | mb->un.varCfgMSI.messageNumberByHA[HA_R1_POS^3] = 1; | ||
336 | #endif | ||
337 | /* Multi-message interrupt autoclear configuration*/ | ||
338 | mb->un.varCfgMSI.autoClearHA[0] = attentionConditions[0]; | ||
339 | mb->un.varCfgMSI.autoClearHA[1] = attentionConditions[1]; | ||
340 | |||
341 | /* For now, HBA autoclear does not work reliably, disable it */ | ||
342 | mb->un.varCfgMSI.autoClearHA[0] = 0; | ||
343 | mb->un.varCfgMSI.autoClearHA[1] = 0; | ||
344 | |||
345 | /* Set command and owner bit */ | ||
346 | mb->mbxCommand = MBX_CONFIG_MSI; | ||
347 | mb->mbxOwner = OWN_HOST; | ||
348 | |||
349 | return 0; | ||
350 | } | ||
351 | |||
352 | /** | ||
275 | * lpfc_init_link: Prepare a mailbox command for initialize link on a HBA. | 353 | * lpfc_init_link: Prepare a mailbox command for initialize link on a HBA. |
276 | * @phba: pointer to lpfc hba data structure. | 354 | * @phba: pointer to lpfc hba data structure. |
277 | * @pmb: pointer to the driver internal queue element for mailbox command. | 355 | * @pmb: pointer to the driver internal queue element for mailbox command. |