xref: /titanic_51/usr/src/uts/sun4v/io/n2rng/n2rng_hcall.s (revision 1e49577a7fcde812700ded04431b49d67cc57d6d)
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 2007 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 ncp driver.
30 */
31
32#include <sys/asm_linkage.h>
33#include <sys/hypervisor_api.h>
34#include <sys/n2rng.h>
35
36#if defined(lint) || defined(__lint)
37
38/*ARGSUSED*/
39uint64_t
40hv_rng_get_diag_control()
41{ return (0); }
42
43/*ARGSUSED*/
44uint64_t
45hv_rng_ctl_read(uint64_t ctlregsptr_ra, uint64_t *rstate, uint64_t *tdelta)
46{ return (0); }
47
48/*ARGSUSED*/
49uint64_t
50hv_rng_ctl_read_v2(uint64_t ctlregsptr_ra, uint64_t rngid, uint64_t *rstate,
51		uint64_t *tdelta, uint64_t *wdelta, uint64_t *wstate)
52{ return (0); }
53
54/*ARGSUSED*/
55uint64_t
56hv_rng_ctl_write(uint64_t ctlregsptr_ra, uint64_t nstate, uint64_t wtimeout,
57		uint64_t *tdelta)
58{ return (0); }
59
60/*ARGSUSED*/
61uint64_t
62hv_rng_ctl_write_v2(uint64_t ctlregsptr_ra, uint64_t nstate, uint64_t wtimeout,
63		uint64_t rngid)
64{ return (0); }
65
66/*ARGSUSED*/
67uint64_t
68hv_rng_data_read_diag(uint64_t buffer_ra, uint64_t sz, uint64_t *tdelta)
69{ return (0); }
70
71/*ARGSUSED*/
72uint64_t
73hv_rng_data_read_diag_v2(uint64_t buffer_ra, uint64_t sz, uint64_t rngid,
74		uint64_t *tdelta)
75{ return (0); }
76
77/*ARGSUSED*/
78uint64_t
79hv_rng_data_read(uint64_t buffer_ra, uint64_t *tdelta)
80{ return (0); }
81
82#else	/* lint || __lint */
83
84	/*
85	 * hv_rng_get_diag_control()
86	 */
87	ENTRY(hv_rng_get_diag_control)
88	mov	HV_RNG_GET_DIAG_CONTROL, %o5
89	ta	FAST_TRAP
90	retl
91	nop
92	SET_SIZE(hv_rng_get_diag_control)
93
94	/*
95	 * hv_rng_ctl_read(uint64_t ctlregsptr_ra, uint64_t *rstate,
96	 *         uint64_t *tdelta)
97	 */
98	ENTRY(hv_rng_ctl_read)
99	mov	%o1, %o3
100	mov	%o2, %o4
101	mov	HV_RNG_CTL_READ, %o5
102	ta	FAST_TRAP
103	stx	%o1, [%o3]
104	retl
105	stx	%o2, [%o4]
106	SET_SIZE(hv_rng_ctl_read)
107
108	/*
109	 * hv_rng_ctl_read_v2(uint64_t ctlregsptr_ra, uint64_t rngid,
110	 *         uint64_t *rstate, uint64_t *tdelta, uint64_t *wdelta,
111	 *         uint64_t *wstatus)
112	 */
113	ENTRY(hv_rng_ctl_read_v2)
114        save    %sp, -SA(MINFRAME64), %sp
115        mov     %i0, %o0
116        mov     %i1, %o1
117        mov     HV_RNG_CTL_READ, %o5
118        ta      FAST_TRAP
119        mov     %o0, %i0        ! trap status
120        stx     %o1, [%i2]      ! save status
121        stx     %o2, [%i3]      ! save delta
122        stx     %o3, [%i4]      ! save watchdog
123        stx     %o4, [%i5]      ! save write status
124        ret
125        restore
126	SET_SIZE(hv_rng_ctl_read_v2)
127
128	/*
129	 * hv_rng_ctl_write(uint64_t ctlregsptr_ra, uint64_t nstate,
130	 *         uint64_t wtimeout, uint64_t *tdelta)
131	 */
132	ENTRY(hv_rng_ctl_write)
133	mov	%o3, %o4
134	mov	HV_RNG_CTL_WRITE, %o5
135	ta	FAST_TRAP
136	retl
137	stx	%o1, [%o4]
138	SET_SIZE(hv_rng_ctl_write)
139
140	/*
141	 * hv_rng_ctl_write_v2(uint64_t ctlregsptr_ra, uint64_t nstate,
142	 *         uint64_t wtimeout, uint64_t rngid)
143	 */
144	ENTRY(hv_rng_ctl_write_v2)
145	mov	HV_RNG_CTL_WRITE, %o5
146	ta	FAST_TRAP
147	retl
148	nop
149	SET_SIZE(hv_rng_ctl_write_v2)
150
151	/*
152	 * hv_rng_data_read_diag(uint64_t buffer_ra, uint64_t sz,
153	 *         uint64_t *tdelta)
154	 */
155	ENTRY(hv_rng_data_read_diag)
156	mov	%o2, %o4
157	mov	HV_RNG_DATA_READ_DIAG, %o5
158	ta	FAST_TRAP
159	retl
160	stx	%o1, [%o4]
161	SET_SIZE(hv_rng_data_read_diag)
162
163	/*
164	 * hv_rng_data_read_diag_v2(uint64_t buffer_ra, uint64_t sz,
165	 *         uint64_t rngid, uint64_t *tdelta)
166	 */
167	ENTRY(hv_rng_data_read_diag_v2)
168	mov	%o3, %o4
169	mov	HV_RNG_DATA_READ_DIAG, %o5
170	ta	FAST_TRAP
171	retl
172	stx	%o1, [%o4]
173	SET_SIZE(hv_rng_data_read_diag_v2)
174
175	/*
176	 * hv_rng_data_read(uint64_t buffer_ra, uint64_t *tdelta)
177	 */
178	ENTRY(hv_rng_data_read)
179	mov	%o1, %o4
180	mov	HV_RNG_DATA_READ, %o5
181	ta	FAST_TRAP
182	retl
183	stx	%o1, [%o4]
184	SET_SIZE(hv_rng_data_read)
185
186#endif	/* lint || __lint */
187