Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36382 )
Change subject: cpu/x86/mtrr: Add function to set MTRR with CR0.CD set
......................................................................
cpu/x86/mtrr: Add function to set MTRR with CR0.CD set
MTRRs should only be changed when CR0.CD is set. In a CAR environment
this is a rather fragile thing to do. This is why it is best to
implement this in assembly.
Change-Id: I4ff59d35ade125f60ed0002a386f41fd8ad54073
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/cpu/x86/mtrr/Makefile.inc
M src/cpu/x86/mtrr/earlymtrr.c
A src/cpu/x86/mtrr/set_mtrr.S
M src/include/cpu/x86/mtrr.h
4 files changed, 88 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/82/36382/1
diff --git a/src/cpu/x86/mtrr/Makefile.inc b/src/cpu/x86/mtrr/Makefile.inc
index caa6e9c..4052c52 100644
--- a/src/cpu/x86/mtrr/Makefile.inc
+++ b/src/cpu/x86/mtrr/Makefile.inc
@@ -3,6 +3,9 @@
romstage-y += earlymtrr.c
bootblock-y += earlymtrr.c
+bootblock-y += set_mtrr.S
+verstage-y += set_mtrr.S
+
bootblock-y += debug.c
romstage-y += debug.c
postcar-y += debug.c
diff --git a/src/cpu/x86/mtrr/earlymtrr.c b/src/cpu/x86/mtrr/earlymtrr.c
index 02dfbdc..2f6a64d 100644
--- a/src/cpu/x86/mtrr/earlymtrr.c
+++ b/src/cpu/x86/mtrr/earlymtrr.c
@@ -52,3 +52,17 @@
maskm.hi = (1 << (cpu_phys_address_size() - 32)) - 1;
wrmsr(MTRR_PHYS_MASK(reg), maskm);
}
+
+void set_var_mtrr_uncached(
+ unsigned int reg, unsigned int base, unsigned int size,
+ unsigned int type)
+{
+ /* Bit Bit 32-35 of MTRRphysMask should be set to 1 */
+ /* FIXME: It only support 4G less range */
+ msr_t basem, maskm;
+ basem.lo = base | type;
+ basem.hi = 0;
+ maskm.lo = ~(size - 1) | MTRR_PHYS_MASK_VALID;
+ maskm.hi = (1 << (cpu_phys_address_size() - 32)) - 1;
+ set_var_mtrr_uncached_asm(reg, basem, maskm);
+}
diff --git a/src/cpu/x86/mtrr/set_mtrr.S b/src/cpu/x86/mtrr/set_mtrr.S
new file mode 100644
index 0000000..43c19f7
--- /dev/null
+++ b/src/cpu/x86/mtrr/set_mtrr.S
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+#include <cpu/x86/mtrr.h>
+#include <cpu/x86/cache.h>
+#include <cpu/x86/post_code.h>
+.global set_var_mtrr_uncached_asm
+ /* ARG0: mtrr_num
+ * ARG1: mtrr_base.lo
+ * ARG2: mtrr_base.hi
+ * ARG3: mtrr_mask.lo
+ * ARG4: mtrr_mask.hi
+ */
+.code32
+set_var_mtrr_uncached_asm:
+ /* Callee saved registers */
+ pushl %ebp
+ movl %esp, %ebp
+ addl $8, %ebp
+ pushl %ebx
+ pushl %edx
+ pushl %esi
+ pushl %edi
+
+ movl 0(%ebp), %ecx
+ movl 4(%ebp), %ebx
+ movl 8(%ebp), %edx
+ movl 12(%ebp), %esi
+ movl 16(%ebp), %edi
+
+ /* Disable caching before setting MTRR */
+ movl %cr0, %eax
+ orl $CR0_CacheDisable, %eax
+ movl %eax, %cr0
+
+ /* MTRR_PHYS_BASE */
+ imul $2, %ecx, %ecx
+ addl $MTRR_PHYS_BASE(0), %ecx
+ movl %ebx, %eax
+ wrmsr
+ /* MTRR_PHYS_MASK */
+ addl $1, %ecx
+ movl %esi, %eax
+ movl %edi, %edx
+ wrmsr
+
+ /* Enable cache again. */
+ movl %cr0, %eax
+ andl $(~(CR0_CacheDisable | CR0_NoWriteThrough)), %eax
+ movl %eax, %cr0
+
+ /* Restore Callee saved registers */
+ popl %edi
+ popl %esi
+ popl %edx
+ popl %ebx
+ popl %ebp
+ ret
diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h
index 29256c8..103388f 100644
--- a/src/include/cpu/x86/mtrr.h
+++ b/src/include/cpu/x86/mtrr.h
@@ -107,6 +107,10 @@
void set_var_mtrr(unsigned int reg, unsigned int base, unsigned int size,
unsigned int type);
int get_free_var_mtrr(void);
+void set_var_mtrr_uncached(unsigned int reg, unsigned int base,
+ unsigned int size, unsigned int type);
+__attribute__((cdecl)) void set_var_mtrr_uncached_asm(unsigned int reg,
+ msr_t base, msr_t mask);
asmlinkage void display_mtrrs(void);
--
To view, visit https://review.coreboot.org/c/coreboot/+/36382
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I4ff59d35ade125f60ed0002a386f41fd8ad54073
Gerrit-Change-Number: 36382
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-MessageType: newchange
Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/37486 )
Change subject: rules.h: Add ENV_EARLY_RAM
......................................................................
rules.h: Add ENV_EARLY_RAM
Add a definition for environments where the x86's reset vector is in
DRAM and a unique linker file must be used to coordinate regions
across stages.
Change-Id: I03703ae37a835de08ad8c905bafa504bdc41e959
Signed-off-by: Marshall Dawson <marshalldawson3rd(a)gmail.com>
---
M src/include/rules.h
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/86/37486/1
diff --git a/src/include/rules.h b/src/include/rules.h
index fa60ede..1947ede 100644
--- a/src/include/rules.h
+++ b/src/include/rules.h
@@ -255,8 +255,10 @@
#if CONFIG(ARCH_X86)
/* Indicates memory layout is determined with arch/x86/car.ld. */
#define ENV_CACHE_AS_RAM (ENV_ROMSTAGE_OR_BEFORE && !CONFIG(RESET_VECTOR_IN_RAM))
+/* Reset vector is in DRAM, and memory layout is determined by its own .ld file. */
+#define ENV_EARLY_RAM (ENV_ROMSTAGE_OR_BEFORE && CONFIG(RESET_VECTOR_IN_RAM))
/* No .data sections with execute-in-place from ROM. */
-#define ENV_STAGE_HAS_DATA_SECTION !ENV_CACHE_AS_RAM
+#define ENV_STAGE_HAS_DATA_SECTION (!ENV_CACHE_AS_RAM && !ENV_EARLY_RAM)
/* No .bss sections for stage with CAR teardown. */
#define ENV_STAGE_HAS_BSS_SECTION 1
#else
--
To view, visit https://review.coreboot.org/c/coreboot/+/37486
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I03703ae37a835de08ad8c905bafa504bdc41e959
Gerrit-Change-Number: 37486
Gerrit-PatchSet: 1
Gerrit-Owner: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-MessageType: newchange
Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/37487 )
Change subject: program.ld: Qualify .bss linking with ENV_EARLY_RAM
......................................................................
program.ld: Qualify .bss linking with ENV_EARLY_RAM
Systems with ENV_EARLY_RAM need to position .bss in a consistent
location across early stages, and not necessarily within the
program region. Skip the default .bss section for these designs.
A subsequent patch will add the early linker script.
Change-Id: Icde1cfd02611b8cce634aa76f5c192d5b637cf44
Signed-off-by: Marshall Dawson <marshalldawson3rd(a)gmail.com>
---
M src/lib/program.ld
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/37487/1
diff --git a/src/lib/program.ld b/src/lib/program.ld
index a9d4e48..1c8f99e 100644
--- a/src/lib/program.ld
+++ b/src/lib/program.ld
@@ -125,7 +125,7 @@
}
#endif
-#if ENV_STAGE_HAS_BSS_SECTION && !ENV_CACHE_AS_RAM
+#if (ENV_STAGE_HAS_BSS_SECTION && !ENV_CACHE_AS_RAM && !ENV_EARLY_RAM)
.bss . : {
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_bss = .;
--
To view, visit https://review.coreboot.org/c/coreboot/+/37487
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Icde1cfd02611b8cce634aa76f5c192d5b637cf44
Gerrit-Change-Number: 37487
Gerrit-PatchSet: 1
Gerrit-Owner: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-MessageType: newchange
Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/38697 )
Change subject: vc/amd/fsp/picasso: Add file for GUIDs
......................................................................
vc/amd/fsp/picasso: Add file for GUIDs
Begin a file for GUIDs used by the FSP.
Signed-off-by: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Change-Id: Ied5c5085ea8ed55439192be8a44fa401aeb559a7
---
A src/vendorcode/amd/fsp/picasso/FspGuids.h
1 file changed, 23 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/97/38697/1
diff --git a/src/vendorcode/amd/fsp/picasso/FspGuids.h b/src/vendorcode/amd/fsp/picasso/FspGuids.h
new file mode 100644
index 0000000..9281b4e
--- /dev/null
+++ b/src/vendorcode/amd/fsp/picasso/FspGuids.h
@@ -0,0 +1,23 @@
+/*
+ * 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 __FSP_GUIDS__
+#define __FSP_GUIDS__
+
+#include <uuid.h>
+
+#define AMD_FSP_TSEG_HOB_GUID \
+ GUID_INIT(0x5fc7897a, 0x5aff, 0x4c61, \
+ 0xaa, 0x7a, 0xdd, 0xcf, 0xa9, 0x18, 0x43, 0x0c)
+
+#endif /* __FSP_GUIDS__ */
--
To view, visit https://review.coreboot.org/c/coreboot/+/38697
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ied5c5085ea8ed55439192be8a44fa401aeb559a7
Gerrit-Change-Number: 38697
Gerrit-PatchSet: 1
Gerrit-Owner: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-MessageType: newchange
Mimoja has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/37582 )
Change subject: drivers/intel: Make FSP_USE_REPO an SOC optin instead of list dependency
......................................................................
drivers/intel: Make FSP_USE_REPO an SOC optin instead of list dependency
For quite a bit now we are extending the FSP_USE_REPO option to be
available for all Intel SOCs. This results in an list beeing not only
hard to maintain but also prune to errors.
To change that behaviour this commit is introducing the
HAVE_INTEL_FSP_REPO config for SOCs that are supported from withing
3rdparty/fsp.
All other interactions with FSP_USE_REPO stay the same.
Change-Id: I68ae373ce591f06073064aa75aac32ceca8fa1cc
Signed-off-by: Johanna Schander <coreboot(a)mimoja.de>
---
M src/drivers/intel/fsp2_0/Kconfig
M src/soc/intel/Kconfig
M src/soc/intel/apollolake/Kconfig
M src/soc/intel/cannonlake/Kconfig
M src/soc/intel/denverton_ns/Kconfig
M src/soc/intel/icelake/Kconfig
M src/soc/intel/skylake/Kconfig
7 files changed, 11 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/82/37582/1
diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig
index 8c8ac59..9d1aa88 100644
--- a/src/drivers/intel/fsp2_0/Kconfig
+++ b/src/drivers/intel/fsp2_0/Kconfig
@@ -53,10 +53,7 @@
config FSP_USE_REPO
bool "Use the IntelFSP based binaries"
depends on ADD_FSP_BINARIES
- depends on SOC_INTEL_APOLLOLAKE || SOC_INTEL_SKYLAKE || \
- SOC_INTEL_KABYLAKE || SOC_INTEL_COFFEELAKE || \
- SOC_INTEL_ICELAKE || SOC_INTEL_WHISKEYLAKE || \
- SOC_INTEL_DENVERTON_NS
+ depends on HAVE_INTEL_FSP_REPO
help
When selecting this option, the SoC must set FSP_HEADER_PATH
and FSP_FD_PATH correctly so FSP splitting works.
diff --git a/src/soc/intel/Kconfig b/src/soc/intel/Kconfig
index 1eebeb6..16f43df 100644
--- a/src/soc/intel/Kconfig
+++ b/src/soc/intel/Kconfig
@@ -46,3 +46,8 @@
than the one in non-topswap bootblock. This string will be passed
onto ifittool (-A -n option). ifittool will not parse the region for MCU
entries, and only locate the region and insert its address into FIT.
+
+config HAVE_INTEL_FSP_REPO
+ bool "Use FSP Blobs from fsp submodule"
+ help
+ This SOC has FSP binaries living in 3rdparty/fsp.
diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig
index 0b3b30a..8dc7628 100644
--- a/src/soc/intel/apollolake/Kconfig
+++ b/src/soc/intel/apollolake/Kconfig
@@ -44,6 +44,7 @@
select GENERIC_GPIO_LIB
select INTEL_DESCRIPTOR_MODE_CAPABLE
select HAVE_SMI_HANDLER
+ select HAVE_INTEL_FSP_REPO
select MRC_SETTINGS_PROTECT
select MRC_SETTINGS_VARIABLE_DATA
select NO_FIXED_XIP_ROM_SIZE
diff --git a/src/soc/intel/cannonlake/Kconfig b/src/soc/intel/cannonlake/Kconfig
index 40c2fd7..8b55ac7 100644
--- a/src/soc/intel/cannonlake/Kconfig
+++ b/src/soc/intel/cannonlake/Kconfig
@@ -64,6 +64,7 @@
select CPU_INTEL_FIRMWARE_INTERFACE_TABLE
select FSP_M_XIP
select GENERIC_GPIO_LIB
+ select HAVE_INTEL_FSP_REPO
select HAVE_FSP_GOP
select INTEL_DESCRIPTOR_MODE_CAPABLE
select HAVE_SMI_HANDLER
diff --git a/src/soc/intel/denverton_ns/Kconfig b/src/soc/intel/denverton_ns/Kconfig
index 9445977..0289cf4 100644
--- a/src/soc/intel/denverton_ns/Kconfig
+++ b/src/soc/intel/denverton_ns/Kconfig
@@ -33,6 +33,7 @@
select SOC_INTEL_COMMON_RESET
select PLATFORM_USES_FSP2_0
select IOAPIC
+ select HAVE_INTEL_FSP_REPO
select HAVE_SMI_HANDLER
select CACHE_MRC_SETTINGS
select PARALLEL_MP
diff --git a/src/soc/intel/icelake/Kconfig b/src/soc/intel/icelake/Kconfig
index 4077619..1dd8bf1 100644
--- a/src/soc/intel/icelake/Kconfig
+++ b/src/soc/intel/icelake/Kconfig
@@ -20,6 +20,7 @@
select FSP_M_XIP
select GENERIC_GPIO_LIB
select HAVE_FSP_GOP
+ select HAVE_INTEL_FSP_REPO
select INTEL_DESCRIPTOR_MODE_CAPABLE
select HAVE_SMI_HANDLER
select IDT_IN_EVERY_STAGE
diff --git a/src/soc/intel/skylake/Kconfig b/src/soc/intel/skylake/Kconfig
index 31f809a..cde9909 100644
--- a/src/soc/intel/skylake/Kconfig
+++ b/src/soc/intel/skylake/Kconfig
@@ -38,6 +38,7 @@
select INTEL_CAR_NEM_ENHANCED
select INTEL_GMA_ACPI
select INTEL_GMA_ADD_VBT if RUN_FSP_GOP
+ select HAVE_INTEL_FSP_REPO
select IOAPIC
select MRC_SETTINGS_PROTECT
select NO_FIXED_XIP_ROM_SIZE
--
To view, visit https://review.coreboot.org/c/coreboot/+/37582
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I68ae373ce591f06073064aa75aac32ceca8fa1cc
Gerrit-Change-Number: 37582
Gerrit-PatchSet: 1
Gerrit-Owner: Mimoja <coreboot(a)mimoja.de>
Gerrit-MessageType: newchange