summaryrefslogtreecommitdiff
path: root/MdePkg/Include/IndustryStandard/Pal.h
blob: 4f079ad15669d8f85a4a03df41fc61394ffdad07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
/** @file
  Main PAL API's defined in IPF PAL Spec.

  Copyright (c) 2006 - 2007, Intel Corporation
  All rights reserved. This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD License
  which accompanies this distribution.  The full text of the license may be found at
  http://opensource.org/licenses/bsd-license.php

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

  Module Name:  PalApi.h

**/

#ifndef __PAL_API_H__
#define __PAL_API_H__

//
// IPF Specific Functions
//

typedef struct {
  UINT64                    Status;
  UINT64                    r9;
  UINT64                    r10;
  UINT64                    r11;
} PAL_CALL_RETURN;



//
// CacheType of PAL_CACHE_FLUSH.
//
#define PAL_CACHE_FLUSH_INSTRUCTION_ALL 	1
#define PAL_CACHE_FLUSH_DATA_ALL 					2
#define PAL_CACHE_FLUSH_ALL								3
#define PAL_CACHE_FLUSH_SYNC_TO_DATA   		4


//
// Bitmask of Opearation of PAL_CACHE_FLUSH.
// 
#define PAL_CACHE_FLUSH_INVIDED_LINES			BIT0
#define PAL_CACHE_FLUSH_PROBE_INTERRUPT		BIT1

/**
   
  Flush the instruction or data caches. It is required by IPF.
  The PAL procedure supports the Static Registers calling
  convention. It could be called at virtual mode and physical
  mode.

  @param Index 							Index of PAL_CACHE_FLUSH within the
														list of PAL procedures.
  
  @param CacheType					Unsigned 64-bit integer indicating
														which cache to flush.

  @param Operation 					Formatted bit vector indicating the
														operation of this call.

  @param ProgressIndicator  Unsigned 64-bit integer specifying
                            the starting position of the flush
                            operation.
  
  @return R9			Unsigned 64-bit integer specifying the vector
									number of the pending interrupt.
  
  @return R10			Unsigned 64-bit integer specifying the
                  starting position of the flush operation.
  
  @return R11			Unsigned 64-bit integer specifying the vector
									number of the pending interrupt.
  
  @return Status	2 - Call completed without error, but a PMI
                  was taken during the execution of this
                  procedure.

  @return Status	1 - Call has not completed flushing due to
                  a pending interrupt.

  @return Status  0 - Call completed without error

  @return Status  -2 - Invalid argument

  @return Status  -3 - Call completed with error
   
**/
#define PAL_CACHE_FLUSH 	1


//
// Attributes of PAL_CACHE_CONFIG_INFO1
// 
#define PAL_CACHE_ATTR_WT 	0
#define PAL_CACHE_ATTR_WB		1

//
// PAL_CACHE_CONFIG_INFO1.StoreHint
// 
#define PAL_CACHE_STORE_TEMPORAL			0
#define PAL_CACHE_STORE_NONE_TEMPORAL	3

//
// PAL_CACHE_CONFIG_INFO1.StoreHint
// 
#define PAL_CACHE_STORE_TEMPORAL_LVL_1				0
#define PAL_CACHE_STORE_NONE_TEMPORAL_LVL_ALL	3

//
// PAL_CACHE_CONFIG_INFO1.StoreHint
// 
#define PAL_CACHE_LOAD_TEMPORAL_LVL_1					0
#define PAL_CACHE_LOAD_NONE_TEMPORAL_LVL_1		1
#define PAL_CACHE_LOAD_NONE_TEMPORAL_LVL_ALL	3

//
// Detail the characteristics of a given processor controlled
// cache in the cache hierarchy.
// 
typedef struct {
	UINT64	IsUnified 	: 1;
	UINT64	Attributes	:	2;
	UINT64	Associativity:8;
	UINT64	LineSize:8;
	UINT64	Stride:8;
	UINT64	StoreLatency:8;
	UINT64	StoreHint:8;
	UINT64	LoadHint:8;
} PAL_CACHE_INFO_RETURN1;

//
// Detail the characteristics of a given processor controlled
// cache in the cache hierarchy.
// 
typedef struct {
	UINT64	CacheSize:32;
	UINT64	AliasBoundary:8;
	UINT64	TagLsBits:8;
	UINT64	TagMsBits:8;
} PAL_CACHE_INFO_RETURN2;

/**
   
  Return detailed instruction or data cache information. It is
  required by IPF. The PAL procedure supports the Static
  Registers calling convention. It could be called at virtual
  mode and physical mode.
  
  @param Index 				Index of PAL_CACHE_INFO within the list of
											PAL procedures.
  
  @param CacheLevel		Unsigned 64-bit integer specifying the
                      level in the cache hierarchy for which
                      information is requested. This value must
                      be between 0 and one less than the value
                      returned in the cache_levels return value
                      from PAL_CACHE_SUMMARY.
  
  @param CacheType    Unsigned 64-bit integer with a value of 1
                      for instruction cache and 2 for data or
                      unified cache. All other values are
                      reserved.
  
  @param Reserved 		Should be 0.
  
  
  @return R9			Detail the characteristics of a given
                  processor controlled cache in the cache
                  hierarchy. See PAL_CACHE_INFO_RETURN1.
  
  @return R10			Detail the characteristics of a given
                  processor controlled cache in the cache
                  hierarchy. See PAL_CACHE_INFO_RETURN2.
  
  @return R11			Reserved with 0.
  
  
  @return Status  0 - Call completed without error

  @return Status  -2 - Invalid argument

  @return Status  -3 - Call completed with error
   
**/
#define PAL_CACHE_INFO 		2



//
// Level of PAL_CACHE_INIT.
// 
#define PAL_CACHE_INIT_ALL	0xffffffffffffffffULL

//
// Restrict of PAL_CACHE_INIT.
// 
#define PAL_CACHE_INIT_NO_RESTRICT	0
#define PAL_CACHE_INIT_RESTRICTED		1

/**
   
  Initialize the instruction or data caches. It is required by
  IPF. The PAL procedure supports the Static Registers calling
  convention. It could be called at physical mode.

  @param Index 	Index of PAL_CACHE_INIT within the list of PAL
                procedures.
  
  @param Level 	Unsigned 64-bit integer containing the level of
                cache to initialize. If the cache level can be
                initialized independently, only that level will
                be initialized. Otherwise
                implementation-dependent side-effects will
                occur.
  
  @param CacheType 	Unsigned 64-bit integer with a value of 1 to
                    initialize the instruction cache, 2 to
                    initialize the data cache, or 3 to
                    initialize both. All other values are
                    reserved.

  @param Restrict 	Unsigned 64-bit integer with a value of 0 or
                    1. All other values are reserved. If
                    restrict is 1 and initializing the specified
                    level and cache_type of the cache would
                    cause side-effects, PAL_CACHE_INIT will
                    return -4 instead of initializing the cache.
 
  
  @return Status  0 - Call completed without error

  @return Status  -2 - Invalid argument

  @return Status  -3 - Call completed with error.
  
  @return Status  -4 - Call could not initialize the specified
                  level and cache_type of the cache without
									side-effects and restrict was 1.  
   
**/
#define PAL_CACHE_INIT 		3 


//
// PAL_CACHE_PROTECTION.Method.
// 
#define PAL_CACHE_PROTECTION_NONE_PROTECT		0
#define PAL_CACHE_PROTECTION_ODD_PROTECT		1
#define PAL_CACHE_PROTECTION_EVEN_PROTECT		2
#define PAL_CACHE_PROTECTION_ECC_PROTECT		3



//
// PAL_CACHE_PROTECTION.TagOrData.
// 
#define PAL_CACHE_PROTECTION_PROTECT_DATA		0
#define PAL_CACHE_PROTECTION_PROTECT_TAG		1
#define PAL_CACHE_PROTECTION_PROTECT_TAG_ANDTHEN_DATA		2
#define PAL_CACHE_PROTECTION_PROTECT_DATA_ANDTHEN_TAG		3

//
// 32-bit protection information structures.
// 
typedef struct {
	UINT32 	DataBits:8;
	UINT32 	TagProtLsb:6;
	UINT32	TagProtMsb:6;
	UINT32	ProtBits:6;
	UINT32	Method:4;
	UINT32	TagOrData:2;
} PAL_CACHE_PROTECTION;

/**
   
  Return instruction or data cache protection information. It is
  required by IPF. The PAL procedure supports the Static
  Registers calling convention. It could be called at physical
  mode and Virtual mode.

  @param Index 	Index of PAL_CACHE_PROT_INFO within the list of
                PAL procedures.

  @param CacheLevel	Unsigned 64-bit integer specifying the level
                    in the cache hierarchy for which information
                    is requested. This value must be between 0
                    and one less than the value returned in the
                    cache_levels return value from
                    PAL_CACHE_SUMMARY.

  @param CacheType	Unsigned 64-bit integer with a value of 1
                    for instruction cache and 2 for data or
                    unified cache. All other values are
                    reserved.
  
  @return R9			Detail the characteristics of a given
                  processor controlled cache in the cache
                  hierarchy. See PAL_CACHE_PROTECTION[0..1].
  
  @return R10			Detail the characteristics of a given
                  processor controlled cache in the cache
                  hierarchy. See PAL_CACHE_PROTECTION[2..3].
  
  @return R11			Detail the characteristics of a given
                  processor controlled cache in the cache
                  hierarchy. See PAL_CACHE_PROTECTION[4..5].
  
  
  @return Status  0 - Call completed without error

  @return Status  -2 - Invalid argument

  @return Status  -3 - Call completed with error.
   
**/
#define PAL_CACHE_PROT_INFO 		38







///
// ?????????



/**
   
  Returns information on which logical processors share caches.
  It is optional.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_CACHE_SHARED_INFO 	43


/**
   
  Return a summary of the cache hierarchy. It is required by
  IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_CACHE_SUMMARY		4

/**
   
  Return a list of supported memory attributes.. It is required
  by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_MEM_ATTRIB 			5

/**
   
  Used in architected sequence to transition pages from a
  cacheable, speculative attribute to an uncacheable attribute.
  It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_PREFETCH_VISIBILITY 	41

/**
   
  Return information needed for ptc.e instruction to purge
  entire TC. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_PTCE_INFO 		6

/**
   
  Return detailed information about virtual memory features
  supported in the processor. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_VM_INFO 			7


/**
   
  Return virtual memory TC and hardware walker page sizes
  supported in the processor. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_VM_PAGE_SIZE 34

/**
   
  Return summary information about virtual memory features
  supported in the processor. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_VM_SUMMARY 	8

/**
   
  Read contents of a translation register. It is required by
  IPF.

  @param CallingConvention  Stacked Register

  @param Mode               Physical
   
**/
#define PAL_VM_TR_READ 	261 

/**
   
  Return configurable processor bus interface features and their
  current settings. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_BUS_GET_FEATURES 9


/**
   
  Enable or disable configurable features in processor bus
  interface. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_BUS_SET_FEATURES 10


/**
   
  Return the number of instruction and data breakpoint
  registers. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_DEBUG_INFO 	11

/**
   
  Return the fixed component of a processor¡¯s directed address.
  It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_FIXED_ADDR 12

/**
   
  Return the frequency of the output clock for use by the
  platform, if generated by the processor. It is optinal.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_FREQ_BASE 13

/**
   
  Return ratio of processor, bus, and interval time counter to
  processor input clock or output clock for platform use, if
  generated by the processor. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_FREQ_RATIOS 14

/**
   
  Return information on which logical processors map to a
  physical processor die. It is optinal.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_LOGICAL_TO_PHYSICAL 42

/**
   
  Return the number and type of performance monitors. It is
  required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_PERF_MON_INFO 15

/**
   
  Specify processor interrupt block address and I/O port space
  address. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_PLATFORM_ADDR 16


/**
   
  Return configurable processor features and their current
  setting. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_PROC_GET_FEATURES 17


/**
   
  Enable or disable configurable processor features. It is
  required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_PROC_SET_FEATURES 18

/**
   
  Return AR and CR register information. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_REGISTER_INFO 39 

/**
   
  Return RSE information. It is required by
  IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_RSE_INFO 19

/**
   
  Return version of PAL code. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_VERSION 20

/**
   
  Clear all error information from processor error logging
  registers. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_MC_CLEAR_LOG 21 

/**
   
  Ensure that all operations that could cause an MCA have
  completed. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_MC_DRAIN 22

/**
   
  Return Processor Dynamic State for logging by SAL. It is
  optional.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_MC_DYNAMIC_STATE 24 

/**
   
  Return Processor Machine Check Information and Processor
  Static State for logging by SAL. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_MC_ERROR_INFO 25 Req. Static Both 

/**
   
  Set/Reset Expected Machine Check Indicator. It is required by
  IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_MC_EXPECTED 23 

/**
   
  Register min-state save area with PAL for machine checks and
  inits. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_MC_REGISTER_MEM 27 

/**
   
  Restore minimal architected state and return to interrupted
  process. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_MC_RESUME 26 

/**
   
  Enter the low-power HALT state or an implementation-dependent
  low-power state. It is optinal.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_HALT 28


/**
   
  Return the low power capabilities of the processor. It is
  required by IPF.

  @param CallingConvention  Stacked Register

  @param Mode               Physical/Virtual
   
**/
#define PAL_HALT_INFO 257


/**
   
  Enter the low power LIGHT HALT state. It is required by
  IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical/Virtual
   
**/
#define PAL_HALT_LIGHT 29 

/**
   
  Initialize tags and data of a cache line for processor
  testing. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_CACHE_LINE_INIT 31

/**
   
  Read tag and data of a cache line for diagnostic testing. It
  is optional.

  @param CallingConvention  Satcked Register

  @param Mode               Physical
   
**/
#define PAL_CACHE_READ 259 

/**
   
  Write tag and data of a cache for diagnostic testing. It is
  optional.

  @param CallingConvention  Satcked Registers

  @param Mode               Physical
   
**/
#define PAL_CACHE_WRITE 260

/**
   
  Returns alignment and size requirements needed for the memory
  buffer passed to the PAL_TEST_PROC procedure as well as
  information on self-test control words for the processor self
  tests. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_TEST_INFO 37

/**
   
  Perform late processor self test. It is required by
  IPF.

  @param CallingConvention  Stacked Registers

  @param Mode               Physical
   
**/
#define PAL_TEST_PROC 258

/**
   
  Return information needed to relocate PAL procedures and PAL
  PMI code to memory. It is required by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_COPY_INFO 30

/**
   
  Relocate PAL procedures and PAL PMI code to memory. It is
  required by IPF.

  @param CallingConvention  Stacked Registers

  @param Mode               Physical
   
**/
#define PAL_COPY_PAL 256

/**
   
  Enter IA-32 System environment. It is optional.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_ENTER_IA_32_ENV 33

/**
   
  Register PMI memory entrypoints with processor. It is required
  by IPF.

  @param CallingConvention  Static Registers

  @param Mode               Physical
   
**/
#define PAL_PMI_ENTRYPOINT 32



#endif