diff options
author | Tom Rini <trini@konsulko.com> | 2023-10-16 09:09:54 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-10-16 09:09:54 -0400 |
commit | 2e1577e8360d8e467bf28009f6763a2ac511f743 (patch) | |
tree | cf05b376e7b46e4b5b4b61d04f6976de85ab31d4 /include/sm-uclass.h | |
parent | 3c3f1626919cd93cbe6c56e3849937de5be18dbb (diff) | |
parent | 7cd53e0d5203f8e25bb69d2e675769888fcbc754 (diff) |
Merge tag 'u-boot-amlogic-20231015' of https://source.denx.de/u-boot/custodians/u-boot-amlogic
- add Amlogic A1 clock driver
- add Amlogic A1 reset support
- add USB Device support for Amlogic A1
- enable RNG on Amlogic A1 & Amlogic S4
- move Amlogic Secure Monitor to standalone driver
Diffstat (limited to 'include/sm-uclass.h')
-rw-r--r-- | include/sm-uclass.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/include/sm-uclass.h b/include/sm-uclass.h new file mode 100644 index 0000000000..c114484044 --- /dev/null +++ b/include/sm-uclass.h @@ -0,0 +1,72 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2023 SberDevices, Inc. + * + * Author: Alexey Romanov <avromanov@salutedevices.com> + */ + +#ifndef __SM_UCLASS_H__ +#define __SM_UCLASS_H__ + +#include <asm/types.h> +#include <asm/ptrace.h> + +struct udevice; + +/** + * struct sm_ops - The functions that a SM driver must implement. + * + * @sm_call: Request a secure monitor call with specified command. + * + * @sm_call_read: Request a secure monitor call and retrieve data + * from secure-monitor (depends on specified command). + * + * @sm_call_write: Request a secure monitor call and send data + * to secure-monitor (depends on specified command). + * + * The individual methods are described more fully below. + */ +struct sm_ops { + /** + * sm_call - generic SMC call to the secure-monitor + * + * @dev: Pointer to UCLASS_SM device + * @cmd_index: Index of the SMC function ID + * @smc_ret: Returned value from secure world + * @args: SMC arguments + * + * @return: 0 on success, a negative value on error + */ + int (*sm_call)(struct udevice *dev, u32 cmd, s32 *smc_ret, + struct pt_regs *args); + + /** + * sm_call_write - send data to secure-monitor + * + * @dev: Pointer to UCLASS_SM device + * @buffer: Buffer containing data to send + * @size: Size of the buffer + * @cmd: Index of the SMC function ID + * @args: SMC arguments + * + * @return: size of sent data on success, a negative value on error + */ + int (*sm_call_write)(struct udevice *dev, void *buffer, + size_t size, u32 cmd, struct pt_regs *args); + + /** + * sm_call_read - retrieve data from secure-monitor + * + * @dev: Pointer to UCLASS_SM device + * @buffer: Buffer to store the retrieved data + * @size: Size of the buffer + * @cmd: Index of the SMC function ID + * @args: SMC arguments + * + * @return: size of read data on success, a negative value on error + */ + int (*sm_call_read)(struct udevice *dev, void *buffer, + size_t size, u32 cmd, struct pt_regs *args); +}; + +#endif /* __SM_UCLASS_H__ */ |