1 | /* |
2 | * Copyright (c) 2021 Apple Inc. All rights reserved. |
3 | * |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
5 | * |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License |
8 | * Version 2.0 (the 'License'). You may not use this file except in |
9 | * compliance with the License. The rights granted to you under the License |
10 | * may not be used to create, or enable the creation or redistribution of, |
11 | * unlawful or unlicensed copies of an Apple operating system, or to |
12 | * circumvent, violate, or enable the circumvention or violation of, any |
13 | * terms of an Apple operating system software license agreement. |
14 | * |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
17 | * |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and |
24 | * limitations under the License. |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | */ |
28 | |
29 | #pragma once |
30 | |
31 | /* Function Identifiers. */ |
32 | #define HVC_FID_FAST_CALL 0x80000000 |
33 | #define HVC_FID_HVC64 0x40000000 |
34 | #define HVC_FID_CPU 0x01000000 |
35 | #define HVC_FID_OEM 0x03000000 |
36 | |
37 | #define HVC_FID_SC_MASK 0xff000000 |
38 | #define HVC_FID_NUM_MASK 0x0000ffff |
39 | |
40 | #define HVC_FID_UID 0xff01 |
41 | #define HVC_FID_REVISION 0xff03 |
42 | #define HVC_FID_FEATURES 0xfeff |
43 | |
44 | #define HVC32_FI(rng, num) (HVC_FID_FAST_CALL | (rng) | (num)) |
45 | |
46 | /* CPU */ |
47 | #define HVC_CPU_SERVICE (HVC_FID_FAST_CALL | HVC_FID_HVC64 | HVC_FID_CPU) |
48 | #define HVC32_CPU_SERVICE (HVC_FID_FAST_CALL | HVC_FID_CPU) |
49 | |
50 | /* Apple CPU Service */ |
51 | #define VMAPPLE_PAC_SET_INITIAL_STATE (HVC_CPU_SERVICE | 0x0) |
52 | #define VMAPPLE_PAC_GET_DEFAULT_KEYS (HVC_CPU_SERVICE | 0x1) |
53 | #define VMAPPLE_PAC_SET_A_KEYS (HVC_CPU_SERVICE | 0x2) |
54 | #define VMAPPLE_PAC_SET_B_KEYS (HVC_CPU_SERVICE | 0x3) |
55 | #define VMAPPLE_PAC_SET_EL0_DIVERSIFIER (HVC_CPU_SERVICE | 0x4) |
56 | #define VMAPPLE_PAC_SET_EL0_DIVERSIFIER_AT_EL1 (HVC_CPU_SERVICE | 0x5) |
57 | #define VMAPPLE_PAC_SET_G_KEY (HVC_CPU_SERVICE | 0x6) |
58 | #define VMAPPLE_PAC_NOP (HVC_CPU_SERVICE | 0xf0) |
59 | |
60 | /* OEM */ |
61 | #define HVC_OEM_SERVICE (HVC_FID_FAST_CALL | HVC_FID_HVC64 | HVC_FID_OEM) |
62 | #define HVC32_OEM_SERVICE (HVC_FID_FAST_CALL | HVC_FID_OEM) |
63 | |
64 | /* Apple OEM Service */ |
65 | #define VMAPPLE_GET_MABS_OFFSET (HVC_OEM_SERVICE | 0x3) |
66 | #define VMAPPLE_GET_BOOTSESSIONUUID (HVC_OEM_SERVICE | 0x4) |
67 | #define VMAPPLE_VCPU_WFK (HVC_OEM_SERVICE | 0x5) |
68 | #define VMAPPLE_VCPU_KICK (HVC_OEM_SERVICE | 0x6) |
69 | |
70 | /* Apple OEM Version 1.0 */ |
71 | #define HVC32_OEM_MAJOR_VER 1 |
72 | #define HVC32_OEM_MINOR_VER 0 |
73 | |
74 | /* Common UUID identifying Apple as the implementor. */ |
75 | #define VMAPPLE_HVC_UID "3B878185-AA62-4E1F-9DC9-D6799CBB6EBB" |
76 | |