the following patch was just integrated into master:
commit 7b681c5926d3699b33c936e34a8176833a03eaf2
Author: Mathias Krause <minipli(a)googlemail.com>
Date: Tue Feb 7 19:03:29 2017 +0100
libpayload: x86/main - propagate return value of main()
According to coreboot’s payload API [1], the called payload should be
able to return a value via %eax. Support this by changing the prototype
of start_main() and pass on the return value of main() to the caller
instead of discarding it.
[1] https://www.coreboot.org/Payload_API
Change-Id: I8442faea19cc8e04487092f8e61aa4e5cba3ba76
Signed-off-by: Mathias Krause <minipli(a)googlemail.com>
Reviewed-on: https://review.coreboot.org/18334
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
See https://review.coreboot.org/18334 for details.
-gerrit
the following patch was just integrated into master:
commit 9fa78c136d6a6538576fb15ccd05d8483ea05ab5
Author: Mathias Krause <minipli(a)googlemail.com>
Date: Sat Feb 11 22:34:46 2017 +0100
libpayload: x86/exec - fix argc/argv value passing
According to coreboot’s payload API [1] the argc value should be passed
at stack offset 0x10, so we need to push a dummy value to comply to the
API.
[1] https://www.coreboot.org/Payload_API
Change-Id: Id20424185a5bf7e4d94de1886a2cece3f3968371
Signed-off-by: Mathias Krause <minipli(a)googlemail.com>
Reviewed-on: https://review.coreboot.org/18333
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
See https://review.coreboot.org/18333 for details.
-gerrit
Mario Scheithauer (mario.scheithauer(a)siemens.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18380
-gerrit
commit e0115dc069660e68fb72aedb4da888dc78c5fc0f
Author: Mario Scheithauer <mario.scheithauer(a)siemens.com>
Date: Thu Feb 16 13:39:16 2017 +0100
siemens/mc_apl1: Set MAC address for all available i210 MACs
This mainboard uses two i210 Ethernet controller. Therfore we enable the
usage of the i210 driver and have to provide a function to search for a
valid MAC address for all i210 devices by using Siemens hwilib.
Change-Id: I36246cdef987fcece15a297ebb2f41561fca1f69
Signed-off-by: Mario Scheithauer <mario.scheithauer(a)siemens.com>
---
src/mainboard/siemens/mc_apl1/Kconfig | 2 +
src/mainboard/siemens/mc_apl1/mainboard.c | 83 +++++++++++++++++++++++++++++++
2 files changed, 85 insertions(+)
diff --git a/src/mainboard/siemens/mc_apl1/Kconfig b/src/mainboard/siemens/mc_apl1/Kconfig
index 6201ed3..ef9d021 100644
--- a/src/mainboard/siemens/mc_apl1/Kconfig
+++ b/src/mainboard/siemens/mc_apl1/Kconfig
@@ -5,6 +5,8 @@ config BOARD_SPECIFIC_OPTIONS
select SOC_INTEL_APOLLOLAKE
select BOARD_ROMSIZE_KB_16384
select HAVE_ACPI_TABLES
+ select DRIVER_INTEL_I210
+ select USE_SIEMENS_HWILIB
config MAINBOARD_DIR
string
diff --git a/src/mainboard/siemens/mc_apl1/mainboard.c b/src/mainboard/siemens/mc_apl1/mainboard.c
index f7a2ef1..1c2dd19 100644
--- a/src/mainboard/siemens/mc_apl1/mainboard.c
+++ b/src/mainboard/siemens/mc_apl1/mainboard.c
@@ -2,6 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright 2016 Google Inc.
+ * Copyright (C) 2017 Siemens AG
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,6 +15,88 @@
*/
#include <device/device.h>
+#include <console/console.h>
+#include <string.h>
+#include <hwilib.h>
+#include <i210.h>
+
+#define MAX_PATH_DEPTH 12
+#define MAX_NUM_MAPPINGS 10
+
+/** \brief This function can decide if a given MAC address is valid or not.
+ * Currently, addresses filled with 0xff or 0x00 are not valid.
+ * @param mac Buffer to the MAC address to check
+ * @return 0 if address is not valid, otherwise 1
+ */
+static uint8_t is_mac_adr_valid(uint8_t mac[6])
+{
+ uint8_t buf[6];
+
+ memset(buf, 0, sizeof(buf));
+ if (!memcmp(buf, mac, sizeof(buf)))
+ return 0;
+ memset(buf, 0xff, sizeof(buf));
+ if (!memcmp(buf, mac, sizeof(buf)))
+ return 0;
+ return 1;
+}
+
+/** \brief This function will search for a MAC address which can be assigned
+ * to a MACPHY.
+ * @param dev pointer to 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(struct device *dev, uint8_t mac[6])
+{
+ struct bus *parent = dev->bus;
+ uint8_t buf[16], mapping[16], i = 0, chain_len = 0;
+
+ memset(buf, 0, sizeof(buf));
+ memset(mapping, 0, sizeof(mapping));
+
+ /* The first entry in the tree is the device itself. */
+ buf[0] = dev->path.pci.devfn;
+ chain_len = 1;
+ for (i = 1; i < MAX_PATH_DEPTH && parent->dev->bus->subordinate; i++) {
+ buf[i] = parent->dev->path.pci.devfn;
+ chain_len++;
+ parent = parent->dev->bus;
+ }
+ if (i == MAX_PATH_DEPTH) {
+ /* The path is deeper than MAX_PATH_DEPTH devices, error. */
+ printk(BIOS_ERR, "Too many bridges for %s\n", dev_path(dev));
+ return CB_ERR;
+ }
+ /*
+ * Now construct the mapping based on the device chain starting from
+ * root bridge device to the device itself.
+ */
+ mapping[0] = 1;
+ mapping[1] = chain_len;
+ for (i = 0; i < chain_len; i++)
+ mapping[i + 4] = buf[chain_len - i - 1];
+
+ /* Open main hwinfo block */
+ if (hwilib_find_blocks("hwinfo.hex") != CB_SUCCESS)
+ return CB_ERR;
+ /* Now try to find a valid MAC address in hwinfo for this mapping.*/
+ for (i = 0; i < MAX_NUM_MAPPINGS; i++) {
+ if ((hwilib_get_field(XMac1Mapping + i, buf, 16) == 16) &&
+ !(memcmp(buf, mapping, chain_len + 4))) {
+ /* There is a matching mapping available, get MAC address. */
+ if ((hwilib_get_field(XMac1 + i, mac, 6) == 6) &&
+ (is_mac_adr_valid(mac))) {
+ return CB_SUCCESS;
+ } else {
+ return CB_ERR;
+ }
+ } else
+ continue;
+ }
+ /* No MAC address found for */
+ return CB_ERR;
+}
static void mainboard_init(void *chip_info)
{