]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/IndustryStandard/Pal.h
Disable the warning of bitfield
[mirror_edk2.git] / MdePkg / Include / IndustryStandard / Pal.h
CommitLineData
540dfc26 1/** @file\r
2 Main PAL API's defined in IPF PAL Spec.\r
3\r
4 Copyright (c) 2006 - 2007, Intel Corporation\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13 Module Name: PalApi.h\r
14\r
15**/\r
16\r
17#ifndef __PAL_API_H__\r
18#define __PAL_API_H__\r
19\r
20//\r
21// IPF Specific Functions\r
22//\r
ecb8241b 23#ifdef _MSC_VER\r
24//\r
25// Disabling bitfield type checking warnings.\r
26//\r
27#pragma warning ( disable : 4214 )\r
28#endif\r
29 \r
540dfc26 30typedef struct {\r
31 UINT64 Status;\r
32 UINT64 r9;\r
33 UINT64 r10;\r
34 UINT64 r11;\r
35} PAL_CALL_RETURN;\r
36\r
37\r
38\r
39//\r
40// CacheType of PAL_CACHE_FLUSH.\r
41//\r
42#define PAL_CACHE_FLUSH_INSTRUCTION_ALL 1\r
43#define PAL_CACHE_FLUSH_DATA_ALL 2\r
44#define PAL_CACHE_FLUSH_ALL 3\r
45#define PAL_CACHE_FLUSH_SYNC_TO_DATA 4\r
46\r
47\r
48//\r
49// Bitmask of Opearation of PAL_CACHE_FLUSH.\r
50// \r
51#define PAL_CACHE_FLUSH_INVIDED_LINES BIT0\r
52#define PAL_CACHE_FLUSH_PROBE_INTERRUPT BIT1\r
53\r
54/**\r
55 \r
56 Flush the instruction or data caches. It is required by IPF.\r
57 The PAL procedure supports the Static Registers calling\r
58 convention. It could be called at virtual mode and physical\r
59 mode.\r
60\r
61 @param Index Index of PAL_CACHE_FLUSH within the\r
62 list of PAL procedures.\r
63 \r
64 @param CacheType Unsigned 64-bit integer indicating\r
65 which cache to flush.\r
66\r
67 @param Operation Formatted bit vector indicating the\r
68 operation of this call.\r
69\r
70 @param ProgressIndicator Unsigned 64-bit integer specifying\r
71 the starting position of the flush\r
72 operation.\r
73 \r
74 @return R9 Unsigned 64-bit integer specifying the vector\r
75 number of the pending interrupt.\r
76 \r
77 @return R10 Unsigned 64-bit integer specifying the\r
78 starting position of the flush operation.\r
79 \r
80 @return R11 Unsigned 64-bit integer specifying the vector\r
81 number of the pending interrupt.\r
82 \r
83 @return Status 2 - Call completed without error, but a PMI\r
84 was taken during the execution of this\r
85 procedure.\r
86\r
87 @return Status 1 - Call has not completed flushing due to\r
88 a pending interrupt.\r
89\r
90 @return Status 0 - Call completed without error\r
91\r
92 @return Status -2 - Invalid argument\r
93\r
94 @return Status -3 - Call completed with error\r
95 \r
96**/\r
97#define PAL_CACHE_FLUSH 1\r
98\r
99\r
100//\r
101// Attributes of PAL_CACHE_CONFIG_INFO1\r
102// \r
103#define PAL_CACHE_ATTR_WT 0\r
104#define PAL_CACHE_ATTR_WB 1\r
105\r
106//\r
107// PAL_CACHE_CONFIG_INFO1.StoreHint\r
108// \r
109#define PAL_CACHE_STORE_TEMPORAL 0\r
110#define PAL_CACHE_STORE_NONE_TEMPORAL 3\r
111\r
112//\r
113// PAL_CACHE_CONFIG_INFO1.StoreHint\r
114// \r
115#define PAL_CACHE_STORE_TEMPORAL_LVL_1 0\r
116#define PAL_CACHE_STORE_NONE_TEMPORAL_LVL_ALL 3\r
117\r
118//\r
119// PAL_CACHE_CONFIG_INFO1.StoreHint\r
120// \r
121#define PAL_CACHE_LOAD_TEMPORAL_LVL_1 0\r
122#define PAL_CACHE_LOAD_NONE_TEMPORAL_LVL_1 1\r
123#define PAL_CACHE_LOAD_NONE_TEMPORAL_LVL_ALL 3\r
124\r
125//\r
126// Detail the characteristics of a given processor controlled\r
127// cache in the cache hierarchy.\r
128// \r
129typedef struct {\r
130 UINT64 IsUnified : 1;\r
131 UINT64 Attributes : 2;\r
132 UINT64 Associativity:8;\r
133 UINT64 LineSize:8;\r
134 UINT64 Stride:8;\r
135 UINT64 StoreLatency:8;\r
136 UINT64 StoreHint:8;\r
137 UINT64 LoadHint:8;\r
138} PAL_CACHE_INFO_RETURN1;\r
139\r
140//\r
141// Detail the characteristics of a given processor controlled\r
142// cache in the cache hierarchy.\r
143// \r
144typedef struct {\r
145 UINT64 CacheSize:32;\r
146 UINT64 AliasBoundary:8;\r
147 UINT64 TagLsBits:8;\r
148 UINT64 TagMsBits:8;\r
ecb8241b 149 UINT64 Reserve:8;\r
540dfc26 150} PAL_CACHE_INFO_RETURN2;\r
151\r
152/**\r
153 \r
154 Return detailed instruction or data cache information. It is\r
155 required by IPF. The PAL procedure supports the Static\r
156 Registers calling convention. It could be called at virtual\r
157 mode and physical mode.\r
158 \r
159 @param Index Index of PAL_CACHE_INFO within the list of\r
160 PAL procedures.\r
161 \r
162 @param CacheLevel Unsigned 64-bit integer specifying the\r
163 level in the cache hierarchy for which\r
164 information is requested. This value must\r
165 be between 0 and one less than the value\r
166 returned in the cache_levels return value\r
167 from PAL_CACHE_SUMMARY.\r
168 \r
169 @param CacheType Unsigned 64-bit integer with a value of 1\r
170 for instruction cache and 2 for data or\r
171 unified cache. All other values are\r
172 reserved.\r
173 \r
174 @param Reserved Should be 0.\r
175 \r
176 \r
177 @return R9 Detail the characteristics of a given\r
178 processor controlled cache in the cache\r
179 hierarchy. See PAL_CACHE_INFO_RETURN1.\r
180 \r
181 @return R10 Detail the characteristics of a given\r
182 processor controlled cache in the cache\r
183 hierarchy. See PAL_CACHE_INFO_RETURN2.\r
184 \r
185 @return R11 Reserved with 0.\r
186 \r
187 \r
188 @return Status 0 - Call completed without error\r
189\r
190 @return Status -2 - Invalid argument\r
191\r
192 @return Status -3 - Call completed with error\r
193 \r
194**/\r
195#define PAL_CACHE_INFO 2\r
196\r
197\r
198\r
199//\r
200// Level of PAL_CACHE_INIT.\r
201// \r
202#define PAL_CACHE_INIT_ALL 0xffffffffffffffffULL\r
203\r
204//\r
205// Restrict of PAL_CACHE_INIT.\r
206// \r
207#define PAL_CACHE_INIT_NO_RESTRICT 0\r
208#define PAL_CACHE_INIT_RESTRICTED 1\r
209\r
210/**\r
211 \r
212 Initialize the instruction or data caches. It is required by\r
213 IPF. The PAL procedure supports the Static Registers calling\r
214 convention. It could be called at physical mode.\r
215\r
216 @param Index Index of PAL_CACHE_INIT within the list of PAL\r
217 procedures.\r
218 \r
219 @param Level Unsigned 64-bit integer containing the level of\r
220 cache to initialize. If the cache level can be\r
221 initialized independently, only that level will\r
222 be initialized. Otherwise\r
223 implementation-dependent side-effects will\r
224 occur.\r
225 \r
226 @param CacheType Unsigned 64-bit integer with a value of 1 to\r
227 initialize the instruction cache, 2 to\r
228 initialize the data cache, or 3 to\r
229 initialize both. All other values are\r
230 reserved.\r
231\r
232 @param Restrict Unsigned 64-bit integer with a value of 0 or\r
233 1. All other values are reserved. If\r
234 restrict is 1 and initializing the specified\r
235 level and cache_type of the cache would\r
236 cause side-effects, PAL_CACHE_INIT will\r
237 return -4 instead of initializing the cache.\r
238 \r
239 \r
240 @return Status 0 - Call completed without error\r
241\r
242 @return Status -2 - Invalid argument\r
243\r
244 @return Status -3 - Call completed with error.\r
245 \r
246 @return Status -4 - Call could not initialize the specified\r
247 level and cache_type of the cache without\r
248 side-effects and restrict was 1. \r
249 \r
250**/\r
251#define PAL_CACHE_INIT 3 \r
252\r
253\r
254//\r
255// PAL_CACHE_PROTECTION.Method.\r
256// \r
257#define PAL_CACHE_PROTECTION_NONE_PROTECT 0\r
258#define PAL_CACHE_PROTECTION_ODD_PROTECT 1\r
259#define PAL_CACHE_PROTECTION_EVEN_PROTECT 2\r
260#define PAL_CACHE_PROTECTION_ECC_PROTECT 3\r
261\r
262\r
263\r
264//\r
265// PAL_CACHE_PROTECTION.TagOrData.\r
266// \r
267#define PAL_CACHE_PROTECTION_PROTECT_DATA 0\r
268#define PAL_CACHE_PROTECTION_PROTECT_TAG 1\r
269#define PAL_CACHE_PROTECTION_PROTECT_TAG_ANDTHEN_DATA 2\r
270#define PAL_CACHE_PROTECTION_PROTECT_DATA_ANDTHEN_TAG 3\r
271\r
272//\r
273// 32-bit protection information structures.\r
274// \r
275typedef struct {\r
276 UINT32 DataBits:8;\r
277 UINT32 TagProtLsb:6;\r
278 UINT32 TagProtMsb:6;\r
279 UINT32 ProtBits:6;\r
280 UINT32 Method:4;\r
281 UINT32 TagOrData:2;\r
282} PAL_CACHE_PROTECTION;\r
283\r
284/**\r
285 \r
286 Return instruction or data cache protection information. It is\r
287 required by IPF. The PAL procedure supports the Static\r
288 Registers calling convention. It could be called at physical\r
289 mode and Virtual mode.\r
290\r
291 @param Index Index of PAL_CACHE_PROT_INFO within the list of\r
292 PAL procedures.\r
293\r
294 @param CacheLevel Unsigned 64-bit integer specifying the level\r
295 in the cache hierarchy for which information\r
296 is requested. This value must be between 0\r
297 and one less than the value returned in the\r
298 cache_levels return value from\r
299 PAL_CACHE_SUMMARY.\r
300\r
301 @param CacheType Unsigned 64-bit integer with a value of 1\r
302 for instruction cache and 2 for data or\r
303 unified cache. All other values are\r
304 reserved.\r
305 \r
306 @return R9 Detail the characteristics of a given\r
307 processor controlled cache in the cache\r
308 hierarchy. See PAL_CACHE_PROTECTION[0..1].\r
309 \r
310 @return R10 Detail the characteristics of a given\r
311 processor controlled cache in the cache\r
312 hierarchy. See PAL_CACHE_PROTECTION[2..3].\r
313 \r
314 @return R11 Detail the characteristics of a given\r
315 processor controlled cache in the cache\r
316 hierarchy. See PAL_CACHE_PROTECTION[4..5].\r
317 \r
318 \r
319 @return Status 0 - Call completed without error\r
320\r
321 @return Status -2 - Invalid argument\r
322\r
323 @return Status -3 - Call completed with error.\r
324 \r
325**/\r
326#define PAL_CACHE_PROT_INFO 38\r
327\r
328\r
329\r
330\r
331\r
332\r
333\r
334///\r
335// ?????????\r
336\r
337\r
338\r
339/**\r
340 \r
341 Returns information on which logical processors share caches.\r
342 It is optional.\r
343\r
344 @param CallingConvention Static Registers\r
345\r
346 @param Mode Physical/Virtual\r
347 \r
348**/\r
349#define PAL_CACHE_SHARED_INFO 43\r
350\r
351\r
352/**\r
353 \r
354 Return a summary of the cache hierarchy. It is required by\r
355 IPF.\r
356\r
357 @param CallingConvention Static Registers\r
358\r
359 @param Mode Physical/Virtual\r
360 \r
361**/\r
362#define PAL_CACHE_SUMMARY 4\r
363\r
364/**\r
365 \r
366 Return a list of supported memory attributes.. It is required\r
367 by IPF.\r
368\r
369 @param CallingConvention Static Registers\r
370\r
371 @param Mode Physical/Virtual\r
372 \r
373**/\r
374#define PAL_MEM_ATTRIB 5\r
375\r
376/**\r
377 \r
378 Used in architected sequence to transition pages from a\r
379 cacheable, speculative attribute to an uncacheable attribute.\r
380 It is required by IPF.\r
381\r
382 @param CallingConvention Static Registers\r
383\r
384 @param Mode Physical/Virtual\r
385 \r
386**/\r
387#define PAL_PREFETCH_VISIBILITY 41\r
388\r
389/**\r
390 \r
391 Return information needed for ptc.e instruction to purge\r
392 entire TC. It is required by IPF.\r
393\r
394 @param CallingConvention Static Registers\r
395\r
396 @param Mode Physical/Virtual\r
397 \r
398**/\r
399#define PAL_PTCE_INFO 6\r
400\r
401/**\r
402 \r
403 Return detailed information about virtual memory features\r
404 supported in the processor. It is required by IPF.\r
405\r
406 @param CallingConvention Static Registers\r
407\r
408 @param Mode Physical/Virtual\r
409 \r
410**/\r
411#define PAL_VM_INFO 7\r
412\r
413\r
414/**\r
415 \r
416 Return virtual memory TC and hardware walker page sizes\r
417 supported in the processor. It is required by IPF.\r
418\r
419 @param CallingConvention Static Registers\r
420\r
421 @param Mode Physical\r
422 \r
423**/\r
424#define PAL_VM_PAGE_SIZE 34\r
425\r
426/**\r
427 \r
428 Return summary information about virtual memory features\r
429 supported in the processor. It is required by IPF.\r
430\r
431 @param CallingConvention Static Registers\r
432\r
433 @param Mode Physical/Virtual\r
434 \r
435**/\r
436#define PAL_VM_SUMMARY 8\r
437\r
438/**\r
439 \r
440 Read contents of a translation register. It is required by\r
441 IPF.\r
442\r
443 @param CallingConvention Stacked Register\r
444\r
445 @param Mode Physical\r
446 \r
447**/\r
448#define PAL_VM_TR_READ 261 \r
449\r
450/**\r
451 \r
452 Return configurable processor bus interface features and their\r
453 current settings. It is required by IPF.\r
454\r
455 @param CallingConvention Static Registers\r
456\r
457 @param Mode Physical\r
458 \r
459**/\r
460#define PAL_BUS_GET_FEATURES 9\r
461\r
462\r
463/**\r
464 \r
465 Enable or disable configurable features in processor bus\r
466 interface. It is required by IPF.\r
467\r
468 @param CallingConvention Static Registers\r
469\r
470 @param Mode Physical\r
471 \r
472**/\r
473#define PAL_BUS_SET_FEATURES 10\r
474\r
475\r
476/**\r
477 \r
478 Return the number of instruction and data breakpoint\r
479 registers. It is required by IPF.\r
480\r
481 @param CallingConvention Static Registers\r
482\r
483 @param Mode Physical/Virtual\r
484 \r
485**/\r
486#define PAL_DEBUG_INFO 11\r
487\r
488/**\r
489 \r
490