aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc.h
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2011-03-11 16:06:12 -0500
committerJames Bottomley <James.Bottomley@suse.de>2011-03-23 12:36:09 -0400
commit9940b97bb30d7435c881418c809ed652eb329583 (patch)
treed274c01b97553711c10f0d862b460aa3cd00ba02 /drivers/scsi/lpfc/lpfc.h
parent7f86059ac016d8662e5fbfab4875529510977b47 (diff)
[SCSI] lpfc 8.3.22: Add support for PCI Adapter Failure
Periodically poll adapter registers to detect pci adapter failure (reads return -1). On failure, take port offline, set error indicators and wake up worker threads. Threads will take adapter offline. Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc.h')
-rw-r--r--drivers/scsi/lpfc/lpfc.h25
1 files changed, 19 insertions, 6 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index d9869f417d4f..60e98a62f308 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -897,7 +897,18 @@ lpfc_worker_wake_up(struct lpfc_hba *phba)
897 return; 897 return;
898} 898}
899 899
900static inline void 900static inline int
901lpfc_readl(void __iomem *addr, uint32_t *data)
902{
903 uint32_t temp;
904 temp = readl(addr);
905 if (temp == 0xffffffff)
906 return -EIO;
907 *data = temp;
908 return 0;
909}
910
911static inline int
901lpfc_sli_read_hs(struct lpfc_hba *phba) 912lpfc_sli_read_hs(struct lpfc_hba *phba)
902{ 913{
903 /* 914 /*
@@ -906,15 +917,17 @@ lpfc_sli_read_hs(struct lpfc_hba *phba)
906 */ 917 */
907 phba->sli.slistat.err_attn_event++; 918 phba->sli.slistat.err_attn_event++;
908 919
909 /* Save status info */ 920 /* Save status info and check for unplug error */
910 phba->work_hs = readl(phba->HSregaddr); 921 if (lpfc_readl(phba->HSregaddr, &phba->work_hs) ||
911 phba->work_status[0] = readl(phba->MBslimaddr + 0xa8); 922 lpfc_readl(phba->MBslimaddr + 0xa8, &phba->work_status[0]) ||
912 phba->work_status[1] = readl(phba->MBslimaddr + 0xac); 923 lpfc_readl(phba->MBslimaddr + 0xac, &phba->work_status[1])) {
924 return -EIO;
925 }
913 926
914 /* Clear chip Host Attention error bit */ 927 /* Clear chip Host Attention error bit */
915 writel(HA_ERATT, phba->HAregaddr); 928 writel(HA_ERATT, phba->HAregaddr);
916 readl(phba->HAregaddr); /* flush */ 929 readl(phba->HAregaddr); /* flush */
917 phba->pport->stopped = 1; 930 phba->pport->stopped = 1;
918 931
919 return; 932 return 0;
920} 933}