]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/cycv/dat.h
add cycv ethernet driver
[plan9front.git] / sys / src / 9 / cycv / 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         usize   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         usize   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         /* known to assembly */
119         int     machno;                 /* physical id of processor */
120         uintptr splpc;                  /* pc of last caller to splhi */
121         Proc*   proc;                   /* current process */
122         ulong   excregs[3];
123         ulong   cycleshi;
124         /* end of known to assembly */
125
126         int     flushmmu;               /* flush current proc mmu state */
127
128         ulong   ticks;                  /* of the clock since boot time */
129         Label   sched;                  /* scheduler wakeup */
130         Lock    alarmlock;              /* access to alarm list */
131         void*   alarm;                  /* alarms bound to this clock */
132         int     inclockintr;
133
134         Proc*   readied;                /* for runproc */
135         ulong   schedticks;             /* next forced context switch */
136
137         ulong   delayloop;
138
139         /* stats */
140         int     tlbfault;
141         int     tlbpurge;
142         int     pfault;
143         int     cs;
144         int     syscall;
145         int     load;
146         int     intr;
147         int     lastintr;
148         int     ilockdepth;
149         Perf    perf;                   /* performance counters */
150
151
152         int     cpumhz;
153         uvlong  cpuhz;                  /* speed of cpu */
154         uvlong  cyclefreq;              /* Frequency of user readable cycle counter */
155         
156         MMMU;
157
158         int     stack[1];
159 };
160
161 #define NISAOPT         8
162 struct ISAConf
163 {
164         char    *type;
165         ulong   port;
166         int     irq;
167         int     nopt;
168         char    *opt[NISAOPT];
169 };
170 #define BUSUNKNOWN -1
171
172 struct
173 {
174         char    machs[MAXMACH];         /* active CPUs */
175         int     exiting;                /* shutdown */
176 }active;
177
178 extern register Mach* m;                        /* R10 */
179 extern register Proc* up;                       /* R9 */
180
181 extern int normalprint;
182
183 void nope(void);
184 #define NOPE nope();
185
186 /*
187  *  hardware info about a device
188  */
189 typedef struct {
190         ulong   port;
191         int     size;
192 } Devport;
193
194 struct DevConf
195 {
196         ulong   intnum;                 /* interrupt number */
197         char    *type;                  /* card type, malloced */
198         int     nports;                 /* Number of ports */
199         Devport *ports;                 /* The ports themselves */
200 };
201
202 #define mpcore ((ulong*)MPCORE_BASE)
203 #define resetmgr ((ulong*)RESETMGR_BASE)
204 #define sysmgr ((ulong*)SYSMGR_BASE)