]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - include/sm.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2023 SberDevices, Inc.
5 * Author: Alexey Romanov <avromanov@salutedevices.ru>
12 * NOTE: UCLASS_SM is designed with the idea that
13 * each driver should convert @cmd to some raw
14 * value, which is known only for driver, and set this
15 * value to the first element of the @args->regs array.
16 * Therefore, it is necessary to pass the remaining
17 * arguments starting at index = 1. Anyway, driver
18 * implementation may vary, so, please, check the specific
19 * implementation of the driver you are using.
22 #include <asm/types.h>
23 #include <asm/ptrace.h>
28 * sm_call - generic SMC call to the secure-monitor
30 * @dev: Pointer to UCLASS_SM device
31 * @cmd_index: Index of the SMC function ID
32 * @smc_ret: Returned value from secure world
33 * @args: SMC arguments
35 * @return: 0 on success, a negative value on error
37 int sm_call(struct udevice
*dev
, u32 cmd
, s32
*ret
, struct pt_regs
*args
);
40 * sm_call_read - retrieve data from secure-monitor
42 * @dev: Pointer to UCLASS_MESON_SM device
43 * @buffer: Buffer to store the retrieved data
44 * @size: Size of the buffer
45 * @cmd: Index of the SMC function ID
46 * @args: SMC arguments
48 * @return: size of read data on success, a negative value on error
50 int sm_call_read(struct udevice
*dev
, void *buffer
, size_t size
,
51 u32 cmd
, struct pt_regs
*args
);
54 * sm_call_write - send data to secure-monitor
56 * @dev: Pointer to UCLASS_SM device
57 * @buffer: Buffer containing data to send
58 * @size: Size of the buffer
59 * @cmd: Index of the SMC function ID
60 * @args: SMC arguments
62 * @return: size of sent data on success, a negative value on error
64 int sm_call_write(struct udevice
*dev
, void *buffer
, size_t size
,
65 u32 cmd
, struct pt_regs
*args
);