Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sim_def.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 Tilera Corporation. All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation, version 2.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11  * NON INFRINGEMENT. See the GNU General Public License for
12  * more details.
13  */
14 
21 #ifndef __ARCH_SIM_DEF_H__
22 #define __ARCH_SIM_DEF_H__
23 
24 
30 #define _SIM_CONTROL_OPERATOR_BITS 8
31 
32 
33 /*
34  * Values which can be written to SPR_SIM_CONTROL.
35  */
36 
38 #define SIM_CONTROL_PROFILER_DISABLE 0
39 
41 #define SIM_CONTROL_PROFILER_ENABLE 1
42 
44 #define SIM_CONTROL_PROFILER_CLEAR 2
45 
47 #define SIM_CONTROL_CHECKPOINT 3
48 
53 #define SIM_CONTROL_SET_TRACING 4
54 
59 #define SIM_CONTROL_DUMP 5
60 
62 #define SIM_CONTROL_PROFILER_CHIP_CLEAR 6
63 
65 #define SIM_CONTROL_PROFILER_CHIP_DISABLE 7
66 
68 #define SIM_CONTROL_PROFILER_CHIP_ENABLE 8
69 
71 #define SIM_CONTROL_ENABLE_FUNCTIONAL 9
72 
74 #define SIM_CONTROL_DISABLE_FUNCTIONAL 10
75 
82 #define SIM_CONTROL_ENABLE_FUNCTIONAL_BARRIER 11
83 
90 /* ISSUE: Document the meaning of "newline", and the handling of NUL. */
91 #define SIM_CONTROL_PUTC 12
92 
99 #define SIM_CONTROL_GRINDER_CLEAR 13
100 
102 #define SIM_CONTROL_SHUTDOWN 14
103 
108 #define SIM_CONTROL_OS_FORK 15
109 
114 #define SIM_CONTROL_OS_EXIT 16
115 
120 #define SIM_CONTROL_OS_SWITCH 17
121 
127 #define SIM_CONTROL_OS_EXEC 18
128 
135 #define SIM_CONTROL_OS_INTERP 19
136 
143 #define SIM_CONTROL_DLOPEN 20
144 
151 #define SIM_CONTROL_DLCLOSE 21
152 
159 #define SIM_CONTROL_ALLOW_MULTIPLE_CACHING 22
160 
162 #define SIM_CONTROL_ENABLE_MEM_LOGGING 23
163 
165 #define SIM_CONTROL_DISABLE_MEM_LOGGING 24
166 
172 #define SIM_CONTROL_SHAPING 25
173 
179 #define SIM_CONTROL_COMMAND 26
180 
185 #define SIM_CONTROL_PANIC 27
186 
191 #define SIM_CONTROL_SYSCALL 32
192 
198 #define SIM_CONTROL_OS_FORK_PARENT 33
199 
206 #define SIM_CONTROL_CLEAR_MPIPE_MAGIC_BYTES 34
207 
214 #define SIM_CONTROL_APPEND_MPIPE_MAGIC_BYTE 35
215 
222 #define SIM_CONTROL_ENABLE_MPIPE_LINK_MAGIC_BYTE 36
223 
224 
225 /*
226  * Syscall numbers for use with "sim_syscall()".
227  */
228 
230 #define SIM_SYSCALL_ADD_WATCHPOINT 2
231 
233 #define SIM_SYSCALL_REMOVE_WATCHPOINT 3
234 
236 #define SIM_SYSCALL_QUERY_WATCHPOINT 4
237 
244 #define SIM_SYSCALL_VALIDATE_LINES_EVICTED 5
245 
247 #define SIM_SYSCALL_QUERY_CPU_SPEED 6
248 
249 
250 /*
251  * Bit masks which can be shifted by 8, combined with
252  * SIM_CONTROL_SET_TRACING, and written to SPR_SIM_CONTROL.
253  */
254 
261 #define SIM_TRACE_CYCLES 0x01
262 
264 #define SIM_TRACE_ROUTER 0x02
265 
267 #define SIM_TRACE_REGISTER_WRITES 0x04
268 
270 #define SIM_TRACE_DISASM 0x08
271 
273 #define SIM_TRACE_STALL_INFO 0x10
274 
276 #define SIM_TRACE_MEMORY_CONTROLLER 0x20
277 
279 #define SIM_TRACE_L2_CACHE 0x40
280 
282 #define SIM_TRACE_LINES 0x80
283 
285 #define SIM_TRACE_NONE 0
286 
288 #define SIM_TRACE_ALL (-1)
289 
293 #define SIM_TRACE_SPR_ARG(mask) \
294  (SIM_CONTROL_SET_TRACING | ((mask) << _SIM_CONTROL_OPERATOR_BITS))
295 
296 
297 /*
298  * Bit masks which can be shifted by 8, combined with
299  * SIM_CONTROL_DUMP, and written to SPR_SIM_CONTROL.
300  */
301 
308 #define SIM_DUMP_REGS 0x001
309 
311 #define SIM_DUMP_SPRS 0x002
312 
314 #define SIM_DUMP_ITLB 0x004
315 
317 #define SIM_DUMP_DTLB 0x008
318 
320 #define SIM_DUMP_L1I 0x010
321 
323 #define SIM_DUMP_L1D 0x020
324 
326 #define SIM_DUMP_L2 0x040
327 
329 #define SIM_DUMP_SNREGS 0x080
330 
332 #define SIM_DUMP_SNITLB 0x100
333 
335 #define SIM_DUMP_SNL1I 0x200
336 
338 #define SIM_DUMP_BACKTRACE 0x400
339 
341 #define SIM_DUMP_VALID_LINES 0x800
342 
344 #define SIM_DUMP_ALL (-1 & ~SIM_DUMP_VALID_LINES)
345 
349 #define SIM_DUMP_SPR_ARG(mask) \
350  (SIM_CONTROL_DUMP | ((mask) << _SIM_CONTROL_OPERATOR_BITS))
351 
352 
353 /*
354  * Bit masks which can be shifted by 8, combined with
355  * SIM_CONTROL_PROFILER_CHIP_xxx, and written to SPR_SIM_CONTROL.
356  */
357 
364 #define SIM_CHIP_MEMCTL 0x001
365 
367 #define SIM_CHIP_XAUI 0x002
368 
370 #define SIM_CHIP_PCIE 0x004
371 
373 #define SIM_CHIP_MPIPE 0x008
374 
376 #define SIM_CHIP_TRIO 0x010
377 
379 #define SIM_CHIP_ALL (-1)
380 
384 #define SIM_PROFILER_CHIP_CLEAR_SPR_ARG(mask) \
385  (SIM_CONTROL_PROFILER_CHIP_CLEAR | ((mask) << _SIM_CONTROL_OPERATOR_BITS))
386 
388 #define SIM_PROFILER_CHIP_DISABLE_SPR_ARG(mask) \
389  (SIM_CONTROL_PROFILER_CHIP_DISABLE | ((mask) << _SIM_CONTROL_OPERATOR_BITS))
390 
392 #define SIM_PROFILER_CHIP_ENABLE_SPR_ARG(mask) \
393  (SIM_CONTROL_PROFILER_CHIP_ENABLE | ((mask) << _SIM_CONTROL_OPERATOR_BITS))
394 
395 
396 
397 /* Shim bitrate controls. */
398 
400 #define SIM_CONTROL_SHAPING_SHIM_ID_BITS 3
401 
408 #define SIM_CONTROL_SHAPING_GBE_0 0x0
409 
411 #define SIM_CONTROL_SHAPING_GBE_1 0x1
412 
414 #define SIM_CONTROL_SHAPING_GBE_2 0x2
415 
417 #define SIM_CONTROL_SHAPING_GBE_3 0x3
418 
420 #define SIM_CONTROL_SHAPING_XGBE_0 0x4
421 
423 #define SIM_CONTROL_SHAPING_XGBE_1 0x5
424 
426 #define SIM_CONTROL_SHAPING_TYPE_BITS 2
427 
429 #define SIM_CONTROL_SHAPING_MULTIPLIER 0
430 
432 #define SIM_CONTROL_SHAPING_PPS 1
433 
435 #define SIM_CONTROL_SHAPING_BPS 2
436 
438 #define SIM_CONTROL_SHAPING_UNITS_BITS 2
439 
441 #define SIM_CONTROL_SHAPING_UNITS_SINGLE 0
442 
444 #define SIM_CONTROL_SHAPING_UNITS_KILO 1
445 
447 #define SIM_CONTROL_SHAPING_UNITS_MEGA 2
448 
450 #define SIM_CONTROL_SHAPING_UNITS_GIGA 3
451 
455 #define SIM_CONTROL_SHAPING_RATE_BITS \
456  (32 - (_SIM_CONTROL_OPERATOR_BITS + \
457  SIM_CONTROL_SHAPING_SHIM_ID_BITS + \
458  SIM_CONTROL_SHAPING_TYPE_BITS + \
459  SIM_CONTROL_SHAPING_UNITS_BITS))
460 
462 #define SIM_SHAPING_SPR_ARG(shim, type, units, rate) \
463  (SIM_CONTROL_SHAPING | \
464  ((shim) | \
465  ((type) << (SIM_CONTROL_SHAPING_SHIM_ID_BITS)) | \
466  ((units) << (SIM_CONTROL_SHAPING_SHIM_ID_BITS + \
467  SIM_CONTROL_SHAPING_TYPE_BITS)) | \
468  ((rate) << (SIM_CONTROL_SHAPING_SHIM_ID_BITS + \
469  SIM_CONTROL_SHAPING_TYPE_BITS + \
470  SIM_CONTROL_SHAPING_UNITS_BITS))) << _SIM_CONTROL_OPERATOR_BITS)
471 
472 
473 /*
474  * Values returned when reading SPR_SIM_CONTROL.
475  * ISSUE: These names should share a longer common prefix.
476  */
477 
482 #define SIM_TRACE_FLAG_MASK 0xFFFF
483 
485 #define SIM_PROFILER_ENABLED_MASK 0x10000
486 
487 
488 /*
489  * Special arguments for "SIM_CONTROL_PUTC".
490  */
491 
496 #define SIM_PUTC_FLUSH_STRING 0x100
497 
502 #define SIM_PUTC_FLUSH_BINARY 0x101
503 
504 
505 #endif /* __ARCH_SIM_DEF_H__ */