aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netxen/netxen_nic_hw.c')
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c65
1 files changed, 27 insertions, 38 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 93466ec64074..a472873f48bd 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -609,33 +609,10 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw)
609 void __iomem *offset; 609 void __iomem *offset;
610 u32 tmp; 610 u32 tmp;
611 int count = 0; 611 int count = 0;
612 uint8_t func = adapter->ahw.pci_func;
612 613
613 if (adapter->curr_window == wndw) 614 if (adapter->curr_window == wndw)
614 return; 615 return;
615 switch(adapter->ahw.pci_func) {
616 case 0:
617 offset = PCI_OFFSET_SECOND_RANGE(adapter,
618 NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW));
619 break;
620 case 1:
621 offset = PCI_OFFSET_SECOND_RANGE(adapter,
622 NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW_F1));
623 break;
624 case 2:
625 offset = PCI_OFFSET_SECOND_RANGE(adapter,
626 NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW_F2));
627 break;
628 case 3:
629 offset = PCI_OFFSET_SECOND_RANGE(adapter,
630 NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW_F3));
631 break;
632 default:
633 printk(KERN_INFO "Changing the window for PCI function "
634 "%d\n", adapter->ahw.pci_func);
635 offset = PCI_OFFSET_SECOND_RANGE(adapter,
636 NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW));
637 break;
638 }
639 /* 616 /*
640 * Move the CRB window. 617 * Move the CRB window.
641 * We need to write to the "direct access" region of PCI 618 * We need to write to the "direct access" region of PCI
@@ -644,6 +621,8 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw)
644 * register address is received by PCI. The direct region bypasses 621 * register address is received by PCI. The direct region bypasses
645 * the CRB bus. 622 * the CRB bus.
646 */ 623 */
624 offset = PCI_OFFSET_SECOND_RANGE(adapter,
625 NETXEN_PCIX_PH_REG(PCIE_CRB_WINDOW_REG(func)));
647 626
648 if (wndw & 0x1) 627 if (wndw & 0x1)
649 wndw = NETXEN_WINDOW_ONE; 628 wndw = NETXEN_WINDOW_ONE;
@@ -857,9 +836,11 @@ static int netxen_pci_set_window_warning_count;
857static unsigned long netxen_nic_pci_set_window(struct netxen_adapter *adapter, 836static unsigned long netxen_nic_pci_set_window(struct netxen_adapter *adapter,
858 unsigned long long addr) 837 unsigned long long addr)
859{ 838{
839 void __iomem *offset;
860 static int ddr_mn_window = -1; 840 static int ddr_mn_window = -1;
861 static int qdr_sn_window = -1; 841 static int qdr_sn_window = -1;
862 int window; 842 int window;
843 uint8_t func = adapter->ahw.pci_func;
863 844
864 if (ADDR_IN_RANGE(addr, NETXEN_ADDR_DDR_NET, NETXEN_ADDR_DDR_NET_MAX)) { 845 if (ADDR_IN_RANGE(addr, NETXEN_ADDR_DDR_NET, NETXEN_ADDR_DDR_NET_MAX)) {
865 /* DDR network side */ 846 /* DDR network side */
@@ -867,13 +848,11 @@ static unsigned long netxen_nic_pci_set_window(struct netxen_adapter *adapter,
867 window = (addr >> 25) & 0x3ff; 848 window = (addr >> 25) & 0x3ff;
868 if (ddr_mn_window != window) { 849 if (ddr_mn_window != window) {
869 ddr_mn_window = window; 850 ddr_mn_window = window;
870 writel(window, PCI_OFFSET_SECOND_RANGE(adapter, 851 offset = PCI_OFFSET_SECOND_RANGE(adapter,
871 NETXEN_PCIX_PH_REG 852 NETXEN_PCIX_PH_REG(PCIE_MN_WINDOW_REG(func)));
872 (PCIX_MN_WINDOW(adapter->ahw.pci_func)))); 853 writel(window, offset);
873 /* MUST make sure window is set before we forge on... */ 854 /* MUST make sure window is set before we forge on... */
874 readl(PCI_OFFSET_SECOND_RANGE(adapter, 855 readl(offset);
875 NETXEN_PCIX_PH_REG
876 (PCIX_MN_WINDOW(adapter->ahw.pci_func))));
877 } 856 }
878 addr -= (window * NETXEN_WINDOW_ONE); 857 addr -= (window * NETXEN_WINDOW_ONE);
879 addr += NETXEN_PCI_DDR_NET; 858 addr += NETXEN_PCI_DDR_NET;
@@ -885,20 +864,17 @@ static unsigned long netxen_nic_pci_set_window(struct netxen_adapter *adapter,
885 addr += NETXEN_PCI_OCM1; 864 addr += NETXEN_PCI_OCM1;
886 } else 865 } else
887 if (ADDR_IN_RANGE 866 if (ADDR_IN_RANGE
888 (addr, NETXEN_ADDR_QDR_NET, NETXEN_ADDR_QDR_NET_MAX)) { 867 (addr, NETXEN_ADDR_QDR_NET, NETXEN_ADDR_QDR_NET_MAX_P2)) {
889 /* QDR network side */ 868 /* QDR network side */
890 addr -= NETXEN_ADDR_QDR_NET; 869 addr -= NETXEN_ADDR_QDR_NET;
891 window = (addr >> 22) & 0x3f; 870 window = (addr >> 22) & 0x3f;
892 if (qdr_sn_window != window) { 871 if (qdr_sn_window != window) {
893 qdr_sn_window = window; 872 qdr_sn_window = window;
894 writel((window << 22), 873 offset = PCI_OFFSET_SECOND_RANGE(adapter,
895 PCI_OFFSET_SECOND_RANGE(adapter, 874 NETXEN_PCIX_PH_REG(PCIE_SN_WINDOW_REG(func)));
896 NETXEN_PCIX_PH_REG 875 writel((window << 22), offset);
897 (PCIX_SN_WINDOW(adapter->ahw.pci_func))));
898 /* MUST make sure window is set before we forge on... */ 876 /* MUST make sure window is set before we forge on... */
899 readl(PCI_OFFSET_SECOND_RANGE(adapter, 877 readl(offset);
900 NETXEN_PCIX_PH_REG
901 (PCIX_SN_WINDOW(adapter->ahw.pci_func))));
902 } 878 }
903 addr -= (window * 0x400000); 879 addr -= (window * 0x400000);
904 addr += NETXEN_PCI_QDR_NET; 880 addr += NETXEN_PCI_QDR_NET;
@@ -972,12 +948,25 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
972 case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ: 948 case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ:
973 case NETXEN_BRDTYPE_P2_SB31_10G_HMEZ: 949 case NETXEN_BRDTYPE_P2_SB31_10G_HMEZ:
974 case NETXEN_BRDTYPE_P2_SB31_10G_CX4: 950 case NETXEN_BRDTYPE_P2_SB31_10G_CX4:
951 case NETXEN_BRDTYPE_P3_HMEZ:
952 case NETXEN_BRDTYPE_P3_XG_LOM:
953 case NETXEN_BRDTYPE_P3_10G_CX4:
954 case NETXEN_BRDTYPE_P3_10G_CX4_LP:
955 case NETXEN_BRDTYPE_P3_IMEZ:
956 case NETXEN_BRDTYPE_P3_10G_SFP_PLUS:
957 case NETXEN_BRDTYPE_P3_10G_XFP:
958 case NETXEN_BRDTYPE_P3_10000_BASE_T:
959
975 adapter->ahw.board_type = NETXEN_NIC_XGBE; 960 adapter->ahw.board_type = NETXEN_NIC_XGBE;
976 break; 961 break;
977 case NETXEN_BRDTYPE_P1_BD: 962 case NETXEN_BRDTYPE_P1_BD:
978 case NETXEN_BRDTYPE_P1_SB: 963 case NETXEN_BRDTYPE_P1_SB:
979 case NETXEN_BRDTYPE_P1_SMAX: 964 case NETXEN_BRDTYPE_P1_SMAX:
980 case NETXEN_BRDTYPE_P1_SOCK: 965 case NETXEN_BRDTYPE_P1_SOCK:
966 case NETXEN_BRDTYPE_P3_REF_QG:
967 case NETXEN_BRDTYPE_P3_4_GB:
968 case NETXEN_BRDTYPE_P3_4_GB_MM:
969
981 adapter->ahw.board_type = NETXEN_NIC_GBE; 970 adapter->ahw.board_type = NETXEN_NIC_GBE;
982 break; 971 break;
983 default: 972 default: