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