diff options
author | David S. Miller <davem@davemloft.net> | 2009-08-12 20:44:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-12 20:44:53 -0400 |
commit | aa11d958d1a6572eda08214d7c6a735804fe48a5 (patch) | |
tree | d025b05270ad1e010660d17eeadc6ac3c1abbd7d /drivers/net/netxen | |
parent | 07f6642ee9418e962e54cbc07471cfe2e559c568 (diff) | |
parent | 9799218ae36910af50f002a5db1802d576fffb43 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
arch/microblaze/include/asm/socket.h
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index c91e02245815..98271f962ae4 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -222,7 +222,7 @@ netxen_napi_disable(struct netxen_adapter *adapter) | |||
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | static int nx_set_dma_mask(struct netxen_adapter *adapter, uint8_t revision_id) | 225 | static int nx_set_dma_mask(struct netxen_adapter *adapter) |
226 | { | 226 | { |
227 | struct pci_dev *pdev = adapter->pdev; | 227 | struct pci_dev *pdev = adapter->pdev; |
228 | uint64_t mask, cmask; | 228 | uint64_t mask, cmask; |
@@ -230,19 +230,17 @@ static int nx_set_dma_mask(struct netxen_adapter *adapter, uint8_t revision_id) | |||
230 | adapter->pci_using_dac = 0; | 230 | adapter->pci_using_dac = 0; |
231 | 231 | ||
232 | mask = DMA_BIT_MASK(32); | 232 | mask = DMA_BIT_MASK(32); |
233 | /* | ||
234 | * Consistent DMA mask is set to 32 bit because it cannot be set to | ||
235 | * 35 bits. For P3 also leave it at 32 bits for now. Only the rings | ||
236 | * come off this pool. | ||
237 | */ | ||
238 | cmask = DMA_BIT_MASK(32); | 233 | cmask = DMA_BIT_MASK(32); |
239 | 234 | ||
235 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | ||
240 | #ifndef CONFIG_IA64 | 236 | #ifndef CONFIG_IA64 |
241 | if (revision_id >= NX_P3_B0) | ||
242 | mask = DMA_BIT_MASK(39); | ||
243 | else if (revision_id == NX_P2_C1) | ||
244 | mask = DMA_BIT_MASK(35); | 237 | mask = DMA_BIT_MASK(35); |
245 | #endif | 238 | #endif |
239 | } else { | ||
240 | mask = DMA_BIT_MASK(39); | ||
241 | cmask = mask; | ||
242 | } | ||
243 | |||
246 | if (pci_set_dma_mask(pdev, mask) == 0 && | 244 | if (pci_set_dma_mask(pdev, mask) == 0 && |
247 | pci_set_consistent_dma_mask(pdev, cmask) == 0) { | 245 | pci_set_consistent_dma_mask(pdev, cmask) == 0) { |
248 | adapter->pci_using_dac = 1; | 246 | adapter->pci_using_dac = 1; |
@@ -257,13 +255,13 @@ static int | |||
257 | nx_update_dma_mask(struct netxen_adapter *adapter) | 255 | nx_update_dma_mask(struct netxen_adapter *adapter) |
258 | { | 256 | { |
259 | int change, shift, err; | 257 | int change, shift, err; |
260 | uint64_t mask, old_mask; | 258 | uint64_t mask, old_mask, old_cmask; |
261 | struct pci_dev *pdev = adapter->pdev; | 259 | struct pci_dev *pdev = adapter->pdev; |
262 | 260 | ||
263 | change = 0; | 261 | change = 0; |
264 | 262 | ||
265 | shift = NXRD32(adapter, CRB_DMA_SHIFT); | 263 | shift = NXRD32(adapter, CRB_DMA_SHIFT); |
266 | if (shift >= 32) | 264 | if (shift > 32) |
267 | return 0; | 265 | return 0; |
268 | 266 | ||
269 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id) && (shift > 9)) | 267 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id) && (shift > 9)) |
@@ -273,14 +271,29 @@ nx_update_dma_mask(struct netxen_adapter *adapter) | |||
273 | 271 | ||
274 | if (change) { | 272 | if (change) { |
275 | old_mask = pdev->dma_mask; | 273 | old_mask = pdev->dma_mask; |
276 | mask = (1ULL<<(32+shift)) - 1; | 274 | old_cmask = pdev->dev.coherent_dma_mask; |
275 | |||
276 | mask = DMA_BIT_MASK(32+shift); | ||
277 | 277 | ||
278 | err = pci_set_dma_mask(pdev, mask); | 278 | err = pci_set_dma_mask(pdev, mask); |
279 | if (err) | 279 | if (err) |
280 | return pci_set_dma_mask(pdev, old_mask); | 280 | goto err_out; |
281 | |||
282 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | ||
283 | |||
284 | err = pci_set_consistent_dma_mask(pdev, mask); | ||
285 | if (err) | ||
286 | goto err_out; | ||
287 | } | ||
288 | dev_info(&pdev->dev, "using %d-bit dma mask\n", 32+shift); | ||
281 | } | 289 | } |
282 | 290 | ||
283 | return 0; | 291 | return 0; |
292 | |||
293 | err_out: | ||
294 | pci_set_dma_mask(pdev, old_mask); | ||
295 | pci_set_consistent_dma_mask(pdev, old_cmask); | ||
296 | return err; | ||
284 | } | 297 | } |
285 | 298 | ||
286 | static void | 299 | static void |
@@ -1128,7 +1141,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1128 | revision_id = pdev->revision; | 1141 | revision_id = pdev->revision; |
1129 | adapter->ahw.revision_id = revision_id; | 1142 | adapter->ahw.revision_id = revision_id; |
1130 | 1143 | ||
1131 | err = nx_set_dma_mask(adapter, revision_id); | 1144 | err = nx_set_dma_mask(adapter); |
1132 | if (err) | 1145 | if (err) |
1133 | goto err_out_free_netdev; | 1146 | goto err_out_free_netdev; |
1134 | 1147 | ||