From: Geert U. <ge...@li...> - 2000-07-08 12:55:30
|
While getting rid of occurrencies of my old email address, I sent following patch to Linus (i.e. keep in sync with the corresponding m68k version). --- native-2.4.0-test3-pre6/arch/ppc/amiga/chipram.c.orig Sun Oct 10 11:10:32 1999 +++ native-2.4.0-test3-pre6/arch/ppc/amiga/chipram.c Sat Jul 8 14:39:57 2000 @@ -1,15 +1,14 @@ /* ** linux/amiga/chipram.c ** -** Modified 03-May-94 by Geert Uytterhoeven -** (Gee...@cs...) +** Modified 03-May-94 by Geert Uytterhoeven <ge...@li...> ** - 64-bit aligned allocations for full AGA compatibility */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> +#include <linux/zorro.h> #include <asm/amigahw.h> struct chip_desc { @@ -25,6 +24,8 @@ u_long amiga_chip_size; static unsigned long chipavail; +static struct resource chipram = { "Chip RAM", 0 }; + unsigned long amiga_chip_avail( void ) { #ifdef DEBUG @@ -34,8 +35,7 @@ } -__init -void amiga_chip_init (void) +void __init amiga_chip_init (void) { struct chip_desc *dp; @@ -49,6 +49,8 @@ */ amiga_chip_size -= 0x4000; #endif + chipram.end = amiga_chip_size-1; + request_resource(&iomem_resource, &chipram); /* initialize start boundary */ @@ -72,7 +74,7 @@ #endif } -void *amiga_chip_alloc (long size) +void *amiga_chip_alloc(long size, const char *name) { /* last chunk */ struct chip_desc *dp; @@ -82,7 +84,7 @@ size = (size + 7) & ~7; #ifdef DEBUG - printk("chip_alloc: allocate %ld bytes\n", size); + printk("amiga_chip_alloc: allocate %ld bytes\n", size); #endif /* @@ -108,14 +110,14 @@ dp = DP((unsigned long)ptr + dp->length); dp->alloced = 1; #ifdef DEBUG - printk ("chip_alloc: no split\n"); + printk ("amiga_chip_alloc: no split\n"); #endif } else { /* split the extent; use the end part */ long newsize = dp->length - (2*sizeof(*dp) + size); #ifdef DEBUG - printk ("chip_alloc: splitting %d to %ld\n", dp->length, + printk ("amiga_chip_alloc: splitting %d to %ld\n", dp->length, newsize); #endif dp->length = newsize; @@ -134,14 +136,18 @@ } #ifdef DEBUG - printk ("chip_alloc: returning %p\n", ptr); + printk ("amiga_chip_alloc: returning %p\n", ptr); #endif if ((unsigned long)ptr & 7) - panic("chip_alloc: alignment violation\n"); + panic("amiga_chip_alloc: alignment violation\n"); chipavail -= size + (2*sizeof(*dp)); /*MILAN*/ + if (!request_mem_region(ZTWO_PADDR(ptr), size, name)) + printk(KERN_WARNING "amiga_chip_alloc: region of size %ld at 0x%08lx " + "is busy\n", size, ZTWO_PADDR(ptr)); + return ptr; } @@ -156,6 +162,7 @@ #endif /* deallocate the chunk */ sdp->alloced = edp->alloced = 0; + release_mem_region(ZTWO_PADDR(ptr), sdp->length); /* check if we should merge with the previous chunk */ if (!sdp->first && !sdp[-1].alloced) { Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- Linux/{m68k~Amiga,PPC~CHRP} -- ge...@li... In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds |