4 * HZ should divide 1000 evenly, ideally.
5 * 100, 125, 200, 250 and 333 are okay.
7 #define HZ 100 /* clock frequency */
8 #define MS2HZ (1000/HZ) /* millisec per clock tick */
9 #define TK2SEC(t) ((t)/HZ) /* ticks to seconds */
18 #define MS2TMR(t) ((ulong)(((uvlong)(t) * m->cpuhz)/1000))
19 #define US2TMR(t) ((ulong)(((uvlong)(t) * m->cpuhz)/1000000))
22 * we ignore the first 2 uarts on the omap3530 (see uarti8250.c) and use the
23 * third one but call it 0.
27 typedef struct Conf Conf;
28 typedef struct Confmem Confmem;
29 typedef struct FPsave FPsave;
30 typedef struct PFPU PFPU;
31 typedef struct ISAConf ISAConf;
32 typedef struct Label Label;
33 typedef struct Lock Lock;
34 typedef struct Memcache Memcache;
35 typedef struct MMMU MMMU;
36 typedef struct Mach Mach;
37 typedef u32int Mreg; /* Msr - bloody UART */
38 typedef struct Page Page;
39 typedef struct PhysUart PhysUart;
40 typedef struct PMMU PMMU;
41 typedef struct Proc Proc;
43 typedef struct Uart Uart;
44 typedef struct Ureg Ureg;
47 #pragma incomplete Ureg
49 #define MAXSYSARG 5 /* for mount(fd, mpt, flag, arg, srv) */
52 * parameters for sysproc.c
54 #define AOUT_MAGIC (E_MAGIC)
73 * emulated floating point
83 ulong regs[Nfpctlregs][3];
112 ulong nmach; /* processors */
113 ulong nproc; /* processes */
114 Confmem mem[1]; /* physical memory */
115 ulong npage; /* total physical pages of memory */
116 usize upages; /* user page pool */
117 ulong copymode; /* 0 is copy on write, 1 is copy on reference */
118 ulong ialloc; /* max interrupt time allocation in bytes */
119 ulong pipeqsize; /* size in bytes of pipe queues */
120 ulong nimage; /* number of page cache image headers */
121 ulong nswap; /* number of swap pages */
122 int nswppo; /* max # of pageouts per segment pass */
123 ulong hz; /* processor cycle freq */
125 int monitor; /* flag */
133 PTE* mmul1; /* l1 for this processor */
142 #define NCOLOR 1 /* 1 level cache, don't worry about VCE's */
146 Page* mmul2cache; /* free mmu pages */
149 #include "../port/portdat.h"
153 int machno; /* physical id of processor */
154 uintptr splpc; /* pc of last caller to splhi */
156 Proc* proc; /* current process */
159 int flushmmu; /* flush current proc mmu state */
161 ulong ticks; /* of the clock since boot time */
162 Label sched; /* scheduler wakeup */
163 Lock alarmlock; /* access to alarm list */
164 void* alarm; /* alarms bound to this clock */
167 Proc* readied; /* for runproc */
168 ulong schedticks; /* next forced context switch */
181 uvlong fastclock; /* last sampled value */
182 uvlong inidle; /* time spent in idlehands() */
186 Perf perf; /* performance counters */
190 uvlong cpuhz; /* speed of cpu */
191 uvlong cyclefreq; /* Frequency of user readable cycle counter */
193 /* save areas for exceptions, hold R0-R4 */
198 u32int smon[5]; /* probably not needed */
208 #define VA(k) ((uintptr)(k))
209 #define kmap(p) (KMap*)((p)->pa|kseg0)
214 char machs[MAXMACH]; /* active CPUs */
215 int exiting; /* shutdown */
218 extern register Mach* m; /* R10 */
219 extern register Proc* up; /* R9 */
220 extern uintptr kseg0;
221 extern Mach* machaddr[MAXMACH];
222 extern ulong memsize;
223 extern int normalprint;
226 * a parsed plan9.ini line
243 #define MACHP(n) (machaddr[n])
246 * Horrid. But the alternative is 'defined'.
249 #define DBGFLG (dbgflg[_DBGC_])
255 extern char dbgflg[256];
257 #define dbgprint print /* for now */
260 * hardware info about a device
269 ulong intnum; /* interrupt number */
270 char *type; /* card type, malloced */
271 int nports; /* Number of ports */
272 Devport *ports; /* The ports themselves */
281 /* characteristics of a given cache level */
283 uint level; /* 1 is nearest processor, 2 further away */
284 uint l1ip; /* l1 I policy */
286 uint nways; /* associativity */
288 uint linelen; /* bytes per cache line */
292 uint waysh; /* shifts for set/way register */