diff options
Diffstat (limited to 'drivers/net/e1000/e1000_ethtool.c')
-rw-r--r-- | drivers/net/e1000/e1000_ethtool.c | 558 |
1 files changed, 270 insertions, 288 deletions
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index a3f6a9c72ec8..6a3893acfe04 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -29,21 +29,8 @@ | |||
29 | /* ethtool support for e1000 */ | 29 | /* ethtool support for e1000 */ |
30 | 30 | ||
31 | #include "e1000.h" | 31 | #include "e1000.h" |
32 | |||
33 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
34 | 33 | ||
35 | extern int e1000_up(struct e1000_adapter *adapter); | ||
36 | extern void e1000_down(struct e1000_adapter *adapter); | ||
37 | extern void e1000_reinit_locked(struct e1000_adapter *adapter); | ||
38 | extern void e1000_reset(struct e1000_adapter *adapter); | ||
39 | extern int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx); | ||
40 | extern int e1000_setup_all_rx_resources(struct e1000_adapter *adapter); | ||
41 | extern int e1000_setup_all_tx_resources(struct e1000_adapter *adapter); | ||
42 | extern void e1000_free_all_rx_resources(struct e1000_adapter *adapter); | ||
43 | extern void e1000_free_all_tx_resources(struct e1000_adapter *adapter); | ||
44 | extern void e1000_update_stats(struct e1000_adapter *adapter); | ||
45 | |||
46 | |||
47 | struct e1000_stats { | 34 | struct e1000_stats { |
48 | char stat_string[ETH_GSTRING_LEN]; | 35 | char stat_string[ETH_GSTRING_LEN]; |
49 | int sizeof_stat; | 36 | int sizeof_stat; |
@@ -112,8 +99,8 @@ static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = { | |||
112 | }; | 99 | }; |
113 | #define E1000_TEST_LEN ARRAY_SIZE(e1000_gstrings_test) | 100 | #define E1000_TEST_LEN ARRAY_SIZE(e1000_gstrings_test) |
114 | 101 | ||
115 | static int | 102 | static int e1000_get_settings(struct net_device *netdev, |
116 | e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | 103 | struct ethtool_cmd *ecmd) |
117 | { | 104 | { |
118 | struct e1000_adapter *adapter = netdev_priv(netdev); | 105 | struct e1000_adapter *adapter = netdev_priv(netdev); |
119 | struct e1000_hw *hw = &adapter->hw; | 106 | struct e1000_hw *hw = &adapter->hw; |
@@ -162,7 +149,7 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
162 | ecmd->transceiver = XCVR_EXTERNAL; | 149 | ecmd->transceiver = XCVR_EXTERNAL; |
163 | } | 150 | } |
164 | 151 | ||
165 | if (E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU) { | 152 | if (er32(STATUS) & E1000_STATUS_LU) { |
166 | 153 | ||
167 | e1000_get_speed_and_duplex(hw, &adapter->link_speed, | 154 | e1000_get_speed_and_duplex(hw, &adapter->link_speed, |
168 | &adapter->link_duplex); | 155 | &adapter->link_duplex); |
@@ -185,8 +172,8 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
185 | return 0; | 172 | return 0; |
186 | } | 173 | } |
187 | 174 | ||
188 | static int | 175 | static int e1000_set_settings(struct net_device *netdev, |
189 | e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | 176 | struct ethtool_cmd *ecmd) |
190 | { | 177 | { |
191 | struct e1000_adapter *adapter = netdev_priv(netdev); | 178 | struct e1000_adapter *adapter = netdev_priv(netdev); |
192 | struct e1000_hw *hw = &adapter->hw; | 179 | struct e1000_hw *hw = &adapter->hw; |
@@ -231,9 +218,8 @@ e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
231 | return 0; | 218 | return 0; |
232 | } | 219 | } |
233 | 220 | ||
234 | static void | 221 | static void e1000_get_pauseparam(struct net_device *netdev, |
235 | e1000_get_pauseparam(struct net_device *netdev, | 222 | struct ethtool_pauseparam *pause) |
236 | struct ethtool_pauseparam *pause) | ||
237 | { | 223 | { |
238 | struct e1000_adapter *adapter = netdev_priv(netdev); | 224 | struct e1000_adapter *adapter = netdev_priv(netdev); |
239 | struct e1000_hw *hw = &adapter->hw; | 225 | struct e1000_hw *hw = &adapter->hw; |
@@ -251,9 +237,8 @@ e1000_get_pauseparam(struct net_device *netdev, | |||
251 | } | 237 | } |
252 | } | 238 | } |
253 | 239 | ||
254 | static int | 240 | static int e1000_set_pauseparam(struct net_device *netdev, |
255 | e1000_set_pauseparam(struct net_device *netdev, | 241 | struct ethtool_pauseparam *pause) |
256 | struct ethtool_pauseparam *pause) | ||
257 | { | 242 | { |
258 | struct e1000_adapter *adapter = netdev_priv(netdev); | 243 | struct e1000_adapter *adapter = netdev_priv(netdev); |
259 | struct e1000_hw *hw = &adapter->hw; | 244 | struct e1000_hw *hw = &adapter->hw; |
@@ -289,15 +274,13 @@ e1000_set_pauseparam(struct net_device *netdev, | |||
289 | return retval; | 274 | return retval; |
290 | } | 275 | } |
291 | 276 | ||
292 | static u32 | 277 | static u32 e1000_get_rx_csum(struct net_device *netdev) |
293 | e1000_get_rx_csum(struct net_device *netdev) | ||
294 | { | 278 | { |
295 | struct e1000_adapter *adapter = netdev_priv(netdev); | 279 | struct e1000_adapter *adapter = netdev_priv(netdev); |
296 | return adapter->rx_csum; | 280 | return adapter->rx_csum; |
297 | } | 281 | } |
298 | 282 | ||
299 | static int | 283 | static int e1000_set_rx_csum(struct net_device *netdev, u32 data) |
300 | e1000_set_rx_csum(struct net_device *netdev, u32 data) | ||
301 | { | 284 | { |
302 | struct e1000_adapter *adapter = netdev_priv(netdev); | 285 | struct e1000_adapter *adapter = netdev_priv(netdev); |
303 | adapter->rx_csum = data; | 286 | adapter->rx_csum = data; |
@@ -309,18 +292,17 @@ e1000_set_rx_csum(struct net_device *netdev, u32 data) | |||
309 | return 0; | 292 | return 0; |
310 | } | 293 | } |
311 | 294 | ||
312 | static u32 | 295 | static u32 e1000_get_tx_csum(struct net_device *netdev) |
313 | e1000_get_tx_csum(struct net_device *netdev) | ||
314 | { | 296 | { |
315 | return (netdev->features & NETIF_F_HW_CSUM) != 0; | 297 | return (netdev->features & NETIF_F_HW_CSUM) != 0; |
316 | } | 298 | } |
317 | 299 | ||
318 | static int | 300 | static int e1000_set_tx_csum(struct net_device *netdev, u32 data) |
319 | e1000_set_tx_csum(struct net_device *netdev, u32 data) | ||
320 | { | 301 | { |
321 | struct e1000_adapter *adapter = netdev_priv(netdev); | 302 | struct e1000_adapter *adapter = netdev_priv(netdev); |
303 | struct e1000_hw *hw = &adapter->hw; | ||
322 | 304 | ||
323 | if (adapter->hw.mac_type < e1000_82543) { | 305 | if (hw->mac_type < e1000_82543) { |
324 | if (!data) | 306 | if (!data) |
325 | return -EINVAL; | 307 | return -EINVAL; |
326 | return 0; | 308 | return 0; |
@@ -334,12 +316,13 @@ e1000_set_tx_csum(struct net_device *netdev, u32 data) | |||
334 | return 0; | 316 | return 0; |
335 | } | 317 | } |
336 | 318 | ||
337 | static int | 319 | static int e1000_set_tso(struct net_device *netdev, u32 data) |
338 | e1000_set_tso(struct net_device *netdev, u32 data) | ||
339 | { | 320 | { |
340 | struct e1000_adapter *adapter = netdev_priv(netdev); | 321 | struct e1000_adapter *adapter = netdev_priv(netdev); |
341 | if ((adapter->hw.mac_type < e1000_82544) || | 322 | struct e1000_hw *hw = &adapter->hw; |
342 | (adapter->hw.mac_type == e1000_82547)) | 323 | |
324 | if ((hw->mac_type < e1000_82544) || | ||
325 | (hw->mac_type == e1000_82547)) | ||
343 | return data ? -EINVAL : 0; | 326 | return data ? -EINVAL : 0; |
344 | 327 | ||
345 | if (data) | 328 | if (data) |
@@ -357,30 +340,26 @@ e1000_set_tso(struct net_device *netdev, u32 data) | |||
357 | return 0; | 340 | return 0; |
358 | } | 341 | } |
359 | 342 | ||
360 | static u32 | 343 | static u32 e1000_get_msglevel(struct net_device *netdev) |
361 | e1000_get_msglevel(struct net_device *netdev) | ||
362 | { | 344 | { |
363 | struct e1000_adapter *adapter = netdev_priv(netdev); | 345 | struct e1000_adapter *adapter = netdev_priv(netdev); |
364 | return adapter->msg_enable; | 346 | return adapter->msg_enable; |
365 | } | 347 | } |
366 | 348 | ||
367 | static void | 349 | static void e1000_set_msglevel(struct net_device *netdev, u32 data) |
368 | e1000_set_msglevel(struct net_device *netdev, u32 data) | ||
369 | { | 350 | { |
370 | struct e1000_adapter *adapter = netdev_priv(netdev); | 351 | struct e1000_adapter *adapter = netdev_priv(netdev); |
371 | adapter->msg_enable = data; | 352 | adapter->msg_enable = data; |
372 | } | 353 | } |
373 | 354 | ||
374 | static int | 355 | static int e1000_get_regs_len(struct net_device *netdev) |
375 | e1000_get_regs_len(struct net_device *netdev) | ||
376 | { | 356 | { |
377 | #define E1000_REGS_LEN 32 | 357 | #define E1000_REGS_LEN 32 |
378 | return E1000_REGS_LEN * sizeof(u32); | 358 | return E1000_REGS_LEN * sizeof(u32); |
379 | } | 359 | } |
380 | 360 | ||
381 | static void | 361 | static void e1000_get_regs(struct net_device *netdev, struct ethtool_regs *regs, |
382 | e1000_get_regs(struct net_device *netdev, | 362 | void *p) |
383 | struct ethtool_regs *regs, void *p) | ||
384 | { | 363 | { |
385 | struct e1000_adapter *adapter = netdev_priv(netdev); | 364 | struct e1000_adapter *adapter = netdev_priv(netdev); |
386 | struct e1000_hw *hw = &adapter->hw; | 365 | struct e1000_hw *hw = &adapter->hw; |
@@ -391,22 +370,22 @@ e1000_get_regs(struct net_device *netdev, | |||
391 | 370 | ||
392 | regs->version = (1 << 24) | (hw->revision_id << 16) | hw->device_id; | 371 | regs->version = (1 << 24) | (hw->revision_id << 16) | hw->device_id; |
393 | 372 | ||
394 | regs_buff[0] = E1000_READ_REG(hw, CTRL); | 373 | regs_buff[0] = er32(CTRL); |
395 | regs_buff[1] = E1000_READ_REG(hw, STATUS); | 374 | regs_buff[1] = er32(STATUS); |
396 | 375 | ||
397 | regs_buff[2] = E1000_READ_REG(hw, RCTL); | 376 | regs_buff[2] = er32(RCTL); |
398 | regs_buff[3] = E1000_READ_REG(hw, RDLEN); | 377 | regs_buff[3] = er32(RDLEN); |
399 | regs_buff[4] = E1000_READ_REG(hw, RDH); | 378 | regs_buff[4] = er32(RDH); |
400 | regs_buff[5] = E1000_READ_REG(hw, RDT); | 379 | regs_buff[5] = er32(RDT); |
401 | regs_buff[6] = E1000_READ_REG(hw, RDTR); | 380 | regs_buff[6] = er32(RDTR); |
402 | 381 | ||
403 | regs_buff[7] = E1000_READ_REG(hw, TCTL); | 382 | regs_buff[7] = er32(TCTL); |
404 | regs_buff[8] = E1000_READ_REG(hw, TDLEN); | 383 | regs_buff[8] = er32(TDLEN); |
405 | regs_buff[9] = E1000_READ_REG(hw, TDH); | 384 | regs_buff[9] = er32(TDH); |
406 | regs_buff[10] = E1000_READ_REG(hw, TDT); | 385 | regs_buff[10] = er32(TDT); |
407 | regs_buff[11] = E1000_READ_REG(hw, TIDV); | 386 | regs_buff[11] = er32(TIDV); |
408 | 387 | ||
409 | regs_buff[12] = adapter->hw.phy_type; /* PHY type (IGP=1, M88=0) */ | 388 | regs_buff[12] = hw->phy_type; /* PHY type (IGP=1, M88=0) */ |
410 | if (hw->phy_type == e1000_phy_igp) { | 389 | if (hw->phy_type == e1000_phy_igp) { |
411 | e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, | 390 | e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, |
412 | IGP01E1000_PHY_AGC_A); | 391 | IGP01E1000_PHY_AGC_A); |
@@ -464,20 +443,20 @@ e1000_get_regs(struct net_device *netdev, | |||
464 | if (hw->mac_type >= e1000_82540 && | 443 | if (hw->mac_type >= e1000_82540 && |
465 | hw->mac_type < e1000_82571 && | 444 | hw->mac_type < e1000_82571 && |
466 | hw->media_type == e1000_media_type_copper) { | 445 | hw->media_type == e1000_media_type_copper) { |
467 | regs_buff[26] = E1000_READ_REG(hw, MANC); | 446 | regs_buff[26] = er32(MANC); |
468 | } | 447 | } |
469 | } | 448 | } |
470 | 449 | ||
471 | static int | 450 | static int e1000_get_eeprom_len(struct net_device *netdev) |
472 | e1000_get_eeprom_len(struct net_device *netdev) | ||
473 | { | 451 | { |
474 | struct e1000_adapter *adapter = netdev_priv(netdev); | 452 | struct e1000_adapter *adapter = netdev_priv(netdev); |
475 | return adapter->hw.eeprom.word_size * 2; | 453 | struct e1000_hw *hw = &adapter->hw; |
454 | |||
455 | return hw->eeprom.word_size * 2; | ||
476 | } | 456 | } |
477 | 457 | ||
478 | static int | 458 | static int e1000_get_eeprom(struct net_device *netdev, |
479 | e1000_get_eeprom(struct net_device *netdev, | 459 | struct ethtool_eeprom *eeprom, u8 *bytes) |
480 | struct ethtool_eeprom *eeprom, u8 *bytes) | ||
481 | { | 460 | { |
482 | struct e1000_adapter *adapter = netdev_priv(netdev); | 461 | struct e1000_adapter *adapter = netdev_priv(netdev); |
483 | struct e1000_hw *hw = &adapter->hw; | 462 | struct e1000_hw *hw = &adapter->hw; |
@@ -504,10 +483,12 @@ e1000_get_eeprom(struct net_device *netdev, | |||
504 | last_word - first_word + 1, | 483 | last_word - first_word + 1, |
505 | eeprom_buff); | 484 | eeprom_buff); |
506 | else { | 485 | else { |
507 | for (i = 0; i < last_word - first_word + 1; i++) | 486 | for (i = 0; i < last_word - first_word + 1; i++) { |
508 | if ((ret_val = e1000_read_eeprom(hw, first_word + i, 1, | 487 | ret_val = e1000_read_eeprom(hw, first_word + i, 1, |
509 | &eeprom_buff[i]))) | 488 | &eeprom_buff[i]); |
489 | if (ret_val) | ||
510 | break; | 490 | break; |
491 | } | ||
511 | } | 492 | } |
512 | 493 | ||
513 | /* Device's eeprom is always little-endian, word addressable */ | 494 | /* Device's eeprom is always little-endian, word addressable */ |
@@ -521,9 +502,8 @@ e1000_get_eeprom(struct net_device *netdev, | |||
521 | return ret_val; | 502 | return ret_val; |
522 | } | 503 | } |
523 | 504 | ||
524 | static int | 505 | static int e1000_set_eeprom(struct net_device *netdev, |
525 | e1000_set_eeprom(struct net_device *netdev, | 506 | struct ethtool_eeprom *eeprom, u8 *bytes) |
526 | struct ethtool_eeprom *eeprom, u8 *bytes) | ||
527 | { | 507 | { |
528 | struct e1000_adapter *adapter = netdev_priv(netdev); | 508 | struct e1000_adapter *adapter = netdev_priv(netdev); |
529 | struct e1000_hw *hw = &adapter->hw; | 509 | struct e1000_hw *hw = &adapter->hw; |
@@ -584,11 +564,11 @@ e1000_set_eeprom(struct net_device *netdev, | |||
584 | return ret_val; | 564 | return ret_val; |
585 | } | 565 | } |
586 | 566 | ||
587 | static void | 567 | static void e1000_get_drvinfo(struct net_device *netdev, |
588 | e1000_get_drvinfo(struct net_device *netdev, | 568 | struct ethtool_drvinfo *drvinfo) |
589 | struct ethtool_drvinfo *drvinfo) | ||
590 | { | 569 | { |
591 | struct e1000_adapter *adapter = netdev_priv(netdev); | 570 | struct e1000_adapter *adapter = netdev_priv(netdev); |
571 | struct e1000_hw *hw = &adapter->hw; | ||
592 | char firmware_version[32]; | 572 | char firmware_version[32]; |
593 | u16 eeprom_data; | 573 | u16 eeprom_data; |
594 | 574 | ||
@@ -597,8 +577,8 @@ e1000_get_drvinfo(struct net_device *netdev, | |||
597 | 577 | ||
598 | /* EEPROM image version # is reported as firmware version # for | 578 | /* EEPROM image version # is reported as firmware version # for |
599 | * 8257{1|2|3} controllers */ | 579 | * 8257{1|2|3} controllers */ |
600 | e1000_read_eeprom(&adapter->hw, 5, 1, &eeprom_data); | 580 | e1000_read_eeprom(hw, 5, 1, &eeprom_data); |
601 | switch (adapter->hw.mac_type) { | 581 | switch (hw->mac_type) { |
602 | case e1000_82571: | 582 | case e1000_82571: |
603 | case e1000_82572: | 583 | case e1000_82572: |
604 | case e1000_82573: | 584 | case e1000_82573: |
@@ -619,12 +599,12 @@ e1000_get_drvinfo(struct net_device *netdev, | |||
619 | drvinfo->eedump_len = e1000_get_eeprom_len(netdev); | 599 | drvinfo->eedump_len = e1000_get_eeprom_len(netdev); |
620 | } | 600 | } |
621 | 601 | ||
622 | static void | 602 | static void e1000_get_ringparam(struct net_device *netdev, |
623 | e1000_get_ringparam(struct net_device *netdev, | 603 | struct ethtool_ringparam *ring) |
624 | struct ethtool_ringparam *ring) | ||
625 | { | 604 | { |
626 | struct e1000_adapter *adapter = netdev_priv(netdev); | 605 | struct e1000_adapter *adapter = netdev_priv(netdev); |
627 | e1000_mac_type mac_type = adapter->hw.mac_type; | 606 | struct e1000_hw *hw = &adapter->hw; |
607 | e1000_mac_type mac_type = hw->mac_type; | ||
628 | struct e1000_tx_ring *txdr = adapter->tx_ring; | 608 | struct e1000_tx_ring *txdr = adapter->tx_ring; |
629 | struct e1000_rx_ring *rxdr = adapter->rx_ring; | 609 | struct e1000_rx_ring *rxdr = adapter->rx_ring; |
630 | 610 | ||
@@ -640,12 +620,12 @@ e1000_get_ringparam(struct net_device *netdev, | |||
640 | ring->rx_jumbo_pending = 0; | 620 | ring->rx_jumbo_pending = 0; |
641 | } | 621 | } |
642 | 622 | ||
643 | static int | 623 | static int e1000_set_ringparam(struct net_device *netdev, |
644 | e1000_set_ringparam(struct net_device *netdev, | 624 | struct ethtool_ringparam *ring) |
645 | struct ethtool_ringparam *ring) | ||
646 | { | 625 | { |
647 | struct e1000_adapter *adapter = netdev_priv(netdev); | 626 | struct e1000_adapter *adapter = netdev_priv(netdev); |
648 | e1000_mac_type mac_type = adapter->hw.mac_type; | 627 | struct e1000_hw *hw = &adapter->hw; |
628 | e1000_mac_type mac_type = hw->mac_type; | ||
649 | struct e1000_tx_ring *txdr, *tx_old; | 629 | struct e1000_tx_ring *txdr, *tx_old; |
650 | struct e1000_rx_ring *rxdr, *rx_old; | 630 | struct e1000_rx_ring *rxdr, *rx_old; |
651 | int i, err; | 631 | int i, err; |
@@ -691,9 +671,11 @@ e1000_set_ringparam(struct net_device *netdev, | |||
691 | 671 | ||
692 | if (netif_running(adapter->netdev)) { | 672 | if (netif_running(adapter->netdev)) { |
693 | /* Try to get new resources before deleting old */ | 673 | /* Try to get new resources before deleting old */ |
694 | if ((err = e1000_setup_all_rx_resources(adapter))) | 674 | err = e1000_setup_all_rx_resources(adapter); |
675 | if (err) | ||
695 | goto err_setup_rx; | 676 | goto err_setup_rx; |
696 | if ((err = e1000_setup_all_tx_resources(adapter))) | 677 | err = e1000_setup_all_tx_resources(adapter); |
678 | if (err) | ||
697 | goto err_setup_tx; | 679 | goto err_setup_tx; |
698 | 680 | ||
699 | /* save the new, restore the old in order to free it, | 681 | /* save the new, restore the old in order to free it, |
@@ -707,7 +689,8 @@ e1000_set_ringparam(struct net_device *netdev, | |||
707 | kfree(rx_old); | 689 | kfree(rx_old); |
708 | adapter->rx_ring = rxdr; | 690 | adapter->rx_ring = rxdr; |
709 | adapter->tx_ring = txdr; | 691 | adapter->tx_ring = txdr; |
710 | if ((err = e1000_up(adapter))) | 692 | err = e1000_up(adapter); |
693 | if (err) | ||
711 | goto err_setup; | 694 | goto err_setup; |
712 | } | 695 | } |
713 | 696 | ||
@@ -728,12 +711,13 @@ err_setup: | |||
728 | return err; | 711 | return err; |
729 | } | 712 | } |
730 | 713 | ||
731 | static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data, | 714 | static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data, int reg, |
732 | int reg, u32 mask, u32 write) | 715 | u32 mask, u32 write) |
733 | { | 716 | { |
717 | struct e1000_hw *hw = &adapter->hw; | ||
734 | static const u32 test[] = | 718 | static const u32 test[] = |
735 | {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; | 719 | {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; |
736 | u8 __iomem *address = adapter->hw.hw_addr + reg; | 720 | u8 __iomem *address = hw->hw_addr + reg; |
737 | u32 read; | 721 | u32 read; |
738 | int i; | 722 | int i; |
739 | 723 | ||
@@ -751,10 +735,11 @@ static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data, | |||
751 | return false; | 735 | return false; |
752 | } | 736 | } |
753 | 737 | ||
754 | static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data, | 738 | static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data, int reg, |
755 | int reg, u32 mask, u32 write) | 739 | u32 mask, u32 write) |
756 | { | 740 | { |
757 | u8 __iomem *address = adapter->hw.hw_addr + reg; | 741 | struct e1000_hw *hw = &adapter->hw; |
742 | u8 __iomem *address = hw->hw_addr + reg; | ||
758 | u32 read; | 743 | u32 read; |
759 | 744 | ||
760 | writel(write & mask, address); | 745 | writel(write & mask, address); |
@@ -772,7 +757,7 @@ static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data, | |||
772 | #define REG_PATTERN_TEST(reg, mask, write) \ | 757 | #define REG_PATTERN_TEST(reg, mask, write) \ |
773 | do { \ | 758 | do { \ |
774 | if (reg_pattern_test(adapter, data, \ | 759 | if (reg_pattern_test(adapter, data, \ |
775 | (adapter->hw.mac_type >= e1000_82543) \ | 760 | (hw->mac_type >= e1000_82543) \ |
776 | ? E1000_##reg : E1000_82542_##reg, \ | 761 | ? E1000_##reg : E1000_82542_##reg, \ |
777 | mask, write)) \ | 762 | mask, write)) \ |
778 | return 1; \ | 763 | return 1; \ |
@@ -781,22 +766,22 @@ static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data, | |||
781 | #define REG_SET_AND_CHECK(reg, mask, write) \ | 766 | #define REG_SET_AND_CHECK(reg, mask, write) \ |
782 | do { \ | 767 | do { \ |
783 | if (reg_set_and_check(adapter, data, \ | 768 | if (reg_set_and_check(adapter, data, \ |
784 | (adapter->hw.mac_type >= e1000_82543) \ | 769 | (hw->mac_type >= e1000_82543) \ |
785 | ? E1000_##reg : E1000_82542_##reg, \ | 770 | ? E1000_##reg : E1000_82542_##reg, \ |
786 | mask, write)) \ | 771 | mask, write)) \ |
787 | return 1; \ | 772 | return 1; \ |
788 | } while (0) | 773 | } while (0) |
789 | 774 | ||
790 | static int | 775 | static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data) |
791 | e1000_reg_test(struct e1000_adapter *adapter, u64 *data) | ||
792 | { | 776 | { |
793 | u32 value, before, after; | 777 | u32 value, before, after; |
794 | u32 i, toggle; | 778 | u32 i, toggle; |
779 | struct e1000_hw *hw = &adapter->hw; | ||
795 | 780 | ||
796 | /* The status register is Read Only, so a write should fail. | 781 | /* The status register is Read Only, so a write should fail. |
797 | * Some bits that get toggled are ignored. | 782 | * Some bits that get toggled are ignored. |
798 | */ | 783 | */ |
799 | switch (adapter->hw.mac_type) { | 784 | switch (hw->mac_type) { |
800 | /* there are several bits on newer hardware that are r/w */ | 785 | /* there are several bits on newer hardware that are r/w */ |
801 | case e1000_82571: | 786 | case e1000_82571: |
802 | case e1000_82572: | 787 | case e1000_82572: |
@@ -812,10 +797,10 @@ e1000_reg_test(struct e1000_adapter *adapter, u64 *data) | |||
812 | break; | 797 | break; |
813 | } | 798 | } |
814 | 799 | ||
815 | before = E1000_READ_REG(&adapter->hw, STATUS); | 800 | before = er32(STATUS); |
816 | value = (E1000_READ_REG(&adapter->hw, STATUS) & toggle); | 801 | value = (er32(STATUS) & toggle); |
817 | E1000_WRITE_REG(&adapter->hw, STATUS, toggle); | 802 | ew32(STATUS, toggle); |
818 | after = E1000_READ_REG(&adapter->hw, STATUS) & toggle; | 803 | after = er32(STATUS) & toggle; |
819 | if (value != after) { | 804 | if (value != after) { |
820 | DPRINTK(DRV, ERR, "failed STATUS register test got: " | 805 | DPRINTK(DRV, ERR, "failed STATUS register test got: " |
821 | "0x%08X expected: 0x%08X\n", after, value); | 806 | "0x%08X expected: 0x%08X\n", after, value); |
@@ -823,9 +808,9 @@ e1000_reg_test(struct e1000_adapter *adapter, u64 *data) | |||
823 | return 1; | 808 | return 1; |
824 | } | 809 | } |
825 | /* restore previous status */ | 810 | /* restore previous status */ |
826 | E1000_WRITE_REG(&adapter->hw, STATUS, before); | 811 | ew32(STATUS, before); |
827 | 812 | ||
828 | if (adapter->hw.mac_type != e1000_ich8lan) { | 813 | if (hw->mac_type != e1000_ich8lan) { |
829 | REG_PATTERN_TEST(FCAL, 0xFFFFFFFF, 0xFFFFFFFF); | 814 | REG_PATTERN_TEST(FCAL, 0xFFFFFFFF, 0xFFFFFFFF); |
830 | REG_PATTERN_TEST(FCAH, 0x0000FFFF, 0xFFFFFFFF); | 815 | REG_PATTERN_TEST(FCAH, 0x0000FFFF, 0xFFFFFFFF); |
831 | REG_PATTERN_TEST(FCT, 0x0000FFFF, 0xFFFFFFFF); | 816 | REG_PATTERN_TEST(FCT, 0x0000FFFF, 0xFFFFFFFF); |
@@ -845,20 +830,20 @@ e1000_reg_test(struct e1000_adapter *adapter, u64 *data) | |||
845 | 830 | ||
846 | REG_SET_AND_CHECK(RCTL, 0xFFFFFFFF, 0x00000000); | 831 | REG_SET_AND_CHECK(RCTL, 0xFFFFFFFF, 0x00000000); |
847 | 832 | ||
848 | before = (adapter->hw.mac_type == e1000_ich8lan ? | 833 | before = (hw->mac_type == e1000_ich8lan ? |
849 | 0x06C3B33E : 0x06DFB3FE); | 834 | 0x06C3B33E : 0x06DFB3FE); |
850 | REG_SET_AND_CHECK(RCTL, before, 0x003FFFFB); | 835 | REG_SET_AND_CHECK(RCTL, before, 0x003FFFFB); |
851 | REG_SET_AND_CHECK(TCTL, 0xFFFFFFFF, 0x00000000); | 836 | REG_SET_AND_CHECK(TCTL, 0xFFFFFFFF, 0x00000000); |
852 | 837 | ||
853 | if (adapter->hw.mac_type >= e1000_82543) { | 838 | if (hw->mac_type >= e1000_82543) { |
854 | 839 | ||
855 | REG_SET_AND_CHECK(RCTL, before, 0xFFFFFFFF); | 840 | REG_SET_AND_CHECK(RCTL, before, 0xFFFFFFFF); |
856 | REG_PATTERN_TEST(RDBAL, 0xFFFFFFF0, 0xFFFFFFFF); | 841 | REG_PATTERN_TEST(RDBAL, 0xFFFFFFF0, 0xFFFFFFFF); |
857 | if (adapter->hw.mac_type != e1000_ich8lan) | 842 | if (hw->mac_type != e1000_ich8lan) |
858 | REG_PATTERN_TEST(TXCW, 0xC000FFFF, 0x0000FFFF); | 843 | REG_PATTERN_TEST(TXCW, 0xC000FFFF, 0x0000FFFF); |
859 | REG_PATTERN_TEST(TDBAL, 0xFFFFFFF0, 0xFFFFFFFF); | 844 | REG_PATTERN_TEST(TDBAL, 0xFFFFFFF0, 0xFFFFFFFF); |
860 | REG_PATTERN_TEST(TIDV, 0x0000FFFF, 0x0000FFFF); | 845 | REG_PATTERN_TEST(TIDV, 0x0000FFFF, 0x0000FFFF); |
861 | value = (adapter->hw.mac_type == e1000_ich8lan ? | 846 | value = (hw->mac_type == e1000_ich8lan ? |
862 | E1000_RAR_ENTRIES_ICH8LAN : E1000_RAR_ENTRIES); | 847 | E1000_RAR_ENTRIES_ICH8LAN : E1000_RAR_ENTRIES); |
863 | for (i = 0; i < value; i++) { | 848 | for (i = 0; i < value; i++) { |
864 | REG_PATTERN_TEST(RA + (((i << 1) + 1) << 2), 0x8003FFFF, | 849 | REG_PATTERN_TEST(RA + (((i << 1) + 1) << 2), 0x8003FFFF, |
@@ -874,7 +859,7 @@ e1000_reg_test(struct e1000_adapter *adapter, u64 *data) | |||
874 | 859 | ||
875 | } | 860 | } |
876 | 861 | ||
877 | value = (adapter->hw.mac_type == e1000_ich8lan ? | 862 | value = (hw->mac_type == e1000_ich8lan ? |
878 | E1000_MC_TBL_SIZE_ICH8LAN : E1000_MC_TBL_SIZE); | 863 | E1000_MC_TBL_SIZE_ICH8LAN : E1000_MC_TBL_SIZE); |
879 | for (i = 0; i < value; i++) | 864 | for (i = 0; i < value; i++) |
880 | REG_PATTERN_TEST(MTA + (i << 2), 0xFFFFFFFF, 0xFFFFFFFF); | 865 | REG_PATTERN_TEST(MTA + (i << 2), 0xFFFFFFFF, 0xFFFFFFFF); |
@@ -883,9 +868,9 @@ e1000_reg_test(struct e1000_adapter *adapter, u64 *data) | |||
883 | return 0; | 868 | return 0; |
884 | } | 869 | } |
885 | 870 | ||
886 | static int | 871 | static int e1000_eeprom_test(struct e1000_adapter *adapter, u64 *data) |
887 | e1000_eeprom_test(struct e1000_adapter *adapter, u64 *data) | ||
888 | { | 872 | { |
873 | struct e1000_hw *hw = &adapter->hw; | ||
889 | u16 temp; | 874 | u16 temp; |
890 | u16 checksum = 0; | 875 | u16 checksum = 0; |
891 | u16 i; | 876 | u16 i; |
@@ -893,7 +878,7 @@ e1000_eeprom_test(struct e1000_adapter *adapter, u64 *data) | |||
893 | *data = 0; | 878 | *data = 0; |
894 | /* Read and add up the contents of the EEPROM */ | 879 | /* Read and add up the contents of the EEPROM */ |
895 | for (i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { | 880 | for (i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { |
896 | if ((e1000_read_eeprom(&adapter->hw, i, 1, &temp)) < 0) { | 881 | if ((e1000_read_eeprom(hw, i, 1, &temp)) < 0) { |
897 | *data = 1; | 882 | *data = 1; |
898 | break; | 883 | break; |
899 | } | 884 | } |
@@ -901,30 +886,30 @@ e1000_eeprom_test(struct e1000_adapter *adapter, u64 *data) | |||
901 | } | 886 | } |
902 | 887 | ||
903 | /* If Checksum is not Correct return error else test passed */ | 888 | /* If Checksum is not Correct return error else test passed */ |
904 | if ((checksum != (u16) EEPROM_SUM) && !(*data)) | 889 | if ((checksum != (u16)EEPROM_SUM) && !(*data)) |
905 | *data = 2; | 890 | *data = 2; |
906 | 891 | ||
907 | return *data; | 892 | return *data; |
908 | } | 893 | } |
909 | 894 | ||
910 | static irqreturn_t | 895 | static irqreturn_t e1000_test_intr(int irq, void *data) |
911 | e1000_test_intr(int irq, void *data) | ||
912 | { | 896 | { |
913 | struct net_device *netdev = (struct net_device *) data; | 897 | struct net_device *netdev = (struct net_device *)data; |
914 | struct e1000_adapter *adapter = netdev_priv(netdev); | 898 | struct e1000_adapter *adapter = netdev_priv(netdev); |
899 | struct e1000_hw *hw = &adapter->hw; | ||
915 | 900 | ||
916 | adapter->test_icr |= E1000_READ_REG(&adapter->hw, ICR); | 901 | adapter->test_icr |= er32(ICR); |
917 | 902 | ||
918 | return IRQ_HANDLED; | 903 | return IRQ_HANDLED; |
919 | } | 904 | } |
920 | 905 | ||
921 | static int | 906 | static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data) |
922 | e1000_intr_test(struct e1000_adapter *adapter, u64 *data) | ||
923 | { | 907 | { |
924 | struct net_device *netdev = adapter->netdev; | 908 | struct net_device *netdev = adapter->netdev; |
925 | u32 mask, i = 0; | 909 | u32 mask, i = 0; |
926 | bool shared_int = true; | 910 | bool shared_int = true; |
927 | u32 irq = adapter->pdev->irq; | 911 | u32 irq = adapter->pdev->irq; |
912 | struct e1000_hw *hw = &adapter->hw; | ||
928 | 913 | ||
929 | *data = 0; | 914 | *data = 0; |
930 | 915 | ||
@@ -942,13 +927,13 @@ e1000_intr_test(struct e1000_adapter *adapter, u64 *data) | |||
942 | (shared_int ? "shared" : "unshared")); | 927 | (shared_int ? "shared" : "unshared")); |
943 | 928 | ||
944 | /* Disable all the interrupts */ | 929 | /* Disable all the interrupts */ |
945 | E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF); | 930 | ew32(IMC, 0xFFFFFFFF); |
946 | msleep(10); | 931 | msleep(10); |
947 | 932 | ||
948 | /* Test each interrupt */ | 933 | /* Test each interrupt */ |
949 | for (; i < 10; i++) { | 934 | for (; i < 10; i++) { |
950 | 935 | ||
951 | if (adapter->hw.mac_type == e1000_ich8lan && i == 8) | 936 | if (hw->mac_type == e1000_ich8lan && i == 8) |
952 | continue; | 937 | continue; |
953 | 938 | ||
954 | /* Interrupt to test */ | 939 | /* Interrupt to test */ |
@@ -962,8 +947,8 @@ e1000_intr_test(struct e1000_adapter *adapter, u64 *data) | |||
962 | * test failed. | 947 | * test failed. |
963 | */ | 948 | */ |
964 | adapter->test_icr = 0; | 949 | adapter->test_icr = 0; |
965 | E1000_WRITE_REG(&adapter->hw, IMC, mask); | 950 | ew32(IMC, mask); |
966 | E1000_WRITE_REG(&adapter->hw, ICS, mask); | 951 | ew32(ICS, mask); |
967 | msleep(10); | 952 | msleep(10); |
968 | 953 | ||
969 | if (adapter->test_icr & mask) { | 954 | if (adapter->test_icr & mask) { |
@@ -979,8 +964,8 @@ e1000_intr_test(struct e1000_adapter *adapter, u64 *data) | |||
979 | * test failed. | 964 | * test failed. |
980 | */ | 965 | */ |
981 | adapter->test_icr = 0; | 966 | adapter->test_icr = 0; |
982 | E1000_WRITE_REG(&adapter->hw, IMS, mask); | 967 | ew32(IMS, mask); |
983 | E1000_WRITE_REG(&adapter->hw, ICS, mask); | 968 | ew32(ICS, mask); |
984 | msleep(10); | 969 | msleep(10); |
985 | 970 | ||
986 | if (!(adapter->test_icr & mask)) { | 971 | if (!(adapter->test_icr & mask)) { |
@@ -996,8 +981,8 @@ e1000_intr_test(struct e1000_adapter *adapter, u64 *data) | |||
996 | * test failed. | 981 | * test failed. |
997 | */ | 982 | */ |
998 | adapter->test_icr = 0; | 983 | adapter->test_icr = 0; |
999 | E1000_WRITE_REG(&adapter->hw, IMC, ~mask & 0x00007FFF); | 984 | ew32(IMC, ~mask & 0x00007FFF); |
1000 | E1000_WRITE_REG(&adapter->hw, ICS, ~mask & 0x00007FFF); | 985 | ew32(ICS, ~mask & 0x00007FFF); |
1001 | msleep(10); | 986 | msleep(10); |
1002 | 987 | ||
1003 | if (adapter->test_icr) { | 988 | if (adapter->test_icr) { |
@@ -1008,7 +993,7 @@ e1000_intr_test(struct e1000_adapter *adapter, u64 *data) | |||
1008 | } | 993 | } |
1009 | 994 | ||
1010 | /* Disable all the interrupts */ | 995 | /* Disable all the interrupts */ |
1011 | E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF); | 996 | ew32(IMC, 0xFFFFFFFF); |
1012 | msleep(10); | 997 | msleep(10); |
1013 | 998 | ||
1014 | /* Unhook test interrupt handler */ | 999 | /* Unhook test interrupt handler */ |
@@ -1017,8 +1002,7 @@ e1000_intr_test(struct e1000_adapter *adapter, u64 *data) | |||
1017 | return *data; | 1002 | return *data; |
1018 | } | 1003 | } |
1019 | 1004 | ||
1020 | static void | 1005 | static void e1000_free_desc_rings(struct e1000_adapter *adapter) |
1021 | e1000_free_desc_rings(struct e1000_adapter *adapter) | ||
1022 | { | 1006 | { |
1023 | struct e1000_tx_ring *txdr = &adapter->test_tx_ring; | 1007 | struct e1000_tx_ring *txdr = &adapter->test_tx_ring; |
1024 | struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; | 1008 | struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; |
@@ -1064,9 +1048,9 @@ e1000_free_desc_rings(struct e1000_adapter *adapter) | |||
1064 | return; | 1048 | return; |
1065 | } | 1049 | } |
1066 | 1050 | ||
1067 | static int | 1051 | static int e1000_setup_desc_rings(struct e1000_adapter *adapter) |
1068 | e1000_setup_desc_rings(struct e1000_adapter *adapter) | ||
1069 | { | 1052 | { |
1053 | struct e1000_hw *hw = &adapter->hw; | ||
1070 | struct e1000_tx_ring *txdr = &adapter->test_tx_ring; | 1054 | struct e1000_tx_ring *txdr = &adapter->test_tx_ring; |
1071 | struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; | 1055 | struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; |
1072 | struct pci_dev *pdev = adapter->pdev; | 1056 | struct pci_dev *pdev = adapter->pdev; |
@@ -1078,41 +1062,39 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1078 | if (!txdr->count) | 1062 | if (!txdr->count) |
1079 | txdr->count = E1000_DEFAULT_TXD; | 1063 | txdr->count = E1000_DEFAULT_TXD; |
1080 | 1064 | ||
1081 | if (!(txdr->buffer_info = kcalloc(txdr->count, | 1065 | txdr->buffer_info = kcalloc(txdr->count, sizeof(struct e1000_buffer), |
1082 | sizeof(struct e1000_buffer), | 1066 | GFP_KERNEL); |
1083 | GFP_KERNEL))) { | 1067 | if (!txdr->buffer_info) { |
1084 | ret_val = 1; | 1068 | ret_val = 1; |
1085 | goto err_nomem; | 1069 | goto err_nomem; |
1086 | } | 1070 | } |
1087 | 1071 | ||
1088 | txdr->size = txdr->count * sizeof(struct e1000_tx_desc); | 1072 | txdr->size = txdr->count * sizeof(struct e1000_tx_desc); |
1089 | txdr->size = ALIGN(txdr->size, 4096); | 1073 | txdr->size = ALIGN(txdr->size, 4096); |
1090 | if (!(txdr->desc = pci_alloc_consistent(pdev, txdr->size, | 1074 | txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); |
1091 | &txdr->dma))) { | 1075 | if (!txdr->desc) { |
1092 | ret_val = 2; | 1076 | ret_val = 2; |
1093 | goto err_nomem; | 1077 | goto err_nomem; |
1094 | } | 1078 | } |
1095 | memset(txdr->desc, 0, txdr->size); | 1079 | memset(txdr->desc, 0, txdr->size); |
1096 | txdr->next_to_use = txdr->next_to_clean = 0; | 1080 | txdr->next_to_use = txdr->next_to_clean = 0; |
1097 | 1081 | ||
1098 | E1000_WRITE_REG(&adapter->hw, TDBAL, | 1082 | ew32(TDBAL, ((u64)txdr->dma & 0x00000000FFFFFFFF)); |
1099 | ((u64) txdr->dma & 0x00000000FFFFFFFF)); | 1083 | ew32(TDBAH, ((u64)txdr->dma >> 32)); |
1100 | E1000_WRITE_REG(&adapter->hw, TDBAH, ((u64) txdr->dma >> 32)); | 1084 | ew32(TDLEN, txdr->count * sizeof(struct e1000_tx_desc)); |
1101 | E1000_WRITE_REG(&adapter->hw, TDLEN, | 1085 | ew32(TDH, 0); |
1102 | txdr->count * sizeof(struct e1000_tx_desc)); | 1086 | ew32(TDT, 0); |
1103 | E1000_WRITE_REG(&adapter->hw, TDH, 0); | 1087 | ew32(TCTL, E1000_TCTL_PSP | E1000_TCTL_EN | |
1104 | E1000_WRITE_REG(&adapter->hw, TDT, 0); | 1088 | E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT | |
1105 | E1000_WRITE_REG(&adapter->hw, TCTL, | 1089 | E1000_FDX_COLLISION_DISTANCE << E1000_COLD_SHIFT); |
1106 | E1000_TCTL_PSP | E1000_TCTL_EN | | ||
1107 | E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT | | ||
1108 | E1000_FDX_COLLISION_DISTANCE << E1000_COLD_SHIFT); | ||
1109 | 1090 | ||
1110 | for (i = 0; i < txdr->count; i++) { | 1091 | for (i = 0; i < txdr->count; i++) { |
1111 | struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*txdr, i); | 1092 | struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*txdr, i); |
1112 | struct sk_buff *skb; | 1093 | struct sk_buff *skb; |
1113 | unsigned int size = 1024; | 1094 | unsigned int size = 1024; |
1114 | 1095 | ||
1115 | if (!(skb = alloc_skb(size, GFP_KERNEL))) { | 1096 | skb = alloc_skb(size, GFP_KERNEL); |
1097 | if (!skb) { | ||
1116 | ret_val = 3; | 1098 | ret_val = 3; |
1117 | goto err_nomem; | 1099 | goto err_nomem; |
1118 | } | 1100 | } |
@@ -1135,40 +1117,40 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1135 | if (!rxdr->count) | 1117 | if (!rxdr->count) |
1136 | rxdr->count = E1000_DEFAULT_RXD; | 1118 | rxdr->count = E1000_DEFAULT_RXD; |
1137 | 1119 | ||
1138 | if (!(rxdr->buffer_info = kcalloc(rxdr->count, | 1120 | rxdr->buffer_info = kcalloc(rxdr->count, sizeof(struct e1000_buffer), |
1139 | sizeof(struct e1000_buffer), | 1121 | GFP_KERNEL); |
1140 | GFP_KERNEL))) { | 1122 | if (!rxdr->buffer_info) { |
1141 | ret_val = 4; | 1123 | ret_val = 4; |
1142 | goto err_nomem; | 1124 | goto err_nomem; |
1143 | } | 1125 | } |
1144 | 1126 | ||
1145 | rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); | 1127 | rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); |
1146 | if (!(rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma))) { | 1128 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); |
1129 | if (!rxdr->desc) { | ||
1147 | ret_val = 5; | 1130 | ret_val = 5; |
1148 | goto err_nomem; | 1131 | goto err_nomem; |
1149 | } | 1132 | } |
1150 | memset(rxdr->desc, 0, rxdr->size); | 1133 | memset(rxdr->desc, 0, rxdr->size); |
1151 | rxdr->next_to_use = rxdr->next_to_clean = 0; | 1134 | rxdr->next_to_use = rxdr->next_to_clean = 0; |
1152 | 1135 | ||
1153 | rctl = E1000_READ_REG(&adapter->hw, RCTL); | 1136 | rctl = er32(RCTL); |
1154 | E1000_WRITE_REG(&adapter->hw, RCTL, rctl & ~E1000_RCTL_EN); | 1137 | ew32(RCTL, rctl & ~E1000_RCTL_EN); |
1155 | E1000_WRITE_REG(&adapter->hw, RDBAL, | 1138 | ew32(RDBAL, ((u64)rxdr->dma & 0xFFFFFFFF)); |
1156 | ((u64) rxdr->dma & 0xFFFFFFFF)); | 1139 | ew32(RDBAH, ((u64)rxdr->dma >> 32)); |
1157 | E1000_WRITE_REG(&adapter->hw, RDBAH, ((u64) rxdr->dma >> 32)); | 1140 | ew32(RDLEN, rxdr->size); |
1158 | E1000_WRITE_REG(&adapter->hw, RDLEN, rxdr->size); | 1141 | ew32(RDH, 0); |
1159 | E1000_WRITE_REG(&adapter->hw, RDH, 0); | 1142 | ew32(RDT, 0); |
1160 | E1000_WRITE_REG(&adapter->hw, RDT, 0); | ||
1161 | rctl = E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_SZ_2048 | | 1143 | rctl = E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_SZ_2048 | |
1162 | E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF | | 1144 | E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF | |
1163 | (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT); | 1145 | (hw->mc_filter_type << E1000_RCTL_MO_SHIFT); |
1164 | E1000_WRITE_REG(&adapter->hw, RCTL, rctl); | 1146 | ew32(RCTL, rctl); |
1165 | 1147 | ||
1166 | for (i = 0; i < rxdr->count; i++) { | 1148 | for (i = 0; i < rxdr->count; i++) { |
1167 | struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i); | 1149 | struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i); |
1168 | struct sk_buff *skb; | 1150 | struct sk_buff *skb; |
1169 | 1151 | ||
1170 | if (!(skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, | 1152 | skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL); |
1171 | GFP_KERNEL))) { | 1153 | if (!skb) { |
1172 | ret_val = 6; | 1154 | ret_val = 6; |
1173 | goto err_nomem; | 1155 | goto err_nomem; |
1174 | } | 1156 | } |
@@ -1189,73 +1171,74 @@ err_nomem: | |||
1189 | return ret_val; | 1171 | return ret_val; |
1190 | } | 1172 | } |
1191 | 1173 | ||
1192 | static void | 1174 | static void e1000_phy_disable_receiver(struct e1000_adapter *adapter) |
1193 | e1000_phy_disable_receiver(struct e1000_adapter *adapter) | ||
1194 | { | 1175 | { |
1176 | struct e1000_hw *hw = &adapter->hw; | ||
1177 | |||
1195 | /* Write out to PHY registers 29 and 30 to disable the Receiver. */ | 1178 | /* Write out to PHY registers 29 and 30 to disable the Receiver. */ |
1196 | e1000_write_phy_reg(&adapter->hw, 29, 0x001F); | 1179 | e1000_write_phy_reg(hw, 29, 0x001F); |
1197 | e1000_write_phy_reg(&adapter->hw, 30, 0x8FFC); | 1180 | e1000_write_phy_reg(hw, 30, 0x8FFC); |
1198 | e1000_write_phy_reg(&adapter->hw, 29, 0x001A); | 1181 | e1000_write_phy_reg(hw, 29, 0x001A); |
1199 | e1000_write_phy_reg(&adapter->hw, 30, 0x8FF0); | 1182 | e1000_write_phy_reg(hw, 30, 0x8FF0); |
1200 | } | 1183 | } |
1201 | 1184 | ||
1202 | static void | 1185 | static void e1000_phy_reset_clk_and_crs(struct e1000_adapter *adapter) |
1203 | e1000_phy_reset_clk_and_crs(struct e1000_adapter *adapter) | ||
1204 | { | 1186 | { |
1187 | struct e1000_hw *hw = &adapter->hw; | ||
1205 | u16 phy_reg; | 1188 | u16 phy_reg; |
1206 | 1189 | ||
1207 | /* Because we reset the PHY above, we need to re-force TX_CLK in the | 1190 | /* Because we reset the PHY above, we need to re-force TX_CLK in the |
1208 | * Extended PHY Specific Control Register to 25MHz clock. This | 1191 | * Extended PHY Specific Control Register to 25MHz clock. This |
1209 | * value defaults back to a 2.5MHz clock when the PHY is reset. | 1192 | * value defaults back to a 2.5MHz clock when the PHY is reset. |
1210 | */ | 1193 | */ |
1211 | e1000_read_phy_reg(&adapter->hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg); | 1194 | e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg); |
1212 | phy_reg |= M88E1000_EPSCR_TX_CLK_25; | 1195 | phy_reg |= M88E1000_EPSCR_TX_CLK_25; |
1213 | e1000_write_phy_reg(&adapter->hw, | 1196 | e1000_write_phy_reg(hw, |
1214 | M88E1000_EXT_PHY_SPEC_CTRL, phy_reg); | 1197 | M88E1000_EXT_PHY_SPEC_CTRL, phy_reg); |
1215 | 1198 | ||
1216 | /* In addition, because of the s/w reset above, we need to enable | 1199 | /* In addition, because of the s/w reset above, we need to enable |
1217 | * CRS on TX. This must be set for both full and half duplex | 1200 | * CRS on TX. This must be set for both full and half duplex |
1218 | * operation. | 1201 | * operation. |
1219 | */ | 1202 | */ |
1220 | e1000_read_phy_reg(&adapter->hw, M88E1000_PHY_SPEC_CTRL, &phy_reg); | 1203 | e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_reg); |
1221 | phy_reg |= M88E1000_PSCR_ASSERT_CRS_ON_TX; | 1204 | phy_reg |= M88E1000_PSCR_ASSERT_CRS_ON_TX; |
1222 | e1000_write_phy_reg(&adapter->hw, | 1205 | e1000_write_phy_reg(hw, |
1223 | M88E1000_PHY_SPEC_CTRL, phy_reg); | 1206 | M88E1000_PHY_SPEC_CTRL, phy_reg); |
1224 | } | 1207 | } |
1225 | 1208 | ||
1226 | static int | 1209 | static int e1000_nonintegrated_phy_loopback(struct e1000_adapter *adapter) |
1227 | e1000_nonintegrated_phy_loopback(struct e1000_adapter *adapter) | ||
1228 | { | 1210 | { |
1211 | struct e1000_hw *hw = &adapter->hw; | ||
1229 | u32 ctrl_reg; | 1212 | u32 ctrl_reg; |
1230 | u16 phy_reg; | 1213 | u16 phy_reg; |
1231 | 1214 | ||
1232 | /* Setup the Device Control Register for PHY loopback test. */ | 1215 | /* Setup the Device Control Register for PHY loopback test. */ |
1233 | 1216 | ||
1234 | ctrl_reg = E1000_READ_REG(&adapter->hw, CTRL); | 1217 | ctrl_reg = er32(CTRL); |
1235 | ctrl_reg |= (E1000_CTRL_ILOS | /* Invert Loss-Of-Signal */ | 1218 | ctrl_reg |= (E1000_CTRL_ILOS | /* Invert Loss-Of-Signal */ |
1236 | E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ | 1219 | E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ |
1237 | E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ | 1220 | E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ |
1238 | E1000_CTRL_SPD_1000 | /* Force Speed to 1000 */ | 1221 | E1000_CTRL_SPD_1000 | /* Force Speed to 1000 */ |
1239 | E1000_CTRL_FD); /* Force Duplex to FULL */ | 1222 | E1000_CTRL_FD); /* Force Duplex to FULL */ |
1240 | 1223 | ||
1241 | E1000_WRITE_REG(&adapter->hw, CTRL, ctrl_reg); | 1224 | ew32(CTRL, ctrl_reg); |
1242 | 1225 | ||
1243 | /* Read the PHY Specific Control Register (0x10) */ | 1226 | /* Read the PHY Specific Control Register (0x10) */ |
1244 | e1000_read_phy_reg(&adapter->hw, M88E1000_PHY_SPEC_CTRL, &phy_reg); | 1227 | e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_reg); |
1245 | 1228 | ||
1246 | /* Clear Auto-Crossover bits in PHY Specific Control Register | 1229 | /* Clear Auto-Crossover bits in PHY Specific Control Register |
1247 | * (bits 6:5). | 1230 | * (bits 6:5). |
1248 | */ | 1231 | */ |
1249 | phy_reg &= ~M88E1000_PSCR_AUTO_X_MODE; | 1232 | phy_reg &= ~M88E1000_PSCR_AUTO_X_MODE; |
1250 | e1000_write_phy_reg(&adapter->hw, M88E1000_PHY_SPEC_CTRL, phy_reg); | 1233 | e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_reg); |
1251 | 1234 | ||
1252 | /* Perform software reset on the PHY */ | 1235 | /* Perform software reset on the PHY */ |
1253 | e1000_phy_reset(&adapter->hw); | 1236 | e1000_phy_reset(hw); |
1254 | 1237 | ||
1255 | /* Have to setup TX_CLK and TX_CRS after software reset */ | 1238 | /* Have to setup TX_CLK and TX_CRS after software reset */ |
1256 | e1000_phy_reset_clk_and_crs(adapter); | 1239 | e1000_phy_reset_clk_and_crs(adapter); |
1257 | 1240 | ||
1258 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x8100); | 1241 | e1000_write_phy_reg(hw, PHY_CTRL, 0x8100); |
1259 | 1242 | ||
1260 | /* Wait for reset to complete. */ | 1243 | /* Wait for reset to complete. */ |
1261 | udelay(500); | 1244 | udelay(500); |
@@ -1267,55 +1250,55 @@ e1000_nonintegrated_phy_loopback(struct e1000_adapter *adapter) | |||
1267 | e1000_phy_disable_receiver(adapter); | 1250 | e1000_phy_disable_receiver(adapter); |
1268 | 1251 | ||
1269 | /* Set the loopback bit in the PHY control register. */ | 1252 | /* Set the loopback bit in the PHY control register. */ |
1270 | e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_reg); | 1253 | e1000_read_phy_reg(hw, PHY_CTRL, &phy_reg); |
1271 | phy_reg |= MII_CR_LOOPBACK; | 1254 | phy_reg |= MII_CR_LOOPBACK; |
1272 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, phy_reg); | 1255 | e1000_write_phy_reg(hw, PHY_CTRL, phy_reg); |
1273 | 1256 | ||
1274 | /* Setup TX_CLK and TX_CRS one more time. */ | 1257 | /* Setup TX_CLK and TX_CRS one more time. */ |
1275 | e1000_phy_reset_clk_and_crs(adapter); | 1258 | e1000_phy_reset_clk_and_crs(adapter); |
1276 | 1259 | ||
1277 | /* Check Phy Configuration */ | 1260 | /* Check Phy Configuration */ |
1278 | e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_reg); | 1261 | e1000_read_phy_reg(hw, PHY_CTRL, &phy_reg); |
1279 | if (phy_reg != 0x4100) | 1262 | if (phy_reg != 0x4100) |
1280 | return 9; | 1263 | return 9; |
1281 | 1264 | ||
1282 | e1000_read_phy_reg(&adapter->hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg); | 1265 | e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg); |
1283 | if (phy_reg != 0x0070) | 1266 | if (phy_reg != 0x0070) |
1284 | return 10; | 1267 | return 10; |
1285 | 1268 | ||
1286 | e1000_read_phy_reg(&adapter->hw, 29, &phy_reg); | 1269 | e1000_read_phy_reg(hw, 29, &phy_reg); |
1287 | if (phy_reg != 0x001A) | 1270 | if (phy_reg != 0x001A) |
1288 | return 11; | 1271 | return 11; |
1289 | 1272 | ||
1290 | return 0; | 1273 | return 0; |
1291 | } | 1274 | } |
1292 | 1275 | ||
1293 | static int | 1276 | static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) |
1294 | e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | ||
1295 | { | 1277 | { |
1278 | struct e1000_hw *hw = &adapter->hw; | ||
1296 | u32 ctrl_reg = 0; | 1279 | u32 ctrl_reg = 0; |
1297 | u32 stat_reg = 0; | 1280 | u32 stat_reg = 0; |
1298 | 1281 | ||
1299 | adapter->hw.autoneg = false; | 1282 | hw->autoneg = false; |
1300 | 1283 | ||
1301 | if (adapter->hw.phy_type == e1000_phy_m88) { | 1284 | if (hw->phy_type == e1000_phy_m88) { |
1302 | /* Auto-MDI/MDIX Off */ | 1285 | /* Auto-MDI/MDIX Off */ |
1303 | e1000_write_phy_reg(&adapter->hw, | 1286 | e1000_write_phy_reg(hw, |
1304 | M88E1000_PHY_SPEC_CTRL, 0x0808); | 1287 | M88E1000_PHY_SPEC_CTRL, 0x0808); |
1305 | /* reset to update Auto-MDI/MDIX */ | 1288 | /* reset to update Auto-MDI/MDIX */ |
1306 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x9140); | 1289 | e1000_write_phy_reg(hw, PHY_CTRL, 0x9140); |
1307 | /* autoneg off */ | 1290 | /* autoneg off */ |
1308 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x8140); | 1291 | e1000_write_phy_reg(hw, PHY_CTRL, 0x8140); |
1309 | } else if (adapter->hw.phy_type == e1000_phy_gg82563) | 1292 | } else if (hw->phy_type == e1000_phy_gg82563) |
1310 | e1000_write_phy_reg(&adapter->hw, | 1293 | e1000_write_phy_reg(hw, |
1311 | GG82563_PHY_KMRN_MODE_CTRL, | 1294 | GG82563_PHY_KMRN_MODE_CTRL, |
1312 | 0x1CC); | 1295 | 0x1CC); |
1313 | 1296 | ||
1314 | ctrl_reg = E1000_READ_REG(&adapter->hw, CTRL); | 1297 | ctrl_reg = er32(CTRL); |
1315 | 1298 | ||
1316 | if (adapter->hw.phy_type == e1000_phy_ife) { | 1299 | if (hw->phy_type == e1000_phy_ife) { |
1317 | /* force 100, set loopback */ | 1300 | /* force 100, set loopback */ |
1318 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x6100); | 1301 | e1000_write_phy_reg(hw, PHY_CTRL, 0x6100); |
1319 | 1302 | ||
1320 | /* Now set up the MAC to the same speed/duplex as the PHY. */ | 1303 | /* Now set up the MAC to the same speed/duplex as the PHY. */ |
1321 | ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ | 1304 | ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ |
@@ -1325,10 +1308,10 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1325 | E1000_CTRL_FD); /* Force Duplex to FULL */ | 1308 | E1000_CTRL_FD); /* Force Duplex to FULL */ |
1326 | } else { | 1309 | } else { |
1327 | /* force 1000, set loopback */ | 1310 | /* force 1000, set loopback */ |
1328 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x4140); | 1311 | e1000_write_phy_reg(hw, PHY_CTRL, 0x4140); |
1329 | 1312 | ||
1330 | /* Now set up the MAC to the same speed/duplex as the PHY. */ | 1313 | /* Now set up the MAC to the same speed/duplex as the PHY. */ |
1331 | ctrl_reg = E1000_READ_REG(&adapter->hw, CTRL); | 1314 | ctrl_reg = er32(CTRL); |
1332 | ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ | 1315 | ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ |
1333 | ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ | 1316 | ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ |
1334 | E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ | 1317 | E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ |
@@ -1336,23 +1319,23 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1336 | E1000_CTRL_FD); /* Force Duplex to FULL */ | 1319 | E1000_CTRL_FD); /* Force Duplex to FULL */ |
1337 | } | 1320 | } |
1338 | 1321 | ||
1339 | if (adapter->hw.media_type == e1000_media_type_copper && | 1322 | if (hw->media_type == e1000_media_type_copper && |
1340 | adapter->hw.phy_type == e1000_phy_m88) | 1323 | hw->phy_type == e1000_phy_m88) |
1341 | ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ | 1324 | ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ |
1342 | else { | 1325 | else { |
1343 | /* Set the ILOS bit on the fiber Nic is half | 1326 | /* Set the ILOS bit on the fiber Nic is half |
1344 | * duplex link is detected. */ | 1327 | * duplex link is detected. */ |
1345 | stat_reg = E1000_READ_REG(&adapter->hw, STATUS); | 1328 | stat_reg = er32(STATUS); |
1346 | if ((stat_reg & E1000_STATUS_FD) == 0) | 1329 | if ((stat_reg & E1000_STATUS_FD) == 0) |
1347 | ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); | 1330 | ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); |
1348 | } | 1331 | } |
1349 | 1332 | ||
1350 | E1000_WRITE_REG(&adapter->hw, CTRL, ctrl_reg); | 1333 | ew32(CTRL, ctrl_reg); |
1351 | 1334 | ||
1352 | /* Disable the receiver on the PHY so when a cable is plugged in, the | 1335 | /* Disable the receiver on the PHY so when a cable is plugged in, the |
1353 | * PHY does not begin to autoneg when a cable is reconnected to the NIC. | 1336 | * PHY does not begin to autoneg when a cable is reconnected to the NIC. |
1354 | */ | 1337 | */ |
1355 | if (adapter->hw.phy_type == e1000_phy_m88) | 1338 | if (hw->phy_type == e1000_phy_m88) |
1356 | e1000_phy_disable_receiver(adapter); | 1339 | e1000_phy_disable_receiver(adapter); |
1357 | 1340 | ||
1358 | udelay(500); | 1341 | udelay(500); |
@@ -1360,15 +1343,15 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1360 | return 0; | 1343 | return 0; |
1361 | } | 1344 | } |
1362 | 1345 | ||
1363 | static int | 1346 | static int e1000_set_phy_loopback(struct e1000_adapter *adapter) |
1364 | e1000_set_phy_loopback(struct e1000_adapter *adapter) | ||
1365 | { | 1347 | { |
1348 | struct e1000_hw *hw = &adapter->hw; | ||
1366 | u16 phy_reg = 0; | 1349 | u16 phy_reg = 0; |
1367 | u16 count = 0; | 1350 | u16 count = 0; |
1368 | 1351 | ||
1369 | switch (adapter->hw.mac_type) { | 1352 | switch (hw->mac_type) { |
1370 | case e1000_82543: | 1353 | case e1000_82543: |
1371 | if (adapter->hw.media_type == e1000_media_type_copper) { | 1354 | if (hw->media_type == e1000_media_type_copper) { |
1372 | /* Attempt to setup Loopback mode on Non-integrated PHY. | 1355 | /* Attempt to setup Loopback mode on Non-integrated PHY. |
1373 | * Some PHY registers get corrupted at random, so | 1356 | * Some PHY registers get corrupted at random, so |
1374 | * attempt this 10 times. | 1357 | * attempt this 10 times. |
@@ -1402,9 +1385,9 @@ e1000_set_phy_loopback(struct e1000_adapter *adapter) | |||
1402 | /* Default PHY loopback work is to read the MII | 1385 | /* Default PHY loopback work is to read the MII |
1403 | * control register and assert bit 14 (loopback mode). | 1386 | * control register and assert bit 14 (loopback mode). |
1404 | */ | 1387 | */ |
1405 | e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_reg); | 1388 | e1000_read_phy_reg(hw, PHY_CTRL, &phy_reg); |
1406 | phy_reg |= MII_CR_LOOPBACK; | 1389 | phy_reg |= MII_CR_LOOPBACK; |
1407 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, phy_reg); | 1390 | e1000_write_phy_reg(hw, PHY_CTRL, phy_reg); |
1408 | return 0; | 1391 | return 0; |
1409 | break; | 1392 | break; |
1410 | } | 1393 | } |
@@ -1412,8 +1395,7 @@ e1000_set_phy_loopback(struct e1000_adapter *adapter) | |||
1412 | return 8; | 1395 | return 8; |
1413 | } | 1396 | } |
1414 | 1397 | ||
1415 | static int | 1398 | static int e1000_setup_loopback_test(struct e1000_adapter *adapter) |
1416 | e1000_setup_loopback_test(struct e1000_adapter *adapter) | ||
1417 | { | 1399 | { |
1418 | struct e1000_hw *hw = &adapter->hw; | 1400 | struct e1000_hw *hw = &adapter->hw; |
1419 | u32 rctl; | 1401 | u32 rctl; |
@@ -1431,14 +1413,14 @@ e1000_setup_loopback_test(struct e1000_adapter *adapter) | |||
1431 | case e1000_82572: | 1413 | case e1000_82572: |
1432 | #define E1000_SERDES_LB_ON 0x410 | 1414 | #define E1000_SERDES_LB_ON 0x410 |
1433 | e1000_set_phy_loopback(adapter); | 1415 | e1000_set_phy_loopback(adapter); |
1434 | E1000_WRITE_REG(hw, SCTL, E1000_SERDES_LB_ON); | 1416 | ew32(SCTL, E1000_SERDES_LB_ON); |
1435 | msleep(10); | 1417 | msleep(10); |
1436 | return 0; | 1418 | return 0; |
1437 | break; | 1419 | break; |
1438 | default: | 1420 | default: |
1439 | rctl = E1000_READ_REG(hw, RCTL); | 1421 | rctl = er32(RCTL); |
1440 | rctl |= E1000_RCTL_LBM_TCVR; | 1422 | rctl |= E1000_RCTL_LBM_TCVR; |
1441 | E1000_WRITE_REG(hw, RCTL, rctl); | 1423 | ew32(RCTL, rctl); |
1442 | return 0; | 1424 | return 0; |
1443 | } | 1425 | } |
1444 | } else if (hw->media_type == e1000_media_type_copper) | 1426 | } else if (hw->media_type == e1000_media_type_copper) |
@@ -1447,16 +1429,15 @@ e1000_setup_loopback_test(struct e1000_adapter *adapter) | |||
1447 | return 7; | 1429 | return 7; |
1448 | } | 1430 | } |
1449 | 1431 | ||
1450 | static void | 1432 | static void e1000_loopback_cleanup(struct e1000_adapter *adapter) |
1451 | e1000_loopback_cleanup(struct e1000_adapter *adapter) | ||
1452 | { | 1433 | { |
1453 | struct e1000_hw *hw = &adapter->hw; | 1434 | struct e1000_hw *hw = &adapter->hw; |
1454 | u32 rctl; | 1435 | u32 rctl; |
1455 | u16 phy_reg; | 1436 | u16 phy_reg; |
1456 | 1437 | ||
1457 | rctl = E1000_READ_REG(hw, RCTL); | 1438 | rctl = er32(RCTL); |
1458 | rctl &= ~(E1000_RCTL_LBM_TCVR | E1000_RCTL_LBM_MAC); | 1439 | rctl &= ~(E1000_RCTL_LBM_TCVR | E1000_RCTL_LBM_MAC); |
1459 | E1000_WRITE_REG(hw, RCTL, rctl); | 1440 | ew32(RCTL, rctl); |
1460 | 1441 | ||
1461 | switch (hw->mac_type) { | 1442 | switch (hw->mac_type) { |
1462 | case e1000_82571: | 1443 | case e1000_82571: |
@@ -1464,7 +1445,7 @@ e1000_loopback_cleanup(struct e1000_adapter *adapter) | |||
1464 | if (hw->media_type == e1000_media_type_fiber || | 1445 | if (hw->media_type == e1000_media_type_fiber || |
1465 | hw->media_type == e1000_media_type_internal_serdes) { | 1446 | hw->media_type == e1000_media_type_internal_serdes) { |
1466 | #define E1000_SERDES_LB_OFF 0x400 | 1447 | #define E1000_SERDES_LB_OFF 0x400 |
1467 | E1000_WRITE_REG(hw, SCTL, E1000_SERDES_LB_OFF); | 1448 | ew32(SCTL, E1000_SERDES_LB_OFF); |
1468 | msleep(10); | 1449 | msleep(10); |
1469 | break; | 1450 | break; |
1470 | } | 1451 | } |
@@ -1489,8 +1470,8 @@ e1000_loopback_cleanup(struct e1000_adapter *adapter) | |||
1489 | } | 1470 | } |
1490 | } | 1471 | } |
1491 | 1472 | ||
1492 | static void | 1473 | static void e1000_create_lbtest_frame(struct sk_buff *skb, |
1493 | e1000_create_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) | 1474 | unsigned int frame_size) |
1494 | { | 1475 | { |
1495 | memset(skb->data, 0xFF, frame_size); | 1476 | memset(skb->data, 0xFF, frame_size); |
1496 | frame_size &= ~1; | 1477 | frame_size &= ~1; |
@@ -1499,8 +1480,8 @@ e1000_create_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) | |||
1499 | memset(&skb->data[frame_size / 2 + 12], 0xAF, 1); | 1480 | memset(&skb->data[frame_size / 2 + 12], 0xAF, 1); |
1500 | } | 1481 | } |
1501 | 1482 | ||
1502 | static int | 1483 | static int e1000_check_lbtest_frame(struct sk_buff *skb, |
1503 | e1000_check_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) | 1484 | unsigned int frame_size) |
1504 | { | 1485 | { |
1505 | frame_size &= ~1; | 1486 | frame_size &= ~1; |
1506 | if (*(skb->data + 3) == 0xFF) { | 1487 | if (*(skb->data + 3) == 0xFF) { |
@@ -1512,16 +1493,16 @@ e1000_check_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) | |||
1512 | return 13; | 1493 | return 13; |
1513 | } | 1494 | } |
1514 | 1495 | ||
1515 | static int | 1496 | static int e1000_run_loopback_test(struct e1000_adapter *adapter) |
1516 | e1000_run_loopback_test(struct e1000_adapter *adapter) | ||
1517 | { | 1497 | { |
1498 | struct e1000_hw *hw = &adapter->hw; | ||
1518 | struct e1000_tx_ring *txdr = &adapter->test_tx_ring; | 1499 | struct e1000_tx_ring *txdr = &adapter->test_tx_ring; |
1519 | struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; | 1500 | struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; |
1520 | struct pci_dev *pdev = adapter->pdev; | 1501 | struct pci_dev *pdev = adapter->pdev; |
1521 | int i, j, k, l, lc, good_cnt, ret_val=0; | 1502 | int i, j, k, l, lc, good_cnt, ret_val=0; |
1522 | unsigned long time; | 1503 | unsigned long time; |
1523 | 1504 | ||
1524 | E1000_WRITE_REG(&adapter->hw, RDT, rxdr->count - 1); | 1505 | ew32(RDT, rxdr->count - 1); |
1525 | 1506 | ||
1526 | /* Calculate the loop count based on the largest descriptor ring | 1507 | /* Calculate the loop count based on the largest descriptor ring |
1527 | * The idea is to wrap the largest ring a number of times using 64 | 1508 | * The idea is to wrap the largest ring a number of times using 64 |
@@ -1544,7 +1525,7 @@ e1000_run_loopback_test(struct e1000_adapter *adapter) | |||
1544 | PCI_DMA_TODEVICE); | 1525 | PCI_DMA_TODEVICE); |
1545 | if (unlikely(++k == txdr->count)) k = 0; | 1526 | if (unlikely(++k == txdr->count)) k = 0; |
1546 | } | 1527 | } |
1547 | E1000_WRITE_REG(&adapter->hw, TDT, k); | 1528 | ew32(TDT, k); |
1548 | msleep(200); | 1529 | msleep(200); |
1549 | time = jiffies; /* set the start time for the receive */ | 1530 | time = jiffies; /* set the start time for the receive */ |
1550 | good_cnt = 0; | 1531 | good_cnt = 0; |
@@ -1577,21 +1558,24 @@ e1000_run_loopback_test(struct e1000_adapter *adapter) | |||
1577 | return ret_val; | 1558 | return ret_val; |
1578 | } | 1559 | } |
1579 | 1560 | ||
1580 | static int | 1561 | static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data) |
1581 | e1000_loopback_test(struct e1000_adapter *adapter, u64 *data) | ||
1582 | { | 1562 | { |
1563 | struct e1000_hw *hw = &adapter->hw; | ||
1564 | |||
1583 | /* PHY loopback cannot be performed if SoL/IDER | 1565 | /* PHY loopback cannot be performed if SoL/IDER |
1584 | * sessions are active */ | 1566 | * sessions are active */ |
1585 | if (e1000_check_phy_reset_block(&adapter->hw)) { | 1567 | if (e1000_check_phy_reset_block(hw)) { |
1586 | DPRINTK(DRV, ERR, "Cannot do PHY loopback test " | 1568 | DPRINTK(DRV, ERR, "Cannot do PHY loopback test " |
1587 | "when SoL/IDER is active.\n"); | 1569 | "when SoL/IDER is active.\n"); |
1588 | *data = 0; | 1570 | *data = 0; |
1589 | goto out; | 1571 | goto out; |
1590 | } | 1572 | } |
1591 | 1573 | ||
1592 | if ((*data = e1000_setup_desc_rings(adapter))) | 1574 | *data = e1000_setup_desc_rings(adapter); |
1575 | if (*data) | ||
1593 | goto out; | 1576 | goto out; |
1594 | if ((*data = e1000_setup_loopback_test(adapter))) | 1577 | *data = e1000_setup_loopback_test(adapter); |
1578 | if (*data) | ||
1595 | goto err_loopback; | 1579 | goto err_loopback; |
1596 | *data = e1000_run_loopback_test(adapter); | 1580 | *data = e1000_run_loopback_test(adapter); |
1597 | e1000_loopback_cleanup(adapter); | 1581 | e1000_loopback_cleanup(adapter); |
@@ -1602,38 +1586,37 @@ out: | |||
1602 | return *data; | 1586 | return *data; |
1603 | } | 1587 | } |
1604 | 1588 | ||
1605 | static int | 1589 | static int e1000_link_test(struct e1000_adapter *adapter, u64 *data) |
1606 | e1000_link_test(struct e1000_adapter *adapter, u64 *data) | ||
1607 | { | 1590 | { |
1591 | struct e1000_hw *hw = &adapter->hw; | ||
1608 | *data = 0; | 1592 | *data = 0; |
1609 | if (adapter->hw.media_type == e1000_media_type_internal_serdes) { | 1593 | if (hw->media_type == e1000_media_type_internal_serdes) { |
1610 | int i = 0; | 1594 | int i = 0; |
1611 | adapter->hw.serdes_link_down = true; | 1595 | hw->serdes_link_down = true; |
1612 | 1596 | ||
1613 | /* On some blade server designs, link establishment | 1597 | /* On some blade server designs, link establishment |
1614 | * could take as long as 2-3 minutes */ | 1598 | * could take as long as 2-3 minutes */ |
1615 | do { | 1599 | do { |
1616 | e1000_check_for_link(&adapter->hw); | 1600 | e1000_check_for_link(hw); |
1617 | if (!adapter->hw.serdes_link_down) | 1601 | if (!hw->serdes_link_down) |
1618 | return *data; | 1602 | return *data; |
1619 | msleep(20); | 1603 | msleep(20); |
1620 | } while (i++ < 3750); | 1604 | } while (i++ < 3750); |
1621 | 1605 | ||
1622 | *data = 1; | 1606 | *data = 1; |
1623 | } else { | 1607 | } else { |
1624 | e1000_check_for_link(&adapter->hw); | 1608 | e1000_check_for_link(hw); |
1625 | if (adapter->hw.autoneg) /* if auto_neg is set wait for it */ | 1609 | if (hw->autoneg) /* if auto_neg is set wait for it */ |
1626 | msleep(4000); | 1610 | msleep(4000); |
1627 | 1611 | ||
1628 | if (!(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU)) { | 1612 | if (!(er32(STATUS) & E1000_STATUS_LU)) { |
1629 | *data = 1; | 1613 | *data = 1; |
1630 | } | 1614 | } |
1631 | } | 1615 | } |
1632 | return *data; | 1616 | return *data; |
1633 | } | 1617 | } |
1634 | 1618 | ||
1635 | static int | 1619 | static int e1000_get_sset_count(struct net_device *netdev, int sset) |
1636 | e1000_get_sset_count(struct net_device *netdev, int sset) | ||
1637 | { | 1620 | { |
1638 | switch (sset) { | 1621 | switch (sset) { |
1639 | case ETH_SS_TEST: | 1622 | case ETH_SS_TEST: |
@@ -1645,11 +1628,11 @@ e1000_get_sset_count(struct net_device *netdev, int sset) | |||
1645 | } | 1628 | } |
1646 | } | 1629 | } |
1647 | 1630 | ||
1648 | static void | 1631 | static void e1000_diag_test(struct net_device *netdev, |
1649 | e1000_diag_test(struct net_device *netdev, | 1632 | struct ethtool_test *eth_test, u64 *data) |
1650 | struct ethtool_test *eth_test, u64 *data) | ||
1651 | { | 1633 | { |
1652 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1634 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1635 | struct e1000_hw *hw = &adapter->hw; | ||
1653 | bool if_running = netif_running(netdev); | 1636 | bool if_running = netif_running(netdev); |
1654 | 1637 | ||
1655 | set_bit(__E1000_TESTING, &adapter->flags); | 1638 | set_bit(__E1000_TESTING, &adapter->flags); |
@@ -1657,9 +1640,9 @@ e1000_diag_test(struct net_device *netdev, | |||
1657 | /* Offline tests */ | 1640 | /* Offline tests */ |
1658 | 1641 | ||
1659 | /* save speed, duplex, autoneg settings */ | 1642 | /* save speed, duplex, autoneg settings */ |
1660 | u16 autoneg_advertised = adapter->hw.autoneg_advertised; | 1643 | u16 autoneg_advertised = hw->autoneg_advertised; |
1661 | u8 forced_speed_duplex = adapter->hw.forced_speed_duplex; | 1644 | u8 forced_speed_duplex = hw->forced_speed_duplex; |
1662 | u8 autoneg = adapter->hw.autoneg; | 1645 | u8 autoneg = hw->autoneg; |
1663 | 1646 | ||
1664 | DPRINTK(HW, INFO, "offline testing starting\n"); | 1647 | DPRINTK(HW, INFO, "offline testing starting\n"); |
1665 | 1648 | ||
@@ -1692,9 +1675,9 @@ e1000_diag_test(struct net_device *netdev, | |||
1692 | eth_test->flags |= ETH_TEST_FL_FAILED; | 1675 | eth_test->flags |= ETH_TEST_FL_FAILED; |
1693 | 1676 | ||
1694 | /* restore speed, duplex, autoneg settings */ | 1677 | /* restore speed, duplex, autoneg settings */ |
1695 | adapter->hw.autoneg_advertised = autoneg_advertised; | 1678 | hw->autoneg_advertised = autoneg_advertised; |
1696 | adapter->hw.forced_speed_duplex = forced_speed_duplex; | 1679 | hw->forced_speed_duplex = forced_speed_duplex; |
1697 | adapter->hw.autoneg = autoneg; | 1680 | hw->autoneg = autoneg; |
1698 | 1681 | ||
1699 | e1000_reset(adapter); | 1682 | e1000_reset(adapter); |
1700 | clear_bit(__E1000_TESTING, &adapter->flags); | 1683 | clear_bit(__E1000_TESTING, &adapter->flags); |
@@ -1717,7 +1700,8 @@ e1000_diag_test(struct net_device *netdev, | |||
1717 | msleep_interruptible(4 * 1000); | 1700 | msleep_interruptible(4 * 1000); |
1718 | } | 1701 | } |
1719 | 1702 | ||
1720 | static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wolinfo *wol) | 1703 | static int e1000_wol_exclusion(struct e1000_adapter *adapter, |
1704 | struct ethtool_wolinfo *wol) | ||
1721 | { | 1705 | { |
1722 | struct e1000_hw *hw = &adapter->hw; | 1706 | struct e1000_hw *hw = &adapter->hw; |
1723 | int retval = 1; /* fail by default */ | 1707 | int retval = 1; /* fail by default */ |
@@ -1742,7 +1726,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol | |||
1742 | case E1000_DEV_ID_82571EB_SERDES: | 1726 | case E1000_DEV_ID_82571EB_SERDES: |
1743 | case E1000_DEV_ID_82571EB_COPPER: | 1727 | case E1000_DEV_ID_82571EB_COPPER: |
1744 | /* Wake events not supported on port B */ | 1728 | /* Wake events not supported on port B */ |
1745 | if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) { | 1729 | if (er32(STATUS) & E1000_STATUS_FUNC_1) { |
1746 | wol->supported = 0; | 1730 | wol->supported = 0; |
1747 | break; | 1731 | break; |
1748 | } | 1732 | } |
@@ -1766,7 +1750,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol | |||
1766 | /* dual port cards only support WoL on port A from now on | 1750 | /* dual port cards only support WoL on port A from now on |
1767 | * unless it was enabled in the eeprom for port B | 1751 | * unless it was enabled in the eeprom for port B |
1768 | * so exclude FUNC_1 ports from having WoL enabled */ | 1752 | * so exclude FUNC_1 ports from having WoL enabled */ |
1769 | if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1 && | 1753 | if (er32(STATUS) & E1000_STATUS_FUNC_1 && |
1770 | !adapter->eeprom_wol) { | 1754 | !adapter->eeprom_wol) { |
1771 | wol->supported = 0; | 1755 | wol->supported = 0; |
1772 | break; | 1756 | break; |
@@ -1778,10 +1762,11 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol | |||
1778 | return retval; | 1762 | return retval; |
1779 | } | 1763 | } |
1780 | 1764 | ||
1781 | static void | 1765 | static void e1000_get_wol(struct net_device *netdev, |
1782 | e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | 1766 | struct ethtool_wolinfo *wol) |
1783 | { | 1767 | { |
1784 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1768 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1769 | struct e1000_hw *hw = &adapter->hw; | ||
1785 | 1770 | ||
1786 | wol->supported = WAKE_UCAST | WAKE_MCAST | | 1771 | wol->supported = WAKE_UCAST | WAKE_MCAST | |
1787 | WAKE_BCAST | WAKE_MAGIC; | 1772 | WAKE_BCAST | WAKE_MAGIC; |
@@ -1793,7 +1778,7 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1793 | return; | 1778 | return; |
1794 | 1779 | ||
1795 | /* apply any specific unsupported masks here */ | 1780 | /* apply any specific unsupported masks here */ |
1796 | switch (adapter->hw.device_id) { | 1781 | switch (hw->device_id) { |
1797 | case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: | 1782 | case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: |
1798 | /* KSP3 does not suppport UCAST wake-ups */ | 1783 | /* KSP3 does not suppport UCAST wake-ups */ |
1799 | wol->supported &= ~WAKE_UCAST; | 1784 | wol->supported &= ~WAKE_UCAST; |
@@ -1818,8 +1803,7 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1818 | return; | 1803 | return; |
1819 | } | 1804 | } |
1820 | 1805 | ||
1821 | static int | 1806 | static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) |
1822 | e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | ||
1823 | { | 1807 | { |
1824 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1808 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1825 | struct e1000_hw *hw = &adapter->hw; | 1809 | struct e1000_hw *hw = &adapter->hw; |
@@ -1863,61 +1847,60 @@ e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1863 | /* bit defines for adapter->led_status */ | 1847 | /* bit defines for adapter->led_status */ |
1864 | #define E1000_LED_ON 0 | 1848 | #define E1000_LED_ON 0 |
1865 | 1849 | ||
1866 | static void | 1850 | static void e1000_led_blink_callback(unsigned long data) |
1867 | e1000_led_blink_callback(unsigned long data) | ||
1868 | { | 1851 | { |
1869 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; | 1852 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; |
1853 | struct e1000_hw *hw = &adapter->hw; | ||
1870 | 1854 | ||
1871 | if (test_and_change_bit(E1000_LED_ON, &adapter->led_status)) | 1855 | if (test_and_change_bit(E1000_LED_ON, &adapter->led_status)) |
1872 | e1000_led_off(&adapter->hw); | 1856 | e1000_led_off(hw); |
1873 | else | 1857 | else |
1874 | e1000_led_on(&adapter->hw); | 1858 | e1000_led_on(hw); |
1875 | 1859 | ||
1876 | mod_timer(&adapter->blink_timer, jiffies + E1000_ID_INTERVAL); | 1860 | mod_timer(&adapter->blink_timer, jiffies + E1000_ID_INTERVAL); |
1877 | } | 1861 | } |
1878 | 1862 | ||
1879 | static int | 1863 | static int e1000_phys_id(struct net_device *netdev, u32 data) |
1880 | e1000_phys_id(struct net_device *netdev, u32 data) | ||
1881 | { | 1864 | { |
1882 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1865 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1866 | struct e1000_hw *hw = &adapter->hw; | ||
1883 | 1867 | ||
1884 | if (!data) | 1868 | if (!data) |
1885 | data = INT_MAX; | 1869 | data = INT_MAX; |
1886 | 1870 | ||
1887 | if (adapter->hw.mac_type < e1000_82571) { | 1871 | if (hw->mac_type < e1000_82571) { |
1888 | if (!adapter->blink_timer.function) { | 1872 | if (!adapter->blink_timer.function) { |
1889 | init_timer(&adapter->blink_timer); | 1873 | init_timer(&adapter->blink_timer); |
1890 | adapter->blink_timer.function = e1000_led_blink_callback; | 1874 | adapter->blink_timer.function = e1000_led_blink_callback; |
1891 | adapter->blink_timer.data = (unsigned long) adapter; | 1875 | adapter->blink_timer.data = (unsigned long)adapter; |
1892 | } | 1876 | } |
1893 | e1000_setup_led(&adapter->hw); | 1877 | e1000_setup_led(hw); |
1894 | mod_timer(&adapter->blink_timer, jiffies); | 1878 | mod_timer(&adapter->blink_timer, jiffies); |
1895 | msleep_interruptible(data * 1000); | 1879 | msleep_interruptible(data * 1000); |
1896 | del_timer_sync(&adapter->blink_timer); | 1880 | del_timer_sync(&adapter->blink_timer); |
1897 | } else if (adapter->hw.phy_type == e1000_phy_ife) { | 1881 | } else if (hw->phy_type == e1000_phy_ife) { |
1898 | if (!adapter->blink_timer.function) { | 1882 | if (!adapter->blink_timer.function) { |
1899 | init_timer(&adapter->blink_timer); | 1883 | init_timer(&adapter->blink_timer); |
1900 | adapter->blink_timer.function = e1000_led_blink_callback; | 1884 | adapter->blink_timer.function = e1000_led_blink_callback; |
1901 | adapter->blink_timer.data = (unsigned long) adapter; | 1885 | adapter->blink_timer.data = (unsigned long)adapter; |
1902 | } | 1886 | } |
1903 | mod_timer(&adapter->blink_timer, jiffies); | 1887 | mod_timer(&adapter->blink_timer, jiffies); |
1904 | msleep_interruptible(data * 1000); | 1888 | msleep_interruptible(data * 1000); |
1905 | del_timer_sync(&adapter->blink_timer); | 1889 | del_timer_sync(&adapter->blink_timer); |
1906 | e1000_write_phy_reg(&(adapter->hw), IFE_PHY_SPECIAL_CONTROL_LED, 0); | 1890 | e1000_write_phy_reg(&(adapter->hw), IFE_PHY_SPECIAL_CONTROL_LED, 0); |
1907 | } else { | 1891 | } else { |
1908 | e1000_blink_led_start(&adapter->hw); | 1892 | e1000_blink_led_start(hw); |
1909 | msleep_interruptible(data * 1000); | 1893 | msleep_interruptible(data * 1000); |
1910 | } | 1894 | } |
1911 | 1895 | ||
1912 | e1000_led_off(&adapter->hw); | 1896 | e1000_led_off(hw); |
1913 | clear_bit(E1000_LED_ON, &adapter->led_status); | 1897 | clear_bit(E1000_LED_ON, &adapter->led_status); |
1914 | e1000_cleanup_led(&adapter->hw); | 1898 | e1000_cleanup_led(hw); |
1915 | 1899 | ||
1916 | return 0; | 1900 | return 0; |
1917 | } | 1901 | } |
1918 | 1902 | ||
1919 | static int | 1903 | static int e1000_nway_reset(struct net_device *netdev) |
1920 | e1000_nway_reset(struct net_device *netdev) | ||
1921 | { | 1904 | { |
1922 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1905 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1923 | if (netif_running(netdev)) | 1906 | if (netif_running(netdev)) |
@@ -1925,9 +1908,8 @@ e1000_nway_reset(struct net_device *netdev) | |||
1925 | return 0; | 1908 | return 0; |
1926 | } | 1909 | } |
1927 | 1910 | ||
1928 | static void | 1911 | static void e1000_get_ethtool_stats(struct net_device *netdev, |
1929 | e1000_get_ethtool_stats(struct net_device *netdev, | 1912 | struct ethtool_stats *stats, u64 *data) |
1930 | struct ethtool_stats *stats, u64 *data) | ||
1931 | { | 1913 | { |
1932 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1914 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1933 | int i; | 1915 | int i; |
@@ -1941,8 +1923,8 @@ e1000_get_ethtool_stats(struct net_device *netdev, | |||
1941 | /* BUG_ON(i != E1000_STATS_LEN); */ | 1923 | /* BUG_ON(i != E1000_STATS_LEN); */ |
1942 | } | 1924 | } |
1943 | 1925 | ||
1944 | static void | 1926 | static void e1000_get_strings(struct net_device *netdev, u32 stringset, |
1945 | e1000_get_strings(struct net_device *netdev, u32 stringset, u8 *data) | 1927 | u8 *data) |
1946 | { | 1928 | { |
1947 | u8 *p = data; | 1929 | u8 *p = data; |
1948 | int i; | 1930 | int i; |