the following patch was just integrated into master:
commit e1fb052ed70b0471ece637f37db01bde6d4b9076
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Tue May 26 00:30:10 2015 +0300
CBMEM: Fix S3 resume path without EARLY_CBMEM_INIT
Implementation for cbmem_find() did not work for boards without
EARLY_CBMEM_INIT in romstage.
This is required for S3 resume to work on AGESA plaforms.
First broken with commit 0dff57d
cbmem: switch over to imd-based cbmem
Change-Id: I9c1a4f6839f5d90f825787baad2a3824a04b5bdc
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Reviewed-on: http://review.coreboot.org/10299
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
Tested-by: build bot (Jenkins)
See http://review.coreboot.org/10299 for details.
-gerrit
the following patch was just integrated into master:
commit 28d5ec9a7d8fe11175c8907cc6fa0305c469b194
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Tue May 26 11:15:45 2015 -0500
x86: provide consistent cbmem_top() for CONFIG_LATE_CBMEM_INIT
For x86 systems employing CONFIG_LATE_CBMEM_INIT, set_top_of_ram() is
called in ramstage to note the upper address of the 32-bit address
space. This in turn is consumed by cbmem. However, in this scenario
cbmem_top() cannot always be relied upon because get_top_of_ram()
doesn't return the same value provided to set_top_of_ram().
To fix the inconsistency in ramstage save the value passed in
to set_top_of_ram() and defer to it as the return value for
cbmem_top().
Change-Id: Ida796fb836c59b9776019e7f8b3f2cd71156f0e5
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-on: http://review.coreboot.org/10313
Reviewed-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Tested-by: build bot (Jenkins)
See http://review.coreboot.org/10313 for details.
-gerrit
the following patch was just integrated into master:
commit aadf2b8b59adec05a84e4884ba76bc2ebc4d9b00
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu May 21 14:54:18 2015 -0500
consoles: remove unused infrastructure
The __console attribute as well as linker binding
was dropped at some point. Kill of the dead code and
infrastructure.
Change-Id: I15e1fb4468fffe2e148ec9ac8539dfd958551807
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-on: http://review.coreboot.org/10279
Tested-by: build bot (Jenkins)
Reviewed-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
See http://review.coreboot.org/10279 for details.
-gerrit
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10313
-gerrit
commit 07c8e0c1b6016fedf295c2ec031cc1348548b115
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Tue May 26 11:15:45 2015 -0500
x86: provide consistent cbmem_top() for CONFIG_LATE_CBMEM_INIT
For x86 systems employing CONFIG_LATE_CBMEM_INIT, set_top_of_ram() is
called in ramstage to note the upper address of the 32-bit address
space. This in turn is consumed by cbmem. However, in this scenario
cbmem_top() cannot always be relied upon because get_top_of_ram()
doesn't return the same value provided to set_top_of_ram().
To fix the inconsistency in ramstage save the value passed in
to set_top_of_ram() and defer to it as the return value for
cbmem_top().
Change-Id: Ida796fb836c59b9776019e7f8b3f2cd71156f0e5
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/arch/x86/boot/cbmem.c | 20 +++++++++++++++++++-
src/include/cbmem.h | 3 +++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/arch/x86/boot/cbmem.c b/src/arch/x86/boot/cbmem.c
index 9ee5db4..f48e46a 100644
--- a/src/arch/x86/boot/cbmem.c
+++ b/src/arch/x86/boot/cbmem.c
@@ -34,10 +34,23 @@ void __attribute__((weak)) backup_top_of_ram(uint64_t ramtop)
/* Do nothing. Chipset may have implementation to save ramtop in NVRAM. */
}
+static void *ramtop_pointer;
+
void set_top_of_ram(uint64_t ramtop)
{
backup_top_of_ram(ramtop);
- cbmem_set_top((void*)(uintptr_t)ramtop);
+ ramtop_pointer = (void *)(uintptr_t)ramtop;
+ cbmem_set_top(ramtop_pointer);
+}
+
+static inline void *saved_ramtop(void)
+{
+ return ramtop_pointer;
+}
+#else
+static inline void *saved_ramtop(void)
+{
+ return NULL;
}
#endif /* !__PRE_RAM__ */
@@ -50,6 +63,11 @@ unsigned long __attribute__((weak)) get_top_of_ram(void)
void *cbmem_top(void)
{
/* Top of cbmem is at lowest usable DRAM address below 4GiB. */
+ void *ptr = saved_ramtop();
+
+ if (ptr != NULL)
+ return ptr;
+
return (void *)get_top_of_ram();
}
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index 20cc174..0a7ca89 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -221,6 +221,9 @@ void cbmem_list(void);
* early features like COLLECT_TIMESTAMPS and CBMEM_CONSOLE.
*/
#if IS_ENABLED(CONFIG_ARCH_X86) && IS_ENABLED(CONFIG_LATE_CBMEM_INIT)
+/* Note that many of the current providers of get_top_of_ram() conditionally
+ * return 0 when the sleep type is non S3. i.e. cold and warm boots would
+ * return 0 from get_top_of_ram(). */
unsigned long get_top_of_ram(void);
void set_top_of_ram(uint64_t ramtop);
void backup_top_of_ram(uint64_t ramtop);
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10300
-gerrit
commit 46ee14121fcc6a6e4e3e78c93c309d25a3bd0e31
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Tue May 26 06:23:02 2015 +0300
timestamp: Fix collection without EARLY_CBMEM_INIT
With LATE_CBMEM_INIT, do not search for the initial collection from
CBMEM in ramstage. On S3 resume this would find the non-empty
collection from previous run of ramstage. Start with an empty table
instead.
Remove a spurious error message as the stamps get stashed and
will be copied to CBMEM later.
Change-Id: Ib94049531c0ac23af25407bd2ca7644ee0163d69
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/lib/timestamp.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index 98ab243..8c82649 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -42,10 +42,8 @@ static void timestamp_real_init(uint64_t base)
sizeof(struct timestamp_table) +
MAX_TIMESTAMPS * sizeof(struct timestamp_entry));
- if (!tst) {
- printk(BIOS_ERR, "ERROR: failed to allocate timestamp table\n");
+ if (!tst)
return;
- }
tst->base_time = base;
tst->max_entries = MAX_TIMESTAMPS;
@@ -142,10 +140,12 @@ void timestamp_init(uint64_t base)
/* Copy of basetime, it is too early for CBMEM. */
car_set_var(ts_basetime, base);
#else
- struct timestamp_table* tst;
+ struct timestamp_table *tst = NULL;
/* Locate and use an already existing table. */
- tst = cbmem_find(CBMEM_ID_TIMESTAMP);
+ if (!IS_ENABLED(CONFIG_LATE_CBMEM_INIT))
+ tst = cbmem_find(CBMEM_ID_TIMESTAMP);
+
if (tst) {
car_set_var(ts_table_p, tst);
return;
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10301
-gerrit
commit de74212e5d1d6f61740ce90387da2b6bfb764473
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Tue May 26 06:46:41 2015 +0300
CBMEM console: Fix buffer without EARLY_CBMEM_INIT
On S3 resume, CBMEM_ID_CONSOLE from previous boot is found in ramstage,
even when romstage did not create it. So buffer did not get cleared
on S3 resume path.
Also do not allocate for preram_cbmem_console in CAR when there
are no means to back it up to ram.
Change-Id: I175cebbb938adf2a7414703fefffb8da796e9fa9
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/arch/x86/init/romstage.ld | 2 +-
src/lib/cbmem_console.c | 7 ++-----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/arch/x86/init/romstage.ld b/src/arch/x86/init/romstage.ld
index 27e8de1..ae7049b 100644
--- a/src/arch/x86/init/romstage.ld
+++ b/src/arch/x86/init/romstage.ld
@@ -65,7 +65,7 @@ SECTIONS
* statically checked because the cache-as-ram region usage is
* cpu/chipset dependent. */
_preram_cbmem_console = .;
- _epreram_cbmem_console = . + 0xc00;
+ _epreram_cbmem_console = . + (CONFIG_LATE_CBMEM_INIT ? 0 : 0xc00);
}
/* Global variables are not allowed in romstage
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c
index 30bf439..e9607f3 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -225,11 +225,8 @@ void cbmemc_reinit(void)
/* Need to reset the newly added cbmem console in ramstage
* when there was no console in preram environment. */
- if (ENV_RAMSTAGE) {
- cbm_cons_p = cbmem_find(CBMEM_ID_CONSOLE);
- if (cbm_cons_p == NULL)
- flags |= CBMEMC_RESET;
- }
+ if (ENV_RAMSTAGE && IS_ENABLED(CONFIG_LATE_CBMEM_INIT))
+ flags |= CBMEMC_RESET;
/* If CBMEM entry already existed, old contents is not altered. */
cbm_cons_p = cbmem_add(CBMEM_ID_CONSOLE, size);
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10314
-gerrit
commit 1ff4c2fa2e61011321489d178ffa6400eaa7c1f6
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Tue May 26 11:26:34 2015 -0500
cbmem: remove cbmem_set_top()
Now that the users of cbmem_set_top() always provide a consistent
cbmem_top() value there's no need to have cbmem_set_top() around.
Therefore, delete it.
Change-Id: I0c96e2b8b829eddbeb1fdf755ed59c51ea689d1b
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/arch/x86/boot/cbmem.c | 1 -
src/include/cbmem.h | 3 ---
src/lib/imd_cbmem.c | 14 --------------
3 files changed, 18 deletions(-)
diff --git a/src/arch/x86/boot/cbmem.c b/src/arch/x86/boot/cbmem.c
index ad8aacb..a9127d7 100644
--- a/src/arch/x86/boot/cbmem.c
+++ b/src/arch/x86/boot/cbmem.c
@@ -40,7 +40,6 @@ void set_top_of_ram(uint64_t ramtop)
{
backup_top_of_ram(ramtop);
ramtop_pointer = (void *)(uintptr_t)ramtop;
- cbmem_set_top(ramtop_pointer);
}
static inline void *saved_ramtop(void)
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index 0a7ca89..a8ab3cd 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -176,9 +176,6 @@ void cbmem_initialize_empty_id_size(u32 id, u64 size);
* below 4GiB. */
void *cbmem_top(void);
-/* Set the top address for dynamic cbmem. Not for new designs. */
-void cbmem_set_top(void *ramtop);
-
/* Add a cbmem entry of a given size and id. These return NULL on failure. The
* add function performs a find first and do not check against the original
* size. */
diff --git a/src/lib/imd_cbmem.c b/src/lib/imd_cbmem.c
index 6255b18..d1ff57d 100644
--- a/src/lib/imd_cbmem.c
+++ b/src/lib/imd_cbmem.c
@@ -40,20 +40,6 @@ static inline struct imd *cbmem_get_imd(void)
return NULL;
}
-/*
- * x86 !CONFIG_EARLY_CBMEM_INIT platforms need to do the following in ramstage:
- * 1. Call set_top_of_ram() which in turn calls cbmem_set_top().
- * 2. Provide a get_top_of_ram() implementation.
- *
- * CONFIG_EARLY_CBMEM_INIT platforms just need to provide cbmem_top().
- */
-void cbmem_set_top(void *ramtop)
-{
- struct imd *imd = cbmem_get_imd();
-
- imd_handle_init(imd, ramtop);
-}
-
static inline const struct cbmem_entry *imd_to_cbmem(const struct imd_entry *e)
{
return (const struct cbmem_entry *)e;
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10299
-gerrit
commit e6f25cf80d4406edd9a44a5cc3ee27b5960f9a18
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Tue May 26 00:30:10 2015 +0300
CBMEM: Fix S3 resume path without EARLY_CBMEM_INIT
Implementation for cbmem_find() did not work for boards without
EARLY_CBMEM_INIT in romstage.
This is required for S3 resume to work on AGESA plaforms.
First broken with commit 0dff57d
cbmem: switch over to imd-based cbmem
Change-Id: I9c1a4f6839f5d90f825787baad2a3824a04b5bdc
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/arch/x86/boot/cbmem.c | 1 -
src/lib/imd_cbmem.c | 15 ++++-----------
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/src/arch/x86/boot/cbmem.c b/src/arch/x86/boot/cbmem.c
index f48e46a..ad8aacb 100644
--- a/src/arch/x86/boot/cbmem.c
+++ b/src/arch/x86/boot/cbmem.c
@@ -56,7 +56,6 @@ static inline void *saved_ramtop(void)
unsigned long __attribute__((weak)) get_top_of_ram(void)
{
- printk(BIOS_WARNING, "WARNING: you need to define get_top_of_ram() for your chipset\n");
return 0;
}
diff --git a/src/lib/imd_cbmem.c b/src/lib/imd_cbmem.c
index fc12c25..6255b18 100644
--- a/src/lib/imd_cbmem.c
+++ b/src/lib/imd_cbmem.c
@@ -96,9 +96,8 @@ static struct imd *imd_init_backing_with_recover(struct imd *backing)
imd = imd_init_backing(backing);
if (!ENV_RAMSTAGE) {
- /* Early cbmem init platforms need to always use cbmem_top(). */
- if (IS_ENABLED(CONFIG_EARLY_CBMEM_INIT))
- imd_handle_init(imd, cbmem_top());
+ imd_handle_init(imd, cbmem_top());
+
/* Need to partially recover all the time outside of ramstage
* because there's object storage outside of the stack. */
imd_handle_init_partial_recovery(imd);
@@ -118,10 +117,7 @@ void cbmem_initialize_empty_id_size(u32 id, u64 size)
struct imd imd_backing;
imd = imd_init_backing(&imd_backing);
-
- /* Early cbmem init platforms need to always use cbmem_top(). */
- if (IS_ENABLED(CONFIG_EARLY_CBMEM_INIT))
- imd_handle_init(imd, cbmem_top());
+ imd_handle_init(imd, cbmem_top());
printk(BIOS_DEBUG, "CBMEM:\n");
@@ -157,10 +153,7 @@ int cbmem_initialize_id_size(u32 id, u64 size)
struct imd imd_backing;
imd = imd_init_backing(&imd_backing);
-
- /* Early cbmem init platforms need to always use cbmem_top(). */
- if (IS_ENABLED(CONFIG_EARLY_CBMEM_INIT))
- imd_handle_init(imd, cbmem_top());
+ imd_handle_init(imd, cbmem_top());
if (imd_recover(imd))
return 1;