diff options
author | dhananjay.phadke@gmail.com <dhananjay.phadke@gmail.com> | 2007-07-01 14:56:00 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-02 08:24:52 -0400 |
commit | 2d1a3bbdf21d05e16703c8d608628ae4676eb3ac (patch) | |
tree | 64df196fd0cd4dcc17f614ab65a25637f1ce5531 /drivers/net/netxen/netxen_nic.h | |
parent | 644caeefb3bbf539e74b7098648ff0bfc9e52bb3 (diff) |
RESEND [PATCH 2/3] NetXen: Support per PCI-function interrupt mask registers
This patch updates the various access routines to access different
control and status settings present in different register locations.
This will fix problems related to working of different ports in
multi Port card.
Signed-off by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off by: Milan Bag <mbag@netxen.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/netxen/netxen_nic.h')
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 102 |
1 files changed, 86 insertions, 16 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 91f25e0a638e..6ce93fcbed32 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -937,6 +937,7 @@ struct netxen_adapter { | |||
937 | struct netxen_ring_ctx *ctx_desc; | 937 | struct netxen_ring_ctx *ctx_desc; |
938 | struct pci_dev *ctx_desc_pdev; | 938 | struct pci_dev *ctx_desc_pdev; |
939 | dma_addr_t ctx_desc_phys_addr; | 939 | dma_addr_t ctx_desc_phys_addr; |
940 | int intr_scheme; | ||
940 | int (*enable_phy_interrupts) (struct netxen_adapter *); | 941 | int (*enable_phy_interrupts) (struct netxen_adapter *); |
941 | int (*disable_phy_interrupts) (struct netxen_adapter *); | 942 | int (*disable_phy_interrupts) (struct netxen_adapter *); |
942 | void (*handle_phy_intr) (struct netxen_adapter *); | 943 | void (*handle_phy_intr) (struct netxen_adapter *); |
@@ -1080,37 +1081,106 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev); | |||
1080 | 1081 | ||
1081 | static inline void netxen_nic_disable_int(struct netxen_adapter *adapter) | 1082 | static inline void netxen_nic_disable_int(struct netxen_adapter *adapter) |
1082 | { | 1083 | { |
1083 | /* | 1084 | uint32_t mask = 0x7ff; |
1084 | * ISR_INT_MASK: Can be read from window 0 or 1. | 1085 | int retries = 32; |
1085 | */ | 1086 | |
1086 | writel(0x7ff, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)); | 1087 | DPRINTK(1, INFO, "Entered ISR Disable \n"); |
1088 | |||
1089 | switch (adapter->portnum) { | ||
1090 | case 0: | ||
1091 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0)); | ||
1092 | break; | ||
1093 | case 1: | ||
1094 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1)); | ||
1095 | break; | ||
1096 | case 2: | ||
1097 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2)); | ||
1098 | break; | ||
1099 | case 3: | ||
1100 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3)); | ||
1101 | break; | ||
1102 | } | ||
1103 | |||
1104 | if (adapter->intr_scheme != -1 && | ||
1105 | adapter->intr_scheme != INTR_SCHEME_PERPORT) { | ||
1106 | writel(mask, | ||
1107 | (void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK))); | ||
1108 | } | ||
1109 | |||
1110 | /* Window = 0 or 1 */ | ||
1111 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { | ||
1112 | do { | ||
1113 | writel(0xffffffff, (void *) | ||
1114 | (PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_STATUS))); | ||
1115 | mask = readl((void *) | ||
1116 | (pci_base_offset(adapter, ISR_INT_VECTOR))); | ||
1117 | if (!(mask & 0x80)) | ||
1118 | break; | ||
1119 | udelay(10); | ||
1120 | } while (--retries); | ||
1121 | |||
1122 | if (!retries) { | ||
1123 | printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n", | ||
1124 | netxen_nic_driver_name); | ||
1125 | } | ||
1126 | } | ||
1127 | |||
1128 | DPRINTK(1, INFO, "Done with Disable Int\n"); | ||
1087 | 1129 | ||
1130 | return; | ||
1088 | } | 1131 | } |
1089 | 1132 | ||
1090 | static inline void netxen_nic_enable_int(struct netxen_adapter *adapter) | 1133 | static inline void netxen_nic_enable_int(struct netxen_adapter *adapter) |
1091 | { | 1134 | { |
1092 | u32 mask; | 1135 | u32 mask; |
1093 | 1136 | ||
1094 | switch (adapter->ahw.board_type) { | 1137 | DPRINTK(1, INFO, "Entered ISR Enable \n"); |
1095 | case NETXEN_NIC_GBE: | 1138 | |
1096 | mask = 0x77b; | 1139 | if (adapter->intr_scheme != -1 && |
1140 | adapter->intr_scheme != INTR_SCHEME_PERPORT) { | ||
1141 | switch (adapter->ahw.board_type) { | ||
1142 | case NETXEN_NIC_GBE: | ||
1143 | mask = 0x77b; | ||
1144 | break; | ||
1145 | case NETXEN_NIC_XGBE: | ||
1146 | mask = 0x77f; | ||
1147 | break; | ||
1148 | default: | ||
1149 | mask = 0x7ff; | ||
1150 | break; | ||
1151 | } | ||
1152 | |||
1153 | writel(mask, | ||
1154 | (void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK))); | ||
1155 | } | ||
1156 | switch (adapter->portnum) { | ||
1157 | case 0: | ||
1158 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0)); | ||
1097 | break; | 1159 | break; |
1098 | case NETXEN_NIC_XGBE: | 1160 | case 1: |
1099 | mask = 0x77f; | 1161 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1)); |
1100 | break; | 1162 | break; |
1101 | default: | 1163 | case 2: |
1102 | mask = 0x7ff; | 1164 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2)); |
1165 | break; | ||
1166 | case 3: | ||
1167 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3)); | ||
1103 | break; | 1168 | break; |
1104 | } | 1169 | } |
1105 | 1170 | ||
1106 | writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)); | ||
1107 | |||
1108 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { | 1171 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { |
1109 | mask = 0xbff; | 1172 | mask = 0xbff; |
1110 | writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR)); | 1173 | if (adapter->intr_scheme != -1 && |
1111 | writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, | 1174 | adapter->intr_scheme != INTR_SCHEME_PERPORT) { |
1112 | ISR_INT_TARGET_MASK)); | 1175 | writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR)); |
1176 | } | ||
1177 | writel(mask, | ||
1178 | (void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK))); | ||
1113 | } | 1179 | } |
1180 | |||
1181 | DPRINTK(1, INFO, "Done with enable Int\n"); | ||
1182 | |||
1183 | return; | ||
1114 | } | 1184 | } |
1115 | 1185 | ||
1116 | /* | 1186 | /* |