Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13396
-gerrit
commit f26df2090229c2016792f81e1169fbf870f5c7c4
Author: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Date: Mon Dec 14 13:52:09 2015 -0800
drivers/intel/fsp2_0: Remove unused prototype in hand_off_block.c
This was probably a test function that was removed, but the prototype
was forgotten.
Change-Id: Ied0d242fa317714d73399b480c663ac1ba996b89
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
---
src/drivers/intel/fsp2_0/hand_off_block.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/drivers/intel/fsp2_0/hand_off_block.c b/src/drivers/intel/fsp2_0/hand_off_block.c
index 4d061b5..df68e61 100644
--- a/src/drivers/intel/fsp2_0/hand_off_block.c
+++ b/src/drivers/intel/fsp2_0/hand_off_block.c
@@ -19,8 +19,6 @@
#include <lib.h>
#include <string.h>
-void hoboparse (const void *hob);
-
#define HOB_HEADER_LEN 8
struct hob_header {
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13398
-gerrit
commit d65768ae7597cb7c54905430e22a5fca48b59793
Author: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Date: Wed Jan 13 14:11:11 2016 -0800
soc/apollolake: Adjust CAR addresses for new FSP memory layout
The FSP memory layout changed, and things need to be shuffled around
a bit, as well as doubling the size of the CAR region.
Change-Id: I14cbcf5141eea9a7a69c8c1628aac701223c04e8
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
---
src/soc/intel/apollolake/Kconfig | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig
index 1b60bcf..179eaad 100644
--- a/src/soc/intel/apollolake/Kconfig
+++ b/src/soc/intel/apollolake/Kconfig
@@ -59,7 +59,7 @@ config DCACHE_RAM_BASE
config DCACHE_RAM_SIZE
hex "Length in bytes of cache-as-RAM"
- default 0x80000
+ default 0x100000
help
The size of the cache-as-ram region required during bootblock
and/or romstage.
@@ -69,21 +69,13 @@ config DCACHE_RAM_BOOTBLOCK_STACK_SIZE
default 0x800
help
The amount of anticipated stack usage from the bootblock during
- pre-romstage initialization..
+ pre-romstage initialization.
-config IFD_BIOS_START
+config ROMSTAGE_CAR_ADDR
hex
- default 0x1000
+ default 0xfef2e000
help
- The starting address of flash region 1 (BIOS), as declared in the
- firmware descriptor. This can be obtained via 'ifdtool -d'.
-
-config IFD_BIOS_END
- hex
- default ROM_SIZE
- help
- The ending address of flash region 1 (BIOS), as declared in the
- firmware descriptor. This can be obtained via 'ifdtool -d'.
+ The base address (in CAR) where romstage should be linked
config CPU_ADDR_BITS
int
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13389
-gerrit
commit 46b66c0625961d950b8db9bda88d467fa47ff4cb
Author: Zhao, Lijian <lijian.zhao(a)intel.com>
Date: Mon Jan 4 16:34:07 2016 -0800
soc/intel/apollolake: Do not setup ACPI SMI_CMD
Current coreboot do not have the smm setup, also no smi handler yet.So we
should not report the SMI CMD port to ACPI FADT table, also the ACPI enable
and ACPI disable command should be zero as well.
Change-Id: I1d03082359191eee7e13bfea5a98c65e0722dfb2
Signed-off-by: Zhao, Lijian <lijian.zhao(a)intel.com>
---
src/soc/intel/apollolake/acpi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/soc/intel/apollolake/acpi.c b/src/soc/intel/apollolake/acpi.c
index 9939408..3b622b8 100644
--- a/src/soc/intel/apollolake/acpi.c
+++ b/src/soc/intel/apollolake/acpi.c
@@ -63,9 +63,7 @@ void soc_fill_common_fadt(acpi_fadt_t * fadt)
const uint16_t pmbase = ACPI_PMIO_BASE;
fadt->sci_int = acpi_sci_irq();
- fadt->smi_cmd = APM_CNT;
- fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
- fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
+ fadt->smi_cmd = 0; /* No Smi Handler as SMI_CMD is 0*/
fadt->pm1a_evt_blk = pmbase + PM1_STS;
fadt->pm1a_cnt_blk = pmbase + PM1_CNT;
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13390
-gerrit
commit da966d4d7dcce4a18ecc7bcddc4642f3f06a3ddf
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Tue Nov 24 16:23:28 2015 -0800
libpayload: x86/arch: Implement basic CPUID functionality
This patch implements minimal cpuid functionality. The API and
structure of the functions is kept consistent with coreboot's
implementation.
Change-Id: I6fbfbc3d1d040c02d4784afe6dc4397cff9fca64
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
---
payloads/libpayload/include/x86/arch/cpuid.h | 121 +++++++++++++++++++++++++++
1 file changed, 121 insertions(+)
diff --git a/payloads/libpayload/include/x86/arch/cpuid.h b/payloads/libpayload/include/x86/arch/cpuid.h
new file mode 100644
index 0000000..f3ee293
--- /dev/null
+++ b/payloads/libpayload/include/x86/arch/cpuid.h
@@ -0,0 +1,121 @@
+/*
+ * This file is part of the libpayload project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _ARCH_X86_CPUID_H
+#define _ARCH_X86_CPUID_H
+
+struct cpuid_result {
+ uint32_t eax;
+ uint32_t ebx;
+ uint32_t ecx;
+ uint32_t edx;
+};
+
+struct cpuid_fms {
+ uint16_t family;
+ uint8_t model;
+ uint8_t stepping;
+};
+
+static inline struct cpuid_result cpuid(uint32_t op_eax)
+{
+ struct cpuid_result res;
+
+ __asm__ volatile(
+ "cpuid"
+ : "=a" (res.eax), "=b" (res.ebx), "=c" (res.ecx), "=d" (res.edx)
+ : "a" (op_eax)
+ );
+
+ return res;
+}
+
+static inline uint32_t cpuid_eax(uint32_t op_eax)
+{
+ struct cpuid_result res = cpuid(op_eax);
+
+ return res.eax;
+}
+
+static inline uint32_t cpuid_ebx(uint32_t op_eax)
+{
+ struct cpuid_result res = cpuid(op_eax);
+
+ return res.ebx;
+}
+
+static inline uint32_t cpuid_ecx(uint32_t op_eax)
+{
+ struct cpuid_result res = cpuid(op_eax);
+
+ return res.ecx;
+}
+
+static inline uint32_t cpuid_edx(uint32_t op_eax)
+{
+ struct cpuid_result res = cpuid(op_eax);
+
+ return res.edx;
+}
+
+/**
+ * Extract the CPU family, model and stepping
+ *
+ * For details, see:
+ * Intel 64 and IA-32 Architectures Software Developer’s Manual
+ * Combined Volumes: 1, 2A, 2B, 2C, 3A, 3B, 3C and 3D
+ * Order Number: 325462-056US
+ * - Figure 3-6. Version Information Returned by CPUID in EAX
+ * pg. 3-190 Vol. 2A
+ *
+ * and
+ *
+ * AMD CPUID Specification
+ * Publication # 25481 Revision: 2.34
+ * - CPUID Fn0000_0001_EAX Family, Model, Stepping Identifiers
+ * pg. 10
+ */
+static inline struct cpuid_fms cpuid_get_fms(void)
+{
+ struct cpuid_fms fms;
+ const uint32_t eax = cpuid_eax(1);
+
+ fms.family = (eax >> 8) & 0xf;
+ if (fms.family == 0xf)
+ fms.family += (eax >> 20) & 0xff;
+
+ fms.model = ((eax >> 4) & 0xf);
+ if ((fms.family == 0xf) | (fms.family == 6))
+ fms.model |= ((eax >> 16) & 0xf) << 4;
+
+ fms.stepping = eax & 0xf;
+
+ return fms;
+}
+
+#endif /* _ARCH_X86_CPUID_H */
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13391
-gerrit
commit 8cd1ab462022e286e79b28473533befab35a32a9
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Tue Nov 24 16:40:10 2015 -0800
libpayload: x86/timer: Implement constant TSC based calibration
On certain SOCs, such as Apollolake, the 8254 timer is not present or
not operational. On such systems, attempting to calibrate the TSC
against the 8254 will hang the payload. The next best approach is to
identify processors with a constant TSC rate, and determine the actual
speed by reading model-specific registers.
With this patch, filo can now succesfully load the filo shell on
Appololalke RVP2 board.
Change-Id: I863acbc015cf072fa007584ab1d4f4531f0a6d4f
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
payloads/libpayload/arch/x86/timer.c | 99 ++++++++++++++++++++++++++++++++++--
1 file changed, 95 insertions(+), 4 deletions(-)
diff --git a/payloads/libpayload/arch/x86/timer.c b/payloads/libpayload/arch/x86/timer.c
index bf0c30a..d015dcc 100644
--- a/payloads/libpayload/arch/x86/timer.c
+++ b/payloads/libpayload/arch/x86/timer.c
@@ -33,20 +33,93 @@
*/
#include <libpayload.h>
+#include <arch/cpuid.h>
#include <arch/rdtsc.h>
+#include <arch/msr.h>
+#define MSR_PLATFORM_INFO 0xce
/**
* @ingroup arch
* Global variable containing the speed of the processor in KHz.
*/
uint32_t cpu_khz;
-/**
- * Calculate the speed of the processor for use in delays.
+const char intel_cpuid_mfg_string[] = "GenuineIntel";
+
+/*
+ * Certain Atom SOCs don't either don't have an 8254 timer (PIT), or coreboot
+ * disables the PIT. In these cases TSC calibration by PIT will hang.
*
- * @return The CPU speed in kHz.
+ * NOTE: This table and its associated helper functions can be extended to
+ * support a larger range of CPUs and access methods. This only includes tested
+ * CPUs.
*/
-unsigned int get_cpu_speed(void)
+static const struct fsb_freq_descriptor {
+ uint8_t cpu_family;
+ uint8_t cpu_model;
+ unsigned int base_clock_khz;
+} intel_freq_table[] = {
+ { 6, 0x5c, 100000 },
+};
+
+static const struct fsb_freq_descriptor *get_cpu_freq_info(void)
+{
+ size_t i;
+ struct cpuid_fms fms = cpuid_get_fms();
+
+ for (i = 0; i < ARRAY_SIZE(intel_freq_table); i++) {
+ if ((intel_freq_table[i].cpu_family == fms.family) &&
+ (intel_freq_table[i].cpu_model == fms.model)) {
+ return &intel_freq_table[i];
+ }
+ }
+
+ return NULL;
+}
+
+static int is_intel_cpu(void)
+{
+ char id_string[12];
+ struct cpuid_result res;
+
+ /* Get manufacturer's ID string */
+ res = cpuid(0);
+ memcpy(id_string + 0, &res.ebx, 4);
+ memcpy(id_string + 4, &res.edx, 4);
+ memcpy(id_string + 8, &res.ecx, 4);
+
+ return !memcmp(intel_cpuid_mfg_string, id_string, 12);
+}
+
+/*
+ * Get the speed of the processor's timestamp counter on supported CPUs
+ */
+static unsigned int get_cpu_speed_by_const_tsc(void)
+{
+ uint64_t msr;
+ uint32_t tsc_multiplier;
+ const struct fsb_freq_descriptor *freq_info;
+
+ if (!is_intel_cpu())
+ return 0;
+
+ freq_info = get_cpu_freq_info();
+ if (!freq_info)
+ return 0;
+
+ msr = _rdmsr(MSR_PLATFORM_INFO);
+ tsc_multiplier = (msr >> 8) & 0xff;
+
+ cpu_khz = (freq_info->base_clock_khz * tsc_multiplier);
+ return cpu_khz;
+}
+
+/*
+ * Get the speed of the processor's timestamp counter by calibrating it
+ * against the 8254 programmable interval timer.
+ * This function waits 2 ms to get an accurate calibration.
+ */
+static unsigned int get_cpu_speed_by_8254_timer(void)
{
unsigned long long start, end;
const uint32_t clock_rate = 1193182; // 1.193182 MHz
@@ -76,3 +149,21 @@ unsigned int get_cpu_speed(void)
return cpu_khz;
}
+
+/**
+ * Calculate the speed of the processor for use in delays.
+ *
+ * @return The CPU speed in kHz.
+ */
+unsigned int get_cpu_speed(void)
+{
+ uint32_t tsc_rate_khz;
+
+ tsc_rate_khz = get_cpu_speed_by_const_tsc();
+ if (tsc_rate_khz)
+ return tsc_rate_khz;
+
+ tsc_rate_khz = get_cpu_speed_by_8254_timer();
+
+ return tsc_rate_khz;
+}
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13378
-gerrit
commit e3eceedbe3a781bb658d20696ddc990a5056330a
Author: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Date: Mon Dec 7 16:30:41 2015 -0800
drivers/intel/fsp2_0: Document the wrapper API
The FSP 2.0 wrapper makes several assumptions about memory use and
call order. Those have escaped undocumented... until now.
Change-Id: I8ab0ced746ef884d9a686c5beb79252c0fa408e2
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
---
src/drivers/intel/fsp2_0/include/fsp/api.h | 52 ++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/src/drivers/intel/fsp2_0/include/fsp/api.h b/src/drivers/intel/fsp2_0/include/fsp/api.h
index 08f5b57..11e29a0 100644
--- a/src/drivers/intel/fsp2_0/include/fsp/api.h
+++ b/src/drivers/intel/fsp2_0/include/fsp/api.h
@@ -47,4 +47,56 @@ enum fsp_status fsp_notify(enum fsp_notify_phase phase);
void platform_fsp_memory_init_params_cb(struct MEMORY_INIT_UPD *memupd);
void platform_fsp_silicon_init_params_cb(struct SILICON_INIT_UPD *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
+ * - tolum_size: The size of the memory area below TSEG to reserve for
+ * use by coreboot
+ *
+ * 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 "blobs/fsp-m.bin".
+ *
+ * The function takes two parameters, which are 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 weak callback symbol
+ * that fsp_memory_init() will call.
+ *
+ * FSP MemoryInit will "reserve" a memory area below TSEG for use by later FSP
+ * stages, and it expects that this memory area not be written. It can, however,
+ * leave an area of memory between TSEG and the fsp reserved region available
+ * for use by coreboot. The size of this area is specified by the "tolum_size"
+ * parameter.
+ *
+ * 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():
+ *
+ * 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 "blobs/fsp-s.bin".
+ *
+ * Like fsp_memory_init(), it provides a callback to fill in FSP-specific
+ * parameters, via platform_fsp_silicon_init_params_cb().
+ *
+ *
+ * ### 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_ */