summaryrefslogtreecommitdiff
path: root/EdkCompatibilityPkg/Compatibility
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2017-04-27 11:30:22 +0800
committerGuo Mang <mang.guo@intel.com>2017-04-27 13:02:43 +0800
commit52e99d85a129b6124dad484f9f349fab8e02e488 (patch)
tree0839a52567104c32841237c149a6c2b1cb5c95b7 /EdkCompatibilityPkg/Compatibility
parent7283449b45d2842b9123ada5129cb073e40b940a (diff)
downloadedk2-platforms-52e99d85a129b6124dad484f9f349fab8e02e488.tar.xz
EdkCompatibilityPkg: Remove unused Package
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'EdkCompatibilityPkg/Compatibility')
-rw-r--r--EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.c249
-rw-r--r--EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.inf52
-rw-r--r--EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/BootScriptSaveOnS3SaveStateThunk.inf82
-rw-r--r--EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/IA32/DispatchExecute.c43
-rw-r--r--EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c993
-rw-r--r--EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.h119
-rw-r--r--EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/AsmDispatchExecute.S216
-rw-r--r--EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/AsmDispatchExecute.asm216
-rw-r--r--EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/DispatchExecute.c157
-rw-r--r--EdkCompatibilityPkg/Compatibility/BootScriptThunkHelper/BootScriptThunkHelper.c73
-rw-r--r--EdkCompatibilityPkg/Compatibility/BootScriptThunkHelper/BootScriptThunkHelper.inf52
-rw-r--r--EdkCompatibilityPkg/Compatibility/CpuIo2OnCpuIoThunk/CpuIo2OnCpuIoThunk.c214
-rw-r--r--EdkCompatibilityPkg/Compatibility/CpuIo2OnCpuIoThunk/CpuIo2OnCpuIoThunk.h130
-rw-r--r--EdkCompatibilityPkg/Compatibility/CpuIo2OnCpuIoThunk/CpuIo2OnCpuIoThunk.inf53
-rw-r--r--EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.c1225
-rw-r--r--EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.inf59
-rw-r--r--EdkCompatibilityPkg/Compatibility/DxeSmmReadyToLockOnExitPmAuthThunk/DxeSmmReadyToLockOnExitPmAuthThunk.c94
-rw-r--r--EdkCompatibilityPkg/Compatibility/DxeSmmReadyToLockOnExitPmAuthThunk/DxeSmmReadyToLockOnExitPmAuthThunk.h28
-rw-r--r--EdkCompatibilityPkg/Compatibility/DxeSmmReadyToLockOnExitPmAuthThunk/DxeSmmReadyToLockOnExitPmAuthThunk.inf52
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c1248
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.h146
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Fonts.c187
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Forms.c598
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/FrameworkHiiOnUefiHiiThunk.inf114
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.c546
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h947
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiHandle.c85
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiHandle.h60
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Keyboard.c45
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/OpcodeCreation.c984
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Package.c897
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/SetupBrowser.c709
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/SetupBrowser.h20
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c438
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.unibin1658 -> 0 bytes
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c543
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.h92
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c1185
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.h342
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParserExpression.c365
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParserExpression.h92
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.c891
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.h287
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk.c72
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk.inf48
-rw-r--r--EdkCompatibilityPkg/Compatibility/Fv2OnFvThunk/Fv2OnFvThunk.c1543
-rw-r--r--EdkCompatibilityPkg/Compatibility/Fv2OnFvThunk/Fv2OnFvThunk.inf58
-rw-r--r--EdkCompatibilityPkg/Compatibility/FvFileLoaderOnLoadFileThunk/FvFileLoaderOnLoadFileThunk.c137
-rw-r--r--EdkCompatibilityPkg/Compatibility/FvFileLoaderOnLoadFileThunk/FvFileLoaderOnLoadFileThunk.inf56
-rw-r--r--EdkCompatibilityPkg/Compatibility/FvOnFv2Thunk/FvOnFv2Thunk.c515
-rw-r--r--EdkCompatibilityPkg/Compatibility/FvOnFv2Thunk/FvOnFv2Thunk.inf58
-rw-r--r--EdkCompatibilityPkg/Compatibility/Include/Guid/BootScriptThunkData.h31
-rw-r--r--EdkCompatibilityPkg/Compatibility/Include/Guid/BootState.h30
-rw-r--r--EdkCompatibilityPkg/Compatibility/Include/Guid/FrameworkBdsFrontPageFormSet.h24
-rw-r--r--EdkCompatibilityPkg/Compatibility/Include/Guid/SmmBaseThunkCommunication.h94
-rw-r--r--EdkCompatibilityPkg/Compatibility/Include/Library/LanguageLib.h122
-rw-r--r--EdkCompatibilityPkg/Compatibility/Include/Ppi/EcpPciCfg.h60
-rw-r--r--EdkCompatibilityPkg/Compatibility/Include/Protocol/Print.h82
-rw-r--r--EdkCompatibilityPkg/Compatibility/Include/Protocol/SmmBaseHelperReady.h41
-rw-r--r--EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.c289
-rw-r--r--EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.h177
-rw-r--r--EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.inf53
-rw-r--r--EdkCompatibilityPkg/Compatibility/Library/UefiLanguageLib/UefiLanguageLib.c501
-rw-r--r--EdkCompatibilityPkg/Compatibility/Library/UefiLanguageLib/UefiLanguageLib.inf41
-rw-r--r--EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/AsmInclude.inc26
-rw-r--r--EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.S174
-rw-r--r--EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.asm167
-rw-r--r--EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.c1637
-rw-r--r--EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.h533
-rw-r--r--EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.inf72
-rw-r--r--EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/AsmInclude.inc28
-rw-r--r--EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S210
-rw-r--r--EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm196
-rw-r--r--EdkCompatibilityPkg/Compatibility/PciCfg2OnPciCfgThunk/PciCfg2OnPciCfgThunk.c447
-rw-r--r--EdkCompatibilityPkg/Compatibility/PciCfg2OnPciCfgThunk/PciCfg2OnPciCfgThunk.inf105
-rw-r--r--EdkCompatibilityPkg/Compatibility/PciCfgOnPciCfg2Thunk/PciCfgOnPciCfg2Thunk.c309
-rw-r--r--EdkCompatibilityPkg/Compatibility/PciCfgOnPciCfg2Thunk/PciCfgOnPciCfg2Thunk.inf60
-rw-r--r--EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/ConvLib.c829
-rw-r--r--EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/ConvTable.c1335
-rw-r--r--EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MemoryConv.c1089
-rw-r--r--EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MiscConv.c2527
-rw-r--r--EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/PiSmbiosRecordOnDataHubSmbiosRecordThunk.inf74
-rw-r--r--EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/ProcessorConv.c164
-rw-r--r--EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Thunk.c160
-rw-r--r--EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Thunk.h1414
-rw-r--r--EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Translate.c608
-rw-r--r--EdkCompatibilityPkg/Compatibility/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.c294
-rw-r--r--EdkCompatibilityPkg/Compatibility/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.h108
-rw-r--r--EdkCompatibilityPkg/Compatibility/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.inf52
-rw-r--r--EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.c68
-rw-r--r--EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.inf55
-rw-r--r--EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2OnReadOnlyVariableThunk/ReadOnlyVariable2OnReadOnlyVariableThunk.c172
-rw-r--r--EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2OnReadOnlyVariableThunk/ReadOnlyVariable2OnReadOnlyVariableThunk.inf61
-rw-r--r--EdkCompatibilityPkg/Compatibility/ReadOnlyVariableOnReadOnlyVariable2Thunk/ReadOnlyVariableOnReadOnlyVariable2Thunk.c165
-rw-r--r--EdkCompatibilityPkg/Compatibility/ReadOnlyVariableOnReadOnlyVariable2Thunk/ReadOnlyVariableOnReadOnlyVariable2Thunk.inf59
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.c208
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.h99
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.inf50
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmBaseHelper/PageFaultHandler.c27
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c1224
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.inf88
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c172
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.S68
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.asm70
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c521
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.inf56
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmControl2OnSmmControlThunk/SmmControl2OnSmmControlThunk.c165
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmControl2OnSmmControlThunk/SmmControl2OnSmmControlThunk.h79
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmControl2OnSmmControlThunk/SmmControl2OnSmmControlThunk.inf55
-rw-r--r--EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.c460
-rw-r--r--EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.inf63
-rw-r--r--EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.c461
-rw-r--r--EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.inf63
113 files changed, 0 insertions, 36087 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.c b/EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.c
deleted file mode 100644
index 2d342d841e..0000000000
--- a/EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/** @file
- This is the driver that produce AcpiVariable hob and slit SmramReserve hob
- for ECP platform.
-
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
-
-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.
-
-**/
-
-#include <PiPei.h>
-#include <Guid/SmramMemoryReserve.h>
-#include <Guid/AcpiS3Context.h>
-
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/BaseMemoryLib.h>
-
-/**
- Retrieves the data structure associated witht he GUIDed HOB of type gEfiSmmPeiSmramMemoryReserveGuid
-
- @retval NULL A HOB of type gEfiSmmPeiSmramMemoryReserveGuid could not be found.
- @retval !NULL A pointer to the GUID data from a HIB of type gEfiSmmPeiSmramMemoryReserveGuid
-
-**/
-EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *
-GetSrmamHobData (
- VOID
- )
-{
- VOID *GuidHob;
-
- //
- // Search SmramMemoryReserve HOB that describes SMRAM region
- //
- GuidHob = GetFirstGuidHob (&gEfiSmmPeiSmramMemoryReserveGuid);
- if (GuidHob == NULL) {
- return NULL;
- }
- return (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *)GET_GUID_HOB_DATA (GuidHob);
-}
-
-/**
- This routine will split SmramReserve hob to reserve 1 page for SMRAM content in S3 phase
- for PI SMM core.
-
- @retval EFI_SUCCESS The gEfiSmmPeiSmramMemoryReserveGuid is splited successfully.
- @retval EFI_NOT_FOUND The gEfiSmmPeiSmramMemoryReserveGuid is not found.
-
-**/
-EFI_STATUS
-EFIAPI
-SplitSmramReserveHob (
- VOID
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
- EFI_PEI_HOB_POINTERS Hob;
- EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *DescriptorBlock;
- EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *NewDescriptorBlock;
- UINTN BufferSize;
- UINTN SmramRanges;
- UINTN Index;
- UINTN SubIndex;
-
- //
- // Retrieve the GUID HOB data that contains the set of SMRAM descriptyors
- //
- GuidHob = GetFirstGuidHob (&gEfiSmmPeiSmramMemoryReserveGuid);
- if (GuidHob == NULL) {
- return EFI_NOT_FOUND;
- }
-
- DescriptorBlock = (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *)GET_GUID_HOB_DATA (GuidHob);
-
- //
- // Allocate one extra EFI_SMRAM_DESCRIPTOR to describe a page of SMRAM memory that contains a pointer
- // to the SMM Services Table that is required on the S3 resume path
- //
- SmramRanges = DescriptorBlock->NumberOfSmmReservedRegions;
- BufferSize = sizeof (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK) + (SmramRanges * sizeof (EFI_SMRAM_DESCRIPTOR));
-
- Hob.Raw = BuildGuidHob (
- &gEfiSmmPeiSmramMemoryReserveGuid,
- BufferSize
- );
- ASSERT (Hob.Raw);
- NewDescriptorBlock = (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *)Hob.Raw;
-
- //
- // Copy old EFI_SMRAM_HOB_DESCRIPTOR_BLOCK to new allocated region
- //
- CopyMem ((VOID *)Hob.Raw, DescriptorBlock, BufferSize - sizeof(EFI_SMRAM_DESCRIPTOR));
-
- //
- // Increase the number of SMRAM descriptors by 1 to make room for the ALLOCATED descriptor of size EFI_PAGE_SIZE
- //
- NewDescriptorBlock->NumberOfSmmReservedRegions = (UINT32)(SmramRanges + 1);
-
- ASSERT (SmramRanges >= 1);
- //
- // Copy last entry to the end - we assume TSEG is last entry, which is same assumption as Framework CPU/SMM driver
- //
- CopyMem (&NewDescriptorBlock->Descriptor[SmramRanges], &NewDescriptorBlock->Descriptor[SmramRanges - 1], sizeof(EFI_SMRAM_DESCRIPTOR));
-
- //
- // Update the last but 1 entry in the array with a size of EFI_PAGE_SIZE and put into the ALLOCATED state
- //
- NewDescriptorBlock->Descriptor[SmramRanges - 1].PhysicalSize = EFI_PAGE_SIZE;
- NewDescriptorBlock->Descriptor[SmramRanges - 1].RegionState |= EFI_ALLOCATED;
-
- //
- // Reduce the size of the last SMRAM descriptor by EFI_PAGE_SIZE
- //
- NewDescriptorBlock->Descriptor[SmramRanges].PhysicalStart += EFI_PAGE_SIZE;
- NewDescriptorBlock->Descriptor[SmramRanges].CpuStart += EFI_PAGE_SIZE;
- NewDescriptorBlock->Descriptor[SmramRanges].PhysicalSize -= EFI_PAGE_SIZE;
-
- //
- // Now, we have created SmramReserve Hob for SmmAccess drive. But the issue is that, Framework SmmAccess will assume there is 2 SmramReserve region only.
- // Reporting 3 SmramReserve region will cause buffer overflow. Moreover, we would like to filter AB-SEG or H-SEG to avoid SMM cache-poisoning issue.
- // So we uses scan SmmReserve Hob to remove AB-SEG or H-SEG.
- //
- for (Index = 0; Index <= SmramRanges; Index++) {
- if (NewDescriptorBlock->Descriptor[Index].PhysicalSize == 0) {
- //
- // Skip zero entry
- //
- continue;
- }
- if (NewDescriptorBlock->Descriptor[Index].PhysicalStart < BASE_1MB) {
- //
- // Find AB-SEG or H-SEG
- // remove this region
- //
- for (SubIndex = Index; SubIndex < NewDescriptorBlock->NumberOfSmmReservedRegions - 1; SubIndex++) {
- CopyMem (&NewDescriptorBlock->Descriptor[SubIndex], &NewDescriptorBlock->Descriptor[SubIndex + 1], sizeof (EFI_SMRAM_DESCRIPTOR));
- }
- //
- // Zero last one
- //
- ZeroMem (&NewDescriptorBlock->Descriptor[SubIndex], sizeof(EFI_SMRAM_DESCRIPTOR));
- //
- // Decrease Number
- //
- NewDescriptorBlock->NumberOfSmmReservedRegions --;
- //
- // Decrease Index to let it test mew entry
- //
- Index --;
- }
- }
-
- //
- // Last step, we can scrub old one
- //
- ZeroMem (&GuidHob->Name, sizeof(GuidHob->Name));
-
- return EFI_SUCCESS;
-}
-
-/**
- This routine will create AcpiVariable hob to point the reserved smram in S3 phase
- for PI SMM core.
-
- @retval EFI_SUCCESS The gEfiAcpiVariableGuid is created successfully.
- @retval EFI_NOT_FOUND The gEfiSmmPeiSmramMemoryReserveGuid is not found.
-
-**/
-EFI_STATUS
-EFIAPI
-CreateAcpiVariableHob (
- VOID
- )
-{
- EFI_PEI_HOB_POINTERS Hob;
- EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *DescriptorBlock;
- UINTN SmramRanges;
-
- //
- // Retrieve the GUID HOB data that contains the set of SMRAM descriptyors
- //
- DescriptorBlock = GetSrmamHobData ();
- if (DescriptorBlock == NULL) {
- return EFI_NOT_FOUND;
- }
-
- Hob.Raw = BuildGuidHob (
- &gEfiAcpiVariableGuid,
- sizeof (EFI_SMRAM_DESCRIPTOR)
- );
- ASSERT (Hob.Raw);
-
- //
- // It should be already patch, so just copy last but 1 region directly.
- //
- SmramRanges = DescriptorBlock->NumberOfSmmReservedRegions;
- ASSERT (SmramRanges >= 2);
- if (SmramRanges >= 2) {
- CopyMem ((VOID *)Hob.Raw, &DescriptorBlock->Descriptor[SmramRanges - 2], sizeof (EFI_SMRAM_DESCRIPTOR));
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Driver Entry for AcpiVariableHobOnSmramReservHob PEIM
-
- @param FileHandle Handle of the file being invoked.
- @param PeiServices Describes the list of possible PEI Services.
-
- @retval EFI_SUCCESS Success create gEfiAcpiVariableGuid and
- split gEfiSmmPeiSmramMemoryReserveGuid.
- @retval EFI_NOT_FOUND Can not get gEfiSmmPeiSmramMemoryReserveGuid hob
-
-**/
-EFI_STATUS
-EFIAPI
-AcpiVariableHobEntry (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- EFI_STATUS Status;
-
- //
- // Split SmramReserve hob, which is required for PI SMM Core for S3.
- //
- Status = SplitSmramReserveHob ();
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Create AcpiVariable hob, which is required for PI SMM Core for S3.
- //
- Status = CreateAcpiVariableHob ();
-
- return Status;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.inf b/EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.inf
deleted file mode 100644
index 2294a01956..0000000000
--- a/EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.inf
+++ /dev/null
@@ -1,52 +0,0 @@
-## @file
-# Component description file for AcpiVariableHob on SmramReservedHob Thunk driver.
-#
-# Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = AcpiVariableHobOnSmramReserveHobThunk
- FILE_GUID = 49B7F3E1-6C08-4a5b-911C-E9E397ED4178
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- ENTRY_POINT = AcpiVariableHobEntry
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- AcpiVariableHobOnSmramReserveHobThunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-[LibraryClasses]
- PeimEntryPoint
- MemoryAllocationLib
- DebugLib
- HobLib
- PeiServicesLib
- BaseMemoryLib
-
-[Guids]
- gEfiSmmPeiSmramMemoryReserveGuid # ALWAYS_CONSUMED
- gEfiAcpiVariableGuid # ALWAYS_CONSUMED
-
-[Depex]
- gEfiPeiMemoryDiscoveredPpiGuid
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/BootScriptSaveOnS3SaveStateThunk.inf b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/BootScriptSaveOnS3SaveStateThunk.inf
deleted file mode 100644
index def1ff0beb..0000000000
--- a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/BootScriptSaveOnS3SaveStateThunk.inf
+++ /dev/null
@@ -1,82 +0,0 @@
-## @file
-# To implement Framework Boot Script Save protocol based on PI S3 Save State protocol
-#
-# Intel's Framework Boot Script Save Protocol is replaced by S3 Save State Protocol in PI.
-# This module produces Framework Boot Script Save protocol by consuming PI S3 Save State protocol
-#
-# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = BootScriptSaveOnS3SaveStateThunk
- FILE_GUID = 062ACC82-1D1E-4f61-AA94-8B0C47236A3D
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeScriptSaveOnS3SaveState
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- ScriptSave.c
- ScriptSave.h
-
-[Sources.X64]
- X64/AsmDispatchExecute.asm
- X64/AsmDispatchExecute.S
- X64/DispatchExecute.c
-
-[Sources.Ia32]
- IA32/DispatchExecute.c
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- UefiRuntimeServicesTableLib
- UefiDriverEntryPoint
- BaseMemoryLib
- MemoryAllocationLib
- DebugLib
- BaseLib
- PeCoffLib
- PcdLib
- DxeServicesLib
- CacheMaintenanceLib
- BaseMemoryLib
- DevicePathLib
- UefiLib
-
-[Protocols]
- gEfiBootScriptSaveProtocolGuid ## PRODUCES
- gEfiS3SaveStateProtocolGuid ## CONSUMES
-
-[Guids]
- gEdkiiMemoryProfileGuid
-
-[Pcd]
- gEfiEdkCompatibilityPkgTokenSpaceGuid.BootScriptThunkDataPtr
- gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfilePropertyMask
-
-[Depex]
- gEfiS3SaveStateProtocolGuid
-
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/IA32/DispatchExecute.c b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/IA32/DispatchExecute.c
deleted file mode 100644
index 7a3c9143b6..0000000000
--- a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/IA32/DispatchExecute.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/** @file
- Execute 32-bit code in Long Mode
- Provide a thunk function to transition from long mode to compatibility mode to execute 32-bit code and then transit
- back to long mode.
-
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-#include "ScriptSave.h"
-/**
- Wrapper for a thunk to transition from long mode to compatibility mode to execute 32-bit code and then transit back to
- long mode.
-
- @param Function The 32bit code entry to be executed.
- @param Param1 The first parameter to pass to 32bit code
- @param Param2 The second parameter to pass to 32bit code
- @retval EFI_SUCCESS Execute 32bit code successfully.
- @retval other Something wrong when execute the 32bit code
-
-**/
-EFI_STATUS
-Execute32BitCode (
- IN UINT64 Function,
- IN UINT64 Param1,
- IN UINT64 Param2
- )
-{
- DISPATCH_ENTRYPOINT_FUNC EntryFunc;
- EFI_STATUS Status;
-
- EntryFunc = (DISPATCH_ENTRYPOINT_FUNC) (UINTN) (Function);
- Status = EntryFunc ((VOID *)(UINTN)Param1, (VOID *)(UINTN)Param2);
-
- return Status;
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c
deleted file mode 100644
index a3503a5d30..0000000000
--- a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c
+++ /dev/null
@@ -1,993 +0,0 @@
-/** @file
- Implementation for S3 Boot Script Save thunk driver.
- This thunk driver consumes PI S3SaveState protocol to produce framework S3BootScriptSave Protocol
-
- Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-#include "ScriptSave.h"
-
-EFI_HANDLE mHandle;
-EFI_BOOT_SCRIPT_SAVE_PROTOCOL mS3ScriptSave = {
- BootScriptWrite,
- BootScriptCloseTable
- };
-EFI_S3_SAVE_STATE_PROTOCOL *mS3SaveState;
-
-/**
- Wrapper for a thunk to transition from long mode to compatibility mode to execute 32-bit code and then transit back to
- long mode.
-
- @param Function The 32bit code entry to be executed.
- @param Param1 The first parameter to pass to 32bit code
- @param Param2 The second parameter to pass to 32bit code
- @retval EFI_SUCCESS Execute 32bit code successfully.
- @retval other Something wrong when execute the 32bit code
-
-**/
-EFI_STATUS
-Execute32BitCode (
- IN UINT64 Function,
- IN UINT64 Param1,
- IN UINT64 Param2
- );
-
-/**
- A stub to convert framework boot script dispatch to PI boot script dispatch.
-
- @param ImageHandle It should be is NULL.
- @param Context The first parameter to pass to 32bit code
-
- @return dispatch value.
-
-**/
-EFI_STATUS
-EFIAPI
-FrameworkBootScriptDispatchStub (
- IN EFI_HANDLE ImageHandle,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- DISPATCH_ENTRYPOINT_FUNC EntryFunc;
- VOID *PeiServices;
- IA32_DESCRIPTOR Idtr;
-
- DEBUG ((EFI_D_ERROR, "FrameworkBootScriptDispatchStub - 0x%08x\n", (UINTN)Context));
-
- EntryFunc = (DISPATCH_ENTRYPOINT_FUNC) (UINTN) (Context);
- AsmReadIdtr (&Idtr);
- PeiServices = (VOID *)(UINTN)(*(UINT32 *)(Idtr.Base - sizeof (UINT32)));
-
- //
- // ECP assumes first parameter is NULL, and second parameter is PeiServices.
- //
- Status = Execute32BitCode ((UINT64)(UINTN)EntryFunc, 0, (UINT64)(UINTN)PeiServices);
-
- return Status;
-}
-
-/**
- Internal function to add IO write opcode to the table.
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-BootScriptIoWrite (
- IN VA_LIST Marker
- )
-{
- EFI_BOOT_SCRIPT_WIDTH Width;
- UINT64 Address;
- UINTN Count;
- UINT8 *Buffer;
-
- Width = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Count = VA_ARG (Marker, UINTN);
- Buffer = VA_ARG (Marker, UINT8 *);
-
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_IO_WRITE_OPCODE,
- Width,
- Address,
- Count,
- Buffer
- );
-}
-/**
- Internal function to add IO read/write opcode to the table.
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-BootScriptIoReadWrite (
- IN VA_LIST Marker
- )
-{
- EFI_BOOT_SCRIPT_WIDTH Width;
- UINT64 Address;
- UINT8 *Data;
- UINT8 *DataMask;
-
- Width = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, UINT8 *);
- DataMask = VA_ARG (Marker, UINT8 *);
-
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE,
- Width,
- Address,
- Data,
- DataMask
- );
-}
-
-/**
- Internal function to add memory write opcode to the table.
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-BootScriptMemWrite (
- IN VA_LIST Marker
- )
-{
- EFI_BOOT_SCRIPT_WIDTH Width;
- UINT64 Address;
- UINTN Count;
- UINT8 *Buffer;
-
- Width = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Count = VA_ARG (Marker, UINTN);
- Buffer = VA_ARG (Marker, UINT8 *);
-
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE,
- Width,
- Address,
- Count,
- Buffer
- );
-}
-
-/**
- Internal function to add memory read/write opcode to the table.
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-BootScriptMemReadWrite (
- IN VA_LIST Marker
- )
-{
- EFI_BOOT_SCRIPT_WIDTH Width;
- UINT64 Address;
- UINT8 *Data;
- UINT8 *DataMask;
-
- Width = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, UINT8 *);
- DataMask = VA_ARG (Marker, UINT8 *);
-
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE,
- Width,
- Address,
- Data,
- DataMask
- );
-}
-
-/**
- Internal function to add PciCfg write opcode to the table.
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-BootScriptPciCfgWrite (
- IN VA_LIST Marker
- )
-{
- EFI_BOOT_SCRIPT_WIDTH Width;
- UINT64 Address;
- UINTN Count;
- UINT8 *Buffer;
-
- Width = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Count = VA_ARG (Marker, UINTN);
- Buffer = VA_ARG (Marker, UINT8 *);
-
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE,
- Width,
- Address,
- Count,
- Buffer
- );
-}
-
-/**
- Internal function to PciCfg read/write opcode to the table.
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-BootScriptPciCfgReadWrite (
- IN VA_LIST Marker
- )
-{
- EFI_BOOT_SCRIPT_WIDTH Width;
- UINT64 Address;
- UINT8 *Data;
- UINT8 *DataMask;
-
- Width = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, UINT8 *);
- DataMask = VA_ARG (Marker, UINT8 *);
-
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE,
- Width,
- Address,
- Data,
- DataMask
- );
-}
-/**
- Internal function to add PciCfg2 write opcode to the table.
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-BootScriptPciCfg2Write (
- IN VA_LIST Marker
- )
-{
- EFI_BOOT_SCRIPT_WIDTH Width;
- UINT64 Address;
- UINTN Count;
- UINT8 *Buffer;
- UINT16 Segment;
-
- Width = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Count = VA_ARG (Marker, UINTN);
- Buffer = VA_ARG (Marker, UINT8 *);
- Segment = VA_ARG (Marker, UINT16);
-
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE,
- Width,
- Segment,
- Address,
- Count,
- Buffer
- );
-}
-
-/**
- Internal function to PciCfg2 read/write opcode to the table.
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-BootScriptPciCfg2ReadWrite (
- IN VA_LIST Marker
- )
-{
- EFI_BOOT_SCRIPT_WIDTH Width;
- UINT16 Segment;
- UINT64 Address;
- UINT8 *Data;
- UINT8 *DataMask;
-
- Width = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Segment = VA_ARG (Marker, UINT16);
- Data = VA_ARG (Marker, UINT8 *);
- DataMask = VA_ARG (Marker, UINT8 *);
-
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE,
- Width,
- Segment,
- Address,
- Data,
- DataMask
- );
-}
-/**
- Internal function to add smbus execute opcode to the table.
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-BootScriptSmbusExecute (
- IN VA_LIST Marker
- )
-{
- EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
- EFI_SMBUS_DEVICE_COMMAND Command;
- EFI_SMBUS_OPERATION Operation;
- BOOLEAN PecCheck;
- VOID *Buffer;
- UINTN *DataSize;
-
- SlaveAddress.SmbusDeviceAddress = VA_ARG (Marker, UINTN);
- Command = VA_ARG (Marker, EFI_SMBUS_DEVICE_COMMAND);
- Operation = VA_ARG (Marker, EFI_SMBUS_OPERATION);
- PecCheck = VA_ARG (Marker, BOOLEAN);
- DataSize = VA_ARG (Marker, UINTN *);
- Buffer = VA_ARG (Marker, VOID *);
-
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE,
- SlaveAddress,
- Command,
- Operation,
- PecCheck,
- DataSize,
- Buffer
- );
-}
-/**
- Internal function to add stall opcode to the table.
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-BootScriptStall (
- IN VA_LIST Marker
- )
-{
- UINT32 Duration;
-
- Duration = VA_ARG (Marker, UINT32);
-
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_STALL_OPCODE,
- Duration
- );
-}
-
-/**
- Internal function to add Save jmp address according to DISPATCH_OPCODE.
- We ignore "Context" parameter
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-BootScriptDispatch (
- IN VA_LIST Marker
- )
-{
- VOID *EntryPoint;
-
- EntryPoint = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_DISPATCH_OPCODE,
- EntryPoint
- );
-}
-
-/**
- Internal function to add Save jmp address according to DISPATCH_OPCODE.
- We ignore "Context" parameter.
- We need create thunk stub to convert PEI entrypoint (used in Framework version)
- to DXE entrypoint (defined in PI spec).
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-FrameworkBootScriptDispatch (
- IN VA_LIST Marker
- )
-{
- VOID *EntryPoint;
- VOID *Context;
-
- EntryPoint = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
-
- //
- // Register callback
- //
- Context = EntryPoint;
- EntryPoint = (VOID *)(UINTN)FrameworkBootScriptDispatchStub;
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE,
- EntryPoint,
- Context
- );
-}
-
-/**
- Internal function to add memory pool operation to the table.
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-BootScriptMemPoll (
- IN VA_LIST Marker
- )
-{
- EFI_BOOT_SCRIPT_WIDTH Width;
- UINT64 Address;
- UINT8 *BitMask;
- UINT8 *BitValue;
- UINT64 Duration;
- UINT64 LoopTimes;
- UINT64 Delay;
-
- Width = VA_ARG (Marker, EFI_BOOT_SCRIPT_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- BitMask = VA_ARG (Marker, UINT8 *);
- BitValue = VA_ARG (Marker, UINT8 *);
- Duration = (UINT64)VA_ARG (Marker, UINT64);
- LoopTimes = (UINT64)VA_ARG (Marker, UINT64);
- //
- // Framework version: Duration is used for Stall(), which is Microseconds.
- // Total time is: Duration(Microseconds) * LoopTimes.
- // PI version: Duration is always 100ns. Delay is LoopTimes.
- // Total time is: 100ns * Delay.
- // So Delay = Duration(Microseconds) * LoopTimes / 100ns
- // = Duration * 1000ns * LoopTimes / 100ns
- // = Duration * 10 * LoopTimes
- //
- Delay = MultU64x64 (MultU64x32 (Duration, 10), LoopTimes);
-
- //
- // Framework version: First BitMask, then BitValue
- // PI version: First Data, then DataMask
- // So we revert their order in function call
- //
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_MEM_POLL_OPCODE,
- Width,
- Address,
- BitValue,
- BitMask,
- Delay
- );
-}
-
-/**
- Internal function to add Save jmp address according to DISPATCH_OPCODE2.
- The "Context" parameter is not ignored.
-
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enough resource to do operation.
- @retval EFI_SUCCESS Opcode is added.
-
-**/
-EFI_STATUS
-BootScriptDispatch2 (
- IN VA_LIST Marker
- )
-{
- VOID *EntryPoint;
- VOID *Context;
-
- EntryPoint = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
- Context = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
-
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE,
- EntryPoint,
- Context
- );
-}
-/**
- Internal function to add the opcode link node to the link
- list.
- @param Marker The variable argument list to get the opcode
- and associated attributes.
-
- @retval EFI_OUT_OF_RESOURCES Not enought resource to complete the operations.
- @retval EFI_SUCCESS The opcode entry is added to the link list
- successfully.
-**/
-EFI_STATUS
-BootScriptInformation (
- IN VA_LIST Marker
- )
-{
- UINT32 InformationLength;
- EFI_PHYSICAL_ADDRESS Information;
-
- InformationLength = VA_ARG (Marker, UINT32);
- Information = VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
-
- return mS3SaveState->Write (
- mS3SaveState,
- EFI_BOOT_SCRIPT_INFORMATION_OPCODE,
- InformationLength,
- (VOID*)(UINTN)Information
- );
-}
-
-/**
- Adds a record into a specified Framework boot script table.
-
- This function is used to store a boot script record into a given boot
- script table. If the table specified by TableName is nonexistent in the
- system, a new table will automatically be created and then the script record
- will be added into the new table. A boot script table can add new script records
- until EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is called. Currently, the only
- meaningful table name is EFI_ACPI_S3_RESUME_SCRIPT_TABLE. This function is
- responsible for allocating necessary memory for the script.
-
- This function has a variable parameter list. The exact parameter list depends on
- the OpCode that is passed into the function. If an unsupported OpCode or illegal
- parameter list is passed in, this function returns EFI_INVALID_PARAMETER.
- If there are not enough resources available for storing more scripts, this function returns
- EFI_OUT_OF_RESOURCES.
-
- @param This A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.
- @param TableName Name of the script table. Currently, the only meaningful value is
- EFI_ACPI_S3_RESUME_SCRIPT_TABLE.
- @param OpCode The operation code (opcode) number.
- @param ... Argument list that is specific to each opcode.
-
- @retval EFI_SUCCESS The operation succeeded. A record was added into the
- specified script table.
- @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
- If the opcode is unknow or not supported because of the PCD
- Feature Flags.
- @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
-
-**/
-EFI_STATUS
-EFIAPI
-BootScriptWrite (
- IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL *This,
- IN UINT16 TableName,
- IN UINT16 OpCode,
- ...
- )
-{
- EFI_STATUS Status;
- VA_LIST Marker;
-
- if (TableName != FRAMEWORK_EFI_ACPI_S3_RESUME_SCRIPT_TABLE) {
- //
- // Only S3 boot script is supported for now
- //
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Build script according to opcode
- //
- switch (OpCode) {
-
- case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptIoWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptIoReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptMemWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptMemReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptPciCfgWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptPciCfgReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptSmbusExecute (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_STALL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptStall (Marker);
- VA_END (Marker);
-
- break;
-
- case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:
- VA_START (Marker, OpCode);
- Status = FrameworkBootScriptDispatch (Marker);
- VA_END (Marker);
- break;
-
- case FRAMEWORK_EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptDispatch2 (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptInformation (Marker);
- VA_END (Marker);
- break;
-
- case FRAMEWORK_EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptMemPoll (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptPciCfg2Write (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptPciCfg2ReadWrite (Marker);
- VA_END (Marker);
- break;
-
- default:
- Status = EFI_INVALID_PARAMETER;
- break;
- }
-
- return Status;
-}
-
-/**
- Closes the specified script table.
-
- This function closes the specified boot script table and returns the base address
- of the table. It allocates a new pool to duplicate all the boot scripts in the specified
- table. Once this function is called, the specified table will be destroyed after it is
- copied into the allocated pool. As a result, any attempts to add a script record into a
- closed table will cause a new table to be created. The base address of the allocated pool
- will be returned in Address. After using the boot script table, the caller is responsible
- for freeing the pool that is allocated by this function. If the boot script table,
- such as EFI_ACPI_S3_RESUME_SCRIPT_TABLE, is required to be stored in a nonperturbed
- memory region, the caller should copy the table into the nonperturbed memory region by itself.
-
- @param This A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.
- @param TableName Name of the script table. Currently, the only meaningful value is
- EFI_ACPI_S3_RESUME_SCRIPT_TABLE.
- @param Address A pointer to the physical address where the table begins.
-
- @retval EFI_SUCCESS The table was successfully returned.
- @retval EFI_NOT_FOUND The specified table was not created previously.
- @retval EFI_OUT_OF_RESOURCE Memory is insufficient to hold the reorganized boot script table.
- @retval EFI_UNSUPPORTED the table type is not EFI_ACPI_S3_RESUME_SCRIPT_TABLE
-
-**/
-EFI_STATUS
-EFIAPI
-BootScriptCloseTable (
- IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL *This,
- IN UINT16 TableName,
- OUT EFI_PHYSICAL_ADDRESS *Address
- )
-{
- if (TableName != FRAMEWORK_EFI_ACPI_S3_RESUME_SCRIPT_TABLE) {
- //
- // Only S3 boot script is supported for now
- //
- return EFI_NOT_FOUND;
- }
- //
- // Here the close table is not implemented.
- //
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- Register image to memory profile.
-
- @param FileName File name of the image.
- @param ImageBase Image base address.
- @param ImageSize Image size.
- @param FileType File type of the image.
-
-**/
-VOID
-RegisterMemoryProfileImage (
- IN EFI_GUID *FileName,
- IN PHYSICAL_ADDRESS ImageBase,
- IN UINT64 ImageSize,
- IN EFI_FV_FILETYPE FileType
- )
-{
- EFI_STATUS Status;
- EDKII_MEMORY_PROFILE_PROTOCOL *ProfileProtocol;
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FilePath;
- UINT8 TempBuffer[sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH) + sizeof (EFI_DEVICE_PATH_PROTOCOL)];
-
- if ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT0) != 0) {
-
- FilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)TempBuffer;
- Status = gBS->LocateProtocol (&gEdkiiMemoryProfileGuid, NULL, (VOID **) &ProfileProtocol);
- if (!EFI_ERROR (Status)) {
- EfiInitializeFwVolDevicepathNode (FilePath, FileName);
- SetDevicePathEndNode (FilePath + 1);
-
- Status = ProfileProtocol->RegisterImage (
- ProfileProtocol,
- (EFI_DEVICE_PATH_PROTOCOL *) FilePath,
- ImageBase,
- ImageSize,
- FileType
- );
- }
- }
-}
-
-/**
- This routine is entry point of ScriptSave driver.
-
- @param ImageHandle Handle for this drivers loaded image protocol.
- @param SystemTable EFI system table.
-
- @retval EFI_OUT_OF_RESOURCES No enough resource
- @retval EFI_SUCCESS Succesfully installed the ScriptSave driver.
- @retval other Errors occured.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeScriptSaveOnS3SaveState (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- UINT8 *Buffer;
- UINTN BufferSize;
- PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
- BOOT_SCRIPT_THUNK_DATA *BootScriptThunkData;
- EFI_STATUS Status;
- VOID *DevicePath;
- EFI_PHYSICAL_ADDRESS MemoryAddress;
- UINTN PageNumber;
- EFI_HANDLE NewImageHandle;
-
- //
- // Test if the gEfiCallerIdGuid of this image is already installed. if not, the entry
- // point is loaded by DXE code which is the first time loaded. or else, it is already
- // be reloaded be itself.This is a work-around
- //
- Status = gBS->LocateProtocol (&gEfiCallerIdGuid, NULL, &DevicePath);
- if (EFI_ERROR (Status)) {
- //
- // This is the first-time loaded by DXE core. reload itself to RESERVED mem
- //
- //
- // A workaround: Here we install a dummy handle
- //
- NewImageHandle = NULL;
- Status = gBS->InstallProtocolInterface (
- &NewImageHandle,
- &gEfiCallerIdGuid,
- EFI_NATIVE_INTERFACE,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = GetSectionFromAnyFv (
- &gEfiCallerIdGuid,
- EFI_SECTION_PE32,
- 0,
- (VOID **) &Buffer,
- &BufferSize
- );
- ASSERT_EFI_ERROR (Status);
- ImageContext.Handle = Buffer;
- ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
- //
- // Get information about the image being loaded
- //
- Status = PeCoffLoaderGetImageInfo (&ImageContext);
- ASSERT_EFI_ERROR (Status);
-
- MemoryAddress = SIZE_4GB - 1;
- if (ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
- PageNumber = EFI_SIZE_TO_PAGES ((UINTN) (ImageContext.ImageSize + ImageContext.SectionAlignment));
- } else {
- PageNumber = EFI_SIZE_TO_PAGES ((UINTN) ImageContext.ImageSize);
- }
- Status = gBS->AllocatePages (
- AllocateMaxAddress,
- EfiReservedMemoryType,
- PageNumber,
- &MemoryAddress
- );
- ASSERT_EFI_ERROR (Status);
- ImageContext.ImageAddress = (PHYSICAL_ADDRESS)(UINTN)MemoryAddress;
- //
- // Align buffer on section boundary
- //
- ImageContext.ImageAddress += ImageContext.SectionAlignment - 1;
- ImageContext.ImageAddress &= ~(ImageContext.SectionAlignment - 1);
- //
- // Load the image to our new buffer
- //
- Status = PeCoffLoaderLoadImage (&ImageContext);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Relocate the image in our new buffer
- //
- Status = PeCoffLoaderRelocateImage (&ImageContext);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Free the buffer allocated by ReadSection since the image has been relocated in the new buffer
- //
- gBS->FreePool (Buffer);
-
- //
- // Flush the instruction cache so the image data is written before we execute it
- //
- InvalidateInstructionCacheRange ((VOID *)(UINTN)ImageContext.ImageAddress, (UINTN)ImageContext.ImageSize);
-
- RegisterMemoryProfileImage (
- &gEfiCallerIdGuid,
- ImageContext.ImageAddress,
- ImageContext.ImageSize,
- EFI_FV_FILETYPE_DRIVER
- );
-
- Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)(ImageContext.EntryPoint)) (NewImageHandle, SystemTable);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Additional step for BootScriptThunk integrity
- //
-
- //
- // Allocate BootScriptThunkData
- //
- BootScriptThunkData = AllocatePool (sizeof (BOOT_SCRIPT_THUNK_DATA));
- ASSERT (BootScriptThunkData != NULL);
-
- BootScriptThunkData->BootScriptThunkBase = ImageContext.ImageAddress;
- BootScriptThunkData->BootScriptThunkLength = ImageContext.ImageSize;
- //
- // Set BootScriptThunkData
- //
- PcdSet64 (BootScriptThunkDataPtr, (UINT64)(UINTN)BootScriptThunkData);
- return EFI_SUCCESS;
- } else {
- //
- // the entry point is invoked after reloading. following code only run in RESERVED mem
- //
-
- //
- // Locate and cache PI S3 Save State Protocol.
- //
- Status = gBS->LocateProtocol (
- &gEfiS3SaveStateProtocolGuid,
- NULL,
- (VOID **) &mS3SaveState
- );
- ASSERT_EFI_ERROR (Status);
-
- return gBS->InstallProtocolInterface (
- &mHandle,
- &gEfiBootScriptSaveProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mS3ScriptSave
- );
- }
-}
-
-
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.h b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.h
deleted file mode 100644
index cac7b0b85c..0000000000
--- a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/** @file
- Header file for S3 Boot Script Saver thunk driver.
-
- Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-#ifndef __BOOT_SCRIPT_SAVE_ON_S3_SAVE_STATE_H__
-#define __BOOT_SCRIPT_SAVE_ON_S3_SAVE_STATE_H__
-#include <FrameworkDxe.h>
-
-#include <Protocol/BootScriptSave.h>
-#include <Protocol/S3SaveState.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/SmbusLib.h>
-#include <Library/PeCoffLib.h>
-#include <Library/PcdLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DxeServicesLib.h>
-#include <Library/CacheMaintenanceLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/UefiLib.h>
-
-#include <Guid/BootScriptThunkData.h>
-#include <Guid/MemoryProfile.h>
-
-#include <IndustryStandard/SmBus.h>
-
-typedef
-EFI_STATUS
-(EFIAPI *DISPATCH_ENTRYPOINT_FUNC) (
- IN EFI_HANDLE ImageHandle,
- IN VOID *Context
- );
-
-/**
- Adds a record into a specified Framework boot script table.
-
- This function is used to store a boot script record into a given boot
- script table. If the table specified by TableName is nonexistent in the
- system, a new table will automatically be created and then the script record
- will be added into the new table. A boot script table can add new script records
- until EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is called. Currently, the only
- meaningful table name is EFI_ACPI_S3_RESUME_SCRIPT_TABLE. This function is
- responsible for allocating necessary memory for the script.
-
- This function has a variable parameter list. The exact parameter list depends on
- the OpCode that is passed into the function. If an unsupported OpCode or illegal
- parameter list is passed in, this function returns EFI_INVALID_PARAMETER.
- If there are not enough resources available for storing more scripts, this function returns
- EFI_OUT_OF_RESOURCES.
-
- @param This A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.
- @param TableName Name of the script table. Currently, the only meaningful value is
- EFI_ACPI_S3_RESUME_SCRIPT_TABLE.
- @param OpCode The operation code (opcode) number.
- @param ... Argument list that is specific to each opcode.
-
- @retval EFI_SUCCESS The operation succeeded. A record was added into the
- specified script table.
- @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
- If the opcode is unknow or not supported because of the PCD
- Feature Flags.
- @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
-
-**/
-EFI_STATUS
-EFIAPI
-BootScriptWrite (
- IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL *This,
- IN UINT16 TableName,
- IN UINT16 OpCode,
- ...
- );
-
-/**
- Closes the specified script table.
-
- This function closes the specified boot script table and returns the base address
- of the table. It allocates a new pool to duplicate all the boot scripts in the specified
- table. Once this function is called, the specified table will be destroyed after it is
- copied into the allocated pool. As a result, any attempts to add a script record into a
- closed table will cause a new table to be created. The base address of the allocated pool
- will be returned in Address. After using the boot script table, the caller is responsible
- for freeing the pool that is allocated by this function. If the boot script table,
- such as EFI_ACPI_S3_RESUME_SCRIPT_TABLE, is required to be stored in a nonperturbed
- memory region, the caller should copy the table into the nonperturbed memory region by itself.
-
- @param This A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.
- @param TableName Name of the script table. Currently, the only meaningful value is
- EFI_ACPI_S3_RESUME_SCRIPT_TABLE.
- @param Address A pointer to the physical address where the table begins.
-
- @retval EFI_SUCCESS The table was successfully returned.
- @retval EFI_NOT_FOUND The specified table was not created previously.
- @retval EFI_OUT_OF_RESOURCE Memory is insufficient to hold the reorganized boot script table.
- @retval EFI_UNSUPPORTED the table type is not EFI_ACPI_S3_RESUME_SCRIPT_TABLE
-
-**/
-EFI_STATUS
-EFIAPI
-BootScriptCloseTable (
- IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL *This,
- IN UINT16 TableName,
- OUT EFI_PHYSICAL_ADDRESS *Address
- );
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/AsmDispatchExecute.S b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/AsmDispatchExecute.S
deleted file mode 100644
index 36f5fd5775..0000000000
--- a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/AsmDispatchExecute.S
+++ /dev/null
@@ -1,216 +0,0 @@
-#
-# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
-# 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:
-#
-# AsmDispatchExecute.asm
-#
-# Abstract:
-#
-# This is the assembly code to transition from long mode to compatibility mode to execute 32-bit code and then
-# transit back to long mode.
-#
-#-------------------------------------------------------------------------------
-
-#----------------------------------------------------------------------------
-# Procedure: AsmExecute32BitCode
-#
-# Input: None
-#
-# Output: None
-#
-# Prototype: EFI_STATUS
-# AsmExecute32BitCode (
-# IN UINT64 Function,
-# IN UINT64 Param1,
-# IN UINT64 Param2,
-# IN IA32_DESCRIPTOR *InternalGdtr
-# );
-#
-#
-# Description: A thunk function to execute 32-bit code in long mode.
-#
-#----------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(AsmExecute32BitCode)
-ASM_PFX(AsmExecute32BitCode):
- #
- # save orignal GDTR and CS
- #
- movl %ds, %eax
- push %rax
- movl %cs, %eax
- push %rax
- subq $0x10, %rsp
- sgdt (%rsp)
- #
- # load internal GDT
- #
- lgdt (%r9)
- #
- # Save general purpose register and rflag register
- #
- pushfq
- push %rdi
- push %rsi
- push %rbp
- push %rbx
-
- #
- # save CR3
- #
- movq %cr3, %rax
- movq %rax, %rbp
-
- #
- # Prepare the CS and return address for the transition from 32-bit to 64-bit mode
- #
- movq $0x10, %rax # load long mode selector
- shl $32, %rax
- lea ReloadCS(%rip), %r9 #Assume the ReloadCS is under 4G
- orq %r9, %rax
- push %rax
- #
- # Save parameters for 32-bit function call
- #
- movq %r8, %rax
- shl $32, %rax
- orq %rdx, %rax
- push %rax
- #
- # save the 32-bit function entry and the return address into stack which will be
- # retrieve in compatibility mode.
- #
- lea ReturnBack(%rip), %rax #Assume the ReloadCS is under 4G
- shl $32, %rax
- orq %rcx, %rax
- push %rax
-
- #
- # let rax save DS
- #
- movq $0x18, %rax
-
- #
- # Change to Compatible Segment
- #
- movq $8, %rcx # load compatible mode selector
- shl $32, %rcx
- lea Compatible(%rip), %rdx # assume address < 4G
- orq %rdx, %rcx
- push %rcx
- .byte 0xcb # retf
-
-Compatible:
- # reload DS/ES/SS to make sure they are correct referred to current GDT
- movw %ax, %ds
- movw %ax, %es
- movw %ax, %ss
-
- #
- # Disable paging
- #
- movq %cr0, %rcx
- btc $31, %ecx
- movq %rcx, %cr0
- #
- # Clear EFER.LME
- #
- movl $0xC0000080, %ecx
- rdmsr
- btc $8, %eax
- wrmsr
-
-# Now we are in protected mode
- #
- # Call 32-bit function. Assume the function entry address and parameter value is less than 4G
- #
- pop %rax # Here is the function entry
- #
- # Now the parameter is at the bottom of the stack, then call in to IA32 function.
- #
- jmp *%rax
-ReturnBack:
- pop %rcx # drop param1
- pop %rcx # drop param2
-
- #
- # restore CR4
- #
- movq %cr4, %rax
- bts $5, %eax
- movq %rax, %cr4
-
- #
- # restore CR3
- #
- movl %ebp, %eax
- movq %rax, %cr3
-
- #
- # Set EFER.LME to re-enable ia32-e
- #
- movl $0xC0000080, %ecx
- rdmsr
- bts $8, %eax
- wrmsr
- #
- # Enable paging
- #
- movq %cr0, %rax
- bts $31, %eax
- mov %rax, %cr0
-# Now we are in compatible mode
-
- #
- # Reload cs register
- #
- .byte 0xcb # retf
-ReloadCS:
- #
- # Now we're in Long Mode
- #
- #
- # Restore C register and eax hold the return status from 32-bit function.
- # Note: Do not touch rax from now which hold the return value from IA32 function
- #
- pop %rbx
- pop %rbp
- pop %rsi
- pop %rdi
- popfq
- #
- # Switch to orignal GDT and CS. here rsp is pointer to the orignal GDT descriptor.
- #
- lgdt (%rsp)
- #
- # drop GDT descriptor in stack
- #
- addq $0x10, %rsp
- #
- # switch to orignal CS and GDTR
- #
- pop %r9 # get CS
- shl $32, %r9 # rcx[32..47] <- Cs
- lea ReturnToLongMode(%rip), %rcx
- orq %r9, %rcx
- push %rcx
- .byte 0xcb # retf
-ReturnToLongMode:
- #
- # Reload original DS/ES/SS
- #
- pop %rcx
- movl %ecx, %ds
- movl %ecx, %es
- movl %ecx, %ss
- ret
-
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/AsmDispatchExecute.asm b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/AsmDispatchExecute.asm
deleted file mode 100644
index 2d5d92056e..0000000000
--- a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/AsmDispatchExecute.asm
+++ /dev/null
@@ -1,216 +0,0 @@
-;
-; Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
-; 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:
-;
-; AsmDispatchExecute.asm
-;
-; Abstract:
-;
-; This is the assembly code to transition from long mode to compatibility mode to execute 32-bit code and then
-; transit back to long mode.
-;
-;-------------------------------------------------------------------------------
- .code
-;----------------------------------------------------------------------------
-; Procedure: AsmExecute32BitCode
-;
-; Input: None
-;
-; Output: None
-;
-; Prototype: EFI_STATUS
-; AsmExecute32BitCode (
-; IN UINT64 Function,
-; IN UINT64 Param1,
-; IN UINT64 Param2,
-; IN IA32_DESCRIPTOR *InternalGdtr
-; );
-;
-;
-; Description: A thunk function to execute 32-bit code in long mode.
-;
-;----------------------------------------------------------------------------
-AsmExecute32BitCode PROC
- ;
- ; save orignal GDTR and CS
- ;
- mov rax, ds
- push rax
- mov rax, cs
- push rax
- sub rsp, 10h
- sgdt fword ptr [rsp]
- ;
- ; load internal GDT
- ;
- lgdt fword ptr [r9]
- ;
- ; Save general purpose register and rflag register
- ;
- pushfq
- push rdi
- push rsi
- push rbp
- push rbx
-
- ;
- ; save CR3
- ;
- mov rax, cr3
- mov rbp, rax
-
- ;
- ; Prepare the CS and return address for the transition from 32-bit to 64-bit mode
- ;
- mov rax, 10h ; load long mode selector
- shl rax, 32
- mov r9, OFFSET ReloadCS ;Assume the ReloadCS is under 4G
- or rax, r9
- push rax
- ;
- ; Save parameters for 32-bit function call
- ;
- mov rax, r8
- shl rax, 32
- or rax, rdx
- push rax
- ;
- ; save the 32-bit function entry and the return address into stack which will be
- ; retrieve in compatibility mode.
- ;
- mov rax, OFFSET ReturnBack ;Assume the ReloadCS is under 4G
- shl rax, 32
- or rax, rcx
- push rax
-
- ;
- ; let rax save DS
- ;
- mov rax, 018h
-
- ;
- ; Change to Compatible Segment
- ;
- mov rcx, 08h ; load compatible mode selector
- shl rcx, 32
- mov rdx, OFFSET Compatible ; assume address < 4G
- or rcx, rdx
- push rcx
- retf
-
-Compatible:
- ; reload DS/ES/SS to make sure they are correct referred to current GDT
- mov ds, ax
- mov es, ax
- mov ss, ax
-
- ;
- ; Disable paging
- ;
- mov rcx, cr0
- btc ecx, 31
- mov cr0, rcx
- ;
- ; Clear EFER.LME
- ;
- mov ecx, 0C0000080h
- rdmsr
- btc eax, 8
- wrmsr
-
-; Now we are in protected mode
- ;
- ; Call 32-bit function. Assume the function entry address and parameter value is less than 4G
- ;
- pop rax ; Here is the function entry
- ;
- ; Now the parameter is at the bottom of the stack, then call in to IA32 function.
- ;
- jmp rax
-ReturnBack:
- pop rcx ; drop param1
- pop rcx ; drop param2
-
- ;
- ; restore CR4
- ;
- mov rax, cr4
- bts eax, 5
- mov cr4, rax
-
- ;
- ; restore CR3
- ;
- mov eax, ebp
- mov cr3, rax
-
- ;
- ; Set EFER.LME to re-enable ia32-e
- ;
- mov ecx, 0C0000080h
- rdmsr
- bts eax, 8
- wrmsr
- ;
- ; Enable paging
- ;
- mov rax, cr0
- bts eax, 31
- mov cr0, rax
-; Now we are in compatible mode
-
- ;
- ; Reload cs register
- ;
- retf
-ReloadCS:
- ;
- ; Now we're in Long Mode
- ;
- ;
- ; Restore C register and eax hold the return status from 32-bit function.
- ; Note: Do not touch rax from now which hold the return value from IA32 function
- ;
- pop rbx
- pop rbp
- pop rsi
- pop rdi
- popfq
- ;
- ; Switch to orignal GDT and CS. here rsp is pointer to the orignal GDT descriptor.
- ;
- lgdt fword ptr[rsp]
- ;
- ; drop GDT descriptor in stack
- ;
- add rsp, 10h
- ;
- ; switch to orignal CS and GDTR
- ;
- pop r9 ; get CS
- shl r9, 32 ; rcx[32..47] <- Cs
- mov rcx, OFFSET @F
- or rcx, r9
- push rcx
- retf
-@@:
- ;
- ; Reload original DS/ES/SS
- ;
- pop rcx
- mov ds, rcx
- mov es, rcx
- mov ss, rcx
- ret
-AsmExecute32BitCode ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/DispatchExecute.c b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/DispatchExecute.c
deleted file mode 100644
index 20567bddeb..0000000000
--- a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/DispatchExecute.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/** @file
- Execute 32-bit code in Long Mode
- Provide a thunk function to transition from long mode to compatibility mode to execute 32-bit code and then transit
- back to long mode.
-
- Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-#include "ScriptSave.h"
-
-#pragma pack(1)
-typedef union {
- struct {
- UINT32 LimitLow : 16;
- UINT32 BaseLow : 16;
- UINT32 BaseMid : 8;
- UINT32 Type : 4;
- UINT32 System : 1;
- UINT32 Dpl : 2;
- UINT32 Present : 1;
- UINT32 LimitHigh : 4;
- UINT32 Software : 1;
- UINT32 Reserved : 1;
- UINT32 DefaultSize : 1;
- UINT32 Granularity : 1;
- UINT32 BaseHigh : 8;
- } Bits;
- UINT64 Uint64;
-} IA32_GDT;
-
-///
-/// Byte packed structure for an IA-32 Interrupt Gate Descriptor.
-///
-typedef union {
- struct {
- UINT32 OffsetLow:16; ///< Offset bits 15..0.
- UINT32 Selector:16; ///< Selector.
- UINT32 Reserved_0:8; ///< Reserved.
- UINT32 GateType:8; ///< Gate Type. See #defines above.
- UINT32 OffsetHigh:16; ///< Offset bits 31..16.
- } Bits;
- UINT64 Uint64;
-} IA32_IDT_ENTRY;
-#pragma pack()
-
-#define COMPATIBILITY_MODE_SELECTOR 8
-
-//
-// Global Descriptor Table (GDT)
-//
-GLOBAL_REMOVE_IF_UNREFERENCED IA32_GDT mGdtEntries[] = {
- {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 0x0: reserve */
- {{0xFFFF, 0, 0, 0xB, 1, 0, 1, 0xF, 0, 0, 1, 1, 0}}, /* 0x8: compatibility mode */
- {{0xFFFF, 0, 0, 0xB, 1, 0, 1, 0xF, 0, 1, 0, 1, 0}}, /* 0x10: for long mode */
- {{0xFFFF, 0, 0, 0x3, 1, 0, 1, 0xF, 0, 0, 1, 1, 0}}, /* 0x18: data */
- {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 0x20: reserve */
-};
-
-//
-// IA32 Gdt register
-//
-GLOBAL_REMOVE_IF_UNREFERENCED IA32_DESCRIPTOR mGdt = {
- sizeof (mGdtEntries) - 1,
- (UINTN) mGdtEntries
- };
-/**
- Assembly function to transition from long mode to compatibility mode to execute 32-bit code and then transit back to
- long mode.
- @param Function The 32bit code entry to be executed.
- @param Param1 The first parameter to pass to 32bit code
- @param Param2 The second parameter to pass to 32bit code
- @param InternalGdtr The GDT and GDT descriptor used by this library
-
- @retval EFI_SUCCESS Execute 32bit code successfully.
- @retval other Something wrong when execute the 32bit code
-**/
-EFI_STATUS
-AsmExecute32BitCode (
- IN UINT64 Function,
- IN UINT64 Param1,
- IN UINT64 Param2,
- IN IA32_DESCRIPTOR *InternalGdtr
- );
-
-/**
- Wrapper for a thunk to transition from long mode to compatibility mode to execute 32-bit code and then transit back to
- long mode.
-
- @param Function The 32bit code entry to be executed.
- @param Param1 The first parameter to pass to 32bit code
- @param Param2 The second parameter to pass to 32bit code
- @retval EFI_SUCCESS Execute 32bit code successfully.
- @retval other Something wrong when execute the 32bit code
-
-**/
-EFI_STATUS
-Execute32BitCode (
- IN UINT64 Function,
- IN UINT64 Param1,
- IN UINT64 Param2
- )
-{
- EFI_STATUS Status;
- IA32_DESCRIPTOR *Ia32Idtr;
- IA32_DESCRIPTOR X64Idtr;
- UINTN Ia32IdtEntryCount;
- UINTN Index;
- IA32_IDT_ENTRY *Ia32IdtEntry;
-
- //
- // Save x64 IDT Descriptor
- //
- AsmReadIdtr ((IA32_DESCRIPTOR *) &X64Idtr);
-
- //
- // Get the IA32 IDT Descriptor saved in 16 bytes in front of X64 IDT table.
- //
- Ia32Idtr = (IA32_DESCRIPTOR *) (UINTN) (X64Idtr.Base - 16);
- Ia32IdtEntryCount = (Ia32Idtr->Limit + 1) / sizeof (IA32_IDT_ENTRY);
-
- Ia32IdtEntry = (IA32_IDT_ENTRY *)(Ia32Idtr->Base);
- for (Index = 0; Index < Ia32IdtEntryCount; Index ++ ) {
- //
- // Use the new Code Selector value
- //
- Ia32IdtEntry[Index].Bits.Selector = COMPATIBILITY_MODE_SELECTOR;
- }
-
- //
- // Setup IA32 IDT table for 32-bit framework Boot Script code
- //
- AsmWriteIdtr (Ia32Idtr);
-
- ASSERT (Function != 0);
-
- Status = AsmExecute32BitCode (
- Function,
- Param1,
- Param2,
- &mGdt
- );
-
- //
- // Restore X64 IDT table
- //
- AsmWriteIdtr ((IA32_DESCRIPTOR *) &X64Idtr);
-
- return Status;
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptThunkHelper/BootScriptThunkHelper.c b/EdkCompatibilityPkg/Compatibility/BootScriptThunkHelper/BootScriptThunkHelper.c
deleted file mode 100644
index 5141df8675..0000000000
--- a/EdkCompatibilityPkg/Compatibility/BootScriptThunkHelper/BootScriptThunkHelper.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/** @file
- Boot Script Helper SMM driver.
-
- This driver is responsible to store BootScriptThunk from ReservedMemory to SMRAM for security consideration.
-
-Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
-
-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.
-
-**/
-
-#include <PiDxe.h>
-#include <Library/BaseLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DebugLib.h>
-#include <Library/LockBoxLib.h>
-
-#include <Guid/BootScriptThunkData.h>
-
-EFI_GUID mBootScriptThunkGuid = {
- 0xa053f561, 0xf56b, 0x4140, {0x89, 0x1, 0xb4, 0xcb, 0x5d, 0x70, 0x92, 0x9e}
-};
-
-/**
- Entry point function of the Boot Script Thunk Helper SMM driver.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @retval other Some error occurs when executing this entry point.
-**/
-EFI_STATUS
-EFIAPI
-BootScriptThunkHelperMain (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- BOOT_SCRIPT_THUNK_DATA *BootScriptThunkData;
- EFI_STATUS Status;
-
- //
- // Get BootScriptThunk variable
- //
- BootScriptThunkData = (BOOT_SCRIPT_THUNK_DATA *)(UINTN)PcdGet64(BootScriptThunkDataPtr);
- ASSERT (BootScriptThunkData != NULL);
- if (BootScriptThunkData == NULL) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Save BootScriptThunk image
- //
- Status = SaveLockBox (
- &mBootScriptThunkGuid,
- (VOID *)(UINTN)BootScriptThunkData->BootScriptThunkBase,
- (UINTN)BootScriptThunkData->BootScriptThunkLength
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = SetLockBoxAttributes (&mBootScriptThunkGuid, LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE);
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptThunkHelper/BootScriptThunkHelper.inf b/EdkCompatibilityPkg/Compatibility/BootScriptThunkHelper/BootScriptThunkHelper.inf
deleted file mode 100644
index f068d6fdb7..0000000000
--- a/EdkCompatibilityPkg/Compatibility/BootScriptThunkHelper/BootScriptThunkHelper.inf
+++ /dev/null
@@ -1,52 +0,0 @@
-## @file
-# Component description file for Boot Script Thunk Helper SMM driver.
-#
-# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = BootScriptThunkHelper
- FILE_GUID = E633E57C-BBB1-4c6a-9F45-22C49378ADD0
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- PI_SPECIFICATION_VERSION = 0x0001000A
- ENTRY_POINT = BootScriptThunkHelperMain
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- BootScriptThunkHelper.c
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- MdeModulePkg/MdeModulePkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- BaseLib
- DebugLib
- PcdLib
- LockBoxLib
-
-[Pcd]
- gEfiEdkCompatibilityPkgTokenSpaceGuid.BootScriptThunkDataPtr
-
-[Depex]
- gEfiS3SaveStateProtocolGuid AND gEfiBootScriptSaveProtocolGuid AND gEfiLockBoxProtocolGuid
diff --git a/EdkCompatibilityPkg/Compatibility/CpuIo2OnCpuIoThunk/CpuIo2OnCpuIoThunk.c b/EdkCompatibilityPkg/Compatibility/CpuIo2OnCpuIoThunk/CpuIo2OnCpuIoThunk.c
deleted file mode 100644
index ee9cf607d0..0000000000
--- a/EdkCompatibilityPkg/Compatibility/CpuIo2OnCpuIoThunk/CpuIo2OnCpuIoThunk.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/** @file
- Implementation of CPU I/O 2 Protocol based on Framework CPU I/O Protocol.
-
- Intel's Framework CPU I/O Protocol is replaced by CPU I/O 2 Protocol in PI.
- This module produces PI CPU I/O 2 Protocol on top of Framework CPU I/O Protocol.
-
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "CpuIo2OnCpuIoThunk.h"
-
-EFI_HANDLE mCpuIo2Handle = NULL;
-EFI_CPU_IO_PROTOCOL *mCpuIo;
-EFI_CPU_IO2_PROTOCOL mCpuIo2 = {
- {
- CpuMemoryServiceRead,
- CpuMemoryServiceWrite
- },
- {
- CpuIoServiceRead,
- CpuIoServiceWrite
- }
-};
-
-/**
- Enables a driver to read memory-mapped registers in the PI System memory space.
-
- @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.
- @param[in] Width Signifies the width of the memory operation.
- @param[in] Address The base address of the memory operation.
- @param[in] Count The number of memory operations to perform. The number of bytes moved
- is Width size * Count, starting at Address.
- @param[in, out] Buffer The destination buffer to store the results.
-
- @retval EFI_SUCCESS The data was read from or written to the EFI system.
- @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL.
- @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
- Or,The address range specified by Address, Width, and Count is not valid for this EFI system.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuMemoryServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- return mCpuIo->Mem.Read (
- mCpuIo,
- Width,
- Address,
- Count,
- Buffer
- );
-}
-
-/**
- Enables a driver to write memory-mapped registers in the PI System memory space.
-
- @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.
- @param[in] Width Signifies the width of the memory operation.
- @param[in] Address The base address of the memory operation.
- @param[in] Count The number of memory operations to perform. The number of bytes moved
- is Width size * Count, starting at Address.
- @param[in, out] Buffer The source buffer from which to write data.
-
- @retval EFI_SUCCESS The data was read from or written to the EFI system.
- @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL.
- @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
- Or,The address range specified by Address, Width, and Count is not valid for this EFI system.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuMemoryServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- return mCpuIo->Mem.Write (
- mCpuIo,
- Width,
- Address,
- Count,
- Buffer
- );
-}
-
-/**
- Enables a driver to read registers in the PI CPU I/O space.
-
- @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.
- @param[in] Width Signifies the width of the I/O operation.
- @param[in] Address The base address of the I/O operation. The caller is responsible
- for aligning the Address if required.
- @param[in] Count The number of I/O operations to perform. The number of bytes moved
- is Width size * Count, starting at Address.
- @param[in, out] Buffer The destination buffer to store the results.
-
- @retval EFI_SUCCESS The data was read from or written to the EFI system.
- @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL.
- @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
- Or,The address range specified by Address, Width, and Count is not valid for this EFI system.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuIoServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- return mCpuIo->Io.Read (
- mCpuIo,
- Width,
- Address,
- Count,
- Buffer
- );
-}
-
-/**
- Enables a driver to write registers in the PI CPU I/O space.
-
- @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.
- @param[in] Width Signifies the width of the I/O operation.
- @param[in] Address The base address of the I/O operation. The caller is responsible
- for aligning the Address if required.
- @param[in] Count The number of I/O operations to perform. The number of bytes moved
- is Width size * Count, starting at Address.
- @param[in, out] Buffer The source buffer from which to write data.
-
- @retval EFI_SUCCESS The data was read from or written to the EFI system.
- @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL.
- @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
- Or,The address range specified by Address, Width, and Count is not valid for this EFI system.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuIoServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- return mCpuIo->Io.Write (
- mCpuIo,
- Width,
- Address,
- Count,
- Buffer
- );
-}
-
-/**
- Entrypoint of CPU I/O 2 DXE thunk module.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuIo2OnCpuIoThunkInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- //
- // Locate and cache Framework CPU I/O Protocol.
- //
- Status = gBS->LocateProtocol (
- &gEfiCpuIoProtocolGuid,
- NULL,
- (VOID **) &mCpuIo
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Install the CPU I/O 2 Protocol on a new handle.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mCpuIo2Handle,
- &gEfiCpuIo2ProtocolGuid, &mCpuIo2,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/CpuIo2OnCpuIoThunk/CpuIo2OnCpuIoThunk.h b/EdkCompatibilityPkg/Compatibility/CpuIo2OnCpuIoThunk/CpuIo2OnCpuIoThunk.h
deleted file mode 100644
index 1fcdc390b3..0000000000
--- a/EdkCompatibilityPkg/Compatibility/CpuIo2OnCpuIoThunk/CpuIo2OnCpuIoThunk.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/** @file
- Internal include file for the CPU I/O 2 Protocol thunk driver.
-
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#ifndef __CPU_IO2_ON_CPU_IO_H__
-#define __CPU_IO2_ON_CPU_IO_H__
-
-#include <Protocol/CpuIo2.h>
-#include <Protocol/CpuIo.h>
-
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-/**
- Enables a driver to read memory-mapped registers in the PI System memory space.
-
- @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.
- @param[in] Width Signifies the width of the memory operation.
- @param[in] Address The base address of the memory operation.
- @param[in] Count The number of memory operations to perform. The number of bytes moved
- is Width size * Count, starting at Address.
- @param[in, out] Buffer The destination buffer to store the results.
-
- @retval EFI_SUCCESS The data was read from or written to the EFI system.
- @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL.
- @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
- Or,The address range specified by Address, Width, and Count is not valid for this EFI system.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuMemoryServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-/**
- Enables a driver to write memory-mapped registers in the PI System memory space.
-
- @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.
- @param[in] Width Signifies the width of the memory operation.
- @param[in] Address The base address of the memory operation.
- @param[in] Count The number of memory operations to perform. The number of bytes moved
- is Width size * Count, starting at Address.
- @param[in, out] Buffer The source buffer from which to write data.
-
- @retval EFI_SUCCESS The data was read from or written to the EFI system.
- @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL.
- @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
- Or,The address range specified by Address, Width, and Count is not valid for this EFI system.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuMemoryServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-/**
- Enables a driver to read registers in the PI CPU I/O space.
-
- @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.
- @param[in] Width Signifies the width of the I/O operation.
- @param[in] Address The base address of the I/O operation. The caller is responsible
- for aligning the Address if required.
- @param[in] Count The number of I/O operations to perform. The number of bytes moved
- is Width size * Count, starting at Address.
- @param[in, out] Buffer The destination buffer to store the results.
-
- @retval EFI_SUCCESS The data was read from or written to the EFI system.
- @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL.
- @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
- Or,The address range specified by Address, Width, and Count is not valid for this EFI system.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuIoServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-/**
- Enables a driver to write registers in the PI CPU I/O space.
-
- @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.
- @param[in] Width Signifies the width of the I/O operation.
- @param[in] Address The base address of the I/O operation. The caller is responsible
- for aligning the Address if required.
- @param[in] Count The number of I/O operations to perform. The number of bytes moved
- is Width size * Count, starting at Address.
- @param[in, out] Buffer The source buffer from which to write data.
-
- @retval EFI_SUCCESS The data was read from or written to the EFI system.
- @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL.
- @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
- Or,The address range specified by Address, Width, and Count is not valid for this EFI system.
-
-**/
-EFI_STATUS
-EFIAPI
-CpuIoServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/CpuIo2OnCpuIoThunk/CpuIo2OnCpuIoThunk.inf b/EdkCompatibilityPkg/Compatibility/CpuIo2OnCpuIoThunk/CpuIo2OnCpuIoThunk.inf
deleted file mode 100644
index 63407f6a62..0000000000
--- a/EdkCompatibilityPkg/Compatibility/CpuIo2OnCpuIoThunk/CpuIo2OnCpuIoThunk.inf
+++ /dev/null
@@ -1,53 +0,0 @@
-## @file
-# Implementation of CPU I/O 2 Protocol based on Framework CPU I/O Protocol.
-#
-# Intel's Framework CPU I/O Protocol is replaced by CPU I/O 2 Protocol in PI.
-# This module produces PI CPU I/O 2 Protocol on top of Framework CPU I/O Protocol.
-#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = CpuIo2OnCpuIoThunk
- FILE_GUID = 503E70FE-047A-410B-A55F-4F63C9382C1E
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = CpuIo2OnCpuIoThunkInitialize
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- CpuIo2OnCpuIoThunk.c
- CpuIo2OnCpuIoThunk.h
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- DebugLib
- UefiBootServicesTableLib
-
-[Protocols]
- gEfiCpuIo2ProtocolGuid ## PRODUCES
- gEfiCpuIoProtocolGuid ## CONSUMES
-
-[Depex]
- gEfiCpuIoProtocolGuid
diff --git a/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.c b/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.c
deleted file mode 100644
index da55e12178..0000000000
--- a/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.c
+++ /dev/null
@@ -1,1225 +0,0 @@
-/** @file
-Module produces Device I/O on top of PCI Root Bridge I/O for Segment 0 only.
-This is a valid assumption because many of the EFI 1.02/EFI 1.10 systems that may have provided
-Device I/O were single segment platforms. The goal of the ECP is to provide compatibility with the
-drivers/apps that may have used Device I/O.
-
-Device I/O is on list of deprecated protocols for UEFI 2.0 and later.
-This module module layers Device I/O on top of PCI Root Bridge I/O (Segment 0)
- Use if:
- There are no EDK modules present that produces Device I/O
- EFI drivers included that consume Device I/O
- Platform required to support EFI drivers that consume Device I/O
- Platform required to support EFI applications that consume Device I/O
-
-Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include <PiDxe.h>
-#include <IndustryStandard/Pci.h>
-#include <Protocol/DeviceIo.h>
-#include <Protocol/PciRootBridgeIo.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DevicePathLib.h>
-
-
-/**
- Perform reading memory mapped I/O space of device.
-
- @param This A pointer to EFI_DEVICE_IO protocol instance.
- @param Width Width of I/O operations.
- @param Address The base address of I/O operations.
- @param Count The number of I/O operations to perform. Bytes
- moves is Width size * Count, starting at Address.
- @param Buffer The destination buffer to store results.
-
- @retval EFI_SUCCESS The data was read from the device.
- @retval EFI_INVALID_PARAMETER Width is invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of
- resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoMemRead (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-
-/**
- Perform writing memory mapped I/O space of device.
-
- @param This A pointer to EFI_DEVICE_IO protocol instance.
- @param Width Width of I/O operations.
- @param Address The base address of I/O operations.
- @param Count The number of I/O operations to perform. Bytes
- moves is Width size * Count, starting at Address.
- @param Buffer The source buffer of data to be written.
-
- @retval EFI_SUCCESS The data was written to the device.
- @retval EFI_INVALID_PARAMETER Width is invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of
- resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoMemWrite (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-/**
- Perform reading I/O space of device.
-
- @param This A pointer to EFI_DEVICE_IO protocol instance.
- @param Width Width of I/O operations.
- @param Address The base address of I/O operations.
- @param Count The number of I/O operations to perform. Bytes
- moves is Width size * Count, starting at Address.
- @param Buffer The destination buffer to store results.
-
- @retval EFI_SUCCESS The data was read from the device.
- @retval EFI_INVALID_PARAMETER Width is invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of
- resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoIoRead (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-/**
- Perform writing I/O space of device.
-
- @param This A pointer to EFI_DEVICE_IO protocol instance.
- @param Width Width of I/O operations.
- @param Address The base address of I/O operations.
- @param Count The number of I/O operations to perform. Bytes
- moves is Width size * Count, starting at Address.
- @param Buffer The source buffer of data to be written.
-
- @retval EFI_SUCCESS The data was written to the device.
- @retval EFI_INVALID_PARAMETER Width is invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of
- resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoIoWrite (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-/**
- Perform reading PCI configuration space of device
-
- @param This A pointer to EFI_DEVICE_IO protocol instance.
- @param Width Width of I/O operations.
- @param Address The base address of I/O operations.
- @param Count The number of I/O operations to perform. Bytes
- moves is Width size * Count, starting at Address.
- @param Buffer The destination buffer to store results.
-
- @retval EFI_SUCCESS The data was read from the device.
- @retval EFI_INVALID_PARAMETER Width is invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of
- resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoPciRead (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-/**
- Perform writing PCI configuration space of device.
-
- @param This A pointer to EFI_DEVICE_IO protocol instance.
- @param Width Width of I/O operations.
- @param Address The base address of I/O operations.
- @param Count The number of I/O operations to perform. Bytes
- moves is Width size * Count, starting at Address.
- @param Buffer The source buffer of data to be written.
-
- @retval EFI_SUCCESS The data was written to the device.
- @retval EFI_INVALID_PARAMETER Width is invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of
- resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoPciWrite (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-/**
- Provides an EFI Device Path for a PCI device with the given PCI configuration space address.
-
- @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance.
- @param Address The PCI configuration space address of the device
- whose Device Path is going to be returned.
- @param PciDevicePath A pointer to the pointer for the EFI Device Path
- for PciAddress. Memory for the Device Path is
- allocated from the pool.
-
- @retval EFI_SUCCESS The PciDevicePath returns a pointer to a valid EFI
- Device Path.
- @retval EFI_UNSUPPORTED The PciAddress does not map to a valid EFI Device
- Path.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
- of resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoPciDevicePath (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN UINT64 Address,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **PciDevicePath
- );
-
-/**
- Provides the device-specific addresses needed to access system memory.
-
- @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance.
- @param Operation Indicates if the bus master is going to read or
- write to system memory.
- @param HostAddress The system memory address to map to the device.
- @param NumberOfBytes On input the number of bytes to map. On output the
- number of bytes that were mapped.
- @param DeviceAddress The resulting map address for the bus master
- device to use to access the hosts HostAddress.
- @param Mapping A resulting value to pass to Unmap().
-
- @retval EFI_SUCCESS The range was mapped for the returned
- NumberOfBytes.
- @retval EFI_INVALID_PARAMETER The Operation or HostAddress is undefined.
- @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common
- buffer.
- @retval EFI_DEVICE_ERROR The system hardware could not map the requested
- address.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
- of resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoMap (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_OPERATION_TYPE Operation,
- IN EFI_PHYSICAL_ADDRESS *HostAddress,
- IN OUT UINTN *NumberOfBytes,
- OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
- OUT VOID **Mapping
- );
-
-/**
- Completes the Map() operation and releases any corresponding resources.
-
- @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance.
- @param Mapping The mapping value returned from Map().
-
- @retval EFI_SUCCESS The range was unmapped.
- @retval EFI_DEVICE_ERROR The data was not committed to the target system
- memory.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoUnmap (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN VOID *Mapping
- );
-
-/**
- Allocates pages that are suitable for an EFIBusMasterCommonBuffer mapping.
-
- @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance.
- @param Type The type allocation to perform.
- @param MemoryType The type of memory to allocate,
- EfiBootServicesData or EfiRuntimeServicesData.
- @param Pages The number of pages to allocate.
- @param PhysicalAddress A pointer to store the base address of the
- allocated range.
-
- @retval EFI_SUCCESS The requested memory pages were allocated.
- @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
- @retval EFI_INVALID_PARAMETER The requested memory type is invalid.
- @retval EFI_UNSUPPORTED The requested PhysicalAddress is not supported on
- this platform.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoAllocateBuffer (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- IN OUT EFI_PHYSICAL_ADDRESS *PhysicalAddress
- );
-
-/**
- Flushes any posted write data to the device.
-
- @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance.
-
- @retval EFI_SUCCESS The buffers were flushed.
- @retval EFI_DEVICE_ERROR The buffers were not flushed due to a hardware
- error.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoFlush (
- IN EFI_DEVICE_IO_PROTOCOL *This
- );
-
-/**
- Frees pages that were allocated with AllocateBuffer().
-
- @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance.
- @param Pages The number of pages to free.
- @param HostAddress The base address of the range to free.
-
- @retval EFI_SUCCESS The requested memory pages were freed.
- @retval EFI_NOT_FOUND The requested memory pages were not allocated with
- AllocateBuffer().
- @retval EFI_INVALID_PARAMETER HostAddress is not page aligned or Pages is
- invalid.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoFreeBuffer (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN UINTN Pages,
- IN EFI_PHYSICAL_ADDRESS HostAddress
- );
-
-
-#define DEVICE_IO_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('D', 'e', 'I', 'O')
-
-typedef struct {
- UINTN Signature;
- EFI_DEVICE_IO_PROTOCOL DeviceIo;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UINT16 PrimaryBus;
- UINT16 SubordinateBus;
-} DEVICE_IO_PRIVATE_DATA;
-
-#define DEVICE_IO_PRIVATE_DATA_FROM_THIS(a) CR (a, DEVICE_IO_PRIVATE_DATA, DeviceIo, DEVICE_IO_PRIVATE_DATA_SIGNATURE)
-
-#define MAX_COMMON_BUFFER 0x00000000FFFFFFFF
-
-
-EFI_EVENT mPciRootBridgeIoRegistration;
-
-//
-// Device Io Volume Protocol template
-//
-DEVICE_IO_PRIVATE_DATA gDeviceIoPrivateDataTemplate = {
- DEVICE_IO_PRIVATE_DATA_SIGNATURE,
- {
- {
- DeviceIoMemRead,
- DeviceIoMemWrite
- },
- {
- DeviceIoIoRead,
- DeviceIoIoWrite
- },
- {
- DeviceIoPciRead,
- DeviceIoPciWrite,
- },
- DeviceIoMap,
- DeviceIoPciDevicePath,
- DeviceIoUnmap,
- DeviceIoAllocateBuffer,
- DeviceIoFlush,
- DeviceIoFreeBuffer
- },
- NULL, // PciRootBridgeIo
- NULL, // DevicePath
- 0, // PrimaryBus
- 255 // SubordinateBus
-};
-
-/**
- This notification function is invoked when an instance of the
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL is produced. It installs another instance of the
- EFI_DEVICE_IO_PROTOCOL on the same handle.
-
- @param Event The event that occured
- @param Context Context of event. Not used in this nofication function.
-
-**/
-VOID
-EFIAPI
-PciRootBridgeIoNotificationEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HANDLE Handle;
- DEVICE_IO_PRIVATE_DATA *Private;
- EFI_DEVICE_IO_PROTOCOL *DeviceIo;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
-
- while (TRUE) {
- BufferSize = sizeof (Handle);
- Status = gBS->LocateHandle (
- ByRegisterNotify,
- &gEfiPciRootBridgeIoProtocolGuid,
- mPciRootBridgeIoRegistration,
- &BufferSize,
- &Handle
- );
- if (EFI_ERROR (Status)) {
- //
- // Exit Path of While Loop....
- //
- break;
- }
-
- //
- // Skip this handle if the Device Io Protocol is already installed
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiDeviceIoProtocolGuid,
- (VOID **)&DeviceIo
- );
- if (!EFI_ERROR (Status)) {
- continue;
- }
-
- //
- // Retrieve the Pci Root Bridge IO Protocol
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiPciRootBridgeIoProtocolGuid,
- (VOID **)&PciRootBridgeIo
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // We only install Device IO for PCI bus in Segment 0.
- // See the file description at @file for details.
- //
- if (PciRootBridgeIo->SegmentNumber != 0) {
- continue;
- }
-
- //
- // Allocate private data structure
- //
- Private = AllocateCopyPool (sizeof (DEVICE_IO_PRIVATE_DATA), &gDeviceIoPrivateDataTemplate);
- if (Private == NULL) {
- continue;
- }
-
- Private->PciRootBridgeIo = PciRootBridgeIo;
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &Private->DevicePath
- );
-
- //
- // Install Device Io onto same handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiDeviceIoProtocolGuid,
- &Private->DeviceIo,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- }
-}
-
-/**
- The user Entry Point for DXE driver. The user code starts with this function
- as the real entry point for the image goes into a library that calls this
- function.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @retval other Some error occurs when executing this entry point.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeDeviceIo (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EfiCreateProtocolNotifyEvent (
- &gEfiPciRootBridgeIoProtocolGuid,
- TPL_CALLBACK,
- PciRootBridgeIoNotificationEvent,
- NULL,
- &mPciRootBridgeIoRegistration
- );
- return EFI_SUCCESS;
-}
-
-
-/**
- Perform reading memory mapped I/O space of device.
-
- @param This A pointer to EFI_DEVICE_IO protocol instance.
- @param Width Width of I/O operations.
- @param Address The base address of I/O operations.
- @param Count The number of I/O operations to perform. Bytes
- moves is Width size * Count, starting at Address.
- @param Buffer The destination buffer to store results.
-
- @retval EFI_SUCCESS The data was read from the device.
- @retval EFI_INVALID_PARAMETER Width is invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of
- resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoMemRead (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- DEVICE_IO_PRIVATE_DATA *Private;
-
- Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if (Width > MMIO_COPY_UINT64) {
- return EFI_INVALID_PARAMETER;
- }
- if (Width >= MMIO_COPY_UINT8) {
- Width = (EFI_IO_WIDTH) (Width - MMIO_COPY_UINT8);
- Status = Private->PciRootBridgeIo->CopyMem (
- Private->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- (UINT64) (UINTN) Buffer,
- Address,
- Count
- );
- } else {
- Status = Private->PciRootBridgeIo->Mem.Read (
- Private->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Address,
- Count,
- Buffer
- );
- }
-
- return Status;
-}
-
-
-
-
-/**
- Perform writing memory mapped I/O space of device.
-
- @param This A pointer to EFI_DEVICE_IO protocol instance.
- @param Width Width of I/O operations.
- @param Address The base address of I/O operations.
- @param Count The number of I/O operations to perform. Bytes
- moves is Width size * Count, starting at Address.
- @param Buffer The source buffer of data to be written.
-
- @retval EFI_SUCCESS The data was written to the device.
- @retval EFI_INVALID_PARAMETER Width is invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of
- resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoMemWrite (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- DEVICE_IO_PRIVATE_DATA *Private;
-
- Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if (Width > MMIO_COPY_UINT64) {
- return EFI_INVALID_PARAMETER;
- }
- if (Width >= MMIO_COPY_UINT8) {
- Width = (EFI_IO_WIDTH) (Width - MMIO_COPY_UINT8);
- Status = Private->PciRootBridgeIo->CopyMem (
- Private->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Address,
- (UINT64) (UINTN) Buffer,
- Count
- );
- } else {
- Status = Private->PciRootBridgeIo->Mem.Write (
- Private->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Address,
- Count,
- Buffer
- );
- }
-
- return Status;
-}
-
-
-/**
- Perform reading I/O space of device.
-
- @param This A pointer to EFI_DEVICE_IO protocol instance.
- @param Width Width of I/O operations.
- @param Address The base address of I/O operations.
- @param Count The number of I/O operations to perform. Bytes
- moves is Width size * Count, starting at Address.
- @param Buffer The destination buffer to store results.
-
- @retval EFI_SUCCESS The data was read from the device.
- @retval EFI_INVALID_PARAMETER Width is invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of
- resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoIoRead (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- DEVICE_IO_PRIVATE_DATA *Private;
-
- Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if (Width >= MMIO_COPY_UINT8) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = Private->PciRootBridgeIo->Io.Read (
- Private->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Address,
- Count,
- Buffer
- );
-
- return Status;
-}
-
-
-/**
- Perform writing I/O space of device.
-
- @param This A pointer to EFI_DEVICE_IO protocol instance.
- @param Width Width of I/O operations.
- @param Address The base address of I/O operations.
- @param Count The number of I/O operations to perform. Bytes
- moves is Width size * Count, starting at Address.
- @param Buffer The source buffer of data to be written.
-
- @retval EFI_SUCCESS The data was written to the device.
- @retval EFI_INVALID_PARAMETER Width is invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of
- resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoIoWrite (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- DEVICE_IO_PRIVATE_DATA *Private;
-
- Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if (Width >= MMIO_COPY_UINT8) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = Private->PciRootBridgeIo->Io.Write (
- Private->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Address,
- Count,
- Buffer
- );
-
- return Status;
-}
-
-
-/**
- Perform reading PCI configuration space of device
-
- @param This A pointer to EFI_DEVICE_IO protocol instance.
- @param Width Width of I/O operations.
- @param Address The base address of I/O operations.
- @param Count The number of I/O operations to perform. Bytes
- moves is Width size * Count, starting at Address.
- @param Buffer The destination buffer to store results.
-
- @retval EFI_SUCCESS The data was read from the device.
- @retval EFI_INVALID_PARAMETER Width is invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of
- resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoPciRead (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- DEVICE_IO_PRIVATE_DATA *Private;
-
- Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if ((UINT32)Width >= MMIO_COPY_UINT8) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = Private->PciRootBridgeIo->Pci.Read (
- Private->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Address,
- Count,
- Buffer
- );
-
- return Status;
-}
-
-
-/**
- Perform writing PCI configuration space of device.
-
- @param This A pointer to EFI_DEVICE_IO protocol instance.
- @param Width Width of I/O operations.
- @param Address The base address of I/O operations.
- @param Count The number of I/O operations to perform. Bytes
- moves is Width size * Count, starting at Address.
- @param Buffer The source buffer of data to be written.
-
- @retval EFI_SUCCESS The data was written to the device.
- @retval EFI_INVALID_PARAMETER Width is invalid.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of
- resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoPciWrite (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- DEVICE_IO_PRIVATE_DATA *Private;
-
- Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if ((UINT32)Width >= MMIO_COPY_UINT8) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = Private->PciRootBridgeIo->Pci.Write (
- Private->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Address,
- Count,
- Buffer
- );
-
- return Status;
-}
-
-
-/**
- Append a PCI device path node to another device path.
-
- @param Private A pointer to DEVICE_IO_PRIVATE_DATA instance.
- @param Bus PCI bus number of the device.
- @param Device PCI device number of the device.
- @param Function PCI function number of the device.
- @param DevicePath Original device path which will be appended a PCI
- device path node.
- @param BridgePrimaryBus Primary bus number of the bridge.
- @param BridgeSubordinateBus Subordinate bus number of the bridge.
-
- @return Pointer to the appended PCI device path.
-
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-AppendPciDevicePath (
- IN DEVICE_IO_PRIVATE_DATA *Private,
- IN UINT8 Bus,
- IN UINT8 Device,
- IN UINT8 Function,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN OUT UINT16 *BridgePrimaryBus,
- IN OUT UINT16 *BridgeSubordinateBus
- )
-{
- UINT16 ThisBus;
- UINT8 ThisDevice;
- UINT8 ThisFunc;
- UINT64 Address;
- PCI_TYPE01 PciBridge;
- PCI_TYPE01 *PciPtr;
- EFI_DEVICE_PATH_PROTOCOL *ReturnDevicePath;
- PCI_DEVICE_PATH PciNode;
-
- PciPtr = &PciBridge;
- for (ThisBus = *BridgePrimaryBus; ThisBus <= *BridgeSubordinateBus; ThisBus++) {
- for (ThisDevice = 0; ThisDevice <= PCI_MAX_DEVICE; ThisDevice++) {
- for (ThisFunc = 0; ThisFunc <= PCI_MAX_FUNC; ThisFunc++) {
- Address = EFI_PCI_ADDRESS (ThisBus, ThisDevice, ThisFunc, 0);
- ZeroMem (PciPtr, sizeof (PCI_TYPE01));
- Private->DeviceIo.Pci.Read (
- &Private->DeviceIo,
- IO_UINT32,
- Address,
- 1,
- &(PciPtr->Hdr.VendorId)
- );
- if ((PciPtr->Hdr.VendorId == 0xffff) && (ThisFunc == 0)) {
- break;
- }
- if (PciPtr->Hdr.VendorId == 0xffff) {
- continue;
- } else {
- Private->DeviceIo.Pci.Read (
- &Private->DeviceIo,
- IO_UINT32,
- Address,
- sizeof (PCI_TYPE01) / sizeof (UINT32),
- PciPtr
- );
- if (IS_PCI_BRIDGE (PciPtr)) {
- if (Bus >= PciPtr->Bridge.SecondaryBus && Bus <= PciPtr->Bridge.SubordinateBus) {
-
- PciNode.Header.Type = HARDWARE_DEVICE_PATH;
- PciNode.Header.SubType = HW_PCI_DP;
- SetDevicePathNodeLength (&PciNode.Header, sizeof (PciNode));
-
- PciNode.Device = ThisDevice;
- PciNode.Function = ThisFunc;
- ReturnDevicePath = AppendDevicePathNode (DevicePath, &PciNode.Header);
-
- *BridgePrimaryBus = PciPtr->Bridge.SecondaryBus;
- *BridgeSubordinateBus = PciPtr->Bridge.SubordinateBus;
- return ReturnDevicePath;
- }
- }
- if (ThisFunc == 0 && ((PciPtr->Hdr.HeaderType & HEADER_TYPE_MULTI_FUNCTION) != HEADER_TYPE_MULTI_FUNCTION)) {
- //
- // Skip sub functions, this is not a multi function device
- //
- ThisFunc = 8;
- }
- }
- }
- }
- }
-
- ZeroMem (&PciNode, sizeof (PciNode));
- PciNode.Header.Type = HARDWARE_DEVICE_PATH;
- PciNode.Header.SubType = HW_PCI_DP;
- SetDevicePathNodeLength (&PciNode.Header, sizeof (PciNode));
- PciNode.Device = Device;
- PciNode.Function = Function;
-
- ReturnDevicePath = AppendDevicePathNode (DevicePath, &PciNode.Header);
-
- *BridgePrimaryBus = 0xffff;
- *BridgeSubordinateBus = 0xffff;
- return ReturnDevicePath;
-}
-
-
-/**
- Provides an EFI Device Path for a PCI device with the given PCI configuration space address.
-
- @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance.
- @param Address The PCI configuration space address of the device
- whose Device Path is going to be returned.
- @param PciDevicePath A pointer to the pointer for the EFI Device Path
- for PciAddress. Memory for the Device Path is
- allocated from the pool.
-
- @retval EFI_SUCCESS The PciDevicePath returns a pointer to a valid EFI
- Device Path.
- @retval EFI_UNSUPPORTED The PciAddress does not map to a valid EFI Device
- Path.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
- of resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoPciDevicePath (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN UINT64 Address,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **PciDevicePath
- )
-{
- DEVICE_IO_PRIVATE_DATA *Private;
- UINT16 PrimaryBus;
- UINT16 SubordinateBus;
- UINT8 Bus;
- UINT8 Device;
- UINT8 Func;
-
- Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
-
- Bus = (UINT8) (((UINT32) Address >> 24) & 0xff);
- Device = (UINT8) (((UINT32) Address >> 16) & 0xff);
- Func = (UINT8) (((UINT32) Address >> 8) & 0xff);
-
- if (Bus < Private->PrimaryBus || Bus > Private->SubordinateBus) {
- return EFI_UNSUPPORTED;
- }
-
- *PciDevicePath = Private->DevicePath;
- PrimaryBus = Private->PrimaryBus;
- SubordinateBus = Private->SubordinateBus;
- do {
- *PciDevicePath = AppendPciDevicePath (
- Private,
- Bus,
- Device,
- Func,
- *PciDevicePath,
- &PrimaryBus,
- &SubordinateBus
- );
- if (*PciDevicePath == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- } while (PrimaryBus != 0xffff);
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Provides the device-specific addresses needed to access system memory.
-
- @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance.
- @param Operation Indicates if the bus master is going to read or
- write to system memory.
- @param HostAddress The system memory address to map to the device.
- @param NumberOfBytes On input the number of bytes to map. On output the
- number of bytes that were mapped.
- @param DeviceAddress The resulting map address for the bus master
- device to use to access the hosts HostAddress.
- @param Mapping A resulting value to pass to Unmap().
-
- @retval EFI_SUCCESS The range was mapped for the returned
- NumberOfBytes.
- @retval EFI_INVALID_PARAMETER The Operation or HostAddress is undefined.
- @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common
- buffer.
- @retval EFI_DEVICE_ERROR The system hardware could not map the requested
- address.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
- of resources.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoMap (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_IO_OPERATION_TYPE Operation,
- IN EFI_PHYSICAL_ADDRESS *HostAddress,
- IN OUT UINTN *NumberOfBytes,
- OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
- OUT VOID **Mapping
- )
-{
- EFI_STATUS Status;
- DEVICE_IO_PRIVATE_DATA *Private;
-
- Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if ((UINT32)Operation > EfiBusMasterCommonBuffer) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (((UINTN) (*HostAddress) != (*HostAddress)) && Operation == EfiBusMasterCommonBuffer) {
- return EFI_UNSUPPORTED;
- }
-
- Status = Private->PciRootBridgeIo->Map (
- Private->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION) Operation,
- (VOID *) (UINTN) (*HostAddress),
- NumberOfBytes,
- DeviceAddress,
- Mapping
- );
-
- return Status;
-}
-
-
-/**
- Completes the Map() operation and releases any corresponding resources.
-
- @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance.
- @param Mapping The mapping value returned from Map().
-
- @retval EFI_SUCCESS The range was unmapped.
- @retval EFI_DEVICE_ERROR The data was not committed to the target system
- memory.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoUnmap (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN VOID *Mapping
- )
-{
- EFI_STATUS Status;
- DEVICE_IO_PRIVATE_DATA *Private;
-
- Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
-
- Status = Private->PciRootBridgeIo->Unmap (
- Private->PciRootBridgeIo,
- Mapping
- );
-
- return Status;
-}
-
-
-/**
- Allocates pages that are suitable for an EFIBusMasterCommonBuffer mapping.
-
- @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance.
- @param Type The type allocation to perform.
- @param MemoryType The type of memory to allocate,
- EfiBootServicesData or EfiRuntimeServicesData.
- @param Pages The number of pages to allocate.
- @param PhysicalAddress A pointer to store the base address of the
- allocated range.
-
- @retval EFI_SUCCESS The requested memory pages were allocated.
- @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
- @retval EFI_INVALID_PARAMETER The requested memory type is invalid.
- @retval EFI_UNSUPPORTED The requested PhysicalAddress is not supported on
- this platform.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoAllocateBuffer (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- IN OUT EFI_PHYSICAL_ADDRESS *PhysicalAddress
- )
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS HostAddress;
- DEVICE_IO_PRIVATE_DATA *Private;
- VOID *HostAddress2;
-
- Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
-
- HostAddress = *PhysicalAddress;
-
- if ((MemoryType != EfiBootServicesData) && (MemoryType != EfiRuntimeServicesData)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((UINT32)Type >= MaxAllocateType) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((Type == AllocateAddress) && (HostAddress + EFI_PAGES_TO_SIZE (Pages) - 1 > MAX_COMMON_BUFFER)) {
- return EFI_UNSUPPORTED;
- }
-
- if ((AllocateAnyPages == Type) || (AllocateMaxAddress == Type && HostAddress > MAX_COMMON_BUFFER)) {
- Type = AllocateMaxAddress;
- HostAddress = MAX_COMMON_BUFFER;
- }
-
- HostAddress2 = (VOID *) (UINTN) (HostAddress);
- Status = Private->PciRootBridgeIo->AllocateBuffer (
- Private->PciRootBridgeIo,
- Type,
- MemoryType,
- Pages,
- &HostAddress2,
- EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE |
- EFI_PCI_ATTRIBUTE_MEMORY_CACHED
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
-
- *PhysicalAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress2;
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Flushes any posted write data to the device.
-
- @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance.
-
- @retval EFI_SUCCESS The buffers were flushed.
- @retval EFI_DEVICE_ERROR The buffers were not flushed due to a hardware
- error.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoFlush (
- IN EFI_DEVICE_IO_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- DEVICE_IO_PRIVATE_DATA *Private;
-
- Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
-
- Status = Private->PciRootBridgeIo->Flush (Private->PciRootBridgeIo);
-
- return Status;
-}
-
-
-/**
- Frees pages that were allocated with AllocateBuffer().
-
- @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance.
- @param Pages The number of pages to free.
- @param HostAddress The base address of the range to free.
-
- @retval EFI_SUCCESS The requested memory pages were freed.
- @retval EFI_NOT_FOUND The requested memory pages were not allocated with
- AllocateBuffer().
- @retval EFI_INVALID_PARAMETER HostAddress is not page aligned or Pages is
- invalid.
-
-**/
-EFI_STATUS
-EFIAPI
-DeviceIoFreeBuffer (
- IN EFI_DEVICE_IO_PROTOCOL *This,
- IN UINTN Pages,
- IN EFI_PHYSICAL_ADDRESS HostAddress
- )
-{
- DEVICE_IO_PRIVATE_DATA *Private;
-
- Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if (((HostAddress & EFI_PAGE_MASK) != 0) || (Pages <= 0)) {
- return EFI_INVALID_PARAMETER;
- }
-
- return Private->PciRootBridgeIo->FreeBuffer (
- Private->PciRootBridgeIo,
- Pages,
- (VOID *) (UINTN) HostAddress
- );
-
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.inf b/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.inf
deleted file mode 100644
index 6faa4a178f..0000000000
--- a/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.inf
+++ /dev/null
@@ -1,59 +0,0 @@
-## @file
-# Module Layer Device I/O on top of PCI Root Bridge I/O (Segment 0)
-#
-# Device I/O is on list of deprecated protocols for UEFI 2.0 and later.
-# This module layers Device I/O on top of PCI Root Bridge I/O (Segment 0)
-# Use if:
-# There are no EDK modules present that produces Device I/O
-# EFI drivers included that consume Device I/O
-# Platform required to support EFI drivers that consume Device I/O
-# Platform required to support EFI applications that consume Device I/O
-#
-# Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DeviceIoOnPciRootBridgeIoThunk
- FILE_GUID = 6E5ED30F-EC52-4136-8A41-3F4324218E41
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeDeviceIo
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- DeviceIoOnPciRootBridgeIoThunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- BaseLib
- DebugLib
- UefiLib
- MemoryAllocationLib
- BaseMemoryLib
- DevicePathLib
-
-[Protocols]
- gEfiDeviceIoProtocolGuid
- gEfiPciRootBridgeIoProtocolGuid
-
-[Depex]
- TRUE
diff --git a/EdkCompatibilityPkg/Compatibility/DxeSmmReadyToLockOnExitPmAuthThunk/DxeSmmReadyToLockOnExitPmAuthThunk.c b/EdkCompatibilityPkg/Compatibility/DxeSmmReadyToLockOnExitPmAuthThunk/DxeSmmReadyToLockOnExitPmAuthThunk.c
deleted file mode 100644
index 51ea68eeed..0000000000
--- a/EdkCompatibilityPkg/Compatibility/DxeSmmReadyToLockOnExitPmAuthThunk/DxeSmmReadyToLockOnExitPmAuthThunk.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/** @file
- DxeSmmReadyToLock Protocol on ExitPmAuth Protocol Thunk driver.
- EDK platform uses ExitPmAuth point to lock SMRAM and SMM API.
- But EDKII uses DxeSmmReadyToLock. We need a thunk driver to convert this event.
-
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
-
-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.
-
-**/
-
-#include "DxeSmmReadyToLockOnExitPmAuthThunk.h"
-
-/**
- ExitPmAuth Protocol notification event handler.
-
- @param[in] Event Event whose notification function is being invoked.
- @param[in] Context Pointer to the notification function's context.
-**/
-VOID
-EFIAPI
-ExitPmAuthProtocolNotification (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE ImageHandle;
- VOID *ExitPmAuth;
-
- //
- // Add more check to locate protocol after got event, because
- // ECP will signal this event immediately once it is register
- // just in case it is already installed.
- //
- Status = gBS->LocateProtocol (
- &gExitPmAuthProtocolGuid,
- NULL,
- &ExitPmAuth
- );
- if (EFI_ERROR (Status)) {
- return ;
- }
-
- //
- // Install DxeSmmReadyToLock protocol to let PI SMM lock
- //
- ImageHandle = NULL;
- Status = gBS->InstallProtocolInterface (
- &ImageHandle,
- &gEfiDxeSmmReadyToLockProtocolGuid,
- EFI_NATIVE_INTERFACE,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-}
-
-/**
- Entry Point for DxeSmmReadyToLock Protocol on ExitPmAuth Protocol Thunk driver.
-
- @param[in] ImageHandle Image handle of this driver.
- @param[in] SystemTable A Pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
-**/
-EFI_STATUS
-EFIAPI
-DxeSmmReadyToLockMain (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- VOID *Registration;
-
- //
- // Install notifications for required protocols
- //
- EfiCreateProtocolNotifyEvent (
- &gExitPmAuthProtocolGuid,
- TPL_CALLBACK,
- ExitPmAuthProtocolNotification,
- NULL,
- &Registration
- );
-
- return EFI_SUCCESS;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/DxeSmmReadyToLockOnExitPmAuthThunk/DxeSmmReadyToLockOnExitPmAuthThunk.h b/EdkCompatibilityPkg/Compatibility/DxeSmmReadyToLockOnExitPmAuthThunk/DxeSmmReadyToLockOnExitPmAuthThunk.h
deleted file mode 100644
index 00f6f6dc85..0000000000
--- a/EdkCompatibilityPkg/Compatibility/DxeSmmReadyToLockOnExitPmAuthThunk/DxeSmmReadyToLockOnExitPmAuthThunk.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/** @file
- Include file for DxeSmmReadyToLock Protocol on ExitPmAuth Protocol Thunk driver.
-
-Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
-
-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.
-
-**/
-
-#ifndef _DXE_SMM_READY_TO_LOCK_ON_EXIT_PMAUTH_THUNK_H_
-#define _DXE_SMM_READY_TO_LOCK_ON_EXIT_PMAUTH_THUNK_H_
-
-#include <PiDxe.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Protocol/DxeSmmReadyToLock.h>
-#include <Protocol/ExitPmAuth.h>
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/DxeSmmReadyToLockOnExitPmAuthThunk/DxeSmmReadyToLockOnExitPmAuthThunk.inf b/EdkCompatibilityPkg/Compatibility/DxeSmmReadyToLockOnExitPmAuthThunk/DxeSmmReadyToLockOnExitPmAuthThunk.inf
deleted file mode 100644
index fddda408bd..0000000000
--- a/EdkCompatibilityPkg/Compatibility/DxeSmmReadyToLockOnExitPmAuthThunk/DxeSmmReadyToLockOnExitPmAuthThunk.inf
+++ /dev/null
@@ -1,52 +0,0 @@
-## @file
-# Component description file for DxeSmmReadyToLock Protocol on
-# ExitPmAuth Protocol Thunk driver.
-#
-# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DxeSmmReadyToLockOnExitPmAuthThunk
- FILE_GUID = 82ECEE48-9571-4427-8485-85A5A45A0F39
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = DxeSmmReadyToLockMain
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- DxeSmmReadyToLockOnExitPmAuthThunk.c
- DxeSmmReadyToLockOnExitPmAuthThunk.h
-
-[Packages]
- MdePkg/MdePkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- DebugLib
- UefiLib
-
-[Protocols]
- gEfiDxeSmmReadyToLockProtocolGuid # PROTOCOL ALWAYS_PRODUCED
- gExitPmAuthProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-
-[Depex]
- TRUE
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c
deleted file mode 100644
index c33a3f0b8e..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c
+++ /dev/null
@@ -1,1248 +0,0 @@
-/** @file
- This file implements functions related to Config Access Protocols installed by
- by HII Thunk Modules. These Config access Protocols are used to thunk UEFI Config
- Access Callback to Framework HII Callback and EFI Variable Set/Get operations.
-
-Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "HiiDatabase.h"
-#include "UefiIfrParser.h"
-
-BOOLEAN mHiiPackageListUpdated = FALSE;
-
-HII_VENDOR_DEVICE_PATH mUefiHiiVendorDevicePath = {
- {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (HII_VENDOR_DEVICE_PATH_NODE)),
- (UINT8) ((sizeof (HII_VENDOR_DEVICE_PATH_NODE)) >> 8)
- }
- },
- EFI_CALLER_ID_GUID
- },
- 0,
- 0
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- (UINT8) (sizeof (EFI_DEVICE_PATH_PROTOCOL)),
- (UINT8) ((sizeof (EFI_DEVICE_PATH_PROTOCOL)) >> 8)
- }
- }
-};
-
-CONFIG_ACCESS_PRIVATE gConfigAccessPrivateTempate = {
- CONFIG_ACCESS_PRIVATE_SIGNATURE,
- {
- ThunkExtractConfig,
- ThunkRouteConfig,
- ThunkCallback
- }, //ConfigAccessProtocol
- NULL, //FormCallbackProtocol
- NULL
-};
-
-/**
- Get the first EFI_IFR_VARSTORE from the FormSet.
-
- @param FormSet The Form Set.
-
- @retval FORMSET_STORAGE * Return the first EFI_IFR_VARSTORE.
- @retval NULL If the Form Set does not have EFI_IFR_VARSTORE.
-**/
-FORMSET_STORAGE *
-GetFirstStorageOfFormSet (
- IN CONST FORM_BROWSER_FORMSET * FormSet
- )
-{
- LIST_ENTRY *StorageList;
- FORMSET_STORAGE *Storage;
-
- StorageList = GetFirstNode (&FormSet->StorageListHead);
-
- while (!IsNull (&FormSet->StorageListHead, StorageList)) {
- Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
- if (Storage->Type == EFI_HII_VARSTORE_BUFFER) {
- return Storage;
- }
- StorageList = GetNextNode (&FormSet->StorageListHead, StorageList);
- }
-
- return NULL;
-}
-
-/**
- Get the FORM_BROWSER_STATEMENT that matches the Question's value.
-
- @param FormSet The Form Set.
- @param QuestionId QuestionId
-
- @retval FORM_BROWSER_STATEMENT* FORM_BROWSER_STATEMENT that match Question's value.
- @retval NULL If the Form Set does not have EFI_IFR_VARSTORE.
-**/
-FORM_BROWSER_STATEMENT *
-GetStorageFromQuestionId (
- IN CONST FORM_BROWSER_FORMSET * FormSet,
- IN EFI_QUESTION_ID QuestionId
- )
-{
- LIST_ENTRY *FormList;
- LIST_ENTRY *StatementList;
- FORM_BROWSER_FORM *Form;
- FORM_BROWSER_STATEMENT *Statement;
-
- FormList = GetFirstNode (&FormSet->FormListHead);
-
- while (!IsNull (&FormSet->FormListHead, FormList)) {
- Form = FORM_BROWSER_FORM_FROM_LINK (FormList);
-
- StatementList = GetFirstNode (&Form->StatementListHead);
-
- while (!IsNull (&Form->StatementListHead, StatementList)) {
- Statement = FORM_BROWSER_STATEMENT_FROM_LINK (StatementList);
- if ((QuestionId == Statement->QuestionId) && (Statement->Storage != NULL)) {
- //
- // UEFI Question ID is unique in a FormSet.
- //
- ASSERT (Statement->Storage->Type == EFI_HII_VARSTORE_BUFFER);
- return Statement;
- }
- StatementList = GetNextNode (&Form->StatementListHead, StatementList);
- }
-
- FormList = GetNextNode (&FormSet->FormListHead, FormList);
- }
-
- return NULL;
-}
-
-/**
- Get the EFI_IFR_VARSTORE based the <ConfigHdr> string in a <ConfigRequest>
- or a <ConfigResp> string.
-
- @param FormSet The Form Set.
- @param ConfigString The Configuration String which is defined by UEFI HII.
-
- @retval FORMSET_STORAGE * The EFI_IFR_VARSTORE where the Question's value is stored.
- @retval NULL If the Form Set does not have EFI_IFR_VARSTORE with such ID.
-**/
-FORMSET_STORAGE *
-GetStorageFromConfigString (
- IN CONST FORM_BROWSER_FORMSET *FormSet,
- IN CONST EFI_STRING ConfigString
- )
-{
- LIST_ENTRY *StorageList;
- FORMSET_STORAGE *Storage;
- CHAR16 *Name;
-
- if (ConfigString == NULL) {
- return NULL;
- }
-
- StorageList = GetFirstNode (&FormSet->StorageListHead);
-
- while (!IsNull (&FormSet->StorageListHead, StorageList)) {
- Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
- StorageList = GetNextNode (&FormSet->StorageListHead, StorageList);
- if (Storage->Type != EFI_HII_VARSTORE_BUFFER) {
- continue;
- }
-
- if ((Storage->VarStoreId == FormSet->DefaultVarStoreId) && (FormSet->OriginalDefaultVarStoreName != NULL)) {
- Name = FormSet->OriginalDefaultVarStoreName;
- } else {
- Name = Storage->Name;
- }
-
- if (HiiIsConfigHdrMatch (ConfigString, &Storage->Guid, Name)) {
- return Storage;
- }
- }
-
- return NULL;
-}
-
-/**
- This function installs a EFI_CONFIG_ACCESS_PROTOCOL instance for a form package registered
- by a module using Framework HII Protocol Interfaces.
-
- UEFI HII require EFI_HII_CONFIG_ACCESS_PROTOCOL to be installed on a EFI_HANDLE, so
- that Setup Utility can load the Buffer Storage using this protocol.
-
- @param Packages The Package List.
- @param ThunkContext The Thunk Context.
-
- @retval EFI_SUCCESS The Config Access Protocol is installed successfully.
- @retval EFI_OUT_RESOURCE There is not enough memory.
-
-**/
-EFI_STATUS
-InstallDefaultConfigAccessProtocol (
- IN CONST EFI_HII_PACKAGES *Packages,
- IN OUT HII_THUNK_CONTEXT *ThunkContext
- )
-{
- EFI_STATUS Status;
- CONFIG_ACCESS_PRIVATE *ConfigAccessInstance;
- HII_VENDOR_DEVICE_PATH *HiiVendorPath;
-
- ASSERT (ThunkContext->IfrPackageCount != 0);
-
- ConfigAccessInstance = AllocateCopyPool (
- sizeof (CONFIG_ACCESS_PRIVATE),
- &gConfigAccessPrivateTempate
- );
- ASSERT (ConfigAccessInstance != NULL);
-
- //
- // Use memory address as unique ID to distinguish from different device paths
- // This function may be called multi times by the framework HII driver.
- //
- HiiVendorPath = AllocateCopyPool (
- sizeof (HII_VENDOR_DEVICE_PATH),
- &mUefiHiiVendorDevicePath
- );
- ASSERT (HiiVendorPath != NULL);
-
- HiiVendorPath->Node.UniqueId = (UINT64) ((UINTN) HiiVendorPath);
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ThunkContext->UefiHiiDriverHandle,
- &gEfiDevicePathProtocolGuid,
- HiiVendorPath,
- &gEfiHiiConfigAccessProtocolGuid,
- &ConfigAccessInstance->ConfigAccessProtocol,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- ConfigAccessInstance->ThunkContext = ThunkContext;
-
- return EFI_SUCCESS;
-}
-
-/**
- This function un-installs the EFI_CONFIG_ACCESS_PROTOCOL instance for a form package registered
- by a module using Framework HII Protocol Interfaces.
-
- ASSERT if no Config Access is found for such pakcage list or failed to uninstall the protocol.
-
- @param ThunkContext The Thunk Context.
-
-**/
-VOID
-UninstallDefaultConfigAccessProtocol (
- IN HII_THUNK_CONTEXT *ThunkContext
- )
-{
- EFI_STATUS Status;
- EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
- HII_VENDOR_DEVICE_PATH *HiiVendorPath;
-
- Status = gBS->HandleProtocol (
- ThunkContext->UefiHiiDriverHandle,
- &gEfiHiiConfigAccessProtocolGuid,
- (VOID **) &ConfigAccess
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->HandleProtocol (
- ThunkContext->UefiHiiDriverHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &HiiVendorPath
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ThunkContext->UefiHiiDriverHandle,
- &gEfiDevicePathProtocolGuid,
- HiiVendorPath,
- &gEfiHiiConfigAccessProtocolGuid,
- ConfigAccess,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
-}
-
-
-/**
- Wrap the EFI_HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig to a call to EFI_FORM_CALLBACK_PROTOCOL.NvRead.
-
- @param BufferStorage The key with all attributes needed to call EFI_FORM_CALLBACK_PROTOCOL.NvRead.
- @param FwFormCallBack The EFI_FORM_CALLBACK_PROTOCOL registered by Framework HII module.
- @param Data The data read.
- @param DataSize The size of data.
-
- @retval EFI_STATUS The status returned by the EFI_FORM_CALLBACK_PROTOCOL.NvWrite.
- @retval EFI_INVALID_PARAMETER If the EFI_FORM_CALLBACK_PROTOCOL.NvRead return the size information of the data
- does not match what has been recorded early in he BUFFER_STORAGE_ENTRY.
- **/
-EFI_STATUS
-CallFormCallBack (
- IN FORMSET_STORAGE *BufferStorage,
- IN EFI_FORM_CALLBACK_PROTOCOL *FwFormCallBack,
- OUT VOID **Data,
- OUT UINTN *DataSize
- )
-{
- EFI_STATUS Status;
-
- *DataSize = 0;
- *Data = NULL;
-
- Status = FwFormCallBack->NvRead (
- FwFormCallBack,
- BufferStorage->Name,
- &BufferStorage->Guid,
- NULL,
- DataSize,
- *Data
- );
- if (Status == EFI_BUFFER_TOO_SMALL) {
- if (BufferStorage->Size != *DataSize) {
- ASSERT (FALSE);
- return EFI_INVALID_PARAMETER;
- }
-
- *Data = AllocateZeroPool (*DataSize);
- if (*Data == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = FwFormCallBack->NvRead (
- FwFormCallBack,
- BufferStorage->Name,
- &BufferStorage->Guid,
- NULL,
- DataSize,
- *Data
- );
- }
-
- return Status;
-}
-
-
-/**
- Wrap the EFI_HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig to a call to UEFI Variable Get Service.
-
- @param BufferStorage The key with all attributes needed to call a UEFI Variable Get Service.
- @param Data The data read.
- @param DataSize The size of data.
-
- If the UEFI Variable Get Service return the size information of the data
- does not match what has been recorded early in he BUFFER_STORAGE_ENTRY.
- then ASSERT.
-
- @retval EFI_STATUS The status returned by the UEFI Variable Get Service.
- @retval EFI_INVALID_PARAMETER If the UEFI Variable Get Service return the size information of the data
- does not match what has been recorded early in he BUFFER_STORAGE_ENTRY.
- **/
-EFI_STATUS
-GetUefiVariable (
- IN FORMSET_STORAGE *BufferStorage,
- OUT VOID **Data,
- OUT UINTN *DataSize
- )
-{
- EFI_STATUS Status;
-
- *DataSize = 0;
- *Data = NULL;
- Status = gRT->GetVariable (
- BufferStorage->Name,
- &BufferStorage->Guid,
- NULL,
- DataSize,
- *Data
- );
- if (Status == EFI_BUFFER_TOO_SMALL) {
-
- if (BufferStorage->Size != *DataSize) {
- ASSERT (FALSE);
- return EFI_INVALID_PARAMETER;
- }
-
- *Data = AllocateZeroPool (*DataSize);
- if (*Data == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = gRT->GetVariable (
- BufferStorage->Name,
- &BufferStorage->Guid,
- NULL,
- DataSize,
- *Data
- );
- }
-
- return Status;
-}
-
-/**
-
- This function implement the EFI_HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig
- so that data can be read from the data storage such as UEFI Variable or module's
- customized storage exposed by EFI_FRAMEWORK_CALLBACK.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL
- @param Request A null-terminated Unicode string in <ConfigRequest> format. Note that this
- includes the routing information as well as the configurable name / value pairs. It is
- invalid for this string to be in <MultiConfigRequest> format.
-
- @param Progress On return, points to a character in the Request string. Points to the string's null
- terminator if request was successful. Points to the most recent '&' before the first
- failing name / value pair (or the beginning of the string if the failure is in the first
- name / value pair) if the request was not successful
- @param Results A null-terminated Unicode string in <ConfigAltResp> format which has all
- values filled in for the names in the Request string. String to be allocated by the called
- function.
-
- @retval EFI_INVALID_PARAMETER If there is no Buffer Storage for this Config Access instance.
- @retval EFI_SUCCESS The setting is retrived successfully.
- @retval !EFI_SUCCESS The error returned by UEFI Get Variable or Framework Form Callback Nvread.
- **/
-EFI_STATUS
-EFIAPI
-ThunkExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
- )
-{
- EFI_STATUS Status;
- CONFIG_ACCESS_PRIVATE *ConfigAccess;
- FORMSET_STORAGE *BufferStorage;
- VOID *Data;
- UINTN DataSize;
- FORM_BROWSER_FORMSET *FormSetContext;
- CHAR16 *VarStoreName;
- EFI_STRING ConfigRequestHdr;
- EFI_STRING ConfigRequest;
- UINTN Size;
- BOOLEAN AllocatedRequest;
- LIST_ENTRY *StorageList;
- EFI_STRING SingleResult;
- EFI_STRING FinalResults;
- EFI_STRING StrPointer;
-
- if (Progress == NULL || Results == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- *Progress = Request;
-
- Status = EFI_SUCCESS;
- Data = NULL;
- StrPointer = NULL;
- SingleResult = NULL;
- FinalResults = NULL;
- ConfigAccess = CONFIG_ACCESS_PRIVATE_FROM_PROTOCOL (This);
- FormSetContext = ConfigAccess->ThunkContext->FormSet;
- if (IsListEmpty (&FormSetContext->StorageListHead)) {
- //
- // No VarStorage does exist in this form.
- //
- return EFI_NOT_FOUND;
- }
- StorageList = GetFirstNode (&FormSetContext->StorageListHead);
-
- do {
- if (Request != NULL) {
- BufferStorage = GetStorageFromConfigString (ConfigAccess->ThunkContext->FormSet, Request);
- if (BufferStorage == NULL) {
- return EFI_NOT_FOUND;
- }
- } else {
- if (IsNull (&FormSetContext->StorageListHead, StorageList)) {
- //
- // No Storage to be extracted into the results.
- //
- break;
- }
- BufferStorage = FORMSET_STORAGE_FROM_LINK (StorageList);
- StorageList = GetNextNode (&FormSetContext->StorageListHead, StorageList);
- if (BufferStorage->Type != EFI_HII_VARSTORE_BUFFER) {
- //
- // BufferStorage type should be EFI_HII_VARSTORE_BUFFER
- //
- continue;
- }
- }
-
- VarStoreName = NULL;
- ConfigRequestHdr = NULL;
- ConfigRequest = NULL;
- Size = 0;
- AllocatedRequest = FALSE;
-
- if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {
- //
- // NvMapOverride is not used. Get the Storage data from EFI Variable or Framework Form Callback.
- //
- if (ConfigAccess->FormCallbackProtocol == NULL ||
- ConfigAccess->FormCallbackProtocol->NvRead == NULL) {
- Status = GetUefiVariable (
- BufferStorage,
- &Data,
- &DataSize
- );
- } else {
- Status = CallFormCallBack (
- BufferStorage,
- ConfigAccess->FormCallbackProtocol,
- &Data,
- &DataSize
- );
- }
- } else {
- //
- // Use the NvMapOverride.
- //
- DataSize = BufferStorage->Size;
- Data = AllocateCopyPool (DataSize, ConfigAccess->ThunkContext->NvMapOverride);
-
- if (Data != NULL) {
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_OUT_OF_RESOURCES;
- }
- }
-
- if (!EFI_ERROR (Status)) {
- ConfigRequest = Request;
- if (Request == NULL || (StrStr (Request, L"OFFSET") == NULL)) {
- //
- // Request is without any request element, construct full request string.
- //
-
- if ((BufferStorage->VarStoreId == FormSetContext->DefaultVarStoreId) && (FormSetContext->OriginalDefaultVarStoreName != NULL)) {
- VarStoreName = FormSetContext->OriginalDefaultVarStoreName;
- } else {
- VarStoreName = BufferStorage->Name;
- }
-
- //
- // First Set ConfigRequestHdr string.
- //
- ConfigRequestHdr = HiiConstructConfigHdr (&BufferStorage->Guid, VarStoreName, ConfigAccess->ThunkContext->UefiHiiDriverHandle);
- ASSERT (ConfigRequestHdr != NULL);
-
- //
- // Allocate and fill a buffer large enough to hold the <ConfigHdr> template
- // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
- //
- Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
- ConfigRequest = AllocateZeroPool (Size);
- ASSERT (ConfigRequest != NULL);
- AllocatedRequest = TRUE;
- UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)DataSize);
- FreePool (ConfigRequestHdr);
- }
- Status = mHiiConfigRoutingProtocol->BlockToConfig (
- mHiiConfigRoutingProtocol,
- ConfigRequest,
- Data,
- DataSize,
- &SingleResult,
- Progress
- );
- //
- // Free the allocated config request string.
- //
- if (AllocatedRequest) {
- FreePool (ConfigRequest);
- ConfigRequest = NULL;
- }
- }
- //
- // Free the allocated Data
- //
- if (Data != NULL) {
- FreePool (Data);
- }
- //
- // Directly return when meet with error
- //
- if (EFI_ERROR (Status)) {
- break;
- }
- //
- // Merge result into the final results.
- //
- if (FinalResults == NULL) {
- FinalResults = SingleResult;
- SingleResult = NULL;
- } else {
- Size = StrLen (FinalResults);
- Size = Size + 1;
- Size = Size + StrLen (SingleResult) + 1;
- StrPointer = AllocateZeroPool (Size * sizeof (CHAR16));
- ASSERT (StrPointer != NULL);
- StrCpy (StrPointer, FinalResults);
- FreePool (FinalResults);
- FinalResults = StrPointer;
- StrPointer = StrPointer + StrLen (StrPointer);
- *StrPointer = L'&';
- StrCpy (StrPointer + 1, SingleResult);
- FreePool (SingleResult);
- }
- } while (Request == NULL);
-
- if (!EFI_ERROR (Status)) {
- *Results = FinalResults;
- } else {
- if (FinalResults != NULL) {
- FreePool (FinalResults);
- }
- }
- //
- // Set Progress string to the original request string.
- //
- if (Request == NULL) {
- *Progress = NULL;
- } else if (StrStr (Request, L"OFFSET") == NULL) {
- *Progress = Request + StrLen (Request);
- }
-
- return Status;
-}
-
-/**
- This function implement the EFI_HII_CONFIG_ACCESS_PROTOCOL.RouteConfig
- so that data can be written to the data storage such as UEFI Variable or module's
- customized storage exposed by EFI_FRAMEWORK_CALLBACK.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL
- @param Configuration A null-terminated Unicode string in <ConfigResp> format.
- @param Progress A pointer to a string filled in with the offset of the most recent '&' before the first
- failing name / value pair (or the beginning of the string if the failure is in the first
- name / value pair) or the terminating NULL if all was successful.
-
- @retval EFI_INVALID_PARAMETER If there is no Buffer Storage for this Config Access instance.
- @retval EFI_SUCCESS The setting is saved successfully.
- @retval !EFI_SUCCESS The error returned by UEFI Set Variable or Framework Form Callback Nvwrite.
-**/
-EFI_STATUS
-EFIAPI
-ThunkRouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
- )
-{
- EFI_STATUS Status;
- CONFIG_ACCESS_PRIVATE *ConfigAccess;
- FORMSET_STORAGE *BufferStorage;
- VOID *Data;
- UINTN DataSize;
- UINTN DataSize2;
- BOOLEAN ResetRequired;
- BOOLEAN DataAllocated;
-
- if (Configuration == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Data = NULL;
- ConfigAccess = CONFIG_ACCESS_PRIVATE_FROM_PROTOCOL (This);
-
- BufferStorage = GetStorageFromConfigString (ConfigAccess->ThunkContext->FormSet, Configuration);
-
- if (BufferStorage == NULL) {
- *Progress = Configuration;
- return EFI_NOT_FOUND;
- }
-
- DataSize2 = BufferStorage->Size;
- if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {
- DataAllocated = TRUE;
- if (ConfigAccess->FormCallbackProtocol == NULL ||
- ConfigAccess->FormCallbackProtocol->NvRead == NULL) {
- Status = GetUefiVariable (
- BufferStorage,
- &Data,
- &DataSize
- );
- } else {
- Status = CallFormCallBack (
- BufferStorage,
- ConfigAccess->FormCallbackProtocol,
- &Data,
- &DataSize
- );
- }
- } else {
- //
- // ConfigToBlock will convert the Config String and update the NvMapOverride accordingly.
- //
- Status = EFI_SUCCESS;
- Data = ConfigAccess->ThunkContext->NvMapOverride;
- DataSize = DataSize2;
- DataAllocated = FALSE;
- }
- if (EFI_ERROR (Status) || (DataSize2 != DataSize)) {
- if (Data == NULL) {
- Data = AllocateZeroPool (DataSize2);
- }
- }
-
- DataSize = DataSize2;
- Status = mHiiConfigRoutingProtocol->ConfigToBlock (
- mHiiConfigRoutingProtocol,
- Configuration,
- Data,
- &DataSize,
- Progress
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {
- if (ConfigAccess->FormCallbackProtocol == NULL ||
- ConfigAccess->FormCallbackProtocol->NvWrite == NULL) {
- Status = gRT->SetVariable (
- BufferStorage->Name,
- &BufferStorage->Guid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- DataSize2,
- Data
- );
- } else {
- Status = ConfigAccess->FormCallbackProtocol->NvWrite (
- ConfigAccess->FormCallbackProtocol,
- BufferStorage->Name,
- &BufferStorage->Guid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- DataSize2,
- Data,
- &ResetRequired
- );
- }
- }
-
-Done:
- if (DataAllocated && (Data != NULL)) {
- FreePool (Data);
- }
-
- return Status;
-}
-
-/**
- Build the EFI_IFR_DATA_ARRAY which will be used to pass to
- EFI_FORM_CALLBACK_PROTOCOL.Callback. Check definition of EFI_IFR_DATA_ARRAY
- for details.
-
- ASSERT if the Question Type is not EFI_IFR_TYPE_NUM_SIZE_* or EFI_IFR_TYPE_STRING.
-
- @param ConfigAccess Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL
- @param QuestionId The Question ID.
- @param Type The Question Type.
- @param Value The Question Value.
- @param NvMapAllocated On output indicates if a buffer is allocated for NvMap.
-
- @return A pointer to EFI_IFR_DATA_ARRAY. The caller must free this buffer allocated.
-**/
-EFI_IFR_DATA_ARRAY *
-CreateIfrDataArray (
- IN CONFIG_ACCESS_PRIVATE *ConfigAccess,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT BOOLEAN *NvMapAllocated
- )
-{
- EFI_IFR_DATA_ARRAY *IfrDataArray;
- EFI_IFR_DATA_ENTRY *IfrDataEntry;
- UINTN BrowserDataSize;
- FORMSET_STORAGE *BufferStorage;
- UINTN Size;
- EFI_STRING String;
- FORM_BROWSER_STATEMENT *Statement;
-
- *NvMapAllocated = FALSE;
-
- String = NULL;
-
- switch (Type) {
- case EFI_IFR_TYPE_NUM_SIZE_8:
- case EFI_IFR_TYPE_NUM_SIZE_16:
- case EFI_IFR_TYPE_NUM_SIZE_32:
- case EFI_IFR_TYPE_NUM_SIZE_64:
- case EFI_IFR_TYPE_BOOLEAN:
- Size = sizeof (*Value);
- break;
-
- case EFI_IFR_TYPE_STRING:
- if (Value->string == 0) {
- Size = 0;
- } else {
- String = HiiGetString (ConfigAccess->ThunkContext->UefiHiiHandle, Value->string, NULL);
- ASSERT (String != NULL);
-
- Size = StrSize (String);
- }
- break;
-
- case EFI_IFR_TYPE_ACTION:
- case EFI_IFR_TYPE_UNDEFINED:
- Size = 0;
- break;
-
- default:
- ASSERT (FALSE);
- Size = 0;
- break;
- }
-
- IfrDataArray = AllocateZeroPool (sizeof (EFI_IFR_DATA_ARRAY) + sizeof (EFI_IFR_DATA_ENTRY) + Size);
- ASSERT (IfrDataArray != NULL);
- IfrDataArray->EntryCount = 1;
- IfrDataEntry = (EFI_IFR_DATA_ENTRY *) (IfrDataArray + 1);
-
- Statement = GetStorageFromQuestionId (ConfigAccess->ThunkContext->FormSet, QuestionId);
-
- if (Statement == NULL || Statement->Storage == NULL) {
- //
- // The QuestionId is not associated with a Buffer Storage.
- // Try to get the first Buffer Storage then.
- //
- BufferStorage = GetFirstStorageOfFormSet (ConfigAccess->ThunkContext->FormSet);
- } else {
- BufferStorage = Statement->Storage;
- IfrDataEntry->OpCode = Statement->Operand;
- }
-
- if (BufferStorage != NULL) {
- BrowserDataSize = BufferStorage->Size;
- IfrDataEntry->Length = (UINT8) (sizeof (EFI_IFR_DATA_ENTRY) + Size);
-
- if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {
- *NvMapAllocated = TRUE;
- IfrDataArray->NvRamMap = AllocateZeroPool (BrowserDataSize);
- } else {
- *NvMapAllocated = FALSE;
- IfrDataArray->NvRamMap = ConfigAccess->ThunkContext->NvMapOverride;
- }
-
- ASSERT (HiiGetBrowserData (&BufferStorage->Guid, BufferStorage->Name, BrowserDataSize, (UINT8 *) IfrDataArray->NvRamMap));
-
- switch (Type) {
- case EFI_IFR_TYPE_NUM_SIZE_8:
- case EFI_IFR_TYPE_NUM_SIZE_16:
- case EFI_IFR_TYPE_NUM_SIZE_32:
- case EFI_IFR_TYPE_NUM_SIZE_64:
- case EFI_IFR_TYPE_BOOLEAN:
- CopyMem (&IfrDataEntry->Data, &(Value->u8), sizeof (*Value));
- break;
-
- case EFI_IFR_TYPE_STRING:
- if (Size != 0) {
- ASSERT (String != NULL);
- StrCpy ((CHAR16 *) &IfrDataEntry->Data, String);
- FreePool (String);
- }
- break;
-
- case EFI_IFR_TYPE_ACTION:
- case EFI_IFR_TYPE_UNDEFINED:
- break;
-
- default:
- ASSERT (FALSE);
- break;
- }
-
- //
- // Need to fiil in the information for the rest of field for EFI_IFR_DATA_ENTRY.
- // It seems that no implementation is found to use other fields. Leave them uninitialized for now.
- //
- //UINT8 OpCode; // Likely a string, numeric, or one-of
- //UINT8 Length; // Length of the EFI_IFR_DATA_ENTRY packet
- //UINT16 Flags; // Flags settings to determine what behavior is desired from the browser after the callback
- //VOID *Data; // The data in the form based on the op-code type - this is not a pointer to the data, the data follows immediately
- // If the OpCode is a OneOf or Numeric type - Data is a UINT16 value
- // If the OpCode is a String type - Data is a CHAR16[x] type
- // If the OpCode is a Checkbox type - Data is a UINT8 value
- // If the OpCode is a NV Access type - Data is a FRAMEWORK_EFI_IFR_NV_DATA structure
- }
-
- return IfrDataArray;
-}
-
-/**
- If a NvMapOverride is passed in to EFI_FORM_BROWSER_PROTOCOL.SendForm, the Form Browser
- needs to be informed when data changed in NvMapOverride. This function will invoke
- SetBrowserData () to set internal data of Form Browser.
-
- @param ConfigAccess The Config Access Private Context.
- @param QuestionId The Question Id that invokes the callback.
-
-
-**/
-VOID
-SyncBrowserDataForNvMapOverride (
- IN CONST CONFIG_ACCESS_PRIVATE *ConfigAccess,
- IN EFI_QUESTION_ID QuestionId
- )
-{
- FORMSET_STORAGE *BufferStorage;
- BOOLEAN CheckFlag;
- UINTN BrowserDataSize;
- FORM_BROWSER_STATEMENT *Statement;
-
- if (ConfigAccess->ThunkContext->NvMapOverride != NULL) {
-
- Statement = GetStorageFromQuestionId (ConfigAccess->ThunkContext->FormSet, QuestionId);
-
- if (Statement == NULL || Statement->Storage == NULL) {
- //
- // QuestionId is a statement without Storage.
- // 1) It is a Goto.
- //
- //
- BufferStorage = GetFirstStorageOfFormSet (ConfigAccess->ThunkContext->FormSet);
- } else {
- BufferStorage = Statement->Storage;
- }
-
- //
- // If NvMapOverride is not NULL, this Form must have at least one Buffer Type Variable Storage.
- //
- ASSERT (BufferStorage != NULL);
-
- BrowserDataSize = BufferStorage->Size;
-
- CheckFlag = HiiSetBrowserData (&BufferStorage->Guid, BufferStorage->Name, BrowserDataSize, ConfigAccess->ThunkContext->NvMapOverride, NULL);
- ASSERT (CheckFlag);
- }
-
-}
-
-/**
- Free up resource allocated for a EFI_IFR_DATA_ARRAY by CreateIfrDataArray ().
-
- @param Array The EFI_IFR_DATA_ARRAY allocated.
- @param NvMapAllocated If the NvRamMap is allocated for EFI_IFR_DATA_ARRAY.
-
-**/
-VOID
-DestroyIfrDataArray (
- IN EFI_IFR_DATA_ARRAY *Array,
- IN BOOLEAN NvMapAllocated
- )
-{
- if (Array != NULL) {
- if (NvMapAllocated) {
- FreePool (Array->NvRamMap);
- }
-
- FreePool (Array);
- }
-}
-
-/**
- Get the ONE_OF_OPTION_MAP_ENTRY for a QuestionId that invokes the
- EFI_FORM_CALLBACK_PROTOCOL.Callback. The information is needed as
- the callback mechanism for EFI_IFR_ONE_OF_OPTION is changed from
- EFI_IFR_ONE_OF_OPTION in Framework IFR. Check EFI_IFR_GUID_OPTIONKEY
- for detailed information.
-
- @param ThunkContext The Thunk Context.
- @param QuestionId The Question Id.
- @param Type The Question Type.
- @param Value The One Of Option's value.
-
- @return The ONE_OF_OPTION_MAP_ENTRY found.
- @retval NULL If no entry is found.
-**/
-ONE_OF_OPTION_MAP_ENTRY *
-GetOneOfOptionMapEntry (
- IN HII_THUNK_CONTEXT *ThunkContext,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value
- )
-{
- LIST_ENTRY *Link;
- LIST_ENTRY *Link2;
- ONE_OF_OPTION_MAP_ENTRY *OneOfOptionMapEntry;
- ONE_OF_OPTION_MAP *OneOfOptionMap;
- FORM_BROWSER_FORMSET *FormSet;
-
- FormSet = ThunkContext->FormSet;
-
- Link = GetFirstNode (&FormSet->OneOfOptionMapListHead);
-
- while (!IsNull (&FormSet->OneOfOptionMapListHead, Link)) {
- OneOfOptionMap = ONE_OF_OPTION_MAP_FROM_LINK(Link);
- if (OneOfOptionMap->QuestionId == QuestionId) {
- ASSERT (OneOfOptionMap->ValueType == Type);
-
- Link2 = GetFirstNode (&OneOfOptionMap->OneOfOptionMapEntryListHead);
-
- while (!IsNull (&OneOfOptionMap->OneOfOptionMapEntryListHead, Link2)) {
- OneOfOptionMapEntry = ONE_OF_OPTION_MAP_ENTRY_FROM_LINK (Link2);
-
- if (CompareMem (Value, &OneOfOptionMapEntry->Value, sizeof (EFI_IFR_TYPE_VALUE)) == 0) {
- return OneOfOptionMapEntry;
- }
-
- Link2 = GetNextNode (&OneOfOptionMap->OneOfOptionMapEntryListHead, Link2);
- }
- }
-
- Link = GetNextNode (&FormSet->OneOfOptionMapListHead, Link);
- }
-
-
- return NULL;
-}
-
-/**
- Functions which are registered to receive notification of
- database events have this prototype. The actual event is encoded
- in NotifyType. The following table describes how PackageType,
- PackageGuid, Handle, and Package are used for each of the
- notification types.
-
- If any Pakcage List in database is updated, mHiiPackageListUpdated
- will be set. If mHiiPackageListUpdated is set, Framework ThunkCallback()
- will force the UEFI Setup Browser to save the uncommitted data. This
- is needed as Framework's Callback function may dynamically update
- opcode in a Package List. UEFI Setup Browser will quit itself and reparse
- the Package List's IFR and display it. UEFI Config Access's implementation
- is required to save the modified (SetBrowserData or directly save the data
- to NV storage). But Framework HII Modules is not aware of this rule. Therefore,
- we will enforce the rule in ThunkCallback (). The side effect of force saving
- of NV data is the NV flag in browser may not flag a update as data has already
- been saved to NV storage.
-
- @param PackageType Package type of the notification.
-
- @param PackageGuid If PackageType is
- EFI_HII_PACKAGE_TYPE_GUID, then this is
- the pointer to the GUID from the Guid
- field of EFI_HII_PACKAGE_GUID_HEADER.
- Otherwise, it must be NULL.
-
- @param Package Points to the package referred to by the
- notification Handle The handle of the package
- list which contains the specified package.
-
- @param Handle The HII handle.
-
- @param NotifyType The type of change concerning the
- database. See
- EFI_HII_DATABASE_NOTIFY_TYPE.
-
-**/
-EFI_STATUS
-EFIAPI
-FormUpdateNotify (
- IN UINT8 PackageType,
- IN CONST EFI_GUID *PackageGuid,
- IN CONST EFI_HII_PACKAGE_HEADER *Package,
- IN EFI_HII_HANDLE Handle,
- IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType
- )
-{
- mHiiPackageListUpdated = TRUE;
-
- return EFI_SUCCESS;
-}
-
-/**
- Wrap the EFI_HII_CONFIG_ACCESS_PROTOCOL.CallBack to EFI_FORM_CALLBACK_PROTOCOL.Callback. Therefor,
- the framework HII module willl do no porting and work with a UEFI HII SetupBrowser.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser. See EFI_BROWSER_ACTION_x.
- @param QuestionId A unique value which is sent to the original exporting driver so that it can identify the
- type of data to expect. The format of the data tends to vary based on the opcode that
- generated the callback.
- @param Type The type of value for the question. See EFI_IFR_TYPE_x in
- EFI_IFR_ONE_OF_OPTION.
- @param Value A pointer to the data being sent to the original exporting driver. The type is specified
- by Type. Type EFI_IFR_TYPE_VALUE is defined in
- EFI_IFR_ONE_OF_OPTION.
- @param ActionRequest On return, points to the action requested by the callback function. Type
- EFI_BROWSER_ACTION_REQUEST is specified in SendForm() in the Form
- Browser Protocol.
-
- @retval EFI_UNSUPPORTED If the Framework HII module does not register Callback although it specify the opcode under
- focuse to be INTERRACTIVE.
- @retval EFI_SUCCESS The callback complete successfully.
- @retval !EFI_SUCCESS The error code returned by EFI_FORM_CALLBACK_PROTOCOL.Callback.
-
- **/
-EFI_STATUS
-EFIAPI
-ThunkCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
- )
-{
- EFI_STATUS Status;
- CONFIG_ACCESS_PRIVATE *ConfigAccess;
- EFI_FORM_CALLBACK_PROTOCOL *FormCallbackProtocol;
- EFI_HII_CALLBACK_PACKET *Packet;
- EFI_IFR_DATA_ARRAY *Data;
- EFI_IFR_DATA_ENTRY *DataEntry;
- UINT16 KeyValue;
- ONE_OF_OPTION_MAP_ENTRY *OneOfOptionMapEntry;
- EFI_HANDLE NotifyHandle;
- EFI_INPUT_KEY Key;
- BOOLEAN NvMapAllocated;
-
- if (Action == EFI_BROWSER_ACTION_CHANGING) {
- ASSERT (This != NULL);
- ASSERT (Value != NULL);
- ASSERT (ActionRequest != NULL);
-
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
-
- ConfigAccess = CONFIG_ACCESS_PRIVATE_FROM_PROTOCOL (This);
-
- FormCallbackProtocol = ConfigAccess->FormCallbackProtocol;
- if (FormCallbackProtocol == NULL) {
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
- }
-
- //
- // Check if the QuestionId match a OneOfOption.
- //
- OneOfOptionMapEntry = GetOneOfOptionMapEntry (ConfigAccess->ThunkContext, QuestionId, Type, Value);
-
- if (OneOfOptionMapEntry == NULL) {
- //
- // This is not a One-Of-Option opcode. QuestionId is the KeyValue
- //
- KeyValue = QuestionId;
- } else {
- //
- // Otherwise, use the original Key specified in One Of Option in the Framework VFR syntax.
- //
- KeyValue = OneOfOptionMapEntry->FwKey;
- }
-
- //
- // Build the EFI_IFR_DATA_ARRAY
- //
- Data = CreateIfrDataArray (ConfigAccess, QuestionId, Type, Value, &NvMapAllocated);
-
- Status = mHiiDatabase->RegisterPackageNotify (
- mHiiDatabase,
- EFI_HII_PACKAGE_FORMS,
- NULL,
- FormUpdateNotify,
- EFI_HII_DATABASE_NOTIFY_REMOVE_PACK,
- &NotifyHandle
- );
- //
- //Call the Framework Callback function.
- //
- Packet = NULL;
- Status = FormCallbackProtocol->Callback (
- FormCallbackProtocol,
- KeyValue,
- Data,
- &Packet
- );
- SyncBrowserDataForNvMapOverride (ConfigAccess, QuestionId);
-
- //
- // Callback require browser to perform action
- //
- if (EFI_ERROR (Status)) {
- if (Packet != NULL) {
- do {
- CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, Packet->String, NULL);
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- }
- //
- // Error Code in Status is discarded.
- //
- } else {
- if (Packet != NULL) {
- if (Packet->DataArray.EntryCount == 1 && Packet->DataArray.NvRamMap == NULL) {
- DataEntry = (EFI_IFR_DATA_ENTRY *) ((UINT8 *) Packet + sizeof (EFI_IFR_DATA_ARRAY));
- if ((DataEntry->Flags & EXIT_REQUIRED) == EXIT_REQUIRED) {
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
- }
-
- if ((DataEntry->Flags & SAVE_REQUIRED) == SAVE_REQUIRED) {
- Status = ConfigAccess->ConfigAccessProtocol.RouteConfig (
- &ConfigAccess->ConfigAccessProtocol,
- NULL,
- NULL
- );
- }
- }
- FreePool (Packet);
- }
- }
-
- //
- // Unregister notify for Form package update
- //
- Status = mHiiDatabase->UnregisterPackageNotify (
- mHiiDatabase,
- NotifyHandle
- );
- //
- // UEFI SetupBrowser behaves differently with Framework SetupBrowser when call back function
- // update any forms in HII database. UEFI SetupBrowser will re-parse the displaying form package and load
- // the values from variable storages. Framework SetupBrowser will only re-parse the displaying form packages.
- // To make sure customer's previous changes is saved and the changing question behaves as expected, we
- // issue a EFI_BROWSER_ACTION_REQUEST_SUBMIT to ask UEFI SetupBrowser to save the changes proceed to re-parse
- // the form and load all the variable storages.
- //
- if (*ActionRequest == EFI_BROWSER_ACTION_REQUEST_NONE && mHiiPackageListUpdated) {
- mHiiPackageListUpdated= FALSE;
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
- } else {
- if (ConfigAccess->ThunkContext->FormSet->SubClass == EFI_FRONT_PAGE_SUBCLASS ||
- ConfigAccess->ThunkContext->FormSet->SubClass == EFI_SINGLE_USE_SUBCLASS) {
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
- }
- }
-
- //
- // Clean up.
- //
- DestroyIfrDataArray (Data, NvMapAllocated);
-
- return Status;
- }
-
- //
- // All other action return unsupported.
- //
- return EFI_UNSUPPORTED;
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.h
deleted file mode 100644
index 6b45b6f807..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/** @file
- This file contains functions related to Config Access Protocols installed by
- by HII Thunk Modules which is used to thunk UEFI Config Access Callback to
- Framework HII Callback.
-
-Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#ifndef _HII_THUNK_CONFIG_ACCESS_H_
-#define _HII_THUNK_CONFIG_ACCESS_H_
-
-/**
- This function installs a EFI_CONFIG_ACCESS_PROTOCOL instance for a form package registered
- by a module using Framework HII Protocol Interfaces.
-
- UEFI HII require EFI_HII_CONFIG_ACCESS_PROTOCOL to be installed on a EFI_HANDLE, so
- that Setup Utility can load the Buffer Storage using this protocol.
-
- @param Packages The Package List.
- @param ThunkContext The Thunk Context.
-
- @retval EFI_SUCCESS The Config Access Protocol is installed successfully.
- @retval EFI_OUT_RESOURCE There is not enough memory.
-
-**/
-EFI_STATUS
-InstallDefaultConfigAccessProtocol (
- IN CONST EFI_HII_PACKAGES *Packages,
- IN OUT HII_THUNK_CONTEXT *ThunkContext
- );
-
-/**
- This function un-installs the EFI_CONFIG_ACCESS_PROTOCOL instance for a form package registered
- by a module using Framework HII Protocol Interfaces.
-
- ASSERT if no Config Access is found for such pakcage list or failed to uninstall the protocol.
-
- @param ThunkContext The Thunk Context.
-
-**/
-VOID
-UninstallDefaultConfigAccessProtocol (
- IN HII_THUNK_CONTEXT *ThunkContext
- );
-
-/**
-
- This function implement the EFI_HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig
- so that data can be read from the data storage such as UEFI Variable or module's
- customized storage exposed by EFI_FRAMEWORK_CALLBACK.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL
- @param Request A null-terminated Unicode string in <ConfigRequest> format. Note that this
- includes the routing information as well as the configurable name / value pairs. It is
- invalid for this string to be in <MultiConfigRequest> format.
-
- @param Progress On return, points to a character in the Request string. Points to the string's null
- terminator if request was successful. Points to the most recent '&' before the first
- failing name / value pair (or the beginning of the string if the failure is in the first
- name / value pair) if the request was not successful
- @param Results A null-terminated Unicode string in <ConfigAltResp> format which has all
- values filled in for the names in the Request string. String to be allocated by the called
- function.
-
- @retval EFI_INVALID_PARAMETER If there is no Buffer Storage for this Config Access instance.
- @retval EFI_SUCCESS The setting is retrived successfully.
- @retval !EFI_SUCCESS The error returned by UEFI Get Variable or Framework Form Callback Nvread.
- **/
-EFI_STATUS
-EFIAPI
-ThunkExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
- );
-
-
-/**
- This function implement the EFI_HII_CONFIG_ACCESS_PROTOCOL.RouteConfig
- so that data can be written to the data storage such as UEFI Variable or module's
- customized storage exposed by EFI_FRAMEWORK_CALLBACK.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL
- @param Configuration A null-terminated Unicode string in <ConfigResp> format.
- @param Progress A pointer to a string filled in with the offset of the most recent '&' before the first
- failing name / value pair (or the beginning of the string if the failure is in the first
- name / value pair) or the terminating NULL if all was successful.
-
- @retval EFI_INVALID_PARAMETER If there is no Buffer Storage for this Config Access instance.
- @retval EFI_SUCCESS The setting is saved successfully.
- @retval !EFI_SUCCESS The error returned by UEFI Set Variable or Framework Form Callback Nvwrite.
-**/
-EFI_STATUS
-EFIAPI
-ThunkRouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
- );
-
-/**
- Wrap the EFI_HII_CONFIG_ACCESS_PROTOCOL.CallBack to EFI_FORM_CALLBACK_PROTOCOL.Callback. Therefor,
- the framework HII module willl do no porting and work with a UEFI HII SetupBrowser.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser. See EFI_BROWSER_ACTION_x.
- @param QuestionId A unique value which is sent to the original exporting driver so that it can identify the
- type of data to expect. The format of the data tends to vary based on the opcode that
- generated the callback.
- @param Type The type of value for the question. See EFI_IFR_TYPE_x in
- EFI_IFR_ONE_OF_OPTION.
- @param Value A pointer to the data being sent to the original exporting driver. The type is specified
- by Type. Type EFI_IFR_TYPE_VALUE is defined in
- EFI_IFR_ONE_OF_OPTION.
- @param ActionRequest On return, points to the action requested by the callback function. Type
- EFI_BROWSER_ACTION_REQUEST is specified in SendForm() in the Form
- Browser Protocol.
-
- @retval EFI_UNSUPPORTED If the Framework HII module does not register Callback although it specify the opcode under
- focuse to be INTERRACTIVE.
- @retval EFI_SUCCESS The callback complete successfully.
- @retval !EFI_SUCCESS The error code returned by EFI_FORM_CALLBACK_PROTOCOL.Callback.
-
- **/
-EFI_STATUS
-EFIAPI
-ThunkCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
- );
-
-#endif
-
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Fonts.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Fonts.c
deleted file mode 100644
index 6826b5950d..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Fonts.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/** @file
- This file contains the Glyph related function.
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-
-#include "HiiDatabase.h"
-
-EFI_NARROW_GLYPH mNarrowGlyphBuffer = {0, 0, {0}};
-
-BOOLEAN mSysFontColorCached = FALSE;
-EFI_GRAPHICS_OUTPUT_BLT_PIXEL mSysFGColor = {0};
-
-
-/**
- Translates a Unicode character into the corresponding font glyph.
-
- Notes:
- This function is only called by Graphics Console module and GraphicsLib.
- Wrap the Framework HII GetGlyph function to UEFI Font Protocol.
-
- EDK II provides a UEFI Graphics Console module. ECP provides a GraphicsLib
- complying to UEFI HII.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Source A pointer to a Unicode string.
- @param Index On input, the offset into the string from which to fetch the character. On successful completion, the
- index is updated to the first character past the character(s) making up the just extracted glyph.
- @param GlyphBuffer Pointer to an array where the glyphs corresponding to the characters in the source may be stored.
- GlyphBuffer is assumed to be wide enough to accept a wide glyph character.
- @param BitWidth If EFI_SUCCESS was returned, the UINT16 pointed to by this value is filled with the length of the glyph in pixels.
- It is unchanged if the call was unsuccessful.
- @param InternalStatus To save the time required to read the string from the beginning on each glyph extraction
- (for example, to ensure that the narrow versus wide glyph mode is correct), this value is
- updated each time the function is called with the status that is local to the call. The cell pointed
- to by this parameter must be initialized to zero prior to invoking the call the first time for any string.
-
- @retval EFI_SUCCESS It worked.
- @retval EFI_NOT_FOUND A glyph for a character was not found.
-
-
-**/
-EFI_STATUS
-EFIAPI
-HiiGetGlyph (
- IN EFI_HII_PROTOCOL *This,
- IN CHAR16 *Source,
- IN OUT UINT16 *Index,
- OUT UINT8 **GlyphBuffer,
- OUT UINT16 *BitWidth,
- IN OUT UINT32 *InternalStatus
- )
-{
- EFI_STATUS Status;
- EFI_IMAGE_OUTPUT *Blt;
- EFI_FONT_DISPLAY_INFO *FontInfo;
- UINTN Xpos;
- UINTN Ypos;
- UINTN BaseLine;
-
- if (!mSysFontColorCached) {
- //
- // Cache the system font's foreground color.
- //
- Status = mHiiFontProtocol->GetFontInfo (
- mHiiFontProtocol,
- NULL,
- NULL,
- &FontInfo,
- NULL
- );
-
- if (!EFI_ERROR (Status)) {
- ASSERT (StrCmp (FontInfo->FontInfo.FontName, L"sysdefault") == 0);
- mSysFGColor = FontInfo->ForegroundColor;
- FreePool (FontInfo);
-
- mSysFontColorCached = TRUE;
- }
-
- }
-
- Blt = NULL;
- Status = mHiiFontProtocol->GetGlyph (
- mHiiFontProtocol,
- Source[*Index],
- NULL,
- &Blt,
- &BaseLine
- );
-
- if (!EFI_ERROR (Status) && (Status != EFI_WARN_UNKNOWN_GLYPH)) {
- //
- // For simplicity, we only handle Narrow Glyph.
- //
- if (Blt->Height == EFI_GLYPH_HEIGHT && Blt->Width == EFI_GLYPH_WIDTH) {
-
- ZeroMem (&mNarrowGlyphBuffer, sizeof (mNarrowGlyphBuffer));
- mNarrowGlyphBuffer.UnicodeWeight = *Source;
- for (Ypos = 0; Ypos < EFI_GLYPH_HEIGHT; Ypos++) {
- for (Xpos = 0; Xpos < EFI_GLYPH_WIDTH; Xpos++) {
- if (CompareMem (&Blt->Image.Bitmap[Ypos * EFI_GLYPH_WIDTH + Xpos], &mSysFGColor, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)) == 0) {
- mNarrowGlyphBuffer.GlyphCol1[Ypos] = (UINT8) (mNarrowGlyphBuffer.GlyphCol1[Ypos] | (1 << (EFI_GLYPH_WIDTH - 1 - Xpos)));
- }
- }
- }
-
- *GlyphBuffer = (UINT8 *) &mNarrowGlyphBuffer;
- *BitWidth = EFI_GLYPH_WIDTH;
- *Index += 1;
- } else {
- Status = EFI_NOT_FOUND;
- }
-
- }
-
- if (EFI_ERROR (Status) || (Status == EFI_WARN_UNKNOWN_GLYPH)) {
- if (Status == EFI_WARN_UNKNOWN_GLYPH) {
- Status = EFI_NOT_FOUND;
- }
- *GlyphBuffer = NULL;
- }
- return Status;
-}
-
-/**
- Translates a glyph into the format required for input to the Universal Graphics Adapter (UGA) Block Transfer (BLT) routines.
-
- Notes:
- This function is only called by Graphics Console module and GraphicsLib.
- EDK II provides a UEFI Graphics Console module. ECP provides a GraphicsLib
- complying to UEFI HII.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param GlyphBuffer A pointer to the buffer that contains glyph data.
- @param Foreground The foreground setting requested to be used for the generated BltBuffer data. Type EFI_UGA_PIXEL is defined in "Related Definitions" below.
- @param Background The background setting requested to be used for the generated BltBuffer data.
- @param Count The entry in the BltBuffer upon which to act.
- @param Width The width in bits of the glyph being converted.
- @param Height The height in bits of the glyph being converted
- @param BltBuffer A pointer to the buffer that contains the data that is ready to be used by the UGA BLT routines.
-
- @retval EFI_SUCCESS It worked.
- @retval EFI_NOT_FOUND A glyph for a character was not found.
-
-
-**/
-EFI_STATUS
-EFIAPI
-HiiGlyphToBlt (
- IN EFI_HII_PROTOCOL *This,
- IN UINT8 *GlyphBuffer,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
- IN UINTN Count,
- IN UINTN Width,
- IN UINTN Height,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
- )
-{
- UINTN Xpos;
- UINTN Ypos;
-
- //
- // Convert Monochrome bitmap of the Glyph to BltBuffer structure
- //
- for (Ypos = 0; Ypos < Height; Ypos++) {
- for (Xpos = 0; Xpos < Width; Xpos++) {
- if ((((EFI_NARROW_GLYPH *) GlyphBuffer)->GlyphCol1[Ypos] & (1 << Xpos)) != 0) {
- BltBuffer[Ypos * Width * Count + (Width - Xpos - 1)] = Foreground;
- } else {
- BltBuffer[Ypos * Width * Count + (Width - Xpos - 1)] = Background;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Forms.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Forms.c
deleted file mode 100644
index 1fe6487197..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Forms.c
+++ /dev/null
@@ -1,598 +0,0 @@
-/** @file
- This file contains the form processing code to the HII database.
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-
-#include "HiiDatabase.h"
-#include "UefiIfrDefault.h"
-
-//
-// This structure is only intended to be used in this file.
-//
-#pragma pack(1)
-typedef struct {
- EFI_HII_PACK_HEADER PackageHeader;
- FRAMEWORK_EFI_IFR_FORM_SET FormSet;
- EFI_IFR_END_FORM_SET EndFormSet;
-} FW_HII_FORMSET_TEMPLATE;
-#pragma pack()
-
-FW_HII_FORMSET_TEMPLATE FormSetTemplate = {
- {
- sizeof (FW_HII_FORMSET_TEMPLATE),
- EFI_HII_IFR
- },
- {
- {
- FRAMEWORK_EFI_IFR_FORM_SET_OP,
- sizeof (FRAMEWORK_EFI_IFR_FORM_SET)
- },
- {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}}, //Guid
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- },
- {
- {
- EFI_IFR_END_FORM_SET_OP,
- sizeof (EFI_IFR_END_FORM_SET)
- }
- }
-};
-
-
-EFI_GUID mTianoHiiIfrGuid = EFI_IFR_TIANO_GUID;
-
-/**
-
- This thunk module only handles UEFI HII packages. The caller of this function
- won't be able to parse the content. Therefore, it is not supported.
-
- This function will ASSERT and return EFI_UNSUPPORTED.
-
- @param This N.A.
- @param Handle N.A.
- @param BufferSize N.A.
- @param Buffer N.A.
-
- @retval EFI_UNSUPPORTED
-
-**/
-EFI_STATUS
-EFIAPI
-HiiExportDatabase (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
-}
-
-
-/**
- This function allows a program to extract a form or form package that has
- previously been registered with the EFI HII database.
-
- In this thunk module, this function will create a IFR Package with only
- one Formset. Effectively, only the GUID of the Formset is updated and return
- in this IFR package to caller. This is enable the Framework modules which call
- a API named GetStringFromToken. GetStringFromToken retieves a String based on
- a String Token from a Package List known only by the Formset GUID.
-
-
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle Handle on which the form resides. Type FRAMEWORK_EFI_HII_HANDLE is defined in
- EFI_HII_PROTOCOL.NewPack() in the Packages section.
- @param FormId Ignored by this implementation.
- @param BufferLengthTemp On input, the size of input buffer. On output, it
- is the size of FW_HII_FORMSET_TEMPLATE.
- @param Buffer The buffer designed to receive the form(s).
-
- @retval EFI_SUCCESS Buffer filled with the requested forms. BufferLength
- was updated.
- @retval EFI_INVALID_PARAMETER The handle is unknown.
- @retval EFI_NOT_FOUND A form on the requested handle cannot be found with the
- requested FormId.
- @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough to allow the form to be stored.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiGetForms (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN EFI_FORM_ID FormId,
- IN OUT UINTN *BufferLengthTemp,
- OUT UINT8 *Buffer
- )
-{
- HII_THUNK_PRIVATE_DATA *Private;
- HII_THUNK_CONTEXT *ThunkContext;
- FW_HII_FORMSET_TEMPLATE *OutputFormSet;
-
- if (*BufferLengthTemp < sizeof(FW_HII_FORMSET_TEMPLATE)) {
- *BufferLengthTemp = sizeof(FW_HII_FORMSET_TEMPLATE);
- return EFI_BUFFER_TOO_SMALL;
- }
-
- Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
-
- ThunkContext = FwHiiHandleToThunkContext (Private, Handle);
-
- if (ThunkContext == NULL) {
- return EFI_NOT_FOUND;
- }
-
- OutputFormSet = (FW_HII_FORMSET_TEMPLATE *) Buffer;
-
- CopyMem (OutputFormSet, &FormSetTemplate, sizeof (FW_HII_FORMSET_TEMPLATE));
- CopyMem (&OutputFormSet->FormSet.Guid, &ThunkContext->TagGuid, sizeof (EFI_GUID));
-
- if (ThunkContext->FormSet != NULL) {
- OutputFormSet->FormSet.Class = ThunkContext->FormSet->Class;
- OutputFormSet->FormSet.SubClass = ThunkContext->FormSet->SubClass;
- OutputFormSet->FormSet.Help = ThunkContext->FormSet->Help;
- OutputFormSet->FormSet.FormSetTitle = ThunkContext->FormSet->FormSetTitle;
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
-
- This function allows a program to extract the NV Image
- that represents the default storage image
-
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle The HII handle from which will have default data retrieved.
- UINTN - Mask used to retrieve the default image.
- @param DefaultMask EDES_TODO: Add parameter description
- @param VariablePackList Callee allocated, tightly-packed, link list data
- structure that contain all default varaible packs
- from the Hii Database.
-
- @retval EFI_NOT_FOUND If Hii database does not contain any default images.
- @retval EFI_INVALID_PARAMETER Invalid input parameter.
- @retval EFI_SUCCESS Operation successful.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiGetDefaultImage (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN UINTN DefaultMask,
- OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList
- )
-{
- LIST_ENTRY *UefiDefaults;
- EFI_STATUS Status;
- HII_THUNK_PRIVATE_DATA *Private;
- HII_THUNK_CONTEXT *ThunkContext;
-
- Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
-
- ThunkContext = FwHiiHandleToThunkContext (Private, Handle);
- if (ThunkContext == NULL) {
- ASSERT (FALSE);
- return EFI_INVALID_PARAMETER;
- }
-
- UefiDefaults = NULL;
- Status = UefiIfrGetBufferTypeDefaults (ThunkContext, &UefiDefaults);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Status = UefiDefaultsToFwDefaults (UefiDefaults, DefaultMask, ThunkContext->FormSet->DefaultVarStoreId, VariablePackList);
-
-Done:
- FreeDefaultList (UefiDefaults);
-
- return Status;
-}
-
-/**
- This function update the FormCallbackProtocol cached in Config Access
- private context data.
-
- @param CallbackHandle The EFI Handle on which the Framework FormCallbackProtocol is
- installed.
- @param ThunkContext The Thunk Context.
-
- @retval EFI_SUCCESS The update is successful.
- @retval EFI_INVALID_PARAMETER If no Framework FormCallbackProtocol is located on CallbackHandle.
-
-**/
-EFI_STATUS
-UpdateFormCallBack (
- IN EFI_HANDLE CallbackHandle,
- IN CONST HII_THUNK_CONTEXT *ThunkContext
- )
-{
- EFI_STATUS Status;
- EFI_FORM_CALLBACK_PROTOCOL *FormCallbackProtocol;
- EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccessProtocol;
- EFI_HANDLE UefiDriverHandle;
- CONFIG_ACCESS_PRIVATE *ConfigAccessPrivate;
-
- Status = gBS->HandleProtocol (
- CallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- (VOID **) &FormCallbackProtocol
- );
- if (EFI_ERROR (Status)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = mHiiDatabase->GetPackageListHandle (
- mHiiDatabase,
- ThunkContext->UefiHiiHandle,
- &UefiDriverHandle
- );
- ASSERT_EFI_ERROR (Status);
- Status = gBS->HandleProtocol (
- UefiDriverHandle,
- &gEfiHiiConfigAccessProtocolGuid,
- (VOID **) &ConfigAccessProtocol
- );
- ASSERT_EFI_ERROR (Status);
-
- ConfigAccessPrivate = CONFIG_ACCESS_PRIVATE_FROM_PROTOCOL (ConfigAccessProtocol);
-
- ConfigAccessPrivate->FormCallbackProtocol = FormCallbackProtocol;
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Get the package data from the Package List.
-
- @param HiiPackageList Package List.
- @param PackageIndex The index of the Package in the Package List.
- @param BufferLen The Length of the Pacage data.
- @param Buffer On output, the Package data.
-
- @return EFI_NOT_FOUND No Package is found for PackageIndex.
- @return EFI_SUCCESS The package data is returned.
-
-**/
-EFI_STATUS
-GetPackageData (
- IN EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList,
- IN UINT32 PackageIndex,
- OUT UINT32 *BufferLen,
- OUT EFI_HII_PACKAGE_HEADER **Buffer
- )
-{
- UINT32 Index;
- EFI_HII_PACKAGE_HEADER *Package;
- UINT32 Offset;
- UINT32 PackageListLength;
- EFI_HII_PACKAGE_HEADER PackageHeader;
-
- ASSERT(HiiPackageList != NULL);
-
- if ((BufferLen == NULL) || (Buffer == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&PackageHeader, sizeof (PackageHeader));
- Package = NULL;
- Index = 0;
- Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
- CopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32));
- while (Offset < PackageListLength) {
- Package = (EFI_HII_PACKAGE_HEADER *) (((UINT8 *) HiiPackageList) + Offset);
- CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
- if (Index == PackageIndex) {
- break;
- }
- Offset += PackageHeader.Length;
- Index++;
- }
- if (Offset >= PackageListLength) {
- //
- // no package found in this Package List
- //
- return EFI_NOT_FOUND;
- }
-
- *BufferLen = PackageHeader.Length;
- *Buffer = Package;
- return EFI_SUCCESS;
-}
-
-/**
- Check if Label exist in the IFR form package and return the FormSet GUID
- and Form ID.
-
- @param Package The Package Header.
- @param Label The Label ID.
- @param FormsetGuid Returns the FormSet GUID.
- @param FormId Returns the Form ID.
-
- @retval EFI_SUCCESS The FORM ID is found.
- @retval EFI_NOT_FOUND The FORM ID is not found.
-**/
-EFI_STATUS
-LocateLabel (
- IN CONST EFI_HII_PACKAGE_HEADER *Package,
- IN EFI_FORM_LABEL Label,
- OUT EFI_GUID *FormsetGuid,
- OUT EFI_FORM_ID *FormId
- )
-{
- UINTN Offset;
- EFI_IFR_OP_HEADER *IfrOpHdr;
- EFI_GUID InternalFormSetGuid;
- EFI_FORM_ID InternalFormId;
- BOOLEAN GetFormSet;
- BOOLEAN GetForm;
- EFI_IFR_GUID_LABEL *LabelOpcode;
-
- IfrOpHdr = (EFI_IFR_OP_HEADER *)((UINT8 *) Package + sizeof (EFI_HII_PACKAGE_HEADER));
- Offset = sizeof (EFI_HII_PACKAGE_HEADER);
-
- InternalFormId= 0;
- ZeroMem (&InternalFormSetGuid, sizeof (EFI_GUID));
- GetFormSet = FALSE;
- GetForm = FALSE;
-
- while (Offset < Package->Length) {
- switch (IfrOpHdr->OpCode) {
- case EFI_IFR_FORM_SET_OP :
- CopyMem (&InternalFormSetGuid, &((EFI_IFR_FORM_SET *) IfrOpHdr)->Guid, sizeof (EFI_GUID));
- GetFormSet = TRUE;
- break;
-
- case EFI_IFR_FORM_OP:
- CopyMem (&InternalFormId, &((EFI_IFR_FORM *) IfrOpHdr)->FormId, sizeof (EFI_FORM_ID));
- GetForm = TRUE;
- break;
-
- case EFI_IFR_GUID_OP :
- LabelOpcode = (EFI_IFR_GUID_LABEL *) IfrOpHdr;
- //
- // If it is an Label opcode.
- //
- if ((LabelOpcode->ExtendOpCode == EFI_IFR_EXTEND_OP_LABEL) && (CompareMem (&LabelOpcode->Guid, &mTianoHiiIfrGuid, sizeof (EFI_GUID)) == 0)) {
- if (CompareMem (&Label, &LabelOpcode->Number, sizeof (UINT16)) == 0) {
- ASSERT (GetForm && GetFormSet);
- CopyGuid (FormsetGuid, &InternalFormSetGuid);
- *FormId = InternalFormId;
- return EFI_SUCCESS;
- }
- }
- break;
- default :
- break;
- }
-
- //
- // Go to the next Op-Code
- //
- Offset += IfrOpHdr->Length;
- IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length);
- }
-
- return EFI_NOT_FOUND;
-}
-
-/**
- Find the first EFI_FORM_LABEL in FormSets for a given EFI_HII_HANLDE defined.
-
- EFI_FORM_LABEL is a specific to Tiano implementation. The current implementation
- does not restrict labels with same label value to be duplicated in either FormSet
- scope or Form scope. This function will only locate the FIRST EFI_FORM_LABEL
- with value as the same as the input Label in the Formset registered with UefiHiiHandle. The FormSet GUID
- and Form ID is returned if such Label is found.
-
- @param Handle Uefi Hii Handle to be searched.
- @param Label The first Label ID to be found.
- @param FormsetGuid The matched FormSet GUID.
- @param FormId The matched Form ID.
-
- @retval EFI_INVALID_PARAMETER If UefiHiiHandle is not a valid handle.
- @retval EFI_NOT_FOUND The package list identified by UefiHiiHandle deos not contain FormSet or
- Form ID with value Label found in all Form Sets in the pacakge list.
- @retval EFI_SUCCESS The first found Form ID is returned in FormId.
-**/
-EFI_STATUS
-LocateFormId (
- IN EFI_HII_HANDLE Handle,
- IN EFI_FORM_LABEL Label,
- OUT EFI_GUID *FormsetGuid,
- OUT EFI_FORM_ID *FormId
- )
-{
- EFI_STATUS Status;
- EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
- UINT32 Index;
- UINTN BufferSize;
- EFI_HII_PACKAGE_HEADER PackageHeader;
- EFI_HII_PACKAGE_HEADER *Package;
- UINT32 PackageLength;
-
- BufferSize = 0;
- HiiPackageList = NULL;
- Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
- if (Status == EFI_BUFFER_TOO_SMALL) {
- HiiPackageList = AllocatePool (BufferSize);
- ASSERT (HiiPackageList != NULL);
-
- Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- }
-
- for (Index = 0; ; Index++) {
- Status = GetPackageData (HiiPackageList, Index, &PackageLength, &Package);
- if (!EFI_ERROR (Status)) {
- CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
- if (PackageHeader.Type == EFI_HII_PACKAGE_FORMS) {
- Status = LocateLabel (Package, Label, FormsetGuid, FormId);
- if (!EFI_ERROR(Status)) {
- break;
- }
- }
- } else {
- break;
- }
- }
-
-
-Done:
- FreePool (HiiPackageList);
-
- return Status;
-}
-
-/**
- This function allows the caller to update a form that has
- previously been registered with the EFI HII database.
-
-
- @param This EDES_TODO: Add parameter description
- @param Handle Hii Handle associated with the Formset to modify
- @param Label Update information starting immediately after this label in the IFR
- @param AddData If TRUE, add data. If FALSE, remove data
- @param Data If adding data, this is the pointer to the data to add
-
- @retval EFI_SUCCESS Update success.
- @retval Other Update fail.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiThunkUpdateForm (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN EFI_FORM_LABEL Label,
- IN BOOLEAN AddData,
- IN EFI_HII_UPDATE_DATA *Data
- )
-{
- EFI_STATUS Status;
- HII_THUNK_PRIVATE_DATA *Private;
- HII_THUNK_CONTEXT *ThunkContext;
- EFI_HII_HANDLE UefiHiiHandle;
- EFI_GUID FormsetGuid;
- EFI_FORM_ID FormId;
- EFI_TPL OldTpl;
- VOID *StartOpCodeHandle;
- VOID *EndOpCodeHandle;
- EFI_IFR_GUID_LABEL *StartLabel;
- EFI_IFR_GUID_LABEL *EndLabel;
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- mInFrameworkUpdatePakcage = TRUE;
- Status = EFI_SUCCESS;
-
- Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
-
- ThunkContext = FwHiiHandleToThunkContext (Private, Handle);
-
- if (ThunkContext == NULL) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
-
- if (Data->FormSetUpdate) {
- Status = UpdateFormCallBack ((EFI_HANDLE) (UINTN) Data->FormCallbackHandle, ThunkContext);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- }
-
- if (ThunkContext->IfrPackageCount == 0) {
- ASSERT (FALSE);
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- } else {
- UefiHiiHandle = ThunkContext->UefiHiiHandle;
- }
-
- Status = LocateFormId (UefiHiiHandle, Label, &FormsetGuid, &FormId);
- if (EFI_ERROR (Status)) {
- //
- // Can't find the label.
- //
- goto Done;
- }
-
- //
- // Init OpCode Handle
- //
- StartOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (StartOpCodeHandle != NULL);
-
- EndOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (EndOpCodeHandle != NULL);
-
- //
- // Create Hii Extend Label OpCode as the start opcode
- //
- StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- StartLabel->Number = Label;
-
- //
- // Create Hii Extend Label OpCode as the end opcode
- //
- EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- EndLabel->Number = 0xffff;
-
- if (AddData) {
- if (Data->DataCount != 0) {
-
- ThunkContext = UefiHiiHandleToThunkContext (Private, UefiHiiHandle);
- ASSERT (ThunkContext != NULL);
- Status = FwUpdateDataToUefiUpdateData (ThunkContext, Data, StartOpCodeHandle);
- ASSERT_EFI_ERROR (Status);
-
- Status = HiiUpdateForm (UefiHiiHandle, &FormsetGuid, FormId, StartOpCodeHandle, NULL);
- ASSERT_EFI_ERROR (Status);
- }
- } else {
- //
- // Delete Opcode starting from Labe in FormId found
- //
- Status = HiiUpdateForm (UefiHiiHandle, &FormsetGuid, FormId, StartOpCodeHandle, EndOpCodeHandle);
- ASSERT_EFI_ERROR (Status);
- }
-
- HiiFreeOpCodeHandle (StartOpCodeHandle);
- HiiFreeOpCodeHandle (EndOpCodeHandle);
-
-Done:
-
- mInFrameworkUpdatePakcage = FALSE;
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/FrameworkHiiOnUefiHiiThunk.inf b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/FrameworkHiiOnUefiHiiThunk.inf
deleted file mode 100644
index 5e13683087..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/FrameworkHiiOnUefiHiiThunk.inf
+++ /dev/null
@@ -1,114 +0,0 @@
-## @file
-# Component description file for HiiDatabase module which produce a Framework HII Protocol instance
-# based on the avaliable UEFI HII protocol found in the platform. This modules enables modules complying
-# to Framework HII specification to able to run on a UEFI HII platform with only a rebuild. This is
-# to ensure that all HII packages are generated by UEFI HII package generation tools (UEFI VfrCompiler and
-# String Gather Tools). This thunk layer only produces the Frameowork HII protocol interface. The binary package
-# data format complying to UEFI HII specification.
-#
-# This module inits HII database and installs HII protocol based on the avaliable UEFI HII protocol found in the platform..
-# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = FrameworkHiiOnUefiHiiThunk
- FILE_GUID = AC3435BB-B1D3-4EF8-957C-8048606FF671
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitializeHiiDatabase
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- SetupBrowser.c
- SetupBrowser.h
- HiiHandle.c
- HiiHandle.h
- ConfigAccess.c
- ConfigAccess.h
- OpcodeCreation.c
- UefiIfrParser.c
- UefiIfrParser.h
- UefiIfrParserExpression.c
- UefiIfrParserExpression.h
- UefiIfrDefault.c
- UefiIfrDefault.h
- Keyboard.c
- Fonts.c
- Package.c
- Strings.c
- Forms.c
- HiiDatabase.h
- HiiDatabase.c
- Utility.c
- Utility.h
- Strings.uni
-
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- UefiRuntimeServicesTableLib
- UefiBootServicesTableLib
- BaseMemoryLib
- MemoryAllocationLib
- UefiDriverEntryPoint
- DebugLib
- BaseLib
- HiiLib
- PrintLib
- UefiLib
- PcdLib
- LanguageLib
-
-[Guids]
- gEfiIfrTianoGuid
- gEfiIfrFrameworkGuid
- gEfiHiiStandardFormGuid
- gFrameworkBdsFrontPageFormsetGuid
- gZeroGuid ## SOMETIMES_CONSUMES ## GUID
-
-[Protocols]
- gEfiHiiImageProtocolGuid
- gEfiHiiDatabaseProtocolGuid
- gEfiHiiStringProtocolGuid
- gEfiHiiFontProtocolGuid
- gEfiHiiConfigRoutingProtocolGuid
- gEfiHiiConfigAccessProtocolGuid
- gEfiFormCallbackProtocolGuid
- gEfiUnicodeCollation2ProtocolGuid
- gEfiHiiCompatibilityProtocolGuid
- gEfiFormBrowserCompatibilityProtocolGuid
-
-[Pcd]
- gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
-
-[Depex]
- gEfiHiiDatabaseProtocolGuid AND
- gEfiHiiStringProtocolGuid AND
- gEfiHiiConfigRoutingProtocolGuid AND
- gEfiHiiFontProtocolGuid AND
- gEfiFormBrowser2ProtocolGuid
-
-
-
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.c
deleted file mode 100644
index 2d456da303..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.c
+++ /dev/null
@@ -1,546 +0,0 @@
-/** @file
-Framework to UEFI 2.1 HII Thunk. The driver consume UEFI HII protocols
-to produce a Framework HII protocol.
-
-Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "HiiDatabase.h"
-#include "HiiHandle.h"
-
-HII_THUNK_PRIVATE_DATA *mHiiThunkPrivateData;
-
-HII_THUNK_PRIVATE_DATA mHiiThunkPrivateDataTempate = {
- HII_THUNK_PRIVATE_DATA_SIGNATURE,
- (EFI_HANDLE) NULL,
- {
- HiiNewPack,
- HiiRemovePack,
- HiiFindHandles,
- HiiExportDatabase,
-
- HiiTestString,
- HiiGetGlyph,
- HiiGlyphToBlt,
-
- HiiNewString,
- HiiGetPrimaryLanguages,
- HiiGetSecondaryLanguages,
- HiiThunkGetString,
- HiiResetStrings,
- HiiGetLine,
- HiiGetForms,
- HiiGetDefaultImage,
- HiiThunkUpdateForm,
-
- HiiGetKeyboardLayout
- },
-
- {
- ///
- /// HiiHandleLinkList
- ///
- NULL, NULL
- },
-};
-
-EFI_FORMBROWSER_THUNK_PRIVATE_DATA mBrowserThunkPrivateDataTemplate = {
- EFI_FORMBROWSER_THUNK_PRIVATE_DATA_SIGNATURE,
- (EFI_HANDLE) NULL,
- (HII_THUNK_PRIVATE_DATA *) NULL,
- {
- ThunkSendForm,
- ThunkCreatePopUp
- }
-};
-
-
-CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
-CONST EFI_HII_IMAGE_PROTOCOL *mHiiImageProtocol;
-CONST EFI_HII_STRING_PROTOCOL *mHiiStringProtocol;
-CONST EFI_HII_FONT_PROTOCOL *mHiiFontProtocol;
-CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRoutingProtocol;
-CONST EFI_FORM_BROWSER2_PROTOCOL *mFormBrowser2Protocol;
-
-
-/**
- This routine initializes the HII Database.
-
- @param ImageHandle Image handle for PCD DXE driver.
- @param SystemTable Pointer to SystemTable.
-
- @retval EFI_SUCCESS The entry point alwasy return successfully.
-**/
-EFI_STATUS
-EFIAPI
-InitializeHiiDatabase (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- HII_THUNK_PRIVATE_DATA *Private;
- EFI_HANDLE Handle;
- EFI_STATUS Status;
- UINTN BufferLength;
- EFI_HII_HANDLE *Buffer;
- UINTN Index;
- HII_THUNK_CONTEXT *ThunkContext;
-
-
- ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiCompatibilityProtocolGuid);
- ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiFormBrowserCompatibilityProtocolGuid);
-
- Private = AllocateCopyPool (sizeof (HII_THUNK_PRIVATE_DATA), &mHiiThunkPrivateDataTempate);
- ASSERT (Private != NULL);
- InitializeListHead (&Private->ThunkContextListHead);
-
- InitHiiHandleDatabase ();
-
- mHiiThunkPrivateData = Private;
-
- Status = gBS->LocateProtocol (
- &gEfiHiiDatabaseProtocolGuid,
- NULL,
- (VOID **) &mHiiDatabase
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->LocateProtocol (
- &gEfiHiiStringProtocolGuid,
- NULL,
- (VOID **) &mHiiStringProtocol
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->LocateProtocol (
- &gEfiHiiFontProtocolGuid,
- NULL,
- (VOID **) &mHiiFontProtocol
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->LocateProtocol (
- &gEfiHiiConfigRoutingProtocolGuid,
- NULL,
- (VOID **) &mHiiConfigRoutingProtocol
- );
- ASSERT_EFI_ERROR (Status);
-
-
- Status = gBS->LocateProtocol (
- &gEfiFormBrowser2ProtocolGuid,
- NULL,
- (VOID **) &mFormBrowser2Protocol
- );
- ASSERT_EFI_ERROR (Status);
-
-
-
-
- //
- // Install protocol interface
- //
- Status = gBS->InstallProtocolInterface (
- &Private->Handle,
- &gEfiHiiCompatibilityProtocolGuid,
- EFI_NATIVE_INTERFACE,
- (VOID *) &Private->Hii
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = ListPackageLists (EFI_HII_PACKAGE_STRINGS, NULL, &BufferLength, &Buffer);
- if (Status == EFI_SUCCESS) {
- ASSERT (Buffer != NULL);
- for (Index = 0; Index < BufferLength / sizeof (EFI_HII_HANDLE); Index++) {
- ThunkContext = CreateThunkContextForUefiHiiHandle (Buffer[Index]);
- ASSERT (ThunkContext!= NULL);
-
- InsertTailList (&Private->ThunkContextListHead, &ThunkContext->Link);
- }
-
- FreePool (Buffer);
- }
-
- Status = mHiiDatabase->RegisterPackageNotify (
- mHiiDatabase,
- EFI_HII_PACKAGE_STRINGS,
- NULL,
- NewOrAddPackNotify,
- EFI_HII_DATABASE_NOTIFY_NEW_PACK,
- &Handle
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = mHiiDatabase->RegisterPackageNotify (
- mHiiDatabase,
- EFI_HII_PACKAGE_STRINGS,
- NULL,
- NewOrAddPackNotify,
- EFI_HII_DATABASE_NOTIFY_ADD_PACK,
- &Handle
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = mHiiDatabase->RegisterPackageNotify (
- mHiiDatabase,
- EFI_HII_PACKAGE_FORMS,
- NULL,
- NewOrAddPackNotify,
- EFI_HII_DATABASE_NOTIFY_NEW_PACK,
- &Handle
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = mHiiDatabase->RegisterPackageNotify (
- mHiiDatabase,
- EFI_HII_PACKAGE_FORMS,
- NULL,
- NewOrAddPackNotify,
- EFI_HII_DATABASE_NOTIFY_ADD_PACK,
- &Handle
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = mHiiDatabase->RegisterPackageNotify (
- mHiiDatabase,
- EFI_HII_PACKAGE_STRINGS,
- NULL,
- RemovePackNotify,
- EFI_HII_DATABASE_NOTIFY_REMOVE_PACK,
- &Handle
- );
- ASSERT_EFI_ERROR (Status);
-
- InitSetBrowserStrings ();
-
- mBrowserThunkPrivateDataTemplate.ThunkPrivate = Private;
- Status = gBS->InstallProtocolInterface (
- &mBrowserThunkPrivateDataTemplate.Handle,
- &gEfiFormBrowserCompatibilityProtocolGuid,
- EFI_NATIVE_INTERFACE,
- (VOID *) &mBrowserThunkPrivateDataTemplate.FormBrowser
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-/**
- Determines the handles that are currently active in the database.
-
- This function determines the handles that are currently active in the database.
- For example, a program wishing to create a Setup-like configuration utility would use this call
- to determine the handles that are available. It would then use calls defined in the forms section
- below to extract forms and then interpret them.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param HandleBufferLength On input, a pointer to the length of the handle buffer.
- On output, the length of the handle buffer that is required for the handles found.
- @param Handle Pointer to an array of EFI_HII_HANDLE instances returned.
- Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack() in the Packages section.
-
- @retval EFI_SUCCESS Handle was updated successfully.
-
- @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter indicates that Handle is too small
- to support the number of handles. HandleBufferLength is updated with a value that
- will enable the data to fit.
-**/
-EFI_STATUS
-EFIAPI
-HiiFindHandles (
- IN EFI_HII_PROTOCOL *This,
- IN OUT UINT16 *HandleBufferLength,
- OUT FRAMEWORK_EFI_HII_HANDLE *Handle
- )
-{
- UINT16 Count;
- LIST_ENTRY *Link;
- HII_THUNK_CONTEXT *ThunkContext;
- HII_THUNK_PRIVATE_DATA *Private;
-
- if (HandleBufferLength == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
-
- //
- // Count the number of handles.
- //
- Count = 0;
- Link = GetFirstNode (&Private->ThunkContextListHead);
- while (!IsNull (&Private->ThunkContextListHead, Link)) {
- Count++;
- Link = GetNextNode (&Private->ThunkContextListHead, Link);
- }
-
- if (Count > *HandleBufferLength) {
- *HandleBufferLength = (UINT16) (Count * sizeof (FRAMEWORK_EFI_HII_HANDLE));
- return EFI_BUFFER_TOO_SMALL;
- }
-
- //
- // Output the handles.
- //
- Count = 0;
- Link = GetFirstNode (&Private->ThunkContextListHead);
- while (!IsNull (&Private->ThunkContextListHead, Link)) {
-
- ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
- Handle[Count] = ThunkContext->FwHiiHandle;
-
- Count++;
- Link = GetNextNode (&Private->ThunkContextListHead, Link);
-
- }
-
- *HandleBufferLength = (UINT16) (Count * sizeof (FRAMEWORK_EFI_HII_HANDLE));
- return EFI_SUCCESS;
-}
-
-/**
- Allows a program to determine the primary languages that are supported on a given handle.
-
- This routine is intended to be used by drivers to query the interface database for supported languages.
- This routine returns a string of concatenated 3-byte language identifiers, one per string package associated with the handle.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle The handle on which the strings reside. Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack()
- in the Packages section.
- @param LanguageString A string allocated by GetPrimaryLanguages() that contains a list of all primary languages
- registered on the handle. The routine will not return the three-spaces language identifier used in
- other functions to indicate non-language-specific strings.
-
- @retval EFI_SUCCESS LanguageString was correctly returned.
-
- @retval EFI_INVALID_PARAMETER The Handle was unknown.
-**/
-EFI_STATUS
-EFIAPI
-HiiGetPrimaryLanguages (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- OUT EFI_STRING *LanguageString
- )
-{
- HII_THUNK_PRIVATE_DATA *Private;
- EFI_HII_HANDLE UefiHiiHandle;
- CHAR8 *LangCodes4646;
- CHAR16 *UnicodeLangCodes639;
- CHAR8 *LangCodes639;
- EFI_STATUS Status;
-
- Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
-
- UefiHiiHandle = FwHiiHandleToUefiHiiHandle (Private, Handle);
- if (UefiHiiHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- LangCodes4646 = HiiGetSupportedLanguages (UefiHiiHandle);
-
- if (LangCodes4646 == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- LangCodes639 = ConvertLanguagesRfc4646ToIso639 (LangCodes4646);
- if (LangCodes639 == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- UnicodeLangCodes639 = AllocateZeroPool (AsciiStrSize (LangCodes639) * sizeof (CHAR16));
- if (UnicodeLangCodes639 == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- //
- // The language returned is in RFC 639-2 format.
- //
- AsciiStrToUnicodeStr (LangCodes639, UnicodeLangCodes639);
- *LanguageString = UnicodeLangCodes639;
- Status = EFI_SUCCESS;
-
-Done:
- FreePool (LangCodes4646);
- if (LangCodes639 != NULL) {
- FreePool (LangCodes639);
- }
-
- return Status;
-}
-
-/**
- This function returns the list of supported 2nd languages, in the format specified
- in UEFI specification Appendix M.
-
- If HiiHandle is not a valid Handle in the HII database, then ASSERT.
- If not enough resource to complete the operation, then ASSERT.
-
- @param HiiHandle The HII package list handle.
- @param PrimaryLanguage Pointer to language name buffer.
-
- @return The supported languages.
-
-**/
-CHAR8 *
-EFIAPI
-HiiGetSupportedSecondaryLanguages (
- IN EFI_HII_HANDLE HiiHandle,
- IN CONST CHAR8 *PrimaryLanguage
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- CHAR8 *LanguageString;
-
- ASSERT (HiiHandle != NULL);
-
- //
- // Collect current supported 2nd Languages for given HII handle
- // First try allocate 4K buffer to store the current supported 2nd languages.
- //
- BufferSize = 0x1000;
- LanguageString = AllocateZeroPool (BufferSize);
- if (LanguageString == NULL) {
- return NULL;
- }
-
- Status = mHiiStringProtocol->GetSecondaryLanguages (mHiiStringProtocol, HiiHandle, PrimaryLanguage, LanguageString, &BufferSize);
- ASSERT (Status != EFI_NOT_FOUND);
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
- FreePool (LanguageString);
- LanguageString = AllocateZeroPool (BufferSize);
- if (LanguageString == NULL) {
- return NULL;
- }
-
- Status = mHiiStringProtocol->GetSecondaryLanguages (mHiiStringProtocol, HiiHandle, PrimaryLanguage, LanguageString, &BufferSize);
- }
-
- if (EFI_ERROR (Status)) {
- LanguageString = NULL;
- }
-
- return LanguageString;
-}
-
-/**
- Allows a program to determine which secondary languages are supported on a given handle for a given primary language
-
- This routine is intended to be used by drivers to query the interface database for supported languages.
- This routine returns a string of concatenated 3-byte language identifiers, one per string package associated with the handle.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle The handle on which the strings reside. Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack()
- in the Packages section.
- @param PrimaryLanguage Pointer to a NULL-terminated string containing a single ISO 639-2 language identifier, indicating
- the primary language.
- @param LanguageString A string allocated by GetSecondaryLanguages() containing a list of all secondary languages registered
- on the handle. The routine will not return the three-spaces language identifier used in other functions
- to indicate non-language-specific strings, nor will it return the primary language. This function succeeds
- but returns a NULL LanguageString if there are no secondary languages associated with the input Handle and
- PrimaryLanguage pair. Type EFI_STRING is defined in String.
-
- @retval EFI_SUCCESS LanguageString was correctly returned.
- @retval EFI_INVALID_PARAMETER The Handle was unknown.
-**/
-EFI_STATUS
-EFIAPI
-HiiGetSecondaryLanguages (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN CHAR16 *PrimaryLanguage,
- OUT EFI_STRING *LanguageString
- )
-{
- HII_THUNK_PRIVATE_DATA *Private;
- EFI_HII_HANDLE UefiHiiHandle;
- CHAR8 *PrimaryLang4646;
- CHAR8 *PrimaryLang639;
- CHAR8 *SecLangCodes4646;
- CHAR8 *SecLangCodes639;
- CHAR16 *UnicodeSecLangCodes639;
- EFI_STATUS Status;
-
- Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
-
- SecLangCodes639 = NULL;
- SecLangCodes4646 = NULL;
- PrimaryLang4646 = NULL;
- UnicodeSecLangCodes639 = NULL;
-
- UefiHiiHandle = FwHiiHandleToUefiHiiHandle (Private, Handle);
- if (UefiHiiHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- PrimaryLang639 = AllocateZeroPool (StrLen (PrimaryLanguage) + 1);
- if (PrimaryLang639 == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- UnicodeStrToAsciiStr (PrimaryLanguage, PrimaryLang639);
-
- PrimaryLang4646 = ConvertLanguagesIso639ToRfc4646 (PrimaryLang639);
- ASSERT (PrimaryLang4646 != NULL);
-
- SecLangCodes4646 = HiiGetSupportedSecondaryLanguages (UefiHiiHandle, PrimaryLang4646);
-
- if (SecLangCodes4646 == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- SecLangCodes639 = ConvertLanguagesIso639ToRfc4646 (SecLangCodes4646);
- if (SecLangCodes639 == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- UnicodeSecLangCodes639 = AllocateZeroPool (AsciiStrSize (SecLangCodes639) * sizeof (CHAR16));
- if (UnicodeSecLangCodes639 == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- //
- // The language returned is in RFC 4646 format.
- //
- *LanguageString = AsciiStrToUnicodeStr (SecLangCodes639, UnicodeSecLangCodes639);
- Status = EFI_SUCCESS;
-
-Done:
- if (PrimaryLang639 != NULL) {
- FreePool (PrimaryLang639);
- }
-
- if (SecLangCodes639 != NULL) {
- FreePool (SecLangCodes639);
- }
-
- if (PrimaryLang4646 != NULL) {
- FreePool (PrimaryLang4646);
- }
-
- if (SecLangCodes4646 != NULL) {
- FreePool (SecLangCodes4646);
- }
- if (UnicodeSecLangCodes639 != NULL) {
- FreePool (UnicodeSecLangCodes639);
- }
-
- return Status;
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h
deleted file mode 100644
index c736990f3e..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h
+++ /dev/null
@@ -1,947 +0,0 @@
-/** @file
-
- This file contains global defines and prototype definitions
- for the Framework HII to Uefi HII Thunk Module.
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#ifndef _HIIDATABASE_H_
-#define _HIIDATABASE_H_
-
-
-#include <FrameworkDxe.h>
-
-#include <Guid/GlobalVariable.h>
-#include <Protocol/FrameworkFormCallback.h>
-#include <Protocol/FrameworkHii.h>
-#include <Protocol/FrameworkFormBrowser.h>
-
-//
-// UEFI HII Protocols
-//
-#include <Protocol/HiiFont.h>
-#include <Protocol/HiiImage.h>
-#include <Protocol/HiiString.h>
-#include <Protocol/HiiDatabase.h>
-#include <Protocol/HiiConfigRouting.h>
-#include <Protocol/HiiConfigAccess.h>
-#include <Protocol/UgaDraw.h>
-#include <Guid/HiiFormMapMethodGuid.h>
-#include <Guid/FrameworkBdsFrontPageFormSet.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/HiiLib.h>
-#include <Library/UefiLib.h>
-#include <Library/PcdLib.h>
-#include <Library/LanguageLib.h>
-#include <Library/PrintLib.h>
-
-#include <Guid/MdeModuleHii.h>
-
-#include "UefiIfrParser.h"
-
-
-//
-// VARSTORE ID of 0 for Buffer Storage Type Storage is defined as invalid in UEFI 2.1 HII. VARSTORE ID
-// 0 is the default VarStore ID for storage without explicit declaration in Framework HII 0.92. EDK II UEFI VFR compiler
-// in compatible mode will assign 0x0001 as UEFI VARSTORE ID to this default storage id in Framework VFR without
-// VARSTORE declaration.
-//
-// In addition, the Name of Default VarStore is assumed to be L"Setup" for those storage without explicit VARSTORE declaration in the formset
-// by Framework HII. EDK II UEFI VFR compiler in compatible mode hard-coded L"Setup" as VARSTORE name.
-//
-#define FRAMEWORK_RESERVED_VARSTORE_ID 0x0001
-#define FRAMEWORK_RESERVED_VARSTORE_NAME L"Setup"
-
-///
-/// The size of a 3 character ISO639 language code.
-///
-#define ISO_639_2_ENTRY_SIZE 3
-
-#pragma pack (1)
-typedef struct {
- EFI_HII_PACK_HEADER FrameworkPackageHeader;
- EFI_HII_PACKAGE_HEADER PackageHeader;
-} TIANO_AUTOGEN_PACKAGES_HEADER;
-#pragma pack ()
-
-#define HII_THUNK_PRIVATE_DATA_FROM_THIS(Record) CR(Record, HII_THUNK_PRIVATE_DATA, Hii, HII_THUNK_PRIVATE_DATA_SIGNATURE)
-#define HII_THUNK_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('H', 'i', 'I', 'T')
-typedef struct {
- UINTN Signature;
- EFI_HANDLE Handle;
- EFI_HII_PROTOCOL Hii;
-
- //
- // The head of link list for all HII_THUNK_CONTEXT.
- //
- LIST_ENTRY ThunkContextListHead;
-
- EFI_HANDLE RemovePackNotifyHandle;
- EFI_HANDLE AddPackNotifyHandle;
-} HII_THUNK_PRIVATE_DATA;
-
-
-
-
-
-#define QUESTION_ID_MAP_ENTRY_FROM_LINK(Record) CR(Record, QUESTION_ID_MAP_ENTRY, Link, QUESTION_ID_MAP_ENTRY_SIGNATURE)
-#define QUESTION_ID_MAP_ENTRY_SIGNATURE SIGNATURE_32 ('Q', 'I', 'M', 'E')
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- UINT16 FwQId;
- EFI_QUESTION_ID UefiQid;
-} QUESTION_ID_MAP_ENTRY;
-
-
-
-#define QUESTION_ID_MAP_FROM_LINK(Record) CR(Record, QUESTION_ID_MAP, Link, QUESTION_ID_MAP_SIGNATURE)
-#define QUESTION_ID_MAP_SIGNATURE SIGNATURE_32 ('Q', 'I', 'M', 'P')
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- UINT16 VarStoreId;
- UINTN VarSize;
- LIST_ENTRY MapEntryListHead;
-} QUESTION_ID_MAP;
-
-
-
-#define HII_THUNK_CONTEXT_FROM_LINK(Record) CR(Record, HII_THUNK_CONTEXT, Link, HII_THUNK_CONTEXT_SIGNATURE)
-#define HII_THUNK_CONTEXT_SIGNATURE SIGNATURE_32 ('H', 'T', 'H', 'M')
-typedef struct {
- LIST_ENTRY Link;
- UINT32 Signature;
- FRAMEWORK_EFI_HII_HANDLE FwHiiHandle;
- EFI_HII_HANDLE UefiHiiHandle;
- EFI_HANDLE UefiHiiDriverHandle;
-
- UINTN IfrPackageCount;
- UINTN StringPackageCount;
-
- BOOLEAN ByFrameworkHiiNewPack;
-
- //
- // HII Thunk will use TagGuid to associate the String Package and Form Package togehter.
- // See description for TagGuid. This field is to record if either one of the following condition
- // is TRUE:
- // 1) if ((SharingStringPack == TRUE) && (StringPackageCount != 0 && IfrPackageCount == 0)), then this Package List only
- /// has String Packages and provides Strings to other IFR package.
- // 2) if ((SharingStringPack == TRUE) && (StringPackageCount == 0 && IfrPackageCount != 1)), then this Form Package
- // copied String Packages from other Package List.
- // 3) if ((SharingStringPack == FALSE)), this Package does not provide String Package or copy String Packages from other
- // Package List.
- //
- //
- // When a Hii->NewString() is called for this FwHiiHandle and SharingStringPack is TRUE, then all Package List that sharing
- // the same TagGuid will update or create String in there respective String Packages. If SharingStringPack is FALSE, then
- // only the String from String Packages in this Package List will be updated or created.
- //
- BOOLEAN SharingStringPack;
-
- //
- // The HII 0.92 version of HII data implementation in EDK 1.03 and 1.04 make an the following assumption
- // in both HII Database implementation and all modules that registering packages:
- // If a Package List has only IFR package and no String Package, the IFR package will reference
- // String in another Package List registered with the HII database with the same EFI_HII_PACKAGES.GuidId.
- // TagGuid is the used to record this GuidId.
- EFI_GUID TagGuid;
-
- UINT8 *NvMapOverride;
-
- FORM_BROWSER_FORMSET *FormSet;
-
-} HII_THUNK_CONTEXT;
-
-
-
-#define BUFFER_STORAGE_ENTRY_SIGNATURE SIGNATURE_32 ('H', 'T', 's', 'k')
-#define BUFFER_STORAGE_ENTRY_FROM_LINK(Record) CR(Record, BUFFER_STORAGE_ENTRY, Link, BUFFER_STORAGE_ENTRY_SIGNATURE)
-typedef struct {
- LIST_ENTRY Link;
- UINT32 Signature;
- EFI_GUID Guid;
- CHAR16 *Name;
- UINTN Size;
- UINT16 VarStoreId;
-} BUFFER_STORAGE_ENTRY;
-
-#pragma pack(1)
-///
-/// HII specific Vendor Device Path Node definition.
-///
-typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- UINT32 Reserved;
- UINT64 UniqueId;
-} HII_VENDOR_DEVICE_PATH_NODE;
-
-///
-/// HII specific Vendor Device Path definition.
-///
-typedef struct {
- HII_VENDOR_DEVICE_PATH_NODE Node;
- EFI_DEVICE_PATH_PROTOCOL End;
-} HII_VENDOR_DEVICE_PATH;
-#pragma pack()
-
-#define CONFIG_ACCESS_PRIVATE_SIGNATURE SIGNATURE_32 ('H', 'T', 'c', 'a')
-#define CONFIG_ACCESS_PRIVATE_FROM_PROTOCOL(Record) CR(Record, CONFIG_ACCESS_PRIVATE, ConfigAccessProtocol, CONFIG_ACCESS_PRIVATE_SIGNATURE)
-typedef struct {
- UINT32 Signature;
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccessProtocol;
- //
- // Framework's callback
- //
- EFI_FORM_CALLBACK_PROTOCOL *FormCallbackProtocol;
-
- HII_THUNK_CONTEXT *ThunkContext;
-} CONFIG_ACCESS_PRIVATE;
-
-
-
-#define EFI_FORMBROWSER_THUNK_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('F', 'B', 'T', 'd')
-#define EFI_FORMBROWSER_THUNK_PRIVATE_DATA_FROM_THIS(Record) CR(Record, EFI_FORMBROWSER_THUNK_PRIVATE_DATA, FormBrowser, EFI_FORMBROWSER_THUNK_PRIVATE_DATA_SIGNATURE)
-typedef struct {
- UINTN Signature;
- EFI_HANDLE Handle;
- HII_THUNK_PRIVATE_DATA *ThunkPrivate;
- EFI_FORM_BROWSER_PROTOCOL FormBrowser;
-} EFI_FORMBROWSER_THUNK_PRIVATE_DATA;
-
-
-//
-// Extern Variables
-//
-extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
-extern CONST EFI_HII_IMAGE_PROTOCOL *mHiiImageProtocol;
-extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProtocol;
-extern CONST EFI_HII_FONT_PROTOCOL *mHiiFontProtocol;
-extern CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRoutingProtocol;
-extern CONST EFI_FORM_BROWSER2_PROTOCOL *mFormBrowser2Protocol;
-
-extern HII_THUNK_PRIVATE_DATA *mHiiThunkPrivateData;
-
-extern BOOLEAN mInFrameworkUpdatePakcage;
-
-
-/**
-
- Registers the various packages that are passed in a Package List.
-
- @param This Pointer of Frameowk HII protocol instance.
- @param Packages Pointer of HII packages.
- @param Handle Handle value to be returned.
-
- @retval EFI_SUCCESS Packages has added to HII database successfully.
- @retval EFI_INVALID_PARAMETER If Handle or Packages is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiNewPack (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_PACKAGES *Packages,
- OUT FRAMEWORK_EFI_HII_HANDLE *Handle
- );
-
-/**
-
- Remove a package from the HII database.
-
- @param This Pointer of Frameowk HII protocol instance.
- @param Handle Handle value to be removed.
-
- @retval EFI_SUCCESS Packages has added to HII database successfully.
- @retval EFI_INVALID_PARAMETER If Handle or Packages is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiRemovePack (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle
- );
-
-/**
- Determines the handles that are currently active in the database.
-
- This function determines the handles that are currently active in the database.
- For example, a program wishing to create a Setup-like configuration utility would use this call
- to determine the handles that are available. It would then use calls defined in the forms section
- below to extract forms and then interpret them.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param HandleBufferLength On input, a pointer to the length of the handle buffer.
- On output, the length of the handle buffer that is required for the handles found.
- @param Handle Pointer to an array of EFI_HII_HANDLE instances returned.
- Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack() in the Packages section.
-
- @retval EFI_SUCCESS Handle was updated successfully.
-
- @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter indicates that Handle is too small
- to support the number of handles. HandleBufferLength is updated with a value that
- will enable the data to fit.
-**/
-EFI_STATUS
-EFIAPI
-HiiFindHandles (
- IN EFI_HII_PROTOCOL *This,
- IN OUT UINT16 *HandleBufferLength,
- OUT FRAMEWORK_EFI_HII_HANDLE *Handle
- );
-
-/**
-
- This thunk module only handles UEFI HII packages. The caller of this function
- won't be able to parse the content. Therefore, it is not supported.
-
- This function will ASSERT and return EFI_UNSUPPORTED.
-
- @param This N.A.
- @param Handle N.A.
- @param BufferSize N.A.
- @param Buffer N.A.
-
- @retval EFI_UNSUPPORTED
-
-**/
-EFI_STATUS
-EFIAPI
-HiiExportDatabase (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- );
-
-/**
- Translates a Unicode character into the corresponding font glyph.
-
- Notes:
- This function is only called by Graphics Console module and GraphicsLib.
- Wrap the Framework HII GetGlyph function to UEFI Font Protocol.
-
- EDK II provides a UEFI Graphics Console module. ECP provides a GraphicsLib
- complying to UEFI HII.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Source A pointer to a Unicode string.
- @param Index On input, the offset into the string from which to fetch the character. On successful completion, the
- index is updated to the first character past the character(s) making up the just extracted glyph.
- @param GlyphBuffer Pointer to an array where the glyphs corresponding to the characters in the source may be stored.
- GlyphBuffer is assumed to be wide enough to accept a wide glyph character.
- @param BitWidth If EFI_SUCCESS was returned, the UINT16 pointed to by this value is filled with the length of the glyph in pixels.
- It is unchanged if the call was unsuccessful.
- @param InternalStatus To save the time required to read the string from the beginning on each glyph extraction
- (for example, to ensure that the narrow versus wide glyph mode is correct), this value is
- updated each time the function is called with the status that is local to the call. The cell pointed
- to by this parameter must be initialized to zero prior to invoking the call the first time for any string.
-
- @retval EFI_SUCCESS It worked.
- @retval EFI_NOT_FOUND A glyph for a character was not found.
-
-
-**/
-EFI_STATUS
-EFIAPI
-HiiGetGlyph (
- IN EFI_HII_PROTOCOL *This,
- IN CHAR16 *Source,
- IN OUT UINT16 *Index,
- OUT UINT8 **GlyphBuffer,
- OUT UINT16 *BitWidth,
- IN OUT UINT32 *InternalStatus
- );
-
-/**
- Translates a glyph into the format required for input to the Universal Graphics Adapter (UGA) Block Transfer (BLT) routines.
-
- Notes:
- This function is only called by Graphics Console module and GraphicsLib.
- EDK II provides a UEFI Graphics Console module. ECP provides a GraphicsLib
- complying to UEFI HII.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param GlyphBuffer A pointer to the buffer that contains glyph data.
- @param Foreground The foreground setting requested to be used for the generated BltBuffer data. Type EFI_UGA_PIXEL is defined in "Related Definitions" below.
- @param Background The background setting requested to be used for the generated BltBuffer data.
- @param Count The entry in the BltBuffer upon which to act.
- @param Width The width in bits of the glyph being converted.
- @param Height The height in bits of the glyph being converted
- @param BltBuffer A pointer to the buffer that contains the data that is ready to be used by the UGA BLT routines.
-
- @retval EFI_SUCCESS It worked.
- @retval EFI_NOT_FOUND A glyph for a character was not found.
-
-
-**/
-EFI_STATUS
-EFIAPI
-HiiGlyphToBlt (
- IN EFI_HII_PROTOCOL *This,
- IN UINT8 *GlyphBuffer,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
- IN UINTN Count,
- IN UINTN Width,
- IN UINTN Height,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
- );
-
-/**
- Create or update a String Token in a String Package.
-
- If *Reference == 0, a new String Token is created.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Language Pointer to a NULL-terminated string containing a single ISO 639-2 language
- identifier, indicating the language to print. A string consisting of
- all spaces indicates that the string is applicable to all languages.
- @param Handle The handle of the language pack to which the string is to be added.
- @param Reference The string token assigned to the string.
- @param NewString The string to be added.
-
-
- @retval EFI_SUCCESS The string was effectively registered.
- @retval EFI_INVALID_PARAMETER The Handle was unknown. The string is not created or updated in the
- the string package.
-**/
-EFI_STATUS
-EFIAPI
-HiiNewString (
- IN EFI_HII_PROTOCOL *This,
- IN CHAR16 *Language,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN OUT STRING_REF *Reference,
- IN CHAR16 *NewString
- );
-
-/**
- This function extracts a string from a package already registered with the EFI HII database.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle The HII handle on which the string resides.
- @param Token The string token assigned to the string.
- @param Raw If TRUE, the string is returned unedited in the internal storage format described
- above. If false, the string returned is edited by replacing <cr> with <space>
- and by removing special characters such as the <wide> prefix.
- @param LanguageString Pointer to a NULL-terminated string containing a single ISO 639-2 language
- identifier, indicating the language to print. If the LanguageString is empty (starts
- with a NULL), the default system language will be used to determine the language.
- @param BufferLength Length of the StringBuffer. If the status reports that the buffer width is too
- small, this parameter is filled with the length of the buffer needed.
- @param StringBuffer The buffer designed to receive the characters in the string. Type EFI_STRING is
- defined in String.
-
- @retval EFI_INVALID_PARAMETER If input parameter is invalid.
- @retval EFI_BUFFER_TOO_SMALL If the *BufferLength is too small.
- @retval EFI_SUCCESS Operation is successful.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiThunkGetString (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN STRING_REF Token,
- IN BOOLEAN Raw,
- IN CHAR16 *LanguageString,
- IN OUT UINTN *BufferLength,
- OUT EFI_STRING StringBuffer
- );
-
-/**
- This function removes any new strings that were added after the initial string export for this handle.
- UEFI HII String Protocol does not have Reset String function. This function perform nothing.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle The HII handle on which the string resides.
-
- @retval EFI_SUCCESS This function is a NOP and always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiResetStrings (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle
- );
-
-/**
- Test if all of the characters in a string have corresponding font characters.
-
- This is a deprecated API. No Framework HII module is calling it. This function will ASSERT and
- return EFI_UNSUPPORTED.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param StringToTest A pointer to a Unicode string.
- @param FirstMissing A pointer to an index into the string. On input, the index of
- the first character in the StringToTest to examine. On exit, the index
- of the first character encountered for which a glyph is unavailable.
- If all glyphs in the string are available, the index is the index of the terminator
- of the string.
- @param GlyphBufferSize A pointer to a value. On output, if the function returns EFI_SUCCESS,
- it contains the amount of memory that is required to store the string? glyph equivalent.
-
- @retval EFI_UNSUPPORTED The function performs nothing and return EFI_UNSUPPORTED.
-**/
-EFI_STATUS
-EFIAPI
-HiiTestString (
- IN EFI_HII_PROTOCOL *This,
- IN CHAR16 *StringToTest,
- IN OUT UINT32 *FirstMissing,
- OUT UINT32 *GlyphBufferSize
- );
-
-/**
- Allows a program to determine the primary languages that are supported on a given handle.
-
- This routine is intended to be used by drivers to query the interface database for supported languages.
- This routine returns a string of concatenated 3-byte language identifiers, one per string package associated with the handle.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle The handle on which the strings reside. Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack()
- in the Packages section.
- @param LanguageString A string allocated by GetPrimaryLanguages() that contains a list of all primary languages
- registered on the handle. The routine will not return the three-spaces language identifier used in
- other functions to indicate non-language-specific strings.
-
- @retval EFI_SUCCESS LanguageString was correctly returned.
-
- @retval EFI_INVALID_PARAMETER The Handle was unknown.
-**/
-EFI_STATUS
-EFIAPI
-HiiGetPrimaryLanguages (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- OUT EFI_STRING *LanguageString
- );
-
-/**
- Allows a program to determine which secondary languages are supported on a given handle for a given primary language
-
- This routine is intended to be used by drivers to query the interface database for supported languages.
- This routine returns a string of concatenated 3-byte language identifiers, one per string package associated with the handle.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle The handle on which the strings reside. Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack()
- in the Packages section.
- @param PrimaryLanguage Pointer to a NULL-terminated string containing a single ISO 639-2 language identifier, indicating
- the primary language.
- @param LanguageString A string allocated by GetSecondaryLanguages() containing a list of all secondary languages registered
- on the handle. The routine will not return the three-spaces language identifier used in other functions
- to indicate non-language-specific strings, nor will it return the primary language. This function succeeds
- but returns a NULL LanguageString if there are no secondary languages associated with the input Handle and
- PrimaryLanguage pair. Type EFI_STRING is defined in String.
-
- @retval EFI_SUCCESS LanguageString was correctly returned.
- @retval EFI_INVALID_PARAMETER The Handle was unknown.
-**/
-EFI_STATUS
-EFIAPI
-HiiGetSecondaryLanguages (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN CHAR16 *PrimaryLanguage,
- OUT EFI_STRING *LanguageString
- );
-
-/**
-
- This function allows a program to extract a part of a string of not more than a given width.
- With repeated calls, this allows a calling program to extract "lines" of text that fit inside
- columns. The effort of measuring the fit of strings inside columns is localized to this call.
-
- This is a deprecated API. No Framework HII module is calling it. This function will ASSERT and
- return EFI_UNSUPPORTED.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle The HII handle on which the string resides.
- @param Token The string token assigned to the string.
- @param Index On input, the offset into the string where the line is to start.
- On output, the index is updated to point to beyond the last character returned
- in the call.
- @param LineWidth The maximum width of the line in units of narrow glyphs.
- @param LanguageString Pointer to a NULL-terminated string containing a single ISO 639-2 language
- identifier, indicating the language to print. If the LanguageString is empty (starts
- with a NULL), the default system language will be used to determine the language.
- @param BufferLength Length of the StringBuffer. If the status reports that the buffer width is too
- small, this parameter is filled with the length of the buffer needed.
- @param StringBuffer The buffer designed to receive the characters in the string. Type EFI_STRING is
- defined in String.
-
- @retval EFI_UNSUPPORTED.
-**/
-EFI_STATUS
-EFIAPI
-HiiGetLine (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN STRING_REF Token,
- IN OUT UINT16 *Index,
- IN UINT16 LineWidth,
- IN CHAR16 *LanguageString,
- IN OUT UINT16 *BufferLength,
- OUT EFI_STRING StringBuffer
- );
-
-/**
- This function allows a program to extract a form or form package that has
- previously been registered with the EFI HII database.
-
- In this thunk module, this function will create a IFR Package with only
- one Formset. Effectively, only the GUID of the Formset is updated and return
- in this IFR package to caller. This is enable the Framework modules which call
- a API named GetStringFromToken. GetStringFromToken retieves a String based on
- a String Token from a Package List known only by the Formset GUID.
-
-
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle Handle on which the form resides. Type FRAMEWORK_EFI_HII_HANDLE is defined in
- EFI_HII_PROTOCOL.NewPack() in the Packages section.
- @param FormId Ignored by this implementation.
- @param BufferLengthTemp On input, the size of input buffer. On output, it
- is the size of FW_HII_FORMSET_TEMPLATE.
- @param Buffer The buffer designed to receive the form(s).
-
- @retval EFI_SUCCESS Buffer filled with the requested forms. BufferLength
- was updated.
- @retval EFI_INVALID_PARAMETER The handle is unknown.
- @retval EFI_NOT_FOUND A form on the requested handle cannot be found with the
- requested FormId.
- @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough to allow the form to be stored.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiGetForms (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN EFI_FORM_ID FormId,
- IN OUT UINTN *BufferLengthTemp,
- OUT UINT8 *Buffer
- );
-
-/**
-
- This function allows a program to extract the NV Image
- that represents the default storage image
-
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle The HII handle from which will have default data retrieved.
- UINTN - Mask used to retrieve the default image.
- @param DefaultMask EDES_TODO: Add parameter description
- @param VariablePackList Callee allocated, tightly-packed, link list data
- structure that contain all default varaible packs
- from the Hii Database.
-
- @retval EFI_NOT_FOUND If Hii database does not contain any default images.
- @retval EFI_INVALID_PARAMETER Invalid input parameter.
- @retval EFI_SUCCESS Operation successful.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiGetDefaultImage (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN UINTN DefaultMask,
- OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList
- );
-
-/**
- This function allows the caller to update a form that has
- previously been registered with the EFI HII database.
-
-
- @param This EDES_TODO: Add parameter description
- @param Handle Hii Handle associated with the Formset to modify
- @param Label Update information starting immediately after this label in the IFR
- @param AddData If TRUE, add data. If FALSE, remove data
- @param Data If adding data, this is the pointer to the data to add
-
- @retval EFI_SUCCESS Update success.
- @retval Other Update fail.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiThunkUpdateForm (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN EFI_FORM_LABEL Label,
- IN BOOLEAN AddData,
- IN EFI_HII_UPDATE_DATA *Data
- );
-
-/**
- Retrieves the current keyboard layout.
- This function is not implemented by HII Thunk Module.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param DescriptorCount A pointer to the number of Descriptor entries being described in the keyboard layout being retrieved.
- @param Descriptor A pointer to a buffer containing an array of EFI_KEY_DESCRIPTOR entries. Each entry will reflect the
- definition of a specific physical key. Type EFI_KEY_DESCRIPTOR is defined in "Related Definitions" below.
-
- @retval EFI_SUCCESS The keyboard layout was retrieved successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiGetKeyboardLayout (
- IN EFI_HII_PROTOCOL *This,
- OUT UINT16 *DescriptorCount,
- OUT FRAMEWORK_EFI_KEY_DESCRIPTOR *Descriptor
- );
-
-/**
- This is the Framework Setup Browser interface which displays a FormSet.
-
- @param This The EFI_FORM_BROWSER_PROTOCOL context.
- @param UseDatabase TRUE if the FormSet is from HII database. The Thunk implementation
- only support UseDatabase is TRUE.
- @param Handle The Handle buffer.
- @param HandleCount The number of Handle in the Handle Buffer. It must be 1 for this implementation.
- @param Packet The pointer to data buffer containing IFR and String package. Not supported.
- @param CallbackHandle Not supported.
- @param NvMapOverride The buffer is used only when there is no NV variable to define the
- current settings and the caller needs to provide to the browser the
- current settings for the the "fake" NV variable. If used, no saving of
- an NV variable is possbile. This parameter is also ignored if Handle is NULL.
- @param ScreenDimensions
- Allows the browser to be called so that it occupies a portion of the physical
- screen instead of dynamically determining the screen dimensions.
- @param ResetRequired This BOOLEAN value denotes whether a reset is required based on the data that
- might have been changed. The ResetRequired parameter is primarily applicable
- for configuration applications, and is an optional parameter.
-
- @retval EFI_SUCCESS If the Formset is displayed correctly.
- @retval EFI_UNSUPPORTED If UseDatabase is FALSE or HandleCount is not 1.
- @retval EFI_INVALID_PARAMETER If the *Handle passed in is not found in the database.
-**/
-EFI_STATUS
-EFIAPI
-ThunkSendForm (
- IN EFI_FORM_BROWSER_PROTOCOL *This,
- IN BOOLEAN UseDatabase,
- IN FRAMEWORK_EFI_HII_HANDLE *Handle,
- IN UINTN HandleCount,
- IN EFI_IFR_PACKET *Packet, OPTIONAL
- IN EFI_HANDLE CallbackHandle, OPTIONAL
- IN UINT8 *NvMapOverride, OPTIONAL
- IN FRAMEWORK_EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL
- OUT BOOLEAN *ResetRequired OPTIONAL
- );
-
-/**
-
- Rountine used to display a generic dialog interface and return
- the Key or Input from user input.
-
- @param LinesNumber The number of lines for the dialog box.
- @param HotKey Defines if a single character is parsed (TRUE) and returned in KeyValue
- or if a string is returned in StringBuffer.
- @param MaximumStringSize The maximum size in bytes of a typed-in string.
- @param StringBuffer On return contains the typed-in string if HotKey is FALSE.
- @param Key The EFI_INPUT_KEY value returned if HotKey is TRUE.
- @param FirstString The pointer to the first string in the list of strings
- that comprise the dialog box.
- @param ... A series of NumberOfLines text strings that will be used
- to construct the dialog box.
- @retval EFI_SUCCESS The dialog is created successfully and user interaction was received.
- @retval EFI_DEVICE_ERROR The user typed in an ESC.
- @retval EFI_INVALID_PARAMETER One of the parameters was invalid.(StringBuffer == NULL && HotKey == FALSE).
-**/
-EFI_STATUS
-EFIAPI
-ThunkCreatePopUp (
- IN UINTN LinesNumber,
- IN BOOLEAN HotKey,
- IN UINTN MaximumStringSize,
- OUT CHAR16 *StringBuffer,
- OUT EFI_INPUT_KEY *Key,
- IN CHAR16 *FirstString,
- ...
- );
-
-/**
- This notification function will be called when a Package List is removed
- using UEFI HII interface. The Package List removed need to be removed from
- Framework Thunk module too.
-
- If the Package List registered is not Sting Package,
- then ASSERT. If the NotifyType is not REMOVE_PACK, then ASSERT.
- Both cases means UEFI HII Database itself is buggy.
-
- @param PackageType The Package Type.
- @param PackageGuid The Package GUID.
- @param Package The Package Header.
- @param Handle The HII Handle of this Package List.
- @param NotifyType The reason of the notification.
-
- @retval EFI_SUCCESS The notification function is successful.
-
-**/
-EFI_STATUS
-EFIAPI
-RemovePackNotify (
- IN UINT8 PackageType,
- IN CONST EFI_GUID *PackageGuid,
- IN CONST EFI_HII_PACKAGE_HEADER *Package,
- IN EFI_HII_HANDLE Handle,
- IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType
- );
-
-/**
- This notification function will be called when a Package List is registered
- using UEFI HII interface. The Package List registered need to be recorded in
- Framework Thunk module as Thunk Module may need to look for String Package in
- the package registered.
-
- If the Package List registered is not either Sting Package or IFR package,
- then ASSERT. If the NotifyType is not ADD_PACK or NEW_PACK, then ASSERT.
- Both cases means UEFI HII Database itself is buggy.
-
- @param PackageType The Package Type.
- @param PackageGuid The Package GUID.
- @param Package The Package Header.
- @param Handle The HII Handle of this Package List.
- @param NotifyType The reason of the notification.
-
- @retval EFI_SUCCESS The notification function is successful.
-
-**/
-EFI_STATUS
-EFIAPI
-NewOrAddPackNotify (
- IN UINT8 PackageType,
- IN CONST EFI_GUID *PackageGuid,
- IN CONST EFI_HII_PACKAGE_HEADER *Package,
- IN EFI_HII_HANDLE Handle,
- IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType
- );
-
-/**
- Create a Hii Update data Handle used to call IfrLibUpdateForm.
-
- @param ThunkContext The HII Thunk Context.
- @param FwUpdateData The Framework Update Data.
- @param UefiOpCodeHandle The UEFI Update Data.
-
- @retval EFI_SUCCESS The UEFI Update Data is created successfully.
- @retval EFI_UNSUPPORTED There is unsupported opcode in FwUpdateData.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource.
-**/
-EFI_STATUS
-FwUpdateDataToUefiUpdateData (
- IN HII_THUNK_CONTEXT *ThunkContext,
- IN CONST EFI_HII_UPDATE_DATA *FwUpdateData,
- IN VOID *UefiOpCodeHandle
- )
-;
-
-/**
-
- Initialize string packages in HII database.
-
-**/
-VOID
-InitSetBrowserStrings (
- VOID
- )
-;
-
-/**
- Convert language code from RFC4646 to ISO639-2.
-
- LanguageRfc4646 contain a single RFC 4646 code such as
- "en-US" or "fr-FR".
-
- The LanguageRfc4646 must be a buffer large enough
- for ISO_639_2_ENTRY_SIZE characters.
-
- If LanguageRfc4646 is NULL, then ASSERT.
- If LanguageIso639 is NULL, then ASSERT.
-
- @param LanguageRfc4646 RFC4646 language code.
- @param LanguageIso639 ISO639-2 language code.
-
- @retval EFI_SUCCESS Language code converted.
- @retval EFI_NOT_FOUND Language code not found.
-
-**/
-EFI_STATUS
-EFIAPI
-ConvertRfc4646LanguageToIso639Language (
- IN CHAR8 *LanguageRfc4646,
- OUT CHAR8 *LanguageIso639
- )
-;
-
-/**
- Convert language code from ISO639-2 to RFC4646 and return the converted language.
- Caller is responsible for freeing the allocated buffer.
-
- LanguageIso639 contain a single ISO639-2 code such as
- "eng" or "fra".
-
- If LanguageIso639 is NULL, then ASSERT.
- If LanguageRfc4646 is NULL, then ASSERT.
-
- @param LanguageIso639 ISO639-2 language code.
-
- @return the allocated buffer or NULL, if the language is not found.
-
-**/
-CHAR8*
-EFIAPI
-ConvertIso639LanguageToRfc4646Language (
- IN CONST CHAR8 *LanguageIso639
- )
-;
-
-/**
- Get next language from language code list (with separator ';').
-
- If LangCode is NULL, then ASSERT.
- If Lang is NULL, then ASSERT.
-
- @param LangCode On input: point to first language in the list. On
- output: point to next language in the list, or
- NULL if no more language in the list.
- @param Lang The first language in the list.
-
-**/
-VOID
-EFIAPI
-GetNextLanguage (
- IN OUT CHAR8 **LangCode,
- OUT CHAR8 *Lang
- )
-;
-
-#include "Utility.h"
-#include "ConfigAccess.h"
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiHandle.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiHandle.c
deleted file mode 100644
index 16b701a40c..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiHandle.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/** @file
- This file is for functins related to assign and free Framework HII handle number.
-
-Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-
-#include "HiiHandle.h"
-
-//
-// FRAMEWORK_EFI_HII_HANDLE
-//
-UINT8 mHandle[1024 * 8] = {0};
-
-/**
-
- Initialize the Framework Hii Handle database.
-
-**/
-VOID
-InitHiiHandleDatabase (
- VOID
- )
-{
- //
- // FRAMEWORK_EFI_HII_HANDLE 0 is reserved.
- // Set Bit 0 in mHandle[0] to 1.
- //
- mHandle[0] |= 1 << 0;
-}
-
-/**
- Allocate a new Framework HII handle.
-
- @param Handle Returns the new Framework HII Handle assigned.
-
- @retval EFI_SUCCESS A new Framework HII Handle is assigned.
- @retval EFI_OUT_OF_RESOURCE The Framework HII Handle database is depleted.
-
-**/
-EFI_STATUS
-AllocateHiiHandle (
- OUT FRAMEWORK_EFI_HII_HANDLE *Handle
- )
-{
- UINTN Index;
-
- for (Index = 0; Index < sizeof (mHandle) * 8; Index++) {
- if ((mHandle[Index / 8] & (1 << (Index % 8))) == 0) {
- mHandle[Index / 8] = (UINT8) (mHandle[Index / 8] | (1 << (Index % 8)));
- *Handle = (FRAMEWORK_EFI_HII_HANDLE) Index;
- ASSERT (*Handle != 0);
- return EFI_SUCCESS;
- }
- }
-
- return EFI_OUT_OF_RESOURCES;
-}
-
-/**
- Free Framework HII handle.
-
- @param Handle The Framework HII Handle to be freed.
-
-**/
-VOID
-FreeHiiHandle (
- IN FRAMEWORK_EFI_HII_HANDLE Handle
- )
-{
- UINT16 Num;
-
- Num = (UINT16) Handle;
-
- ASSERT ((mHandle [Num / 8] & (1 << (Num % 8))) != 0);
- mHandle [Num / 8] = (UINT8) (mHandle [Num / 8] & (~(1 << (Num % 8))));
-}
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiHandle.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiHandle.h
deleted file mode 100644
index 6e36dae930..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiHandle.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/** @file
- This file is for functins related to assign and free Framework HII handle number.
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#ifndef _HII_HANDLE_H_
-#define _HII_HANDLE_H_
-
-#include <FrameworkDxe.h>
-#include <Protocol/FrameworkHii.h>
-#include <Library/DebugLib.h>
-
-/**
-
- Initialize the Framework Hii Handle database.
-
-**/
-VOID
-InitHiiHandleDatabase (
- VOID
- );
-
-/**
- Allocate a new Framework HII handle.
-
- @param Handle Returns the new Framework HII Handle assigned.
-
- @retval EFI_SUCCESS A new Framework HII Handle is assigned.
- @retval EFI_OUT_OF_RESOURCE The Framework HII Handle database is depleted.
-
-**/
-EFI_STATUS
-AllocateHiiHandle (
- OUT FRAMEWORK_EFI_HII_HANDLE *Handle
- );
-
-
-/**
- Free Framework HII handle.
-
- @param Handle The Framework HII Handle to be freed.
-
-**/
-VOID
-FreeHiiHandle (
- IN FRAMEWORK_EFI_HII_HANDLE Handle
- );
-
-
-#endif
-
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Keyboard.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Keyboard.c
deleted file mode 100644
index 0f55e96fce..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Keyboard.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file
-
- This file contains the keyboard processing code to the HII database.
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-
-#include "HiiDatabase.h"
-
-/**
- Retrieves the current keyboard layout.
- This function is not implemented by HII Thunk Module.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param DescriptorCount A pointer to the number of Descriptor entries being described in the keyboard layout being retrieved.
- @param Descriptor A pointer to a buffer containing an array of EFI_KEY_DESCRIPTOR entries. Each entry will reflect the
- definition of a specific physical key. Type EFI_KEY_DESCRIPTOR is defined in "Related Definitions" below.
-
- @retval EFI_SUCCESS The keyboard layout was retrieved successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiGetKeyboardLayout (
- IN EFI_HII_PROTOCOL *This,
- OUT UINT16 *DescriptorCount,
- OUT FRAMEWORK_EFI_KEY_DESCRIPTOR *Descriptor
- )
-{
- ASSERT (FALSE);
- //
- // In previous Framewok HII implementation, GetKeyBoardLayout is defined in HII 0.92 specification,
- // but it is not implemented. We ASSERT and return UNSUPPORTED here.
- //
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/OpcodeCreation.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/OpcodeCreation.c
deleted file mode 100644
index a3ddce9b44..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/OpcodeCreation.c
+++ /dev/null
@@ -1,984 +0,0 @@
-/** @file
-Implement Functions to convert IFR Opcode in format defined in Framework HII specification to
-format defined in UEFI HII Specification.
-
-Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "HiiDatabase.h"
-#include "UefiIfrDefault.h"
-
-/**
- The dynamic creation of these opcodes is supported in Framework HII modules.
- Therefore, Framework HII Thunk module only map these opcode between Framework
- HII's definitions to UEFI HII's.
-**/
-typedef struct {
- UINT8 FrameworkIfrOp;
- UINT8 UefiIfrOp;
-} IFR_OPCODE_MAP;
-
-IFR_OPCODE_MAP QuestionOpcodeMap[] = {
- { FRAMEWORK_EFI_IFR_ONE_OF_OP, EFI_IFR_ONE_OF_OP},
- { FRAMEWORK_EFI_IFR_CHECKBOX_OP, EFI_IFR_CHECKBOX_OP},
- { FRAMEWORK_EFI_IFR_NUMERIC_OP, EFI_IFR_NUMERIC_OP},
- { FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP, EFI_IFR_ONE_OF_OPTION_OP},
- { FRAMEWORK_EFI_IFR_ORDERED_LIST_OP, EFI_IFR_ORDERED_LIST_OP}
-};
-
-/**
- Translate a Framework Question Opcode to UEFI Question Opcode.
-
- @param FwOp Framework Opcode.
- @param UefiOp UEFI Opcode.
-
- @retval EFI_SUCCESS The UEFI opcode is found and returned.
- @retval EFI_NOT_FOUND The UEFI opcode is not found.
-**/
-EFI_STATUS
-QuestionOpFwToUefi (
- IN UINT8 FwOp,
- OUT UINT8 *UefiOp
- )
-{
- UINTN Index;
-
- for (Index = 0; Index < ARRAY_SIZE (QuestionOpcodeMap); Index++) {
- if (FwOp == QuestionOpcodeMap[Index].FrameworkIfrOp) {
- *UefiOp = QuestionOpcodeMap[Index].UefiIfrOp;
- return EFI_SUCCESS;
- }
- }
-
- *UefiOp = (UINT8) (EFI_IFR_LAST_OPCODE + 1);
- return EFI_NOT_FOUND;
-}
-
-/**
- Translate a Framework Question ID to UEFI Question ID.
-
- @param FormSet FormSet context
- @param FwOpCode Framework Opcode
- @param FwQId Framework Question Id
- @param UefiQId UEFI Question ID.
-
- @retval EFI_SUCCESS The UEFI Question Id is found and returned.
- @retval EFI_NOT_FOUND The UEFI Question Id is not found.
-**/
-EFI_STATUS
-FwQIdToUefiQId (
- IN CONST FORM_BROWSER_FORMSET *FormSet,
- IN UINT8 FwOpCode,
- IN UINT16 FwQId,
- OUT UINT16 *UefiQId
- )
-{
- LIST_ENTRY *FormList;
- LIST_ENTRY *StatementList;
- FORM_BROWSER_FORM *Form;
- FORM_BROWSER_STATEMENT *Statement;
- FORM_BROWSER_STATEMENT *StatementFound;
- EFI_STATUS Status;
- UINT8 UefiOp;
-
-
- *UefiQId = 0;
- StatementFound = NULL;
-
- FormList = GetFirstNode (&FormSet->FormListHead);
-
- while (!IsNull (&FormSet->FormListHead, FormList)) {
- Form = FORM_BROWSER_FORM_FROM_LINK (FormList);
-
- StatementList = GetFirstNode (&Form->StatementListHead);
-
- while (!IsNull (&Form->StatementListHead, StatementList)) {
- Statement = FORM_BROWSER_STATEMENT_FROM_LINK (StatementList);
- if (Statement->VarStoreId != 0 && Statement->Storage->Type == EFI_HII_VARSTORE_BUFFER) {
- if (FwQId == Statement->VarStoreInfo.VarOffset) {
- Status = QuestionOpFwToUefi (FwOpCode, &UefiOp);
- ASSERT_EFI_ERROR (Status);
-
- if ((UefiOp == Statement->Operand) && (FormSet->DefaultVarStoreId == Statement->VarStoreId)) {
- //
- // If ASSERT here, the Framework VFR file has two Questions with all three attibutes the same:
- // 1) Same Question Type,
- // 2) Same Variable Storage
- // 3) Refering to the Same offset in Variable Map (NvMap).
- // This is ambigurity as FwQIdToUefiQId () can't find which UEFI Question
- // ID to return.
- //
- // One possible solution is to remove the one of the duplicated questions in this Form Set.
- //
- ASSERT (StatementFound == NULL);
- StatementFound= Statement;
-
- //
- // Continue the search to check if the Form Set contains more than one questins that has the 3 attributes
- // with same value.
- //
- }
- }
- }
-
- StatementList = GetNextNode (&Form->StatementListHead, StatementList);
- }
-
- FormList = GetNextNode (&FormSet->FormListHead, FormList);
- }
-
- if (StatementFound != NULL) {
- *UefiQId = StatementFound->QuestionId;
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_FOUND;
-}
-
-/**
- Assign a Question ID.
-
- If FwQuestionId is 0, then assign a new question ID. The new question ID
- is MaxQuestionId incremented by 1. The MaxQuestionId of FormSet is also
- incremented by 1.
-
- If FwQuestionId is not 0, then it is used as the Framework Question ID.
-
- @param FwQuestionId
- @param FormSet
-
- @return The Framework Question ID.
-**/
-EFI_QUESTION_ID
-AssignQuestionId (
- IN UINT16 FwQuestionId,
- IN FORM_BROWSER_FORMSET *FormSet
- )
-{
- if (FwQuestionId == 0) {
- FormSet->MaxQuestionId++;
- return FormSet->MaxQuestionId;
- } else {
- return FwQuestionId;
- }
-}
-
-/**
- Create UEFI HII Text Opcode from a Framework HII Text Opcode.
-
- @param UefiUpdateDataHandle The newly created UEFI HII opcode is appended to UefiUpdateDataHandle.
- @param FwOpcode The input Framework Opcode.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-F2UCreateTextOpCode (
- IN OUT VOID *UefiUpdateDataHandle,
- IN CONST FRAMEWORK_EFI_IFR_TEXT *FwOpcode
- )
-{
- EFI_IFR_TEXT UTextOpCode;
-
- if ((FwOpcode->Flags & EFI_IFR_FLAG_INTERACTIVE) == 0) {
- ZeroMem (&UTextOpCode, sizeof(UTextOpCode));
-
- UTextOpCode.Header.OpCode = EFI_IFR_TEXT_OP;
- UTextOpCode.Header.Length = (UINT8) sizeof (EFI_IFR_TEXT);
-
- UTextOpCode.Statement.Help = FwOpcode->Help;
-
- UTextOpCode.Statement.Prompt = FwOpcode->Text;
- UTextOpCode.TextTwo = FwOpcode->TextTwo;
-
- return HiiCreateRawOpCodes (UefiUpdateDataHandle, (UINT8 *) &UTextOpCode, sizeof(UTextOpCode));
- } else {
- //
- // Iteractive Text Opcode is EFI_IFR_ACTION
- //
- return HiiCreateActionOpCode (UefiUpdateDataHandle, FwOpcode->Key, FwOpcode->Text, FwOpcode->Help, EFI_IFR_FLAG_CALLBACK, 0);
- }
-}
-
-/**
- Create UEFI HII Reference Opcode from a Framework HII Reference Opcode.
-
- @param UefiUpdateDataHandle The newly created UEFI HII opcode is appended to UefiUpdateDataHandle.
- @param FwOpcode The input Framework Opcode.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-F2UCreateReferenceOpCode (
- IN OUT VOID *UefiUpdateDataHandle,
- IN CONST FRAMEWORK_EFI_IFR_REF *FwOpcode
- )
-{
- EFI_IFR_REF UOpcode;
-
- ZeroMem (&UOpcode, sizeof(UOpcode));
-
- UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
- UOpcode.Header.OpCode = EFI_IFR_REF_OP;
-
- UOpcode.Question.Header.Prompt = FwOpcode->Prompt;
- UOpcode.Question.Header.Help = FwOpcode->Help;
- UOpcode.Question.QuestionId = FwOpcode->Key;
-
- UOpcode.FormId = FwOpcode->FormId;
-
- //
- // We only map EFI_IFR_FLAG_INTERACTIVE and EFI_IFR_FLAG_RESET_REQUIRED to
- // UEFI IFR Opcode flags. The rest flags are obsolete.
- //
- UOpcode.Question.Flags = (UINT8) (FwOpcode->Flags & (EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_RESET_REQUIRED));
-
- return HiiCreateRawOpCodes (UefiUpdateDataHandle, (UINT8 *) &UOpcode, sizeof(UOpcode));
-}
-
-/**
- Create UEFI HII "One Of Option" Opcode from a Framework HII "One Of Option" Opcode.
-
- @param UefiUpdateDataHandle The newly created UEFI HII opcode is appended to UefiUpdateDataHandle.
- @param FwOpcode The input Framework Opcode.
- @param Width The size of the One Of Option. 1 bytes or 2 bytes.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-F2UCreateOneOfOptionOpCode (
- IN OUT VOID *UefiUpdateDataHandle,
- IN CONST FRAMEWORK_EFI_IFR_ONE_OF_OPTION *FwOpcode,
- IN UINTN Width
- )
-{
- EFI_IFR_ONE_OF_OPTION UOpcode;
-
- ZeroMem (&UOpcode, sizeof(UOpcode));
-
- UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
- UOpcode.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
-
- UOpcode.Option = FwOpcode->Option;
- CopyMem (&UOpcode.Value.u8, &FwOpcode->Value, Width);
-
- //
- // #define EFI_IFR_FLAG_DEFAULT 0x01
- // #define EFI_IFR_FLAG_MANUFACTURING 0x02
- // #define EFI_IFR_OPTION_DEFAULT 0x10
- // #define EFI_IFR_OPTION_DEFAULT_MFG 0x20
- //
- UOpcode.Flags = (UINT8) (UOpcode.Flags | (FwOpcode->Flags & (EFI_IFR_FLAG_DEFAULT | EFI_IFR_FLAG_MANUFACTURING)) << 4);
-
- switch (Width) {
- case 1:
- UOpcode.Type = EFI_IFR_TYPE_NUM_SIZE_8;
- break;
-
- case 2:
- UOpcode.Type = EFI_IFR_TYPE_NUM_SIZE_16;
- break;
-
- default:
- ASSERT (FALSE);
- return NULL;
- }
-
- return HiiCreateRawOpCodes (UefiUpdateDataHandle, (UINT8 *) &UOpcode, sizeof(UOpcode));
-}
-
-/**
- Create a GUID Opcode EFI_IFR_GUID_OPTIONKEY to map the Framework One Of Option callback key
- to a UEFI Question ID. This information is used to invoke the Framework HII Browser Callback
- function. The opcode is appened to UefiUpdateDataHandle.
-
- @param UefiUpdateDataHandle The UEFI Update Data buffer.
- @param QuestionId The UEFI Question ID.
- @param OptionValue The value of the "One Of Option".
- @param KeyValue The Framework "One Of Option" callback key.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-**/
-UINT8 *
-CreateGuidOptionKeyOpCode (
- IN OUT VOID *UefiUpdateDataHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT16 OptionValue,
- IN EFI_QUESTION_ID KeyValue
- )
-{
- EFI_IFR_GUID_OPTIONKEY *UOpcode;
-
- UOpcode = (EFI_IFR_GUID_OPTIONKEY *) HiiCreateGuidOpCode (
- UefiUpdateDataHandle,
- &gEfiIfrFrameworkGuid,
- NULL,
- sizeof (EFI_IFR_GUID_OPTIONKEY)
- );
-
- UOpcode->ExtendOpCode = EFI_IFR_EXTEND_OP_OPTIONKEY;
- UOpcode->QuestionId = QuestionId;
- CopyMem (&UOpcode->OptionValue, &OptionValue, sizeof (OptionValue));
- UOpcode->KeyValue = KeyValue;
-
- return (UINT8 *) UOpcode;
-}
-
-/**
- Create UEFI HII "One Of" Opcode from a Framework HII "One Of" Opcode.
-
- @param UefiUpdateDataHandle The newly created UEFI HII opcode is appended to UefiUpdateDataHandle.
- @param ThunkContext The HII Thunk Context.
- @param FwOpcode The input Framework Opcode.
- @param NextFwOpcode Returns the position of the next Framework Opcode after EFI_IFR_END_ONE_OF_OP of
- the "One Of Option".
- @param OpcodeCount The number of Opcode for the complete Framework "One Of" Opcode.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-F2UCreateOneOfOpCode (
- IN OUT VOID *UefiUpdateDataHandle,
- IN HII_THUNK_CONTEXT *ThunkContext,
- IN CONST FRAMEWORK_EFI_IFR_ONE_OF *FwOpcode,
- OUT FRAMEWORK_EFI_IFR_OP_HEADER **NextFwOpcode,
- OUT UINTN *OpcodeCount
- )
-{
- EFI_STATUS Status;
- EFI_IFR_ONE_OF UOpcode;
- FRAMEWORK_EFI_IFR_OP_HEADER *FwOpHeader;
- FRAMEWORK_EFI_IFR_ONE_OF_OPTION *FwOneOfOp;
- UINT8 *OpCodeBuffer;
- UINT8 *OneOfOpCodeBuffer;
-
- ASSERT (NextFwOpcode != NULL);
- ASSERT (OpcodeCount != NULL);
-
- ZeroMem (&UOpcode, sizeof(UOpcode));
- *OpcodeCount = 0;
-
- UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
- UOpcode.Header.OpCode = EFI_IFR_ONE_OF_OP;
- UOpcode.Header.Scope = 1;
-
- UOpcode.Question.Header.Prompt = FwOpcode->Prompt;
- UOpcode.Question.Header.Help = FwOpcode->Help;
- UOpcode.Question.VarStoreId = ThunkContext->FormSet->DefaultVarStoreId;
- UOpcode.Question.VarStoreInfo.VarOffset = FwOpcode->QuestionId;
-
- //
- // Go over the Framework IFR binary to get the QuestionId for generated UEFI One Of Option opcode
- //
- FwOpHeader = (FRAMEWORK_EFI_IFR_OP_HEADER *) ((UINT8 *) FwOpcode + FwOpcode->Header.Length);
- while (FwOpHeader->OpCode != EFI_IFR_END_ONE_OF_OP) {
- ASSERT (FwOpHeader->OpCode == FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP);
-
- FwOneOfOp = (FRAMEWORK_EFI_IFR_ONE_OF_OPTION *) FwOpHeader;
- if ((FwOneOfOp->Flags & EFI_IFR_FLAG_INTERACTIVE) != 0) {
- UOpcode.Question.Flags |= EFI_IFR_FLAG_CALLBACK;
-
- if (UOpcode.Question.QuestionId == 0) {
- Status = FwQIdToUefiQId (ThunkContext->FormSet, FwOpcode->Header.OpCode, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
- if (EFI_ERROR (Status)) {
- UOpcode.Question.QuestionId = AssignQuestionId (FwOneOfOp->Key, ThunkContext->FormSet);
- }
- }
-
- }
-
- if ((FwOneOfOp->Flags & EFI_IFR_FLAG_RESET_REQUIRED) == EFI_IFR_FLAG_RESET_REQUIRED) {
- UOpcode.Question.Flags |= EFI_IFR_FLAG_RESET_REQUIRED;
- }
-
- FwOpHeader = (FRAMEWORK_EFI_IFR_OP_HEADER *) ((UINT8 *) FwOpHeader + FwOpHeader->Length);
- }
-
-
- if (UOpcode.Question.QuestionId == 0) {
- //
- // Assign QuestionId if still not assigned.
- //
- Status = FwQIdToUefiQId (ThunkContext->FormSet, FwOpcode->Header.OpCode, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
- if (EFI_ERROR (Status)) {
- UOpcode.Question.QuestionId = AssignQuestionId (FwOpcode->QuestionId, ThunkContext->FormSet);
- }
- }
-
- OneOfOpCodeBuffer = HiiCreateRawOpCodes (UefiUpdateDataHandle, (UINT8 *) &UOpcode, sizeof (UOpcode));
- if (OneOfOpCodeBuffer == NULL) {
- return NULL;
- }
- *OpcodeCount += 1;
-
- //
- // Go over again the Framework IFR binary to build the UEFI One Of Option opcodes.
- //
- FwOpHeader = (FRAMEWORK_EFI_IFR_OP_HEADER *) ((UINT8 *) FwOpcode + FwOpcode->Header.Length);
- while (FwOpHeader->OpCode != EFI_IFR_END_ONE_OF_OP) {
-
- FwOneOfOp = (FRAMEWORK_EFI_IFR_ONE_OF_OPTION *) FwOpHeader;
-
- OpCodeBuffer = F2UCreateOneOfOptionOpCode (UefiUpdateDataHandle, (FRAMEWORK_EFI_IFR_ONE_OF_OPTION *) FwOpHeader, FwOpcode->Width);
- if (OpCodeBuffer == NULL) {
- return NULL;
- }
-
- OpCodeBuffer = CreateGuidOptionKeyOpCode (UefiUpdateDataHandle, UOpcode.Question.QuestionId, FwOneOfOp->Value, FwOneOfOp->Key);
- if (OpCodeBuffer == NULL) {
- return NULL;
- }
-
- FwOpHeader = (FRAMEWORK_EFI_IFR_OP_HEADER *) ((UINT8 *) FwOpHeader + FwOpHeader->Length);
- *OpcodeCount += 1;
- }
-
- OpCodeBuffer = HiiCreateEndOpCode (UefiUpdateDataHandle);
- if (OpCodeBuffer != NULL) {
- *NextFwOpcode = (FRAMEWORK_EFI_IFR_OP_HEADER *)((UINT8 *) FwOpHeader + FwOpHeader->Length);
- *OpcodeCount += 1;
- }
-
- return OneOfOpCodeBuffer;
-}
-
-/**
- Create UEFI HII "Ordered List" Opcode from a Framework HII "Ordered List" Opcode.
-
- @param UefiUpdateDataHandle The newly created UEFI HII opcode is appended to UefiUpdateDataHandle.
- @param ThunkContext The HII Thunk Context.
- @param FwOpcode The input Framework Opcode.
- @param NextFwOpcode Returns the position of the next Framework Opcode after EFI_IFR_END_ONE_OF_OP of
- the "Ordered List".
- @param OpcodeCount The number of Opcode for the complete Framework "Ordered List" Opcode.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-F2UCreateOrderedListOpCode (
- IN OUT VOID *UefiUpdateDataHandle,
- IN HII_THUNK_CONTEXT *ThunkContext,
- IN CONST FRAMEWORK_EFI_IFR_ORDERED_LIST *FwOpcode,
- OUT FRAMEWORK_EFI_IFR_OP_HEADER **NextFwOpcode,
- OUT UINTN *OpcodeCount
- )
-{
- EFI_IFR_ORDERED_LIST UOpcode;
- EFI_STATUS Status;
- FRAMEWORK_EFI_IFR_OP_HEADER *FwOpHeader;
- FRAMEWORK_EFI_IFR_ONE_OF_OPTION *FwOneOfOp;
- UINT8 *OpcodeBuffer;
- UINT8 *OrderListOpCode;
-
- ZeroMem (&UOpcode, sizeof(UOpcode));
- *OpcodeCount = 0;
-
- UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
- UOpcode.Header.OpCode = EFI_IFR_ORDERED_LIST_OP;
- UOpcode.Header.Scope = 1;
-
- UOpcode.Question.Header.Prompt = FwOpcode->Prompt;
- UOpcode.Question.Header.Help = FwOpcode->Help;
- UOpcode.Question.VarStoreId = ThunkContext->FormSet->DefaultVarStoreId;
- UOpcode.Question.VarStoreInfo.VarOffset = FwOpcode->QuestionId;
-
- UOpcode.MaxContainers = FwOpcode->MaxEntries;
-
- //
- // Go over the Framework IFR binary to get the QuestionId for generated UEFI One Of Option opcode
- //
- FwOpHeader = (FRAMEWORK_EFI_IFR_OP_HEADER *) ((UINT8 *) FwOpcode + FwOpcode->Header.Length);
- while (FwOpHeader->OpCode != EFI_IFR_END_ONE_OF_OP) {
- ASSERT (FwOpHeader->OpCode == FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP);
-
- FwOneOfOp = (FRAMEWORK_EFI_IFR_ONE_OF_OPTION *) FwOpHeader;
- if ((FwOneOfOp->Flags & EFI_IFR_FLAG_INTERACTIVE) != 0) {
- UOpcode.Question.Flags |= EFI_IFR_FLAG_CALLBACK;
-
- if (UOpcode.Question.QuestionId == 0) {
- Status = FwQIdToUefiQId (ThunkContext->FormSet, FwOpcode->Header.OpCode, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
- if (EFI_ERROR (Status)) {
- UOpcode.Question.QuestionId = AssignQuestionId (FwOneOfOp->Key, ThunkContext->FormSet);
- }
-
- }
- }
-
- if ((FwOneOfOp->Flags & EFI_IFR_FLAG_RESET_REQUIRED) == EFI_IFR_FLAG_RESET_REQUIRED) {
- UOpcode.Question.Flags |= EFI_IFR_FLAG_RESET_REQUIRED;
- }
-
- FwOpHeader = (FRAMEWORK_EFI_IFR_OP_HEADER *) ((UINT8 *) FwOpHeader + FwOpHeader->Length);
- }
-
- if (UOpcode.Question.QuestionId == 0) {
- Status = FwQIdToUefiQId (ThunkContext->FormSet, FwOpcode->Header.OpCode, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
- if (EFI_ERROR (Status)) {
- UOpcode.Question.QuestionId = AssignQuestionId (FwOpcode->QuestionId, ThunkContext->FormSet);
- }
- }
-
- OrderListOpCode = HiiCreateRawOpCodes (UefiUpdateDataHandle, (UINT8 *) &UOpcode, sizeof(UOpcode));
- if (OrderListOpCode == NULL) {
- return NULL;
- }
- *OpcodeCount += 1;
-
- FwOpHeader = (FRAMEWORK_EFI_IFR_OP_HEADER *) ((UINT8 *) FwOpcode + FwOpcode->Header.Length);
- while (FwOpHeader->OpCode != EFI_IFR_END_ONE_OF_OP) {
- //
- // Each entry of Order List in Framework HII is always 1 byte in size
- //
- OpcodeBuffer = F2UCreateOneOfOptionOpCode (UefiUpdateDataHandle, (CONST FRAMEWORK_EFI_IFR_ONE_OF_OPTION *) FwOpHeader, 1);
- if (OpcodeBuffer == NULL) {
- return NULL;
- }
- FwOpHeader = (FRAMEWORK_EFI_IFR_OP_HEADER *) ((UINT8 *) FwOpHeader + FwOpHeader->Length);
- *OpcodeCount += 1;
- }
-
- OpcodeBuffer = HiiCreateEndOpCode (UefiUpdateDataHandle);
- if (OpcodeBuffer != NULL) {
- *NextFwOpcode = (FRAMEWORK_EFI_IFR_OP_HEADER *)((UINT8 *) FwOpHeader + FwOpHeader->Length);
- *OpcodeCount += 1;
- }
-
- return OrderListOpCode;
-}
-
-/**
- Create UEFI HII CheckBox Opcode from a Framework HII Checkbox Opcode.
-
- @param UefiUpdateDataHandle The newly created UEFI HII opcode is appended to UefiUpdateDataHandle.
- @param ThunkContext The HII Thunk Context.
- @param FwOpcode The input Framework Opcode.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-F2UCreateCheckBoxOpCode (
- IN OUT VOID *UefiUpdateDataHandle,
- IN HII_THUNK_CONTEXT *ThunkContext,
- IN CONST FRAMEWORK_EFI_IFR_CHECKBOX *FwOpcode
- )
-{
- EFI_STATUS Status;
- EFI_IFR_CHECKBOX UOpcode;
-
- ZeroMem (&UOpcode, sizeof(UOpcode));
-
- UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
- UOpcode.Header.OpCode = EFI_IFR_CHECKBOX_OP;
-
- UOpcode.Question.Header.Prompt = FwOpcode->Prompt;
- UOpcode.Question.Header.Help = FwOpcode->Help;
-
- if (FwOpcode->Key == 0) {
- Status = FwQIdToUefiQId (ThunkContext->FormSet, FwOpcode->Header.OpCode, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
- if (EFI_ERROR (Status)) {
- //
- // Add a new opcode and it will not trigger call back. So we just reuse the FW QuestionId.
- //
- UOpcode.Question.QuestionId = AssignQuestionId (FwOpcode->QuestionId, ThunkContext->FormSet);
- }
- } else {
- UOpcode.Question.QuestionId = FwOpcode->Key;
- }
-
- //
- // We map 2 flags:
- // EFI_IFR_FLAG_INTERACTIVE,
- // EFI_IFR_FLAG_RESET_REQUIRED,
- // to UEFI IFR Opcode Question flags. The rest flags are obsolete.
- //
- UOpcode.Question.Flags = (UINT8) (FwOpcode->Flags & (EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_RESET_REQUIRED));
-
-
- UOpcode.Question.VarStoreId = ThunkContext->FormSet->DefaultVarStoreId;
- UOpcode.Question.VarStoreInfo.VarOffset = FwOpcode->QuestionId;
-
- //
- // We also map these 2 flags:
- // EFI_IFR_FLAG_DEFAULT,
- // EFI_IFR_FLAG_MANUFACTURING,
- // to UEFI IFR CheckBox Opcode default flags.
- //
- UOpcode.Flags = (UINT8) (FwOpcode->Flags & (EFI_IFR_FLAG_DEFAULT | EFI_IFR_FLAG_MANUFACTURING));
-
- return HiiCreateRawOpCodes (UefiUpdateDataHandle, (UINT8 *) &UOpcode, sizeof(UOpcode));
-}
-
-
-/**
- Create UEFI HII Numeric Opcode from a Framework HII Numeric Opcode.
-
- @param UefiUpdateDataHandle The newly created UEFI HII opcode is appended to UefiUpdateDataHandle.
- @param ThunkContext The HII Thunk Context.
- @param FwOpcode The input Framework Opcode.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-F2UCreateNumericOpCode (
- IN OUT VOID *UefiUpdateDataHandle,
- IN HII_THUNK_CONTEXT *ThunkContext,
- IN CONST FRAMEWORK_EFI_IFR_NUMERIC *FwOpcode
- )
-{
- EFI_STATUS Status;
- EFI_IFR_NUMERIC UOpcode;
- EFI_IFR_DEFAULT UOpcodeDefault;
- UINT8 *NumbericOpCode;
- UINT8 *OpcodeBuffer;
-
- ZeroMem (&UOpcode, sizeof(UOpcode));
-
- if (FwOpcode->Key == 0) {
- Status = FwQIdToUefiQId (ThunkContext->FormSet, FwOpcode->Header.OpCode, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
- if (EFI_ERROR (Status)) {
- //
- // Add a new opcode and it will not trigger call back. So we just reuse the FW QuestionId.
- //
- UOpcode.Question.QuestionId = AssignQuestionId (FwOpcode->QuestionId, ThunkContext->FormSet);
- }
- } else {
- UOpcode.Question.QuestionId = FwOpcode->Key;
- }
-
- UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
- UOpcode.Header.OpCode = EFI_IFR_NUMERIC_OP;
- //
- // We need to create a nested default value for the UEFI Numeric Opcode.
- // So turn on the scope.
- //
- UOpcode.Header.Scope = 1;
-
- UOpcode.Question.Header.Prompt = FwOpcode->Prompt;
- UOpcode.Question.Header.Help = FwOpcode->Help;
-
- UOpcode.Question.VarStoreId = ThunkContext->FormSet->DefaultVarStoreId;
- UOpcode.Question.VarStoreInfo.VarOffset = FwOpcode->QuestionId;
-
- UOpcode.Question.Flags = (UINT8) (FwOpcode->Flags & (EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_RESET_REQUIRED));
-
- //
- // Framework Numeric values are all in UINT16 and displayed as decimal.
- //
- UOpcode.data.u16.MinValue = FwOpcode->Minimum;
- UOpcode.data.u16.MaxValue = FwOpcode->Maximum;
- UOpcode.data.u16.Step = FwOpcode->Step;
-
- switch (FwOpcode->Width) {
- case 1:
- {
- UOpcode.Flags = EFI_IFR_NUMERIC_SIZE_1 | EFI_IFR_DISPLAY_UINT_DEC;
- break;
- }
- case 2:
- {
- UOpcode.Flags = EFI_IFR_NUMERIC_SIZE_2 | EFI_IFR_DISPLAY_UINT_DEC;
- break;
- }
- default:
- {
- ASSERT (FALSE);
- return NULL;
- }
- }
-
- NumbericOpCode = HiiCreateRawOpCodes (UefiUpdateDataHandle, (UINT8 *) &UOpcode, sizeof(UOpcode));
- if (NumbericOpCode == NULL) {
- return NULL;
- }
-
- //
- // We need to create a default value.
- //
- ZeroMem (&UOpcodeDefault, sizeof (UOpcodeDefault));
- UOpcodeDefault.Header.Length = (UINT8) sizeof (UOpcodeDefault);
- UOpcodeDefault.Header.OpCode = EFI_IFR_DEFAULT_OP;
-
- UOpcodeDefault.DefaultId = 0;
-
- switch (FwOpcode->Width) {
- case 1:
- {
- UOpcodeDefault.Type = EFI_IFR_TYPE_NUM_SIZE_8;
- break;
- }
- case 2:
- {
- UOpcodeDefault.Type = EFI_IFR_TYPE_NUM_SIZE_16;
- break;
- }
- }
-
- CopyMem (&UOpcodeDefault.Value.u8, &FwOpcode->Default, FwOpcode->Width);
-
- OpcodeBuffer = HiiCreateRawOpCodes (UefiUpdateDataHandle, (UINT8 *) &UOpcodeDefault, sizeof(UOpcodeDefault));
- if (OpcodeBuffer == NULL) {
- return NULL;
- }
-
- OpcodeBuffer = HiiCreateEndOpCode (UefiUpdateDataHandle);
- if (OpcodeBuffer == NULL) {
- return NULL;
- }
-
- return NumbericOpCode;
-}
-
-
-/**
- Create UEFI HII String Opcode from a Framework HII String Opcode.
-
- @param UefiUpdateDataHandle The newly created UEFI HII opcode is appended to UefiUpdateDataHandle.
- @param ThunkContext The HII Thunk Context.
- @param FwOpcode The input Framework Opcode.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-F2UCreateStringOpCode (
- IN OUT VOID *UefiUpdateDataHandle,
- IN HII_THUNK_CONTEXT *ThunkContext,
- IN CONST FRAMEWORK_EFI_IFR_STRING *FwOpcode
- )
-{
- EFI_IFR_STRING UOpcode;
- EFI_STATUS Status;
-
- ZeroMem (&UOpcode, sizeof(UOpcode));
-
- if (FwOpcode->Key == 0) {
- Status = FwQIdToUefiQId (ThunkContext->FormSet, FwOpcode->Header.OpCode, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
- if (EFI_ERROR (Status)) {
- //
- // Add a new opcode and it will not trigger call back. So we just reuse the FW QuestionId.
- //
- UOpcode.Question.QuestionId = AssignQuestionId (FwOpcode->QuestionId, ThunkContext->FormSet);
- }
- } else {
- UOpcode.Question.QuestionId = FwOpcode->Key;
- }
-
- UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
- UOpcode.Header.OpCode = EFI_IFR_STRING_OP;
-
- UOpcode.Question.Header.Prompt = FwOpcode->Prompt;
- UOpcode.Question.Header.Help = FwOpcode->Help;
-
- UOpcode.Question.Flags = (UINT8) (FwOpcode->Flags & (EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_RESET_REQUIRED));
-
- UOpcode.Question.VarStoreId = ThunkContext->FormSet->DefaultVarStoreId;
- UOpcode.Question.VarStoreInfo.VarOffset = FwOpcode->QuestionId;
-
- UOpcode.MinSize = FwOpcode->MinSize;
- UOpcode.MaxSize = FwOpcode->MaxSize;
- UOpcode.Flags = EFI_IFR_STRING_MULTI_LINE;
-
- return HiiCreateRawOpCodes (UefiUpdateDataHandle, (UINT8 *) &UOpcode, sizeof(UOpcode));
-}
-
-/**
- Create UEFI HII Banner Opcode from a Framework HII Banner Opcode.
-
- @param UefiUpdateDataHandle The newly created UEFI HII opcode is appended to UefiUpdateDataHandle.
- @param FwOpcode The input Framework Opcode.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-F2UCreateBannerOpCode (
- IN OUT VOID *UefiUpdateDataHandle,
- IN CONST EFI_IFR_BANNER *FwOpcode
- )
-{
- EFI_IFR_GUID_BANNER *UOpcode;
-
- UOpcode = (EFI_IFR_GUID_BANNER *) HiiCreateGuidOpCode (
- UefiUpdateDataHandle,
- &gEfiIfrTianoGuid,
- NULL,
- sizeof (EFI_IFR_GUID_BANNER)
- );
-
- UOpcode->ExtendOpCode = EFI_IFR_EXTEND_OP_BANNER;
- UOpcode->Title = FwOpcode->Title;
- UOpcode->LineNumber = FwOpcode->LineNumber;
- UOpcode->Alignment = FwOpcode->Alignment;
-
- return (UINT8 *) UOpcode;
-}
-
-/**
- Create a Hii Update data Handle used to call IfrLibUpdateForm.
-
- @param ThunkContext The HII Thunk Context.
- @param FwUpdateData The Framework Update Data.
- @param UefiOpCodeHandle The UEFI opcode handle.
-
- @retval EFI_SUCCESS The UEFI Update Data is created successfully.
- @retval EFI_UNSUPPORTED There is unsupported opcode in FwUpdateData.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource.
-**/
-EFI_STATUS
-FwUpdateDataToUefiUpdateData (
- IN HII_THUNK_CONTEXT *ThunkContext,
- IN CONST EFI_HII_UPDATE_DATA *FwUpdateData,
- IN VOID *UefiOpCodeHandle
- )
-{
- FRAMEWORK_EFI_IFR_OP_HEADER *FwOpCode;
- FRAMEWORK_EFI_IFR_OP_HEADER *NextFwOpCode;
- UINTN Index;
- UINTN DataCount;
- UINT8 *OpCodeBuffer;
- LIST_ENTRY *StorageList;
- FORMSET_STORAGE *Storage;
- FORM_BROWSER_FORMSET *FormSet;
- CHAR16 *DefaultVarStoreName;
- UINT16 DefaultVarStoreId;
- EFI_IFR_VARSTORE_SELECT *SelectVarOp;
-
- FwOpCode = (FRAMEWORK_EFI_IFR_OP_HEADER *) &FwUpdateData->Data;
-
- FormSet = ThunkContext->FormSet;
- DefaultVarStoreId = FormSet->DefaultVarStoreId;
- DefaultVarStoreName = FormSet->OriginalDefaultVarStoreName;
-
- for (Index = 0; Index < FwUpdateData->DataCount; Index += DataCount) {
- switch (FwOpCode->OpCode) {
- case FRAMEWORK_EFI_IFR_SUBTITLE_OP:
- OpCodeBuffer = HiiCreateSubTitleOpCode (UefiOpCodeHandle, ((FRAMEWORK_EFI_IFR_SUBTITLE *) FwOpCode)->SubTitle, 0, 0, 0);
- DataCount = 1;
- break;
-
- case FRAMEWORK_EFI_IFR_TEXT_OP:
- OpCodeBuffer = F2UCreateTextOpCode (UefiOpCodeHandle, (FRAMEWORK_EFI_IFR_TEXT *) FwOpCode);
- DataCount = 1;
- break;
-
- case FRAMEWORK_EFI_IFR_REF_OP:
- OpCodeBuffer = F2UCreateReferenceOpCode (UefiOpCodeHandle, (FRAMEWORK_EFI_IFR_REF *) FwOpCode);
- DataCount = 1;
- break;
-
- case FRAMEWORK_EFI_IFR_ONE_OF_OP:
- OpCodeBuffer = F2UCreateOneOfOpCode (UefiOpCodeHandle, ThunkContext, (FRAMEWORK_EFI_IFR_ONE_OF *) FwOpCode, &NextFwOpCode, &DataCount);
- if (OpCodeBuffer != NULL) {
- FwOpCode = NextFwOpCode;
- //
- // FwOpCode is already updated to point to the next opcode.
- //
- continue;
- }
- break;
-
- case FRAMEWORK_EFI_IFR_ORDERED_LIST_OP:
- OpCodeBuffer = F2UCreateOrderedListOpCode (UefiOpCodeHandle, ThunkContext, (FRAMEWORK_EFI_IFR_ORDERED_LIST *) FwOpCode, &NextFwOpCode, &DataCount);
- if (OpCodeBuffer != NULL) {
- FwOpCode = NextFwOpCode;
- //
- // FwOpCode is already updated to point to the next opcode.
- //
- continue;
- }
- break;
-
- case FRAMEWORK_EFI_IFR_CHECKBOX_OP:
- OpCodeBuffer = F2UCreateCheckBoxOpCode (UefiOpCodeHandle, ThunkContext, (FRAMEWORK_EFI_IFR_CHECKBOX *) FwOpCode);
- DataCount = 1;
- break;
-
- case FRAMEWORK_EFI_IFR_STRING_OP:
- OpCodeBuffer = F2UCreateStringOpCode (UefiOpCodeHandle, ThunkContext, (FRAMEWORK_EFI_IFR_STRING *) FwOpCode);
- DataCount = 1;
- break;
-
- case EFI_IFR_BANNER_OP:
- OpCodeBuffer = F2UCreateBannerOpCode (UefiOpCodeHandle, (EFI_IFR_BANNER *) FwOpCode);
- DataCount = 1;
- break;
-
- case EFI_IFR_END_ONE_OF_OP:
- OpCodeBuffer = HiiCreateEndOpCode (UefiOpCodeHandle);
- DataCount = 1;
- break;
-
- case FRAMEWORK_EFI_IFR_NUMERIC_OP:
- OpCodeBuffer = F2UCreateNumericOpCode (UefiOpCodeHandle, ThunkContext, (FRAMEWORK_EFI_IFR_NUMERIC *) FwOpCode);
- DataCount = 1;
- break;
-
- case EFI_IFR_VARSTORE_SELECT_OP:
- OpCodeBuffer = (UINT8 *) FwOpCode;
- SelectVarOp = (EFI_IFR_VARSTORE_SELECT *) FwOpCode;
- //
- // Check whether the selected VarId is in StorageList.
- //
- StorageList = GetFirstNode (&FormSet->StorageListHead);
- while (!IsNull (&FormSet->StorageListHead, StorageList)) {
- Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
- if (Storage->VarStoreId == SelectVarOp->VarId) {
- break;
- }
- StorageList = GetNextNode (&FormSet->StorageListHead, StorageList);
- }
- ASSERT (!IsNull (&FormSet->StorageListHead, StorageList));
- //
- // Change VarStoreId to the selected VarId.
- //
- FormSet->DefaultVarStoreId = SelectVarOp->VarId;
- if (SelectVarOp->VarId == DefaultVarStoreId) {
- FormSet->OriginalDefaultVarStoreName = DefaultVarStoreName;
- }
- DataCount = 1;
- break;
-
- default:
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
- }
-
- if (OpCodeBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- FwOpCode = (FRAMEWORK_EFI_IFR_OP_HEADER *)((UINT8 *) FwOpCode + FwOpCode->Length);
- }
-
- //
- // Revert FromSet default varstore ID.
- //
- FormSet->DefaultVarStoreId = DefaultVarStoreId;
- FormSet->OriginalDefaultVarStoreName = DefaultVarStoreName;
- return EFI_SUCCESS;
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Package.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Package.c
deleted file mode 100644
index caa5cf87d4..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Package.c
+++ /dev/null
@@ -1,897 +0,0 @@
-/** @file
- Implement protocol interface related to package registrations.
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-
-#include "HiiDatabase.h"
-#include "HiiHandle.h"
-
-
-BOOLEAN mInFrameworkHiiNewPack = FALSE;
-BOOLEAN mInFrameworkHiiRemovePack = FALSE;
-BOOLEAN mInFrameworkUpdatePakcage = FALSE;
-UINT64 mGuidCount = 0;
-
-EFI_GUID mGuidBase = { 0x14f95e01, 0xd562, 0x432e, { 0x84, 0x4a, 0x95, 0xa4, 0x39, 0x5, 0x10, 0x7e }};
-
-
-
-/**
- Get the number of Form, STRING and Font packages in the package list passed in.
-
- @param Packages Package List.
- @param IfrPackageCount Number of IFR Packages.
- @param StringPackageCount Number of String Packages.
- @param FontPackageCount Number of Font Packages.
-
- @retval EFI_INVALID_PARAMETER If the Package List has package with type of
- EFI_HII_PACKAGE_KEYBOARD_LAYOUT, EFI_HII_PACKAGE_FONTS, EFI_HII_PACKAGE_IMAGES.
- @retval EFI_SUCCESS Successfully get the number of IFR and STRING package.
-
-
-**/
-EFI_STATUS
-GetPackageCount (
- IN CONST EFI_HII_PACKAGES *Packages,
- OUT UINTN *IfrPackageCount,
- OUT UINTN *StringPackageCount,
- OUT UINTN *FontPackageCount
- )
-{
- UINTN Index;
- TIANO_AUTOGEN_PACKAGES_HEADER **TianoAutogenPackageHdrArray;
-
- ASSERT (Packages != NULL);
- ASSERT (IfrPackageCount != NULL);
- ASSERT (StringPackageCount != NULL);
- ASSERT (FontPackageCount != NULL);
-
- *IfrPackageCount = 0;
- *StringPackageCount = 0;
- *FontPackageCount = 0;
-
- TianoAutogenPackageHdrArray = (TIANO_AUTOGEN_PACKAGES_HEADER **) (((UINT8 *) &Packages->GuidId) + sizeof (Packages->GuidId));
-
- for (Index = 0; Index < Packages->NumberOfPackages; Index++) {
- //
- // The current UEFI HII build tool generate a binary in the format defined by
- // TIANO_AUTOGEN_PACKAGES_HEADER. We assume that all packages generated in
- // this binary is with same package type. So the returned IfrPackageCount and StringPackageCount
- // may not be the exact number of valid package number in the binary generated
- // by HII Build tool.
- //
- switch (TianoAutogenPackageHdrArray[Index]->FrameworkPackageHeader.Type) {
- case EFI_HII_IFR:
- *IfrPackageCount += 1;
- break;
- case EFI_HII_STRING:
- *StringPackageCount += 1;
- break;
-
- case EFI_HII_FONT:
- *FontPackageCount += 1;
- break;
-
- //
- // The following fonts are invalid for a module that using Framework to UEFI thunk layer.
- //
- default:
- ASSERT (FALSE);
- return EFI_INVALID_PARAMETER;
- break;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Insert the String Package into the Package Lists which has the TAG GUID matching
- the PackageListGuid of the String Package.
-
- The Package List must have only IFR Package and no String Package.
- Otherwise, ASSERT.
-
- @param Private The HII THUNK driver context data.
- @param StringPackageThunkContext The HII THUNK context data.
- @param StringPackageListHeader The String Package List Header.
-
-**/
-VOID
-UpdatePackListWithOnlyIfrPack (
- IN HII_THUNK_PRIVATE_DATA *Private,
- IN HII_THUNK_CONTEXT *StringPackageThunkContext,
- IN CONST EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- HII_THUNK_CONTEXT *ThunkContext;
-
- Link = GetFirstNode (&Private->ThunkContextListHead);
- while (!IsNull (&Private->ThunkContextListHead, Link)) {
-
- ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
-
- if (StringPackageThunkContext != ThunkContext) {
- //
- // Skip the String Package Thunk Entry itself.
- //
-
- if (CompareGuid (&StringPackageListHeader->PackageListGuid, &ThunkContext->TagGuid)) {
-
- ASSERT (ThunkContext->StringPackageCount == 0 && ThunkContext->IfrPackageCount == 1);
-
- ThunkContext->StringPackageCount = GetPackageCountByType (StringPackageListHeader, EFI_HII_PACKAGE_STRINGS);
-
- Status = mHiiDatabase->UpdatePackageList (
- mHiiDatabase,
- ThunkContext->UefiHiiHandle,
- StringPackageListHeader
- );
- ASSERT_EFI_ERROR (Status);
-
- ThunkContext->SharingStringPack = TRUE;
- StringPackageThunkContext->SharingStringPack = TRUE;
-
- }
- }
-
- Link = GetNextNode (&Private->ThunkContextListHead, Link);
- }
-
-}
-
-/**
- Caculate the size of UEFI Simple Font Package that is needed to
- convert all the font a Framework Font Paackage.
-
- ONLY Narrow Font is supported. Wide Font is discarded.
-
- If the Package Header is not of EFI_HII_FONT type, then ASSERT.
-
- @param PackHeader Pointer to Framework Font Package.
-
- @return The size of the UEFI Simple Font Package.
-
-**/
-UINTN
-GetUefiSimpleFontPackSize (
- IN CONST EFI_HII_PACK_HEADER * PackHeader
- )
-{
- UINTN Size;
- EFI_HII_FONT_PACK *FwFontPack;
-
- FwFontPack = (EFI_HII_FONT_PACK *) PackHeader;
-
- ASSERT (FwFontPack->Header.Type == EFI_HII_FONT);
-
- Size = sizeof (EFI_HII_SIMPLE_FONT_PACKAGE_HDR)
- + (FwFontPack->NumberOfNarrowGlyphs * sizeof (EFI_NARROW_GLYPH));
-
- return Size;
-}
-
-
-/**
- Convert Font Package in Framework format to a newly allocated UEFI
- Simple Font Package.
-
- ONLY Narrow Font is supported. Wide Font is discarded.
-
- If memory allocation fails, then ASSERT.
-
- @param PackHeader Pointer to Framework Font Package header.
-
- @return UEFI Simple Font Package.
-**/
-EFI_HII_SIMPLE_FONT_PACKAGE_HDR *
-FrameworkFontPackToUefiSimpliedFont (
- IN CONST EFI_HII_PACK_HEADER * PackHeader
- )
-{
- EFI_HII_SIMPLE_FONT_PACKAGE_HDR *FontPack;
- UINTN Size;
- EFI_NARROW_GLYPH *FwNarrowGlyph;
- EFI_NARROW_GLYPH *NarrowGlyph;
- UINTN Idx;
- EFI_HII_FONT_PACK *FwFontPack;
-
- Size = GetUefiSimpleFontPackSize (PackHeader);
-
- FwFontPack = (EFI_HII_FONT_PACK *) PackHeader;
-
- FontPack = AllocateZeroPool (Size);
- ASSERT (FontPack != NULL);
-
- //
- // Prepare the Header information.
- //
- FontPack->Header.Length = (UINT32) Size;
- FontPack->Header.Type = EFI_HII_PACKAGE_SIMPLE_FONTS;
-
- FontPack->NumberOfNarrowGlyphs = FwFontPack->NumberOfNarrowGlyphs;
-
- //
- // ONLY Narrow Font is supported. Wide Font is discarded.
- //
- FontPack->NumberOfWideGlyphs = 0;
-
- //
- // Copy Narrow Glyph
- //
- NarrowGlyph = (EFI_NARROW_GLYPH *) (FontPack + 1);
- FwNarrowGlyph = (EFI_NARROW_GLYPH *) (FwFontPack + 1);
- CopyMem (NarrowGlyph, FwNarrowGlyph, sizeof (EFI_NARROW_GLYPH) * FwFontPack->NumberOfNarrowGlyphs);
- for (Idx = 0; Idx < FwFontPack->NumberOfNarrowGlyphs; Idx++) {
- //
- // Clear the GLYPH_NON_BREAKING (EFI_GLYPH_WIDE is used here as they are all 0x02)
- // attribute which is not defined in UEFI EFI_NARROW_GLYPH
- //
- NarrowGlyph[Idx].Attributes = (UINT8) (NarrowGlyph[Idx].Attributes & ~(EFI_GLYPH_WIDE));
- }
-
- return FontPack;
-}
-
-/**
- Prepare a UEFI Package List from a Framework HII package list registered
- from a Framework HII NewPack () function.
-
- If either Packages or PackageListGuid is NULL, then ASSERT.
-
- @param Packages The Framework HII Package List.
- @param PackageListGuid The Package List GUID.
-
-
- @return The UEFI Package List.
-**/
-EFI_HII_PACKAGE_LIST_HEADER *
-PrepareUefiPackageListFromFrameworkHiiPackages (
- IN CONST EFI_HII_PACKAGES *Packages,
- IN CONST EFI_GUID *PackageListGuid
- )
-{
- UINTN NumberOfPackages;
- EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
- UINT8 *PackageListData;
- UINT32 PackageListLength;
- UINT32 PackageLength;
- EFI_HII_PACKAGE_HEADER PackageHeader;
- UINTN Index;
- TIANO_AUTOGEN_PACKAGES_HEADER **TianoAutogenPackageHdrArray;
- EFI_HII_SIMPLE_FONT_PACKAGE_HDR *FontPack;
-
-
- ASSERT (Packages != NULL);
- ASSERT (PackageListGuid != NULL);
-
- TianoAutogenPackageHdrArray = (TIANO_AUTOGEN_PACKAGES_HEADER **) ((UINT8 *) &Packages->GuidId + sizeof (Packages->GuidId));
- NumberOfPackages = Packages->NumberOfPackages;
-
- PackageListLength = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
-
- for (Index = 0; Index < NumberOfPackages; Index++) {
- if (TianoAutogenPackageHdrArray[Index]->FrameworkPackageHeader.Type == EFI_HII_FONT) {
- //
- // There is no tool to generate Font package in Framework HII's implementation.
- // Therefore, Font Package be a C structure defined in Framework HII code.
- // Therefore, Font Package will be in Framework HII format defined by EFI_HII_FONT_PACK.
- // We need to create a UEFI Simple Font Package and copy over all data. Hence, EFI_HII_FONT
- // is handled differently than EFI_HII_IFR and EFI_HII_STRING.
- //
- PackageListLength = (UINT32) (PackageListLength + GetUefiSimpleFontPackSize (&TianoAutogenPackageHdrArray[Index]->FrameworkPackageHeader));
-
- } else {
- //
- // For EFI_HII_IFR and EFI_HII_STRING, EDK II's VFR Compiler and Build.exe will generate a binary in a format
- // defined by TIANO_AUTOGEN_PACKAGES_HEADER. A Framework HII's EFI_HII_PACK_HEADER is inserted before
- // the UEFI package data.
- //
- CopyMem (&PackageLength, &TianoAutogenPackageHdrArray[Index]->FrameworkPackageHeader.Length, sizeof (UINT32));
- //
- // EFI_HII_PACK_HEADER.FrameworkPackageHeader.Length include the sizeof FrameworkPackageHeader itself.
- //
- PackageListLength += (PackageLength - sizeof(EFI_HII_PACK_HEADER));
-
- }
- }
-
- //
- // Include the lenght of EFI_HII_PACKAGE_END
- //
- PackageListLength += sizeof (EFI_HII_PACKAGE_HEADER);
- PackageListHeader = AllocateZeroPool (PackageListLength);
- ASSERT (PackageListHeader != NULL);
-
- CopyMem (&PackageListHeader->PackageListGuid, PackageListGuid, sizeof (EFI_GUID));
- PackageListHeader->PackageLength = PackageListLength;
-
- PackageListData = ((UINT8 *) PackageListHeader) + sizeof (EFI_HII_PACKAGE_LIST_HEADER);
-
- //
- // Build the UEFI Package List.
- //
- for (Index = 0; Index < NumberOfPackages; Index++) {
- if (TianoAutogenPackageHdrArray[Index]->FrameworkPackageHeader.Type == EFI_HII_FONT) {
- PackageLength = (UINT32) GetUefiSimpleFontPackSize (&TianoAutogenPackageHdrArray[Index]->FrameworkPackageHeader);
- FontPack = FrameworkFontPackToUefiSimpliedFont (&TianoAutogenPackageHdrArray[Index]->FrameworkPackageHeader);
- CopyMem (PackageListData, FontPack, PackageLength);
- FreePool (FontPack);
-
- } else {
- CopyMem (&PackageLength, &(TianoAutogenPackageHdrArray[Index]->FrameworkPackageHeader.Length), sizeof (UINT32));
- PackageLength -= sizeof (EFI_HII_PACK_HEADER);
- CopyMem (PackageListData, &(TianoAutogenPackageHdrArray[Index]->PackageHeader), PackageLength);
-
- }
- PackageListData += PackageLength;
- }
-
- //
- // Append EFI_HII_PACKAGE_END
- //
- PackageHeader.Type = EFI_HII_PACKAGE_END;
- PackageHeader.Length = sizeof (EFI_HII_PACKAGE_HEADER);
- CopyMem (PackageListData, &PackageHeader, PackageHeader.Length);
-
- return PackageListHeader;
-}
-
-
-/**
- Generate a Random GUID.
-
- @param Guid On output, a Random GUID will be filled.
-
-**/
-VOID
-GenerateRandomGuid (
- OUT EFI_GUID * Guid
- )
-{
- CopyGuid (Guid, &mGuidBase);
-
- mGuidCount++;
- *((UINT64 *) Guid) = *((UINT64 *) Guid) + mGuidCount;
-}
-
-/**
- Given a Package List with only a IFR package, find the Package List that only has a String Package based on
- the TAG GUID. Then export the String Package from the Package List and insert it
- to the given IFR package.
-
- This is to handle the case of Framework HII interface which allow String Package
- and IFR package to be registered using two different NewPack () calls.
-
- @param Private The HII THUNK driver context data.
- @param IfrThunkContext Package List with only a IFR package.
-
- @retval EFI_SUCCESS If the String Package is found and inserted to the
- Package List with only a IFR package.
- @retval EFI_NOT_FOUND No String Package matching the TAG GUID is found.
-**/
-EFI_STATUS
-FindStringPackAndUpdatePackListWithOnlyIfrPack (
- IN HII_THUNK_PRIVATE_DATA *Private,
- IN HII_THUNK_CONTEXT *IfrThunkContext
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader;
- UINTN Size;
- HII_THUNK_CONTEXT *ThunkContext;
-
- Link = GetFirstNode (&Private->ThunkContextListHead);
-
- while (!IsNull (&Private->ThunkContextListHead, Link)) {
-
- ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
-
- if (ThunkContext != IfrThunkContext) {
- if (CompareGuid (&IfrThunkContext->TagGuid, &ThunkContext->TagGuid) && (ThunkContext->IfrPackageCount == 0)) {
- StringPackageListHeader = NULL;
- Status = ExportPackageLists (ThunkContext->UefiHiiHandle, &StringPackageListHeader, &Size);
- ASSERT_EFI_ERROR (Status);
- if (StringPackageListHeader == NULL) {
- return EFI_NOT_FOUND;
- }
-
- IfrThunkContext->StringPackageCount = GetPackageCountByType (StringPackageListHeader, EFI_HII_PACKAGE_STRINGS);
- //
- // Add Function to only get only String Packages from the Package List
- //
- Status = mHiiDatabase->UpdatePackageList (
- mHiiDatabase,
- IfrThunkContext->UefiHiiHandle,
- StringPackageListHeader
- );
- ASSERT_EFI_ERROR (Status);
-
- FreePool (StringPackageListHeader);
-
- IfrThunkContext->SharingStringPack = TRUE;
- ThunkContext->SharingStringPack = TRUE;
-
- return EFI_SUCCESS;
-
- }
- }
-
- Link = GetNextNode (&Private->ThunkContextListHead, Link);
- }
-
- //
- // A Form Package must have a String Package to function.
- // If ASSERT here, check the sequence of call to Hii->NewPack.
- // String Pack must be registered before Ifr Package is registered.
- //
- ASSERT (FALSE);
- return EFI_NOT_FOUND;
-
-}
-
-
-/**
- Register the Package List passed from the Framework HII NewPack () interface.
- The FRAMEWORK_EFI_HII_HANDLE will be returned.
-
- @param This The EFI_HII_PROTOCOL context data. Only used
- to call HiiRemovePack.
- @param Private The HII THUNK driver context data.
- @param Packages Package List.
- @param Handle On output, a FRAMEWORK_EFI_HII_HANDLE number is
- returned.
-
- @retval EFI_SUCCESS The Package List is registered successfully in
- the database.
- @retval EFI_UNSUPPORTED The number of IFR package in the package list
- is greater than 1.
- @retval EFI_OUT_OF_RESOURCE Not enough resouce.
-
-**/
-EFI_STATUS
-UefiRegisterPackageList (
- IN EFI_HII_PROTOCOL *This,
- IN HII_THUNK_PRIVATE_DATA *Private,
- IN EFI_HII_PACKAGES *Packages,
- OUT FRAMEWORK_EFI_HII_HANDLE *Handle
- )
-{
- EFI_STATUS Status;
- UINTN StringPackageCount;
- UINTN IfrPackageCount;
- UINTN FontPackageCount;
- EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
- HII_THUNK_CONTEXT *ThunkContext;
- HII_THUNK_CONTEXT *ThunkContextToRemove;
- EFI_GUID GuidId;
- EFI_HII_PACKAGE_HEADER *IfrPackage;
-
- PackageListHeader = NULL;
-
- Status = GetPackageCount (Packages, &IfrPackageCount, &StringPackageCount, &FontPackageCount);
- ASSERT_EFI_ERROR (Status);
-
- if (IfrPackageCount > 1) {
- //
- // HII Thunk only handle package with 0 or 1 IFR package.
- //
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
- }
-
- ThunkContext = CreateThunkContext (Private, StringPackageCount, IfrPackageCount);
- if (ThunkContext == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- ThunkContext->ByFrameworkHiiNewPack = TRUE;
-
- if (Packages->GuidId == NULL) {
- //
- // UEFI HII Database require Package List GUID must be unique.
- //
- // If Packages->GuidId is NULL, the caller of FramworkHii->NewPack is registering
- // packages with at least 1 StringPack and 1 IfrPack. Therefore, Packages->GuidId is
- // not used as the name of the package list. Formset GUID is used as the Package List
- // GUID instead.
- //
- ASSERT ((StringPackageCount >=1 && IfrPackageCount == 1) || (FontPackageCount > 0));
- if (IfrPackageCount > 0) {
- IfrPackage = GetIfrPackage (Packages);
- if (IfrPackage == NULL) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
- GetFormSetGuid (IfrPackage, &ThunkContext->TagGuid);
- } else {
- ASSERT (FontPackageCount > 0);
- GenerateRandomGuid (&ThunkContext->TagGuid);
- }
-
- } else {
- ThunkContextToRemove = TagGuidToIfrPackThunkContext (Private, Packages->GuidId);
-
- if (IfrPackageCount > 0 &&
- StringPackageCount > 0 &&
- (ThunkContextToRemove != NULL)) {
- DEBUG((EFI_D_WARN, "Framework code registers HII package list with the same GUID more than once.\n"));
- DEBUG((EFI_D_WARN, "Remove the previously registered package list and register the new one.\n"));
- HiiRemovePack (This, ThunkContextToRemove->FwHiiHandle);
- }
- CopyGuid (&ThunkContext->TagGuid, Packages->GuidId);
-
- }
-
- //
- // UEFI HII require EFI_HII_CONFIG_ACCESS_PROTOCOL to be installed on a EFI_HANDLE, so
- // that Setup Utility can load the Buffer Storage using this protocol. An UEFI VFR can only
- // produce IFR package generated with Buffer Storage type and EFI Variable Storage.
- // The default EFI_HII_CONFIG_ACCESS_PROTOCOL is used to Get/Set the Buffer Storage.
- //
- if (IfrPackageCount != 0) {
- InstallDefaultConfigAccessProtocol (Packages, ThunkContext);
- }
-
- PackageListHeader = PrepareUefiPackageListFromFrameworkHiiPackages (Packages, &ThunkContext->TagGuid);
- Status = mHiiDatabase->NewPackageList (
- mHiiDatabase,
- PackageListHeader,
- ThunkContext->UefiHiiDriverHandle,
- &ThunkContext->UefiHiiHandle
- );
- if (Status == EFI_INVALID_PARAMETER) {
- FreePool (PackageListHeader);
-
- //
- // UEFI HII database does not allow two package list with the same GUID.
- // In Framework HII implementation, Packages->GuidId is used as an identifier to associate
- // a PackageList with only IFR to a Package list the with String package.
- //
- GenerateRandomGuid (&GuidId);
-
- PackageListHeader = PrepareUefiPackageListFromFrameworkHiiPackages (Packages, &GuidId);
- Status = mHiiDatabase->NewPackageList (
- mHiiDatabase,
- PackageListHeader,
- ThunkContext->UefiHiiDriverHandle,
- &ThunkContext->UefiHiiHandle
- );
- }
-
- //
- // BUGBUG: Remove when development is done
- //
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- if (IfrPackageCount == 0) {
- if (StringPackageCount != 0) {
- //
- // Look for a Package List with only IFR Package with the same TAG GUID name.
- // If found one, add the String Packages to the found Package List.
- // This is needed because Framework HII Module may not register the String Package
- // and IFR Package in one NewPack () call.
- //
- UpdatePackListWithOnlyIfrPack (
- Private,
- ThunkContext,
- PackageListHeader
- );
- }
- } else {
- if (StringPackageCount == 0) {
- //
- // Look for the String Package with the same TAG GUID name and add
- // the found String Package to this Package List.
- // This is needed because Framework HII Module may not register the String Package
- // and IFR Package in one NewPack () call.
- //
- Status = FindStringPackAndUpdatePackListWithOnlyIfrPack (
- Private,
- ThunkContext
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- }
-
- //
- // Parse the Formset. Must be called after FindStringPackAndUpdatePackListWithOnlyIfrPack is called so
- // that String Package is ready.
- //
- ThunkContext->FormSet = ParseFormSet (ThunkContext->UefiHiiHandle);
- ASSERT (ThunkContext->FormSet != NULL);
-
- }
-
-Done:
- if (EFI_ERROR (Status)) {
- DestroyThunkContext (ThunkContext);
- } else {
- InsertTailList (&Private->ThunkContextListHead, &ThunkContext->Link);
- *Handle = ThunkContext->FwHiiHandle;
- }
-
- if (PackageListHeader != NULL) {
- FreePool (PackageListHeader);
- }
-
- return Status;
-}
-
-
-/**
-
- Registers the various packages that are passed in a Package List.
-
- @param This Pointer of Frameowk HII protocol instance.
- @param Packages Pointer of HII packages.
- @param Handle Handle value to be returned.
-
- @retval EFI_SUCCESS Packages has added to HII database successfully.
- @retval EFI_INVALID_PARAMETER If Handle or Packages is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiNewPack (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_PACKAGES *Packages,
- OUT FRAMEWORK_EFI_HII_HANDLE *Handle
- )
-{
- EFI_STATUS Status;
- HII_THUNK_PRIVATE_DATA *Private;
- EFI_TPL OldTpl;
-
- if (Handle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Packages == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- //
- // We use a simple Global variable to inform NewOrAddPackNotify()
- // that the package list registered here is already registered
- // in the HII Thunk Layer. So NewOrAddPackNotify () does not need to
- // call registered the Package List again.
- //
- mInFrameworkHiiNewPack = TRUE;
-
- Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
-
- Status = UefiRegisterPackageList (
- This,
- Private,
- Packages,
- Handle
- );
-
- mInFrameworkHiiNewPack = FALSE;
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-/**
-
- Remove a package from the HII database.
-
- @param This Pointer of Frameowk HII protocol instance.
- @param Handle Handle value to be removed.
-
- @retval EFI_SUCCESS Packages has added to HII database successfully.
- @retval EFI_INVALID_PARAMETER If Handle or Packages is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiRemovePack (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle
- )
-{
- EFI_STATUS Status;
- HII_THUNK_PRIVATE_DATA *Private;
- HII_THUNK_CONTEXT *ThunkContext;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- mInFrameworkHiiRemovePack = TRUE;
-
- Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
-
- ThunkContext = FwHiiHandleToThunkContext (Private, Handle);
-
- if (ThunkContext != NULL) {
- Status = mHiiDatabase->RemovePackageList (
- mHiiDatabase,
- ThunkContext->UefiHiiHandle
- );
- ASSERT_EFI_ERROR (Status);
-
- if (ThunkContext->IfrPackageCount != 0) {
- UninstallDefaultConfigAccessProtocol (ThunkContext);
- }
-
- DestroyThunkContext (ThunkContext);
- }else {
- Status = EFI_NOT_FOUND;
- }
-
- mInFrameworkHiiRemovePack = FALSE;
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-/**
- This notification function will be called when a Package List is registered
- using UEFI HII interface. The Package List registered need to be recorded in
- Framework Thunk module as Thunk Module may need to look for String Package in
- the package registered.
-
- If the Package List registered is not either Sting Package or IFR package,
- then ASSERT. If the NotifyType is not ADD_PACK or NEW_PACK, then ASSERT.
- Both cases means UEFI HII Database itself is buggy.
-
- @param PackageType The Package Type.
- @param PackageGuid The Package GUID.
- @param Package The Package Header.
- @param Handle The HII Handle of this Package List.
- @param NotifyType The reason of the notification.
-
- @retval EFI_SUCCESS The notification function is successful.
-
-**/
-EFI_STATUS
-EFIAPI
-NewOrAddPackNotify (
- IN UINT8 PackageType,
- IN CONST EFI_GUID *PackageGuid,
- IN CONST EFI_HII_PACKAGE_HEADER *Package,
- IN EFI_HII_HANDLE Handle,
- IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType
- )
-{
- EFI_STATUS Status;
- HII_THUNK_PRIVATE_DATA *Private;
- HII_THUNK_CONTEXT *ThunkContext;
-
- ASSERT (PackageType == EFI_HII_PACKAGE_STRINGS || PackageType == EFI_HII_PACKAGE_FORMS);
- ASSERT (NotifyType == EFI_HII_DATABASE_NOTIFY_ADD_PACK || NotifyType == EFI_HII_DATABASE_NOTIFY_NEW_PACK);
-
- Status = EFI_SUCCESS;
- Private = mHiiThunkPrivateData;
-
- if (mInFrameworkHiiNewPack || mInFrameworkUpdatePakcage) {
- return EFI_SUCCESS;
- }
-
- //
- // We will create a ThunkContext to log the package list only if the
- // package is not registered with by Framework HII Thunk module yet.
- //
- ThunkContext = UefiHiiHandleToThunkContext (Private, Handle);
- if (ThunkContext == NULL) {
- ThunkContext = CreateThunkContextForUefiHiiHandle (Handle);
- ASSERT (ThunkContext != NULL);
-
- InsertTailList (&Private->ThunkContextListHead, &ThunkContext->Link);
- }
-
- if (PackageType == EFI_HII_PACKAGE_FORMS) {
- if (ThunkContext->FormSet != NULL) {
- DestroyFormSet (ThunkContext->FormSet);
- }
-
- //
- // Reparse the FormSet.
- //
- ThunkContext->FormSet = ParseFormSet (ThunkContext->UefiHiiHandle);
- }
-
- return Status;
-}
-
-/**
- This notification function will be called when a Package List is removed
- using UEFI HII interface. The Package List removed need to be removed from
- Framework Thunk module too.
-
- If the Package List registered is not Sting Package,
- then ASSERT. If the NotifyType is not REMOVE_PACK, then ASSERT.
- Both cases means UEFI HII Database itself is buggy.
-
- @param PackageType The Package Type.
- @param PackageGuid The Package GUID.
- @param Package The Package Header.
- @param Handle The HII Handle of this Package List.
- @param NotifyType The reason of the notification.
-
- @retval EFI_SUCCESS The notification function is successful.
-
-**/
-EFI_STATUS
-EFIAPI
-RemovePackNotify (
- IN UINT8 PackageType,
- IN CONST EFI_GUID *PackageGuid,
- IN CONST EFI_HII_PACKAGE_HEADER *Package,
- IN EFI_HII_HANDLE Handle,
- IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType
- )
-{
- EFI_STATUS Status;
- HII_THUNK_PRIVATE_DATA *Private;
- HII_THUNK_CONTEXT *ThunkContext;
- EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
- UINTN BufferSize;
-
- Status = EFI_SUCCESS;
-
- ASSERT (PackageType == EFI_HII_PACKAGE_STRINGS);
- ASSERT (NotifyType == EFI_HII_DATABASE_NOTIFY_REMOVE_PACK);
-
- if (mInFrameworkHiiRemovePack || mInFrameworkUpdatePakcage) {
- return EFI_SUCCESS;
- }
-
- Private = mHiiThunkPrivateData;
-
- ThunkContext = UefiHiiHandleToThunkContext (Private, Handle);
-
- //
- // BugBug: Change to ASSERT if HII Database fix the bug and to also invoke
- // NEW_PACK_NOTIFY for package (String Package) created internally.
- //
- if (ThunkContext != NULL) {
- if (!ThunkContext->ByFrameworkHiiNewPack) {
- HiiPackageList = NULL;
- Status = ExportPackageLists (Handle, &HiiPackageList, &BufferSize);
- ASSERT_EFI_ERROR (Status);
- if (HiiPackageList == NULL) {
- return EFI_NOT_FOUND;
- }
-
- if (GetPackageCountByType (HiiPackageList, EFI_HII_PACKAGE_STRINGS) == 1) {
- //
- // If the string package will be removed is the last string package
- // in the package list, we will remove the HII Thunk entry from the
- // database.
- //
- DestroyThunkContextForUefiHiiHandle (Private, Handle);
- }
-
- FreePool (HiiPackageList);
- }
- }
-
-
- return Status;
-}
-
-
-
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/SetupBrowser.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/SetupBrowser.c
deleted file mode 100644
index 1a8219ac46..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/SetupBrowser.c
+++ /dev/null
@@ -1,709 +0,0 @@
-/** @file
-Framework to UEFI 2.1 Setup Browser Thunk. The file consume EFI_FORM_BROWSER2_PROTOCOL
-to produce a EFI_FORM_BROWSER_PROTOCOL.
-
-Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "HiiDatabase.h"
-#include "SetupBrowser.h"
-
-EFI_HII_HANDLE gStringPackHandle = NULL;
-BOOLEAN mFrontPageDisplayed = FALSE;
-//
-// 106F3545-B788-4cb5-9D2A-CE0CDB208DF5
-//
-EFI_GUID gEfiHiiThunkProducerGuid = { 0x106f3545, 0xb788, 0x4cb5, { 0x9d, 0x2a, 0xce, 0xc, 0xdb, 0x20, 0x8d, 0xf5 } };
-
-
-/**
- Get string by string id from HII Interface
-
-
- @param Id String ID.
-
- @retval CHAR16 * String from ID.
- @retval NULL If error occurs.
-
-**/
-CHAR16 *
-GetStringById (
- IN EFI_STRING_ID Id
- )
-{
- return HiiGetString (gStringPackHandle, Id, NULL);
-}
-
-/**
-
- Show progress bar with title above it. It only works in Graphics mode.
-
-
- @param TitleForeground Foreground color for Title.
- @param TitleBackground Background color for Title.
- @param Title Title above progress bar.
- @param ProgressColor Progress bar color.
- @param Progress Progress (0-100)
- @param PreviousValue The previous value of the progress.
-
- @retval EFI_STATUS Success update the progress bar
-
-**/
-EFI_STATUS
-PlatformBdsShowProgress (
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
- IN CHAR16 *Title,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
- IN UINTN Progress,
- IN UINTN PreviousValue
- )
-{
- EFI_STATUS Status;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- UINT32 SizeOfX;
- UINT32 SizeOfY;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
- UINTN BlockHeight;
- UINTN BlockWidth;
- UINTN BlockNum;
- UINTN PosX;
- UINTN PosY;
- UINTN Index;
-
- if (Progress > 100) {
- return EFI_INVALID_PARAMETER;
- }
-
- UgaDraw = NULL;
- Status = gBS->HandleProtocol (
- gST->ConsoleOutHandle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID **) &GraphicsOutput
- );
- if (EFI_ERROR (Status)) {
- GraphicsOutput = NULL;
-
- Status = gBS->HandleProtocol (
- gST->ConsoleOutHandle,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw
- );
- }
- if (EFI_ERROR (Status) || (GraphicsOutput == NULL && UgaDraw == NULL)) {
- return EFI_UNSUPPORTED;
- }
-
- SizeOfX = 0;
- SizeOfY = 0;
- if (GraphicsOutput != NULL) {
- SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
- SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
- } else {
- Status = UgaDraw->GetMode (
- UgaDraw,
- &SizeOfX,
- &SizeOfY,
- &ColorDepth,
- &RefreshRate
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- }
-
- BlockWidth = SizeOfX / 100;
- BlockHeight = SizeOfY / 50;
-
- BlockNum = Progress;
-
- PosX = 0;
- PosY = SizeOfY * 48 / 50;
-
- if (BlockNum == 0) {
- //
- // Clear progress area
- //
- SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
-
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- &Color,
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- PosY - EFI_GLYPH_HEIGHT - 1,
- SizeOfX,
- SizeOfY - (PosY - EFI_GLYPH_HEIGHT - 1),
- SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) &Color,
- EfiUgaVideoFill,
- 0,
- 0,
- 0,
- PosY - EFI_GLYPH_HEIGHT - 1,
- SizeOfX,
- SizeOfY - (PosY - EFI_GLYPH_HEIGHT - 1),
- SizeOfX * sizeof (EFI_UGA_PIXEL)
- );
- }
- }
- //
- // Show progress by drawing blocks
- //
- for (Index = PreviousValue; Index < BlockNum; Index++) {
- PosX = Index * BlockWidth;
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- &ProgressColor,
- EfiBltVideoFill,
- 0,
- 0,
- PosX,
- PosY,
- BlockWidth - 1,
- BlockHeight,
- (BlockWidth) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) &ProgressColor,
- EfiUgaVideoFill,
- 0,
- 0,
- PosX,
- PosY,
- BlockWidth - 1,
- BlockHeight,
- (BlockWidth) * sizeof (EFI_UGA_PIXEL)
- );
- }
- }
-
- PrintXY (
- (SizeOfX - StrLen (Title) * EFI_GLYPH_WIDTH) / 2,
- PosY - EFI_GLYPH_HEIGHT - 1,
- &TitleForeground,
- &TitleBackground,
- Title
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Function waits for a given event to fire, or for an optional timeout to expire.
-
-
- @param Event The event to wait for
-
- @param Timeout An optional timeout value in 100 ns units.
-
- @retval EFI_SUCCESS Event fired before Timeout expired.
- @retval EFI_TIME_OUT Timout expired before Event fired..
-
-**/
-EFI_STATUS
-WaitForSingleEvent (
- IN EFI_EVENT Event,
- IN UINT64 Timeout OPTIONAL
- )
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_EVENT TimerEvent;
- EFI_EVENT WaitList[2];
-
- if (Timeout != 0) {
- //
- // Create a timer event
- //
- Status = gBS->CreateEvent (EVT_TIMER, 0, NULL, NULL, &TimerEvent);
- if (!EFI_ERROR (Status)) {
- //
- // Set the timer event
- //
- gBS->SetTimer (
- TimerEvent,
- TimerRelative,
- Timeout
- );
-
- //
- // Wait for the original event or the timer
- //
- WaitList[0] = Event;
- WaitList[1] = TimerEvent;
- Status = gBS->WaitForEvent (2, WaitList, &Index);
- gBS->CloseEvent (TimerEvent);
-
- //
- // If the timer expired, change the return to timed out
- //
- if (!EFI_ERROR (Status) && Index == 1) {
- Status = EFI_TIMEOUT;
- }
- }
- } else {
- //
- // No timeout... just wait on the event
- //
- Status = gBS->WaitForEvent (1, &Event, &Index);
- ASSERT (!EFI_ERROR (Status));
- ASSERT (Index == 0);
- }
-
- return Status;
-}
-
-/**
- Function show progress bar to wait for user input.
-
-
- @param TimeoutDefault - The fault time out value before the system
- continue to boot.
-
- @retval EFI_SUCCESS User pressed some key except "Enter"
- @retval EFI_TIME_OUT Timout expired or user press "Enter"
-
-**/
-EFI_STATUS
-ShowProgress (
- IN UINT16 TimeoutDefault
- )
-{
- EFI_STATUS Status;
- CHAR16 *TmpStr;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
- EFI_INPUT_KEY Key;
- UINT16 TimeoutRemain;
-
- if (TimeoutDefault == 0) {
- return EFI_TIMEOUT;
- }
-
- DEBUG ((EFI_D_INFO, "\n\nStart showing progress bar... Press any key to stop it! ...Zzz....\n"));
-
- SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
- SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
- SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
-
- //
- // Clear the progress status bar first
- //
- TmpStr = GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION));
- if (TmpStr != NULL) {
- PlatformBdsShowProgress (Foreground, Background, TmpStr, Color, 0, 0);
- }
-
- TimeoutRemain = TimeoutDefault;
- while (TimeoutRemain != 0) {
- DEBUG ((EFI_D_INFO, "Showing progress bar...Remaining %d second!\n", TimeoutRemain));
-
- Status = WaitForSingleEvent (gST->ConIn->WaitForKey, ONE_SECOND);
- if (Status != EFI_TIMEOUT) {
- break;
- }
- TimeoutRemain--;
-
- //
- // Show progress
- //
- if (TmpStr != NULL) {
- PlatformBdsShowProgress (
- Foreground,
- Background,
- TmpStr,
- Color,
- ((TimeoutDefault - TimeoutRemain) * 100 / TimeoutDefault),
- 0
- );
- }
- }
- gBS->FreePool (TmpStr);
-
- //
- // Timeout expired
- //
- if (TimeoutRemain == 0) {
- return EFI_TIMEOUT;
- }
-
- //
- // User pressed some key
- //
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
- //
- // User pressed enter, equivalent to select "continue"
- //
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Return the default value for system Timeout variable.
-
- @return Timeout value.
-
-**/
-UINT16
-EFIAPI
-GetTimeout (
- VOID
- )
-{
- return PcdGet16 (PcdPlatformBootTimeOut);
-}
-
-
-/**
- This is the Framework Setup Browser interface which displays a FormSet.
-
- @param This The EFI_FORM_BROWSER_PROTOCOL context.
- @param UseDatabase TRUE if the FormSet is from HII database. The Thunk implementation
- only support UseDatabase is TRUE.
- @param Handle The Handle buffer.
- @param HandleCount The number of Handle in the Handle Buffer. It must be 1 for this implementation.
- @param Packet The pointer to data buffer containing IFR and String package. Not supported.
- @param CallbackHandle Not supported.
- @param NvMapOverride The buffer is used only when there is no NV variable to define the
- current settings and the caller needs to provide to the browser the
- current settings for the the "fake" NV variable. If used, no saving of
- an NV variable is possbile. This parameter is also ignored if Handle is NULL.
- @param ScreenDimensions
- Allows the browser to be called so that it occupies a portion of the physical
- screen instead of dynamically determining the screen dimensions.
- @param ResetRequired This BOOLEAN value denotes whether a reset is required based on the data that
- might have been changed. The ResetRequired parameter is primarily applicable
- for configuration applications, and is an optional parameter.
-
- @retval EFI_SUCCESS If the Formset is displayed correctly.
- @retval EFI_UNSUPPORTED If UseDatabase is FALSE or HandleCount is not 1.
- @retval EFI_INVALID_PARAMETER If the *Handle passed in is not found in the database.
-**/
-EFI_STATUS
-EFIAPI
-ThunkSendForm (
- IN EFI_FORM_BROWSER_PROTOCOL *This,
- IN BOOLEAN UseDatabase,
- IN FRAMEWORK_EFI_HII_HANDLE *Handle,
- IN UINTN HandleCount,
- IN EFI_IFR_PACKET *Packet, OPTIONAL
- IN EFI_HANDLE CallbackHandle, OPTIONAL
- IN UINT8 *NvMapOverride, OPTIONAL
- IN FRAMEWORK_EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL
- OUT BOOLEAN *ResetRequired OPTIONAL
- )
-{
- EFI_STATUS Status;
- EFI_BROWSER_ACTION_REQUEST ActionRequest;
- HII_THUNK_CONTEXT *ThunkContext;
- HII_THUNK_PRIVATE_DATA *Private;
- EFI_FORMBROWSER_THUNK_PRIVATE_DATA *BrowserPrivate;
-
- if (!UseDatabase) {
- //
- // ThunkSendForm only support displays forms registered into the HII database.
- //
- return EFI_UNSUPPORTED;
- }
-
- if (HandleCount != 1 ) {
- return EFI_UNSUPPORTED;
- }
-
- BrowserPrivate = EFI_FORMBROWSER_THUNK_PRIVATE_DATA_FROM_THIS (This);
- Private = BrowserPrivate->ThunkPrivate;
-
- ThunkContext = FwHiiHandleToThunkContext (Private, *Handle);
- if (ThunkContext == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Following UEFI spec to do auto booting after a time-out. This feature is implemented
- // in Framework Setup Browser and moved to MdeModulePkg/Universal/BdsDxe. The auto booting is
- // moved here in HII Thunk module.
- //
- if (CompareGuid (&gFrameworkBdsFrontPageFormsetGuid, &ThunkContext->FormSet->Guid) && !mFrontPageDisplayed) {
- //
- // Send form is called before entering the
- //
- mFrontPageDisplayed = TRUE;
- Status = ShowProgress (GetTimeout ());
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- if (NvMapOverride != NULL) {
- ThunkContext->NvMapOverride = NvMapOverride;
- }
-
- Status = mFormBrowser2Protocol->SendForm (
- mFormBrowser2Protocol,
- &ThunkContext->UefiHiiHandle,
- 1,
- NULL,
- 0,
- (EFI_SCREEN_DESCRIPTOR *) ScreenDimensions,
- &ActionRequest
- );
-
- if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
- *ResetRequired = TRUE;
- }
-
- return Status;
-}
-
-/**
-
- Rountine used to display a generic dialog interface and return
- the Key or Input from user input.
-
- @param LinesNumber The number of lines for the dialog box.
- @param HotKey Defines if a single character is parsed (TRUE) and returned in KeyValue
- or if a string is returned in StringBuffer.
- @param MaximumStringSize The maximum size in bytes of a typed-in string.
- @param StringBuffer On return contains the typed-in string if HotKey is FALSE.
- @param Key The EFI_INPUT_KEY value returned if HotKey is TRUE.
- @param FirstString The pointer to the first string in the list of strings
- that comprise the dialog box.
- @param ... A series of NumberOfLines text strings that will be used
- to construct the dialog box.
- @retval EFI_SUCCESS The dialog is created successfully and user interaction was received.
- @retval EFI_DEVICE_ERROR The user typed in an ESC.
- @retval EFI_INVALID_PARAMETER One of the parameters was invalid.(StringBuffer == NULL && HotKey == FALSE).
-**/
-EFI_STATUS
-EFIAPI
-ThunkCreatePopUp (
- IN UINTN LinesNumber,
- IN BOOLEAN HotKey,
- IN UINTN MaximumStringSize,
- OUT CHAR16 *StringBuffer,
- OUT EFI_INPUT_KEY *Key,
- IN CHAR16 *FirstString,
- ...
- )
-{
- VA_LIST Args;
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
- EFI_SIMPLE_TEXT_OUTPUT_MODE SavedConsoleMode;
- UINTN Columns;
- UINTN Rows;
- UINTN Column;
- UINTN Row;
- UINTN NumberOfLines;
- UINTN MaxLength;
- CHAR16 *String;
- UINTN Length;
- CHAR16 *Line;
- UINTN EventIndex;
-
- if (!HotKey) {
- return EFI_UNSUPPORTED;
- }
-
- if (MaximumStringSize == 0) {
- //
- // Blank strint to output
- //
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Determine the length of the longest line in the popup and the the total
- // number of lines in the popup
- //
- MaxLength = StrLen (FirstString);
- NumberOfLines = 1;
- VA_START (Args, FirstString);
- while ((String = VA_ARG (Args, CHAR16 *)) != NULL) {
- MaxLength = MAX (MaxLength, StrLen (String));
- NumberOfLines++;
- }
- VA_END (Args);
-
- //
- // If the total number of lines in the popup is not same to the input NumberOfLines
- // the parameter is not valid. Not check.
- //
- // if (NumberOfLines != LinesNumber) {
- // return EFI_INVALID_PARAMETER;
- // }
-
- //
- // If the maximum length of all the strings is not same to the input MaximumStringSize
- // the parameter is not valid. Not check.
- //
- // if (MaxLength != MaximumStringSize) {
- // return EFI_INVALID_PARAMETER;
- // }
-
- //
- // Cache a pointer to the Simple Text Output Protocol in the EFI System Table
- //
- ConOut = gST->ConOut;
-
- //
- // Save the current console cursor position and attributes
- //
- CopyMem (&SavedConsoleMode, ConOut->Mode, sizeof (SavedConsoleMode));
-
- //
- // Retrieve the number of columns and rows in the current console mode
- //
- ConOut->QueryMode (ConOut, SavedConsoleMode.Mode, &Columns, &Rows);
-
- //
- // Disable cursor and set the foreground and background colors specified by Attribute
- //
- ConOut->EnableCursor (ConOut, FALSE);
- ConOut->SetAttribute (ConOut, EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE);
-
- //
- // Limit NumberOfLines to height of the screen minus 3 rows for the box itself
- //
- NumberOfLines = MIN (NumberOfLines, Rows - 3);
-
- //
- // Limit MaxLength to width of the screen minus 2 columns for the box itself
- //
- MaxLength = MIN (MaxLength, Columns - 2);
-
- //
- // Compute the starting row and starting column for the popup
- //
- Row = (Rows - (NumberOfLines + 3)) / 2;
- Column = (Columns - (MaxLength + 2)) / 2;
-
- //
- // Allocate a buffer for a single line of the popup with borders and a Null-terminator
- //
- Line = AllocateZeroPool ((MaxLength + 3) * sizeof (CHAR16));
- ASSERT (Line != NULL);
-
- //
- // Draw top of popup box
- //
- SetMem16 (Line, (MaxLength + 2) * 2, BOXDRAW_HORIZONTAL);
- Line[0] = BOXDRAW_DOWN_RIGHT;
- Line[MaxLength + 1] = BOXDRAW_DOWN_LEFT;
- Line[MaxLength + 2] = L'\0';
- ConOut->SetCursorPosition (ConOut, Column, Row++);
- ConOut->OutputString (ConOut, Line);
-
- //
- // Draw middle of the popup with strings
- //
- VA_START (Args, FirstString);
- String = FirstString;
- while ((String != NULL) && (NumberOfLines > 0)) {
- Length = StrLen (String);
- SetMem16 (Line, (MaxLength + 2) * 2, L' ');
- if (Length <= MaxLength) {
- //
- // Length <= MaxLength
- //
- CopyMem (Line + 1 + (MaxLength - Length) / 2, String , Length * sizeof (CHAR16));
- } else {
- //
- // Length > MaxLength
- //
- CopyMem (Line + 1, String + (Length - MaxLength) / 2 , MaxLength * sizeof (CHAR16));
- }
- Line[0] = BOXDRAW_VERTICAL;
- Line[MaxLength + 1] = BOXDRAW_VERTICAL;
- Line[MaxLength + 2] = L'\0';
- ConOut->SetCursorPosition (ConOut, Column, Row++);
- ConOut->OutputString (ConOut, Line);
- String = VA_ARG (Args, CHAR16 *);
- NumberOfLines--;
- }
- VA_END (Args);
-
- //
- // Draw bottom of popup box
- //
- SetMem16 (Line, (MaxLength + 2) * 2, BOXDRAW_HORIZONTAL);
- Line[0] = BOXDRAW_UP_RIGHT;
- Line[MaxLength + 1] = BOXDRAW_UP_LEFT;
- Line[MaxLength + 2] = L'\0';
- ConOut->SetCursorPosition (ConOut, Column, Row++);
- ConOut->OutputString (ConOut, Line);
-
- //
- // Free the allocated line buffer
- //
- FreePool (Line);
-
- //
- // Restore the cursor visibility, position, and attributes
- //
- ConOut->EnableCursor (ConOut, SavedConsoleMode.CursorVisible);
- ConOut->SetCursorPosition (ConOut, SavedConsoleMode.CursorColumn, SavedConsoleMode.CursorRow);
- ConOut->SetAttribute (ConOut, SavedConsoleMode.Attribute);
-
- //
- // Wait for a keystroke
- //
- if (Key != NULL) {
- gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
- gST->ConIn->ReadKeyStroke (gST->ConIn, Key);
- }
-
- return EFI_SUCCESS;
-}
-
-/**
-
- Initialize string packages in HII database.
-
-**/
-VOID
-InitSetBrowserStrings (
- VOID
- )
-{
- //
- // Initialize strings to HII database
- //
- gStringPackHandle = HiiAddPackages (
- &gEfiHiiThunkProducerGuid,
- NULL,
- STRING_ARRAY_NAME,
- NULL
- );
- ASSERT (gStringPackHandle != NULL);
-}
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/SetupBrowser.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/SetupBrowser.h
deleted file mode 100644
index 58983da497..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/SetupBrowser.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/** @file
- This file contains macros to be included by SetupBrowser.c.
-
-Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#ifndef _HIITHUNK_SETUPBROWSER_H_
-#define _HIITHUNK_SETUPBROWSER_H_
-
-#define ONE_SECOND 10000000
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c
deleted file mode 100644
index f246c08b5f..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c
+++ /dev/null
@@ -1,438 +0,0 @@
-/** @file
- This file implements the protocol functions related to string package.
-
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-
-#include "HiiDatabase.h"
-
-/**
- Test if all of the characters in a string have corresponding font characters.
-
- This is a deprecated API. No Framework HII module is calling it. This function will ASSERT and
- return EFI_UNSUPPORTED.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param StringToTest A pointer to a Unicode string.
- @param FirstMissing A pointer to an index into the string. On input, the index of
- the first character in the StringToTest to examine. On exit, the index
- of the first character encountered for which a glyph is unavailable.
- If all glyphs in the string are available, the index is the index of the terminator
- of the string.
- @param GlyphBufferSize A pointer to a value. On output, if the function returns EFI_SUCCESS,
- it contains the amount of memory that is required to store the string? glyph equivalent.
-
- @retval EFI_UNSUPPORTED The function performs nothing and return EFI_UNSUPPORTED.
-**/
-EFI_STATUS
-EFIAPI
-HiiTestString (
- IN EFI_HII_PROTOCOL *This,
- IN CHAR16 *StringToTest,
- IN OUT UINT32 *FirstMissing,
- OUT UINT32 *GlyphBufferSize
- )
-{
- ASSERT (FALSE);
-
- return EFI_UNSUPPORTED;
-}
-
-
-/**
- Find the corressponding TAG GUID from a Framework HII Handle given.
-
- @param Private The HII Thunk Module Private context.
- @param FwHiiHandle The Framemwork HII Handle.
- @param TagGuid The output of TAG GUID found.
-
- @return NULL If Framework HII Handle is invalid.
- @return The corresponding HII Thunk Context.
-**/
-EFI_STATUS
-GetTagGuidByFwHiiHandle (
- IN CONST HII_THUNK_PRIVATE_DATA *Private,
- IN FRAMEWORK_EFI_HII_HANDLE FwHiiHandle,
- OUT EFI_GUID *TagGuid
- )
-{
- LIST_ENTRY *Link;
- HII_THUNK_CONTEXT *ThunkContext;
-
- ASSERT (TagGuid != NULL);
-
- Link = GetFirstNode (&Private->ThunkContextListHead);
- while (!IsNull (&Private->ThunkContextListHead, Link)) {
-
- ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
-
- if (FwHiiHandle == ThunkContext->FwHiiHandle) {
- CopyGuid (TagGuid, &ThunkContext->TagGuid);
- return EFI_SUCCESS;
- }
-
- Link = GetNextNode (&Private->ThunkContextListHead, Link);
- }
-
- return EFI_NOT_FOUND;
-}
-
-/**
- Create or update the String given a new string and String ID.
-
- @param ThunkContext The Thunk Context.
- @param Rfc4646AsciiLanguage The RFC 4646 Language code in ASCII string format.
- @param NewString The new string.
- @param StringId The String ID. If StringId is 0, a new String Token
- is created. Otherwise, the String Token StringId is
- updated.
-
-
- @retval EFI_SUCCESS The new string is created or updated successfully.
- The new String Token ID is returned in StringId if
- *StringId is 0 on input.
- @return Others The update of string failed.
-
-**/
-EFI_STATUS
-UpdateString (
- IN CONST HII_THUNK_CONTEXT *ThunkContext,
- IN CONST CHAR8 *Rfc4646AsciiLanguage,
- IN CHAR16 *NewString,
- IN OUT STRING_REF *StringId
- )
-{
- EFI_STRING_ID NewStringId;
-
- NewStringId = HiiSetString (ThunkContext->UefiHiiHandle, *StringId, NewString, Rfc4646AsciiLanguage);
- *StringId = NewStringId;
- if (NewStringId == 0) {
- //
- // Only EFI_INVALID_PARAMETER is defined in HII 0.92 specification.
- //
- return EFI_INVALID_PARAMETER;
- } else {
- return EFI_SUCCESS;
- }
-}
-
-/**
- Create or update a String Token in a String Package.
-
- If *Reference == 0, a new String Token is created.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Language Pointer to a NULL-terminated string containing a single ISO 639-2 language
- identifier, indicating the language to print. A string consisting of
- all spaces indicates that the string is applicable to all languages.
- @param Handle The handle of the language pack to which the string is to be added.
- @param Reference The string token assigned to the string.
- @param NewString The string to be added.
-
-
- @retval EFI_SUCCESS The string was effectively registered.
- @retval EFI_INVALID_PARAMETER The Handle was unknown. The string is not created or updated in the
- the string package.
-**/
-EFI_STATUS
-EFIAPI
-HiiNewString (
- IN EFI_HII_PROTOCOL *This,
- IN CHAR16 *Language,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN OUT STRING_REF *Reference,
- IN CHAR16 *NewString
- )
-{
- EFI_STATUS Status;
- HII_THUNK_PRIVATE_DATA *Private;
- EFI_GUID TagGuid;
- LIST_ENTRY *Link;
- HII_THUNK_CONTEXT *ThunkContext;
- HII_THUNK_CONTEXT *StringPackThunkContext;
- EFI_STRING_ID StringId;
- EFI_STRING_ID LastStringId;
- CHAR8 AsciiLanguage[ISO_639_2_ENTRY_SIZE + 1];
- CHAR16 LanguageCopy[ISO_639_2_ENTRY_SIZE + 1];
- CHAR8 *Rfc4646AsciiLanguage;
-
- LastStringId = (EFI_STRING_ID) 0;
- StringId = (EFI_STRING_ID) 0;
- Rfc4646AsciiLanguage = NULL;
-
- if (Language != NULL) {
- ZeroMem (AsciiLanguage, sizeof (AsciiLanguage));;
- ZeroMem (LanguageCopy, sizeof (LanguageCopy));
- CopyMem (LanguageCopy, Language, ISO_639_2_ENTRY_SIZE * sizeof (CHAR16));
- UnicodeStrToAsciiStr (LanguageCopy, AsciiLanguage);
- Rfc4646AsciiLanguage = ConvertLanguagesIso639ToRfc4646 (AsciiLanguage);
- ASSERT (Rfc4646AsciiLanguage != NULL);
- }
-
- Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
-
- StringPackThunkContext = FwHiiHandleToThunkContext (Private, Handle);
- if (StringPackThunkContext == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (StringPackThunkContext->SharingStringPack) {
- Status = GetTagGuidByFwHiiHandle (Private, Handle, &TagGuid);
- ASSERT_EFI_ERROR (Status);
-
- Link = GetFirstNode (&Private->ThunkContextListHead);
- while (!IsNull (&Private->ThunkContextListHead, Link)) {
- ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
-
- if (CompareGuid (&TagGuid, &ThunkContext->TagGuid)) {
- if (ThunkContext->SharingStringPack) {
- StringId = *Reference;
- Status = UpdateString (ThunkContext, Rfc4646AsciiLanguage, NewString, &StringId);
- if (EFI_ERROR (Status)) {
- break;
- }
-
- DEBUG_CODE_BEGIN ();
- if (*Reference == 0) {
- //
- // When creating new string token, make sure all created token is the same
- // for all string packages registered using FW HII interface.
- //
- if (LastStringId == (EFI_STRING_ID) 0) {
- LastStringId = StringId;
- } else {
- if (LastStringId != StringId) {
- ASSERT(FALSE);
- }
- }
- }
- DEBUG_CODE_END ();
-
- }
- }
-
- Link = GetNextNode (&Private->ThunkContextListHead, Link);
- }
- } else {
- StringId = *Reference;
- Status = UpdateString (StringPackThunkContext, Rfc4646AsciiLanguage, NewString, &StringId);
- }
-
- if (!EFI_ERROR (Status)) {
- if (*Reference == 0) {
- *Reference = StringId;
- }
- } else {
- //
- // Only EFI_INVALID_PARAMETER is defined in HII 0.92 specification.
- //
- Status = EFI_INVALID_PARAMETER;
- }
-
- return Status;
-}
-
-/**
- This function removes any new strings that were added after the initial string export for this handle.
- UEFI HII String Protocol does not have Reset String function. This function perform nothing.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle The HII handle on which the string resides.
-
- @retval EFI_SUCCESS This function is a NOP and always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiResetStrings (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle
- )
-{
- return EFI_SUCCESS;
-}
-
-/**
- This function extracts a string from a package already registered with the EFI HII database.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle The HII handle on which the string resides.
- @param Token The string token assigned to the string.
- @param Raw If TRUE, the string is returned unedited in the internal storage format described
- above. If false, the string returned is edited by replacing <cr> with <space>
- and by removing special characters such as the <wide> prefix.
- @param LanguageString Pointer to a NULL-terminated string containing a single ISO 639-2 language
- identifier, indicating the language to print. If the LanguageString is empty (starts
- with a NULL), the default system language will be used to determine the language.
- @param BufferLength Length of the StringBuffer. If the status reports that the buffer width is too
- small, this parameter is filled with the length of the buffer needed.
- @param StringBuffer The buffer designed to receive the characters in the string. Type EFI_STRING is
- defined in String.
-
- @retval EFI_INVALID_PARAMETER If input parameter is invalid.
- @retval EFI_BUFFER_TOO_SMALL If the *BufferLength is too small.
- @retval EFI_SUCCESS Operation is successful.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiThunkGetString (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN STRING_REF Token,
- IN BOOLEAN Raw,
- IN CHAR16 *LanguageString,
- IN OUT UINTN *BufferLength,
- OUT EFI_STRING StringBuffer
- )
-{
- HII_THUNK_PRIVATE_DATA *Private;
- CHAR8 *Iso639AsciiLanguage;
- CHAR8 *Rfc4646AsciiLanguage;
- CHAR8 *SupportedLanguages;
- CHAR8 *PlatformLanguage;
- CHAR8 *BestLanguage;
- EFI_HII_HANDLE UefiHiiHandle;
- EFI_STATUS Status;
-
- Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
-
- Rfc4646AsciiLanguage = NULL;
- SupportedLanguages = NULL;
- PlatformLanguage = NULL;
- Status = EFI_SUCCESS;
-
- if (LanguageString != NULL) {
- Iso639AsciiLanguage = AllocateZeroPool (StrLen (LanguageString) + 1);
- if (Iso639AsciiLanguage == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- UnicodeStrToAsciiStr (LanguageString, Iso639AsciiLanguage);
-
- //
- // Caller of Framework HII Interface uses the Language Identification String defined
- // in Iso639. So map it to the Language Identifier defined in RFC4646.
- //
- Rfc4646AsciiLanguage = ConvertLanguagesIso639ToRfc4646 (Iso639AsciiLanguage);
- FreePool (Iso639AsciiLanguage);
-
- //
- // If Rfc4646AsciiLanguage is NULL, more language mapping must be added to
- // Iso639ToRfc4646Map.
- //
- ASSERT (Rfc4646AsciiLanguage != NULL);
- }
-
- UefiHiiHandle = FwHiiHandleToUefiHiiHandle (Private, Handle);
- if (UefiHiiHandle == NULL) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
-
- //
- // Get the languages that the package specified by HiiHandle supports
- //
- SupportedLanguages = HiiGetSupportedLanguages (UefiHiiHandle);
- if (SupportedLanguages == NULL) {
- goto Done;
- }
-
- //
- // Get the current platform language setting
- //
- GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&PlatformLanguage, NULL);
-
- //
- // Get the best matching language from SupportedLanguages
- //
- BestLanguage = GetBestLanguage (
- SupportedLanguages,
- FALSE, // RFC 4646 mode
- (Rfc4646AsciiLanguage != NULL) ? Rfc4646AsciiLanguage : "", // Highest priority
- (PlatformLanguage != NULL) ? PlatformLanguage : "", // Next highest priority
- SupportedLanguages, // Lowest priority
- NULL
- );
- if (BestLanguage != NULL) {
- Status = mHiiStringProtocol->GetString (
- mHiiStringProtocol,
- BestLanguage,
- UefiHiiHandle,
- Token,
- StringBuffer,
- BufferLength,
- NULL
- );
- FreePool (BestLanguage);
- } else {
- Status = EFI_INVALID_PARAMETER;
- }
-
-Done:
- if (Rfc4646AsciiLanguage != NULL) {
- FreePool (Rfc4646AsciiLanguage);
- }
-
- if (SupportedLanguages != NULL) {
- FreePool (SupportedLanguages);
- }
-
- if (PlatformLanguage != NULL) {
- FreePool (PlatformLanguage);
- }
- return Status;
-}
-
-/**
-
- This function allows a program to extract a part of a string of not more than a given width.
- With repeated calls, this allows a calling program to extract "lines" of text that fit inside
- columns. The effort of measuring the fit of strings inside columns is localized to this call.
-
- This is a deprecated API. No Framework HII module is calling it. This function will ASSERT and
- return EFI_UNSUPPORTED.
-
- @param This A pointer to the EFI_HII_PROTOCOL instance.
- @param Handle The HII handle on which the string resides.
- @param Token The string token assigned to the string.
- @param Index On input, the offset into the string where the line is to start.
- On output, the index is updated to point to beyond the last character returned
- in the call.
- @param LineWidth The maximum width of the line in units of narrow glyphs.
- @param LanguageString Pointer to a NULL-terminated string containing a single ISO 639-2 language
- identifier, indicating the language to print. If the LanguageString is empty (starts
- with a NULL), the default system language will be used to determine the language.
- @param BufferLength Length of the StringBuffer. If the status reports that the buffer width is too
- small, this parameter is filled with the length of the buffer needed.
- @param StringBuffer The buffer designed to receive the characters in the string. Type EFI_STRING is
- defined in String.
-
- @retval EFI_UNSUPPORTED.
-**/
-EFI_STATUS
-EFIAPI
-HiiGetLine (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN STRING_REF Token,
- IN OUT UINT16 *Index,
- IN UINT16 LineWidth,
- IN CHAR16 *LanguageString,
- IN OUT UINT16 *BufferLength,
- OUT EFI_STRING StringBuffer
- )
-{
- ASSERT (FALSE);
- return EFI_UNSUPPORTED;
-}
-
-
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.uni b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.uni
deleted file mode 100644
index 71dcbd211d..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.uni
+++ /dev/null
Binary files differ
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c
deleted file mode 100644
index 482d6ad404..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c
+++ /dev/null
@@ -1,543 +0,0 @@
-/** @file
- Function and Macro defintions for to extract default values from UEFI Form package.
-
- Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-
-#include "HiiDatabase.h"
-#include "UefiIfrParser.h"
-#include "UefiIfrDefault.h"
-
-//
-// Extern Variables
-//
-extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
-extern CONST EFI_HII_IMAGE_PROTOCOL *mHiiImageProtocol;
-extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProtocol;
-extern CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRoutingProtocol;
-
-/**
- Set the data position at Offset with Width in Node->Buffer based
- the value passed in.
-
- @param Node The Buffer Storage Node.
- @param Value The input value.
- @param Offset The offset in Node->Buffer for the update.
- @param Width The length of the Value.
-
-**/
-VOID
-SetNodeBuffer (
- OUT UEFI_IFR_BUFFER_STORAGE_NODE *Node,
- IN CONST EFI_HII_VALUE *Value,
- IN UINTN Offset,
- IN UINTN Width
- )
-{
- ASSERT (Node->Signature == UEFI_IFR_BUFFER_STORAGE_NODE_SIGNATURE);
- ASSERT (Offset + Width <= Node->Size);
-
- CopyMem (Node->Buffer + Offset, &Value->Value.u8, Width);
-}
-
-
-/**
- Get question default value, and set it into the match var storage.
-
- Note Framework 0.92's HII Implementation does not support for default value for these opcodes:
- EFI_IFR_ORDERED_LIST_OP:
- EFI_IFR_PASSWORD_OP:
- EFI_IFR_STRING_OP:
-
- @param Question Question to be set to its default value.
- @param DefaultId The Class of the default.
- @param VarStoreId Id of var storage.
- @param Node Var storage buffer to store the got default value.
-
- @retval EFI_SUCCESS Question is reset to default value.
-
-**/
-EFI_STATUS
-GetQuestionDefault (
- IN FORM_BROWSER_STATEMENT *Question,
- IN UINT16 DefaultId,
- IN UINT16 VarStoreId,
- OUT UEFI_IFR_BUFFER_STORAGE_NODE *Node
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- QUESTION_DEFAULT *Default;
- QUESTION_OPTION *Option;
- EFI_HII_VALUE *HiiValue;
-
- Status = EFI_SUCCESS;
-
- //
- // Statement don't have storage, skip them
- //
- if (Question->QuestionId == 0) {
- return Status;
- }
-
- if (Question->VarStoreId != VarStoreId) {
- return Status;
- }
-
- ASSERT (Question->Storage->Type == EFI_HII_VARSTORE_BUFFER);
-
- //
- // There are three ways to specify default value for a Question:
- // 1, use nested EFI_IFR_DEFAULT (highest priority)
- // 2, set flags of EFI_ONE_OF_OPTION (provide Standard and Manufacturing default)
- // 3, set flags of EFI_IFR_CHECKBOX (provide Standard and Manufacturing default) (lowest priority)
- //
- HiiValue = &Question->HiiValue;
-
- //
- // EFI_IFR_DEFAULT has highest priority
- //
- if (!IsListEmpty (&Question->DefaultListHead)) {
- Link = GetFirstNode (&Question->DefaultListHead);
- while (!IsNull (&Question->DefaultListHead, Link)) {
- Default = QUESTION_DEFAULT_FROM_LINK (Link);
-
- if (Default->DefaultId == DefaultId) {
- //
- // Default value is embedded in EFI_IFR_DEFAULT
- //
- CopyMem (HiiValue, &Default->Value, sizeof (EFI_HII_VALUE));
-
- SetNodeBuffer (Node, HiiValue, Question->VarStoreInfo.VarOffset, Question->StorageWidth);
- return EFI_SUCCESS;
- }
-
- Link = GetNextNode (&Question->DefaultListHead, Link);
- }
- }
-
- //
- // EFI_ONE_OF_OPTION
- //
- if ((Question->Operand == EFI_IFR_ONE_OF_OP) && !IsListEmpty (&Question->OptionListHead)) {
- if (DefaultId <= EFI_HII_DEFAULT_CLASS_MANUFACTURING) {
- //
- // OneOfOption could only provide Standard and Manufacturing default
- //
- Link = GetFirstNode (&Question->OptionListHead);
- while (!IsNull (&Question->OptionListHead, Link)) {
- Option = QUESTION_OPTION_FROM_LINK (Link);
-
- if (((DefaultId == EFI_HII_DEFAULT_CLASS_STANDARD) && ((Option->Flags & EFI_IFR_OPTION_DEFAULT) == EFI_IFR_OPTION_DEFAULT)) ||
- ((DefaultId == EFI_HII_DEFAULT_CLASS_MANUFACTURING) && ((Option->Flags & EFI_IFR_OPTION_DEFAULT_MFG) == EFI_IFR_OPTION_DEFAULT_MFG))
- ) {
- CopyMem (HiiValue, &Option->Value, sizeof (EFI_HII_VALUE));
-
- SetNodeBuffer (Node, HiiValue, Question->VarStoreInfo.VarOffset, Question->StorageWidth);
- return EFI_SUCCESS;
- }
-
- Link = GetNextNode (&Question->OptionListHead, Link);
- }
- }
- }
-
- //
- // EFI_IFR_CHECKBOX - lowest priority
- //
- if (Question->Operand == EFI_IFR_CHECKBOX_OP) {
- if (DefaultId <= EFI_HII_DEFAULT_CLASS_MANUFACTURING) {
- //
- // Checkbox could only provide Standard and Manufacturing default
- //
- if (((DefaultId == EFI_HII_DEFAULT_CLASS_STANDARD) && ((Question->Flags & EFI_IFR_CHECKBOX_DEFAULT) == EFI_IFR_CHECKBOX_DEFAULT)) ||
- ((DefaultId == EFI_HII_DEFAULT_CLASS_MANUFACTURING) && ((Question->Flags & EFI_IFR_CHECKBOX_DEFAULT_MFG) == EFI_IFR_CHECKBOX_DEFAULT_MFG))
- ) {
- HiiValue->Value.b = TRUE;
- } else {
- HiiValue->Value.b = FALSE;
- }
-
- SetNodeBuffer (Node, HiiValue, Question->VarStoreInfo.VarOffset, Question->StorageWidth);
- return EFI_SUCCESS;
- }
- }
-
- return Status;
-}
-
-
-/**
- Extract the default values from all questions in the input Form,
- and set default value into the matched var storage.
-
- @param Form The Form which to be reset.
- @param DefaultId The Class of the default.
- @param VarStoreId Id of var storage.
- @param Node Var storage buffer to store the got default value.
-
- @retval EFI_SUCCESS The function completed successfully.
-
-**/
-EFI_STATUS
-ExtractFormDefault (
- IN FORM_BROWSER_FORM *Form,
- IN UINT16 DefaultId,
- IN UINT16 VarStoreId,
- OUT UEFI_IFR_BUFFER_STORAGE_NODE *Node
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- FORM_BROWSER_STATEMENT *Question;
-
- Link = GetFirstNode (&Form->StatementListHead);
- while (!IsNull (&Form->StatementListHead, Link)) {
- Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
- //
- // Reset Question to its default value
- //
- Status = GetQuestionDefault (Question, DefaultId, VarStoreId, Node);
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- Link = GetNextNode (&Form->StatementListHead, Link);
- }
- return EFI_SUCCESS;
-}
-
-
-/**
- Destroy all the buffer allocated for the fileds of
- UEFI_IFR_BUFFER_STORAGE_NODE. The Node itself
- will be freed too.
-
- @param Node Var storage buffer.
-
-**/
-VOID
-DestroyDefaultNode (
- IN UEFI_IFR_BUFFER_STORAGE_NODE *Node
- )
-{
- FreePool (Node->Buffer);
- FreePool (Node->Name);
- FreePool (Node);
-}
-
-
-/**
- Get the default value for Buffer Type storage named by
- a Default Store and a Storage Store from a FormSet.
- The result is in the a instance of UEFI_IFR_BUFFER_STORAGE_NODE
- allocated by this function. It is inserted to the link list.
-
- @param DefaultStore The Default Store.
- @param Storage The Storage.
- @param FormSet The Form Set.
- @param UefiDefaultsListHead The head of link list for the output.
-
- @retval EFI_SUCCESS Successful.
-
-**/
-EFI_STATUS
-GetBufferTypeDefaultIdAndStorageId (
- IN FORMSET_DEFAULTSTORE *DefaultStore,
- IN FORMSET_STORAGE *Storage,
- IN FORM_BROWSER_FORMSET *FormSet,
- OUT LIST_ENTRY *UefiDefaultsListHead
- )
-{
- UEFI_IFR_BUFFER_STORAGE_NODE *Node;
- LIST_ENTRY *Link;
- FORM_BROWSER_FORM *Form;
- EFI_STATUS Status;
-
- Node = AllocateZeroPool (sizeof (UEFI_IFR_BUFFER_STORAGE_NODE));
- ASSERT (Node != NULL);
-
- Node->Signature = UEFI_IFR_BUFFER_STORAGE_NODE_SIGNATURE;
- Node->Name = AllocateCopyPool (StrSize (Storage->Name), Storage->Name);
- Node->DefaultId = DefaultStore->DefaultId;
- Node->StoreId = Storage->VarStoreId;
- CopyGuid (&Node->Guid, &Storage->Guid);
- Node->Size = Storage->Size;
- Node->Buffer = AllocateZeroPool (Node->Size);
- //
- // Extract default from IFR binary
- //
- Link = GetFirstNode (&FormSet->FormListHead);
- while (!IsNull (&FormSet->FormListHead, Link)) {
- Form = FORM_BROWSER_FORM_FROM_LINK (Link);
-
- Status = ExtractFormDefault (Form, DefaultStore->DefaultId, Storage->VarStoreId, Node);
- ASSERT_EFI_ERROR (Status);
-
- Link = GetNextNode (&FormSet->FormListHead, Link);
- }
-
- InsertTailList (UefiDefaultsListHead, &Node->List);
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Get the default value for Buffer Type storage named by
- a Default Store from a FormSet.
- The result is in the a instance of UEFI_IFR_BUFFER_STORAGE_NODE
- allocated by this function. The output can be multiple instances
- of UEFI_IFR_BUFFER_STORAGE_NODE. It is inserted to the link list.
-
- @param DefaultStore The Default Store.
- @param FormSet The Form Set.
- @param UefiDefaultsListHead The head of link list for the output.
-
- @retval EFI_SUCCESS Successful.
-
-**/
-EFI_STATUS
-GetBufferTypeDefaultId (
- IN FORMSET_DEFAULTSTORE *DefaultStore,
- IN FORM_BROWSER_FORMSET *FormSet,
- OUT LIST_ENTRY *UefiDefaultsListHead
- )
-{
- LIST_ENTRY *StorageLink;
- FORMSET_STORAGE *Storage;
- EFI_STATUS Status;
-
- StorageLink = GetFirstNode (&FormSet->StorageListHead);
-
- while (!IsNull (&FormSet->StorageListHead, StorageLink)) {
- Storage = FORMSET_STORAGE_FROM_LINK(StorageLink);
-
- if (Storage->Type == EFI_HII_VARSTORE_BUFFER) {
- Status = GetBufferTypeDefaultIdAndStorageId (DefaultStore, Storage, FormSet, UefiDefaultsListHead);
- ASSERT_EFI_ERROR (Status);
- }
-
- StorageLink = GetNextNode (&FormSet->StorageListHead, StorageLink);
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Get the default value for Buffer Type storage from the FormSet in ThunkContext.
-
- The results can be multiple instances of UEFI_IFR_BUFFER_STORAGE_NODE.
- They are inserted to the link list.
-
- @param ThunkContext Hii thunk context.
- @param UefiDefaults The head of link list for the output.
-
- @retval EFI_SUCCESS Successful.
-
-**/
-EFI_STATUS
-UefiIfrGetBufferTypeDefaults (
- IN HII_THUNK_CONTEXT *ThunkContext,
- OUT LIST_ENTRY **UefiDefaults
- )
-{
- LIST_ENTRY *DefaultLink;
- FORMSET_DEFAULTSTORE *DefaultStore;
- EFI_STATUS Status;
-
- ASSERT (UefiDefaults != NULL);
-
- *UefiDefaults = AllocateZeroPool (sizeof (LIST_ENTRY));
- ASSERT (*UefiDefaults != NULL);
- InitializeListHead (*UefiDefaults);
-
- DefaultLink = GetFirstNode (&ThunkContext->FormSet->DefaultStoreListHead);
- while (!IsNull (&ThunkContext->FormSet->DefaultStoreListHead, DefaultLink)) {
- DefaultStore = FORMSET_DEFAULTSTORE_FROM_LINK(DefaultLink);
-
- Status = GetBufferTypeDefaultId (DefaultStore, ThunkContext->FormSet, *UefiDefaults);
- ASSERT_EFI_ERROR (Status);
-
- DefaultLink = GetNextNode (&ThunkContext->FormSet->DefaultStoreListHead, DefaultLink);
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Convert the UEFI Buffer Type default values to a Framework HII default
- values specified by a EFI_HII_VARIABLE_PACK_LIST structure.
-
- @param ListHead The link list of UEFI_IFR_BUFFER_STORAGE_NODE
- which contains the default values retrived from a UEFI form set.
- @param DefaultMask The default mask.
- The valid values are EFI_IFR_FLAG_DEFAULT and EFI_IFR_FLAG_MANUFACTURING.
- UEFI spec only map EFI_IFR_FLAG_DEFAULT and EFI_IFR_FLAG_MANUFACTURING
- from specification to valid default class.
- @param UefiFormSetDefaultVarStoreId
- ID of the default varstore in FormSet.
- @param VariablePackList The output default value in a format defined in Framework.
-
- @retval EFI_SUCCESS Successful.
- @retval EFI_INVALID_PARAMETER The default mask is not EFI_IFR_FLAG_DEFAULT or
- EFI_IFR_FLAG_MANUFACTURING.
-**/
-EFI_STATUS
-UefiDefaultsToFwDefaults (
- IN LIST_ENTRY *ListHead,
- IN UINTN DefaultMask,
- IN EFI_VARSTORE_ID UefiFormSetDefaultVarStoreId,
- OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList
- )
-{
- LIST_ENTRY *List;
- UEFI_IFR_BUFFER_STORAGE_NODE *Node;
- UINTN Size;
- UINTN Count;
- UINT16 DefaultId;
- EFI_HII_VARIABLE_PACK *Pack;
- EFI_HII_VARIABLE_PACK_LIST *PackList;
- UINTN Index;
-
- if (DefaultMask == EFI_IFR_FLAG_DEFAULT) {
- DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
- } else if (DefaultMask == EFI_IFR_FLAG_MANUFACTURING) {
- DefaultId = EFI_HII_DEFAULT_CLASS_MANUFACTURING;
- } else {
- //
- // UEFI spec only map EFI_IFR_FLAG_DEFAULT and EFI_IFR_FLAG_MANUFACTURING
- // from specification to valid default class.
- //
- ASSERT (FALSE);
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Calculate the size of the output EFI_HII_VARIABLE_PACK_LIST structure
- //
- Size = 0;
- Count = 0;
- List = GetFirstNode (ListHead);
- while (!IsNull (ListHead, List)) {
- Node = UEFI_IFR_BUFFER_STORAGE_NODE_FROM_LIST(List);
-
- if (Node->DefaultId == DefaultId) {
- Size += Node->Size;
- Size += StrSize (Node->Name);
-
- Count++;
- }
-
- List = GetNextNode (ListHead, List);
- }
-
- if (Count == 0) {
- *VariablePackList = NULL;
- return EFI_NOT_FOUND;
- }
-
- Size = Size + Count * (sizeof (EFI_HII_VARIABLE_PACK_LIST) + sizeof (EFI_HII_VARIABLE_PACK));
-
- *VariablePackList = AllocateZeroPool (Size);
- ASSERT (*VariablePackList != NULL);
-
- List = GetFirstNode (ListHead);
-
- PackList = (EFI_HII_VARIABLE_PACK_LIST *) *VariablePackList;
- Pack = (EFI_HII_VARIABLE_PACK *) (PackList + 1);
- Index = 0;
- while (!IsNull (ListHead, List)) {
- Node = UEFI_IFR_BUFFER_STORAGE_NODE_FROM_LIST(List);
-
- Size = 0;
- if (Node->DefaultId == DefaultId) {
- Size += Node->Size;
- Size += sizeof (EFI_HII_VARIABLE_PACK);
-
- Pack->VariableNameLength = (UINT32) StrSize (Node->Name);
-
- if (Node->StoreId == UefiFormSetDefaultVarStoreId) {
- //
- // The default VARSTORE in VFR from a Framework module has Varstore ID of 0.
- //
- Pack->VariableId = 0;
- } else {
- Pack->VariableId = Node->StoreId;
- }
-
- CopyMem ((UINT8 *) Pack + sizeof (EFI_HII_VARIABLE_PACK), Node->Name, StrSize (Node->Name));
- Size += Pack->VariableNameLength;
-
- //
- // Initialize EFI_HII_VARIABLE_PACK
- //
- Pack->Header.Type = 0;
- Pack->Header.Length = (UINT32) Size;
- CopyMem (&Pack->VariableGuid, &Node->Guid, sizeof (EFI_GUID));
-
- CopyMem ((UINT8 *) Pack + sizeof (EFI_HII_VARIABLE_PACK) + Pack->VariableNameLength, Node->Buffer, Node->Size);
-
- Size += sizeof (EFI_HII_VARIABLE_PACK_LIST);
-
- //
- // Initialize EFI_HII_VARIABLE_PACK_LIST
- //
- PackList->VariablePack = Pack;
- Index++;
- if (Index < Count) {
- PackList->NextVariablePack = (EFI_HII_VARIABLE_PACK_LIST *)((UINT8 *) PackList + Size);
-
- PackList = PackList->NextVariablePack;
- Pack = (EFI_HII_VARIABLE_PACK *) (PackList + 1);
- }
-
- }
-
- List = GetNextNode (ListHead, List);
- }
-
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Free up all buffer allocated for the link list of UEFI_IFR_BUFFER_STORAGE_NODE.
-
- @param ListHead The link list of UEFI_IFR_BUFFER_STORAGE_NODE
- which contains the default values retrived from
- a UEFI form set.
-
-**/
-VOID
-FreeDefaultList (
- IN LIST_ENTRY *ListHead
- )
-{
- LIST_ENTRY *Link;
- UEFI_IFR_BUFFER_STORAGE_NODE *Default;
-
- while (!IsListEmpty (ListHead)) {
- Link = GetFirstNode (ListHead);
-
- Default = UEFI_IFR_BUFFER_STORAGE_NODE_FROM_LIST(Link);
-
- RemoveEntryList (Link);
-
- DestroyDefaultNode (Default);
- }
-
- FreePool (ListHead);
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.h
deleted file mode 100644
index 5e856d9d93..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/** @file
- Header file for Function and Macro defintions for to extract default values from UEFI Form package.
-
- Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-
-#ifndef _HII_THUNK_UEFI_IFR_DEFAULT_
-#define _HII_THUNK_UEFI_IFR_DEFAULT_
-
-#define UEFI_IFR_BUFFER_STORAGE_NODE_FROM_LIST(a) CR(a, UEFI_IFR_BUFFER_STORAGE_NODE, List, UEFI_IFR_BUFFER_STORAGE_NODE_SIGNATURE)
-#define UEFI_IFR_BUFFER_STORAGE_NODE_SIGNATURE SIGNATURE_32 ('I', 'b', 'S', 'n')
-typedef struct {
- LIST_ENTRY List;
- UINT32 Signature;
-
- EFI_GUID Guid;
- CHAR16 *Name;
- UINT16 DefaultId;
- UINT16 StoreId;
- UINTN Size;
- UINT8 *Buffer;
-
-} UEFI_IFR_BUFFER_STORAGE_NODE;
-
-/**
- Get the default value for Buffer Type storage from the FormSet in ThunkContext.
-
- The results can be multiple instances of UEFI_IFR_BUFFER_STORAGE_NODE.
- They are inserted to the link list.
-
- @param ThunkContext Hii thunk context.
- @param UefiDefaults The head of link list for the output.
-
- @retval EFI_SUCCESS Successful.
-
-**/
-EFI_STATUS
-UefiIfrGetBufferTypeDefaults (
- IN HII_THUNK_CONTEXT *ThunkContext,
- OUT LIST_ENTRY **UefiDefaults
- );
-
-/**
- Convert the UEFI Buffer Type default values to a Framework HII default
- values specified by a EFI_HII_VARIABLE_PACK_LIST structure.
-
- @param ListHead The link list of UEFI_IFR_BUFFER_STORAGE_NODE
- which contains the default values retrived from a UEFI form set.
- @param DefaultMask The default mask.
- The valid values are EFI_IFR_FLAG_DEFAULT and EFI_IFR_FLAG_MANUFACTURING.
- UEFI spec only map EFI_IFR_FLAG_DEFAULT and EFI_IFR_FLAG_MANUFACTURING
- from specification to valid default class.
- @param UefiFormSetDefaultVarStoreId
- ID of the default varstore in FormSet.
- @param VariablePackList The output default value in a format defined in Framework.
-
- @retval EFI_SUCCESS Successful.
- @retval EFI_INVALID_PARAMETER The default mask is not EFI_IFR_FLAG_DEFAULT or
- EFI_IFR_FLAG_MANUFACTURING.
-**/
-EFI_STATUS
-UefiDefaultsToFwDefaults (
- IN LIST_ENTRY *ListHead,
- IN UINTN DefaultMask,
- IN EFI_VARSTORE_ID UefiFormSetDefaultVarStoreId,
- OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList
- );
-
-/**
- Free up all buffer allocated for the link list of UEFI_IFR_BUFFER_STORAGE_NODE.
-
- @param ListHead The link list of UEFI_IFR_BUFFER_STORAGE_NODE
- which contains the default values retrived from
- a UEFI form set.
-
-**/
-VOID
-FreeDefaultList (
- IN LIST_ENTRY *ListHead
- );
-
-#endif
-
-
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c
deleted file mode 100644
index 105c3b53e1..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c
+++ /dev/null
@@ -1,1185 +0,0 @@
-/** @file
-Parser for IFR binary encoding.
-
-Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "HiiDatabase.h"
-
-#include "UefiIfrParserExpression.h"
-
-UINT16 mStatementIndex;
-
-BOOLEAN mInScopeSubtitle;
-BOOLEAN mInScopeSuppress;
-BOOLEAN mInScopeGrayOut;
-
-EFI_GUID mFrameworkHiiCompatibilityGuid = EFI_IFR_FRAMEWORK_GUID;
-extern EFI_GUID mTianoHiiIfrGuid;
-
-/**
- Find the question's OneOfOptionMap list in FormSet
- based on the input question Id.
-
- @param FormSet FormSet context.
- @param QuestionId Unique ID to specicy the question in FormSet.
-
- @return the found OneOfOptionMap list. If not found, NULL will return.
-**/
-LIST_ENTRY *
-GetOneOfOptionMapEntryListHead (
- IN CONST FORM_BROWSER_FORMSET *FormSet,
- IN UINT16 QuestionId
- )
-{
- LIST_ENTRY *Link;
- ONE_OF_OPTION_MAP *Map;
-
- Link = GetFirstNode (&FormSet->OneOfOptionMapListHead);
-
- while (!IsNull (&FormSet->OneOfOptionMapListHead, Link)) {
- Map = ONE_OF_OPTION_MAP_FROM_LINK (Link);
- if (QuestionId == Map->QuestionId) {
- return &Map->OneOfOptionMapEntryListHead;
- }
- Link = GetNextNode (&FormSet->OneOfOptionMapListHead, Link);
- }
-
- return NULL;
-}
-
-/**
- Free OneOfOption map list.
-
- @param OneOfOptionMapListHead Pointer to list header of OneOfOptionMap list.
-
-**/
-VOID
-DestoryOneOfOptionMap (
- IN LIST_ENTRY *OneOfOptionMapListHead
- )
-{
- ONE_OF_OPTION_MAP *Map;
- ONE_OF_OPTION_MAP_ENTRY *MapEntry;
- LIST_ENTRY *Link;
- LIST_ENTRY *Link2;
-
- while (!IsListEmpty (OneOfOptionMapListHead)) {
- Link = GetFirstNode (OneOfOptionMapListHead);
-
- Map = ONE_OF_OPTION_MAP_FROM_LINK (Link);
-
- while (!IsListEmpty (&Map->OneOfOptionMapEntryListHead)) {
- Link2 = GetFirstNode (&Map->OneOfOptionMapEntryListHead);
-
- MapEntry = ONE_OF_OPTION_MAP_ENTRY_FROM_LINK (Link2);
-
- RemoveEntryList (Link2);
-
- FreePool (MapEntry);
- }
-
- RemoveEntryList (Link);
- FreePool (Map);
- }
-}
-
-
-/**
- Initialize Statement header members.
-
- @param OpCodeData Pointer of the raw OpCode data.
- @param FormSet Pointer of the current FormSet.
- @param Form Pointer of the current Form.
-
- @return The Statement.
-
-**/
-FORM_BROWSER_STATEMENT *
-CreateStatement (
- IN UINT8 *OpCodeData,
- IN OUT FORM_BROWSER_FORMSET *FormSet,
- IN OUT FORM_BROWSER_FORM *Form
- )
-{
- FORM_BROWSER_STATEMENT *Statement;
- EFI_IFR_STATEMENT_HEADER *StatementHdr;
-
- if (Form == NULL) {
- //
- // We are currently not in a Form Scope, so just skip this Statement
- //
- return NULL;
- }
-
- Statement = &FormSet->StatementBuffer[mStatementIndex];
- mStatementIndex++;
-
- InitializeListHead (&Statement->DefaultListHead);
- InitializeListHead (&Statement->OptionListHead);
-
- Statement->Signature = FORM_BROWSER_STATEMENT_SIGNATURE;
-
- Statement->Operand = ((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode;
-
- StatementHdr = (EFI_IFR_STATEMENT_HEADER *) (OpCodeData + sizeof (EFI_IFR_OP_HEADER));
- CopyMem (&Statement->Prompt, &StatementHdr->Prompt, sizeof (EFI_STRING_ID));
- CopyMem (&Statement->Help, &StatementHdr->Help, sizeof (EFI_STRING_ID));
-
- Statement->InSubtitle = mInScopeSubtitle;
-
- //
- // Insert this Statement into current Form
- //
- InsertTailList (&Form->StatementListHead, &Statement->Link);
-
- return Statement;
-}
-
-/**
- Initialize Question's members.
-
- @param OpCodeData Pointer of the raw OpCode data.
- @param FormSet Pointer of the current FormSet.
- @param Form Pointer of the current Form.
-
- @return The Question.
-
-**/
-FORM_BROWSER_STATEMENT *
-CreateQuestion (
- IN UINT8 *OpCodeData,
- IN OUT FORM_BROWSER_FORMSET *FormSet,
- IN OUT FORM_BROWSER_FORM *Form
- )
-{
- FORM_BROWSER_STATEMENT *Statement;
- EFI_IFR_QUESTION_HEADER *QuestionHdr;
- LIST_ENTRY *Link;
- FORMSET_STORAGE *Storage;
-
- Statement = CreateStatement (OpCodeData, FormSet, Form);
- if (Statement == NULL) {
- return NULL;
- }
-
- QuestionHdr = (EFI_IFR_QUESTION_HEADER *) (OpCodeData + sizeof (EFI_IFR_OP_HEADER));
- CopyMem (&Statement->QuestionId, &QuestionHdr->QuestionId, sizeof (EFI_QUESTION_ID));
- CopyMem (&Statement->VarStoreId, &QuestionHdr->VarStoreId, sizeof (EFI_VARSTORE_ID));
- CopyMem (&Statement->VarStoreInfo.VarOffset, &QuestionHdr->VarStoreInfo.VarOffset, sizeof (UINT16));
-
- if (FormSet->MaxQuestionId < QuestionHdr->QuestionId) {
- FormSet->MaxQuestionId = QuestionHdr->QuestionId;
- }
-
- Statement->QuestionFlags = QuestionHdr->Flags;
-
- if (Statement->VarStoreId == 0) {
- //
- // VarStoreId of zero indicates no variable storage
- //
- return Statement;
- }
-
- //
- // Find Storage for this Question
- //
- Link = GetFirstNode (&FormSet->StorageListHead);
- while (!IsNull (&FormSet->StorageListHead, Link)) {
- Storage = FORMSET_STORAGE_FROM_LINK (Link);
-
- if (Storage->VarStoreId == Statement->VarStoreId) {
- Statement->Storage = Storage;
- break;
- }
-
- Link = GetNextNode (&FormSet->StorageListHead, Link);
- }
- ASSERT (Statement->Storage != NULL);
-
- return Statement;
-}
-
-/**
- Allocate a FORMSET_STORAGE data structure and insert to FormSet Storage List.
-
- @param FormSet Pointer of the current FormSet
-
- @return Pointer to a FORMSET_STORAGE data structure.
-
-**/
-FORMSET_STORAGE *
-CreateStorage (
- IN FORM_BROWSER_FORMSET *FormSet
- )
-{
- FORMSET_STORAGE *Storage;
-
- Storage = AllocateZeroPool (sizeof (FORMSET_STORAGE));
- ASSERT (Storage != NULL);
- Storage->Signature = FORMSET_STORAGE_SIGNATURE;
- InsertTailList (&FormSet->StorageListHead, &Storage->Link);
-
- return Storage;
-}
-
-/**
- Free resources of a storage
-
- @param Storage Pointer of the storage
-
- @return None.
-
-**/
-VOID
-DestroyStorage (
- IN FORMSET_STORAGE *Storage
- )
-{
- if (Storage == NULL) {
- return;
- }
-
- if (Storage->Name!= NULL) {
- FreePool (Storage->Name);
- }
-
- FreePool (Storage);
-}
-
-
-/**
- Free resources of a Statement
-
- @param Statement Pointer of the Statement
-
- @return None.
-
-**/
-VOID
-DestroyStatement (
- IN OUT FORM_BROWSER_STATEMENT *Statement
- )
-{
- LIST_ENTRY *Link;
- QUESTION_DEFAULT *Default;
- QUESTION_OPTION *Option;
-
- //
- // Free Default value List
- //
- while (!IsListEmpty (&Statement->DefaultListHead)) {
- Link = GetFirstNode (&Statement->DefaultListHead);
- Default = QUESTION_DEFAULT_FROM_LINK (Link);
- RemoveEntryList (&Default->Link);
-
- gBS->FreePool (Default);
- }
-
- //
- // Free Options List
- //
- while (!IsListEmpty (&Statement->OptionListHead)) {
- Link = GetFirstNode (&Statement->OptionListHead);
- Option = QUESTION_OPTION_FROM_LINK (Link);
- RemoveEntryList (&Option->Link);
-
- gBS->FreePool (Option);
- }
-
-}
-
-
-
-/**
- Free resources of a Form
-
- @param Form Pointer of the Form
-
- @return None.
-
-**/
-VOID
-DestroyForm (
- IN OUT FORM_BROWSER_FORM *Form
- )
-{
- LIST_ENTRY *Link;
- FORM_BROWSER_STATEMENT *Statement;
-
- //
- // Free Statements/Questions
- //
- while (!IsListEmpty (&Form->StatementListHead)) {
- Link = GetFirstNode (&Form->StatementListHead);
- Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
- RemoveEntryList (&Statement->Link);
-
- DestroyStatement (Statement);
- }
-
- //
- // Free this Form
- //
- gBS->FreePool (Form);
-}
-
-
-/**
- Free resources allocated for a FormSet
-
- @param FormSet Pointer of the FormSet
-
- @return None.
-
-**/
-VOID
-DestroyFormSet (
- IN OUT FORM_BROWSER_FORMSET *FormSet
- )
-{
- LIST_ENTRY *Link;
- FORMSET_STORAGE *Storage;
- FORMSET_DEFAULTSTORE *DefaultStore;
- FORM_BROWSER_FORM *Form;
-
- //
- // Free IFR binary buffer
- //
- FreePool (FormSet->IfrBinaryData);
-
- //
- // Free FormSet Storage
- //
- if (FormSet->StorageListHead.ForwardLink != NULL) {
- while (!IsListEmpty (&FormSet->StorageListHead)) {
- Link = GetFirstNode (&FormSet->StorageListHead);
- Storage = FORMSET_STORAGE_FROM_LINK (Link);
- RemoveEntryList (&Storage->Link);
-
- DestroyStorage (Storage);
- }
- }
-
- //
- // Free FormSet Default Store
- //
- if (FormSet->DefaultStoreListHead.ForwardLink != NULL) {
- while (!IsListEmpty (&FormSet->DefaultStoreListHead)) {
- Link = GetFirstNode (&FormSet->DefaultStoreListHead);
- DefaultStore = FORMSET_DEFAULTSTORE_FROM_LINK (Link);
- RemoveEntryList (&DefaultStore->Link);
-
- gBS->FreePool (DefaultStore);
- }
- }
-
- //
- // Free Forms
- //
- if (FormSet->FormListHead.ForwardLink != NULL) {
- while (!IsListEmpty (&FormSet->FormListHead)) {
- Link = GetFirstNode (&FormSet->FormListHead);
- Form = FORM_BROWSER_FORM_FROM_LINK (Link);
- RemoveEntryList (&Form->Link);
-
- DestroyForm (Form);
- }
- }
-
- if (FormSet->StatementBuffer != NULL) {
- FreePool (FormSet->StatementBuffer);
- }
-
- DestoryOneOfOptionMap (&FormSet->OneOfOptionMapListHead);
-
- if (FormSet->OriginalDefaultVarStoreName != NULL) {
- FreePool (FormSet->OriginalDefaultVarStoreName);
- }
-
- FreePool (FormSet);
-}
-
-
-/**
- Tell whether this Operand is an Expression OpCode or not
-
- @param Operand Operand of an IFR OpCode.
-
- @retval TRUE This is an Expression OpCode.
- @retval FALSE Not an Expression OpCode.
-
-**/
-BOOLEAN
-IsExpressionOpCode (
- IN UINT8 Operand
- )
-{
- if (((Operand >= EFI_IFR_EQ_ID_VAL_OP) && (Operand <= EFI_IFR_NOT_OP)) ||
- ((Operand >= EFI_IFR_MATCH_OP) && (Operand <= EFI_IFR_SET_OP)) ||
- ((Operand >= EFI_IFR_EQUAL_OP) && (Operand <= EFI_IFR_SPAN_OP)) ||
- (Operand == EFI_IFR_CATENATE_OP) ||
- (Operand == EFI_IFR_TO_LOWER_OP) ||
- (Operand == EFI_IFR_TO_UPPER_OP) ||
- (Operand == EFI_IFR_MAP_OP) ||
- (Operand == EFI_IFR_VERSION_OP) ||
- (Operand == EFI_IFR_SECURITY_OP)) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-
-/**
- Calculate number of Statemens(Questions) and Expression OpCodes.
-
- @param FormSet The FormSet to be counted.
- @param NumberOfStatement Number of Statemens(Questions)
- @param NumberOfExpression Number of Expression OpCodes
-
- @return None.
-
-**/
-VOID
-CountOpCodes (
- IN FORM_BROWSER_FORMSET *FormSet,
- IN OUT UINT16 *NumberOfStatement,
- IN OUT UINT16 *NumberOfExpression
- )
-{
- UINT16 StatementCount;
- UINT16 ExpressionCount;
- UINT8 *OpCodeData;
- UINTN Offset;
- UINTN OpCodeLen;
-
- Offset = 0;
- StatementCount = 0;
- ExpressionCount = 0;
-
- while (Offset < FormSet->IfrBinaryLength) {
- OpCodeData = FormSet->IfrBinaryData + Offset;
- OpCodeLen = ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
- Offset += OpCodeLen;
-
- if (IsExpressionOpCode (((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode)) {
- ExpressionCount++;
- } else {
- StatementCount++;
- }
- }
-
- *NumberOfStatement = StatementCount;
- *NumberOfExpression = ExpressionCount;
-}
-
-
-/**
- Parse opcodes in the formset IFR binary.
-
- @param FormSet Pointer of the FormSet data structure.
-
- @retval EFI_SUCCESS Opcode parse success.
- @retval Other Opcode parse fail.
-
-**/
-EFI_STATUS
-ParseOpCodes (
- IN FORM_BROWSER_FORMSET *FormSet
- )
-{
- EFI_STATUS Status;
- UINT16 Index;
- FORM_BROWSER_FORM *CurrentForm;
- FORM_BROWSER_STATEMENT *CurrentStatement;
- UINT8 Operand;
- UINT8 Scope;
- UINTN OpCodeOffset;
- UINTN OpCodeLength;
- UINT8 *OpCodeData;
- UINT8 ScopeOpCode;
- FORMSET_STORAGE *Storage;
- FORMSET_DEFAULTSTORE *DefaultStore;
- QUESTION_DEFAULT *CurrentDefault;
- QUESTION_OPTION *CurrentOption;
- CHAR8 *AsciiString;
- UINT16 NumberOfStatement;
- UINT16 NumberOfExpression;
- EFI_IMAGE_ID *ImageId;
- EFI_HII_VALUE *Value;
- LIST_ENTRY *OneOfOptinMapEntryListHead;
- EFI_IFR_GUID_OPTIONKEY *OptionMap;
- ONE_OF_OPTION_MAP *OneOfOptionMap;
- ONE_OF_OPTION_MAP_ENTRY *OneOfOptionMapEntry;
- UINT8 OneOfType;
- EFI_IFR_ONE_OF *OneOfOpcode;
- HII_THUNK_CONTEXT *ThunkContext;
- EFI_IFR_FORM_MAP_METHOD *MapMethod;
-
- mInScopeSubtitle = FALSE;
- mInScopeSuppress = FALSE;
- mInScopeGrayOut = FALSE;
- CurrentDefault = NULL;
- CurrentOption = NULL;
- MapMethod = NULL;
- ThunkContext = UefiHiiHandleToThunkContext ((CONST HII_THUNK_PRIVATE_DATA*) mHiiThunkPrivateData, FormSet->HiiHandle);
-
- //
- // Set to a invalid value.
- //
- OneOfType = (UINT8) -1;
-
- //
- // Get the number of Statements and Expressions
- //
- CountOpCodes (FormSet, &NumberOfStatement, &NumberOfExpression);
- FormSet->NumberOfStatement = NumberOfStatement;
-
- mStatementIndex = 0;
- FormSet->StatementBuffer = AllocateZeroPool (NumberOfStatement * sizeof (FORM_BROWSER_STATEMENT));
- if (FormSet->StatementBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- InitializeListHead (&FormSet->StorageListHead);
- InitializeListHead (&FormSet->DefaultStoreListHead);
- InitializeListHead (&FormSet->FormListHead);
- InitializeListHead (&FormSet->OneOfOptionMapListHead);
-
- CurrentForm = NULL;
- CurrentStatement = NULL;
-
- ResetScopeStack ();
-
- OpCodeOffset = 0;
- while (OpCodeOffset < FormSet->IfrBinaryLength) {
- OpCodeData = FormSet->IfrBinaryData + OpCodeOffset;
-
- OpCodeLength = ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
- OpCodeOffset += OpCodeLength;
- Operand = ((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode;
- Scope = ((EFI_IFR_OP_HEADER *) OpCodeData)->Scope;
-
- //
- // If scope bit set, push onto scope stack
- //
- if (Scope != 0) {
- PushScope (Operand);
- }
-
- if (IsExpressionOpCode (Operand)) {
- continue;
- }
-
- //
- // Parse the Opcode
- //
- switch (Operand) {
-
- case EFI_IFR_FORM_SET_OP:
- //
- // check the formset GUID
- //
- if (!CompareGuid ((EFI_GUID *)(VOID *)&FormSet->Guid, (EFI_GUID *)(VOID *)&((EFI_IFR_FORM_SET *) OpCodeData)->Guid)) {
- return EFI_INVALID_PARAMETER;
- }
-
- CopyMem (&FormSet->FormSetTitle, &((EFI_IFR_FORM_SET *) OpCodeData)->FormSetTitle, sizeof (EFI_STRING_ID));
- CopyMem (&FormSet->Help, &((EFI_IFR_FORM_SET *) OpCodeData)->Help, sizeof (EFI_STRING_ID));
- break;
-
- case EFI_IFR_FORM_OP:
- //
- // Create a new Form for this FormSet
- //
- CurrentForm = AllocateZeroPool (sizeof (FORM_BROWSER_FORM));
- ASSERT (CurrentForm != NULL);
- CurrentForm->Signature = FORM_BROWSER_FORM_SIGNATURE;
-
- InitializeListHead (&CurrentForm->StatementListHead);
-
- CopyMem (&CurrentForm->FormId, &((EFI_IFR_FORM *) OpCodeData)->FormId, sizeof (UINT16));
- CopyMem (&CurrentForm->FormTitle, &((EFI_IFR_FORM *) OpCodeData)->FormTitle, sizeof (EFI_STRING_ID));
-
- //
- // Insert into Form list of this FormSet
- //
- InsertTailList (&FormSet->FormListHead, &CurrentForm->Link);
- break;
-
- case EFI_IFR_FORM_MAP_OP:
- //
- // Create a new Form Map for this FormSet
- //
- CurrentForm = AllocateZeroPool (sizeof (FORM_BROWSER_FORM));
- ASSERT (CurrentForm != NULL);
- CurrentForm->Signature = FORM_BROWSER_FORM_SIGNATURE;
-
- InitializeListHead (&CurrentForm->StatementListHead);
-
- CopyMem (&CurrentForm->FormId, &((EFI_IFR_FORM *) OpCodeData)->FormId, sizeof (UINT16));
- MapMethod = (EFI_IFR_FORM_MAP_METHOD *) (OpCodeData + sizeof (EFI_IFR_FORM_MAP));
-
- //
- // FormMap Form must contain at least one Map Method.
- //
- if (((EFI_IFR_OP_HEADER *) OpCodeData)->Length < ((UINTN) (UINT8 *) (MapMethod + 1) - (UINTN) OpCodeData)) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Try to find the standard form map method.
- //
- while (((UINTN) (UINT8 *) MapMethod - (UINTN) OpCodeData) < ((EFI_IFR_OP_HEADER *) OpCodeData)->Length) {
- if (CompareGuid ((EFI_GUID *) (VOID *) &MapMethod->MethodIdentifier, &gEfiHiiStandardFormGuid)) {
- CopyMem (&CurrentForm->FormTitle, &MapMethod->MethodTitle, sizeof (EFI_STRING_ID));
- break;
- }
- MapMethod ++;
- }
- //
- // If the standard form map method is not found, the first map method title will be used.
- //
- if (CurrentForm->FormTitle == 0) {
- MapMethod = (EFI_IFR_FORM_MAP_METHOD *) (OpCodeData + sizeof (EFI_IFR_FORM_MAP));
- CopyMem (&CurrentForm->FormTitle, &MapMethod->MethodTitle, sizeof (EFI_STRING_ID));
- }
-
- //
- // Insert into Form list of this FormSet
- //
- InsertTailList (&FormSet->FormListHead, &CurrentForm->Link);
- break;
-
- //
- // Storage
- //
- case EFI_IFR_VARSTORE_OP:
- //
- // Create a buffer Storage for this FormSet
- //
- Storage = CreateStorage (FormSet);
- Storage->Type = EFI_HII_VARSTORE_BUFFER;
-
- CopyMem (&Storage->VarStoreId, &((EFI_IFR_VARSTORE *) OpCodeData)->VarStoreId, sizeof (EFI_VARSTORE_ID));
- CopyMem (&Storage->Guid, &((EFI_IFR_VARSTORE *) OpCodeData)->Guid, sizeof (EFI_GUID));
- CopyMem (&Storage->Size, &((EFI_IFR_VARSTORE *) OpCodeData)->Size, sizeof (UINT16));
-
- AsciiString = (CHAR8 *) ((EFI_IFR_VARSTORE *) OpCodeData)->Name;
- Storage->Name = AllocateZeroPool (AsciiStrSize (AsciiString) * 2);
- ASSERT (Storage->Name != NULL);
- for (Index = 0; AsciiString[Index] != 0; Index++) {
- Storage->Name[Index] = (CHAR16) AsciiString[Index];
- }
-
- break;
-
- case EFI_IFR_VARSTORE_NAME_VALUE_OP:
- //
- // Framework IFR doesn't support Name/Value VarStore opcode
- //
- if (ThunkContext != NULL && ThunkContext->ByFrameworkHiiNewPack) {
- ASSERT (FALSE);
- }
-
- //
- // Create a name/value Storage for this FormSet
- //
- Storage = CreateStorage (FormSet);
- Storage->Type = EFI_HII_VARSTORE_NAME_VALUE;
-
- CopyMem (&Storage->VarStoreId, &((EFI_IFR_VARSTORE_NAME_VALUE *) OpCodeData)->VarStoreId, sizeof (EFI_VARSTORE_ID));
- CopyMem (&Storage->Guid, &((EFI_IFR_VARSTORE_NAME_VALUE *) OpCodeData)->Guid, sizeof (EFI_GUID));
-
- break;
-
- case EFI_IFR_VARSTORE_EFI_OP:
- //
- // Create a EFI variable Storage for this FormSet
- //
- Storage = CreateStorage (FormSet);
- Storage->Type = EFI_HII_VARSTORE_EFI_VARIABLE;
-
- CopyMem (&Storage->VarStoreId, &((EFI_IFR_VARSTORE_EFI *) OpCodeData)->VarStoreId, sizeof (EFI_VARSTORE_ID));
- CopyMem (&Storage->Guid, &((EFI_IFR_VARSTORE_EFI *) OpCodeData)->Guid, sizeof (EFI_GUID));
- CopyMem (&Storage->Attributes, &((EFI_IFR_VARSTORE_EFI *) OpCodeData)->Attributes, sizeof (UINT32));
- break;
-
- //
- // DefaultStore
- //
- case EFI_IFR_DEFAULTSTORE_OP:
- DefaultStore = AllocateZeroPool (sizeof (FORMSET_DEFAULTSTORE));
- ASSERT (DefaultStore != NULL);
- DefaultStore->Signature = FORMSET_DEFAULTSTORE_SIGNATURE;
-
- CopyMem (&DefaultStore->DefaultId, &((EFI_IFR_DEFAULTSTORE *) OpCodeData)->DefaultId, sizeof (UINT16));
- CopyMem (&DefaultStore->DefaultName, &((EFI_IFR_DEFAULTSTORE *) OpCodeData)->DefaultName, sizeof (EFI_STRING_ID));
-
- //
- // Insert to DefaultStore list of this Formset
- //
- InsertTailList (&FormSet->DefaultStoreListHead, &DefaultStore->Link);
- break;
-
- //
- // Statements
- //
- case EFI_IFR_SUBTITLE_OP:
- CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
- ASSERT (CurrentStatement != NULL);
- CurrentStatement->Flags = ((EFI_IFR_SUBTITLE *) OpCodeData)->Flags;
-
- if (Scope != 0) {
- mInScopeSubtitle = TRUE;
- }
- break;
-
- case EFI_IFR_TEXT_OP:
- CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
- ASSERT (CurrentStatement != NULL);
-
- CopyMem (&CurrentStatement->TextTwo, &((EFI_IFR_TEXT *) OpCodeData)->TextTwo, sizeof (EFI_STRING_ID));
- break;
-
- //
- // Questions
- //
- case EFI_IFR_ACTION_OP:
- CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
- ASSERT (CurrentStatement != NULL);
-
- if (OpCodeLength == sizeof (EFI_IFR_ACTION_1)) {
- //
- // No QuestionConfig present, so no configuration string will be processed
- //
- CurrentStatement->QuestionConfig = 0;
- } else {
- CopyMem (&CurrentStatement->QuestionConfig, &((EFI_IFR_ACTION *) OpCodeData)->QuestionConfig, sizeof (EFI_STRING_ID));
- }
- break;
-
- case EFI_IFR_RESET_BUTTON_OP:
- CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
- ASSERT (CurrentStatement != NULL);
- CopyMem (&CurrentStatement->DefaultId, &((EFI_IFR_RESET_BUTTON *) OpCodeData)->DefaultId, sizeof (EFI_DEFAULT_ID));
- break;
-
- case EFI_IFR_REF_OP:
- CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
- ASSERT (CurrentStatement != NULL);
-
- CopyMem (&CurrentStatement->RefFormId, &((EFI_IFR_REF *) OpCodeData)->FormId, sizeof (EFI_FORM_ID));
- if (OpCodeLength >= sizeof (EFI_IFR_REF2)) {
- CopyMem (&CurrentStatement->RefQuestionId, &((EFI_IFR_REF2 *) OpCodeData)->QuestionId, sizeof (EFI_QUESTION_ID));
-
- if (OpCodeLength >= sizeof (EFI_IFR_REF3)) {
- CopyMem (&CurrentStatement->RefFormSetId, &((EFI_IFR_REF3 *) OpCodeData)->FormSetId, sizeof (EFI_GUID));
-
- if (OpCodeLength >= sizeof (EFI_IFR_REF4)) {
- CopyMem (&CurrentStatement->RefDevicePath, &((EFI_IFR_REF4 *) OpCodeData)->DevicePath, sizeof (EFI_STRING_ID));
- }
- }
- }
- break;
-
- case EFI_IFR_ONE_OF_OP:
- case EFI_IFR_NUMERIC_OP:
- CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
- ASSERT (CurrentStatement != NULL);
-
- CurrentStatement->Flags = ((EFI_IFR_ONE_OF *) OpCodeData)->Flags;
- Value = &CurrentStatement->HiiValue;
-
- switch (CurrentStatement->Flags & EFI_IFR_NUMERIC_SIZE) {
- case EFI_IFR_NUMERIC_SIZE_1:
- CurrentStatement->Minimum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MinValue;
- CurrentStatement->Maximum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MaxValue;
- CurrentStatement->Step = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.Step;
- CurrentStatement->StorageWidth = (UINT16) sizeof (UINT8);
- Value->Type = EFI_IFR_TYPE_NUM_SIZE_8;
- break;
-
- case EFI_IFR_NUMERIC_SIZE_2:
- CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MinValue, sizeof (UINT16));
- CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MaxValue, sizeof (UINT16));
- CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.Step, sizeof (UINT16));
- CurrentStatement->StorageWidth = (UINT16) sizeof (UINT16);
- Value->Type = EFI_IFR_TYPE_NUM_SIZE_16;
- break;
-
- case EFI_IFR_NUMERIC_SIZE_4:
- CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MinValue, sizeof (UINT32));
- CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MaxValue, sizeof (UINT32));
- CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.Step, sizeof (UINT32));
- CurrentStatement->StorageWidth = (UINT16) sizeof (UINT32);
- Value->Type = EFI_IFR_TYPE_NUM_SIZE_32;
- break;
-
- case EFI_IFR_NUMERIC_SIZE_8:
- CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.MinValue, sizeof (UINT64));
- CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.MaxValue, sizeof (UINT64));
- CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.Step, sizeof (UINT64));
- CurrentStatement->StorageWidth = (UINT16) sizeof (UINT64);
- Value->Type = EFI_IFR_TYPE_NUM_SIZE_64;
- break;
-
- default:
- break;
- }
-
- if (Operand == EFI_IFR_ONE_OF_OP) {
- OneOfOpcode = (EFI_IFR_ONE_OF *) OpCodeData;
- OneOfType = (UINT8) (OneOfOpcode->Flags & EFI_IFR_NUMERIC_SIZE);
- }
- break;
-
- case EFI_IFR_ORDERED_LIST_OP:
- CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
- ASSERT (CurrentStatement != NULL);
-
- CurrentStatement->Flags = ((EFI_IFR_ORDERED_LIST *) OpCodeData)->Flags;
- CurrentStatement->MaxContainers = ((EFI_IFR_ORDERED_LIST *) OpCodeData)->MaxContainers;
- CurrentStatement->StorageWidth = (UINT16)(CurrentStatement->MaxContainers * sizeof (UINT8));
-
- //
- // No buffer type is defined in EFI_IFR_TYPE_VALUE, so a Configuration Driver
- // has to use FormBrowser2.Callback() to retrieve the uncommited data for
- // an interactive orderedlist (i.e. with EFI_IFR_FLAG_CALLBACK flag set).
- //
- CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_OTHER;
- CurrentStatement->BufferValue = AllocateZeroPool (CurrentStatement->StorageWidth);
-
- break;
-
- case EFI_IFR_CHECKBOX_OP:
- CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
- ASSERT (CurrentStatement != NULL);
-
- CurrentStatement->Flags = ((EFI_IFR_CHECKBOX *) OpCodeData)->Flags;
- CurrentStatement->StorageWidth = (UINT16) sizeof (BOOLEAN);
- CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_BOOLEAN;
-
- break;
-
- case EFI_IFR_STRING_OP:
- CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
- ASSERT (CurrentStatement != NULL);
-
- //
- // MinSize is the minimum number of characters that can be accepted for this opcode,
- // MaxSize is the maximum number of characters that can be accepted for this opcode.
- // The characters are stored as Unicode, so the storage width should multiply 2.
- //
- CurrentStatement->Minimum = ((EFI_IFR_STRING *) OpCodeData)->MinSize;
- CurrentStatement->Maximum = ((EFI_IFR_STRING *) OpCodeData)->MaxSize;
- CurrentStatement->StorageWidth = (UINT16)((UINTN) CurrentStatement->Maximum * sizeof (UINT16));
- CurrentStatement->Flags = ((EFI_IFR_STRING *) OpCodeData)->Flags;
-
- CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_STRING;
- CurrentStatement->BufferValue = AllocateZeroPool (CurrentStatement->StorageWidth);
-
- break;
-
- case EFI_IFR_PASSWORD_OP:
- CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
- ASSERT (CurrentStatement != NULL);
-
- //
- // MinSize is the minimum number of characters that can be accepted for this opcode,
- // MaxSize is the maximum number of characters that can be accepted for this opcode.
- // The characters are stored as Unicode, so the storage width should multiply 2.
- //
- CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_PASSWORD *) OpCodeData)->MinSize, sizeof (UINT16));
- CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_PASSWORD *) OpCodeData)->MaxSize, sizeof (UINT16));
- CurrentStatement->StorageWidth = (UINT16)((UINTN) CurrentStatement->Maximum * sizeof (UINT16));
-
- CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_STRING;
- CurrentStatement->BufferValue = AllocateZeroPool (CurrentStatement->StorageWidth);
-
- break;
-
- case EFI_IFR_DATE_OP:
- CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
- ASSERT (CurrentStatement != NULL);
-
- CurrentStatement->Flags = ((EFI_IFR_DATE *) OpCodeData)->Flags;
- CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_DATE;
-
- break;
-
- case EFI_IFR_TIME_OP:
- CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
- ASSERT (CurrentStatement != NULL);
-
- CurrentStatement->Flags = ((EFI_IFR_TIME *) OpCodeData)->Flags;
- CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_TIME;
-
- break;
-
- //
- // Default
- //
- case EFI_IFR_DEFAULT_OP:
- //
- // EFI_IFR_DEFAULT appear in scope of a Question,
- // It creates a default value for the current question.
- // A Question may have more than one Default value which have different default types.
- //
- CurrentDefault = AllocateZeroPool (sizeof (QUESTION_DEFAULT));
- ASSERT (CurrentDefault != NULL);
- CurrentDefault->Signature = QUESTION_DEFAULT_SIGNATURE;
-
- CurrentDefault->Value.Type = ((EFI_IFR_DEFAULT *) OpCodeData)->Type;
- CopyMem (&CurrentDefault->DefaultId, &((EFI_IFR_DEFAULT *) OpCodeData)->DefaultId, sizeof (UINT16));
- CopyMem (&CurrentDefault->Value.Value, &((EFI_IFR_DEFAULT *) OpCodeData)->Value, sizeof (EFI_IFR_TYPE_VALUE));
- ExtendValueToU64 (&CurrentDefault->Value);
-
- //
- // Insert to Default Value list of current Question
- //
- InsertTailList (&CurrentStatement->DefaultListHead, &CurrentDefault->Link);
-
- break;
-
- //
- // Option
- //
- case EFI_IFR_ONE_OF_OPTION_OP:
- //
- // EFI_IFR_ONE_OF_OPTION appear in scope of a Question.
- // It create a selection for use in current Question.
- //
- CurrentOption = AllocateZeroPool (sizeof (QUESTION_OPTION));
- ASSERT (CurrentOption != NULL);
- CurrentOption->Signature = QUESTION_OPTION_SIGNATURE;
-
- CurrentOption->Flags = ((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Flags;
- CurrentOption->Value.Type = ((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Type;
- CopyMem (&CurrentOption->Text, &((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Option, sizeof (EFI_STRING_ID));
- CopyMem (&CurrentOption->Value.Value, &((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Value, sizeof (EFI_IFR_TYPE_VALUE));
- ExtendValueToU64 (&CurrentOption->Value);
-
- //
- // Insert to Option list of current Question
- //
- InsertTailList (&CurrentStatement->OptionListHead, &CurrentOption->Link);
- break;
-
- //
- // Conditional
- //
- case EFI_IFR_NO_SUBMIT_IF_OP:
- case EFI_IFR_INCONSISTENT_IF_OP:
- break;
-
- case EFI_IFR_SUPPRESS_IF_OP:
- break;
-
- case EFI_IFR_GRAY_OUT_IF_OP:
- break;
-
- case EFI_IFR_DISABLE_IF_OP:
- //
- // Framework IFR doesn't support DisableIf opcode
- //
- if (ThunkContext != NULL && ThunkContext->ByFrameworkHiiNewPack) {
- ASSERT (FALSE);
- }
-
- //
- // Expression
- //
- case EFI_IFR_VALUE_OP:
- case EFI_IFR_READ_OP:
- case EFI_IFR_WRITE_OP:
- break;
-
- case EFI_IFR_RULE_OP:
- break;
-
- //
- // Image
- //
- case EFI_IFR_IMAGE_OP:
- //
- // Get ScopeOpcode from top of stack
- //
- PopScope (&ScopeOpCode);
- PushScope (ScopeOpCode);
-
- switch (ScopeOpCode) {
- case EFI_IFR_FORM_SET_OP:
- ImageId = &FormSet->ImageId;
- break;
-
- case EFI_IFR_FORM_OP:
- case EFI_IFR_FORM_MAP_OP:
- ASSERT (CurrentForm != NULL);
- ImageId = &CurrentForm->ImageId;
- break;
-
- case EFI_IFR_ONE_OF_OPTION_OP:
- ASSERT (CurrentOption != NULL);
- ImageId = &CurrentOption->ImageId;
- break;
-
- default:
- //
- // Make sure CurrentStatement is not NULL.
- // If it is NULL, 1) ParseOpCodes functions may parse the IFR wrongly. Or 2) the IFR
- // file is wrongly generated by tools such as VFR Compiler.
- //
- ASSERT (CurrentStatement != NULL);
- ImageId = &CurrentStatement->ImageId;
- break;
- }
-
- ASSERT (ImageId != NULL);
- CopyMem (ImageId, &((EFI_IFR_IMAGE *) OpCodeData)->Id, sizeof (EFI_IMAGE_ID));
- break;
-
- //
- // Refresh
- //
- case EFI_IFR_REFRESH_OP:
- ASSERT (CurrentStatement != NULL);
- CurrentStatement->RefreshInterval = ((EFI_IFR_REFRESH *) OpCodeData)->RefreshInterval;
- break;
-
- //
- // Vendor specific
- //
- case EFI_IFR_GUID_OP:
- OptionMap = (EFI_IFR_GUID_OPTIONKEY *) OpCodeData;
-
- if (CompareGuid (&mTianoHiiIfrGuid, (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER)))) {
- //
- // Tiano specific GUIDed opcodes
- //
- switch (((EFI_IFR_GUID_LABEL *) OpCodeData)->ExtendOpCode) {
- case EFI_IFR_EXTEND_OP_LABEL:
- //
- // just ignore label
- //
- break;
-
-
- case EFI_IFR_EXTEND_OP_CLASS:
- CopyMem (&FormSet->Class, &((EFI_IFR_GUID_CLASS *) OpCodeData)->Class, sizeof (UINT16));
- break;
-
- case EFI_IFR_EXTEND_OP_SUBCLASS:
- CopyMem (&FormSet->SubClass, &((EFI_IFR_GUID_SUBCLASS *) OpCodeData)->SubClass, sizeof (UINT16));
- break;
-
- default:
- break;
- }
- } else if (CompareGuid ((EFI_GUID *)(VOID *)&OptionMap->Guid, &mFrameworkHiiCompatibilityGuid)) {
- if (OptionMap->ExtendOpCode == EFI_IFR_EXTEND_OP_OPTIONKEY) {
- OneOfOptinMapEntryListHead = GetOneOfOptionMapEntryListHead (FormSet, OptionMap->QuestionId);
- if (OneOfOptinMapEntryListHead == NULL) {
- OneOfOptionMap = AllocateZeroPool (sizeof (ONE_OF_OPTION_MAP));
- ASSERT (OneOfOptionMap != NULL);
-
- OneOfOptionMap->Signature = ONE_OF_OPTION_MAP_SIGNATURE;
- OneOfOptionMap->QuestionId = OptionMap->QuestionId;
-
- //
- // Make sure OneOfType is initialized.
- //
- ASSERT (OneOfType != (UINT8) -1);
- OneOfOptionMap->ValueType = OneOfType;
- InitializeListHead (&OneOfOptionMap->OneOfOptionMapEntryListHead);
- OneOfOptinMapEntryListHead = &OneOfOptionMap->OneOfOptionMapEntryListHead;
- InsertTailList (&FormSet->OneOfOptionMapListHead, &OneOfOptionMap->Link);
- }
- OneOfOptionMapEntry = AllocateZeroPool (sizeof (ONE_OF_OPTION_MAP_ENTRY));
- ASSERT (OneOfOptionMapEntry != NULL);
-
- OneOfOptionMapEntry->Signature = ONE_OF_OPTION_MAP_ENTRY_SIGNATURE;
- OneOfOptionMapEntry->FwKey = OptionMap->KeyValue;
- CopyMem (&OneOfOptionMapEntry->Value, &OptionMap->OptionValue, sizeof (EFI_IFR_TYPE_VALUE));
-
- InsertTailList (OneOfOptinMapEntryListHead, &OneOfOptionMapEntry->Link);
- }
- }
- break;
-
- //
- // Scope End
- //
- case EFI_IFR_END_OP:
- Status = PopScope (&ScopeOpCode);
- if (EFI_ERROR (Status)) {
- ResetScopeStack ();
- return Status;
- }
-
- switch (ScopeOpCode) {
- case EFI_IFR_FORM_SET_OP:
- //
- // End of FormSet, update FormSet IFR binary length
- // to stop parsing substantial OpCodes
- //
- FormSet->IfrBinaryLength = OpCodeOffset;
- break;
-
- case EFI_IFR_FORM_OP:
- case EFI_IFR_FORM_MAP_OP:
- //
- // End of Form
- //
- CurrentForm = NULL;
- break;
-
- case EFI_IFR_ONE_OF_OPTION_OP:
- //
- // End of Option
- //
- CurrentOption = NULL;
- break;
-
- case EFI_IFR_SUBTITLE_OP:
- mInScopeSubtitle = FALSE;
- break;
-
- case EFI_IFR_NO_SUBMIT_IF_OP:
- case EFI_IFR_INCONSISTENT_IF_OP:
- //
- // Ignore end of EFI_IFR_NO_SUBMIT_IF and EFI_IFR_INCONSISTENT_IF
- //
- break;
-
- case EFI_IFR_GRAY_OUT_IF_OP:
- mInScopeGrayOut = FALSE;
- break;
-
- default:
- if (IsExpressionOpCode (ScopeOpCode)) {
- }
- break;
- }
- break;
-
- default:
- break;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-
-
-
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.h
deleted file mode 100644
index 6d3dd82574..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.h
+++ /dev/null
@@ -1,342 +0,0 @@
-/** @file
- Function and Macro defintions for IFR parsing. To get the default value from IFR package, the IFR
- opcode needs to be parsed. Most of code is taken from MdeModulePkg\Universal\SetupBrowserDxe\IfrParse.c.
- This parser is simplified from the origianl IfrParser.c in the following way:
-
- 1) All data structure definition that have nothing to do with IFR Default value scanning (
- required to implement Framework HII's GetDefaultImage ()) is removed.
- 2) Ignore the IFR opcode which is invalid for Form Package
- generated using Framework VFR file.
-
- Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-
-#ifndef _HII_THUNK_UEFI_IFR_PARSER_
-#define _HII_THUNK_UEFI_IFR_PARSER_
-
-
-//
-// IFR relative definition
-//
-#define EFI_HII_EXPRESSION_INCONSISTENT_IF 0
-#define EFI_HII_EXPRESSION_NO_SUBMIT_IF 1
-#define EFI_HII_EXPRESSION_GRAY_OUT_IF 2
-#define EFI_HII_EXPRESSION_SUPPRESS_IF 3
-#define EFI_HII_EXPRESSION_DISABLE_IF 4
-#define EFI_HII_EXPRESSION_VALUE 5
-#define EFI_HII_EXPRESSION_RULE 6
-
-#define EFI_HII_VARSTORE_BUFFER 0
-#define EFI_HII_VARSTORE_NAME_VALUE 1
-#define EFI_HII_VARSTORE_EFI_VARIABLE 2
-
-#define FORM_INCONSISTENT_VALIDATION 0
-#define FORM_NO_SUBMIT_VALIDATION 1
-
-extern EFI_GUID gTianoHiiIfrGuid;
-
-#define ONE_OF_OPTION_MAP_ENTRY_FROM_LINK(Record) CR(Record, ONE_OF_OPTION_MAP_ENTRY, Link, ONE_OF_OPTION_MAP_ENTRY_SIGNATURE)
-#define ONE_OF_OPTION_MAP_ENTRY_SIGNATURE SIGNATURE_32 ('O', 'O', 'M', 'E')
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
-
- UINT16 FwKey;
- EFI_IFR_TYPE_VALUE Value;
-
-} ONE_OF_OPTION_MAP_ENTRY;
-
-
-
-#define ONE_OF_OPTION_MAP_FROM_LINK(Record) CR(Record, ONE_OF_OPTION_MAP, Link, ONE_OF_OPTION_MAP_SIGNATURE)
-#define ONE_OF_OPTION_MAP_SIGNATURE SIGNATURE_32 ('O', 'O', 'O', 'M')
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
-
- UINT16 VarStoreId;
-
- UINT8 ValueType; //EFI_IFR_TYPE_NUM_*
-
- EFI_QUESTION_ID QuestionId;
-
- LIST_ENTRY OneOfOptionMapEntryListHead; //ONE_OF_OPTION_MAP_ENTRY
-} ONE_OF_OPTION_MAP;
-
-
-typedef struct {
- UINT8 Type;
- EFI_IFR_TYPE_VALUE Value;
-} EFI_HII_VALUE;
-
-#define NAME_VALUE_NODE_SIGNATURE SIGNATURE_32 ('N', 'V', 'S', 'T')
-
-#define FORMSET_STORAGE_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'G')
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- UINT8 Type; // Storage type
-
- UINT16 VarStoreId;
- EFI_GUID Guid;
-
- CHAR16 *Name; // For EFI_IFR_VARSTORE
- UINT16 Size;
-
- UINT32 Attributes; // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute
-
-} FORMSET_STORAGE;
-
-#define FORMSET_STORAGE_FROM_LINK(a) CR (a, FORMSET_STORAGE, Link, FORMSET_STORAGE_SIGNATURE)
-
-#if 0
-
-#define EXPRESSION_OPCODE_SIGNATURE SIGNATURE_32 ('E', 'X', 'O', 'P')
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- UINT8 Operand;
-
- UINT8 Format; // For EFI_IFR_TO_STRING, EFI_IFR_FIND
- UINT8 Flags; // For EFI_IFR_SPAN
- UINT8 RuleId; // For EFI_IFR_RULE_REF
-
- EFI_HII_VALUE Value; // For EFI_IFR_EQ_ID_VAL, EFI_IFR_UINT64, EFI_IFR_UINT32, EFI_IFR_UINT16, EFI_IFR_UINT8, EFI_IFR_STRING_REF1
-
- EFI_QUESTION_ID QuestionId; // For EFI_IFR_EQ_ID_ID, EFI_IFR_EQ_ID_VAL_LIST, EFI_IFR_QUESTION_REF1
- EFI_QUESTION_ID QuestionId2;
-
- UINT16 ListLength; // For EFI_IFR_EQ_ID_VAL_LIST
- UINT16 *ValueList;
-
- EFI_STRING_ID DevicePath; // For EFI_IFR_QUESTION_REF3_2, EFI_IFR_QUESTION_REF3_3
- EFI_GUID Guid;
-} EXPRESSION_OPCODE;
-
-#define EXPRESSION_OPCODE_FROM_LINK(a) CR (a, EXPRESSION_OPCODE, Link, EXPRESSION_OPCODE_SIGNATURE)
-
-#define FORM_EXPRESSION_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'P')
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- UINT8 Type; // Type for this expression
-
- UINT8 RuleId; // For EFI_IFR_RULE only
- EFI_STRING_ID Error; // For EFI_IFR_NO_SUBMIT_IF, EFI_IFR_INCONSISTENT_IF only
-
- EFI_HII_VALUE Result; // Expression evaluation result
-
- LIST_ENTRY OpCodeListHead; // OpCodes consist of this expression (EXPRESSION_OPCODE)
-} FORM_EXPRESSION;
-
-#define FORM_EXPRESSION_FROM_LINK(a) CR (a, FORM_EXPRESSION, Link, FORM_EXPRESSION_SIGNATURE)
-#endif
-
-#define QUESTION_DEFAULT_SIGNATURE SIGNATURE_32 ('Q', 'D', 'F', 'T')
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- UINT16 DefaultId;
- EFI_HII_VALUE Value; // Default value
-
-} QUESTION_DEFAULT;
-
-#define QUESTION_DEFAULT_FROM_LINK(a) CR (a, QUESTION_DEFAULT, Link, QUESTION_DEFAULT_SIGNATURE)
-
-#define QUESTION_OPTION_SIGNATURE SIGNATURE_32 ('Q', 'O', 'P', 'T')
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- EFI_STRING_ID Text;
- UINT8 Flags;
- EFI_HII_VALUE Value;
- EFI_IMAGE_ID ImageId;
-
-} QUESTION_OPTION;
-
-#define QUESTION_OPTION_FROM_LINK(a) CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)
-
-typedef union {
- EFI_STRING_ID VarName;
- UINT16 VarOffset;
-} VAR_STORE_INFO;
-
-#define FORM_BROWSER_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- UINT8 Operand; // The operand (first byte) of this Statement or Question
-
- //
- // Statement Header
- //
- EFI_STRING_ID Prompt;
- EFI_STRING_ID Help;
- EFI_STRING_ID TextTwo; // For EFI_IFR_TEXT
-
- //
- // Question Header
- //
- EFI_QUESTION_ID QuestionId; // The value of zero is reserved
- EFI_VARSTORE_ID VarStoreId; // A value of zero indicates no variable storage
- FORMSET_STORAGE *Storage;
- VAR_STORE_INFO VarStoreInfo;
-
- UINT16 StorageWidth;
- UINT8 QuestionFlags;
-
- EFI_HII_VALUE HiiValue; // Edit copy for checkbox, numberic, oneof
- UINT8 *BufferValue; // Edit copy for string, password, orderedlist
-
- //
- // OpCode specific members
- //
- UINT8 Flags; // for EFI_IFR_CHECKBOX, EFI_IFR_DATE, EFI_IFR_NUMERIC, EFI_IFR_ONE_OF,
- // EFI_IFR_ORDERED_LIST, EFI_IFR_STRING,EFI_IFR_SUBTITLE,EFI_IFR_TIME, EFI_IFR_BANNER
- UINT8 MaxContainers; // for EFI_IFR_ORDERED_LIST
-
- UINT16 BannerLineNumber; // for EFI_IFR_BANNER, 1-based line number
- EFI_STRING_ID QuestionConfig; // for EFI_IFR_ACTION, if 0 then no configuration string will be processed
-
- UINT64 Minimum; // for EFI_IFR_ONE_OF/EFI_IFR_NUMERIC, it's Min/Max value
- UINT64 Maximum; // for EFI_IFR_STRING/EFI_IFR_PASSWORD, it's Min/Max length
- UINT64 Step;
-
- EFI_DEFAULT_ID DefaultId; // for EFI_IFR_RESET_BUTTON
- EFI_FORM_ID RefFormId; // for EFI_IFR_REF
- EFI_QUESTION_ID RefQuestionId; // for EFI_IFR_REF2
- EFI_GUID RefFormSetId; // for EFI_IFR_REF3
- EFI_STRING_ID RefDevicePath; // for EFI_IFR_REF4
-
- //
- // Get from IFR parsing
- //
- LIST_ENTRY DefaultListHead; // nested EFI_IFR_DEFAULT list (QUESTION_DEFAULT), provide default values
- LIST_ENTRY OptionListHead; // nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION)
-
- EFI_IMAGE_ID ImageId; // nested EFI_IFR_IMAGE
- UINT8 RefreshInterval; // nested EFI_IFR_REFRESH, refresh interval(in seconds) for Question value, 0 means no refresh
- BOOLEAN InSubtitle; // nesting inside of EFI_IFR_SUBTITLE
-
-} FORM_BROWSER_STATEMENT;
-
-#define FORM_BROWSER_STATEMENT_FROM_LINK(a) CR (a, FORM_BROWSER_STATEMENT, Link, FORM_BROWSER_STATEMENT_SIGNATURE)
-
-#define FORM_BROWSER_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M')
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- UINT16 FormId;
- EFI_STRING_ID FormTitle;
-
- EFI_IMAGE_ID ImageId;
-
-#if 0
- LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
-#endif
- LIST_ENTRY StatementListHead; // List of Statements and Questions (FORM_BROWSER_STATEMENT)
-} FORM_BROWSER_FORM;
-
-#define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)
-
-#define FORMSET_DEFAULTSTORE_SIGNATURE SIGNATURE_32 ('F', 'D', 'F', 'S')
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- UINT16 DefaultId;
- EFI_STRING_ID DefaultName;
-} FORMSET_DEFAULTSTORE;
-
-#define FORMSET_DEFAULTSTORE_FROM_LINK(a) CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)
-
-typedef struct {
- EFI_HII_HANDLE HiiHandle;
-
- UINTN IfrBinaryLength;
- UINT8 *IfrBinaryData;
-
- EFI_GUID Guid;
- EFI_STRING_ID FormSetTitle;
- EFI_STRING_ID Help;
- UINT16 Class;
- UINT16 SubClass;
- EFI_IMAGE_ID ImageId;
-
- FORM_BROWSER_STATEMENT *StatementBuffer; // Buffer for all Statements and Questions
-#if 0
- EXPRESSION_OPCODE *ExpressionBuffer; // Buffer for all Expression OpCode
-#endif
-
- LIST_ENTRY StorageListHead; // Storage list (FORMSET_STORAGE)
- LIST_ENTRY DefaultStoreListHead; // DefaultStore list (FORMSET_DEFAULTSTORE)
- LIST_ENTRY FormListHead; // Form list (FORM_BROWSER_FORM)
-
- LIST_ENTRY OneOfOptionMapListHead; //ONE_OF_OPTION_MAP
-
- UINT16 MaxQuestionId;
-
- //
- // Added for Framework HII Thunk.
- // Default Variable Storage built from a Framework VFR file using UEFI VFR Compiler in Compatibility mode is determined
- // by priority rules defined in GetFormsetDefaultVarstoreId (). See the function description for details.
- //
- EFI_VARSTORE_ID DefaultVarStoreId;
- CHAR16 *OriginalDefaultVarStoreName;
-
- UINTN NumberOfStatement;
-
-} FORM_BROWSER_FORMSET;
-
-
-/**
- Parse opcodes in the formset IFR binary.
-
- @param FormSet Pointer of the FormSet data structure.
-
- @retval EFI_SUCCESS Opcode parse success.
- @retval Other Opcode parse fail.
-
-**/
-EFI_STATUS
-ParseOpCodes (
- IN FORM_BROWSER_FORMSET *FormSet
- );
-
-/**
- Free resources allocated for a FormSet
-
- @param FormSet Pointer of the FormSet
-
- @return None.
-
-**/
-VOID
-DestroyFormSet (
- IN OUT FORM_BROWSER_FORMSET *FormSet
- );
-
-#endif
-
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParserExpression.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParserExpression.c
deleted file mode 100644
index 7cab3909fc..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParserExpression.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/** @file
-
-Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-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:
-
- Expression.c
-
-Abstract:
-
- Expression evaluation.
-
-
-**/
-#include <PiDxe.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PrintLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Protocol/UnicodeCollation.h>
-
-#include "UefiIfrParser.h"
-
-//
-// Global stack used to evaluate boolean expresions
-//
-EFI_HII_VALUE *mOpCodeScopeStack = NULL;
-EFI_HII_VALUE *mOpCodeScopeStackEnd = NULL;
-EFI_HII_VALUE *mOpCodeScopeStackPointer = NULL;
-
-EFI_HII_VALUE *mExpressionEvaluationStack = NULL;
-EFI_HII_VALUE *mExpressionEvaluationStackEnd = NULL;
-EFI_HII_VALUE *mExpressionEvaluationStackPointer = NULL;
-
-#define EXPRESSION_STACK_SIZE_INCREMENT 0x100
-
-
-/**
- Grow size of the stack
-
- @param Stack On input: old stack; On output: new stack
- @param StackPtr On input: old stack pointer; On output: new stack
- pointer
- @param StackEnd On input: old stack end; On output: new stack end
-
- @retval EFI_SUCCESS Grow stack success.
- @retval EFI_OUT_OF_RESOURCES No enough memory for stack space.
-
-**/
-EFI_STATUS
-GrowStack (
- IN OUT EFI_HII_VALUE **Stack,
- IN OUT EFI_HII_VALUE **StackPtr,
- IN OUT EFI_HII_VALUE **StackEnd
- )
-{
- UINTN Size;
- EFI_HII_VALUE *NewStack;
-
- Size = EXPRESSION_STACK_SIZE_INCREMENT;
- if (*StackPtr != NULL) {
- Size = Size + (*StackEnd - *Stack);
- }
-
- NewStack = AllocatePool (Size * sizeof (EFI_HII_VALUE));
- if (NewStack == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (*StackPtr != NULL) {
- //
- // Copy from Old Stack to the New Stack
- //
- CopyMem (
- NewStack,
- *Stack,
- (*StackEnd - *Stack) * sizeof (EFI_HII_VALUE)
- );
-
- //
- // Free The Old Stack
- //
- gBS->FreePool (*Stack);
- }
-
- //
- // Make the Stack pointer point to the old data in the new stack
- //
- *StackPtr = NewStack + (*StackPtr - *Stack);
- *Stack = NewStack;
- *StackEnd = NewStack + Size;
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Push an element onto the Boolean Stack
-
- @param Stack On input: old stack; On output: new stack
- @param StackPtr On input: old stack pointer; On output: new stack
- pointer
- @param StackEnd On input: old stack end; On output: new stack end
- @param Data Data to push.
-
- @retval EFI_SUCCESS Push stack success.
-
-**/
-EFI_STATUS
-PushStack (
- IN OUT EFI_HII_VALUE **Stack,
- IN OUT EFI_HII_VALUE **StackPtr,
- IN OUT EFI_HII_VALUE **StackEnd,
- IN EFI_HII_VALUE *Data
- )
-{
- EFI_STATUS Status;
-
- //
- // Check for a stack overflow condition
- //
- if (*StackPtr >= *StackEnd) {
- //
- // Grow the stack
- //
- Status = GrowStack (Stack, StackPtr, StackEnd);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- //
- // Push the item onto the stack
- //
- CopyMem (*StackPtr, Data, sizeof (EFI_HII_VALUE));
- *StackPtr = *StackPtr + 1;
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Pop an element from the stack.
-
- @param Stack On input: old stack; On output: new stack
- @param StackPtr On input: old stack pointer; On output: new stack
- pointer
- @param StackEnd On input: old stack end; On output: new stack end
- @param Data Data to pop.
-
- @retval EFI_SUCCESS The value was popped onto the stack.
- @retval EFI_ACCESS_DENIED The pop operation underflowed the stack
-
-**/
-EFI_STATUS
-PopStack (
- IN OUT EFI_HII_VALUE **Stack,
- IN OUT EFI_HII_VALUE **StackPtr,
- IN OUT EFI_HII_VALUE **StackEnd,
- OUT EFI_HII_VALUE *Data
- )
-{
- //
- // Check for a stack underflow condition
- //
- if (*StackPtr == *Stack) {
- return EFI_ACCESS_DENIED;
- }
-
- //
- // Pop the item off the stack
- //
- *StackPtr = *StackPtr - 1;
- CopyMem (Data, *StackPtr, sizeof (EFI_HII_VALUE));
- return EFI_SUCCESS;
-}
-
-/**
- Reset stack pointer to begin of the stack.
-
-**/
-VOID
-ResetScopeStack (
- VOID
- )
-{
- mOpCodeScopeStackPointer = mOpCodeScopeStack;
-}
-
-
-/**
- Push an Operand onto the Stack
-
- @param Operand Operand to push.
-
- @retval EFI_SUCCESS The value was pushed onto the stack.
- @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
- stack.
-
-**/
-EFI_STATUS
-PushScope (
- IN UINT8 Operand
- )
-{
- EFI_HII_VALUE Data;
-
- Data.Type = EFI_IFR_TYPE_NUM_SIZE_8;
- Data.Value.u8 = Operand;
-
- return PushStack (
- &mOpCodeScopeStack,
- &mOpCodeScopeStackPointer,
- &mOpCodeScopeStackEnd,
- &Data
- );
-}
-
-
-/**
- Pop an Operand from the Stack
-
- @param Operand Operand to pop.
-
- @retval EFI_SUCCESS The value was pushed onto the stack.
- @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
- stack.
-
-**/
-EFI_STATUS
-PopScope (
- OUT UINT8 *Operand
- )
-{
- EFI_STATUS Status;
- EFI_HII_VALUE Data;
-
- Status = PopStack (
- &mOpCodeScopeStack,
- &mOpCodeScopeStackPointer,
- &mOpCodeScopeStackEnd,
- &Data
- );
-
- *Operand = Data.Value.u8;
-
- return Status;
-}
-
-
-/**
- Reset stack pointer to begin of the stack.
-
-**/
-VOID
-ResetExpressionStack (
- VOID
- )
-{
- mExpressionEvaluationStackPointer = mExpressionEvaluationStack;
-}
-
-
-/**
- Push an Expression value onto the Stack
-
- @param Value Expression value to push.
-
- @retval EFI_SUCCESS The value was pushed onto the stack.
- @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
- stack.
-
-**/
-EFI_STATUS
-PushExpression (
- IN EFI_HII_VALUE *Value
- )
-{
- return PushStack (
- &mExpressionEvaluationStack,
- &mExpressionEvaluationStackPointer,
- &mExpressionEvaluationStackEnd,
- Value
- );
-}
-
-
-/**
- Pop an Expression value from the stack.
-
- @param Value Expression value to pop.
-
- @retval EFI_SUCCESS The value was popped onto the stack.
- @retval EFI_ACCESS_DENIED The pop operation underflowed the stack
-
-**/
-EFI_STATUS
-PopExpression (
- OUT EFI_HII_VALUE *Value
- )
-{
- return PopStack (
- &mExpressionEvaluationStack,
- &mExpressionEvaluationStackPointer,
- &mExpressionEvaluationStackEnd,
- Value
- );
-}
-
-/**
- Zero extend integer/boolean/date/time to UINT64 for comparing.
-
- @param Value HII Value to be converted.
-
- @return None.
-
-**/
-VOID
-ExtendValueToU64 (
- IN EFI_HII_VALUE *Value
- )
-{
- UINT64 Temp;
-
- Temp = 0;
- switch (Value->Type) {
- case EFI_IFR_TYPE_NUM_SIZE_8:
- Temp = Value->Value.u8;
- break;
-
- case EFI_IFR_TYPE_NUM_SIZE_16:
- Temp = Value->Value.u16;
- break;
-
- case EFI_IFR_TYPE_NUM_SIZE_32:
- Temp = Value->Value.u32;
- break;
-
- case EFI_IFR_TYPE_BOOLEAN:
- Temp = Value->Value.b;
- break;
-
- case EFI_IFR_TYPE_TIME:
- Temp = Value->Value.u32 & 0xffffff;
- break;
-
- case EFI_IFR_TYPE_DATE:
- Temp = Value->Value.u32;
- break;
-
- default:
- return;
- }
-
- Value->Value.u64 = Temp;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParserExpression.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParserExpression.h
deleted file mode 100644
index c73db92b8e..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParserExpression.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/** @file
- Internal Function and Macro defintions for IFR Expression evaluation used in Ifr Parsing. This header file should only
- be included by UefiIfrParserExpression.c and UefiIfrParser.c
-
- Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-
-#ifndef _HII_THUNK_UEFI_IFR_PARSER_EXPRESSION_
-#define _HII_THUNK_UEFI_IFR_PARSER_EXPRESSION_
-
-/**
- Reset stack pointer to begin of the stack.
-
-**/
-VOID
-ResetScopeStack (
- VOID
- );
-
-/**
- Push an Operand onto the Stack
-
- @param Operand Operand to push.
-
- @retval EFI_SUCCESS The value was pushed onto the stack.
- @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
- stack.
-
-**/
-EFI_STATUS
-PushScope (
- IN UINT8 Operand
- );
-
-
-/**
- Pop an Operand from the Stack
-
- @param Operand Operand to pop.
-
- @retval EFI_SUCCESS The value was pushed onto the stack.
- @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
- stack.
-
-**/
-EFI_STATUS
-PopScope (
- OUT UINT8 *Operand
- );
-
-/**
- Zero extend integer/boolean/date/time to UINT64 for comparing.
-
- @param Value HII Value to be converted.
-
- @return None.
-
-**/
-VOID
-ExtendValueToU64 (
- IN EFI_HII_VALUE *Value
- );
-
-/**
- Compare two Hii value.
-
- @param Value1 Expression value to compare on left-hand
- @param Value2 Expression value to compare on right-hand
- @param HiiHandle Only required for string compare
-
- @retval EFI_INVALID_PARAMETER Could not perform comparation on two values
- @retval 0 Two operators equeal
- @retval 0 Value1 is greater than Value2
- @retval 0 Value1 is less than Value2
-
-**/
-INTN
-CompareHiiValue (
- IN EFI_HII_VALUE *Value1,
- IN EFI_HII_VALUE *Value2,
- IN EFI_HII_HANDLE HiiHandle OPTIONAL
- );
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.c
deleted file mode 100644
index 93cd710569..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.c
+++ /dev/null
@@ -1,891 +0,0 @@
-/** @file
-
- This file contains the keyboard processing code to the HII database.
-
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-
-#include "HiiDatabase.h"
-#include "HiiHandle.h"
-#include <Library/DebugLib.h>
-#include <Guid/ZeroGuid.h>
-
-CONST CHAR16 FrameworkReservedVarstoreName[] = FRAMEWORK_RESERVED_VARSTORE_NAME;
-
-/**
-
- This function returns a list of the package handles of the
- specified type that are currently active in the HII database. The
- pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package
- handles to be listed.
-
- If HandleBufferLength is NULL, then ASSERT.
- If HandleBuffer is NULL, the ASSERT.
- If PackageType is EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is
- NULL, then ASSERT.
- If PackageType is not EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is not
- NULL, then ASSERT.
-
-
- @param PackageType Specifies the package type of the packages
- to list or EFI_HII_PACKAGE_TYPE_ALL for
- all packages to be listed.
-
- @param PackageGuid If PackageType is
- EFI_HII_PACKAGE_TYPE_GUID, then this is
- the pointer to the GUID which must match
- the Guid field of
- EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
- must be NULL.
-
- @param HandleBufferLength On output, the length of the handle buffer
- that is required for the handles found.
-
- @param HandleBuffer On output, an array of EFI_HII_HANDLE instances returned.
- The caller is responcible to free this pointer allocated.
-
- @retval EFI_SUCCESS The matching handles are outputted successfully.
- HandleBufferLength is updated with the actual length.
- @retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operation.
- @retval EFI_NOT_FOUND No matching handle could not be found in database.
-**/
-EFI_STATUS
-EFIAPI
-ListPackageLists (
- IN UINT8 PackageType,
- IN CONST EFI_GUID *PackageGuid,
- IN OUT UINTN *HandleBufferLength,
- OUT EFI_HII_HANDLE **HandleBuffer
- )
-{
- EFI_STATUS Status;
-
- ASSERT (HandleBufferLength != NULL);
- ASSERT (HandleBuffer != NULL);
-
- *HandleBufferLength = 0;
- *HandleBuffer = NULL;
-
- if (PackageType == EFI_HII_PACKAGE_TYPE_GUID) {
- ASSERT (PackageGuid != NULL);
- } else {
- ASSERT (PackageGuid == NULL);
- }
-
- Status = mHiiDatabase->ListPackageLists (
- mHiiDatabase,
- PackageType,
- PackageGuid,
- HandleBufferLength,
- *HandleBuffer
- );
- if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
- //
- // No packages is registered to UEFI HII Database, just return.
- //
- //
- return Status;
- }
-
- *HandleBuffer = AllocateZeroPool (*HandleBufferLength);
-
- if (*HandleBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- return mHiiDatabase->ListPackageLists (
- mHiiDatabase,
- PackageType,
- PackageGuid,
- HandleBufferLength,
- *HandleBuffer
- );
-
-}
-
-/**
- Exports the contents of one or all package lists in the HII database into a buffer.
-
- If Handle is not NULL and not a valid EFI_HII_HANDLE registered in the database,
- then ASSERT.
- If PackageListHeader is NULL, then ASSERT.
- If PackageListSize is NULL, then ASSERT.
-
- @param Handle The HII Handle.
- @param PackageListHeader A pointer to a buffer that will contain the results of
- the export function.
- @param PackageListSize On output, the length of the buffer that is required for the exported data.
-
- @retval EFI_SUCCESS Package exported.
-
- @retval EFI_OUT_OF_RESOURCES Not enought memory to complete the operations.
-
-**/
-EFI_STATUS
-EFIAPI
-ExportPackageLists (
- IN EFI_HII_HANDLE Handle,
- OUT EFI_HII_PACKAGE_LIST_HEADER **PackageListHeader,
- OUT UINTN *PackageListSize
- )
-{
- EFI_STATUS Status;
- UINTN Size;
- EFI_HII_PACKAGE_LIST_HEADER *PackageListHdr;
-
- ASSERT (PackageListSize != NULL);
- ASSERT (PackageListHeader != NULL);
-
- Size = 0;
- PackageListHdr = NULL;
- Status = mHiiDatabase->ExportPackageLists (
- mHiiDatabase,
- Handle,
- &Size,
- PackageListHdr
- );
- ASSERT (Status != EFI_BUFFER_TOO_SMALL);
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
- PackageListHdr = AllocateZeroPool (Size);
-
- if (PackageListHeader == NULL) {
- return EFI_OUT_OF_RESOURCES;
- } else {
- Status = mHiiDatabase->ExportPackageLists (
- mHiiDatabase,
- Handle,
- &Size,
- PackageListHdr
- );
- }
- }
-
- if (!EFI_ERROR (Status)) {
- *PackageListHeader = PackageListHdr;
- *PackageListSize = Size;
- } else {
- FreePool (PackageListHdr);
- }
-
- return Status;
-}
-
-/**
- Extract Hii package list GUID for given HII handle.
-
- If HiiHandle could not be found in the HII database, then ASSERT.
- If Guid is NULL, then ASSERT.
-
- @param Handle Hii handle
- @param Guid Package list GUID
-
- @retval EFI_SUCCESS Successfully extract GUID from Hii database.
-
-**/
-EFI_STATUS
-EFIAPI
-ExtractGuidFromHiiHandle (
- IN EFI_HII_HANDLE Handle,
- OUT EFI_GUID *Guid
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
-
- ASSERT (Guid != NULL);
- ASSERT (Handle != NULL);
-
- //
- // Get HII PackageList
- //
- BufferSize = 0;
- HiiPackageList = NULL;
-
- Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
- ASSERT (Status != EFI_NOT_FOUND);
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
- HiiPackageList = AllocatePool (BufferSize);
- ASSERT (HiiPackageList != NULL);
-
- Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
- }
- if (EFI_ERROR (Status)) {
- FreePool (HiiPackageList);
- return Status;
- }
-
- //
- // Extract GUID
- //
- CopyGuid (Guid, &HiiPackageList->PackageListGuid);
-
- FreePool (HiiPackageList);
-
- return EFI_SUCCESS;
-}
-
-/**
- Find the corressponding UEFI HII Handle from a Framework HII Handle given.
-
- @param Private The HII Thunk Module Private context.
- @param FwHiiHandle The Framemwork HII Handle.
-
- @return NULL If Framework HII Handle is invalid.
- @return The corresponding UEFI HII Handle.
-**/
-EFI_HII_HANDLE
-FwHiiHandleToUefiHiiHandle (
- IN CONST HII_THUNK_PRIVATE_DATA *Private,
- IN FRAMEWORK_EFI_HII_HANDLE FwHiiHandle
- )
-{
- HII_THUNK_CONTEXT *ThunkContext;
-
- ASSERT (FwHiiHandle != (FRAMEWORK_EFI_HII_HANDLE) 0);
- ASSERT (Private != NULL);
-
- ThunkContext = FwHiiHandleToThunkContext (Private, FwHiiHandle);
-
- if (ThunkContext != NULL) {
- return ThunkContext->UefiHiiHandle;
- }
-
- return (EFI_HII_HANDLE) NULL;
-}
-
-
-/**
- Find the corressponding HII Thunk Context from a Framework HII Handle given.
-
- @param Private The HII Thunk Module Private context.
- @param FwHiiHandle The Framemwork HII Handle.
-
- @return NULL If Framework HII Handle is invalid.
- @return The corresponding HII Thunk Context.
-**/
-HII_THUNK_CONTEXT *
-FwHiiHandleToThunkContext (
- IN CONST HII_THUNK_PRIVATE_DATA *Private,
- IN FRAMEWORK_EFI_HII_HANDLE FwHiiHandle
- )
-{
- LIST_ENTRY *Link;
- HII_THUNK_CONTEXT *ThunkContext;
-
-
- Link = GetFirstNode (&Private->ThunkContextListHead);
-
- while (!IsNull (&Private->ThunkContextListHead, Link)) {
- ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
-
- if (FwHiiHandle == ThunkContext->FwHiiHandle) {
- return ThunkContext;
- }
-
- Link = GetNextNode (&Private->ThunkContextListHead, Link);
- }
-
- return NULL;
-}
-
-/**
- Find the corressponding HII Thunk Context from a UEFI HII Handle given.
-
- @param Private The HII Thunk Module Private context.
- @param UefiHiiHandle The UEFI HII Handle.
-
- @return NULL If UEFI HII Handle is invalid.
- @return The corresponding HII Thunk Context.
-**/
-HII_THUNK_CONTEXT *
-UefiHiiHandleToThunkContext (
- IN CONST HII_THUNK_PRIVATE_DATA *Private,
- IN EFI_HII_HANDLE UefiHiiHandle
- )
-{
- LIST_ENTRY *Link;
- HII_THUNK_CONTEXT *ThunkContext;
-
- Link = GetFirstNode (&Private->ThunkContextListHead);
-
- while (!IsNull (&Private->ThunkContextListHead, Link)) {
- ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
-
- if (UefiHiiHandle == ThunkContext->UefiHiiHandle) {
- return ThunkContext;
- }
- Link = GetNextNode (&Private->ThunkContextListHead, Link);
- }
-
- return NULL;
-}
-
-/**
- Find the corressponding HII Thunk Context from a Tag GUID.
-
- @param Private The HII Thunk Module Private context.
- @param Guid The Tag GUID.
-
- @return NULL No HII Thunk Context matched the Tag GUID.
- @return The corresponding HII Thunk Context.
-**/
-HII_THUNK_CONTEXT *
-TagGuidToIfrPackThunkContext (
- IN CONST HII_THUNK_PRIVATE_DATA *Private,
- IN CONST EFI_GUID *Guid
- )
-{
- LIST_ENTRY *Link;
- HII_THUNK_CONTEXT *ThunkContext;
-
- Link = GetFirstNode (&Private->ThunkContextListHead);
-
- while (!IsNull (&Private->ThunkContextListHead, Link)) {
- ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
-
- if (CompareGuid (Guid, &ThunkContext->TagGuid) && (ThunkContext->IfrPackageCount != 0)) {
- return ThunkContext;
- }
-
- Link = GetNextNode (&Private->ThunkContextListHead, Link);
- }
-
- return NULL;
-
-}
-
-/**
- Clean up the HII Thunk Context for a UEFI HII Handle.
-
- @param Private The HII Thunk Module Private context.
- @param UefiHiiHandle The UEFI HII Handle.
-
-**/
-VOID
-DestroyThunkContextForUefiHiiHandle (
- IN HII_THUNK_PRIVATE_DATA *Private,
- IN EFI_HII_HANDLE UefiHiiHandle
- )
-{
- HII_THUNK_CONTEXT *ThunkContext;
-
- ThunkContext = UefiHiiHandleToThunkContext (Private, UefiHiiHandle);
- ASSERT (ThunkContext != NULL);
-
- DestroyThunkContext (ThunkContext);
-}
-
-
-/**
- This function create a HII_THUNK_CONTEXT for the input UEFI HiiHandle
- that is created when a package list registered by a module calling
- EFI_HII_DATABASE_PROTOCOL.NewPackageList.
- This function records the PackageListGuid of EFI_HII_PACKAGE_LIST_HEADER
- into the TagGuid of the created HII_THUNK_CONTEXT.
-
- @param UefiHiiHandle The UEFI HII Handle.
-
- @return the new created Hii thunk context.
-
-**/
-HII_THUNK_CONTEXT *
-CreateThunkContextForUefiHiiHandle (
- IN EFI_HII_HANDLE UefiHiiHandle
- )
-{
- EFI_STATUS Status;
- EFI_GUID PackageGuid;
- HII_THUNK_CONTEXT *ThunkContext;
-
- ThunkContext = AllocateZeroPool (sizeof (*ThunkContext));
- ASSERT (ThunkContext != NULL);
-
- ThunkContext->Signature = HII_THUNK_CONTEXT_SIGNATURE;
-
- Status = AllocateHiiHandle (&ThunkContext->FwHiiHandle);
- if (EFI_ERROR (Status)) {
- return NULL;
- }
-
- ThunkContext->UefiHiiHandle = UefiHiiHandle;
-
- Status = ExtractGuidFromHiiHandle (UefiHiiHandle, &PackageGuid);
- ASSERT_EFI_ERROR (Status);
-
- CopyGuid(&ThunkContext->TagGuid, &PackageGuid);
-
- return ThunkContext;
-}
-
-
-/**
- Get the number of HII Package for a Package type.
-
- @param PackageListHeader The Package List.
- @param PackageType The Package Type.
-
- @return The number of Package for given type.
-**/
-UINTN
-GetPackageCountByType (
- IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader,
- IN UINT8 PackageType
- )
-{
- UINTN Count;
- EFI_HII_PACKAGE_HEADER *PackageHeader;
-
- PackageHeader = (EFI_HII_PACKAGE_HEADER *) ((UINT8 *) PackageListHeader + sizeof (EFI_HII_PACKAGE_LIST_HEADER));
- Count = 0;
-
- while (PackageHeader->Type != EFI_HII_PACKAGE_END) {
- if (PackageHeader->Type == PackageType ) {
- Count++;
- }
- PackageHeader = (EFI_HII_PACKAGE_HEADER *) ((UINT8 *) PackageHeader + PackageHeader->Length);
- }
-
-
- return Count;
-}
-
-/**
- Get the Form Package from a Framework Package List.
-
- @param Packages Framework Package List.
-
- @return The Form Package Header found.
-**/
-EFI_HII_PACKAGE_HEADER *
-GetIfrPackage (
- IN CONST EFI_HII_PACKAGES *Packages
- )
-{
- UINTN Index;
- TIANO_AUTOGEN_PACKAGES_HEADER **TianoAutogenPackageHdrArray;
-
- ASSERT (Packages != NULL);
-
- TianoAutogenPackageHdrArray = (TIANO_AUTOGEN_PACKAGES_HEADER **) (((UINT8 *) &Packages->GuidId) + sizeof (Packages->GuidId));
-
- for (Index = 0; Index < Packages->NumberOfPackages; Index++) {
- //
- // The current UEFI HII build tool generate a binary in the format defined by
- // TIANO_AUTOGEN_PACKAGES_HEADER. We assume that all packages generated in
- // this binary is with same package type. So the returned IfrPackageCount and StringPackageCount
- // may not be the exact number of valid package number in the binary generated
- // by HII Build tool.
- //
- switch (TianoAutogenPackageHdrArray[Index]->FrameworkPackageHeader.Type) {
- case EFI_HII_IFR:
- return &TianoAutogenPackageHdrArray[Index]->PackageHeader;
- break;
- case EFI_HII_STRING:
- case EFI_HII_FONT:
- break;
-
- default:
- ASSERT (FALSE);
- return NULL;
- break;
- }
- }
-
- return NULL;
-}
-
-/**
- Get FormSet GUID.
-
- ASSERT if no FormSet Opcode is found.
-
- @param Packages Form Framework Package.
- @param FormSetGuid Return the FormSet Guid.
-
-**/
-VOID
-GetFormSetGuid (
- IN EFI_HII_PACKAGE_HEADER *Package,
- OUT EFI_GUID *FormSetGuid
- )
-{
- UINTN Offset;
- EFI_IFR_OP_HEADER *OpCode;
- EFI_IFR_FORM_SET *FormSet;
-
- Offset = sizeof (EFI_HII_PACKAGE_HEADER);
- while (Offset < Package->Length) {
- OpCode = (EFI_IFR_OP_HEADER *)((UINT8 *) Package + Offset);
-
- switch (OpCode->OpCode) {
- case EFI_IFR_FORM_SET_OP:
- FormSet = (EFI_IFR_FORM_SET *) OpCode;
- CopyGuid (FormSetGuid, (EFI_GUID *)(VOID *)&FormSet->Guid);
- return;
-
- default:
- break;
-
- }
- Offset += OpCode->Length;
- }
-
- //
- // A proper IFR must have a formset opcode.
- //
- ASSERT (FALSE);
-
-}
-
-/**
- Creat a Thunk Context.
-
- ASSERT if no FormSet Opcode is found.
-
- @param Private The HII Thunk Private Context.
- @param StringPackageCount The String package count.
- @param IfrPackageCount The IFR Package count.
-
- @return A newly created Thunk Context.
- @retval NULL No resource to create a new Thunk Context.
-**/
-HII_THUNK_CONTEXT *
-CreateThunkContext (
- IN HII_THUNK_PRIVATE_DATA *Private,
- IN UINTN StringPackageCount,
- IN UINTN IfrPackageCount
- )
-{
- EFI_STATUS Status;
- HII_THUNK_CONTEXT *ThunkContext;
-
- ThunkContext = AllocateZeroPool (sizeof (HII_THUNK_CONTEXT));
- ASSERT (ThunkContext != NULL);
-
- ThunkContext->Signature = HII_THUNK_CONTEXT_SIGNATURE;
- ThunkContext->IfrPackageCount = IfrPackageCount;
- ThunkContext->StringPackageCount = StringPackageCount;
- Status = AllocateHiiHandle (&ThunkContext->FwHiiHandle);
- if (EFI_ERROR (Status)) {
- return NULL;
- }
-
- return ThunkContext;
-
-}
-
-/**
- Destroy the Thunk Context and free up all resource.
-
- @param ThunkContext The HII Thunk Private Context to be freed.
-
-**/
-VOID
-DestroyThunkContext (
- IN HII_THUNK_CONTEXT *ThunkContext
- )
-{
- ASSERT (ThunkContext != NULL);
-
- FreeHiiHandle (ThunkContext->FwHiiHandle);
-
- RemoveEntryList (&ThunkContext->Link);
-
- if (ThunkContext->FormSet != NULL) {
- DestroyFormSet (ThunkContext->FormSet);
- }
-
- FreePool (ThunkContext);
-}
-
-/**
- Get the FormSet's Default Varstore ID based on the rule (Descending Priority):
-
- 1) If VarStore ID of FRAMEWORK_RESERVED_VARSTORE_ID (0x01) is found, Var Store ID is used.
- 2) If VarStore ID of FRAMEWORK_RESERVED_VARSTORE_ID is not found, First Var Store ID is used
- as the default Var Store ID.
-
- @param FormSet The Form Set. The Default Varstore ID is updated if found.
-
-**/
-VOID
-GetFormsetDefaultVarstoreId (
- IN OUT FORM_BROWSER_FORMSET * FormSet
- )
-{
- LIST_ENTRY *StorageList;
- FORMSET_STORAGE *Storage;
-
- //
- // VarStoreId 0 is invalid in UEFI IFR.
- //
- FormSet->DefaultVarStoreId = 0;
- StorageList = GetFirstNode (&FormSet->StorageListHead);
-
- while (!IsNull (&FormSet->StorageListHead, StorageList)) {
- Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
-
- DEBUG ((EFI_D_INFO, "FormSet %g: Found Varstore ID %x Name %s Size 0x%x\n", &FormSet->Guid, Storage->VarStoreId, Storage->Name, Storage->Size));
-
- if (Storage->VarStoreId == FRAMEWORK_RESERVED_VARSTORE_ID) {
- //
- // 1) If VarStore ID of FRAMEWORK_RESERVED_VARSTORE_ID (0x01) is found, Var Store ID is used.
- //
- FormSet->DefaultVarStoreId = FRAMEWORK_RESERVED_VARSTORE_ID;
- break;
- }
-
- StorageList = GetNextNode (&FormSet->StorageListHead, StorageList);
- }
-
- if (FormSet->DefaultVarStoreId != FRAMEWORK_RESERVED_VARSTORE_ID) {
- //
- //
- // 2) If VarStore ID of FRAMEWORK_RESERVED_VARSTORE_ID is not found, First Var Store ID is used
- // as the default Var Store ID.
- //
- StorageList = GetFirstNode (&FormSet->StorageListHead);
- if (!IsNull (&FormSet->StorageListHead, StorageList)) {
- Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
- FormSet->DefaultVarStoreId = Storage->VarStoreId;
- }
-
- }
-
- if (FormSet->DefaultVarStoreId == 0) {
- DEBUG ((EFI_D_INFO, "FormSet %g: No Varstore Found\n", &FormSet->Guid));
- }
-
- return;
-}
-
-/**
- Fetch the Ifr binary data of a FormSet.
-
- @param Handle PackageList Handle
- @param FormSetGuid GUID of a formset. If not specified (NULL or zero
- GUID), take the first FormSet found in package
- list.
- @param BinaryLength The length of the FormSet IFR binary.
- @param BinaryData The buffer designed to receive the FormSet.
-
- @retval EFI_SUCCESS Buffer filled with the requested FormSet.
- BufferLength was updated.
- @retval EFI_INVALID_PARAMETER The handle is unknown.
- @retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot
- be found with the requested FormId.
-
-**/
-EFI_STATUS
-GetIfrBinaryData (
- IN EFI_HII_HANDLE Handle,
- IN OUT EFI_GUID *FormSetGuid,
- OUT UINTN *BinaryLength,
- OUT UINT8 **BinaryData
- )
-{
- EFI_STATUS Status;
- EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
- UINTN BufferSize;
- UINT8 *Package;
- UINT8 *OpCodeData;
- UINT32 Offset;
- UINT32 Offset2;
- BOOLEAN ReturnDefault;
- UINT32 PackageListLength;
- EFI_HII_PACKAGE_HEADER PackageHeader;
-
- OpCodeData = NULL;
- Package = NULL;
- ZeroMem (&PackageHeader, sizeof (EFI_HII_PACKAGE_HEADER));;
-
- //
- // if FormSetGuid is NULL or zero GUID, return first FormSet in the package list
- //
- if (FormSetGuid == NULL || CompareGuid (FormSetGuid, &gZeroGuid)) {
- ReturnDefault = TRUE;
- } else {
- ReturnDefault = FALSE;
- }
-
- //
- // Get HII PackageList
- //
- BufferSize = 0;
- HiiPackageList = NULL;
- Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
- if (Status == EFI_BUFFER_TOO_SMALL) {
- HiiPackageList = AllocatePool (BufferSize);
- ASSERT (HiiPackageList != NULL);
-
- Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
- }
- if (EFI_ERROR (Status) || HiiPackageList == NULL) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Get Form package from this HII package List
- //
- Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
- Offset2 = 0;
- CopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32));
-
- while (Offset < PackageListLength) {
- Package = ((UINT8 *) HiiPackageList) + Offset;
- CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
-
- if (PackageHeader.Type == EFI_HII_PACKAGE_FORMS) {
- //
- // Search FormSet in this Form Package
- //
- Offset2 = sizeof (EFI_HII_PACKAGE_HEADER);
- while (Offset2 < PackageHeader.Length) {
- OpCodeData = Package + Offset2;
-
- if (((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_FORM_SET_OP) {
- //
- // Check whether return default FormSet
- //
- if (ReturnDefault) {
- break;
- }
-
- //
- // FormSet GUID is specified, check it
- //
- if (CompareGuid (FormSetGuid, (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER)))) {
- break;
- }
- }
-
- Offset2 += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
- }
-
- if (Offset2 < PackageHeader.Length) {
- //
- // Target formset found
- //
- break;
- }
- }
-
- Offset += PackageHeader.Length;
- }
-
- if (Offset >= PackageListLength) {
- //
- // Form package not found in this Package List
- //
- gBS->FreePool (HiiPackageList);
- return EFI_NOT_FOUND;
- }
-
- if (ReturnDefault && FormSetGuid != NULL) {
- //
- // Return the default FormSet GUID
- //
- CopyMem (FormSetGuid, &((EFI_IFR_FORM_SET *) OpCodeData)->Guid, sizeof (EFI_GUID));
- }
-
- //
- // To determine the length of a whole FormSet IFR binary, one have to parse all the Opcodes
- // in this FormSet; So, here just simply copy the data from start of a FormSet to the end
- // of the Form Package.
- //
- *BinaryLength = PackageHeader.Length - Offset2;
- *BinaryData = AllocateCopyPool (*BinaryLength, OpCodeData);
-
- gBS->FreePool (HiiPackageList);
-
- if (*BinaryData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Initialize the internal data structure of a FormSet.
-
- @param Handle PackageList Handle
- @param FormSetGuid GUID of a formset. If not specified (NULL or zero
- GUID), take the first FormSet found in package
- list.
- @param FormSet FormSet data structure.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_NOT_FOUND The specified FormSet could not be found.
-
-**/
-EFI_STATUS
-InitializeFormSet (
- IN EFI_HII_HANDLE Handle,
- IN OUT EFI_GUID *FormSetGuid,
- OUT FORM_BROWSER_FORMSET *FormSet
- )
-{
- EFI_STATUS Status;
-
- Status = GetIfrBinaryData (Handle, FormSetGuid, &FormSet->IfrBinaryLength, &FormSet->IfrBinaryData);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- FormSet->HiiHandle = Handle;
- CopyMem (&FormSet->Guid, FormSetGuid, sizeof (EFI_GUID));
-
- //
- // Parse the IFR binary OpCodes
- //
- Status = ParseOpCodes (FormSet);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- GetFormsetDefaultVarstoreId (FormSet);
- return Status;
-}
-
-/**
- Parse the Form Package and build a FORM_BROWSER_FORMSET structure.
-
- @param UefiHiiHandle PackageList Handle
-
- @return A pointer to FORM_BROWSER_FORMSET.
-
-**/
-FORM_BROWSER_FORMSET *
-ParseFormSet (
- IN EFI_HII_HANDLE UefiHiiHandle
- )
-{
- FORM_BROWSER_FORMSET *FormSet;
- EFI_GUID FormSetGuid;
- EFI_STATUS Status;
-
- FormSet = AllocateZeroPool (sizeof (FORM_BROWSER_FORMSET));
- ASSERT (FormSet != NULL);
-
- CopyGuid (&FormSetGuid, &gZeroGuid);
- Status = InitializeFormSet (UefiHiiHandle, &FormSetGuid, FormSet);
- if (EFI_ERROR (Status)) {
- FreePool (FormSet);
- return NULL;
- }
-
- return FormSet;
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.h
deleted file mode 100644
index 551c4bf27a..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.h
+++ /dev/null
@@ -1,287 +0,0 @@
-/** @file
-
- This file contains utility functions by HII Thunk Modules.
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#ifndef _HII_THUNK_UTILITY_H_
-#define _HII_THUNK_UTILITY_H_
-
-/**
-
- This function returns a list of the package handles of the
- specified type that are currently active in the HII database. The
- pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package
- handles to be listed.
-
- If HandleBufferLength is NULL, then ASSERT.
- If HandleBuffer is NULL, the ASSERT.
- If PackageType is EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is
- NULL, then ASSERT.
- If PackageType is not EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is not
- NULL, then ASSERT.
-
-
- @param PackageType Specifies the package type of the packages
- to list or EFI_HII_PACKAGE_TYPE_ALL for
- all packages to be listed.
-
- @param PackageGuid If PackageType is
- EFI_HII_PACKAGE_TYPE_GUID, then this is
- the pointer to the GUID which must match
- the Guid field of
- EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
- must be NULL.
-
- @param HandleBufferLength On output, the length of the handle buffer
- that is required for the handles found.
-
- @param HandleBuffer On output, an array of EFI_HII_HANDLE instances returned.
- The caller is responcible to free this pointer allocated.
-
- @retval EFI_SUCCESS The matching handles are outputted successfully.
- HandleBufferLength is updated with the actual length.
- @retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operation.
- @retval EFI_NOT_FOUND No matching handle could not be found in database.
-**/
-EFI_STATUS
-EFIAPI
-ListPackageLists (
- IN UINT8 PackageType,
- IN CONST EFI_GUID *PackageGuid,
- IN OUT UINTN *HandleBufferLength,
- OUT EFI_HII_HANDLE **HandleBuffer
- )
-;
-
-/**
- Exports the contents of one or all package lists in the HII database into a buffer.
-
- If Handle is not NULL and not a valid EFI_HII_HANDLE registered in the database,
- then ASSERT.
- If PackageListHeader is NULL, then ASSERT.
- If PackageListSize is NULL, then ASSERT.
-
- @param Handle The HII Handle.
- @param PackageListHeader A pointer to a buffer that will contain the results of
- the export function.
- @param PackageListSize On output, the length of the buffer that is required for the exported data.
-
- @retval EFI_SUCCESS Package exported.
-
- @retval EFI_OUT_OF_RESOURCES Not enought memory to complete the operations.
-
-**/
-EFI_STATUS
-EFIAPI
-ExportPackageLists (
- IN EFI_HII_HANDLE Handle,
- OUT EFI_HII_PACKAGE_LIST_HEADER **PackageListHeader,
- OUT UINTN *PackageListSize
- )
-;
-
-/**
- Extract Hii package list GUID for given HII handle.
-
- If HiiHandle could not be found in the HII database, then ASSERT.
- If Guid is NULL, then ASSERT.
-
- @param Handle Hii handle
- @param Guid Package list GUID
-
- @retval EFI_SUCCESS Successfully extract GUID from Hii database.
-
-**/
-EFI_STATUS
-EFIAPI
-ExtractGuidFromHiiHandle (
- IN EFI_HII_HANDLE Handle,
- OUT EFI_GUID *Guid
- )
-;
-
-/**
- Find the corressponding UEFI HII Handle from a Framework HII Handle given.
-
- @param Private The HII Thunk Module Private context.
- @param FwHiiHandle The Framemwork HII Handle.
-
- @return NULL If Framework HII Handle is invalid.
- @return The corresponding UEFI HII Handle.
-**/
-EFI_HII_HANDLE
-FwHiiHandleToUefiHiiHandle (
- IN CONST HII_THUNK_PRIVATE_DATA *Private,
- IN FRAMEWORK_EFI_HII_HANDLE FwHiiHandle
- );
-
-/**
- Find the corressponding HII Thunk Context from a Framework HII Handle given.
-
- @param Private The HII Thunk Module Private context.
- @param FwHiiHandle The Framemwork HII Handle.
-
- @return NULL If Framework HII Handle is invalid.
- @return The corresponding HII Thunk Context.
-**/
-HII_THUNK_CONTEXT *
-FwHiiHandleToThunkContext (
- IN CONST HII_THUNK_PRIVATE_DATA *Private,
- IN FRAMEWORK_EFI_HII_HANDLE FwHiiHandle
- );
-
-/**
- Find the corressponding HII Thunk Context from a UEFI HII Handle given.
-
- @param Private The HII Thunk Module Private context.
- @param UefiHiiHandle The UEFI HII Handle.
-
- @return NULL If UEFI HII Handle is invalid.
- @return The corresponding HII Thunk Context.
-**/
-HII_THUNK_CONTEXT *
-UefiHiiHandleToThunkContext (
- IN CONST HII_THUNK_PRIVATE_DATA *Private,
- IN EFI_HII_HANDLE UefiHiiHandle
- );
-
-/**
- Find the corressponding HII Thunk Context from a Tag GUID.
-
- @param Private The HII Thunk Module Private context.
- @param Guid The Tag GUID.
-
- @return NULL No HII Thunk Context matched the Tag GUID.
- @return The corresponding HII Thunk Context.
-**/
-HII_THUNK_CONTEXT *
-TagGuidToIfrPackThunkContext (
- IN CONST HII_THUNK_PRIVATE_DATA *Private,
- IN CONST EFI_GUID *Guid
- );
-
-/**
- This function create a HII_THUNK_CONTEXT for the input UEFI HiiHandle
- that is created when a package list registered by a module calling
- EFI_HII_DATABASE_PROTOCOL.NewPackageList.
- This function records the PackageListGuid of EFI_HII_PACKAGE_LIST_HEADER
- into the TagGuid of the created HII_THUNK_CONTEXT.
-
- @param UefiHiiHandle The UEFI HII Handle.
-
- @return the new created Hii thunk context.
-
-**/
-HII_THUNK_CONTEXT *
-CreateThunkContextForUefiHiiHandle (
- IN EFI_HII_HANDLE UefiHiiHandle
- );
-
-/**
- Clean up the HII Thunk Context for a UEFI HII Handle.
-
- @param Private The HII Thunk Module Private context.
- @param UefiHiiHandle The UEFI HII Handle.
-
-**/
-VOID
-DestroyThunkContextForUefiHiiHandle (
- IN HII_THUNK_PRIVATE_DATA *Private,
- IN EFI_HII_HANDLE UefiHiiHandle
- );
-
-/**
- Get the number of HII Package for a Package type.
-
- @param PackageListHeader The Package List.
- @param PackageType The Package Type.
-
- @return The number of Package for given type.
-**/
-UINTN
-GetPackageCountByType (
- IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader,
- IN UINT8 PackageType
- );
-
-/**
- Creat a Thunk Context.
-
- ASSERT if no FormSet Opcode is found.
-
- @param Private The HII Thunk Private Context.
- @param StringPackageCount The String package count.
- @param IfrPackageCount The IFR Package count.
-
- @return A newly created Thunk Context.
- @retval NULL No resource to create a new Thunk Context.
-**/
-HII_THUNK_CONTEXT *
-CreateThunkContext (
- IN HII_THUNK_PRIVATE_DATA *Private,
- IN UINTN StringPackageCount,
- IN UINTN IfrPackageCount
- );
-
-/**
- Destroy the Thunk Context and free up all resource.
-
- @param ThunkContext The HII Thunk Private Context to be freed.
-
-**/
-VOID
-DestroyThunkContext (
- IN HII_THUNK_CONTEXT *ThunkContext
- );
-
-/**
- Get FormSet GUID.
-
- ASSERT if no FormSet Opcode is found.
-
- @param Packages Form Framework Package.
- @param FormSetGuid Return the FormSet Guid.
-
-**/
-VOID
-GetFormSetGuid (
- IN EFI_HII_PACKAGE_HEADER *Package,
- OUT EFI_GUID *FormSetGuid
- );
-
-/**
- Get the Form Package from a Framework Package List.
-
- @param Packages Framework Package List.
-
- @return The Form Package Header found.
-**/
-EFI_HII_PACKAGE_HEADER *
-GetIfrPackage (
- IN CONST EFI_HII_PACKAGES *Packages
- );
-
-/**
- Parse the Form Package and build a FORM_BROWSER_FORMSET structure.
-
- @param UefiHiiHandle PackageList Handle
-
- @return A pointer to FORM_BROWSER_FORMSET.
-
-**/
-FORM_BROWSER_FORMSET *
-ParseFormSet (
- IN EFI_HII_HANDLE UefiHiiHandle
- );
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk.c b/EdkCompatibilityPkg/Compatibility/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk.c
deleted file mode 100644
index ba4e99ddbb..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/** @file
- Framework SMM Status Code Protocol on PI SMM Status Code Protocol Thunk.
-
- This thunk driver locates PI SMM Status Code Protocol in the SMM protocol database and
- installs it in the UEFI protocol database.
-
- Note that Framework SMM Status Code Protocol and PI SMM Status Code Protocol have identical protocol
- GUID and interface structure, but they are in different handle databases.
-
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials are licensed and made available under
- the terms and conditions of the BSD License that 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.
-
-**/
-
-#include <PiSmm.h>
-
-#include <Protocol/SmmStatusCode.h>
-
-#include <Library/DebugLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/SmmServicesTableLib.h>
-
-/**
- Entry point of this thunk driver.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-SmmStatusCodeThunkMain (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- EFI_SMM_STATUS_CODE_PROTOCOL *SmmStatusCode;
-
- //
- // Locate the PI SMM Status Code Protocol in the SMM protocol database.
- //
- Status = gSmst->SmmLocateProtocol (
- &gEfiSmmStatusCodeProtocolGuid,
- NULL,
- (VOID **)&SmmStatusCode
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Install the PI SMM Status Code Protocol into the UEFI protocol database.
- //
- Handle = NULL;
- Status = SystemTable->BootServices->InstallProtocolInterface (
- &Handle,
- &gEfiSmmStatusCodeProtocolGuid,
- EFI_NATIVE_INTERFACE,
- SmmStatusCode
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk.inf b/EdkCompatibilityPkg/Compatibility/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk.inf
deleted file mode 100644
index 5a666a009b..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk/FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk.inf
+++ /dev/null
@@ -1,48 +0,0 @@
-## @file
-# Framework SMM Status Code Protocol on PI SMM Status Code Protocol Thunk driver.
-#
-# Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk
- FILE_GUID = 88B49226-A63F-4505-9D3C-B5A67B846133
- MODULE_TYPE = DXE_SMM_DRIVER
- PI_SPECIFICATION_VERSION = 0x0001000A
- VERSION_STRING = 1.0
- ENTRY_POINT = SmmStatusCodeThunkMain
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- FrameworkSmmStatusCodeOnPiSmmStatusCodeThunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- SmmServicesTableLib
- DebugLib
- BaseLib
-
-[Protocols]
- gEfiSmmStatusCodeProtocolGuid ## PRODUCES/CONSUMES
-
-[Depex]
- gEfiSmmStatusCodeProtocolGuid
-
diff --git a/EdkCompatibilityPkg/Compatibility/Fv2OnFvThunk/Fv2OnFvThunk.c b/EdkCompatibilityPkg/Compatibility/Fv2OnFvThunk/Fv2OnFvThunk.c
deleted file mode 100644
index 64b7df79e5..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Fv2OnFvThunk/Fv2OnFvThunk.c
+++ /dev/null
@@ -1,1543 +0,0 @@
-/** @file
-Module produce FV2 on top of FV.
-
-UEFI PI specification supersedes Inte's Framework Specification.
-EFI_FIRMWARE_VOLUME_PROTOCOL defined in Intel Framework Pkg is replaced by
-EFI_FIRMWARE_VOLUME2_PROTOCOL in MdePkg.
-This module produces FV2 on top of FV. This module is used on platform when both of
-these two conditions are true:
-1) Framework module producing FV is present
-2) And the rest of modules on the platform consume FV2
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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:
-
-**/
-
-#include <PiDxe.h>
-#include <Protocol/FirmwareVolume2.h>
-#include <Protocol/FirmwareVolume.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-/**
-
- Because of constraints imposed by the underlying firmware
- storage, an instance of the Firmware Volume Protocol may not
- be to able to support all possible variations of this
- architecture. These constraints and the current state of the
- firmware volume are exposed to the caller using the
- GetVolumeAttributes() function. GetVolumeAttributes() is
- callable only from TPL_NOTIFY and below. Behavior of
- GetVolumeAttributes() at any EFI_TPL above TPL_NOTIFY is
- undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI
- 2.0 specification.
-
- @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance.
-
- @param FvAttributes Pointer to an EFI_FV_ATTRIBUTES in which
- the attributes and current settings are
- returned.
-
-
- @retval EFI_SUCCESS The firmware volume attributes were
- returned.
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2GetVolumeAttributes (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- OUT EFI_FV_ATTRIBUTES *FvAttributes
- );
-
-
-/**
- The SetVolumeAttributes() function is used to set configurable
- firmware volume attributes. Only EFI_FV_READ_STATUS,
- EFI_FV_WRITE_STATUS, and EFI_FV_LOCK_STATUS may be modified, and
- then only in accordance with the declared capabilities. All
- other bits of FvAttributes are ignored on input. On successful
- return, all bits of *FvAttributes are valid and it contains the
- completed EFI_FV_ATTRIBUTES for the volume. To modify an
- attribute, the corresponding status bit in the EFI_FV_ATTRIBUTES
- is set to the desired value on input. The EFI_FV_LOCK_STATUS bit
- does not affect the ability to read or write the firmware
- volume. Rather, once the EFI_FV_LOCK_STATUS bit is set, it
- prevents further modification to all the attribute bits.
- SetVolumeAttributes() is callable only from TPL_NOTIFY and
- below. Behavior of SetVolumeAttributes() at any EFI_TPL above
- TPL_NOTIFY is undefined. Type EFI_TPL is defined in
- RaiseTPL() in the UEFI 2.0 specification.
-
-
- @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance.
-
- @param FvAttributes On input, FvAttributes is a pointer to
- an EFI_FV_ATTRIBUTES containing the
- desired firmware volume settings. On
- successful return, it contains the new
- settings of the firmware volume. On
- unsuccessful return, FvAttributes is not
- modified and the firmware volume
- settings are not changed.
-
- @retval EFI_SUCCESS The requested firmware volume attributes
- were set and the resulting
- EFI_FV_ATTRIBUTES is returned in
- FvAttributes.
-
- @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS
- is set to 1 on input, but the
- device does not support enabling
- reads
- (FvAttributes:EFI_FV_READ_ENABLE
- is clear on return from
- GetVolumeAttributes()). Actual
- volume attributes are unchanged.
-
- @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS
- is cleared to 0 on input, but
- the device does not support
- disabling reads
- (FvAttributes:EFI_FV_READ_DISABL
- is clear on return from
- GetVolumeAttributes()). Actual
- volume attributes are unchanged.
-
- @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS
- is set to 1 on input, but the
- device does not support enabling
- writes
- (FvAttributes:EFI_FV_WRITE_ENABL
- is clear on return from
- GetVolumeAttributes()). Actual
- volume attributes are unchanged.
-
- @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS
- is cleared to 0 on input, but
- the device does not support
- disabling writes
- (FvAttributes:EFI_FV_WRITE_DISAB
- is clear on return from
- GetVolumeAttributes()). Actual
- volume attributes are unchanged.
-
- @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_LOCK_STATUS
- is set on input, but the device
- does not support locking
- (FvAttributes:EFI_FV_LOCK_CAP is
- clear on return from
- GetVolumeAttributes()). Actual
- volume attributes are unchanged.
-
- @retval EFI_ACCESS_DENIED Device is locked and does not
- allow attribute modification
- (FvAttributes:EFI_FV_LOCK_STATUS
- is set on return from
- GetVolumeAttributes()). Actual
- volume attributes are unchanged.
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2SetVolumeAttributes (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN OUT EFI_FV_ATTRIBUTES *FvAttributes
- );
-
-
-/**
- ReadFile() is used to retrieve any file from a firmware volume
- during the DXE phase. The actual binary encoding of the file in
- the firmware volume media may be in any arbitrary format as long
- as it does the following: It is accessed using the Firmware
- Volume Protocol. The image that is returned follows the image
- format defined in Code Definitions: PI Firmware File Format.
- If the input value of Buffer==NULL, it indicates the caller is
- requesting only that the type, attributes, and size of the
- file be returned and that there is no output buffer. In this
- case, the following occurs:
- - BufferSize is returned with the size that is required to
- successfully complete the read.
- - The output parameters FoundType and *FileAttributes are
- returned with valid values.
- - The returned value of *AuthenticationStatus is undefined.
-
- If the input value of Buffer!=NULL, the output buffer is
- specified by a double indirection of the Buffer parameter. The
- input value of *Buffer is used to determine if the output
- buffer is caller allocated or is dynamically allocated by
- ReadFile(). If the input value of *Buffer!=NULL, it indicates
- the output buffer is caller allocated. In this case, the input
- value of *BufferSize indicates the size of the
- caller-allocated output buffer. If the output buffer is not
- large enough to contain the entire requested output, it is
- filled up to the point that the output buffer is exhausted and
- EFI_WARN_BUFFER_TOO_SMALL is returned, and then BufferSize is
- returned with the size required to successfully complete the
- read. All other output parameters are returned with valid
- values. If the input value of *Buffer==NULL, it indicates the
- output buffer is to be allocated by ReadFile(). In this case,
- ReadFile() will allocate an appropriately sized buffer from
- boot services pool memory, which will be returned in Buffer.
- The size of the new buffer is returned in BufferSize and all
- other output parameters are returned with valid values.
- ReadFile() is callable only from TPL_NOTIFY and below.
- Behavior of ReadFile() at any EFI_TPL above TPL_NOTIFY is
- undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI
- 2.0 specification.
-
- @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance.
-
- @param NameGuid Pointer to an EFI_GUID, which is the file
- name. All firmware file names are EFI_GUIDs.
- A single firmware volume must not have two
- valid files with the same file name
- EFI_GUID.
-
- @param Buffer Pointer to a pointer to a buffer in which the
- file contents are returned, not including the
- file header.
- @param BufferSize Pointer to a caller-allocated UINTN. It
- indicates the size of the memory
- represented by Buffer.
-
- @param FoundType Pointer to a caller-allocated
- EFI_FV_FILETYPE.
-
- @param FileAttributes Pointer to a caller-allocated
- EFI_FV_FILE_ATTRIBUTES.
-
- @param AuthenticationStatus Pointer to a caller-allocated
- UINT32 in which the
- authentication status is
- returned.
-
- @retval EFI_SUCCESS The call completed successfully.
-
- @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to
- contain the requested
- output. The buffer is
- filled and the output is
- truncated.
-
- @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.
-
- @retval EFI_NOT_FOUND Name was not found in the firmware
- volume.
-
- @retval EFI_DEVICE_ERROR A hardware error occurred when
- attempting to access the firmware
- volume.
-
- @retval EFI_ACCESS_DENIED The firmware volume is configured to
- isallow reads.
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2ReadFile (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN CONST EFI_GUID *NameGuid,
- IN OUT VOID **Buffer,
- IN OUT UINTN *BufferSize,
- OUT EFI_FV_FILETYPE *FoundType,
- OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,
- OUT UINT32 *AuthenticationStatus
- );
-
-/**
- ReadSection() is used to retrieve a specific section from a file
- within a firmware volume. The section returned is determined
- using a depth-first, left-to-right search algorithm through all
- sections found in the specified file. The output buffer is
- specified by a double indirection of the Buffer parameter.
- The input value of Buffer is used to determine
- if the output buffer is caller allocated or is
- dynamically allocated by ReadSection(). If the input value of
- Buffer!=NULL, it indicates that the output buffer is caller
- allocated. In this case, the input value of *BufferSize
- indicates the size of the caller-allocated output buffer. If
- the output buffer is not large enough to contain the entire
- requested output, it is filled up to the point that the output
- buffer is exhausted and EFI_WARN_BUFFER_TOO_SMALL is returned,
- and then BufferSize is returned with the size that is required
- to successfully complete the read. All other
- output parameters are returned with valid values. If the input
- value of *Buffer==NULL, it indicates the output buffer is to
- be allocated by ReadSection(). In this case, ReadSection()
- will allocate an appropriately sized buffer from boot services
- pool memory, which will be returned in *Buffer. The size of
- the new buffer is returned in *BufferSize and all other output
- parameters are returned with valid values. ReadSection() is
- callable only from TPL_NOTIFY and below. Behavior of
- ReadSection() at any EFI_TPL above TPL_NOTIFY is
- undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI
- 2.0 specification.
-
-
- @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance.
-
- @param NameGuid Pointer to an EFI_GUID, which indicates the
- file name from which the requested section
- will be read.
-
- @param SectionType Indicates the section type to return.
- SectionType in conjunction with
- SectionInstance indicates which section to
- return.
-
- @param SectionInstance Indicates which instance of sections
- with a type of SectionType to return.
- SectionType in conjunction with
- SectionInstance indicates which
- section to return. SectionInstance is
- zero based.
-
- @param Buffer Pointer to a pointer to a buffer in which the
- section contents are returned, not including
- the section header.
-
- @param BufferSize Pointer to a caller-allocated UINTN. It
- indicates the size of the memory
- represented by Buffer.
-
- @param AuthenticationStatus Pointer to a caller-allocated
- UINT32 in which the authentication
- status is returned.
-
-
- @retval EFI_SUCCESS The call completed successfully.
-
- @retval EFI_WARN_BUFFER_TOO_SMALL The caller-allocated
- buffer is too small to
- contain the requested
- output. The buffer is
- filled and the output is
- truncated.
-
- @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.
-
- @retval EFI_NOT_FOUND The requested file was not found in
- the firmware volume. EFI_NOT_FOUND The
- requested section was not found in the
- specified file.
-
- @retval EFI_DEVICE_ERROR A hardware error occurred when
- attempting to access the firmware
- volume.
-
- @retval EFI_ACCESS_DENIED The firmware volume is configured to
- disallow reads. EFI_PROTOCOL_ERROR
- The requested section was not found,
- but the file could not be fully
- parsed because a required
- GUIDED_SECTION_EXTRACTION_PROTOCOL
- was not found. It is possible the
- requested section exists within the
- file and could be successfully
- extracted once the required
- GUIDED_SECTION_EXTRACTION_PROTOCOL
- is published.
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2ReadSection (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN CONST EFI_GUID *NameGuid,
- IN EFI_SECTION_TYPE SectionType,
- IN UINTN SectionInstance,
- IN OUT VOID **Buffer,
- IN OUT UINTN *BufferSize,
- OUT UINT32 *AuthenticationStatus
- );
-
-/**
- WriteFile() is used to write one or more files to a firmware
- volume. Each file to be written is described by an
- EFI_FV_WRITE_FILE_DATA structure. The caller must ensure that
- any required alignment for all files listed in the FileData
- array is compatible with the firmware volume. Firmware volume
- capabilities can be determined using the GetVolumeAttributes()
- call. Similarly, if the WritePolicy is set to
- EFI_FV_RELIABLE_WRITE, the caller must check the firmware volume
- capabilities to ensure EFI_FV_RELIABLE_WRITE is supported by the
- firmware volume. EFI_FV_UNRELIABLE_WRITE must always be
- supported. Writing a file with a size of zero
- (FileData[n].BufferSize == 0) deletes the file from the firmware
- volume if it exists. Deleting a file must be done one at a time.
- Deleting a file as part of a multiple file write is not allowed.
- Platform Initialization Specification VOLUME 3 Shared
- Architectural Elements 84 August 21, 2006 Version 1.0
- WriteFile() is callable only from TPL_NOTIFY and below.
- Behavior of WriteFile() at any EFI_TPL above TPL_NOTIFY is
- undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0
- specification.
-
- @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.
-
- @param NumberOfFiles Indicates the number of elements in the
- array pointed to by FileData.
-
- @param WritePolicy Indicates the level of reliability for the
- write in the event of a power failure or
- other system failure during the write
- operation.
-
- @param FileData Pointer to an array of
- EFI_FV_WRITE_FILE_DATA. Each element of
- FileData[] represents a file to be written.
-
-
- @retval EFI_SUCCESS The write completed successfully.
-
- @retval EFI_OUT_OF_RESOURCES The firmware volume does not
- have enough free space to
- storefile(s).
-
- @retval EFI_DEVICE_ERROR A hardware error occurred when
- attempting to access the firmware volume.
-
- @retval EFI_WRITE_PROTECTED The firmware volume is
- configured to disallow writes.
-
- @retval EFI_NOT_FOUND A delete was requested, but the
- requested file was not found in the
- firmware volume.
-
- @retval EFI_INVALID_PARAMETER A delete was requested with a
- multiple file write.
-
- @retval EFI_INVALID_PARAMETER An unsupported WritePolicy was
- requested.
-
- @retval EFI_INVALID_PARAMETER An unknown file type was
- specified.
-
- @retval EFI_INVALID_PARAMETER A file system specific error
- has occurred.
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2WriteFile (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN UINT32 NumberOfFiles,
- IN EFI_FV_WRITE_POLICY WritePolicy,
- IN EFI_FV_WRITE_FILE_DATA *FileData
- );
-
-/**
- GetNextFile() is the interface that is used to search a firmware
- volume for a particular file. It is called successively until
- the desired file is located or the function returns
- EFI_NOT_FOUND. To filter uninteresting files from the output,
- the type of file to search for may be specified in FileType. For
- example, if *FileType is EFI_FV_FILETYPE_DRIVER, only files of
- this type will be returned in the output. If *FileType is
- EFI_FV_FILETYPE_ALL, no filtering of file types is done. The Key
- parameter is used to indicate a starting point of the search. If
- the buffer *Key is completely initialized to zero, the search
- re-initialized and starts at the beginning. Subsequent calls to
- GetNextFile() must maintain the value of *Key returned by the
- immediately previous call. The actual contents of *Key are
- implementation specific and no semantic content is implied.
- GetNextFile() is callable only from TPL_NOTIFY and below.
- Behavior of GetNextFile() at any EFI_TPL above TPL_NOTIFY is
- undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0
- specification. Status Codes Returned
-
-
- @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance.
-
- @param Key Pointer to a caller-allocated buffer
- that contains implementation-specific data that is
- used to track where to begin the search for the
- next file. The size of the buffer must be at least
- This->KeySize bytes long. To re-initialize the
- search and begin from the beginning of the
- firmware volume, the entire buffer must be cleared
- to zero. Other than clearing the buffer to
- initiate a new search, the caller must not modify
- the data in the buffer between calls to
- GetNextFile().
-
- @param FileType Pointer to a caller-allocated
- EFI_FV_FILETYPE. The GetNextFile() API can
- filter its search for files based on the
- value of the FileType input. A *FileType
- input of EFI_FV_FILETYPE_ALL causes
- GetNextFile() to search for files of all
- types. If a file is found, the file's type
- is returned in FileType. *FileType is not
- modified if no file is found.
-
- @param NameGuid Pointer to a caller-allocated EFI_GUID. If a
- matching file is found, the file's name is
- returned in NameGuid. If no matching file is
- found, *NameGuid is not modified.
-
- @param Attributes Pointer to a caller-allocated
- EFI_FV_FILE_ATTRIBUTES. If a matching file
- is found, the file's attributes are returned
- in Attributes. If no matching file is found,
- Attributes is not modified. Type
- EFI_FV_FILE_ATTRIBUTES is defined in
- ReadFile().
-
- @param Size Pointer to a caller-allocated UINTN. If a
- matching file is found, the file's size is
- returned in *Size. If no matching file is found,
- Size is not modified.
-
- @retval EFI_SUCCESS The output parameters are filled with data
- obtained from the first matching file that
- was found.
-
- @retval FI_NOT_FOUND No files of type FileType were found.
-
-
- @retval EFI_DEVICE_ERROR A hardware error occurred when
- attempting to access the firmware
- volume.
-
- @retval EFI_ACCESS_DENIED The firmware volume is configured to
- disallow reads.
-
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2GetNextFile (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN OUT VOID *Key,
- IN OUT EFI_FV_FILETYPE *FileType,
- OUT EFI_GUID *NameGuid,
- OUT EFI_FV_FILE_ATTRIBUTES *Attributes,
- OUT UINTN *Size
- );
-
-/**
- The GetInfo() function returns information of type
- InformationType for the requested firmware volume. If the volume
- does not support the requested information type, then
- EFI_UNSUPPORTED is returned. If the buffer is not large enough
- to hold the requested structure, EFI_BUFFER_TOO_SMALL is
- returned and the BufferSize is set to the size of buffer that is
- required to make the request. The information types defined by
- this specification are required information types that all file
- systems must support.
-
- @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance that is the file handle the requested
- information is for.
-
- @param InformationType The type identifier for the
- information being requested.
-
- @param BufferSize On input, the size of Buffer. On output,
- the amount of data returned in Buffer. In
- both cases, the size is measured in bytes.
-
- @param Buffer A pointer to the data buffer to return. The
- buffer's type is indicated by InformationType.
-
-
- @retval EFI_SUCCESS The information was retrieved.
-
- @retval EFI_UNSUPPORTED The InformationType is not known.
-
- @retval EFI_NO_MEDIA The device has no medium.
-
- @retval EFI_DEVICE_ERROR The device reported an error.
-
- @retval EFI_VOLUME_CORRUPTED The file system structures are
- corrupted.
-
- @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to
- read the current directory
- entry. BufferSize has been
- updated with the size needed to
- complete the request.
-
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2GetInfo (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN CONST EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- );
-
-/**
-
- The SetInfo() function sets information of type InformationType
- on the requested firmware volume.
-
-
- @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance that is the file handle the information
- is for.
-
- @param InformationType The type identifier for the
- information being set.
-
- @param BufferSize The size, in bytes, of Buffer.
-
- @param Buffer A pointer to the data buffer to write. The
- buffer's type is indicated by InformationType.
-
- @retval EFI_SUCCESS The information was set.
-
- @retval EFI_UNSUPPORTED The InformationType is not known.
-
- @retval EFI_NO_MEDIA The device has no medium.
-
- @retval EFI_DEVICE_ERROR The device reported an error.
-
- @retval EFI_VOLUME_CORRUPTED The file system structures are
- corrupted.
-
-
- @retval EFI_WRITE_PROTECTED The media is read only.
-
- @retval EFI_VOLUME_FULL The volume is full.
-
- @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the
- size of the type indicated by
- InformationType.
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2SetInfo (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN CONST EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN CONST VOID *Buffer
- );
-
-//
-//
-//
-#define FIRMWARE_VOLUME2_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('f', 'v', '2', 't')
-
-typedef struct {
- UINTN Signature;
- EFI_FIRMWARE_VOLUME2_PROTOCOL FirmwareVolume2;
- EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume;
-} FIRMWARE_VOLUME2_PRIVATE_DATA;
-
-#define FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS(a) CR (a, FIRMWARE_VOLUME2_PRIVATE_DATA, FirmwareVolume2, FIRMWARE_VOLUME2_PRIVATE_DATA_SIGNATURE)
-
-//
-// Firmware Volume Protocol template
-//
-EFI_EVENT mFv2Registration;
-
-FIRMWARE_VOLUME2_PRIVATE_DATA gFirmwareVolume2PrivateDataTemplate = {
- FIRMWARE_VOLUME2_PRIVATE_DATA_SIGNATURE,
- {
- Fv2GetVolumeAttributes,
- Fv2SetVolumeAttributes,
- Fv2ReadFile,
- Fv2ReadSection,
- Fv2WriteFile,
- Fv2GetNextFile,
- 0,
- NULL,
- Fv2GetInfo,
- Fv2SetInfo
- },
- NULL
-};
-
-//
-// Module globals
-//
-/**
- This notification function is invoked when an instance of the
- EFI_FIRMWARE_VOLUME_PROTOCOL is produced. It installs another instance of the
- EFI_FIRMWARE_VOLUME2_PROTOCOL on the same handle.
-
- @param Event The event that occured
- @param Context Context of event. Not used in this nofication function.
-
-**/
-VOID
-EFIAPI
-Fv2NotificationEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HANDLE Handle;
- FIRMWARE_VOLUME2_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
-
- while (TRUE) {
- BufferSize = sizeof (Handle);
- Status = gBS->LocateHandle (
- ByRegisterNotify,
- &gEfiFirmwareVolumeProtocolGuid,
- mFv2Registration,
- &BufferSize,
- &Handle
- );
- if (EFI_ERROR (Status)) {
- //
- // Exit Path of While Loop....
- //
- break;
- }
-
- //
- // Skip this handle if the Firmware Volume Protocol is already installed
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiFirmwareVolume2ProtocolGuid,
- (VOID **)&FirmwareVolume2
- );
- if (!EFI_ERROR (Status)) {
- continue;
- }
-
- //
- // Allocate private data structure
- //
- Private = AllocateCopyPool (sizeof (FIRMWARE_VOLUME2_PRIVATE_DATA), &gFirmwareVolume2PrivateDataTemplate);
- if (Private == NULL) {
- continue;
- }
-
- //
- // Retrieve the Firmware Volume2 Protocol
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiFirmwareVolumeProtocolGuid,
- (VOID **)&Private->FirmwareVolume
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Fill in rest of private data structure
- //
- Private->FirmwareVolume2.KeySize = Private->FirmwareVolume->KeySize;
- Private->FirmwareVolume2.ParentHandle = Private->FirmwareVolume->ParentHandle;
-
- //
- // Install Firmware Volume Protocol onto same handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiFirmwareVolume2ProtocolGuid,
- &Private->FirmwareVolume2,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- }
-}
-
-
-/**
- The user Entry Point for DXE driver. The user code starts with this function
- as the real entry point for the image goes into a library that calls this
- function.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @retval other Some error occurs when executing this entry point.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeFirmwareVolume (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EfiCreateProtocolNotifyEvent (
- &gEfiFirmwareVolumeProtocolGuid,
- TPL_CALLBACK,
- Fv2NotificationEvent,
- NULL,
- &mFv2Registration
- );
- return EFI_SUCCESS;
-}
-
-/**
- Convert FV attributes defined in Framework Specification
- to FV attributes defined in PI specification.
-
- @param FvAttributes The FV attributes defined in Framework Specification.
-
- @retval The FV attributes defined in PI Specification.
-**/
-EFI_FV_ATTRIBUTES
-FvAttributesToFv2Attributes (
- EFI_FV_ATTRIBUTES FvAttributes
- )
-{
- INTN Alignment;
-
- Alignment = LowBitSet64 (RShiftU64 (FvAttributes, 16) & 0xffff);
- if (Alignment != -1) {
- Alignment = Alignment << 16;
- } else {
- Alignment = 0;
- }
- FvAttributes = (FvAttributes & 0x1ff) | Alignment;
-
- return FvAttributes;
-}
-
-/**
-
- Because of constraints imposed by the underlying firmware
- storage, an instance of the Firmware Volume Protocol may not
- be to able to support all possible variations of this
- architecture. These constraints and the current state of the
- firmware volume are exposed to the caller using the
- GetVolumeAttributes() function. GetVolumeAttributes() is
- callable only from TPL_NOTIFY and below. Behavior of
- GetVolumeAttributes() at any EFI_TPL above TPL_NOTIFY is
- undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI
- 2.0 specification.
-
- @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance.
-
- @param FvAttributes Pointer to an EFI_FV_ATTRIBUTES in which
- the attributes and current settings are
- returned.
-
-
- @retval EFI_SUCCESS The firmware volume attributes were
- returned.
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2GetVolumeAttributes (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- OUT EFI_FV_ATTRIBUTES *FvAttributes
- )
-{
- EFI_STATUS Status;
- FIRMWARE_VOLUME2_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume;
-
- Private = FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS (This);
- FirmwareVolume = Private->FirmwareVolume;
- Status = FirmwareVolume->GetVolumeAttributes (
- FirmwareVolume,
- (FRAMEWORK_EFI_FV_ATTRIBUTES *)FvAttributes
- );
- if (!EFI_ERROR (Status)) {
- *FvAttributes = FvAttributesToFv2Attributes (*FvAttributes);
- }
- return Status;
-}
-
-/**
- The SetVolumeAttributes() function is used to set configurable
- firmware volume attributes. Only EFI_FV_READ_STATUS,
- EFI_FV_WRITE_STATUS, and EFI_FV_LOCK_STATUS may be modified, and
- then only in accordance with the declared capabilities. All
- other bits of FvAttributes are ignored on input. On successful
- return, all bits of *FvAttributes are valid and it contains the
- completed EFI_FV_ATTRIBUTES for the volume. To modify an
- attribute, the corresponding status bit in the EFI_FV_ATTRIBUTES
- is set to the desired value on input. The EFI_FV_LOCK_STATUS bit
- does not affect the ability to read or write the firmware
- volume. Rather, once the EFI_FV_LOCK_STATUS bit is set, it
- prevents further modification to all the attribute bits.
- SetVolumeAttributes() is callable only from TPL_NOTIFY and
- below. Behavior of SetVolumeAttributes() at any EFI_TPL above
- TPL_NOTIFY is undefined. Type EFI_TPL is defined in
- RaiseTPL() in the UEFI 2.0 specification.
-
-
- @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance.
-
- @param FvAttributes On input, FvAttributes is a pointer to
- an EFI_FV_ATTRIBUTES containing the
- desired firmware volume settings. On
- successful return, it contains the new
- settings of the firmware volume. On
- unsuccessful return, FvAttributes is not
- modified and the firmware volume
- settings are not changed.
-
- @retval EFI_SUCCESS The requested firmware volume attributes
- were set and the resulting
- EFI_FV_ATTRIBUTES is returned in
- FvAttributes.
-
- @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS
- is set to 1 on input, but the
- device does not support enabling
- reads
- (FvAttributes:EFI_FV_READ_ENABLE
- is clear on return from
- GetVolumeAttributes()). Actual
- volume attributes are unchanged.
-
- @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS
- is cleared to 0 on input, but
- the device does not support
- disabling reads
- (FvAttributes:EFI_FV_READ_DISABL
- is clear on return from
- GetVolumeAttributes()). Actual
- volume attributes are unchanged.
-
- @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS
- is set to 1 on input, but the
- device does not support enabling
- writes
- (FvAttributes:EFI_FV_WRITE_ENABL
- is clear on return from
- GetVolumeAttributes()). Actual
- volume attributes are unchanged.
-
- @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS
- is cleared to 0 on input, but
- the device does not support
- disabling writes
- (FvAttributes:EFI_FV_WRITE_DISAB
- is clear on return from
- GetVolumeAttributes()). Actual
- volume attributes are unchanged.
-
- @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_LOCK_STATUS
- is set on input, but the device
- does not support locking
- (FvAttributes:EFI_FV_LOCK_CAP is
- clear on return from
- GetVolumeAttributes()). Actual
- volume attributes are unchanged.
-
- @retval EFI_ACCESS_DENIED Device is locked and does not
- allow attribute modification
- (FvAttributes:EFI_FV_LOCK_STATUS
- is set on return from
- GetVolumeAttributes()). Actual
- volume attributes are unchanged.
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2SetVolumeAttributes (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN OUT EFI_FV_ATTRIBUTES *FvAttributes
- )
-{
- FIRMWARE_VOLUME2_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume;
- FRAMEWORK_EFI_FV_ATTRIBUTES FrameworkFvAttributes;
- EFI_STATUS Status;
- UINTN Shift;
-
- if ((*FvAttributes & (EFI_FV2_READ_LOCK_STATUS | EFI_FV2_WRITE_LOCK_STATUS)) != 0) {
- //
- // Framework FV protocol does not support EFI_FV2_READ_LOCK_* | EFI_FV2_WRITE_LOCK_*
- //
- return EFI_INVALID_PARAMETER;
- }
-
- *FvAttributes = *FvAttributes & (EFI_FV2_READ_STATUS | EFI_FV2_WRITE_STATUS | EFI_FV2_LOCK_STATUS);
-
- Private = FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS (This);
- FirmwareVolume = Private->FirmwareVolume;
-
- FrameworkFvAttributes = (*FvAttributes & 0x1ff);
- Shift = (UINTN) RShiftU64(*FvAttributes & EFI_FV2_ALIGNMENT, 16);
- FrameworkFvAttributes = FrameworkFvAttributes | LShiftU64 (EFI_FV_ALIGNMENT_2, Shift);
-
- Status = FirmwareVolume->SetVolumeAttributes (
- FirmwareVolume,
- &FrameworkFvAttributes
- );
-
- if (!EFI_ERROR (Status)) {
- *FvAttributes = FvAttributesToFv2Attributes (FrameworkFvAttributes);
- }
-
- return Status;
-}
-
-/**
- ReadFile() is used to retrieve any file from a firmware volume
- during the DXE phase. The actual binary encoding of the file in
- the firmware volume media may be in any arbitrary format as long
- as it does the following: It is accessed using the Firmware
- Volume Protocol. The image that is returned follows the image
- format defined in Code Definitions: PI Firmware File Format.
- If the input value of Buffer==NULL, it indicates the caller is
- requesting only that the type, attributes, and size of the
- file be returned and that there is no output buffer. In this
- case, the following occurs:
- - BufferSize is returned with the size that is required to
- successfully complete the read.
- - The output parameters FoundType and *FileAttributes are
- returned with valid values.
- - The returned value of *AuthenticationStatus is undefined.
-
- If the input value of Buffer!=NULL, the output buffer is
- specified by a double indirection of the Buffer parameter. The
- input value of *Buffer is used to determine if the output
- buffer is caller allocated or is dynamically allocated by
- ReadFile(). If the input value of *Buffer!=NULL, it indicates
- the output buffer is caller allocated. In this case, the input
- value of *BufferSize indicates the size of the
- caller-allocated output buffer. If the output buffer is not
- large enough to contain the entire requested output, it is
- filled up to the point that the output buffer is exhausted and
- EFI_WARN_BUFFER_TOO_SMALL is returned, and then BufferSize is
- returned with the size required to successfully complete the
- read. All other output parameters are returned with valid
- values. If the input value of *Buffer==NULL, it indicates the
- output buffer is to be allocated by ReadFile(). In this case,
- ReadFile() will allocate an appropriately sized buffer from
- boot services pool memory, which will be returned in Buffer.
- The size of the new buffer is returned in BufferSize and all
- other output parameters are returned with valid values.
- ReadFile() is callable only from TPL_NOTIFY and below.
- Behavior of ReadFile() at any EFI_TPL above TPL_NOTIFY is
- undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI
- 2.0 specification.
-
- @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance.
-
- @param NameGuid Pointer to an EFI_GUID, which is the file
- name. All firmware file names are EFI_GUIDs.
- A single firmware volume must not have two
- valid files with the same file name
- EFI_GUID.
-
- @param Buffer Pointer to a pointer to a buffer in which the
- file contents are returned, not including the
- file header.
- @param BufferSize Pointer to a caller-allocated UINTN. It
- indicates the size of the memory
- represented by Buffer.
-
- @param FoundType Pointer to a caller-allocated
- EFI_FV_FILETYPE.
-
- @param FileAttributes Pointer to a caller-allocated
- EFI_FV_FILE_ATTRIBUTES.
-
- @param AuthenticationStatus Pointer to a caller-allocated
- UINT32 in which the
- authentication status is
- returned.
-
- @retval EFI_SUCCESS The call completed successfully.
-
- @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to
- contain the requested
- output. The buffer is
- filled and the output is
- truncated.
-
- @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.
-
- @retval EFI_NOT_FOUND Name was not found in the firmware
- volume.
-
- @retval EFI_DEVICE_ERROR A hardware error occurred when
- attempting to access the firmware
- volume.
-
- @retval EFI_ACCESS_DENIED The firmware volume is configured to
- isallow reads.
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2ReadFile (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN CONST EFI_GUID *NameGuid,
- IN OUT VOID **Buffer,
- IN OUT UINTN *BufferSize,
- OUT EFI_FV_FILETYPE *FoundType,
- OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,
- OUT UINT32 *AuthenticationStatus
- )
-{
- FIRMWARE_VOLUME2_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume;
-
- Private = FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS (This);
- FirmwareVolume = Private->FirmwareVolume;
-
- return FirmwareVolume->ReadFile (
- FirmwareVolume,
- (EFI_GUID *)NameGuid,
- Buffer,
- BufferSize,
- FoundType,
- FileAttributes,
- AuthenticationStatus
- );
-}
-
-/**
- ReadSection() is used to retrieve a specific section from a file
- within a firmware volume. The section returned is determined
- using a depth-first, left-to-right search algorithm through all
- sections found in the specified file.The output buffer is specified
- by a double indirection of the Buffer parameter. The input value of Buffer
- is used to determine if the output buffer is caller allocated or is
- dynamically allocated by ReadSection(). If the input value of
- Buffer!=NULL, it indicates that the output buffer is caller
- allocated. In this case, the input value of *BufferSize
- indicates the size of the caller-allocated output buffer. If
- the output buffer is not large enough to contain the entire
- requested output, it is filled up to the point that the output
- buffer is exhausted and EFI_WARN_BUFFER_TOO_SMALL is returned,
- and then BufferSize is returned with the size that is required
- to successfully complete the read. All other
- output parameters are returned with valid values. If the input
- value of *Buffer==NULL, it indicates the output buffer is to
- be allocated by ReadSection(). In this case, ReadSection()
- will allocate an appropriately sized buffer from boot services
- pool memory, which will be returned in *Buffer. The size of
- the new buffer is returned in *BufferSize and all other output
- parameters are returned with valid values. ReadSection() is
- callable only from TPL_NOTIFY and below. Behavior of
- ReadSection() at any EFI_TPL above TPL_NOTIFY is
- undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI
- 2.0 specification.
-
-
- @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance.
-
- @param NameGuid Pointer to an EFI_GUID, which indicates the
- file name from which the requested section
- will be read.
-
- @param SectionType Indicates the section type to return.
- SectionType in conjunction with
- SectionInstance indicates which section to
- return.
-
- @param SectionInstance Indicates which instance of sections
- with a type of SectionType to return.
- SectionType in conjunction with
- SectionInstance indicates which
- section to return. SectionInstance is
- zero based.
-
- @param Buffer Pointer to a pointer to a buffer in which the
- section contents are returned, not including
- the section header.
-
- @param BufferSize Pointer to a caller-allocated UINTN. It
- indicates the size of the memory
- represented by Buffer.
-
- @param AuthenticationStatus Pointer to a caller-allocated
- UINT32 in which the authentication
- status is returned.
-
-
- @retval EFI_SUCCESS The call completed successfully.
-
- @retval EFI_WARN_BUFFER_TOO_SMALL The caller-allocated
- buffer is too small to
- contain the requested
- output. The buffer is
- filled and the output is
- truncated.
-
- @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.
-
- @retval EFI_NOT_FOUND The requested file was not found in
- the firmware volume. EFI_NOT_FOUND The
- requested section was not found in the
- specified file.
-
- @retval EFI_DEVICE_ERROR A hardware error occurred when
- attempting to access the firmware
- volume.
-
- @retval EFI_ACCESS_DENIED The firmware volume is configured to
- disallow reads. EFI_PROTOCOL_ERROR
- The requested section was not found,
- but the file could not be fully
- parsed because a required
- GUIDED_SECTION_EXTRACTION_PROTOCOL
- was not found. It is possible the
- requested section exists within the
- file and could be successfully
- extracted once the required
- GUIDED_SECTION_EXTRACTION_PROTOCOL
- is published.
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2ReadSection (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN CONST EFI_GUID *NameGuid,
- IN EFI_SECTION_TYPE SectionType,
- IN UINTN SectionInstance,
- IN OUT VOID **Buffer,
- IN OUT UINTN *BufferSize,
- OUT UINT32 *AuthenticationStatus
- )
-{
- FIRMWARE_VOLUME2_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume;
-
- Private = FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS (This);
- FirmwareVolume = Private->FirmwareVolume;
-
- return FirmwareVolume->ReadSection (
- FirmwareVolume,
- (EFI_GUID *)NameGuid,
- SectionType,
- SectionInstance,
- Buffer,
- BufferSize,
- AuthenticationStatus
- );
-}
-
-/**
- WriteFile() is used to write one or more files to a firmware
- volume. Each file to be written is described by an
- EFI_FV_WRITE_FILE_DATA structure. The caller must ensure that
- any required alignment for all files listed in the FileData
- array is compatible with the firmware volume. Firmware volume
- capabilities can be determined using the GetVolumeAttributes()
- call. Similarly, if the WritePolicy is set to
- EFI_FV_RELIABLE_WRITE, the caller must check the firmware volume
- capabilities to ensure EFI_FV_RELIABLE_WRITE is supported by the
- firmware volume. EFI_FV_UNRELIABLE_WRITE must always be
- supported. Writing a file with a size of zero
- (FileData[n].BufferSize == 0) deletes the file from the firmware
- volume if it exists. Deleting a file must be done one at a time.
- Deleting a file as part of a multiple file write is not allowed.
- Platform Initialization Specification VOLUME 3 Shared
- Architectural Elements 84 August 21, 2006 Version 1.0
- WriteFile() is callable only from TPL_NOTIFY and below.
- Behavior of WriteFile() at any EFI_TPL above TPL_NOTIFY is
- undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0
- specification.
-
- @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.
-
- @param NumberOfFiles Indicates the number of
- elements in the array pointed to by FileData.
-
-
- @param WritePolicy Indicates the level of reliability for the
- write in the event of a power failure or
- other system failure during the write
- operation.
-
- @param FileData Pointer to an array of
- EFI_FV_WRITE_FILE_DATA. Each element of
- FileData[] represents a file to be written.
-
-
- @retval EFI_SUCCESS The write completed successfully.
-
- @retval EFI_OUT_OF_RESOURCES The firmware volume does not
- have enough free space to
- storefile(s).
-
- @retval EFI_DEVICE_ERROR A hardware error occurred when
- attempting to access the firmware volume.
-
- @retval EFI_WRITE_PROTECTED The firmware volume is
- configured to disallow writes.
-
- @retval EFI_NOT_FOUND A delete was requested, but the
- requested file was not found in the
- firmware volume.
-
- @retval EFI_INVALID_PARAMETER A delete was requested with a
- multiple file write.
-
- @retval EFI_INVALID_PARAMETER An unsupported WritePolicy was
- requested.
-
- @retval EFI_INVALID_PARAMETER An unknown file type was
- specified.
-
- @retval EFI_INVALID_PARAMETER A file system specific error
- has occurred.
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2WriteFile (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN UINT32 NumberOfFiles,
- IN EFI_FV_WRITE_POLICY WritePolicy,
- IN EFI_FV_WRITE_FILE_DATA *FileData
- )
-{
- FIRMWARE_VOLUME2_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume;
-
- Private = FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS (This);
- FirmwareVolume = Private->FirmwareVolume;
-
- return FirmwareVolume->WriteFile (
- FirmwareVolume,
- NumberOfFiles,
- WritePolicy,
- (FRAMEWORK_EFI_FV_WRITE_FILE_DATA *)FileData
- );
-}
-
-/**
- GetNextFile() is the interface that is used to search a firmware
- volume for a particular file. It is called successively until
- the desired file is located or the function returns
- EFI_NOT_FOUND. To filter uninteresting files from the output,
- the type of file to search for may be specified in FileType. For
- example, if *FileType is EFI_FV_FILETYPE_DRIVER, only files of
- this type will be returned in the output. If *FileType is
- EFI_FV_FILETYPE_ALL, no filtering of file types is done. The Key
- parameter is used to indicate a starting point of the search. If
- the buffer *Key is completely initialized to zero, the search
- re-initialized and starts at the beginning. Subsequent calls to
- GetNextFile() must maintain the value of *Key returned by the
- immediately previous call. The actual contents of *Key are
- implementation specific and no semantic content is implied.
- GetNextFile() is callable only from TPL_NOTIFY and below.
- Behavior of GetNextFile() at any EFI_TPL above TPL_NOTIFY is
- undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0
- specification. Status Codes Returned
-
-
- @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance.
-
- @param Key Pointer to a caller-allocated buffer
- that contains implementation-specific data that is
- used to track where to begin the search for the
- next file. The size of the buffer must be at least
- This->KeySize bytes long. To re-initialize the
- search and begin from the beginning of the
- firmware volume, the entire buffer must be cleared
- to zero. Other than clearing the buffer to
- initiate a new search, the caller must not modify
- the data in the buffer between calls to
- GetNextFile().
-
- @param FileType Pointer to a caller-allocated
- EFI_FV_FILETYPE. The GetNextFile() API can
- filter its search for files based on the
- value of the FileType input. A *FileType
- input of EFI_FV_FILETYPE_ALL causes
- GetNextFile() to search for files of all
- types. If a file is found, the file's type
- is returned in FileType. *FileType is not
- modified if no file is found.
-
- @param NameGuid Pointer to a caller-allocated EFI_GUID. If a
- matching file is found, the file's name is
- returned in NameGuid. If no matching file is
- found, *NameGuid is not modified.
-
- @param Attributes Pointer to a caller-allocated
- EFI_FV_FILE_ATTRIBUTES. If a matching file
- is found, the file's attributes are returned
- in Attributes. If no matching file is found,
- Attributes is not modified. Type
- EFI_FV_FILE_ATTRIBUTES is defined in
- ReadFile().
-
- @param Size Pointer to a caller-allocated UINTN. If a
- matching file is found, the file's size is
- returned in *Size. If no matching file is found,
- Size is not modified.
-
- @retval EFI_SUCCESS The output parameters are filled with data
- obtained from the first matching file that
- was found.
-
- @retval FI_NOT_FOUND No files of type FileType were found.
-
-
- @retval EFI_DEVICE_ERROR A hardware error occurred when
- attempting to access the firmware
- volume.
-
- @retval EFI_ACCESS_DENIED The firmware volume is configured to
- disallow reads.
-
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2GetNextFile (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN OUT VOID *Key,
- IN OUT EFI_FV_FILETYPE *FileType,
- OUT EFI_GUID *NameGuid,
- OUT EFI_FV_FILE_ATTRIBUTES *Attributes,
- OUT UINTN *Size
- )
-{
- FIRMWARE_VOLUME2_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume;
-
- Private = FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS (This);
- FirmwareVolume = Private->FirmwareVolume;
-
- return FirmwareVolume->GetNextFile (
- FirmwareVolume,
- Key,
- FileType,
- NameGuid,
- Attributes,
- Size
- );
-}
-
-/**
- The GetInfo() function returns information of type
- InformationType for the requested firmware volume. If the volume
- does not support the requested information type, then
- EFI_UNSUPPORTED is returned. If the buffer is not large enough
- to hold the requested structure, EFI_BUFFER_TOO_SMALL is
- returned and the BufferSize is set to the size of buffer that is
- required to make the request. The information types defined by
- this specification are required information types that all file
- systems must support.
-
- @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance that is the file handle the requested
- information is for.
-
- @param InformationType The type identifier for the
- information being requested.
-
- @param BufferSize On input, the size of Buffer. On output,
- the amount of data returned in Buffer. In
- both cases, the size is measured in bytes.
-
- @param Buffer A pointer to the data buffer to return. The
- buffer's type is indicated by InformationType.
-
-
- @retval EFI_SUCCESS The information was retrieved.
-
- @retval EFI_UNSUPPORTED The InformationType is not known.
-
- @retval EFI_NO_MEDIA The device has no medium.
-
- @retval EFI_DEVICE_ERROR The device reported an error.
-
- @retval EFI_VOLUME_CORRUPTED The file system structures are
- corrupted.
-
- @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to
- read the current directory
- entry. BufferSize has been
- updated with the size needed to
- complete the request.
-
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2GetInfo (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN CONST EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-/**
-
- The SetInfo() function sets information of type InformationType
- on the requested firmware volume.
-
-
- @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL
- instance that is the file handle the information
- is for.
-
- @param InformationType The type identifier for the
- information being set.
-
- @param BufferSize The size, in bytes, of Buffer.
-
- @param Buffer A pointer to the data buffer to write. The
- buffer's type is indicated by InformationType.
-
- @retval EFI_SUCCESS The information was set.
-
- @retval EFI_UNSUPPORTED The InformationType is not known.
-
- @retval EFI_NO_MEDIA The device has no medium.
-
- @retval EFI_DEVICE_ERROR The device reported an error.
-
- @retval EFI_VOLUME_CORRUPTED The file system structures are
- corrupted.
-
-
- @retval EFI_WRITE_PROTECTED The media is read only.
-
- @retval EFI_VOLUME_FULL The volume is full.
-
- @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the
- size of the type indicated by
- InformationType.
-
-**/
-EFI_STATUS
-EFIAPI
-Fv2SetInfo (
- IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
- IN CONST EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN CONST VOID *Buffer
- )
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/Fv2OnFvThunk/Fv2OnFvThunk.inf b/EdkCompatibilityPkg/Compatibility/Fv2OnFvThunk/Fv2OnFvThunk.inf
deleted file mode 100644
index 93540e42eb..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Fv2OnFvThunk/Fv2OnFvThunk.inf
+++ /dev/null
@@ -1,58 +0,0 @@
-## @file
-# Module produce FV2 on top of FV.
-#
-# UEFI PI specification supersedes Inte's Framework Specification.
-# EFI_FIRMWARE_VOLUME_PROTOCOL defined in Intel Framework Pkg is replaced by
-# EFI_FIRMWARE_VOLUME2_PROTOCOL in MdePkg.
-# This module produces FV2 on top of FV. This module is used on platform when both of
-# these two conditions are true:
-# 1) Framework module producing FV is present
-# 2) And the rest of modules on the platform consume FV2
-#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = Fv2OnFvThunk
- FILE_GUID = D8A6F4A6-0E97-4a8b-A475-39F1B28B5AEC
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeFirmwareVolume
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- Fv2OnFvThunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- BaseLib
- DebugLib
- UefiLib
- MemoryAllocationLib
-
-[Protocols]
- gEfiFirmwareVolume2ProtocolGuid
- gEfiFirmwareVolumeProtocolGuid
-
-[Depex]
- TRUE
diff --git a/EdkCompatibilityPkg/Compatibility/FvFileLoaderOnLoadFileThunk/FvFileLoaderOnLoadFileThunk.c b/EdkCompatibilityPkg/Compatibility/FvFileLoaderOnLoadFileThunk/FvFileLoaderOnLoadFileThunk.c
deleted file mode 100644
index 96604f56d1..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FvFileLoaderOnLoadFileThunk/FvFileLoaderOnLoadFileThunk.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/** @file
-Module produce Framework's EFI_PEI_FV_FILE_LOADER_PPI top of EFI_PEI_LOAD_FILE_PPI.
-
-UEFI PI Spec supersedes Intel's Framework Specs.
-EFI_PEI_FV_FILE_LOADER_PPI defined in Intel Framework Pkg is replaced by EFI_PEI_LOAD_FILE_PPI
-in MdePkg.
-This module produces EFI_PEI_FV_FILE_LOADER_PPI on top of EFI_PEI_LOAD_FILE_PPI .
-This module is used on platform when both of these two conditions are true:
-1) Framework module consumes EFI_PEI_FV_FILE_LOADER_PPI is present.
-2) The platform has PI modules that produce EFI_PEI_LOAD_FILE_PPI.
-
-Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
-
-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:
-
-**/
-
-#include <PiPei.h>
-#include <Ppi/LoadFile.h>
-#include <Ppi/FvLoadFile.h>
-#include <Library/DebugLib.h>
-#include <Library/PeiServicesLib.h>
-
-/**
-
- Wrap the call to PI's EFI_PEI_LOAD_FILE_PPI.
-
- @param This A pointer to EFI_PEI_FV_FILE_LOADER_PPI.
- @param FfsHeader Pointer to the FFS header of the file to load.
- @param ImageAddress The loaded address of the Image.
- @param ImageSize Pointer to the size of the loaded image.
- @param EntryPoint Pointer to the entry point of the image.
-
- @retval EFI_SUCCESS The image was loaded successfully.
- @retval EFI_OUT_OF_RESOURCE There was not enought memory.
- @retval EFI_INVALID_PARAMETER The contents of the FFS file did not contain a valid PE/COFF image that could be loaded.
-**/
-EFI_STATUS
-EFIAPI
-FrameworkLoadFile (
- IN EFI_PEI_FV_FILE_LOADER_PPI *This,
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- OUT EFI_PHYSICAL_ADDRESS *ImageAddress,
- OUT UINT64 *ImageSize,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint
- );
-
-EFI_PEI_FV_FILE_LOADER_PPI mLoadFilePpi = {
- FrameworkLoadFile
-};
-
-EFI_PEI_PPI_DESCRIPTOR mPpiFrameworkLoadFile = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiPeiFvFileLoaderPpiGuid,
- &mLoadFilePpi
-};
-
-/**
- Standard entry point of a PEIM.
-
- @param FfsHeader The FFS file header
- @param PeiServices General purpose services available to every PEIM.
-
- @retval EFI_SUCCESS If the gEfiPeiReadOnlyVariablePpiGuid interface could be successfully installed.
-
-**/
-EFI_STATUS
-EFIAPI
-InitPeim (
- IN EFI_PEI_FILE_HANDLE FfsHeader,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- //
- // This thunk module can only be used together with a PI PEI core, as we
- // assume PeiServices Pointer Table can be located in a standard way defined
- // in PI spec.
- //
- ASSERT ((*PeiServices)->Hdr.Revision >= 0x00010000);
- return (*PeiServices)->InstallPpi (PeiServices, &mPpiFrameworkLoadFile);
-}
-
-
-/**
-
- Wrap the call to PI's EFI_PEI_LOAD_FILE_PPI.
-
- @param This A pointer to EFI_PEI_FV_FILE_LOADER_PPI.
- @param FfsHeader The pointer to the file header to be loaded by the Pe/Coff loader.
- @param ImageAddress The loaded address of the Image.
- @param ImageSize Pointer to the size of the loaded image.
- @param EntryPoint Pointer to the entry point of the image.
-
- @retval EFI_SUCCESS The image was loaded successfully.
- @retval EFI_OUT_OF_RESOURCE There was not enought memory.
- @retval EFI_INVALID_PARAMETER The contents of the FFS file did not contain a valid PE/COFF image that could be loaded.
-**/
-EFI_STATUS
-EFIAPI
-FrameworkLoadFile (
- IN EFI_PEI_FV_FILE_LOADER_PPI *This,
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- OUT EFI_PHYSICAL_ADDRESS *ImageAddress,
- OUT UINT64 *ImageSize,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint
- )
-{
- EFI_STATUS Status;
- EFI_PEI_LOAD_FILE_PPI *PiLoadFile;
- UINT32 AuthenticationState;
-
- Status = PeiServicesLocatePpi (
- &gEfiPeiLoadFilePpiGuid,
- 0,
- NULL,
- (VOID **) &PiLoadFile
- );
- ASSERT_EFI_ERROR (Status);
-
- return PiLoadFile->LoadFile (
- PiLoadFile,
- (EFI_PEI_FILE_HANDLE) FfsHeader,
- ImageAddress,
- ImageSize,
- EntryPoint,
- &AuthenticationState
- );
-
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/FvFileLoaderOnLoadFileThunk/FvFileLoaderOnLoadFileThunk.inf b/EdkCompatibilityPkg/Compatibility/FvFileLoaderOnLoadFileThunk/FvFileLoaderOnLoadFileThunk.inf
deleted file mode 100644
index a0506c15eb..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FvFileLoaderOnLoadFileThunk/FvFileLoaderOnLoadFileThunk.inf
+++ /dev/null
@@ -1,56 +0,0 @@
-## @file
-# Module produce Framework's EFI_PEI_FV_FILE_LOADER_PPI top of EFI_PEI_LOAD_FILE_PPI.
-#
-# UEFI PI Spec supersedes Intel's Framework Specs.
-# EFI_PEI_FV_FILE_LOADER_PPI defined in Intel Framework Pkg is replaced by EFI_PEI_LOAD_FILE_PPI
-# in MdePkg.
-# This module produces EFI_PEI_FV_FILE_LOADER_PPI on top of EFI_PEI_LOAD_FILE_PPI .
-# This module is used on platform when both of these two conditions are true:
-# 1) Framework module consumes EFI_PEI_FV_FILE_LOADER_PPI is present.
-# 2) The platform has PI modules that produce EFI_PEI_LOAD_FILE_PPI.
-#
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = FvFileLoaderOnLoadFileThunk
- FILE_GUID = 6CDDBF28-89AC-4e01-9692-616B8A1009C8
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitPeim
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- FvFileLoaderOnLoadFileThunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
-
-[LibraryClasses]
- PeimEntryPoint
- PeiServicesLib
- DebugLib
-
-[Ppis]
- gEfiPeiLoadFilePpiGuid #ALWAYS_CONSUME
- gEfiPeiFvFileLoaderPpiGuid #ALWAYS_PRODUCE
-
-[Depex]
- gEfiPeiLoadFilePpiGuid
diff --git a/EdkCompatibilityPkg/Compatibility/FvOnFv2Thunk/FvOnFv2Thunk.c b/EdkCompatibilityPkg/Compatibility/FvOnFv2Thunk/FvOnFv2Thunk.c
deleted file mode 100644
index e13ebc2654..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FvOnFv2Thunk/FvOnFv2Thunk.c
+++ /dev/null
@@ -1,515 +0,0 @@
-/** @file
-UEFI PI specification supersedes Inte's Framework Specification.
-EFI_FIRMWARE_VOLUME_PROTOCOL defined in Intel Framework Pkg is replaced by
-EFI_FIRMWARE_VOLUME2_PROTOCOL in MdePkg.
-This module produces FV on top of FV2. This module is used on platform when both of
-these two conditions are true:
-1) Framework module consuming FV is present
-2) And the platform only produces FV2
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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:
-
-**/
-
-#include <PiDxe.h>
-#include <Protocol/FirmwareVolume2.h>
-#include <Protocol/FirmwareVolume.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#define FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('f', 'v', 't', 'h')
-
-typedef struct {
- UINTN Signature;
- EFI_FIRMWARE_VOLUME_PROTOCOL FirmwareVolume;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
-} FIRMWARE_VOLUME_PRIVATE_DATA;
-
-#define FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS(a) CR (a, FIRMWARE_VOLUME_PRIVATE_DATA, FirmwareVolume, FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE)
-
-/**
- Convert FV attrbiutes to FV2 attributes.
-
- @param Fv2Attributes FV2 attributes.
-
- @return FV attributes.
-
-**/
-FRAMEWORK_EFI_FV_ATTRIBUTES
-Fv2AttributesToFvAttributes (
- IN EFI_FV_ATTRIBUTES Fv2Attributes
- )
-{
- //
- // Clear those filed that is not defined in Framework FV spec and Alignment conversion.
- //
- return (Fv2Attributes & 0x1ff) | ((UINTN) EFI_FV_ALIGNMENT_2 << RShiftU64((Fv2Attributes & EFI_FV2_ALIGNMENT), 16));
-}
-
-/**
- Retrieves attributes, insures positive polarity of attribute bits, returns
- resulting attributes in output parameter.
-
- @param This Calling context
- @param Attributes output buffer which contains attributes
-
- @retval EFI_SUCCESS The firmware volume attributes were returned.
-
-**/
-EFI_STATUS
-EFIAPI
-FvGetVolumeAttributes (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes
- )
-{
- EFI_STATUS Status;
- FIRMWARE_VOLUME_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
-
- Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);
- FirmwareVolume2 = Private->FirmwareVolume2;
-
- Status = FirmwareVolume2->GetVolumeAttributes (
- FirmwareVolume2,
- Attributes
- );
- if (!EFI_ERROR (Status)) {
- *Attributes = Fv2AttributesToFvAttributes (*Attributes);
- }
- return Status;
-}
-
-/**
- Sets volume attributes.
-
- @param This Calling context
- @param Attributes Buffer which contains attributes
-
- @retval EFI_INVALID_PARAMETER A bit in Attributes was invalid
- @retval EFI_SUCCESS The requested firmware volume attributes were set
- and the resulting EFI_FV_ATTRIBUTES is returned in
- Attributes.
- @retval EFI_ACCESS_DENIED The Device is locked and does not permit modification.
-
-**/
-EFI_STATUS
-EFIAPI
-FvSetVolumeAttributes (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes
- )
-{
- FIRMWARE_VOLUME_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
- EFI_FV_ATTRIBUTES Fv2Attributes;
- EFI_STATUS Status;
-
- Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);
- FirmwareVolume2 = Private->FirmwareVolume2;
-
- Fv2Attributes = (*Attributes & 0x1ff);
- Status = FirmwareVolume2->SetVolumeAttributes (
- FirmwareVolume2,
- &Fv2Attributes
- );
-
- *Attributes = Fv2AttributesToFvAttributes (Fv2Attributes);
-
- return Status;
-}
-
-/**
- Read the requested file (NameGuid) and returns data in Buffer.
-
- @param This Calling context
- @param NameGuid Filename identifying which file to read
- @param Buffer Pointer to pointer to buffer in which contents of file are returned.
- <br>
- If Buffer is NULL, only type, attributes, and size are returned as
- there is no output buffer.
- <br>
- If Buffer != NULL and *Buffer == NULL, the output buffer is allocated
- from BS pool by ReadFile
- <br>
- If Buffer != NULL and *Buffer != NULL, the output buffer has been
- allocated by the caller and is being passed in.
- @param BufferSize Indicates the buffer size passed in, and on output the size
- required to complete the read
- @param FoundType Indicates the type of the file who's data is returned
- @param FileAttributes Indicates the attributes of the file who's data is resturned
- @param AuthenticationStatus Indicates the authentication status of the data
-
- @retval EFI_SUCCESS The call completed successfully
- @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to contain the requested output.
- The buffer is filled and the output is truncated.
- @retval EFI_NOT_FOUND NameGuid was not found in the firmware volume.
- @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access the firmware volume.
- @retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.
- @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.
-
-**/
-EFI_STATUS
-EFIAPI
-FvReadFile (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN EFI_GUID *NameGuid,
- IN OUT VOID **Buffer,
- IN OUT UINTN *BufferSize,
- OUT EFI_FV_FILETYPE *FoundType,
- OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,
- OUT UINT32 *AuthenticationStatus
- )
-{
- FIRMWARE_VOLUME_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
- EFI_STATUS Status;
-
- Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);
- FirmwareVolume2 = Private->FirmwareVolume2;
-
- Status = FirmwareVolume2->ReadFile (
- FirmwareVolume2,
- NameGuid,
- Buffer,
- BufferSize,
- FoundType,
- FileAttributes,
- AuthenticationStatus
- );
-
- //
- // For Framework FV attrbutes, only alignment fields are valid.
- //
- *FileAttributes = *FileAttributes & EFI_FV_FILE_ATTRIB_ALIGNMENT;
-
- return Status;
-}
-
-/**
- Read the requested section from the specified file and returns data in Buffer.
-
- @param This Calling context
- @param NameGuid Filename identifying the file from which to read
- @param SectionType Indicates what section type to retrieve
- @param SectionInstance Indicates which instance of SectionType to retrieve
- @param Buffer Pointer to pointer to buffer in which contents of file are returned.
- <br>
- If Buffer is NULL, only type, attributes, and size are returned as
- there is no output buffer.
- <br>
- If Buffer != NULL and *Buffer == NULL, the output buffer is allocated
- from BS pool by ReadFile
- <br>
- If Buffer != NULL and *Buffer != NULL, the output buffer has been
- allocated by the caller and is being passed in.
- @param BufferSize Indicates the buffer size passed in, and on output the size
- required to complete the read
- @param AuthenticationStatus Indicates the authentication status of the data
-
- @retval EFI_SUCCESS The call completed successfully.
- @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to contain the requested output.
- The buffer is filled and the output is truncated.
- @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.
- @retval EFI_NOT_FOUND Name was not found in the firmware volume.
- @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access the firmware volume.
- @retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.
-
-**/
-EFI_STATUS
-EFIAPI
-FvReadSection (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN EFI_GUID *NameGuid,
- IN EFI_SECTION_TYPE SectionType,
- IN UINTN SectionInstance,
- IN OUT VOID **Buffer,
- IN OUT UINTN *BufferSize,
- OUT UINT32 *AuthenticationStatus
- )
-{
- FIRMWARE_VOLUME_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
-
- Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);
- FirmwareVolume2 = Private->FirmwareVolume2;
-
- return FirmwareVolume2->ReadSection (
- FirmwareVolume2,
- NameGuid,
- SectionType,
- SectionInstance,
- Buffer,
- BufferSize,
- AuthenticationStatus
- );
-}
-
-/**
- Write the supplied file (NameGuid) to the FV.
-
- @param This Calling context
- @param NumberOfFiles Indicates the number of file records pointed to by FileData
- @param WritePolicy Indicates the level of reliability of the write with respect to
- things like power failure events.
- @param FileData A pointer to an array of EFI_FV_WRITE_FILE_DATA structures. Each
- element in the array indicates a file to write, and there are
- NumberOfFiles elements in the input array.
-
- @retval EFI_SUCCESS The write completed successfully.
- @retval EFI_OUT_OF_RESOURCES The firmware volume does not have enough free space to store file(s).
- @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access the firmware volume.
- @retval EFI_WRITE_PROTECTED The firmware volume is configured to disallow writes.
- @retval EFI_NOT_FOUND A delete was requested, but the requested file was not
- found in the firmware volume.
- @retval EFI_INVALID_PARAMETER A delete was requested with a multiple file write.
- An unsupported WritePolicy was requested.
- An unknown file type was specified.
- A file system specific error has occurred.
-
-**/
-EFI_STATUS
-EFIAPI
-FvWriteFile (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN UINT32 NumberOfFiles,
- IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy,
- IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA *FileData
- )
-{
- FIRMWARE_VOLUME_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
- EFI_FV_WRITE_FILE_DATA *PiFileData;
- EFI_STATUS Status;
- UINTN Index;
-
- Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);
- FirmwareVolume2 = Private->FirmwareVolume2;
-
- PiFileData = AllocateCopyPool (sizeof (EFI_FV_WRITE_FILE_DATA), FileData);
- ASSERT (PiFileData != NULL);
-
- //
- // Framework Spec assume firmware files are Memory-Mapped.
- //
- for (Index = 0; Index < NumberOfFiles; Index++) {
- PiFileData[Index].FileAttributes |= EFI_FV_FILE_ATTRIB_MEMORY_MAPPED;
- }
-
- Status = FirmwareVolume2->WriteFile (
- FirmwareVolume2,
- NumberOfFiles,
- WritePolicy,
- (EFI_FV_WRITE_FILE_DATA *)FileData
- );
-
- FreePool (PiFileData);
- return Status;
-}
-
-/**
- Given the input key, search for the next matching file in the volume.
-
- @param This Calling context
- @param Key Pointer to a caller allocated buffer that contains an implementation
- specific key that is used to track where to begin searching on
- successive calls.
- @param FileType Indicates the file type to filter for
- @param NameGuid Guid filename of the file found
- @param Attributes Attributes of the file found
- @param Size Size in bytes of the file found
-
- @retval EFI_SUCCESS The output parameters are filled with data obtained from
- the first matching file that was found.
- @retval EFI_NOT_FOUND No files of type FileType were found.
- @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access
- the firmware volume.
- @retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.
-
-**/
-EFI_STATUS
-EFIAPI
-FvGetNextFile (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN OUT VOID *Key,
- IN OUT EFI_FV_FILETYPE *FileType,
- OUT EFI_GUID *NameGuid,
- OUT EFI_FV_FILE_ATTRIBUTES *Attributes,
- OUT UINTN *Size
- )
-{
- FIRMWARE_VOLUME_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
- EFI_STATUS Status;
-
- Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);
- FirmwareVolume2 = Private->FirmwareVolume2;
-
- Status = FirmwareVolume2->GetNextFile (
- FirmwareVolume2,
- Key,
- FileType,
- NameGuid,
- Attributes,
- Size
- );
-
- //
- // For Framework FV attrbutes, only alignment fields are valid.
- //
- *Attributes = *Attributes & EFI_FV_FILE_ATTRIB_ALIGNMENT;
-
- return Status;
-}
-
-//
-// Firmware Volume Protocol template
-//
-EFI_EVENT mFvRegistration;
-
-FIRMWARE_VOLUME_PRIVATE_DATA gFirmwareVolumePrivateDataTemplate = {
- FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE,
- {
- FvGetVolumeAttributes,
- FvSetVolumeAttributes,
- FvReadFile,
- FvReadSection,
- FvWriteFile,
- FvGetNextFile,
- 0,
- NULL
- },
- NULL
-};
-
-//
-// Module globals
-//
-/**
- This notification function is invoked when an instance of the
- EFI_FIRMWARE_VOLUME2_PROTOCOL is produced. It installs another instance of the
- EFI_FIRMWARE_VOLUME_PROTOCOL on the same handle.
-
- @param Event The event that occured
- @param Context Context of event. Not used in this nofication function.
-
-**/
-VOID
-EFIAPI
-FvNotificationEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HANDLE Handle;
- FIRMWARE_VOLUME_PRIVATE_DATA *Private;
- EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume;
-
- while (TRUE) {
- BufferSize = sizeof (Handle);
- Status = gBS->LocateHandle (
- ByRegisterNotify,
- &gEfiFirmwareVolume2ProtocolGuid,
- mFvRegistration,
- &BufferSize,
- &Handle
- );
- if (EFI_ERROR (Status)) {
- //
- // Exit Path of While Loop....
- //
- break;
- }
-
- //
- // Skip this handle if the Firmware Volume Protocol is already installed
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiFirmwareVolumeProtocolGuid,
- (VOID **)&FirmwareVolume
- );
- if (!EFI_ERROR (Status)) {
- continue;
- }
-
- //
- // Allocate private data structure
- //
- Private = AllocateCopyPool (sizeof (FIRMWARE_VOLUME_PRIVATE_DATA), &gFirmwareVolumePrivateDataTemplate);
- if (Private == NULL) {
- continue;
- }
-
- //
- // Retrieve the Firmware Volume2 Protocol
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiFirmwareVolume2ProtocolGuid,
- (VOID **)&Private->FirmwareVolume2
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Fill in rest of private data structure
- //
- Private->FirmwareVolume.KeySize = Private->FirmwareVolume2->KeySize;
- Private->FirmwareVolume.ParentHandle = Private->FirmwareVolume2->ParentHandle;
-
- //
- // Install Firmware Volume Protocol onto same handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiFirmwareVolumeProtocolGuid,
- &Private->FirmwareVolume,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- }
-}
-
-
-/**
- The user Entry Point for DXE driver. The user code starts with this function
- as the real entry point for the image goes into a library that calls this
- function.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @retval other Some error occurs when executing this entry point.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeFirmwareVolume2 (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EfiCreateProtocolNotifyEvent (
- &gEfiFirmwareVolume2ProtocolGuid,
- TPL_CALLBACK,
- FvNotificationEvent,
- NULL,
- &mFvRegistration
- );
- return EFI_SUCCESS;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/FvOnFv2Thunk/FvOnFv2Thunk.inf b/EdkCompatibilityPkg/Compatibility/FvOnFv2Thunk/FvOnFv2Thunk.inf
deleted file mode 100644
index 5d1b521e2a..0000000000
--- a/EdkCompatibilityPkg/Compatibility/FvOnFv2Thunk/FvOnFv2Thunk.inf
+++ /dev/null
@@ -1,58 +0,0 @@
-## @file
-# Module produce FV on top of FV2.
-#
-# UEFI PI specification supersedes Inte's Framework Specification.
-# EFI_FIRMWARE_VOLUME_PROTOCOL defined in Intel Framework Pkg is replaced by
-# EFI_FIRMWARE_VOLUME2_PROTOCOL in MdePkg.
-# This module produces FV on top of FV2. This module is used on platform when both of
-# these two conditions are true:
-# 1) Framework module consuming FV is present
-# 2) And the platform only produces FV2
-#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = FvOnFv2Thunk
- FILE_GUID = 5007A40E-A5E0-44f7-86AE-662F9A91DA26
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeFirmwareVolume2
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- FvOnFv2Thunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- BaseLib
- DebugLib
- UefiLib
- MemoryAllocationLib
-
-[Protocols]
- gEfiFirmwareVolume2ProtocolGuid
- gEfiFirmwareVolumeProtocolGuid
-
-[Depex]
- TRUE
diff --git a/EdkCompatibilityPkg/Compatibility/Include/Guid/BootScriptThunkData.h b/EdkCompatibilityPkg/Compatibility/Include/Guid/BootScriptThunkData.h
deleted file mode 100644
index f0e6f5fee3..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Include/Guid/BootScriptThunkData.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/** @file
- Define Name, GUID and data format for an EFI PCD that is used to save the image base and size
- of a code segment which will be loaded and executed by a boot script thunk on S3 boot path.
-
-Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#ifndef _BOOT_SCRIPT_THUNK_VARIABLE_H_
-#define _BOOT_SCRIPT_THUNK_VARIABLE_H_
-
-//
-// The following structure boosts performance by combining structure all ACPI related variables into one.
-//
-#pragma pack(1)
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS BootScriptThunkBase;
- EFI_PHYSICAL_ADDRESS BootScriptThunkLength;
-} BOOT_SCRIPT_THUNK_DATA;
-
-#pragma pack()
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/Include/Guid/BootState.h b/EdkCompatibilityPkg/Compatibility/Include/Guid/BootState.h
deleted file mode 100644
index 439afe8563..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Include/Guid/BootState.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- GUID and Name are used to configure PcdBootState to DynamicHii PCD, which can
- make EDKII core work with the EDK implementation.
-
- The EDK implementation may depend on this guid variable to check the boot state.
- However, the EDKII core uses a dynamic PcdBootState to save the boot state. To be compatible with EDK implementations,
- BootStateGuid and BootStateName are used to configure PcdBootState to DynamicHii PCD to
- save the boot state as a variable.
-
-Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-#ifndef _BOOT_STATE_H_
-#define _BOOT_STATE_H_
-
-#define BOOT_STATE_VARIABLE_NAME L"BootState"
-
-#define EFI_BOOT_STATE_VARIABLE_GUID \
- { 0x60b5e939, 0xfcf, 0x4227, { 0xba, 0x83, 0x6b, 0xbe, 0xd4, 0x5b, 0xc0, 0xe3 } }
-
-extern EFI_GUID gEfiBootStateGuid;
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/Include/Guid/FrameworkBdsFrontPageFormSet.h b/EdkCompatibilityPkg/Compatibility/Include/Guid/FrameworkBdsFrontPageFormSet.h
deleted file mode 100644
index cedc2a86d5..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Include/Guid/FrameworkBdsFrontPageFormSet.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
- Framework BDS FrontPage FormSet GUID. It will be used when HiiThunk works with Framework BDS driver.
-
-Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-#ifndef __FRAMEWORK_BDS_FRONTPAGE_FORMSET_H__
-#define __FRAMEWORK_BDS_FRONTPAGE_FORMSET_H__
-
-//
-// In order to follow UEFI spec to do auto booting after a time-out, the GUID of Formset of Frontpage must match this value.
-//
-#define FRAMEWORK_BDS_FRONTPAGE_FORMSET_GUID { 0x9e0c30bc, 0x3f06, 0x4ba6, {0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe }}
-
-extern EFI_GUID gFrameworkBdsFrontPageFormsetGuid;
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/Include/Guid/SmmBaseThunkCommunication.h b/EdkCompatibilityPkg/Compatibility/Include/Guid/SmmBaseThunkCommunication.h
deleted file mode 100644
index 64e6824c86..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Include/Guid/SmmBaseThunkCommunication.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/** @file
- GUID and data structures for communication between SMM Base on SMM Base2 Thunk driver
- and SmmBaseHelper driver.
-
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-#ifndef _SMM_BASE_THUNK_COMMUNICATION_H_
-#define _SMM_BASE_THUNK_COMMUNICATION_H_
-
-#include <Protocol/SmmBase.h>
-
-#define EFI_SMM_BASE_THUNK_COMMUNICATION_GUID \
- { 0x6568a3d6, 0x15f, 0x4b4a, { 0x9c, 0x89, 0x1d, 0x14, 0x63, 0x14, 0x13, 0xa } }
-
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL *FilePath;
- VOID *SourceBuffer;
- UINTN SourceSize;
- EFI_HANDLE *ImageHandle;
- BOOLEAN LegacyIA32Binary;
-} SMMBASE_REGISTER_ARG;
-
-typedef struct {
- EFI_HANDLE ImageHandle;
-} SMMBASE_UNREGISTER_ARG;
-
-typedef struct {
- EFI_HANDLE SmmImageHandle;
- EFI_SMM_CALLBACK_ENTRY_POINT CallbackAddress;
- BOOLEAN MakeLast;
- BOOLEAN FloatingPointSave;
-} SMMBASE_REGISTER_CALLBACK_ARG;
-
-typedef struct {
- EFI_MEMORY_TYPE PoolType;
- UINTN Size;
- VOID **Buffer;
-} SMMBASE_ALLOCATE_POOL_ARG;
-
-typedef struct {
- VOID *Buffer;
-} SMMBASE_FREE_POOL_ARG;
-
-typedef struct {
- EFI_HANDLE ImageHandle;
- VOID *CommunicationBuffer;
- UINTN *SourceSize;
-} SMMBASE_COMMUNICATE_ARG;
-
-typedef union {
- SMMBASE_REGISTER_ARG Register;
- SMMBASE_UNREGISTER_ARG UnRegister;
- SMMBASE_REGISTER_CALLBACK_ARG RegisterCallback;
- SMMBASE_ALLOCATE_POOL_ARG AllocatePool;
- SMMBASE_FREE_POOL_ARG FreePool;
- SMMBASE_COMMUNICATE_ARG Communicate;
-} SMMBASE_FUNCTION_ARGS;
-
-typedef enum {
- SmmBaseFunctionRegister,
- SmmBaseFunctionUnregister,
- SmmBaseFunctionRegisterCallback,
- SmmBaseFunctionAllocatePool,
- SmmBaseFunctionFreePool,
- SmmBaseFunctionCommunicate
-} SMMBASE_FUNCTION;
-
-typedef struct {
- SMMBASE_FUNCTION Function;
- EFI_STATUS Status;
- SMMBASE_FUNCTION_ARGS Args;
- EFI_HANDLE SmmBaseImageHandle;
-} SMMBASE_FUNCTION_DATA;
-
-#pragma pack(1)
-typedef struct {
- EFI_GUID HeaderGuid;
- UINTN MessageLength;
- SMMBASE_FUNCTION_DATA FunctionData;
-} SMMBASETHUNK_COMMUNICATION_DATA;
-#pragma pack()
-
-extern EFI_GUID gEfiSmmBaseThunkCommunicationGuid;
-
-#endif
-
diff --git a/EdkCompatibilityPkg/Compatibility/Include/Library/LanguageLib.h b/EdkCompatibilityPkg/Compatibility/Include/Library/LanguageLib.h
deleted file mode 100644
index 4ae28682c6..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Include/Library/LanguageLib.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/** @file
- Provides functions for language conversion between ISO 639-2 and RFC 4646 styles.
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#ifndef __LANGUAGE_LIB__
-#define __LANGUAGE_LIB__
-
-/**
- Converts an ISO 639-2 language code to an RFC 4646 language code.
- If the ISO 639-2 language code has a corresponding ISO 639-1 code, then that ISO 639-1
- code is returned in the out parameter. Else the original ISO 639-2 code is returned. The returned RFC 4646
- language code is composed of only a primary language subtag.
-
- If Iso639Language is NULL, then ASSERT().
- If Rfc4646Language is NULL, then ASSERT().
-
- @param[out] Rfc4646Language Pointers to a buffer large enough for an ASCII string
- representing an RFC 4646 language code containing only
- either a ISO 639-1 or ISO 639-2 primary language subtag.
- This string is Null-terminated.
- @param[in] Iso639Language The pointer to a 3-letter ASCII string that represents
- an ISO 639-2 language code. This string is not required
- to be Null-terminated.
-
- @retval TRUE The ISO 639-2 language code was converted to an ISO 639-1 code.
- @retval FALSE The language code does not have a corresponding ISO 639-1 code.
-
-**/
-BOOLEAN
-EFIAPI
-ConvertIso639ToRfc4646 (
- OUT CHAR8 *Rfc4646Language,
- IN CONST CHAR8 *Iso639Language
- );
-
-/**
- Converts an RFC 4646 language code to an ISO 639-2 language code. The primary language
- subtag of the RFC 4646 code must be either an ISO 639-1 or 639-2 code. If the primary
- language subtag is an ISO 639-1 code, then it is converted to its corresponding ISO 639-2
- code (T code if applies). Else the ISO 639-2 code is returned.
-
- If Rfc4646Language is NULL, then ASSERT().
- If Iso639Language is NULL, then ASSERT().
-
- @param[out] Iso639Language Pointers to a buffer large enough for a 3-letter ASCII string
- representing an ISO 639-2 language code. The string
- is Null-terminated.
- @param[in] Rfc4646Language The pointer to a RFC 4646 language code string.
- This string is terminated
- by a NULL or a ';' character.
-
- @retval TRUE Language code converted successfully.
- @retval FALSE The RFC 4646 language code is invalid or unsupported.
-
-**/
-BOOLEAN
-EFIAPI
-ConvertRfc4646ToIso639 (
- OUT CHAR8 *Iso639Language,
- IN CONST CHAR8 *Rfc4646Language
- );
-
-/**
- Converts ISO 639-2 language codes to RFC 4646 codes and returns the converted codes.
- Caller is responsible for freeing the allocated buffer.
-
- If Iso639Languages is NULL, then ASSERT.
-
- @param[in] Iso639Languages Pointers to Null-terminated ISO 639-2 language code strings containing
- one or more ISO 639-2 3-letter language codes.
-
- @retval NULL Invalid ISO 639-2 language code found.
- @retval NULL Out of memory.
- @return The pointer to the allocate buffer containing the
- Null-terminated converted language codes string.
- This string is composed of one or more RFC4646
- language codes each of which has only
- ISO 639-1 2-letter primary language subtag.
-
-**/
-CHAR8 *
-EFIAPI
-ConvertLanguagesIso639ToRfc4646 (
- IN CONST CHAR8 *Iso639Languages
- );
-
-/**
- Converts RFC 4646 language codes to ISO 639-2 codes and returns the converted codes.
- The primary language subtag of the RFC 4646 code must be either an ISO 639-1 or 639-2 code.
- Caller is responsible for freeing the allocated buffer.
-
- If Rfc4646Languages is NULL, then ASSERT.
-
- @param[in] Rfc4646Languages Pointers to a Null-terminated RFC 4646 language codes
- string containing one or more RFC 4646 language codes.
-
- @retval NULL Invalid or unsupported RFC 4646 language code found.
- @retval NULL Out of memory.
- @return The pointer to the allocate buffer containing the
- Null-terminated converted language codes string.
- This string is composed of one or more ISO 639-2
- language codes.
-
-**/
-CHAR8 *
-EFIAPI
-ConvertLanguagesRfc4646ToIso639 (
- IN CONST CHAR8 *Rfc4646Languages
- );
-
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/Include/Ppi/EcpPciCfg.h b/EdkCompatibilityPkg/Compatibility/Include/Ppi/EcpPciCfg.h
deleted file mode 100644
index 6b0f55750a..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Include/Ppi/EcpPciCfg.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/** @file
-This PPI is the same as the PPI in the framework PciCfg, with one exception.
-Specifically, this PPI does not include a modify API, while the PPI in the framework PciCfg does.
-
-Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#ifndef _PEI_PCI_CFG_H_
-#define _PEI_PCI_CFG_H_
-
-#include <Ppi/PciCfg.h>
-
-#define ECP_PEI_PCI_CFG_PPI_GUID \
- {0xb0ee53d4, 0xa049, 0x4a79, { 0xb2, 0xff, 0x19, 0xd9, 0xfa, 0xef, 0xaa, 0x94}}
-
-typedef struct _ECP_PEI_PCI_CFG_PPI ECP_PEI_PCI_CFG_PPI;
-
-/**
- A PCI read and write operation.
-
- Writes to, or reads from, a given location in the PCI configuration space.
-
- @param PeiServices An indirect pointer to the PEI Services Table
- published by the PEI Foundation.
- @param This The pointer to local data for the interface.
- @param Width The width of the access. Enumerated in bytes.
- @param Address The physical address of the access. The format of
- the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
- @param Buffer A pointer to the buffer of data.
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the
- operation at this time.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *ECP_PEI_PCI_CFG_PPI_IO)(
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_PCI_CFG_PPI * This,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT64 Address,
- IN OUT VOID *Buffer
- );
-
-struct _ECP_PEI_PCI_CFG_PPI {
- ECP_PEI_PCI_CFG_PPI_IO Read;
- ECP_PEI_PCI_CFG_PPI_IO Write;
-};
-
-extern EFI_GUID gEcpPeiPciCfgPpiGuid;
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/Include/Protocol/Print.h b/EdkCompatibilityPkg/Compatibility/Include/Protocol/Print.h
deleted file mode 100644
index b54fd1d7ca..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Include/Protocol/Print.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/** @file
-
- The lite print protocol defines only one print function to
- print the format unicode string.
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#ifndef __PPRINT_H__
-#define __PPRINT_H__
-
-#define EFI_PRINT_PROTOCOL_GUID \
- { 0xdf2d868e, 0x32fc, 0x4cf0, {0x8e, 0x6b, 0xff, 0xd9, 0x5d, 0x13, 0x43, 0xd0} }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_PRINT_PROTOCOL EFI_PRINT_PROTOCOL;
-
-/**
- Produces a Null-terminated Unicode string in an output buffer, based on
- a Null-terminated Unicode format string and a VA_LIST argument list.
-
- Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The Unicode string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list specified by Marker based on the
- contents of the format string.
- The number of Unicode characters in the produced output buffer is returned, not including
- the Null-terminator.
- If BufferSize is 0 or 1, then no output buffer is produced, and 0 is returned.
-
- If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
- If BufferSize > 1 and FormatString is NULL, then ASSERT().
- If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
- ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
- contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the
- Null-terminator, then ASSERT().
-
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
- Unicode string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString A Null-terminated Unicode format string.
- @param Marker VA_LIST marker for the variable argument list.
-
- @return The number of Unicode characters in the produced output buffer not including the
- Null-terminator.
-
-**/
-typedef
-UINTN
-(EFIAPI *UNI_VSPRINT)(
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- IN VA_LIST Marker
- );
-
-/**
- EFI_PRINT_PROTOCOL provides one service to produce a Null-terminated Unicode string,
- based on a Null-terminated Unicode format string and a VA_LIST argument list, and fills into
- the buffer as output.
-**/
-struct _EFI_PRINT_PROTOCOL {
- UNI_VSPRINT VSPrint;
-};
-
-extern EFI_GUID gEfiPrintProtocolGuid;
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/Include/Protocol/SmmBaseHelperReady.h b/EdkCompatibilityPkg/Compatibility/Include/Protocol/SmmBaseHelperReady.h
deleted file mode 100644
index e1df20280b..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Include/Protocol/SmmBaseHelperReady.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/** @file
- EFI SMM Base Helper Ready Protocol.
-
- This UEFI protocol is produced by the SMM Base Helper SMM driver to provide
- a Framework SMST to the SMM Base Thunk driver. This protocol is also an indicator
- that the SMM Base Helper SMM driver is ready in SMRAM for communication with
- the SMM Base Thunk driver.
-
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#ifndef __EFI_SMM_BASE_HELPER_READY_H__
-#define __EFI_SMM_BASE_HELPER_READY_H__
-
-#define EFI_SMM_BASE_HELPER_READY_PROTOCOL_GUID \
- { \
- 0x910dca07, 0x1f94, 0x4ee7, { 0xaf, 0x2f, 0xff, 0x72, 0xf3, 0x15, 0x43, 0x53 } \
- }
-
-typedef struct {
- ///
- /// Pointer to the Framework SMST built from PI SMST by SMM Base Helper SMM driver.
- ///
- EFI_SMM_SYSTEM_TABLE *FrameworkSmst;
- ///
- /// Services function directly called by SMM Base Thunk when in SMM
- ///
- EFI_SMM_HANDLER_ENTRY_POINT2 ServiceEntry;
-} EFI_SMM_BASE_HELPER_READY_PROTOCOL;
-
-extern EFI_GUID gEfiSmmBaseHelperReadyProtocolGuid;
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.c b/EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.c
deleted file mode 100644
index 086dbe3b2e..0000000000
--- a/EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/** @file
- Implementation of Legacy Region 2 Protocol based on Framework Legacy Region Protocol.
-
- Intel's Framework Legacy Region Protocol is replaced by Legacy Region 2 Protocol in PI 1.2.
- This module produces PI Legacy Region 2 Protocol on top of Framework Legacy Region Protocol.
-
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "LegacyRegion2OnLegacyRegionThunk.h"
-
-EFI_HANDLE mLegacyRegion2Handle = NULL;
-
-EFI_LEGACY_REGION_PROTOCOL *mLegacyRegion;
-
-EFI_LEGACY_REGION2_PROTOCOL mLegacyRegion2 = {
- LegacyRegion2Decode,
- LegacyRegion2Lock,
- LegacyRegion2BootLock,
- LegacyRegion2Unlock,
- LegacyRegionGetInfo
-};
-
-/**
- Modify the hardware to allow (decode) or disallow (not decode) memory reads in a region.
-
- If the On parameter evaluates to TRUE, this function enables memory reads in the address range
- Start to (Start + Length - 1).
- If the On parameter evaluates to FALSE, this function disables memory reads in the address range
- Start to (Start + Length - 1).
-
- @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
- @param Start[in] The beginning of the physical address of the region whose attributes
- should be modified.
- @param Length[in] The number of bytes of memory whose attributes should be modified.
- The actual number of bytes modified may be greater than the number
- specified.
- @param Granularity[out] The number of bytes in the last region affected. This may be less
- than the total number of bytes affected if the starting address
- was not aligned to a region's starting address or if the length
- was greater than the number of bytes in the first region.
- @param On[in] Decode / Non-Decode flag.
-
- @retval EFI_SUCCESS The region's attributes were successfully modified.
- @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
-
-**/
-EFI_STATUS
-EFIAPI
-LegacyRegion2Decode (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- IN UINT32 Start,
- IN UINT32 Length,
- OUT UINT32 *Granularity,
- IN BOOLEAN *On
- )
-{
- if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) {
- return EFI_INVALID_PARAMETER;
- }
-
- ASSERT (Granularity != NULL);
- *Granularity = 0;
-
- return mLegacyRegion->Decode (
- mLegacyRegion,
- Start,
- Length,
- On
- );
-}
-
-/**
- Modify the hardware to disallow memory writes in a region.
-
- This function changes the attributes of a memory range to not allow writes.
-
- @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
- @param Start[in] The beginning of the physical address of the region whose
- attributes should be modified.
- @param Length[in] The number of bytes of memory whose attributes should be modified.
- The actual number of bytes modified may be greater than the number
- specified.
- @param Granularity[out] The number of bytes in the last region affected. This may be less
- than the total number of bytes affected if the starting address was
- not aligned to a region's starting address or if the length was
- greater than the number of bytes in the first region.
-
- @retval EFI_SUCCESS The region's attributes were successfully modified.
- @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
-
-**/
-EFI_STATUS
-EFIAPI
-LegacyRegion2Lock (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- IN UINT32 Start,
- IN UINT32 Length,
- OUT UINT32 *Granularity
- )
-{
- if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) {
- return EFI_INVALID_PARAMETER;
- }
-
- ASSERT (Granularity != NULL);
-
- return mLegacyRegion->Lock (
- mLegacyRegion,
- Start,
- Length,
- Granularity
- );
-}
-
-/**
- Modify the hardware to disallow memory attribute changes in a region.
-
- This function makes the attributes of a region read only. Once a region is boot-locked with this
- function, the read and write attributes of that region cannot be changed until a power cycle has
- reset the boot-lock attribute. Calls to Decode(), Lock() and Unlock() will have no effect.
-
- @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
- @param Start[in] The beginning of the physical address of the region whose
- attributes should be modified.
- @param Length[in] The number of bytes of memory whose attributes should be modified.
- The actual number of bytes modified may be greater than the number
- specified.
- @param Granularity[out] The number of bytes in the last region affected. This may be less
- than the total number of bytes affected if the starting address was
- not aligned to a region's starting address or if the length was
- greater than the number of bytes in the first region.
-
- @retval EFI_SUCCESS The region's attributes were successfully modified.
- @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
- @retval EFI_UNSUPPORTED The chipset does not support locking the configuration registers in
- a way that will not affect memory regions outside the legacy memory
- region.
-
-**/
-EFI_STATUS
-EFIAPI
-LegacyRegion2BootLock (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- IN UINT32 Start,
- IN UINT32 Length,
- OUT UINT32 *Granularity
- )
-{
- if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // PI Legacy Region 2 Protocol and Framework Legacy Region Protocol have different
- // semantic of BootLock() API, so we cannot thunk to Framework Legacy Region Protocol
- // to produce the functionality of PI version. In addition, this functionality is
- // chipset dependent, so here we return EFI_UNSUPPORTED, which is a valid return status
- // code specified by PI spec.
- //
- return EFI_UNSUPPORTED;
-}
-
-/**
- Modify the hardware to allow memory writes in a region.
-
- This function changes the attributes of a memory range to allow writes.
-
- @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
- @param Start[in] The beginning of the physical address of the region whose
- attributes should be modified.
- @param Length[in] The number of bytes of memory whose attributes should be modified.
- The actual number of bytes modified may be greater than the number
- specified.
- @param Granularity[out] The number of bytes in the last region affected. This may be less
- than the total number of bytes affected if the starting address was
- not aligned to a region's starting address or if the length was
- greater than the number of bytes in the first region.
-
- @retval EFI_SUCCESS The region's attributes were successfully modified.
- @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
-
-**/
-EFI_STATUS
-EFIAPI
-LegacyRegion2Unlock (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- IN UINT32 Start,
- IN UINT32 Length,
- OUT UINT32 *Granularity
- )
-{
- if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) {
- return EFI_INVALID_PARAMETER;
- }
-
- ASSERT (Granularity != NULL);
-
- return mLegacyRegion->UnLock (
- mLegacyRegion,
- Start,
- Length,
- Granularity
- );
-}
-
-/**
- Get region information for the attributes of the Legacy Region.
-
- This function is used to discover the granularity of the attributes for the memory in the legacy
- region. Each attribute may have a different granularity and the granularity may not be the same
- for all memory ranges in the legacy region.
-
- @param This[in] Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.
- @param DescriptorCount[out] The number of region descriptor entries returned in the Descriptor
- buffer.
- @param Descriptor[out] A pointer to a pointer used to return a buffer where the legacy
- region information is deposited. This buffer will contain a list of
- DescriptorCount number of region descriptors. This function will
- provide the memory for the buffer.
-
- @retval EFI_SUCCESS The information structure was returned.
- @retval EFI_UNSUPPORTED This function is not supported.
-
-**/
-EFI_STATUS
-EFIAPI
-LegacyRegionGetInfo (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- OUT UINT32 *DescriptorCount,
- OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-/**
- The user Entry Point for module LegacyRegionDxe. The user code starts with this function.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-LegacyRegion2OnLegacyRegionThunkInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- //
- // Make sure the Legacy Region 2 Protocol is not already installed in the system
- //
- ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiLegacyRegion2ProtocolGuid);
-
- //
- // Locate and cache Framework Legacy Region Protocol.
- //
- Status = gBS->LocateProtocol (
- &gEfiLegacyRegionProtocolGuid,
- NULL,
- (VOID **) &mLegacyRegion
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Install the protocol on a new handle.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mLegacyRegion2Handle,
- &gEfiLegacyRegion2ProtocolGuid, &mLegacyRegion2,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.h b/EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.h
deleted file mode 100644
index 148458c099..0000000000
--- a/EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/** @file
- Internal include file for the Legacy Region 2 Protocol thunk driver.
-
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#ifndef __LEGACY_REGION2_ON_LEGACY_REGION_H__
-#define __LEGACY_REGION2_ON_LEGACY_REGION_H__
-
-#include <Protocol/LegacyRegion2.h>
-#include <Protocol/LegacyRegion.h>
-
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-/**
- Modify the hardware to allow (decode) or disallow (not decode) memory reads in a region.
-
- If the On parameter evaluates to TRUE, this function enables memory reads in the address range
- Start to (Start + Length - 1).
- If the On parameter evaluates to FALSE, this function disables memory reads in the address range
- Start to (Start + Length - 1).
-
- @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
- @param Start[in] The beginning of the physical address of the region whose attributes
- should be modified.
- @param Length[in] The number of bytes of memory whose attributes should be modified.
- The actual number of bytes modified may be greater than the number
- specified.
- @param Granularity[out] The number of bytes in the last region affected. This may be less
- than the total number of bytes affected if the starting address
- was not aligned to a region's starting address or if the length
- was greater than the number of bytes in the first region.
- @param On[in] Decode / Non-Decode flag.
-
- @retval EFI_SUCCESS The region's attributes were successfully modified.
- @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
-
-**/
-EFI_STATUS
-EFIAPI
-LegacyRegion2Decode (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- IN UINT32 Start,
- IN UINT32 Length,
- OUT UINT32 *Granularity,
- IN BOOLEAN *On
- );
-
-/**
- Modify the hardware to disallow memory writes in a region.
-
- This function changes the attributes of a memory range to not allow writes.
-
- @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
- @param Start[in] The beginning of the physical address of the region whose
- attributes should be modified.
- @param Length[in] The number of bytes of memory whose attributes should be modified.
- The actual number of bytes modified may be greater than the number
- specified.
- @param Granularity[out] The number of bytes in the last region affected. This may be less
- than the total number of bytes affected if the starting address was
- not aligned to a region's starting address or if the length was
- greater than the number of bytes in the first region.
-
- @retval EFI_SUCCESS The region's attributes were successfully modified.
- @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
-
-**/
-EFI_STATUS
-EFIAPI
-LegacyRegion2Lock (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- IN UINT32 Start,
- IN UINT32 Length,
- OUT UINT32 *Granularity
- );
-
-/**
- Modify the hardware to disallow memory attribute changes in a region.
-
- This function makes the attributes of a region read only. Once a region is boot-locked with this
- function, the read and write attributes of that region cannot be changed until a power cycle has
- reset the boot-lock attribute. Calls to Decode(), Lock() and Unlock() will have no effect.
-
- @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
- @param Start[in] The beginning of the physical address of the region whose
- attributes should be modified.
- @param Length[in] The number of bytes of memory whose attributes should be modified.
- The actual number of bytes modified may be greater than the number
- specified.
- @param Granularity[out] The number of bytes in the last region affected. This may be less
- than the total number of bytes affected if the starting address was
- not aligned to a region's starting address or if the length was
- greater than the number of bytes in the first region.
-
- @retval EFI_SUCCESS The region's attributes were successfully modified.
- @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
- @retval EFI_UNSUPPORTED The chipset does not support locking the configuration registers in
- a way that will not affect memory regions outside the legacy memory
- region.
-
-**/
-EFI_STATUS
-EFIAPI
-LegacyRegion2BootLock (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- IN UINT32 Start,
- IN UINT32 Length,
- OUT UINT32 *Granularity
- );
-
-/**
- Modify the hardware to allow memory writes in a region.
-
- This function changes the attributes of a memory range to allow writes.
-
- @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
- @param Start[in] The beginning of the physical address of the region whose
- attributes should be modified.
- @param Length[in] The number of bytes of memory whose attributes should be modified.
- The actual number of bytes modified may be greater than the number
- specified.
- @param Granularity[out] The number of bytes in the last region affected. This may be less
- than the total number of bytes affected if the starting address was
- not aligned to a region's starting address or if the length was
- greater than the number of bytes in the first region.
-
- @retval EFI_SUCCESS The region's attributes were successfully modified.
- @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
-
-**/
-EFI_STATUS
-EFIAPI
-LegacyRegion2Unlock (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- IN UINT32 Start,
- IN UINT32 Length,
- OUT UINT32 *Granularity
- );
-
-/**
- Get region information for the attributes of the Legacy Region.
-
- This function is used to discover the granularity of the attributes for the memory in the legacy
- region. Each attribute may have a different granularity and the granularity may not be the same
- for all memory ranges in the legacy region.
-
- @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
- @param DescriptorCount[out] The number of region descriptor entries returned in the Descriptor
- buffer.
- @param Descriptor[out] A pointer to a pointer used to return a buffer where the legacy
- region information is deposited. This buffer will contain a list of
- DescriptorCount number of region descriptors. This function will
- provide the memory for the buffer.
-
- @retval EFI_SUCCESS The region's attributes were successfully modified.
- @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
-
-**/
-EFI_STATUS
-EFIAPI
-LegacyRegionGetInfo (
- IN EFI_LEGACY_REGION2_PROTOCOL *This,
- OUT UINT32 *DescriptorCount,
- OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor
- );
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.inf b/EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.inf
deleted file mode 100644
index ca6668a5b1..0000000000
--- a/EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.inf
+++ /dev/null
@@ -1,53 +0,0 @@
-## @file
-# Implementation of Legacy Region 2 Protocol based on Framework Legacy Region Protocol.
-#
-# Intel's Framework Legacy Region Protocol is replaced by Legacy Region 2 Protocol in PI 1.2.
-# This module produces PI Legacy Region 2 Protocol on top of Framework Legacy Region Protocol.
-#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = LegacyRegion2OnLegacyRegionThunk
- FILE_GUID = 5167FD5D-AAA2-4FE1-9D0D-5CFCAB36C14C
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = LegacyRegion2OnLegacyRegionThunkInitialize
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- LegacyRegion2OnLegacyRegionThunk.c
- LegacyRegion2OnLegacyRegionThunk.h
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- DebugLib
- UefiBootServicesTableLib
-
-[Protocols]
- gEfiLegacyRegion2ProtocolGuid ## PRODUCES
- gEfiLegacyRegionProtocolGuid ## CONSUMES
-
-[Depex]
- gEfiLegacyRegionProtocolGuid
diff --git a/EdkCompatibilityPkg/Compatibility/Library/UefiLanguageLib/UefiLanguageLib.c b/EdkCompatibilityPkg/Compatibility/Library/UefiLanguageLib/UefiLanguageLib.c
deleted file mode 100644
index 781689f2c7..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Library/UefiLanguageLib/UefiLanguageLib.c
+++ /dev/null
@@ -1,501 +0,0 @@
-/** @file
- Language Library implementation that provides functions for language conversion
- between ISO 639-2 and RFC 4646 language codes.
-
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-
-#include <Uefi.h>
-
-#include <Library/LanguageLib.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-//
-// Lookup table of ISO639-2 3 character language codes to ISO 639-1 2 character language codes
-// Each entry is 5 CHAR8 values long. The first 3 CHAR8 values are the ISO 639-2 code.
-// The last 2 CHAR8 values are the ISO 639-1 code.
-//
-// ISO 639-2 B codes and deprecated ISO 639-1 codes are not supported.
-//
-// Commonly used language codes such as English and French are put in the front of the table for quick match.
-//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mIso639ToRfc4646ConversionTable[] =
-"\
-engen\
-frafr\
-aaraa\
-abkab\
-aveae\
-afraf\
-akaak\
-amham\
-argan\
-araar\
-asmas\
-avaav\
-aymay\
-azeaz\
-bakba\
-belbe\
-bulbg\
-bihbh\
-bisbi\
-bambm\
-benbn\
-bodbo\
-brebr\
-bosbs\
-catca\
-chece\
-chach\
-cosco\
-crecr\
-cescs\
-chucu\
-chvcv\
-cymcy\
-danda\
-deude\
-divdv\
-dzodz\
-eweee\
-ellel\
-epoeo\
-spaes\
-estet\
-euseu\
-fasfa\
-fulff\
-finfi\
-fijfj\
-faofo\
-fryfy\
-glega\
-glagd\
-glggl\
-grngn\
-gujgu\
-glvgv\
-hauha\
-hebhe\
-hinhi\
-hmoho\
-hrvhr\
-hatht\
-hunhu\
-hyehy\
-herhz\
-inaia\
-indid\
-ileie\
-iboig\
-iiiii\
-ipkik\
-idoio\
-islis\
-itait\
-ikuiu\
-jpnja\
-javjv\
-katka\
-konkg\
-kikki\
-kuakj\
-kazkk\
-kalkl\
-khmkm\
-kankn\
-korko\
-kaukr\
-kasks\
-kurku\
-komkv\
-corkw\
-kirky\
-latla\
-ltzlb\
-luglg\
-limli\
-linln\
-laolo\
-litlt\
-lublu\
-lavlv\
-mlgmg\
-mahmh\
-mrimi\
-mkdmk\
-malml\
-monmn\
-marmr\
-msams\
-mltmt\
-myamy\
-nauna\
-nobnb\
-ndend\
-nepne\
-ndong\
-nldnl\
-nnonn\
-norno\
-nblnr\
-navnv\
-nyany\
-ocioc\
-ojioj\
-ormom\
-orior\
-ossos\
-panpa\
-plipi\
-polpl\
-pusps\
-porpt\
-quequ\
-rohrm\
-runrn\
-ronro\
-rusru\
-kinrw\
-sansa\
-srdsc\
-sndsd\
-smese\
-sagsg\
-sinsi\
-slksk\
-slvsl\
-smosm\
-snasn\
-somso\
-sqisq\
-srpsr\
-sswss\
-sotst\
-sunsu\
-swesv\
-swasw\
-tamta\
-telte\
-tgktg\
-thath\
-tirti\
-tuktk\
-tgltl\
-tsntn\
-tonto\
-turtr\
-tsots\
-tattt\
-twitw\
-tahty\
-uigug\
-ukruk\
-urdur\
-uzbuz\
-venve\
-vievi\
-volvo\
-wlnwa\
-wolwo\
-xhoxh\
-yidyi\
-yoryo\
-zhaza\
-zhozh\
-zulzu\
-";
-
-/**
- Converts upper case ASCII characters in an ASCII string to lower case ASCII
- characters in an ASCII string.
-
- If a an ASCII character in Source is in the range 'A'..'Z', then it is converted
- to an ASCII character in the range 'a'..'z' in Destination. Otherwise, no
- conversion is performed. Length ASCII characters from Source are convertered and
- stored in Destination.
-
- @param Destination An ASCII string to store the results of the conversion.
- @param Source The source ASCII string of the conversion.
- @param Length The number of ASCII characters to convert.
-
-**/
-VOID
-EFIAPI
-InternalLanguageLibToLower (
- OUT CHAR8 *Destination,
- IN CONST CHAR8 *Source,
- IN UINTN Length
- )
-{
- for (; Length > 0; Length--, Destination++, Source++) {
- *Destination = (CHAR8)((*Source >= 'A' && *Source <= 'Z') ? *Source + ('a' - 'A') : *Source);
- }
-}
-
-/**
- Convert an ISO 639-2 language code to a RFC 4646 language code.
- If the ISO 639-2 language code has a corresponding ISO 639-1 code, then the ISO 639-1
- code is returned. Else the original ISO 639-2 code is returned. The returned RFC 4646
- language code is composed of only a primary language subtag.
-
- If Iso639Language is NULL, then ASSERT.
- If Rfc4646Language is NULL, then ASSERT.
-
- @param[out] Rfc4646Language Pointers to a buffer large enough for an ASCII string
- which reprsents a RFC 4646 language code containging only
- either a ISO 639-1 or ISO 639-2 primary language subtag.
- This string is Null-terminated.
- @param[in] Iso639Language Pointer to a 3-letter ASCII string which represents
- an ISO 639-2 language code. This string is not required
- to be Null-terminated.
-
- @retval TRUE The ISO 639-2 language code was converted to a ISO 639-1 code.
- @retval FALSE The language code does not have corresponding ISO 639-1 code.
-
-**/
-BOOLEAN
-EFIAPI
-ConvertIso639ToRfc4646 (
- OUT CHAR8 *Rfc4646Language,
- IN CONST CHAR8 *Iso639Language
- )
-{
- CONST CHAR8 *Match;
-
- ASSERT (Iso639Language != NULL);
- ASSERT (Rfc4646Language != NULL);
-
- //
- // Convert first 3 characters of Iso639Language to lower case ASCII characters in Rfc4646Language
- //
- InternalLanguageLibToLower (Rfc4646Language, Iso639Language, 3);
- Rfc4646Language[3] = '\0';
-
- Match = mIso639ToRfc4646ConversionTable;
- do {
- Match = AsciiStrStr (Match, Rfc4646Language);
- if (Match == NULL) {
- return FALSE;
- }
- if (((Match - mIso639ToRfc4646ConversionTable) % 5) == 0) {
- break;
- }
- ++Match;
- } while (TRUE);
- Rfc4646Language[0] = Match[3];
- Rfc4646Language[1] = Match[4];
- Rfc4646Language[2] = '\0';
- return TRUE;
-}
-
-/**
- Convert a RFC 4646 language code to an ISO 639-2 language code. The primary language
- subtag of the RFC 4646 code must be either an ISO 639-1 or 639-2 code. If the primary
- language subtag is an ISO 639-1 code, then it is converted to its corresponding ISO 639-2
- code (T code if applies). Else the ISO 639-2 code is returned.
-
- If Rfc4646Language is NULL, then ASSERT.
- If Iso639Language is NULL, then ASSERT.
-
- @param[out] Iso639Language Pointers to a buffer large enough for a 3-letter ASCII string
- which reprsents an ISO 639-2 language code. The string is Null-terminated.
- @param[in] Rfc4646Language Pointer to a RFC 4646 language code string. This string is terminated
- by a NULL or a ';' character.
-
- @retval TRUE Language code converted successfully.
- @retval FALSE The RFC 4646 language code is invalid or unsupported.
-
-**/
-BOOLEAN
-EFIAPI
-ConvertRfc4646ToIso639 (
- OUT CHAR8 *Iso639Language,
- IN CONST CHAR8 *Rfc4646Language
- )
-{
- CONST CHAR8 *Match;
-
- ASSERT (Rfc4646Language != NULL);
- ASSERT (Iso639Language != NULL);
-
- //
- // RFC 4646 language code check before determining
- // if the primary language subtag is ISO 639-1 or 639-2 code
- //
- if (Rfc4646Language[0] == '\0' || Rfc4646Language[1] == '\0') {
- return FALSE;
- }
-
- //
- // Check if the primary language subtag is ISO 639-1 code
- //
- if (Rfc4646Language[2] == ';' || Rfc4646Language[2] == '-' || Rfc4646Language[2] == '\0') {
- //
- // Convert first 2 characters of Rfc4646Language to lower case ASCII characters in Iso639Language
- //
- InternalLanguageLibToLower (Iso639Language, Rfc4646Language, 2);
- //
- // Convert ISO 639-1 code to ISO 639-2 code
- //
- Iso639Language[2] = '\0';
- Match = mIso639ToRfc4646ConversionTable;
- do {
- Match = AsciiStrStr (Match, Iso639Language);
- if (Match == NULL) {
- return FALSE;
- }
- if (((Match - mIso639ToRfc4646ConversionTable) % 5) == 3) {
- break;
- }
- ++Match;
- } while (TRUE);
- Rfc4646Language = Match - 3;
- } else if (!(Rfc4646Language[3] == ';' || Rfc4646Language[3] == '-' || Rfc4646Language[3] == '\0')) {
- return FALSE;
- }
- Iso639Language[0] = Rfc4646Language[0];
- Iso639Language[1] = Rfc4646Language[1];
- Iso639Language[2] = Rfc4646Language[2];
- Iso639Language[3] = '\0';
- return TRUE;
-}
-
-/**
- Convert ISO 639-2 language codes to RFC 4646 codes and return the converted codes.
- Caller is responsible for freeing the allocated buffer.
-
- If Iso639Languages is NULL, then ASSERT.
-
- @param[in] Iso639Languages Pointers to a Null-terminated ISO 639-2 language codes string containing
- one or more ISO 639-2 3-letter language codes.
-
- @retval NULL Invalid ISO 639-2 language code found.
- @retval NULL Out of memory.
- @return Pointer to the allocate buffer containing the Null-terminated converted language codes string.
- This string is composed of one or more RFC4646 language codes each of which has only
- ISO 639-1 2-letter primary language subtag.
-
-**/
-CHAR8 *
-EFIAPI
-ConvertLanguagesIso639ToRfc4646 (
- IN CONST CHAR8 *Iso639Languages
- )
-{
- UINTN Length;
- UINTN Iso639Index;
- UINTN Rfc4646Index;
- CHAR8 *Rfc4646Languages;
-
- ASSERT (Iso639Languages != NULL);
-
- //
- // The length of ISO 639-2 lanugage codes string must be multiple of 3
- //
- Length = AsciiStrLen (Iso639Languages);
- if (Length % 3 != 0) {
- return NULL;
- }
-
- //
- // Allocate buffer for RFC 4646 language codes string
- //
- Rfc4646Languages = AllocatePool (Length + (Length / 3));
- if (Rfc4646Languages == NULL) {
- return NULL;
- }
-
- for (Iso639Index = 0, Rfc4646Index = 0; Iso639Languages[Iso639Index] != '\0'; Iso639Index += 3) {
- if (ConvertIso639ToRfc4646 (&Rfc4646Languages[Rfc4646Index], &Iso639Languages[Iso639Index])) {
- Rfc4646Index += 2;
- } else {
- Rfc4646Index += 3;
- }
- Rfc4646Languages[Rfc4646Index++] = ';';
- }
- Rfc4646Languages[Rfc4646Index - 1] = '\0';
- return Rfc4646Languages;
-}
-
-/**
- Convert RFC 4646 language codes to ISO 639-2 codes and return the converted codes.
- The primary language subtag of the RFC 4646 code must be either an ISO 639-1 or 639-2 code.
- Caller is responsible for freeing the allocated buffer.
-
- If Rfc4646Languages is NULL, then ASSERT.
-
- @param[in] Rfc4646Languages Pointers to a Null-terminated RFC 4646 language codes string containing
- one or more RFC 4646 language codes.
-
- @retval NULL Invalid or unsupported RFC 4646 language code found.
- @retval NULL Out of memory.
- @return Pointer to the allocate buffer containing the Null-terminated converted language codes string.
- This string is composed of one or more ISO 639-2 language codes.
-
-**/
-CHAR8 *
-EFIAPI
-ConvertLanguagesRfc4646ToIso639 (
- IN CONST CHAR8 *Rfc4646Languages
- )
-{
- UINTN NumLanguages;
- UINTN Iso639Index;
- UINTN Rfc4646Index;
- CHAR8 *Iso639Languages;
-
- ASSERT (Rfc4646Languages != NULL);
-
- //
- // Determine the number of languages in the RFC 4646 language codes string
- //
- for (Rfc4646Index = 0, NumLanguages = 1; Rfc4646Languages[Rfc4646Index] != '\0'; Rfc4646Index++) {
- if (Rfc4646Languages[Rfc4646Index] == ';') {
- NumLanguages++;
- }
- }
-
- //
- // Allocate buffer for ISO 639-2 language codes string
- //
- Iso639Languages = AllocateZeroPool (NumLanguages * 3 + 1);
- if (Iso639Languages == NULL) {
- return NULL;
- }
-
- //
- // Do the conversion for each RFC 4646 language code
- //
- for (Rfc4646Index = 0, Iso639Index = 0; Rfc4646Languages[Rfc4646Index] != '\0';) {
- if (ConvertRfc4646ToIso639 (&Iso639Languages[Iso639Index], &Rfc4646Languages[Rfc4646Index])) {
- Iso639Index += 3;
- } else {
- FreePool (Iso639Languages);
- return NULL;
- }
- //
- // Locate next language code
- //
- while (Rfc4646Languages[Rfc4646Index] != ';' && Rfc4646Languages[Rfc4646Index] != '\0') {
- Rfc4646Index++;
- }
- if (Rfc4646Languages[Rfc4646Index] == ';') {
- Rfc4646Index++;
- }
- }
- Iso639Languages[Iso639Index] = '\0';
- return Iso639Languages;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/Library/UefiLanguageLib/UefiLanguageLib.inf b/EdkCompatibilityPkg/Compatibility/Library/UefiLanguageLib/UefiLanguageLib.inf
deleted file mode 100644
index a4324734d5..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Library/UefiLanguageLib/UefiLanguageLib.inf
+++ /dev/null
@@ -1,41 +0,0 @@
-## @file
-# Instance of Language Library.
-#
-# The Language Library implementation that provides functions for language conversion
-# between ISO 639-2 and RFC 4646 language codes.
-#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = UefiLanguageLib
- FILE_GUID = 283cad13-a151-4d55-be2d-96ea57392a82
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = LanguageLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_APPLICATION UEFI_DRIVER
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- UefiLanguageLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- BaseLib
- DebugLib
- MemoryAllocationLib
diff --git a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/AsmInclude.inc b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/AsmInclude.inc
deleted file mode 100644
index ab2443c79e..0000000000
--- a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/AsmInclude.inc
+++ /dev/null
@@ -1,26 +0,0 @@
-;------------------------------------------------------------------------------
-; Include file for IA32 MpFuncs.asm
-;
-; Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-; 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.
-;
-;------------------------------------------------------------------------------
-
-VacantFlag Equ 00h
-NotVacantFlag Equ 0ffh
-
-LockLocation equ RendezvousFunnelProcEnd - RendezvousFunnelProcStart
-StackStart equ LockLocation + 4h
-StackSize equ LockLocation + 8h
-RendezvousProc equ LockLocation + 0Ch
-GdtrProfile equ LockLocation + 10h
-IdtrProfile equ LockLocation + 16h
-BufferStart equ LockLocation + 1Ch
-ProcessorNumber equ LockLocation + 20h
-;-------------------------------------------------------------------------------
diff --git a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.S b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.S
deleted file mode 100644
index 84fd473292..0000000000
--- a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.S
+++ /dev/null
@@ -1,174 +0,0 @@
-#------------------------------------------------------------------------------
-# IA32 assembly file for AP startup vector.
-#
-# Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
-# 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.
-#
-#------------------------------------------------------------------------------
-
-#define VacantFlag 0x0
-#define NotVacantFlag 0xff
-
-#define LockLocation RendezvousFunnelProcEnd - RendezvousFunnelProcStart
-#define StackStart RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x04
-#define StackSize RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x08
-#define RendezvousProc RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x0C
-#define GdtrProfile RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x10
-#define IdtrProfile RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x16
-#define BufferStart RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x1C
-#define ProcessorNumber RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x20
-
-#-------------------------------------------------------------------------------------
-#RendezvousFunnelProc procedure follows. All APs execute their procedure. This
-#procedure serializes all the AP processors through an Init sequence. It must be
-#noted that APs arrive here very raw...ie: real mode, no stack.
-#ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC
-#IS IN MACHINE CODE.
-#-------------------------------------------------------------------------------------
-#RendezvousFunnelProc (&WakeUpBuffer,MemAddress);
-
-ASM_GLOBAL ASM_PFX(RendezvousFunnelProc)
-ASM_PFX(RendezvousFunnelProc):
-RendezvousFunnelProcStart:
-
-
-# At this point CS = 0x(vv00) and ip= 0x0.
-
- .byte 0x8c,0xc8 # mov ax, cs
- .byte 0x8e,0xd8 # mov ds, ax
- .byte 0x8e,0xc0 # mov es, ax
- .byte 0x8e,0xd0 # mov ss, ax
- .byte 0x33,0xc0 # xor ax, ax
- .byte 0x8e,0xe0 # mov fs, ax
- .byte 0x8e,0xe8 # mov gs, ax
-
-# Switch to flat mode.
-
- .byte 0xBE
- .word BufferStart
- .byte 0x66,0x8B,0xC # mov ecx,dword ptr [si] ; ECX is keeping the start address of wakeup buffer
-
- .byte 0xFA # cli
- .byte 0xBE
- .word GdtrProfile
- .byte 0x66 # db 66h
- .byte 0x2E,0xF,0x1,0x14 # lgdt fword ptr cs:[si]
-
- .byte 0xBE
- .word IdtrProfile
- .byte 0x66 # db 66h
- .byte 0x2E,0xF,0x1,0x1C # lidt fword ptr cs:[si]
-
- .byte 0x33,0xC0 # xor ax, ax
- .byte 0x8E,0xD8 # mov ds, ax
- .byte 0xF,0x20,0xC0 # mov eax, cr0 ; Get control register 0
- .byte 0x66,0x83,0xC8,0x1 # or eax, 000000001h ; Set PE bit (bit #0)
- .byte 0xF,0x22,0xC0 # mov cr0, eax
-
-
-#step-4:
-
-FLAT32_JUMP:
- .byte 0x66
- .byte 0x67
- .byte 0xEA # far jump
- .long 0x0
- .word 0x10
-
-ProtectedModeStart: # protected mode entry point
-
- movw $0x8,%ax
- .byte 0x66
- movw %ax,%ds
- .byte 0x66
- movw %ax,%es
- .byte 0x66
- movw %ax,%fs
- .byte 0x66
- movw %ax,%gs
- .byte 0x66
- movw %ax,%ss # Flat mode setup.
-
- #
- # ProgramStack
- #
- movl $0x1b, %ecx
- rdmsr
-
- btl $10, %eax # Check for x2apic mode
- jnc LegacyApicMode
- movl $0x802, %ecx # Read APIC_ID
- rdmsr
- movl %eax, %ebx # ebx == apicid
- jmp GetCpuNumber
-
-LegacyApicMode:
- andl $0xfffff000, %eax
- addl $0x20, %eax
- movl (%eax), %ebx
- shrl $24, %ebx # ebx == apicid
-
-GetCpuNumber:
- xorl %ecx, %ecx
- movl %esi,%edi
- addl $ProcessorNumber, %edi
- movl (%edi, %ebx, 4), %ecx
-
- movl %esi,%edi
- addl $StackSize, %edi
- movl (%edi), %eax
- incl %ecx
- mull %ecx
-
- movl %esi,%edi
- addl $StackStart, %edi
- movl (%edi), %ebx
- addl %ebx, %eax
-
- movl %eax, %esp
-
- #
- # Call C Function
- #
- movl %esi,%edi
- addl $RendezvousProc, %edi
- movl (%edi), %ebx
-
- testl %ebx,%ebx
- jz GoToSleep
- call *%ebx # Call C function
-
-#Step-6: Sleep
-
-GoToSleep:
-
- cli
- hlt
- jmp GoToSleep
-
-RendezvousFunnelProcEnd:
-#-------------------------------------------------------------------------------------
-# AsmGetAddressMap (&AddressMap);
-#-------------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(AsmGetAddressMap)
-ASM_PFX(AsmGetAddressMap):
-
- pushal
- movl %esp,%ebp
-
- movl 0x24(%ebp), %ebx
- movl $RendezvousFunnelProcStart, (%ebx)
- movl $(ProtectedModeStart - RendezvousFunnelProcStart), 0x4(%ebx)
- movl $(FLAT32_JUMP - RendezvousFunnelProcStart), 0x8(%ebx)
- movl $0, 0x0c(%ebx)
- movl $0, 0x10(%ebx)
- movl $(RendezvousFunnelProcEnd - RendezvousFunnelProcStart), 0x14(%ebx)
-
- popal
- ret
diff --git a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.asm b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.asm
deleted file mode 100644
index 8c4728f68c..0000000000
--- a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.asm
+++ /dev/null
@@ -1,167 +0,0 @@
-;------------------------------------------------------------------------------
-; IA32 assembly file for AP startup vector.
-;
-; Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-; 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.
-;
-;------------------------------------------------------------------------------
-
-.686p
-.model flat
-.code
-
-include AsmInclude.inc
-;-------------------------------------------------------------------------------------
-FJMP32 MACRO Selector, Offset
- DB 066h
- DB 067h
- DB 0EAh ; far jump
- DD Offset ; 32-bit offset
- DW Selector ; 16-bit selector
- ENDM
-
-;-------------------------------------------------------------------------------------
-;RendezvousFunnelProc procedure follows. All APs execute their procedure. This
-;procedure serializes all the AP processors through an Init sequence. It must be
-;noted that APs arrive here very raw...ie: real mode, no stack.
-;ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC
-;IS IN MACHINE CODE.
-;-------------------------------------------------------------------------------------
-;RendezvousFunnelProc (&WakeUpBuffer,MemAddress);
-
-RendezvousFunnelProc PROC near C PUBLIC
-RendezvousFunnelProcStart::
-
-
-; At this point CS = 0x(vv00) and ip= 0x0.
-
- db 8ch, 0c8h ; mov ax, cs
- db 8eh, 0d8h ; mov ds, ax
- db 8eh, 0c0h ; mov es, ax
- db 8eh, 0d0h ; mov ss, ax
- db 33h, 0c0h ; xor ax, ax
- db 8eh, 0e0h ; mov fs, ax
- db 8eh, 0e8h ; mov gs, ax
-
-; Switch to flat mode.
-
- db 0BEh
- dw BufferStart ; mov si, BufferStart
- db 66h, 8Bh, 0Ch ; mov ecx,dword ptr [si] ; ECX is keeping the start address of wakeup buffer
-
- db 0FAh ; cli
- db 0BEh
- dw GdtrProfile ; mov si, GdtrProfile
- db 66h ; db 66h
- db 2Eh,0Fh, 01h, 14h ; lgdt fword ptr cs:[si]
-
- db 0BEh
- dw IdtrProfile ; mov si, IdtrProfile
- db 66h ; db 66h
- db 2Eh,0Fh, 01h, 1Ch ; lidt fword ptr cs:[si]
-
- db 33h, 0C0h ; xor ax, ax
- db 8Eh, 0D8h ; mov ds, ax
- db 0Fh, 20h, 0C0h ; mov eax, cr0 ; Get control register 0
- db 66h, 83h, 0C8h, 01h ; or eax, 000000001h ; Set PE bit (bit #0)
- db 0Fh, 22h, 0C0h ; mov cr0, eax
-
-
-FLAT32_JUMP::
- FJMP32 010h,0h ; Far jmp using code segment descriptor
-
-ProtectedModeStart:: ; protected mode entry point
-
- mov ax, 8h
- mov ds, ax
- mov es, ax
- mov fs, ax
- mov gs, ax
- mov ss, ax ; Flat mode setup.
-
- ;
- ; ProgramStack
- ;
- mov ecx, 1bh ; Read IA32_APIC_BASE MSR
- rdmsr
-
- bt eax, 10 ; Check for x2apic mode
- jnc LegacyApicMode
- mov ecx, 802h ; Read APIC_ID
- rdmsr
- mov ebx, eax ; ebx == apicid
- jmp GetCpuNumber
-
-LegacyApicMode::
-
- and eax, 0fffff000h
- add eax, 20h
- mov ebx, dword ptr [eax]
- shr ebx, 24 ; ebx == apicid
-
-GetCpuNumber::
-
- xor ecx, ecx
- mov edi, esi
- add edi, ProcessorNumber
- mov ecx, dword ptr [edi + 4 * ebx] ; ECX = CpuNumber
-
- mov edi, esi
- add edi, StackSize
- mov eax, dword ptr [edi]
- inc ecx
- mul ecx ; EAX = StackSize * (CpuNumber + 1)
-
- mov edi, esi
- add edi, StackStart
- mov ebx, dword ptr [edi]
- add eax, ebx ; EAX = StackStart + StackSize * (CpuNumber + 1)
-
- mov esp, eax
-
- ;
- ; Call C Function
- ;
- mov edi, esi
- add edi, RendezvousProc
- mov ebx, dword ptr [edi]
-
- test ebx, ebx
- jz GoToSleep
- call ebx ; Call C function
-
-GoToSleep::
-
- cli
- hlt
- jmp $-2
-
-RendezvousFunnelProc ENDP
-RendezvousFunnelProcEnd::
-;-------------------------------------------------------------------------------------
-; AsmGetAddressMap (&AddressMap);
-;-------------------------------------------------------------------------------------
-AsmGetAddressMap PROC near C PUBLIC
-
- pushad
- mov ebp,esp
-
- mov ebx, dword ptr [ebp+24h]
- mov dword ptr [ebx], RendezvousFunnelProcStart
- mov dword ptr [ebx+4h], ProtectedModeStart - RendezvousFunnelProcStart
- mov dword ptr [ebx+8h], FLAT32_JUMP - RendezvousFunnelProcStart
- mov dword ptr [ebx+0ch], 0
- mov dword ptr [ebx+10h], 0
- mov dword ptr [ebx+14h], RendezvousFunnelProcEnd - RendezvousFunnelProcStart
-
- popad
- ret
-AsmGetAddressMap ENDP
-
-END
diff --git a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.c b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.c
deleted file mode 100644
index 73c89a10f0..0000000000
--- a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.c
+++ /dev/null
@@ -1,1637 +0,0 @@
-/** @file
-Produces PI MP Services Protocol on top of Framework MP Services Protocol.
-
-Intel's Framework MP Services Protocol is replaced by EFI_MP_SERVICES_PROTOCOL in PI 1.1.
-This module produces PI MP Services Protocol on top of Framework MP Services Protocol.
-
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-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:
-
-**/
-
-#include "MpServicesOnFrameworkMpServicesThunk.h"
-
-EFI_HANDLE mHandle = NULL;
-MP_SYSTEM_DATA mMPSystemData;
-EFI_PHYSICAL_ADDRESS mStartupVector;
-MP_CPU_EXCHANGE_INFO *mExchangeInfo;
-BOOLEAN mStopCheckAPsStatus = FALSE;
-UINTN mNumberOfProcessors;
-EFI_GENERIC_MEMORY_TEST_PROTOCOL *mGenMemoryTest;
-
-FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *mFrameworkMpService;
-EFI_MP_SERVICES_PROTOCOL mMpService = {
- GetNumberOfProcessors,
- GetProcessorInfo,
- StartupAllAPs,
- StartupThisAP,
- SwitchBSP,
- EnableDisableAP,
- WhoAmI
-};
-
-
-/**
- Implementation of GetNumberOfProcessors() service of MP Services Protocol.
-
- This service retrieves the number of logical processor in the platform
- and the number of those logical processors that are enabled on this boot.
- This service may only be called from the BSP.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param NumberOfProcessors Pointer to the total number of logical processors in the system,
- including the BSP and disabled APs.
- @param NumberOfEnabledProcessors Pointer to the number of enabled logical processors that exist
- in system, including the BSP.
-
- @retval EFI_SUCCESS Number of logical processors and enabled logical processors retrieved..
- @retval EFI_DEVICE_ERROR Caller processor is AP.
- @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL
- @retval EFI_INVALID_PARAMETER NumberOfEnabledProcessors is NULL
-
-**/
-EFI_STATUS
-EFIAPI
-GetNumberOfProcessors (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- OUT UINTN *NumberOfProcessors,
- OUT UINTN *NumberOfEnabledProcessors
- )
-{
- EFI_STATUS Status;
- UINTN CallerNumber;
-
- //
- // Check whether caller processor is BSP
- //
- WhoAmI (This, &CallerNumber);
- if (CallerNumber != GetBspNumber ()) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Check parameter NumberOfProcessors
- //
- if (NumberOfProcessors == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Check parameter NumberOfEnabledProcessors
- //
- if (NumberOfEnabledProcessors == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = mFrameworkMpService->GetGeneralMPInfo (
- mFrameworkMpService,
- NumberOfProcessors,
- NULL,
- NumberOfEnabledProcessors,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
-
-/**
- Implementation of GetNumberOfProcessors() service of MP Services Protocol.
-
- Gets detailed MP-related information on the requested processor at the
- instant this call is made. This service may only be called from the BSP.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param ProcessorNumber The handle number of processor.
- @param ProcessorInfoBuffer A pointer to the buffer where information for the requested processor is deposited.
-
- @retval EFI_SUCCESS Processor information successfully returned.
- @retval EFI_DEVICE_ERROR Caller processor is AP.
- @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL
- @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber does not exist.
-
-**/
-EFI_STATUS
-EFIAPI
-GetProcessorInfo (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN UINTN ProcessorNumber,
- OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer
- )
-{
- EFI_STATUS Status;
- UINTN CallerNumber;
- UINTN BufferSize;
- EFI_MP_PROC_CONTEXT ProcessorContextBuffer;
-
- //
- // Check whether caller processor is BSP
- //
- WhoAmI (This, &CallerNumber);
- if (CallerNumber != GetBspNumber ()) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Check parameter ProcessorInfoBuffer
- //
- if (ProcessorInfoBuffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Check whether processor with the handle specified by ProcessorNumber exists
- //
- if (ProcessorNumber >= mNumberOfProcessors) {
- return EFI_NOT_FOUND;
- }
-
- BufferSize = sizeof (EFI_MP_PROC_CONTEXT);
- Status = mFrameworkMpService->GetProcessorContext (
- mFrameworkMpService,
- ProcessorNumber,
- &BufferSize,
- &ProcessorContextBuffer
- );
- ASSERT_EFI_ERROR (Status);
-
- ProcessorInfoBuffer->ProcessorId = (UINT64) ProcessorContextBuffer.ApicID;
-
- //
- // Get Status Flag of specified processor
- //
- ProcessorInfoBuffer->StatusFlag = 0;
-
- if (ProcessorContextBuffer.Enabled) {
- ProcessorInfoBuffer->StatusFlag |= PROCESSOR_ENABLED_BIT;
- }
-
- if (ProcessorContextBuffer.Designation == EfiCpuBSP) {
- ProcessorInfoBuffer->StatusFlag |= PROCESSOR_AS_BSP_BIT;
- }
-
- if (ProcessorContextBuffer.Health.Flags.Uint32 == 0) {
- ProcessorInfoBuffer->StatusFlag |= PROCESSOR_HEALTH_STATUS_BIT;
- }
-
- ProcessorInfoBuffer->Location.Package = (UINT32) ProcessorContextBuffer.PackageNumber;
- ProcessorInfoBuffer->Location.Core = (UINT32) ProcessorContextBuffer.NumberOfCores;
- ProcessorInfoBuffer->Location.Thread = (UINT32) ProcessorContextBuffer.NumberOfThreads;
-
- return EFI_SUCCESS;
-}
-
-/**
- Implementation of StartupAllAPs() service of MP Services Protocol.
-
- This service lets the caller get all enabled APs to execute a caller-provided function.
- This service may only be called from the BSP.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param Procedure A pointer to the function to be run on enabled APs of the system.
- @param SingleThread Indicates whether to execute the function simultaneously or one by one..
- @param WaitEvent The event created by the caller.
- If it is NULL, then execute in blocking mode.
- If it is not NULL, then execute in non-blocking mode.
- @param TimeoutInMicroSeconds The time limit in microseconds for this AP to finish the function.
- Zero means infinity.
- @param ProcedureArgument Pointer to the optional parameter of the assigned function.
- @param FailedCpuList The list of processor numbers that fail to finish the function before
- TimeoutInMicrosecsond expires.
-
- @retval EFI_SUCCESS In blocking mode, all APs have finished before the timeout expired.
- @retval EFI_SUCCESS In non-blocking mode, function has been dispatched to all enabled APs.
- @retval EFI_DEVICE_ERROR Caller processor is AP.
- @retval EFI_NOT_STARTED No enabled AP exists in the system.
- @retval EFI_NOT_READY Any enabled AP is busy.
- @retval EFI_TIMEOUT In blocking mode, The timeout expired before all enabled APs have finished.
- @retval EFI_INVALID_PARAMETER Procedure is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-StartupAllAPs (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN EFI_AP_PROCEDURE Procedure,
- IN BOOLEAN SingleThread,
- IN EFI_EVENT WaitEvent OPTIONAL,
- IN UINTN TimeoutInMicroSeconds,
- IN VOID *ProcedureArgument OPTIONAL,
- OUT UINTN **FailedCpuList OPTIONAL
- )
-{
- EFI_STATUS Status;
- UINTN ProcessorNumber;
- CPU_DATA_BLOCK *CpuData;
- BOOLEAN Blocking;
- UINTN BspNumber;
-
- if (FailedCpuList != NULL) {
- *FailedCpuList = NULL;
- }
-
- //
- // Check whether caller processor is BSP
- //
- BspNumber = GetBspNumber ();
- WhoAmI (This, &ProcessorNumber);
- if (ProcessorNumber != BspNumber) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Check parameter Procedure
- //
- if (Procedure == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Temporarily suppress CheckAPsStatus()
- //
- mStopCheckAPsStatus = TRUE;
-
- //
- // Check whether all enabled APs are idle.
- // If any enabled AP is not idle, return EFI_NOT_READY.
- //
- for (ProcessorNumber = 0; ProcessorNumber < mNumberOfProcessors; ProcessorNumber++) {
-
- CpuData = &mMPSystemData.CpuData[ProcessorNumber];
-
- mMPSystemData.CpuList[ProcessorNumber] = FALSE;
- if (ProcessorNumber != BspNumber) {
- if (CpuData->State != CpuStateDisabled) {
- if (CpuData->State != CpuStateIdle) {
- mStopCheckAPsStatus = FALSE;
- return EFI_NOT_READY;
- } else {
- //
- // Mark this processor as responsible for current calling.
- //
- mMPSystemData.CpuList[ProcessorNumber] = TRUE;
- }
- }
- }
- }
-
- mMPSystemData.FinishCount = 0;
- mMPSystemData.StartCount = 0;
- Blocking = FALSE;
- //
- // Go through all enabled APs to wakeup them for Procedure.
- // If in Single Thread mode, then only one AP is woken up, and others are waiting.
- //
- for (ProcessorNumber = 0; ProcessorNumber < mNumberOfProcessors; ProcessorNumber++) {
-
- CpuData = &mMPSystemData.CpuData[ProcessorNumber];
- //
- // Check whether this processor is responsible for current calling.
- //
- if (mMPSystemData.CpuList[ProcessorNumber]) {
-
- mMPSystemData.StartCount++;
-
- AcquireSpinLock (&CpuData->CpuDataLock);
- CpuData->State = CpuStateReady;
- ReleaseSpinLock (&CpuData->CpuDataLock);
-
- if (!Blocking) {
- WakeUpAp (
- ProcessorNumber,
- Procedure,
- ProcedureArgument
- );
- }
-
- if (SingleThread) {
- Blocking = TRUE;
- }
- }
- }
-
- //
- // If no enabled AP exists, return EFI_NOT_STARTED.
- //
- if (mMPSystemData.StartCount == 0) {
- mStopCheckAPsStatus = FALSE;
- return EFI_NOT_STARTED;
- }
-
- //
- // If WaitEvent is not NULL, execute in non-blocking mode.
- // BSP saves data for CheckAPsStatus(), and returns EFI_SUCCESS.
- // CheckAPsStatus() will check completion and timeout periodically.
- //
- mMPSystemData.Procedure = Procedure;
- mMPSystemData.ProcArguments = ProcedureArgument;
- mMPSystemData.SingleThread = SingleThread;
- mMPSystemData.FailedCpuList = FailedCpuList;
- mMPSystemData.ExpectedTime = CalculateTimeout (TimeoutInMicroSeconds, &mMPSystemData.CurrentTime);
- mMPSystemData.WaitEvent = WaitEvent;
-
- //
- // Allow CheckAPsStatus()
- //
- mStopCheckAPsStatus = FALSE;
-
- if (WaitEvent != NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // If WaitEvent is NULL, execute in blocking mode.
- // BSP checks APs'state until all APs finish or TimeoutInMicrosecsond expires.
- //
- do {
- Status = CheckAllAPs ();
- } while (Status == EFI_NOT_READY);
-
- return Status;
-}
-
-/**
- Implementation of StartupThisAP() service of MP Services Protocol.
-
- This service lets the caller get one enabled AP to execute a caller-provided function.
- This service may only be called from the BSP.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param Procedure A pointer to the function to be run on the designated AP.
- @param ProcessorNumber The handle number of AP..
- @param WaitEvent The event created by the caller.
- If it is NULL, then execute in blocking mode.
- If it is not NULL, then execute in non-blocking mode.
- @param TimeoutInMicroseconds The time limit in microseconds for this AP to finish the function.
- Zero means infinity.
- @param ProcedureArgument Pointer to the optional parameter of the assigned function.
- @param Finished Indicates whether AP has finished assigned function.
- In blocking mode, it is ignored.
-
- @retval EFI_SUCCESS In blocking mode, specified AP has finished before the timeout expires.
- @retval EFI_SUCCESS In non-blocking mode, function has been dispatched to specified AP.
- @retval EFI_DEVICE_ERROR Caller processor is AP.
- @retval EFI_TIMEOUT In blocking mode, the timeout expires before specified AP has finished.
- @retval EFI_NOT_READY Specified AP is busy.
- @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber does not exist.
- @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.
- @retval EFI_INVALID_PARAMETER Procedure is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-StartupThisAP (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN EFI_AP_PROCEDURE Procedure,
- IN UINTN ProcessorNumber,
- IN EFI_EVENT WaitEvent OPTIONAL,
- IN UINTN TimeoutInMicroseconds,
- IN VOID *ProcedureArgument OPTIONAL,
- OUT BOOLEAN *Finished OPTIONAL
- )
-{
- CPU_DATA_BLOCK *CpuData;
- UINTN CallerNumber;
- EFI_STATUS Status;
- UINTN BspNumber;
-
- if (Finished != NULL) {
- *Finished = TRUE;
- }
-
- //
- // Check whether caller processor is BSP
- //
- BspNumber = GetBspNumber ();
- WhoAmI (This, &CallerNumber);
- if (CallerNumber != BspNumber) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Check whether processor with the handle specified by ProcessorNumber exists
- //
- if (ProcessorNumber >= mNumberOfProcessors) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Check whether specified processor is BSP
- //
- if (ProcessorNumber == BspNumber) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Check parameter Procedure
- //
- if (Procedure == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- CpuData = &mMPSystemData.CpuData[ProcessorNumber];
-
- //
- // Temporarily suppress CheckAPsStatus()
- //
- mStopCheckAPsStatus = TRUE;
-
- //
- // Check whether specified AP is disabled
- //
- if (CpuData->State == CpuStateDisabled) {
- mStopCheckAPsStatus = FALSE;
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Check whether specified AP is busy
- //
- if (CpuData->State != CpuStateIdle) {
- mStopCheckAPsStatus = FALSE;
- return EFI_NOT_READY;
- }
-
- //
- // Wakeup specified AP for Procedure.
- //
- AcquireSpinLock (&CpuData->CpuDataLock);
- CpuData->State = CpuStateReady;
- ReleaseSpinLock (&CpuData->CpuDataLock);
-
- WakeUpAp (
- ProcessorNumber,
- Procedure,
- ProcedureArgument
- );
-
- //
- // If WaitEvent is not NULL, execute in non-blocking mode.
- // BSP saves data for CheckAPsStatus(), and returns EFI_SUCCESS.
- // CheckAPsStatus() will check completion and timeout periodically.
- //
- CpuData->WaitEvent = WaitEvent;
- CpuData->Finished = Finished;
- CpuData->ExpectedTime = CalculateTimeout (TimeoutInMicroseconds, &CpuData->CurrentTime);
-
- //
- // Allow CheckAPsStatus()
- //
- mStopCheckAPsStatus = FALSE;
-
- if (WaitEvent != NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // If WaitEvent is NULL, execute in blocking mode.
- // BSP checks AP's state until it finishes or TimeoutInMicrosecsond expires.
- //
- do {
- Status = CheckThisAP (ProcessorNumber);
- } while (Status == EFI_NOT_READY);
-
- return Status;
-}
-
-/**
- Implementation of SwitchBSP() service of MP Services Protocol.
-
- This service switches the requested AP to be the BSP from that point onward.
- This service may only be called from the current BSP.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param ProcessorNumber The handle number of processor.
- @param EnableOldBSP Whether to enable or disable the original BSP.
-
- @retval EFI_SUCCESS BSP successfully switched.
- @retval EFI_DEVICE_ERROR Caller processor is AP.
- @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber does not exist.
- @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.
- @retval EFI_NOT_READY Specified AP is busy.
-
-**/
-EFI_STATUS
-EFIAPI
-SwitchBSP (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN UINTN ProcessorNumber,
- IN BOOLEAN EnableOldBSP
- )
-{
- EFI_STATUS Status;
- CPU_DATA_BLOCK *CpuData;
- UINTN CallerNumber;
- UINTN BspNumber;
- UINTN ApicBase;
- UINT32 CurrentTimerValue;
- UINT32 CurrentTimerRegister;
- UINT32 CurrentTimerDivide;
- UINT64 CurrentTscValue;
- BOOLEAN OldInterruptState;
-
- //
- // Check whether caller processor is BSP
- //
- BspNumber = GetBspNumber ();
- WhoAmI (This, &CallerNumber);
- if (CallerNumber != BspNumber) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Check whether processor with the handle specified by ProcessorNumber exists
- //
- if (ProcessorNumber >= mNumberOfProcessors) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Check whether specified processor is BSP
- //
- if (ProcessorNumber == BspNumber) {
- return EFI_INVALID_PARAMETER;
- }
-
- CpuData = &mMPSystemData.CpuData[ProcessorNumber];
-
- //
- // Check whether specified AP is disabled
- //
- if (CpuData->State == CpuStateDisabled) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Check whether specified AP is busy
- //
- if (CpuData->State != CpuStateIdle) {
- return EFI_NOT_READY;
- }
-
- //
- // Save and disable interrupt.
- //
- OldInterruptState = SaveAndDisableInterrupts ();
-
- //
- // Record the current local APIC timer setting of BSP
- //
- ApicBase = (UINTN)AsmMsrBitFieldRead64 (MSR_IA32_APIC_BASE, 12, 35) << 12;
- CurrentTimerValue = MmioRead32 (ApicBase + APIC_REGISTER_TIMER_COUNT);
- CurrentTimerRegister = MmioRead32 (ApicBase + APIC_REGISTER_LVT_TIMER);
- CurrentTimerDivide = MmioRead32 (ApicBase + APIC_REGISTER_TIMER_DIVIDE);
- //
- // Set mask bit (BIT 16) of LVT Timer Register to disable its interrupt
- //
- MmioBitFieldWrite32 (ApicBase + APIC_REGISTER_LVT_TIMER, 16, 16, 1);
-
- //
- // Record the current TSC value
- //
- CurrentTscValue = AsmReadTsc ();
-
- Status = mFrameworkMpService->SwitchBSP (
- mFrameworkMpService,
- ProcessorNumber,
- EnableOldBSP
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Restore TSC value
- //
- AsmWriteMsr64 (MSR_IA32_TIME_STAMP_COUNTER, CurrentTscValue);
-
- //
- // Restore local APIC timer setting to new BSP
- //
- MmioWrite32 (ApicBase + APIC_REGISTER_TIMER_DIVIDE, CurrentTimerDivide);
- MmioWrite32 (ApicBase + APIC_REGISTER_TIMER_INIT_COUNT, CurrentTimerValue);
- MmioWrite32 (ApicBase + APIC_REGISTER_LVT_TIMER, CurrentTimerRegister);
-
- //
- // Restore interrupt state.
- //
- SetInterruptState (OldInterruptState);
-
- ChangeCpuState (BspNumber, EnableOldBSP);
-
- return EFI_SUCCESS;
-}
-
-/**
- Implementation of EnableDisableAP() service of MP Services Protocol.
-
- This service lets the caller enable or disable an AP.
- This service may only be called from the BSP.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param ProcessorNumber The handle number of processor.
- @param EnableAP Indicates whether the newstate of the AP is enabled or disabled.
- @param HealthFlag Indicates new health state of the AP..
-
- @retval EFI_SUCCESS AP successfully enabled or disabled.
- @retval EFI_DEVICE_ERROR Caller processor is AP.
- @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber does not exist.
- @retval EFI_INVALID_PARAMETERS ProcessorNumber specifies the BSP.
-
-**/
-EFI_STATUS
-EFIAPI
-EnableDisableAP (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN UINTN ProcessorNumber,
- IN BOOLEAN EnableAP,
- IN UINT32 *HealthFlag OPTIONAL
- )
-{
- EFI_STATUS Status;
- UINTN CallerNumber;
- EFI_MP_HEALTH HealthState;
- EFI_MP_HEALTH *HealthStatePointer;
- UINTN BspNumber;
-
- //
- // Check whether caller processor is BSP
- //
- BspNumber = GetBspNumber ();
- WhoAmI (This, &CallerNumber);
- if (CallerNumber != BspNumber) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Check whether processor with the handle specified by ProcessorNumber exists
- //
- if (ProcessorNumber >= mNumberOfProcessors) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Check whether specified processor is BSP
- //
- if (ProcessorNumber == BspNumber) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (HealthFlag == NULL) {
- HealthStatePointer = NULL;
- } else {
- if ((*HealthFlag & PROCESSOR_HEALTH_STATUS_BIT) == 0) {
- HealthState.Flags.Uint32 = 1;
- } else {
- HealthState.Flags.Uint32 = 0;
- }
- HealthState.TestStatus = 0;
-
- HealthStatePointer = &HealthState;
- }
-
- Status = mFrameworkMpService->EnableDisableAP (
- mFrameworkMpService,
- ProcessorNumber,
- EnableAP,
- HealthStatePointer
- );
- ASSERT_EFI_ERROR (Status);
-
- ChangeCpuState (ProcessorNumber, EnableAP);
-
- return EFI_SUCCESS;
-}
-
-/**
- Implementation of WhoAmI() service of MP Services Protocol.
-
- This service lets the caller processor get its handle number.
- This service may be called from the BSP and APs.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param ProcessorNumber Pointer to the handle number of AP.
-
- @retval EFI_SUCCESS Processor number successfully returned.
- @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL
-
-**/
-EFI_STATUS
-EFIAPI
-WhoAmI (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- OUT UINTN *ProcessorNumber
- )
-{
- EFI_STATUS Status;
-
- if (ProcessorNumber == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = mFrameworkMpService->WhoAmI (
- mFrameworkMpService,
- ProcessorNumber
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
-
-/**
- Checks APs' status periodically.
-
- This function is triggered by timer periodically to check the
- state of APs for StartupAllAPs() and StartupThisAP() executed
- in non-blocking mode.
-
- @param Event Event triggered.
- @param Context Parameter passed with the event.
-
-**/
-VOID
-EFIAPI
-CheckAPsStatus (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- UINTN ProcessorNumber;
- CPU_DATA_BLOCK *CpuData;
- EFI_STATUS Status;
-
- //
- // If CheckAPsStatus() is stopped, then return immediately.
- //
- if (mStopCheckAPsStatus) {
- return;
- }
-
- //
- // First, check whether pending StartupAllAPs() exists.
- //
- if (mMPSystemData.WaitEvent != NULL) {
-
- Status = CheckAllAPs ();
- //
- // If all APs finish for StartupAllAPs(), signal the WaitEvent for it..
- //
- if (Status != EFI_NOT_READY) {
- Status = gBS->SignalEvent (mMPSystemData.WaitEvent);
- mMPSystemData.WaitEvent = NULL;
- }
- }
-
- //
- // Second, check whether pending StartupThisAPs() callings exist.
- //
- for (ProcessorNumber = 0; ProcessorNumber < mNumberOfProcessors; ProcessorNumber++) {
-
- CpuData = &mMPSystemData.CpuData[ProcessorNumber];
-
- if (CpuData->WaitEvent == NULL) {
- continue;
- }
-
- Status = CheckThisAP (ProcessorNumber);
-
- if (Status != EFI_NOT_READY) {
- gBS->SignalEvent (CpuData->WaitEvent);
- CpuData->WaitEvent = NULL;
- }
- }
- return ;
-}
-
-/**
- Checks status of all APs.
-
- This function checks whether all APs have finished task assigned by StartupAllAPs(),
- and whether timeout expires.
-
- @retval EFI_SUCCESS All APs have finished task assigned by StartupAllAPs().
- @retval EFI_TIMEOUT The timeout expires.
- @retval EFI_NOT_READY APs have not finished task and timeout has not expired.
-
-**/
-EFI_STATUS
-CheckAllAPs (
- VOID
- )
-{
- UINTN ProcessorNumber;
- UINTN NextProcessorNumber;
- UINTN ListIndex;
- EFI_STATUS Status;
- CPU_STATE CpuState;
- CPU_DATA_BLOCK *CpuData;
-
- NextProcessorNumber = 0;
-
- //
- // Go through all APs that are responsible for the StartupAllAPs().
- //
- for (ProcessorNumber = 0; ProcessorNumber < mNumberOfProcessors; ProcessorNumber++) {
- if (!mMPSystemData.CpuList[ProcessorNumber]) {
- continue;
- }
-
- CpuData = &mMPSystemData.CpuData[ProcessorNumber];
-
- //
- // Check the CPU state of AP. If it is CpuStateFinished, then the AP has finished its task.
- // Only BSP and corresponding AP access this unit of CPU Data. This means the AP will not modify the
- // value of state after setting the it to CpuStateFinished, so BSP can safely make use of its value.
- //
- AcquireSpinLock (&CpuData->CpuDataLock);
- CpuState = CpuData->State;
- ReleaseSpinLock (&CpuData->CpuDataLock);
-
- if (CpuState == CpuStateFinished) {
- mMPSystemData.FinishCount++;
- mMPSystemData.CpuList[ProcessorNumber] = FALSE;
-
- AcquireSpinLock (&CpuData->CpuDataLock);
- CpuData->State = CpuStateIdle;
- ReleaseSpinLock (&CpuData->CpuDataLock);
-
- //
- // If in Single Thread mode, then search for the next waiting AP for execution.
- //
- if (mMPSystemData.SingleThread) {
- Status = GetNextWaitingProcessorNumber (&NextProcessorNumber);
-
- if (!EFI_ERROR (Status)) {
- WakeUpAp (
- NextProcessorNumber,
- mMPSystemData.Procedure,
- mMPSystemData.ProcArguments
- );
- }
- }
- }
- }
-
- //
- // If all APs finish, return EFI_SUCCESS.
- //
- if (mMPSystemData.FinishCount == mMPSystemData.StartCount) {
- return EFI_SUCCESS;
- }
-
- //
- // If timeout expires, report timeout.
- //
- if (CheckTimeout (&mMPSystemData.CurrentTime, &mMPSystemData.TotalTime, mMPSystemData.ExpectedTime)) {
- //
- // If FailedCpuList is not NULL, record all failed APs in it.
- //
- if (mMPSystemData.FailedCpuList != NULL) {
- *mMPSystemData.FailedCpuList = AllocatePool ((mMPSystemData.StartCount - mMPSystemData.FinishCount + 1) * sizeof(UINTN));
- ASSERT (*mMPSystemData.FailedCpuList != NULL);
- }
- ListIndex = 0;
-
- for (ProcessorNumber = 0; ProcessorNumber < mNumberOfProcessors; ProcessorNumber++) {
- //
- // Check whether this processor is responsible for StartupAllAPs().
- //
- if (mMPSystemData.CpuList[ProcessorNumber]) {
- //
- // Reset failed APs to idle state
- //
- ResetProcessorToIdleState (ProcessorNumber);
- mMPSystemData.CpuList[ProcessorNumber] = FALSE;
- if (mMPSystemData.FailedCpuList != NULL) {
- (*mMPSystemData.FailedCpuList)[ListIndex++] = ProcessorNumber;
- }
- }
- }
- if (mMPSystemData.FailedCpuList != NULL) {
- (*mMPSystemData.FailedCpuList)[ListIndex] = END_OF_CPU_LIST;
- }
- return EFI_TIMEOUT;
- }
- return EFI_NOT_READY;
-}
-
-/**
- Checks status of specified AP.
-
- This function checks whether specified AP has finished task assigned by StartupThisAP(),
- and whether timeout expires.
-
- @param ProcessorNumber The handle number of processor.
-
- @retval EFI_SUCCESS Specified AP has finished task assigned by StartupThisAPs().
- @retval EFI_TIMEOUT The timeout expires.
- @retval EFI_NOT_READY Specified AP has not finished task and timeout has not expired.
-
-**/
-EFI_STATUS
-CheckThisAP (
- UINTN ProcessorNumber
- )
-{
- CPU_DATA_BLOCK *CpuData;
- CPU_STATE CpuState;
-
- ASSERT (ProcessorNumber < mNumberOfProcessors);
- ASSERT (ProcessorNumber < MAX_CPU_NUMBER);
-
- CpuData = &mMPSystemData.CpuData[ProcessorNumber];
-
- //
- // Check the CPU state of AP. If it is CpuStateFinished, then the AP has finished its task.
- // Only BSP and corresponding AP access this unit of CPU Data. This means the AP will not modify the
- // value of state after setting the it to CpuStateFinished, so BSP can safely make use of its value.
- //
- AcquireSpinLock (&CpuData->CpuDataLock);
- CpuState = CpuData->State;
- ReleaseSpinLock (&CpuData->CpuDataLock);
-
- //
- // If the APs finishes for StartupThisAP(), return EFI_SUCCESS.
- //
- if (CpuState == CpuStateFinished) {
-
- AcquireSpinLock (&CpuData->CpuDataLock);
- CpuData->State = CpuStateIdle;
- ReleaseSpinLock (&CpuData->CpuDataLock);
-
- if (CpuData->Finished != NULL) {
- *(CpuData->Finished) = TRUE;
- }
- return EFI_SUCCESS;
- } else {
- //
- // If timeout expires for StartupThisAP(), report timeout.
- //
- if (CheckTimeout (&CpuData->CurrentTime, &CpuData->TotalTime, CpuData->ExpectedTime)) {
-
- if (CpuData->Finished != NULL) {
- *(CpuData->Finished) = FALSE;
- }
- //
- // Reset failed AP to idle state
- //
- ResetProcessorToIdleState (ProcessorNumber);
-
- return EFI_TIMEOUT;
- }
- }
- return EFI_NOT_READY;
-}
-
-/**
- Calculate timeout value and return the current performance counter value.
-
- Calculate the number of performance counter ticks required for a timeout.
- If TimeoutInMicroseconds is 0, return value is also 0, which is recognized
- as infinity.
-
- @param TimeoutInMicroseconds Timeout value in microseconds.
- @param CurrentTime Returns the current value of the performance counter.
-
- @return Expected timestamp counter for timeout.
- If TimeoutInMicroseconds is 0, return value is also 0, which is recognized
- as infinity.
-
-**/
-UINT64
-CalculateTimeout (
- IN UINTN TimeoutInMicroseconds,
- OUT UINT64 *CurrentTime
- )
-{
- //
- // Read the current value of the performance counter
- //
- *CurrentTime = GetPerformanceCounter ();
-
- //
- // If TimeoutInMicroseconds is 0, return value is also 0, which is recognized
- // as infinity.
- //
- if (TimeoutInMicroseconds == 0) {
- return 0;
- }
-
- //
- // GetPerformanceCounterProperties () returns the timestamp counter's frequency
- // in Hz. So multiply the return value with TimeoutInMicroseconds and then divide
- // it by 1,000,000, to get the number of ticks for the timeout value.
- //
- return DivU64x32 (
- MultU64x64 (
- GetPerformanceCounterProperties (NULL, NULL),
- TimeoutInMicroseconds
- ),
- 1000000
- );
-}
-
-/**
- Checks whether timeout expires.
-
- Check whether the number of ellapsed performance counter ticks required for a timeout condition
- has been reached. If Timeout is zero, which means infinity, return value is always FALSE.
-
- @param PreviousTime On input, the value of the performance counter when it was last read.
- On output, the current value of the performance counter
- @param TotalTime The total amount of ellapsed time in performance counter ticks.
- @param Timeout The number of performance counter ticks required to reach a timeout condition.
-
- @retval TRUE A timeout condition has been reached.
- @retval FALSE A timeout condition has not been reached.
-
-**/
-BOOLEAN
-CheckTimeout (
- IN OUT UINT64 *PreviousTime,
- IN UINT64 *TotalTime,
- IN UINT64 Timeout
- )
-{
- UINT64 Start;
- UINT64 End;
- UINT64 CurrentTime;
- INT64 Delta;
- INT64 Cycle;
-
- if (Timeout == 0) {
- return FALSE;
- }
- GetPerformanceCounterProperties (&Start, &End);
- Cycle = End - Start;
- if (Cycle < 0) {
- Cycle = -Cycle;
- }
- Cycle++;
- CurrentTime = GetPerformanceCounter();
- Delta = (INT64) (CurrentTime - *PreviousTime);
- if (Start > End) {
- Delta = -Delta;
- }
- if (Delta < 0) {
- Delta += Cycle;
- }
- *TotalTime += Delta;
- *PreviousTime = CurrentTime;
- if (*TotalTime > Timeout) {
- return TRUE;
- }
- return FALSE;
-}
-
-/**
- Searches for the next waiting AP.
-
- Search for the next AP that is put in waiting state by single-threaded StartupAllAPs().
-
- @param NextProcessorNumber Pointer to the processor number of the next waiting AP.
-
- @retval EFI_SUCCESS The next waiting AP has been found.
- @retval EFI_NOT_FOUND No waiting AP exists.
-
-**/
-EFI_STATUS
-GetNextWaitingProcessorNumber (
- OUT UINTN *NextProcessorNumber
- )
-{
- UINTN ProcessorNumber;
-
- for (ProcessorNumber = 0; ProcessorNumber < mNumberOfProcessors; ProcessorNumber++) {
-
- if (mMPSystemData.CpuList[ProcessorNumber]) {
- *NextProcessorNumber = ProcessorNumber;
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-
-/**
- Wrapper function for all procedures assigned to AP.
-
- Wrapper function for all procedures assigned to AP via MP service protocol.
- It controls states of AP and invokes assigned precedure.
-
-**/
-VOID
-ApProcWrapper (
- VOID
- )
-{
- EFI_AP_PROCEDURE Procedure;
- VOID *Parameter;
- UINTN ProcessorNumber;
- CPU_DATA_BLOCK *CpuData;
-
- //
- // Program virtual wire mode for AP, since it will be lost after AP wake up
- //
- ProgramVirtualWireMode ();
- DisableLvtInterrupts ();
-
- //
- // Initialize Debug Agent to support source level debug on AP code.
- //
- InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_AP, NULL, NULL);
-
- WhoAmI (&mMpService, &ProcessorNumber);
- CpuData = &mMPSystemData.CpuData[ProcessorNumber];
-
- AcquireSpinLock (&CpuData->CpuDataLock);
- CpuData->State = CpuStateBusy;
- ReleaseSpinLock (&CpuData->CpuDataLock);
-
- //
- // Now let us check it out.
- //
- AcquireSpinLock (&CpuData->CpuDataLock);
- Procedure = CpuData->Procedure;
- Parameter = CpuData->Parameter;
- ReleaseSpinLock (&CpuData->CpuDataLock);
-
- if (Procedure != NULL) {
-
- Procedure (Parameter);
-
- //
- // if BSP is switched to AP, it continue execute from here, but it carries register state
- // of the old AP, so need to reload CpuData (might be stored in a register after compiler
- // optimization) to make sure it points to the right data
- //
- WhoAmI (&mMpService, &ProcessorNumber);
- CpuData = &mMPSystemData.CpuData[ProcessorNumber];
-
- AcquireSpinLock (&CpuData->CpuDataLock);
- CpuData->Procedure = NULL;
- ReleaseSpinLock (&CpuData->CpuDataLock);
- }
-
- AcquireSpinLock (&CpuData->CpuDataLock);
- CpuData->State = CpuStateFinished;
- ReleaseSpinLock (&CpuData->CpuDataLock);
-}
-
-/**
- Function to wake up a specified AP and assign procedure to it.
-
- @param ProcessorNumber Handle number of the specified processor.
- @param Procedure Procedure to assign.
- @param ProcArguments Argument for Procedure.
-
-**/
-VOID
-WakeUpAp (
- IN UINTN ProcessorNumber,
- IN EFI_AP_PROCEDURE Procedure,
- IN VOID *ProcArguments
- )
-{
- EFI_STATUS Status;
- CPU_DATA_BLOCK *CpuData;
- EFI_PROCESSOR_INFORMATION ProcessorInfoBuffer;
-
- ASSERT (ProcessorNumber < mNumberOfProcessors);
- ASSERT (ProcessorNumber < MAX_CPU_NUMBER);
-
- CpuData = &mMPSystemData.CpuData[ProcessorNumber];
-
- AcquireSpinLock (&CpuData->CpuDataLock);
- CpuData->Parameter = ProcArguments;
- CpuData->Procedure = Procedure;
- ReleaseSpinLock (&CpuData->CpuDataLock);
-
- Status = GetProcessorInfo (
- &mMpService,
- ProcessorNumber,
- &ProcessorInfoBuffer
- );
- ASSERT_EFI_ERROR (Status);
-
- mExchangeInfo->ApFunction = (VOID *) (UINTN) ApProcWrapper;
- mExchangeInfo->ProcessorNumber[ProcessorInfoBuffer.ProcessorId] = (UINT32) ProcessorNumber;
- SendInitSipiSipi (
- (UINT32) ProcessorInfoBuffer.ProcessorId,
- (UINT32) (UINTN) mStartupVector
- );
-}
-
-/**
- Terminate AP's task and set it to idle state.
-
- This function terminates AP's task due to timeout by sending INIT-SIPI,
- and sends it to idle state.
-
- @param ProcessorNumber Handle number of the specified processor.
-
-**/
-VOID
-ResetProcessorToIdleState (
- UINTN ProcessorNumber
- )
-{
- EFI_STATUS Status;
- CPU_DATA_BLOCK *CpuData;
- EFI_PROCESSOR_INFORMATION ProcessorInfoBuffer;
-
- Status = GetProcessorInfo (
- &mMpService,
- ProcessorNumber,
- &ProcessorInfoBuffer
- );
- ASSERT_EFI_ERROR (Status);
-
- mExchangeInfo->ApFunction = NULL;
- mExchangeInfo->ProcessorNumber[ProcessorInfoBuffer.ProcessorId] = (UINT32) ProcessorNumber;
- SendInitSipiSipi (
- (UINT32) ProcessorInfoBuffer.ProcessorId,
- (UINT32) (UINTN) mStartupVector
- );
-
- CpuData = &mMPSystemData.CpuData[ProcessorNumber];
-
- AcquireSpinLock (&CpuData->CpuDataLock);
- CpuData->State = CpuStateIdle;
- ReleaseSpinLock (&CpuData->CpuDataLock);
-}
-
-/**
- Worker function of EnableDisableAP ()
-
- Worker function of EnableDisableAP (). Changes state of specified processor.
-
- @param ProcessorNumber Processor number of specified AP.
- @param NewState Desired state of the specified AP.
-
- @retval EFI_SUCCESS AP's state successfully changed.
-
-**/
-EFI_STATUS
-ChangeCpuState (
- IN UINTN ProcessorNumber,
- IN BOOLEAN NewState
- )
-{
- CPU_DATA_BLOCK *CpuData;
-
- ASSERT (ProcessorNumber < mNumberOfProcessors);
- ASSERT (ProcessorNumber < MAX_CPU_NUMBER);
-
- CpuData = &mMPSystemData.CpuData[ProcessorNumber];
-
- if (!NewState) {
- AcquireSpinLock (&CpuData->CpuDataLock);
- CpuData->State = CpuStateDisabled;
- ReleaseSpinLock (&CpuData->CpuDataLock);
- } else {
- AcquireSpinLock (&CpuData->CpuDataLock);
- CpuData->State = CpuStateIdle;
- ReleaseSpinLock (&CpuData->CpuDataLock);
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Test memory region of EfiGcdMemoryTypeReserved.
-
- @param Length The length of memory region to test.
-
- @retval EFI_SUCCESS The memory region passes test.
- @retval EFI_NOT_FOUND The memory region is not reserved memory.
- @retval EFI_DEVICE_ERROR The memory fails on test.
-
-**/
-EFI_STATUS
-TestReservedMemory (
- UINTN Length
- )
-{
- EFI_STATUS Status;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
- EFI_PHYSICAL_ADDRESS Address;
- UINTN LengthCovered;
- UINTN RemainingLength;
-
- //
- // Walk through the memory descriptors covering the memory range.
- //
- Address = mStartupVector;
- RemainingLength = Length;
- while (Address < mStartupVector + Length) {
- Status = gDS->GetMemorySpaceDescriptor(
- Address,
- &Descriptor
- );
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
-
- if (Descriptor.GcdMemoryType != EfiGcdMemoryTypeReserved) {
- return EFI_NOT_FOUND;
- }
- //
- // Calculated the length of the intersected range.
- //
- LengthCovered = (UINTN) (Descriptor.BaseAddress + Descriptor.Length - Address);
- if (LengthCovered > RemainingLength) {
- LengthCovered = RemainingLength;
- }
-
- Status = mGenMemoryTest->CompatibleRangeTest (
- mGenMemoryTest,
- Address,
- LengthCovered
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Address += LengthCovered;
- RemainingLength -= LengthCovered;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Allocates startup vector for APs.
-
- This function allocates Startup vector for APs.
-
- @param Size The size of startup vector.
-
-**/
-VOID
-AllocateStartupVector (
- UINTN Size
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (
- &gEfiGenericMemTestProtocolGuid,
- NULL,
- (VOID **) &mGenMemoryTest
- );
- if (EFI_ERROR (Status)) {
- mGenMemoryTest = NULL;
- }
-
- for (mStartupVector = 0x7F000; mStartupVector >= 0x2000; mStartupVector -= EFI_PAGE_SIZE) {
- if (mGenMemoryTest != NULL) {
- //
- // Test memory if it is EfiGcdMemoryTypeReserved.
- //
- Status = TestReservedMemory (EFI_SIZE_TO_PAGES (Size) * EFI_PAGE_SIZE);
- if (Status == EFI_DEVICE_ERROR) {
- continue;
- }
- }
-
- Status = gBS->AllocatePages (
- AllocateAddress,
- EfiBootServicesCode,
- EFI_SIZE_TO_PAGES (Size),
- &mStartupVector
- );
-
- if (!EFI_ERROR (Status)) {
- break;
- }
- }
-
- ASSERT_EFI_ERROR (Status);
-}
-
-/**
- Prepares Startup Vector for APs.
-
- This function prepares Startup Vector for APs.
-
-**/
-VOID
-PrepareAPStartupVector (
- VOID
- )
-{
- MP_ASSEMBLY_ADDRESS_MAP AddressMap;
- IA32_DESCRIPTOR GdtrForBSP;
- IA32_DESCRIPTOR IdtrForBSP;
- EFI_PHYSICAL_ADDRESS GdtForAP;
- EFI_PHYSICAL_ADDRESS IdtForAP;
- EFI_STATUS Status;
-
- //
- // Get the address map of startup code for AP,
- // including code size, and offset of long jump instructions to redirect.
- //
- AsmGetAddressMap (&AddressMap);
-
- //
- // Allocate a 4K-aligned region under 1M for startup vector for AP.
- // The region contains AP startup code and exchange data between BSP and AP.
- //
- AllocateStartupVector (AddressMap.Size + sizeof (MP_CPU_EXCHANGE_INFO));
-
- //
- // Copy AP startup code to startup vector, and then redirect the long jump
- // instructions for mode switching.
- //
- CopyMem ((VOID *) (UINTN) mStartupVector, AddressMap.RendezvousFunnelAddress, AddressMap.Size);
- *(UINT32 *) (UINTN) (mStartupVector + AddressMap.FlatJumpOffset + 3) = (UINT32) (mStartupVector + AddressMap.PModeEntryOffset);
- //
- // For IA32 mode, LongJumpOffset is filled with zero. If non-zero, then we are in X64 mode, so further redirect for long mode switch.
- //
- if (AddressMap.LongJumpOffset != 0) {
- *(UINT32 *) (UINTN) (mStartupVector + AddressMap.LongJumpOffset + 2) = (UINT32) (mStartupVector + AddressMap.LModeEntryOffset);
- }
-
- //
- // Get the start address of exchange data between BSP and AP.
- //
- mExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (mStartupVector + AddressMap.Size);
-
- ZeroMem ((VOID *) mExchangeInfo, sizeof (MP_CPU_EXCHANGE_INFO));
-
- mExchangeInfo->StackStart = AllocatePages (EFI_SIZE_TO_PAGES (mNumberOfProcessors * AP_STACK_SIZE));
- mExchangeInfo->StackSize = AP_STACK_SIZE;
-
- AsmReadGdtr (&GdtrForBSP);
- AsmReadIdtr (&IdtrForBSP);
-
- //
- // Allocate memory under 4G to hold GDT for APs
- //
- GdtForAP = 0xffffffff;
- Status = gBS->AllocatePages (
- AllocateMaxAddress,
- EfiBootServicesData,
- EFI_SIZE_TO_PAGES ((GdtrForBSP.Limit + 1) + (IdtrForBSP.Limit + 1)),
- &GdtForAP
- );
- ASSERT_EFI_ERROR (Status);
-
- IdtForAP = (UINTN) GdtForAP + GdtrForBSP.Limit + 1;
-
- CopyMem ((VOID *) (UINTN) GdtForAP, (VOID *) GdtrForBSP.Base, GdtrForBSP.Limit + 1);
- CopyMem ((VOID *) (UINTN) IdtForAP, (VOID *) IdtrForBSP.Base, IdtrForBSP.Limit + 1);
-
- mExchangeInfo->GdtrProfile.Base = (UINTN) GdtForAP;
- mExchangeInfo->GdtrProfile.Limit = GdtrForBSP.Limit;
- mExchangeInfo->IdtrProfile.Base = (UINTN) IdtForAP;
- mExchangeInfo->IdtrProfile.Limit = IdtrForBSP.Limit;
-
- mExchangeInfo->BufferStart = (UINT32) mStartupVector;
- mExchangeInfo->Cr3 = (UINT32) (AsmReadCr3 ());
-}
-
-/**
- Prepares memory region for processor configuration.
-
- This function prepares memory region for processor configuration.
-
-**/
-VOID
-PrepareMemoryForConfiguration (
- VOID
- )
-{
- UINTN Index;
-
- //
- // Initialize Spin Locks for system
- //
- InitializeSpinLock (&mMPSystemData.APSerializeLock);
- for (Index = 0; Index < MAX_CPU_NUMBER; Index++) {
- InitializeSpinLock (&mMPSystemData.CpuData[Index].CpuDataLock);
- }
-
- PrepareAPStartupVector ();
-}
-
-/**
- Gets the processor number of BSP.
-
- @return The processor number of BSP.
-
-**/
-UINTN
-GetBspNumber (
- VOID
- )
-{
- UINTN ProcessorNumber;
- EFI_MP_PROC_CONTEXT ProcessorContextBuffer;
- EFI_STATUS Status;
- UINTN BufferSize;
-
- BufferSize = sizeof (EFI_MP_PROC_CONTEXT);
-
- for (ProcessorNumber = 0; ProcessorNumber < mNumberOfProcessors; ProcessorNumber++) {
- Status = mFrameworkMpService->GetProcessorContext (
- mFrameworkMpService,
- ProcessorNumber,
- &BufferSize,
- &ProcessorContextBuffer
- );
- ASSERT_EFI_ERROR (Status);
-
- if (ProcessorContextBuffer.Designation == EfiCpuBSP) {
- break;
- }
- }
- ASSERT (ProcessorNumber < mNumberOfProcessors);
-
- return ProcessorNumber;
-}
-
-/**
- Entrypoint of MP Services Protocol thunk driver.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeMpServicesProtocol (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- //
- // Locates Framework version MP Services Protocol
- //
- Status = gBS->LocateProtocol (
- &gFrameworkEfiMpServiceProtocolGuid,
- NULL,
- (VOID **) &mFrameworkMpService
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = mFrameworkMpService->GetGeneralMPInfo (
- mFrameworkMpService,
- &mNumberOfProcessors,
- NULL,
- NULL,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- ASSERT (mNumberOfProcessors < MAX_CPU_NUMBER);
-
- PrepareMemoryForConfiguration ();
-
- //
- // Create timer event to check AP state for non-blocking execution.
- //
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- CheckAPsStatus,
- NULL,
- &mMPSystemData.CheckAPsEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Now install the MP services protocol.
- //
- Status = gBS->InstallProtocolInterface (
- &mHandle,
- &gEfiMpServiceProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mMpService
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Launch the timer event to check AP state.
- //
- Status = gBS->SetTimer (
- mMPSystemData.CheckAPsEvent,
- TimerPeriodic,
- 100000
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.h b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.h
deleted file mode 100644
index 1374968db8..0000000000
--- a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.h
+++ /dev/null
@@ -1,533 +0,0 @@
-/** @file
-Include file for PI MP Services Protocol Thunk.
-
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-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:
-
-**/
-
-#ifndef _MP_SERVICES_ON_FRAMEWORK_MP_SERVICES_THUNK_
-#define _MP_SERVICES_ON_FRAMEWORK_MP_SERVICES_THUNK_
-
-#include <Protocol/MpService.h>
-#include <Protocol/FrameworkMpService.h>
-#include <Protocol/GenericMemoryTest.h>
-
-#include <Library/BaseLib.h>
-#include <Library/SynchronizationLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/IoLib.h>
-#include <Library/TimerLib.h>
-#include <Library/DebugAgentLib.h>
-#include <Library/LocalApicLib.h>
-
-#define AP_STACK_SIZE 0x8000
-#define MAX_CPU_NUMBER 256
-
-//
-// Bit definition for IPI
-//
-#define BROADCAST_MODE_ALL_EXCLUDING_SELF_BIT 0xC0000
-#define SPECIFY_CPU_MODE_BIT 0x00000
-#define TRIGGER_MODE_LEVEL_BIT 0x08000
-#define ASSERT_BIT 0x04000
-
-//
-// Local APIC register definition for IPI.
-//
-#define APIC_REGISTER_SPURIOUS_VECTOR_OFFSET 0xF0
-#define APIC_REGISTER_ICR_LOW_OFFSET 0x300
-#define APIC_REGISTER_ICR_HIGH_OFFSET 0x310
-#define APIC_REGISTER_LVT_TIMER 0x320
-#define APIC_REGISTER_TIMER_INIT_COUNT 0x380
-#define APIC_REGISTER_LINT0_VECTOR_OFFSET 0x350
-#define APIC_REGISTER_LINT1_VECTOR_OFFSET 0x360
-#define APIC_REGISTER_TIMER_COUNT 0x390
-#define APIC_REGISTER_TIMER_DIVIDE 0x3E0
-
-//
-// Definition for MSR address
-//
-#define MSR_IA32_TIME_STAMP_COUNTER 0x10
-#define MSR_IA32_APIC_BASE 0x1B
-
-typedef struct {
- UINTN Lock;
- VOID *StackStart;
- UINTN StackSize;
- VOID *ApFunction;
- IA32_DESCRIPTOR GdtrProfile;
- IA32_DESCRIPTOR IdtrProfile;
- UINT32 BufferStart;
- UINT32 Cr3;
- UINT32 ProcessorNumber[MAX_CPU_NUMBER];
-} MP_CPU_EXCHANGE_INFO;
-
-typedef struct {
- UINT8 *RendezvousFunnelAddress;
- UINTN PModeEntryOffset;
- UINTN FlatJumpOffset;
- UINTN LModeEntryOffset;
- UINTN LongJumpOffset;
- UINTN Size;
-} MP_ASSEMBLY_ADDRESS_MAP;
-
-typedef enum {
- CpuStateIdle,
- CpuStateReady,
- CpuStateBusy,
- CpuStateFinished,
- CpuStateDisabled
-} CPU_STATE;
-
-//
-// Define Individual Processor Data block.
-//
-typedef struct {
- EFI_AP_PROCEDURE volatile Procedure;
- VOID* volatile Parameter;
-
- EFI_EVENT WaitEvent;
- BOOLEAN *Finished;
- UINT64 ExpectedTime;
- UINT64 CurrentTime;
- UINT64 TotalTime;
-
- SPIN_LOCK CpuDataLock;
- CPU_STATE volatile State;
-
-} CPU_DATA_BLOCK;
-
-//
-// Define MP data block which consumes individual processor block.
-//
-typedef struct {
- SPIN_LOCK APSerializeLock;
-
- EFI_EVENT CheckAPsEvent;
-
- UINTN FinishCount;
- UINTN StartCount;
-
- BOOLEAN CpuList[MAX_CPU_NUMBER];
-
- EFI_AP_PROCEDURE Procedure;
- VOID *ProcArguments;
- BOOLEAN SingleThread;
- EFI_EVENT WaitEvent;
- UINTN **FailedCpuList;
- UINT64 ExpectedTime;
- UINT64 CurrentTime;
- UINT64 TotalTime;
-
- CPU_DATA_BLOCK CpuData[MAX_CPU_NUMBER];
-} MP_SYSTEM_DATA;
-
-/**
- Implementation of GetNumberOfProcessors() service of MP Services Protocol.
-
- This service retrieves the number of logical processor in the platform
- and the number of those logical processors that are enabled on this boot.
- This service may only be called from the BSP.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param NumberOfProcessors Pointer to the total number of logical processors in the system,
- including the BSP and disabled APs.
- @param NumberOfEnabledProcessors Pointer to the number of enabled logical processors that exist
- in system, including the BSP.
-
- @retval EFI_SUCCESS Number of logical processors and enabled logical processors retrieved..
- @retval EFI_DEVICE_ERROR Caller processor is AP.
- @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL
- @retval EFI_INVALID_PARAMETER NumberOfEnabledProcessors is NULL
-
-**/
-EFI_STATUS
-EFIAPI
-GetNumberOfProcessors (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- OUT UINTN *NumberOfProcessors,
- OUT UINTN *NumberOfEnabledProcessors
- );
-
-/**
- Implementation of GetNumberOfProcessors() service of MP Services Protocol.
-
- Gets detailed MP-related information on the requested processor at the
- instant this call is made. This service may only be called from the BSP.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param ProcessorNumber The handle number of processor.
- @param ProcessorInfoBuffer A pointer to the buffer where information for the requested processor is deposited.
-
- @retval EFI_SUCCESS Processor information successfully returned.
- @retval EFI_DEVICE_ERROR Caller processor is AP.
- @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL
- @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber does not exist.
-
-**/
-EFI_STATUS
-EFIAPI
-GetProcessorInfo (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN UINTN ProcessorNumber,
- OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer
- );
-
-/**
- Implementation of StartupAllAPs() service of MP Services Protocol.
-
- This service lets the caller get all enabled APs to execute a caller-provided function.
- This service may only be called from the BSP.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param Procedure A pointer to the function to be run on enabled APs of the system.
- @param SingleThread Indicates whether to execute the function simultaneously or one by one..
- @param WaitEvent The event created by the caller.
- If it is NULL, then execute in blocking mode.
- If it is not NULL, then execute in non-blocking mode.
- @param TimeoutInMicroSeconds The time limit in microseconds for this AP to finish the function.
- Zero means infinity.
- @param ProcedureArgument Pointer to the optional parameter of the assigned function.
- @param FailedCpuList The list of processor numbers that fail to finish the function before
- TimeoutInMicrosecsond expires.
-
- @retval EFI_SUCCESS In blocking mode, all APs have finished before the timeout expired.
- @retval EFI_SUCCESS In non-blocking mode, function has been dispatched to all enabled APs.
- @retval EFI_DEVICE_ERROR Caller processor is AP.
- @retval EFI_NOT_STARTED No enabled AP exists in the system.
- @retval EFI_NOT_READY Any enabled AP is busy.
- @retval EFI_TIMEOUT In blocking mode, The timeout expired before all enabled APs have finished.
- @retval EFI_INVALID_PARAMETER Procedure is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-StartupAllAPs (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN EFI_AP_PROCEDURE Procedure,
- IN BOOLEAN SingleThread,
- IN EFI_EVENT WaitEvent OPTIONAL,
- IN UINTN TimeoutInMicroSeconds,
- IN VOID *ProcedureArgument OPTIONAL,
- OUT UINTN **FailedCpuList OPTIONAL
- );
-
-/**
- Implementation of StartupThisAP() service of MP Services Protocol.
-
- This service lets the caller get one enabled AP to execute a caller-provided function.
- This service may only be called from the BSP.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param Procedure A pointer to the function to be run on the designated AP.
- @param ProcessorNumber The handle number of AP..
- @param WaitEvent The event created by the caller.
- If it is NULL, then execute in blocking mode.
- If it is not NULL, then execute in non-blocking mode.
- @param TimeoutInMicroseconds The time limit in microseconds for this AP to finish the function.
- Zero means infinity.
- @param ProcedureArgument Pointer to the optional parameter of the assigned function.
- @param Finished Indicates whether AP has finished assigned function.
- In blocking mode, it is ignored.
-
- @retval EFI_SUCCESS In blocking mode, specified AP has finished before the timeout expires.
- @retval EFI_SUCCESS In non-blocking mode, function has been dispatched to specified AP.
- @retval EFI_DEVICE_ERROR Caller processor is AP.
- @retval EFI_TIMEOUT In blocking mode, the timeout expires before specified AP has finished.
- @retval EFI_NOT_READY Specified AP is busy.
- @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber does not exist.
- @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.
- @retval EFI_INVALID_PARAMETER Procedure is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-StartupThisAP (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN EFI_AP_PROCEDURE Procedure,
- IN UINTN ProcessorNumber,
- IN EFI_EVENT WaitEvent OPTIONAL,
- IN UINTN TimeoutInMicroseconds,
- IN VOID *ProcedureArgument OPTIONAL,
- OUT BOOLEAN *Finished OPTIONAL
- );
-
-/**
- Implementation of SwitchBSP() service of MP Services Protocol.
-
- This service switches the requested AP to be the BSP from that point onward.
- This service may only be called from the current BSP.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param ProcessorNumber The handle number of processor.
- @param EnableOldBSP Whether to enable or disable the original BSP.
-
- @retval EFI_SUCCESS BSP successfully switched.
- @retval EFI_DEVICE_ERROR Caller processor is AP.
- @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber does not exist.
- @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.
- @retval EFI_NOT_READY Specified AP is busy.
-
-**/
-EFI_STATUS
-EFIAPI
-SwitchBSP (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN UINTN ProcessorNumber,
- IN BOOLEAN EnableOldBSP
- );
-
-/**
- Implementation of EnableDisableAP() service of MP Services Protocol.
-
- This service lets the caller enable or disable an AP.
- This service may only be called from the BSP.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param ProcessorNumber The handle number of processor.
- @param EnableAP Indicates whether the newstate of the AP is enabled or disabled.
- @param HealthFlag Indicates new health state of the AP..
-
- @retval EFI_SUCCESS AP successfully enabled or disabled.
- @retval EFI_DEVICE_ERROR Caller processor is AP.
- @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber does not exist.
- @retval EFI_INVALID_PARAMETERS ProcessorNumber specifies the BSP.
-
-**/
-EFI_STATUS
-EFIAPI
-EnableDisableAP (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- IN UINTN ProcessorNumber,
- IN BOOLEAN EnableAP,
- IN UINT32 *HealthFlag OPTIONAL
- );
-
-/**
- Implementation of WhoAmI() service of MP Services Protocol.
-
- This service lets the caller processor get its handle number.
- This service may be called from the BSP and APs.
-
- @param This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
- @param ProcessorNumber Pointer to the handle number of AP.
-
- @retval EFI_SUCCESS Processor number successfully returned.
- @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL
-
-**/
-EFI_STATUS
-EFIAPI
-WhoAmI (
- IN EFI_MP_SERVICES_PROTOCOL *This,
- OUT UINTN *ProcessorNumber
- );
-
-/**
- Checks APs' status periodically.
-
- This function is triggered by timer periodically to check the
- state of APs for StartupAllAPs() and StartupThisAP() executed
- in non-blocking mode.
-
- @param Event Event triggered.
- @param Context Parameter passed with the event.
-
-**/
-VOID
-EFIAPI
-CheckAPsStatus (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-/**
- Checks status of all APs.
-
- This function checks whether all APs have finished task assigned by StartupAllAPs(),
- and whether timeout expires.
-
- @retval EFI_SUCCESS All APs have finished task assigned by StartupAllAPs().
- @retval EFI_TIMEOUT The timeout expires.
- @retval EFI_NOT_READY APs have not finished task and timeout has not expired.
-
-**/
-EFI_STATUS
-CheckAllAPs (
- VOID
- );
-
-/**
- Checks status of specified AP.
-
- This function checks whether specified AP has finished task assigned by StartupThisAP(),
- and whether timeout expires.
-
- @param ProcessorNumber The handle number of processor.
-
- @retval EFI_SUCCESS Specified AP has finished task assigned by StartupThisAPs().
- @retval EFI_TIMEOUT The timeout expires.
- @retval EFI_NOT_READY Specified AP has not finished task and timeout has not expired.
-
-**/
-EFI_STATUS
-CheckThisAP (
- UINTN ProcessorNumber
- );
-
-/**
- Calculate timeout value and return the current performance counter value.
-
- Calculate the number of performance counter ticks required for a timeout.
- If TimeoutInMicroseconds is 0, return value is also 0, which is recognized
- as infinity.
-
- @param TimeoutInMicroseconds Timeout value in microseconds.
- @param CurrentTime Returns the current value of the performance counter.
-
- @return Expected timestamp counter for timeout.
- If TimeoutInMicroseconds is 0, return value is also 0, which is recognized
- as infinity.
-
-**/
-UINT64
-CalculateTimeout (
- IN UINTN TimeoutInMicroseconds,
- OUT UINT64 *CurrentTime
- );
-
-/**
- Checks whether timeout expires.
-
- Check whether the number of ellapsed performance counter ticks required for a timeout condition
- has been reached. If Timeout is zero, which means infinity, return value is always FALSE.
-
- @param PreviousTime On input, the value of the performance counter when it was last read.
- On output, the current value of the performance counter
- @param TotalTime The total amount of ellapsed time in performance counter ticks.
- @param Timeout The number of performance counter ticks required to reach a timeout condition.
-
- @retval TRUE A timeout condition has been reached.
- @retval FALSE A timeout condition has not been reached.
-
-**/
-BOOLEAN
-CheckTimeout (
- IN OUT UINT64 *PreviousTime,
- IN UINT64 *TotalTime,
- IN UINT64 Timeout
- );
-
-/**
- Searches for the next waiting AP.
-
- Search for the next AP that is put in waiting state by single-threaded StartupAllAPs().
-
- @param NextProcessorNumber Pointer to the processor number of the next waiting AP.
-
- @retval EFI_SUCCESS The next waiting AP has been found.
- @retval EFI_NOT_FOUND No waiting AP exists.
-
-**/
-EFI_STATUS
-GetNextWaitingProcessorNumber (
- OUT UINTN *NextProcessorNumber
- );
-
-/**
- Wrapper function for all procedures assigned to AP.
-
- Wrapper function for all procedures assigned to AP via MP service protocol.
- It controls states of AP and invokes assigned precedure.
-
-**/
-VOID
-ApProcWrapper (
- VOID
- );
-
-/**
- Function to wake up a specified AP and assign procedure to it.
-
- @param ProcessorNumber Handle number of the specified processor.
- @param Procedure Procedure to assign.
- @param ProcArguments Argument for Procedure.
-
-**/
-VOID
-WakeUpAp (
- IN UINTN ProcessorNumber,
- IN EFI_AP_PROCEDURE Procedure,
- IN VOID *ProcArguments
- );
-
-/**
- Terminate AP's task and set it to idle state.
-
- This function terminates AP's task due to timeout by sending INIT-SIPI,
- and sends it to idle state.
-
- @param ProcessorNumber Handle number of the specified processor.
-
-**/
-VOID
-ResetProcessorToIdleState (
- UINTN ProcessorNumber
- );
-
-/**
- Worker function of EnableDisableAP ()
-
- Worker function of EnableDisableAP (). Changes state of specified processor.
-
- @param ProcessorNumber Processor number of specified AP.
- @param NewState Desired state of the specified AP.
-
- @retval EFI_SUCCESS AP's state successfully changed.
-
-**/
-EFI_STATUS
-ChangeCpuState (
- IN UINTN ProcessorNumber,
- IN BOOLEAN NewState
- );
-
-/**
- Gets the processor number of BSP.
-
- @return The processor number of BSP.
-
-**/
-UINTN
-GetBspNumber (
- VOID
- );
-
-/**
- Get address map of RendezvousFunnelProc.
-
- This function gets address map of RendezvousFunnelProc.
-
- @param AddressMap Output buffer for address map information
-
-**/
-VOID
-AsmGetAddressMap (
- OUT MP_ASSEMBLY_ADDRESS_MAP *AddressMap
- );
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.inf b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.inf
deleted file mode 100644
index 15528e331c..0000000000
--- a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.inf
+++ /dev/null
@@ -1,72 +0,0 @@
-## @file
-# Produces PI MP Services Protocol on top of Framework MP Services Protocol.
-#
-# Intel's Framework MP Services Protocol is replaced by EFI_MP_SERVICES_PROTOCOL in PI 1.1.
-# This module produces PI MP Services Protocol on top of Framework MP Services Protocol.
-#
-# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = MpServicesOnFrameworkMpServicesThunk
- FILE_GUID = 51739E2A-A022-4D73-ADB9-91F0C9BC7142
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeMpServicesProtocol
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- MpServicesOnFrameworkMpServicesThunk.c
- MpServicesOnFrameworkMpServicesThunk.h
-
-[Sources.X64]
- X64/MpFuncs.asm
- X64/MpFuncs.S
-
-[Sources.IA32]
- IA32/MpFuncs.asm
- IA32/MpFuncs.S
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- UefiCpuPkg/UefiCpuPkg.dec
-
-[LibraryClasses]
- TimerLib
- IoLib
- UefiBootServicesTableLib
- DxeServicesTableLib
- MemoryAllocationLib
- UefiDriverEntryPoint
- BaseMemoryLib
- UefiLib
- DebugLib
- BaseLib
- SynchronizationLib
- DebugAgentLib
- LocalApicLib
-
-[Protocols]
- gEfiMpServiceProtocolGuid ## PRODUCES
- gFrameworkEfiMpServiceProtocolGuid ## CONSUMES
- gEfiGenericMemTestProtocolGuid ## SOMETIMES_CONSUMES
-
-[Depex]
- gFrameworkEfiMpServiceProtocolGuid
diff --git a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/AsmInclude.inc b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/AsmInclude.inc
deleted file mode 100644
index b0e611108f..0000000000
--- a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/AsmInclude.inc
+++ /dev/null
@@ -1,28 +0,0 @@
-;------------------------------------------------------------------------------
-; Include file for X64 MpFuncs.asm
-;
-; Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-; 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.
-;
-;------------------------------------------------------------------------------
-
-VacantFlag Equ 00h
-NotVacantFlag Equ 0ffh
-
-LockLocation equ RendezvousFunnelProcEnd - RendezvousFunnelProcStart
-StackStartAddressLocation equ LockLocation + 08h
-StackSizeLocation equ LockLocation + 10h
-CProcedureLocation equ LockLocation + 18h
-GdtrLocation equ LockLocation + 20h
-IdtrLocation equ LockLocation + 2Ah
-BufferStartLocation equ LockLocation + 34h
-Cr3OffsetLocation equ LockLocation + 38h
-ProcessorNumberLocation equ LockLocation + 3Ch
-
-;-------------------------------------------------------------------------------
diff --git a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S
deleted file mode 100644
index 9585d32241..0000000000
--- a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S
+++ /dev/null
@@ -1,210 +0,0 @@
-#------------------------------------------------------------------------------
-# X64 assembly file for AP startup vector.
-#
-# Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
-# 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.
-#
-#------------------------------------------------------------------------------
-
-
-.set VacantFlag, 0x0
-.set NotVacantFlag, 0xff
-
-.set LockLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart
-.set StackStartAddressLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x08
-.set StackSizeLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x10
-.set CProcedureLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x18
-.set GdtrLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x20
-.set IdtrLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x2A
-.set BufferStartLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x34
-.set Cr3OffsetLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x38
-.set ProcessorNumberLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x38
-
-#-------------------------------------------------------------------------------------
-
-#-------------------------------------------------------------------------------------
-#RendezvousFunnelProc procedure follows. All APs execute their procedure. This
-#procedure serializes all the AP processors through an Init sequence. It must be
-#noted that APs arrive here very raw...ie: real mode, no stack.
-#ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC
-#IS IN MACHINE CODE.
-#-------------------------------------------------------------------------------------
-#RendezvousFunnelProc (&WakeUpBuffer,MemAddress);
-
-.text
-
-ASM_GLOBAL ASM_PFX(RendezvousFunnelProc)
-ASM_PFX(RendezvousFunnelProc):
-RendezvousFunnelProcStart:
-
-# At this point CS = 0x(vv00) and ip= 0x0.
-
- .byte 0x8c,0xc8 # mov ax, cs
- .byte 0x8e,0xd8 # mov ds, ax
- .byte 0x8e,0xc0 # mov es, ax
- .byte 0x8e,0xd0 # mov ss, ax
- .byte 0x33,0xc0 # xor ax, ax
- .byte 0x8e,0xe0 # mov fs, ax
- .byte 0x8e,0xe8 # mov gs, ax
-
-# Switch to flat mode.
-
- .byte 0xBE
- .word BufferStartLocation
- .byte 0x66,0x8B,0x14 # mov edx,dword ptr [si] ; EDX is keeping the start address of wakeup buffer
-
- .byte 0xBE
- .word Cr3OffsetLocation
- .byte 0x66,0x8B,0xC # mov ecx,dword ptr [si] ; ECX is keeping the value of CR3
-
- .byte 0xBE
- .word GdtrLocation
- .byte 0x66 # db 66h
- .byte 0x2E,0xF,0x1,0x14 # lgdt fword ptr cs:[si]
-
- .byte 0xBE
- .word IdtrLocation
- .byte 0x66 # db 66h
- .byte 0x2E,0xF,0x1,0x1C # lidt fword ptr cs:[si]
-
- .byte 0x33,0xC0 # xor ax, ax
- .byte 0x8E,0xD8 # mov ds, ax
-
- .byte 0xF,0x20,0xC0 # mov eax, cr0 ; Get control register 0
- .byte 0x66,0x83,0xC8,0x1 # or eax, 000000001h ; Set PE bit (bit #0)
- .byte 0xF,0x22,0xC0 # mov cr0, eax
-
-FLAT32_JUMP:
-
- .byte 0x66,0x67,0xEA # far jump
- .long 0x0 # 32-bit offset
- .word 0x20 # 16-bit selector
-
-ProtectedModeStart:
-
- .byte 0x66,0xB8,0x18,0x0 # mov ax, 18h
- .byte 0x66,0x8E,0xD8 # mov ds, ax
- .byte 0x66,0x8E,0xC0 # mov es, ax
- .byte 0x66,0x8E,0xE0 # mov fs, ax
- .byte 0x66,0x8E,0xE8 # mov gs, ax
- .byte 0x66,0x8E,0xD0 # mov ss, ax ; Flat mode setup.
-
- .byte 0xF,0x20,0xE0 # mov eax, cr4
- .byte 0xF,0xBA,0xE8,0x5 # bts eax, 5
- .byte 0xF,0x22,0xE0 # mov cr4, eax
-
- .byte 0xF,0x22,0xD9 # mov cr3, ecx
-
- .byte 0x8B,0xF2 # mov esi, edx ; Save wakeup buffer address
-
- .byte 0xB9
- .long 0xC0000080 # mov ecx, 0c0000080h ; EFER MSR number.
- .byte 0xF,0x32 # rdmsr ; Read EFER.
- .byte 0xF,0xBA,0xE8,0x8 # bts eax, 8 ; Set LME=1.
- .byte 0xF,0x30 # wrmsr ; Write EFER.
-
- .byte 0xF,0x20,0xC0 # mov eax, cr0 ; Read CR0.
- .byte 0xF,0xBA,0xE8,0x1F # bts eax, 31 ; Set PG=1.
- .byte 0xF,0x22,0xC0 # mov cr0, eax ; Write CR0.
-
-LONG_JUMP:
-
- .byte 0x67,0xEA # far jump
- .long 0x0 # 32-bit offset
- .word 0x38 # 16-bit selector
-
-LongModeStart:
-
- movw $0x30,%ax
- .byte 0x66
- movw %ax,%ds
- .byte 0x66
- movw %ax,%es
- .byte 0x66
- movw %ax,%ss
-
- #
- # ProgramStack
- #
- movl $0x1b, %ecx
- rdmsr
-
- btl $10, %eax # Check for x2apic mode
- jnc LegacyApicMode
- movl $0x802, %ecx # Read APIC_ID
- rdmsr
- movl %eax, %ebx # ebx == apicid
- jmp GetCpuNumber
-
-LegacyApicMode:
- andl $0xfffff000, %eax
- addl $0x20, %eax
- movl (%eax), %ebx
- shrl $24, %ebx # ebx == apicid
-
-GetCpuNumber:
- xorq %rcx, %rcx
- movl %esi,%edi
- addl $ProcessorNumberLocation, %edi
- movl (%edi, %ebx, 4), %ecx
-
- movl %esi,%edi
- addl $StackSizeLocation, %edi
- movq (%edi), %rax
- incq %rcx
- mulq %rcx
-
- movl %esi,%edi
- addl $StackStartAddressLocation, %edi
- movq (%edi), %rbx
- addq %rbx, %rax
-
- movq %rax, %rsp
-
- #
- # Call C Function
- #
- movl %esi,%edi
- addl $CProcedureLocation, %edi
- movq (%edi), %rax
-
- testq %rax, %rax
- jz GoToSleep
-
- subq $0x20, %rsp
- call *%rax
- addq $0x20, %rsp
-
-GoToSleep:
-
- cli
- hlt
- jmp .-2
-
-RendezvousFunnelProcEnd:
-
-
-#-------------------------------------------------------------------------------------
-# AsmGetAddressMap (&AddressMap);
-#-------------------------------------------------------------------------------------
-# comments here for definition of address map
-ASM_GLOBAL ASM_PFX(AsmGetAddressMap)
-ASM_PFX(AsmGetAddressMap):
-#ifdef __APPLE__
- int $3
-#else
- movq $RendezvousFunnelProcStart, %rax
- movq %rax, (%rcx)
- movq $(ProtectedModeStart - RendezvousFunnelProcStart), 0x08(%rcx)
- movq $(FLAT32_JUMP - RendezvousFunnelProcStart), 0x10(%rcx)
- movq $(LongModeStart - RendezvousFunnelProcStart), 0x18(%rcx)
- movq $(LONG_JUMP - RendezvousFunnelProcStart), 0x20(%rcx)
- movq $(RendezvousFunnelProcEnd - RendezvousFunnelProcStart), 0x28(%rcx)
-#endif
- ret
diff --git a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm
deleted file mode 100644
index a3c9c7219c..0000000000
--- a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm
+++ /dev/null
@@ -1,196 +0,0 @@
-;------------------------------------------------------------------------------
-; X64 assembly file for AP startup vector.
-;
-; Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-; 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.
-;
-;------------------------------------------------------------------------------
-
-.code
-
-include AsmInclude.inc
-;-------------------------------------------------------------------------------------
-
-;-------------------------------------------------------------------------------------
-;RendezvousFunnelProc procedure follows. All APs execute their procedure. This
-;procedure serializes all the AP processors through an Init sequence. It must be
-;noted that APs arrive here very raw...ie: real mode, no stack.
-;ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC
-;IS IN MACHINE CODE.
-;-------------------------------------------------------------------------------------
-;RendezvousFunnelProc (&WakeUpBuffer,MemAddress);
-
-RendezvousFunnelProc PROC PUBLIC
-RendezvousFunnelProcStart::
-
-; At this point CS = 0x(vv00) and ip= 0x0.
-
- db 8ch, 0c8h ; mov ax, cs
- db 8eh, 0d8h ; mov ds, ax
- db 8eh, 0c0h ; mov es, ax
- db 8eh, 0d0h ; mov ss, ax
- db 33h, 0c0h ; xor ax, ax
- db 8eh, 0e0h ; mov fs, ax
- db 8eh, 0e8h ; mov gs, ax
-
-; Switch to flat mode.
-
- db 0BEh
- dw BufferStartLocation ; mov si, BufferStartLocation
- db 66h, 8Bh, 14h ; mov edx,dword ptr [si] ; EDX is keeping the start address of wakeup buffer
-
- db 0BEh
- dw Cr3OffsetLocation ; mov si, Cr3Location
- db 66h, 8Bh, 0Ch ; mov ecx,dword ptr [si] ; ECX is keeping the value of CR3
-
- db 0BEh
- dw GdtrLocation ; mov si, GdtrProfile
- db 66h ; db 66h
- db 2Eh, 0Fh, 01h, 14h ; lgdt fword ptr cs:[si]
-
- db 0BEh
- dw IdtrLocation ; mov si, IdtrProfile
- db 66h ; db 66h
- db 2Eh, 0Fh, 01h, 1Ch ; lidt fword ptr cs:[si]
-
- db 33h, 0C0h ; xor ax, ax
- db 8Eh, 0D8h ; mov ds, ax
-
- db 0Fh, 20h, 0C0h ; mov eax, cr0 ; Get control register 0
- db 66h, 83h, 0C8h, 01h ; or eax, 000000001h ; Set PE bit (bit #0)
- db 0Fh, 22h, 0C0h ; mov cr0, eax
-
-FLAT32_JUMP::
-
- db 66h, 67h, 0EAh ; far jump
- dd 0h ; 32-bit offset
- dw 20h ; 16-bit selector
-
-ProtectedModeStart::
-
- db 66h, 0B8h, 18h, 00h ; mov ax, 18h
- db 66h, 8Eh, 0D8h ; mov ds, ax
- db 66h, 8Eh, 0C0h ; mov es, ax
- db 66h, 8Eh, 0E0h ; mov fs, ax
- db 66h, 8Eh, 0E8h ; mov gs, ax
- db 66h, 8Eh, 0D0h ; mov ss, ax ; Flat mode setup.
-
- db 0Fh, 20h, 0E0h ; mov eax, cr4
- db 0Fh, 0BAh, 0E8h, 05h ; bts eax, 5
- db 0Fh, 22h, 0E0h ; mov cr4, eax
-
- db 0Fh, 22h, 0D9h ; mov cr3, ecx
-
- db 8Bh, 0F2h ; mov esi, edx ; Save wakeup buffer address
-
- db 0B9h
- dd 0C0000080h ; mov ecx, 0c0000080h ; EFER MSR number.
- db 0Fh, 32h ; rdmsr ; Read EFER.
- db 0Fh, 0BAh, 0E8h, 08h ; bts eax, 8 ; Set LME=1.
- db 0Fh, 30h ; wrmsr ; Write EFER.
-
- db 0Fh, 20h, 0C0h ; mov eax, cr0 ; Read CR0.
- db 0Fh, 0BAh, 0E8h, 1Fh ; bts eax, 31 ; Set PG=1.
- db 0Fh, 22h, 0C0h ; mov cr0, eax ; Write CR0.
-
-LONG_JUMP::
-
- db 67h, 0EAh ; far jump
- dd 0h ; 32-bit offset
- dw 38h ; 16-bit selector
-
-LongModeStart::
-
- mov ax, 30h
- mov ds, ax
- mov es, ax
- mov ss, ax
-
- ;
- ; ProgramStack
- ;
- mov ecx, 1bh ; Read IA32_APIC_BASE MSR
- rdmsr
-
- bt eax, 10 ; Check for x2apic mode
- jnc LegacyApicMode
- mov ecx, 802h ; Read APIC_ID
- rdmsr
- mov ebx, eax ; ebx == apicid
- jmp GetCpuNumber
-
-LegacyApicMode::
-
- and eax, 0fffff000h
- add eax, 20h
- mov ebx, dword ptr [eax]
- shr ebx, 24 ; ebx == apicid
-
-GetCpuNumber::
-
- xor rcx, rcx
- mov edi, esi
- add edi, ProcessorNumberLocation
- mov ecx, dword ptr [edi + 4 * ebx] ; RCX = CpuNumber
-
- mov edi, esi
- add edi, StackSizeLocation
- mov rax, qword ptr [edi]
- inc rcx
- mul rcx ; RAX = StackSize * (CpuNumber + 1)
-
- mov edi, esi
- add edi, StackStartAddressLocation
- mov rbx, qword ptr [edi]
- add rax, rbx ; RAX = StackStart + StackSize * (CpuNumber + 1)
-
- mov rsp, rax
-
- ;
- ; Call C Function
- ;
- mov edi, esi
- add edi, CProcedureLocation
- mov rax, qword ptr [edi]
-
- test rax, rax
- jz GoToSleep
-
- sub rsp, 20h
- call rax
- add rsp, 20h
-
-GoToSleep::
-
- cli
- hlt
- jmp $-2
-
-RendezvousFunnelProc ENDP
-RendezvousFunnelProcEnd::
-
-
-;-------------------------------------------------------------------------------------
-; AsmGetAddressMap (&AddressMap);
-;-------------------------------------------------------------------------------------
-AsmGetAddressMap PROC
-
- mov rax, offset RendezvousFunnelProcStart
- mov qword ptr [rcx], rax
- mov qword ptr [rcx+8h], ProtectedModeStart - RendezvousFunnelProcStart
- mov qword ptr [rcx+10h], FLAT32_JUMP - RendezvousFunnelProcStart
- mov qword ptr [rcx+18h], LongModeStart - RendezvousFunnelProcStart
- mov qword ptr [rcx+20h], LONG_JUMP - RendezvousFunnelProcStart
- mov qword ptr [rcx+28h], RendezvousFunnelProcEnd - RendezvousFunnelProcStart
-
- ret
-
-AsmGetAddressMap ENDP
-
-END
diff --git a/EdkCompatibilityPkg/Compatibility/PciCfg2OnPciCfgThunk/PciCfg2OnPciCfgThunk.c b/EdkCompatibilityPkg/Compatibility/PciCfg2OnPciCfgThunk/PciCfg2OnPciCfgThunk.c
deleted file mode 100644
index dfa1d42014..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PciCfg2OnPciCfgThunk/PciCfg2OnPciCfgThunk.c
+++ /dev/null
@@ -1,447 +0,0 @@
-/** @file
- Module produces PciCfgPpi2 on top of PciCfgPpi. It also updates the
- PciCfg2Ppi pointer in the EFI_PEI_SERVICES upon a installation of
- EcpPeiPciCfgPpi.
-
- EcpPeiPciCfgPpi is installed by a framework module which
- produce PciCfgPpi originally. Such framework module is updated based on the
- following rule to install EcpPeiPciCfgPpi instead of updating the PciCfg pointer
- in the Framework PeiServicesTable:
-
- Search pattern:
- PeiServices->PciCfg = <*>;
- Replace pattern:
- {
- static EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEcpPeiPciCfgPpiGuid,
- <*>
- };
- (**PeiServices).InstallPpi (PeiServices, gEcpPeiPciCfgPpiList);
- }
-
- In addition, the PeiServicesTable definition in PeiApi.h is updated to
-
- struct _EFI_PEI_SERVICES {
- EFI_TABLE_HEADER Hdr;
- ...
-
- //
- // Pointer to PPI interface
- //
- if (PI_SPECIFICATION_VERSION < 0x00010000)
-
- PEI_CPU_IO_PPI *CpuIo;
- ECP_PEI_PCI_CFG_PPI *PciCfg; //Changed.
- else
- ...
- endif
-
- };
-
- This change enable the detection of code segment which invokes PeiServices->PciCfg->Modify.
- Such code causes a build break as ECP_PEI_PCI_CFG_PPI does not has "Modify" field.
- This should be updated to a call to PeiLibPciCfgModify as shown below:
-
- Search pattern:
- *->Modify(<*>);
- Replace pattern:
- PeiLibPciCfgModify(<*>);
-
-
-
-PIWG's PI specification replaces Inte's EFI Specification 1.10.
-EFI_PEI_PCI_CFG_PPI defined in Inte's EFI Specification 1.10 is replaced by
-EFI_PEI_PCI_CFG2_PPI in PI 1.0.
-This module produces PciCfgPpi on top of PciCfgPpi2. This module is used on platform when both of
-these two conditions are true:
-1) Framework module present that produces PCI CFG PPI AND
-2) PI module that produces PCI CFG2 is not present
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include <PiPei.h>
-#include <Ppi/PciCfg.h>
-#include <Ppi/PciCfg2.h>
-#include <Ppi/EcpPciCfg.h>
-#include <Library/DebugLib.h>
-
-//
-// Function Prototypes
-//
-
-/**
- Notification service to be called when gEcpPeiPciCfgPpiGuid is installed.
-
- @param PeiServices Indirect reference to the PEI Services Table.
- @param NotifyDescriptor Address of the notification descriptor data structure. Type
- EFI_PEI_NOTIFY_DESCRIPTOR is defined above.
- @param Ppi Address of the PPI that was installed.
-
- @retval EFI_STATUS This function will install a PPI to PPI database. The status
- code will be the code for (*PeiServices)->InstallPpi.
-
-**/
-EFI_STATUS
-EFIAPI
-EcpPciCfgPpiNotifyCallback (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
- IN VOID *Ppi
- );
-
-//
-// Function Prototypes
-//
-/**
- Reads from a given location in the PCI configuration space.
-
- @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes.
- See EFI_PEI_PCI_CFG_PPI_WIDTH above.
-
- @param Address The physical address of the access. The format of
- the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
-
- @param Buffer A pointer to the buffer of data..
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
- time.
-
-**/
-EFI_STATUS
-EFIAPI
-PciCfg2Read (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN CONST EFI_PEI_PCI_CFG2_PPI *This,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT64 Address,
- IN OUT VOID *Buffer
- );
-
-/**
- Write to a given location in the PCI configuration space.
-
- @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes.
- See EFI_PEI_PCI_CFG_PPI_WIDTH above.
-
- @param Address The physical address of the access. The format of
- the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
-
- @param Buffer A pointer to the buffer of data..
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this time.
-
-**/
-EFI_STATUS
-EFIAPI
-PciCfg2Write (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN CONST EFI_PEI_PCI_CFG2_PPI *This,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT64 Address,
- IN OUT VOID *Buffer
- );
-
-/**
- PCI read-modify-write operation.
-
- @param PeiServices An indirect pointer to the PEI Services Table
- published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes. Type
- EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
-
- @param Address The physical address of the access.
-
- @param SetBits Points to value to bitwise-OR with the read configuration value.
- The size of the value is determined by Width.
-
- @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
- The size of the value is determined by Width.
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting
- the operation at this time.
-
-**/
-EFI_STATUS
-EFIAPI
-PciCfg2Modify (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN CONST EFI_PEI_PCI_CFG2_PPI *This,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT64 Address,
- IN VOID *SetBits,
- IN VOID *ClearBits
- );
-
-//
-// Module globals
-//
-EFI_PEI_NOTIFY_DESCRIPTOR mNotifyOnEcpPciCfgList = {
- (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEcpPeiPciCfgPpiGuid,
- EcpPciCfgPpiNotifyCallback
-};
-
-EFI_PEI_PCI_CFG2_PPI mPciCfg2Ppi = {
- PciCfg2Read,
- PciCfg2Write,
- PciCfg2Modify,
- 0
-};
-
-EFI_PEI_PPI_DESCRIPTOR mPpiListPciCfg2 = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiPciCfg2PpiGuid,
- &mPciCfg2Ppi
-};
-
-
-/**
-
- Standard PEIM entry point.
-
- @param FileHandle Handle of the file being invoked.
- @param PeiServices General purpose services available to every PEIM.
-
- @retval EFI_SUCCESS The interface could be successfully installed.
-
-**/
-EFI_STATUS
-EFIAPI
-PeimInitializePciCfg2 (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- EFI_STATUS Status;
- VOID *Ppi;
-
- //
- // Make sure no other module has install the first instance of gEfiPciCfg2PpiGuid.
- //
- Status = (*PeiServices)->LocatePpi (PeiServices, &gEfiPciCfg2PpiGuid, 0, NULL, &Ppi);
- ASSERT (Status == EFI_NOT_FOUND);
-
- //
- // Register a notification for ECP PCI CFG PPI
- //
- Status = (*PeiServices)->NotifyPpi (PeiServices, &mNotifyOnEcpPciCfgList);
- ASSERT_EFI_ERROR (Status);
- return Status;
-}
-
-
-/**
- Notification service to be called when gEcpPeiPciCfgPpiGuid is installed.
-
- @param PeiServices Indirect reference to the PEI Services Table.
- @param NotifyDescriptor Address of the notification descriptor data structure. Type
- EFI_PEI_NOTIFY_DESCRIPTOR is defined above.
- @param Ppi Address of the PPI that was installed.
-
- @retval EFI_STATUS This function will install a PPI to PPI database. The status
- code will be the code for (*PeiServices)->InstallPpi.
-
-**/
-EFI_STATUS
-EFIAPI
-EcpPciCfgPpiNotifyCallback (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
- IN VOID *Ppi
- )
-{
- //
- // When ECP PCI CFG PPI is installed, publish the PCI CFG2 PPI in the
- // PEI Services Table and the PPI database
- //
- (*PeiServices)->PciCfg = &mPciCfg2Ppi;
- return (*PeiServices)->InstallPpi ((CONST EFI_PEI_SERVICES **)PeiServices, &mPpiListPciCfg2);
-}
-
-/**
- Reads from a given location in the PCI configuration space.
-
- @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes.
- See EFI_PEI_PCI_CFG_PPI_WIDTH above.
-
- @param Address The physical address of the access. The format of
- the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
-
- @param Buffer A pointer to the buffer of data..
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
- time.
-
-**/
-EFI_STATUS
-EFIAPI
-PciCfg2Read (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN CONST EFI_PEI_PCI_CFG2_PPI *This,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT64 Address,
- IN OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EFI_PEI_PCI_CFG_PPI *PciCfg;
-
- Status = (*PeiServices)->LocatePpi (
- PeiServices,
- &gEcpPeiPciCfgPpiGuid,
- 0,
- NULL,
- (VOID **)&PciCfg
- );
- ASSERT_EFI_ERROR (Status);
-
- return PciCfg->Read ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, Buffer);
-}
-
-/**
- Write to a given location in the PCI configuration space.
-
- @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes.
- See EFI_PEI_PCI_CFG_PPI_WIDTH above.
-
- @param Address The physical address of the access. The format of
- the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
-
- @param Buffer A pointer to the buffer of data..
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
- time.
-
-**/
-EFI_STATUS
-EFIAPI
-PciCfg2Write (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN CONST EFI_PEI_PCI_CFG2_PPI *This,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT64 Address,
- IN OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EFI_PEI_PCI_CFG_PPI *PciCfg;
-
- Status = (*PeiServices)->LocatePpi (
- PeiServices,
- &gEcpPeiPciCfgPpiGuid,
- 0,
- NULL,
- (VOID **)&PciCfg
- );
- ASSERT_EFI_ERROR (Status);
-
- return PciCfg->Write ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, Buffer);
-}
-
-/**
- PCI read-modify-write operation.
-
- @param PeiServices An indirect pointer to the PEI Services Table
- published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes. Type
- EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
-
- @param Address The physical address of the access.
-
- @param SetBits Points to value to bitwise-OR with the read configuration value.
- The size of the value is determined by Width.
-
- @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
- The size of the value is determined by Width.
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting
- the operation at this time.
-
-**/
-EFI_STATUS
-EFIAPI
-PciCfg2Modify (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN CONST EFI_PEI_PCI_CFG2_PPI *This,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT64 Address,
- IN VOID *SetBits,
- IN VOID *ClearBits
- )
-{
- EFI_STATUS Status;
- EFI_PEI_PCI_CFG_PPI *PciCfg;
-
- Status = (*PeiServices)->LocatePpi (
- PeiServices,
- &gEfiPciCfgPpiInServiceTableGuid,
- 0,
- NULL,
- (VOID **)&PciCfg
- );
- ASSERT_EFI_ERROR (Status);
-
- return PciCfg->Modify ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, *(UINTN *)SetBits, *(UINTN *)ClearBits);
-}
diff --git a/EdkCompatibilityPkg/Compatibility/PciCfg2OnPciCfgThunk/PciCfg2OnPciCfgThunk.inf b/EdkCompatibilityPkg/Compatibility/PciCfg2OnPciCfgThunk/PciCfg2OnPciCfgThunk.inf
deleted file mode 100644
index f9f11def5b..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PciCfg2OnPciCfgThunk/PciCfg2OnPciCfgThunk.inf
+++ /dev/null
@@ -1,105 +0,0 @@
-## @file
-# Module produces PciCfgPpi2 on top of PciCfgPpi. It also updates the
-# PciCfg2Ppi pointer in the EFI_PEI_SERVICES upon a installation of
-# EcpPeiPciCfgPpi.
-#
-# EcpPeiPciCfgPpi is installed by a framework module which
-# produce PciCfgPpi originally. Such framework module is updated based on the
-# following rule to install EcpPeiPciCfgPpi instead of updating the PciCfg pointer
-# in the Framework PeiServicesTable:
-#
-# Search pattern:
-# PeiServices->PciCfg = <*>;
-# Replace pattern:
-# {
-# static EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = {
-# (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-# &gEcpPeiPciCfgPpiGuid,
-# <*>
-# };
-# (**PeiServices).InstallPpi (PeiServices, &gEcpPeiPciCfgPpiList);
-# }
-#
-# In addition, the PeiServicesTable definition in PeiApi.h is updated to
-#
-# struct _EFI_PEI_SERVICES {
-# EFI_TABLE_HEADER Hdr;
-# ...
-#
-# //
-# // Pointer to PPI interface
-# //
-# #if (PI_SPECIFICATION_VERSION < 0x00010000)
-#
-# PEI_CPU_IO_PPI *CpuIo;
-# ECP_PEI_PCI_CFG_PPI *PciCfg; //Changed.
-# #else
-# ...
-# #endif
-#
-# };
-#
-# This change enable the detection of code segment which invokes PeiServices->PciCfg->Modify.
-# Such code causes a build break as ECP_PEI_PCI_CFG_PPI does not has "Modify" field.
-# This should be updated to a call to PeiLibPciCfgModify as shown below:
-#
-# Search pattern:
-# *->Modify(<*>);
-# Replace pattern:
-# PeiLibPciCfgModify(<*>);
-#
-# PIWG's PI specification replaces Inte's EFI Specification 1.10.
-# EFI_PEI_PCI_CFG_PPI defined in Inte's EFI Specification 1.10 is replaced by
-# EFI_PEI_PCI_CFG2_PPI in PI 1.0.
-# This module produces PciCfgPpi on top of PciCfgPpi2. This module is used on platform when both of
-# these two conditions are true:
-# 1) Framework module present that produces PCI CFG PPI AND
-# 2) PI module that produces PCI CFG2 is not present
-#
-#
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PciCfg2OnPciCfgThunk
- FILE_GUID = 41401688-2862-431b-BAAC-6ECADAC384AB
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
-
- ENTRY_POINT = PeimInitializePciCfg2
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- PciCfg2OnPciCfgThunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- PeimEntryPoint
- DebugLib
-
-[Ppis]
- gEfiPciCfgPpiInServiceTableGuid
- gEfiPciCfg2PpiGuid
- gEcpPeiPciCfgPpiGuid
-
-[Depex]
- TRUE
diff --git a/EdkCompatibilityPkg/Compatibility/PciCfgOnPciCfg2Thunk/PciCfgOnPciCfg2Thunk.c b/EdkCompatibilityPkg/Compatibility/PciCfgOnPciCfg2Thunk/PciCfgOnPciCfg2Thunk.c
deleted file mode 100644
index 7a459dfec0..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PciCfgOnPciCfg2Thunk/PciCfgOnPciCfg2Thunk.c
+++ /dev/null
@@ -1,309 +0,0 @@
-/** @file
-Module produce PciCfgPpi on top of PciCfgPpi2.
-
-PIWG's PI specification replaces Inte's EFI Specification 1.10.
-EFI_PEI_PCI_CFG_PPI defined in Inte's EFI Specification 1.10 is replaced by
-EFI_PEI_PCI_CFG2_PPI in PI 1.0.
-This module produces PciCfgPpi on top of PciCfgPpi2. This module is used on platform when both of
-these two conditions are true:
-1) Framework module is present that consumes PCI CFG AND
-2) PI module is present that produces PCI CFG2 but not PCI CFG
-
-The Usage of this module is rare since EDK II module IntelFrameworkModulePkg\Universal\PcatSingleSegmentPciCfgPei\PcatSingleSegmentPciCfgPei.inf
-that produce PCI CFG2 can also produce PCI CFG by setting Pcd Feature Flag gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciCfgDisable
-to FALSE.
-
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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:
-**/
-
-#include <PiPei.h>
-#include <Ppi/PciCfg.h>
-#include <Ppi/PciCfg2.h>
-#include <Library/DebugLib.h>
-
-//
-// Function Prototypes
-//
-
-/**
- Reads from a given location in the PCI configuration space.
-
- @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes.
- See EFI_PEI_PCI_CFG_PPI_WIDTH above.
-
- @param Address The physical address of the access. The format of
- the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
-
- @param Buffer A pointer to the buffer of data..
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
- time.
-
-**/
-EFI_STATUS
-EFIAPI
-PciCfgRead (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_PCI_CFG_PPI *This,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT64 Address,
- IN OUT VOID *Buffer
- );
-
-/**
- Write to a given location in the PCI configuration space.
-
- @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes.
- See EFI_PEI_PCI_CFG_PPI_WIDTH above.
-
- @param Address The physical address of the access. The format of
- the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
-
- @param Buffer A pointer to the buffer of data..
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
- time.
-
-**/
-EFI_STATUS
-EFIAPI
-PciCfgWrite (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_PCI_CFG_PPI *This,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT64 Address,
- IN OUT VOID *Buffer
- );
-
-/**
- PCI read-modify-write operation.
-
- @param PeiServices An indirect pointer to the PEI Services Table
- published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes. Type
- EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
-
- @param Address The physical address of the access.
-
- @param SetBits Points to value to bitwise-OR with the read configuration value.
- The size of the value is determined by Width.
-
- @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
- The size of the value is determined by Width.
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting
- the operation at this time.
-
-**/
-EFI_STATUS
-EFIAPI
-PciCfgModify (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_PCI_CFG_PPI *This,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT64 Address,
- IN UINTN SetBits,
- IN UINTN ClearBits
- );
-
-//
-// Module globals
-//
-EFI_PEI_PCI_CFG_PPI mPciCfgPpi = {
- PciCfgRead,
- PciCfgWrite,
- PciCfgModify,
-};
-
-EFI_PEI_PPI_DESCRIPTOR mPpiListPciCfg = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiPciCfgPpiInServiceTableGuid,
- &mPciCfgPpi
-};
-
-/**
-
- Standard PEIM entry point.
-
- @param FileHandle Handle of the file being invoked.
- @param PeiServices General purpose services available to every PEIM.
-
- @retval EFI_SUCCESS The interface could be successfully installed.
-
-**/
-EFI_STATUS
-EFIAPI
-PeimInitializePciCfg (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- //
- // Publish the PciCfgToPciCfg2 Thunk capability to other modules
- //
- return (*PeiServices)->InstallPpi (PeiServices, &mPpiListPciCfg);
-}
-
-/**
- Reads from a given location in the PCI configuration space.
-
- @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes.
- See EFI_PEI_PCI_CFG_PPI_WIDTH above.
-
- @param Address The physical address of the access. The format of
- the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
-
- @param Buffer A pointer to the buffer of data..
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
- time.
-
-**/
-EFI_STATUS
-EFIAPI
-PciCfgRead (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_PCI_CFG_PPI *This,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT64 Address,
- IN OUT VOID *Buffer
- )
-{
- EFI_PEI_PCI_CFG2_PPI *PciCfg2;
-
- PciCfg2 = (*PeiServices)->PciCfg;
-
- return PciCfg2->Read ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, Buffer);
-}
-
-
-/**
- Write to a given location in the PCI configuration space.
-
- @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes.
- See EFI_PEI_PCI_CFG_PPI_WIDTH above.
-
- @param Address The physical address of the access. The format of
- the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
-
- @param Buffer A pointer to the buffer of data..
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
- time.
-
-**/
-EFI_STATUS
-EFIAPI
-PciCfgWrite (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_PCI_CFG_PPI *This,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT64 Address,
- IN OUT VOID *Buffer
- )
-{
- EFI_PEI_PCI_CFG2_PPI *PciCfg2;
-
- PciCfg2 = (*PeiServices)->PciCfg;
-
- return PciCfg2->Write ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, Buffer);
-}
-
-/**
- PCI read-modify-write operation.
-
- @param PeiServices An indirect pointer to the PEI Services Table
- published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes. Type
- EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
-
- @param Address The physical address of the access.
-
- @param SetBits Points to value to bitwise-OR with the read configuration value.
- The size of the value is determined by Width.
-
- @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
- The size of the value is determined by Width.
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting
- the operation at this time.
-
-**/
-EFI_STATUS
-EFIAPI
-PciCfgModify (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_PCI_CFG_PPI *This,
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
- IN UINT64 Address,
- IN UINTN SetBits,
- IN UINTN ClearBits
- )
-{
- EFI_PEI_PCI_CFG2_PPI *PciCfg2;
-
- PciCfg2 = (*PeiServices)->PciCfg;
-
- return PciCfg2->Modify ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, &SetBits, &ClearBits);
-}
diff --git a/EdkCompatibilityPkg/Compatibility/PciCfgOnPciCfg2Thunk/PciCfgOnPciCfg2Thunk.inf b/EdkCompatibilityPkg/Compatibility/PciCfgOnPciCfg2Thunk/PciCfgOnPciCfg2Thunk.inf
deleted file mode 100644
index 167080562b..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PciCfgOnPciCfg2Thunk/PciCfgOnPciCfg2Thunk.inf
+++ /dev/null
@@ -1,60 +0,0 @@
-## @file
-# Module produce PciCfgPpi on top of PciCfgPpi2.
-#
-# PIWG's PI specification replaces Inte's EFI Specification 1.10.
-# EFI_PEI_PCI_CFG_PPI defined in Inte's EFI Specification 1.10 is replaced by
-# EFI_PEI_PCI_CFG2_PPI in PI 1.0.
-# This module produces PciCfgPpi on top of PciCfgPpi2. This module is used on platform when both of
-# these two conditions are true:
-# 1) Framework module is present that consumes PCI CFG AND
-# 2) EDKII module is present that produces PCI CFG2 but not PCI CFG
-#
-# The Usage of this module is rare since EDK II module IntelFrameworkModulePkg\Universal\PcatSingleSegmentPciCfgPei\PcatSingleSegmentPciCfgPei.inf
-# that produce PCI CFG2 can also produce PCI CFG by setting Pcd Feature Flag gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciCfgDisable
-# to FALSE.
-#
-#
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PciCfgOnPciCfg2Thunk
- FILE_GUID = 717886AB-C40A-44cf-9114-4119E84B0DC7
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
-
- ENTRY_POINT = PeimInitializePciCfg
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- PciCfgOnPciCfg2Thunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
-
-[LibraryClasses]
- PeimEntryPoint
- DebugLib
-
-[Ppis]
- gEfiPciCfgPpiInServiceTableGuid
- gEfiPciCfg2PpiGuid
-
-[Depex]
- gEfiPciCfg2PpiGuid
diff --git a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/ConvLib.c b/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/ConvLib.c
deleted file mode 100644
index 10208cecb4..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/ConvLib.c
+++ /dev/null
@@ -1,829 +0,0 @@
-/** @file
- Common filling functions used in translating Datahub's record
- to PI SMBIOS's record.
-
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "Thunk.h"
-
-/**
- Field Filling Function for Cache SubClass record type 5&6 -- Cache SRAM type.
- Offset is mandatory
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldCacheType5 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_CACHE_SRAM_TYPE_DATA SramData;
- UINT32 Temp;
-
- SramData = *(EFI_CACHE_SRAM_TYPE_DATA*)RecordData;
-
- //
- // Swap two fields because of inconsistency between smbios and datahub specs
- //
- Temp = SramData.Asynchronous;
- SramData.Asynchronous = SramData.Synchronous;
- SramData.Synchronous = Temp;
-
- //
- // Truncate the data to word
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + Offset,
- (EFI_CACHE_SRAM_TYPE_DATA *) &SramData,
- 2
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Cache SubClass record type 10 -- Cache Config.
- Offset is mandatory
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldCacheType10 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
-
- UINT16 CacheConfig;
-
- CopyMem (&CacheConfig, RecordData, 2);
-
- if ((CacheConfig & 0x07) == 0) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Truncate the data to 2 bytes and make cache level zero-based.
- //
- CacheConfig--;
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + Offset,
- &CacheConfig,
- 2
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Enlarge the structure buffer of a structure node in SMBIOS database.
- The function maybe lead the structure pointer for SMBIOS record changed.
-
- @param StructureNode The structure node whose structure buffer is to be enlarged.
- @param NewLength The new length of SMBIOS record which does not include unformat area.
- @param OldBufferSize The old size of SMBIOS record buffer.
- @param NewBufferSize The new size is targeted for enlarged.
-
- @retval EFI_OUT_OF_RESOURCES No more memory to allocate new record
- @retval EFI_SUCCESS Success to enlarge the record buffer size.
-**/
-EFI_STATUS
-SmbiosEnlargeStructureBuffer (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- UINT8 NewLength,
- UINTN OldBufferSize,
- UINTN NewBufferSize
- )
-{
- EFI_SMBIOS_TABLE_HEADER *NewRecord;
- EFI_SMBIOS_PROTOCOL *Smbios;
- EFI_STATUS Status;
- UINT8 CountOfString;
-
- NewRecord = NULL;
- Smbios = GetSmbiosProtocol();
- ASSERT (Smbios != NULL);
-
- NewRecord = (EFI_SMBIOS_TABLE_HEADER*) AllocateZeroPool (NewBufferSize);
- if (NewRecord == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- CopyMem (NewRecord, StructureNode->Structure, OldBufferSize);
-
-
- Status = Smbios->Remove (Smbios, StructureNode->SmbiosHandle);
- ASSERT_EFI_ERROR (Status);
-
- //
- // try to use original handle to enlarge the buffer.
- //
- NewRecord->Length = NewLength;
- Status = Smbios->Add (Smbios, NULL, &StructureNode->SmbiosHandle, NewRecord);
- ASSERT_EFI_ERROR (Status);
- FreePool (NewRecord);
-
- StructureNode->Structure = GetSmbiosBufferFromHandle (
- StructureNode->SmbiosHandle,
- StructureNode->SmbiosType,
- NULL
- );
- GetSmbiosStructureSize (
- StructureNode->Structure,
- &StructureNode->StructureSize,
- &CountOfString
- );
- return EFI_SUCCESS;
-}
-
-/**
- Update the structure buffer of a structure node in SMBIOS database.
- The function lead the structure pointer for SMBIOS record changed.
-
- @param StructureNode The structure node whose structure buffer is to be enlarged.
- @param NewRecord The new SMBIOS record.
-
-**/
-VOID
-SmbiosUpdateStructureBuffer (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN EFI_SMBIOS_TABLE_HEADER *NewRecord
- )
-{
- EFI_SMBIOS_PROTOCOL *Smbios;
- EFI_STATUS Status;
- UINT8 CountOfString;
-
- Smbios = GetSmbiosProtocol();
- ASSERT (Smbios != NULL);
-
- Status = Smbios->Remove (Smbios, StructureNode->SmbiosHandle);
- ASSERT_EFI_ERROR (Status);
-
- //
- // try to use original handle to enlarge the buffer.
- //
- Status = Smbios->Add (Smbios, NULL, &StructureNode->SmbiosHandle, NewRecord);
- ASSERT_EFI_ERROR (Status);
-
- StructureNode->Structure = GetSmbiosBufferFromHandle (
- StructureNode->SmbiosHandle,
- StructureNode->SmbiosType,
- NULL
- );
- GetSmbiosStructureSize (
- StructureNode->Structure,
- &StructureNode->StructureSize,
- &CountOfString
- );
- return ;
-}
-
-/**
- Fill a standard Smbios string field.
-
- This function will convert the unicode string to single byte chars, and only
- English language is supported.
- This function changes the Structure pointer value of the structure node,
- which should be noted by Caller.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is too larger
- @retval EFI_OUT_OF_RESOURCES No memory to allocate new buffer for string
- @retval EFI_SUCCESS Sucess append string for a SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldString (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
- UINT16 *Data;
- CHAR8 AsciiData[SMBIOS_STRING_MAX_LENGTH];
- UINT8 CountOfStrings;
- UINTN OrigStringNumber;
- EFI_SMBIOS_PROTOCOL *Smbios;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- UINT32 OrigStructureSize;
- UINTN NewStructureSize;
- EFI_SMBIOS_TABLE_HEADER *NewRecord;
- UINT32 StringLength;
-
- Status = EFI_SUCCESS;
- OrigStringNumber = 0;
- OrigStructureSize = 0;
-
- //
- // if we have a NULL token,
- //
- if (0 == *((STRING_REF *) RecordData)) {
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + Offset) = 0;
- return EFI_SUCCESS;
- }
-
- //
- // Get the String from the Hii Database
- //
- Data = HiiGetPackageString (
- &(StructureNode->ProducerName),
- *((EFI_STRING_ID *) RecordData),
- NULL
- );
- if (Data == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- StringLength = (UINT32)StrLen (Data);
- //
- // Count the string size including the terminating 0.
- //
- if (StringLength == 0) {
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + Offset) = 0;
- FreePool (Data);
- return EFI_SUCCESS;
- }
-
- if (StringLength > SMBIOS_STRING_MAX_LENGTH) {
- //
- // Too long a string
- //
- FreePool (Data);
- return EFI_INVALID_PARAMETER;
- }
-
- Smbios = GetSmbiosProtocol();
- ASSERT (Smbios != NULL);
-
- //
- // Convert Unicode string to Ascii string which only supported by SMBIOS.
- //
- ZeroMem (AsciiData, SMBIOS_STRING_MAX_LENGTH);
- UnicodeStrToAsciiStr (Data, AsciiData);
-
- //
- // if the field at offset is already filled with some value,
- // find out the string it points to
- //
- OrigStringNumber = *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + Offset);
- if (OrigStringNumber != 0) {
- DEBUG ((EFI_D_ERROR, "[SMBIOSThunk] Update %dth string for type[%d],offset[0x%x],handle[0x%x] to [%s]\n",
- OrigStringNumber, StructureNode->SmbiosType, Offset, StructureNode->SmbiosHandle, AsciiData));
-
- //
- // If original string number is not zero, just update string
- //
- Status = Smbios->UpdateString (Smbios, &StructureNode->SmbiosHandle, &OrigStringNumber, AsciiData);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "[SMBIOSThunk] Fail to update %dth string in offset 0x%x for handle:0x%x type:0x%x\n",
- OrigStringNumber, Offset, StructureNode->SmbiosHandle, StructureNode->SmbiosType));
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
- } else {
- //
- // If the string has not been filled in SMBIOS database, remove it and add again
- // with string appended.
- //
- Status = GetSmbiosStructureSize (StructureNode->Structure, &OrigStructureSize, &CountOfStrings);
- ASSERT_EFI_ERROR (Status);
-
- if (CountOfStrings == 0) {
- NewStructureSize = OrigStructureSize + StringLength;
- } else {
- NewStructureSize = OrigStructureSize + StringLength + 1;
- }
-
- NewRecord = AllocateZeroPool (NewStructureSize);
- if (NewRecord == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- CopyMem (NewRecord, StructureNode->Structure, OrigStructureSize);
-
- //
- // Copy new string into tail of original SMBIOS record buffer.
- //
- if (CountOfStrings == 0) {
- AsciiStrCpy ((CHAR8 *)NewRecord + OrigStructureSize - 2, AsciiData);
- } else {
- AsciiStrCpy ((CHAR8 *)NewRecord + OrigStructureSize - 1, AsciiData);
- }
- DEBUG ((EFI_D_ERROR, "[SMBIOSThunk] Type(%d) offset(0x%x) StringNumber:%d\n",
- StructureNode->SmbiosType, Offset, CountOfStrings + 1));
- //
- // Update string reference number
- //
- *(UINT8 *) ((UINT8 *) NewRecord + Offset) = (UINT8) (CountOfStrings + 1);
- SmbiosHandle = StructureNode->SmbiosHandle;
-
- //
- // Remove original SMBIOS record and add new one
- //
- Status = Smbios->Remove (Smbios, StructureNode->SmbiosHandle);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Add new SMBIOS record
- //
- Status = Smbios->Add (Smbios, NULL, &SmbiosHandle, NewRecord);
- ASSERT_EFI_ERROR (Status);
-
- StructureNode->SmbiosHandle = SmbiosHandle;
-
- FreePool (NewRecord);
- }
-
- //
- // The SMBIOS record buffer maybe re-allocated in SMBIOS database,
- // so update cached buffer pointer in DataHub structure list.
- //
- StructureNode->Structure = GetSmbiosBufferFromHandle (
- StructureNode->SmbiosHandle,
- StructureNode->SmbiosType,
- NULL
- );
- ASSERT (StructureNode->Structure != NULL);
-
- //
- // The string update action maybe lead the record is re-allocated in SMBIOS database
- // so update cached record pointer
- //
- Status = GetSmbiosStructureSize (StructureNode->Structure, &StructureNode->StructureSize, &CountOfStrings);
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
-
-/**
- Find a handle that matches the Link Data and the target Smbios type.
-
- @param TargetType the Smbios type
- @param SubClass the SubClass
- @param LinkData Specifies Instance, SubInstance and ProducerName
- @param Handle the HandleNum found
-
- @retval EFI_NOT_FOUND Can not find the record according to handle
- @retval EFI_SUCCESS Success to find the handle
-**/
-EFI_STATUS
-SmbiosFindHandle (
- IN UINT8 TargetType,
- IN EFI_GUID *SubClass,
- IN EFI_INTER_LINK_DATA *LinkData,
- IN OUT UINT16 *HandleNum
- )
-{
- LIST_ENTRY *Link;
- SMBIOS_STRUCTURE_NODE *StructureNode;
-
- StructureNode = NULL;
-
- //
- // Find out the matching handle
- //
- for (Link = mStructureList.ForwardLink; Link != &mStructureList; Link = Link->ForwardLink) {
- StructureNode = CR (Link, SMBIOS_STRUCTURE_NODE, Link, SMBIOS_STRUCTURE_NODE_SIGNATURE);
- if (StructureNode->Structure->Type == TargetType &&
- CompareGuid (&(StructureNode->SubClass), SubClass) &&
- StructureNode->Instance == LinkData->Instance &&
- StructureNode->SubInstance == LinkData->SubInstance
- ) {
- break;
- }
- }
-
- if (Link == &mStructureList || StructureNode == NULL) {
- return EFI_NOT_FOUND;
- } else {
- *HandleNum = StructureNode->Structure->Handle;
- return EFI_SUCCESS;
- }
-}
-
-/**
- Fill the inter link field for a SMBIOS recorder.
-
- Some SMBIOS recorder need to reference the handle of another SMBIOS record. But
- maybe another SMBIOS record has not been added, so put the InterLink request into
- a linked list and the interlink will be fixedup when a new SMBIOS record is added.
-
- @param StructureNode Point to SMBIOS_STRUCTURE_NODE which reference another record's handle
- @param LinkSmbiosNodeOffset The offset in this record for holding the handle of another SMBIOS record
- @param LinkSmbiosType The type of SMBIOS record want to be linked.
- @param InterLink Point to EFI_INTER_LINK_DATA will be put linked list.
- @param SubClassGuid The guid of subclass for linked SMBIOS record.
-
- @retval EFI_SUCESS The linked record is found and no need fixup in future.
- @retval !EFI_SUCESS The linked record can not be found and InterLink is put a fixing-p linked list.
-**/
-EFI_STATUS
-SmbiosFldInterLink (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT16 LinkSmbiosNodeOffset,
- IN UINT8 LinkSmbiosType,
- IN EFI_INTER_LINK_DATA *InterLink,
- IN EFI_GUID *SubClassGuid
- )
-{
- EFI_STATUS Status;
- SMBIOS_LINK_DATA_FIXUP_NODE *LinkDataFixupNode;
- UINT16 StructureHandle;
-
- Status = EFI_SUCCESS;
- LinkDataFixupNode = NULL;
-
- Status = SmbiosFindHandle (
- LinkSmbiosType, // Smbios type
- SubClassGuid,
- InterLink,
- &StructureHandle
- );
- if (!EFI_ERROR (Status)) {
- //
- // Set the handle
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + LinkSmbiosNodeOffset,
- &StructureHandle,
- sizeof (EFI_SMBIOS_HANDLE)
- );
- } else {
- //
- // Hang this in the link data fixup node
- //
- LinkDataFixupNode = AllocateZeroPool (sizeof (SMBIOS_LINK_DATA_FIXUP_NODE));
- if (LinkDataFixupNode == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- LinkDataFixupNode->Signature = SMBIOS_LINK_DATA_FIXUP_NODE_SIGNATURE;
- LinkDataFixupNode->Offset = LinkSmbiosNodeOffset;
- LinkDataFixupNode->TargetType = LinkSmbiosType;
- CopyMem (
- &LinkDataFixupNode->SubClass,
- SubClassGuid,
- sizeof (EFI_GUID)
- );
- CopyMem (
- &LinkDataFixupNode->LinkData,
- InterLink,
- sizeof (EFI_INTER_LINK_DATA)
- );
- InsertTailList (
- &StructureNode->LinkDataFixup,
- &(LinkDataFixupNode->Link)
- );
- }
-
- return Status;
-}
-
-/**
- Field Filling Function. Transform an EFI_EXP_BASE10_DATA to a word, with 'Mega'
- as the unit.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is invalid.
- @retval EFI_SUCCESS RecordData is successed to be filled into given SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldBase10ToWordWithMega (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_EXP_BASE10_DATA *Base10Data;
- INT16 Value;
- INT16 Exponent;
-
- if (RecordDataSize != sizeof (EFI_EXP_BASE10_DATA)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Base10Data = RecordData;
- Value = Base10Data->Value;
- Exponent = Base10Data->Exponent;
-
- Exponent -= 6;
- while (Exponent != 0) {
- if (Exponent > 0) {
- Value = (INT16) (Value * 10);
- Exponent--;
- } else {
- Value = (INT16) (Value / 10);
- Exponent++;
- }
- }
-
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + Offset,
- &Value,
- 2
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function. Transform an EFI_EXP_BASE2_DATA to a word, with 'Kilo'
- as the unit. Granularity implemented for Cache Size.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is invalid.
- @retval EFI_SUCCESS RecordData is successed to be filled into given SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldBase2ToWordWithKilo (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_EXP_BASE2_DATA *Base2Data;
- UINT32 Value;
- UINT16 Exponent;
-
- if (RecordDataSize != sizeof (EFI_EXP_BASE2_DATA)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Base2Data = RecordData;
- Value = Base2Data->Value;
- Exponent = Base2Data->Exponent;
-
- Exponent -= 10;
- Value <<= Exponent;
-
- //
- // Implement cache size granularity
- //
- if(Value >= 0x8000) {
- Value >>= 6;
- Value |= 0x8000;
- }
-
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + Offset,
- &Value,
- 2
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function. Transform an EFI_EXP_BASE2_DATA to a byte, with '64k'
- as the unit.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is invalid.
- @retval EFI_SUCCESS RecordData is successed to be filled into given SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldBase2ToByteWith64K (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_EXP_BASE2_DATA *Base2Data;
- UINT16 Value;
- UINT16 Exponent;
-
- if (RecordDataSize != sizeof (EFI_EXP_BASE2_DATA)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Base2Data = RecordData;
- Value = Base2Data->Value;
- Exponent = Base2Data->Exponent;
- Exponent -= 16;
- Value <<= Exponent;
-
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + Offset,
- &Value,
- 1
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function. Transform an EFI_EXP_BASE2_DATA to a word, with 10exp-9
- as the unit.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is invalid.
- @retval EFI_SUCCESS RecordData is successed to be filled into given SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldBase10ToByteWithNano (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_EXP_BASE10_DATA *Base10Data;
- INT16 Value;
- INT16 Exponent;
-
- if (RecordDataSize != sizeof (EFI_EXP_BASE2_DATA)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Base10Data = RecordData;
- Value = Base10Data->Value;
- Exponent = Base10Data->Exponent;
-
- Exponent += 9;
- while (Exponent != 0) {
- if (Exponent > 0) {
- Value = (INT16) (Value * 10);
- Exponent--;
- } else {
- Value = (INT16) (Value / 10);
- Exponent++;
- }
- }
-
- * (UINT8 *) ((UINT8 *) (StructureNode->Structure) + Offset) = (UINT8) Value;
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function: truncate record data to byte and fill in the
- field as indicated by Offset.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is invalid.
- @retval EFI_SUCCESS RecordData is successed to be filled into given SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldTruncateToByte (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- //
- // Truncate the data to 8 bits
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + Offset) = (UINT8) (*(UINT8 *) RecordData);
-
- return Status;
-}
-
-/**
- Field Filling Function: truncate record data to byte and fill in the
- field as indicated by Offset.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is invalid.
- @retval EFI_SUCCESS RecordData is successed to be filled into given SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldTruncateToWord (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- //
- // Truncate the data to 8 bits
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + Offset,
- RecordData,
- 2
- );
-
- return Status;
-}
-
-/**
- Check if OEM structure has included 2 trailing 0s in data record.
-
- @param RecordData Point to record data will be checked.
- @param RecordDataSize The size of record data.
-
- @retval 0 2 trailing 0s exist in unformatted section
- @retval 1 1 trailing 0 exists at the end of unformatted section
- @retval -1 There is no 0 at the end of unformatted section
-**/
-INT8
-SmbiosCheckTrailingZero (
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- SMBIOS_STRUCTURE *Smbios;
- CHAR8 *Start;
- CHAR8 *End;
-
- Smbios = (SMBIOS_STRUCTURE *) RecordData;
-
- //
- // Skip over formatted section
- //
- Start = (CHAR8 *) ((UINT8 *) Smbios + Smbios->Length);
- End = (CHAR8 *) RecordData + RecordDataSize;
-
- //
- // Unformatted section exists
- //
- while (Start < End - 1) {
- //
- // Avoid unaligned issue on IPF
- //
- if ((*Start == 0) && (*(Start + 1) == 0)) {
- //
- // 2 trailing 0s exist in unformatted section
- //
- return 0;
- }
- Start++;
- }
-
- if (Start == End - 1) {
- //
- // Check if there has been already 1 trailing 0
- //
- if (*Start == 0) {
- return 1;
- }
- }
-
- //
- // There is no 0 at the end of unformatted section
- //
- return -1;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/ConvTable.c b/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/ConvTable.c
deleted file mode 100644
index 61bc1e9b29..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/ConvTable.c
+++ /dev/null
@@ -1,1335 +0,0 @@
-/** @file
- The conversion table that guides the generation of the Smbios struture list.
-
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "Thunk.h"
-
-///
-/// The minimal length includes last two zero bytes.
-///
-SMBIOS_TYPE_INFO_TABLE_ENTRY mTypeInfoTable[] = {
- //
- // Type 0: Bios Information
- //
- {
- 0,
- 0x1a,
- TRUE,
- FALSE
- }, // size includes wo extension bytes
- //
- // Type 1: System Information
- //
- {
- 1,
- 0x1d,
- TRUE,
- FALSE
- },
- //
- // Type 2: Base Board Information
- //
- {
- 2,
- 0x12,
- FALSE,
- FALSE
- },
- //
- // Type 3: System Enclosure or Chassis
- //
- {
- 3,
- 0x17, // 0x13 covers till OEM-defined, not right
- TRUE,
- FALSE
- },
- //
- // Type 4: Processor
- //
- {
- 4,
- 0x2C,
- TRUE,
- FALSE
- },
- //
- // Type 5: Memory Controller
- //
- {
- 5,
- 0x12,
- FALSE,
- FALSE
- },
- //
- // Type 6: Memory
- //
- {
- 6,
- 0x0E,
- FALSE,
- FALSE
- },
- //
- // Type 7: Cache
- //
- {
- 7,
- 0x15,
- TRUE,
- FALSE
- },
- //
- // Type 8: Port Connector Information
- //
- {
- 8,
- 0x0B,
- FALSE,
- FALSE
- },
- //
- // Type 9: System Slots
- //
- {
- 9,
- 0x0f,
- TRUE,
- FALSE
- },
- //
- // Type 10: On Board Device Information
- //
- {
- 10,
- 0x8,
- FALSE,
- FALSE
- },
- //
- // Type 11: OEM Strings
- //
- {
- 11,
- 0x7,
- FALSE,
- FALSE
- },
- //
- // Type 12: System Configuration Options
- //
- {
- 12,
- 0x7,
- FALSE,
- FALSE
- },
- //
- // Type 13: BIOS Language Information
- //
- {
- 13,
- 0x18,
- FALSE,
- FALSE
- },
- //
- // Type 15: System Event Log
- //
- {
- 15,
- 0x19,
- FALSE,
- FALSE
- },
- //
- // Type 16: Physical Memory Array
- //
- {
- 16,
- 0x11,
- TRUE,
- FALSE
- },
- //
- // Type 17: Memory Device
- //
- {
- 17,
- 0x1d,
- TRUE,
- FALSE
- },
- //
- // Type 18: 32 bit Memory Error Information
- //
- {
- 18,
- 0x19,
- FALSE,
- FALSE
- },
- //
- // Type 19: Memory Array Mapped Address
- //
- {
- 19,
- 0x11,
- TRUE,
- FALSE
- },
- //
- // Type 20: Memory Device Mapped Address
- //
- {
- 20,
- 0x15,
- TRUE,
- FALSE
- },
- //
- // Type 21: Pointing Device
- //
- {
- 21,
- 0x9,
- FALSE,
- FALSE
- },
- //
- // Type 22: Portable Battery
- //
- {
- 22,
- 0x1c,
- FALSE,
- FALSE
- },
- //
- // Type 23: System Reset
- //
- {
- 23,
- 0x0f,
- FALSE,
- FALSE
- },
- //
- // Type 24: Hardware Security
- //
- {
- 24,
- 0x07,
- FALSE,
- FALSE
- },
- //
- // Type 25: System Power Controls
- //
- {
- 25,
- 0x0b,
- FALSE,
- FALSE
- },
- //
- // Type 26: Voltage Probe
- //
- {
- 26,
- 0x18,
- FALSE,
- FALSE
- },
- //
- // Type 27: Cooling Device
- //
- {
- 27,
- 0x10,
- FALSE,
- FALSE
- },
- //
- // Type 28: Temperature Probe
- //
- {
- 28,
- 0x18,
- FALSE,
- FALSE
- },
- //
- // Type 29: Electrical Current Probe
- //
- {
- 29,
- 0x18,
- FALSE,
- FALSE
- },
- //
- // Type 30: Out-of-Band Remote Access
- //
- {
- 30,
- 0x08,
- FALSE,
- FALSE
- },
- //
- // Type 31: BIS Entry Point
- //
- {
- 31,
- 0x1c,
- FALSE,
- FALSE
- },
- //
- // Type 32: System Boot Information
- //
- {
- 32,
- 0x16,
- TRUE,
- FALSE
- },
- //
- // Type 33: 64 bit Memory Error Information
- //
- {
- 33,
- 0x21,
- FALSE,
- FALSE
- },
- //
- // Type 34: Management Device
- //
- {
- 34,
- 0x0d,
- FALSE,
- FALSE
- },
- //
- // Type 35: Management Device Component
- //
- {
- 35,
- 0x0d,
- FALSE,
- FALSE
- },
- //
- // Type 36: Management Device Threshold
- //
- {
- 36,
- 0x12,
- FALSE,
- FALSE
- },
- //
- // Type 37: Memory Channel
- //
- {
- 37,
- 0x0c,
- FALSE,
- FALSE
- },
- //
- // Type 38: IPMI device info
- //
- {
- 38,
- 0x12,
- TRUE,
- FALSE
- },
- //
- // Type 39: Power supply
- //
- {
- 39,
- 0x18,
- FALSE,
- FALSE
- },
- //
- // Type 0x80-0xFF: OEM type
- //
- {
- 0x80,
- 0x6,
- FALSE,
- FALSE
- },
- //
- // Type 127: End of Table
- //
- {
- 127,
- 0x6,
- FALSE,
- FALSE
- },
- //
- // Terminator
- //
- {
- 0,
- 0
- }
-};
-
-SMBIOS_CONVERSION_TABLE_ENTRY mConversionTable[] = {
-
- {
- //
- // Processor Sub Class -- Record Type 1: Frequency
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorCoreFrequencyRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x16,
- SmbiosFldBase10ToWordWithMega
- },
-
- {
- //
- // Processor SubClass -- Record Type 2: Bus Frequency
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorFsbFrequencyRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x12,
- SmbiosFldBase10ToWordWithMega
- },
-
- {
- //
- // Processor SubClass -- Record Type 3: Version
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorVersionRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x10,
- SmbiosFldString
- },
-
- {
- //
- // Processor SubClass -- Record Type 4: Manufacturor
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorManufacturerRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x7,
- SmbiosFldString
- },
-
- {
- //
- // Processor SubClass -- Record Type 5: Serial Number
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorSerialNumberRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x20,
- SmbiosFldString
- },
-
- {
- //
- // Processor SubClass -- Record Type 6: ID
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorIdRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x08,
- SmbiosFldProcessorType6
- },
-
- {
- //
- // Processor SubClass -- Record Type 7: Type
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorTypeRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x05,
- SmbiosFldTruncateToByte
- },
-
- {
- //
- // Processor SubClass -- Record Type 8: Family
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorFamilyRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x06,
- SmbiosFldTruncateToByte
- },
-
- {
- //
- // Processor SubClass -- Record Type 9: Voltage
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorVoltageRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x11,
- SmbiosFldProcessorType9
- },
-
- {
- //
- // Processor SubClass -- Record Type 14: Status
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorStatusRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x18,
- SmbiosFldTruncateToByte
- },
-
- {
- //
- // Processor SubClass -- Record Type 15: Socket Type
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorSocketTypeRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x19,
- SmbiosFldTruncateToByte
- },
-
- {
- //
- // Processor SubClass -- Record Type 16: Socket Name
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorSocketNameRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x04,
- SmbiosFldString
- },
-
- {
- //
- // Processor SubClass -- Record Type 17: Cache Associtation
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- CacheAssociationRecordType,
- 4,
- BySubClassInstanceProducer,
- ByFunctionWithWholeDataRecord,
- 0,
- SmbiosFldProcessorType17
- },
-
- {
- //
- // Processor Sub Class -- Record Type 18: MaxFrequency
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorMaxCoreFrequencyRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x14,
- SmbiosFldBase10ToWordWithMega
- },
-
- {
- //
- // Processor SubClass -- Record Type 19: Asset Tag
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorAssetTagRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x21,
- SmbiosFldString
- },
-
- {
- //
- // Processor Sub Class -- Record Type 25: Core Count
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorCoreCountRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x23,
- SmbiosFldTruncateToByte
- },
-
- {
- //
- // Processor Sub Class -- Record Type 26: Enabled Core Count
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorEnabledCoreCountRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x24,
- SmbiosFldTruncateToByte
- },
-
- {
- //
- // Processor Sub Class -- Record Type 27: Thread Count
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorThreadCountRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x25,
- SmbiosFldTruncateToByte
- },
-
- {
- //
- // Processor Sub Class -- Record Type 28: Processor Characteristics
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorCharacteristicsRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x26,
- SmbiosFldTruncateToWord
- },
-
- {
- //
- // Processor Sub Class -- Record Type 29: Family 2
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorFamily2RecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x28,
- SmbiosFldTruncateToWord
- },
-
- {
- //
- // Processor Sub Class -- Record Type 30: Part Number
- //
- EFI_PROCESSOR_SUBCLASS_GUID,
- ProcessorPartNumberRecordType,
- 4,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x22,
- SmbiosFldString
- },
-
- {
- //
- // Cache SubClass -- Record Type 1: Size
- //
- EFI_CACHE_SUBCLASS_GUID,
- CacheSizeRecordType,
- 7,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x09,
- SmbiosFldBase2ToWordWithKilo
- },
-
- {
- //
- // Cache SubClass -- Record Type 2: Max Size
- //
- EFI_CACHE_SUBCLASS_GUID,
- MaximumSizeCacheRecordType,
- 7,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x07,
- SmbiosFldBase2ToWordWithKilo
- },
-
- {
- //
- // Cache SubClass -- Record Type 3: Speed
- //
- EFI_CACHE_SUBCLASS_GUID,
- CacheSpeedRecordType,
- 7,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x0f,
- SmbiosFldBase10ToByteWithNano
- },
-
- {
- //
- // Cache SubClass -- Record Type 4: Socket
- //
- EFI_CACHE_SUBCLASS_GUID,
- CacheSocketRecordType,
- 7,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x04,
- SmbiosFldString
- },
-
- {
- //
- // Cache SubClass -- Record Type 5: Supported SRAM type
- //
- EFI_CACHE_SUBCLASS_GUID,
- CacheSramTypeRecordType,
- 7,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x0b,
- SmbiosFldCacheType5 // Asynchronous and Synchronous are reversed
- },
-
- {
- //
- // Cache SubClass -- Record Type 6: Installed SRAM type
- //
- EFI_CACHE_SUBCLASS_GUID,
- CacheInstalledSramTypeRecordType,
- 7,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x0d,
- SmbiosFldCacheType5
- },
-
- {
- //
- // Cache SubClass -- Record Type 7: error correction type
- //
- EFI_CACHE_SUBCLASS_GUID,
- CacheErrorTypeRecordType,
- 7,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x10,
- SmbiosFldTruncateToByte
- },
-
- {
- //
- // Cache SubClass -- Record Type 8: cache type
- //
- EFI_CACHE_SUBCLASS_GUID,
- CacheTypeRecordType,
- 7,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x11,
- SmbiosFldTruncateToByte
- },
-
- {
- //
- // Cache SubClass -- Record Type 9: Associativity
- //
- EFI_CACHE_SUBCLASS_GUID,
- CacheAssociativityRecordType,
- 7,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x12,
- SmbiosFldTruncateToByte
- },
-
- {
- //
- // Cache SubClass -- Record Type 10: Cache configuration
- //
- EFI_CACHE_SUBCLASS_GUID,
- CacheConfigRecordType,
- 7,
- BySubclassInstanceSubinstanceProducer,
- ByFunctionWithOffsetSpecified,
- 0x05,
- SmbiosFldCacheType10
- },
-
- {
- //
- // Memory SubClass -- Record Type 2: Physical Memory Array
- //
- EFI_MEMORY_SUBCLASS_GUID,
- EFI_MEMORY_ARRAY_LOCATION_RECORD_NUMBER,
- 16,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMemoryType2
- },
-
- {
- //
- // Memory SubClass -- Record Type 3: Memory Device to SMBIOS type 6
- //
- EFI_MEMORY_SUBCLASS_GUID,
- EFI_MEMORY_ARRAY_LINK_RECORD_NUMBER,
- 6,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldSMBIOSType6
- },
-
- {
- //
- // Memory SubClass -- Record Type 3: Memory Device to SMBIOS type 17
- //
- EFI_MEMORY_SUBCLASS_GUID,
- EFI_MEMORY_ARRAY_LINK_RECORD_NUMBER,
- 17,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMemoryType3
- },
-
- {
- //
- // Memory SubClass -- Record Type 4: Memory Array Mapped Address
- //
- EFI_MEMORY_SUBCLASS_GUID,
- EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER,
- 19,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMemoryType4
- },
-
- {
- //
- // Memory SubClass -- Record Type 5: Memory Device Mapped Address
- //
- EFI_MEMORY_SUBCLASS_GUID,
- EFI_MEMORY_DEVICE_START_ADDRESS_RECORD_NUMBER,
- 20,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMemoryType5
- },
-
- {
- //
- // Memory SubClass -- Record Type 6: Memory Channel Type
- //
- EFI_MEMORY_SUBCLASS_GUID,
- EFI_MEMORY_CHANNEL_TYPE_RECORD_NUMBER,
- 37,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMemoryType6
- },
-
- {
- //
- // Memory SubClass -- Record Type 7: Memory Channel Device
- //
- EFI_MEMORY_SUBCLASS_GUID,
- EFI_MEMORY_CHANNEL_DEVICE_RECORD_NUMBER,
- 37,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMemoryType7
- },
-
- {
- //
- // Memory SubClass -- Record Type 8: Memory Controller information
- //
- EFI_MEMORY_SUBCLASS_GUID,
- EFI_MEMORY_CONTROLLER_INFORMATION_RECORD_NUMBER,
- 5,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMemoryType8
- },
-
- {
- //
- // Memory SubClass -- Record Type 9: Memory 32 Bit Error Information
- //
- EFI_MEMORY_SUBCLASS_GUID,
- EFI_MEMORY_32BIT_ERROR_INFORMATION_RECORD_NUMBER,
- 18,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMemoryType9
- },
-
- {
- //
- // Memory SubClass -- Record Type 10: Memory 64 Bit Error Information
- //
- EFI_MEMORY_SUBCLASS_GUID,
- EFI_MEMORY_64BIT_ERROR_INFORMATION_RECORD_NUMBER,
- 33,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMemoryType10
- },
-
- {
- //
- // Misc SubClass -- Record Type 2: Bios Information (SMBIOS Type 0)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_BIOS_VENDOR_RECORD_NUMBER, // 0,
- 0, // smbios Type 0
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType0
- },
-
- {
- //
- // Misc SubClass -- Record Type 3: System Information (SMBIOS Type 1)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_SYSTEM_MANUFACTURER_RECORD_NUMBER, // 1,
- 1,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType1
- },
-
- {
- //
- // Misc SubClass -- Record Type 4: Base Board Manufacturer (SMBIOS Type 2)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_BASE_BOARD_MANUFACTURER_RECORD_NUMBER, // 2,
- 2, // SMBIOS Type 2
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType2
- },
-
- {
- //
- // Misc SubClass -- Record Type 5: System Enclosure or Chassis (SMBIOS Type 3)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_CHASSIS_MANUFACTURER_RECORD_NUMBER, // 3,
- 3,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType3
- },
-
- {
- //
- // Misc SubClass -- Record Type 6: Port Connector (SMBIOS Type 8)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_RECORD_NUMBER, // 8,
- 8,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType8
- },
-
- {
- //
- // Misc SubClass -- Record Type 7: System Slots (SMBIOS Type 9)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_SYSTEM_SLOT_DESIGNATION_RECORD_NUMBER, // 9,
- 9,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType9
- },
-
- {
- //
- // Misc SubClass -- Record Type 8: Onboard Device (SMBIOS Type 10)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_ONBOARD_DEVICE_RECORD_NUMBER, // 10,
- 10,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType10
- },
-
- {
- //
- // Misc Subclass -- Record Type 9: OEM strings (SMBIOS Type 11)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_OEM_STRING_RECORD_NUMBER, // 11,
- 11,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType11
- },
-
- {
- //
- // Misc SubClass -- Record Type 0A: System Options (SMBIOS Type 12)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_SYSTEM_OPTION_STRING_RECORD_NUMBER, // 12,
- 12,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType12
- },
-
- {
- //
- // Misc SubClass -- Record Type 0B: Number of Installable Languages (SMBIOS Type 13)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_RECORD_NUMBER, // 13,
- 13,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType13
- },
-
- {
- //
- // Misc SubClass -- Record Type 0C: Installable Languages (SMBIOS Type 13)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_SYSTEM_LANGUAGE_STRING_RECORD_NUMBER, // 13,
- 13,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType14
- },
-
- {
- //
- // Misc SubClass -- Record Type 20: System Event Log (SMBIOS Type 15)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_SYSTEM_EVENT_LOG_RECORD_NUMBER, // 15,
- 15,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType15
- },
-
- {
- //
- // Misc SubClass -- Record Type 0F: Pointing Device (SMBIOS Type 21)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_POINTING_DEVICE_TYPE_RECORD_NUMBER, // 21,
- 21,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType21
- },
-
- {
- //
- // Misc SubClass -- Record Type 10: Portable Battery (SMBIOS Type 22)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_PORTABLE_BATTERY_RECORD_NUMBER, // 22,
- 22,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType22
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x11: Reset Capabilities (SMBIOS Type 23)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_RESET_CAPABILITIES_RECORD_NUMBER, // 23,
- 23,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType23
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x12: Hardware Security (SMBIOS Type 24)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_HARDWARE_SECURITY_SETTINGS_DATA_RECORD_NUMBER, // 24,
- 24,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType24
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x13: System Power Controls (SMBIOS Type 25)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_SCHEDULED_POWER_ON_MONTH_RECORD_NUMBER, // 25,
- 25,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType25
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x14: System Power Controls (SMBIOS Type 26)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_VOLTAGE_PROBE_DESCRIPTION_RECORD_NUMBER, // 26,
- 26,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType26
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x15: Cooling Device (SMBIOS Type 27)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_COOLING_DEVICE_TEMP_LINK_RECORD_NUMBER, // 27,
- 27,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType27
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x16: Temperature Probe (SMBIOS Type 28)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_TEMPERATURE_PROBE_DESCRIPTION_RECORD_NUMBER, // 28,
- 28,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType28
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x17: Electrical Current Probe (SMBIOS Type 29)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_ELECTRICAL_CURRENT_PROBE_DESCRIPTION_RECORD_NUMBER, // 29,
- 29,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType29
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x18: Temperature Probe (SMBIOS Type 30)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_REMOTE_ACCESS_MANUFACTURER_DESCRIPTION_RECORD_NUMBER, // 30,
- 30,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType30
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x1A: Boot Information (SMBIOS Type 32)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_BOOT_INFORMATION_STATUS_RECORD_NUMBER, // 32,
- 32,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType32
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x1B: Management Device (SMBIOS Type 34)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_MANAGEMENT_DEVICE_DESCRIPTION_RECORD_NUMBER, // 34,
- 34,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType34
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x1C: Management Device Component (SMBIOS Type 35)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_MANAGEMENT_DEVICE_COMPONENT_DESCRIPTION_RECORD_NUMBER, // 35,
- 35,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType35
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x21: Management Device Threshold (SMBIOS Type 36)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_MANAGEMENT_DEVICE_THRESHOLD_RECORD_NUMBER, // 36,
- 36,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType36
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x1D: Boot Information (SMBIOS Type 38)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_IPMI_INTERFACE_TYPE_RECORD_NUMBER, // 38,
- 38,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType38
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x1E: Power supply (SMBIOS Type 39)
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_SYSTEM_POWER_SUPPLY_RECORD_NUMBER, // 39,
- 39,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType39
- },
-
- {
- //
- // Misc SubClass -- Record Type 0x80-0xFF: OEM type
- //
- EFI_MISC_SUBCLASS_GUID,
- EFI_MISC_SMBIOS_STRUCT_ENCAP_RECORD_NUMBER, // 0x80,
- 0x80,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscTypeOEM
- },
-
- {
- //
- // End-of-Table -- Record Type 127
- //
- EFI_MISC_SUBCLASS_GUID,
- 127,
- 127,
- BySubclassInstanceSubinstanceProducer,
- ByFunction,
- 0,
- SmbiosFldMiscType127
- },
- //
- // Table Terminator
- //
- {
- {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}},
- 0,
- 0,
- (SMBIOS_STRUCTURE_LOCATING_METHOD) 0,
- (SMBIOS_FIELD_FILLING_METHOD) 0,
- 0,
- 0
- }
-};
diff --git a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MemoryConv.c b/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MemoryConv.c
deleted file mode 100644
index 2a847330aa..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MemoryConv.c
+++ /dev/null
@@ -1,1089 +0,0 @@
-/** @file
- Routines that support Memory SubClass data records translation.
-
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "Thunk.h"
-
-/**
- Field Filling Function for Memory SubClass record type 2 -- Physical Memory
- Array.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType2 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
- EFI_MEMORY_ARRAY_LOCATION_DATA *PhyMemArray;
- FRAMEWORK_MEMORY_ARRAY_LOCATION_DATA *FrameworkPhyMemArray;
- UINT32 MemoryCapacity;
- UINT16 NumberMemoryDevices;
- UINT16 Test16;
-
- Status = EFI_SUCCESS;
- PhyMemArray = (EFI_MEMORY_ARRAY_LOCATION_DATA *) RecordData;
- FrameworkPhyMemArray = (FRAMEWORK_MEMORY_ARRAY_LOCATION_DATA *) RecordData;
-
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE16, Location)) = (UINT8) (PhyMemArray->MemoryArrayLocation);
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE16, Use)) = (UINT8) (PhyMemArray->MemoryArrayUse);
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE16, MemoryErrorCorrection)) = (UINT8) (PhyMemArray->MemoryErrorCorrection);
-
- if (!FeaturePcdGet(PcdFrameworkCompatibilitySupport)) {
- MemoryCapacity = (UINT32) (((UINTN) PhyMemArray->MaximumMemoryCapacity.Value) << PhyMemArray->MaximumMemoryCapacity.Exponent);
- NumberMemoryDevices = PhyMemArray->NumberMemoryDevices;
- } else {
- //
- // Support EDk/Framework defined Data strucutre.
- //
- MemoryCapacity = FrameworkPhyMemArray->MaximumMemoryCapacity;
- NumberMemoryDevices = FrameworkPhyMemArray->NumberMemoryDevices;
- }
-
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE16, MaximumCapacity),
- &MemoryCapacity,
- 4
- );
-
- Test16 = 0xfffe;
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE16, MemoryErrorInformationHandle),
- &Test16,
- 2
- );
-
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE16, NumberOfMemoryDevices),
- &NumberMemoryDevices,
- 2
- );
-
- return Status;
-}
-
-/**
- Field Filling Function for Memory SubClass record type 3 -
- - Memory Device: SMBIOS Type 17
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType3 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MEMORY_ARRAY_LINK_DATA *MemDevice;
- FRAMEWORK_MEMORY_ARRAY_LINK_DATA *FrameworkMemDevice;
- UINT64 MemoryDeviceSize;
- BOOLEAN MemoryDeviceSizeUnitMega;
- UINT16 MemoryDeviceSpeed;
- UINT16 MemoryDeviceExponent;
- UINT16 Test16;
-
- MemDevice = (EFI_MEMORY_ARRAY_LINK_DATA *) RecordData;
- FrameworkMemDevice = (FRAMEWORK_MEMORY_ARRAY_LINK_DATA *) RecordData;
- MemoryDeviceSpeed = 0;
- MemoryDeviceExponent = 0;
-
- //
- // Memory Device Locator
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE17, DeviceLocator),
- &(MemDevice->MemoryDeviceLocator),
- sizeof (STRING_REF)
- );
-
- //
- // Memory Bank Locator
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE17, BankLocator),
- &(MemDevice->MemoryBankLocator),
- sizeof (STRING_REF)
- );
-
- //
- // Memory Manufacturer
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE17, Manufacturer),
- &(MemDevice->MemoryManufacturer),
- sizeof (STRING_REF)
- );
-
- //
- // Memory Serial Number
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE17, SerialNumber),
- &(MemDevice->MemorySerialNumber),
- sizeof (STRING_REF)
- );
-
- //
- // Memory Asset Tag
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE17, AssetTag),
- &(MemDevice->MemoryAssetTag),
- sizeof (STRING_REF)
- );
-
- //
- // Memory Part Number
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE17, PartNumber),
- &(MemDevice->MemoryPartNumber),
- sizeof (STRING_REF)
- );
-
- //
- // Memory Array Link
- //
- SmbiosFldInterLink (
- StructureNode,
- (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE17, MemoryArrayHandle),
- 16, // SMBIOS type 16
- &MemDevice->MemoryArrayLink,
- &gEfiMemorySubClassGuid
- );
-
- //
- // Set Memory Error Information Handle to Not supported
- //
- Test16 = 0xfffe;
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE17, MemoryErrorInformationHandle),
- &Test16,
- sizeof (EFI_SMBIOS_HANDLE)
- );
-
- //
- // Total width
- //
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE17, TotalWidth),
- &MemDevice->MemoryTotalWidth,
- 2
- );
-
- //
- // Data Width
- //
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE17, DataWidth),
- &MemDevice->MemoryDataWidth,
- 2
- );
-
- //
- // Device Size
- //
- if (!FeaturePcdGet(PcdFrameworkCompatibilitySupport)) {
- //
- // Form Factor
- //
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE17, FormFactor),
- &MemDevice->MemoryFormFactor,
- 1
- );
-
- //
- // Device Set
- //
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE17, DeviceSet),
- &MemDevice->MemoryDeviceSet,
- 1
- );
-
- //
- // Type
- //
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE17, MemoryType),
- &MemDevice->MemoryType,
- 1
- );
-
- //
- // Type Detail
- //
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE17, TypeDetail),
- &MemDevice->MemoryTypeDetail,
- 2
- );
-
- //
- // Speed
- //
- MemoryDeviceSpeed = MemDevice->MemorySpeed.Value;
- MemoryDeviceExponent = MemDevice->MemorySpeed.Exponent;
- while (MemoryDeviceExponent-- > 0) {
- MemoryDeviceSpeed = (UINT16) (MemoryDeviceSpeed * 10);
- }
-
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE17, Speed),
- &MemoryDeviceSpeed,
- 2
- );
-
- MemoryDeviceSize = (UINT64) (((UINTN) MemDevice->MemoryDeviceSize.Value) << MemDevice->MemoryDeviceSize.Exponent);
- } else {
- //
- // Form Factor
- //
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE17, FormFactor),
- &FrameworkMemDevice->MemoryFormFactor,
- 1
- );
-
- //
- // Device Set
- //
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE17, DeviceSet),
- &FrameworkMemDevice->MemoryDeviceSet,
- 1
- );
-
- //
- // Type
- //
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE17, MemoryType),
- &FrameworkMemDevice->MemoryType,
- 1
- );
-
- //
- // Type Detail
- //
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE17, TypeDetail),
- &FrameworkMemDevice->MemoryTypeDetail,
- 2
- );
-
- //
- // Speed
- //
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE17, Speed),
- &FrameworkMemDevice->MemorySpeed,
- 2
- );
-
- MemoryDeviceSize = FrameworkMemDevice->MemoryDeviceSize;
- }
-
- MemoryDeviceSizeUnitMega = FALSE;
- MemoryDeviceSize = RShiftU64 (MemoryDeviceSize, 10);
- //
- // kilo as unit
- //
- if (MemoryDeviceSize > 0xffff) {
- MemoryDeviceSize = RShiftU64 (MemoryDeviceSize, 10);
- //
- // Mega as unit
- //
- MemoryDeviceSizeUnitMega = TRUE;
- }
-
- MemoryDeviceSize = MemoryDeviceSize & 0x7fff;
- if (MemoryDeviceSize != 0 && !MemoryDeviceSizeUnitMega) {
- MemoryDeviceSize |= 0x8000;
- }
-
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE17, Size),
- &MemoryDeviceSize,
- 2
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Memory SubClass record type 3 -
- - Memory Device: SMBIOS Type 6
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldSMBIOSType6 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MEMORY_ARRAY_LINK_DATA *MemDevice;
- UINT64 MemoryDeviceSize;
- UINT8 MemSize;
- UINT16 MemType;
- UINT8 MemSpeed;
- FRAMEWORK_MEMORY_ARRAY_LINK_DATA *FrameworkMemDevice;
- UINT16 MemoryDeviceSpeed;
- UINT16 MemoryDeviceExponent;
-
- MemDevice = (EFI_MEMORY_ARRAY_LINK_DATA *) RecordData;
- FrameworkMemDevice = (FRAMEWORK_MEMORY_ARRAY_LINK_DATA *) RecordData;
- MemoryDeviceExponent = 0;
-
- //
- // Memory Device Locator
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE6, SocketDesignation),
- &(MemDevice->MemoryDeviceLocator),
- 2
- );
-
- if (!FeaturePcdGet(PcdFrameworkCompatibilitySupport)) {
- MemoryDeviceSpeed = MemDevice->MemorySpeed.Value;
- MemoryDeviceExponent = MemDevice->MemorySpeed.Exponent;
- while (MemoryDeviceExponent-- > 0) {
- MemoryDeviceSpeed = (UINT16) (MemoryDeviceSpeed * 10);
- }
- MemoryDeviceSize = (UINT64) (((UINTN) MemDevice->MemoryDeviceSize.Value) << MemDevice->MemoryDeviceSize.Exponent);
- } else {
- //
- // Support EDk/Framework defined Data strucutre.
- //
- MemoryDeviceSpeed = FrameworkMemDevice->MemorySpeed;
- MemoryDeviceSize = FrameworkMemDevice->MemoryDeviceSize;
- }
-
- if (MemoryDeviceSpeed == 0) {
- MemSpeed = 0;
- } else {
- //
- // Memory speed is in ns unit
- //
- MemSpeed = (UINT8)(1000 / MemoryDeviceSpeed);
- }
-
- CopyMem (
- (UINT8*)StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE6, CurrentSpeed),
- &MemSpeed,
- 1
- );
-
-
- //
- // Device Size
- //
- MemSize = 0;
- if (MemoryDeviceSize == 0) {
- MemSize = 0x7F;
- } else {
- MemoryDeviceSize = RShiftU64 (MemoryDeviceSize, 21);
- while (MemoryDeviceSize != 0) {
- MemSize++;
- MemoryDeviceSize = RShiftU64(MemoryDeviceSize,1);
- }
- }
-
- CopyMem (
- (UINT8*)StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE6, InstalledSize),
- &MemSize,
- 1
- );
-
- CopyMem (
- (UINT8*)StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE6, EnabledSize),
- &MemSize,
- 1
- );
-
- //
- // According SMBIOS SPEC Type 6 definition
- //
- MemType = 0;
- if (!FeaturePcdGet(PcdFrameworkCompatibilitySupport)) {
- if (MemDevice->MemoryFormFactor == EfiMemoryFormFactorDimm ||
- MemDevice->MemoryFormFactor == EfiMemoryFormFactorFbDimm) {
- MemType |= 1<<8;
- }
-
- if (MemDevice->MemoryFormFactor == EfiMemoryFormFactorSimm) {
- MemType |= 1<<7;
- }
-
- if (MemDevice->MemoryType == EfiMemoryTypeSdram) {
- MemType |= 1<<10;
- }
-
- if (MemDevice->MemoryTypeDetail.Edo == 1) {
- MemType |= 1<<4;
- }
-
- if (MemDevice->MemoryTypeDetail.FastPaged == 1) {
- MemType |= 1<<3;
- }
- } else {
- //
- // Support EDk/Framework defined Data strucutre.
- //
- if (FrameworkMemDevice->MemoryFormFactor == EfiMemoryFormFactorDimm ||
- FrameworkMemDevice->MemoryFormFactor == EfiMemoryFormFactorFbDimm) {
- MemType |= 1<<8;
- }
-
- if (FrameworkMemDevice->MemoryFormFactor == EfiMemoryFormFactorSimm) {
- MemType |= 1<<7;
- }
-
- if (FrameworkMemDevice->MemoryType == EfiMemoryTypeSdram) {
- MemType |= 1<<10;
- }
-
- if (FrameworkMemDevice->MemoryTypeDetail.Edo == 1) {
- MemType |= 1<<4;
- }
-
- if (FrameworkMemDevice->MemoryTypeDetail.FastPaged == 1) {
- MemType |= 1<<3;
- }
- }
- //
- // Form Factor
- //
- CopyMem (
- (UINT8*)StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE6, CurrentMemoryType),
- &MemType,
- 2
- );
-
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Memory SubClass record type 4
- -- Memory Array Mapped Address: SMBIOS Type 19
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType4 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MEMORY_ARRAY_START_ADDRESS_DATA *Masa;
- EFI_PHYSICAL_ADDRESS TempData;
-
- Masa = (EFI_MEMORY_ARRAY_START_ADDRESS_DATA *) RecordData;
-
- //
- // Starting Address
- //
- TempData = RShiftU64 (Masa->MemoryArrayStartAddress, 10);
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE19, StartingAddress),
- &TempData,
- 4
- );
-
- //
- // Ending Address
- //
- TempData = RShiftU64 (Masa->MemoryArrayEndAddress, 10);
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE19, EndingAddress),
- &TempData,
- 4
- );
-
- //
- // Partition Width
- //
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE19, PartitionWidth),
- &Masa->MemoryArrayPartitionWidth,
- 1
- );
-
- //
- // Physical Memory Array Link
- //
- return SmbiosFldInterLink (
- StructureNode,
- (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE19, MemoryArrayHandle),
- 16, // SMBIOS type 16
- &Masa->PhysicalMemoryArrayLink,
- &gEfiMemorySubClassGuid
- );
-
-}
-
-/**
- Field Filling Function for Memory SubClass record type 5
- -- Memory Device Mapped Address: SMBIOS Type 20
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType5 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MEMORY_DEVICE_START_ADDRESS_DATA *Mdsa;
- EFI_PHYSICAL_ADDRESS TempData;
-
- Mdsa = (EFI_MEMORY_DEVICE_START_ADDRESS_DATA *) RecordData;
-
- //
- // Starting Address
- //
- TempData = RShiftU64 (Mdsa->MemoryDeviceStartAddress, 10);
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE20, StartingAddress),
- &TempData,
- 4
- );
-
- //
- // Ending Address
- //
- TempData = RShiftU64 (Mdsa->MemoryDeviceEndAddress, 10);
- CopyMem (
- (UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE20, EndingAddress),
- &TempData,
- 4
- );
-
- //
- // Memory Device Link
- //
- SmbiosFldInterLink (
- StructureNode,
- (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE20, MemoryDeviceHandle),
- 17, // SMBIOS type 17
- &Mdsa->PhysicalMemoryDeviceLink,
- &gEfiMemorySubClassGuid
- );
-
- //
- // Memory Array Mapped Address Link
- //
- SmbiosFldInterLink (
- StructureNode,
- (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE20, MemoryArrayMappedAddressHandle),
- 19, // SMBIOS type 19
- &Mdsa->PhysicalMemoryArrayLink,
- &gEfiMemorySubClassGuid
- );
-
- //
- // Memory Device Partition Row Position
- //
- *(UINT8 *) ((UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE20, PartitionRowPosition)) = (UINT8) Mdsa->MemoryDevicePartitionRowPosition;
-
- //
- // Memory Device Interleave Position
- //
- *(UINT8 *) ((UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE20, InterleavePosition)) = (UINT8) Mdsa->MemoryDeviceInterleavePosition;
-
- //
- // Memory Device Interleave Data Depth
- //
- *(UINT8 *) ((UINT8 *) StructureNode->Structure + OFFSET_OF (SMBIOS_TABLE_TYPE20, InterleavedDataDepth)) = (UINT8) Mdsa->MemoryDeviceInterleaveDataDepth;
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Memory SubClass record type 6
- -- Memory Channel Type: SMBIOS Type 37
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType6 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MEMORY_CHANNEL_TYPE_DATA *McTa;
- EFI_STATUS Status;
-
- McTa = (EFI_MEMORY_CHANNEL_TYPE_DATA *) RecordData;
-
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE37, ChannelType)) = (UINT8) (McTa->MemoryChannelType);
-
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE37, MaximumChannelLoad)) = (UINT8) (McTa->MemoryChannelMaximumLoad);
-
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE37, MemoryDeviceCount)) = (UINT8) (McTa->MemoryChannelDeviceCount);
-
- //
- // Update the length field
- // Multiple device loads are filled through SmbiosFldMemoryType7
- //
- StructureNode->Structure->Length = (UINT8)(StructureNode->Structure->Length +
- sizeof(MEMORY_DEVICE) * McTa->MemoryChannelDeviceCount);
- Status = SmbiosEnlargeStructureBuffer(
- StructureNode,
- StructureNode->Structure->Length,
- StructureNode->StructureSize,
- StructureNode->StructureSize + sizeof(MEMORY_DEVICE) * McTa->MemoryChannelDeviceCount
- );
- return Status;
-}
-
-/**
- Field Filling Function for Memory SubClass record type 7
- -- Memory Channel Device: SMBIOS Type 37
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType7 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MEMORY_CHANNEL_DEVICE_DATA *Mcdd;
- UINTN DeviceLoadOffset;
- UINTN DeviceLoadHandleOffset;
-
- Mcdd = (EFI_MEMORY_CHANNEL_DEVICE_DATA *) RecordData;
-
- if (Mcdd->DeviceId < 1) {
- return EFI_INVALID_PARAMETER;
- }
-
- DeviceLoadOffset = OFFSET_OF (SMBIOS_TABLE_TYPE37, MemoryDevice[0]) + 3 * (Mcdd->DeviceId - 1);
- DeviceLoadHandleOffset = OFFSET_OF (SMBIOS_TABLE_TYPE37, MemoryDevice[1]) + 3 * (Mcdd->DeviceId - 1);
-
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + DeviceLoadOffset) = (UINT8) (Mcdd->MemoryChannelDeviceLoad);
-
- //
- // Memory Device Handle Link
- //
- return SmbiosFldInterLink (
- StructureNode,
- (UINT16) DeviceLoadHandleOffset,
- 17, // Smbios type 17 -- Physical Memory Device
- &Mcdd->DeviceLink,
- &gEfiMemorySubClassGuid
- );
-
-}
-
-/**
- Field Filling Function for Memory SubClass record type 8
- -- Memory Controller information: SMBIOS Type 5
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType8 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MEMORY_CONTROLLER_INFORMATION_DATA *MemoryController;
- UINT32 NewMinimalSize;
- UINT16 Count;
- EFI_INTER_LINK_DATA *Link;
- EFI_STATUS Status;
-
- NewMinimalSize = 0;
-
- //
- // There is an update from EFI_MEMORY_CONTROLLER_INFORMATION to
- // EFI_MEMORY_CONTROLLER_INFORMATION_DATA. Multiple MemoryModuleConfig
- // handles are filled.
- //
- MemoryController = (EFI_MEMORY_CONTROLLER_INFORMATION_DATA *)RecordData;
-
- //
- // ErrorDetectingMethod
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE5, ErrDetectMethod),
- &MemoryController->ErrorDetectingMethod,
- 1
- );
-
- //
- // ErrorCorrectingCapability
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE5, ErrCorrectCapability),
- &MemoryController->ErrorCorrectingCapability,
- 1
- );
-
- //
- // MemorySupportedInterleave
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE5, SupportInterleave),
- &MemoryController->MemorySupportedInterleave,
- 1
- );
-
- //
- // MemoryCurrentInterleave
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE5, CurrentInterleave),
- &MemoryController->MemoryCurrentInterleave,
- 1
- );
-
- //
- // MaxMemoryModuleSize
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE5, MaxMemoryModuleSize),
- &MemoryController->MaxMemoryModuleSize,
- 1
- );
-
- //
- // MemorySpeedType
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE5, SupportSpeed),
- &MemoryController->MemorySpeedType,
- 2
- );
-
- //
- // MemorySupportedType
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE5, SupportMemoryType),
- &MemoryController->MemorySupportedType,
- 2
- );
-
- //
- // MemoryModuleVoltage
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE5, MemoryModuleVoltage),
- &MemoryController->MemoryModuleVoltage,
- 1
- );
-
- //
- // NumberofMemorySlot
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE5, AssociatedMemorySlotNum),
- &MemoryController->NumberofMemorySlot,
- 1
- );
-
- if (MemoryController->NumberofMemorySlot == 0) {
- //
- // EnabledCorrectingCapability
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE5, MemoryModuleConfigHandles),
- &MemoryController->EnabledCorrectingCapability,
- 1
- );
- } else {
- //
- // Memory module configuration handles exist
- // we should enlarge smbios entry buffer from minimal size
- //
- NewMinimalSize = (MemoryController->NumberofMemorySlot) * sizeof(UINT16) + StructureNode->StructureSize;
- StructureNode->Structure->Length = (UINT8) (NewMinimalSize - 2);
- Status = SmbiosEnlargeStructureBuffer (StructureNode, StructureNode->Structure->Length, StructureNode->StructureSize, NewMinimalSize);
- ASSERT_EFI_ERROR (Status);
-
- //
- // MemoryModuleConfigHandles
- //
- for (Count = 0, Link = MemoryController->MemoryModuleConfig;
- Count < MemoryController->NumberofMemorySlot;
- Count++, Link++) {
- SmbiosFldInterLink (
- StructureNode,
- (UINT16) (OFFSET_OF (SMBIOS_TABLE_TYPE5, MemoryModuleConfigHandles) + Count * sizeof(UINT16)),
- 6, // SMBIOS type 6
- Link,
- &gEfiMemorySubClassGuid
- );
- }
-
- //
- // EnabledCorrectingCapability
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE5, MemoryModuleConfigHandles) + (MemoryController->NumberofMemorySlot) * sizeof(UINT16),
- &MemoryController->EnabledCorrectingCapability,
- 1
- );
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Memory SubClass record type
- -- Memory 32 Bit Error Information: SMBIOS Type 18
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType9 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MEMORY_32BIT_ERROR_INFORMATION *MemoryInfo;
-
- MemoryInfo = (EFI_MEMORY_32BIT_ERROR_INFORMATION *)RecordData;
-
- //
- // MemoryErrorType
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE18, ErrorType),
- &MemoryInfo->MemoryErrorType,
- 1
- );
-
- //
- // MemoryErrorGranularity
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE18, ErrorGranularity),
- &MemoryInfo->MemoryErrorGranularity,
- 1
- );
-
- //
- // MemoryErrorOperation
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE18, ErrorOperation),
- &MemoryInfo->MemoryErrorOperation,
- 1
- );
-
- //
- // VendorSyndrome
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE18, VendorSyndrome),
- &MemoryInfo->VendorSyndrome,
- 4
- );
-
- //
- // MemoryArrayErrorAddress
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE18, MemoryArrayErrorAddress),
- &MemoryInfo->MemoryArrayErrorAddress,
- 4
- );
-
- //
- // DeviceErrorAddress
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE18, DeviceErrorAddress),
- &MemoryInfo->DeviceErrorAddress,
- 4
- );
-
- //
- // DeviceErrorResolution
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE18, ErrorResolution),
- &MemoryInfo->DeviceErrorResolution,
- 4
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Memory SubClass record type
- -- Memory 64 Bit Error Information: SMBIOS Type 33
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType10 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MEMORY_64BIT_ERROR_INFORMATION *MemoryInfo;
-
- MemoryInfo = (EFI_MEMORY_64BIT_ERROR_INFORMATION *)RecordData;
-
- //
- // MemoryErrorType
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE33, ErrorType),
- &MemoryInfo->MemoryErrorType,
- 1
- );
-
- //
- // MemoryErrorGranularity
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE33, ErrorGranularity),
- &MemoryInfo->MemoryErrorGranularity,
- 1
- );
-
- //
- // MemoryErrorOperation
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE33, ErrorOperation),
- &MemoryInfo->MemoryErrorOperation,
- 1
- );
-
- //
- // VendorSyndrome
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE33, VendorSyndrome),
- &MemoryInfo->VendorSyndrome,
- 4
- );
-
- //
- // MemoryArrayErrorAddress
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE33, MemoryArrayErrorAddress),
- &MemoryInfo->MemoryArrayErrorAddress,
- 8
- );
-
- //
- // DeviceErrorAddress
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE33, DeviceErrorAddress),
- &MemoryInfo->DeviceErrorAddress,
- 8
- );
-
- //
- // DeviceErrorResolution
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE33, ErrorResolution),
- &MemoryInfo->DeviceErrorResolution,
- 4
- );
-
- return EFI_SUCCESS;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MiscConv.c b/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MiscConv.c
deleted file mode 100644
index 428dbf0238..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MiscConv.c
+++ /dev/null
@@ -1,2527 +0,0 @@
-/** @file
- Routines that support Misc SubClass data records translation.
-
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "Thunk.h"
-
-/**
- Field Filling Function for Misc SubClass record type 0 -- Bios Information.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType0 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
- EFI_MISC_BIOS_VENDOR_DATA *BiosInfo;
-
- Status = EFI_SUCCESS;
- BiosInfo = NULL;
-
- BiosInfo = (EFI_MISC_BIOS_VENDOR_DATA *) RecordData;
-
- //
- // Bios Vendor
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE0, Vendor),
- &(BiosInfo->BiosVendor),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // Bios Version
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosVersion),
- &(BiosInfo->BiosVersion),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // Bios Release Date
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosReleaseDate),
- &(BiosInfo->BiosReleaseDate),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // Bios Starting Address Segment
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosSegment),
- &BiosInfo->BiosStartingAddress,
- 2
- );
-
- //
- // Bios Physical device size
- //
- SmbiosFldBase2ToByteWith64K (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosSize),
- &BiosInfo->BiosPhysicalDeviceSize,
- sizeof (EFI_EXP_BASE2_DATA)
- );
- (*(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosSize)))--;
-
- //
- // Bios Characteristics
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosCharacteristics),
- &BiosInfo->BiosCharacteristics1,
- 4
- );
-
- //
- // Bios Characteristics higher four bytes
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosCharacteristics) + 4,
- &BiosInfo->BiosCharacteristics2,
- 4
- );
-
- //
- // Bios Characteristics Extension1/2
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, BIOSCharacteristicsExtensionBytes),
- (UINT8 *) &BiosInfo->BiosCharacteristics1 + 4,
- 2
- );
-
- //
- // System BIOS Major Release
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, SystemBiosMajorRelease),
- (UINT8 *) &BiosInfo->BiosMajorRelease,
- 1
- );
-
- //
- // System BIOS Minor Release
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, SystemBiosMinorRelease),
- (UINT8 *) &BiosInfo->BiosMinorRelease,
- 1
- );
-
- //
- // Embedded Controller Firmware Major Release
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, EmbeddedControllerFirmwareMajorRelease),
- (UINT8 *) &BiosInfo->BiosEmbeddedFirmwareMajorRelease,
- 1
- );
-
- //
- // Embedded Controller Firmware Minor Release
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, EmbeddedControllerFirmwareMinorRelease),
- (UINT8 *) &BiosInfo->BiosEmbeddedFirmwareMinorRelease,
- 1
- );
-
- return Status;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 1 -- System Information.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType1 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
- EFI_MISC_SYSTEM_MANUFACTURER_DATA *SystemInfo;
-
- Status = EFI_SUCCESS;
- SystemInfo = NULL;
-
- SystemInfo = (EFI_MISC_SYSTEM_MANUFACTURER_DATA *) RecordData;
-
- //
- // System Manufacturer
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE1, Manufacturer),
- &(SystemInfo->SystemManufacturer),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // System Product Name
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE1, ProductName),
- &(SystemInfo->SystemProductName),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // System Version
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE1, Version),
- &(SystemInfo->SystemVersion),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // System Serial Number
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE1, SerialNumber),
- &(SystemInfo->SystemSerialNumber),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // Uuid
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE1, Uuid),
- &SystemInfo->SystemUuid,
- 16
- );
-
- //
- // Wakeup Type
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE1, WakeUpType),
- &SystemInfo->SystemWakeupType,
- 1
- );
-
- //
- // System SKU Number
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE1, SKUNumber),
- &(SystemInfo->SystemSKUNumber),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // System Family
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE1, Family),
- &(SystemInfo->SystemFamily),
- 2 // 64 * sizeof(CHAR16)
- );
-
- return Status;
-}
-
-/**
- Field Filling Function for record type 2 -- Base Board Manufacture.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType2 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
- EFI_MISC_BASE_BOARD_MANUFACTURER_DATA *Bbm;
- Status = EFI_SUCCESS;
- Bbm = (EFI_MISC_BASE_BOARD_MANUFACTURER_DATA *) RecordData;
-
- //
- // Manufacturer
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE2, Manufacturer),
- &(Bbm->BaseBoardManufacturer),
- 2
- );
-
- //
- // Product
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE2, ProductName),
- &(Bbm->BaseBoardProductName),
- 2
- );
-
- //
- // Version
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE2, Version),
- &(Bbm->BaseBoardVersion),
- 2
- );
-
- //
- // Serial Number
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE2, SerialNumber),
- &(Bbm->BaseBoardSerialNumber),
- 2
- );
-
- //
- // Asset Tag
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE2, AssetTag),
- &(Bbm->BaseBoardAssetTag),
- 2
- );
-
- //
- // Location in Chassis
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE2, LocationInChassis),
- &(Bbm->BaseBoardChassisLocation),
- 2
- );
-
- //
- // Feature Flags
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE2, FeatureFlag),
- &Bbm->BaseBoardFeatureFlags,
- 1
- );
-
- //
- // Board Type
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE2, BoardType)) = (UINT8) Bbm->BaseBoardType;
-
- //
- // Chassis Handle
- //
- SmbiosFldInterLink (
- StructureNode,
- (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE2, ChassisHandle),
- 3, // SMBIOS type 3 - System Enclosure or Chassis
- &Bbm->BaseBoardChassisLink,
- &gEfiMiscSubClassGuid
- );
-
- //
- // Number of Contained Object Handles
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE2, NumberOfContainedObjectHandles)) = (UINT8) Bbm->BaseBoardNumberLinks;
-
- return Status;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 3 -
- - System Enclosure or Chassis.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType3 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
- EFI_MISC_CHASSIS_MANUFACTURER_DATA *Ec;
- EFI_MISC_ELEMENTS *Element;
- UINT16 Index;
- UINT8 ContainedElementType;
- Status = EFI_SUCCESS;
- Ec = (EFI_MISC_CHASSIS_MANUFACTURER_DATA *) RecordData;
-
- //
- // Chassis Type
- //
- *(UINT8*)((UINT8 *) (StructureNode->Structure) +
- OFFSET_OF (SMBIOS_TABLE_TYPE3, Type))
- = (UINT8) (Ec->ChassisType.ChassisType | Ec->ChassisType.ChassisLockPresent << 7);
-
-
- //
- // Chassis Bootup State
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE3, BootupState),
- &Ec->ChassisBootupState,
- 1
- );
-
- //
- // Chassis Power Supply State
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE3, PowerSupplyState),
- &Ec->ChassisPowerSupplyState,
- 1
- );
-
- //
- // Chassis Thermal State
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE3, ThermalState),
- &Ec->ChassisThermalState,
- 1
- );
-
- //
- // Chassis Security State
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE3, SecurityStatus),
- &Ec->ChassisSecurityState,
- 1
- );
-
- //
- // Chassis Oem Defined
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE3, OemDefined),
- &Ec->ChassisOemDefined,
- 4
- );
-
- //
- // Chassis Height
- //
- *(UINT8*)((UINT8*)(StructureNode->Structure) +
- OFFSET_OF (SMBIOS_TABLE_TYPE3, Height))
- = (UINT8)Ec->ChassisHeight;
-
- //
- // Chassis Number Power Cords
- //
- *(UINT8*)((UINT8*)(StructureNode->Structure) +
- OFFSET_OF (SMBIOS_TABLE_TYPE3, NumberofPowerCords))
- = (UINT8)Ec->ChassisNumberPowerCords;
-
- //
- // Chassis Element Count
- //
- *(UINT8*)((UINT8*)(StructureNode->Structure) +
- OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElementCount))
- = (UINT8)Ec->ChassisElementCount;
-
- if(Ec->ChassisElementCount > 0) {
- //
- // Element Record Length
- // Current solution covers first 3 bytes; user can extend to meet its requirements.
- //
- *(UINT8*)((UINT8*)(StructureNode->Structure) +
- OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElementRecordLength))
- = (UINT8)sizeof(CONTAINED_ELEMENT);
-
- //
- // Update the structure's length and StructureSize
- //
- StructureNode->Structure->Length = (UINT8)(StructureNode->Structure->Length +
- Ec->ChassisElementCount * sizeof(CONTAINED_ELEMENT));
- Status = SmbiosEnlargeStructureBuffer (
- StructureNode,
- StructureNode->Structure->Length,
- StructureNode->StructureSize,
- StructureNode->StructureSize + Ec->ChassisElementCount * sizeof(CONTAINED_ELEMENT)
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Contained Elements
- //
- for (Index=0, Element = &Ec->ChassisElements;
- Index < Ec->ChassisElementCount;
- Index += 1, Element ++) {
-
- //
- // ContainedElementType
- //
- ContainedElementType = (UINT8)((Element->ChassisElementType.RecordType == 1)
- ? (UINT8)(Element->ChassisElementType.RecordType << 7 | Element->ChassisElementType.Type)
- : (UINT8)(Element->ChassisBaseBoard));
- *(UINT8*)((UINT8*)(StructureNode->Structure) +
- OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements) +
- Index * sizeof(CONTAINED_ELEMENT) +
- OFFSET_OF(CONTAINED_ELEMENT,ContainedElementType))
- = ContainedElementType;
-
- //
- // ContainedElementMinimum
- //
- *(UINT8*)((UINT8*)(StructureNode->Structure) +
- OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements) +
- Index * sizeof(CONTAINED_ELEMENT) +
- OFFSET_OF(CONTAINED_ELEMENT,ContainedElementMinimum))
- = (UINT8)Element->ChassisElementMinimum;
-
- //
- // ContainedElementMaximum
- //
- *(UINT8*)((UINT8*)(StructureNode->Structure) +
- OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements) +
- Index * sizeof(CONTAINED_ELEMENT) +
- OFFSET_OF(CONTAINED_ELEMENT,ContainedElementMaximum))
- = (UINT8)Element->ChassisElementMaximum;
- }
- }
-
- //
- // Move the filling of following four String fields after Contained Elements
- // because they would break SMBIOS table.
- // Chassis Manufacturer
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE3, Manufacturer),
- &(Ec->ChassisManufacturer),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // Chassis Version
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE3, Version),
- &(Ec->ChassisVersion),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // Chassis Serial Number
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE3, SerialNumber),
- &(Ec->ChassisSerialNumber),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // Chassis Asset Tag
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE3, AssetTag),
- &(Ec->ChassisAssetTag),
- 2 // 64 * sizeof(CHAR16)
- );
-
- return Status;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 8 -- Port Connector.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType8 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
- EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *Picd;
-
- Status = EFI_SUCCESS;
- Picd = (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData;
-
- //
- // Internal Connector Designator
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE8, InternalReferenceDesignator),
- &(Picd->PortInternalConnectorDesignator),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // Internal Connector Type
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE8, InternalConnectorType)) = (UINT8) Picd->PortInternalConnectorType;
-
- //
- // External Connector Designator
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE8, ExternalReferenceDesignator),
- &(Picd->PortExternalConnectorDesignator),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // Internal Connector Type
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE8, ExternalConnectorType)) = (UINT8) Picd->PortExternalConnectorType;
-
- //
- // Internal Connector Type
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE8, PortType)) = (UINT8) Picd->PortType;
-
- return Status;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 9 -- System slot.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType9 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
- EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA *Slot;
-
- Status = EFI_SUCCESS;
- Slot = (EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA *) RecordData;
-
- //
- // Slot Designation
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE9, SlotDesignation),
- &(Slot->SlotDesignation),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // Slot Type
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE9, SlotType),
- &Slot->SlotType,
- 1
- );
-
- //
- // Slot Data Bus Width
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE9, SlotDataBusWidth),
- &Slot->SlotDataBusWidth,
- 1
- );
-
- //
- // Slot Usage
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE9, CurrentUsage),
- &Slot->SlotUsage,
- 1
- );
-
- //
- // Slot Length
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE9, SlotLength),
- &Slot->SlotLength,
- 1
- );
-
- //
- // Slot Id
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE9, SlotID),
- &Slot->SlotId,
- 2
- );
-
- //
- // Slot Characteristics
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE9, SlotCharacteristics1),
- &Slot->SlotCharacteristics,
- 2
- );
-
- return Status;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 10 - Onboard Device.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType10 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
- EFI_MISC_ONBOARD_DEVICE_DATA *OnboardDevice;
- UINTN NumberOfDevices;
- UINTN Index;
- UINT8 StatusAndType;
-
- Status = EFI_SUCCESS;
- OnboardDevice = (EFI_MISC_ONBOARD_DEVICE_DATA *) RecordData;
-
- NumberOfDevices = (StructureNode->Structure->Length - 4) / 2;
- for (Index = 0; Index < NumberOfDevices; Index += 1) {
- //
- // OnBoard Device Description
- //
- SmbiosFldString (
- StructureNode,
- (UINT32) (OFFSET_OF (SMBIOS_TABLE_TYPE10, Device) + 1 + (2 * Index)),
- &(OnboardDevice->OnBoardDeviceDescription),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // Status & Type: Bit 7 Devicen Status, Bits 6:0 Type of Device
- //
- StatusAndType = (UINT8) OnboardDevice->OnBoardDeviceStatus.DeviceType;
- if (OnboardDevice->OnBoardDeviceStatus.DeviceEnabled != 0) {
- StatusAndType |= 0x80;
- } else {
- StatusAndType &= 0x7F;
- }
-
- * (UINT8 *) ((UINT8 *) (StructureNode->Structure) + (OFFSET_OF (SMBIOS_TABLE_TYPE10, Device) + (2 * Index))) = StatusAndType;
- }
-
- return Status;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 11 - OEM Strings.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType11 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_OEM_STRING_DATA *OemString;
-
- OemString = (EFI_MISC_OEM_STRING_DATA *)RecordData;
- //
- // OEM String data
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE11, StringCount),
- &(OemString->OemStringRef[0]),
- 2
- );
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 12 - System Options.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType12 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
- EFI_MISC_SYSTEM_OPTION_STRING_DATA *Sos;
- UINTN NumberOfInstallableLanguages;
- UINTN Index;
-
- Status = EFI_SUCCESS;
- Sos = (EFI_MISC_SYSTEM_OPTION_STRING_DATA *) RecordData;
-
- //
- // As MiscDataHub spec defines,
- // NumberOfInstallableLanguages should retrieve from Type 13.
- //
- NumberOfInstallableLanguages = (StructureNode->Structure->Length - 4);
- for (Index = 0; Index < NumberOfInstallableLanguages; Index += 1) {
- //
- // OnBoard Device Description
- //
- SmbiosFldString (
- StructureNode,
- (UINT32) (OFFSET_OF (SMBIOS_TABLE_TYPE12, StringCount) + (Index)),
- &(Sos->SystemOptionStringRef[Index]),
- 2
- );
- }
-
- return Status;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 13 - BIOS Language.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType13 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA *InstallableLanguage;
-
- InstallableLanguage = (EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA *) RecordData;
-
- //
- // Number Of Installable Languages
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE13, InstallableLanguages)) = (UINT8) (InstallableLanguage->NumberOfInstallableLanguages);
-
- //
- // Language Flags
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE13, Flags),
- &InstallableLanguage->LanguageFlags,
- 1
- );
-
- //
- // Current Language Number
- // It's the index of multiple languages. Languages are filled by SmbiosFldMiscType14.
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE13, CurrentLanguages),
- &InstallableLanguage->CurrentLanguageNumber,
- 1
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 14 - System Language String
- Current solution assumes that EFI_MISC_SYSTEM_LANGUAGE_STRINGs are logged with
- their LanguageId having ascending orders.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType14 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- UINT16 CurrentLanguageNumber;
- EFI_MISC_SYSTEM_LANGUAGE_STRING *LanguageString;
-
- LanguageString = (EFI_MISC_SYSTEM_LANGUAGE_STRING *) RecordData;
-
- //
- // Backup CurrentLanguage
- //
- CopyMem (
- &CurrentLanguageNumber,
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE13, CurrentLanguages),
- 1
- );
-
- //
- // Clear the field so that SmbiosFldString can be reused
- //
- *(UINT8 *)((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE13, CurrentLanguages)) = 0;
-
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE13, CurrentLanguages),
- &(LanguageString->SystemLanguageString),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // Restore CurrentLanguage
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE13, CurrentLanguages),
- &CurrentLanguageNumber,
- 1
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 15 -- System Event Log.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType15 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
- EFI_MISC_SYSTEM_EVENT_LOG_DATA *SystemEventLog;
-
- Status = EFI_SUCCESS;
- SystemEventLog = NULL;
-
- SystemEventLog = (EFI_MISC_SYSTEM_EVENT_LOG_DATA *) RecordData;
-
- //
- // Log Area Length
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LogAreaLength),
- &(SystemEventLog->LogAreaLength),
- 2
- );
-
- //
- // Log Header Start Offset
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LogHeaderStartOffset),
- &(SystemEventLog->LogHeaderStartOffset),
- 2
- );
-
- //
- // Log Data Start Offset
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LogDataStartOffset),
- &(SystemEventLog->LogDataStartOffset),
- 2
- );
-
- //
- // Access Method
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, AccessMethod),
- &(SystemEventLog->AccessMethod),
- 1
- );
-
- //
- // Log Status
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LogStatus),
- &(SystemEventLog->LogStatus),
- 1
- );
-
- //
- // Log Change Token
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LogChangeToken),
- &(SystemEventLog->LogChangeToken),
- 4
- );
-
- //
- // Access Method Address
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, AccessMethodAddress),
- &(SystemEventLog->AccessMethodAddress),
- 4
- );
-
- //
- // Log Header Format
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LogHeaderFormat),
- &(SystemEventLog->LogHeaderFormat),
- 1
- );
-
- //
- // Number of Supported Log Type Descriptors
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, NumberOfSupportedLogTypeDescriptors),
- &(SystemEventLog->NumberOfSupportedLogType),
- 1
- );
-
- //
- // Length of each Log Type Descriptor
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LengthOfLogTypeDescriptor),
- &(SystemEventLog->LengthOfLogDescriptor),
- 1
- );
-
- return Status;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 21 - Pointing Device.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType21 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_POINTING_DEVICE_TYPE_DATA *PointingDeviceData;
-
- PointingDeviceData = (EFI_MISC_POINTING_DEVICE_TYPE_DATA *) RecordData;
-
- //
- // Pointing Device Type
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE21, Type)) = (UINT8) (PointingDeviceData->PointingDeviceType);
-
- //
- // Pointing Device Interface
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE21, Interface)) = (UINT8) (PointingDeviceData->PointingDeviceInterface);
-
- //
- // Number Pointing Device Buttons
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE21, NumberOfButtons)) = (UINT8) (PointingDeviceData->NumberPointingDeviceButtons);
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 22 - Portable Battery.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType22 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_PORTABLE_BATTERY *PortableBattery;
- STRING_REF Chemistry;
- PortableBattery = (EFI_MISC_PORTABLE_BATTERY *)RecordData;
-
- //
- // Location
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE22, Location),
- &(PortableBattery->Location),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // Manufacturer
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE22, Manufacturer),
- &(PortableBattery->Manufacturer),
- 2
- );
-
- //
- // ManufactureDate
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE22, ManufactureDate),
- &(PortableBattery->ManufactureDate),
- 2
- );
-
- //
- // SerialNumber
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE22, SerialNumber),
- &(PortableBattery->SerialNumber),
- 2
- );
-
- //
- // DeviceName
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE22, DeviceName),
- &(PortableBattery->DeviceName),
- 2
- );
-
- //
- // DeviceChemistry
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, DeviceChemistry),
- &PortableBattery->DeviceChemistry,
- 1
- );
-
- //
- // DesignCapacity
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, DeviceCapacity),
- &PortableBattery->DesignCapacity,
- 2
- );
-
- //
- // DesignVoltage
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, DesignVoltage),
- &PortableBattery->DesignVoltage,
- 2
- );
-
- //
- // SBDSVersionNumber
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE22, SBDSVersionNumber),
- &(PortableBattery->SBDSVersionNumber),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // MaximumError
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, MaximumErrorInBatteryData),
- &PortableBattery->MaximumError,
- 1
- );
-
- //
- // SBDSSerialNumber
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, SBDSSerialNumber),
- &PortableBattery->SBDSSerialNumber,
- 2
- );
-
- //
- // SBDSManufactureDate
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, SBDSManufactureDate),
- &PortableBattery->SBDSManufactureDate,
- 2
- );
-
- //
- // Avoid alignment issue on IPF
- //
- CopyMem (
- &Chemistry,
- &PortableBattery->SBDSDeviceChemistry,
- 2
- );
-
- //
- // SBDSDeviceChemistry
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE22, SBDSDeviceChemistry),
- &Chemistry,
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // DesignCapacityMultiplier
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, DesignCapacityMultiplier),
- &PortableBattery->DesignCapacityMultiplier,
- 1
- );
-
- //
- // OEMSpecific
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, OEMSpecific),
- &PortableBattery->OEMSpecific,
- 4
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 23 - System Reset.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType23 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_RESET_CAPABILITIES_DATA *SystemResetData;
-
- SystemResetData = (EFI_MISC_RESET_CAPABILITIES_DATA *) RecordData;
-
- //
- // Reset Capabilities
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE23, Capabilities),
- &(SystemResetData->ResetCapabilities),
- 1
- );
-
- //
- // Reset Count
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE23, ResetCount),
- &(SystemResetData->ResetCount),
- 2
- );
-
- //
- // Reset Limit
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE23, ResetLimit),
- &(SystemResetData->ResetLimit),
- 2
- );
-
- //
- // Reset Timer Interval
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE23, TimerInterval),
- &(SystemResetData->ResetTimerInterval),
- 2
- );
-
- //
- // Reset Timeout
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE23, Timeout),
- &(SystemResetData->ResetTimeout),
- 2
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 24 - Hardware Security.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType24 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_HARDWARE_SECURITY_SETTINGS_DATA *HardwareSecurity;
-
- HardwareSecurity = (EFI_MISC_HARDWARE_SECURITY_SETTINGS_DATA *)RecordData;
-
- //
- // Hardware Security Settings
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE24, HardwareSecuritySettings),
- &HardwareSecurity->HardwareSecuritySettings,
- 1
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 25 - System Power Controls.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType25 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_SCHEDULED_POWER_ON_MONTH *PowerOnMonth;
-
- PowerOnMonth = (EFI_MISC_SCHEDULED_POWER_ON_MONTH *)RecordData;
-
- //
- // ScheduledPoweronMonth
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE25, NextScheduledPowerOnMonth),
- &PowerOnMonth->ScheduledPoweronMonth,
- 1
- );
-
- //
- // ScheduledPoweronDayOfMonth
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE25, NextScheduledPowerOnDayOfMonth),
- &PowerOnMonth->ScheduledPoweronDayOfMonth,
- 1
- );
-
- //
- // ScheduledPoweronHour
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE25, NextScheduledPowerOnHour),
- &PowerOnMonth->ScheduledPoweronHour,
- 1
- );
-
- //
- // ScheduledPoweronMinute
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE25, NextScheduledPowerOnMinute),
- &PowerOnMonth->ScheduledPoweronMinute,
- 1
- );
-
- //
- // ScheduledPoweronSecond
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE25, NextScheduledPowerOnSecond),
- &PowerOnMonth->ScheduledPoweronSecond,
- 1
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 26 - Voltage Probe.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType26 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_VOLTAGE_PROBE_DESCRIPTION *VoltageProbe;
-
- VoltageProbe = (EFI_MISC_VOLTAGE_PROBE_DESCRIPTION *)RecordData;
-
- //
- // VoltageProbe Description
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE26, Description),
- &(VoltageProbe->VoltageProbeDescription),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // VoltageProbeLocation
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, LocationAndStatus),
- &VoltageProbe->VoltageProbeLocation,
- 1
- );
-
- //
- // VoltageProbeMaximumValue
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, MaximumValue),
- &VoltageProbe->VoltageProbeMaximumValue,
- 2
- );
-
- //
- // VoltageProbeMinimumValue
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, MinimumValue),
- &VoltageProbe->VoltageProbeMinimumValue,
- 2
- );
-
- //
- // VoltageProbeResolution
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, Resolution),
- &VoltageProbe->VoltageProbeResolution,
- 2
- );
-
- //
- // VoltageProbeTolerance
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, Tolerance),
- &VoltageProbe->VoltageProbeTolerance,
- 2
- );
-
- //
- // VoltageProbeAccuracy
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, Accuracy),
- &VoltageProbe->VoltageProbeAccuracy,
- 2
- );
-
- //
- // VoltageProbeNominalValue
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, NominalValue),
- &VoltageProbe->VoltageProbeNominalValue,
- 2
- );
-
- //
- // VoltageProbeOemDefined
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, OEMDefined),
- &VoltageProbe->VoltageProbeOemDefined,
- 4
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 27 - Cooling Device.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType27 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_COOLING_DEVICE_TEMP_LINK *CoolingDevice;
-
- CoolingDevice = (EFI_MISC_COOLING_DEVICE_TEMP_LINK *)RecordData;
-
- //
- // Device Type
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE27, DeviceTypeAndStatus),
- &CoolingDevice->CoolingDeviceType,
- 1
- );
-
- //
- // Temperature Probe
- //
- SmbiosFldInterLink (
- StructureNode,
- (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE27, TemperatureProbeHandle),
- 28, // SMBIOS type 28 - Temperature Probe
- &CoolingDevice->CoolingDeviceTemperatureLink,
- &gEfiMiscSubClassGuid
- );
-
- //
- // CoolingDeviceUnitGroup
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE27, CoolingUnitGroup),
- &CoolingDevice->CoolingDeviceUnitGroup,
- 1
- );
-
- //
- // CoolingDeviceUnitGroup
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE27, OEMDefined),
- &CoolingDevice->CoolingDeviceOemDefined,
- 4
- );
-
- //
- // CoolingDeviceNominalSpeed
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE27, NominalSpeed),
- &CoolingDevice->CoolingDeviceNominalSpeed,
- 2
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 28 -- Temperature Probe.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType28 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_TEMPERATURE_PROBE_DESCRIPTION *TemperatureProbe;
-
- TemperatureProbe = (EFI_MISC_TEMPERATURE_PROBE_DESCRIPTION *)RecordData;
-
- //
- // TemperatureProbeDescription
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE28, Description),
- &(TemperatureProbe->TemperatureProbeDescription),
- 2
- );
-
- //
- // TemperatureProbeLocation
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, LocationAndStatus),
- &TemperatureProbe->TemperatureProbeLocation,
- 1
- );
-
- //
- // TemperatureProbeMaximumValue
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, MaximumValue),
- &TemperatureProbe->TemperatureProbeMaximumValue,
- 2
- );
-
- //
- // TemperatureProbeMinimumValue
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, MinimumValue),
- &TemperatureProbe->TemperatureProbeMinimumValue,
- 2
- );
-
- //
- // TemperatureProbeResolution
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, Resolution),
- &TemperatureProbe->TemperatureProbeResolution,
- 2
- );
-
-
- //
- // TemperatureProbeTolerance
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, Tolerance),
- &TemperatureProbe->TemperatureProbeTolerance,
- 2
- );
-
- //
- // TemperatureProbeAccuracy
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, Accuracy),
- &TemperatureProbe->TemperatureProbeAccuracy,
- 2
- );
-
- //
- // TemperatureProbeNominalValue
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, NominalValue),
- &TemperatureProbe->TemperatureProbeNominalValue,
- 2
- );
-
- //
- // TemperatureProbeOemDefined
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, OEMDefined),
- &TemperatureProbe->TemperatureProbeOemDefined,
- 4
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 29 -- Electrical Current Probe.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType29 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_ELECTRICAL_CURRENT_PROBE_DESCRIPTION *ElectricalProbe;
-
- ElectricalProbe = (EFI_MISC_ELECTRICAL_CURRENT_PROBE_DESCRIPTION *)RecordData;
-
- //
- // ElectricalCurrentProbeDescription
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE29, Description),
- &(ElectricalProbe->ElectricalCurrentProbeDescription),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // ElectricalCurrentProbeLocation
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, LocationAndStatus),
- &ElectricalProbe->ElectricalCurrentProbeLocation,
- 1
- );
-
- //
- // ElectricalCurrentProbeMaximumValue
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, MaximumValue),
- &ElectricalProbe->ElectricalCurrentProbeMaximumValue,
- 2
- );
-
- //
- // ElectricalCurrentProbeMinimumValue
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, MinimumValue),
- &ElectricalProbe->ElectricalCurrentProbeMinimumValue,
- 2
- );
-
- //
- // ElectricalCurrentProbeResolution
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, Resolution),
- &ElectricalProbe->ElectricalCurrentProbeResolution,
- 2
- );
-
- //
- // ElectricalCurrentProbeTolerance
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, Tolerance),
- &ElectricalProbe->ElectricalCurrentProbeTolerance,
- 2
- );
-
- //
- // ElectricalCurrentProbeAccuracy
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, Accuracy),
- &ElectricalProbe->ElectricalCurrentProbeAccuracy,
- 2
- );
- //
- // ElectricalCurrentProbeNominalValue
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, NominalValue),
- &ElectricalProbe->ElectricalCurrentProbeNominalValue,
- 2
- );
-
- //
- // ElectricalCurrentProbeOemDefined
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, OEMDefined),
- &ElectricalProbe->ElectricalCurrentProbeOemDefined,
- 4
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 30 -- Out-of-Band Remote Access.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType30 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_REMOTE_ACCESS_MANUFACTURER_DESCRIPTION *RemoteData;
-
- RemoteData = (EFI_MISC_REMOTE_ACCESS_MANUFACTURER_DESCRIPTION *)RecordData;
-
- //
- // ManufacturerNameDescription
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE30, ManufacturerName),
- &(RemoteData->RemoteAccessManufacturerNameDescription),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // RemoteAccessConnections
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE30, Connections),
- &RemoteData->RemoteAccessConnections,
- 1
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 32 -- System Boot Information.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType32 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
- EFI_MISC_BOOT_INFORMATION_STATUS_DATA *BootInfo;
-
- Status = EFI_SUCCESS;
- BootInfo = (EFI_MISC_BOOT_INFORMATION_STATUS_DATA *) RecordData;
-
- //
- // Set reserved bytes
- //
- ZeroMem ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE32, Reserved), 6);
-
- //
- // Set BootInformation Status
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE32, BootStatus),
- &BootInfo->BootInformationStatus,
- 1
- );
-
- //
- // Set Additional Data
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE32, BootStatus) + 1,
- &BootInfo->BootInformationData,
- 9
- );
-
- return Status;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 34 -- Management Device.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType34 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_MANAGEMENT_DEVICE_DESCRIPTION *ManagementDevice;
-
- ManagementDevice = (EFI_MISC_MANAGEMENT_DEVICE_DESCRIPTION *)RecordData;
-
- //
- // ManagementDeviceDescription
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE34, Description),
- &(ManagementDevice->ManagementDeviceDescription),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // ManagementDeviceType
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE34, Type),
- &ManagementDevice->ManagementDeviceType,
- 1
- );
-
- //
- // ManagementDeviceAddress
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE34, Address),
- &ManagementDevice->ManagementDeviceAddress,
- 4
- );
-
- //
- // ManagementDeviceAddressType
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE34, AddressType),
- &ManagementDevice->ManagementDeviceAddressType,
- 1
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 35 -- Management Device Component.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType35 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_MANAGEMENT_DEVICE_COMPONENT_DESCRIPTION *ManagementDeviceComponent;
- EFI_INTER_LINK_DATA ManagementDeviceLink;
- EFI_INTER_LINK_DATA ManagementDeviceComponentLink;
- EFI_INTER_LINK_DATA ManagementDeviceThresholdLink;
-
- ManagementDeviceComponent = (EFI_MISC_MANAGEMENT_DEVICE_COMPONENT_DESCRIPTION *)RecordData;
- CopyMem (
- &ManagementDeviceLink,
- &ManagementDeviceComponent->ManagementDeviceLink,
- sizeof (EFI_INTER_LINK_DATA)
- );
- CopyMem (
- &ManagementDeviceComponentLink,
- &ManagementDeviceComponent->ManagementDeviceComponentLink,
- sizeof (EFI_INTER_LINK_DATA)
- );
- CopyMem (&ManagementDeviceThresholdLink,
- &ManagementDeviceComponent->ManagementDeviceThresholdLink,
- sizeof (EFI_INTER_LINK_DATA)
- );
-
- //
- // ManagementDeviceComponentDescription
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE35, Description),
- &ManagementDeviceComponent->ManagementDeviceComponentDescription,
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // ManagementDeviceLink
- //
- SmbiosFldInterLink (
- StructureNode,
- (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE35, ManagementDeviceHandle),
- 34, // SMBIOS type 34 - Management Device
- &ManagementDeviceLink,
- &gEfiMiscSubClassGuid
- );
-
- //
- // ManagementDeviceComponentLink
- //
- SmbiosFldInterLink (
- StructureNode,
- (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE35, ComponentHandle),
- ManagementDeviceComponent->ComponentType, // SMBIOS type, according to SMBIOS spec, it can be Type 26, 27, 28, 29
- &ManagementDeviceComponentLink,
- &gEfiMiscSubClassGuid
- );
-
- //
- // ManagementDeviceThresholdLink
- //
- SmbiosFldInterLink (
- StructureNode,
- (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE35, ThresholdHandle),
- 36, // SMBIOS type 36 - Management Device Threshold Data
- &ManagementDeviceThresholdLink,
- &gEfiMiscSubClassGuid
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 36 -- Management Device Threshold.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType36 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_MANAGEMENT_DEVICE_THRESHOLD *DeviceThreshold;
-
- DeviceThreshold = (EFI_MISC_MANAGEMENT_DEVICE_THRESHOLD *)RecordData;
-
- //
- // LowerThresNonCritical
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, LowerThresholdNonCritical),
- &DeviceThreshold->LowerThresNonCritical,
- 2
- );
-
- //
- // UpperThresNonCritical
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, UpperThresholdNonCritical),
- &DeviceThreshold->UpperThresNonCritical,
- 2
- );
-
- //
- // LowerThresCritical
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, LowerThresholdCritical),
- &DeviceThreshold->LowerThresCritical,
- 2
- );
-
- //
- // UpperThresCritical
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, UpperThresholdCritical),
- &DeviceThreshold->UpperThresCritical,
- 2
- );
-
- //
- // LowerThresNonRecover
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, LowerThresholdNonRecoverable),
- &DeviceThreshold->LowerThresNonRecover,
- 2
- );
-
- //
- // UpperThresNonRecover
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, UpperThresholdNonRecoverable),
- &DeviceThreshold->UpperThresNonRecover,
- 2
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 38 -- IPMI device info.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType38 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_IPMI_INTERFACE_TYPE_DATA *IpmiInfo;
-
- IpmiInfo = (EFI_MISC_IPMI_INTERFACE_TYPE_DATA *) RecordData;
-
- //
- // Interface Type
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, InterfaceType)) = (UINT8) (IpmiInfo->IpmiInterfaceType);
-
- //
- // IPMI specification revision
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, IPMISpecificationRevision)) =
- (UINT8) ((IpmiInfo->IpmiSpecificationRevision.IpmiSpecLeastSignificantDigit) + \
- (IpmiInfo->IpmiSpecificationRevision.IpmiSpecMostSignificantDigit << 4));
-
- //
- // I2C slave address
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, I2CSlaveAddress)) = (UINT8) (IpmiInfo->IpmiI2CSlaveAddress);
-
- //
- // NV storage device address
- //
- *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, NVStorageDeviceAddress)) = (UINT8) (IpmiInfo->IpmiNvDeviceAddress);
-
- //
- // Base address
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, BaseAddress),
- &IpmiInfo->IpmiBaseAddress,
- 8
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 39 -- Power supply.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType39 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_MISC_SYSTEM_POWER_SUPPLY *PowerSupply;
-
- PowerSupply = (EFI_MISC_SYSTEM_POWER_SUPPLY *)RecordData;
-
- //
- // PowerUnitGroup
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE39, PowerUnitGroup),
- &PowerSupply->PowerUnitGroup,
- 1
- );
-
- //
- // PowerSupplyLocation
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE39, Location),
- &(PowerSupply->PowerSupplyLocation),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // PowerSupplyDeviceName
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE39, DeviceName),
- &(PowerSupply->PowerSupplyDeviceName),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // PowerSupplyManufacturer
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE39, Manufacturer),
- &(PowerSupply->PowerSupplyManufacturer),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // PowerSupplySerialNumber
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE39, SerialNumber),
- &(PowerSupply->PowerSupplySerialNumber),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // PowerSupplyAssetTagNumber
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE39, AssetTagNumber),
- &(PowerSupply->PowerSupplyAssetTagNumber),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // PowerSupplyModelPartNumber
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE39, ModelPartNumber),
- &(PowerSupply->PowerSupplyModelPartNumber),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // PowerSupplyRevisionLevel
- //
- SmbiosFldString (
- StructureNode,
- OFFSET_OF (SMBIOS_TABLE_TYPE39, RevisionLevel),
- &(PowerSupply->PowerSupplyRevisionLevel),
- 2 // 64 * sizeof(CHAR16)
- );
-
- //
- // PowerSupplyMaxPowerCapacity
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE39, MaxPowerCapacity),
- &PowerSupply->PowerSupplyMaxPowerCapacity,
- 2
- );
-
- //
- // PowerSupplyCharacteristics
- //
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE39, PowerSupplyCharacteristics),
- &PowerSupply->PowerSupplyCharacteristics,
- 2
- );
-
- //
- // PowerSupplyInputVoltageProbeLink
- //
- SmbiosFldInterLink (
- StructureNode,
- (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE39, InputVoltageProbeHandle),
- 26, // SMBIOS type 26 - Voltage Probe
- &PowerSupply->PowerSupplyInputVoltageProbeLink,
- &gEfiMiscSubClassGuid
- );
-
- //
- // PowerSupplyCoolingDeviceLink
- //
- SmbiosFldInterLink (
- StructureNode,
- (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE39, CoolingDeviceHandle),
- 27, // SMBIOS type 27 - Cooling Device
- &PowerSupply->PowerSupplyCoolingDeviceLink,
- &gEfiMiscSubClassGuid
- );
-
- //
- // PowerSupplyInputCurrentProbeLink
- //
- SmbiosFldInterLink (
- StructureNode,
- (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE39, InputCurrentProbeHandle),
- 29, // SMBIOS type 29 - Electrical Current Probe
- &PowerSupply->PowerSupplyInputCurrentProbeLink,
- &gEfiMiscSubClassGuid
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 0x80-0xFF -- OEM.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscTypeOEM (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_STATUS Status;
- UINT8 *NewRecordData;
- UINT32 IncrementDataSize;
- UINT16 Handle;
- INT8 Result;
- UINT32 StructureSize;
- UINT8 CountOfString;
-
- Status = EFI_SUCCESS;
- NewRecordData = NULL;
-
- //
- // Check if OEM structure has included 2 trailing 0s in data record, if not,
- // we append them at the end to ensure OEM structure is always correct with 2 trailing 0s.
- //
- Result = SmbiosCheckTrailingZero (RecordData, RecordDataSize);
-
- if (Result != 0) {
- DEBUG ((EFI_D_ERROR, "OEM SMBIOS type %x is not valid!!\n", ((SMBIOS_STRUCTURE *) RecordData) -> Type));
- if (Result == -1) {
- //
- // No 2 trailing 0s exist
- //
- DEBUG ((EFI_D_ERROR, "OEM SMBIOS type has NO 2 trailing 0s!!\n"));
- IncrementDataSize = 2;
- } else {
- //
- // Only 1 trailing 0 exist at the end
- //
- DEBUG ((EFI_D_ERROR, "OEM SMBIOS type has only 1 trailing 0!!\n"));
- IncrementDataSize = 1;
- }
- NewRecordData = AllocateZeroPool (RecordDataSize + IncrementDataSize);
- ASSERT (NewRecordData != NULL);
- CopyMem (NewRecordData, RecordData, RecordDataSize);
- RecordData = NewRecordData;
- RecordDataSize += IncrementDataSize;
- }
-
- Status = GetSmbiosStructureSize (StructureNode->Structure, &StructureSize, &CountOfString);
- ASSERT_EFI_ERROR (Status);
-
- if (StructureSize < RecordDataSize) {
- //
- // Create new SMBIOS table entry
- //
- SmbiosUpdateStructureBuffer (
- StructureNode,
- RecordData
- );
- } else {
- //
- // Copy the entire data (including the Smbios structure header),
- // but preserve the handle that is already allocated.
- //
- Handle = StructureNode->Structure->Handle;
- CopyMem (
- StructureNode->Structure,
- RecordData,
- RecordDataSize
- );
- StructureNode->Structure->Handle = Handle;
- StructureNode->StructureSize = RecordDataSize;
- }
-
- if (NewRecordData != NULL) {
- FreePool (NewRecordData);
- }
-
- return Status;
-}
-
-/**
- Field Filling Function for Misc SubClass record type 127 - End-of-Table.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType127 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- return EFI_SUCCESS;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/PiSmbiosRecordOnDataHubSmbiosRecordThunk.inf b/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/PiSmbiosRecordOnDataHubSmbiosRecordThunk.inf
deleted file mode 100644
index ad3003988b..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/PiSmbiosRecordOnDataHubSmbiosRecordThunk.inf
+++ /dev/null
@@ -1,74 +0,0 @@
-## @file
-# This thunk driver register a filter for DataHub protocol, once a data hub record
-# is added via EFI_DATA_HUB_PROTOCOL->LogData(), this filter will be invoked to
-# translate the datahub's record to SMBIOS record.
-#
-# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = Datahub2SmbiosThunk
- FILE_GUID = 9F8B12CF-E796-408f-9D59-3ACDDC0AFBE3
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = ThunkEntry
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- Thunk.c
- Thunk.h
- Translate.c
- ConvLib.c
- ConvTable.c
- ProcessorConv.c
- MemoryConv.c
- MiscConv.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-
-[LibraryClasses]
- UefiBootServicesTableLib
- MemoryAllocationLib
- UefiDriverEntryPoint
- BaseMemoryLib
- HiiLib
- DebugLib
- BaseLib
- PcdLib
-
-[Protocols]
- gEfiDataHubProtocolGuid ## CONSUMES
- gEfiSmbiosProtocolGuid ## CONSUMES
-
-[Guids]
- gEfiMemorySubClassGuid ## CONSUMES
- gEfiMiscSubClassGuid ## CONSUMES
- gEfiCacheSubClassGuid ## CONSUMES
- gZeroGuid ## SOMETIMES_CONSUMES ## GUID
-
-[FeaturePcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport
-
-[Depex]
- gEfiDataHubProtocolGuid AND gEfiSmbiosProtocolGuid \ No newline at end of file
diff --git a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/ProcessorConv.c b/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/ProcessorConv.c
deleted file mode 100644
index 1090648a4e..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/ProcessorConv.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/** @file
- Routines that support Processor SubClass data records translation.
-
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "Thunk.h"
-
-/**
- Field Filling Function for Processor SubClass record type 17 -- Cache association.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldProcessorType17 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_SUBCLASS_TYPE1_HEADER *DataHeader;
- EFI_INTER_LINK_DATA *LinkData;
- UINT16 FieldOffset;
- UINT8 *Pointer;
-
- DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *) RecordData;
- LinkData = (EFI_INTER_LINK_DATA *) (DataHeader + 1);
- if (RecordDataSize != sizeof (EFI_INTER_LINK_DATA) + sizeof (EFI_SUBCLASS_TYPE1_HEADER)) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Determine the cache level
- //
- Pointer = (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE4, L1CacheHandle);
- if ((*Pointer == 0) && (*(Pointer + 1) == 0)) {
- SetMem ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE4, L1CacheHandle), 2, 0xFF);
- }
-
- Pointer = (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE4, L2CacheHandle);
- if ((*Pointer == 0) && (*(Pointer + 1) == 0)) {
- SetMem ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE4, L2CacheHandle), 2, 0xFF);
- }
-
- Pointer = (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE4, L3CacheHandle);
- if ((*Pointer == 0) && (*(Pointer + 1) == 0)) {
- SetMem ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE4, L3CacheHandle), 2, 0xFF);
- }
-
- if (LinkData->SubInstance == 1) {
- FieldOffset = (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE4, L1CacheHandle);
- } else if (LinkData->SubInstance == 2) {
- FieldOffset = (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE4, L2CacheHandle);
- } else if (LinkData->SubInstance == 3) {
- FieldOffset = (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE4, L3CacheHandle);
- } else {
- return EFI_INVALID_PARAMETER;
- }
-
- return SmbiosFldInterLink (
- StructureNode,
- FieldOffset,
- 7, // Smbios type 7 -- Cache Information
- LinkData,
- &gEfiCacheSubClassGuid // gProcessorSubClassName
- );
-}
-
-/**
- Field Filling Function for Processor SubClass record type 6 -- ProcessorID.
- Offset is mandatory.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldProcessorType6 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_PROCESSOR_ID_DATA *ProcessorIdData;
-
- ProcessorIdData = RecordData;
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + Offset,
- &(ProcessorIdData->Signature),
- 4
- );
-
- CopyMem (
- (UINT8 *) (StructureNode->Structure) + Offset + 4,
- &(ProcessorIdData->FeatureFlags),
- 4
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Field Filling Function for Processor SubClass record type 9 -- Voltage.
- Offset is mandatory.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldProcessorType9 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- )
-{
- EFI_EXP_BASE10_DATA *Base10Data;
- INT16 Value;
- INT16 Exponent;
-
- if (RecordDataSize != sizeof (EFI_EXP_BASE10_DATA)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Base10Data = RecordData;
- Value = Base10Data->Value;
- Exponent = Base10Data->Exponent;
-
- Exponent += 1;
- while (Exponent != 0) {
- if (Exponent > 0) {
- Value = (INT16) (Value * 10);
- Exponent--;
- } else {
- Value = (INT16) (Value / 10);
- Exponent++;
- }
- }
-
- * (UINT8 *) ((UINT8 *) (StructureNode->Structure) + Offset) = (UINT8) (Value | BIT7);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Thunk.c b/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Thunk.c
deleted file mode 100644
index 2c395f2300..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Thunk.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/** @file
- Thunk driver's entry that install filter for DataRecord.
-
-Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "Thunk.h"
-
-//
-// Global variables
-//
-LIST_ENTRY mStructureList;
-
-/**
- Entry Point of thunk driver.
-
- @param[in] ImageHandle Image handle of this driver.
- @param[in] SystemTable Pointer to EFI system table.
-
- @retval EFI_SUCCESS The event handlers were registered.
- @retval EFI_DEVICE_ERROR Failed to register the event handlers
-**/
-EFI_STATUS
-EFIAPI
-ThunkEntry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_DATA_HUB_PROTOCOL *DataHub;
- EFI_EVENT FilterEvent;
-
- Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (VOID**) &DataHub);
- ASSERT_EFI_ERROR (Status);
- ASSERT (DataHub != NULL);
-
- InitializeListHead (&mStructureList);
-
- //
- // Register SmBios Data Filter Function.
- // This function is notified at TPL_CALLBACK.
- //
- Status = gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- SmbiosDataFilter,
- NULL,
- &FilterEvent
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = DataHub->RegisterFilterDriver (
- DataHub,
- FilterEvent,
- TPL_APPLICATION,
- EFI_DATA_RECORD_CLASS_DATA,
- NULL
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseEvent (FilterEvent);
- return Status;
- }
-
- return Status;
-
-}
-
-/**
- Smbios data filter function. This function is invoked when there is data records
- available in the Data Hub.
-
- @param Event The event that is signaled.
- @param Context not used here.
-**/
-VOID
-EFIAPI
-SmbiosDataFilter (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- EFI_DATA_HUB_PROTOCOL *DataHub;
- EFI_HANDLE DataHubHandle;
- UINTN HandleSize;
- UINT64 MonotonicCount;
- EFI_DATA_RECORD_HEADER *Record;
-
- Status = EFI_SUCCESS;
- DataHub = NULL;
-
- //
- // Get the Data Hub Protocol. Assume only one instance
- // of Data Hub Protocol is available in the system.
- //
- HandleSize = sizeof (EFI_HANDLE);
-
- Status = gBS->LocateHandle (
- ByProtocol,
- &gEfiDataHubProtocolGuid,
- NULL,
- &HandleSize,
- &DataHubHandle
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Status = gBS->HandleProtocol (
- DataHubHandle,
- &gEfiDataHubProtocolGuid,
- (VOID **) &DataHub
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // Get all available data records from data hub
- //
- MonotonicCount = 0;
- Record = NULL;
-
- do {
-
- Status = DataHub->GetNextRecord (
- DataHub,
- &MonotonicCount,
- &Event,
- &Record
- );
-
- if (!EFI_ERROR (Status)) {
- if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {
-
- //
- // It's of expected Data Type. Process it.
- //
- SmbiosProcessDataRecord (Record);
- }
- }
- } while (!EFI_ERROR (Status) && (MonotonicCount != 0));
-
-Done:
-
- return ;
-
-}
diff --git a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Thunk.h b/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Thunk.h
deleted file mode 100644
index 98e53718b9..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Thunk.h
+++ /dev/null
@@ -1,1414 +0,0 @@
-/** @file
- The common header file for the thunk driver.
-
-Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#ifndef _DATAHUB_TO_SMBIOS_THUNK_
-#define _DATAHUB_TO_SMBIOS_THUNK_
-
-#include <FrameworkDxe.h>
-#include <IndustryStandard/SmBios.h>
-
-#include <Guid/EventGroup.h>
-#include <Guid/SmBios.h>
-#include <Guid/ZeroGuid.h>
-#include <Protocol/DataHub.h>
-#include <Guid/DataHubRecords.h>
-#include <Protocol/HiiDatabase.h>
-#include <Protocol/Smbios.h>
-
-#include <Library/BaseLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/HiiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/ReportStatusCodeLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-//
-// Conversion Table that describes the translation method for
-// Data Hub Data Records of certain SubClass and RecordNumber
-//
-typedef enum {
- BySubclassInstanceSubinstanceProducer,
- BySubClassInstanceProducer,
- MaxLocatingMethod
-} SMBIOS_STRUCTURE_LOCATING_METHOD;
-
-typedef enum {
- RecordDataUnchangedOffsetSpecified,
- ByFunctionWithOffsetSpecified,
- ByFunction,
- ByFunctionWithWholeDataRecord,
- MaxFieldFillingMethod
-} SMBIOS_FIELD_FILLING_METHOD;
-
-typedef struct _SMBIOS_STRUCTURE_NODE SMBIOS_STRUCTURE_NODE;
-
-typedef struct {
- UINT8 Type;
- UINT8 Length;
- UINT16 Handle;
- UINT8 Tailing[2];
-} EFI_SMBIOS_TABLE_TYPE127;
-
-typedef
-EFI_STATUS
-(*SMBIOS_FIELD_FILLING_FUNCTION) (
- IN OUT SMBIOS_STRUCTURE_NODE * StructureNode,
- IN UINT32 Offset OPTIONAL,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-typedef struct {
- //
- // Data Hub Data Record's SubClass and RecordNumber
- //
- EFI_GUID SubClass;
- UINT32 RecordType;
-
- //
- // Translation method applied
- //
- UINT8 SmbiosType;
- SMBIOS_STRUCTURE_LOCATING_METHOD StructureLocatingMethod;
- SMBIOS_FIELD_FILLING_METHOD FieldFillingMethod;
- UINT32 FieldOffset;
- SMBIOS_FIELD_FILLING_FUNCTION FieldFillingFunction;
-
-} SMBIOS_CONVERSION_TABLE_ENTRY;
-
-//
-// SMBIOS_LINK_DATA_FIXUP nodes indicate the Link fields that
-// need to be fixed up when creating the resulting Smbios image.
-//
-#define SMBIOS_LINK_DATA_FIXUP_NODE_SIGNATURE SIGNATURE_32 ('S', 'm', 'l', 'n')
-
-typedef struct {
-
- UINT32 Signature;
- LIST_ENTRY Link;
-
- UINT32 Offset;
- UINT8 TargetType;
- EFI_GUID SubClass;
- EFI_INTER_LINK_DATA LinkData;
-
-} SMBIOS_LINK_DATA_FIXUP_NODE;
-
-//
-// The global Structure List node.
-// The Structure List is populated as more and more
-// Structures (of various types) are discovered and inserted.
-// The nodes in the Structure List will be concatenated
-// to form the ultimate SMBIOS table.
-//
-#define SMBIOS_STRUCTURE_NODE_SIGNATURE SIGNATURE_32 ('S', 'm', 'b', 's')
-
-struct _SMBIOS_STRUCTURE_NODE {
-
- UINT32 Signature;
- LIST_ENTRY Link;
-
- //
- // Tags
- //
- EFI_GUID SubClass;
- UINT16 Instance;
- UINT16 SubInstance;
- EFI_GUID ProducerName;
-
- //
- // the Smbios structure
- //
- UINT32 StructureSize; // Actual structure size including strings
-
- EFI_SMBIOS_TABLE_HEADER *Structure;
-
-
- EFI_SMBIOS_HANDLE SmbiosHandle; // Smbios Handle in SMBIOS database.
-
- EFI_SMBIOS_TYPE SmbiosType;
-
- LIST_ENTRY LinkDataFixup;
-
-};
-
-//
-// Smbios type info table. Indicates minimum length
-// for each Smbios type as the indicator of the initial size of buffer
-// allocated for the structure instance of a specific type.
-//
-typedef struct {
-
- UINT8 Type;
- UINT8 MinLength; // Minimal structure size including
- // TWO trailing bytes of 0x00
- //
- BOOLEAN IsRequired; // Required structure type defined by Smbios Spec
- BOOLEAN IsCreated; // Created in this run
-} SMBIOS_TYPE_INFO_TABLE_ENTRY;
-
-//
-// EDK framwork Memory Data hub definition to support EDK/Framework driver.
-//
-typedef struct {
- STRING_REF MemoryDeviceLocator;
- STRING_REF MemoryBankLocator;
- STRING_REF MemoryManufacturer;
- STRING_REF MemorySerialNumber;
- STRING_REF MemoryAssetTag;
- STRING_REF MemoryPartNumber;
- EFI_INTER_LINK_DATA MemoryArrayLink;
- EFI_INTER_LINK_DATA MemorySubArrayLink;
- UINT16 MemoryTotalWidth;
- UINT16 MemoryDataWidth;
- UINT64 MemoryDeviceSize;
- EFI_MEMORY_FORM_FACTOR MemoryFormFactor;
- UINT8 MemoryDeviceSet;
- EFI_MEMORY_ARRAY_TYPE MemoryType;
- EFI_MEMORY_TYPE_DETAIL MemoryTypeDetail;
- UINT16 MemorySpeed;
- EFI_MEMORY_STATE MemoryState;
- UINT8 MemoryAttributes;
-} FRAMEWORK_MEMORY_ARRAY_LINK_DATA;
-
-typedef struct {
- EFI_MEMORY_ARRAY_LOCATION MemoryArrayLocation;
- EFI_MEMORY_ARRAY_USE MemoryArrayUse;
- EFI_MEMORY_ERROR_CORRECTION MemoryErrorCorrection;
- UINT32 MaximumMemoryCapacity;
- UINT16 NumberMemoryDevices;
-} FRAMEWORK_MEMORY_ARRAY_LOCATION_DATA;
-
-//
-// Global variables
-//
-extern SMBIOS_CONVERSION_TABLE_ENTRY mConversionTable[];
-extern SMBIOS_TYPE_INFO_TABLE_ENTRY mTypeInfoTable[];
-extern LIST_ENTRY mStructureList;
-
-//
-// Function Prototypes
-//
-/**
- Smbios data filter function. This function is invoked when there is data records
- available in the Data Hub.
-
- @param Event The event that is signaled.
- @param Context not used here.
-**/
-VOID
-EFIAPI
-SmbiosDataFilter (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-//
-// Function prototypes
-//
-/**
- Process a datahub's record and find corresponding translation way to translate
- to SMBIOS record.
-
- @param Record Point to datahub record.
-**/
-VOID
-SmbiosProcessDataRecord (
- IN EFI_DATA_RECORD_HEADER *Record
- );
-
-/**
- Calculate the minimal length for a SMBIOS type. This length maybe not equal
- to sizeof (SMBIOS_RECORD_STRUCTURE), but defined in conformance chapter in SMBIOS specification.
-
- @param Type SMBIOS's type.
-
- @return the minimal length of a smbios record.
-**/
-UINT32
-SmbiosGetTypeMinimalLength (
- IN UINT8 Type
- );
-
-/**
- Enlarge the structure buffer of a structure node in SMBIOS database.
- The function maybe lead the structure pointer for SMBIOS record changed.
-
- @param StructureNode The structure node whose structure buffer is to be enlarged.
- @param NewLength The new length of SMBIOS record which does not include unformat area.
- @param OldBufferSize The old size of SMBIOS record buffer.
- @param NewBufferSize The new size is targeted for enlarged.
-
- @retval EFI_OUT_OF_RESOURCES No more memory to allocate new record
- @retval EFI_SUCCESS Success to enlarge the record buffer size.
-**/
-EFI_STATUS
-SmbiosEnlargeStructureBuffer (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- UINT8 NewLength,
- UINTN OldBufferSize,
- UINTN NewBufferSize
- );
-
-/**
- Update the structure buffer of a structure node in SMBIOS database.
- The function lead the structure pointer for SMBIOS record changed.
-
- @param StructureNode The structure node whose structure buffer is to be enlarged.
- @param NewRecord The new SMBIOS record.
-
-**/
-VOID
-SmbiosUpdateStructureBuffer (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN EFI_SMBIOS_TABLE_HEADER *NewRecord
- );
-
-/**
- Fill a standard Smbios string field.
-
- This function will convert the unicode string to single byte chars, and only
- English language is supported.
- This function changes the Structure pointer value of the structure node,
- which should be noted by Caller.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is too larger
- @retval EFI_OUT_OF_RESOURCES No memory to allocate new buffer for string
- @retval EFI_SUCCESS Sucess append string for a SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldString (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Fill the inter link field for a SMBIOS recorder.
-
- Some SMBIOS recorder need to reference the handle of another SMBIOS record. But
- maybe another SMBIOS record has not been added, so put the InterLink request into
- a linked list and the interlink will be fixedup when a new SMBIOS record is added.
-
- @param StructureNode Point to SMBIOS_STRUCTURE_NODE which reference another record's handle
- @param LinkSmbiosNodeOffset The offset in this record for holding the handle of another SMBIOS record
- @param LinkSmbiosType The type of SMBIOS record want to be linked.
- @param InterLink Point to EFI_INTER_LINK_DATA will be put linked list.
- @param SubClassGuid The guid of subclass for linked SMBIOS record.
-
- @retval EFI_SUCESS The linked record is found and no need fixup in future.
- @retval !EFI_SUCESS The linked record can not be found and InterLink is put a fixing-p linked list.
-**/
-EFI_STATUS
-SmbiosFldInterLink (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT16 LinkSmbiosNodeOffset,
- IN UINT8 LinkSmbiosType,
- IN EFI_INTER_LINK_DATA *InterLink,
- IN EFI_GUID *SubClassGuid
- );
-
-/**
- Find a handle that matches the Link Data and the target Smbios type.
-
- @param TargetType the Smbios type
- @param SubClass the SubClass
- @param LinkData Specifies Instance, SubInstance and ProducerName
- @param Handle the HandleNum found
-
- @retval EFI_NOT_FOUND Can not find the record according to handle
- @retval EFI_SUCCESS Success to find the handle
-**/
-EFI_STATUS
-SmbiosFindHandle (
- IN UINT8 TargetType,
- IN EFI_GUID *SubClass,
- IN EFI_INTER_LINK_DATA *LinkData,
- IN OUT UINT16 *HandleNum
- );
-
-/**
- Field Filling Function. Transform an EFI_EXP_BASE10_DATA to a word, with 'Mega'
- as the unit.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is invalid.
- @retval EFI_SUCCESS RecordData is successed to be filled into given SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldBase10ToWordWithMega (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function. Transform an EFI_EXP_BASE2_DATA to a word, with 'Kilo'
- as the unit. Granularity implemented for Cache Size.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is invalid.
- @retval EFI_SUCCESS RecordData is successed to be filled into given SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldBase2ToWordWithKilo (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function: truncate record data to byte and fill in the
- field as indicated by Offset.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is invalid.
- @retval EFI_SUCCESS RecordData is successed to be filled into given SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldTruncateToByte (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Processor SubClass record type 6 -- ProcessorID.
- Offset is mandatory.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldProcessorType6 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Processor SubClass record type 9 -- Voltage.
- Offset is mandatory.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldProcessorType9 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Processor SubClass record type 17 -- Cache association.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldProcessorType17 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function. Transform an EFI_EXP_BASE2_DATA to a word, with 10exp-9
- as the unit.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is invalid.
- @retval EFI_SUCCESS RecordData is successed to be filled into given SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldBase10ToByteWithNano (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function: truncate record data to byte and fill in the
- field as indicated by Offset.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is invalid.
- @retval EFI_SUCCESS RecordData is successed to be filled into given SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldTruncateToWord (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Cache SubClass record type 10 -- Cache Config.
- Offset is mandatory
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldCacheType10 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Check if OEM structure has included 2 trailing 0s in data record.
-
- @param RecordData Point to record data will be checked.
- @param RecordDataSize The size of record data.
-
- @retval 0 2 trailing 0s exist in unformatted section
- @retval 1 1 trailing 0 exists at the end of unformatted section
- @retval -1 There is no 0 at the end of unformatted section
-**/
-INT8
-SmbiosCheckTrailingZero (
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Cache SubClass record type 5&6 -- Cache SRAM type.
- Offset is mandatory
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldCacheType5 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Memory SubClass record type 2 -- Physical Memory
- Array.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType2 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Memory SubClass record type 3 -
- - Memory Device: SMBIOS Type 17
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType3 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Memory SubClass record type 4
- -- Memory Array Mapped Address: SMBIOS Type 19
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType4 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Memory SubClass record type 5
- -- Memory Device Mapped Address: SMBIOS Type 20
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType5 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Memory SubClass record type 6
- -- Memory Channel Type: SMBIOS Type 37
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType6 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Memory SubClass record type 7
- -- Memory Channel Device: SMBIOS Type 37
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType7 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Memory SubClass record type 8
- -- Memory Controller information: SMBIOS Type 5
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType8 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Memory SubClass record type
- -- Memory 32 Bit Error Information: SMBIOS Type 18
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType9 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Memory SubClass record type
- -- Memory 64 Bit Error Information: SMBIOS Type 33
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMemoryType10 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 0 -- Bios Information.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType0 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function. Transform an EFI_EXP_BASE2_DATA to a byte, with '64k'
- as the unit.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_INVALID_PARAMETER RecordDataSize is invalid.
- @retval EFI_SUCCESS RecordData is successed to be filled into given SMBIOS record.
-**/
-EFI_STATUS
-SmbiosFldBase2ToByteWith64K (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 1 -- System Information.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType1 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for record type 2 -- Base Board Manufacture.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType2 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 3 -
- - System Enclosure or Chassis.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType3 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 8 -- Port Connector.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType8 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 9 -- System slot.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType9 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 10 - Onboard Device.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType10 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 11 - OEM Strings.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType11 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 12 - System Options.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType12 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 13 - BIOS Language.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType13 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 14 - System Language String
- Current solution assumes that EFI_MISC_SYSTEM_LANGUAGE_STRINGs are logged with
- their LanguageId having ascending orders.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType14 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 15 -- System Event Log.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType15 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 21 - Pointing Device.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType21 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-
-/**
- Field Filling Function for Misc SubClass record type 32 -- System Boot Information.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType32 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 38 -- IPMI device info.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType38 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 0x80-0xFF -- OEM.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscTypeOEM (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Memory SubClass record type 3 -
- - Memory Device: SMBIOS Type 6
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldSMBIOSType6 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 22 - Portable Battery.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType22 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 22 - Portable Battery.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType22 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 23 - System Reset.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType23 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 24 - Hardware Security.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType24 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 25 - System Power Controls.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType25 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 26 - Voltage Probe.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType26 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 27 - Cooling Device.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType27 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 28 -- Temperature Probe.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType28 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 29 -- Electrical Current Probe.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType29 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 30 -- Out-of-Band Remote Access.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType30 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 34 -- Management Device.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType34 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 35 -- Management Device Component.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType35 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 36 -- Management Device Threshold.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType36 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 38 -- IPMI device info.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType38 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 39 -- Power supply.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType39 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Field Filling Function for Misc SubClass record type 127 - End-of-Table.
-
- @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
- @param Offset Offset of SMBIOS record which RecordData will be filled.
- @param RecordData RecordData buffer will be filled.
- @param RecordDataSize The size of RecordData buffer.
-
- @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
-**/
-EFI_STATUS
-SmbiosFldMiscType127 (
- IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
- IN UINT32 Offset,
- IN VOID *RecordData,
- IN UINT32 RecordDataSize
- );
-
-/**
- Create a blank smbios record. The datahub record is only a field of smbios record.
- So before fill any field from datahub's record. A blank smbios record need to be
- created.
-
- @param ProducerHandle The produce handle for a datahub record
- @param StructureNode Point to SMBIOS_STRUCTURE_NODE
-
- @retval EFI_OUT_OF_RESOURCES Fail to allocate memory for new blank SMBIOS record.
- @retval EFI_SUCCESS Success to create blank smbios record.
-**/
-EFI_STATUS
-SmbiosProtocolCreateRecord (
- IN EFI_HANDLE ProducerHandle, OPTIONAL
- IN SMBIOS_STRUCTURE_NODE *StructureNode
- );
-
-/**
- Get pointer of EFI_SMBIOS_PROTOCOL.
-
- @return pointer of EFI_SMBIOS_PROTOCOL.
-**/
-EFI_SMBIOS_PROTOCOL*
-GetSmbiosProtocol (
- VOID
- );
-
-/**
- Get pointer of a SMBIOS record's buffer according to its handle.
-
- @param Handle The handle of SMBIOS record want to be searched.
- @param Type The type of SMBIOS record want to be searched.
- @param ProducerHandle The producer handle of SMBIOS record.
-
- @return EFI_SMBIOS_TABLE_HEADER Point to a SMBIOS record's buffer.
-**/
-EFI_SMBIOS_TABLE_HEADER*
-GetSmbiosBufferFromHandle (
- IN EFI_SMBIOS_HANDLE Handle,
- IN EFI_SMBIOS_TYPE Type,
- IN EFI_HANDLE ProducerHandle OPTIONAL
- );
-
-/**
-
- Get the full size of smbios structure including optional strings that follow the formatted structure.
-
- @param Head Pointer to the beginning of smbios structure.
- @param Size The returned size.
- @param NumberOfStrings The returned number of optional strings that follow the formatted structure.
-
- @retval EFI_SUCCESS Size retured in Size.
- @retval EFI_INVALID_PARAMETER Input smbios structure mal-formed or Size is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-GetSmbiosStructureSize (
- IN EFI_SMBIOS_TABLE_HEADER *Head,
- OUT UINT32 *Size,
- OUT UINT8 *NumberOfStrings
- );
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Translate.c b/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Translate.c
deleted file mode 100644
index 7d674f89f4..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/Translate.c
+++ /dev/null
@@ -1,608 +0,0 @@
-/** @file
- Translate the DataHub records via EFI_DATA_HUB_PROTOCOL to Smbios recorders
- via EFI_SMBIOS_PROTOCOL.
-
-Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
-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.
-
-**/
-
-#include "Thunk.h"
-
-EFI_SMBIOS_PROTOCOL *mSmbiosProtocol = NULL;
-
-/**
- Release the structure Node.
-
- @param StructureNode Point to SMBIOS_STRUCTURE_NODE which will be removed.
-**/
-VOID
-ReleaseStructureNode (
- SMBIOS_STRUCTURE_NODE *StructureNode
- )
-{
- EFI_SMBIOS_PROTOCOL *Smbios;
-
- RemoveEntryList (&(StructureNode->Link));
- Smbios = GetSmbiosProtocol();
- ASSERT (Smbios != NULL);
- Smbios->Remove (Smbios, StructureNode->SmbiosHandle);
- gBS->FreePool (StructureNode);
-}
-
-/**
- Process a datahub's record and find corresponding translation way to translate
- to SMBIOS record.
-
- @param Record Point to datahub record.
-**/
-VOID
-SmbiosProcessDataRecord (
- IN EFI_DATA_RECORD_HEADER *Record
- )
-{
- EFI_DATA_RECORD_HEADER *RecordHeader;
- EFI_SUBCLASS_TYPE1_HEADER *DataHeader;
- UINTN Index;
- SMBIOS_CONVERSION_TABLE_ENTRY *Conversion;
- UINT8 *SrcData;
- UINTN SrcDataSize;
- LIST_ENTRY *Link;
- SMBIOS_STRUCTURE_NODE *StructureNode;
- BOOLEAN StructureCreated;
- EFI_STATUS Status;
-
- Conversion = NULL;
- StructureNode = NULL;
- StructureCreated = FALSE;
- RecordHeader = Record;
- DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);
- SrcData = (UINT8 *) (DataHeader + 1);
- SrcDataSize = RecordHeader->RecordSize - RecordHeader->HeaderSize - sizeof (EFI_SUBCLASS_TYPE1_HEADER);
-
- if (DataHeader->HeaderSize != sizeof (EFI_SUBCLASS_TYPE1_HEADER) ||
- DataHeader->Instance == EFI_SUBCLASS_INSTANCE_RESERVED ||
- DataHeader->SubInstance == EFI_SUBCLASS_INSTANCE_RESERVED
- ) {
- //
- // Invalid Data Record
- //
- goto Done;
- }
-
- Index = 0;
- while(TRUE) {
- //
- // Find a matching entry in the conversion table for this
- // (SubClass, RecordNumber) pair
- //
- for (; !CompareGuid (&(mConversionTable[Index].SubClass), &gZeroGuid); Index++) {
- if (CompareGuid (
- &(mConversionTable[Index].SubClass),
- &(RecordHeader->DataRecordGuid)
- )) {
- if (mConversionTable[Index].RecordType == DataHeader->RecordType) {
- break;
- }
- }
- }
-
- if (CompareGuid (&(mConversionTable[Index].SubClass), &gZeroGuid)) {
- //
- // We cannot find a matching entry in conversion table,
- // this means this data record cannot be used for SMBIOS.
- // Just skip it.
- //
- goto Done;
- }
-
- Conversion = &mConversionTable[Index++];
-
- //
- // Find corresponding structure in the Structure List
- //
- for (Link = mStructureList.ForwardLink; Link != &mStructureList; Link = Link->ForwardLink) {
-
- StructureNode = CR (
- Link,
- SMBIOS_STRUCTURE_NODE,
- Link,
- SMBIOS_STRUCTURE_NODE_SIGNATURE
- );
-
- if (Conversion->StructureLocatingMethod == BySubclassInstanceSubinstanceProducer) {
- //
- // Look at SubClass, Instance, SubInstance and ProducerName for a matching
- // node
- //
- if (CompareGuid (&(StructureNode->SubClass), &(RecordHeader->DataRecordGuid)) &&
- StructureNode->Instance == DataHeader->Instance &&
- StructureNode->SubInstance == DataHeader->SubInstance &&
- CompareGuid (&(StructureNode->ProducerName), &(RecordHeader->ProducerName))
- ) {
- if (Conversion->SmbiosType >= 0x80) {
- if (StructureNode->SmbiosType == ((SMBIOS_STRUCTURE_HDR *) SrcData)->Type) {
- break;
- }
- } else if (StructureNode->SmbiosType == Conversion->SmbiosType) {
- break;
- }
- }
-
- } else if (Conversion->StructureLocatingMethod == BySubClassInstanceProducer) {
- //
- // Look at SubClass, Instance and ProducerName for a matching node
- //
- if (CompareGuid (&(StructureNode->SubClass), &(RecordHeader->DataRecordGuid)) &&
- StructureNode->Instance == DataHeader->Instance &&
- CompareGuid (&(StructureNode->ProducerName), &(RecordHeader->ProducerName))
- ) {
- if (Conversion->SmbiosType >= 0x80) {
- if (StructureNode->SmbiosType == ((SMBIOS_STRUCTURE_HDR *) SrcData)->Type) {
- break;
- }
- } else if (StructureNode->SmbiosType == Conversion->SmbiosType) {
- break;
- }
- }
-
- } else {
- //
- // Invalid conversion table entry
- //
- goto Done;
- }
- }
-
- if (Link == &mStructureList || StructureNode == NULL) {
-
- //
- // Not found, create a new structure
- //
- StructureNode = AllocateZeroPool (sizeof (SMBIOS_STRUCTURE_NODE));
-
- if (StructureNode == NULL) {
- goto Done;
- }
-
- if (Conversion->StructureLocatingMethod == BySubclassInstanceSubinstanceProducer) {
- //
- // Fill in SubClass, Instance, SubInstance and ProducerName
- //
- CopyMem (&(StructureNode->SubClass), &(RecordHeader->DataRecordGuid), sizeof (EFI_GUID));
- StructureNode->Instance = DataHeader->Instance;
- StructureNode->SubInstance = DataHeader->SubInstance;
- CopyMem (&(StructureNode->ProducerName), &(RecordHeader->ProducerName), sizeof (EFI_GUID));
-
- } else if (Conversion->StructureLocatingMethod == BySubClassInstanceProducer) {
- //
- // Fill in at SubClass, Instance and ProducerName, mark SubInstance as Non
- // Applicable
- //
- CopyMem (&(StructureNode->SubClass), &(RecordHeader->DataRecordGuid), sizeof (EFI_GUID));
- StructureNode->Instance = DataHeader->Instance;
- StructureNode->SubInstance = EFI_SUBCLASS_INSTANCE_NON_APPLICABLE;
- CopyMem (&(StructureNode->ProducerName), &(RecordHeader->ProducerName), sizeof (EFI_GUID));
-
- }
- //
- // Allocate the structure instance
- //
- StructureNode->StructureSize = SmbiosGetTypeMinimalLength (Conversion->SmbiosType);
-
- //
- // StructureSize include the TWO trailing zero byte.
- //
- if (StructureNode->StructureSize < (sizeof(SMBIOS_STRUCTURE) + 2)) {
- //
- // Invalid Type
- //
- gBS->FreePool (StructureNode);
- goto Done;
- }
-
- //
- // Assign correct SmbiosType when OEM type and Non-OEM type
- //
- if (Conversion->SmbiosType >= 0x80) {
- StructureNode->SmbiosType = ((SMBIOS_STRUCTURE_HDR *) SrcData)->Type;
- } else {
- StructureNode->SmbiosType = Conversion->SmbiosType;
- }
-
- StructureNode->SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
- Status = SmbiosProtocolCreateRecord (
- NULL,
- StructureNode
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // Temporary cache the structrue pointer to Smbios database.
- //
- StructureNode->Structure = GetSmbiosBufferFromHandle (StructureNode->SmbiosHandle, StructureNode->SmbiosType, NULL);
-
- InitializeListHead (&StructureNode->LinkDataFixup);
-
- //
- // Insert the Structure Node into the Strucutre List
- //
- StructureNode->Signature = SMBIOS_STRUCTURE_NODE_SIGNATURE;
- InsertTailList (&mStructureList, &(StructureNode->Link));
-
- StructureCreated = TRUE;
-
- }
-
-
- //
- // Re-calculate the structure pointer to Smbios database.
- //
- StructureNode->Structure = GetSmbiosBufferFromHandle (StructureNode->SmbiosHandle, StructureNode->SmbiosType, NULL);
-
- //
- // Fill the Structure's field corresponding to this data record
- //
- if (Conversion->FieldFillingMethod == RecordDataUnchangedOffsetSpecified) {
- //
- // Field data is just the record data without transforming and
- // offset is specified directly in the conversion table entry
- //
- if (Conversion->FieldOffset + SrcDataSize > StructureNode->Structure->Length) {
- //
- // Invalid Conversion Table Entry
- //
- if (StructureCreated) {
- ReleaseStructureNode (StructureNode);
- }
-
- goto Done;
- }
-
- CopyMem ((UINT8 *) (StructureNode->Structure) + Conversion->FieldOffset, SrcData, SrcDataSize);
-
- } else if (Conversion->FieldFillingMethod == ByFunctionWithOffsetSpecified) {
- //
- // Field offfset is specified in the conversion table entry, but
- // record data needs to be transformed to be filled into the field,
- // so let the FieldFillingFunction do it.
- //
- if (Conversion->FieldFillingFunction == NULL) {
- //
- // Invalid Conversion Table Entry
- //
- if (StructureCreated) {
- ReleaseStructureNode (StructureNode);
- }
-
- goto Done;
- }
-
- Status = Conversion->FieldFillingFunction (
- StructureNode,
- Conversion->FieldOffset,
- SrcData,
- (UINT32) SrcDataSize
- );
- if (EFI_ERROR (Status)) {
- if (StructureCreated) {
- ReleaseStructureNode (StructureNode);
- }
-
- goto Done;
- }
- } else if (Conversion->FieldFillingMethod == ByFunction) {
- //
- // Both field offset and field content are determined by
- // FieldFillingFunction
- //
- if (Conversion->FieldFillingFunction == NULL) {
- //
- // Invalid Conversion Table Entry
- //
- if (StructureCreated) {
- ReleaseStructureNode (StructureNode);
- }
-
- goto Done;
- }
-
- Status = Conversion->FieldFillingFunction (
- StructureNode,
- 0,
- SrcData,
- (UINT32) SrcDataSize
- );
- if (EFI_ERROR (Status)) {
- if (StructureCreated) {
- ReleaseStructureNode (StructureNode);
- }
-
- goto Done;
- }
- } else if (Conversion->FieldFillingMethod == ByFunctionWithWholeDataRecord) {
- //
- // Both field offset and field content are determined by
- // FieldFillingFunction and the function accepts the whole data record
- // including the data header
- //
- if (Conversion->FieldFillingFunction == NULL) {
- //
- // Invalid Conversion Table Entry
- //
- if (StructureCreated) {
- ReleaseStructureNode (StructureNode);
- }
-
- goto Done;
- }
-
- Status = Conversion->FieldFillingFunction (
- StructureNode,
- 0,
- DataHeader,
- RecordHeader->RecordSize - RecordHeader->HeaderSize
- );
- if (EFI_ERROR (Status)) {
- if (StructureCreated) {
- ReleaseStructureNode (StructureNode);
- }
-
- goto Done;
- }
- } else {
- //
- // Invalid Conversion Table Entry
- //
- if (StructureCreated) {
- ReleaseStructureNode (StructureNode);
- }
-
- goto Done;
- }
-
- //
- // SmbiosEnlargeStructureBuffer is called to remove and add again
- // this SMBIOS entry to reflash SMBIOS table in configuration table.
- //
- SmbiosEnlargeStructureBuffer (
- StructureNode,
- StructureNode->Structure->Length,
- StructureNode->StructureSize,
- StructureNode->StructureSize
- );
- }
-Done:
- return ;
-}
-
-/**
- Calculate the minimal length for a SMBIOS type. This length maybe not equal
- to sizeof (SMBIOS_RECORD_STRUCTURE), but defined in conformance chapter in SMBIOS specification.
-
- @param Type SMBIOS's type.
-
- @return the minimal length of a smbios record.
-**/
-UINT32
-SmbiosGetTypeMinimalLength (
- IN UINT8 Type
- )
-{
- UINTN Index;
-
- for (Index = 0; mTypeInfoTable[Index].MinLength != 0; Index++) {
- if (mTypeInfoTable[Index].Type == Type) {
- return mTypeInfoTable[Index].MinLength;
- }
- }
-
- return 0;
-}
-
-/**
- Get pointer of EFI_SMBIOS_PROTOCOL.
-
- @return pointer of EFI_SMBIOS_PROTOCOL.
-**/
-EFI_SMBIOS_PROTOCOL*
-GetSmbiosProtocol(
- VOID
- )
-{
- EFI_STATUS Status;
-
- if (mSmbiosProtocol == NULL) {
- Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID*) &mSmbiosProtocol);
- ASSERT_EFI_ERROR (Status);
- }
-
- ASSERT (mSmbiosProtocol != NULL);
- return mSmbiosProtocol;
-}
-
-/**
- Create a blank smbios record. The datahub record is only a field of smbios record.
- So before fill any field from datahub's record. A blank smbios record need to be
- created.
-
- @param ProducerHandle The produce handle for a datahub record
- @param StructureNode Point to SMBIOS_STRUCTURE_NODE
-
- @retval EFI_OUT_OF_RESOURCES Fail to allocate memory for new blank SMBIOS record.
- @retval EFI_SUCCESS Success to create blank smbios record.
-**/
-EFI_STATUS
-SmbiosProtocolCreateRecord (
- IN EFI_HANDLE ProducerHandle, OPTIONAL
- IN SMBIOS_STRUCTURE_NODE *StructureNode
- )
-{
- EFI_SMBIOS_PROTOCOL *Smbios;
- EFI_SMBIOS_TABLE_HEADER *BlankRecord;
- EFI_STATUS Status;
- SMBIOS_STRUCTURE_NODE *RefStructureNode;
- LIST_ENTRY *Link;
- LIST_ENTRY *Link1;
- LIST_ENTRY *Link2;
- SMBIOS_LINK_DATA_FIXUP_NODE *LinkDataFixupNode;
- UINT8 *BufferPointer;
-
- Smbios = GetSmbiosProtocol();
- ASSERT (Smbios != NULL);
-
- //
- // Prepare a blank smbios record.
- //
- BlankRecord = (EFI_SMBIOS_TABLE_HEADER*) AllocateZeroPool (StructureNode->StructureSize);
- if (BlankRecord == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- BlankRecord->Type = StructureNode->SmbiosType;
- BlankRecord->Length = (UINT8) (StructureNode->StructureSize - 2);
-
- //
- // Add blank record into SMBIOS database.
- //
- Status = Smbios->Add (Smbios, NULL, &StructureNode->SmbiosHandle, BlankRecord);
- FreePool (BlankRecord);
-
- //
- // Fix up the InterLink node for new added smbios record if some other
- // existing smbios record want to link this new record's handle.
- //
- for (Link = mStructureList.ForwardLink; Link != &mStructureList; Link = Link->ForwardLink) {
- RefStructureNode = CR (Link, SMBIOS_STRUCTURE_NODE, Link, SMBIOS_STRUCTURE_NODE_SIGNATURE);
- for (Link1 = RefStructureNode->LinkDataFixup.ForwardLink; Link1 != &RefStructureNode->LinkDataFixup;) {
- LinkDataFixupNode = CR (Link1, SMBIOS_LINK_DATA_FIXUP_NODE, Link, SMBIOS_LINK_DATA_FIXUP_NODE_SIGNATURE);
- Link2 = Link1;
- Link1 = Link1->ForwardLink;
-
- if ((StructureNode->SmbiosType != LinkDataFixupNode->TargetType) ||
- !(CompareGuid (&StructureNode->SubClass, &LinkDataFixupNode->SubClass)) ||
- (StructureNode->Instance != LinkDataFixupNode->LinkData.Instance) ||
- (StructureNode->SubInstance != LinkDataFixupNode->LinkData.SubInstance)) {
- continue;
- }
-
- //
- // Fill the field with the handle found
- //
- BufferPointer = (UINT8 *) (RefStructureNode->Structure) + LinkDataFixupNode->Offset;
- *BufferPointer = (UINT8) (StructureNode->SmbiosHandle & 0xFF);
- *(BufferPointer + 1) = (UINT8) ((StructureNode->SmbiosHandle >> 8) & 0xFF);
- BufferPointer = NULL;
-
- RemoveEntryList (Link2);
- FreePool (LinkDataFixupNode);
- }
- }
-
- return Status;
-}
-
-/**
- Get pointer of a SMBIOS record's buffer according to its handle.
-
- @param Handle The handle of SMBIOS record want to be searched.
- @param Type The type of SMBIOS record want to be searched.
- @param ProducerHandle The producer handle of SMBIOS record.
-
- @return EFI_SMBIOS_TABLE_HEADER Point to a SMBIOS record's buffer.
-**/
-EFI_SMBIOS_TABLE_HEADER*
-GetSmbiosBufferFromHandle (
- IN EFI_SMBIOS_HANDLE Handle,
- IN EFI_SMBIOS_TYPE Type,
- IN EFI_HANDLE ProducerHandle OPTIONAL
- )
-{
- EFI_SMBIOS_PROTOCOL* Smbios;
- EFI_SMBIOS_HANDLE SearchingHandle;
- EFI_SMBIOS_TABLE_HEADER *RecordInSmbiosDatabase;
- EFI_STATUS Status;
-
- SearchingHandle = SMBIOS_HANDLE_PI_RESERVED;
- Smbios = GetSmbiosProtocol();
- ASSERT (Smbios != NULL);
-
- do {
- Status = Smbios->GetNext (Smbios, &SearchingHandle, &Type, &RecordInSmbiosDatabase, NULL);
- } while ((SearchingHandle != Handle) && (Status != EFI_NOT_FOUND));
-
- return RecordInSmbiosDatabase;
-}
-
-/**
-
- Get the full size of smbios structure including optional strings that follow the formatted structure.
-
- @param Head Pointer to the beginning of smbios structure.
- @param Size The returned size.
- @param NumberOfStrings The returned number of optional strings that follow the formatted structure.
-
- @retval EFI_SUCCESS Size retured in Size.
- @retval EFI_INVALID_PARAMETER Input smbios structure mal-formed or Size is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-GetSmbiosStructureSize (
- IN EFI_SMBIOS_TABLE_HEADER *Head,
- OUT UINT32 *Size,
- OUT UINT8 *NumberOfStrings
- )
-{
- UINT32 FullSize;
- UINT8 StrLen;
- INT8* CharInStr;
-
- if (Size == NULL || NumberOfStrings == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- FullSize = Head->Length;
- CharInStr = (INT8*)Head + Head->Length;
- *Size = FullSize;
- *NumberOfStrings = 0;
- StrLen = 0;
- //
- // look for the two consecutive zeros, check the string limit by the way.
- //
- while (*CharInStr != 0 || *(CharInStr+1) != 0) {
- if (*CharInStr == 0) {
- *Size += 1;
- CharInStr++;
- }
-
- for (StrLen = 0 ; StrLen < SMBIOS_STRING_MAX_LENGTH; StrLen++) {
- if (*(CharInStr+StrLen) == 0) {
- break;
- }
- }
-
- if (StrLen == SMBIOS_STRING_MAX_LENGTH) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // forward the pointer
- //
- CharInStr += StrLen;
- *Size += StrLen;
- *NumberOfStrings += 1;
-
- }
-
- //
- // count ending two zeros.
- //
- *Size += 2;
- return EFI_SUCCESS;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.c b/EdkCompatibilityPkg/Compatibility/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.c
deleted file mode 100644
index 699b120759..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/** @file
- PI SMM Status Code Protocol on Framework SMM Status Code Protocol Thunk.
-
- This thunk driver produces PI SMM Status Code Protocol and SMM Report Status Code Handler Protocol.
- And it registers a status code handler within itself to route status codes into Framework SMM Status
- Code Protocol.
-
- Note that Framework SMM Status Code Protocol and PI SMM Status Code Protocol have identical protocol
- GUID and interface structure, but they are in different handle databases.
-
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials are licensed and made available under
- the terms and conditions of the BSD License that 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.
-
-**/
-
-#include "PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.h"
-
-LIST_ENTRY mCallbackListHead = INITIALIZE_LIST_HEAD_VARIABLE (mCallbackListHead);
-
-//
-// Report operation nest status.
-// If it is set, then the report operation has nested.
-//
-UINT32 mStatusCodeNestStatus = 0;
-
-EFI_SMM_STATUS_CODE_PROTOCOL mSmmStatusCodeProtocol = {
- ReportDispatcher
-};
-
-EFI_SMM_RSC_HANDLER_PROTOCOL mSmmRscHandlerProtocol = {
- Register,
- Unregister
- };
-
-EFI_SMM_STATUS_CODE_PROTOCOL *mFrameworkSmmStatusCode;
-
-/**
- Register the callback function for ReportStatusCode() notification.
-
- When this function is called the function pointer is added to an internal list and any future calls to
- ReportStatusCode() will be forwarded to the Callback function.
-
- @param[in] Callback A pointer to a function of type EFI_PEI_RSC_HANDLER_CALLBACK that is called
- when a call to ReportStatusCode() occurs.
-
- @retval EFI_SUCCESS Function was successfully registered.
- @retval EFI_INVALID_PARAMETER The callback function was NULL.
- @retval EFI_OUT_OF_RESOURCES The internal buffer ran out of space. No more functions can be
- registered.
- @retval EFI_ALREADY_STARTED The function was already registered. It can't be registered again.
-
-**/
-EFI_STATUS
-EFIAPI
-Register (
- IN EFI_SMM_RSC_HANDLER_CALLBACK Callback
- )
-{
- LIST_ENTRY *Link;
- SMM_RSC_HANDLER_CALLBACK_ENTRY *CallbackEntry;
-
- if (Callback == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- for (Link = GetFirstNode (&mCallbackListHead); !IsNull (&mCallbackListHead, Link); Link = GetNextNode (&mCallbackListHead, Link)) {
- CallbackEntry = CR (Link, SMM_RSC_HANDLER_CALLBACK_ENTRY, Node, SMM_RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE);
- if (CallbackEntry->RscHandlerCallback == Callback) {
- //
- // If the function was already registered. It can't be registered again.
- //
- return EFI_ALREADY_STARTED;
- }
- }
-
- CallbackEntry = (SMM_RSC_HANDLER_CALLBACK_ENTRY *)AllocatePool (sizeof (SMM_RSC_HANDLER_CALLBACK_ENTRY));
- ASSERT (CallbackEntry != NULL);
-
- CallbackEntry->Signature = SMM_RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE;
- CallbackEntry->RscHandlerCallback = Callback;
-
- InsertTailList (&mCallbackListHead, &CallbackEntry->Node);
-
- return EFI_SUCCESS;
-}
-
-/**
- Remove a previously registered callback function from the notification list.
-
- ReportStatusCode() messages will no longer be forwarded to the Callback function.
-
- @param[in] Callback A pointer to a function of type EFI_PEI_RSC_HANDLER_CALLBACK that is to be
- unregistered.
-
- @retval EFI_SUCCESS The function was successfully unregistered.
- @retval EFI_INVALID_PARAMETER The callback function was NULL.
- @retval EFI_NOT_FOUND The callback function was not found to be unregistered.
-
-**/
-EFI_STATUS
-EFIAPI
-Unregister (
- IN EFI_SMM_RSC_HANDLER_CALLBACK Callback
- )
-{
- LIST_ENTRY *Link;
- SMM_RSC_HANDLER_CALLBACK_ENTRY *CallbackEntry;
-
- if (Callback == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- for (Link = GetFirstNode (&mCallbackListHead); !IsNull (&mCallbackListHead, Link); Link = GetNextNode (&mCallbackListHead, Link)) {
- CallbackEntry = CR (Link, SMM_RSC_HANDLER_CALLBACK_ENTRY, Node, SMM_RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE);
- if (CallbackEntry->RscHandlerCallback == Callback) {
- //
- // If the function is found in list, delete it and return.
- //
- RemoveEntryList (&CallbackEntry->Node);
- FreePool (CallbackEntry);
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-
-/**
- Provides an interface that a software module can call to report a status code.
-
- @param This EFI_SMM_STATUS_CODE_PROTOCOL instance.
- @param Type Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to
- classify the entity as well as an operation.
- @param Instance The enumeration of a hardware or software entity within
- the system. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS The function completed successfully
- @retval EFI_DEVICE_ERROR The function should not be completed due to a device error.
-
-**/
-EFI_STATUS
-EFIAPI
-ReportDispatcher (
- IN CONST EFI_SMM_STATUS_CODE_PROTOCOL *This,
- IN EFI_STATUS_CODE_TYPE Type,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN CONST EFI_GUID *CallerId OPTIONAL,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- LIST_ENTRY *Link;
- SMM_RSC_HANDLER_CALLBACK_ENTRY *CallbackEntry;
-
- //
- // Use atom operation to avoid the reentant of report.
- // If current status is not zero, then the function is reentrancy.
- //
- if (InterlockedCompareExchange32 (&mStatusCodeNestStatus, 0, 1) == 1) {
- return EFI_DEVICE_ERROR;
- }
-
- for (Link = GetFirstNode (&mCallbackListHead); !IsNull (&mCallbackListHead, Link); Link = GetNextNode (&mCallbackListHead, Link)) {
- CallbackEntry = CR (Link, SMM_RSC_HANDLER_CALLBACK_ENTRY, Node, SMM_RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE);
-
- CallbackEntry->RscHandlerCallback (
- Type,
- Value,
- Instance,
- (EFI_GUID*)CallerId,
- Data
- );
-
- }
-
- //
- // Restore the nest status of report
- //
- InterlockedCompareExchange32 (&mStatusCodeNestStatus, 1, 0);
-
- return EFI_SUCCESS;
-}
-
-/**
- This SMM Status Code Handler routes status codes to Framework SMM Status Code Protocol.
-
- @param CodeType Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to
- classify the entity as well as an operation.
- @param Instance The enumeration of a hardware or software entity within
- the system. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_DEVICE_ERROR The function should not be completed due to a device error.
-
-**/
-EFI_STATUS
-EFIAPI
-SmmStatusCodeHandler (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- return mFrameworkSmmStatusCode->ReportStatusCode (
- mFrameworkSmmStatusCode,
- CodeType,
- Value,
- Instance,
- CallerId,
- Data
- );
-}
-
-/**
- Entry point of PI SMM Status Code Protocol on Framework SMM Status Code Protocol thunk driver.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-SmmStatusCodeThunkMain (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
-
- //
- // Locate Framework SMM Status Code Protocol in UEFI handle database.
- //
- Status = SystemTable->BootServices->LocateProtocol (
- &gEfiSmmStatusCodeProtocolGuid,
- NULL,
- (VOID **)&mFrameworkSmmStatusCode
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Registers status code handler to route status codes into Framework SMM Status Code Protocol.
- //
- Register (SmmStatusCodeHandler);
-
- Handle = NULL;
-
- //
- // Install SmmRscHandler Protocol
- //
- Status = gSmst->SmmInstallProtocolInterface (
- &Handle,
- &gEfiSmmRscHandlerProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mSmmRscHandlerProtocol
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Install SmmStatusCode Protocol
- //
- Status = gSmst->SmmInstallProtocolInterface (
- &Handle,
- &gEfiSmmStatusCodeProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mSmmStatusCodeProtocol
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.h b/EdkCompatibilityPkg/Compatibility/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.h
deleted file mode 100644
index 97120056d0..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/** @file
- Include file for PI SMM Status Code Protocol on Framework SMM Status Code Protocol Thunk driver.
-
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials are licensed and made available under
- the terms and conditions of the BSD License that 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.
-
-**/
-
-#ifndef __PI_SMM_STATUS_CODE_ON_FRAMEWORK_SMM_STATUS_CODE_H__
-#define __PI_SMM_STATUS_CODE_ON_FRAMEWORK_SMM_STATUS_CODE_H__
-
-
-#include <Protocol/SmmReportStatusCodeHandler.h>
-#include <Protocol/SmmStatusCode.h>
-
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/SynchronizationLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/SmmServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#define SMM_RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE SIGNATURE_32 ('s', 'h', 'c', 'e')
-
-typedef struct {
- UINTN Signature;
- EFI_SMM_RSC_HANDLER_CALLBACK RscHandlerCallback;
- LIST_ENTRY Node;
-} SMM_RSC_HANDLER_CALLBACK_ENTRY;
-
-/**
- Register the callback function for ReportStatusCode() notification.
-
- When this function is called the function pointer is added to an internal list and any future calls to
- ReportStatusCode() will be forwarded to the Callback function.
-
- @param[in] Callback A pointer to a function of type EFI_PEI_RSC_HANDLER_CALLBACK that is called
- when a call to ReportStatusCode() occurs.
-
- @retval EFI_SUCCESS Function was successfully registered.
- @retval EFI_INVALID_PARAMETER The callback function was NULL.
- @retval EFI_OUT_OF_RESOURCES The internal buffer ran out of space. No more functions can be
- registered.
- @retval EFI_ALREADY_STARTED The function was already registered. It can't be registered again.
-
-**/
-EFI_STATUS
-EFIAPI
-Register (
- IN EFI_SMM_RSC_HANDLER_CALLBACK Callback
- );
-
-/**
- Remove a previously registered callback function from the notification list.
-
- ReportStatusCode() messages will no longer be forwarded to the Callback function.
-
- @param[in] Callback A pointer to a function of type EFI_PEI_RSC_HANDLER_CALLBACK that is to be
- unregistered.
-
- @retval EFI_SUCCESS The function was successfully unregistered.
- @retval EFI_INVALID_PARAMETER The callback function was NULL.
- @retval EFI_NOT_FOUND The callback function was not found to be unregistered.
-
-**/
-EFI_STATUS
-EFIAPI
-Unregister (
- IN EFI_SMM_RSC_HANDLER_CALLBACK Callback
- );
-
-/**
- Provides an interface that a software module can call to report a status code.
-
- @param This EFI_SMM_STATUS_CODE_PROTOCOL instance.
- @param Type Indicates the type of status code being reported.
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to
- classify the entity as well as an operation.
- @param Instance The enumeration of a hardware or software entity within
- the system. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS The function completed successfully
- @retval EFI_DEVICE_ERROR The function should not be completed due to a device error.
-
-**/
-EFI_STATUS
-EFIAPI
-ReportDispatcher (
- IN CONST EFI_SMM_STATUS_CODE_PROTOCOL *This,
- IN EFI_STATUS_CODE_TYPE Type,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN CONST EFI_GUID *CallerId OPTIONAL,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.inf b/EdkCompatibilityPkg/Compatibility/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.inf
deleted file mode 100644
index d1c72dc45c..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk/PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.inf
+++ /dev/null
@@ -1,52 +0,0 @@
-## @file
-# PI SMM Status Code Protocol on Framework SMM Status Code Protocol Thunk driver.
-#
-# Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk
- FILE_GUID = 14FF38A8-ACBA-4228-A7D7-A73260C7559B
- MODULE_TYPE = DXE_SMM_DRIVER
- PI_SPECIFICATION_VERSION = 0x0001000A
- VERSION_STRING = 1.0
- ENTRY_POINT = SmmStatusCodeThunkMain
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.c
- PiSmmStatusCodeOnFrameworkSmmStatusCodeThunk.h
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-[LibraryClasses]
- SmmServicesTableLib
- UefiDriverEntryPoint
- DebugLib
- BaseLib
- SynchronizationLib
- MemoryAllocationLib
-
-[Protocols]
- gEfiSmmRscHandlerProtocolGuid ## PRODUCES
- gEfiSmmStatusCodeProtocolGuid ## PRODUCES/CONSUMES
-
-[Depex]
- gEfiSmmStatusCodeProtocolGuid
diff --git a/EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.c b/EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.c
deleted file mode 100644
index 5303495c19..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/** @file
- Module produces EDK gEfiPrintProtocolGuid for backward compatibility support.
-
- EDK II retires old EDK Print Protocol and this module produces
- gEfiPrintProtocolGuid based on PrintLib:
- 1) If it links against BasePrintLib in MdePkg, it produces gEfiPrintProtocolGuid
- without any prerequisites.
- 2) If it links against DxePrintLibPrint2Protocol in MdeModulePkg, it produces
- gEfiPrintProtocolGuid on top of gEfiPrint2ProtocolGuid.
-
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
-
-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:
-
-**/
-
-#include <PiDxe.h>
-
-#include <Protocol/Print.h>
-#include <Library/PrintLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DebugLib.h>
-
-EFI_HANDLE mPrintThunkHandle = NULL;
-
-CONST EFI_PRINT_PROTOCOL mPrintProtocol = {
- UnicodeVSPrint,
-};
-
-
-/**
- The user Entry Point for Print thunk module.
-
- This is the entry point for Print thunk DXE Driver. It installs the Print Protocol on
- top of PrintLib class in MdePkg.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @retval Others Some error occurs when executing this entry point.
-
-**/
-EFI_STATUS
-EFIAPI
-InitPrintThunk (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mPrintThunkHandle,
- &gEfiPrintProtocolGuid, &mPrintProtocol,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.inf b/EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.inf
deleted file mode 100644
index 8d4a6f13a0..0000000000
--- a/EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.inf
+++ /dev/null
@@ -1,55 +0,0 @@
-## @file
-# Module produces EDK gEfiPrintProtocolGuid for backward compatibility support.
-#
-# EDK II retires old EDK Print Protocol and this module produces
-# gEfiPrintProtocolGuid based on PrintLib:
-# 1) If it links against BasePrintLib in MdePkg, it produces gEfiPrintProtocolGuid
-# without any prerequisites.
-# 2) If it links against DxePrintLibPrint2Protocol in MdeModulePkg, it produces
-# gEfiPrintProtocolGuid on top of gEfiPrint2ProtocolGuid.
-#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PrintThunk
- FILE_GUID = 3792FF94-8614-45ed-902B-1207BF1490A8
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
-
- ENTRY_POINT = InitPrintThunk
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- PrintThunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- DebugLib
- UefiBootServicesTableLib
- PrintLib
-
-[Protocols]
- gEfiPrintProtocolGuid ## PRODUCES
-
-[Depex]
- TRUE
diff --git a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2OnReadOnlyVariableThunk/ReadOnlyVariable2OnReadOnlyVariableThunk.c b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2OnReadOnlyVariableThunk/ReadOnlyVariable2OnReadOnlyVariableThunk.c
deleted file mode 100644
index 677c4888db..0000000000
--- a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2OnReadOnlyVariableThunk/ReadOnlyVariable2OnReadOnlyVariableThunk.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/** @file
-Module produce EFI_PEI_READ_ONLY_VARIABLE2_PPI on top of EFI_PEI_READ_ONLY_VARIABLE_PPI.
-UEFI PI Spec supersedes Intel's Framework Specs.
-EFI_PEI_READ_ONLY_VARIABLE_PPI defined in Intel Framework Pkg is replaced by EFI_PEI_READ_ONLY_VARIABLE2_PPI
-in MdePkg.
-This module produces EFI_PEI_READ_ONLY_VARIABLE2_PPI on top of EFI_PEI_READ_ONLY_VARIABLE_PPI.
-This module is used on platform when both of these two conditions are true:
-1) Framework module produces EFI_PEI_READ_ONLY_VARIABLE_PPI is present.
-2) The platform has PI modules that only consumes EFI_PEI_READ_ONLY_VARIABLE2_PPI.
-
-This module can't be used together with ReadOnlyVariableToReadOnlyVariable2Thunk module.
-
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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:
-
-**/
-
-#include <PiPei.h>
-#include <Ppi/ReadOnlyVariable2.h>
-#include <Ppi/ReadOnlyVariable.h>
-#include <Library/DebugLib.h>
-#include <Library/PeiServicesTablePointerLib.h>
-#include <Library/PeiServicesLib.h>
-
-/**
- Provide the read variable functionality of the variable services.
-
- @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.
- @param VariableName A pointer to a null-terminated string that is the variable's name.
- @param VariableGuid A pointer to an EFI_GUID that is the variable's GUID. The combination of
- VariableGuid and VariableName must be unique.
- @param Attributes If non-NULL, on return, points to the variable's attributes.
- @param DataSize On entry, points to the size in bytes of the Data buffer.
- On return, points to the size of the data returned in Data.
- @param Data Points to the buffer which will hold the returned variable value.
-
- @retval EFI_SUCCESS The interface could be successfully installed
- @retval EFI_NOT_FOUND The variable could not be discovered
- @retval EFI_BUFFER_TOO_SMALL The caller buffer is not large enough
-
-**/
-EFI_STATUS
-EFIAPI
-PeiGetVariable (
- IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
- IN CONST CHAR16 *VariableName,
- IN CONST EFI_GUID *VariableGuid,
- OUT UINT32 *Attributes,
- IN OUT UINTN *DataSize,
- OUT VOID *Data
- )
-{
- EFI_STATUS Status;
- EFI_PEI_READ_ONLY_VARIABLE_PPI *ReadOnlyVariable;
-
- Status = PeiServicesLocatePpi (
- &gEfiPeiReadOnlyVariablePpiGuid,
- 0,
- NULL,
- (VOID **)&ReadOnlyVariable
- );
- ASSERT_EFI_ERROR (Status);
-
- return ReadOnlyVariable->PeiGetVariable (
- (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),
- (CHAR16 *)VariableName,
- (EFI_GUID *)VariableGuid,
- Attributes,
- DataSize,
- Data
- );
-}
-
-/**
- Provide the get next variable functionality of the variable services.
-
- @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.
-
- @param VariableNameSize On entry, points to the size of the buffer pointed to by VariableName.
- @param VariableName On entry, a pointer to a null-terminated string that is the variable's name.
- On return, points to the next variable's null-terminated name string.
-
- @param VariableGuid On entry, a pointer to an EFI_GUID that is the variable's GUID.
- On return, a pointer to the next variable's GUID.
-
- @retval EFI_SUCCESS The interface could be successfully installed
- @retval EFI_NOT_FOUND The variable could not be discovered
-
-**/
-EFI_STATUS
-EFIAPI
-PeiGetNextVariableName (
- IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VariableGuid
- )
-{
- EFI_STATUS Status;
- EFI_PEI_READ_ONLY_VARIABLE_PPI *ReadOnlyVariable;
-
- Status = PeiServicesLocatePpi (
- &gEfiPeiReadOnlyVariablePpiGuid,
- 0,
- NULL,
- (VOID **)&ReadOnlyVariable
- );
- ASSERT_EFI_ERROR (Status);
-
- return ReadOnlyVariable->PeiGetNextVariableName (
- (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),
- VariableNameSize,
- VariableName,
- VariableGuid
- );
-}
-
-//
-// Module globals
-//
-EFI_PEI_READ_ONLY_VARIABLE2_PPI mVariablePpi = {
- PeiGetVariable,
- PeiGetNextVariableName
-};
-
-EFI_PEI_PPI_DESCRIPTOR mPpiListVariable = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiPeiReadOnlyVariable2PpiGuid,
- &mVariablePpi
-};
-
-/**
- User entry for this PEIM driver.
-
- @param FileHandle Handle of the file being invoked.
- @param PeiServices Describes the list of possible PEI Services.
-
- @retval EFI_SUCCESS ReadOnlyVariable2 PPI is successfully installed.
- @return Others ReadOnlyVariable2 PPI is not successfully installed.
-
-**/
-EFI_STATUS
-EFIAPI
-PeimInitializeReadOnlyVariable2 (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- //
- // This thunk module can only be used together with a PI PEI core, as we
- // assume PeiServices Pointer Table can be located in a standard way defined
- // in PI spec.
- //
- ASSERT ((*PeiServices)->Hdr.Revision >= 0x00010000);
-
- //
- // Developer should make sure ReadOnlyVariable2ToReadOnlyVariable module is not present. or else, the call chain will form a
- // infinite loop: ReadOnlyVariable2 -> ReadOnlyVariable -> ReadOnlyVariable2 -> .....
- //
- //
- // Publish the variable capability to other modules
- //
- return PeiServicesInstallPpi (&mPpiListVariable);
-}
diff --git a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2OnReadOnlyVariableThunk/ReadOnlyVariable2OnReadOnlyVariableThunk.inf b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2OnReadOnlyVariableThunk/ReadOnlyVariable2OnReadOnlyVariableThunk.inf
deleted file mode 100644
index 79e8d506cb..0000000000
--- a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2OnReadOnlyVariableThunk/ReadOnlyVariable2OnReadOnlyVariableThunk.inf
+++ /dev/null
@@ -1,61 +0,0 @@
-## @file
-# Module produce EFI_PEI_READ_ONLY_VARIABLE2_PPI on top of EFI_PEI_READ_ONLY_VARIABLE_PPI .
-#
-# UEFI PI Spec supersedes Intel's Framework Specs.
-# EFI_PEI_READ_ONLY_VARIABLE_PPI defined in Intel Framework Pkg is replaced by EFI_PEI_READ_ONLY_VARIABLE2_PPI
-# in MdePkg.
-# This module produces EFI_PEI_READ_ONLY_VARIABLE2_PPI on top of EFI_PEI_READ_ONLY_VARIABLE_PPI .
-# This module is used on platform when both of these two conditions are true:
-# 1) Framework module produces EFI_PEI_READ_ONLY_VARIABLE_PPI is present.
-# 2) The platform has PI modules that consumes EFI_PEI_READ_ONLY_VARIABLE2_PPI.
-#
-# This module can't be used together with ReadOnlyVariableOnReadOnlyVariable2Thunk module.
-#
-#
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ReadOnlyVariable2OnReadOnlyVariableThunk
- FILE_GUID = 950216A2-A621-479c-A13D-2990617BDFE7
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
-
- ENTRY_POINT = PeimInitializeReadOnlyVariable2
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- ReadOnlyVariable2OnReadOnlyVariableThunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
-
-[LibraryClasses]
- PeimEntryPoint
- PeiServicesLib
- PeiServicesTablePointerLib
- DebugLib
-
-[Ppis]
- gEfiPeiReadOnlyVariablePpiGuid # PPI ALWAYS_CONSUMED
- gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_PRODUCED
-
-[Depex]
- gEfiPeiReadOnlyVariablePpiGuid
diff --git a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableOnReadOnlyVariable2Thunk/ReadOnlyVariableOnReadOnlyVariable2Thunk.c b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableOnReadOnlyVariable2Thunk/ReadOnlyVariableOnReadOnlyVariable2Thunk.c
deleted file mode 100644
index 7e500fc56d..0000000000
--- a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableOnReadOnlyVariable2Thunk/ReadOnlyVariableOnReadOnlyVariable2Thunk.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/** @file
-Module produce EFI_PEI_READ_ONLY_VARIABLE_PPI on top of EFI_PEI_READ_ONLY_VARIABLE2_PPI.
-UEFI PI Spec supersedes Intel's Framework Specs.
-# EFI_PEI_READ_ONLY_VARIABLE_PPI defined in Intel Framework Pkg is replaced by EFI_PEI_READ_ONLY_VARIABLE2_PPI
-# in MdePkg.
-# This module produces EFI_PEI_READ_ONLY_VARIABLE_PPI on top of EFI_PEI_READ_ONLY_VARIABLE2_PPI.
-# This module is used on platform when both of these two conditions are true:
-# 1) Framework module consumes EFI_PEI_READ_ONLY_VARIABLE_PPI is present.
-# 2) The platform has a PI module that only produces EFI_PEI_READ_ONLY_VARIABLE2_PPI.
-
-This module can't be used together with ReadOnlyVariable2ToReadOnlyVariableThunk module.
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-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:
-
-**/
-
-#include <PiPei.h>
-#include <Ppi/ReadOnlyVariable.h>
-#include <Ppi/ReadOnlyVariable2.h>
-#include <Library/DebugLib.h>
-#include <Library/PeiServicesLib.h>
-
-/**
- Provide the read variable functionality of the variable services.
-
- @param[in] PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
- @param[in] VariableName A NULL-terminated Unicode string that is the name of the vendor's variable.
- @param[in] VendorGuid A unique identifier for the vendor.
- @param[out] Attributes This OPTIONAL parameter may be either NULL or
- a pointer to the location in which to return
- the attributes bitmask for the variable.
- @param[in, out] DataSize On input, the size in bytes of the return Data buffer.
- On output, the size of data returned in Data.
- @param[out] Data The buffer to return the contents of the variable.
-
- @retval EFI_SUCCESS The interface could be successfully installed
- @retval EFI_NOT_FOUND The variable could not be discovered
- @retval EFI_BUFFER_TOO_SMALL The caller buffer is not large enough
-
-**/
-EFI_STATUS
-EFIAPI
-PeiGetVariable (
- IN EFI_PEI_SERVICES **PeiServices,
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data
- )
-{
- EFI_STATUS Status;
- EFI_PEI_READ_ONLY_VARIABLE2_PPI *ReadOnlyVariable2;
-
- Status = (*PeiServices)->LocatePpi (
- (CONST EFI_PEI_SERVICES **)PeiServices,
- &gEfiPeiReadOnlyVariable2PpiGuid,
- 0,
- NULL,
- (VOID **)&ReadOnlyVariable2
- );
- ASSERT_EFI_ERROR (Status);
-
- return ReadOnlyVariable2->GetVariable (
- ReadOnlyVariable2,
- VariableName,
- VendorGuid,
- Attributes,
- DataSize,
- Data
- );
-}
-
-/**
- Provide the get next variable functionality of the variable services.
-
- @param[in] PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
- @param[in, out] VariableNameSize The size of the VariableName buffer.
- @param[in, out] VariableName On input, supplies the last VariableName that was
- returned by GetNextVariableName(). On output, returns the Null-terminated
- Unicode string of the current variable.
- @param[in, out] VendorGuid On input, supplies the last VendorGuid that was
- returned by GetNextVariableName(). On output, returns the VendorGuid
- of the current variable.
-
- @retval EFI_SUCCESS The interface could be successfully installed
- @retval EFI_NOT_FOUND The variable could not be discovered
-
-**/
-EFI_STATUS
-EFIAPI
-PeiGetNextVariableName (
- IN EFI_PEI_SERVICES **PeiServices,
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid
- )
-{
- EFI_STATUS Status;
- EFI_PEI_READ_ONLY_VARIABLE2_PPI *ReadOnlyVariable2;
-
- Status = (*PeiServices)->LocatePpi (
- (CONST EFI_PEI_SERVICES **)PeiServices,
- &gEfiPeiReadOnlyVariable2PpiGuid,
- 0,
- NULL,
- (VOID **)&ReadOnlyVariable2
- );
- ASSERT_EFI_ERROR (Status);
-
- return ReadOnlyVariable2->NextVariableName (
- ReadOnlyVariable2,
- VariableNameSize,
- VariableName,
- VendorGuid
- );
-}
-
-//
-// Module globals
-//
-EFI_PEI_READ_ONLY_VARIABLE_PPI mVariablePpi = {
- PeiGetVariable,
- PeiGetNextVariableName
-};
-
-EFI_PEI_PPI_DESCRIPTOR mPpiListVariable = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiPeiReadOnlyVariablePpiGuid,
- &mVariablePpi
-};
-
-/**
- Standard entry point of a PEIM.
-
- @param FileHandle Handle of the file being invoked.
- @param PeiServices General purpose services available to every PEIM.
-
- @retval EFI_SUCCESS If the gEfiPeiReadOnlyVariablePpiGuid interface could be successfully installed.
-
-**/
-EFI_STATUS
-EFIAPI
-PeimInitializeReadOnlyVariable (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- //
- //Developer should make sure ReadOnlyVariableToReadOnlyVariable2 module is not present. If so, the call chain will form a
- // infinite loop: ReadOnlyVariable -> ReadOnlyVariable2 -> ReadOnlyVariable -> ....
- //
- //
- // Publish the variable capability to other modules
- //
- return (*PeiServices)->InstallPpi (PeiServices, &mPpiListVariable);
-}
diff --git a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableOnReadOnlyVariable2Thunk/ReadOnlyVariableOnReadOnlyVariable2Thunk.inf b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableOnReadOnlyVariable2Thunk/ReadOnlyVariableOnReadOnlyVariable2Thunk.inf
deleted file mode 100644
index 1126d298e8..0000000000
--- a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableOnReadOnlyVariable2Thunk/ReadOnlyVariableOnReadOnlyVariable2Thunk.inf
+++ /dev/null
@@ -1,59 +0,0 @@
-## @file
-# Module produce EFI_PEI_READ_ONLY_VARIABLE_PPI on top of EFI_PEI_READ_ONLY_VARIABLE2_PPI.
-#
-# UEFI PI Spec supersedes Intel's Framework Specs.
-# EFI_PEI_READ_ONLY_VARIABLE_PPI defined in Intel Framework Pkg is replaced by EFI_PEI_READ_ONLY_VARIABLE2_PPI
-# in MdePkg.
-# This module produces EFI_PEI_READ_ONLY_VARIABLE_PPI on top of EFI_PEI_READ_ONLY_VARIABLE2_PPI.
-# This module is used on platform when both of these two conditions are true:
-# 1) Framework module consumes EFI_PEI_READ_ONLY_VARIABLE_PPI is present.
-# 2) The platform has a PI module that only produces EFI_PEI_READ_ONLY_VARIABLE2_PPI.
-# This module can't be used together with ReadOnlyVariable2OnReadOnlyVariableThunk module.
-#
-#
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = ReadOnlyVariableOnReadOnlyVariable2Thunk
- FILE_GUID = 0FDB764B-E669-4c69-83AC-5EDD99A2711E
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
-
- ENTRY_POINT = PeimInitializeReadOnlyVariable
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- ReadOnlyVariableOnReadOnlyVariable2Thunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
-
-[LibraryClasses]
- PeimEntryPoint
- DebugLib
- PeiServicesLib
-
-[Ppis]
- gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_CONSUMED
- gEfiPeiReadOnlyVariablePpiGuid # PPI ALWAYS_PRODUCED
-
-[Depex]
- gEfiPeiReadOnlyVariable2PpiGuid
diff --git a/EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.c b/EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.c
deleted file mode 100644
index 0275bd7550..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/** @file
- SMM Access2 Protocol on SMM Access Protocol Thunk driver.
-
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-
-#include "SmmAccess2OnSmmAccessThunk.h"
-
-EFI_SMM_ACCESS2_PROTOCOL gSmmAccess2 = {
- SmmAccess2Open,
- SmmAccess2Close,
- SmmAccess2Lock,
- SmmAccess2GetCapabilities,
- FALSE,
- FALSE
-};
-
-EFI_SMM_ACCESS_PROTOCOL *mSmmAccess;
-UINTN mSmramRegionNumber;
-
-/**
- Opens the SMRAM area to be accessible by a boot-service driver.
-
- This function "opens" SMRAM so that it is visible while not inside of SMM. The function should
- return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. The function
- should return EFI_DEVICE_ERROR if the SMRAM configuration is locked.
-
- @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.
-
- @retval EFI_SUCCESS The operation was successful.
- @retval EFI_UNSUPPORTED The system does not support opening and closing of SMRAM.
- @retval EFI_DEVICE_ERROR SMRAM cannot be opened, perhaps because it is locked.
-**/
-EFI_STATUS
-EFIAPI
-SmmAccess2Open (
- IN EFI_SMM_ACCESS2_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- UINTN DescriptorIndex;
-
- ///
- /// Open all SMRAM regions via SMM Access Protocol
- ///
-
- Status = EFI_SUCCESS;
- for (DescriptorIndex = 0; DescriptorIndex < mSmramRegionNumber && !EFI_ERROR (Status); DescriptorIndex++) {
- Status = mSmmAccess->Open (mSmmAccess, DescriptorIndex);
- }
- if (!EFI_ERROR (Status)) {
- gSmmAccess2.OpenState = TRUE;
- }
- return Status;
-}
-
-/**
- Inhibits access to the SMRAM.
-
- This function "closes" SMRAM so that it is not visible while outside of SMM. The function should
- return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM.
-
- @param [in] This The EFI_SMM_ACCESS2_PROTOCOL instance.
-
- @retval EFI_SUCCESS The operation was successful.
- @retval EFI_UNSUPPORTED The system does not support opening and closing of SMRAM.
- @retval EFI_DEVICE_ERROR SMRAM cannot be closed.
-**/
-EFI_STATUS
-EFIAPI
-SmmAccess2Close (
- IN EFI_SMM_ACCESS2_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- UINTN DescriptorIndex;
-
- ///
- /// Close all SMRAM regions via SMM Access Protocol
- ///
-
- Status = EFI_SUCCESS;
- for (DescriptorIndex = 0; DescriptorIndex < mSmramRegionNumber && !EFI_ERROR (Status); DescriptorIndex++) {
- Status = mSmmAccess->Close (mSmmAccess, DescriptorIndex);
- }
- if (!EFI_ERROR (Status)) {
- gSmmAccess2.OpenState = FALSE;
- }
- return Status;
-}
-
-/**
- Inhibits access to the SMRAM.
-
- This function prohibits access to the SMRAM region. This function is usually implemented such
- that it is a write-once operation.
-
- @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.
-
- @retval EFI_SUCCESS The device was successfully locked.
- @retval EFI_UNSUPPORTED The system does not support locking of SMRAM.
-**/
-EFI_STATUS
-EFIAPI
-SmmAccess2Lock (
- IN EFI_SMM_ACCESS2_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- UINTN DescriptorIndex;
-
- ///
- /// Lock all SMRAM regions via SMM Access Protocol
- ///
-
- Status = EFI_SUCCESS;
- for (DescriptorIndex = 0; DescriptorIndex < mSmramRegionNumber && !EFI_ERROR (Status); DescriptorIndex++) {
- Status = mSmmAccess->Lock (mSmmAccess, DescriptorIndex);
- }
- if (!EFI_ERROR (Status)) {
- gSmmAccess2.LockState = TRUE;
- }
- return Status;
-}
-
-/**
- Queries the memory controller for the possible regions that will support SMRAM.
-
- @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.
- @param[in, out] SmramMapSize A pointer to the size, in bytes, of the SmramMemoryMap buffer.
- @param[in, out] SmramMap A pointer to the buffer in which firmware places the current memory map.
-
- @retval EFI_SUCCESS The chipset supported the given resource.
- @retval EFI_BUFFER_TOO_SMALL The SmramMap parameter was too small. The current buffer size
- needed to hold the memory map is returned in SmramMapSize.
-**/
-EFI_STATUS
-EFIAPI
-SmmAccess2GetCapabilities (
- IN CONST EFI_SMM_ACCESS2_PROTOCOL *This,
- IN OUT UINTN *SmramMapSize,
- IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
- )
-{
- return mSmmAccess->GetCapabilities (mSmmAccess, SmramMapSize, SmramMap);
-}
-
-/**
- Entry Point for SMM Access2 On SMM Access Thunk driver.
-
- @param[in] ImageHandle Image handle of this driver.
- @param[in] SystemTable A Pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @retval other Some error occurred when executing this entry point.
-**/
-EFI_STATUS
-EFIAPI
-SmmAccess2ThunkMain (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- UINTN SmramMapSize;
-
- ///
- /// Locate SMM Access Protocol
- ///
- Status = gBS->LocateProtocol (&gEfiSmmAccessProtocolGuid, NULL, (VOID **)&mSmmAccess);
- ASSERT_EFI_ERROR (Status);
-
- ///
- /// Calculate number of SMRAM regions
- ///
- SmramMapSize = 0;
- Status = mSmmAccess->GetCapabilities (mSmmAccess, &SmramMapSize, NULL);
- ASSERT (Status == EFI_BUFFER_TOO_SMALL);
-
- mSmramRegionNumber = SmramMapSize/sizeof (EFI_SMRAM_DESCRIPTOR);
- ASSERT (mSmramRegionNumber > 0);
-
- ///
- /// Assume all SMRAM regions have consistent OPEN and LOCK states
- ///
- gSmmAccess2.OpenState = mSmmAccess->OpenState;
- gSmmAccess2.LockState = mSmmAccess->LockState;
-
- ///
- /// Publish PI SMM Access2 Protocol
- ///
- Status = gBS->InstallProtocolInterface (
- &ImageHandle,
- &gEfiSmmAccess2ProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &gSmmAccess2
- );
- return Status;
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.h b/EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.h
deleted file mode 100644
index 18f9c65ebe..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/** @file
- Include file for SMM Access2 Protocol on SMM Access Protocol Thunk driver.
-
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-
-#ifndef _SMM_ACCESS2_ON_SMM_ACCESS_THUNK_H_
-#define _SMM_ACCESS2_ON_SMM_ACCESS_THUNK_H_
-
-#include <PiDxe.h>
-#include <FrameworkSmm.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Protocol/SmmAccess2.h>
-#include <Protocol/SmmAccess.h>
-
-/**
- Opens the SMRAM area to be accessible by a boot-service driver.
-
- This function "opens" SMRAM so that it is visible while not inside of SMM. The function should
- return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. The function
- should return EFI_DEVICE_ERROR if the SMRAM configuration is locked.
-
- @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.
-
- @retval EFI_SUCCESS The operation was successful.
- @retval EFI_UNSUPPORTED The system does not support opening and closing of SMRAM.
- @retval EFI_DEVICE_ERROR SMRAM cannot be opened, perhaps because it is locked.
-**/
-EFI_STATUS
-EFIAPI
-SmmAccess2Open (
- IN EFI_SMM_ACCESS2_PROTOCOL *This
- );
-
-/**
- Inhibits access to the SMRAM.
-
- This function "closes" SMRAM so that it is not visible while outside of SMM. The function should
- return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM.
-
- @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.
-
- @retval EFI_SUCCESS The operation was successful.
- @retval EFI_UNSUPPORTED The system does not support opening and closing of SMRAM.
- @retval EFI_DEVICE_ERROR SMRAM cannot be closed.
-**/
-EFI_STATUS
-EFIAPI
-SmmAccess2Close (
- IN EFI_SMM_ACCESS2_PROTOCOL *This
- );
-
-/**
- Inhibits access to the SMRAM.
-
- This function prohibits access to the SMRAM region. This function is usually implemented such
- that it is a write-once operation.
-
- @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.
-
- @retval EFI_SUCCESS The device was successfully locked.
- @retval EFI_UNSUPPORTED The system does not support locking of SMRAM.
-**/
-EFI_STATUS
-EFIAPI
-SmmAccess2Lock (
- IN EFI_SMM_ACCESS2_PROTOCOL *This
- );
-
-/**
- Queries the memory controller for the possible regions that will support SMRAM.
-
- @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.
- @param[in, out] SmramMapSize A pointer to the size, in bytes, of the SmramMemoryMap buffer.
- @param[in, out] SmramMap A pointer to the buffer in which firmware places the current memory map.
-
- @retval EFI_SUCCESS The chipset supported the given resource.
- @retval EFI_BUFFER_TOO_SMALL The SmramMap parameter was too small. The current buffer size
- needed to hold the memory map is returned in SmramMapSize.
-**/
-EFI_STATUS
-EFIAPI
-SmmAccess2GetCapabilities (
- IN CONST EFI_SMM_ACCESS2_PROTOCOL *This,
- IN OUT UINTN *SmramMapSize,
- IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
- );
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.inf b/EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.inf
deleted file mode 100644
index 2d857e7835..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.inf
+++ /dev/null
@@ -1,50 +0,0 @@
-## @file
-# Component description file for SMM Access2 Protocol on SMM Access Protocol Thunk driver.
-#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SmmAccess2OnSmmAccessThunk
- FILE_GUID = 98BBCDA4-18B4-46d3-BD1F-6A3A52D44CF8
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = SmmAccess2ThunkMain
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- SmmAccess2OnSmmAccessThunk.c
- SmmAccess2OnSmmAccessThunk.h
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- DebugLib
-
-[Protocols]
- gEfiSmmAccessProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiSmmAccess2ProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-
-[Depex]
- gEfiSmmAccessProtocolGuid
-
diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/PageFaultHandler.c b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/PageFaultHandler.c
deleted file mode 100644
index 58e9548a53..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/PageFaultHandler.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/** @file
- Page fault handler that does nothing.
-
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-
-/**
- The dummy handler that does nothing.
-
- The function is only used by systems that don't use paging but need
- build pass.
-
-**/
-VOID
-PageFaultHandlerHook (
- VOID
- )
-{
-}
diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
deleted file mode 100644
index 5f220dd476..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
+++ /dev/null
@@ -1,1224 +0,0 @@
-/** @file
- SMM Base Helper SMM driver.
-
- This driver is the counterpart of the SMM Base On SMM Base2 Thunk driver. It
- provides helping services in SMM to the SMM Base On SMM Base2 Thunk driver.
-
- Caution: This module requires additional review when modified.
- This driver will have external input - communicate buffer in SMM mode.
- This external input must be validated carefully to avoid security issue like
- buffer overflow, integer overflow.
-
- SmmHandlerEntry() will receive untrusted input and do validation.
-
- Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-
-#include <PiSmm.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/SmmServicesTableLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PeCoffLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/CacheMaintenanceLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/SynchronizationLib.h>
-#include <Library/CpuLib.h>
-#include <Library/SmmMemLib.h>
-#include <Guid/SmmBaseThunkCommunication.h>
-#include <Protocol/SmmBaseHelperReady.h>
-#include <Protocol/SmmCpu.h>
-#include <Protocol/LoadedImage.h>
-#include <Protocol/SmmCpuSaveState.h>
-#include <Protocol/MpService.h>
-#include <Protocol/LoadPe32Image.h>
-#include <Protocol/SmmReadyToLock.h>
-
-/**
- Register SMM image to SMRAM profile.
-
- @param[in] FilePath File path of the image.
- @param[in] ImageBuffer Image base address.
- @param[in] NumberOfPage Number of page.
-
- @retval TRUE Register success.
- @retval FALSE Register fail.
-
-**/
-BOOLEAN
-RegisterSmramProfileImage (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN PHYSICAL_ADDRESS ImageBuffer,
- IN UINTN NumberOfPage
- );
-
-/**
- Unregister SMM image from SMRAM profile.
-
- @param[in] FilePath File path of the image.
- @param[in] ImageBuffer Image base address.
- @param[in] NumberOfPage Number of page.
-
- @retval TRUE Unregister success.
- @retval FALSE Unregister fail.
-
-**/
-BOOLEAN
-UnregisterSmramProfileImage (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN PHYSICAL_ADDRESS ImageBuffer,
- IN UINTN NumberOfPage
- );
-
-///
-/// Structure for tracking paired information of registered Framework SMI handler
-/// and correpsonding dispatch handle for SMI handler thunk.
-///
-typedef struct {
- LIST_ENTRY Link;
- EFI_HANDLE DispatchHandle;
- EFI_HANDLE SmmImageHandle;
- EFI_SMM_CALLBACK_ENTRY_POINT CallbackAddress;
- VOID *CommunicationBuffer;
- UINTN *SourceSize;
-} CALLBACK_INFO;
-
-typedef struct {
- ///
- /// PI SMM CPU Save State register index
- ///
- EFI_SMM_SAVE_STATE_REGISTER Register;
- ///
- /// Offset in Framework SMST
- ///
- UINTN Offset;
-} CPU_SAVE_STATE_CONVERSION;
-
-#define CPU_SAVE_STATE_GET_OFFSET(Field) (UINTN)(&(((EFI_SMM_CPU_SAVE_STATE *) 0)->Ia32SaveState.Field))
-
-
-EFI_HANDLE mDispatchHandle;
-EFI_SMM_CPU_PROTOCOL *mSmmCpu;
-EFI_PE32_IMAGE_PROTOCOL *mLoadPe32Image;
-EFI_GUID mEfiSmmCpuIoGuid = EFI_SMM_CPU_IO_GUID;
-EFI_SMM_BASE_HELPER_READY_PROTOCOL *mSmmBaseHelperReady;
-EFI_SMM_SYSTEM_TABLE *mFrameworkSmst;
-UINTN mNumberOfProcessors;
-BOOLEAN mLocked = FALSE;
-BOOLEAN mPageTableHookEnabled;
-BOOLEAN mHookInitialized;
-UINT64 *mCpuStatePageTable;
-SPIN_LOCK mPFLock;
-UINT64 mPhyMask;
-VOID *mOriginalHandler;
-EFI_SMM_CPU_SAVE_STATE *mShadowSaveState;
-
-LIST_ENTRY mCallbackInfoListHead = INITIALIZE_LIST_HEAD_VARIABLE (mCallbackInfoListHead);
-
-CPU_SAVE_STATE_CONVERSION mCpuSaveStateConvTable[] = {
- {EFI_SMM_SAVE_STATE_REGISTER_LDTBASE , CPU_SAVE_STATE_GET_OFFSET(LDTBase)},
- {EFI_SMM_SAVE_STATE_REGISTER_ES , CPU_SAVE_STATE_GET_OFFSET(ES)},
- {EFI_SMM_SAVE_STATE_REGISTER_CS , CPU_SAVE_STATE_GET_OFFSET(CS)},
- {EFI_SMM_SAVE_STATE_REGISTER_SS , CPU_SAVE_STATE_GET_OFFSET(SS)},
- {EFI_SMM_SAVE_STATE_REGISTER_DS , CPU_SAVE_STATE_GET_OFFSET(DS)},
- {EFI_SMM_SAVE_STATE_REGISTER_FS , CPU_SAVE_STATE_GET_OFFSET(FS)},
- {EFI_SMM_SAVE_STATE_REGISTER_GS , CPU_SAVE_STATE_GET_OFFSET(GS)},
- {EFI_SMM_SAVE_STATE_REGISTER_TR_SEL , CPU_SAVE_STATE_GET_OFFSET(TR)},
- {EFI_SMM_SAVE_STATE_REGISTER_DR7 , CPU_SAVE_STATE_GET_OFFSET(DR7)},
- {EFI_SMM_SAVE_STATE_REGISTER_DR6 , CPU_SAVE_STATE_GET_OFFSET(DR6)},
- {EFI_SMM_SAVE_STATE_REGISTER_RAX , CPU_SAVE_STATE_GET_OFFSET(EAX)},
- {EFI_SMM_SAVE_STATE_REGISTER_RBX , CPU_SAVE_STATE_GET_OFFSET(EBX)},
- {EFI_SMM_SAVE_STATE_REGISTER_RCX , CPU_SAVE_STATE_GET_OFFSET(ECX)},
- {EFI_SMM_SAVE_STATE_REGISTER_RDX , CPU_SAVE_STATE_GET_OFFSET(EDX)},
- {EFI_SMM_SAVE_STATE_REGISTER_RSP , CPU_SAVE_STATE_GET_OFFSET(ESP)},
- {EFI_SMM_SAVE_STATE_REGISTER_RBP , CPU_SAVE_STATE_GET_OFFSET(EBP)},
- {EFI_SMM_SAVE_STATE_REGISTER_RSI , CPU_SAVE_STATE_GET_OFFSET(ESI)},
- {EFI_SMM_SAVE_STATE_REGISTER_RDI , CPU_SAVE_STATE_GET_OFFSET(EDI)},
- {EFI_SMM_SAVE_STATE_REGISTER_RIP , CPU_SAVE_STATE_GET_OFFSET(EIP)},
- {EFI_SMM_SAVE_STATE_REGISTER_RFLAGS , CPU_SAVE_STATE_GET_OFFSET(EFLAGS)},
- {EFI_SMM_SAVE_STATE_REGISTER_CR0 , CPU_SAVE_STATE_GET_OFFSET(CR0)},
- {EFI_SMM_SAVE_STATE_REGISTER_CR3 , CPU_SAVE_STATE_GET_OFFSET(CR3)}
-};
-
-/**
- Page fault handler.
-
-**/
-VOID
-PageFaultHandlerHook (
- VOID
- );
-
-/**
- Read CpuSaveStates from PI for Framework use.
-
- The function reads PI style CpuSaveStates of CpuIndex-th CPU for Framework driver use. If
- ToRead is specified, the CpuSaveStates will be copied to ToRead, otherwise copied to
- mFrameworkSmst->CpuSaveState[CpuIndex].
-
- @param[in] CpuIndex The zero-based CPU index.
- @param[in, out] ToRead If not NULL, CpuSaveStates will be copied to it.
-
-**/
-VOID
-ReadCpuSaveState (
- IN UINTN CpuIndex,
- IN OUT EFI_SMM_CPU_SAVE_STATE *ToRead
- )
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_SMM_CPU_STATE *State;
- EFI_SMI_CPU_SAVE_STATE *SaveState;
-
- State = (EFI_SMM_CPU_STATE *)gSmst->CpuSaveState[CpuIndex];
- if (ToRead != NULL) {
- SaveState = &ToRead->Ia32SaveState;
- } else {
- SaveState = &mFrameworkSmst->CpuSaveState[CpuIndex].Ia32SaveState;
- }
-
- //
- // Note that SMBASE/SMMRevId/IORestart/AutoHALTRestart are in same location in IA32 and X64 CPU Save State Map.
- //
- SaveState->SMBASE = State->x86.SMBASE;
- SaveState->SMMRevId = State->x86.SMMRevId;
- SaveState->IORestart = State->x86.IORestart;
- SaveState->AutoHALTRestart = State->x86.AutoHALTRestart;
-
- for (Index = 0; Index < sizeof (mCpuSaveStateConvTable) / sizeof (CPU_SAVE_STATE_CONVERSION); Index++) {
- ///
- /// Try to use SMM CPU Protocol to access CPU save states if possible
- ///
- Status = mSmmCpu->ReadSaveState (
- mSmmCpu,
- (UINTN)sizeof (UINT32),
- mCpuSaveStateConvTable[Index].Register,
- CpuIndex,
- ((UINT8 *)SaveState) + mCpuSaveStateConvTable[Index].Offset
- );
- ASSERT_EFI_ERROR (Status);
- }
-}
-
-/**
- Write CpuSaveStates from Framework into PI.
-
- The function writes back CpuSaveStates of CpuIndex-th CPU from PI to Framework. If
- ToWrite is specified, it contains the CpuSaveStates to write from, otherwise CpuSaveStates
- to write from mFrameworkSmst->CpuSaveState[CpuIndex].
-
- @param[in] CpuIndex The zero-based CPU index.
- @param[in] ToWrite If not NULL, CpuSaveStates to write from.
-
-**/
-VOID
-WriteCpuSaveState (
- IN UINTN CpuIndex,
- IN EFI_SMM_CPU_SAVE_STATE *ToWrite
- )
-{
- UINTN Index;
- EFI_SMM_CPU_STATE *State;
- EFI_SMI_CPU_SAVE_STATE *SaveState;
-
- State = (EFI_SMM_CPU_STATE *)gSmst->CpuSaveState[CpuIndex];
-
- if (ToWrite != NULL) {
- SaveState = &ToWrite->Ia32SaveState;
- } else {
- SaveState = &mFrameworkSmst->CpuSaveState[CpuIndex].Ia32SaveState;
- }
-
- //
- // SMMRevId is read-only.
- // Note that SMBASE/IORestart/AutoHALTRestart are in same location in IA32 and X64 CPU Save State Map.
- //
- State->x86.SMBASE = SaveState->SMBASE;
- State->x86.IORestart = SaveState->IORestart;
- State->x86.AutoHALTRestart = SaveState->AutoHALTRestart;
-
- for (Index = 0; Index < sizeof (mCpuSaveStateConvTable) / sizeof (CPU_SAVE_STATE_CONVERSION); Index++) {
- mSmmCpu->WriteSaveState (
- mSmmCpu,
- (UINTN)sizeof (UINT32),
- mCpuSaveStateConvTable[Index].Register,
- CpuIndex,
- ((UINT8 *)SaveState) +
- mCpuSaveStateConvTable[Index].Offset
- );
- }
-}
-
-/**
- Read or write a page that contains CpuSaveStates. Read is from PI to Framework.
- Write is from Framework to PI.
-
- This function reads or writes a page that contains CpuSaveStates. The page contains Framework
- CpuSaveStates. On read, it reads PI style CpuSaveStates and fill the page up. On write, it
- writes back from the page content to PI CpuSaveStates struct.
- The first Framework CpuSaveStates (for CPU 0) is from mFrameworkSmst->CpuSaveState which is
- page aligned. Because Framework CpuSaveStates are continuous, we can know which CPUs' SaveStates
- are in the page start from PageAddress.
-
- @param[in] PageAddress The base address for a page.
- @param[in] IsRead TRUE for Read, FALSE for Write.
-
-**/
-VOID
-ReadWriteCpuStatePage (
- IN UINT64 PageAddress,
- IN BOOLEAN IsRead
- )
-{
- UINTN FirstSSIndex; // Index of first CpuSaveState in the page
- UINTN LastSSIndex; // Index of last CpuSaveState in the page
- BOOLEAN FirstSSAligned; // Whether first CpuSaveState is page-aligned
- BOOLEAN LastSSAligned; // Whether the end of last CpuSaveState is page-aligned
- UINTN ClippedSize;
- UINTN CpuIndex;
-
- FirstSSIndex = ((UINTN)PageAddress - (UINTN)mFrameworkSmst->CpuSaveState) / sizeof (EFI_SMM_CPU_SAVE_STATE);
- FirstSSAligned = TRUE;
- if (((UINTN)PageAddress - (UINTN)mFrameworkSmst->CpuSaveState) % sizeof (EFI_SMM_CPU_SAVE_STATE) != 0) {
- FirstSSIndex++;
- FirstSSAligned = FALSE;
- }
- LastSSIndex = ((UINTN)PageAddress + SIZE_4KB - (UINTN)mFrameworkSmst->CpuSaveState - 1) / sizeof (EFI_SMM_CPU_SAVE_STATE);
- LastSSAligned = TRUE;
- if (((UINTN)PageAddress + SIZE_4KB - (UINTN)mFrameworkSmst->CpuSaveState) % sizeof (EFI_SMM_CPU_SAVE_STATE) != 0) {
- LastSSIndex--;
- LastSSAligned = FALSE;
- }
- for (CpuIndex = FirstSSIndex; CpuIndex <= LastSSIndex && CpuIndex < mNumberOfProcessors; CpuIndex++) {
- if (IsRead) {
- ReadCpuSaveState (CpuIndex, NULL);
- } else {
- WriteCpuSaveState (CpuIndex, NULL);
- }
- }
- if (!FirstSSAligned) {
- ReadCpuSaveState (FirstSSIndex - 1, mShadowSaveState);
- ClippedSize = (UINTN)&mFrameworkSmst->CpuSaveState[FirstSSIndex] & (SIZE_4KB - 1);
- if (IsRead) {
- CopyMem ((VOID*)(UINTN)PageAddress, (VOID*)((UINTN)(mShadowSaveState + 1) - ClippedSize), ClippedSize);
- } else {
- CopyMem ((VOID*)((UINTN)(mShadowSaveState + 1) - ClippedSize), (VOID*)(UINTN)PageAddress, ClippedSize);
- WriteCpuSaveState (FirstSSIndex - 1, mShadowSaveState);
- }
- }
- if (!LastSSAligned && LastSSIndex + 1 < mNumberOfProcessors) {
- ReadCpuSaveState (LastSSIndex + 1, mShadowSaveState);
- ClippedSize = SIZE_4KB - ((UINTN)&mFrameworkSmst->CpuSaveState[LastSSIndex + 1] & (SIZE_4KB - 1));
- if (IsRead) {
- CopyMem (&mFrameworkSmst->CpuSaveState[LastSSIndex + 1], mShadowSaveState, ClippedSize);
- } else {
- CopyMem (mShadowSaveState, &mFrameworkSmst->CpuSaveState[LastSSIndex + 1], ClippedSize);
- WriteCpuSaveState (LastSSIndex + 1, mShadowSaveState);
- }
- }
-}
-
-/**
- The page fault handler that on-demand read PI CpuSaveStates for framework use. If the fault
- is not targeted to mFrameworkSmst->CpuSaveState range, the function will return FALSE to let
- PageFaultHandlerHook know it needs to pass the fault over to original page fault handler.
-
- @retval TRUE The page fault is correctly handled.
- @retval FALSE The page fault is not handled and is passed through to original handler.
-
-**/
-BOOLEAN
-PageFaultHandler (
- VOID
- )
-{
- BOOLEAN IsHandled;
- UINT64 PFAddress;
- UINTN NumCpuStatePages;
-
- ASSERT (mPageTableHookEnabled);
- AcquireSpinLock (&mPFLock);
-
- PFAddress = AsmReadCr2 ();
- NumCpuStatePages = EFI_SIZE_TO_PAGES (mNumberOfProcessors * sizeof (EFI_SMM_CPU_SAVE_STATE));
- IsHandled = FALSE;
- if (((UINTN)mFrameworkSmst->CpuSaveState & ~(SIZE_2MB-1)) == (PFAddress & ~(SIZE_2MB-1))) {
- if ((UINTN)mFrameworkSmst->CpuSaveState <= PFAddress &&
- PFAddress < (UINTN)mFrameworkSmst->CpuSaveState + EFI_PAGES_TO_SIZE (NumCpuStatePages)
- ) {
- mCpuStatePageTable[BitFieldRead64 (PFAddress, 12, 20)] |= BIT0 | BIT1; // present and rw
- CpuFlushTlb ();
- ReadWriteCpuStatePage (PFAddress & ~(SIZE_4KB-1), TRUE);
- IsHandled = TRUE;
- } else {
- ASSERT (FALSE);
- }
- }
-
- ReleaseSpinLock (&mPFLock);
- return IsHandled;
-}
-
-/**
- Write back the dirty Framework CpuSaveStates to PI.
-
- The function scans the page table for dirty pages in mFrameworkSmst->CpuSaveState
- to write back to PI CpuSaveStates. It is meant to be called on each SmmBaseHelper SMI
- callback after Framework handler is called.
-
-**/
-VOID
-WriteBackDirtyPages (
- VOID
- )
-{
- UINTN NumCpuStatePages;
- UINTN PTIndex;
- UINTN PTStartIndex;
- UINTN PTEndIndex;
-
- NumCpuStatePages = EFI_SIZE_TO_PAGES (mNumberOfProcessors * sizeof (EFI_SMM_CPU_SAVE_STATE));
- PTStartIndex = (UINTN)BitFieldRead64 ((UINT64) (UINTN) mFrameworkSmst->CpuSaveState, 12, 20);
- PTEndIndex = (UINTN)BitFieldRead64 ((UINT64) (UINTN) mFrameworkSmst->CpuSaveState + EFI_PAGES_TO_SIZE(NumCpuStatePages) - 1, 12, 20);
- for (PTIndex = PTStartIndex; PTIndex <= PTEndIndex; PTIndex++) {
- if ((mCpuStatePageTable[PTIndex] & (BIT0|BIT6)) == (BIT0|BIT6)) { // present and dirty?
- ReadWriteCpuStatePage (mCpuStatePageTable[PTIndex] & mPhyMask, FALSE);
- }
- }
-}
-
-/**
- Hook IDT with our page fault handler so that the on-demand paging works on page fault.
-
- The function hooks the IDT with PageFaultHandlerHook to get on-demand paging work for
- PI<->Framework CpuSaveStates marshalling. It also saves original handler for pass-through
- purpose.
-
-**/
-VOID
-HookPageFaultHandler (
- VOID
- )
-{
- IA32_DESCRIPTOR Idtr;
- IA32_IDT_GATE_DESCRIPTOR *IdtGateDesc;
- UINT32 OffsetUpper;
-
- InitializeSpinLock (&mPFLock);
-
- AsmReadIdtr (&Idtr);
- IdtGateDesc = (IA32_IDT_GATE_DESCRIPTOR *) Idtr.Base;
- OffsetUpper = *(UINT32*)((UINT64*)IdtGateDesc + 1);
- mOriginalHandler = (VOID *)(UINTN)(LShiftU64 (OffsetUpper, 32) + IdtGateDesc[14].Bits.OffsetLow + (IdtGateDesc[14].Bits.OffsetHigh << 16));
- IdtGateDesc[14].Bits.OffsetLow = (UINT32)((UINTN)PageFaultHandlerHook & ((1 << 16) - 1));
- IdtGateDesc[14].Bits.OffsetHigh = (UINT32)(((UINTN)PageFaultHandlerHook >> 16) & ((1 << 16) - 1));
-}
-
-/**
- Initialize page table for pages contain HookData.
-
- The function initialize PDE for 2MB range that contains HookData. If the related PDE points
- to a 2MB page, a page table will be allocated and initialized for 4KB pages. Otherwise we juse
- use the original page table.
-
- @param[in] HookData Based on which to initialize page table.
-
- @return The pointer to a Page Table that points to 4KB pages which contain HookData.
-**/
-UINT64 *
-InitCpuStatePageTable (
- IN VOID *HookData
- )
-{
- UINTN Index;
- UINT64 *PageTable;
- UINT64 *Pdpte;
- UINT64 HookAddress;
- UINT64 Pde;
- UINT64 Address;
-
- //
- // Initialize physical address mask
- // NOTE: Physical memory above virtual address limit is not supported !!!
- //
- AsmCpuid (0x80000008, (UINT32*)&Index, NULL, NULL, NULL);
- mPhyMask = LShiftU64 (1, (UINT8)Index) - 1;
- mPhyMask &= (1ull << 48) - EFI_PAGE_SIZE;
-
- HookAddress = (UINT64)(UINTN)HookData;
- PageTable = (UINT64 *)(UINTN)(AsmReadCr3 () & mPhyMask);
- PageTable = (UINT64 *)(UINTN)(PageTable[BitFieldRead64 (HookAddress, 39, 47)] & mPhyMask);
- PageTable = (UINT64 *)(UINTN)(PageTable[BitFieldRead64 (HookAddress, 30, 38)] & mPhyMask);
-
- Pdpte = (UINT64 *)(UINTN)PageTable;
- Pde = Pdpte[BitFieldRead64 (HookAddress, 21, 29)];
- ASSERT ((Pde & BIT0) != 0); // Present and 2M Page
-
- if ((Pde & BIT7) == 0) { // 4KB Page Directory
- PageTable = (UINT64 *)(UINTN)(Pde & mPhyMask);
- } else {
- ASSERT ((Pde & mPhyMask) == (HookAddress & ~(SIZE_2MB-1))); // 2MB Page Point to HookAddress
- PageTable = AllocatePages (1);
- ASSERT (PageTable != NULL);
- Address = HookAddress & ~(SIZE_2MB-1);
- for (Index = 0; Index < 512; Index++) {
- PageTable[Index] = Address | BIT0 | BIT1; // Present and RW
- Address += SIZE_4KB;
- }
- Pdpte[BitFieldRead64 (HookAddress, 21, 29)] = (UINT64)(UINTN)PageTable | BIT0 | BIT1; // Present and RW
- }
- return PageTable;
-}
-
-/**
- Mark all the CpuSaveStates as not present.
-
- The function marks all CpuSaveStates memory range as not present so that page fault can be triggered
- on CpuSaveStates access. It is meant to be called on each SmmBaseHelper SMI callback before Framework
- handler is called.
-
- @param[in] CpuSaveState The base of CpuSaveStates.
-
-**/
-VOID
-HookCpuStateMemory (
- IN EFI_SMM_CPU_SAVE_STATE *CpuSaveState
- )
-{
- UINT64 Index;
- UINT64 PTStartIndex;
- UINT64 PTEndIndex;
-
- PTStartIndex = BitFieldRead64 ((UINTN)CpuSaveState, 12, 20);
- PTEndIndex = BitFieldRead64 ((UINTN)CpuSaveState + mNumberOfProcessors * sizeof (EFI_SMM_CPU_SAVE_STATE) - 1, 12, 20);
- for (Index = PTStartIndex; Index <= PTEndIndex; Index++) {
- mCpuStatePageTable[Index] &= ~(BIT0|BIT5|BIT6); // not present nor accessed nor dirty
- }
-}
-
-/**
- Framework SMST SmmInstallConfigurationTable() Thunk.
-
- This thunk calls the PI SMM SmmInstallConfigurationTable() and then update the configuration
- table related fields in the Framework SMST because the PI SMM SmmInstallConfigurationTable()
- function may modify these fields.
-
- @param[in] SystemTable A pointer to the SMM System Table.
- @param[in] Guid A pointer to the GUID for the entry to add, update, or remove.
- @param[in] Table A pointer to the buffer of the table to add.
- @param[in] TableSize The size of the table to install.
-
- @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
- @retval EFI_INVALID_PARAMETER Guid is not valid.
- @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.
- @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
-**/
-EFI_STATUS
-EFIAPI
-SmmInstallConfigurationTable (
- IN EFI_SMM_SYSTEM_TABLE *SystemTable,
- IN EFI_GUID *Guid,
- IN VOID *Table,
- IN UINTN TableSize
- )
-{
- EFI_STATUS Status;
-
- Status = gSmst->SmmInstallConfigurationTable (gSmst, Guid, Table, TableSize);
- if (!EFI_ERROR (Status)) {
- mFrameworkSmst->NumberOfTableEntries = gSmst->NumberOfTableEntries;
- mFrameworkSmst->SmmConfigurationTable = gSmst->SmmConfigurationTable;
- }
- return Status;
-}
-
-/**
- Initialize all the stuff needed for on-demand paging hooks for PI<->Framework
- CpuSaveStates marshalling.
-
- @param[in] FrameworkSmst Framework SMM system table pointer.
-
-**/
-VOID
-InitHook (
- IN EFI_SMM_SYSTEM_TABLE *FrameworkSmst
- )
-{
- UINTN NumCpuStatePages;
- UINTN CpuStatePage;
- UINTN Bottom2MPage;
- UINTN Top2MPage;
-
- mPageTableHookEnabled = FALSE;
- NumCpuStatePages = EFI_SIZE_TO_PAGES (mNumberOfProcessors * sizeof (EFI_SMM_CPU_SAVE_STATE));
- //
- // Only hook page table for X64 image and less than 2MB needed to hold all CPU Save States
- //
- if (EFI_IMAGE_MACHINE_TYPE_SUPPORTED(EFI_IMAGE_MACHINE_X64) && NumCpuStatePages <= EFI_SIZE_TO_PAGES (SIZE_2MB)) {
- //
- // Allocate double page size to make sure all CPU Save States are in one 2MB page.
- //
- CpuStatePage = (UINTN)AllocatePages (NumCpuStatePages * 2);
- ASSERT (CpuStatePage != 0);
- Bottom2MPage = CpuStatePage & ~(SIZE_2MB-1);
- Top2MPage = (CpuStatePage + EFI_PAGES_TO_SIZE (NumCpuStatePages * 2) - 1) & ~(SIZE_2MB-1);
- if (Bottom2MPage == Top2MPage ||
- CpuStatePage + EFI_PAGES_TO_SIZE (NumCpuStatePages * 2) - Top2MPage >= EFI_PAGES_TO_SIZE (NumCpuStatePages)
- ) {
- //
- // If the allocated 4KB pages are within the same 2MB page or higher portion is larger, use higher portion pages.
- //
- FrameworkSmst->CpuSaveState = (EFI_SMM_CPU_SAVE_STATE *)(CpuStatePage + EFI_PAGES_TO_SIZE (NumCpuStatePages));
- FreePages ((VOID*)CpuStatePage, NumCpuStatePages);
- } else {
- FrameworkSmst->CpuSaveState = (EFI_SMM_CPU_SAVE_STATE *)CpuStatePage;
- FreePages ((VOID*)(CpuStatePage + EFI_PAGES_TO_SIZE (NumCpuStatePages)), NumCpuStatePages);
- }
- //
- // Add temporary working buffer for hooking
- //
- mShadowSaveState = (EFI_SMM_CPU_SAVE_STATE*) AllocatePool (sizeof (EFI_SMM_CPU_SAVE_STATE));
- ASSERT (mShadowSaveState != NULL);
- //
- // Allocate and initialize 4KB Page Table for hooking CpuSaveState.
- // Replace the original 2MB PDE with new 4KB page table.
- //
- mCpuStatePageTable = InitCpuStatePageTable (FrameworkSmst->CpuSaveState);
- //
- // Mark PTE for CpuSaveState as non-exist.
- //
- HookCpuStateMemory (FrameworkSmst->CpuSaveState);
- HookPageFaultHandler ();
- CpuFlushTlb ();
- mPageTableHookEnabled = TRUE;
- }
- mHookInitialized = TRUE;
-}
-
-/**
- Construct a Framework SMST based on the PI SMM SMST.
-
- @return Pointer to the constructed Framework SMST.
-**/
-EFI_SMM_SYSTEM_TABLE *
-ConstructFrameworkSmst (
- VOID
- )
-{
- EFI_SMM_SYSTEM_TABLE *FrameworkSmst;
-
- FrameworkSmst = (EFI_SMM_SYSTEM_TABLE *)AllocatePool (sizeof (EFI_SMM_SYSTEM_TABLE));
- ASSERT (FrameworkSmst != NULL);
-
- ///
- /// Copy same things from PI SMST to Framework SMST
- ///
- CopyMem (FrameworkSmst, gSmst, (UINTN)(&((EFI_SMM_SYSTEM_TABLE *)0)->SmmIo));
- CopyMem (
- &FrameworkSmst->SmmIo,
- &gSmst->SmmIo,
- sizeof (EFI_SMM_SYSTEM_TABLE) - (UINTN)(&((EFI_SMM_SYSTEM_TABLE *)0)->SmmIo)
- );
-
- ///
- /// Update Framework SMST
- ///
- FrameworkSmst->Hdr.Revision = EFI_SMM_SYSTEM_TABLE_REVISION;
- CopyGuid (&FrameworkSmst->EfiSmmCpuIoGuid, &mEfiSmmCpuIoGuid);
-
- mHookInitialized = FALSE;
- FrameworkSmst->CpuSaveState = (EFI_SMM_CPU_SAVE_STATE *)AllocateZeroPool (mNumberOfProcessors * sizeof (EFI_SMM_CPU_SAVE_STATE));
- ASSERT (FrameworkSmst->CpuSaveState != NULL);
-
- ///
- /// Do not support floating point state now
- ///
- FrameworkSmst->CpuOptionalFloatingPointState = NULL;
-
- FrameworkSmst->SmmInstallConfigurationTable = SmmInstallConfigurationTable;
-
- return FrameworkSmst;
-}
-
-/**
- Load a given Framework SMM driver into SMRAM and invoke its entry point.
-
- @param[in] ParentImageHandle Parent Image Handle.
- @param[in] FilePath Location of the image to be installed as the handler.
- @param[in] SourceBuffer Optional source buffer in case the image file
- is in memory.
- @param[in] SourceSize Size of the source image file, if in memory.
- @param[out] ImageHandle The handle that the base driver uses to decode
- the handler. Unique among SMM handlers only,
- not unique across DXE/EFI.
-
- @retval EFI_SUCCESS The operation was successful.
- @retval EFI_OUT_OF_RESOURCES There were no additional SMRAM resources to load the handler
- @retval EFI_UNSUPPORTED Can not find its copy in normal memory.
- @retval EFI_INVALID_PARAMETER The handlers was not the correct image type
-**/
-EFI_STATUS
-LoadImage (
- IN EFI_HANDLE ParentImageHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN VOID *SourceBuffer,
- IN UINTN SourceSize,
- OUT EFI_HANDLE *ImageHandle
- )
-{
- EFI_STATUS Status;
- UINTN PageCount;
- UINTN OrgPageCount;
- EFI_PHYSICAL_ADDRESS DstBuffer;
-
- if (FilePath == NULL || ImageHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- PageCount = 1;
- do {
- OrgPageCount = PageCount;
- DstBuffer = (UINTN)-1;
- Status = gSmst->SmmAllocatePages (
- AllocateMaxAddress,
- EfiRuntimeServicesCode,
- PageCount,
- &DstBuffer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = mLoadPe32Image->LoadPeImage (
- mLoadPe32Image,
- ParentImageHandle,
- FilePath,
- SourceBuffer,
- SourceSize,
- DstBuffer,
- &PageCount,
- ImageHandle,
- NULL,
- EFI_LOAD_PE_IMAGE_ATTRIBUTE_NONE
- );
- if (EFI_ERROR (Status)) {
- FreePages ((VOID *)(UINTN)DstBuffer, OrgPageCount);
- }
- } while (Status == EFI_BUFFER_TOO_SMALL);
-
- if (!EFI_ERROR (Status)) {
- ///
- /// Update MP state in Framework SMST before transferring control to Framework SMM driver entry point
- ///
- mFrameworkSmst->SmmStartupThisAp = gSmst->SmmStartupThisAp;
- mFrameworkSmst->NumberOfCpus = mNumberOfProcessors;
- mFrameworkSmst->CurrentlyExecutingCpu = gSmst->CurrentlyExecutingCpu;
-
- RegisterSmramProfileImage (FilePath, DstBuffer, PageCount);
- Status = gBS->StartImage (*ImageHandle, NULL, NULL);
- if (EFI_ERROR (Status)) {
- UnregisterSmramProfileImage (FilePath, DstBuffer, PageCount);
- mLoadPe32Image->UnLoadPeImage (mLoadPe32Image, *ImageHandle);
- *ImageHandle = NULL;
- FreePages ((VOID *)(UINTN)DstBuffer, PageCount);
- }
- }
-
- return Status;
-}
-
-/**
- Thunk service of EFI_SMM_BASE_PROTOCOL.Register().
-
- @param[in, out] FunctionData Pointer to SMMBASE_FUNCTION_DATA.
-**/
-VOID
-Register (
- IN OUT SMMBASE_FUNCTION_DATA *FunctionData
- )
-{
- EFI_STATUS Status;
-
- if (mLocked || FunctionData->Args.Register.LegacyIA32Binary) {
- Status = EFI_UNSUPPORTED;
- } else {
- Status = LoadImage (
- FunctionData->SmmBaseImageHandle,
- FunctionData->Args.Register.FilePath,
- FunctionData->Args.Register.SourceBuffer,
- FunctionData->Args.Register.SourceSize,
- FunctionData->Args.Register.ImageHandle
- );
- }
- FunctionData->Status = Status;
-}
-
-/**
- Thunk service of EFI_SMM_BASE_PROTOCOL.UnRegister().
-
- @param[in, out] FunctionData Pointer to SMMBASE_FUNCTION_DATA.
-**/
-VOID
-UnRegister (
- IN OUT SMMBASE_FUNCTION_DATA *FunctionData
- )
-{
- ///
- /// Unregister not supported now
- ///
- FunctionData->Status = EFI_UNSUPPORTED;
-}
-
-/**
- Search for Framework SMI handler information according to specific PI SMM dispatch handle.
-
- @param[in] DispatchHandle The unique handle assigned by SmiHandlerRegister().
-
- @return Pointer to CALLBACK_INFO. If NULL, no callback info record is found.
-**/
-CALLBACK_INFO *
-GetCallbackInfo (
- IN EFI_HANDLE DispatchHandle
- )
-{
- LIST_ENTRY *Node;
-
- Node = GetFirstNode (&mCallbackInfoListHead);
- while (!IsNull (&mCallbackInfoListHead, Node)) {
- if (((CALLBACK_INFO *)Node)->DispatchHandle == DispatchHandle) {
- return (CALLBACK_INFO *)Node;
- }
- Node = GetNextNode (&mCallbackInfoListHead, Node);
- }
- return NULL;
-}
-
-/**
- Callback thunk for Framework SMI handler.
-
- This thunk functions calls the Framework SMI handler and converts the return value
- defined from Framework SMI handlers to a correpsonding return value defined by PI SMM.
-
- @param[in] DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
- @param[in] Context Points to an optional handler context which was specified when the
- handler was registered.
- @param[in, out] CommBuffer A pointer to a collection of data in memory that will
- be conveyed from a non-SMM environment into an SMM environment.
- @param[in, out] CommBufferSize The size of the CommBuffer.
-
- @retval EFI_SUCCESS The interrupt was handled and quiesced. No other handlers
- should still be called.
- @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quiesced but other handlers should
- still be called.
- @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pending and other handlers should still
- be called.
- @retval EFI_INTERRUPT_PENDING The interrupt could not be quiesced.
-**/
-EFI_STATUS
-EFIAPI
-CallbackThunk (
- IN EFI_HANDLE DispatchHandle,
- IN CONST VOID *Context OPTIONAL,
- IN OUT VOID *CommBuffer OPTIONAL,
- IN OUT UINTN *CommBufferSize OPTIONAL
- )
-{
- EFI_STATUS Status;
- CALLBACK_INFO *CallbackInfo;
- UINTN CpuIndex;
-
- ///
- /// Before transferring the control into the Framework SMI handler, update CPU Save States
- /// and MP states in the Framework SMST.
- ///
-
- if (!mHookInitialized) {
- InitHook (mFrameworkSmst);
- }
- if (mPageTableHookEnabled) {
- HookCpuStateMemory (mFrameworkSmst->CpuSaveState);
- CpuFlushTlb ();
- } else {
- for (CpuIndex = 0; CpuIndex < mNumberOfProcessors; CpuIndex++) {
- ReadCpuSaveState (CpuIndex, NULL);
- }
- }
-
- mFrameworkSmst->SmmStartupThisAp = gSmst->SmmStartupThisAp;
- mFrameworkSmst->NumberOfCpus = mNumberOfProcessors;
- mFrameworkSmst->CurrentlyExecutingCpu = gSmst->CurrentlyExecutingCpu;
-
- ///
- /// Search for Framework SMI handler information
- ///
- CallbackInfo = GetCallbackInfo (DispatchHandle);
- ASSERT (CallbackInfo != NULL);
-
- ///
- /// Thunk into original Framwork SMI handler
- ///
- Status = (CallbackInfo->CallbackAddress) (
- CallbackInfo->SmmImageHandle,
- CallbackInfo->CommunicationBuffer,
- CallbackInfo->SourceSize
- );
- ///
- /// Save CPU Save States in case any of them was modified
- ///
- if (mPageTableHookEnabled) {
- WriteBackDirtyPages ();
- } else {
- for (CpuIndex = 0; CpuIndex < mNumberOfProcessors; CpuIndex++) {
- WriteCpuSaveState (CpuIndex, NULL);
- }
- }
-
- ///
- /// Conversion of returned status code
- ///
- switch (Status) {
- case EFI_HANDLER_SUCCESS:
- Status = EFI_WARN_INTERRUPT_SOURCE_QUIESCED;
- break;
- case EFI_HANDLER_CRITICAL_EXIT:
- case EFI_HANDLER_SOURCE_QUIESCED:
- Status = EFI_SUCCESS;
- break;
- case EFI_HANDLER_SOURCE_PENDING:
- Status = EFI_WARN_INTERRUPT_SOURCE_PENDING;
- break;
- }
- return Status;
-}
-
-/**
- Thunk service of EFI_SMM_BASE_PROTOCOL.RegisterCallback().
-
- @param[in, out] FunctionData Pointer to SMMBASE_FUNCTION_DATA.
-**/
-VOID
-RegisterCallback (
- IN OUT SMMBASE_FUNCTION_DATA *FunctionData
- )
-{
- CALLBACK_INFO *Buffer;
-
- if (mLocked) {
- FunctionData->Status = EFI_UNSUPPORTED;
- return;
- }
-
- ///
- /// Note that MakeLast and FloatingPointSave options are not supported in PI SMM
- ///
-
- ///
- /// Allocate buffer for callback thunk information
- ///
- Buffer = (CALLBACK_INFO *)AllocateZeroPool (sizeof (CALLBACK_INFO));
- if (Buffer == NULL) {
- FunctionData->Status = EFI_OUT_OF_RESOURCES;
- return;
- }
-
- ///
- /// Fill SmmImageHandle and CallbackAddress into the thunk
- ///
- Buffer->SmmImageHandle = FunctionData->Args.RegisterCallback.SmmImageHandle;
- Buffer->CallbackAddress = FunctionData->Args.RegisterCallback.CallbackAddress;
-
- ///
- /// Register the thunk code as a root SMI handler
- ///
- FunctionData->Status = gSmst->SmiHandlerRegister (
- CallbackThunk,
- NULL,
- &Buffer->DispatchHandle
- );
- if (EFI_ERROR (FunctionData->Status)) {
- FreePool (Buffer);
- return;
- }
-
- ///
- /// Save this callback info
- ///
- InsertTailList (&mCallbackInfoListHead, &Buffer->Link);
-}
-
-
-/**
- Thunk service of EFI_SMM_BASE_PROTOCOL.SmmAllocatePool().
-
- @param[in, out] FunctionData Pointer to SMMBASE_FUNCTION_DATA.
-**/
-VOID
-HelperAllocatePool (
- IN OUT SMMBASE_FUNCTION_DATA *FunctionData
- )
-{
- if (mLocked) {
- FunctionData->Status = EFI_UNSUPPORTED;
- } else {
- FunctionData->Status = gSmst->SmmAllocatePool (
- FunctionData->Args.AllocatePool.PoolType,
- FunctionData->Args.AllocatePool.Size,
- FunctionData->Args.AllocatePool.Buffer
- );
- }
-}
-
-/**
- Thunk service of EFI_SMM_BASE_PROTOCOL.SmmFreePool().
-
- @param[in, out] FunctionData Pointer to SMMBASE_FUNCTION_DATA.
-**/
-VOID
-HelperFreePool (
- IN OUT SMMBASE_FUNCTION_DATA *FunctionData
- )
-{
- if (mLocked) {
- FunctionData->Status = EFI_UNSUPPORTED;
- } else {
- FreePool (FunctionData->Args.FreePool.Buffer);
- FunctionData->Status = EFI_SUCCESS;
- }
-}
-
-/**
- Thunk service of EFI_SMM_BASE_PROTOCOL.Communicate().
-
- @param[in, out] FunctionData Pointer to SMMBASE_FUNCTION_DATA.
-**/
-VOID
-HelperCommunicate (
- IN OUT SMMBASE_FUNCTION_DATA *FunctionData
- )
-{
- LIST_ENTRY *Node;
- CALLBACK_INFO *CallbackInfo;
-
- if (FunctionData->Args.Communicate.CommunicationBuffer == NULL) {
- FunctionData->Status = EFI_INVALID_PARAMETER;
- return;
- }
-
- Node = GetFirstNode (&mCallbackInfoListHead);
- while (!IsNull (&mCallbackInfoListHead, Node)) {
- CallbackInfo = (CALLBACK_INFO *)Node;
-
- if (FunctionData->Args.Communicate.ImageHandle == CallbackInfo->SmmImageHandle) {
- CallbackInfo->CommunicationBuffer = FunctionData->Args.Communicate.CommunicationBuffer;
- CallbackInfo->SourceSize = FunctionData->Args.Communicate.SourceSize;
-
- ///
- /// The message was successfully posted.
- ///
- FunctionData->Status = EFI_SUCCESS;
- return;
- }
- Node = GetNextNode (&mCallbackInfoListHead, Node);
- }
-
- FunctionData->Status = EFI_INVALID_PARAMETER;
-}
-
-/**
- Communication service SMI Handler entry.
-
- This SMI handler provides services for the SMM Base Thunk driver.
-
- Caution: This function may receive untrusted input during runtime.
- The communicate buffer is external input, so this function will do operations only if the communicate
- buffer is outside of SMRAM so that returning the status code in the buffer won't overwrite anywhere in SMRAM.
-
- @param[in] DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
- @param[in] RegisterContext Points to an optional handler context which was specified when the
- handler was registered.
- @param[in, out] CommBuffer A pointer to a collection of data in memory that will
- be conveyed from a non-SMM environment into an SMM environment.
- @param[in, out] CommBufferSize The size of the CommBuffer.
-
- @retval EFI_SUCCESS The interrupt was handled and quiesced. No other handlers
- should still be called.
- @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quiesced but other handlers should
- still be called.
- @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pending and other handlers should still
- be called.
- @retval EFI_INTERRUPT_PENDING The interrupt could not be quiesced.
-**/
-EFI_STATUS
-EFIAPI
-SmmHandlerEntry (
- IN EFI_HANDLE DispatchHandle,
- IN CONST VOID *RegisterContext,
- IN OUT VOID *CommBuffer,
- IN OUT UINTN *CommBufferSize
- )
-{
- SMMBASE_FUNCTION_DATA *FunctionData;
-
- ASSERT (CommBuffer != NULL);
- ASSERT (CommBufferSize != NULL);
-
- if (*CommBufferSize == sizeof (SMMBASE_FUNCTION_DATA) &&
- SmmIsBufferOutsideSmmValid ((EFI_PHYSICAL_ADDRESS)(UINTN)CommBuffer, (UINT64)*CommBufferSize)) {
- FunctionData = (SMMBASE_FUNCTION_DATA *)CommBuffer;
-
- switch (FunctionData->Function) {
- case SmmBaseFunctionRegister:
- Register (FunctionData);
- break;
- case SmmBaseFunctionUnregister:
- UnRegister (FunctionData);
- break;
- case SmmBaseFunctionRegisterCallback:
- RegisterCallback (FunctionData);
- break;
- case SmmBaseFunctionAllocatePool:
- HelperAllocatePool (FunctionData);
- break;
- case SmmBaseFunctionFreePool:
- HelperFreePool (FunctionData);
- break;
- case SmmBaseFunctionCommunicate:
- HelperCommunicate (FunctionData);
- break;
- default:
- DEBUG ((EFI_D_WARN, "SmmBaseHelper: invalid SMM Base function.\n"));
- FunctionData->Status = EFI_UNSUPPORTED;
- }
- }
- return EFI_SUCCESS;
-}
-
-/**
- Smm Ready To Lock event notification handler.
-
- It sets a flag indicating that SMRAM has been locked.
-
- @param[in] Protocol Points to the protocol's unique identifier.
- @param[in] Interface Points to the interface instance.
- @param[in] Handle The handle on which the interface was installed.
-
- @retval EFI_SUCCESS Notification handler runs successfully.
- **/
-EFI_STATUS
-EFIAPI
-SmmReadyToLockEventNotify (
- IN CONST EFI_GUID *Protocol,
- IN VOID *Interface,
- IN EFI_HANDLE Handle
- )
-{
- mLocked = TRUE;
- return EFI_SUCCESS;
-}
-
-/**
- Entry point function of the SMM Base Helper SMM driver.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @retval other Some error occurs when executing this entry point.
-**/
-EFI_STATUS
-EFIAPI
-SmmBaseHelperMain (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_MP_SERVICES_PROTOCOL *MpServices;
- EFI_HANDLE Handle;
- UINTN NumberOfEnabledProcessors;
- VOID *Registration;
-
- Handle = NULL;
- ///
- /// Locate SMM CPU Protocol which is used later to retrieve/update CPU Save States
- ///
- Status = gSmst->SmmLocateProtocol (&gEfiSmmCpuProtocolGuid, NULL, (VOID **) &mSmmCpu);
- ASSERT_EFI_ERROR (Status);
-
- ///
- /// Locate PE32 Image Protocol which is used later to load Framework SMM driver
- ///
- Status = SystemTable->BootServices->LocateProtocol (&gEfiLoadPeImageProtocolGuid, NULL, (VOID **) &mLoadPe32Image);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Get MP Services Protocol
- //
- Status = SystemTable->BootServices->LocateProtocol (&gEfiMpServiceProtocolGuid, NULL, (VOID **)&MpServices);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Use MP Services Protocol to retrieve the number of processors and number of enabled processors
- //
- Status = MpServices->GetNumberOfProcessors (MpServices, &mNumberOfProcessors, &NumberOfEnabledProcessors);
- ASSERT_EFI_ERROR (Status);
-
- ///
- /// Interface structure of SMM BASE Helper Ready Protocol is allocated from UEFI pool
- /// instead of SMM pool so that SMM Base Thunk driver can access it in Non-SMM mode.
- ///
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (EFI_SMM_BASE_HELPER_READY_PROTOCOL),
- (VOID **)&mSmmBaseHelperReady
- );
- ASSERT_EFI_ERROR (Status);
-
- ///
- /// Construct Framework SMST from PI SMST
- ///
- mFrameworkSmst = ConstructFrameworkSmst ();
- mSmmBaseHelperReady->FrameworkSmst = mFrameworkSmst;
- mSmmBaseHelperReady->ServiceEntry = SmmHandlerEntry;
-
- //
- // Register SMM Ready To Lock Protocol notification
- //
- Status = gSmst->SmmRegisterProtocolNotify (
- &gEfiSmmReadyToLockProtocolGuid,
- SmmReadyToLockEventNotify,
- &Registration
- );
- ASSERT_EFI_ERROR (Status);
-
- ///
- /// Register SMM Base Helper services for SMM Base Thunk driver
- ///
- Status = gSmst->SmiHandlerRegister (SmmHandlerEntry, &gEfiSmmBaseThunkCommunicationGuid, &mDispatchHandle);
- ASSERT_EFI_ERROR (Status);
-
- ///
- /// Install EFI SMM Base Helper Protocol in the UEFI handle database
- ///
- Status = gBS->InstallProtocolInterface (
- &Handle,
- &gEfiSmmBaseHelperReadyProtocolGuid,
- EFI_NATIVE_INTERFACE,
- mSmmBaseHelperReady
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.inf b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.inf
deleted file mode 100644
index 118640b1e4..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.inf
+++ /dev/null
@@ -1,88 +0,0 @@
-## @file
-# Component description file for SMM Base Helper SMM driver.
-#
-# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SmmBaseHelper
- FILE_GUID = 8C87E0A0-B390-4be3-819C-7C6C83CAE4EB
- MODULE_TYPE = DXE_SMM_DRIVER
- VERSION_STRING = 1.0
- PI_SPECIFICATION_VERSION = 0x0001000A
- ENTRY_POINT = SmmBaseHelperMain
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- SmmBaseHelper.c
- SmramProfileRecord.c
-
-[Sources.Ia32]
- PageFaultHandler.c
-
-[Sources.X64]
- X64/PageFaultHandler.asm | MSFT
-
- X64/PageFaultHandler.asm | INTEL
-
- X64/PageFaultHandler.S | GCC
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- SmmServicesTableLib
- BaseMemoryLib
- PeCoffLib
- DevicePathLib
- CacheMaintenanceLib
- MemoryAllocationLib
- SynchronizationLib
- CpuLib
- PcdLib
- SmmMemLib
-
-[Guids]
- gEfiSmmBaseThunkCommunicationGuid
- gEdkiiMemoryProfileGuid
-
-[Protocols]
- gEfiSmmBaseHelperReadyProtocolGuid # PROTOCOL ALWAYS_PRODUCED
- gEfiSmmCpuProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiLoadedImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiLoadedImageDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiSmmCpuSaveStateProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiMpServiceProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiSmmCpuIo2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiLoadPeImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiSmmReadyToLockProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiSmmCommunicationProtocolGuid
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfilePropertyMask
-
-[Depex]
- gEfiSmmCpuProtocolGuid AND
- gEfiMpServiceProtocolGuid AND
- gEfiSmmCpuIo2ProtocolGuid AND
- gEfiLoadPeImageProtocolGuid
diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c
deleted file mode 100644
index a1797eaa60..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/** @file
-
- Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-
-#include <PiSmm.h>
-
-#include <Library/BaseLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/SmmServicesTableLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-#include <Protocol/SmmCommunication.h>
-
-#include <Guid/MemoryProfile.h>
-
-EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL;
-
-/**
- Get the GUID file name from the file path.
-
- @param FilePath File path.
-
- @return The GUID file name from the file path.
-
-**/
-EFI_GUID *
-GetFileNameFromFilePath (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath
- )
-{
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *ThisFilePath;
-
- ThisFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) FilePath;
- while (!IsDevicePathEnd (ThisFilePath)) {
- if ((DevicePathType (ThisFilePath) == MEDIA_DEVICE_PATH) && (DevicePathSubType (ThisFilePath) == MEDIA_PIWG_FW_FILE_DP)) {
- return &ThisFilePath->FvFileName;
- }
- ThisFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) NextDevicePathNode (ThisFilePath);
- }
-
- return NULL;
-}
-
-/**
- Register SMM image to SMRAM profile.
-
- @param[in] FilePath File path of the image.
- @param[in] ImageBuffer Image base address.
- @param[in] NumberOfPage Number of page.
-
- @retval TRUE Register success.
- @retval FALSE Register fail.
-
-**/
-BOOLEAN
-RegisterSmramProfileImage (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN PHYSICAL_ADDRESS ImageBuffer,
- IN UINTN NumberOfPage
- )
-{
- EFI_GUID *FileName;
- EFI_STATUS Status;
- UINTN CommSize;
- UINT8 CommBuffer[sizeof (EFI_GUID) + sizeof (UINTN) + sizeof (SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE)];
- EFI_SMM_COMMUNICATE_HEADER *CommHeader;
- SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE *CommRegisterImage;
-
- if ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT1) == 0) {
- return FALSE;
- }
-
- FileName = GetFileNameFromFilePath (FilePath);
-
- if (mSmmCommunication == NULL) {
- Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication);
- ASSERT_EFI_ERROR (Status);
- }
-
- CommHeader = (EFI_SMM_COMMUNICATE_HEADER *) &CommBuffer[0];
- CopyMem (&CommHeader->HeaderGuid, &gEdkiiMemoryProfileGuid, sizeof (gEdkiiMemoryProfileGuid));
- CommHeader->MessageLength = sizeof (SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE);
-
- CommRegisterImage = (SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
- CommRegisterImage->Header.Command = SMRAM_PROFILE_COMMAND_REGISTER_IMAGE;
- CommRegisterImage->Header.DataLength = sizeof (*CommRegisterImage);
- CommRegisterImage->Header.ReturnStatus = (UINT64)-1;
- CopyMem (&CommRegisterImage->FileName, FileName, sizeof(EFI_GUID));
- CommRegisterImage->ImageBuffer = ImageBuffer;
- CommRegisterImage->NumberOfPage = NumberOfPage;
-
- CommSize = sizeof (EFI_GUID) + sizeof (UINTN) + CommHeader->MessageLength;
- Status = mSmmCommunication->Communicate (mSmmCommunication, CommBuffer, &CommSize);
- ASSERT_EFI_ERROR (Status);
-
- if (CommRegisterImage->Header.ReturnStatus != 0) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- Unregister SMM image from SMRAM profile.
-
- @param[in] FilePath File path of the image.
- @param[in] ImageBuffer Image base address.
- @param[in] NumberOfPage Number of page.
-
- @retval TRUE Unregister success.
- @retval FALSE Unregister fail.
-
-**/
-BOOLEAN
-UnregisterSmramProfileImage (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN PHYSICAL_ADDRESS ImageBuffer,
- IN UINTN NumberOfPage
- )
-{
- EFI_GUID *FileName;
- EFI_STATUS Status;
- UINTN CommSize;
- UINT8 CommBuffer[sizeof (EFI_GUID) + sizeof (UINTN) + sizeof (SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE)];
- EFI_SMM_COMMUNICATE_HEADER *CommHeader;
- SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE *CommUnregisterImage;
-
- if ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT1) == 0) {
- return FALSE;
- }
-
- FileName = GetFileNameFromFilePath (FilePath);
-
- if (mSmmCommunication == NULL) {
- Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication);
- ASSERT_EFI_ERROR (Status);
- }
-
- CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
- CopyMem (&CommHeader->HeaderGuid, &gEdkiiMemoryProfileGuid, sizeof(gEdkiiMemoryProfileGuid));
- CommHeader->MessageLength = sizeof(SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE);
-
- CommUnregisterImage = (SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
- CommUnregisterImage->Header.Command = SMRAM_PROFILE_COMMAND_UNREGISTER_IMAGE;
- CommUnregisterImage->Header.DataLength = sizeof (*CommUnregisterImage);
- CommUnregisterImage->Header.ReturnStatus = (UINT64)-1;
- CopyMem (&CommUnregisterImage->FileName, FileName, sizeof(EFI_GUID));
- CommUnregisterImage->ImageBuffer = ImageBuffer;
- CommUnregisterImage->NumberOfPage = NumberOfPage;
-
- CommSize = sizeof (EFI_GUID) + sizeof (UINTN) + CommHeader->MessageLength;
- Status = mSmmCommunication->Communicate (mSmmCommunication, CommBuffer, &CommSize);
- ASSERT_EFI_ERROR (Status);
-
- if (CommUnregisterImage->Header.ReturnStatus != 0) {
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.S b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.S
deleted file mode 100644
index f1b5ad7adb..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.S
+++ /dev/null
@@ -1,68 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-# 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:
-#
-# PageFaultHandler.S
-#
-# Abstract:
-#
-# Defines page fault handler used to hook SMM IDT
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(PageFaultHandlerHook)
-ASM_PFX(PageFaultHandlerHook):
- pushq %rax # save all volatile registers
- pushq %rcx
- pushq %rdx
- pushq %r8
- pushq %r9
- pushq %r10
- pushq %r11
-
- addq $-0x68, %rsp # reserve memory to store XMM registers and make address 16-byte alignment
- movdqa %xmm0, 0(%rsp)
- movdqa %xmm1, 0x10(%rsp)
- movdqa %xmm2, 0x20(%rsp)
- movdqa %xmm3, 0x30(%rsp)
- movdqa %xmm4, 0x40(%rsp)
- movdqa %xmm5, 0x50(%rsp)
-
- addq $-0x20, %rsp
- call ASM_PFX(PageFaultHandler)
- addq $0x20, %rsp
-
- movdqa 0(%rsp), %xmm0
- movdqa 0x10(%rsp), %xmm1
- movdqa 0x20(%rsp), %xmm2
- movdqa 0x30(%rsp), %xmm3
- movdqa 0x40(%rsp), %xmm4
- movdqa 0x50(%rsp), %xmm5
- addq $0x68, %rsp
-
- testb %al, %al # set ZF flag
- popq %r11
- popq %r10
- popq %r9
- popq %r8
- popq %rdx
- popq %rcx
- popq %rax # restore all volatile registers
- jnz L1 # check ZF flag
-#ifdef __APPLE__
- int $3
-#else
- jmpq *ASM_PFX(mOriginalHandler)
-#endif
-L1:
- addq $0x08, %rsp # skip error code for PF
- iretq
diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.asm b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.asm
deleted file mode 100644
index ed0d7f7c28..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.asm
+++ /dev/null
@@ -1,70 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
-; 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:
-;
-; PageFaultHandler.asm
-;
-; Abstract:
-;
-; Defines page fault handler used to hook SMM IDT
-;
-;------------------------------------------------------------------------------
-
-EXTERN mOriginalHandler:QWORD
-EXTERN PageFaultHandler:PROC
-
- .code
-
-PageFaultHandlerHook PROC
- push rax ; save all volatile registers
- push rcx
- push rdx
- push r8
- push r9
- push r10
- push r11
-
- add rsp, -10h * 6 - 8 ; reserve memory to store XMM registers and make address 16-byte alignment
- movdqa [rsp], xmm0
- movdqa [rsp + 10h], xmm1
- movdqa [rsp + 20h], xmm2
- movdqa [rsp + 30h], xmm3
- movdqa [rsp + 40h], xmm4
- movdqa [rsp + 50h], xmm5
-
- add rsp, -20h
- call PageFaultHandler
- add rsp, 20h
-
- movdqa xmm0, [rsp]
- movdqa xmm1, [rsp + 10h]
- movdqa xmm2, [rsp + 20h]
- movdqa xmm3, [rsp + 30h]
- movdqa xmm4, [rsp + 40h]
- movdqa xmm5, [rsp + 50h]
- add rsp, 10h * 6 + 8
-
- test al, al ; set ZF flag
- pop r11
- pop r10
- pop r9
- pop r8
- pop rdx
- pop rcx
- pop rax ; restore all volatile registers
- jnz @F ; check ZF flag
- jmp mOriginalHandler
-@@:
- add rsp, 08h ; skip error code for PF
- iretq
-PageFaultHandlerHook ENDP
- END
diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c b/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c
deleted file mode 100644
index 187adff941..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.c
+++ /dev/null
@@ -1,521 +0,0 @@
-/** @file
- SMM Base Protocol on SMM Base2 Protocol Thunk driver.
-
- This driver co-operates with SMM Base Helper SMM driver to provide SMM Base Protocol
- based on SMM Base2 Protocol.
-
- This thunk driver is expected to be loaded before PI SMM IPL driver so that
- SMM BASE Protocol can be published immediately after SMM Base2 Protocol is installed to
- make SMM Base Protocol.InSmm() as early as possible.
-
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-
-#include <PiDxe.h>
-#include <FrameworkSmm.h>
-
-#include <Protocol/SmmBase2.h>
-#include <Protocol/SmmCommunication.h>
-#include <Protocol/SmmBaseHelperReady.h>
-
-#include <Guid/SmmBaseThunkCommunication.h>
-#include <Guid/EventGroup.h>
-
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiRuntimeLib.h>
-
-SMMBASETHUNK_COMMUNICATION_DATA mCommunicationData = {
- EFI_SMM_BASE_THUNK_COMMUNICATION_GUID,
- sizeof (SMMBASE_FUNCTION_DATA)
-};
-
-EFI_HANDLE mSmmBaseHandle = NULL;
-EFI_SMM_BASE2_PROTOCOL *mSmmBase2 = NULL;
-EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL;
-EFI_SMM_BASE_HELPER_READY_PROTOCOL *mSmmBaseHelperReady = NULL;
-BOOLEAN mAtRuntime = FALSE;
-
-/**
- Determine if in SMM mode.
-
- @retval TRUE In SMM mode.
- @retval FALSE Not in SMM mode.
-**/
-BOOLEAN
-IsInSmm (
- VOID
- )
-{
- EFI_STATUS Status;
- BOOLEAN InSmm;
-
- Status = mSmmBase2->InSmm (mSmmBase2, &InSmm);
- ASSERT_EFI_ERROR (Status);
- return InSmm;
-}
-
-/**
- Invoke services provided by SMM Base Helper SMM driver.
-**/
-VOID
-SmmBaseHelperService (
- VOID
- )
-{
- UINTN DataSize;
-
- mCommunicationData.FunctionData.Status = EFI_UNSUPPORTED;
- mCommunicationData.FunctionData.SmmBaseImageHandle = mSmmBaseHandle;
-
- if ((mCommunicationData.FunctionData.Function != SmmBaseFunctionCommunicate) && IsInSmm()) {
- ///
- /// If in SMM mode, directly call services in SMM Base Helper.
- ///
- DataSize = (UINTN)(sizeof (SMMBASE_FUNCTION_DATA));
- mSmmBaseHelperReady->ServiceEntry (
- NULL,
- NULL,
- &mCommunicationData.FunctionData,
- &DataSize
- );
- } else {
- ///
- /// Call services in SMM Base Helper via SMM Communication Protocol.
- ///
- DataSize = (UINTN)(sizeof (mCommunicationData));
- mSmmCommunication->Communicate (
- mSmmCommunication,
- &mCommunicationData,
- &DataSize
- );
- }
-}
-
-/**
- Register a given driver into SMRAM. This is the equivalent of performing
- the LoadImage/StartImage into System Management Mode.
-
- @param[in] This Protocol instance pointer.
- @param[in] FilePath Location of the image to be installed as the handler.
- @param[in] SourceBuffer Optional source buffer in case the image file
- is in memory.
- @param[in] SourceSize Size of the source image file, if in memory.
- @param[out] ImageHandle The handle that the base driver uses to decode
- the handler. Unique among SMM handlers only,
- not unique across DXE/EFI.
- @param[in] LegacyIA32Binary An optional parameter specifying that the associated
- file is a real-mode IA-32 binary.
-
- @retval EFI_SUCCESS The operation was successful.
- @retval EFI_OUT_OF_RESOURCES There were no additional SMRAM resources to load the handler
- @retval EFI_UNSUPPORTED This platform does not support 16-bit handlers.
- @retval EFI_UNSUPPORTED Platform is in runtime.
- @retval EFI_INVALID_PARAMETER The handlers was not the correct image type
-**/
-EFI_STATUS
-EFIAPI
-SmmBaseRegister (
- IN EFI_SMM_BASE_PROTOCOL *This,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN VOID *SourceBuffer,
- IN UINTN SourceSize,
- OUT EFI_HANDLE *ImageHandle,
- IN BOOLEAN LegacyIA32Binary
- )
-{
- if (mAtRuntime || LegacyIA32Binary) {
- return EFI_UNSUPPORTED;
- }
-
- mCommunicationData.FunctionData.Function = SmmBaseFunctionRegister;
- mCommunicationData.FunctionData.Args.Register.FilePath = FilePath;
- mCommunicationData.FunctionData.Args.Register.SourceBuffer = SourceBuffer;
- mCommunicationData.FunctionData.Args.Register.SourceSize = SourceSize;
- mCommunicationData.FunctionData.Args.Register.ImageHandle = ImageHandle;
- mCommunicationData.FunctionData.Args.Register.LegacyIA32Binary = LegacyIA32Binary;
-
- SmmBaseHelperService ();
- return mCommunicationData.FunctionData.Status;
-}
-
-/**
- Removes a handler from execution within SMRAM. This is the equivalent of performing
- the UnloadImage in System Management Mode.
-
- @param[in] This Protocol instance pointer.
- @param[in] ImageHandle The handler to be removed.
-
- @retval EFI_SUCCESS The operation was successful
- @retval EFI_INVALID_PARAMETER The handler did not exist
- @retval EFI_UNSUPPORTED Platform is in runtime.
-**/
-EFI_STATUS
-EFIAPI
-SmmBaseUnregister (
- IN EFI_SMM_BASE_PROTOCOL *This,
- IN EFI_HANDLE ImageHandle
- )
-{
- if (mAtRuntime) {
- return EFI_UNSUPPORTED;
- }
-
- mCommunicationData.FunctionData.Function = SmmBaseFunctionUnregister;
- mCommunicationData.FunctionData.Args.UnRegister.ImageHandle = ImageHandle;
-
- SmmBaseHelperService ();
- return mCommunicationData.FunctionData.Status;
-}
-
-/**
- The SMM Inter-module Communicate Service Communicate() function
- provides a service to send/receive messages from a registered
- EFI service. The BASE protocol driver is responsible for doing
- any of the copies such that the data lives in boot-service-accessible RAM.
-
- @param[in] This Protocol instance pointer.
- @param[in] ImageHandle The handle of the registered driver.
- @param[in, out] CommunicationBuffer Pointer to the buffer to convey into SMRAM.
- @param[in, out] BufferSize The size of the data buffer being passed in.
- On exit, the size of data being returned.
- Zero if the handler does not wish to reply with any data.
-
- @retval EFI_SUCCESS The message was successfully posted
- @retval EFI_INVALID_PARAMETER The buffer was NULL
-**/
-EFI_STATUS
-EFIAPI
-SmmBaseCommunicate (
- IN EFI_SMM_BASE_PROTOCOL *This,
- IN EFI_HANDLE ImageHandle,
- IN OUT VOID *CommunicationBuffer,
- IN OUT UINTN *BufferSize
- )
-{
- ///
- /// Note this is a runtime interface
- ///
-
- if (CommunicationBuffer == NULL || BufferSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- mCommunicationData.FunctionData.Function = SmmBaseFunctionCommunicate;
- mCommunicationData.FunctionData.Args.Communicate.ImageHandle = ImageHandle;
- mCommunicationData.FunctionData.Args.Communicate.CommunicationBuffer = CommunicationBuffer;
- mCommunicationData.FunctionData.Args.Communicate.SourceSize = BufferSize;
-
- SmmBaseHelperService ();
- return mCommunicationData.FunctionData.Status;
-}
-
-/**
- Register a callback to execute within SMM.
- This allows receipt of messages created with EFI_SMM_BASE_PROTOCOL.Communicate().
-
- @param[in] This Protocol instance pointer.
- @param[in] SmmImageHandle Handle of the callback service.
- @param[in] CallbackAddress Address of the callback service.
- @param[in] MakeLast If present, will stipulate that the handler is posted to
- be executed last in the dispatch table.
- @param[in] FloatingPointSave An optional parameter that informs the
- EFI_SMM_ACCESS_PROTOCOL Driver core if it needs to save
- the floating point register state. If any handler
- require this, the state will be saved for all handlers.
-
- @retval EFI_SUCCESS The operation was successful
- @retval EFI_OUT_OF_RESOURCES Not enough space in the dispatch queue
- @retval EFI_UNSUPPORTED Platform is in runtime.
- @retval EFI_UNSUPPORTED The caller is not in SMM.
-**/
-EFI_STATUS
-EFIAPI
-SmmBaseRegisterCallback (
- IN EFI_SMM_BASE_PROTOCOL *This,
- IN EFI_HANDLE SmmImageHandle,
- IN EFI_SMM_CALLBACK_ENTRY_POINT CallbackAddress,
- IN BOOLEAN MakeLast,
- IN BOOLEAN FloatingPointSave
- )
-{
- if (!IsInSmm()) {
- return EFI_UNSUPPORTED;
- }
-
- mCommunicationData.FunctionData.Function = SmmBaseFunctionRegisterCallback;
- mCommunicationData.FunctionData.Args.RegisterCallback.SmmImageHandle = SmmImageHandle;
- mCommunicationData.FunctionData.Args.RegisterCallback.CallbackAddress = CallbackAddress;
- mCommunicationData.FunctionData.Args.RegisterCallback.MakeLast = MakeLast;
- mCommunicationData.FunctionData.Args.RegisterCallback.FloatingPointSave = FloatingPointSave;
-
- SmmBaseHelperService();
- return mCommunicationData.FunctionData.Status;
-}
-
-/**
- This routine tells caller if execution context is SMM or not.
-
- @param[in] This Protocol instance pointer.
- @param[out] InSmm Whether the caller is inside SMM for IA-32
- or servicing a PMI for the Itanium processor
- family.
-
- @retval EFI_SUCCESS The operation was successful
- @retval EFI_INVALID_PARAMETER InSmm was NULL.
-**/
-EFI_STATUS
-EFIAPI
-SmmBaseInSmm (
- IN EFI_SMM_BASE_PROTOCOL *This,
- OUT BOOLEAN *InSmm
- )
-{
- return mSmmBase2->InSmm (mSmmBase2, InSmm);
-}
-
-/**
- The SmmAllocatePool() function allocates a memory region of Size bytes from memory of
- type PoolType and returns the address of the allocated memory in the location referenced
- by Buffer. This function allocates pages from EFI SMRAM Memory as needed to grow the
- requested pool type. All allocations are eight-byte aligned.
-
- @param[in] This Protocol instance pointer.
- @param[in] PoolType The type of pool to allocate.
- The only supported type is EfiRuntimeServicesData;
- the interface will internally map this runtime request to
- SMRAM for IA-32 and leave as this type for the Itanium
- processor family. Other types can be ignored.
- @param[in] Size The number of bytes to allocate from the pool.
- @param[out] Buffer A pointer to a pointer to the allocated buffer if the call
- succeeds; undefined otherwise.
-
- @retval EFI_SUCCESS The requested number of bytes was allocated.
- @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.
- @retval EFI_UNSUPPORTED Platform is in runtime.
-**/
-EFI_STATUS
-EFIAPI
-SmmBaseSmmAllocatePool (
- IN EFI_SMM_BASE_PROTOCOL *This,
- IN EFI_MEMORY_TYPE PoolType,
- IN UINTN Size,
- OUT VOID **Buffer
- )
-{
- if (mAtRuntime) {
- return EFI_UNSUPPORTED;
- }
-
- mCommunicationData.FunctionData.Function = SmmBaseFunctionAllocatePool;
- mCommunicationData.FunctionData.Args.AllocatePool.PoolType = PoolType;
- mCommunicationData.FunctionData.Args.AllocatePool.Size = Size;
- mCommunicationData.FunctionData.Args.AllocatePool.Buffer = Buffer;
-
- SmmBaseHelperService ();
- return mCommunicationData.FunctionData.Status;
-}
-
-/**
- The SmmFreePool() function returns the memory specified by Buffer to the system.
- On return, the memory's type is EFI SMRAM Memory. The Buffer that is freed must
- have been allocated by SmmAllocatePool().
-
- @param[in] This Protocol instance pointer.
- @param[in] Buffer Pointer to the buffer allocation.
-
- @retval EFI_SUCCESS The memory was returned to the system.
- @retval EFI_INVALID_PARAMETER Buffer was invalid.
- @retval EFI_UNSUPPORTED Platform is in runtime.
-**/
-EFI_STATUS
-EFIAPI
-SmmBaseSmmFreePool (
- IN EFI_SMM_BASE_PROTOCOL *This,
- IN VOID *Buffer
- )
-{
- if (mAtRuntime) {
- return EFI_UNSUPPORTED;
- }
-
- mCommunicationData.FunctionData.Function = SmmBaseFunctionFreePool;
- mCommunicationData.FunctionData.Args.FreePool.Buffer = Buffer;
-
- SmmBaseHelperService ();
- return mCommunicationData.FunctionData.Status;
-}
-
-/**
- The GetSmstLocation() function returns the location of the System Management
- Service Table. The use of the API is such that a driver can discover the
- location of the SMST in its entry point and then cache it in some driver
- global variable so that the SMST can be invoked in subsequent callbacks.
-
- @param[in] This Protocol instance pointer.
- @param[out] Smst Pointer to the SMST.
-
- @retval EFI_SUCCESS The operation was successful
- @retval EFI_INVALID_PARAMETER Smst was invalid.
- @retval EFI_UNSUPPORTED Not in SMM.
-**/
-EFI_STATUS
-EFIAPI
-SmmBaseGetSmstLocation (
- IN EFI_SMM_BASE_PROTOCOL *This,
- OUT EFI_SMM_SYSTEM_TABLE **Smst
- )
-{
- if (!IsInSmm ()) {
- return EFI_UNSUPPORTED;
- }
-
- if (Smst == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Smst = mSmmBaseHelperReady->FrameworkSmst;
- return EFI_SUCCESS;
-}
-
-/**
- Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE
-
- This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
- It convers pointer to new virtual address.
-
- @param Event Event whose notification function is being invoked
- @param Context Pointer to the notification function's context
-**/
-VOID
-EFIAPI
-SmmBaseAddressChangeEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EfiConvertPointer (0x0, (VOID **) &mSmmCommunication);
-}
-
-///
-/// SMM Base Protocol instance
-///
-EFI_SMM_BASE_PROTOCOL mSmmBase = {
- SmmBaseRegister,
- SmmBaseUnregister,
- SmmBaseCommunicate,
- SmmBaseRegisterCallback,
- SmmBaseInSmm,
- SmmBaseSmmAllocatePool,
- SmmBaseSmmFreePool,
- SmmBaseGetSmstLocation
-};
-
-/**
- Notification function on Exit Boot Services Event.
-
- This function sets a flag indicating it is in Runtime phase.
-
- @param Event Event whose notification function is being invoked
- @param Context Pointer to the notification function's context
-**/
-VOID
-EFIAPI
-SmmBaseExitBootServicesEventNotify (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- mAtRuntime = TRUE;
-}
-
-/**
- Entry Point for SMM Base Protocol on SMM Base2 Protocol Thunk driver.
-
- @param[in] ImageHandle Image handle of this driver.
- @param[in] SystemTable A Pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
-**/
-EFI_STATUS
-EFIAPI
-SmmBaseThunkMain (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_EVENT Event;
-
- mSmmBaseHandle = ImageHandle;
-
- //
- // Assume only one instance of SMM Base2 Protocol in the system
- // Locate SMM Base2 Protocol
- //
- Status = gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID **) &mSmmBase2);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Assume only one instance of SMM Communication Protocol in the system
- // Locate SMM Communication Protocol
- //
- Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Assume only one instance of SMM Base Helper Ready Protocol in the system
- // Locate SMM Base Helper Ready Protocol
- //
- Status = gBS->LocateProtocol (&gEfiSmmBaseHelperReadyProtocolGuid, NULL, (VOID **) &mSmmBaseHelperReady);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Create event notification on Exit Boot Services event.
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- SmmBaseExitBootServicesEventNotify,
- NULL,
- &gEfiEventExitBootServicesGuid,
- &Event
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Create event on SetVirtualAddressMap() to convert mSmmCommunication from a physical address to a virtual address
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- SmmBaseAddressChangeEvent,
- NULL,
- &gEfiEventVirtualAddressChangeGuid,
- &Event
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Publish Framework SMM BASE Protocol immediately after SMM Base2 Protocol is installed to
- // make SMM Base Protocol.InSmm() available as early as possible.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mSmmBaseHandle,
- &gEfiSmmBaseProtocolGuid, &mSmmBase,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.inf b/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.inf
deleted file mode 100644
index 4e9f3d1895..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseOnSmmBase2Thunk/SmmBaseOnSmmBase2Thunk.inf
+++ /dev/null
@@ -1,56 +0,0 @@
-## @file
-# Component description file for SMM Base Protocol on SMM Base2 Protocol Thunk driver.
-#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SmmBaseOnSmmBase2Thunk
- FILE_GUID = 21CCF0B7-246B-412c-A334-0B65A07B28DF
- MODULE_TYPE = DXE_RUNTIME_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = SmmBaseThunkMain
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- SmmBaseOnSmmBase2Thunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- DebugLib
- UefiLib
- UefiRuntimeLib
-
-[Guids]
- gEfiEventVirtualAddressChangeGuid # GUID ALWAYS_CONSUMED
- gEfiEventExitBootServicesGuid # GUID ALWAYS_CONSUMED
-
-[Protocols]
- gEfiSmmBase2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiSmmCommunicationProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiSmmBaseHelperReadyProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiSmmBaseProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-
-[Depex]
- gEfiSmmBase2ProtocolGuid AND gEfiSmmCommunicationProtocolGuid AND gEfiSmmBaseHelperReadyProtocolGuid
diff --git a/EdkCompatibilityPkg/Compatibility/SmmControl2OnSmmControlThunk/SmmControl2OnSmmControlThunk.c b/EdkCompatibilityPkg/Compatibility/SmmControl2OnSmmControlThunk/SmmControl2OnSmmControlThunk.c
deleted file mode 100644
index 651d194209..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmControl2OnSmmControlThunk/SmmControl2OnSmmControlThunk.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/** @file
- SMM Control2 Protocol on SMM Control Protocol Thunk driver.
-
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-
-#include "SmmControl2OnSmmControlThunk.h"
-
-EFI_SMM_CONTROL2_PROTOCOL gSmmControl2 = {
- SmmControl2Trigger,
- SmmControl2Clear,
- 0
-};
-
-EFI_SMM_CONTROL_PROTOCOL *mSmmControl;
-UINT8 mDataPort;
-
-/**
- Invokes SMI activation from either the preboot or runtime environment.
-
- This function generates an SMI.
-
- @param[in] This The EFI_SMM_CONTROL2_PROTOCOL instance.
- @param[in, out] CommandPort The value written to the command port.
- @param[in, out] DataPort The value written to the data port.
- @param[in] Periodic Optional mechanism to engender a periodic stream.
- @param[in] ActivationInterval Optional parameter to repeat at this period one
- time or, if the Periodic Boolean is set, periodically.
-
- @retval EFI_SUCCESS The SMI/PMI has been engendered.
- @retval EFI_DEVICE_ERROR The timing is unsupported.
- @retval EFI_INVALID_PARAMETER The activation period is unsupported.
- @retval EFI_INVALID_PARAMETER The last periodic activation has not been cleared.
- @retval EFI_NOT_STARTED The SMM base service has not been initialized.
-**/
-EFI_STATUS
-EFIAPI
-SmmControl2Trigger (
- IN CONST EFI_SMM_CONTROL2_PROTOCOL *This,
- IN OUT UINT8 *CommandPort OPTIONAL,
- IN OUT UINT8 *DataPort OPTIONAL,
- IN BOOLEAN Periodic OPTIONAL,
- IN UINTN ActivationInterval OPTIONAL
- )
-{
- UINTN ArgumentBufferSize;
-
- ArgumentBufferSize = 0;
- if (CommandPort != NULL) {
- ArgumentBufferSize = 1;
- }
- if (DataPort != NULL) {
- IoWrite8 (mDataPort, *DataPort);
- }
- return mSmmControl->Trigger (mSmmControl, (INT8 *)CommandPort, &ArgumentBufferSize, Periodic, ActivationInterval);
-}
-
-/**
- Clears any system state that was created in response to the Trigger() call.
-
- This function acknowledges and causes the deassertion of the SMI activation source.
-
- @param[in] This The EFI_SMM_CONTROL2_PROTOCOL instance.
- @param[in] Periodic Optional parameter to repeat at this period one time
-
- @retval EFI_SUCCESS The SMI/PMI has been engendered.
- @retval EFI_DEVICE_ERROR The source could not be cleared.
- @retval EFI_INVALID_PARAMETER The service did not support the Periodic input argument.
-**/
-EFI_STATUS
-EFIAPI
-SmmControl2Clear (
- IN CONST EFI_SMM_CONTROL2_PROTOCOL *This,
- IN BOOLEAN Periodic OPTIONAL
- )
-{
- return mSmmControl->Clear (mSmmControl, Periodic);
-}
-
-/**
- Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE.
-
- This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
- It convers pointer to new virtual address.
-
- @param[in] Event Event whose notification function is being invoked.
- @param[in] Context Pointer to the notification function's context.
-
-**/
-VOID
-EFIAPI
-SetVirtualAddressNotify (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EfiConvertPointer (0x0, (VOID **)&mSmmControl);
-}
-
-/**
- Entry Point for this thunk driver.
-
- @param[in] ImageHandle Image handle of this driver.
- @param[in] SystemTable A Pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @retval other Some error occurred when executing this entry point.
-**/
-EFI_STATUS
-EFIAPI
-SmmControl2ThunkMain (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_EVENT Event;
- EFI_SMM_CONTROL_REGISTER RegisterInfo;
-
- ///
- /// Locate Framework SMM Control Protocol
- ///
- Status = gBS->LocateProtocol (&gEfiSmmControlProtocolGuid, NULL, (VOID **)&mSmmControl);
- ASSERT_EFI_ERROR (Status);
-
- gSmmControl2.MinimumTriggerPeriod = mSmmControl->MinimumTriggerPeriod;
-
- Status = mSmmControl->GetRegisterInfo (mSmmControl, &RegisterInfo);
- ASSERT_EFI_ERROR (Status);
- mDataPort = RegisterInfo.SmiDataRegister;
-
- ///
- /// Create event on SetVirtualAddressMap() to convert mSmmControl from a physical address to a virtual address
- ///
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- SetVirtualAddressNotify,
- NULL,
- &gEfiEventVirtualAddressChangeGuid,
- &Event
- );
-
- ASSERT_EFI_ERROR (Status);
-
- ///
- /// Publish framework SMM Control Protocol
- ///
- Status = gBS->InstallProtocolInterface (
- &ImageHandle,
- &gEfiSmmControl2ProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &gSmmControl2
- );
- return Status;
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/SmmControl2OnSmmControlThunk/SmmControl2OnSmmControlThunk.h b/EdkCompatibilityPkg/Compatibility/SmmControl2OnSmmControlThunk/SmmControl2OnSmmControlThunk.h
deleted file mode 100644
index 25e9d3afb7..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmControl2OnSmmControlThunk/SmmControl2OnSmmControlThunk.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/** @file
- Include file for SMM Control2 Protocol on SMM Control Protocol Thunk driver.
-
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
- 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.
-
-**/
-
-#ifndef _SMM_CONTROL2_ON_SMM_CONTROL_THUNK_H_
-#define _SMM_CONTROL2_ON_SMM_CONTROL_THUNK_H_
-
-#include <PiDxe.h>
-#include <FrameworkSmm.h>
-
-#include <Protocol/SmmControl2.h>
-#include <Protocol/SmmControl.h>
-
-#include <Guid/EventGroup.h>
-
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiRuntimeLib.h>
-#include <Library/IoLib.h>
-
-/**
- Invokes SMI activation from either the preboot or runtime environment.
-
- This function generates an SMI.
-
- @param[in] This The EFI_SMM_CONTROL2_PROTOCOL instance.
- @param[in, out] CommandPort The value written to the command port.
- @param[in, out] DataPort The value written to the data port.
- @param[in] Periodic Optional mechanism to engender a periodic stream.
- @param[in] ActivationInterval Optional parameter to repeat at this period one
- time or, if the Periodic Boolean is set, periodically.
-
- @retval EFI_SUCCESS The SMI/PMI has been engendered.
- @retval EFI_DEVICE_ERROR The timing is unsupported.
- @retval EFI_INVALID_PARAMETER The activation period is unsupported.
- @retval EFI_INVALID_PARAMETER The last periodic activation has not been cleared.
- @retval EFI_NOT_STARTED The SMM base service has not been initialized.
-**/
-EFI_STATUS
-EFIAPI
-SmmControl2Trigger (
- IN CONST EFI_SMM_CONTROL2_PROTOCOL *This,
- IN OUT UINT8 *CommandPort OPTIONAL,
- IN OUT UINT8 *DataPort OPTIONAL,
- IN BOOLEAN Periodic OPTIONAL,
- IN UINTN ActivationInterval OPTIONAL
- );
-
-/**
- Clears any system state that was created in response to the Trigger() call.
-
- This function acknowledges and causes the deassertion of the SMI activation source.
-
- @param[in] This The EFI_SMM_CONTROL2_PROTOCOL instance.
- @param[in] Periodic Optional parameter to repeat at this period one time
-
- @retval EFI_SUCCESS The SMI/PMI has been engendered.
- @retval EFI_DEVICE_ERROR The source could not be cleared.
- @retval EFI_INVALID_PARAMETER The service did not support the Periodic input argument.
-**/
-EFI_STATUS
-EFIAPI
-SmmControl2Clear (
- IN CONST EFI_SMM_CONTROL2_PROTOCOL *This,
- IN BOOLEAN Periodic OPTIONAL
- );
-
-#endif
diff --git a/EdkCompatibilityPkg/Compatibility/SmmControl2OnSmmControlThunk/SmmControl2OnSmmControlThunk.inf b/EdkCompatibilityPkg/Compatibility/SmmControl2OnSmmControlThunk/SmmControl2OnSmmControlThunk.inf
deleted file mode 100644
index 47824a7dd8..0000000000
--- a/EdkCompatibilityPkg/Compatibility/SmmControl2OnSmmControlThunk/SmmControl2OnSmmControlThunk.inf
+++ /dev/null
@@ -1,55 +0,0 @@
-## @file
-# Component description file for SMM Control2 Protocol on SMM Control Protocol Thunk driver.
-#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SmmControl2OnSmmControlThunk
- FILE_GUID = B55A4515-5895-4ea8-845B-75B7480F6502
- MODULE_TYPE = DXE_RUNTIME_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = SmmControl2ThunkMain
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- SmmControl2OnSmmControlThunk.c
- SmmControl2OnSmmControlThunk.h
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- UefiRuntimeLib
- DebugLib
- IoLib
-
-[Protocols]
- gEfiSmmControlProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiSmmControl2ProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-
-[Guids]
- gEfiEventVirtualAddressChangeGuid # GUID ALWAYS_CONSUMED
-
-[Depex]
- gEfiSmmControlProtocolGuid
-
diff --git a/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.c b/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.c
deleted file mode 100644
index 021f3e68f5..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.c
+++ /dev/null
@@ -1,460 +0,0 @@
-/** @file
-Module produce UC2 on top of UC.
-
-UEFI 2.1 specification supersedes Inte's EFI Specification 1.10.
-EFI_UNICODE_COLLATION_PROTOCOL defined in Inte's EFI Specification 1.10 is replaced by
-EFI_UNICODE_COLLATION_PROTOCOL in UEFI 2.1.
-This module produces UC2 on top of UC. This module is used on platform when both of
-these two conditions are true:
-1) EFI 1.10 module producing UC present
-2) And the rest of modules on the platform consume UC2
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-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:
-
-**/
-
-#include <PiDxe.h>
-#include <Protocol/UnicodeCollation.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/HiiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/LanguageLib.h>
-
-/**
- Performs a case-insensitive comparison of two Null-terminated strings.
-
- @param This Protocol instance pointer.
- @param Str1 A pointer to a Null-terminated string.
- @param Str2 A pointer to a Null-terminated string.
-
- @retval 0 Str1 is equivalent to Str2
- @retval > 0 Str1 is lexically greater than Str2
- @retval < 0 Str1 is lexically less than Str2
-
-**/
-INTN
-EFIAPI
-StriColl (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *Str1,
- IN CHAR16 *Str2
- );
-
-/**
- Converts all the characters in a Null-terminated string to
- lower case characters.
-
- @param This Protocol instance pointer.
- @param Str A pointer to a Null-terminated string.
-
-**/
-VOID
-EFIAPI
-StrLwr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN OUT CHAR16 *Str
- );
-
-/**
- Converts all the characters in a Null-terminated string to upper
- case characters.
-
- @param This Protocol instance pointer.
- @param Str A pointer to a Null-terminated string.
-
-**/
-VOID
-EFIAPI
-StrUpr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN OUT CHAR16 *Str
- );
-
-/**
- Performs a case-insensitive comparison of a Null-terminated
- pattern string and a Null-terminated string.
-
- @param This Protocol instance pointer.
- @param String A pointer to a Null-terminated string.
- @param Pattern A pointer to a Null-terminated pattern string.
-
- @retval TRUE Pattern was found in String.
- @retval FALSE Pattern was not found in String.
-
-**/
-BOOLEAN
-EFIAPI
-MetaiMatch (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *String,
- IN CHAR16 *Pattern
- );
-
-/**
- Converts an 8.3 FAT file name in an OEM character set to a Null-terminated string.
-
- @param This Protocol instance pointer.
- @param FatSize The size of the string Fat in bytes.
- @param Fat A pointer to a Null-terminated string that contains an 8.3 file
- name using an OEM character set.
- @param String A pointer to a Null-terminated string. The string must
- be preallocated to hold FatSize characters.
-
-**/
-VOID
-EFIAPI
-FatToStr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN UINTN FatSize,
- IN CHAR8 *Fat,
- OUT CHAR16 *String
- );
-
-/**
- Converts a Null-terminated string to legal characters in a FAT
- filename using an OEM character set.
-
- @param This Protocol instance pointer.
- @param String A pointer to a Null-terminated string. The string must
- be preallocated to hold FatSize characters.
- @param FatSize The size of the string Fat in bytes.
- @param Fat A pointer to a Null-terminated string that contains an 8.3 file
- name using an OEM character set.
-
- @retval TRUE Fat is a Long File Name
- @retval FALSE Fat is an 8.3 file name
-
-**/
-BOOLEAN
-EFIAPI
-StrToFat (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *String,
- IN UINTN FatSize,
- OUT CHAR8 *Fat
- );
-
-#define UC2_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('_', 'U', 'C', '2')
-
-typedef struct {
- UINT32 Signature;
- EFI_UNICODE_COLLATION_PROTOCOL Uc2;
- EFI_UNICODE_COLLATION_PROTOCOL *Uc;
-} UC2_PRIVATE_DATA;
-
-#define UC2_PRIVATE_DATA_FROM_THIS(a) CR (a, UC2_PRIVATE_DATA, Uc2, UC2_PRIVATE_DATA_SIGNATURE)
-
-//
-// Firmware Volume Protocol template
-//
-EFI_EVENT mUc2Registration;
-
-UC2_PRIVATE_DATA gUC2PrivateDataTemplate = {
- UC2_PRIVATE_DATA_SIGNATURE,
- {
- StriColl,
- MetaiMatch,
- StrLwr,
- StrUpr,
- FatToStr,
- StrToFat,
- NULL
- },
- NULL
-};
-
-//
-// Module globals
-//
-/**
- This notification function is invoked when an instance of the
- EFI_UNICODE_COLLATION_PROTOCOL is produced. It installs another instance of the
- EFI_UNICODE_COLLATION_PROTOCOL2 on the same handle.
-
- @param Event The event that occured
- @param Context Context of event. Not used in this nofication function.
-
-**/
-VOID
-EFIAPI
-UcNotificationEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HANDLE Handle;
- UC2_PRIVATE_DATA *Private;
- EFI_UNICODE_COLLATION_PROTOCOL *Uc2;
-
- while (TRUE) {
- BufferSize = sizeof (Handle);
- Status = gBS->LocateHandle (
- ByRegisterNotify,
- &gEfiUnicodeCollationProtocolGuid,
- mUc2Registration,
- &BufferSize,
- &Handle
- );
- if (EFI_ERROR (Status)) {
- //
- // Exit Path of While Loop....
- //
- break;
- }
-
- //
- // Skip this handle if the Firmware Volume Protocol is already installed
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiUnicodeCollation2ProtocolGuid,
- (VOID **)&Uc2
- );
- if (!EFI_ERROR (Status)) {
- continue;
- }
-
- //
- // Allocate private data structure
- //
- Private = AllocateCopyPool (sizeof (UC2_PRIVATE_DATA), &gUC2PrivateDataTemplate);
- if (Private == NULL) {
- continue;
- }
-
- //
- // Retrieve the UC Protocol
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiUnicodeCollationProtocolGuid,
- (VOID **)&Private->Uc
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Fill in rest of private data structure
- //
- Private->Uc2.SupportedLanguages = ConvertLanguagesIso639ToRfc4646 (Private->Uc->SupportedLanguages);
- if (Private->Uc2.SupportedLanguages != NULL) {
-
- //
- // Install UC2 Protocol onto same handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiUnicodeCollation2ProtocolGuid,
- &Private->Uc2,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- }
- }
-}
-
-
-/**
- The user Entry Point for DXE driver. The user code starts with this function
- as the real entry point for the image goes into a library that calls this
- function.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @retval other Some error occurs when executing this entry point.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeUC2 (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EfiCreateProtocolNotifyEvent (
- &gEfiUnicodeCollationProtocolGuid,
- TPL_CALLBACK,
- UcNotificationEvent,
- NULL,
- &mUc2Registration
- );
- return EFI_SUCCESS;
-}
-
-
-/**
- Performs a case-insensitive comparison of two Null-terminated strings.
-
- @param This Protocol instance pointer.
- @param Str1 A pointer to a Null-terminated string.
- @param Str2 A pointer to a Null-terminated string.
-
- @retval 0 Str1 is equivalent to Str2
- @retval > 0 Str1 is lexically greater than Str2
- @retval < 0 Str1 is lexically less than Str2
-
-**/
-INTN
-EFIAPI
-StriColl (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *Str1,
- IN CHAR16 *Str2
- )
-{
- UC2_PRIVATE_DATA *Private;
-
- Private = UC2_PRIVATE_DATA_FROM_THIS (This);
-
- return Private->Uc->StriColl (Private->Uc, Str1, Str2);
-}
-
-
-/**
- Converts all the characters in a Null-terminated string to
- lower case characters.
-
- @param This Protocol instance pointer.
- @param Str A pointer to a Null-terminated string.
-
-**/
-VOID
-EFIAPI
-StrLwr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN OUT CHAR16 *Str
- )
-{
- UC2_PRIVATE_DATA *Private;
-
- Private = UC2_PRIVATE_DATA_FROM_THIS (This);
-
- Private->Uc->StrLwr (Private->Uc, Str);
-}
-
-
-/**
- Converts all the characters in a Null-terminated string to upper
- case characters.
-
- @param This Protocol instance pointer.
- @param Str A pointer to a Null-terminated string.
-
-**/
-VOID
-EFIAPI
-StrUpr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN OUT CHAR16 *Str
- )
-{
- UC2_PRIVATE_DATA *Private;
-
- Private = UC2_PRIVATE_DATA_FROM_THIS (This);
-
- Private->Uc->StrUpr (Private->Uc, Str);
-}
-
-/**
- Performs a case-insensitive comparison of a Null-terminated
- pattern string and a Null-terminated string.
-
- @param This Protocol instance pointer.
- @param String A pointer to a Null-terminated string.
- @param Pattern A pointer to a Null-terminated pattern string.
-
- @retval TRUE Pattern was found in String.
- @retval FALSE Pattern was not found in String.
-
-**/
-BOOLEAN
-EFIAPI
-MetaiMatch (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *String,
- IN CHAR16 *Pattern
- )
-{
- UC2_PRIVATE_DATA *Private;
-
- Private = UC2_PRIVATE_DATA_FROM_THIS (This);
-
- return Private->Uc->MetaiMatch (Private->Uc, String, Pattern);
-}
-
-
-/**
- Converts an 8.3 FAT file name in an OEM character set to a Null-terminated string.
-
- @param This Protocol instance pointer.
- @param FatSize The size of the string Fat in bytes.
- @param Fat A pointer to a Null-terminated string that contains an 8.3 file
- name using an 8-bit OEM character set.
- @param String A pointer to a Null-terminated string. The string must
- be preallocated to hold FatSize characters.
-
-**/
-VOID
-EFIAPI
-FatToStr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN UINTN FatSize,
- IN CHAR8 *Fat,
- OUT CHAR16 *String
- )
-{
- UC2_PRIVATE_DATA *Private;
-
- Private = UC2_PRIVATE_DATA_FROM_THIS (This);
-
- Private->Uc->FatToStr (Private->Uc, FatSize, Fat, String);
-}
-
-
-/**
- Converts a Null-terminated string to legal characters in a FAT
- filename using an OEM character set.
-
- @param This Protocol instance pointer.
- @param String A pointer to a Null-terminated string. The string must
- be preallocated to hold FatSize characters.
- @param FatSize The size of the string Fat in bytes.
- @param Fat A pointer to a Null-terminated string that contains an 8.3 file
- name using an OEM character set.
-
- @retval TRUE Fat is a Long File Name
- @retval FALSE Fat is an 8.3 file name
-
-**/
-BOOLEAN
-EFIAPI
-StrToFat (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *String,
- IN UINTN FatSize,
- OUT CHAR8 *Fat
- )
-{
- UC2_PRIVATE_DATA *Private;
-
- Private = UC2_PRIVATE_DATA_FROM_THIS (This);
-
- return Private->Uc->StrToFat (Private->Uc, String, FatSize, Fat);
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.inf b/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.inf
deleted file mode 100644
index c7c4f7e35a..0000000000
--- a/EdkCompatibilityPkg/Compatibility/Uc2OnUcThunk/Uc2OnUcThunk.inf
+++ /dev/null
@@ -1,63 +0,0 @@
-## @file
-# Module produce UC2 on top of UC.
-#
-# UEFI 2.1 specification supersedes Inte's EFI Specification 1.10.
-# UNICODE_COLLATION_PROTOCOL defined in Inte's EFI Specification 1.10 is replaced by
-# EFI_UNICODE_COLLATION_PROTOCOL in UEFI 2.1.
-# This module produces UC2 on top of UC. This module is used on platform when both of
-# these two conditions are true:
-# 1) EFI 1.10 module producing UC present
-# 2) And the rest of modules on the platform consume UC2
-#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = Uc2OnUcThunk
- FILE_GUID = 69282DF3-778F-4269-91AA-D7DF6E193317
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeUC2
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- Uc2OnUcThunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- BaseLib
- DebugLib
- UefiLib
- MemoryAllocationLib
- HiiLib
- BaseMemoryLib
- LanguageLib
-
-[Protocols]
- gEfiUnicodeCollation2ProtocolGuid
- gEfiUnicodeCollationProtocolGuid
-
-[Depex]
- TRUE
diff --git a/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.c b/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.c
deleted file mode 100644
index 1a2c3914ef..0000000000
--- a/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.c
+++ /dev/null
@@ -1,461 +0,0 @@
-/** @file
-Module produce UC on top of UC2.
-
-UEFI 2.1 specification supersedes Inte's EFI Specification 1.10.
-UNICODE_COLLATION_PROTOCOL defined in Inte's EFI Specification 1.10 is replaced by
-EFI_UNICODE_COLLATION_PROTOCOL in UEFI 2.1.
-This module produces UC on top of UC2. This module is used on platform when both of
-these two conditions are true:
-1) EFI 1.10 module consuming UC present
-2) And the rest of modules on the platform produce UC2
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-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:
-
-**/
-
-#include <PiDxe.h>
-#include <Protocol/UnicodeCollation.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/HiiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/LanguageLib.h>
-
-/**
- Performs a case-insensitive comparison of two Null-terminated strings.
-
- @param This Protocol instance pointer.
- @param Str1 A pointer to a Null-terminated string.
- @param Str2 A pointer to a Null-terminated string.
-
- @retval 0 Str1 is equivalent to Str2
- @retval > 0 Str1 is lexically greater than Str2
- @retval < 0 Str1 is lexically less than Str2
-
-**/
-INTN
-EFIAPI
-StriColl (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *Str1,
- IN CHAR16 *Str2
- );
-
-/**
- Converts all the characters in a Null-terminated string to
- lower case characters.
-
- @param This Protocol instance pointer.
- @param Str A pointer to a Null-terminated string.
-
-**/
-VOID
-EFIAPI
-StrLwr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN OUT CHAR16 *Str
- );
-
-/**
- Converts all the characters in a Null-terminated string to upper
- case characters.
-
- @param This Protocol instance pointer.
- @param Str A pointer to a Null-terminated string.
-
-**/
-VOID
-EFIAPI
-StrUpr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN OUT CHAR16 *Str
- );
-
-/**
- Performs a case-insensitive comparison of a Null-terminated
- pattern string and a Null-terminated string.
-
- @param This Protocol instance pointer.
- @param String A pointer to a Null-terminated string.
- @param Pattern A pointer to a Null-terminated pattern string.
-
- @retval TRUE Pattern was found in String.
- @retval FALSE Pattern was not found in String.
-
-**/
-BOOLEAN
-EFIAPI
-MetaiMatch (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *String,
- IN CHAR16 *Pattern
- );
-
-/**
- Converts an 8.3 FAT file name in an OEM character set to a Null-terminated string.
-
- @param This Protocol instance pointer.
- @param FatSize The size of the string Fat in bytes.
- @param Fat A pointer to a Null-terminated string that contains an 8.3 file
- name using an OEM character set.
- @param String A pointer to a Null-terminated string. The string must
- be preallocated to hold FatSize characters.
-
-**/
-VOID
-EFIAPI
-FatToStr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN UINTN FatSize,
- IN CHAR8 *Fat,
- OUT CHAR16 *String
- );
-
-/**
- Converts a Null-terminated string to legal characters in a FAT
- filename using an OEM character set.
-
- @param This Protocol instance pointer.
- @param String A pointer to a Null-terminated string. The string must
- be preallocated to hold FatSize characters.
- @param FatSize The size of the string Fat in bytes.
- @param Fat A pointer to a Null-terminated string that contains an 8.3 file
- name using an OEM character set.
-
- @retval TRUE Fat is a Long File Name
- @retval FALSE Fat is an 8.3 file name
-
-**/
-BOOLEAN
-EFIAPI
-StrToFat (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *String,
- IN UINTN FatSize,
- OUT CHAR8 *Fat
- );
-
-#define UC_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('_', 'U', 'C', '_')
-
-typedef struct {
- UINT32 Signature;
- EFI_UNICODE_COLLATION_PROTOCOL Uc;
- EFI_UNICODE_COLLATION_PROTOCOL *Uc2;
-} UC_PRIVATE_DATA;
-
-#define UC_PRIVATE_DATA_FROM_THIS(a) CR (a, UC_PRIVATE_DATA, Uc, UC_PRIVATE_DATA_SIGNATURE)
-
-//
-// Firmware Volume Protocol template
-//
-EFI_EVENT mUcRegistration;
-
-UC_PRIVATE_DATA gUCPrivateDataTemplate = {
- UC_PRIVATE_DATA_SIGNATURE,
- {
- StriColl,
- MetaiMatch,
- StrLwr,
- StrUpr,
- FatToStr,
- StrToFat,
- NULL
- },
- NULL
-};
-
-//
-// Module globals
-//
-/**
- This notification function is invoked when an instance of the
- EFI_UNICODE_COLLATION_PROTOCOL2 is produced. It installs another instance of the
- EFI_UNICODE_COLLATION_PROTOCOL on the same handle.
-
- @param Event The event that occured
- @param Context Context of event. Not used in this nofication function.
-
-**/
-VOID
-EFIAPI
-Uc2NotificationEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HANDLE Handle;
- UC_PRIVATE_DATA *Private;
- EFI_UNICODE_COLLATION_PROTOCOL *Uc2;
-
- while (TRUE) {
- BufferSize = sizeof (Handle);
- Status = gBS->LocateHandle (
- ByRegisterNotify,
- &gEfiUnicodeCollation2ProtocolGuid,
- mUcRegistration,
- &BufferSize,
- &Handle
- );
- if (EFI_ERROR (Status)) {
- //
- // Exit Path of While Loop....
- //
- break;
- }
-
- //
- // Skip this handle if the Firmware Volume Protocol is already installed
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiUnicodeCollationProtocolGuid,
- (VOID **)&Uc2
- );
- if (!EFI_ERROR (Status)) {
- continue;
- }
-
- //
- // Allocate private data structure
- //
- Private = AllocateCopyPool (sizeof (UC_PRIVATE_DATA), &gUCPrivateDataTemplate);
- if (Private == NULL) {
- continue;
- }
-
- //
- // Retrieve the UC Protocol
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiUnicodeCollation2ProtocolGuid,
- (VOID **)&Private->Uc2
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Fill in rest of private data structure
- //
- Private->Uc.SupportedLanguages = ConvertLanguagesRfc4646ToIso639 (Private->Uc2->SupportedLanguages);
-
- if (Private->Uc.SupportedLanguages != NULL) {
-
- //
- // Install Firmware Volume Protocol onto same handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiUnicodeCollationProtocolGuid,
- &Private->Uc,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- }
- }
-}
-
-
-/**
- The user Entry Point for DXE driver. The user code starts with this function
- as the real entry point for the image goes into a library that calls this
- function.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @retval other Some error occurs when executing this entry point.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeUC (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EfiCreateProtocolNotifyEvent (
- &gEfiUnicodeCollation2ProtocolGuid,
- TPL_CALLBACK,
- Uc2NotificationEvent,
- NULL,
- &mUcRegistration
- );
- return EFI_SUCCESS;
-}
-
-
-/**
- Performs a case-insensitive comparison of two Null-terminated strings.
-
- @param This Protocol instance pointer.
- @param Str1 A pointer to a Null-terminated string.
- @param Str2 A pointer to a Null-terminated string.
-
- @retval 0 Str1 is equivalent to Str2
- @retval > 0 Str1 is lexically greater than Str2
- @retval < 0 Str1 is lexically less than Str2
-
-**/
-INTN
-EFIAPI
-StriColl (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *Str1,
- IN CHAR16 *Str2
- )
-{
- UC_PRIVATE_DATA *Private;
-
- Private = UC_PRIVATE_DATA_FROM_THIS (This);
-
- return Private->Uc2->StriColl (Private->Uc2, Str1, Str2);
-}
-
-
-/**
- Converts all the characters in a Null-terminated string to
- lower case characters.
-
- @param This Protocol instance pointer.
- @param Str A pointer to a Null-terminated string.
-
-**/
-VOID
-EFIAPI
-StrLwr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN OUT CHAR16 *Str
- )
-{
- UC_PRIVATE_DATA *Private;
-
- Private = UC_PRIVATE_DATA_FROM_THIS (This);
-
- Private->Uc2->StrLwr (Private->Uc2, Str);
-}
-
-
-/**
- Converts all the characters in a Null-terminated string to upper
- case characters.
-
- @param This Protocol instance pointer.
- @param Str A pointer to a Null-terminated string.
-
-**/
-VOID
-EFIAPI
-StrUpr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN OUT CHAR16 *Str
- )
-{
- UC_PRIVATE_DATA *Private;
-
- Private = UC_PRIVATE_DATA_FROM_THIS (This);
-
- Private->Uc2->StrUpr (Private->Uc2, Str);
-}
-
-/**
- Performs a case-insensitive comparison of a Null-terminated
- pattern string and a Null-terminated string.
-
- @param This Protocol instance pointer.
- @param String A pointer to a Null-terminated string.
- @param Pattern A pointer to a Null-terminated pattern string.
-
- @retval TRUE Pattern was found in String.
- @retval FALSE Pattern was not found in String.
-
-**/
-BOOLEAN
-EFIAPI
-MetaiMatch (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *String,
- IN CHAR16 *Pattern
- )
-{
- UC_PRIVATE_DATA *Private;
-
- Private = UC_PRIVATE_DATA_FROM_THIS (This);
-
- return Private->Uc2->MetaiMatch (Private->Uc2, String, Pattern);
-}
-
-
-/**
- Converts an 8.3 FAT file name in an OEM character set to a Null-terminated string.
-
- @param This Protocol instance pointer.
- @param FatSize The size of the string Fat in bytes.
- @param Fat A pointer to a Null-terminated string that contains an 8.3 file
- name using an 8-bit OEM character set.
- @param String A pointer to a Null-terminated string. The string must
- be preallocated to hold FatSize characters.
-
-**/
-VOID
-EFIAPI
-FatToStr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN UINTN FatSize,
- IN CHAR8 *Fat,
- OUT CHAR16 *String
- )
-{
- UC_PRIVATE_DATA *Private;
-
- Private = UC_PRIVATE_DATA_FROM_THIS (This);
-
- Private->Uc2->FatToStr (Private->Uc2, FatSize, Fat, String);
-}
-
-
-/**
- Converts a Null-terminated string to legal characters in a FAT
- filename using an OEM character set.
-
- @param This Protocol instance pointer.
- @param String A pointer to a Null-terminated string. The string must
- be preallocated to hold FatSize characters.
- @param FatSize The size of the string Fat in bytes.
- @param Fat A pointer to a Null-terminated string that contains an 8.3 file
- name using an OEM character set.
-
- @retval TRUE Fat is a Long File Name
- @retval FALSE Fat is an 8.3 file name
-
-**/
-BOOLEAN
-EFIAPI
-StrToFat (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *String,
- IN UINTN FatSize,
- OUT CHAR8 *Fat
- )
-{
- UC_PRIVATE_DATA *Private;
-
- Private = UC_PRIVATE_DATA_FROM_THIS (This);
-
- return Private->Uc2->StrToFat (Private->Uc2, String, FatSize, Fat);
-}
-
diff --git a/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.inf b/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.inf
deleted file mode 100644
index d6c819213e..0000000000
--- a/EdkCompatibilityPkg/Compatibility/UcOnUc2Thunk/UcOnUc2Thunk.inf
+++ /dev/null
@@ -1,63 +0,0 @@
-## @file
-# Module produce UC on top of UC2.
-#
-# UEFI 2.1 specification supersedes Inte's EFI Specification 1.10.
-# UNICODE_COLLATION_PROTOCOL defined in Inte's EFI Specification 1.10 is replaced by
-# EFI_UNICODE_COLLATION_PROTOCOL in UEFI 2.1.
-# This module produces UC on top of UC2. This module is used on platform when both of
-# these two conditions are true:
-# 1) EFI 1.10 module consuming UC present
-# 2) And the rest of modules on the platform produce UC2
-#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-#
-# 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.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = UcOnUc2Thunk
- FILE_GUID = FD76FF8E-665F-4afc-AF75-724EF5A569E5
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeUC
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- UcOnUc2Thunk.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- EdkCompatibilityPkg/EdkCompatibilityPkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- UefiBootServicesTableLib
- BaseLib
- DebugLib
- UefiLib
- MemoryAllocationLib
- HiiLib
- BaseMemoryLib
- LanguageLib
-
-[Protocols]
- gEfiUnicodeCollation2ProtocolGuid
- gEfiUnicodeCollationProtocolGuid
-
-[Depex]
- TRUE