2 CPU Register Table Library functions.
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 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
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.
15 #include "RegisterCpuFeatures.h"
18 Checks if two CPU feature bit masks are equal.
20 @param[in] FirstFeatureMask The first input CPU feature bit mask
21 @param[in] SecondFeatureMask The second input CPU feature bit mask
23 @retval TRUE Two CPU feature bit masks are equal.
24 @retval FALSE Two CPU feature bit masks are not equal.
28 IN UINT8
*FirstFeatureMask
,
29 IN UINT8
*SecondFeatureMask
34 BitMaskSize
= PcdGetSize (PcdCpuFeaturesSupport
);
35 if (CompareMem (FirstFeatureMask
, SecondFeatureMask
, BitMaskSize
) == 0) {
43 Function that uses DEBUG() macros to display the contents of a a CPU feature bit mask.
45 @param[in] FeatureMask A pointer to the CPU feature bit mask.
56 BitMaskSize
= PcdGetSize (PcdCpuFeaturesSupport
);
57 Data8
= (UINT8
*) FeatureMask
;
58 for (Index
= 0; Index
< BitMaskSize
; Index
++) {
59 DEBUG ((DEBUG_INFO
, " %02x ", *Data8
++));
61 DEBUG ((DEBUG_INFO
, "\n"));
65 Dump CPU feature name or CPU feature bit mask.
67 @param[in] CpuFeature Pointer to CPU_FEATURES_ENTRY
71 IN CPU_FEATURES_ENTRY
*CpuFeature
75 if (CpuFeature
->FeatureName
!= NULL
) {
76 DEBUG ((DEBUG_INFO
, "FeatureName: %a\n", CpuFeature
->FeatureName
));
78 DEBUG ((DEBUG_INFO
, "FeatureMask = "));
79 DumpCpuFeatureMask (CpuFeature
->FeatureMask
);
84 Determines if the feature bit mask is in dependent CPU feature bit mask buffer.
86 @param[in] FeatureMask Pointer to CPU feature bit mask
87 @param[in] DependentBitMask Pointer to dependent CPU feature bit mask buffer
89 @retval TRUE The feature bit mask is in dependent CPU feature bit mask buffer.
90 @retval FALSE The feature bit mask is not in dependent CPU feature bit mask buffer.
94 IN UINT8
*FeatureMask
,
95 IN UINT8
*DependentBitMask
103 BitMaskSize
= PcdGetSize (PcdCpuFeaturesSupport
);
106 Data2
= DependentBitMask
;
107 for (Index
= 0; Index
< BitMaskSize
; Index
++) {
108 if (((*(Data1
++)) & (*(Data2
++))) != 0) {
116 Checks and adjusts CPU features order per dependency relationship.
118 @param[in] FeatureList Pointer to CPU feature list
121 CheckCpuFeaturesDependency (
122 IN LIST_ENTRY
*FeatureList
125 LIST_ENTRY
*CurrentEntry
;
126 CPU_FEATURES_ENTRY
*CpuFeature
;
127 LIST_ENTRY
*CheckEntry
;
128 CPU_FEATURES_ENTRY
*CheckFeature
;
130 LIST_ENTRY
*TempEntry
;
132 CurrentEntry
= GetFirstNode (FeatureList
);
133 while (!IsNull (FeatureList
, CurrentEntry
)) {
135 CpuFeature
= CPU_FEATURE_ENTRY_FROM_LINK (CurrentEntry
);
136 if (CpuFeature
->BeforeAll
) {
138 // Check all features dispatched before this entry
140 CheckEntry
= GetFirstNode (FeatureList
);
141 while (CheckEntry
!= CurrentEntry
) {
142 CheckFeature
= CPU_FEATURE_ENTRY_FROM_LINK (CheckEntry
);
143 if (!CheckFeature
->BeforeAll
) {
145 // If this feature has no BeforeAll flag and is dispatched before CpuFeature,
146 // insert currentEntry before Checked feature
148 RemoveEntryList (CurrentEntry
);
149 InsertTailList (CheckEntry
, CurrentEntry
);
153 CheckEntry
= CheckEntry
->ForwardLink
;
160 if (CpuFeature
->AfterAll
) {
162 // Check all features dispatched after this entry
164 CheckEntry
= GetNextNode (FeatureList
, CurrentEntry
);
165 while (!IsNull (FeatureList
, CheckEntry
)) {
166 CheckFeature
= CPU_FEATURE_ENTRY_FROM_LINK (CheckEntry
);
167 if (!CheckFeature
->AfterAll
) {
169 // If this feature has no AfterAll flag and is dispatched after CpuFeature,
170 // insert currentEntry after Checked feature
172 TempEntry
= GetNextNode (FeatureList
, CurrentEntry
);
173 RemoveEntryList (CurrentEntry
);
174 InsertHeadList (CheckEntry
, CurrentEntry
);
175 CurrentEntry
= TempEntry
;
179 CheckEntry
= CheckEntry
->ForwardLink
;
186 if (CpuFeature
->BeforeFeatureBitMask
!= NULL
) {
188 // Check all features dispatched before this entry
190 CheckEntry
= GetFirstNode (FeatureList
);
191 while (CheckEntry
!= CurrentEntry
) {
192 CheckFeature
= CPU_FEATURE_ENTRY_FROM_LINK (CheckEntry
);
193 if (IsBitMaskMatchCheck (CheckFeature
->FeatureMask
, CpuFeature
->BeforeFeatureBitMask
)) {
195 // If there is dependency, swap them
197 RemoveEntryList (CurrentEntry
);
198 InsertTailList (CheckEntry
, CurrentEntry
);
202 CheckEntry
= CheckEntry
->ForwardLink
;
209 if (CpuFeature
->AfterFeatureBitMask
!= NULL
) {
211 // Check all features dispatched after this entry
213 CheckEntry
= GetNextNode (FeatureList
, CurrentEntry
);
214 while (!IsNull (FeatureList
, CheckEntry
)) {
215 CheckFeature
= CPU_FEATURE_ENTRY_FROM_LINK (CheckEntry
);
216 if (IsBitMaskMatchCheck (CheckFeature
->FeatureMask
, CpuFeature
->AfterFeatureBitMask
)) {
218 // If there is dependency, swap them
220 TempEntry
= GetNextNode (FeatureList
, CurrentEntry
);
221 RemoveEntryList (CurrentEntry
);
222 InsertHeadList (CheckEntry
, CurrentEntry
);
223 CurrentEntry
= TempEntry
;
227 CheckEntry
= CheckEntry
->ForwardLink
;
234 // No swap happened, check the next feature
236 CurrentEntry
= CurrentEntry
->ForwardLink
;
241 Worker function to register CPU Feature.
243 @param[in] CpuFeature Pointer to CPU feature entry
245 @retval RETURN_SUCCESS The CPU feature was successfully registered.
246 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to register
248 @retval RETURN_UNSUPPORTED Registration of the CPU feature is not
249 supported due to a circular dependency between
250 BEFORE and AFTER features.
253 RegisterCpuFeatureWorker (
254 IN CPU_FEATURES_ENTRY
*CpuFeature
258 CPU_FEATURES_DATA
*CpuFeaturesData
;
259 CPU_FEATURES_ENTRY
*CpuFeatureEntry
;
262 BOOLEAN FeatureExist
;
264 BitMaskSize
= PcdGetSize (PcdCpuFeaturesSupport
);
265 CpuFeaturesData
= GetCpuFeaturesData ();
266 if (CpuFeaturesData
->FeaturesCount
== 0) {
267 InitializeListHead (&CpuFeaturesData
->FeatureList
);
268 InitializeSpinLock (&CpuFeaturesData
->MsrLock
);
269 InitializeSpinLock (&CpuFeaturesData
->MemoryMappedLock
);
270 CpuFeaturesData
->BitMaskSize
= BitMaskSize
;
272 ASSERT (CpuFeaturesData
->BitMaskSize
== BitMaskSize
);
274 FeatureExist
= FALSE
;
275 Entry
= GetFirstNode (&CpuFeaturesData
->FeatureList
);
276 while (!IsNull (&CpuFeaturesData
->FeatureList
, Entry
)) {
277 CpuFeatureEntry
= CPU_FEATURE_ENTRY_FROM_LINK (Entry
);
278 if (IsCpuFeatureMatch (CpuFeature
->FeatureMask
, CpuFeatureEntry
->FeatureMask
)) {
280 // If this feature already registered
285 Entry
= Entry
->ForwardLink
;
289 DEBUG ((DEBUG_INFO
, "[NEW] "));
290 DumpCpuFeature (CpuFeature
);
291 InsertTailList (&CpuFeaturesData
->FeatureList
, &CpuFeature
->Link
);
292 CpuFeaturesData
->FeaturesCount
++;
294 DEBUG ((DEBUG_INFO
, "[OVERRIDE] "));
295 DumpCpuFeature (CpuFeature
);
297 // Overwrite original parameters of CPU feature
299 if (CpuFeature
->GetConfigDataFunc
!= NULL
) {
300 CpuFeatureEntry
->GetConfigDataFunc
= CpuFeature
->GetConfigDataFunc
;
302 if (CpuFeature
->SupportFunc
!= NULL
) {
303 CpuFeatureEntry
->SupportFunc
= CpuFeature
->SupportFunc
;
305 if (CpuFeature
->InitializeFunc
!= NULL
) {
306 CpuFeatureEntry
->InitializeFunc
= CpuFeature
->InitializeFunc
;
308 if (CpuFeature
->FeatureName
!= NULL
) {
309 if (CpuFeatureEntry
->FeatureName
== NULL
) {
310 CpuFeatureEntry
->FeatureName
= AllocatePool (CPU_FEATURE_NAME_SIZE
);
311 ASSERT (CpuFeatureEntry
->FeatureName
!= NULL
);
313 Status
= AsciiStrCpyS (CpuFeatureEntry
->FeatureName
, CPU_FEATURE_NAME_SIZE
, CpuFeature
->FeatureName
);
314 ASSERT_EFI_ERROR (Status
);
315 FreePool (CpuFeature
->FeatureName
);
317 if (CpuFeature
->BeforeFeatureBitMask
!= NULL
) {
318 if (CpuFeatureEntry
->BeforeFeatureBitMask
!= NULL
) {
319 FreePool (CpuFeatureEntry
->BeforeFeatureBitMask
);
321 CpuFeatureEntry
->BeforeFeatureBitMask
= CpuFeature
->BeforeFeatureBitMask
;
323 if (CpuFeature
->AfterFeatureBitMask
!= NULL
) {
324 if (CpuFeatureEntry
->AfterFeatureBitMask
!= NULL
) {
325 FreePool (CpuFeatureEntry
->AfterFeatureBitMask
);
327 CpuFeatureEntry
->AfterFeatureBitMask
= CpuFeature
->AfterFeatureBitMask
;
329 CpuFeatureEntry
->BeforeAll
= CpuFeature
->BeforeAll
;
330 CpuFeatureEntry
->AfterAll
= CpuFeature
->AfterAll
;
332 FreePool (CpuFeature
->FeatureMask
);
333 FreePool (CpuFeature
);
336 // Verify CPU features dependency can change CPU feature order
338 CheckCpuFeaturesDependency (&CpuFeaturesData
->FeatureList
);
339 return RETURN_SUCCESS
;
343 Sets CPU feature bit mask in CPU feature bit mask buffer.
345 @param[in] FeaturesBitMask Pointer to CPU feature bit mask buffer
346 @param[in] Feature The bit number of the CPU feature
347 @param[in] BitMaskSize CPU feature bit mask buffer size
350 SetCpuFeaturesBitMask (
351 IN UINT8
**FeaturesBitMask
,
356 UINT8
*CpuFeaturesBitMask
;
358 ASSERT (FeaturesBitMask
!= NULL
);
359 CpuFeaturesBitMask
= *FeaturesBitMask
;
360 if (CpuFeaturesBitMask
== NULL
) {
361 CpuFeaturesBitMask
= AllocateZeroPool (BitMaskSize
);
362 ASSERT (CpuFeaturesBitMask
!= NULL
);
363 *FeaturesBitMask
= CpuFeaturesBitMask
;
366 CpuFeaturesBitMask
+= (Feature
/ 8);
367 *CpuFeaturesBitMask
|= (UINT8
) (1 << (Feature
% 8));
371 Registers a CPU Feature.
373 @param GetConfigDataFunc CPU feature get configuration data function. This
374 is an optional parameter that may be NULL. If NULL,
375 then the most recently registered function for the
376 CPU feature is used. If no functions are registered
377 for a CPU feature, then the CPU configuration data
378 for the registered feature is NULL.
379 @param SupportFunc CPU feature support function. This is an optional
380 parameter that may be NULL. If NULL, then the most
381 recently registered function for the CPU feature is
382 used. If no functions are registered for a CPU
383 feature, then the CPU feature is assumed to be
384 supported by all CPUs.
385 @param InitializeFunc CPU feature initialize function. This is an optional
386 parameter that may be NULL. If NULL, then the most
387 recently registered function for the CPU feature is
388 used. If no functions are registered for a CPU
389 feature, then the CPU feature initialization is
391 @param ... Variable argument list of UINT32 CPU feature value.
392 Values with no modifiers are the features provided
393 by the registered functions.
394 Values with CPU_FEATURE_BEFORE modifier are features
395 that must be initialized after the features provided
396 by the registered functions are used.
397 Values with CPU_FEATURE_AFTER modifier are features
398 that must be initialized before the features provided
399 by the registered functions are used.
400 The last argument in this variable argument list must
401 always be CPU_FEATURE_END.
403 @retval RETURN_SUCCESS The CPU feature was successfully registered.
404 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to register
406 @retval RETURN_UNSUPPORTED Registration of the CPU feature is not
407 supported due to a circular dependency between
408 BEFORE and AFTER features.
410 @note This service could be called by BSP only.
415 IN CHAR8
*FeatureName
, OPTIONAL
416 IN CPU_FEATURE_GET_CONFIG_DATA GetConfigDataFunc
, OPTIONAL
417 IN CPU_FEATURE_SUPPORT SupportFunc
, OPTIONAL
418 IN CPU_FEATURE_INITIALIZE InitializeFunc
, OPTIONAL
426 CPU_FEATURES_ENTRY
*CpuFeature
;
428 UINT8
*BeforeFeatureBitMask
;
429 UINT8
*AfterFeatureBitMask
;
434 BeforeFeatureBitMask
= NULL
;
435 AfterFeatureBitMask
= NULL
;
439 BitMaskSize
= PcdGetSize (PcdCpuFeaturesSupport
);
441 VA_START (Marker
, InitializeFunc
);
442 Feature
= VA_ARG (Marker
, UINT32
);
443 while (Feature
!= CPU_FEATURE_END
) {
444 ASSERT ((Feature
& (CPU_FEATURE_BEFORE
| CPU_FEATURE_AFTER
))
445 != (CPU_FEATURE_BEFORE
| CPU_FEATURE_AFTER
));
446 ASSERT ((Feature
& (CPU_FEATURE_BEFORE_ALL
| CPU_FEATURE_AFTER_ALL
))
447 != (CPU_FEATURE_BEFORE_ALL
| CPU_FEATURE_AFTER_ALL
));
448 if (Feature
< CPU_FEATURE_BEFORE
) {
449 BeforeAll
= ((Feature
& CPU_FEATURE_BEFORE_ALL
) != 0) ? TRUE
: FALSE
;
450 AfterAll
= ((Feature
& CPU_FEATURE_AFTER_ALL
) != 0) ? TRUE
: FALSE
;
451 Feature
&= ~(CPU_FEATURE_BEFORE_ALL
| CPU_FEATURE_AFTER_ALL
);
452 ASSERT (FeatureMask
== NULL
);
453 SetCpuFeaturesBitMask (&FeatureMask
, Feature
, BitMaskSize
);
454 } else if ((Feature
& CPU_FEATURE_BEFORE
) != 0) {
455 SetCpuFeaturesBitMask (&BeforeFeatureBitMask
, Feature
& ~CPU_FEATURE_BEFORE
, BitMaskSize
);
456 } else if ((Feature
& CPU_FEATURE_AFTER
) != 0) {
457 SetCpuFeaturesBitMask (&AfterFeatureBitMask
, Feature
& ~CPU_FEATURE_AFTER
, BitMaskSize
);
459 Feature
= VA_ARG (Marker
, UINT32
);
463 CpuFeature
= AllocateZeroPool (sizeof (CPU_FEATURES_ENTRY
));
464 ASSERT (CpuFeature
!= NULL
);
465 CpuFeature
->Signature
= CPU_FEATURE_ENTRY_SIGNATURE
;
466 CpuFeature
->FeatureMask
= FeatureMask
;
467 CpuFeature
->BeforeFeatureBitMask
= BeforeFeatureBitMask
;
468 CpuFeature
->AfterFeatureBitMask
= AfterFeatureBitMask
;
469 CpuFeature
->BeforeAll
= BeforeAll
;
470 CpuFeature
->AfterAll
= AfterAll
;
471 CpuFeature
->GetConfigDataFunc
= GetConfigDataFunc
;
472 CpuFeature
->SupportFunc
= SupportFunc
;
473 CpuFeature
->InitializeFunc
= InitializeFunc
;
474 if (FeatureName
!= NULL
) {
475 CpuFeature
->FeatureName
= AllocatePool (CPU_FEATURE_NAME_SIZE
);
476 ASSERT (CpuFeature
->FeatureName
!= NULL
);
477 Status
= AsciiStrCpyS (CpuFeature
->FeatureName
, CPU_FEATURE_NAME_SIZE
, FeatureName
);
478 ASSERT_EFI_ERROR (Status
);
481 Status
= RegisterCpuFeatureWorker (CpuFeature
);
482 ASSERT_EFI_ERROR (Status
);
484 return RETURN_SUCCESS
;
488 Add an entry in specified register table.
490 This function adds an entry in specified register table, with given register type,
491 register index, bit section and value.
493 @param[in] PreSmmFlag If TRUE, entry will be added into PreSmm register table
494 If FALSE, entry will be added into register table
495 @param[in] ProcessorNumber The index of the CPU to add a register table entry
496 @param[in] RegisterType Type of the register to program
497 @param[in] Index Index of the register to program
498 @param[in] ValidBitStart Start of the bit section
499 @param[in] ValidBitLength Length of the bit section
500 @param[in] Value Value to write
503 CpuRegisterTableWriteWorker (
504 IN BOOLEAN PreSmmFlag
,
505 IN UINTN ProcessorNumber
,
506 IN REGISTER_TYPE RegisterType
,
508 IN UINT8 ValidBitStart
,
509 IN UINT8 ValidBitLength
,
514 CPU_FEATURES_DATA
*CpuFeaturesData
;
515 ACPI_CPU_DATA
*AcpiCpuData
;
516 CPU_REGISTER_TABLE
*RegisterTable
;
517 CPU_REGISTER_TABLE_ENTRY
*RegisterTableEntry
;
519 CpuFeaturesData
= GetCpuFeaturesData ();
520 if (CpuFeaturesData
->RegisterTable
== NULL
) {
521 AcpiCpuData
= (ACPI_CPU_DATA
*) (UINTN
) PcdGet64 (PcdCpuS3DataAddress
);
522 if (AcpiCpuData
== NULL
) {
523 AcpiCpuData
= AllocateAcpiCpuData ();
524 ASSERT (AcpiCpuData
!= NULL
);
526 // Set PcdCpuS3DataAddress to the base address of the ACPI_CPU_DATA structure
528 Status
= PcdSet64S (PcdCpuS3DataAddress
, (UINT64
)(UINTN
)AcpiCpuData
);
529 ASSERT_EFI_ERROR (Status
);
531 ASSERT (AcpiCpuData
->RegisterTable
!= 0);
532 CpuFeaturesData
->RegisterTable
= (CPU_REGISTER_TABLE
*) (UINTN
) AcpiCpuData
->RegisterTable
;
533 CpuFeaturesData
->PreSmmRegisterTable
= (CPU_REGISTER_TABLE
*) (UINTN
) AcpiCpuData
->PreSmmInitRegisterTable
;
537 RegisterTable
= &CpuFeaturesData
->PreSmmRegisterTable
[ProcessorNumber
];
539 RegisterTable
= &CpuFeaturesData
->RegisterTable
[ProcessorNumber
];
542 if (RegisterTable
->TableLength
== RegisterTable
->AllocatedSize
/ sizeof (CPU_REGISTER_TABLE_ENTRY
)) {
543 EnlargeRegisterTable (RegisterTable
);
547 // Append entry in the register table.
549 RegisterTableEntry
= (CPU_REGISTER_TABLE_ENTRY
*) (UINTN
) RegisterTable
->RegisterTableEntry
;
550 RegisterTableEntry
[RegisterTable
->TableLength
].RegisterType
= RegisterType
;
551 RegisterTableEntry
[RegisterTable
->TableLength
].Index
= Index
;
552 RegisterTableEntry
[RegisterTable
->TableLength
].ValidBitStart
= ValidBitStart
;
553 RegisterTableEntry
[RegisterTable
->TableLength
].ValidBitLength
= ValidBitLength
;
554 RegisterTableEntry
[RegisterTable
->TableLength
].Value
= Value
;
556 RegisterTable
->TableLength
++;
560 Adds an entry in specified register table.
562 This function adds an entry in specified register table, with given register type,
563 register index, bit section and value.
565 @param[in] ProcessorNumber The index of the CPU to add a register table entry
566 @param[in] RegisterType Type of the register to program
567 @param[in] Index Index of the register to program
568 @param[in] ValueMask Mask of bits in register to write
569 @param[in] Value Value to write
571 @note This service could be called by BSP only.
575 CpuRegisterTableWrite (
576 IN UINTN ProcessorNumber
,
577 IN REGISTER_TYPE RegisterType
,
587 Start
= (UINT8
)LowBitSet64 (ValueMask
);
588 End
= (UINT8
)HighBitSet64 (ValueMask
);
589 Length
= End
- Start
+ 1;
590 CpuRegisterTableWriteWorker (FALSE
, ProcessorNumber
, RegisterType
, Index
, Start
, Length
, Value
);
594 Adds an entry in specified Pre-SMM register table.
596 This function adds an entry in specified register table, with given register type,
597 register index, bit section and value.
599 @param[in] ProcessorNumber The index of the CPU to add a register table entry.
600 @param[in] RegisterType Type of the register to program
601 @param[in] Index Index of the register to program
602 @param[in] ValueMask Mask of bits in register to write
603 @param[in] Value Value to write
605 @note This service could be called by BSP only.
609 PreSmmCpuRegisterTableWrite (
610 IN UINTN ProcessorNumber
,
611 IN REGISTER_TYPE RegisterType
,
621 Start
= (UINT8
)LowBitSet64 (ValueMask
);
622 End
= (UINT8
)HighBitSet64 (ValueMask
);
623 Length
= End
- Start
+ 1;
624 CpuRegisterTableWriteWorker (TRUE
, ProcessorNumber
, RegisterType
, Index
, Start
, Length
, Value
);
628 Worker function to determine if a CPU feature is set in input CPU feature bit mask buffer.
630 @param[in] CpuBitMask CPU feature bit mask buffer
631 @param[in] CpuBitMaskSize The size of CPU feature bit mask buffer
632 @param[in] Feature The bit number of the CPU feature
634 @retval TRUE The CPU feature is set in PcdCpuFeaturesSupport.
635 @retval FALSE The CPU feature is not set in PcdCpuFeaturesSupport.
639 IsCpuFeatureSetInCpuPcd (
640 IN UINT8
*CpuBitMask
,
641 IN UINTN CpuBitMaskSize
,
645 if ((Feature
>> 3) >= CpuBitMaskSize
) {
648 return ((*(CpuBitMask
+ (Feature
>> 3)) & (1 << (Feature
& 0x07))) != 0);
652 Determines if a CPU feature is enabled in PcdCpuFeaturesSupport bit mask.
653 If a CPU feature is disabled in PcdCpuFeaturesSupport then all the code/data
654 associated with that feature should be optimized away if compiler
655 optimizations are enabled.
657 @param[in] Feature The bit number of the CPU feature to check in the PCD
658 PcdCpuFeaturesSupport
660 @retval TRUE The CPU feature is set in PcdCpuFeaturesSupport.
661 @retval FALSE The CPU feature is not set in PcdCpuFeaturesSupport.
663 @note This service could be called by BSP only.
667 IsCpuFeatureSupported (
671 return IsCpuFeatureSetInCpuPcd (
672 (UINT8
*)PcdGetPtr (PcdCpuFeaturesSupport
),
673 PcdGetSize (PcdCpuFeaturesSupport
),
679 Determines if a CPU feature is set in PcdCpuFeaturesSetting bit mask.
681 @param[in] Feature The bit number of the CPU feature to check in the PCD
682 PcdCpuFeaturesSetting
684 @retval TRUE The CPU feature is set in PcdCpuFeaturesSetting.
685 @retval FALSE The CPU feature is not set in PcdCpuFeaturesSetting.
687 @note This service could be called by BSP only.
691 IsCpuFeatureInSetting (
695 return IsCpuFeatureSetInCpuPcd (
696 (UINT8
*)PcdGetPtr (PcdCpuFeaturesSetting
),
697 PcdGetSize (PcdCpuFeaturesSetting
),
703 Determines if a CPU feature is set in PcdCpuFeaturesCapability bit mask.
705 @param[in] Feature The bit number of the CPU feature to check in the PCD
706 PcdCpuFeaturesCapability
708 @retval TRUE The CPU feature is set in PcdCpuFeaturesCapability.
709 @retval FALSE The CPU feature is not set in PcdCpuFeaturesCapability.
711 @note This service could be called by BSP only.
715 IsCpuFeatureCapability (
719 return IsCpuFeatureSetInCpuPcd (
720 (UINT8
*)PcdGetPtr (PcdCpuFeaturesCapability
),
721 PcdGetSize (PcdCpuFeaturesCapability
),
728 Determines if a CPU feature is set in PcdCpuFeaturesUserConfiguration bit mask.
730 @param[in] Feature The bit number of the CPU feature to check in the PCD
731 PcdCpuFeaturesUserConfiguration
733 @retval TRUE The CPU feature is set in PcdCpuFeaturesUserConfiguration.
734 @retval FALSE The CPU feature is not set in PcdCpuFeaturesUserConfiguration.
736 @note This service could be called by BSP only.
740 IsCpuFeatureUserConfiguration (
744 return IsCpuFeatureSetInCpuPcd (
745 (UINT8
*)PcdGetPtr (PcdCpuFeaturesUserConfiguration
),
746 PcdGetSize (PcdCpuFeaturesUserConfiguration
),
753 Switches to assigned BSP after CPU features initialization.
755 @param[in] ProcessorNumber The index of the CPU executing this function.
757 @note This service could be called by BSP only.
761 SwitchBspAfterFeaturesInitialize (
762 IN UINTN ProcessorNumber
765 CPU_FEATURES_DATA
*CpuFeaturesData
;
767 CpuFeaturesData
= GetCpuFeaturesData ();
768 CpuFeaturesData
->BspNumber
= ProcessorNumber
;