summaryrefslogtreecommitdiffstats
path: root/arch/ppc/amiga/chipram.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-09 23:29:35 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-09 23:29:35 +0000
commit35385d7a83b4cae6d5ea5f80f3b3377d94178344 (patch)
tree49494d95dfef31ba4f9a697d31e4028cf65a57bd /arch/ppc/amiga/chipram.c
parentd9d8062e7b49943b2a2fb034f817a9fc217fd40f (diff)
Merge with 2.4.0-test3-pre7.
Diffstat (limited to 'arch/ppc/amiga/chipram.c')
-rw-r--r--arch/ppc/amiga/chipram.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/arch/ppc/amiga/chipram.c b/arch/ppc/amiga/chipram.c
index 31f91a794..259522584 100644
--- a/arch/ppc/amiga/chipram.c
+++ b/arch/ppc/amiga/chipram.c
@@ -1,15 +1,14 @@
/*
** linux/amiga/chipram.c
**
-** Modified 03-May-94 by Geert Uytterhoeven
-** (Geert.Uytterhoeven@cs.kuleuven.ac.be)
+** Modified 03-May-94 by Geert Uytterhoeven <geert@linux-m68k.org>
** - 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 @@ struct chip_desc {
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 @@ unsigned long amiga_chip_avail( void )
}
-__init
-void amiga_chip_init (void)
+void __init amiga_chip_init (void)
{
struct chip_desc *dp;
@@ -49,6 +49,8 @@ void amiga_chip_init (void)
*/
amiga_chip_size -= 0x4000;
#endif
+ chipram.end = amiga_chip_size-1;
+ request_resource(&iomem_resource, &chipram);
/* initialize start boundary */
@@ -72,7 +74,7 @@ void amiga_chip_init (void)
#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 @@ void *amiga_chip_alloc (long size)
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 @@ void *amiga_chip_alloc (long size)
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 @@ void *amiga_chip_alloc (long size)
}
#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 @@ void amiga_chip_free (void *ptr)
#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) {