Werner Zeh (werner.zeh(a)siemens.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15495
-gerrit
commit 5c55ff11f7a742b4ed6ec8dc6b876a5ee38a3e71
Author: Werner Zeh <werner.zeh(a)siemens.com>
Date: Wed Jun 29 07:17:21 2016 +0200
fsp_broadwell_de: Enable Super I/O address range decode
If there is an external 16550 like UART, one needs to enable
the appropriate address ranges before console_init() is called
so that the init sequence can reach the external UART. Otherwise
the UART will only start working in ramstage and will produce
unreadable characters in romstage due to the lack of initialization.
Tested-on: Siemens MC_BDX1
Change-Id: Iafc5b5b6df14916c5ed778928521d4a8f539cf46
Signed-off-by: Werner Zeh <werner.zeh(a)siemens.com>
---
src/soc/intel/fsp_broadwell_de/include/soc/lpc.h | 4 +++-
src/soc/intel/fsp_broadwell_de/romstage/romstage.c | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/soc/intel/fsp_broadwell_de/include/soc/lpc.h b/src/soc/intel/fsp_broadwell_de/include/soc/lpc.h
index 2c02ebd..0408f7f 100644
--- a/src/soc/intel/fsp_broadwell_de/include/soc/lpc.h
+++ b/src/soc/intel/fsp_broadwell_de/include/soc/lpc.h
@@ -21,6 +21,8 @@
#define REVID 0x08
#define PIRQ_RCR1 0x60
#define PIRQ_RCR2 0x68
+#define LPC_IO_DEC 0x80
+#define LPC_EN 0x82
#define GEN_PMCON_1 0xA0
#define GEN_PMCON_2 0xA2
#define GEN_PMCON_3 0xA4
@@ -83,4 +85,4 @@
#define TCO_TMR_HALT (1 << 11)
#define TCO_TMR 0x70
-#endif /* _SOC_LPC_H_ */
\ No newline at end of file
+#endif /* _SOC_LPC_H_ */
diff --git a/src/soc/intel/fsp_broadwell_de/romstage/romstage.c b/src/soc/intel/fsp_broadwell_de/romstage/romstage.c
index dc883a4..bdfcbc8 100644
--- a/src/soc/intel/fsp_broadwell_de/romstage/romstage.c
+++ b/src/soc/intel/fsp_broadwell_de/romstage/romstage.c
@@ -48,6 +48,9 @@ static void init_rtc(void)
void *asmlinkage main(FSP_INFO_HEADER *fsp_info_header)
{
post_code(0x40);
+ /* Enable decoding of I/O locations for Super I/O devices */
+ pci_write_config16(PCI_DEV(0x0, LPC_DEV, LPC_FUNC), LPC_IO_DEC, 0x0010);
+ pci_write_config16(PCI_DEV(0x0, LPC_DEV, LPC_FUNC), LPC_EN, 0x340f);
console_init();
init_rtc();
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15344
-gerrit
commit 1174caaf4c739ab6593794b80730aa3d00da12b0
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Fri Jun 24 16:37:05 2016 +0300
AGESA boards: Fix split to romstage and ramstage
Boards broken with commit:
062ef1c AGESA boards: Split dispatcher to romstage and ramstage
Boot failure with asus/f2a85-m witnessed around MemMS3Save() call,
message "Save memory S3 data in heap" in verbose agesa logs was
replaced by a system reset.
Default stubs for MemS3ResumeConstructNBBlock() returned TRUE
without initializing the block contents. This would not work for case
with multiple NB support built into same firmware.
MemMCreateS3NbBlock() then returned with S3NBPtr!=NULL with uninitialized
data and MemMContextSave() referenced those as invalid pointers.
There is no reason to prevent booting in the case S3 resume data is not
passed to ramstage, so remove the ASSERT(). It only affects builds with
IDSOPT_IDS_ENABLED=TRUE anyways.
Change-Id: I8fd1e308ceab2b6f4b4c90f0f712934c2918d92d
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/vendorcode/amd/agesa/f15tn/Include/OptionMemoryInstall.h | 2 +-
src/vendorcode/amd/agesa/f15tn/Proc/Mem/Main/mmMemRestore.c | 1 -
src/vendorcode/amd/agesa/f16kb/Include/OptionMemoryInstall.h | 2 +-
src/vendorcode/amd/agesa/f16kb/Proc/Mem/Main/mmMemRestore.c | 1 -
4 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/vendorcode/amd/agesa/f15tn/Include/OptionMemoryInstall.h b/src/vendorcode/amd/agesa/f15tn/Include/OptionMemoryInstall.h
index e1c47ee..0cb25b8 100644
--- a/src/vendorcode/amd/agesa/f15tn/Include/OptionMemoryInstall.h
+++ b/src/vendorcode/amd/agesa/f15tn/Include/OptionMemoryInstall.h
@@ -124,7 +124,7 @@ BOOLEAN MemFS3DefConstructorRet (
IN UINT8 NodeID
)
{
- return TRUE;
+ return FALSE;
}
#if (OPTION_MEMCTLR_DR == TRUE)
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/Mem/Main/mmMemRestore.c b/src/vendorcode/amd/agesa/f15tn/Proc/Mem/Main/mmMemRestore.c
index 244420d..ab1ce1a 100644
--- a/src/vendorcode/amd/agesa/f15tn/Proc/Mem/Main/mmMemRestore.c
+++ b/src/vendorcode/amd/agesa/f15tn/Proc/Mem/Main/mmMemRestore.c
@@ -319,7 +319,6 @@ MemMS3Save (
if (RefPtr->MemContext.NvStorage == NULL) {
// Memory context cannot be saved succesfully
- ASSERT (FALSE);
return FALSE;
}
}
diff --git a/src/vendorcode/amd/agesa/f16kb/Include/OptionMemoryInstall.h b/src/vendorcode/amd/agesa/f16kb/Include/OptionMemoryInstall.h
index 647c370..8269742 100644
--- a/src/vendorcode/amd/agesa/f16kb/Include/OptionMemoryInstall.h
+++ b/src/vendorcode/amd/agesa/f16kb/Include/OptionMemoryInstall.h
@@ -124,7 +124,7 @@ BOOLEAN MemFS3DefConstructorRet (
IN UINT8 NodeID
)
{
- return TRUE;
+ return FALSE;
}
#if (OPTION_MEMCTLR_TN == TRUE)
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/Mem/Main/mmMemRestore.c b/src/vendorcode/amd/agesa/f16kb/Proc/Mem/Main/mmMemRestore.c
index 3d80baf..248e98c 100644
--- a/src/vendorcode/amd/agesa/f16kb/Proc/Mem/Main/mmMemRestore.c
+++ b/src/vendorcode/amd/agesa/f16kb/Proc/Mem/Main/mmMemRestore.c
@@ -576,7 +576,6 @@ MemMS3Save (
if (RefPtr->MemContext.NvStorage == NULL) {
// Memory context cannot be saved succesfully
- ASSERT (FALSE);
return FALSE;
}
}
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15463
-gerrit
commit ac8d988354b51b00737a7b3913471b89b74ebc50
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Mon Jun 27 14:50:27 2016 +0300
intel post-car: Consolidate choose_top_of_stack()
Change-Id: I2c49d68ea9a8f52737b6064bc4fa703bdb1af1df
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/cpu/intel/haswell/romstage.c | 16 +---------
src/drivers/intel/fsp1_1/Kconfig | 4 ---
src/drivers/intel/fsp1_1/stack.c | 23 ++------------
src/include/program_loading.h | 6 ++++
src/lib/Makefile.inc | 1 +
src/lib/romstage_stack.c | 48 ++++++++++++++++++++++++++++++
src/soc/intel/baytrail/romstage/romstage.c | 16 +---------
src/soc/intel/broadwell/romstage/stack.c | 17 ++---------
8 files changed, 62 insertions(+), 69 deletions(-)
diff --git a/src/cpu/intel/haswell/romstage.c b/src/cpu/intel/haswell/romstage.c
index cde9441..9154316 100644
--- a/src/cpu/intel/haswell/romstage.c
+++ b/src/cpu/intel/haswell/romstage.c
@@ -65,20 +65,6 @@ static inline u32 *stack_push(u32 *stack, u32 value)
return stack;
}
-/* Romstage needs quite a bit of stack for decompressing images since the lzma
- * lib keeps its state on the stack during romstage. */
-#define ROMSTAGE_RAM_STACK_SIZE 0x5000
-static unsigned long choose_top_of_stack(void)
-{
- unsigned long stack_top;
-
- /* cbmem_add() does a find() before add(). */
- stack_top = (unsigned long)cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK,
- ROMSTAGE_RAM_STACK_SIZE);
- stack_top += ROMSTAGE_RAM_STACK_SIZE;
- return stack_top;
-}
-
/* setup_romstage_stack_after_car() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use. */
static void *setup_romstage_stack_after_car(void)
@@ -90,7 +76,7 @@ static void *setup_romstage_stack_after_car(void)
u32 top_of_ram;
/* Top of stack needs to be aligned to a 4-byte boundary. */
- top_of_stack = choose_top_of_stack() & ~3;
+ top_of_stack = romstage_ram_stack_top() & ~3;
slot = (void *)top_of_stack;
num_mtrrs = 0;
diff --git a/src/drivers/intel/fsp1_1/Kconfig b/src/drivers/intel/fsp1_1/Kconfig
index 86f6c7b..59b4797 100644
--- a/src/drivers/intel/fsp1_1/Kconfig
+++ b/src/drivers/intel/fsp1_1/Kconfig
@@ -99,10 +99,6 @@ config GOP_SUPPORT
bool "Enable GOP support"
default n
-config ROMSTAGE_RAM_STACK_SIZE
- hex "Size of the romstage RAM stack in bytes"
- default 0x5000
-
config USE_GENERIC_FSP_CAR_INC
bool
default n
diff --git a/src/drivers/intel/fsp1_1/stack.c b/src/drivers/intel/fsp1_1/stack.c
index 65ba235..8d0759a 100644
--- a/src/drivers/intel/fsp1_1/stack.c
+++ b/src/drivers/intel/fsp1_1/stack.c
@@ -21,23 +21,7 @@
#include <fsp/romstage.h>
#include <fsp/stack.h>
#include <stdlib.h>
-
-const unsigned long romstage_ram_stack_size = CONFIG_ROMSTAGE_RAM_STACK_SIZE;
-
-/*
- * Romstage needs quite a bit of stack for decompressing images since the lzma
- * lib keeps its state on the stack during romstage.
- */
-static unsigned long choose_top_of_stack(void)
-{
- unsigned long stack_top;
-
- /* cbmem_add() does a find() before add(). */
- stack_top = (unsigned long)cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK,
- romstage_ram_stack_size);
- stack_top += romstage_ram_stack_size;
- return stack_top;
-}
+#include <program_loading.h>
/*
* setup_stack_and_mtrrs() determines the stack to use after
@@ -57,7 +41,7 @@ void *setup_stack_and_mtrrs(void)
soc_display_mtrrs();
/* Top of stack needs to be aligned to a 8-byte boundary. */
- top_of_stack = choose_top_of_stack();
+ top_of_stack = romstage_ram_stack_top();
slot = (void *)top_of_stack;
num_mtrrs = 0;
max_mtrrs = soc_get_variable_mtrr_count(NULL);
@@ -68,8 +52,7 @@ void *setup_stack_and_mtrrs(void)
*/
mtrr_mask_upper = (1 << ((cpuid_eax(0x80000008) & 0xff) - 32)) - 1;
alignment = mmap_region_granularity();
- aligned_ram = ALIGN_DOWN(top_of_stack - romstage_ram_stack_size,
- alignment);
+ aligned_ram = ALIGN_DOWN(romstage_ram_stack_bottom(), alignment);
/*
* The order for each MTRR is value then base with upper 32-bits of
diff --git a/src/include/program_loading.h b/src/include/program_loading.h
index 42addb8..4cadab6 100644
--- a/src/include/program_loading.h
+++ b/src/include/program_loading.h
@@ -170,6 +170,12 @@ void run_ramstage(void);
/* Called when the stage cache couldn't load ramstage on resume. */
void ramstage_cache_invalid(void);
+/* Determine where stack for ramstage loader is located. */
+enum { ROMSTAGE_STACK_CBMEM, ROMSTAGE_STACK_LOW_MEM };
+uintptr_t romstage_ram_stack_source(size_t size, int src);
+uintptr_t romstage_ram_stack_top(void);
+uintptr_t romstage_ram_stack_bottom(void);
+
/***********************
* PAYLOAD LOADING *
***********************/
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 1028917..0c34b75 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -78,6 +78,7 @@ romstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
ramstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
romstage-$(CONFIG_CACHE_AS_RAM) += ramtest.c
romstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
+romstage-y += romstage_stack.c
romstage-y += stack.c
ramstage-y += rtc.c
diff --git a/src/lib/romstage_stack.c b/src/lib/romstage_stack.c
new file mode 100644
index 0000000..97313f5
--- /dev/null
+++ b/src/lib/romstage_stack.c
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Google Inc.
+ * Copyright (C) 2015-2016 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; 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 <program_loading.h>
+#include <cbmem.h>
+
+/*
+ * Romstage needs quite a bit of stack for decompressing images since the lzma
+ * lib keeps its state on the stack during romstage.
+ */
+#define ROMSTAGE_RAM_STACK_SIZE 0x5000
+
+uintptr_t romstage_ram_stack_source(size_t size, int src)
+{
+ /* cbmem_add() does a find() before add(). */
+ if (src == ROMSTAGE_STACK_CBMEM)
+ return (uintptr_t)cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK, size);
+ if (src == ROMSTAGE_STACK_LOW_MEM)
+ return CONFIG_RAMTOP - size;
+ return 0;
+}
+
+uintptr_t romstage_ram_stack_bottom(void)
+{
+ return romstage_ram_stack_source(ROMSTAGE_RAM_STACK_SIZE,
+ ROMSTAGE_STACK_CBMEM);
+}
+
+uintptr_t romstage_ram_stack_top(void)
+{
+ uintptr_t stack_top = romstage_ram_stack_source(ROMSTAGE_RAM_STACK_SIZE,
+ ROMSTAGE_STACK_CBMEM);
+ stack_top += ROMSTAGE_RAM_STACK_SIZE;
+ return stack_top;
+}
diff --git a/src/soc/intel/baytrail/romstage/romstage.c b/src/soc/intel/baytrail/romstage/romstage.c
index a167c90..d7e8b17 100644
--- a/src/soc/intel/baytrail/romstage/romstage.c
+++ b/src/soc/intel/baytrail/romstage/romstage.c
@@ -258,20 +258,6 @@ static inline uint32_t *stack_push(u32 *stack, u32 value)
return stack;
}
-/* Romstage needs quite a bit of stack for decompressing images since the lzma
- * lib keeps its state on the stack during romstage. */
-static unsigned long choose_top_of_stack(void)
-{
- unsigned long stack_top;
- const unsigned long romstage_ram_stack_size = 0x5000;
-
- /* cbmem_add() does a find() before add(). */
- stack_top = (unsigned long)cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK,
- romstage_ram_stack_size);
- stack_top += romstage_ram_stack_size;
- return stack_top;
-}
-
/* setup_stack_and_mttrs() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use. */
static void *setup_stack_and_mttrs(void)
@@ -283,7 +269,7 @@ static void *setup_stack_and_mttrs(void)
uint32_t top_of_ram;
/* Top of stack needs to be aligned to a 4-byte boundary. */
- top_of_stack = choose_top_of_stack() & ~3;
+ top_of_stack = romstage_ram_stack_top() & ~3;
slot = (void *)top_of_stack;
num_mtrrs = 0;
diff --git a/src/soc/intel/broadwell/romstage/stack.c b/src/soc/intel/broadwell/romstage/stack.c
index 6c602a8..76307cf 100644
--- a/src/soc/intel/broadwell/romstage/stack.c
+++ b/src/soc/intel/broadwell/romstage/stack.c
@@ -21,6 +21,7 @@
#include <cbmem.h>
#include <cpu/x86/mtrr.h>
#include <soc/romstage.h>
+#include <program_loading.h>
static inline uint32_t *stack_push(u32 *stack, u32 value)
{
@@ -29,20 +30,6 @@ static inline uint32_t *stack_push(u32 *stack, u32 value)
return stack;
}
-/* Romstage needs quite a bit of stack for decompressing images since the lzma
- * lib keeps its state on the stack during romstage. */
-static unsigned long choose_top_of_stack(void)
-{
- unsigned long stack_top;
- const unsigned long romstage_ram_stack_size = 0x5000;
-
- /* cbmem_add() does a find() before add(). */
- stack_top = (unsigned long)cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK,
- romstage_ram_stack_size);
- stack_top += romstage_ram_stack_size;
- return stack_top;
-}
-
/* setup_stack_and_mttrs() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use. */
void *setup_stack_and_mttrs(void)
@@ -54,7 +41,7 @@ void *setup_stack_and_mttrs(void)
uint32_t top_of_ram;
/* Top of stack needs to be aligned to a 4-byte boundary. */
- top_of_stack = choose_top_of_stack() & ~3;
+ top_of_stack = romstage_ram_stack_top() & ~3;
slot = (void *)top_of_stack;
num_mtrrs = 0;
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15468
-gerrit
commit 304e1d02411e9617b31b34ca92c8b0c9118e5952
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Mon Jun 27 13:24:11 2016 +0300
intel post-car: Separate romstage ramstack (WIP)
TODO: Need to fix MTRRs before placing stack high.
TODO: Check stack top reference in FSP1_0
TODO: Case LATE_CBMEM_INIT
Change-Id: I221e207bcd0031048876f29100a1770a444d435b
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/cpu/intel/car/romstage.c | 20 +++++++++++++++++++-
src/drivers/intel/fsp1_0/fsp_util.c | 3 ++-
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/cpu/intel/car/romstage.c b/src/cpu/intel/car/romstage.c
index c6df446..215a6a2 100644
--- a/src/cpu/intel/car/romstage.c
+++ b/src/cpu/intel/car/romstage.c
@@ -1,7 +1,25 @@
+/*
+ * 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/intel/romstage.h>
+#include <program_loading.h>
void * asmlinkage romstage_main(unsigned long bist)
{
mainboard_romstage_entry(bist);
- return (void*)CONFIG_RAMTOP;
+
+ if (IS_ENABLED(CONFIG_LATE_CBMEM_INIT))
+ return (void*)CONFIG_RAMTOP;
+
+ return (void*)romstage_ram_stack_top();
}
diff --git a/src/drivers/intel/fsp1_0/fsp_util.c b/src/drivers/intel/fsp1_0/fsp_util.c
index a3fef2d..1f12053 100644
--- a/src/drivers/intel/fsp1_0/fsp_util.c
+++ b/src/drivers/intel/fsp1_0/fsp_util.c
@@ -22,6 +22,7 @@
#include <lib.h> // hexdump
#include <ip_checksum.h>
#include <timestamp.h>
+#include <program_loading.h>
#ifndef __PRE_RAM__
/* Globals pointers for FSP structures */
@@ -76,7 +77,7 @@ void __attribute__ ((noreturn)) fsp_early_init (FSP_INFO_HEADER *fsp_ptr)
#endif
memset((void*)&FspRtBuffer, 0, sizeof(FSP_INIT_RT_BUFFER));
- FspRtBuffer.Common.StackTop = (u32 *)CONFIG_RAMTOP;
+ FspRtBuffer.Common.StackTop = (u32 *)romstage_ram_stack_top();
FspInitParams.NvsBufferPtr = NULL;
#if IS_ENABLED(CONFIG_FSP_USES_UPD)