Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / hypervisor / src / greatlakes / common / include / svc_vbsc.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* Hypervisor Software File: svc_vbsc.h
5*
6* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
7*
8* - Do no alter or remove copyright notices
9*
10* - Redistribution and use of this software in source and binary forms, with
11* or without modification, are permitted provided that the following
12* conditions are met:
13*
14* - Redistribution of source code must retain the above copyright notice,
15* this list of conditions and the following disclaimer.
16*
17* - Redistribution in binary form must reproduce the above copyright notice,
18* this list of conditions and the following disclaimer in the
19* documentation and/or other materials provided with the distribution.
20*
21* Neither the name of Sun Microsystems, Inc. or the names of contributors
22* may be used to endorse or promote products derived from this software
23* without specific prior written permission.
24*
25* This software is provided "AS IS," without a warranty of any kind.
26* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
27* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
28* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
29* MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
30* ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
31* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
32* OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
33* FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
34* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
35* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
36* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
37*
38* You acknowledge that this software is not designed, licensed or
39* intended for use in the design, construction, operation or maintenance of
40* any nuclear facility.
41*
42* ========== Copyright Header End ============================================
43*/
44/*
45 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
46 * Use is subject to license terms.
47 */
48
49#ifndef _SVC_VBSC_H
50#define _SVC_VBSC_H
51
52#pragma ident "@(#)svc_vbsc.h 1.12 07/05/29 SMI"
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58#ifdef CONFIG_VBSC_SVC
59
60#define VBSC_CMD_READMEM 'R'
61#define VBSC_CMD_WRITEMEM 'W'
62#define VBSC_CMD_SENDERR 'E'
63#define VBSC_CMD_GUEST_STATE 'P'
64#define VBSC_CMD_GUEST_XIR 'X'
65#define VBSC_CMD_GUEST_TODOFFSET 'O'
66#define VBSC_CMD_HV 'H'
67
68#define GUEST_STATE_CMD_OFF 0
69#define GUEST_STATE_CMD_ON 1
70#define GUEST_STATE_CMD_RESET 2
71#define GUEST_STATE_CMD_SHUTREQ 3
72#define GUEST_STATE_CMD_WDEXPIRE 4
73#define GUEST_STATE_CMD_DCOREREQ 5
74
75
76#ifdef _ASM
77#define VBSC_CMD(x, y) ((0x80 << 56) | (((x) << 8) | (y)))
78#else
79#define VBSC_CMD(x, y) ((uint64_t)((0x80ULL << 56) | (((x) << 8) | (y))))
80#endif /* _ASM */
81#define VBSC_ACK(x, y) ((((x) << 8) | (y)))
82
83#define VBSC_GUEST_OFF VBSC_CMD(VBSC_CMD_GUEST_STATE, GUEST_STATE_CMD_OFF)
84#define VBSC_GUEST_ON VBSC_CMD(VBSC_CMD_GUEST_STATE, GUEST_STATE_CMD_ON)
85#define VBSC_GUEST_RESET VBSC_CMD(VBSC_CMD_GUEST_STATE, GUEST_STATE_CMD_RESET)
86#define VBSC_GUEST_WDEXPIRE \
87 VBSC_CMD(VBSC_CMD_GUEST_STATE, GUEST_STATE_CMD_WDEXPIRE)
88#define VBSC_GUEST_XIR VBSC_CMD(VBSC_CMD_GUEST_XIR, 0)
89#define VBSC_GUEST_TODOFFSET VBSC_CMD(VBSC_CMD_GUEST_TODOFFSET, 0)
90#define VBSC_HV_START VBSC_CMD(VBSC_CMD_HV, 'V')
91#define VBSC_HV_PING VBSC_CMD(VBSC_CMD_HV, 'I')
92#define VBSC_HV_ABORT VBSC_CMD(VBSC_CMD_HV, 'A')
93#define VBSC_HV_PLXRESET VBSC_CMD(VBSC_CMD_HV, 'P')
94/*
95 * HV_GUEST_SHUTDOWN_REQ - send the guest a graceful shutdown resumable
96 * error report
97 *
98 * word0: VBSC_HV_GUEST_SHUTDOWN_REQ
99 * word1: xid
100 * word2: grace period in seconds
101 */
102#define VBSC_HV_GUEST_SHUTDOWN_REQ \
103 VBSC_CMD(VBSC_CMD_GUEST_STATE, GUEST_STATE_CMD_SHUTREQ)
104
105/*
106 * HV_GUEST_DCORE_REQ - send the guest a forced panic non-resumable
107 * error report
108 *
109 * word0: VBSC_HV_GUEST_DCORE_REQ
110 * word1: xid
111 */
112#define VBSC_HV_GUEST_DCORE_REQ \
113 VBSC_CMD(VBSC_CMD_GUEST_STATE, GUEST_STATE_CMD_DCOREREQ)
114
115
116/*
117 * Debugging aids, emitted on hte vbsc HV "console" (TCP port 2001)
118 *
119 * putchars - writes up to 8 characters, leading NUL characters are ignored
120 *
121 * puthex - writes a 64-bit hex number
122 */
123#define VBSC_HV_PUTCHARS VBSC_CMD(VBSC_CMD_HV, 'C')
124#define VBSC_HV_PUTHEX VBSC_CMD(VBSC_CMD_HV, 'N')
125
126#endif /* CONFIG_VBSC_SVC */
127
128#ifndef _ASM
129
130struct vbsc_ctrl_pkt {
131 uint64_t cmd;
132 uint64_t arg0;
133 uint64_t arg1;
134 uint64_t arg2;
135};
136
137
138/*
139 * For debugging mailbox channels
140 */
141struct dbgerror_payload {
142 uint64_t data[63];
143};
144
145struct dbgerror {
146 uint64_t error_svch;
147 struct dbgerror_payload payload;
148};
149
150extern void config_svcchans();
151extern void error_svc_rx();
152extern void error_svc_tx();
153extern void vbsc_rx();
154extern void vbsc_tx();
155extern int svc_intr_getstate(void *);
156
157#endif /* !_ASM */
158
159#ifdef __cplusplus
160}
161#endif
162
163#endif /* _SVC_VBSC_H */