xref: /plan9-contrib/sys/src/boot/vt4/prototype.h (revision da917039c7f233c1a27d212bf012c6afa758af39)
1 #define PTR2UINT(p)	((uintptr)(p))
2 #define UINT2PTR(i)	((void*)(i))
3 
4 /* physical == virtual in our world! */
5 #define PADDR(a)	((ulong)(a) & ~0xF0000000)
6 
7 #define	GSHORT(p)	(((p)[1]<<8)|(p)[0])
8 #define	GLONG(p)	((GSHORT(p+2)<<16)|GSHORT(p))
9 #define	GLSHORT(p)	(((p)[0]<<8)|(p)[1])
10 #define	GLLONG(p)	(((ulong)GLSHORT(p)<<16)|GLSHORT(p+2))
11 #define	PLLONG(p,v)	(p)[3]=(v);(p)[2]=(v)>>8;(p)[1]=(v)>>16;(p)[0]=(v)>>24
12 
13 #define mallocalign(n, a, o, s)	ialloc((n), (a))
14 
15 /* emergency debugging printing, from uart.c */
16 #define Uarttxfifo	((ulong *)(Uartlite + 4))
17 #define PROG(c)		{ coherence(); *Uarttxfifo = (uchar)(c); coherence(); }
18 
19 /*
20  * l32p.s
21  */
22 void	cachesinvalidate(void);
23 void	dcbi(void*);
24 void	dcflush(uintptr, usize);
25 void	eieio(void);
26 u32int	esrget(void);
27 void	esrput(u32int);
28 // char*	getconf(char*);
29 #define getconf(s) nil
30 u32int	getccr0(void);
31 u32int	getdar(void);
32 u32int	getdear(void);
33 u32int	getdec(void);
34 u32int	getesr(void);
35 u32int	getmsr(void);
36 u32int	getpid(void);
37 u32int	getpir(void);
38 u32int	getpit(void);
39 u32int	getpvr(void);
40 u32int	gettbl(void);
41 u32int	gettsr(void);
42 void	icflush(uintptr, usize);
43 int	islo(void);
44 void	microdelay(int);
45 u32int	mmucrget(void);
46 void	mmucrput(u32int);
47 void	putdec(ulong);
48 void	putesr(ulong);
49 void	putevpr(ulong);
50 void	putmsr(u32int);
51 void	putpid(u32int);
52 void	putpit(u32int);
53 void	putsdr1(u32int);
54 void	puttcr(u32int);
55 void	puttsr(u32int);
56 void	setsp(uintptr);
57 void	spldone(void);
58 int	splhi(void);
59 int	spllo(void);
60 void	splx(int);
61 void	splxpc(int);
62 void	sync(void);
63 void	syncall(void);
64 int	tas32(uint*);
65 void	trapvec(void);
66 int	_xdec(long *);
67 int	_xinc(long *);
68 
69 /*
70  * trap.c
71  */
72 void	trapdisable(void);
73 void	trapinit(void);
74 
75 /*
76  * intr.c
77  */
78 void	intr(Ureg *ur);
79 void	intrack(ulong);
80 void	intrenable(ulong bit, int (*func)(ulong));
81 void	intrinit(void);
82 ulong	lddbg(void);
83 
84 /*
85  * uart.c
86  */
87 int	vuartgetc(void);
88 void	vuartputc(int c);
89 int	vuartputs(char *s, int len);
90 
91 /*
92  * clock.c
93  */
94 void	clockinit(void);
95 void	clockintr(Ureg *ureg);
96 void	delay(int);
97 void	prcpuid(void);
98 void	timerintr(Ureg*);
99 
100 /*
101  * dma.c
102  */
103 void	dmacpy(void *dest, void *src, ulong len, ulong flags);
104 void	dmainit(void);
105 void	dmastart(void *dest, void *src, ulong len, ulong flags);
106 void	dmawait(void);
107 
108 /*
109  * ether.c
110  */
111 uchar	*etheraddr(int ctlrno);
112 int	etherinit(void);
113 void	etherinitdev(int, char*);
114 void	etherprintdevs(int);
115 int	etherrxflush(int ctlrno);
116 int	etherrxpkt(int ctlrno, Etherpkt* pkt, int timo);
117 int	ethertxpkt(int ctlrno, Etherpkt* pkt, int len, int);
118 
119 /*
120  * llfifo.c
121  */
122 void	llfifoinit(Ether *);
123 int	llfifointr(ulong bit);
124 void	llfiforeset(void);
125 void	llfifotransmit(uchar *ubuf, unsigned len);
126 
127 /*
128  * load.c
129  */
130 int	getfields(char*, char**, int, char);
131 void*	ialloc(ulong, int);
132 
133 /*
134  * boot.c
135  */
136 int	bootpass(Boot *b, void *vbuf, int nbuf);
137 
138 /*
139  * bootp.c
140  */
141 int	bootpboot(int, char*, Boot*);
142 void*	pxegetfspart(int, char*, int);
143 
144 /*
145  * conf.c
146  */
147 int	dotini(Fs *fs);
148 
149 /*
150  * console.c
151  */
152 void	consinit(char*, char*);
153 int	getstr(char*, char*, int, char*, int);
154 void	kbdinit(void);
155 void	warp86(char*, ulong);
156 void	warp9(ulong);
157 
158 /*
159  * inflate.c
160  */
161 int	gunzip(uchar*, int, uchar*, int);
162 
163 /*
164  * misc.
165  */
166 
167 void	ilock(Lock*);
168 void	iunlock(Lock*);
169 int	lock(Lock*);
170 void	unlock(Lock*);
171 
172 void	panic(char *fmt, ...);
173 
174 #define TAS(l)		tas32(l)
175 
176 #define iprint		print
177 
178 #define coherence()	eieio()
179 #define exit(n)		for(;;) ;
180 
181 void	cacheline0(uintptr addr);
182 ulong	cacheson(void);
183 void	clrmchk(void);
184 void	dump(void *, int);
185 void	dumpregs(Ureg *);
186 void	flushwrbufs(void);
187 uintptr	memsize(void);
188 vlong	probeaddr(uintptr addr);
189 /*
190  * qtm.c
191  */
192 int	qtmerrfmt(char *, int);
193 void	qtmerrtest(char *);
194 void	qtmerrtestaddr(ulong);
195 int	qtmmemreset(void);
196 vlong	qtmprobeaddr(uintptr addr);
197