FreeBSD kernel E1000 device code
e1000_mac.c
Go to the documentation of this file.
1/******************************************************************************
2 SPDX-License-Identifier: BSD-3-Clause
3
4 Copyright (c) 2001-2020, Intel Corporation
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9
10 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12
13 2. Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the
15 documentation and/or other materials provided with the distribution.
16
17 3. Neither the name of the Intel Corporation nor the names of its
18 contributors may be used to endorse or promote products derived from
19 this software without specific prior written permission.
20
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 POSSIBILITY OF SUCH DAMAGE.
32
33******************************************************************************/
34/*$FreeBSD$*/
35
36#include "e1000_api.h"
37
39static void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw);
40static void e1000_config_collision_dist_generic(struct e1000_hw *hw);
41
49{
50 struct e1000_mac_info *mac = &hw->mac;
51 DEBUGFUNC("e1000_init_mac_ops_generic");
52
53 /* General Setup */
63 /* LED */
69 /* LINK */
74 /* Management */
76 /* VLAN, MC, etc. */
82}
83
89{
90 DEBUGFUNC("e1000_null_ops_generic");
91 return E1000_SUCCESS;
92}
93
99{
100 DEBUGFUNC("e1000_null_mac_generic");
101 return;
102}
103
112{
113 DEBUGFUNC("e1000_null_link_info");
114 return E1000_SUCCESS;
115}
116
122{
123 DEBUGFUNC("e1000_null_mng_mode");
124 return false;
125}
126
135{
136 DEBUGFUNC("e1000_null_update_mc");
137 return;
138}
139
148{
149 DEBUGFUNC("e1000_null_write_vfta");
150 return;
151}
152
161{
162 DEBUGFUNC("e1000_null_rar_set");
163 return E1000_SUCCESS;
164}
165
172{
173 DEBUGFUNC("e1000_null_set_obff_timer");
174 return E1000_SUCCESS;
175}
176
186{
187 struct e1000_mac_info *mac = &hw->mac;
188 struct e1000_bus_info *bus = &hw->bus;
189 u32 status = E1000_READ_REG(hw, E1000_STATUS);
190 s32 ret_val = E1000_SUCCESS;
191
192 DEBUGFUNC("e1000_get_bus_info_pci_generic");
193
194 /* PCI or PCI-X? */
195 bus->type = (status & E1000_STATUS_PCIX_MODE)
198
199 /* Bus speed */
200 if (bus->type == e1000_bus_type_pci) {
201 bus->speed = (status & E1000_STATUS_PCI66)
204 } else {
205 switch (status & E1000_STATUS_PCIX_SPEED) {
208 break;
211 break;
214 break;
215 default:
217 break;
218 }
219 }
220
221 /* Bus width */
222 bus->width = (status & E1000_STATUS_BUS64)
225
226 /* Which PCI(-X) function? */
227 mac->ops.set_lan_id(hw);
228
229 return ret_val;
230}
231
241{
242 struct e1000_mac_info *mac = &hw->mac;
243 struct e1000_bus_info *bus = &hw->bus;
244 s32 ret_val;
245 u16 pcie_link_status;
246
247 DEBUGFUNC("e1000_get_bus_info_pcie_generic");
248
250
252 &pcie_link_status);
253 if (ret_val) {
256 } else {
257 switch (pcie_link_status & PCIE_LINK_SPEED_MASK) {
260 break;
263 break;
264 default:
266 break;
267 }
268
269 bus->width = (enum e1000_bus_width)((pcie_link_status &
271 }
272
273 mac->ops.set_lan_id(hw);
274
275 return E1000_SUCCESS;
276}
277
287{
288 struct e1000_bus_info *bus = &hw->bus;
289 u32 reg;
290
291 /* The status register reports the correct function number
292 * for the device regardless of function swap state.
293 */
294 reg = E1000_READ_REG(hw, E1000_STATUS);
296}
297
305{
306 struct e1000_bus_info *bus = &hw->bus;
307 u16 pci_header_type;
308 u32 status;
309
310 e1000_read_pci_cfg(hw, PCI_HEADER_TYPE_REGISTER, &pci_header_type);
311 if (pci_header_type & PCI_HEADER_TYPE_MULTIFUNC) {
312 status = E1000_READ_REG(hw, E1000_STATUS);
313 bus->func = (status & E1000_STATUS_FUNC_MASK)
315 } else {
316 bus->func = 0;
317 }
318}
319
327{
328 struct e1000_bus_info *bus = &hw->bus;
329
330 bus->func = 0;
331}
332
341{
342 u32 offset;
343
344 DEBUGFUNC("e1000_clear_vfta_generic");
345
346 for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {
347 E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, 0);
349 }
350}
351
361void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value)
362{
363 DEBUGFUNC("e1000_write_vfta_generic");
364
365 E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, value);
367}
368
378void e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count)
379{
380 u32 i;
381 u8 mac_addr[ETHER_ADDR_LEN] = {0};
382
383 DEBUGFUNC("e1000_init_rx_addrs_generic");
384
385 /* Setup the receive address */
386 DEBUGOUT("Programming MAC Address into RAR[0]\n");
387
388 hw->mac.ops.rar_set(hw, hw->mac.addr, 0);
389
390 /* Zero out the other (rar_entry_count - 1) receive addresses */
391 DEBUGOUT1("Clearing RAR[1-%u]\n", rar_count-1);
392 for (i = 1; i < rar_count; i++)
393 hw->mac.ops.rar_set(hw, mac_addr, i);
394}
395
409{
410 u32 i;
411 s32 ret_val;
412 u16 offset, nvm_alt_mac_addr_offset, nvm_data;
413 u8 alt_mac_addr[ETHER_ADDR_LEN];
414
415 DEBUGFUNC("e1000_check_alt_mac_addr_generic");
416
417 ret_val = hw->nvm.ops.read(hw, NVM_COMPAT, 1, &nvm_data);
418 if (ret_val)
419 return ret_val;
420
421 /* not supported on older hardware or 82573 */
422 if ((hw->mac.type < e1000_82571) || (hw->mac.type == e1000_82573))
423 return E1000_SUCCESS;
424
425 /* Alternate MAC address is handled by the option ROM for 82580
426 * and newer. SW support not required.
427 */
428 if (hw->mac.type >= e1000_82580)
429 return E1000_SUCCESS;
430
431 ret_val = hw->nvm.ops.read(hw, NVM_ALT_MAC_ADDR_PTR, 1,
432 &nvm_alt_mac_addr_offset);
433 if (ret_val) {
434 DEBUGOUT("NVM Read Error\n");
435 return ret_val;
436 }
437
438 if ((nvm_alt_mac_addr_offset == 0xFFFF) ||
439 (nvm_alt_mac_addr_offset == 0x0000))
440 /* There is no Alternate MAC Address */
441 return E1000_SUCCESS;
442
443 if (hw->bus.func == E1000_FUNC_1)
444 nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN1;
445 if (hw->bus.func == E1000_FUNC_2)
446 nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN2;
447
448 if (hw->bus.func == E1000_FUNC_3)
449 nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN3;
450 for (i = 0; i < ETHER_ADDR_LEN; i += 2) {
451 offset = nvm_alt_mac_addr_offset + (i >> 1);
452 ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
453 if (ret_val) {
454 DEBUGOUT("NVM Read Error\n");
455 return ret_val;
456 }
457
458 alt_mac_addr[i] = (u8)(nvm_data & 0xFF);
459 alt_mac_addr[i + 1] = (u8)(nvm_data >> 8);
460 }
461
462 /* if multicast bit is set, the alternate address will not be used */
463 if (alt_mac_addr[0] & 0x01) {
464 DEBUGOUT("Ignoring Alternate Mac Address with MC bit set\n");
465 return E1000_SUCCESS;
466 }
467
468 /* We have a valid alternate MAC address, and we want to treat it the
469 * same as the normal permanent MAC address stored by the HW into the
470 * RAR. Do this by mapping this address into RAR0.
471 */
472 hw->mac.ops.rar_set(hw, alt_mac_addr, 0);
473
474 return E1000_SUCCESS;
475}
476
486int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index)
487{
488 u32 rar_low, rar_high;
489
490 DEBUGFUNC("e1000_rar_set_generic");
491
492 /* HW expects these in little endian so we reverse the byte order
493 * from network order (big endian) to little endian
494 */
495 rar_low = ((u32) addr[0] | ((u32) addr[1] << 8) |
496 ((u32) addr[2] << 16) | ((u32) addr[3] << 24));
497
498 rar_high = ((u32) addr[4] | ((u32) addr[5] << 8));
499
500 /* If MAC address zero, no need to set the AV bit */
501 if (rar_low || rar_high)
502 rar_high |= E1000_RAH_AV;
503
504 /* Some bridges will combine consecutive 32-bit writes into
505 * a single burst write, which will malfunction on some parts.
506 * The flushes avoid this.
507 */
508 E1000_WRITE_REG(hw, E1000_RAL(index), rar_low);
510 E1000_WRITE_REG(hw, E1000_RAH(index), rar_high);
512
513 return E1000_SUCCESS;
514}
515
525{
526 u32 hash_value, hash_mask;
527 u8 bit_shift = 0;
528
529 DEBUGFUNC("e1000_hash_mc_addr_generic");
530
531 /* Register count multiplied by bits per register */
532 hash_mask = (hw->mac.mta_reg_count * 32) - 1;
533
534 /* For a mc_filter_type of 0, bit_shift is the number of left-shifts
535 * where 0xFF would still fall within the hash mask.
536 */
537 while (hash_mask >> bit_shift != 0xFF)
538 bit_shift++;
539
540 /* The portion of the address that is used for the hash table
541 * is determined by the mc_filter_type setting.
542 * The algorithm is such that there is a total of 8 bits of shifting.
543 * The bit_shift for a mc_filter_type of 0 represents the number of
544 * left-shifts where the MSB of mc_addr[5] would still fall within
545 * the hash_mask. Case 0 does this exactly. Since there are a total
546 * of 8 bits of shifting, then mc_addr[4] will shift right the
547 * remaining number of bits. Thus 8 - bit_shift. The rest of the
548 * cases are a variation of this algorithm...essentially raising the
549 * number of bits to shift mc_addr[5] left, while still keeping the
550 * 8-bit shifting total.
551 *
552 * For example, given the following Destination MAC Address and an
553 * mta register count of 128 (thus a 4096-bit vector and 0xFFF mask),
554 * we can see that the bit_shift for case 0 is 4. These are the hash
555 * values resulting from each mc_filter_type...
556 * [0] [1] [2] [3] [4] [5]
557 * 01 AA 00 12 34 56
558 * LSB MSB
559 *
560 * case 0: hash_value = ((0x34 >> 4) | (0x56 << 4)) & 0xFFF = 0x563
561 * case 1: hash_value = ((0x34 >> 3) | (0x56 << 5)) & 0xFFF = 0xAC6
562 * case 2: hash_value = ((0x34 >> 2) | (0x56 << 6)) & 0xFFF = 0x163
563 * case 3: hash_value = ((0x34 >> 0) | (0x56 << 8)) & 0xFFF = 0x634
564 */
565 switch (hw->mac.mc_filter_type) {
566 default:
567 case 0:
568 break;
569 case 1:
570 bit_shift += 1;
571 break;
572 case 2:
573 bit_shift += 2;
574 break;
575 case 3:
576 bit_shift += 4;
577 break;
578 }
579
580 hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) |
581 (((u16) mc_addr[5]) << bit_shift)));
582
583 return hash_value;
584}
585
596 u8 *mc_addr_list, u32 mc_addr_count)
597{
598 u32 hash_value, hash_bit, hash_reg;
599 int i;
600
601 DEBUGFUNC("e1000_update_mc_addr_list_generic");
602
603 /* clear mta_shadow */
604 memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow));
605
606 /* update mta_shadow from mc_addr_list */
607 for (i = 0; (u32) i < mc_addr_count; i++) {
608 hash_value = e1000_hash_mc_addr_generic(hw, mc_addr_list);
609
610 hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1);
611 hash_bit = hash_value & 0x1F;
612
613 hw->mac.mta_shadow[hash_reg] |= (1 << hash_bit);
614 mc_addr_list += (ETHER_ADDR_LEN);
615 }
616
617 /* replace the entire MTA table */
618 for (i = hw->mac.mta_reg_count - 1; i >= 0; i--)
621}
622
633{
634 u16 cmd_mmrbc;
635 u16 pcix_cmd;
636 u16 pcix_stat_hi_word;
637 u16 stat_mmrbc;
638
639 DEBUGFUNC("e1000_pcix_mmrbc_workaround_generic");
640
641 /* Workaround for PCI-X issue when BIOS sets MMRBC incorrectly */
642 if (hw->bus.type != e1000_bus_type_pcix)
643 return;
644
646 e1000_read_pci_cfg(hw, PCIX_STATUS_REGISTER_HI, &pcix_stat_hi_word);
647 cmd_mmrbc = (pcix_cmd & PCIX_COMMAND_MMRBC_MASK) >>
649 stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >>
651 if (stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K)
652 stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K;
653 if (cmd_mmrbc > stat_mmrbc) {
654 pcix_cmd &= ~PCIX_COMMAND_MMRBC_MASK;
655 pcix_cmd |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT;
657 }
658}
659
667{
668 DEBUGFUNC("e1000_clear_hw_cntrs_base_generic");
669
707}
708
718{
719 struct e1000_mac_info *mac = &hw->mac;
720 s32 ret_val;
721 bool link;
722
723 DEBUGFUNC("e1000_check_for_copper_link");
724
725 /* We only want to go out to the PHY registers to see if Auto-Neg
726 * has completed and/or if our link status has changed. The
727 * get_link_status flag is set upon receiving a Link Status
728 * Change or Rx Sequence Error interrupt.
729 */
730 if (!mac->get_link_status)
731 return E1000_SUCCESS;
732
733 /* First we want to see if the MII Status Register reports
734 * link. If so, then we want to get the current speed/duplex
735 * of the PHY.
736 */
737 ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link);
738 if (ret_val)
739 return ret_val;
740
741 if (!link)
742 return E1000_SUCCESS; /* No link detected */
743
744 mac->get_link_status = false;
745
746 /* Check if there was DownShift, must be checked
747 * immediately after link-up
748 */
750
751 /* If we are forcing speed/duplex, then we simply return since
752 * we have already determined whether we have link or not.
753 */
754 if (!mac->autoneg)
755 return -E1000_ERR_CONFIG;
756
757 /* Auto-Neg is enabled. Auto Speed Detection takes care
758 * of MAC speed/duplex configuration. So we only need to
759 * configure Collision Distance in the MAC.
760 */
761 mac->ops.config_collision_dist(hw);
762
763 /* Configure Flow Control now that Auto-Neg has completed.
764 * First, we need to restore the desired flow control
765 * settings because we may have had to re-autoneg with a
766 * different link partner.
767 */
769 if (ret_val)
770 DEBUGOUT("Error configuring flow control\n");
771
772 return ret_val;
773}
774
783{
784 struct e1000_mac_info *mac = &hw->mac;
785 u32 rxcw;
786 u32 ctrl;
787 u32 status;
788 s32 ret_val;
789
790 DEBUGFUNC("e1000_check_for_fiber_link_generic");
791
792 ctrl = E1000_READ_REG(hw, E1000_CTRL);
793 status = E1000_READ_REG(hw, E1000_STATUS);
794 rxcw = E1000_READ_REG(hw, E1000_RXCW);
795
796 /* If we don't have link (auto-negotiation failed or link partner
797 * cannot auto-negotiate), the cable is plugged in (we have signal),
798 * and our link partner is not trying to auto-negotiate with us (we
799 * are receiving idles or data), we need to force link up. We also
800 * need to give auto-negotiation time to complete, in case the cable
801 * was just plugged in. The autoneg_failed flag does this.
802 */
803 /* (ctrl & E1000_CTRL_SWDPIN1) == 1 == have signal */
804 if ((ctrl & E1000_CTRL_SWDPIN1) && !(status & E1000_STATUS_LU) &&
805 !(rxcw & E1000_RXCW_C)) {
806 if (!mac->autoneg_failed) {
807 mac->autoneg_failed = true;
808 return E1000_SUCCESS;
809 }
810 DEBUGOUT("NOT Rx'ing /C/, disable AutoNeg and force link.\n");
811
812 /* Disable auto-negotiation in the TXCW register */
814
815 /* Force link-up and also force full-duplex. */
816 ctrl = E1000_READ_REG(hw, E1000_CTRL);
817 ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD);
818 E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
819
820 /* Configure Flow Control after forcing link up. */
822 if (ret_val) {
823 DEBUGOUT("Error configuring flow control\n");
824 return ret_val;
825 }
826 } else if ((ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) {
827 /* If we are forcing link and we are receiving /C/ ordered
828 * sets, re-enable auto-negotiation in the TXCW register
829 * and disable forced link in the Device Control register
830 * in an attempt to auto-negotiate with our link partner.
831 */
832 DEBUGOUT("Rx'ing /C/, enable AutoNeg and stop forcing link.\n");
835
836 mac->serdes_has_link = true;
837 }
838
839 return E1000_SUCCESS;
840}
841
850{
851 struct e1000_mac_info *mac = &hw->mac;
852 u32 rxcw;
853 u32 ctrl;
854 u32 status;
855 s32 ret_val;
856
857 DEBUGFUNC("e1000_check_for_serdes_link_generic");
858
859 ctrl = E1000_READ_REG(hw, E1000_CTRL);
860 status = E1000_READ_REG(hw, E1000_STATUS);
861 rxcw = E1000_READ_REG(hw, E1000_RXCW);
862
863 /* If we don't have link (auto-negotiation failed or link partner
864 * cannot auto-negotiate), and our link partner is not trying to
865 * auto-negotiate with us (we are receiving idles or data),
866 * we need to force link up. We also need to give auto-negotiation
867 * time to complete.
868 */
869 /* (ctrl & E1000_CTRL_SWDPIN1) == 1 == have signal */
870 if (!(status & E1000_STATUS_LU) && !(rxcw & E1000_RXCW_C)) {
871 if (!mac->autoneg_failed) {
872 mac->autoneg_failed = true;
873 return E1000_SUCCESS;
874 }
875 DEBUGOUT("NOT Rx'ing /C/, disable AutoNeg and force link.\n");
876
877 /* Disable auto-negotiation in the TXCW register */
879
880 /* Force link-up and also force full-duplex. */
881 ctrl = E1000_READ_REG(hw, E1000_CTRL);
882 ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD);
883 E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
884
885 /* Configure Flow Control after forcing link up. */
887 if (ret_val) {
888 DEBUGOUT("Error configuring flow control\n");
889 return ret_val;
890 }
891 } else if ((ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) {
892 /* If we are forcing link and we are receiving /C/ ordered
893 * sets, re-enable auto-negotiation in the TXCW register
894 * and disable forced link in the Device Control register
895 * in an attempt to auto-negotiate with our link partner.
896 */
897 DEBUGOUT("Rx'ing /C/, enable AutoNeg and stop forcing link.\n");
900
901 mac->serdes_has_link = true;
902 } else if (!(E1000_TXCW_ANE & E1000_READ_REG(hw, E1000_TXCW))) {
903 /* If we force link for non-auto-negotiation switch, check
904 * link status based on MAC synchronization for internal
905 * serdes media type.
906 */
907 /* SYNCH bit and IV bit are sticky. */
908 usec_delay(10);
909 rxcw = E1000_READ_REG(hw, E1000_RXCW);
910 if (rxcw & E1000_RXCW_SYNCH) {
911 if (!(rxcw & E1000_RXCW_IV)) {
912 mac->serdes_has_link = true;
913 DEBUGOUT("SERDES: Link up - forced.\n");
914 }
915 } else {
916 mac->serdes_has_link = false;
917 DEBUGOUT("SERDES: Link down - force failed.\n");
918 }
919 }
920
922 status = E1000_READ_REG(hw, E1000_STATUS);
923 if (status & E1000_STATUS_LU) {
924 /* SYNCH bit and IV bit are sticky, so reread rxcw. */
925 usec_delay(10);
926 rxcw = E1000_READ_REG(hw, E1000_RXCW);
927 if (rxcw & E1000_RXCW_SYNCH) {
928 if (!(rxcw & E1000_RXCW_IV)) {
929 mac->serdes_has_link = true;
930 DEBUGOUT("SERDES: Link up - autoneg completed successfully.\n");
931 } else {
932 mac->serdes_has_link = false;
933 DEBUGOUT("SERDES: Link down - invalid codewords detected in autoneg.\n");
934 }
935 } else {
936 mac->serdes_has_link = false;
937 DEBUGOUT("SERDES: Link down - no sync.\n");
938 }
939 } else {
940 mac->serdes_has_link = false;
941 DEBUGOUT("SERDES: Link down - autoneg failed\n");
942 }
943 }
944
945 return E1000_SUCCESS;
946}
947
956{
957 s32 ret_val;
958 u16 nvm_data;
959 u16 nvm_offset = 0;
960
961 DEBUGFUNC("e1000_set_default_fc_generic");
962
963 /* Read and store word 0x0F of the EEPROM. This word contains bits
964 * that determine the hardware's default PAUSE (flow control) mode,
965 * a bit that determines whether the HW defaults to enabling or
966 * disabling auto-negotiation, and the direction of the
967 * SW defined pins. If there is no SW over-ride of the flow
968 * control setting, then the variable hw->fc will
969 * be initialized based on a value in the EEPROM.
970 */
971 if (hw->mac.type == e1000_i350) {
972 nvm_offset = NVM_82580_LAN_FUNC_OFFSET(hw->bus.func);
973 ret_val = hw->nvm.ops.read(hw,
975 nvm_offset,
976 1, &nvm_data);
977 } else {
978 ret_val = hw->nvm.ops.read(hw,
980 1, &nvm_data);
981 }
982
983
984 if (ret_val) {
985 DEBUGOUT("NVM Read Error\n");
986 return ret_val;
987 }
988
989 if (!(nvm_data & NVM_WORD0F_PAUSE_MASK))
991 else if ((nvm_data & NVM_WORD0F_PAUSE_MASK) ==
994 else
996
997 return E1000_SUCCESS;
998}
999
1011{
1012 s32 ret_val;
1013
1014 DEBUGFUNC("e1000_setup_link_generic");
1015
1016 /* In the case of the phy reset being blocked, we already have a link.
1017 * We do not need to set it up again.
1018 */
1019 if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw))
1020 return E1000_SUCCESS;
1021
1022 /* If requested flow control is set to default, set flow control
1023 * based on the EEPROM flow control settings.
1024 */
1025 if (hw->fc.requested_mode == e1000_fc_default) {
1026 ret_val = e1000_set_default_fc_generic(hw);
1027 if (ret_val)
1028 return ret_val;
1029 }
1030
1031 /* Save off the requested flow control mode for use later. Depending
1032 * on the link partner's capabilities, we may or may not use this mode.
1033 */
1034 hw->fc.current_mode = hw->fc.requested_mode;
1035
1036 DEBUGOUT1("After fix-ups FlowControl is now = %x\n",
1037 hw->fc.current_mode);
1038
1039 /* Call the necessary media_type subroutine to configure the link. */
1040 ret_val = hw->mac.ops.setup_physical_interface(hw);
1041 if (ret_val)
1042 return ret_val;
1043
1044 /* Initialize the flow control address, type, and PAUSE timer
1045 * registers to their default values. This is done even if flow
1046 * control is disabled, because it does not hurt anything to
1047 * initialize these registers.
1048 */
1049 DEBUGOUT("Initializing the Flow Control address, type and timer regs\n");
1053
1055
1057}
1058
1067{
1068 struct e1000_mac_info *mac = &hw->mac;
1069 u32 txcw;
1070
1071 DEBUGFUNC("e1000_commit_fc_settings_generic");
1072
1073 /* Check for a software override of the flow control settings, and
1074 * setup the device accordingly. If auto-negotiation is enabled, then
1075 * software will have to set the "PAUSE" bits to the correct value in
1076 * the Transmit Config Word Register (TXCW) and re-start auto-
1077 * negotiation. However, if auto-negotiation is disabled, then
1078 * software will have to manually configure the two flow control enable
1079 * bits in the CTRL register.
1080 *
1081 * The possible values of the "fc" parameter are:
1082 * 0: Flow control is completely disabled
1083 * 1: Rx flow control is enabled (we can receive pause frames,
1084 * but not send pause frames).
1085 * 2: Tx flow control is enabled (we can send pause frames but we
1086 * do not support receiving pause frames).
1087 * 3: Both Rx and Tx flow control (symmetric) are enabled.
1088 */
1089 switch (hw->fc.current_mode) {
1090 case e1000_fc_none:
1091 /* Flow control completely disabled by a software over-ride. */
1093 break;
1094 case e1000_fc_rx_pause:
1095 /* Rx Flow control is enabled and Tx Flow control is disabled
1096 * by a software over-ride. Since there really isn't a way to
1097 * advertise that we are capable of Rx Pause ONLY, we will
1098 * advertise that we support both symmetric and asymmetric Rx
1099 * PAUSE. Later, we will disable the adapter's ability to send
1100 * PAUSE frames.
1101 */
1103 break;
1104 case e1000_fc_tx_pause:
1105 /* Tx Flow control is enabled, and Rx Flow control is disabled,
1106 * by a software over-ride.
1107 */
1109 break;
1110 case e1000_fc_full:
1111 /* Flow control (both Rx and Tx) is enabled by a software
1112 * over-ride.
1113 */
1115 break;
1116 default:
1117 DEBUGOUT("Flow control param set incorrectly\n");
1118 return -E1000_ERR_CONFIG;
1119 break;
1120 }
1121
1123 mac->txcw = txcw;
1124
1125 return E1000_SUCCESS;
1126}
1127
1136{
1137 struct e1000_mac_info *mac = &hw->mac;
1138 u32 i, status;
1139 s32 ret_val;
1140
1141 DEBUGFUNC("e1000_poll_fiber_serdes_link_generic");
1142
1143 /* If we have a signal (the cable is plugged in, or assumed true for
1144 * serdes media) then poll for a "Link-Up" indication in the Device
1145 * Status Register. Time-out if a link isn't seen in 500 milliseconds
1146 * seconds (Auto-negotiation should complete in less than 500
1147 * milliseconds even if the other end is doing it in SW).
1148 */
1149 for (i = 0; i < FIBER_LINK_UP_LIMIT; i++) {
1150 msec_delay(10);
1151 status = E1000_READ_REG(hw, E1000_STATUS);
1152 if (status & E1000_STATUS_LU)
1153 break;
1154 }
1155 if (i == FIBER_LINK_UP_LIMIT) {
1156 DEBUGOUT("Never got a valid link from auto-neg!!!\n");
1157 mac->autoneg_failed = true;
1158 /* AutoNeg failed to achieve a link, so we'll call
1159 * mac->check_for_link. This routine will force the
1160 * link up if we detect a signal. This will allow us to
1161 * communicate with non-autonegotiating link partners.
1162 */
1163 ret_val = mac->ops.check_for_link(hw);
1164 if (ret_val) {
1165 DEBUGOUT("Error while checking for link\n");
1166 return ret_val;
1167 }
1168 mac->autoneg_failed = false;
1169 } else {
1170 mac->autoneg_failed = false;
1171 DEBUGOUT("Valid Link Found\n");
1172 }
1173
1174 return E1000_SUCCESS;
1175}
1176
1185{
1186 u32 ctrl;
1187 s32 ret_val;
1188
1189 DEBUGFUNC("e1000_setup_fiber_serdes_link_generic");
1190
1191 ctrl = E1000_READ_REG(hw, E1000_CTRL);
1192
1193 /* Take the link out of reset */
1194 ctrl &= ~E1000_CTRL_LRST;
1195
1197
1199 if (ret_val)
1200 return ret_val;
1201
1202 /* Since auto-negotiation is enabled, take the link out of reset (the
1203 * link will be in reset, because we previously reset the chip). This
1204 * will restart auto-negotiation. If auto-negotiation is successful
1205 * then the link-up status bit will be set and the flow control enable
1206 * bits (RFCE and TFCE) will be set according to their negotiated value.
1207 */
1208 DEBUGOUT("Auto-negotiation enabled\n");
1209
1210 E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
1212 msec_delay(1);
1213
1214 /* For these adapters, the SW definable pin 1 is set when the optics
1215 * detect a signal. If we have a signal, then poll for a "Link-Up"
1216 * indication.
1217 */
1221 } else {
1222 DEBUGOUT("No signal detected\n");
1223 }
1224
1225 return ret_val;
1226}
1227
1236{
1237 u32 tctl;
1238
1239 DEBUGFUNC("e1000_config_collision_dist_generic");
1240
1241 tctl = E1000_READ_REG(hw, E1000_TCTL);
1242
1243 tctl &= ~E1000_TCTL_COLD;
1245
1246 E1000_WRITE_REG(hw, E1000_TCTL, tctl);
1248}
1249
1259{
1260 u32 fcrtl = 0, fcrth = 0;
1261
1262 DEBUGFUNC("e1000_set_fc_watermarks_generic");
1263
1264 /* Set the flow control receive threshold registers. Normally,
1265 * these registers will be set to a default threshold that may be
1266 * adjusted later by the driver's runtime code. However, if the
1267 * ability to transmit pause frames is not enabled, then these
1268 * registers will be set to 0.
1269 */
1270 if (hw->fc.current_mode & e1000_fc_tx_pause) {
1271 /* We need to set up the Receive Threshold high and low water
1272 * marks as well as (optionally) enabling the transmission of
1273 * XON frames.
1274 */
1275 fcrtl = hw->fc.low_water;
1276 if (hw->fc.send_xon)
1277 fcrtl |= E1000_FCRTL_XONE;
1278
1279 fcrth = hw->fc.high_water;
1280 }
1281 E1000_WRITE_REG(hw, E1000_FCRTL, fcrtl);
1282 E1000_WRITE_REG(hw, E1000_FCRTH, fcrth);
1283
1284 return E1000_SUCCESS;
1285}
1286
1298{
1299 u32 ctrl;
1300
1301 DEBUGFUNC("e1000_force_mac_fc_generic");
1302
1303 ctrl = E1000_READ_REG(hw, E1000_CTRL);
1304
1305 /* Because we didn't get link via the internal auto-negotiation
1306 * mechanism (we either forced link or we got link via PHY
1307 * auto-neg), we have to manually enable/disable transmit an
1308 * receive flow control.
1309 *
1310 * The "Case" statement below enables/disable flow control
1311 * according to the "hw->fc.current_mode" parameter.
1312 *
1313 * The possible values of the "fc" parameter are:
1314 * 0: Flow control is completely disabled
1315 * 1: Rx flow control is enabled (we can receive pause
1316 * frames but not send pause frames).
1317 * 2: Tx flow control is enabled (we can send pause frames
1318 * frames but we do not receive pause frames).
1319 * 3: Both Rx and Tx flow control (symmetric) is enabled.
1320 * other: No other values should be possible at this point.
1321 */
1322 DEBUGOUT1("hw->fc.current_mode = %u\n", hw->fc.current_mode);
1323
1324 switch (hw->fc.current_mode) {
1325 case e1000_fc_none:
1326 ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE));
1327 break;
1328 case e1000_fc_rx_pause:
1329 ctrl &= (~E1000_CTRL_TFCE);
1330 ctrl |= E1000_CTRL_RFCE;
1331 break;
1332 case e1000_fc_tx_pause:
1333 ctrl &= (~E1000_CTRL_RFCE);
1334 ctrl |= E1000_CTRL_TFCE;
1335 break;
1336 case e1000_fc_full:
1337 ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE);
1338 break;
1339 default:
1340 DEBUGOUT("Flow control param set incorrectly\n");
1341 return -E1000_ERR_CONFIG;
1342 }
1343
1344 E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
1345
1346 return E1000_SUCCESS;
1347}
1348
1360{
1361 struct e1000_mac_info *mac = &hw->mac;
1362 s32 ret_val = E1000_SUCCESS;
1363 u32 pcs_status_reg, pcs_adv_reg, pcs_lp_ability_reg, pcs_ctrl_reg;
1364 u16 mii_status_reg, mii_nway_adv_reg, mii_nway_lp_ability_reg;
1365 u16 speed, duplex;
1366
1367 DEBUGFUNC("e1000_config_fc_after_link_up_generic");
1368
1369 /* Check for the case where we have fiber media and auto-neg failed
1370 * so we had to force link. In this case, we need to force the
1371 * configuration of the MAC to match the "fc" parameter.
1372 */
1373 if (mac->autoneg_failed) {
1376 ret_val = e1000_force_mac_fc_generic(hw);
1377 } else {
1379 ret_val = e1000_force_mac_fc_generic(hw);
1380 }
1381
1382 if (ret_val) {
1383 DEBUGOUT("Error forcing flow control settings\n");
1384 return ret_val;
1385 }
1386
1387 /* Check for the case where we have copper media and auto-neg is
1388 * enabled. In this case, we need to check and see if Auto-Neg
1389 * has completed, and if so, how the PHY and link partner has
1390 * flow control configured.
1391 */
1392 if ((hw->phy.media_type == e1000_media_type_copper) && mac->autoneg) {
1393 /* Read the MII Status Register and check to see if AutoNeg
1394 * has completed. We read this twice because this reg has
1395 * some "sticky" (latched) bits.
1396 */
1397 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &mii_status_reg);
1398 if (ret_val)
1399 return ret_val;
1400 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &mii_status_reg);
1401 if (ret_val)
1402 return ret_val;
1403
1404 if (!(mii_status_reg & MII_SR_AUTONEG_COMPLETE)) {
1405 DEBUGOUT("Copper PHY and Auto Neg has not completed.\n");
1406 return ret_val;
1407 }
1408
1409 /* The AutoNeg process has completed, so we now need to
1410 * read both the Auto Negotiation Advertisement
1411 * Register (Address 4) and the Auto_Negotiation Base
1412 * Page Ability Register (Address 5) to determine how
1413 * flow control was negotiated.
1414 */
1415 ret_val = hw->phy.ops.read_reg(hw, PHY_AUTONEG_ADV,
1416 &mii_nway_adv_reg);
1417 if (ret_val)
1418 return ret_val;
1419 ret_val = hw->phy.ops.read_reg(hw, PHY_LP_ABILITY,
1420 &mii_nway_lp_ability_reg);
1421 if (ret_val)
1422 return ret_val;
1423
1424 /* Two bits in the Auto Negotiation Advertisement Register
1425 * (Address 4) and two bits in the Auto Negotiation Base
1426 * Page Ability Register (Address 5) determine flow control
1427 * for both the PHY and the link partner. The following
1428 * table, taken out of the IEEE 802.3ab/D6.0 dated March 25,
1429 * 1999, describes these PAUSE resolution bits and how flow
1430 * control is determined based upon these settings.
1431 * NOTE: DC = Don't Care
1432 *
1433 * LOCAL DEVICE | LINK PARTNER
1434 * PAUSE | ASM_DIR | PAUSE | ASM_DIR | NIC Resolution
1435 *-------|---------|-------|---------|--------------------
1436 * 0 | 0 | DC | DC | e1000_fc_none
1437 * 0 | 1 | 0 | DC | e1000_fc_none
1438 * 0 | 1 | 1 | 0 | e1000_fc_none
1439 * 0 | 1 | 1 | 1 | e1000_fc_tx_pause
1440 * 1 | 0 | 0 | DC | e1000_fc_none
1441 * 1 | DC | 1 | DC | e1000_fc_full
1442 * 1 | 1 | 0 | 0 | e1000_fc_none
1443 * 1 | 1 | 0 | 1 | e1000_fc_rx_pause
1444 *
1445 * Are both PAUSE bits set to 1? If so, this implies
1446 * Symmetric Flow Control is enabled at both ends. The
1447 * ASM_DIR bits are irrelevant per the spec.
1448 *
1449 * For Symmetric Flow Control:
1450 *
1451 * LOCAL DEVICE | LINK PARTNER
1452 * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
1453 *-------|---------|-------|---------|--------------------
1454 * 1 | DC | 1 | DC | E1000_fc_full
1455 *
1456 */
1457 if ((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
1458 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) {
1459 /* Now we need to check if the user selected Rx ONLY
1460 * of pause frames. In this case, we had to advertise
1461 * FULL flow control because we could not advertise Rx
1462 * ONLY. Hence, we must now check to see if we need to
1463 * turn OFF the TRANSMISSION of PAUSE frames.
1464 */
1465 if (hw->fc.requested_mode == e1000_fc_full) {
1467 DEBUGOUT("Flow Control = FULL.\n");
1468 } else {
1470 DEBUGOUT("Flow Control = Rx PAUSE frames only.\n");
1471 }
1472 }
1473 /* For receiving PAUSE frames ONLY.
1474 *
1475 * LOCAL DEVICE | LINK PARTNER
1476 * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
1477 *-------|---------|-------|---------|--------------------
1478 * 0 | 1 | 1 | 1 | e1000_fc_tx_pause
1479 */
1480 else if (!(mii_nway_adv_reg & NWAY_AR_PAUSE) &&
1481 (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
1482 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
1483 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
1485 DEBUGOUT("Flow Control = Tx PAUSE frames only.\n");
1486 }
1487 /* For transmitting PAUSE frames ONLY.
1488 *
1489 * LOCAL DEVICE | LINK PARTNER
1490 * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
1491 *-------|---------|-------|---------|--------------------
1492 * 1 | 1 | 0 | 1 | e1000_fc_rx_pause
1493 */
1494 else if ((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
1495 (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
1496 !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
1497 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
1499 DEBUGOUT("Flow Control = Rx PAUSE frames only.\n");
1500 } else {
1501 /* Per the IEEE spec, at this point flow control
1502 * should be disabled.
1503 */
1505 DEBUGOUT("Flow Control = NONE.\n");
1506 }
1507
1508 /* Now we need to do one last check... If we auto-
1509 * negotiated to HALF DUPLEX, flow control should not be
1510 * enabled per IEEE 802.3 spec.
1511 */
1512 ret_val = mac->ops.get_link_up_info(hw, &speed, &duplex);
1513 if (ret_val) {
1514 DEBUGOUT("Error getting link speed and duplex\n");
1515 return ret_val;
1516 }
1517
1518 if (duplex == HALF_DUPLEX)
1520
1521 /* Now we call a subroutine to actually force the MAC
1522 * controller to use the correct flow control settings.
1523 */
1524 ret_val = e1000_force_mac_fc_generic(hw);
1525 if (ret_val) {
1526 DEBUGOUT("Error forcing flow control settings\n");
1527 return ret_val;
1528 }
1529 }
1530
1531 /* Check for the case where we have SerDes media and auto-neg is
1532 * enabled. In this case, we need to check and see if Auto-Neg
1533 * has completed, and if so, how the PHY and link partner has
1534 * flow control configured.
1535 */
1537 mac->autoneg) {
1538 /* Read the PCS_LSTS and check to see if AutoNeg
1539 * has completed.
1540 */
1541 pcs_status_reg = E1000_READ_REG(hw, E1000_PCS_LSTAT);
1542
1543 if (!(pcs_status_reg & E1000_PCS_LSTS_AN_COMPLETE)) {
1544 DEBUGOUT("PCS Auto Neg has not completed.\n");
1545 return ret_val;
1546 }
1547
1548 /* The AutoNeg process has completed, so we now need to
1549 * read both the Auto Negotiation Advertisement
1550 * Register (PCS_ANADV) and the Auto_Negotiation Base
1551 * Page Ability Register (PCS_LPAB) to determine how
1552 * flow control was negotiated.
1553 */
1554 pcs_adv_reg = E1000_READ_REG(hw, E1000_PCS_ANADV);
1555 pcs_lp_ability_reg = E1000_READ_REG(hw, E1000_PCS_LPAB);
1556
1557 /* Two bits in the Auto Negotiation Advertisement Register
1558 * (PCS_ANADV) and two bits in the Auto Negotiation Base
1559 * Page Ability Register (PCS_LPAB) determine flow control
1560 * for both the PHY and the link partner. The following
1561 * table, taken out of the IEEE 802.3ab/D6.0 dated March 25,
1562 * 1999, describes these PAUSE resolution bits and how flow
1563 * control is determined based upon these settings.
1564 * NOTE: DC = Don't Care
1565 *
1566 * LOCAL DEVICE | LINK PARTNER
1567 * PAUSE | ASM_DIR | PAUSE | ASM_DIR | NIC Resolution
1568 *-------|---------|-------|---------|--------------------
1569 * 0 | 0 | DC | DC | e1000_fc_none
1570 * 0 | 1 | 0 | DC | e1000_fc_none
1571 * 0 | 1 | 1 | 0 | e1000_fc_none
1572 * 0 | 1 | 1 | 1 | e1000_fc_tx_pause
1573 * 1 | 0 | 0 | DC | e1000_fc_none
1574 * 1 | DC | 1 | DC | e1000_fc_full
1575 * 1 | 1 | 0 | 0 | e1000_fc_none
1576 * 1 | 1 | 0 | 1 | e1000_fc_rx_pause
1577 *
1578 * Are both PAUSE bits set to 1? If so, this implies
1579 * Symmetric Flow Control is enabled at both ends. The
1580 * ASM_DIR bits are irrelevant per the spec.
1581 *
1582 * For Symmetric Flow Control:
1583 *
1584 * LOCAL DEVICE | LINK PARTNER
1585 * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
1586 *-------|---------|-------|---------|--------------------
1587 * 1 | DC | 1 | DC | e1000_fc_full
1588 *
1589 */
1590 if ((pcs_adv_reg & E1000_TXCW_PAUSE) &&
1591 (pcs_lp_ability_reg & E1000_TXCW_PAUSE)) {
1592 /* Now we need to check if the user selected Rx ONLY
1593 * of pause frames. In this case, we had to advertise
1594 * FULL flow control because we could not advertise Rx
1595 * ONLY. Hence, we must now check to see if we need to
1596 * turn OFF the TRANSMISSION of PAUSE frames.
1597 */
1598 if (hw->fc.requested_mode == e1000_fc_full) {
1600 DEBUGOUT("Flow Control = FULL.\n");
1601 } else {
1603 DEBUGOUT("Flow Control = Rx PAUSE frames only.\n");
1604 }
1605 }
1606 /* For receiving PAUSE frames ONLY.
1607 *
1608 * LOCAL DEVICE | LINK PARTNER
1609 * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
1610 *-------|---------|-------|---------|--------------------
1611 * 0 | 1 | 1 | 1 | e1000_fc_tx_pause
1612 */
1613 else if (!(pcs_adv_reg & E1000_TXCW_PAUSE) &&
1614 (pcs_adv_reg & E1000_TXCW_ASM_DIR) &&
1615 (pcs_lp_ability_reg & E1000_TXCW_PAUSE) &&
1616 (pcs_lp_ability_reg & E1000_TXCW_ASM_DIR)) {
1618 DEBUGOUT("Flow Control = Tx PAUSE frames only.\n");
1619 }
1620 /* For transmitting PAUSE frames ONLY.
1621 *
1622 * LOCAL DEVICE | LINK PARTNER
1623 * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
1624 *-------|---------|-------|---------|--------------------
1625 * 1 | 1 | 0 | 1 | e1000_fc_rx_pause
1626 */
1627 else if ((pcs_adv_reg & E1000_TXCW_PAUSE) &&
1628 (pcs_adv_reg & E1000_TXCW_ASM_DIR) &&
1629 !(pcs_lp_ability_reg & E1000_TXCW_PAUSE) &&
1630 (pcs_lp_ability_reg & E1000_TXCW_ASM_DIR)) {
1632 DEBUGOUT("Flow Control = Rx PAUSE frames only.\n");
1633 } else {
1634 /* Per the IEEE spec, at this point flow control
1635 * should be disabled.
1636 */
1638 DEBUGOUT("Flow Control = NONE.\n");
1639 }
1640
1641 /* Now we call a subroutine to actually force the MAC
1642 * controller to use the correct flow control settings.
1643 */
1644 pcs_ctrl_reg = E1000_READ_REG(hw, E1000_PCS_LCTL);
1645 pcs_ctrl_reg |= E1000_PCS_LCTL_FORCE_FCTRL;
1646 E1000_WRITE_REG(hw, E1000_PCS_LCTL, pcs_ctrl_reg);
1647
1648 ret_val = e1000_force_mac_fc_generic(hw);
1649 if (ret_val) {
1650 DEBUGOUT("Error forcing flow control settings\n");
1651 return ret_val;
1652 }
1653 }
1654
1655 return E1000_SUCCESS;
1656}
1657
1668 u16 *duplex)
1669{
1670 u32 status;
1671
1672 DEBUGFUNC("e1000_get_speed_and_duplex_copper_generic");
1673
1674 status = E1000_READ_REG(hw, E1000_STATUS);
1675 if (status & E1000_STATUS_SPEED_1000) {
1676 *speed = SPEED_1000;
1677 DEBUGOUT("1000 Mbs, ");
1678 } else if (status & E1000_STATUS_SPEED_100) {
1679 *speed = SPEED_100;
1680 DEBUGOUT("100 Mbs, ");
1681 } else {
1682 *speed = SPEED_10;
1683 DEBUGOUT("10 Mbs, ");
1684 }
1685
1686 if (status & E1000_STATUS_FD) {
1687 *duplex = FULL_DUPLEX;
1688 DEBUGOUT("Full Duplex\n");
1689 } else {
1690 *duplex = HALF_DUPLEX;
1691 DEBUGOUT("Half Duplex\n");
1692 }
1693
1694 return E1000_SUCCESS;
1695}
1696
1707 u16 *speed, u16 *duplex)
1708{
1709 DEBUGFUNC("e1000_get_speed_and_duplex_fiber_serdes_generic");
1710
1711 *speed = SPEED_1000;
1712 *duplex = FULL_DUPLEX;
1713
1714 return E1000_SUCCESS;
1715}
1716
1724{
1725 s32 i = 0;
1726
1727 DEBUGFUNC("e1000_get_auto_rd_done_generic");
1728
1729 while (i < AUTO_READ_DONE_TIMEOUT) {
1731 break;
1732 msec_delay(1);
1733 i++;
1734 }
1735
1736 if (i == AUTO_READ_DONE_TIMEOUT) {
1737 DEBUGOUT("Auto read by HW from NVM has not completed.\n");
1738 return -E1000_ERR_RESET;
1739 }
1740
1741 return E1000_SUCCESS;
1742}
1743
1753{
1754 s32 ret_val;
1755
1756 DEBUGFUNC("e1000_valid_led_default_generic");
1757
1758 ret_val = hw->nvm.ops.read(hw, NVM_ID_LED_SETTINGS, 1, data);
1759 if (ret_val) {
1760 DEBUGOUT("NVM Read Error\n");
1761 return ret_val;
1762 }
1763
1764 if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF)
1765 *data = ID_LED_DEFAULT;
1766
1767 return E1000_SUCCESS;
1768}
1769
1776{
1777 struct e1000_mac_info *mac = &hw->mac;
1778 s32 ret_val;
1779 const u32 ledctl_mask = 0x000000FF;
1780 const u32 ledctl_on = E1000_LEDCTL_MODE_LED_ON;
1781 const u32 ledctl_off = E1000_LEDCTL_MODE_LED_OFF;
1782 u16 data, i, temp;
1783 const u16 led_mask = 0x0F;
1784
1785 DEBUGFUNC("e1000_id_led_init_generic");
1786
1787 ret_val = hw->nvm.ops.valid_led_default(hw, &data);
1788 if (ret_val)
1789 return ret_val;
1790
1792 mac->ledctl_mode1 = mac->ledctl_default;
1793 mac->ledctl_mode2 = mac->ledctl_default;
1794
1795 for (i = 0; i < 4; i++) {
1796 temp = (data >> (i << 2)) & led_mask;
1797 switch (temp) {
1798 case ID_LED_ON1_DEF2:
1799 case ID_LED_ON1_ON2:
1800 case ID_LED_ON1_OFF2:
1801 mac->ledctl_mode1 &= ~(ledctl_mask << (i << 3));
1802 mac->ledctl_mode1 |= ledctl_on << (i << 3);
1803 break;
1804 case ID_LED_OFF1_DEF2:
1805 case ID_LED_OFF1_ON2:
1806 case ID_LED_OFF1_OFF2:
1807 mac->ledctl_mode1 &= ~(ledctl_mask << (i << 3));
1808 mac->ledctl_mode1 |= ledctl_off << (i << 3);
1809 break;
1810 default:
1811 /* Do nothing */
1812 break;
1813 }
1814 switch (temp) {
1815 case ID_LED_DEF1_ON2:
1816 case ID_LED_ON1_ON2:
1817 case ID_LED_OFF1_ON2:
1818 mac->ledctl_mode2 &= ~(ledctl_mask << (i << 3));
1819 mac->ledctl_mode2 |= ledctl_on << (i << 3);
1820 break;
1821 case ID_LED_DEF1_OFF2:
1822 case ID_LED_ON1_OFF2:
1823 case ID_LED_OFF1_OFF2:
1824 mac->ledctl_mode2 &= ~(ledctl_mask << (i << 3));
1825 mac->ledctl_mode2 |= ledctl_off << (i << 3);
1826 break;
1827 default:
1828 /* Do nothing */
1829 break;
1830 }
1831 }
1832
1833 return E1000_SUCCESS;
1834}
1835
1844{
1845 u32 ledctl;
1846
1847 DEBUGFUNC("e1000_setup_led_generic");
1848
1850 return -E1000_ERR_CONFIG;
1851
1853 ledctl = E1000_READ_REG(hw, E1000_LEDCTL);
1854 hw->mac.ledctl_default = ledctl;
1855 /* Turn off LED0 */
1858 ledctl |= (E1000_LEDCTL_MODE_LED_OFF <<
1860 E1000_WRITE_REG(hw, E1000_LEDCTL, ledctl);
1861 } else if (hw->phy.media_type == e1000_media_type_copper) {
1863 }
1864
1865 return E1000_SUCCESS;
1866}
1867
1876{
1877 DEBUGFUNC("e1000_cleanup_led_generic");
1878
1880 return E1000_SUCCESS;
1881}
1882
1890{
1891 u32 ledctl_blink = 0;
1892 u32 i;
1893
1894 DEBUGFUNC("e1000_blink_led_generic");
1895
1897 /* always blink LED0 for PCI-E fiber */
1898 ledctl_blink = E1000_LEDCTL_LED0_BLINK |
1900 } else {
1901 /* Set the blink bit for each LED that's "on" (0x0E)
1902 * (or "off" if inverted) in ledctl_mode2. The blink
1903 * logic in hardware only works when mode is set to "on"
1904 * so it must be changed accordingly when the mode is
1905 * "off" and inverted.
1906 */
1907 ledctl_blink = hw->mac.ledctl_mode2;
1908 for (i = 0; i < 32; i += 8) {
1909 u32 mode = (hw->mac.ledctl_mode2 >> i) &
1911 u32 led_default = hw->mac.ledctl_default >> i;
1912
1913 if ((!(led_default & E1000_LEDCTL_LED0_IVRT) &&
1914 (mode == E1000_LEDCTL_MODE_LED_ON)) ||
1915 ((led_default & E1000_LEDCTL_LED0_IVRT) &&
1916 (mode == E1000_LEDCTL_MODE_LED_OFF))) {
1917 ledctl_blink &=
1919 ledctl_blink |= (E1000_LEDCTL_LED0_BLINK |
1921 }
1922 }
1923 }
1924
1925 E1000_WRITE_REG(hw, E1000_LEDCTL, ledctl_blink);
1926
1927 return E1000_SUCCESS;
1928}
1929
1937{
1938 u32 ctrl;
1939
1940 DEBUGFUNC("e1000_led_on_generic");
1941
1942 switch (hw->phy.media_type) {
1944 ctrl = E1000_READ_REG(hw, E1000_CTRL);
1945 ctrl &= ~E1000_CTRL_SWDPIN0;
1946 ctrl |= E1000_CTRL_SWDPIO0;
1947 E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
1948 break;
1951 break;
1952 default:
1953 break;
1954 }
1955
1956 return E1000_SUCCESS;
1957}
1958
1966{
1967 u32 ctrl;
1968
1969 DEBUGFUNC("e1000_led_off_generic");
1970
1971 switch (hw->phy.media_type) {
1973 ctrl = E1000_READ_REG(hw, E1000_CTRL);
1974 ctrl |= E1000_CTRL_SWDPIN0;
1975 ctrl |= E1000_CTRL_SWDPIO0;
1976 E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
1977 break;
1980 break;
1981 default:
1982 break;
1983 }
1984
1985 return E1000_SUCCESS;
1986}
1987
1996{
1997 u32 gcr;
1998
1999 DEBUGFUNC("e1000_set_pcie_no_snoop_generic");
2000
2002 return;
2003
2004 if (no_snoop) {
2005 gcr = E1000_READ_REG(hw, E1000_GCR);
2006 gcr &= ~(PCIE_NO_SNOOP_ALL);
2007 gcr |= no_snoop;
2008 E1000_WRITE_REG(hw, E1000_GCR, gcr);
2009 }
2010}
2011
2024{
2025 u32 ctrl;
2026 s32 timeout = MASTER_DISABLE_TIMEOUT;
2027
2028 DEBUGFUNC("e1000_disable_pcie_master_generic");
2029
2031 return E1000_SUCCESS;
2032
2033 ctrl = E1000_READ_REG(hw, E1000_CTRL);
2035 E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
2036
2037 while (timeout) {
2038 if (!(E1000_READ_REG(hw, E1000_STATUS) &
2041 break;
2042 usec_delay(100);
2043 timeout--;
2044 }
2045
2046 if (!timeout) {
2047 DEBUGOUT("Master requests are pending.\n");
2049 }
2050
2051 return E1000_SUCCESS;
2052}
2053
2061{
2062 struct e1000_mac_info *mac = &hw->mac;
2063
2064 DEBUGFUNC("e1000_reset_adaptive_generic");
2065
2066 if (!mac->adaptive_ifs) {
2067 DEBUGOUT("Not in Adaptive IFS mode!\n");
2068 return;
2069 }
2070
2071 mac->current_ifs_val = 0;
2072 mac->ifs_min_val = IFS_MIN;
2073 mac->ifs_max_val = IFS_MAX;
2074 mac->ifs_step_size = IFS_STEP;
2075 mac->ifs_ratio = IFS_RATIO;
2076
2077 mac->in_ifs_mode = false;
2078 E1000_WRITE_REG(hw, E1000_AIT, 0);
2079}
2080
2089{
2090 struct e1000_mac_info *mac = &hw->mac;
2091
2092 DEBUGFUNC("e1000_update_adaptive_generic");
2093
2094 if (!mac->adaptive_ifs) {
2095 DEBUGOUT("Not in Adaptive IFS mode!\n");
2096 return;
2097 }
2098
2099 if ((mac->collision_delta * mac->ifs_ratio) > mac->tx_packet_delta) {
2100 if (mac->tx_packet_delta > MIN_NUM_XMITS) {
2101 mac->in_ifs_mode = true;
2102 if (mac->current_ifs_val < mac->ifs_max_val) {
2103 if (!mac->current_ifs_val)
2104 mac->current_ifs_val = mac->ifs_min_val;
2105 else
2106 mac->current_ifs_val +=
2107 mac->ifs_step_size;
2109 mac->current_ifs_val);
2110 }
2111 }
2112 } else {
2113 if (mac->in_ifs_mode &&
2114 (mac->tx_packet_delta <= MIN_NUM_XMITS)) {
2115 mac->current_ifs_val = 0;
2116 mac->in_ifs_mode = false;
2117 E1000_WRITE_REG(hw, E1000_AIT, 0);
2118 }
2119 }
2120}
2121
2130{
2131 DEBUGFUNC("e1000_validate_mdi_setting_generic");
2132
2133 if (!hw->mac.autoneg && (hw->phy.mdix == 0 || hw->phy.mdix == 3)) {
2134 DEBUGOUT("Invalid MDI setting detected\n");
2135 hw->phy.mdix = 1;
2136 return -E1000_ERR_CONFIG;
2137 }
2138
2139 return E1000_SUCCESS;
2140}
2141
2150{
2151 DEBUGFUNC("e1000_validate_mdi_setting_crossover_generic");
2152
2153 return E1000_SUCCESS;
2154}
2155
2168 u32 offset, u8 data)
2169{
2170 u32 i, regvalue = 0;
2171
2172 DEBUGFUNC("e1000_write_8bit_ctrl_reg_generic");
2173
2174 /* Set up the address and data */
2175 regvalue = ((u32)data) | (offset << E1000_GEN_CTL_ADDRESS_SHIFT);
2176 E1000_WRITE_REG(hw, reg, regvalue);
2177
2178 /* Poll the ready bit to see if the MDI read completed */
2179 for (i = 0; i < E1000_GEN_POLL_TIMEOUT; i++) {
2180 usec_delay(5);
2181 regvalue = E1000_READ_REG(hw, reg);
2182 if (regvalue & E1000_GEN_CTL_READY)
2183 break;
2184 }
2185 if (!(regvalue & E1000_GEN_CTL_READY)) {
2186 DEBUGOUT1("Reg %08x did not indicate ready\n", reg);
2187 return -E1000_ERR_PHY;
2188 }
2189
2190 return E1000_SUCCESS;
2191}
2192
2200{
2201 u32 swsm;
2202 s32 fw_timeout = hw->nvm.word_size + 1;
2203 s32 sw_timeout = hw->nvm.word_size + 1;
2204 s32 i = 0;
2205
2206 DEBUGFUNC("e1000_get_hw_semaphore");
2207
2208 /* _82571 */
2209 /* If we have timedout 3 times on trying to acquire
2210 * the inter-port SMBI semaphore, there is old code
2211 * operating on the other port, and it is not
2212 * releasing SMBI. Modify the number of times that
2213 * we try for the semaphore to interwork with this
2214 * older code.
2215 */
2216 if (hw->dev_spec._82571.smb_counter > 2)
2217 sw_timeout = 1;
2218
2219
2220 /* Get the SW semaphore */
2221 while (i < sw_timeout) {
2222 swsm = E1000_READ_REG(hw, E1000_SWSM);
2223 if (!(swsm & E1000_SWSM_SMBI))
2224 break;
2225
2226 usec_delay(50);
2227 i++;
2228 }
2229
2230 if (i == sw_timeout) {
2231 DEBUGOUT("Driver can't access device - SMBI bit is set.\n");
2233 }
2234
2235 /* In rare circumstances, the SW semaphore may already be held
2236 * unintentionally. Clear the semaphore once before giving up.
2237 */
2241 for (i = 0; i < fw_timeout; i++) {
2242 swsm = E1000_READ_REG(hw, E1000_SWSM);
2243 if (!(swsm & E1000_SWSM_SMBI))
2244 break;
2245
2246 usec_delay(50);
2247 }
2248 }
2249
2250 /* Get the FW semaphore. */
2251 for (i = 0; i < fw_timeout; i++) {
2252 swsm = E1000_READ_REG(hw, E1000_SWSM);
2254
2255 /* Semaphore acquired if bit latched */
2257 break;
2258
2259 usec_delay(50);
2260 }
2261
2262 if (i == fw_timeout) {
2263 /* Release semaphores */
2265 DEBUGOUT("Driver can't access the NVM\n");
2266 return -E1000_ERR_NVM;
2267 }
2268
2269 return E1000_SUCCESS;
2270}
2271
2279{
2280 u32 swsm;
2281
2282 DEBUGFUNC("e1000_put_hw_semaphore");
2283
2284 swsm = E1000_READ_REG(hw, E1000_SWSM);
2285
2287
2288 E1000_WRITE_REG(hw, E1000_SWSM, swsm);
2289}
2290
2291
2300s32
2302{
2303 u32 swfw_sync;
2304 u32 swmask = mask;
2305 u32 fwmask = mask << 16;
2306 s32 ret_val = E1000_SUCCESS;
2307 s32 i = 0, timeout = 200;
2308
2309 DEBUGFUNC("e1000_acquire_swfw_sync");
2311 while (i < timeout) {
2312 if (e1000_get_hw_semaphore(hw)) {
2313 ret_val = -E1000_ERR_SWFW_SYNC;
2314 goto out;
2315 }
2316
2317 swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC);
2318 if (!(swfw_sync & (fwmask | swmask)))
2319 break;
2320
2321 /*
2322 * Firmware currently using resource (fwmask)
2323 * or other software thread using resource (swmask)
2324 */
2326 msec_delay_irq(5);
2327 i++;
2328 }
2329
2330 if (i == timeout) {
2331 DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n");
2332 ret_val = -E1000_ERR_SWFW_SYNC;
2333 goto out;
2334 }
2335
2336 swfw_sync |= swmask;
2337 E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync);
2338
2340
2341out:
2342 return ret_val;
2343}
2344
2353void
2355{
2356 u32 swfw_sync;
2357
2358 DEBUGFUNC("e1000_release_swfw_sync");
2359
2361 ; /* Empty */
2362
2363 swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC);
2364 swfw_sync &= (u32)~mask;
2365 E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync);
2366
2368}
2369
#define ID_LED_RESERVED_0000
#define E1000_TXCW_ASM_DIR
#define ID_LED_OFF1_OFF2
#define E1000_ERR_PHY
#define MII_SR_AUTONEG_COMPLETE
#define NWAY_LPAR_ASM_DIR
#define E1000_STATUS_PCIX_SPEED_133
#define NWAY_LPAR_PAUSE
#define E1000_GEN_CTL_READY
#define NVM_ALT_MAC_ADDR_PTR
#define NVM_WORD0F_PAUSE_MASK
#define FLOW_CONTROL_ADDRESS_LOW
#define NWAY_AR_ASM_DIR
#define E1000_GEN_CTL_ADDRESS_SHIFT
#define E1000_PCS_LSTS_AN_COMPLETE
#define PCIE_LINK_SPEED_5000
#define ID_LED_DEFAULT
#define NVM_INIT_CONTROL2_REG
#define IFS_STEP
#define FLOW_CONTROL_ADDRESS_HIGH
#define SPEED_100
#define E1000_TXCW_FD
#define E1000_STATUS_PCIX_MODE
#define E1000_RXCW_IV
#define E1000_CTRL_GIO_MASTER_DISABLE
#define ID_LED_ON1_DEF2
#define E1000_STATUS_FUNC_SHIFT
#define PHY_STATUS
#define E1000_STATUS_SPEED_1000
#define E1000_LEDCTL_MODE_LED_OFF
#define SPEED_1000
#define E1000_CTRL_FD
#define PCIE_LINK_SPEED_2500
#define PCIX_COMMAND_REGISTER
#define E1000_TXCW_PAUSE_MASK
#define E1000_ERR_RESET
#define PCIE_LINK_WIDTH_MASK
#define E1000_FCRTL_XONE
#define E1000_STATUS_PCIX_SPEED_100
#define ID_LED_DEF1_OFF2
#define MASTER_DISABLE_TIMEOUT
#define PCIE_LINK_SPEED_MASK
#define HALF_DUPLEX
#define E1000_CTRL_SLU
#define ID_LED_DEF1_ON2
#define PCIX_STATUS_HI_MMRBC_2K
#define E1000_STATUS_SPEED_100
#define E1000_CTRL_TFCE
#define PCIX_STATUS_HI_MMRBC_SHIFT
#define PCI_HEADER_TYPE_MULTIFUNC
#define E1000_VLAN_FILTER_TBL_SIZE
#define FLOW_CONTROL_TYPE
#define E1000_ERR_MASTER_REQUESTS_PENDING
#define E1000_LEDCTL_LED0_MODE_SHIFT
#define ID_LED_OFF1_ON2
#define ID_LED_RESERVED_FFFF
#define ID_LED_ON1_ON2
#define PCIX_STATUS_HI_MMRBC_4K
#define IFS_MIN
#define E1000_RXCW_C
#define E1000_STATUS_FD
#define E1000_STATUS_PCI66
#define E1000_TXCW_ANE
#define NVM_82580_LAN_FUNC_OFFSET(a)
#define E1000_STATUS_PCIX_SPEED_66
#define AUTO_READ_DONE_TIMEOUT
#define IFS_MAX
#define PCIX_COMMAND_MMRBC_MASK
#define E1000_STATUS_LU
#define PCIE_LINK_STATUS
#define E1000_RXCW_SYNCH
#define E1000_LEDCTL_LED0_IVRT
#define PCIE_NO_SNOOP_ALL
#define E1000_COLD_SHIFT
#define PCIX_STATUS_REGISTER_HI
#define PCIX_COMMAND_MMRBC_SHIFT
#define PHY_LP_ABILITY
#define E1000_CTRL_SWDPIN1
#define E1000_ERR_SWFW_SYNC
#define ID_LED_ON1_OFF2
#define E1000_CTRL_SWDPIO0
#define PCI_HEADER_TYPE_REGISTER
#define NVM_WORD0F_ASM_DIR
#define IFS_RATIO
#define E1000_TXCW_PAUSE
#define E1000_LEDCTL_LED0_BLINK
#define ID_LED_OFF1_DEF2
#define SPEED_10
#define E1000_SWSM_SMBI
#define PCIX_STATUS_HI_MMRBC_MASK
#define NVM_COMPAT
#define E1000_PCS_LCTL_FORCE_FCTRL
#define E1000_CTRL_SWDPIN0
#define E1000_CTRL_RFCE
#define E1000_COLLISION_DISTANCE
#define E1000_ERR_CONFIG
#define E1000_LEDCTL_LED0_MODE_MASK
#define E1000_SWSM_SWESMBI
#define E1000_STATUS_PCIX_SPEED
#define NWAY_AR_PAUSE
#define MIN_NUM_XMITS
#define E1000_STATUS_FUNC_MASK
#define PCIE_LINK_WIDTH_SHIFT
#define E1000_SUCCESS
#define E1000_RAH_AV
#define E1000_GEN_POLL_TIMEOUT
#define FIBER_LINK_UP_LIMIT
#define E1000_STATUS_GIO_MASTER_ENABLE
#define E1000_UNUSEDARG
#define PHY_AUTONEG_ADV
#define E1000_EECD_AUTO_RD
#define E1000_LEDCTL_MODE_LED_ON
#define E1000_STATUS_BUS64
#define E1000_ERR_NVM
#define FULL_DUPLEX
#define NVM_ID_LED_SETTINGS
#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN2
Definition: e1000_hw.h:235
#define E1000_FUNC_1
Definition: e1000_hw.h:229
#define E1000_FUNC_3
Definition: e1000_hw.h:231
e1000_bus_width
Definition: e1000_hw.h:346
@ e1000_bus_width_64
Definition: e1000_hw.h:353
@ e1000_bus_width_32
Definition: e1000_hw.h:352
@ e1000_bus_width_unknown
Definition: e1000_hw.h:347
#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN3
Definition: e1000_hw.h:236
@ e1000_bus_type_pci
Definition: e1000_hw.h:328
@ e1000_bus_type_pcix
Definition: e1000_hw.h:329
@ e1000_bus_type_pci_express
Definition: e1000_hw.h:330
void e1000_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value)
Definition: e1000_osdep.c:45
@ e1000_bus_speed_5000
Definition: e1000_hw.h:342
@ e1000_bus_speed_reserved
Definition: e1000_hw.h:343
@ e1000_bus_speed_100
Definition: e1000_hw.h:338
@ e1000_bus_speed_66
Definition: e1000_hw.h:337
@ e1000_bus_speed_unknown
Definition: e1000_hw.h:335
@ e1000_bus_speed_133
Definition: e1000_hw.h:340
@ e1000_bus_speed_2500
Definition: e1000_hw.h:341
@ e1000_bus_speed_33
Definition: e1000_hw.h:336
@ e1000_82580
Definition: e1000_hw.h:271
@ e1000_i350
Definition: e1000_hw.h:272
@ e1000_82573
Definition: e1000_hw.h:254
@ e1000_82571
Definition: e1000_hw.h:252
s32 e1000_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value)
Definition: e1000_osdep.c:74
@ e1000_fc_none
Definition: e1000_hw.h:370
@ e1000_fc_default
Definition: e1000_hw.h:374
@ e1000_fc_full
Definition: e1000_hw.h:373
@ e1000_fc_tx_pause
Definition: e1000_hw.h:372
@ e1000_fc_rx_pause
Definition: e1000_hw.h:371
#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1
Definition: e1000_hw.h:234
@ e1000_media_type_fiber
Definition: e1000_hw.h:284
@ e1000_media_type_internal_serdes
Definition: e1000_hw.h:285
@ e1000_media_type_copper
Definition: e1000_hw.h:283
#define E1000_FUNC_2
Definition: e1000_hw.h:230
void e1000_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value)
Definition: e1000_osdep.c:51
void e1000_pcix_mmrbc_workaround_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:632
u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr)
Definition: e1000_mac.c:524
void e1000_reset_adaptive_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:2060
s32 e1000_get_bus_info_pcie_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:240
static void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw)
Definition: e1000_mac.c:286
s32 e1000_null_set_obff_timer(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG a)
Definition: e1000_mac.c:170
s32 e1000_get_hw_semaphore(struct e1000_hw *hw)
Definition: e1000_mac.c:2199
s32 e1000_null_link_info(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG *s, u16 E1000_UNUSEDARG *d)
Definition: e1000_mac.c:110
s32 e1000_valid_led_default_generic(struct e1000_hw *hw, u16 *data)
Definition: e1000_mac.c:1752
s32 e1000_check_for_copper_link_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:717
void e1000_init_mac_ops_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:48
void e1000_update_adaptive_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:2088
s32 e1000_validate_mdi_setting_crossover_generic(struct e1000_hw E1000_UNUSEDARG *hw)
Definition: e1000_mac.c:2149
static void e1000_config_collision_dist_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1235
s32 e1000_set_fc_watermarks_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1258
void e1000_set_lan_id_multi_port_pci(struct e1000_hw *hw)
Definition: e1000_mac.c:304
s32 e1000_id_led_init_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1775
bool e1000_null_mng_mode(struct e1000_hw E1000_UNUSEDARG *hw)
Definition: e1000_mac.c:121
s32 e1000_get_bus_info_pci_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:185
s32 e1000_acquire_swfw_sync(struct e1000_hw *hw, u16 mask)
Definition: e1000_mac.c:2301
s32 e1000_force_mac_fc_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1297
void e1000_put_hw_semaphore(struct e1000_hw *hw)
Definition: e1000_mac.c:2278
s32 e1000_led_on_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1936
s32 e1000_disable_pcie_master_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:2023
s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:408
static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:2129
s32 e1000_setup_link_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1010
void e1000_null_mac_generic(struct e1000_hw E1000_UNUSEDARG *hw)
Definition: e1000_mac.c:98
void e1000_clear_hw_cntrs_base_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:666
void e1000_release_swfw_sync(struct e1000_hw *hw, u16 mask)
Definition: e1000_mac.c:2354
s32 e1000_cleanup_led_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1875
int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index)
Definition: e1000_mac.c:486
s32 e1000_led_off_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1965
void e1000_update_mc_addr_list_generic(struct e1000_hw *hw, u8 *mc_addr_list, u32 mc_addr_count)
Definition: e1000_mac.c:595
s32 e1000_blink_led_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1889
s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1184
void e1000_clear_vfta_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:340
s32 e1000_poll_fiber_serdes_link_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1135
s32 e1000_commit_fc_settings_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1066
s32 e1000_check_for_fiber_link_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:782
s32 e1000_get_speed_and_duplex_copper_generic(struct e1000_hw *hw, u16 *speed, u16 *duplex)
Definition: e1000_mac.c:1667
void e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count)
Definition: e1000_mac.c:378
void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value)
Definition: e1000_mac.c:361
int e1000_null_rar_set(struct e1000_hw E1000_UNUSEDARG *hw, u8 E1000_UNUSEDARG *h, u32 E1000_UNUSEDARG a)
Definition: e1000_mac.c:159
s32 e1000_get_speed_and_duplex_fiber_serdes_generic(struct e1000_hw E1000_UNUSEDARG *hw, u16 *speed, u16 *duplex)
Definition: e1000_mac.c:1706
s32 e1000_set_default_fc_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:955
s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:849
void e1000_set_pcie_no_snoop_generic(struct e1000_hw *hw, u32 no_snoop)
Definition: e1000_mac.c:1995
void e1000_null_write_vfta(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG a, u32 E1000_UNUSEDARG b)
Definition: e1000_mac.c:146
s32 e1000_setup_led_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1843
s32 e1000_null_ops_generic(struct e1000_hw E1000_UNUSEDARG *hw)
Definition: e1000_mac.c:88
void e1000_null_update_mc(struct e1000_hw E1000_UNUSEDARG *hw, u8 E1000_UNUSEDARG *h, u32 E1000_UNUSEDARG a)
Definition: e1000_mac.c:133
s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1359
void e1000_set_lan_id_single_port(struct e1000_hw *hw)
Definition: e1000_mac.c:326
s32 e1000_write_8bit_ctrl_reg_generic(struct e1000_hw *hw, u32 reg, u32 offset, u8 data)
Definition: e1000_mac.c:2167
s32 e1000_get_auto_rd_done_generic(struct e1000_hw *hw)
Definition: e1000_mac.c:1723
#define E1000_REMOVED(a)
Definition: e1000_mac.h:40
s32 e1000_read_mac_addr_generic(struct e1000_hw *hw)
Definition: e1000_nvm.c:1174
#define DEBUGOUT1(...)
Definition: e1000_osdep.h:111
#define msec_delay(x)
Definition: e1000_osdep.h:103
#define usec_delay(x)
Definition: e1000_osdep.h:101
#define E1000_WRITE_REG_ARRAY(hw, reg, index, value)
Definition: e1000_osdep.h:206
uint8_t u8
Definition: e1000_osdep.h:124
#define DEBUGFUNC(F)
Definition: e1000_osdep.h:115
#define ASSERT_NO_LOCKS()
Definition: e1000_osdep.h:267
#define E1000_WRITE_FLUSH(a)
Definition: e1000_osdep.h:177
#define E1000_WRITE_REG(hw, reg, value)
Definition: e1000_osdep.h:196
uint16_t u16
Definition: e1000_osdep.h:123
#define DEBUGOUT(...)
Definition: e1000_osdep.h:109
#define msec_delay_irq(x)
Definition: e1000_osdep.h:104
#define E1000_READ_REG(hw, reg)
Definition: e1000_osdep.h:191
int32_t s32
Definition: e1000_osdep.h:126
uint32_t u32
Definition: e1000_osdep.h:122
s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, u32 usec_interval, bool *success)
Definition: e1000_phy.c:2360
s32 e1000_check_downshift_generic(struct e1000_hw *hw)
Definition: e1000_phy.c:2172
#define E1000_RFC
Definition: e1000_regs.h:362
#define E1000_TORH
Definition: e1000_regs.h:369
#define E1000_GORCH
Definition: e1000_regs.h:357
#define E1000_GCR
Definition: e1000_regs.h:536
#define E1000_TOTH
Definition: e1000_regs.h:371
#define E1000_FCTTV
Definition: e1000_regs.h:90
#define E1000_ECOL
Definition: e1000_regs.h:332
#define E1000_PCS_LPAB
Definition: e1000_regs.h:490
#define E1000_TORL
Definition: e1000_regs.h:368
#define E1000_GORCL
Definition: e1000_regs.h:356
#define E1000_VFTA
Definition: e1000_regs.h:499
#define E1000_FCAL
Definition: e1000_regs.h:61
#define E1000_FCRTL
Definition: e1000_regs.h:150
#define E1000_TPT
Definition: e1000_regs.h:373
#define E1000_SCC
Definition: e1000_regs.h:331
#define E1000_TXCW
Definition: e1000_regs.h:91
#define E1000_XONRXC
Definition: e1000_regs.h:341
#define E1000_TPR
Definition: e1000_regs.h:372
#define E1000_PCS_ANADV
Definition: e1000_regs.h:489
#define E1000_RAH(_i)
Definition: e1000_regs.h:292
#define E1000_RJC
Definition: e1000_regs.h:364
#define E1000_XONTXC
Definition: e1000_regs.h:342
#define E1000_COLC
Definition: e1000_regs.h:335
#define E1000_PCS_LCTL
Definition: e1000_regs.h:473
#define E1000_RNBC
Definition: e1000_regs.h:360
#define E1000_GOTCH
Definition: e1000_regs.h:359
#define E1000_GPRC
Definition: e1000_regs.h:352
#define E1000_RXCW
Definition: e1000_regs.h:92
#define E1000_BPTC
Definition: e1000_regs.h:381
#define E1000_SWSM
Definition: e1000_regs.h:544
#define E1000_TCTL
Definition: e1000_regs.h:104
#define E1000_LATECOL
Definition: e1000_regs.h:334
#define E1000_STATUS
Definition: e1000_regs.h:41
#define E1000_TOTL
Definition: e1000_regs.h:370
#define E1000_DC
Definition: e1000_regs.h:336
#define E1000_SEC
Definition: e1000_regs.h:338
#define E1000_XOFFTXC
Definition: e1000_regs.h:344
#define E1000_GPTC
Definition: e1000_regs.h:355
#define E1000_FCT
Definition: e1000_regs.h:76
#define E1000_MPTC
Definition: e1000_regs.h:380
#define E1000_MCC
Definition: e1000_regs.h:333
#define E1000_CTRL
Definition: e1000_regs.h:39
#define E1000_SYMERRS
Definition: e1000_regs.h:328
#define E1000_RUC
Definition: e1000_regs.h:361
#define E1000_CRCERRS
Definition: e1000_regs.h:326
#define E1000_RLEC
Definition: e1000_regs.h:340
#define E1000_PCS_LSTAT
Definition: e1000_regs.h:474
#define E1000_MPC
Definition: e1000_regs.h:330
#define E1000_BPRC
Definition: e1000_regs.h:353
#define E1000_LEDCTL
Definition: e1000_regs.h:109
#define E1000_FCAH
Definition: e1000_regs.h:62
#define E1000_ROC
Definition: e1000_regs.h:363
#define E1000_MTA
Definition: e1000_regs.h:496
#define E1000_FCRUC
Definition: e1000_regs.h:345
#define E1000_AIT
Definition: e1000_regs.h:108
#define E1000_MPRC
Definition: e1000_regs.h:354
#define E1000_EECD
Definition: e1000_regs.h:42
#define E1000_GOTCL
Definition: e1000_regs.h:358
#define E1000_FCRTH
Definition: e1000_regs.h:151
#define E1000_RAL(_i)
Definition: e1000_regs.h:290
#define E1000_SW_FW_SYNC
Definition: e1000_regs.h:531
#define E1000_XOFFRXC
Definition: e1000_regs.h:343
enum e1000_bus_speed speed
Definition: e1000_hw.h:905
enum e1000_bus_type type
Definition: e1000_hw.h:904
enum e1000_bus_width width
Definition: e1000_hw.h:906
enum e1000_fc_mode current_mode
Definition: e1000_hw.h:919
u16 pause_time
Definition: e1000_hw.h:915
u32 high_water
Definition: e1000_hw.h:913
enum e1000_fc_mode requested_mode
Definition: e1000_hw.h:920
bool send_xon
Definition: e1000_hw.h:917
union e1000_hw::@46 dev_spec
struct e1000_bus_info bus
Definition: e1000_hw.h:1032
struct e1000_mac_info mac
Definition: e1000_hw.h:1028
struct e1000_dev_spec_82571 _82571
Definition: e1000_hw.h:1040
struct e1000_dev_spec_82575 _82575
Definition: e1000_hw.h:1043
struct e1000_nvm_info nvm
Definition: e1000_hw.h:1031
u8 * hw_addr
Definition: e1000_hw.h:1024
struct e1000_fc_info fc
Definition: e1000_hw.h:1029
struct e1000_phy_info phy
Definition: e1000_hw.h:1030
u32 collision_delta
Definition: e1000_hw.h:817
enum e1000_mac_type type
Definition: e1000_hw.h:815
u32 tx_packet_delta
Definition: e1000_hw.h:822
u8 addr[ETHER_ADDR_LEN]
Definition: e1000_hw.h:812
u32 ledctl_default
Definition: e1000_hw.h:818
bool adaptive_ifs
Definition: e1000_hw.h:840
u16 ifs_step_size
Definition: e1000_hw.h:829
bool get_link_status
Definition: e1000_hw.h:846
u32 ledctl_mode1
Definition: e1000_hw.h:819
u32 mc_filter_type
Definition: e1000_hw.h:821
u16 mta_reg_count
Definition: e1000_hw.h:830
bool serdes_has_link
Definition: e1000_hw.h:850
u32 ledctl_mode2
Definition: e1000_hw.h:820
bool in_ifs_mode
Definition: e1000_hw.h:847
struct e1000_mac_operations ops
Definition: e1000_hw.h:811
u32 mta_shadow[MAX_MTA_REG]
Definition: e1000_hw.h:835
bool autoneg_failed
Definition: e1000_hw.h:845
u16 current_ifs_val
Definition: e1000_hw.h:825
s32(* setup_led)(struct e1000_hw *)
Definition: e1000_hw.h:744
s32(* get_link_up_info)(struct e1000_hw *, u16 *, u16 *)
Definition: e1000_hw.h:734
s32(* setup_physical_interface)(struct e1000_hw *)
Definition: e1000_hw.h:743
s32(* validate_mdi_setting)(struct e1000_hw *)
Definition: e1000_hw.h:749
s32(* check_for_link)(struct e1000_hw *)
Definition: e1000_hw.h:728
void(* config_collision_dist)(struct e1000_hw *)
Definition: e1000_hw.h:746
void(* clear_vfta)(struct e1000_hw *)
Definition: e1000_hw.h:731
s32(* blink_led)(struct e1000_hw *)
Definition: e1000_hw.h:726
s32(* reset_hw)(struct e1000_hw *)
Definition: e1000_hw.h:738
s32(* set_obff_timer)(struct e1000_hw *, u32)
Definition: e1000_hw.h:750
s32(* led_on)(struct e1000_hw *)
Definition: e1000_hw.h:735
s32(* read_mac_addr)(struct e1000_hw *)
Definition: e1000_hw.h:748
void(* write_vfta)(struct e1000_hw *, u32, u32)
Definition: e1000_hw.h:745
int(* rar_set)(struct e1000_hw *, u8 *, u32)
Definition: e1000_hw.h:747
s32(* init_hw)(struct e1000_hw *)
Definition: e1000_hw.h:739
s32(* setup_link)(struct e1000_hw *)
Definition: e1000_hw.h:742
s32(* cleanup_led)(struct e1000_hw *)
Definition: e1000_hw.h:729
void(* clear_hw_cntrs)(struct e1000_hw *)
Definition: e1000_hw.h:730
void(* set_lan_id)(struct e1000_hw *)
Definition: e1000_hw.h:733
void(* update_mc_addr_list)(struct e1000_hw *, u8 *, u32)
Definition: e1000_hw.h:737
s32(* led_off)(struct e1000_hw *)
Definition: e1000_hw.h:736
bool(* check_mng_mode)(struct e1000_hw *)
Definition: e1000_hw.h:727
s32(* get_bus_info)(struct e1000_hw *)
Definition: e1000_hw.h:732
s32(* init_params)(struct e1000_hw *)
Definition: e1000_hw.h:724
struct e1000_nvm_operations ops
Definition: e1000_hw.h:889
s32(* read)(struct e1000_hw *, u16, u16, u16 *)
Definition: e1000_hw.h:801
s32(* valid_led_default)(struct e1000_hw *, u16 *)
Definition: e1000_hw.h:805
enum e1000_media_type media_type
Definition: e1000_hw.h:871
struct e1000_phy_operations ops
Definition: e1000_hw.h:856
s32(* read_reg)(struct e1000_hw *, u32, u16 *)
Definition: e1000_hw.h:781
s32(* check_reset_block)(struct e1000_hw *)
Definition: e1000_hw.h:774