src/arm64/psci.bend checks
raw source on the hub · import 0xab9fd5982a23be6a9b632b364492ce07/src/arm64/psci.bend as Psci
2 imports
import Base import ../lib/u64.bend as U
Types
type PsciCall source · line 20 · raw
Data
SmcccVersionPsciCall
PsciVersionPsciCall
CpuOffPsciCall
CpuOnCall@target:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @entry:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @ctx:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciCall
target is the MPIDR of the CPU to start; cpu index = Aff0 (bits [7:0]).
AffinityInfo@target:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @level:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciCall
MigrateInfoTypePsciCall
SystemOffPsciCall
SystemResetPsciCall
Features@fid:U32 -> PsciCall
Unsupported@fid:U32 -> PsciCall
Any other function id (answered NOT_SUPPORTED).
type PsciEffect source · line 35 · raw
Data
What the VMM must do besides writing x0.
NoEffectPsciEffect
StartCpu@cpu:U32 -> @entry:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @ctx:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciEffect
StopCpuPsciEffect
OffPsciEffect
ResetPsciEffect
type PsciState source · line 43 · raw
Data
Which CPUs are powered on: on[i] for cpu i, ncpus long.
PsciState@on:List<&2, Bool> -> PsciState
type PsciResult source · line 46 · raw
Data
PsciResult@state:PsciState -> @x0:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @effect:PsciEffect -> PsciResult
Definitions
def Fid.smccc_version source · line 50 · raw
U32
Function ids (decimal; hex in comments).
def Fid.psci_version source · line 52 · raw
U32
def Fid.cpu_off source · line 54 · raw
U32
def Fid.cpu_on source · line 56 · raw
U32
def Fid.affinity_info source · line 58 · raw
U32
def Fid.migrate_info_type source · line 60 · raw
U32
def Fid.system_off source · line 62 · raw
U32
def Fid.system_reset source · line 64 · raw
U32
def Fid.features source · line 66 · raw
U32
def Ret.success source · line 70 · raw
0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64
Return codes, sign-extended to 64 bits.
def Ret.not_supported source · line 72 · raw
0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64
def Ret.invalid_parameters source · line 74 · raw
0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64
def Ret.already_on source · line 76 · raw
0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64
def Ret.version_1_1 source · line 80 · raw
0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64
Version 1.1 (major in [31:16], minor in [15:0]), for PSCI and SMCCC.
def PsciState.all_off source · line 84 · raw
@n:Nat -> List<&2, Bool>
n CPUs, all off.
def PsciState.boot source · line 92 · raw
@ncpus:Nat -> PsciState
A machine of ncpus CPUs with only CPU 0 on.
def Psci.implemented source · line 100 · raw
@+fid:U32 -> Bool
Does decode know this function id? PSCI_FEATURES answers from it.
def Psci.by_features source · line 109 · raw
@hit:Bool -> @+fid:U32 -> @x1:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciCall
The decoders below each test one id (from the list at the top, in reverse) and hand the rest to the one above.
def Psci.by_reset source · line 116 · raw
@hit:Bool -> @+fid:U32 -> @x1:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciCall
def Psci.by_off source · line 123 · raw
@hit:Bool -> @+fid:U32 -> @x1:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciCall
def Psci.by_migrate source · line 130 · raw
@hit:Bool -> @+fid:U32 -> @x1:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciCall
def Psci.by_affinity source · line 137 · raw
@hit:Bool -> @+fid:U32 -> @x1:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @x2:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciCall
def Psci.by_cpu_on source · line 144 · raw
@hit:Bool -> @+fid:U32 -> @x1:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @x2:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @x3:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciCall
def Psci.by_cpu_off source · line 151 · raw
@hit:Bool -> @+fid:U32 -> @x1:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @x2:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @x3:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciCall
def Psci.by_version source · line 158 · raw
@hit:Bool -> @+fid:U32 -> @x1:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @x2:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @x3:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciCall
def Psci.by_smccc source · line 165 · raw
@hit:Bool -> @+fid:U32 -> @x1:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @x2:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @x3:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciCall
def Psci.decode source · line 173 · raw
@x0:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @x1:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @x2:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @x3:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciCall
The call the guest makes with x0 (function id in its low 32 bits) .. x3.
def Psci.index.of source · line 179 · raw
@ok:Bool -> @+lo:U32 -> Maybe<&2, Nat>
The CPU index an MPIDR names: Aff0, when every other affinity bit is zero (the DTB gives cpu n the MPIDR n). None for any other MPIDR.
def Psci.index source · line 186 · raw
@target:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> Maybe<&2, Nat>
def Psci.get source · line 192 · raw
@on:List<&2, Bool> -> @i:Nat -> Maybe<&2, Bool>
on[i], or None past the end.
def Psci.set source · line 202 · raw
@on:List<&2, Bool> -> @i:Nat -> @v:Bool -> List<&2, Bool>
on with on[i] = v; unchanged when i is past the end.
def Psci.lookup source · line 212 · raw
@+on:List<&2, Bool> -> @mi:Maybe<&2, Nat> -> Maybe<&2, Bool>
The power state of the CPU an MPIDR names; None when there is no such CPU.
def Psci.mark source · line 220 · raw
@on:List<&2, Bool> -> @mi:Maybe<&2, Nat> -> @v:Bool -> List<&2, Bool>
on with the CPU an MPIDR names marked v; unchanged when there is no such CPU.
def Psci.cpu_on.x0 source · line 228 · raw
@cur:Maybe<&2, Bool> -> 0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64
CPU_ON: x0 from the target's power state (None: no such CPU).
def Psci.cpu_on.effect source · line 237 · raw
@cur:Maybe<&2, Bool> -> @+target:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @entry:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> @ctx:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> PsciEffect
def Psci.affinity.x0 source · line 245 · raw
@level0:Bool -> @cur:Maybe<&2, Bool> -> 0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64
AFFINITY_INFO: 0 on, 1 off; only level 0 is implemented.
def Psci.features.x0 source · line 254 · raw
@ok:Bool -> 0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64
def Psci.handle source · line 269 · raw
@self:U32 -> @s:PsciState -> @call:PsciCall -> PsciResult
Answers a call from CPU self. CPU_ON of an index >= ncpus answers
INVALID_PARAMETERS; of a CPU already on, ALREADY_ON; else SUCCESS and the
StartCpu effect, marking the CPU on. CPU_OFF marks self off.
AFFINITY_INFO (level 0) answers 0 for on, 1 for off. PSCI_FEATURES answers 0
for every function id this module implements, NOT_SUPPORTED otherwise.
MIGRATE_INFO_TYPE answers 2 (no trusted OS).
Every case builds the result directly, and CPU state changes only through
Psci.mark and Psci.set, so the number of CPUs never changes.