xref: /xnu-10002.81.5/osfmk/arm/machine_cpuid.h (revision 5e3eaea39dcf651e66cb99ba7d70e32cc4a99587)
1*5e3eaea3SApple OSS Distributions /*
2*5e3eaea3SApple OSS Distributions  * Copyright (c) 2017 Apple Inc. All rights reserved.
3*5e3eaea3SApple OSS Distributions  *
4*5e3eaea3SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*5e3eaea3SApple OSS Distributions  *
6*5e3eaea3SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*5e3eaea3SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*5e3eaea3SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*5e3eaea3SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*5e3eaea3SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*5e3eaea3SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*5e3eaea3SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*5e3eaea3SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*5e3eaea3SApple OSS Distributions  *
15*5e3eaea3SApple OSS Distributions  * Please obtain a copy of the License at
16*5e3eaea3SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*5e3eaea3SApple OSS Distributions  *
18*5e3eaea3SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*5e3eaea3SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*5e3eaea3SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*5e3eaea3SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*5e3eaea3SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*5e3eaea3SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*5e3eaea3SApple OSS Distributions  * limitations under the License.
25*5e3eaea3SApple OSS Distributions  *
26*5e3eaea3SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*5e3eaea3SApple OSS Distributions  */
28*5e3eaea3SApple OSS Distributions #ifndef _ARM_MACHINE_CPUID_H_
29*5e3eaea3SApple OSS Distributions #define _ARM_MACHINE_CPUID_H_
30*5e3eaea3SApple OSS Distributions 
31*5e3eaea3SApple OSS Distributions /* CPU feature identification */
32*5e3eaea3SApple OSS Distributions 
33*5e3eaea3SApple OSS Distributions typedef struct {
34*5e3eaea3SApple OSS Distributions 	uint32_t        arm_32bit_isa   : 4,
35*5e3eaea3SApple OSS Distributions 	    arm_thumb_ver   : 4,
36*5e3eaea3SApple OSS Distributions 	    arm_jazelle             : 4,
37*5e3eaea3SApple OSS Distributions 	    arm_thumb2              : 4,
38*5e3eaea3SApple OSS Distributions 	    reserved                : 16;
39*5e3eaea3SApple OSS Distributions } arm_feature_bits_t;
40*5e3eaea3SApple OSS Distributions 
41*5e3eaea3SApple OSS Distributions typedef union {
42*5e3eaea3SApple OSS Distributions 	arm_feature_bits_t      field;
43*5e3eaea3SApple OSS Distributions 	uint32_t                        value;
44*5e3eaea3SApple OSS Distributions } arm_feature0_reg_t;
45*5e3eaea3SApple OSS Distributions 
46*5e3eaea3SApple OSS Distributions // Register 0, subtype 21: Instruction Set Features #1
47*5e3eaea3SApple OSS Distributions typedef struct{
48*5e3eaea3SApple OSS Distributions 	uint32_t endianness_support     : 4;
49*5e3eaea3SApple OSS Distributions 	uint32_t exception_1_support    : 4;
50*5e3eaea3SApple OSS Distributions 	uint32_t exception_2_support    : 4;
51*5e3eaea3SApple OSS Distributions 	uint32_t sign_zero_ext_support  : 4;
52*5e3eaea3SApple OSS Distributions 	uint32_t if_then_support        : 4;
53*5e3eaea3SApple OSS Distributions 	uint32_t immediate_support      : 4;
54*5e3eaea3SApple OSS Distributions 	uint32_t interworking_support   : 4;
55*5e3eaea3SApple OSS Distributions 	uint32_t jazelle_support        : 4;
56*5e3eaea3SApple OSS Distributions }
57*5e3eaea3SApple OSS Distributions syscp_ID_instructions_feat_1_reg;
58*5e3eaea3SApple OSS Distributions 
59*5e3eaea3SApple OSS Distributions typedef union {
60*5e3eaea3SApple OSS Distributions 	uint32_t value;
61*5e3eaea3SApple OSS Distributions 	syscp_ID_instructions_feat_1_reg field;
62*5e3eaea3SApple OSS Distributions } arm_isa_feat1_reg;
63*5e3eaea3SApple OSS Distributions 
64*5e3eaea3SApple OSS Distributions arm_isa_feat1_reg machine_read_isa_feat1(void);
65*5e3eaea3SApple OSS Distributions 
66*5e3eaea3SApple OSS Distributions /* Debug identification */
67*5e3eaea3SApple OSS Distributions 
68*5e3eaea3SApple OSS Distributions /* ID_DFR0 */
69*5e3eaea3SApple OSS Distributions typedef union {
70*5e3eaea3SApple OSS Distributions 	struct {
71*5e3eaea3SApple OSS Distributions 		uint32_t    coprocessor_core_debug      : 4,
72*5e3eaea3SApple OSS Distributions 		    coprocessor_secure_debug    : 4,
73*5e3eaea3SApple OSS Distributions 		    memory_mapped_core_debug    : 4,
74*5e3eaea3SApple OSS Distributions 		    coprocessor_trace_debug     : 4,
75*5e3eaea3SApple OSS Distributions 		    memory_mapped_trace_debug   : 4,
76*5e3eaea3SApple OSS Distributions 		    microcontroller_debug       : 4;
77*5e3eaea3SApple OSS Distributions 	} debug_feature;
78*5e3eaea3SApple OSS Distributions 	uint32_t value;
79*5e3eaea3SApple OSS Distributions } arm_cpuid_id_dfr0;
80*5e3eaea3SApple OSS Distributions 
81*5e3eaea3SApple OSS Distributions /* DBGDIDR */
82*5e3eaea3SApple OSS Distributions typedef union {
83*5e3eaea3SApple OSS Distributions 	struct {
84*5e3eaea3SApple OSS Distributions 		uint32_t    revision                    : 4,
85*5e3eaea3SApple OSS Distributions 		    variant                     : 4,
86*5e3eaea3SApple OSS Distributions 		: 4,
87*5e3eaea3SApple OSS Distributions 		    se_imp                      : 1,
88*5e3eaea3SApple OSS Distributions 		    pcsr_imp                    : 1,
89*5e3eaea3SApple OSS Distributions 		    nsuhd_imp                   : 1,
90*5e3eaea3SApple OSS Distributions 		: 1,
91*5e3eaea3SApple OSS Distributions 		    version                     : 4,
92*5e3eaea3SApple OSS Distributions 		    ctx_cmps                    : 4,
93*5e3eaea3SApple OSS Distributions 		    brps                        : 4,
94*5e3eaea3SApple OSS Distributions 		    wrps                        : 4;
95*5e3eaea3SApple OSS Distributions 	} debug_id;
96*5e3eaea3SApple OSS Distributions 	uint32_t value;
97*5e3eaea3SApple OSS Distributions } arm_debug_dbgdidr;
98*5e3eaea3SApple OSS Distributions 
99*5e3eaea3SApple OSS Distributions typedef struct {
100*5e3eaea3SApple OSS Distributions 	boolean_t               memory_mapped_core_debug;
101*5e3eaea3SApple OSS Distributions 	boolean_t               coprocessor_core_debug;
102*5e3eaea3SApple OSS Distributions 	uint32_t                num_watchpoint_pairs;
103*5e3eaea3SApple OSS Distributions 	uint32_t                num_breakpoint_pairs;
104*5e3eaea3SApple OSS Distributions } arm_debug_info_t;
105*5e3eaea3SApple OSS Distributions 
106*5e3eaea3SApple OSS Distributions #endif /* _ARM_MACHINE_CPUID_H_ */
107