drivers/option: Add forms in cbtables
[coreboot2.git] / src / include / acpi / acpi_crat.h
blobd18d66ce41b3ae6be073adc31e974ab11a620af4
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef __ACPI_CRAT_H__
4 #define __ACPI_CRAT_H__
6 #include <stdint.h>
8 enum crat_entry_type {
9 CRAT_HSA_PROC_UNIT_TYPE,
10 CRAT_MEMORY_TYPE,
11 CRAT_CACHE_TYPE,
12 CRAT_TLB_TYPE,
13 CRAT_FPU_TYPE,
14 CRAT_IO_TYPE,
15 CRAT_MAX_TYPE,
18 #define CRAT_HSA_PR_FLAG_EN_SHFT 0
19 #define CRAT_HSA_PR_FLAG_EN (0x1 << CRAT_HSA_PR_FLAG_EN_SHFT)
20 #define CRAT_HSA_PR_FLAG_HOT_PLUG_SHFT 1
21 #define CRAT_HSA_PR_FLAG_HOT_PLUG (0x1 << CRAT_HSA_PR_FLAG_HOT_PLUG_SHFT)
22 #define CRAT_HSA_PR_FLAG_CPU_PRES_SHFT 2
23 #define CRAT_HSA_PR_FLAG_CPU_PRES (0x1 << CRAT_HSA_PR_FLAG_CPU_PRES_SHFT)
24 #define CRAT_HSA_PR_FLAG_GPU_PRES_SHFT 3
25 #define CRAT_HSA_PR_FLAG_GPU_PRES (0x1 << CRAT_HSA_PR_FLAG_GPU_PRES_SHFT)
26 #define CRAT_HSA_PR_FLAG_CRAT_HSAMMU_SHFT 4
27 #define CRAT_HSA_PR_FLAG_CRAT_HSAMMU (0x1 << CRAT_HSA_PR_FLAG_CRAT_HSAMMU_SHFT)
28 #define CRAT_HSA_PR_FLAG_VAL_LIM_SHFT 5
29 #define CRAT_HSA_PR_FLAG_VAL_LIM (0x7 << CRAT_HSA_PR_FLAG_VAL_LIM_SHFT)
30 #define CRAT_HSA_PR_FLAG_ATOM_OPS_SHFT 8
31 #define CRAT_HSA_PR_FLAG_ATOM_OPS (0x3 << CRAT_HSA_PR_FLAG_ATOM_OPS_SHFT)
32 #define CRAT_HSA_PR_FLAG_SMT_CAPS_SHFT 10
33 #define CRAT_HSA_PR_FLAG_SMT_CAPS (0x3 << CRAT_HSA_PR_FLAG_SMT_CAPS_SHFT)
35 /* CRAT HSA Processing Unit Affinity Structure */
36 struct crat_hsa_processing_unit {
37 uint8_t type;
38 uint8_t length;
39 uint16_t reserved;
40 uint32_t flags;
41 uint32_t proximity_node;
42 uint32_t processor_id_low;
43 uint16_t num_cpu_cores;
44 uint16_t num_simd_cores;
45 uint16_t max_waves_simd;
46 uint16_t io_count;
47 uint16_t hsa_capability;
48 uint16_t lds_size_in_kb;
49 uint8_t wave_front_size;
50 uint8_t num_shader_banks;
51 uint16_t uengine_identifier;
52 uint8_t num_arrays;
53 uint8_t num_cu_per_array;
54 uint8_t num_simd_per_cu;
55 uint8_t max_slots_scratch_cu;
56 uint8_t reserved1[4];
57 } __packed;
59 #define CRAT_L1_CACHE 1
60 #define CRAT_L2_CACHE 2
61 #define CRAT_L3_CACHE 3
63 #define CRAT_MEM_FLAG_EN_SHFT 0
64 #define CRAT_MEM_FLAG_EN (0x1 << CRAT_MEM_FLAG_EN_SHFT)
65 #define CRAT_MEM_FLAG_HOT_PLUG_SHFT 1
66 #define CRAT_MEM_FLAG_HOT_PLUG (0x1 << CRAT_MEM_FLAG_HOT_PLUG_SHFT)
67 #define CRAT_MEM_FLAG_NV_SHFT 2
68 #define CRAT_MEM_FLAG_NV (0x1 << CRAT_MEM_FLAG_NV_SHFT)
69 #define CRAT_MEM_FLAG_ATOM_OPS_SHFT 3
70 #define CRAT_MEM_FLAG_ATOM_OPS (0x3 << CRAT_MEM_FLAG_ATOM_OPS_SHFT)
72 /* CRAT Memory Affinity Structure */
73 struct crat_memory {
74 uint8_t type;
75 uint8_t length;
76 uint16_t reserved;
77 uint32_t flags;
78 uint32_t proximity_domain;
79 uint32_t base_address_low;
80 uint32_t base_address_high;
81 uint32_t length_low;
82 uint32_t length_high;
83 uint32_t width;
84 uint8_t reserved1[8];
85 } __packed;
87 #define CRAT_CACHE_FLAG_EN_SHFT 0
88 #define CRAT_CACHE_FLAG_EN (0x1 << CRAT_CACHE_FLAG_EN_SHFT)
89 #define CRAT_CACHE_FLAG_DATA_CACHE_SHFT 1
90 #define CRAT_CACHE_FLAG_DATA_CACHE (0x1 << CRAT_CACHE_FLAG_DATA_CACHE_SHFT)
91 #define CRAT_CACHE_FLAG_INSTR_CACHE_SHFT 2
92 #define CRAT_CACHE_FLAG_INSTR_CACHE (0x1 << CRAT_CACHE_FLAG_INSTR_CACHE_SHFT)
93 #define CRAT_CACHE_FLAG_CPU_CACHE_SHFT 3
94 #define CRAT_CACHE_FLAG_CPU_CACHE (0x1 << CRAT_CACHE_FLAG_CPU_CACHE_SHFT)
95 #define CRAT_CACHE_FLAG_SIMD_CACHE_SHFT 4
96 #define CRAT_CACHE_FLAG_SIMD_CACHE (0x1 << CRAT_CACHE_FLAG_SIMD_CACHE_SHFT)
97 #define CRAT_CACHE_FLAG_GDS_SHFT 5
98 #define CRAT_CACHE_FLAG_GDS (0x1 << CRAT_CACHE_FLAG_GDS_SHFT)
99 #define CRAT_CACHE_FLAG_ATOMIC_OPS_SHFT 6
100 #define CRAT_CACHE_FLAG_ATOMIC_OPS (0x1 << CRAT_CACHE_FLAG_ATOMIC_OPS_SHFT)
102 /* CRAT Cache Affinity Structure */
103 struct crat_cache {
104 uint8_t type;
105 uint8_t length;
106 uint16_t reserved;
107 uint32_t flags;
108 uint32_t proc_id_low;
109 uint8_t sibling_map[32];
110 uint32_t cache_size;
111 uint8_t cache_level;
112 uint8_t lines_per_tag;
113 uint16_t cache_line_size;
114 uint8_t associativity;
115 uint8_t cache_properties;
116 uint16_t cache_latency;
117 uint8_t reserved1[8];
118 } __packed;
120 enum tlb_type {
121 tlb_2m,
122 tlb_4k,
123 tlb_1g,
124 tlb_type_max,
127 #define CRAT_TLB_FLAG_EN_SHFT 0
128 #define CRAT_TLB_FLAG_EN (0x1 << CRAT_TLB_FLAG_EN_SHFT)
129 #define CRAT_TLB_FLAG_DATA_TLB_SHFT 1
130 #define CRAT_TLB_FLAG_DATA_TLB (0x1 << CRAT_TLB_FLAG_DATA_TLB_SHFT)
131 #define CRAT_TLB_FLAG_INSTR_TLB_SHFT 2
132 #define CRAT_TLB_FLAG_INSTR_TLB (0x1 << CRAT_TLB_FLAG_INSTR_TLB_SHFT)
133 #define CRAT_TLB_FLAG_CPU_TLB_SHFT 3
134 #define CRAT_TLB_FLAG_CPU_TLB (0x1 << CRAT_TLB_FLAG_CPU_TLB_SHFT)
135 #define CRAT_TLB_FLAG_SIMD_TLB_SHFT 4
136 #define CRAT_TLB_FLAG_SIMD_TLB (0x1 << CRAT_TLB_FLAG_SIMD_TLB_SHFT)
137 #define CRAT_TLB_FLAG_4K_BASE_256_SHFT 5
138 #define CRAT_TLB_FLAG_4K_BASE_256 (0x1 << CRAT_TLB_FLAG_4K_BASE_256_SHFT)
139 #define CRAT_TLB_FLAG_2MB_BASE_256_SHFT 7
140 #define CRAT_TLB_FLAG_2MB_BASE_256 (0x1 << CRAT_TLB_FLAG_2MB_BASE_256_SHFT)
141 #define CRAT_TLB_FLAG_1GB_BASE_256_SHFT 9
142 #define CRAT_TLB_FLAG_1GB_BASE_256 (0x1 << CRAT_TLB_FLAG_1GB_BASE_256_SHFT)
144 /* CRAT TLB Affinity Structure */
145 struct crat_tlb {
146 uint8_t type;
147 uint8_t length;
148 uint16_t reserved;
149 uint32_t flags;
150 uint32_t proc_id_low;
151 uint8_t sibling_map[32];
152 uint32_t tlb_level;
153 uint8_t data_tlb_2mb_assoc;
154 uint8_t data_tlb_2mb_size;
155 uint8_t instr_tlb_2mb_assoc;
156 uint8_t instr_tlb_2mb_size;
157 uint8_t data_tlb_4k_assoc;
158 uint8_t data_tlb_4k_size;
159 uint8_t instr_tlb_4k_assoc;
160 uint8_t instr_tlb_4k_size;
161 uint8_t data_tlb_1g_assoc;
162 uint8_t data_tlb_1g_size;
163 uint8_t instr_tlb_1g_assoc;
164 uint8_t instr_tlb_1g_size;
165 uint8_t reserved1[4];
166 } __packed;
168 #define CRAT_FPU_FLAG_EN_SHFT 0
169 #define CRAT_FPU_FLAG_EN (0x1 << CRAT_TLB_FLAG_EN_SHFT)
171 /* CRAT FPU Affinity Structure */
172 struct crat_fpu {
173 uint8_t type;
174 uint8_t length;
175 uint16_t reserved;
176 uint32_t flags;
177 uint32_t proc_id_low;
178 uint8_t sibling_map[32];
179 uint32_t fpu_size;
180 uint8_t reserved1[16];
181 } __packed;
183 #define CRAT_IO_FLAG_EN_SHFT 0
184 #define CRAT_IO_FLAG_EN (0x1 << CRAT_IO_FLAG_EN_SHFT)
185 #define CRAT_IO_FLAG_COHER_SHFT 1
186 #define CRAT_IO_FLAG_COHER (0x1 << CRAT_IO_FLAG_COHER_SHFT)
188 /* CRAT IO Affinity Structure */
189 struct crat_io {
190 uint8_t type;
191 uint8_t length;
192 uint16_t reserved;
193 uint32_t flags;
194 uint32_t proximity_domain_from;
195 uint32_t proximity_domain_to;
196 uint8_t io_type;
197 uint8_t version_major;
198 uint16_t version_minor;
199 uint32_t minimum_latency;
200 uint32_t maximum_latency;
201 uint32_t minimum_bandwidth;
202 uint32_t maximum_bandwidth;
203 uint32_t recommended_transfer_size;
204 uint8_t reserved1[24];
205 } __packed;
207 #endif /* __ACPI_CRAT_H__ */