xref: /illumos-gate/usr/src/uts/sun4v/io/n2rng/n2rng_hcall.S (revision d48be21240dfd051b689384ce2b23479d757f2d8)
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/*
27 * Hypervisor calls called by ncp driver.
28 */
29
30#include <sys/asm_linkage.h>
31#include <sys/hypervisor_api.h>
32#include <sys/n2rng.h>
33
34	/*
35	 * hv_rng_get_diag_control()
36	 */
37	ENTRY(hv_rng_get_diag_control)
38	mov	HV_RNG_GET_DIAG_CONTROL, %o5
39	ta	FAST_TRAP
40	retl
41	nop
42	SET_SIZE(hv_rng_get_diag_control)
43
44	/*
45	 * hv_rng_ctl_read(uint64_t ctlregsptr_ra, uint64_t *rstate,
46	 *         uint64_t *tdelta)
47	 */
48	ENTRY(hv_rng_ctl_read)
49	mov	%o1, %o3
50	mov	%o2, %o4
51	mov	HV_RNG_CTL_READ, %o5
52	ta	FAST_TRAP
53	stx	%o1, [%o3]
54	retl
55	stx	%o2, [%o4]
56	SET_SIZE(hv_rng_ctl_read)
57
58	/*
59	 * hv_rng_ctl_read_v2(uint64_t ctlregsptr_ra, uint64_t rngid,
60	 *         uint64_t *rstate, uint64_t *tdelta, uint64_t *wdelta,
61	 *         uint64_t *wstatus)
62	 */
63	ENTRY(hv_rng_ctl_read_v2)
64        save    %sp, -SA(MINFRAME64), %sp
65        mov     %i0, %o0
66        mov     %i1, %o1
67        mov     HV_RNG_CTL_READ, %o5
68        ta      FAST_TRAP
69        mov     %o0, %i0        ! trap status
70        stx     %o1, [%i2]      ! save status
71        stx     %o2, [%i3]      ! save delta
72        stx     %o3, [%i4]      ! save watchdog
73        stx     %o4, [%i5]      ! save write status
74        ret
75        restore
76	SET_SIZE(hv_rng_ctl_read_v2)
77
78	/*
79	 * hv_rng_ctl_write(uint64_t ctlregsptr_ra, uint64_t nstate,
80	 *         uint64_t wtimeout, uint64_t *tdelta)
81	 */
82	ENTRY(hv_rng_ctl_write)
83	mov	%o3, %o4
84	mov	HV_RNG_CTL_WRITE, %o5
85	ta	FAST_TRAP
86	retl
87	stx	%o1, [%o4]
88	SET_SIZE(hv_rng_ctl_write)
89
90	/*
91	 * hv_rng_ctl_write_v2(uint64_t ctlregsptr_ra, uint64_t nstate,
92	 *         uint64_t wtimeout, uint64_t rngid)
93	 */
94	ENTRY(hv_rng_ctl_write_v2)
95	mov	HV_RNG_CTL_WRITE, %o5
96	ta	FAST_TRAP
97	retl
98	nop
99	SET_SIZE(hv_rng_ctl_write_v2)
100
101	/*
102	 * hv_rng_data_read_diag(uint64_t buffer_ra, uint64_t sz,
103	 *         uint64_t *tdelta)
104	 */
105	ENTRY(hv_rng_data_read_diag)
106	mov	%o2, %o4
107	mov	HV_RNG_DATA_READ_DIAG, %o5
108	ta	FAST_TRAP
109	retl
110	stx	%o1, [%o4]
111	SET_SIZE(hv_rng_data_read_diag)
112
113	/*
114	 * hv_rng_data_read_diag_v2(uint64_t buffer_ra, uint64_t sz,
115	 *         uint64_t rngid, uint64_t *tdelta)
116	 */
117	ENTRY(hv_rng_data_read_diag_v2)
118	mov	%o3, %o4
119	mov	HV_RNG_DATA_READ_DIAG, %o5
120	ta	FAST_TRAP
121	retl
122	stx	%o1, [%o4]
123	SET_SIZE(hv_rng_data_read_diag_v2)
124
125	/*
126	 * hv_rng_data_read(uint64_t buffer_ra, uint64_t *tdelta)
127	 */
128	ENTRY(hv_rng_data_read)
129	mov	%o1, %o4
130	mov	HV_RNG_DATA_READ, %o5
131	ta	FAST_TRAP
132	retl
133	stx	%o1, [%o4]
134	SET_SIZE(hv_rng_data_read)
135
136