From 546db14ee74118296f425f3b91634fb767d67290 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Thu, 27 Jan 2000 01:05:20 +0000 Subject: Merge with Linux 2.3.23. The new bootmem stuff has broken various platforms. At this time I've only verified that IP22 support compiles and IP27 actually works. --- include/asm-mips/highmem.h | 27 +++++++++++++++++++++++ include/asm-mips/io.h | 19 +++++++++++++++- include/asm-mips/offset.h | 2 +- include/asm-mips/page.h | 36 +++++------------------------- include/asm-mips/pgtable.h | 55 ++++++++++++++++++++++++++++++++++++++-------- 5 files changed, 98 insertions(+), 41 deletions(-) create mode 100644 include/asm-mips/highmem.h (limited to 'include/asm-mips') diff --git a/include/asm-mips/highmem.h b/include/asm-mips/highmem.h new file mode 100644 index 000000000..fe6b44516 --- /dev/null +++ b/include/asm-mips/highmem.h @@ -0,0 +1,27 @@ +/* $Id$ + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2000 by Ralf Baechle + * Copyright (C) 2000 Silicon Graphics, Inc. + */ +#ifndef _ASM_HIGHMEM_H +#define _ASM_HIGHMEM_H + +#include +#include + +/* declarations for highmem.c */ +extern unsigned long highstart_pfn, highend_pfn; + +extern pte_t *kmap_pte; +extern pgprot_t kmap_prot; + +#define kmap_init() do { } while(0) +#define kmap(page, type) page_address(page) +#define kunmap(vaddr, type) do { } while(0) +#define kmap_check() do { } while(0) + +#endif /* _ASM_HIGHMEM_H */ diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h index 20bdbeb34..d4c77dd78 100644 --- a/include/asm-mips/io.h +++ b/include/asm-mips/io.h @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: io.h,v 1.7 1999/10/09 00:01:43 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -173,6 +173,23 @@ extern inline void iounmap(void *addr) /* END SNI HACKS ... */ +/* + * ISA space is 'always mapped' on currently supported MIPS systems, no need + * to explicitly ioremap() it. The fact that the ISA IO space is mapped + * to PAGE_OFFSET is pure coincidence - it does not mean ISA values + * are physical addresses. The following constant pointer can be + * used as the IO-area pointer (it can be iounmapped as well, so the + * analogy with PCI is quite large): + */ +#define __ISA_IO_base ((char *)(PAGE_OFFSET)) + +#define isa_readb(a) readb(a) +#define isa_readw(a) readb(a) +#define isa_readl(a) readb(a) +#define isa_writeb(b,a) writeb(b,a) +#define isa_writew(w,a) writeb(w,a) +#define isa_writel(l,a) writeb(l,a) + /* * We don't have csum_partial_copy_fromio() yet, so we cheat here and * just copy it. The net code will then do the checksum later. diff --git a/include/asm-mips/offset.h b/include/asm-mips/offset.h index 69a32238a..ba0b87698 100644 --- a/include/asm-mips/offset.h +++ b/include/asm-mips/offset.h @@ -52,7 +52,7 @@ #define TASK_COUNTER 24 #define TASK_PRIORITY 28 #define TASK_MM 792 -#define TASK_STRUCT_SIZE 856 +#define TASK_STRUCT_SIZE 864 /* MIPS specific thread_struct offsets. */ #define THREAD_REG16 568 diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h index c24112ea1..0fb32cb97 100644 --- a/include/asm-mips/page.h +++ b/include/asm-mips/page.h @@ -1,4 +1,4 @@ -/* $Id: page.h,v 1.6 1999/01/04 16:09:24 ralf Exp $ +/* $Id: page.h,v 1.7 1999/06/22 23:07:47 ralf Exp $ * * Definitions for page handling * @@ -8,8 +8,8 @@ * * Copyright (C) 1994 - 1999 by Ralf Baechle */ -#ifndef __ASM_MIPS_PAGE_H -#define __ASM_MIPS_PAGE_H +#ifndef __ASM_PAGE_H +#define __ASM_PAGE_H /* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT 12 @@ -18,17 +18,14 @@ #ifdef __KERNEL__ -#define STRICT_MM_TYPECHECKS - #ifndef _LANGUAGE_ASSEMBLY #define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); *(int *)0=0; } while (0) #define PAGE_BUG(page) do { BUG(); } while (0) -extern void (*clear_page)(unsigned long page); -extern void (*copy_page)(unsigned long to, unsigned long from); +extern void (*clear_page)(void * page); +extern void (*copy_page)(void * to, void * from); -#ifdef STRICT_MM_TYPECHECKS /* * These are used to make use of C type-checking.. */ @@ -47,27 +44,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define __pgd(x) ((pgd_t) { (x) } ) #define __pgprot(x) ((pgprot_t) { (x) } ) -#else /* !defined (STRICT_MM_TYPECHECKS) */ -/* - * .. while these make it easier on the compiler - */ -typedef unsigned long pte_t; -typedef unsigned long pmd_t; -typedef unsigned long pgd_t; -typedef unsigned long pgprot_t; - -#define pte_val(x) (x) -#define pmd_val(x) (x) -#define pgd_val(x) (x) -#define pgprot_val(x) (x) - -#define __pte(x) (x) -#define __pmd(x) (x) -#define __pgd(x) (x) -#define __pgprot(x) (x) - -#endif /* !defined (STRICT_MM_TYPECHECKS) */ - #endif /* _LANGUAGE_ASSEMBLY */ /* to align the pointer to the (next) page boundary */ @@ -84,4 +60,4 @@ typedef unsigned long pgprot_t; #endif /* defined (__KERNEL__) */ -#endif /* __ASM_MIPS_PAGE_H */ +#endif /* __ASM_PAGE_H */ diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index 1dc438914..66ffa79f2 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.24 1999/08/18 23:37:49 ralf Exp $ +/* $Id: pgtable.h,v 1.25 1999/10/09 00:01:43 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -32,7 +32,7 @@ extern void (*flush_cache_range)(struct mm_struct *mm, unsigned long start, unsigned long end); extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page); extern void (*flush_cache_sigtramp)(unsigned long addr); -extern void (*flush_page_to_ram)(unsigned long page); +extern void (*flush_page_to_ram)(struct page * page); #define flush_icache_range(start, end) flush_cache_all() /* TLB flushing: @@ -187,6 +187,13 @@ extern void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1, #if !defined (_LANGUAGE_ASSEMBLY) +#define pte_ERROR(e) \ + printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e)) +#define pmd_ERROR(e) \ + printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e)) +#define pgd_ERROR(e) \ + printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e)) + /* * BAD_PAGETABLE is used when we need a bogus page-table, while * BAD_PAGE is used for a bogus page. @@ -202,8 +209,8 @@ extern unsigned long zero_page_mask; #define BAD_PAGETABLE __bad_pagetable() #define BAD_PAGE __bad_page() -#define ZERO_PAGE(__vaddr) \ - (empty_zero_page + (((unsigned long)(__vaddr)) & zero_page_mask)) +#define ZERO_PAGE(vaddr) \ + (mem_map + MAP_NR(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))) /* number of bits that fit into a memory pointer */ #define BITS_PER_PTR (8*sizeof(unsigned long)) @@ -260,6 +267,8 @@ extern inline void pte_clear(pte_t *ptep) set_pte(ptep, __pte(0)); } +#define pte_pagenr(x) ((unsigned long)((pte_val(x) >> PAGE_SHIFT))) + /* * Empty pgd/pmd entries point to the invalid_pte_table. */ @@ -294,6 +303,16 @@ extern inline int pgd_bad(pgd_t pgd) { return 0; } extern inline int pgd_present(pgd_t pgd) { return 1; } extern inline void pgd_clear(pgd_t *pgdp) { } +/* + * Permanent address of a page. On MIPS64 we never have highmem, so this + * is simple. + * called on a highmem page. + */ +#define page_address(page) \ + (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) +#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) /* Unused? */ +#define pte_page(x) (mem_map+pte_pagenr(x)) + /* * The following only work if pte_present() is true. * Undefined behaviour if not.. @@ -363,9 +382,14 @@ extern inline pte_t pte_mkyoung(pte_t pte) * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ -extern inline pte_t mk_pte(unsigned long page, pgprot_t pgprot) +extern inline pte_t mk_pte(struct page * page, pgprot_t pgprot) { - return __pte(((page & PAGE_MASK) - PAGE_OFFSET) | pgprot_val(pgprot)); + pte_t __pte; + + pte_val(__pte) = ((unsigned long)(page - mem_map) << PAGE_SHIFT) | + pgprot_val(pgprot); + + return __pte; } extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) @@ -378,6 +402,9 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot)); } +#define page_pte_prot(page,prot) mk_pte(page, prot) +#define page_pte(page) page_pte_prot(page, __pgprot(0)) + /* to find an entry in a kernel page-table-directory */ #define pgd_offset_k(address) pgd_offset(&init_mm, address) @@ -591,12 +618,22 @@ extern pgd_t swapper_pg_dir[1024]; extern void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte); +/* + * Non-present pages: high 24 bits are offset, next 8 bits type, + * low 32 bits zero. + */ +extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) +{ + pte_t pte; pte_val(pte) = (type << 1) | (offset << 8); + return pte; +} + /* * Kernel with 32 bit address space */ -#define SWP_TYPE(entry) (((entry) >> 8) & 0x7f) -#define SWP_OFFSET(entry) ((entry) >> 15) -#define SWP_ENTRY(type,offset) (((type) << 8) | ((offset) << 15)) +#define SWP_TYPE(entry) ((pte_val(entry) >> 1) & 0x3f) +#define SWP_OFFSET(entry) (pte_val(entry) >> 8) +#define SWP_ENTRY(type,offset) mk_swap_pte((type),(offset)) #define module_map vmalloc #define module_unmap vfree -- cgit v1.2.3