1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#pragma ident	"%Z%%M%	%I%	%E% SMI"
27
28/*
29 * Hypervisor calls called by glvc driver.
30*/
31
32#include <sys/asm_linkage.h>
33#include <sys/hypervisor_api.h>
34#include <sys/glvc.h>
35
36#if defined(lint) || defined(__lint)
37
38/*ARGSUSED*/
39uint64_t
40hv_service_recv(uint64_t s_id, uint64_t buf_pa, uint64_t size,
41    uint64_t *recv_bytes)
42{ return (0); }
43
44/*ARGSUSED*/
45uint64_t
46hv_service_send(uint64_t s_id, uint64_t buf_pa, uint64_t size,
47    uint64_t *send_bytes)
48{ return (0); }
49
50/*ARGSUSED*/
51uint64_t
52hv_service_getstatus(uint64_t s_id, uint64_t *vreg)
53{ return (0); }
54
55/*ARGSUSED*/
56uint64_t
57hv_service_setstatus(uint64_t s_id, uint64_t bits)
58{ return (0); }
59
60/*ARGSUSED*/
61uint64_t
62hv_service_clrstatus(uint64_t s_id, uint64_t bits)
63{ return (0); }
64
65#else	/* lint || __lint */
66
67	/*
68	 * hv_service_recv(uint64_t s_id, uint64_t buf_pa,
69	 *     uint64_t size, uint64_t *recv_bytes);
70	 */
71	ENTRY(hv_service_recv)
72	save	%sp, -SA(MINFRAME), %sp
73	mov	%i0, %o0
74	mov	%i1, %o1
75	mov	%i2, %o2
76	mov	%i3, %o3
77	mov	SVC_RECV, %o5
78	ta	FAST_TRAP
79	brnz	%o0, 1f
80	mov	%o0, %i0
81	stx	%o1, [%i3]
821:
83	ret
84	restore
85	SET_SIZE(hv_service_recv)
86
87	/*
88	 * hv_service_send(uint64_t s_id, uint64_t buf_pa,
89	 *     uint64_t size, uint64_t *recv_bytes);
90	 */
91	ENTRY(hv_service_send)
92	save	%sp, -SA(MINFRAME), %sp
93	mov	%i0, %o0
94	mov	%i1, %o1
95	mov	%i2, %o2
96	mov	%i3, %o3
97	mov	SVC_SEND, %o5
98	ta	FAST_TRAP
99	brnz	%o0, 1f
100	mov	%o0, %i0
101	stx	%o1, [%i3]
1021:
103	ret
104	restore
105	SET_SIZE(hv_service_send)
106
107	/*
108	 * hv_service_getstatus(uint64_t s_id, uint64_t *vreg);
109	 */
110	ENTRY(hv_service_getstatus)
111	mov	%o1, %o4			! save datap
112	mov	SVC_GETSTATUS, %o5
113	ta	FAST_TRAP
114	brz,a	%o0, 1f
115	stx	%o1, [%o4]
1161:
117	retl
118	nop
119	SET_SIZE(hv_service_getstatus)
120
121	/*
122	 * hv_service_setstatus(uint64_t s_id, uint64_t bits);
123	 */
124	ENTRY(hv_service_setstatus)
125	mov	SVC_SETSTATUS, %o5
126	ta	FAST_TRAP
127	retl
128	nop
129	SET_SIZE(hv_service_setstatus)
130
131	/*
132	 * hv_service_clrstatus(uint64_t s_id, uint64_t bits);
133	 */
134	ENTRY(hv_service_clrstatus)
135	mov	SVC_CLRSTATUS, %o5
136	ta	FAST_TRAP
137	retl
138	nop
139	SET_SIZE(hv_service_clrstatus)
140
141#endif	/* lint || __lint */
142