xref: /xnu-10002.81.5/pexpert/pexpert/arm64/apple_arm64_common.h (revision 5e3eaea39dcf651e66cb99ba7d70e32cc4a99587)
1 /*
2  * Copyright (c) 2019 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 #ifndef _PEXPERT_ARM64_APPLE_ARM64_COMMON_H
30 #define _PEXPERT_ARM64_APPLE_ARM64_COMMON_H
31 
32 #define __ARM_ARCH__                         8
33 #define __ARM_VMSA__                         8
34 #define __ARM_VFP__                          4
35 #define __ARM_COHERENT_CACHE__               1
36 #define __ARM_COHERENT_IO__                  1
37 #define __ARM_IC_NOALIAS_ICACHE__            1
38 #define __ARM_DEBUG__                        7
39 #define __ARM_ENABLE_SWAP__                  1
40 #define __ARM_V8_CRYPTO_EXTENSIONS__         1
41 
42 #ifndef ARM_LARGE_MEMORY
43 #define __ARM64_PMAP_SUBPAGE_L1__            1
44 #endif
45 
46 #define APPLE_ARM64_ARCH_FAMILY              1
47 #define ARM_ARCH_TIMER
48 
49 #if defined(HAS_CTRR3)
50 #define KERNEL_INTEGRITY_CTRR                1
51 #define KERNEL_CTRR_VERSION                  3
52 #elif defined(HAS_CTRR)
53 #define KERNEL_INTEGRITY_CTRR                1
54 #define KERNEL_CTRR_VERSION                  2
55 #elif defined(HAS_KTRR)
56 #define KERNEL_INTEGRITY_KTRR                1
57 #elif defined(MONITOR)
58 #define KERNEL_INTEGRITY_WT                  1
59 #endif
60 
61 #if defined(CPU_HAS_APPLE_PAC) && defined(__arm64e__)
62 #define HAS_APPLE_PAC                        1 /* Has Apple ARMv8.3a pointer authentication */
63 #endif
64 
65 #include <pexpert/arm64/apple_arm64_regs.h>
66 #include <pexpert/arm64/AIC.h>
67 
68 #ifndef ASSEMBLER
69 #include <pexpert/arm/apple_uart_regs.h>
70 
71 #if !defined(APPLETYPHOON) && !defined(APPLETWISTER) && !defined(APPLEVIRTUALPLATFORM)
72 #include <pexpert/arm/dockchannel.h>
73 
74 // AOP_CLOCK frequency * 30 ms
75 #define DOCKCHANNEL_DRAIN_PERIOD             (192000000 * 0.03)
76 #endif
77 
78 #endif /* ASSEMBLER */
79 
80 /*
81  * See arm64/proc_reg.h for how these values are constructed from the MIDR.
82  * The chip-revision property from EDT also uses these constants.
83  */
84 #define CPU_VERSION_A0                       0x00
85 #define CPU_VERSION_A1                       0x01
86 #define CPU_VERSION_B0                       0x10
87 #define CPU_VERSION_B1                       0x11
88 #define CPU_VERSION_C0                       0x20
89 #define CPU_VERSION_UNKNOWN                  0xff
90 
91 #endif /* !_PEXPERT_ARM64_APPLE_ARM64_COMMON_H */
92