1 /*
2  *   Creation Date: <2002/01/13 13:53:14 samuel>
3  *   Time-stamp: <2002/01/27 19:56:11 samuel>
4  *
5  *	<mmutypes.h>
6  *
7  *	MMU definitions
8  *
9  *   Most of these declarations originate from the Linux Kernel
10  *
11  *   Copyright (C) 2002 Samuel Rydh (samuel@ibrium.se)
12  *
13  *   This program is free software; you can redistribute it and/or
14  *   modify it under the terms of the GNU General Public License
15  *   as published by the Free Software Foundation
16  *
17  */
18 
19 #ifndef _H_MMUTYPES
20 #define _H_MMUTYPES
21 
22 /* Hardware Page Table Entry */
23 typedef struct mPTE {
24 	unsigned long v:1;	/* Entry is valid */
25 	unsigned long vsid:24;	/* Virtual segment identifier */
26 	unsigned long h:1;	/* Hash algorithm indicator */
27 	unsigned long api:6;	/* Abbreviated page index */
28 
29 	unsigned long rpn:20;	/* Real (physical) page number */
30 	unsigned long    :3;	/* Unused */
31 	unsigned long r:1;	/* Referenced */
32 	unsigned long c:1;	/* Changed */
33 	unsigned long w:1;	/* Write-thru cache mode */
34 	unsigned long i:1;	/* Cache inhibited */
35 	unsigned long m:1;	/* Memory coherence */
36 	unsigned long g:1;	/* Guarded */
37 	unsigned long  :1;	/* Unused */
38 	unsigned long pp:2;	/* Page protection */
39 } mPTE_t;
40 
41 typedef struct mPTE_64 {
42 	uint32_t avpn_low;	/* Abbreviated Virtual Page Number (unused) */
43 	uint32_t avpn:25;	/* Abbreviated Virtual Page Number */
44 	uint32_t sw:4;		/* Software Use */
45 	uint32_t  :1;		/* Reserved */
46 	uint32_t h:1;		/* Hash algorithm indicator */
47 	uint32_t v:1;		/* Entry is valid */
48 
49 	uint32_t rpn_low;	/* Real (physical) page number (unused) */
50 	uint32_t rpn:20;	/* Real (physical) page number */
51 	uint32_t    :2;		/* Reserved */
52 	uint32_t ac:1;		/* Address Compare*/
53 	uint32_t r:1;		/* Referenced */
54 	uint32_t c:1;		/* Changed */
55 	uint32_t w:1;		/* Write-thru cache mode */
56 	uint32_t i:1;		/* Cache inhibited */
57 	uint32_t m:1;		/* Memory coherence */
58 	uint32_t g:1;		/* Guarded */
59 	uint32_t n:1;		/* No-Execute */
60 	uint32_t pp:2;		/* Page protection */
61 } mPTE_64_t;
62 
63 typedef struct _mBATU {		/* Upper part of BAT (all except 601) */
64         unsigned long bepi:15;	/* Effective page index (virtual address) */
65         unsigned long :4;	/* Unused */
66         unsigned long bl:11;	/* Block size mask */
67         unsigned long vs:1;	/* Supervisor valid */
68         unsigned long vp:1;	/* User valid */
69 } mBATU;
70 
71 typedef struct _mBATL {		/* Lower part of BAT (all except 601) */
72         unsigned long brpn:15;	/* Real page index (physical address) */
73         unsigned long :10;	/* Unused */
74         unsigned long w:1;	/* Write-thru cache */
75         unsigned long i:1;	/* Cache inhibit */
76         unsigned long m:1;	/* Memory coherence */
77         unsigned long g:1;	/* Guarded (MBZ in IBAT) */
78         unsigned long :1;	/* Unused */
79         unsigned long pp:2;	/* Page access protections */
80 } mBATL;
81 
82 typedef struct _mBAT {
83         mBATU batu;		/* Upper register */
84         mBATL batl;		/* Lower register */
85 } mBAT;
86 
87 typedef struct _mSEGREG {
88         unsigned long t:1;      /* Normal or I/O  type */
89         unsigned long ks:1;     /* Supervisor 'key' (normally 0) */
90         unsigned long kp:1;     /* User 'key' (normally 1) */
91         unsigned long n:1;      /* No-execute */
92         unsigned long :4;       /* Unused */
93         unsigned long vsid:24;  /* Virtual Segment Identifier */
94 } mSEGREG;
95 
96 
97 #endif   /* _H_MMUTYPES */
98