File: mvmebug.h

package info (click to toggle)
m68k-vme-tftplilo 1.1.2-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 332 kB
  • ctags: 674
  • sloc: ansic: 5,858; makefile: 81
file content (371 lines) | stat: -rw-r--r-- 7,727 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
/*
 *  VME Linux/m68k Loader
 *
 *  (c) Copyright 1998 by Nick Holgate
 *
 *  This file is subject to the terms and conditions of the GNU General Public
 *  License.  See the file COPYING for more details.
 */

/*--------------------------------------------------------------------------*/

#define MVMEBugEntry			15		/* Trap #15 to call MVMEBug */

#define MB_OUTCHR			0x0020
#define MB_OUTSTR			0x0021
#define MB_WRITD			0x0028
#define MB_INCHR			0x0000
#define MB_INSTAT			0x0001
#define MB_DSKRD			0x0010
#define MB_SYMBOLTA			0x0130
#define MB_SYMBOLTD			0x0131
#define MB_RETURN			0x0063
#define MB_RTC_READ			0x0053
#define MB_NETRD			0x0018
#define MB_NETWR			0x0019

/*--------------------------------------------------------------------------*/
/* Board ID data structure
 *
 * Note, bytes 12 and 13 are board no in BCD (0162,0166,0167,0177,etc)
 */

typedef struct {
	unsigned long	bdid;
	unsigned char	rev;
	unsigned char	mth;
	unsigned char	day;
	unsigned char	yr;
	unsigned short	size;
	unsigned short	reserved;
	unsigned short	brdno;
	unsigned char	suffix[2];
	unsigned long	options;
	unsigned short	clun;
	unsigned short	dlun;
	unsigned short	ctype;
	unsigned short	dnum;
	unsigned long	option2;

} BRDID_PKT;

/*--------------------------------------------------------------------------*/
/* system call .NETRD/.NETWR packet template
 */

typedef struct niopcall {
	unsigned char	clun;			/* controller logical unit number		*/
	unsigned char	dlun;			/* device logical unit number			*/
	unsigned short	status;			/* error status word					*/
	unsigned long	address;		/* data transfer address				*/
	unsigned long	length;			/* maximum length of transfer			*/
	unsigned long	offset;			/* byte offset							*/
	unsigned long	time;			/* transfer time in seconds (status)	*/
	unsigned long	bytes;			/* transfer byte count (status)			*/
	unsigned char	filename[64];	/* boot filename buffer string			*/

} NIOPCALL;

/*--------------------------------------------------------------------------*/
/* network boot information block structure template
 */

typedef struct netbootinfo {
	unsigned long	cipa;			/* client IP address 					*/
	unsigned long	sipa;			/* server IP address					*/
	unsigned long	gipa;			/* gateway IP address					*/
	unsigned long	subnetmask;		/* subnet IP address mask				*/
	unsigned long	broadcast;		/* broadcast IP address					*/

} NETBOOTINFO;

/*--------------------------------------------------------------------------*/
/* Disk Read command block
 */
typedef struct {
	unsigned char	clun,
					dlun;
	unsigned short	status;
	unsigned long	address,
					block;
	unsigned short	count;
	unsigned char	flags,
					mod;
} DSKRD_CMND;

/*--------------------------------------------------------------------------*/

/*
        32 bit word at  0x14 block number of start of IPL
        16 bit word at  0x18 number of blocks to load
        32 bit word at  0x1E boot load address
        32 bit word at 0x90 to contain 0 (Media config area start block)
        Locations 0xF8 to 0xFF to contain "MOTOROLA"
*/

typedef struct {
	unsigned long	sp;					/*  00 initial stack pointer		*/
	unsigned long	pc;					/*  04 initial program counter		*/
	char			filler1[12];		/*  08								*/
	unsigned long	boot_start_block;	/*  14 boot file start block addr	*/
	unsigned short	boot_block_count;	/*  18 number of blocks in file		*/
	char			filler2[4];			/*  1a								*/
	unsigned long	boot_load_addr;		/*  1e 								*/
	char			boot_code[110];		/*  22 IPL code						*/
	unsigned long	cfg_block;			/*  90 config data start block		*/
	unsigned char	cfg_count;			/*  94 config data block count		*/
	char			filler3[1];			/*  95 word align frag_list			*/
	char			frag_list[90];		/*  96 loader file fragment list	*/
	char			boot_id[16];		/*  f0 id string "Linux68kMOTOROLA"	*/
} BOOTBLOCK;

#define BOOT_BLOCK_ID  "Linux68kMOTOROLA"

/*--------------------------------------------------------------------------*/
/* Call MVMEBug putchar subroutine.
 */

static
__inline__
void
MVMEBug_putchar
(	int		c
)
{	register unsigned long	d0 asm("d0") = (unsigned long) c;

	asm volatile (
		"	move.b	%%d0,-(%%sp)
			trap	#15
			dc.w	0x0020
		"
		: /* no outputs */
		: "r" (d0)
		: "d0"
	);
}

/*--------------------------------------------------------------------------*/
/* Call MVMEBug putstr subroutine.
 */

static
__inline__
void
MVMEBug_putstr
(	const char		*str,
	const char		*end
)
{	register void			*a0 asm("a0") = (void *) str;
	register void			*a1 asm("a1") = (void *) end;

	asm volatile (
		"	move.l	%%a1,-(%%sp)
			move.l	%%a0,-(%%sp)
			trap	#15
			dc.w	0x0021
		"
		: /* no outputs */
		: "r" (a0), "r" (a1)
		: "a0", "a1"
	);
}

/*--------------------------------------------------------------------------*/
/* Call MVMEBug print subroutine.
 */

static
__inline__
void
MVMEBug_print
(	const char		*str,
	void			*vap
)
{	register void			*a0 asm("a0") = (void *) str;
	register void			*a1 asm("a1") = (void *) vap;

	asm volatile (
		"	move.l	%%a1,-(%%sp)
			move.l	%%a0,-(%%sp)
			trap	#15
			dc.w	0x0028
		"
		: /* no outputs */
		: "r" (a0), "r" (a1)
		: "a0", "a1"
	);
}

/*--------------------------------------------------------------------------*/
/* Call MVMEBug getchar subroutine.
 */

static
__inline__
int
MVMEBug_getchar
(	void
)
{	register unsigned long	d0 asm("d0") = 0;

	asm volatile (
		"	subq.l	#2,%%sp
			trap	#15
			dc.w	0x0000
			move.b	(%%sp)+,%%d0
		"
		: "=r" (d0)
		: "r" (d0)
		: "d0"
	);

	return d0;
}

/*--------------------------------------------------------------------------*/
/* Call MVMEBug input status subroutine.
 */

static
__inline__
int
MVMEBug_getchar_status
(	void
)
{	register unsigned long	d0 asm("d0");

	asm volatile (
		"	move.l	#0,-(%%sp)
			trap	#15
			dc.w	0x0001
			beq.s	1f
			move.l	#1,(%%sp)
		1:
			move.l	(%%sp)+,%%d0
		"
		: "=r" (d0)
		: /* no inputs */
		: "d0"
	);

	return d0;
}

/*--------------------------------------------------------------------------*/
/* Call MVMEBug RTC read subroutine.
 */

static
__inline__
void
MVMEBug_rtc_read
(	void			*buf
)
{	register void *			d0 asm("d0") = (void *) buf;

	asm volatile (
		"	move.l	%%d0,-(%%sp)
			trap	#15
			dc.w	0x0053
		"
		: /* no outputs */
		: "r" (d0)
		: "d0"
	);
}

/*--------------------------------------------------------------------------*/
/* Call MVMEBug disk_read subroutine.
 */

static
__inline__
void
MVMEBug_disk_read
(	DSKRD_CMND		*cmnd
)
{	register void	*d0 asm("d0") = (void *) cmnd;

	asm volatile (
		"	move.l	%%d0,-(%%sp)
			trap	#15
			dc.w	0x0010
		"
		: /* no outputs */
		: "r" (d0)
		: "d0", "memory"
	);
}

/*--------------------------------------------------------------------------*/
/* Call MVMEBug net_read subroutine.
 */

static
__inline__
void
MVMEBug_net_read
(	NIOPCALL		*niop
)
{	register void	*d0 asm("d0") = (void *) niop;

	asm volatile (
		"	move.l	%%d0,-(%%sp)
			trap	#15
			dc.w	0x0018
		"
		: /* no outputs */
		: "r" (d0)
		: "d0", "memory"
	);
}

/*--------------------------------------------------------------------------*/
/* Call MVMEBug.
 */

static
__inline__
void
MVMEBug_enter
(	void
)
{
	asm volatile (
		"	trap	#15
			dc.w	0x0063
		"
		: /* No outputs */
		: /* No inputs  */
		: "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
		  "a0", "a1", "a2", "a3", "a4", "a5", "a6", "memory"
	);
}

/*--------------------------------------------------------------------------*/
/* Call MVMEBug BRD_ID subroutine.
 */

static
__inline__
BRDID_PKT *
MVMEBug_brdid
(	void
)
{	register void *			d0 asm("d0");

	asm volatile (
		"	subq.l	#4,%%sp
			trap	#15
			dc.w	0x0070
			move.l	(%%sp)+,%%d0
		"
		: "=r" (d0)
		: /* no inputs */
		: "d0"
	);

	return d0;
}

/*-----------------------------< end of file >------------------------------*/