summaryrefslogtreecommitdiffstats
path: root/cfe/cfe/verif/readme.txt
blob: 4a35deed1d03d28142e4715c95f0b11964695393 (plain)
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
CFE Diagnostic Entry Points
---------------------------

---------------------------------------------------------------------------

The CFE diagnostic entry points are used when running verification
programs under the control of the firmware.  They are fixed (constant)
addresses and have register-based calling sequences.  These entry
points are designed to be as minimal as possible so that as much of the
verification code as possible can be reused.

You can call the KSEG0 or KSEG1 version of the routine.  It is
recommended that you call the cached version from cached code and 
vice versa.

The firmware will reserve the top megabyte of memory for itself.  The
diagnostic must not touch this memory.

The firmware will be compiled to *NOT* use relocatable data and
code segments. 

The firmware will need one general register that it is allowed to
trash without saving - I'll be using this to generate the pointer to
the save area.

The diagnostics can generate records in a log buffer.  This buffer
is allocated in the diagnostic's memory space but is filled in
by the firmware through the diagnostic entry points.  At the end
of the diagnostic run, user commands in the firmware may be used
to look through accumulated log records.

If you mess with the caches or with the console device, the
VAPI functions that print messages to the console may not work.

Log records follow this format:

        +0  SIGNATURE, FORMAT, and ID-CODE
        +8  Number of 64-bit words in 'Log Data' field.
            Upper 32 bits are CP0 count register
        +16 Return address of routine generating this record
        +24 Log Data

The "Log Record size" field is the number of bytes in the "log data"
field.  No log data would use a value of zero.

The bytes in the SIGNATURE word are broken down as follows:

      S1 S2 P1 F1 I1 I2 I3 I4
      CF E1 pp xx ii ii ii ii

The "F1" byte is the format code; it describes the type
of log record being generated. 

     0x00 - General register and CP0 dump
     0x01 - SOC state dump
     0x02 - Generic log data (multiple of 8 bytes)
     0x03 - trace RAM
     0x04 - Diagnostic termination status (8 bytes) 
     0x05 - Floating point registers

The "P1" byte is the processor number, 0 or 1.

The "I1" through "I4" bytes are supplied by the diagnostic
and can take on any value.  You can use these bytes to identify
what part of the program generated this particular log record.

For example, if the diagnostic logs a single value of
0x0123_4567_89ab_cdef the log entry might look like:

      0xCCFF_EE02_0000_0001
      0x0001_3F22_0000_0008
      0xFFFF_FFFF_8000_0120
      0x0123_4567_89AB_CDEF


RETURN TO FIRMWARE
------------------

Description:

   Returns control to the firmware and displays the test status.  
   The status result is in register A0.  

   The firmware will store a "diagnostic termination status" 
   record in the log with the A0 register value.  The ID code
   will be zero for this record.

   CFE's log scanning commands can be used to display log 
   records accumulated by the test.


Routine address:        0xBFC00510  (KSEG1)
                        0x9FC00510  (KSEG0)

On entry:               A0 ($4)     Exit status (9=ok, nonzero=fail)
On return:              Does not return
Registers used:         All


DUMP GENERAL REGISTERS
----------------------

Description:

   This routine causes CFE to display a register dump on the console
   port.  It is assumed that the console hardware state has not been
   altered by the diagnostic.  

   The format of the register dump is:  TBD [XXX should it look like the
   one that the functional simulator uses?]

   The firmware needs one scratch register.


Routine address:        0xBFC00520 (KSEG1)
                        0x9FC00520 (KSEG0)

On Entry:               RA ($31)    Return Address
On Return:              nothing
Registers used:         K0 ($26)    Scratch register for CFE


SET LOG BUFFER
--------------

Description:

   This routine sets the address of the log buffer.  This
   call must be made once at the beginning of the diagnostic
   or else the "SAVE" functions will be considered as
   NOPs.  

   The buffer addresses must be 64-bit aligned.

Routine address:	0xBFC00530 (KSEG1)
			0x9FC00530 (KSEG0)

On Entry:               RA ($31)    Return Address
                        A0 ($4)     Address of start of buffer
                        A1 ($5)     Address of end of buffer
On Return:              Nothing
Registers Used:         K0 ($26)    Scratch register for CFE



LOG SINGLE VALUE
----------------

Description:

   This routine saves a single 64-bit value in the log.


Routine address:	0xBFC00540 (KSEG1)
			0x9FC00540 (KSEG0)

On Entry:               RA ($31)    Return Address
                        A0 ($4)     Low 32 bits are ID code for value
                        A1 ($5)     Value to log
On Return:              Nothing
Registers Used:         K0 ($26)    Scratch register for CFE



LOG MEMORY DATA
---------------

Description:

   This routine saves a block of memory in the log.  The source
   buffer must be 64-bit aligned.


Routine address:	0xBFC00550 (KSEG1)
			0x9FC00550 (KSEG0)

On Entry:               RA ($31)    Return Address
                        A0 ($4)     Low 32 bits are ID code for values
                        A1 ($5)     Address of buffer containing values
                        A2 ($6)     Number of 64-bit words to store
On Return:              Nothing
Registers Used:         K0 ($26)    Scratch register for CFE





SAVE SOC STATE
--------------

Description:

   This routine saves the SOC state in a user-supplied buffer.
   The buffer must be large enough to accomodate the SOC state.
   The SOC state will be written as records with the following
   format:

        uint64_t        phys_address
        uint64_t        value
        uint64_t        phys_address
        uint64_t        value
        ...
        uint64_t        phys_address
        uint64_t        value

   The table of SOC registers to dump will be maintained by 
   the firmware.

   The firmware needs one scratch register.

Routine address:        0xBFC00570 (KSEG1)
                        0x9FC00570 (KSEG0)

On entry:               A0 ($4)    Low 32 bits are ID code for values
                        A1 ($5)    Bitmask of agents to store in log
On return:              nothing
Registers used:         K0 ($26)   Scratch register for CFE
        

SAVE CPU REGISTERS
------------------

Description:

   This routine saves the CPU general registers and certain CP0
   registers in a user-supplied buffer.

   This buffer must be large enough to accomodate the data
   that will be saved.  The registers will be written in 
   the following format:

        uint64_t        general_registers[32]
	uint64_t	C0_INX
	uint64_t	C0_RAND
	uint64_t	C0_TLBLO0
	uint64_t	C0_TLBLO1
	uint64_t	C0_CTEXT
	uint64_t	C0_PGMASK
	uint64_t	C0_WIRED
	uint64_t	C0_BADVADDR
	uint64_t	C0_COUNT
	uint64_t	C0_TLBHI
	uint64_t	C0_COMPARE
	uint64_t	C0_SR
	uint64_t	C0_CAUSE
	uint64_t	C0_EPC
	uint64_t	C0_PRID
	uint64_t	C0_CONFIG
	uint64_t	C0_LLADDR
	uint64_t	C0_WATCHLO
	uint64_t	C0_WATCHHI
	uint64_t	C0_XCTEXT
	uint64_t	C0_ECC
	uint64_t	C0_CACHEERR
	uint64_t	C0_TAGLO
	uint64_t	C0_TAGHI
	uint64_t	C0_ERREPC

   The firmware needs one scratch register.

Routine address:        0xBFC00580 (KSEG1)
                        0x9FC00580 (KSEG0)

On entry:               RA ($31)   Return address
                        A0 ($4)    Low 32 bits are ID code for values
On return:              nothing
Registers used:         K0 ($26)   Scratch register for CFE


SAVE FPU REGISTERS
------------------

Description:

   This routine saves the floating point and floating point
   control registers. The registers will be written in 
   the following format:

        uint64_t        fp_registers[32]
	uint64_t	fp_fir
	uint64_t	fp_status
	uint64_t	fp_condition_codes
	uint64_t	fp_exceptions
	uint64_t	fp_enables

   The firmware needs one scratch register.

Routine address:        0xBFC005B0 (KSEG1)
                        0x9FC005B0 (KSEG0)

On entry:               RA ($31)   Return address
                        A0 ($4)    Low 32 bits are ID code for values
On return:              nothing
Registers used:         K0 ($26)   Scratch register for CFE


DUMP STRING
-----------

Description:

   This routine displays a zero-terminated ASCII text string on the
   console port.  

   The firmware needs one scratch register.


Routine address:        0xBFC00590 (KSEG1)
                        0x9FC00590 (KSEG0)

On entry:               RA ($31)    Return address
                        A0 ($4)     Pointer to null-terminated string
On return:              nothing
Registers used:         K0 ($26)    Scratch register for CFE



SHOW LED MESSAGE
----------------

Description:

   This routine writes four characters onto the SWARM board LEDs. 
   Writing to the LEDs is very fast compared to writing to the 
   console and can be useful for providing progress feedback
   during a run.

   The characters are packed into the low 4 bytes of register A0.
   The string ABCD would be hex 0x0000_0000_4142_4344

   The firmware needs one scratch register

Routine address:        0xBFC005A0 (KSEG1)
                        0x9FC005A0 (KSEG0)

On entry:               RA ($31)    Return Address
                        A0 ($4)     Four characters
On return:              nothing
Registers used:         K0 ($26)    Scratch register for CFE

------------------------------------------------------------------------