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 751d4ab19b62bb4c0aa06fa816b1e8f6f4f9c96b
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 | 59 +++++++++++++++++++++++++++++++++
1 file changed, 59 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..66043c8
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/silicon_init.c
@@ -0,0 +1,59 @@
+/*
+ * 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>
+#include <string.h>
+
+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)
+{
+ struct FSPS_UPD upd, *supd;
+ fsp_silicon_init_fn silicon_init;
+ enum fsp_status status;
+
+ supd = (struct FSPS_UPD *) (hdr->cfg_region_offset + hdr->image_base);
+
+ if (supd->FspUpdHeader.Signature != FSPS_UPD_SIGNATURE) {
+ printk(BIOS_ERR, "Invalid FSPS signature\n");
+ return FSP_INCOMPATIBLE_VERSION;
+ }
+
+ memcpy(&upd, supd, sizeof(upd));
+
+ /* Give SoC/mainboard a chance to populate entries */
+ platform_fsp_silicon_init_params_cb(&upd);
+
+ silicon_init = (void *) (hdr->image_base +
+ hdr->silicon_init_entry_offset);
+
+ status = silicon_init(&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 */
+ /* TODO: do not hardcode CBFS file names */
+ if (fsp_load_binary(&fsps_hdr, "blobs/fsps.bin", range) != CB_SUCCESS)
+ return FSP_NOT_FOUND;
+
+ return do_silicon_init(&fsps_hdr);
+}
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13935
-gerrit
commit b7ad987356a66a27d7c29d1af3de74fdff74f41c
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Mon Mar 7 16:05:36 2016 -0600
cpu/x86/mtrr: add helper function to detect variable MTRRs
The current MTRR API doesn't allow one to detect variable MTRRs
along with handling fixed MTRRs in one function call. Therefore,
add x86_setup_mtrrs_with_detect() to perform the same actions
as x86_setup_mtrrs() but always do the dynamic detection.
Change-Id: I443909691afa28ce11882e2beab12e836e5bcb3d
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/cpu/x86/mtrr/mtrr.c | 13 ++++++++++---
src/include/cpu/x86/mtrr.h | 12 +++++++++---
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c
index efd0b68..794df99 100644
--- a/src/cpu/x86/mtrr/mtrr.c
+++ b/src/cpu/x86/mtrr/mtrr.c
@@ -789,8 +789,6 @@ void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb)
addr_space = get_physical_address_space();
if (sol == NULL) {
- if (above4gb == 2)
- detect_var_mtrrs();
sol = &mtrr_global_solution;
sol->mtrr_default_type =
calc_var_mtrrs(addr_space, !!above4gb, address_bits);
@@ -804,12 +802,21 @@ void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb)
void x86_setup_mtrrs(void)
{
int address_size;
+
x86_setup_fixed_mtrrs();
address_size = cpu_phys_address_size();
- printk(BIOS_DEBUG, "CPU physical address size: %d bits\n", address_size);
+ printk(BIOS_DEBUG, "CPU physical address size: %d bits\n",
+ address_size);
+ /* Always handle addresses above 4GiB. */
x86_setup_var_mtrrs(address_size, 1);
}
+void x86_setup_mtrrs_with_detect(void)
+{
+ detect_var_mtrrs();
+ x86_setup_mtrrs();
+}
+
void x86_mtrr_check(void)
{
/* Only Pentium Pro and later have MTRR */
diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h
index 8fd4261..d158735 100644
--- a/src/include/cpu/x86/mtrr.h
+++ b/src/include/cpu/x86/mtrr.h
@@ -56,14 +56,20 @@
* of the nature of the global MTRR enable flag. Therefore, all direct
* or indirect callers of enable_fixed_mtrr() should ensure that the
* variable MTRR MSRs do not contain bad ranges.
+ *
+ * Note that this function sets up MTRRs for addresses above 4GiB.
*/
void x86_setup_mtrrs(void);
/*
+ * x86_setup_mtrrs_with_detect() does the same thing as x86_setup_mtrrs(), but
+ * it always dynamically detects the number of variable MTRRs available.
+ */
+void x86_setup_mtrrs_with_detect(void);
+/*
* x86_setup_var_mtrrs() parameters:
* address_bits - number of physical address bits supported by cpu
- * above4gb - 2 means dynamically detect number of variable MTRRs available.
- * non-zero means handle memory ranges above 4GiB.
- * 0 means ignore memory ranges above 4GiB
+ * above4gb - if set setup MTRRs for addresses above 4GiB else ignore
+ * memory ranges above 4GiB
*/
void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb);
void enable_fixed_mtrr(void);
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13935
-gerrit
commit 0aea9ee1b83aeebad51b7bab68ddd00aa31ca5c1
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Mon Mar 7 16:05:36 2016 -0600
cpu/x86/mtrr: add helper function to detect variable MTRRs
The current MTRR API doesn't allow one to detect variable MTRRs
along with handling fixed MTRRs in one function call. Therefore,
add x86_setup_mtrrs_with_detect() to perform the same actions
as x86_setup_mtrrs() but always do the dynamic detection.
Change-Id: I443909691afa28ce11882e2beab12e836e5bcb3d
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/cpu/x86/mtrr/mtrr.c | 13 ++++++++++---
src/include/cpu/x86/mtrr.h | 14 ++++++++++----
2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c
index efd0b68..794df99 100644
--- a/src/cpu/x86/mtrr/mtrr.c
+++ b/src/cpu/x86/mtrr/mtrr.c
@@ -789,8 +789,6 @@ void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb)
addr_space = get_physical_address_space();
if (sol == NULL) {
- if (above4gb == 2)
- detect_var_mtrrs();
sol = &mtrr_global_solution;
sol->mtrr_default_type =
calc_var_mtrrs(addr_space, !!above4gb, address_bits);
@@ -804,12 +802,21 @@ void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb)
void x86_setup_mtrrs(void)
{
int address_size;
+
x86_setup_fixed_mtrrs();
address_size = cpu_phys_address_size();
- printk(BIOS_DEBUG, "CPU physical address size: %d bits\n", address_size);
+ printk(BIOS_DEBUG, "CPU physical address size: %d bits\n",
+ address_size);
+ /* Always handle addresses above 4GiB. */
x86_setup_var_mtrrs(address_size, 1);
}
+void x86_setup_mtrrs_with_detect(void)
+{
+ detect_var_mtrrs();
+ x86_setup_mtrrs();
+}
+
void x86_mtrr_check(void)
{
/* Only Pentium Pro and later have MTRR */
diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h
index 8fd4261..4df0bfb 100644
--- a/src/include/cpu/x86/mtrr.h
+++ b/src/include/cpu/x86/mtrr.h
@@ -56,16 +56,22 @@
* of the nature of the global MTRR enable flag. Therefore, all direct
* or indirect callers of enable_fixed_mtrr() should ensure that the
* variable MTRR MSRs do not contain bad ranges.
+ *
+ * Note that this function sets up MTRRs for addresses above 4GiB.
*/
void x86_setup_mtrrs(void);
/*
+ * x86_setup_mtrrs_with_detect() does the same thing as x86_setup_mtrrs(), but
+ * it always dynamically detects the number of variable MTRRs available.
+ */
+void x86_setup_mtrrs_with_detect(void);
+/*
* x86_setup_var_mtrrs() parameters:
* address_bits - number of physical address bits supported by cpu
- * above4gb - 2 means dynamically detect number of variable MTRRs available.
- * non-zero means handle memory ranges above 4GiB.
- * 0 means ignore memory ranges above 4GiB
+ * above4gb - if set setup MTRRs for addresses above 4GiB else ignore
+ * memory ranges above 4GiB
*/
-void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb);
+void x86_setup_var_mtrrs(unsigned int address_bits, int above4gb);
void enable_fixed_mtrr(void);
void x86_setup_fixed_mtrrs(void);
/* Set up fixed MTRRs but do not enable them. */
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13935
-gerrit
commit f07430055284cd9c3d31163725f70a2edefbb56d
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Mon Mar 7 16:05:36 2016 -0600
cpu/x86/mtrr: add helper function to detect variable MTRRs
The current MTRR API doesn't allow one to detect variable MTRRs
along with handling fixed MTRRs in one function call. Therefore,
add x86_setup_mtrrs_with_detect() to perform the same actions
as x86_setup_mtrrs() but always do the dynamic detection.
Change-Id: I443909691afa28ce11882e2beab12e836e5bcb3d
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/cpu/x86/mtrr/mtrr.c | 22 +++++++++++++++++++---
src/include/cpu/x86/mtrr.h | 7 +++++++
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c
index efd0b68..84e005a 100644
--- a/src/cpu/x86/mtrr/mtrr.c
+++ b/src/cpu/x86/mtrr/mtrr.c
@@ -801,13 +801,29 @@ void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb)
commit_var_mtrrs(sol);
}
-void x86_setup_mtrrs(void)
+static void __x86_setup_mtrrs(int above4gb)
{
int address_size;
+
x86_setup_fixed_mtrrs();
address_size = cpu_phys_address_size();
- printk(BIOS_DEBUG, "CPU physical address size: %d bits\n", address_size);
- x86_setup_var_mtrrs(address_size, 1);
+ printk(BIOS_DEBUG, "CPU physical address size: %d bits\n",
+ address_size);
+ /* Always handle addresses above 4GiB. */
+ x86_setup_var_mtrrs(address_size, above4gb);
+}
+
+void x86_setup_mtrrs(void)
+{
+ /* Handle addresses above 4GiB, but don't detect number of variable
+ * MTRRs. */
+ __x86_setup_mtrrs(1);
+}
+
+void x86_setup_mtrrs_with_detect(void)
+{
+ /* Handle addresses above 4GiB, but detect number of variable MTRRs. */
+ __x86_setup_mtrrs(2);
}
void x86_mtrr_check(void)
diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h
index 8fd4261..5a92ea3 100644
--- a/src/include/cpu/x86/mtrr.h
+++ b/src/include/cpu/x86/mtrr.h
@@ -56,9 +56,16 @@
* of the nature of the global MTRR enable flag. Therefore, all direct
* or indirect callers of enable_fixed_mtrr() should ensure that the
* variable MTRR MSRs do not contain bad ranges.
+ *
+ * Note that this function sets up MTRRs for addresses above 4GiB.
*/
void x86_setup_mtrrs(void);
/*
+ * x86_setup_mtrrs_with_detect() does the same thing as x86_setup_mtrrs(), but
+ * it always dynamically detects the number of variable MTRRs available.
+ */
+void x86_setup_mtrrs_with_detect(void);
+/*
* x86_setup_var_mtrrs() parameters:
* address_bits - number of physical address bits supported by cpu
* above4gb - 2 means dynamically detect number of variable MTRRs available.