1 | /* $Id: arm-psci.h 105694 2024-08-15 13:11:31Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT, ARM PSCI (Power State Coordination Interface) common definitions (this is actually a protocol and not a format).
|
---|
4 | *
|
---|
5 | * from https://developer.arm.com/documentation/den0022/e/?lang=en (2023-06-05)
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2023 Oracle and/or its affiliates.
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox base platform packages, as
|
---|
12 | * available from https://www.virtualbox.org.
|
---|
13 | *
|
---|
14 | * This program is free software; you can redistribute it and/or
|
---|
15 | * modify it under the terms of the GNU General Public License
|
---|
16 | * as published by the Free Software Foundation, in version 3 of the
|
---|
17 | * License.
|
---|
18 | *
|
---|
19 | * This program is distributed in the hope that it will be useful, but
|
---|
20 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
22 | * General Public License for more details.
|
---|
23 | *
|
---|
24 | * You should have received a copy of the GNU General Public License
|
---|
25 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
26 | *
|
---|
27 | * The contents of this file may alternatively be used under the terms
|
---|
28 | * of the Common Development and Distribution License Version 1.0
|
---|
29 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
30 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
31 | * CDDL are applicable instead of those of the GPL.
|
---|
32 | *
|
---|
33 | * You may elect to license modified versions of this file under the
|
---|
34 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
35 | *
|
---|
36 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
37 | */
|
---|
38 |
|
---|
39 | #ifndef IPRT_INCLUDED_formats_arm_psci_h
|
---|
40 | #define IPRT_INCLUDED_formats_arm_psci_h
|
---|
41 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
42 | # pragma once
|
---|
43 | #endif
|
---|
44 |
|
---|
45 | #include <iprt/cdefs.h>
|
---|
46 | #include <iprt/types.h>
|
---|
47 | #include <iprt/assertcompile.h>
|
---|
48 | #include <iprt/formats/arm-smccc.h>
|
---|
49 |
|
---|
50 | /** @name Return error codes.
|
---|
51 | * @{ */
|
---|
52 | /** Success. */
|
---|
53 | #define ARM_PSCI_STS_SUCCESS INT32_C(0)
|
---|
54 | /** Operation is not supported. */
|
---|
55 | #define ARM_PSCI_STS_NOT_SUPPORTED INT32_C(-1)
|
---|
56 | /** Caller supplied invalid parameters. */
|
---|
57 | #define ARM_PSCI_STS_INVALID_PARAMETERS INT32_C(-2)
|
---|
58 | /** Access to the operation was denied. */
|
---|
59 | #define ARM_PSCI_STS_DENIED INT32_C(-3)
|
---|
60 | /** CPU is already online. */
|
---|
61 | #define ARM_PSCI_STS_ALREADY_ON INT32_C(-4)
|
---|
62 | /** Operation is already pending. */
|
---|
63 | #define ARM_PSCI_STS_ON_PENDING INT32_C(-5)
|
---|
64 | /** PSCI implementation encountered an internal failure for the operation. */
|
---|
65 | #define ARM_PSCI_STS_INTERNAL_FAILURE INT32_C(-6)
|
---|
66 | /** Target CPU is not present. */
|
---|
67 | #define ARM_PSCI_STS_NOT_PRESENT INT32_C(-7)
|
---|
68 | /** Target CPU is disabled. */
|
---|
69 | #define ARM_PSCI_STS_DISABLED INT32_C(-8)
|
---|
70 | /** An invalid address was supplied. */
|
---|
71 | #define ARM_PSCI_STS_INVALID_ADDRESS INT32_C(-9)
|
---|
72 | /** @} */
|
---|
73 |
|
---|
74 |
|
---|
75 | /** @name 32-bit Function identifiers.
|
---|
76 | * @{ */
|
---|
77 | /** Return the version of the PSCI implemented. */
|
---|
78 | #define ARM_PSCI_FUNC_ID_PSCI_VERSION 0
|
---|
79 | # define ARM_PSCI_FUNC_ID_PSCI_VERSION_SET(a_Major, a_Minor) (((a_Major) << 16) | ((a_Minor)))
|
---|
80 | /** Suspends execution on a core or topology node. */
|
---|
81 | #define ARM_PSCI_FUNC_ID_CPU_SUSPEND 1
|
---|
82 | /** Powers down the calling core. */
|
---|
83 | #define ARM_PSCI_FUNC_ID_CPU_OFF 2
|
---|
84 | /** Power up a core. */
|
---|
85 | #define ARM_PSCI_FUNC_ID_CPU_ON 3
|
---|
86 | /** Enable the caller to request status of an affinity instance. */
|
---|
87 | #define ARM_PSCI_FUNC_ID_AFFINITY_INFO 4
|
---|
88 | /** Asks a uniprocessor trusted OS to migrate its context to a specific core. */
|
---|
89 | #define ARM_PSCI_FUNC_ID_MIGRATE 5
|
---|
90 | /** Allows caller to identify the level of multicore support present in the trusted OS. */
|
---|
91 | #define ARM_PSCI_FUNC_ID_MIGRATE_INFO_TYPE 6
|
---|
92 | /** Returns the current resident core for a uniprocessor trusted OS. */
|
---|
93 | #define ARM_PSCI_FUNC_ID_MIGRATE_INFO_UP_CPU 7
|
---|
94 | /** Shut down the system. */
|
---|
95 | #define ARM_PSCI_FUNC_ID_SYSTEM_OFF 8
|
---|
96 | /** Reset the system. */
|
---|
97 | #define ARM_PSCI_FUNC_ID_SYSTEM_RESET 9
|
---|
98 | /** Query API allowing to discover whether SMCCC_VERSION or a specific PSCI function is implemented. */
|
---|
99 | #define ARM_PSCI_FUNC_ID_PSCI_FEATURES 10
|
---|
100 | /** Places the core into an implementation defined low-power state. */
|
---|
101 | #define ARM_PSCI_FUNC_ID_CPU_FREEZE 11
|
---|
102 | /** Places the core into an implementation defined low-power state. */
|
---|
103 | #define ARM_PSCI_FUNC_ID_CPU_DEFAULT_SUSPEND 12
|
---|
104 | /** Returns HW state of a node in the power domain topology of the system. */
|
---|
105 | #define ARM_PSCI_FUNC_ID_NODE_HW_STATE 13
|
---|
106 | /** Used to implement suspend to RAM. */
|
---|
107 | #define ARM_PSCI_FUNC_ID_SYSTEM_SUSPEND 14
|
---|
108 | /** Sets the mode used by CPU_SUSPEND to coordinate power states. */
|
---|
109 | #define ARM_PSCI_FUNC_ID_SET_SUSPEND_MODE 15
|
---|
110 | /** Returns the amount of time the platform has spent in the given power state since cold boot. */
|
---|
111 | #define ARM_PSCI_FUNC_ID_STAT_RESIDENCY 16
|
---|
112 | /** Returns the number of times the platform has used the given power state since cold boot. */
|
---|
113 | #define ARM_PSCI_FUNC_ID_STAT_COUNT 17
|
---|
114 | /** Reset the system, extended version present in PSCI 1.1. */
|
---|
115 | #define ARM_PSCI_FUNC_ID_SYSTEM_RESET2 18
|
---|
116 | /** Provide protection against cold reboot attacks, present in PSCI 1.1. */
|
---|
117 | #define ARM_PSCI_FUNC_ID_MEM_PROTECT 19
|
---|
118 | /** Checks whether a given memory range is protected by MEM_PROTECT, present in PSCI 1.1. */
|
---|
119 | #define ARM_PSCI_FUNC_ID_MEM_PROTECT_CHECK_RANGE 20
|
---|
120 | /** @} */
|
---|
121 |
|
---|
122 |
|
---|
123 | #define ARM_PSCI_MIGRATE_INFO_TYPE_TOS_NOT_PRESENT 2
|
---|
124 |
|
---|
125 | /** Helper to define a PSCI function identifier conforming to SMC32/HVC32. */
|
---|
126 | #define ARM_PSCI_FUNC_ID_CREATE_FAST_32(a_FunNum) ARM_SMCCC_FUNC_ID_CREATE_FAST_32(ARM_SMCCC_FUNC_ID_ENTITY_STD_SEC_SERVICE, a_FunNum)
|
---|
127 | /** Helper to define a PSCI function identifier conforming to SMC64/HVC64. */
|
---|
128 | #define ARM_PSCI_FUNC_ID_CREATE_FAST_64(a_FunNum) ARM_SMCCC_FUNC_ID_CREATE_FAST_64(ARM_SMCCC_FUNC_ID_ENTITY_STD_SEC_SERVICE, a_FunNum)
|
---|
129 |
|
---|
130 | #endif /* !IPRT_INCLUDED_formats_arm_psci_h */
|
---|
131 |
|
---|