xref: /openbmc/linux/drivers/char/hw_random/n2-asm.S (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */
2ce087150SDavid S. Miller/* n2-asm.S: Niagara2 RNG hypervisor call assembler.
3ce087150SDavid S. Miller *
4ce087150SDavid S. Miller * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
5ce087150SDavid S. Miller */
6ce087150SDavid S. Miller#include <linux/linkage.h>
7ce087150SDavid S. Miller#include <asm/hypervisor.h>
8ce087150SDavid S. Miller#include "n2rng.h"
9ce087150SDavid S. Miller
10ce087150SDavid S. Miller	.text
11ce087150SDavid S. Miller
12ce087150SDavid S. MillerENTRY(sun4v_rng_get_diag_ctl)
13ce087150SDavid S. Miller	mov	HV_FAST_RNG_GET_DIAG_CTL, %o5
14ce087150SDavid S. Miller	ta	HV_FAST_TRAP
15ce087150SDavid S. Miller	retl
16ce087150SDavid S. Miller	 nop
17ce087150SDavid S. MillerENDPROC(sun4v_rng_get_diag_ctl)
18ce087150SDavid S. Miller
19ce087150SDavid S. MillerENTRY(sun4v_rng_ctl_read_v1)
20ce087150SDavid S. Miller	mov	%o1, %o3
21ce087150SDavid S. Miller	mov	%o2, %o4
22ce087150SDavid S. Miller	mov	HV_FAST_RNG_CTL_READ, %o5
23ce087150SDavid S. Miller	ta	HV_FAST_TRAP
24ce087150SDavid S. Miller	stx	%o1, [%o3]
25ce087150SDavid S. Miller	retl
26ce087150SDavid S. Miller	 stx	%o2, [%o4]
27ce087150SDavid S. MillerENDPROC(sun4v_rng_ctl_read_v1)
28ce087150SDavid S. Miller
29ce087150SDavid S. MillerENTRY(sun4v_rng_ctl_read_v2)
30ce087150SDavid S. Miller	save	%sp, -192, %sp
31ce087150SDavid S. Miller	mov	%i0, %o0
32ce087150SDavid S. Miller	mov	%i1, %o1
33ce087150SDavid S. Miller	mov	HV_FAST_RNG_CTL_READ, %o5
34ce087150SDavid S. Miller	ta	HV_FAST_TRAP
35ce087150SDavid S. Miller	stx	%o1, [%i2]
36ce087150SDavid S. Miller	stx	%o2, [%i3]
37ce087150SDavid S. Miller	stx	%o3, [%i4]
38ce087150SDavid S. Miller	stx	%o4, [%i5]
39ce087150SDavid S. Miller	ret
40ce087150SDavid S. Miller	restore	%g0, %o0, %o0
41ce087150SDavid S. MillerENDPROC(sun4v_rng_ctl_read_v2)
42ce087150SDavid S. Miller
43ce087150SDavid S. MillerENTRY(sun4v_rng_ctl_write_v1)
44ce087150SDavid S. Miller	mov	%o3, %o4
45ce087150SDavid S. Miller	mov	HV_FAST_RNG_CTL_WRITE, %o5
46ce087150SDavid S. Miller	ta	HV_FAST_TRAP
47ce087150SDavid S. Miller	retl
48ce087150SDavid S. Miller	 stx	%o1, [%o4]
49ce087150SDavid S. MillerENDPROC(sun4v_rng_ctl_write_v1)
50ce087150SDavid S. Miller
51ce087150SDavid S. MillerENTRY(sun4v_rng_ctl_write_v2)
52ce087150SDavid S. Miller	mov	HV_FAST_RNG_CTL_WRITE, %o5
53ce087150SDavid S. Miller	ta	HV_FAST_TRAP
54ce087150SDavid S. Miller	retl
55ce087150SDavid S. Miller	 nop
56ce087150SDavid S. MillerENDPROC(sun4v_rng_ctl_write_v2)
57ce087150SDavid S. Miller
58ce087150SDavid S. MillerENTRY(sun4v_rng_data_read_diag_v1)
59ce087150SDavid S. Miller	mov	%o2, %o4
60ce087150SDavid S. Miller	mov	HV_FAST_RNG_DATA_READ_DIAG, %o5
61ce087150SDavid S. Miller	ta	HV_FAST_TRAP
62ce087150SDavid S. Miller	retl
63ce087150SDavid S. Miller	 stx	%o1, [%o4]
64ce087150SDavid S. MillerENDPROC(sun4v_rng_data_read_diag_v1)
65ce087150SDavid S. Miller
66ce087150SDavid S. MillerENTRY(sun4v_rng_data_read_diag_v2)
67ce087150SDavid S. Miller	mov	%o3, %o4
68ce087150SDavid S. Miller	mov	HV_FAST_RNG_DATA_READ_DIAG, %o5
69ce087150SDavid S. Miller	ta	HV_FAST_TRAP
70ce087150SDavid S. Miller	retl
71ce087150SDavid S. Miller	 stx	%o1, [%o4]
72ce087150SDavid S. MillerENDPROC(sun4v_rng_data_read_diag_v2)
73ce087150SDavid S. Miller
74ce087150SDavid S. MillerENTRY(sun4v_rng_data_read)
75ce087150SDavid S. Miller	mov	%o1, %o4
76ce087150SDavid S. Miller	mov	HV_FAST_RNG_DATA_READ, %o5
77ce087150SDavid S. Miller	ta	HV_FAST_TRAP
78ce087150SDavid S. Miller	retl
79ce087150SDavid S. Miller	 stx	%o1, [%o4]
80ce087150SDavid S. MillerENDPROC(sun4v_rng_data_read)
81