summaryrefslogtreecommitdiffstats
path: root/arch/m68k/mm
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-06-13 16:29:25 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-06-13 16:29:25 +0000
commitdb7d4daea91e105e3859cf461d7e53b9b77454b2 (patch)
tree9bb65b95440af09e8aca63abe56970dd3360cc57 /arch/m68k/mm
parent9c1c01ead627bdda9211c9abd5b758d6c687d8ac (diff)
Merge with Linux 2.2.8.
Diffstat (limited to 'arch/m68k/mm')
-rw-r--r--arch/m68k/mm/init.c22
-rw-r--r--arch/m68k/mm/kmap.c27
-rw-r--r--arch/m68k/mm/memory.c14
3 files changed, 41 insertions, 22 deletions
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 8e520702f..9a41dc279 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -123,7 +123,7 @@ void show_mem(void)
unsigned long mm_cachebits = 0;
#endif
-static pte_t *__init kernel_page_table(unsigned long *memavailp)
+__initfunc(static pte_t * kernel_page_table(unsigned long *memavailp))
{
pte_t *ptablep;
@@ -140,15 +140,19 @@ static pte_t *__init kernel_page_table(unsigned long *memavailp)
static pmd_t *last_pgtable __initdata = NULL;
-static pmd_t *__init kernel_ptr_table(unsigned long *memavailp)
+__initfunc(static pmd_t * kernel_ptr_table(unsigned long *memavailp))
{
if (!last_pgtable) {
unsigned long pmd, last;
int i;
+ /* Find the last ptr table that was used in head.S and
+ * reuse the remaining space in that page for further
+ * ptr tables.
+ */
last = (unsigned long)kernel_pg_dir;
for (i = 0; i < PTRS_PER_PGD; i++) {
- if (!pgd_val(kernel_pg_dir[i]))
+ if (!pgd_present(kernel_pg_dir[i]))
continue;
pmd = pgd_page(kernel_pg_dir[i]);
if (pmd > last)
@@ -175,8 +179,8 @@ static pmd_t *__init kernel_ptr_table(unsigned long *memavailp)
return last_pgtable;
}
-static unsigned long __init
-map_chunk (unsigned long addr, long size, unsigned long *memavailp)
+__initfunc(static unsigned long
+map_chunk (unsigned long addr, long size, unsigned long *memavailp))
{
#define PTRTREESIZE (256*1024)
#define ROOTTREESIZE (32*1024*1024)
@@ -282,8 +286,8 @@ extern char __init_begin, __init_end;
* paging_init() continues the virtual memory environment setup which
* was begun by the code in arch/head.S.
*/
-unsigned long __init paging_init(unsigned long start_mem,
- unsigned long end_mem)
+__initfunc(unsigned long paging_init(unsigned long start_mem,
+ unsigned long end_mem))
{
int chunk;
unsigned long mem_avail = 0;
@@ -392,7 +396,7 @@ unsigned long __init paging_init(unsigned long start_mem,
return PAGE_ALIGN(free_area_init(start_mem, end_mem));
}
-void __init mem_init(unsigned long start_mem, unsigned long end_mem)
+__initfunc(void mem_init(unsigned long start_mem, unsigned long end_mem))
{
int codepages = 0;
int datapages = 0;
@@ -443,7 +447,7 @@ void __init mem_init(unsigned long start_mem, unsigned long end_mem)
/* insert pointer tables allocated so far into the tablelist */
init_pointer_table((unsigned long)kernel_pg_dir);
for (i = 0; i < PTRS_PER_PGD; i++) {
- if (pgd_val(kernel_pg_dir[i]))
+ if (pgd_present(kernel_pg_dir[i]))
init_pointer_table(pgd_page(kernel_pg_dir[i]));
}
diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c
index d2cd29011..3fefe4e03 100644
--- a/arch/m68k/mm/kmap.c
+++ b/arch/m68k/mm/kmap.c
@@ -116,6 +116,14 @@ void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
if (!size || size > physaddr + size)
return NULL;
+#ifdef CONFIG_AMIGA
+ if (MACH_IS_AMIGA) {
+ if ((physaddr >= 0x40000000) && (physaddr + size < 0x60000000)
+ && (cacheflag == IOMAP_NOCACHE_SER))
+ return (void *)physaddr;
+ }
+#endif
+
#ifdef DEBUG
printk("ioremap: 0x%lx,0x%lx(%d) - ", physaddr, size, cacheflag);
#endif
@@ -174,7 +182,7 @@ void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
}
}
- while (size > 0) {
+ while ((long)size > 0) {
#ifdef DEBUG
if (!(virtaddr & (PTRTREESIZE-1)))
printk ("\npa=%#lx va=%#lx ", physaddr, virtaddr);
@@ -187,7 +195,7 @@ void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
}
if (CPU_IS_020_OR_030) {
- pmd_dir->pmd[(virtaddr/PTRTREESIZE)&-16] = physaddr;
+ pmd_dir->pmd[(virtaddr/PTRTREESIZE) & 15] = physaddr;
physaddr += PTRTREESIZE;
virtaddr += PTRTREESIZE;
size -= PTRTREESIZE;
@@ -217,7 +225,14 @@ void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
*/
void iounmap(void *addr)
{
+#ifdef CONFIG_AMIGA
+ if ((!MACH_IS_AMIGA) ||
+ (((unsigned long)addr < 0x40000000) ||
+ ((unsigned long)addr > 0x60000000)))
+ free_io_area(addr);
+#else
free_io_area(addr);
+#endif
}
/*
@@ -232,7 +247,7 @@ void __iounmap(void *addr, unsigned long size)
pmd_t *pmd_dir;
pte_t *pte_dir;
- while (size > 0) {
+ while ((long)size > 0) {
pgd_dir = pgd_offset_k(virtaddr);
if (pgd_bad(*pgd_dir)) {
printk("iounmap: bad pgd(%08lx)\n", pgd_val(*pgd_dir));
@@ -242,7 +257,7 @@ void __iounmap(void *addr, unsigned long size)
pmd_dir = pmd_offset(pgd_dir, virtaddr);
if (CPU_IS_020_OR_030) {
- int pmd_off = (virtaddr/PTRTREESIZE) & -16;
+ int pmd_off = (virtaddr/PTRTREESIZE) & 15;
if ((pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK) == _PAGE_PRESENT) {
pmd_dir->pmd[pmd_off] = 0;
@@ -308,7 +323,7 @@ void kernel_set_cachemode(void *addr, unsigned long size, int cmode)
}
}
- while (size > 0) {
+ while ((long)size > 0) {
pgd_dir = pgd_offset_k(virtaddr);
if (pgd_bad(*pgd_dir)) {
printk("iocachemode: bad pgd(%08lx)\n", pgd_val(*pgd_dir));
@@ -318,7 +333,7 @@ void kernel_set_cachemode(void *addr, unsigned long size, int cmode)
pmd_dir = pmd_offset(pgd_dir, virtaddr);
if (CPU_IS_020_OR_030) {
- int pmd_off = (virtaddr/PTRTREESIZE) & -16;
+ int pmd_off = (virtaddr/PTRTREESIZE) & 15;
if ((pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK) == _PAGE_PRESENT) {
pmd_dir->pmd[pmd_off] = (pmd_dir->pmd[pmd_off] &
diff --git a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c
index a97578ec2..a6d496571 100644
--- a/arch/m68k/mm/memory.c
+++ b/arch/m68k/mm/memory.c
@@ -11,6 +11,7 @@
#include <linux/types.h>
#include <linux/malloc.h>
#include <linux/init.h>
+#include <linux/pagemap.h>
#include <asm/setup.h>
#include <asm/segment.h>
@@ -93,12 +94,11 @@ typedef struct page ptable_desc;
static ptable_desc ptable_list = { &ptable_list, &ptable_list };
#define PD_MARKBITS(dp) (*(unsigned char *)&(dp)->offset)
-#define PD_PAGE(dp) (PAGE_OFFSET + ((dp)->map_nr << PAGE_SHIFT))
#define PAGE_PD(page) ((ptable_desc *)&mem_map[MAP_NR(page)])
#define PTABLE_SIZE (PTRS_PER_PMD * sizeof(pmd_t))
-void __init init_pointer_table(unsigned long ptable)
+__initfunc(void init_pointer_table(unsigned long ptable))
{
ptable_desc *dp;
unsigned long page = ptable & PAGE_MASK;
@@ -166,7 +166,7 @@ pmd_t *get_pointer_table (void)
(dp->next = last->next)->prev = dp;
(dp->prev = last)->next = dp;
}
- return (pmd_t *) (PD_PAGE(dp) + off);
+ return (pmd_t *) (page_address(dp) + off);
}
int free_pointer_table (pmd_t *ptable)
@@ -215,8 +215,8 @@ static unsigned long transp_transl_matches( unsigned long regval,
/* function code match? */
base = (regval >> 4) & 7;
mask = ~(regval & 7);
- if ((SUPER_DATA & mask) != (base & mask))
- return( 0 );
+ if (((SUPER_DATA ^ base) & mask) != 0)
+ return 0;
}
else {
/* must not be user-only */
@@ -226,8 +226,8 @@ static unsigned long transp_transl_matches( unsigned long regval,
/* address match? */
base = regval & 0xff000000;
- mask = ~((regval << 8) & 0xff000000);
- return( (vaddr & mask) == (base & mask) );
+ mask = ~(regval << 8) & 0xff000000;
+ return ((vaddr ^ base) & mask) == 0;
}
#ifndef CONFIG_SINGLE_MEMORY_CHUNK