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 (mpl@broadcom.com)
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
50#include "sbmips.h"
51#include "bsp_config.h"
52#include "lib_types.h"
53#include "lib_printf.h"
54#include "lib_string.h"
55#include "cfe_console.h"
56
57#if CFG_VAPI
58
59void vapi_doputs(char *str);
60void vapi_dodumpregs(uint64_t *gprs);
61
62const static char * const gpregnames[] = {
63    "$0/zero","$1/AT","$2/v0","$3/v1","$4/a0","$5/a1","$6/a2","$7/a3",
64    "$8/t0","$9/t1","$10/t2","$11/t3","$12/t4","$13/t5","$14/t6","$15/t7",
65    "$16/s0","$17/s1","$18/s2","$19/s3","$20/s4","$21/s5","$22/s6","$23/s7",
66    "$24/t8","$25/t9","$26/k0","$27/k1","$28/gp","$29/sp","$30/fp","$31/ra",
67    "INX",
68    "RAND",
69    "TLBLO0",
70    "TLBLO1",
71    "CTEXT",
72    "PGMASK",
73    "WIRED",
74    "BADVADDR",
75    "COUNT",
76    "TLBHI",
77    "COMPARE",
78    "SR",
79    "CAUSE",
80    "EPC",
81    "PRID",
82    "CONFIG",
83    "LLADDR",
84    "WATCHLO",
85    "WATCHHI",
86    "XCTEXT",
87    "ECC",
88    "CACHEERR",
89    "TAGLO",
90    "TAGHI",
91    "ERREPC"};
92
93
94
95
96void vapi_doputs(char *str)
97{
98    xprintf("# %s\n",str);
99}
100
101void vapi_dodumpregs(uint64_t *gprs)
102{
103    int cnt = sizeof(gpregnames)/sizeof(char *);
104    int idx;
105
106    xprintf("# GPRS:\n");
107    for (idx = 0; idx < cnt; idx++) {
108	if ((idx & 1) == 0) xprintf("# ");
109	xprintf(" %8s=%016llX ",gpregnames[idx],gprs[idx]);
110	if ((idx & 1) == 1) xprintf("\n");
111	}
112    xprintf("\n");
113
114}
115
116#endif /* CFG_VAPI */
117
118/*  *********************************************************************
119    *  End
120    ********************************************************************* */
121