2 #define countpagerefs(a, b)
4 #include "../port/portfns.h"
6 extern int led(int, int);
7 extern void ledexit(int);
8 extern void delay(int);
9 extern void _uartputs(char*, int);
10 extern int _uartprint(char*, ...);
12 #pragma varargck argpos _uartprint 1
14 extern void archreboot(void);
15 extern void archreset(void);
16 extern void cachedinv(void);
17 extern void cachedinvse(void*, int);
18 extern void cachedwb(void);
19 extern void cachedwbinv(void);
20 extern void cachedwbinvse(void*, int);
21 extern void cachedwbse(void*, int);
22 extern void cacheiinv(void);
23 extern void cacheinfo(int level, Memcache *cp);
24 extern void cacheuwbinv(void);
25 extern uintptr cankaddr(uintptr pa);
26 extern void chkmissing(void);
27 extern void clockshutdown(void);
28 extern int clz(ulong);
29 extern int cmpswap(long*, long, long);
30 extern void coherence(void);
31 extern void configscreengpio(void);
32 extern u32int controlget(void);
33 extern u32int cpctget(void);
34 extern u32int cpidget(void);
35 extern ulong cprd(int cp, int op1, int crn, int crm, int op2);
36 extern ulong cprdsc(int op1, int crn, int crm, int op2);
37 extern void cpuidprint(void);
38 extern void cpwr(int cp, int op1, int crn, int crm, int op2, ulong val);
39 extern void cpwrsc(int op1, int crn, int crm, int op2, ulong val);
40 #define cycles(ip) *(ip) = lcycles()
41 extern u32int dacget(void);
42 extern void dacput(u32int);
43 extern void dmainit(void);
44 extern int dmastart(void *, int, void *, int, uint, Rendez *, int *);
45 extern void dmatest(void);
46 extern u32int farget(void);
47 extern ulong fprd(int fpreg);
48 extern void fpwr(int fpreg, ulong val);
49 extern u32int fsrget(void);
50 extern u32int getscr(void);
51 extern u32int getpsr(void);
52 extern ulong getwayssets(void);
53 extern void intrsoff(void);
54 extern int isaconfig(char*, int, ISAConf*);
55 extern int isdmadone(int);
56 extern int ispow2(uvlong);
57 extern void kbdenable(void);
58 extern void l2cacheuinv(void);
59 extern void l2cacheuwb(void);
60 extern void l2cacheuwbinv(void);
61 extern void lastresortprint(char *buf, long bp);
62 extern int log2(ulong);
63 extern void machinit(void);
64 extern void mmuidmap(uintptr phys, int mbs);
65 extern void mmuinvalidate(void); /* 'mmu' or 'tlb'? */
66 extern void mmuinvalidateaddr(u32int); /* 'mmu' or 'tlb'? */
67 extern void mousectl(Cmdbuf *cb);
68 extern u32int pidget(void);
69 extern void pidput(u32int);
70 extern vlong probeaddr(uintptr);
71 extern void procrestore(Proc *);
72 extern void procsave(Proc*);
73 extern void procsetup(Proc*);
74 extern void _reset(void);
75 extern void screenclockson(void);
76 extern void screeninit(void);
77 extern void serialputs(char* s, int n);
78 extern void setcachelvl(int);
79 extern void setr13(int, u32int*);
80 extern int tas(void *);
81 extern u32int ttbget(void);
82 extern void ttbput(u32int);
83 extern void watchdoginit(void);
85 extern int irqenable(int, void (*)(Ureg*, void*), void*, char*);
86 extern int irqdisable(int, void (*)(Ureg*, void*), void*, char*);
87 #define intrenable(i, f, a, b, n) irqenable((i), (f), (a), (n))
88 #define intrdisable(i, f, a, b, n) irqdisable((i), (f), (a), (n))
89 extern void vectors(void);
90 extern void vtable(void);
92 /* dregs, going away */
94 extern void outb(int, int);
97 * Things called in main.
99 extern void archconfinit(void);
100 extern void clockinit(void);
101 extern int i8250console(void);
102 extern void links(void);
103 extern void mmuinit(void);
104 extern void touser(uintptr);
105 extern void trapinit(void);
108 extern int fpiarm(Ureg*);
109 extern int fpudevprocio(Proc*, void*, long, uintptr, int);
110 extern void fpuinit(void);
111 extern void fpunoted(void);
112 extern void fpunotify(Ureg*);
113 extern void fpuprocrestore(Proc*);
114 extern void fpuprocsave(Proc*);
115 extern void fpusysprocsetup(Proc*);
116 extern void fpusysrfork(Ureg*);
117 extern void fpusysrforkchild(Proc*, Ureg*, Proc*);
118 extern int fpuemu(Ureg*);
121 * Miscellaneous machine dependent stuff.
123 extern char* getenv(char*, char*, int);
124 char* getconf(char*);
125 uintptr mmukmap(uintptr, uintptr, usize);
126 uintptr mmukunmap(uintptr, uintptr, usize);
127 extern void* mmuuncache(void*, usize);
128 extern void* ucalloc(usize);
129 extern Block* ucallocb(int);
130 extern void* ucallocalign(usize size, int align, int span);
131 extern void ucfree(void*);
132 extern void ucfreeb(Block*);
135 * Things called from port.
137 extern void delay(int); /* only scheddump() */
138 extern int islo(void);
139 extern void microdelay(int); /* only edf.c */
140 extern void evenaddr(uintptr);
141 extern void idlehands(void);
142 extern void setkernur(Ureg*, Proc*); /* only devproc.c */
143 extern void* sysexecregs(uintptr, ulong, int);
144 extern void sysprocsetup(Proc*);
150 int cas32(void*, u32int, u32int);
153 #define CASU(p, e, n) cas32((p), (u32int)(e), (u32int)(n))
154 #define CASV(p, e, n) cas32((p), (u32int)(e), (u32int)(n))
155 #define CASW(addr, exp, new) cas32((addr), (exp), (new))
156 #define TAS(addr) tas32(addr)
158 extern void forkret(void);
159 extern int userureg(Ureg*);
160 void* vmap(uintptr, usize);
161 void vunmap(void*, usize);
163 extern void kexit(Ureg*);
165 #define getpgcolor(a) 0
168 #define PTR2UINT(p) ((uintptr)(p))
169 #define UINT2PTR(i) ((void*)(i))
171 #define waserror() (up->nerrlab++, setlabel(&up->errlab[up->nerrlab-1]))
173 #define KADDR(pa) UINT2PTR(KZERO | ((uintptr)(pa) & ~KSEGM))
174 #define PADDR(va) PTR2UINT(PHYSDRAM | ((uintptr)(va) & ~KSEGM))
176 #define wave(c) *(ulong *)PHYSCONS = (c)
178 #define MASK(v) ((1UL << (v)) - 1) /* mask `v' bits wide */