1 /*
2  * Copyright 2018 The Hafnium Authors.
3  *
4  * Use of this source code is governed by a BSD-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/BSD-3-Clause.
7  */
8 
9 #pragma once
10 
11 #include "smc.h"
12 
13 /* clang-format off */
14 
15 /* The following are PSCI version codes. */
16 enum psci_version : uint32_t {
17 	PSCI_VERSION_0_2 = 0x00000002,
18 	PSCI_VERSION_1_0 = 0x00010000,
19 	PSCI_VERSION_1_1 = 0x00010001,
20 };
21 
22 /* The following are function identifiers for PSCI. */
23 #define PSCI_VERSION                 0x84000000
24 #define PSCI_CPU_SUSPEND             0x84000001
25 #define PSCI_CPU_OFF                 0x84000002
26 #define PSCI_CPU_ON                  0x84000003
27 #define PSCI_AFFINITY_INFO           0x84000004
28 #define PSCI_MIGRATE                 0x84000005
29 #define PSCI_MIGRATE_INFO_TYPE       0x84000006
30 #define PSCI_MIGRATE_INFO_UP_CPU     0x84000007
31 #define PSCI_SYSTEM_OFF              0x84000008
32 #define PSCI_SYSTEM_RESET            0x84000009
33 #define PSCI_FEATURES                0x8400000a
34 #define PSCI_CPU_FREEZE              0x8400000b
35 #define PSCI_CPU_DEFAULT_SUSPEND     0x8400000c
36 #define PSCI_NODE_HW_STATE           0x8400000d
37 #define PSCI_SYSTEM_SUSPEND          0x8400000e
38 #define PSCI_SET_SYSPEND_MODE        0x8400000f
39 #define PSCI_STAT_RESIDENCY          0x84000010
40 #define PSCI_STAT_COUNT              0x84000011
41 #define PSCI_SYSTEM_RESET2           0x84000012
42 #define PSCI_MEM_PROTECT             0x84000013
43 #define PSCI_MEM_PROTECT_CHECK_RANGE 0x84000014
44 
45 /* The following are return codes for PSCI. */
46 enum psci_return_code : uint32_t {
47 	PSCI_RETURN_ON_PENDING         = 2,
48 	PSCI_RETURN_OFF                = 1,
49 	PSCI_RETURN_ON                 = 0,
50 	PSCI_RETURN_SUCCESS            = 0,
51 	PSCI_ERROR_NOT_SUPPORTED       = SMCCC_ERROR_UNKNOWN,
52 	PSCI_ERROR_INVALID_PARAMETERS  = -2,
53 	PSCI_ERROR_DENIED              = -3,
54 	PSCI_ERROR_ALREADY_ON          = -4,
55 	PSCI_ERROR_ON_PENDING          = -5,
56 	PSCI_ERROR_INTERNAL_FAILURE    = -6,
57 	PSCI_ERROR_NOT_PRESENT         = -7,
58 	PSCI_ERROR_DISABLE             = -8,
59 	PSCI_ERROR_INVALID_ADDRESS     = -9,
60 };
61 
62 /* clang-format on */
63