root/include/asm-sparc/pgtsun4c.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. sun4c_get_synchronous_error
  2. sun4c_get_synchronous_address
  3. sun4c_get_segmap
  4. sun4c_put_segmap
  5. sun4c_get_pte
  6. sun4c_put_pte
  7. sun4c_get_context
  8. sun4c_set_context

   1 /* $Id: pgtsun4c.h,v 1.22 1996/01/24 02:33:45 davem Exp $
   2  * pgtsun4c.h:  Sun4c specific pgtable.h defines and code.
   3  *
   4  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
   5  */
   6 #ifndef _SPARC_PGTSUN4C_H
   7 #define _SPARC_PGTSUN4C_H
   8 
   9 /* PMD_SHIFT determines the size of the area a second-level page table can map */
  10 #define SUN4C_PMD_SHIFT       22
  11 #define SUN4C_PMD_SIZE        (1UL << SUN4C_PMD_SHIFT)
  12 #define SUN4C_PMD_MASK        (~(SUN4C_PMD_SIZE-1))
  13 #define SUN4C_PMD_ALIGN(addr) (((addr)+SUN4C_PMD_SIZE-1)&SUN4C_PMD_MASK)
  14 
  15 /* PGDIR_SHIFT determines what a third-level page table entry can map */
  16 #define SUN4C_PGDIR_SHIFT       22
  17 #define SUN4C_PGDIR_SIZE        (1UL << SUN4C_PGDIR_SHIFT)
  18 #define SUN4C_PGDIR_MASK        (~(SUN4C_PGDIR_SIZE-1))
  19 #define SUN4C_PGDIR_ALIGN(addr) (((addr)+SUN4C_PGDIR_SIZE-1)&SUN4C_PGDIR_MASK)
  20 
  21 /* To represent how the sun4c mmu really lays things out. */
  22 #define SUN4C_REAL_PGDIR_SHIFT       18
  23 #define SUN4C_REAL_PGDIR_SIZE        (1UL << SUN4C_REAL_PGDIR_SHIFT)
  24 #define SUN4C_REAL_PGDIR_MASK        (~(SUN4C_REAL_PGDIR_SIZE-1))
  25 #define SUN4C_REAL_PGDIR_ALIGN(addr) (((addr)+SUN4C_REAL_PGDIR_SIZE-1)&SUN4C_REAL_PGDIR_MASK)
  26 
  27 /*
  28  * To be efficient, and not have to worry about allocating such
  29  * a huge pgd, we make the kernel sun4c tables each hold 1024
  30  * entries and the pgd similarly just like the i386 tables.
  31  */
  32 #define SUN4C_PTRS_PER_PTE    1024
  33 #define SUN4C_PTRS_PER_PMD    1
  34 #define SUN4C_PTRS_PER_PGD    1024
  35 
  36 /* On the sun4c the physical ram limit is 128MB.  We set up our I/O
  37  * translations at KERNBASE + 128MB for 1MB, then we begin the VMALLOC
  38  * area, makes sense.  This works out to the value below.
  39  */
  40 #define SUN4C_VMALLOC_START   (0xfe100000)
  41 
  42 /*
  43  * Sparc SUN4C pte fields.
  44  */
  45 #define _SUN4C_PAGE_VALID     0x80000000   /* valid page */
  46 #define _SUN4C_PAGE_WRITE     0x40000000   /* can be written to */
  47 #define _SUN4C_PAGE_PRIV      0x20000000   /* bit to signify privileged page */
  48 #define _SUN4C_PAGE_USER      0x00000000   /* User page */
  49 #define _SUN4C_PAGE_NOCACHE   0x10000000   /* non-cacheable page */
  50 #define _SUN4C_PAGE_IO        0x04000000   /* I/O page */
  51 #define _SUN4C_PAGE_REF       0x02000000   /* Page has been accessed/referenced */
  52 #define _SUN4C_PAGE_DIRTY     0x01000000   /* Page has been modified, is dirty */
  53 
  54 #define _SUN4C_PAGE_CHG_MASK  (0xffff | _SUN4C_PAGE_REF | _SUN4C_PAGE_DIRTY)
  55 
  56 #define SUN4C_PAGE_NONE     __pgprot(_SUN4C_PAGE_VALID | _SUN4C_PAGE_PRIV | \
  57                                      _SUN4C_PAGE_REF)
  58 #define SUN4C_PAGE_SHARED   __pgprot(_SUN4C_PAGE_VALID | _SUN4C_PAGE_WRITE | \
  59                                      _SUN4C_PAGE_USER | _SUN4C_PAGE_REF)
  60 #define SUN4C_PAGE_COPY     __pgprot(_SUN4C_PAGE_VALID | _SUN4C_PAGE_USER | \
  61                                      _SUN4C_PAGE_REF)
  62 #define SUN4C_PAGE_READONLY __pgprot(_SUN4C_PAGE_VALID | _SUN4C_PAGE_USER | \
  63                                      _SUN4C_PAGE_REF)
  64 #define SUN4C_PAGE_KERNEL   __pgprot(_SUN4C_PAGE_VALID | _SUN4C_PAGE_WRITE | \
  65                                      _SUN4C_PAGE_PRIV | _SUN4C_PAGE_DIRTY | \
  66                                      _SUN4C_PAGE_REF | _SUN4C_PAGE_NOCACHE)
  67 
  68 extern char *sun4c_lockarea(char *vaddr, unsigned long size);
  69 extern void sun4c_unlockarea(char *vaddr, unsigned long size);
  70 
  71 extern __inline__ unsigned long sun4c_get_synchronous_error(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  72 {
  73         unsigned long sync_err;
  74 
  75         __asm__ __volatile__("lda [%1] %2, %0\n\t" :
  76                              "=r" (sync_err) :
  77                              "r" (AC_SYNC_ERR), "i" (ASI_CONTROL));
  78         return sync_err;
  79 }
  80 
  81 extern __inline__ unsigned long sun4c_get_synchronous_address(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  82 {
  83         unsigned long sync_addr;
  84 
  85         __asm__ __volatile__("lda [%1] %2, %0\n\t" :
  86                              "=r" (sync_addr) :
  87                              "r" (AC_SYNC_VA), "i" (ASI_CONTROL));
  88         return sync_addr;
  89 }
  90 
  91 /* SUN4C pte, segmap, and context manipulation */
  92 extern __inline__ unsigned long sun4c_get_segmap(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  93 {
  94   register unsigned long entry;
  95 
  96   __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" : 
  97                        "=r" (entry) :
  98                        "r" (addr), "i" (ASI_SEGMAP));
  99 
 100   return entry;
 101 }
 102 
 103 extern __inline__ void sun4c_put_segmap(unsigned long addr, unsigned long entry)
     /* [previous][next][first][last][top][bottom][index][help] */
 104 {
 105 
 106   __asm__ __volatile__("\n\tstba %1, [%0] %2\n\t" : :
 107                        "r" (addr), "r" (entry),
 108                        "i" (ASI_SEGMAP));
 109 
 110   return;
 111 }
 112 
 113 extern __inline__ unsigned long sun4c_get_pte(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 114 {
 115   register unsigned long entry;
 116 
 117   __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" : 
 118                        "=r" (entry) :
 119                        "r" (addr), "i" (ASI_PTE));
 120   return entry;
 121 }
 122 
 123 extern __inline__ void sun4c_put_pte(unsigned long addr, unsigned long entry)
     /* [previous][next][first][last][top][bottom][index][help] */
 124 {
 125   __asm__ __volatile__("\n\tsta %1, [%0] %2\n\t" : :
 126                        "r" (addr), 
 127                        "r" (entry), "i" (ASI_PTE));
 128 
 129   return;
 130 }
 131 
 132 extern __inline__ int sun4c_get_context(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 133 {
 134   register int ctx;
 135 
 136   __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" :
 137                        "=r" (ctx) :
 138                        "r" (AC_CONTEXT), "i" (ASI_CONTROL));
 139 
 140   return ctx;
 141 }
 142 
 143 extern __inline__ int sun4c_set_context(int ctx)
     /* [previous][next][first][last][top][bottom][index][help] */
 144 {
 145   __asm__ __volatile__("\n\tstba %0, [%1] %2\n\t" : :
 146                        "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL));
 147 
 148   return ctx;
 149 }
 150 
 151 #endif /* !(_SPARC_PGTSUN4C_H) */

/* [previous][next][first][last][top][bottom][index][help] */