[coreboot-gerrit] Patch set updated for coreboot: 9fdf3de Drop parameter from cbmem_reinit()

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Wed Sep 4 20:26:04 CEST 2013


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/3564

-gerrit

commit 9fdf3de1e2190df144670eaa2bdf0557c638ba93
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Sun Jun 23 17:01:29 2013 +0300

    Drop parameter from cbmem_reinit()
    
    Function is always called with high_tables_base() so there
    is no need to pass it as a parameter.
    
    Change-Id: If026cb567ff534716cd9200cdffa08b21ac0c162
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/include/cbmem.h                       | 2 +-
 src/lib/cbmem.c                           | 9 ++++-----
 src/mainboard/getac/p470/romstage.c       | 5 +----
 src/mainboard/google/stout/romstage.c     | 3 +--
 src/mainboard/ibase/mb899/romstage.c      | 5 +----
 src/mainboard/intel/d945gclf/romstage.c   | 5 +----
 src/mainboard/kontron/986lcd-m/romstage.c | 5 +----
 src/mainboard/roda/rk886ex/romstage.c     | 5 +----
 src/mainboard/roda/rk9/romstage.c         | 5 +----
 9 files changed, 12 insertions(+), 32 deletions(-)

diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index 6124f4a..cba0b85 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -135,7 +135,7 @@ void set_cbmem_table(uint64_t base, uint64_t size);
 int cbmem_base_check(void);
 #endif
 
-int cbmem_reinit(u64 baseaddr);
+int cbmem_reinit(void);
 
 struct cbmem_entry *get_cbmem_toc(void);
 void get_cbmem_table(uint64_t *base, uint64_t *size);
diff --git a/src/lib/cbmem.c b/src/lib/cbmem.c
index 963ca4d..656b46d 100644
--- a/src/lib/cbmem.c
+++ b/src/lib/cbmem.c
@@ -113,13 +113,12 @@ static void cbmem_init(u64 baseaddr, u64 size)
 }
 #endif
 
-int cbmem_reinit(u64 baseaddr)
+int cbmem_reinit(void)
 {
-	struct cbmem_entry *cbmem_toc;
-	cbmem_toc = (struct cbmem_entry *)(unsigned long)baseaddr;
+	struct cbmem_entry *cbmem_toc = get_cbmem_toc();
 
 	printk(BIOS_DEBUG, "Re-Initializing CBMEM area to 0x%lx\n",
-	       (unsigned long)baseaddr);
+	       (unsigned long)cbmem_toc);
 
 	return (cbmem_toc[0].magic == CBMEM_MAGIC);
 }
@@ -219,7 +218,7 @@ int cbmem_initialize(void)
 	cbmem_locate_table(&base, &size);
 
 	/* We expect the romstage to always initialize it. */
-	if (!cbmem_reinit(base)) {
+	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)
diff --git a/src/mainboard/getac/p470/romstage.c b/src/mainboard/getac/p470/romstage.c
index 90d38eb..f4e43e5 100644
--- a/src/mainboard/getac/p470/romstage.c
+++ b/src/mainboard/getac/p470/romstage.c
@@ -358,13 +358,10 @@ void main(unsigned long bist)
 	MCHBAR16(SSKPD) = 0xCAFE;
 
 #if CONFIG_HAVE_ACPI_RESUME
-	/* Start address of high memory tables */
-	unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
-
 	/* If there is no high memory area, we didn't boot before, so
 	 * this is not a resume. In that case we just create the cbmem toc.
 	 */
-	if ((boot_mode == 2) && cbmem_reinit((u64)high_ram_base)) {
+	if ((boot_mode == 2) && cbmem_reinit()) {
 		void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
 
 		/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
diff --git a/src/mainboard/google/stout/romstage.c b/src/mainboard/google/stout/romstage.c
index 14820dd..83be94e 100644
--- a/src/mainboard/google/stout/romstage.c
+++ b/src/mainboard/google/stout/romstage.c
@@ -313,8 +313,7 @@ void main(unsigned long bist)
 #if CONFIG_EARLY_CBMEM_INIT
 	cbmem_was_initted = !cbmem_initialize();
 #else
-	cbmem_was_initted = cbmem_reinit((uint64_t) (get_top_of_ram()
-						     - HIGH_MEMORY_SIZE));
+	cbmem_was_initted = cbmem_reinit();
 #endif
 
 #if CONFIG_HAVE_ACPI_RESUME
diff --git a/src/mainboard/ibase/mb899/romstage.c b/src/mainboard/ibase/mb899/romstage.c
index 79eaa0b..b059a57 100644
--- a/src/mainboard/ibase/mb899/romstage.c
+++ b/src/mainboard/ibase/mb899/romstage.c
@@ -312,13 +312,10 @@ void main(unsigned long bist)
 	MCHBAR16(SSKPD) = 0xCAFE;
 
 #if CONFIG_HAVE_ACPI_RESUME
-	/* Start address of high memory tables */
-	unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
-
 	/* If there is no high memory area, we didn't boot before, so
 	 * this is not a resume. In that case we just create the cbmem toc.
 	 */
-	if ((boot_mode == 2) && cbmem_reinit((u64)high_ram_base)) {
+	if ((boot_mode == 2) && cbmem_reinit()) {
 		void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
 
 		/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
diff --git a/src/mainboard/intel/d945gclf/romstage.c b/src/mainboard/intel/d945gclf/romstage.c
index a37f605..248aa3b 100644
--- a/src/mainboard/intel/d945gclf/romstage.c
+++ b/src/mainboard/intel/d945gclf/romstage.c
@@ -270,13 +270,10 @@ void main(unsigned long bist)
 	MCHBAR16(SSKPD) = 0xCAFE;
 
 #if CONFIG_HAVE_ACPI_RESUME
-	/* Start address of high memory tables */
-	unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
-
 	/* If there is no high memory area, we didn't boot before, so
 	 * this is not a resume. In that case we just create the cbmem toc.
 	 */
-	if ((boot_mode == 2) && cbmem_reinit((u64)high_ram_base)) {
+	if ((boot_mode == 2) && cbmem_reinit()) {
 		void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
 
 		/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
diff --git a/src/mainboard/kontron/986lcd-m/romstage.c b/src/mainboard/kontron/986lcd-m/romstage.c
index 03b24d8..324f442 100644
--- a/src/mainboard/kontron/986lcd-m/romstage.c
+++ b/src/mainboard/kontron/986lcd-m/romstage.c
@@ -411,13 +411,10 @@ void main(unsigned long bist)
 	MCHBAR16(SSKPD) = 0xCAFE;
 
 #if CONFIG_HAVE_ACPI_RESUME
-	/* Start address of high memory tables */
-	unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
-
 	/* If there is no high memory area, we didn't boot before, so
 	 * this is not a resume. In that case we just create the cbmem toc.
 	 */
-	if ((boot_mode == 2) && cbmem_reinit((u64)high_ram_base)) {
+	if ((boot_mode == 2) && cbmem_reinit()) {
 		void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
 
 		/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
diff --git a/src/mainboard/roda/rk886ex/romstage.c b/src/mainboard/roda/rk886ex/romstage.c
index ab200d2..cb141f9 100644
--- a/src/mainboard/roda/rk886ex/romstage.c
+++ b/src/mainboard/roda/rk886ex/romstage.c
@@ -347,13 +347,10 @@ void main(unsigned long bist)
 	MCHBAR16(SSKPD) = 0xCAFE;
 
 #if CONFIG_HAVE_ACPI_RESUME
-	/* Start address of high memory tables */
-	unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
-
 	/* If there is no high memory area, we didn't boot before, so
 	 * this is not a resume. In that case we just create the cbmem toc.
 	 */
-	if ((boot_mode == 2) && cbmem_reinit((u64)high_ram_base)) {
+	if ((boot_mode == 2) && cbmem_reinit()) {
 		void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
 
 		/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
diff --git a/src/mainboard/roda/rk9/romstage.c b/src/mainboard/roda/rk9/romstage.c
index 56eea84..075790d 100644
--- a/src/mainboard/roda/rk9/romstage.c
+++ b/src/mainboard/roda/rk9/romstage.c
@@ -184,13 +184,10 @@ void main(unsigned long bist)
 	init_iommu();
 
 #if CONFIG_HAVE_ACPI_RESUME
-	/* Start address of high memory tables */
-	unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
-
 	/* If there is no high memory area, we didn't boot before, so
 	 * this is not a resume. In that case we just create the cbmem toc.
 	 */
-	if (s3resume && cbmem_reinit((u64)high_ram_base)) {
+	if (s3resume && cbmem_reinit() {
 		void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
 
 		/* copy 1MB - 64K to high tables ram_base to prevent memory corruption



More information about the coreboot-gerrit mailing list