]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/zynq/dat.h
kernel: page counts a ulong, not usize
[plan9front.git] / sys / src / 9 / zynq / 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 L1       L1;
6 typedef struct Label    Label;
7 typedef struct Lock     Lock;
8 typedef struct KMap     KMap;
9 typedef struct MMMU     MMMU;
10 typedef struct Mach     Mach;
11 typedef struct Page     Page;
12 typedef struct Proc     Proc;
13 typedef struct PMMU     PMMU;
14 typedef struct Ureg     Ureg;
15 typedef struct ISAConf  ISAConf;
16 typedef uvlong          Tval;
17
18 #pragma incomplete Ureg
19
20 #define MAXSYSARG       5       /* for mount(fd, mpt, flag, arg, srv) */
21
22 #define AOUT_MAGIC      (E_MAGIC)
23
24 struct Lock
25 {
26         ulong   key;
27         u32int  sr;
28         uintptr pc;
29         Proc*   p;
30         Mach*   m;
31         int     isilock;
32 };
33
34 struct Label
35 {
36         uintptr sp;
37         uintptr pc;
38 };
39
40 struct FPsave
41 {
42         ulong   exc, scr;
43         uchar   regs[256];
44 };
45
46 struct PFPU
47 {
48         int     fpstate;
49         FPsave  fpsave[1];
50 };
51
52 enum
53 {
54         FPinit,
55         FPactive,
56         FPinactive,
57         FPillegal = 0x100
58 };
59
60 struct Confmem
61 {
62         uintptr base;
63         ulong   npage;
64         uintptr kbase;
65         uintptr klimit;
66 };
67
68 struct Conf
69 {
70         ulong   nmach;          /* processors */
71         ulong   nproc;          /* processes */
72         Confmem mem[2];         /* physical memory */
73         ulong   npage;          /* total physical pages of memory */
74         ulong   upages;         /* user page pool */
75         ulong   copymode;       /* 0 is copy on write, 1 is copy on reference */
76         ulong   ialloc;         /* max interrupt time allocation in bytes */
77         ulong   pipeqsize;      /* size in bytes of pipe queues */
78         ulong   nimage;         /* number of page cache image headers */
79         ulong   nswap;          /* number of swap pages */
80         int     nswppo;         /* max # of pageouts per segment pass */
81         int     monitor;
82 };
83
84 /*
85  *  MMU stuff in proc
86  */
87 #define NCOLOR  1
88
89 struct PMMU
90 {
91         L1 *l1;
92         Page *mmuused, *mmufree;
93         
94         int nkmap;
95         Page *kmaptable;
96 };
97
98 #include "../port/portdat.h"
99
100 struct L1
101 {
102         Ref;
103         uintptr pa;
104         ulong *va;
105         L1 *next;
106 };
107
108 struct MMMU
109 {
110         L1 l1;
111         L1 *l1free;
112         int nfree;
113         uchar asid;
114 };
115
116 struct Mach
117 {
118         int     machno;                 /* physical id of processor */
119         uintptr splpc;                  /* pc of last caller to splhi */
120         Proc*   proc;                   /* current process */
121         ulong   excregs[3];
122         ulong   cycleshi;
123         /* end of known to assembly */
124
125         MMMU;
126
127         PMach;
128
129         int     lastintr;
130
131         int     cpumhz;
132         uvlong  cpuhz;                  /* speed of cpu */
133
134         uintptr stack[1];
135 };
136
137 #define NISAOPT         8
138 struct ISAConf
139 {
140         char    *type;
141         ulong   port;
142         int     irq;
143         int     nopt;
144         char    *opt[NISAOPT];
145 };
146 #define BUSUNKNOWN -1
147
148 struct
149 {
150         char    machs[MAXMACH];         /* active CPUs */
151         int     exiting;                /* shutdown */
152 }active;
153
154 extern register Mach* m;                        /* R10 */
155 extern register Proc* up;                       /* R9 */
156
157 extern int normalprint;
158
159 extern ulong *mpcore, *slcr;
160
161 void nope(void);
162 #define NOPE nope();
163
164 /*
165  *  hardware info about a device
166  */
167 typedef struct {
168         ulong   port;
169         int     size;
170 } Devport;
171
172 struct DevConf
173 {
174         ulong   intnum;                 /* interrupt number */
175         char    *type;                  /* card type, malloced */
176         int     nports;                 /* Number of ports */
177         Devport *ports;                 /* The ports themselves */
178 };