summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}