]> git.saurik.com Git - apple/xnu.git/blame - osfmk/arm/cpuid.h
xnu-6153.81.5.tar.gz
[apple/xnu.git] / osfmk / arm / cpuid.h
CommitLineData
5ba3f43e
A
1/*
2 * Copyright (c) 2007-2016 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 * @OSF_COPYRIGHT@
30 */
31
32/*
33 * ARM CPU identification
34 */
35
36#ifndef _MACHINE_CPUID_H_
37#define _MACHINE_CPUID_H_
38
39#include <stdint.h>
40#include <mach/boolean.h>
41#include <machine/machine_cpuid.h>
42
43typedef struct {
cb323159
A
44 uint32_t arm_rev : 4, /* 00:03 revision number */
45 arm_part : 12,/* 04:15 primary part number */
46 arm_arch : 4,/* 16:19 architecture */
47 arm_variant : 4,/* 20:23 variant */
48 arm_implementor : 8;/* 24:31 implementor (0x41) */
5ba3f43e
A
49} arm_cpuid_bits_t;
50
51typedef union {
cb323159
A
52 arm_cpuid_bits_t arm_info; /* ARM9xx, ARM11xx, and later processors */
53 uint32_t value;
5ba3f43e
A
54} arm_cpu_info_t;
55
56/* Implementor codes */
cb323159
A
57#define CPU_VID_ARM 0x41 // ARM Limited
58#define CPU_VID_DEC 0x44 // Digital Equipment Corporation
59#define CPU_VID_MOTOROLA 0x4D // Motorola - Freescale Semiconductor Inc.
60#define CPU_VID_MARVELL 0x56 // Marvell Semiconductor Inc.
61#define CPU_VID_INTEL 0x69 // Intel ARM parts.
62#define CPU_VID_APPLE 0x61 // Apple Inc.
5ba3f43e
A
63
64
65/* ARM Architecture Codes */
66
cb323159
A
67#define CPU_ARCH_ARMv4 0x1 /* ARMv4 */
68#define CPU_ARCH_ARMv4T 0x2 /* ARMv4 + Thumb */
69#define CPU_ARCH_ARMv5 0x3 /* ARMv5 */
70#define CPU_ARCH_ARMv5T 0x4 /* ARMv5 + Thumb */
71#define CPU_ARCH_ARMv5TE 0x5 /* ARMv5 + Thumb + Extensions(?) */
72#define CPU_ARCH_ARMv5TEJ 0x6 /* ARMv5 + Thumb + Extensions(?) + //Jazelle(?) XXX */
73#define CPU_ARCH_ARMv6 0x7 /* ARMv6 */
74#define CPU_ARCH_ARMv7 0x8 /* ARMv7 */
75#define CPU_ARCH_ARMv7f 0x9 /* ARMv7 for Cortex A9 */
76#define CPU_ARCH_ARMv7s 0xa /* ARMv7 for Swift */
77#define CPU_ARCH_ARMv7k 0xb /* ARMv7 for Cortex A7 */
5ba3f43e 78
cb323159 79#define CPU_ARCH_ARMv8 0xc /* Subtype for CPU_TYPE_ARM64 */
5ba3f43e 80
cb323159 81#define CPU_ARCH_ARMv8E 0xd /* ARMv8.3a + Apple Private ISA Subtype for CPU_TYPE_ARM64 */
5ba3f43e
A
82
83/* special code indicating we need to look somewhere else for the architecture version */
cb323159 84#define CPU_ARCH_EXTENDED 0xF
5ba3f43e
A
85
86/* ARM Part Numbers */
87/*
88 * XXX: ARM Todo
89 * Fill out these part numbers more completely
90 */
91
92/* ARM9 (ARMv4T architecture) */
cb323159
A
93#define CPU_PART_920T 0x920
94#define CPU_PART_926EJS 0x926 /* ARM926EJ-S */
5ba3f43e
A
95
96/* ARM11 (ARMv6 architecture) */
cb323159
A
97#define CPU_PART_1136JFS 0xB36 /* ARM1136JF-S or ARM1136J-S */
98#define CPU_PART_1176JZFS 0xB76 /* ARM1176JZF-S */
5ba3f43e
A
99
100/* G1 (ARMv7 architecture) */
cb323159 101#define CPU_PART_CORTEXA5 0xC05
5ba3f43e
A
102
103/* M7 (ARMv7 architecture) */
cb323159 104#define CPU_PART_CORTEXA7 0xC07
5ba3f43e
A
105
106/* H2 H3 (ARMv7 architecture) */
cb323159 107#define CPU_PART_CORTEXA8 0xC08
5ba3f43e
A
108
109/* H4 (ARMv7 architecture) */
cb323159 110#define CPU_PART_CORTEXA9 0xC09
5ba3f43e
A
111
112/* H5 (SWIFT architecture) */
cb323159 113#define CPU_PART_SWIFT 0x0
5ba3f43e
A
114
115/* H6 (ARMv8 architecture) */
cb323159 116#define CPU_PART_CYCLONE 0x1
5ba3f43e
A
117
118/* H7 (ARMv8 architecture) */
cb323159 119#define CPU_PART_TYPHOON 0x2
5ba3f43e
A
120
121/* H7G (ARMv8 architecture) */
cb323159 122#define CPU_PART_TYPHOON_CAPRI 0x3
5ba3f43e
A
123
124/* H8 (ARMv8 architecture) */
cb323159 125#define CPU_PART_TWISTER 0x4
5ba3f43e
A
126
127/* H8G H8M (ARMv8 architecture) */
cb323159 128#define CPU_PART_TWISTER_ELBA_MALTA 0x5
5ba3f43e
A
129
130/* H9 (ARMv8 architecture) */
cb323159 131#define CPU_PART_HURRICANE 0x6
5ba3f43e
A
132
133/* H9G (ARMv8 architecture) */
cb323159 134#define CPU_PART_HURRICANE_MYST 0x7
5ba3f43e 135
d9a64523 136/* H10 p-Core (ARMv8 architecture) */
cb323159 137#define CPU_PART_MONSOON 0x8
d9a64523
A
138
139/* H10 e-Core (ARMv8 architecture) */
cb323159
A
140#define CPU_PART_MISTRAL 0x9
141
142/* H11 p-Core (ARMv8 architecture) */
143#define CPU_PART_VORTEX 0xB
144
145/* H11 e-Core (ARMv8 architecture) */
146#define CPU_PART_TEMPEST 0xC
147
148/* M9 e-Core (ARMv8 architecture) */
149#define CPU_PART_TEMPEST_M9 0xF
150
151/* H11G p-Core (ARMv8 architecture) */
152#define CPU_PART_VORTEX_ARUBA 0x10
153
154/* H11G e-Core (ARMv8 architecture) */
155#define CPU_PART_TEMPEST_ARUBA 0x11
d9a64523 156
c6bf4f31
A
157#ifndef RC_HIDE_XNU_LIGHTNING
158/* H12 p-Core (ARMv8 architecture) */
159#define CPU_PART_LIGHTNING 0x12
160
161/* H12 e-Core (ARMv8 architecture) */
162#define CPU_PART_THUNDER 0x13
163
164#endif /* !RC_HIDE_XNU_LIGHTNING */
5ba3f43e
A
165
166/* Cache type identification */
167
168/* Supported Cache Types */
169typedef enum {
170 CACHE_WRITE_THROUGH,
171 CACHE_WRITE_BACK,
172 CACHE_READ_ALLOCATION,
173 CACHE_WRITE_ALLOCATION,
174 CACHE_UNKNOWN
175} cache_type_t;
176
177typedef struct {
cb323159
A
178 boolean_t c_unified; /* unified I & D cache? */
179 uint32_t c_isize; /* in Bytes (ARM caches can be 0.5 KB) */
180 boolean_t c_i_ppage; /* protected page restriction for I cache
181 * (see B6-11 in ARM DDI 0100I document). */
182 uint32_t c_dsize; /* in Bytes (ARM caches can be 0.5 KB) */
183 boolean_t c_d_ppage; /* protected page restriction for I cache
184 * (see B6-11 in ARM DDI 0100I document). */
185 cache_type_t c_type; /* WB or WT */
186 uint32_t c_linesz; /* number of bytes */
187 uint32_t c_assoc; /* n-way associativity */
188 uint32_t c_l2size; /* L2 size, if present */
189 uint32_t c_bulksize_op; /* bulk operation size limit. 0 if disabled */
190 uint32_t c_inner_cache_size; /* inner dache size */
5ba3f43e
A
191} cache_info_t;
192
193typedef struct {
194 uint32_t
0a7de745
A
195 RB:4, /* 3:0 - 32x64-bit media register bank supported: 0x2 */
196 SP:4, /* 7:4 - Single precision supported in VFPv3: 0x2 */
197 DP:4, /* 8:11 - Double precision supported in VFPv3: 0x2 */
198 TE:4, /* 12-15 - Only untrapped exception handling can be selected: 0x0 */
199 D:4, /* 19:16 - VFP hardware divide supported: 0x1 */
200 SR:4, /* 23:20 - VFP hardware square root supported: 0x1 */
201 SV:4, /* 27:24 - VFP short vector supported: 0x1 */
202 RM:4; /* 31:28 - All VFP rounding modes supported: 0x1 */
5ba3f43e
A
203} arm_mvfr0_t;
204
205typedef union {
206 arm_mvfr0_t bits;
207 uint32_t value;
208} arm_mvfr0_info_t;
209
210typedef struct {
211 uint32_t
0a7de745
A
212 FZ:4, /* 3:0 - Full denormal arithmetic supported for VFP: 0x1 */
213 DN:4, /* 7:4 - Propagation of NaN values supported for VFP: 0x1 */
214 LS:4, /* 11:8 - Load/store instructions supported for NEON: 0x1 */
215 I:4, /* 15:12 - Integer instructions supported for NEON: 0x1 */
216 SP:4, /* 19:16 - Single precision floating-point instructions supported for NEON: 0x1 */
217 HPFP:4, /* 23:20 - Half precision floating-point instructions supported */
218 RSVP:8; /* 31:24 - Reserved */
5ba3f43e
A
219} arm_mvfr1_t;
220
221typedef union {
222 arm_mvfr1_t bits;
223 uint32_t value;
224} arm_mvfr1_info_t;
225
226typedef struct {
cb323159
A
227 uint32_t neon;
228 uint32_t neon_hpfp;
229 uint32_t neon_fp16;
5ba3f43e
A
230} arm_mvfp_info_t;
231
232#ifdef __cplusplus
233extern "C" {
cb323159 234#endif /* __cplusplus */
5ba3f43e
A
235
236extern void do_cpuid(void);
237extern arm_cpu_info_t *cpuid_info(void);
238extern int cpuid_get_cpufamily(void);
239
240extern void do_debugid(void);
241extern arm_debug_info_t *arm_debug_info(void);
242
243extern void do_cacheid(void);
244extern cache_info_t *cache_info(void);
245
246extern void do_mvfpid(void);
247extern arm_mvfp_info_t *arm_mvfp_info(void);
248
249#ifdef __cplusplus
250}
cb323159 251#endif /* __cplusplus */
5ba3f43e
A
252
253#endif // _MACHINE_CPUID_H_