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