[coreboot-gerrit] New patch to review for coreboot: 3eb16ab CBMEM ACPI: Move resume handler
Kyösti Mälkki (kyosti.malkki@gmail.com)
gerrit at coreboot.org
Sun Jan 5 09:55:43 CET 2014
Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4619
-gerrit
commit 3eb16abf89b9426669200620fa5b188051415c7d
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date: Fri Jan 3 15:15:22 2014 +0200
CBMEM ACPI: Move resume handler
Handler is ACPI/x86 specific so move details out of cbmem code.
With static CBMEM initialisation, ramstage will need to test for
S3 wakeup condition so publish also acpi_is_wakeup().
Change-Id: If591535448cdd24a54262b534c1a828fc13da759
Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
src/arch/armv7/tables.c | 4 ++++
src/arch/x86/boot/acpi.c | 8 +++++++-
src/arch/x86/boot/cbmem.c | 15 +++++++++++++++
src/arch/x86/include/arch/acpi.h | 2 ++
src/include/cbmem.h | 2 ++
src/lib/cbmem.c | 6 +-----
src/lib/dynamic_cbmem.c | 15 +--------------
7 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/src/arch/armv7/tables.c b/src/arch/armv7/tables.c
index cf4e4e0..3f5338c 100644
--- a/src/arch/armv7/tables.c
+++ b/src/arch/armv7/tables.c
@@ -42,6 +42,10 @@ void cbmem_arch_init(void)
{
}
+void cbmem_fail_resume(void)
+{
+}
+
struct lb_memory *write_tables(void)
{
unsigned long table_pointer, new_table_pointer;
diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c
index 96cb270..0e09ec5 100644
--- a/src/arch/x86/boot/acpi.c
+++ b/src/arch/x86/boot/acpi.c
@@ -645,12 +645,18 @@ void acpi_resume(void *wake_vec)
/* This is to be filled by SB code - startup value what was found. */
u8 acpi_slp_type = 0;
-static int acpi_is_wakeup(void)
+int acpi_is_wakeup(void)
{
/* Both resume from S2 and resume from S3 restart at CPU reset */
return (acpi_slp_type == 3 || acpi_slp_type == 2);
}
+void acpi_fail_wakeup(void)
+{
+ if (acpi_slp_type == 3 || acpi_slp_type == 2)
+ acpi_slp_type = 0;
+}
+
static acpi_rsdp_t *valid_rsdp(acpi_rsdp_t *rsdp)
{
if (strncmp((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0)
diff --git a/src/arch/x86/boot/cbmem.c b/src/arch/x86/boot/cbmem.c
index bdc695c..0152018 100644
--- a/src/arch/x86/boot/cbmem.c
+++ b/src/arch/x86/boot/cbmem.c
@@ -17,6 +17,7 @@
#include <console/console.h>
#include <cbmem.h>
+#include <arch/acpi.h>
#if !CONFIG_DYNAMIC_CBMEM
void get_cbmem_table(uint64_t *base, uint64_t *size)
@@ -64,3 +65,17 @@ void *cbmem_top(void)
}
#endif /* DYNAMIC_CBMEM */
+
+#if !defined(__PRE_RAM__)
+
+/* ACPI resume needs to be cleared in the fail-to-recover case, but that
+ * condition is only handled during ramstage. */
+void cbmem_fail_resume(void)
+{
+#if CONFIG_HAVE_ACPI_RESUME
+ /* Something went wrong, our high memory area got wiped */
+ acpi_fail_wakeup();
+#endif
+}
+
+#endif /* !__PRE_RAM__ */
diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h
index 306f7da..d73c046 100644
--- a/src/arch/x86/include/arch/acpi.h
+++ b/src/arch/x86/include/arch/acpi.h
@@ -558,6 +558,8 @@ void acpi_save_gnvs(u32 gnvs_address);
/* 0 = S0, 1 = S1 ...*/
extern u8 acpi_slp_type;
+int acpi_is_wakeup(void);
+void acpi_fail_wakeup(void);
void acpi_resume(void *wake_vec);
void __attribute__((weak)) mainboard_suspend_resume(void);
void *acpi_find_wakeup_vector(void);
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index 0c32111..f9d268a 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -166,8 +166,10 @@ void cbmem_add_lb_mem(struct lb_memory *mem);
void cbmem_list(void);
void cbmem_arch_init(void);
void cbmem_print_entry(int n, u32 id, u64 start, u64 size);
+void cbmem_fail_resume(void);
#else
static inline void cbmem_arch_init(void) {}
+static inline void cbmem_fail_resume(void) {}
#endif /* __PRE_RAM__ */
#endif /* __ASSEMBLER__ */
diff --git a/src/lib/cbmem.c b/src/lib/cbmem.c
index 6449b55..e6d3913 100644
--- a/src/lib/cbmem.c
+++ b/src/lib/cbmem.c
@@ -228,12 +228,8 @@ int cbmem_initialize(void)
/* We expect the romstage to always initialize it. */
if (!cbmem_reinit()) {
-#if CONFIG_HAVE_ACPI_RESUME && !defined(__PRE_RAM__)
- /* Something went wrong, our high memory area got wiped */
- if (acpi_slp_type == 3 || acpi_slp_type == 2)
- acpi_slp_type = 0;
-#endif
cbmem_init();
+ cbmem_fail_resume();
rv = 1;
}
#ifndef __PRE_RAM__
diff --git a/src/lib/dynamic_cbmem.c b/src/lib/dynamic_cbmem.c
index b934aed..0ab8f81 100644
--- a/src/lib/dynamic_cbmem.c
+++ b/src/lib/dynamic_cbmem.c
@@ -32,19 +32,6 @@
#define UINT_MAX 4294967295U
#endif
-/* ACPI resume needs to be cleared in the fail-to-recover case, but that
- * condition is only handled during ramstage. */
-#if CONFIG_HAVE_ACPI_RESUME && !defined(__PRE_RAM__)
-static inline void cbmem_handle_acpi_resume(void)
-{
- /* Something went wrong, our high memory area got wiped */
- if (acpi_slp_type == 3 || acpi_slp_type == 2)
- acpi_slp_type = 0;
-}
-#else
-static inline void cbmem_handle_acpi_resume(void) {}
-#endif
-
/*
* The dynamic cbmem code uses a root region. The root region boundary
* addresses are determined by cbmem_top() and ROOT_MIN_SIZE. Just below
@@ -191,7 +178,7 @@ void cbmem_initialize_empty(void)
static inline int cbmem_fail_recovery(void)
{
cbmem_initialize_empty();
- cbmem_handle_acpi_resume();
+ cbmem_fail_resume();
/* Migrate cache-as-ram variables. */
car_migrate_variables();
return 1;
More information about the coreboot-gerrit
mailing list