[OpenBIOS] [PATCH 5/7] SPARC32: Remove manual fix for bad alignments passed into the romvec malloc() functions

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Fri Apr 12 14:57:45 CEST 2013


Since the handling of bad alignments is now internal to OFMEM, there is no need for
the SPARC32 malloc() functions to have to do this any more.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 openbios-devel/arch/sparc32/lib.c |   24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/openbios-devel/arch/sparc32/lib.c b/openbios-devel/arch/sparc32/lib.c
index f8fa55a..350cd08 100644
--- a/openbios-devel/arch/sparc32/lib.c
+++ b/openbios-devel/arch/sparc32/lib.c
@@ -285,28 +285,14 @@ char *obp_memalloc(char *va, unsigned int size, unsigned int align)
 
 char *obp_dumb_memalloc(char *va, unsigned int size)
 {
-    unsigned long align;
-    int i;
+    unsigned long align = size;
     
     DPRINTF("obp_dumb_memalloc: virta 0x%x, sz %d\n", (unsigned int)va, size);    
     
-    /* Solaris seems to assume that the returned value is physically aligned to size. For
-       example, not having this here causes the Solaris 8 kernel to fault because the 
-       IOMMU page table base address is calculated incorrectly. */
-
-    /* Enforce a minimum alignment of CONFIG_OFMEM_MALLOC_ALIGN, and choose an alignment 
-       which is the next power of 2 higher than the specified size */
-    align = size;
-    if (align <= CONFIG_OFMEM_MALLOC_ALIGN) {
-        align = CONFIG_OFMEM_MALLOC_ALIGN;
-    } else {
-        align--;
-        for (i = 1; i < sizeof(unsigned long) * 8; i<<=1) {
-            align |= align >> i;
-        }
-        align++;
-    }
-
+    /* Solaris seems to assume that the returned value is physically aligned to size.
+       e.g. it is used for setting up page tables. Fortunately this is now handled by 
+       ofmem_claim_phys() above. */
+    
     return obp_memalloc(va, size, align);
 }
 
-- 
1.7.10.4




More information about the OpenBIOS mailing list