Marshall Dawson (marshalldawson3rd(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18443
-gerrit
commit 5a13ffb0fa86d17fb0be4efdf5fb20391492ab58
Author: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Date: Tue Feb 14 17:18:45 2017 -0700
amd/gardenia: Add early_mainboard.c file
Add a file that can speed up the SPI interface to match the populated
SPI flash. The board uses an MX25U6435F.
Original-Signed-off-by: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Original-Reviewed-by: Marc Jones <marcj303(a)gmail.com>
(cherry picked from commit cfda0166302d2c89aa09d95df84b97eb49b1f4fd)
Change-Id: Ibbad1391fb128249a58caa9358ecb5e0ca6382aa
Signed-off-by: Marc Jones <marcj303(a)gmail.com>
---
src/mainboard/amd/gardenia/Makefile.inc | 3 +++
src/mainboard/amd/gardenia/early_mainboard.c | 28 ++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/src/mainboard/amd/gardenia/Makefile.inc b/src/mainboard/amd/gardenia/Makefile.inc
index 72cd042..43c5a04 100644
--- a/src/mainboard/amd/gardenia/Makefile.inc
+++ b/src/mainboard/amd/gardenia/Makefile.inc
@@ -19,3 +19,6 @@ romstage-y += OemCustomize.c
ramstage-y += BiosCallOuts.c
ramstage-y += OemCustomize.c
ramstage-$(CONFIG_HUDSON_IMC_FWM) += fchec.c
+
+verstage-y += early_mainboard.c
+romstage-y += early_mainboard.c
diff --git a/src/mainboard/amd/gardenia/early_mainboard.c b/src/mainboard/amd/gardenia/early_mainboard.c
new file mode 100644
index 0000000..e89484b
--- /dev/null
+++ b/src/mainboard/amd/gardenia/early_mainboard.c
@@ -0,0 +1,28 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Advanced Micro Devices, 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 <arch/io.h>
+#include <device/pci_def.h>
+#include <cpu/x86/msr.h>
+#include <cpu/amd/pi/car.h>
+#include <southbridge/amd/pi/hudson/hudson.h>
+
+void car_mainboard_pre_console_init(void)
+{
+ hudson_set_spi100(SPI_SPEED_33M,
+ SPI_SPEED_66M, SPI_SPEED_16M, SPI_SPEED_16M);
+ hudson_disable_4dw_burst();
+ hudson_read_mode(SPI_READ_MODE_QUAD114);
+}
Marshall Dawson (marshalldawson3rd(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18439
-gerrit
commit 521b309eaa0c8f335ff5f6aa2037cc2cf106de03
Author: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Date: Thu Feb 9 16:19:34 2017 -0700
amd/pi: Add verstage support
This patch takes hints from the work in commits 75c51d9 and 909c512.
Give PI-based systems the capability of running a SEPARATE_VERSTAGE.
This adds
* A verstage.c file to that initiates loading romstage (and verification)
* A new entry point in car.c that will be used when there is a separate
verstage
* Makefile flags and verstage-y additions for cpu and southbridge
* Besides AMD binary-PI changes, the x86 lapic timer is also now
included into verstage
This has been tested on Stoney (00670F000) and Gardenia. Although
additional APUs' makefiles are modified, none of those platforms are
assumed to support verstage at this time.
Original-Signed-off-by: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Original-Reviewed-by: Marc Jones <marcj303(a)gmail.com>
(cherry picked from commit 15ce30cbd9d20aa0f5a5516e5f3bee7eab069852)
Change-Id: Ie43d87908c2d83b42b95b306419156e85993f7bd
Signed-off-by: Marc Jones <marcj303(a)gmail.com>
---
src/cpu/amd/pi/00630F01/Makefile.inc | 1 +
src/cpu/amd/pi/00660F01/Makefile.inc | 1 +
src/cpu/amd/pi/00670F00/Makefile.inc | 1 +
src/cpu/amd/pi/00730F01/Makefile.inc | 1 +
src/cpu/amd/pi/Makefile.inc | 4 ++++
src/cpu/amd/pi/car.c | 6 ++++++
src/cpu/amd/pi/car.h | 3 +++
src/cpu/amd/pi/romstage_after_verstage.S | 23 +++++++++++++++++++++++
src/cpu/amd/pi/verstage.c | 23 +++++++++++++++++++++++
src/cpu/x86/lapic/Makefile.inc | 1 +
src/southbridge/amd/pi/hudson/Makefile.inc | 3 +++
src/vendorcode/amd/pi/Makefile.inc | 2 ++
12 files changed, 69 insertions(+)
diff --git a/src/cpu/amd/pi/00630F01/Makefile.inc b/src/cpu/amd/pi/00630F01/Makefile.inc
index 98a7050..9dce0a8 100644
--- a/src/cpu/amd/pi/00630F01/Makefile.inc
+++ b/src/cpu/amd/pi/00630F01/Makefile.inc
@@ -13,6 +13,7 @@
# GNU General Public License for more details.
#
+verstage-y += fixme.c
romstage-y += fixme.c
ramstage-y += fixme.c
diff --git a/src/cpu/amd/pi/00660F01/Makefile.inc b/src/cpu/amd/pi/00660F01/Makefile.inc
index 6c6a2b8..acaf1f4 100644
--- a/src/cpu/amd/pi/00660F01/Makefile.inc
+++ b/src/cpu/amd/pi/00660F01/Makefile.inc
@@ -13,6 +13,7 @@
# GNU General Public License for more details.
#
+verstage-y += fixme.c
romstage-y += fixme.c
ramstage-y += fixme.c
ramstage-y += chip_name.c
diff --git a/src/cpu/amd/pi/00670F00/Makefile.inc b/src/cpu/amd/pi/00670F00/Makefile.inc
index ae10485..601e062 100644
--- a/src/cpu/amd/pi/00670F00/Makefile.inc
+++ b/src/cpu/amd/pi/00670F00/Makefile.inc
@@ -13,6 +13,7 @@
# GNU General Public License for more details.
#
+verstage-y += fixme.c
romstage-y += fixme.c
romstage-y += romstage.c
ramstage-y += fixme.c
diff --git a/src/cpu/amd/pi/00730F01/Makefile.inc b/src/cpu/amd/pi/00730F01/Makefile.inc
index 9367b45..57cabb3 100644
--- a/src/cpu/amd/pi/00730F01/Makefile.inc
+++ b/src/cpu/amd/pi/00730F01/Makefile.inc
@@ -13,6 +13,7 @@
# GNU General Public License for more details.
#
+verstage-y += fixme.c
romstage-y += fixme.c
ramstage-y += fixme.c
diff --git a/src/cpu/amd/pi/Makefile.inc b/src/cpu/amd/pi/Makefile.inc
index ce60833..972c11d 100644
--- a/src/cpu/amd/pi/Makefile.inc
+++ b/src/cpu/amd/pi/Makefile.inc
@@ -18,7 +18,11 @@ subdirs-$(CONFIG_CPU_AMD_PI_00730F01) += 00730F01
subdirs-$(CONFIG_CPU_AMD_PI_00670F00) += 00670F00
subdirs-$(CONFIG_CPU_AMD_PI_00660F01) += 00660F01
+verstage-y += verstage.c
+verstage-y += car.c
+
romstage-y += car.c
+romstage-$(CONFIG_SEPARATE_VERSTAGE) += romstage_after_verstage.S
romstage-y += s3_resume.c
ramstage-y += s3_resume.c
diff --git a/src/cpu/amd/pi/car.c b/src/cpu/amd/pi/car.c
index 62c5338..f66f94f 100644
--- a/src/cpu/amd/pi/car.c
+++ b/src/cpu/amd/pi/car.c
@@ -66,6 +66,12 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
cache_as_ram_stage_main();
}
+void romstage_after_verstage(void)
+{
+ /* This does not return. */
+ cache_as_ram_stage_main();
+}
+
unsigned long __attribute__((weak)) car_bist_mask_bist(unsigned long bist)
{
return bist;
diff --git a/src/cpu/amd/pi/car.h b/src/cpu/amd/pi/car.h
index 98da75d..fdf1420 100644
--- a/src/cpu/amd/pi/car.h
+++ b/src/cpu/amd/pi/car.h
@@ -17,6 +17,9 @@
#ifndef PI_SPLIT_CAR_H
#define PI_SPLIT_CAR_H
+/* Entry points from the cache-as-ram assembly code */
+void romstage_after_verstage(void);
+
/* Early initialization immediately after CAR setup */
void cache_as_ram_stage_main(void);
diff --git a/src/cpu/amd/pi/romstage_after_verstage.S b/src/cpu/amd/pi/romstage_after_verstage.S
new file mode 100644
index 0000000..a89c20a
--- /dev/null
+++ b/src/cpu/amd/pi/romstage_after_verstage.S
@@ -0,0 +1,23 @@
+/*
+ * 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 "gcccar.inc"
+
+.text
+.global car_stage_entry
+car_stage_entry:
+ call romstage_after_verstage
+
+ #include "after_raminit.S"
diff --git a/src/cpu/amd/pi/verstage.c b/src/cpu/amd/pi/verstage.c
new file mode 100644
index 0000000..c8551dd
--- /dev/null
+++ b/src/cpu/amd/pi/verstage.c
@@ -0,0 +1,23 @@
+/*
+ * 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 <cpu/amd/pi/car.h>
+#include <program_loading.h>
+
+void cache_as_ram_stage_main(void)
+{
+ run_romstage();
+ /* Will not return to here. */
+}
diff --git a/src/cpu/x86/lapic/Makefile.inc b/src/cpu/x86/lapic/Makefile.inc
index 9df2c5f..58f67b2 100644
--- a/src/cpu/x86/lapic/Makefile.inc
+++ b/src/cpu/x86/lapic/Makefile.inc
@@ -1,6 +1,7 @@
ramstage-y += lapic.c
ramstage-y += lapic_cpu_init.c
ramstage-y += secondary.S
+verstage-$(CONFIG_UDELAY_LAPIC) += apic_timer.c
romstage-$(CONFIG_UDELAY_LAPIC) += apic_timer.c
ramstage-$(CONFIG_UDELAY_LAPIC) += apic_timer.c
bootblock-y += boot_cpu.c
diff --git a/src/southbridge/amd/pi/hudson/Makefile.inc b/src/southbridge/amd/pi/hudson/Makefile.inc
index 2153c62..4bd599b 100644
--- a/src/southbridge/amd/pi/hudson/Makefile.inc
+++ b/src/southbridge/amd/pi/hudson/Makefile.inc
@@ -42,8 +42,10 @@ ramstage-y += sd.c
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += fadt.c
ramstage-y += reset.c
+verstage-y += reset.c
romstage-$(CONFIG_USBDEBUG_IN_ROMSTAGE) += enable_usbdebug.c
ramstage-$(CONFIG_USBDEBUG) += enable_usbdebug.c
+verstage-y += early_setup.c
romstage-y += early_setup.c
ifeq ($(CONFIG_HUDSON_IMC_FWM), y)
romstage-y += imc.c
@@ -51,6 +53,7 @@ ramstage-y += imc.c
endif
ifeq ($(CONFIG_HUDSON_UART), y)
+verstage-y += uart.c
romstage-y += uart.c
ramstage-y += uart.c
endif
diff --git a/src/vendorcode/amd/pi/Makefile.inc b/src/vendorcode/amd/pi/Makefile.inc
index 2cd18c1..b782540 100644
--- a/src/vendorcode/amd/pi/Makefile.inc
+++ b/src/vendorcode/amd/pi/Makefile.inc
@@ -77,6 +77,7 @@ export AGESA_INC := $(AGESA_INC)
export AGESA_CFLAGS := $(AGESA_CFLAGS)
CC_bootblock := $(CC_bootblock) $(AGESA_INC) $(AGESA_CFLAGS)
+CC_verstage := $(CC_verstage) $(AGESA_INC) $(AGESA_CFLAGS)
CC_romstage := $(CC_romstage) $(AGESA_INC) $(AGESA_CFLAGS)
CC_ramstage := $(CC_ramstage) $(AGESA_INC) $(AGESA_CFLAGS)
CC_x86_32 := $(CC_x86_32) $(AGESA_INC) $(AGESA_CFLAGS)
@@ -139,6 +140,7 @@ $(obj)/agesa/libagesa.a: $(call src-to-obj,libagesa,$(agesa_src_files))
@printf " AGESA $(subst $(obj)/,,$(@))\n"
ar rcs $@ $+
+verstage-libs += $(obj)/agesa/libagesa.a
romstage-libs += $(obj)/agesa/libagesa.a
ramstage-libs += $(obj)/agesa/libagesa.a
Marshall Dawson (marshalldawson3rd(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18438
-gerrit
commit 173875b4605f339c7290c6492c69f98dd1e3f717
Author: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Date: Wed Jan 25 15:23:47 2017 -0700
cpu/amd/pi: Change wrapper to use config option
Add a check for vboot when locating the binaryPI image.
There is currently an ordering problem using cbmem to locate the
image when vboot is present. Vboot inserts its locator into the
search process so that memory can be checked before flash is queried.
For the earliest calls using the wrapper, DRAM has not been set up
and cbmem not initialized in romstage. This change prevents an
endless loop when vboot searches cbmem.
This change has another side effect. When vboot is in effect, the
change forces the RO binaryPI to be used even when on either of the
RW paths. There is currently no ability to relocate the XIP image
for use in a RW region.
Signed-off-by: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Reviewed-by: Marc Jones <marcj303(a)gmail.com>
(cherry picked from commit 6efe9217c38cf93fd9b38e52cf3ec90fee3d0474)
Change-Id: I0c14bd729f8a67bca37cbdbd3a5e266c99c86d54
Signed-off-by: Marc Jones <marcj303(a)gmail.com>
---
src/northbridge/amd/pi/agesawrapper.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/northbridge/amd/pi/agesawrapper.c b/src/northbridge/amd/pi/agesawrapper.c
index 0fe8eab..543aa80 100644
--- a/src/northbridge/amd/pi/agesawrapper.c
+++ b/src/northbridge/amd/pi/agesawrapper.c
@@ -603,8 +603,14 @@ const void *agesawrapper_locate_module (const CHAR8 name[8])
const AMD_MODULE_HEADER* module;
size_t file_size;
+#if IS_ENABLED(CONFIG_VBOOT)
+ /* Use phys. location in flash and prevent vboot from searching cbmem */
+ agesa = (void *)CONFIG_AGESA_BINARY_PI_LOCATION;
+ file_size = 0x100000;
+#else
agesa = cbfs_boot_map_with_leak((const char *)CONFIG_CBFS_AGESA_NAME,
CBFS_TYPE_RAW, &file_size);
+#endif
if (!agesa)
return NULL;
image = LibAmdLocateImage(agesa, agesa + file_size - 1, 4096, name);
Marshall Dawson (marshalldawson3rd(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18437
-gerrit
commit f49aae095d70e8e6141d9d863ba181a1af423d57
Author: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Date: Tue Jan 17 11:57:31 2017 -0500
cpu/amd/pi: Split CAR setup for use in multiple stages
This patch uses hints from commit e6af4be to make CAR setup more
standalone. These changes will facilitate establishing CAR outside
of romstage in an upcoming separate verstage patch.
Move CAR teardown to its own file that will always be in romstage, but
isn't required in an earlier stage.
Signed-off-by: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Reviewed-by: Marc Jones <marcj303(a)gmail.com>
(cherry picked from commit c648d2a0f88ac1161f5d2002f7b947cb8e56b03f)
Change-Id: I9fe53ca1fd6b1edd4d5e072849f3962c8bc95df0
Signed-off-by: Marc Jones <marcj303(a)gmail.com>
---
src/cpu/amd/pi/after_raminit.S | 49 +++++++++++++++++++++++++++++++++++++++++
src/cpu/amd/pi/cache_as_ram.inc | 33 +++++----------------------
2 files changed, 54 insertions(+), 28 deletions(-)
diff --git a/src/cpu/amd/pi/after_raminit.S b/src/cpu/amd/pi/after_raminit.S
new file mode 100644
index 0000000..79cf59b
--- /dev/null
+++ b/src/cpu/amd/pi/after_raminit.S
@@ -0,0 +1,49 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Advanced Micro Devices, 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 <cpu/x86/cache.h>
+
+/*
+ * This is the common entry point after DRAM has been initialized.
+ */
+.global disable_cache_as_ram
+disable_cache_as_ram:
+ /* Save return stack */
+ movd 0(%esp), %xmm1
+ movd %esp, %xmm0
+
+ /* Disable cache */
+ movl %cr0, %eax
+ orl $CR0_CacheDisable, %eax
+ movl %eax, %cr0
+
+ AMD_DISABLE_STACK
+
+ /* enable cache */
+ movl %cr0, %eax
+ andl $0x9fffffff, %eax
+ movl %eax, %cr0
+ xorl %eax, %eax
+
+ /* Restore the return stack */
+ wbinvd
+ movd %xmm0, %esp
+ movd %xmm1, (%esp)
+ ret
+
+cache_as_ram_setup_out:
+#ifdef __x86_64__
+.code64
+#endif
diff --git a/src/cpu/amd/pi/cache_as_ram.inc b/src/cpu/amd/pi/cache_as_ram.inc
index 24db600..0915c23 100644
--- a/src/cpu/amd/pi/cache_as_ram.inc
+++ b/src/cpu/amd/pi/cache_as_ram.inc
@@ -33,7 +33,7 @@
*/
.code32
-.globl cache_as_ram_setup, disable_cache_as_ram, cache_as_ram_setup_out
+.globl cache_as_ram_setup
cache_as_ram_setup:
@@ -136,31 +136,8 @@ cache_as_ram_setup:
stop:
jmp stop
-disable_cache_as_ram:
- /* Save return stack */
- movd 0(%esp), %xmm1
- movd %esp, %xmm0
-
- /* Disable cache */
- movl %cr0, %eax
- orl $CR0_CacheDisable, %eax
- movl %eax, %cr0
-
- AMD_DISABLE_STACK
-
- /* enable cache */
- movl %cr0, %eax
- andl $0x9fffffff, %eax
- movl %eax, %cr0
- xorl %eax, %eax
-
- /* Restore the return stack */
- wbinvd
- movd %xmm0, %esp
- movd %xmm1, (%esp)
- ret
-
-cache_as_ram_setup_out:
-#ifdef __x86_64__
-.code64
+/* One will never return from cache_as_ram_main() in verstage so there's
+ * no such thing as after RAM init. */
+#if !ENV_VERSTAGE
+#include "after_raminit.S"
#endif