xref: /optee_os/core/arch/arm/include/sm/watchdog_smc.h (revision d50fee0321fe6853ac6352cf0fd548666457b407)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (C) STMicroelectronics 2023
4  */
5 #ifndef __SM_WATCHDOG_SMC_H
6 #define __SM_WATCHDOG_SMC_H
7 
8 /*
9  * This file describes the secure watchdog management service.
10  * It exposes the SMC supported commands.
11  * We're following ARM SMC Calling Convention as specified in
12  * https://developer.arm.com/documentation/den0028.
13  */
14 
15 /*
16  * Overall global call for watchdog interface
17  * Call requests usage:
18  * a0		[in]		SMC Function ID, CFG_WDT_SM_HANDLER_ID
19  *		[out]		PSCI error code return
20  * a1		[in]		Watchdog command (one of SMCWD_*)
21  *		[out]		Depends on watchdog command (input a1)
22  * a2		[in/out]	Depends on watchdog command (input a1)
23  * a3-6		[in/out]	Not used
24  * a7		[in/out]	Hypervisor Client ID register
25  */
26 
27 /* Watchdog supported commands */
28 
29 #define SMCWD_INIT		0
30 #define SMCWD_SET_TIMEOUT	1
31 #define SMCWD_ENABLE		2
32 #define SMCWD_PET		3
33 #define SMCWD_GET_TIMELEFT	4
34 
35 /*
36  * Command SMCWD_INIT : Watchdog initialization
37  * [in]		a1	Set to SMCWD_INIT
38  * [out]	a1	The minimal timeout value in seconds supported
39  *		a2	The maximum timeout value in seconds supported
40  * Return codes:
41  * PSCI_RET_SUCCESS - Command success
42  * PSCI_RET_INTERNAL_FAILURE - Initialization failure
43  *
44  * Command SMCWD_SET_TIMEOUT : Watchdog set timeout
45  * [in]		a1	Set to SMCWD_SET_TIMEOUT
46  *		a2	The timeout value in seconds to set
47  * Return codes:
48  * PSCI_RET_SUCCESS - Command success
49  * PSCI_RET_INVALID_PARAMETERS - Incorrect input param
50  *
51  * Command SMCWD_ENABLE : Watchdog enable
52  * [in]		a1	Set to SMCWD_ENABLE
53  *		a2	Set to 0 to stop the watchdog, 1 to enable it
54  * Return codes:
55  * PSCI_RET_SUCCESS - Command success
56  * PSCI_RET_INVALID_PARAMETERS - Incorrect input param
57  *
58  * Command SMCWD_PET : Ping the watchdog for refresh
59  * [in]		a1	Set to SMCWD_PET
60  * Return codes:
61  * PSCI_RET_SUCCESS - Command success
62  * PSCI_RET_DISABLED - The watchdog is not enabled
63  *
64  * Command SMCWD_GET_TIMELEFT : Get time left
65  * [in]		a1	Set to SMCWD_GET_TIMELEFT
66  * [out]	a1	The timeout value in seconds before watchdog expires
67  * Return codes:
68  * PSCI_RET_SUCCESS - Command success
69  * PSCI_RET_DISABLED - The watchdog is not enabled
70  * PSCI_RET_NOT_SUPPORTED - Function not supported
71  *
72  * Other commands
73  * [in]		a1	Other values
74  * Return codes:
75  * PSCI_RET_NOT_SUPPORTED - Function not supported
76  *
77  * a3-6		Not used
78  * a7		Hypervisor Client ID register
79  */
80 
81 #endif /* __SM_WATCHDOG_SMC_H */
82