From f33d270d972f101341d7273267b8215dfff61cf5 Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Thu, 16 Oct 2014 10:58:09 +0000 Subject: cbmem: 64/32 cleanup Change-Id: I4b55b635cc233a9d48b284623399277d941b0d5a Signed-off-by: Ronald G. Minnich Reviewed-on: http://review.coreboot.org/7069 Reviewed-by: Edward O'Callaghan Tested-by: build bot (Jenkins) --- src/lib/dynamic_cbmem.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/lib') diff --git a/src/lib/dynamic_cbmem.c b/src/lib/dynamic_cbmem.c index 1382f1de29..ba96e8cbce 100644 --- a/src/lib/dynamic_cbmem.c +++ b/src/lib/dynamic_cbmem.c @@ -97,17 +97,18 @@ static inline void *get_top_aligned(void) static inline void *get_root(void) { - unsigned long pointer_addr; + uintptr_t pointer_addr; struct cbmem_root_pointer *pointer; - pointer_addr = (unsigned long)get_top_aligned(); + pointer_addr = (uintptr_t)get_top_aligned(); pointer_addr -= sizeof(struct cbmem_root_pointer); pointer = (void *)pointer_addr; if (pointer->magic != CBMEM_POINTER_MAGIC) return NULL; - return (void *)pointer->root; + pointer_addr = pointer->root; + return (void *)pointer_addr; } static inline void cbmem_entry_assign(struct cbmem_entry *entry, @@ -190,7 +191,7 @@ static int validate_entries(struct cbmem_root *root) unsigned int i; u32 current_end; - current_end = (u32)get_top_aligned(); + current_end = (uintptr_t)get_top_aligned(); printk(BIOS_DEBUG, "CBMEM: recovering %d/%d entries from root @ %p\n", root->num_entries, root->max_entries, root); @@ -270,14 +271,16 @@ int cbmem_recovery(int is_wakeup) static void *cbmem_base(void) { struct cbmem_root *root; - u32 low_addr; + uintptr_t low_addr; root = get_root(); if (root == NULL) return NULL; - low_addr = (u32)root; + low_addr = (uintptr_t)root; + /* a low address is low. */ + low_addr &= 0xffffffff; /* Assume the lowest address is the last one added. */ if (root->num_entries > 0) { @@ -411,7 +414,8 @@ u64 cbmem_entry_size(const struct cbmem_entry *entry) void *cbmem_entry_start(const struct cbmem_entry *entry) { - return (void *)entry->start; + uintptr_t addr = entry->start; + return (void *)addr; } -- cgit v1.2.3