The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/ppc/mem.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Memory and machine-specific definitions.  Used in C and assembler.
    3  */
    4 
    5 #ifdef ucuconf
    6 #include "ucu.h"
    7 #else
    8 #include "blast.h"
    9 #endif
   10 
   11 /*
   12  * Sizes
   13  */
   14 
   15 #define BI2BY           8                       /* bits per byte */
   16 #define BI2WD           32                      /* bits per word */
   17 #define BY2WD           4                       /* bytes per word */
   18 #define BY2V            8                       /* bytes per vlong */
   19 #define BY2PG           4096                    /* bytes per page */
   20 #define WD2PG           (BY2PG/BY2WD)           /* words per page */
   21 #define PGSHIFT         12                      /* log(BY2PG) */
   22 #define ROUND(s, sz)    (((s)+(sz-1))&~(sz-1))
   23 #define PGROUND(s)      ROUND(s, BY2PG)
   24 #define CACHELINELOG    5
   25 #define CACHELINESZ     (1<<CACHELINELOG)
   26 #define BLOCKALIGN      CACHELINESZ
   27 
   28 #define MHz             1000000
   29 
   30 #define BY2PTE          8                       /* bytes per pte entry */
   31 #define BY2PTEG         64                      /* bytes per pte group */
   32 
   33 #define MAXMACH 1                               /* max # cpus system can run */
   34 #define MACHSIZE        BY2PG
   35 #define KSTACK          4096                    /* Size of kernel stack */
   36 
   37 /*
   38  * Time
   39  */
   40 #define HZ              1000                    /* clock frequency */
   41 #define TK2SEC(t)       ((t)/HZ)                /* ticks to seconds */
   42 
   43 /*
   44  * Standard PPC Special Purpose Registers (OEA and VEA)
   45  */
   46 #define DSISR   18
   47 #define DAR     19              /* Data Address Register */
   48 #define DEC     22              /* Decrementer */
   49 #define SDR1    25
   50 #define SRR0    26              /* Saved Registers (exception) */
   51 #define SRR1    27
   52 #define TBRL    268
   53 #define TBRU    269             /* Time base Upper/Lower (Reading) */
   54 #define SPRG0   272             /* Supervisor Private Registers */
   55 #define SPRG1   273
   56 #define SPRG2   274
   57 #define SPRG3   275
   58 #define SPRG4   276
   59 #define SPRG5   277
   60 #define SPRG6   278
   61 #define SPRG7   279
   62 #define ASR     280             /* Address Space Register */
   63 #define EAR     282             /* External Access Register (optional) */
   64 #define TBWU    284             /* Time base Upper/Lower (Writing) */
   65 #define TBWL    285
   66 #define PVR     287             /* Processor Version */
   67 #define IABR    1010    /* Instruction Address Breakpoint Register (optional) */
   68 #define DABR    1013    /* Data Address Breakpoint Register (optional) */
   69 #define FPECR   1022    /* Floating-Point Exception Cause Register (optional) */
   70 #define PIR     1023    /* Processor Identification Register (optional) */
   71 
   72 #define IBATU(i)        (528+2*(i))     /* Instruction BAT register (upper) */
   73 #define IBATL(i)        (529+2*(i))     /* Instruction BAT register (lower) */
   74 #define DBATU(i)        (536+2*(i))     /* Data BAT register (upper) */
   75 #define DBATL(i)        (537+2*(i))     /* Data BAT register (lower) */
   76 
   77 /*
   78  * PPC604e-specific Special Purpose Registers (OEA)
   79  */
   80 #define MMCR0           952             /* Monitor Control Register 0 */
   81 #define PMC1            953             /* Performance Monitor Counter 1 */
   82 #define PMC2            954             /* Performance Monitor Counter 2 */
   83 #define SIA             955             /* Sampled Instruction Address */
   84 #define MMCR1           956             /* Monitor Control Register 0 */
   85 #define PMC3            957             /* Performance Monitor Counter 3 */
   86 #define PMC4            958             /* Performance Monitor Counter 4 */
   87 #define SDA             959             /* Sampled Data Address */
   88 /*
   89  * PPC603e-specific Special Purpose Registers
   90  */
   91 #define DMISS           976             /* Data Miss Address Register */
   92 #define DCMP            977             /* Data Miss Address Register */
   93 #define HASH1           978
   94 #define HASH2           979
   95 #define IMISS           980             /* Instruction Miss Address Register */
   96 #define iCMP            981             /* Instruction Miss Address Register */
   97 #define RPA             982
   98 #define HID0            1008    /* Hardware Implementation Dependent Register 0 */
   99 #define HID1            1009    /* Hardware Implementation Dependent Register 1 */
  100 /*
  101  * PowerQUICC II (MPC 8260) Special Purpose Registers
  102  */
  103 #define HID2            1011    /* Hardware Implementation Dependent Register 2 */
  104 
  105 #define BIT(i)          (1<<(31-(i)))   /* Silly backwards register bit numbering scheme */
  106 #define SBIT(n)         ((ushort)1<<(15-(n)))
  107 #define RBIT(b,n)       (1<<(8*sizeof(n)-1-(b)))
  108 
  109 /*
  110  * Bit encodings for Machine State Register (MSR)
  111  */
  112 #define MSR_POW         BIT(13)         /* Enable Power Management */
  113 #define MSR_TGPR        BIT(14)         /* Temporary GPR Registers in use (603e) */
  114 #define MSR_ILE         BIT(15)         /* Interrupt Little-Endian enable */
  115 #define MSR_EE          BIT(16)         /* External Interrupt enable */
  116 #define MSR_PR          BIT(17)         /* Supervisor/User privilege */
  117 #define MSR_FP          BIT(18)         /* Floating Point enable */
  118 #define MSR_ME          BIT(19)         /* Machine Check enable */
  119 #define MSR_FE0         BIT(20)         /* Floating Exception mode 0 */
  120 #define MSR_SE          BIT(21)         /* Single Step (optional) */
  121 #define MSR_BE          BIT(22)         /* Branch Trace (optional) */
  122 #define MSR_FE1         BIT(23)         /* Floating Exception mode 1 */
  123 #define MSR_IP          BIT(25)         /* Exception prefix 0x000/0xFFF */
  124 #define MSR_IR          BIT(26)         /* Instruction MMU enable */
  125 #define MSR_DR          BIT(27)         /* Data MMU enable */
  126 #define MSR_PM          BIT(29)         /* Performance Monitor marked mode (604e specific) */
  127 #define MSR_RI          BIT(30)         /* Recoverable Exception */
  128 #define MSR_LE          BIT(31)         /* Little-Endian enable */
  129 /* SRR1 bits for TLB operations */
  130 #define MSR_SR0         0xf0000000      /* Saved bits from CR register */
  131 #define MSR_KEY         BIT(12)         /* Copy of Ks or Kp bit */
  132 #define MSR_IMISS       BIT(13)         /* It was an I miss */
  133 #define MSR_WAY         BIT(14)         /* TLB set to be replaced */
  134 #define MSR_STORE       BIT(15)         /* Miss caused by a store */
  135 
  136 /*
  137  * Exception codes (trap vectors)
  138  */
  139 #define CRESET  0x01
  140 #define CMCHECK 0x02
  141 #define CDSI            0x03
  142 #define CISI            0x04
  143 #define CEI             0x05
  144 #define CALIGN          0x06
  145 #define CPROG           0x07
  146 #define CFPU            0x08
  147 #define CDEC            0x09
  148 #define CSYSCALL        0x0C
  149 #define CTRACE          0x0D    /* optional */
  150 #define CFPA            0x0E    /* not implemented in 603e */
  151 
  152 /* PPC603e-specific: */
  153 #define CIMISS          0x10    /* Instruction TLB miss */
  154 #define CLMISS          0x11    /* Data load TLB miss */
  155 #define CSMISS          0x12    /* Data store TLB miss */
  156 #define CIBREAK         0x13
  157 #define CSMI            0x14
  158 
  159 /*
  160  * Magic registers
  161  */
  162 
  163 #define MACH            30      /* R30 is m-> */
  164 #define USER            29      /* R29 is up-> */
  165 
  166 
  167 /*
  168  *  virtual MMU
  169  */
  170 #define PTEMAPMEM       (1024*1024)     
  171 #define PTEPERTAB       (PTEMAPMEM/BY2PG)
  172 #define SEGMAPSIZE      1984
  173 #define SSEGMAPSIZE     16
  174 #define PPN(x)          ((x)&~(BY2PG-1))
  175 
  176 /*
  177  *  First pte word
  178  */
  179 #define PTE0(v, vsid, h, va)    (((v)<<31)|((vsid)<<7)|((h)<<6)|(((va)>>22)&0x3f))
  180 
  181 /*
  182  *  Second pte word; WIMG & PP(RW/RO) common to page table and BATs
  183  */
  184 #define PTE1_R          BIT(23)
  185 #define PTE1_C          BIT(24)
  186 
  187 #define PTE1_W          BIT(25)
  188 #define PTE1_I          BIT(26)
  189 #define PTE1_M          BIT(27)
  190 #define PTE1_G          BIT(28)
  191 
  192 #define PTE1_RW         BIT(30)
  193 #define PTE1_RO         BIT(31)
  194 
  195 /* HID0 register bits */
  196 #define HID_ICE         BIT(16)
  197 #define HID_DCE         BIT(17)
  198 #define HID_ILOCK       BIT(18)
  199 #define HID_DLOCK       BIT(19)
  200 #define HID_ICFI        BIT(20)
  201 #define HID_DCFI        BIT(21)
  202 #define HID_IFEM        BIT(24)
  203 
  204 /*
  205  * Address spaces
  206  */
  207 
  208 #define KZERO           0x80000000              /* base of kernel address space */
  209 #define KTZERO          0x80100000              /* first address in kernel text */
  210 #define UZERO           0                       /* base of user address space */
  211 #define UTZERO          (UZERO+BY2PG)           /* first address in user text */
  212 #define USTKTOP         (TSTKTOP-TSTKSIZ*BY2PG) /* byte just beyond user stack */
  213 #define TSTKTOP         KZERO                   /* top of temporary stack */
  214 #define TSTKSIZ         100
  215 #define USTKSIZE        (4*1024*1024)           /* size of user stack */
  216 #define UREGSIZE        ((8+40)*4)
  217 #define MACHADDR        (KTZERO-MAXMACH*MACHSIZE)
  218 #define MACHPADDR       (MACHADDR&~KZERO)
  219 #define MACHP(n)        ((Mach *)(MACHADDR+(n)*MACHSIZE))
  220 
  221 #define isphys(x) (((ulong)x&KZERO)!=0)
  222 
  223 /*
  224  * MPC8xx addresses
  225  */
  226 #define INTMEM          0xf0000000
  227 #define IOMEM           (INTMEM+0x10000)
  228 
  229 #define getpgcolor(a)   0

Cache object: ef2d9e7c94ee023c330b6443ce80809a


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.