1/*  *********************************************************************
2    *  Broadcom Common Firmware Environment (CFE)
3    *
4    *  Verification Test APIs			File: vapisubr.c
5    *
6    *  This module contains special low-level routines for use
7    *  by verification programs.  The routines here are the "C"
8    *  routines for higher-level functions.
9    *
10    *  Author:  Mitch Lichtenberg
11    *
12    *********************************************************************
13    *
14    *  Copyright 2000,2001,2002,2003
15    *  Broadcom Corporation. All rights reserved.
16    *
17    *  This software is furnished under license and may be used and
18    *  copied only in accordance with the following terms and
19    *  conditions.  Subject to these conditions, you may download,
20    *  copy, install, use, modify and distribute modified or unmodified
21    *  copies of this software in source and/or binary form.  No title
22    *  or ownership is transferred hereby.
23    *
24    *  1) Any source code used, modified or distributed must reproduce
25    *     and retain this copyright notice and list of conditions
26    *     as they appear in the source file.
27    *
28    *  2) No right is granted to use any trade name, trademark, or
29    *     logo of Broadcom Corporation.  The "Broadcom Corporation"
30    *     name may not be used to endorse or promote products derived
31    *     from this software without the prior written permission of
32    *     Broadcom Corporation.
33    *
34    *  3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
35    *     IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
36    *     WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37    *     PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
38    *     SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
39    *     PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
40    *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
41    *     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
42    *     GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43    *     BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
44    *     OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
45    *     TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
46    *     THE POSSIBILITY OF SUCH DAMAGE.
47    ********************************************************************* */
48
49#include "cfe.h"
50
51#include "sbmips.h"
52
53#if CFG_VAPI
54
55void vapi_doputs(char *str);
56void vapi_dodumpregs(uint64_t *gprs);
57
58const static char * const gpregnames[] = {
59    "$0/zero","$1/AT","$2/v0","$3/v1","$4/a0","$5/a1","$6/a2","$7/a3",
60    "$8/t0","$9/t1","$10/t2","$11/t3","$12/t4","$13/t5","$14/t6","$15/t7",
61    "$16/s0","$17/s1","$18/s2","$19/s3","$20/s4","$21/s5","$22/s6","$23/s7",
62    "$24/t8","$25/t9","$26/k0","$27/k1","$28/gp","$29/sp","$30/fp","$31/ra",
63    "INX",
64    "RAND",
65    "TLBLO0",
66    "TLBLO1",
67    "CTEXT",
68    "PGMASK",
69    "WIRED",
70    "BADVADDR",
71    "COUNT",
72    "TLBHI",
73    "COMPARE",
74    "SR",
75    "CAUSE",
76    "EPC",
77    "PRID",
78    "CONFIG",
79    "LLADDR",
80    "WATCHLO",
81    "WATCHHI",
82    "XCTEXT",
83    "ECC",
84    "CACHEERR",
85    "TAGLO",
86    "TAGHI",
87    "ERREPC"};
88
89
90
91
92void vapi_doputs(char *str)
93{
94    xprintf("# %s\n",str);
95}
96
97void vapi_dodumpregs(uint64_t *gprs)
98{
99    int cnt = sizeof(gpregnames)/sizeof(char *);
100    int idx;
101
102    xprintf("# GPRS:\n");
103    for (idx = 0; idx < cnt; idx++) {
104	if ((idx & 1) == 0) xprintf("# ");
105	xprintf(" %8s=%016llX ",gpregnames[idx],gprs[idx]);
106	if ((idx & 1) == 1) xprintf("\n");
107	}
108    xprintf("\n");
109
110}
111
112#endif /* CFG_VAPI */
113
114/*  *********************************************************************
115    *  End
116    ********************************************************************* */
117
118
119