]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/IndustryStandard/Pal.h
Disable the warning of bitfield
[mirror_edk2.git] / MdePkg / Include / IndustryStandard / Pal.h
1 /** @file
2 Main PAL API's defined in IPF PAL Spec.
3
4 Copyright (c) 2006 - 2007, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Module Name: PalApi.h
14
15 **/
16
17 #ifndef __PAL_API_H__
18 #define __PAL_API_H__
19
20 //
21 // IPF Specific Functions
22 //
23 #ifdef _MSC_VER
24 //
25 // Disabling bitfield type checking warnings.
26 //
27 #pragma warning ( disable : 4214 )
28 #endif
29
30 typedef struct {
31 UINT64 Status;
32 UINT64 r9;
33 UINT64 r10;
34 UINT64 r11;
35 } PAL_CALL_RETURN;
36
37
38
39 //
40 // CacheType of PAL_CACHE_FLUSH.
41 //
42 #define PAL_CACHE_FLUSH_INSTRUCTION_ALL 1
43 #define PAL_CACHE_FLUSH_DATA_ALL 2
44 #define PAL_CACHE_FLUSH_ALL 3
45 #define PAL_CACHE_FLUSH_SYNC_TO_DATA 4
46
47
48 //
49 // Bitmask of Opearation of PAL_CACHE_FLUSH.
50 //
51 #define PAL_CACHE_FLUSH_INVIDED_LINES BIT0
52 #define PAL_CACHE_FLUSH_PROBE_INTERRUPT BIT1
53
54 /**
55
56 Flush the instruction or data caches. It is required by IPF.
57 The PAL procedure supports the Static Registers calling
58 convention. It could be called at virtual mode and physical
59 mode.
60
61 @param Index Index of PAL_CACHE_FLUSH within the
62 list of PAL procedures.
63
64 @param CacheType Unsigned 64-bit integer indicating
65 which cache to flush.
66
67 @param Operation Formatted bit vector indicating the
68 operation of this call.
69
70 @param ProgressIndicator Unsigned 64-bit integer specifying
71 the starting position of the flush
72 operation.
73
74 @return R9 Unsigned 64-bit integer specifying the vector
75 number of the pending interrupt.
76
77 @return R10 Unsigned 64-bit integer specifying the
78 starting position of the flush operation.
79
80 @return R11 Unsigned 64-bit integer specifying the vector
81 number of the pending interrupt.
82
83 @return Status 2 - Call completed without error, but a PMI
84 was taken during the execution of this
85 procedure.
86
87 @return Status 1 - Call has not completed flushing due to
88 a pending interrupt.
89
90 @return Status 0 - Call completed without error
91
92 @return Status -2 - Invalid argument
93
94 @return Status -3 - Call completed with error
95
96 **/
97 #define PAL_CACHE_FLUSH 1
98
99
100 //
101 // Attributes of PAL_CACHE_CONFIG_INFO1
102 //
103 #define PAL_CACHE_ATTR_WT 0
104 #define PAL_CACHE_ATTR_WB 1
105
106 //
107 // PAL_CACHE_CONFIG_INFO1.StoreHint
108 //
109 #define PAL_CACHE_STORE_TEMPORAL 0
110 #define PAL_CACHE_STORE_NONE_TEMPORAL 3
111
112 //
113 // PAL_CACHE_CONFIG_INFO1.StoreHint
114 //
115 #define PAL_CACHE_STORE_TEMPORAL_LVL_1 0
116 #define PAL_CACHE_STORE_NONE_TEMPORAL_LVL_ALL 3
117
118 //
119 // PAL_CACHE_CONFIG_INFO1.StoreHint
120 //
121 #define PAL_CACHE_LOAD_TEMPORAL_LVL_1 0
122 #define PAL_CACHE_LOAD_NONE_TEMPORAL_LVL_1 1
123 #define PAL_CACHE_LOAD_NONE_TEMPORAL_LVL_ALL 3
124
125 //
126 // Detail the characteristics of a given processor controlled
127 // cache in the cache hierarchy.
128 //
129 typedef struct {
130 UINT64 IsUnified : 1;
131 UINT64 Attributes : 2;
132 UINT64 Associativity:8;
133 UINT64 LineSize:8;
134 UINT64 Stride:8;
135 UINT64 StoreLatency:8;
136 UINT64 StoreHint:8;
137 UINT64 LoadHint:8;
138 } PAL_CACHE_INFO_RETURN1;
139
140 //
141 // Detail the characteristics of a given processor controlled
142 // cache in the cache hierarchy.
143 //
144 typedef struct {
145 UINT64 CacheSize:32;
146 UINT64 AliasBoundary:8;
147 UINT64 TagLsBits:8;
148 UINT64 TagMsBits:8;
149 UINT64 Reserve:8;
150 } PAL_CACHE_INFO_RETURN2;
151
152 /**
153
154 Return detailed instruction or data cache information. It is
155 required by IPF. The PAL procedure supports the Static
156 Registers calling convention. It could be called at virtual
157 mode and physical mode.
158
159 @param Index Index of PAL_CACHE_INFO within the list of
160 PAL procedures.
161
162 @param CacheLevel Unsigned 64-bit integer specifying the
163 level in the cache hierarchy for which
164 information is requested. This value must
165 be between 0 and one less than the value
166 returned in the cache_levels return value
167 from PAL_CACHE_SUMMARY.
168
169 @param CacheType Unsigned 64-bit integer with a value of 1
170 for instruction cache and 2 for data or
171 unified cache. All other values are
172 reserved.
173
174 @param Reserved Should be 0.
175
176
177 @return R9 Detail the characteristics of a given
178 processor controlled cache in the cache
179 hierarchy. See PAL_CACHE_INFO_RETURN1.
180
181 @return R10 Detail the characteristics of a given
182 processor controlled cache in the cache
183 hierarchy. See PAL_CACHE_INFO_RETURN2.
184
185 @return R11 Reserved with 0.
186
187
188 @return Status 0 - Call completed without error
189
190 @return Status -2 - Invalid argument
191
192 @return Status -3 - Call completed with error
193
194 **/
195 #define PAL_CACHE_INFO 2
196
197
198
199 //
200 // Level of PAL_CACHE_INIT.
201 //
202 #define PAL_CACHE_INIT_ALL 0xffffffffffffffffULL
203
204 //
205 // Restrict of PAL_CACHE_INIT.
206 //
207 #define PAL_CACHE_INIT_NO_RESTRICT 0
208 #define PAL_CACHE_INIT_RESTRICTED 1
209
210 /**
211
212 Initialize the instruction or data caches. It is required by
213 IPF. The PAL procedure supports the Static Registers calling
214 convention. It could be called at physical mode.
215
216 @param Index Index of PAL_CACHE_INIT within the list of PAL
217 procedures.
218
219 @param Level Unsigned 64-bit integer containing the level of
220 cache to initialize. If the cache level can be
221 initialized independently, only that level will
222 be initialized. Otherwise
223 implementation-dependent side-effects will
224 occur.
225
226 @param CacheType Unsigned 64-bit integer with a value of 1 to
227 initialize the instruction cache, 2 to
228 initialize the data cache, or 3 to
229 initialize both. All other values are
230 reserved.
231
232 @param Restrict Unsigned 64-bit integer with a value of 0 or
233 1. All other values are reserved. If
234 restrict is 1 and initializing the specified
235 level and cache_type of the cache would
236 cause side-effects, PAL_CACHE_INIT will
237 return -4 instead of initializing the cache.
238
239
240 @return Status 0 - Call completed without error
241
242 @return Status -2 - Invalid argument
243
244 @return Status -3 - Call completed with error.
245
246 @return Status -4 - Call could not initialize the specified
247 level and cache_type of the cache without
248 side-effects and restrict was 1.
249
250 **/
251 #define PAL_CACHE_INIT 3
252
253
254 //
255 // PAL_CACHE_PROTECTION.Method.
256 //
257 #define PAL_CACHE_PROTECTION_NONE_PROTECT 0
258 #define PAL_CACHE_PROTECTION_ODD_PROTECT 1
259 #define PAL_CACHE_PROTECTION_EVEN_PROTECT 2
260 #define PAL_CACHE_PROTECTION_ECC_PROTECT 3
261
262
263
264 //
265 // PAL_CACHE_PROTECTION.TagOrData.
266 //
267 #define PAL_CACHE_PROTECTION_PROTECT_DATA 0
268 #define PAL_CACHE_PROTECTION_PROTECT_TAG 1
269 #define PAL_CACHE_PROTECTION_PROTECT_TAG_ANDTHEN_DATA 2
270 #define PAL_CACHE_PROTECTION_PROTECT_DATA_ANDTHEN_TAG 3
271
272 //
273 // 32-bit protection information structures.
274 //
275 typedef struct {
276 UINT32 DataBits:8;
277 UINT32 TagProtLsb:6;
278 UINT32 TagProtMsb:6;
279 UINT32 ProtBits:6;
280 UINT32 Method:4;
281 UINT32 TagOrData:2;
282 } PAL_CACHE_PROTECTION;
283
284 /**
285
286 Return instruction or data cache protection information. It is
287 required by IPF. The PAL procedure supports the Static
288 Registers calling convention. It could be called at physical
289 mode and Virtual mode.
290
291 @param Index Index of PAL_CACHE_PROT_INFO within the list of
292 PAL procedures.
293
294 @param CacheLevel Unsigned 64-bit integer specifying the level
295 in the cache hierarchy for which information
296 is requested. This value must be between 0
297 and one less than the value returned in the
298 cache_levels return value from
299 PAL_CACHE_SUMMARY.
300
301 @param CacheType Unsigned 64-bit integer with a value of 1
302 for instruction cache and 2 for data or
303 unified cache. All other values are
304 reserved.
305
306 @return R9 Detail the characteristics of a given
307 processor controlled cache in the cache
308 hierarchy. See PAL_CACHE_PROTECTION[0..1].
309
310 @return R10 Detail the characteristics of a given
311 processor controlled cache in the cache
312 hierarchy. See PAL_CACHE_PROTECTION[2..3].
313
314 @return R11 Detail the characteristics of a given
315 processor controlled cache in the cache
316 hierarchy. See PAL_CACHE_PROTECTION[4..5].
317
318
319 @return Status 0 - Call completed without error
320
321 @return Status -2 - Invalid argument
322
323 @return Status -3 - Call completed with error.
324
325 **/
326 #define PAL_CACHE_PROT_INFO 38
327
328
329
330
331
332
333
334 ///
335 // ?????????
336
337
338
339 /**
340
341 Returns information on which logical processors share caches.
342 It is optional.
343
344 @param CallingConvention Static Registers
345
346 @param Mode Physical/Virtual
347
348 **/
349 #define PAL_CACHE_SHARED_INFO 43
350
351
352 /**
353
354 Return a summary of the cache hierarchy. It is required by
355 IPF.
356
357 @param CallingConvention Static Registers
358
359 @param Mode Physical/Virtual
360
361 **/
362 #define PAL_CACHE_SUMMARY 4
363
364 /**
365
366 Return a list of supported memory attributes.. It is required
367 by IPF.
368
369 @param CallingConvention Static Registers
370
371 @param Mode Physical/Virtual
372
373 **/
374 #define PAL_MEM_ATTRIB 5
375
376 /**
377
378 Used in architected sequence to transition pages from a
379 cacheable, speculative attribute to an uncacheable attribute.
380 It is required by IPF.
381
382 @param CallingConvention Static Registers
383
384 @param Mode Physical/Virtual
385
386 **/
387 #define PAL_PREFETCH_VISIBILITY 41
388
389 /**
390
391 Return information needed for ptc.e instruction to purge
392 entire TC. It is required by IPF.
393
394 @param CallingConvention Static Registers
395
396 @param Mode Physical/Virtual
397
398 **/
399 #define PAL_PTCE_INFO 6
400
401 /**
402
403 Return detailed information about virtual memory features
404 supported in the processor. It is required by IPF.
405
406 @param CallingConvention Static Registers
407
408 @param Mode Physical/Virtual
409
410 **/
411 #define PAL_VM_INFO 7
412
413
414 /**
415
416 Return virtual memory TC and hardware walker page sizes
417 supported in the processor. It is required by IPF.
418
419 @param CallingConvention Static Registers
420
421 @param Mode Physical
422
423 **/
424 #define PAL_VM_PAGE_SIZE 34
425
426 /**
427
428 Return summary information about virtual memory features
429 supported in the processor. It is required by IPF.
430
431 @param CallingConvention Static Registers
432
433 @param Mode Physical/Virtual
434
435 **/
436 #define PAL_VM_SUMMARY 8
437
438 /**
439
440 Read contents of a translation register. It is required by
441 IPF.
442
443 @param CallingConvention Stacked Register
444
445 @param Mode Physical
446
447 **/
448 #define PAL_VM_TR_READ 261
449
450 /**
451
452 Return configurable processor bus interface features and their
453 current settings. It is required by IPF.
454
455 @param CallingConvention Static Registers
456
457 @param Mode Physical
458
459 **/
460 #define PAL_BUS_GET_FEATURES 9
461
462
463 /**
464
465 Enable or disable configurable features in processor bus
466 interface. It is required by IPF.
467
468 @param CallingConvention Static Registers
469
470 @param Mode Physical
471
472 **/
473 #define PAL_BUS_SET_FEATURES 10
474
475
476 /**
477
478 Return the number of instruction and data breakpoint
479 registers. It is required by IPF.
480
481 @param CallingConvention Static Registers
482
483 @param Mode Physical/Virtual
484
485 **/
486 #define PAL_DEBUG_INFO 11
487
488 /**
489
490 Return the fixed component of a processor¡¯s directed address.
491 It is required by IPF.
492
493 @param CallingConvention Static Registers
494
495 @param Mode Physical/Virtual
496
497 **/
498 #define PAL_FIXED_ADDR 12
499
500 /**
501
502 Return the frequency of the output clock for use by the
503 platform, if generated by the processor. It is optinal.
504
505 @param CallingConvention Static Registers
506
507 @param Mode Physical/Virtual
508
509 **/
510 #define PAL_FREQ_BASE 13
511
512 /**
513
514 Return ratio of processor, bus, and interval time counter to
515 processor input clock or output clock for platform use, if
516 generated by the processor. It is required by IPF.
517
518 @param CallingConvention Static Registers
519
520 @param Mode Physical/Virtual
521
522 **/
523 #define PAL_FREQ_RATIOS 14
524
525 /**
526
527 Return information on which logical processors map to a
528 physical processor die. It is optinal.
529
530 @param CallingConvention Static Registers
531
532 @param Mode Physical/Virtual
533
534 **/
535 #define PAL_LOGICAL_TO_PHYSICAL 42
536
537 /**
538
539 Return the number and type of performance monitors. It is
540 required by IPF.
541
542 @param CallingConvention Static Registers
543
544 @param Mode Physical/Virtual
545
546 **/
547 #define PAL_PERF_MON_INFO 15
548
549 /**
550
551 Specify processor interrupt block address and I/O port space
552 address. It is required by IPF.
553
554 @param CallingConvention Static Registers
555
556 @param Mode Physical/Virtual
557
558 **/
559 #define PAL_PLATFORM_ADDR 16
560
561
562 /**
563
564 Return configurable processor features and their current
565 setting. It is required by IPF.
566
567 @param CallingConvention Static Registers
568
569 @param Mode Physical/Virtual
570
571 **/
572 #define PAL_PROC_GET_FEATURES 17
573
574
575 /**
576
577 Enable or disable configurable processor features. It is
578 required by IPF.
579
580 @param CallingConvention Static Registers
581
582 @param Mode Physical
583
584 **/
585 #define PAL_PROC_SET_FEATURES 18
586
587 /**
588
589 Return AR and CR register information. It is required by IPF.
590
591 @param CallingConvention Static Registers
592
593 @param Mode Physical/Virtual
594
595 **/
596 #define PAL_REGISTER_INFO 39
597
598 /**
599
600 Return RSE information. It is required by
601 IPF.
602
603 @param CallingConvention Static Registers
604
605 @param Mode Physical/Virtual
606
607 **/
608 #define PAL_RSE_INFO 19
609
610 /**
611
612 Return version of PAL code. It is required by IPF.
613
614 @param CallingConvention Static Registers
615
616 @param Mode Physical/Virtual
617
618 **/
619 #define PAL_VERSION 20
620
621 /**
622
623 Clear all error information from processor error logging
624 registers. It is required by IPF.
625
626 @param CallingConvention Static Registers
627
628 @param Mode Physical/Virtual
629
630 **/
631 #define PAL_MC_CLEAR_LOG 21
632
633 /**
634
635 Ensure that all operations that could cause an MCA have
636 completed. It is required by IPF.
637
638 @param CallingConvention Static Registers
639
640 @param Mode Physical/Virtual
641
642 **/
643 #define PAL_MC_DRAIN 22
644
645 /**
646
647 Return Processor Dynamic State for logging by SAL. It is
648 optional.
649
650 @param CallingConvention Static Registers
651
652 @param Mode Physical
653
654 **/
655 #define PAL_MC_DYNAMIC_STATE 24
656
657 /**
658
659 Return Processor Machine Check Information and Processor
660 Static State for logging by SAL. It is required by IPF.
661
662 @param CallingConvention Static Registers
663
664 @param Mode Physical/Virtual
665
666 **/
667 #define PAL_MC_ERROR_INFO 25 Req. Static Both
668
669 /**
670
671 Set/Reset Expected Machine Check Indicator. It is required by
672 IPF.
673
674 @param CallingConvention Static Registers
675
676 @param Mode Physical
677
678 **/
679 #define PAL_MC_EXPECTED 23
680
681 /**
682
683 Register min-state save area with PAL for machine checks and
684 inits. It is required by IPF.
685
686 @param CallingConvention Static Registers
687
688 @param Mode Physical
689
690 **/
691 #define PAL_MC_REGISTER_MEM 27
692
693 /**
694
695 Restore minimal architected state and return to interrupted
696 process. It is required by IPF.
697
698 @param CallingConvention Static Registers
699
700 @param Mode Physical
701
702 **/
703 #define PAL_MC_RESUME 26
704
705 /**
706
707 Enter the low-power HALT state or an implementation-dependent
708 low-power state. It is optinal.
709
710 @param CallingConvention Static Registers
711
712 @param Mode Physical
713
714 **/
715 #define PAL_HALT 28
716
717
718 /**
719
720 Return the low power capabilities of the processor. It is
721 required by IPF.
722
723 @param CallingConvention Stacked Register
724
725 @param Mode Physical/Virtual
726
727 **/
728 #define PAL_HALT_INFO 257
729
730
731 /**
732
733 Enter the low power LIGHT HALT state. It is required by
734 IPF.
735
736 @param CallingConvention Static Registers
737
738 @param Mode Physical/Virtual
739
740 **/
741 #define PAL_HALT_LIGHT 29
742
743 /**
744
745 Initialize tags and data of a cache line for processor
746 testing. It is required by IPF.
747
748 @param CallingConvention Static Registers
749
750 @param Mode Physical
751
752 **/
753 #define PAL_CACHE_LINE_INIT 31
754
755 /**
756
757 Read tag and data of a cache line for diagnostic testing. It
758 is optional.
759
760 @param CallingConvention Satcked Register
761
762 @param Mode Physical
763
764 **/
765 #define PAL_CACHE_READ 259
766
767 /**
768
769 Write tag and data of a cache for diagnostic testing. It is
770 optional.
771
772 @param CallingConvention Satcked Registers
773
774 @param Mode Physical
775
776 **/
777 #define PAL_CACHE_WRITE 260
778
779 /**
780
781 Returns alignment and size requirements needed for the memory
782 buffer passed to the PAL_TEST_PROC procedure as well as
783 information on self-test control words for the processor self
784 tests. It is required by IPF.
785
786 @param CallingConvention Static Registers
787
788 @param Mode Physical
789
790 **/
791 #define PAL_TEST_INFO 37
792
793 /**
794
795 Perform late processor self test. It is required by
796 IPF.
797
798 @param CallingConvention Stacked Registers
799
800 @param Mode Physical
801
802 **/
803 #define PAL_TEST_PROC 258
804
805 /**
806
807 Return information needed to relocate PAL procedures and PAL
808 PMI code to memory. It is required by IPF.
809
810 @param CallingConvention Static Registers
811
812 @param Mode Physical
813
814 **/
815 #define PAL_COPY_INFO 30
816
817 /**
818
819 Relocate PAL procedures and PAL PMI code to memory. It is
820 required by IPF.
821
822 @param CallingConvention Stacked Registers
823
824 @param Mode Physical
825
826 **/
827 #define PAL_COPY_PAL 256
828
829 /**
830
831 Enter IA-32 System environment. It is optional.
832
833 @param CallingConvention Static Registers
834
835 @param Mode Physical
836
837 **/
838 #define PAL_ENTER_IA_32_ENV 33
839
840 /**
841
842 Register PMI memory entrypoints with processor. It is required
843 by IPF.
844
845 @param CallingConvention Static Registers
846
847 @param Mode Physical
848
849 **/
850 #define PAL_PMI_ENTRYPOINT 32
851
852
853
854 #endif