1 /*
2  * Copyright (c) 2022 Zephyr authors
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef H_OS_MGMT_PROCESSOR_
8 #define H_OS_MGMT_PROCESSOR_
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 /**
15  * Processor name (used in uname output command)
16  * Will be unknown if processor type is not listed
17  * (List extracted from /cmake/gcc-m-cpu.cmake)
18  */
19 #if defined(CONFIG_ARM)
20 #if defined(CONFIG_CPU_CORTEX_M0)
21 #define PROCESSOR_NAME "cortex-m0"
22 #elif defined(CONFIG_CPU_CORTEX_M0PLUS)
23 #define PROCESSOR_NAME "cortex-m0plus"
24 #elif defined(CONFIG_CPU_CORTEX_M1)
25 #define PROCESSOR_NAME "cortex-m1"
26 #elif defined(CONFIG_CPU_CORTEX_M3)
27 #define PROCESSOR_NAME "cortex-m3"
28 #elif defined(CONFIG_CPU_CORTEX_M4)
29 #define PROCESSOR_NAME "cortex-m4"
30 #elif defined(CONFIG_CPU_CORTEX_M7)
31 #define PROCESSOR_NAME "cortex-m7"
32 #elif defined(CONFIG_CPU_CORTEX_M23)
33 #define PROCESSOR_NAME "cortex-m23"
34 #elif defined(CONFIG_CPU_CORTEX_M33)
35 #if defined(CONFIG_ARMV8_M_DSP)
36 #define PROCESSOR_NAME "cortex-m33"
37 #else
38 #define PROCESSOR_NAME "cortex-m33+nodsp"
39 #endif
40 #elif defined(CONFIG_CPU_CORTEX_M55)
41 #if defined(CONFIG_ARMV8_1_M_MVEF)
42 #define PROCESSOR_NAME "cortex-m55"
43 #elif defined(CONFIG_ARMV8_1_M_MVEI)
44 #define PROCESSOR_NAME "cortex-m55+nomve.fp"
45 #elif defined(CONFIG_ARMV8_M_DSP)
46 #define PROCESSOR_NAME "cortex-m55+nomve"
47 #else
48 #define PROCESSOR_NAME "cortex-m55+nodsp"
49 #endif
50 #elif defined(CONFIG_CPU_CORTEX_M85)
51 #if defined(CONFIG_ARMV8_1_M_MVEF)
52 #define PROCESSOR_NAME "cortex-m85"
53 #elif defined(CONFIG_ARMV8_1_M_MVEI)
54 #define PROCESSOR_NAME "cortex-m85+nomve.fp"
55 #elif defined(CONFIG_ARMV8_M_DSP)
56 #define PROCESSOR_NAME "cortex-m85+nomve"
57 #else
58 #define PROCESSOR_NAME "cortex-m85+nodsp"
59 #endif
60 #elif defined(CONFIG_CPU_CORTEX_R4)
61 #if defined(CONFIG_FPU) && defined(CONFIG_CPU_HAS_VFP)
62 #define PROCESSOR_NAME "cortex-r4f"
63 #else
64 #define PROCESSOR_NAME "cortex-r4"
65 #endif
66 #elif defined(CONFIG_CPU_CORTEX_R5)
67 #if defined(CONFIG_FPU) && defined(CONFIG_CPU_HAS_VFP)
68 #if !defined(CONFIG_VFP_FEATURE_DOUBLE_PRECISION)
69 #define PROCESSOR_NAME "cortex-r5+nofp.dp"
70 #else
71 #define PROCESSOR_NAME "cortex-r5"
72 #endif
73 #else
74 #define PROCESSOR_NAME "cortex-r5+nofp"
75 #endif
76 #elif defined(CONFIG_CPU_CORTEX_R7)
77 #if defined(CONFIG_FPU) && defined(CONFIG_CPU_HAS_VFP)
78 #if !defined(CONFIG_VFP_FEATURE_DOUBLE_PRECISION)
79 #define PROCESSOR_NAME "cortex-r7+nofp.dp"
80 #else
81 #define PROCESSOR_NAME "cortex-r7"
82 #endif
83 #else
84 #define PROCESSOR_NAME "cortex-r7+nofp"
85 #endif
86 #elif defined(CONFIG_CPU_CORTEX_R8)
87 #if defined(CONFIG_FPU) && defined(CONFIG_CPU_HAS_VFP)
88 #if !defined(CONFIG_VFP_FEATURE_DOUBLE_PRECISION)
89 #define PROCESSOR_NAME "cortex-r8+nofp.dp"
90 #else
91 #define PROCESSOR_NAME "cortex-r8"
92 #endif
93 #else
94 #define PROCESSOR_NAME "cortex-r8+nofp"
95 #endif
96 #elif defined(CONFIG_CPU_CORTEX_R52)
97 #if defined(CONFIG_FPU) && defined(CONFIG_CPU_HAS_VFP)
98 #if !defined(CONFIG_VFP_FEATURE_DOUBLE_PRECISION)
99 #define PROCESSOR_NAME "cortex-r52+nofp.dp"
100 #else
101 #define PROCESSOR_NAME "cortex-r52"
102 #endif
103 #else
104 #define PROCESSOR_NAME "cortex-r52"
105 #endif
106 #elif defined(CONFIG_CPU_CORTEX_A9)
107 #define PROCESSOR_NAME "cortex-a9"
108 #endif
109 #elif defined(CONFIG_ARM64)
110 #if defined(CONFIG_CPU_CORTEX_A53)
111 #define PROCESSOR_NAME "cortex-a53"
112 #elif defined(CONFIG_CPU_CORTEX_A55)
113 #define PROCESSOR_NAME "cortex-a55"
114 #elif defined(CONFIG_CPU_CORTEX_A57)
115 #define PROCESSOR_NAME "cortex-a57"
116 #elif defined(CONFIG_CPU_CORTEX_A72)
117 #define PROCESSOR_NAME "cortex-a72"
118 #elif defined(CONFIG_CPU_CORTEX_A76_A55)
119 #define PROCESSOR_NAME "cortex-a76"
120 #elif defined(CONFIG_CPU_CORTEX_A76)
121 #define PROCESSOR_NAME "cortex-a76"
122 #elif defined(CONFIG_CPU_CORTEX_R82)
123 #define PROCESSOR_NAME "armv8.4-a+nolse"
124 #endif
125 #elif defined(CONFIG_ARC)
126 #if defined(CONFIG_CPU_EM4_FPUS)
127 #define PROCESSOR_NAME "em4_fpus"
128 #elif defined(CONFIG_CPU_EM4_DMIPS)
129 #define PROCESSOR_NAME "em4_dmips"
130 #elif defined(CONFIG_CPU_EM4_FPUDA)
131 #define PROCESSOR_NAME "em4_fpuda"
132 #elif defined(CONFIG_CPU_HS3X)
133 #define PROCESSOR_NAME "archs"
134 #elif defined(CONFIG_CPU_HS4X)
135 #define PROCESSOR_NAME "hs4x"
136 #elif defined(CONFIG_CPU_HS5X)
137 #define PROCESSOR_NAME "hs5x"
138 #elif defined(CONFIG_CPU_HS6X)
139 #define PROCESSOR_NAME "hs6x"
140 #elif defined(CONFIG_CPU_EM4)
141 #define PROCESSOR_NAME "arcem"
142 #elif defined(CONFIG_CPU_EM6)
143 #define PROCESSOR_NAME "arcem"
144 #endif
145 #elif defined(CONFIG_X86)
146 #if defined(CONFIG_X86_64)
147 #define PROCESSOR_NAME "x86_64"
148 #else
149 #define PROCESSOR_NAME "x86"
150 #endif
151 #elif defined(CONFIG_RISCV)
152 #define PROCESSOR_NAME "riscv"
153 #elif defined(CONFIG_XTENSA)
154 #define PROCESSOR_NAME "xtensa"
155 #elif defined(CONFIG_SPARC)
156 #define PROCESSOR_NAME "sparc"
157 #endif
158 
159 #ifndef PROCESSOR_NAME
160 #warning "Processor type could not be determined"
161 #define PROCESSOR_NAME "unknown"
162 #endif
163 
164 #ifdef __cplusplus
165 }
166 #endif
167 
168 #endif /* H_OS_MGMT_PROCESSOR_ */
169