root/include/asm-sparc/page.h

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

INCLUDED FROM


   1 /* $Id: page.h,v 1.26 1996/01/03 03:53:07 davem Exp $
   2  * page.h:  Various defines and such for MMU operations on the Sparc for
   3  *          the Linux kernel.
   4  *
   5  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
   6  */
   7 
   8 #ifndef _SPARC_PAGE_H
   9 #define _SPARC_PAGE_H
  10 
  11 #include <asm/head.h>       /* for KERNBASE */
  12 
  13 #define PAGE_SHIFT   12
  14 #define PAGE_OFFSET  KERNBASE
  15 #define PAGE_SIZE    (1 << PAGE_SHIFT)
  16 #define PAGE_MASK    (~(PAGE_SIZE-1))
  17 
  18 #ifdef __KERNEL__
  19 #ifndef __ASSEMBLY__
  20 
  21 /* The following structure is used to hold the physical
  22  * memory configuration of the machine.  This is filled in
  23  * probe_memory() and is later used by mem_init() to set up
  24  * mem_map[].  We statically allocate SPARC_PHYS_BANKS of
  25  * these structs, this is arbitrary.  The entry after the
  26  * last valid one has num_bytes==0.
  27  */
  28 
  29 struct sparc_phys_banks {
  30   unsigned long base_addr;
  31   unsigned long num_bytes;
  32 };
  33 
  34 #define SPARC_PHYS_BANKS 32
  35 
  36 extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];
  37 
  38 /* Cache alias structure.  Entry is valid if context != -1. */
  39 struct cache_palias {
  40         unsigned long vaddr;
  41         int context;
  42 };
  43 
  44 extern struct cache_palias *sparc_aliases;
  45 
  46 #define STRICT_MM_TYPECHECKS
  47 
  48 #ifdef STRICT_MM_TYPECHECKS
  49 /*
  50  * These are used to make use of C type-checking..
  51  */
  52 typedef struct { unsigned long pte; } pte_t;
  53 typedef struct { unsigned long iopte; } iopte_t;
  54 typedef struct { unsigned long pmd; } pmd_t;
  55 typedef struct { unsigned long pgd; } pgd_t;
  56 typedef struct { unsigned long ctxd; } ctxd_t;
  57 typedef struct { unsigned long pgprot; } pgprot_t;
  58 typedef struct { unsigned long iopgprot; } iopgprot_t;
  59 
  60 #define pte_val(x)      ((x).pte)
  61 #define iopte_val(x)    ((x).iopte)
  62 #define pmd_val(x)      ((x).pmd)
  63 #define pgd_val(x)      ((x).pgd)
  64 #define ctxd_val(x)     ((x).ctxd)
  65 #define pgprot_val(x)   ((x).pgprot)
  66 #define iopgprot_val(x) ((x).iopgprot)
  67 
  68 #define __pte(x)        ((pte_t) { (x) } )
  69 #define __iopte(x)      ((iopte_t) { (x) } )
  70 #define __pmd(x)        ((pmd_t) { (x) } )
  71 #define __pgd(x)        ((pgd_t) { (x) } )
  72 #define __ctxd(x)       ((ctxd_t) { (x) } )
  73 #define __pgprot(x)     ((pgprot_t) { (x) } )
  74 #define __iopgprot(x)   ((iopgprot_t) { (x) } )
  75 
  76 #else
  77 /*
  78  * .. while these make it easier on the compiler
  79  */
  80 typedef unsigned long pte_t;
  81 typedef unsigned long iopte_t;
  82 typedef unsigned long pmd_t;
  83 typedef unsigned long pgd_t;
  84 typedef unsigned long ctxd_t;
  85 typedef unsigned long pgprot_t;
  86 typedef unsigned long iopgprot_t;
  87 
  88 #define pte_val(x)      (x)
  89 #define iopte_val(x)    (x)
  90 #define pmd_val(x)      (x)
  91 #define pgd_val(x)      (x)
  92 #define ctxd_val(x)     (x)
  93 #define pgprot_val(x)   (x)
  94 #define iopgprot_val(x) (x)
  95 
  96 #define __pte(x)        (x)
  97 #define __iopte(x)      (x)
  98 #define __pmd(x)        (x)
  99 #define __pgd(x)        (x)
 100 #define __ctxd(x)       (x)
 101 #define __pgprot(x)     (x)
 102 #define __iopgprot(x)   (x)
 103 
 104 #endif
 105 
 106 /* to align the pointer to the (next) page boundary */
 107 #define PAGE_ALIGN(addr)  (((addr)+PAGE_SIZE-1)&PAGE_MASK)
 108 
 109 /* We now put the free page pool mapped contiguously in high memory above
 110  * the kernel.
 111  */
 112 #define MAP_NR(addr) ((((unsigned long) (addr)) - PAGE_OFFSET) >> PAGE_SHIFT)
 113 
 114 #endif /* !(__ASSEMBLY__) */
 115 
 116 #endif /* __KERNEL__ */
 117 
 118 #endif /* _SPARC_PAGE_H */

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