summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonald G. Minnich <rminnich@gmail.com>2014-10-16 10:58:09 +0000
committerRonald G. Minnich <rminnich@gmail.com>2014-10-16 17:40:06 +0200
commitf33d270d972f101341d7273267b8215dfff61cf5 (patch)
treed0303fd334d986aeb7c8fabee390dd6c5ea75eb4
parent6d7de4f64f6ee94631044b9574a4a5125c0faa6f (diff)
downloadcoreboot-f33d270d972f101341d7273267b8215dfff61cf5.tar.xz
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)
-rw-r--r--src/lib/dynamic_cbmem.c18
1 files changed, 11 insertions, 7 deletions
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;
}