]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/sgi/dat.h
usbehci: catch interrupt in tsleep
[plan9front.git] / sys / src / 9 / sgi / 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 KMap     KMap;
6 typedef struct Lance    Lance;
7 typedef struct Lancemem Lancemem;
8 typedef struct Label    Label;
9 typedef struct Lock     Lock;
10 typedef struct Mach     Mach;
11 typedef struct MMU      MMU;
12 typedef struct PMMU     PMMU;
13 typedef struct Softtlb  Softtlb;
14 typedef struct Ureg     Ureg;
15 typedef struct Proc     Proc;
16 typedef struct ISAConf  ISAConf;
17 typedef uvlong          Tval;
18
19 #define MAXSYSARG       5       /* for mount(fd, afd, mpt, flag, arg) */
20
21 /*
22  *  parameters for sysproc.c and rebootcmd.c
23  */
24 #define AOUT_MAGIC      V_MAGIC || magic==M_MAGIC
25 /* r3k or r4k boot images */
26 #define BOOT_MAGIC      (0x160<<16) || magic == ((0x160<<16)|3)
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         Mach    *m;
39         ushort  isilock;
40 };
41
42 struct Label
43 {
44         uintptr sp;
45         uintptr pc;
46 };
47
48 struct Confmem
49 {
50         ulong   base;
51         ulong   npage;
52         ulong   kbase;
53         ulong   klimit;
54 };
55
56 struct Conf
57 {
58         ulong   nmach;          /* processors */
59         ulong   nproc;          /* processes */
60         Confmem mem[4];
61         ulong   npage;          /* total physical pages of memory */
62         ulong   upages;         /* user page pool */
63         ulong   nimage;         /* number of page cache image headers */
64         ulong   nswap;          /* number of swap pages */
65         int     nswppo;         /* max # of pageouts per segment pass */
66         ulong   copymode;       /* 0 is copy on write, 1 is copy on reference */
67         ulong   ialloc;         /* bytes available for interrupt-time allocation */
68         ulong   pipeqsize;      /* size in bytes of pipe queues */
69         int     nuart;          /* number of uart devices */
70         int     monitor;
71         int     keyboard;
72 };
73
74 struct ISAConf
75 {
76         char    *type;
77         ulong   port;
78         int     irq;
79         int     nopt;
80         char    *opt[1];
81 };
82 #define BUSUNKNOWN -1
83
84 /*
85  * floating point registers
86  */
87 enum {
88         Nfpregs         = 32,           /* floats; half as many doubles */
89 };
90
91 /*
92  * emulated floating point (mips32r2 with ieee fp regs)
93  * fpstate is separate, kept in Proc
94  */
95 struct FPsave
96 {
97         /* /dev/proc expects the registers to be first in FPsave */
98         ulong   reg[Nfpregs];           /* the canonical bits */
99         union {
100                 ulong   fpstatus;       /* both are fcr31 */
101                 ulong   fpcontrol;
102         };
103
104         int     fpdelayexec;            /* executing delay slot of branch */
105         uintptr fpdelaypc;              /* pc to resume at after */
106         ulong   fpdelaysts;     /* save across user-mode delay-slot execution */
107
108         /* stuck-fault detection */
109         uintptr fppc;                   /* addr of last fault */
110         int     fpcnt;                  /* how many consecutive at that addr */
111 };
112
113 struct PFPU
114 {
115         int     fpstate;
116         FPsave  fpsave[1];
117 };
118
119 enum
120 {
121         /* floating point state */
122         FPinit,
123         FPactive,
124         FPinactive,
125         FPemu,
126
127         /* bit meaning floating point illegal */
128         FPillegal= 0x100,
129 };
130
131 /*
132  *  mmu goo in the Proc structure
133  */
134 struct PMMU
135 {
136         int     pidonmach[MAXMACH];
137 };
138
139 #include "../port/portdat.h"
140
141 struct Mach
142 {
143         /* the following are all known by l.s and cannot be moved */
144         int     machno;                 /* physical id of processor */
145         Softtlb*stb;
146         Proc*   proc;                   /* process on this processor */
147         ulong   splpc;                  /* pc that called splhi() */
148         ulong   tlbfault;
149
150         /* the following is safe to move */
151         ulong   tlbpurge;
152         ulong   ticks;                  /* of the clock since boot time */
153         Label   sched;                  /* scheduler wakeup */
154         void*   alarm;                  /* alarms bound to this clock */
155         int     lastpid;                /* last pid allocated on this machine */
156         Proc*   pidproc[NTLBPID];       /* proc that owns tlbpid on this mach */
157         KMap*   kactive;                /* active on this machine */
158         int     knext;
159         uchar   ktlbx[NTLB];            /* tlb index used for kmap */
160         uchar   ktlbnext;
161         int     speed;                  /* cpu speed */
162         ulong   delayloop;              /* for the delay() routine */
163         ulong   fairness;               /* for runproc */
164         int     flushmmu;
165         int     inclockintr;
166         int     ilockdepth;
167         Perf    perf;                   /* performance counters */
168         uvlong  cyclefreq;              /* Frequency of user readable cycle counter */
169
170         /* for per-processor timers */
171         ulong   lastcount;
172         uvlong  fastticks;
173         ulong   hz;
174         ulong   maxperiod;
175         ulong   minperiod;
176
177         Proc*   readied;                /* for runproc */
178         ulong   schedticks;             /* next forced context switch */
179
180         int     pfault;
181         int     cs;
182         int     syscall;
183         int     load;
184         int     intr;
185         int     hashcoll;               /* soft-tlb hash collisions */
186         int     paststartup;            /* for putktlb */
187
188         int     stack[1];
189 };
190
191 struct KMap
192 {
193         Ref;
194         ulong   virt;
195         ulong   phys0;
196         ulong   phys1;
197         KMap*   next;
198         KMap*   konmach[MAXMACH];
199         Page*   pg;
200         ulong   pc;                     /* of caller to kmap() */
201 };
202
203 #define VA(k)           ((k)->virt)
204 #define PPN(x)          ((ulong)(x)>>6)
205
206 struct Softtlb
207 {
208         ulong   virt;
209         ulong   phys0;
210         ulong   phys1;
211 };
212
213 struct
214 {
215         char    machs[MAXMACH];         /* active cpus */
216         short   exiting;
217 }active;
218
219 extern register Mach    *m;
220 extern register Proc    *up;