Jonathan Neuschäfer (j.neuschaefer(a)gmx.net) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15285
-gerrit
commit f4492225dc2309fe63811f02486b2fd6daffe40a
Author: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
Date: Wed Jun 29 21:59:30 2016 +0200
spike-riscv: Look for the CBFS in RAM
Change-Id: I98927a70adc45d9aca916bd985932b94287921de
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
---
src/arch/riscv/Makefile.inc | 3 ---
src/arch/riscv/rom_media.c | 26 --------------------
src/mainboard/emulation/spike-riscv/Makefile.inc | 3 +++
src/mainboard/emulation/spike-riscv/rom_media.c | 30 ++++++++++++++++++++++++
4 files changed, 33 insertions(+), 29 deletions(-)
diff --git a/src/arch/riscv/Makefile.inc b/src/arch/riscv/Makefile.inc
index 243fa53..c1c62ef 100644
--- a/src/arch/riscv/Makefile.inc
+++ b/src/arch/riscv/Makefile.inc
@@ -33,7 +33,6 @@ bootblock-y += trap_util.S
bootblock-y += trap_handler.c
bootblock-y += virtual_memory.c
bootblock-y += boot.c
-bootblock-y += rom_media.c
bootblock-y += misc.c
bootblock-y += \
$(top)/src/lib/memchr.c \
@@ -60,7 +59,6 @@ ifeq ($(CONFIG_ARCH_ROMSTAGE_RISCV),y)
romstage-y += boot.c
romstage-y += stages.c
-romstage-y += rom_media.c
romstage-y += misc.c
romstage-y += \
$(top)/src/lib/memchr.c \
@@ -90,7 +88,6 @@ ifeq ($(CONFIG_ARCH_RAMSTAGE_RISCV),y)
ramstage-y =
ramstage-y += trap_handler.c
ramstage-y += virtual_memory.c
-ramstage-y += rom_media.c
ramstage-y += stages.c
ramstage-y += misc.c
ramstage-y += boot.c
diff --git a/src/arch/riscv/rom_media.c b/src/arch/riscv/rom_media.c
deleted file mode 100644
index c171307..0000000
--- a/src/arch/riscv/rom_media.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright 2015 Google Inc.
- *
- * 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 the Free Software Foundation; version 2 of
- * the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-#include <boot_device.h>
-
-/* This assumes that the CBFS resides at 0x0, which is true for the default
- * configuration. */
-static const struct mem_region_device boot_dev =
- MEM_REGION_DEV_RO_INIT(NULL, CONFIG_ROM_SIZE);
-
-const struct region_device *boot_device_ro(void)
-{
- return &boot_dev.rdev;
-}
diff --git a/src/mainboard/emulation/spike-riscv/Makefile.inc b/src/mainboard/emulation/spike-riscv/Makefile.inc
index dff4758..91c1369 100644
--- a/src/mainboard/emulation/spike-riscv/Makefile.inc
+++ b/src/mainboard/emulation/spike-riscv/Makefile.inc
@@ -15,11 +15,14 @@
bootblock-y += bootblock.c
bootblock-y += uart.c
bootblock-y += spike_util.c
+bootblock-y += rom_media.c
romstage-y += romstage.c
romstage-y += uart.c
romstage-y += spike_util.c
+romstage-y += rom_media.c
ramstage-y += uart.c
ramstage-y += spike_util.c
+ramstage-y += rom_media.c
bootblock-y += memlayout.ld
romstage-y += memlayout.ld
diff --git a/src/mainboard/emulation/spike-riscv/rom_media.c b/src/mainboard/emulation/spike-riscv/rom_media.c
new file mode 100644
index 0000000..10952a3
--- /dev/null
+++ b/src/mainboard/emulation/spike-riscv/rom_media.c
@@ -0,0 +1,30 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2015 Google Inc.
+ * Copyright 2016 Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
+ *
+ * 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 the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#include <boot_device.h>
+
+/*
+ * 0x80000000 is this start of RAM. We currently need to load coreboot.rom into
+ * RAM on SPIKE, because SPIKE doesn't support loading custom code into the
+ * boot ROM.
+ */
+static const struct mem_region_device boot_dev =
+ MEM_REGION_DEV_RO_INIT(0x80000000, CONFIG_ROM_SIZE);
+
+const struct region_device *boot_device_ro(void)
+{
+ return &boot_dev.rdev;
+}
Jonathan Neuschäfer (j.neuschaefer(a)gmx.net) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15288
-gerrit
commit 7200f2f21f88359598c54992cf30fbc80d42c5d1
Author: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
Date: Wed Jun 29 21:59:31 2016 +0200
util/riscvtools: Provide a tohost symbol so Spike doesn't hang
See https://github.com/riscv/riscv-isa-sim/issues/54 for more
information.
Change-Id: I8cda8dc07866d395eb3ce5d94df8232840fa8b82
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
---
util/riscvtools/spike-elf.ld | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/util/riscvtools/spike-elf.ld b/util/riscvtools/spike-elf.ld
index 341a16f..44114f7 100644
--- a/util/riscvtools/spike-elf.ld
+++ b/util/riscvtools/spike-elf.ld
@@ -8,4 +8,8 @@ SECTIONS
.data : {
*(.data)
}
+
+ tohost = .;
+ . = . + 8;
+ fromhost = .;
}
Jonathan Neuschäfer (j.neuschaefer(a)gmx.net) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15505
-gerrit
commit 1fc08f2dae7acd22e5e54e97ead4434d12579ea6
Author: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
Date: Thu Jun 30 00:32:02 2016 +0200
util/kconfig: Fix gconfig build
This linker error was the problem:
build/util/kconfig/zconf.tab.o: In function `conf_read_simple':
/home/jn/dev/coreboot/util/kconfig/confdata.c:413: undefined reference to `kconfig_warnings'
/home/jn/dev/coreboot/util/kconfig/confdata.c:413: undefined reference to `kconfig_warnings'
build/util/kconfig/zconf.tab.o: In function `sym_calc_value':
/home/jn/dev/coreboot/util/kconfig/symbol.c:388: undefined reference to `kconfig_warnings'
/home/jn/dev/coreboot/util/kconfig/symbol.c:388: undefined reference to `kconfig_warnings'
collect2: error: ld returned 1 exit status
/home/jn/dev/coreboot/util/kconfig/Makefile:339: recipe for target 'build/util/kconfig/gconf' failed
make: *** [build/util/kconfig/gconf] Error 1
Change-Id: I4a667c7c15b35618fb9ad536f2be5044b8031ab4
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
---
util/kconfig/gconf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/util/kconfig/gconf.c b/util/kconfig/gconf.c
index d0a35b2..faa1c59 100644
--- a/util/kconfig/gconf.c
+++ b/util/kconfig/gconf.c
@@ -26,6 +26,8 @@
//#define DEBUG
+int kconfig_warnings = 0;
+
enum {
SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW
};
the following patch was just integrated into master:
commit 9a0c9ac912b4bc4248cdada2889a13e48a06d28d
Author: Shaunak Saha <shaunak.saha(a)intel.com>
Date: Mon Jun 27 23:00:15 2016 -0700
soc/apollolake: Expose a function to read pmc bar
This patch exposes a function to read pmc bar.
PMC bar is read in function read_pmc_mmio_bar which
is defined static in file pmutil.c. This patch exposes
that functionality to call it from other files.
BUG=chrome-os-partner:53438
TEST= Read the PMC bar value properly from outside
pmutil file.
Change-Id: I26ee13e6ab95d3a8991c7f8ea4b3856ceb015d10
Signed-off-by: Shaunak Saha <shaunak.saha(a)intel.com>
Reviewed-on: https://review.coreboot.org/15460
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
See https://review.coreboot.org/15460 for details.
-gerrit
Werner Zeh (werner.zeh(a)siemens.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15516
-gerrit
commit d12ac269b74c62a0961d6a6ecde3cea8c1f2ce54
Author: Werner Zeh <werner.zeh(a)siemens.com>
Date: Wed Jun 29 07:53:47 2016 +0200
intel/i210: Change API for function mainboard_get_mac_address()
The function mainboard_get_mac_address() is used to get a MAC address
for a given i210 PCI device. Instead of passing pure numbers for PCI
bus, device and function pass the device pointer to this function. In
this way the function can retrieve the needed values itself as well as
have the pointer to the device tree so that PCI path can be evaluated
there.
Change-Id: I2335d995651baa5e23a0448f5f32310dcd394f9b
Signed-off-by: Werner Zeh <werner.zeh(a)siemens.com>
---
src/drivers/intel/i210/i210.c | 10 +---------
src/drivers/intel/i210/i210.h | 8 ++++++++
src/mainboard/siemens/mc_tcu3/mainboard.c | 5 ++---
src/vendorcode/siemens/hwilib/hwilib.h | 5 +++--
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/drivers/intel/i210/i210.c b/src/drivers/intel/i210/i210.c
index c5e0c4e..c55eecc 100644
--- a/src/drivers/intel/i210/i210.c
+++ b/src/drivers/intel/i210/i210.c
@@ -14,20 +14,13 @@
*/
#include "i210.h"
-#include <device/device.h>
#include <console/console.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <string.h>
-#include <types.h>
#include <delay.h>
-/* We need one function we can call to get a MAC address to use */
-/* This function can be coded somewhere else but must exist. */
-extern enum cb_err mainboard_get_mac_address(uint16_t bus, uint8_t devfn,
- uint8_t mac[6]);
-
/* This is a private function to wait for a bit mask in a given register */
/* To avoid endless loops, a time-out is implemented here. */
static int wait_done(uint32_t* reg, uint32_t mask)
@@ -202,8 +195,7 @@ static void init(struct device *dev)
enum cb_err status;
/*Check first whether there is a valid MAC address available */
- status = mainboard_get_mac_address(dev->bus->subordinate,
- dev->path.pci.devfn, adr_to_set);
+ status = mainboard_get_mac_address(dev, adr_to_set);
if (status != CB_SUCCESS) {
printk(BIOS_ERR, "I210: No valid MAC address found\n");
return;
diff --git a/src/drivers/intel/i210/i210.h b/src/drivers/intel/i210/i210.h
index b19b584..e3179b7 100644
--- a/src/drivers/intel/i210/i210.h
+++ b/src/drivers/intel/i210/i210.h
@@ -16,6 +16,9 @@
#ifndef _INTEL_I210_H_
#define _INTEL_I210_H_
+#include <types.h>
+#include <device/device.h>
+
#define I210_PCI_MEM_BAR_OFFSET 0x10
#define I210_REG_EECTRL 0x12010 /* Offset for EEPROM control reg */
#define I210_FLUPD 0x800000 /* Start flash update bit */
@@ -38,4 +41,9 @@
#define I210_CHECKSUM_ERROR 0x00000010
#define I210_FLASH_UPDATE_ERROR 0x00000020
+/* We need one function we can call to get a MAC address to use */
+/* This function can be coded somewhere else but must exist. */
+extern enum cb_err mainboard_get_mac_address(struct device *dev,
+ uint8_t mac[6]);
+
#endif /* _INTEL_I210_H_ */
diff --git a/src/mainboard/siemens/mc_tcu3/mainboard.c b/src/mainboard/siemens/mc_tcu3/mainboard.c
index 009c34d..9ac6dc0 100644
--- a/src/mainboard/siemens/mc_tcu3/mainboard.c
+++ b/src/mainboard/siemens/mc_tcu3/mainboard.c
@@ -35,12 +35,11 @@
/** \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 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(uint16_t bus, uint8_t devfn,
- uint8_t mac[6])
+extern enum cb_err mainboard_get_mac_address(struct device *dev, uint8_t mac[6])
{
uint8_t mac_adr[6];
uint32_t i;
diff --git a/src/vendorcode/siemens/hwilib/hwilib.h b/src/vendorcode/siemens/hwilib/hwilib.h
index d858091..9ccb3fe 100644
--- a/src/vendorcode/siemens/hwilib/hwilib.h
+++ b/src/vendorcode/siemens/hwilib/hwilib.h
@@ -17,6 +17,7 @@
#define SIEMENS_HWI_LIB_H_
#include <types.h>
+#include <device/device.h>
/* Declare all supported fields which can be get with hwilib. */
@@ -136,6 +137,6 @@ enum cb_err hwilib_find_blocks (const char *hwi_filename);
uint32_t hwilib_get_field (hwinfo_field_t field, uint8_t *data, uint32_t maxlen);
/* This functions needs to be implemented for every mainboard that uses i210. */
-enum cb_err mainboard_get_mac_address(uint16_t bus, uint8_t devfn,
- uint8_t mac[6]);
+extern enum cb_err mainboard_get_mac_address(struct device *dev,
+ uint8_t mac[6]);
#endif /* SIEMENS_HWI_LIB_H_ */
Werner Zeh (werner.zeh(a)siemens.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15517
-gerrit
commit ec51d012fed9d7da81e515f77448efe8754c88e5
Author: Werner Zeh <werner.zeh(a)siemens.com>
Date: Thu Jun 30 08:21:17 2016 +0200
siemens/mc_bdx1: Set up MAC address for available i210 MACs
Enable the usage of DRIVER_INTEL_I210 and provide a function to search
for a valid MAC address for all i210 devices using hwilib.
Change-Id: Ic0f4f1579364cf5b0111334a05a8a0926785318b
Signed-off-by: Werner Zeh <werner.zeh(a)siemens.com>
---
src/mainboard/siemens/mc_bdx1/Kconfig | 2 +
src/mainboard/siemens/mc_bdx1/mainboard.c | 74 +++++++++++++++++++++++++++++++
2 files changed, 76 insertions(+)
diff --git a/src/mainboard/siemens/mc_bdx1/Kconfig b/src/mainboard/siemens/mc_bdx1/Kconfig
index e33b14a..f947f3d 100644
--- a/src/mainboard/siemens/mc_bdx1/Kconfig
+++ b/src/mainboard/siemens/mc_bdx1/Kconfig
@@ -9,6 +9,8 @@ config BOARD_SPECIFIC_OPTIONS
select TSC_MONOTONIC_TIMER
select HAVE_FSP_BIN if FSP_PACKAGE_DEFAULT
select CBFS_AUTOGEN_ATTRIBUTES
+ select USE_SIEMENS_HWILIB
+ select DRIVER_INTEL_I210
config MAINBOARD_DIR
string
diff --git a/src/mainboard/siemens/mc_bdx1/mainboard.c b/src/mainboard/siemens/mc_bdx1/mainboard.c
index 58da036..ccfb471 100644
--- a/src/mainboard/siemens/mc_bdx1/mainboard.c
+++ b/src/mainboard/siemens/mc_bdx1/mainboard.c
@@ -3,6 +3,7 @@
*
* Copyright (C) 2007-2009 coresystems GmbH
* Copyright (C) 2011 Google Inc.
+ * Copyright (C) 2016 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
@@ -29,7 +30,10 @@
#include <arch/io.h>
#include <arch/interrupt.h>
#include <boot/coreboot_tables.h>
+#include <hwilib.h>
+#define MAX_PATH_DEPTH 14
+#define MAX_NUM_MAPPINGS 10
/*
* mainboard_enable is executed as first thing after enumerate_buses().
* This is the earliest point to add customization.
@@ -38,6 +42,76 @@ static void mainboard_enable(device_t dev)
{
}
+/** \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
+ */
+extern 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;
+ for (i = 1; i < MAX_PATH_DEPTH && parent->dev->bus->subordinate; i++) {
+ buf[i] = parent->dev->path.pci.devfn;
+ 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;
+ }
+ chain_len = i;
+ /* 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 = 1; i <= chain_len; i++)
+ mapping[i + 3] = buf[chain_len - i];
+
+ /* 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;
+}
struct chip_operations mainboard_ops = {
.enable_dev = mainboard_enable,