diff options
author | Ajit Khaparde <ajitk@serverengines.com> | 2010-01-27 16:56:44 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-28 08:54:18 -0500 |
commit | 7b139c83c590d4965259aad8889cbb08104b2891 (patch) | |
tree | 12d6d9295be36e716a3a3ef71743a4bcc0f80b1e | |
parent | 744595c847cefd6ac0eec8f66e9fba95687c3f4f (diff) |
be2net: Bug fix to support newer generation of BE ASIC
Bug fix in be2net for newer generation of BladeEngine ASIC.
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/benet/be.h | 5 | ||||
-rw-r--r-- | drivers/net/benet/be_cmds.h | 3 | ||||
-rw-r--r-- | drivers/net/benet/be_main.c | 25 |
3 files changed, 30 insertions, 3 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index 9fd8e5ecd5d7..5bc74590c73e 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -276,8 +276,13 @@ struct be_adapter { | |||
276 | int link_speed; | 276 | int link_speed; |
277 | u8 port_type; | 277 | u8 port_type; |
278 | u8 transceiver; | 278 | u8 transceiver; |
279 | u8 generation; /* BladeEngine ASIC generation */ | ||
279 | }; | 280 | }; |
280 | 281 | ||
282 | /* BladeEngine Generation numbers */ | ||
283 | #define BE_GEN2 2 | ||
284 | #define BE_GEN3 3 | ||
285 | |||
281 | extern const struct ethtool_ops be_ethtool_ops; | 286 | extern const struct ethtool_ops be_ethtool_ops; |
282 | 287 | ||
283 | #define drvr_stats(adapter) (&adapter->stats.drvr_stats) | 288 | #define drvr_stats(adapter) (&adapter->stats.drvr_stats) |
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h index c002b8391b4d..13b33c841083 100644 --- a/drivers/net/benet/be_cmds.h +++ b/drivers/net/benet/be_cmds.h | |||
@@ -164,7 +164,8 @@ struct be_cmd_req_hdr { | |||
164 | u8 domain; /* dword 0 */ | 164 | u8 domain; /* dword 0 */ |
165 | u32 timeout; /* dword 1 */ | 165 | u32 timeout; /* dword 1 */ |
166 | u32 request_length; /* dword 2 */ | 166 | u32 request_length; /* dword 2 */ |
167 | u32 rsvd; /* dword 3 */ | 167 | u8 version; /* dword 3 */ |
168 | u8 rsvd[3]; /* dword 3 */ | ||
168 | }; | 169 | }; |
169 | 170 | ||
170 | #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */ | 171 | #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */ |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 33ab8c7f14fe..90c5661b336f 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -2051,6 +2051,7 @@ static void be_unmap_pci_bars(struct be_adapter *adapter) | |||
2051 | static int be_map_pci_bars(struct be_adapter *adapter) | 2051 | static int be_map_pci_bars(struct be_adapter *adapter) |
2052 | { | 2052 | { |
2053 | u8 __iomem *addr; | 2053 | u8 __iomem *addr; |
2054 | int pcicfg_reg; | ||
2054 | 2055 | ||
2055 | addr = ioremap_nocache(pci_resource_start(adapter->pdev, 2), | 2056 | addr = ioremap_nocache(pci_resource_start(adapter->pdev, 2), |
2056 | pci_resource_len(adapter->pdev, 2)); | 2057 | pci_resource_len(adapter->pdev, 2)); |
@@ -2064,8 +2065,13 @@ static int be_map_pci_bars(struct be_adapter *adapter) | |||
2064 | goto pci_map_err; | 2065 | goto pci_map_err; |
2065 | adapter->db = addr; | 2066 | adapter->db = addr; |
2066 | 2067 | ||
2067 | addr = ioremap_nocache(pci_resource_start(adapter->pdev, 1), | 2068 | if (adapter->generation == BE_GEN2) |
2068 | pci_resource_len(adapter->pdev, 1)); | 2069 | pcicfg_reg = 1; |
2070 | else | ||
2071 | pcicfg_reg = 0; | ||
2072 | |||
2073 | addr = ioremap_nocache(pci_resource_start(adapter->pdev, pcicfg_reg), | ||
2074 | pci_resource_len(adapter->pdev, pcicfg_reg)); | ||
2069 | if (addr == NULL) | 2075 | if (addr == NULL) |
2070 | goto pci_map_err; | 2076 | goto pci_map_err; |
2071 | adapter->pcicfg = addr; | 2077 | adapter->pcicfg = addr; |
@@ -2162,6 +2168,7 @@ static int be_stats_init(struct be_adapter *adapter) | |||
2162 | cmd->va = pci_alloc_consistent(adapter->pdev, cmd->size, &cmd->dma); | 2168 | cmd->va = pci_alloc_consistent(adapter->pdev, cmd->size, &cmd->dma); |
2163 | if (cmd->va == NULL) | 2169 | if (cmd->va == NULL) |
2164 | return -1; | 2170 | return -1; |
2171 | memset(cmd->va, cmd->size, 0); | ||
2165 | return 0; | 2172 | return 0; |
2166 | } | 2173 | } |
2167 | 2174 | ||
@@ -2240,6 +2247,20 @@ static int __devinit be_probe(struct pci_dev *pdev, | |||
2240 | goto rel_reg; | 2247 | goto rel_reg; |
2241 | } | 2248 | } |
2242 | adapter = netdev_priv(netdev); | 2249 | adapter = netdev_priv(netdev); |
2250 | |||
2251 | switch (pdev->device) { | ||
2252 | case BE_DEVICE_ID1: | ||
2253 | case OC_DEVICE_ID1: | ||
2254 | adapter->generation = BE_GEN2; | ||
2255 | break; | ||
2256 | case BE_DEVICE_ID2: | ||
2257 | case OC_DEVICE_ID2: | ||
2258 | adapter->generation = BE_GEN3; | ||
2259 | break; | ||
2260 | default: | ||
2261 | adapter->generation = 0; | ||
2262 | } | ||
2263 | |||
2243 | adapter->pdev = pdev; | 2264 | adapter->pdev = pdev; |
2244 | pci_set_drvdata(pdev, adapter); | 2265 | pci_set_drvdata(pdev, adapter); |
2245 | adapter->netdev = netdev; | 2266 | adapter->netdev = netdev; |