[OpenBIOS] [commit] r995 - in trunk/openbios-devel: arch/ppc/qemu arch/sparc64 include/libopenbios libopenbios
repository service
svn at openbios.org
Thu Dec 30 14:56:25 CET 2010
Author: mcayland
Date: Thu Dec 30 14:56:24 2010
New Revision: 995
URL: http://tracker.coreboot.org/trac/openbios/changeset/995
Log:
Introduce ofmem_arch_get_phys_top() for specifying the top of physical memory in OFMEM.
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 at siriusit.co.uk>
Modified:
trunk/openbios-devel/arch/ppc/qemu/ofmem.c
trunk/openbios-devel/arch/sparc64/ofmem_sparc64.c
trunk/openbios-devel/include/libopenbios/ofmem.h
trunk/openbios-devel/libopenbios/ofmem_common.c
Modified: trunk/openbios-devel/arch/ppc/qemu/ofmem.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/qemu/ofmem.c Thu Dec 30 14:56:20 2010 (r994)
+++ trunk/openbios-devel/arch/ppc/qemu/ofmem.c Thu Dec 30 14:56:24 2010 (r995)
@@ -115,6 +115,13 @@
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 */
Modified: trunk/openbios-devel/arch/sparc64/ofmem_sparc64.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/ofmem_sparc64.c Thu Dec 30 14:56:20 2010 (r994)
+++ trunk/openbios-devel/arch/sparc64/ofmem_sparc64.c Thu Dec 30 14:56:24 2010 (r995)
@@ -63,6 +63,13 @@
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 */
Modified: trunk/openbios-devel/include/libopenbios/ofmem.h
==============================================================================
--- trunk/openbios-devel/include/libopenbios/ofmem.h Thu Dec 30 14:56:20 2010 (r994)
+++ trunk/openbios-devel/include/libopenbios/ofmem.h Thu Dec 30 14:56:24 2010 (r995)
@@ -62,6 +62,7 @@
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);
Modified: trunk/openbios-devel/libopenbios/ofmem_common.c
==============================================================================
--- trunk/openbios-devel/libopenbios/ofmem_common.c Thu Dec 30 14:56:20 2010 (r994)
+++ trunk/openbios-devel/libopenbios/ofmem_common.c Thu Dec 30 14:56:24 2010 (r995)
@@ -354,7 +354,7 @@
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 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 @@
" 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 @@
} 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");
More information about the OpenBIOS
mailing list