cbmem: 64/32 cleanup

Change-Id: I4b55b635cc233a9d48b284623399277d941b0d5a
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-on: http://review.coreboot.org/7069
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Tested-by: build bot (Jenkins)
This commit is contained in:
Ronald G. Minnich 2014-10-16 10:58:09 +00:00
parent 6d7de4f64f
commit f33d270d97
1 changed files with 11 additions and 7 deletions

View File

@ -97,17 +97,18 @@ static inline void *get_top_aligned(void)
static inline void *get_root(void) static inline void *get_root(void)
{ {
unsigned long pointer_addr; uintptr_t pointer_addr;
struct cbmem_root_pointer *pointer; 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_addr -= sizeof(struct cbmem_root_pointer);
pointer = (void *)pointer_addr; pointer = (void *)pointer_addr;
if (pointer->magic != CBMEM_POINTER_MAGIC) if (pointer->magic != CBMEM_POINTER_MAGIC)
return NULL; return NULL;
return (void *)pointer->root; pointer_addr = pointer->root;
return (void *)pointer_addr;
} }
static inline void cbmem_entry_assign(struct cbmem_entry *entry, 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; unsigned int i;
u32 current_end; 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", printk(BIOS_DEBUG, "CBMEM: recovering %d/%d entries from root @ %p\n",
root->num_entries, root->max_entries, root); root->num_entries, root->max_entries, root);
@ -270,14 +271,16 @@ int cbmem_recovery(int is_wakeup)
static void *cbmem_base(void) static void *cbmem_base(void)
{ {
struct cbmem_root *root; struct cbmem_root *root;
u32 low_addr; uintptr_t low_addr;
root = get_root(); root = get_root();
if (root == NULL) if (root == NULL)
return 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. */ /* Assume the lowest address is the last one added. */
if (root->num_entries > 0) { 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) void *cbmem_entry_start(const struct cbmem_entry *entry)
{ {
return (void *)entry->start; uintptr_t addr = entry->start;
return (void *)addr;
} }