diff options
author | Werner Zeh <werner.zeh@siemens.com> | 2016-04-25 12:24:17 +0200 |
---|---|---|
committer | Werner Zeh <werner.zeh@siemens.com> | 2016-04-28 08:16:05 +0200 |
commit | bf13d3f567795324a587af745c71e58ce680ab3f (patch) | |
tree | 1983311e16a8a1071d15af2432a0fe4205cf09d4 /src/mainboard/siemens/mc_tcu3/mainboard.c | |
parent | 223498fa16c8de69b2649c669d2fba43ecf364d8 (diff) |
mc_tcu3: Switch to hwilib instead of own hwinfo implementation
Use hwilib in vendorcode/siemens/hwilib to get fields from hwinfo
instead of having mainboard specific hwinfo code.
This patch does not change the functional behavior in any way.
Change-Id: Idb226a82a08b1b753f654c5cde106236e72f33c3
Signed-off-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-on: https://review.coreboot.org/14506
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/mainboard/siemens/mc_tcu3/mainboard.c')
-rw-r--r-- | src/mainboard/siemens/mc_tcu3/mainboard.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/mainboard/siemens/mc_tcu3/mainboard.c b/src/mainboard/siemens/mc_tcu3/mainboard.c index 8a966dcc84..e9c29a07b5 100644 --- a/src/mainboard/siemens/mc_tcu3/mainboard.c +++ b/src/mainboard/siemens/mc_tcu3/mainboard.c @@ -29,9 +29,47 @@ #include <arch/io.h> #include <arch/interrupt.h> #include <boot/coreboot_tables.h> - +#include <hwilib.h> #include "lcd_panel.h" + +/** \brief This function will search for a MAC address which can be assigned + * to a MACPHY. + * @param pci_bdf Bus, device and function of the given PCI-device + * @param mac buffer where to store the MAC address + * @return cb_err CB_ERR or CB_SUCCESS + */ +enum cb_err mainboard_get_mac_address(u16 bus, u8 devfn, u8 mac[6]) +{ + uint8_t mac_adr[6]; + u32 i; + + /* Open main hwinfo block */ + if (hwilib_find_blocks("hwinfo.hex") != CB_SUCCESS) + return CB_ERR; + /* Get first MAC address from hwinfo. */ + if (hwilib_get_field(Mac1, mac_adr, sizeof(mac_adr)) != sizeof(mac_adr)) + return CB_ERR; + /* Ensure the first MAC-Address is not completely 0x00 or 0xff */ + for (i = 0; i < 6; i++) { + if (mac_adr[i] != 0xFF) + break; + } + if (i == 6){ + return CB_ERR; + } + for (i = 0; i < 6; i++) { + if (mac_adr[i] != 0x00) + break; + } + if (i == 6){ + return CB_ERR; + } else { + memcpy(mac, mac_adr, 6); + return CB_SUCCESS; + } +} + /* * mainboard_enable is executed as first thing after enumerate_buses(). * This is the earliest point to add customization. |