Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9207
-gerrit
commit 216302212b1deb377aac9f58423fc4db2834992d
Author: Vadim Bendebury <vbendeb(a)chromium.org>
Date: Mon Sep 22 18:48:41 2014 -0700
vpd: retrieve mac addresses and pass them to bootloader
Chrome OS devices firmware usually includes an area called VPD (Vital
Product Data). VPD is a blob of a certain structure, in particular
containing freely defined variable size fields. A field is a tuple of
the field name and field contents.
MAC addresses of the interfaces are stored in VPD as well. Field names
are in the form of 'ethernet_macN', where N is the zero based
interface number.
This patch retrieves the MAC address(es) from the VPD and populates
them in the coreboot table so that they become available to the
bootloader.
BUG=chrome-os-partner:32152, chromium:417117
TEST=with this and other patches in place the storm device tree shows
up with MAC addresses properly initialized.
Change-Id: I955207b3a644cde100cc4b48e51a2ab9a3cb1ba0
Signed-off-by: Stefan Reinauer <reinauer(a)chromium.org>
Original-Commit-Id: 1972b9e97b57cc8503c5e4dc496706970ed2ffbe
Original-Change-Id: I12c0d15ca84f60e4824e1056c9be2e81a7ad8e73
Original-Signed-off-by: Vadim Bendebury <vbendeb(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/219443
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/include/boot/coreboot_tables.h | 13 +++++++
src/lib/coreboot_table.c | 74 ++++++++++++++++++++++++++++++++++++++
2 files changed, 87 insertions(+)
diff --git a/src/include/boot/coreboot_tables.h b/src/include/boot/coreboot_tables.h
index 46c1df5..0efb8fd 100644
--- a/src/include/boot/coreboot_tables.h
+++ b/src/include/boot/coreboot_tables.h
@@ -263,6 +263,19 @@ struct lb_board_id {
uint32_t board_id;
};
+#define LB_TAG_MAC_ADDRS 0x0026
+struct mac_address {
+ uint8_t mac_addr[6];
+ uint8_t pad[2]; /* Pad it to 8 bytes to keep it simple. */
+};
+
+struct lb_macs {
+ uint32_t tag;
+ uint32_t size;
+ uint32_t count;
+ struct mac_address mac_addrs[0];
+};
+
/* The following structures are for the cmos definitions table */
#define LB_TAG_CMOS_OPTION_TABLE 200
/* cmos header record */
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index d6d84cd..a8b5edf 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -38,6 +38,7 @@
#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>
@@ -157,9 +158,79 @@ 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;
+
gpios = (struct lb_gpios *)lb_new_record(header);
gpios->tag = LB_TAG_GPIO;
gpios->size = sizeof(*gpios);
@@ -446,6 +517,9 @@ 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 */
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9222
-gerrit
commit 32d92d106e25dec5580e11c389b2fcdaa1de6c32
Author: Julius Werner <jwerner(a)chromium.org>
Date: Tue Sep 23 20:53:20 2014 -0700
arm: Prevent compilation of old, experimental SMP support
The ARM SMP feature was added a long time ago and has never really been
used by anyone since. We are still always compiling cpu_info() even
though we don't use it, and it makes some dangerous assumptions about
stack alignment that are not guaranteed anywhere.
I'm planning to change the way the stack boundaries are defined. Rather
than trying to work that into this unsafe, unused and hard to test
feature, I think we should just seal it off with police tape and make
sure that if anyone ever tries to use it again (which currently seems
unlikely), they get forced to do their due diligence on making sure it
works as intended.
BUG=None
TEST=Compiled Veyron_Pinky.
Change-Id: Id25545cab88f29200c7672ef02c7804f0ac26399
Signed-off-by: Stefan Reinauer <reinauer(a)chromium.org>
Original-Commit-Id: 5b517fc46b030a6e50ef2f5e4d4a449b98ce16c6
Original-Change-Id: I8a60bd30e8b27a22bb3da68ca84daea99424dee9
Original-Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/219680
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
Original-Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
---
src/arch/arm/Makefile.inc | 2 +-
src/arch/arm/cpu.c | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/arch/arm/Makefile.inc b/src/arch/arm/Makefile.inc
index 25f764c..e739d0b 100644
--- a/src/arch/arm/Makefile.inc
+++ b/src/arch/arm/Makefile.inc
@@ -117,7 +117,7 @@ ifeq ($(CONFIG_ARCH_RAMSTAGE_ARM),y)
ramstage-y += stages.c
ramstage-y += div0.c
-ramstage-y += cpu.c
+ramstage-$(CONFIG_COOP_MULTITASKING) += cpu.c
ramstage-y += eabi_compat.c
ramstage-y += boot.c
ramstage-y += tables.c
diff --git a/src/arch/arm/cpu.c b/src/arch/arm/cpu.c
index f90c759..e02fed3 100644
--- a/src/arch/arm/cpu.c
+++ b/src/arch/arm/cpu.c
@@ -34,6 +34,11 @@
*/
struct cpu_info *cpu_info(void)
{
+#error "This is BROKEN! ARM stacks are currently not guaranteed to be " \
+ "STACK_SIZE-aligned in any way. If you ever plan to revive this " \
+ "feature, make sure you add the proper assertions " \
+ "(and maybe consider revising the whole thing to work closer to what " \
+ "arm64 is doing now)."
uintptr_t addr = ALIGN((uintptr_t)__builtin_frame_address(0),
CONFIG_STACK_SIZE);
addr -= sizeof(struct cpu_info);
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9200
-gerrit
commit 2c9e1f1f8c041697f2a8dd976d3ac095fb6b97ee
Author: Kein Yuan <kein.yuan(a)intel.com>
Date: Fri Jun 27 09:12:57 2014 -0700
Baytrail: changes to USB3 PLL VCO and iCLK PLL current on BYT-M/D CPU
Intel will be making slight changes to USB3 PLL VCO and iCLK PLL current
on C0 stepping of BYT-M/D C0 stepping in order to meet the high demands
for these processors.
Pre-conversion materials are compatible with USB PLL VCO current increase.
Post-conversion materials ARE REQUIRED to be run with increased USB3 PLL
VCO current.
BUG=chrome-os-partner:31199
TEST=Boot Rambi, then read USHPHY_CDN_PLL_CONTROL and verify register
has new value.
Signed-off-by: Stefan Reinauer <reinauer(a)chromium.org>
Original-Commit-Id: bc01a3df80f5bd7fd86047c8bbf1584d19363e3b
Original-Change-Id: Ie9c3d0afd54ea7ced2c76ebb948de95be0828fa0
Original-Signed-off-by: Kein Yuan <kein.yuan(a)intel.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/211337
Original-Commit-Queue: Shawn Nematbakhsh <shawnn(a)chromium.org>
Original-Tested-by: Shawn Nematbakhsh <shawnn(a)chromium.org>
Original-Reviewed-by: Duncan Laurie <dlaurie(a)chromium.org>
Original-(cherry picked from commit df20eca47ca0ff33baf5d554ef11dd2b35706a5d)
Original-Reviewed-on: https://chromium-review.googlesource.com/205970
Original-Reviewed-by: Shawn Nematbakhsh <shawnn(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/217772
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
Original-Commit-Queue: Kenji Chen <kenji.chen(a)intel.com>
Original-Tested-by: Kenji Chen <kenji.chen(a)intel.com>
Change-Id: I1c825992a2b4dfac86f77cde567d2471ca4c19e6
---
src/soc/intel/baytrail/xhci.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/soc/intel/baytrail/xhci.c b/src/soc/intel/baytrail/xhci.c
index 19339e4..21a0c5f 100644
--- a/src/soc/intel/baytrail/xhci.c
+++ b/src/soc/intel/baytrail/xhci.c
@@ -27,6 +27,8 @@
#include <baytrail/iomap.h>
#include <baytrail/iosf.h>
+#include <baytrail/lpc.h>
+#include <baytrail/pattrs.h>
#include <baytrail/pci_devs.h>
#include <baytrail/pmc.h>
#include <baytrail/ramstage.h>
@@ -227,6 +229,13 @@ static void xhci_init(device_t dev)
else
reg_script_run_on_dev(dev, xhci_init_boot_script);
+ /* C0 steppings change iCLK/USB PLL VCO settings from 5 to 7 */
+ if (pattrs_get()->stepping == STEP_C0) {
+ uint32_t reg = iosf_ushphy_read(USHPHY_CDN_PLL_CONTROL);
+ reg |= 0x00700000;
+ iosf_ushphy_write(USHPHY_CDN_PLL_CONTROL, reg);
+ }
+
/* Finalize Initialization */
reg_script_run_on_dev(dev, xhci_hc_init);