lpfc_sli.c (e59058c44025d71c9b7f260076a932935d3bba95) | lpfc_sli.c (34b02dcdcf1865405f4762b991965c0c3b8a3ae0) |
---|---|
1/******************************************************************* 2 * This file is part of the Emulex Linux Device Driver for * 3 * Fibre Channel Host Bus Adapters. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. * 5 * EMULEX and SLI are trademarks of Emulex. * 6 * www.emulex.com * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 8 * * --- 392 unchanged lines hidden (view full) --- 401 * is available slot in the ring, else it returns NULL. 402 * If the get index of the ring is ahead of the put index, the function 403 * will post an error attention event to the worker thread to take the 404 * HBA to offline state. 405 **/ 406static IOCB_t * 407lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) 408{ | 1/******************************************************************* 2 * This file is part of the Emulex Linux Device Driver for * 3 * Fibre Channel Host Bus Adapters. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. * 5 * EMULEX and SLI are trademarks of Emulex. * 6 * www.emulex.com * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 8 * * --- 392 unchanged lines hidden (view full) --- 401 * is available slot in the ring, else it returns NULL. 402 * If the get index of the ring is ahead of the put index, the function 403 * will post an error attention event to the worker thread to take the 404 * HBA to offline state. 405 **/ 406static IOCB_t * 407lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) 408{ |
409 struct lpfc_pgp *pgp = (phba->sli_rev == 3) ? 410 &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] : 411 &phba->slim2p->mbx.us.s2.port[pring->ringno]; | 409 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; |
412 uint32_t max_cmd_idx = pring->numCiocb; | 410 uint32_t max_cmd_idx = pring->numCiocb; |
413 | |
414 if ((pring->next_cmdidx == pring->cmdidx) && 415 (++pring->next_cmdidx >= max_cmd_idx)) 416 pring->next_cmdidx = 0; 417 418 if (unlikely(pring->local_getidx == pring->next_cmdidx)) { 419 420 pring->local_getidx = le32_to_cpu(pgp->cmdGetInx); 421 --- 198 unchanged lines hidden (view full) --- 620static void 621lpfc_sli_update_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) 622{ 623 int ringno = pring->ringno; 624 625 /* 626 * Tell the HBA that there is work to do in this ring. 627 */ | 411 if ((pring->next_cmdidx == pring->cmdidx) && 412 (++pring->next_cmdidx >= max_cmd_idx)) 413 pring->next_cmdidx = 0; 414 415 if (unlikely(pring->local_getidx == pring->next_cmdidx)) { 416 417 pring->local_getidx = le32_to_cpu(pgp->cmdGetInx); 418 --- 198 unchanged lines hidden (view full) --- 617static void 618lpfc_sli_update_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) 619{ 620 int ringno = pring->ringno; 621 622 /* 623 * Tell the HBA that there is work to do in this ring. 624 */ |
628 wmb(); 629 writel(CA_R0ATT << (ringno * 4), phba->CAregaddr); 630 readl(phba->CAregaddr); /* flush */ | 625 if (!(phba->sli3_options & LPFC_SLI3_CRP_ENABLED)) { 626 wmb(); 627 writel(CA_R0ATT << (ringno * 4), phba->CAregaddr); 628 readl(phba->CAregaddr); /* flush */ 629 } |
631} 632 633/** 634 * lpfc_sli_resume_iocb: Process iocbs in the txq. 635 * @phba: Pointer to HBA context object. 636 * @pring: Pointer to driver SLI ring object. 637 * 638 * This function is called with hbalock held to post pending iocbs --- 1010 unchanged lines hidden (view full) --- 1649 * This function is called from the iocb ring event handlers when 1650 * put pointer is ahead of the get pointer for a ring. This function signal 1651 * an error attention condition to the worker thread and the worker 1652 * thread will transition the HBA to offline state. 1653 **/ 1654static void 1655lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) 1656{ | 630} 631 632/** 633 * lpfc_sli_resume_iocb: Process iocbs in the txq. 634 * @phba: Pointer to HBA context object. 635 * @pring: Pointer to driver SLI ring object. 636 * 637 * This function is called with hbalock held to post pending iocbs --- 1010 unchanged lines hidden (view full) --- 1648 * This function is called from the iocb ring event handlers when 1649 * put pointer is ahead of the get pointer for a ring. This function signal 1650 * an error attention condition to the worker thread and the worker 1651 * thread will transition the HBA to offline state. 1652 **/ 1653static void 1654lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) 1655{ |
1657 struct lpfc_pgp *pgp = (phba->sli_rev == 3) ? 1658 &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] : 1659 &phba->slim2p->mbx.us.s2.port[pring->ringno]; | 1656 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; |
1660 /* 1661 * Ring <ringno> handler: portRspPut <portRspPut> is bigger then 1662 * rsp ring <portRspMax> 1663 */ 1664 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 1665 "0312 Ring %d handler: portRspPut %d " 1666 "is bigger then rsp ring %d\n", 1667 pring->ringno, le32_to_cpu(pgp->rspPutInx), --- 31 unchanged lines hidden (view full) --- 1699void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) 1700{ 1701 struct lpfc_sli *psli = &phba->sli; 1702 struct lpfc_sli_ring *pring = &psli->ring[LPFC_FCP_RING]; 1703 IOCB_t *irsp = NULL; 1704 IOCB_t *entry = NULL; 1705 struct lpfc_iocbq *cmdiocbq = NULL; 1706 struct lpfc_iocbq rspiocbq; | 1657 /* 1658 * Ring <ringno> handler: portRspPut <portRspPut> is bigger then 1659 * rsp ring <portRspMax> 1660 */ 1661 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 1662 "0312 Ring %d handler: portRspPut %d " 1663 "is bigger then rsp ring %d\n", 1664 pring->ringno, le32_to_cpu(pgp->rspPutInx), --- 31 unchanged lines hidden (view full) --- 1696void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) 1697{ 1698 struct lpfc_sli *psli = &phba->sli; 1699 struct lpfc_sli_ring *pring = &psli->ring[LPFC_FCP_RING]; 1700 IOCB_t *irsp = NULL; 1701 IOCB_t *entry = NULL; 1702 struct lpfc_iocbq *cmdiocbq = NULL; 1703 struct lpfc_iocbq rspiocbq; |
1707 struct lpfc_pgp *pgp; | 1704 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; |
1708 uint32_t status; 1709 uint32_t portRspPut, portRspMax; 1710 int type; 1711 uint32_t rsp_cmpl = 0; 1712 uint32_t ha_copy; 1713 unsigned long iflags; 1714 1715 pring->stats.iocb_event++; 1716 | 1705 uint32_t status; 1706 uint32_t portRspPut, portRspMax; 1707 int type; 1708 uint32_t rsp_cmpl = 0; 1709 uint32_t ha_copy; 1710 unsigned long iflags; 1711 1712 pring->stats.iocb_event++; 1713 |
1717 pgp = (phba->sli_rev == 3) ? 1718 &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] : 1719 &phba->slim2p->mbx.us.s2.port[pring->ringno]; 1720 1721 | |
1722 /* 1723 * The next available response entry should never exceed the maximum 1724 * entries. If it does, treat it as an adapter hardware error. 1725 */ 1726 portRspMax = pring->numRiocb; 1727 portRspPut = le32_to_cpu(pgp->rspPutInx); 1728 if (unlikely(portRspPut >= portRspMax)) { 1729 lpfc_sli_rsp_pointers_error(phba, pring); --- 135 unchanged lines hidden (view full) --- 1865 * function if this is an unsolicited iocb. 1866 * This routine presumes LPFC_FCP_RING handling and doesn't bother 1867 * to check it explicitly. This function always returns 1. 1868 **/ 1869static int 1870lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, 1871 struct lpfc_sli_ring *pring, uint32_t mask) 1872{ | 1714 /* 1715 * The next available response entry should never exceed the maximum 1716 * entries. If it does, treat it as an adapter hardware error. 1717 */ 1718 portRspMax = pring->numRiocb; 1719 portRspPut = le32_to_cpu(pgp->rspPutInx); 1720 if (unlikely(portRspPut >= portRspMax)) { 1721 lpfc_sli_rsp_pointers_error(phba, pring); --- 135 unchanged lines hidden (view full) --- 1857 * function if this is an unsolicited iocb. 1858 * This routine presumes LPFC_FCP_RING handling and doesn't bother 1859 * to check it explicitly. This function always returns 1. 1860 **/ 1861static int 1862lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, 1863 struct lpfc_sli_ring *pring, uint32_t mask) 1864{ |
1873 struct lpfc_pgp *pgp = (phba->sli_rev == 3) ? 1874 &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] : 1875 &phba->slim2p->mbx.us.s2.port[pring->ringno]; | 1865 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; |
1876 IOCB_t *irsp = NULL; 1877 IOCB_t *entry = NULL; 1878 struct lpfc_iocbq *cmdiocbq = NULL; 1879 struct lpfc_iocbq rspiocbq; 1880 uint32_t status; 1881 uint32_t portRspPut, portRspMax; 1882 int rc = 1; 1883 lpfc_iocb_type type; --- 175 unchanged lines hidden (view full) --- 2059 * iocb. The function frees the resources or calls the completion handler if 2060 * this iocb is an abort completion. The function returns 0 when the allocated 2061 * iocbs are not freed, otherwise returns 1. 2062 **/ 2063int 2064lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, 2065 struct lpfc_sli_ring *pring, uint32_t mask) 2066{ | 1866 IOCB_t *irsp = NULL; 1867 IOCB_t *entry = NULL; 1868 struct lpfc_iocbq *cmdiocbq = NULL; 1869 struct lpfc_iocbq rspiocbq; 1870 uint32_t status; 1871 uint32_t portRspPut, portRspMax; 1872 int rc = 1; 1873 lpfc_iocb_type type; --- 175 unchanged lines hidden (view full) --- 2049 * iocb. The function frees the resources or calls the completion handler if 2050 * this iocb is an abort completion. The function returns 0 when the allocated 2051 * iocbs are not freed, otherwise returns 1. 2052 **/ 2053int 2054lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, 2055 struct lpfc_sli_ring *pring, uint32_t mask) 2056{ |
2067 struct lpfc_pgp *pgp = (phba->sli_rev == 3) ? 2068 &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] : 2069 &phba->slim2p->mbx.us.s2.port[pring->ringno]; | 2057 struct lpfc_pgp *pgp; |
2070 IOCB_t *entry; 2071 IOCB_t *irsp = NULL; 2072 struct lpfc_iocbq *rspiocbp = NULL; 2073 struct lpfc_iocbq *next_iocb; 2074 struct lpfc_iocbq *cmdiocbp; 2075 struct lpfc_iocbq *saveq; 2076 uint8_t iocb_cmd_type; 2077 lpfc_iocb_type type; 2078 uint32_t status, free_saveq; 2079 uint32_t portRspPut, portRspMax; 2080 int rc = 1; 2081 unsigned long iflag; 2082 | 2058 IOCB_t *entry; 2059 IOCB_t *irsp = NULL; 2060 struct lpfc_iocbq *rspiocbp = NULL; 2061 struct lpfc_iocbq *next_iocb; 2062 struct lpfc_iocbq *cmdiocbp; 2063 struct lpfc_iocbq *saveq; 2064 uint8_t iocb_cmd_type; 2065 lpfc_iocb_type type; 2066 uint32_t status, free_saveq; 2067 uint32_t portRspPut, portRspMax; 2068 int rc = 1; 2069 unsigned long iflag; 2070 |
2071 pgp = &phba->port_gp[pring->ringno]; |
|
2083 spin_lock_irqsave(&phba->hbalock, iflag); 2084 pring->stats.iocb_event++; 2085 2086 /* 2087 * The next available response entry should never exceed the maximum 2088 * entries. If it does, treat it as an adapter hardware error. 2089 */ 2090 portRspMax = pring->numRiocb; --- 894 unchanged lines hidden (view full) --- 2985 * value of 0 means the call was successful. Any other 2986 * nonzero value is a failure, but if ERESTART is returned, 2987 * the driver may reset the HBA and try again. 2988 */ 2989 rc = lpfc_config_port_prep(phba); 2990 if (rc == -ERESTART) { 2991 phba->link_state = LPFC_LINK_UNKNOWN; 2992 continue; | 2072 spin_lock_irqsave(&phba->hbalock, iflag); 2073 pring->stats.iocb_event++; 2074 2075 /* 2076 * The next available response entry should never exceed the maximum 2077 * entries. If it does, treat it as an adapter hardware error. 2078 */ 2079 portRspMax = pring->numRiocb; --- 894 unchanged lines hidden (view full) --- 2974 * value of 0 means the call was successful. Any other 2975 * nonzero value is a failure, but if ERESTART is returned, 2976 * the driver may reset the HBA and try again. 2977 */ 2978 rc = lpfc_config_port_prep(phba); 2979 if (rc == -ERESTART) { 2980 phba->link_state = LPFC_LINK_UNKNOWN; 2981 continue; |
2993 } else if (rc) { | 2982 } else if (rc) |
2994 break; | 2983 break; |
2995 } 2996 | |
2997 phba->link_state = LPFC_INIT_MBX_CMDS; 2998 lpfc_config_port(phba, pmb); 2999 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); | 2984 phba->link_state = LPFC_INIT_MBX_CMDS; 2985 lpfc_config_port(phba, pmb); 2986 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); |
2987 phba->sli3_options &= ~(LPFC_SLI3_NPIV_ENABLED | 2988 LPFC_SLI3_HBQ_ENABLED | 2989 LPFC_SLI3_CRP_ENABLED | 2990 LPFC_SLI3_INB_ENABLED); |
|
3000 if (rc != MBX_SUCCESS) { 3001 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 3002 "0442 Adapter failed to init, mbxCmd x%x " 3003 "CONFIG_PORT, mbxStatus x%x Data: x%x\n", 3004 pmb->mb.mbxCommand, pmb->mb.mbxStatus, 0); 3005 spin_lock_irq(&phba->hbalock); 3006 phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE; 3007 spin_unlock_irq(&phba->hbalock); 3008 rc = -ENXIO; | 2991 if (rc != MBX_SUCCESS) { 2992 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 2993 "0442 Adapter failed to init, mbxCmd x%x " 2994 "CONFIG_PORT, mbxStatus x%x Data: x%x\n", 2995 pmb->mb.mbxCommand, pmb->mb.mbxStatus, 0); 2996 spin_lock_irq(&phba->hbalock); 2997 phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE; 2998 spin_unlock_irq(&phba->hbalock); 2999 rc = -ENXIO; |
3009 } else { | 3000 } else |
3010 done = 1; | 3001 done = 1; |
3011 phba->max_vpi = (phba->max_vpi && 3012 pmb->mb.un.varCfgPort.gmv) != 0 3013 ? pmb->mb.un.varCfgPort.max_vpi 3014 : 0; 3015 } | |
3016 } | 3002 } |
3017 | |
3018 if (!done) { 3019 rc = -EINVAL; 3020 goto do_prep_failed; 3021 } | 3003 if (!done) { 3004 rc = -EINVAL; 3005 goto do_prep_failed; 3006 } |
3022 3023 if ((pmb->mb.un.varCfgPort.sli_mode == 3) && 3024 (!pmb->mb.un.varCfgPort.cMA)) { 3025 rc = -ENXIO; | 3007 if (pmb->mb.un.varCfgPort.sli_mode == 3) { 3008 if (!pmb->mb.un.varCfgPort.cMA) { 3009 rc = -ENXIO; 3010 goto do_prep_failed; 3011 } 3012 if (phba->max_vpi && pmb->mb.un.varCfgPort.gmv) { 3013 phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED; 3014 phba->max_vpi = pmb->mb.un.varCfgPort.max_vpi; 3015 } else 3016 phba->max_vpi = 0; 3017 if (pmb->mb.un.varCfgPort.gerbm) 3018 phba->sli3_options |= LPFC_SLI3_HBQ_ENABLED; 3019 if (pmb->mb.un.varCfgPort.gcrp) 3020 phba->sli3_options |= LPFC_SLI3_CRP_ENABLED; 3021 if (pmb->mb.un.varCfgPort.ginb) { 3022 phba->sli3_options |= LPFC_SLI3_INB_ENABLED; 3023 phba->port_gp = phba->mbox->us.s3_inb_pgp.port; 3024 phba->inb_ha_copy = &phba->mbox->us.s3_inb_pgp.ha_copy; 3025 phba->inb_counter = &phba->mbox->us.s3_inb_pgp.counter; 3026 phba->inb_last_counter = 3027 phba->mbox->us.s3_inb_pgp.counter; 3028 } else { 3029 phba->port_gp = phba->mbox->us.s3_pgp.port; 3030 phba->inb_ha_copy = NULL; 3031 phba->inb_counter = NULL; 3032 } 3033 } else { 3034 phba->port_gp = phba->mbox->us.s2.port; 3035 phba->inb_ha_copy = NULL; 3036 phba->inb_counter = NULL; |
3026 } | 3037 } |
3027 | |
3028do_prep_failed: 3029 mempool_free(pmb, phba->mbox_mem_pool); 3030 return rc; 3031} 3032 3033 3034/** 3035 * lpfc_sli_hba_setup: SLI intialization function. --- 44 unchanged lines hidden (view full) --- 3080 if (rc && mode != 2) 3081 rc = lpfc_do_config_port(phba, 2); 3082 if (rc) 3083 goto lpfc_sli_hba_setup_error; 3084 3085 if (phba->sli_rev == 3) { 3086 phba->iocb_cmd_size = SLI3_IOCB_CMD_SIZE; 3087 phba->iocb_rsp_size = SLI3_IOCB_RSP_SIZE; | 3038do_prep_failed: 3039 mempool_free(pmb, phba->mbox_mem_pool); 3040 return rc; 3041} 3042 3043 3044/** 3045 * lpfc_sli_hba_setup: SLI intialization function. --- 44 unchanged lines hidden (view full) --- 3090 if (rc && mode != 2) 3091 rc = lpfc_do_config_port(phba, 2); 3092 if (rc) 3093 goto lpfc_sli_hba_setup_error; 3094 3095 if (phba->sli_rev == 3) { 3096 phba->iocb_cmd_size = SLI3_IOCB_CMD_SIZE; 3097 phba->iocb_rsp_size = SLI3_IOCB_RSP_SIZE; |
3088 phba->sli3_options |= LPFC_SLI3_ENABLED; 3089 phba->sli3_options |= LPFC_SLI3_HBQ_ENABLED; 3090 | |
3091 } else { 3092 phba->iocb_cmd_size = SLI2_IOCB_CMD_SIZE; 3093 phba->iocb_rsp_size = SLI2_IOCB_RSP_SIZE; 3094 phba->sli3_options = 0; 3095 } 3096 3097 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 3098 "0444 Firmware in SLI %x mode. Max_vpi %d\n", --- 151 unchanged lines hidden (view full) --- 3250{ 3251 MAILBOX_t *mb; 3252 struct lpfc_sli *psli = &phba->sli; 3253 uint32_t status, evtctr; 3254 uint32_t ha_copy; 3255 int i; 3256 unsigned long timeout; 3257 unsigned long drvr_flag = 0; | 3098 } else { 3099 phba->iocb_cmd_size = SLI2_IOCB_CMD_SIZE; 3100 phba->iocb_rsp_size = SLI2_IOCB_RSP_SIZE; 3101 phba->sli3_options = 0; 3102 } 3103 3104 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 3105 "0444 Firmware in SLI %x mode. Max_vpi %d\n", --- 151 unchanged lines hidden (view full) --- 3257{ 3258 MAILBOX_t *mb; 3259 struct lpfc_sli *psli = &phba->sli; 3260 uint32_t status, evtctr; 3261 uint32_t ha_copy; 3262 int i; 3263 unsigned long timeout; 3264 unsigned long drvr_flag = 0; |
3258 volatile uint32_t word0, ldata; | 3265 uint32_t word0, ldata; |
3259 void __iomem *to_slim; 3260 int processing_queue = 0; 3261 3262 spin_lock_irqsave(&phba->hbalock, drvr_flag); 3263 if (!pmbox) { 3264 /* processing mbox queue from intr_handler */ 3265 processing_queue = 1; 3266 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; --- 143 unchanged lines hidden (view full) --- 3410 psli->slistat.mbox_cmd++; 3411 evtctr = psli->slistat.mbox_event; 3412 3413 /* next set own bit for the adapter and copy over command word */ 3414 mb->mbxOwner = OWN_CHIP; 3415 3416 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 3417 /* First copy command data to host SLIM area */ | 3266 void __iomem *to_slim; 3267 int processing_queue = 0; 3268 3269 spin_lock_irqsave(&phba->hbalock, drvr_flag); 3270 if (!pmbox) { 3271 /* processing mbox queue from intr_handler */ 3272 processing_queue = 1; 3273 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; --- 143 unchanged lines hidden (view full) --- 3417 psli->slistat.mbox_cmd++; 3418 evtctr = psli->slistat.mbox_event; 3419 3420 /* next set own bit for the adapter and copy over command word */ 3421 mb->mbxOwner = OWN_CHIP; 3422 3423 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 3424 /* First copy command data to host SLIM area */ |
3418 lpfc_sli_pcimem_bcopy(mb, &phba->slim2p->mbx, MAILBOX_CMD_SIZE); | 3425 lpfc_sli_pcimem_bcopy(mb, phba->mbox, MAILBOX_CMD_SIZE); |
3419 } else { 3420 if (mb->mbxCommand == MBX_CONFIG_PORT) { 3421 /* copy command data into host mbox for cmpl */ | 3426 } else { 3427 if (mb->mbxCommand == MBX_CONFIG_PORT) { 3428 /* copy command data into host mbox for cmpl */ |
3422 lpfc_sli_pcimem_bcopy(mb, &phba->slim2p->mbx, 3423 MAILBOX_CMD_SIZE); | 3429 lpfc_sli_pcimem_bcopy(mb, phba->mbox, MAILBOX_CMD_SIZE); |
3424 } 3425 3426 /* First copy mbox command data to HBA SLIM, skip past first 3427 word */ 3428 to_slim = phba->MBslimaddr + sizeof (uint32_t); 3429 lpfc_memcpy_to_slim(to_slim, &mb->un.varWords[0], 3430 MAILBOX_CMD_SIZE - sizeof (uint32_t)); 3431 3432 /* Next copy over first word, with mbxOwner set */ | 3430 } 3431 3432 /* First copy mbox command data to HBA SLIM, skip past first 3433 word */ 3434 to_slim = phba->MBslimaddr + sizeof (uint32_t); 3435 lpfc_memcpy_to_slim(to_slim, &mb->un.varWords[0], 3436 MAILBOX_CMD_SIZE - sizeof (uint32_t)); 3437 3438 /* Next copy over first word, with mbxOwner set */ |
3433 ldata = *((volatile uint32_t *)mb); | 3439 ldata = *((uint32_t *)mb); |
3434 to_slim = phba->MBslimaddr; 3435 writel(ldata, to_slim); 3436 readl(to_slim); /* flush */ 3437 3438 if (mb->mbxCommand == MBX_CONFIG_PORT) { 3439 /* switch over to host mailbox */ 3440 psli->sli_flag |= LPFC_SLI2_ACTIVE; 3441 } --- 15 unchanged lines hidden (view full) --- 3457 /* Set up null reference to mailbox command */ 3458 psli->mbox_active = NULL; 3459 /* Interrupt board to do it */ 3460 writel(CA_MBATT, phba->CAregaddr); 3461 readl(phba->CAregaddr); /* flush */ 3462 3463 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 3464 /* First read mbox status word */ | 3440 to_slim = phba->MBslimaddr; 3441 writel(ldata, to_slim); 3442 readl(to_slim); /* flush */ 3443 3444 if (mb->mbxCommand == MBX_CONFIG_PORT) { 3445 /* switch over to host mailbox */ 3446 psli->sli_flag |= LPFC_SLI2_ACTIVE; 3447 } --- 15 unchanged lines hidden (view full) --- 3463 /* Set up null reference to mailbox command */ 3464 psli->mbox_active = NULL; 3465 /* Interrupt board to do it */ 3466 writel(CA_MBATT, phba->CAregaddr); 3467 readl(phba->CAregaddr); /* flush */ 3468 3469 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 3470 /* First read mbox status word */ |
3465 word0 = *((volatile uint32_t *)&phba->slim2p->mbx); | 3471 word0 = *((uint32_t *)phba->mbox); |
3466 word0 = le32_to_cpu(word0); 3467 } else { 3468 /* First read mbox status word */ 3469 word0 = readl(phba->MBslimaddr); 3470 } 3471 3472 /* Read the HBA Host Attention Register */ 3473 ha_copy = readl(phba->HAregaddr); --- 22 unchanged lines hidden (view full) --- 3496 spin_unlock_irqrestore(&phba->hbalock, 3497 drvr_flag); 3498 msleep(1); 3499 spin_lock_irqsave(&phba->hbalock, drvr_flag); 3500 } 3501 3502 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 3503 /* First copy command data */ | 3472 word0 = le32_to_cpu(word0); 3473 } else { 3474 /* First read mbox status word */ 3475 word0 = readl(phba->MBslimaddr); 3476 } 3477 3478 /* Read the HBA Host Attention Register */ 3479 ha_copy = readl(phba->HAregaddr); --- 22 unchanged lines hidden (view full) --- 3502 spin_unlock_irqrestore(&phba->hbalock, 3503 drvr_flag); 3504 msleep(1); 3505 spin_lock_irqsave(&phba->hbalock, drvr_flag); 3506 } 3507 3508 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 3509 /* First copy command data */ |
3504 word0 = *((volatile uint32_t *) 3505 &phba->slim2p->mbx); | 3510 word0 = *((uint32_t *)phba->mbox); |
3506 word0 = le32_to_cpu(word0); 3507 if (mb->mbxCommand == MBX_CONFIG_PORT) { 3508 MAILBOX_t *slimmb; | 3511 word0 = le32_to_cpu(word0); 3512 if (mb->mbxCommand == MBX_CONFIG_PORT) { 3513 MAILBOX_t *slimmb; |
3509 volatile uint32_t slimword0; | 3514 uint32_t slimword0; |
3510 /* Check real SLIM for any errors */ 3511 slimword0 = readl(phba->MBslimaddr); 3512 slimmb = (MAILBOX_t *) & slimword0; 3513 if (((slimword0 & OWN_CHIP) != OWN_CHIP) 3514 && slimmb->mbxStatus) { 3515 psli->sli_flag &= 3516 ~LPFC_SLI2_ACTIVE; 3517 word0 = slimword0; --- 4 unchanged lines hidden (view full) --- 3522 word0 = readl(phba->MBslimaddr); 3523 } 3524 /* Read the HBA Host Attention Register */ 3525 ha_copy = readl(phba->HAregaddr); 3526 } 3527 3528 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 3529 /* copy results back to user */ | 3515 /* Check real SLIM for any errors */ 3516 slimword0 = readl(phba->MBslimaddr); 3517 slimmb = (MAILBOX_t *) & slimword0; 3518 if (((slimword0 & OWN_CHIP) != OWN_CHIP) 3519 && slimmb->mbxStatus) { 3520 psli->sli_flag &= 3521 ~LPFC_SLI2_ACTIVE; 3522 word0 = slimword0; --- 4 unchanged lines hidden (view full) --- 3527 word0 = readl(phba->MBslimaddr); 3528 } 3529 /* Read the HBA Host Attention Register */ 3530 ha_copy = readl(phba->HAregaddr); 3531 } 3532 3533 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 3534 /* copy results back to user */ |
3530 lpfc_sli_pcimem_bcopy(&phba->slim2p->mbx, mb, 3531 MAILBOX_CMD_SIZE); | 3535 lpfc_sli_pcimem_bcopy(phba->mbox, mb, MAILBOX_CMD_SIZE); |
3532 } else { 3533 /* First copy command data */ 3534 lpfc_memcpy_from_slim(mb, phba->MBslimaddr, 3535 MAILBOX_CMD_SIZE); 3536 if ((mb->mbxCommand == MBX_DUMP_MEMORY) && 3537 pmbox->context2) { 3538 lpfc_memcpy_from_slim((void *)pmbox->context2, 3539 phba->MBslimaddr + DMP_RSP_OFFSET, --- 1550 unchanged lines hidden (view full) --- 5090 return IRQ_NONE; 5091 5092 /* 5093 * Read host attention register to determine interrupt source 5094 * Clear Attention Sources, except Error Attention (to 5095 * preserve status) and Link Attention 5096 */ 5097 spin_lock(&phba->hbalock); | 3536 } else { 3537 /* First copy command data */ 3538 lpfc_memcpy_from_slim(mb, phba->MBslimaddr, 3539 MAILBOX_CMD_SIZE); 3540 if ((mb->mbxCommand == MBX_DUMP_MEMORY) && 3541 pmbox->context2) { 3542 lpfc_memcpy_from_slim((void *)pmbox->context2, 3543 phba->MBslimaddr + DMP_RSP_OFFSET, --- 1550 unchanged lines hidden (view full) --- 5094 return IRQ_NONE; 5095 5096 /* 5097 * Read host attention register to determine interrupt source 5098 * Clear Attention Sources, except Error Attention (to 5099 * preserve status) and Link Attention 5100 */ 5101 spin_lock(&phba->hbalock); |
5098 ha_copy = readl(phba->HAregaddr); | 5102 if (phba->sli3_options & LPFC_SLI3_INB_ENABLED && 5103 (phba->inb_last_counter != *phba->inb_counter)) { 5104 phba->inb_last_counter = *phba->inb_counter; 5105 ha_copy = le32_to_cpu(*phba->inb_ha_copy); 5106 } else 5107 ha_copy = readl(phba->HAregaddr); 5108 if (unlikely(!ha_copy)) { 5109 spin_unlock(&phba->hbalock); 5110 return IRQ_NONE; 5111 } |
5099 /* If somebody is waiting to handle an eratt don't process it 5100 * here. The brdkill function will do this. 5101 */ 5102 if (phba->link_flag & LS_IGNORE_ERATT) 5103 ha_copy &= ~HA_ERATT; 5104 writel((ha_copy & ~(HA_LATT | HA_ERATT)), phba->HAregaddr); 5105 readl(phba->HAregaddr); /* flush */ 5106 spin_unlock(&phba->hbalock); 5107 | 5112 /* If somebody is waiting to handle an eratt don't process it 5113 * here. The brdkill function will do this. 5114 */ 5115 if (phba->link_flag & LS_IGNORE_ERATT) 5116 ha_copy &= ~HA_ERATT; 5117 writel((ha_copy & ~(HA_LATT | HA_ERATT)), phba->HAregaddr); 5118 readl(phba->HAregaddr); /* flush */ 5119 spin_unlock(&phba->hbalock); 5120 |
5108 if (unlikely(!ha_copy)) 5109 return IRQ_NONE; 5110 | |
5111 work_ha_copy = ha_copy & phba->work_ha_mask; 5112 5113 if (unlikely(work_ha_copy)) { 5114 if (work_ha_copy & HA_LATT) { 5115 if (phba->sli.sli_flag & LPFC_PROCESS_LA) { 5116 /* 5117 * Turn off Link Attention interrupts 5118 * until CLEAR_LA done --- 70 unchanged lines hidden (view full) --- 5189 phba->pport->stopped = 1; 5190 } 5191 5192 spin_lock(&phba->hbalock); 5193 if ((work_ha_copy & HA_MBATT) && 5194 (phba->sli.mbox_active)) { 5195 pmb = phba->sli.mbox_active; 5196 pmbox = &pmb->mb; | 5121 work_ha_copy = ha_copy & phba->work_ha_mask; 5122 5123 if (unlikely(work_ha_copy)) { 5124 if (work_ha_copy & HA_LATT) { 5125 if (phba->sli.sli_flag & LPFC_PROCESS_LA) { 5126 /* 5127 * Turn off Link Attention interrupts 5128 * until CLEAR_LA done --- 70 unchanged lines hidden (view full) --- 5199 phba->pport->stopped = 1; 5200 } 5201 5202 spin_lock(&phba->hbalock); 5203 if ((work_ha_copy & HA_MBATT) && 5204 (phba->sli.mbox_active)) { 5205 pmb = phba->sli.mbox_active; 5206 pmbox = &pmb->mb; |
5197 mbox = &phba->slim2p->mbx; | 5207 mbox = phba->mbox; |
5198 vport = pmb->vport; 5199 5200 /* First check out the status word */ 5201 lpfc_sli_pcimem_bcopy(mbox, pmbox, sizeof(uint32_t)); 5202 if (pmbox->mbxOwner != OWN_HOST) { 5203 spin_unlock(&phba->hbalock); 5204 /* 5205 * Stray Mailbox Interrupt, mbxCommand <cmd> --- 122 unchanged lines hidden --- | 5208 vport = pmb->vport; 5209 5210 /* First check out the status word */ 5211 lpfc_sli_pcimem_bcopy(mbox, pmbox, sizeof(uint32_t)); 5212 if (pmbox->mbxOwner != OWN_HOST) { 5213 spin_unlock(&phba->hbalock); 5214 /* 5215 * Stray Mailbox Interrupt, mbxCommand <cmd> --- 122 unchanged lines hidden --- |