Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13706
-gerrit
commit 8976e7e6fbc0aa62293e65ee8592da5e81c2ac18
Author: Andrey Petrov <andrey.petrov(a)intel.com>
Date: Fri Feb 12 15:12:43 2016 -0800
soc/intel/apollolake: Add support for memory-mapped boot media
On Apollo Lake SPI flash is memory mapped. The mapping is different
to previous platforms. Only "BIOS" region is mapped in contrast to
whole flash. Also, the 128 KiB right below 4 GiB are being decoded by
readonly SRAM. Fail accesses to those regions, rather than returning
false data.
Change-Id: Iac3fa74cd221a5a46ceb34c2a79470290bcc2d84
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/mainboard/intel/apollolake_rvp/Kconfig | 9 ++++
src/soc/intel/apollolake/Kconfig | 3 ++
src/soc/intel/apollolake/Makefile.inc | 3 ++
src/soc/intel/apollolake/mmap_boot.c | 74 ++++++++++++++++++++++++++++++
4 files changed, 89 insertions(+)
diff --git a/src/mainboard/intel/apollolake_rvp/Kconfig b/src/mainboard/intel/apollolake_rvp/Kconfig
index 52d3777..9920b46 100644
--- a/src/mainboard/intel/apollolake_rvp/Kconfig
+++ b/src/mainboard/intel/apollolake_rvp/Kconfig
@@ -17,4 +17,13 @@ config MAINBOARD_VENDOR
string
default "Intel"
+config IFD_BIOS_END
+ hex
+ default 0x6FF000
+
+config IFD_BIOS_START
+ hex
+ default 0x1000
+
+
endif
diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig
index bb0cc20..401535f 100644
--- a/src/soc/intel/apollolake/Kconfig
+++ b/src/soc/intel/apollolake/Kconfig
@@ -80,4 +80,7 @@ config C_ENV_BOOTBLOCK_SIZE
hex
default 0x8000
+config X86_TOP4G_BOOTMEDIA_MAP
+ bool
+ default n
endif
diff --git a/src/soc/intel/apollolake/Makefile.inc b/src/soc/intel/apollolake/Makefile.inc
index 7f8beb0..17ddaec 100644
--- a/src/soc/intel/apollolake/Makefile.inc
+++ b/src/soc/intel/apollolake/Makefile.inc
@@ -11,17 +11,20 @@ bootblock-y += bootblock/bootblock.c
bootblock-y += bootblock/cache_as_ram.S
bootblock-y += bootblock/bootblock.c
bootblock-y += gpio.c
+bootblock-y += mmap_boot.c
bootblock-y += placeholders.c
bootblock-y += tsc_freq.c
bootblock-y += uart_early.c
romstage-y += placeholders.c
romstage-y += gpio.c
+romstage-y += mmap_boot.c
romstage-y += uart_early.c
smm-y += placeholders.c
ramstage-y += placeholders.c
ramstage-y += gpio.c
+ramstage-y += mmap_boot.c
ramstage-y += uart_early.c
CPPFLAGS_common += -I$(src)/soc/intel/apollolake/include
diff --git a/src/soc/intel/apollolake/mmap_boot.c b/src/soc/intel/apollolake/mmap_boot.c
new file mode 100644
index 0000000..3625924
--- /dev/null
+++ b/src/soc/intel/apollolake/mmap_boot.c
@@ -0,0 +1,74 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Andrey Petrov <andrey.petrov(a)intel.com> for Intel Corp.)
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <boot_device.h>
+#include <cbfs.h>
+#include <commonlib/region.h>
+#include <console/console.h>
+#include <fmap.h>
+
+/* The 128 KiB right below 4G are decoded by readonly SRAM, not boot media */
+#define IFD_BIOS_MAX_MAPPED (CONFIG_IFD_BIOS_END - 128 * KiB)
+#define IFD_MAPPED_SIZE (IFD_BIOS_MAX_MAPPED - CONFIG_IFD_BIOS_START)
+#define IFD_BIOS_SIZE (CONFIG_IFD_BIOS_END - CONFIG_IFD_BIOS_START)
+
+/*
+ * If Apollo Lake is configured to boot from SPI flash "BIOS" region
+ * (as defined in descriptor) is mapped below 4GiB. Form a pointer for
+ * the base.
+ */
+#define VIRTUAL_ROM_BASE ((uintptr_t)(0x100000000ULL - IFD_BIOS_SIZE))
+
+static const struct mem_region_device shadow_dev = MEM_REGION_DEV_INIT(
+ VIRTUAL_ROM_BASE, IFD_BIOS_MAX_MAPPED
+);
+
+/*
+ * This is how we translate physical SPI flash address space into CPU memory-mapped space. In
+ * essence this means "BIOS" region (usually starts at flash physical 0x1000 is mapped to
+ * 4G - IFD_BIOS_SIZE.
+ */
+static const struct xlate_region_device real_dev = XLATE_REGION_INIT(
+ &shadow_dev.rdev, CONFIG_IFD_BIOS_START,
+ IFD_MAPPED_SIZE, CONFIG_ROM_SIZE
+);
+
+const struct region_device *boot_device_ro(void)
+{
+ return &real_dev.rdev;
+}
+
+static int iafw_boot_region_properties(struct cbfs_props *props)
+{
+ struct region regn;
+
+ /* use fmap to locate CBFS area */
+ if (fmap_locate_area("COREBOOT", ®n))
+ return -1;
+
+ props->offset = region_offset(®n);
+ props->size = region_sz(®n);
+
+ printk(BIOS_DEBUG, "CBFS @ %zx size %zx\n", props->offset, props->size);
+
+ return 0;
+}
+
+/*
+ * Named cbfs_master_header_locator so that it overrides the default, but
+ * incompatible locator in cbfs.c
+ */
+const struct cbfs_locator cbfs_master_header_locator = {
+ .name = "IAFW Locator",
+ .locate = iafw_boot_region_properties,
+};
Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13804
-gerrit
commit d3a884b160ece3babcd78027a1805f22b6eefa73
Author: Andrey Petrov <andrey.petrov(a)intel.com>
Date: Thu Feb 25 17:22:17 2016 -0800
arch/x86: Expose some symbols from linker script file
Apollolake SoC needs some symbols, i.e CAR stack size
and FIT pointer.
Change-Id: I1f1af4983804dc8521d0427f43381bde6d23a060
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/arch/x86/include/arch/symbols.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/arch/x86/include/arch/symbols.h b/src/arch/x86/include/arch/symbols.h
new file mode 100644
index 0000000..dd41d01
--- /dev/null
+++ b/src/arch/x86/include/arch/symbols.h
@@ -0,0 +1,21 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * 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.
+ */
+
+#ifndef __ARCH_SYMBOLS_H
+#define __ARCH_SYMBOLS_H
+
+/* stages may need to know end of CAR data */
+extern char _car_data_start[];
+extern char _car_data_end[];
+
+#endif
Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13796
-gerrit
commit 04cf1fcd369711e52b3d6fde80048b31e0889ecd
Author: Andrey Petrov <andrey.petrov(a)intel.com>
Date: Tue Mar 1 16:25:38 2016 -0800
drivers/intel/fsp2_0: Add coreboot<->FSP header files
This adds important header files that specify calling interface between
coreboot and FSP.
Change-Id: I393601c91e3c3f630e0fc899f1140ecefed8ecba
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/drivers/intel/Kconfig | 1 +
src/drivers/intel/Makefile.inc | 1 +
src/drivers/intel/fsp2_0/Kconfig | 6 ++
src/drivers/intel/fsp2_0/Makefile.inc | 11 +++
src/drivers/intel/fsp2_0/include/fsp/api.h | 103 +++++++++++++++++++++
src/drivers/intel/fsp2_0/include/fsp/info_header.h | 70 ++++++++++++++
src/drivers/intel/fsp2_0/include/fsp/util.h | 42 +++++++++
7 files changed, 234 insertions(+)
diff --git a/src/drivers/intel/Kconfig b/src/drivers/intel/Kconfig
index 19986f4..e5525d8 100644
--- a/src/drivers/intel/Kconfig
+++ b/src/drivers/intel/Kconfig
@@ -14,5 +14,6 @@
##
source src/drivers/intel/fsp1_1/Kconfig
+source src/drivers/intel/fsp2_0/Kconfig
source src/drivers/intel/gma/Kconfig
source src/drivers/intel/i210/Kconfig
diff --git a/src/drivers/intel/Makefile.inc b/src/drivers/intel/Makefile.inc
index e54f07b..67c1163 100644
--- a/src/drivers/intel/Makefile.inc
+++ b/src/drivers/intel/Makefile.inc
@@ -2,4 +2,5 @@ subdirs-y += gma
subdirs-$(CONFIG_GENERATE_SMBIOS_TABLES) += wifi
subdirs-$(CONFIG_PLATFORM_USES_FSP1_0) += fsp1_0
subdirs-$(CONFIG_PLATFORM_USES_FSP1_1) += fsp1_1
+subdirs-$(CONFIG_PLATFORM_USES_FSP2_0) += fsp2_0
subdirs-$(CONFIG_DRIVER_INTEL_I210) += i210
diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig
new file mode 100644
index 0000000..4ebe70a
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/Kconfig
@@ -0,0 +1,6 @@
+config PLATFORM_USES_FSP2_0
+ bool
+ help
+ Include FSP 2.0 wrappers and functionality
+
+endif # PLATFORM_USES_FSP2_0
diff --git a/src/drivers/intel/fsp2_0/Makefile.inc b/src/drivers/intel/fsp2_0/Makefile.inc
new file mode 100644
index 0000000..61faefa
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/Makefile.inc
@@ -0,0 +1,11 @@
+romstage-y += hand_off_block.c
+romstage-y += util.c
+romstage-y += memory_init.c
+
+ramstage-y += graphics.c
+ramstage-y += hand_off_block.c
+ramstage-y += notify.c
+ramstage-y += silicon_init.c
+ramstage-y += util.c
+
+CPPFLAGS_common += -I$(src)/drivers/intel/fsp2_0/include
diff --git a/src/drivers/intel/fsp2_0/include/fsp/api.h b/src/drivers/intel/fsp2_0/include/fsp/api.h
new file mode 100644
index 0000000..0d45df3
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/include/fsp/api.h
@@ -0,0 +1,103 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _FSP2_0_API_H_
+#define _FSP2_0_API_H_
+
+#include <stddef.h>
+#include <memrange.h>
+#include <fsp/info_header.h>
+
+enum fsp_status {
+ FSP_SUCCESS = 0x00000000,
+ FSP_INVALID_PARAMETER = 0x80000002,
+ FSP_UNSUPPORTED = 0x80000003,
+ FSP_NOT_READY = 0x80000006,
+ FSP_DEVICE_ERROR = 0x80000007,
+ FSP_OUT_OF_RESOURCES = 0x80000009,
+ FSP_VOLUME_CORRUPTED = 0x8000000a,
+ FSP_NOT_FOUND = 0x8000000a,
+ FSP_TIMEOUT = 0x80000012,
+ FSP_ABORTED = 0x80000015,
+ FSP_INCOMPATIBLE_VERSION = 0x80000010,
+ FSP_SECURITY_VIOLATION = 0x8000001a,
+ FSP_CRC_ERROR = 0x8000001b,
+};
+
+enum fsp_notify_phase {
+ AFTER_PCI_ENUM = 0x20,
+ READY_TO_BOOT = 0x40
+};
+
+
+/* Opaque structures. These are platform-specific. */
+struct FSP_M_CONFIG;
+struct FSP_S_CONFIG;
+
+/* Main FSP stages */
+enum fsp_status fsp_memory_init(void **hob_list, struct range_entry *r);
+enum fsp_status fsp_silicon_init(struct range_entry *r);
+enum fsp_status fsp_notify(enum fsp_notify_phase phase);
+
+/* Callbacks for updating stage-specific parameters */
+void platform_fsp_memory_init_params_cb(struct fsp_m_arch_upd *archupd,
+ struct FSP_M_CONFIG *mcfg);
+void platform_fsp_silicon_init_params_cb(struct FSP_S_CONFIG *silupd);
+
+/*
+ * # DOCUMENTATION:
+ *
+ * This file defines the interface between coreboot and the FSP 2.0 wrapper
+ * fsp_memory_init(), fsp_silicon_init(), and fsp_notify() are the main entry
+ * points and map 1:1 to the FSP entry points of the same name.
+ *
+ * ### fsp_memory_init():
+ * - hob_list: retuns a pointer to the HOB storage area created by FSP
+ * - r: memory range that the binary is allowed to be loaded into
+ *
+ * This function is responsible for loading and executing the memory
+ * initialization code from the FSP-M binary. It expects this binary to reside
+ * in cbfs as FSP_M_FILE.
+ *
+ * The function takes one parameter, which is described below, but does not
+ * take in memory parameters as an argument. The memory parameters can be filled
+ * in with platform_fsp_memory_init_params_cb(). This is a callback symbol
+ * that fsp_memory_init() will call. The platform must provide this symbol.
+ *
+ * FSP returns information about the memory layout in a series of structures
+ * called hand-off-blocks (HOB). The "hob_list" output parameter will point to
+ * the start of the HOB list. The fsp reserved region will also be described by
+ * one of the HOBs. For more information on parsing these structures, see
+ * fsp/util.h
+ *
+ *
+ * ### fsp_silicon_init():
+ * - r: memory range that the binary is allowed to be loaded into
+ *
+ * This function is responsible for loading and executing the silicon
+ * initialization code from the FSP-S binary. It expects this binary to reside
+ * in cbfs as FSP_S_FILE.
+ *
+ * Like fsp_memory_init(), it provides a callback to fill in FSP-specific
+ * parameters, via platform_fsp_silicon_init_params_cb(). The platform must
+ * also provide this symbol.
+ *
+ *
+ * ### fsp_notify():
+ * - phase: Which FSP notification phase
+ *
+ * This function is responsible for loading and executing the notify code from
+ * the FSP-S binary. It expects that fsp_silicon_init() has already been called
+ * succesfully, and that the FSP-S binary is still loaded into memory.
+ */
+
+#endif /* _FSP2_0_API_H_ */
diff --git a/src/drivers/intel/fsp2_0/include/fsp/info_header.h b/src/drivers/intel/fsp2_0/include/fsp/info_header.h
new file mode 100644
index 0000000..0f25496
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/include/fsp/info_header.h
@@ -0,0 +1,70 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _FSP2_0_INFO_HEADER_H_
+#define _FSP2_0_INFO_HEADER_H_
+
+#include <rules.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <types.h>
+
+#define FSP_HDR_OFFSET 0x94
+#define FSP_HDR_LEN 0x48
+#define FSP_HDR_SIGNATURE "FSPH"
+#define FSP_HDR_ATTRIB_FSPT (0b0001 << 28)
+#define FSP_HDR_ATTRIB_FSPM (0b0010 << 28)
+#define FSP_HDR_ATTRIB_FSPS (0b0011 << 28)
+
+struct fsp_header {
+ uint32_t fsp_revision;
+ size_t image_size;
+ uintptr_t image_base;
+ uint32_t image_attribute;
+ size_t cfg_region_offset;
+ size_t cfg_region_size;
+ size_t notify_phase_entry_offset;
+ size_t memory_init_entry_offset;
+ size_t silicon_init_entry_offset;
+ char image_id[sizeof(uint64_t) + 1];
+ uint8_t revision;
+};
+
+struct fsp_upd_header {
+ uint64_t signature;
+ uint8_t revision;
+};
+
+struct fsp_m_arch_upd {
+ uint8_t revision;
+ uintptr_t nvs_buffer;
+ uintptr_t stack_base;
+ uint32_t stack_size;
+ uint32_t bootloader_tolumsz;
+ uint32_t boot_mode;
+};
+
+enum cb_err fsp_identify(struct fsp_header *hdr, const void *fsp_blob);
+void fsp_print_header_info(const struct fsp_header *hdr);
+void fsp_print_upd_info(const struct fsp_header *hdr, void *cfg_blob);
+
+#if ENV_RAMSTAGE
+/*
+ * This is a FSP_INFO_HEADER that came from fsps.bin blob. It contains
+ * both SiliconInit and Notify APIs. When SiliconInit is loaded the
+ * header is saved so that when Notify is called we do not have to start
+ * header parsing again.
+ */
+extern struct fsp_header fsps_hdr;
+#endif
+
+#endif /* _FSP2_0_INFO_HEADER_H_ */
diff --git a/src/drivers/intel/fsp2_0/include/fsp/util.h b/src/drivers/intel/fsp2_0/include/fsp/util.h
new file mode 100644
index 0000000..69e545e
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/include/fsp/util.h
@@ -0,0 +1,42 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _FSP2_0_UTIL_H_
+#define _FSP2_0_UTIL_H_
+
+#include <boot/coreboot_tables.h>
+#include <fsp/info_header.h>
+#include <device/resource.h>
+#include <memrange.h>
+
+/*
+ * Hand-off-block handling functions that depend on CBMEM, and thus can only
+ * be used after cbmem_initialize().
+ */
+void fsp_save_hob_list(void *hob_list_ptr);
+const void *fsp_get_hob_list(void);
+const void *fsp_find_extension_hob_by_uuid(const uint8_t *uuid, size_t *size);
+enum cb_err fsp_fill_lb_framebuffer(struct lb_framebuffer *framebuffer);
+/*
+ * Hand-off-block utilities which do not depend on CBMEM, but need to be passed
+ * the HOB list explicitly.
+ */
+void fsp_find_reserved_memory(struct resource *res, const void *hob_list);
+void fsp_print_memory_resource_hobs(const void *hob_list);
+
+/* Load an FSP binary into CBFS, and fill the associated fsp_header struct */
+enum cb_err fsp_load_binary(struct fsp_header *hdr, const char *name,
+ struct range_entry *r);
+/* Load a vbt.bin file for graphics. Returns 0 if a valid VBT is not found. */
+uintptr_t fsp_load_vbt(void);
+
+#endif /* _FSP2_0_UTIL_H_ */
Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13799
-gerrit
commit 358beca6508d1a96c477b9644663466de21778b6
Author: Andrey Petrov <andrey.petrov(a)intel.com>
Date: Thu Feb 25 14:17:45 2016 -0800
drivers/intel/fsp2_0: Add SiliconInit API
This adds SiliconInit API that is needed to be called after memory
has been trained. This call is needed to let the blob do various
initialisations of IP blocks.
Change-Id: I35e02f22174c8392e55ac869265a19c4309932e5
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/drivers/intel/fsp2_0/silicon_init.c | 56 +++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/src/drivers/intel/fsp2_0/silicon_init.c b/src/drivers/intel/fsp2_0/silicon_init.c
new file mode 100644
index 0000000..9d6eb46
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/silicon_init.c
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Andrey Petrov <andrey.petrov(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <arch/cpu.h>
+#include <cbfs.h>
+#include <console/console.h>
+#include <fsp/api.h>
+#include <fsp/util.h>
+
+#define FSPS_OFFSET_S_CONFIG 0x40
+
+struct fsp_header fsps_hdr;
+
+typedef asmlinkage enum fsp_status (*fsp_silicon_init_fn)
+ (void *silicon_upd);
+
+static enum fsp_status do_silicon_init(struct fsp_header *hdr)
+{
+ uint8_t *silicon_upd;
+ struct FSP_S_CONFIG *fsp_s_config;
+ fsp_silicon_init_fn silicon_init;
+ enum fsp_status status;
+
+ silicon_upd = (uint8_t *) (hdr->cfg_region_offset + hdr->image_base);
+ /* UPD region is in RW memory, so it can be modified directly */
+ fsp_s_config = (struct FSP_S_CONFIG *) (silicon_upd +
+ FSPS_OFFSET_S_CONFIG);
+
+ /* Give SoC/mainboard a chance to populate entries */
+ platform_fsp_silicon_init_params_cb(fsp_s_config);
+
+ silicon_init = (void *) (hdr->image_base +
+ hdr->silicon_init_entry_offset);
+
+ status = silicon_init(silicon_upd);
+ printk(BIOS_DEBUG, "FspSiliconInit returned 0x%08x\n", status);
+ return status;
+}
+
+enum fsp_status fsp_silicon_init(struct range_entry *range)
+{
+ /* Load FSP-S and save FSP header. We will need it for Notify */
+ if (fsp_load_binary(&fsps_hdr, "blobs/fsps.bin", range) != CB_SUCCESS)
+ return FSP_NOT_FOUND;
+
+ return do_silicon_init(&fsps_hdr);
+}
Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13860
-gerrit
commit 4673f41a1d1159a7b473958b4c7ffbc364302078
Author: Andrey Petrov <andrey.petrov(a)intel.com>
Date: Sun Feb 28 22:04:51 2016 -0800
arch/x86: Allow soc/chipset to set linking address
Until recently x86 romstage used to be linked at some default
address. The address itself is not meaningful because the code
was normally relocated at address calculated during insertion
in CBFS. Since some newer SoC run romstage at CAR it became
useful to link romstage code at some address in CAR and avoid
relocation during build/run time altogether.
Change-Id: I11bec142ab204633da0000a63792de7057e2eeaf
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/arch/x86/Kconfig | 10 ++++++++++
src/arch/x86/memlayout.ld | 4 ++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig
index 89e142a..2257cb6 100644
--- a/src/arch/x86/Kconfig
+++ b/src/arch/x86/Kconfig
@@ -161,3 +161,13 @@ config COMPILE_IN_DSDT
config C_ENV_BOOTBLOCK_SIZE
hex
default 0x10000
+
+# Default address romstage is to be linked at
+config ROMSTAGE_ADDR
+ hex
+ default 0x2000000
+
+# Default address verstage is to be linked at
+config VERSTAGE_ADDR
+ hex
+ default 0x2000000
diff --git a/src/arch/x86/memlayout.ld b/src/arch/x86/memlayout.ld
index fb67575..56611041 100644
--- a/src/arch/x86/memlayout.ld
+++ b/src/arch/x86/memlayout.ld
@@ -31,14 +31,14 @@ SECTIONS
#elif ENV_ROMSTAGE
/* The 1M size is not allocated. It's just for basic size checking.
* Link at 32MiB address and rely on cbfstool to relocate to XIP. */
- ROMSTAGE(32M, 1M)
+ ROMSTAGE(CONFIG_ROMSTAGE_ADDR, 1M)
/* Pull in the cache-as-ram rules. */
#include "car.ld"
#elif ENV_VERSTAGE
/* The 1M size is not allocated. It's just for basic size checking.
* Link at 32MiB address and rely on cbfstool to relocate to XIP. */
- VERSTAGE(32M, 1M)
+ VERSTAGE(CONFIG_VERSTAGE_ADDR, 1M)
/* Pull in the cache-as-ram rules. */
#include "car.ld"
Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13861
-gerrit
commit dbaa71bb952d670bf8d10476b492ed7684f2b368
Author: Andrey Petrov <andrey.petrov(a)intel.com>
Date: Sun Feb 28 22:37:15 2016 -0800
arch/x86: Add common assembly code for stages that run in CAR
This adds a few assembly lines that are generic enought to be shared
between romstage and verstage that are ran in CAR.
Change-Id: Ie7ef6a02f62627f29a109126d08c68176075bd67
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/arch/x86/carstage_entry.S | 54 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/src/arch/x86/carstage_entry.S b/src/arch/x86/carstage_entry.S
new file mode 100644
index 0000000..4a601a7
--- /dev/null
+++ b/src/arch/x86/carstage_entry.S
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2016 Intel Corp.
+ * 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.
+ */
+
+.global _start
+_start:
+
+#define LHLT_DELAY 0x50000 /* I/O delay between post codes on failure */
+ /*
+ * This code is meant to be used for stages that are ran in CAR.
+ * The assumption is that gdt is already loaded. So in order to
+ * continue with C code execution we needed to set stack pointer
+ * and clear CAR_GLOBAL variables that are stage-specific.
+ */
+
+ /* reset stack pointer to CAR stack */
+ mov $_car_stack_end, %esp
+
+ /* clear CAR_GLOBAL area as it is not shared */
+ cld
+ xor %eax, %eax
+ movl $(_car_global_end), %ecx
+ movl $(_car_global_start), %edi
+ sub %edi, %ecx
+ rep stosl
+
+ jmp romstage_car_entry
+ movb $0x69, %ah
+ jmp .Lhlt
+
+.Lhlt:
+ xchg %al, %ah
+#if IS_ENABLED(CONFIG_POST_IO)
+ outb %al, $CONFIG_POST_IO_PORT
+#else
+ post_code(POST_DEAD_CODE)
+#endif
+ movl $LHLT_DELAY, %ecx
+.Lhlt_Delay:
+ outb %al, $0xED
+ loop .Lhlt_Delay
+ jmp .Lhlt