]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/ppc/dat.h
f92367764ba488944818a5fc2c66451820168b22
[plan9front.git] / sys / src / 9 / ppc / dat.h
1 typedef struct Conf     Conf;
2 typedef struct FPsave   FPsave;
3 typedef struct ISAConf  ISAConf;
4 typedef struct Imap     Imap;
5 typedef struct Label    Label;
6 typedef struct Lock     Lock;
7 typedef struct Mach     Mach;
8 typedef struct Notsave  Notsave;
9 typedef struct PCArch   PCArch;
10 typedef struct PMMU     PMMU;
11 typedef struct Page     Page;
12 typedef struct Pcidev   Pcidev;
13 typedef struct Proc     Proc;
14 typedef struct Sys      Sys;
15 typedef struct Ureg     Ureg;
16 typedef struct Vctl     Vctl;
17
18 #pragma incomplete Ureg
19 #pragma incomplete Imap
20
21 #define MAXSYSARG       5       /* for mount(fd, mpt, flag, arg, srv) */
22
23 /*
24  *  parameters for sysproc.c
25  */
26 #define AOUT_MAGIC      Q_MAGIC
27
28 /*
29  *  machine dependent definitions used by ../port/dat.h
30  */
31
32 struct Lock
33 {
34         ulong   key;                    /* semaphore (non-zero = locked) */
35         ulong   sr;
36         ulong   pc;
37         Proc    *p;
38         ulong   pid;
39         ushort  isilock;
40 };
41
42 struct Label
43 {
44         ulong   sp;
45         ulong   pc;
46 };
47
48 /*
49  * Proc.fpstate
50  */
51 enum
52 {
53         /* Floating point states */
54         FPinit = 0,
55         FPactive = 1,
56         FPinactive = 2,
57         /* Bit that's or-ed in during note handling (FP is illegal in note handlers) */
58         FPillegal = 0x100,
59 };
60
61 /*
62  * This structure must agree with fpsave and fprestore asm routines
63  */
64 struct FPsave
65 {
66         double  fpreg[32];
67         union {
68                 double  fpscrd;
69                 struct {
70                         ulong   pad;
71                         ulong   fpscr;
72                 };
73         };
74 };
75
76 struct Conf
77 {
78         ulong   nmach;          /* processors */
79         ulong   nproc;          /* processes */
80         ulong   npage0;         /* total physical pages of memory */
81         ulong   npage1;         /* total physical pages of memory */
82         ulong   npage;          /* total physical pages of memory */
83         ulong   base0;          /* base of bank 0 */
84         ulong   base1;          /* base of bank 1 */
85         ulong   upages;         /* user page pool */
86         ulong   nimage;         /* number of page cache image headers */
87         ulong   nswap;          /* number of swap pages */
88         int     nswppo;         /* max # of pageouts per segment pass */
89         ulong   copymode;       /* 0 is copy on write, 1 is copy on reference */
90         int     monitor;        /* has display? */
91         ulong   ialloc;         /* bytes available for interrupt time allocation */
92         ulong   pipeqsize;      /* size in bytes of pipe queues */
93 };
94
95 /*
96  *  mmu goo in the Proc structure
97  */
98 #define NCOLOR 1
99 struct PMMU
100 {
101         int     mmupid;
102         Ureg    *mmureg;                /* pointer to ureg structure */
103 };
104
105 /*
106  *  things saved in the Proc structure during a notify
107  */
108 struct Notsave
109 {
110         ulong   UNUSED;
111 };
112
113 #include "../port/portdat.h"
114
115 /*
116  *  machine dependent definitions not used by ../port/dat.h
117  */
118 /*
119  * Fake kmap
120  */
121 typedef void            KMap;
122 #define VA(k)           ((ulong)(k))
123 #define kmap(p)         (KMap*)((p)->pa|KZERO)
124 #define kunmap(k)
125
126 struct Mach
127 {
128         /* OFFSETS OF THE FOLLOWING KNOWN BY l.s */
129 /*0x00*/        int     machno; /* physical id of processor */
130 /*0x04*/        ulong   splpc;  /* pc that called splhi() */
131 /*0x08*/        Proc    *proc;  /* current process on this processor */
132         /* Debugging/statistics for software TLB in l.s (therefore, also known by l.s) */
133 /*0x0c*/        ulong   tlbfault;       /* type of last miss */
134 /*0x10*/        ulong   imiss;  /* number of instruction misses */
135 /*0x14*/        ulong   dmiss;  /* number of data misses */
136
137         /* ordering from here on irrelevant */
138
139         Imap*   imap;
140
141         ulong   ticks;          /* of the clock since boot time */
142         Label   sched;          /* scheduler wakeup */
143         Lock    alarmlock;      /* access to alarm list */
144         void    *alarm;         /* alarms bound to this clock */
145         int     inclockintr;
146         int     cputype;
147         ulong   loopconst;
148         Perf    perf;           /* performance counters */
149
150         Proc*   readied;        /* for runproc */
151         ulong   schedticks;     /* next forced context switch */
152
153         ulong   clkin;          /* basic clock frequency */
154         ulong   vco_out;
155         vlong   cpuhz;
156         uvlong  cyclefreq;      /* Frequency of user readable cycle counter */
157         ulong   bushz;
158         ulong   dechz;
159         ulong   tbhz;
160         ulong   cpmhz;          /* communications processor module frequency */
161         ulong   brghz;          /* baud rate generator frequency */
162
163         ulong   pcclast;
164         uvlong  fastclock;
165
166         int     tlbpurge;       /* # of tlb purges */
167         int     pfault;         /* # of page faults */
168         int     cs;
169         int     syscall;
170         int     load;
171         int     intr;
172         int     flushmmu;       /* make current proc flush it's mmu state */
173         int     ilockdepth;
174
175         ulong   ptabbase;       /* start of page table in kernel virtual space */
176         int     slotgen;        /* next pte (byte offset) when pteg is full */
177         int     mmupid;         /* next mmu pid to use */
178         int     sweepcolor;
179         int     trigcolor;
180         Rendez  sweepr;
181
182         ulong   spuriousintr;
183         int     lastintr;
184
185         /* MUST BE LAST */
186         int     stack[1];
187 };
188
189 struct
190 {
191         Lock;
192         short   machs;
193         short   exiting;
194         short   ispanic;
195 }active;
196
197 /*
198  *  a parsed plan9.ini line
199  */
200 #define NISAOPT         8
201
202 struct ISAConf {
203         char    *type;
204         ulong   port;
205         int     irq;
206         ulong   dma;
207         ulong   mem;
208         ulong   size;
209         ulong   freq;
210
211         int     nopt;
212         char    *opt[NISAOPT];
213 };
214
215 struct Vctl {
216         Vctl*   next;           /* handlers on this vector */
217
218         char    name[KNAMELEN]; /* of driver */
219         int     isintr;         /* interrupt or fault/trap */
220         int     irq;
221
222         void    (*f)(Ureg*, void*);     /* handler to call */
223         void*   a;              /* argument to call it with */
224 };
225
226 extern Mach mach0;
227
228 extern register Mach *m;
229 extern register Proc *up;
230
231 extern FPsave initfp;