j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
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 | 8 ++++---- 4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/openbios-devel/arch/ppc/qemu/ofmem.c b/openbios-devel/arch/ppc/qemu/ofmem.c index 44b5ef4..8f52bdf 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 3d8ddbf..1e44d36 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 638ca30..a7a0edf 100644 --- a/openbios-devel/libopenbios/ofmem_common.c +++ b/openbios-devel/libopenbios/ofmem_common.c @@ -354,7 +354,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(); @@ -481,7 +481,7 @@ static ucell find_area( ucell align, ucell size, range_t *r, }
static phys_addr_t ofmem_claim_phys_( phys_addr_t phys, ucell size, ucell align, - ucell min, ucell max, int reverse ) + phys_addr_t min, phys_addr_t max, int reverse ) { ofmem_t *ofmem = ofmem_arch_get_private(); if( !align ) { @@ -511,7 +511,7 @@ phys_addr_t ofmem_claim_phys( phys_addr_t phys, ucell size, ucell align ) " align=" FMT_ucellx "\n", phys, size, align);
- return ofmem_claim_phys_( phys, size, align, 0, get_ram_size(), 0 ); + return ofmem_claim_phys_( phys, size, align, 0, ofmem_arch_get_phys_top(), 0 ); }
static ucell ofmem_claim_virt_( ucell virt, ucell size, ucell align, @@ -591,7 +591,7 @@ ucell ofmem_claim( ucell addr, ucell size, ucell align ) } else { if( align < 0x1000 ) align = 0x1000; - phys = ofmem_claim_phys_( addr, size, align, 0, get_ram_size(), 1 /* reverse */ ); + phys = ofmem_claim_phys_( addr, size, align, 0, ofmem_arch_get_phys_top(), 1 /* reverse */ ); virt = ofmem_claim_virt_( addr, size, align, 0, get_ram_size(), 1 /* reverse */ ); if( phys == -1 || virt == -1 ) { OFMEM_TRACE("ofmem_claim failed\n");