-
Notifications
You must be signed in to change notification settings - Fork 1
/
sysMipsLib.c
467 lines (406 loc) · 10.9 KB
/
sysMipsLib.c
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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
/* sysMipsLib.c - MIPS system-dependent routines */
/* Copyright 2001 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
* This file has been developed or significantly modified by the
* MIPS Center of Excellence Dedicated Engineering Staff.
* This notice is as per the MIPS Center of Excellence Master Partner
* Agreement, do not remove this notice without checking first with
* WR/Platforms MIPS Center of Excellence engineering management.
*/
/*
modification history
--------------------
01g,13mar02,agf replace (SM_OBJ || SM_NET) with SM_COMMON, SPR 74321
01f,27feb02,pes Fix conditional to include sysProcNumSet
01e,17jan02,tlc Add call to vxTas() to sysBusTas() (SPR #70336 fix).
01d,16jul01,tlc Add CofE copyright.
01c,27jun01,tlc Add conditional for (INCLUDE_SM_OBJ) and (INCLUDE_SM_NET) for
sysLocalToBusAdrs, sysBusToLocalAdrs, sysBusIntAck, and
sysBusIntGen.
01b,15jun01,tlc Make each routine conditionally compiled so that BSPs may
define thier own routines, if necessary.
01a,13jun01,tlc Add sysIntDisable(). Remove sysBusTas().
*/
/*
DESCRIPTION
DO NOT EDIT THIS FILE.
This library provides board-specific routines that are shared by *all* MIPS-based
BSPs. MIPS BSPs utilize this file by creating a symbolic link from their
directory to target/config/mipsCommon/sysMipsLib.c and include the file at the
top of sysLib.c using
#include "sysMipsLib.c"
A list of provided routines follows. If a BSP requires a specialized routine,
then #define the appropriate MACRO corresponding to the routine to be
specialized in the BSPs sysLib.c file.
ROUTINE MACRO
------------------------------------------------------
sysProcNumGet SYS_PROC_NUM_GET
sysProcNumSet SYS_PROC_NUM_SET
sysBusEid SYS_BUS_EID
sysBusEar SYS_BUS_EAR
sysClearTlb SYS_CLEAR_TLB
sysMaskVmeErr SYS_MASK_VME_ERR
sysUnmaskVmeErr SYS_UNMASK_VMR_ERR
sysLocalToBusAdrs SYS_LOCAL_TO_BUS_ADRS
sysBusToLocalAdrs SYS_BUS_TO_LOCAL_ADRS
sysBusIntAck SYS_BUS_INT_ACK
sysBusIntGen SYS_BUS_INT_GEN
sysIntEnable SYS_INT_ENABLE
sysIntDisable SYS_INT_DISABLE
sysSw0Gen SYS_SW0_GEN
sysSw1Gen SYS_SW1_GEN
sysSw0Ack SYS_SW0_ACK
sysSw1Ack SYS_SW1_ACK
sysBusTas SYS_BUS_TAS
*/
/* globals */
int sysBus = BUS; /* system bus type (VME_BUS, etc) */
int sysCpu = CPU; /* system CPU type (MIPS_Vr5400) */
char *sysMemTopAdr= NULL; /* top of memory */
char *sysBootLine = BOOT_LINE_ADRS; /* address of boot line */
char *sysExcMsg = EXC_MSG_ADRS; /* catastrophic message area */
int sysProcNum; /* processor number of this CPU */
int sysFlags; /* boot flags */
char sysBootHost [BOOT_FIELD_LEN]; /* name of host from which we booted */
char sysBootFile [BOOT_FIELD_LEN]; /* name of file from which we booted */
/* externals */
IMPORT BOOL vxTas();
/* Initialize cache function pointer */
LOCAL STATUS sysCacheInit ();
FUNCPTR sysCacheLibInit = (FUNCPTR) sysCacheInit;
#ifndef SYS_PROC_NUM_GET
/******************************************************************************
*
* sysProcNumGet - get the processor number
*
* This routine returns the processor number for the CPU board, which is
* set with sysProcNumSet().
*
* RETURNS: The processor number for the CPU board.
*
* SEE ALSO: sysProcNumSet()
*/
int sysProcNumGet (void)
{
return (sysProcNum);
}
#endif
#ifndef SYS_PROC_NUM_SET
/******************************************************************************
*
* sysProcNumSet - set the processor number
*
* This routine sets the processor number for this board. Processor numbers
* should be unique on a single backplane.
*
* RETURNS: N/A
*
* SEE ALSO: sysProcNumGet()
*/
void sysProcNumSet
(
int procNum
)
{
sysProcNum = procNum;
}
#endif
#ifndef SYS_BUS_EID
/******************************************************************************
*
* sysBusEid - get the value of the error ID register
*
* This routine returns the contents of the bus error status register
* MIPS devices have no such register, so they simply return zero.
*
* RETURNS: 0, always.
*/
USHORT sysBusEid (void)
{
return (0);
}
#endif
#ifndef SYS_BUS_EAR
/******************************************************************************
*
* sysBusEar - get the access address of a bus error
*
* This routine returns the address of a bus error.
*
* NOTE:
* This routine must be provided on all MIPS board support packages.
* MIPS devices cannot determine the address that caused
* a bus error. It is possible to determine the source of a read bus error
* by interpreting the instruction stream that caused the bus error.
*
* RETURNS: -1, always.
*/
ULONG sysBusEar (void)
{
return (-1);
}
#endif
#ifndef SYS_CLEAR_TLB
/******************************************************************************
*
* sysClearTlb - clear the translation lookaside buffer
*
* This routine clears the entries in the translation lookaside buffer (TLB)
* for the MIPS devices.
*
* RETURNS: N/A
*
* NOMANUAL
*/
void sysClearTlb (void)
{
int tlbEntry;
for (tlbEntry = 0; tlbEntry < TLB_ENTRIES; tlbEntry++)
sysClearTlbEntry (tlbEntry);
}
#endif
#ifndef SYS_MASK_VME_ERR
/******************************************************************************
*
* sysMaskVmeErr - mask the VMEbus error interrupt
*
* This routine is required for all MIPS BSPs. It has no effect.
*
* RETURNS: 0.
*
* NOMANUAL
*/
UINT8 sysMaskVmeErr (void)
{
return (0);
}
#endif
#ifndef SYS_UNMASK_VME_ERR
/******************************************************************************
*
* sysUnmaskVmeErr - unmask the VMEbus error interrupt
*
* This routine is required for all MIPS BSPs. It has no effect.
*
* RETURNS: 0.
*
* NOMANUAL
*/
UINT8 sysUnmaskVmeErr (void)
{
return (0);
}
#endif
#ifdef INCLUDE_SM_COMMON
#ifndef SYS_LOCAL_TO_BUS_ADRS
/******************************************************************************
*
* sysLocalToBusAdrs - convert a local address to a bus address
*
* Not Implemented
*
* NOMANUAL
*/
STATUS sysLocalToBusAdrs
(
int adrsSpace, /* bus address space in which busAdrs resides, */
/* use address modifier codes defined in vme.h, */
/* such as VME_AM_STD_SUP_DATA */
char *localAdrs, /* local address to convert */
char **pBusAdrs /* where to return bus address */
)
{
return (ERROR);
}
#endif
#ifndef SYS_BUS_TO_LOCAL_ADRS
/******************************************************************************
*
* sysBusToLocalAdrs - convert a bus address to a local address
*
* Not Implemented
*
* NOMANUAL
*/
STATUS sysBusToLocalAdrs
(
int adrsSpace, /* bus address space in which busAdrs resides, */
/* use address modifier codes defined in vme.h, */
/* such as VME_AM_STD_SUP_DATA */
char *busAdrs, /* bus address to convert */
char **pLocalAdrs /* where to return local address */
)
{
return (ERROR);
}
#endif
#ifndef SYS_BUS_INT_ACK
/******************************************************************************
*
* sysBusIntAck - acknowledge a bus interrupt
*
* Not Implemented
*
* NOMANUAL
*/
int sysBusIntAck
(
int intLevel /* interrupt level to acknowledge */
)
{
return(ERROR);
}
#endif
#ifndef SYS_BUS_INT_GEN
/******************************************************************************
*
* sysBusIntGen - generate a bus interrupt
*
* Not Implemented
* RETURNS: ERROR, since there is no external bus.
*/
STATUS sysBusIntGen
(
int level, /* bus interrupt level to generate */
int vector /* interrupt vector to return (0-255) */
)
{
return (ERROR);
}
#endif
#endif /* INCLUDE_SM_COMMON */
#ifndef SYS_INT_ENABLE
/******************************************************************************
*
* sysIntEnable - enable a bus interrupt level
*
* Not Implemented
*
* NOMANUAL
*/
STATUS sysIntEnable
(
int intNum
)
{
return (ERROR);
}
#endif
#ifndef SYS_INT_DISABLE
/******************************************************************************
*
* sysIntDisable - disable a bus interrupt level
*
* Not Implemented
*
* NOMANUAL
*/
STATUS sysIntDisable
(
int intNum
)
{
return (ERROR);
}
#endif
#ifndef SYS_SW0_GEN
/*******************************************************************************
*
* sysSw0Gen - generate software interrupt 0
*
* This routine writes to the MIPS cause register to generate a software
* interrupt.
*
* RETURNS: N/A
*/
void sysSw0Gen (void)
{
unsigned causeReg;
causeReg = intCRGet ();
causeReg |= CAUSE_SW1;
intCRSet (causeReg);
}
#endif
#ifndef SYS_SW1_GEN
/*******************************************************************************
*
* sysSw1Gen - generate software interrupt 1
*
* This routine writes to the MIPS cause register to generate a software
* interrupt.
*
* RETURNS: N/A
*/
void sysSw1Gen (void)
{
unsigned causeReg;
causeReg = intCRGet ();
causeReg |= CAUSE_SW2;
intCRSet (causeReg);
}
#endif
#ifndef SYS_SW0_ACK
/*******************************************************************************
*
* sysSw0Ack - acknowledge software interrupt 0
*
* This routine writes to the MIPS cause register to acknowledge a software
* interrupt.
*
* NOTE:
* This routine is provided as a default interrupt service routine.
*
* RETURNS: N/A
*/
LOCAL int sysSw0Ack (void)
{
unsigned causeReg;
causeReg = intCRGet ();
causeReg &= ~CAUSE_SW1;
intCRSet (causeReg);
return (OK);
}
#endif
#ifndef SYS_SW1_ACK
/*******************************************************************************
*
* sysSw1Ack - acknowledge software interrupt 1
*
* This routine writes to the MIPS cause register to acknowledge a software
* interrupt.
*
* NOTE:
* This routine is provided as a default interrupt service routine.
*
* RETURNS: N/A
*/
LOCAL int sysSw1Ack (void)
{
unsigned causeReg;
causeReg = intCRGet ();
causeReg &= ~CAUSE_SW2;
intCRSet (causeReg);
return (OK);
}
#endif
#ifndef SYS_BUS_TAS
/******************************************************************************
*
* sysBusTas - test and set a location across the bus
*
* This routine performs a test-and-set operation across the backplane.
*
* RETURNS: TRUE if the value had not been set but is now, or FALSE if the
* value was set already.
*
* SEE ALSO: vxTas()
*/
BOOL sysBusTas
(
char *adrs /* address to be tested-and-set */
)
{
return (vxTas(adrs));
}
#endif