diff options
author | Krishna Gudipati <kgudipat@brocade.com> | 2011-06-24 23:22:56 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-06-29 17:57:52 -0400 |
commit | 5a0adaedffce91100d03fc1036dde024c8589295 (patch) | |
tree | 672bba0f2dd33eea68a492dc4567f42d16a53c4d /drivers/scsi/bfa/bfa_ioc_ct.c | |
parent | 1a4d8e1bd81c018f7b8c7622066d5cfead59b38a (diff) |
[SCSI] bfa: IOC bug fixes.
- Add logic to handle the case where PCI mapping goes away when
IOCPF state machine is waiting for semaphore.
- Added logic to unlock hw semaphore if the previos FW boot was
from flash based and the current FW initialization attempt is from OS.
- Added fix to update hbfails and hb_count stats during hwerror event.
Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bfa/bfa_ioc_ct.c')
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc_ct.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/scsi/bfa/bfa_ioc_ct.c b/drivers/scsi/bfa/bfa_ioc_ct.c index 5b5579401d43..216016c50d11 100644 --- a/drivers/scsi/bfa/bfa_ioc_ct.c +++ b/drivers/scsi/bfa/bfa_ioc_ct.c | |||
@@ -58,12 +58,6 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) | |||
58 | struct bfi_ioc_image_hdr_s fwhdr; | 58 | struct bfi_ioc_image_hdr_s fwhdr; |
59 | 59 | ||
60 | /* | 60 | /* |
61 | * Firmware match check is relevant only for CNA. | ||
62 | */ | ||
63 | if (!bfa_ioc_is_cna(ioc)) | ||
64 | return BFA_TRUE; | ||
65 | |||
66 | /* | ||
67 | * If bios boot (flash based) -- do not increment usage count | 61 | * If bios boot (flash based) -- do not increment usage count |
68 | */ | 62 | */ |
69 | if (bfa_cb_image_get_size(bfa_ioc_asic_gen(ioc)) < | 63 | if (bfa_cb_image_get_size(bfa_ioc_asic_gen(ioc)) < |
@@ -78,6 +72,7 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) | |||
78 | */ | 72 | */ |
79 | if (usecnt == 0) { | 73 | if (usecnt == 0) { |
80 | writel(1, ioc->ioc_regs.ioc_usage_reg); | 74 | writel(1, ioc->ioc_regs.ioc_usage_reg); |
75 | readl(ioc->ioc_regs.ioc_usage_sem_reg); | ||
81 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); | 76 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); |
82 | writel(0, ioc->ioc_regs.ioc_fail_sync); | 77 | writel(0, ioc->ioc_regs.ioc_fail_sync); |
83 | bfa_trc(ioc, usecnt); | 78 | bfa_trc(ioc, usecnt); |
@@ -97,6 +92,7 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) | |||
97 | */ | 92 | */ |
98 | bfa_ioc_fwver_get(ioc, &fwhdr); | 93 | bfa_ioc_fwver_get(ioc, &fwhdr); |
99 | if (!bfa_ioc_fwver_cmp(ioc, &fwhdr)) { | 94 | if (!bfa_ioc_fwver_cmp(ioc, &fwhdr)) { |
95 | readl(ioc->ioc_regs.ioc_usage_sem_reg); | ||
100 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); | 96 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); |
101 | bfa_trc(ioc, usecnt); | 97 | bfa_trc(ioc, usecnt); |
102 | return BFA_FALSE; | 98 | return BFA_FALSE; |
@@ -107,6 +103,7 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) | |||
107 | */ | 103 | */ |
108 | usecnt++; | 104 | usecnt++; |
109 | writel(usecnt, ioc->ioc_regs.ioc_usage_reg); | 105 | writel(usecnt, ioc->ioc_regs.ioc_usage_reg); |
106 | readl(ioc->ioc_regs.ioc_usage_sem_reg); | ||
110 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); | 107 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); |
111 | bfa_trc(ioc, usecnt); | 108 | bfa_trc(ioc, usecnt); |
112 | return BFA_TRUE; | 109 | return BFA_TRUE; |
@@ -118,12 +115,6 @@ bfa_ioc_ct_firmware_unlock(struct bfa_ioc_s *ioc) | |||
118 | u32 usecnt; | 115 | u32 usecnt; |
119 | 116 | ||
120 | /* | 117 | /* |
121 | * Firmware lock is relevant only for CNA. | ||
122 | */ | ||
123 | if (!bfa_ioc_is_cna(ioc)) | ||
124 | return; | ||
125 | |||
126 | /* | ||
127 | * If bios boot (flash based) -- do not decrement usage count | 118 | * If bios boot (flash based) -- do not decrement usage count |
128 | */ | 119 | */ |
129 | if (bfa_cb_image_get_size(bfa_ioc_asic_gen(ioc)) < | 120 | if (bfa_cb_image_get_size(bfa_ioc_asic_gen(ioc)) < |
@@ -141,6 +132,7 @@ bfa_ioc_ct_firmware_unlock(struct bfa_ioc_s *ioc) | |||
141 | writel(usecnt, ioc->ioc_regs.ioc_usage_reg); | 132 | writel(usecnt, ioc->ioc_regs.ioc_usage_reg); |
142 | bfa_trc(ioc, usecnt); | 133 | bfa_trc(ioc, usecnt); |
143 | 134 | ||
135 | readl(ioc->ioc_regs.ioc_usage_sem_reg); | ||
144 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); | 136 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); |
145 | } | 137 | } |
146 | 138 | ||
@@ -344,7 +336,11 @@ bfa_ioc_ct_map_port(struct bfa_ioc_s *ioc) | |||
344 | static void | 336 | static void |
345 | bfa_ioc_ct2_map_port(struct bfa_ioc_s *ioc) | 337 | bfa_ioc_ct2_map_port(struct bfa_ioc_s *ioc) |
346 | { | 338 | { |
347 | ioc->port_id = bfa_ioc_pcifn(ioc) % 2; | 339 | void __iomem *rb = ioc->pcidev.pci_bar_kva; |
340 | u32 r32; | ||
341 | |||
342 | r32 = readl(rb + CT2_HOSTFN_PERSONALITY0); | ||
343 | ioc->port_id = ((r32 & __FC_LL_PORT_MAP__MK) >> __FC_LL_PORT_MAP__SH); | ||
348 | 344 | ||
349 | bfa_trc(ioc, bfa_ioc_pcifn(ioc)); | 345 | bfa_trc(ioc, bfa_ioc_pcifn(ioc)); |
350 | bfa_trc(ioc, ioc->port_id); | 346 | bfa_trc(ioc, ioc->port_id); |
@@ -407,6 +403,7 @@ bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc) | |||
407 | if (bfa_ioc_is_cna(ioc)) { | 403 | if (bfa_ioc_is_cna(ioc)) { |
408 | bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); | 404 | bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); |
409 | writel(0, ioc->ioc_regs.ioc_usage_reg); | 405 | writel(0, ioc->ioc_regs.ioc_usage_reg); |
406 | readl(ioc->ioc_regs.ioc_usage_sem_reg); | ||
410 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); | 407 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); |
411 | } | 408 | } |
412 | 409 | ||