CBMEM: Unify get_top_of_ram()

Change-Id: Ic40a51638873642f33c74d80ac41cf082b2fb177
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/3904
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@google.com>
This commit is contained in:
Kyösti Mälkki 2013-09-04 01:11:16 +03:00
parent e1ea802ea6
commit dcb688e5ec
14 changed files with 8 additions and 12 deletions

View File

@ -146,6 +146,8 @@ extern struct cbmem_entry *get_cbmem_toc(void);
/* Common API between cbmem and dynamic cbmem. */ /* Common API between cbmem and dynamic cbmem. */
unsigned long get_top_of_ram(void);
/* By default cbmem is attempted to be recovered. Returns 0 if cbmem was /* By default cbmem is attempted to be recovered. Returns 0 if cbmem was
* recovered or 1 if cbmem had to be reinitialized. */ * recovered or 1 if cbmem had to be reinitialized. */
int cbmem_initialize(void); int cbmem_initialize(void);

View File

@ -222,7 +222,6 @@ int cbmem_initialize(void)
int rv = 0; int rv = 0;
#ifdef __PRE_RAM__ #ifdef __PRE_RAM__
extern unsigned long get_top_of_ram(void);
uint64_t high_tables_base = get_top_of_ram() - HIGH_MEMORY_SIZE; uint64_t high_tables_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
uint64_t high_tables_size = HIGH_MEMORY_SIZE; uint64_t high_tables_size = HIGH_MEMORY_SIZE;
#endif #endif

View File

@ -40,7 +40,6 @@ static unsigned long qemu_get_memory_size(void)
return tomk; return tomk;
} }
unsigned long get_top_of_ram(void);
unsigned long get_top_of_ram(void) unsigned long get_top_of_ram(void)
{ {
return qemu_get_memory_size() * 1024; return qemu_get_memory_size() * 1024;

View File

@ -28,7 +28,6 @@ int sizeram(void);
/* northbridgeinit.c */ /* northbridgeinit.c */
void northbridge_init_early(void); void northbridge_init_early(void);
uint32_t get_top_of_ram(void);
/* pll_reset.c */ /* pll_reset.c */
unsigned int GeodeLinkSpeed(void); unsigned int GeodeLinkSpeed(void);

View File

@ -30,6 +30,7 @@
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <cpu/x86/msr.h> #include <cpu/x86/msr.h>
#include <cpu/x86/cache.h> #include <cpu/x86/cache.h>
#include <cbmem.h>
struct gliutable { struct gliutable {
unsigned long desc_name; unsigned long desc_name;
@ -713,7 +714,7 @@ static void setup_lx_cache(void)
wbinvd(); wbinvd();
} }
uint32_t get_top_of_ram(void) unsigned long get_top_of_ram(void)
{ {
struct gliutable *gl = 0; struct gliutable *gl = 0;
uint32_t systop; uint32_t systop;

View File

@ -25,6 +25,7 @@
#include <assert.h> #include <assert.h>
#include <spd.h> #include <spd.h>
#include <sdram_mode.h> #include <sdram_mode.h>
#include <cbmem.h>
#include "raminit.h" #include "raminit.h"
#include "e7505.h" #include "e7505.h"

View File

@ -20,7 +20,6 @@ void e7505_mch_scrub_ecc(unsigned long ret_addr);
void e7505_mch_done(const struct mem_controller *memctrl); void e7505_mch_done(const struct mem_controller *memctrl);
int e7505_mch_is_ready(void); int e7505_mch_is_ready(void);
unsigned long get_top_of_ram(void);
/* Mainboard exports this. */ /* Mainboard exports this. */
int spd_read_byte(unsigned device, unsigned address); int spd_read_byte(unsigned device, unsigned address);

View File

@ -422,7 +422,6 @@ void gm45_late_init(stepping_t);
u32 decode_igd_memory_size(u32 gms); u32 decode_igd_memory_size(u32 gms);
u32 decode_igd_gtt_size(u32 gsm); u32 decode_igd_gtt_size(u32 gsm);
u32 get_top_of_ram(void);
void init_iommu(void); void init_iommu(void);
#endif #endif

View File

@ -26,6 +26,7 @@
#include <arch/io.h> #include <arch/io.h>
#include <device/pci_def.h> #include <device/pci_def.h>
#include <console/console.h> #include <console/console.h>
#include <cbmem.h>
#include "gm45.h" #include "gm45.h"
/** Decodes used Graphics Mode Select (GMS) to kilobytes. */ /** Decodes used Graphics Mode Select (GMS) to kilobytes. */
@ -83,7 +84,7 @@ u32 decode_igd_gtt_size(const u32 gsm)
} }
} }
u32 get_top_of_ram(void) unsigned long get_top_of_ram(void)
{ {
const pci_devfn_t dev = PCI_DEV(0, 0, 0); const pci_devfn_t dev = PCI_DEV(0, 0, 0);

View File

@ -23,7 +23,6 @@
#include "pei_data.h" #include "pei_data.h"
void sdram_initialize(struct pei_data *pei_data); void sdram_initialize(struct pei_data *pei_data);
unsigned long get_top_of_ram(void);
int fixup_haswell_errata(void); int fixup_haswell_errata(void);
/* save_mrc_data() must be called after cbmem has been initialized. */ /* save_mrc_data() must be called after cbmem has been initialized. */
void save_mrc_data(struct pei_data *pei_data); void save_mrc_data(struct pei_data *pei_data);

View File

@ -69,7 +69,6 @@ struct sys_info {
void receive_enable_adjust(struct sys_info *sysinfo); void receive_enable_adjust(struct sys_info *sysinfo);
void sdram_initialize(int boot_path, const u8 *sdram_addresses); void sdram_initialize(int boot_path, const u8 *sdram_addresses);
unsigned long get_top_of_ram(void);
int fixup_i945_errata(void); int fixup_i945_errata(void);
void udelay(u32 us); void udelay(u32 us);

View File

@ -51,7 +51,7 @@ int bridge_silicon_revision(void)
return bridge_revision_id; return bridge_revision_id;
} }
static unsigned long get_top_of_ram(void) unsigned long get_top_of_ram(void)
{ {
/* Base of TSEG is top of usable DRAM */ /* Base of TSEG is top of usable DRAM */
u32 tom = pci_read_config32(dev_find_slot(0, PCI_DEVFN(0,0)), TSEG); u32 tom = pci_read_config32(dev_find_slot(0, PCI_DEVFN(0,0)), TSEG);

View File

@ -30,7 +30,6 @@ struct sys_info {
} __attribute__ ((packed)); } __attribute__ ((packed));
void sdram_initialize(struct pei_data *pei_data); void sdram_initialize(struct pei_data *pei_data);
unsigned long get_top_of_ram(void);
int fixup_sandybridge_errata(void); int fixup_sandybridge_errata(void);
#endif /* RAMINIT_H */ #endif /* RAMINIT_H */

View File

@ -61,7 +61,6 @@
#define RAMINIT_USE_HW_RXCR_CALIB 0 #define RAMINIT_USE_HW_RXCR_CALIB 0
#define RAMINIT_USE_HW_MRS_SEQ 0 #define RAMINIT_USE_HW_MRS_SEQ 0
unsigned long get_top_of_ram(void);
void enable_smbus(void); void enable_smbus(void);
void dump_spd_data(spd_raw_data spd); void dump_spd_data(spd_raw_data spd);