At the same time, teach OFMEM to make use of it when calculating the /memory available property.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@siriusit.co.uk --- openbios-devel/arch/ppc/qemu/ofmem.c | 7 +++++++ openbios-devel/arch/sparc64/ofmem_sparc64.c | 7 +++++++ openbios-devel/include/libopenbios/ofmem.h | 1 + openbios-devel/libopenbios/ofmem_common.c | 2 +- 4 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/openbios-devel/arch/ppc/qemu/ofmem.c b/openbios-devel/arch/ppc/qemu/ofmem.c index c21a112..ef8cfc3 100644 --- a/openbios-devel/arch/ppc/qemu/ofmem.c +++ b/openbios-devel/arch/ppc/qemu/ofmem.c @@ -115,6 +115,13 @@ ucell ofmem_arch_get_virt_top(void) return IO_BASE; }
+phys_addr_t ofmem_arch_get_phys_top(void) +{ + ofmem_t *ofmem = ofmem_arch_get_private(); + + return ofmem->ramsize; +} + void ofmem_arch_unmap_pages(ucell virt, ucell size) { /* kill page mappings in provided range */ diff --git a/openbios-devel/arch/sparc64/ofmem_sparc64.c b/openbios-devel/arch/sparc64/ofmem_sparc64.c index 4d13038..0ec8632 100644 --- a/openbios-devel/arch/sparc64/ofmem_sparc64.c +++ b/openbios-devel/arch/sparc64/ofmem_sparc64.c @@ -63,6 +63,13 @@ ucell ofmem_arch_get_virt_top(void) return (ucell)TOP_OF_RAM; }
+phys_addr_t ofmem_arch_get_phys_top(void) +{ + ofmem_t *ofmem = ofmem_arch_get_private(); + + return ofmem->ramsize; +} + retain_t *ofmem_arch_get_retained(void) { /* Retained area is at the top of physical RAM */ diff --git a/openbios-devel/include/libopenbios/ofmem.h b/openbios-devel/include/libopenbios/ofmem.h index 72247d9..b7469c2 100644 --- a/openbios-devel/include/libopenbios/ofmem.h +++ b/openbios-devel/include/libopenbios/ofmem.h @@ -62,6 +62,7 @@ extern ofmem_t* ofmem_arch_get_private(void); extern void* ofmem_arch_get_malloc_base(void); extern ucell ofmem_arch_get_heap_top(void); extern ucell ofmem_arch_get_virt_top(void); +extern phys_addr_t ofmem_arch_get_phys_top(void); extern retain_t* ofmem_arch_get_retained(void); extern int ofmem_arch_get_physaddr_cellsize(void); extern int ofmem_arch_encode_physaddr(ucell *p, phys_addr_t value); diff --git a/openbios-devel/libopenbios/ofmem_common.c b/openbios-devel/libopenbios/ofmem_common.c index 50cd7d8..f235e98 100644 --- a/openbios-devel/libopenbios/ofmem_common.c +++ b/openbios-devel/libopenbios/ofmem_common.c @@ -341,7 +341,7 @@ static void ofmem_update_translations( void ) ofmem_t *ofmem = ofmem_arch_get_private();
ofmem_update_memory_available(s_phandle_memory, ofmem->phys_range, - &phys_range_prop, &phys_range_prop_size, &phys_range_prop_used, get_ram_size()); + &phys_range_prop, &phys_range_prop_size, &phys_range_prop_used, ofmem_arch_get_phys_top()); ofmem_update_memory_available(s_phandle_mmu, ofmem->virt_range, &virt_range_prop, &virt_range_prop_size, &virt_range_prop_used, -1ULL); ofmem_update_mmu_translations();