diff options
author | Bruce Allan <bruce.w.allan@intel.com> | 2010-01-12 21:05:18 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-13 23:31:57 -0500 |
commit | f4d2dd4cd4d001f5dc20fc76c780c0c20c000c23 (patch) | |
tree | c056667e1787a0f9c63d42f7a61924cf98a52eb5 /drivers | |
parent | 608f8a0d014db6cd18d4f535934d4b5d556e3013 (diff) |
e1000e: provide MAC-family-specific function to set LAN ID
Provide MAC-specific function pointer to determine the LAN ID (PCI func).
The LAN ID is used internally by the driver to determine which h/w lock
to use to protect accessing the PHY on ESB2 as well as help to determine
the alternate MAC address on some parts.
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/e1000e/82571.c | 7 | ||||
-rw-r--r-- | drivers/net/e1000e/e1000.h | 2 | ||||
-rw-r--r-- | drivers/net/e1000e/es2lan.c | 4 | ||||
-rw-r--r-- | drivers/net/e1000e/hw.h | 1 | ||||
-rw-r--r-- | drivers/net/e1000e/ich8lan.c | 1 | ||||
-rw-r--r-- | drivers/net/e1000e/lib.c | 48 |
6 files changed, 52 insertions, 11 deletions
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index d1a45143c2aa..7674a91824bc 100644 --- a/drivers/net/e1000e/82571.c +++ b/drivers/net/e1000e/82571.c | |||
@@ -267,8 +267,14 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) | |||
267 | } | 267 | } |
268 | 268 | ||
269 | switch (hw->mac.type) { | 269 | switch (hw->mac.type) { |
270 | case e1000_82573: | ||
271 | func->set_lan_id = e1000_set_lan_id_single_port; | ||
272 | func->check_mng_mode = e1000e_check_mng_mode_generic; | ||
273 | func->led_on = e1000e_led_on_generic; | ||
274 | break; | ||
270 | case e1000_82574: | 275 | case e1000_82574: |
271 | case e1000_82583: | 276 | case e1000_82583: |
277 | func->set_lan_id = e1000_set_lan_id_single_port; | ||
272 | func->check_mng_mode = e1000_check_mng_mode_82574; | 278 | func->check_mng_mode = e1000_check_mng_mode_82574; |
273 | func->led_on = e1000_led_on_82574; | 279 | func->led_on = e1000_led_on_82574; |
274 | break; | 280 | break; |
@@ -1721,6 +1727,7 @@ static struct e1000_mac_operations e82571_mac_ops = { | |||
1721 | .cleanup_led = e1000e_cleanup_led_generic, | 1727 | .cleanup_led = e1000e_cleanup_led_generic, |
1722 | .clear_hw_cntrs = e1000_clear_hw_cntrs_82571, | 1728 | .clear_hw_cntrs = e1000_clear_hw_cntrs_82571, |
1723 | .get_bus_info = e1000e_get_bus_info_pcie, | 1729 | .get_bus_info = e1000e_get_bus_info_pcie, |
1730 | .set_lan_id = e1000_set_lan_id_multi_port_pcie, | ||
1724 | /* .get_link_up_info: media type dependent */ | 1731 | /* .get_link_up_info: media type dependent */ |
1725 | /* .led_on: mac type dependent */ | 1732 | /* .led_on: mac type dependent */ |
1726 | .led_off = e1000e_led_off_generic, | 1733 | .led_off = e1000e_led_off_generic, |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 7c91e4bdd361..8b311ce0400e 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -502,6 +502,8 @@ extern s32 e1000e_cleanup_led_generic(struct e1000_hw *hw); | |||
502 | extern s32 e1000e_led_on_generic(struct e1000_hw *hw); | 502 | extern s32 e1000e_led_on_generic(struct e1000_hw *hw); |
503 | extern s32 e1000e_led_off_generic(struct e1000_hw *hw); | 503 | extern s32 e1000e_led_off_generic(struct e1000_hw *hw); |
504 | extern s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw); | 504 | extern s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw); |
505 | extern void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw); | ||
506 | extern void e1000_set_lan_id_single_port(struct e1000_hw *hw); | ||
505 | extern s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, u16 *duplex); | 507 | extern s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, u16 *duplex); |
506 | extern s32 e1000e_get_speed_and_duplex_fiber_serdes(struct e1000_hw *hw, u16 *speed, u16 *duplex); | 508 | extern s32 e1000e_get_speed_and_duplex_fiber_serdes(struct e1000_hw *hw, u16 *speed, u16 *duplex); |
507 | extern s32 e1000e_disable_pcie_master(struct e1000_hw *hw); | 509 | extern s32 e1000e_disable_pcie_master(struct e1000_hw *hw); |
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c index 4bb9d88ad976..27d21589a69a 100644 --- a/drivers/net/e1000e/es2lan.c +++ b/drivers/net/e1000e/es2lan.c | |||
@@ -246,6 +246,9 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter) | |||
246 | break; | 246 | break; |
247 | } | 247 | } |
248 | 248 | ||
249 | /* set lan id for port to determine which phy lock to use */ | ||
250 | hw->mac.ops.set_lan_id(hw); | ||
251 | |||
249 | return 0; | 252 | return 0; |
250 | } | 253 | } |
251 | 254 | ||
@@ -1435,6 +1438,7 @@ static struct e1000_mac_operations es2_mac_ops = { | |||
1435 | .cleanup_led = e1000e_cleanup_led_generic, | 1438 | .cleanup_led = e1000e_cleanup_led_generic, |
1436 | .clear_hw_cntrs = e1000_clear_hw_cntrs_80003es2lan, | 1439 | .clear_hw_cntrs = e1000_clear_hw_cntrs_80003es2lan, |
1437 | .get_bus_info = e1000e_get_bus_info_pcie, | 1440 | .get_bus_info = e1000e_get_bus_info_pcie, |
1441 | .set_lan_id = e1000_set_lan_id_multi_port_pcie, | ||
1438 | .get_link_up_info = e1000_get_link_up_info_80003es2lan, | 1442 | .get_link_up_info = e1000_get_link_up_info_80003es2lan, |
1439 | .led_on = e1000e_led_on_generic, | 1443 | .led_on = e1000e_led_on_generic, |
1440 | .led_off = e1000e_led_off_generic, | 1444 | .led_off = e1000e_led_off_generic, |
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index 127e6a226da1..9cac5d9b94b8 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h | |||
@@ -749,6 +749,7 @@ struct e1000_mac_operations { | |||
749 | void (*clear_hw_cntrs)(struct e1000_hw *); | 749 | void (*clear_hw_cntrs)(struct e1000_hw *); |
750 | void (*clear_vfta)(struct e1000_hw *); | 750 | void (*clear_vfta)(struct e1000_hw *); |
751 | s32 (*get_bus_info)(struct e1000_hw *); | 751 | s32 (*get_bus_info)(struct e1000_hw *); |
752 | void (*set_lan_id)(struct e1000_hw *); | ||
752 | s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *); | 753 | s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *); |
753 | s32 (*led_on)(struct e1000_hw *); | 754 | s32 (*led_on)(struct e1000_hw *); |
754 | s32 (*led_off)(struct e1000_hw *); | 755 | s32 (*led_off)(struct e1000_hw *); |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index ad08cf3f40c0..061cd100aac2 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -3302,6 +3302,7 @@ static struct e1000_mac_operations ich8_mac_ops = { | |||
3302 | /* cleanup_led dependent on mac type */ | 3302 | /* cleanup_led dependent on mac type */ |
3303 | .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, | 3303 | .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, |
3304 | .get_bus_info = e1000_get_bus_info_ich8lan, | 3304 | .get_bus_info = e1000_get_bus_info_ich8lan, |
3305 | .set_lan_id = e1000_set_lan_id_single_port, | ||
3305 | .get_link_up_info = e1000_get_link_up_info_ich8lan, | 3306 | .get_link_up_info = e1000_get_link_up_info_ich8lan, |
3306 | /* led_on dependent on mac type */ | 3307 | /* led_on dependent on mac type */ |
3307 | /* led_off dependent on mac type */ | 3308 | /* led_off dependent on mac type */ |
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index 547542428edc..5f6b17148d34 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -51,10 +51,10 @@ enum e1000_mng_mode { | |||
51 | **/ | 51 | **/ |
52 | s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw) | 52 | s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw) |
53 | { | 53 | { |
54 | struct e1000_mac_info *mac = &hw->mac; | ||
54 | struct e1000_bus_info *bus = &hw->bus; | 55 | struct e1000_bus_info *bus = &hw->bus; |
55 | struct e1000_adapter *adapter = hw->adapter; | 56 | struct e1000_adapter *adapter = hw->adapter; |
56 | u32 status; | 57 | u16 pcie_link_status, cap_offset; |
57 | u16 pcie_link_status, pci_header_type, cap_offset; | ||
58 | 58 | ||
59 | cap_offset = pci_find_capability(adapter->pdev, PCI_CAP_ID_EXP); | 59 | cap_offset = pci_find_capability(adapter->pdev, PCI_CAP_ID_EXP); |
60 | if (!cap_offset) { | 60 | if (!cap_offset) { |
@@ -68,20 +68,46 @@ s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw) | |||
68 | PCIE_LINK_WIDTH_SHIFT); | 68 | PCIE_LINK_WIDTH_SHIFT); |
69 | } | 69 | } |
70 | 70 | ||
71 | pci_read_config_word(adapter->pdev, PCI_HEADER_TYPE_REGISTER, | 71 | mac->ops.set_lan_id(hw); |
72 | &pci_header_type); | ||
73 | if (pci_header_type & PCI_HEADER_TYPE_MULTIFUNC) { | ||
74 | status = er32(STATUS); | ||
75 | bus->func = (status & E1000_STATUS_FUNC_MASK) | ||
76 | >> E1000_STATUS_FUNC_SHIFT; | ||
77 | } else { | ||
78 | bus->func = 0; | ||
79 | } | ||
80 | 72 | ||
81 | return 0; | 73 | return 0; |
82 | } | 74 | } |
83 | 75 | ||
84 | /** | 76 | /** |
77 | * e1000_set_lan_id_multi_port_pcie - Set LAN id for PCIe multiple port devices | ||
78 | * | ||
79 | * @hw: pointer to the HW structure | ||
80 | * | ||
81 | * Determines the LAN function id by reading memory-mapped registers | ||
82 | * and swaps the port value if requested. | ||
83 | **/ | ||
84 | void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw) | ||
85 | { | ||
86 | struct e1000_bus_info *bus = &hw->bus; | ||
87 | u32 reg; | ||
88 | |||
89 | /* | ||
90 | * The status register reports the correct function number | ||
91 | * for the device regardless of function swap state. | ||
92 | */ | ||
93 | reg = er32(STATUS); | ||
94 | bus->func = (reg & E1000_STATUS_FUNC_MASK) >> E1000_STATUS_FUNC_SHIFT; | ||
95 | } | ||
96 | |||
97 | /** | ||
98 | * e1000_set_lan_id_single_port - Set LAN id for a single port device | ||
99 | * @hw: pointer to the HW structure | ||
100 | * | ||
101 | * Sets the LAN function id to zero for a single port device. | ||
102 | **/ | ||
103 | void e1000_set_lan_id_single_port(struct e1000_hw *hw) | ||
104 | { | ||
105 | struct e1000_bus_info *bus = &hw->bus; | ||
106 | |||
107 | bus->func = 0; | ||
108 | } | ||
109 | |||
110 | /** | ||
85 | * e1000_clear_vfta_generic - Clear VLAN filter table | 111 | * e1000_clear_vfta_generic - Clear VLAN filter table |
86 | * @hw: pointer to the HW structure | 112 | * @hw: pointer to the HW structure |
87 | * | 113 | * |