aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel
diff options
context:
space:
mode:
authorMartin K Petersen <mkp@mkp.net>2014-11-15 09:24:51 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-12-05 12:13:05 -0500
commitc762dff24c06c0eca30e96650f60022eaa1862b0 (patch)
tree803bf89aaf484b06457ab2e351262fe616753d87 /drivers/net/ethernet/intel
parentad435ec689c981a11005d5283cc88588a699537f (diff)
ixgbe: Look up MAC address in Open Firmware or IDPROM
Attempt to look up the MAC address in Open Firmware on systems that support it. On SPARC resort to using the IDPROM if no OF address is found. Signed-off-by: Martin K Petersen <martin.petersen@oracle.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 73cd0fefad44..18ddffbb7e3f 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -42,6 +42,7 @@
42#include <linux/slab.h> 42#include <linux/slab.h>
43#include <net/checksum.h> 43#include <net/checksum.h>
44#include <net/ip6_checksum.h> 44#include <net/ip6_checksum.h>
45#include <linux/etherdevice.h>
45#include <linux/ethtool.h> 46#include <linux/ethtool.h>
46#include <linux/if.h> 47#include <linux/if.h>
47#include <linux/if_vlan.h> 48#include <linux/if_vlan.h>
@@ -50,6 +51,15 @@
50#include <linux/prefetch.h> 51#include <linux/prefetch.h>
51#include <scsi/fc/fc_fcoe.h> 52#include <scsi/fc/fc_fcoe.h>
52 53
54#ifdef CONFIG_OF
55#include <linux/of_net.h>
56#endif
57
58#ifdef CONFIG_SPARC
59#include <asm/idprom.h>
60#include <asm/prom.h>
61#endif
62
53#include "ixgbe.h" 63#include "ixgbe.h"
54#include "ixgbe_common.h" 64#include "ixgbe_common.h"
55#include "ixgbe_dcb_82599.h" 65#include "ixgbe_dcb_82599.h"
@@ -8021,6 +8031,29 @@ int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id,
8021} 8031}
8022 8032
8023/** 8033/**
8034 * ixgbe_get_platform_mac_addr - Look up MAC address in Open Firmware / IDPROM
8035 * @adapter: Pointer to adapter struct
8036 */
8037static void ixgbe_get_platform_mac_addr(struct ixgbe_adapter *adapter)
8038{
8039#ifdef CONFIG_OF
8040 struct device_node *dp = pci_device_to_OF_node(adapter->pdev);
8041 struct ixgbe_hw *hw = &adapter->hw;
8042 const unsigned char *addr;
8043
8044 addr = of_get_mac_address(dp);
8045 if (addr) {
8046 ether_addr_copy(hw->mac.perm_addr, addr);
8047 return;
8048 }
8049#endif /* CONFIG_OF */
8050
8051#ifdef CONFIG_SPARC
8052 ether_addr_copy(hw->mac.perm_addr, idprom->id_ethaddr);
8053#endif /* CONFIG_SPARC */
8054}
8055
8056/**
8024 * ixgbe_probe - Device Initialization Routine 8057 * ixgbe_probe - Device Initialization Routine
8025 * @pdev: PCI device information struct 8058 * @pdev: PCI device information struct
8026 * @ent: entry in ixgbe_pci_tbl 8059 * @ent: entry in ixgbe_pci_tbl
@@ -8289,6 +8322,8 @@ skip_sriov:
8289 goto err_sw_init; 8322 goto err_sw_init;
8290 } 8323 }
8291 8324
8325 ixgbe_get_platform_mac_addr(adapter);
8326
8292 memcpy(netdev->dev_addr, hw->mac.perm_addr, netdev->addr_len); 8327 memcpy(netdev->dev_addr, hw->mac.perm_addr, netdev->addr_len);
8293 8328
8294 if (!is_valid_ether_addr(netdev->dev_addr)) { 8329 if (!is_valid_ether_addr(netdev->dev_addr)) {