patch-2.4.0-test3 linux/arch/ppc/amiga/chipram.c
Next file: linux/arch/ppc/config.in
Previous file: linux/arch/ppc/8xx_io/uart.c
Back to the patch index
Back to the overall index
- Lines: 110
- Date:
Sat Jul 8 19:44:08 2000
- Orig file:
v2.4.0-test2/linux/arch/ppc/amiga/chipram.c
- Orig date:
Sat Oct 9 11:47:50 1999
diff -u --recursive --new-file v2.4.0-test2/linux/arch/ppc/amiga/chipram.c linux/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 @@
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) {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)