[coreboot-gerrit] Patch set updated for coreboot: 9b8adf1 CBMEM: Implement cbmem_arch_init() for romstage too

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Tue Dec 30 20:41:14 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/7876

-gerrit

commit 9b8adf1ea1c6c8d3c4df9838939738858d53c12e
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Thu Dec 18 18:30:29 2014 +0200

    CBMEM: Implement cbmem_arch_init() for romstage too
    
    Until we completely can unify early_variables, use this to
    handle CBMEM update hooks for both romstage and ramstage.
    
    Change-Id: I100ebc0e35e1b7091b4f287ca37f539fd7c9fa7a
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/arch/arm/Makefile.inc   |  2 ++
 src/arch/arm/cbmem.c        | 26 ++++++++++++++++++++++++++
 src/arch/arm/tables.c       |  8 --------
 src/arch/arm64/Makefile.inc |  2 ++
 src/arch/arm64/cbmem.c      |  8 ++++++++
 src/arch/arm64/tables.c     |  4 ----
 src/arch/riscv/Makefile.inc |  2 ++
 src/arch/riscv/cbmem.c      | 26 ++++++++++++++++++++++++++
 src/arch/riscv/tables.c     |  8 --------
 src/arch/x86/boot/cbmem.c   | 17 +++++++++++------
 src/arch/x86/boot/tables.c  |  8 --------
 src/include/cbmem.h         |  8 +++-----
 12 files changed, 80 insertions(+), 39 deletions(-)

diff --git a/src/arch/arm/Makefile.inc b/src/arch/arm/Makefile.inc
index 5698f38..fefaeb1 100644
--- a/src/arch/arm/Makefile.inc
+++ b/src/arch/arm/Makefile.inc
@@ -76,6 +76,7 @@ ifeq ($(CONFIG_ARCH_ROMSTAGE_ARM),y)
 romstage-y += stages.c
 romstage-y += div0.c
 romstage-y += eabi_compat.c
+romstage-y += cbmem.c
 romstage-y += memset.S
 romstage-y += memcpy.S
 romstage-y += memmove.S
@@ -100,6 +101,7 @@ ramstage-y += cpu.c
 ramstage-y += eabi_compat.c
 ramstage-y += boot.c
 ramstage-y += tables.c
+ramstage-y += cbmem.c
 ramstage-y += memset.S
 ramstage-y += memcpy.S
 ramstage-y += memmove.S
diff --git a/src/arch/arm/cbmem.c b/src/arch/arm/cbmem.c
new file mode 100644
index 0000000..339b71e
--- /dev/null
+++ b/src/arch/arm/cbmem.c
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ */
+
+#include <cbmem.h>
+
+void cbmem_arch_init(void)
+{
+}
+
+void cbmem_fail_resume(void)
+{
+}
diff --git a/src/arch/arm/tables.c b/src/arch/arm/tables.c
index 20c5a9f..cdeeb36 100644
--- a/src/arch/arm/tables.c
+++ b/src/arch/arm/tables.c
@@ -38,14 +38,6 @@ void __attribute__((weak)) get_cbmem_table(uint64_t *base, uint64_t *size)
 }
 #endif
 
-void cbmem_arch_init(void)
-{
-}
-
-void cbmem_fail_resume(void)
-{
-}
-
 void write_tables(void)
 {
 	unsigned long table_pointer, new_table_pointer;
diff --git a/src/arch/arm64/Makefile.inc b/src/arch/arm64/Makefile.inc
index 5bf72b2..b4df4aa 100644
--- a/src/arch/arm64/Makefile.inc
+++ b/src/arch/arm64/Makefile.inc
@@ -74,6 +74,7 @@ romstage-y += stages.c
 romstage-y += div0.c
 romstage-y += early_console.c
 romstage-y += eabi_compat.c
+romstage-y += cbmem.c
 romstage-y += memset.S
 romstage-y += memcpy.S
 romstage-y += memmove.S
@@ -99,6 +100,7 @@ ramstage-y += cpu.c
 ramstage-y += eabi_compat.c
 ramstage-y += boot.c
 ramstage-y += tables.c
+ramstage-y += cbmem.c
 ramstage-y += memset.S
 ramstage-y += memcpy.S
 ramstage-y += memmove.S
diff --git a/src/arch/arm64/cbmem.c b/src/arch/arm64/cbmem.c
index b33e9b8..e333cfc 100644
--- a/src/arch/arm64/cbmem.c
+++ b/src/arch/arm64/cbmem.c
@@ -28,3 +28,11 @@ void *cbmem_top(void)
 {
         return (void *)get_top_of_ram();
 }
+
+void cbmem_arch_init(void)
+{
+}
+
+void cbmem_fail_resume(void)
+{
+}
diff --git a/src/arch/arm64/tables.c b/src/arch/arm64/tables.c
index 49fab9f..825d7a2 100644
--- a/src/arch/arm64/tables.c
+++ b/src/arch/arm64/tables.c
@@ -38,10 +38,6 @@ uint64_t high_tables_base = 0;
 uint64_t high_tables_size;
 #endif
 
-void cbmem_arch_init(void)
-{
-}
-
 struct lb_memory *write_tables(void)
 {
 	unsigned long table_pointer, new_table_pointer;
diff --git a/src/arch/riscv/Makefile.inc b/src/arch/riscv/Makefile.inc
index 242fd40..ab4ecbd 100644
--- a/src/arch/riscv/Makefile.inc
+++ b/src/arch/riscv/Makefile.inc
@@ -54,6 +54,7 @@ ifeq ($(CONFIG_ARCH_ROMSTAGE_RISCV),y)
 
 romstage-y += stages.c
 romstage-y += rom_media.c
+romstage-y += cbmem.c
 romstage-y += \
 	$(top)/src/lib/memchr.c \
 	$(top)/src/lib/memcmp.c \
@@ -87,6 +88,7 @@ ramstage-y += rom_media.c
 ramstage-y += stages.c
 ramstage-y += misc.c
 ramstage-y += boot.c
+ramstage-y += cbmem.c
 ramstage-y += tables.c
 ramstage-y += \
 	$(top)/src/lib/memchr.c \
diff --git a/src/arch/riscv/cbmem.c b/src/arch/riscv/cbmem.c
new file mode 100644
index 0000000..339b71e
--- /dev/null
+++ b/src/arch/riscv/cbmem.c
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ */
+
+#include <cbmem.h>
+
+void cbmem_arch_init(void)
+{
+}
+
+void cbmem_fail_resume(void)
+{
+}
diff --git a/src/arch/riscv/tables.c b/src/arch/riscv/tables.c
index 6300f7b..124a659 100644
--- a/src/arch/riscv/tables.c
+++ b/src/arch/riscv/tables.c
@@ -29,10 +29,6 @@
 
 #define MAX_COREBOOT_TABLE_SIZE (8 * 1024)
 
-void cbmem_arch_init(void)
-{
-}
-
 // WTF. this does not agre with the prototype!
 static struct lb_memory *wtf_write_tables(void)
 {
@@ -70,7 +66,3 @@ void write_tables(void)
 {
 	wtf_write_tables();
 }
-
-void cbmem_fail_resume(void)
-{
-}
diff --git a/src/arch/x86/boot/cbmem.c b/src/arch/x86/boot/cbmem.c
index 8b2b6da..920ca99 100644
--- a/src/arch/x86/boot/cbmem.c
+++ b/src/arch/x86/boot/cbmem.c
@@ -17,6 +17,7 @@
 
 #include <stdlib.h>
 #include <console/console.h>
+#include <cpu/x86/gdt.h>
 #include <cbmem.h>
 #include <arch/acpi.h>
 
@@ -69,16 +70,20 @@ void *cbmem_top(void)
 
 #endif /* DYNAMIC_CBMEM */
 
+void cbmem_arch_init(void)
+{
+
 #if !defined(__PRE_RAM__)
+	move_gdt();
+#endif
+}
 
-/* ACPI resume needs to be cleared in the fail-to-recover case, but that
- * condition is only handled during ramstage. */
+/* Something went wrong, our high memory area got wiped */
 void cbmem_fail_resume(void)
 {
-#if CONFIG_HAVE_ACPI_RESUME
-	/* Something went wrong, our high memory area got wiped */
+#if !defined(__PRE_RAM__) && IS_ENABLED(CONFIG_HAVE_ACPI_RESUME)
+	/* ACPI resume needs to be cleared in the fail-to-recover case, but that
+	 * condition is only handled during ramstage. */
 	acpi_fail_wakeup();
 #endif
 }
-
-#endif /* !__PRE_RAM__ */
diff --git a/src/arch/x86/boot/tables.c b/src/arch/x86/boot/tables.c
index 8685ed4..c2265ea 100644
--- a/src/arch/x86/boot/tables.c
+++ b/src/arch/x86/boot/tables.c
@@ -21,7 +21,6 @@
 
 #include <console/console.h>
 #include <cpu/cpu.h>
-#include <cpu/x86/gdt.h>
 #include <boot/tables.h>
 #include <boot/coreboot_tables.h>
 #include <arch/pirq_routing.h>
@@ -31,13 +30,6 @@
 #include <cbmem.h>
 #include <smbios.h>
 
-
-void cbmem_arch_init(void)
-{
-	/* defined in gdt.c */
-	move_gdt();
-}
-
 void write_tables(void)
 {
 	unsigned long low_table_start, low_table_end;
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index 7de6e56..a7bd904 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -213,17 +213,15 @@ void *cbmem_add(u32 id, u64 size);
 /* Find a cbmem entry of a given id. These return NULL on failure. */
 void *cbmem_find(u32 id);
 
+void cbmem_arch_init(void);
+void cbmem_fail_resume(void);
+
 #ifndef __PRE_RAM__
 /* Ramstage only functions. */
 /* Add the cbmem memory used to the memory map at boot. */
 void cbmem_add_bootmem(void);
 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__ */



More information about the coreboot-gerrit mailing list