summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2013-09-06 10:46:22 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2013-09-11 07:18:53 +0200
commitf9f74afdd7b39c12d399a900f3af326a33c87387 (patch)
tree064d869087e861b668eb79b07203d0c40cc772d1 /src
parentbc90e15d3f8e841ccf229fca5d7df99436ff4bdb (diff)
downloadcoreboot-f9f74afdd7b39c12d399a900f3af326a33c87387.tar.xz
CBMEM x86: Unify get_cbmem_toc()
Remove any chipset-specific implementations and use arch-specific implementation of get_cbmem_table() instead. Change-Id: I338ee2c1bd51f5e517462115170dc926e040159e Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/3907 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/include/cbmem.h2
-rw-r--r--src/lib/cbmem.c2
-rw-r--r--src/mainboard/emulation/qemu-i440fx/memory.c7
-rw-r--r--src/northbridge/intel/i945/raminit.c5
-rw-r--r--src/northbridge/intel/sandybridge/northbridge.c8
-rw-r--r--src/northbridge/intel/sandybridge/raminit.c5
-rw-r--r--src/northbridge/via/vx900/early_vx900.c5
7 files changed, 3 insertions, 31 deletions
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index bbdfe38961..00998f37e8 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -141,7 +141,7 @@ void cbmem_init(u64 baseaddr, u64 size);
int cbmem_reinit(u64 baseaddr);
void get_cbmem_table(uint64_t *base, uint64_t *size);
-extern struct cbmem_entry *get_cbmem_toc(void);
+struct cbmem_entry *get_cbmem_toc(void);
#endif /* CONFIG_DYNAMIC_CBMEM */
diff --git a/src/lib/cbmem.c b/src/lib/cbmem.c
index b6751defe4..2307054421 100644
--- a/src/lib/cbmem.c
+++ b/src/lib/cbmem.c
@@ -71,7 +71,7 @@ static void cbmem_locate_table(uint64_t *base, uint64_t *size)
#endif
}
-struct cbmem_entry *__attribute__((weak)) get_cbmem_toc(void)
+struct cbmem_entry *get_cbmem_toc(void)
{
uint64_t base, size;
cbmem_locate_table(&base, &size);
diff --git a/src/mainboard/emulation/qemu-i440fx/memory.c b/src/mainboard/emulation/qemu-i440fx/memory.c
index 08077e9681..027deb9c49 100644
--- a/src/mainboard/emulation/qemu-i440fx/memory.c
+++ b/src/mainboard/emulation/qemu-i440fx/memory.c
@@ -45,12 +45,7 @@ unsigned long get_top_of_ram(void)
return qemu_get_memory_size() * 1024;
}
-#if !CONFIG_DYNAMIC_CBMEM
-struct cbmem_entry *get_cbmem_toc(void)
-{
- return (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
-}
-#else
+#if CONFIG_DYNAMIC_CBMEM
void *cbmem_top(void)
{
/* Top of cbmem is at lowest usable DRAM address below 4GiB. */
diff --git a/src/northbridge/intel/i945/raminit.c b/src/northbridge/intel/i945/raminit.c
index b1a0684b8e..b50f1d80a1 100644
--- a/src/northbridge/intel/i945/raminit.c
+++ b/src/northbridge/intel/i945/raminit.c
@@ -28,11 +28,6 @@
#include "i945.h"
#include <cbmem.h>
-struct cbmem_entry *get_cbmem_toc(void)
-{
- return (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
-}
-
/* Debugging macros. */
#if CONFIG_DEBUG_RAM_SETUP
#define PRINTK_DEBUG(x...) printk(BIOS_DEBUG, x)
diff --git a/src/northbridge/intel/sandybridge/northbridge.c b/src/northbridge/intel/sandybridge/northbridge.c
index 4abcec33cb..a03b8a6492 100644
--- a/src/northbridge/intel/sandybridge/northbridge.c
+++ b/src/northbridge/intel/sandybridge/northbridge.c
@@ -58,14 +58,6 @@ unsigned long get_top_of_ram(void)
return (unsigned long) tom;
}
-struct cbmem_entry *get_cbmem_toc(void)
-{
- static struct cbmem_entry *toc = NULL;
- if (!toc)
- toc = (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
- return toc;
-}
-
/* Reserve everything between A segment and 1MB:
*
* 0xa0000 - 0xbffff: legacy VGA
diff --git a/src/northbridge/intel/sandybridge/raminit.c b/src/northbridge/intel/sandybridge/raminit.c
index 3eb2fb3e79..3b321d72b2 100644
--- a/src/northbridge/intel/sandybridge/raminit.c
+++ b/src/northbridge/intel/sandybridge/raminit.c
@@ -305,11 +305,6 @@ void sdram_initialize(struct pei_data *pei_data)
save_mrc_data(pei_data);
}
-struct cbmem_entry *get_cbmem_toc(void)
-{
- return (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
-}
-
unsigned long get_top_of_ram(void)
{
/* Base of TSEG is top of usable DRAM */
diff --git a/src/northbridge/via/vx900/early_vx900.c b/src/northbridge/via/vx900/early_vx900.c
index 2439c8db4c..2896680b32 100644
--- a/src/northbridge/via/vx900/early_vx900.c
+++ b/src/northbridge/via/vx900/early_vx900.c
@@ -27,11 +27,6 @@ unsigned long get_top_of_ram(void)
return (((unsigned long)reg_tom) << 24) - (256 << 20);
}
-struct cbmem_entry *get_cbmem_toc(void)
-{
- return (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
-}
-
/**
* \brief Enable accessing of PCI configuration space for all devices.
*