Author: mcayland Date: Sun Jan 2 01:06:12 2011 New Revision: 1002 URL: http://tracker.coreboot.org/trac/openbios/changeset/1002
Log: Switch IOMMU posix_memalign() calls over to ofmem_posix_memalign(), and then remove the private SPARC32 posix_memalign() implementation since it is no longer required.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@siriusit.co.uk Tested-by: Blue Swirl blauwirbel@gmail.com Reviewed-by: Blue Swirl blauwirbel@gmail.com
Modified: trunk/openbios-devel/arch/sparc32/lib.c trunk/openbios-devel/drivers/iommu.c trunk/openbios-devel/include/libc/stdlib.h
Modified: trunk/openbios-devel/arch/sparc32/lib.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/lib.c Sun Jan 2 01:06:03 2011 (r1001) +++ trunk/openbios-devel/arch/sparc32/lib.c Sun Jan 2 01:06:12 2011 (r1002) @@ -216,21 +216,6 @@ return p; }
-// XXX should be removed -int -posix_memalign(void **memptr, size_t alignment, size_t size) -{ - void *block; - - block = mem_alloc(&cmem, size, alignment); - - if (!block) - return -1; - - *memptr = block; - return 0; -} - /* * Allocate memory. This is reusable. */
Modified: trunk/openbios-devel/drivers/iommu.c ============================================================================== --- trunk/openbios-devel/drivers/iommu.c Sun Jan 2 01:06:03 2011 (r1001) +++ trunk/openbios-devel/drivers/iommu.c Sun Jan 2 01:06:12 2011 (r1002) @@ -53,7 +53,7 @@ int ret;
npages = (size + (PAGE_SIZE-1)) / PAGE_SIZE; - ret = posix_memalign(&va, npages * PAGE_SIZE, PAGE_SIZE); + ret = ofmem_posix_memalign(&va, npages * PAGE_SIZE, PAGE_SIZE); if (ret != 0) return NULL;
@@ -132,7 +132,7 @@ /* Allocate IOMMU page table */ /* Tremendous alignment causes great waste... */ ptsize = (vasize / PAGE_SIZE) * sizeof(int); - ret = posix_memalign((void *)&ptab, ptsize, ptsize); + ret = ofmem_posix_memalign((void *)&ptab, ptsize, ptsize); if (ret != 0) { DPRINTF("Cannot allocate IOMMU table [0x%x]\n", ptsize); for (;;) { }
Modified: trunk/openbios-devel/include/libc/stdlib.h ============================================================================== --- trunk/openbios-devel/include/libc/stdlib.h Sun Jan 2 01:06:03 2011 (r1001) +++ trunk/openbios-devel/include/libc/stdlib.h Sun Jan 2 01:06:12 2011 (r1002) @@ -19,7 +19,6 @@ extern void *malloc( int size ); extern void free( void *ptr ); extern void *realloc( void *ptr, size_t size ); -extern int posix_memalign(void **memptr, size_t alignment, size_t size);
/* should perhaps go somewhere else... */ extern void qsort( void *base, size_t nmemb, size_t size, int (*compar)(const void*, const void*));