aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bna
diff options
context:
space:
mode:
authorRasesh Mody <rmody@brocade.com>2010-12-23 16:45:06 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-25 22:16:01 -0500
commit2c7d38210ff8e65f8961699bce92c273c77d113c (patch)
treeec6a75c0c6d5f22a71e1e098b275677c07c1cee2 /drivers/net/bna
parentf7c0fa4cd5dcf58dd95b216d2c33444a3b4a44e0 (diff)
bna: IOC uninit check and misc cleanup
Change Details: - Added a check in ioc firmware lock function to see if IOC is in BFI_IOC_UNINIT state or not. If it is not in UNINIT state and the last IOC boot was not done by OS driver, force IOC state to BFI_IOC_UNINIT - Unused macro and API cleanup Signed-off-by: Debashis Dutt <ddutt@brocade.com> Signed-off-by: Rasesh Mody <rmody@brocade.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bna')
-rw-r--r--drivers/net/bna/bfa_defs_mfg_comm.h22
-rw-r--r--drivers/net/bna/bfa_ioc.c45
2 files changed, 2 insertions, 65 deletions
diff --git a/drivers/net/bna/bfa_defs_mfg_comm.h b/drivers/net/bna/bfa_defs_mfg_comm.h
index 987978fcb3fe..fdd677618361 100644
--- a/drivers/net/bna/bfa_defs_mfg_comm.h
+++ b/drivers/net/bna/bfa_defs_mfg_comm.h
@@ -95,28 +95,6 @@ enum {
95 (type) == BFA_MFG_TYPE_CNA10P1 || \ 95 (type) == BFA_MFG_TYPE_CNA10P1 || \
96 bfa_mfg_is_mezz(type))) 96 bfa_mfg_is_mezz(type)))
97 97
98/**
99 * Check if the card having old wwn/mac handling
100 */
101#define bfa_mfg_is_old_wwn_mac_model(type) (( \
102 (type) == BFA_MFG_TYPE_FC8P2 || \
103 (type) == BFA_MFG_TYPE_FC8P1 || \
104 (type) == BFA_MFG_TYPE_FC4P2 || \
105 (type) == BFA_MFG_TYPE_FC4P1 || \
106 (type) == BFA_MFG_TYPE_CNA10P2 || \
107 (type) == BFA_MFG_TYPE_CNA10P1 || \
108 (type) == BFA_MFG_TYPE_JAYHAWK || \
109 (type) == BFA_MFG_TYPE_WANCHESE))
110
111#define bfa_mfg_increment_wwn_mac(m, i) \
112do { \
113 u32 t = ((m)[0] << 16) | ((m)[1] << 8) | (m)[2]; \
114 t += (i); \
115 (m)[0] = (t >> 16) & 0xFF; \
116 (m)[1] = (t >> 8) & 0xFF; \
117 (m)[2] = t & 0xFF; \
118} while (0)
119
120#define bfa_mfg_adapter_prop_init_flash(card_type, prop) \ 98#define bfa_mfg_adapter_prop_init_flash(card_type, prop) \
121do { \ 99do { \
122 switch ((card_type)) { \ 100 switch ((card_type)) { \
diff --git a/drivers/net/bna/bfa_ioc.c b/drivers/net/bna/bfa_ioc.c
index e94e5aa97515..8ed147e803c3 100644
--- a/drivers/net/bna/bfa_ioc.c
+++ b/drivers/net/bna/bfa_ioc.c
@@ -58,9 +58,6 @@
58#define bfa_ioc_notify_hbfail(__ioc) \ 58#define bfa_ioc_notify_hbfail(__ioc) \
59 ((__ioc)->ioc_hwif->ioc_notify_hbfail(__ioc)) 59 ((__ioc)->ioc_hwif->ioc_notify_hbfail(__ioc))
60 60
61#define bfa_ioc_is_optrom(__ioc) \
62 (bfa_cb_image_get_size(BFA_IOC_FWIMG_TYPE(__ioc)) < BFA_IOC_FWIMG_MINSZ)
63
64#define bfa_ioc_mbox_cmd_pending(__ioc) \ 61#define bfa_ioc_mbox_cmd_pending(__ioc) \
65 (!list_empty(&((__ioc)->mbox_mod.cmd_q)) || \ 62 (!list_empty(&((__ioc)->mbox_mod.cmd_q)) || \
66 readl((__ioc)->ioc_regs.hfn_mbox_cmd)) 63 readl((__ioc)->ioc_regs.hfn_mbox_cmd))
@@ -101,7 +98,6 @@ static void bfa_ioc_get_adapter_manufacturer(struct bfa_ioc *ioc,
101 char *manufacturer); 98 char *manufacturer);
102static void bfa_ioc_get_adapter_model(struct bfa_ioc *ioc, char *model); 99static void bfa_ioc_get_adapter_model(struct bfa_ioc *ioc, char *model);
103static u64 bfa_ioc_get_pwwn(struct bfa_ioc *ioc); 100static u64 bfa_ioc_get_pwwn(struct bfa_ioc *ioc);
104static mac_t bfa_ioc_get_mfg_mac(struct bfa_ioc *ioc);
105 101
106/** 102/**
107 * IOC state machine events 103 * IOC state machine events
@@ -865,12 +861,6 @@ bfa_ioc_fwver_valid(struct bfa_ioc *ioc)
865{ 861{
866 struct bfi_ioc_image_hdr fwhdr, *drv_fwhdr; 862 struct bfi_ioc_image_hdr fwhdr, *drv_fwhdr;
867 863
868 /**
869 * If bios/efi boot (flash based) -- return true
870 */
871 if (bfa_ioc_is_optrom(ioc))
872 return true;
873
874 bfa_nw_ioc_fwver_get(ioc, &fwhdr); 864 bfa_nw_ioc_fwver_get(ioc, &fwhdr);
875 drv_fwhdr = (struct bfi_ioc_image_hdr *) 865 drv_fwhdr = (struct bfi_ioc_image_hdr *)
876 bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), 0); 866 bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), 0);
@@ -934,13 +924,8 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force)
934 /** 924 /**
935 * If IOC function is disabled and firmware version is same, 925 * If IOC function is disabled and firmware version is same,
936 * just re-enable IOC. 926 * just re-enable IOC.
937 *
938 * If option rom, IOC must not be in operational state. With
939 * convergence, IOC will be in operational state when 2nd driver
940 * is loaded.
941 */ 927 */
942 if (ioc_fwstate == BFI_IOC_DISABLED || 928 if (ioc_fwstate == BFI_IOC_DISABLED || ioc_fwstate == BFI_IOC_OP) {
943 (!bfa_ioc_is_optrom(ioc) && ioc_fwstate == BFI_IOC_OP)) {
944 /** 929 /**
945 * When using MSI-X any pending firmware ready event should 930 * When using MSI-X any pending firmware ready event should
946 * be flushed. Otherwise MSI-X interrupts are not delivered. 931 * be flushed. Otherwise MSI-X interrupts are not delivered.
@@ -1078,11 +1063,6 @@ bfa_ioc_download_fw(struct bfa_ioc *ioc, u32 boot_type,
1078 */ 1063 */
1079 bfa_ioc_lmem_init(ioc); 1064 bfa_ioc_lmem_init(ioc);
1080 1065
1081 /**
1082 * Flash based firmware boot
1083 */
1084 if (bfa_ioc_is_optrom(ioc))
1085 boot_type = BFI_BOOT_TYPE_FLASH;
1086 fwimg = bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), chunkno); 1066 fwimg = bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), chunkno);
1087 1067
1088 pgnum = bfa_ioc_smem_pgnum(ioc, loff); 1068 pgnum = bfa_ioc_smem_pgnum(ioc, loff);
@@ -1689,28 +1669,7 @@ bfa_ioc_get_pwwn(struct bfa_ioc *ioc)
1689mac_t 1669mac_t
1690bfa_nw_ioc_get_mac(struct bfa_ioc *ioc) 1670bfa_nw_ioc_get_mac(struct bfa_ioc *ioc)
1691{ 1671{
1692 /* 1672 return ioc->attr->mac;
1693 * Currently mfg mac is used as FCoE enode mac (not configured by PBC)
1694 */
1695 if (bfa_ioc_get_type(ioc) == BFA_IOC_TYPE_FCoE)
1696 return bfa_ioc_get_mfg_mac(ioc);
1697 else
1698 return ioc->attr->mac;
1699}
1700
1701static mac_t
1702bfa_ioc_get_mfg_mac(struct bfa_ioc *ioc)
1703{
1704 mac_t m;
1705
1706 m = ioc->attr->mfg_mac;
1707 if (bfa_mfg_is_old_wwn_mac_model(ioc->attr->card_type))
1708 m.mac[MAC_ADDRLEN - 1] += bfa_ioc_pcifn(ioc);
1709 else
1710 bfa_mfg_increment_wwn_mac(&(m.mac[MAC_ADDRLEN-3]),
1711 bfa_ioc_pcifn(ioc));
1712
1713 return m;
1714} 1673}
1715 1674
1716/** 1675/**