patch-2.3.35 linux/include/asm-sparc/pgtable.h
Next file: linux/include/asm-sparc/poll.h
Previous file: linux/include/asm-sparc/pcic.h
Back to the patch index
Back to the overall index
- Lines: 198
- Date:
Mon Dec 20 22:05:52 1999
- Orig file:
v2.3.34/linux/include/asm-sparc/pgtable.h
- Orig date:
Fri Sep 10 23:57:37 1999
diff -u --recursive --new-file v2.3.34/linux/include/asm-sparc/pgtable.h linux/include/asm-sparc/pgtable.h
@@ -1,4 +1,4 @@
-/* $Id: pgtable.h,v 1.82 1999/09/10 10:44:21 davem Exp $ */
+/* $Id: pgtable.h,v 1.86 1999/12/16 14:41:19 anton Exp $ */
#ifndef _SPARC_PGTABLE_H
#define _SPARC_PGTABLE_H
@@ -32,10 +32,6 @@
#define quick_kernel_fault(addr) BTFIXUP_CALL(quick_kernel_fault)(addr)
-/* Allocate a block of RAM which is aligned to its size.
- This procedure can be used until the call to mem_init(). */
-extern void *sparc_init_alloc(unsigned long *kbrk, unsigned long size);
-
/* Routines for data transfer buffers. */
BTFIXUPDEF_CALL(char *, mmu_lockarea, char *, unsigned long)
BTFIXUPDEF_CALL(void, mmu_unlockarea, char *, unsigned long)
@@ -43,25 +39,27 @@
#define mmu_lockarea(vaddr,len) BTFIXUP_CALL(mmu_lockarea)(vaddr,len)
#define mmu_unlockarea(vaddr,len) BTFIXUP_CALL(mmu_unlockarea)(vaddr,len)
-/* Routines for getting a dvma scsi buffer. */
-struct mmu_sglist {
- char *addr;
- char *__dont_touch;
- unsigned int len;
- __u32 dvma_addr;
-};
-BTFIXUPDEF_CALL(__u32, mmu_get_scsi_one, char *, unsigned long, struct linux_sbus *sbus)
-BTFIXUPDEF_CALL(void, mmu_get_scsi_sgl, struct mmu_sglist *, int, struct linux_sbus *sbus)
-BTFIXUPDEF_CALL(void, mmu_release_scsi_one, __u32, unsigned long, struct linux_sbus *sbus)
-BTFIXUPDEF_CALL(void, mmu_release_scsi_sgl, struct mmu_sglist *, int, struct linux_sbus *sbus)
-BTFIXUPDEF_CALL(void, mmu_map_dma_area, unsigned long addr, int len)
+/* These are implementations for sbus_map_sg/sbus_unmap_sg... collapse later */
+BTFIXUPDEF_CALL(__u32, mmu_get_scsi_one, char *, unsigned long, struct sbus_bus *sbus)
+BTFIXUPDEF_CALL(void, mmu_get_scsi_sgl, struct scatterlist *, int, struct sbus_bus *sbus)
+BTFIXUPDEF_CALL(void, mmu_release_scsi_one, __u32, unsigned long, struct sbus_bus *sbus)
+BTFIXUPDEF_CALL(void, mmu_release_scsi_sgl, struct scatterlist *, int, struct sbus_bus *sbus)
#define mmu_get_scsi_one(vaddr,len,sbus) BTFIXUP_CALL(mmu_get_scsi_one)(vaddr,len,sbus)
#define mmu_get_scsi_sgl(sg,sz,sbus) BTFIXUP_CALL(mmu_get_scsi_sgl)(sg,sz,sbus)
#define mmu_release_scsi_one(vaddr,len,sbus) BTFIXUP_CALL(mmu_release_scsi_one)(vaddr,len,sbus)
#define mmu_release_scsi_sgl(sg,sz,sbus) BTFIXUP_CALL(mmu_release_scsi_sgl)(sg,sz,sbus)
-#define mmu_map_dma_area(addr,len) BTFIXUP_CALL(mmu_map_dma_area)(addr,len)
+/* mmu_map/unmap is provided by iommu/iounit; mmu_flush/inval probably belongs to CPU... */
+BTFIXUPDEF_CALL(void, mmu_map_dma_area, unsigned long va, __u32 addr, int len)
+BTFIXUPDEF_CALL(void, mmu_unmap_dma_area, unsigned long addr, int len)
+BTFIXUPDEF_CALL(void, mmu_inval_dma_area, unsigned long addr, int len)
+BTFIXUPDEF_CALL(void, mmu_flush_dma_area, unsigned long addr, int len)
+
+#define mmu_map_dma_area(va, ba,len) BTFIXUP_CALL(mmu_map_dma_area)(va,ba,len)
+#define mmu_unmap_dma_area(ba,len) BTFIXUP_CALL(mmu_unmap_dma_area)(ba,len)
+#define mmu_inval_dma_area(va,len) BTFIXUP_CALL(mmu_unmap_dma_area)(va,len)
+#define mmu_flush_dma_area(va,len) BTFIXUP_CALL(mmu_unmap_dma_area)(va,len)
BTFIXUPDEF_SIMM13(pmd_shift)
BTFIXUPDEF_SETHI(pmd_size)
@@ -93,6 +91,10 @@
#define VMALLOC_START (0xfe300000)
#define VMALLOC_END ~0x0UL
+#define pte_ERROR(e) __builtin_trap()
+#define pmd_ERROR(e) __builtin_trap()
+#define pgd_ERROR(e) __builtin_trap()
+
BTFIXUPDEF_INT(page_none)
BTFIXUPDEF_INT(page_shared)
BTFIXUPDEF_INT(page_copy)
@@ -163,6 +165,12 @@
extern int num_contexts;
+/* First physical page can be anywhere, the following is needed so that
+ * va-->pa and vice versa conversions work properly without performance
+ * hit for all __pa()/__va() operations.
+ */
+extern unsigned long phys_base;
+
/*
* BAD_PAGETABLE is used when we need a bogus page-table, while
* BAD_PAGE is used for a bogus page.
@@ -170,14 +178,13 @@
* ZERO_PAGE is a global shared page that is always zero: used
* for zero-mapped memory areas etc..
*/
-extern pte_t __bad_page(void);
extern pte_t * __bad_pagetable(void);
-
+extern pte_t __bad_page(void);
extern unsigned long empty_zero_page;
#define BAD_PAGETABLE __bad_pagetable()
#define BAD_PAGE __bad_page()
-#define ZERO_PAGE(vaddr) ((unsigned long)(&(empty_zero_page)))
+#define ZERO_PAGE(vaddr) (mem_map + (((unsigned long)&empty_zero_page - PAGE_OFFSET + phys_base) >> PAGE_SHIFT))
/* number of bits that fit into a memory pointer */
#define BITS_PER_PTR (8*sizeof(unsigned long))
@@ -187,22 +194,14 @@
#define SIZEOF_PTR_LOG2 2
-BTFIXUPDEF_CALL_CONST(unsigned long, pte_page, pte_t)
+BTFIXUPDEF_CALL_CONST(unsigned long, pte_pagenr, pte_t)
BTFIXUPDEF_CALL_CONST(unsigned long, pmd_page, pmd_t)
BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page, pgd_t)
-#define pte_page(pte) BTFIXUP_CALL(pte_page)(pte)
+#define pte_pagenr(pte) BTFIXUP_CALL(pte_pagenr)(pte)
#define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd)
#define pgd_page(pgd) BTFIXUP_CALL(pgd_page)(pgd)
-BTFIXUPDEF_CALL(void, sparc_update_rootmmu_dir, struct task_struct *, pgd_t *pgdir)
-
-#define SET_PAGE_DIR(tsk,pgdir) BTFIXUP_CALL(sparc_update_rootmmu_dir)(tsk, pgdir)
-
-/* to find an entry in a page-table */
-#define PAGE_PTR(address) \
-((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
-
BTFIXUPDEF_SETHI(none_mask)
BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t)
BTFIXUPDEF_CALL(void, pte_clear, pte_t *)
@@ -294,11 +293,19 @@
#define pte_mkdirty(pte) BTFIXUP_CALL(pte_mkdirty)(pte)
#define pte_mkyoung(pte) BTFIXUP_CALL(pte_mkyoung)(pte)
+#define page_pte_prot(page, prot) mk_pte(page, prot)
+#define page_pte(page) page_pte_prot(page, __pgprot(0))
+
+/* Permanent address of a page. */
+#define page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT))
+#define pte_page(x) (mem_map+pte_pagenr(x))
+
/*
* Conversion functions: convert a page and protection to a page entry,
* and a page entry and page directory to the page they refer to.
*/
-BTFIXUPDEF_CALL_CONST(pte_t, mk_pte, unsigned long, pgprot_t)
+BTFIXUPDEF_CALL_CONST(pte_t, mk_pte, struct page *, pgprot_t)
+
BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_phys, unsigned long, pgprot_t)
BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_io, unsigned long, pgprot_t, int)
@@ -428,10 +435,10 @@
#define local_flush_tlb_range(mm,start,end) BTFIXUP_CALL(local_flush_tlb_range)(mm,start,end)
#define local_flush_tlb_page(vma,addr) BTFIXUP_CALL(local_flush_tlb_page)(vma,addr)
-BTFIXUPDEF_CALL(void, local_flush_page_to_ram, unsigned long)
+BTFIXUPDEF_CALL(void, local_flush_page_to_ram, struct page *)
BTFIXUPDEF_CALL(void, local_flush_sig_insns, struct mm_struct *, unsigned long)
-#define local_flush_page_to_ram(addr) BTFIXUP_CALL(local_flush_page_to_ram)(addr)
+#define local_flush_page_to_ram(page) BTFIXUP_CALL(local_flush_page_to_ram)(page)
#define local_flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(local_flush_sig_insns)(mm,insn_addr)
extern void smp_flush_cache_all(void);
@@ -447,7 +454,7 @@
unsigned long start,
unsigned long end);
extern void smp_flush_tlb_page(struct vm_area_struct *mm, unsigned long page);
-extern void smp_flush_page_to_ram(unsigned long page);
+extern void smp_flush_page_to_ram(struct page *page);
extern void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr);
#endif
@@ -472,20 +479,15 @@
#define flush_tlb_range(mm,start,end) BTFIXUP_CALL(flush_tlb_range)(mm,start,end)
#define flush_tlb_page(vma,addr) BTFIXUP_CALL(flush_tlb_page)(vma,addr)
-BTFIXUPDEF_CALL(void, flush_page_to_ram, unsigned long)
+BTFIXUPDEF_CALL(void, flush_page_to_ram, struct page *)
BTFIXUPDEF_CALL(void, flush_sig_insns, struct mm_struct *, unsigned long)
-#define flush_page_to_ram(addr) BTFIXUP_CALL(flush_page_to_ram)(addr)
+#define flush_page_to_ram(page) BTFIXUP_CALL(flush_page_to_ram)(page)
#define flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(flush_sig_insns)(mm,insn_addr)
/* The permissions for pgprot_val to make a page mapped on the obio space */
extern unsigned int pg_iobits;
-/* MMU context switching. */
-BTFIXUPDEF_CALL(void, switch_to_context, struct task_struct *)
-
-#define switch_to_context(tsk) BTFIXUP_CALL(switch_to_context)(tsk)
-
/* Certain architectures need to do special things when pte's
* within a page table are directly modified. Thus, the following
* hook is made available.
@@ -577,7 +579,6 @@
extern unsigned long *sparc_valid_addr_bitmap;
/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
-#define PageSkip(page) (test_bit(PG_skip, &(page)->flags))
#define kern_addr_valid(addr) (test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap))
#endif /* !(_SPARC_PGTABLE_H) */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)