diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2014-10-16 13:02:37 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-04-10 11:57:24 +0200 |
commit | dd94b5f023b5449b6d2555ccd1d3f294ef2a99d0 (patch) | |
tree | a79276287ef89c6baeeb8b0604fc4fcd6d65840a /src/lib | |
parent | 931a218d685610d85b570b72889b341270e2d00a (diff) | |
download | coreboot-staging-dd94b5f023b5449b6d2555ccd1d3f294ef2a99d0.zip coreboot-staging-dd94b5f023b5449b6d2555ccd1d3f294ef2a99d0.tar.gz |
chromeos: move VPD MAC address retrieval function
Retrieval of the MAC address from the VPD is a Chrome OS specific
feature, required just on one platform so far. There is no need to
look for the MAC address in the VPD on all other Chrome OS boards.
BRANCH=storm
BUG=chromium:417117
TEST=with the upcoming patch applied verified that MAC addresses still
show up in the device tree on storm
Change-Id: If5fd4895bffc758563df7d21f38995f0c8594330
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: fb4906ac559634321a01b4814f338611b9e98b2b
Original-Change-Id: I8e6f8dc38294d3ab11965931be575360fd12b2fc
Original-Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/223796
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: http://review.coreboot.org/9398
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/coreboot_table.c | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index a8b5edf..365283f 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -38,7 +38,6 @@ #endif #include <vendorcode/google/chromeos/chromeos.h> #include <vendorcode/google/chromeos/gnvs.h> -#include <vendorcode/google/chromeos/cros_vpd.h> #endif #if CONFIG_ARCH_X86 #include <cpu/x86/mtrr.h> @@ -158,75 +157,6 @@ void fill_lb_gpio(struct lb_gpio *gpio, int num, } #if CONFIG_CHROMEOS -static void lb_macs(struct lb_header *header) -{ - /* - * In case there is one or more MAC addresses stored in the VPD, the - * key is "ethernet_mac{0..9}", up to 10 values. - */ - static const char mac_addr_key_base[] = "ethernet_mac0"; - char mac_addr_key[sizeof(mac_addr_key_base)]; - char mac_addr_str[13]; /* 12 symbols and the trailing zero. */ - int count; - struct lb_macs *macs = NULL; - const int index_of_index = sizeof(mac_addr_key) - 2; - - /* - * MAC addresses are stored in the VPD as strings of hex numbers, - * which need to be converted into binary for storing in the coreboot - * table. - */ - strcpy(mac_addr_key, mac_addr_key_base); - count = 0; - do { - int i; - - if (!cros_vpd_gets(mac_addr_key, mac_addr_str, - sizeof(mac_addr_str))) - break; /* No more MAC addresses in VPD */ - - if (!macs) { - macs = (struct lb_macs *)lb_new_record(header); - macs->tag = LB_TAG_MAC_ADDRS; - } - - /* MAC address in symbolic form is in mac_addr_str. */ - for (i = 0; i < sizeof(macs->mac_addrs[0].mac_addr); i++) { - int j; - uint8_t n = 0; - - for (j = 0; j < 2; j++) { - char c = mac_addr_str[i * 2 + j]; - - if (isxdigit(c)) { - if (isdigit(c)) - c -= '0'; - else - c = tolower(c) - 'a' + 10; - } else { - printk(BIOS_ERR, - "%s: non hexadecimal symbol " - "%#2.2x in the VPD field %s\n", - __func__, (uint8_t)c, - mac_addr_key); - c = 0; - } - n <<= 4; - n |= c; - } - macs->mac_addrs[count].mac_addr[i] = n; - } - count++; - mac_addr_key[index_of_index] = '0' + count; - } while (count < 10); - - if (!count) - return; /* No MAC addresses in the VPD. */ - - macs->count = count; - macs->size = sizeof(*macs) + count * sizeof(struct mac_address); -} - static void lb_gpios(struct lb_header *header) { struct lb_gpios *gpios; @@ -517,9 +447,6 @@ unsigned long write_coreboot_table( /* pass along the vboot_handoff address. */ lb_vboot_handoff(head); - - /* Retrieve mac addresses from VPD, if any. */ - lb_macs(head); #endif /* Add board ID if available */ |