* [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor
@ 2019-11-13 3:27 Kubacki, Michael A
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 01/49] AdvancedFeaturePkg: Package DSC style cleanup Kubacki, Michael A
` (47 more replies)
0 siblings, 48 replies; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel
Cc: Agyeman Prince, Chasel Chiu, Dandan Bi, Eric Dong, Isaac W Oram,
Liming Gao, Nate DeSimone, Sai Chaganty, Wei David Y
RFC:https://edk2.groups.io/g/devel/message/49880
This patch series introduces a consistent design for Intel advanced features.
Advanced features in this context refer to the definition stated in
the EDK II Minimum Platform specification. Information regarding
this feature design is provided in Features/Intel/Readme.md.
An RFC was sent to the mailing list on 11/1/2019 that stated the
intention of creating the Features directory in edk2-platforms for
this purpose and that change is implemented in this patch series.
Testing performed:
* Feature packages and board packages build successfully
* Board packages boot successfully to their supported OS
* Board package Stage 4 and Stage 6 tested
The actual feature source implementation was not functionally
modified. Any issues reported by PatchCheck.py were fixed.
Future changes will be made to individually address improving the
quality of each feature and to add new features.
This patch series is intended to provide a foundation for future
changes to the advanced feature design as an incremental improvement
over the current state and should not be considered the final state.
Cc: Agyeman Prince <prince.agyeman@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Isaac W Oram <isaac.w.oram@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Wei David Y <david.y.wei@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
Michael Kubacki (49):
AdvancedFeaturePkg: Package DSC style cleanup
DebugFeaturePkg: Package DSC style cleanup
UserInterfaceFeaturePkg: Package DSC style cleanup
Features/Intel: Add Readme.md
Features/Intel/PowerManagement: Add Readme.md
Features/Intel/OutOfBandManagement: Add Readme.md
Features/Intel/SystemInformation: Add Readme.md
Features/Intel/Debug: Add Readme.md
Features/Intel/UserInterface: Add Readme.md
Features/Intel/Network: Add Readme.md
TemplateFeaturePkg: Add initial package
SimicsOpenBoardPkg: Remove advanced feature references
AdvancedFeaturePkg: Remove the S3 feature
Features/Intel: Add S3FeaturePkg
AdvancedFeaturePkg: Remove the IPMI feature
Features/Intel/IpmiFeaturePkg: Add initial package
Features/Intel/IpmiFeaturePkg: Add libraries
Features/Intel/IpmiFeaturePkg: Add modules
AdvancedFeaturePkg: Remove the SMBIOS feature
Features/Intel/SmbiosFeaturePkg: Add initial package
Features/Intel/SmbiosFeaturePkg: Update default strings
DebugFeaturePkg: Remove the ACPI Debug feature
Features/Intel/AcpiDebugFeaturePkg: Add initial package
DebugFeaturePkg: Remove the USB3 Debug feature
Features/Intel/Usb3DebugFeaturePkg: Add initial package
UserInterfaceFeaturePkg: Remove the User Authentication feature
Features/Intel/UserAuthFeaturePkg: Add initial package
Features/Intel/NetworkFeaturePkg: Add initial package
AdvancedFeaturePkg: Remove remaining contents
AdvancedFeaturePkg: Move to Features/Intel
AdvancedFeaturePkg: Add feature build support
AdvancedFeaturePkg: Add temporary build workaround
AdvancedFeaturePkg: Add FDF include files
KabylakeOpenBoardPkg/KabylakeRvp3: Add PEI_ARCH and DXE_ARCH
KabylakeOpenBoardPkg/GalagoPro3: Add PEI_ARCH and DXE_ARCH
WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add PEI_ARCH and DXE_ARCH
SimicsOpenBoardPkg/BoardX58Ich10: Use PEI_ARCH and DXE_ARCH
MinPlatformPkg: Add FvAdvancedPreMemory
KabylakeOpenBoardPkg/KabylakeRvp3: Add FvAdvancedPreMemory
KabylakeOpenBoardPkg/GalagoPro3: Add FvAdvancedPreMemory
WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add FvAdvancedPreMemory
Platform/Intel: Add advanced feature build support
Platform/Intel/Readme.md Content update
KabylakeOpenBoardPkg/GalagoPro3: Enable advanced features
KabylakeOpenBoardPkg/KabylakeRvp3: Enable advanced features
WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Enable advanced features
SimicsOpenBoardPkg: Enable advanced features
MinPlatformPkg: Install advanced feature FVs by stage enabled
Maintainers.txt: Update Intel feature maintainers
Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 31 +++
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec | 39 ++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec | 57 +++++
Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec | 30 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec | 46 ++++
Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dec | 30 +++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec | 172 +++++++++++++++
Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec | 30 +++
Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec | 24 +-
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 153 -------------
Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec | 66 ------
Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec | 4 +
Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 53 +++++
Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc | 56 +++++
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc | 74 +++++++
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc | 30 +++
Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeature.dsc | 125 +++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc | 149 +++++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dsc | 30 +++
Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc | 152 +++++++++++++
Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc | 30 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc | 144 ++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc | 31 +++
Features/Intel/PowerManagement/S3FeaturePkg/Include/S3Feature.dsc | 122 ++++++++++
Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dsc | 30 +++
Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc | 115 ++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc | 30 +++
Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc | 113 ++++++++++
Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc | 30 +++
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc | 141 ++++++++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dsc | 30 +++
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 156 -------------
Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc | 19 --
Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.dsc | 9 -
Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc | 101 ---------
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc | 62 +++---
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkgPcd.dsc | 1 +
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc | 61 +++--
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc | 1 +
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 25 ++-
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc | 12 +-
Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc | 80 -------
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc | 60 +++--
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkgPcd.dsc | 1 +
Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf | 57 +++++
Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf | 57 +++++
Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf | 11 +
Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf | 8 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf | 10 +
Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf | 16 ++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf | 11 +
Features/Intel/PowerManagement/S3FeaturePkg/Include/PostMemory.fdf | 8 +
Features/Intel/PowerManagement/S3FeaturePkg/Include/PreMemory.fdf | 10 +
Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf | 10 +
Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf | 8 +
Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf | 12 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf | 8 +
Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf | 20 --
Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf | 8 -
Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf | 9 -
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapInclude.fdf | 20 +-
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf | 48 ++--
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMapInclude.fdf | 30 +--
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf | 48 ++--
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf | 10 +-
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf | 24 +-
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf | 48 ++--
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.inf | 57 +++++
{Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebugDxe.inf | 10 +-
{Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebugSmm.inf | 11 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf | 12 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf | 12 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf | 3 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf | 10 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf | 10 +-
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf | 31 +++
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi.inf | 9 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog.inf | 5 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.inf | 10 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.inf | 10 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.inf | 4 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiInit.inf | 6 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiInit.inf | 6 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLib.inf | 6 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf | 9 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.inf | 7 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStatus.inf | 13 +-
{Platform/Intel/AdvancedFeaturePkg/S3 => Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.inf | 16 +-
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf | 83 +++++++
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf | 5 +-
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLib/UserPasswordLib.inf | 2 +-
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordUiLib/UserPasswordUiLib.inf | 2 +-
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthentication2Dxe.inf | 3 +-
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxe.inf | 3 +-
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationSmm.inf | 2 +-
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf | 28 ---
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf | 83 -------
Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf | 31 ---
Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf | 43 ++--
Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 1 -
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Include/Library/Usb3DebugPortLib.h | 0
Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameterLib.h => Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortParamLib.h | 0
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/IpmiCommandLib.h | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/IpmiPlatformHookLib.h | 0
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/SmbiosBasic.h | 4 +-
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Guid/UserAuthentication.h | 0
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/PlatformPasswordLib.h | 0
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPasswordLib.h | 0
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPasswordUiLib.h | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/KeyService.h | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthentication2Dxe.h | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxe.h | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxeFormset.h | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationSmm.h | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxeVfr.vfr | 0
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c | 31 +++
{Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebug.c | 54 +++--
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/MiscServices.c | 0
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c | 2 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c | 2 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c | 4 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c | 4 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c | 0
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c | 2 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c | 2 +-
Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.c => Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.c | 2 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.c | 2 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.c | 4 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiInit.c | 8 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiInit.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.c | 2 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStatus.c | 6 +-
{Platform/Intel/AdvancedFeaturePkg/S3 => Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.c | 0
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/SmbiosBasicEntryPoint.c | 8 +-
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type0BiosVendorFunction.c | 2 +-
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type1SystemManufacturerFunction.c | 2 +-
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c | 0
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type32BootInformationFunction.c | 0
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c | 0
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c | 0
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLib/UserPasswordLib.c | 0
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordUiLib/UserPasswordUiLib.c | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/KeyService.c | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthentication2Dxe.c | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxe.c | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxePassword.c | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationSmm.c | 0
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c | 45 ----
Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c | 38 +++-
{Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebug.asl | 3 +-
Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md | 121 ++++++++++
Features/Intel/Debugging/Readme.md | 7 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md | 86 ++++++++
Features/Intel/Network/NetworkFeaturePkg/Readme.md | 89 ++++++++
Features/Intel/Network/Readme.md | 5 +
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt/BmcSsdt.asl | 8 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt/IpmiOprRegions.asi | 10 +-
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md | 86 ++++++++
Features/Intel/OutOfBandManagement/Readme.md | 8 +
Features/Intel/PowerManagement/Readme.md | 10 +
Features/Intel/PowerManagement/S3FeaturePkg/Readme.md | 86 ++++++++
Features/Intel/Readme.md | 232 ++++++++++++++++++++
Features/Intel/SystemInformation/Readme.md | 8 +
Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md | 86 ++++++++
Features/Intel/TemplateFeaturePkg/Readme.md | 71 ++++++
Features/Intel/UserInterface/Readme.md | 9 +
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni | 0
Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md | 86 ++++++++
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxeStrings.uni | 0
Maintainers.txt | 26 +--
Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt | 31 ---
Platform/Intel/Readme.md | 14 +-
Platform/Intel/build.cfg | 1 +
Platform/Intel/build_bios.py | 3 +
188 files changed, 3854 insertions(+), 1285 deletions(-)
create mode 100644 Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
create mode 100644 Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
create mode 100644 Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec
create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
create mode 100644 Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dec
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
create mode 100644 Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec
rename Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec (53%)
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
delete mode 100644 Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec
create mode 100644 Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
create mode 100644 Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
create mode 100644 Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc
create mode 100644 Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc
create mode 100644 Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeature.dsc
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dsc
create mode 100644 Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc
create mode 100644 Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc
create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
create mode 100644 Features/Intel/PowerManagement/S3FeaturePkg/Include/S3Feature.dsc
create mode 100644 Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dsc
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc
create mode 100644 Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc
create mode 100644 Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc
create mode 100644 Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc
create mode 100644 Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dsc
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.dsc
delete mode 100644 Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
create mode 100644 Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/PowerManagement/S3FeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/PowerManagement/S3FeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf
create mode 100644 Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.inf
rename {Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebugDxe.inf (77%)
rename {Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebugSmm.inf (74%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf (74%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf (78%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf (92%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf (74%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf (76%)
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi.inf (78%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog.inf (78%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.inf (77%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.inf (64%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.inf (78%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiInit.inf (79%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiInit.inf (78%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLib.inf (80%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf (74%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.inf (79%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStatus.inf (66%)
rename {Platform/Intel/AdvancedFeaturePkg/S3 => Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.inf (52%)
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf (88%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLib/UserPasswordLib.inf (91%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordUiLib/UserPasswordUiLib.inf (91%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthentication2Dxe.inf (92%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxe.inf (93%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationSmm.inf (92%)
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Include/Library/Usb3DebugPortLib.h (100%)
rename Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameterLib.h => Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortParamLib.h (100%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/IpmiCommandLib.h (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/IpmiPlatformHookLib.h (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/SmbiosBasic.h (90%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Guid/UserAuthentication.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/PlatformPasswordLib.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPasswordLib.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPasswordUiLib.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/KeyService.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthentication2Dxe.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxe.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxeFormset.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationSmm.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxeVfr.vfr (100%)
create mode 100644 Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c
rename {Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebug.c (90%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/MiscServices.c (100%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c (96%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c (96%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c (95%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c (95%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c (100%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c (95%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c (95%)
rename Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.c => Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.c (92%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.c (95%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.c (94%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiInit.c (93%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiInit.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.c (94%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStatus.c (94%)
rename {Platform/Intel/AdvancedFeaturePkg/S3 => Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/SmbiosBasicEntryPoint.c (89%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type0BiosVendorFunction.c (95%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type1SystemManufacturerFunction.c (96%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type32BootInformationFunction.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLib/UserPasswordLib.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordUiLib/UserPasswordUiLib.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/KeyService.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthentication2Dxe.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxe.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxePassword.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationSmm.c (100%)
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c
rename {Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebug.asl (95%)
create mode 100644 Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md
create mode 100644 Features/Intel/Debugging/Readme.md
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md
create mode 100644 Features/Intel/Network/NetworkFeaturePkg/Readme.md
create mode 100644 Features/Intel/Network/Readme.md
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt/BmcSsdt.asl (87%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt/IpmiOprRegions.asi (91%)
create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md
create mode 100644 Features/Intel/OutOfBandManagement/Readme.md
create mode 100644 Features/Intel/PowerManagement/Readme.md
create mode 100644 Features/Intel/PowerManagement/S3FeaturePkg/Readme.md
create mode 100644 Features/Intel/Readme.md
create mode 100644 Features/Intel/SystemInformation/Readme.md
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md
create mode 100644 Features/Intel/TemplateFeaturePkg/Readme.md
create mode 100644 Features/Intel/UserInterface/Readme.md
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni (100%)
create mode 100644 Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxeStrings.uni (100%)
delete mode 100644 Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 01/49] AdvancedFeaturePkg: Package DSC style cleanup
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-14 2:00 ` Chaganty, Rangasai V
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 02/49] DebugFeaturePkg: " Kubacki, Michael A
` (46 subsequent siblings)
47 siblings, 2 replies; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
This change refactors AdvancedFeaturePkg.dsc to consolidate
redundant sections and better group file content to improve
maintainability and readability.
This pattern is being applied in all Minimum Platform package
DSC files.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 133 +++++++++++---------
1 file changed, 71 insertions(+), 62 deletions(-)
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index b2e7ab8302..b83e72b48c 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -1,5 +1,5 @@
## @file
-# Platform description.
+# Advanced Feature Package build description file.
#
# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
#
@@ -24,8 +24,7 @@
################################################################################
#
-# SKU Identification section - list of all SKU IDs supported by this
-# Platform.
+# SKU Identification section - list of all SKU IDs supported.
#
################################################################################
[SkuIds]
@@ -33,88 +32,93 @@
################################################################################
#
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform
+# Pcd Section - list of all EDK II PCD Entries defined by this package.
#
################################################################################
-
+
[PcdsFeatureFlag]
################################################################################
#
-# Library Class section - list of all Library Classes needed by this Platform.
+# Library Class section - list of all Library Classes needed by this package.
#
################################################################################
[LibraryClasses.common]
-
- PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
- PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
- DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
- SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
- PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
-
- #
- # Basic
- #
+ #######################################
+ # Edk2 Packages
+ #######################################
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
-
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ BasePciLibPciExpress|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
+ CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+ DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
+ HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
- PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
- PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
- BasePciLibPciExpress|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
-# PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
- CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
- PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+ PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
+ PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
+ PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+ PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+ PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
+ PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
+ PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+ PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
+ SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
- #
- # UEFI & PI
- #
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
+ UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
- UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
-
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
- PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
- PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
-
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
-
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
-
- TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
-
- IpmiPlatformHookLib|AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
- IpmiLib|AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
+ UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+
+ #######################################
+ # Advanced Feature Package
+ #######################################
IpmiCommandLib|AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf
+ IpmiLib|AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
+ IpmiPlatformHookLib|AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
[LibraryClasses.common.SEC,LibraryClasses.common.PEI_CORE,LibraryClasses.common.PEIM]
- PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+
+ #######################################
+ # Silicon Initialization Package
+ #######################################
SmmAccessLib|IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.inf
[LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE,LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRIVER,LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION]
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
[LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE]
+ #######################################
+ # Edk2 Packages
+ #######################################
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
###################################################################################################
@@ -137,20 +141,25 @@
###################################################################################################
[Components]
+ #######################################
+ # Advanced Feature Package
+ #######################################
- AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
- AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
- AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf
- AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf
+ # Add components here that should be included in the package build.
+ AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
+ AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf
+ AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf
+ AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
+ AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf
+ AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf
AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf
- AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
- AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
- AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
-
AdvancedFeaturePkg/S3/S3Pei.inf
+ AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
[BuildOptions]
- *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
\ No newline at end of file
+ *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 02/49] DebugFeaturePkg: Package DSC style cleanup
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 01/49] AdvancedFeaturePkg: Package DSC style cleanup Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 03/49] UserInterfaceFeaturePkg: " Kubacki, Michael A
` (45 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Eric Dong, Liming Gao
This change refactors DebugFeaturePkg.dsc to consolidate
redundant sections and better group file content to improve
maintainability and readability.
This pattern is being applied in all Minimum Platform package
DSC files.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc | 55 +++++++++++++-------
1 file changed, 37 insertions(+), 18 deletions(-)
diff --git a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
index 8e5ff4c9a3..efe705bd76 100644
--- a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
+++ b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
@@ -1,6 +1,6 @@
## @file
# This package provides the modules that build for debug feature.
-# This DebugFeaturePkg should only depend on EDKII Core packages and MinPlatformPkg.
+# This package should only depend on EDKII Core packages and MinPlatformPkg.
#
# The DEC files are used by the utilities that parse DSC and
# INF files to generate AutoGen.c and AutoGen.h files
@@ -23,46 +23,58 @@
SKUID_IDENTIFIER = DEFAULT
[LibraryClasses]
- #
- # Entry point
- #
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ #######################################
+ # Edk2 Packages
+ #######################################
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
[LibraryClasses.common.PEIM]
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
- #Usb3DebugPortLib|DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
-
-[LibraryClasses.IA32.PEIM, LibraryClasses.X64.PEIM]
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
[LibraryClasses.common.DXE_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
[LibraryClasses.common.UEFI_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
[LibraryClasses.common.DXE_RUNTIME_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
[LibraryClasses.common.DXE_SMM_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
@@ -87,13 +99,20 @@
###################################################################################################
[Components]
- DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf
- DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
- DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
+ #######################################
+ # Debug Feature Package
+ #######################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+ DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf
+ DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf
- DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
+ DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
+ DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf
+ # Add components here that should be included in the package build.
DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 03/49] UserInterfaceFeaturePkg: Package DSC style cleanup
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 01/49] AdvancedFeaturePkg: Package DSC style cleanup Kubacki, Michael A
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 02/49] DebugFeaturePkg: " Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 04/49] Features/Intel: Add Readme.md Kubacki, Michael A
` (44 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Dandan Bi, Liming Gao
This change refactors UserInterfaceFeaturePkg.dsc to consolidate
redundant sections and better group file content to improve
maintainability and readability.
This pattern is being applied in all Minimum Platform package
DSC files.
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc | 45 ++++++++++++++------
1 file changed, 33 insertions(+), 12 deletions(-)
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc b/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
index 6c5f77b59b..bd09052f3c 100644
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
+++ b/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
@@ -1,5 +1,6 @@
## @file
# This package provides UI related modules.
+# This package should only depend on EDKII Core packages and MinPlatformPkg.
#
# The DEC files are used by the utilities that parse DSC and
# INF files to generate AutoGen.c and AutoGen.h files
@@ -22,32 +23,45 @@
SKUID_IDENTIFIER = DEFAULT
[LibraryClasses]
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ #######################################
+ # Edk2 Packages
+ #######################################
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
- IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
- TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+
+ #####################################
+ # User Interface Feature Package
+ #####################################
PlatformPasswordLib|UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
UserPasswordLib|UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
[LibraryClasses.common.DXE_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
[LibraryClasses.common.DXE_SMM_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
- BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
###################################################################################################
#
@@ -68,10 +82,17 @@
#
###################################################################################################
[Components]
+ #####################################
+ # User Interface Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
+ # Add components here that should be included in the package build.
UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf
UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf
UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 04/49] Features/Intel: Add Readme.md
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (2 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 03/49] UserInterfaceFeaturePkg: " Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:47 ` Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 05/49] Features/Intel/PowerManagement: " Kubacki, Michael A
` (43 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel
Cc: Dandan Bi, Sai Chaganty, Chasel Chiu, Wei David Y, Nate DeSimone,
Eric Dong, Liming Gao, Agyeman Prince
This change adds the initial Readme.md to the root of the Features/
Intel directory. The features are maintained in an Intel
directory because they are not tested on other systems. If there
is interest to support a feature on systems other than Intel, the
feature should be tested on those other systems and the feature can
be promoted above the Intel directory.
This Readme.md is the most important file in the Features/Intel tree
as it provides the desired attributes and definition of advanced
features, the advanced feature source layout, and the new feature
creation checklist. This is the primary documentation file for new
users to understand advanced features.
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Wei David Y <david.y.wei@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Agyeman Prince <prince.agyeman@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/Readme.md | 232 ++++++++++++++++++++
1 file changed, 232 insertions(+)
diff --git a/Features/Intel/Readme.md b/Features/Intel/Readme.md
new file mode 100644
index 0000000000..a2b081eb37
--- /dev/null
+++ b/Features/Intel/Readme.md
@@ -0,0 +1,232 @@
+# **EDK II Minimum Platform Firmware Advanced Features for Intel® Platforms**
+
+In the EDK II Minimum Platform, advanced features are non-essential features. Essential features are those required
+to achieve an earlier boot stage (Stage I through Stage V). The Minimum Platform boot stages are defined in the
+[EDK II Minimum Platform Draft Specification](https://edk2-docs.gitbooks.io/edk-ii-minimum-platform-specification/). A
+brief overview is also provided in the [Platfom/Intel/Readme.md](https://github.com/tianocore/edk2-platforms/blob/master/Platform/Intel/Readme.md).
+
+An advanced feature must be implemented as highly cohesive and stand-alone software to only support a specific
+feature. Advanced features are the primary method to extend platform firmware capabilities in a modular fashion.
+
+If you would like to quickly get started creating a new advanced feature, you can jump ahead to the
+[Add New Advanced Feature Checklist](#Add-New-Advanced-Feature-Checklist) and reference other sections of this
+document as needed.
+
+## Overview
+
+### Advanced Feature Attributes
+Advanced features should be:
+* _Cohesive_, the feature should not contain any functionality unrelated to the feature.
+* _Complete_, the feature must have a complete design that minimizes dependencies. A feature package cannot directly
+ depend on another feature package.
+* _Easy to Integrate_, the feature should expose well-defined software interfaces to use and configure the feature.
+ * It should also present a set of simple and well-documented standard EDK II configuration options such as PCDs to
+ configure the feature.
+ * In general, features should be self-contained and started by the dispatcher. The board firmware should
+ be required to perform as few steps as possible to enable the feature.
+ * All features are required to have a feature enable PCD (`PcdFeatureEnable`). Any effort to enable the feature
+ besides this PCD should be carefully considered. Default configuration values should apply to the common case.
+* _Portable_, the feature is not allowed to depend on other advanced feature or board source code packages. For example,
+ if Feature A depends on output Feature B, a board integration module should use a generic interface in Feature A
+ to get the output and pass it to a generic interface in Feature B. Structures should not be shared between feature
+ packages. Most structures should be defined in a common package such as MdePkg if the structure is industry standard,
+ IntelSiliconPkg if the structure is specific to Intel silicon initialization, etc. Feature-specific structures are
+ of course allowed to be defined within a feature package and used by libraries and modules in that package.
+* _Self Documenting_, the feature should follow software best practices to allow others to debug the code and
+ contribute changes. In addition to source code, advanced features must have a Readme.md with sufficient
+ information for a newcomer to understand the feature.
+* _Single Instance_, the feature should not have more than one instance of a source solution. If an existing feature
+ package does not solve a specific instance of a problem for the feature, the feature package should be re-worked
+ to consider new requirements instead of duplicating feature code.
+
+ Features should be written for a specific feature technology. Outside of technology restrictions, the feature
+ should not make arbitrary assumptions about the type of board or system that may integrate the feature. Any
+ board or hardware-specific details that may vary in design should be given to the feature through a defined
+ and documented software interface.
+
+### Advanced Feature Packages
+Feature portability is a key aspect of board scalability. To maintain high cohesion within a feature package and
+reduce potential coupling between features, each feature is maintained in a dedicated package. Such encapsulation enables
+increased flexibility in implementation, rapid integration with board firmware, improved software maintenance by reducing
+coupling between features, and a better scope for feature-focused maintenance and testing over time.
+
+Two package types exist for advanced features:
+ * AdvancedFeaturePkg - A special package described further in [AdvancedFeaturePkg](#AdvancedFeaturePkg).
+ * XxxFeaturePkg - A specific feature package described further in [XxxFeaturePkg](#XxxFeaturePkg).
+
+#### AdvancedFeaturePkg
+A single package called `AdvancedFeaturePkg` exists with the following responsibilities:
+1. Present a consolidated and simplified view of all available advanced features to board packages.
+2. Provide a single package build for all available advanced features.
+ 2.a. This can save time. Each feature package will send build output to a package-specific build output directory.
+ By building a features from a single package build object files can be reused across features.
+
+##### Template Resources
+A template for a new advanced feature package is provided in `TemplateFeaturePkg`. It is recommended to start
+a new advanced feature package using this template. The minimally required set of files for an advanced feature to
+be acceptable is defined in [Advanced Feature Collateral](#Advanced-Feature-Collateral). Apart from required files,
+the content organization within the files should follow the layout provided in the template files.
+
+##### Consolidated View of All Advanced Features to Board Packages
+A board package may consume any number of advanced features. In order to reduce the overall effort required to add
+advanced features, all available advanced features are consolidated into single includable files in `AdvancedFeaturePkg`.
+
+_DSC File_
+
+All advanced features are importable to a board package DSC file by simply including `AdvancedFeatures.dsc`.
+`AdvancedFeatures.dsc` already includes the conditional logic to only include features that are enabled by the board package.
+
+_FDF File_
+
+The EDK II Minimum Platform has two firmware volumes to contain advanced features.
+
+1. `FvAdvancedPreMemory` - Contains advanced feature modules that should be dispatched before permanent memory is enabled.
+ Typically, these are PEI modules (PEIMs).
+2. `FvAdvanced` - Contains advanced feature modules that do not need to be executed prior to permanent memory being
+ initialized. Typically, these are post-memory PEIMs or DXE modules.
+
+##### Single Build of All Advanced Features
+With many advanced feature packages, it is convenient to have a single build target that can build all advanced features.
+The `AdvancedFeaturePkg.dsc` enables all the advanced features for its package build.
+
+#### XxxFeaturePkg
+Each feature is maintained in its own feature package called `XxxFeaturePkg` where *Xxx* is replaced by the feature
+name.
+
+### Source Code Organization of Advanced Features
+All advanced feature code is maintained in `edk2-platforms/Features`. Features that are only tested on Intel systems
+are maintained in `edk2-platforms/Features/Intel`. These features are not intended to be constrained to Intel systems.
+
+A package resides at the root of `edk2-platforms/Features/Intel` called [AdvancedFeaturePkg](#AdvancedFeaturePkg).
+All feature packages are organized into directories by feature domain. Each feature domain directory is required to
+have a `Readme.md` that explains the scope of features for that domain. Each feature package is required to have a
+`Readme.md` that explain the feature. All feature packages are required to base their `Readme.md` on the
+[template](TemplateFeaturePkg/Readme.md) provided in `TemplateFeaturePkg`.
+
+A generic tree layout of the advanced features is illustrated below. The contents are shown at the time of writing but
+of course, are subject to change over time.
+
+ <pre>
+ WORKSPACE
+ |------edk2
+ |------edk2-non-osi
+ |------edk2-platforms
+ | |---Features
+ | | |--Intel
+ | | |------AdvancedFeaturePkg
+ | | |
+ | | |------TemplateFeaturePkg
+ | | |
+ | | |------Debugging: Debug related advanced features
+ | | | |------AcpiDebugFeaturePkg
+ | | | | |---AcpiDebugDxeSmm (module directories)
+ | | | | |---. . .
+ | | | | |---Include
+ | | | | | |---AcpiDebugFeature.dsc (feature build DSC file)
+ | | | | | |---PostMemory.fdf (post-memory feature modules)
+ | | | | | |---PreMemory.fdf (pre-memory feature modules)
+ | | | | | |---. . .
+ | | | | |---AcpiDebugFeaturePkg.dec (feature package DEC file)
+ | | | | |---AcpiDebugFeature.dsc (feature package build DSC file)
+ | | | |
+ | | | |------Usb3DebugFeaturePkg
+ | | | | |---. . .
+ | | | |
+ | | | |------. . .
+ | | |------Network: Network related advanced features
+ | | | |------. . .
+ | | |
+ | | |------OutOfBandManagement: Out-of-Band Management related advanced features
+ | | | |------. . .
+ | | |
+ | | |------PowerManagement: Power Management related advanced features
+ | | | |------. . .
+ | | |
+ | | |------SystemInformation: System Information related advanced features
+ | | | |------. . .
+ | | |
+ | | |------UserInterface: User Interface related advanced features
+ | | | |------. . .
+ | | |
+ |------FSP
+ </pre>
+
+## Adding a New Advanced Feature
+
+### Advanced Feature Collateral
+At a minimum, an advanced feature must consist of the following elements:
+1. A feature package directory (`XxxFeaturePkg`)
+2. A `Readme.md` file in the feature package directory root to describe the feature
+3. Some advanced feature source code (e.g. a PEI or DXE module)
+4. A feature DSC file (`XxxFeaturePkg/Include/XxxFeature.dsc`)
+5. Feature pre-memory / post-memory FDF files (`XxxFeaturePkg/Include/PreMemory.fdf` & `XxxFeaturePkg/Include/PostMemory.fdf`)
+6. A feature package DSC file (`XxxFeaturePkg/XxxFeaturePkg.dsc`)
+7. A feature package DEC file (`XxxFeaturePkg/XxxFeaturePkg.dec`)
+8. A reference in the `AdvancedFeaturePkg` as described in the [checklist](#Add-New-Advanced-Feature-Checklist)
+
+### Add New Advanced Feature Checklist
+1. Check if a feature package already exists for your new feature.
+ * If it does, use the existing feature package. If changes are needed to meet your requirements, work with the
+ package maintainer to make any required updates to the existing package.
+
+2. Determine the functional domain of your feature. For example, "Debugging", "Power Management", etc. This should not be
+ very specific and abstracted so the feature is available alongside similar feature packages for the given domain. It
+ is preferred to keep the number of feature domain directories minimal but new directories can be created if needed.
+
+3. Decide on a succinct name for your feature package.
+ * The name should be descriptive enough to uniquely identify the feature from similar features in the same feature
+ domain.
+
+ * At this point, the feature package location is: `FeatureDomain/<Xxx>FeaturePkg`.
+
+ * For example, the ACPI Debug feature is located in `Debugging/AcpiDebugFeaturePkg` based on this naming pattern.
+
+4. Use the package template provided by `TemplateFeaturePkg` to create a new advanced feature package in the
+ feature location.
+
+5. Review the [advanced feature attributes](#Advanced-Feature-Attributes) to draft a feature design proposal.
+ * It is recommended to use the template in `TemplateFeaturePkg/Readme.md` to document the feature design for review.
+ Once the design review is approved, a subsequent review can be sent for the feature implementation. An advantage to
+ this approach is that the requirement to complete a Readme.md file for the feature and gain approval in a feature
+ design review are combined into a single step.
+
+6. Add the source code for the advanced feature.
+ * If the feature is large it is recommended to add libraries in one patch and then modules in a following patch.
+
+7. Update the feature DSC file. This file is in `XxxFeaturePkg/Include/XxxFeature.dsc`.
+ * In most cases, `XxxFeaturePkg/XxxFeaturePkg.dsc` should just `!include XxxFeaturePkg/Include/XxxFeature.dsc`.
+
+8. Update the feature FDF files. These files are `XxxFeaturePkg/Include/PreMemory.fdf` and
+ `XxxFeaturePkg/Include/PostMemory.fdf`.
+ * Each file should contain the feature pre-memory modules and post-memory modules respectively.
+
+9. Build the advanced feature package to ensure the build is successful:
+
+ From the workspace root:
+ 1. cd edk2-platforms/edk2
+ 2. Execute edksetup.bat (Windows) or edksetup.sh (Linux).
+ 3. Verify the "WORKSPACE" environment variable is set to the edk2 directory in your workspace.
+ 4. Set the "PACKAGES_PATH" environment variable to include the edk2-platforms/Platform/Intel, edk2-platforms/Silicon/Intel,
+ and edk2-platforms/Features/Intel directories.
+ * Windows example:
+ * set PACKAGES_PATH=c:\Edk2Workspace\edk2-platforms\Platform\Intel;
+ c:\Edk2Workspace\edk2-platforms\Silicon\Intel;
+ c:\Edk2Workspace\edk2-platforms\Features\Intel
+ 5. cd edk2-platforms/Features/Intel
+ 6. <pre>build -p FeatureDomainDirectory/XxxFeaturePkg/XxxFeaturePkg.dsc -a IA32 -a X64</pre>
+
+ *Note:* -a specifies the architecture. Typically IA32 and X64 modules are built for 32-bit PEI and 64-bit
+ DXE though build for your specific requirements.
+
+10. Add the advanced feature to `AdvancedFeaturePkg` so it is available to board packages.
+ 1. Add `XxxFeaturePkg/Include/XxxFeature.dsc` to `AdvancedFeatures.dsc`
+ 2. Add `XxxFeaturePkg/Include/PreMemory.fdf` to `AdvancedFeaturePkg/Include/PreMemory.fdf`
+ 3. Add `XxxFeaturePkg/Include/PostMemory.fdf` to `AdvancedFeaturePkg/Include/PostMemory.fdf`
+
+11. Build `AdvancedFeaturePkg` to ensure the build is successful.
+ 1. Follow the steps in step #9 but change the build command to:
+
+ <pre>build -p AdvancedFeaturePkg/AdvancedFeaturePkg.dsc -a IA32 -a X64</pre>
+
+12. Before sending your patch series, ensure the `Readme.md` file in `XxxFeaturePkg` is completed so others can use it
+ during the feature review.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 05/49] Features/Intel/PowerManagement: Add Readme.md
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (3 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 04/49] Features/Intel: Add Readme.md Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 06/49] Features/Intel/OutOfBandManagement: " Kubacki, Michael A
` (42 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Adds the Readme.md file to briefly explain the types of features
supported in the PowerManagement feature domain directory.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/PowerManagement/Readme.md | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Features/Intel/PowerManagement/Readme.md b/Features/Intel/PowerManagement/Readme.md
new file mode 100644
index 0000000000..f539fbd2ec
--- /dev/null
+++ b/Features/Intel/PowerManagement/Readme.md
@@ -0,0 +1,10 @@
+# **EDK II Minimum Platform Firmware Power Management Advanced Features**
+
+This feature domain directory contains power management related advanced features.
+
+Features may be added to this domain whose primary role and responsibility is related to power management including
+support for various power states such as device power states (Dx), system sleep states (Sx), processor power states (Cx),
+performance states (Px), etc. Firmware power management responsibilities are largely defined by the
+[Advanced Configuration Configuration and Power Interface Specification](https://uefi.org/specifications) though features
+in this domain may be written to other specifications or not defined in a specification at all. In any case, the
+`Readme.md` file in the feature package should reference all relevant documentation to the feature.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 06/49] Features/Intel/OutOfBandManagement: Add Readme.md
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (4 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 05/49] Features/Intel/PowerManagement: " Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 07/49] Features/Intel/SystemInformation: " Kubacki, Michael A
` (41 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Adds the Readme.md file to briefly explain the types of features
supported in the OutOfBandManagement feature domain directory.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/OutOfBandManagement/Readme.md | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Features/Intel/OutOfBandManagement/Readme.md b/Features/Intel/OutOfBandManagement/Readme.md
new file mode 100644
index 0000000000..dc526029a7
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/Readme.md
@@ -0,0 +1,8 @@
+# **EDK II Minimum Platform Firmware Out-of-Band Management Advanced Features**
+
+This feature domain directory contains out-of-band management related advanced features.
+
+Features may be added to this domain whose primary role and responsibility is related to out-of-band management. These
+are features that typically interface with an external controller to enable system maintenance operations such as
+monitoring, logging, and recovery control functions independent of the main processors, host CPU firmware (BIOS), and
+host operating system. An out-of-band controller is usually available when the system is in a powered down state.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 07/49] Features/Intel/SystemInformation: Add Readme.md
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (5 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 06/49] Features/Intel/OutOfBandManagement: " Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 08/49] Features/Intel/Debug: " Kubacki, Michael A
` (40 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Adds the Readme.md file to briefly explain the types of features
supported in the SystemInformation feature domain directory.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/SystemInformation/Readme.md | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Features/Intel/SystemInformation/Readme.md b/Features/Intel/SystemInformation/Readme.md
new file mode 100644
index 0000000000..cdf061d08d
--- /dev/null
+++ b/Features/Intel/SystemInformation/Readme.md
@@ -0,0 +1,8 @@
+# **EDK II Minimum Platform Firmware System Information Advanced Features**
+
+This feature domain directory contains advanced features that produce system information.
+
+Features may be added to this domain whose primary role and responsibility is related to producing structures for
+system information. The system information structures supported should be standardized in a public document such as
+an industry standard specification or white paper. The feature documentation must be referenced in the `Readme.md`
+file in the feature package.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 08/49] Features/Intel/Debug: Add Readme.md
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (6 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 07/49] Features/Intel/SystemInformation: " Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 09/49] Features/Intel/UserInterface: " Kubacki, Michael A
` (39 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Adds the Readme.md file to briefly explain the types of features
supported in the Debug feature domain directory.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/Debugging/Readme.md | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Features/Intel/Debugging/Readme.md b/Features/Intel/Debugging/Readme.md
new file mode 100644
index 0000000000..08621154ec
--- /dev/null
+++ b/Features/Intel/Debugging/Readme.md
@@ -0,0 +1,7 @@
+# **EDK II Minimum Platform Firmware Debug Advanced Features**
+
+This feature domain directory contains debug related advanced features. Note that the directory is named "Debugging"
+as opposed to "Debug" to help indicate the directory is related to containing build files for a Debug build target.
+
+Features may be added to this domain whose primary role and responsibility is related to debug. The type of debug
+technology may include hardware or software debug.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 09/49] Features/Intel/UserInterface: Add Readme.md
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (7 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 08/49] Features/Intel/Debug: " Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 10/49] Features/Intel/Network: " Kubacki, Michael A
` (38 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Adds the Readme.md file to briefly explain the types of features
supported in the UserInterface feature domain directory.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/UserInterface/Readme.md | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Features/Intel/UserInterface/Readme.md b/Features/Intel/UserInterface/Readme.md
new file mode 100644
index 0000000000..2ef4413ade
--- /dev/null
+++ b/Features/Intel/UserInterface/Readme.md
@@ -0,0 +1,9 @@
+# **EDK II Minimum Platform Firmware User Interface Features**
+
+This feature domain directory contains user interface related advanced features.
+
+Features may be added to this domain whose primary role and responsibility is related to user interfaces. This may
+include any number of interfaces related to user interaction with the system that require firmware support. High-level
+examples of common user interfaces in firmware are console support and Human Interface Infrastructure (HII). These
+high-level categories may comprise multiple independent features. It is recommended to reduce individual feature scope
+to the minimally required level for the feature to be functional to improve cohesion within the feature package.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 10/49] Features/Intel/Network: Add Readme.md
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (8 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 09/49] Features/Intel/UserInterface: " Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 11/49] TemplateFeaturePkg: Add initial package Kubacki, Michael A
` (37 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Adds the Readme.md file to briefly explain the types of features
supported in the Network feature domain directory.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/Network/Readme.md | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Features/Intel/Network/Readme.md b/Features/Intel/Network/Readme.md
new file mode 100644
index 0000000000..780a1264ac
--- /dev/null
+++ b/Features/Intel/Network/Readme.md
@@ -0,0 +1,5 @@
+# **EDK II Minimum Platform Firmware Network Features**
+
+This feature domain directory contains network related advanced features.
+
+Features may be added to this domain whose primary role and responsibility is related to network technologies.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 11/49] TemplateFeaturePkg: Add initial package
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (9 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 10/49] Features/Intel/Network: " Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:48 ` Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 12/49] SimicsOpenBoardPkg: Remove advanced feature references Kubacki, Michael A
` (36 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Nate DeSimone, Liming Gao
This change adds a new package called TemplateFeaturePkg that
should be used as a starting point for the creation of new advanced
feature packages.
TemplateFeaturePkg is not meant to be built or used directly for
functionality. It simply serves as a template to be copied and
modified. The advanced feature package creation process is
described in detail in Features/Intel/Readme.md.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec | 30 ++++++
Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc | 113 ++++++++++++++++++++
Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc | 30 ++++++
Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf | 8 ++
Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf | 8 ++
Features/Intel/TemplateFeaturePkg/Readme.md | 71 ++++++++++++
6 files changed, 260 insertions(+)
diff --git a/Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec b/Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec
new file mode 100644
index 0000000000..b37ce8f34a
--- /dev/null
+++ b/Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for <TEMPLATE> support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = TemplateFeaturePkg
+ PACKAGE_GUID = 00000000-0000-0000-0000-000000000000
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[LibraryClasses]
+
+[Guids]
+ gTemplateFeaturePkgTokenSpaceGuid = {0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}
+
+[PcdsFeatureFlag]
+ gTemplateFeaturePkgTokenSpaceGuid.PcdTemplateFeatureEnable|FALSE|BOOLEAN|0xA0000001
diff --git a/Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc b/Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc
new file mode 100644
index 0000000000..6742eddcf9
--- /dev/null
+++ b/Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc
@@ -0,0 +1,113 @@
+## @file
+# This is a build description file for the <TEMPLATE> advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+################################################################################
+[LibraryClasses]
+
+ ## Note: This comment block should be removed from the template when the
+ # template is used.
+ #
+ # Library classes should have a comment header that describes the type of
+ # package the library is used from for organization purposes.
+ #
+ # For an advanced feature, these are typically:
+ # * Edk2 Packages
+ # * Silicon Initialization Package
+ # * Platform Package
+ # * Feature Package
+ #
+ # The comment header should follow the format:
+ #
+ # #######################################
+ # # Edk2 Packages
+ # #######################################
+
+################################################################################
+#
+# Component section - list of all components that need built for this feature.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+################################################################################
+
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # <TEMPALTE> Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
+ #####################################
+ # <TEMPLATE> Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+
+###################################################################################################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
+###################################################################################################
+[BuildOptions]
diff --git a/Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc b/Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc
new file mode 100644
index 0000000000..0ce8debee0
--- /dev/null
+++ b/Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for <TEMPLATE> support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ PLATFORM_NAME = TemplateFeaturePkg
+ PLATFORM_GUID = 00000000-0000-0000-0000-000000000000
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#
+# This package always builds the feature.
+#
+!include Include/TemplateFeature.dsc
diff --git a/Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf b/Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..86225cefbe
--- /dev/null
+++ b/Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for post-memory <TEMPLATE> advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf b/Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..5ce30af174
--- /dev/null
+++ b/Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory <TEMPLATE> advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/TemplateFeaturePkg/Readme.md b/Features/Intel/TemplateFeaturePkg/Readme.md
new file mode 100644
index 0000000000..90be279ae3
--- /dev/null
+++ b/Features/Intel/TemplateFeaturePkg/Readme.md
@@ -0,0 +1,71 @@
+# Overview
+* **Feature Name:** <Feature Name>
+* **PI Phase(s) Supported:** <PI Phases Supported>
+* **SMM Required?** <Yes/No>
+
+## Purpose
+Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph.
+
+# High-Level Theory of Operation
+A description of how the device works at a high-level.
+
+The description should not be constrained to implementation details but provide a simple mental model of how the
+feature is supposed to work.
+
+## Firmware Volumes
+A bulleted list of the firmware volumes that feature module(s) are placed in.
+
+## Modules
+A bulleted list of the modules that make up the feature.
+
+## <Module Name>
+Each module in the feature should have a section that describes the module in a level of detail that is useful
+to better understand the module source code.
+
+## <Library Name>
+Each library in the feature should have a section that describes the library in a level of detail that is useful
+to better understand the library source code.
+
+## Key Functions
+A bulleted list of key functions for interacting with the feature.
+
+Not all features need to be listed. Only functions exposed through external interfaces that are important for feature
+users to be aware of.
+
+## Configuration
+Information that is useful for configuring the feature.
+
+Not all configuration options need to be listed. This section is used to provide more background on configuration
+options than possible elsewhere.
+
+## Data Flows
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+Key control flows for the feature.
+
+## Build Flows
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or require non-standard tool configuration. If the
+standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the feature is successful. If the test point is not
+implemented, this should be stated.
+
+## Functional Exit Criteria
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board integrator can reference to ensure the feature is
+functional on their board.
+
+## Feature Enabling Checklist
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 12/49] SimicsOpenBoardPkg: Remove advanced feature references
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (10 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 11/49] TemplateFeaturePkg: Add initial package Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:48 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 13/49] AdvancedFeaturePkg: Remove the S3 feature Kubacki, Michael A
` (35 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Wei David Y, Agyeman Prince
Removes references to advanced features in the package to prepare
for an advanced feature refactor that will impact the location of
features and details such as package names and PCD token space
identifiers.
Cc: Wei David Y <david.y.wei@intel.com>
Cc: Agyeman Prince <prince.agyeman@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 17 -----------------
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc | 6 ------
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf | 8 --------
Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 1 -
4 files changed, 32 deletions(-)
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 35a8c7c765..761874de73 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -34,16 +34,7 @@
DEFINE SMM_REQUIRE = TRUE
- #
- # PLATFORMX64_ENABLE is set to TRUE when PEI is IA32 and DXE is X64 platform
- #
- DEFINE PLATFORMX64_ENABLE = TRUE
- DEFINE NETWORK_TLS_ENABLE = FALSE
- DEFINE NETWORK_ISCSI_ENABLE = FALSE
- DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
-
!include $(PROJECT)/OpenBoardPkgPcd.dsc
- !include NetworkPkg/NetworkDefines.dsc.inc
################################################################################
#
@@ -76,7 +67,6 @@
[Components.X64]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CoreDxeInclude.dsc
-!include AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
#######################################
# Build Option Includes
@@ -271,13 +261,6 @@
$(PLATFORM_PACKAGE)/Flash/SpiFvbService/SpiFvbServiceSmm.inf
!endif
- #######################################
- # Advanced Feature Package
- #######################################
-!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable == TRUE
- AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
-!endif
-
#######################################
# Board Package
#######################################
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc
index cd95755f91..1383a63d36 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc
@@ -96,8 +96,6 @@
######################################
# Advanced Feature Configuration
######################################
- gAdvancedFeaturePkgTokenSpaceGuid.PcdNetworkEnable|TRUE
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable|TRUE
[PcdsFeatureFlag.X64]
######################################
@@ -252,10 +250,6 @@
######################################
# Advanced Feature Configuration
######################################
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|"2019-08-09"
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"Ver.1.0.0"
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"QSP UEFI BIOS"
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"QSP UEFI BIOS"
[PcdsDynamicExDefault]
######################################
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
index ef6b35c92f..d29835f606 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
@@ -155,7 +155,6 @@ INF MinPlatformPkg/PlatformInit/ReportFv/ReportFvPei.inf
INF MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
INF MinPlatformPkg/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMem.inf
!include MinPlatformPkg/Include/Fdf/CoreSecurityPreMemoryInclude.fdf
-!include AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf
INF $(BOARD_PKG)/SimicsPei/SimicsPei.inf
!include $(SKT_PKG)/SktPostMemoryInclude.fdf
!include $(PCH_PKG)/IchPostMemoryInclude.fdf
@@ -163,7 +162,6 @@ INF $(BOARD_PKG)/SimicsPei/SimicsPei.inf
INF MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.inf
INF MinPlatformPkg/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPostMem.inf
!include MinPlatformPkg/Include/Fdf/CoreSecurityPostMemoryInclude.fdf
-!include AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf
INF UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
INF $(SKT_PKG)/Smm/Access/SmmAccessPei.inf
@@ -238,12 +236,6 @@ INF ShellPkg/Application/Shell/Shell.inf
#
INF SimicsIch10BinPkg/UndiBinary/UndiDxe.inf
-!include AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
-
-!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable == TRUE
- INF AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
-!endif
-
!include MinPlatformPkg/Include/Fdf/CoreSecurityLateInclude.fdf
[FV.FVMAIN_COMPACT]
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index 3cc6a03564..f8ecab08e6 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -31,7 +31,6 @@
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
SimicsOpenBoardPkg/OpenBoardPkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
BoardModulePkg/BoardModulePkg.dec
[LibraryClasses]
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 13/49] AdvancedFeaturePkg: Remove the S3 feature
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (11 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 12/49] SimicsOpenBoardPkg: Remove advanced feature references Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:48 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 14/49] Features/Intel: Add S3FeaturePkg Kubacki, Michael A
` (34 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Removes the S3 feature from AdvancedFeaturePkg. The feature does
not follow the advanced feature design. A future change will add
the feature back following the advanced feature design.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 6 ----
Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.inf | 31 -----------------
Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c | 36 --------------------
3 files changed, 73 deletions(-)
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index b83e72b48c..885b84e2df 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -102,11 +102,6 @@
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
- #######################################
- # Silicon Initialization Package
- #######################################
- SmmAccessLib|IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.inf
-
[LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE,LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRIVER,LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION]
#######################################
# Edk2 Packages
@@ -158,7 +153,6 @@
AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf
AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf
- AdvancedFeaturePkg/S3/S3Pei.inf
AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
[BuildOptions]
diff --git a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.inf b/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.inf
deleted file mode 100644
index 847edd20c0..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.inf
+++ /dev/null
@@ -1,31 +0,0 @@
-### @file
-# Component information file for the S3 PEI module.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010017
- BASE_NAME = S3Pei
- FILE_GUID = 8683EFB2-FDE1-4AFF-B2DB-E96449FDD4E9
- VERSION_STRING = 1.0
- MODULE_TYPE = PEIM
- ENTRY_POINT = S3PeiEntryPoint
-
-[LibraryClasses]
- PeimEntryPoint
- PeiServicesLib
- SmmAccessLib
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelSiliconPkg/IntelSiliconPkg.dec
-
-[Sources]
- S3Pei.c
-
-[Depex]
- gEfiPeiMemoryDiscoveredPpiGuid
diff --git a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c b/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c
deleted file mode 100644
index b0aaa04962..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/** @file
- Source code file for S3 PEI module
-
-Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Library/PeiServicesLib.h>
-#include <Library/SmmAccessLib.h>
-
-/**
- S3 PEI module entry point
-
- @param[in] FileHandle Not used.
- @param[in] PeiServices General purpose services available to every PEIM.
-
- @retval EFI_SUCCESS The function completes successfully
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to create database
-**/
-EFI_STATUS
-EFIAPI
-S3PeiEntryPoint (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- EFI_STATUS Status;
-
- //
- // Install EFI_PEI_MM_ACCESS_PPI for S3 resume case
- //
- Status = PeiInstallSmmAccessPpi ();
-
- return Status;
-}
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 14/49] Features/Intel: Add S3FeaturePkg
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (12 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 13/49] AdvancedFeaturePkg: Remove the S3 feature Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 15/49] AdvancedFeaturePkg: Remove the IPMI feature Kubacki, Michael A
` (33 subsequent siblings)
47 siblings, 0 replies; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Adds a new feature package for the S3 feature.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dec | 30 +++++
Features/Intel/PowerManagement/S3FeaturePkg/Include/S3Feature.dsc | 122 ++++++++++++++++++++
Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dsc | 30 +++++
Features/Intel/PowerManagement/S3FeaturePkg/Include/PostMemory.fdf | 8 ++
Features/Intel/PowerManagement/S3FeaturePkg/Include/PreMemory.fdf | 10 ++
Features/Intel/PowerManagement/S3FeaturePkg/S3Pei/S3Pei.inf | 35 ++++++
Features/Intel/PowerManagement/S3FeaturePkg/S3Pei/S3Pei.c | 36 ++++++
Features/Intel/PowerManagement/S3FeaturePkg/Readme.md | 86 ++++++++++++++
8 files changed, 357 insertions(+)
diff --git a/Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dec b/Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dec
new file mode 100644
index 0000000000..2a723ad3d6
--- /dev/null
+++ b/Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dec
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for S3 support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = S3FeaturePkg
+ PACKAGE_GUID = 600F7249-65BD-44E2-80D7-344BD5250198
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[LibraryClasses]
+
+[Guids]
+ gS3FeaturePkgTokenSpaceGuid = {0x423c5a51, 0x36e9, 0x4aea, {0x92, 0xdd, 0xdd, 0xae, 0x5b, 0x4a, 0x3d, 0x24}}
+
+[PcdsFeatureFlag]
+ gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable|FALSE|BOOLEAN|0xA0000001
diff --git a/Features/Intel/PowerManagement/S3FeaturePkg/Include/S3Feature.dsc b/Features/Intel/PowerManagement/S3FeaturePkg/Include/S3Feature.dsc
new file mode 100644
index 0000000000..647dc3f93a
--- /dev/null
+++ b/Features/Intel/PowerManagement/S3FeaturePkg/Include/S3Feature.dsc
@@ -0,0 +1,122 @@
+## @file
+# This is a build description file for the S3 advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+################################################################################
+[LibraryClasses]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+ PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
+ PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
+ PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
+
+[LibraryClasses.common.PEI_CORE,LibraryClasses.common.PEIM]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+ PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
+ PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+ PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
+
+ #######################################
+ # Silicon Initialization Package
+ #######################################
+ SmmAccessLib|IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.inf
+
+################################################################################
+#
+# Component section - list of all components that need built for this feature.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+################################################################################
+
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # S3 Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+ PowerManagement/S3FeaturePkg/S3Pei/S3Pei.inf
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
+ #####################################
+ # S3 Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+
+###################################################################################################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
+###################################################################################################
+[BuildOptions]
diff --git a/Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dsc b/Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dsc
new file mode 100644
index 0000000000..28ee49d429
--- /dev/null
+++ b/Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dsc
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for S3 support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ PLATFORM_NAME = S3FeaturePkg
+ PLATFORM_GUID = 02E7C519-5A24-4594-8D69-F4117D6E3D25
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#
+# This package always builds the feature.
+#
+!include Include/S3Feature.dsc
diff --git a/Features/Intel/PowerManagement/S3FeaturePkg/Include/PostMemory.fdf b/Features/Intel/PowerManagement/S3FeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..9e17f853c6
--- /dev/null
+++ b/Features/Intel/PowerManagement/S3FeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for post-memory S3 advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/PowerManagement/S3FeaturePkg/Include/PreMemory.fdf b/Features/Intel/PowerManagement/S3FeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..3cd5cd9628
--- /dev/null
+++ b/Features/Intel/PowerManagement/S3FeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,10 @@
+## @file
+# FDF file for pre-memory S3 advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+ INF PowerManagement/S3FeaturePkg/S3Pei/S3Pei.inf
diff --git a/Features/Intel/PowerManagement/S3FeaturePkg/S3Pei/S3Pei.inf b/Features/Intel/PowerManagement/S3FeaturePkg/S3Pei/S3Pei.inf
new file mode 100644
index 0000000000..46fbb62a46
--- /dev/null
+++ b/Features/Intel/PowerManagement/S3FeaturePkg/S3Pei/S3Pei.inf
@@ -0,0 +1,35 @@
+### @file
+# Component information file for the S3 PEI module.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010017
+ BASE_NAME = S3Pei
+ FILE_GUID = 8683EFB2-FDE1-4AFF-B2DB-E96449FDD4E9
+ VERSION_STRING = 1.0
+ MODULE_TYPE = PEIM
+ ENTRY_POINT = S3PeiEntryPoint
+
+[LibraryClasses]
+ PeimEntryPoint
+ PeiServicesLib
+ SmmAccessLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ IntelSiliconPkg/IntelSiliconPkg.dec
+ PowerManagement/S3FeaturePkg/S3FeaturePkg.dec
+
+[Sources]
+ S3Pei.c
+
+[FeaturePcd]
+ gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable
+
+[Depex]
+ gEfiPeiMemoryDiscoveredPpiGuid
diff --git a/Features/Intel/PowerManagement/S3FeaturePkg/S3Pei/S3Pei.c b/Features/Intel/PowerManagement/S3FeaturePkg/S3Pei/S3Pei.c
new file mode 100644
index 0000000000..b0aaa04962
--- /dev/null
+++ b/Features/Intel/PowerManagement/S3FeaturePkg/S3Pei/S3Pei.c
@@ -0,0 +1,36 @@
+/** @file
+ Source code file for S3 PEI module
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/PeiServicesLib.h>
+#include <Library/SmmAccessLib.h>
+
+/**
+ S3 PEI module entry point
+
+ @param[in] FileHandle Not used.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS The function completes successfully
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to create database
+**/
+EFI_STATUS
+EFIAPI
+S3PeiEntryPoint (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // Install EFI_PEI_MM_ACCESS_PPI for S3 resume case
+ //
+ Status = PeiInstallSmmAccessPpi ();
+
+ return Status;
+}
diff --git a/Features/Intel/PowerManagement/S3FeaturePkg/Readme.md b/Features/Intel/PowerManagement/S3FeaturePkg/Readme.md
new file mode 100644
index 0000000000..91ea3da854
--- /dev/null
+++ b/Features/Intel/PowerManagement/S3FeaturePkg/Readme.md
@@ -0,0 +1,86 @@
+# Overview
+* **Feature Name:** S3
+* **PI Phase(s) Supported:** PEI
+* **SMM Required?** Yes
+
+## Purpose
+*_TODO_*
+Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph.
+
+# High-Level Theory of Operation
+*_TODO_*
+A description of how the device works at a high-level.
+
+The description should not be constrained to implementation details but provide a simple mental model of how the
+feature is supposed to work.
+
+## Firmware Volumes
+*_TODO_*
+A bulleted list of the firmware volumes that feature module(s) are placed in.
+
+## Modules
+*_TODO_*
+A bulleted list of the modules that make up the feature.
+
+## <Module Name>
+*_TODO_*
+Each module in the feature should have a section that describes the module in a level of detail that is useful
+to better understand the module source code.
+
+## <Library Name>
+*_TODO_*
+Each library in the feature should have a section that describes the library in a level of detail that is useful
+to better understand the library source code.
+
+## Key Functions
+*_TODO_*
+A bulleted list of key functions for interacting with the feature.
+
+Not all features need to be listed. Only functions exposed through external interfaces that are important for feature
+users to be aware of.
+
+## Configuration
+*_TODO_*
+Information that is useful for configuring the feature.
+
+Not all configuration options need to be listed. This section is used to provide more background on configuration
+options than possible elsewhere.
+
+## Data Flows
+*_TODO_*
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+*_TODO_*
+Key control flows for the feature.
+
+## Build Flows
+*_TODO_*
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or require non-standard tool configuration. If the
+standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+*_TODO_*
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the feature is successful. If the test point is not
+implemented, this should be stated.
+
+## Functional Exit Criteria
+*_TODO_*
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board integrator can reference to ensure the feature is
+functional on their board.
+
+## Feature Enabling Checklist
+*_TODO_*
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+*_TODO_*
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 15/49] AdvancedFeaturePkg: Remove the IPMI feature
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (13 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 14/49] Features/Intel: Add S3FeaturePkg Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:48 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 16/49] Features/Intel/IpmiFeaturePkg: Add initial package Kubacki, Michael A
` (32 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Removes the IPMI feature from AdvancedFeaturePkg. The feature does
not follow the advanced feature design. A future change will add
the feature back following the advanced feature design.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 11 -
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 59 -----
Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf | 48 ----
Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf | 34 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf | 37 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf | 37 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf | 35 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf | 34 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf | 32 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf | 32 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf | 28 --
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf | 29 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf | 34 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf | 38 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiCommandLib.h | 235 -----------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiPlatformHookLib.h | 23 --
Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c | 257 ------------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c | 236 -----------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c | 236 -----------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c | 84 ------
Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c | 67 -----
Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.c | 150 -----------
Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.c | 96 -------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c | 248 ------------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c | 101 -------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c | 275 --------------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c | 81 ------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c | 45 ----
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c | 36 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c | 112 --------
Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.c | 164 ------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/BmcSsdt.asl | 28 --
Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOprRegions.asi | 58 -----
33 files changed, 3020 deletions(-)
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
index 44e5de64db..4f8300d145 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
@@ -22,7 +22,6 @@ PACKAGE_GUID = 290127D9-ABED-4DD8-A35D-73DCB4261BCB
[Includes]
Include
-Ipmi/Include
[Guids]
gAdvancedFeaturePkgTokenSpaceGuid = {0xa8514688, 0x6693, 0x4ab5, {0xaa, 0xc8, 0xcc, 0xa9, 0x8d, 0xde, 0x90, 0xe1}}
@@ -138,16 +137,6 @@ gAdvancedFeaturePkgTokenSpaceGuid = {0xa8514688, 0x6693, 0x4ab5, {0xaa,
}
gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation.BootStatus|BootInformationStatusNoError
-[PcdsFixedAtBuild]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels|0x3|UINT8|0x40000009
-
-[PcdsDynamic, PcdsDynamicEx]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress|0xCA2|UINT16|0x90000022
- gAdvancedFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag|TRUE|BOOLEAN|0x10000030
- gAdvancedFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue|360|UINT16|0x10000040
-
[PcdsFeatureFlag]
gAdvancedFeaturePkgTokenSpaceGuid.PcdNetworkEnable |FALSE|BOOLEAN|0xF00000A1
gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable |FALSE|BOOLEAN|0xF00000A2
- gAdvancedFeaturePkgTokenSpaceGuid.PcdIpmiEnable |FALSE|BOOLEAN|0xF00000A3
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index 885b84e2df..ca8db13f7c 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -50,58 +50,14 @@
#######################################
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
- BasePciLibPciExpress|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
- CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
- CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
- DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
- PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
- PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
- PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
- PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
- PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
- PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
- PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
- PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
- ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
- SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
- SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
- TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
- UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
- #######################################
- # Advanced Feature Package
- #######################################
- IpmiCommandLib|AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf
- IpmiLib|AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
- IpmiPlatformHookLib|AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
-
-[LibraryClasses.common.SEC,LibraryClasses.common.PEI_CORE,LibraryClasses.common.PEIM]
- #######################################
- # Edk2 Packages
- #######################################
- HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
- MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
- PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
-
[LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE,LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRIVER,LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION]
#######################################
# Edk2 Packages
@@ -110,12 +66,6 @@
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
-[LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE]
- #######################################
- # Edk2 Packages
- #######################################
- SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
-
###################################################################################################
#
# Components Section - list of the modules and components that will be processed by compilation
@@ -144,15 +94,6 @@
# in the package build.
# Add components here that should be included in the package build.
- AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
- AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
- AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf
- AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf
- AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
- AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf
- AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
- AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf
- AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf
AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
[BuildOptions]
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
deleted file mode 100644
index 17b75dfbcc..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
+++ /dev/null
@@ -1,48 +0,0 @@
-### @file
-# Component description file for BMC ACPI.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = BmcAcpi
- FILE_GUID = F59DAA23-D5D5-4d16-91FC-D03ABDC12FFE
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = BmcAcpiEntryPoint
-
-[Sources]
- BmcAcpi.c
- BmcSsdt/BmcSsdt.asl
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- BaseMemoryLib
- DebugLib
- UefiLib
-
-[Protocols]
- gEfiFirmwareVolume2ProtocolGuid
- gEfiAcpiTableProtocolGuid
-
-[Pcd]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress
- gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId
- gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId
-
-[Depex]
- gEfiAcpiTableProtocolGuid
-
-[BuildOptions]
- *_*_*_ASL_FLAGS = -oi
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
deleted file mode 100644
index 85591efb5d..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
+++ /dev/null
@@ -1,34 +0,0 @@
-### @file
-# Component description file for BMC ELOG.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = BmcElog
- FILE_GUID = 8A17F6CA-BF1A-45C4-FFFF-FFFF0C829DDD
- MODULE_TYPE = DXE_DRIVER
- PI_SPECIFICATION_VERSION = 0x0001000A
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeBmcElogLayer
-
-[Sources]
- BmcElog.c
-
-[Packages]
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- DebugLib
- UefiBootServicesTableLib
- IpmiCommandLib
-
-[Depex]
- TRUE
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf
deleted file mode 100644
index 3aa29889b1..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf
+++ /dev/null
@@ -1,37 +0,0 @@
-### @file
-# Component description file for IPMI FRB.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[defines]
- INF_VERSION = 0x00010005
- BASE_NAME = FrbDxe
- FILE_GUID = F6C7812D-81BF-4e6d-A87D-E75AF17BD511
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = FrbDxeEntryPoint
-
-[Sources]
- FrbDxe.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- MemoryAllocationLib
- UefiLib
- DebugLib
- BaseMemoryLib
- IpmiCommandLib
- PcdLib
-
-[Depex]
- TRUE
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf
deleted file mode 100644
index 1882453ffe..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf
+++ /dev/null
@@ -1,37 +0,0 @@
-### @file
-# Component description file for IPMI FRB PEIM.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[defines]
- INF_VERSION = 0x00010005
- BASE_NAME = FrbPei
- FILE_GUID = 7F9F9788-9F1F-4725-895C-3932F1A04DE8
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeFrbPei
-
-[Sources]
- FrbPei.c
-
-[Packages]
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- PeimEntryPoint
- DebugLib
- BaseMemoryLib
- PcdLib
- IpmiCommandLib
-
-[Pcd]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag
- gAdvancedFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue
-
-[Depex]
- TRUE
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
deleted file mode 100644
index a2556e92d2..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
+++ /dev/null
@@ -1,35 +0,0 @@
-### @file
-# Component description file for IPMI FRU.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = IpmiFru
- FILE_GUID = 3F1D6464-2B4C-4640-BAC4-3DD905D26CDA
- MODULE_TYPE = DXE_DRIVER
- PI_SPECIFICATION_VERSION = 0x0001000A
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeFru
-
-[Sources]
- IpmiFru.c
-
-[Packages]
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- UefiLib
- DebugLib
- UefiBootServicesTableLib
- BaseMemoryLib
- IpmiCommandLib
-
-[Depex]
- TRUE
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf
deleted file mode 100644
index 2e544270a3..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf
+++ /dev/null
@@ -1,34 +0,0 @@
-### @file
-# Component description file for IPMI initialization.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DxeIpmiInit
- FILE_GUID = 07A01ACF-46D5-48de-A63D-74FA92AA8450
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = IpmiInterfaceInit
-
-[Sources]
- DxeIpmiInit.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- DebugLib
- UefiDriverEntryPoint
- IpmiCommandLib
- TimerLib
-
-[Depex]
- TRUE
\ No newline at end of file
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
deleted file mode 100644
index 5e00f4bd33..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
+++ /dev/null
@@ -1,32 +0,0 @@
-### @file
-# Component description file for IPMI initialization in PEI.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PeiIpmiInit
- FILE_GUID = D8F57F4E-D67D-4f2c-8351-C7092986542F
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- ENTRY_POINT = PeimIpmiInterfaceInit
-
-[Sources]
- PeiIpmiInit.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- PeimEntryPoint
- DebugLib
- IpmiCommandLib
-
-[Depex]
- TRUE
\ No newline at end of file
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf
deleted file mode 100644
index 89e7a66f60..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf
+++ /dev/null
@@ -1,32 +0,0 @@
-### @file
-# Component description file for IPMI Command Library.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = IpmiCommandLib
- FILE_GUID = E599C9C7-5913-40A0-8669-67282E2BEC53
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = IpmiCommandLib
-
-[sources]
- IpmiCommandLibNetFnApp.c
- IpmiCommandLibNetFnTransport.c
- IpmiCommandLibNetFnChassis.c
- IpmiCommandLibNetFnStorage.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- BaseMemoryLib
- DebugLib
- IpmiLib
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
deleted file mode 100644
index c042b8beed..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
+++ /dev/null
@@ -1,28 +0,0 @@
-### @file
-# Component description file for IPMI NULL Library.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = IpmiLibNull
- FILE_GUID = DDF0E1D9-F53F-429A-BD9C-5D12A321E625
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = IpmiLib
-
-[sources]
- IpmiLibNull.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
-
-[Pcd]
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
deleted file mode 100644
index 458b40f626..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
+++ /dev/null
@@ -1,29 +0,0 @@
-### @file
-# Component description file for IPMI platform Library.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = IpmiPlatformHookLibNull
- FILE_GUID = C31A5B17-81DB-4D86-B376-17711BB6E0A5
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = IpmiPlatformHookLib
-
-[sources]
- IpmiPlatformHookLibNull.c
-
-[Packages]
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- DebugLib
-
-[Protocols]
- gEfiIpmiTransportProtocolGuid
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf
deleted file mode 100644
index e49942c198..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf
+++ /dev/null
@@ -1,34 +0,0 @@
-### @file
-# Component description file for IPMI OS watch dog timer driver.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = OsWdt
- FILE_GUID = BE9B694A-B5D9-48e0-A527-6E1A49EB7028
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = DriverInit
-
-[Sources]
- OsWdt.c
-
-[Packages]
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- DebugLib
- UefiBootServicesTableLib
- BaseMemoryLib
- IpmiCommandLib
-
-[Depex]
- TRUE
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf
deleted file mode 100644
index 07f2c03f6a..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf
+++ /dev/null
@@ -1,38 +0,0 @@
-### @file
-# Component description file for IPMI Serial Over LAN driver.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SolStatus
- FILE_GUID = F9887B5E-2D46-4213-8794-14F1FD39F6B8
- MODULE_TYPE = DXE_DRIVER
- PI_SPECIFICATION_VERSION = 0x0001000A
- VERSION_STRING = 1.0
- ENTRY_POINT = SolStatusEntryPoint
-
-[Sources]
- SolStatus.c
-
-[Packages]
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[Pcd]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels
-
-[LibraryClasses]
- UefiDriverEntryPoint
- DebugLib
- UefiBootServicesTableLib
- IpmiCommandLib
- PcdLib
-
-[Depex]
- TRUE
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiCommandLib.h b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiCommandLib.h
deleted file mode 100644
index 9b761717d4..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiCommandLib.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/** @file
- This library abstract how to send/receive IPMI command.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _IPMI_COMMAND_LIB_H_
-#define _IPMI_COMMAND_LIB_H_
-
-#include <Uefi.h>
-#include <IndustryStandard/Ipmi.h>
-
-//
-// NetFnApp
-//
-EFI_STATUS
-EFIAPI
-IpmiGetDeviceId (
- OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelfTestResult (
- OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult
- );
-
-EFI_STATUS
-EFIAPI
-IpmiResetWatchdogTimer (
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiSetWatchdogTimer (
- IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetWatchdogTimer (
- OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer
- );
-
-EFI_STATUS
-EFIAPI
-IpmiSetBmcGlobalEnables (
- IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetBmcGlobalEnables (
- OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables
- );
-
-EFI_STATUS
-EFIAPI
-IpmiClearMessageFlags (
- IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetMessageFlags (
- OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetMessage (
- OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse,
- IN OUT UINT32 *GetMessageResponseSize
- );
-
-EFI_STATUS
-EFIAPI
-IpmiSendMessage (
- IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest,
- IN UINT32 SendMessageRequestSize,
- OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse,
- IN OUT UINT32 *SendMessageResponseSize
- );
-
-//
-// NetFnTransport
-//
-EFI_STATUS
-EFIAPI
-IpmiSolActivating (
- IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiSetSolConfigurationParameters (
- IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationParametersRequest,
- IN UINT32 SetConfigurationParametersRequestSize,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSolConfigurationParameters (
- IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationParametersRequest,
- OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationParametersResponse,
- IN OUT UINT32 *GetConfigurationParametersResponseSize
- );
-
-//
-// NetFnChasis
-//
-EFI_STATUS
-EFIAPI
-IpmiGetChassisCapabilities (
- OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetChassisStatus (
- OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiChassisControl (
- IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiSetPowerRestorePolicy (
- IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest,
- OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse
- );
-
-//
-// NetFnStorage
-//
-EFI_STATUS
-EFIAPI
-IpmiGetFruInventoryAreaInfo (
- IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoRequest,
- OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiReadFruData (
- IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest,
- OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse,
- IN OUT UINT32 *ReadFruDataResponseSize
- );
-
-EFI_STATUS
-EFIAPI
-IpmiWriteFruData (
- IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest,
- IN UINT32 WriteFruDataRequestSize,
- OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelInfo (
- OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelEntry (
- IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest,
- OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse,
- IN OUT UINT32 *GetSelEntryResponseSize
- );
-
-EFI_STATUS
-EFIAPI
-IpmiAddSelEntry (
- IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest,
- OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiPartialAddSelEntry (
- IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest,
- IN UINT32 PartialAddSelEntryRequestSize,
- OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiClearSel (
- IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest,
- OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelTime (
- OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiSetSelTime (
- IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSdrRepositoryInfo (
- OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSdr (
- IN IPMI_GET_SDR_REQUEST *GetSdrRequest,
- OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse,
- IN OUT UINT32 *GetSdrResponseSize
- );
-
-#endif
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiPlatformHookLib.h b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiPlatformHookLib.h
deleted file mode 100644
index 8359e3f38b..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiPlatformHookLib.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/** @file
- This library abstract the platform specific hook for IPMI.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _IPMI_PLATFORM_UPDATE_LIB_H_
-#define _IPMI_PLATFORM_UPDATE_LIB_H_
-
-#include <Uefi.h>
-#include <IndustryStandard/Acpi.h>
-#include <Protocol/Smbios.h>
-
-EFI_STATUS
-EFIAPI
-PlatformIpmiIoRangeSet(
- UINT16 IpmiIoBase
- );
-
-#endif
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c
deleted file mode 100644
index 990b4b9e83..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/** @file
- BMC ACPI.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-//
-// Statements that include other header files
-//
-#include <PiDxe.h>
-
-#include <IndustryStandard/Acpi.h>
-#include <Protocol/AcpiSystemDescriptionTable.h>
-#include <Protocol/FirmwareVolume2.h>
-#include <Protocol/AcpiTable.h>
-
-#include <Library/BaseLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiLib.h>
-
-#ifndef EFI_ACPI_CREATOR_ID
-#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('M', 'S', 'F', 'T')
-#endif
-#ifndef EFI_ACPI_CREATOR_REVISION
-#define EFI_ACPI_CREATOR_REVISION 0x0100000D
-#endif
-
-/**
-
- Locate the first instance of a protocol. If the protocol requested is an
- FV protocol, then it will return the first FV that contains the ACPI table
- storage file.
-
- @param Protocol - The protocol to find.
- Instance - Return pointer to the first instance of the protocol.
- Type - The type of protocol to locate.
-
- @retval EFI_SUCCESS - The function completed successfully.
- @retval EFI_NOT_FOUND - The protocol could not be located.
- @retval EFI_OUT_OF_RESOURCES - There are not enough resources to find the protocol.
-
-**/
-EFI_STATUS
-LocateSupportProtocol (
- IN EFI_GUID *Protocol,
- OUT VOID **Instance,
- IN UINT32 Type
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE *HandleBuffer;
- UINTN NumberOfHandles;
- EFI_FV_FILETYPE FileType;
- UINT32 FvStatus = 0;
- EFI_FV_FILE_ATTRIBUTES Attributes;
- UINTN Size;
- UINTN Index;
-
- Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NumberOfHandles, &HandleBuffer);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Looking for FV with ACPI storage file
- //
- for (Index = 0; Index < NumberOfHandles; Index++) {
- Status = gBS->HandleProtocol (HandleBuffer[Index], Protocol, Instance);
- ASSERT (!EFI_ERROR (Status));
-
- if (!Type) {
- //
- // Not looking for the FV protocol, so find the first instance of the
- // protocol. There should not be any errors because our handle buffer
- // should always contain at least one or LocateHandleBuffer would have
- // returned not found.
- //
- break;
- }
- //
- // See if it has the ACPI storage file
- //
- Status = ((EFI_FIRMWARE_VOLUME2_PROTOCOL *) (*Instance))->ReadFile (
- *Instance,
- &gEfiCallerIdGuid,
- NULL,
- &Size,
- &FileType,
- &Attributes,
- &FvStatus
- );
-
- //
- // If we found it, then we are done
- //
- if (!EFI_ERROR (Status)) {
- break;
- }
- }
-
- gBS->FreePool (HandleBuffer);
- return Status;
-}
-
-
-EFI_STATUS
-UpdateDeviceSsdtTable (
- IN OUT EFI_ACPI_COMMON_HEADER *Table
- )
-{
- EFI_ACPI_DESCRIPTION_HEADER *TableHeader = NULL;
- UINT64 TempOemTableId;
- UINT8 *DataPtr;
- EFI_ACPI_IO_PORT_DESCRIPTOR *IoRsc;
-
- TableHeader = (EFI_ACPI_DESCRIPTION_HEADER *)Table;
-
- //
- // Update the OEMID and OEM Table ID.
- //
- CopyMem (&TableHeader->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof(TableHeader->OemId));
- TempOemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
- CopyMem (&TableHeader->OemTableId, &TempOemTableId, sizeof(UINT64));
- TableHeader->CreatorId = EFI_ACPI_CREATOR_ID;
- TableHeader->CreatorRevision = EFI_ACPI_CREATOR_REVISION;
-
- //
- // Update IO(Decode16, 0xCA2, 0xCA2, 0, 2)
- //
- DEBUG ((DEBUG_INFO, "UpdateDeviceSsdtTable - IPMI\n"));
- for (DataPtr = (UINT8 *)(Table + 1);
- DataPtr < (UINT8 *) ((UINT8 *) Table + Table->Length - 4);
- DataPtr++) {
- if (CompareMem(DataPtr, "_CRS", 4) == 0) {
- DataPtr += 4; // Skip _CRS
- ASSERT (*DataPtr == AML_BUFFER_OP);
- DataPtr ++; // Skip AML_BUFFER_OP
- ASSERT ((*DataPtr & (BIT7|BIT6)) == 0);
- DataPtr ++; // Skip PkgLength - 0xD
- ASSERT ((*DataPtr) == AML_BYTE_PREFIX);
- DataPtr ++; // Skip BufferSize OpCode
- DataPtr ++; // Skip BufferSize - 0xA
- IoRsc = (VOID *)DataPtr;
- ASSERT (IoRsc->Header.Bits.Type == ACPI_SMALL_ITEM_FLAG);
- ASSERT (IoRsc->Header.Bits.Name == ACPI_SMALL_IO_PORT_DESCRIPTOR_NAME);
- ASSERT (IoRsc->Header.Bits.Length == sizeof(EFI_ACPI_IO_PORT_DESCRIPTOR) - sizeof(ACPI_SMALL_RESOURCE_HEADER));
- DEBUG ((DEBUG_INFO, "IPMI IO Base in ASL update - 0x%04x <= 0x%04x\n", IoRsc->BaseAddressMin, PcdGet16(PcdIpmiIoBaseAddress)));
- IoRsc->BaseAddressMin = PcdGet16(PcdIpmiIoBaseAddress);
- IoRsc->BaseAddressMax = PcdGet16(PcdIpmiIoBaseAddress);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
-
- Entry point for Acpi platform driver.
-
- @param ImageHandle - A handle for the image that is initializing this driver.
- @param SystemTable - A pointer to the EFI system table.
-
- @retval EFI_SUCCESS - Driver initialized successfully.
- @retval EFI_LOAD_ERROR - Failed to Initialize or has been loaded.
- @retval EFI_OUT_OF_RESOURCES - Could not allocate needed resources.
-
-**/
-EFI_STATUS
-EFIAPI
-BmcAcpiEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_STATUS AcpiStatus;
-
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol;
- INTN Instance = 0;
- EFI_ACPI_COMMON_HEADER *CurrentTable = NULL;
- UINTN TableHandle = 0;
- UINT32 FvStatus;
- UINT32 Size;
-
- EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
- UINTN TableSize;
-
-
- //
- // Find the AcpiTable protocol
- //
- Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
-
- //
- // Locate the firmware volume protocol
- //
- Status = LocateSupportProtocol (&gEfiFirmwareVolume2ProtocolGuid, (VOID **) &FwVol, 1);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = EFI_SUCCESS;
- Instance = 0;
-
- //
- // Read tables from the storage file.
- //
- while (!EFI_ERROR (Status)) {
- CurrentTable = NULL;
-
- Status = FwVol->ReadSection (
- FwVol,
- &gEfiCallerIdGuid,
- EFI_SECTION_RAW,
- Instance,
- (VOID **) &CurrentTable,
- (UINTN *) &Size,
- &FvStatus
- );
- if (!EFI_ERROR (Status)) {
- //
- // Perform any table specific updates.
- //
- AcpiStatus = UpdateDeviceSsdtTable (CurrentTable);
- if (!EFI_ERROR (AcpiStatus)) {
-
- TableHandle = 0;
- TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
- ASSERT (Size >= TableSize);
-
- Status = AcpiTable->InstallAcpiTable (
- AcpiTable,
- CurrentTable,
- TableSize,
- &TableHandle
- );
-
- ASSERT_EFI_ERROR (Status);
- }
-
- //
- // Increment the instance
- //
- Instance++;
- }
- }
-
- return EFI_SUCCESS;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c
deleted file mode 100644
index a6d075b19c..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/** @file
- BMC Event Log functions.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Uefi.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/IpmiCommandLib.h>
-
-EFI_STATUS
-EFIAPI
-CheckIfSelIsFull (
- VOID
- );
-
-/*++
-
- Routine Description:
- This function verifies the BMC SEL is full and When it is reports the error to the Error Manager.
-
- Arguments:
- None
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-EFI_STATUS
-WaitTillErased (
- UINT8 *ResvId
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- BmcElogPrivateData - Bmc event log instance
- ResvId - Reserved ID
-
-Returns:
-
- EFI_SUCCESS
- EFI_NO_RESPONSE
-
---*/
-{
- INTN Counter;
- IPMI_CLEAR_SEL_REQUEST ClearSel;
- IPMI_CLEAR_SEL_RESPONSE ClearSelResponse;
-
- Counter = 0x200;
- ZeroMem (&ClearSelResponse, sizeof(ClearSelResponse));
-
- while (TRUE) {
- ZeroMem (&ClearSel, sizeof(ClearSel));
- ClearSel.Reserve[0] = ResvId[0];
- ClearSel.Reserve[1] = ResvId[1];
- ClearSel.AscC = 0x43;
- ClearSel.AscL = 0x4C;
- ClearSel.AscR = 0x52;
- ClearSel.Erase = 0x00;
-
- IpmiClearSel (
- &ClearSel,
- &ClearSelResponse
- );
-
- if ((ClearSelResponse.ErasureProgress & 0xf) == 1) {
- return EFI_SUCCESS;
- }
- //
- // If there is not a response from the BMC controller we need to return and not hang.
- //
- --Counter;
- if (Counter == 0x0) {
- return EFI_NO_RESPONSE;
- }
- }
-}
-
-EFI_STATUS
-EfiActivateBmcElog (
- IN BOOLEAN *EnableElog,
- OUT BOOLEAN *ElogStatus
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- This - Protocol pointer
- DataType - indicate event log type
- EnableElog - Enable/Disable event log
- ElogStatus - return log status
-
-Returns:
-
- EFI_STATUS
-
---*/
-{
- EFI_STATUS Status;
- UINT8 ElogStat;
- IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST SetBmcGlobalEnables;
- IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE GetBmcGlobalEnables;
- UINT8 CompletionCode;
-
- Status = EFI_SUCCESS;
- ElogStat = 0;
-
- Status = IpmiGetBmcGlobalEnables (&GetBmcGlobalEnables);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- if (EnableElog == NULL) {
- *ElogStatus = GetBmcGlobalEnables.GetEnables.Bits.SystemEventLogging;
- } else {
- if (Status == EFI_SUCCESS) {
- if (*EnableElog) {
- ElogStat = 1;
- }
-
- CopyMem (&SetBmcGlobalEnables, (UINT8 *)&GetBmcGlobalEnables + 1, sizeof(UINT8));
- SetBmcGlobalEnables.SetEnables.Bits.SystemEventLogging = ElogStat;
-
- Status = IpmiSetBmcGlobalEnables (&SetBmcGlobalEnables, &CompletionCode);
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-SetElogRedirInstall (
- VOID
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- BOOLEAN EnableElog;
- BOOLEAN ElogStatus;
-
- //
- // Activate the Event Log (This should depend upon Setup).
- //
- EfiActivateBmcElog (&EnableElog, &ElogStatus);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-InitializeBmcElogLayer (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- ImageHandle - ImageHandle of the loaded driver
- SystemTable - Pointer to the System Table
-
-Returns:
-
- EFI_STATUS
-
---*/
-{
- SetElogRedirInstall ();
-
- CheckIfSelIsFull ();
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-CheckIfSelIsFull (
- VOID
- )
-/*++
-
- Routine Description:
- This function verifies the BMC SEL is full and When it is reports the error to the Error Manager.
-
- Arguments:
- None
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- EFI_STATUS Status;
- UINT8 SelIsFull;
- IPMI_GET_SEL_INFO_RESPONSE SelInfo;
-
- Status = IpmiGetSelInfo (&SelInfo);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Check the Bit7 of the OperationByte if SEL is OverFlow.
- //
- SelIsFull = (SelInfo.OperationSupport & 0x80);
- DEBUG ((DEBUG_INFO, "SelIsFull - 0x%x\n", SelIsFull));
-
- return EFI_SUCCESS;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c
deleted file mode 100644
index 74c52a74eb..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/** @file
- IPMI FRB Driver.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiDxe.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IpmiCommandLib.h>
-#include <IndustryStandard/Ipmi.h>
-
-EFI_STATUS
-EfiDisableFrb (
- VOID
- )
-/*++
-
- Routine Description:
- This routine disables the specified FRB timer.
-
- Arguments:
- This - This pointer
- FrbType - Type of FRB timer to get data on
-
- Returns:
- EFI_SUCCESS - FRB timer was disabled
- EFI_ABORTED - Timer was already stopped
- EFI_UNSUPPORTED - This type of FRB timer is not supported.
-
---*/
-{
- EFI_STATUS Status;
- IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer;
- UINT8 CompletionCode;
- IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
-
- Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Check if timer is still running, if not abort disable routine.
- //
- if (GetWatchdogTimer.TimerUse.Bits.TimerRunning == 0) {
- return EFI_ABORTED;
- }
-
- ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer));
- //
- // Just flip the Timer Use bit. This should release the timer.
- //
- SetWatchdogTimer.TimerUse.Bits.TimerRunning = 0;
- SetWatchdogTimer.TimerUse.Bits.TimerUse = IPMI_WATCHDOG_TIMER_BIOS_FRB2;
- SetWatchdogTimer.TimerUseExpirationFlagsClear &= ~BIT2;
- SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT4;
-
- Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
- return Status;
-}
-
-VOID
-EFIAPI
-DisableFRB2Handler (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
- Disables FRB2. This function gets called each time the
- EFI_EVENT_SIGNAL_READY_TO_BOOT gets signaled
-
- Arguments:
- Standard event notification function arguments:
- Event - the event that is signaled.
- Context - not used here.
-
- Returns:
-
---*/
-{
- DEBUG((EFI_D_ERROR, "!!! enter DisableFRB2Handler()!!!\n"));
-
- EfiDisableFrb ();
-}
-
-EFI_STATUS
-CheckForAndReportErrors(
- VOID
- )
-/*++
-
- Routine Description:
- Check the Watchdog timer expiration flags and report the kind of watchdog
- timeout occurred to the Error Manager.
-
- Arguments:
-
- Returns:
- EFI_SUCCESS - Errors retrieved and reported
-
---*/
-{
- EFI_STATUS Status;
- IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
- IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer;
- UINT8 CompletionCode;
-
- //
- // Get the Watchdog timer info to find out what kind of timer expiration occurred.
- //
- Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // If FRB2 Failure occurred, report it to the error manager and log a SEL.
- //
- if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT1) != 0) {
- //
- // Report the FRB2 time-out error
- //
- } else if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT3) != 0) {
- //
- // Report the OS Watchdog timer failure
- //
- }
-
- //
- // Need to clear Timer expiration flags after checking.
- //
- ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer));
- SetWatchdogTimer.TimerUse = GetWatchdogTimer.TimerUse;
- SetWatchdogTimer.TimerActions = GetWatchdogTimer.TimerActions;
- SetWatchdogTimer.PretimeoutInterval = GetWatchdogTimer.PretimeoutInterval;
- SetWatchdogTimer.TimerUseExpirationFlagsClear = GetWatchdogTimer.TimerUseExpirationFlagsClear;
- SetWatchdogTimer.InitialCountdownValue = GetWatchdogTimer.InitialCountdownValue;
- SetWatchdogTimer.TimerUse.Bits.TimerRunning = 1;
- SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT2 | BIT3;
-
- Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
-
- return Status;
-}
-
-EFI_STATUS
-ReportFrb2Status (
- VOID
- )
-/*++
-
- Routine Description:
- This routine is built only when DEBUG_MODE is enabled. It is used
- to report the status of FRB2 when the FRB2 driver is installed.
-
- Arguments:
- none
-
- Returns:
- EFI_SUCCESS: All info was retrieved and reported
- EFI_ERROR: There was an error during info retrieval
-
---*/
-{
- EFI_STATUS Status;
- IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
-
- //
- // Get the Watchdog timer info to find out what kind of timer expiration occurred.
- //
- Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_INFO, "Failed to get Watchdog Timer info from BMC.\n"));
- return Status;
- }
-
- //
- // Check if timer is running, report status to DEBUG_MODE output.
- //
- if (GetWatchdogTimer.TimerUse.Bits.TimerRunning == 1) {
- DEBUG ((DEBUG_INFO, "FRB2 Timer is running.\n"));
- } else {
- DEBUG ((DEBUG_INFO, "FRB2 Timer is not running.\n"));
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-FrbDxeEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
- Routine Description:
- This is the standard EFI driver point. This function intitializes
- the private data required for creating FRB Driver.
-
- Arguments:
- ImageHandle - Handle for the image of this driver
- SystemTable - Pointer to the EFI System Table
-
- Returns:
- EFI_SUCCESS - Protocol successfully started and installed
- EFI_UNSUPPORTED - Protocol can't be started
-
---*/
-{
- EFI_EVENT ReadyToBootEvent;
- EFI_STATUS Status;
-
- CheckForAndReportErrors();
- ReportFrb2Status ();
-
- //
- // Register the event to Disable FRB2 before Boot.
- //
- Status = EfiCreateEventReadyToBootEx (
- TPL_NOTIFY,
- DisableFRB2Handler,
- NULL,
- &ReadyToBootEvent
- );
-
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c
deleted file mode 100644
index 5d33df0103..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @file
- IPMI FRB PEIM.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/IoLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IpmiCommandLib.h>
-
-#include <IndustryStandard/Ipmi.h>
-
-VOID
-SetWatchDogTimer (
- IN BOOLEAN Frb2Enabled
- )
-{
- EFI_STATUS Status;
- IPMI_SET_WATCHDOG_TIMER_REQUEST FrbTimer;
- IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
- UINT8 CompletionCode;
-
- Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
- if (EFI_ERROR(Status)) {
- return ;
- }
-
- if (Frb2Enabled) {
- ZeroMem (&FrbTimer, sizeof(FrbTimer));
- //Byte 1
- FrbTimer.TimerUse.Bits.TimerUse = IPMI_WATCHDOG_TIMER_BIOS_FRB2;
- //Byte 2
- FrbTimer.TimerActions.Uint8 = 0; //NormalBoot, NoTimeOutInterrupt. i.e no action when BMC watchdog timeout
- //Byte 3
- FrbTimer.PretimeoutInterval = 0;
- //Byte 4
- FrbTimer.TimerUseExpirationFlagsClear |= BIT1; //set Frb2ExpirationFlag
-
- //Data Byte 5/6
- FrbTimer.InitialCountdownValue = PcdGet16(PcdFRBTimeoutValue) * 10;
-
- //Set BMC watchdog timer
- Status = IpmiSetWatchdogTimer (&FrbTimer, &CompletionCode);
- Status = IpmiResetWatchdogTimer (&CompletionCode);
- }
-}
-
-EFI_STATUS
-EFIAPI
-InitializeFrbPei (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- FfsHeader
- PeiServices
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- BOOLEAN Frb2Enabled;
-
- //
- // If we are booting with defaults, then make sure FRB2 is enabled.
- //
- Frb2Enabled = PcdGetBool (PcdFRB2EnabledFlag);
-
- SetWatchDogTimer (Frb2Enabled);
-
- return EFI_SUCCESS;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c
deleted file mode 100644
index 58e1fb4d7e..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/** @file
- IPMI FRU Driver.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Library/BaseLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/IpmiCommandLib.h>
-#include <IndustryStandard/Ipmi.h>
-
-EFI_STATUS
-EFIAPI
-InitializeFru (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Initialize SM Redirection Fru Layer
-
-Arguments:
-
- ImageHandle - ImageHandle of the loaded driver
- SystemTable - Pointer to the System Table
-
-Returns:
-
- EFI_STATUS
-
---*/
-{
- EFI_STATUS Status;
- IPMI_GET_DEVICE_ID_RESPONSE ControllerInfo;
- IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST GetFruInventoryAreaInfoRequest;
- IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE GetFruInventoryAreaInfoResponse;
-
- //
- // Get all the SDR Records from BMC and retrieve the Record ID from the structure for future use.
- //
- Status = IpmiGetDeviceId (&ControllerInfo);
- if (EFI_ERROR (Status)) {
- DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetDeviceId Status=%x\n", Status));
- return Status;
- }
-
- DEBUG((DEBUG_ERROR, "!!! IpmiFru FruInventorySupport %x\n", ControllerInfo.DeviceSupport.Bits.FruInventorySupport));
-
- if (ControllerInfo.DeviceSupport.Bits.FruInventorySupport) {
- GetFruInventoryAreaInfoRequest.DeviceId = 0;
- Status = IpmiGetFruInventoryAreaInfo (&GetFruInventoryAreaInfoRequest, &GetFruInventoryAreaInfoResponse);
- if (EFI_ERROR (Status)) {
- DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetFruInventoryAreaInfo Status=%x\n", Status));
- return Status;
- }
- DEBUG((DEBUG_ERROR, "!!! IpmiFru InventoryAreaSize=%x\n", GetFruInventoryAreaInfoResponse.InventoryAreaSize));
- }
-
- return EFI_SUCCESS;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.c
deleted file mode 100644
index fccbb3b5dc..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/** @file
- IPMI stack initialization.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiDxe.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/TimerLib.h>
-#include <Library/IpmiCommandLib.h>
-
-#define BMC_TIMEOUT 30 // [s] How long shall BIOS wait for BMC
-#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout
-
-EFI_STATUS
-GetSelfTest (
- VOID
- )
-/*++
-
-Routine Description:
-
- Execute the Get Self Test results command to determine whether or not the BMC self tests
- have passed
-
-Arguments:
-
- mIpmiInstance - Data structure describing BMC variables and used for sending commands
- StatusCodeValue - An array used to accumulate error codes for later reporting.
- ErrorCount - Counter used to keep track of error codes in StatusCodeValue
-
-Returns:
-
- EFI_SUCCESS - BMC Self test results are retrieved and saved into BmcStatus
- EFI_DEVICE_ERROR - BMC failed to return self test results.
-
---*/
-{
- EFI_STATUS Status;
- IPMI_SELF_TEST_RESULT_RESPONSE TestResult;
-
- //
- // Get the SELF TEST Results.
- //
- Status = IpmiGetSelfTestResult (&TestResult);
- if (EFI_ERROR(Status)) {
- DEBUG((DEBUG_ERROR, "\n[IPMI] BMC does not respond (status: %r)!\n\n", Status));
- return Status;
- }
-
- DEBUG((DEBUG_INFO, "[IPMI] BMC self-test result: %02X-%02X\n", TestResult.Result, TestResult.Param));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetDeviceId (
- OUT BOOLEAN *UpdateMode
- )
-/*++
-
-Routine Description:
- Execute the Get Device ID command to determine whether or not the BMC is in Force Update
- Mode. If it is, then report it to the error manager.
-
-Arguments:
-
-Returns:
- Status
-
---*/
-{
- EFI_STATUS Status;
- IPMI_GET_DEVICE_ID_RESPONSE BmcInfo;
- UINT32 Retries;
-
- //
- // Set up a loop to retry for up to 30 seconds. Calculate retries not timeout
- // so that in case KCS is not enabled and EfiIpmiSendCommand() returns
- // immediately we will not wait all the 30 seconds.
- //
- Retries = BMC_TIMEOUT / BMC_KCS_TIMEOUT + 1;
- //
- // Get the device ID information for the BMC.
- //
- do {
- Status = IpmiGetDeviceId (&BmcInfo);
- if (!EFI_ERROR(Status)) {
- break;
- }
- DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d retries left\n", Status, Retries));
- MicroSecondDelay(50 * 1000);
- if (Retries-- == 0) {
- return Status;
- }
- } while (TRUE);
-
- DEBUG((
- DEBUG_INFO,
- "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n",
- BmcInfo.DeviceId,
- BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev,
- BmcInfo.MinorFirmwareRev
- ));
- *UpdateMode = (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode;
- return Status;
-}
-
-/**
- The entry point of the Ipmi DXE.
-
-@param[in] ImageHandle - Handle of this driver image
-@param[in] SystemTable - Table containing standard EFI services
-
-@retval EFI_SUCCESS - Always success is returned even if KCS does not function
-
- **/
-EFI_STATUS
-EFIAPI
-IpmiInterfaceInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- BOOLEAN UpdateMode;
- EFI_STATUS Status;
-
- DEBUG((EFI_D_ERROR,"IPMI Dxe:Get BMC Device Id\n"));
-
- //
- // Get the Device ID and check if the system is in Force Update mode.
- //
- Status = GetDeviceId (&UpdateMode);
- //
- // Do not continue initialization if the BMC is in Force Update Mode.
- //
- if (!EFI_ERROR(Status) && !UpdateMode) {
- //
- // Get the SELF TEST Results.
- //
- GetSelfTest ();
- }
-
- return EFI_SUCCESS;
-}
-
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.c
deleted file mode 100644
index 062d20c44e..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/** @file
- IPMI stack initialization in PEI.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/TimerLib.h>
-#include <Library/IpmiCommandLib.h>
-
-#define BMC_TIMEOUT_PEI 50 // [s] How long shall BIOS wait for BMC
-#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout
-
-EFI_STATUS
-GetDeviceId (
- OUT BOOLEAN *UpdateMode
- )
-/*++
-
-Routine Description:
- Execute the Get Device ID command to determine whether or not the BMC is in Force Update
- Mode. If it is, then report it to the error manager.
-
-Arguments:
-
-Returns:
- Status
-
---*/
-{
- EFI_STATUS Status;
- IPMI_GET_DEVICE_ID_RESPONSE BmcInfo;
- UINT32 Retries;
-
- //
- // Set up a loop to retry for up to 30 seconds. Calculate retries not timeout
- // so that in case KCS is not enabled and EfiIpmiSendCommand() returns
- // immediately we will not wait all the 30 seconds.
- //
- Retries = BMC_TIMEOUT_PEI/ BMC_KCS_TIMEOUT + 1;
- //
- // Get the device ID information for the BMC.
- //
- do {
- Status = IpmiGetDeviceId (&BmcInfo);
- if (!EFI_ERROR(Status)) {
- break;
- }
- DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d retries left\n", Status, Retries));
- if (Retries-- == 0) {
- return Status;
- }
- } while (TRUE);
-
- DEBUG((
- DEBUG_INFO,
- "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n",
- BmcInfo.DeviceId,
- BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev,
- BmcInfo.MinorFirmwareRev
- ));
- *UpdateMode = (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode;
- return Status;
-}
-
-/**
- The entry point of the Ipmi PEIM.
-
- @param FileHandle Handle of the file being invoked.
- @param PeiServices Describes the list of possible PEI Services.
-
- @retval EFI_SUCCESS Indicates that Ipmi initialization completed successfully.
- @retval Others Indicates that Ipmi initialization could not complete successfully.
-**/
-EFI_STATUS
-EFIAPI
-PeimIpmiInterfaceInit (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- BOOLEAN UpdateMode;
- EFI_STATUS Status;
-
- DEBUG ((DEBUG_INFO, "IPMI Peim:Get BMC Device Id\n"));
-
- //
- // Get the Device ID and check if the system is in Force Update mode.
- //
- Status = GetDeviceId (&UpdateMode);
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
deleted file mode 100644
index b57db50610..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/** @file
- IPMI Command - NetFnApp.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IpmiLib.h>
-
-#include <IndustryStandard/Ipmi.h>
-
-EFI_STATUS
-EFIAPI
-IpmiGetDeviceId (
- OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*DeviceId);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_GET_DEVICE_ID,
- NULL,
- 0,
- (VOID *)DeviceId,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelfTestResult (
- OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*SelfTestResult);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_GET_SELFTEST_RESULTS,
- NULL,
- 0,
- (VOID *)SelfTestResult,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiResetWatchdogTimer (
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_RESET_WATCHDOG_TIMER,
- NULL,
- 0,
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiSetWatchdogTimer (
- IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_SET_WATCHDOG_TIMER,
- (VOID *)SetWatchdogTimer,
- sizeof(*SetWatchdogTimer),
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetWatchdogTimer (
- OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetWatchdogTimer);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_GET_WATCHDOG_TIMER,
- NULL,
- 0,
- (VOID *)GetWatchdogTimer,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiSetBmcGlobalEnables (
- IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_SET_BMC_GLOBAL_ENABLES,
- (VOID *)SetBmcGlobalEnables,
- sizeof(*SetBmcGlobalEnables),
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetBmcGlobalEnables (
- OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetBmcGlobalEnables);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_GET_BMC_GLOBAL_ENABLES,
- NULL,
- 0,
- (VOID *)GetBmcGlobalEnables,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiClearMessageFlags (
- IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_CLEAR_MESSAGE_FLAGS,
- (VOID *)ClearMessageFlagsRequest,
- sizeof(*ClearMessageFlagsRequest),
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetMessageFlags (
- OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetMessageFlagsResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_GET_MESSAGE_FLAGS,
- NULL,
- 0,
- (VOID *)GetMessageFlagsResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetMessage (
- OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse,
- IN OUT UINT32 *GetMessageResponseSize
- )
-{
- EFI_STATUS Status;
-
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_GET_MESSAGE,
- NULL,
- 0,
- (VOID *)GetMessageResponse,
- GetMessageResponseSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiSendMessage (
- IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest,
- IN UINT32 SendMessageRequestSize,
- OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse,
- IN OUT UINT32 *SendMessageResponseSize
- )
-{
- EFI_STATUS Status;
-
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_SEND_MESSAGE,
- (VOID *)SendMessageRequest,
- SendMessageRequestSize,
- (VOID *)SendMessageResponse,
- SendMessageResponseSize
- );
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
deleted file mode 100644
index 1b86aa888e..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/** @file
- IPMI Command - NetFnChassis.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IpmiLib.h>
-
-#include <IndustryStandard/Ipmi.h>
-
-
-EFI_STATUS
-EFIAPI
-IpmiGetChassisCapabilities (
- OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetChassisCapabilitiesResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_CHASSIS,
- IPMI_CHASSIS_GET_CAPABILITIES,
- NULL,
- 0,
- (VOID *)GetChassisCapabilitiesResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetChassisStatus (
- OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetChassisStatusResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_CHASSIS,
- IPMI_CHASSIS_GET_STATUS,
- NULL,
- 0,
- (VOID *)GetChassisStatusResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiChassisControl (
- IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_CHASSIS,
- IPMI_CHASSIS_CONTROL,
- (VOID *)ChassisControlRequest,
- sizeof(*ChassisControlRequest),
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiSetPowerRestorePolicy (
- IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest,
- OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*ChassisControlResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_CHASSIS,
- IPMI_CHASSIS_SET_POWER_RESTORE_POLICY,
- (VOID *)ChassisControlRequest,
- sizeof(*ChassisControlRequest),
- (VOID *)ChassisControlResponse,
- &DataSize
- );
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c
deleted file mode 100644
index 8e892c5f84..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/** @file
- IPMI Command - NetFnStorage.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IpmiLib.h>
-
-#include <IndustryStandard/Ipmi.h>
-
-
-EFI_STATUS
-EFIAPI
-IpmiGetFruInventoryAreaInfo (
- IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoRequest,
- OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetFruInventoryAreaInfoResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_GET_FRU_INVENTORY_AREAINFO,
- (VOID *)GetFruInventoryAreaInfoRequest,
- sizeof(*GetFruInventoryAreaInfoRequest),
- (VOID *)GetFruInventoryAreaInfoResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiReadFruData (
- IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest,
- OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse,
- IN OUT UINT32 *ReadFruDataResponseSize
- )
-{
- EFI_STATUS Status;
-
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_READ_FRU_DATA,
- (VOID *)ReadFruDataRequest,
- sizeof(*ReadFruDataRequest),
- (VOID *)ReadFruDataResponse,
- ReadFruDataResponseSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiWriteFruData (
- IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest,
- IN UINT32 WriteFruDataRequestSize,
- OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*WriteFruDataResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_WRITE_FRU_DATA,
- (VOID *)WriteFruDataRequest,
- WriteFruDataRequestSize,
- (VOID *)WriteFruDataResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelInfo (
- OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetSelInfoResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_GET_SEL_INFO,
- NULL,
- 0,
- (VOID *)GetSelInfoResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelEntry (
- IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest,
- OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse,
- IN OUT UINT32 *GetSelEntryResponseSize
- )
-{
- EFI_STATUS Status;
-
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_GET_SEL_ENTRY,
- (VOID *)GetSelEntryRequest,
- sizeof(*GetSelEntryRequest),
- (VOID *)GetSelEntryResponse,
- GetSelEntryResponseSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiAddSelEntry (
- IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest,
- OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*AddSelEntryResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_ADD_SEL_ENTRY,
- (VOID *)AddSelEntryRequest,
- sizeof(*AddSelEntryRequest),
- (VOID *)AddSelEntryResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiPartialAddSelEntry (
- IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest,
- IN UINT32 PartialAddSelEntryRequestSize,
- OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*PartialAddSelEntryResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_PARTIAL_ADD_SEL_ENTRY,
- (VOID *)PartialAddSelEntryRequest,
- PartialAddSelEntryRequestSize,
- (VOID *)PartialAddSelEntryResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiClearSel (
- IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest,
- OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*ClearSelResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_CLEAR_SEL,
- (VOID *)ClearSelRequest,
- sizeof(*ClearSelRequest),
- (VOID *)ClearSelResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelTime (
- OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetSelTimeResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_GET_SEL_TIME,
- NULL,
- 0,
- (VOID *)GetSelTimeResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiSetSelTime (
- IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_SET_SEL_TIME,
- (VOID *)SetSelTimeRequest,
- sizeof(*SetSelTimeRequest),
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSdrRepositoryInfo (
- OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetSdrRepositoryInfoResp);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_GET_SDR_REPOSITORY_INFO,
- NULL,
- 0,
- (VOID *)GetSdrRepositoryInfoResp,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSdr (
- IN IPMI_GET_SDR_REQUEST *GetSdrRequest,
- OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse,
- IN OUT UINT32 *GetSdrResponseSize
- )
-{
- EFI_STATUS Status;
-
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_GET_SDR,
- (VOID *)GetSdrRequest,
- sizeof(*GetSdrRequest),
- (VOID *)GetSdrResponse,
- GetSdrResponseSize
- );
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c
deleted file mode 100644
index 3b9b17b909..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/** @file
- IPMI Command - NetFnTransport.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IpmiLib.h>
-
-#include <IndustryStandard/Ipmi.h>
-
-
-EFI_STATUS
-EFIAPI
-IpmiSolActivating (
- IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_TRANSPORT,
- IPMI_TRANSPORT_SOL_ACTIVATING,
- (VOID *)SolActivatingRequest,
- sizeof(*SolActivatingRequest),
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiSetSolConfigurationParameters (
- IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationParametersRequest,
- IN UINT32 SetConfigurationParametersRequestSize,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_TRANSPORT,
- IPMI_TRANSPORT_SET_SOL_CONFIG_PARAM,
- (VOID *)SetConfigurationParametersRequest,
- SetConfigurationParametersRequestSize,
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSolConfigurationParameters (
- IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationParametersRequest,
- OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationParametersResponse,
- IN OUT UINT32 *GetConfigurationParametersResponseSize
- )
-{
- EFI_STATUS Status;
-
- Status = IpmiSubmitCommand (
- IPMI_NETFN_TRANSPORT,
- IPMI_TRANSPORT_GET_SOL_CONFIG_PARAM,
- (VOID *)GetConfigurationParametersRequest,
- sizeof(*GetConfigurationParametersRequest),
- (VOID *)GetConfigurationParametersResponse,
- GetConfigurationParametersResponseSize
- );
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c
deleted file mode 100644
index db4c7ada7e..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file
- IPMI library.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/DebugLib.h>
-
-#include <IndustryStandard/Ipmi.h>
-
-/**
- This service enables submitting commands via Ipmi.
-
- @param[in] NetFunction Net function of the command.
- @param[in] Command IPMI Command.
- @param[in] RequestData Command Request Data.
- @param[in] RequestDataSize Size of Command Request Data.
- @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
- @param[in, out] ResponseDataSize Size of Command Response Data.
-
- @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
- @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
- @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
- @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
- @retval EFI_TIMEOUT The command time out.
- @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
- @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource or data size error.
-**/
-EFI_STATUS
-EFIAPI
-IpmiSubmitCommand (
- IN UINT8 NetFunction,
- IN UINT8 Command,
- IN UINT8 *RequestData,
- IN UINT32 RequestDataSize,
- OUT UINT8 *ResponseData,
- IN OUT UINT32 *ResponseDataSize
- )
-{
- return EFI_UNSUPPORTED;
-}
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c
deleted file mode 100644
index bdc8d23827..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/** @file
- IPMI platform hook library.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Library/IpmiPlatformHookLib.h>
-
-//
-// Prototype definitions for IPMI Platform Update Library
-//
-EFI_STATUS
-EFIAPI
-PlatformIpmiIoRangeSet(
- UINT16 IpmiIoBase
- )
-/*++
-
- Routine Description:
-
- This function sets IPMI Io range
-
- Arguments:
-
- IpmiIoBase
-
- Returns:
-
- Status
-
---*/
-{
- return EFI_SUCCESS;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c
deleted file mode 100644
index 25139eadba..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/** @file
- IPMI Os watchdog timer Driver.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Uefi.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/IpmiCommandLib.h>
-#include <IndustryStandard/Ipmi.h>
-
-BOOLEAN mOsWdtFlag = FALSE;
-
-EFI_EVENT mExitBootServicesEvent;
-
-VOID
-EFIAPI
-EnableEfiOsBootWdtHandler (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
- Enable the OS Boot Watchdog Timer.
- Is called only on legacy or EFI OS boot.
-
-Arguments:
- Event - Event type
- *Context - Context for the event
-
-Returns:
- None
-
---*/
-{
- EFI_STATUS Status;
- IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer;
- UINT8 CompletionCode;
- IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
- static BOOLEAN OsWdtEventHandled = FALSE;
-
- DEBUG((EFI_D_ERROR, "!!! EnableEfiOsBootWdtHandler()!!!\n"));
-
- //
- // Make sure it processes once only. And proceess it only if OsWdtFlag==TRUE;
- //
- if (OsWdtEventHandled || !mOsWdtFlag) {
- return ;
- }
-
- OsWdtEventHandled = TRUE;
-
- Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
- if (EFI_ERROR (Status)) {
- return ;
- }
-
- ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer));
- //
- // Just flip the Timer Use bit. This should release the timer.
- //
- SetWatchdogTimer.TimerUse.Bits.TimerRunning = 1;
- SetWatchdogTimer.TimerUse.Bits.TimerUse = IPMI_WATCHDOG_TIMER_OS_LOADER;
- SetWatchdogTimer.TimerActions.Uint8 = IPMI_WATCHDOG_TIMER_ACTION_HARD_RESET;
- SetWatchdogTimer.TimerUseExpirationFlagsClear &= ~BIT4;
- SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT2;
- SetWatchdogTimer.InitialCountdownValue = 600; // 100ms / count
-
- Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
- return ;
-}
-
-EFI_STATUS
-EFIAPI
-DriverInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- This is the standard EFI driver point. This function intitializes
- the private data required for creating ASRR Driver.
-
-Arguments:
- As required for DXE driver enrty routine.
- ImageHandle - ImageHandle of the loaded driver
- SystemTable - Pointer to the System Table
-
-Returns:
- @retval EFI_SUCCESS Protocol successfully started and installed.
- @retval EFI_OUT_OF_RESOURCES The event could not be allocated.
-
---*/
-{
- EFI_STATUS Status;
-
- Status = gBS->CreateEvent (
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_NOTIFY,
- EnableEfiOsBootWdtHandler,
- NULL,
- &mExitBootServicesEvent
- );
-
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.c
deleted file mode 100644
index 47bec1975a..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/** @file
- IPMI Serial Over Lan Driver.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Uefi.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/IpmiCommandLib.h>
-#include <IndustryStandard/Ipmi.h>
-
-#define SOL_CMD_RETRY_COUNT 10
-
-/*++
-
-Routine Description:
-
- This routine gets the SOL payload status or settings for a specific channel.
-
-Arguments:
- Channel - LAN channel naumber.
- ParamSel - Configuration parameter selection.
- Data - Information returned from BMC.
-Returns:
- EFI_SUCCESS - SOL configuration parameters are successfully read from BMC.
- Others - SOL configuration parameters could not be read from BMC.
-
---*/
-EFI_STATUS
-GetSOLStatus (
- IN UINT8 Channel,
- IN UINT8 ParamSel,
- IN OUT UINT8 *Data
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
- IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST GetConfigurationParametersRequest;
- IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE GetConfigurationParametersResponse;
- UINT32 DataSize;
- UINT8 RetryCount;
-
- for (RetryCount = 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) {
- ZeroMem (&GetConfigurationParametersRequest, sizeof(GetConfigurationParametersRequest));
- GetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber = Channel;
- GetConfigurationParametersRequest.ParameterSelector = ParamSel;
-
- ZeroMem (&GetConfigurationParametersResponse, sizeof(GetConfigurationParametersResponse));
-
- DataSize = sizeof(GetConfigurationParametersResponse);
- Status = IpmiGetSolConfigurationParameters (
- &GetConfigurationParametersRequest,
- &GetConfigurationParametersResponse,
- &DataSize
- );
-
- if (Status == EFI_SUCCESS){
- break;
- } else {
- gBS->Stall(100000);
- }
- }
-
- if (Status == EFI_SUCCESS) {
- *Data = GetConfigurationParametersResponse.ParameterData[0];
- }
-
- return Status;
-}
-
-/*++
-
-Routine Description:
-
- This routine sets the SOL payload configuration parameters for a specific channel.
-
-Arguments:
- Channel - LAN channel naumber.
- ParamSel - Configuration parameter selection.
- Data - Configuration parameter values.
-Returns:
- EFI_SUCCESS - SOL configuration parameters are sent to BMC.
- Others - SOL configuration parameters could not be sent to BMC.
-
---*/
-EFI_STATUS
-SetSOLParams (
- IN UINT8 Channel,
- IN UINT8 ParamSel,
- IN UINT8 Data
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
- IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST SetConfigurationParametersRequest;
- UINT8 CompletionCode;
- UINT8 RetryCount;
-
- for (RetryCount = 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) {
- ZeroMem (&SetConfigurationParametersRequest, sizeof(SetConfigurationParametersRequest));
- SetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber = Channel;
- SetConfigurationParametersRequest.ParameterSelector = ParamSel;
- SetConfigurationParametersRequest.ParameterData[0] = Data;
-
- CompletionCode = 0;
-
- Status = IpmiSetSolConfigurationParameters (
- &SetConfigurationParametersRequest,
- sizeof(SetConfigurationParametersRequest),
- &CompletionCode
- );
-
- if (Status == EFI_SUCCESS) {
- break;
- } else {
- gBS->Stall(100000);
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-SolStatusEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
- Routine Description:
- This is the standard EFI driver point. This function intitializes
- the private data required for creating SOL Status Driver.
-
- Arguments:
- ImageHandle - Handle for the image of this driver
- SystemTable - Pointer to the EFI System Table
-
- Returns:
- EFI_SUCCESS - Protocol successfully installed
- EFI_UNSUPPORTED - Protocol can't be installed.
-
---*/
-{
- EFI_STATUS Status = EFI_SUCCESS;
- UINT8 Channel;
- BOOLEAN SolEnabled = FALSE;
-
- for (Channel = 1; Channel <= PcdGet8 (PcdMaxSOLChannels); Channel++) {
- Status = GetSOLStatus (Channel, IPMI_SOL_CONFIGURATION_PARAMETER_SOL_ENABLE, &SolEnabled);
- if (Status == EFI_SUCCESS) {
- DEBUG ((DEBUG_ERROR, "SOL enabling status for channel %x is %x\n", Channel, SolEnabled));
- } else {
- DEBUG ((DEBUG_ERROR, "Failed to get channel %x SOL status from BMC!, status is %x\n", Channel, Status));
- }
- }
-
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/BmcSsdt.asl b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/BmcSsdt.asl
deleted file mode 100644
index 0daa175205..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/BmcSsdt.asl
+++ /dev/null
@@ -1,28 +0,0 @@
-/** @file
- BMC ACPI SSDT.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-DefinitionBlock (
- "BmcSsdt.aml",
- "SSDT",
- 0x02, // SSDT revision.
- // A Revision field value greater than or equal to 2 signifies that integers
- // declared within the Definition Block are to be evaluated as 64-bit values
- "INTEL", // OEM ID (6 byte string)
- "BMCACPI", // OEM table ID (8 byte string)
- 0x0 // OEM version of DSDT table (4 byte Integer)
- )
-{
-
- External(\_SB.PC00.LPC0, DeviceObj)
-
- Scope (\_SB.PC00.LPC0)
- {
- #include "IpmiOprRegions.asi"
- }
-
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOprRegions.asi b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOprRegions.asi
deleted file mode 100644
index d2ae5fc40a..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOprRegions.asi
+++ /dev/null
@@ -1,58 +0,0 @@
-/** @file
- IPMI ACPI SSDT.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-Device(IPMC)
-{
- // Config DWord, modified during POST
- // Bit definitions are the same as PPMFlags:
- // [00] = Plug and Play BMC Detection enabled in setup
- // [31:01] = Reserved = 0
-
- Name(ECFL, 0x80000000)
-
- // Return the interface specification revision
- Method(_SRV)
- {
- // IPMI Specification Revision v2.0
- Return(0x0200)
- }
-
- Method(_STA, 0)
- {
- //
- // Assume OK
- //
- Store (0xF, Local0)
-
- Return(Local0)
-
- // Bit 0 - Set if the device is present.
- // Bit 1 - Set if the device is enabled and decoding its resources.
- // Bit 2 - Set if the device should be shown in the UI.
- // Bit 3 - Set if the device is functioning properly (cleared if the device failed its diagnostics).
- // Bit 4 - Set if the battery is present.
- // Bit 5 - Reserved (must be cleared).
- } // end of _STA
-
- // Return the x86 resources consumed by BMC
- Name(_CRS, ResourceTemplate()
- {
- // Uses 8-bit ports 0xCA2-0xCA5
- IO(Decode16, 0xCA2, 0xCA2, 0, 2)
- })
-
- Name(_HID, "IPI0001") // IPMI device
- Name(_IFT, 0x1) // KCS system interface type
- Name(_STR, Unicode("IPMI_KCS"))
-
- Name(_UID, 0) // First interface.
-
-
-} // end of Device(IPMC)
-
-
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 16/49] Features/Intel/IpmiFeaturePkg: Add initial package
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (14 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 15/49] AdvancedFeaturePkg: Remove the IPMI feature Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:48 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 17/49] Features/Intel/IpmiFeaturePkg: Add libraries Kubacki, Michael A
` (31 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Adds a new feature package for the IPMI feature.
This change updates the advanced feature package template for IPMI
and adds the updated template to the IpmiFeaturePkg.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec | 29 +++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc | 24 ++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf | 8 ++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf | 8 ++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md | 86 ++++++++++++++++++++
5 files changed, 155 insertions(+)
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
new file mode 100644
index 0000000000..dfa8888e88
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
@@ -0,0 +1,29 @@
+## @file
+# This package provides advanced feature functionality to enable the
+# Intelligent Platform Management Interface (IPMI).
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = IpmiFeaturePkg
+ PACKAGE_GUID = AE091910-F6C9-4AB5-B8B4-995E2F0D5166
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[Guids]
+ gIpmiFeaturePkgTokenSpaceGuid = {0xc05283f6, 0xd6a8, 0x48f3, {0x9b, 0x59, 0xfb, 0xca, 0x71, 0x32, 0x0f, 0x12}}
+
+[PcdsFeatureFlag]
+ gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable|FALSE|BOOLEAN|0xA0000001
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
new file mode 100644
index 0000000000..1952ba185e
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
@@ -0,0 +1,24 @@
+## @file
+# This package provides advanced feature functionality to enable the
+# Intelligent Platform Management Interface (IPMI).
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ PLATFORM_NAME = IpmiFeaturePkg
+ PLATFORM_GUID = 7B2E74D7-9538-4818-B51A-492F3D33BD20
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..c3847c54c7
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for post-memory modules that enable Intelligent Platform Management Interface.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..0c82d7eb02
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory modules that enable Intelligent Platform Management Interface.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md
new file mode 100644
index 0000000000..eaa56835f5
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md
@@ -0,0 +1,86 @@
+# Overview
+* **Feature Name:** Intelligent Platform Management Interface (IPMI)
+* **PI Phase(s) Supported:** PEI, DXE
+* **SMM Required?** No
+
+## Purpose
+*_TODO_*
+Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph.
+
+# High-Level Theory of Operation
+*_TODO_*
+A description of how the device works at a high-level.
+
+The description should not be constrained to implementation details but provide a simple mental model of how the
+feature is supposed to work.
+
+## Firmware Volumes
+*_TODO_*
+A bulleted list of the firmware volumes that feature module(s) are placed in.
+
+## Modules
+*_TODO_*
+A bulleted list of the modules that make up the feature.
+
+## <Module Name>
+*_TODO_*
+Each module in the feature should have a section that describes the module in a level of detail that is useful
+to better understand the module source code.
+
+## <Library Name>
+*_TODO_*
+Each library in the feature should have a section that describes the library in a level of detail that is useful
+to better understand the library source code.
+
+## Key Functions
+*_TODO_*
+A bulleted list of key functions for interacting with the feature.
+
+Not all features need to be listed. Only functions exposed through external interfaces that are important for feature
+users to be aware of.
+
+## Configuration
+*_TODO_*
+Information that is useful for configuring the feature.
+
+Not all configuration options need to be listed. This section is used to provide more background on configuration
+options than possible elsewhere.
+
+## Data Flows
+*_TODO_*
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+*_TODO_*
+Key control flows for the feature.
+
+## Build Flows
+*_TODO_*
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or require non-standard tool configuration. If the
+standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+*_TODO_*
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the feature is successful. If the test point is not
+implemented, this should be stated.
+
+## Functional Exit Criteria
+*_TODO_*
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board integrator can reference to ensure the feature is
+functional on their board.
+
+## Feature Enabling Checklist
+*_TODO_*
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+*_TODO_*
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 17/49] Features/Intel/IpmiFeaturePkg: Add libraries
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (15 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 16/49] Features/Intel/IpmiFeaturePkg: Add initial package Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 18/49] Features/Intel/IpmiFeaturePkg: Add modules Kubacki, Michael A
` (30 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
This change adds the libraries required for the IPMI feature to
IpmiFeaturePkg.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec | 9 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc | 72 +++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc | 5 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLib.inf | 32 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf | 26 ++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiCommandLib.h | 235 +++++++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiPlatformHookLib.h | 23 ++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c | 248 ++++++++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c | 101 +++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c | 275 ++++++++++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c | 81 ++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c | 36 +++
12 files changed, 1143 insertions(+)
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
index dfa8888e88..4c43fc5f49 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
@@ -22,6 +22,15 @@
[Includes]
Include
+[LibraryClasses]
+ ## @libraryclass Provides services to send IPMI commands.
+ #
+ IpmiCommandLib|Include/Library/IpmiCommandLib.inf
+
+ ## @libraryclass Provides an API for platform-specific IPMI hooks.
+ #
+ IpmiCommandLib|Include/Library/IpmiPlatformHookLib.h
+
[Guids]
gIpmiFeaturePkgTokenSpaceGuid = {0xc05283f6, 0xd6a8, 0x48f3, {0x9b, 0x59, 0xfb, 0xca, 0x71, 0x32, 0x0f, 0x12}}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
new file mode 100644
index 0000000000..c6a385108b
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
@@ -0,0 +1,72 @@
+## @file
+# This is a build description file for the Intelligent Platform Management Interface (IPMI) advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+################################################################################
+[LibraryClasses]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
+
+################################################################################
+#
+# Component section - list of all components that need built for this feature.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+################################################################################
+[Components]
+ #####################################
+ # IPMI Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+ OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLib.inf
+ OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
+
+ # Add components here that should be included in the package build.
+
+###################################################################################################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+###################################################################################################
+[BuildOptions]
+ *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
index 1952ba185e..623a52650f 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
@@ -22,3 +22,8 @@
SUPPORTED_ARCHITECTURES = IA32|X64
BUILD_TARGETS = DEBUG|RELEASE|NOOPT
SKUID_IDENTIFIER = DEFAULT
+
+#
+# This package always builds the feature.
+#
+!include Include/IpmiFeature.dsc
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLib.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLib.inf
new file mode 100644
index 0000000000..0bdace8688
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLib.inf
@@ -0,0 +1,32 @@
+### @file
+# Component description file for IPMI Command Library.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = IpmiCommandLib
+ FILE_GUID = E599C9C7-5913-40A0-8669-67282E2BEC53
+ MODULE_TYPE = UEFI_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = IpmiCommandLib
+
+[sources]
+ IpmiCommandLibNetFnApp.c
+ IpmiCommandLibNetFnTransport.c
+ IpmiCommandLibNetFnChassis.c
+ IpmiCommandLibNetFnStorage.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ BaseMemoryLib
+ DebugLib
+ IpmiLib
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
new file mode 100644
index 0000000000..ab270079aa
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
@@ -0,0 +1,26 @@
+### @file
+# Component description file for IPMI platform Library.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = IpmiPlatformHookLibNull
+ FILE_GUID = C31A5B17-81DB-4D86-B376-17711BB6E0A5
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = IpmiPlatformHookLib
+
+[sources]
+ IpmiPlatformHookLibNull.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ DebugLib
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiCommandLib.h b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiCommandLib.h
new file mode 100644
index 0000000000..9b761717d4
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiCommandLib.h
@@ -0,0 +1,235 @@
+/** @file
+ This library abstract how to send/receive IPMI command.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _IPMI_COMMAND_LIB_H_
+#define _IPMI_COMMAND_LIB_H_
+
+#include <Uefi.h>
+#include <IndustryStandard/Ipmi.h>
+
+//
+// NetFnApp
+//
+EFI_STATUS
+EFIAPI
+IpmiGetDeviceId (
+ OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelfTestResult (
+ OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiResetWatchdogTimer (
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiSetWatchdogTimer (
+ IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetWatchdogTimer (
+ OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiSetBmcGlobalEnables (
+ IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetBmcGlobalEnables (
+ OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiClearMessageFlags (
+ IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetMessageFlags (
+ OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetMessage (
+ OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse,
+ IN OUT UINT32 *GetMessageResponseSize
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiSendMessage (
+ IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest,
+ IN UINT32 SendMessageRequestSize,
+ OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse,
+ IN OUT UINT32 *SendMessageResponseSize
+ );
+
+//
+// NetFnTransport
+//
+EFI_STATUS
+EFIAPI
+IpmiSolActivating (
+ IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiSetSolConfigurationParameters (
+ IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationParametersRequest,
+ IN UINT32 SetConfigurationParametersRequestSize,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSolConfigurationParameters (
+ IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationParametersRequest,
+ OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationParametersResponse,
+ IN OUT UINT32 *GetConfigurationParametersResponseSize
+ );
+
+//
+// NetFnChasis
+//
+EFI_STATUS
+EFIAPI
+IpmiGetChassisCapabilities (
+ OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetChassisStatus (
+ OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiChassisControl (
+ IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiSetPowerRestorePolicy (
+ IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest,
+ OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse
+ );
+
+//
+// NetFnStorage
+//
+EFI_STATUS
+EFIAPI
+IpmiGetFruInventoryAreaInfo (
+ IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoRequest,
+ OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiReadFruData (
+ IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest,
+ OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse,
+ IN OUT UINT32 *ReadFruDataResponseSize
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiWriteFruData (
+ IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest,
+ IN UINT32 WriteFruDataRequestSize,
+ OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelInfo (
+ OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelEntry (
+ IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest,
+ OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse,
+ IN OUT UINT32 *GetSelEntryResponseSize
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiAddSelEntry (
+ IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest,
+ OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiPartialAddSelEntry (
+ IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest,
+ IN UINT32 PartialAddSelEntryRequestSize,
+ OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiClearSel (
+ IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest,
+ OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelTime (
+ OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiSetSelTime (
+ IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSdrRepositoryInfo (
+ OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSdr (
+ IN IPMI_GET_SDR_REQUEST *GetSdrRequest,
+ OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse,
+ IN OUT UINT32 *GetSdrResponseSize
+ );
+
+#endif
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiPlatformHookLib.h b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiPlatformHookLib.h
new file mode 100644
index 0000000000..8359e3f38b
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiPlatformHookLib.h
@@ -0,0 +1,23 @@
+/** @file
+ This library abstract the platform specific hook for IPMI.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _IPMI_PLATFORM_UPDATE_LIB_H_
+#define _IPMI_PLATFORM_UPDATE_LIB_H_
+
+#include <Uefi.h>
+#include <IndustryStandard/Acpi.h>
+#include <Protocol/Smbios.h>
+
+EFI_STATUS
+EFIAPI
+PlatformIpmiIoRangeSet(
+ UINT16 IpmiIoBase
+ );
+
+#endif
+
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
new file mode 100644
index 0000000000..b57db50610
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
@@ -0,0 +1,248 @@
+/** @file
+ IPMI Command - NetFnApp.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IpmiLib.h>
+
+#include <IndustryStandard/Ipmi.h>
+
+EFI_STATUS
+EFIAPI
+IpmiGetDeviceId (
+ OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*DeviceId);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_GET_DEVICE_ID,
+ NULL,
+ 0,
+ (VOID *)DeviceId,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelfTestResult (
+ OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*SelfTestResult);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_GET_SELFTEST_RESULTS,
+ NULL,
+ 0,
+ (VOID *)SelfTestResult,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiResetWatchdogTimer (
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_RESET_WATCHDOG_TIMER,
+ NULL,
+ 0,
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiSetWatchdogTimer (
+ IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_SET_WATCHDOG_TIMER,
+ (VOID *)SetWatchdogTimer,
+ sizeof(*SetWatchdogTimer),
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetWatchdogTimer (
+ OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetWatchdogTimer);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_GET_WATCHDOG_TIMER,
+ NULL,
+ 0,
+ (VOID *)GetWatchdogTimer,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiSetBmcGlobalEnables (
+ IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_SET_BMC_GLOBAL_ENABLES,
+ (VOID *)SetBmcGlobalEnables,
+ sizeof(*SetBmcGlobalEnables),
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetBmcGlobalEnables (
+ OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetBmcGlobalEnables);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_GET_BMC_GLOBAL_ENABLES,
+ NULL,
+ 0,
+ (VOID *)GetBmcGlobalEnables,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiClearMessageFlags (
+ IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_CLEAR_MESSAGE_FLAGS,
+ (VOID *)ClearMessageFlagsRequest,
+ sizeof(*ClearMessageFlagsRequest),
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetMessageFlags (
+ OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetMessageFlagsResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_GET_MESSAGE_FLAGS,
+ NULL,
+ 0,
+ (VOID *)GetMessageFlagsResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetMessage (
+ OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse,
+ IN OUT UINT32 *GetMessageResponseSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_GET_MESSAGE,
+ NULL,
+ 0,
+ (VOID *)GetMessageResponse,
+ GetMessageResponseSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiSendMessage (
+ IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest,
+ IN UINT32 SendMessageRequestSize,
+ OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse,
+ IN OUT UINT32 *SendMessageResponseSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_SEND_MESSAGE,
+ (VOID *)SendMessageRequest,
+ SendMessageRequestSize,
+ (VOID *)SendMessageResponse,
+ SendMessageResponseSize
+ );
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
new file mode 100644
index 0000000000..1b86aa888e
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
@@ -0,0 +1,101 @@
+/** @file
+ IPMI Command - NetFnChassis.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IpmiLib.h>
+
+#include <IndustryStandard/Ipmi.h>
+
+
+EFI_STATUS
+EFIAPI
+IpmiGetChassisCapabilities (
+ OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetChassisCapabilitiesResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_CHASSIS,
+ IPMI_CHASSIS_GET_CAPABILITIES,
+ NULL,
+ 0,
+ (VOID *)GetChassisCapabilitiesResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetChassisStatus (
+ OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetChassisStatusResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_CHASSIS,
+ IPMI_CHASSIS_GET_STATUS,
+ NULL,
+ 0,
+ (VOID *)GetChassisStatusResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiChassisControl (
+ IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_CHASSIS,
+ IPMI_CHASSIS_CONTROL,
+ (VOID *)ChassisControlRequest,
+ sizeof(*ChassisControlRequest),
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiSetPowerRestorePolicy (
+ IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest,
+ OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*ChassisControlResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_CHASSIS,
+ IPMI_CHASSIS_SET_POWER_RESTORE_POLICY,
+ (VOID *)ChassisControlRequest,
+ sizeof(*ChassisControlRequest),
+ (VOID *)ChassisControlResponse,
+ &DataSize
+ );
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c
new file mode 100644
index 0000000000..8e892c5f84
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c
@@ -0,0 +1,275 @@
+/** @file
+ IPMI Command - NetFnStorage.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IpmiLib.h>
+
+#include <IndustryStandard/Ipmi.h>
+
+
+EFI_STATUS
+EFIAPI
+IpmiGetFruInventoryAreaInfo (
+ IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoRequest,
+ OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetFruInventoryAreaInfoResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_GET_FRU_INVENTORY_AREAINFO,
+ (VOID *)GetFruInventoryAreaInfoRequest,
+ sizeof(*GetFruInventoryAreaInfoRequest),
+ (VOID *)GetFruInventoryAreaInfoResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiReadFruData (
+ IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest,
+ OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse,
+ IN OUT UINT32 *ReadFruDataResponseSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_READ_FRU_DATA,
+ (VOID *)ReadFruDataRequest,
+ sizeof(*ReadFruDataRequest),
+ (VOID *)ReadFruDataResponse,
+ ReadFruDataResponseSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiWriteFruData (
+ IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest,
+ IN UINT32 WriteFruDataRequestSize,
+ OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*WriteFruDataResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_WRITE_FRU_DATA,
+ (VOID *)WriteFruDataRequest,
+ WriteFruDataRequestSize,
+ (VOID *)WriteFruDataResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelInfo (
+ OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetSelInfoResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_GET_SEL_INFO,
+ NULL,
+ 0,
+ (VOID *)GetSelInfoResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelEntry (
+ IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest,
+ OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse,
+ IN OUT UINT32 *GetSelEntryResponseSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_GET_SEL_ENTRY,
+ (VOID *)GetSelEntryRequest,
+ sizeof(*GetSelEntryRequest),
+ (VOID *)GetSelEntryResponse,
+ GetSelEntryResponseSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiAddSelEntry (
+ IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest,
+ OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*AddSelEntryResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_ADD_SEL_ENTRY,
+ (VOID *)AddSelEntryRequest,
+ sizeof(*AddSelEntryRequest),
+ (VOID *)AddSelEntryResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiPartialAddSelEntry (
+ IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest,
+ IN UINT32 PartialAddSelEntryRequestSize,
+ OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*PartialAddSelEntryResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_PARTIAL_ADD_SEL_ENTRY,
+ (VOID *)PartialAddSelEntryRequest,
+ PartialAddSelEntryRequestSize,
+ (VOID *)PartialAddSelEntryResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiClearSel (
+ IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest,
+ OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*ClearSelResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_CLEAR_SEL,
+ (VOID *)ClearSelRequest,
+ sizeof(*ClearSelRequest),
+ (VOID *)ClearSelResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelTime (
+ OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetSelTimeResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_GET_SEL_TIME,
+ NULL,
+ 0,
+ (VOID *)GetSelTimeResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiSetSelTime (
+ IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_SET_SEL_TIME,
+ (VOID *)SetSelTimeRequest,
+ sizeof(*SetSelTimeRequest),
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSdrRepositoryInfo (
+ OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetSdrRepositoryInfoResp);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_GET_SDR_REPOSITORY_INFO,
+ NULL,
+ 0,
+ (VOID *)GetSdrRepositoryInfoResp,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSdr (
+ IN IPMI_GET_SDR_REQUEST *GetSdrRequest,
+ OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse,
+ IN OUT UINT32 *GetSdrResponseSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_GET_SDR,
+ (VOID *)GetSdrRequest,
+ sizeof(*GetSdrRequest),
+ (VOID *)GetSdrResponse,
+ GetSdrResponseSize
+ );
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c
new file mode 100644
index 0000000000..3b9b17b909
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c
@@ -0,0 +1,81 @@
+/** @file
+ IPMI Command - NetFnTransport.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IpmiLib.h>
+
+#include <IndustryStandard/Ipmi.h>
+
+
+EFI_STATUS
+EFIAPI
+IpmiSolActivating (
+ IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_TRANSPORT,
+ IPMI_TRANSPORT_SOL_ACTIVATING,
+ (VOID *)SolActivatingRequest,
+ sizeof(*SolActivatingRequest),
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiSetSolConfigurationParameters (
+ IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationParametersRequest,
+ IN UINT32 SetConfigurationParametersRequestSize,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_TRANSPORT,
+ IPMI_TRANSPORT_SET_SOL_CONFIG_PARAM,
+ (VOID *)SetConfigurationParametersRequest,
+ SetConfigurationParametersRequestSize,
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSolConfigurationParameters (
+ IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationParametersRequest,
+ OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationParametersResponse,
+ IN OUT UINT32 *GetConfigurationParametersResponseSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_TRANSPORT,
+ IPMI_TRANSPORT_GET_SOL_CONFIG_PARAM,
+ (VOID *)GetConfigurationParametersRequest,
+ sizeof(*GetConfigurationParametersRequest),
+ (VOID *)GetConfigurationParametersResponse,
+ GetConfigurationParametersResponseSize
+ );
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c
new file mode 100644
index 0000000000..bdc8d23827
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c
@@ -0,0 +1,36 @@
+/** @file
+ IPMI platform hook library.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/IpmiPlatformHookLib.h>
+
+//
+// Prototype definitions for IPMI Platform Update Library
+//
+EFI_STATUS
+EFIAPI
+PlatformIpmiIoRangeSet(
+ UINT16 IpmiIoBase
+ )
+/*++
+
+ Routine Description:
+
+ This function sets IPMI Io range
+
+ Arguments:
+
+ IpmiIoBase
+
+ Returns:
+
+ Status
+
+--*/
+{
+ return EFI_SUCCESS;
+}
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 18/49] Features/Intel/IpmiFeaturePkg: Add modules
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (16 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 17/49] Features/Intel/IpmiFeaturePkg: Add libraries Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 19/49] AdvancedFeaturePkg: Remove the SMBIOS feature Kubacki, Michael A
` (29 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
This change adds the modules for the IPMI feature to
IpmiFeaturePkg.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec | 8 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc | 78 +++++-
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc | 2 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf | 8 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf | 3 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf | 47 ++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf | 33 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf | 37 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf | 37 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf | 35 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf | 34 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf | 32 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf | 33 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf | 37 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.c | 257 ++++++++++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.c | 236 ++++++++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.c | 236 ++++++++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.c | 84 +++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.c | 67 +++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.c | 150 ++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.c | 96 ++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.c | 112 +++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.c | 164 +++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/BmcSsdt.asl | 28 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/IpmiOprRegions.asi | 58 +++++
25 files changed, 1909 insertions(+), 3 deletions(-)
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
index 4c43fc5f49..1426496d28 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
@@ -36,3 +36,11 @@
[PcdsFeatureFlag]
gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable|FALSE|BOOLEAN|0xA0000001
+
+[PcdsFixedAtBuild]
+ gIpmiFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels|3|UINT8|0xF0000001
+
+[PcdsDynamic, PcdsDynamicEx]
+ gIpmiFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag|TRUE|BOOLEAN|0xD0000001
+ gIpmiFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue|360|UINT16|0xD0000002
+ gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress|0xCA2|UINT16|0xD0000003
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
index c6a385108b..a82f18a68c 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
@@ -18,6 +18,12 @@
#
################################################################################
[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
################################################################################
#
@@ -32,6 +38,36 @@
BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
+
+ #####################################
+ # IPMI Feature Package
+ #####################################
+ IpmiCommandLib|OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLib.inf
+
+[LibraryClasses.common.PEI_CORE,LibraryClasses.common.PEIM]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+ PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
+ PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+ PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
+
+[LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.UEFI_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
################################################################################
#
@@ -47,17 +83,50 @@
# generated for it, but the binary will not be put into any firmware volume.
#
################################################################################
-[Components]
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # IPMI Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
+
+ # Add components here that should be included in the package build.
+ OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf
+ OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
#####################################
# IPMI Feature Package
#####################################
# Add library instances here that are not included in package components and should be tested
# in the package build.
- OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLib.inf
+
OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
# Add components here that should be included in the package build.
+ OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf
+ OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf
+ OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf
+ OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf
+ OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf
+ OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf
###################################################################################################
#
@@ -67,6 +136,9 @@
# applied for any modules or only those modules with the specific
# module style (EDK or EDKII) specified in [Components] section.
#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
###################################################################################################
[BuildOptions]
- *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
index 623a52650f..6a3eed0882 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
@@ -22,6 +22,8 @@
SUPPORTED_ARCHITECTURES = IA32|X64
BUILD_TARGETS = DEBUG|RELEASE|NOOPT
SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
#
# This package always builds the feature.
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf
index c3847c54c7..b5b37ddd9f 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf
@@ -6,3 +6,11 @@
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
+
+ INF OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf
+ INF OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf
+ INF OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf
+ INF OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf
+ INF OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf
+ INF OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf
+ INF OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf
index 0c82d7eb02..4aa2d8e9da 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf
@@ -6,3 +6,6 @@
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
+
+INF OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf
+INF OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf
new file mode 100644
index 0000000000..a84813f55c
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf
@@ -0,0 +1,47 @@
+### @file
+# Component description file for BMC ACPI.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = BmcAcpi
+ FILE_GUID = F59DAA23-D5D5-4d16-91FC-D03ABDC12FFE
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = BmcAcpiEntryPoint
+
+[Sources]
+ BmcAcpi.c
+ BmcSsdt/BmcSsdt.asl
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ BaseMemoryLib
+ DebugLib
+ UefiLib
+
+[Protocols]
+ gEfiFirmwareVolume2ProtocolGuid
+ gEfiAcpiTableProtocolGuid
+
+[Pcd]
+ gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId
+
+[Depex]
+ gEfiAcpiTableProtocolGuid
+
+[BuildOptions]
+ *_*_*_ASL_FLAGS = -oi
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf
new file mode 100644
index 0000000000..665b3d9bda
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf
@@ -0,0 +1,33 @@
+### @file
+# Component description file for BMC ELOG.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = BmcElog
+ FILE_GUID = 8A17F6CA-BF1A-45C4-FFFF-FFFF0C829DDD
+ MODULE_TYPE = DXE_DRIVER
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializeBmcElogLayer
+
+[Sources]
+ BmcElog.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ DebugLib
+ UefiBootServicesTableLib
+ IpmiCommandLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf
new file mode 100644
index 0000000000..85836cd8ee
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf
@@ -0,0 +1,37 @@
+### @file
+# Component description file for IPMI FRB.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = FrbDxe
+ FILE_GUID = F6C7812D-81BF-4e6d-A87D-E75AF17BD511
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = FrbDxeEntryPoint
+
+[Sources]
+ FrbDxe.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ MemoryAllocationLib
+ UefiLib
+ DebugLib
+ BaseMemoryLib
+ IpmiCommandLib
+ PcdLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf
new file mode 100644
index 0000000000..7ad00ae574
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf
@@ -0,0 +1,37 @@
+### @file
+# Component description file for IPMI FRB PEIM.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = FrbPei
+ FILE_GUID = 7F9F9788-9F1F-4725-895C-3932F1A04DE8
+ MODULE_TYPE = PEIM
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializeFrbPei
+
+[Sources]
+ FrbPei.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ PeimEntryPoint
+ DebugLib
+ BaseMemoryLib
+ PcdLib
+ IpmiCommandLib
+
+[Pcd]
+ gIpmiFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag
+ gIpmiFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf
new file mode 100644
index 0000000000..0778b221c1
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf
@@ -0,0 +1,35 @@
+### @file
+# Component description file for IPMI FRU.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = IpmiFru
+ FILE_GUID = 3F1D6464-2B4C-4640-BAC4-3DD905D26CDA
+ MODULE_TYPE = DXE_DRIVER
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializeFru
+
+[Sources]
+ IpmiFru.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ UefiLib
+ DebugLib
+ UefiBootServicesTableLib
+ BaseMemoryLib
+ IpmiCommandLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf
new file mode 100644
index 0000000000..68ff70cd43
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf
@@ -0,0 +1,34 @@
+### @file
+# Component description file for IPMI initialization.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = DxeIpmiInit
+ FILE_GUID = 07A01ACF-46D5-48de-A63D-74FA92AA8450
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = IpmiInterfaceInit
+
+[Sources]
+ DxeIpmiInit.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ DebugLib
+ UefiDriverEntryPoint
+ IpmiCommandLib
+ TimerLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf
new file mode 100644
index 0000000000..825451ede1
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf
@@ -0,0 +1,32 @@
+### @file
+# Component description file for IPMI initialization in PEI.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = PeiIpmiInit
+ FILE_GUID = D8F57F4E-D67D-4f2c-8351-C7092986542F
+ MODULE_TYPE = PEIM
+ VERSION_STRING = 1.0
+ ENTRY_POINT = PeimIpmiInterfaceInit
+
+[Sources]
+ PeiIpmiInit.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ PeimEntryPoint
+ DebugLib
+ IpmiCommandLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf
new file mode 100644
index 0000000000..7e7d2826cb
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf
@@ -0,0 +1,33 @@
+### @file
+# Component description file for IPMI OS watch dog timer driver.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = OsWdt
+ FILE_GUID = BE9B694A-B5D9-48e0-A527-6E1A49EB7028
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = DriverInit
+
+[Sources]
+ OsWdt.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ DebugLib
+ UefiBootServicesTableLib
+ BaseMemoryLib
+ IpmiCommandLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf
new file mode 100644
index 0000000000..826144e537
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf
@@ -0,0 +1,37 @@
+### @file
+# Component description file for IPMI Serial Over LAN (SOL) driver.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = SolStatus
+ FILE_GUID = F9887B5E-2D46-4213-8794-14F1FD39F6B8
+ MODULE_TYPE = DXE_DRIVER
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ VERSION_STRING = 1.0
+ ENTRY_POINT = SolStatusEntryPoint
+
+[Sources]
+ SolStatus.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[Pcd]
+ gIpmiFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ DebugLib
+ UefiBootServicesTableLib
+ IpmiCommandLib
+ PcdLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.c
new file mode 100644
index 0000000000..990b4b9e83
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.c
@@ -0,0 +1,257 @@
+/** @file
+ BMC ACPI.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+//
+// Statements that include other header files
+//
+#include <PiDxe.h>
+
+#include <IndustryStandard/Acpi.h>
+#include <Protocol/AcpiSystemDescriptionTable.h>
+#include <Protocol/FirmwareVolume2.h>
+#include <Protocol/AcpiTable.h>
+
+#include <Library/BaseLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiLib.h>
+
+#ifndef EFI_ACPI_CREATOR_ID
+#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('M', 'S', 'F', 'T')
+#endif
+#ifndef EFI_ACPI_CREATOR_REVISION
+#define EFI_ACPI_CREATOR_REVISION 0x0100000D
+#endif
+
+/**
+
+ Locate the first instance of a protocol. If the protocol requested is an
+ FV protocol, then it will return the first FV that contains the ACPI table
+ storage file.
+
+ @param Protocol - The protocol to find.
+ Instance - Return pointer to the first instance of the protocol.
+ Type - The type of protocol to locate.
+
+ @retval EFI_SUCCESS - The function completed successfully.
+ @retval EFI_NOT_FOUND - The protocol could not be located.
+ @retval EFI_OUT_OF_RESOURCES - There are not enough resources to find the protocol.
+
+**/
+EFI_STATUS
+LocateSupportProtocol (
+ IN EFI_GUID *Protocol,
+ OUT VOID **Instance,
+ IN UINT32 Type
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ EFI_FV_FILETYPE FileType;
+ UINT32 FvStatus = 0;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINTN Size;
+ UINTN Index;
+
+ Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NumberOfHandles, &HandleBuffer);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ //
+ // Looking for FV with ACPI storage file
+ //
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+ Status = gBS->HandleProtocol (HandleBuffer[Index], Protocol, Instance);
+ ASSERT (!EFI_ERROR (Status));
+
+ if (!Type) {
+ //
+ // Not looking for the FV protocol, so find the first instance of the
+ // protocol. There should not be any errors because our handle buffer
+ // should always contain at least one or LocateHandleBuffer would have
+ // returned not found.
+ //
+ break;
+ }
+ //
+ // See if it has the ACPI storage file
+ //
+ Status = ((EFI_FIRMWARE_VOLUME2_PROTOCOL *) (*Instance))->ReadFile (
+ *Instance,
+ &gEfiCallerIdGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ //
+ // If we found it, then we are done
+ //
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+ }
+
+ gBS->FreePool (HandleBuffer);
+ return Status;
+}
+
+
+EFI_STATUS
+UpdateDeviceSsdtTable (
+ IN OUT EFI_ACPI_COMMON_HEADER *Table
+ )
+{
+ EFI_ACPI_DESCRIPTION_HEADER *TableHeader = NULL;
+ UINT64 TempOemTableId;
+ UINT8 *DataPtr;
+ EFI_ACPI_IO_PORT_DESCRIPTOR *IoRsc;
+
+ TableHeader = (EFI_ACPI_DESCRIPTION_HEADER *)Table;
+
+ //
+ // Update the OEMID and OEM Table ID.
+ //
+ CopyMem (&TableHeader->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof(TableHeader->OemId));
+ TempOemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
+ CopyMem (&TableHeader->OemTableId, &TempOemTableId, sizeof(UINT64));
+ TableHeader->CreatorId = EFI_ACPI_CREATOR_ID;
+ TableHeader->CreatorRevision = EFI_ACPI_CREATOR_REVISION;
+
+ //
+ // Update IO(Decode16, 0xCA2, 0xCA2, 0, 2)
+ //
+ DEBUG ((DEBUG_INFO, "UpdateDeviceSsdtTable - IPMI\n"));
+ for (DataPtr = (UINT8 *)(Table + 1);
+ DataPtr < (UINT8 *) ((UINT8 *) Table + Table->Length - 4);
+ DataPtr++) {
+ if (CompareMem(DataPtr, "_CRS", 4) == 0) {
+ DataPtr += 4; // Skip _CRS
+ ASSERT (*DataPtr == AML_BUFFER_OP);
+ DataPtr ++; // Skip AML_BUFFER_OP
+ ASSERT ((*DataPtr & (BIT7|BIT6)) == 0);
+ DataPtr ++; // Skip PkgLength - 0xD
+ ASSERT ((*DataPtr) == AML_BYTE_PREFIX);
+ DataPtr ++; // Skip BufferSize OpCode
+ DataPtr ++; // Skip BufferSize - 0xA
+ IoRsc = (VOID *)DataPtr;
+ ASSERT (IoRsc->Header.Bits.Type == ACPI_SMALL_ITEM_FLAG);
+ ASSERT (IoRsc->Header.Bits.Name == ACPI_SMALL_IO_PORT_DESCRIPTOR_NAME);
+ ASSERT (IoRsc->Header.Bits.Length == sizeof(EFI_ACPI_IO_PORT_DESCRIPTOR) - sizeof(ACPI_SMALL_RESOURCE_HEADER));
+ DEBUG ((DEBUG_INFO, "IPMI IO Base in ASL update - 0x%04x <= 0x%04x\n", IoRsc->BaseAddressMin, PcdGet16(PcdIpmiIoBaseAddress)));
+ IoRsc->BaseAddressMin = PcdGet16(PcdIpmiIoBaseAddress);
+ IoRsc->BaseAddressMax = PcdGet16(PcdIpmiIoBaseAddress);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+
+ Entry point for Acpi platform driver.
+
+ @param ImageHandle - A handle for the image that is initializing this driver.
+ @param SystemTable - A pointer to the EFI system table.
+
+ @retval EFI_SUCCESS - Driver initialized successfully.
+ @retval EFI_LOAD_ERROR - Failed to Initialize or has been loaded.
+ @retval EFI_OUT_OF_RESOURCES - Could not allocate needed resources.
+
+**/
+EFI_STATUS
+EFIAPI
+BmcAcpiEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_STATUS AcpiStatus;
+
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol;
+ INTN Instance = 0;
+ EFI_ACPI_COMMON_HEADER *CurrentTable = NULL;
+ UINTN TableHandle = 0;
+ UINT32 FvStatus;
+ UINT32 Size;
+
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ UINTN TableSize;
+
+
+ //
+ // Find the AcpiTable protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+
+ //
+ // Locate the firmware volume protocol
+ //
+ Status = LocateSupportProtocol (&gEfiFirmwareVolume2ProtocolGuid, (VOID **) &FwVol, 1);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = EFI_SUCCESS;
+ Instance = 0;
+
+ //
+ // Read tables from the storage file.
+ //
+ while (!EFI_ERROR (Status)) {
+ CurrentTable = NULL;
+
+ Status = FwVol->ReadSection (
+ FwVol,
+ &gEfiCallerIdGuid,
+ EFI_SECTION_RAW,
+ Instance,
+ (VOID **) &CurrentTable,
+ (UINTN *) &Size,
+ &FvStatus
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Perform any table specific updates.
+ //
+ AcpiStatus = UpdateDeviceSsdtTable (CurrentTable);
+ if (!EFI_ERROR (AcpiStatus)) {
+
+ TableHandle = 0;
+ TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
+ ASSERT (Size >= TableSize);
+
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ CurrentTable,
+ TableSize,
+ &TableHandle
+ );
+
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ //
+ // Increment the instance
+ //
+ Instance++;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.c
new file mode 100644
index 0000000000..a6d075b19c
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.c
@@ -0,0 +1,236 @@
+/** @file
+ BMC Event Log functions.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/IpmiCommandLib.h>
+
+EFI_STATUS
+EFIAPI
+CheckIfSelIsFull (
+ VOID
+ );
+
+/*++
+
+ Routine Description:
+ This function verifies the BMC SEL is full and When it is reports the error to the Error Manager.
+
+ Arguments:
+ None
+
+ Returns:
+ EFI_SUCCESS
+ EFI_DEVICE_ERROR
+
+--*/
+EFI_STATUS
+WaitTillErased (
+ UINT8 *ResvId
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+ BmcElogPrivateData - Bmc event log instance
+ ResvId - Reserved ID
+
+Returns:
+
+ EFI_SUCCESS
+ EFI_NO_RESPONSE
+
+--*/
+{
+ INTN Counter;
+ IPMI_CLEAR_SEL_REQUEST ClearSel;
+ IPMI_CLEAR_SEL_RESPONSE ClearSelResponse;
+
+ Counter = 0x200;
+ ZeroMem (&ClearSelResponse, sizeof(ClearSelResponse));
+
+ while (TRUE) {
+ ZeroMem (&ClearSel, sizeof(ClearSel));
+ ClearSel.Reserve[0] = ResvId[0];
+ ClearSel.Reserve[1] = ResvId[1];
+ ClearSel.AscC = 0x43;
+ ClearSel.AscL = 0x4C;
+ ClearSel.AscR = 0x52;
+ ClearSel.Erase = 0x00;
+
+ IpmiClearSel (
+ &ClearSel,
+ &ClearSelResponse
+ );
+
+ if ((ClearSelResponse.ErasureProgress & 0xf) == 1) {
+ return EFI_SUCCESS;
+ }
+ //
+ // If there is not a response from the BMC controller we need to return and not hang.
+ //
+ --Counter;
+ if (Counter == 0x0) {
+ return EFI_NO_RESPONSE;
+ }
+ }
+}
+
+EFI_STATUS
+EfiActivateBmcElog (
+ IN BOOLEAN *EnableElog,
+ OUT BOOLEAN *ElogStatus
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+ This - Protocol pointer
+ DataType - indicate event log type
+ EnableElog - Enable/Disable event log
+ ElogStatus - return log status
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ EFI_STATUS Status;
+ UINT8 ElogStat;
+ IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST SetBmcGlobalEnables;
+ IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE GetBmcGlobalEnables;
+ UINT8 CompletionCode;
+
+ Status = EFI_SUCCESS;
+ ElogStat = 0;
+
+ Status = IpmiGetBmcGlobalEnables (&GetBmcGlobalEnables);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ if (EnableElog == NULL) {
+ *ElogStatus = GetBmcGlobalEnables.GetEnables.Bits.SystemEventLogging;
+ } else {
+ if (Status == EFI_SUCCESS) {
+ if (*EnableElog) {
+ ElogStat = 1;
+ }
+
+ CopyMem (&SetBmcGlobalEnables, (UINT8 *)&GetBmcGlobalEnables + 1, sizeof(UINT8));
+ SetBmcGlobalEnables.SetEnables.Bits.SystemEventLogging = ElogStat;
+
+ Status = IpmiSetBmcGlobalEnables (&SetBmcGlobalEnables, &CompletionCode);
+ }
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+SetElogRedirInstall (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+ None
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+{
+ BOOLEAN EnableElog;
+ BOOLEAN ElogStatus;
+
+ //
+ // Activate the Event Log (This should depend upon Setup).
+ //
+ EfiActivateBmcElog (&EnableElog, &ElogStatus);
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+InitializeBmcElogLayer (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+ ImageHandle - ImageHandle of the loaded driver
+ SystemTable - Pointer to the System Table
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ SetElogRedirInstall ();
+
+ CheckIfSelIsFull ();
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+CheckIfSelIsFull (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ This function verifies the BMC SEL is full and When it is reports the error to the Error Manager.
+
+ Arguments:
+ None
+
+ Returns:
+ EFI_SUCCESS
+ EFI_DEVICE_ERROR
+
+--*/
+{
+ EFI_STATUS Status;
+ UINT8 SelIsFull;
+ IPMI_GET_SEL_INFO_RESPONSE SelInfo;
+
+ Status = IpmiGetSelInfo (&SelInfo);
+ if (EFI_ERROR (Status)) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ //
+ // Check the Bit7 of the OperationByte if SEL is OverFlow.
+ //
+ SelIsFull = (SelInfo.OperationSupport & 0x80);
+ DEBUG ((DEBUG_INFO, "SelIsFull - 0x%x\n", SelIsFull));
+
+ return EFI_SUCCESS;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.c
new file mode 100644
index 0000000000..6454fa5f9b
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.c
@@ -0,0 +1,236 @@
+/** @file
+ IPMI FRB Driver.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiDxe.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PcdLib.h>
+#include <Library/IpmiCommandLib.h>
+#include <IndustryStandard/Ipmi.h>
+
+EFI_STATUS
+EfiDisableFrb (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ This routine disables the specified FRB timer.
+
+ Arguments:
+ This - This pointer
+ FrbType - Type of FRB timer to get data on
+
+ Returns:
+ EFI_SUCCESS - FRB timer was disabled
+ EFI_ABORTED - Timer was already stopped
+ EFI_UNSUPPORTED - This type of FRB timer is not supported.
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer;
+ UINT8 CompletionCode;
+ IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
+
+ Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Check if timer is still running, if not abort disable routine.
+ //
+ if (GetWatchdogTimer.TimerUse.Bits.TimerRunning == 0) {
+ return EFI_ABORTED;
+ }
+
+ ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer));
+ //
+ // Just flip the Timer Use bit. This should release the timer.
+ //
+ SetWatchdogTimer.TimerUse.Bits.TimerRunning = 0;
+ SetWatchdogTimer.TimerUse.Bits.TimerUse = IPMI_WATCHDOG_TIMER_BIOS_FRB2;
+ SetWatchdogTimer.TimerUseExpirationFlagsClear &= ~BIT2;
+ SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT4;
+
+ Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
+ return Status;
+}
+
+VOID
+EFIAPI
+DisableFRB2Handler (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/*++
+
+ Routine Description:
+ Disables FRB2. This function gets called each time the
+ EFI_EVENT_SIGNAL_READY_TO_BOOT gets signaled
+
+ Arguments:
+ Standard event notification function arguments:
+ Event - the event that is signaled.
+ Context - not used here.
+
+ Returns:
+
+--*/
+{
+ DEBUG((DEBUG_ERROR, "!!! enter DisableFRB2Handler()!!!\n"));
+
+ EfiDisableFrb ();
+}
+
+EFI_STATUS
+CheckForAndReportErrors(
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Check the Watchdog timer expiration flags and report the kind of watchdog
+ timeout occurred to the Error Manager.
+
+ Arguments:
+
+ Returns:
+ EFI_SUCCESS - Errors retrieved and reported
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
+ IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer;
+ UINT8 CompletionCode;
+
+ //
+ // Get the Watchdog timer info to find out what kind of timer expiration occurred.
+ //
+ Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ //
+ // If FRB2 Failure occurred, report it to the error manager and log a SEL.
+ //
+ if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT1) != 0) {
+ //
+ // Report the FRB2 time-out error
+ //
+ } else if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT3) != 0) {
+ //
+ // Report the OS Watchdog timer failure
+ //
+ }
+
+ //
+ // Need to clear Timer expiration flags after checking.
+ //
+ ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer));
+ SetWatchdogTimer.TimerUse = GetWatchdogTimer.TimerUse;
+ SetWatchdogTimer.TimerActions = GetWatchdogTimer.TimerActions;
+ SetWatchdogTimer.PretimeoutInterval = GetWatchdogTimer.PretimeoutInterval;
+ SetWatchdogTimer.TimerUseExpirationFlagsClear = GetWatchdogTimer.TimerUseExpirationFlagsClear;
+ SetWatchdogTimer.InitialCountdownValue = GetWatchdogTimer.InitialCountdownValue;
+ SetWatchdogTimer.TimerUse.Bits.TimerRunning = 1;
+ SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT2 | BIT3;
+
+ Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
+
+ return Status;
+}
+
+EFI_STATUS
+ReportFrb2Status (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ This routine is built only when DEBUG_MODE is enabled. It is used
+ to report the status of FRB2 when the FRB2 driver is installed.
+
+ Arguments:
+ none
+
+ Returns:
+ EFI_SUCCESS: All info was retrieved and reported
+ EFI_ERROR: There was an error during info retrieval
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
+
+ //
+ // Get the Watchdog timer info to find out what kind of timer expiration occurred.
+ //
+ Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_INFO, "Failed to get Watchdog Timer info from BMC.\n"));
+ return Status;
+ }
+
+ //
+ // Check if timer is running, report status to DEBUG_MODE output.
+ //
+ if (GetWatchdogTimer.TimerUse.Bits.TimerRunning == 1) {
+ DEBUG ((DEBUG_INFO, "FRB2 Timer is running.\n"));
+ } else {
+ DEBUG ((DEBUG_INFO, "FRB2 Timer is not running.\n"));
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+FrbDxeEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+ Routine Description:
+ This is the standard EFI driver point. This function intitializes
+ the private data required for creating FRB Driver.
+
+ Arguments:
+ ImageHandle - Handle for the image of this driver
+ SystemTable - Pointer to the EFI System Table
+
+ Returns:
+ EFI_SUCCESS - Protocol successfully started and installed
+ EFI_UNSUPPORTED - Protocol can't be started
+
+--*/
+{
+ EFI_EVENT ReadyToBootEvent;
+ EFI_STATUS Status;
+
+ CheckForAndReportErrors();
+ ReportFrb2Status ();
+
+ //
+ // Register the event to Disable FRB2 before Boot.
+ //
+ Status = EfiCreateEventReadyToBootEx (
+ TPL_NOTIFY,
+ DisableFRB2Handler,
+ NULL,
+ &ReadyToBootEvent
+ );
+
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.c
new file mode 100644
index 0000000000..3e65eb9dad
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.c
@@ -0,0 +1,84 @@
+/** @file
+ IPMI FRB PEIM.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/IoLib.h>
+#include <Library/PcdLib.h>
+#include <Library/IpmiCommandLib.h>
+
+#include <IndustryStandard/Ipmi.h>
+
+VOID
+SetWatchDogTimer (
+ IN BOOLEAN Frb2Enabled
+ )
+{
+ EFI_STATUS Status;
+ IPMI_SET_WATCHDOG_TIMER_REQUEST FrbTimer;
+ IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
+ UINT8 CompletionCode;
+
+ Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
+ if (EFI_ERROR(Status)) {
+ return ;
+ }
+
+ if (Frb2Enabled) {
+ ZeroMem (&FrbTimer, sizeof(FrbTimer));
+ //Byte 1
+ FrbTimer.TimerUse.Bits.TimerUse = IPMI_WATCHDOG_TIMER_BIOS_FRB2;
+ //Byte 2
+ FrbTimer.TimerActions.Uint8 = 0; //NormalBoot, NoTimeOutInterrupt. i.e no action when BMC watchdog timeout
+ //Byte 3
+ FrbTimer.PretimeoutInterval = 0;
+ //Byte 4
+ FrbTimer.TimerUseExpirationFlagsClear |= BIT1; //set Frb2ExpirationFlag
+
+ //Data Byte 5/6
+ FrbTimer.InitialCountdownValue = PcdGet16(PcdFRBTimeoutValue) * 10;
+
+ //Set BMC watchdog timer
+ Status = IpmiSetWatchdogTimer (&FrbTimer, &CompletionCode);
+ Status = IpmiResetWatchdogTimer (&CompletionCode);
+ }
+}
+
+EFI_STATUS
+EFIAPI
+InitializeFrbPei (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+ FfsHeader
+ PeiServices
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+{
+ BOOLEAN Frb2Enabled;
+
+ //
+ // If we are booting with defaults, then make sure FRB2 is enabled.
+ //
+ Frb2Enabled = PcdGetBool (PcdFRB2EnabledFlag);
+
+ SetWatchDogTimer (Frb2Enabled);
+
+ return EFI_SUCCESS;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.c
new file mode 100644
index 0000000000..58e1fb4d7e
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.c
@@ -0,0 +1,67 @@
+/** @file
+ IPMI FRU Driver.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/BaseLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/IpmiCommandLib.h>
+#include <IndustryStandard/Ipmi.h>
+
+EFI_STATUS
+EFIAPI
+InitializeFru (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+ Initialize SM Redirection Fru Layer
+
+Arguments:
+
+ ImageHandle - ImageHandle of the loaded driver
+ SystemTable - Pointer to the System Table
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_GET_DEVICE_ID_RESPONSE ControllerInfo;
+ IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST GetFruInventoryAreaInfoRequest;
+ IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE GetFruInventoryAreaInfoResponse;
+
+ //
+ // Get all the SDR Records from BMC and retrieve the Record ID from the structure for future use.
+ //
+ Status = IpmiGetDeviceId (&ControllerInfo);
+ if (EFI_ERROR (Status)) {
+ DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetDeviceId Status=%x\n", Status));
+ return Status;
+ }
+
+ DEBUG((DEBUG_ERROR, "!!! IpmiFru FruInventorySupport %x\n", ControllerInfo.DeviceSupport.Bits.FruInventorySupport));
+
+ if (ControllerInfo.DeviceSupport.Bits.FruInventorySupport) {
+ GetFruInventoryAreaInfoRequest.DeviceId = 0;
+ Status = IpmiGetFruInventoryAreaInfo (&GetFruInventoryAreaInfoRequest, &GetFruInventoryAreaInfoResponse);
+ if (EFI_ERROR (Status)) {
+ DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetFruInventoryAreaInfo Status=%x\n", Status));
+ return Status;
+ }
+ DEBUG((DEBUG_ERROR, "!!! IpmiFru InventoryAreaSize=%x\n", GetFruInventoryAreaInfoResponse.InventoryAreaSize));
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.c
new file mode 100644
index 0000000000..77576fda47
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.c
@@ -0,0 +1,150 @@
+/** @file
+ IPMI stack initialization.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiDxe.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/TimerLib.h>
+#include <Library/IpmiCommandLib.h>
+
+#define BMC_TIMEOUT 30 // [s] How long shall BIOS wait for BMC
+#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout
+
+EFI_STATUS
+GetSelfTest (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Execute the Get Self Test results command to determine whether or not the BMC self tests
+ have passed
+
+Arguments:
+
+ mIpmiInstance - Data structure describing BMC variables and used for sending commands
+ StatusCodeValue - An array used to accumulate error codes for later reporting.
+ ErrorCount - Counter used to keep track of error codes in StatusCodeValue
+
+Returns:
+
+ EFI_SUCCESS - BMC Self test results are retrieved and saved into BmcStatus
+ EFI_DEVICE_ERROR - BMC failed to return self test results.
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_SELF_TEST_RESULT_RESPONSE TestResult;
+
+ //
+ // Get the SELF TEST Results.
+ //
+ Status = IpmiGetSelfTestResult (&TestResult);
+ if (EFI_ERROR(Status)) {
+ DEBUG((DEBUG_ERROR, "\n[IPMI] BMC does not respond (status: %r)!\n\n", Status));
+ return Status;
+ }
+
+ DEBUG((DEBUG_INFO, "[IPMI] BMC self-test result: %02X-%02X\n", TestResult.Result, TestResult.Param));
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GetDeviceId (
+ OUT BOOLEAN *UpdateMode
+ )
+/*++
+
+Routine Description:
+ Execute the Get Device ID command to determine whether or not the BMC is in Force Update
+ Mode. If it is, then report it to the error manager.
+
+Arguments:
+
+Returns:
+ Status
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_GET_DEVICE_ID_RESPONSE BmcInfo;
+ UINT32 Retries;
+
+ //
+ // Set up a loop to retry for up to 30 seconds. Calculate retries not timeout
+ // so that in case KCS is not enabled and EfiIpmiSendCommand() returns
+ // immediately we will not wait all the 30 seconds.
+ //
+ Retries = BMC_TIMEOUT / BMC_KCS_TIMEOUT + 1;
+ //
+ // Get the device ID information for the BMC.
+ //
+ do {
+ Status = IpmiGetDeviceId (&BmcInfo);
+ if (!EFI_ERROR(Status)) {
+ break;
+ }
+ DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d retries left\n", Status, Retries));
+ MicroSecondDelay(50 * 1000);
+ if (Retries-- == 0) {
+ return Status;
+ }
+ } while (TRUE);
+
+ DEBUG((
+ DEBUG_INFO,
+ "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n",
+ BmcInfo.DeviceId,
+ BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev,
+ BmcInfo.MinorFirmwareRev
+ ));
+ *UpdateMode = (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode;
+ return Status;
+}
+
+/**
+ The entry point of the Ipmi DXE.
+
+@param[in] ImageHandle - Handle of this driver image
+@param[in] SystemTable - Table containing standard EFI services
+
+@retval EFI_SUCCESS - Always success is returned even if KCS does not function
+
+ **/
+EFI_STATUS
+EFIAPI
+IpmiInterfaceInit (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ BOOLEAN UpdateMode;
+ EFI_STATUS Status;
+
+ DEBUG((DEBUG_ERROR,"IPMI Dxe:Get BMC Device Id\n"));
+
+ //
+ // Get the Device ID and check if the system is in Force Update mode.
+ //
+ Status = GetDeviceId (&UpdateMode);
+ //
+ // Do not continue initialization if the BMC is in Force Update Mode.
+ //
+ if (!EFI_ERROR(Status) && !UpdateMode) {
+ //
+ // Get the SELF TEST Results.
+ //
+ GetSelfTest ();
+ }
+
+ return EFI_SUCCESS;
+}
+
+
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.c
new file mode 100644
index 0000000000..062d20c44e
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.c
@@ -0,0 +1,96 @@
+/** @file
+ IPMI stack initialization in PEI.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/TimerLib.h>
+#include <Library/IpmiCommandLib.h>
+
+#define BMC_TIMEOUT_PEI 50 // [s] How long shall BIOS wait for BMC
+#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout
+
+EFI_STATUS
+GetDeviceId (
+ OUT BOOLEAN *UpdateMode
+ )
+/*++
+
+Routine Description:
+ Execute the Get Device ID command to determine whether or not the BMC is in Force Update
+ Mode. If it is, then report it to the error manager.
+
+Arguments:
+
+Returns:
+ Status
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_GET_DEVICE_ID_RESPONSE BmcInfo;
+ UINT32 Retries;
+
+ //
+ // Set up a loop to retry for up to 30 seconds. Calculate retries not timeout
+ // so that in case KCS is not enabled and EfiIpmiSendCommand() returns
+ // immediately we will not wait all the 30 seconds.
+ //
+ Retries = BMC_TIMEOUT_PEI/ BMC_KCS_TIMEOUT + 1;
+ //
+ // Get the device ID information for the BMC.
+ //
+ do {
+ Status = IpmiGetDeviceId (&BmcInfo);
+ if (!EFI_ERROR(Status)) {
+ break;
+ }
+ DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d retries left\n", Status, Retries));
+ if (Retries-- == 0) {
+ return Status;
+ }
+ } while (TRUE);
+
+ DEBUG((
+ DEBUG_INFO,
+ "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n",
+ BmcInfo.DeviceId,
+ BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev,
+ BmcInfo.MinorFirmwareRev
+ ));
+ *UpdateMode = (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode;
+ return Status;
+}
+
+/**
+ The entry point of the Ipmi PEIM.
+
+ @param FileHandle Handle of the file being invoked.
+ @param PeiServices Describes the list of possible PEI Services.
+
+ @retval EFI_SUCCESS Indicates that Ipmi initialization completed successfully.
+ @retval Others Indicates that Ipmi initialization could not complete successfully.
+**/
+EFI_STATUS
+EFIAPI
+PeimIpmiInterfaceInit (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+{
+ BOOLEAN UpdateMode;
+ EFI_STATUS Status;
+
+ DEBUG ((DEBUG_INFO, "IPMI Peim:Get BMC Device Id\n"));
+
+ //
+ // Get the Device ID and check if the system is in Force Update mode.
+ //
+ Status = GetDeviceId (&UpdateMode);
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.c
new file mode 100644
index 0000000000..6d6cb21d08
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.c
@@ -0,0 +1,112 @@
+/** @file
+ IPMI Os watchdog timer Driver.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/IpmiCommandLib.h>
+#include <IndustryStandard/Ipmi.h>
+
+BOOLEAN mOsWdtFlag = FALSE;
+
+EFI_EVENT mExitBootServicesEvent;
+
+VOID
+EFIAPI
+EnableEfiOsBootWdtHandler (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/*++
+
+Routine Description:
+ Enable the OS Boot Watchdog Timer.
+ Is called only on legacy or EFI OS boot.
+
+Arguments:
+ Event - Event type
+ *Context - Context for the event
+
+Returns:
+ None
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer;
+ UINT8 CompletionCode;
+ IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
+ static BOOLEAN OsWdtEventHandled = FALSE;
+
+ DEBUG((DEBUG_ERROR, "!!! EnableEfiOsBootWdtHandler()!!!\n"));
+
+ //
+ // Make sure it processes once only. And proceess it only if OsWdtFlag==TRUE;
+ //
+ if (OsWdtEventHandled || !mOsWdtFlag) {
+ return ;
+ }
+
+ OsWdtEventHandled = TRUE;
+
+ Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
+ if (EFI_ERROR (Status)) {
+ return ;
+ }
+
+ ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer));
+ //
+ // Just flip the Timer Use bit. This should release the timer.
+ //
+ SetWatchdogTimer.TimerUse.Bits.TimerRunning = 1;
+ SetWatchdogTimer.TimerUse.Bits.TimerUse = IPMI_WATCHDOG_TIMER_OS_LOADER;
+ SetWatchdogTimer.TimerActions.Uint8 = IPMI_WATCHDOG_TIMER_ACTION_HARD_RESET;
+ SetWatchdogTimer.TimerUseExpirationFlagsClear &= ~BIT4;
+ SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT2;
+ SetWatchdogTimer.InitialCountdownValue = 600; // 100ms / count
+
+ Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
+ return ;
+}
+
+EFI_STATUS
+EFIAPI
+DriverInit (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+ This is the standard EFI driver point. This function intitializes
+ the private data required for creating ASRR Driver.
+
+Arguments:
+ As required for DXE driver enrty routine.
+ ImageHandle - ImageHandle of the loaded driver
+ SystemTable - Pointer to the System Table
+
+Returns:
+ @retval EFI_SUCCESS Protocol successfully started and installed.
+ @retval EFI_OUT_OF_RESOURCES The event could not be allocated.
+
+--*/
+{
+ EFI_STATUS Status;
+
+ Status = gBS->CreateEvent (
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_NOTIFY,
+ EnableEfiOsBootWdtHandler,
+ NULL,
+ &mExitBootServicesEvent
+ );
+
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.c
new file mode 100644
index 0000000000..0e3c538d8c
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.c
@@ -0,0 +1,164 @@
+/** @file
+ IPMI Serial Over Lan Driver.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/IpmiCommandLib.h>
+#include <IndustryStandard/Ipmi.h>
+
+#define SOL_CMD_RETRY_COUNT 10
+
+/*++
+
+Routine Description:
+
+ This routine gets the SOL payload status or settings for a specific channel.
+
+Arguments:
+ Channel - LAN channel naumber.
+ ParamSel - Configuration parameter selection.
+ Data - Information returned from BMC.
+Returns:
+ EFI_SUCCESS - SOL configuration parameters are successfully read from BMC.
+ Others - SOL configuration parameters could not be read from BMC.
+
+--*/
+EFI_STATUS
+GetSOLStatus (
+ IN UINT8 Channel,
+ IN UINT8 ParamSel,
+ IN OUT UINT8 *Data
+ )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST GetConfigurationParametersRequest;
+ IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE GetConfigurationParametersResponse;
+ UINT32 DataSize;
+ UINT8 RetryCount;
+
+ for (RetryCount = 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) {
+ ZeroMem (&GetConfigurationParametersRequest, sizeof(GetConfigurationParametersRequest));
+ GetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber = Channel;
+ GetConfigurationParametersRequest.ParameterSelector = ParamSel;
+
+ ZeroMem (&GetConfigurationParametersResponse, sizeof(GetConfigurationParametersResponse));
+
+ DataSize = sizeof(GetConfigurationParametersResponse);
+ Status = IpmiGetSolConfigurationParameters (
+ &GetConfigurationParametersRequest,
+ &GetConfigurationParametersResponse,
+ &DataSize
+ );
+
+ if (Status == EFI_SUCCESS){
+ break;
+ } else {
+ gBS->Stall(100000);
+ }
+ }
+
+ if (Status == EFI_SUCCESS) {
+ *Data = GetConfigurationParametersResponse.ParameterData[0];
+ }
+
+ return Status;
+}
+
+/*++
+
+Routine Description:
+
+ This routine sets the SOL payload configuration parameters for a specific channel.
+
+Arguments:
+ Channel - LAN channel naumber.
+ ParamSel - Configuration parameter selection.
+ Data - Configuration parameter values.
+Returns:
+ EFI_SUCCESS - SOL configuration parameters are sent to BMC.
+ Others - SOL configuration parameters could not be sent to BMC.
+
+--*/
+EFI_STATUS
+SetSOLParams (
+ IN UINT8 Channel,
+ IN UINT8 ParamSel,
+ IN UINT8 Data
+ )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST SetConfigurationParametersRequest;
+ UINT8 CompletionCode;
+ UINT8 RetryCount;
+
+ for (RetryCount = 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) {
+ ZeroMem (&SetConfigurationParametersRequest, sizeof(SetConfigurationParametersRequest));
+ SetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber = Channel;
+ SetConfigurationParametersRequest.ParameterSelector = ParamSel;
+ SetConfigurationParametersRequest.ParameterData[0] = Data;
+
+ CompletionCode = 0;
+
+ Status = IpmiSetSolConfigurationParameters (
+ &SetConfigurationParametersRequest,
+ sizeof(SetConfigurationParametersRequest),
+ &CompletionCode
+ );
+
+ if (Status == EFI_SUCCESS) {
+ break;
+ } else {
+ gBS->Stall(100000);
+ }
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+SolStatusEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+ Routine Description:
+ This is the standard EFI driver point. This function initializes
+ the private data required for creating SOL Status Driver.
+
+ Arguments:
+ ImageHandle - Handle for the image of this driver
+ SystemTable - Pointer to the EFI System Table
+
+ Returns:
+ EFI_SUCCESS - Protocol successfully installed
+ EFI_UNSUPPORTED - Protocol can't be installed.
+
+--*/
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT8 Channel;
+ BOOLEAN SolEnabled = FALSE;
+
+ for (Channel = 1; Channel <= PcdGet8 (PcdMaxSOLChannels); Channel++) {
+ Status = GetSOLStatus (Channel, IPMI_SOL_CONFIGURATION_PARAMETER_SOL_ENABLE, &SolEnabled);
+ if (Status == EFI_SUCCESS) {
+ DEBUG ((DEBUG_ERROR, "SOL enabling status for channel %x is %x\n", Channel, SolEnabled));
+ } else {
+ DEBUG ((DEBUG_ERROR, "Failed to get channel %x SOL status from BMC!, status is %x\n", Channel, Status));
+ }
+ }
+
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/BmcSsdt.asl b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/BmcSsdt.asl
new file mode 100644
index 0000000000..79993f199b
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/BmcSsdt.asl
@@ -0,0 +1,28 @@
+/** @file
+ BMC ACPI SSDT.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+DefinitionBlock (
+ "BmcSsdt.aml",
+ "SSDT",
+ 0x02, // SSDT revision.
+ // A Revision field value greater than or equal to 2 signifies that integers
+ // declared within the Definition Block are to be evaluated as 64-bit values
+ "INTEL", // OEM ID (6 byte string)
+ "BMCACPI", // OEM table ID (8 byte string)
+ 0x0 // OEM version of DSDT table (4 byte Integer)
+ )
+{
+
+ External(\_SB.PC00.LPC0, DeviceObj)
+
+ Scope (\_SB.PC00.LPC0)
+ {
+ #include "IpmiOprRegions.asi"
+ }
+
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/IpmiOprRegions.asi b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/IpmiOprRegions.asi
new file mode 100644
index 0000000000..876e00b1ac
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/IpmiOprRegions.asi
@@ -0,0 +1,58 @@
+/** @file
+ IPMI ACPI SSDT.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+Device(IPMC)
+{
+ // Config DWord, modified during POST
+ // Bit definitions are the same as PPMFlags:
+ // [00] = Plug and Play BMC Detection enabled in setup
+ // [31:01] = Reserved = 0
+
+ Name(ECFL, 0x80000000)
+
+ // Return the interface specification revision
+ Method(_SRV)
+ {
+ // IPMI Specification Revision v2.0
+ Return(0x0200)
+ }
+
+ Method(_STA, 0)
+ {
+ //
+ // Assume OK
+ //
+ Store (0xF, Local0)
+
+ Return(Local0)
+
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if the device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bit 5 - Reserved (must be cleared).
+ } // end of _STA
+
+ // Return the x86 resources consumed by BMC
+ Name(_CRS, ResourceTemplate()
+ {
+ // Uses 8-bit ports 0xCA2-0xCA5
+ IO(Decode16, 0xCA2, 0xCA2, 0, 2)
+ })
+
+ Name(_HID, "IPI0001") // IPMI device
+ Name(_IFT, 0x1) // KCS system interface type
+ Name(_STR, Unicode("IPMI_KCS"))
+
+ Name(_UID, 0) // First interface.
+
+
+} // end of Device(IPMC)
+
+
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 19/49] AdvancedFeaturePkg: Remove the SMBIOS feature
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (17 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 18/49] Features/Intel/IpmiFeaturePkg: Add modules Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 20/49] Features/Intel/SmbiosFeaturePkg: Add initial package Kubacki, Michael A
` (28 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Removes the SMBIOS feature from AdvancedFeaturePkg. The feature
does not follow the advanced feature design. A future change will
add the feature back following the advanced feature design.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 112 -----------------
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 21 ----
Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc | 4 -
Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf | 6 -
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf | 83 -------------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h | 45 -------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntryPoint.c | 125 -------------------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendorFunction.c | 81 ------------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManufacturerFunction.c | 114 -----------------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c | 131 --------------------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInformationFunction.c | 56 ---------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c | 125 -------------------
12 files changed, 903 deletions(-)
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
index 4f8300d145..6cd333d498 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
@@ -26,117 +26,5 @@ Include
[Guids]
gAdvancedFeaturePkgTokenSpaceGuid = {0xa8514688, 0x6693, 0x4ab5, {0xaa, 0xc8, 0xcc, 0xa9, 0x8d, 0xde, 0x90, 0xe1}}
-[PcdsDynamic, PcdsDynamicEx]
-
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation|{0x0}|SMBIOS_TABLE_TYPE0|0x80010000 {
- <HeaderFiles>
- IndustryStandard/SmBios.h
- <Packages>
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
- }
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.Vendor|0x1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosVersion|0x2
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSegment|0xF000
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosReleaseDate|0x3
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSize|0xFF
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PciIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PlugAndPlayIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BiosIsUpgradable|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BiosShadowingAllowed|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BootFromCdIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.SelectableBootIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.EDDSpecificationIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy525_12IsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy35_720IsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy35_288IsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PrintScreenIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Keyboard8042IsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.SerialIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PrinterIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.CgaMonoIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[0]|0x33
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[1]|0x0F
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor|"Intel Corporation"|VOID*|0x80010001
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"PURLEY CV/CRB BIOS Internal"|VOID*|0x80010002
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|"2008-12-23"|VOID*|0x80010003
-
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation|{0x0}|SMBIOS_TABLE_TYPE1|0x80010100 {
- <HeaderFiles>
- IndustryStandard/SmBios.h
- <Packages>
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
- }
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Manufacturer|0x1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.ProductName|0x2
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Version|0x3
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SerialNumber|0x4
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Uuid|{GUID("88888888-8887-8888-8888-878888888888")}
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.WakeUpType|SystemWakeupTypePowerSwitch
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SKUNumber|0x5
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Family|0x6
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer|"Intel Corporation"|VOID*|0x80010101
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"PURLEY"|VOID*|0x80010102
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion|"1.0"|VOID*|0x80010103
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber|"UNKNOWN"|VOID*|0x80010104
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber|"SKU Number"|VOID*|0x80010105
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily|"Family"|VOID*|0x80010106
-
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation|{0x0}|SMBIOS_TABLE_TYPE2|0x80010200 {
- <HeaderFiles>
- IndustryStandard/SmBios.h
- <Packages>
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
- }
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Manufacturer|0x1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.ProductName|0x2
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Version|0x3
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.SerialNumber|0x4
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.AssetTag|0x5
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.FeatureFlag.Motherboard|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.FeatureFlag.Replaceable|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.LocationInChassis|0x6
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.BoardType|BaseBoardTypeMotherBoard
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer|"Intel Corporation"|VOID*|0x80010201
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"PURLEY"|VOID*|0x80010202
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion|"E63448-400"|VOID*|0x80010203
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber|"SPRO03200016"|VOID*|0x80010204
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag|"Base Board Asset Tag"|VOID*|0x80010205
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis|"Part Component"|VOID*|0x80010206
-
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis|{0x0}|SMBIOS_TABLE_TYPE3|0x80010300 {
- <HeaderFiles>
- IndustryStandard/SmBios.h
- <Packages>
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
- }
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Manufacturer|0x1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Type|MiscChassisTypeRackMountChassis
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Version|0x2
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.SerialNumber|0x3
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.AssetTag|0x4
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.BootupState|ChassisStateSafe
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.PowerSupplyState|ChassisStateSafe
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.ThermalState|ChassisStateSafe
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.SecurityStatus|ChassisSecurityStatusNone
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer|"Intel Corporation"|VOID*|0x80010301
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion|"0.1"|VOID*|0x80010302
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber|"UNKNOWN"|VOID*|0x80010303
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag|"Chassis Asset Tag"|VOID*|0x80010304
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber|"SKU Number"|VOID*|0x80010305
-
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation|{0x0}|SMBIOS_TABLE_TYPE32|0x80012000 {
- <HeaderFiles>
- IndustryStandard/SmBios.h
- <Packages>
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
- }
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation.BootStatus|BootInformationStatusNoError
-
[PcdsFeatureFlag]
gAdvancedFeaturePkgTokenSpaceGuid.PcdNetworkEnable |FALSE|BOOLEAN|0xF00000A1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable |FALSE|BOOLEAN|0xF00000A2
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index ca8db13f7c..4b8ccf3375 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -45,26 +45,6 @@
################################################################################
[LibraryClasses.common]
- #######################################
- # Edk2 Packages
- #######################################
- BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
- BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
-
-[LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE,LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRIVER,LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION]
- #######################################
- # Edk2 Packages
- #######################################
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
###################################################################################################
#
@@ -94,7 +74,6 @@
# in the package build.
# Add components here that should be included in the package build.
- AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
[BuildOptions]
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc b/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
index fceaadc100..b74c0ef2bc 100644
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
@@ -13,7 +13,3 @@
#
!include NetworkPkg/NetworkComponents.dsc.inc
-!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable == TRUE
- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
-!endif
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
index d980e673a8..a86ecdc9d1 100644
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
+++ b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
@@ -12,9 +12,3 @@
# UEFI network modules
#
!include NetworkPkg/Network.fdf.inc
-
-!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable == TRUE
-INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
-!endif
-
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
deleted file mode 100644
index c3ec4f7885..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
+++ /dev/null
@@ -1,83 +0,0 @@
-### @file
-# Component description file for Smbios Misc module.
-#
-# Copyright (c) 2018-2019, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SmbiosBasic
- FILE_GUID = 03ADF4A1-A27A-45E3-B211-3177C6C2E7ED
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = SmbiosBasicEntryPoint
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- SmbiosBasicEntryPoint.c
- SmbiosBasic.h
- Type0BiosVendorFunction.c
- Type1SystemManufacturerFunction.c
- Type2BaseBoardManufacturerFunction.c
- Type3ChassisManufacturerFunction.c
- Type32BootInformationFunction.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- PcdLib
- MemoryAllocationLib
- DevicePathLib
- BaseMemoryLib
- BaseLib
- DebugLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- UefiLib
- HobLib
-
-[Protocols]
- gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiVariableArchProtocolGuid
-
-[Pcd]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation
-
-[Depex]
- gEfiSmbiosProtocolGuid AND
- gEfiVariableArchProtocolGuid
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h
deleted file mode 100644
index 944946b5b8..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file
- Smbios basic header file.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _SMBIOS_BASIC_DRIVER_H
-#define _SMBIOS_BASIC_DRIVER_H
-
-#include <PiDxe.h>
-#include <Protocol/Smbios.h>
-#include <IndustryStandard/SmBios.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
-#include <Library/UefiLib.h>
-
-/**
- Add an SMBIOS record.
-
- @param Smbios The EFI_SMBIOS_PROTOCOL instance.
- @param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
- @param Record The data for the fixed portion of the SMBIOS record. The format of the record is
- determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
- by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
- a set of null terminated strings and a null.
-
- @retval EFI_SUCCESS Record was added.
- @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
-
-**/
-EFI_STATUS
-AddSmbiosRecord (
- IN EFI_SMBIOS_PROTOCOL *Smbios,
- OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
- IN EFI_SMBIOS_TABLE_HEADER *Record
- );
-
-#endif
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntryPoint.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntryPoint.c
deleted file mode 100644
index 8e68629ef6..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntryPoint.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/** @file
- Smbios basic entry point.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "SmbiosBasic.h"
-
-EFI_STATUS
-EFIAPI
-BiosVendorFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- );
-
-EFI_STATUS
-EFIAPI
-SystemManufacturerFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- );
-
-EFI_STATUS
-EFIAPI
-BaseBoardManufacturerFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- );
-
-EFI_STATUS
-EFIAPI
-ChassisManufacturerFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- );
-
-EFI_STATUS
-EFIAPI
-BootInfoStatusFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- );
-
-typedef
-EFI_STATUS
-(EFIAPI EFI_BASIC_SMBIOS_DATA_FUNCTION) (
- IN EFI_SMBIOS_PROTOCOL *Smbios
- );
-
-typedef struct {
- EFI_BASIC_SMBIOS_DATA_FUNCTION *Function;
-} EFI_BASIC_SMBIOS_DATA;
-
-EFI_BASIC_SMBIOS_DATA mSmbiosBasicDataFuncTable[] = {
- {&BiosVendorFunction},
- {&SystemManufacturerFunction},
- {&BaseBoardManufacturerFunction},
- {&ChassisManufacturerFunction},
- {&BootInfoStatusFunction},
-};
-
-/**
- Standard EFI driver point. This driver parses the mSmbiosMiscDataTable
- structure and reports any generated data using SMBIOS protocol.
-
- @param ImageHandle Handle for the image of this driver
- @param SystemTable Pointer to the EFI System Table
-
- @retval EFI_SUCCESS The data was successfully stored.
-
-**/
-EFI_STATUS
-EFIAPI
-SmbiosBasicEntryPoint(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- UINTN Index;
- EFI_STATUS EfiStatus;
- EFI_SMBIOS_PROTOCOL *Smbios;
-
- EfiStatus = gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios);
- if (EFI_ERROR(EfiStatus)) {
- DEBUG((EFI_D_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStatus));
- return EfiStatus;
- }
-
- for (Index = 0; Index < sizeof(mSmbiosBasicDataFuncTable)/sizeof(mSmbiosBasicDataFuncTable[0]); ++Index) {
- EfiStatus = (*mSmbiosBasicDataFuncTable[Index].Function) (Smbios);
- if (EFI_ERROR(EfiStatus)) {
- DEBUG((EFI_D_ERROR, "Basic smbios store error. Index=%d, ReturnStatus=%r\n", Index, EfiStatus));
- return EfiStatus;
- }
- }
-
- return EfiStatus;
-}
-
-/**
- Add an SMBIOS record.
-
- @param Smbios The EFI_SMBIOS_PROTOCOL instance.
- @param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
- @param Record The data for the fixed portion of the SMBIOS record. The format of the record is
- determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
- by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
- a set of null terminated strings and a null.
-
- @retval EFI_SUCCESS Record was added.
- @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
-
-**/
-EFI_STATUS
-AddSmbiosRecord (
- IN EFI_SMBIOS_PROTOCOL *Smbios,
- OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
- IN EFI_SMBIOS_TABLE_HEADER *Record
- )
-{
- *SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
- return Smbios->Add (
- Smbios,
- NULL,
- SmbiosHandle,
- Record
- );
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendorFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendorFunction.c
deleted file mode 100644
index 331efc8614..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendorFunction.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/** @file
- Smbios type 0.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "SmbiosBasic.h"
-
-/**
- This function makes boot time changes to the contents of the
- BiosVendor (Type 0).
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-EFI_STATUS
-EFIAPI
-BiosVendorFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- )
-{
- EFI_STATUS Status;
- CHAR8 *VendorStr;
- UINTN VendorStrLen;
- CHAR8 *VersionStr;
- UINTN VerStrLen;
- CHAR8 *DateStr;
- UINTN DateStrLen;
- SMBIOS_TABLE_TYPE0 *SmbiosRecord;
- SMBIOS_TABLE_TYPE0 *PcdSmbiosRecord;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- UINTN StringOffset;
-
- PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType0BiosInformation);
-
- VendorStr = PcdGetPtr (PcdSmbiosType0StringVendor);
- VendorStrLen = AsciiStrLen (VendorStr);
- ASSERT (VendorStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- VersionStr = PcdGetPtr (PcdSmbiosType0StringBiosVersion);
- VerStrLen = AsciiStrLen (VersionStr);
- ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- DateStr = PcdGetPtr (PcdSmbiosType0StringBiosReleaseDate);
- DateStrLen = AsciiStrLen (DateStr);
- ASSERT (DateStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1);
- if (SmbiosRecord == NULL) {
- ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
- return EFI_OUT_OF_RESOURCES;
- }
-
- CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE0));
-
- SmbiosRecord->Hdr.Type = SMBIOS_TYPE_BIOS_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE0);
- SmbiosRecord->Hdr.Handle = 0;
-
- StringOffset = SmbiosRecord->Hdr.Length;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VendorStr, VendorStrLen);
- StringOffset += VendorStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
- StringOffset += VerStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, DateStr, DateStrLen);
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool (SmbiosRecord);
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManufacturerFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManufacturerFunction.c
deleted file mode 100644
index 2314d09695..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManufacturerFunction.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/** @file
- Smbios type 1.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "SmbiosBasic.h"
-
-/**
- This function makes boot time changes to the contents of the
- SystemManufacturer (Type 1).
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-EFI_STATUS
-EFIAPI
-SystemManufacturerFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- )
-{
- EFI_STATUS Status;
- CHAR8 *ManufacturerStr;
- CHAR8 *ProductNameStr;
- CHAR8 *VersionStr;
- CHAR8 *SerialNumberStr;
- CHAR8 *SKUNumberStr;
- CHAR8 *FamilyStr;
- UINTN ManufacturerStrLen;
- UINTN ProductNameStrLen;
- UINTN VersionStrLen;
- UINTN SerialNumberStrLen;
- UINTN SKUNumberStrLen;
- UINTN FamilyStrLen;
- UINTN TableSize;
- SMBIOS_TABLE_TYPE1 *PcdSmbiosRecord;
- SMBIOS_TABLE_TYPE1 *SmbiosRecord;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- UINTN StringOffset;
-
- PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType1SystemInformation);
-
- ManufacturerStr = PcdGetPtr (PcdSmbiosType1StringManufacturer);
- ManufacturerStrLen = AsciiStrLen (ManufacturerStr);
- ASSERT (ManufacturerStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- ProductNameStr = PcdGetPtr (PcdSmbiosType1StringProductName);
- ProductNameStrLen = AsciiStrLen (ProductNameStr);
- ASSERT (ProductNameStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- VersionStr = PcdGetPtr (PcdSmbiosType1StringVersion);
- VersionStrLen = AsciiStrLen (VersionStr);
- ASSERT (VersionStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- SerialNumberStr = PcdGetPtr (PcdSmbiosType1StringSerialNumber);
- SerialNumberStrLen = AsciiStrLen (SerialNumberStr);
- ASSERT (SerialNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- SKUNumberStr = PcdGetPtr (PcdSmbiosType1StringSKUNumber);
- SKUNumberStrLen = AsciiStrLen (SKUNumberStr);
- ASSERT (SKUNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- FamilyStr = PcdGetPtr (PcdSmbiosType1StringFamily);
- FamilyStrLen = AsciiStrLen (FamilyStr);
- ASSERT (FamilyStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Create table size based on string lengths
- //
- TableSize = sizeof (SMBIOS_TABLE_TYPE1) + ManufacturerStrLen + 1 + ProductNameStrLen + 1 + VersionStrLen + 1 + SerialNumberStrLen + 1 + SKUNumberStrLen + 1 + FamilyStrLen + 1 + 1;
- SmbiosRecord = AllocateZeroPool (TableSize);
- if (SmbiosRecord == NULL) {
- ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
- return EFI_OUT_OF_RESOURCES;
- }
-
- CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE1));
-
- //
- // Fill in Type 1 fields
- //
-
- SmbiosRecord->Hdr.Type = SMBIOS_TYPE_SYSTEM_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE1);
- SmbiosRecord->Hdr.Handle = 0;
-
- //
- // Add strings to bottom of data block
- //
- StringOffset = SmbiosRecord->Hdr.Length;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManufacturerStrLen);
- StringOffset += ManufacturerStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductNameStr, ProductNameStrLen);
- StringOffset += ProductNameStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VersionStrLen);
- StringOffset += VersionStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumberStrLen);
- StringOffset += SerialNumberStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberStrLen);
- StringOffset += SKUNumberStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, FamilyStr, FamilyStrLen);
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c
deleted file mode 100644
index 9193cb0be7..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/** @file
- Smbios type 2.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "SmbiosBasic.h"
-
-/**
- This function makes boot time changes to the contents of the
- BaseBoardManufacturer (Type 2).
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-EFI_STATUS
-EFIAPI
-BaseBoardManufacturerFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- )
-{
- EFI_STATUS Status;
- CHAR8 *ManufacturerStr;
- CHAR8 *ProductStr;
- CHAR8 *VersionStr;
- CHAR8 *SerialNumberStr;
- CHAR8 *AssertTagStr;
- CHAR8 *ChassisStr;
- UINTN ManuStrLen;
- UINTN ProductStrLen;
- UINTN VerStrLen;
- UINTN AssertTagStrLen;
- UINTN SerialNumStrLen;
- UINTN ChassisStrLen;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE2 *PcdSmbiosRecord;
- SMBIOS_TABLE_TYPE2 *SmbiosRecord;
- UINTN SourceSize;
- UINTN TotalSize;
- UINTN StringOffset;
-
- PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType2BaseBoardInformation);
-
- //
- // Get BoardManufacturer String.
- //
- ManufacturerStr = PcdGetPtr (PcdSmbiosType2StringManufacturer);
- ManuStrLen = AsciiStrLen (ManufacturerStr);
- ASSERT (ManuStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get Board ProductName String.
- //
- ProductStr = PcdGetPtr (PcdSmbiosType2StringProductName);
- ProductStrLen = AsciiStrLen (ProductStr);
- ASSERT (ProductStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get Board Version String.
- //
- VersionStr = PcdGetPtr (PcdSmbiosType2StringVersion);
- VerStrLen = AsciiStrLen (VersionStr);
- ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get Board Serial Number String.
- //
- SerialNumberStr = PcdGetPtr (PcdSmbiosType2StringSerialNumber);
- SerialNumStrLen = AsciiStrLen (SerialNumberStr);
- ASSERT (SerialNumStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get Board Asset Tag String.
- //
- AssertTagStr = PcdGetPtr (PcdSmbiosType2StringAssetTag);
- AssertTagStrLen = AsciiStrLen (AssertTagStr);
- ASSERT (AssertTagStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get Board Chassis Location Tag String.
- //
- ChassisStr = PcdGetPtr (PcdSmbiosType2StringLocationInChassis);
- ChassisStrLen = AsciiStrLen (ChassisStr);
- ASSERT (ChassisStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Two zeros following the last string.
- //
- SourceSize = PcdGetSize (PcdSmbiosType2BaseBoardInformation);
- TotalSize = SourceSize + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen + 1 + 1;
- SmbiosRecord = AllocateZeroPool(TotalSize);
- if (SmbiosRecord == NULL) {
- ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
- return EFI_OUT_OF_RESOURCES;
- }
-
- CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize);
-
- SmbiosRecord->Hdr.Type = SMBIOS_TYPE_BASEBOARD_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2);
- if (PcdSmbiosRecord->NumberOfContainedObjectHandles >= 2) {
- SmbiosRecord->Hdr.Length += (PcdSmbiosRecord->NumberOfContainedObjectHandles - 1) * sizeof(PcdSmbiosRecord->ContainedObjectHandles);
- }
- ASSERT(SourceSize >= SmbiosRecord->Hdr.Length);
- SmbiosRecord->Hdr.Handle = 0;
-
- StringOffset = SmbiosRecord->Hdr.Length;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrLen);
- StringOffset += ManuStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductStr, ProductStrLen);
- StringOffset += ProductStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
- StringOffset += VerStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumStrLen);
- StringOffset += SerialNumStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagStrLen);
- StringOffset += AssertTagStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ChassisStr, ChassisStrLen);
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInformationFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInformationFunction.c
deleted file mode 100644
index 87bfd045da..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInformationFunction.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
- Smbios type 32.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "SmbiosBasic.h"
-
-
-/**
- This function makes boot time changes to the contents of the
- BootInformation (Type 32).
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-EFI_STATUS
-EFIAPI
-BootInfoStatusFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- )
-{
- EFI_STATUS Status;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE32 *PcdSmbiosRecord;
- SMBIOS_TABLE_TYPE32 *SmbiosRecord;
-
- PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType32SystemBootInformation);
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
- if (SmbiosRecord == NULL) {
- ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
- return EFI_OUT_OF_RESOURCES;
- }
-
- CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE32));
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);
- SmbiosRecord->Hdr.Handle = 0;
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c
deleted file mode 100644
index 33732bc9ca..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/** @file
- Smbios type 3.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "SmbiosBasic.h"
-
-/**
- This function makes boot time changes to the contents of the
- ChassisManufacturer (Type 3).
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-EFI_STATUS
-EFIAPI
-ChassisManufacturerFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- )
-{
- UINTN ManuStrLen;
- UINTN VerStrLen;
- UINTN AssertTagStrLen;
- UINTN SerialNumStrLen;
- UINTN SKUNumberStrLen;
- EFI_STATUS Status;
- CHAR8 *ManufacturerStr;
- CHAR8 *VersionStr;
- CHAR8 *SerialNumberStr;
- CHAR8 *AssertTagStr;
- CHAR8 *SKUNumberStr;
- SMBIOS_TABLE_STRING *SKUNumberPtr;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE3 *SmbiosRecord;
- SMBIOS_TABLE_TYPE3 *PcdSmbiosRecord;
- UINTN SourceSize;
- UINTN TotalSize;
- UINTN StringOffset;
-
- PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType3SystemEnclosureChassis);
-
- //
- // Get ChassisManufacturer String.
- //
- ManufacturerStr = PcdGetPtr (PcdSmbiosType3StringManufacturer);
- ManuStrLen = AsciiStrLen (ManufacturerStr);
- ASSERT (ManuStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get ChassisVersion String.
- //
- VersionStr = PcdGetPtr (PcdSmbiosType3StringVersion);
- VerStrLen = AsciiStrLen (VersionStr);
- ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get ChassisSerialNumber String.
- //
- SerialNumberStr = PcdGetPtr (PcdSmbiosType3StringSerialNumber);
- SerialNumStrLen = AsciiStrLen (SerialNumberStr);
- ASSERT (SerialNumStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get ChassisAssetTag String.
- //
- AssertTagStr = PcdGetPtr (PcdSmbiosType3StringAssetTag);
- AssertTagStrLen = AsciiStrLen (AssertTagStr);
- ASSERT (AssertTagStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get ChassisSKUNumber String.
- //
- SKUNumberStr = PcdGetPtr (PcdSmbiosType3StringSKUNumber);
- SKUNumberStrLen = AsciiStrLen (SKUNumberStr);
- ASSERT (SKUNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Two zeros following the last string.
- //
- SourceSize = PcdGetSize(PcdSmbiosType3SystemEnclosureChassis);
- TotalSize = SourceSize + sizeof(SMBIOS_TABLE_STRING) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + SKUNumberStrLen + 1 + 1;
- SmbiosRecord = AllocateZeroPool(TotalSize);
- if (SmbiosRecord == NULL) {
- ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
- return EFI_OUT_OF_RESOURCES;
- }
-
- CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE;
- SmbiosRecord->Hdr.Length = OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements) + sizeof(SMBIOS_TABLE_STRING);
- if (PcdSmbiosRecord->ContainedElementCount >= 1) {
- SmbiosRecord->Hdr.Length += PcdSmbiosRecord->ContainedElementCount * PcdSmbiosRecord->ContainedElementRecordLength;
- }
- SmbiosRecord->Hdr.Handle = 0;
-
- if ((PcdSmbiosRecord->ContainedElementCount == 0) || (SourceSize < (UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length)) {
- SKUNumberPtr = (SMBIOS_TABLE_STRING *)((UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length - sizeof(SMBIOS_TABLE_STRING));
- *SKUNumberPtr = 5;
- }
-
- StringOffset = SmbiosRecord->Hdr.Length;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrLen);
- StringOffset += ManuStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
- StringOffset += VerStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumStrLen);
- StringOffset += SerialNumStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagStrLen);
- StringOffset += AssertTagStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberStrLen);
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 20/49] Features/Intel/SmbiosFeaturePkg: Add initial package
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (18 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 19/49] AdvancedFeaturePkg: Remove the SMBIOS feature Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 21/49] Features/Intel/SmbiosFeaturePkg: Update default strings Kubacki, Michael A
` (27 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Adds a new feature package for the SMBIOS feature.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec | 172 ++++++++++++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc | 115 +++++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc | 30 ++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf | 10 ++
Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf | 83 ++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h | 45 +++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicEntryPoint.c | 125 ++++++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c | 81 +++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c | 114 +++++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c | 131 +++++++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c | 56 +++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c | 125 ++++++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md | 86 ++++++++++
14 files changed, 1181 insertions(+)
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
new file mode 100644
index 0000000000..c06a87aad0
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
@@ -0,0 +1,172 @@
+## @file
+# This package provides advanced feature functionality for System Management BIOS (SMBIOS).
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = SmbiosFeaturePkg
+ PACKAGE_GUID = 8CCEE569-02AD-4844-8725-F4C7966E320A
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[LibraryClasses]
+
+[Guids]
+ gSmbiosFeaturePkgTokenSpaceGuid = {0xc1530658, 0xe234, 0x4c13, {0xb6, 0x82, 0xd3, 0x87, 0x84, 0xf1, 0xd7, 0x16}}
+
+[PcdsFeatureFlag]
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable|FALSE|BOOLEAN|0xA0000001
+
+[PcdsDynamic, PcdsDynamicEx]
+ #
+ # SMBIOS Type 0 BIOS Information
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation|{0x0}|SMBIOS_TABLE_TYPE0|0xD0000001 {
+ <HeaderFiles>
+ IndustryStandard/SmBios.h
+ <Packages>
+ MdePkg/MdePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+ }
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.Vendor|0x1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosVersion|0x2
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSegment|0xF000
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosReleaseDate|0x3
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSize|0xFF
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PciIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PlugAndPlayIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BiosIsUpgradable|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BiosShadowingAllowed|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BootFromCdIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.SelectableBootIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.EDDSpecificationIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy525_12IsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy35_720IsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy35_288IsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PrintScreenIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Keyboard8042IsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.SerialIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PrinterIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.CgaMonoIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[0]|0x33
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[1]|0x0F
+
+ #
+ # SMBIOS Type 1 System Information
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation|{0x0}|SMBIOS_TABLE_TYPE1|0xD0000002 {
+ <HeaderFiles>
+ IndustryStandard/SmBios.h
+ <Packages>
+ MdePkg/MdePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+ }
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Manufacturer|0x1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.ProductName|0x2
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Version|0x3
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SerialNumber|0x4
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Uuid|{GUID("88888888-8887-8888-8888-878888888888")}
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.WakeUpType|SystemWakeupTypePowerSwitch
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SKUNumber|0x5
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Family|0x6
+
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation|{0x0}|SMBIOS_TABLE_TYPE2|0xD0000003 {
+ <HeaderFiles>
+ IndustryStandard/SmBios.h
+ <Packages>
+ MdePkg/MdePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+ }
+
+ #
+ # SMBIOS Type 2 Base Board Information
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Manufacturer|0x1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.ProductName|0x2
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Version|0x3
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.SerialNumber|0x4
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.AssetTag|0x5
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.FeatureFlag.Motherboard|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.FeatureFlag.Replaceable|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.LocationInChassis|0x6
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.BoardType|BaseBoardTypeMotherBoard
+
+ #
+ # SMBIOS Type 3 System Enclosure Chassis
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis|{0x0}|SMBIOS_TABLE_TYPE3|0xD0000004 {
+ <HeaderFiles>
+ IndustryStandard/SmBios.h
+ <Packages>
+ MdePkg/MdePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+ }
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Manufacturer|0x1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Type|MiscChassisTypeRackMountChassis
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Version|0x2
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.SerialNumber|0x3
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.AssetTag|0x4
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.BootupState|ChassisStateSafe
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.PowerSupplyState|ChassisStateSafe
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.ThermalState|ChassisStateSafe
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.SecurityStatus|ChassisSecurityStatusNone
+
+ #
+ # SMBIOS Type 32 System Boot Information
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation|{0x0}|SMBIOS_TABLE_TYPE32|0xD0000005 {
+ <HeaderFiles>
+ IndustryStandard/SmBios.h
+ <Packages>
+ MdePkg/MdePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+ }
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation.BootStatus|BootInformationStatusNoError
+
+ #
+ # SMBIOS Type 0 BIOS Information Strings
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|"2008-12-23"|VOID*|0xD1000001
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"PURLEY CV/CRB BIOS Internal"|VOID*|0xD1000002
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor|"Intel Corporation"|VOID*|0xD1000003
+
+ #
+ # SMBIOS Type 1 System Information Strings
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily|"Family"|VOID*|0xD1000004
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer|"Intel Corporation"|VOID*|0xD1000005
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"PURLEY"|VOID*|0xD1000006
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber|"UNKNOWN"|VOID*|0xD1000007
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber|"SKU Number"|VOID*|0xD1000008
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion|"1.0"|VOID*|0xD1000009
+
+ #
+ # SMBIOS Type 2 Base Board Information Strings
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag|"Base Board Asset Tag"|VOID*|0xD100000A
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis|"Part Component"|VOID*|0xD100000B
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer|"Intel Corporation"|VOID*|0xD100000C
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"PURLEY"|VOID*|0xD100000D
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber|"SPRO03200016"|VOID*|0xD100000E
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion|"E63448-400"|VOID*|0xD100000F
+
+ #
+ # SMBIOS Type 3 System Enclosure Chassis Strings
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag|"Chassis Asset Tag"|VOID*|0xD1000011
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer|"Intel Corporation"|VOID*|0xD1000012
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber|"UNKNOWN"|VOID*|0xD1000013
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber|"SKU Number"|VOID*|0xD1000014
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion|"0.1"|VOID*|0xD1000015
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc
new file mode 100644
index 0000000000..a59fdf3702
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc
@@ -0,0 +1,115 @@
+## @file
+# This is a build description file for the SMBIOS advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+################################################################################
+[LibraryClasses]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+
+[LibraryClasses.common.DXE_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+
+################################################################################
+#
+# Component section - list of all components that need built for this feature.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+################################################################################
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # SMBIOS Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
+ #####################################
+ # SMBIOS Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+ SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf
+
+###################################################################################################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
+###################################################################################################
+[BuildOptions]
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc
new file mode 100644
index 0000000000..31141c0725
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for System Management BIOS (SMBIOS).
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ PLATFORM_NAME = SmbiosFeaturePkg
+ PLATFORM_GUID = 44AF1C2A-16AD-4509-8DF6-988E73E23A85
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#
+# This package always builds the feature.
+#
+!include Include/SmbiosFeature.dsc
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..3ed23bd937
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,10 @@
+## @file
+# FDF file for post-memory SMBIOS modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+ INF SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..732c1b69e5
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory SMBIOS modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf
new file mode 100644
index 0000000000..bd8736b621
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf
@@ -0,0 +1,83 @@
+### @file
+# Component description file for the SMBIOS basic module.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = SmbiosBasic
+ FILE_GUID = 03ADF4A1-A27A-45E3-B211-3177C6C2E7ED
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = SmbiosBasicEntryPoint
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources]
+ SmbiosBasic.h
+ SmbiosBasicEntryPoint.c
+ Type0BiosVendorFunction.c
+ Type1SystemManufacturerFunction.c
+ Type2BaseBoardManufacturerFunction.c
+ Type32BootInformationFunction.c
+ Type3ChassisManufacturerFunction.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ BaseMemoryLib
+ DebugLib
+ DevicePathLib
+ HobLib
+ MemoryAllocationLib
+ PcdLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiLib
+
+[Protocols]
+ gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiVariableArchProtocolGuid
+
+[Pcd]
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis
+
+[Depex]
+ gEfiSmbiosProtocolGuid AND
+ gEfiVariableArchProtocolGuid
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h
new file mode 100644
index 0000000000..e206d69726
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h
@@ -0,0 +1,45 @@
+/** @file
+ Smbios basic header file.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _SMBIOS_BASIC_DRIVER_H
+#define _SMBIOS_BASIC_DRIVER_H
+
+#include <PiDxe.h>
+#include <Protocol/Smbios.h>
+#include <IndustryStandard/SmBios.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiLib.h>
+
+/**
+ Add an SMBIOS record.
+
+ @param Smbios The EFI_SMBIOS_PROTOCOL instance.
+ @param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
+ @param Record The data for the fixed portion of the SMBIOS record. The format of the record is
+ determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
+ by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
+ a set of null terminated strings and a null.
+
+ @retval EFI_SUCCESS Record was added.
+ @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
+
+**/
+EFI_STATUS
+AddSmbiosRecord (
+ IN EFI_SMBIOS_PROTOCOL *Smbios,
+ OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
+ IN EFI_SMBIOS_TABLE_HEADER *Record
+ );
+
+#endif
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicEntryPoint.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicEntryPoint.c
new file mode 100644
index 0000000000..4b24d1a124
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicEntryPoint.c
@@ -0,0 +1,125 @@
+/** @file
+ Smbios basic entry point.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SmbiosBasic.h"
+
+EFI_STATUS
+EFIAPI
+BiosVendorFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+EFI_STATUS
+EFIAPI
+SystemManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+EFI_STATUS
+EFIAPI
+BaseBoardManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+EFI_STATUS
+EFIAPI
+ChassisManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+EFI_STATUS
+EFIAPI
+BootInfoStatusFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI EFI_BASIC_SMBIOS_DATA_FUNCTION) (
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+typedef struct {
+ EFI_BASIC_SMBIOS_DATA_FUNCTION *Function;
+} EFI_BASIC_SMBIOS_DATA;
+
+EFI_BASIC_SMBIOS_DATA mSmbiosBasicDataFuncTable[] = {
+ {&BiosVendorFunction},
+ {&SystemManufacturerFunction},
+ {&BaseBoardManufacturerFunction},
+ {&ChassisManufacturerFunction},
+ {&BootInfoStatusFunction},
+};
+
+/**
+ Standard EFI driver point. This driver parses the mSmbiosMiscDataTable
+ structure and reports any generated data using SMBIOS protocol.
+
+ @param ImageHandle Handle for the image of this driver
+ @param SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS The data was successfully stored.
+
+**/
+EFI_STATUS
+EFIAPI
+SmbiosBasicEntryPoint(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ UINTN Index;
+ EFI_STATUS EfiStatus;
+ EFI_SMBIOS_PROTOCOL *Smbios;
+
+ EfiStatus = gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios);
+ if (EFI_ERROR(EfiStatus)) {
+ DEBUG((DEBUG_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStatus));
+ return EfiStatus;
+ }
+
+ for (Index = 0; Index < sizeof(mSmbiosBasicDataFuncTable)/sizeof(mSmbiosBasicDataFuncTable[0]); ++Index) {
+ EfiStatus = (*mSmbiosBasicDataFuncTable[Index].Function) (Smbios);
+ if (EFI_ERROR(EfiStatus)) {
+ DEBUG((DEBUG_ERROR, "Basic smbios store error. Index=%d, ReturnStatus=%r\n", Index, EfiStatus));
+ return EfiStatus;
+ }
+ }
+
+ return EfiStatus;
+}
+
+/**
+ Add an SMBIOS record.
+
+ @param Smbios The EFI_SMBIOS_PROTOCOL instance.
+ @param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
+ @param Record The data for the fixed portion of the SMBIOS record. The format of the record is
+ determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
+ by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
+ a set of null terminated strings and a null.
+
+ @retval EFI_SUCCESS Record was added.
+ @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
+
+**/
+EFI_STATUS
+AddSmbiosRecord (
+ IN EFI_SMBIOS_PROTOCOL *Smbios,
+ OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
+ IN EFI_SMBIOS_TABLE_HEADER *Record
+ )
+{
+ *SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
+ return Smbios->Add (
+ Smbios,
+ NULL,
+ SmbiosHandle,
+ Record
+ );
+}
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c
new file mode 100644
index 0000000000..a0db734698
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c
@@ -0,0 +1,81 @@
+/** @file
+ Smbios type 0.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SmbiosBasic.h"
+
+/**
+ This function makes boot time changes to the contents of the
+ BiosVendor (Type 0).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+BiosVendorFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ CHAR8 *VendorStr;
+ UINTN VendorStrLen;
+ CHAR8 *VersionStr;
+ UINTN VerStrLen;
+ CHAR8 *DateStr;
+ UINTN DateStrLen;
+ SMBIOS_TABLE_TYPE0 *SmbiosRecord;
+ SMBIOS_TABLE_TYPE0 *PcdSmbiosRecord;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ UINTN StringOffset;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType0BiosInformation);
+
+ VendorStr = PcdGetPtr (PcdSmbiosType0StringVendor);
+ VendorStrLen = AsciiStrLen (VendorStr);
+ ASSERT (VendorStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ VersionStr = PcdGetPtr (PcdSmbiosType0StringBiosVersion);
+ VerStrLen = AsciiStrLen (VersionStr);
+ ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ DateStr = PcdGetPtr (PcdSmbiosType0StringBiosReleaseDate);
+ DateStrLen = AsciiStrLen (DateStr);
+ ASSERT (DateStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE0));
+
+ SmbiosRecord->Hdr.Type = SMBIOS_TYPE_BIOS_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE0);
+ SmbiosRecord->Hdr.Handle = 0;
+
+ StringOffset = SmbiosRecord->Hdr.Length;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VendorStr, VendorStrLen);
+ StringOffset += VendorStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
+ StringOffset += VerStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, DateStr, DateStrLen);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool (SmbiosRecord);
+ return Status;
+}
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c
new file mode 100644
index 0000000000..3b8e39fe53
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c
@@ -0,0 +1,114 @@
+/** @file
+ Smbios type 1.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SmbiosBasic.h"
+
+/**
+ This function makes boot time changes to the contents of the
+ SystemManufacturer (Type 1).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+SystemManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ CHAR8 *ManufacturerStr;
+ CHAR8 *ProductNameStr;
+ CHAR8 *VersionStr;
+ CHAR8 *SerialNumberStr;
+ CHAR8 *SKUNumberStr;
+ CHAR8 *FamilyStr;
+ UINTN ManufacturerStrLen;
+ UINTN ProductNameStrLen;
+ UINTN VersionStrLen;
+ UINTN SerialNumberStrLen;
+ UINTN SKUNumberStrLen;
+ UINTN FamilyStrLen;
+ UINTN TableSize;
+ SMBIOS_TABLE_TYPE1 *PcdSmbiosRecord;
+ SMBIOS_TABLE_TYPE1 *SmbiosRecord;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ UINTN StringOffset;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType1SystemInformation);
+
+ ManufacturerStr = PcdGetPtr (PcdSmbiosType1StringManufacturer);
+ ManufacturerStrLen = AsciiStrLen (ManufacturerStr);
+ ASSERT (ManufacturerStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ ProductNameStr = PcdGetPtr (PcdSmbiosType1StringProductName);
+ ProductNameStrLen = AsciiStrLen (ProductNameStr);
+ ASSERT (ProductNameStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ VersionStr = PcdGetPtr (PcdSmbiosType1StringVersion);
+ VersionStrLen = AsciiStrLen (VersionStr);
+ ASSERT (VersionStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ SerialNumberStr = PcdGetPtr (PcdSmbiosType1StringSerialNumber);
+ SerialNumberStrLen = AsciiStrLen (SerialNumberStr);
+ ASSERT (SerialNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ SKUNumberStr = PcdGetPtr (PcdSmbiosType1StringSKUNumber);
+ SKUNumberStrLen = AsciiStrLen (SKUNumberStr);
+ ASSERT (SKUNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ FamilyStr = PcdGetPtr (PcdSmbiosType1StringFamily);
+ FamilyStrLen = AsciiStrLen (FamilyStr);
+ ASSERT (FamilyStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Create table size based on string lengths
+ //
+ TableSize = sizeof (SMBIOS_TABLE_TYPE1) + ManufacturerStrLen + 1 + ProductNameStrLen + 1 + VersionStrLen + 1 + SerialNumberStrLen + 1 + SKUNumberStrLen + 1 + FamilyStrLen + 1 + 1;
+ SmbiosRecord = AllocateZeroPool (TableSize);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE1));
+
+ //
+ // Fill in Type 1 fields
+ //
+
+ SmbiosRecord->Hdr.Type = SMBIOS_TYPE_SYSTEM_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE1);
+ SmbiosRecord->Hdr.Handle = 0;
+
+ //
+ // Add strings to bottom of data block
+ //
+ StringOffset = SmbiosRecord->Hdr.Length;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManufacturerStrLen);
+ StringOffset += ManufacturerStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductNameStr, ProductNameStrLen);
+ StringOffset += ProductNameStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VersionStrLen);
+ StringOffset += VersionStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumberStrLen);
+ StringOffset += SerialNumberStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberStrLen);
+ StringOffset += SKUNumberStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, FamilyStr, FamilyStrLen);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c
new file mode 100644
index 0000000000..9193cb0be7
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c
@@ -0,0 +1,131 @@
+/** @file
+ Smbios type 2.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SmbiosBasic.h"
+
+/**
+ This function makes boot time changes to the contents of the
+ BaseBoardManufacturer (Type 2).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+BaseBoardManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ CHAR8 *ManufacturerStr;
+ CHAR8 *ProductStr;
+ CHAR8 *VersionStr;
+ CHAR8 *SerialNumberStr;
+ CHAR8 *AssertTagStr;
+ CHAR8 *ChassisStr;
+ UINTN ManuStrLen;
+ UINTN ProductStrLen;
+ UINTN VerStrLen;
+ UINTN AssertTagStrLen;
+ UINTN SerialNumStrLen;
+ UINTN ChassisStrLen;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE2 *PcdSmbiosRecord;
+ SMBIOS_TABLE_TYPE2 *SmbiosRecord;
+ UINTN SourceSize;
+ UINTN TotalSize;
+ UINTN StringOffset;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType2BaseBoardInformation);
+
+ //
+ // Get BoardManufacturer String.
+ //
+ ManufacturerStr = PcdGetPtr (PcdSmbiosType2StringManufacturer);
+ ManuStrLen = AsciiStrLen (ManufacturerStr);
+ ASSERT (ManuStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board ProductName String.
+ //
+ ProductStr = PcdGetPtr (PcdSmbiosType2StringProductName);
+ ProductStrLen = AsciiStrLen (ProductStr);
+ ASSERT (ProductStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board Version String.
+ //
+ VersionStr = PcdGetPtr (PcdSmbiosType2StringVersion);
+ VerStrLen = AsciiStrLen (VersionStr);
+ ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board Serial Number String.
+ //
+ SerialNumberStr = PcdGetPtr (PcdSmbiosType2StringSerialNumber);
+ SerialNumStrLen = AsciiStrLen (SerialNumberStr);
+ ASSERT (SerialNumStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board Asset Tag String.
+ //
+ AssertTagStr = PcdGetPtr (PcdSmbiosType2StringAssetTag);
+ AssertTagStrLen = AsciiStrLen (AssertTagStr);
+ ASSERT (AssertTagStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board Chassis Location Tag String.
+ //
+ ChassisStr = PcdGetPtr (PcdSmbiosType2StringLocationInChassis);
+ ChassisStrLen = AsciiStrLen (ChassisStr);
+ ASSERT (ChassisStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Two zeros following the last string.
+ //
+ SourceSize = PcdGetSize (PcdSmbiosType2BaseBoardInformation);
+ TotalSize = SourceSize + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen + 1 + 1;
+ SmbiosRecord = AllocateZeroPool(TotalSize);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize);
+
+ SmbiosRecord->Hdr.Type = SMBIOS_TYPE_BASEBOARD_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2);
+ if (PcdSmbiosRecord->NumberOfContainedObjectHandles >= 2) {
+ SmbiosRecord->Hdr.Length += (PcdSmbiosRecord->NumberOfContainedObjectHandles - 1) * sizeof(PcdSmbiosRecord->ContainedObjectHandles);
+ }
+ ASSERT(SourceSize >= SmbiosRecord->Hdr.Length);
+ SmbiosRecord->Hdr.Handle = 0;
+
+ StringOffset = SmbiosRecord->Hdr.Length;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrLen);
+ StringOffset += ManuStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductStr, ProductStrLen);
+ StringOffset += ProductStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
+ StringOffset += VerStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumStrLen);
+ StringOffset += SerialNumStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagStrLen);
+ StringOffset += AssertTagStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ChassisStr, ChassisStrLen);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c
new file mode 100644
index 0000000000..87bfd045da
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c
@@ -0,0 +1,56 @@
+/** @file
+ Smbios type 32.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SmbiosBasic.h"
+
+
+/**
+ This function makes boot time changes to the contents of the
+ BootInformation (Type 32).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+BootInfoStatusFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE32 *PcdSmbiosRecord;
+ SMBIOS_TABLE_TYPE32 *SmbiosRecord;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType32SystemBootInformation);
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE32));
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);
+ SmbiosRecord->Hdr.Handle = 0;
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c
new file mode 100644
index 0000000000..33732bc9ca
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c
@@ -0,0 +1,125 @@
+/** @file
+ Smbios type 3.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SmbiosBasic.h"
+
+/**
+ This function makes boot time changes to the contents of the
+ ChassisManufacturer (Type 3).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+ChassisManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ UINTN ManuStrLen;
+ UINTN VerStrLen;
+ UINTN AssertTagStrLen;
+ UINTN SerialNumStrLen;
+ UINTN SKUNumberStrLen;
+ EFI_STATUS Status;
+ CHAR8 *ManufacturerStr;
+ CHAR8 *VersionStr;
+ CHAR8 *SerialNumberStr;
+ CHAR8 *AssertTagStr;
+ CHAR8 *SKUNumberStr;
+ SMBIOS_TABLE_STRING *SKUNumberPtr;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE3 *SmbiosRecord;
+ SMBIOS_TABLE_TYPE3 *PcdSmbiosRecord;
+ UINTN SourceSize;
+ UINTN TotalSize;
+ UINTN StringOffset;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType3SystemEnclosureChassis);
+
+ //
+ // Get ChassisManufacturer String.
+ //
+ ManufacturerStr = PcdGetPtr (PcdSmbiosType3StringManufacturer);
+ ManuStrLen = AsciiStrLen (ManufacturerStr);
+ ASSERT (ManuStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get ChassisVersion String.
+ //
+ VersionStr = PcdGetPtr (PcdSmbiosType3StringVersion);
+ VerStrLen = AsciiStrLen (VersionStr);
+ ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get ChassisSerialNumber String.
+ //
+ SerialNumberStr = PcdGetPtr (PcdSmbiosType3StringSerialNumber);
+ SerialNumStrLen = AsciiStrLen (SerialNumberStr);
+ ASSERT (SerialNumStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get ChassisAssetTag String.
+ //
+ AssertTagStr = PcdGetPtr (PcdSmbiosType3StringAssetTag);
+ AssertTagStrLen = AsciiStrLen (AssertTagStr);
+ ASSERT (AssertTagStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get ChassisSKUNumber String.
+ //
+ SKUNumberStr = PcdGetPtr (PcdSmbiosType3StringSKUNumber);
+ SKUNumberStrLen = AsciiStrLen (SKUNumberStr);
+ ASSERT (SKUNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Two zeros following the last string.
+ //
+ SourceSize = PcdGetSize(PcdSmbiosType3SystemEnclosureChassis);
+ TotalSize = SourceSize + sizeof(SMBIOS_TABLE_STRING) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + SKUNumberStrLen + 1 + 1;
+ SmbiosRecord = AllocateZeroPool(TotalSize);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE;
+ SmbiosRecord->Hdr.Length = OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements) + sizeof(SMBIOS_TABLE_STRING);
+ if (PcdSmbiosRecord->ContainedElementCount >= 1) {
+ SmbiosRecord->Hdr.Length += PcdSmbiosRecord->ContainedElementCount * PcdSmbiosRecord->ContainedElementRecordLength;
+ }
+ SmbiosRecord->Hdr.Handle = 0;
+
+ if ((PcdSmbiosRecord->ContainedElementCount == 0) || (SourceSize < (UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length)) {
+ SKUNumberPtr = (SMBIOS_TABLE_STRING *)((UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length - sizeof(SMBIOS_TABLE_STRING));
+ *SKUNumberPtr = 5;
+ }
+
+ StringOffset = SmbiosRecord->Hdr.Length;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrLen);
+ StringOffset += ManuStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
+ StringOffset += VerStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumStrLen);
+ StringOffset += SerialNumStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagStrLen);
+ StringOffset += AssertTagStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberStrLen);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md
new file mode 100644
index 0000000000..104cb153a6
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md
@@ -0,0 +1,86 @@
+# Overview
+* **Feature Name:** System Management BIOS (SMBIOS)
+* **PI Phase(s) Supported:** DXE
+* **SMM Required?** No
+
+## Purpose
+*_TODO_*
+Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph.
+
+# High-Level Theory of Operation
+*_TODO_*
+A description of how the device works at a high-level.
+
+The description should not be constrained to implementation details but provide a simple mental model of how the
+feature is supposed to work.
+
+## Firmware Volumes
+*_TODO_*
+A bulleted list of the firmware volumes that feature module(s) are placed in.
+
+## Modules
+*_TODO_*
+A bulleted list of the modules that make up the feature.
+
+## <Module Name>
+*_TODO_*
+Each module in the feature should have a section that describes the module in a level of detail that is useful
+to better understand the module source code.
+
+## <Library Name>
+*_TODO_*
+Each library in the feature should have a section that describes the library in a level of detail that is useful
+to better understand the library source code.
+
+## Key Functions
+*_TODO_*
+A bulleted list of key functions for interacting with the feature.
+
+Not all features need to be listed. Only functions exposed through external interfaces that are important for feature
+users to be aware of.
+
+## Configuration
+*_TODO_*
+Information that is useful for configuring the feature.
+
+Not all configuration options need to be listed. This section is used to provide more background on configuration
+options than possible elsewhere.
+
+## Data Flows
+*_TODO_*
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+*_TODO_*
+Key control flows for the feature.
+
+## Build Flows
+*_TODO_*
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or require non-standard tool configuration. If the
+standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+*_TODO_*
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the feature is successful. If the test point is not
+implemented, this should be stated.
+
+## Functional Exit Criteria
+*_TODO_*
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board integrator can reference to ensure the feature is
+functional on their board.
+
+## Feature Enabling Checklist
+*_TODO_*
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+*_TODO_*
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 21/49] Features/Intel/SmbiosFeaturePkg: Update default strings
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (19 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 20/49] Features/Intel/SmbiosFeaturePkg: Add initial package Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 22/49] DebugFeaturePkg: Remove the ACPI Debug feature Kubacki, Michael A
` (26 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Updates the PCD string default values so they are generic. The
PCDs should be customized by the package that uses the feature.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec | 30 ++++++++++----------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
index c06a87aad0..6170f37969 100644
--- a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
@@ -138,35 +138,35 @@
#
# SMBIOS Type 0 BIOS Information Strings
#
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|"2008-12-23"|VOID*|0xD1000001
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"PURLEY CV/CRB BIOS Internal"|VOID*|0xD1000002
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor|"Intel Corporation"|VOID*|0xD1000003
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|"01/01/2019"|VOID*|0xD1000001
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"1.0"|VOID*|0xD1000002
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor|"BIOS Vendor"|VOID*|0xD1000003
#
# SMBIOS Type 1 System Information Strings
#
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily|"Family"|VOID*|0xD1000004
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer|"Intel Corporation"|VOID*|0xD1000005
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"PURLEY"|VOID*|0xD1000006
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily|"System Family"|VOID*|0xD1000004
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer|"System Manufacturer"|VOID*|0xD1000005
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"System Product Name"|VOID*|0xD1000006
gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber|"UNKNOWN"|VOID*|0xD1000007
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber|"SKU Number"|VOID*|0xD1000008
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion|"1.0"|VOID*|0xD1000009
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber|"System SKU Number"|VOID*|0xD1000008
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion|"System Version"|VOID*|0xD1000009
#
# SMBIOS Type 2 Base Board Information Strings
#
gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag|"Base Board Asset Tag"|VOID*|0xD100000A
gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis|"Part Component"|VOID*|0xD100000B
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer|"Intel Corporation"|VOID*|0xD100000C
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"PURLEY"|VOID*|0xD100000D
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber|"SPRO03200016"|VOID*|0xD100000E
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion|"E63448-400"|VOID*|0xD100000F
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer|"Base Board Manufacturer"|VOID*|0xD100000C
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"Base Board Product Name"|VOID*|0xD100000D
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber|"UNKNOWN"|VOID*|0xD100000E
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion|"Base Board Version"|VOID*|0xD100000F
#
# SMBIOS Type 3 System Enclosure Chassis Strings
#
gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag|"Chassis Asset Tag"|VOID*|0xD1000011
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer|"Intel Corporation"|VOID*|0xD1000012
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer|"Chassis Manufacturer"|VOID*|0xD1000012
gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber|"UNKNOWN"|VOID*|0xD1000013
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber|"SKU Number"|VOID*|0xD1000014
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion|"0.1"|VOID*|0xD1000015
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber|"Chassis SKU Number"|VOID*|0xD1000014
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion|"Chassis Version"|VOID*|0xD1000015
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 22/49] DebugFeaturePkg: Remove the ACPI Debug feature
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (20 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 21/49] Features/Intel/SmbiosFeaturePkg: Update default strings Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 23/49] Features/Intel/AcpiDebugFeaturePkg: Add initial package Kubacki, Michael A
` (25 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Eric Dong, Liming Gao
Removes the S3 feature from DebugFeaturePkg. The feature does
not follow the advanced feature design. A future change will add
the feature back following the advanced feature design.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc | 10 -
Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf | 57 ---
Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf | 59 ---
Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c | 523 --------------------
Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl | 103 ----
Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt | 31 --
6 files changed, 783 deletions(-)
diff --git a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
index efe705bd76..c43dd63a06 100644
--- a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
+++ b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
@@ -71,14 +71,6 @@
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
-[LibraryClasses.common.DXE_SMM_DRIVER]
- #######################################
- # Edk2 Packages
- #######################################
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
- SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
-
###################################################################################################
#
# Components Section - list of the modules and components that will be processed by compilation
@@ -113,8 +105,6 @@
DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf
# Add components here that should be included in the package build.
- DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
- DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
[BuildOptions]
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf b/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
deleted file mode 100644
index 7473126b11..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
+++ /dev/null
@@ -1,57 +0,0 @@
-### @file
-# Component description file for Acpi debug module.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = AcpiDebugDxe
- FILE_GUID = EC98FF95-242C-4513-B1BC-69FA24111C58
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeAcpiDebugDxe
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF
-#
-
-[LibraryClasses]
- BaseLib
- BaseMemoryLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- DebugLib
- PcdLib
- DxeServicesLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- DebugFeaturePkg/DebugFeaturePkg.dec
-
-[Pcd]
- gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable ## CONSUMES
- gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize ## CONSUMES
- gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress ## PRODUCES
-
-[Sources]
- AcpiDebug.c
- AcpiDebug.asl
-
-[Protocols]
- gEfiAcpiTableProtocolGuid ## CONSUMES
- gEfiSmmBase2ProtocolGuid ## CONSUMES # only for SMM version
- gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES # only for SMM version
- gEfiSmmEndOfDxeProtocolGuid ## NOTIFY # only for SMM version
-
-[Guids]
- gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event
-
-[Depex]
- gEfiAcpiTableProtocolGuid
-
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf b/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
deleted file mode 100644
index 679f9eb014..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
+++ /dev/null
@@ -1,59 +0,0 @@
-### @file
-# Component description file for Acpi Debug module.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = AcpiDebugSmm
- FILE_GUID = 9069C144-0A7E-41ef-9C07-418BCA9BF939
- MODULE_TYPE = DXE_SMM_DRIVER
- VERSION_STRING = 1.0
- PI_SPECIFICATION_VERSION = 0x0001000A
- ENTRY_POINT = InitializeAcpiDebugSmm
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF
-#
-
-[LibraryClasses]
- BaseLib
- BaseMemoryLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- DebugLib
- PcdLib
- DxeServicesLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- DebugFeaturePkg/DebugFeaturePkg.dec
-
-[Pcd]
- gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable ## CONSUMES
- gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize ## CONSUMES
- gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress ## PRODUCES
-
-[Sources]
- AcpiDebug.c
- AcpiDebug.asl
-
-[Protocols]
- gEfiAcpiTableProtocolGuid ## CONSUMES
- gEfiSmmBase2ProtocolGuid ## CONSUMES
- gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES
- gEfiSmmEndOfDxeProtocolGuid ## NOTIFY
-
-[Guids]
- gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event # only for DXE version
-
-[Depex]
- gEfiAcpiTableProtocolGuid AND
- gEfiSmmBase2ProtocolGuid AND
- gEfiSmmSwDispatch2ProtocolGuid
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c b/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c
deleted file mode 100644
index f99d80f687..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/** @file
- Acpi Debug driver code.
-
-Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-
-#include <Uefi.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DxeServicesLib.h>
-#include <Protocol/AcpiTable.h>
-#include <IndustryStandard/Acpi.h>
-
-#include <Protocol/SmmBase2.h>
-#include <Protocol/SmmEndOfDxe.h>
-#include <Protocol/SmmSwDispatch2.h>
-
-#define ACPI_DEBUG_STR "INTEL ACPI DEBUG"
-
-//
-// ASL NAME structure
-//
-#pragma pack(1)
-typedef struct {
- UINT8 NameOp; // Byte [0]=0x08:NameOp.
- UINT32 NameString; // Byte [4:1]=Name of object.
- UINT8 DWordPrefix; // Byte [5]=0x0C:DWord Prefix.
- UINT32 Value; // 0 ; Value of named object.
-} NAME_LAYOUT;
-#pragma pack()
-
-#pragma pack(1)
-typedef struct {
- UINT8 Signature[16]; // "INTEL ACPI DEBUG"
- UINT32 BufferSize; // Total size of Acpi Debug buffer including header structure
- UINT32 Head; // Current buffer pointer for SMM to print out
- UINT32 Tail; // Current buffer pointer for ASL to input
- UINT8 SmiTrigger; // Value to trigger the SMI via B2 port
- UINT8 Wrap; // If current Tail < Head
- UINT8 SmmVersion; // If SMM version
- UINT8 Truncate; // If the input from ASL > MAX_BUFFER_SIZE
-} ACPI_DEBUG_HEAD;
-#pragma pack()
-
-#define AD_SIZE sizeof (ACPI_DEBUG_HEAD) // This is 0x20
-
-#define MAX_BUFFER_SIZE 32
-
-UINT32 mBufferEnd = 0;
-ACPI_DEBUG_HEAD *mAcpiDebug = NULL;
-
-EFI_SMM_SYSTEM_TABLE2 *mSmst = NULL;
-
-/**
- Patch and load ACPI table.
-
- @param[in] AcpiDebugAddress Address of Acpi debug memory buffer.
- @param[in] BufferIndex Index that starts after the Acpi Debug head.
- @param[in] BufferEnd End of Acpi debug memory buffer.
-
-**/
-VOID
-PatchAndLoadAcpiTable (
- IN ACPI_DEBUG_HEAD *AcpiDebugAddress,
- IN UINT32 BufferIndex,
- IN UINT32 BufferEnd
- )
-{
- EFI_STATUS Status;
- EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
- UINTN Size;
- EFI_ACPI_DESCRIPTION_HEADER *TableHeader;
- UINTN TableKey;
- UINT8 *CurrPtr;
- UINT32 *Signature;
- NAME_LAYOUT *NamePtr;
- UINT8 UpdateCounter;
-
- Status = GetSectionFromFv (
- &gEfiCallerIdGuid,
- EFI_SECTION_RAW,
- 0,
- (VOID **) &TableHeader,
- &Size
- );
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return;
- }
-
- //
- // This is Acpi Debug SSDT. Acpi Debug should be enabled if we reach here so load the table.
- //
- ASSERT (((EFI_ACPI_DESCRIPTION_HEADER *) TableHeader)->OemTableId == SIGNATURE_64 ('A', 'D', 'e', 'b', 'T', 'a', 'b', 'l'));
-
- //
- // Patch some pointers for the ASL code before loading the SSDT.
- //
-
- //
- // Count pointer updates, so we can stop after all three pointers are patched.
- //
- UpdateCounter = 1;
- for (CurrPtr = (UINT8 *) TableHeader; CurrPtr <= ((UINT8 *) TableHeader + TableHeader->Length) && UpdateCounter < 4; CurrPtr++) {
- Signature = (UINT32 *) (CurrPtr + 1);
- //
- // patch DPTR (address of Acpi debug memory buffer)
- //
- if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('D', 'P', 'T', 'R')) {
- NamePtr = (NAME_LAYOUT *) CurrPtr;
- NamePtr->Value = (UINT32) (UINTN) AcpiDebugAddress;
- UpdateCounter++;
- }
- //
- // patch EPTR (end of Acpi debug memory buffer)
- //
- if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('E', 'P', 'T', 'R')) {
- NamePtr = (NAME_LAYOUT *) CurrPtr;
- NamePtr->Value = BufferEnd;
- UpdateCounter++;
- }
- //
- // patch CPTR (used as an index that starts after the Acpi Debug head)
- //
- if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('C', 'P', 'T', 'R')) {
- NamePtr = (NAME_LAYOUT *) CurrPtr;
- NamePtr->Value = BufferIndex;
- UpdateCounter++;
- }
- }
-
- //
- // Add the table
- //
- Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTable);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- TableKey = 0;
- Status = AcpiTable->InstallAcpiTable (
- AcpiTable,
- TableHeader,
- Size,
- &TableKey
- );
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
-Done:
- gBS->FreePool (TableHeader);
- return ;
-}
-
-/**
- Allocate Acpi Debug memory.
-
- @param[out] BufferSize Pointer to Acpi debug memory buffer size.
-
- @return Address of Acpi debug memory buffer. 0 if PcdAcpiDebugEnable is FALSE.
-
-**/
-EFI_PHYSICAL_ADDRESS
-AllocateAcpiDebugMemory (
- OUT UINT32 *BufferSize
- )
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS AcpiDebugAddress;
- UINTN PagesNum;
-
- AcpiDebugAddress = 0;
- *BufferSize = 0;
-
- if (PcdGetBool (PcdAcpiDebugEnable)) {
- //
- // Reserve memory to store Acpi Debug data.
- //
- AcpiDebugAddress = 0xFFFFFFFF;
- PagesNum = EFI_SIZE_TO_PAGES (PcdGet32 (PcdAcpiDebugBufferSize));
- Status = gBS->AllocatePages (
- AllocateMaxAddress,
- EfiReservedMemoryType,
- PagesNum,
- &AcpiDebugAddress
- );
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return 0;
- }
-
- DEBUG ((DEBUG_INFO, "AcpiDebugAddress - 0x%08x\n", AcpiDebugAddress));
-
- Status = PcdSet32S (PcdAcpiDebugAddress, (UINT32) AcpiDebugAddress);
- ASSERT_EFI_ERROR (Status);
-
- if (EFI_ERROR (Status)) {
- gBS->FreePages (AcpiDebugAddress, PagesNum);
- return 0;
- }
-
- *BufferSize = PcdGet32 (PcdAcpiDebugBufferSize);
- }
-
- return AcpiDebugAddress;
-}
-
-/**
- Acpi Debug EndOfDxe notification.
-
- @param[in] Event Event whose notification function is being invoked.
- @param[in] Context Pointer to the notification function's context.
-
-**/
-VOID
-EFIAPI
-AcpiDebugEndOfDxeNotification (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- UINT32 BufferSize;
- UINT32 BufferIndex;
-
- mAcpiDebug = (ACPI_DEBUG_HEAD *) (UINTN) AllocateAcpiDebugMemory (&BufferSize);
- if (mAcpiDebug != NULL) {
- //
- // Init ACPI DEBUG buffer to lower case 'x'.
- //
- SetMem ((VOID *) mAcpiDebug, BufferSize, 0x78);
-
- //
- // Clear header of AD_SIZE bytes.
- //
- ZeroMem ((VOID *) mAcpiDebug, AD_SIZE);
-
- //
- // Write a signature to the first line of the buffer, "INTEL ACPI DEBUG".
- //
- CopyMem ((VOID *) mAcpiDebug, ACPI_DEBUG_STR, sizeof (ACPI_DEBUG_STR) - 1);
-
- BufferIndex = (UINT32) (UINTN) mAcpiDebug;
- mBufferEnd = BufferIndex + BufferSize;
-
- //
- // Leave the Index after the Acpi Debug head.
- //
- BufferIndex += AD_SIZE;
-
- //
- // Patch and Load the SSDT ACPI Tables.
- //
- PatchAndLoadAcpiTable (mAcpiDebug, BufferIndex, mBufferEnd);
-
- mAcpiDebug->Head = BufferIndex;
- mAcpiDebug->Tail = BufferIndex;
- mAcpiDebug->BufferSize = BufferSize;
- }
-
- //
- // Close event, so it will not be invoked again.
- //
- gBS->CloseEvent (Event);
-
- return ;
-}
-
-/**
- Initialize ACPI Debug.
-
- @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 driver initializes correctly.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeAcpiDebugDxe (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_EVENT EndOfDxeEvent;
-
- //
- // Register EndOfDxe notification
- // that point could ensure the Acpi Debug related PCDs initialized.
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- AcpiDebugEndOfDxeNotification,
- NULL,
- &gEfiEndOfDxeEventGroupGuid,
- &EndOfDxeEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-/**
- Software SMI callback for ACPI Debug which is called from ACPI method.
-
- @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 successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-AcpiDebugSmmCallback (
- IN EFI_HANDLE DispatchHandle,
- IN CONST VOID *Context,
- IN OUT VOID *CommBuffer,
- IN OUT UINTN *CommBufferSize
- )
-{
- UINT8 Buffer[MAX_BUFFER_SIZE];
-
- //
- // Validate the fields in mAcpiDebug to ensure there is no harm to SMI handler.
- // mAcpiDebug is below 4GB and the start address of whole buffer.
- //
- if ((mAcpiDebug->BufferSize != (mBufferEnd - (UINT32) (UINTN) mAcpiDebug)) ||
- (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) ||
- (mAcpiDebug->Head > mBufferEnd) ||
- (mAcpiDebug->Tail < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) ||
- (mAcpiDebug->Tail > mBufferEnd)) {
- //
- // If some fields in mAcpiDebug are invaid, return directly.
- //
- return EFI_SUCCESS;
- }
-
- if (!(BOOLEAN)mAcpiDebug->Wrap && ((mAcpiDebug->Head >= (UINT32) ((UINTN) mAcpiDebug + AD_SIZE))
- && (mAcpiDebug->Head < mAcpiDebug->Tail))){
- //
- // If curent ----- buffer + 020
- // ...
- // ... Head
- // ... Data for SMM print
- // ... Tail
- // ... Vacant for ASL input
- // ----- buffer end
- //
- // skip NULL block
- //
- while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head == '\0') && (mAcpiDebug->Head < mAcpiDebug->Tail)) {
- mAcpiDebug->Head ++;
- }
-
- if (mAcpiDebug->Head < mAcpiDebug->Tail) {
- ZeroMem (Buffer, MAX_BUFFER_SIZE);
- AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *) (UINTN) mAcpiDebug->Head, MAX_BUFFER_SIZE - 1);
-
- DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcpiDebug->Truncate ? "..." : ""));
- mAcpiDebug->Head += MAX_BUFFER_SIZE;
-
- if (mAcpiDebug->Head >= (mAcpiDebug->Tail)) {
- //
- // When head == tail, we do nothing in handler.
- //
- mAcpiDebug->Head = mAcpiDebug->Tail;
- }
- }
- } else if ((BOOLEAN) mAcpiDebug->Wrap && ((mAcpiDebug->Head > mAcpiDebug->Tail)
- && (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)))){
- //
- // If curent ----- buffer + 020
- // ... Tail
- // ... Vacant for ASL input
- // ... Head
- // ... Data for SMM print
- // ----- buffer end
- //
- while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head == '\0') && (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize))) {
- mAcpiDebug->Head ++;
- }
- if (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)){
- ZeroMem (Buffer, MAX_BUFFER_SIZE);
- AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *) (UINTN) mAcpiDebug->Head, MAX_BUFFER_SIZE - 1);
- DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcpiDebug->Truncate ? "..." : ""));
- mAcpiDebug->Head += MAX_BUFFER_SIZE;
-
- if (mAcpiDebug->Head >= (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)) {
- //
- // We met end of buffer.
- //
- mAcpiDebug->Wrap = 0;
- mAcpiDebug->Head = (UINT32) ((UINTN) mAcpiDebug + AD_SIZE);
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Acpi Debug SmmEndOfDxe notification.
-
- @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 runs successfully.
-
- **/
-EFI_STATUS
-EFIAPI
-AcpiDebugSmmEndOfDxeNotification (
- IN CONST EFI_GUID *Protocol,
- IN VOID *Interface,
- IN EFI_HANDLE Handle
- )
-{
- EFI_STATUS Status;
- EFI_SMM_SW_DISPATCH2_PROTOCOL *SwDispatch;
- EFI_SMM_SW_REGISTER_CONTEXT SwContext;
- EFI_HANDLE SwHandle;
-
- AcpiDebugEndOfDxeNotification (NULL, NULL);
-
- if (mAcpiDebug != NULL) {
- //
- // Get the Sw dispatch protocol and register SMI callback function.
- //
- SwDispatch = NULL;
- Status = mSmst->SmmLocateProtocol (&gEfiSmmSwDispatch2ProtocolGuid, NULL, (VOID **) &SwDispatch);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- SwContext.SwSmiInputValue = (UINTN) -1;
- Status = SwDispatch->Register (SwDispatch, AcpiDebugSmmCallback, &SwContext, &SwHandle);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- mAcpiDebug->SmiTrigger = (UINT8) SwContext.SwSmiInputValue;
- mAcpiDebug->SmmVersion = 1;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Initialize ACPI Debug.
-
- @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 driver initializes correctly.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeAcpiDebugSmm (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- VOID *Registration;
- EFI_SMM_BASE2_PROTOCOL *SmmBase2;
- BOOLEAN InSmm;
-
- Status = gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID **) &SmmBase2);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = SmmBase2->InSmm (SmmBase2, &InSmm);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ASSERT (InSmm);
-
- if (!InSmm) {
- return EFI_UNSUPPORTED;
- }
-
- Status = SmmBase2->GetSmstLocation (SmmBase2, &mSmst);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Register SmmEndOfDxe notification
- // that point could ensure the Acpi Debug related PCDs initialized.
- //
- Registration = NULL;
- Status = mSmst->SmmRegisterProtocolNotify (
- &gEfiSmmEndOfDxeProtocolGuid,
- AcpiDebugSmmEndOfDxeNotification,
- &Registration
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl b/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl
deleted file mode 100644
index cbfe085b56..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl
+++ /dev/null
@@ -1,103 +0,0 @@
-/** @file
- Acpi Debug ASL code.
-
-Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-DefinitionBlock (
- "AcpiDebug.aml",
- "SSDT",
- 2,
- "Intel ",
- "ADebTabl",
- 0x1000
- )
-{
- Scope(\)
- {
- //
- // These pointers are patched during POST.
- //
- Name (DPTR, 0x80000000) // Address of Acpi debug memory buffer, fixed up during POST
- Name (EPTR, 0x80000000) // End of Acpi debug memory buffer, fixed up during POST
- Name (CPTR, 0x80000000) // Current pointer used as an index into the buffer(starts after the Acpi Debug head), fixed up during POST
-
- //
- // Use a Mutex to prevent multiple calls from simutaneously writing to the same memory.
- //
- Mutex (MMUT, 0)
-
- //
- // Operational region for SMI port access
- //
- OperationRegion (ADBP, SystemIO, 0xB2, 2)
- Field (ADBP, ByteAcc, NoLock, Preserve)
- {
- B2PT, 8,
- B3PT, 8,
- }
-
- //
- // Write a string to a memory buffer
- //
- Method (MDBG, 1, Serialized)
- {
- OperationRegion (ADHD, SystemMemory, DPTR, 32) // Operation region for Acpi Debug buffer first 0x20 bytes
- Field (ADHD, ByteAcc, NoLock, Preserve)
- {
- Offset (0x0),
- ASIG, 128, // 16 bytes is Signature
- Offset (0x10),
- ASIZ, 32, // 4 bytes is buffer size
- ACHP, 32, // 4 bytes is current head pointer, normally is DPTR + 0x20,
- // if there's SMM handler to print, then it's the starting of the info hasn't been printed yet.
- ACTP, 32, // 4 bytes is current tail pointer, is the same as CPTR
- SMIN, 8, // 1 byte of SMI Number for trigger callback
- WRAP, 8, // 1 byte of wrap status
- SMMV, 8, // 1 byte of SMM version status
- TRUN, 8 // 1 byte of truncate status
- }
-
- Store (Acquire (MMUT, 1000), Local0) // save Acquire result so we can check for Mutex acquired
- If (LEqual (Local0, Zero)) // check for Mutex acquired
- {
- OperationRegion (ABLK, SystemMemory, CPTR, 32) // Operation region to allow writes to ACPI debug buffer
- Field (ABLK, ByteAcc, NoLock, Preserve)
- {
- Offset (0x0),
- AAAA, 256 // 32 bytes is max size for string or data
- }
- ToHexString (Arg0, Local1) // convert argument to Hexadecimal String
- Store (0, TRUN)
- If (LGreaterEqual (SizeOf (Local1), 32))
- {
- Store (1, TRUN) // the input from ASL >= 32
- }
- Mid (Local1, 0, 31, AAAA) // extract the input to current buffer
-
- Add (CPTR, 32, CPTR) // advance current pointer to next string location in memory buffer
- If (LGreaterEqual (CPTR, EPTR) ) // check for end of 64kb Acpi debug buffer
- {
- Add (DPTR, 32, CPTR) // wrap around to beginning of buffer if the end has been reached
- Store (1, WRAP)
- }
- Store (CPTR, ACTP)
-
- If (SMMV)
- {
- //
- // Trigger the SMI to print
- //
- Store (SMIN, B2PT)
- }
- Release (MMUT)
- }
-
- Return (Local0) // return error code indicating whether Mutex was acquired
- }
-
- } // End Scope
-} // End SSDT
-
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt b/Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt
deleted file mode 100644
index 71284ec77f..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-ACPI Debug feature - an alternative to Port 80 and WinDBG
-
-How it works:
- Acpi Debug does this:
- Opens a 64kb memory buffer during POST.
- Patches the buffer address in SSDT ASL code.
- Save the address in gAdvancedFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress for user reference.
- Write strings or numbers to the buffer from ASL code with the ADBG method.
-
-How to use it:
- 1. Enable it by set gAdvancedFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable to TRUE.
- 2. The ACPI ASL code must be instrumented with the debug method.
- Strings up to 32 characters (shorter strings will be padded with Zero's, longer strings will be truncated)
- Examples:
- ADBG("This is a test.")
- ADBG(Arg0)
-
- DXE version: The bios engineer will read the strings from the buffer on the target machine with read/write memory utility.
- SMM version: Check debug serial that would show debug strings.
-
- Sample code for ADBG:
- External (MDBG, MethodObj)
- Method (ADBG, 1, Serialized)
- {
- If (CondRefOf (MDBG)) // Check if ACPI Debug SSDT is loaded
- {
- Return (MDBG (Arg0))
- }
- Return (0)
- }
-
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 23/49] Features/Intel/AcpiDebugFeaturePkg: Add initial package
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (21 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 22/49] DebugFeaturePkg: Remove the ACPI Debug feature Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 25/49] Features/Intel/Usb3DebugFeaturePkg: " Kubacki, Michael A
` (24 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Eric Dong, Liming Gao
Adds a new feature package for the ACPI Debug feature.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec | 39 ++
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc | 30 ++
Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeature.dsc | 125 +++++
Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf | 11 +
Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugDxe.inf | 55 +++
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugSmm.inf | 58 +++
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.c | 519 ++++++++++++++++++++
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.asl | 102 ++++
Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md | 121 +++++
10 files changed, 1068 insertions(+)
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
new file mode 100644
index 0000000000..a74ee3e084
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
@@ -0,0 +1,39 @@
+## @file
+# This package provides advanced feature functionality for ACPI Debug support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = AcpiDebugFeaturePkg
+ PACKAGE_GUID = 53E3E908-5DF9-4137-ABB9-6DE162C3898F
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[LibraryClasses]
+
+[Guids]
+ gAcpiDebugFeaturePkgTokenSpaceGuid = {0xaf2582c0, 0x93fe, 0x466d, {0xb6, 0xa4, 0x4d, 0x23, 0x77, 0xf7, 0x82, 0xa7}}
+
+[PcdsFeatureFlag]
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable|FALSE|BOOLEAN|0xA0000001
+
+[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx]
+ ## This PCD specifies the ACPI debug message buffer size.
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize|0x10000|UINT32|0xF0000001
+
+[PcdsDynamic, PcdsDynamicEx]
+ ## This PCD specifies ACPI debug message buffer address.
+ # The PCD value will be updated during boot time when the buffer is allocated.
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress|0|UINT32|0xD0000001
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc
new file mode 100644
index 0000000000..62cc559d8f
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for ACPI Debug support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ PLATFORM_NAME = AcpiDebugFeaturePkg
+ PLATFORM_GUID = F3001DF1-4A5B-42A9-944B-E766BDDC7B99
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#
+# This package always builds the feature.
+#
+!include Include/AcpiDebugFeature.dsc
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeature.dsc b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeature.dsc
new file mode 100644
index 0000000000..3e6b1f69c2
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeature.dsc
@@ -0,0 +1,125 @@
+## @file
+# This is a build description file for the ACPI Debug advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+################################################################################
+[LibraryClasses]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+
+[LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+
+[LibraryClasses.common.DXE_SMM_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
+ SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
+
+################################################################################
+#
+# Component section - list of all components that need built for this feature.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+################################################################################
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # ACPI Debug Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
+ #####################################
+ # ACPI Debug Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+ Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugDxe.inf
+ Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugSmm.inf
+
+###################################################################################################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
+###################################################################################################
+[BuildOptions]
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..ae90238bed
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,11 @@
+## @file
+# FDF file for post-memory ACPI Debug advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+ INF Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugDxe.inf
+ INF Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugSmm.inf
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..3100daee71
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory ACPI Debug advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugDxe.inf b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugDxe.inf
new file mode 100644
index 0000000000..dfcee0a842
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugDxe.inf
@@ -0,0 +1,55 @@
+### @file
+# Component description file for the ACPI Debug DXE module.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = AcpiDebugDxe
+ FILE_GUID = EC98FF95-242C-4513-B1BC-69FA24111C58
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializeAcpiDebugDxe
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[LibraryClasses]
+ BaseLib
+ BaseMemoryLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ DebugLib
+ PcdLib
+ DxeServicesLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
+
+[Pcd]
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize ## CONSUMES
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress ## PRODUCES
+
+[Sources]
+ AcpiDebug.c
+ AcpiDebug.asl
+
+[Protocols]
+ gEfiAcpiTableProtocolGuid ## CONSUMES
+ gEfiSmmBase2ProtocolGuid ## CONSUMES # only for SMM version
+ gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES # only for SMM version
+ gEfiSmmEndOfDxeProtocolGuid ## NOTIFY # only for SMM version
+
+[Guids]
+ gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event
+
+[Depex]
+ gEfiAcpiTableProtocolGuid
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugSmm.inf b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugSmm.inf
new file mode 100644
index 0000000000..089bb57707
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugSmm.inf
@@ -0,0 +1,58 @@
+### @file
+# Component description file for Acpi Debug SMM module.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = AcpiDebugSmm
+ FILE_GUID = 9069C144-0A7E-41EF-9C07-418BCA9BF939
+ MODULE_TYPE = DXE_SMM_DRIVER
+ VERSION_STRING = 1.0
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ ENTRY_POINT = InitializeAcpiDebugSmm
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[LibraryClasses]
+ BaseLib
+ BaseMemoryLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ DebugLib
+ PcdLib
+ DxeServicesLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
+
+[Pcd]
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize ## CONSUMES
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress ## PRODUCES
+
+[Sources]
+ AcpiDebug.c
+ AcpiDebug.asl
+
+[Protocols]
+ gEfiAcpiTableProtocolGuid ## CONSUMES
+ gEfiSmmBase2ProtocolGuid ## CONSUMES
+ gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES
+ gEfiSmmEndOfDxeProtocolGuid ## NOTIFY
+
+[Guids]
+ gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event # only for DXE version
+
+[Depex]
+ gEfiAcpiTableProtocolGuid AND
+ gEfiSmmBase2ProtocolGuid AND
+ gEfiSmmSwDispatch2ProtocolGuid
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.c b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.c
new file mode 100644
index 0000000000..42428d8005
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.c
@@ -0,0 +1,519 @@
+/** @file
+ ACPI Debug feature driver implementation.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
+#include <Library/DxeServicesLib.h>
+#include <Protocol/AcpiTable.h>
+#include <IndustryStandard/Acpi.h>
+
+#include <Protocol/SmmBase2.h>
+#include <Protocol/SmmEndOfDxe.h>
+#include <Protocol/SmmSwDispatch2.h>
+
+#define ACPI_DEBUG_STR "INTEL ACPI DEBUG"
+
+//
+// ASL NAME structure
+//
+#pragma pack(1)
+typedef struct {
+ UINT8 NameOp; // Byte [0]=0x08:NameOp.
+ UINT32 NameString; // Byte [4:1]=Name of object.
+ UINT8 DWordPrefix; // Byte [5]=0x0C:DWord Prefix.
+ UINT32 Value; // 0 ; Value of named object.
+} NAME_LAYOUT;
+#pragma pack()
+
+#pragma pack(1)
+typedef struct {
+ UINT8 Signature[16]; // "INTEL ACPI DEBUG"
+ UINT32 BufferSize; // Total size of Acpi Debug buffer including header structure
+ UINT32 Head; // Current buffer pointer for SMM to print out
+ UINT32 Tail; // Current buffer pointer for ASL to input
+ UINT8 SmiTrigger; // Value to trigger the SMI via B2 port
+ UINT8 Wrap; // If current Tail < Head
+ UINT8 SmmVersion; // If SMM version
+ UINT8 Truncate; // If the input from ASL > MAX_BUFFER_SIZE
+} ACPI_DEBUG_HEAD;
+#pragma pack()
+
+#define AD_SIZE sizeof (ACPI_DEBUG_HEAD) // This is 0x20
+
+#define MAX_BUFFER_SIZE 32
+
+UINT32 mBufferEnd = 0;
+ACPI_DEBUG_HEAD *mAcpiDebug = NULL;
+
+EFI_SMM_SYSTEM_TABLE2 *mSmst = NULL;
+
+/**
+ Patch and load ACPI table.
+
+ @param[in] AcpiDebugAddress Address of Acpi debug memory buffer.
+ @param[in] BufferIndex Index that starts after the Acpi Debug head.
+ @param[in] BufferEnd End of Acpi debug memory buffer.
+
+**/
+VOID
+PatchAndLoadAcpiTable (
+ IN ACPI_DEBUG_HEAD *AcpiDebugAddress,
+ IN UINT32 BufferIndex,
+ IN UINT32 BufferEnd
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ UINTN Size;
+ EFI_ACPI_DESCRIPTION_HEADER *TableHeader;
+ UINTN TableKey;
+ UINT8 *CurrPtr;
+ UINT32 *Signature;
+ NAME_LAYOUT *NamePtr;
+ UINT8 UpdateCounter;
+
+ Status = GetSectionFromFv (
+ &gEfiCallerIdGuid,
+ EFI_SECTION_RAW,
+ 0,
+ (VOID **) &TableHeader,
+ &Size
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ //
+ // This is Acpi Debug SSDT. Acpi Debug should be enabled if we reach here so load the table.
+ //
+ ASSERT (((EFI_ACPI_DESCRIPTION_HEADER *) TableHeader)->OemTableId == SIGNATURE_64 ('A', 'D', 'e', 'b', 'T', 'a', 'b', 'l'));
+
+ //
+ // Patch some pointers for the ASL code before loading the SSDT.
+ //
+
+ //
+ // Count pointer updates, so we can stop after all three pointers are patched.
+ //
+ UpdateCounter = 1;
+ for (CurrPtr = (UINT8 *) TableHeader; CurrPtr <= ((UINT8 *) TableHeader + TableHeader->Length) && UpdateCounter < 4; CurrPtr++) {
+ Signature = (UINT32 *) (CurrPtr + 1);
+ //
+ // patch DPTR (address of Acpi debug memory buffer)
+ //
+ if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('D', 'P', 'T', 'R')) {
+ NamePtr = (NAME_LAYOUT *) CurrPtr;
+ NamePtr->Value = (UINT32) (UINTN) AcpiDebugAddress;
+ UpdateCounter++;
+ }
+ //
+ // patch EPTR (end of Acpi debug memory buffer)
+ //
+ if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('E', 'P', 'T', 'R')) {
+ NamePtr = (NAME_LAYOUT *) CurrPtr;
+ NamePtr->Value = BufferEnd;
+ UpdateCounter++;
+ }
+ //
+ // patch CPTR (used as an index that starts after the Acpi Debug head)
+ //
+ if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('C', 'P', 'T', 'R')) {
+ NamePtr = (NAME_LAYOUT *) CurrPtr;
+ NamePtr->Value = BufferIndex;
+ UpdateCounter++;
+ }
+ }
+
+ //
+ // Add the table
+ //
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTable);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+ TableKey = 0;
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ TableHeader,
+ Size,
+ &TableKey
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+Done:
+ gBS->FreePool (TableHeader);
+ return ;
+}
+
+/**
+ Allocate Acpi Debug memory.
+
+ @param[out] BufferSize Pointer to Acpi debug memory buffer size.
+
+ @return Address of Acpi debug memory buffer.
+
+**/
+EFI_PHYSICAL_ADDRESS
+AllocateAcpiDebugMemory (
+ OUT UINT32 *BufferSize
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS AcpiDebugAddress;
+ UINTN PagesNum;
+
+ AcpiDebugAddress = 0;
+ *BufferSize = 0;
+
+ //
+ // Reserve memory to store Acpi Debug data.
+ //
+ AcpiDebugAddress = 0xFFFFFFFF;
+ PagesNum = EFI_SIZE_TO_PAGES (PcdGet32 (PcdAcpiDebugBufferSize));
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiReservedMemoryType,
+ PagesNum,
+ &AcpiDebugAddress
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return 0;
+ }
+
+ DEBUG ((DEBUG_INFO, "AcpiDebugAddress - 0x%08x\n", AcpiDebugAddress));
+
+ Status = PcdSet32S (PcdAcpiDebugAddress, (UINT32) AcpiDebugAddress);
+ ASSERT_EFI_ERROR (Status);
+
+ if (EFI_ERROR (Status)) {
+ gBS->FreePages (AcpiDebugAddress, PagesNum);
+ return 0;
+ }
+
+ *BufferSize = PcdGet32 (PcdAcpiDebugBufferSize);
+
+ return AcpiDebugAddress;
+}
+
+/**
+ Acpi Debug EndOfDxe notification.
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context Pointer to the notification function's context.
+
+**/
+VOID
+EFIAPI
+AcpiDebugEndOfDxeNotification (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ UINT32 BufferSize;
+ UINT32 BufferIndex;
+
+ mAcpiDebug = (ACPI_DEBUG_HEAD *) (UINTN) AllocateAcpiDebugMemory (&BufferSize);
+ if (mAcpiDebug != NULL) {
+ //
+ // Init ACPI DEBUG buffer to lower case 'x'.
+ //
+ SetMem ((VOID *) mAcpiDebug, BufferSize, 0x78);
+
+ //
+ // Clear header of AD_SIZE bytes.
+ //
+ ZeroMem ((VOID *) mAcpiDebug, AD_SIZE);
+
+ //
+ // Write a signature to the first line of the buffer, "INTEL ACPI DEBUG".
+ //
+ CopyMem ((VOID *) mAcpiDebug, ACPI_DEBUG_STR, sizeof (ACPI_DEBUG_STR) - 1);
+
+ BufferIndex = (UINT32) (UINTN) mAcpiDebug;
+ mBufferEnd = BufferIndex + BufferSize;
+
+ //
+ // Leave the Index after the Acpi Debug head.
+ //
+ BufferIndex += AD_SIZE;
+
+ //
+ // Patch and Load the SSDT ACPI Tables.
+ //
+ PatchAndLoadAcpiTable (mAcpiDebug, BufferIndex, mBufferEnd);
+
+ mAcpiDebug->Head = BufferIndex;
+ mAcpiDebug->Tail = BufferIndex;
+ mAcpiDebug->BufferSize = BufferSize;
+ }
+
+ //
+ // Close event, so it will not be invoked again.
+ //
+ gBS->CloseEvent (Event);
+
+ return ;
+}
+
+/**
+ Initialize ACPI Debug.
+
+ @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 driver initializes correctly.
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeAcpiDebugDxe (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_EVENT EndOfDxeEvent;
+
+ //
+ // Register EndOfDxe notification
+ // that point could ensure the Acpi Debug related PCDs initialized.
+ //
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ AcpiDebugEndOfDxeNotification,
+ NULL,
+ &gEfiEndOfDxeEventGroupGuid,
+ &EndOfDxeEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+/**
+ Software SMI callback for ACPI Debug which is called from ACPI method.
+
+ @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 successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+AcpiDebugSmmCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN CONST VOID *Context,
+ IN OUT VOID *CommBuffer,
+ IN OUT UINTN *CommBufferSize
+ )
+{
+ UINT8 Buffer[MAX_BUFFER_SIZE];
+
+ //
+ // Validate the fields in mAcpiDebug to ensure there is no harm to SMI handler.
+ // mAcpiDebug is below 4GB and the start address of whole buffer.
+ //
+ if ((mAcpiDebug->BufferSize != (mBufferEnd - (UINT32) (UINTN) mAcpiDebug)) ||
+ (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) ||
+ (mAcpiDebug->Head > mBufferEnd) ||
+ (mAcpiDebug->Tail < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) ||
+ (mAcpiDebug->Tail > mBufferEnd)) {
+ //
+ // If some fields in mAcpiDebug are invaid, return directly.
+ //
+ return EFI_SUCCESS;
+ }
+
+ if (!(BOOLEAN)mAcpiDebug->Wrap && ((mAcpiDebug->Head >= (UINT32) ((UINTN) mAcpiDebug + AD_SIZE))
+ && (mAcpiDebug->Head < mAcpiDebug->Tail))){
+ //
+ // If curent ----- buffer + 020
+ // ...
+ // ... Head
+ // ... Data for SMM print
+ // ... Tail
+ // ... Vacant for ASL input
+ // ----- buffer end
+ //
+ // skip NULL block
+ //
+ while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head == '\0') && (mAcpiDebug->Head < mAcpiDebug->Tail)) {
+ mAcpiDebug->Head ++;
+ }
+
+ if (mAcpiDebug->Head < mAcpiDebug->Tail) {
+ ZeroMem (Buffer, MAX_BUFFER_SIZE);
+ AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *) (UINTN) mAcpiDebug->Head, MAX_BUFFER_SIZE - 1);
+
+ DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcpiDebug->Truncate ? "..." : ""));
+ mAcpiDebug->Head += MAX_BUFFER_SIZE;
+
+ if (mAcpiDebug->Head >= (mAcpiDebug->Tail)) {
+ //
+ // When head == tail, we do nothing in handler.
+ //
+ mAcpiDebug->Head = mAcpiDebug->Tail;
+ }
+ }
+ } else if ((BOOLEAN) mAcpiDebug->Wrap && ((mAcpiDebug->Head > mAcpiDebug->Tail)
+ && (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)))){
+ //
+ // If curent ----- buffer + 020
+ // ... Tail
+ // ... Vacant for ASL input
+ // ... Head
+ // ... Data for SMM print
+ // ----- buffer end
+ //
+ while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head == '\0') && (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize))) {
+ mAcpiDebug->Head ++;
+ }
+ if (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)){
+ ZeroMem (Buffer, MAX_BUFFER_SIZE);
+ AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *) (UINTN) mAcpiDebug->Head, MAX_BUFFER_SIZE - 1);
+ DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcpiDebug->Truncate ? "..." : ""));
+ mAcpiDebug->Head += MAX_BUFFER_SIZE;
+
+ if (mAcpiDebug->Head >= (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)) {
+ //
+ // We met end of buffer.
+ //
+ mAcpiDebug->Wrap = 0;
+ mAcpiDebug->Head = (UINT32) ((UINTN) mAcpiDebug + AD_SIZE);
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Acpi Debug SmmEndOfDxe notification.
+
+ @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 runs successfully.
+
+ **/
+EFI_STATUS
+EFIAPI
+AcpiDebugSmmEndOfDxeNotification (
+ IN CONST EFI_GUID *Protocol,
+ IN VOID *Interface,
+ IN EFI_HANDLE Handle
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMM_SW_DISPATCH2_PROTOCOL *SwDispatch;
+ EFI_SMM_SW_REGISTER_CONTEXT SwContext;
+ EFI_HANDLE SwHandle;
+
+ AcpiDebugEndOfDxeNotification (NULL, NULL);
+
+ if (mAcpiDebug != NULL) {
+ //
+ // Get the Sw dispatch protocol and register SMI callback function.
+ //
+ SwDispatch = NULL;
+ Status = mSmst->SmmLocateProtocol (&gEfiSmmSwDispatch2ProtocolGuid, NULL, (VOID **) &SwDispatch);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ SwContext.SwSmiInputValue = (UINTN) -1;
+ Status = SwDispatch->Register (SwDispatch, AcpiDebugSmmCallback, &SwContext, &SwHandle);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ mAcpiDebug->SmiTrigger = (UINT8) SwContext.SwSmiInputValue;
+ mAcpiDebug->SmmVersion = 1;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize ACPI Debug.
+
+ @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 driver initializes correctly.
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeAcpiDebugSmm (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ VOID *Registration;
+ EFI_SMM_BASE2_PROTOCOL *SmmBase2;
+ BOOLEAN InSmm;
+
+ Status = gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID **) &SmmBase2);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = SmmBase2->InSmm (SmmBase2, &InSmm);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ASSERT (InSmm);
+
+ if (!InSmm) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = SmmBase2->GetSmstLocation (SmmBase2, &mSmst);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Register SmmEndOfDxe notification
+ // that point could ensure the Acpi Debug related PCDs initialized.
+ //
+ Registration = NULL;
+ Status = mSmst->SmmRegisterProtocolNotify (
+ &gEfiSmmEndOfDxeProtocolGuid,
+ AcpiDebugSmmEndOfDxeNotification,
+ &Registration
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.asl b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.asl
new file mode 100644
index 0000000000..3504c2d6ea
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.asl
@@ -0,0 +1,102 @@
+/** @file
+ SSDT for the ACPI Debug feature.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+DefinitionBlock (
+ "AcpiDebug.aml",
+ "SSDT",
+ 2,
+ "Intel ",
+ "ADebTabl",
+ 0x1000
+ )
+{
+ Scope(\)
+ {
+ //
+ // These pointers are patched during POST.
+ //
+ Name (DPTR, 0x80000000) // Address of Acpi debug memory buffer, fixed up during POST
+ Name (EPTR, 0x80000000) // End of Acpi debug memory buffer, fixed up during POST
+ Name (CPTR, 0x80000000) // Current pointer used as an index into the buffer(starts after the Acpi Debug head), fixed up during POST
+
+ //
+ // Use a Mutex to prevent multiple calls from simutaneously writing to the same memory.
+ //
+ Mutex (MMUT, 0)
+
+ //
+ // Operational region for SMI port access
+ //
+ OperationRegion (ADBP, SystemIO, 0xB2, 2)
+ Field (ADBP, ByteAcc, NoLock, Preserve)
+ {
+ B2PT, 8,
+ B3PT, 8,
+ }
+
+ //
+ // Write a string to a memory buffer
+ //
+ Method (MDBG, 1, Serialized)
+ {
+ OperationRegion (ADHD, SystemMemory, DPTR, 32) // Operation region for Acpi Debug buffer first 0x20 bytes
+ Field (ADHD, ByteAcc, NoLock, Preserve)
+ {
+ Offset (0x0),
+ ASIG, 128, // 16 bytes is Signature
+ Offset (0x10),
+ ASIZ, 32, // 4 bytes is buffer size
+ ACHP, 32, // 4 bytes is current head pointer, normally is DPTR + 0x20,
+ // if there's SMM handler to print, then it's the starting of the info hasn't been printed yet.
+ ACTP, 32, // 4 bytes is current tail pointer, is the same as CPTR
+ SMIN, 8, // 1 byte of SMI Number for trigger callback
+ WRAP, 8, // 1 byte of wrap status
+ SMMV, 8, // 1 byte of SMM version status
+ TRUN, 8 // 1 byte of truncate status
+ }
+
+ Store (Acquire (MMUT, 1000), Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual (Local0, Zero)) // check for Mutex acquired
+ {
+ OperationRegion (ABLK, SystemMemory, CPTR, 32) // Operation region to allow writes to ACPI debug buffer
+ Field (ABLK, ByteAcc, NoLock, Preserve)
+ {
+ Offset (0x0),
+ AAAA, 256 // 32 bytes is max size for string or data
+ }
+ ToHexString (Arg0, Local1) // convert argument to Hexadecimal String
+ Store (0, TRUN)
+ If (LGreaterEqual (SizeOf (Local1), 32))
+ {
+ Store (1, TRUN) // the input from ASL >= 32
+ }
+ Mid (Local1, 0, 31, AAAA) // extract the input to current buffer
+
+ Add (CPTR, 32, CPTR) // advance current pointer to next string location in memory buffer
+ If (LGreaterEqual (CPTR, EPTR) ) // check for end of 64kb Acpi debug buffer
+ {
+ Add (DPTR, 32, CPTR) // wrap around to beginning of buffer if the end has been reached
+ Store (1, WRAP)
+ }
+ Store (CPTR, ACTP)
+
+ If (SMMV)
+ {
+ //
+ // Trigger the SMI to print
+ //
+ Store (SMIN, B2PT)
+ }
+ Release (MMUT)
+ }
+
+ Return (Local0) // return error code indicating whether Mutex was acquired
+ }
+
+ } // End Scope
+} // End SSDT
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md
new file mode 100644
index 0000000000..bc0dce9348
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md
@@ -0,0 +1,121 @@
+# Overview
+* **Feature Name:** ACPI Debug
+* **PI Phase(s) Supported:** DXE and SMM
+* **SMM Required?** No
+
+## Purpose
+This feature is an alternative ACPI debug mechanism to port 0x80 or a kernel debugger such as WinDBG.
+
+**_DO NOT_** use this feature in a production system. It may not handle SMM memory buffers or data input/output
+from SMM in a safe manner.
+
+# High-Level Theory of Operation
+There are two driver modes:
+ 1. DXE - ACPI debug messages should be manually read from a memory buffer on the target machine using a utility
+ that has the ability to read main memory.
+ 2. SMM - ACPI debug messages should be read from the firmware debug message output port.
+
+The DXE driver is required and the SMM driver is optional. The SMM driver eases retrieval of the ACPI debug messages
+from a message ring buffer in memory by sending the messages over the SMM debug mechanism. ASL code writes messages up
+to 32 characters in length (shorter strings will be padded with zeroes and longer strings will be truncated) to an
+ASL debug method.
+
+## Firmware Volumes
+* FvAdvancedPostMemory
+
+## Modules
+* AcpiDebugDxe
+* AcpiDebugSmm
+
+## AcpiDebugDxe
+The entry point registers an end of DXE notification. Further action is deferred until end of DXE to allow the
+feature PCDs to be customized at boot time in DXE if desired. The notification handler allocates a `EfiReservedMemoryType`
+buffer (memory not available to the operating system) of the size specified in `PcdAcpiDebugBufferSize`. The actual
+buffer size is allocated on a page boundary of size `EFI_PAGE_SIZE`. The allocated buffer address is written out
+as a debug message `AcpiDebugAddress - 0xXXXXXXXX`. In addition, the address is written to `PcdAcpiDebugAddress`
+and the actual allocation size is written to `PcdAcpiDebugBufferSize`.
+
+To expose the ACPI debug buffer to ASL code, an ACPI debug SSDT (defined in `AcpiDebug.asl`) is installed. The pointer
+fields in the SSDT are patched by `AcpiDebugDxe` to the actual buffer address. The SSDT is installed using the
+`EFI_ACPI_TABLE_PROTOCOL`.
+
+## AcpiDebugSmm
+The entry point registers an end of DXE notification. Further action is deferred until end of DXE to allow the
+feature PCDs to be customized at boot time if desired. The notification handler registers a SW SMI that can be
+triggered in ACPI debug SSDT to invoke the SMI handler `AcpiDebugSmmCallback ()`. The SMI handler retrieves the debug
+message from the buffer at `PcdAcpiDebugAddress` and sends it to the `DEBUG` function for the given SMM `DebugLib`
+instance assigned to `AcpiDebugSmm`.
+
+## Key Functions
+* `MDBG` _(ASL method)_
+
+ This method is given a single argument with a number or string to write
+ to the ACPI memory debug buffer. If AcpiDebugSmm is used, an SMI will
+ be used to send the message as a DEBUG message.
+
+ It is recommended to instrument the ASL code with a method called `ADBG`. An ASL caller sends a debug
+ message as follows:
+
+ ```
+ ADBG("This is a test.")
+ ADBG(Arg0)
+ ```
+
+* `ADBG` _(ASL method)_ is intended to be a wrapper of `MDBG` that allows the `ADBG` references to remain in the ASL code even if
+ the ACPI debug advanced feature is disabled. Below is a code snippet with a sample implementation for `ADBG`.
+
+ ```
+ External (MDBG, MethodObj)
+ Method (ADBG, 1, Serialized)
+ {
+ If (CondRefOf (MDBG)) // Check if ACPI Debug SSDT is loaded
+ {
+ Return (MDBG (Arg0))
+ }
+ Return (0)
+ }
+ ```
+
+## Configuration
+* PcdAcpiDebugEnable - Enables this feature.
+* PcdAcpiDebugAddress - The address of the ACPI debug message buffer.
+* PcdAcpiDebugBufferSize - The size of the ACPI debug message buffer.
+
+## Data Flows
+*_TODO_*
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+*_TODO_*
+Key control flows for the feature.
+
+## Build Flows
+*_TODO_*
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or require non-standard tool configuration. If the
+standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+*_TODO_*
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the feature is successful. If the test point is not
+implemented, this should be stated.
+
+## Functional Exit Criteria
+*_TODO_*
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board integrator can reference to ensure the feature is
+functional on their board.
+
+## Feature Enabling Checklist
+*_TODO_*
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+*_TODO_*
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 25/49] Features/Intel/Usb3DebugFeaturePkg: Add initial package
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (22 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 23/49] Features/Intel/AcpiDebugFeaturePkg: Add initial package Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 26/49] UserInterfaceFeaturePkg: Remove the User Authentication feature Kubacki, Michael A
` (23 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Eric Dong, Liming Gao
Adds a new feature package for the USB3 Debug feature.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec | 57 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc | 149 ++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dsc | 30 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf | 8 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf | 55 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf | 63 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf | 27 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf | 48 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf | 51 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf | 31 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h | 71 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortParamLib.h | 56 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h | 887 +++++++++++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c | 385 +++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c | 892 ++++++++++++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c | 726 ++++++++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c | 454 ++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c | 828 ++++++++++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c | 103 +++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c | 236 ++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c | 440 ++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.c | 58 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md | 86 ++
24 files changed, 5749 insertions(+)
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
new file mode 100644
index 0000000000..2b19e48491
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
@@ -0,0 +1,57 @@
+## @file
+# This package provides advanced feature functionality for USB3 Debug support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = Usb3DebugFeaturePkg
+ PACKAGE_GUID = A96B06AE-5C10-4226-9B22-259AFCBB6119
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[LibraryClasses]
+ ## @libraryclass Provides the capability to get/set USB3 debug port parameters.
+ Usb3DebugPortParamLib|Include/Library/Usb3DebugPortParamLib.h
+
+ ## @libraryclass Provide common USB3 debug port functions.
+ Usb3DebugPortLib|Include/Library/Usb3DebugPortLib.h
+
+[Guids]
+ gUsb3DebugFeaturePkgTokenSpaceGuid = {0x1cbca3b0, 0x780c, 0x47d0, {0x8a, 0x46, 0xfe, 0x10, 0x77, 0x64, 0xe8, 0xd0}}
+
+[PcdsFeatureFlag]
+ ## This PCD specifies whether StatusCode is reported via USB3 Serial port.
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable|FALSE|BOOLEAN|0xA0000001
+
+[PcdsFixedAtBuild]
+ ## These PCD specify XHCI controller Bus/Device/Function, which are used to enable
+ # XHCI debug device.
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciBus|0x00|UINT8|0xF0000001
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciDev|0x14|UINT8|0xF0000002
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciFunc|0x00|UINT8|0xF0000003
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress|0xFEA10000|UINT32|0xF0000004
+
+ ## This PCD specifies the wait timeout value in microsecond if USB debug cable is detected but host not connected.
+ # Default timeout value is 2000000 microseconds.
+ # If user does not want system stall for long time, it can be set to small value.
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout|2000000|UINT64|0xF0000005
+
+ ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes space.
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortBusIndex|0x59|UINT8|0xF0000006
+ ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes space.
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortDeviceIndex|0x5A|UINT8|0xF0000007
+ ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes space.
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortFunctionIndex|0x5B|UINT8|0xF0000008
+
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc
new file mode 100644
index 0000000000..494dd7a342
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc
@@ -0,0 +1,149 @@
+## @file
+# This is a build description file for the USB3 Debug advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+################################################################################
+[LibraryClasses]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+
+[LibraryClasses.common.PEIM]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+ PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
+
+[LibraryClasses.common.DXE_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+
+[LibraryClasses.common.DXE_RUNTIME_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+
+[LibraryClasses.common.UEFI_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+
+################################################################################
+#
+# Component section - list of all components that need built for this feature.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+################################################################################
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # USB3 Debug Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
+
+ # Add components here that should be included in the package build.
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
+ #####################################
+ # USB3 Debug Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf
+
+ # Add components here that should be included in the package build.
+
+###################################################################################################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
+###################################################################################################
+[BuildOptions]
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dsc b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dsc
new file mode 100644
index 0000000000..02627d2ed4
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dsc
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for USB3 Debug support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ PLATFORM_NAME = Usb3DebugFeaturePkg
+ PLATFORM_GUID = 3A861E9B-E2B3-4725-BD3B-93A7FB5E861E
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#
+# This package always builds the feature.
+#
+!include Include/Usb3DebugFeature.dsc
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..6f6e94a51c
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for post-memory modules that enable USB3 Debug
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..28441c0b9a
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory modules that enable USB3 Debug.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
new file mode 100644
index 0000000000..51671ce4e3
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
@@ -0,0 +1,55 @@
+## @file
+# USB3 Debug port library.
+#
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = Usb3DebugPortLibDxe
+ FILE_GUID = 08A575C4-D962-4ca5-8855-D3B4AE93A141
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = Usb3DebugPortLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE
+ CONSTRUCTOR = Usb3DebugPortLibDxeConstructor
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[Sources]
+ Usb3DebugPortLibDxe.c
+ Usb3DebugPortDataTransfer.c
+ Usb3DebugPortInitialize.c
+ MiscServices.c
+ Usb3DebugPortLibInternal.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ PcdLib
+ IoLib
+ PciLib
+ TimerLib
+ UefiBootServicesTableLib
+ UefiLib
+ HobLib
+ Usb3DebugPortParamLib
+
+[Protocols]
+ gEfiSmmAccess2ProtocolGuid ## CONSUMES
+ gEfiSmmBase2ProtocolGuid ## CONSUMES
+
+[Pcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOMETIMES_CONSUMES
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONSUMES
+
+[FeaturePcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable ## CONSUMES
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf
new file mode 100644
index 0000000000..3f38ba2649
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf
@@ -0,0 +1,63 @@
+## @file
+# USB3 Debug port library.
+#
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = Usb3DebugPortLibDxeIoMmu
+ FILE_GUID = BC48A65D-5E5E-4512-8ACC-90E79E2D80C2
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = Usb3DebugPortLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE
+ CONSTRUCTOR = Usb3DebugPortLibDxeConstructor
+ DESTRUCTOR = Usb3DebugPortLibDxeDestructor
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[Sources]
+ Usb3DebugPortLibDxeIoMmu.c
+ Usb3DebugPortDataTransfer.c
+ Usb3DebugPortInitialize.c
+ MiscServices.c
+ Usb3DebugPortLibInternal.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ PcdLib
+ IoLib
+ PciLib
+ TimerLib
+ UefiBootServicesTableLib
+ UefiLib
+ HobLib
+ Usb3DebugPortParamLib
+
+[Protocols]
+ gEfiSmmAccess2ProtocolGuid ## CONSUMES
+ gEfiSmmBase2ProtocolGuid ## CONSUMES
+ ## NOTIFY
+ ## SOMETIMES_CONSUMES
+ gEfiPciIoProtocolGuid
+ gEdkiiIoMmuProtocolGuid ## SOMETIMES_CONSUMES
+ ## NOTIFY
+ gEfiDxeSmmReadyToLockProtocolGuid
+
+[Pcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOMETIMES_CONSUMES
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONSUMES
+
+[FeaturePcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable ## CONSUMES
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
new file mode 100644
index 0000000000..a25a3ceb54
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
@@ -0,0 +1,27 @@
+## @file
+# USB3 Debug port library.
+#
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = USB3DebugPortLibNull
+ FILE_GUID = 3E895F08-0A69-42a2-AF4A-3E9EFAA40361
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = Usb3DebugPortLib
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[Sources]
+ Usb3DebugPortLibNull.c
+
+[Packages]
+ MdePkg/MdePkg.dec
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf
new file mode 100644
index 0000000000..ebea01d5a8
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf
@@ -0,0 +1,48 @@
+## @file
+# USB3 Debug port library.
+#
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = USB3DebugPortLibPei
+ FILE_GUID = 62C974F0-D0E0-4963-B93A-22FBCEB69AB4
+ MODULE_TYPE = PEIM
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = Usb3DebugPortLib|PEIM PEI_CORE
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[Sources]
+ Usb3DebugPortLibPei.c
+ Usb3DebugPortDataTransfer.c
+ Usb3DebugPortInitialize.c
+ MiscServices.c
+ Usb3DebugPortLibInternal.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ PcdLib
+ IoLib
+ PciLib
+ TimerLib
+ HobLib
+ Usb3DebugPortParamLib
+ PeiServicesTablePointerLib
+
+[Ppis]
+ gEfiPeiMemoryDiscoveredPpiGuid ## CONSUMES
+
+[Pcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOMETIMES_CONSUMES
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONSUMES
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
new file mode 100644
index 0000000000..6c3e8bc760
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
@@ -0,0 +1,51 @@
+## @file
+# USB3 Debug port library.
+#
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = USB3DebugPortLibPeiIoMmu
+ FILE_GUID = C973C5E8-A0D8-4FEE-A0F0-7DA6C3C72451
+ MODULE_TYPE = PEIM
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = Usb3DebugPortLib|PEIM PEI_CORE
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[Sources]
+ Usb3DebugPortLibPeiIoMmu.c
+ Usb3DebugPortDataTransfer.c
+ Usb3DebugPortInitialize.c
+ MiscServices.c
+ Usb3DebugPortLibInternal.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ PcdLib
+ IoLib
+ PciLib
+ TimerLib
+ HobLib
+ Usb3DebugPortParamLib
+ PeiServicesTablePointerLib
+
+[Ppis]
+ gEfiPeiMemoryDiscoveredPpiGuid ## CONSUMES
+ gEdkiiIoMmuPpiGuid ## SOMETIMES_CONSUMES
+
+[Pcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOMETIMES_CONSUMES
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONSUMES
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf
new file mode 100644
index 0000000000..e891a0c459
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf
@@ -0,0 +1,31 @@
+## @file
+# USB3 Debug Port Parameter library instance based on PCD.
+#
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = Usb3DebugPortParamLibPcd
+ FILE_GUID = 4990A700-4002-4d08-8E00-622720032662
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = Usb3DebugPortParamLib
+
+[Sources]
+ Usb3DebugPortParamLibPcd.c
+
+[LibraryClasses]
+ BaseLib
+ DebugLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
+
+[Pcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciBus ## CONSUMES
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciDev ## CONSUMES
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciFunc ## CONSUMES
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h
new file mode 100644
index 0000000000..0bee2b63dd
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h
@@ -0,0 +1,71 @@
+/** @file
+ This library class provides common USB3 debug port functions.
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USB3_DEBUG_PORT_LIB__
+#define __USB3_DEBUG_PORT_LIB__
+
+/**
+ Initialize the USB3 debug port hardware.
+
+ If no initialization is required, then return RETURN_SUCCESS.
+ If the serial device was successfully initialized, then return RETURN_SUCCESS.
+ If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+ @retval RETURN_DEVICE_ERROR The serial device could not be initialized.
+
+**/
+RETURN_STATUS
+EFIAPI
+Usb3DebugPortInitialize (
+ VOID
+ );
+
+/**
+ Write data from buffer to USB3 debug port.
+
+ Writes NumberOfBytes data bytes from Buffer to the serial device.
+ The number of bytes actually written to the serial device is returned.
+ If the return value is less than NumberOfBytes, then the write operation failed.
+ If Buffer is NULL, then ASSERT().
+ If NumberOfBytes is zero, then return 0.
+
+ @param Buffer Pointer to the data buffer to be written.
+ @param NumberOfBytes Number of bytes to written to the serial device.
+
+ @retval 0 NumberOfBytes is 0.
+ @retval >0 The number of bytes written to the serial device.
+ If this value is less than NumberOfBytes, then the read operation failed.
+
+**/
+UINTN
+EFIAPI
+Usb3DebugPortWrite (
+ IN UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ );
+
+
+/**
+ Polls a USB3 debug port to see if there is any data waiting to be read.
+
+ Polls a serial device to see if there is any data waiting to be read.
+ If there is data waiting to be read from the serial device, then TRUE is returned.
+ If there is no data waiting to be read from the serial device, then FALSE is returned.
+
+ @retval TRUE Data is waiting to be read from the serial device.
+ @retval FALSE There is no data waiting to be read from the serial device.
+
+**/
+BOOLEAN
+EFIAPI
+Usb3DebugPortPoll (
+ VOID
+ );
+
+#endif
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortParamLib.h b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortParamLib.h
new file mode 100644
index 0000000000..167c607e9f
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortParamLib.h
@@ -0,0 +1,56 @@
+/** @file
+ This library class provides capability to get/set usb3 debug port parameter.
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USB3_DEBUG_PORT_PARAMETER_LIB__
+#define __USB3_DEBUG_PORT_PARAMETER_LIB__
+
+typedef struct {
+ UINT8 Function;
+ UINT8 Device;
+ UINT8 Bus;
+} PCI_ADDRESS;
+
+typedef union {
+ UINT32 Controller;
+ PCI_ADDRESS PciAddress;
+} USB3_DEBUG_PORT_CONTROLLER;
+
+/**
+ Returns the USB debug port controller.
+ bit: 0~ 7: Function
+ bit: 8~15: Device
+ bit: 16~24: Bus
+
+ @return Controller information of USB debug port.
+
+**/
+UINT32
+EFIAPI
+GetUsb3DebugPortController (
+ VOID
+ );
+
+/**
+ Sets the USB debug port controller.
+ bit: 0~ 7: Function
+ bit: 8~15: Device
+ bit: 16~24: Bus
+
+ @param[in] Controller information of USB debug port value to be set.
+
+ @retval TRUE The controller of USB debug port was sucessfully set.
+ @retval FALSE The controller of USB debug port could not be set.
+
+**/
+BOOLEAN
+EFIAPI
+SetUsb3DebugPortController (
+ UINT32 Controller
+ );
+
+#endif
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h
new file mode 100644
index 0000000000..3641cc1d52
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h
@@ -0,0 +1,887 @@
+/** @file
+ This library class provides common Usb debug port functions.
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USB3_DEBUG_PORT_LIB_INTERNAL__
+#define __USB3_DEBUG_PORT_LIB_INTERNAL__
+
+#include <Uefi.h>
+#include <IndustryStandard/Usb.h>
+#include <Library/IoLib.h>
+#include <IndustryStandard/Pci.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/BaseLib.h>
+#include <Library/TimerLib.h>
+
+//
+// USB Debug GUID value
+//
+#define USB3_DBG_GUID \
+ { \
+ 0xb2a56f4d, 0x9177, 0x4fc8, { 0xa6, 0x77, 0xdd, 0x96, 0x3e, 0xb4, 0xcb, 0x1b } \
+ }
+
+//
+// Define the maximum of SMRAM ranges
+//
+#define MAX_SMRAM_RANGE 8
+
+#define XHCI_DEBUG_DEVICE_VENDOR_ID 0x8086
+#define XHCI_DEBUG_DEVICE_PRODUCT_ID 0x1234
+#define XHCI_DEBUG_DEVICE_PROTOCOL 0xFF
+#define XHCI_DEBUG_DEVICE_REVISION 0x00
+
+#define XHCI_BASE_ADDRESS_64_BIT_MASK 0xFFFFFFFFFFFF0000ULL
+#define XHCI_BASE_ADDRESS_32_BIT_MASK 0xFFFF0000
+
+#define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A
+#define XHC_HCCPARAMS_OFFSET 0x10
+#define XHC_CAPABILITY_ID_MASK 0xFF
+#define XHC_NEXT_CAPABILITY_MASK 0xFF00
+
+#define XHC_USBCMD_OFFSET 0x0 // USB Command Register Offset
+#define XHC_USBSTS_OFFSET 0x4 // USB Status Register Offset
+
+#define XHC_USBCMD_RUN BIT0 // Run/Stop
+#define XHC_USBCMD_RESET BIT1 // Host Controller Reset
+
+#define XHC_USBSTS_HALT BIT0
+
+//
+// Transfer the data of 8 bytes each time
+//
+#define XHC_DEBUG_PORT_DATA_LENGTH 8
+
+//
+// Indicate the timeout when data is transferred. 0 means infinite timeout.
+//
+#define DATA_TRANSFER_TIME_OUT 0
+
+//
+// USB debug device string descritpor (header size + unicode string length)
+//
+#define STRING0_DESC_LEN 4
+#define MANU_DESC_LEN 12
+#define PRODUCT_DESC_LEN 40
+#define SERIAL_DESC_LEN 4
+
+//
+// Debug Capability Register Offset
+//
+#define XHC_DC_DCID 0x0
+#define XHC_DC_DCDB 0x4
+#define XHC_DC_DCERSTSZ 0x8
+#define XHC_DC_DCERSTBA 0x10
+#define XHC_DC_DCERDP 0x18
+#define XHC_DC_DCCTRL 0x20
+#define XHC_DC_DCST 0x24
+#define XHC_DC_DCPORTSC 0x28
+#define XHC_DC_DCCP 0x30
+#define XHC_DC_DCDDI1 0x38
+#define XHC_DC_DCDDI2 0x3C
+
+#define TRB_TYPE_LINK 6
+
+#define ERST_NUMBER 0x01
+#define TR_RING_TRB_NUMBER 0x100
+#define EVENT_RING_TRB_NUMBER 0x200
+#define CMD_RING_TRB_NUMBER 0x100
+
+#define ED_BULK_OUT 2
+#define ED_BULK_IN 6
+
+#define XHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0xFFFFFFFF))
+#define XHC_HIGH_32BIT(Addr64) ((UINT32)(RShiftU64((UINT64)(UINTN)(Addr64), 32) & 0xFFFFFFFF))
+#define XHC_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))
+
+#define XHC_REG_BIT_IS_SET(Xhc, Offset, Bit) \
+ (XHC_BIT_IS_SET(XhcReadMmioReg ((Xhc), (Offset)), (Bit)))
+
+//
+// Endpoint Type (EP Type).
+//
+#define ED_NOT_VALID 0
+#define ED_ISOCH_OUT 1
+#define ED_BULK_OUT 2
+#define ED_INTERRUPT_OUT 3
+#define ED_CONTROL_BIDIR 4
+#define ED_ISOCH_IN 5
+#define ED_BULK_IN 6
+#define ED_INTERRUPT_IN 7
+
+//
+// 6.4.5 TRB Completion Codes
+//
+#define TRB_COMPLETION_INVALID 0
+#define TRB_COMPLETION_SUCCESS 1
+#define TRB_COMPLETION_DATA_BUFFER_ERROR 2
+#define TRB_COMPLETION_BABBLE_ERROR 3
+#define TRB_COMPLETION_USB_TRANSACTION_ERROR 4
+#define TRB_COMPLETION_TRB_ERROR 5
+#define TRB_COMPLETION_STALL_ERROR 6
+#define TRB_COMPLETION_SHORT_PACKET 13
+
+//
+// 6.4.6 TRB Types
+//
+#define TRB_TYPE_NORMAL 1
+#define TRB_TYPE_SETUP_STAGE 2
+#define TRB_TYPE_DATA_STAGE 3
+#define TRB_TYPE_STATUS_STAGE 4
+#define TRB_TYPE_ISOCH 5
+#define TRB_TYPE_LINK 6
+#define TRB_TYPE_EVENT_DATA 7
+#define TRB_TYPE_NO_OP 8
+#define TRB_TYPE_EN_SLOT 9
+#define TRB_TYPE_DIS_SLOT 10
+#define TRB_TYPE_ADDRESS_DEV 11
+#define TRB_TYPE_CON_ENDPOINT 12
+#define TRB_TYPE_EVALU_CONTXT 13
+#define TRB_TYPE_RESET_ENDPOINT 14
+#define TRB_TYPE_STOP_ENDPOINT 15
+#define TRB_TYPE_SET_TR_DEQUE 16
+#define TRB_TYPE_RESET_DEV 17
+#define TRB_TYPE_GET_PORT_BANW 21
+#define TRB_TYPE_FORCE_HEADER 22
+#define TRB_TYPE_NO_OP_COMMAND 23
+#define TRB_TYPE_TRANS_EVENT 32
+#define TRB_TYPE_COMMAND_COMPLT_EVENT 33
+#define TRB_TYPE_PORT_STATUS_CHANGE_EVENT 34
+#define TRB_TYPE_HOST_CONTROLLER_EVENT 37
+#define TRB_TYPE_DEVICE_NOTIFI_EVENT 38
+#define TRB_TYPE_MFINDEX_WRAP_EVENT 39
+
+//
+// Convert millisecond to microsecond.
+//
+#define XHC_1_MILLISECOND (1000)
+#define XHC_POLL_DELAY (1000)
+#define XHC_GENERIC_TIMEOUT (10 * 1000)
+
+#define EFI_USB_SPEED_FULL 0x0000 ///< 12 Mb/s, USB 1.1 OHCI and UHCI HC.
+#define EFI_USB_SPEED_LOW 0x0001 ///< 1 Mb/s, USB 1.1 OHCI and UHCI HC.
+#define EFI_USB_SPEED_HIGH 0x0002 ///< 480 Mb/s, USB 2.0 EHCI HC.
+#define EFI_USB_SPEED_SUPER 0x0003 ///< 4.8 Gb/s, USB 3.0 XHCI HC.
+
+//
+// Transfer types, used in URB to identify the transfer type
+//
+#define XHC_CTRL_TRANSFER 0x01
+#define XHC_BULK_TRANSFER 0x02
+#define XHC_INT_TRANSFER_SYNC 0x04
+#define XHC_INT_TRANSFER_ASYNC 0x08
+#define XHC_INT_ONLY_TRANSFER_ASYNC 0x10
+
+//
+// USB Transfer Results
+//
+#define EFI_USB_NOERROR 0x00
+#define EFI_USB_ERR_NOTEXECUTE 0x01
+#define EFI_USB_ERR_STALL 0x02
+#define EFI_USB_ERR_BUFFER 0x04
+#define EFI_USB_ERR_BABBLE 0x08
+#define EFI_USB_ERR_NAK 0x10
+#define EFI_USB_ERR_CRC 0x20
+#define EFI_USB_ERR_TIMEOUT 0x40
+#define EFI_USB_ERR_BITSTUFF 0x80
+#define EFI_USB_ERR_SYSTEM 0x100
+
+#define USB3_DEBUG_PORT_INSTANCE_SIGNATURE SIGNATURE_32('D', 'B', 'G', 'P')
+
+#pragma pack(1)
+
+//
+// 7.6.9 OUT/IN EP Context: 64 bytes
+// 7.6.9.2 When used by the DbC it is always a 64 byte data structure
+//
+typedef struct _ENDPOINT_CONTEXT_64 {
+ UINT32 EPState:3;
+ UINT32 RsvdZ1:5;
+ UINT32 Mult:2; // set to 0
+ UINT32 MaxPStreams:5; // set to 0
+ UINT32 LSA:1; // set to 0
+ UINT32 Interval:8; // set to 0
+ UINT32 RsvdZ2:8;
+
+ UINT32 RsvdZ3:1;
+ UINT32 CErr:2;
+ UINT32 EPType:3;
+ UINT32 RsvdZ4:1;
+ UINT32 HID:1; // set to 0
+ UINT32 MaxBurstSize:8;
+ UINT32 MaxPacketSize:16;
+
+ UINT32 PtrLo;
+
+ UINT32 PtrHi;
+
+ UINT32 AverageTRBLength:16;
+ UINT32 MaxESITPayload:16; // set to 0
+
+ UINT32 RsvdZ5; // Reserved
+ UINT32 RsvdZ6;
+ UINT32 RsvdZ7;
+
+ UINT32 RsvdZ8;
+ UINT32 RsvdZ9;
+ UINT32 RsvdZ10;
+ UINT32 RsvdZ11;
+
+ UINT32 RsvdZ12;
+ UINT32 RsvdZ13;
+ UINT32 RsvdZ14;
+ UINT32 RsvdZ15;
+} ENDPOINT_CONTEXT_64;
+
+//
+// 6.4.1.1 Normal TRB: 16 bytes
+// A Normal TRB is used in several ways; exclusively on Bulk and Interrupt Transfer Rings for normal and
+// Scatter/Gather operations, to define additional data buffers for Scatter/Gather operations on Isoch Transfer
+// Rings, and to define the Data stage information for Control Transfer Rings.
+//
+typedef struct _TRANSFER_TRB_NORMAL {
+ UINT32 TRBPtrLo;
+
+ UINT32 TRBPtrHi;
+
+ UINT32 Length:17;
+ UINT32 TDSize:5;
+ UINT32 IntTarget:10;
+
+ UINT32 CycleBit:1;
+ UINT32 ENT:1;
+ UINT32 ISP:1;
+ UINT32 NS:1;
+ UINT32 CH:1;
+ UINT32 IOC:1;
+ UINT32 IDT:1;
+ UINT32 RsvdZ1:2;
+ UINT32 BEI:1;
+ UINT32 Type:6;
+ UINT32 RsvdZ2:16;
+} TRANSFER_TRB_NORMAL;
+
+//
+// 6.4.2.1 Transfer Event TRB: 16 bytes
+// A Transfer Event provides the completion status associated with a Transfer TRB. Refer to section 4.11.3.1
+// for more information on the use and operation of Transfer Events.
+//
+typedef struct _EVT_TRB_TRANSFER {
+ UINT32 TRBPtrLo;
+
+ UINT32 TRBPtrHi;
+
+ UINT32 Length:24;
+ UINT32 Completecode:8;
+
+ UINT32 CycleBit:1;
+ UINT32 RsvdZ1:1;
+ UINT32 ED:1;
+ UINT32 RsvdZ2:7;
+ UINT32 Type:6;
+ UINT32 EndpointId:5;
+ UINT32 RsvdZ3:3;
+ UINT32 SlotId:8;
+} EVT_TRB_TRANSFER;
+
+//
+// 6.4.4.1 Link TRB: 16 bytes
+// A Link TRB provides support for non-contiguous TRB Rings.
+//
+typedef struct _LINK_TRB {
+ UINT32 PtrLo;
+
+ UINT32 PtrHi;
+
+ UINT32 RsvdZ1:22;
+ UINT32 InterTarget:10;
+
+ UINT32 CycleBit:1;
+ UINT32 TC:1;
+ UINT32 RsvdZ2:2;
+ UINT32 CH:1;
+ UINT32 IOC:1;
+ UINT32 RsvdZ3:4;
+ UINT32 Type:6;
+ UINT32 RsvdZ4:16;
+} LINK_TRB;
+
+//
+// TRB Template: 16 bytes
+//
+typedef struct _TRB_TEMPLATE {
+ UINT32 Parameter1;
+
+ UINT32 Parameter2;
+
+ UINT32 Status;
+
+ UINT32 CycleBit:1;
+ UINT32 RsvdZ1:9;
+ UINT32 Type:6;
+ UINT32 Control:16;
+} TRB_TEMPLATE;
+
+//
+// Refer to XHCI 6.5 Event Ring Segment Table: 16 bytes
+//
+typedef struct _EVENT_RING_SEG_TABLE_ENTRY {
+ UINT32 PtrLo;
+ UINT32 PtrHi;
+ UINT32 RingTrbSize:16;
+ UINT32 RsvdZ1:16;
+ UINT32 RsvdZ2;
+} EVENT_RING_SEG_TABLE_ENTRY;
+
+//
+// Size: 40 bytes
+//
+typedef struct _EVENT_RING {
+ EFI_PHYSICAL_ADDRESS ERSTBase;
+ EFI_PHYSICAL_ADDRESS EventRingSeg0;
+ UINT32 TrbNumber;
+ EFI_PHYSICAL_ADDRESS EventRingEnqueue;
+ EFI_PHYSICAL_ADDRESS EventRingDequeue;
+ UINT32 EventRingCCS;
+} EVENT_RING;
+
+// Size: 32 bytes
+typedef struct _TRANSFER_RING {
+ EFI_PHYSICAL_ADDRESS RingSeg0;
+ UINT32 TrbNumber;
+ EFI_PHYSICAL_ADDRESS RingEnqueue;
+ EFI_PHYSICAL_ADDRESS RingDequeue;
+ UINT32 RingPCS;
+} TRANSFER_RING;
+
+//
+// Size: 64 bytes
+//
+typedef struct _DBC_INFO_CONTEXT {
+ UINT64 String0DescAddress;
+ UINT64 ManufacturerStrDescAddress;
+ UINT64 ProductStrDescAddress;
+ UINT64 SerialNumberStrDescAddress;
+ UINT64 String0Length:8;
+ UINT64 ManufacturerStrLength:8;
+ UINT64 ProductStrLength:8;
+ UINT64 SerialNumberStrLength:8;
+ UINT64 RsvdZ1:32;
+ UINT64 RsvdZ2;
+ UINT64 RsvdZ3;
+ UINT64 RsvdZ4;
+} DBC_INFO_CONTEXT;
+
+//
+// Debug Capability Context Data Structure: 192 bytes
+//
+typedef struct _XHC_DC_CONTEXT {
+ DBC_INFO_CONTEXT DbcInfoContext;
+ ENDPOINT_CONTEXT_64 EpOutContext;
+ ENDPOINT_CONTEXT_64 EpInContext;
+} XHC_DC_CONTEXT;
+
+//
+// Size: 16 bytes
+//
+typedef union _TRB {
+ TRB_TEMPLATE TrbTemplate;
+ TRANSFER_TRB_NORMAL TrbNormal;
+} TRB;
+
+///
+/// USB data transfer direction
+///
+typedef enum {
+ EfiUsbDataIn,
+ EfiUsbDataOut,
+ EfiUsbNoData
+} EFI_USB_DATA_DIRECTION;
+
+//
+// URB (Usb Request Block) contains information for all kinds of
+// usb requests.
+//
+typedef struct _URB {
+ UINT32 Signature;
+ //
+ // Transfer data
+ //
+ EFI_PHYSICAL_ADDRESS Data;
+ UINT32 DataLen;
+ //
+ // Execute result
+ //
+ UINT32 Result;
+ //
+ // Completed data length
+ //
+ UINT32 Completed;
+ //
+ // Tranfer Ring info
+ //
+ EFI_PHYSICAL_ADDRESS Ring;
+ EFI_PHYSICAL_ADDRESS TrbStart;
+ EFI_PHYSICAL_ADDRESS TrbEnd;
+ UINT32 TrbNum;
+ BOOLEAN StartDone;
+ BOOLEAN EndDone;
+ BOOLEAN Finished;
+ EFI_USB_DATA_DIRECTION Direction;
+} URB;
+
+//
+// Size: 90 bytes
+//
+typedef struct _USB3_DEBUG_PORT_INSTANCE {
+ UINT32 Signature;
+
+ UINT8 PciBusNumber;
+ UINT8 PciDeviceNumber;
+ UINT8 PciFunctionNumber;
+
+ //
+ // The flag indicates debug capability is supported
+ //
+ BOOLEAN DebugSupport;
+
+ //
+ // The flag indicates debug device is ready
+ //
+ BOOLEAN Ready;
+
+ //
+ // The flag indicates the instance is from HOB
+ //
+ BOOLEAN FromHob;
+
+ //
+ // PciIo protocol event
+ //
+ EFI_PHYSICAL_ADDRESS PciIoEvent;
+
+ //
+ // XHCI MMIO Base address
+ //
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+
+ //
+ // XHCI OP RegisterBase address
+ //
+ EFI_PHYSICAL_ADDRESS XhciOpRegister;
+
+ //
+ // XHCI Debug Register Base Address
+ //
+ EFI_PHYSICAL_ADDRESS DebugCapabilityBase;
+
+ //
+ // XHCI Debug Capability offset
+ //
+ UINT64 DebugCapabilityOffset;
+
+ //
+ // XHCI Debug Context Address
+ //
+ EFI_PHYSICAL_ADDRESS DebugCapabilityContext;
+
+ //
+ // Transfer Ring
+ //
+ TRANSFER_RING TransferRingOut;
+ TRANSFER_RING TransferRingIn;
+
+ //
+ // EventRing
+ //
+ EVENT_RING EventRing;
+
+ //
+ // URB
+ //
+ URB Urb;
+} USB3_DEBUG_PORT_INSTANCE;
+
+#pragma pack()
+
+/**
+ Clear one bit of the debug register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcClearDebugRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ );
+
+/**
+ Clear one bit of the MMIO register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the MMIO register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcClearMmioRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ );
+
+/**
+ Read XHCI debug register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+
+ @return The register content read
+
+**/
+UINT32
+XhcReadDebugReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset
+ );
+
+/**
+ Read XHCI MMIO register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the MMIO register.
+
+ @return The register content read
+
+**/
+UINT32
+XhcReadMmioReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset
+ );
+
+/**
+ Set one bit of the debug register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcSetDebugRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ );
+
+/**
+ Set one bit of the MMIO register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the MMIO register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcSetMmioRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ );
+
+/**
+ Wait the MMIO register's bit as specified by Bit
+ to be set (or clear).
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the MMIO register.
+ @param Bit The bit of the register to wait for.
+ @param WaitToSet Wait the bit to set or clear.
+ @param Timeout The time to wait before abort (in millisecond, ms).
+
+ @retval EFI_SUCCESS The bit successfully changed by host controller.
+ @retval EFI_TIMEOUT The time out occurred.
+
+**/
+EFI_STATUS
+XhcWaitMmioRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit,
+ IN BOOLEAN WaitToSet,
+ IN UINT32 Timeout
+ );
+
+/**
+ Write the data to the debug register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+ @param Data The data to write.
+
+**/
+VOID
+XhcWriteDebugReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Data
+ );
+
+/**
+ Write the data to the MMIO register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the MMIO register.
+ @param Data The data to write.
+
+**/
+VOID
+XhcWriteMmioReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Data
+ );
+
+/**
+ Discover the USB3 debug device.
+
+ @param[in] Instance Pointer to USB3 debug port object instance.
+
+ @retval RETURN_SUCCESS The USB3 debug device was found.
+ @retval RETURN_DEVICE_ERROR The USB3 debug device was not found.
+
+**/
+RETURN_STATUS
+DiscoverUsb3DebugPort(
+ IN USB3_DEBUG_PORT_INSTANCE *Instance
+ );
+
+/**
+ Initialize the USB3 debug Device hardware.
+
+ @param[in] Instance Pointer to USB3 debug port object instance.
+
+ @retval RETURN_SUCCESS The USB3 debug device was initialized successfully.
+ @retval !RETURN_SUCCESS Error.
+
+**/
+RETURN_STATUS
+InitializeUsb3DebugPort (
+ IN USB3_DEBUG_PORT_INSTANCE *Instance
+ );
+
+/**
+ Return XHCI MMIO base address.
+
+**/
+EFI_PHYSICAL_ADDRESS
+GetXhciBaseAddress (
+ VOID
+ );
+
+/**
+ Return XHCI debug instance address.
+
+**/
+USB3_DEBUG_PORT_INSTANCE *
+GetUsb3DebugPortInstance (
+ VOID
+ );
+
+/**
+ Send data over the USB3 debug cable.
+
+ @param[out] Data Pointer to data
+ @param[in, out] Length Pointer to data length
+
+**/
+VOID
+Usb3DbgOut (
+ OUT UINT8 *Data,
+ IN OUT UINTN *Length
+ );
+
+/**
+ Receive data over the USB3 debug cable.
+
+ @param[out] Data Pointer to data
+ @param[in, out] Length Pointer to data length
+
+**/
+RETURN_STATUS
+Usb3DbgIn (
+ OUT UINT8 *Data,
+ IN OUT UINTN *Length
+ );
+
+/**
+ Verifies if the bit positions specified by a mask are set in a register.
+
+ @param[in, out] Register UNITN register
+ @param[in] BitMask 32-bit mask
+
+ @return BOOLEAN - TRUE if all bits specified by the mask are enabled.
+ - FALSE even if one of the bits specified by the mask
+ is not enabled.
+**/
+BOOLEAN
+XhcIsBitSet(
+ UINTN Register,
+ UINT32 BitMask
+ );
+
+/**
+ Sets bits as per the enabled bit positions in the mask.
+
+ @param[in, out] Register UINTN register
+ @param[in] BitMask 32-bit mask
+**/
+VOID
+XhcSetR32Bit(
+ UINTN Register,
+ UINT32 BitMask
+ );
+
+/**
+ Clears bits as per the enabled bit positions in the mask.
+
+ @param[in, out] Register UINTN register
+ @param[in] BitMask 32-bit mask
+**/
+VOID
+XhcClrR32Bit(
+ UINTN Register,
+ UINT32 BitMask
+ );
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3Initialize (
+ VOID
+ );
+
+/**
+ Return command register value in XHCI controller.
+
+**/
+UINT16
+GetXhciPciCommand (
+ VOID
+ );
+
+/**
+ Allocate aligned memory for XHC's usage.
+
+ @param BufferSize The size, in bytes, of the Buffer.
+
+ @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID*
+AllocateAlignBuffer (
+ IN UINTN BufferSize
+ );
+
+/**
+ Check whether AllocatePages in permanent memory is ready.
+
+ @retval TRUE AllocatePages in permanent memory is ready.
+ @retval FALSE AllocatePages in permanent memory is not ready.
+
+**/
+BOOLEAN
+IsAllocatePagesReady (
+ VOID
+ );
+
+/**
+ The real function to initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3InitializeReal (
+ VOID
+ );
+
+/**
+ Update XHC hardware address when MMIO base is changed.
+
+ @param Instance The XHCI Instance.
+ @param XhcMmioBase XHCI MMIO base address.
+
+**/
+VOID
+FixUsb3InstanceResource (
+ IN OUT USB3_DEBUG_PORT_INSTANCE *Instance,
+ IN EFI_PHYSICAL_ADDRESS XhcMmioBase
+ );
+
+/**
+ Save USB3 instance address.
+
+ @param[in] Instance The XHCI Instance.
+
+**/
+VOID
+SaveUsb3InstanceAddress (
+ IN USB3_DEBUG_PORT_INSTANCE *Instance
+ );
+
+/**
+ Submits bulk transfer to a bulk endpoint of a USB device.
+
+ @param Xhc The instance of debug device.
+ @param Direction The direction of data transfer.
+ @param Data Array of pointers to the buffers of data to transmit
+ from or receive into.
+ @param DataLength The lenght of the data buffer.
+ @param Timeout Indicates the maximum time, in millisecond, which
+ the transfer is allowed to complete.
+ @param TransferResult Transfer result.
+
+ @retval EFI_SUCCESS The transfer was completed successfully.
+ @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.
+ @retval EFI_TIMEOUT The transfer failed due to timeout.
+ @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.
+
+**/
+EFI_STATUS
+EFIAPI
+XhcDataTransfer (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN EFI_USB_DATA_DIRECTION Direction,
+ IN OUT VOID *Data,
+ IN OUT UINTN *DataLength,
+ IN UINTN Timeout,
+ OUT UINT32 *TransferResult
+ );
+
+#endif //__SERIAL_PORT_LIB_USB__
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c
new file mode 100644
index 0000000000..cb29a880e6
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c
@@ -0,0 +1,385 @@
+/** @file
+ Miscellaneous services internal to USB debug port implementation.
+
+ Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "Usb3DebugPortLibInternal.h"
+
+/**
+ Verifies if the bit positions specified by a mask are set in a register.
+
+ @param[in, out] Register UNITN register
+ @param[in] BitMask 32-bit mask
+
+ @return BOOLEAN - TRUE if all bits specified by the mask are enabled.
+ - FALSE even if one of the bits specified by the mask
+ is not enabled.
+**/
+BOOLEAN
+XhcIsBitSet(
+ IN OUT UINTN Register,
+ IN UINT32 BitMask
+ )
+{
+ if ((MmioRead32 (Register) & (BitMask)) != 0) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+ Sets bits as per the enabled bit positions in the mask.
+
+ @param[in, out] Register UINTN register
+ @param[in] BitMask 32-bit mask
+**/
+VOID
+XhcSetR32Bit(
+ IN OUT UINTN Register,
+ IN UINT32 BitMask
+ )
+{
+ UINT32 RegisterValue;
+
+ RegisterValue = MmioRead32 (Register);
+ RegisterValue |= (UINT32)(BitMask);
+ MmioWrite32 (Register, RegisterValue);
+}
+
+/**
+ Clears bits as per the enabled bit positions in the mask.
+
+ @param[in, out] Register UINTN register
+ @param[in] BitMask 32-bit mask
+**/
+VOID
+XhcClrR32Bit(
+ IN OUT UINTN Register,
+ IN UINT32 BitMask
+ )
+{
+ UINT32 RegisterValue;
+
+ RegisterValue = MmioRead32 (Register);
+ RegisterValue &= (UINT32)(~(BitMask));
+ MmioWrite32 (Register, RegisterValue);
+}
+
+/**
+ Initialize the USB debug port hardware.
+
+ If no initialization is required, then return RETURN_SUCCESS.
+ If the serial device was successfully initialized, then return RETURN_SUCCESS.
+ If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+ @retval RETURN_DEVICE_ERROR The serial device could not be initialized.
+**/
+RETURN_STATUS
+EFIAPI
+Usb3DebugPortInitialize (
+ VOID
+ )
+{
+ USB3Initialize ();
+ return RETURN_SUCCESS;
+}
+
+/**
+ Write data from buffer to USB debug port.
+
+ Writes NumberOfBytes data bytes from Buffer to the serial device.
+ The number of bytes actually written to the serial device is returned.
+ If the return value is less than NumberOfBytes, then the write operation failed.
+ If Buffer is NULL, then ASSERT().
+ If NumberOfBytes is zero, then return 0.
+
+ @param Buffer Pointer to the data buffer to be written.
+ @param NumberOfBytes Number of bytes to written to the serial device.
+
+ @retval 0 NumberOfBytes is 0.
+ @retval >0 The number of bytes written to the serial device.
+ If this value is less than NumberOfBytes, then the read operation failed.
+**/
+UINTN
+EFIAPI
+Usb3DebugPortWrite (
+ IN UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
+{
+ Usb3DbgOut (Buffer, &NumberOfBytes);
+ return NumberOfBytes;
+}
+
+/**
+ Read data from USB debug port and save the datas in buffer.
+
+ Reads NumberOfBytes data bytes from a serial device into the buffer
+ specified by Buffer. The number of bytes actually read is returned.
+ If the return value is less than NumberOfBytes, then the rest operation failed.
+ If Buffer is NULL, then ASSERT().
+ If NumberOfBytes is zero, then return 0.
+
+ @param Buffer Pointer to the data buffer to store the data read from the serial device.
+ @param NumberOfBytes Number of bytes which will be read.
+
+ @retval 0 Read data failed, no data is to be read.
+ @retval >0 Actual number of bytes read from serial device.
+**/
+UINTN
+EFIAPI
+Usb3DebugPortRead (
+ OUT UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
+{
+ Usb3DbgIn (Buffer, &NumberOfBytes);
+ return NumberOfBytes;
+}
+
+/**
+ Polls a USB debug port to see if there is any data waiting to be read.
+
+ Polls a serial device to see if there is any data waiting to be read.
+ If there is data waiting to be read from the serial device, then TRUE is returned.
+ If there is no data waiting to be read from the serial device, then FALSE is returned.
+
+ @retval TRUE Data is waiting to be read from the serial device.
+ @retval FALSE There is no data waiting to be read from the serial device.
+**/
+BOOLEAN
+EFIAPI
+Usb3DebugPortPoll (
+ VOID
+ )
+{
+ return FALSE;
+}
+
+/**
+ Write the data to the XHCI debug register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the runtime register.
+ @param Data The data to write.
+
+**/
+VOID
+XhcWriteDebugReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Data
+ )
+{
+ EFI_PHYSICAL_ADDRESS DebugCapabilityBase;
+
+ DebugCapabilityBase = Xhc->DebugCapabilityBase;
+
+ MmioWrite32 ((UINTN)(DebugCapabilityBase + Offset), Data);
+
+ return;
+}
+
+/**
+ Read XHCI debug register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+
+ @return The register content read
+
+**/
+UINT32
+XhcReadDebugReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset
+ )
+{
+ UINT32 Data;
+ EFI_PHYSICAL_ADDRESS DebugCapabilityBase;
+
+ DebugCapabilityBase = Xhc->DebugCapabilityBase;
+
+ Data = MmioRead32 ((UINTN)(DebugCapabilityBase + Offset));
+
+ return Data;
+}
+
+/**
+ Set one bit of the debug register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcSetDebugRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ )
+{
+ UINT32 Data;
+
+ Data = XhcReadDebugReg (Xhc, Offset);
+ Data |= Bit;
+ XhcWriteDebugReg (Xhc, Offset, Data);
+}
+
+/**
+ Clear one bit of the debug register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcClearDebugRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ )
+{
+ UINT32 Data;
+
+ Data = XhcReadDebugReg (Xhc, Offset);
+ Data &= ~Bit;
+ XhcWriteDebugReg (Xhc, Offset, Data);
+}
+
+/**
+ Write the data to the XHCI MMIO register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the runtime register.
+ @param Data The data to write.
+
+**/
+VOID
+XhcWriteMmioReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Data
+ )
+{
+ EFI_PHYSICAL_ADDRESS MmioBase;
+
+ MmioBase = Xhc->XhcMmioBase;
+ MmioWrite32 ((UINTN)(MmioBase + Offset), Data);
+
+ return;
+}
+
+/**
+ Read XHCI MMIO register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the runtime register.
+
+ @return The register content read
+
+**/
+UINT32
+XhcReadMmioReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset
+ )
+{
+ UINT32 Data;
+ EFI_PHYSICAL_ADDRESS MmioBase;
+
+ MmioBase = Xhc->XhcMmioBase;
+
+ Data = MmioRead32 ((UINTN)(MmioBase + Offset));
+
+ return Data;
+}
+
+/**
+ Set one bit of the operational register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the runtime register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcSetMmioRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ )
+{
+ UINT32 Data;
+
+ Data = XhcReadMmioReg (Xhc, Offset);
+ Data |= Bit;
+ XhcWriteMmioReg (Xhc, Offset, Data);
+}
+
+/**
+ Clear one bit of the operational register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the runtime register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcClearMmioRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ )
+{
+ UINT32 Data;
+
+ Data = XhcReadMmioReg (Xhc, Offset);
+ Data &= ~Bit;
+ XhcWriteMmioReg (Xhc, Offset, Data);
+}
+
+/**
+ Wait the operation register's bit as specified by Bit
+ to be set (or clear).
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the operational register.
+ @param Bit The bit of the register to wait for.
+ @param WaitToSet Wait the bit to set or clear.
+ @param Timeout The time to wait before abort (in millisecond, ms).
+
+ @retval EFI_SUCCESS The bit successfully changed by host controller.
+ @retval EFI_TIMEOUT The time out occurred.
+
+**/
+EFI_STATUS
+XhcWaitMmioRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit,
+ IN BOOLEAN WaitToSet,
+ IN UINT32 Timeout
+ )
+{
+ UINT32 Index;
+ UINTN Loop;
+
+ Loop = (Timeout * XHC_1_MILLISECOND / XHC_POLL_DELAY) + 1;
+
+ for (Index = 0; Index < Loop; Index++) {
+ if (XHC_REG_BIT_IS_SET (Xhc, Offset, Bit) == WaitToSet) {
+ return EFI_SUCCESS;
+ }
+
+ MicroSecondDelay (XHC_POLL_DELAY);
+ }
+
+ return EFI_TIMEOUT;
+}
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c
new file mode 100644
index 0000000000..c4a7fd3a06
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c
@@ -0,0 +1,892 @@
+/** @file
+ Usb3 Debug Port library instance
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <PiPei.h>
+#include <Library/SerialPortLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PciLib.h>
+#include <Library/PcdLib.h>
+#include <Library/TimerLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+#include "Usb3DebugPortLibInternal.h"
+
+EFI_SMRAM_DESCRIPTOR mSmramCheckRanges[MAX_SMRAM_RANGE];
+UINTN mSmramCheckRangeCount = 0;
+BOOLEAN mUsb3InSmm = FALSE;
+UINT64 mUsb3MmioSize = 0;
+
+/**
+ Synchronize the specified transfer ring to update the enqueue and dequeue pointer.
+
+ @param Xhc The XHCI Instance.
+ @param TrsRing The transfer ring to sync.
+
+ @retval EFI_SUCCESS The transfer ring is synchronized successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+XhcSyncTrsRing (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN TRANSFER_RING *TrsRing
+ )
+{
+ UINTN Index;
+ TRB_TEMPLATE *TrsTrb;
+
+ ASSERT (TrsRing != NULL);
+
+ //
+ // Calculate the latest RingEnqueue and RingPCS
+ //
+ TrsTrb = (TRB_TEMPLATE *)(UINTN) TrsRing->RingEnqueue;
+
+ ASSERT (TrsTrb != NULL);
+
+ for (Index = 0; Index < TrsRing->TrbNumber; Index++) {
+ if (TrsTrb->CycleBit != (TrsRing->RingPCS & BIT0)) {
+ break;
+ }
+ TrsTrb++;
+ if ((UINT8) TrsTrb->Type == TRB_TYPE_LINK) {
+ ASSERT (((LINK_TRB*)TrsTrb)->TC != 0);
+ //
+ // set cycle bit in Link TRB as normal
+ //
+ ((LINK_TRB*)TrsTrb)->CycleBit = TrsRing->RingPCS & BIT0;
+ //
+ // Toggle PCS maintained by software
+ //
+ TrsRing->RingPCS = (TrsRing->RingPCS & BIT0) ? 0 : 1;
+ TrsTrb = (TRB_TEMPLATE *)(UINTN)((TrsTrb->Parameter1 | LShiftU64 ((UINT64)TrsTrb->Parameter2, 32)) & ~0x0F);
+ }
+ }
+ ASSERT (Index != TrsRing->TrbNumber);
+
+ if ((EFI_PHYSICAL_ADDRESS)(UINTN) TrsTrb != TrsRing->RingEnqueue) {
+ TrsRing->RingEnqueue = (EFI_PHYSICAL_ADDRESS)(UINTN) TrsTrb;
+ }
+
+ //
+ // Clear the Trb context for enqueue, but reserve the PCS bit
+ //
+ TrsTrb->Parameter1 = 0;
+ TrsTrb->Parameter2 = 0;
+ TrsTrb->Status = 0;
+ TrsTrb->RsvdZ1 = 0;
+ TrsTrb->Type = 0;
+ TrsTrb->Control = 0;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Synchronize the specified event ring to update the enqueue and dequeue pointer.
+
+ @param Xhc The XHCI Instance.
+ @param EvtRing The event ring to sync.
+
+ @retval EFI_SUCCESS The event ring is synchronized successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+XhcSyncEventRing (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN EVENT_RING *EvtRing
+ )
+{
+ UINTN Index;
+ TRB_TEMPLATE *EvtTrb1;
+
+ ASSERT (EvtRing != NULL);
+
+ //
+ // Calculate the EventRingEnqueue and EventRingCCS.
+ // Note: only support single Segment
+ //
+ EvtTrb1 = (TRB_TEMPLATE *)(UINTN) EvtRing->EventRingDequeue;
+
+ for (Index = 0; Index < EvtRing->TrbNumber; Index++) {
+ if (EvtTrb1->CycleBit != EvtRing->EventRingCCS) {
+ break;
+ }
+
+ EvtTrb1++;
+
+ if ((UINTN)EvtTrb1 >= ((UINTN) EvtRing->EventRingSeg0 + sizeof (TRB_TEMPLATE) * EvtRing->TrbNumber)) {
+ EvtTrb1 = (TRB_TEMPLATE *)(UINTN) EvtRing->EventRingSeg0;
+ EvtRing->EventRingCCS = (EvtRing->EventRingCCS) ? 0 : 1;
+ }
+ }
+
+ if (Index < EvtRing->TrbNumber) {
+ EvtRing->EventRingEnqueue = (EFI_PHYSICAL_ADDRESS)(UINTN)EvtTrb1;
+ } else {
+ ASSERT (FALSE);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Check if there is a new generated event.
+
+ @param Xhc The XHCI Instance.
+ @param EvtRing The event ring to check.
+ @param NewEvtTrb The new event TRB found.
+
+ @retval EFI_SUCCESS Found a new event TRB at the event ring.
+ @retval EFI_NOT_READY The event ring has no new event.
+
+**/
+EFI_STATUS
+EFIAPI
+XhcCheckNewEvent (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN EVENT_RING *EvtRing,
+ OUT TRB_TEMPLATE **NewEvtTrb
+ )
+{
+ EFI_STATUS Status;
+
+ ASSERT (EvtRing != NULL);
+
+ *NewEvtTrb = (TRB_TEMPLATE *)(UINTN) EvtRing->EventRingDequeue;
+
+ if (EvtRing->EventRingDequeue == EvtRing->EventRingEnqueue) {
+ return EFI_NOT_READY;
+ }
+
+ Status = EFI_SUCCESS;
+
+ EvtRing->EventRingDequeue += sizeof (TRB_TEMPLATE);
+ //
+ // If the dequeue pointer is beyond the ring, then roll-back it to the begining of the ring.
+ //
+ if ((UINTN)EvtRing->EventRingDequeue >= ((UINTN) EvtRing->EventRingSeg0 + sizeof (TRB_TEMPLATE) * EvtRing->TrbNumber)) {
+ EvtRing->EventRingDequeue = EvtRing->EventRingSeg0;
+ }
+
+ return Status;
+}
+
+/**
+ Check if the Trb is a transaction of the URB.
+
+ @param Trb The TRB to be checked
+ @param Urb The transfer ring to be checked.
+
+ @retval TRUE It is a transaction of the URB.
+ @retval FALSE It is not any transaction of the URB.
+
+**/
+BOOLEAN
+IsTransferRingTrb (
+ IN TRB_TEMPLATE *Trb,
+ IN URB *Urb
+ )
+{
+ TRB_TEMPLATE *CheckedTrb;
+ TRANSFER_RING *Ring;
+ UINTN Index;
+
+ Ring = (TRANSFER_RING *)(UINTN) Urb->Ring;
+ CheckedTrb = (TRB_TEMPLATE *)(UINTN) Ring->RingSeg0;
+
+ ASSERT (Ring->TrbNumber == CMD_RING_TRB_NUMBER || Ring->TrbNumber == TR_RING_TRB_NUMBER);
+
+ for (Index = 0; Index < Ring->TrbNumber; Index++) {
+ if (Trb == CheckedTrb) {
+ return TRUE;
+ }
+ CheckedTrb++;
+ }
+
+ return FALSE;
+}
+
+/**
+ Check the URB's execution result and update the URB's
+ result accordingly.
+
+ @param Xhc The XHCI Instance.
+ @param Urb The URB to check result.
+
+ @return Whether the result of URB transfer is finialized.
+
+**/
+EFI_STATUS
+XhcCheckUrbResult (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN URB *Urb
+ )
+{
+ EVT_TRB_TRANSFER *EvtTrb;
+ TRB_TEMPLATE *TRBPtr;
+ UINTN Index;
+ UINT8 TRBType;
+ EFI_STATUS Status;
+ URB *CheckedUrb;
+ UINT64 XhcDequeue;
+ UINT32 High;
+ UINT32 Low;
+
+ ASSERT ((Xhc != NULL) && (Urb != NULL));
+
+ Status = EFI_SUCCESS;
+
+ if (Urb->Finished) {
+ goto EXIT;
+ }
+
+ EvtTrb = NULL;
+
+ //
+ // Traverse the event ring to find out all new events from the previous check.
+ //
+ XhcSyncEventRing (Xhc, &Xhc->EventRing);
+
+ for (Index = 0; Index < Xhc->EventRing.TrbNumber; Index++) {
+ Status = XhcCheckNewEvent (Xhc, &Xhc->EventRing, ((TRB_TEMPLATE **)&EvtTrb));
+ if (Status == EFI_NOT_READY) {
+ //
+ // All new events are handled, return directly.
+ //
+ goto EXIT;
+ }
+ //
+ // Only handle COMMAND_COMPLETETION_EVENT and TRANSFER_EVENT.
+ //
+ if ((EvtTrb->Type != TRB_TYPE_COMMAND_COMPLT_EVENT) && (EvtTrb->Type != TRB_TYPE_TRANS_EVENT)) {
+ continue;
+ }
+
+ TRBPtr = (TRB_TEMPLATE *)(UINTN)(EvtTrb->TRBPtrLo | LShiftU64 ((UINT64) EvtTrb->TRBPtrHi, 32));
+
+ //
+ // Update the status of Urb according to the finished event regardless of whether
+ // the urb is current checked one or in the XHCI's async transfer list.
+ // This way is used to avoid that those completed async transfer events don't get
+ // handled in time and are flushed by newer coming events.
+ //
+ if (IsTransferRingTrb (TRBPtr, Urb)) {
+ CheckedUrb = Urb;
+ } else {
+ continue;
+ }
+ switch (EvtTrb->Completecode) {
+ case TRB_COMPLETION_STALL_ERROR:
+ CheckedUrb->Result |= EFI_USB_ERR_STALL;
+ CheckedUrb->Finished = TRUE;
+ break;
+
+ case TRB_COMPLETION_BABBLE_ERROR:
+ CheckedUrb->Result |= EFI_USB_ERR_BABBLE;
+ CheckedUrb->Finished = TRUE;
+ break;
+
+ case TRB_COMPLETION_DATA_BUFFER_ERROR:
+ CheckedUrb->Result |= EFI_USB_ERR_BUFFER;
+ CheckedUrb->Finished = TRUE;
+ break;
+
+ case TRB_COMPLETION_USB_TRANSACTION_ERROR:
+ CheckedUrb->Result |= EFI_USB_ERR_TIMEOUT;
+ CheckedUrb->Finished = TRUE;
+ break;
+
+ case TRB_COMPLETION_SHORT_PACKET:
+ case TRB_COMPLETION_SUCCESS:
+ if (EvtTrb->Completecode == TRB_COMPLETION_SHORT_PACKET) {
+ }
+
+ TRBType = (UINT8) (TRBPtr->Type);
+ if ((TRBType == TRB_TYPE_DATA_STAGE) ||
+ (TRBType == TRB_TYPE_NORMAL) ||
+ (TRBType == TRB_TYPE_ISOCH)) {
+ CheckedUrb->Completed += (CheckedUrb->DataLen - EvtTrb->Length);
+ }
+
+ break;
+
+ default:
+ CheckedUrb->Result |= EFI_USB_ERR_TIMEOUT;
+ CheckedUrb->Finished = TRUE;
+ break;
+ }
+
+ //
+ // Only check first and end Trb event address
+ //
+
+ if ((EFI_PHYSICAL_ADDRESS)(UINTN) TRBPtr == CheckedUrb->TrbStart) {
+ CheckedUrb->StartDone = TRUE;
+ }
+
+ if ((EFI_PHYSICAL_ADDRESS)(UINTN) TRBPtr == CheckedUrb->TrbEnd) {
+ CheckedUrb->EndDone = TRUE;
+ }
+
+ if (CheckedUrb->StartDone && CheckedUrb->EndDone) {
+ CheckedUrb->Finished = TRUE;
+ }
+
+ }
+
+EXIT:
+ //
+ // Advance event ring to last available entry
+ //
+ // Some 3rd party XHCI external cards don't support single 64-bytes width register access,
+ // So divide it to two 32-bytes width register access.
+ //
+ Low = XhcReadDebugReg (Xhc, XHC_DC_DCERDP);
+ High = XhcReadDebugReg (Xhc, XHC_DC_DCERDP + 4);
+ XhcDequeue = (UINT64)(LShiftU64((UINT64)High, 32) | Low);
+
+ if ((XhcDequeue & (~0x0F)) != ((UINT64)(UINTN)Xhc->EventRing.EventRingDequeue & (~0x0F))) {
+ //
+ // Some 3rd party XHCI external cards don't support single 64-bytes width register access,
+ // So divide it to two 32-bytes width register access.
+ //
+ XhcWriteDebugReg (Xhc, XHC_DC_DCERDP, XHC_LOW_32BIT (Xhc->EventRing.EventRingDequeue));
+ XhcWriteDebugReg (Xhc, XHC_DC_DCERDP + 4, XHC_HIGH_32BIT (Xhc->EventRing.EventRingDequeue));
+ }
+
+ return Status;
+}
+
+/**
+ Ring the door bell to notify XHCI there is a transaction to be executed.
+
+ @param Xhc The XHCI Instance.
+ @param Urb The pointer to URB.
+
+ @retval EFI_SUCCESS Successfully ring the door bell.
+
+**/
+EFI_STATUS
+EFIAPI
+XhcRingDoorBell (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN URB *Urb
+ )
+{
+ UINT32 Dcdb;
+
+ //
+ // 7.6.8.2 DCDB Register
+ //
+ if (Urb->Direction == EfiUsbDataIn) {
+ Dcdb = 0x100;
+ } else {
+ Dcdb = 0x0;
+ }
+
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCDB,
+ Dcdb
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Execute the transfer by polling the URB. This is a synchronous operation.
+
+ @param Xhc The XHCI Instance.
+ @param Urb The URB to execute.
+ @param Timeout The time to wait before abort, in millisecond.
+
+ @return EFI_DEVICE_ERROR The transfer failed due to transfer error.
+ @return EFI_TIMEOUT The transfer failed due to time out.
+ @return EFI_SUCCESS The transfer finished OK.
+
+**/
+EFI_STATUS
+XhcExecTransfer (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN URB *Urb,
+ IN UINTN Timeout
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN Loop;
+ TRB_TEMPLATE *Trb;
+ TRANSFER_RING *Ring;
+ TRB_TEMPLATE *TrbStart;
+ TRB_TEMPLATE *TrbEnd;
+
+ Status = EFI_SUCCESS;
+
+ Loop = (Timeout * XHC_1_MILLISECOND / XHC_POLL_DELAY) + 1;
+ if (Timeout == 0) {
+ Loop = 0xFFFFFFFF;
+ }
+ XhcRingDoorBell (Xhc, Urb);
+ //
+ // DSCT BIT0: Event Ring Not Empty bit can only be set to 1 by XHC after ringing door bell with some delay.
+ //
+
+ for (Index = 0; Index < Loop; Index++) {
+ Status = XhcCheckUrbResult (Xhc, Urb);
+ if (Urb->Finished) {
+ break;
+ }
+ MicroSecondDelay (XHC_POLL_DELAY);
+ }
+ if (Index == Loop) {
+ Urb->Result = EFI_USB_ERR_TIMEOUT;
+ }
+
+ //
+ // If URB transfer is error, restore transfer ring to original value before URB transfer
+ // This will make the current transfer TRB is always at the latest unused one in transfer ring.
+ // Without this code, when there is read TRB from target, but host does not write anything, this TRB (A)
+ // will be still here, next read TRB (B) will be put next to TRB (A), when host write then, the TRB (A)
+ // will be used to contain data, not TRB(B), this will cause Finished flag will not be set and return error in this function.
+ //
+ Ring = (TRANSFER_RING *)(UINTN) Urb->Ring;
+ if (Urb->Result != EFI_USB_NOERROR) {
+ Ring->RingEnqueue = Urb->TrbStart;
+ //
+ // Clear CCS flag for next use
+ //
+ TrbStart = (TRB_TEMPLATE *)(UINTN) Urb->TrbStart;
+ TrbEnd = (TRB_TEMPLATE *)(UINTN) Urb->TrbEnd;
+ for (Trb = TrbStart; Trb <= TrbEnd; Trb++) {
+ Trb->CycleBit = ((~Ring->RingPCS) & BIT0);
+ }
+ }
+ return Status;
+}
+
+/**
+ Create a transfer TRB.
+
+ @param Xhc The XHCI Instance
+ @param Urb The urb used to construct the transfer TRB.
+
+ @return Created TRB or NULL
+
+**/
+EFI_STATUS
+XhcCreateTransferTrb (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN URB *Urb
+ )
+{
+ TRANSFER_RING *EPRing;
+ TRB *TrbStart;
+ UINT32 TotalLen;
+ UINT32 Len;
+ UINT32 TrbNum;
+
+ Urb->Finished = FALSE;
+ Urb->StartDone = FALSE;
+ Urb->EndDone = FALSE;
+ Urb->Completed = 0;
+ Urb->Result = EFI_USB_NOERROR;
+
+ if (Urb->Direction == EfiUsbDataIn) {
+ EPRing = &Xhc->TransferRingIn;
+ } else {
+ EPRing = &Xhc->TransferRingOut;
+ }
+
+ Urb->Ring = (EFI_PHYSICAL_ADDRESS)(UINTN) EPRing;
+ //
+ // Construct the TRB for ED_BULK_OUT and ED_BULK_IN
+ //
+ XhcSyncTrsRing (Xhc, EPRing);
+
+ Urb->TrbStart = EPRing->RingEnqueue;
+
+ TotalLen = 0;
+ Len = 0;
+ TrbNum = 0;
+ TrbStart = (TRB *)(UINTN)EPRing->RingEnqueue;
+
+ while (TotalLen < Urb->DataLen) {
+ if ((TotalLen + 0x10000) >= Urb->DataLen) {
+ Len = Urb->DataLen - TotalLen;
+ } else {
+ Len = 0x10000;
+ }
+ TrbStart = (TRB *)(UINTN)EPRing->RingEnqueue;
+ TrbStart->TrbNormal.TRBPtrLo = XHC_LOW_32BIT(Urb->Data + TotalLen);
+ TrbStart->TrbNormal.TRBPtrHi = XHC_HIGH_32BIT(Urb->Data + TotalLen);
+ TrbStart->TrbNormal.Length = Len;
+ TrbStart->TrbNormal.TDSize = 0;
+ TrbStart->TrbNormal.IntTarget = 0;
+ TrbStart->TrbNormal.ISP = 1;
+ TrbStart->TrbNormal.IOC = 1;
+ TrbStart->TrbNormal.Type = TRB_TYPE_NORMAL;
+
+ //
+ // Update the cycle bit
+ //
+ TrbStart->TrbNormal.CycleBit = EPRing->RingPCS & BIT0;
+
+ XhcSyncTrsRing (Xhc, EPRing);
+ TrbNum++;
+ TotalLen += Len;
+ }
+
+ Urb->TrbNum = TrbNum;
+
+ //
+ // Update to the last TRB
+ //
+ Urb->TrbEnd = (EFI_PHYSICAL_ADDRESS)(UINTN) TrbStart;
+ return EFI_SUCCESS;
+}
+
+/**
+ Create a new URB for a new transaction.
+
+ @param Xhc The XHCI Instance
+ @param Direction The direction of data flow.
+ @param Data The user data to transfer
+ @param DataLen The length of data buffer
+
+ @return Created URB or NULL
+
+**/
+URB*
+XhcCreateUrb (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN EFI_USB_DATA_DIRECTION Direction,
+ IN VOID *Data,
+ IN UINTN DataLen
+ )
+{
+ EFI_STATUS Status;
+ URB *Urb;
+ EFI_PHYSICAL_ADDRESS DataAddress;
+
+ Urb = &Xhc->Urb;
+ ASSERT (Urb->Data != 0);
+ DataAddress = Urb->Data;
+ ZeroMem (Urb, sizeof (URB));
+
+ Urb->Signature = USB3_DEBUG_PORT_INSTANCE_SIGNATURE;
+ Urb->Direction = Direction;
+ Urb->Data = DataAddress;
+
+ ZeroMem ((VOID*)(UINTN) Urb->Data, DataLen);
+ CopyMem ((VOID*)(UINTN) Urb->Data, Data, DataLen);
+
+ Urb->DataLen = (UINT32) DataLen;
+ Status = XhcCreateTransferTrb (Xhc, Urb);
+ ASSERT_EFI_ERROR (Status);
+
+ return Urb;
+}
+
+/**
+ Submits bulk transfer to a bulk endpoint of a USB device.
+
+ @param Xhc The instance of debug device.
+ @param Direction The direction of data transfer.
+ @param Data Array of pointers to the buffers of data to transmit
+ from or receive into.
+ @param DataLength The lenght of the data buffer.
+ @param Timeout Indicates the maximum time, in millisecond, which
+ the transfer is allowed to complete.
+ @param TransferResult Transfer result.
+
+ @retval EFI_SUCCESS The transfer was completed successfully.
+ @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.
+ @retval EFI_TIMEOUT The transfer failed due to timeout.
+ @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.
+
+**/
+EFI_STATUS
+EFIAPI
+XhcDataTransfer (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN EFI_USB_DATA_DIRECTION Direction,
+ IN OUT VOID *Data,
+ IN OUT UINTN *DataLength,
+ IN UINTN Timeout,
+ OUT UINT32 *TransferResult
+ )
+{
+ URB *Urb;
+ EFI_STATUS Status;
+
+ //
+ // Validate the parameters
+ //
+ if ((DataLength == NULL) || (*DataLength == 0) ||
+ (Data == NULL) || (TransferResult == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *TransferResult = EFI_USB_ERR_SYSTEM;
+ Status = EFI_DEVICE_ERROR;
+
+ //
+ // Create a new URB, insert it into the asynchronous
+ // schedule list, then poll the execution status.
+ //
+ Urb = XhcCreateUrb (Xhc, Direction, Data, *DataLength);
+
+ if (Urb == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto ON_EXIT;
+ }
+
+ Status = XhcExecTransfer (Xhc, Urb, Timeout);
+
+ *TransferResult = Urb->Result;
+ *DataLength = Urb->Completed;
+
+ if (*TransferResult == EFI_USB_NOERROR) {
+ Status = EFI_SUCCESS;
+ }
+
+ON_EXIT:
+
+ return Status;
+}
+
+/**
+ Check whether the MMIO Bar is within any of the SMRAM ranges.
+
+ @param[in] XhcMmioBase The address of the MMIO to be checked.
+
+ @retval TURE The XHCI MMIO is in SMRAM ranges.
+ @retval FALSE The XHCI MMIO is out of SMRAM ranges.
+**/
+BOOLEAN
+EFIAPI
+Usb3DebugIsAddressInSmram (
+ IN EFI_PHYSICAL_ADDRESS XhcMmioBase
+ )
+{
+ UINTN Index;
+
+ if (mSmramCheckRangeCount == 0) {
+ //
+ // When we invoke this function, we are already in SMM mode,
+ // but SmmAccess->GetCapabilities failed which kept mSmramCheckRanges as 0.
+ //
+ return TRUE;
+ }
+
+ for (Index = 0; Index < mSmramCheckRangeCount; Index ++) {
+ if (((XhcMmioBase >= mSmramCheckRanges[Index].CpuStart) && (XhcMmioBase < mSmramCheckRanges[Index].CpuStart + mSmramCheckRanges[Index].PhysicalSize)) ||
+ ((mSmramCheckRanges[Index].CpuStart >= XhcMmioBase) && (mSmramCheckRanges[Index].CpuStart < XhcMmioBase + mUsb3MmioSize))) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+/**
+ Transfer data via XHC controller.
+
+ @param Data Data buffer.
+ @param Length Data length.
+ @param Direction Transfer direction.
+
+**/
+VOID
+Usb3DebugPortDataTransfer (
+ UINT8 *Data,
+ UINTN *Length,
+ EFI_USB_DATA_DIRECTION Direction
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+ UINT16 Command;
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT32 TransferResult;
+ UINT32 Dcctrl;
+ EFI_PHYSICAL_ADDRESS UsbBase;
+ UINTN BytesToSend;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ EFI_STATUS Status;
+ USB3_DEBUG_PORT_INSTANCE UsbDbgInstance;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+
+ //
+ // MMIO base address is possible to clear, set it if it is cleared. (XhciMemorySpaceClose in PchUsbCommon.c)
+ //
+ XhcMmioBase = GetXhciBaseAddress ();
+ Command = GetXhciPciCommand ();
+
+ if ((XhcMmioBase == 0) || (XhcMmioBase == XHCI_BASE_ADDRESS_64_BIT_MASK)) {
+ //
+ // XHCI device MMIO base is cleared by someone, set it again
+ //
+ UsbBase = PcdGet32 (PcdXhciDefaultBaseAddress);
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET), (UINT32)UsbBase);
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4), 0x0);
+ UsbBase = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET)) & XHCI_BASE_ADDRESS_32_BIT_MASK;
+ if (UsbBase == 0 || UsbBase == XHCI_BASE_ADDRESS_32_BIT_MASK) {
+ return;
+ }
+ }
+
+ //
+ // Check if XHC debug MMIO range is in SMRAM
+ //
+ if ((mUsb3InSmm) && (Usb3DebugIsAddressInSmram (XhcMmioBase))) {
+ return;
+ }
+
+ //
+ // Save and set Command Register
+ //
+ if (((Command & EFI_PCI_COMMAND_MEMORY_SPACE) == 0) || ((Command & EFI_PCI_COMMAND_BUS_MASTER) == 0)) {
+ PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER);
+ PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ }
+
+ Instance = GetUsb3DebugPortInstance ();
+
+ if (Instance != NULL) {
+ if (!Instance->DebugSupport) {
+ //
+ // Debug device is not supported by XHCI, return
+ //
+ goto Done;
+ }
+ }
+
+ if ((Instance != NULL) && (Instance->Ready)) {
+ //
+ // Debug device is broken suddently (e.g. Windows OS), return
+ //
+ Dcctrl = XhcReadDebugReg (Instance, XHC_DC_DCCTRL);
+ if ((Dcctrl & BIT0) == 0) {
+ goto Done;
+ }
+ }
+
+ if ((Instance != NULL) && (!Instance->Ready)) {
+ //
+ // Debug host does not connect with target
+ //
+ goto Done;
+ }
+
+ if (Instance == NULL) {
+ ZeroMem (&UsbDbgInstance, sizeof (USB3_DEBUG_PORT_INSTANCE));
+ DiscoverUsb3DebugPort (&UsbDbgInstance);
+ if (UsbDbgInstance.DebugSupport) {
+ if (!IsAllocatePagesReady ()) {
+ //
+ // AllocatePages can not work, return
+ //
+ goto Done;
+ }
+ }
+ Status = USB3InitializeReal ();
+ if (EFI_ERROR (Status)) {
+ //
+ // Debug device is failed to initialize
+ //
+ goto Done;
+ }
+
+ //
+ // Update instance
+ //
+ Instance = GetUsb3DebugPortInstance ();
+
+ if (Instance == NULL) {
+ //
+ // Debug device instance is failed to create
+ //
+ goto Done;
+ }
+
+ if ((!Instance->Ready) || (!Instance->DebugSupport)) {
+ //
+ // Debug host does not connect at first or is not supported
+ //
+ goto Done;
+ }
+ }
+
+ BytesToSend = 0;
+ while (*Length > 0) {
+ BytesToSend = ((*Length) > XHC_DEBUG_PORT_DATA_LENGTH) ? XHC_DEBUG_PORT_DATA_LENGTH : *Length;
+ XhcDataTransfer (
+ Instance,
+ Direction,
+ Data,
+ &BytesToSend,
+ DATA_TRANSFER_TIME_OUT,
+ &TransferResult
+ );
+ if (TransferResult != EFI_USB_NOERROR) {
+ break;
+ }
+ *Length -= BytesToSend;
+ Data += BytesToSend;
+ }
+
+Done:
+ //
+ // Restore Command Register
+ //
+ PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command);
+
+}
+
+/**
+ Receive data over the USB3 debug cable.
+
+ @param[out] Data Pointer to data
+ @param[in, out] Length Pointer to data length
+
+**/
+RETURN_STATUS
+Usb3DbgIn (
+ OUT UINT8 *Data,
+ IN OUT UINTN *Length
+ )
+{
+ Usb3DebugPortDataTransfer (Data, Length, EfiUsbDataIn);
+ return EFI_SUCCESS;
+}
+
+/**
+ Send data over the USB3 debug cable.
+
+ @param[out] Data Pointer to data
+ @param[in, out] Length Pointer to data length
+
+**/
+VOID
+Usb3DbgOut (
+ OUT UINT8 *Data,
+ IN OUT UINTN *Length
+ )
+{
+ Usb3DebugPortDataTransfer (Data, Length, EfiUsbDataOut);
+}
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c
new file mode 100644
index 0000000000..37924b0b76
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c
@@ -0,0 +1,726 @@
+/** @file
+ Usb3 Debug Port initialization
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <PiPei.h>
+#include <Library/SerialPortLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PciLib.h>
+#include <Library/PcdLib.h>
+#include <Library/TimerLib.h>
+#include <Library/HobLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+#include "Usb3DebugPortLibInternal.h"
+
+UINT16 mString0Desc[] = {
+ // String Descriptor Type + Length
+ ( USB_DESC_TYPE_STRING << 8 ) + STRING0_DESC_LEN,
+ 0x0409
+};
+
+UINT16 mManufacturerStrDesc[] = {
+ // String Descriptor Type + Length
+ ( USB_DESC_TYPE_STRING << 8 ) + MANU_DESC_LEN,
+ 'I', 'n', 't', 'e', 'l'
+};
+
+//USB 3.0 Debug Cable
+UINT16 mProductStrDesc[] = {
+ // String Descriptor Type + Length
+ ( USB_DESC_TYPE_STRING << 8 ) + PRODUCT_DESC_LEN,
+ 'U', 'S', 'B', ' ', '3', '.', '0', ' ', 'D', 'e', 'b', 'u', 'g', ' ', 'C', 'a', 'b', 'l', 'e'
+};
+
+UINT16 mSerialNumberStrDesc[] = {
+ // String Descriptor Type + Length
+ ( USB_DESC_TYPE_STRING << 8 ) + SERIAL_DESC_LEN,
+ '1'
+};
+
+XHC_DC_CONTEXT DebugCapabilityContextTemplate = {
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ STRING0_DESC_LEN,
+ MANU_DESC_LEN,
+ PRODUCT_DESC_LEN,
+ SERIAL_DESC_LEN,
+ 0,
+ 0,
+ 0,
+ 0
+ },
+ {
+ 0, // EPState
+ 0, // RsvdZ1
+ 0, // Mult
+ 0, // MaxPStreams
+ 0, // LSA
+ 0, // Interval
+ 0, // RsvdZ2
+ 0, // RsvdZ3
+ 3, // CERR
+ ED_BULK_OUT, // EPType
+ 0, // RsvdZ4
+ 0, // HID
+ 0, // MaxBurstSize
+ 1024, // MaxPacketSize
+ 0, // PtrLo
+ 0, // PtrHi
+ 0x1000, // AverageTRBLength
+ 0, // MaxESITPayload
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ },
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 3, //CERR
+ ED_BULK_IN,
+ 0,
+ 0,
+ 0,
+ 1024, //MaxPacketSize
+ 0,
+ 0,
+ 0x1000,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ }
+};
+
+/**
+ Return command register value in XHCI controller.
+
+**/
+UINT16
+GetXhciPciCommand (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT16 Command;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+ Command = PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ return Command;
+}
+
+/**
+ Discover the USB3 debug device.
+
+ @param[in] Instance Pointer to USB3 debug port object instance.
+
+ @retval RETURN_SUCCESS The USB3 debug device was found.
+ @retval RETURN_DEVICE_ERROR The USB3 debug device was not found.
+
+**/
+RETURN_STATUS
+DiscoverUsb3DebugPort(
+ IN USB3_DEBUG_PORT_INSTANCE *Instance
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT16 Command;
+ EFI_PHYSICAL_ADDRESS UsbBase;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ EFI_PHYSICAL_ADDRESS CapabilityPointer;
+ UINT32 Capability;
+ BOOLEAN Flag;
+ UINT8 CapLength;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+ if ((PciRead8(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_CLASSCODE_OFFSET + 2)) != PCI_CLASS_SERIAL) ||
+ (PciRead8(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_CLASSCODE_OFFSET + 1)) != PCI_CLASS_SERIAL_USB) ||
+ (PciRead8(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_CLASSCODE_OFFSET)) != 0x30)) {
+ //
+ // The device is not XHCI controller
+ //
+ return RETURN_NOT_FOUND;
+ }
+
+ //
+ // USBBASE is at 10-13h, i.e. the first BAR, clear the low bits which is not part of base address
+ //
+ UsbBase = GetXhciBaseAddress ();
+
+ //
+ // Set XHCI MMIO base address if necessary
+ //
+ if ((UsbBase == 0) || (UsbBase == XHCI_BASE_ADDRESS_64_BIT_MASK)) {
+ UsbBase = PcdGet32 (PcdXhciDefaultBaseAddress);
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET), (UINT32)UsbBase);
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4), 0x0);
+ UsbBase = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET)) & XHCI_BASE_ADDRESS_32_BIT_MASK;
+ if (UsbBase == 0 || UsbBase == XHCI_BASE_ADDRESS_32_BIT_MASK) {
+ return RETURN_DEVICE_ERROR;
+ }
+ }
+
+ //
+ // Set MSE and BME bit - enable the address space
+ //
+ Command = PciRead16 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) == 0) {
+ PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE);
+ PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ }
+
+ CapLength = MmioRead8 ((UINTN) UsbBase);
+
+ //
+ // Get capability pointer from HCCPARAMS at offset 0x10
+ //
+ CapabilityPointer = UsbBase + (MmioRead32 ((UINTN)(UsbBase + XHC_HCCPARAMS_OFFSET)) >> 16) * 4;
+
+ //
+ // Search XHCI debug capability
+ //
+ Flag = FALSE;
+ Capability = MmioRead32 ((UINTN)CapabilityPointer);
+ while (TRUE) {
+ if ((Capability & XHC_CAPABILITY_ID_MASK) == PCI_CAPABILITY_ID_DEBUG_PORT) {
+ Flag = TRUE;
+ break;
+ }
+ if ((((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) & XHC_CAPABILITY_ID_MASK) == 0) {
+ //
+ // Reach the end of capability list, quit
+ //
+ break;
+ }
+ CapabilityPointer += ((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) * 4;
+ Capability = MmioRead32 ((UINTN)CapabilityPointer);
+ }
+
+ Instance->Signature = USB3_DEBUG_PORT_INSTANCE_SIGNATURE;
+
+ if (Flag) {
+ Instance->DebugSupport = TRUE;
+ Instance->DebugCapabilityBase = CapabilityPointer;
+ Instance->DebugCapabilityOffset = CapabilityPointer - UsbBase;
+
+ Instance->XhciOpRegister = UsbBase + CapLength;
+ Instance->XhcMmioBase = UsbBase;
+
+ Instance->PciBusNumber = Bus;
+ Instance->PciDeviceNumber = Device;
+ Instance->PciFunctionNumber = Function;
+ }
+
+ //
+ // Restore Command Register
+ //
+ PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command);
+
+ return RETURN_SUCCESS;
+}
+
+/**
+ Create XHCI event ring.
+
+ @param Xhc The XHCI Instance.
+ @param EventRing The created event ring.
+
+**/
+EFI_STATUS
+CreateEventRing (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ OUT EVENT_RING *EventRing
+ )
+{
+ VOID *Buf;
+ EVENT_RING_SEG_TABLE_ENTRY *ERSTBase;
+
+ ASSERT (EventRing != NULL);
+
+ //
+ // Allocate Event Ring
+ //
+ Buf = AllocateAlignBuffer (sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMBER);
+ ASSERT (Buf != NULL);
+ ASSERT (((UINTN) Buf & 0x3F) == 0);
+ ZeroMem (Buf, sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMBER);
+
+ EventRing->EventRingSeg0 = (EFI_PHYSICAL_ADDRESS)(UINTN) Buf;
+ EventRing->TrbNumber = EVENT_RING_TRB_NUMBER;
+ EventRing->EventRingDequeue = (EFI_PHYSICAL_ADDRESS)(UINTN) EventRing->EventRingSeg0;
+ EventRing->EventRingEnqueue = (EFI_PHYSICAL_ADDRESS)(UINTN) EventRing->EventRingSeg0;
+
+ //
+ // Software maintains an Event Ring Consumer Cycle State (CCS) bit, initializing it to '1'
+ // and toggling it every time the Event Ring Dequeue Pointer wraps back to the beginning of the Event Ring.
+ //
+ EventRing->EventRingCCS = 1;
+
+ //
+ // Allocate Event Ring Segment Table Entry 0 in Event Ring Segment Table
+ //
+ Buf = AllocateAlignBuffer (sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERST_NUMBER);
+ ASSERT (Buf != NULL);
+ ASSERT (((UINTN) Buf & 0x3F) == 0);
+ ZeroMem (Buf, sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERST_NUMBER);
+
+ ERSTBase = (EVENT_RING_SEG_TABLE_ENTRY *) Buf;
+ EventRing->ERSTBase = (EFI_PHYSICAL_ADDRESS)(UINTN) ERSTBase;
+
+ //
+ // Fill Event Segment address
+ //
+ ERSTBase->PtrLo = XHC_LOW_32BIT (EventRing->EventRingSeg0);
+ ERSTBase->PtrHi = XHC_HIGH_32BIT (EventRing->EventRingSeg0);
+ ERSTBase->RingTrbSize = EVENT_RING_TRB_NUMBER;
+
+ //
+ // Program the Interrupter Event Ring Dequeue Pointer (DCERDP) register (7.6.4.1)
+ //
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCERDP,
+ XHC_LOW_32BIT((UINT64)(UINTN)EventRing->EventRingDequeue)
+ );
+
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCERDP + 4,
+ XHC_HIGH_32BIT((UINT64)(UINTN)EventRing->EventRingDequeue)
+ );
+
+ //
+ // Program the Debug Capability Event Ring Segment Table Base Address (DCERSTBA) register(7.6.4.1)
+ //
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCERSTBA,
+ XHC_LOW_32BIT((UINT64)(UINTN)ERSTBase)
+ );
+
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCERSTBA + 4,
+ XHC_HIGH_32BIT((UINT64)(UINTN)ERSTBase)
+ );
+
+ //
+ // Program the Debug Capability Event Ring Segment Table Size (DCERSTSZ) register(7.6.4.1)
+ //
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCERSTSZ,
+ ERST_NUMBER
+ );
+ return EFI_SUCCESS;
+}
+
+/**
+ Create XHCI transfer ring.
+
+ @param Xhc The XHCI Instance.
+ @param TrbNum The number of TRB in the ring.
+ @param TransferRing The created transfer ring.
+
+**/
+VOID
+CreateTransferRing (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 TrbNum,
+ OUT TRANSFER_RING *TransferRing
+ )
+{
+ VOID *Buf;
+ LINK_TRB *EndTrb;
+
+ Buf = AllocateAlignBuffer (sizeof (TRB_TEMPLATE) * TrbNum);
+ ASSERT (Buf != NULL);
+ ASSERT (((UINTN) Buf & 0xF) == 0);
+ ZeroMem (Buf, sizeof (TRB_TEMPLATE) * TrbNum);
+
+ TransferRing->RingSeg0 = (EFI_PHYSICAL_ADDRESS)(UINTN) Buf;
+ TransferRing->TrbNumber = TrbNum;
+ TransferRing->RingEnqueue = TransferRing->RingSeg0;
+ TransferRing->RingDequeue = TransferRing->RingSeg0;
+ TransferRing->RingPCS = 1;
+ //
+ // 4.9.2 Transfer Ring Management
+ // To form a ring (or circular queue) a Link TRB may be inserted at the end of a ring to
+ // point to the first TRB in the ring.
+ //
+ EndTrb = (LINK_TRB *) ((UINTN)Buf + sizeof (TRB_TEMPLATE) * (TrbNum - 1));
+ EndTrb->Type = TRB_TYPE_LINK;
+ EndTrb->PtrLo = XHC_LOW_32BIT (Buf);
+ EndTrb->PtrHi = XHC_HIGH_32BIT (Buf);
+ //
+ // Toggle Cycle (TC). When set to '1', the xHC shall toggle its interpretation of the Cycle bit.
+ //
+ EndTrb->TC = 1;
+ //
+ // Set Cycle bit as other TRB PCS init value
+ //
+ EndTrb->CycleBit = 0;
+}
+
+/**
+ Create debug capability context for XHC debug device.
+
+ @param Xhc The XHCI Instance.
+
+ @retval EFI_SUCCESS The bit successfully changed by host controller.
+ @retval EFI_TIMEOUT The time out occurred.
+
+**/
+EFI_STATUS
+CreateDebugCapabilityContext (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc
+ )
+{
+ VOID *Buf;
+ XHC_DC_CONTEXT *DebugCapabilityContext;
+ UINT8 *String0Desc;
+ UINT8 *ManufacturerStrDesc;
+ UINT8 *ProductStrDesc;
+ UINT8 *SerialNumberStrDesc;
+
+ //
+ // Allocate debug device context
+ //
+ Buf = AllocateAlignBuffer (sizeof (XHC_DC_CONTEXT));
+ ASSERT (Buf != NULL);
+ ASSERT (((UINTN) Buf & 0xF) == 0);
+ ZeroMem (Buf, sizeof (XHC_DC_CONTEXT));
+
+ DebugCapabilityContext = (XHC_DC_CONTEXT *)(UINTN) Buf;
+ Xhc->DebugCapabilityContext = (EFI_PHYSICAL_ADDRESS)(UINTN) DebugCapabilityContext;
+
+ CopyMem (DebugCapabilityContext, &DebugCapabilityContextTemplate, sizeof (XHC_DC_CONTEXT));
+
+ //
+ // Update string descriptor address
+ //
+ String0Desc = (UINT8 *) AllocateAlignBuffer (STRING0_DESC_LEN + MANU_DESC_LEN + PRODUCT_DESC_LEN + SERIAL_DESC_LEN);
+ ASSERT (String0Desc != NULL);
+ ZeroMem (String0Desc, STRING0_DESC_LEN + MANU_DESC_LEN + PRODUCT_DESC_LEN + SERIAL_DESC_LEN);
+ CopyMem (String0Desc, mString0Desc, STRING0_DESC_LEN);
+ DebugCapabilityContext->DbcInfoContext.String0DescAddress = (UINT64)(UINTN)String0Desc;
+
+ ManufacturerStrDesc = String0Desc + STRING0_DESC_LEN;
+ CopyMem (ManufacturerStrDesc, mManufacturerStrDesc, MANU_DESC_LEN);
+ DebugCapabilityContext->DbcInfoContext.ManufacturerStrDescAddress = (UINT64)(UINTN)ManufacturerStrDesc;
+
+ ProductStrDesc = ManufacturerStrDesc + MANU_DESC_LEN;
+ CopyMem (ProductStrDesc, mProductStrDesc, PRODUCT_DESC_LEN);
+ DebugCapabilityContext->DbcInfoContext.ProductStrDescAddress = (UINT64)(UINTN)ProductStrDesc;
+
+ SerialNumberStrDesc = ProductStrDesc + PRODUCT_DESC_LEN;
+ CopyMem (SerialNumberStrDesc, mSerialNumberStrDesc, SERIAL_DESC_LEN);
+ DebugCapabilityContext->DbcInfoContext.SerialNumberStrDescAddress = (UINT64)(UINTN)SerialNumberStrDesc;
+
+ //
+ // Allocate and initialize the Transfer Ring for the Input Endpoint Context.
+ //
+ ZeroMem (&Xhc->TransferRingIn, sizeof (TRANSFER_RING));
+ CreateTransferRing (Xhc, TR_RING_TRB_NUMBER, &Xhc->TransferRingIn);
+
+ //
+ // Can not set BIT0, otherwise there is no transfer ring detected.
+ //
+ DebugCapabilityContext->EpInContext.PtrLo = XHC_LOW_32BIT (Xhc->TransferRingIn.RingSeg0) | BIT0;
+ DebugCapabilityContext->EpInContext.PtrHi = XHC_HIGH_32BIT (Xhc->TransferRingIn.RingSeg0);
+
+ //
+ // Allocate and initialize the Transfer Ring for the Output Endpoint Context.
+ //
+ ZeroMem (&Xhc->TransferRingOut, sizeof (TRANSFER_RING));
+ CreateTransferRing (Xhc, TR_RING_TRB_NUMBER, &Xhc->TransferRingOut);
+
+ //
+ // Can not set BIT0, otherwise there is no transfer ring detected.
+ //
+ DebugCapabilityContext->EpOutContext.PtrLo = XHC_LOW_32BIT (Xhc->TransferRingOut.RingSeg0) | BIT0;
+ DebugCapabilityContext->EpOutContext.PtrHi = XHC_HIGH_32BIT (Xhc->TransferRingOut.RingSeg0);
+
+ //
+ // Program the Debug Capability Context Pointer (DCCP) register(7.6.8.7)
+ //
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCCP,
+ XHC_LOW_32BIT((UINT64)(UINTN)DebugCapabilityContext)
+ );
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCCP + 4,
+ XHC_HIGH_32BIT((UINT64)(UINTN)DebugCapabilityContext)
+ );
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize the USB3 debug Device hardware.
+
+ @param[in] Instance Pointer to USB3 debug port object instance.
+
+ @retval RETURN_SUCCESS The USB3 debug device was initialized successfully.
+ @retval !RETURN_SUCCESS Error.
+
+**/
+RETURN_STATUS
+InitializeUsb3DebugPort (
+ IN USB3_DEBUG_PORT_INSTANCE *Instance
+ )
+{
+ RETURN_STATUS Status;
+ UINT64 XhciOpRegister;
+ volatile UINT32 Dcctrl;
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT16 Command;
+ EFI_BOOT_MODE BootMode;
+ UINT64 TimeOut;
+ CHAR8 *TestString;
+ UINTN Length;
+ UINT32 TransferResult;
+
+ Bus = Instance->PciBusNumber;
+ Device = Instance->PciDeviceNumber;
+ Function = Instance->PciFunctionNumber;
+
+ Command = GetXhciPciCommand ();
+
+ //
+ // Save and set Command Register
+ //
+ if (((Command & EFI_PCI_COMMAND_MEMORY_SPACE) == 0) || ((Command & EFI_PCI_COMMAND_BUS_MASTER) == 0)) {
+ PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER);
+ PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ }
+
+ //
+ // Clear DCE bit and LSE bit in DCCTRL
+ //
+ if ((XhcReadDebugReg (Instance, XHC_DC_DCCTRL) & (BIT1|BIT31)) == (BIT1|BIT31)) {
+ XhcClearDebugRegBit (Instance, XHC_DC_DCCTRL, BIT1|BIT31);
+ }
+
+ XhciOpRegister = Instance->XhciOpRegister;
+
+ //
+ // Get current Boot Mode
+ //
+ BootMode = GetBootModeHob ();
+
+ if (BootMode != BOOT_ON_S3_RESUME) {
+ if (!XhcIsBitSet((UINTN)(XhciOpRegister + XHC_USBSTS_OFFSET), XHC_USBSTS_HALT)) {
+ XhcClrR32Bit((UINTN) XhciOpRegister + XHC_USBCMD_OFFSET, XHC_USBCMD_RUN);
+ while (!XhcIsBitSet((UINTN)(XhciOpRegister + XHC_USBSTS_OFFSET), XHC_USBSTS_HALT)) {
+ MicroSecondDelay (10);
+ }
+ }
+
+ //
+ // Reset host controller
+ //
+ XhcSetR32Bit((UINTN)XhciOpRegister + XHC_USBCMD_OFFSET, XHC_USBCMD_RESET);
+
+ //
+ // Ensure that the host controller is reset (RESET bit must be cleared after reset)
+ //
+ while (XhcIsBitSet((UINTN)XhciOpRegister + XHC_USBCMD_OFFSET, XHC_USBCMD_RESET)) {
+ MicroSecondDelay (10);
+ }
+ }
+
+ //
+ // Initialize event ring
+ //
+ ZeroMem (&Instance->EventRing, sizeof (EVENT_RING));
+ Status = CreateEventRing (Instance, &Instance->EventRing);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Init IN and OUT endpoint context
+ //
+ Status = CreateDebugCapabilityContext (Instance);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Init data buffer used to transfer
+ //
+ Instance->Urb.Data = (EFI_PHYSICAL_ADDRESS) (UINTN) AllocateAlignBuffer (XHC_DEBUG_PORT_DATA_LENGTH);
+
+ //
+ // Init DCDDI1 and DCDDI2
+ //
+ XhcWriteDebugReg (
+ Instance,
+ XHC_DC_DCDDI1,
+ (UINT32)((XHCI_DEBUG_DEVICE_VENDOR_ID << 16) | XHCI_DEBUG_DEVICE_PROTOCOL)
+ );
+
+ XhcWriteDebugReg (
+ Instance,
+ XHC_DC_DCDDI2,
+ (UINT32)((XHCI_DEBUG_DEVICE_REVISION << 16) | XHCI_DEBUG_DEVICE_PRODUCT_ID)
+ );
+
+ //
+ // Set DCE bit and LSE bit to "1" in DCCTRL
+ //
+ XhcSetDebugRegBit (Instance, XHC_DC_DCCTRL, BIT1|BIT31);
+
+ TimeOut = DivU64x32 (PcdGet64 (PcdXhciHostWaitTimeout), XHC_POLL_DELAY) + 1;
+ while (TimeOut != 0) {
+ //
+ // Check if debug device is in configured state
+ //
+ Dcctrl = XhcReadDebugReg (Instance, XHC_DC_DCCTRL);
+ if ((Dcctrl & BIT0) != 0) {
+ //
+ // Set the flag to indicate debug device is ready
+ //
+ Instance->Ready = TRUE;
+ break;
+ }
+ MicroSecondDelay (XHC_POLL_DELAY);
+ TimeOut--;
+ }
+
+ if (!Instance->Ready) {
+ XhcClearDebugRegBit (Instance, XHC_DC_DCCTRL, BIT1|BIT31);
+ } else {
+ TestString = "Usb 3.0 Debug Message Start\n";
+ Length = AsciiStrLen (TestString);
+ XhcDataTransfer (
+ Instance,
+ EfiUsbDataOut,
+ TestString,
+ &Length,
+ 0,
+ &TransferResult
+ );
+ }
+
+ //
+ // Restore Command Register
+ //
+ PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Update XHC hardware address when MMIO base is changed.
+
+ @param Instance The XHCI Instance.
+ @param XhcMmioBase XHCI MMIO base address.
+
+**/
+VOID
+FixUsb3InstanceResource (
+ IN OUT USB3_DEBUG_PORT_INSTANCE *Instance,
+ IN EFI_PHYSICAL_ADDRESS XhcMmioBase
+ )
+{
+ if ((Instance == NULL) || (Instance->XhcMmioBase == XhcMmioBase)) {
+ return;
+ }
+
+ //
+ // Need fix Instance data according to PCI resource
+ //
+ Instance->XhcMmioBase = XhcMmioBase;
+ Instance->DebugCapabilityBase = XhcMmioBase + Instance->DebugCapabilityOffset;
+ Instance->XhciOpRegister = XhcMmioBase + MmioRead8 ((UINTN)XhcMmioBase);
+}
+
+/**
+ Save USB3 instance address.
+
+ @param[in] Instance The XHCI Instance.
+
+**/
+VOID
+SaveUsb3InstanceAddress (
+ IN USB3_DEBUG_PORT_INSTANCE *Instance
+ )
+{
+ UINT16 Command;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+
+ Command = GetXhciPciCommand ();
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+
+ //
+ // Set Command Register
+ //
+ if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) == 0) {
+ PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE);
+ PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ }
+
+ //
+ // After debug device is finished to enumerate, use DCDDI2 register to store instance address
+ //
+ XhcWriteDebugReg (
+ Instance,
+ XHC_DC_DCDDI2,
+ (UINT32)(UINTN)Instance
+ );
+
+ //
+ // Restore Command Register
+ //
+ PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command);
+}
+
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c
new file mode 100644
index 0000000000..53572f934b
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c
@@ -0,0 +1,454 @@
+/** @file
+ Usb3 Debug Port library instance
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <PiDxe.h>
+#include <Library/SerialPortLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+#include <Library/PciLib.h>
+#include <Library/PcdLib.h>
+#include <Library/TimerLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+#include <Protocol/SmmBase2.h>
+#include <Protocol/SmmAccess2.h>
+#include "Usb3DebugPortLibInternal.h"
+
+extern EFI_SMRAM_DESCRIPTOR mSmramCheckRanges[MAX_SMRAM_RANGE];
+extern UINTN mSmramCheckRangeCount;
+extern BOOLEAN mUsb3InSmm;
+extern UINT64 mUsb3MmioSize;
+extern BOOLEAN mUsb3GetCapSuccess;
+
+GUID gUsb3DbgGuid = USB3_DBG_GUID;
+
+USB3_DEBUG_PORT_CONTROLLER mUsb3DebugPort;
+USB3_DEBUG_PORT_INSTANCE *mUsb3Instance = NULL;
+
+/**
+ Return XHCI MMIO base address.
+
+**/
+EFI_PHYSICAL_ADDRESS
+GetXhciBaseAddress (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ EFI_PHYSICAL_ADDRESS Address;
+ UINT32 Low;
+ UINT32 High;
+
+ if (mUsb3DebugPort.Controller == 0) {
+ mUsb3DebugPort.Controller = GetUsb3DebugPortController();
+ }
+
+ Bus = mUsb3DebugPort.PciAddress.Bus;
+ Device = mUsb3DebugPort.PciAddress.Device;
+ Function = mUsb3DebugPort.PciAddress.Function;
+
+ Low = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET));
+ High = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4));
+ Address = (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Low);
+ //
+ // Mask other parts which are not part of base address
+ //
+ Address &= XHCI_BASE_ADDRESS_64_BIT_MASK;
+ return Address;
+}
+
+/**
+ Return XHCI debug instance address.
+
+**/
+USB3_DEBUG_PORT_INSTANCE *
+GetUsb3DebugPortInstance (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+ UINT64 CapabilityPointer;
+ UINT32 Capability;
+ BOOLEAN Flag;
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT16 Command;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+
+ Instance = NULL;
+
+ XhcMmioBase = GetXhciBaseAddress ();
+
+ if ((XhcMmioBase == 0) || (XhcMmioBase == XHCI_BASE_ADDRESS_64_BIT_MASK)) {
+ return NULL;
+ }
+
+ if (mUsb3Instance != NULL) {
+ FixUsb3InstanceResource (mUsb3Instance, XhcMmioBase);
+ return mUsb3Instance;
+ }
+
+ Command = GetXhciPciCommand ();
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+
+ //
+ // Set Command Register
+ //
+ if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) == 0) {
+ PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE);
+ PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ }
+
+ //
+ // Calculate capability offset from HCCPARAMS [16:31], in 32-bit words
+ //
+ CapabilityPointer = XhcMmioBase + (MmioRead32 ((UINTN)(XhcMmioBase + XHC_HCCPARAMS_OFFSET)) >> 16) * 4;
+
+ //
+ // Search XHCI debug capability
+ //
+ Flag = FALSE;
+ Capability = MmioRead32 ((UINTN)CapabilityPointer);
+ while (TRUE) {
+ if ((Capability & XHC_CAPABILITY_ID_MASK) == PCI_CAPABILITY_ID_DEBUG_PORT) {
+ Flag = TRUE;
+ break;
+ }
+ if ((((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) & XHC_CAPABILITY_ID_MASK) == 0) {
+ //
+ // Reach the end of list, quit
+ //
+ break;
+ }
+ CapabilityPointer += ((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) * 4;
+ Capability = MmioRead32 ((UINTN)CapabilityPointer);
+ }
+
+ if (Flag) {
+ Instance = (USB3_DEBUG_PORT_INSTANCE *)(UINTN) MmioRead32 ((UINTN) (CapabilityPointer + XHC_DC_DCDDI2));
+
+ if (Instance != NULL) {
+ FixUsb3InstanceResource (Instance, XhcMmioBase);
+ }
+ }
+
+ //
+ // Restore Command Register
+ //
+ PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command);
+
+ return Instance;
+}
+
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The USB3 debug port was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3Initialize (
+ VOID
+ )
+{
+ //
+ // Leave it empty, we assume PEI phase already do initialization
+ //
+ return RETURN_SUCCESS;
+}
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3InitializeReal (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE UsbDbg;
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PHYSICAL_ADDRESS Address;
+ EFI_STATUS Status;
+
+ if ((gST == NULL) || (gBS == NULL)) {
+ //
+ // gST and gBS have not been initialized yet
+ //
+ return EFI_DEVICE_ERROR;
+ }
+
+ Status = EfiGetSystemConfigurationTable (&gUsb3DbgGuid, (VOID **) &mUsb3Instance);
+ if (!EFI_ERROR (Status)) {
+ return RETURN_SUCCESS;
+ }
+
+ //
+ // It is first time to run DXE instance, copy Instance from Hob to ACPINvs
+ // NOTE: Hob is not ready at this time, so copy it from XHCI register.
+ //
+ Instance = GetUsb3DebugPortInstance ();
+ if (Instance == NULL) {
+ //
+ // Initialize USB debug
+ //
+ SetMem (&UsbDbg, sizeof(UsbDbg), 0);
+ DiscoverUsb3DebugPort (&UsbDbg);
+ if (UsbDbg.DebugSupport) {
+ InitializeUsb3DebugPort (&UsbDbg);
+ }
+ Instance = &UsbDbg;
+ }
+ Address = SIZE_4GB;
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiACPIMemoryNVS,
+ EFI_SIZE_TO_PAGES (sizeof (USB3_DEBUG_PORT_INSTANCE)),
+ &Address
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ CopyMem (
+ (VOID *)(UINTN)Address,
+ Instance,
+ sizeof (USB3_DEBUG_PORT_INSTANCE)
+ );
+ mUsb3Instance = (USB3_DEBUG_PORT_INSTANCE *)(UINTN)Address;
+
+ Status = gBS->InstallConfigurationTable (&gUsb3DbgGuid, mUsb3Instance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (mUsb3Instance->DebugSupport) {
+ SaveUsb3InstanceAddress (mUsb3Instance);
+ }
+
+ return RETURN_SUCCESS;
+}
+
+/**
+ Calculate the size of XHCI MMIO space.
+
+ @retval TURE The XHCI MMIO is in SMRAM ranges.
+ @retval FALSE The XHCI MMIO is out of SMRAM ranges.
+**/
+UINT64
+CalculateMmioSize (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT32 Value;
+ UINT32 Mask;
+ UINT64 MmioSize;
+ UINT16 Command;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+
+ Mask = 0xFFFFFFF0;
+ MmioSize = 0;
+
+ XhcMmioBase = GetXhciBaseAddress ();
+
+ //
+ // Disable MSE
+ //
+ Command = PciRead16 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command & ~(EFI_PCI_COMMAND_MEMORY_SPACE));
+
+ //
+ // Get Mmio Size
+ //
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET), 0xFFFFFFFF);
+ Value = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET));
+
+ switch (Value & 0x07) {
+ case 0x0:
+ //
+ // Memory space: anywhere in 32 bit address space
+ //
+ MmioSize = (~(Value & Mask)) + 1;
+ break;
+ case 0x4:
+ //
+ // Memory space: anywhere in 64 bit address space
+ //
+ MmioSize = Value & Mask;
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4), 0xFFFFFFFF);
+ Value = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4));
+ //
+ // Fix the length to support some spefic 64 bit BAR
+ //
+ Value |= ((UINT32)(-1) << HighBitSet32 (Value));
+ //
+ // Calculate the size of 64bit bar
+ //
+ MmioSize |= LShiftU64 ((UINT64) Value, 32);
+ MmioSize = (~(MmioSize)) + 1;
+ break;
+ default:
+ //
+ // Unknown BAR type
+ //
+ MmioSize = (~(Value & Mask)) + 1;
+ break;
+ };
+
+
+ //
+ // Restore MMIO address
+ //
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET), (UINT32)XhcMmioBase);
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4), (UINT32) (XhcMmioBase >> 32));
+
+ PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE);
+
+ return MmioSize;
+}
+
+/**
+ The constructor function initialize USB3 debug port.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+Usb3DebugPortLibDxeConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_SMM_BASE2_PROTOCOL *SmmBase;
+ EFI_SMM_ACCESS2_PROTOCOL *SmmAccess;
+ UINTN Size;
+ EFI_STATUS Status;
+
+ //
+ // Do real initialization here, because we need copy data from Hob to ACPINvs.
+ // We must do it in constructor because it depends on UefiBootServicesTableLib.
+ //
+ if (FeaturePcdGet (PcdUsb3DebugFeatureEnable)) {
+ USB3InitializeReal ();
+ }
+
+ mUsb3MmioSize = CalculateMmioSize ();
+
+ if (gBS != NULL) {
+ SmmBase = NULL;
+ Status = gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID **)&SmmBase);
+ if (!EFI_ERROR (Status)) {
+ SmmBase->InSmm(SmmBase, &mUsb3InSmm);
+ }
+
+ if (mUsb3InSmm) {
+ //
+ // Get SMRAM information
+ //
+ SmmAccess = NULL;
+ Status = gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID **)&SmmAccess);
+ if (!EFI_ERROR (Status)) {
+ Size = sizeof (mSmramCheckRanges);
+
+ Status = SmmAccess->GetCapabilities (SmmAccess, &Size, mSmramCheckRanges);
+ if (!EFI_ERROR (Status)) {
+ mSmramCheckRangeCount = Size / sizeof (EFI_SMRAM_DESCRIPTOR);
+ }
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Allocate aligned memory for XHC's usage.
+
+ @param BufferSize The size, in bytes, of the Buffer.
+
+ @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID*
+AllocateAlignBuffer (
+ IN UINTN BufferSize
+ )
+{
+ VOID *Buf;
+ EFI_PHYSICAL_ADDRESS Address;
+ EFI_STATUS Status;
+
+ Buf = NULL;
+
+ if (gBS != NULL) {
+ Address = 0xFFFFFFFF;
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiACPIMemoryNVS,
+ EFI_SIZE_TO_PAGES (BufferSize),
+ &Address
+ );
+ if (!EFI_ERROR (Status)) {
+ Buf = (VOID *)(UINTN)Address;
+ }
+ }
+
+ return Buf;
+}
+
+/**
+ Check whether AllocatePages in permanent memory is ready.
+
+ @retval TRUE AllocatePages in permanent memory is ready.
+ @retval FALSE AllocatePages in permanent memory is not ready.
+
+**/
+BOOLEAN
+IsAllocatePagesReady (
+ VOID
+ )
+{
+ if (gBS != NULL) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c
new file mode 100644
index 0000000000..7d2b4fe18b
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c
@@ -0,0 +1,828 @@
+/** @file
+ Usb3 Debug Port library instance
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <PiDxe.h>
+#include <Library/SerialPortLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+#include <Library/PciLib.h>
+#include <Library/PcdLib.h>
+#include <Library/TimerLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+#include <Protocol/SmmBase2.h>
+#include <Protocol/SmmAccess2.h>
+#include <Protocol/IoMmu.h>
+#include <Protocol/PciIo.h>
+#include <Protocol/DxeSmmReadyToLock.h>
+#include "Usb3DebugPortLibInternal.h"
+
+extern EFI_SMRAM_DESCRIPTOR mSmramCheckRanges[MAX_SMRAM_RANGE];
+extern UINTN mSmramCheckRangeCount;
+extern BOOLEAN mUsb3InSmm;
+extern UINT64 mUsb3MmioSize;
+extern BOOLEAN mUsb3GetCapSuccess;
+
+GUID gUsb3DbgGuid = USB3_DBG_GUID;
+
+USB3_DEBUG_PORT_CONTROLLER mUsb3DebugPort;
+USB3_DEBUG_PORT_INSTANCE *mUsb3Instance = NULL;
+EFI_PCI_IO_PROTOCOL *mUsb3PciIo = NULL;
+
+/**
+ Creates a named event that can be signaled.
+
+ This function creates an event using NotifyTpl, NoifyFunction.
+ If Name is NULL, then ASSERT().
+ If NotifyTpl is not a legal TPL value, then ASSERT().
+ If NotifyFunction is NULL, then ASSERT().
+
+ @param Name Supplies the GUID name of the event.
+ @param NotifyTpl Supplies the task priority level of the event notifications.
+ @param NotifyFunction Supplies the function to notify when the event is signaled.
+ @param Event A pointer to the event created.
+
+ @retval EFI_SUCCESS A named event was created.
+ @retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.
+
+**/
+EFI_STATUS
+EFIAPI
+Usb3NamedEventListen (
+ IN CONST EFI_GUID *Name,
+ IN EFI_TPL NotifyTpl,
+ IN EFI_EVENT_NOTIFY NotifyFunction,
+ IN EFI_EVENT *Event
+ )
+{
+ EFI_STATUS Status;
+ VOID *RegistrationLocal;
+
+ ASSERT (Name != NULL);
+ ASSERT (NotifyFunction != NULL);
+ ASSERT (NotifyTpl <= TPL_HIGH_LEVEL);
+
+ //
+ // Create event
+ //
+ Status = gBS->CreateEvent (
+ EVT_NOTIFY_SIGNAL,
+ NotifyTpl,
+ NotifyFunction,
+ NULL,
+ Event
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Register for an installation of protocol interface
+ //
+ Status = gBS->RegisterProtocolNotify (
+ (EFI_GUID *) Name,
+ *Event,
+ &RegistrationLocal
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+/**
+ USB3 map one DMA buffer.
+
+ @param PciIo Pointer to PciIo for USB3 debug port.
+ @param Address DMA buffer address to be mapped.
+ @param NumberOfBytes Number of bytes to be mapped.
+
+**/
+VOID
+Usb3MapOneDmaBuffer (
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN EFI_PHYSICAL_ADDRESS Address,
+ IN UINTN NumberOfBytes
+ )
+{
+ EFI_STATUS Status;
+ VOID *HostAddress;
+ EFI_PHYSICAL_ADDRESS DeviceAddress;
+ VOID *Mapping;
+
+ HostAddress = (VOID *) (UINTN) Address;
+ Status = PciIo->Map (
+ PciIo,
+ EfiPciIoOperationBusMasterCommonBuffer,
+ HostAddress,
+ &NumberOfBytes,
+ &DeviceAddress,
+ &Mapping
+ );
+ ASSERT_EFI_ERROR (Status);
+ ASSERT (DeviceAddress == ((EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress));
+}
+
+/**
+ USB3 map DMA buffers.
+
+ @param Instance Pointer to USB3 debug port instance.
+ @param PciIo Pointer to PciIo for USB3 debug port.
+
+**/
+VOID
+Usb3MapDmaBuffers (
+ IN USB3_DEBUG_PORT_INSTANCE *Instance,
+ IN EFI_PCI_IO_PROTOCOL *PciIo
+ )
+{
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ Instance->Urb.Data,
+ XHC_DEBUG_PORT_DATA_LENGTH
+ );
+
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ Instance->TransferRingIn.RingSeg0,
+ sizeof (TRB_TEMPLATE) * TR_RING_TRB_NUMBER
+ );
+
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ Instance->TransferRingOut.RingSeg0,
+ sizeof (TRB_TEMPLATE) * TR_RING_TRB_NUMBER
+ );
+
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ Instance->EventRing.EventRingSeg0,
+ sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMBER
+ );
+
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ Instance->EventRing.ERSTBase,
+ sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERST_NUMBER
+ );
+
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ Instance->DebugCapabilityContext,
+ sizeof (XHC_DC_CONTEXT)
+ );
+
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ ((XHC_DC_CONTEXT *) (UINTN) Instance->DebugCapabilityContext)->DbcInfoContext.String0DescAddress,
+ STRING0_DESC_LEN + MANU_DESC_LEN + PRODUCT_DESC_LEN + SERIAL_DESC_LEN
+ );
+}
+
+/**
+ Invoke a notification event
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context The pointer to the notification function's context,
+ which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+Usb3DxeSmmReadyToLockNotify (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ ASSERT (mUsb3Instance != NULL);
+
+ //
+ // For the case that the USB3 debug port instance and DMA buffers are
+ // from PEI HOB with IOMMU enabled.
+ // Reinitialize USB3 debug port with granted DXE DMA buffer accessible
+ // by SMM environment.
+ //
+ InitializeUsb3DebugPort (mUsb3Instance);
+
+ SaveUsb3InstanceAddress (mUsb3Instance);
+
+ gBS->CloseEvent (Event);
+}
+
+/**
+ USB3 get IOMMU protocol.
+
+ @return Pointer to IOMMU protocol.
+
+**/
+EDKII_IOMMU_PROTOCOL *
+Usb3GetIoMmu (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EDKII_IOMMU_PROTOCOL *IoMmu;
+
+ IoMmu = NULL;
+ Status = gBS->LocateProtocol (
+ &gEdkiiIoMmuProtocolGuid,
+ NULL,
+ (VOID **) &IoMmu
+ );
+ if (!EFI_ERROR (Status) && (IoMmu != NULL)) {
+ return IoMmu;
+ }
+
+ return NULL;
+}
+
+/**
+ Invoke a notification event
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context The pointer to the notification function's context,
+ which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+Usb3PciIoNotify (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ UINTN PciIoHandleCount;
+ EFI_HANDLE *PciIoHandleBuffer;
+ UINTN Index;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UINTN PciSegment;
+ UINTN PciBusNumber;
+ UINTN PciDeviceNumber;
+ UINTN PciFunctionNumber;
+ EFI_EVENT SmmReadyToLockEvent;
+
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiPciIoProtocolGuid,
+ NULL,
+ &PciIoHandleCount,
+ &PciIoHandleBuffer
+ );
+ if (!EFI_ERROR (Status) &&
+ (PciIoHandleBuffer != NULL) &&
+ (PciIoHandleCount != 0)) {
+ for (Index = 0; Index < PciIoHandleCount; Index++) {
+ Status = gBS->HandleProtocol (
+ PciIoHandleBuffer[Index],
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PciIo->GetLocation (PciIo, &PciSegment, &PciBusNumber, &PciDeviceNumber, &PciFunctionNumber);
+ ASSERT_EFI_ERROR (Status);
+ if ((PciBusNumber == mUsb3DebugPort.PciAddress.Bus) &&
+ (PciDeviceNumber == mUsb3DebugPort.PciAddress.Device) &&
+ (PciFunctionNumber == mUsb3DebugPort.PciAddress.Function)) {
+ //
+ // Found the PciIo for USB3 debug port.
+ //
+ ASSERT (mUsb3Instance != NULL);
+ if (Usb3GetIoMmu () != NULL) {
+ Usb3MapDmaBuffers (mUsb3Instance, PciIo);
+
+ if (mUsb3Instance->FromHob) {
+ mUsb3PciIo = PciIo;
+ Usb3NamedEventListen (
+ &gEfiDxeSmmReadyToLockProtocolGuid,
+ TPL_NOTIFY,
+ Usb3DxeSmmReadyToLockNotify,
+ &SmmReadyToLockEvent
+ );
+ }
+ }
+ gBS->CloseEvent (Event);
+ break;
+ }
+ }
+
+ gBS->FreePool (PciIoHandleBuffer);
+ }
+}
+
+/**
+ Return XHCI MMIO base address.
+
+**/
+EFI_PHYSICAL_ADDRESS
+GetXhciBaseAddress (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ EFI_PHYSICAL_ADDRESS Address;
+ UINT32 Low;
+ UINT32 High;
+
+ if (mUsb3DebugPort.Controller == 0) {
+ mUsb3DebugPort.Controller = GetUsb3DebugPortController();
+ }
+
+ Bus = mUsb3DebugPort.PciAddress.Bus;
+ Device = mUsb3DebugPort.PciAddress.Device;
+ Function = mUsb3DebugPort.PciAddress.Function;
+
+ Low = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET));
+ High = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4));
+ Address = (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Low);
+ //
+ // Mask other parts which are not part of base address
+ //
+ Address &= XHCI_BASE_ADDRESS_64_BIT_MASK;
+ return Address;
+}
+
+/**
+ Return XHCI debug instance address.
+
+**/
+USB3_DEBUG_PORT_INSTANCE *
+GetUsb3DebugPortInstance (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+ UINT64 CapabilityPointer;
+ UINT32 Capability;
+ BOOLEAN Flag;
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT16 Command;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+
+ Instance = NULL;
+
+ XhcMmioBase = GetXhciBaseAddress ();
+
+ if ((XhcMmioBase == 0) || (XhcMmioBase == XHCI_BASE_ADDRESS_64_BIT_MASK)) {
+ return NULL;
+ }
+
+ if (mUsb3Instance != NULL) {
+ FixUsb3InstanceResource (mUsb3Instance, XhcMmioBase);
+ return mUsb3Instance;
+ }
+
+ Command = GetXhciPciCommand ();
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+
+ //
+ // Set Command Register
+ //
+ if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) == 0) {
+ PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE);
+ PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ }
+
+ //
+ // Calculate capability offset from HCCPARAMS [16:31], in 32-bit words
+ //
+ CapabilityPointer = XhcMmioBase + (MmioRead32 ((UINTN)(XhcMmioBase + XHC_HCCPARAMS_OFFSET)) >> 16) * 4;
+
+ //
+ // Search XHCI debug capability
+ //
+ Flag = FALSE;
+ Capability = MmioRead32 ((UINTN)CapabilityPointer);
+ while (TRUE) {
+ if ((Capability & XHC_CAPABILITY_ID_MASK) == PCI_CAPABILITY_ID_DEBUG_PORT) {
+ Flag = TRUE;
+ break;
+ }
+ if ((((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) & XHC_CAPABILITY_ID_MASK) == 0) {
+ //
+ // Reach the end of list, quit
+ //
+ break;
+ }
+ CapabilityPointer += ((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) * 4;
+ Capability = MmioRead32 ((UINTN)CapabilityPointer);
+ }
+
+ if (Flag) {
+ Instance = (USB3_DEBUG_PORT_INSTANCE *)(UINTN) MmioRead32 ((UINTN) (CapabilityPointer + XHC_DC_DCDDI2));
+
+ if (Instance != NULL) {
+ FixUsb3InstanceResource (Instance, XhcMmioBase);
+ }
+ }
+
+ //
+ // Restore Command Register
+ //
+ PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command);
+
+ return Instance;
+}
+
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The USB3 debug port was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3Initialize (
+ VOID
+ )
+{
+ //
+ // Leave it empty, we assume PEI phase already do initialization
+ //
+ return RETURN_SUCCESS;
+}
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3InitializeReal (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE UsbDbg;
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PHYSICAL_ADDRESS Address;
+ EFI_STATUS Status;
+ EFI_EVENT Event;
+
+ if ((gST == NULL) || (gBS == NULL)) {
+ //
+ // gST and gBS have not been initialized yet
+ //
+ return EFI_DEVICE_ERROR;
+ }
+
+ Status = EfiGetSystemConfigurationTable (&gUsb3DbgGuid, (VOID **) &mUsb3Instance);
+ if (!EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+ //
+ // It is first time to run DXE instance, copy Instance from Hob to ACPINvs
+ // NOTE: Hob is not ready at this time, so copy it from XHCI register.
+ //
+ Instance = GetUsb3DebugPortInstance ();
+ if (Instance == NULL) {
+ //
+ // Initialize USB debug
+ //
+ SetMem (&UsbDbg, sizeof(UsbDbg), 0);
+ DiscoverUsb3DebugPort (&UsbDbg);
+ if (UsbDbg.DebugSupport) {
+ InitializeUsb3DebugPort (&UsbDbg);
+ }
+ Instance = &UsbDbg;
+ }
+ Address = SIZE_4GB;
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiACPIMemoryNVS,
+ EFI_SIZE_TO_PAGES (sizeof (USB3_DEBUG_PORT_INSTANCE)),
+ &Address
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ CopyMem (
+ (VOID *)(UINTN)Address,
+ Instance,
+ sizeof (USB3_DEBUG_PORT_INSTANCE)
+ );
+ mUsb3Instance = (USB3_DEBUG_PORT_INSTANCE *)(UINTN)Address;
+
+ Status = gBS->InstallConfigurationTable (&gUsb3DbgGuid, mUsb3Instance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (mUsb3Instance->DebugSupport) {
+ SaveUsb3InstanceAddress (mUsb3Instance);
+ }
+
+Done:
+ if ((mUsb3Instance != NULL) && mUsb3Instance->Ready && (mUsb3Instance->PciIoEvent == 0)) {
+ Status = Usb3NamedEventListen (
+ &gEfiPciIoProtocolGuid,
+ TPL_NOTIFY,
+ Usb3PciIoNotify,
+ &Event
+ );
+ if (!EFI_ERROR (Status)) {
+ mUsb3Instance->PciIoEvent = (EFI_PHYSICAL_ADDRESS) (UINTN) Event;
+ }
+ }
+
+ return RETURN_SUCCESS;
+}
+
+/**
+ Calculate the size of XHCI MMIO space.
+
+ @retval TURE The XHCI MMIO is in SMRAM ranges.
+ @retval FALSE The XHCI MMIO is out of SMRAM ranges.
+**/
+UINT64
+CalculateMmioSize (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT32 Value;
+ UINT32 Mask;
+ UINT64 MmioSize;
+ UINT16 Command;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+
+ Mask = 0xFFFFFFF0;
+ MmioSize = 0;
+
+ XhcMmioBase = GetXhciBaseAddress ();
+
+ //
+ // Disable MSE
+ //
+ Command = PciRead16 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command & ~(EFI_PCI_COMMAND_MEMORY_SPACE));
+
+ //
+ // Get Mmio Size
+ //
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET), 0xFFFFFFFF);
+ Value = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET));
+
+ switch (Value & 0x07) {
+ case 0x0:
+ //
+ // Memory space: anywhere in 32 bit address space
+ //
+ MmioSize = (~(Value & Mask)) + 1;
+ break;
+ case 0x4:
+ //
+ // Memory space: anywhere in 64 bit address space
+ //
+ MmioSize = Value & Mask;
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4), 0xFFFFFFFF);
+ Value = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4));
+ //
+ // Fix the length to support some spefic 64 bit BAR
+ //
+ Value |= ((UINT32)(-1) << HighBitSet32 (Value));
+ //
+ // Calculate the size of 64bit bar
+ //
+ MmioSize |= LShiftU64 ((UINT64) Value, 32);
+ MmioSize = (~(MmioSize)) + 1;
+ break;
+ default:
+ //
+ // Unknown BAR type
+ //
+ MmioSize = (~(Value & Mask)) + 1;
+ break;
+ };
+
+
+ //
+ // Restore MMIO address
+ //
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET), (UINT32)XhcMmioBase);
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4), (UINT32) (XhcMmioBase >> 32));
+
+ PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE);
+
+ return MmioSize;
+}
+
+/**
+ The constructor function initialize USB3 debug port.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+Usb3DebugPortLibDxeConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_SMM_BASE2_PROTOCOL *SmmBase;
+ EFI_SMM_ACCESS2_PROTOCOL *SmmAccess;
+ UINTN Size;
+ EFI_STATUS Status;
+
+ //
+ // Do real initialization here, because we need copy data from Hob to ACPINvs.
+ // We must do it in constructor because it depends on UefiBootServicesTableLib.
+ //
+ if (FeaturePcdGet (PcdUsb3DebugFeatureEnable)) {
+ USB3InitializeReal ();
+ }
+
+ mUsb3MmioSize = CalculateMmioSize ();
+
+ if (gBS != NULL) {
+ SmmBase = NULL;
+ Status = gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID **)&SmmBase);
+ if (!EFI_ERROR (Status)) {
+ SmmBase->InSmm(SmmBase, &mUsb3InSmm);
+ }
+
+ if (mUsb3InSmm) {
+ //
+ // Get SMRAM information
+ //
+ SmmAccess = NULL;
+ Status = gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID **)&SmmAccess);
+ if (!EFI_ERROR (Status)) {
+ Size = sizeof (mSmramCheckRanges);
+
+ Status = SmmAccess->GetCapabilities (SmmAccess, &Size, mSmramCheckRanges);
+ if (!EFI_ERROR (Status)) {
+ mSmramCheckRangeCount = Size / sizeof (EFI_SMRAM_DESCRIPTOR);
+ }
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ The destructor function.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The destructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+Usb3DebugPortLibDxeDestructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ if ((mUsb3Instance != NULL) && (mUsb3Instance->PciIoEvent != 0)) {
+ //
+ // Close the event created.
+ //
+ gBS->CloseEvent ((EFI_EVENT) (UINTN) mUsb3Instance->PciIoEvent);
+ mUsb3Instance->PciIoEvent = 0;
+ }
+ return EFI_SUCCESS;
+}
+
+/**
+ Allocates pages that are suitable for an OperationBusMasterCommonBuffer or
+ OperationBusMasterCommonBuffer64 mapping.
+
+ @param PciIo Pointer to PciIo for USB3 debug port.
+ @param Pages The number of pages to allocate.
+ @param Address A pointer to store the base system memory address of the
+ allocated range.
+
+ @retval EFI_SUCCESS The requested memory pages were allocated.
+ @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
+ MEMORY_WRITE_COMBINE and MEMORY_CACHED.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+ @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
+
+**/
+EFI_STATUS
+Usb3AllocateDmaBuffer (
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINTN Pages,
+ OUT VOID **Address
+ )
+{
+ EFI_STATUS Status;
+
+ *Address = NULL;
+ Status = PciIo->AllocateBuffer (
+ PciIo,
+ AllocateAnyPages,
+ EfiRuntimeServicesData,
+ Pages,
+ Address,
+ 0
+ );
+ if (!EFI_ERROR (Status)) {
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ (EFI_PHYSICAL_ADDRESS) (UINTN) *Address,
+ EFI_PAGES_TO_SIZE (Pages)
+ );
+ }
+ return Status;
+}
+
+/**
+ Allocate aligned memory for XHC's usage.
+
+ @param BufferSize The size, in bytes, of the Buffer.
+
+ @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID*
+AllocateAlignBuffer (
+ IN UINTN BufferSize
+ )
+{
+ VOID *Buf;
+ EFI_PHYSICAL_ADDRESS Address;
+ EFI_STATUS Status;
+
+ Buf = NULL;
+
+ if (gBS != NULL) {
+ if (mUsb3PciIo != NULL) {
+ Usb3AllocateDmaBuffer (
+ mUsb3PciIo,
+ EFI_SIZE_TO_PAGES (BufferSize),
+ &Buf
+ );
+ } else {
+ Address = 0xFFFFFFFF;
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiACPIMemoryNVS,
+ EFI_SIZE_TO_PAGES (BufferSize),
+ &Address
+ );
+ if (!EFI_ERROR (Status)) {
+ Buf = (VOID *)(UINTN)Address;
+ }
+ }
+ }
+
+ return Buf;
+}
+
+/**
+ Check whether AllocatePages in permanent memory is ready.
+
+ @retval TRUE AllocatePages in permanent memory is ready.
+ @retval FALSE AllocatePages in permanent memory is not ready.
+
+**/
+BOOLEAN
+IsAllocatePagesReady (
+ VOID
+ )
+{
+ if (gBS != NULL) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c
new file mode 100644
index 0000000000..319cebecbb
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c
@@ -0,0 +1,103 @@
+/** @file
+ Usb Debug Port library NULL instance
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+/**
+ Initialize the USB3 debug port hardware.
+
+ If no initialization is required, then return RETURN_SUCCESS.
+ If the serial device was successfully initialized, then return RETURN_SUCCESS.
+ If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+ @retval RETURN_DEVICE_ERROR The serial device could not be initialized.
+
+**/
+RETURN_STATUS
+EFIAPI
+Usb3DebugPortInitialize (
+ VOID
+ )
+{
+ return RETURN_SUCCESS;
+}
+
+/**
+ Write data from buffer to USB3 debug port.
+
+ Writes NumberOfBytes data bytes from Buffer to the serial device.
+ The number of bytes actually written to the serial device is returned.
+ If the return value is less than NumberOfBytes, then the write operation failed.
+ If Buffer is NULL, then ASSERT().
+ If NumberOfBytes is zero, then return 0.
+
+ @param Buffer Pointer to the data buffer to be written.
+ @param NumberOfBytes Number of bytes to written to the serial device.
+
+ @retval 0 NumberOfBytes is 0.
+ @retval >0 The number of bytes written to the serial device.
+ If this value is less than NumberOfBytes, then the read operation failed.
+
+**/
+UINTN
+EFIAPI
+Usb3DebugPortWrite (
+ IN UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
+{
+ return 0;
+}
+
+
+/**
+ Read data from USB3 debug port and save the datas in buffer.
+
+ Reads NumberOfBytes data bytes from a serial device into the buffer
+ specified by Buffer. The number of bytes actually read is returned.
+ If the return value is less than NumberOfBytes, then the rest operation failed.
+ If Buffer is NULL, then ASSERT().
+ If NumberOfBytes is zero, then return 0.
+
+ @param Buffer Pointer to the data buffer to store the data read from the serial device.
+ @param NumberOfBytes Number of bytes which will be read.
+
+ @retval 0 Read data failed, no data is to be read.
+ @retval >0 Actual number of bytes read from serial device.
+
+**/
+UINTN
+EFIAPI
+Usb3DebugPortRead (
+ OUT UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
+{
+ return 0;
+}
+
+/**
+ Polls a USB3 debug port to see if there is any data waiting to be read.
+
+ Polls a serial device to see if there is any data waiting to be read.
+ If there is data waiting to be read from the serial device, then TRUE is returned.
+ If there is no data waiting to be read from the serial device, then FALSE is returned.
+
+ @retval TRUE Data is waiting to be read from the serial device.
+ @retval FALSE There is no data waiting to be read from the serial device.
+
+**/
+BOOLEAN
+EFIAPI
+Usb3DebugPortPoll (
+ VOID
+ )
+{
+ return FALSE;
+}
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c
new file mode 100644
index 0000000000..fa6eaad9bf
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c
@@ -0,0 +1,236 @@
+/** @file
+ Usb Debug Port library instance
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <PiPei.h>
+#include <Library/SerialPortLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PciLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+#include <Library/TimerLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+#include <Library/PeiServicesTablePointerLib.h>
+#include <Ppi/MemoryDiscovered.h>
+#include "Usb3DebugPortLibInternal.h"
+
+GUID gUsb3DbgGuid = USB3_DBG_GUID;
+
+/**
+ Return XHCI MMIO base address.
+
+**/
+EFI_PHYSICAL_ADDRESS
+GetXhciBaseAddress (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ EFI_PHYSICAL_ADDRESS Address;
+ UINT32 Low;
+ UINT32 High;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+ Low = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET));
+ High = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4));
+ Address = (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Low);
+
+ //
+ // Mask other parts which are not part of base address
+ //
+ Address &= XHCI_BASE_ADDRESS_64_BIT_MASK;
+ return Address;
+}
+
+/**
+ Return XHCI debug instance address.
+
+**/
+USB3_DEBUG_PORT_INSTANCE *
+GetUsb3DebugPortInstance (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PEI_HOB_POINTERS Hob;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+
+ Hob.Raw = GetFirstGuidHob (&gUsb3DbgGuid);
+ if (Hob.Raw == NULL) {
+ return NULL;
+ }
+ Instance = GET_GUID_HOB_DATA (Hob.Guid);
+
+ //
+ // Update XHCI MMIO base address
+ //
+ XhcMmioBase = GetXhciBaseAddress ();
+
+ FixUsb3InstanceResource (Instance, XhcMmioBase);
+
+ return Instance;
+}
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3Initialize (
+ VOID
+ )
+{
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3InitializeReal (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE UsbDbg;
+ VOID *DataPtr;
+ EFI_PEI_HOB_POINTERS Hob;
+
+ //
+ // USB Initilization has to be done only once. So this function should just return when
+ // it is called more than once.
+ //
+ Hob.Raw = GetFirstGuidHob (&gUsb3DbgGuid);
+ if (Hob.Raw != NULL) {
+ return RETURN_SUCCESS;
+ }
+
+ //
+ // Initialize USB debug for PEI at the first time
+ //
+ SetMem (&UsbDbg, sizeof(UsbDbg), 0);
+ UsbDbg.FromHob = TRUE;
+ DiscoverUsb3DebugPort (&UsbDbg);
+ if (UsbDbg.DebugSupport) {
+ InitializeUsb3DebugPort (&UsbDbg);
+ }
+
+ //
+ // Save Instance into HOB
+ //
+ DataPtr = BuildGuidDataHob (
+ &gUsb3DbgGuid,
+ (VOID*) &UsbDbg,
+ sizeof (UsbDbg)
+ );
+
+ if (UsbDbg.DebugSupport) {
+ SaveUsb3InstanceAddress ((USB3_DEBUG_PORT_INSTANCE *) DataPtr);
+ }
+
+ return RETURN_SUCCESS;
+}
+
+/**
+ Allocate aligned memory for XHC's usage.
+
+ @param BufferSize The size, in bytes, of the Buffer.
+
+ @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID*
+AllocateAlignBuffer (
+ IN UINTN BufferSize
+ )
+{
+ VOID *Buf;
+ EFI_PHYSICAL_ADDRESS Address;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_STATUS Status;
+ VOID *MemoryDiscoveredPpi;
+
+ Buf = NULL;
+ PeiServices = GetPeiServicesTablePointer ();
+
+ //
+ // Make sure the allocated memory is physical memory.
+ //
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEfiPeiMemoryDiscoveredPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &MemoryDiscoveredPpi
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = (*PeiServices)->AllocatePages (
+ PeiServices,
+ EfiACPIMemoryNVS,
+ EFI_SIZE_TO_PAGES (BufferSize),
+ &Address
+ );
+ if (!EFI_ERROR (Status)) {
+ Buf = (VOID *)(UINTN) Address;
+ }
+ }
+ return Buf;
+}
+
+/**
+ Check whether AllocatePages in permanent memory is ready.
+
+ @retval TRUE AllocatePages in permanent memory is ready.
+ @retval FALSE AllocatePages in permanent memory is not ready.
+
+**/
+BOOLEAN
+IsAllocatePagesReady (
+ VOID
+ )
+{
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_STATUS Status;
+ VOID *MemoryDiscoveredPpi;
+
+ PeiServices = GetPeiServicesTablePointer ();
+
+ //
+ // Make sure the allocated memory is physical memory.
+ //
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEfiPeiMemoryDiscoveredPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &MemoryDiscoveredPpi
+ );
+ if (!EFI_ERROR (Status)) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c
new file mode 100644
index 0000000000..9a7d10f39f
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c
@@ -0,0 +1,440 @@
+/** @file
+ Usb Debug Port library instance
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <PiPei.h>
+#include <Library/SerialPortLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PciLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+#include <Library/TimerLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+#include <Library/PeiServicesTablePointerLib.h>
+#include <Ppi/MemoryDiscovered.h>
+#include <Ppi/IoMmu.h>
+#include "Usb3DebugPortLibInternal.h"
+
+GUID gUsb3DbgGuid = USB3_DBG_GUID;
+
+/**
+ USB3 IOMMU PPI notify.
+
+ @param[in] PeiServices Pointer to PEI Services Table.
+ @param[in] NotifyDesc Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi Pointer to the PPI data associated with this function.
+
+ @retval EFI_STATUS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+EFIAPI
+Usb3IoMmuPpiNotify (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+
+ Instance = GetUsb3DebugPortInstance ();
+ ASSERT (Instance != NULL);
+ //
+ // Reinitialize USB3 debug port with granted DMA buffer from IOMMU PPI.
+ //
+ InitializeUsb3DebugPort (Instance);
+
+ SaveUsb3InstanceAddress (Instance);
+
+ return EFI_SUCCESS;
+}
+
+EFI_PEI_NOTIFY_DESCRIPTOR mUsb3IoMmuPpiNotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEdkiiIoMmuPpiGuid,
+ Usb3IoMmuPpiNotify
+};
+
+/**
+ Allocates pages that are suitable for an OperationBusMasterCommonBuffer or
+ OperationBusMasterCommonBuffer64 mapping.
+
+ @param IoMmu Pointer to IOMMU PPI.
+ @param Pages The number of pages to allocate.
+ @param HostAddress A pointer to store the base system memory address of the
+ allocated range.
+ @param DeviceAddress The resulting map address for the bus master PCI controller to use to
+ access the hosts HostAddress.
+ @param Mapping A resulting value to pass to Unmap().
+
+ @retval EFI_SUCCESS The requested memory pages were allocated.
+ @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
+ MEMORY_WRITE_COMBINE and MEMORY_CACHED.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+ @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
+
+**/
+EFI_STATUS
+IoMmuAllocateBuffer (
+ IN EDKII_IOMMU_PPI *IoMmu,
+ IN UINTN Pages,
+ OUT VOID **HostAddress,
+ OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
+ OUT VOID **Mapping
+ )
+{
+ EFI_STATUS Status;
+ UINTN NumberOfBytes;
+
+ *HostAddress = NULL;
+ *DeviceAddress = 0;
+ *Mapping = NULL;
+
+ Status = IoMmu->AllocateBuffer (
+ IoMmu,
+ EfiRuntimeServicesData,
+ Pages,
+ HostAddress,
+ 0
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ NumberOfBytes = EFI_PAGES_TO_SIZE (Pages);
+ Status = IoMmu->Map (
+ IoMmu,
+ EdkiiIoMmuOperationBusMasterCommonBuffer,
+ *HostAddress,
+ &NumberOfBytes,
+ DeviceAddress,
+ Mapping
+ );
+ if (EFI_ERROR (Status)) {
+ IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress);
+ *HostAddress = NULL;
+ return EFI_OUT_OF_RESOURCES;
+ }
+ Status = IoMmu->SetAttribute (
+ IoMmu,
+ *Mapping,
+ EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE
+ );
+ if (EFI_ERROR (Status)) {
+ IoMmu->Unmap (IoMmu, *Mapping);
+ IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress);
+ *Mapping = NULL;
+ *HostAddress = NULL;
+ return Status;
+ }
+
+ return Status;
+}
+
+/**
+ USB3 get IOMMU PPI.
+
+ @return Pointer to IOMMU PPI.
+
+**/
+EDKII_IOMMU_PPI *
+Usb3GetIoMmu (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EDKII_IOMMU_PPI *IoMmu;
+ CONST EFI_PEI_SERVICES **PeiServices;
+
+ PeiServices = GetPeiServicesTablePointer ();
+
+ IoMmu = NULL;
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEdkiiIoMmuPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &IoMmu
+ );
+ if (!EFI_ERROR (Status) && (IoMmu != NULL)) {
+ return IoMmu;
+ }
+
+ return NULL;
+}
+
+/**
+ Return XHCI MMIO base address.
+
+**/
+EFI_PHYSICAL_ADDRESS
+GetXhciBaseAddress (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ EFI_PHYSICAL_ADDRESS Address;
+ UINT32 Low;
+ UINT32 High;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+ Low = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET));
+ High = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4));
+ Address = (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Low);
+
+ //
+ // Mask other parts which are not part of base address
+ //
+ Address &= XHCI_BASE_ADDRESS_64_BIT_MASK;
+ return Address;
+}
+
+/**
+ Return XHCI debug instance address.
+
+**/
+USB3_DEBUG_PORT_INSTANCE *
+GetUsb3DebugPortInstance (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PEI_HOB_POINTERS Hob;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+
+ Hob.Raw = GetFirstGuidHob (&gUsb3DbgGuid);
+ if (Hob.Raw == NULL) {
+ return NULL;
+ }
+ Instance = GET_GUID_HOB_DATA (Hob.Guid);
+
+ //
+ // Update XHCI MMIO base address
+ //
+ XhcMmioBase = GetXhciBaseAddress ();
+
+ FixUsb3InstanceResource (Instance, XhcMmioBase);
+
+ return Instance;
+}
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3Initialize (
+ VOID
+ )
+{
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3InitializeReal (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ USB3_DEBUG_PORT_INSTANCE UsbDbg;
+ VOID *DataPtr;
+ EFI_PEI_HOB_POINTERS Hob;
+ CONST EFI_PEI_SERVICES **PeiServices;
+
+ PeiServices = GetPeiServicesTablePointer ();
+
+ //
+ // USB Initilization has to be done only once. So this function should just return when
+ // it is called more than once.
+ //
+ Hob.Raw = GetFirstGuidHob (&gUsb3DbgGuid);
+ if (Hob.Raw != NULL) {
+ return RETURN_SUCCESS;
+ }
+
+ //
+ // Initialize USB debug for PEI at the first time
+ //
+ SetMem (&UsbDbg, sizeof(UsbDbg), 0);
+ UsbDbg.FromHob = TRUE;
+ DiscoverUsb3DebugPort (&UsbDbg);
+ if (UsbDbg.DebugSupport) {
+ InitializeUsb3DebugPort (&UsbDbg);
+ }
+
+ if (UsbDbg.Ready && (Usb3GetIoMmu () == NULL)) {
+ Status = (*PeiServices)->NotifyPpi (PeiServices, &mUsb3IoMmuPpiNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ //
+ // Save Instance into HOB
+ //
+ DataPtr = BuildGuidDataHob (
+ &gUsb3DbgGuid,
+ (VOID*) &UsbDbg,
+ sizeof (UsbDbg)
+ );
+
+ if (UsbDbg.DebugSupport) {
+ SaveUsb3InstanceAddress ((USB3_DEBUG_PORT_INSTANCE *) DataPtr);
+ }
+
+ return RETURN_SUCCESS;
+}
+
+/**
+ Allocate aligned memory for XHC's usage.
+
+ @param BufferSize The size, in bytes, of the Buffer.
+
+ @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID*
+AllocateAlignBuffer (
+ IN UINTN BufferSize
+ )
+{
+ VOID *Buf;
+ EFI_PHYSICAL_ADDRESS Address;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_STATUS Status;
+ VOID *MemoryDiscoveredPpi;
+ EDKII_IOMMU_PPI *IoMmu;
+ VOID *HostAddress;
+ VOID *Mapping;
+
+ Buf = NULL;
+ PeiServices = GetPeiServicesTablePointer ();
+
+ //
+ // Make sure the allocated memory is physical memory.
+ //
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEfiPeiMemoryDiscoveredPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &MemoryDiscoveredPpi
+ );
+ if (!EFI_ERROR (Status)) {
+ IoMmu = Usb3GetIoMmu ();
+ if (IoMmu != NULL) {
+ Status = IoMmuAllocateBuffer (
+ IoMmu,
+ EFI_SIZE_TO_PAGES (BufferSize),
+ &HostAddress,
+ &Address,
+ &Mapping
+ );
+ if (!EFI_ERROR (Status)) {
+ ASSERT (Address == ((EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress));
+ Buf = (VOID *)(UINTN) Address;
+ }
+ } else {
+ Status = (*PeiServices)->AllocatePages (
+ PeiServices,
+ EfiACPIMemoryNVS,
+ EFI_SIZE_TO_PAGES (BufferSize),
+ &Address
+ );
+ if (!EFI_ERROR (Status)) {
+ Buf = (VOID *)(UINTN) Address;
+ }
+ }
+ }
+ return Buf;
+}
+
+/**
+ Check whether AllocatePages in permanent memory is ready.
+
+ @retval TRUE AllocatePages in permanent memory is ready.
+ @retval FALSE AllocatePages in permanent memory is not ready.
+
+**/
+BOOLEAN
+IsAllocatePagesReady (
+ VOID
+ )
+{
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_STATUS Status;
+ VOID *MemoryDiscoveredPpi;
+ EDKII_IOMMU_PPI *IoMmu;
+ VOID *HostAddress;
+
+ PeiServices = GetPeiServicesTablePointer ();
+
+ //
+ // Make sure the allocated memory is physical memory.
+ //
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEfiPeiMemoryDiscoveredPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &MemoryDiscoveredPpi
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEdkiiIoMmuPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &IoMmu
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = IoMmu->AllocateBuffer (
+ IoMmu,
+ EfiRuntimeServicesData,
+ 1,
+ &HostAddress,
+ 0
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // DMA protection has been enabled,
+ // but DMA buffer could not be allocated yet.
+ //
+ return FALSE;
+ }
+ IoMmu->FreeBuffer (
+ IoMmu,
+ 1,
+ HostAddress
+ );
+ }
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.c
new file mode 100644
index 0000000000..84dfa25d8e
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.c
@@ -0,0 +1,58 @@
+/** @file
+ USB3 debug Port Parameter library instance based on PCD.
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+
+/**
+ Returns the USB3 debug port controller.
+ bit: 0~ 7: Function
+ bit: 8~15: Device
+ bit: 16~24: Bus
+
+ @return Controller information of USB debug port.
+
+**/
+UINT32
+EFIAPI
+GetUsb3DebugPortController (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+
+ UsbDebugPort.Controller = 0;
+ UsbDebugPort.PciAddress.Bus = PcdGet8(PcdUsbSerialXhciBus);
+ UsbDebugPort.PciAddress.Device = PcdGet8(PcdUsbSerialXhciDev);
+ UsbDebugPort.PciAddress.Function = PcdGet8(PcdUsbSerialXhciFunc);
+
+ return UsbDebugPort.Controller;
+}
+
+/**
+ Sets the USB debug port controller.
+ bit: 0~ 7: Function
+ bit: 8~15: Device
+ bit: 16~24: Bus
+
+ @param[in] Controller information of USB debug port value to be set.
+
+ @retval TRUE The controller of USB debug port was sucessfully set.
+ @retval FALSE The controller of USB debug port could not be set.
+
+**/
+BOOLEAN
+EFIAPI
+SetUsb3DebugPortController (
+ UINT32 Controller
+ )
+{
+ return FALSE;
+}
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md
new file mode 100644
index 0000000000..969c7eed29
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md
@@ -0,0 +1,86 @@
+# Overview
+* **Feature Name:** USB3 Debug
+* **PI Phase(s) Supported:** PEI, DXE
+* **SMM Required?** No
+
+## Purpose
+*_TODO_*
+Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph.
+
+# High-Level Theory of Operation
+*_TODO_*
+A description of how the device works at a high-level.
+
+The description should not be constrained to implementation details but provide a simple mental model of how the
+feature is supposed to work.
+
+## Firmware Volumes
+*_TODO_*
+A bulleted list of the firmware volumes that feature module(s) are placed in.
+
+## Modules
+*_TODO_*
+A bulleted list of the modules that make up the feature.
+
+## <Module Name>
+*_TODO_*
+Each module in the feature should have a section that describes the module in a level of detail that is useful
+to better understand the module source code.
+
+## <Library Name>
+*_TODO_*
+Each library in the feature should have a section that describes the library in a level of detail that is useful
+to better understand the library source code.
+
+## Key Functions
+*_TODO_*
+A bulleted list of key functions for interacting with the feature.
+
+Not all features need to be listed. Only functions exposed through external interfaces that are important for feature
+users to be aware of.
+
+## Configuration
+*_TODO_*
+Information that is useful for configuring the feature.
+
+Not all configuration options need to be listed. This section is used to provide more background on configuration
+options than possible elsewhere.
+
+## Data Flows
+*_TODO_*
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+*_TODO_*
+Key control flows for the feature.
+
+## Build Flows
+*_TODO_*
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or require non-standard tool configuration. If the
+standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+*_TODO_*
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the feature is successful. If the test point is not
+implemented, this should be stated.
+
+## Functional Exit Criteria
+*_TODO_*
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board integrator can reference to ensure the feature is
+functional on their board.
+
+## Feature Enabling Checklist
+*_TODO_*
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+*_TODO_*
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 26/49] UserInterfaceFeaturePkg: Remove the User Authentication feature
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (23 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 25/49] Features/Intel/Usb3DebugFeaturePkg: " Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 27/49] Features/Intel/UserAuthFeaturePkg: Add initial package Kubacki, Michael A
` (22 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Dandan Bi, Liming Gao
Removes the User Authentication feature from
UserInterfaceFeaturePkg. The feature does not follow the advanced
feature design. A future change will add the feature back following
the advanced feature design.
Since the UserAuthentication feature is the only feature in
UserInterfaceFeaturePkg, the whole package is removed in this
change.
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec | 45 --
Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc | 101 ---
Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf | 39 -
Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf | 37 -
Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf | 41 -
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf | 53 --
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf | 63 --
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf | 53 --
Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthentication.h | 45 --
Platform/Intel/UserInterfaceFeaturePkg/Include/Library/PlatformPasswordLib.h | 48 --
Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordLib.h | 70 --
Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordUiLib.h | 37 -
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.h | 88 ---
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.h | 55 --
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.h | 138 ----
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeFormset.h | 23 -
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.h | 52 --
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeVfr.vfr | 39 -
Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c | 78 --
Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c | 274 -------
Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c | 522 -------------
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.c | 133 ----
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c | 484 ------------
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.c | 780 --------------------
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxePassword.c | 319 --------
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.c | 674 -----------------
Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni | 19 -
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeStrings.uni | 30 -
28 files changed, 4340 deletions(-)
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec b/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
deleted file mode 100644
index 3c8fe1da01..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
+++ /dev/null
@@ -1,45 +0,0 @@
-## @file
-# This package provides UI related modules.
-#
-# The DEC files are used by the utilities that parse DSC and
-# INF files to generate AutoGen.c and AutoGen.h files
-# for the build infrastructure.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- DEC_SPECIFICATION = 0x00010017
- PACKAGE_NAME = UserInterfaceFeaturePkg
- PACKAGE_VERSION = 0.1
- PACKAGE_GUID = 5A92199C-C2ED-4A3F-9ED0-C278DEA0DA47
-
-[Includes]
- Include
-
-[LibraryClasses]
- ## @libraryclass Provides a platform-specific method to return password policy.
- PlatformPasswordLib|Include/Library/PlatformPasswordLib.h
-
- ## @libraryclass Provides services to set/verify password and return if the password is set.
- UserPasswordLib|Include/Library/UserPasswordLib.h
-
- ## @libraryclass Provides services to do password authentication.
- UserPasswordUiLib|Include/Library/UserPasswordUiLib.h
-
-[Guids]
- gEfiUserInterfaceFeaturePkgTokenSpaceGuid = { 0x13c2147c, 0x75b6, 0x48ee, { 0xa4, 0x4b, 0xfc, 0x4, 0xb, 0x44, 0x97, 0xbd } }
-
- ## Include Include/Guid/UserAuthentication.h
- gUserAuthenticationGuid = { 0xee24a7f7, 0x606b, 0x4724, { 0xb3, 0xc9, 0xf5, 0xae, 0x4a, 0x3b, 0x81, 0x65} }
-
-[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx]
- ## Indicate whether the password is cleared.
- # When it is configured to Dynamic or DynamicEx, it can be set through detection using
- # a platform-specific method (e.g. Board Jumper set) in a actual platform in early boot phase.<BR><BR>
- # @Prompt The password clear status
- gEfiUserInterfaceFeaturePkgTokenSpaceGuid.PcdPasswordCleared|FALSE|BOOLEAN|0x00000001
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc b/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
deleted file mode 100644
index bd09052f3c..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
+++ /dev/null
@@ -1,101 +0,0 @@
-## @file
-# This package provides UI related modules.
-# This package should only depend on EDKII Core packages and MinPlatformPkg.
-#
-# The DEC files are used by the utilities that parse DSC and
-# INF files to generate AutoGen.c and AutoGen.h files
-# for the build infrastructure.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- PLATFORM_NAME = UserInterfaceFeaturePkg
- PLATFORM_GUID = 66536B4C-84A3-42FD-B0AE-603414A4CE9E
- PLATFORM_VERSION = 0.1
- DSC_SPECIFICATION = 0x00010005
- OUTPUT_DIRECTORY = Build/UserInterfaceFeaturePkg
- SUPPORTED_ARCHITECTURES = IA32|X64
- BUILD_TARGETS = DEBUG|RELEASE|NOOPT
- SKUID_IDENTIFIER = DEFAULT
-
-[LibraryClasses]
- #######################################
- # Edk2 Packages
- #######################################
- BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
- BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
- IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
- OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
- TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
-
- #####################################
- # User Interface Feature Package
- #####################################
- PlatformPasswordLib|UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
- UserPasswordLib|UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
-
-[LibraryClasses.common.DXE_DRIVER]
- #######################################
- # Edk2 Packages
- #######################################
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
-
-[LibraryClasses.common.DXE_SMM_DRIVER]
- #######################################
- # Edk2 Packages
- #######################################
- BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
- MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
- SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
-
-###################################################################################################
-#
-# Components Section - list of the modules and components that will be processed by compilation
-# tools and the EDK II tools to generate PE32/PE32+/Coff image files.
-#
-# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
-# into firmware volume images. This section is just a list of modules to compile from
-# source into UEFI-compliant binaries.
-# It is the FDF file that contains information on combining binary files into firmware
-# volume images, whose concept is beyond UEFI and is described in PI specification.
-# Binary modules do not need to be listed in this section, as they should be
-# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi),
-# Logo (Logo.bmp), and etc.
-# There may also be modules listed in this section that are not required in the FDF file,
-# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
-# generated for it, but the binary will not be put into any firmware volume.
-#
-###################################################################################################
-[Components]
- #####################################
- # User Interface Feature Package
- #####################################
-
- # Add library instances here that are not included in package components and should be tested
- # in the package build.
- UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
- UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
- UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
-
- # Add components here that should be included in the package build.
- UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf
- UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf
- UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf
-
-[BuildOptions]
- *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf b/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
deleted file mode 100644
index 6f4e40f174..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
+++ /dev/null
@@ -1,39 +0,0 @@
-## @file
-# NULL platform password library instance that returns the password clear state based upon PCD.
-#
-# NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared
-# but returns the PCD value directly. This instance can be used to verify security
-# related features during platform enabling and development. It should be replaced
-# by a platform-specific method(e.g. Button pressed) in a real platform for product.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010006
- BASE_NAME = PlatformPasswordLibNull
- MODULE_UNI_FILE = PlatformPasswordLibNull.uni
- FILE_GUID = 27417BCA-0CCD-4089-9711-AD069A33C555
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PlatformPasswordLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_DRIVER
- CONSTRUCTOR = PlatformPasswordLibNullConstructor
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 EBC
-#
-
-[Sources]
- PlatformPasswordLibNull.c
-
-[Packages]
- MdePkg/MdePkg.dec
- UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
-
-[Pcd]
- gEfiUserInterfaceFeaturePkgTokenSpaceGuid.PcdPasswordCleared ## CONSUMES
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
deleted file mode 100644
index 6dc6ca734f..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
+++ /dev/null
@@ -1,37 +0,0 @@
-## @file
-# UserPasswordLib instance provides services to set/verify password
-# and return if the password is set.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = UserPasswordLib
- FILE_GUID = 422BA58A-F162-4ECC-BD9A-AD84FE940F37
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = UserPasswordLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_DRIVER UEFI_APPLICATION
-
-[Sources]
- UserPasswordLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- DebugLib
- UefiLib
- BaseMemoryLib
-
-[Guids]
- gUserAuthenticationGuid ## CONSUMES ## GUID
- gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable
-
-[Protocols]
- gEfiSmmCommunicationProtocolGuid ## CONSUMES
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
deleted file mode 100644
index bdd8680ba0..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
+++ /dev/null
@@ -1,41 +0,0 @@
-## @file
-# UserPasswordUiLib instance provides services to do password authentication.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = UserPasswordUiLib
- FILE_GUID = E2E92636-F511-46BC-A08B-02F815AFA884
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = UserPasswordUiLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_DRIVER UEFI_APPLICATION
-
-[Sources]
- UserPasswordUiLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- UefiRuntimeServicesTableLib
- DebugLib
- UefiLib
- MemoryAllocationLib
- BaseMemoryLib
- PrintLib
- PlatformPasswordLib
- UserPasswordLib
-
-[Guids]
- gUserAuthenticationGuid ## CONSUMES ## GUID
- gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable
-
-[Protocols]
- gEfiSmmCommunicationProtocolGuid ## CONSUMES
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf
deleted file mode 100644
index d93d511005..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf
+++ /dev/null
@@ -1,53 +0,0 @@
-## @file
-# User Authentication 2 Dxe Driver.
-#
-# This Driver mainly provides Setup Form to change password.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = UserAuthentication2Dxe
- FILE_GUID = 4EF592F4-C716-40CC-8C07-1E4E3BD71F11
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 2.0
- ENTRY_POINT = UserAuthentication2Entry
- UNLOAD_IMAGE = UserAuthentication2Unload
-
-[Sources]
- UserAuthentication2Dxe.c
- UserAuthentication2Dxe.h
- UserAuthenticationDxeFormset.h
- UserAuthenticationDxeVfr.vfr
- UserAuthenticationDxeStrings.uni
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
-
-[LibraryClasses]
- BaseLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- UefiRuntimeServicesTableLib
- BaseMemoryLib
- DebugLib
- UefiLib
- HiiLib
- DevicePathLib
- MemoryAllocationLib
- UserPasswordLib
-
-[Protocols]
- gEfiDevicePathProtocolGuid ## PRODUCES
- gEfiHiiConfigAccessProtocolGuid ## PRODUCES
-
-[Depex]
- gEfiSimpleTextOutProtocolGuid AND
- gEfiSmmCommunicationProtocolGuid AND
- gEfiVariableArchProtocolGuid AND
- gEfiVariableWriteArchProtocolGuid
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf
deleted file mode 100644
index 61f5f27e63..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf
+++ /dev/null
@@ -1,63 +0,0 @@
-## @file
-# User Authentication Dxe Driver.
-#
-# This Driver mainly provides Setup Form to change password and
-# does user authentication before entering Setup.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = UserAuthenticationDxe
- FILE_GUID = 0683FB88-664C-4BA6-9ED4-1C0916EE43A4
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 2.0
- ENTRY_POINT = UserAuthenticationEntry
- UNLOAD_IMAGE = UserAuthenticationUnload
-
-
-[Sources]
- UserAuthenticationDxe.c
- UserAuthenticationDxe.h
- UserAuthenticationDxePassword.c
- UserAuthenticationDxeFormset.h
- UserAuthenticationDxeVfr.vfr
- UserAuthenticationDxeStrings.uni
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
-
-[LibraryClasses]
- BaseLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- UefiRuntimeServicesTableLib
- BaseMemoryLib
- DebugLib
- UefiLib
- HiiLib
- DevicePathLib
- MemoryAllocationLib
- PlatformPasswordLib
- PrintLib
-
-[Guids]
- gUserAuthenticationGuid ## CONSUMES ## GUID
- gEfiEventExitBootServicesGuid ## CONSUMES ## Event
- gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable
-
-[Protocols]
- gEfiRscHandlerProtocolGuid ## CONSUMES
- gEfiDevicePathProtocolGuid ## PRODUCES
- gEfiHiiConfigAccessProtocolGuid ## PRODUCES
- gEfiSmmCommunicationProtocolGuid ## CONSUMES
-
-[Depex]
- gEfiSimpleTextOutProtocolGuid AND
- gEfiSmmCommunicationProtocolGuid AND
- gEfiVariableArchProtocolGuid AND
- gEfiVariableWriteArchProtocolGuid
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf
deleted file mode 100644
index c5d15ada5e..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf
+++ /dev/null
@@ -1,53 +0,0 @@
-## @file
-# User Authentication Smm Driver.
-#
-# This driver provides SMM services for DXE user authentication module.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = UserAuthenticationSmm
- FILE_GUID = 8fc6aaaa-4561-4815-8cf7-b87312992dce
- MODULE_TYPE = DXE_SMM_DRIVER
- VERSION_STRING = 1.0
- PI_SPECIFICATION_VERSION = 0x0001000A
- ENTRY_POINT = PasswordSmmInit
-
-[Sources]
- UserAuthenticationSmm.c
- UserAuthenticationSmm.h
- KeyService.c
- KeyService.h
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- CryptoPkg/CryptoPkg.dec
- UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- DebugLib
- BaseLib
- BaseMemoryLib
- PrintLib
- SmmServicesTableLib
- MemoryAllocationLib
- UefiLib
- BaseCryptLib
- PlatformPasswordLib
-
-[Guids]
- gUserAuthenticationGuid ## CONSUMES ## GUID
-
-[Protocols]
- gEdkiiVariableLockProtocolGuid ## CONSUMES
- gEfiSmmVariableProtocolGuid ## CONSUMES
-
-[Depex]
- gEfiSmmVariableProtocolGuid AND gEfiVariableWriteArchProtocolGuid
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthentication.h b/Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthentication.h
deleted file mode 100644
index 2a41a46cdc..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthentication.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file
- GUID is for UserAuthentication SMM communication.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __USER_AUTHENTICATION_GUID_H__
-#define __USER_AUTHENTICATION_GUID_H__
-
-#define PASSWORD_MIN_SIZE 9 // MIN number of chars of password, including NULL.
-#define PASSWORD_MAX_SIZE 33 // MAX number of chars of password, including NULL.
-
-#define USER_AUTHENTICATION_GUID \
- { 0xf06e3ea7, 0x611c, 0x4b6b, { 0xb4, 0x10, 0xc2, 0xbf, 0x94, 0x3f, 0x38, 0xf2 } }
-
-extern EFI_GUID gUserAuthenticationGuid;
-
-typedef struct {
- UINTN Function;
- EFI_STATUS ReturnStatus;
-} SMM_PASSWORD_COMMUNICATE_HEADER;
-
-#define SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET 1
-#define SMM_PASSWORD_FUNCTION_SET_PASSWORD 2
-#define SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD 3
-#define SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY 4
-#define SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY 5
-#define SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED 6
-
-typedef struct {
- CHAR8 NewPassword[PASSWORD_MAX_SIZE];
- CHAR8 OldPassword[PASSWORD_MAX_SIZE];
-} SMM_PASSWORD_COMMUNICATE_SET_PASSWORD;
-
-typedef struct {
- CHAR8 Password[PASSWORD_MAX_SIZE];
-} SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD;
-
-typedef struct {
- BOOLEAN NeedReVerify;
-} SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY;
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/PlatformPasswordLib.h b/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/PlatformPasswordLib.h
deleted file mode 100644
index ce27947f6d..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/PlatformPasswordLib.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file
- Provides a platform-specific method to return password policy.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PLATFORM_PASSWORD_LIB_H__
-#define __PLATFORM_PASSWORD_LIB_H__
-
-/**
- This function is called at password driver entrypoint.
- This function should be called only once, to clear the password.
-
- This function provides a way to reset the password, just in case
- the platform owner forgets the password.
- The platform should provide a secure way to make sure
- only the platform owner is allowed to clear password.
-
- Once the password is cleared, the platform should provide a way
- to set a new password.
-
- @retval TRUE There is a platform request to clear the password.
- @retval FALSE There is no platform request to clear the password.
-**/
-BOOLEAN
-EFIAPI
-IsPasswordCleared (
- VOID
- );
-
-/**
- This function is called if the password driver finds that the password is not enrolled,
- when the password is required to input.
-
- This function should return the action according to platform policy.
-
- @retval TRUE The caller should force the user to enroll the password.
- @retval FALSE The caller may skip the password enroll.
-**/
-BOOLEAN
-EFIAPI
-NeedEnrollPassword (
- VOID
- );
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordLib.h b/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordLib.h
deleted file mode 100644
index b6aad224e9..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordLib.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/** @file
- Provides services to set/verify password and return if the password is set.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __USER_PASSWORD_LIB_H__
-#define __USER_PASSWORD_LIB_H__
-
-/**
- Validate if the password is correct.
-
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval EFI_SUCCESS The password is correct.
- @retval EFI_SECURITY_VIOLATION The password is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
-**/
-EFI_STATUS
-EFIAPI
-VerifyPassword (
- IN CHAR16 *Password,
- IN UINTN PasswordSize
- );
-
-/**
- Set a new password.
-
- @param[in] NewPassword The user input new password.
- NULL means clear password.
- @param[in] NewPasswordSize The size of NewPassword in byte.
- @param[in] OldPassword The user input old password.
- NULL means no old password.
- @param[in] OldPasswordSize The size of OldPassword in byte.
-
- @retval EFI_SUCCESS The NewPassword is set successfully.
- @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
- @retval EFI_UNSUPPORTED NewPassword is not strong enough.
- @retval EFI_ALREADY_STARTED NewPassword is in history.
-**/
-EFI_STATUS
-EFIAPI
-SetPassword (
- IN CHAR16 *NewPassword, OPTIONAL
- IN UINTN NewPasswordSize,
- IN CHAR16 *OldPassword, OPTIONAL
- IN UINTN OldPasswordSize
- );
-
-/**
- Return if the password is set.
-
- @retval TRUE The password is set.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-EFIAPI
-IsPasswordInstalled (
- VOID
- );
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordUiLib.h b/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordUiLib.h
deleted file mode 100644
index 117f480733..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordUiLib.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/** @file
- Provides services to do password authentication.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __USER_PASSWORD_UI_LIB_H__
-#define __USER_PASSWORD_UI_LIB_H__
-
-/**
- Do password authentication.
-
- @retval EFI_SUCCESS Password authentication pass.
-**/
-EFI_STATUS
-EFIAPI
-UiDoPasswordAuthentication (
- VOID
- );
-
-/**
- Set password verification policy.
-
- @param[in] NeedReVerify Need re-verify or not.
-
- @retval EFI_SUCCESS Set verification policy successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to set verification policy.
-**/
-EFI_STATUS
-EFIAPI
-UiSetPasswordVerificationPolicy (
- IN BOOLEAN NeedReVerify
- );
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.h
deleted file mode 100644
index d0b20851fa..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/** @file
- Header file for key service.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __KEY_LIB_H__
-#define __KEY_LIB_H__
-
-/**
- Compares the contents of two buffers with slow algorithm
-
- This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
- If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
- value returned is the first mismatched byte in SourceBuffer subtracted from the first
- mismatched byte in DestinationBuffer.
-
- If Length > 0 and DestinationBuffer is NULL, then ASSERT().
- If Length > 0 and SourceBuffer is NULL, then ASSERT().
- If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
- If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
-
- @param DestinationBuffer The pointer to the destination buffer to compare.
- @param SourceBuffer The pointer to the source buffer to compare.
- @param Length The number of bytes to compare.
-
- @return 0 All Length bytes of the two buffers are identical.
- @retval -1 The SourceBuffer is not identical to DestinationBuffer.
-
-**/
-INTN
-EFIAPI
-KeyLibSlowCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
- );
-
-/**
- Generate Salt value.
-
- @param[in, out] SaltValue Points to the salt buffer
- @param[in] SaltSize Size of the salt buffer
-
- @retval TRUE Salt is generated.
- @retval FALSE Salt is not generated.
-**/
-BOOLEAN
-EFIAPI
-KeyLibGenerateSalt(
- IN OUT UINT8 *SaltValue,
- IN UINTN SaltSize
- );
-
-#define HASH_TYPE_SHA256 0x000B
-#define DEFAULT_PBKDF2_ITERATION_COUNT 1000
-
-/**
- Hash the password with PBKDF2.
-
- @param[in] HashType Hash type
- @param[in] Key Points to the key buffer
- @param[in] KeySize Key buffer size
- @param[in] SaltValue Points to the salt buffer
- @param[in] SaltSize Size of the salt buffer
- @param[out] KeyHash Points to the hashed result
- @param[in] KeyHashSize Size of the hash buffer
-
- @retval TRUE Hash the data successfully.
- @retval FALSE Failed to hash the data.
-
-**/
-BOOLEAN
-EFIAPI
-KeyLibGeneratePBKDF2Hash (
- IN UINT32 HashType,
- IN VOID *Key,
- IN UINTN KeySize,
- IN UINT8 *SaltValue,
- IN UINTN SaltSize,
- OUT UINT8 *KeyHash,
- IN UINTN KeyHashSize
- );
-
-#endif
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.h
deleted file mode 100644
index 3b7fba026d..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/** @file
- Header file for UserAuthentication2Dxe.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _USER_AUTHENTICATION_DXE_H_
-#define _USER_AUTHENTICATION_DXE_H_
-
-
-#include <Protocol/ReportStatusCodeHandler.h>
-#include <Protocol/HiiConfigAccess.h>
-
-#include <Guid/MdeModuleHii.h>
-#include <Guid/HiiPlatformSetupFormset.h>
-#include <Guid/UserAuthentication.h>
-
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/BaseLib.h>
-#include <Library/UefiLib.h>
-#include <Library/HiiLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UserPasswordLib.h>
-
-#include "UserAuthenticationDxeFormset.h"
-
-extern UINT8 UserAuthenticationDxeVfrBin[];
-extern UINT8 UserAuthentication2DxeStrings[];
-
-typedef struct {
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
- EFI_HANDLE DriverHandle;
- EFI_HII_HANDLE HiiHandle;
- UINT8 PasswordState;
- CHAR16 OldPassword[PASSWORD_MAX_SIZE];
-} USER_AUTHENTICATION_PRIVATE_DATA;
-
-#pragma pack(1)
-///
-/// HII specific Vendor Device Path definition.
-///
-typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- EFI_DEVICE_PATH_PROTOCOL End;
-} HII_VENDOR_DEVICE_PATH;
-#pragma pack()
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.h
deleted file mode 100644
index e183424f35..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/** @file
- Header file for UserAuthenticationDxe.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _USER_AUTHENTICATION_DXE_H_
-#define _USER_AUTHENTICATION_DXE_H_
-
-
-#include <Protocol/ReportStatusCodeHandler.h>
-#include <Protocol/HiiConfigAccess.h>
-#include <Protocol/SmmCommunication.h>
-
-#include <Guid/MdeModuleHii.h>
-#include <Guid/HiiPlatformSetupFormset.h>
-#include <Guid/PiSmmCommunicationRegionTable.h>
-#include <Guid/UserAuthentication.h>
-
-#include <Library/PrintLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/BaseLib.h>
-#include <Library/UefiLib.h>
-#include <Library/HiiLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PlatformPasswordLib.h>
-
-#include "UserAuthenticationDxeFormset.h"
-
-extern UINT8 UserAuthenticationDxeVfrBin[];
-extern UINT8 UserAuthenticationDxeStrings[];
-extern EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication;
-
-typedef struct {
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
- EFI_HANDLE DriverHandle;
- EFI_HII_HANDLE HiiHandle;
- UINT8 PasswordState;
- CHAR16 OldPassword[PASSWORD_MAX_SIZE];
-} USER_AUTHENTICATION_PRIVATE_DATA;
-
-#pragma pack(1)
-///
-/// HII specific Vendor Device Path definition.
-///
-typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- EFI_DEVICE_PATH_PROTOCOL End;
-} HII_VENDOR_DEVICE_PATH;
-#pragma pack()
-
-/**
- Validate if the password is correct.
-
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval EFI_SUCCESS The password is correct.
- @retval EFI_SECURITY_VIOLATION The password is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
-**/
-EFI_STATUS
-VerifyPassword (
- IN CHAR16 *Password,
- IN UINTN PasswordSize
- );
-
-/**
- Set a new password.
-
- @param[in] NewPassword The user input new password.
- NULL means clear password.
- @param[in] NewPasswordSize The size of NewPassword in byte.
- @param[in] OldPassword The user input old password.
- NULL means no old password.
- @param[in] OldPasswordSize The size of OldPassword in byte.
-
- @retval EFI_SUCCESS The NewPassword is set successfully.
- @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
- @retval EFI_UNSUPPORTED NewPassword is not strong enough.
- @retval EFI_ALREADY_STARTED NewPassword is in history.
-**/
-EFI_STATUS
-SetPassword (
- IN CHAR16 *NewPassword, OPTIONAL
- IN UINTN NewPasswordSize,
- IN CHAR16 *OldPassword, OPTIONAL
- IN UINTN OldPasswordSize
- );
-
-/**
- Return if the password is set.
-
- @retval TRUE The password is set.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-IsPasswordInstalled (
- VOID
- );
-
-/**
- Get password verification policy.
-
- @param[out] VerifyPolicy Verification policy.
-
- @retval EFI_SUCCESS Get verification policy successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verification policy.
-**/
-EFI_STATUS
-GetPasswordVerificationPolicy (
- OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy
- );
-
-/**
- Return if the password was verified.
-
- @retval TRUE The password was verified.
- @retval FALSE The password was not verified.
-**/
-BOOLEAN
-WasPasswordVerified (
- VOID
- );
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeFormset.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeFormset.h
deleted file mode 100644
index 581849b534..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeFormset.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/** @file
- Header file for UserAuthentication formset.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _USER_AUTHENTICATION_DXE_FORMSET_H_
-#define _USER_AUTHENTICATION_DXE_FORMSET_H_
-
-//
-// Vendor GUID of the formset
-//
-#define USER_AUTHENTICATION_FORMSET_GUID \
- { 0x760e3022, 0xf149, 0x4560, {0x9c, 0x6f, 0x33, 0xaa, 0x7d, 0x48, 0x75, 0xfa} }
-
-#define ADMIN_PASSWORD_KEY_ID 0x2001
-
-#define MAX_PASSWORD_LEN 32
-#define MIN_PASSWORD_LEN 0
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.h
deleted file mode 100644
index 47bb95529f..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/** @file
- Header file for UserAuthenticationSmm.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __USER_AUTHENTICATION_SMM_H__
-#define __USER_AUTHENTICATION_SMM_H__
-
-#include <PiSmm.h>
-
-#include <Protocol/SmmVariable.h>
-#include <Protocol/VariableLock.h>
-
-#include <Guid/UserAuthentication.h>
-
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PrintLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/SmmServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/SmmServicesTableLib.h>
-#include <Library/BaseCryptLib.h>
-#include <Library/PlatformPasswordLib.h>
-
-#include "KeyService.h"
-
-#define PASSWORD_SALT_SIZE 32
-#define PASSWORD_HASH_SIZE 32 // SHA256_DIGEST_SIZE
-
-#define PASSWORD_MAX_TRY_COUNT 3
-#define PASSWORD_HISTORY_CHECK_COUNT 5
-
-//
-// Name of the variable
-//
-#define USER_AUTHENTICATION_VAR_NAME L"Password"
-#define USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME L"PasswordLast"
-
-//
-// Variable storage
-//
-typedef struct {
- UINT8 PasswordHash[PASSWORD_HASH_SIZE];
- UINT8 PasswordSalt[PASSWORD_SALT_SIZE];
-} USER_PASSWORD_VAR_STRUCT;
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeVfr.vfr b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeVfr.vfr
deleted file mode 100644
index ca1d5ddec1..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeVfr.vfr
+++ /dev/null
@@ -1,39 +0,0 @@
-///** @file
-// UserAuthentication formset.
-//
-// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-//**/
-
-#include <Guid/HiiPlatformSetupFormset.h>
-#include "UserAuthenticationDxeFormset.h"
-
-formset
- guid = USER_AUTHENTICATION_FORMSET_GUID,
- title = STRING_TOKEN(STR_FORM_SET_TITLE),
- help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
- classguid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID,
-
- form formid = 1,
- title = STRING_TOKEN(STR_FORM_TITLE);
-
- grayoutif TRUE;
- text
- help = STRING_TOKEN(STR_ADMIN_PASSWORD_STS_HELP),
- text = STRING_TOKEN(STR_ADMIN_PASSWORD_STS_PROMPT),
- text = STRING_TOKEN(STR_ADMIN_PASSWORD_STS_CONTENT);
- endif;
-
- password
- prompt = STRING_TOKEN(STR_ADMIN_PASSWORD_PROMPT),
- help = STRING_TOKEN(STR_ADMIN_PASSWORD_HELP),
- flags = INTERACTIVE,
- key = ADMIN_PASSWORD_KEY_ID,
- minsize = MIN_PASSWORD_LEN,
- maxsize = MAX_PASSWORD_LEN,
- endpassword;
-
- endform;
-
-endformset;
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c b/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c
deleted file mode 100644
index 08e081aa99..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/** @file
- NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared
- but returns the PCD value directly. This instance can be used to verify security
- related features during platform enabling and development. It should be replaced
- by a platform-specific method(e.g. Button pressed) in a real platform for product.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-BOOLEAN mPasswordCleared = FALSE;
-
-/**
- This function is called at password driver entrypoint.
- This function should be called only once, to clear the password.
-
- This function provides a way to reset the password, just in case
- the platform owner forgets the password.
- The platform should provide a secure way to make sure
- only the platform owner is allowed to clear password.
-
- Once the password is cleared, the platform should provide a way
- to set a new password.
-
- @retval TRUE There is a platform request to clear the password.
- @retval FALSE There is no platform request to clear the password.
-**/
-BOOLEAN
-EFIAPI
-IsPasswordCleared (
- VOID
- )
-{
- return mPasswordCleared;
-}
-
-/**
- This function is called if the password driver finds that the password is not enrolled,
- when the password is required to input.
-
- This function should return the action according to platform policy.
-
- @retval TRUE The caller should force the user to enroll the password.
- @retval FALSE The caller may skip the password enroll.
-**/
-BOOLEAN
-EFIAPI
-NeedEnrollPassword (
- VOID
- )
-{
- return FALSE;
-}
-
-
-/**
- Save password clear state from a PCD to mPasswordCleared.
-
- @param ImageHandle ImageHandle of the loaded driver.
- @param SystemTable Pointer to the EFI System Table.
-
- @retval EFI_SUCCESS PcdPasswordCleared is got successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformPasswordLibNullConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
-
- mPasswordCleared = PcdGetBool(PcdPasswordCleared);
-
- return EFI_SUCCESS;
-}
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c
deleted file mode 100644
index cbaf572378..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/** @file
- UserPasswordLib instance implementation provides services to
- set/verify password and return if the password is set.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Protocol/SmmCommunication.h>
-
-#include <Guid/PiSmmCommunicationRegionTable.h>
-#include <Guid/UserAuthentication.h>
-
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-
-/**
- Initialize the communicate buffer using DataSize and Function.
-
- @param[out] DataPtr Points to the data in the communicate buffer.
- @param[in] DataSize The data size to send to SMM.
- @param[in] Function The function number to initialize the communicate header.
-
- @return Communicate buffer.
-**/
-VOID*
-UserPasswordLibInitCommunicateBuffer (
- OUT VOID **DataPtr OPTIONAL,
- IN UINTN DataSize,
- IN UINTN Function
- )
-{
- EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
- VOID *Buffer;
- EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable;
- EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
- UINTN Index;
- UINTN Size;
- EFI_STATUS Status;
-
- Buffer = NULL;
- Status = EfiGetSystemConfigurationTable (
- &gEdkiiPiSmmCommunicationRegionTableGuid,
- (VOID **) &SmmCommRegionTable
- );
- if (EFI_ERROR (Status)) {
- return NULL;
- }
- ASSERT (SmmCommRegionTable != NULL);
- SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
- Size = 0;
- for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) {
- if (SmmCommMemRegion->Type == EfiConventionalMemory) {
- Size = EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages);
- if (Size >= (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) {
- break;
- }
- }
- SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRegion + SmmCommRegionTable->DescriptorSize);
- }
- ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
-
- Buffer = (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart;
- ASSERT (Buffer != NULL);
- SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
- CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid);
- SmmCommunicateHeader->MessageLength = DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data;
- ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER));
- SmmPasswordFunctionHeader->Function = Function;
- if (DataPtr != NULL) {
- *DataPtr = SmmPasswordFunctionHeader + 1;
- }
-
- return Buffer;
-}
-
-/**
- Send the data in communicate buffer to SMM.
-
- @param[in] Buffer Points to the data in the communicate buffer.
- @param[in] DataSize The data size to send to SMM.
-
- @retval EFI_SUCCESS Success is returned from the function in SMM.
- @retval Others Failure is returned from the function in SMM.
-
-**/
-EFI_STATUS
-UserPasswordLibSendCommunicateBuffer (
- IN VOID *Buffer,
- IN UINTN DataSize
- )
-{
- EFI_STATUS Status;
- UINTN CommSize;
- EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
- EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
-
- //
- // Locates SMM Communication protocol.
- //
- Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &SmmCommunication);
- ASSERT_EFI_ERROR (Status);
-
- CommSize = DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- Status = SmmCommunication->Communicate (SmmCommunication, Buffer, &CommSize);
- ASSERT_EFI_ERROR (Status);
-
- SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
- SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data;
- return SmmPasswordFunctionHeader->ReturnStatus;
-}
-
-/**
- Validate if the password is correct.
-
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval EFI_SUCCESS The password is correct.
- @retval EFI_SECURITY_VIOLATION The password is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
-**/
-EFI_STATUS
-EFIAPI
-VerifyPassword (
- IN CHAR16 *Password,
- IN UINTN PasswordSize
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD *VerifyPassword;
-
- ASSERT (Password != NULL);
-
- if (PasswordSize > sizeof(VerifyPassword->Password) * sizeof(CHAR16)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Buffer = UserPasswordLibInitCommunicateBuffer (
- (VOID**)&VerifyPassword,
- sizeof(*VerifyPassword),
- SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = UnicodeStrToAsciiStrS (Password, VerifyPassword->Password, sizeof(VerifyPassword->Password));
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
-
- Status = UserPasswordLibSendCommunicateBuffer (Buffer, sizeof(*VerifyPassword));
-
-EXIT:
- ZeroMem (VerifyPassword, sizeof(*VerifyPassword));
- return Status;
-}
-
-/**
- Set a new password.
-
- @param[in] NewPassword The user input new password.
- NULL means clear password.
- @param[in] NewPasswordSize The size of NewPassword in byte.
- @param[in] OldPassword The user input old password.
- NULL means no old password.
- @param[in] OldPasswordSize The size of OldPassword in byte.
-
- @retval EFI_SUCCESS The NewPassword is set successfully.
- @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
- @retval EFI_UNSUPPORTED NewPassword is not strong enough.
- @retval EFI_ALREADY_STARTED NewPassword is in history.
-**/
-EFI_STATUS
-EFIAPI
-SetPassword (
- IN CHAR16 *NewPassword, OPTIONAL
- IN UINTN NewPasswordSize,
- IN CHAR16 *OldPassword, OPTIONAL
- IN UINTN OldPasswordSize
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_SET_PASSWORD *SetPassword;
-
- if (NewPasswordSize > sizeof(SetPassword->NewPassword) * sizeof(CHAR16)) {
- return EFI_INVALID_PARAMETER;
- }
- if (OldPasswordSize > sizeof(SetPassword->OldPassword) * sizeof(CHAR16)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Buffer = UserPasswordLibInitCommunicateBuffer (
- (VOID**)&SetPassword,
- sizeof(*SetPassword),
- SMM_PASSWORD_FUNCTION_SET_PASSWORD
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (NewPassword != NULL) {
- Status = UnicodeStrToAsciiStrS (NewPassword, SetPassword->NewPassword, sizeof(SetPassword->NewPassword));
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- } else {
- SetPassword->NewPassword[0] = 0;
- }
-
- if (OldPassword != NULL) {
- Status = UnicodeStrToAsciiStrS (OldPassword, SetPassword->OldPassword, sizeof(SetPassword->OldPassword));
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- } else {
- SetPassword->OldPassword[0] = 0;
- }
-
- Status = UserPasswordLibSendCommunicateBuffer (Buffer, sizeof(*SetPassword));
-
-EXIT:
- ZeroMem (SetPassword, sizeof(*SetPassword));
- return Status;
-}
-
-/**
- Return if the password is set.
-
- @retval TRUE The password is set.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-EFIAPI
-IsPasswordInstalled (
- VOID
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
-
- Buffer = UserPasswordLibInitCommunicateBuffer (
- NULL,
- 0,
- SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET
- );
- if (Buffer == NULL) {
- return FALSE;
- }
-
- Status = UserPasswordLibSendCommunicateBuffer (Buffer, 0);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c
deleted file mode 100644
index 050bfda63a..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c
+++ /dev/null
@@ -1,522 +0,0 @@
-/** @file
- UserPasswordUiLib instance provides services to do password authentication.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Protocol/SmmCommunication.h>
-
-#include <Guid/PiSmmCommunicationRegionTable.h>
-#include <Guid/UserAuthentication.h>
-
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PrintLib.h>
-#include <Library/PlatformPasswordLib.h>
-#include <Library/UserPasswordLib.h>
-
-/**
- Initialize the communicate buffer using DataSize and Function.
-
- @param[out] DataPtr Points to the data in the communicate buffer.
- @param[in] DataSize The data size to send to SMM.
- @param[in] Function The function number to initialize the communicate header.
-
- @return Communicate buffer.
-**/
-VOID*
-UserPasswordUiLibInitCommunicateBuffer (
- OUT VOID **DataPtr OPTIONAL,
- IN UINTN DataSize,
- IN UINTN Function
- )
-{
- EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
- VOID *Buffer;
- EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable;
- EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
- UINTN Index;
- UINTN Size;
- EFI_STATUS Status;
-
- Buffer = NULL;
- Status = EfiGetSystemConfigurationTable (
- &gEdkiiPiSmmCommunicationRegionTableGuid,
- (VOID **) &SmmCommRegionTable
- );
- if (EFI_ERROR (Status)) {
- return NULL;
- }
- ASSERT (SmmCommRegionTable != NULL);
- SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
- Size = 0;
- for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) {
- if (SmmCommMemRegion->Type == EfiConventionalMemory) {
- Size = EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages);
- if (Size >= (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) {
- break;
- }
- }
- SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRegion + SmmCommRegionTable->DescriptorSize);
- }
- ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
-
- Buffer = (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart;
- ASSERT (Buffer != NULL);
- SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
- CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid);
- SmmCommunicateHeader->MessageLength = DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data;
- ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER));
- SmmPasswordFunctionHeader->Function = Function;
- if (DataPtr != NULL) {
- *DataPtr = SmmPasswordFunctionHeader + 1;
- }
-
- return Buffer;
-}
-
-/**
- Send the data in communicate buffer to SMM.
-
- @param[in] Buffer Points to the data in the communicate buffer.
- @param[in] DataSize The data size to send to SMM.
-
- @retval EFI_SUCCESS Success is returned from the function in SMM.
- @retval Others Failure is returned from the function in SMM.
-
-**/
-EFI_STATUS
-UserPasswordUiLibSendCommunicateBuffer (
- IN VOID *Buffer,
- IN UINTN DataSize
- )
-{
- EFI_STATUS Status;
- UINTN CommSize;
- EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
- EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
-
- //
- // Locates SMM Communication protocol.
- //
- Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &SmmCommunication);
- ASSERT_EFI_ERROR (Status);
-
- CommSize = DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- Status = SmmCommunication->Communicate (SmmCommunication, Buffer, &CommSize);
- ASSERT_EFI_ERROR (Status);
-
- SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
- SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data;
- return SmmPasswordFunctionHeader->ReturnStatus;
-}
-
-/**
- Set password verification policy.
-
- @param[in] NeedReVerify Need re-verify or not.
-
- @retval EFI_SUCCESS Set verification policy successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to set verification policy.
-**/
-EFI_STATUS
-EFIAPI
-UiSetPasswordVerificationPolicy (
- IN BOOLEAN NeedReVerify
- )
-{
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *SetVerifyPolicy;
-
- Buffer = UserPasswordUiLibInitCommunicateBuffer (
- (VOID**)&SetVerifyPolicy,
- sizeof(*SetVerifyPolicy),
- SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- SetVerifyPolicy->NeedReVerify = NeedReVerify;
-
- return UserPasswordUiLibSendCommunicateBuffer (Buffer, sizeof(*SetVerifyPolicy));
-}
-
-/**
- Get a user input string.
-
- @param[in] PopUpString A popup string to inform user.
- @param[in, out] UserInput The user input string
- @param[in] UserInputMaxLen The max unicode count of the UserInput without NULL terminator.
-**/
-EFI_STATUS
-GetUserInput (
- IN CHAR16 *PopUpString,
- IN OUT CHAR16 *UserInput,
- IN UINTN UserInputMaxLen
- )
-{
- EFI_INPUT_KEY InputKey;
- UINTN InputLength;
- CHAR16 *Mask;
-
- UserInput[0] = 0;
- Mask = AllocateZeroPool ((UserInputMaxLen + 1) * sizeof(CHAR16));
- if (Mask == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- InputLength = 0;
-
- while (TRUE) {
- if (InputLength < UserInputMaxLen) {
- Mask[InputLength] = L'_';
- }
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &InputKey,
- PopUpString,
- L"--------------------------------",
- Mask,
- NULL
- );
- if (InputKey.ScanCode == SCAN_NULL) {
- //
- // Check whether finish inputing password.
- //
- if (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN && InputLength > 0) {
- //
- // Add the null terminator.
- //
- UserInput[InputLength] = 0;
- break;
- } else if ((InputKey.UnicodeChar == CHAR_NULL) ||
- (InputKey.UnicodeChar == CHAR_LINEFEED) ||
- (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN)
- ) {
- continue;
- } else {
- //
- // delete last key entered
- //
- if (InputKey.UnicodeChar == CHAR_BACKSPACE) {
- if (InputLength > 0) {
- UserInput[InputLength] = 0;
- Mask[InputLength] = 0;
- InputLength--;
- }
- } else {
- if (InputLength == UserInputMaxLen) {
- Mask[InputLength] = 0;
- continue;
- }
- //
- // add Next key entry
- //
- UserInput[InputLength] = InputKey.UnicodeChar;
- Mask[InputLength] = L'*';
- InputLength++;
- }
- }
- }
- }
- FreePool (Mask);
- return EFI_SUCCESS;
-}
-
-/**
- Display a message box to end user.
-
- @param[in] DisplayString The string in message box.
-**/
-VOID
-MessageBox (
- IN CHAR16 *DisplayString
- )
-{
- EFI_INPUT_KEY Key;
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
-}
-
-/**
- Force system reset.
-**/
-VOID
-ForceSystemReset (
- VOID
- )
-{
- MessageBox (L"Password retry count reach, reset system!");
- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
- CpuDeadLoop();
-}
-
-/**
- Display message for set password.
-
- @param[in] ReturnStatus The return status for set password.
-**/
-VOID
-PrintSetPasswordStatus (
- IN EFI_STATUS ReturnStatus
- )
-{
- CHAR16 *DisplayString;
- CHAR16 *DisplayString2;
-
- EFI_INPUT_KEY Key;
-
- if (ReturnStatus == EFI_UNSUPPORTED) {
- DisplayString = L"New password is not strong enough!";
- DisplayString2 = L"Password must at least 8 chars and include lowercase, uppercase alphabetic, number and symbol";
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- DisplayString2,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- } else {
- if (ReturnStatus == EFI_SUCCESS) {
- DisplayString = L"New password is updated successfully!";
- } else if (ReturnStatus == EFI_ALREADY_STARTED) {
- DisplayString = L"New password is found in the history passwords!";
- } else {
- DisplayString = L"New password update fails!";
- }
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- }
-}
-
-/**
- Get password verification policy.
-
- @param[out] VerifyPolicy Verification policy.
-
- @retval EFI_SUCCESS Get verification policy successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verification policy.
-**/
-EFI_STATUS
-GetPasswordVerificationPolicy (
- OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *TempVerifyPolicy;
-
- Buffer = UserPasswordUiLibInitCommunicateBuffer (
- (VOID**)&TempVerifyPolicy,
- sizeof(*TempVerifyPolicy),
- SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = UserPasswordUiLibSendCommunicateBuffer (Buffer, sizeof(*TempVerifyPolicy));
- if (!EFI_ERROR (Status)) {
- CopyMem (VerifyPolicy, TempVerifyPolicy, sizeof (SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY));
- }
-
- return Status;
-}
-
-/**
- Return if the password was verified.
-
- @retval TRUE The password was verified.
- @retval FALSE The password was not verified.
-**/
-BOOLEAN
-WasPasswordVerified (
- VOID
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
-
- Buffer = UserPasswordUiLibInitCommunicateBuffer (
- NULL,
- 0,
- SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED
- );
- if (Buffer == NULL) {
- return FALSE;
- }
-
- Status = UserPasswordUiLibSendCommunicateBuffer (Buffer, 0);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- Require user input password.
-
- @retval TRUE User input correct password successfully.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-RequireUserPassword (
- VOID
- )
-{
- EFI_STATUS Status;
- CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
- CHAR16 *PopUpString;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY VerifyPolicy;
-
- Status = EFI_SUCCESS;
- ZeroMem(UserInputPw, sizeof(UserInputPw));
-
- if (!IsPasswordInstalled ()) {
- return FALSE;
- }
-
- Status = GetPasswordVerificationPolicy (&VerifyPolicy);
- if (!EFI_ERROR (Status)) {
- if (WasPasswordVerified() && (!VerifyPolicy.NeedReVerify)) {
- DEBUG ((DEBUG_INFO, "Password was verified and Re-verify is not needed\n"));
- return TRUE;
- }
- }
-
- PopUpString = L"Please input admin password";
-
- while (TRUE) {
- gST->ConOut->ClearScreen(gST->ConOut);
- GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
-
- Status = VerifyPassword (UserInputPw, StrSize(UserInputPw));
- if (!EFI_ERROR(Status)) {
- break;
- }
- if (Status == EFI_ACCESS_DENIED) {
- //
- // Password retry count reach.
- //
- ForceSystemReset ();
- }
- MessageBox (L"Incorrect password!");
- }
-
- ZeroMem(UserInputPw, sizeof(UserInputPw));
-
- gST->ConOut->ClearScreen(gST->ConOut);
-
- return TRUE;
-}
-
-/**
- Set user password.
-
-**/
-VOID
-SetUserPassword (
- VOID
- )
-{
- EFI_STATUS Status;
- CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
- CHAR16 TmpPassword[PASSWORD_MAX_SIZE];
- CHAR16 *PopUpString;
- CHAR16 *PopUpString2;
-
- ZeroMem(UserInputPw, sizeof(UserInputPw));
- ZeroMem(TmpPassword, sizeof(TmpPassword));
-
- PopUpString = L"Please set admin password";
-
- while (TRUE) {
- gST->ConOut->ClearScreen(gST->ConOut);
- GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
-
- PopUpString2 = L"Please confirm your new password";
- gST->ConOut->ClearScreen(gST->ConOut);
- GetUserInput (PopUpString2, TmpPassword, PASSWORD_MAX_SIZE - 1);
- if (StrCmp (TmpPassword, UserInputPw) != 0) {
- MessageBox (L"Password are not the same!");
- continue;
- }
-
- Status = SetPassword (UserInputPw, StrSize(UserInputPw), NULL, 0);
- PrintSetPasswordStatus (Status);
- if (!EFI_ERROR(Status)) {
- break;
- }
- }
-
- ZeroMem(UserInputPw, sizeof(UserInputPw));
- ZeroMem(TmpPassword, sizeof(TmpPassword));
-
- gST->ConOut->ClearScreen(gST->ConOut);
-}
-
-/**
- Do password authentication.
-
- @retval EFI_SUCCESS Password authentication pass.
-**/
-EFI_STATUS
-EFIAPI
-UiDoPasswordAuthentication (
- VOID
- )
-{
- BOOLEAN PasswordSet;
-
- PasswordSet = RequireUserPassword ();
- if (PasswordSet) {
- DEBUG ((DEBUG_INFO, "Welcome Admin!\n"));
- } else {
- DEBUG ((DEBUG_INFO, "Admin password is not set!\n"));
- if (NeedEnrollPassword()) {
- SetUserPassword ();
- }
- }
-
- return EFI_SUCCESS;
-}
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.c
deleted file mode 100644
index 8b06e58ca5..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/** @file
- Password key service.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Uefi.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/BaseCryptLib.h>
-#include "KeyService.h"
-
-/**
- Compares the contents of two buffers with slow algorithm
-
- This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
- If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
- value returned is the first mismatched byte in SourceBuffer subtracted from the first
- mismatched byte in DestinationBuffer.
-
- If Length > 0 and DestinationBuffer is NULL, then ASSERT().
- If Length > 0 and SourceBuffer is NULL, then ASSERT().
- If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
- If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
-
- @param DestinationBuffer The pointer to the destination buffer to compare.
- @param SourceBuffer The pointer to the source buffer to compare.
- @param Length The number of bytes to compare.
-
- @return 0 All Length bytes of the two buffers are identical.
- @retval -1 The SourceBuffer is not identical to DestinationBuffer.
-
-**/
-INTN
-EFIAPI
-KeyLibSlowCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
- )
-{
- UINT8 Delta;
- UINTN Index;
- UINT8 *Destination;
- UINT8 *Source;
-
- Destination = (UINT8 *)DestinationBuffer;
- Source = (UINT8 *)SourceBuffer;
- Delta = 0;
- for (Index = 0; Index < Length; Index++) {
- Delta |= Destination[Index] ^ Source[Index];
- }
- if (Delta == 0) {
- return 0;
- } else {
- return -1;
- }
-}
-
-/**
- Generate Salt value.
-
- @param[in, out] SaltValue Points to the salt buffer
- @param[in] SaltSize Size of the salt buffer
-
- @retval TRUE Salt is generated.
- @retval FALSE Salt is not generated.
-**/
-BOOLEAN
-EFIAPI
-KeyLibGenerateSalt (
- IN OUT UINT8 *SaltValue,
- IN UINTN SaltSize
- )
-{
- if (SaltValue == NULL) {
- return FALSE;
- }
- RandomSeed(NULL, 0);
- RandomBytes(SaltValue, SaltSize);
- return TRUE;
-}
-
-/**
- Hash the password with PBKDF2.
-
- @param[in] HashType Hash type
- @param[in] Key Points to the key buffer
- @param[in] KeySize Key buffer size
- @param[in] SaltValue Points to the salt buffer
- @param[in] SaltSize Size of the salt buffer
- @param[out] KeyHash Points to the hashed result
- @param[in] KeyHashSize Size of the hash buffer
-
- @retval TRUE Hash the data successfully.
- @retval FALSE Failed to hash the data.
-
-**/
-BOOLEAN
-EFIAPI
-KeyLibGeneratePBKDF2Hash (
- IN UINT32 HashType,
- IN VOID *Key,
- IN UINTN KeySize,
- IN UINT8 *SaltValue,
- IN UINTN SaltSize,
- OUT UINT8 *KeyHash,
- IN UINTN KeyHashSize
- )
-{
- BOOLEAN Result;
-
- if (HashType != HASH_TYPE_SHA256) {
- return FALSE;
- }
- if (KeyHashSize != SHA256_DIGEST_SIZE) {
- return FALSE;
- }
-
- Result = Pkcs5HashPassword (
- KeySize,
- Key,
- SaltSize,
- SaltValue,
- DEFAULT_PBKDF2_ITERATION_COUNT,
- SHA256_DIGEST_SIZE,
- KeyHashSize,
- KeyHash
- );
- return Result;
-}
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c
deleted file mode 100644
index b4326d380f..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c
+++ /dev/null
@@ -1,484 +0,0 @@
-/** @file
- This Driver mainly provides Setup Form to change password.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "UserAuthentication2Dxe.h"
-
-USER_AUTHENTICATION_PRIVATE_DATA *mUserAuthenticationData = NULL;
-
-EFI_GUID mUserAuthenticationVendorGuid = USER_AUTHENTICATION_FORMSET_GUID;
-HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- }
- },
- USER_AUTHENTICATION_FORMSET_GUID
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
- }
- }
-};
-
-/**
- Display a message box to end user.
-
- @param[in] DisplayString The string in message box.
-**/
-VOID
-MessageBox (
- IN CHAR16 *DisplayString
- )
-{
- EFI_INPUT_KEY Key;
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
-}
-
-/**
- Force system reset.
-**/
-VOID
-ForceSystemReset (
- VOID
- )
-{
- MessageBox (L"Password retry count reach, reset system!");
- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
- CpuDeadLoop();
-}
-
-/**
- Display message for set password.
-
- @param[in] ReturnStatus The return status for set password.
-**/
-VOID
-PrintSetPasswordStatus (
- IN EFI_STATUS ReturnStatus
- )
-{
- CHAR16 *DisplayString;
- CHAR16 *DisplayString2;
-
- EFI_INPUT_KEY Key;
-
- if (ReturnStatus == EFI_UNSUPPORTED) {
- DisplayString = L"New password is not strong enough!";
- DisplayString2 = L"Password must at least 8 chars and include lowercase, uppercase alphabetic, number and symbol";
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- DisplayString2,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- } else {
- if (ReturnStatus == EFI_SUCCESS) {
- DisplayString = L"New password is updated successfully!";
- } else if (ReturnStatus == EFI_ALREADY_STARTED) {
- DisplayString = L"New password is found in the history passwords!";
- } else {
- DisplayString = L"New password update fails!";
- }
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- }
-}
-
-/**
- This function allows a caller to extract the current configuration for one
- or more named elements from the target driver.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Request A null-terminated Unicode string in
- <ConfigRequest> 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_SUCCESS The Results is filled with the requested values.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
- @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
- driver.
-
-**/
-EFI_STATUS
-EFIAPI
-ExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
- )
-{
- if (Progress == NULL || Results == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- *Progress = Request;
- return EFI_NOT_FOUND;
-}
-
-
-/**
- This function processes the results of changes in configuration.
-
- @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_SUCCESS The Results is processed successfully.
- @retval EFI_INVALID_PARAMETER Configuration is NULL.
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
- driver.
-
-**/
-EFI_STATUS
-EFIAPI
-RouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
- )
-{
- if (Configuration == NULL || Progress == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Progress = Configuration;
-
- return EFI_NOT_FOUND;
-}
-
-/**
- HII update Admin Password status.
-
-**/
-VOID
-HiiUpdateAdminPasswordStatus (
- VOID
- )
-{
- if (IsPasswordInstalled ()) {
- HiiSetString (
- mUserAuthenticationData->HiiHandle,
- STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
- L"Installed",
- NULL
- );
- } else {
- HiiSetString (
- mUserAuthenticationData->HiiHandle,
- STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
- L"Not Installed",
- NULL
- );
- }
-}
-
-/**
- This function processes the results of changes in configuration.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original
- exporting driver so that it can identify the type
- of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original
- exporting driver.
- @param ActionRequest On return, points to the action requested by the
- callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
- variable and its data.
- @retval EFI_DEVICE_ERROR The variable could not be saved.
- @retval EFI_UNSUPPORTED The specified Action is not supported by the
- callback.
-
-**/
-EFI_STATUS
-EFIAPI
-UserAuthenticationCallback (
- 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;
- CHAR16 *UserInputPassword;
-
- Status = EFI_SUCCESS;
-
- if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE)) ||
- (ActionRequest == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- switch (Action) {
- case EFI_BROWSER_ACTION_FORM_OPEN:
- {
- switch (QuestionId) {
- case ADMIN_PASSWORD_KEY_ID:
- HiiUpdateAdminPasswordStatus ();
- default:
- break;
- }
- }
- break;
- case EFI_BROWSER_ACTION_CHANGING:
- {
- switch (QuestionId) {
- case ADMIN_PASSWORD_KEY_ID:
- if ((Type == EFI_IFR_TYPE_STRING) && (Value->string == 0) &&
- (mUserAuthenticationData->PasswordState == BROWSER_STATE_SET_PASSWORD)) {
- mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
- ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
- return EFI_INVALID_PARAMETER;
- }
- //
- // The Callback is responsible for validating old password input by user,
- // If Callback return EFI_SUCCESS, it indicates validation pass.
- //
- switch (mUserAuthenticationData->PasswordState) {
- case BROWSER_STATE_VALIDATE_PASSWORD:
- UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
- if (UserInputPassword == NULL) {
- return EFI_UNSUPPORTED;
- }
- if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
- Status = EFI_NOT_READY;
- break;
- }
- if (UserInputPassword[0] == 0) {
- //
- // Setup will use an empty password to check whether the old password is set,
- // If the validation is successful, means there is no old password, return
- // success to set the new password. Or need to return EFI_NOT_READY to
- // let user input the old password.
- //
- Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
- if (Status == EFI_SUCCESS) {
- mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
- } else {
- Status = EFI_NOT_READY;
- }
- break;
- }
- Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
- if (Status == EFI_SUCCESS) {
- mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
- StrCpyS (
- mUserAuthenticationData->OldPassword,
- sizeof(mUserAuthenticationData->OldPassword)/sizeof(CHAR16),
- UserInputPassword
- );
- } else {
- //
- // Old password mismatch, return EFI_NOT_READY to prompt for error message.
- //
- if (Status == EFI_ACCESS_DENIED) {
- //
- // Password retry count reach.
- //
- ForceSystemReset ();
- }
- Status = EFI_NOT_READY;
- }
- break;
-
- case BROWSER_STATE_SET_PASSWORD:
- UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
- if (UserInputPassword == NULL) {
- return EFI_UNSUPPORTED;
- }
- if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
- Status = EFI_NOT_READY;
- break;
- }
- Status = SetPassword (UserInputPassword, StrSize (UserInputPassword), mUserAuthenticationData->OldPassword, StrSize(mUserAuthenticationData->OldPassword));
- PrintSetPasswordStatus (Status);
- ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
- mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
- HiiUpdateAdminPasswordStatus ();
- break;
-
- default:
- break;
- }
- default:
- break;
- }
- }
- break;
- default:
- break;
- }
- return Status;
-}
-
-/**
- User Authentication entry point.
-
- @param ImageHandle The image handle.
- @param SystemTable The system table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @return other Contain some other errors.
-
-**/
-EFI_STATUS
-EFIAPI
-UserAuthentication2Entry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE DriverHandle;
- EFI_HII_HANDLE HiiHandle;
-
- DriverHandle = NULL;
-
- mUserAuthenticationData = AllocateZeroPool (sizeof (USER_AUTHENTICATION_PRIVATE_DATA));
- if (mUserAuthenticationData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- mUserAuthenticationData->ConfigAccess.ExtractConfig = ExtractConfig;
- mUserAuthenticationData->ConfigAccess.RouteConfig = RouteConfig;
- mUserAuthenticationData->ConfigAccess.Callback = UserAuthenticationCallback;
- mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
-
- //
- // Install Config Access protocol to driver handle.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &mUserAuthenticationData->ConfigAccess,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- mUserAuthenticationData->DriverHandle = DriverHandle;
-
- //
- // Add HII data to database.
- //
- HiiHandle = HiiAddPackages (
- &mUserAuthenticationVendorGuid,
- DriverHandle,
- UserAuthentication2DxeStrings,
- UserAuthenticationDxeVfrBin,
- NULL
- );
- if (HiiHandle == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- mUserAuthenticationData->HiiHandle = HiiHandle;
-
- return EFI_SUCCESS;
-}
-
-/**
- Unloads the application and its installed protocol.
-
- @param[in] ImageHandle Handle that identifies the image to be unloaded.
-
- @retval EFI_SUCCESS The image has been unloaded.
-**/
-EFI_STATUS
-EFIAPI
-UserAuthentication2Unload (
- IN EFI_HANDLE ImageHandle
- )
-{
- ASSERT (mUserAuthenticationData != NULL);
-
- //
- // Uninstall Config Access Protocol.
- //
- if (mUserAuthenticationData->DriverHandle != NULL) {
- gBS->UninstallMultipleProtocolInterfaces (
- mUserAuthenticationData->DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &mUserAuthenticationData->ConfigAccess,
- NULL
- );
- mUserAuthenticationData->DriverHandle = NULL;
- }
-
- //
- // Remove Hii Data.
- //
- if (mUserAuthenticationData->HiiHandle != NULL) {
- HiiRemovePackages (mUserAuthenticationData->HiiHandle);
- }
-
- FreePool (mUserAuthenticationData);
- mUserAuthenticationData = NULL;
-
- return EFI_SUCCESS;
-}
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.c
deleted file mode 100644
index bba2057a96..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.c
+++ /dev/null
@@ -1,780 +0,0 @@
-/** @file
- This Driver mainly provides Setup Form to change password and
- does user authentication before entering Setup.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "UserAuthenticationDxe.h"
-
-EFI_EVENT mExitBootServicesEvent = NULL;
-EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
-USER_AUTHENTICATION_PRIVATE_DATA *mUserAuthenticationData = NULL;
-EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL;
-
-EFI_GUID mUserAuthenticationVendorGuid = USER_AUTHENTICATION_FORMSET_GUID;
-HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- }
- },
- USER_AUTHENTICATION_FORMSET_GUID
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
- }
- }
-};
-
-/**
- Get a user input string.
-
- @param[in] PopUpString A popup string to inform user.
- @param[in, out] UserInput The user input string
- @param[in] UserInputMaxLen The max unicode count of the UserInput without NULL terminator.
-**/
-EFI_STATUS
-GetUserInput (
- IN CHAR16 *PopUpString,
- IN OUT CHAR16 *UserInput,
- IN UINTN UserInputMaxLen
- )
-{
- EFI_INPUT_KEY InputKey;
- UINTN InputLength;
- CHAR16 *Mask;
-
- UserInput[0] = 0;
- Mask = AllocateZeroPool ((UserInputMaxLen + 1) * sizeof(CHAR16));
- if (Mask == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- InputLength = 0;
-
- while (TRUE) {
- if (InputLength < UserInputMaxLen) {
- Mask[InputLength] = L'_';
- }
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &InputKey,
- PopUpString,
- L"--------------------------------",
- Mask,
- NULL
- );
- if (InputKey.ScanCode == SCAN_NULL) {
- //
- // Check whether finish inputing password.
- //
- if (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN && InputLength > 0) {
- //
- // Add the null terminator.
- //
- UserInput[InputLength] = 0;
- break;
- } else if ((InputKey.UnicodeChar == CHAR_NULL) ||
- (InputKey.UnicodeChar == CHAR_LINEFEED) ||
- (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN)
- ) {
- continue;
- } else {
- //
- // delete last key entered
- //
- if (InputKey.UnicodeChar == CHAR_BACKSPACE) {
- if (InputLength > 0) {
- UserInput[InputLength] = 0;
- Mask[InputLength] = 0;
- InputLength--;
- }
- } else {
- if (InputLength == UserInputMaxLen) {
- Mask[InputLength] = 0;
- continue;
- }
- //
- // add Next key entry
- //
- UserInput[InputLength] = InputKey.UnicodeChar;
- Mask[InputLength] = L'*';
- InputLength++;
- }
- }
- }
- }
- FreePool (Mask);
- return EFI_SUCCESS;
-}
-
-/**
- Display a message box to end user.
-
- @param[in] DisplayString The string in message box.
-**/
-VOID
-MessageBox (
- IN CHAR16 *DisplayString
- )
-{
- EFI_INPUT_KEY Key;
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
-}
-
-/**
- Force system reset.
-**/
-VOID
-ForceSystemReset (
- VOID
- )
-{
- MessageBox (L"Password retry count reach, reset system!");
- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
- CpuDeadLoop();
-}
-
-/**
- Display message for set password.
-
- @param[in] ReturnStatus The return status for set password.
-**/
-VOID
-PrintSetPasswordStatus (
- IN EFI_STATUS ReturnStatus
- )
-{
- CHAR16 *DisplayString;
- CHAR16 *DisplayString2;
-
- EFI_INPUT_KEY Key;
-
- if (ReturnStatus == EFI_UNSUPPORTED) {
- DisplayString = L"New password is not strong enough!";
- DisplayString2 = L"Password must at least 8 chars and include lowercase, uppercase alphabetic, number and symbol";
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- DisplayString2,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- } else {
- if (ReturnStatus == EFI_SUCCESS) {
- DisplayString = L"New password is updated successfully!";
- } else if (ReturnStatus == EFI_ALREADY_STARTED) {
- DisplayString = L"New password is found in the history passwords!";
- } else {
- DisplayString = L"New password update fails!";
- }
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- }
-}
-
-/**
- Require user input password.
-
- @retval TRUE User input correct password successfully.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-RequireUserPassword (
- VOID
- )
-{
- EFI_STATUS Status;
- CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
- CHAR16 *PopUpString;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY VerifyPolicy;
-
- Status = EFI_SUCCESS;
- ZeroMem(UserInputPw, sizeof(UserInputPw));
-
- if (!IsPasswordInstalled ()) {
- return FALSE;
- }
-
- Status = GetPasswordVerificationPolicy (&VerifyPolicy);
- if (!EFI_ERROR (Status)) {
- if (WasPasswordVerified() && (!VerifyPolicy.NeedReVerify)) {
- DEBUG ((DEBUG_INFO, "Password was verified and Re-verify is not needed\n"));
- return TRUE;
- }
- }
-
- PopUpString = L"Please input admin password";
-
- while (TRUE) {
- gST->ConOut->ClearScreen(gST->ConOut);
- GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
-
- Status = VerifyPassword (UserInputPw, StrSize(UserInputPw));
- if (!EFI_ERROR(Status)) {
- break;
- }
- if (Status == EFI_ACCESS_DENIED) {
- //
- // Password retry count reach.
- //
- ForceSystemReset ();
- }
- MessageBox (L"Incorrect password!");
- }
-
- ZeroMem(UserInputPw, sizeof(UserInputPw));
-
- gST->ConOut->ClearScreen(gST->ConOut);
-
- return TRUE;
-}
-
-/**
- Set user password.
-
-**/
-VOID
-SetUserPassword (
- VOID
- )
-{
- EFI_STATUS Status;
- CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
- CHAR16 TmpPassword[PASSWORD_MAX_SIZE];
- CHAR16 *PopUpString;
- CHAR16 *PopUpString2;
-
- ZeroMem(UserInputPw, sizeof(UserInputPw));
- ZeroMem(TmpPassword, sizeof(TmpPassword));
-
- PopUpString = L"Please set admin password";
-
- while (TRUE) {
- gST->ConOut->ClearScreen(gST->ConOut);
- GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
-
- PopUpString2 = L"Please confirm your new password";
- gST->ConOut->ClearScreen(gST->ConOut);
- GetUserInput (PopUpString2, TmpPassword, PASSWORD_MAX_SIZE - 1);
- if (StrCmp (TmpPassword, UserInputPw) != 0) {
- MessageBox (L"Password are not the same!");
- continue;
- }
-
- Status = SetPassword (UserInputPw, StrSize(UserInputPw), NULL, 0);
- PrintSetPasswordStatus (Status);
- if (!EFI_ERROR(Status)) {
- break;
- }
- }
-
- ZeroMem(UserInputPw, sizeof(UserInputPw));
- ZeroMem(TmpPassword, sizeof(TmpPassword));
-
- gST->ConOut->ClearScreen(gST->ConOut);
-}
-
-/**
- Check password before entering into setup.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @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. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. 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.
- Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @retval EFI_SUCCESS Status code is what we expected.
- @retval EFI_UNSUPPORTED Status code not supported.
-
-**/
-EFI_STATUS
-EFIAPI
-CheckForPassword (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId, OPTIONAL
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- BOOLEAN PasswordSet;
-
- if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) &&
- (Value == (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP))) {
- //
- // Check whether enter setup page.
- //
- PasswordSet = RequireUserPassword ();
- if (PasswordSet) {
- DEBUG ((DEBUG_INFO, "Welcome Admin!\n"));
- } else {
- DEBUG ((DEBUG_INFO, "Admin password is not set!\n"));
- if (NeedEnrollPassword()) {
- SetUserPassword ();
- }
- }
-
- return EFI_SUCCESS;
- } else{
- return EFI_UNSUPPORTED;
- }
-}
-
-/**
- This function allows a caller to extract the current configuration for one
- or more named elements from the target driver.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Request A null-terminated Unicode string in
- <ConfigRequest> 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_SUCCESS The Results is filled with the requested values.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
- @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
- driver.
-
-**/
-EFI_STATUS
-EFIAPI
-ExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
- )
-{
- if (Progress == NULL || Results == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- *Progress = Request;
- return EFI_NOT_FOUND;
-}
-
-
-/**
- This function processes the results of changes in configuration.
-
- @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_SUCCESS The Results is processed successfully.
- @retval EFI_INVALID_PARAMETER Configuration is NULL.
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
- driver.
-
-**/
-EFI_STATUS
-EFIAPI
-RouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
- )
-{
- if (Configuration == NULL || Progress == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Progress = Configuration;
-
- return EFI_NOT_FOUND;
-}
-
-/**
- HII update Admin Password status.
-
-**/
-VOID
-HiiUpdateAdminPasswordStatus (
- VOID
- )
-{
- if (IsPasswordInstalled ()) {
- HiiSetString (
- mUserAuthenticationData->HiiHandle,
- STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
- L"Installed",
- NULL
- );
- } else {
- HiiSetString (
- mUserAuthenticationData->HiiHandle,
- STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
- L"Not Installed",
- NULL
- );
- }
-}
-
-/**
- This function processes the results of changes in configuration.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original
- exporting driver so that it can identify the type
- of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original
- exporting driver.
- @param ActionRequest On return, points to the action requested by the
- callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
- variable and its data.
- @retval EFI_DEVICE_ERROR The variable could not be saved.
- @retval EFI_UNSUPPORTED The specified Action is not supported by the
- callback.
-
-**/
-EFI_STATUS
-EFIAPI
-UserAuthenticationCallback (
- 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;
- CHAR16 *UserInputPassword;
-
- Status = EFI_SUCCESS;
-
- if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE)) ||
- (ActionRequest == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- switch (Action) {
- case EFI_BROWSER_ACTION_FORM_OPEN:
- {
- switch (QuestionId) {
- case ADMIN_PASSWORD_KEY_ID:
- HiiUpdateAdminPasswordStatus ();
- default:
- break;
- }
- }
- break;
- case EFI_BROWSER_ACTION_CHANGING:
- {
- switch (QuestionId) {
- case ADMIN_PASSWORD_KEY_ID:
- if ((Type == EFI_IFR_TYPE_STRING) && (Value->string == 0) &&
- (mUserAuthenticationData->PasswordState == BROWSER_STATE_SET_PASSWORD)) {
- mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
- ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
- return EFI_INVALID_PARAMETER;
- }
- //
- // The Callback is responsible for validating old password input by user,
- // If Callback return EFI_SUCCESS, it indicates validation pass.
- //
- switch (mUserAuthenticationData->PasswordState) {
- case BROWSER_STATE_VALIDATE_PASSWORD:
- UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
- if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
- Status = EFI_NOT_READY;
- break;
- }
- if (UserInputPassword[0] == 0) {
- //
- // Setup will use a NULL password to check whether the old password is set,
- // If the validation is successful, means there is no old password, return
- // success to set the new password. Or need to return EFI_NOT_READY to
- // let user input the old password.
- //
- Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
- if (Status == EFI_SUCCESS) {
- mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
- } else {
- Status = EFI_NOT_READY;
- }
- break;
- }
- Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
- if (Status == EFI_SUCCESS) {
- mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
- StrCpyS (
- mUserAuthenticationData->OldPassword,
- sizeof(mUserAuthenticationData->OldPassword)/sizeof(CHAR16),
- UserInputPassword
- );
- } else {
- //
- // Old password mismatch, return EFI_NOT_READY to prompt for error message.
- //
- if (Status == EFI_ACCESS_DENIED) {
- //
- // Password retry count reach.
- //
- ForceSystemReset ();
- }
- Status = EFI_NOT_READY;
- }
- break;
-
- case BROWSER_STATE_SET_PASSWORD:
- UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
- if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
- Status = EFI_NOT_READY;
- break;
- }
- Status = SetPassword (UserInputPassword, StrSize (UserInputPassword), mUserAuthenticationData->OldPassword, StrSize(mUserAuthenticationData->OldPassword));
- PrintSetPasswordStatus (Status);
- ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
- mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
- HiiUpdateAdminPasswordStatus ();
- break;
-
- default:
- break;
- }
- default:
- break;
- }
- }
- break;
- default:
- break;
- }
- return Status;
-}
-
-/**
- Unregister status code callback functions.
-
- @param Event Event whose notification function is being invoked.
- @param Context Pointer to the notification function's context, which is
- always zero in current implementation.
-
-**/
-VOID
-EFIAPI
-UnregisterBootTimeHandlers (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- mRscHandlerProtocol->Unregister (CheckForPassword);
-}
-
-/**
- User Authentication entry point.
-
- @param ImageHandle The image handle.
- @param SystemTable The system table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @return other Contain some other errors.
-
-**/
-EFI_STATUS
-EFIAPI
-UserAuthenticationEntry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE DriverHandle;
- EFI_HII_HANDLE HiiHandle;
-
- DriverHandle = NULL;
-
- mUserAuthenticationData = AllocateZeroPool (sizeof (USER_AUTHENTICATION_PRIVATE_DATA));
- if (mUserAuthenticationData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- mUserAuthenticationData->ConfigAccess.ExtractConfig = ExtractConfig;
- mUserAuthenticationData->ConfigAccess.RouteConfig = RouteConfig;
- mUserAuthenticationData->ConfigAccess.Callback = UserAuthenticationCallback;
- mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
-
- //
- // Install Config Access protocol to driver handle.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &mUserAuthenticationData->ConfigAccess,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- mUserAuthenticationData->DriverHandle = DriverHandle;
-
- //
- // Add HII data to database.
- //
- HiiHandle = HiiAddPackages (
- &mUserAuthenticationVendorGuid,
- DriverHandle,
- UserAuthenticationDxeStrings,
- UserAuthenticationDxeVfrBin,
- NULL
- );
- if (HiiHandle == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- mUserAuthenticationData->HiiHandle = HiiHandle;
-
- //
- // Locate report status code protocol.
- //
- Status = gBS->LocateProtocol (
- &gEfiRscHandlerProtocolGuid,
- NULL,
- (VOID **) &mRscHandlerProtocol
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- //Register the callback function for ReportStatusCode() notification.
- //
- mRscHandlerProtocol->Register (CheckForPassword, TPL_HIGH_LEVEL);
-
- //
- // Unregister boot time report status code listener at ExitBootService Event.
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- UnregisterBootTimeHandlers,
- NULL,
- &gEfiEventExitBootServicesGuid,
- &mExitBootServicesEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Locates SMM Communication protocol.
- //
- Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication);
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
-
-/**
- Unloads the application and its installed protocol.
-
- @param[in] ImageHandle Handle that identifies the image to be unloaded.
-
- @retval EFI_SUCCESS The image has been unloaded.
-**/
-EFI_STATUS
-EFIAPI
-UserAuthenticationUnload (
- IN EFI_HANDLE ImageHandle
- )
-{
- ASSERT (mUserAuthenticationData != NULL);
-
- //
- // Uninstall Config Access Protocol.
- //
- if (mUserAuthenticationData->DriverHandle != NULL) {
- gBS->UninstallMultipleProtocolInterfaces (
- mUserAuthenticationData->DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &mUserAuthenticationData->ConfigAccess,
- NULL
- );
- mUserAuthenticationData->DriverHandle = NULL;
- }
-
- //
- // Remove Hii Data.
- //
- if (mUserAuthenticationData->HiiHandle != NULL) {
- HiiRemovePackages (mUserAuthenticationData->HiiHandle);
- }
-
- FreePool (mUserAuthenticationData);
- mUserAuthenticationData = NULL;
-
- return EFI_SUCCESS;
-}
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxePassword.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxePassword.c
deleted file mode 100644
index 6e1fedfab7..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxePassword.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/** @file
- UserAuthentication DXE password wrapper.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "UserAuthenticationDxe.h"
-
-/**
- Initialize the communicate buffer using DataSize and Function.
-
- @param[out] DataPtr Points to the data in the communicate buffer.
- @param[in] DataSize The data size to send to SMM.
- @param[in] Function The function number to initialize the communicate header.
-
- @return Communicate buffer.
-**/
-VOID*
-InitCommunicateBuffer (
- OUT VOID **DataPtr OPTIONAL,
- IN UINTN DataSize,
- IN UINTN Function
- )
-{
- EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
- VOID *Buffer;
- EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable;
- EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
- UINTN Index;
- UINTN Size;
- EFI_STATUS Status;
-
- Buffer = NULL;
- Status = EfiGetSystemConfigurationTable (
- &gEdkiiPiSmmCommunicationRegionTableGuid,
- (VOID **) &SmmCommRegionTable
- );
- if (EFI_ERROR (Status)) {
- return NULL;
- }
- ASSERT (SmmCommRegionTable != NULL);
- SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
- Size = 0;
- for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) {
- if (SmmCommMemRegion->Type == EfiConventionalMemory) {
- Size = EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages);
- if (Size >= (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) {
- break;
- }
- }
- SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRegion + SmmCommRegionTable->DescriptorSize);
- }
- ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
-
- Buffer = (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart;
- ASSERT (Buffer != NULL);
- SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
- CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid);
- SmmCommunicateHeader->MessageLength = DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data;
- ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER));
- SmmPasswordFunctionHeader->Function = Function;
- if (DataPtr != NULL) {
- *DataPtr = SmmPasswordFunctionHeader + 1;
- }
-
- return Buffer;
-}
-
-/**
- Send the data in communicate buffer to SMM.
-
- @param[in] Buffer Points to the data in the communicate buffer.
- @param[in] DataSize The data size to send to SMM.
-
- @retval EFI_SUCCESS Success is returned from the function in SMM.
- @retval Others Failure is returned from the function in SMM.
-
-**/
-EFI_STATUS
-SendCommunicateBuffer (
- IN VOID *Buffer,
- IN UINTN DataSize
- )
-{
- EFI_STATUS Status;
- UINTN CommSize;
- EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
-
- CommSize = DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- Status = mSmmCommunication->Communicate (mSmmCommunication, Buffer, &CommSize);
- ASSERT_EFI_ERROR (Status);
-
- SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
- SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data;
- return SmmPasswordFunctionHeader->ReturnStatus;
-}
-
-/**
- Validate if the password is correct.
-
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval EFI_SUCCESS The password is correct.
- @retval EFI_SECURITY_VIOLATION The password is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
-**/
-EFI_STATUS
-VerifyPassword (
- IN CHAR16 *Password,
- IN UINTN PasswordSize
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD *VerifyPassword;
-
- ASSERT (Password != NULL);
-
- if (PasswordSize > sizeof(VerifyPassword->Password) * sizeof(CHAR16)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Buffer = InitCommunicateBuffer (
- (VOID**)&VerifyPassword,
- sizeof(*VerifyPassword),
- SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = UnicodeStrToAsciiStrS (Password, VerifyPassword->Password, sizeof(VerifyPassword->Password));
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
-
- Status = SendCommunicateBuffer (Buffer, sizeof(*VerifyPassword));
-
-EXIT:
- ZeroMem (VerifyPassword, sizeof(*VerifyPassword));
- return Status;
-}
-
-/**
- Set a new password.
-
- @param[in] NewPassword The user input new password.
- NULL means clear password.
- @param[in] NewPasswordSize The size of NewPassword in byte.
- @param[in] OldPassword The user input old password.
- NULL means no old password.
- @param[in] OldPasswordSize The size of OldPassword in byte.
-
- @retval EFI_SUCCESS The NewPassword is set successfully.
- @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
- @retval EFI_UNSUPPORTED NewPassword is not strong enough.
- @retval EFI_ALREADY_STARTED NewPassword is in history.
-**/
-EFI_STATUS
-SetPassword (
- IN CHAR16 *NewPassword, OPTIONAL
- IN UINTN NewPasswordSize,
- IN CHAR16 *OldPassword, OPTIONAL
- IN UINTN OldPasswordSize
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_SET_PASSWORD *SetPassword;
-
- if (NewPasswordSize > sizeof(SetPassword->NewPassword) * sizeof(CHAR16)) {
- return EFI_INVALID_PARAMETER;
- }
- if (OldPasswordSize > sizeof(SetPassword->OldPassword) * sizeof(CHAR16)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Buffer = InitCommunicateBuffer (
- (VOID**)&SetPassword,
- sizeof(*SetPassword),
- SMM_PASSWORD_FUNCTION_SET_PASSWORD
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (NewPassword != NULL) {
- Status = UnicodeStrToAsciiStrS (NewPassword, SetPassword->NewPassword, sizeof(SetPassword->NewPassword));
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- } else {
- SetPassword->NewPassword[0] = 0;
- }
-
- if (OldPassword != NULL) {
- Status = UnicodeStrToAsciiStrS (OldPassword, SetPassword->OldPassword, sizeof(SetPassword->OldPassword));
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- } else {
- SetPassword->OldPassword[0] = 0;
- }
-
- Status = SendCommunicateBuffer (Buffer, sizeof(*SetPassword));
-
-EXIT:
- ZeroMem (SetPassword, sizeof(*SetPassword));
- return Status;
-}
-
-/**
- Return if the password is set.
-
- @retval TRUE The password is set.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-IsPasswordInstalled (
- VOID
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
-
- Buffer = InitCommunicateBuffer (
- NULL,
- 0,
- SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET
- );
- if (Buffer == NULL) {
- return FALSE;
- }
-
- Status = SendCommunicateBuffer (Buffer, 0);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- Get password verification policy.
-
- @param[out] VerifyPolicy Verification policy.
-
- @retval EFI_SUCCESS Get verification policy successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verification policy.
-**/
-EFI_STATUS
-GetPasswordVerificationPolicy (
- OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *GetVerifyPolicy;
-
- Buffer = InitCommunicateBuffer (
- (VOID**)&GetVerifyPolicy,
- sizeof(*GetVerifyPolicy),
- SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = SendCommunicateBuffer (Buffer, sizeof(*GetVerifyPolicy));
- if (!EFI_ERROR (Status)) {
- CopyMem (VerifyPolicy, GetVerifyPolicy, sizeof (SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY));
- }
-
- return Status;
-}
-
-/**
- Return if the password was verified.
-
- @retval TRUE The password was verified.
- @retval FALSE The password was not verified.
-**/
-BOOLEAN
-WasPasswordVerified (
- VOID
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
-
- Buffer = InitCommunicateBuffer (
- NULL,
- 0,
- SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED
- );
- if (Buffer == NULL) {
- return FALSE;
- }
-
- Status = SendCommunicateBuffer (Buffer, 0);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.c
deleted file mode 100644
index 07e834ebfa..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.c
+++ /dev/null
@@ -1,674 +0,0 @@
-/** @file
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "UserAuthenticationSmm.h"
-
-EFI_SMM_VARIABLE_PROTOCOL *mSmmVariable;
-
-UINTN mAdminPasswordTryCount = 0;
-
-BOOLEAN mNeedReVerify = TRUE;
-BOOLEAN mPasswordVerified = FALSE;
-
-/**
- Verify if the password is correct.
-
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
- @param[in] UserPasswordVarStruct The storage of password in variable.
-
- @retval EFI_SUCCESS The password is correct.
- @retval EFI_SECURITY_VIOLATION The password is incorrect.
-**/
-EFI_STATUS
-VerifyPassword (
- IN CHAR8 *Password,
- IN UINTN PasswordSize,
- IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
- )
-{
- BOOLEAN HashOk;
- UINT8 HashData[PASSWORD_HASH_SIZE];
-
- HashOk = KeyLibGeneratePBKDF2Hash (
- HASH_TYPE_SHA256,
- (UINT8 *)Password,
- PasswordSize,
- UserPasswordVarStruct->PasswordSalt,
- sizeof(UserPasswordVarStruct->PasswordSalt),
- HashData,
- sizeof(HashData)
- );
- if (!HashOk) {
- return EFI_DEVICE_ERROR;
- }
- if (KeyLibSlowCompareMem (UserPasswordVarStruct->PasswordHash, HashData, PASSWORD_HASH_SIZE) == 0) {
- return EFI_SUCCESS;
- } else {
- return EFI_SECURITY_VIOLATION;
- }
-}
-
-/**
- Get hash data of password from non-volatile variable region.
-
- @param[in] UserGuid The user GUID of the password variable.
- @param[in] Index The index of the password.
- 0 means current password.
- Non-0 means the password history.
- @param[out] UserPasswordVarStruct The storage of password in variable.
-
- @retval EFI_SUCCESS The password hash is returned successfully.
- @retval EFI_NOT_FOUND The password hash is not found.
-**/
-EFI_STATUS
-GetPasswordHashFromVariable (
- IN EFI_GUID *UserGuid,
- IN UINTN Index,
- OUT USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
- )
-{
- UINTN DataSize;
- CHAR16 PasswordName[sizeof(USER_AUTHENTICATION_VAR_NAME)/sizeof(CHAR16) + 5];
-
- if (Index != 0) {
- UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s%04x", USER_AUTHENTICATION_VAR_NAME, Index);
- } else {
- UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s", USER_AUTHENTICATION_VAR_NAME);
- }
-
- DataSize = sizeof(*UserPasswordVarStruct);
- return mSmmVariable->SmmGetVariable (
- PasswordName,
- UserGuid,
- NULL,
- &DataSize,
- UserPasswordVarStruct
- );
-}
-
-/**
- Save password hash data to non-volatile variable region.
-
- @param[in] UserGuid The user GUID of the password variable.
- @param[in] UserPasswordVarStruct The storage of password in variable.
-
- @retval EFI_SUCCESS The password hash is saved successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the password hash.
-**/
-EFI_STATUS
-SavePasswordHashToVariable (
- IN EFI_GUID *UserGuid,
- IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
- )
-{
- EFI_STATUS Status;
-
- if (UserPasswordVarStruct == NULL) {
- Status = mSmmVariable->SmmSetVariable (
- USER_AUTHENTICATION_VAR_NAME,
- UserGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- 0,
- NULL
- );
- } else {
- Status = mSmmVariable->SmmSetVariable (
- USER_AUTHENTICATION_VAR_NAME,
- UserGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof(*UserPasswordVarStruct),
- UserPasswordVarStruct
- );
- }
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "SavePasswordHashToVariable fails with %r\n", Status));
- }
-
- return Status;
-}
-
-/**
- Save old password hash data to non-volatile variable region as history.
-
- The number of password history variable is limited.
- If all the password history variables are used, the new password history
- will override the oldest one.
-
- @param[in] UserGuid The user GUID of the password variable.
- @param[in] UserPasswordVarStruct The storage of password in variable.
-
- @retval EFI_SUCCESS The password hash is saved successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the password hash.
-**/
-EFI_STATUS
-SaveOldPasswordToHistory (
- IN EFI_GUID *UserGuid,
- IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
- )
-{
- EFI_STATUS Status;
- UINTN DataSize;
- UINT32 LastIndex;
- CHAR16 PasswordName[sizeof(USER_AUTHENTICATION_VAR_NAME)/sizeof(CHAR16) + 5];
-
- DEBUG ((DEBUG_INFO, "SaveOldPasswordToHistory\n"));
-
- DataSize = sizeof(LastIndex);
- Status = mSmmVariable->SmmGetVariable (
- USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME,
- UserGuid,
- NULL,
- &DataSize,
- &LastIndex
- );
- if (EFI_ERROR(Status)) {
- LastIndex = 0;
- }
- if (LastIndex >= PASSWORD_HISTORY_CHECK_COUNT) {
- LastIndex = 0;
- }
-
- LastIndex ++;
- UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s%04x", USER_AUTHENTICATION_VAR_NAME, LastIndex);
-
-
- Status = mSmmVariable->SmmSetVariable (
- PasswordName,
- UserGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof(*UserPasswordVarStruct),
- UserPasswordVarStruct
- );
- DEBUG ((DEBUG_INFO, " -- to %s, %r\n", PasswordName, Status));
- if (!EFI_ERROR(Status)) {
- Status = mSmmVariable->SmmSetVariable (
- USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME,
- UserGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof(LastIndex),
- &LastIndex
- );
- DEBUG ((DEBUG_INFO, " LastIndex - 0x%04x, %r\n", LastIndex, Status));
- }
-
- return Status;
-}
-
-/**
- Calculate password hash data and save it to non-volatile variable region.
-
- @param[in] UserGuid The user GUID of the password variable.
- @param[in] Password The user input password.
- NULL means delete the password variable.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval EFI_SUCCESS The password hash is calculated and saved.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the password hash.
-**/
-EFI_STATUS
-SavePasswordToVariable (
- IN EFI_GUID *UserGuid,
- IN CHAR8 *Password, OPTIONAL
- IN UINTN PasswordSize
- )
-{
- EFI_STATUS Status;
- USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
- BOOLEAN HashOk;
-
- //
- // If password is NULL, it means we want to clean password field saved in variable region.
- //
- if (Password != NULL) {
- KeyLibGenerateSalt (UserPasswordVarStruct.PasswordSalt, sizeof(UserPasswordVarStruct.PasswordSalt));
- HashOk = KeyLibGeneratePBKDF2Hash (
- HASH_TYPE_SHA256,
- (UINT8 *)Password,
- PasswordSize,
- UserPasswordVarStruct.PasswordSalt,
- sizeof(UserPasswordVarStruct.PasswordSalt),
- UserPasswordVarStruct.PasswordHash,
- sizeof(UserPasswordVarStruct.PasswordHash)
- );
- if (!HashOk) {
- return EFI_DEVICE_ERROR;
- }
- Status = SavePasswordHashToVariable (UserGuid, &UserPasswordVarStruct);
- //
- // Save Password data to history variable
- //
- if (!EFI_ERROR(Status)) {
- SaveOldPasswordToHistory (UserGuid, &UserPasswordVarStruct);
- }
- } else {
- Status = SavePasswordHashToVariable (UserGuid, NULL);
- }
-
- return Status;
-}
-
-/**
- Verify the password.
- If the password variable does not exist, it passes the verification.
- If the password variable exists, it does verification based upon password variable.
-
- @param[in] UserGuid The user GUID of the password variable.
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval TRUE The verification passes.
- @retval FALSE The verification fails.
-**/
-BOOLEAN
-IsPasswordVerified (
- IN EFI_GUID *UserGuid,
- IN CHAR8 *Password,
- IN UINTN PasswordSize
- )
-{
- USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
- EFI_STATUS Status;
- UINTN *PasswordTryCount;
-
- PasswordTryCount = &mAdminPasswordTryCount;
-
- Status = GetPasswordHashFromVariable (UserGuid, 0, &UserPasswordVarStruct);
- if (EFI_ERROR(Status)) {
- return TRUE;
- }
-
- //
- // Old password exists
- //
- Status = VerifyPassword (Password, PasswordSize, &UserPasswordVarStruct);
- if (EFI_ERROR(Status)) {
- if (Password[0] != 0) {
- *PasswordTryCount = *PasswordTryCount + 1;
- }
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- Return if the password is set.
-
- @param[in] UserGuid The user GUID of the password variable.
-
- @retval TRUE The password is set.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-IsPasswordSet (
- IN EFI_GUID *UserGuid
- )
-{
- USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
- EFI_STATUS Status;
-
- Status = GetPasswordHashFromVariable(UserGuid, 0, &UserPasswordVarStruct);
- if (EFI_ERROR(Status)) {
- return FALSE;
- }
- return TRUE;
-}
-
-/**
- Return if the password is strong.
- Criteria:
- 1) length >= PASSWORD_MIN_SIZE
- 2) include lower case, upper case, number, symbol.
-
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval TRUE The password is strong.
- @retval FALSE The password is weak.
-**/
-BOOLEAN
-IsPasswordStrong (
- IN CHAR8 *Password,
- IN UINTN PasswordSize
- )
-{
- UINTN Index;
- BOOLEAN HasLowerCase;
- BOOLEAN HasUpperCase;
- BOOLEAN HasNumber;
- BOOLEAN HasSymbol;
-
- if (PasswordSize < PASSWORD_MIN_SIZE) {
- return FALSE;
- }
-
- HasLowerCase = FALSE;
- HasUpperCase = FALSE;
- HasNumber = FALSE;
- HasSymbol = FALSE;
- for (Index = 0; Index < PasswordSize - 1; Index++) {
- if (Password[Index] >= 'a' && Password[Index] <= 'z') {
- HasLowerCase = TRUE;
- } else if (Password[Index] >= 'A' && Password[Index] <= 'Z') {
- HasUpperCase = TRUE;
- } else if (Password[Index] >= '0' && Password[Index] <= '9') {
- HasNumber = TRUE;
- } else {
- HasSymbol = TRUE;
- }
- }
- if ((!HasLowerCase) || (!HasUpperCase) || (!HasNumber) || (!HasSymbol)) {
- return FALSE;
- }
- return TRUE;
-}
-
-/**
- Return if the password is set before in PASSWORD_HISTORY_CHECK_COUNT.
-
- @param[in] UserGuid The user GUID of the password variable.
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval TRUE The password is set before.
- @retval FALSE The password is not set before.
-**/
-BOOLEAN
-IsPasswordInHistory (
- IN EFI_GUID *UserGuid,
- IN CHAR8 *Password,
- IN UINTN PasswordSize
- )
-{
- EFI_STATUS Status;
- USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
- UINTN Index;
-
- for (Index = 1; Index <= PASSWORD_HISTORY_CHECK_COUNT; Index++) {
- Status = GetPasswordHashFromVariable (UserGuid, Index, &UserPasswordVarStruct);
- if (!EFI_ERROR(Status)) {
- Status = VerifyPassword (Password, PasswordSize, &UserPasswordVarStruct);
- if (!EFI_ERROR(Status)) {
- return TRUE;
- }
- }
- }
-
- return FALSE;
-}
-
-/**
- Communication service SMI Handler entry.
-
- This SMI handler provides services for password management.
-
- @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
-SmmPasswordHandler (
- IN EFI_HANDLE DispatchHandle,
- IN CONST VOID *RegisterContext,
- IN OUT VOID *CommBuffer,
- IN OUT UINTN *CommBufferSize
- )
-{
- EFI_STATUS Status;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmFunctionHeader;
- UINTN CommBufferPayloadSize;
- UINTN TempCommBufferSize;
- SMM_PASSWORD_COMMUNICATE_SET_PASSWORD SmmCommunicateSetPassword;
- SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD SmmCommunicateVerifyPassword;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY SmmCommunicateSetVerifyPolicy;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *SmmCommunicateGetVerifyPolicy;
- UINTN PasswordLen;
- EFI_GUID *UserGuid;
- UINTN *PasswordTryCount;
-
- //
- // If input is invalid, stop processing this SMI
- //
- if (CommBuffer == NULL || CommBufferSize == NULL) {
- return EFI_SUCCESS;
- }
-
- TempCommBufferSize = *CommBufferSize;
- PasswordLen = 0;
-
- if (TempCommBufferSize < sizeof (SMM_PASSWORD_COMMUNICATE_HEADER)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SMM communication buffer size invalid!\n"));
- return EFI_SUCCESS;
- }
-
- CommBufferPayloadSize = TempCommBufferSize - sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- Status = EFI_SUCCESS;
- SmmFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)CommBuffer;
-
- UserGuid = &gUserAuthenticationGuid;
- PasswordTryCount = &mAdminPasswordTryCount;
-
- switch (SmmFunctionHeader->Function) {
- case SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET:
- PasswordTryCount = NULL;
- if (CommBufferPayloadSize != 0) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: IS_PASSWORD_SET payload buffer invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- if (IsPasswordSet(UserGuid)) {
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_NOT_FOUND;
- }
- break;
- case SMM_PASSWORD_FUNCTION_SET_PASSWORD:
- if (*PasswordTryCount >= PASSWORD_MAX_TRY_COUNT) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_PASSWORD try count reach!\n"));
- PasswordTryCount = NULL;
- Status = EFI_ACCESS_DENIED;
- goto EXIT;
- }
- if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_SET_PASSWORD)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_PASSWORD payload buffer invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- CopyMem (&SmmCommunicateSetPassword, SmmFunctionHeader + 1, sizeof(SmmCommunicateSetPassword));
-
- PasswordLen = AsciiStrnLenS(SmmCommunicateSetPassword.OldPassword, sizeof(SmmCommunicateSetPassword.OldPassword));
- if (PasswordLen == sizeof(SmmCommunicateSetPassword.OldPassword)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: OldPassword invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
-
- if (!IsPasswordVerified (UserGuid, SmmCommunicateSetPassword.OldPassword, PasswordLen + 1)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: PasswordVerify - FAIL\n"));
- Status = EFI_SECURITY_VIOLATION;
- goto EXIT;
- }
-
- PasswordLen = AsciiStrnLenS(SmmCommunicateSetPassword.NewPassword, sizeof(SmmCommunicateSetPassword.NewPassword));
- if (PasswordLen == sizeof(SmmCommunicateSetPassword.NewPassword)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- if (PasswordLen != 0 && !IsPasswordStrong (SmmCommunicateSetPassword.NewPassword, PasswordLen + 1)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword too weak!\n"));
- Status = EFI_UNSUPPORTED;
- goto EXIT;
- }
- if (PasswordLen != 0 && IsPasswordInHistory (UserGuid, SmmCommunicateSetPassword.NewPassword, PasswordLen + 1)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword in history!\n"));
- Status = EFI_ALREADY_STARTED;
- goto EXIT;
- }
-
- if (PasswordLen == 0) {
- Status = SavePasswordToVariable (UserGuid, NULL, 0);
- } else {
- Status = SavePasswordToVariable (UserGuid, SmmCommunicateSetPassword.NewPassword, PasswordLen + 1);
- }
- break;
-
- case SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD:
- if (*PasswordTryCount >= PASSWORD_MAX_TRY_COUNT) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: VERIFY_PASSWORD try count reach!\n"));
- PasswordTryCount = NULL;
- Status = EFI_ACCESS_DENIED;
- goto EXIT;
- }
- if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: VERIFY_PASSWORD payload buffer invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- CopyMem (&SmmCommunicateVerifyPassword, SmmFunctionHeader + 1, sizeof(SmmCommunicateVerifyPassword));
-
- PasswordLen = AsciiStrnLenS(SmmCommunicateVerifyPassword.Password, sizeof(SmmCommunicateVerifyPassword.Password));
- if (PasswordLen == sizeof(SmmCommunicateVerifyPassword.Password)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: Password invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- if (!IsPasswordVerified (UserGuid, SmmCommunicateVerifyPassword.Password, PasswordLen + 1)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: PasswordVerify - FAIL\n"));
- Status = EFI_SECURITY_VIOLATION;
- goto EXIT;
- }
- mPasswordVerified = TRUE;
- Status = EFI_SUCCESS;
- break;
-
- case SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY:
- PasswordTryCount = NULL;
- if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_VERIFY_POLICY payload buffer invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- CopyMem (&SmmCommunicateSetVerifyPolicy, SmmFunctionHeader + 1, sizeof(SmmCommunicateSetVerifyPolicy));
- mNeedReVerify = SmmCommunicateSetVerifyPolicy.NeedReVerify;
- break;
-
- case SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY:
- PasswordTryCount = NULL;
- if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: GET_VERIFY_POLICY payload buffer invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- SmmCommunicateGetVerifyPolicy = (SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *) (SmmFunctionHeader + 1);
- SmmCommunicateGetVerifyPolicy->NeedReVerify = mNeedReVerify;
- break;
- case SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED:
- PasswordTryCount = NULL;
- if (CommBufferPayloadSize != 0) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: WAS_PASSWORD_VERIFIED payload buffer invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- if (mPasswordVerified) {
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_NOT_STARTED;
- }
- break;
-
- default:
- PasswordTryCount = NULL;
- Status = EFI_UNSUPPORTED;
- break;
- }
-
-EXIT:
- if (PasswordTryCount != NULL) {
- if (Status == EFI_SUCCESS) {
- *PasswordTryCount = 0;
- }
- }
- SmmFunctionHeader->ReturnStatus = Status;
-
- return EFI_SUCCESS;
-}
-
-/**
- Main entry for this driver.
-
- @param ImageHandle Image handle this driver.
- @param SystemTable Pointer to SystemTable.
-
- @retval EFI_SUCESS This function always complete successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-PasswordSmmInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE SmmHandle;
- EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;
- CHAR16 PasswordHistoryName[sizeof(USER_AUTHENTICATION_VAR_NAME)/sizeof(CHAR16) + 5];
- UINTN Index;
-
- ASSERT (PASSWORD_HASH_SIZE == SHA256_DIGEST_SIZE);
- ASSERT (PASSWORD_HISTORY_CHECK_COUNT < 0xFFFF);
-
- Status = gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID**)&mSmmVariable);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Make password variables read-only for DXE driver for security concern.
- //
- Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);
- if (!EFI_ERROR (Status)) {
- Status = VariableLock->RequestToLock (VariableLock, USER_AUTHENTICATION_VAR_NAME, &gUserAuthenticationGuid);
- ASSERT_EFI_ERROR (Status);
-
- for (Index = 1; Index <= PASSWORD_HISTORY_CHECK_COUNT; Index++) {
- UnicodeSPrint (PasswordHistoryName, sizeof (PasswordHistoryName), L"%s%04x", USER_AUTHENTICATION_VAR_NAME, Index);
- Status = VariableLock->RequestToLock (VariableLock, PasswordHistoryName, &gUserAuthenticationGuid);
- ASSERT_EFI_ERROR (Status);
- }
- Status = VariableLock->RequestToLock (VariableLock, USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME, &gUserAuthenticationGuid);
- ASSERT_EFI_ERROR (Status);
- }
-
- SmmHandle = NULL;
- Status = gSmst->SmiHandlerRegister (SmmPasswordHandler, &gUserAuthenticationGuid, &SmmHandle);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (IsPasswordCleared()) {
- DEBUG ((DEBUG_INFO, "IsPasswordCleared\n"));
- SavePasswordToVariable (&gUserAuthenticationGuid, NULL, 0);
- }
-
- return EFI_SUCCESS;
-}
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni b/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni
deleted file mode 100644
index b0255889e0..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni
+++ /dev/null
@@ -1,19 +0,0 @@
-// /** @file
-// NULL platform password library instance that returns the password clear state based upon PCD.
-//
-// NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared
-// but returns the PCD value directly. This instance can be used to verify security
-// related features during platform enabling and development. It should be replaced
-// by a platform-specific method(e.g. Button pressed) in a real platform for product.
-//
-// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "NULL platform password library instance that returns the password clear state based upon PCD."
-
-#string STR_MODULE_DESCRIPTION #language en-US "NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared but returns the PCD value directly. This instance can be used to verify security related features during platform enabling and development. It should be replaced by a platform-specific method(e.g. Button pressed) in a real platform for product."
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeStrings.uni b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeStrings.uni
deleted file mode 100644
index 1e3a179677..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeStrings.uni
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
-// String definitions for User Authentication formset.
-//
-// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-**/
-
-#langdef en-US "English"
-#langdef fr-FR "Francais"
-
-
-#string STR_FORM_SET_TITLE #language en-US "User Password Management"
- #language fr-FR "User Password Management"
-#string STR_FORM_SET_TITLE_HELP #language en-US "This Driver mainly handle user's password"
- #language fr-FR "This Driver mainly handle user's password"
-#string STR_FORM_TITLE #language en-US "Password Management Form"
- #language fr-FR "Password Management Form"
-#string STR_ADMIN_PASSWORD_PROMPT #language en-US "Change Admin Password"
- #language fr-FR "Change Admin Password"
-#string STR_ADMIN_PASSWORD_HELP #language en-US "Input old admin password if it was set, then you can change the password to a new one. After the change action, you may need input the new password when you enter UI. The new password must be between 8 and 32 chars include lowercase, uppercase alphabetic, number, and symbol. Input an empty password can clean old admin password, then no need input password to enter UI."
- #language fr-FR "Input old admin password if it was set, then you can change the password to a new one. After the change action, you may need input the new password when you enter UI. The new password must be between 8 and 32 chars include lowercase, uppercase alphabetic, number, and symbol. Input an empty password can clean old admin password, then no need input password to enter UI."
-#string STR_ADMIN_PASSWORD_STS_HELP #language en-US "Current Admin Password status: Installed or Not Installed."
- #language fr-FR "Current Admin Password status: Installed or Not Installed."
-#string STR_ADMIN_PASSWORD_STS_PROMPT #language en-US "Admin Password Status"
- #language fr-FR "Admin Password Status"
-#string STR_ADMIN_PASSWORD_STS_CONTENT #language en-US ""
- #language fr-FR ""
-
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 27/49] Features/Intel/UserAuthFeaturePkg: Add initial package
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (24 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 26/49] UserInterfaceFeaturePkg: Remove the User Authentication feature Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 28/49] Features/Intel/NetworkFeaturePkg: " Kubacki, Michael A
` (21 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Dandan Bi, Liming Gao
Adds a new feature package for the User Authentication feature.
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec | 49 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc | 141 ++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dsc | 30 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf | 12 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf | 38 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf | 37 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf | 41 +
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.inf | 52 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.inf | 62 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.inf | 53 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Guid/UserAuthentication.h | 45 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/PlatformPasswordLib.h | 48 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordLib.h | 70 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordUiLib.h | 37 +
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.h | 88 +++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.h | 55 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.h | 138 ++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeFormset.h | 23 +
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.h | 52 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeVfr.vfr | 39 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c | 78 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c | 274 +++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c | 522 +++++++++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.c | 133 ++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.c | 484 ++++++++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.c | 780 ++++++++++++++++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxePassword.c | 319 ++++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.c | 674 +++++++++++++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni | 19 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md | 86 +++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeStrings.uni | 30 +
32 files changed, 4517 insertions(+)
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
new file mode 100644
index 0000000000..a9174edd54
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
@@ -0,0 +1,49 @@
+## @file
+# This package provides advanced feature functionality for User Authentication support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = UserAuthFeaturePkg
+ PACKAGE_GUID = 08737161-3956-422A-9ABD-FCE3C8DBA3D4
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[LibraryClasses]
+ ## @libraryclass Provides a platform-specific method to return the password policy.
+ PlatformPasswordLib|Include/Library/PlatformPasswordLib.h
+
+ ## @libraryclass Provides services to set/verify the password and return if the password is set.
+ UserPasswordLib|Include/Library/UserPasswordLib.h
+
+ ## @libraryclass Provides services to perform password authentication.
+ UserPasswordUiLib|Include/Library/UserPasswordUiLib.h
+
+[Guids]
+ gUserAuthFeaturePkgTokenSpaceGuid = {0xa2793a6e, 0x6af1, 0x45c4, {0x88, 0x4d, 0x3d, 0x0c, 0x7a, 0xfe, 0x91, 0xc6}}
+
+ ## Include Include/Guid/UserAuthentication.h
+ gUserAuthenticationGuid = { 0xee24a7f7, 0x606b, 0x4724, { 0xb3, 0xc9, 0xf5, 0xae, 0x4a, 0x3b, 0x81, 0x65}}
+
+[PcdsFeatureFlag]
+ ## This PCD specifies whether StatusCode is reported via USB3 Serial port.
+ gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable|FALSE|BOOLEAN|0xA0000001
+
+[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx]
+ ## Indicate whether the password is cleared.
+ # When it is configured to Dynamic or DynamicEx, it can be set through detection using
+ # a platform-specific method (e.g. Board Jumper set) in a actual platform in early boot phase.<BR><BR>
+ # @Prompt The password clear status
+ gUserAuthFeaturePkgTokenSpaceGuid.PcdPasswordCleared|FALSE|BOOLEAN|0xF0000001
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc
new file mode 100644
index 0000000000..e8d9a639bc
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc
@@ -0,0 +1,141 @@
+## @file
+# This is a build description file for the User Authentication advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+################################################################################
+[LibraryClasses]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+ IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+ OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+
+ #####################################
+ # User Authentication Feature Package
+ #####################################
+ PlatformPasswordLib|UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
+ UserPasswordLib|UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
+
+[LibraryClasses.common.DXE_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+
+[LibraryClasses.common.DXE_SMM_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
+ MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
+ SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
+
+###################################################################################################
+#
+# Components Section - list of the modules and components that will be processed by compilation
+# tools and the EDK II tools to generate PE32/PE32+/Coff image files.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# Binary modules do not need to be listed in this section, as they should be
+# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi),
+# Logo (Logo.bmp), and etc.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+###################################################################################################
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # User Authentication Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
+ #####################################
+ # User Authentication Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+ UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
+
+ # Add components here that should be included in the package build.
+ UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.inf
+ UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.inf
+ UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.inf
+
+###################################################################################################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
+###################################################################################################
+[BuildOptions]
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dsc b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dsc
new file mode 100644
index 0000000000..74eb9213ce
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dsc
@@ -0,0 +1,30 @@
+## @file
+# This is a build description file for the User Authentication advanced feature.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ PLATFORM_NAME = UserAuthFeaturePkg
+ PLATFORM_GUID = E859E721-41C7-46A9-98DE-8C2F29097880
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#
+# This package always builds the feature.
+#
+!include Include/UserAuthFeature.dsc
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..f0b33aa44c
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,12 @@
+## @file
+# FDF file for post-memory modules that enable User Authentication.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+ INF UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.inf
+ INF UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.inf
+ INF UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.inf
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..512d1a2673
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory modules that enable User Authentication.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
new file mode 100644
index 0000000000..00be14df8a
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
@@ -0,0 +1,38 @@
+## @file
+# NULL platform password library instance that returns the password clear state based upon PCD.
+#
+# NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared
+# but returns the PCD value directly. This instance can be used to verify security
+# related features during platform enabling and development. It should be replaced
+# by a platform-specific method(e.g. Button pressed) in a real platform for product.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010006
+ BASE_NAME = PlatformPasswordLibNull
+ MODULE_UNI_FILE = PlatformPasswordLibNull.uni
+ FILE_GUID = 27417BCA-0CCD-4089-9711-AD069A33C555
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = PlatformPasswordLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_DRIVER
+ CONSTRUCTOR = PlatformPasswordLibNullConstructor
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC
+#
+
+[Sources]
+ PlatformPasswordLibNull.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[Pcd]
+ gUserAuthFeaturePkgTokenSpaceGuid.PcdPasswordCleared ## CONSUMES
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
new file mode 100644
index 0000000000..99d84ae637
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
@@ -0,0 +1,37 @@
+## @file
+# UserPasswordLib instance provides services to set/verify password
+# and return if the password is set.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UserPasswordLib
+ FILE_GUID = 422BA58A-F162-4ECC-BD9A-AD84FE940F37
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = UserPasswordLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_DRIVER UEFI_APPLICATION
+
+[Sources]
+ UserPasswordLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ DebugLib
+ UefiLib
+ BaseMemoryLib
+
+[Guids]
+ gUserAuthenticationGuid ## CONSUMES ## GUID
+ gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable
+
+[Protocols]
+ gEfiSmmCommunicationProtocolGuid ## CONSUMES
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
new file mode 100644
index 0000000000..9ab7d83319
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
@@ -0,0 +1,41 @@
+## @file
+# UserPasswordUiLib instance provides services to do password authentication.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UserPasswordUiLib
+ FILE_GUID = E2E92636-F511-46BC-A08B-02F815AFA884
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = UserPasswordUiLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_DRIVER UEFI_APPLICATION
+
+[Sources]
+ UserPasswordUiLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ UefiRuntimeServicesTableLib
+ DebugLib
+ UefiLib
+ MemoryAllocationLib
+ BaseMemoryLib
+ PrintLib
+ PlatformPasswordLib
+ UserPasswordLib
+
+[Guids]
+ gUserAuthenticationGuid ## CONSUMES ## GUID
+ gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable
+
+[Protocols]
+ gEfiSmmCommunicationProtocolGuid ## CONSUMES
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.inf b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.inf
new file mode 100644
index 0000000000..2c6c3661fb
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.inf
@@ -0,0 +1,52 @@
+## @file
+# User Authentication 2 Dxe Driver.
+#
+# This Driver mainly provides Setup Form to change password.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UserAuthentication2Dxe
+ FILE_GUID = 4EF592F4-C716-40CC-8C07-1E4E3BD71F11
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 2.0
+ ENTRY_POINT = UserAuthentication2Entry
+ UNLOAD_IMAGE = UserAuthentication2Unload
+[Sources]
+ UserAuthentication2Dxe.c
+ UserAuthentication2Dxe.h
+ UserAuthenticationDxeFormset.h
+ UserAuthenticationDxeVfr.vfr
+ UserAuthenticationDxeStrings.uni
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiRuntimeServicesTableLib
+ BaseMemoryLib
+ DebugLib
+ UefiLib
+ HiiLib
+ DevicePathLib
+ MemoryAllocationLib
+ UserPasswordLib
+
+[Protocols]
+ gEfiDevicePathProtocolGuid ## PRODUCES
+ gEfiHiiConfigAccessProtocolGuid ## PRODUCES
+
+[Depex]
+ gEfiSimpleTextOutProtocolGuid AND
+ gEfiSmmCommunicationProtocolGuid AND
+ gEfiVariableArchProtocolGuid AND
+ gEfiVariableWriteArchProtocolGuid
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.inf b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.inf
new file mode 100644
index 0000000000..58066b588c
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.inf
@@ -0,0 +1,62 @@
+## @file
+# User Authentication Dxe Driver.
+#
+# This Driver mainly provides Setup Form to change password and
+# does user authentication before entering Setup.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UserAuthenticationDxe
+ FILE_GUID = 0683FB88-664C-4BA6-9ED4-1C0916EE43A4
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 2.0
+ ENTRY_POINT = UserAuthenticationEntry
+ UNLOAD_IMAGE = UserAuthenticationUnload
+
+[Sources]
+ UserAuthenticationDxe.c
+ UserAuthenticationDxe.h
+ UserAuthenticationDxePassword.c
+ UserAuthenticationDxeFormset.h
+ UserAuthenticationDxeVfr.vfr
+ UserAuthenticationDxeStrings.uni
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiRuntimeServicesTableLib
+ BaseMemoryLib
+ DebugLib
+ UefiLib
+ HiiLib
+ DevicePathLib
+ MemoryAllocationLib
+ PlatformPasswordLib
+ PrintLib
+
+[Guids]
+ gUserAuthenticationGuid ## CONSUMES ## GUID
+ gEfiEventExitBootServicesGuid ## CONSUMES ## Event
+ gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable
+
+[Protocols]
+ gEfiRscHandlerProtocolGuid ## CONSUMES
+ gEfiDevicePathProtocolGuid ## PRODUCES
+ gEfiHiiConfigAccessProtocolGuid ## PRODUCES
+ gEfiSmmCommunicationProtocolGuid ## CONSUMES
+
+[Depex]
+ gEfiSimpleTextOutProtocolGuid AND
+ gEfiSmmCommunicationProtocolGuid AND
+ gEfiVariableArchProtocolGuid AND
+ gEfiVariableWriteArchProtocolGuid
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.inf b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.inf
new file mode 100644
index 0000000000..0b33b194aa
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.inf
@@ -0,0 +1,53 @@
+## @file
+# User Authentication Smm Driver.
+#
+# This driver provides SMM services for DXE user authentication module.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UserAuthenticationSmm
+ FILE_GUID = 8fc6aaaa-4561-4815-8cf7-b87312992dce
+ MODULE_TYPE = DXE_SMM_DRIVER
+ VERSION_STRING = 1.0
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ ENTRY_POINT = PasswordSmmInit
+
+[Sources]
+ UserAuthenticationSmm.c
+ UserAuthenticationSmm.h
+ KeyService.c
+ KeyService.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ CryptoPkg/CryptoPkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ DebugLib
+ BaseLib
+ BaseMemoryLib
+ PrintLib
+ SmmServicesTableLib
+ MemoryAllocationLib
+ UefiLib
+ BaseCryptLib
+ PlatformPasswordLib
+
+[Guids]
+ gUserAuthenticationGuid ## CONSUMES ## GUID
+
+[Protocols]
+ gEdkiiVariableLockProtocolGuid ## CONSUMES
+ gEfiSmmVariableProtocolGuid ## CONSUMES
+
+[Depex]
+ gEfiSmmVariableProtocolGuid AND gEfiVariableWriteArchProtocolGuid
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Guid/UserAuthentication.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Guid/UserAuthentication.h
new file mode 100644
index 0000000000..2a41a46cdc
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Guid/UserAuthentication.h
@@ -0,0 +1,45 @@
+/** @file
+ GUID is for UserAuthentication SMM communication.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USER_AUTHENTICATION_GUID_H__
+#define __USER_AUTHENTICATION_GUID_H__
+
+#define PASSWORD_MIN_SIZE 9 // MIN number of chars of password, including NULL.
+#define PASSWORD_MAX_SIZE 33 // MAX number of chars of password, including NULL.
+
+#define USER_AUTHENTICATION_GUID \
+ { 0xf06e3ea7, 0x611c, 0x4b6b, { 0xb4, 0x10, 0xc2, 0xbf, 0x94, 0x3f, 0x38, 0xf2 } }
+
+extern EFI_GUID gUserAuthenticationGuid;
+
+typedef struct {
+ UINTN Function;
+ EFI_STATUS ReturnStatus;
+} SMM_PASSWORD_COMMUNICATE_HEADER;
+
+#define SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET 1
+#define SMM_PASSWORD_FUNCTION_SET_PASSWORD 2
+#define SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD 3
+#define SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY 4
+#define SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY 5
+#define SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED 6
+
+typedef struct {
+ CHAR8 NewPassword[PASSWORD_MAX_SIZE];
+ CHAR8 OldPassword[PASSWORD_MAX_SIZE];
+} SMM_PASSWORD_COMMUNICATE_SET_PASSWORD;
+
+typedef struct {
+ CHAR8 Password[PASSWORD_MAX_SIZE];
+} SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD;
+
+typedef struct {
+ BOOLEAN NeedReVerify;
+} SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY;
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/PlatformPasswordLib.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/PlatformPasswordLib.h
new file mode 100644
index 0000000000..ce27947f6d
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/PlatformPasswordLib.h
@@ -0,0 +1,48 @@
+/** @file
+ Provides a platform-specific method to return password policy.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PLATFORM_PASSWORD_LIB_H__
+#define __PLATFORM_PASSWORD_LIB_H__
+
+/**
+ This function is called at password driver entrypoint.
+ This function should be called only once, to clear the password.
+
+ This function provides a way to reset the password, just in case
+ the platform owner forgets the password.
+ The platform should provide a secure way to make sure
+ only the platform owner is allowed to clear password.
+
+ Once the password is cleared, the platform should provide a way
+ to set a new password.
+
+ @retval TRUE There is a platform request to clear the password.
+ @retval FALSE There is no platform request to clear the password.
+**/
+BOOLEAN
+EFIAPI
+IsPasswordCleared (
+ VOID
+ );
+
+/**
+ This function is called if the password driver finds that the password is not enrolled,
+ when the password is required to input.
+
+ This function should return the action according to platform policy.
+
+ @retval TRUE The caller should force the user to enroll the password.
+ @retval FALSE The caller may skip the password enroll.
+**/
+BOOLEAN
+EFIAPI
+NeedEnrollPassword (
+ VOID
+ );
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordLib.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordLib.h
new file mode 100644
index 0000000000..b6aad224e9
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordLib.h
@@ -0,0 +1,70 @@
+/** @file
+ Provides services to set/verify password and return if the password is set.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USER_PASSWORD_LIB_H__
+#define __USER_PASSWORD_LIB_H__
+
+/**
+ Validate if the password is correct.
+
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval EFI_SUCCESS The password is correct.
+ @retval EFI_SECURITY_VIOLATION The password is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+**/
+EFI_STATUS
+EFIAPI
+VerifyPassword (
+ IN CHAR16 *Password,
+ IN UINTN PasswordSize
+ );
+
+/**
+ Set a new password.
+
+ @param[in] NewPassword The user input new password.
+ NULL means clear password.
+ @param[in] NewPasswordSize The size of NewPassword in byte.
+ @param[in] OldPassword The user input old password.
+ NULL means no old password.
+ @param[in] OldPasswordSize The size of OldPassword in byte.
+
+ @retval EFI_SUCCESS The NewPassword is set successfully.
+ @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+ @retval EFI_UNSUPPORTED NewPassword is not strong enough.
+ @retval EFI_ALREADY_STARTED NewPassword is in history.
+**/
+EFI_STATUS
+EFIAPI
+SetPassword (
+ IN CHAR16 *NewPassword, OPTIONAL
+ IN UINTN NewPasswordSize,
+ IN CHAR16 *OldPassword, OPTIONAL
+ IN UINTN OldPasswordSize
+ );
+
+/**
+ Return if the password is set.
+
+ @retval TRUE The password is set.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+EFIAPI
+IsPasswordInstalled (
+ VOID
+ );
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordUiLib.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordUiLib.h
new file mode 100644
index 0000000000..117f480733
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordUiLib.h
@@ -0,0 +1,37 @@
+/** @file
+ Provides services to do password authentication.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USER_PASSWORD_UI_LIB_H__
+#define __USER_PASSWORD_UI_LIB_H__
+
+/**
+ Do password authentication.
+
+ @retval EFI_SUCCESS Password authentication pass.
+**/
+EFI_STATUS
+EFIAPI
+UiDoPasswordAuthentication (
+ VOID
+ );
+
+/**
+ Set password verification policy.
+
+ @param[in] NeedReVerify Need re-verify or not.
+
+ @retval EFI_SUCCESS Set verification policy successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to set verification policy.
+**/
+EFI_STATUS
+EFIAPI
+UiSetPasswordVerificationPolicy (
+ IN BOOLEAN NeedReVerify
+ );
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.h
new file mode 100644
index 0000000000..d0b20851fa
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.h
@@ -0,0 +1,88 @@
+/** @file
+ Header file for key service.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __KEY_LIB_H__
+#define __KEY_LIB_H__
+
+/**
+ Compares the contents of two buffers with slow algorithm
+
+ This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
+ If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
+ value returned is the first mismatched byte in SourceBuffer subtracted from the first
+ mismatched byte in DestinationBuffer.
+
+ If Length > 0 and DestinationBuffer is NULL, then ASSERT().
+ If Length > 0 and SourceBuffer is NULL, then ASSERT().
+ If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
+ If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
+
+ @param DestinationBuffer The pointer to the destination buffer to compare.
+ @param SourceBuffer The pointer to the source buffer to compare.
+ @param Length The number of bytes to compare.
+
+ @return 0 All Length bytes of the two buffers are identical.
+ @retval -1 The SourceBuffer is not identical to DestinationBuffer.
+
+**/
+INTN
+EFIAPI
+KeyLibSlowCompareMem (
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
+ );
+
+/**
+ Generate Salt value.
+
+ @param[in, out] SaltValue Points to the salt buffer
+ @param[in] SaltSize Size of the salt buffer
+
+ @retval TRUE Salt is generated.
+ @retval FALSE Salt is not generated.
+**/
+BOOLEAN
+EFIAPI
+KeyLibGenerateSalt(
+ IN OUT UINT8 *SaltValue,
+ IN UINTN SaltSize
+ );
+
+#define HASH_TYPE_SHA256 0x000B
+#define DEFAULT_PBKDF2_ITERATION_COUNT 1000
+
+/**
+ Hash the password with PBKDF2.
+
+ @param[in] HashType Hash type
+ @param[in] Key Points to the key buffer
+ @param[in] KeySize Key buffer size
+ @param[in] SaltValue Points to the salt buffer
+ @param[in] SaltSize Size of the salt buffer
+ @param[out] KeyHash Points to the hashed result
+ @param[in] KeyHashSize Size of the hash buffer
+
+ @retval TRUE Hash the data successfully.
+ @retval FALSE Failed to hash the data.
+
+**/
+BOOLEAN
+EFIAPI
+KeyLibGeneratePBKDF2Hash (
+ IN UINT32 HashType,
+ IN VOID *Key,
+ IN UINTN KeySize,
+ IN UINT8 *SaltValue,
+ IN UINTN SaltSize,
+ OUT UINT8 *KeyHash,
+ IN UINTN KeyHashSize
+ );
+
+#endif
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.h
new file mode 100644
index 0000000000..3b7fba026d
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.h
@@ -0,0 +1,55 @@
+/** @file
+ Header file for UserAuthentication2Dxe.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _USER_AUTHENTICATION_DXE_H_
+#define _USER_AUTHENTICATION_DXE_H_
+
+
+#include <Protocol/ReportStatusCodeHandler.h>
+#include <Protocol/HiiConfigAccess.h>
+
+#include <Guid/MdeModuleHii.h>
+#include <Guid/HiiPlatformSetupFormset.h>
+#include <Guid/UserAuthentication.h>
+
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/BaseLib.h>
+#include <Library/UefiLib.h>
+#include <Library/HiiLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UserPasswordLib.h>
+
+#include "UserAuthenticationDxeFormset.h"
+
+extern UINT8 UserAuthenticationDxeVfrBin[];
+extern UINT8 UserAuthentication2DxeStrings[];
+
+typedef struct {
+ EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
+ EFI_HANDLE DriverHandle;
+ EFI_HII_HANDLE HiiHandle;
+ UINT8 PasswordState;
+ CHAR16 OldPassword[PASSWORD_MAX_SIZE];
+} USER_AUTHENTICATION_PRIVATE_DATA;
+
+#pragma pack(1)
+///
+/// HII specific Vendor Device Path definition.
+///
+typedef struct {
+ VENDOR_DEVICE_PATH VendorDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL End;
+} HII_VENDOR_DEVICE_PATH;
+#pragma pack()
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.h
new file mode 100644
index 0000000000..e183424f35
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.h
@@ -0,0 +1,138 @@
+/** @file
+ Header file for UserAuthenticationDxe.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _USER_AUTHENTICATION_DXE_H_
+#define _USER_AUTHENTICATION_DXE_H_
+
+
+#include <Protocol/ReportStatusCodeHandler.h>
+#include <Protocol/HiiConfigAccess.h>
+#include <Protocol/SmmCommunication.h>
+
+#include <Guid/MdeModuleHii.h>
+#include <Guid/HiiPlatformSetupFormset.h>
+#include <Guid/PiSmmCommunicationRegionTable.h>
+#include <Guid/UserAuthentication.h>
+
+#include <Library/PrintLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/BaseLib.h>
+#include <Library/UefiLib.h>
+#include <Library/HiiLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PlatformPasswordLib.h>
+
+#include "UserAuthenticationDxeFormset.h"
+
+extern UINT8 UserAuthenticationDxeVfrBin[];
+extern UINT8 UserAuthenticationDxeStrings[];
+extern EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication;
+
+typedef struct {
+ EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
+ EFI_HANDLE DriverHandle;
+ EFI_HII_HANDLE HiiHandle;
+ UINT8 PasswordState;
+ CHAR16 OldPassword[PASSWORD_MAX_SIZE];
+} USER_AUTHENTICATION_PRIVATE_DATA;
+
+#pragma pack(1)
+///
+/// HII specific Vendor Device Path definition.
+///
+typedef struct {
+ VENDOR_DEVICE_PATH VendorDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL End;
+} HII_VENDOR_DEVICE_PATH;
+#pragma pack()
+
+/**
+ Validate if the password is correct.
+
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval EFI_SUCCESS The password is correct.
+ @retval EFI_SECURITY_VIOLATION The password is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+**/
+EFI_STATUS
+VerifyPassword (
+ IN CHAR16 *Password,
+ IN UINTN PasswordSize
+ );
+
+/**
+ Set a new password.
+
+ @param[in] NewPassword The user input new password.
+ NULL means clear password.
+ @param[in] NewPasswordSize The size of NewPassword in byte.
+ @param[in] OldPassword The user input old password.
+ NULL means no old password.
+ @param[in] OldPasswordSize The size of OldPassword in byte.
+
+ @retval EFI_SUCCESS The NewPassword is set successfully.
+ @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+ @retval EFI_UNSUPPORTED NewPassword is not strong enough.
+ @retval EFI_ALREADY_STARTED NewPassword is in history.
+**/
+EFI_STATUS
+SetPassword (
+ IN CHAR16 *NewPassword, OPTIONAL
+ IN UINTN NewPasswordSize,
+ IN CHAR16 *OldPassword, OPTIONAL
+ IN UINTN OldPasswordSize
+ );
+
+/**
+ Return if the password is set.
+
+ @retval TRUE The password is set.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+IsPasswordInstalled (
+ VOID
+ );
+
+/**
+ Get password verification policy.
+
+ @param[out] VerifyPolicy Verification policy.
+
+ @retval EFI_SUCCESS Get verification policy successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verification policy.
+**/
+EFI_STATUS
+GetPasswordVerificationPolicy (
+ OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy
+ );
+
+/**
+ Return if the password was verified.
+
+ @retval TRUE The password was verified.
+ @retval FALSE The password was not verified.
+**/
+BOOLEAN
+WasPasswordVerified (
+ VOID
+ );
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeFormset.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeFormset.h
new file mode 100644
index 0000000000..581849b534
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeFormset.h
@@ -0,0 +1,23 @@
+/** @file
+ Header file for UserAuthentication formset.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _USER_AUTHENTICATION_DXE_FORMSET_H_
+#define _USER_AUTHENTICATION_DXE_FORMSET_H_
+
+//
+// Vendor GUID of the formset
+//
+#define USER_AUTHENTICATION_FORMSET_GUID \
+ { 0x760e3022, 0xf149, 0x4560, {0x9c, 0x6f, 0x33, 0xaa, 0x7d, 0x48, 0x75, 0xfa} }
+
+#define ADMIN_PASSWORD_KEY_ID 0x2001
+
+#define MAX_PASSWORD_LEN 32
+#define MIN_PASSWORD_LEN 0
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.h
new file mode 100644
index 0000000000..47bb95529f
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.h
@@ -0,0 +1,52 @@
+/** @file
+ Header file for UserAuthenticationSmm.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USER_AUTHENTICATION_SMM_H__
+#define __USER_AUTHENTICATION_SMM_H__
+
+#include <PiSmm.h>
+
+#include <Protocol/SmmVariable.h>
+#include <Protocol/VariableLock.h>
+
+#include <Guid/UserAuthentication.h>
+
+#include <Library/DebugLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PrintLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/SmmServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/SmmServicesTableLib.h>
+#include <Library/BaseCryptLib.h>
+#include <Library/PlatformPasswordLib.h>
+
+#include "KeyService.h"
+
+#define PASSWORD_SALT_SIZE 32
+#define PASSWORD_HASH_SIZE 32 // SHA256_DIGEST_SIZE
+
+#define PASSWORD_MAX_TRY_COUNT 3
+#define PASSWORD_HISTORY_CHECK_COUNT 5
+
+//
+// Name of the variable
+//
+#define USER_AUTHENTICATION_VAR_NAME L"Password"
+#define USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME L"PasswordLast"
+
+//
+// Variable storage
+//
+typedef struct {
+ UINT8 PasswordHash[PASSWORD_HASH_SIZE];
+ UINT8 PasswordSalt[PASSWORD_SALT_SIZE];
+} USER_PASSWORD_VAR_STRUCT;
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeVfr.vfr b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeVfr.vfr
new file mode 100644
index 0000000000..ca1d5ddec1
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeVfr.vfr
@@ -0,0 +1,39 @@
+///** @file
+// UserAuthentication formset.
+//
+// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+//**/
+
+#include <Guid/HiiPlatformSetupFormset.h>
+#include "UserAuthenticationDxeFormset.h"
+
+formset
+ guid = USER_AUTHENTICATION_FORMSET_GUID,
+ title = STRING_TOKEN(STR_FORM_SET_TITLE),
+ help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
+ classguid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID,
+
+ form formid = 1,
+ title = STRING_TOKEN(STR_FORM_TITLE);
+
+ grayoutif TRUE;
+ text
+ help = STRING_TOKEN(STR_ADMIN_PASSWORD_STS_HELP),
+ text = STRING_TOKEN(STR_ADMIN_PASSWORD_STS_PROMPT),
+ text = STRING_TOKEN(STR_ADMIN_PASSWORD_STS_CONTENT);
+ endif;
+
+ password
+ prompt = STRING_TOKEN(STR_ADMIN_PASSWORD_PROMPT),
+ help = STRING_TOKEN(STR_ADMIN_PASSWORD_HELP),
+ flags = INTERACTIVE,
+ key = ADMIN_PASSWORD_KEY_ID,
+ minsize = MIN_PASSWORD_LEN,
+ maxsize = MAX_PASSWORD_LEN,
+ endpassword;
+
+ endform;
+
+endformset;
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c
new file mode 100644
index 0000000000..08e081aa99
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c
@@ -0,0 +1,78 @@
+/** @file
+ NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared
+ but returns the PCD value directly. This instance can be used to verify security
+ related features during platform enabling and development. It should be replaced
+ by a platform-specific method(e.g. Button pressed) in a real platform for product.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+BOOLEAN mPasswordCleared = FALSE;
+
+/**
+ This function is called at password driver entrypoint.
+ This function should be called only once, to clear the password.
+
+ This function provides a way to reset the password, just in case
+ the platform owner forgets the password.
+ The platform should provide a secure way to make sure
+ only the platform owner is allowed to clear password.
+
+ Once the password is cleared, the platform should provide a way
+ to set a new password.
+
+ @retval TRUE There is a platform request to clear the password.
+ @retval FALSE There is no platform request to clear the password.
+**/
+BOOLEAN
+EFIAPI
+IsPasswordCleared (
+ VOID
+ )
+{
+ return mPasswordCleared;
+}
+
+/**
+ This function is called if the password driver finds that the password is not enrolled,
+ when the password is required to input.
+
+ This function should return the action according to platform policy.
+
+ @retval TRUE The caller should force the user to enroll the password.
+ @retval FALSE The caller may skip the password enroll.
+**/
+BOOLEAN
+EFIAPI
+NeedEnrollPassword (
+ VOID
+ )
+{
+ return FALSE;
+}
+
+
+/**
+ Save password clear state from a PCD to mPasswordCleared.
+
+ @param ImageHandle ImageHandle of the loaded driver.
+ @param SystemTable Pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS PcdPasswordCleared is got successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+PlatformPasswordLibNullConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+
+ mPasswordCleared = PcdGetBool(PcdPasswordCleared);
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c
new file mode 100644
index 0000000000..cbaf572378
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c
@@ -0,0 +1,274 @@
+/** @file
+ UserPasswordLib instance implementation provides services to
+ set/verify password and return if the password is set.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Protocol/SmmCommunication.h>
+
+#include <Guid/PiSmmCommunicationRegionTable.h>
+#include <Guid/UserAuthentication.h>
+
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+#include <Library/BaseMemoryLib.h>
+
+/**
+ Initialize the communicate buffer using DataSize and Function.
+
+ @param[out] DataPtr Points to the data in the communicate buffer.
+ @param[in] DataSize The data size to send to SMM.
+ @param[in] Function The function number to initialize the communicate header.
+
+ @return Communicate buffer.
+**/
+VOID*
+UserPasswordLibInitCommunicateBuffer (
+ OUT VOID **DataPtr OPTIONAL,
+ IN UINTN DataSize,
+ IN UINTN Function
+ )
+{
+ EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
+ VOID *Buffer;
+ EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable;
+ EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
+ UINTN Index;
+ UINTN Size;
+ EFI_STATUS Status;
+
+ Buffer = NULL;
+ Status = EfiGetSystemConfigurationTable (
+ &gEdkiiPiSmmCommunicationRegionTableGuid,
+ (VOID **) &SmmCommRegionTable
+ );
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+ ASSERT (SmmCommRegionTable != NULL);
+ SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
+ Size = 0;
+ for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) {
+ if (SmmCommMemRegion->Type == EfiConventionalMemory) {
+ Size = EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages);
+ if (Size >= (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) {
+ break;
+ }
+ }
+ SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRegion + SmmCommRegionTable->DescriptorSize);
+ }
+ ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
+
+ Buffer = (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart;
+ ASSERT (Buffer != NULL);
+ SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
+ CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid);
+ SmmCommunicateHeader->MessageLength = DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data;
+ ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER));
+ SmmPasswordFunctionHeader->Function = Function;
+ if (DataPtr != NULL) {
+ *DataPtr = SmmPasswordFunctionHeader + 1;
+ }
+
+ return Buffer;
+}
+
+/**
+ Send the data in communicate buffer to SMM.
+
+ @param[in] Buffer Points to the data in the communicate buffer.
+ @param[in] DataSize The data size to send to SMM.
+
+ @retval EFI_SUCCESS Success is returned from the function in SMM.
+ @retval Others Failure is returned from the function in SMM.
+
+**/
+EFI_STATUS
+UserPasswordLibSendCommunicateBuffer (
+ IN VOID *Buffer,
+ IN UINTN DataSize
+ )
+{
+ EFI_STATUS Status;
+ UINTN CommSize;
+ EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
+ EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
+
+ //
+ // Locates SMM Communication protocol.
+ //
+ Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &SmmCommunication);
+ ASSERT_EFI_ERROR (Status);
+
+ CommSize = DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ Status = SmmCommunication->Communicate (SmmCommunication, Buffer, &CommSize);
+ ASSERT_EFI_ERROR (Status);
+
+ SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
+ SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data;
+ return SmmPasswordFunctionHeader->ReturnStatus;
+}
+
+/**
+ Validate if the password is correct.
+
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval EFI_SUCCESS The password is correct.
+ @retval EFI_SECURITY_VIOLATION The password is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+**/
+EFI_STATUS
+EFIAPI
+VerifyPassword (
+ IN CHAR16 *Password,
+ IN UINTN PasswordSize
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD *VerifyPassword;
+
+ ASSERT (Password != NULL);
+
+ if (PasswordSize > sizeof(VerifyPassword->Password) * sizeof(CHAR16)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Buffer = UserPasswordLibInitCommunicateBuffer (
+ (VOID**)&VerifyPassword,
+ sizeof(*VerifyPassword),
+ SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = UnicodeStrToAsciiStrS (Password, VerifyPassword->Password, sizeof(VerifyPassword->Password));
+ if (EFI_ERROR(Status)) {
+ goto EXIT;
+ }
+
+ Status = UserPasswordLibSendCommunicateBuffer (Buffer, sizeof(*VerifyPassword));
+
+EXIT:
+ ZeroMem (VerifyPassword, sizeof(*VerifyPassword));
+ return Status;
+}
+
+/**
+ Set a new password.
+
+ @param[in] NewPassword The user input new password.
+ NULL means clear password.
+ @param[in] NewPasswordSize The size of NewPassword in byte.
+ @param[in] OldPassword The user input old password.
+ NULL means no old password.
+ @param[in] OldPasswordSize The size of OldPassword in byte.
+
+ @retval EFI_SUCCESS The NewPassword is set successfully.
+ @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+ @retval EFI_UNSUPPORTED NewPassword is not strong enough.
+ @retval EFI_ALREADY_STARTED NewPassword is in history.
+**/
+EFI_STATUS
+EFIAPI
+SetPassword (
+ IN CHAR16 *NewPassword, OPTIONAL
+ IN UINTN NewPasswordSize,
+ IN CHAR16 *OldPassword, OPTIONAL
+ IN UINTN OldPasswordSize
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_SET_PASSWORD *SetPassword;
+
+ if (NewPasswordSize > sizeof(SetPassword->NewPassword) * sizeof(CHAR16)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ if (OldPasswordSize > sizeof(SetPassword->OldPassword) * sizeof(CHAR16)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Buffer = UserPasswordLibInitCommunicateBuffer (
+ (VOID**)&SetPassword,
+ sizeof(*SetPassword),
+ SMM_PASSWORD_FUNCTION_SET_PASSWORD
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (NewPassword != NULL) {
+ Status = UnicodeStrToAsciiStrS (NewPassword, SetPassword->NewPassword, sizeof(SetPassword->NewPassword));
+ if (EFI_ERROR(Status)) {
+ goto EXIT;
+ }
+ } else {
+ SetPassword->NewPassword[0] = 0;
+ }
+
+ if (OldPassword != NULL) {
+ Status = UnicodeStrToAsciiStrS (OldPassword, SetPassword->OldPassword, sizeof(SetPassword->OldPassword));
+ if (EFI_ERROR(Status)) {
+ goto EXIT;
+ }
+ } else {
+ SetPassword->OldPassword[0] = 0;
+ }
+
+ Status = UserPasswordLibSendCommunicateBuffer (Buffer, sizeof(*SetPassword));
+
+EXIT:
+ ZeroMem (SetPassword, sizeof(*SetPassword));
+ return Status;
+}
+
+/**
+ Return if the password is set.
+
+ @retval TRUE The password is set.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+EFIAPI
+IsPasswordInstalled (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+
+ Buffer = UserPasswordLibInitCommunicateBuffer (
+ NULL,
+ 0,
+ SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET
+ );
+ if (Buffer == NULL) {
+ return FALSE;
+ }
+
+ Status = UserPasswordLibSendCommunicateBuffer (Buffer, 0);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c
new file mode 100644
index 0000000000..050bfda63a
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c
@@ -0,0 +1,522 @@
+/** @file
+ UserPasswordUiLib instance provides services to do password authentication.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Protocol/SmmCommunication.h>
+
+#include <Guid/PiSmmCommunicationRegionTable.h>
+#include <Guid/UserAuthentication.h>
+
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PrintLib.h>
+#include <Library/PlatformPasswordLib.h>
+#include <Library/UserPasswordLib.h>
+
+/**
+ Initialize the communicate buffer using DataSize and Function.
+
+ @param[out] DataPtr Points to the data in the communicate buffer.
+ @param[in] DataSize The data size to send to SMM.
+ @param[in] Function The function number to initialize the communicate header.
+
+ @return Communicate buffer.
+**/
+VOID*
+UserPasswordUiLibInitCommunicateBuffer (
+ OUT VOID **DataPtr OPTIONAL,
+ IN UINTN DataSize,
+ IN UINTN Function
+ )
+{
+ EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
+ VOID *Buffer;
+ EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable;
+ EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
+ UINTN Index;
+ UINTN Size;
+ EFI_STATUS Status;
+
+ Buffer = NULL;
+ Status = EfiGetSystemConfigurationTable (
+ &gEdkiiPiSmmCommunicationRegionTableGuid,
+ (VOID **) &SmmCommRegionTable
+ );
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+ ASSERT (SmmCommRegionTable != NULL);
+ SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
+ Size = 0;
+ for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) {
+ if (SmmCommMemRegion->Type == EfiConventionalMemory) {
+ Size = EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages);
+ if (Size >= (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) {
+ break;
+ }
+ }
+ SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRegion + SmmCommRegionTable->DescriptorSize);
+ }
+ ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
+
+ Buffer = (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart;
+ ASSERT (Buffer != NULL);
+ SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
+ CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid);
+ SmmCommunicateHeader->MessageLength = DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data;
+ ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER));
+ SmmPasswordFunctionHeader->Function = Function;
+ if (DataPtr != NULL) {
+ *DataPtr = SmmPasswordFunctionHeader + 1;
+ }
+
+ return Buffer;
+}
+
+/**
+ Send the data in communicate buffer to SMM.
+
+ @param[in] Buffer Points to the data in the communicate buffer.
+ @param[in] DataSize The data size to send to SMM.
+
+ @retval EFI_SUCCESS Success is returned from the function in SMM.
+ @retval Others Failure is returned from the function in SMM.
+
+**/
+EFI_STATUS
+UserPasswordUiLibSendCommunicateBuffer (
+ IN VOID *Buffer,
+ IN UINTN DataSize
+ )
+{
+ EFI_STATUS Status;
+ UINTN CommSize;
+ EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
+ EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
+
+ //
+ // Locates SMM Communication protocol.
+ //
+ Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &SmmCommunication);
+ ASSERT_EFI_ERROR (Status);
+
+ CommSize = DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ Status = SmmCommunication->Communicate (SmmCommunication, Buffer, &CommSize);
+ ASSERT_EFI_ERROR (Status);
+
+ SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
+ SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data;
+ return SmmPasswordFunctionHeader->ReturnStatus;
+}
+
+/**
+ Set password verification policy.
+
+ @param[in] NeedReVerify Need re-verify or not.
+
+ @retval EFI_SUCCESS Set verification policy successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to set verification policy.
+**/
+EFI_STATUS
+EFIAPI
+UiSetPasswordVerificationPolicy (
+ IN BOOLEAN NeedReVerify
+ )
+{
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *SetVerifyPolicy;
+
+ Buffer = UserPasswordUiLibInitCommunicateBuffer (
+ (VOID**)&SetVerifyPolicy,
+ sizeof(*SetVerifyPolicy),
+ SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ SetVerifyPolicy->NeedReVerify = NeedReVerify;
+
+ return UserPasswordUiLibSendCommunicateBuffer (Buffer, sizeof(*SetVerifyPolicy));
+}
+
+/**
+ Get a user input string.
+
+ @param[in] PopUpString A popup string to inform user.
+ @param[in, out] UserInput The user input string
+ @param[in] UserInputMaxLen The max unicode count of the UserInput without NULL terminator.
+**/
+EFI_STATUS
+GetUserInput (
+ IN CHAR16 *PopUpString,
+ IN OUT CHAR16 *UserInput,
+ IN UINTN UserInputMaxLen
+ )
+{
+ EFI_INPUT_KEY InputKey;
+ UINTN InputLength;
+ CHAR16 *Mask;
+
+ UserInput[0] = 0;
+ Mask = AllocateZeroPool ((UserInputMaxLen + 1) * sizeof(CHAR16));
+ if (Mask == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ InputLength = 0;
+
+ while (TRUE) {
+ if (InputLength < UserInputMaxLen) {
+ Mask[InputLength] = L'_';
+ }
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &InputKey,
+ PopUpString,
+ L"--------------------------------",
+ Mask,
+ NULL
+ );
+ if (InputKey.ScanCode == SCAN_NULL) {
+ //
+ // Check whether finish inputing password.
+ //
+ if (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN && InputLength > 0) {
+ //
+ // Add the null terminator.
+ //
+ UserInput[InputLength] = 0;
+ break;
+ } else if ((InputKey.UnicodeChar == CHAR_NULL) ||
+ (InputKey.UnicodeChar == CHAR_LINEFEED) ||
+ (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN)
+ ) {
+ continue;
+ } else {
+ //
+ // delete last key entered
+ //
+ if (InputKey.UnicodeChar == CHAR_BACKSPACE) {
+ if (InputLength > 0) {
+ UserInput[InputLength] = 0;
+ Mask[InputLength] = 0;
+ InputLength--;
+ }
+ } else {
+ if (InputLength == UserInputMaxLen) {
+ Mask[InputLength] = 0;
+ continue;
+ }
+ //
+ // add Next key entry
+ //
+ UserInput[InputLength] = InputKey.UnicodeChar;
+ Mask[InputLength] = L'*';
+ InputLength++;
+ }
+ }
+ }
+ }
+ FreePool (Mask);
+ return EFI_SUCCESS;
+}
+
+/**
+ Display a message box to end user.
+
+ @param[in] DisplayString The string in message box.
+**/
+VOID
+MessageBox (
+ IN CHAR16 *DisplayString
+ )
+{
+ EFI_INPUT_KEY Key;
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+}
+
+/**
+ Force system reset.
+**/
+VOID
+ForceSystemReset (
+ VOID
+ )
+{
+ MessageBox (L"Password retry count reach, reset system!");
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+ CpuDeadLoop();
+}
+
+/**
+ Display message for set password.
+
+ @param[in] ReturnStatus The return status for set password.
+**/
+VOID
+PrintSetPasswordStatus (
+ IN EFI_STATUS ReturnStatus
+ )
+{
+ CHAR16 *DisplayString;
+ CHAR16 *DisplayString2;
+
+ EFI_INPUT_KEY Key;
+
+ if (ReturnStatus == EFI_UNSUPPORTED) {
+ DisplayString = L"New password is not strong enough!";
+ DisplayString2 = L"Password must at least 8 chars and include lowercase, uppercase alphabetic, number and symbol";
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ DisplayString2,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ } else {
+ if (ReturnStatus == EFI_SUCCESS) {
+ DisplayString = L"New password is updated successfully!";
+ } else if (ReturnStatus == EFI_ALREADY_STARTED) {
+ DisplayString = L"New password is found in the history passwords!";
+ } else {
+ DisplayString = L"New password update fails!";
+ }
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ }
+}
+
+/**
+ Get password verification policy.
+
+ @param[out] VerifyPolicy Verification policy.
+
+ @retval EFI_SUCCESS Get verification policy successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verification policy.
+**/
+EFI_STATUS
+GetPasswordVerificationPolicy (
+ OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *TempVerifyPolicy;
+
+ Buffer = UserPasswordUiLibInitCommunicateBuffer (
+ (VOID**)&TempVerifyPolicy,
+ sizeof(*TempVerifyPolicy),
+ SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = UserPasswordUiLibSendCommunicateBuffer (Buffer, sizeof(*TempVerifyPolicy));
+ if (!EFI_ERROR (Status)) {
+ CopyMem (VerifyPolicy, TempVerifyPolicy, sizeof (SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY));
+ }
+
+ return Status;
+}
+
+/**
+ Return if the password was verified.
+
+ @retval TRUE The password was verified.
+ @retval FALSE The password was not verified.
+**/
+BOOLEAN
+WasPasswordVerified (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+
+ Buffer = UserPasswordUiLibInitCommunicateBuffer (
+ NULL,
+ 0,
+ SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED
+ );
+ if (Buffer == NULL) {
+ return FALSE;
+ }
+
+ Status = UserPasswordUiLibSendCommunicateBuffer (Buffer, 0);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
+ Require user input password.
+
+ @retval TRUE User input correct password successfully.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+RequireUserPassword (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
+ CHAR16 *PopUpString;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY VerifyPolicy;
+
+ Status = EFI_SUCCESS;
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+
+ if (!IsPasswordInstalled ()) {
+ return FALSE;
+ }
+
+ Status = GetPasswordVerificationPolicy (&VerifyPolicy);
+ if (!EFI_ERROR (Status)) {
+ if (WasPasswordVerified() && (!VerifyPolicy.NeedReVerify)) {
+ DEBUG ((DEBUG_INFO, "Password was verified and Re-verify is not needed\n"));
+ return TRUE;
+ }
+ }
+
+ PopUpString = L"Please input admin password";
+
+ while (TRUE) {
+ gST->ConOut->ClearScreen(gST->ConOut);
+ GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
+
+ Status = VerifyPassword (UserInputPw, StrSize(UserInputPw));
+ if (!EFI_ERROR(Status)) {
+ break;
+ }
+ if (Status == EFI_ACCESS_DENIED) {
+ //
+ // Password retry count reach.
+ //
+ ForceSystemReset ();
+ }
+ MessageBox (L"Incorrect password!");
+ }
+
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+
+ gST->ConOut->ClearScreen(gST->ConOut);
+
+ return TRUE;
+}
+
+/**
+ Set user password.
+
+**/
+VOID
+SetUserPassword (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
+ CHAR16 TmpPassword[PASSWORD_MAX_SIZE];
+ CHAR16 *PopUpString;
+ CHAR16 *PopUpString2;
+
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+ ZeroMem(TmpPassword, sizeof(TmpPassword));
+
+ PopUpString = L"Please set admin password";
+
+ while (TRUE) {
+ gST->ConOut->ClearScreen(gST->ConOut);
+ GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
+
+ PopUpString2 = L"Please confirm your new password";
+ gST->ConOut->ClearScreen(gST->ConOut);
+ GetUserInput (PopUpString2, TmpPassword, PASSWORD_MAX_SIZE - 1);
+ if (StrCmp (TmpPassword, UserInputPw) != 0) {
+ MessageBox (L"Password are not the same!");
+ continue;
+ }
+
+ Status = SetPassword (UserInputPw, StrSize(UserInputPw), NULL, 0);
+ PrintSetPasswordStatus (Status);
+ if (!EFI_ERROR(Status)) {
+ break;
+ }
+ }
+
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+ ZeroMem(TmpPassword, sizeof(TmpPassword));
+
+ gST->ConOut->ClearScreen(gST->ConOut);
+}
+
+/**
+ Do password authentication.
+
+ @retval EFI_SUCCESS Password authentication pass.
+**/
+EFI_STATUS
+EFIAPI
+UiDoPasswordAuthentication (
+ VOID
+ )
+{
+ BOOLEAN PasswordSet;
+
+ PasswordSet = RequireUserPassword ();
+ if (PasswordSet) {
+ DEBUG ((DEBUG_INFO, "Welcome Admin!\n"));
+ } else {
+ DEBUG ((DEBUG_INFO, "Admin password is not set!\n"));
+ if (NeedEnrollPassword()) {
+ SetUserPassword ();
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.c
new file mode 100644
index 0000000000..8b06e58ca5
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.c
@@ -0,0 +1,133 @@
+/** @file
+ Password key service.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/BaseCryptLib.h>
+#include "KeyService.h"
+
+/**
+ Compares the contents of two buffers with slow algorithm
+
+ This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
+ If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
+ value returned is the first mismatched byte in SourceBuffer subtracted from the first
+ mismatched byte in DestinationBuffer.
+
+ If Length > 0 and DestinationBuffer is NULL, then ASSERT().
+ If Length > 0 and SourceBuffer is NULL, then ASSERT().
+ If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
+ If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
+
+ @param DestinationBuffer The pointer to the destination buffer to compare.
+ @param SourceBuffer The pointer to the source buffer to compare.
+ @param Length The number of bytes to compare.
+
+ @return 0 All Length bytes of the two buffers are identical.
+ @retval -1 The SourceBuffer is not identical to DestinationBuffer.
+
+**/
+INTN
+EFIAPI
+KeyLibSlowCompareMem (
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
+ )
+{
+ UINT8 Delta;
+ UINTN Index;
+ UINT8 *Destination;
+ UINT8 *Source;
+
+ Destination = (UINT8 *)DestinationBuffer;
+ Source = (UINT8 *)SourceBuffer;
+ Delta = 0;
+ for (Index = 0; Index < Length; Index++) {
+ Delta |= Destination[Index] ^ Source[Index];
+ }
+ if (Delta == 0) {
+ return 0;
+ } else {
+ return -1;
+ }
+}
+
+/**
+ Generate Salt value.
+
+ @param[in, out] SaltValue Points to the salt buffer
+ @param[in] SaltSize Size of the salt buffer
+
+ @retval TRUE Salt is generated.
+ @retval FALSE Salt is not generated.
+**/
+BOOLEAN
+EFIAPI
+KeyLibGenerateSalt (
+ IN OUT UINT8 *SaltValue,
+ IN UINTN SaltSize
+ )
+{
+ if (SaltValue == NULL) {
+ return FALSE;
+ }
+ RandomSeed(NULL, 0);
+ RandomBytes(SaltValue, SaltSize);
+ return TRUE;
+}
+
+/**
+ Hash the password with PBKDF2.
+
+ @param[in] HashType Hash type
+ @param[in] Key Points to the key buffer
+ @param[in] KeySize Key buffer size
+ @param[in] SaltValue Points to the salt buffer
+ @param[in] SaltSize Size of the salt buffer
+ @param[out] KeyHash Points to the hashed result
+ @param[in] KeyHashSize Size of the hash buffer
+
+ @retval TRUE Hash the data successfully.
+ @retval FALSE Failed to hash the data.
+
+**/
+BOOLEAN
+EFIAPI
+KeyLibGeneratePBKDF2Hash (
+ IN UINT32 HashType,
+ IN VOID *Key,
+ IN UINTN KeySize,
+ IN UINT8 *SaltValue,
+ IN UINTN SaltSize,
+ OUT UINT8 *KeyHash,
+ IN UINTN KeyHashSize
+ )
+{
+ BOOLEAN Result;
+
+ if (HashType != HASH_TYPE_SHA256) {
+ return FALSE;
+ }
+ if (KeyHashSize != SHA256_DIGEST_SIZE) {
+ return FALSE;
+ }
+
+ Result = Pkcs5HashPassword (
+ KeySize,
+ Key,
+ SaltSize,
+ SaltValue,
+ DEFAULT_PBKDF2_ITERATION_COUNT,
+ SHA256_DIGEST_SIZE,
+ KeyHashSize,
+ KeyHash
+ );
+ return Result;
+}
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.c
new file mode 100644
index 0000000000..b4326d380f
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.c
@@ -0,0 +1,484 @@
+/** @file
+ This Driver mainly provides Setup Form to change password.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UserAuthentication2Dxe.h"
+
+USER_AUTHENTICATION_PRIVATE_DATA *mUserAuthenticationData = NULL;
+
+EFI_GUID mUserAuthenticationVendorGuid = USER_AUTHENTICATION_FORMSET_GUID;
+HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = {
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ {
+ (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ }
+ },
+ USER_AUTHENTICATION_FORMSET_GUID
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ (UINT8) (END_DEVICE_PATH_LENGTH),
+ (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
+ }
+ }
+};
+
+/**
+ Display a message box to end user.
+
+ @param[in] DisplayString The string in message box.
+**/
+VOID
+MessageBox (
+ IN CHAR16 *DisplayString
+ )
+{
+ EFI_INPUT_KEY Key;
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+}
+
+/**
+ Force system reset.
+**/
+VOID
+ForceSystemReset (
+ VOID
+ )
+{
+ MessageBox (L"Password retry count reach, reset system!");
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+ CpuDeadLoop();
+}
+
+/**
+ Display message for set password.
+
+ @param[in] ReturnStatus The return status for set password.
+**/
+VOID
+PrintSetPasswordStatus (
+ IN EFI_STATUS ReturnStatus
+ )
+{
+ CHAR16 *DisplayString;
+ CHAR16 *DisplayString2;
+
+ EFI_INPUT_KEY Key;
+
+ if (ReturnStatus == EFI_UNSUPPORTED) {
+ DisplayString = L"New password is not strong enough!";
+ DisplayString2 = L"Password must at least 8 chars and include lowercase, uppercase alphabetic, number and symbol";
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ DisplayString2,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ } else {
+ if (ReturnStatus == EFI_SUCCESS) {
+ DisplayString = L"New password is updated successfully!";
+ } else if (ReturnStatus == EFI_ALREADY_STARTED) {
+ DisplayString = L"New password is found in the history passwords!";
+ } else {
+ DisplayString = L"New password update fails!";
+ }
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ }
+}
+
+/**
+ This function allows a caller to extract the current configuration for one
+ or more named elements from the target driver.
+
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param Request A null-terminated Unicode string in
+ <ConfigRequest> 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_SUCCESS The Results is filled with the requested values.
+ @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
+ @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
+ driver.
+
+**/
+EFI_STATUS
+EFIAPI
+ExtractConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Request,
+ OUT EFI_STRING *Progress,
+ OUT EFI_STRING *Results
+ )
+{
+ if (Progress == NULL || Results == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ *Progress = Request;
+ return EFI_NOT_FOUND;
+}
+
+
+/**
+ This function processes the results of changes in configuration.
+
+ @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_SUCCESS The Results is processed successfully.
+ @retval EFI_INVALID_PARAMETER Configuration is NULL.
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
+ driver.
+
+**/
+EFI_STATUS
+EFIAPI
+RouteConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
+ )
+{
+ if (Configuration == NULL || Progress == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *Progress = Configuration;
+
+ return EFI_NOT_FOUND;
+}
+
+/**
+ HII update Admin Password status.
+
+**/
+VOID
+HiiUpdateAdminPasswordStatus (
+ VOID
+ )
+{
+ if (IsPasswordInstalled ()) {
+ HiiSetString (
+ mUserAuthenticationData->HiiHandle,
+ STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
+ L"Installed",
+ NULL
+ );
+ } else {
+ HiiSetString (
+ mUserAuthenticationData->HiiHandle,
+ STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
+ L"Not Installed",
+ NULL
+ );
+ }
+}
+
+/**
+ This function processes the results of changes in configuration.
+
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param Action Specifies the type of action taken by the browser.
+ @param QuestionId A unique value which is sent to the original
+ exporting driver so that it can identify the type
+ of data to expect.
+ @param Type The type of value for the question.
+ @param Value A pointer to the data being sent to the original
+ exporting driver.
+ @param ActionRequest On return, points to the action requested by the
+ callback function.
+
+ @retval EFI_SUCCESS The callback successfully handled the action.
+ @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
+ variable and its data.
+ @retval EFI_DEVICE_ERROR The variable could not be saved.
+ @retval EFI_UNSUPPORTED The specified Action is not supported by the
+ callback.
+
+**/
+EFI_STATUS
+EFIAPI
+UserAuthenticationCallback (
+ 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;
+ CHAR16 *UserInputPassword;
+
+ Status = EFI_SUCCESS;
+
+ if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE)) ||
+ (ActionRequest == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ switch (Action) {
+ case EFI_BROWSER_ACTION_FORM_OPEN:
+ {
+ switch (QuestionId) {
+ case ADMIN_PASSWORD_KEY_ID:
+ HiiUpdateAdminPasswordStatus ();
+ default:
+ break;
+ }
+ }
+ break;
+ case EFI_BROWSER_ACTION_CHANGING:
+ {
+ switch (QuestionId) {
+ case ADMIN_PASSWORD_KEY_ID:
+ if ((Type == EFI_IFR_TYPE_STRING) && (Value->string == 0) &&
+ (mUserAuthenticationData->PasswordState == BROWSER_STATE_SET_PASSWORD)) {
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
+ ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // The Callback is responsible for validating old password input by user,
+ // If Callback return EFI_SUCCESS, it indicates validation pass.
+ //
+ switch (mUserAuthenticationData->PasswordState) {
+ case BROWSER_STATE_VALIDATE_PASSWORD:
+ UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
+ if (UserInputPassword == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+ if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
+ Status = EFI_NOT_READY;
+ break;
+ }
+ if (UserInputPassword[0] == 0) {
+ //
+ // Setup will use an empty password to check whether the old password is set,
+ // If the validation is successful, means there is no old password, return
+ // success to set the new password. Or need to return EFI_NOT_READY to
+ // let user input the old password.
+ //
+ Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
+ if (Status == EFI_SUCCESS) {
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
+ } else {
+ Status = EFI_NOT_READY;
+ }
+ break;
+ }
+ Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
+ if (Status == EFI_SUCCESS) {
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
+ StrCpyS (
+ mUserAuthenticationData->OldPassword,
+ sizeof(mUserAuthenticationData->OldPassword)/sizeof(CHAR16),
+ UserInputPassword
+ );
+ } else {
+ //
+ // Old password mismatch, return EFI_NOT_READY to prompt for error message.
+ //
+ if (Status == EFI_ACCESS_DENIED) {
+ //
+ // Password retry count reach.
+ //
+ ForceSystemReset ();
+ }
+ Status = EFI_NOT_READY;
+ }
+ break;
+
+ case BROWSER_STATE_SET_PASSWORD:
+ UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
+ if (UserInputPassword == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+ if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
+ Status = EFI_NOT_READY;
+ break;
+ }
+ Status = SetPassword (UserInputPassword, StrSize (UserInputPassword), mUserAuthenticationData->OldPassword, StrSize(mUserAuthenticationData->OldPassword));
+ PrintSetPasswordStatus (Status);
+ ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
+ HiiUpdateAdminPasswordStatus ();
+ break;
+
+ default:
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ return Status;
+}
+
+/**
+ User Authentication entry point.
+
+ @param ImageHandle The image handle.
+ @param SystemTable The system table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+ @return other Contain some other errors.
+
+**/
+EFI_STATUS
+EFIAPI
+UserAuthentication2Entry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE DriverHandle;
+ EFI_HII_HANDLE HiiHandle;
+
+ DriverHandle = NULL;
+
+ mUserAuthenticationData = AllocateZeroPool (sizeof (USER_AUTHENTICATION_PRIVATE_DATA));
+ if (mUserAuthenticationData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mUserAuthenticationData->ConfigAccess.ExtractConfig = ExtractConfig;
+ mUserAuthenticationData->ConfigAccess.RouteConfig = RouteConfig;
+ mUserAuthenticationData->ConfigAccess.Callback = UserAuthenticationCallback;
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
+
+ //
+ // Install Config Access protocol to driver handle.
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &DriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mUserAuthenticationData->ConfigAccess,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ mUserAuthenticationData->DriverHandle = DriverHandle;
+
+ //
+ // Add HII data to database.
+ //
+ HiiHandle = HiiAddPackages (
+ &mUserAuthenticationVendorGuid,
+ DriverHandle,
+ UserAuthentication2DxeStrings,
+ UserAuthenticationDxeVfrBin,
+ NULL
+ );
+ if (HiiHandle == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ mUserAuthenticationData->HiiHandle = HiiHandle;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Unloads the application and its installed protocol.
+
+ @param[in] ImageHandle Handle that identifies the image to be unloaded.
+
+ @retval EFI_SUCCESS The image has been unloaded.
+**/
+EFI_STATUS
+EFIAPI
+UserAuthentication2Unload (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ ASSERT (mUserAuthenticationData != NULL);
+
+ //
+ // Uninstall Config Access Protocol.
+ //
+ if (mUserAuthenticationData->DriverHandle != NULL) {
+ gBS->UninstallMultipleProtocolInterfaces (
+ mUserAuthenticationData->DriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mUserAuthenticationData->ConfigAccess,
+ NULL
+ );
+ mUserAuthenticationData->DriverHandle = NULL;
+ }
+
+ //
+ // Remove Hii Data.
+ //
+ if (mUserAuthenticationData->HiiHandle != NULL) {
+ HiiRemovePackages (mUserAuthenticationData->HiiHandle);
+ }
+
+ FreePool (mUserAuthenticationData);
+ mUserAuthenticationData = NULL;
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.c
new file mode 100644
index 0000000000..bba2057a96
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.c
@@ -0,0 +1,780 @@
+/** @file
+ This Driver mainly provides Setup Form to change password and
+ does user authentication before entering Setup.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UserAuthenticationDxe.h"
+
+EFI_EVENT mExitBootServicesEvent = NULL;
+EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
+USER_AUTHENTICATION_PRIVATE_DATA *mUserAuthenticationData = NULL;
+EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL;
+
+EFI_GUID mUserAuthenticationVendorGuid = USER_AUTHENTICATION_FORMSET_GUID;
+HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = {
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ {
+ (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ }
+ },
+ USER_AUTHENTICATION_FORMSET_GUID
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ (UINT8) (END_DEVICE_PATH_LENGTH),
+ (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
+ }
+ }
+};
+
+/**
+ Get a user input string.
+
+ @param[in] PopUpString A popup string to inform user.
+ @param[in, out] UserInput The user input string
+ @param[in] UserInputMaxLen The max unicode count of the UserInput without NULL terminator.
+**/
+EFI_STATUS
+GetUserInput (
+ IN CHAR16 *PopUpString,
+ IN OUT CHAR16 *UserInput,
+ IN UINTN UserInputMaxLen
+ )
+{
+ EFI_INPUT_KEY InputKey;
+ UINTN InputLength;
+ CHAR16 *Mask;
+
+ UserInput[0] = 0;
+ Mask = AllocateZeroPool ((UserInputMaxLen + 1) * sizeof(CHAR16));
+ if (Mask == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ InputLength = 0;
+
+ while (TRUE) {
+ if (InputLength < UserInputMaxLen) {
+ Mask[InputLength] = L'_';
+ }
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &InputKey,
+ PopUpString,
+ L"--------------------------------",
+ Mask,
+ NULL
+ );
+ if (InputKey.ScanCode == SCAN_NULL) {
+ //
+ // Check whether finish inputing password.
+ //
+ if (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN && InputLength > 0) {
+ //
+ // Add the null terminator.
+ //
+ UserInput[InputLength] = 0;
+ break;
+ } else if ((InputKey.UnicodeChar == CHAR_NULL) ||
+ (InputKey.UnicodeChar == CHAR_LINEFEED) ||
+ (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN)
+ ) {
+ continue;
+ } else {
+ //
+ // delete last key entered
+ //
+ if (InputKey.UnicodeChar == CHAR_BACKSPACE) {
+ if (InputLength > 0) {
+ UserInput[InputLength] = 0;
+ Mask[InputLength] = 0;
+ InputLength--;
+ }
+ } else {
+ if (InputLength == UserInputMaxLen) {
+ Mask[InputLength] = 0;
+ continue;
+ }
+ //
+ // add Next key entry
+ //
+ UserInput[InputLength] = InputKey.UnicodeChar;
+ Mask[InputLength] = L'*';
+ InputLength++;
+ }
+ }
+ }
+ }
+ FreePool (Mask);
+ return EFI_SUCCESS;
+}
+
+/**
+ Display a message box to end user.
+
+ @param[in] DisplayString The string in message box.
+**/
+VOID
+MessageBox (
+ IN CHAR16 *DisplayString
+ )
+{
+ EFI_INPUT_KEY Key;
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+}
+
+/**
+ Force system reset.
+**/
+VOID
+ForceSystemReset (
+ VOID
+ )
+{
+ MessageBox (L"Password retry count reach, reset system!");
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+ CpuDeadLoop();
+}
+
+/**
+ Display message for set password.
+
+ @param[in] ReturnStatus The return status for set password.
+**/
+VOID
+PrintSetPasswordStatus (
+ IN EFI_STATUS ReturnStatus
+ )
+{
+ CHAR16 *DisplayString;
+ CHAR16 *DisplayString2;
+
+ EFI_INPUT_KEY Key;
+
+ if (ReturnStatus == EFI_UNSUPPORTED) {
+ DisplayString = L"New password is not strong enough!";
+ DisplayString2 = L"Password must at least 8 chars and include lowercase, uppercase alphabetic, number and symbol";
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ DisplayString2,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ } else {
+ if (ReturnStatus == EFI_SUCCESS) {
+ DisplayString = L"New password is updated successfully!";
+ } else if (ReturnStatus == EFI_ALREADY_STARTED) {
+ DisplayString = L"New password is found in the history passwords!";
+ } else {
+ DisplayString = L"New password update fails!";
+ }
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ }
+}
+
+/**
+ Require user input password.
+
+ @retval TRUE User input correct password successfully.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+RequireUserPassword (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
+ CHAR16 *PopUpString;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY VerifyPolicy;
+
+ Status = EFI_SUCCESS;
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+
+ if (!IsPasswordInstalled ()) {
+ return FALSE;
+ }
+
+ Status = GetPasswordVerificationPolicy (&VerifyPolicy);
+ if (!EFI_ERROR (Status)) {
+ if (WasPasswordVerified() && (!VerifyPolicy.NeedReVerify)) {
+ DEBUG ((DEBUG_INFO, "Password was verified and Re-verify is not needed\n"));
+ return TRUE;
+ }
+ }
+
+ PopUpString = L"Please input admin password";
+
+ while (TRUE) {
+ gST->ConOut->ClearScreen(gST->ConOut);
+ GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
+
+ Status = VerifyPassword (UserInputPw, StrSize(UserInputPw));
+ if (!EFI_ERROR(Status)) {
+ break;
+ }
+ if (Status == EFI_ACCESS_DENIED) {
+ //
+ // Password retry count reach.
+ //
+ ForceSystemReset ();
+ }
+ MessageBox (L"Incorrect password!");
+ }
+
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+
+ gST->ConOut->ClearScreen(gST->ConOut);
+
+ return TRUE;
+}
+
+/**
+ Set user password.
+
+**/
+VOID
+SetUserPassword (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
+ CHAR16 TmpPassword[PASSWORD_MAX_SIZE];
+ CHAR16 *PopUpString;
+ CHAR16 *PopUpString2;
+
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+ ZeroMem(TmpPassword, sizeof(TmpPassword));
+
+ PopUpString = L"Please set admin password";
+
+ while (TRUE) {
+ gST->ConOut->ClearScreen(gST->ConOut);
+ GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
+
+ PopUpString2 = L"Please confirm your new password";
+ gST->ConOut->ClearScreen(gST->ConOut);
+ GetUserInput (PopUpString2, TmpPassword, PASSWORD_MAX_SIZE - 1);
+ if (StrCmp (TmpPassword, UserInputPw) != 0) {
+ MessageBox (L"Password are not the same!");
+ continue;
+ }
+
+ Status = SetPassword (UserInputPw, StrSize(UserInputPw), NULL, 0);
+ PrintSetPasswordStatus (Status);
+ if (!EFI_ERROR(Status)) {
+ break;
+ }
+ }
+
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+ ZeroMem(TmpPassword, sizeof(TmpPassword));
+
+ gST->ConOut->ClearScreen(gST->ConOut);
+}
+
+/**
+ Check password before entering into setup.
+
+ @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
+
+ @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. For progress codes, the operation is the current activity.
+ For error codes, it is the exception. For debug codes, it is not defined at this time.
+ Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
+ Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
+
+ @param Instance The enumeration of a hardware or software entity within the system.
+ A system may contain multiple entities that match a class/subclass pairing.
+ The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
+ not meaningful, or not relevant. 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.
+ Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.
+
+
+ @param Data This optional parameter may be used to pass additional data
+
+ @retval EFI_SUCCESS Status code is what we expected.
+ @retval EFI_UNSUPPORTED Status code not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+CheckForPassword (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId, OPTIONAL
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+{
+ BOOLEAN PasswordSet;
+
+ if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) &&
+ (Value == (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP))) {
+ //
+ // Check whether enter setup page.
+ //
+ PasswordSet = RequireUserPassword ();
+ if (PasswordSet) {
+ DEBUG ((DEBUG_INFO, "Welcome Admin!\n"));
+ } else {
+ DEBUG ((DEBUG_INFO, "Admin password is not set!\n"));
+ if (NeedEnrollPassword()) {
+ SetUserPassword ();
+ }
+ }
+
+ return EFI_SUCCESS;
+ } else{
+ return EFI_UNSUPPORTED;
+ }
+}
+
+/**
+ This function allows a caller to extract the current configuration for one
+ or more named elements from the target driver.
+
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param Request A null-terminated Unicode string in
+ <ConfigRequest> 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_SUCCESS The Results is filled with the requested values.
+ @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
+ @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
+ driver.
+
+**/
+EFI_STATUS
+EFIAPI
+ExtractConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Request,
+ OUT EFI_STRING *Progress,
+ OUT EFI_STRING *Results
+ )
+{
+ if (Progress == NULL || Results == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ *Progress = Request;
+ return EFI_NOT_FOUND;
+}
+
+
+/**
+ This function processes the results of changes in configuration.
+
+ @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_SUCCESS The Results is processed successfully.
+ @retval EFI_INVALID_PARAMETER Configuration is NULL.
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
+ driver.
+
+**/
+EFI_STATUS
+EFIAPI
+RouteConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
+ )
+{
+ if (Configuration == NULL || Progress == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *Progress = Configuration;
+
+ return EFI_NOT_FOUND;
+}
+
+/**
+ HII update Admin Password status.
+
+**/
+VOID
+HiiUpdateAdminPasswordStatus (
+ VOID
+ )
+{
+ if (IsPasswordInstalled ()) {
+ HiiSetString (
+ mUserAuthenticationData->HiiHandle,
+ STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
+ L"Installed",
+ NULL
+ );
+ } else {
+ HiiSetString (
+ mUserAuthenticationData->HiiHandle,
+ STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
+ L"Not Installed",
+ NULL
+ );
+ }
+}
+
+/**
+ This function processes the results of changes in configuration.
+
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param Action Specifies the type of action taken by the browser.
+ @param QuestionId A unique value which is sent to the original
+ exporting driver so that it can identify the type
+ of data to expect.
+ @param Type The type of value for the question.
+ @param Value A pointer to the data being sent to the original
+ exporting driver.
+ @param ActionRequest On return, points to the action requested by the
+ callback function.
+
+ @retval EFI_SUCCESS The callback successfully handled the action.
+ @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
+ variable and its data.
+ @retval EFI_DEVICE_ERROR The variable could not be saved.
+ @retval EFI_UNSUPPORTED The specified Action is not supported by the
+ callback.
+
+**/
+EFI_STATUS
+EFIAPI
+UserAuthenticationCallback (
+ 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;
+ CHAR16 *UserInputPassword;
+
+ Status = EFI_SUCCESS;
+
+ if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE)) ||
+ (ActionRequest == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ switch (Action) {
+ case EFI_BROWSER_ACTION_FORM_OPEN:
+ {
+ switch (QuestionId) {
+ case ADMIN_PASSWORD_KEY_ID:
+ HiiUpdateAdminPasswordStatus ();
+ default:
+ break;
+ }
+ }
+ break;
+ case EFI_BROWSER_ACTION_CHANGING:
+ {
+ switch (QuestionId) {
+ case ADMIN_PASSWORD_KEY_ID:
+ if ((Type == EFI_IFR_TYPE_STRING) && (Value->string == 0) &&
+ (mUserAuthenticationData->PasswordState == BROWSER_STATE_SET_PASSWORD)) {
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
+ ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // The Callback is responsible for validating old password input by user,
+ // If Callback return EFI_SUCCESS, it indicates validation pass.
+ //
+ switch (mUserAuthenticationData->PasswordState) {
+ case BROWSER_STATE_VALIDATE_PASSWORD:
+ UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
+ if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
+ Status = EFI_NOT_READY;
+ break;
+ }
+ if (UserInputPassword[0] == 0) {
+ //
+ // Setup will use a NULL password to check whether the old password is set,
+ // If the validation is successful, means there is no old password, return
+ // success to set the new password. Or need to return EFI_NOT_READY to
+ // let user input the old password.
+ //
+ Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
+ if (Status == EFI_SUCCESS) {
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
+ } else {
+ Status = EFI_NOT_READY;
+ }
+ break;
+ }
+ Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
+ if (Status == EFI_SUCCESS) {
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
+ StrCpyS (
+ mUserAuthenticationData->OldPassword,
+ sizeof(mUserAuthenticationData->OldPassword)/sizeof(CHAR16),
+ UserInputPassword
+ );
+ } else {
+ //
+ // Old password mismatch, return EFI_NOT_READY to prompt for error message.
+ //
+ if (Status == EFI_ACCESS_DENIED) {
+ //
+ // Password retry count reach.
+ //
+ ForceSystemReset ();
+ }
+ Status = EFI_NOT_READY;
+ }
+ break;
+
+ case BROWSER_STATE_SET_PASSWORD:
+ UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
+ if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
+ Status = EFI_NOT_READY;
+ break;
+ }
+ Status = SetPassword (UserInputPassword, StrSize (UserInputPassword), mUserAuthenticationData->OldPassword, StrSize(mUserAuthenticationData->OldPassword));
+ PrintSetPasswordStatus (Status);
+ ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
+ HiiUpdateAdminPasswordStatus ();
+ break;
+
+ default:
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ return Status;
+}
+
+/**
+ Unregister status code callback functions.
+
+ @param Event Event whose notification function is being invoked.
+ @param Context Pointer to the notification function's context, which is
+ always zero in current implementation.
+
+**/
+VOID
+EFIAPI
+UnregisterBootTimeHandlers (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ mRscHandlerProtocol->Unregister (CheckForPassword);
+}
+
+/**
+ User Authentication entry point.
+
+ @param ImageHandle The image handle.
+ @param SystemTable The system table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+ @return other Contain some other errors.
+
+**/
+EFI_STATUS
+EFIAPI
+UserAuthenticationEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE DriverHandle;
+ EFI_HII_HANDLE HiiHandle;
+
+ DriverHandle = NULL;
+
+ mUserAuthenticationData = AllocateZeroPool (sizeof (USER_AUTHENTICATION_PRIVATE_DATA));
+ if (mUserAuthenticationData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mUserAuthenticationData->ConfigAccess.ExtractConfig = ExtractConfig;
+ mUserAuthenticationData->ConfigAccess.RouteConfig = RouteConfig;
+ mUserAuthenticationData->ConfigAccess.Callback = UserAuthenticationCallback;
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
+
+ //
+ // Install Config Access protocol to driver handle.
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &DriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mUserAuthenticationData->ConfigAccess,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ mUserAuthenticationData->DriverHandle = DriverHandle;
+
+ //
+ // Add HII data to database.
+ //
+ HiiHandle = HiiAddPackages (
+ &mUserAuthenticationVendorGuid,
+ DriverHandle,
+ UserAuthenticationDxeStrings,
+ UserAuthenticationDxeVfrBin,
+ NULL
+ );
+ if (HiiHandle == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ mUserAuthenticationData->HiiHandle = HiiHandle;
+
+ //
+ // Locate report status code protocol.
+ //
+ Status = gBS->LocateProtocol (
+ &gEfiRscHandlerProtocolGuid,
+ NULL,
+ (VOID **) &mRscHandlerProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ //Register the callback function for ReportStatusCode() notification.
+ //
+ mRscHandlerProtocol->Register (CheckForPassword, TPL_HIGH_LEVEL);
+
+ //
+ // Unregister boot time report status code listener at ExitBootService Event.
+ //
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ UnregisterBootTimeHandlers,
+ NULL,
+ &gEfiEventExitBootServicesGuid,
+ &mExitBootServicesEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Locates SMM Communication protocol.
+ //
+ Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication);
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Unloads the application and its installed protocol.
+
+ @param[in] ImageHandle Handle that identifies the image to be unloaded.
+
+ @retval EFI_SUCCESS The image has been unloaded.
+**/
+EFI_STATUS
+EFIAPI
+UserAuthenticationUnload (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ ASSERT (mUserAuthenticationData != NULL);
+
+ //
+ // Uninstall Config Access Protocol.
+ //
+ if (mUserAuthenticationData->DriverHandle != NULL) {
+ gBS->UninstallMultipleProtocolInterfaces (
+ mUserAuthenticationData->DriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mUserAuthenticationData->ConfigAccess,
+ NULL
+ );
+ mUserAuthenticationData->DriverHandle = NULL;
+ }
+
+ //
+ // Remove Hii Data.
+ //
+ if (mUserAuthenticationData->HiiHandle != NULL) {
+ HiiRemovePackages (mUserAuthenticationData->HiiHandle);
+ }
+
+ FreePool (mUserAuthenticationData);
+ mUserAuthenticationData = NULL;
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxePassword.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxePassword.c
new file mode 100644
index 0000000000..6e1fedfab7
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxePassword.c
@@ -0,0 +1,319 @@
+/** @file
+ UserAuthentication DXE password wrapper.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UserAuthenticationDxe.h"
+
+/**
+ Initialize the communicate buffer using DataSize and Function.
+
+ @param[out] DataPtr Points to the data in the communicate buffer.
+ @param[in] DataSize The data size to send to SMM.
+ @param[in] Function The function number to initialize the communicate header.
+
+ @return Communicate buffer.
+**/
+VOID*
+InitCommunicateBuffer (
+ OUT VOID **DataPtr OPTIONAL,
+ IN UINTN DataSize,
+ IN UINTN Function
+ )
+{
+ EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
+ VOID *Buffer;
+ EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable;
+ EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
+ UINTN Index;
+ UINTN Size;
+ EFI_STATUS Status;
+
+ Buffer = NULL;
+ Status = EfiGetSystemConfigurationTable (
+ &gEdkiiPiSmmCommunicationRegionTableGuid,
+ (VOID **) &SmmCommRegionTable
+ );
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+ ASSERT (SmmCommRegionTable != NULL);
+ SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
+ Size = 0;
+ for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) {
+ if (SmmCommMemRegion->Type == EfiConventionalMemory) {
+ Size = EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages);
+ if (Size >= (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) {
+ break;
+ }
+ }
+ SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRegion + SmmCommRegionTable->DescriptorSize);
+ }
+ ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
+
+ Buffer = (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart;
+ ASSERT (Buffer != NULL);
+ SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
+ CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid);
+ SmmCommunicateHeader->MessageLength = DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data;
+ ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER));
+ SmmPasswordFunctionHeader->Function = Function;
+ if (DataPtr != NULL) {
+ *DataPtr = SmmPasswordFunctionHeader + 1;
+ }
+
+ return Buffer;
+}
+
+/**
+ Send the data in communicate buffer to SMM.
+
+ @param[in] Buffer Points to the data in the communicate buffer.
+ @param[in] DataSize The data size to send to SMM.
+
+ @retval EFI_SUCCESS Success is returned from the function in SMM.
+ @retval Others Failure is returned from the function in SMM.
+
+**/
+EFI_STATUS
+SendCommunicateBuffer (
+ IN VOID *Buffer,
+ IN UINTN DataSize
+ )
+{
+ EFI_STATUS Status;
+ UINTN CommSize;
+ EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
+
+ CommSize = DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ Status = mSmmCommunication->Communicate (mSmmCommunication, Buffer, &CommSize);
+ ASSERT_EFI_ERROR (Status);
+
+ SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
+ SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data;
+ return SmmPasswordFunctionHeader->ReturnStatus;
+}
+
+/**
+ Validate if the password is correct.
+
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval EFI_SUCCESS The password is correct.
+ @retval EFI_SECURITY_VIOLATION The password is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+**/
+EFI_STATUS
+VerifyPassword (
+ IN CHAR16 *Password,
+ IN UINTN PasswordSize
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD *VerifyPassword;
+
+ ASSERT (Password != NULL);
+
+ if (PasswordSize > sizeof(VerifyPassword->Password) * sizeof(CHAR16)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Buffer = InitCommunicateBuffer (
+ (VOID**)&VerifyPassword,
+ sizeof(*VerifyPassword),
+ SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = UnicodeStrToAsciiStrS (Password, VerifyPassword->Password, sizeof(VerifyPassword->Password));
+ if (EFI_ERROR(Status)) {
+ goto EXIT;
+ }
+
+ Status = SendCommunicateBuffer (Buffer, sizeof(*VerifyPassword));
+
+EXIT:
+ ZeroMem (VerifyPassword, sizeof(*VerifyPassword));
+ return Status;
+}
+
+/**
+ Set a new password.
+
+ @param[in] NewPassword The user input new password.
+ NULL means clear password.
+ @param[in] NewPasswordSize The size of NewPassword in byte.
+ @param[in] OldPassword The user input old password.
+ NULL means no old password.
+ @param[in] OldPasswordSize The size of OldPassword in byte.
+
+ @retval EFI_SUCCESS The NewPassword is set successfully.
+ @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+ @retval EFI_UNSUPPORTED NewPassword is not strong enough.
+ @retval EFI_ALREADY_STARTED NewPassword is in history.
+**/
+EFI_STATUS
+SetPassword (
+ IN CHAR16 *NewPassword, OPTIONAL
+ IN UINTN NewPasswordSize,
+ IN CHAR16 *OldPassword, OPTIONAL
+ IN UINTN OldPasswordSize
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_SET_PASSWORD *SetPassword;
+
+ if (NewPasswordSize > sizeof(SetPassword->NewPassword) * sizeof(CHAR16)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ if (OldPasswordSize > sizeof(SetPassword->OldPassword) * sizeof(CHAR16)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Buffer = InitCommunicateBuffer (
+ (VOID**)&SetPassword,
+ sizeof(*SetPassword),
+ SMM_PASSWORD_FUNCTION_SET_PASSWORD
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (NewPassword != NULL) {
+ Status = UnicodeStrToAsciiStrS (NewPassword, SetPassword->NewPassword, sizeof(SetPassword->NewPassword));
+ if (EFI_ERROR(Status)) {
+ goto EXIT;
+ }
+ } else {
+ SetPassword->NewPassword[0] = 0;
+ }
+
+ if (OldPassword != NULL) {
+ Status = UnicodeStrToAsciiStrS (OldPassword, SetPassword->OldPassword, sizeof(SetPassword->OldPassword));
+ if (EFI_ERROR(Status)) {
+ goto EXIT;
+ }
+ } else {
+ SetPassword->OldPassword[0] = 0;
+ }
+
+ Status = SendCommunicateBuffer (Buffer, sizeof(*SetPassword));
+
+EXIT:
+ ZeroMem (SetPassword, sizeof(*SetPassword));
+ return Status;
+}
+
+/**
+ Return if the password is set.
+
+ @retval TRUE The password is set.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+IsPasswordInstalled (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+
+ Buffer = InitCommunicateBuffer (
+ NULL,
+ 0,
+ SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET
+ );
+ if (Buffer == NULL) {
+ return FALSE;
+ }
+
+ Status = SendCommunicateBuffer (Buffer, 0);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
+ Get password verification policy.
+
+ @param[out] VerifyPolicy Verification policy.
+
+ @retval EFI_SUCCESS Get verification policy successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verification policy.
+**/
+EFI_STATUS
+GetPasswordVerificationPolicy (
+ OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *GetVerifyPolicy;
+
+ Buffer = InitCommunicateBuffer (
+ (VOID**)&GetVerifyPolicy,
+ sizeof(*GetVerifyPolicy),
+ SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = SendCommunicateBuffer (Buffer, sizeof(*GetVerifyPolicy));
+ if (!EFI_ERROR (Status)) {
+ CopyMem (VerifyPolicy, GetVerifyPolicy, sizeof (SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY));
+ }
+
+ return Status;
+}
+
+/**
+ Return if the password was verified.
+
+ @retval TRUE The password was verified.
+ @retval FALSE The password was not verified.
+**/
+BOOLEAN
+WasPasswordVerified (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+
+ Buffer = InitCommunicateBuffer (
+ NULL,
+ 0,
+ SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED
+ );
+ if (Buffer == NULL) {
+ return FALSE;
+ }
+
+ Status = SendCommunicateBuffer (Buffer, 0);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.c
new file mode 100644
index 0000000000..07e834ebfa
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.c
@@ -0,0 +1,674 @@
+/** @file
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UserAuthenticationSmm.h"
+
+EFI_SMM_VARIABLE_PROTOCOL *mSmmVariable;
+
+UINTN mAdminPasswordTryCount = 0;
+
+BOOLEAN mNeedReVerify = TRUE;
+BOOLEAN mPasswordVerified = FALSE;
+
+/**
+ Verify if the password is correct.
+
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+ @param[in] UserPasswordVarStruct The storage of password in variable.
+
+ @retval EFI_SUCCESS The password is correct.
+ @retval EFI_SECURITY_VIOLATION The password is incorrect.
+**/
+EFI_STATUS
+VerifyPassword (
+ IN CHAR8 *Password,
+ IN UINTN PasswordSize,
+ IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
+ )
+{
+ BOOLEAN HashOk;
+ UINT8 HashData[PASSWORD_HASH_SIZE];
+
+ HashOk = KeyLibGeneratePBKDF2Hash (
+ HASH_TYPE_SHA256,
+ (UINT8 *)Password,
+ PasswordSize,
+ UserPasswordVarStruct->PasswordSalt,
+ sizeof(UserPasswordVarStruct->PasswordSalt),
+ HashData,
+ sizeof(HashData)
+ );
+ if (!HashOk) {
+ return EFI_DEVICE_ERROR;
+ }
+ if (KeyLibSlowCompareMem (UserPasswordVarStruct->PasswordHash, HashData, PASSWORD_HASH_SIZE) == 0) {
+ return EFI_SUCCESS;
+ } else {
+ return EFI_SECURITY_VIOLATION;
+ }
+}
+
+/**
+ Get hash data of password from non-volatile variable region.
+
+ @param[in] UserGuid The user GUID of the password variable.
+ @param[in] Index The index of the password.
+ 0 means current password.
+ Non-0 means the password history.
+ @param[out] UserPasswordVarStruct The storage of password in variable.
+
+ @retval EFI_SUCCESS The password hash is returned successfully.
+ @retval EFI_NOT_FOUND The password hash is not found.
+**/
+EFI_STATUS
+GetPasswordHashFromVariable (
+ IN EFI_GUID *UserGuid,
+ IN UINTN Index,
+ OUT USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
+ )
+{
+ UINTN DataSize;
+ CHAR16 PasswordName[sizeof(USER_AUTHENTICATION_VAR_NAME)/sizeof(CHAR16) + 5];
+
+ if (Index != 0) {
+ UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s%04x", USER_AUTHENTICATION_VAR_NAME, Index);
+ } else {
+ UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s", USER_AUTHENTICATION_VAR_NAME);
+ }
+
+ DataSize = sizeof(*UserPasswordVarStruct);
+ return mSmmVariable->SmmGetVariable (
+ PasswordName,
+ UserGuid,
+ NULL,
+ &DataSize,
+ UserPasswordVarStruct
+ );
+}
+
+/**
+ Save password hash data to non-volatile variable region.
+
+ @param[in] UserGuid The user GUID of the password variable.
+ @param[in] UserPasswordVarStruct The storage of password in variable.
+
+ @retval EFI_SUCCESS The password hash is saved successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the password hash.
+**/
+EFI_STATUS
+SavePasswordHashToVariable (
+ IN EFI_GUID *UserGuid,
+ IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
+ )
+{
+ EFI_STATUS Status;
+
+ if (UserPasswordVarStruct == NULL) {
+ Status = mSmmVariable->SmmSetVariable (
+ USER_AUTHENTICATION_VAR_NAME,
+ UserGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ 0,
+ NULL
+ );
+ } else {
+ Status = mSmmVariable->SmmSetVariable (
+ USER_AUTHENTICATION_VAR_NAME,
+ UserGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof(*UserPasswordVarStruct),
+ UserPasswordVarStruct
+ );
+ }
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "SavePasswordHashToVariable fails with %r\n", Status));
+ }
+
+ return Status;
+}
+
+/**
+ Save old password hash data to non-volatile variable region as history.
+
+ The number of password history variable is limited.
+ If all the password history variables are used, the new password history
+ will override the oldest one.
+
+ @param[in] UserGuid The user GUID of the password variable.
+ @param[in] UserPasswordVarStruct The storage of password in variable.
+
+ @retval EFI_SUCCESS The password hash is saved successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the password hash.
+**/
+EFI_STATUS
+SaveOldPasswordToHistory (
+ IN EFI_GUID *UserGuid,
+ IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
+ )
+{
+ EFI_STATUS Status;
+ UINTN DataSize;
+ UINT32 LastIndex;
+ CHAR16 PasswordName[sizeof(USER_AUTHENTICATION_VAR_NAME)/sizeof(CHAR16) + 5];
+
+ DEBUG ((DEBUG_INFO, "SaveOldPasswordToHistory\n"));
+
+ DataSize = sizeof(LastIndex);
+ Status = mSmmVariable->SmmGetVariable (
+ USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME,
+ UserGuid,
+ NULL,
+ &DataSize,
+ &LastIndex
+ );
+ if (EFI_ERROR(Status)) {
+ LastIndex = 0;
+ }
+ if (LastIndex >= PASSWORD_HISTORY_CHECK_COUNT) {
+ LastIndex = 0;
+ }
+
+ LastIndex ++;
+ UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s%04x", USER_AUTHENTICATION_VAR_NAME, LastIndex);
+
+
+ Status = mSmmVariable->SmmSetVariable (
+ PasswordName,
+ UserGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof(*UserPasswordVarStruct),
+ UserPasswordVarStruct
+ );
+ DEBUG ((DEBUG_INFO, " -- to %s, %r\n", PasswordName, Status));
+ if (!EFI_ERROR(Status)) {
+ Status = mSmmVariable->SmmSetVariable (
+ USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME,
+ UserGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof(LastIndex),
+ &LastIndex
+ );
+ DEBUG ((DEBUG_INFO, " LastIndex - 0x%04x, %r\n", LastIndex, Status));
+ }
+
+ return Status;
+}
+
+/**
+ Calculate password hash data and save it to non-volatile variable region.
+
+ @param[in] UserGuid The user GUID of the password variable.
+ @param[in] Password The user input password.
+ NULL means delete the password variable.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval EFI_SUCCESS The password hash is calculated and saved.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the password hash.
+**/
+EFI_STATUS
+SavePasswordToVariable (
+ IN EFI_GUID *UserGuid,
+ IN CHAR8 *Password, OPTIONAL
+ IN UINTN PasswordSize
+ )
+{
+ EFI_STATUS Status;
+ USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
+ BOOLEAN HashOk;
+
+ //
+ // If password is NULL, it means we want to clean password field saved in variable region.
+ //
+ if (Password != NULL) {
+ KeyLibGenerateSalt (UserPasswordVarStruct.PasswordSalt, sizeof(UserPasswordVarStruct.PasswordSalt));
+ HashOk = KeyLibGeneratePBKDF2Hash (
+ HASH_TYPE_SHA256,
+ (UINT8 *)Password,
+ PasswordSize,
+ UserPasswordVarStruct.PasswordSalt,
+ sizeof(UserPasswordVarStruct.PasswordSalt),
+ UserPasswordVarStruct.PasswordHash,
+ sizeof(UserPasswordVarStruct.PasswordHash)
+ );
+ if (!HashOk) {
+ return EFI_DEVICE_ERROR;
+ }
+ Status = SavePasswordHashToVariable (UserGuid, &UserPasswordVarStruct);
+ //
+ // Save Password data to history variable
+ //
+ if (!EFI_ERROR(Status)) {
+ SaveOldPasswordToHistory (UserGuid, &UserPasswordVarStruct);
+ }
+ } else {
+ Status = SavePasswordHashToVariable (UserGuid, NULL);
+ }
+
+ return Status;
+}
+
+/**
+ Verify the password.
+ If the password variable does not exist, it passes the verification.
+ If the password variable exists, it does verification based upon password variable.
+
+ @param[in] UserGuid The user GUID of the password variable.
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval TRUE The verification passes.
+ @retval FALSE The verification fails.
+**/
+BOOLEAN
+IsPasswordVerified (
+ IN EFI_GUID *UserGuid,
+ IN CHAR8 *Password,
+ IN UINTN PasswordSize
+ )
+{
+ USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
+ EFI_STATUS Status;
+ UINTN *PasswordTryCount;
+
+ PasswordTryCount = &mAdminPasswordTryCount;
+
+ Status = GetPasswordHashFromVariable (UserGuid, 0, &UserPasswordVarStruct);
+ if (EFI_ERROR(Status)) {
+ return TRUE;
+ }
+
+ //
+ // Old password exists
+ //
+ Status = VerifyPassword (Password, PasswordSize, &UserPasswordVarStruct);
+ if (EFI_ERROR(Status)) {
+ if (Password[0] != 0) {
+ *PasswordTryCount = *PasswordTryCount + 1;
+ }
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
+ Return if the password is set.
+
+ @param[in] UserGuid The user GUID of the password variable.
+
+ @retval TRUE The password is set.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+IsPasswordSet (
+ IN EFI_GUID *UserGuid
+ )
+{
+ USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
+ EFI_STATUS Status;
+
+ Status = GetPasswordHashFromVariable(UserGuid, 0, &UserPasswordVarStruct);
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ Return if the password is strong.
+ Criteria:
+ 1) length >= PASSWORD_MIN_SIZE
+ 2) include lower case, upper case, number, symbol.
+
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval TRUE The password is strong.
+ @retval FALSE The password is weak.
+**/
+BOOLEAN
+IsPasswordStrong (
+ IN CHAR8 *Password,
+ IN UINTN PasswordSize
+ )
+{
+ UINTN Index;
+ BOOLEAN HasLowerCase;
+ BOOLEAN HasUpperCase;
+ BOOLEAN HasNumber;
+ BOOLEAN HasSymbol;
+
+ if (PasswordSize < PASSWORD_MIN_SIZE) {
+ return FALSE;
+ }
+
+ HasLowerCase = FALSE;
+ HasUpperCase = FALSE;
+ HasNumber = FALSE;
+ HasSymbol = FALSE;
+ for (Index = 0; Index < PasswordSize - 1; Index++) {
+ if (Password[Index] >= 'a' && Password[Index] <= 'z') {
+ HasLowerCase = TRUE;
+ } else if (Password[Index] >= 'A' && Password[Index] <= 'Z') {
+ HasUpperCase = TRUE;
+ } else if (Password[Index] >= '0' && Password[Index] <= '9') {
+ HasNumber = TRUE;
+ } else {
+ HasSymbol = TRUE;
+ }
+ }
+ if ((!HasLowerCase) || (!HasUpperCase) || (!HasNumber) || (!HasSymbol)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ Return if the password is set before in PASSWORD_HISTORY_CHECK_COUNT.
+
+ @param[in] UserGuid The user GUID of the password variable.
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval TRUE The password is set before.
+ @retval FALSE The password is not set before.
+**/
+BOOLEAN
+IsPasswordInHistory (
+ IN EFI_GUID *UserGuid,
+ IN CHAR8 *Password,
+ IN UINTN PasswordSize
+ )
+{
+ EFI_STATUS Status;
+ USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
+ UINTN Index;
+
+ for (Index = 1; Index <= PASSWORD_HISTORY_CHECK_COUNT; Index++) {
+ Status = GetPasswordHashFromVariable (UserGuid, Index, &UserPasswordVarStruct);
+ if (!EFI_ERROR(Status)) {
+ Status = VerifyPassword (Password, PasswordSize, &UserPasswordVarStruct);
+ if (!EFI_ERROR(Status)) {
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+/**
+ Communication service SMI Handler entry.
+
+ This SMI handler provides services for password management.
+
+ @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
+SmmPasswordHandler (
+ IN EFI_HANDLE DispatchHandle,
+ IN CONST VOID *RegisterContext,
+ IN OUT VOID *CommBuffer,
+ IN OUT UINTN *CommBufferSize
+ )
+{
+ EFI_STATUS Status;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmFunctionHeader;
+ UINTN CommBufferPayloadSize;
+ UINTN TempCommBufferSize;
+ SMM_PASSWORD_COMMUNICATE_SET_PASSWORD SmmCommunicateSetPassword;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD SmmCommunicateVerifyPassword;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY SmmCommunicateSetVerifyPolicy;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *SmmCommunicateGetVerifyPolicy;
+ UINTN PasswordLen;
+ EFI_GUID *UserGuid;
+ UINTN *PasswordTryCount;
+
+ //
+ // If input is invalid, stop processing this SMI
+ //
+ if (CommBuffer == NULL || CommBufferSize == NULL) {
+ return EFI_SUCCESS;
+ }
+
+ TempCommBufferSize = *CommBufferSize;
+ PasswordLen = 0;
+
+ if (TempCommBufferSize < sizeof (SMM_PASSWORD_COMMUNICATE_HEADER)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SMM communication buffer size invalid!\n"));
+ return EFI_SUCCESS;
+ }
+
+ CommBufferPayloadSize = TempCommBufferSize - sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ Status = EFI_SUCCESS;
+ SmmFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)CommBuffer;
+
+ UserGuid = &gUserAuthenticationGuid;
+ PasswordTryCount = &mAdminPasswordTryCount;
+
+ switch (SmmFunctionHeader->Function) {
+ case SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET:
+ PasswordTryCount = NULL;
+ if (CommBufferPayloadSize != 0) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: IS_PASSWORD_SET payload buffer invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ if (IsPasswordSet(UserGuid)) {
+ Status = EFI_SUCCESS;
+ } else {
+ Status = EFI_NOT_FOUND;
+ }
+ break;
+ case SMM_PASSWORD_FUNCTION_SET_PASSWORD:
+ if (*PasswordTryCount >= PASSWORD_MAX_TRY_COUNT) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_PASSWORD try count reach!\n"));
+ PasswordTryCount = NULL;
+ Status = EFI_ACCESS_DENIED;
+ goto EXIT;
+ }
+ if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_SET_PASSWORD)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_PASSWORD payload buffer invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ CopyMem (&SmmCommunicateSetPassword, SmmFunctionHeader + 1, sizeof(SmmCommunicateSetPassword));
+
+ PasswordLen = AsciiStrnLenS(SmmCommunicateSetPassword.OldPassword, sizeof(SmmCommunicateSetPassword.OldPassword));
+ if (PasswordLen == sizeof(SmmCommunicateSetPassword.OldPassword)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: OldPassword invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+
+ if (!IsPasswordVerified (UserGuid, SmmCommunicateSetPassword.OldPassword, PasswordLen + 1)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: PasswordVerify - FAIL\n"));
+ Status = EFI_SECURITY_VIOLATION;
+ goto EXIT;
+ }
+
+ PasswordLen = AsciiStrnLenS(SmmCommunicateSetPassword.NewPassword, sizeof(SmmCommunicateSetPassword.NewPassword));
+ if (PasswordLen == sizeof(SmmCommunicateSetPassword.NewPassword)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ if (PasswordLen != 0 && !IsPasswordStrong (SmmCommunicateSetPassword.NewPassword, PasswordLen + 1)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword too weak!\n"));
+ Status = EFI_UNSUPPORTED;
+ goto EXIT;
+ }
+ if (PasswordLen != 0 && IsPasswordInHistory (UserGuid, SmmCommunicateSetPassword.NewPassword, PasswordLen + 1)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword in history!\n"));
+ Status = EFI_ALREADY_STARTED;
+ goto EXIT;
+ }
+
+ if (PasswordLen == 0) {
+ Status = SavePasswordToVariable (UserGuid, NULL, 0);
+ } else {
+ Status = SavePasswordToVariable (UserGuid, SmmCommunicateSetPassword.NewPassword, PasswordLen + 1);
+ }
+ break;
+
+ case SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD:
+ if (*PasswordTryCount >= PASSWORD_MAX_TRY_COUNT) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: VERIFY_PASSWORD try count reach!\n"));
+ PasswordTryCount = NULL;
+ Status = EFI_ACCESS_DENIED;
+ goto EXIT;
+ }
+ if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: VERIFY_PASSWORD payload buffer invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ CopyMem (&SmmCommunicateVerifyPassword, SmmFunctionHeader + 1, sizeof(SmmCommunicateVerifyPassword));
+
+ PasswordLen = AsciiStrnLenS(SmmCommunicateVerifyPassword.Password, sizeof(SmmCommunicateVerifyPassword.Password));
+ if (PasswordLen == sizeof(SmmCommunicateVerifyPassword.Password)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: Password invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ if (!IsPasswordVerified (UserGuid, SmmCommunicateVerifyPassword.Password, PasswordLen + 1)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: PasswordVerify - FAIL\n"));
+ Status = EFI_SECURITY_VIOLATION;
+ goto EXIT;
+ }
+ mPasswordVerified = TRUE;
+ Status = EFI_SUCCESS;
+ break;
+
+ case SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY:
+ PasswordTryCount = NULL;
+ if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_VERIFY_POLICY payload buffer invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ CopyMem (&SmmCommunicateSetVerifyPolicy, SmmFunctionHeader + 1, sizeof(SmmCommunicateSetVerifyPolicy));
+ mNeedReVerify = SmmCommunicateSetVerifyPolicy.NeedReVerify;
+ break;
+
+ case SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY:
+ PasswordTryCount = NULL;
+ if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: GET_VERIFY_POLICY payload buffer invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ SmmCommunicateGetVerifyPolicy = (SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *) (SmmFunctionHeader + 1);
+ SmmCommunicateGetVerifyPolicy->NeedReVerify = mNeedReVerify;
+ break;
+ case SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED:
+ PasswordTryCount = NULL;
+ if (CommBufferPayloadSize != 0) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: WAS_PASSWORD_VERIFIED payload buffer invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ if (mPasswordVerified) {
+ Status = EFI_SUCCESS;
+ } else {
+ Status = EFI_NOT_STARTED;
+ }
+ break;
+
+ default:
+ PasswordTryCount = NULL;
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+
+EXIT:
+ if (PasswordTryCount != NULL) {
+ if (Status == EFI_SUCCESS) {
+ *PasswordTryCount = 0;
+ }
+ }
+ SmmFunctionHeader->ReturnStatus = Status;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Main entry for this driver.
+
+ @param ImageHandle Image handle this driver.
+ @param SystemTable Pointer to SystemTable.
+
+ @retval EFI_SUCESS This function always complete successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+PasswordSmmInit (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE SmmHandle;
+ EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;
+ CHAR16 PasswordHistoryName[sizeof(USER_AUTHENTICATION_VAR_NAME)/sizeof(CHAR16) + 5];
+ UINTN Index;
+
+ ASSERT (PASSWORD_HASH_SIZE == SHA256_DIGEST_SIZE);
+ ASSERT (PASSWORD_HISTORY_CHECK_COUNT < 0xFFFF);
+
+ Status = gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID**)&mSmmVariable);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Make password variables read-only for DXE driver for security concern.
+ //
+ Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);
+ if (!EFI_ERROR (Status)) {
+ Status = VariableLock->RequestToLock (VariableLock, USER_AUTHENTICATION_VAR_NAME, &gUserAuthenticationGuid);
+ ASSERT_EFI_ERROR (Status);
+
+ for (Index = 1; Index <= PASSWORD_HISTORY_CHECK_COUNT; Index++) {
+ UnicodeSPrint (PasswordHistoryName, sizeof (PasswordHistoryName), L"%s%04x", USER_AUTHENTICATION_VAR_NAME, Index);
+ Status = VariableLock->RequestToLock (VariableLock, PasswordHistoryName, &gUserAuthenticationGuid);
+ ASSERT_EFI_ERROR (Status);
+ }
+ Status = VariableLock->RequestToLock (VariableLock, USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME, &gUserAuthenticationGuid);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ SmmHandle = NULL;
+ Status = gSmst->SmiHandlerRegister (SmmPasswordHandler, &gUserAuthenticationGuid, &SmmHandle);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (IsPasswordCleared()) {
+ DEBUG ((DEBUG_INFO, "IsPasswordCleared\n"));
+ SavePasswordToVariable (&gUserAuthenticationGuid, NULL, 0);
+ }
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni
new file mode 100644
index 0000000000..b0255889e0
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni
@@ -0,0 +1,19 @@
+// /** @file
+// NULL platform password library instance that returns the password clear state based upon PCD.
+//
+// NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared
+// but returns the PCD value directly. This instance can be used to verify security
+// related features during platform enabling and development. It should be replaced
+// by a platform-specific method(e.g. Button pressed) in a real platform for product.
+//
+// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "NULL platform password library instance that returns the password clear state based upon PCD."
+
+#string STR_MODULE_DESCRIPTION #language en-US "NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared but returns the PCD value directly. This instance can be used to verify security related features during platform enabling and development. It should be replaced by a platform-specific method(e.g. Button pressed) in a real platform for product."
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md b/Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md
new file mode 100644
index 0000000000..d2c492710e
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md
@@ -0,0 +1,86 @@
+# Overview
+* **Feature Name:** User Authentication
+* **PI Phase(s) Supported:** DXE
+* **SMM Required?** Yes
+
+## Purpose
+*_TODO_*
+Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph.
+
+# High-Level Theory of Operation
+*_TODO_*
+A description of how the device works at a high-level.
+
+The description should not be constrained to implementation details but provide a simple mental model of how the
+feature is supposed to work.
+
+## Firmware Volumes
+*_TODO_*
+A bulleted list of the firmware volumes that feature module(s) are placed in.
+
+## Modules
+*_TODO_*
+A bulleted list of the modules that make up the feature.
+
+## <Module Name>
+*_TODO_*
+Each module in the feature should have a section that describes the module in a level of detail that is useful
+to better understand the module source code.
+
+## <Library Name>
+*_TODO_*
+Each library in the feature should have a section that describes the library in a level of detail that is useful
+to better understand the library source code.
+
+## Key Functions
+*_TODO_*
+A bulleted list of key functions for interacting with the feature.
+
+Not all features need to be listed. Only functions exposed through external interfaces that are important for feature
+users to be aware of.
+
+## Configuration
+*_TODO_*
+Information that is useful for configuring the feature.
+
+Not all configuration options need to be listed. This section is used to provide more background on configuration
+options than possible elsewhere.
+
+## Data Flows
+*_TODO_*
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+*_TODO_*
+Key control flows for the feature.
+
+## Build Flows
+*_TODO_*
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or require non-standard tool configuration. If the
+standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+*_TODO_*
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the feature is successful. If the test point is not
+implemented, this should be stated.
+
+## Functional Exit Criteria
+*_TODO_*
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board integrator can reference to ensure the feature is
+functional on their board.
+
+## Feature Enabling Checklist
+*_TODO_*
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+*_TODO_*
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeStrings.uni b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeStrings.uni
new file mode 100644
index 0000000000..1e3a179677
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeStrings.uni
@@ -0,0 +1,30 @@
+/** @file
+// String definitions for User Authentication formset.
+//
+// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+**/
+
+#langdef en-US "English"
+#langdef fr-FR "Francais"
+
+
+#string STR_FORM_SET_TITLE #language en-US "User Password Management"
+ #language fr-FR "User Password Management"
+#string STR_FORM_SET_TITLE_HELP #language en-US "This Driver mainly handle user's password"
+ #language fr-FR "This Driver mainly handle user's password"
+#string STR_FORM_TITLE #language en-US "Password Management Form"
+ #language fr-FR "Password Management Form"
+#string STR_ADMIN_PASSWORD_PROMPT #language en-US "Change Admin Password"
+ #language fr-FR "Change Admin Password"
+#string STR_ADMIN_PASSWORD_HELP #language en-US "Input old admin password if it was set, then you can change the password to a new one. After the change action, you may need input the new password when you enter UI. The new password must be between 8 and 32 chars include lowercase, uppercase alphabetic, number, and symbol. Input an empty password can clean old admin password, then no need input password to enter UI."
+ #language fr-FR "Input old admin password if it was set, then you can change the password to a new one. After the change action, you may need input the new password when you enter UI. The new password must be between 8 and 32 chars include lowercase, uppercase alphabetic, number, and symbol. Input an empty password can clean old admin password, then no need input password to enter UI."
+#string STR_ADMIN_PASSWORD_STS_HELP #language en-US "Current Admin Password status: Installed or Not Installed."
+ #language fr-FR "Current Admin Password status: Installed or Not Installed."
+#string STR_ADMIN_PASSWORD_STS_PROMPT #language en-US "Admin Password Status"
+ #language fr-FR "Admin Password Status"
+#string STR_ADMIN_PASSWORD_STS_CONTENT #language en-US ""
+ #language fr-FR ""
+
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 28/49] Features/Intel/NetworkFeaturePkg: Add initial package
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (25 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 27/49] Features/Intel/UserAuthFeaturePkg: Add initial package Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 29/49] AdvancedFeaturePkg: Remove remaining contents Kubacki, Michael A
` (20 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Adds a new feature package for the Network feature.
The Network feature code is actually in edk2/NetworkPkg at this
time so this package inclues the content from edk2/NetworkPkg. In
the future, it is preferred to move the source code from
NetworkPkg to NetworkFeaturePkg.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec | 30 ++++
Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc | 152 ++++++++++++++++++++
Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc | 30 ++++
Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf | 10 ++
Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf | 8 ++
Features/Intel/Network/NetworkFeaturePkg/Readme.md | 89 ++++++++++++
6 files changed, 319 insertions(+)
diff --git a/Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec b/Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec
new file mode 100644
index 0000000000..670b76e52f
--- /dev/null
+++ b/Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for Network support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = NetworkFeaturePkg
+ PACKAGE_GUID = CA1BF91C-8B5E-40C2-9C4C-DD250D2170A9
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[LibraryClasses]
+
+[Guids]
+ gNetworkFeaturePkgTokenSpaceGuid = {0x990904ed, 0xb62a, 0x4b46, {0xa2, 0x9d, 0xe4, 0x09, 0xa6, 0x7f, 0x54, 0x68}}
+
+[PcdsFeatureFlag]
+ gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable|FALSE|BOOLEAN|0xA0000001
diff --git a/Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc b/Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc
new file mode 100644
index 0000000000..c59c21ee6c
--- /dev/null
+++ b/Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc
@@ -0,0 +1,152 @@
+## @file
+# This is a build description file for the Network advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
+
+ !include NetworkPkg/NetworkDefines.dsc.inc
+
+################################################################################
+#
+# PCD Section - list of EDK II PCD Entries modified by the feature.
+#
+################################################################################
+[PcdsFixedAtBuild]
+ !include NetworkPkg/NetworkPcds.dsc.inc
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+################################################################################
+[LibraryClasses]
+ !include NetworkPkg/NetworkLibs.dsc.inc
+
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+ HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+ IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+ OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+ PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
+ SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
+ TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
+ UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+
+[LibraryClasses.common.SEC,LibraryClasses.common.PEI_CORE,LibraryClasses.common.PEIM]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+
+[LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE,LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRIVER,LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+ DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+
+################################################################################
+#
+# Component section - list of all components that need built for this feature.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+################################################################################
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # Network Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
+ #####################################
+ # Network Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+ !include NetworkPkg/NetworkComponents.dsc.inc
+
+###################################################################################################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
+###################################################################################################
+[BuildOptions]
diff --git a/Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc b/Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc
new file mode 100644
index 0000000000..199686fa09
--- /dev/null
+++ b/Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for Network support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ PLATFORM_NAME = NetworkFeaturePkg
+ PLATFORM_GUID = 63D1D82C-965C-44A7-B90D-C8AA42E59152
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#
+# This package always builds the feature.
+#
+!include Include/NetworkFeature.dsc
diff --git a/Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf b/Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..819b839d60
--- /dev/null
+++ b/Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,10 @@
+## @file
+# FDF file for post-memory Network advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+!include NetworkPkg/Network.fdf.inc
diff --git a/Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf b/Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..25f17be40f
--- /dev/null
+++ b/Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory Network advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/Network/NetworkFeaturePkg/Readme.md b/Features/Intel/Network/NetworkFeaturePkg/Readme.md
new file mode 100644
index 0000000000..4ad5e2a3a3
--- /dev/null
+++ b/Features/Intel/Network/NetworkFeaturePkg/Readme.md
@@ -0,0 +1,89 @@
+# Overview
+* **Feature Name:** Network
+* **PI Phase(s) Supported:** DXE
+* **SMM Required?** No
+
+_Note:_ Network feature support is currently provided by including files exposed by NetworkPkg. In the future,
+it is preferable to relocate the source code in NetworkPkg to NetworkFeaturePkg.
+
+## Purpose
+*_TODO_*
+Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph.
+
+# High-Level Theory of Operation
+*_TODO_*
+A description of how the device works at a high-level.
+
+The description should not be constrained to implementation details but provide a simple mental model of how the
+feature is supposed to work.
+
+## Firmware Volumes
+*_TODO_*
+A bulleted list of the firmware volumes that feature module(s) are placed in.
+
+## Modules
+*_TODO_*
+A bulleted list of the modules that make up the feature.
+
+## <Module Name>
+*_TODO_*
+Each module in the feature should have a section that describes the module in a level of detail that is useful
+to better understand the module source code.
+
+## <Library Name>
+*_TODO_*
+Each library in the feature should have a section that describes the library in a level of detail that is useful
+to better understand the library source code.
+
+## Key Functions
+*_TODO_*
+A bulleted list of key functions for interacting with the feature.
+
+Not all features need to be listed. Only functions exposed through external interfaces that are important for feature
+users to be aware of.
+
+## Configuration
+*_TODO_*
+Information that is useful for configuring the feature.
+
+Not all configuration options need to be listed. This section is used to provide more background on configuration
+options than possible elsewhere.
+
+## Data Flows
+*_TODO_*
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+*_TODO_*
+Key control flows for the feature.
+
+## Build Flows
+*_TODO_*
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or require non-standard tool configuration. If the
+standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+*_TODO_*
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the feature is successful. If the test point is not
+implemented, this should be stated.
+
+## Functional Exit Criteria
+*_TODO_*
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board integrator can reference to ensure the feature is
+functional on their board.
+
+## Feature Enabling Checklist
+*_TODO_*
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+*_TODO_*
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 29/49] AdvancedFeaturePkg: Remove remaining contents
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (26 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 28/49] Features/Intel/NetworkFeaturePkg: " Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 30/49] AdvancedFeaturePkg: Move to Features/Intel Kubacki, Michael A
` (19 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
This change removes the remaining files in AdvancedFeaturePkg that
are no longer part of the Minimum Platform Advanced Feature design.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 4 --
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 56 --------------------
Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc | 15 ------
Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.dsc | 9 ----
Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf | 14 -----
Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf | 8 ---
Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf | 9 ----
7 files changed, 115 deletions(-)
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
index 6cd333d498..7342539198 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
@@ -11,15 +11,12 @@
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
-
-
[Defines]
DEC_SPECIFICATION = 0x00010017
PACKAGE_NAME = AdvancedFeaturePkg
PACKAGE_VERSION = 0.1
PACKAGE_GUID = 290127D9-ABED-4DD8-A35D-73DCB4261BCB
-
[Includes]
Include
@@ -27,4 +24,3 @@ Include
gAdvancedFeaturePkgTokenSpaceGuid = {0xa8514688, 0x6693, 0x4ab5, {0xaa, 0xc8, 0xcc, 0xa9, 0x8d, 0xde, 0x90, 0xe1}}
[PcdsFeatureFlag]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdNetworkEnable |FALSE|BOOLEAN|0xF00000A1
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index 4b8ccf3375..38298e15e4 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -21,59 +21,3 @@
SUPPORTED_ARCHITECTURES = IA32|X64
BUILD_TARGETS = DEBUG|RELEASE
SKUID_IDENTIFIER = DEFAULT
-
-################################################################################
-#
-# SKU Identification section - list of all SKU IDs supported.
-#
-################################################################################
-[SkuIds]
- 0|DEFAULT # The entry: 0|DEFAULT is reserved and always required.
-
-################################################################################
-#
-# Pcd Section - list of all EDK II PCD Entries defined by this package.
-#
-################################################################################
-
-[PcdsFeatureFlag]
-
-################################################################################
-#
-# Library Class section - list of all Library Classes needed by this package.
-#
-################################################################################
-
-[LibraryClasses.common]
-
-###################################################################################################
-#
-# Components Section - list of the modules and components that will be processed by compilation
-# tools and the EDK II tools to generate PE32/PE32+/Coff image files.
-#
-# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
-# into firmware volume images. This section is just a list of modules to compile from
-# source into UEFI-compliant binaries.
-# It is the FDF file that contains information on combining binary files into firmware
-# volume images, whose concept is beyond UEFI and is described in PI specification.
-# Binary modules do not need to be listed in this section, as they should be
-# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi),
-# Logo (Logo.bmp), and etc.
-# There may also be modules listed in this section that are not required in the FDF file,
-# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
-# generated for it, but the binary will not be put into any firmware volume.
-#
-###################################################################################################
-
-[Components]
- #######################################
- # Advanced Feature Package
- #######################################
-
- # Add library instances here that are not included in package components and should be tested
- # in the package build.
-
- # Add components here that should be included in the package build.
-
-[BuildOptions]
- *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc b/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
deleted file mode 100644
index b74c0ef2bc..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
+++ /dev/null
@@ -1,15 +0,0 @@
-## @file
-# Platform description.
-#
-# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-
- #
- # UEFI network modules
- #
- !include NetworkPkg/NetworkComponents.dsc.inc
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.dsc b/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.dsc
deleted file mode 100644
index 86b1ebfed0..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.dsc
+++ /dev/null
@@ -1,9 +0,0 @@
-## @file
-# Platform description.
-#
-# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
deleted file mode 100644
index a86ecdc9d1..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
+++ /dev/null
@@ -1,14 +0,0 @@
-## @file
-# FDF file of Platform.
-#
-# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-
-#
-# UEFI network modules
-#
-!include NetworkPkg/Network.fdf.inc
diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf
deleted file mode 100644
index 3c2716d672..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf
+++ /dev/null
@@ -1,8 +0,0 @@
-## @file
-# FDF file of Platform.
-#
-# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf
deleted file mode 100644
index 5b21f781a7..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf
+++ /dev/null
@@ -1,9 +0,0 @@
-## @file
-# FDF file of Platform.
-#
-# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 30/49] AdvancedFeaturePkg: Move to Features/Intel
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (27 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 29/49] AdvancedFeaturePkg: Remove remaining contents Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 31/49] AdvancedFeaturePkg: Add feature build support Kubacki, Michael A
` (18 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
This change moves AdvancedFeaturePkg to the Features/Intel
directory. AdvancedFeaturePkg will be the only package that is
located at the root level of Features/Intel.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
{Platform => Features}/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 0
{Platform => Features}/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 0
2 files changed, 0 insertions(+), 0 deletions(-)
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
similarity index 100%
rename from Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
rename to Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
similarity index 100%
rename from Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
rename to Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 31/49] AdvancedFeaturePkg: Add feature build support
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (28 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 30/49] AdvancedFeaturePkg: Move to Features/Intel Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 32/49] AdvancedFeaturePkg: Add temporary build workaround Kubacki, Michael A
` (17 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
This change adds the ability to build all currently available
advanced features using the AdvancedFeaturePkg build. To build
all advanced features, follow the instructions in the
Feature/Intel/Readme.md file. The actual build is performed by
executing the following command in the Features/Intel directory:
"build -p AdvancedFeaturePkg/AdvancedFeaturePkg.dsc -a IA32 -a X64"
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 9 +++-
Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 28 ++++++++++
Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc | 56 ++++++++++++++++++++
3 files changed, 91 insertions(+), 2 deletions(-)
diff --git a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
index 7342539198..36c72b98e1 100644
--- a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
+++ b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
@@ -1,6 +1,11 @@
## @file
-# This package provides the modules that build for a full feature platform.
-# This AdvancedFeaturePkg should only depend on EDKII Core packages and MinPlatformPkg.
+# Advanced Feature Package build declaration file.
+#
+# Advanced features allow a board package to be extended with advanced functionality.
+#
+# This package should not contain any specific advanced features. The package has two responsibilities:
+# 1. Present a consolidated and simplified view of all available advanced features to board packages.
+# 2. Provide a simple, single package build for all available advanced features.
#
# The DEC files are used by the utilities that parse DSC and
# INF files to generate AutoGen.c and AutoGen.h files
diff --git a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index 38298e15e4..50c0e81048 100644
--- a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -1,6 +1,12 @@
## @file
# Advanced Feature Package build description file.
#
+# Advanced features allow a board package to be extended with advanced functionality.
+#
+# This package should not contain any specific advanced features. The package has two responsibilities:
+# 1. Present a consolidated and simplified view of all available advanced features to board packages.
+# 2. Provide a simple, single package build for all available advanced features.
+#
# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -21,3 +27,25 @@
SUPPORTED_ARCHITECTURES = IA32|X64
BUILD_TARGETS = DEBUG|RELEASE
SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+################################################################################
+#
+# Advanced Feature Enable section - all advanced features are enabling for the
+# AdvancedFeaturePkg build.
+#
+################################################################################
+[PcdsFeatureFlag]
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable |TRUE
+ gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable |TRUE
+ gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable |TRUE
+ gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable |TRUE
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable |TRUE
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable |TRUE
+ gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable |TRUE
+
+#
+# This package builds all advanced features.
+#
+!include Include/AdvancedFeatures.dsc
diff --git a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
new file mode 100644
index 0000000000..649774edf7
--- /dev/null
+++ b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
@@ -0,0 +1,56 @@
+## @file
+# DSC file for advanced features.
+#
+# This file is intended to be included into another package so advanced features
+# can be conditionally built by enabling the respective feature via its FeaturePCD.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+#
+# Debug Advanced Features
+#
+!if gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable == TRUE
+ !include Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeature.dsc
+!endif
+!if gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable == TRUE
+ !include Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc
+!endif
+
+#
+# Network Advanced Features
+#
+!if gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable == TRUE
+ !include Network/NetworkFeaturePkg/Include/NetworkFeature.dsc
+!endif
+
+#
+# Out-of-Band Management Advanced Features
+#
+!if gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable == TRUE
+ !include OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
+!endif
+
+#
+# Power Management Advanced Features
+#
+!if gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable == TRUE
+ !include PowerManagement/S3FeaturePkg/Include/S3Feature.dsc
+!endif
+
+#
+# System Information Advanced Features
+#
+!if gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable == TRUE
+ !include SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc
+!endif
+
+#
+# User Interface Advanced Features
+#
+!if gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable == TRUE
+ !include UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc
+!endif
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 32/49] AdvancedFeaturePkg: Add temporary build workaround
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (29 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 31/49] AdvancedFeaturePkg: Add feature build support Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 33/49] AdvancedFeaturePkg: Add FDF include files Kubacki, Michael A
` (16 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
This change adds a temporary build workaround to allow the advanced
feature PCDs to be used in conditional statements in DSC files even
if they are not referenced in INF files.
Support to allow a FeaturePCD to be used in a conditional statement
without being referenced in an INF file has been requested in the
following Bugzilla item:
https://bugzilla.tianocore.org/show_bug.cgi?id=2270
This change can be reverted when that Bugzilla is completed and the
change is submitted to edk2.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 2 +
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc | 74 ++++++++++++++++++++
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.inf | 57 +++++++++++++++
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c | 31 ++++++++
4 files changed, 164 insertions(+)
diff --git a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index 50c0e81048..23e7c6474a 100644
--- a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -30,6 +30,8 @@
PEI_ARCH = IA32
DXE_ARCH = X64
+!include AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc
+
################################################################################
#
# Advanced Feature Enable section - all advanced features are enabling for the
diff --git a/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc b/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc
new file mode 100644
index 0000000000..227ae00908
--- /dev/null
+++ b/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc
@@ -0,0 +1,74 @@
+## @file
+# Build description file for a temporary build workaround.
+#
+# The feature enable PCD for advanced features must be referenced in an INF
+# to be referenced in DSC/FDF files. This DSC only exists in the build to
+# allow the PCDs to be referenced. This workaround does not affect the final
+# flash image or boot in any way.
+#
+# The request to update BaseTools to allow a PCD to be referenced in DSC/FDF
+# files without requiring the PCD to be referenced in an INF file is tracked
+# here: https://bugzilla.tianocore.org/show_bug.cgi?id=2270
+#
+# When the BaseTools update is complete, this file can entirely be removed
+# from this package.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+#
+# BEGIN:Temporary Build Workaround (resolution: https://bugzilla.tianocore.org/show_bug.cgi?id=2270)
+#
+
+# THIS FILE IS TEMPORARY. PLEASE TRY TO LOOK PAST THE "HACKS" ASSOCIATED WITH IT.
+#
+# With the BaseTools change requested, the changes needed to move to the end state are simply:
+# 1. Remove the !include for this file in AdvancedFeatures.dsc
+# 2. Remove this directory
+
+!if $(PLATFORM_NAME) != AdvancedFeaturePkg
+#
+# AdvancedFeaturePkg initializes all FeaturePCDs to TRUE so they can conveniently be built in one package.
+# Board packages will normally only enable (and therefore reference) a small subset of advanced features
+# relative to the board. If an INF does not reference a package DEC file (which will be the case if the
+# feature is not enabled) then the DSC must set ("define") the PCD for the conditional statements based
+# on the PCD to work.
+#
+# AdvancedFeaturePkg has no problem as it naturally has a need to set al PCDs to TRUE for build.
+# The section below sets all PCDs to FALSE in the DSC file so if the feature is not enabled by a board,
+# the build will still be successful.
+#
+[PcdsFeatureFlag]
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable |FALSE
+ gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable |FALSE
+ gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable |FALSE
+ gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable |FALSE
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable |FALSE
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable |FALSE
+ gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable |FALSE
+!endif
+
+#
+# The LibraryClasses required to build TemporaryBuildWorkaround.inf
+# (mostly libraries requiring other libraries)
+#
+[LibraryClasses]
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
+ PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+ PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
+
+#
+# The driver that references all feature PCDs to satsify current build limitations
+#
+[Components]
+ AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.inf
+#
+# END:Temporary Build Workaround (resolution: https://bugzilla.tianocore.org/show_bug.cgi?id=2270)
+#
diff --git a/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.inf b/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.inf
new file mode 100644
index 0000000000..74176d1989
--- /dev/null
+++ b/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.inf
@@ -0,0 +1,57 @@
+### @file
+# Component information file for a temporary build workaround.
+#
+# The feature enable PCD for this package must be referenced in an INF to be
+# referenced in DSC/FDF files. This driver is only included in the build to
+# allow the PCD to be referenced. This driver is not included in the flash
+# image and does not affect the boot in any way.
+#
+# The request to update BaseTools to allow a PCD to be referenced in DSC/FDF
+# files without requiring the PCD to be referenced in an INF file is tracked
+# here: https://bugzilla.tianocore.org/show_bug.cgi?id=2270
+#
+# When the BaseTools update is complete, this file can entirely be removed
+# from this package.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010017
+ BASE_NAME = TemporaryBuildWorkaround
+ FILE_GUID = 8846A81E-F552-4917-81F5-80B62E4EFBAC
+ VERSION_STRING = 1.0
+ MODULE_TYPE = PEIM
+ ENTRY_POINT = TemporaryBuildWorkaroundEntry
+
+[LibraryClasses]
+ BaseLib
+ PeimEntryPoint
+
+[Packages]
+ MdePkg/MdePkg.dec
+ Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
+ Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
+ Network/NetworkFeaturePkg/NetworkFeaturePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+ PowerManagement/S3FeaturePkg/S3FeaturePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[FeaturePcd]
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable
+ gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable
+ gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable
+ gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable
+ gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable
+
+[Sources]
+ TemporaryBuildWorkaround.c
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c b/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c
new file mode 100644
index 0000000000..2cd91b06f0
--- /dev/null
+++ b/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c
@@ -0,0 +1,31 @@
+/** @file
+ Source code file for a temporary build workaround.
+
+ The purpose of this workaround is described in the module INF file.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+#include <Library/BaseLib.h>
+
+/**
+ An empty entry point function.
+
+ @param FileHandle Handle of the file being invoked.
+ @param PeiServices Describes the list of possible PEI Services.
+
+ @retval EFI_SUCCESS This function always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+TemporaryBuildWorkaroundEntry (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+{
+ return EFI_SUCCESS;
+}
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 33/49] AdvancedFeaturePkg: Add FDF include files
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (30 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 32/49] AdvancedFeaturePkg: Add temporary build workaround Kubacki, Michael A
@ 2019-11-13 3:27 ` Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 34/49] KabylakeOpenBoardPkg/KabylakeRvp3: Add PEI_ARCH and DXE_ARCH Kubacki, Michael A
` (15 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:27 UTC (permalink / raw)
To: devel; +Cc: Sai Chaganty, Liming Gao
Adds FDF files that group all currently available advanced features
so they can be conveniently included into board packages.
The Minimum Platform defines two firmware volumes for advanced
features: FvAdvancedPreMemory and FvAdvanced.
This change provides all pre-memory advanced feature modules to
be included in FvAdvancedPreMemory via
AdvancedFeaturePkg/Include/PreMemory.fdf. All post-memory advanced
feature modules to be included in FvAdvanced are available in
AdvancedFeaturePkg/Include/PostMemory.fdf.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf | 57 ++++++++++++++++++++
Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf | 57 ++++++++++++++++++++
2 files changed, 114 insertions(+)
diff --git a/Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf b/Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..57b29a42b9
--- /dev/null
+++ b/Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,57 @@
+## @file
+# FDF file for post-memory advanced features.
+#
+# This file is intended to be included into another package so advanced features
+# can be conditionally included in the flash image by enabling the respective
+# feature via its FeaturePCD.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+#
+# Debug Advanced Features
+#
+!if gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable == TRUE
+ !include Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf
+!endif
+!if gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable == TRUE
+ !include Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf
+!endif
+
+#
+# Network Advanced Features
+#
+!if gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable == TRUE
+ !include Network/NetworkFeaturePkg/Include/PostMemory.fdf
+!endif
+
+#
+# Out-of-Band Management Advanced Features
+#
+!if gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable == TRUE
+ !include OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf
+!endif
+
+#
+# Power Management Advanced Features
+#
+!if gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable == TRUE
+ !include PowerManagement/S3FeaturePkg/Include/PostMemory.fdf
+!endif
+
+#
+# System Information Advanced Features
+#
+!if gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable == TRUE
+ !include SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf
+!endif
+
+#
+# User Interface Advanced Features
+#
+!if gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable == TRUE
+ !include UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf
+!endif
diff --git a/Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf b/Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..20d25dd173
--- /dev/null
+++ b/Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,57 @@
+## @file
+# FDF file for pre-memory advanced features.
+#
+# This file is intended to be included into another package so advanced features
+# can be conditionally included in the flash image by enabling the respective
+# feature via its FeaturePCD.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+#
+# Debug Advanced Features
+#
+!if gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable == TRUE
+ !include Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf
+!endif
+!if gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable == TRUE
+ !include Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf
+!endif
+
+#
+# Network Advanced Features
+#
+!if gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable == TRUE
+ !include Network/NetworkFeaturePkg/Include/PreMemory.fdf
+!endif
+
+#
+# Out-of-Band Management Advanced Features
+#
+!if gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable == TRUE
+ !include OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf
+!endif
+
+#
+# Power Management Advanced Features
+#
+!if gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable == TRUE
+ !include PowerManagement/S3FeaturePkg/Include/PreMemory.fdf
+!endif
+
+#
+# System Information Advanced Features
+#
+!if gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable == TRUE
+ !include SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf
+!endif
+
+#
+# User Interface Advanced Features
+#
+!if gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable == TRUE
+ !include UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf
+!endif
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 34/49] KabylakeOpenBoardPkg/KabylakeRvp3: Add PEI_ARCH and DXE_ARCH
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (31 preceding siblings ...)
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 33/49] AdvancedFeaturePkg: Add FDF include files Kubacki, Michael A
@ 2019-11-13 3:28 ` Kubacki, Michael A
2019-11-15 23:51 ` Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 35/49] KabylakeOpenBoardPkg/GalagoPro3: " Kubacki, Michael A
` (14 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:28 UTC (permalink / raw)
To: devel; +Cc: Chasel Chiu, Nate DeSimone
This change adds two new macros to OpenBoardPkg.dsc that identify
the build architecture for PEI and DXE modules. The intention of
this macro is to ensure that all DSC files that compose the package
build (such as those included from MinPlatformPkg or an advanced
feature package) build phase-specific drivers for the architecture
defined by the board package.
This is a macro that is required in all Minimum Platform board
packages.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
index 1ce473432a..e4f0fcb1b5 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
@@ -13,6 +13,8 @@
DEFINE PLATFORM_BOARD_PACKAGE = KabylakeOpenBoardPkg
DEFINE BOARD = KabylakeRvp3
DEFINE PROJECT = $(PLATFORM_BOARD_PACKAGE)/$(BOARD)
+ DEFINE PEI_ARCH = IA32
+ DEFINE DXE_ARCH = X64
#
# Include PCD configuration for this board.
@@ -102,10 +104,15 @@
#######################################
# Component Includes
#######################################
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CorePeiInclude.dsc
!include $(PLATFORM_SI_PACKAGE)/SiPkgPei.dsc
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CoreDxeInclude.dsc
!include $(PLATFORM_SI_PACKAGE)/SiPkgDxe.dsc
@@ -266,6 +273,11 @@
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.inf
!endif
+#######################################
+# PEI Components
+#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
#######################################
# Edk2 Packages
@@ -373,6 +385,11 @@
!endif
$(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf
+#######################################
+# DXE Components
+#######################################
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
#######################################
# Edk2 Packages
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 35/49] KabylakeOpenBoardPkg/GalagoPro3: Add PEI_ARCH and DXE_ARCH
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (32 preceding siblings ...)
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 34/49] KabylakeOpenBoardPkg/KabylakeRvp3: Add PEI_ARCH and DXE_ARCH Kubacki, Michael A
@ 2019-11-13 3:28 ` Kubacki, Michael A
2019-11-15 23:51 ` Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 36/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: " Kubacki, Michael A
` (13 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:28 UTC (permalink / raw)
To: devel; +Cc: Chasel Chiu, Nate DeSimone
This change adds two new macros to OpenBoardPkg.dsc that identify
the build architecture for PEI and DXE modules. The intention of
this macro is to ensure that all DSC files that compose the package
build (such as those included from MinPlatformPkg or an advanced
feature package) build phase-specific drivers for the architecture
defined by the board package.
This is a macro that is required in all Minimum Platform board
packages.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index e43c944201..280de880aa 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -14,6 +14,8 @@
DEFINE PLATFORM_BOARD_PACKAGE = KabylakeOpenBoardPkg
DEFINE BOARD = GalagoPro3
DEFINE PROJECT = $(PLATFORM_BOARD_PACKAGE)/$(BOARD)
+ DEFINE PEI_ARCH = IA32
+ DEFINE DXE_ARCH = X64
#
# Include PCD configuration for this board.
@@ -74,10 +76,14 @@
#######################################
# Component Includes
#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CorePeiInclude.dsc
!include $(PLATFORM_SI_PACKAGE)/SiPkgPei.dsc
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CoreDxeInclude.dsc
!include $(PLATFORM_SI_PACKAGE)/SiPkgDxe.dsc
@@ -228,6 +234,11 @@
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.inf
!endif
+#######################################
+# PEI Components
+#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
#######################################
# Edk2 Packages
@@ -301,6 +312,11 @@
!endif
$(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf
+#######################################
+# DXE Components
+#######################################
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
#######################################
# Edk2 Packages
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 36/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add PEI_ARCH and DXE_ARCH
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (33 preceding siblings ...)
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 35/49] KabylakeOpenBoardPkg/GalagoPro3: " Kubacki, Michael A
@ 2019-11-13 3:28 ` Kubacki, Michael A
2019-11-15 23:51 ` Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 37/49] SimicsOpenBoardPkg/BoardX58Ich10: Use " Kubacki, Michael A
` (12 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:28 UTC (permalink / raw)
To: devel; +Cc: Chasel Chiu, Nate DeSimone
This change adds two new macros to OpenBoardPkg.dsc that identify
the build architecture for PEI and DXE modules. The intention of
this macro is to ensure that all DSC files that compose the package
build (such as those included from MinPlatformPkg or an advanced
feature package) build phase-specific drivers for the architecture
defined by the board package.
This is a macro that is required in all Minimum Platform board
packages.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index cdaf47b6f7..44623eb427 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
@@ -15,6 +15,8 @@
DEFINE PLATFORM_BOARD_PACKAGE = WhiskeylakeOpenBoardPkg
DEFINE BOARD = WhiskeylakeURvp
DEFINE PROJECT = $(PLATFORM_BOARD_PACKAGE)/$(BOARD)
+ DEFINE PEI_ARCH = IA32
+ DEFINE DXE_ARCH = X64
#
# Include PCD configuration for this board.
@@ -73,10 +75,14 @@
#######################################
# Component Includes
#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CorePeiInclude.dsc
!include $(PLATFORM_SI_PACKAGE)/SiPkgPei.dsc
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CoreDxeInclude.dsc
!include $(PLATFORM_SI_PACKAGE)/SiPkgDxe.dsc
@@ -255,6 +261,11 @@
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.inf
!endif
+#######################################
+# PEI Components
+#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
#######################################
# Edk2 Packages
@@ -325,6 +336,11 @@
!endif
$(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf
+#######################################
+# DXE Components
+#######################################
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
#######################################
# Edk2 Packages
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 37/49] SimicsOpenBoardPkg/BoardX58Ich10: Use PEI_ARCH and DXE_ARCH
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (34 preceding siblings ...)
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 36/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: " Kubacki, Michael A
@ 2019-11-13 3:28 ` Kubacki, Michael A
2019-11-15 23:51 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 38/49] MinPlatformPkg: Add FvAdvancedPreMemory Kubacki, Michael A
` (11 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:28 UTC (permalink / raw)
To: devel; +Cc: Wei David Y, Agyeman Prince
This change updates OpenBoardPkg.dsc to use the PEI_ARCH and
DXE_ARCH specified in the DSC file for the board package components.
An EDK II build limitation currently prevents the macros from
being able to be used, so a todo has been placed with the action
needed when the BaseTools update is completed as described in the
following Bugzilla item:
https://bugzilla.tianocore.org/show_bug.cgi?id=2308
The intention of this macro is to ensure that all DSC files that
compose the package build (such as those included from
MinPlatformPkg or an advanced feature package) build phase-specific
drivers for the architecture defined by the board package.
This is a macro that is required in all Minimum Platform board
packages.
Cc: Wei David Y <david.y.wei@intel.com>
Cc: Agyeman Prince <prince.agyeman@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 761874de73..c6b2beee4d 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -61,10 +61,14 @@
#######################################
# Component Includes
#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CorePeiInclude.dsc
!include $(SKT_PKG)/SktPkgPei.dsc
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CoreDxeInclude.dsc
@@ -143,6 +147,11 @@
#######################################
SpiFlashCommonLib|$(PCH_PKG)/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.inf
+#######################################
+# PEI Components
+#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
#######################################
# Edk2 Packages
@@ -192,6 +201,11 @@
PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
}
+#######################################
+# DXE Components
+#######################################
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
#######################################
# Edk2 Packages
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 38/49] MinPlatformPkg: Add FvAdvancedPreMemory
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (35 preceding siblings ...)
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 37/49] SimicsOpenBoardPkg/BoardX58Ich10: Use " Kubacki, Michael A
@ 2019-11-13 3:28 ` Kubacki, Michael A
2019-11-15 23:51 ` Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 39/49] KabylakeOpenBoardPkg/KabylakeRvp3: " Kubacki, Michael A
` (10 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:28 UTC (permalink / raw)
To: devel; +Cc: Chasel Chiu, Nate DeSimone, Liming Gao
This change adds a new firmware volume to MinPlatformPkg called
FvAdvancedPreMemory. This firmware volume is used to hold advanced
feature modules that must be available in pre-memory.
Previously, these modules were kept as an uncompressed child FV in
FvAdvanced. However, in memory constrained environments before
permanent memory is initialized, it is preferable to have a
dedicated firmware volume that can simply be installed as a
standalone firmware volume to reduce the need for creating FV HOBs
for other post-memory advanced features if they are not needed and
to simplify the FV layout and FV installation process.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec | 3 ++
Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf | 42 ++++++++++----------
Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c | 24 ++++++++---
3 files changed, 44 insertions(+), 25 deletions(-)
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index a851021c0b..28713108ed 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -168,6 +168,9 @@ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset|0x00000000|UINT32|0x2000000
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityBase|0x00000000|UINT32|0x20000010
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize|0x00000000|UINT32|0x20000011
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset|0x00000000|UINT32|0x20000012
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase|0x00000000|UINT32|0x2000002D
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize|0x00000000|UINT32|0x2000002E
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset|0x00000000|UINT32|0x2000002F
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedBase|0x00000000|UINT32|0x20000013
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize|0x00000000|UINT32|0x20000014
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedOffset|0x00000000|UINT32|0x20000015
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
index 4d96c9cf31..1ce3034fcc 100644
--- a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
@@ -1,7 +1,7 @@
### @file
# Component information file for the Report Firmware Volume (FV) library.
#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -30,22 +30,24 @@
PeiReportFvLib.c
[Pcd]
- gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBootMode ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaBaseAddress ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUSize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBootMode ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaBaseAddress ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize ## CONSUMES
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c
index 6e49b1239d..b61587f6e3 100644
--- a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c
@@ -1,7 +1,7 @@
/** @file
Source code file for Report Firmware Volume (FV) library
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -40,11 +40,16 @@ ReportPreMemFv (
NULL,
0
);
- DEBUG ((DEBUG_INFO, "Install FlashFvAdvanced - 0x%x, 0x%x\n", PcdGet32 (PcdFlashFvAdvancedBase), PcdGet32 (PcdFlashFvAdvancedSize)));
+ DEBUG ((
+ DEBUG_INFO,
+ "Install FlashFvAdvancedPreMemory - 0x%x, 0x%x\n",
+ PcdGet32 (PcdFlashFvAdvancedPreMemoryBase),
+ PcdGet32 (PcdFlashFvAdvancedPreMemorySize)
+ ));
PeiServicesInstallFvInfo2Ppi (
- &(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFlashFvAdvancedBase))->FileSystemGuid),
- (VOID *) (UINTN) PcdGet32 (PcdFlashFvAdvancedBase),
- PcdGet32 (PcdFlashFvAdvancedSize),
+ &(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFlashFvAdvancedPreMemoryBase))->FileSystemGuid),
+ (VOID *) (UINTN) PcdGet32 (PcdFlashFvAdvancedPreMemoryBase),
+ PcdGet32 (PcdFlashFvAdvancedPreMemorySize),
NULL,
NULL,
0
@@ -117,6 +122,15 @@ ReportPostMemFv (
NULL,
0
);
+ DEBUG ((DEBUG_INFO, "Install FlashFvAdvanced - 0x%x, 0x%x\n", PcdGet32 (PcdFlashFvAdvancedBase), PcdGet32 (PcdFlashFvAdvancedSize)));
+ PeiServicesInstallFvInfo2Ppi (
+ &(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFlashFvAdvancedBase))->FileSystemGuid),
+ (VOID *) (UINTN) PcdGet32 (PcdFlashFvAdvancedBase),
+ PcdGet32 (PcdFlashFvAdvancedSize),
+ NULL,
+ NULL,
+ 0
+ );
}
//
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 39/49] KabylakeOpenBoardPkg/KabylakeRvp3: Add FvAdvancedPreMemory
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (36 preceding siblings ...)
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 38/49] MinPlatformPkg: Add FvAdvancedPreMemory Kubacki, Michael A
@ 2019-11-13 3:28 ` Kubacki, Michael A
2019-11-16 0:34 ` Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 40/49] KabylakeOpenBoardPkg/GalagoPro3: " Kubacki, Michael A
` (9 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:28 UTC (permalink / raw)
To: devel; +Cc: Chasel Chiu, Nate DeSimone
This change adds a standalone firmware volume for pre-memory
advanced features called FvAdvancedPreMemory to the flash map.
Pre-memory advanced feature modules were previously kept in a child
firmware volume of FvAdvanced called FvAdvancedPreMem. This change
simplifies the flash layout and separation of pre-memory and
post-memory modules.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMapInclude.fdf | 30 +++++++------
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf | 46 +++++++-------------
2 files changed, 32 insertions(+), 44 deletions(-)
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMapInclude.fdf b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMapInclude.fdf
index 6cb49c941c..b5e3f66cea 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMapInclude.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMapInclude.fdf
@@ -1,5 +1,5 @@
## @file
-# FDF file of Platform.
+# FDF file for the KabylakeRvp3 board.
#
# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
#
@@ -19,28 +19,30 @@ DEFINE FLASH_NUM_BLOCKS = 0x00000080
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageOffset = 0x00000000 # Flash addr (0xFF800000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageSize = 0x00040000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageVariableOffset = 0x00000000 # Flash addr (0xFF800000)
-SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize = 0x0001E000 #
+SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize = 0x0001E000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingOffset = 0x0001E000 # Flash addr (0xFF81E000)
-SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize = 0x00002000 #
+SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize = 0x00002000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareOffset = 0x00020000 # Flash addr (0xFF820000)
-SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = 0x00020000 #
+SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = 0x00020000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedOffset = 0x00040000 # Flash addr (0xFF840000)
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00060000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x000A0000 # Flash addr (0xFF8A0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00050000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x00090000 # Flash addr (0xFF890000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize = 0x00070000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00110000 # Flash addr (0xFF910000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00100000 # Flash addr (0xFF900000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize = 0x00090000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x001A0000 # Flash addr (0xFF9A0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x00190000 # Flash addr (0xFF990000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize = 0x001E0000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x00380000 # Flash addr (0xFFB80000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x00370000 # Flash addr (0xFFB70000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize = 0x00180000 #
-SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x00500000 # Flash addr (0xFFD00000)
-SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = 0x000A0000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x005A0000 # Flash addr (0xFFDA0000)
+SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x004F0000 # Flash addr (0xFFCF0000)
+SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = 0x000A0000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00590000 # Flash addr (0xFFD90000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize = 0x00060000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x00600000 # Flash addr (0xFFE00000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x005F0000 # Flash addr (0xFFDF0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize = 0x000BC000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x006BC000 # Flash addr (0xFFEBC000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x006AC000 # Flash addr (0xFFEAC000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize = 0x00014000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset = 0x006C0000 # Flash addr (0xFFEC0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize = 0x00010000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset = 0x006D0000 # Flash addr (0xFFED0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize = 0x00130000 #
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
index 98eb7dcb5a..132015be5d 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
@@ -173,6 +173,10 @@ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTBase|gMinPlatformPkgTokenSpaceGuid.P
# FSP_T Section
FILE = $(PLATFORM_FSP_BIN_PACKAGE)/Fsp_Rebased_T.fd
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+FV = FvAdvancedPreMemory
+
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
FV = FvPreMemory
@@ -611,7 +615,10 @@ FILE FV_IMAGE = C83522D9-80A1-4D95-8C25-3F1370497406 {
}
}
-[FV.FvAdvancedPreMem]
+#
+# Pre-memory Advanced Features
+#
+[FV.FvAdvancedPreMemory]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -634,7 +641,10 @@ FvNameGuid = 6053D78A-457E-4490-A237-31D0FBE2F305
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Pei/PeiTbtInit.inf
!endif
-[FV.FvAdvancedPostMem]
+#
+# Post-Memory Advanced Features
+#
+[FV.FvAdvancedUncompact]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -653,31 +663,15 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = BE3DF86F-E464-44A3-83F7-0D27E6B88C27
-[FV.FvAdvancedLate]
-FvAlignment = 16
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = 11F6E304-43F9-4B2F-90AB-B8FFEAD6205D
-
!if gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Dxe/TbtDxe.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/PciHotPlug/PciHotPlug.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Smm/TbtSmm.inf
!endif
+#
+# Compressed FV with Post-Memory Advanced Features
+#
[FV.FvAdvanced]
BlockSize = $(FLASH_BLOCK_SIZE)
FvAlignment = 16
@@ -698,17 +692,9 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = B23E7388-9953-45C7-9201-0473DDE5487A
-FILE FV_IMAGE = 35E7406A-5842-4F2B-BC62-19022C12AF74 {
- SECTION FV_IMAGE = FvAdvancedPreMem
- }
-
-FILE FV_IMAGE = F5DCB34F-27EA-48AC-9406-C894F6D587CA {
- SECTION FV_IMAGE = FvAdvancedPostMem
- }
-
FILE FV_IMAGE = 5248467B-B87B-4E74-AC02-398AF4BCB712 {
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FvAdvancedLate
+ SECTION FV_IMAGE = FvAdvancedUncompact
}
}
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 40/49] KabylakeOpenBoardPkg/GalagoPro3: Add FvAdvancedPreMemory
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (37 preceding siblings ...)
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 39/49] KabylakeOpenBoardPkg/KabylakeRvp3: " Kubacki, Michael A
@ 2019-11-13 3:28 ` Kubacki, Michael A
2019-11-16 0:34 ` Nate DeSimone
2019-11-15 23:47 ` [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Nate DeSimone
` (8 subsequent siblings)
47 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 3:28 UTC (permalink / raw)
To: devel; +Cc: Chasel Chiu, Nate DeSimone
This change adds a standalone firmware volume for pre-memory
advanced features called FvAdvancedPreMemory to the flash map.
Pre-memory advanced feature modules were previously kept in a child
firmware volume of FvAdvanced called FvAdvancedPreMem. This change
simplifies the flash layout and separation of pre-memory and
post-memory modules.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapInclude.fdf | 20 +++++----
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf | 46 +++++++-------------
2 files changed, 27 insertions(+), 39 deletions(-)
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapInclude.fdf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapInclude.fdf
index c7f314ffe4..6cb6d54f55 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapInclude.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapInclude.fdf
@@ -27,22 +27,24 @@ SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = 0x00020000
SET gKabylakeOpenBoardPkgTokenSpaceGuid.PcdFlashNvDebugMessageOffset = 0x00040000 # Flash addr (0xFFA60000)
SET gKabylakeOpenBoardPkgTokenSpaceGuid.PcdFlashNvDebugMessageSize = 0x00010000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedOffset = 0x00050000 # Flash addr (0xFFA70000)
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00060000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x000B0000 # Flash addr (0xFFAD0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00050000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x000A0000 # Flash addr (0xFFAC0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize = 0x00070000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00120000 # Flash addr (0xFFB40000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00110000 # Flash addr (0xFFB30000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize = 0x00090000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x001B0000 # Flash addr (0xFFBD0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x001A0000 # Flash addr (0xFFBC0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize = 0x00140000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x002F0000 # Flash addr (0xFFD10000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x002E0000 # Flash addr (0xFFD00000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize = 0x000B0000 #
-SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x003A0000 # Flash addr (0xFFDC0000)
+SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x00390000 # Flash addr (0xFFDB0000)
SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = 0x000A0000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00440000 # Flash addr (0xFFE60000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00430000 # Flash addr (0xFFE50000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize = 0x00060000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x004A0000 # Flash addr (0xFFEC0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x00490000 # Flash addr (0xFFEB0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize = 0x000BA000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x0055A000 # Flash addr (0xFFF7A000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x0054A000 # Flash addr (0xFFF6A000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize = 0x00006000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset = 0x00550000 # Flash addr (0xFFF70000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize = 0x00010000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset = 0x00560000 # Flash addr (0xFFF80000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize = 0x00080000 #
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
index d5ae9dce41..0a9b933e40 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
@@ -177,6 +177,10 @@ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTBase|gMinPlatformPkgTokenSpaceGuid.P
# FSP_T Section
FILE = $(PLATFORM_FSP_BIN_PACKAGE)/Fsp_Rebased_T.fd
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+FV = FvAdvancedPreMemory
+
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
FV = FvPreMemory
@@ -605,7 +609,10 @@ FILE FV_IMAGE = C83522D9-80A1-4D95-8C25-3F1370497406 {
}
}
-[FV.FvAdvancedPreMem]
+#
+# Pre-memory Advanced Features
+#
+[FV.FvAdvancedPreMemory]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -628,7 +635,10 @@ FvNameGuid = 6053D78A-457E-4490-A237-31D0FBE2F305
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Pei/PeiTbtInit.inf
!endif
-[FV.FvAdvancedPostMem]
+#
+# Post-Memory Advanced Features
+#
+[FV.FvAdvancedUncompact]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -647,31 +657,15 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = BE3DF86F-E464-44A3-83F7-0D27E6B88C27
-[FV.FvAdvancedLate]
-FvAlignment = 16
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = 11F6E304-43F9-4B2F-90AB-B8FFEAD6205D
-
!if gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Dxe/TbtDxe.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/PciHotPlug/PciHotPlug.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Smm/TbtSmm.inf
!endif
+#
+# Compressed FV with Post-Memory Advanced Features
+#
[FV.FvAdvanced]
BlockSize = $(FLASH_BLOCK_SIZE)
FvAlignment = 16
@@ -692,17 +686,9 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = B23E7388-9953-45C7-9201-0473DDE5487A
-FILE FV_IMAGE = 35E7406A-5842-4F2B-BC62-19022C12AF74 {
- SECTION FV_IMAGE = FvAdvancedPreMem
- }
-
-FILE FV_IMAGE = F5DCB34F-27EA-48AC-9406-C894F6D587CA {
- SECTION FV_IMAGE = FvAdvancedPostMem
- }
-
FILE FV_IMAGE = 5248467B-B87B-4E74-AC02-398AF4BCB712 {
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FvAdvancedLate
+ SECTION FV_IMAGE = FvAdvancedUncompact
}
}
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [edk2-platforms][PATCH V1 41/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add FvAdvancedPreMemory
2019-11-13 4:37 [edk2-platforms][PATCH V1 24/49] DebugFeaturePkg: Remove the USB3 Debug feature Kubacki, Michael A
@ 2019-11-13 4:37 ` Kubacki, Michael A
2019-11-16 0:35 ` Nate DeSimone
0 siblings, 1 reply; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-13 4:37 UTC (permalink / raw)
To: devel; +Cc: Chasel Chiu, Nate DeSimone
This change adds a standalone firmware volume for pre-memory
advanced features called FvAdvancedPreMemory to the flash map.
Pre-memory advanced feature modules were previously kept in a child
firmware volume of FvAdvanced called FvAdvancedPreMem. This change
simplifies the flash layout and separation of pre-memory and
post-memory modules.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf | 24 +++++-----
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf | 46 +++++++-------------
2 files changed, 28 insertions(+), 42 deletions(-)
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf
index 9209b9e88a..e0db381942 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf
@@ -1,12 +1,10 @@
## @file
-# FDF file of Platform.
-#
+# FDF file for the WhiskeylakeURvp board.
#
# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
-#
##
#=================================================================================#
@@ -27,23 +25,25 @@ SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize = 0x00002000
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareOffset = 0x00020000 # Flash addr (0xFF820000)
SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = 0x00020000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedOffset = 0x00040000 # Flash addr (0xFF840000)
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00060000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x000A0000 # Flash addr (0xFF8A0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00050000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x00090000 # Flash addr (0xFF890000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize = 0x00070000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00110000 # Flash addr (0xFF910000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00100000 # Flash addr (0xFF900000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize = 0x00090000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x001A0000 # Flash addr (0xFF9A0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x00190000 # Flash addr (0xFF990000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize = 0x00190000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x00330000 # Flash addr (0xFFB30000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x00320000 # Flash addr (0xFFB20000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize = 0x00170000 #
-SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x004A0000 # Flash addr (0xFFCA0000)
+SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x00490000 # Flash addr (0xFFC90000)
SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = 0x000B0000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00550000 # Flash addr (0xFFD50000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00540000 # Flash addr (0xFFD40000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize = 0x00070000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x005C0000 # Flash addr (0xFFDC0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x005B0000 # Flash addr (0xFFDB0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize = 0x000EC000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x006AC000 # Flash addr (0xFFEAC000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x0069C000 # Flash addr (0xFFE9C000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize = 0x00014000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset = 0x006B0000 # Flash addr (0xFFEB0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize = 0x00010000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset = 0x006C0000 # Flash addr (0xFFEC0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize = 0x00140000 #
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
index 8a4fd973b4..130930ad40 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
@@ -175,6 +175,10 @@ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTBase|gMinPlatformPkgTokenSpaceGuid.P
# FSP_T Section
FILE = $(PLATFORM_FSP_BIN_PACKAGE)/Fsp_Rebased_T.fd
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+FV = FvAdvancedPreMemory
+
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
FV = FvPreMemory
@@ -597,7 +601,10 @@ FILE FV_IMAGE = C83522D9-80A1-4D95-8C25-3F1370497406 {
}
}
-[FV.FvAdvancedPreMem]
+#
+# Pre-memory Advanced Features
+#
+[FV.FvAdvancedPreMemory]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -620,7 +627,10 @@ FvNameGuid = 6053D78A-457E-4490-A237-31D0FBE2F305
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Pei/PeiTbtInit.inf
!endif
-[FV.FvAdvancedPostMem]
+#
+# Post-Memory Advanced Features
+#
+[FV.FvAdvancedUncompact]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -639,31 +649,15 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = BE3DF86F-E464-44A3-83F7-0D27E6B88C27
-[FV.FvAdvancedLate]
-FvAlignment = 16
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = 11F6E304-43F9-4B2F-90AB-B8FFEAD6205D
-
!if gWhiskeylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Dxe/TbtDxe.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/PciHotPlug/PciHotPlug.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Smm/TbtSmm.inf
!endif
+#
+# Compressed FV with Post-Memory Advanced Features
+#
[FV.FvAdvanced]
BlockSize = $(FLASH_BLOCK_SIZE)
FvAlignment = 16
@@ -684,17 +678,9 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = B23E7388-9953-45C7-9201-0473DDE5487A
-FILE FV_IMAGE = 35E7406A-5842-4F2B-BC62-19022C12AF74 {
- SECTION FV_IMAGE = FvAdvancedPreMem
- }
-
-FILE FV_IMAGE = F5DCB34F-27EA-48AC-9406-C894F6D587CA {
- SECTION FV_IMAGE = FvAdvancedPostMem
- }
-
FILE FV_IMAGE = 5248467B-B87B-4E74-AC02-398AF4BCB712 {
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FvAdvancedLate
+ SECTION FV_IMAGE = FvAdvancedUncompact
}
}
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 01/49] AdvancedFeaturePkg: Package DSC style cleanup
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 01/49] AdvancedFeaturePkg: Package DSC style cleanup Kubacki, Michael A
@ 2019-11-14 2:00 ` Chaganty, Rangasai V
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
1 sibling, 0 replies; 92+ messages in thread
From: Chaganty, Rangasai V @ 2019-11-14 2:00 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Gao, Liming
Reviewed-by: Sai Chaganty <rangasai.v.chaganty@intel.com>
-----Original Message-----
From: Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:27 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-platforms][PATCH V1 01/49] AdvancedFeaturePkg: Package DSC style cleanup
This change refactors AdvancedFeaturePkg.dsc to consolidate redundant sections and better group file content to improve maintainability and readability.
This pattern is being applied in all Minimum Platform package DSC files.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 133 +++++++++++---------
1 file changed, 71 insertions(+), 62 deletions(-)
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index b2e7ab8302..b83e72b48c 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -1,5 +1,5 @@
## @file
-# Platform description.
+# Advanced Feature Package build description file.
#
# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR> # @@ -24,8 +24,7 @@
################################################################################
#
-# SKU Identification section - list of all SKU IDs supported by this
-# Platform.
+# SKU Identification section - list of all SKU IDs supported.
#
################################################################################
[SkuIds]
@@ -33,88 +32,93 @@
################################################################################
#
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform
+# Pcd Section - list of all EDK II PCD Entries defined by this package.
#
################################################################################
-
+
[PcdsFeatureFlag]
################################################################################
#
-# Library Class section - list of all Library Classes needed by this Platform.
+# Library Class section - list of all Library Classes needed by this package.
#
################################################################################
[LibraryClasses.common]
-
- PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
- PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
- DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
- SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
- PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
-
- #
- # Basic
- #
+ #######################################
+ # Edk2 Packages
+ #######################################
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
-
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+
+ BasePciLibPciExpress|MdePkg/Library/BasePciLibPciExpress/BasePciLibPci
+ Express.inf
+ CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMa
+ intenanceLib.inf
CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+
+ DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.i
+ nf DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+
+ DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTabl
+ eLib.inf HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
- PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
- PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
- BasePciLibPciExpress|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
-# PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
- CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
- PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+ PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
+
+ PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci
+ .inf
+ PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BaseP
+ eCoffExtraActionLibNull.inf
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+ PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+
+ PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.i
+ nf PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
+ PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+
+ PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibId
+ t/PeiServicesTablePointerLibIdt.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+
+ ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRep
+ ortStatusCodeLibNull.inf
+ SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPo
+ rtLib16550.inf
SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
- #
- # UEFI & PI
- #
+
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTempl
+ ate.inf
+ UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/Uef
+ iApplicationEntryPoint.inf
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
- UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
-
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
- PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
- PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
-
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
-
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
-
- TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
-
- IpmiPlatformHookLib|AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
- IpmiLib|AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
+
+ UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompr
+ essLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEnt
+ ryPoint.inf
+ UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServ
+ icesLib.inf UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib
+ /UefiRuntimeServicesTableLib.inf
+
+ #######################################
+ # Advanced Feature Package
+ #######################################
IpmiCommandLib|AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf
+ IpmiLib|AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
+
+ IpmiPlatformHookLib|AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLi
+ bNull/IpmiPlatformHookLibNull.inf
[LibraryClasses.common.SEC,LibraryClasses.common.PEI_CORE,LibraryClasses.common.PEIM]
- PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+
+ #######################################
+ # Silicon Initialization Package
+ #######################################
SmmAccessLib|IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.inf
[LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE,LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRIVER,LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION]
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
[LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE]
+ #######################################
+ # Edk2 Packages
+ #######################################
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
###################################################################################################
@@ -137,20 +141,25 @@
###################################################################################################
[Components]
+ #######################################
+ # Advanced Feature Package
+ #######################################
- AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
+ # Add library instances here that are not included in package
+ components and should be tested # in the package build.
- AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
- AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf
- AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf
+ # Add components here that should be included in the package build.
+ AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
+ AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf
+ AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf
+ AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
+ AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf
+ AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf
AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf
- AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
- AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
- AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
-
AdvancedFeaturePkg/S3/S3Pei.inf
+ AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
[BuildOptions]
- *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES \ No newline at end of file
+ *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (38 preceding siblings ...)
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 40/49] KabylakeOpenBoardPkg/GalagoPro3: " Kubacki, Michael A
@ 2019-11-15 23:47 ` Nate DeSimone
[not found] ` <20191113032816.4056-42-michael.a.kubacki@intel.com>
` (7 subsequent siblings)
47 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:47 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io
Cc: Agyeman, Prince, Chiu, Chasel, Bi, Dandan, Dong, Eric,
Oram, Isaac W, Gao, Liming, Chaganty, Rangasai V, Wei, David Y
Hi Michael,
I have completed reviewing your considerably large patch series. Overall, I have approved 80% of your patches without modification. I do have feedback for 10 of the patches however. In the interest of efficiency, please reuse my "Reviewed-by" for 39 patches that I have already approved for subsequent versions of the patch series. Also, in the interest of efficiency, I have consolidated my feedback for the entire series below.
General Feedback:
1. This is a vast improvement over the current mechanisms for advanced features! In particular I found the MUXing capability you implemented in AdvancedFeaturePkg/Include/AdvancedFeatures.dsc excellent. It reminds me of KConfig and I think it will make it a lot easier to get started with a new MinPlatform board port! Thank you!
2. With the addition of Leif's recent changes to Maintainers.txt, your patch series no longer cleanly applies to the tip of master. Please rebase your patch series.
3. Please at least fill in the "Purpose" section of all the new Readme.md files you are creating, don't leave the entire file as TODOs.
This feedback applies for the following patches:
Patch 14/49 - Features/Intel: Add S3FeaturePkg
Patch 16/49 - Features/Intel/IpmiFeaturePkg: Add initial package
Patch 20/49 - Features/Intel/SmbiosFeaturePkg: Add initial package
Patch 25/49 - Features/Intel/Usb3DebugFeaturePkg: Add initial package
Patch 27/49 - Features/Intel/UserAuthFeaturePkg: Add initial package
Patch 28/49 - Features/Intel/NetworkFeaturePkg: Add initial package
Patch 04/49 - Features/Intel: Add Readme.md
1. Readme.md, line 211: Please also add a Linux/Mac example.
Patch 17/49 - Features/Intel/IpmiFeaturePkg: Add libraries
1. IpmiFeaturePkg/Include/Library/IpmiCommandLib.h - Update copyright year
2. IpmiFeaturePkg/Include/Library/IpmiPlatformHookLib.h - Update copyright year
3. IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c - Update copyright year
Patch 18/49 - Features/Intel/IpmiFeaturePkg: Add modules
1. IpmiFeaturePkg/BmcAcpi/BmcSsdt/BmcSsdt.asl - Update copyright year.
2. IpmiFeaturePkg/BmcAcpi/BmcSsdt/IpmiOprRegions.asi - Update copyright year.
3. IpmiFeaturePkg/Frb/FrbDxe.c - Update copyright year.
4. IpmiFeaturePkg/IpmiInit/DxeIpmiInit.c - Update copyright year
5. IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c - Update copyright year
6. IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c - Update copyright year
7. IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c - Update copyright year
Patch 20/49 - Features/Intel/SmbiosFeaturePkg: Add initial package
1. SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h - Update copyright year
2. SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c - Update copyright year
3. SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c - Update copyright year
4. SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c - Update copyright year
5. SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c - Update copyright year
6. SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c - Update copyright year
Patch 25/49 - Features/Intel/Usb3DebugFeaturePkg: Add initial package:
1. Why rename Usb3DebugPortParameterLib.h to Library/Usb3DebugPortParamLib.h?
Patch 43/49 - Platform/Intel/Readme.md Content update
1. Readme.md, line 269: Please also add a Linux/Mac example.
I look forward to your second series!
Regards,
Nate
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:27 PM
To: devel@edk2.groups.io
Cc: Agyeman, Prince <prince.agyeman@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Dong, Eric <eric.dong@intel.com>; Oram, Isaac W <isaac.w.oram@intel.com>; Gao, Liming <liming.gao@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Wei, David Y <david.y.wei@intel.com>
Subject: [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor
RFC:https://edk2.groups.io/g/devel/message/49880
This patch series introduces a consistent design for Intel advanced features.
Advanced features in this context refer to the definition stated in
the EDK II Minimum Platform specification. Information regarding
this feature design is provided in Features/Intel/Readme.md.
An RFC was sent to the mailing list on 11/1/2019 that stated the
intention of creating the Features directory in edk2-platforms for
this purpose and that change is implemented in this patch series.
Testing performed:
* Feature packages and board packages build successfully
* Board packages boot successfully to their supported OS
* Board package Stage 4 and Stage 6 tested
The actual feature source implementation was not functionally
modified. Any issues reported by PatchCheck.py were fixed.
Future changes will be made to individually address improving the
quality of each feature and to add new features.
This patch series is intended to provide a foundation for future
changes to the advanced feature design as an incremental improvement
over the current state and should not be considered the final state.
Cc: Agyeman Prince <prince.agyeman@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Isaac W Oram <isaac.w.oram@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Wei David Y <david.y.wei@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
Michael Kubacki (49):
AdvancedFeaturePkg: Package DSC style cleanup
DebugFeaturePkg: Package DSC style cleanup
UserInterfaceFeaturePkg: Package DSC style cleanup
Features/Intel: Add Readme.md
Features/Intel/PowerManagement: Add Readme.md
Features/Intel/OutOfBandManagement: Add Readme.md
Features/Intel/SystemInformation: Add Readme.md
Features/Intel/Debug: Add Readme.md
Features/Intel/UserInterface: Add Readme.md
Features/Intel/Network: Add Readme.md
TemplateFeaturePkg: Add initial package
SimicsOpenBoardPkg: Remove advanced feature references
AdvancedFeaturePkg: Remove the S3 feature
Features/Intel: Add S3FeaturePkg
AdvancedFeaturePkg: Remove the IPMI feature
Features/Intel/IpmiFeaturePkg: Add initial package
Features/Intel/IpmiFeaturePkg: Add libraries
Features/Intel/IpmiFeaturePkg: Add modules
AdvancedFeaturePkg: Remove the SMBIOS feature
Features/Intel/SmbiosFeaturePkg: Add initial package
Features/Intel/SmbiosFeaturePkg: Update default strings
DebugFeaturePkg: Remove the ACPI Debug feature
Features/Intel/AcpiDebugFeaturePkg: Add initial package
DebugFeaturePkg: Remove the USB3 Debug feature
Features/Intel/Usb3DebugFeaturePkg: Add initial package
UserInterfaceFeaturePkg: Remove the User Authentication feature
Features/Intel/UserAuthFeaturePkg: Add initial package
Features/Intel/NetworkFeaturePkg: Add initial package
AdvancedFeaturePkg: Remove remaining contents
AdvancedFeaturePkg: Move to Features/Intel
AdvancedFeaturePkg: Add feature build support
AdvancedFeaturePkg: Add temporary build workaround
AdvancedFeaturePkg: Add FDF include files
KabylakeOpenBoardPkg/KabylakeRvp3: Add PEI_ARCH and DXE_ARCH
KabylakeOpenBoardPkg/GalagoPro3: Add PEI_ARCH and DXE_ARCH
WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add PEI_ARCH and DXE_ARCH
SimicsOpenBoardPkg/BoardX58Ich10: Use PEI_ARCH and DXE_ARCH
MinPlatformPkg: Add FvAdvancedPreMemory
KabylakeOpenBoardPkg/KabylakeRvp3: Add FvAdvancedPreMemory
KabylakeOpenBoardPkg/GalagoPro3: Add FvAdvancedPreMemory
WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add FvAdvancedPreMemory
Platform/Intel: Add advanced feature build support
Platform/Intel/Readme.md Content update
KabylakeOpenBoardPkg/GalagoPro3: Enable advanced features
KabylakeOpenBoardPkg/KabylakeRvp3: Enable advanced features
WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Enable advanced features
SimicsOpenBoardPkg: Enable advanced features
MinPlatformPkg: Install advanced feature FVs by stage enabled
Maintainers.txt: Update Intel feature maintainers
Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 31 +++
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec | 39 ++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec | 57 +++++
Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec | 30 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec | 46 ++++
Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dec | 30 +++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec | 172 +++++++++++++++
Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec | 30 +++
Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec | 24 +-
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 153 -------------
Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec | 66 ------
Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec | 4 +
Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 53 +++++
Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc | 56 +++++
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc | 74 +++++++
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc | 30 +++
Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeature.dsc | 125 +++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc | 149 +++++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dsc | 30 +++
Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc | 152 +++++++++++++
Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc | 30 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc | 144 ++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc | 31 +++
Features/Intel/PowerManagement/S3FeaturePkg/Include/S3Feature.dsc | 122 ++++++++++
Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dsc | 30 +++
Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc | 115 ++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc | 30 +++
Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc | 113 ++++++++++
Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc | 30 +++
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc | 141 ++++++++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dsc | 30 +++
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 156 -------------
Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc | 19 --
Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.dsc | 9 -
Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc | 101 ---------
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc | 62 +++---
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkgPcd.dsc | 1 +
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc | 61 +++--
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc | 1 +
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 25 ++-
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc | 12 +-
Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc | 80 -------
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc | 60 +++--
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkgPcd.dsc | 1 +
Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf | 57 +++++
Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf | 57 +++++
Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf | 11 +
Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf | 8 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf | 10 +
Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf | 16 ++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf | 11 +
Features/Intel/PowerManagement/S3FeaturePkg/Include/PostMemory.fdf | 8 +
Features/Intel/PowerManagement/S3FeaturePkg/Include/PreMemory.fdf | 10 +
Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf | 10 +
Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf | 8 +
Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf | 12 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf | 8 +
Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf | 20 --
Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf | 8 -
Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf | 9 -
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapInclude.fdf | 20 +-
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf | 48 ++--
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMapInclude.fdf | 30 +--
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf | 48 ++--
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf | 10 +-
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf | 24 +-
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf | 48 ++--
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.inf | 57 +++++
{Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebugDxe.inf | 10 +-
{Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebugSmm.inf | 11 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf | 12 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf | 12 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf | 3 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf | 10 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf | 10 +-
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf | 31 +++
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi.inf | 9 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog.inf | 5 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.inf | 10 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.inf | 10 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.inf | 4 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiInit.inf | 6 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiInit.inf | 6 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLib.inf | 6 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf | 9 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.inf | 7 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStatus.inf | 13 +-
{Platform/Intel/AdvancedFeaturePkg/S3 => Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.inf | 16 +-
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf | 83 +++++++
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf | 5 +-
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLib/UserPasswordLib.inf | 2 +-
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordUiLib/UserPasswordUiLib.inf | 2 +-
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthentication2Dxe.inf | 3 +-
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxe.inf | 3 +-
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationSmm.inf | 2 +-
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf | 28 ---
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf | 83 -------
Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf | 31 ---
Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf | 43 ++--
Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 1 -
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Include/Library/Usb3DebugPortLib.h | 0
Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameterLib.h => Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortParamLib.h | 0
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/IpmiCommandLib.h | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/IpmiPlatformHookLib.h | 0
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/SmbiosBasic.h | 4 +-
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Guid/UserAuthentication.h | 0
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/PlatformPasswordLib.h | 0
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPasswordLib.h | 0
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPasswordUiLib.h | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/KeyService.h | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthentication2Dxe.h | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxe.h | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxeFormset.h | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationSmm.h | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxeVfr.vfr | 0
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c | 31 +++
{Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebug.c | 54 +++--
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/MiscServices.c | 0
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c | 2 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c | 2 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c | 4 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c | 4 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c | 0
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c | 2 +-
{Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c | 2 +-
Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.c => Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.c | 2 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.c | 2 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.c | 4 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiInit.c | 8 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiInit.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c | 0
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.c | 2 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStatus.c | 6 +-
{Platform/Intel/AdvancedFeaturePkg/S3 => Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.c | 0
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/SmbiosBasicEntryPoint.c | 8 +-
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type0BiosVendorFunction.c | 2 +-
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type1SystemManufacturerFunction.c | 2 +-
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c | 0
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type32BootInformationFunction.c | 0
{Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c | 0
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c | 0
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLib/UserPasswordLib.c | 0
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordUiLib/UserPasswordUiLib.c | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/KeyService.c | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthentication2Dxe.c | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxe.c | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxePassword.c | 0
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationSmm.c | 0
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c | 45 ----
Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c | 38 +++-
{Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebug.asl | 3 +-
Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md | 121 ++++++++++
Features/Intel/Debugging/Readme.md | 7 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md | 86 ++++++++
Features/Intel/Network/NetworkFeaturePkg/Readme.md | 89 ++++++++
Features/Intel/Network/Readme.md | 5 +
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt/BmcSsdt.asl | 8 +-
{Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt/IpmiOprRegions.asi | 10 +-
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md | 86 ++++++++
Features/Intel/OutOfBandManagement/Readme.md | 8 +
Features/Intel/PowerManagement/Readme.md | 10 +
Features/Intel/PowerManagement/S3FeaturePkg/Readme.md | 86 ++++++++
Features/Intel/Readme.md | 232 ++++++++++++++++++++
Features/Intel/SystemInformation/Readme.md | 8 +
Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md | 86 ++++++++
Features/Intel/TemplateFeaturePkg/Readme.md | 71 ++++++
Features/Intel/UserInterface/Readme.md | 9 +
{Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni | 0
Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md | 86 ++++++++
{Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxeStrings.uni | 0
Maintainers.txt | 26 +--
Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt | 31 ---
Platform/Intel/Readme.md | 14 +-
Platform/Intel/build.cfg | 1 +
Platform/Intel/build_bios.py | 3 +
188 files changed, 3854 insertions(+), 1285 deletions(-)
create mode 100644 Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
create mode 100644 Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
create mode 100644 Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec
create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
create mode 100644 Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dec
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
create mode 100644 Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec
rename Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec (53%)
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
delete mode 100644 Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec
create mode 100644 Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
create mode 100644 Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
create mode 100644 Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc
create mode 100644 Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc
create mode 100644 Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeature.dsc
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dsc
create mode 100644 Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc
create mode 100644 Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc
create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
create mode 100644 Features/Intel/PowerManagement/S3FeaturePkg/Include/S3Feature.dsc
create mode 100644 Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dsc
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc
create mode 100644 Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc
create mode 100644 Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc
create mode 100644 Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc
create mode 100644 Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dsc
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.dsc
delete mode 100644 Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
create mode 100644 Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/PowerManagement/S3FeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/PowerManagement/S3FeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf
create mode 100644 Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf
create mode 100644 Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf
create mode 100644 Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.inf
rename {Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebugDxe.inf (77%)
rename {Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebugSmm.inf (74%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf (74%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf (78%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf (92%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf (74%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf (76%)
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi.inf (78%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog.inf (78%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.inf (77%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.inf (64%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.inf (78%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiInit.inf (79%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiInit.inf (78%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLib.inf (80%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf (74%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.inf (79%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStatus.inf (66%)
rename {Platform/Intel/AdvancedFeaturePkg/S3 => Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.inf (52%)
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf (88%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLib/UserPasswordLib.inf (91%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordUiLib/UserPasswordUiLib.inf (91%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthentication2Dxe.inf (92%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxe.inf (93%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationSmm.inf (92%)
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Include/Library/Usb3DebugPortLib.h (100%)
rename Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameterLib.h => Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortParamLib.h (100%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/IpmiCommandLib.h (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/IpmiPlatformHookLib.h (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/SmbiosBasic.h (90%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Guid/UserAuthentication.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/PlatformPasswordLib.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPasswordLib.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPasswordUiLib.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/KeyService.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthentication2Dxe.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxe.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxeFormset.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationSmm.h (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxeVfr.vfr (100%)
create mode 100644 Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c
rename {Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebug.c (90%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/MiscServices.c (100%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c (96%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c (96%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c (95%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c (95%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c (100%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c (95%)
rename {Platform/Intel/DebugFeaturePkg => Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c (95%)
rename Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.c => Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.c (92%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.c (95%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.c (94%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiInit.c (93%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiInit.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.c (94%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStatus.c (94%)
rename {Platform/Intel/AdvancedFeaturePkg/S3 => Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/SmbiosBasicEntryPoint.c (89%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type0BiosVendorFunction.c (95%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type1SystemManufacturerFunction.c (96%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type32BootInformationFunction.c (100%)
rename {Platform/Intel/AdvancedFeaturePkg/Smbios => Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLib/UserPasswordLib.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordUiLib/UserPasswordUiLib.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/KeyService.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthentication2Dxe.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxe.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxePassword.c (100%)
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationSmm.c (100%)
delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c
rename {Platform/Intel/DebugFeaturePkg/AcpiDebug => Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/AcpiDebug.asl (95%)
create mode 100644 Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md
create mode 100644 Features/Intel/Debugging/Readme.md
create mode 100644 Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md
create mode 100644 Features/Intel/Network/NetworkFeaturePkg/Readme.md
create mode 100644 Features/Intel/Network/Readme.md
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt/BmcSsdt.asl (87%)
rename {Platform/Intel/AdvancedFeaturePkg/Ipmi => Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt/IpmiOprRegions.asi (91%)
create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md
create mode 100644 Features/Intel/OutOfBandManagement/Readme.md
create mode 100644 Features/Intel/PowerManagement/Readme.md
create mode 100644 Features/Intel/PowerManagement/S3FeaturePkg/Readme.md
create mode 100644 Features/Intel/Readme.md
create mode 100644 Features/Intel/SystemInformation/Readme.md
create mode 100644 Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md
create mode 100644 Features/Intel/TemplateFeaturePkg/Readme.md
create mode 100644 Features/Intel/UserInterface/Readme.md
rename {Platform/Intel/UserInterfaceFeaturePkg => Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni (100%)
create mode 100644 Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md
rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication => Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm}/UserAuthenticationDxeStrings.uni (100%)
delete mode 100644 Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 01/49] AdvancedFeaturePkg: Package DSC style cleanup
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 01/49] AdvancedFeaturePkg: Package DSC style cleanup Kubacki, Michael A
2019-11-14 2:00 ` Chaganty, Rangasai V
@ 2019-11-15 23:47 ` Nate DeSimone
1 sibling, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:47 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:27 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 01/49] AdvancedFeaturePkg: Package DSC style cleanup
This change refactors AdvancedFeaturePkg.dsc to consolidate redundant sections and better group file content to improve maintainability and readability.
This pattern is being applied in all Minimum Platform package DSC files.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 133 +++++++++++---------
1 file changed, 71 insertions(+), 62 deletions(-)
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index b2e7ab8302..b83e72b48c 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -1,5 +1,5 @@
## @file
-# Platform description.
+# Advanced Feature Package build description file.
#
# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR> # @@ -24,8 +24,7 @@
################################################################################
#
-# SKU Identification section - list of all SKU IDs supported by this
-# Platform.
+# SKU Identification section - list of all SKU IDs supported.
#
################################################################################
[SkuIds]
@@ -33,88 +32,93 @@
################################################################################
#
-# Pcd Section - list of all EDK II PCD Entries defined by this Platform
+# Pcd Section - list of all EDK II PCD Entries defined by this package.
#
################################################################################
-
+
[PcdsFeatureFlag]
################################################################################
#
-# Library Class section - list of all Library Classes needed by this Platform.
+# Library Class section - list of all Library Classes needed by this package.
#
################################################################################
[LibraryClasses.common]
-
- PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
- PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
- DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
- SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
- PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
-
- #
- # Basic
- #
+ #######################################
+ # Edk2 Packages
+ #######################################
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
-
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+
+ BasePciLibPciExpress|MdePkg/Library/BasePciLibPciExpress/BasePciLibPci
+ Express.inf
+ CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMa
+ intenanceLib.inf
CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+
+ DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.i
+ nf DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+
+ DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTabl
+ eLib.inf HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
- PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
- PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
- BasePciLibPciExpress|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
-# PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
- CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
- PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+ PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
+
+ PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci
+ .inf
+ PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BaseP
+ eCoffExtraActionLibNull.inf
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+ PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+
+ PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.i
+ nf PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
+ PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+
+ PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibId
+ t/PeiServicesTablePointerLibIdt.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+
+ ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRep
+ ortStatusCodeLibNull.inf
+ SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPo
+ rtLib16550.inf
SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
- #
- # UEFI & PI
- #
+
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTempl
+ ate.inf
+ UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/Uef
+ iApplicationEntryPoint.inf
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
- UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
-
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
- PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
- PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
-
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
-
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
-
- TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
-
- IpmiPlatformHookLib|AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
- IpmiLib|AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
+
+ UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompr
+ essLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEnt
+ ryPoint.inf
+ UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServ
+ icesLib.inf UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib
+ /UefiRuntimeServicesTableLib.inf
+
+ #######################################
+ # Advanced Feature Package
+ #######################################
IpmiCommandLib|AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf
+ IpmiLib|AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
+
+ IpmiPlatformHookLib|AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLi
+ bNull/IpmiPlatformHookLibNull.inf
[LibraryClasses.common.SEC,LibraryClasses.common.PEI_CORE,LibraryClasses.common.PEIM]
- PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+
+ #######################################
+ # Silicon Initialization Package
+ #######################################
SmmAccessLib|IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.inf
[LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE,LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRIVER,LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION]
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
[LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE]
+ #######################################
+ # Edk2 Packages
+ #######################################
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
###################################################################################################
@@ -137,20 +141,25 @@
###################################################################################################
[Components]
+ #######################################
+ # Advanced Feature Package
+ #######################################
- AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
+ # Add library instances here that are not included in package
+ components and should be tested # in the package build.
- AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
- AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf
- AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf
+ # Add components here that should be included in the package build.
+ AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
+ AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf
+ AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf
+ AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
+ AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf
+ AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf
AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf
- AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
- AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
- AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
-
AdvancedFeaturePkg/S3/S3Pei.inf
+ AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
[BuildOptions]
- *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES \ No newline at end of file
+ *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 02/49] DebugFeaturePkg: Package DSC style cleanup
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 02/49] DebugFeaturePkg: " Kubacki, Michael A
@ 2019-11-15 23:47 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:47 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A; +Cc: Dong, Eric, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:27 PM
To: devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 02/49] DebugFeaturePkg: Package DSC style cleanup
This change refactors DebugFeaturePkg.dsc to consolidate redundant sections and better group file content to improve maintainability and readability.
This pattern is being applied in all Minimum Platform package DSC files.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc | 55 +++++++++++++-------
1 file changed, 37 insertions(+), 18 deletions(-)
diff --git a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
index 8e5ff4c9a3..efe705bd76 100644
--- a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
+++ b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
@@ -1,6 +1,6 @@
## @file
# This package provides the modules that build for debug feature.
-# This DebugFeaturePkg should only depend on EDKII Core packages and MinPlatformPkg.
+# This package should only depend on EDKII Core packages and MinPlatformPkg.
#
# The DEC files are used by the utilities that parse DSC and # INF files to generate AutoGen.c and AutoGen.h files @@ -23,46 +23,58 @@
SKUID_IDENTIFIER = DEFAULT
[LibraryClasses]
- #
- # Entry point
- #
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ #######################################
+ # Edk2 Packages
+ #######################################
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiB
+ ootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEnt
+ ryPoint.inf
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
[LibraryClasses.common.PEIM]
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
- #Usb3DebugPortLib|DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
-
-[LibraryClasses.IA32.PEIM, LibraryClasses.X64.PEIM]
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
[LibraryClasses.common.DXE_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
[LibraryClasses.common.UEFI_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
[LibraryClasses.common.DXE_RUNTIME_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
[LibraryClasses.common.DXE_SMM_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
@@ -87,13 +99,20 @@
###################################################################################################
[Components]
- DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf
- DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
- DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
+ #######################################
+ # Debug Feature Package
+ #######################################
+
+ # Add library instances here that are not included in package
+ components and should be tested # in the package build.
+ DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf
+ DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf
- DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
+ DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
+
+ DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortPara
+ meterLibPcd.inf
+ # Add components here that should be included in the package build.
DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 03/49] UserInterfaceFeaturePkg: Package DSC style cleanup
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 03/49] UserInterfaceFeaturePkg: " Kubacki, Michael A
@ 2019-11-15 23:47 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:47 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A; +Cc: Bi, Dandan, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:27 PM
To: devel@edk2.groups.io
Cc: Bi, Dandan <dandan.bi@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 03/49] UserInterfaceFeaturePkg: Package DSC style cleanup
This change refactors UserInterfaceFeaturePkg.dsc to consolidate redundant sections and better group file content to improve maintainability and readability.
This pattern is being applied in all Minimum Platform package DSC files.
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc | 45 ++++++++++++++------
1 file changed, 33 insertions(+), 12 deletions(-)
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc b/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
index 6c5f77b59b..bd09052f3c 100644
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
+++ b/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
@@ -1,5 +1,6 @@
## @file
# This package provides UI related modules.
+# This package should only depend on EDKII Core packages and MinPlatformPkg.
#
# The DEC files are used by the utilities that parse DSC and # INF files to generate AutoGen.c and AutoGen.h files @@ -22,32 +23,45 @@
SKUID_IDENTIFIER = DEFAULT
[LibraryClasses]
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ #######################################
+ # Edk2 Packages
+ #######################################
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
- IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
- TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTempl
+ ate.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiB
+ ootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEnt
+ ryPoint.inf
+ UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServ
+ icesLib.inf UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib
+ /UefiRuntimeServicesTableLib.inf
+
+ #####################################
+ # User Interface Feature Package
+ #####################################
PlatformPasswordLib|UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
UserPasswordLib|UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
[LibraryClasses.common.DXE_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
[LibraryClasses.common.DXE_SMM_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
- BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
###################################################################################################
#
@@ -68,10 +82,17 @@
#
###################################################################################################
[Components]
+ #####################################
+ # User Interface Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package
+ components and should be tested # in the package build.
UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
+ # Add components here that should be included in the package build.
UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf
UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf
UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 04/49] Features/Intel: Add Readme.md
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 04/49] Features/Intel: Add Readme.md Kubacki, Michael A
@ 2019-11-15 23:47 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:47 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io
Cc: Bi, Dandan, Chaganty, Rangasai V, Chiu, Chasel, Wei, David Y,
Dong, Eric, Gao, Liming, Agyeman, Prince
Readme.md, line 211: Please also add a Linux/Mac example.
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Bi, Dandan <dandan.bi@intel.com>; Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>; Wei, David Y <david.y.wei@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-platforms][PATCH V1 04/49] Features/Intel: Add Readme.md
This change adds the initial Readme.md to the root of the Features/ Intel directory. The features are maintained in an Intel directory because they are not tested on other systems. If there is interest to support a feature on systems other than Intel, the feature should be tested on those other systems and the feature can be promoted above the Intel directory.
This Readme.md is the most important file in the Features/Intel tree as it provides the desired attributes and definition of advanced features, the advanced feature source layout, and the new feature creation checklist. This is the primary documentation file for new users to understand advanced features.
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Wei David Y <david.y.wei@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Agyeman Prince <prince.agyeman@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/Readme.md | 232 ++++++++++++++++++++
1 file changed, 232 insertions(+)
diff --git a/Features/Intel/Readme.md b/Features/Intel/Readme.md new file mode 100644 index 0000000000..a2b081eb37
--- /dev/null
+++ b/Features/Intel/Readme.md
@@ -0,0 +1,232 @@
+# **EDK II Minimum Platform Firmware Advanced Features for Intel®
+Platforms**
+
+In the EDK II Minimum Platform, advanced features are non-essential
+features. Essential features are those required to achieve an earlier
+boot stage (Stage I through Stage V). The Minimum Platform boot stages
+are defined in the [EDK II Minimum Platform Draft Specification](https://edk2-docs.gitbooks.io/edk-ii-minimum-platform-specification/). A brief overview is also provided in the [Platfom/Intel/Readme.md](https://github.com/tianocore/edk2-platforms/blob/master/Platform/Intel/Readme.md).
+
+An advanced feature must be implemented as highly cohesive and
+stand-alone software to only support a specific feature. Advanced features are the primary method to extend platform firmware capabilities in a modular fashion.
+
+If you would like to quickly get started creating a new advanced
+feature, you can jump ahead to the [Add New Advanced Feature
+Checklist](#Add-New-Advanced-Feature-Checklist) and reference other sections of this document as needed.
+
+## Overview
+
+### Advanced Feature Attributes
+Advanced features should be:
+* _Cohesive_, the feature should not contain any functionality unrelated to the feature.
+* _Complete_, the feature must have a complete design that minimizes
+dependencies. A feature package cannot directly
+ depend on another feature package.
+* _Easy to Integrate_, the feature should expose well-defined software interfaces to use and configure the feature.
+ * It should also present a set of simple and well-documented standard
+EDK II configuration options such as PCDs to
+ configure the feature.
+ * In general, features should be self-contained and started by the dispatcher. The board firmware should
+ be required to perform as few steps as possible to enable the feature.
+ * All features are required to have a feature enable PCD (`PcdFeatureEnable`). Any effort to enable the feature
+ besides this PCD should be carefully considered. Default configuration values should apply to the common case.
+* _Portable_, the feature is not allowed to depend on other advanced
+feature or board source code packages. For example,
+ if Feature A depends on output Feature B, a board integration module
+should use a generic interface in Feature A
+ to get the output and pass it to a generic interface in Feature B.
+Structures should not be shared between feature
+ packages. Most structures should be defined in a common package such
+as MdePkg if the structure is industry standard,
+ IntelSiliconPkg if the structure is specific to Intel silicon
+initialization, etc. Feature-specific structures are
+ of course allowed to be defined within a feature package and used by libraries and modules in that package.
+* _Self Documenting_, the feature should follow software best practices
+to allow others to debug the code and
+ contribute changes. In addition to source code, advanced features
+must have a Readme.md with sufficient
+ information for a newcomer to understand the feature.
+* _Single Instance_, the feature should not have more than one instance
+of a source solution. If an existing feature
+ package does not solve a specific instance of a problem for the
+feature, the feature package should be re-worked
+ to consider new requirements instead of duplicating feature code.
+
+ Features should be written for a specific feature technology. Outside
+ of technology restrictions, the feature should not make arbitrary
+ assumptions about the type of board or system that may integrate the
+ feature. Any board or hardware-specific details that may vary in design should be given to the feature through a defined and documented software interface.
+
+### Advanced Feature Packages
+Feature portability is a key aspect of board scalability. To maintain
+high cohesion within a feature package and reduce potential coupling
+between features, each feature is maintained in a dedicated package.
+Such encapsulation enables increased flexibility in implementation, rapid integration with board firmware, improved software maintenance by reducing coupling between features, and a better scope for feature-focused maintenance and testing over time.
+
+Two package types exist for advanced features:
+ * AdvancedFeaturePkg - A special package described further in [AdvancedFeaturePkg](#AdvancedFeaturePkg).
+ * XxxFeaturePkg - A specific feature package described further in [XxxFeaturePkg](#XxxFeaturePkg).
+
+#### AdvancedFeaturePkg
+A single package called `AdvancedFeaturePkg` exists with the following responsibilities:
+1. Present a consolidated and simplified view of all available advanced features to board packages.
+2. Provide a single package build for all available advanced features.
+ 2.a. This can save time. Each feature package will send build output to a package-specific build output directory.
+ By building a features from a single package build object files can be reused across features.
+
+##### Template Resources
+A template for a new advanced feature package is provided in
+`TemplateFeaturePkg`. It is recommended to start a new advanced feature
+package using this template. The minimally required set of files for an
+advanced feature to be acceptable is defined in [Advanced Feature Collateral](#Advanced-Feature-Collateral). Apart from required files, the content organization within the files should follow the layout provided in the template files.
+
+##### Consolidated View of All Advanced Features to Board Packages A
+board package may consume any number of advanced features. In order to
+reduce the overall effort required to add advanced features, all available advanced features are consolidated into single includable files in `AdvancedFeaturePkg`.
+
+_DSC File_
+
+All advanced features are importable to a board package DSC file by simply including `AdvancedFeatures.dsc`.
+`AdvancedFeatures.dsc` already includes the conditional logic to only include features that are enabled by the board package.
+
+_FDF File_
+
+The EDK II Minimum Platform has two firmware volumes to contain advanced features.
+
+1. `FvAdvancedPreMemory` - Contains advanced feature modules that should be dispatched before permanent memory is enabled.
+ Typically, these are PEI modules (PEIMs).
+2. `FvAdvanced` - Contains advanced feature modules that do not need to be executed prior to permanent memory being
+ initialized. Typically, these are post-memory PEIMs or DXE modules.
+
+##### Single Build of All Advanced Features With many advanced feature
+packages, it is convenient to have a single build target that can build all advanced features.
+The `AdvancedFeaturePkg.dsc` enables all the advanced features for its package build.
+
+#### XxxFeaturePkg
+Each feature is maintained in its own feature package called
+`XxxFeaturePkg` where *Xxx* is replaced by the feature name.
+
+### Source Code Organization of Advanced Features All advanced feature
+code is maintained in `edk2-platforms/Features`. Features that are only
+tested on Intel systems are maintained in `edk2-platforms/Features/Intel`. These features are not intended to be constrained to Intel systems.
+
+A package resides at the root of `edk2-platforms/Features/Intel` called [AdvancedFeaturePkg](#AdvancedFeaturePkg).
+All feature packages are organized into directories by feature domain.
+Each feature domain directory is required to have a `Readme.md` that
+explains the scope of features for that domain. Each feature package is
+required to have a `Readme.md` that explain the feature. All feature
+packages are required to base their `Readme.md` on the
+[template](TemplateFeaturePkg/Readme.md) provided in `TemplateFeaturePkg`.
+
+A generic tree layout of the advanced features is illustrated below.
+The contents are shown at the time of writing but of course, are subject to change over time.
+
+ <pre>
+ WORKSPACE
+ |------edk2
+ |------edk2-non-osi
+ |------edk2-platforms
+ | |---Features
+ | | |--Intel
+ | | |------AdvancedFeaturePkg
+ | | |
+ | | |------TemplateFeaturePkg
+ | | |
+ | | |------Debugging: Debug related advanced features
+ | | | |------AcpiDebugFeaturePkg
+ | | | | |---AcpiDebugDxeSmm (module directories)
+ | | | | |---. . .
+ | | | | |---Include
+ | | | | | |---AcpiDebugFeature.dsc (feature build DSC file)
+ | | | | | |---PostMemory.fdf (post-memory feature modules)
+ | | | | | |---PreMemory.fdf (pre-memory feature modules)
+ | | | | | |---. . .
+ | | | | |---AcpiDebugFeaturePkg.dec (feature package DEC file)
+ | | | | |---AcpiDebugFeature.dsc (feature package build DSC file)
+ | | | |
+ | | | |------Usb3DebugFeaturePkg
+ | | | | |---. . .
+ | | | |
+ | | | |------. . .
+ | | |------Network: Network related advanced features
+ | | | |------. . .
+ | | |
+ | | |------OutOfBandManagement: Out-of-Band Management related advanced features
+ | | | |------. . .
+ | | |
+ | | |------PowerManagement: Power Management related advanced features
+ | | | |------. . .
+ | | |
+ | | |------SystemInformation: System Information related advanced features
+ | | | |------. . .
+ | | |
+ | | |------UserInterface: User Interface related advanced features
+ | | | |------. . .
+ | | |
+ |------FSP
+ </pre>
+
+## Adding a New Advanced Feature
+
+### Advanced Feature Collateral
+At a minimum, an advanced feature must consist of the following elements:
+1. A feature package directory (`XxxFeaturePkg`) 2. A `Readme.md` file
+in the feature package directory root to describe the feature 3. Some
+advanced feature source code (e.g. a PEI or DXE module) 4. A feature
+DSC file (`XxxFeaturePkg/Include/XxxFeature.dsc`)
+5. Feature pre-memory / post-memory FDF files
+(`XxxFeaturePkg/Include/PreMemory.fdf` &
+`XxxFeaturePkg/Include/PostMemory.fdf`)
+6. A feature package DSC file (`XxxFeaturePkg/XxxFeaturePkg.dsc`)
+7. A feature package DEC file (`XxxFeaturePkg/XxxFeaturePkg.dec`)
+8. A reference in the `AdvancedFeaturePkg` as described in the
+[checklist](#Add-New-Advanced-Feature-Checklist)
+
+### Add New Advanced Feature Checklist
+1. Check if a feature package already exists for your new feature.
+ * If it does, use the existing feature package. If changes are needed to meet your requirements, work with the
+ package maintainer to make any required updates to the existing package.
+
+2. Determine the functional domain of your feature. For example, "Debugging", "Power Management", etc. This should not be
+ very specific and abstracted so the feature is available alongside similar feature packages for the given domain. It
+ is preferred to keep the number of feature domain directories minimal but new directories can be created if needed.
+
+3. Decide on a succinct name for your feature package.
+ * The name should be descriptive enough to uniquely identify the feature from similar features in the same feature
+ domain.
+
+ * At this point, the feature package location is: `FeatureDomain/<Xxx>FeaturePkg`.
+
+ * For example, the ACPI Debug feature is located in `Debugging/AcpiDebugFeaturePkg` based on this naming pattern.
+
+4. Use the package template provided by `TemplateFeaturePkg` to create a new advanced feature package in the
+ feature location.
+
+5. Review the [advanced feature attributes](#Advanced-Feature-Attributes) to draft a feature design proposal.
+ * It is recommended to use the template in `TemplateFeaturePkg/Readme.md` to document the feature design for review.
+ Once the design review is approved, a subsequent review can be sent for the feature implementation. An advantage to
+ this approach is that the requirement to complete a Readme.md file for the feature and gain approval in a feature
+ design review are combined into a single step.
+
+6. Add the source code for the advanced feature.
+ * If the feature is large it is recommended to add libraries in one patch and then modules in a following patch.
+
+7. Update the feature DSC file. This file is in `XxxFeaturePkg/Include/XxxFeature.dsc`.
+ * In most cases, `XxxFeaturePkg/XxxFeaturePkg.dsc` should just `!include XxxFeaturePkg/Include/XxxFeature.dsc`.
+
+8. Update the feature FDF files. These files are `XxxFeaturePkg/Include/PreMemory.fdf` and
+ `XxxFeaturePkg/Include/PostMemory.fdf`.
+ * Each file should contain the feature pre-memory modules and post-memory modules respectively.
+
+9. Build the advanced feature package to ensure the build is successful:
+
+ From the workspace root:
+ 1. cd edk2-platforms/edk2
+ 2. Execute edksetup.bat (Windows) or edksetup.sh (Linux).
+ 3. Verify the "WORKSPACE" environment variable is set to the edk2 directory in your workspace.
+ 4. Set the "PACKAGES_PATH" environment variable to include the edk2-platforms/Platform/Intel, edk2-platforms/Silicon/Intel,
+ and edk2-platforms/Features/Intel directories.
+ * Windows example:
+ * set PACKAGES_PATH=c:\Edk2Workspace\edk2-platforms\Platform\Intel;
+ c:\Edk2Workspace\edk2-platforms\Silicon\Intel;
+ c:\Edk2Workspace\edk2-platforms\Features\Intel
+ 5. cd edk2-platforms/Features/Intel
+ 6. <pre>build -p
+ FeatureDomainDirectory/XxxFeaturePkg/XxxFeaturePkg.dsc -a IA32 -a
+ X64</pre>
+
+ *Note:* -a specifies the architecture. Typically IA32 and X64 modules are built for 32-bit PEI and 64-bit
+ DXE though build for your specific requirements.
+
+10. Add the advanced feature to `AdvancedFeaturePkg` so it is available to board packages.
+ 1. Add `XxxFeaturePkg/Include/XxxFeature.dsc` to `AdvancedFeatures.dsc`
+ 2. Add `XxxFeaturePkg/Include/PreMemory.fdf` to `AdvancedFeaturePkg/Include/PreMemory.fdf`
+ 3. Add `XxxFeaturePkg/Include/PostMemory.fdf` to
+`AdvancedFeaturePkg/Include/PostMemory.fdf`
+
+11. Build `AdvancedFeaturePkg` to ensure the build is successful.
+ 1. Follow the steps in step #9 but change the build command to:
+
+ <pre>build -p AdvancedFeaturePkg/AdvancedFeaturePkg.dsc -a IA32 -a
+ X64</pre>
+
+12. Before sending your patch series, ensure the `Readme.md` file in `XxxFeaturePkg` is completed so others can use it
+ during the feature review.
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 05/49] Features/Intel/PowerManagement: Add Readme.md
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 05/49] Features/Intel/PowerManagement: " Kubacki, Michael A
@ 2019-11-15 23:47 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:47 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 05/49] Features/Intel/PowerManagement: Add Readme.md
Adds the Readme.md file to briefly explain the types of features supported in the PowerManagement feature domain directory.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/PowerManagement/Readme.md | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Features/Intel/PowerManagement/Readme.md b/Features/Intel/PowerManagement/Readme.md
new file mode 100644
index 0000000000..f539fbd2ec
--- /dev/null
+++ b/Features/Intel/PowerManagement/Readme.md
@@ -0,0 +1,10 @@
+# **EDK II Minimum Platform Firmware Power Management Advanced
+Features**
+
+This feature domain directory contains power management related advanced features.
+
+Features may be added to this domain whose primary role and
+responsibility is related to power management including support for
+various power states such as device power states (Dx), system sleep
+states (Sx), processor power states (Cx), performance states (Px), etc.
+Firmware power management responsibilities are largely defined by the
+[Advanced Configuration Configuration and Power Interface Specification](https://uefi.org/specifications) though features in this domain may be written to other specifications or not defined in a specification at all. In any case, the `Readme.md` file in the feature package should reference all relevant documentation to the feature.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 06/49] Features/Intel/OutOfBandManagement: Add Readme.md
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 06/49] Features/Intel/OutOfBandManagement: " Kubacki, Michael A
@ 2019-11-15 23:47 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:47 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 06/49] Features/Intel/OutOfBandManagement: Add Readme.md
Adds the Readme.md file to briefly explain the types of features supported in the OutOfBandManagement feature domain directory.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/OutOfBandManagement/Readme.md | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Features/Intel/OutOfBandManagement/Readme.md b/Features/Intel/OutOfBandManagement/Readme.md
new file mode 100644
index 0000000000..dc526029a7
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/Readme.md
@@ -0,0 +1,8 @@
+# **EDK II Minimum Platform Firmware Out-of-Band Management Advanced
+Features**
+
+This feature domain directory contains out-of-band management related advanced features.
+
+Features may be added to this domain whose primary role and
+responsibility is related to out-of-band management. These are features
+that typically interface with an external controller to enable system
+maintenance operations such as monitoring, logging, and recovery control functions independent of the main processors, host CPU firmware (BIOS), and host operating system. An out-of-band controller is usually available when the system is in a powered down state.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 07/49] Features/Intel/SystemInformation: Add Readme.md
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 07/49] Features/Intel/SystemInformation: " Kubacki, Michael A
@ 2019-11-15 23:47 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:47 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 07/49] Features/Intel/SystemInformation: Add Readme.md
Adds the Readme.md file to briefly explain the types of features supported in the SystemInformation feature domain directory.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/SystemInformation/Readme.md | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Features/Intel/SystemInformation/Readme.md b/Features/Intel/SystemInformation/Readme.md
new file mode 100644
index 0000000000..cdf061d08d
--- /dev/null
+++ b/Features/Intel/SystemInformation/Readme.md
@@ -0,0 +1,8 @@
+# **EDK II Minimum Platform Firmware System Information Advanced
+Features**
+
+This feature domain directory contains advanced features that produce system information.
+
+Features may be added to this domain whose primary role and
+responsibility is related to producing structures for system
+information. The system information structures supported should be
+standardized in a public document such as an industry standard specification or white paper. The feature documentation must be referenced in the `Readme.md` file in the feature package.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 08/49] Features/Intel/Debug: Add Readme.md
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 08/49] Features/Intel/Debug: " Kubacki, Michael A
@ 2019-11-15 23:47 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:47 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 08/49] Features/Intel/Debug: Add Readme.md
Adds the Readme.md file to briefly explain the types of features supported in the Debug feature domain directory.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/Debugging/Readme.md | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Features/Intel/Debugging/Readme.md b/Features/Intel/Debugging/Readme.md
new file mode 100644
index 0000000000..08621154ec
--- /dev/null
+++ b/Features/Intel/Debugging/Readme.md
@@ -0,0 +1,7 @@
+# **EDK II Minimum Platform Firmware Debug Advanced Features**
+
+This feature domain directory contains debug related advanced features. Note that the directory is named "Debugging"
+as opposed to "Debug" to help indicate the directory is related to containing build files for a Debug build target.
+
+Features may be added to this domain whose primary role and
+responsibility is related to debug. The type of debug technology may include hardware or software debug.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 09/49] Features/Intel/UserInterface: Add Readme.md
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 09/49] Features/Intel/UserInterface: " Kubacki, Michael A
@ 2019-11-15 23:47 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:47 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 09/49] Features/Intel/UserInterface: Add Readme.md
Adds the Readme.md file to briefly explain the types of features supported in the UserInterface feature domain directory.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/UserInterface/Readme.md | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Features/Intel/UserInterface/Readme.md b/Features/Intel/UserInterface/Readme.md
new file mode 100644
index 0000000000..2ef4413ade
--- /dev/null
+++ b/Features/Intel/UserInterface/Readme.md
@@ -0,0 +1,9 @@
+# **EDK II Minimum Platform Firmware User Interface Features**
+
+This feature domain directory contains user interface related advanced features.
+
+Features may be added to this domain whose primary role and
+responsibility is related to user interfaces. This may include any
+number of interfaces related to user interaction with the system that
+require firmware support. High-level examples of common user interfaces
+in firmware are console support and Human Interface Infrastructure (HII). These high-level categories may comprise multiple independent features. It is recommended to reduce individual feature scope to the minimally required level for the feature to be functional to improve cohesion within the feature package.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 10/49] Features/Intel/Network: Add Readme.md
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 10/49] Features/Intel/Network: " Kubacki, Michael A
@ 2019-11-15 23:47 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:47 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 10/49] Features/Intel/Network: Add Readme.md
Adds the Readme.md file to briefly explain the types of features supported in the Network feature domain directory.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/Network/Readme.md | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Features/Intel/Network/Readme.md b/Features/Intel/Network/Readme.md
new file mode 100644
index 0000000000..780a1264ac
--- /dev/null
+++ b/Features/Intel/Network/Readme.md
@@ -0,0 +1,5 @@
+# **EDK II Minimum Platform Firmware Network Features**
+
+This feature domain directory contains network related advanced features.
+
+Features may be added to this domain whose primary role and responsibility is related to network technologies.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 11/49] TemplateFeaturePkg: Add initial package
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 11/49] TemplateFeaturePkg: Add initial package Kubacki, Michael A
@ 2019-11-15 23:48 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:48 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-platforms][PATCH V1 11/49] TemplateFeaturePkg: Add initial package
This change adds a new package called TemplateFeaturePkg that should be used as a starting point for the creation of new advanced feature packages.
TemplateFeaturePkg is not meant to be built or used directly for functionality. It simply serves as a template to be copied and modified. The advanced feature package creation process is described in detail in Features/Intel/Readme.md.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec | 30 ++++++
Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc | 113 ++++++++++++++++++++
Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc | 30 ++++++
Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf | 8 ++
Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf | 8 ++
Features/Intel/TemplateFeaturePkg/Readme.md | 71 ++++++++++++
6 files changed, 260 insertions(+)
diff --git a/Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec b/Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec
new file mode 100644
index 0000000000..b37ce8f34a
--- /dev/null
+++ b/Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for <TEMPLATE> support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and # INF
+files to generate AutoGen.c and AutoGen.h files # for the build
+infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = TemplateFeaturePkg
+ PACKAGE_GUID = 00000000-0000-0000-0000-000000000000
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[LibraryClasses]
+
+[Guids]
+ gTemplateFeaturePkgTokenSpaceGuid = {0x00000000, 0x0000, 0x0000,
+{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}
+
+[PcdsFeatureFlag]
+
+gTemplateFeaturePkgTokenSpaceGuid.PcdTemplateFeatureEnable|FALSE|BOOLEA
+N|0xA0000001
diff --git a/Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc b/Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc
new file mode 100644
index 0000000000..6742eddcf9
--- /dev/null
+++ b/Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc
@@ -0,0 +1,113 @@
+## @file
+# This is a build description file for the <TEMPLATE> advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and # INF
+files to generate AutoGen.c and AutoGen.h files # for the build
+infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+#######################################################################
+#########
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+#######################################################################
+#########
+[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
+
+#######################################################################
+#########
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+#######################################################################
+#########
+[LibraryClasses]
+
+ ## Note: This comment block should be removed from the template when the
+ # template is used.
+ #
+ # Library classes should have a comment header that describes the
+ type of # package the library is used from for organization purposes.
+ #
+ # For an advanced feature, these are typically:
+ # * Edk2 Packages
+ # * Silicon Initialization Package
+ # * Platform Package
+ # * Feature Package
+ #
+ # The comment header should follow the format:
+ #
+ # #######################################
+ # # Edk2 Packages
+ # #######################################
+
+#######################################################################
+#########
+#
+# Component section - list of all components that need built for this feature.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+#######################################################################
+#########
+
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # <TEMPALTE> Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package
+ components and should be tested # in the package build.
+
+ # Add components here that should be included in the package build.
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
+ #####################################
+ # <TEMPLATE> Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package
+ components and should be tested # in the package build.
+
+ # Add components here that should be included in the package build.
+
+#######################################################################
+############################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
+#######################################################################
+############################
+[BuildOptions]
diff --git a/Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc b/Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc
new file mode 100644
index 0000000000..0ce8debee0
--- /dev/null
+++ b/Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for <TEMPLATE> support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and # INF
+files to generate AutoGen.c and AutoGen.h files # for the build
+infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+[Defines]
+ PLATFORM_NAME = TemplateFeaturePkg
+ PLATFORM_GUID = 00000000-0000-0000-0000-000000000000
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#
+# This package always builds the feature.
+#
+!include Include/TemplateFeature.dsc
diff --git a/Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf b/Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..86225cefbe
--- /dev/null
+++ b/Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for post-memory <TEMPLATE> advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
diff --git a/Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf b/Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..5ce30af174
--- /dev/null
+++ b/Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory <TEMPLATE> advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
diff --git a/Features/Intel/TemplateFeaturePkg/Readme.md b/Features/Intel/TemplateFeaturePkg/Readme.md
new file mode 100644
index 0000000000..90be279ae3
--- /dev/null
+++ b/Features/Intel/TemplateFeaturePkg/Readme.md
@@ -0,0 +1,71 @@
+# Overview
+* **Feature Name:** <Feature Name>
+* **PI Phase(s) Supported:** <PI Phases Supported>
+* **SMM Required?** <Yes/No>
+
+## Purpose
+Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph.
+
+# High-Level Theory of Operation
+A description of how the device works at a high-level.
+
+The description should not be constrained to implementation details but
+provide a simple mental model of how the feature is supposed to work.
+
+## Firmware Volumes
+A bulleted list of the firmware volumes that feature module(s) are placed in.
+
+## Modules
+A bulleted list of the modules that make up the feature.
+
+## <Module Name>
+Each module in the feature should have a section that describes the
+module in a level of detail that is useful to better understand the module source code.
+
+## <Library Name>
+Each library in the feature should have a section that describes the
+library in a level of detail that is useful to better understand the library source code.
+
+## Key Functions
+A bulleted list of key functions for interacting with the feature.
+
+Not all features need to be listed. Only functions exposed through
+external interfaces that are important for feature users to be aware of.
+
+## Configuration
+Information that is useful for configuring the feature.
+
+Not all configuration options need to be listed. This section is used
+to provide more background on configuration options than possible elsewhere.
+
+## Data Flows
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+Key control flows for the feature.
+
+## Build Flows
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or
+require non-standard tool configuration. If the standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the
+feature is successful. If the test point is not implemented, this should be stated.
+
+## Functional Exit Criteria
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board
+integrator can reference to ensure the feature is functional on their board.
+
+## Feature Enabling Checklist
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 12/49] SimicsOpenBoardPkg: Remove advanced feature references
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 12/49] SimicsOpenBoardPkg: Remove advanced feature references Kubacki, Michael A
@ 2019-11-15 23:48 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:48 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A; +Cc: Wei, David Y, Agyeman, Prince
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Wei, David Y <david.y.wei@intel.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 12/49] SimicsOpenBoardPkg: Remove advanced feature references
Removes references to advanced features in the package to prepare for an advanced feature refactor that will impact the location of features and details such as package names and PCD token space identifiers.
Cc: Wei David Y <david.y.wei@intel.com>
Cc: Agyeman Prince <prince.agyeman@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 17 -----------------
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc | 6 ------
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf | 8 --------
Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 1 -
4 files changed, 32 deletions(-)
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 35a8c7c765..761874de73 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -34,16 +34,7 @@
DEFINE SMM_REQUIRE = TRUE
- #
- # PLATFORMX64_ENABLE is set to TRUE when PEI is IA32 and DXE is X64 platform
- #
- DEFINE PLATFORMX64_ENABLE = TRUE
- DEFINE NETWORK_TLS_ENABLE = FALSE
- DEFINE NETWORK_ISCSI_ENABLE = FALSE
- DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
-
!include $(PROJECT)/OpenBoardPkgPcd.dsc
- !include NetworkPkg/NetworkDefines.dsc.inc
################################################################################
#
@@ -76,7 +67,6 @@
[Components.X64]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CoreDxeInclude.dsc
-!include AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
#######################################
# Build Option Includes
@@ -271,13 +261,6 @@
$(PLATFORM_PACKAGE)/Flash/SpiFvbService/SpiFvbServiceSmm.inf
!endif
- #######################################
- # Advanced Feature Package
- #######################################
-!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable == TRUE
- AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
-!endif
-
#######################################
# Board Package
#######################################
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc
index cd95755f91..1383a63d36 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.ds
+++ c
@@ -96,8 +96,6 @@
######################################
# Advanced Feature Configuration
######################################
- gAdvancedFeaturePkgTokenSpaceGuid.PcdNetworkEnable|TRUE
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable|TRUE
[PcdsFeatureFlag.X64]
######################################
@@ -252,10 +250,6 @@
######################################
# Advanced Feature Configuration
######################################
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|"2019-08-09"
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"Ver.1.0.0"
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"QSP UEFI BIOS"
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"QSP UEFI BIOS"
[PcdsDynamicExDefault]
######################################
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
index ef6b35c92f..d29835f606 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
@@ -155,7 +155,6 @@ INF MinPlatformPkg/PlatformInit/ReportFv/ReportFvPei.inf
INF MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
INF MinPlatformPkg/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMem.inf
!include MinPlatformPkg/Include/Fdf/CoreSecurityPreMemoryInclude.fdf
-!include AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf
INF $(BOARD_PKG)/SimicsPei/SimicsPei.inf
!include $(SKT_PKG)/SktPostMemoryInclude.fdf
!include $(PCH_PKG)/IchPostMemoryInclude.fdf
@@ -163,7 +162,6 @@ INF $(BOARD_PKG)/SimicsPei/SimicsPei.inf
INF MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.inf
INF MinPlatformPkg/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPostMem.inf
!include MinPlatformPkg/Include/Fdf/CoreSecurityPostMemoryInclude.fdf
-!include AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf
INF UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
INF $(SKT_PKG)/Smm/Access/SmmAccessPei.inf
@@ -238,12 +236,6 @@ INF ShellPkg/Application/Shell/Shell.inf
#
INF SimicsIch10BinPkg/UndiBinary/UndiDxe.inf
-!include AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
-
-!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable == TRUE
- INF AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
-!endif
-
!include MinPlatformPkg/Include/Fdf/CoreSecurityLateInclude.fdf
[FV.FVMAIN_COMPACT]
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index 3cc6a03564..f8ecab08e6 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatform
+++ Dxe.inf
@@ -31,7 +31,6 @@
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
SimicsOpenBoardPkg/OpenBoardPkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
BoardModulePkg/BoardModulePkg.dec
[LibraryClasses]
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 13/49] AdvancedFeaturePkg: Remove the S3 feature
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 13/49] AdvancedFeaturePkg: Remove the S3 feature Kubacki, Michael A
@ 2019-11-15 23:48 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:48 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 13/49] AdvancedFeaturePkg: Remove the S3 feature
Removes the S3 feature from AdvancedFeaturePkg. The feature does not follow the advanced feature design. A future change will add the feature back following the advanced feature design.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 6 ----
Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.inf | 31 -----------------
Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c | 36 --------------------
3 files changed, 73 deletions(-)
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index b83e72b48c..885b84e2df 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -102,11 +102,6 @@
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
- #######################################
- # Silicon Initialization Package
- #######################################
- SmmAccessLib|IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.inf
-
[LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE,LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRIVER,LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION]
#######################################
# Edk2 Packages
@@ -158,7 +153,6 @@
AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf
AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf
- AdvancedFeaturePkg/S3/S3Pei.inf
AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
[BuildOptions]
diff --git a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.inf b/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.inf
deleted file mode 100644
index 847edd20c0..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.inf
+++ /dev/null
@@ -1,31 +0,0 @@
-### @file
-# Component information file for the S3 PEI module.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -###
-
-[Defines]
- INF_VERSION = 0x00010017
- BASE_NAME = S3Pei
- FILE_GUID = 8683EFB2-FDE1-4AFF-B2DB-E96449FDD4E9
- VERSION_STRING = 1.0
- MODULE_TYPE = PEIM
- ENTRY_POINT = S3PeiEntryPoint
-
-[LibraryClasses]
- PeimEntryPoint
- PeiServicesLib
- SmmAccessLib
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelSiliconPkg/IntelSiliconPkg.dec
-
-[Sources]
- S3Pei.c
-
-[Depex]
- gEfiPeiMemoryDiscoveredPpiGuid
diff --git a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c b/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c
deleted file mode 100644
index b0aaa04962..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/** @file
- Source code file for S3 PEI module
-
-Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Library/PeiServicesLib.h>
-#include <Library/SmmAccessLib.h>
-
-/**
- S3 PEI module entry point
-
- @param[in] FileHandle Not used.
- @param[in] PeiServices General purpose services available to every PEIM.
-
- @retval EFI_SUCCESS The function completes successfully
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to create database
-**/
-EFI_STATUS
-EFIAPI
-S3PeiEntryPoint (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- EFI_STATUS Status;
-
- //
- // Install EFI_PEI_MM_ACCESS_PPI for S3 resume case
- //
- Status = PeiInstallSmmAccessPpi ();
-
- return Status;
-}
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 15/49] AdvancedFeaturePkg: Remove the IPMI feature
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 15/49] AdvancedFeaturePkg: Remove the IPMI feature Kubacki, Michael A
@ 2019-11-15 23:48 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:48 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 15/49] AdvancedFeaturePkg: Remove the IPMI feature
Removes the IPMI feature from AdvancedFeaturePkg. The feature does
not follow the advanced feature design. A future change will add
the feature back following the advanced feature design.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 11 -
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 59 -----
Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf | 48 ----
Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf | 34 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf | 37 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf | 37 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf | 35 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf | 34 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf | 32 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf | 32 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf | 28 --
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf | 29 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf | 34 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf | 38 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiCommandLib.h | 235 -----------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiPlatformHookLib.h | 23 --
Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c | 257 ------------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c | 236 -----------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c | 236 -----------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c | 84 ------
Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c | 67 -----
Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.c | 150 -----------
Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.c | 96 -------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c | 248 ------------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c | 101 -------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c | 275 --------------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c | 81 ------
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c | 45 ----
Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c | 36 ---
Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c | 112 --------
Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.c | 164 ------------
Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/BmcSsdt.asl | 28 --
Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOprRegions.asi | 58 -----
33 files changed, 3020 deletions(-)
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
index 44e5de64db..4f8300d145 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
@@ -22,7 +22,6 @@ PACKAGE_GUID = 290127D9-ABED-4DD8-A35D-73DCB4261BCB
[Includes]
Include
-Ipmi/Include
[Guids]
gAdvancedFeaturePkgTokenSpaceGuid = {0xa8514688, 0x6693, 0x4ab5, {0xaa, 0xc8, 0xcc, 0xa9, 0x8d, 0xde, 0x90, 0xe1}}
@@ -138,16 +137,6 @@ gAdvancedFeaturePkgTokenSpaceGuid = {0xa8514688, 0x6693, 0x4ab5, {0xaa,
}
gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation.BootStatus|BootInformationStatusNoError
-[PcdsFixedAtBuild]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels|0x3|UINT8|0x40000009
-
-[PcdsDynamic, PcdsDynamicEx]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress|0xCA2|UINT16|0x90000022
- gAdvancedFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag|TRUE|BOOLEAN|0x10000030
- gAdvancedFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue|360|UINT16|0x10000040
-
[PcdsFeatureFlag]
gAdvancedFeaturePkgTokenSpaceGuid.PcdNetworkEnable |FALSE|BOOLEAN|0xF00000A1
gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable |FALSE|BOOLEAN|0xF00000A2
- gAdvancedFeaturePkgTokenSpaceGuid.PcdIpmiEnable |FALSE|BOOLEAN|0xF00000A3
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index 885b84e2df..ca8db13f7c 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -50,58 +50,14 @@
#######################################
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
- BasePciLibPciExpress|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
- CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
- CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
- DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
- DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
- PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
- PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
- PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
- PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
- PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
- PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
- PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
- PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
- PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
- ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
- SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
- SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
- TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
- UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
- UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
- #######################################
- # Advanced Feature Package
- #######################################
- IpmiCommandLib|AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf
- IpmiLib|AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
- IpmiPlatformHookLib|AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
-
-[LibraryClasses.common.SEC,LibraryClasses.common.PEI_CORE,LibraryClasses.common.PEIM]
- #######################################
- # Edk2 Packages
- #######################################
- HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
- MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
- PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
-
[LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE,LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRIVER,LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION]
#######################################
# Edk2 Packages
@@ -110,12 +66,6 @@
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
-[LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE]
- #######################################
- # Edk2 Packages
- #######################################
- SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
-
###################################################################################################
#
# Components Section - list of the modules and components that will be processed by compilation
@@ -144,15 +94,6 @@
# in the package build.
# Add components here that should be included in the package build.
- AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
- AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
- AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf
- AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf
- AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
- AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf
- AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
- AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf
- AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf
AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
[BuildOptions]
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
deleted file mode 100644
index 17b75dfbcc..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
+++ /dev/null
@@ -1,48 +0,0 @@
-### @file
-# Component description file for BMC ACPI.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = BmcAcpi
- FILE_GUID = F59DAA23-D5D5-4d16-91FC-D03ABDC12FFE
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = BmcAcpiEntryPoint
-
-[Sources]
- BmcAcpi.c
- BmcSsdt/BmcSsdt.asl
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- BaseMemoryLib
- DebugLib
- UefiLib
-
-[Protocols]
- gEfiFirmwareVolume2ProtocolGuid
- gEfiAcpiTableProtocolGuid
-
-[Pcd]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress
- gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId
- gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId
-
-[Depex]
- gEfiAcpiTableProtocolGuid
-
-[BuildOptions]
- *_*_*_ASL_FLAGS = -oi
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
deleted file mode 100644
index 85591efb5d..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
+++ /dev/null
@@ -1,34 +0,0 @@
-### @file
-# Component description file for BMC ELOG.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = BmcElog
- FILE_GUID = 8A17F6CA-BF1A-45C4-FFFF-FFFF0C829DDD
- MODULE_TYPE = DXE_DRIVER
- PI_SPECIFICATION_VERSION = 0x0001000A
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeBmcElogLayer
-
-[Sources]
- BmcElog.c
-
-[Packages]
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- DebugLib
- UefiBootServicesTableLib
- IpmiCommandLib
-
-[Depex]
- TRUE
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf
deleted file mode 100644
index 3aa29889b1..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf
+++ /dev/null
@@ -1,37 +0,0 @@
-### @file
-# Component description file for IPMI FRB.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[defines]
- INF_VERSION = 0x00010005
- BASE_NAME = FrbDxe
- FILE_GUID = F6C7812D-81BF-4e6d-A87D-E75AF17BD511
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = FrbDxeEntryPoint
-
-[Sources]
- FrbDxe.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- MemoryAllocationLib
- UefiLib
- DebugLib
- BaseMemoryLib
- IpmiCommandLib
- PcdLib
-
-[Depex]
- TRUE
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf
deleted file mode 100644
index 1882453ffe..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf
+++ /dev/null
@@ -1,37 +0,0 @@
-### @file
-# Component description file for IPMI FRB PEIM.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[defines]
- INF_VERSION = 0x00010005
- BASE_NAME = FrbPei
- FILE_GUID = 7F9F9788-9F1F-4725-895C-3932F1A04DE8
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeFrbPei
-
-[Sources]
- FrbPei.c
-
-[Packages]
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- PeimEntryPoint
- DebugLib
- BaseMemoryLib
- PcdLib
- IpmiCommandLib
-
-[Pcd]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag
- gAdvancedFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue
-
-[Depex]
- TRUE
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
deleted file mode 100644
index a2556e92d2..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
+++ /dev/null
@@ -1,35 +0,0 @@
-### @file
-# Component description file for IPMI FRU.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = IpmiFru
- FILE_GUID = 3F1D6464-2B4C-4640-BAC4-3DD905D26CDA
- MODULE_TYPE = DXE_DRIVER
- PI_SPECIFICATION_VERSION = 0x0001000A
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeFru
-
-[Sources]
- IpmiFru.c
-
-[Packages]
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- UefiLib
- DebugLib
- UefiBootServicesTableLib
- BaseMemoryLib
- IpmiCommandLib
-
-[Depex]
- TRUE
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf
deleted file mode 100644
index 2e544270a3..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf
+++ /dev/null
@@ -1,34 +0,0 @@
-### @file
-# Component description file for IPMI initialization.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DxeIpmiInit
- FILE_GUID = 07A01ACF-46D5-48de-A63D-74FA92AA8450
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = IpmiInterfaceInit
-
-[Sources]
- DxeIpmiInit.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- DebugLib
- UefiDriverEntryPoint
- IpmiCommandLib
- TimerLib
-
-[Depex]
- TRUE
\ No newline at end of file
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
deleted file mode 100644
index 5e00f4bd33..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
+++ /dev/null
@@ -1,32 +0,0 @@
-### @file
-# Component description file for IPMI initialization in PEI.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PeiIpmiInit
- FILE_GUID = D8F57F4E-D67D-4f2c-8351-C7092986542F
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- ENTRY_POINT = PeimIpmiInterfaceInit
-
-[Sources]
- PeiIpmiInit.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- PeimEntryPoint
- DebugLib
- IpmiCommandLib
-
-[Depex]
- TRUE
\ No newline at end of file
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf
deleted file mode 100644
index 89e7a66f60..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf
+++ /dev/null
@@ -1,32 +0,0 @@
-### @file
-# Component description file for IPMI Command Library.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = IpmiCommandLib
- FILE_GUID = E599C9C7-5913-40A0-8669-67282E2BEC53
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = IpmiCommandLib
-
-[sources]
- IpmiCommandLibNetFnApp.c
- IpmiCommandLibNetFnTransport.c
- IpmiCommandLibNetFnChassis.c
- IpmiCommandLibNetFnStorage.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- BaseMemoryLib
- DebugLib
- IpmiLib
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
deleted file mode 100644
index c042b8beed..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
+++ /dev/null
@@ -1,28 +0,0 @@
-### @file
-# Component description file for IPMI NULL Library.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = IpmiLibNull
- FILE_GUID = DDF0E1D9-F53F-429A-BD9C-5D12A321E625
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = IpmiLib
-
-[sources]
- IpmiLibNull.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
-
-[Pcd]
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
deleted file mode 100644
index 458b40f626..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
+++ /dev/null
@@ -1,29 +0,0 @@
-### @file
-# Component description file for IPMI platform Library.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = IpmiPlatformHookLibNull
- FILE_GUID = C31A5B17-81DB-4D86-B376-17711BB6E0A5
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = IpmiPlatformHookLib
-
-[sources]
- IpmiPlatformHookLibNull.c
-
-[Packages]
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- DebugLib
-
-[Protocols]
- gEfiIpmiTransportProtocolGuid
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf
deleted file mode 100644
index e49942c198..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf
+++ /dev/null
@@ -1,34 +0,0 @@
-### @file
-# Component description file for IPMI OS watch dog timer driver.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = OsWdt
- FILE_GUID = BE9B694A-B5D9-48e0-A527-6E1A49EB7028
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = DriverInit
-
-[Sources]
- OsWdt.c
-
-[Packages]
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- UefiDriverEntryPoint
- DebugLib
- UefiBootServicesTableLib
- BaseMemoryLib
- IpmiCommandLib
-
-[Depex]
- TRUE
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf
deleted file mode 100644
index 07f2c03f6a..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf
+++ /dev/null
@@ -1,38 +0,0 @@
-### @file
-# Component description file for IPMI Serial Over LAN driver.
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SolStatus
- FILE_GUID = F9887B5E-2D46-4213-8794-14F1FD39F6B8
- MODULE_TYPE = DXE_DRIVER
- PI_SPECIFICATION_VERSION = 0x0001000A
- VERSION_STRING = 1.0
- ENTRY_POINT = SolStatusEntryPoint
-
-[Sources]
- SolStatus.c
-
-[Packages]
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[Pcd]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels
-
-[LibraryClasses]
- UefiDriverEntryPoint
- DebugLib
- UefiBootServicesTableLib
- IpmiCommandLib
- PcdLib
-
-[Depex]
- TRUE
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiCommandLib.h b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiCommandLib.h
deleted file mode 100644
index 9b761717d4..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiCommandLib.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/** @file
- This library abstract how to send/receive IPMI command.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _IPMI_COMMAND_LIB_H_
-#define _IPMI_COMMAND_LIB_H_
-
-#include <Uefi.h>
-#include <IndustryStandard/Ipmi.h>
-
-//
-// NetFnApp
-//
-EFI_STATUS
-EFIAPI
-IpmiGetDeviceId (
- OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelfTestResult (
- OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult
- );
-
-EFI_STATUS
-EFIAPI
-IpmiResetWatchdogTimer (
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiSetWatchdogTimer (
- IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetWatchdogTimer (
- OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer
- );
-
-EFI_STATUS
-EFIAPI
-IpmiSetBmcGlobalEnables (
- IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetBmcGlobalEnables (
- OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables
- );
-
-EFI_STATUS
-EFIAPI
-IpmiClearMessageFlags (
- IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetMessageFlags (
- OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetMessage (
- OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse,
- IN OUT UINT32 *GetMessageResponseSize
- );
-
-EFI_STATUS
-EFIAPI
-IpmiSendMessage (
- IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest,
- IN UINT32 SendMessageRequestSize,
- OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse,
- IN OUT UINT32 *SendMessageResponseSize
- );
-
-//
-// NetFnTransport
-//
-EFI_STATUS
-EFIAPI
-IpmiSolActivating (
- IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiSetSolConfigurationParameters (
- IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationParametersRequest,
- IN UINT32 SetConfigurationParametersRequestSize,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSolConfigurationParameters (
- IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationParametersRequest,
- OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationParametersResponse,
- IN OUT UINT32 *GetConfigurationParametersResponseSize
- );
-
-//
-// NetFnChasis
-//
-EFI_STATUS
-EFIAPI
-IpmiGetChassisCapabilities (
- OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetChassisStatus (
- OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiChassisControl (
- IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiSetPowerRestorePolicy (
- IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest,
- OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse
- );
-
-//
-// NetFnStorage
-//
-EFI_STATUS
-EFIAPI
-IpmiGetFruInventoryAreaInfo (
- IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoRequest,
- OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiReadFruData (
- IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest,
- OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse,
- IN OUT UINT32 *ReadFruDataResponseSize
- );
-
-EFI_STATUS
-EFIAPI
-IpmiWriteFruData (
- IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest,
- IN UINT32 WriteFruDataRequestSize,
- OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelInfo (
- OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelEntry (
- IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest,
- OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse,
- IN OUT UINT32 *GetSelEntryResponseSize
- );
-
-EFI_STATUS
-EFIAPI
-IpmiAddSelEntry (
- IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest,
- OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiPartialAddSelEntry (
- IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest,
- IN UINT32 PartialAddSelEntryRequestSize,
- OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiClearSel (
- IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest,
- OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelTime (
- OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse
- );
-
-EFI_STATUS
-EFIAPI
-IpmiSetSelTime (
- IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest,
- OUT UINT8 *CompletionCode
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSdrRepositoryInfo (
- OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp
- );
-
-EFI_STATUS
-EFIAPI
-IpmiGetSdr (
- IN IPMI_GET_SDR_REQUEST *GetSdrRequest,
- OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse,
- IN OUT UINT32 *GetSdrResponseSize
- );
-
-#endif
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiPlatformHookLib.h b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiPlatformHookLib.h
deleted file mode 100644
index 8359e3f38b..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiPlatformHookLib.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/** @file
- This library abstract the platform specific hook for IPMI.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _IPMI_PLATFORM_UPDATE_LIB_H_
-#define _IPMI_PLATFORM_UPDATE_LIB_H_
-
-#include <Uefi.h>
-#include <IndustryStandard/Acpi.h>
-#include <Protocol/Smbios.h>
-
-EFI_STATUS
-EFIAPI
-PlatformIpmiIoRangeSet(
- UINT16 IpmiIoBase
- );
-
-#endif
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c
deleted file mode 100644
index 990b4b9e83..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/** @file
- BMC ACPI.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-//
-// Statements that include other header files
-//
-#include <PiDxe.h>
-
-#include <IndustryStandard/Acpi.h>
-#include <Protocol/AcpiSystemDescriptionTable.h>
-#include <Protocol/FirmwareVolume2.h>
-#include <Protocol/AcpiTable.h>
-
-#include <Library/BaseLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiLib.h>
-
-#ifndef EFI_ACPI_CREATOR_ID
-#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('M', 'S', 'F', 'T')
-#endif
-#ifndef EFI_ACPI_CREATOR_REVISION
-#define EFI_ACPI_CREATOR_REVISION 0x0100000D
-#endif
-
-/**
-
- Locate the first instance of a protocol. If the protocol requested is an
- FV protocol, then it will return the first FV that contains the ACPI table
- storage file.
-
- @param Protocol - The protocol to find.
- Instance - Return pointer to the first instance of the protocol.
- Type - The type of protocol to locate.
-
- @retval EFI_SUCCESS - The function completed successfully.
- @retval EFI_NOT_FOUND - The protocol could not be located.
- @retval EFI_OUT_OF_RESOURCES - There are not enough resources to find the protocol.
-
-**/
-EFI_STATUS
-LocateSupportProtocol (
- IN EFI_GUID *Protocol,
- OUT VOID **Instance,
- IN UINT32 Type
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE *HandleBuffer;
- UINTN NumberOfHandles;
- EFI_FV_FILETYPE FileType;
- UINT32 FvStatus = 0;
- EFI_FV_FILE_ATTRIBUTES Attributes;
- UINTN Size;
- UINTN Index;
-
- Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NumberOfHandles, &HandleBuffer);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Looking for FV with ACPI storage file
- //
- for (Index = 0; Index < NumberOfHandles; Index++) {
- Status = gBS->HandleProtocol (HandleBuffer[Index], Protocol, Instance);
- ASSERT (!EFI_ERROR (Status));
-
- if (!Type) {
- //
- // Not looking for the FV protocol, so find the first instance of the
- // protocol. There should not be any errors because our handle buffer
- // should always contain at least one or LocateHandleBuffer would have
- // returned not found.
- //
- break;
- }
- //
- // See if it has the ACPI storage file
- //
- Status = ((EFI_FIRMWARE_VOLUME2_PROTOCOL *) (*Instance))->ReadFile (
- *Instance,
- &gEfiCallerIdGuid,
- NULL,
- &Size,
- &FileType,
- &Attributes,
- &FvStatus
- );
-
- //
- // If we found it, then we are done
- //
- if (!EFI_ERROR (Status)) {
- break;
- }
- }
-
- gBS->FreePool (HandleBuffer);
- return Status;
-}
-
-
-EFI_STATUS
-UpdateDeviceSsdtTable (
- IN OUT EFI_ACPI_COMMON_HEADER *Table
- )
-{
- EFI_ACPI_DESCRIPTION_HEADER *TableHeader = NULL;
- UINT64 TempOemTableId;
- UINT8 *DataPtr;
- EFI_ACPI_IO_PORT_DESCRIPTOR *IoRsc;
-
- TableHeader = (EFI_ACPI_DESCRIPTION_HEADER *)Table;
-
- //
- // Update the OEMID and OEM Table ID.
- //
- CopyMem (&TableHeader->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof(TableHeader->OemId));
- TempOemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
- CopyMem (&TableHeader->OemTableId, &TempOemTableId, sizeof(UINT64));
- TableHeader->CreatorId = EFI_ACPI_CREATOR_ID;
- TableHeader->CreatorRevision = EFI_ACPI_CREATOR_REVISION;
-
- //
- // Update IO(Decode16, 0xCA2, 0xCA2, 0, 2)
- //
- DEBUG ((DEBUG_INFO, "UpdateDeviceSsdtTable - IPMI\n"));
- for (DataPtr = (UINT8 *)(Table + 1);
- DataPtr < (UINT8 *) ((UINT8 *) Table + Table->Length - 4);
- DataPtr++) {
- if (CompareMem(DataPtr, "_CRS", 4) == 0) {
- DataPtr += 4; // Skip _CRS
- ASSERT (*DataPtr == AML_BUFFER_OP);
- DataPtr ++; // Skip AML_BUFFER_OP
- ASSERT ((*DataPtr & (BIT7|BIT6)) == 0);
- DataPtr ++; // Skip PkgLength - 0xD
- ASSERT ((*DataPtr) == AML_BYTE_PREFIX);
- DataPtr ++; // Skip BufferSize OpCode
- DataPtr ++; // Skip BufferSize - 0xA
- IoRsc = (VOID *)DataPtr;
- ASSERT (IoRsc->Header.Bits.Type == ACPI_SMALL_ITEM_FLAG);
- ASSERT (IoRsc->Header.Bits.Name == ACPI_SMALL_IO_PORT_DESCRIPTOR_NAME);
- ASSERT (IoRsc->Header.Bits.Length == sizeof(EFI_ACPI_IO_PORT_DESCRIPTOR) - sizeof(ACPI_SMALL_RESOURCE_HEADER));
- DEBUG ((DEBUG_INFO, "IPMI IO Base in ASL update - 0x%04x <= 0x%04x\n", IoRsc->BaseAddressMin, PcdGet16(PcdIpmiIoBaseAddress)));
- IoRsc->BaseAddressMin = PcdGet16(PcdIpmiIoBaseAddress);
- IoRsc->BaseAddressMax = PcdGet16(PcdIpmiIoBaseAddress);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
-
- Entry point for Acpi platform driver.
-
- @param ImageHandle - A handle for the image that is initializing this driver.
- @param SystemTable - A pointer to the EFI system table.
-
- @retval EFI_SUCCESS - Driver initialized successfully.
- @retval EFI_LOAD_ERROR - Failed to Initialize or has been loaded.
- @retval EFI_OUT_OF_RESOURCES - Could not allocate needed resources.
-
-**/
-EFI_STATUS
-EFIAPI
-BmcAcpiEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_STATUS AcpiStatus;
-
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol;
- INTN Instance = 0;
- EFI_ACPI_COMMON_HEADER *CurrentTable = NULL;
- UINTN TableHandle = 0;
- UINT32 FvStatus;
- UINT32 Size;
-
- EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
- UINTN TableSize;
-
-
- //
- // Find the AcpiTable protocol
- //
- Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
-
- //
- // Locate the firmware volume protocol
- //
- Status = LocateSupportProtocol (&gEfiFirmwareVolume2ProtocolGuid, (VOID **) &FwVol, 1);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = EFI_SUCCESS;
- Instance = 0;
-
- //
- // Read tables from the storage file.
- //
- while (!EFI_ERROR (Status)) {
- CurrentTable = NULL;
-
- Status = FwVol->ReadSection (
- FwVol,
- &gEfiCallerIdGuid,
- EFI_SECTION_RAW,
- Instance,
- (VOID **) &CurrentTable,
- (UINTN *) &Size,
- &FvStatus
- );
- if (!EFI_ERROR (Status)) {
- //
- // Perform any table specific updates.
- //
- AcpiStatus = UpdateDeviceSsdtTable (CurrentTable);
- if (!EFI_ERROR (AcpiStatus)) {
-
- TableHandle = 0;
- TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
- ASSERT (Size >= TableSize);
-
- Status = AcpiTable->InstallAcpiTable (
- AcpiTable,
- CurrentTable,
- TableSize,
- &TableHandle
- );
-
- ASSERT_EFI_ERROR (Status);
- }
-
- //
- // Increment the instance
- //
- Instance++;
- }
- }
-
- return EFI_SUCCESS;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c
deleted file mode 100644
index a6d075b19c..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/** @file
- BMC Event Log functions.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Uefi.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/IpmiCommandLib.h>
-
-EFI_STATUS
-EFIAPI
-CheckIfSelIsFull (
- VOID
- );
-
-/*++
-
- Routine Description:
- This function verifies the BMC SEL is full and When it is reports the error to the Error Manager.
-
- Arguments:
- None
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-EFI_STATUS
-WaitTillErased (
- UINT8 *ResvId
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- BmcElogPrivateData - Bmc event log instance
- ResvId - Reserved ID
-
-Returns:
-
- EFI_SUCCESS
- EFI_NO_RESPONSE
-
---*/
-{
- INTN Counter;
- IPMI_CLEAR_SEL_REQUEST ClearSel;
- IPMI_CLEAR_SEL_RESPONSE ClearSelResponse;
-
- Counter = 0x200;
- ZeroMem (&ClearSelResponse, sizeof(ClearSelResponse));
-
- while (TRUE) {
- ZeroMem (&ClearSel, sizeof(ClearSel));
- ClearSel.Reserve[0] = ResvId[0];
- ClearSel.Reserve[1] = ResvId[1];
- ClearSel.AscC = 0x43;
- ClearSel.AscL = 0x4C;
- ClearSel.AscR = 0x52;
- ClearSel.Erase = 0x00;
-
- IpmiClearSel (
- &ClearSel,
- &ClearSelResponse
- );
-
- if ((ClearSelResponse.ErasureProgress & 0xf) == 1) {
- return EFI_SUCCESS;
- }
- //
- // If there is not a response from the BMC controller we need to return and not hang.
- //
- --Counter;
- if (Counter == 0x0) {
- return EFI_NO_RESPONSE;
- }
- }
-}
-
-EFI_STATUS
-EfiActivateBmcElog (
- IN BOOLEAN *EnableElog,
- OUT BOOLEAN *ElogStatus
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- This - Protocol pointer
- DataType - indicate event log type
- EnableElog - Enable/Disable event log
- ElogStatus - return log status
-
-Returns:
-
- EFI_STATUS
-
---*/
-{
- EFI_STATUS Status;
- UINT8 ElogStat;
- IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST SetBmcGlobalEnables;
- IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE GetBmcGlobalEnables;
- UINT8 CompletionCode;
-
- Status = EFI_SUCCESS;
- ElogStat = 0;
-
- Status = IpmiGetBmcGlobalEnables (&GetBmcGlobalEnables);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- if (EnableElog == NULL) {
- *ElogStatus = GetBmcGlobalEnables.GetEnables.Bits.SystemEventLogging;
- } else {
- if (Status == EFI_SUCCESS) {
- if (*EnableElog) {
- ElogStat = 1;
- }
-
- CopyMem (&SetBmcGlobalEnables, (UINT8 *)&GetBmcGlobalEnables + 1, sizeof(UINT8));
- SetBmcGlobalEnables.SetEnables.Bits.SystemEventLogging = ElogStat;
-
- Status = IpmiSetBmcGlobalEnables (&SetBmcGlobalEnables, &CompletionCode);
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-SetElogRedirInstall (
- VOID
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- BOOLEAN EnableElog;
- BOOLEAN ElogStatus;
-
- //
- // Activate the Event Log (This should depend upon Setup).
- //
- EfiActivateBmcElog (&EnableElog, &ElogStatus);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-InitializeBmcElogLayer (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- ImageHandle - ImageHandle of the loaded driver
- SystemTable - Pointer to the System Table
-
-Returns:
-
- EFI_STATUS
-
---*/
-{
- SetElogRedirInstall ();
-
- CheckIfSelIsFull ();
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-CheckIfSelIsFull (
- VOID
- )
-/*++
-
- Routine Description:
- This function verifies the BMC SEL is full and When it is reports the error to the Error Manager.
-
- Arguments:
- None
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- EFI_STATUS Status;
- UINT8 SelIsFull;
- IPMI_GET_SEL_INFO_RESPONSE SelInfo;
-
- Status = IpmiGetSelInfo (&SelInfo);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Check the Bit7 of the OperationByte if SEL is OverFlow.
- //
- SelIsFull = (SelInfo.OperationSupport & 0x80);
- DEBUG ((DEBUG_INFO, "SelIsFull - 0x%x\n", SelIsFull));
-
- return EFI_SUCCESS;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c
deleted file mode 100644
index 74c52a74eb..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/** @file
- IPMI FRB Driver.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiDxe.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IpmiCommandLib.h>
-#include <IndustryStandard/Ipmi.h>
-
-EFI_STATUS
-EfiDisableFrb (
- VOID
- )
-/*++
-
- Routine Description:
- This routine disables the specified FRB timer.
-
- Arguments:
- This - This pointer
- FrbType - Type of FRB timer to get data on
-
- Returns:
- EFI_SUCCESS - FRB timer was disabled
- EFI_ABORTED - Timer was already stopped
- EFI_UNSUPPORTED - This type of FRB timer is not supported.
-
---*/
-{
- EFI_STATUS Status;
- IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer;
- UINT8 CompletionCode;
- IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
-
- Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Check if timer is still running, if not abort disable routine.
- //
- if (GetWatchdogTimer.TimerUse.Bits.TimerRunning == 0) {
- return EFI_ABORTED;
- }
-
- ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer));
- //
- // Just flip the Timer Use bit. This should release the timer.
- //
- SetWatchdogTimer.TimerUse.Bits.TimerRunning = 0;
- SetWatchdogTimer.TimerUse.Bits.TimerUse = IPMI_WATCHDOG_TIMER_BIOS_FRB2;
- SetWatchdogTimer.TimerUseExpirationFlagsClear &= ~BIT2;
- SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT4;
-
- Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
- return Status;
-}
-
-VOID
-EFIAPI
-DisableFRB2Handler (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
- Disables FRB2. This function gets called each time the
- EFI_EVENT_SIGNAL_READY_TO_BOOT gets signaled
-
- Arguments:
- Standard event notification function arguments:
- Event - the event that is signaled.
- Context - not used here.
-
- Returns:
-
---*/
-{
- DEBUG((EFI_D_ERROR, "!!! enter DisableFRB2Handler()!!!\n"));
-
- EfiDisableFrb ();
-}
-
-EFI_STATUS
-CheckForAndReportErrors(
- VOID
- )
-/*++
-
- Routine Description:
- Check the Watchdog timer expiration flags and report the kind of watchdog
- timeout occurred to the Error Manager.
-
- Arguments:
-
- Returns:
- EFI_SUCCESS - Errors retrieved and reported
-
---*/
-{
- EFI_STATUS Status;
- IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
- IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer;
- UINT8 CompletionCode;
-
- //
- // Get the Watchdog timer info to find out what kind of timer expiration occurred.
- //
- Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // If FRB2 Failure occurred, report it to the error manager and log a SEL.
- //
- if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT1) != 0) {
- //
- // Report the FRB2 time-out error
- //
- } else if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT3) != 0) {
- //
- // Report the OS Watchdog timer failure
- //
- }
-
- //
- // Need to clear Timer expiration flags after checking.
- //
- ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer));
- SetWatchdogTimer.TimerUse = GetWatchdogTimer.TimerUse;
- SetWatchdogTimer.TimerActions = GetWatchdogTimer.TimerActions;
- SetWatchdogTimer.PretimeoutInterval = GetWatchdogTimer.PretimeoutInterval;
- SetWatchdogTimer.TimerUseExpirationFlagsClear = GetWatchdogTimer.TimerUseExpirationFlagsClear;
- SetWatchdogTimer.InitialCountdownValue = GetWatchdogTimer.InitialCountdownValue;
- SetWatchdogTimer.TimerUse.Bits.TimerRunning = 1;
- SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT2 | BIT3;
-
- Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
-
- return Status;
-}
-
-EFI_STATUS
-ReportFrb2Status (
- VOID
- )
-/*++
-
- Routine Description:
- This routine is built only when DEBUG_MODE is enabled. It is used
- to report the status of FRB2 when the FRB2 driver is installed.
-
- Arguments:
- none
-
- Returns:
- EFI_SUCCESS: All info was retrieved and reported
- EFI_ERROR: There was an error during info retrieval
-
---*/
-{
- EFI_STATUS Status;
- IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
-
- //
- // Get the Watchdog timer info to find out what kind of timer expiration occurred.
- //
- Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_INFO, "Failed to get Watchdog Timer info from BMC.\n"));
- return Status;
- }
-
- //
- // Check if timer is running, report status to DEBUG_MODE output.
- //
- if (GetWatchdogTimer.TimerUse.Bits.TimerRunning == 1) {
- DEBUG ((DEBUG_INFO, "FRB2 Timer is running.\n"));
- } else {
- DEBUG ((DEBUG_INFO, "FRB2 Timer is not running.\n"));
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-FrbDxeEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
- Routine Description:
- This is the standard EFI driver point. This function intitializes
- the private data required for creating FRB Driver.
-
- Arguments:
- ImageHandle - Handle for the image of this driver
- SystemTable - Pointer to the EFI System Table
-
- Returns:
- EFI_SUCCESS - Protocol successfully started and installed
- EFI_UNSUPPORTED - Protocol can't be started
-
---*/
-{
- EFI_EVENT ReadyToBootEvent;
- EFI_STATUS Status;
-
- CheckForAndReportErrors();
- ReportFrb2Status ();
-
- //
- // Register the event to Disable FRB2 before Boot.
- //
- Status = EfiCreateEventReadyToBootEx (
- TPL_NOTIFY,
- DisableFRB2Handler,
- NULL,
- &ReadyToBootEvent
- );
-
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c
deleted file mode 100644
index 5d33df0103..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @file
- IPMI FRB PEIM.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/IoLib.h>
-#include <Library/PcdLib.h>
-#include <Library/IpmiCommandLib.h>
-
-#include <IndustryStandard/Ipmi.h>
-
-VOID
-SetWatchDogTimer (
- IN BOOLEAN Frb2Enabled
- )
-{
- EFI_STATUS Status;
- IPMI_SET_WATCHDOG_TIMER_REQUEST FrbTimer;
- IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
- UINT8 CompletionCode;
-
- Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
- if (EFI_ERROR(Status)) {
- return ;
- }
-
- if (Frb2Enabled) {
- ZeroMem (&FrbTimer, sizeof(FrbTimer));
- //Byte 1
- FrbTimer.TimerUse.Bits.TimerUse = IPMI_WATCHDOG_TIMER_BIOS_FRB2;
- //Byte 2
- FrbTimer.TimerActions.Uint8 = 0; //NormalBoot, NoTimeOutInterrupt. i.e no action when BMC watchdog timeout
- //Byte 3
- FrbTimer.PretimeoutInterval = 0;
- //Byte 4
- FrbTimer.TimerUseExpirationFlagsClear |= BIT1; //set Frb2ExpirationFlag
-
- //Data Byte 5/6
- FrbTimer.InitialCountdownValue = PcdGet16(PcdFRBTimeoutValue) * 10;
-
- //Set BMC watchdog timer
- Status = IpmiSetWatchdogTimer (&FrbTimer, &CompletionCode);
- Status = IpmiResetWatchdogTimer (&CompletionCode);
- }
-}
-
-EFI_STATUS
-EFIAPI
-InitializeFrbPei (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- FfsHeader
- PeiServices
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- BOOLEAN Frb2Enabled;
-
- //
- // If we are booting with defaults, then make sure FRB2 is enabled.
- //
- Frb2Enabled = PcdGetBool (PcdFRB2EnabledFlag);
-
- SetWatchDogTimer (Frb2Enabled);
-
- return EFI_SUCCESS;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c
deleted file mode 100644
index 58e1fb4d7e..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/** @file
- IPMI FRU Driver.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Library/BaseLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/IpmiCommandLib.h>
-#include <IndustryStandard/Ipmi.h>
-
-EFI_STATUS
-EFIAPI
-InitializeFru (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Initialize SM Redirection Fru Layer
-
-Arguments:
-
- ImageHandle - ImageHandle of the loaded driver
- SystemTable - Pointer to the System Table
-
-Returns:
-
- EFI_STATUS
-
---*/
-{
- EFI_STATUS Status;
- IPMI_GET_DEVICE_ID_RESPONSE ControllerInfo;
- IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST GetFruInventoryAreaInfoRequest;
- IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE GetFruInventoryAreaInfoResponse;
-
- //
- // Get all the SDR Records from BMC and retrieve the Record ID from the structure for future use.
- //
- Status = IpmiGetDeviceId (&ControllerInfo);
- if (EFI_ERROR (Status)) {
- DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetDeviceId Status=%x\n", Status));
- return Status;
- }
-
- DEBUG((DEBUG_ERROR, "!!! IpmiFru FruInventorySupport %x\n", ControllerInfo.DeviceSupport.Bits.FruInventorySupport));
-
- if (ControllerInfo.DeviceSupport.Bits.FruInventorySupport) {
- GetFruInventoryAreaInfoRequest.DeviceId = 0;
- Status = IpmiGetFruInventoryAreaInfo (&GetFruInventoryAreaInfoRequest, &GetFruInventoryAreaInfoResponse);
- if (EFI_ERROR (Status)) {
- DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetFruInventoryAreaInfo Status=%x\n", Status));
- return Status;
- }
- DEBUG((DEBUG_ERROR, "!!! IpmiFru InventoryAreaSize=%x\n", GetFruInventoryAreaInfoResponse.InventoryAreaSize));
- }
-
- return EFI_SUCCESS;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.c
deleted file mode 100644
index fccbb3b5dc..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/** @file
- IPMI stack initialization.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiDxe.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/TimerLib.h>
-#include <Library/IpmiCommandLib.h>
-
-#define BMC_TIMEOUT 30 // [s] How long shall BIOS wait for BMC
-#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout
-
-EFI_STATUS
-GetSelfTest (
- VOID
- )
-/*++
-
-Routine Description:
-
- Execute the Get Self Test results command to determine whether or not the BMC self tests
- have passed
-
-Arguments:
-
- mIpmiInstance - Data structure describing BMC variables and used for sending commands
- StatusCodeValue - An array used to accumulate error codes for later reporting.
- ErrorCount - Counter used to keep track of error codes in StatusCodeValue
-
-Returns:
-
- EFI_SUCCESS - BMC Self test results are retrieved and saved into BmcStatus
- EFI_DEVICE_ERROR - BMC failed to return self test results.
-
---*/
-{
- EFI_STATUS Status;
- IPMI_SELF_TEST_RESULT_RESPONSE TestResult;
-
- //
- // Get the SELF TEST Results.
- //
- Status = IpmiGetSelfTestResult (&TestResult);
- if (EFI_ERROR(Status)) {
- DEBUG((DEBUG_ERROR, "\n[IPMI] BMC does not respond (status: %r)!\n\n", Status));
- return Status;
- }
-
- DEBUG((DEBUG_INFO, "[IPMI] BMC self-test result: %02X-%02X\n", TestResult.Result, TestResult.Param));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetDeviceId (
- OUT BOOLEAN *UpdateMode
- )
-/*++
-
-Routine Description:
- Execute the Get Device ID command to determine whether or not the BMC is in Force Update
- Mode. If it is, then report it to the error manager.
-
-Arguments:
-
-Returns:
- Status
-
---*/
-{
- EFI_STATUS Status;
- IPMI_GET_DEVICE_ID_RESPONSE BmcInfo;
- UINT32 Retries;
-
- //
- // Set up a loop to retry for up to 30 seconds. Calculate retries not timeout
- // so that in case KCS is not enabled and EfiIpmiSendCommand() returns
- // immediately we will not wait all the 30 seconds.
- //
- Retries = BMC_TIMEOUT / BMC_KCS_TIMEOUT + 1;
- //
- // Get the device ID information for the BMC.
- //
- do {
- Status = IpmiGetDeviceId (&BmcInfo);
- if (!EFI_ERROR(Status)) {
- break;
- }
- DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d retries left\n", Status, Retries));
- MicroSecondDelay(50 * 1000);
- if (Retries-- == 0) {
- return Status;
- }
- } while (TRUE);
-
- DEBUG((
- DEBUG_INFO,
- "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n",
- BmcInfo.DeviceId,
- BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev,
- BmcInfo.MinorFirmwareRev
- ));
- *UpdateMode = (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode;
- return Status;
-}
-
-/**
- The entry point of the Ipmi DXE.
-
-@param[in] ImageHandle - Handle of this driver image
-@param[in] SystemTable - Table containing standard EFI services
-
-@retval EFI_SUCCESS - Always success is returned even if KCS does not function
-
- **/
-EFI_STATUS
-EFIAPI
-IpmiInterfaceInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- BOOLEAN UpdateMode;
- EFI_STATUS Status;
-
- DEBUG((EFI_D_ERROR,"IPMI Dxe:Get BMC Device Id\n"));
-
- //
- // Get the Device ID and check if the system is in Force Update mode.
- //
- Status = GetDeviceId (&UpdateMode);
- //
- // Do not continue initialization if the BMC is in Force Update Mode.
- //
- if (!EFI_ERROR(Status) && !UpdateMode) {
- //
- // Get the SELF TEST Results.
- //
- GetSelfTest ();
- }
-
- return EFI_SUCCESS;
-}
-
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.c
deleted file mode 100644
index 062d20c44e..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/** @file
- IPMI stack initialization in PEI.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/TimerLib.h>
-#include <Library/IpmiCommandLib.h>
-
-#define BMC_TIMEOUT_PEI 50 // [s] How long shall BIOS wait for BMC
-#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout
-
-EFI_STATUS
-GetDeviceId (
- OUT BOOLEAN *UpdateMode
- )
-/*++
-
-Routine Description:
- Execute the Get Device ID command to determine whether or not the BMC is in Force Update
- Mode. If it is, then report it to the error manager.
-
-Arguments:
-
-Returns:
- Status
-
---*/
-{
- EFI_STATUS Status;
- IPMI_GET_DEVICE_ID_RESPONSE BmcInfo;
- UINT32 Retries;
-
- //
- // Set up a loop to retry for up to 30 seconds. Calculate retries not timeout
- // so that in case KCS is not enabled and EfiIpmiSendCommand() returns
- // immediately we will not wait all the 30 seconds.
- //
- Retries = BMC_TIMEOUT_PEI/ BMC_KCS_TIMEOUT + 1;
- //
- // Get the device ID information for the BMC.
- //
- do {
- Status = IpmiGetDeviceId (&BmcInfo);
- if (!EFI_ERROR(Status)) {
- break;
- }
- DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d retries left\n", Status, Retries));
- if (Retries-- == 0) {
- return Status;
- }
- } while (TRUE);
-
- DEBUG((
- DEBUG_INFO,
- "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n",
- BmcInfo.DeviceId,
- BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev,
- BmcInfo.MinorFirmwareRev
- ));
- *UpdateMode = (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode;
- return Status;
-}
-
-/**
- The entry point of the Ipmi PEIM.
-
- @param FileHandle Handle of the file being invoked.
- @param PeiServices Describes the list of possible PEI Services.
-
- @retval EFI_SUCCESS Indicates that Ipmi initialization completed successfully.
- @retval Others Indicates that Ipmi initialization could not complete successfully.
-**/
-EFI_STATUS
-EFIAPI
-PeimIpmiInterfaceInit (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
- )
-{
- BOOLEAN UpdateMode;
- EFI_STATUS Status;
-
- DEBUG ((DEBUG_INFO, "IPMI Peim:Get BMC Device Id\n"));
-
- //
- // Get the Device ID and check if the system is in Force Update mode.
- //
- Status = GetDeviceId (&UpdateMode);
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
deleted file mode 100644
index b57db50610..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/** @file
- IPMI Command - NetFnApp.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IpmiLib.h>
-
-#include <IndustryStandard/Ipmi.h>
-
-EFI_STATUS
-EFIAPI
-IpmiGetDeviceId (
- OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*DeviceId);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_GET_DEVICE_ID,
- NULL,
- 0,
- (VOID *)DeviceId,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelfTestResult (
- OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*SelfTestResult);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_GET_SELFTEST_RESULTS,
- NULL,
- 0,
- (VOID *)SelfTestResult,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiResetWatchdogTimer (
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_RESET_WATCHDOG_TIMER,
- NULL,
- 0,
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiSetWatchdogTimer (
- IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_SET_WATCHDOG_TIMER,
- (VOID *)SetWatchdogTimer,
- sizeof(*SetWatchdogTimer),
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetWatchdogTimer (
- OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetWatchdogTimer);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_GET_WATCHDOG_TIMER,
- NULL,
- 0,
- (VOID *)GetWatchdogTimer,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiSetBmcGlobalEnables (
- IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_SET_BMC_GLOBAL_ENABLES,
- (VOID *)SetBmcGlobalEnables,
- sizeof(*SetBmcGlobalEnables),
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetBmcGlobalEnables (
- OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetBmcGlobalEnables);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_GET_BMC_GLOBAL_ENABLES,
- NULL,
- 0,
- (VOID *)GetBmcGlobalEnables,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiClearMessageFlags (
- IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_CLEAR_MESSAGE_FLAGS,
- (VOID *)ClearMessageFlagsRequest,
- sizeof(*ClearMessageFlagsRequest),
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetMessageFlags (
- OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetMessageFlagsResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_GET_MESSAGE_FLAGS,
- NULL,
- 0,
- (VOID *)GetMessageFlagsResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetMessage (
- OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse,
- IN OUT UINT32 *GetMessageResponseSize
- )
-{
- EFI_STATUS Status;
-
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_GET_MESSAGE,
- NULL,
- 0,
- (VOID *)GetMessageResponse,
- GetMessageResponseSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiSendMessage (
- IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest,
- IN UINT32 SendMessageRequestSize,
- OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse,
- IN OUT UINT32 *SendMessageResponseSize
- )
-{
- EFI_STATUS Status;
-
- Status = IpmiSubmitCommand (
- IPMI_NETFN_APP,
- IPMI_APP_SEND_MESSAGE,
- (VOID *)SendMessageRequest,
- SendMessageRequestSize,
- (VOID *)SendMessageResponse,
- SendMessageResponseSize
- );
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
deleted file mode 100644
index 1b86aa888e..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/** @file
- IPMI Command - NetFnChassis.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IpmiLib.h>
-
-#include <IndustryStandard/Ipmi.h>
-
-
-EFI_STATUS
-EFIAPI
-IpmiGetChassisCapabilities (
- OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetChassisCapabilitiesResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_CHASSIS,
- IPMI_CHASSIS_GET_CAPABILITIES,
- NULL,
- 0,
- (VOID *)GetChassisCapabilitiesResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetChassisStatus (
- OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetChassisStatusResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_CHASSIS,
- IPMI_CHASSIS_GET_STATUS,
- NULL,
- 0,
- (VOID *)GetChassisStatusResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiChassisControl (
- IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_CHASSIS,
- IPMI_CHASSIS_CONTROL,
- (VOID *)ChassisControlRequest,
- sizeof(*ChassisControlRequest),
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiSetPowerRestorePolicy (
- IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest,
- OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*ChassisControlResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_CHASSIS,
- IPMI_CHASSIS_SET_POWER_RESTORE_POLICY,
- (VOID *)ChassisControlRequest,
- sizeof(*ChassisControlRequest),
- (VOID *)ChassisControlResponse,
- &DataSize
- );
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c
deleted file mode 100644
index 8e892c5f84..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/** @file
- IPMI Command - NetFnStorage.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IpmiLib.h>
-
-#include <IndustryStandard/Ipmi.h>
-
-
-EFI_STATUS
-EFIAPI
-IpmiGetFruInventoryAreaInfo (
- IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoRequest,
- OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetFruInventoryAreaInfoResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_GET_FRU_INVENTORY_AREAINFO,
- (VOID *)GetFruInventoryAreaInfoRequest,
- sizeof(*GetFruInventoryAreaInfoRequest),
- (VOID *)GetFruInventoryAreaInfoResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiReadFruData (
- IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest,
- OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse,
- IN OUT UINT32 *ReadFruDataResponseSize
- )
-{
- EFI_STATUS Status;
-
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_READ_FRU_DATA,
- (VOID *)ReadFruDataRequest,
- sizeof(*ReadFruDataRequest),
- (VOID *)ReadFruDataResponse,
- ReadFruDataResponseSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiWriteFruData (
- IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest,
- IN UINT32 WriteFruDataRequestSize,
- OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*WriteFruDataResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_WRITE_FRU_DATA,
- (VOID *)WriteFruDataRequest,
- WriteFruDataRequestSize,
- (VOID *)WriteFruDataResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelInfo (
- OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetSelInfoResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_GET_SEL_INFO,
- NULL,
- 0,
- (VOID *)GetSelInfoResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelEntry (
- IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest,
- OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse,
- IN OUT UINT32 *GetSelEntryResponseSize
- )
-{
- EFI_STATUS Status;
-
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_GET_SEL_ENTRY,
- (VOID *)GetSelEntryRequest,
- sizeof(*GetSelEntryRequest),
- (VOID *)GetSelEntryResponse,
- GetSelEntryResponseSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiAddSelEntry (
- IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest,
- OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*AddSelEntryResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_ADD_SEL_ENTRY,
- (VOID *)AddSelEntryRequest,
- sizeof(*AddSelEntryRequest),
- (VOID *)AddSelEntryResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiPartialAddSelEntry (
- IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest,
- IN UINT32 PartialAddSelEntryRequestSize,
- OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*PartialAddSelEntryResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_PARTIAL_ADD_SEL_ENTRY,
- (VOID *)PartialAddSelEntryRequest,
- PartialAddSelEntryRequestSize,
- (VOID *)PartialAddSelEntryResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiClearSel (
- IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest,
- OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*ClearSelResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_CLEAR_SEL,
- (VOID *)ClearSelRequest,
- sizeof(*ClearSelRequest),
- (VOID *)ClearSelResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSelTime (
- OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetSelTimeResponse);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_GET_SEL_TIME,
- NULL,
- 0,
- (VOID *)GetSelTimeResponse,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiSetSelTime (
- IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_SET_SEL_TIME,
- (VOID *)SetSelTimeRequest,
- sizeof(*SetSelTimeRequest),
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSdrRepositoryInfo (
- OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*GetSdrRepositoryInfoResp);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_GET_SDR_REPOSITORY_INFO,
- NULL,
- 0,
- (VOID *)GetSdrRepositoryInfoResp,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSdr (
- IN IPMI_GET_SDR_REQUEST *GetSdrRequest,
- OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse,
- IN OUT UINT32 *GetSdrResponseSize
- )
-{
- EFI_STATUS Status;
-
- Status = IpmiSubmitCommand (
- IPMI_NETFN_STORAGE,
- IPMI_STORAGE_GET_SDR,
- (VOID *)GetSdrRequest,
- sizeof(*GetSdrRequest),
- (VOID *)GetSdrResponse,
- GetSdrResponseSize
- );
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c
deleted file mode 100644
index 3b9b17b909..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/** @file
- IPMI Command - NetFnTransport.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IpmiLib.h>
-
-#include <IndustryStandard/Ipmi.h>
-
-
-EFI_STATUS
-EFIAPI
-IpmiSolActivating (
- IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_TRANSPORT,
- IPMI_TRANSPORT_SOL_ACTIVATING,
- (VOID *)SolActivatingRequest,
- sizeof(*SolActivatingRequest),
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiSetSolConfigurationParameters (
- IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationParametersRequest,
- IN UINT32 SetConfigurationParametersRequestSize,
- OUT UINT8 *CompletionCode
- )
-{
- EFI_STATUS Status;
- UINT32 DataSize;
-
- DataSize = sizeof(*CompletionCode);
- Status = IpmiSubmitCommand (
- IPMI_NETFN_TRANSPORT,
- IPMI_TRANSPORT_SET_SOL_CONFIG_PARAM,
- (VOID *)SetConfigurationParametersRequest,
- SetConfigurationParametersRequestSize,
- (VOID *)CompletionCode,
- &DataSize
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-IpmiGetSolConfigurationParameters (
- IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationParametersRequest,
- OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationParametersResponse,
- IN OUT UINT32 *GetConfigurationParametersResponseSize
- )
-{
- EFI_STATUS Status;
-
- Status = IpmiSubmitCommand (
- IPMI_NETFN_TRANSPORT,
- IPMI_TRANSPORT_GET_SOL_CONFIG_PARAM,
- (VOID *)GetConfigurationParametersRequest,
- sizeof(*GetConfigurationParametersRequest),
- (VOID *)GetConfigurationParametersResponse,
- GetConfigurationParametersResponseSize
- );
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c
deleted file mode 100644
index db4c7ada7e..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file
- IPMI library.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <PiPei.h>
-#include <Library/DebugLib.h>
-
-#include <IndustryStandard/Ipmi.h>
-
-/**
- This service enables submitting commands via Ipmi.
-
- @param[in] NetFunction Net function of the command.
- @param[in] Command IPMI Command.
- @param[in] RequestData Command Request Data.
- @param[in] RequestDataSize Size of Command Request Data.
- @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
- @param[in, out] ResponseDataSize Size of Command Response Data.
-
- @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
- @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
- @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
- @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
- @retval EFI_TIMEOUT The command time out.
- @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
- @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource or data size error.
-**/
-EFI_STATUS
-EFIAPI
-IpmiSubmitCommand (
- IN UINT8 NetFunction,
- IN UINT8 Command,
- IN UINT8 *RequestData,
- IN UINT32 RequestDataSize,
- OUT UINT8 *ResponseData,
- IN OUT UINT32 *ResponseDataSize
- )
-{
- return EFI_UNSUPPORTED;
-}
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c
deleted file mode 100644
index bdc8d23827..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/** @file
- IPMI platform hook library.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Library/IpmiPlatformHookLib.h>
-
-//
-// Prototype definitions for IPMI Platform Update Library
-//
-EFI_STATUS
-EFIAPI
-PlatformIpmiIoRangeSet(
- UINT16 IpmiIoBase
- )
-/*++
-
- Routine Description:
-
- This function sets IPMI Io range
-
- Arguments:
-
- IpmiIoBase
-
- Returns:
-
- Status
-
---*/
-{
- return EFI_SUCCESS;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c
deleted file mode 100644
index 25139eadba..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/** @file
- IPMI Os watchdog timer Driver.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Uefi.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/IpmiCommandLib.h>
-#include <IndustryStandard/Ipmi.h>
-
-BOOLEAN mOsWdtFlag = FALSE;
-
-EFI_EVENT mExitBootServicesEvent;
-
-VOID
-EFIAPI
-EnableEfiOsBootWdtHandler (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
- Enable the OS Boot Watchdog Timer.
- Is called only on legacy or EFI OS boot.
-
-Arguments:
- Event - Event type
- *Context - Context for the event
-
-Returns:
- None
-
---*/
-{
- EFI_STATUS Status;
- IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer;
- UINT8 CompletionCode;
- IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
- static BOOLEAN OsWdtEventHandled = FALSE;
-
- DEBUG((EFI_D_ERROR, "!!! EnableEfiOsBootWdtHandler()!!!\n"));
-
- //
- // Make sure it processes once only. And proceess it only if OsWdtFlag==TRUE;
- //
- if (OsWdtEventHandled || !mOsWdtFlag) {
- return ;
- }
-
- OsWdtEventHandled = TRUE;
-
- Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
- if (EFI_ERROR (Status)) {
- return ;
- }
-
- ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer));
- //
- // Just flip the Timer Use bit. This should release the timer.
- //
- SetWatchdogTimer.TimerUse.Bits.TimerRunning = 1;
- SetWatchdogTimer.TimerUse.Bits.TimerUse = IPMI_WATCHDOG_TIMER_OS_LOADER;
- SetWatchdogTimer.TimerActions.Uint8 = IPMI_WATCHDOG_TIMER_ACTION_HARD_RESET;
- SetWatchdogTimer.TimerUseExpirationFlagsClear &= ~BIT4;
- SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT2;
- SetWatchdogTimer.InitialCountdownValue = 600; // 100ms / count
-
- Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
- return ;
-}
-
-EFI_STATUS
-EFIAPI
-DriverInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- This is the standard EFI driver point. This function intitializes
- the private data required for creating ASRR Driver.
-
-Arguments:
- As required for DXE driver enrty routine.
- ImageHandle - ImageHandle of the loaded driver
- SystemTable - Pointer to the System Table
-
-Returns:
- @retval EFI_SUCCESS Protocol successfully started and installed.
- @retval EFI_OUT_OF_RESOURCES The event could not be allocated.
-
---*/
-{
- EFI_STATUS Status;
-
- Status = gBS->CreateEvent (
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_NOTIFY,
- EnableEfiOsBootWdtHandler,
- NULL,
- &mExitBootServicesEvent
- );
-
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.c
deleted file mode 100644
index 47bec1975a..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/** @file
- IPMI Serial Over Lan Driver.
-
-Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Uefi.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/IpmiCommandLib.h>
-#include <IndustryStandard/Ipmi.h>
-
-#define SOL_CMD_RETRY_COUNT 10
-
-/*++
-
-Routine Description:
-
- This routine gets the SOL payload status or settings for a specific channel.
-
-Arguments:
- Channel - LAN channel naumber.
- ParamSel - Configuration parameter selection.
- Data - Information returned from BMC.
-Returns:
- EFI_SUCCESS - SOL configuration parameters are successfully read from BMC.
- Others - SOL configuration parameters could not be read from BMC.
-
---*/
-EFI_STATUS
-GetSOLStatus (
- IN UINT8 Channel,
- IN UINT8 ParamSel,
- IN OUT UINT8 *Data
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
- IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST GetConfigurationParametersRequest;
- IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE GetConfigurationParametersResponse;
- UINT32 DataSize;
- UINT8 RetryCount;
-
- for (RetryCount = 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) {
- ZeroMem (&GetConfigurationParametersRequest, sizeof(GetConfigurationParametersRequest));
- GetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber = Channel;
- GetConfigurationParametersRequest.ParameterSelector = ParamSel;
-
- ZeroMem (&GetConfigurationParametersResponse, sizeof(GetConfigurationParametersResponse));
-
- DataSize = sizeof(GetConfigurationParametersResponse);
- Status = IpmiGetSolConfigurationParameters (
- &GetConfigurationParametersRequest,
- &GetConfigurationParametersResponse,
- &DataSize
- );
-
- if (Status == EFI_SUCCESS){
- break;
- } else {
- gBS->Stall(100000);
- }
- }
-
- if (Status == EFI_SUCCESS) {
- *Data = GetConfigurationParametersResponse.ParameterData[0];
- }
-
- return Status;
-}
-
-/*++
-
-Routine Description:
-
- This routine sets the SOL payload configuration parameters for a specific channel.
-
-Arguments:
- Channel - LAN channel naumber.
- ParamSel - Configuration parameter selection.
- Data - Configuration parameter values.
-Returns:
- EFI_SUCCESS - SOL configuration parameters are sent to BMC.
- Others - SOL configuration parameters could not be sent to BMC.
-
---*/
-EFI_STATUS
-SetSOLParams (
- IN UINT8 Channel,
- IN UINT8 ParamSel,
- IN UINT8 Data
- )
-{
- EFI_STATUS Status = EFI_SUCCESS;
- IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST SetConfigurationParametersRequest;
- UINT8 CompletionCode;
- UINT8 RetryCount;
-
- for (RetryCount = 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) {
- ZeroMem (&SetConfigurationParametersRequest, sizeof(SetConfigurationParametersRequest));
- SetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber = Channel;
- SetConfigurationParametersRequest.ParameterSelector = ParamSel;
- SetConfigurationParametersRequest.ParameterData[0] = Data;
-
- CompletionCode = 0;
-
- Status = IpmiSetSolConfigurationParameters (
- &SetConfigurationParametersRequest,
- sizeof(SetConfigurationParametersRequest),
- &CompletionCode
- );
-
- if (Status == EFI_SUCCESS) {
- break;
- } else {
- gBS->Stall(100000);
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-SolStatusEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
- Routine Description:
- This is the standard EFI driver point. This function intitializes
- the private data required for creating SOL Status Driver.
-
- Arguments:
- ImageHandle - Handle for the image of this driver
- SystemTable - Pointer to the EFI System Table
-
- Returns:
- EFI_SUCCESS - Protocol successfully installed
- EFI_UNSUPPORTED - Protocol can't be installed.
-
---*/
-{
- EFI_STATUS Status = EFI_SUCCESS;
- UINT8 Channel;
- BOOLEAN SolEnabled = FALSE;
-
- for (Channel = 1; Channel <= PcdGet8 (PcdMaxSOLChannels); Channel++) {
- Status = GetSOLStatus (Channel, IPMI_SOL_CONFIGURATION_PARAMETER_SOL_ENABLE, &SolEnabled);
- if (Status == EFI_SUCCESS) {
- DEBUG ((DEBUG_ERROR, "SOL enabling status for channel %x is %x\n", Channel, SolEnabled));
- } else {
- DEBUG ((DEBUG_ERROR, "Failed to get channel %x SOL status from BMC!, status is %x\n", Channel, Status));
- }
- }
-
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/BmcSsdt.asl b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/BmcSsdt.asl
deleted file mode 100644
index 0daa175205..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/BmcSsdt.asl
+++ /dev/null
@@ -1,28 +0,0 @@
-/** @file
- BMC ACPI SSDT.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-DefinitionBlock (
- "BmcSsdt.aml",
- "SSDT",
- 0x02, // SSDT revision.
- // A Revision field value greater than or equal to 2 signifies that integers
- // declared within the Definition Block are to be evaluated as 64-bit values
- "INTEL", // OEM ID (6 byte string)
- "BMCACPI", // OEM table ID (8 byte string)
- 0x0 // OEM version of DSDT table (4 byte Integer)
- )
-{
-
- External(\_SB.PC00.LPC0, DeviceObj)
-
- Scope (\_SB.PC00.LPC0)
- {
- #include "IpmiOprRegions.asi"
- }
-
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOprRegions.asi b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOprRegions.asi
deleted file mode 100644
index d2ae5fc40a..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOprRegions.asi
+++ /dev/null
@@ -1,58 +0,0 @@
-/** @file
- IPMI ACPI SSDT.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-Device(IPMC)
-{
- // Config DWord, modified during POST
- // Bit definitions are the same as PPMFlags:
- // [00] = Plug and Play BMC Detection enabled in setup
- // [31:01] = Reserved = 0
-
- Name(ECFL, 0x80000000)
-
- // Return the interface specification revision
- Method(_SRV)
- {
- // IPMI Specification Revision v2.0
- Return(0x0200)
- }
-
- Method(_STA, 0)
- {
- //
- // Assume OK
- //
- Store (0xF, Local0)
-
- Return(Local0)
-
- // Bit 0 - Set if the device is present.
- // Bit 1 - Set if the device is enabled and decoding its resources.
- // Bit 2 - Set if the device should be shown in the UI.
- // Bit 3 - Set if the device is functioning properly (cleared if the device failed its diagnostics).
- // Bit 4 - Set if the battery is present.
- // Bit 5 - Reserved (must be cleared).
- } // end of _STA
-
- // Return the x86 resources consumed by BMC
- Name(_CRS, ResourceTemplate()
- {
- // Uses 8-bit ports 0xCA2-0xCA5
- IO(Decode16, 0xCA2, 0xCA2, 0, 2)
- })
-
- Name(_HID, "IPI0001") // IPMI device
- Name(_IFT, 0x1) // KCS system interface type
- Name(_STR, Unicode("IPMI_KCS"))
-
- Name(_UID, 0) // First interface.
-
-
-} // end of Device(IPMC)
-
-
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 16/49] Features/Intel/IpmiFeaturePkg: Add initial package
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 16/49] Features/Intel/IpmiFeaturePkg: Add initial package Kubacki, Michael A
@ 2019-11-15 23:48 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:48 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Please at least fill in the "Purpose" section of Readme.md, don't leave the entire file as TODOs.
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 16/49] Features/Intel/IpmiFeaturePkg: Add initial package
Adds a new feature package for the IPMI feature.
This change updates the advanced feature package template for IPMI and adds the updated template to the IpmiFeaturePkg.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec | 29 +++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc | 24 ++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf | 8 ++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf | 8 ++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md | 86 ++++++++++++++++++++
5 files changed, 155 insertions(+)
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
new file mode 100644
index 0000000000..dfa8888e88
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.d
+++ ec
@@ -0,0 +1,29 @@
+## @file
+# This package provides advanced feature functionality to enable the #
+Intelligent Platform Management Interface (IPMI).
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and # INF
+files to generate AutoGen.c and AutoGen.h files # for the build
+infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = IpmiFeaturePkg
+ PACKAGE_GUID = AE091910-F6C9-4AB5-B8B4-995E2F0D5166
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[Guids]
+ gIpmiFeaturePkgTokenSpaceGuid = {0xc05283f6, 0xd6a8, 0x48f3, {0x9b,
+0x59, 0xfb, 0xca, 0x71, 0x32, 0x0f, 0x12}}
+
+[PcdsFeatureFlag]
+
+gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable|FALSE|BOOLEAN|0xA000
+0001
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
new file mode 100644
index 0000000000..1952ba185e
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.d
+++ sc
@@ -0,0 +1,24 @@
+## @file
+# This package provides advanced feature functionality to enable the #
+Intelligent Platform Management Interface (IPMI).
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and # INF
+files to generate AutoGen.c and AutoGen.h files # for the build
+infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+[Defines]
+ PLATFORM_NAME = IpmiFeaturePkg
+ PLATFORM_GUID = 7B2E74D7-9538-4818-B51A-492F3D33BD20
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..c3847c54c7
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemo
+++ ry.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for post-memory modules that enable Intelligent Platform Management Interface.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..0c82d7eb02
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemor
+++ y.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory modules that enable Intelligent Platform Management Interface.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md
new file mode 100644
index 0000000000..eaa56835f5
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md
@@ -0,0 +1,86 @@
+# Overview
+* **Feature Name:** Intelligent Platform Management Interface (IPMI)
+* **PI Phase(s) Supported:** PEI, DXE
+* **SMM Required?** No
+
+## Purpose
+*_TODO_*
+Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph.
+
+# High-Level Theory of Operation
+*_TODO_*
+A description of how the device works at a high-level.
+
+The description should not be constrained to implementation details but
+provide a simple mental model of how the feature is supposed to work.
+
+## Firmware Volumes
+*_TODO_*
+A bulleted list of the firmware volumes that feature module(s) are placed in.
+
+## Modules
+*_TODO_*
+A bulleted list of the modules that make up the feature.
+
+## <Module Name>
+*_TODO_*
+Each module in the feature should have a section that describes the
+module in a level of detail that is useful to better understand the module source code.
+
+## <Library Name>
+*_TODO_*
+Each library in the feature should have a section that describes the
+library in a level of detail that is useful to better understand the library source code.
+
+## Key Functions
+*_TODO_*
+A bulleted list of key functions for interacting with the feature.
+
+Not all features need to be listed. Only functions exposed through
+external interfaces that are important for feature users to be aware of.
+
+## Configuration
+*_TODO_*
+Information that is useful for configuring the feature.
+
+Not all configuration options need to be listed. This section is used
+to provide more background on configuration options than possible elsewhere.
+
+## Data Flows
+*_TODO_*
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+*_TODO_*
+Key control flows for the feature.
+
+## Build Flows
+*_TODO_*
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or
+require non-standard tool configuration. If the standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+*_TODO_*
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the
+feature is successful. If the test point is not implemented, this should be stated.
+
+## Functional Exit Criteria
+*_TODO_*
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board
+integrator can reference to ensure the feature is functional on their board.
+
+## Feature Enabling Checklist
+*_TODO_*
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+*_TODO_*
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 17/49] Features/Intel/IpmiFeaturePkg: Add libraries
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 17/49] Features/Intel/IpmiFeaturePkg: Add libraries Kubacki, Michael A
@ 2019-11-15 23:49 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:49 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
1. IpmiFeaturePkg/Include/Library/IpmiCommandLib.h - Update copyright year
2. IpmiFeaturePkg/Include/Library/IpmiPlatformHookLib.h - Update copyright year
3. IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c - Update copyright year
4. IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c - Update copyright year
5. IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c - Update copyright year
6. IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c - Update copyright year
7. IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c - Update copyright year
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 17/49] Features/Intel/IpmiFeaturePkg: Add libraries
This change adds the libraries required for the IPMI feature to IpmiFeaturePkg.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec | 9 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc | 72 +++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc | 5 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLib.inf | 32 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf | 26 ++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiCommandLib.h | 235 +++++++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiPlatformHookLib.h | 23 ++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c | 248 ++++++++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c | 101 +++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c | 275 ++++++++++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c | 81 ++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c | 36 +++
12 files changed, 1143 insertions(+)
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
index dfa8888e88..4c43fc5f49 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.d
+++ ec
@@ -22,6 +22,15 @@
[Includes]
Include
+[LibraryClasses]
+ ## @libraryclass Provides services to send IPMI commands.
+ #
+ IpmiCommandLib|Include/Library/IpmiCommandLib.inf
+
+ ## @libraryclass Provides an API for platform-specific IPMI hooks.
+ #
+ IpmiCommandLib|Include/Library/IpmiPlatformHookLib.h
+
[Guids]
gIpmiFeaturePkgTokenSpaceGuid = {0xc05283f6, 0xd6a8, 0x48f3, {0x9b, 0x59, 0xfb, 0xca, 0x71, 0x32, 0x0f, 0x12}}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
new file mode 100644
index 0000000000..c6a385108b
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeat
+++ ure.dsc
@@ -0,0 +1,72 @@
+## @file
+# This is a build description file for the Intelligent Platform Management Interface (IPMI) advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and # INF
+files to generate AutoGen.c and AutoGen.h files # for the build
+infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+#######################################################################
+#########
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+#######################################################################
+#########
+[Defines]
+
+#######################################################################
+#########
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+#######################################################################
+#########
+[LibraryClasses]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+
+BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.in
+f
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
+
+#######################################################################
+#########
+#
+# Component section - list of all components that need built for this feature.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+#######################################################################
+#########
+[Components]
+ #####################################
+ # IPMI Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package
+ components and should be tested # in the package build.
+
+ OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandL
+ ib.inf
+ OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/Ipm
+ iPlatformHookLibNull.inf
+
+ # Add components here that should be included in the package build.
+
+#######################################################################
+############################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+#######################################################################
+############################
+[BuildOptions]
+ *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
index 1952ba185e..623a52650f 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.d
+++ sc
@@ -22,3 +22,8 @@
SUPPORTED_ARCHITECTURES = IA32|X64
BUILD_TARGETS = DEBUG|RELEASE|NOOPT
SKUID_IDENTIFIER = DEFAULT
+
+#
+# This package always builds the feature.
+#
+!include Include/IpmiFeature.dsc
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLib.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLib.inf
new file mode 100644
index 0000000000..0bdace8688
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiComm
+++ andLib/IpmiCommandLib.inf
@@ -0,0 +1,32 @@
+### @file
+# Component description file for IPMI Command Library.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights
+reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # ###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = IpmiCommandLib
+ FILE_GUID = E599C9C7-5913-40A0-8669-67282E2BEC53
+ MODULE_TYPE = UEFI_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = IpmiCommandLib
+
+[sources]
+ IpmiCommandLibNetFnApp.c
+ IpmiCommandLibNetFnTransport.c
+ IpmiCommandLibNetFnChassis.c
+ IpmiCommandLibNetFnStorage.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ BaseMemoryLib
+ DebugLib
+ IpmiLib
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
new file mode 100644
index 0000000000..ab270079aa
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlat
+++ formHookLibNull/IpmiPlatformHookLibNull.inf
@@ -0,0 +1,26 @@
+### @file
+# Component description file for IPMI platform Library.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights
+reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # ###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = IpmiPlatformHookLibNull
+ FILE_GUID = C31A5B17-81DB-4D86-B376-17711BB6E0A5
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = IpmiPlatformHookLib
+
+[sources]
+ IpmiPlatformHookLibNull.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ DebugLib
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiCommandLib.h b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiCommandLib.h
new file mode 100644
index 0000000000..9b761717d4
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/
+++ IpmiCommandLib.h
@@ -0,0 +1,235 @@
+/** @file
+ This library abstract how to send/receive IPMI command.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _IPMI_COMMAND_LIB_H_
+#define _IPMI_COMMAND_LIB_H_
+
+#include <Uefi.h>
+#include <IndustryStandard/Ipmi.h>
+
+//
+// NetFnApp
+//
+EFI_STATUS
+EFIAPI
+IpmiGetDeviceId (
+ OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelfTestResult (
+ OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiResetWatchdogTimer (
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiSetWatchdogTimer (
+ IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetWatchdogTimer (
+ OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiSetBmcGlobalEnables (
+ IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetBmcGlobalEnables (
+ OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiClearMessageFlags (
+ IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetMessageFlags (
+ OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetMessage (
+ OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse,
+ IN OUT UINT32 *GetMessageResponseSize
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiSendMessage (
+ IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest,
+ IN UINT32 SendMessageRequestSize,
+ OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse,
+ IN OUT UINT32 *SendMessageResponseSize
+ );
+
+//
+// NetFnTransport
+//
+EFI_STATUS
+EFIAPI
+IpmiSolActivating (
+ IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiSetSolConfigurationParameters (
+ IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationParametersRequest,
+ IN UINT32 SetConfigurationParametersRequestSize,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSolConfigurationParameters (
+ IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST
+*GetConfigurationParametersRequest,
+ OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationParametersResponse,
+ IN OUT UINT32 *GetConfigurationParametersResponseSize
+ );
+
+//
+// NetFnChasis
+//
+EFI_STATUS
+EFIAPI
+IpmiGetChassisCapabilities (
+ OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE
+*GetChassisCapabilitiesResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetChassisStatus (
+ OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiChassisControl (
+ IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiSetPowerRestorePolicy (
+ IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest,
+ OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse
+ );
+
+//
+// NetFnStorage
+//
+EFI_STATUS
+EFIAPI
+IpmiGetFruInventoryAreaInfo (
+ IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoRequest,
+ OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE
+*GetFruInventoryAreaInfoResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiReadFruData (
+ IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest,
+ OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse,
+ IN OUT UINT32 *ReadFruDataResponseSize
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiWriteFruData (
+ IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest,
+ IN UINT32 WriteFruDataRequestSize,
+ OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelInfo (
+ OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelEntry (
+ IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest,
+ OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse,
+ IN OUT UINT32 *GetSelEntryResponseSize
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiAddSelEntry (
+ IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest,
+ OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiPartialAddSelEntry (
+ IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest,
+ IN UINT32 PartialAddSelEntryRequestSize,
+ OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiClearSel (
+ IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest,
+ OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelTime (
+ OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiSetSelTime (
+ IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest,
+ OUT UINT8 *CompletionCode
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSdrRepositoryInfo (
+ OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp
+ );
+
+EFI_STATUS
+EFIAPI
+IpmiGetSdr (
+ IN IPMI_GET_SDR_REQUEST *GetSdrRequest,
+ OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse,
+ IN OUT UINT32 *GetSdrResponseSize
+ );
+
+#endif
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiPlatformHookLib.h b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/IpmiPlatformHookLib.h
new file mode 100644
index 0000000000..8359e3f38b
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Library/
+++ IpmiPlatformHookLib.h
@@ -0,0 +1,23 @@
+/** @file
+ This library abstract the platform specific hook for IPMI.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _IPMI_PLATFORM_UPDATE_LIB_H_
+#define _IPMI_PLATFORM_UPDATE_LIB_H_
+
+#include <Uefi.h>
+#include <IndustryStandard/Acpi.h>
+#include <Protocol/Smbios.h>
+
+EFI_STATUS
+EFIAPI
+PlatformIpmiIoRangeSet(
+ UINT16 IpmiIoBase
+ );
+
+#endif
+
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
new file mode 100644
index 0000000000..b57db50610
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiComm
+++ andLib/IpmiCommandLibNetFnApp.c
@@ -0,0 +1,248 @@
+/** @file
+ IPMI Command - NetFnApp.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IpmiLib.h>
+
+#include <IndustryStandard/Ipmi.h>
+
+EFI_STATUS
+EFIAPI
+IpmiGetDeviceId (
+ OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*DeviceId);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_GET_DEVICE_ID,
+ NULL,
+ 0,
+ (VOID *)DeviceId,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelfTestResult (
+ OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*SelfTestResult);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_GET_SELFTEST_RESULTS,
+ NULL,
+ 0,
+ (VOID *)SelfTestResult,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiResetWatchdogTimer (
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_RESET_WATCHDOG_TIMER,
+ NULL,
+ 0,
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiSetWatchdogTimer (
+ IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_SET_WATCHDOG_TIMER,
+ (VOID *)SetWatchdogTimer,
+ sizeof(*SetWatchdogTimer),
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetWatchdogTimer (
+ OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetWatchdogTimer);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_GET_WATCHDOG_TIMER,
+ NULL,
+ 0,
+ (VOID *)GetWatchdogTimer,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiSetBmcGlobalEnables (
+ IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_SET_BMC_GLOBAL_ENABLES,
+ (VOID *)SetBmcGlobalEnables,
+ sizeof(*SetBmcGlobalEnables),
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetBmcGlobalEnables (
+ OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetBmcGlobalEnables);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_GET_BMC_GLOBAL_ENABLES,
+ NULL,
+ 0,
+ (VOID *)GetBmcGlobalEnables,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiClearMessageFlags (
+ IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_CLEAR_MESSAGE_FLAGS,
+ (VOID *)ClearMessageFlagsRequest,
+ sizeof(*ClearMessageFlagsRequest),
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetMessageFlags (
+ OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetMessageFlagsResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_GET_MESSAGE_FLAGS,
+ NULL,
+ 0,
+ (VOID *)GetMessageFlagsResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetMessage (
+ OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse,
+ IN OUT UINT32 *GetMessageResponseSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_GET_MESSAGE,
+ NULL,
+ 0,
+ (VOID *)GetMessageResponse,
+ GetMessageResponseSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiSendMessage (
+ IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest,
+ IN UINT32 SendMessageRequestSize,
+ OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse,
+ IN OUT UINT32 *SendMessageResponseSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_APP,
+ IPMI_APP_SEND_MESSAGE,
+ (VOID *)SendMessageRequest,
+ SendMessageRequestSize,
+ (VOID *)SendMessageResponse,
+ SendMessageResponseSize
+ );
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
new file mode 100644
index 0000000000..1b86aa888e
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiComm
+++ andLib/IpmiCommandLibNetFnChassis.c
@@ -0,0 +1,101 @@
+/** @file
+ IPMI Command - NetFnChassis.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IpmiLib.h>
+
+#include <IndustryStandard/Ipmi.h>
+
+
+EFI_STATUS
+EFIAPI
+IpmiGetChassisCapabilities (
+ OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE
+*GetChassisCapabilitiesResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetChassisCapabilitiesResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_CHASSIS,
+ IPMI_CHASSIS_GET_CAPABILITIES,
+ NULL,
+ 0,
+ (VOID *)GetChassisCapabilitiesResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetChassisStatus (
+ OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetChassisStatusResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_CHASSIS,
+ IPMI_CHASSIS_GET_STATUS,
+ NULL,
+ 0,
+ (VOID *)GetChassisStatusResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiChassisControl (
+ IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_CHASSIS,
+ IPMI_CHASSIS_CONTROL,
+ (VOID *)ChassisControlRequest,
+ sizeof(*ChassisControlRequest),
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiSetPowerRestorePolicy (
+ IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest,
+ OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*ChassisControlResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_CHASSIS,
+ IPMI_CHASSIS_SET_POWER_RESTORE_POLICY,
+ (VOID *)ChassisControlRequest,
+ sizeof(*ChassisControlRequest),
+ (VOID *)ChassisControlResponse,
+ &DataSize
+ );
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c
new file mode 100644
index 0000000000..8e892c5f84
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiComm
+++ andLib/IpmiCommandLibNetFnStorage.c
@@ -0,0 +1,275 @@
+/** @file
+ IPMI Command - NetFnStorage.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IpmiLib.h>
+
+#include <IndustryStandard/Ipmi.h>
+
+
+EFI_STATUS
+EFIAPI
+IpmiGetFruInventoryAreaInfo (
+ IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoRequest,
+ OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE
+*GetFruInventoryAreaInfoResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetFruInventoryAreaInfoResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_GET_FRU_INVENTORY_AREAINFO,
+ (VOID *)GetFruInventoryAreaInfoRequest,
+ sizeof(*GetFruInventoryAreaInfoRequest),
+ (VOID *)GetFruInventoryAreaInfoResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiReadFruData (
+ IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest,
+ OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse,
+ IN OUT UINT32 *ReadFruDataResponseSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_READ_FRU_DATA,
+ (VOID *)ReadFruDataRequest,
+ sizeof(*ReadFruDataRequest),
+ (VOID *)ReadFruDataResponse,
+ ReadFruDataResponseSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiWriteFruData (
+ IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest,
+ IN UINT32 WriteFruDataRequestSize,
+ OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*WriteFruDataResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_WRITE_FRU_DATA,
+ (VOID *)WriteFruDataRequest,
+ WriteFruDataRequestSize,
+ (VOID *)WriteFruDataResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelInfo (
+ OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetSelInfoResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_GET_SEL_INFO,
+ NULL,
+ 0,
+ (VOID *)GetSelInfoResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelEntry (
+ IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest,
+ OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse,
+ IN OUT UINT32 *GetSelEntryResponseSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_GET_SEL_ENTRY,
+ (VOID *)GetSelEntryRequest,
+ sizeof(*GetSelEntryRequest),
+ (VOID *)GetSelEntryResponse,
+ GetSelEntryResponseSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiAddSelEntry (
+ IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest,
+ OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*AddSelEntryResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_ADD_SEL_ENTRY,
+ (VOID *)AddSelEntryRequest,
+ sizeof(*AddSelEntryRequest),
+ (VOID *)AddSelEntryResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiPartialAddSelEntry (
+ IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest,
+ IN UINT32 PartialAddSelEntryRequestSize,
+ OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*PartialAddSelEntryResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_PARTIAL_ADD_SEL_ENTRY,
+ (VOID *)PartialAddSelEntryRequest,
+ PartialAddSelEntryRequestSize,
+ (VOID *)PartialAddSelEntryResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiClearSel (
+ IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest,
+ OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*ClearSelResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_CLEAR_SEL,
+ (VOID *)ClearSelRequest,
+ sizeof(*ClearSelRequest),
+ (VOID *)ClearSelResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSelTime (
+ OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetSelTimeResponse);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_GET_SEL_TIME,
+ NULL,
+ 0,
+ (VOID *)GetSelTimeResponse,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiSetSelTime (
+ IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_SET_SEL_TIME,
+ (VOID *)SetSelTimeRequest,
+ sizeof(*SetSelTimeRequest),
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSdrRepositoryInfo (
+ OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*GetSdrRepositoryInfoResp);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_GET_SDR_REPOSITORY_INFO,
+ NULL,
+ 0,
+ (VOID *)GetSdrRepositoryInfoResp,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSdr (
+ IN IPMI_GET_SDR_REQUEST *GetSdrRequest,
+ OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse,
+ IN OUT UINT32 *GetSdrResponseSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_STORAGE,
+ IPMI_STORAGE_GET_SDR,
+ (VOID *)GetSdrRequest,
+ sizeof(*GetSdrRequest),
+ (VOID *)GetSdrResponse,
+ GetSdrResponseSize
+ );
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c
new file mode 100644
index 0000000000..3b9b17b909
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiComm
+++ andLib/IpmiCommandLibNetFnTransport.c
@@ -0,0 +1,81 @@
+/** @file
+ IPMI Command - NetFnTransport.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IpmiLib.h>
+
+#include <IndustryStandard/Ipmi.h>
+
+
+EFI_STATUS
+EFIAPI
+IpmiSolActivating (
+ IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_TRANSPORT,
+ IPMI_TRANSPORT_SOL_ACTIVATING,
+ (VOID *)SolActivatingRequest,
+ sizeof(*SolActivatingRequest),
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiSetSolConfigurationParameters (
+ IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationParametersRequest,
+ IN UINT32 SetConfigurationParametersRequestSize,
+ OUT UINT8 *CompletionCode
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DataSize;
+
+ DataSize = sizeof(*CompletionCode);
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_TRANSPORT,
+ IPMI_TRANSPORT_SET_SOL_CONFIG_PARAM,
+ (VOID *)SetConfigurationParametersRequest,
+ SetConfigurationParametersRequestSize,
+ (VOID *)CompletionCode,
+ &DataSize
+ );
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+IpmiGetSolConfigurationParameters (
+ IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST
+*GetConfigurationParametersRequest,
+ OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationParametersResponse,
+ IN OUT UINT32 *GetConfigurationParametersResponseSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = IpmiSubmitCommand (
+ IPMI_NETFN_TRANSPORT,
+ IPMI_TRANSPORT_GET_SOL_CONFIG_PARAM,
+ (VOID *)GetConfigurationParametersRequest,
+ sizeof(*GetConfigurationParametersRequest),
+ (VOID *)GetConfigurationParametersResponse,
+ GetConfigurationParametersResponseSize
+ );
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c
new file mode 100644
index 0000000000..bdc8d23827
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlat
+++ formHookLibNull/IpmiPlatformHookLibNull.c
@@ -0,0 +1,36 @@
+/** @file
+ IPMI platform hook library.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/IpmiPlatformHookLib.h>
+
+//
+// Prototype definitions for IPMI Platform Update Library // EFI_STATUS
+EFIAPI PlatformIpmiIoRangeSet(
+ UINT16 IpmiIoBase
+ )
+/*++
+
+ Routine Description:
+
+ This function sets IPMI Io range
+
+ Arguments:
+
+ IpmiIoBase
+
+ Returns:
+
+ Status
+
+--*/
+{
+ return EFI_SUCCESS;
+}
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 18/49] Features/Intel/IpmiFeaturePkg: Add modules
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 18/49] Features/Intel/IpmiFeaturePkg: Add modules Kubacki, Michael A
@ 2019-11-15 23:49 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:49 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
1. IpmiFeaturePkg/BmcAcpi/BmcSsdt/BmcSsdt.asl - Update copyright year.
2. IpmiFeaturePkg/BmcAcpi/BmcSsdt/IpmiOprRegions.asi - Update copyright year.
3. IpmiFeaturePkg/Frb/FrbDxe.c - Update copyright year.
4. IpmiFeaturePkg/IpmiInit/DxeIpmiInit.c - Update copyright year
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 18/49] Features/Intel/IpmiFeaturePkg: Add modules
This change adds the modules for the IPMI feature to
IpmiFeaturePkg.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec | 8 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc | 78 +++++-
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc | 2 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf | 8 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf | 3 +
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf | 47 ++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf | 33 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf | 37 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf | 37 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf | 35 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf | 34 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf | 32 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf | 33 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf | 37 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.c | 257 ++++++++++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.c | 236 ++++++++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.c | 236 ++++++++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.c | 84 +++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.c | 67 +++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.c | 150 ++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.c | 96 ++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.c | 112 +++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.c | 164 +++++++++++++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/BmcSsdt.asl | 28 +++
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/IpmiOprRegions.asi | 58 +++++
25 files changed, 1909 insertions(+), 3 deletions(-)
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
index 4c43fc5f49..1426496d28 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
@@ -36,3 +36,11 @@
[PcdsFeatureFlag]
gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable|FALSE|BOOLEAN|0xA0000001
+
+[PcdsFixedAtBuild]
+ gIpmiFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels|3|UINT8|0xF0000001
+
+[PcdsDynamic, PcdsDynamicEx]
+ gIpmiFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag|TRUE|BOOLEAN|0xD0000001
+ gIpmiFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue|360|UINT16|0xD0000002
+ gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress|0xCA2|UINT16|0xD0000003
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
index c6a385108b..a82f18a68c 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
@@ -18,6 +18,12 @@
#
################################################################################
[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
################################################################################
#
@@ -32,6 +38,36 @@
BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
+
+ #####################################
+ # IPMI Feature Package
+ #####################################
+ IpmiCommandLib|OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLib.inf
+
+[LibraryClasses.common.PEI_CORE,LibraryClasses.common.PEIM]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+ PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
+ PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+ PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
+
+[LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.UEFI_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
################################################################################
#
@@ -47,17 +83,50 @@
# generated for it, but the binary will not be put into any firmware volume.
#
################################################################################
-[Components]
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # IPMI Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
+
+ # Add components here that should be included in the package build.
+ OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf
+ OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
#####################################
# IPMI Feature Package
#####################################
# Add library instances here that are not included in package components and should be tested
# in the package build.
- OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLib.inf
+
OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
# Add components here that should be included in the package build.
+ OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf
+ OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf
+ OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf
+ OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf
+ OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf
+ OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf
###################################################################################################
#
@@ -67,6 +136,9 @@
# applied for any modules or only those modules with the specific
# module style (EDK or EDKII) specified in [Components] section.
#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
###################################################################################################
[BuildOptions]
- *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
index 623a52650f..6a3eed0882 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc
@@ -22,6 +22,8 @@
SUPPORTED_ARCHITECTURES = IA32|X64
BUILD_TARGETS = DEBUG|RELEASE|NOOPT
SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
#
# This package always builds the feature.
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf
index c3847c54c7..b5b37ddd9f 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf
@@ -6,3 +6,11 @@
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
+
+ INF OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf
+ INF OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf
+ INF OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf
+ INF OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf
+ INF OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf
+ INF OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf
+ INF OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf
index 0c82d7eb02..4aa2d8e9da 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf
@@ -6,3 +6,6 @@
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
+
+INF OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf
+INF OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf
new file mode 100644
index 0000000000..a84813f55c
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf
@@ -0,0 +1,47 @@
+### @file
+# Component description file for BMC ACPI.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = BmcAcpi
+ FILE_GUID = F59DAA23-D5D5-4d16-91FC-D03ABDC12FFE
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = BmcAcpiEntryPoint
+
+[Sources]
+ BmcAcpi.c
+ BmcSsdt/BmcSsdt.asl
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ BaseMemoryLib
+ DebugLib
+ UefiLib
+
+[Protocols]
+ gEfiFirmwareVolume2ProtocolGuid
+ gEfiAcpiTableProtocolGuid
+
+[Pcd]
+ gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId
+
+[Depex]
+ gEfiAcpiTableProtocolGuid
+
+[BuildOptions]
+ *_*_*_ASL_FLAGS = -oi
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf
new file mode 100644
index 0000000000..665b3d9bda
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf
@@ -0,0 +1,33 @@
+### @file
+# Component description file for BMC ELOG.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = BmcElog
+ FILE_GUID = 8A17F6CA-BF1A-45C4-FFFF-FFFF0C829DDD
+ MODULE_TYPE = DXE_DRIVER
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializeBmcElogLayer
+
+[Sources]
+ BmcElog.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ DebugLib
+ UefiBootServicesTableLib
+ IpmiCommandLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf
new file mode 100644
index 0000000000..85836cd8ee
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf
@@ -0,0 +1,37 @@
+### @file
+# Component description file for IPMI FRB.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = FrbDxe
+ FILE_GUID = F6C7812D-81BF-4e6d-A87D-E75AF17BD511
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = FrbDxeEntryPoint
+
+[Sources]
+ FrbDxe.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ MemoryAllocationLib
+ UefiLib
+ DebugLib
+ BaseMemoryLib
+ IpmiCommandLib
+ PcdLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf
new file mode 100644
index 0000000000..7ad00ae574
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf
@@ -0,0 +1,37 @@
+### @file
+# Component description file for IPMI FRB PEIM.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = FrbPei
+ FILE_GUID = 7F9F9788-9F1F-4725-895C-3932F1A04DE8
+ MODULE_TYPE = PEIM
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializeFrbPei
+
+[Sources]
+ FrbPei.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ PeimEntryPoint
+ DebugLib
+ BaseMemoryLib
+ PcdLib
+ IpmiCommandLib
+
+[Pcd]
+ gIpmiFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag
+ gIpmiFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf
new file mode 100644
index 0000000000..0778b221c1
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf
@@ -0,0 +1,35 @@
+### @file
+# Component description file for IPMI FRU.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = IpmiFru
+ FILE_GUID = 3F1D6464-2B4C-4640-BAC4-3DD905D26CDA
+ MODULE_TYPE = DXE_DRIVER
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializeFru
+
+[Sources]
+ IpmiFru.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ UefiLib
+ DebugLib
+ UefiBootServicesTableLib
+ BaseMemoryLib
+ IpmiCommandLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf
new file mode 100644
index 0000000000..68ff70cd43
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf
@@ -0,0 +1,34 @@
+### @file
+# Component description file for IPMI initialization.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = DxeIpmiInit
+ FILE_GUID = 07A01ACF-46D5-48de-A63D-74FA92AA8450
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = IpmiInterfaceInit
+
+[Sources]
+ DxeIpmiInit.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ DebugLib
+ UefiDriverEntryPoint
+ IpmiCommandLib
+ TimerLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf
new file mode 100644
index 0000000000..825451ede1
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf
@@ -0,0 +1,32 @@
+### @file
+# Component description file for IPMI initialization in PEI.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = PeiIpmiInit
+ FILE_GUID = D8F57F4E-D67D-4f2c-8351-C7092986542F
+ MODULE_TYPE = PEIM
+ VERSION_STRING = 1.0
+ ENTRY_POINT = PeimIpmiInterfaceInit
+
+[Sources]
+ PeiIpmiInit.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ PeimEntryPoint
+ DebugLib
+ IpmiCommandLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf
new file mode 100644
index 0000000000..7e7d2826cb
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf
@@ -0,0 +1,33 @@
+### @file
+# Component description file for IPMI OS watch dog timer driver.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = OsWdt
+ FILE_GUID = BE9B694A-B5D9-48e0-A527-6E1A49EB7028
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = DriverInit
+
+[Sources]
+ OsWdt.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ DebugLib
+ UefiBootServicesTableLib
+ BaseMemoryLib
+ IpmiCommandLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf
new file mode 100644
index 0000000000..826144e537
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf
@@ -0,0 +1,37 @@
+### @file
+# Component description file for IPMI Serial Over LAN (SOL) driver.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = SolStatus
+ FILE_GUID = F9887B5E-2D46-4213-8794-14F1FD39F6B8
+ MODULE_TYPE = DXE_DRIVER
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ VERSION_STRING = 1.0
+ ENTRY_POINT = SolStatusEntryPoint
+
+[Sources]
+ SolStatus.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+
+[Pcd]
+ gIpmiFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ DebugLib
+ UefiBootServicesTableLib
+ IpmiCommandLib
+ PcdLib
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.c
new file mode 100644
index 0000000000..990b4b9e83
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.c
@@ -0,0 +1,257 @@
+/** @file
+ BMC ACPI.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+//
+// Statements that include other header files
+//
+#include <PiDxe.h>
+
+#include <IndustryStandard/Acpi.h>
+#include <Protocol/AcpiSystemDescriptionTable.h>
+#include <Protocol/FirmwareVolume2.h>
+#include <Protocol/AcpiTable.h>
+
+#include <Library/BaseLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiLib.h>
+
+#ifndef EFI_ACPI_CREATOR_ID
+#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('M', 'S', 'F', 'T')
+#endif
+#ifndef EFI_ACPI_CREATOR_REVISION
+#define EFI_ACPI_CREATOR_REVISION 0x0100000D
+#endif
+
+/**
+
+ Locate the first instance of a protocol. If the protocol requested is an
+ FV protocol, then it will return the first FV that contains the ACPI table
+ storage file.
+
+ @param Protocol - The protocol to find.
+ Instance - Return pointer to the first instance of the protocol.
+ Type - The type of protocol to locate.
+
+ @retval EFI_SUCCESS - The function completed successfully.
+ @retval EFI_NOT_FOUND - The protocol could not be located.
+ @retval EFI_OUT_OF_RESOURCES - There are not enough resources to find the protocol.
+
+**/
+EFI_STATUS
+LocateSupportProtocol (
+ IN EFI_GUID *Protocol,
+ OUT VOID **Instance,
+ IN UINT32 Type
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ EFI_FV_FILETYPE FileType;
+ UINT32 FvStatus = 0;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINTN Size;
+ UINTN Index;
+
+ Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NumberOfHandles, &HandleBuffer);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ //
+ // Looking for FV with ACPI storage file
+ //
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+ Status = gBS->HandleProtocol (HandleBuffer[Index], Protocol, Instance);
+ ASSERT (!EFI_ERROR (Status));
+
+ if (!Type) {
+ //
+ // Not looking for the FV protocol, so find the first instance of the
+ // protocol. There should not be any errors because our handle buffer
+ // should always contain at least one or LocateHandleBuffer would have
+ // returned not found.
+ //
+ break;
+ }
+ //
+ // See if it has the ACPI storage file
+ //
+ Status = ((EFI_FIRMWARE_VOLUME2_PROTOCOL *) (*Instance))->ReadFile (
+ *Instance,
+ &gEfiCallerIdGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ //
+ // If we found it, then we are done
+ //
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+ }
+
+ gBS->FreePool (HandleBuffer);
+ return Status;
+}
+
+
+EFI_STATUS
+UpdateDeviceSsdtTable (
+ IN OUT EFI_ACPI_COMMON_HEADER *Table
+ )
+{
+ EFI_ACPI_DESCRIPTION_HEADER *TableHeader = NULL;
+ UINT64 TempOemTableId;
+ UINT8 *DataPtr;
+ EFI_ACPI_IO_PORT_DESCRIPTOR *IoRsc;
+
+ TableHeader = (EFI_ACPI_DESCRIPTION_HEADER *)Table;
+
+ //
+ // Update the OEMID and OEM Table ID.
+ //
+ CopyMem (&TableHeader->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof(TableHeader->OemId));
+ TempOemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
+ CopyMem (&TableHeader->OemTableId, &TempOemTableId, sizeof(UINT64));
+ TableHeader->CreatorId = EFI_ACPI_CREATOR_ID;
+ TableHeader->CreatorRevision = EFI_ACPI_CREATOR_REVISION;
+
+ //
+ // Update IO(Decode16, 0xCA2, 0xCA2, 0, 2)
+ //
+ DEBUG ((DEBUG_INFO, "UpdateDeviceSsdtTable - IPMI\n"));
+ for (DataPtr = (UINT8 *)(Table + 1);
+ DataPtr < (UINT8 *) ((UINT8 *) Table + Table->Length - 4);
+ DataPtr++) {
+ if (CompareMem(DataPtr, "_CRS", 4) == 0) {
+ DataPtr += 4; // Skip _CRS
+ ASSERT (*DataPtr == AML_BUFFER_OP);
+ DataPtr ++; // Skip AML_BUFFER_OP
+ ASSERT ((*DataPtr & (BIT7|BIT6)) == 0);
+ DataPtr ++; // Skip PkgLength - 0xD
+ ASSERT ((*DataPtr) == AML_BYTE_PREFIX);
+ DataPtr ++; // Skip BufferSize OpCode
+ DataPtr ++; // Skip BufferSize - 0xA
+ IoRsc = (VOID *)DataPtr;
+ ASSERT (IoRsc->Header.Bits.Type == ACPI_SMALL_ITEM_FLAG);
+ ASSERT (IoRsc->Header.Bits.Name == ACPI_SMALL_IO_PORT_DESCRIPTOR_NAME);
+ ASSERT (IoRsc->Header.Bits.Length == sizeof(EFI_ACPI_IO_PORT_DESCRIPTOR) - sizeof(ACPI_SMALL_RESOURCE_HEADER));
+ DEBUG ((DEBUG_INFO, "IPMI IO Base in ASL update - 0x%04x <= 0x%04x\n", IoRsc->BaseAddressMin, PcdGet16(PcdIpmiIoBaseAddress)));
+ IoRsc->BaseAddressMin = PcdGet16(PcdIpmiIoBaseAddress);
+ IoRsc->BaseAddressMax = PcdGet16(PcdIpmiIoBaseAddress);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+
+ Entry point for Acpi platform driver.
+
+ @param ImageHandle - A handle for the image that is initializing this driver.
+ @param SystemTable - A pointer to the EFI system table.
+
+ @retval EFI_SUCCESS - Driver initialized successfully.
+ @retval EFI_LOAD_ERROR - Failed to Initialize or has been loaded.
+ @retval EFI_OUT_OF_RESOURCES - Could not allocate needed resources.
+
+**/
+EFI_STATUS
+EFIAPI
+BmcAcpiEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_STATUS AcpiStatus;
+
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol;
+ INTN Instance = 0;
+ EFI_ACPI_COMMON_HEADER *CurrentTable = NULL;
+ UINTN TableHandle = 0;
+ UINT32 FvStatus;
+ UINT32 Size;
+
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ UINTN TableSize;
+
+
+ //
+ // Find the AcpiTable protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+
+ //
+ // Locate the firmware volume protocol
+ //
+ Status = LocateSupportProtocol (&gEfiFirmwareVolume2ProtocolGuid, (VOID **) &FwVol, 1);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = EFI_SUCCESS;
+ Instance = 0;
+
+ //
+ // Read tables from the storage file.
+ //
+ while (!EFI_ERROR (Status)) {
+ CurrentTable = NULL;
+
+ Status = FwVol->ReadSection (
+ FwVol,
+ &gEfiCallerIdGuid,
+ EFI_SECTION_RAW,
+ Instance,
+ (VOID **) &CurrentTable,
+ (UINTN *) &Size,
+ &FvStatus
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Perform any table specific updates.
+ //
+ AcpiStatus = UpdateDeviceSsdtTable (CurrentTable);
+ if (!EFI_ERROR (AcpiStatus)) {
+
+ TableHandle = 0;
+ TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
+ ASSERT (Size >= TableSize);
+
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ CurrentTable,
+ TableSize,
+ &TableHandle
+ );
+
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ //
+ // Increment the instance
+ //
+ Instance++;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.c
new file mode 100644
index 0000000000..a6d075b19c
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.c
@@ -0,0 +1,236 @@
+/** @file
+ BMC Event Log functions.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/IpmiCommandLib.h>
+
+EFI_STATUS
+EFIAPI
+CheckIfSelIsFull (
+ VOID
+ );
+
+/*++
+
+ Routine Description:
+ This function verifies the BMC SEL is full and When it is reports the error to the Error Manager.
+
+ Arguments:
+ None
+
+ Returns:
+ EFI_SUCCESS
+ EFI_DEVICE_ERROR
+
+--*/
+EFI_STATUS
+WaitTillErased (
+ UINT8 *ResvId
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+ BmcElogPrivateData - Bmc event log instance
+ ResvId - Reserved ID
+
+Returns:
+
+ EFI_SUCCESS
+ EFI_NO_RESPONSE
+
+--*/
+{
+ INTN Counter;
+ IPMI_CLEAR_SEL_REQUEST ClearSel;
+ IPMI_CLEAR_SEL_RESPONSE ClearSelResponse;
+
+ Counter = 0x200;
+ ZeroMem (&ClearSelResponse, sizeof(ClearSelResponse));
+
+ while (TRUE) {
+ ZeroMem (&ClearSel, sizeof(ClearSel));
+ ClearSel.Reserve[0] = ResvId[0];
+ ClearSel.Reserve[1] = ResvId[1];
+ ClearSel.AscC = 0x43;
+ ClearSel.AscL = 0x4C;
+ ClearSel.AscR = 0x52;
+ ClearSel.Erase = 0x00;
+
+ IpmiClearSel (
+ &ClearSel,
+ &ClearSelResponse
+ );
+
+ if ((ClearSelResponse.ErasureProgress & 0xf) == 1) {
+ return EFI_SUCCESS;
+ }
+ //
+ // If there is not a response from the BMC controller we need to return and not hang.
+ //
+ --Counter;
+ if (Counter == 0x0) {
+ return EFI_NO_RESPONSE;
+ }
+ }
+}
+
+EFI_STATUS
+EfiActivateBmcElog (
+ IN BOOLEAN *EnableElog,
+ OUT BOOLEAN *ElogStatus
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+ This - Protocol pointer
+ DataType - indicate event log type
+ EnableElog - Enable/Disable event log
+ ElogStatus - return log status
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ EFI_STATUS Status;
+ UINT8 ElogStat;
+ IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST SetBmcGlobalEnables;
+ IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE GetBmcGlobalEnables;
+ UINT8 CompletionCode;
+
+ Status = EFI_SUCCESS;
+ ElogStat = 0;
+
+ Status = IpmiGetBmcGlobalEnables (&GetBmcGlobalEnables);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ if (EnableElog == NULL) {
+ *ElogStatus = GetBmcGlobalEnables.GetEnables.Bits.SystemEventLogging;
+ } else {
+ if (Status == EFI_SUCCESS) {
+ if (*EnableElog) {
+ ElogStat = 1;
+ }
+
+ CopyMem (&SetBmcGlobalEnables, (UINT8 *)&GetBmcGlobalEnables + 1, sizeof(UINT8));
+ SetBmcGlobalEnables.SetEnables.Bits.SystemEventLogging = ElogStat;
+
+ Status = IpmiSetBmcGlobalEnables (&SetBmcGlobalEnables, &CompletionCode);
+ }
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+SetElogRedirInstall (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+ None
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+{
+ BOOLEAN EnableElog;
+ BOOLEAN ElogStatus;
+
+ //
+ // Activate the Event Log (This should depend upon Setup).
+ //
+ EfiActivateBmcElog (&EnableElog, &ElogStatus);
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+InitializeBmcElogLayer (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+ ImageHandle - ImageHandle of the loaded driver
+ SystemTable - Pointer to the System Table
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ SetElogRedirInstall ();
+
+ CheckIfSelIsFull ();
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+CheckIfSelIsFull (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ This function verifies the BMC SEL is full and When it is reports the error to the Error Manager.
+
+ Arguments:
+ None
+
+ Returns:
+ EFI_SUCCESS
+ EFI_DEVICE_ERROR
+
+--*/
+{
+ EFI_STATUS Status;
+ UINT8 SelIsFull;
+ IPMI_GET_SEL_INFO_RESPONSE SelInfo;
+
+ Status = IpmiGetSelInfo (&SelInfo);
+ if (EFI_ERROR (Status)) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ //
+ // Check the Bit7 of the OperationByte if SEL is OverFlow.
+ //
+ SelIsFull = (SelInfo.OperationSupport & 0x80);
+ DEBUG ((DEBUG_INFO, "SelIsFull - 0x%x\n", SelIsFull));
+
+ return EFI_SUCCESS;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.c
new file mode 100644
index 0000000000..6454fa5f9b
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.c
@@ -0,0 +1,236 @@
+/** @file
+ IPMI FRB Driver.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiDxe.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PcdLib.h>
+#include <Library/IpmiCommandLib.h>
+#include <IndustryStandard/Ipmi.h>
+
+EFI_STATUS
+EfiDisableFrb (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ This routine disables the specified FRB timer.
+
+ Arguments:
+ This - This pointer
+ FrbType - Type of FRB timer to get data on
+
+ Returns:
+ EFI_SUCCESS - FRB timer was disabled
+ EFI_ABORTED - Timer was already stopped
+ EFI_UNSUPPORTED - This type of FRB timer is not supported.
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer;
+ UINT8 CompletionCode;
+ IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
+
+ Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Check if timer is still running, if not abort disable routine.
+ //
+ if (GetWatchdogTimer.TimerUse.Bits.TimerRunning == 0) {
+ return EFI_ABORTED;
+ }
+
+ ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer));
+ //
+ // Just flip the Timer Use bit. This should release the timer.
+ //
+ SetWatchdogTimer.TimerUse.Bits.TimerRunning = 0;
+ SetWatchdogTimer.TimerUse.Bits.TimerUse = IPMI_WATCHDOG_TIMER_BIOS_FRB2;
+ SetWatchdogTimer.TimerUseExpirationFlagsClear &= ~BIT2;
+ SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT4;
+
+ Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
+ return Status;
+}
+
+VOID
+EFIAPI
+DisableFRB2Handler (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/*++
+
+ Routine Description:
+ Disables FRB2. This function gets called each time the
+ EFI_EVENT_SIGNAL_READY_TO_BOOT gets signaled
+
+ Arguments:
+ Standard event notification function arguments:
+ Event - the event that is signaled.
+ Context - not used here.
+
+ Returns:
+
+--*/
+{
+ DEBUG((DEBUG_ERROR, "!!! enter DisableFRB2Handler()!!!\n"));
+
+ EfiDisableFrb ();
+}
+
+EFI_STATUS
+CheckForAndReportErrors(
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Check the Watchdog timer expiration flags and report the kind of watchdog
+ timeout occurred to the Error Manager.
+
+ Arguments:
+
+ Returns:
+ EFI_SUCCESS - Errors retrieved and reported
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
+ IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer;
+ UINT8 CompletionCode;
+
+ //
+ // Get the Watchdog timer info to find out what kind of timer expiration occurred.
+ //
+ Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ //
+ // If FRB2 Failure occurred, report it to the error manager and log a SEL.
+ //
+ if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT1) != 0) {
+ //
+ // Report the FRB2 time-out error
+ //
+ } else if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT3) != 0) {
+ //
+ // Report the OS Watchdog timer failure
+ //
+ }
+
+ //
+ // Need to clear Timer expiration flags after checking.
+ //
+ ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer));
+ SetWatchdogTimer.TimerUse = GetWatchdogTimer.TimerUse;
+ SetWatchdogTimer.TimerActions = GetWatchdogTimer.TimerActions;
+ SetWatchdogTimer.PretimeoutInterval = GetWatchdogTimer.PretimeoutInterval;
+ SetWatchdogTimer.TimerUseExpirationFlagsClear = GetWatchdogTimer.TimerUseExpirationFlagsClear;
+ SetWatchdogTimer.InitialCountdownValue = GetWatchdogTimer.InitialCountdownValue;
+ SetWatchdogTimer.TimerUse.Bits.TimerRunning = 1;
+ SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT2 | BIT3;
+
+ Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
+
+ return Status;
+}
+
+EFI_STATUS
+ReportFrb2Status (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ This routine is built only when DEBUG_MODE is enabled. It is used
+ to report the status of FRB2 when the FRB2 driver is installed.
+
+ Arguments:
+ none
+
+ Returns:
+ EFI_SUCCESS: All info was retrieved and reported
+ EFI_ERROR: There was an error during info retrieval
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
+
+ //
+ // Get the Watchdog timer info to find out what kind of timer expiration occurred.
+ //
+ Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_INFO, "Failed to get Watchdog Timer info from BMC.\n"));
+ return Status;
+ }
+
+ //
+ // Check if timer is running, report status to DEBUG_MODE output.
+ //
+ if (GetWatchdogTimer.TimerUse.Bits.TimerRunning == 1) {
+ DEBUG ((DEBUG_INFO, "FRB2 Timer is running.\n"));
+ } else {
+ DEBUG ((DEBUG_INFO, "FRB2 Timer is not running.\n"));
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+FrbDxeEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+ Routine Description:
+ This is the standard EFI driver point. This function intitializes
+ the private data required for creating FRB Driver.
+
+ Arguments:
+ ImageHandle - Handle for the image of this driver
+ SystemTable - Pointer to the EFI System Table
+
+ Returns:
+ EFI_SUCCESS - Protocol successfully started and installed
+ EFI_UNSUPPORTED - Protocol can't be started
+
+--*/
+{
+ EFI_EVENT ReadyToBootEvent;
+ EFI_STATUS Status;
+
+ CheckForAndReportErrors();
+ ReportFrb2Status ();
+
+ //
+ // Register the event to Disable FRB2 before Boot.
+ //
+ Status = EfiCreateEventReadyToBootEx (
+ TPL_NOTIFY,
+ DisableFRB2Handler,
+ NULL,
+ &ReadyToBootEvent
+ );
+
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.c
new file mode 100644
index 0000000000..3e65eb9dad
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.c
@@ -0,0 +1,84 @@
+/** @file
+ IPMI FRB PEIM.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/IoLib.h>
+#include <Library/PcdLib.h>
+#include <Library/IpmiCommandLib.h>
+
+#include <IndustryStandard/Ipmi.h>
+
+VOID
+SetWatchDogTimer (
+ IN BOOLEAN Frb2Enabled
+ )
+{
+ EFI_STATUS Status;
+ IPMI_SET_WATCHDOG_TIMER_REQUEST FrbTimer;
+ IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
+ UINT8 CompletionCode;
+
+ Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
+ if (EFI_ERROR(Status)) {
+ return ;
+ }
+
+ if (Frb2Enabled) {
+ ZeroMem (&FrbTimer, sizeof(FrbTimer));
+ //Byte 1
+ FrbTimer.TimerUse.Bits.TimerUse = IPMI_WATCHDOG_TIMER_BIOS_FRB2;
+ //Byte 2
+ FrbTimer.TimerActions.Uint8 = 0; //NormalBoot, NoTimeOutInterrupt. i.e no action when BMC watchdog timeout
+ //Byte 3
+ FrbTimer.PretimeoutInterval = 0;
+ //Byte 4
+ FrbTimer.TimerUseExpirationFlagsClear |= BIT1; //set Frb2ExpirationFlag
+
+ //Data Byte 5/6
+ FrbTimer.InitialCountdownValue = PcdGet16(PcdFRBTimeoutValue) * 10;
+
+ //Set BMC watchdog timer
+ Status = IpmiSetWatchdogTimer (&FrbTimer, &CompletionCode);
+ Status = IpmiResetWatchdogTimer (&CompletionCode);
+ }
+}
+
+EFI_STATUS
+EFIAPI
+InitializeFrbPei (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+ FfsHeader
+ PeiServices
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+{
+ BOOLEAN Frb2Enabled;
+
+ //
+ // If we are booting with defaults, then make sure FRB2 is enabled.
+ //
+ Frb2Enabled = PcdGetBool (PcdFRB2EnabledFlag);
+
+ SetWatchDogTimer (Frb2Enabled);
+
+ return EFI_SUCCESS;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.c
new file mode 100644
index 0000000000..58e1fb4d7e
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.c
@@ -0,0 +1,67 @@
+/** @file
+ IPMI FRU Driver.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/BaseLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/IpmiCommandLib.h>
+#include <IndustryStandard/Ipmi.h>
+
+EFI_STATUS
+EFIAPI
+InitializeFru (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+ Initialize SM Redirection Fru Layer
+
+Arguments:
+
+ ImageHandle - ImageHandle of the loaded driver
+ SystemTable - Pointer to the System Table
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_GET_DEVICE_ID_RESPONSE ControllerInfo;
+ IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST GetFruInventoryAreaInfoRequest;
+ IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE GetFruInventoryAreaInfoResponse;
+
+ //
+ // Get all the SDR Records from BMC and retrieve the Record ID from the structure for future use.
+ //
+ Status = IpmiGetDeviceId (&ControllerInfo);
+ if (EFI_ERROR (Status)) {
+ DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetDeviceId Status=%x\n", Status));
+ return Status;
+ }
+
+ DEBUG((DEBUG_ERROR, "!!! IpmiFru FruInventorySupport %x\n", ControllerInfo.DeviceSupport.Bits.FruInventorySupport));
+
+ if (ControllerInfo.DeviceSupport.Bits.FruInventorySupport) {
+ GetFruInventoryAreaInfoRequest.DeviceId = 0;
+ Status = IpmiGetFruInventoryAreaInfo (&GetFruInventoryAreaInfoRequest, &GetFruInventoryAreaInfoResponse);
+ if (EFI_ERROR (Status)) {
+ DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetFruInventoryAreaInfo Status=%x\n", Status));
+ return Status;
+ }
+ DEBUG((DEBUG_ERROR, "!!! IpmiFru InventoryAreaSize=%x\n", GetFruInventoryAreaInfoResponse.InventoryAreaSize));
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.c
new file mode 100644
index 0000000000..77576fda47
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.c
@@ -0,0 +1,150 @@
+/** @file
+ IPMI stack initialization.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiDxe.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/TimerLib.h>
+#include <Library/IpmiCommandLib.h>
+
+#define BMC_TIMEOUT 30 // [s] How long shall BIOS wait for BMC
+#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout
+
+EFI_STATUS
+GetSelfTest (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Execute the Get Self Test results command to determine whether or not the BMC self tests
+ have passed
+
+Arguments:
+
+ mIpmiInstance - Data structure describing BMC variables and used for sending commands
+ StatusCodeValue - An array used to accumulate error codes for later reporting.
+ ErrorCount - Counter used to keep track of error codes in StatusCodeValue
+
+Returns:
+
+ EFI_SUCCESS - BMC Self test results are retrieved and saved into BmcStatus
+ EFI_DEVICE_ERROR - BMC failed to return self test results.
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_SELF_TEST_RESULT_RESPONSE TestResult;
+
+ //
+ // Get the SELF TEST Results.
+ //
+ Status = IpmiGetSelfTestResult (&TestResult);
+ if (EFI_ERROR(Status)) {
+ DEBUG((DEBUG_ERROR, "\n[IPMI] BMC does not respond (status: %r)!\n\n", Status));
+ return Status;
+ }
+
+ DEBUG((DEBUG_INFO, "[IPMI] BMC self-test result: %02X-%02X\n", TestResult.Result, TestResult.Param));
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GetDeviceId (
+ OUT BOOLEAN *UpdateMode
+ )
+/*++
+
+Routine Description:
+ Execute the Get Device ID command to determine whether or not the BMC is in Force Update
+ Mode. If it is, then report it to the error manager.
+
+Arguments:
+
+Returns:
+ Status
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_GET_DEVICE_ID_RESPONSE BmcInfo;
+ UINT32 Retries;
+
+ //
+ // Set up a loop to retry for up to 30 seconds. Calculate retries not timeout
+ // so that in case KCS is not enabled and EfiIpmiSendCommand() returns
+ // immediately we will not wait all the 30 seconds.
+ //
+ Retries = BMC_TIMEOUT / BMC_KCS_TIMEOUT + 1;
+ //
+ // Get the device ID information for the BMC.
+ //
+ do {
+ Status = IpmiGetDeviceId (&BmcInfo);
+ if (!EFI_ERROR(Status)) {
+ break;
+ }
+ DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d retries left\n", Status, Retries));
+ MicroSecondDelay(50 * 1000);
+ if (Retries-- == 0) {
+ return Status;
+ }
+ } while (TRUE);
+
+ DEBUG((
+ DEBUG_INFO,
+ "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n",
+ BmcInfo.DeviceId,
+ BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev,
+ BmcInfo.MinorFirmwareRev
+ ));
+ *UpdateMode = (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode;
+ return Status;
+}
+
+/**
+ The entry point of the Ipmi DXE.
+
+@param[in] ImageHandle - Handle of this driver image
+@param[in] SystemTable - Table containing standard EFI services
+
+@retval EFI_SUCCESS - Always success is returned even if KCS does not function
+
+ **/
+EFI_STATUS
+EFIAPI
+IpmiInterfaceInit (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ BOOLEAN UpdateMode;
+ EFI_STATUS Status;
+
+ DEBUG((DEBUG_ERROR,"IPMI Dxe:Get BMC Device Id\n"));
+
+ //
+ // Get the Device ID and check if the system is in Force Update mode.
+ //
+ Status = GetDeviceId (&UpdateMode);
+ //
+ // Do not continue initialization if the BMC is in Force Update Mode.
+ //
+ if (!EFI_ERROR(Status) && !UpdateMode) {
+ //
+ // Get the SELF TEST Results.
+ //
+ GetSelfTest ();
+ }
+
+ return EFI_SUCCESS;
+}
+
+
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.c
new file mode 100644
index 0000000000..062d20c44e
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.c
@@ -0,0 +1,96 @@
+/** @file
+ IPMI stack initialization in PEI.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/TimerLib.h>
+#include <Library/IpmiCommandLib.h>
+
+#define BMC_TIMEOUT_PEI 50 // [s] How long shall BIOS wait for BMC
+#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout
+
+EFI_STATUS
+GetDeviceId (
+ OUT BOOLEAN *UpdateMode
+ )
+/*++
+
+Routine Description:
+ Execute the Get Device ID command to determine whether or not the BMC is in Force Update
+ Mode. If it is, then report it to the error manager.
+
+Arguments:
+
+Returns:
+ Status
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_GET_DEVICE_ID_RESPONSE BmcInfo;
+ UINT32 Retries;
+
+ //
+ // Set up a loop to retry for up to 30 seconds. Calculate retries not timeout
+ // so that in case KCS is not enabled and EfiIpmiSendCommand() returns
+ // immediately we will not wait all the 30 seconds.
+ //
+ Retries = BMC_TIMEOUT_PEI/ BMC_KCS_TIMEOUT + 1;
+ //
+ // Get the device ID information for the BMC.
+ //
+ do {
+ Status = IpmiGetDeviceId (&BmcInfo);
+ if (!EFI_ERROR(Status)) {
+ break;
+ }
+ DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d retries left\n", Status, Retries));
+ if (Retries-- == 0) {
+ return Status;
+ }
+ } while (TRUE);
+
+ DEBUG((
+ DEBUG_INFO,
+ "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n",
+ BmcInfo.DeviceId,
+ BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev,
+ BmcInfo.MinorFirmwareRev
+ ));
+ *UpdateMode = (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode;
+ return Status;
+}
+
+/**
+ The entry point of the Ipmi PEIM.
+
+ @param FileHandle Handle of the file being invoked.
+ @param PeiServices Describes the list of possible PEI Services.
+
+ @retval EFI_SUCCESS Indicates that Ipmi initialization completed successfully.
+ @retval Others Indicates that Ipmi initialization could not complete successfully.
+**/
+EFI_STATUS
+EFIAPI
+PeimIpmiInterfaceInit (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+{
+ BOOLEAN UpdateMode;
+ EFI_STATUS Status;
+
+ DEBUG ((DEBUG_INFO, "IPMI Peim:Get BMC Device Id\n"));
+
+ //
+ // Get the Device ID and check if the system is in Force Update mode.
+ //
+ Status = GetDeviceId (&UpdateMode);
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.c
new file mode 100644
index 0000000000..6d6cb21d08
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.c
@@ -0,0 +1,112 @@
+/** @file
+ IPMI Os watchdog timer Driver.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/IpmiCommandLib.h>
+#include <IndustryStandard/Ipmi.h>
+
+BOOLEAN mOsWdtFlag = FALSE;
+
+EFI_EVENT mExitBootServicesEvent;
+
+VOID
+EFIAPI
+EnableEfiOsBootWdtHandler (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/*++
+
+Routine Description:
+ Enable the OS Boot Watchdog Timer.
+ Is called only on legacy or EFI OS boot.
+
+Arguments:
+ Event - Event type
+ *Context - Context for the event
+
+Returns:
+ None
+
+--*/
+{
+ EFI_STATUS Status;
+ IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer;
+ UINT8 CompletionCode;
+ IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer;
+ static BOOLEAN OsWdtEventHandled = FALSE;
+
+ DEBUG((DEBUG_ERROR, "!!! EnableEfiOsBootWdtHandler()!!!\n"));
+
+ //
+ // Make sure it processes once only. And proceess it only if OsWdtFlag==TRUE;
+ //
+ if (OsWdtEventHandled || !mOsWdtFlag) {
+ return ;
+ }
+
+ OsWdtEventHandled = TRUE;
+
+ Status = IpmiGetWatchdogTimer (&GetWatchdogTimer);
+ if (EFI_ERROR (Status)) {
+ return ;
+ }
+
+ ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer));
+ //
+ // Just flip the Timer Use bit. This should release the timer.
+ //
+ SetWatchdogTimer.TimerUse.Bits.TimerRunning = 1;
+ SetWatchdogTimer.TimerUse.Bits.TimerUse = IPMI_WATCHDOG_TIMER_OS_LOADER;
+ SetWatchdogTimer.TimerActions.Uint8 = IPMI_WATCHDOG_TIMER_ACTION_HARD_RESET;
+ SetWatchdogTimer.TimerUseExpirationFlagsClear &= ~BIT4;
+ SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT2;
+ SetWatchdogTimer.InitialCountdownValue = 600; // 100ms / count
+
+ Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode);
+ return ;
+}
+
+EFI_STATUS
+EFIAPI
+DriverInit (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+ This is the standard EFI driver point. This function intitializes
+ the private data required for creating ASRR Driver.
+
+Arguments:
+ As required for DXE driver enrty routine.
+ ImageHandle - ImageHandle of the loaded driver
+ SystemTable - Pointer to the System Table
+
+Returns:
+ @retval EFI_SUCCESS Protocol successfully started and installed.
+ @retval EFI_OUT_OF_RESOURCES The event could not be allocated.
+
+--*/
+{
+ EFI_STATUS Status;
+
+ Status = gBS->CreateEvent (
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_NOTIFY,
+ EnableEfiOsBootWdtHandler,
+ NULL,
+ &mExitBootServicesEvent
+ );
+
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.c
new file mode 100644
index 0000000000..0e3c538d8c
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.c
@@ -0,0 +1,164 @@
+/** @file
+ IPMI Serial Over Lan Driver.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/IpmiCommandLib.h>
+#include <IndustryStandard/Ipmi.h>
+
+#define SOL_CMD_RETRY_COUNT 10
+
+/*++
+
+Routine Description:
+
+ This routine gets the SOL payload status or settings for a specific channel.
+
+Arguments:
+ Channel - LAN channel naumber.
+ ParamSel - Configuration parameter selection.
+ Data - Information returned from BMC.
+Returns:
+ EFI_SUCCESS - SOL configuration parameters are successfully read from BMC.
+ Others - SOL configuration parameters could not be read from BMC.
+
+--*/
+EFI_STATUS
+GetSOLStatus (
+ IN UINT8 Channel,
+ IN UINT8 ParamSel,
+ IN OUT UINT8 *Data
+ )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST GetConfigurationParametersRequest;
+ IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE GetConfigurationParametersResponse;
+ UINT32 DataSize;
+ UINT8 RetryCount;
+
+ for (RetryCount = 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) {
+ ZeroMem (&GetConfigurationParametersRequest, sizeof(GetConfigurationParametersRequest));
+ GetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber = Channel;
+ GetConfigurationParametersRequest.ParameterSelector = ParamSel;
+
+ ZeroMem (&GetConfigurationParametersResponse, sizeof(GetConfigurationParametersResponse));
+
+ DataSize = sizeof(GetConfigurationParametersResponse);
+ Status = IpmiGetSolConfigurationParameters (
+ &GetConfigurationParametersRequest,
+ &GetConfigurationParametersResponse,
+ &DataSize
+ );
+
+ if (Status == EFI_SUCCESS){
+ break;
+ } else {
+ gBS->Stall(100000);
+ }
+ }
+
+ if (Status == EFI_SUCCESS) {
+ *Data = GetConfigurationParametersResponse.ParameterData[0];
+ }
+
+ return Status;
+}
+
+/*++
+
+Routine Description:
+
+ This routine sets the SOL payload configuration parameters for a specific channel.
+
+Arguments:
+ Channel - LAN channel naumber.
+ ParamSel - Configuration parameter selection.
+ Data - Configuration parameter values.
+Returns:
+ EFI_SUCCESS - SOL configuration parameters are sent to BMC.
+ Others - SOL configuration parameters could not be sent to BMC.
+
+--*/
+EFI_STATUS
+SetSOLParams (
+ IN UINT8 Channel,
+ IN UINT8 ParamSel,
+ IN UINT8 Data
+ )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST SetConfigurationParametersRequest;
+ UINT8 CompletionCode;
+ UINT8 RetryCount;
+
+ for (RetryCount = 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) {
+ ZeroMem (&SetConfigurationParametersRequest, sizeof(SetConfigurationParametersRequest));
+ SetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber = Channel;
+ SetConfigurationParametersRequest.ParameterSelector = ParamSel;
+ SetConfigurationParametersRequest.ParameterData[0] = Data;
+
+ CompletionCode = 0;
+
+ Status = IpmiSetSolConfigurationParameters (
+ &SetConfigurationParametersRequest,
+ sizeof(SetConfigurationParametersRequest),
+ &CompletionCode
+ );
+
+ if (Status == EFI_SUCCESS) {
+ break;
+ } else {
+ gBS->Stall(100000);
+ }
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+SolStatusEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+ Routine Description:
+ This is the standard EFI driver point. This function initializes
+ the private data required for creating SOL Status Driver.
+
+ Arguments:
+ ImageHandle - Handle for the image of this driver
+ SystemTable - Pointer to the EFI System Table
+
+ Returns:
+ EFI_SUCCESS - Protocol successfully installed
+ EFI_UNSUPPORTED - Protocol can't be installed.
+
+--*/
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINT8 Channel;
+ BOOLEAN SolEnabled = FALSE;
+
+ for (Channel = 1; Channel <= PcdGet8 (PcdMaxSOLChannels); Channel++) {
+ Status = GetSOLStatus (Channel, IPMI_SOL_CONFIGURATION_PARAMETER_SOL_ENABLE, &SolEnabled);
+ if (Status == EFI_SUCCESS) {
+ DEBUG ((DEBUG_ERROR, "SOL enabling status for channel %x is %x\n", Channel, SolEnabled));
+ } else {
+ DEBUG ((DEBUG_ERROR, "Failed to get channel %x SOL status from BMC!, status is %x\n", Channel, Status));
+ }
+ }
+
+ return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/BmcSsdt.asl b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/BmcSsdt.asl
new file mode 100644
index 0000000000..79993f199b
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/BmcSsdt.asl
@@ -0,0 +1,28 @@
+/** @file
+ BMC ACPI SSDT.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+DefinitionBlock (
+ "BmcSsdt.aml",
+ "SSDT",
+ 0x02, // SSDT revision.
+ // A Revision field value greater than or equal to 2 signifies that integers
+ // declared within the Definition Block are to be evaluated as 64-bit values
+ "INTEL", // OEM ID (6 byte string)
+ "BMCACPI", // OEM table ID (8 byte string)
+ 0x0 // OEM version of DSDT table (4 byte Integer)
+ )
+{
+
+ External(\_SB.PC00.LPC0, DeviceObj)
+
+ Scope (\_SB.PC00.LPC0)
+ {
+ #include "IpmiOprRegions.asi"
+ }
+
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/IpmiOprRegions.asi b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/IpmiOprRegions.asi
new file mode 100644
index 0000000000..876e00b1ac
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/IpmiOprRegions.asi
@@ -0,0 +1,58 @@
+/** @file
+ IPMI ACPI SSDT.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+Device(IPMC)
+{
+ // Config DWord, modified during POST
+ // Bit definitions are the same as PPMFlags:
+ // [00] = Plug and Play BMC Detection enabled in setup
+ // [31:01] = Reserved = 0
+
+ Name(ECFL, 0x80000000)
+
+ // Return the interface specification revision
+ Method(_SRV)
+ {
+ // IPMI Specification Revision v2.0
+ Return(0x0200)
+ }
+
+ Method(_STA, 0)
+ {
+ //
+ // Assume OK
+ //
+ Store (0xF, Local0)
+
+ Return(Local0)
+
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if the device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bit 5 - Reserved (must be cleared).
+ } // end of _STA
+
+ // Return the x86 resources consumed by BMC
+ Name(_CRS, ResourceTemplate()
+ {
+ // Uses 8-bit ports 0xCA2-0xCA5
+ IO(Decode16, 0xCA2, 0xCA2, 0, 2)
+ })
+
+ Name(_HID, "IPI0001") // IPMI device
+ Name(_IFT, 0x1) // KCS system interface type
+ Name(_STR, Unicode("IPMI_KCS"))
+
+ Name(_UID, 0) // First interface.
+
+
+} // end of Device(IPMC)
+
+
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 19/49] AdvancedFeaturePkg: Remove the SMBIOS feature
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 19/49] AdvancedFeaturePkg: Remove the SMBIOS feature Kubacki, Michael A
@ 2019-11-15 23:49 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:49 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 19/49] AdvancedFeaturePkg: Remove the SMBIOS feature
Removes the SMBIOS feature from AdvancedFeaturePkg. The feature does not follow the advanced feature design. A future change will add the feature back following the advanced feature design.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 112 -----------------
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 21 ----
Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc | 4 -
Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf | 6 -
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf | 83 -------------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h | 45 -------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntryPoint.c | 125 -------------------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendorFunction.c | 81 ------------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManufacturerFunction.c | 114 -----------------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c | 131 --------------------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInformationFunction.c | 56 ---------
Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c | 125 -------------------
12 files changed, 903 deletions(-)
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
index 4f8300d145..6cd333d498 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
@@ -26,117 +26,5 @@ Include
[Guids]
gAdvancedFeaturePkgTokenSpaceGuid = {0xa8514688, 0x6693, 0x4ab5, {0xaa, 0xc8, 0xcc, 0xa9, 0x8d, 0xde, 0x90, 0xe1}}
-[PcdsDynamic, PcdsDynamicEx]
-
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation|{0x0}|SMBIOS_TABLE_TYPE0|0x80010000 {
- <HeaderFiles>
- IndustryStandard/SmBios.h
- <Packages>
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
- }
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.Vendor|0x1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosVersion|0x2
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSegment|0xF000
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosReleaseDate|0x3
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSize|0xFF
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PciIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PlugAndPlayIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BiosIsUpgradable|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BiosShadowingAllowed|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BootFromCdIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.SelectableBootIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.EDDSpecificationIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy525_12IsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy35_720IsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy35_288IsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PrintScreenIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Keyboard8042IsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.SerialIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PrinterIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.CgaMonoIsSupported|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[0]|0x33
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[1]|0x0F
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor|"Intel Corporation"|VOID*|0x80010001
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"PURLEY CV/CRB BIOS Internal"|VOID*|0x80010002
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|"2008-12-23"|VOID*|0x80010003
-
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation|{0x0}|SMBIOS_TABLE_TYPE1|0x80010100 {
- <HeaderFiles>
- IndustryStandard/SmBios.h
- <Packages>
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
- }
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Manufacturer|0x1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.ProductName|0x2
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Version|0x3
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SerialNumber|0x4
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Uuid|{GUID("88888888-8887-8888-8888-878888888888")}
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.WakeUpType|SystemWakeupTypePowerSwitch
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SKUNumber|0x5
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Family|0x6
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer|"Intel Corporation"|VOID*|0x80010101
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"PURLEY"|VOID*|0x80010102
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion|"1.0"|VOID*|0x80010103
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber|"UNKNOWN"|VOID*|0x80010104
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber|"SKU Number"|VOID*|0x80010105
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily|"Family"|VOID*|0x80010106
-
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation|{0x0}|SMBIOS_TABLE_TYPE2|0x80010200 {
- <HeaderFiles>
- IndustryStandard/SmBios.h
- <Packages>
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
- }
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Manufacturer|0x1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.ProductName|0x2
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Version|0x3
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.SerialNumber|0x4
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.AssetTag|0x5
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.FeatureFlag.Motherboard|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.FeatureFlag.Replaceable|1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.LocationInChassis|0x6
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.BoardType|BaseBoardTypeMotherBoard
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer|"Intel Corporation"|VOID*|0x80010201
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"PURLEY"|VOID*|0x80010202
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion|"E63448-400"|VOID*|0x80010203
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber|"SPRO03200016"|VOID*|0x80010204
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag|"Base Board Asset Tag"|VOID*|0x80010205
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis|"Part Component"|VOID*|0x80010206
-
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis|{0x0}|SMBIOS_TABLE_TYPE3|0x80010300 {
- <HeaderFiles>
- IndustryStandard/SmBios.h
- <Packages>
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
- }
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Manufacturer|0x1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Type|MiscChassisTypeRackMountChassis
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Version|0x2
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.SerialNumber|0x3
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.AssetTag|0x4
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.BootupState|ChassisStateSafe
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.PowerSupplyState|ChassisStateSafe
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.ThermalState|ChassisStateSafe
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.SecurityStatus|ChassisSecurityStatusNone
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer|"Intel Corporation"|VOID*|0x80010301
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion|"0.1"|VOID*|0x80010302
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber|"UNKNOWN"|VOID*|0x80010303
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag|"Chassis Asset Tag"|VOID*|0x80010304
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber|"SKU Number"|VOID*|0x80010305
-
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation|{0x0}|SMBIOS_TABLE_TYPE32|0x80012000 {
- <HeaderFiles>
- IndustryStandard/SmBios.h
- <Packages>
- MdePkg/MdePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
- }
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation.BootStatus|BootInformationStatusNoError
-
[PcdsFeatureFlag]
gAdvancedFeaturePkgTokenSpaceGuid.PcdNetworkEnable |FALSE|BOOLEAN|0xF00000A1
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable |FALSE|BOOLEAN|0xF00000A2
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index ca8db13f7c..4b8ccf3375 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -45,26 +45,6 @@
################################################################################
[LibraryClasses.common]
- #######################################
- # Edk2 Packages
- #######################################
- BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
- BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
-
-[LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE,LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRIVER,LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION]
- #######################################
- # Edk2 Packages
- #######################################
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
- PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
###################################################################################################
#
@@ -94,7 +74,6 @@
# in the package build.
# Add components here that should be included in the package build.
- AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
[BuildOptions]
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc b/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
index fceaadc100..b74c0ef2bc 100644
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclu
+++ de.dsc
@@ -13,7 +13,3 @@
#
!include NetworkPkg/NetworkComponents.dsc.inc
-!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable == TRUE
- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
-!endif
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
index d980e673a8..a86ecdc9d1 100644
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
+++ b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateIncl
+++ ude.fdf
@@ -12,9 +12,3 @@
# UEFI network modules
#
!include NetworkPkg/Network.fdf.inc
-
-!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable == TRUE -INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
-!endif
-
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
deleted file mode 100644
index c3ec4f7885..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
+++ /dev/null
@@ -1,83 +0,0 @@
-### @file
-# Component description file for Smbios Misc module.
-#
-# Copyright (c) 2018-2019, Intel Corporation. All rights reserved.<BR> -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = SmbiosBasic
- FILE_GUID = 03ADF4A1-A27A-45E3-B211-3177C6C2E7ED
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = SmbiosBasicEntryPoint
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- SmbiosBasicEntryPoint.c
- SmbiosBasic.h
- Type0BiosVendorFunction.c
- Type1SystemManufacturerFunction.c
- Type2BaseBoardManufacturerFunction.c
- Type3ChassisManufacturerFunction.c
- Type32BootInformationFunction.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- AdvancedFeaturePkg/AdvancedFeaturePkg.dec
-
-[LibraryClasses]
- PcdLib
- MemoryAllocationLib
- DevicePathLib
- BaseMemoryLib
- BaseLib
- DebugLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- UefiLib
- HobLib
-
-[Protocols]
- gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiVariableArchProtocolGuid
-
-[Pcd]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber
- gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation
-
-[Depex]
- gEfiSmbiosProtocolGuid AND
- gEfiVariableArchProtocolGuid
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h
deleted file mode 100644
index 944946b5b8..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file
- Smbios basic header file.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _SMBIOS_BASIC_DRIVER_H
-#define _SMBIOS_BASIC_DRIVER_H
-
-#include <PiDxe.h>
-#include <Protocol/Smbios.h>
-#include <IndustryStandard/SmBios.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/MemoryAllocationLib.h> -#include <Library/PcdLib.h> -#include <Library/UefiLib.h>
-
-/**
- Add an SMBIOS record.
-
- @param Smbios The EFI_SMBIOS_PROTOCOL instance.
- @param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
- @param Record The data for the fixed portion of the SMBIOS record. The format of the record is
- determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
- by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
- a set of null terminated strings and a null.
-
- @retval EFI_SUCCESS Record was added.
- @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
-
-**/
-EFI_STATUS
-AddSmbiosRecord (
- IN EFI_SMBIOS_PROTOCOL *Smbios,
- OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
- IN EFI_SMBIOS_TABLE_HEADER *Record
- );
-
-#endif
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntryPoint.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntryPoint.c
deleted file mode 100644
index 8e68629ef6..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntryPoint.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/** @file
- Smbios basic entry point.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "SmbiosBasic.h"
-
-EFI_STATUS
-EFIAPI
-BiosVendorFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- );
-
-EFI_STATUS
-EFIAPI
-SystemManufacturerFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- );
-
-EFI_STATUS
-EFIAPI
-BaseBoardManufacturerFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- );
-
-EFI_STATUS
-EFIAPI
-ChassisManufacturerFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- );
-
-EFI_STATUS
-EFIAPI
-BootInfoStatusFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- );
-
-typedef
-EFI_STATUS
-(EFIAPI EFI_BASIC_SMBIOS_DATA_FUNCTION) (
- IN EFI_SMBIOS_PROTOCOL *Smbios
- );
-
-typedef struct {
- EFI_BASIC_SMBIOS_DATA_FUNCTION *Function; -} EFI_BASIC_SMBIOS_DATA;
-
-EFI_BASIC_SMBIOS_DATA mSmbiosBasicDataFuncTable[] = {
- {&BiosVendorFunction},
- {&SystemManufacturerFunction},
- {&BaseBoardManufacturerFunction},
- {&ChassisManufacturerFunction},
- {&BootInfoStatusFunction},
-};
-
-/**
- Standard EFI driver point. This driver parses the mSmbiosMiscDataTable
- structure and reports any generated data using SMBIOS protocol.
-
- @param ImageHandle Handle for the image of this driver
- @param SystemTable Pointer to the EFI System Table
-
- @retval EFI_SUCCESS The data was successfully stored.
-
-**/
-EFI_STATUS
-EFIAPI
-SmbiosBasicEntryPoint(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- UINTN Index;
- EFI_STATUS EfiStatus;
- EFI_SMBIOS_PROTOCOL *Smbios;
-
- EfiStatus = gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios);
- if (EFI_ERROR(EfiStatus)) {
- DEBUG((EFI_D_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStatus));
- return EfiStatus;
- }
-
- for (Index = 0; Index < sizeof(mSmbiosBasicDataFuncTable)/sizeof(mSmbiosBasicDataFuncTable[0]); ++Index) {
- EfiStatus = (*mSmbiosBasicDataFuncTable[Index].Function) (Smbios);
- if (EFI_ERROR(EfiStatus)) {
- DEBUG((EFI_D_ERROR, "Basic smbios store error. Index=%d, ReturnStatus=%r\n", Index, EfiStatus));
- return EfiStatus;
- }
- }
-
- return EfiStatus;
-}
-
-/**
- Add an SMBIOS record.
-
- @param Smbios The EFI_SMBIOS_PROTOCOL instance.
- @param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
- @param Record The data for the fixed portion of the SMBIOS record. The format of the record is
- determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
- by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
- a set of null terminated strings and a null.
-
- @retval EFI_SUCCESS Record was added.
- @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
-
-**/
-EFI_STATUS
-AddSmbiosRecord (
- IN EFI_SMBIOS_PROTOCOL *Smbios,
- OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
- IN EFI_SMBIOS_TABLE_HEADER *Record
- )
-{
- *SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
- return Smbios->Add (
- Smbios,
- NULL,
- SmbiosHandle,
- Record
- );
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendorFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendorFunction.c
deleted file mode 100644
index 331efc8614..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendorFunction.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/** @file
- Smbios type 0.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "SmbiosBasic.h"
-
-/**
- This function makes boot time changes to the contents of the
- BiosVendor (Type 0).
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-EFI_STATUS
-EFIAPI
-BiosVendorFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- )
-{
- EFI_STATUS Status;
- CHAR8 *VendorStr;
- UINTN VendorStrLen;
- CHAR8 *VersionStr;
- UINTN VerStrLen;
- CHAR8 *DateStr;
- UINTN DateStrLen;
- SMBIOS_TABLE_TYPE0 *SmbiosRecord;
- SMBIOS_TABLE_TYPE0 *PcdSmbiosRecord;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- UINTN StringOffset;
-
- PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType0BiosInformation);
-
- VendorStr = PcdGetPtr (PcdSmbiosType0StringVendor);
- VendorStrLen = AsciiStrLen (VendorStr);
- ASSERT (VendorStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- VersionStr = PcdGetPtr (PcdSmbiosType0StringBiosVersion);
- VerStrLen = AsciiStrLen (VersionStr);
- ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- DateStr = PcdGetPtr (PcdSmbiosType0StringBiosReleaseDate);
- DateStrLen = AsciiStrLen (DateStr);
- ASSERT (DateStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1);
- if (SmbiosRecord == NULL) {
- ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
- return EFI_OUT_OF_RESOURCES;
- }
-
- CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE0));
-
- SmbiosRecord->Hdr.Type = SMBIOS_TYPE_BIOS_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE0);
- SmbiosRecord->Hdr.Handle = 0;
-
- StringOffset = SmbiosRecord->Hdr.Length;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VendorStr, VendorStrLen);
- StringOffset += VendorStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
- StringOffset += VerStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, DateStr, DateStrLen);
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool (SmbiosRecord);
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManufacturerFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManufacturerFunction.c
deleted file mode 100644
index 2314d09695..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManufacturerFunction.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/** @file
- Smbios type 1.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "SmbiosBasic.h"
-
-/**
- This function makes boot time changes to the contents of the
- SystemManufacturer (Type 1).
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-EFI_STATUS
-EFIAPI
-SystemManufacturerFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- )
-{
- EFI_STATUS Status;
- CHAR8 *ManufacturerStr;
- CHAR8 *ProductNameStr;
- CHAR8 *VersionStr;
- CHAR8 *SerialNumberStr;
- CHAR8 *SKUNumberStr;
- CHAR8 *FamilyStr;
- UINTN ManufacturerStrLen;
- UINTN ProductNameStrLen;
- UINTN VersionStrLen;
- UINTN SerialNumberStrLen;
- UINTN SKUNumberStrLen;
- UINTN FamilyStrLen;
- UINTN TableSize;
- SMBIOS_TABLE_TYPE1 *PcdSmbiosRecord;
- SMBIOS_TABLE_TYPE1 *SmbiosRecord;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- UINTN StringOffset;
-
- PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType1SystemInformation);
-
- ManufacturerStr = PcdGetPtr (PcdSmbiosType1StringManufacturer);
- ManufacturerStrLen = AsciiStrLen (ManufacturerStr);
- ASSERT (ManufacturerStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- ProductNameStr = PcdGetPtr (PcdSmbiosType1StringProductName);
- ProductNameStrLen = AsciiStrLen (ProductNameStr);
- ASSERT (ProductNameStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- VersionStr = PcdGetPtr (PcdSmbiosType1StringVersion);
- VersionStrLen = AsciiStrLen (VersionStr);
- ASSERT (VersionStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- SerialNumberStr = PcdGetPtr (PcdSmbiosType1StringSerialNumber);
- SerialNumberStrLen = AsciiStrLen (SerialNumberStr);
- ASSERT (SerialNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- SKUNumberStr = PcdGetPtr (PcdSmbiosType1StringSKUNumber);
- SKUNumberStrLen = AsciiStrLen (SKUNumberStr);
- ASSERT (SKUNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- FamilyStr = PcdGetPtr (PcdSmbiosType1StringFamily);
- FamilyStrLen = AsciiStrLen (FamilyStr);
- ASSERT (FamilyStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Create table size based on string lengths
- //
- TableSize = sizeof (SMBIOS_TABLE_TYPE1) + ManufacturerStrLen + 1 + ProductNameStrLen + 1 + VersionStrLen + 1 + SerialNumberStrLen + 1 + SKUNumberStrLen + 1 + FamilyStrLen + 1 + 1;
- SmbiosRecord = AllocateZeroPool (TableSize);
- if (SmbiosRecord == NULL) {
- ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
- return EFI_OUT_OF_RESOURCES;
- }
-
- CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE1));
-
- //
- // Fill in Type 1 fields
- //
-
- SmbiosRecord->Hdr.Type = SMBIOS_TYPE_SYSTEM_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE1);
- SmbiosRecord->Hdr.Handle = 0;
-
- //
- // Add strings to bottom of data block
- //
- StringOffset = SmbiosRecord->Hdr.Length;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManufacturerStrLen);
- StringOffset += ManufacturerStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductNameStr, ProductNameStrLen);
- StringOffset += ProductNameStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VersionStrLen);
- StringOffset += VersionStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumberStrLen);
- StringOffset += SerialNumberStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberStrLen);
- StringOffset += SKUNumberStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, FamilyStr, FamilyStrLen);
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c
deleted file mode 100644
index 9193cb0be7..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/** @file
- Smbios type 2.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "SmbiosBasic.h"
-
-/**
- This function makes boot time changes to the contents of the
- BaseBoardManufacturer (Type 2).
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-EFI_STATUS
-EFIAPI
-BaseBoardManufacturerFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- )
-{
- EFI_STATUS Status;
- CHAR8 *ManufacturerStr;
- CHAR8 *ProductStr;
- CHAR8 *VersionStr;
- CHAR8 *SerialNumberStr;
- CHAR8 *AssertTagStr;
- CHAR8 *ChassisStr;
- UINTN ManuStrLen;
- UINTN ProductStrLen;
- UINTN VerStrLen;
- UINTN AssertTagStrLen;
- UINTN SerialNumStrLen;
- UINTN ChassisStrLen;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE2 *PcdSmbiosRecord;
- SMBIOS_TABLE_TYPE2 *SmbiosRecord;
- UINTN SourceSize;
- UINTN TotalSize;
- UINTN StringOffset;
-
- PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType2BaseBoardInformation);
-
- //
- // Get BoardManufacturer String.
- //
- ManufacturerStr = PcdGetPtr (PcdSmbiosType2StringManufacturer);
- ManuStrLen = AsciiStrLen (ManufacturerStr);
- ASSERT (ManuStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get Board ProductName String.
- //
- ProductStr = PcdGetPtr (PcdSmbiosType2StringProductName);
- ProductStrLen = AsciiStrLen (ProductStr);
- ASSERT (ProductStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get Board Version String.
- //
- VersionStr = PcdGetPtr (PcdSmbiosType2StringVersion);
- VerStrLen = AsciiStrLen (VersionStr);
- ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get Board Serial Number String.
- //
- SerialNumberStr = PcdGetPtr (PcdSmbiosType2StringSerialNumber);
- SerialNumStrLen = AsciiStrLen (SerialNumberStr);
- ASSERT (SerialNumStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get Board Asset Tag String.
- //
- AssertTagStr = PcdGetPtr (PcdSmbiosType2StringAssetTag);
- AssertTagStrLen = AsciiStrLen (AssertTagStr);
- ASSERT (AssertTagStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get Board Chassis Location Tag String.
- //
- ChassisStr = PcdGetPtr (PcdSmbiosType2StringLocationInChassis);
- ChassisStrLen = AsciiStrLen (ChassisStr);
- ASSERT (ChassisStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Two zeros following the last string.
- //
- SourceSize = PcdGetSize (PcdSmbiosType2BaseBoardInformation);
- TotalSize = SourceSize + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen + 1 + 1;
- SmbiosRecord = AllocateZeroPool(TotalSize);
- if (SmbiosRecord == NULL) {
- ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
- return EFI_OUT_OF_RESOURCES;
- }
-
- CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize);
-
- SmbiosRecord->Hdr.Type = SMBIOS_TYPE_BASEBOARD_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2);
- if (PcdSmbiosRecord->NumberOfContainedObjectHandles >= 2) {
- SmbiosRecord->Hdr.Length += (PcdSmbiosRecord->NumberOfContainedObjectHandles - 1) * sizeof(PcdSmbiosRecord->ContainedObjectHandles);
- }
- ASSERT(SourceSize >= SmbiosRecord->Hdr.Length);
- SmbiosRecord->Hdr.Handle = 0;
-
- StringOffset = SmbiosRecord->Hdr.Length;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrLen);
- StringOffset += ManuStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductStr, ProductStrLen);
- StringOffset += ProductStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
- StringOffset += VerStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumStrLen);
- StringOffset += SerialNumStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagStrLen);
- StringOffset += AssertTagStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ChassisStr, ChassisStrLen);
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInformationFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInformationFunction.c
deleted file mode 100644
index 87bfd045da..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInformationFunction.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
- Smbios type 32.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "SmbiosBasic.h"
-
-
-/**
- This function makes boot time changes to the contents of the
- BootInformation (Type 32).
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-EFI_STATUS
-EFIAPI
-BootInfoStatusFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- )
-{
- EFI_STATUS Status;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE32 *PcdSmbiosRecord;
- SMBIOS_TABLE_TYPE32 *SmbiosRecord;
-
- PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType32SystemBootInformation);
-
- //
- // Two zeros following the last string.
- //
- SmbiosRecord = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
- if (SmbiosRecord == NULL) {
- ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
- return EFI_OUT_OF_RESOURCES;
- }
-
- CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE32));
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION;
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);
- SmbiosRecord->Hdr.Handle = 0;
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c
deleted file mode 100644
index 33732bc9ca..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/** @file
- Smbios type 3.
-
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "SmbiosBasic.h"
-
-/**
- This function makes boot time changes to the contents of the
- ChassisManufacturer (Type 3).
-
- @retval EFI_SUCCESS All parameters were valid.
- @retval EFI_UNSUPPORTED Unexpected RecordType value.
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.
-
-**/
-EFI_STATUS
-EFIAPI
-ChassisManufacturerFunction(
- IN EFI_SMBIOS_PROTOCOL *Smbios
- )
-{
- UINTN ManuStrLen;
- UINTN VerStrLen;
- UINTN AssertTagStrLen;
- UINTN SerialNumStrLen;
- UINTN SKUNumberStrLen;
- EFI_STATUS Status;
- CHAR8 *ManufacturerStr;
- CHAR8 *VersionStr;
- CHAR8 *SerialNumberStr;
- CHAR8 *AssertTagStr;
- CHAR8 *SKUNumberStr;
- SMBIOS_TABLE_STRING *SKUNumberPtr;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- SMBIOS_TABLE_TYPE3 *SmbiosRecord;
- SMBIOS_TABLE_TYPE3 *PcdSmbiosRecord;
- UINTN SourceSize;
- UINTN TotalSize;
- UINTN StringOffset;
-
- PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType3SystemEnclosureChassis);
-
- //
- // Get ChassisManufacturer String.
- //
- ManufacturerStr = PcdGetPtr (PcdSmbiosType3StringManufacturer);
- ManuStrLen = AsciiStrLen (ManufacturerStr);
- ASSERT (ManuStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get ChassisVersion String.
- //
- VersionStr = PcdGetPtr (PcdSmbiosType3StringVersion);
- VerStrLen = AsciiStrLen (VersionStr);
- ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get ChassisSerialNumber String.
- //
- SerialNumberStr = PcdGetPtr (PcdSmbiosType3StringSerialNumber);
- SerialNumStrLen = AsciiStrLen (SerialNumberStr);
- ASSERT (SerialNumStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get ChassisAssetTag String.
- //
- AssertTagStr = PcdGetPtr (PcdSmbiosType3StringAssetTag);
- AssertTagStrLen = AsciiStrLen (AssertTagStr);
- ASSERT (AssertTagStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Get ChassisSKUNumber String.
- //
- SKUNumberStr = PcdGetPtr (PcdSmbiosType3StringSKUNumber);
- SKUNumberStrLen = AsciiStrLen (SKUNumberStr);
- ASSERT (SKUNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
-
- //
- // Two zeros following the last string.
- //
- SourceSize = PcdGetSize(PcdSmbiosType3SystemEnclosureChassis);
- TotalSize = SourceSize + sizeof(SMBIOS_TABLE_STRING) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + SKUNumberStrLen + 1 + 1;
- SmbiosRecord = AllocateZeroPool(TotalSize);
- if (SmbiosRecord == NULL) {
- ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
- return EFI_OUT_OF_RESOURCES;
- }
-
- CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize);
-
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE;
- SmbiosRecord->Hdr.Length = OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements) + sizeof(SMBIOS_TABLE_STRING);
- if (PcdSmbiosRecord->ContainedElementCount >= 1) {
- SmbiosRecord->Hdr.Length += PcdSmbiosRecord->ContainedElementCount * PcdSmbiosRecord->ContainedElementRecordLength;
- }
- SmbiosRecord->Hdr.Handle = 0;
-
- if ((PcdSmbiosRecord->ContainedElementCount == 0) || (SourceSize < (UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length)) {
- SKUNumberPtr = (SMBIOS_TABLE_STRING *)((UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length - sizeof(SMBIOS_TABLE_STRING));
- *SKUNumberPtr = 5;
- }
-
- StringOffset = SmbiosRecord->Hdr.Length;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrLen);
- StringOffset += ManuStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
- StringOffset += VerStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumStrLen);
- StringOffset += SerialNumStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagStrLen);
- StringOffset += AssertTagStrLen + 1;
- CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberStrLen);
-
- //
- // Now we have got the full smbios record, call smbios protocol to add this record.
- //
- Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
-
- FreePool(SmbiosRecord);
- return Status;
-}
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 20/49] Features/Intel/SmbiosFeaturePkg: Add initial package
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 20/49] Features/Intel/SmbiosFeaturePkg: Add initial package Kubacki, Michael A
@ 2019-11-15 23:49 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:49 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
1. Please at least fill in the "Purpose" section of all the new Readme.md files you are creating, don't leave the entire file as TODOs.
2. SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h - Update copyright year
3. SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c - Update copyright year
4. SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c - Update copyright year
5. SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c - Update copyright year
6. SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c - Update copyright year
7. SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c - Update copyright year
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 20/49] Features/Intel/SmbiosFeaturePkg: Add initial package
Adds a new feature package for the SMBIOS feature.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec | 172 ++++++++++++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc | 115 +++++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc | 30 ++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf | 10 ++
Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf | 83 ++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h | 45 +++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicEntryPoint.c | 125 ++++++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c | 81 +++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c | 114 +++++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c | 131 +++++++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c | 56 +++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c | 125 ++++++++++++++
Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md | 86 ++++++++++
14 files changed, 1181 insertions(+)
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
new file mode 100644
index 0000000000..c06a87aad0
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
@@ -0,0 +1,172 @@
+## @file
+# This package provides advanced feature functionality for System Management BIOS (SMBIOS).
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = SmbiosFeaturePkg
+ PACKAGE_GUID = 8CCEE569-02AD-4844-8725-F4C7966E320A
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[LibraryClasses]
+
+[Guids]
+ gSmbiosFeaturePkgTokenSpaceGuid = {0xc1530658, 0xe234, 0x4c13, {0xb6, 0x82, 0xd3, 0x87, 0x84, 0xf1, 0xd7, 0x16}}
+
+[PcdsFeatureFlag]
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable|FALSE|BOOLEAN|0xA0000001
+
+[PcdsDynamic, PcdsDynamicEx]
+ #
+ # SMBIOS Type 0 BIOS Information
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation|{0x0}|SMBIOS_TABLE_TYPE0|0xD0000001 {
+ <HeaderFiles>
+ IndustryStandard/SmBios.h
+ <Packages>
+ MdePkg/MdePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+ }
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.Vendor|0x1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosVersion|0x2
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSegment|0xF000
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosReleaseDate|0x3
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSize|0xFF
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PciIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PlugAndPlayIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BiosIsUpgradable|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BiosShadowingAllowed|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BootFromCdIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.SelectableBootIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.EDDSpecificationIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy525_12IsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy35_720IsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy35_288IsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PrintScreenIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Keyboard8042IsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.SerialIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PrinterIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.CgaMonoIsSupported|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[0]|0x33
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[1]|0x0F
+
+ #
+ # SMBIOS Type 1 System Information
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation|{0x0}|SMBIOS_TABLE_TYPE1|0xD0000002 {
+ <HeaderFiles>
+ IndustryStandard/SmBios.h
+ <Packages>
+ MdePkg/MdePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+ }
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Manufacturer|0x1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.ProductName|0x2
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Version|0x3
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SerialNumber|0x4
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Uuid|{GUID("88888888-8887-8888-8888-878888888888")}
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.WakeUpType|SystemWakeupTypePowerSwitch
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SKUNumber|0x5
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Family|0x6
+
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation|{0x0}|SMBIOS_TABLE_TYPE2|0xD0000003 {
+ <HeaderFiles>
+ IndustryStandard/SmBios.h
+ <Packages>
+ MdePkg/MdePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+ }
+
+ #
+ # SMBIOS Type 2 Base Board Information
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Manufacturer|0x1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.ProductName|0x2
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Version|0x3
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.SerialNumber|0x4
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.AssetTag|0x5
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.FeatureFlag.Motherboard|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.FeatureFlag.Replaceable|1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.LocationInChassis|0x6
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.BoardType|BaseBoardTypeMotherBoard
+
+ #
+ # SMBIOS Type 3 System Enclosure Chassis
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis|{0x0}|SMBIOS_TABLE_TYPE3|0xD0000004 {
+ <HeaderFiles>
+ IndustryStandard/SmBios.h
+ <Packages>
+ MdePkg/MdePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+ }
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Manufacturer|0x1
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Type|MiscChassisTypeRackMountChassis
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Version|0x2
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.SerialNumber|0x3
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.AssetTag|0x4
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.BootupState|ChassisStateSafe
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.PowerSupplyState|ChassisStateSafe
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.ThermalState|ChassisStateSafe
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.SecurityStatus|ChassisSecurityStatusNone
+
+ #
+ # SMBIOS Type 32 System Boot Information
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation|{0x0}|SMBIOS_TABLE_TYPE32|0xD0000005 {
+ <HeaderFiles>
+ IndustryStandard/SmBios.h
+ <Packages>
+ MdePkg/MdePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+ }
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation.BootStatus|BootInformationStatusNoError
+
+ #
+ # SMBIOS Type 0 BIOS Information Strings
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|"2008-12-23"|VOID*|0xD1000001
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"PURLEY CV/CRB BIOS Internal"|VOID*|0xD1000002
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor|"Intel Corporation"|VOID*|0xD1000003
+
+ #
+ # SMBIOS Type 1 System Information Strings
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily|"Family"|VOID*|0xD1000004
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer|"Intel Corporation"|VOID*|0xD1000005
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"PURLEY"|VOID*|0xD1000006
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber|"UNKNOWN"|VOID*|0xD1000007
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber|"SKU Number"|VOID*|0xD1000008
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion|"1.0"|VOID*|0xD1000009
+
+ #
+ # SMBIOS Type 2 Base Board Information Strings
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag|"Base Board Asset Tag"|VOID*|0xD100000A
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis|"Part Component"|VOID*|0xD100000B
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer|"Intel Corporation"|VOID*|0xD100000C
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"PURLEY"|VOID*|0xD100000D
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber|"SPRO03200016"|VOID*|0xD100000E
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion|"E63448-400"|VOID*|0xD100000F
+
+ #
+ # SMBIOS Type 3 System Enclosure Chassis Strings
+ #
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag|"Chassis Asset Tag"|VOID*|0xD1000011
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer|"Intel Corporation"|VOID*|0xD1000012
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber|"UNKNOWN"|VOID*|0xD1000013
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber|"SKU Number"|VOID*|0xD1000014
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion|"0.1"|VOID*|0xD1000015
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc
new file mode 100644
index 0000000000..a59fdf3702
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc
@@ -0,0 +1,115 @@
+## @file
+# This is a build description file for the SMBIOS advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+################################################################################
+[LibraryClasses]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+
+[LibraryClasses.common.DXE_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+
+################################################################################
+#
+# Component section - list of all components that need built for this feature.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+################################################################################
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # SMBIOS Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
+ #####################################
+ # SMBIOS Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+ SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf
+
+###################################################################################################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
+###################################################################################################
+[BuildOptions]
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc
new file mode 100644
index 0000000000..31141c0725
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for System Management BIOS (SMBIOS).
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ PLATFORM_NAME = SmbiosFeaturePkg
+ PLATFORM_GUID = 44AF1C2A-16AD-4509-8DF6-988E73E23A85
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#
+# This package always builds the feature.
+#
+!include Include/SmbiosFeature.dsc
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..3ed23bd937
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,10 @@
+## @file
+# FDF file for post-memory SMBIOS modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+ INF SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..732c1b69e5
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory SMBIOS modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf
new file mode 100644
index 0000000000..bd8736b621
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf
@@ -0,0 +1,83 @@
+### @file
+# Component description file for the SMBIOS basic module.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = SmbiosBasic
+ FILE_GUID = 03ADF4A1-A27A-45E3-B211-3177C6C2E7ED
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = SmbiosBasicEntryPoint
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources]
+ SmbiosBasic.h
+ SmbiosBasicEntryPoint.c
+ Type0BiosVendorFunction.c
+ Type1SystemManufacturerFunction.c
+ Type2BaseBoardManufacturerFunction.c
+ Type32BootInformationFunction.c
+ Type3ChassisManufacturerFunction.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ BaseMemoryLib
+ DebugLib
+ DevicePathLib
+ HobLib
+ MemoryAllocationLib
+ PcdLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiLib
+
+[Protocols]
+ gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiVariableArchProtocolGuid
+
+[Pcd]
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis
+
+[Depex]
+ gEfiSmbiosProtocolGuid AND
+ gEfiVariableArchProtocolGuid
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h
new file mode 100644
index 0000000000..e206d69726
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h
@@ -0,0 +1,45 @@
+/** @file
+ Smbios basic header file.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _SMBIOS_BASIC_DRIVER_H
+#define _SMBIOS_BASIC_DRIVER_H
+
+#include <PiDxe.h>
+#include <Protocol/Smbios.h>
+#include <IndustryStandard/SmBios.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiLib.h>
+
+/**
+ Add an SMBIOS record.
+
+ @param Smbios The EFI_SMBIOS_PROTOCOL instance.
+ @param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
+ @param Record The data for the fixed portion of the SMBIOS record. The format of the record is
+ determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
+ by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
+ a set of null terminated strings and a null.
+
+ @retval EFI_SUCCESS Record was added.
+ @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
+
+**/
+EFI_STATUS
+AddSmbiosRecord (
+ IN EFI_SMBIOS_PROTOCOL *Smbios,
+ OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
+ IN EFI_SMBIOS_TABLE_HEADER *Record
+ );
+
+#endif
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicEntryPoint.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicEntryPoint.c
new file mode 100644
index 0000000000..4b24d1a124
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicEntryPoint.c
@@ -0,0 +1,125 @@
+/** @file
+ Smbios basic entry point.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SmbiosBasic.h"
+
+EFI_STATUS
+EFIAPI
+BiosVendorFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+EFI_STATUS
+EFIAPI
+SystemManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+EFI_STATUS
+EFIAPI
+BaseBoardManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+EFI_STATUS
+EFIAPI
+ChassisManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+EFI_STATUS
+EFIAPI
+BootInfoStatusFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI EFI_BASIC_SMBIOS_DATA_FUNCTION) (
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+typedef struct {
+ EFI_BASIC_SMBIOS_DATA_FUNCTION *Function;
+} EFI_BASIC_SMBIOS_DATA;
+
+EFI_BASIC_SMBIOS_DATA mSmbiosBasicDataFuncTable[] = {
+ {&BiosVendorFunction},
+ {&SystemManufacturerFunction},
+ {&BaseBoardManufacturerFunction},
+ {&ChassisManufacturerFunction},
+ {&BootInfoStatusFunction},
+};
+
+/**
+ Standard EFI driver point. This driver parses the mSmbiosMiscDataTable
+ structure and reports any generated data using SMBIOS protocol.
+
+ @param ImageHandle Handle for the image of this driver
+ @param SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS The data was successfully stored.
+
+**/
+EFI_STATUS
+EFIAPI
+SmbiosBasicEntryPoint(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ UINTN Index;
+ EFI_STATUS EfiStatus;
+ EFI_SMBIOS_PROTOCOL *Smbios;
+
+ EfiStatus = gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios);
+ if (EFI_ERROR(EfiStatus)) {
+ DEBUG((DEBUG_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStatus));
+ return EfiStatus;
+ }
+
+ for (Index = 0; Index < sizeof(mSmbiosBasicDataFuncTable)/sizeof(mSmbiosBasicDataFuncTable[0]); ++Index) {
+ EfiStatus = (*mSmbiosBasicDataFuncTable[Index].Function) (Smbios);
+ if (EFI_ERROR(EfiStatus)) {
+ DEBUG((DEBUG_ERROR, "Basic smbios store error. Index=%d, ReturnStatus=%r\n", Index, EfiStatus));
+ return EfiStatus;
+ }
+ }
+
+ return EfiStatus;
+}
+
+/**
+ Add an SMBIOS record.
+
+ @param Smbios The EFI_SMBIOS_PROTOCOL instance.
+ @param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
+ @param Record The data for the fixed portion of the SMBIOS record. The format of the record is
+ determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
+ by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
+ a set of null terminated strings and a null.
+
+ @retval EFI_SUCCESS Record was added.
+ @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
+
+**/
+EFI_STATUS
+AddSmbiosRecord (
+ IN EFI_SMBIOS_PROTOCOL *Smbios,
+ OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
+ IN EFI_SMBIOS_TABLE_HEADER *Record
+ )
+{
+ *SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
+ return Smbios->Add (
+ Smbios,
+ NULL,
+ SmbiosHandle,
+ Record
+ );
+}
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c
new file mode 100644
index 0000000000..a0db734698
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c
@@ -0,0 +1,81 @@
+/** @file
+ Smbios type 0.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SmbiosBasic.h"
+
+/**
+ This function makes boot time changes to the contents of the
+ BiosVendor (Type 0).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+BiosVendorFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ CHAR8 *VendorStr;
+ UINTN VendorStrLen;
+ CHAR8 *VersionStr;
+ UINTN VerStrLen;
+ CHAR8 *DateStr;
+ UINTN DateStrLen;
+ SMBIOS_TABLE_TYPE0 *SmbiosRecord;
+ SMBIOS_TABLE_TYPE0 *PcdSmbiosRecord;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ UINTN StringOffset;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType0BiosInformation);
+
+ VendorStr = PcdGetPtr (PcdSmbiosType0StringVendor);
+ VendorStrLen = AsciiStrLen (VendorStr);
+ ASSERT (VendorStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ VersionStr = PcdGetPtr (PcdSmbiosType0StringBiosVersion);
+ VerStrLen = AsciiStrLen (VersionStr);
+ ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ DateStr = PcdGetPtr (PcdSmbiosType0StringBiosReleaseDate);
+ DateStrLen = AsciiStrLen (DateStr);
+ ASSERT (DateStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE0));
+
+ SmbiosRecord->Hdr.Type = SMBIOS_TYPE_BIOS_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE0);
+ SmbiosRecord->Hdr.Handle = 0;
+
+ StringOffset = SmbiosRecord->Hdr.Length;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VendorStr, VendorStrLen);
+ StringOffset += VendorStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
+ StringOffset += VerStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, DateStr, DateStrLen);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool (SmbiosRecord);
+ return Status;
+}
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c
new file mode 100644
index 0000000000..3b8e39fe53
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c
@@ -0,0 +1,114 @@
+/** @file
+ Smbios type 1.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SmbiosBasic.h"
+
+/**
+ This function makes boot time changes to the contents of the
+ SystemManufacturer (Type 1).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+SystemManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ CHAR8 *ManufacturerStr;
+ CHAR8 *ProductNameStr;
+ CHAR8 *VersionStr;
+ CHAR8 *SerialNumberStr;
+ CHAR8 *SKUNumberStr;
+ CHAR8 *FamilyStr;
+ UINTN ManufacturerStrLen;
+ UINTN ProductNameStrLen;
+ UINTN VersionStrLen;
+ UINTN SerialNumberStrLen;
+ UINTN SKUNumberStrLen;
+ UINTN FamilyStrLen;
+ UINTN TableSize;
+ SMBIOS_TABLE_TYPE1 *PcdSmbiosRecord;
+ SMBIOS_TABLE_TYPE1 *SmbiosRecord;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ UINTN StringOffset;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType1SystemInformation);
+
+ ManufacturerStr = PcdGetPtr (PcdSmbiosType1StringManufacturer);
+ ManufacturerStrLen = AsciiStrLen (ManufacturerStr);
+ ASSERT (ManufacturerStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ ProductNameStr = PcdGetPtr (PcdSmbiosType1StringProductName);
+ ProductNameStrLen = AsciiStrLen (ProductNameStr);
+ ASSERT (ProductNameStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ VersionStr = PcdGetPtr (PcdSmbiosType1StringVersion);
+ VersionStrLen = AsciiStrLen (VersionStr);
+ ASSERT (VersionStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ SerialNumberStr = PcdGetPtr (PcdSmbiosType1StringSerialNumber);
+ SerialNumberStrLen = AsciiStrLen (SerialNumberStr);
+ ASSERT (SerialNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ SKUNumberStr = PcdGetPtr (PcdSmbiosType1StringSKUNumber);
+ SKUNumberStrLen = AsciiStrLen (SKUNumberStr);
+ ASSERT (SKUNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ FamilyStr = PcdGetPtr (PcdSmbiosType1StringFamily);
+ FamilyStrLen = AsciiStrLen (FamilyStr);
+ ASSERT (FamilyStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Create table size based on string lengths
+ //
+ TableSize = sizeof (SMBIOS_TABLE_TYPE1) + ManufacturerStrLen + 1 + ProductNameStrLen + 1 + VersionStrLen + 1 + SerialNumberStrLen + 1 + SKUNumberStrLen + 1 + FamilyStrLen + 1 + 1;
+ SmbiosRecord = AllocateZeroPool (TableSize);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE1));
+
+ //
+ // Fill in Type 1 fields
+ //
+
+ SmbiosRecord->Hdr.Type = SMBIOS_TYPE_SYSTEM_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE1);
+ SmbiosRecord->Hdr.Handle = 0;
+
+ //
+ // Add strings to bottom of data block
+ //
+ StringOffset = SmbiosRecord->Hdr.Length;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManufacturerStrLen);
+ StringOffset += ManufacturerStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductNameStr, ProductNameStrLen);
+ StringOffset += ProductNameStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VersionStrLen);
+ StringOffset += VersionStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumberStrLen);
+ StringOffset += SerialNumberStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberStrLen);
+ StringOffset += SKUNumberStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, FamilyStr, FamilyStrLen);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c
new file mode 100644
index 0000000000..9193cb0be7
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c
@@ -0,0 +1,131 @@
+/** @file
+ Smbios type 2.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SmbiosBasic.h"
+
+/**
+ This function makes boot time changes to the contents of the
+ BaseBoardManufacturer (Type 2).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+BaseBoardManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ CHAR8 *ManufacturerStr;
+ CHAR8 *ProductStr;
+ CHAR8 *VersionStr;
+ CHAR8 *SerialNumberStr;
+ CHAR8 *AssertTagStr;
+ CHAR8 *ChassisStr;
+ UINTN ManuStrLen;
+ UINTN ProductStrLen;
+ UINTN VerStrLen;
+ UINTN AssertTagStrLen;
+ UINTN SerialNumStrLen;
+ UINTN ChassisStrLen;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE2 *PcdSmbiosRecord;
+ SMBIOS_TABLE_TYPE2 *SmbiosRecord;
+ UINTN SourceSize;
+ UINTN TotalSize;
+ UINTN StringOffset;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType2BaseBoardInformation);
+
+ //
+ // Get BoardManufacturer String.
+ //
+ ManufacturerStr = PcdGetPtr (PcdSmbiosType2StringManufacturer);
+ ManuStrLen = AsciiStrLen (ManufacturerStr);
+ ASSERT (ManuStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board ProductName String.
+ //
+ ProductStr = PcdGetPtr (PcdSmbiosType2StringProductName);
+ ProductStrLen = AsciiStrLen (ProductStr);
+ ASSERT (ProductStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board Version String.
+ //
+ VersionStr = PcdGetPtr (PcdSmbiosType2StringVersion);
+ VerStrLen = AsciiStrLen (VersionStr);
+ ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board Serial Number String.
+ //
+ SerialNumberStr = PcdGetPtr (PcdSmbiosType2StringSerialNumber);
+ SerialNumStrLen = AsciiStrLen (SerialNumberStr);
+ ASSERT (SerialNumStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board Asset Tag String.
+ //
+ AssertTagStr = PcdGetPtr (PcdSmbiosType2StringAssetTag);
+ AssertTagStrLen = AsciiStrLen (AssertTagStr);
+ ASSERT (AssertTagStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board Chassis Location Tag String.
+ //
+ ChassisStr = PcdGetPtr (PcdSmbiosType2StringLocationInChassis);
+ ChassisStrLen = AsciiStrLen (ChassisStr);
+ ASSERT (ChassisStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Two zeros following the last string.
+ //
+ SourceSize = PcdGetSize (PcdSmbiosType2BaseBoardInformation);
+ TotalSize = SourceSize + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen + 1 + 1;
+ SmbiosRecord = AllocateZeroPool(TotalSize);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize);
+
+ SmbiosRecord->Hdr.Type = SMBIOS_TYPE_BASEBOARD_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2);
+ if (PcdSmbiosRecord->NumberOfContainedObjectHandles >= 2) {
+ SmbiosRecord->Hdr.Length += (PcdSmbiosRecord->NumberOfContainedObjectHandles - 1) * sizeof(PcdSmbiosRecord->ContainedObjectHandles);
+ }
+ ASSERT(SourceSize >= SmbiosRecord->Hdr.Length);
+ SmbiosRecord->Hdr.Handle = 0;
+
+ StringOffset = SmbiosRecord->Hdr.Length;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrLen);
+ StringOffset += ManuStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductStr, ProductStrLen);
+ StringOffset += ProductStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
+ StringOffset += VerStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumStrLen);
+ StringOffset += SerialNumStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagStrLen);
+ StringOffset += AssertTagStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ChassisStr, ChassisStrLen);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c
new file mode 100644
index 0000000000..87bfd045da
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c
@@ -0,0 +1,56 @@
+/** @file
+ Smbios type 32.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SmbiosBasic.h"
+
+
+/**
+ This function makes boot time changes to the contents of the
+ BootInformation (Type 32).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+BootInfoStatusFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE32 *PcdSmbiosRecord;
+ SMBIOS_TABLE_TYPE32 *SmbiosRecord;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType32SystemBootInformation);
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE32));
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);
+ SmbiosRecord->Hdr.Handle = 0;
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c
new file mode 100644
index 0000000000..33732bc9ca
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c
@@ -0,0 +1,125 @@
+/** @file
+ Smbios type 3.
+
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SmbiosBasic.h"
+
+/**
+ This function makes boot time changes to the contents of the
+ ChassisManufacturer (Type 3).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+ChassisManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ UINTN ManuStrLen;
+ UINTN VerStrLen;
+ UINTN AssertTagStrLen;
+ UINTN SerialNumStrLen;
+ UINTN SKUNumberStrLen;
+ EFI_STATUS Status;
+ CHAR8 *ManufacturerStr;
+ CHAR8 *VersionStr;
+ CHAR8 *SerialNumberStr;
+ CHAR8 *AssertTagStr;
+ CHAR8 *SKUNumberStr;
+ SMBIOS_TABLE_STRING *SKUNumberPtr;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE3 *SmbiosRecord;
+ SMBIOS_TABLE_TYPE3 *PcdSmbiosRecord;
+ UINTN SourceSize;
+ UINTN TotalSize;
+ UINTN StringOffset;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType3SystemEnclosureChassis);
+
+ //
+ // Get ChassisManufacturer String.
+ //
+ ManufacturerStr = PcdGetPtr (PcdSmbiosType3StringManufacturer);
+ ManuStrLen = AsciiStrLen (ManufacturerStr);
+ ASSERT (ManuStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get ChassisVersion String.
+ //
+ VersionStr = PcdGetPtr (PcdSmbiosType3StringVersion);
+ VerStrLen = AsciiStrLen (VersionStr);
+ ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get ChassisSerialNumber String.
+ //
+ SerialNumberStr = PcdGetPtr (PcdSmbiosType3StringSerialNumber);
+ SerialNumStrLen = AsciiStrLen (SerialNumberStr);
+ ASSERT (SerialNumStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get ChassisAssetTag String.
+ //
+ AssertTagStr = PcdGetPtr (PcdSmbiosType3StringAssetTag);
+ AssertTagStrLen = AsciiStrLen (AssertTagStr);
+ ASSERT (AssertTagStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get ChassisSKUNumber String.
+ //
+ SKUNumberStr = PcdGetPtr (PcdSmbiosType3StringSKUNumber);
+ SKUNumberStrLen = AsciiStrLen (SKUNumberStr);
+ ASSERT (SKUNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Two zeros following the last string.
+ //
+ SourceSize = PcdGetSize(PcdSmbiosType3SystemEnclosureChassis);
+ TotalSize = SourceSize + sizeof(SMBIOS_TABLE_STRING) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + SKUNumberStrLen + 1 + 1;
+ SmbiosRecord = AllocateZeroPool(TotalSize);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE;
+ SmbiosRecord->Hdr.Length = OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements) + sizeof(SMBIOS_TABLE_STRING);
+ if (PcdSmbiosRecord->ContainedElementCount >= 1) {
+ SmbiosRecord->Hdr.Length += PcdSmbiosRecord->ContainedElementCount * PcdSmbiosRecord->ContainedElementRecordLength;
+ }
+ SmbiosRecord->Hdr.Handle = 0;
+
+ if ((PcdSmbiosRecord->ContainedElementCount == 0) || (SourceSize < (UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length)) {
+ SKUNumberPtr = (SMBIOS_TABLE_STRING *)((UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length - sizeof(SMBIOS_TABLE_STRING));
+ *SKUNumberPtr = 5;
+ }
+
+ StringOffset = SmbiosRecord->Hdr.Length;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrLen);
+ StringOffset += ManuStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
+ StringOffset += VerStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumStrLen);
+ StringOffset += SerialNumStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagStrLen);
+ StringOffset += AssertTagStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberStrLen);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md
new file mode 100644
index 0000000000..104cb153a6
--- /dev/null
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md
@@ -0,0 +1,86 @@
+# Overview
+* **Feature Name:** System Management BIOS (SMBIOS)
+* **PI Phase(s) Supported:** DXE
+* **SMM Required?** No
+
+## Purpose
+*_TODO_*
+Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph.
+
+# High-Level Theory of Operation
+*_TODO_*
+A description of how the device works at a high-level.
+
+The description should not be constrained to implementation details but provide a simple mental model of how the
+feature is supposed to work.
+
+## Firmware Volumes
+*_TODO_*
+A bulleted list of the firmware volumes that feature module(s) are placed in.
+
+## Modules
+*_TODO_*
+A bulleted list of the modules that make up the feature.
+
+## <Module Name>
+*_TODO_*
+Each module in the feature should have a section that describes the module in a level of detail that is useful
+to better understand the module source code.
+
+## <Library Name>
+*_TODO_*
+Each library in the feature should have a section that describes the library in a level of detail that is useful
+to better understand the library source code.
+
+## Key Functions
+*_TODO_*
+A bulleted list of key functions for interacting with the feature.
+
+Not all features need to be listed. Only functions exposed through external interfaces that are important for feature
+users to be aware of.
+
+## Configuration
+*_TODO_*
+Information that is useful for configuring the feature.
+
+Not all configuration options need to be listed. This section is used to provide more background on configuration
+options than possible elsewhere.
+
+## Data Flows
+*_TODO_*
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+*_TODO_*
+Key control flows for the feature.
+
+## Build Flows
+*_TODO_*
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or require non-standard tool configuration. If the
+standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+*_TODO_*
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the feature is successful. If the test point is not
+implemented, this should be stated.
+
+## Functional Exit Criteria
+*_TODO_*
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board integrator can reference to ensure the feature is
+functional on their board.
+
+## Feature Enabling Checklist
+*_TODO_*
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+*_TODO_*
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 21/49] Features/Intel/SmbiosFeaturePkg: Update default strings
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 21/49] Features/Intel/SmbiosFeaturePkg: Update default strings Kubacki, Michael A
@ 2019-11-15 23:49 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:49 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 21/49] Features/Intel/SmbiosFeaturePkg: Update default strings
Updates the PCD string default values so they are generic. The PCDs should be customized by the package that uses the feature.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec | 30 ++++++++++----------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
index c06a87aad0..6170f37969 100644
--- a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg
+++ .dec
@@ -138,35 +138,35 @@
#
# SMBIOS Type 0 BIOS Information Strings
#
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|"2008-12-23"|VOID*|0xD1000001
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"PURLEY CV/CRB BIOS Internal"|VOID*|0xD1000002
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor|"Intel Corporation"|VOID*|0xD1000003
+
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|"0
+ 1/01/2019"|VOID*|0xD1000001
+
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"1.0"|
+ VOID*|0xD1000002
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor|"BIOS
+ Vendor"|VOID*|0xD1000003
#
# SMBIOS Type 1 System Information Strings
#
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily|"Family"|VOID*|0xD1000004
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer|"Intel Corporation"|VOID*|0xD1000005
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"PURLEY"|VOID*|0xD1000006
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily|"System
+ Family"|VOID*|0xD1000004
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer|"Syst
+ em Manufacturer"|VOID*|0xD1000005
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"Syste
+ m Product Name"|VOID*|0xD1000006
gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber|"UNKNOWN"|VOID*|0xD1000007
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber|"SKU Number"|VOID*|0xD1000008
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion|"1.0"|VOID*|0xD1000009
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber|"System
+ SKU Number"|VOID*|0xD1000008
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion|"System
+ Version"|VOID*|0xD1000009
#
# SMBIOS Type 2 Base Board Information Strings
#
gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag|"Base Board Asset Tag"|VOID*|0xD100000A
gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis|"Part Component"|VOID*|0xD100000B
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer|"Intel Corporation"|VOID*|0xD100000C
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"PURLEY"|VOID*|0xD100000D
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber|"SPRO03200016"|VOID*|0xD100000E
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion|"E63448-400"|VOID*|0xD100000F
+
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer|"Base
+ Board Manufacturer"|VOID*|0xD100000C
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"Base
+ Board Product Name"|VOID*|0xD100000D
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber|"UNKN
+ OWN"|VOID*|0xD100000E
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion|"Base
+ Board Version"|VOID*|0xD100000F
#
# SMBIOS Type 3 System Enclosure Chassis Strings
#
gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag|"Chassis Asset Tag"|VOID*|0xD1000011
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer|"Intel Corporation"|VOID*|0xD1000012
+
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer|"Chas
+ sis Manufacturer"|VOID*|0xD1000012
gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber|"UNKNOWN"|VOID*|0xD1000013
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber|"SKU Number"|VOID*|0xD1000014
- gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion|"0.1"|VOID*|0xD1000015
+
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber|"Chassis
+ SKU Number"|VOID*|0xD1000014
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion|"Chassis
+ Version"|VOID*|0xD1000015
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 22/49] DebugFeaturePkg: Remove the ACPI Debug feature
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 22/49] DebugFeaturePkg: Remove the ACPI Debug feature Kubacki, Michael A
@ 2019-11-15 23:49 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:49 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A; +Cc: Dong, Eric, Gao, Liming
Why did you remove the check for "if (PcdGetBool (PcdAcpiDebugEnable))"?
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 22/49] DebugFeaturePkg: Remove the ACPI Debug feature
Removes the S3 feature from DebugFeaturePkg. The feature does not follow the advanced feature design. A future change will add the feature back following the advanced feature design.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc | 10 -
Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf | 57 --- Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf | 59 ---
Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c | 523 --------------------
Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl | 103 ----
Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt | 31 --
6 files changed, 783 deletions(-)
diff --git a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
index efe705bd76..c43dd63a06 100644
--- a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
+++ b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
@@ -71,14 +71,6 @@
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
-[LibraryClasses.common.DXE_SMM_DRIVER]
- #######################################
- # Edk2 Packages
- #######################################
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
- MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
- SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
-
###################################################################################################
#
# Components Section - list of the modules and components that will be processed by compilation @@ -113,8 +105,6 @@
DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf
# Add components here that should be included in the package build.
- DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
- DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
[BuildOptions]
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf b/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
deleted file mode 100644
index 7473126b11..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
+++ /dev/null
@@ -1,57 +0,0 @@
-### @file
-# Component description file for Acpi debug module.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = AcpiDebugDxe
- FILE_GUID = EC98FF95-242C-4513-B1BC-69FA24111C58
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeAcpiDebugDxe
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF
-#
-
-[LibraryClasses]
- BaseLib
- BaseMemoryLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- DebugLib
- PcdLib
- DxeServicesLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- DebugFeaturePkg/DebugFeaturePkg.dec
-
-[Pcd]
- gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable ## CONSUMES
- gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize ## CONSUMES
- gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress ## PRODUCES
-
-[Sources]
- AcpiDebug.c
- AcpiDebug.asl
-
-[Protocols]
- gEfiAcpiTableProtocolGuid ## CONSUMES
- gEfiSmmBase2ProtocolGuid ## CONSUMES # only for SMM version
- gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES # only for SMM version
- gEfiSmmEndOfDxeProtocolGuid ## NOTIFY # only for SMM version
-
-[Guids]
- gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event
-
-[Depex]
- gEfiAcpiTableProtocolGuid
-
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf b/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
deleted file mode 100644
index 679f9eb014..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
+++ /dev/null
@@ -1,59 +0,0 @@
-### @file
-# Component description file for Acpi Debug module.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -###
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = AcpiDebugSmm
- FILE_GUID = 9069C144-0A7E-41ef-9C07-418BCA9BF939
- MODULE_TYPE = DXE_SMM_DRIVER
- VERSION_STRING = 1.0
- PI_SPECIFICATION_VERSION = 0x0001000A
- ENTRY_POINT = InitializeAcpiDebugSmm
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF
-#
-
-[LibraryClasses]
- BaseLib
- BaseMemoryLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- DebugLib
- PcdLib
- DxeServicesLib
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- DebugFeaturePkg/DebugFeaturePkg.dec
-
-[Pcd]
- gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable ## CONSUMES
- gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize ## CONSUMES
- gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress ## PRODUCES
-
-[Sources]
- AcpiDebug.c
- AcpiDebug.asl
-
-[Protocols]
- gEfiAcpiTableProtocolGuid ## CONSUMES
- gEfiSmmBase2ProtocolGuid ## CONSUMES
- gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES
- gEfiSmmEndOfDxeProtocolGuid ## NOTIFY
-
-[Guids]
- gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event # only for DXE version
-
-[Depex]
- gEfiAcpiTableProtocolGuid AND
- gEfiSmmBase2ProtocolGuid AND
- gEfiSmmSwDispatch2ProtocolGuid
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c b/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c
deleted file mode 100644
index f99d80f687..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/** @file
- Acpi Debug driver code.
-
-Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-
-#include <Uefi.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DxeServicesLib.h>
-#include <Protocol/AcpiTable.h>
-#include <IndustryStandard/Acpi.h>
-
-#include <Protocol/SmmBase2.h>
-#include <Protocol/SmmEndOfDxe.h>
-#include <Protocol/SmmSwDispatch2.h>
-
-#define ACPI_DEBUG_STR "INTEL ACPI DEBUG"
-
-//
-// ASL NAME structure
-//
-#pragma pack(1)
-typedef struct {
- UINT8 NameOp; // Byte [0]=0x08:NameOp.
- UINT32 NameString; // Byte [4:1]=Name of object.
- UINT8 DWordPrefix; // Byte [5]=0x0C:DWord Prefix.
- UINT32 Value; // 0 ; Value of named object.
-} NAME_LAYOUT;
-#pragma pack()
-
-#pragma pack(1)
-typedef struct {
- UINT8 Signature[16]; // "INTEL ACPI DEBUG"
- UINT32 BufferSize; // Total size of Acpi Debug buffer including header structure
- UINT32 Head; // Current buffer pointer for SMM to print out
- UINT32 Tail; // Current buffer pointer for ASL to input
- UINT8 SmiTrigger; // Value to trigger the SMI via B2 port
- UINT8 Wrap; // If current Tail < Head
- UINT8 SmmVersion; // If SMM version
- UINT8 Truncate; // If the input from ASL > MAX_BUFFER_SIZE
-} ACPI_DEBUG_HEAD;
-#pragma pack()
-
-#define AD_SIZE sizeof (ACPI_DEBUG_HEAD) // This is 0x20
-
-#define MAX_BUFFER_SIZE 32
-
-UINT32 mBufferEnd = 0;
-ACPI_DEBUG_HEAD *mAcpiDebug = NULL;
-
-EFI_SMM_SYSTEM_TABLE2 *mSmst = NULL;
-
-/**
- Patch and load ACPI table.
-
- @param[in] AcpiDebugAddress Address of Acpi debug memory buffer.
- @param[in] BufferIndex Index that starts after the Acpi Debug head.
- @param[in] BufferEnd End of Acpi debug memory buffer.
-
-**/
-VOID
-PatchAndLoadAcpiTable (
- IN ACPI_DEBUG_HEAD *AcpiDebugAddress,
- IN UINT32 BufferIndex,
- IN UINT32 BufferEnd
- )
-{
- EFI_STATUS Status;
- EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
- UINTN Size;
- EFI_ACPI_DESCRIPTION_HEADER *TableHeader;
- UINTN TableKey;
- UINT8 *CurrPtr;
- UINT32 *Signature;
- NAME_LAYOUT *NamePtr;
- UINT8 UpdateCounter;
-
- Status = GetSectionFromFv (
- &gEfiCallerIdGuid,
- EFI_SECTION_RAW,
- 0,
- (VOID **) &TableHeader,
- &Size
- );
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return;
- }
-
- //
- // This is Acpi Debug SSDT. Acpi Debug should be enabled if we reach here so load the table.
- //
- ASSERT (((EFI_ACPI_DESCRIPTION_HEADER *) TableHeader)->OemTableId == SIGNATURE_64 ('A', 'D', 'e', 'b', 'T', 'a', 'b', 'l'));
-
- //
- // Patch some pointers for the ASL code before loading the SSDT.
- //
-
- //
- // Count pointer updates, so we can stop after all three pointers are patched.
- //
- UpdateCounter = 1;
- for (CurrPtr = (UINT8 *) TableHeader; CurrPtr <= ((UINT8 *) TableHeader + TableHeader->Length) && UpdateCounter < 4; CurrPtr++) {
- Signature = (UINT32 *) (CurrPtr + 1);
- //
- // patch DPTR (address of Acpi debug memory buffer)
- //
- if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('D', 'P', 'T', 'R')) {
- NamePtr = (NAME_LAYOUT *) CurrPtr;
- NamePtr->Value = (UINT32) (UINTN) AcpiDebugAddress;
- UpdateCounter++;
- }
- //
- // patch EPTR (end of Acpi debug memory buffer)
- //
- if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('E', 'P', 'T', 'R')) {
- NamePtr = (NAME_LAYOUT *) CurrPtr;
- NamePtr->Value = BufferEnd;
- UpdateCounter++;
- }
- //
- // patch CPTR (used as an index that starts after the Acpi Debug head)
- //
- if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('C', 'P', 'T', 'R')) {
- NamePtr = (NAME_LAYOUT *) CurrPtr;
- NamePtr->Value = BufferIndex;
- UpdateCounter++;
- }
- }
-
- //
- // Add the table
- //
- Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTable);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- TableKey = 0;
- Status = AcpiTable->InstallAcpiTable (
- AcpiTable,
- TableHeader,
- Size,
- &TableKey
- );
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
-Done:
- gBS->FreePool (TableHeader);
- return ;
-}
-
-/**
- Allocate Acpi Debug memory.
-
- @param[out] BufferSize Pointer to Acpi debug memory buffer size.
-
- @return Address of Acpi debug memory buffer. 0 if PcdAcpiDebugEnable is FALSE.
-
-**/
-EFI_PHYSICAL_ADDRESS
-AllocateAcpiDebugMemory (
- OUT UINT32 *BufferSize
- )
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS AcpiDebugAddress;
- UINTN PagesNum;
-
- AcpiDebugAddress = 0;
- *BufferSize = 0;
-
- if (PcdGetBool (PcdAcpiDebugEnable)) {
- //
- // Reserve memory to store Acpi Debug data.
- //
- AcpiDebugAddress = 0xFFFFFFFF;
- PagesNum = EFI_SIZE_TO_PAGES (PcdGet32 (PcdAcpiDebugBufferSize));
- Status = gBS->AllocatePages (
- AllocateMaxAddress,
- EfiReservedMemoryType,
- PagesNum,
- &AcpiDebugAddress
- );
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return 0;
- }
-
- DEBUG ((DEBUG_INFO, "AcpiDebugAddress - 0x%08x\n", AcpiDebugAddress));
-
- Status = PcdSet32S (PcdAcpiDebugAddress, (UINT32) AcpiDebugAddress);
- ASSERT_EFI_ERROR (Status);
-
- if (EFI_ERROR (Status)) {
- gBS->FreePages (AcpiDebugAddress, PagesNum);
- return 0;
- }
-
- *BufferSize = PcdGet32 (PcdAcpiDebugBufferSize);
- }
-
- return AcpiDebugAddress;
-}
-
-/**
- Acpi Debug EndOfDxe notification.
-
- @param[in] Event Event whose notification function is being invoked.
- @param[in] Context Pointer to the notification function's context.
-
-**/
-VOID
-EFIAPI
-AcpiDebugEndOfDxeNotification (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- UINT32 BufferSize;
- UINT32 BufferIndex;
-
- mAcpiDebug = (ACPI_DEBUG_HEAD *) (UINTN) AllocateAcpiDebugMemory (&BufferSize);
- if (mAcpiDebug != NULL) {
- //
- // Init ACPI DEBUG buffer to lower case 'x'.
- //
- SetMem ((VOID *) mAcpiDebug, BufferSize, 0x78);
-
- //
- // Clear header of AD_SIZE bytes.
- //
- ZeroMem ((VOID *) mAcpiDebug, AD_SIZE);
-
- //
- // Write a signature to the first line of the buffer, "INTEL ACPI DEBUG".
- //
- CopyMem ((VOID *) mAcpiDebug, ACPI_DEBUG_STR, sizeof (ACPI_DEBUG_STR) - 1);
-
- BufferIndex = (UINT32) (UINTN) mAcpiDebug;
- mBufferEnd = BufferIndex + BufferSize;
-
- //
- // Leave the Index after the Acpi Debug head.
- //
- BufferIndex += AD_SIZE;
-
- //
- // Patch and Load the SSDT ACPI Tables.
- //
- PatchAndLoadAcpiTable (mAcpiDebug, BufferIndex, mBufferEnd);
-
- mAcpiDebug->Head = BufferIndex;
- mAcpiDebug->Tail = BufferIndex;
- mAcpiDebug->BufferSize = BufferSize;
- }
-
- //
- // Close event, so it will not be invoked again.
- //
- gBS->CloseEvent (Event);
-
- return ;
-}
-
-/**
- Initialize ACPI Debug.
-
- @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 driver initializes correctly.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeAcpiDebugDxe (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_EVENT EndOfDxeEvent;
-
- //
- // Register EndOfDxe notification
- // that point could ensure the Acpi Debug related PCDs initialized.
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- AcpiDebugEndOfDxeNotification,
- NULL,
- &gEfiEndOfDxeEventGroupGuid,
- &EndOfDxeEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-/**
- Software SMI callback for ACPI Debug which is called from ACPI method.
-
- @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 successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-AcpiDebugSmmCallback (
- IN EFI_HANDLE DispatchHandle,
- IN CONST VOID *Context,
- IN OUT VOID *CommBuffer,
- IN OUT UINTN *CommBufferSize
- )
-{
- UINT8 Buffer[MAX_BUFFER_SIZE];
-
- //
- // Validate the fields in mAcpiDebug to ensure there is no harm to SMI handler.
- // mAcpiDebug is below 4GB and the start address of whole buffer.
- //
- if ((mAcpiDebug->BufferSize != (mBufferEnd - (UINT32) (UINTN) mAcpiDebug)) ||
- (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) ||
- (mAcpiDebug->Head > mBufferEnd) ||
- (mAcpiDebug->Tail < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) ||
- (mAcpiDebug->Tail > mBufferEnd)) {
- //
- // If some fields in mAcpiDebug are invaid, return directly.
- //
- return EFI_SUCCESS;
- }
-
- if (!(BOOLEAN)mAcpiDebug->Wrap && ((mAcpiDebug->Head >= (UINT32) ((UINTN) mAcpiDebug + AD_SIZE))
- && (mAcpiDebug->Head < mAcpiDebug->Tail))){
- //
- // If curent ----- buffer + 020
- // ...
- // ... Head
- // ... Data for SMM print
- // ... Tail
- // ... Vacant for ASL input
- // ----- buffer end
- //
- // skip NULL block
- //
- while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head == '\0') && (mAcpiDebug->Head < mAcpiDebug->Tail)) {
- mAcpiDebug->Head ++;
- }
-
- if (mAcpiDebug->Head < mAcpiDebug->Tail) {
- ZeroMem (Buffer, MAX_BUFFER_SIZE);
- AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *) (UINTN) mAcpiDebug->Head, MAX_BUFFER_SIZE - 1);
-
- DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcpiDebug->Truncate ? "..." : ""));
- mAcpiDebug->Head += MAX_BUFFER_SIZE;
-
- if (mAcpiDebug->Head >= (mAcpiDebug->Tail)) {
- //
- // When head == tail, we do nothing in handler.
- //
- mAcpiDebug->Head = mAcpiDebug->Tail;
- }
- }
- } else if ((BOOLEAN) mAcpiDebug->Wrap && ((mAcpiDebug->Head > mAcpiDebug->Tail)
- && (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)))){
- //
- // If curent ----- buffer + 020
- // ... Tail
- // ... Vacant for ASL input
- // ... Head
- // ... Data for SMM print
- // ----- buffer end
- //
- while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head == '\0') && (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize))) {
- mAcpiDebug->Head ++;
- }
- if (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)){
- ZeroMem (Buffer, MAX_BUFFER_SIZE);
- AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *) (UINTN) mAcpiDebug->Head, MAX_BUFFER_SIZE - 1);
- DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcpiDebug->Truncate ? "..." : ""));
- mAcpiDebug->Head += MAX_BUFFER_SIZE;
-
- if (mAcpiDebug->Head >= (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)) {
- //
- // We met end of buffer.
- //
- mAcpiDebug->Wrap = 0;
- mAcpiDebug->Head = (UINT32) ((UINTN) mAcpiDebug + AD_SIZE);
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Acpi Debug SmmEndOfDxe notification.
-
- @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 runs successfully.
-
- **/
-EFI_STATUS
-EFIAPI
-AcpiDebugSmmEndOfDxeNotification (
- IN CONST EFI_GUID *Protocol,
- IN VOID *Interface,
- IN EFI_HANDLE Handle
- )
-{
- EFI_STATUS Status;
- EFI_SMM_SW_DISPATCH2_PROTOCOL *SwDispatch;
- EFI_SMM_SW_REGISTER_CONTEXT SwContext;
- EFI_HANDLE SwHandle;
-
- AcpiDebugEndOfDxeNotification (NULL, NULL);
-
- if (mAcpiDebug != NULL) {
- //
- // Get the Sw dispatch protocol and register SMI callback function.
- //
- SwDispatch = NULL;
- Status = mSmst->SmmLocateProtocol (&gEfiSmmSwDispatch2ProtocolGuid, NULL, (VOID **) &SwDispatch);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- SwContext.SwSmiInputValue = (UINTN) -1;
- Status = SwDispatch->Register (SwDispatch, AcpiDebugSmmCallback, &SwContext, &SwHandle);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- mAcpiDebug->SmiTrigger = (UINT8) SwContext.SwSmiInputValue;
- mAcpiDebug->SmmVersion = 1;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Initialize ACPI Debug.
-
- @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 driver initializes correctly.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeAcpiDebugSmm (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- VOID *Registration;
- EFI_SMM_BASE2_PROTOCOL *SmmBase2;
- BOOLEAN InSmm;
-
- Status = gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID **) &SmmBase2);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = SmmBase2->InSmm (SmmBase2, &InSmm);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ASSERT (InSmm);
-
- if (!InSmm) {
- return EFI_UNSUPPORTED;
- }
-
- Status = SmmBase2->GetSmstLocation (SmmBase2, &mSmst);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Register SmmEndOfDxe notification
- // that point could ensure the Acpi Debug related PCDs initialized.
- //
- Registration = NULL;
- Status = mSmst->SmmRegisterProtocolNotify (
- &gEfiSmmEndOfDxeProtocolGuid,
- AcpiDebugSmmEndOfDxeNotification,
- &Registration
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl b/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl
deleted file mode 100644
index cbfe085b56..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl
+++ /dev/null
@@ -1,103 +0,0 @@
-/** @file
- Acpi Debug ASL code.
-
-Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-DefinitionBlock (
- "AcpiDebug.aml",
- "SSDT",
- 2,
- "Intel ",
- "ADebTabl",
- 0x1000
- )
-{
- Scope(\)
- {
- //
- // These pointers are patched during POST.
- //
- Name (DPTR, 0x80000000) // Address of Acpi debug memory buffer, fixed up during POST
- Name (EPTR, 0x80000000) // End of Acpi debug memory buffer, fixed up during POST
- Name (CPTR, 0x80000000) // Current pointer used as an index into the buffer(starts after the Acpi Debug head), fixed up during POST
-
- //
- // Use a Mutex to prevent multiple calls from simutaneously writing to the same memory.
- //
- Mutex (MMUT, 0)
-
- //
- // Operational region for SMI port access
- //
- OperationRegion (ADBP, SystemIO, 0xB2, 2)
- Field (ADBP, ByteAcc, NoLock, Preserve)
- {
- B2PT, 8,
- B3PT, 8,
- }
-
- //
- // Write a string to a memory buffer
- //
- Method (MDBG, 1, Serialized)
- {
- OperationRegion (ADHD, SystemMemory, DPTR, 32) // Operation region for Acpi Debug buffer first 0x20 bytes
- Field (ADHD, ByteAcc, NoLock, Preserve)
- {
- Offset (0x0),
- ASIG, 128, // 16 bytes is Signature
- Offset (0x10),
- ASIZ, 32, // 4 bytes is buffer size
- ACHP, 32, // 4 bytes is current head pointer, normally is DPTR + 0x20,
- // if there's SMM handler to print, then it's the starting of the info hasn't been printed yet.
- ACTP, 32, // 4 bytes is current tail pointer, is the same as CPTR
- SMIN, 8, // 1 byte of SMI Number for trigger callback
- WRAP, 8, // 1 byte of wrap status
- SMMV, 8, // 1 byte of SMM version status
- TRUN, 8 // 1 byte of truncate status
- }
-
- Store (Acquire (MMUT, 1000), Local0) // save Acquire result so we can check for Mutex acquired
- If (LEqual (Local0, Zero)) // check for Mutex acquired
- {
- OperationRegion (ABLK, SystemMemory, CPTR, 32) // Operation region to allow writes to ACPI debug buffer
- Field (ABLK, ByteAcc, NoLock, Preserve)
- {
- Offset (0x0),
- AAAA, 256 // 32 bytes is max size for string or data
- }
- ToHexString (Arg0, Local1) // convert argument to Hexadecimal String
- Store (0, TRUN)
- If (LGreaterEqual (SizeOf (Local1), 32))
- {
- Store (1, TRUN) // the input from ASL >= 32
- }
- Mid (Local1, 0, 31, AAAA) // extract the input to current buffer
-
- Add (CPTR, 32, CPTR) // advance current pointer to next string location in memory buffer
- If (LGreaterEqual (CPTR, EPTR) ) // check for end of 64kb Acpi debug buffer
- {
- Add (DPTR, 32, CPTR) // wrap around to beginning of buffer if the end has been reached
- Store (1, WRAP)
- }
- Store (CPTR, ACTP)
-
- If (SMMV)
- {
- //
- // Trigger the SMI to print
- //
- Store (SMIN, B2PT)
- }
- Release (MMUT)
- }
-
- Return (Local0) // return error code indicating whether Mutex was acquired
- }
-
- } // End Scope
-} // End SSDT
-
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt b/Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt
deleted file mode 100644
index 71284ec77f..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-ACPI Debug feature - an alternative to Port 80 and WinDBG
-
-How it works:
- Acpi Debug does this:
- Opens a 64kb memory buffer during POST.
- Patches the buffer address in SSDT ASL code.
- Save the address in gAdvancedFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress for user reference.
- Write strings or numbers to the buffer from ASL code with the ADBG method.
-
-How to use it:
- 1. Enable it by set gAdvancedFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable to TRUE.
- 2. The ACPI ASL code must be instrumented with the debug method.
- Strings up to 32 characters (shorter strings will be padded with Zero's, longer strings will be truncated)
- Examples:
- ADBG("This is a test.")
- ADBG(Arg0)
-
- DXE version: The bios engineer will read the strings from the buffer on the target machine with read/write memory utility.
- SMM version: Check debug serial that would show debug strings.
-
- Sample code for ADBG:
- External (MDBG, MethodObj)
- Method (ADBG, 1, Serialized)
- {
- If (CondRefOf (MDBG)) // Check if ACPI Debug SSDT is loaded
- {
- Return (MDBG (Arg0))
- }
- Return (0)
- }
-
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 23/49] Features/Intel/AcpiDebugFeaturePkg: Add initial package
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 23/49] Features/Intel/AcpiDebugFeaturePkg: Add initial package Kubacki, Michael A
@ 2019-11-15 23:49 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:49 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A; +Cc: Dong, Eric, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 23/49] Features/Intel/AcpiDebugFeaturePkg: Add initial package
Adds a new feature package for the ACPI Debug feature.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec | 39 ++
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc | 30 ++
Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeature.dsc | 125 +++++
Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf | 11 +
Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugDxe.inf | 55 +++ Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugSmm.inf | 58 +++
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.c | 519 ++++++++++++++++++++
Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.asl | 102 ++++
Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md | 121 +++++
10 files changed, 1068 insertions(+)
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
new file mode 100644
index 0000000000..a74ee3e084
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.d
+++ ec
@@ -0,0 +1,39 @@
+## @file
+# This package provides advanced feature functionality for ACPI Debug support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and # INF
+files to generate AutoGen.c and AutoGen.h files # for the build
+infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = AcpiDebugFeaturePkg
+ PACKAGE_GUID = 53E3E908-5DF9-4137-ABB9-6DE162C3898F
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[LibraryClasses]
+
+[Guids]
+ gAcpiDebugFeaturePkgTokenSpaceGuid = {0xaf2582c0, 0x93fe, 0x466d,
+{0xb6, 0xa4, 0x4d, 0x23, 0x77, 0xf7, 0x82, 0xa7}}
+
+[PcdsFeatureFlag]
+
+gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable|FALSE|BOOL
+EAN|0xA0000001
+
+[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx]
+ ## This PCD specifies the ACPI debug message buffer size.
+
+gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize|0x10000|UINT3
+2|0xF0000001
+
+[PcdsDynamic, PcdsDynamicEx]
+ ## This PCD specifies ACPI debug message buffer address.
+ # The PCD value will be updated during boot time when the buffer is allocated.
+
+gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress|0|UINT32|0xD0000
+001
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc
new file mode 100644
index 0000000000..62cc559d8f
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.d
+++ sc
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for ACPI Debug support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and # INF
+files to generate AutoGen.c and AutoGen.h files # for the build
+infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+[Defines]
+ PLATFORM_NAME = AcpiDebugFeaturePkg
+ PLATFORM_GUID = F3001DF1-4A5B-42A9-944B-E766BDDC7B99
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#
+# This package always builds the feature.
+#
+!include Include/AcpiDebugFeature.dsc
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeature.dsc b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeature.dsc
new file mode 100644
index 0000000000..3e6b1f69c2
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeat
+++ ure.dsc
@@ -0,0 +1,125 @@
+## @file
+# This is a build description file for the ACPI Debug advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and # INF
+files to generate AutoGen.c and AutoGen.h files # for the build
+infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+#######################################################################
+#########
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+#######################################################################
+#########
+[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
+
+#######################################################################
+#########
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+#######################################################################
+#########
+[LibraryClasses]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+
+UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBo
+otServicesTableLib.inf
+
+UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntr
+yPoint.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+
+UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/
+UefiRuntimeServicesTableLib.inf
+
+[LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRI
+VER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+
+MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAl
+locationLib.inf
+
+[LibraryClasses.common.DXE_SMM_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+
+MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllo
+cationLib.inf
+
+SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTable
+Lib.inf
+
+#######################################################################
+#########
+#
+# Component section - list of all components that need built for this feature.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+#######################################################################
+#########
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # ACPI Debug Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package
+ components and should be tested # in the package build.
+
+ # Add components here that should be included in the package build.
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
+ #####################################
+ # ACPI Debug Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package
+ components and should be tested # in the package build.
+
+ # Add components here that should be included in the package build.
+ Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugDxe.inf
+ Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugSmm.inf
+
+#######################################################################
+############################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
+#######################################################################
+############################
+[BuildOptions]
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..ae90238bed
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fd
+++ f
@@ -0,0 +1,11 @@
+## @file
+# FDF file for post-memory ACPI Debug advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+ INF Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugDxe.inf
+ INF Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugSmm.inf
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..3100daee71
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory ACPI Debug advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugDxe.inf b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugDxe.inf
new file mode 100644
index 0000000000..dfcee0a842
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiD
+++ ebugDxe.inf
@@ -0,0 +1,55 @@
+### @file
+# Component description file for the ACPI Debug DXE module.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = AcpiDebugDxe
+ FILE_GUID = EC98FF95-242C-4513-B1BC-69FA24111C58
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializeAcpiDebugDxe
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[LibraryClasses]
+ BaseLib
+ BaseMemoryLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ DebugLib
+ PcdLib
+ DxeServicesLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
+
+[Pcd]
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize ## CONSUMES
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress ## PRODUCES
+
+[Sources]
+ AcpiDebug.c
+ AcpiDebug.asl
+
+[Protocols]
+ gEfiAcpiTableProtocolGuid ## CONSUMES
+ gEfiSmmBase2ProtocolGuid ## CONSUMES # only for SMM version
+ gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES # only for SMM version
+ gEfiSmmEndOfDxeProtocolGuid ## NOTIFY # only for SMM version
+
+[Guids]
+ gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event
+
+[Depex]
+ gEfiAcpiTableProtocolGuid
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugSmm.inf b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebugSmm.inf
new file mode 100644
index 0000000000..089bb57707
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiD
+++ ebugSmm.inf
@@ -0,0 +1,58 @@
+### @file
+# Component description file for Acpi Debug SMM module.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = AcpiDebugSmm
+ FILE_GUID = 9069C144-0A7E-41EF-9C07-418BCA9BF939
+ MODULE_TYPE = DXE_SMM_DRIVER
+ VERSION_STRING = 1.0
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ ENTRY_POINT = InitializeAcpiDebugSmm
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[LibraryClasses]
+ BaseLib
+ BaseMemoryLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ DebugLib
+ PcdLib
+ DxeServicesLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
+
+[Pcd]
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize ## CONSUMES
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress ## PRODUCES
+
+[Sources]
+ AcpiDebug.c
+ AcpiDebug.asl
+
+[Protocols]
+ gEfiAcpiTableProtocolGuid ## CONSUMES
+ gEfiSmmBase2ProtocolGuid ## CONSUMES
+ gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES
+ gEfiSmmEndOfDxeProtocolGuid ## NOTIFY
+
+[Guids]
+ gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event # only for DXE version
+
+[Depex]
+ gEfiAcpiTableProtocolGuid AND
+ gEfiSmmBase2ProtocolGuid AND
+ gEfiSmmSwDispatch2ProtocolGuid
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.c b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.c
new file mode 100644
index 0000000000..42428d8005
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiD
+++ ebug.c
@@ -0,0 +1,519 @@
+/** @file
+ ACPI Debug feature driver implementation.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
+#include <Library/DxeServicesLib.h>
+#include <Protocol/AcpiTable.h>
+#include <IndustryStandard/Acpi.h>
+
+#include <Protocol/SmmBase2.h>
+#include <Protocol/SmmEndOfDxe.h>
+#include <Protocol/SmmSwDispatch2.h>
+
+#define ACPI_DEBUG_STR "INTEL ACPI DEBUG"
+
+//
+// ASL NAME structure
+//
+#pragma pack(1)
+typedef struct {
+ UINT8 NameOp; // Byte [0]=0x08:NameOp.
+ UINT32 NameString; // Byte [4:1]=Name of object.
+ UINT8 DWordPrefix; // Byte [5]=0x0C:DWord Prefix.
+ UINT32 Value; // 0 ; Value of named object.
+} NAME_LAYOUT;
+#pragma pack()
+
+#pragma pack(1)
+typedef struct {
+ UINT8 Signature[16]; // "INTEL ACPI DEBUG"
+ UINT32 BufferSize; // Total size of Acpi Debug buffer including header structure
+ UINT32 Head; // Current buffer pointer for SMM to print out
+ UINT32 Tail; // Current buffer pointer for ASL to input
+ UINT8 SmiTrigger; // Value to trigger the SMI via B2 port
+ UINT8 Wrap; // If current Tail < Head
+ UINT8 SmmVersion; // If SMM version
+ UINT8 Truncate; // If the input from ASL > MAX_BUFFER_SIZE
+} ACPI_DEBUG_HEAD;
+#pragma pack()
+
+#define AD_SIZE sizeof (ACPI_DEBUG_HEAD) // This is 0x20
+
+#define MAX_BUFFER_SIZE 32
+
+UINT32 mBufferEnd = 0;
+ACPI_DEBUG_HEAD *mAcpiDebug = NULL;
+
+EFI_SMM_SYSTEM_TABLE2 *mSmst = NULL;
+
+/**
+ Patch and load ACPI table.
+
+ @param[in] AcpiDebugAddress Address of Acpi debug memory buffer.
+ @param[in] BufferIndex Index that starts after the Acpi Debug head.
+ @param[in] BufferEnd End of Acpi debug memory buffer.
+
+**/
+VOID
+PatchAndLoadAcpiTable (
+ IN ACPI_DEBUG_HEAD *AcpiDebugAddress,
+ IN UINT32 BufferIndex,
+ IN UINT32 BufferEnd
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ UINTN Size;
+ EFI_ACPI_DESCRIPTION_HEADER *TableHeader;
+ UINTN TableKey;
+ UINT8 *CurrPtr;
+ UINT32 *Signature;
+ NAME_LAYOUT *NamePtr;
+ UINT8 UpdateCounter;
+
+ Status = GetSectionFromFv (
+ &gEfiCallerIdGuid,
+ EFI_SECTION_RAW,
+ 0,
+ (VOID **) &TableHeader,
+ &Size
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ //
+ // This is Acpi Debug SSDT. Acpi Debug should be enabled if we reach here so load the table.
+ //
+ ASSERT (((EFI_ACPI_DESCRIPTION_HEADER *) TableHeader)->OemTableId ==
+ SIGNATURE_64 ('A', 'D', 'e', 'b', 'T', 'a', 'b', 'l'));
+
+ //
+ // Patch some pointers for the ASL code before loading the SSDT.
+ //
+
+ //
+ // Count pointer updates, so we can stop after all three pointers are patched.
+ //
+ UpdateCounter = 1;
+ for (CurrPtr = (UINT8 *) TableHeader; CurrPtr <= ((UINT8 *) TableHeader + TableHeader->Length) && UpdateCounter < 4; CurrPtr++) {
+ Signature = (UINT32 *) (CurrPtr + 1);
+ //
+ // patch DPTR (address of Acpi debug memory buffer)
+ //
+ if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('D', 'P', 'T', 'R')) {
+ NamePtr = (NAME_LAYOUT *) CurrPtr;
+ NamePtr->Value = (UINT32) (UINTN) AcpiDebugAddress;
+ UpdateCounter++;
+ }
+ //
+ // patch EPTR (end of Acpi debug memory buffer)
+ //
+ if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('E', 'P', 'T', 'R')) {
+ NamePtr = (NAME_LAYOUT *) CurrPtr;
+ NamePtr->Value = BufferEnd;
+ UpdateCounter++;
+ }
+ //
+ // patch CPTR (used as an index that starts after the Acpi Debug head)
+ //
+ if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('C', 'P', 'T', 'R')) {
+ NamePtr = (NAME_LAYOUT *) CurrPtr;
+ NamePtr->Value = BufferIndex;
+ UpdateCounter++;
+ }
+ }
+
+ //
+ // Add the table
+ //
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID
+ **)&AcpiTable); ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+ TableKey = 0;
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ TableHeader,
+ Size,
+ &TableKey
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+Done:
+ gBS->FreePool (TableHeader);
+ return ;
+}
+
+/**
+ Allocate Acpi Debug memory.
+
+ @param[out] BufferSize Pointer to Acpi debug memory buffer size.
+
+ @return Address of Acpi debug memory buffer.
+
+**/
+EFI_PHYSICAL_ADDRESS
+AllocateAcpiDebugMemory (
+ OUT UINT32 *BufferSize
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS AcpiDebugAddress;
+ UINTN PagesNum;
+
+ AcpiDebugAddress = 0;
+ *BufferSize = 0;
+
+ //
+ // Reserve memory to store Acpi Debug data.
+ //
+ AcpiDebugAddress = 0xFFFFFFFF;
+ PagesNum = EFI_SIZE_TO_PAGES (PcdGet32 (PcdAcpiDebugBufferSize));
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiReservedMemoryType,
+ PagesNum,
+ &AcpiDebugAddress
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return 0;
+ }
+
+ DEBUG ((DEBUG_INFO, "AcpiDebugAddress - 0x%08x\n",
+ AcpiDebugAddress));
+
+ Status = PcdSet32S (PcdAcpiDebugAddress, (UINT32) AcpiDebugAddress);
+ ASSERT_EFI_ERROR (Status);
+
+ if (EFI_ERROR (Status)) {
+ gBS->FreePages (AcpiDebugAddress, PagesNum);
+ return 0;
+ }
+
+ *BufferSize = PcdGet32 (PcdAcpiDebugBufferSize);
+
+ return AcpiDebugAddress;
+}
+
+/**
+ Acpi Debug EndOfDxe notification.
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context Pointer to the notification function's context.
+
+**/
+VOID
+EFIAPI
+AcpiDebugEndOfDxeNotification (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ UINT32 BufferSize;
+ UINT32 BufferIndex;
+
+ mAcpiDebug = (ACPI_DEBUG_HEAD *) (UINTN) AllocateAcpiDebugMemory
+ (&BufferSize); if (mAcpiDebug != NULL) {
+ //
+ // Init ACPI DEBUG buffer to lower case 'x'.
+ //
+ SetMem ((VOID *) mAcpiDebug, BufferSize, 0x78);
+
+ //
+ // Clear header of AD_SIZE bytes.
+ //
+ ZeroMem ((VOID *) mAcpiDebug, AD_SIZE);
+
+ //
+ // Write a signature to the first line of the buffer, "INTEL ACPI DEBUG".
+ //
+ CopyMem ((VOID *) mAcpiDebug, ACPI_DEBUG_STR, sizeof
+ (ACPI_DEBUG_STR) - 1);
+
+ BufferIndex = (UINT32) (UINTN) mAcpiDebug;
+ mBufferEnd = BufferIndex + BufferSize;
+
+ //
+ // Leave the Index after the Acpi Debug head.
+ //
+ BufferIndex += AD_SIZE;
+
+ //
+ // Patch and Load the SSDT ACPI Tables.
+ //
+ PatchAndLoadAcpiTable (mAcpiDebug, BufferIndex, mBufferEnd);
+
+ mAcpiDebug->Head = BufferIndex;
+ mAcpiDebug->Tail = BufferIndex;
+ mAcpiDebug->BufferSize = BufferSize; }
+
+ //
+ // Close event, so it will not be invoked again.
+ //
+ gBS->CloseEvent (Event);
+
+ return ;
+}
+
+/**
+ Initialize ACPI Debug.
+
+ @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 driver initializes correctly.
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeAcpiDebugDxe (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_EVENT EndOfDxeEvent;
+
+ //
+ // Register EndOfDxe notification
+ // that point could ensure the Acpi Debug related PCDs initialized.
+ //
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ AcpiDebugEndOfDxeNotification,
+ NULL,
+ &gEfiEndOfDxeEventGroupGuid,
+ &EndOfDxeEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+/**
+ Software SMI callback for ACPI Debug which is called from ACPI method.
+
+ @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 successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+AcpiDebugSmmCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN CONST VOID *Context,
+ IN OUT VOID *CommBuffer,
+ IN OUT UINTN *CommBufferSize
+ )
+{
+ UINT8 Buffer[MAX_BUFFER_SIZE];
+
+ //
+ // Validate the fields in mAcpiDebug to ensure there is no harm to SMI handler.
+ // mAcpiDebug is below 4GB and the start address of whole buffer.
+ //
+ if ((mAcpiDebug->BufferSize != (mBufferEnd - (UINT32) (UINTN) mAcpiDebug)) ||
+ (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) ||
+ (mAcpiDebug->Head > mBufferEnd) ||
+ (mAcpiDebug->Tail < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) ||
+ (mAcpiDebug->Tail > mBufferEnd)) {
+ //
+ // If some fields in mAcpiDebug are invaid, return directly.
+ //
+ return EFI_SUCCESS;
+ }
+
+ if (!(BOOLEAN)mAcpiDebug->Wrap && ((mAcpiDebug->Head >= (UINT32) ((UINTN) mAcpiDebug + AD_SIZE))
+ && (mAcpiDebug->Head < mAcpiDebug->Tail))){
+ //
+ // If curent ----- buffer + 020
+ // ...
+ // ... Head
+ // ... Data for SMM print
+ // ... Tail
+ // ... Vacant for ASL input
+ // ----- buffer end
+ //
+ // skip NULL block
+ //
+ while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head == '\0') && (mAcpiDebug->Head < mAcpiDebug->Tail)) {
+ mAcpiDebug->Head ++;
+ }
+
+ if (mAcpiDebug->Head < mAcpiDebug->Tail) {
+ ZeroMem (Buffer, MAX_BUFFER_SIZE);
+ AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *)
+ (UINTN) mAcpiDebug->Head, MAX_BUFFER_SIZE - 1);
+
+ DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcpiDebug->Truncate ? "..." : ""));
+ mAcpiDebug->Head += MAX_BUFFER_SIZE;
+
+ if (mAcpiDebug->Head >= (mAcpiDebug->Tail)) {
+ //
+ // When head == tail, we do nothing in handler.
+ //
+ mAcpiDebug->Head = mAcpiDebug->Tail;
+ }
+ }
+ } else if ((BOOLEAN) mAcpiDebug->Wrap && ((mAcpiDebug->Head > mAcpiDebug->Tail)
+ && (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)))){
+ //
+ // If curent ----- buffer + 020
+ // ... Tail
+ // ... Vacant for ASL input
+ // ... Head
+ // ... Data for SMM print
+ // ----- buffer end
+ //
+ while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head == '\0') && (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize))) {
+ mAcpiDebug->Head ++;
+ }
+ if (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)){
+ ZeroMem (Buffer, MAX_BUFFER_SIZE);
+ AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *) (UINTN) mAcpiDebug->Head, MAX_BUFFER_SIZE - 1);
+ DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcpiDebug->Truncate ? "..." : ""));
+ mAcpiDebug->Head += MAX_BUFFER_SIZE;
+
+ if (mAcpiDebug->Head >= (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)) {
+ //
+ // We met end of buffer.
+ //
+ mAcpiDebug->Wrap = 0;
+ mAcpiDebug->Head = (UINT32) ((UINTN) mAcpiDebug + AD_SIZE);
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Acpi Debug SmmEndOfDxe notification.
+
+ @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 runs successfully.
+
+ **/
+EFI_STATUS
+EFIAPI
+AcpiDebugSmmEndOfDxeNotification (
+ IN CONST EFI_GUID *Protocol,
+ IN VOID *Interface,
+ IN EFI_HANDLE Handle
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMM_SW_DISPATCH2_PROTOCOL *SwDispatch;
+ EFI_SMM_SW_REGISTER_CONTEXT SwContext;
+ EFI_HANDLE SwHandle;
+
+ AcpiDebugEndOfDxeNotification (NULL, NULL);
+
+ if (mAcpiDebug != NULL) {
+ //
+ // Get the Sw dispatch protocol and register SMI callback function.
+ //
+ SwDispatch = NULL;
+ Status = mSmst->SmmLocateProtocol (&gEfiSmmSwDispatch2ProtocolGuid, NULL, (VOID **) &SwDispatch);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ SwContext.SwSmiInputValue = (UINTN) -1;
+ Status = SwDispatch->Register (SwDispatch, AcpiDebugSmmCallback, &SwContext, &SwHandle);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ mAcpiDebug->SmiTrigger = (UINT8) SwContext.SwSmiInputValue;
+ mAcpiDebug->SmmVersion = 1;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize ACPI Debug.
+
+ @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 driver initializes correctly.
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeAcpiDebugSmm (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ VOID *Registration;
+ EFI_SMM_BASE2_PROTOCOL *SmmBase2;
+ BOOLEAN InSmm;
+
+ Status = gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID
+ **) &SmmBase2); ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = SmmBase2->InSmm (SmmBase2, &InSmm); ASSERT_EFI_ERROR
+ (Status); if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ASSERT (InSmm);
+
+ if (!InSmm) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = SmmBase2->GetSmstLocation (SmmBase2, &mSmst);
+ ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Register SmmEndOfDxe notification
+ // that point could ensure the Acpi Debug related PCDs initialized.
+ //
+ Registration = NULL;
+ Status = mSmst->SmmRegisterProtocolNotify (
+ &gEfiSmmEndOfDxeProtocolGuid,
+ AcpiDebugSmmEndOfDxeNotification,
+ &Registration
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.asl b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiDebug.asl
new file mode 100644
index 0000000000..3504c2d6ea
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm/AcpiD
+++ ebug.asl
@@ -0,0 +1,102 @@
+/** @file
+ SSDT for the ACPI Debug feature.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+DefinitionBlock (
+ "AcpiDebug.aml",
+ "SSDT",
+ 2,
+ "Intel ",
+ "ADebTabl",
+ 0x1000
+ )
+{
+ Scope(\)
+ {
+ //
+ // These pointers are patched during POST.
+ //
+ Name (DPTR, 0x80000000) // Address of Acpi debug memory buffer, fixed up during POST
+ Name (EPTR, 0x80000000) // End of Acpi debug memory buffer, fixed up during POST
+ Name (CPTR, 0x80000000) // Current pointer used as an index into
+the buffer(starts after the Acpi Debug head), fixed up during POST
+
+ //
+ // Use a Mutex to prevent multiple calls from simutaneously writing to the same memory.
+ //
+ Mutex (MMUT, 0)
+
+ //
+ // Operational region for SMI port access
+ //
+ OperationRegion (ADBP, SystemIO, 0xB2, 2)
+ Field (ADBP, ByteAcc, NoLock, Preserve)
+ {
+ B2PT, 8,
+ B3PT, 8,
+ }
+
+ //
+ // Write a string to a memory buffer
+ //
+ Method (MDBG, 1, Serialized)
+ {
+ OperationRegion (ADHD, SystemMemory, DPTR, 32) // Operation region for Acpi Debug buffer first 0x20 bytes
+ Field (ADHD, ByteAcc, NoLock, Preserve)
+ {
+ Offset (0x0),
+ ASIG, 128, // 16 bytes is Signature
+ Offset (0x10),
+ ASIZ, 32, // 4 bytes is buffer size
+ ACHP, 32, // 4 bytes is current head pointer, normally is DPTR + 0x20,
+ // if there's SMM handler to print, then it's the starting of the info hasn't been printed yet.
+ ACTP, 32, // 4 bytes is current tail pointer, is the same as CPTR
+ SMIN, 8, // 1 byte of SMI Number for trigger callback
+ WRAP, 8, // 1 byte of wrap status
+ SMMV, 8, // 1 byte of SMM version status
+ TRUN, 8 // 1 byte of truncate status
+ }
+
+ Store (Acquire (MMUT, 1000), Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual (Local0, Zero)) // check for Mutex acquired
+ {
+ OperationRegion (ABLK, SystemMemory, CPTR, 32) // Operation region to allow writes to ACPI debug buffer
+ Field (ABLK, ByteAcc, NoLock, Preserve)
+ {
+ Offset (0x0),
+ AAAA, 256 // 32 bytes is max size for string or data
+ }
+ ToHexString (Arg0, Local1) // convert argument to Hexadecimal String
+ Store (0, TRUN)
+ If (LGreaterEqual (SizeOf (Local1), 32))
+ {
+ Store (1, TRUN) // the input from ASL >= 32
+ }
+ Mid (Local1, 0, 31, AAAA) // extract the input to current
+ buffer
+
+ Add (CPTR, 32, CPTR) // advance current pointer to next string location in memory buffer
+ If (LGreaterEqual (CPTR, EPTR) ) // check for end of 64kb Acpi debug buffer
+ {
+ Add (DPTR, 32, CPTR) // wrap around to beginning of buffer if the end has been reached
+ Store (1, WRAP)
+ }
+ Store (CPTR, ACTP)
+
+ If (SMMV)
+ {
+ //
+ // Trigger the SMI to print
+ //
+ Store (SMIN, B2PT)
+ }
+ Release (MMUT)
+ }
+
+ Return (Local0) // return error code indicating whether Mutex was acquired
+ }
+
+ } // End Scope
+} // End SSDT
diff --git a/Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md
new file mode 100644
index 0000000000..bc0dce9348
--- /dev/null
+++ b/Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md
@@ -0,0 +1,121 @@
+# Overview
+* **Feature Name:** ACPI Debug
+* **PI Phase(s) Supported:** DXE and SMM
+* **SMM Required?** No
+
+## Purpose
+This feature is an alternative ACPI debug mechanism to port 0x80 or a kernel debugger such as WinDBG.
+
+**_DO NOT_** use this feature in a production system. It may not handle
+SMM memory buffers or data input/output from SMM in a safe manner.
+
+# High-Level Theory of Operation
+There are two driver modes:
+ 1. DXE - ACPI debug messages should be manually read from a memory buffer on the target machine using a utility
+ that has the ability to read main memory.
+ 2. SMM - ACPI debug messages should be read from the firmware debug message output port.
+
+The DXE driver is required and the SMM driver is optional. The SMM
+driver eases retrieval of the ACPI debug messages from a message ring
+buffer in memory by sending the messages over the SMM debug mechanism.
+ASL code writes messages up to 32 characters in length (shorter strings will be padded with zeroes and longer strings will be truncated) to an ASL debug method.
+
+## Firmware Volumes
+* FvAdvancedPostMemory
+
+## Modules
+* AcpiDebugDxe
+* AcpiDebugSmm
+
+## AcpiDebugDxe
+The entry point registers an end of DXE notification. Further action is
+deferred until end of DXE to allow the feature PCDs to be customized at
+boot time in DXE if desired. The notification handler allocates a
+`EfiReservedMemoryType` buffer (memory not available to the operating
+system) of the size specified in `PcdAcpiDebugBufferSize`. The actual
+buffer size is allocated on a page boundary of size `EFI_PAGE_SIZE`. The allocated buffer address is written out as a debug message `AcpiDebugAddress - 0xXXXXXXXX`. In addition, the address is written to `PcdAcpiDebugAddress` and the actual allocation size is written to `PcdAcpiDebugBufferSize`.
+
+To expose the ACPI debug buffer to ASL code, an ACPI debug SSDT
+(defined in `AcpiDebug.asl`) is installed. The pointer fields in the
+SSDT are patched by `AcpiDebugDxe` to the actual buffer address. The SSDT is installed using the `EFI_ACPI_TABLE_PROTOCOL`.
+
+## AcpiDebugSmm
+The entry point registers an end of DXE notification. Further action is
+deferred until end of DXE to allow the feature PCDs to be customized at
+boot time if desired. The notification handler registers a SW SMI that
+can be triggered in ACPI debug SSDT to invoke the SMI handler
+`AcpiDebugSmmCallback ()`. The SMI handler retrieves the debug message from the buffer at `PcdAcpiDebugAddress` and sends it to the `DEBUG` function for the given SMM `DebugLib` instance assigned to `AcpiDebugSmm`.
+
+## Key Functions
+* `MDBG` _(ASL method)_
+
+ This method is given a single argument with a number or string to
+ write to the ACPI memory debug buffer. If AcpiDebugSmm is used, an
+ SMI will be used to send the message as a DEBUG message.
+
+ It is recommended to instrument the ASL code with a method called
+ `ADBG`. An ASL caller sends a debug message as follows:
+
+ ```
+ ADBG("This is a test.")
+ ADBG(Arg0)
+ ```
+
+* `ADBG` _(ASL method)_ is intended to be a wrapper of `MDBG` that
+allows the `ADBG` references to remain in the ASL code even if
+ the ACPI debug advanced feature is disabled. Below is a code snippet with a sample implementation for `ADBG`.
+
+ ```
+ External (MDBG, MethodObj)
+ Method (ADBG, 1, Serialized)
+ {
+ If (CondRefOf (MDBG)) // Check if ACPI Debug SSDT is loaded
+ {
+ Return (MDBG (Arg0))
+ }
+ Return (0)
+ }
+ ```
+
+## Configuration
+* PcdAcpiDebugEnable - Enables this feature.
+* PcdAcpiDebugAddress - The address of the ACPI debug message buffer.
+* PcdAcpiDebugBufferSize - The size of the ACPI debug message buffer.
+
+## Data Flows
+*_TODO_*
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+*_TODO_*
+Key control flows for the feature.
+
+## Build Flows
+*_TODO_*
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or
+require non-standard tool configuration. If the standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+*_TODO_*
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the
+feature is successful. If the test point is not implemented, this should be stated.
+
+## Functional Exit Criteria
+*_TODO_*
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board
+integrator can reference to ensure the feature is functional on their board.
+
+## Feature Enabling Checklist
+*_TODO_*
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+*_TODO_*
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 25/49] Features/Intel/Usb3DebugFeaturePkg: Add initial package
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 25/49] Features/Intel/Usb3DebugFeaturePkg: " Kubacki, Michael A
@ 2019-11-15 23:50 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:50 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A; +Cc: Dong, Eric, Gao, Liming
1. Why rename Usb3DebugPortParameterLib.h to Library/Usb3DebugPortParamLib.h?
2. Please at least fill in the "Purpose" section of Readme.md, don't leave the entire file as TODOs.
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 25/49] Features/Intel/Usb3DebugFeaturePkg: Add initial package
Adds a new feature package for the USB3 Debug feature.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec | 57 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc | 149 ++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dsc | 30 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf | 8 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf | 55 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf | 63 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf | 27 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf | 48 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf | 51 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf | 31 +
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h | 71 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortParamLib.h | 56 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h | 887 +++++++++++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c | 385 +++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c | 892 ++++++++++++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c | 726 ++++++++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c | 454 ++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c | 828 ++++++++++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c | 103 +++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c | 236 ++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c | 440 ++++++++++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.c | 58 ++
Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md | 86 ++
24 files changed, 5749 insertions(+)
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
new file mode 100644
index 0000000000..2b19e48491
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
@@ -0,0 +1,57 @@
+## @file
+# This package provides advanced feature functionality for USB3 Debug support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = Usb3DebugFeaturePkg
+ PACKAGE_GUID = A96B06AE-5C10-4226-9B22-259AFCBB6119
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[LibraryClasses]
+ ## @libraryclass Provides the capability to get/set USB3 debug port parameters.
+ Usb3DebugPortParamLib|Include/Library/Usb3DebugPortParamLib.h
+
+ ## @libraryclass Provide common USB3 debug port functions.
+ Usb3DebugPortLib|Include/Library/Usb3DebugPortLib.h
+
+[Guids]
+ gUsb3DebugFeaturePkgTokenSpaceGuid = {0x1cbca3b0, 0x780c, 0x47d0, {0x8a, 0x46, 0xfe, 0x10, 0x77, 0x64, 0xe8, 0xd0}}
+
+[PcdsFeatureFlag]
+ ## This PCD specifies whether StatusCode is reported via USB3 Serial port.
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable|FALSE|BOOLEAN|0xA0000001
+
+[PcdsFixedAtBuild]
+ ## These PCD specify XHCI controller Bus/Device/Function, which are used to enable
+ # XHCI debug device.
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciBus|0x00|UINT8|0xF0000001
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciDev|0x14|UINT8|0xF0000002
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciFunc|0x00|UINT8|0xF0000003
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress|0xFEA10000|UINT32|0xF0000004
+
+ ## This PCD specifies the wait timeout value in microsecond if USB debug cable is detected but host not connected.
+ # Default timeout value is 2000000 microseconds.
+ # If user does not want system stall for long time, it can be set to small value.
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout|2000000|UINT64|0xF0000005
+
+ ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes space.
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortBusIndex|0x59|UINT8|0xF0000006
+ ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes space.
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortDeviceIndex|0x5A|UINT8|0xF0000007
+ ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes space.
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortFunctionIndex|0x5B|UINT8|0xF0000008
+
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc
new file mode 100644
index 0000000000..494dd7a342
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc
@@ -0,0 +1,149 @@
+## @file
+# This is a build description file for the USB3 Debug advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+################################################################################
+[LibraryClasses]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+
+[LibraryClasses.common.PEIM]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+ PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
+
+[LibraryClasses.common.DXE_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+
+[LibraryClasses.common.DXE_RUNTIME_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+
+[LibraryClasses.common.UEFI_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+
+################################################################################
+#
+# Component section - list of all components that need built for this feature.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+################################################################################
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # USB3 Debug Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
+
+ # Add components here that should be included in the package build.
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
+ #####################################
+ # USB3 Debug Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
+ Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf
+
+ # Add components here that should be included in the package build.
+
+###################################################################################################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
+###################################################################################################
+[BuildOptions]
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dsc b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dsc
new file mode 100644
index 0000000000..02627d2ed4
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dsc
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for USB3 Debug support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ PLATFORM_NAME = Usb3DebugFeaturePkg
+ PLATFORM_GUID = 3A861E9B-E2B3-4725-BD3B-93A7FB5E861E
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#
+# This package always builds the feature.
+#
+!include Include/Usb3DebugFeature.dsc
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..6f6e94a51c
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for post-memory modules that enable USB3 Debug
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..28441c0b9a
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory modules that enable USB3 Debug.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
new file mode 100644
index 0000000000..51671ce4e3
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
@@ -0,0 +1,55 @@
+## @file
+# USB3 Debug port library.
+#
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = Usb3DebugPortLibDxe
+ FILE_GUID = 08A575C4-D962-4ca5-8855-D3B4AE93A141
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = Usb3DebugPortLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE
+ CONSTRUCTOR = Usb3DebugPortLibDxeConstructor
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[Sources]
+ Usb3DebugPortLibDxe.c
+ Usb3DebugPortDataTransfer.c
+ Usb3DebugPortInitialize.c
+ MiscServices.c
+ Usb3DebugPortLibInternal.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ PcdLib
+ IoLib
+ PciLib
+ TimerLib
+ UefiBootServicesTableLib
+ UefiLib
+ HobLib
+ Usb3DebugPortParamLib
+
+[Protocols]
+ gEfiSmmAccess2ProtocolGuid ## CONSUMES
+ gEfiSmmBase2ProtocolGuid ## CONSUMES
+
+[Pcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOMETIMES_CONSUMES
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONSUMES
+
+[FeaturePcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable ## CONSUMES
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf
new file mode 100644
index 0000000000..3f38ba2649
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf
@@ -0,0 +1,63 @@
+## @file
+# USB3 Debug port library.
+#
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = Usb3DebugPortLibDxeIoMmu
+ FILE_GUID = BC48A65D-5E5E-4512-8ACC-90E79E2D80C2
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = Usb3DebugPortLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE
+ CONSTRUCTOR = Usb3DebugPortLibDxeConstructor
+ DESTRUCTOR = Usb3DebugPortLibDxeDestructor
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[Sources]
+ Usb3DebugPortLibDxeIoMmu.c
+ Usb3DebugPortDataTransfer.c
+ Usb3DebugPortInitialize.c
+ MiscServices.c
+ Usb3DebugPortLibInternal.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ PcdLib
+ IoLib
+ PciLib
+ TimerLib
+ UefiBootServicesTableLib
+ UefiLib
+ HobLib
+ Usb3DebugPortParamLib
+
+[Protocols]
+ gEfiSmmAccess2ProtocolGuid ## CONSUMES
+ gEfiSmmBase2ProtocolGuid ## CONSUMES
+ ## NOTIFY
+ ## SOMETIMES_CONSUMES
+ gEfiPciIoProtocolGuid
+ gEdkiiIoMmuProtocolGuid ## SOMETIMES_CONSUMES
+ ## NOTIFY
+ gEfiDxeSmmReadyToLockProtocolGuid
+
+[Pcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOMETIMES_CONSUMES
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONSUMES
+
+[FeaturePcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable ## CONSUMES
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
new file mode 100644
index 0000000000..a25a3ceb54
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
@@ -0,0 +1,27 @@
+## @file
+# USB3 Debug port library.
+#
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = USB3DebugPortLibNull
+ FILE_GUID = 3E895F08-0A69-42a2-AF4A-3E9EFAA40361
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = Usb3DebugPortLib
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[Sources]
+ Usb3DebugPortLibNull.c
+
+[Packages]
+ MdePkg/MdePkg.dec
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf
new file mode 100644
index 0000000000..ebea01d5a8
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf
@@ -0,0 +1,48 @@
+## @file
+# USB3 Debug port library.
+#
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = USB3DebugPortLibPei
+ FILE_GUID = 62C974F0-D0E0-4963-B93A-22FBCEB69AB4
+ MODULE_TYPE = PEIM
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = Usb3DebugPortLib|PEIM PEI_CORE
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[Sources]
+ Usb3DebugPortLibPei.c
+ Usb3DebugPortDataTransfer.c
+ Usb3DebugPortInitialize.c
+ MiscServices.c
+ Usb3DebugPortLibInternal.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ PcdLib
+ IoLib
+ PciLib
+ TimerLib
+ HobLib
+ Usb3DebugPortParamLib
+ PeiServicesTablePointerLib
+
+[Ppis]
+ gEfiPeiMemoryDiscoveredPpiGuid ## CONSUMES
+
+[Pcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOMETIMES_CONSUMES
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONSUMES
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
new file mode 100644
index 0000000000..6c3e8bc760
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
@@ -0,0 +1,51 @@
+## @file
+# USB3 Debug port library.
+#
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = USB3DebugPortLibPeiIoMmu
+ FILE_GUID = C973C5E8-A0D8-4FEE-A0F0-7DA6C3C72451
+ MODULE_TYPE = PEIM
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = Usb3DebugPortLib|PEIM PEI_CORE
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF
+#
+
+[Sources]
+ Usb3DebugPortLibPeiIoMmu.c
+ Usb3DebugPortDataTransfer.c
+ Usb3DebugPortInitialize.c
+ MiscServices.c
+ Usb3DebugPortLibInternal.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ PcdLib
+ IoLib
+ PciLib
+ TimerLib
+ HobLib
+ Usb3DebugPortParamLib
+ PeiServicesTablePointerLib
+
+[Ppis]
+ gEfiPeiMemoryDiscoveredPpiGuid ## CONSUMES
+ gEdkiiIoMmuPpiGuid ## SOMETIMES_CONSUMES
+
+[Pcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOMETIMES_CONSUMES
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONSUMES
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf
new file mode 100644
index 0000000000..e891a0c459
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.inf
@@ -0,0 +1,31 @@
+## @file
+# USB3 Debug Port Parameter library instance based on PCD.
+#
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = Usb3DebugPortParamLibPcd
+ FILE_GUID = 4990A700-4002-4d08-8E00-622720032662
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = Usb3DebugPortParamLib
+
+[Sources]
+ Usb3DebugPortParamLibPcd.c
+
+[LibraryClasses]
+ BaseLib
+ DebugLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
+
+[Pcd]
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciBus ## CONSUMES
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciDev ## CONSUMES
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciFunc ## CONSUMES
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h
new file mode 100644
index 0000000000..0bee2b63dd
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h
@@ -0,0 +1,71 @@
+/** @file
+ This library class provides common USB3 debug port functions.
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USB3_DEBUG_PORT_LIB__
+#define __USB3_DEBUG_PORT_LIB__
+
+/**
+ Initialize the USB3 debug port hardware.
+
+ If no initialization is required, then return RETURN_SUCCESS.
+ If the serial device was successfully initialized, then return RETURN_SUCCESS.
+ If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+ @retval RETURN_DEVICE_ERROR The serial device could not be initialized.
+
+**/
+RETURN_STATUS
+EFIAPI
+Usb3DebugPortInitialize (
+ VOID
+ );
+
+/**
+ Write data from buffer to USB3 debug port.
+
+ Writes NumberOfBytes data bytes from Buffer to the serial device.
+ The number of bytes actually written to the serial device is returned.
+ If the return value is less than NumberOfBytes, then the write operation failed.
+ If Buffer is NULL, then ASSERT().
+ If NumberOfBytes is zero, then return 0.
+
+ @param Buffer Pointer to the data buffer to be written.
+ @param NumberOfBytes Number of bytes to written to the serial device.
+
+ @retval 0 NumberOfBytes is 0.
+ @retval >0 The number of bytes written to the serial device.
+ If this value is less than NumberOfBytes, then the read operation failed.
+
+**/
+UINTN
+EFIAPI
+Usb3DebugPortWrite (
+ IN UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ );
+
+
+/**
+ Polls a USB3 debug port to see if there is any data waiting to be read.
+
+ Polls a serial device to see if there is any data waiting to be read.
+ If there is data waiting to be read from the serial device, then TRUE is returned.
+ If there is no data waiting to be read from the serial device, then FALSE is returned.
+
+ @retval TRUE Data is waiting to be read from the serial device.
+ @retval FALSE There is no data waiting to be read from the serial device.
+
+**/
+BOOLEAN
+EFIAPI
+Usb3DebugPortPoll (
+ VOID
+ );
+
+#endif
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortParamLib.h b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortParamLib.h
new file mode 100644
index 0000000000..167c607e9f
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3DebugPortParamLib.h
@@ -0,0 +1,56 @@
+/** @file
+ This library class provides capability to get/set usb3 debug port parameter.
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USB3_DEBUG_PORT_PARAMETER_LIB__
+#define __USB3_DEBUG_PORT_PARAMETER_LIB__
+
+typedef struct {
+ UINT8 Function;
+ UINT8 Device;
+ UINT8 Bus;
+} PCI_ADDRESS;
+
+typedef union {
+ UINT32 Controller;
+ PCI_ADDRESS PciAddress;
+} USB3_DEBUG_PORT_CONTROLLER;
+
+/**
+ Returns the USB debug port controller.
+ bit: 0~ 7: Function
+ bit: 8~15: Device
+ bit: 16~24: Bus
+
+ @return Controller information of USB debug port.
+
+**/
+UINT32
+EFIAPI
+GetUsb3DebugPortController (
+ VOID
+ );
+
+/**
+ Sets the USB debug port controller.
+ bit: 0~ 7: Function
+ bit: 8~15: Device
+ bit: 16~24: Bus
+
+ @param[in] Controller information of USB debug port value to be set.
+
+ @retval TRUE The controller of USB debug port was sucessfully set.
+ @retval FALSE The controller of USB debug port could not be set.
+
+**/
+BOOLEAN
+EFIAPI
+SetUsb3DebugPortController (
+ UINT32 Controller
+ );
+
+#endif
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h
new file mode 100644
index 0000000000..3641cc1d52
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h
@@ -0,0 +1,887 @@
+/** @file
+ This library class provides common Usb debug port functions.
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USB3_DEBUG_PORT_LIB_INTERNAL__
+#define __USB3_DEBUG_PORT_LIB_INTERNAL__
+
+#include <Uefi.h>
+#include <IndustryStandard/Usb.h>
+#include <Library/IoLib.h>
+#include <IndustryStandard/Pci.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/BaseLib.h>
+#include <Library/TimerLib.h>
+
+//
+// USB Debug GUID value
+//
+#define USB3_DBG_GUID \
+ { \
+ 0xb2a56f4d, 0x9177, 0x4fc8, { 0xa6, 0x77, 0xdd, 0x96, 0x3e, 0xb4, 0xcb, 0x1b } \
+ }
+
+//
+// Define the maximum of SMRAM ranges
+//
+#define MAX_SMRAM_RANGE 8
+
+#define XHCI_DEBUG_DEVICE_VENDOR_ID 0x8086
+#define XHCI_DEBUG_DEVICE_PRODUCT_ID 0x1234
+#define XHCI_DEBUG_DEVICE_PROTOCOL 0xFF
+#define XHCI_DEBUG_DEVICE_REVISION 0x00
+
+#define XHCI_BASE_ADDRESS_64_BIT_MASK 0xFFFFFFFFFFFF0000ULL
+#define XHCI_BASE_ADDRESS_32_BIT_MASK 0xFFFF0000
+
+#define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A
+#define XHC_HCCPARAMS_OFFSET 0x10
+#define XHC_CAPABILITY_ID_MASK 0xFF
+#define XHC_NEXT_CAPABILITY_MASK 0xFF00
+
+#define XHC_USBCMD_OFFSET 0x0 // USB Command Register Offset
+#define XHC_USBSTS_OFFSET 0x4 // USB Status Register Offset
+
+#define XHC_USBCMD_RUN BIT0 // Run/Stop
+#define XHC_USBCMD_RESET BIT1 // Host Controller Reset
+
+#define XHC_USBSTS_HALT BIT0
+
+//
+// Transfer the data of 8 bytes each time
+//
+#define XHC_DEBUG_PORT_DATA_LENGTH 8
+
+//
+// Indicate the timeout when data is transferred. 0 means infinite timeout.
+//
+#define DATA_TRANSFER_TIME_OUT 0
+
+//
+// USB debug device string descritpor (header size + unicode string length)
+//
+#define STRING0_DESC_LEN 4
+#define MANU_DESC_LEN 12
+#define PRODUCT_DESC_LEN 40
+#define SERIAL_DESC_LEN 4
+
+//
+// Debug Capability Register Offset
+//
+#define XHC_DC_DCID 0x0
+#define XHC_DC_DCDB 0x4
+#define XHC_DC_DCERSTSZ 0x8
+#define XHC_DC_DCERSTBA 0x10
+#define XHC_DC_DCERDP 0x18
+#define XHC_DC_DCCTRL 0x20
+#define XHC_DC_DCST 0x24
+#define XHC_DC_DCPORTSC 0x28
+#define XHC_DC_DCCP 0x30
+#define XHC_DC_DCDDI1 0x38
+#define XHC_DC_DCDDI2 0x3C
+
+#define TRB_TYPE_LINK 6
+
+#define ERST_NUMBER 0x01
+#define TR_RING_TRB_NUMBER 0x100
+#define EVENT_RING_TRB_NUMBER 0x200
+#define CMD_RING_TRB_NUMBER 0x100
+
+#define ED_BULK_OUT 2
+#define ED_BULK_IN 6
+
+#define XHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0xFFFFFFFF))
+#define XHC_HIGH_32BIT(Addr64) ((UINT32)(RShiftU64((UINT64)(UINTN)(Addr64), 32) & 0xFFFFFFFF))
+#define XHC_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))
+
+#define XHC_REG_BIT_IS_SET(Xhc, Offset, Bit) \
+ (XHC_BIT_IS_SET(XhcReadMmioReg ((Xhc), (Offset)), (Bit)))
+
+//
+// Endpoint Type (EP Type).
+//
+#define ED_NOT_VALID 0
+#define ED_ISOCH_OUT 1
+#define ED_BULK_OUT 2
+#define ED_INTERRUPT_OUT 3
+#define ED_CONTROL_BIDIR 4
+#define ED_ISOCH_IN 5
+#define ED_BULK_IN 6
+#define ED_INTERRUPT_IN 7
+
+//
+// 6.4.5 TRB Completion Codes
+//
+#define TRB_COMPLETION_INVALID 0
+#define TRB_COMPLETION_SUCCESS 1
+#define TRB_COMPLETION_DATA_BUFFER_ERROR 2
+#define TRB_COMPLETION_BABBLE_ERROR 3
+#define TRB_COMPLETION_USB_TRANSACTION_ERROR 4
+#define TRB_COMPLETION_TRB_ERROR 5
+#define TRB_COMPLETION_STALL_ERROR 6
+#define TRB_COMPLETION_SHORT_PACKET 13
+
+//
+// 6.4.6 TRB Types
+//
+#define TRB_TYPE_NORMAL 1
+#define TRB_TYPE_SETUP_STAGE 2
+#define TRB_TYPE_DATA_STAGE 3
+#define TRB_TYPE_STATUS_STAGE 4
+#define TRB_TYPE_ISOCH 5
+#define TRB_TYPE_LINK 6
+#define TRB_TYPE_EVENT_DATA 7
+#define TRB_TYPE_NO_OP 8
+#define TRB_TYPE_EN_SLOT 9
+#define TRB_TYPE_DIS_SLOT 10
+#define TRB_TYPE_ADDRESS_DEV 11
+#define TRB_TYPE_CON_ENDPOINT 12
+#define TRB_TYPE_EVALU_CONTXT 13
+#define TRB_TYPE_RESET_ENDPOINT 14
+#define TRB_TYPE_STOP_ENDPOINT 15
+#define TRB_TYPE_SET_TR_DEQUE 16
+#define TRB_TYPE_RESET_DEV 17
+#define TRB_TYPE_GET_PORT_BANW 21
+#define TRB_TYPE_FORCE_HEADER 22
+#define TRB_TYPE_NO_OP_COMMAND 23
+#define TRB_TYPE_TRANS_EVENT 32
+#define TRB_TYPE_COMMAND_COMPLT_EVENT 33
+#define TRB_TYPE_PORT_STATUS_CHANGE_EVENT 34
+#define TRB_TYPE_HOST_CONTROLLER_EVENT 37
+#define TRB_TYPE_DEVICE_NOTIFI_EVENT 38
+#define TRB_TYPE_MFINDEX_WRAP_EVENT 39
+
+//
+// Convert millisecond to microsecond.
+//
+#define XHC_1_MILLISECOND (1000)
+#define XHC_POLL_DELAY (1000)
+#define XHC_GENERIC_TIMEOUT (10 * 1000)
+
+#define EFI_USB_SPEED_FULL 0x0000 ///< 12 Mb/s, USB 1.1 OHCI and UHCI HC.
+#define EFI_USB_SPEED_LOW 0x0001 ///< 1 Mb/s, USB 1.1 OHCI and UHCI HC.
+#define EFI_USB_SPEED_HIGH 0x0002 ///< 480 Mb/s, USB 2.0 EHCI HC.
+#define EFI_USB_SPEED_SUPER 0x0003 ///< 4.8 Gb/s, USB 3.0 XHCI HC.
+
+//
+// Transfer types, used in URB to identify the transfer type
+//
+#define XHC_CTRL_TRANSFER 0x01
+#define XHC_BULK_TRANSFER 0x02
+#define XHC_INT_TRANSFER_SYNC 0x04
+#define XHC_INT_TRANSFER_ASYNC 0x08
+#define XHC_INT_ONLY_TRANSFER_ASYNC 0x10
+
+//
+// USB Transfer Results
+//
+#define EFI_USB_NOERROR 0x00
+#define EFI_USB_ERR_NOTEXECUTE 0x01
+#define EFI_USB_ERR_STALL 0x02
+#define EFI_USB_ERR_BUFFER 0x04
+#define EFI_USB_ERR_BABBLE 0x08
+#define EFI_USB_ERR_NAK 0x10
+#define EFI_USB_ERR_CRC 0x20
+#define EFI_USB_ERR_TIMEOUT 0x40
+#define EFI_USB_ERR_BITSTUFF 0x80
+#define EFI_USB_ERR_SYSTEM 0x100
+
+#define USB3_DEBUG_PORT_INSTANCE_SIGNATURE SIGNATURE_32('D', 'B', 'G', 'P')
+
+#pragma pack(1)
+
+//
+// 7.6.9 OUT/IN EP Context: 64 bytes
+// 7.6.9.2 When used by the DbC it is always a 64 byte data structure
+//
+typedef struct _ENDPOINT_CONTEXT_64 {
+ UINT32 EPState:3;
+ UINT32 RsvdZ1:5;
+ UINT32 Mult:2; // set to 0
+ UINT32 MaxPStreams:5; // set to 0
+ UINT32 LSA:1; // set to 0
+ UINT32 Interval:8; // set to 0
+ UINT32 RsvdZ2:8;
+
+ UINT32 RsvdZ3:1;
+ UINT32 CErr:2;
+ UINT32 EPType:3;
+ UINT32 RsvdZ4:1;
+ UINT32 HID:1; // set to 0
+ UINT32 MaxBurstSize:8;
+ UINT32 MaxPacketSize:16;
+
+ UINT32 PtrLo;
+
+ UINT32 PtrHi;
+
+ UINT32 AverageTRBLength:16;
+ UINT32 MaxESITPayload:16; // set to 0
+
+ UINT32 RsvdZ5; // Reserved
+ UINT32 RsvdZ6;
+ UINT32 RsvdZ7;
+
+ UINT32 RsvdZ8;
+ UINT32 RsvdZ9;
+ UINT32 RsvdZ10;
+ UINT32 RsvdZ11;
+
+ UINT32 RsvdZ12;
+ UINT32 RsvdZ13;
+ UINT32 RsvdZ14;
+ UINT32 RsvdZ15;
+} ENDPOINT_CONTEXT_64;
+
+//
+// 6.4.1.1 Normal TRB: 16 bytes
+// A Normal TRB is used in several ways; exclusively on Bulk and Interrupt Transfer Rings for normal and
+// Scatter/Gather operations, to define additional data buffers for Scatter/Gather operations on Isoch Transfer
+// Rings, and to define the Data stage information for Control Transfer Rings.
+//
+typedef struct _TRANSFER_TRB_NORMAL {
+ UINT32 TRBPtrLo;
+
+ UINT32 TRBPtrHi;
+
+ UINT32 Length:17;
+ UINT32 TDSize:5;
+ UINT32 IntTarget:10;
+
+ UINT32 CycleBit:1;
+ UINT32 ENT:1;
+ UINT32 ISP:1;
+ UINT32 NS:1;
+ UINT32 CH:1;
+ UINT32 IOC:1;
+ UINT32 IDT:1;
+ UINT32 RsvdZ1:2;
+ UINT32 BEI:1;
+ UINT32 Type:6;
+ UINT32 RsvdZ2:16;
+} TRANSFER_TRB_NORMAL;
+
+//
+// 6.4.2.1 Transfer Event TRB: 16 bytes
+// A Transfer Event provides the completion status associated with a Transfer TRB. Refer to section 4.11.3.1
+// for more information on the use and operation of Transfer Events.
+//
+typedef struct _EVT_TRB_TRANSFER {
+ UINT32 TRBPtrLo;
+
+ UINT32 TRBPtrHi;
+
+ UINT32 Length:24;
+ UINT32 Completecode:8;
+
+ UINT32 CycleBit:1;
+ UINT32 RsvdZ1:1;
+ UINT32 ED:1;
+ UINT32 RsvdZ2:7;
+ UINT32 Type:6;
+ UINT32 EndpointId:5;
+ UINT32 RsvdZ3:3;
+ UINT32 SlotId:8;
+} EVT_TRB_TRANSFER;
+
+//
+// 6.4.4.1 Link TRB: 16 bytes
+// A Link TRB provides support for non-contiguous TRB Rings.
+//
+typedef struct _LINK_TRB {
+ UINT32 PtrLo;
+
+ UINT32 PtrHi;
+
+ UINT32 RsvdZ1:22;
+ UINT32 InterTarget:10;
+
+ UINT32 CycleBit:1;
+ UINT32 TC:1;
+ UINT32 RsvdZ2:2;
+ UINT32 CH:1;
+ UINT32 IOC:1;
+ UINT32 RsvdZ3:4;
+ UINT32 Type:6;
+ UINT32 RsvdZ4:16;
+} LINK_TRB;
+
+//
+// TRB Template: 16 bytes
+//
+typedef struct _TRB_TEMPLATE {
+ UINT32 Parameter1;
+
+ UINT32 Parameter2;
+
+ UINT32 Status;
+
+ UINT32 CycleBit:1;
+ UINT32 RsvdZ1:9;
+ UINT32 Type:6;
+ UINT32 Control:16;
+} TRB_TEMPLATE;
+
+//
+// Refer to XHCI 6.5 Event Ring Segment Table: 16 bytes
+//
+typedef struct _EVENT_RING_SEG_TABLE_ENTRY {
+ UINT32 PtrLo;
+ UINT32 PtrHi;
+ UINT32 RingTrbSize:16;
+ UINT32 RsvdZ1:16;
+ UINT32 RsvdZ2;
+} EVENT_RING_SEG_TABLE_ENTRY;
+
+//
+// Size: 40 bytes
+//
+typedef struct _EVENT_RING {
+ EFI_PHYSICAL_ADDRESS ERSTBase;
+ EFI_PHYSICAL_ADDRESS EventRingSeg0;
+ UINT32 TrbNumber;
+ EFI_PHYSICAL_ADDRESS EventRingEnqueue;
+ EFI_PHYSICAL_ADDRESS EventRingDequeue;
+ UINT32 EventRingCCS;
+} EVENT_RING;
+
+// Size: 32 bytes
+typedef struct _TRANSFER_RING {
+ EFI_PHYSICAL_ADDRESS RingSeg0;
+ UINT32 TrbNumber;
+ EFI_PHYSICAL_ADDRESS RingEnqueue;
+ EFI_PHYSICAL_ADDRESS RingDequeue;
+ UINT32 RingPCS;
+} TRANSFER_RING;
+
+//
+// Size: 64 bytes
+//
+typedef struct _DBC_INFO_CONTEXT {
+ UINT64 String0DescAddress;
+ UINT64 ManufacturerStrDescAddress;
+ UINT64 ProductStrDescAddress;
+ UINT64 SerialNumberStrDescAddress;
+ UINT64 String0Length:8;
+ UINT64 ManufacturerStrLength:8;
+ UINT64 ProductStrLength:8;
+ UINT64 SerialNumberStrLength:8;
+ UINT64 RsvdZ1:32;
+ UINT64 RsvdZ2;
+ UINT64 RsvdZ3;
+ UINT64 RsvdZ4;
+} DBC_INFO_CONTEXT;
+
+//
+// Debug Capability Context Data Structure: 192 bytes
+//
+typedef struct _XHC_DC_CONTEXT {
+ DBC_INFO_CONTEXT DbcInfoContext;
+ ENDPOINT_CONTEXT_64 EpOutContext;
+ ENDPOINT_CONTEXT_64 EpInContext;
+} XHC_DC_CONTEXT;
+
+//
+// Size: 16 bytes
+//
+typedef union _TRB {
+ TRB_TEMPLATE TrbTemplate;
+ TRANSFER_TRB_NORMAL TrbNormal;
+} TRB;
+
+///
+/// USB data transfer direction
+///
+typedef enum {
+ EfiUsbDataIn,
+ EfiUsbDataOut,
+ EfiUsbNoData
+} EFI_USB_DATA_DIRECTION;
+
+//
+// URB (Usb Request Block) contains information for all kinds of
+// usb requests.
+//
+typedef struct _URB {
+ UINT32 Signature;
+ //
+ // Transfer data
+ //
+ EFI_PHYSICAL_ADDRESS Data;
+ UINT32 DataLen;
+ //
+ // Execute result
+ //
+ UINT32 Result;
+ //
+ // Completed data length
+ //
+ UINT32 Completed;
+ //
+ // Tranfer Ring info
+ //
+ EFI_PHYSICAL_ADDRESS Ring;
+ EFI_PHYSICAL_ADDRESS TrbStart;
+ EFI_PHYSICAL_ADDRESS TrbEnd;
+ UINT32 TrbNum;
+ BOOLEAN StartDone;
+ BOOLEAN EndDone;
+ BOOLEAN Finished;
+ EFI_USB_DATA_DIRECTION Direction;
+} URB;
+
+//
+// Size: 90 bytes
+//
+typedef struct _USB3_DEBUG_PORT_INSTANCE {
+ UINT32 Signature;
+
+ UINT8 PciBusNumber;
+ UINT8 PciDeviceNumber;
+ UINT8 PciFunctionNumber;
+
+ //
+ // The flag indicates debug capability is supported
+ //
+ BOOLEAN DebugSupport;
+
+ //
+ // The flag indicates debug device is ready
+ //
+ BOOLEAN Ready;
+
+ //
+ // The flag indicates the instance is from HOB
+ //
+ BOOLEAN FromHob;
+
+ //
+ // PciIo protocol event
+ //
+ EFI_PHYSICAL_ADDRESS PciIoEvent;
+
+ //
+ // XHCI MMIO Base address
+ //
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+
+ //
+ // XHCI OP RegisterBase address
+ //
+ EFI_PHYSICAL_ADDRESS XhciOpRegister;
+
+ //
+ // XHCI Debug Register Base Address
+ //
+ EFI_PHYSICAL_ADDRESS DebugCapabilityBase;
+
+ //
+ // XHCI Debug Capability offset
+ //
+ UINT64 DebugCapabilityOffset;
+
+ //
+ // XHCI Debug Context Address
+ //
+ EFI_PHYSICAL_ADDRESS DebugCapabilityContext;
+
+ //
+ // Transfer Ring
+ //
+ TRANSFER_RING TransferRingOut;
+ TRANSFER_RING TransferRingIn;
+
+ //
+ // EventRing
+ //
+ EVENT_RING EventRing;
+
+ //
+ // URB
+ //
+ URB Urb;
+} USB3_DEBUG_PORT_INSTANCE;
+
+#pragma pack()
+
+/**
+ Clear one bit of the debug register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcClearDebugRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ );
+
+/**
+ Clear one bit of the MMIO register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the MMIO register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcClearMmioRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ );
+
+/**
+ Read XHCI debug register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+
+ @return The register content read
+
+**/
+UINT32
+XhcReadDebugReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset
+ );
+
+/**
+ Read XHCI MMIO register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the MMIO register.
+
+ @return The register content read
+
+**/
+UINT32
+XhcReadMmioReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset
+ );
+
+/**
+ Set one bit of the debug register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcSetDebugRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ );
+
+/**
+ Set one bit of the MMIO register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the MMIO register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcSetMmioRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ );
+
+/**
+ Wait the MMIO register's bit as specified by Bit
+ to be set (or clear).
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the MMIO register.
+ @param Bit The bit of the register to wait for.
+ @param WaitToSet Wait the bit to set or clear.
+ @param Timeout The time to wait before abort (in millisecond, ms).
+
+ @retval EFI_SUCCESS The bit successfully changed by host controller.
+ @retval EFI_TIMEOUT The time out occurred.
+
+**/
+EFI_STATUS
+XhcWaitMmioRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit,
+ IN BOOLEAN WaitToSet,
+ IN UINT32 Timeout
+ );
+
+/**
+ Write the data to the debug register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+ @param Data The data to write.
+
+**/
+VOID
+XhcWriteDebugReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Data
+ );
+
+/**
+ Write the data to the MMIO register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the MMIO register.
+ @param Data The data to write.
+
+**/
+VOID
+XhcWriteMmioReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Data
+ );
+
+/**
+ Discover the USB3 debug device.
+
+ @param[in] Instance Pointer to USB3 debug port object instance.
+
+ @retval RETURN_SUCCESS The USB3 debug device was found.
+ @retval RETURN_DEVICE_ERROR The USB3 debug device was not found.
+
+**/
+RETURN_STATUS
+DiscoverUsb3DebugPort(
+ IN USB3_DEBUG_PORT_INSTANCE *Instance
+ );
+
+/**
+ Initialize the USB3 debug Device hardware.
+
+ @param[in] Instance Pointer to USB3 debug port object instance.
+
+ @retval RETURN_SUCCESS The USB3 debug device was initialized successfully.
+ @retval !RETURN_SUCCESS Error.
+
+**/
+RETURN_STATUS
+InitializeUsb3DebugPort (
+ IN USB3_DEBUG_PORT_INSTANCE *Instance
+ );
+
+/**
+ Return XHCI MMIO base address.
+
+**/
+EFI_PHYSICAL_ADDRESS
+GetXhciBaseAddress (
+ VOID
+ );
+
+/**
+ Return XHCI debug instance address.
+
+**/
+USB3_DEBUG_PORT_INSTANCE *
+GetUsb3DebugPortInstance (
+ VOID
+ );
+
+/**
+ Send data over the USB3 debug cable.
+
+ @param[out] Data Pointer to data
+ @param[in, out] Length Pointer to data length
+
+**/
+VOID
+Usb3DbgOut (
+ OUT UINT8 *Data,
+ IN OUT UINTN *Length
+ );
+
+/**
+ Receive data over the USB3 debug cable.
+
+ @param[out] Data Pointer to data
+ @param[in, out] Length Pointer to data length
+
+**/
+RETURN_STATUS
+Usb3DbgIn (
+ OUT UINT8 *Data,
+ IN OUT UINTN *Length
+ );
+
+/**
+ Verifies if the bit positions specified by a mask are set in a register.
+
+ @param[in, out] Register UNITN register
+ @param[in] BitMask 32-bit mask
+
+ @return BOOLEAN - TRUE if all bits specified by the mask are enabled.
+ - FALSE even if one of the bits specified by the mask
+ is not enabled.
+**/
+BOOLEAN
+XhcIsBitSet(
+ UINTN Register,
+ UINT32 BitMask
+ );
+
+/**
+ Sets bits as per the enabled bit positions in the mask.
+
+ @param[in, out] Register UINTN register
+ @param[in] BitMask 32-bit mask
+**/
+VOID
+XhcSetR32Bit(
+ UINTN Register,
+ UINT32 BitMask
+ );
+
+/**
+ Clears bits as per the enabled bit positions in the mask.
+
+ @param[in, out] Register UINTN register
+ @param[in] BitMask 32-bit mask
+**/
+VOID
+XhcClrR32Bit(
+ UINTN Register,
+ UINT32 BitMask
+ );
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3Initialize (
+ VOID
+ );
+
+/**
+ Return command register value in XHCI controller.
+
+**/
+UINT16
+GetXhciPciCommand (
+ VOID
+ );
+
+/**
+ Allocate aligned memory for XHC's usage.
+
+ @param BufferSize The size, in bytes, of the Buffer.
+
+ @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID*
+AllocateAlignBuffer (
+ IN UINTN BufferSize
+ );
+
+/**
+ Check whether AllocatePages in permanent memory is ready.
+
+ @retval TRUE AllocatePages in permanent memory is ready.
+ @retval FALSE AllocatePages in permanent memory is not ready.
+
+**/
+BOOLEAN
+IsAllocatePagesReady (
+ VOID
+ );
+
+/**
+ The real function to initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3InitializeReal (
+ VOID
+ );
+
+/**
+ Update XHC hardware address when MMIO base is changed.
+
+ @param Instance The XHCI Instance.
+ @param XhcMmioBase XHCI MMIO base address.
+
+**/
+VOID
+FixUsb3InstanceResource (
+ IN OUT USB3_DEBUG_PORT_INSTANCE *Instance,
+ IN EFI_PHYSICAL_ADDRESS XhcMmioBase
+ );
+
+/**
+ Save USB3 instance address.
+
+ @param[in] Instance The XHCI Instance.
+
+**/
+VOID
+SaveUsb3InstanceAddress (
+ IN USB3_DEBUG_PORT_INSTANCE *Instance
+ );
+
+/**
+ Submits bulk transfer to a bulk endpoint of a USB device.
+
+ @param Xhc The instance of debug device.
+ @param Direction The direction of data transfer.
+ @param Data Array of pointers to the buffers of data to transmit
+ from or receive into.
+ @param DataLength The lenght of the data buffer.
+ @param Timeout Indicates the maximum time, in millisecond, which
+ the transfer is allowed to complete.
+ @param TransferResult Transfer result.
+
+ @retval EFI_SUCCESS The transfer was completed successfully.
+ @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.
+ @retval EFI_TIMEOUT The transfer failed due to timeout.
+ @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.
+
+**/
+EFI_STATUS
+EFIAPI
+XhcDataTransfer (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN EFI_USB_DATA_DIRECTION Direction,
+ IN OUT VOID *Data,
+ IN OUT UINTN *DataLength,
+ IN UINTN Timeout,
+ OUT UINT32 *TransferResult
+ );
+
+#endif //__SERIAL_PORT_LIB_USB__
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c
new file mode 100644
index 0000000000..cb29a880e6
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c
@@ -0,0 +1,385 @@
+/** @file
+ Miscellaneous services internal to USB debug port implementation.
+
+ Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "Usb3DebugPortLibInternal.h"
+
+/**
+ Verifies if the bit positions specified by a mask are set in a register.
+
+ @param[in, out] Register UNITN register
+ @param[in] BitMask 32-bit mask
+
+ @return BOOLEAN - TRUE if all bits specified by the mask are enabled.
+ - FALSE even if one of the bits specified by the mask
+ is not enabled.
+**/
+BOOLEAN
+XhcIsBitSet(
+ IN OUT UINTN Register,
+ IN UINT32 BitMask
+ )
+{
+ if ((MmioRead32 (Register) & (BitMask)) != 0) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+ Sets bits as per the enabled bit positions in the mask.
+
+ @param[in, out] Register UINTN register
+ @param[in] BitMask 32-bit mask
+**/
+VOID
+XhcSetR32Bit(
+ IN OUT UINTN Register,
+ IN UINT32 BitMask
+ )
+{
+ UINT32 RegisterValue;
+
+ RegisterValue = MmioRead32 (Register);
+ RegisterValue |= (UINT32)(BitMask);
+ MmioWrite32 (Register, RegisterValue);
+}
+
+/**
+ Clears bits as per the enabled bit positions in the mask.
+
+ @param[in, out] Register UINTN register
+ @param[in] BitMask 32-bit mask
+**/
+VOID
+XhcClrR32Bit(
+ IN OUT UINTN Register,
+ IN UINT32 BitMask
+ )
+{
+ UINT32 RegisterValue;
+
+ RegisterValue = MmioRead32 (Register);
+ RegisterValue &= (UINT32)(~(BitMask));
+ MmioWrite32 (Register, RegisterValue);
+}
+
+/**
+ Initialize the USB debug port hardware.
+
+ If no initialization is required, then return RETURN_SUCCESS.
+ If the serial device was successfully initialized, then return RETURN_SUCCESS.
+ If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+ @retval RETURN_DEVICE_ERROR The serial device could not be initialized.
+**/
+RETURN_STATUS
+EFIAPI
+Usb3DebugPortInitialize (
+ VOID
+ )
+{
+ USB3Initialize ();
+ return RETURN_SUCCESS;
+}
+
+/**
+ Write data from buffer to USB debug port.
+
+ Writes NumberOfBytes data bytes from Buffer to the serial device.
+ The number of bytes actually written to the serial device is returned.
+ If the return value is less than NumberOfBytes, then the write operation failed.
+ If Buffer is NULL, then ASSERT().
+ If NumberOfBytes is zero, then return 0.
+
+ @param Buffer Pointer to the data buffer to be written.
+ @param NumberOfBytes Number of bytes to written to the serial device.
+
+ @retval 0 NumberOfBytes is 0.
+ @retval >0 The number of bytes written to the serial device.
+ If this value is less than NumberOfBytes, then the read operation failed.
+**/
+UINTN
+EFIAPI
+Usb3DebugPortWrite (
+ IN UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
+{
+ Usb3DbgOut (Buffer, &NumberOfBytes);
+ return NumberOfBytes;
+}
+
+/**
+ Read data from USB debug port and save the datas in buffer.
+
+ Reads NumberOfBytes data bytes from a serial device into the buffer
+ specified by Buffer. The number of bytes actually read is returned.
+ If the return value is less than NumberOfBytes, then the rest operation failed.
+ If Buffer is NULL, then ASSERT().
+ If NumberOfBytes is zero, then return 0.
+
+ @param Buffer Pointer to the data buffer to store the data read from the serial device.
+ @param NumberOfBytes Number of bytes which will be read.
+
+ @retval 0 Read data failed, no data is to be read.
+ @retval >0 Actual number of bytes read from serial device.
+**/
+UINTN
+EFIAPI
+Usb3DebugPortRead (
+ OUT UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
+{
+ Usb3DbgIn (Buffer, &NumberOfBytes);
+ return NumberOfBytes;
+}
+
+/**
+ Polls a USB debug port to see if there is any data waiting to be read.
+
+ Polls a serial device to see if there is any data waiting to be read.
+ If there is data waiting to be read from the serial device, then TRUE is returned.
+ If there is no data waiting to be read from the serial device, then FALSE is returned.
+
+ @retval TRUE Data is waiting to be read from the serial device.
+ @retval FALSE There is no data waiting to be read from the serial device.
+**/
+BOOLEAN
+EFIAPI
+Usb3DebugPortPoll (
+ VOID
+ )
+{
+ return FALSE;
+}
+
+/**
+ Write the data to the XHCI debug register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the runtime register.
+ @param Data The data to write.
+
+**/
+VOID
+XhcWriteDebugReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Data
+ )
+{
+ EFI_PHYSICAL_ADDRESS DebugCapabilityBase;
+
+ DebugCapabilityBase = Xhc->DebugCapabilityBase;
+
+ MmioWrite32 ((UINTN)(DebugCapabilityBase + Offset), Data);
+
+ return;
+}
+
+/**
+ Read XHCI debug register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+
+ @return The register content read
+
+**/
+UINT32
+XhcReadDebugReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset
+ )
+{
+ UINT32 Data;
+ EFI_PHYSICAL_ADDRESS DebugCapabilityBase;
+
+ DebugCapabilityBase = Xhc->DebugCapabilityBase;
+
+ Data = MmioRead32 ((UINTN)(DebugCapabilityBase + Offset));
+
+ return Data;
+}
+
+/**
+ Set one bit of the debug register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcSetDebugRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ )
+{
+ UINT32 Data;
+
+ Data = XhcReadDebugReg (Xhc, Offset);
+ Data |= Bit;
+ XhcWriteDebugReg (Xhc, Offset, Data);
+}
+
+/**
+ Clear one bit of the debug register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the debug register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcClearDebugRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ )
+{
+ UINT32 Data;
+
+ Data = XhcReadDebugReg (Xhc, Offset);
+ Data &= ~Bit;
+ XhcWriteDebugReg (Xhc, Offset, Data);
+}
+
+/**
+ Write the data to the XHCI MMIO register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the runtime register.
+ @param Data The data to write.
+
+**/
+VOID
+XhcWriteMmioReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Data
+ )
+{
+ EFI_PHYSICAL_ADDRESS MmioBase;
+
+ MmioBase = Xhc->XhcMmioBase;
+ MmioWrite32 ((UINTN)(MmioBase + Offset), Data);
+
+ return;
+}
+
+/**
+ Read XHCI MMIO register.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the runtime register.
+
+ @return The register content read
+
+**/
+UINT32
+XhcReadMmioReg (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset
+ )
+{
+ UINT32 Data;
+ EFI_PHYSICAL_ADDRESS MmioBase;
+
+ MmioBase = Xhc->XhcMmioBase;
+
+ Data = MmioRead32 ((UINTN)(MmioBase + Offset));
+
+ return Data;
+}
+
+/**
+ Set one bit of the operational register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the runtime register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcSetMmioRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ )
+{
+ UINT32 Data;
+
+ Data = XhcReadMmioReg (Xhc, Offset);
+ Data |= Bit;
+ XhcWriteMmioReg (Xhc, Offset, Data);
+}
+
+/**
+ Clear one bit of the operational register while keeping other bits.
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the runtime register.
+ @param Bit The bit mask of the register to set.
+
+**/
+VOID
+XhcClearMmioRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit
+ )
+{
+ UINT32 Data;
+
+ Data = XhcReadMmioReg (Xhc, Offset);
+ Data &= ~Bit;
+ XhcWriteMmioReg (Xhc, Offset, Data);
+}
+
+/**
+ Wait the operation register's bit as specified by Bit
+ to be set (or clear).
+
+ @param Xhc The XHCI Instance.
+ @param Offset The offset of the operational register.
+ @param Bit The bit of the register to wait for.
+ @param WaitToSet Wait the bit to set or clear.
+ @param Timeout The time to wait before abort (in millisecond, ms).
+
+ @retval EFI_SUCCESS The bit successfully changed by host controller.
+ @retval EFI_TIMEOUT The time out occurred.
+
+**/
+EFI_STATUS
+XhcWaitMmioRegBit (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 Offset,
+ IN UINT32 Bit,
+ IN BOOLEAN WaitToSet,
+ IN UINT32 Timeout
+ )
+{
+ UINT32 Index;
+ UINTN Loop;
+
+ Loop = (Timeout * XHC_1_MILLISECOND / XHC_POLL_DELAY) + 1;
+
+ for (Index = 0; Index < Loop; Index++) {
+ if (XHC_REG_BIT_IS_SET (Xhc, Offset, Bit) == WaitToSet) {
+ return EFI_SUCCESS;
+ }
+
+ MicroSecondDelay (XHC_POLL_DELAY);
+ }
+
+ return EFI_TIMEOUT;
+}
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c
new file mode 100644
index 0000000000..c4a7fd3a06
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c
@@ -0,0 +1,892 @@
+/** @file
+ Usb3 Debug Port library instance
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <PiPei.h>
+#include <Library/SerialPortLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PciLib.h>
+#include <Library/PcdLib.h>
+#include <Library/TimerLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+#include "Usb3DebugPortLibInternal.h"
+
+EFI_SMRAM_DESCRIPTOR mSmramCheckRanges[MAX_SMRAM_RANGE];
+UINTN mSmramCheckRangeCount = 0;
+BOOLEAN mUsb3InSmm = FALSE;
+UINT64 mUsb3MmioSize = 0;
+
+/**
+ Synchronize the specified transfer ring to update the enqueue and dequeue pointer.
+
+ @param Xhc The XHCI Instance.
+ @param TrsRing The transfer ring to sync.
+
+ @retval EFI_SUCCESS The transfer ring is synchronized successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+XhcSyncTrsRing (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN TRANSFER_RING *TrsRing
+ )
+{
+ UINTN Index;
+ TRB_TEMPLATE *TrsTrb;
+
+ ASSERT (TrsRing != NULL);
+
+ //
+ // Calculate the latest RingEnqueue and RingPCS
+ //
+ TrsTrb = (TRB_TEMPLATE *)(UINTN) TrsRing->RingEnqueue;
+
+ ASSERT (TrsTrb != NULL);
+
+ for (Index = 0; Index < TrsRing->TrbNumber; Index++) {
+ if (TrsTrb->CycleBit != (TrsRing->RingPCS & BIT0)) {
+ break;
+ }
+ TrsTrb++;
+ if ((UINT8) TrsTrb->Type == TRB_TYPE_LINK) {
+ ASSERT (((LINK_TRB*)TrsTrb)->TC != 0);
+ //
+ // set cycle bit in Link TRB as normal
+ //
+ ((LINK_TRB*)TrsTrb)->CycleBit = TrsRing->RingPCS & BIT0;
+ //
+ // Toggle PCS maintained by software
+ //
+ TrsRing->RingPCS = (TrsRing->RingPCS & BIT0) ? 0 : 1;
+ TrsTrb = (TRB_TEMPLATE *)(UINTN)((TrsTrb->Parameter1 | LShiftU64 ((UINT64)TrsTrb->Parameter2, 32)) & ~0x0F);
+ }
+ }
+ ASSERT (Index != TrsRing->TrbNumber);
+
+ if ((EFI_PHYSICAL_ADDRESS)(UINTN) TrsTrb != TrsRing->RingEnqueue) {
+ TrsRing->RingEnqueue = (EFI_PHYSICAL_ADDRESS)(UINTN) TrsTrb;
+ }
+
+ //
+ // Clear the Trb context for enqueue, but reserve the PCS bit
+ //
+ TrsTrb->Parameter1 = 0;
+ TrsTrb->Parameter2 = 0;
+ TrsTrb->Status = 0;
+ TrsTrb->RsvdZ1 = 0;
+ TrsTrb->Type = 0;
+ TrsTrb->Control = 0;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Synchronize the specified event ring to update the enqueue and dequeue pointer.
+
+ @param Xhc The XHCI Instance.
+ @param EvtRing The event ring to sync.
+
+ @retval EFI_SUCCESS The event ring is synchronized successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+XhcSyncEventRing (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN EVENT_RING *EvtRing
+ )
+{
+ UINTN Index;
+ TRB_TEMPLATE *EvtTrb1;
+
+ ASSERT (EvtRing != NULL);
+
+ //
+ // Calculate the EventRingEnqueue and EventRingCCS.
+ // Note: only support single Segment
+ //
+ EvtTrb1 = (TRB_TEMPLATE *)(UINTN) EvtRing->EventRingDequeue;
+
+ for (Index = 0; Index < EvtRing->TrbNumber; Index++) {
+ if (EvtTrb1->CycleBit != EvtRing->EventRingCCS) {
+ break;
+ }
+
+ EvtTrb1++;
+
+ if ((UINTN)EvtTrb1 >= ((UINTN) EvtRing->EventRingSeg0 + sizeof (TRB_TEMPLATE) * EvtRing->TrbNumber)) {
+ EvtTrb1 = (TRB_TEMPLATE *)(UINTN) EvtRing->EventRingSeg0;
+ EvtRing->EventRingCCS = (EvtRing->EventRingCCS) ? 0 : 1;
+ }
+ }
+
+ if (Index < EvtRing->TrbNumber) {
+ EvtRing->EventRingEnqueue = (EFI_PHYSICAL_ADDRESS)(UINTN)EvtTrb1;
+ } else {
+ ASSERT (FALSE);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Check if there is a new generated event.
+
+ @param Xhc The XHCI Instance.
+ @param EvtRing The event ring to check.
+ @param NewEvtTrb The new event TRB found.
+
+ @retval EFI_SUCCESS Found a new event TRB at the event ring.
+ @retval EFI_NOT_READY The event ring has no new event.
+
+**/
+EFI_STATUS
+EFIAPI
+XhcCheckNewEvent (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN EVENT_RING *EvtRing,
+ OUT TRB_TEMPLATE **NewEvtTrb
+ )
+{
+ EFI_STATUS Status;
+
+ ASSERT (EvtRing != NULL);
+
+ *NewEvtTrb = (TRB_TEMPLATE *)(UINTN) EvtRing->EventRingDequeue;
+
+ if (EvtRing->EventRingDequeue == EvtRing->EventRingEnqueue) {
+ return EFI_NOT_READY;
+ }
+
+ Status = EFI_SUCCESS;
+
+ EvtRing->EventRingDequeue += sizeof (TRB_TEMPLATE);
+ //
+ // If the dequeue pointer is beyond the ring, then roll-back it to the begining of the ring.
+ //
+ if ((UINTN)EvtRing->EventRingDequeue >= ((UINTN) EvtRing->EventRingSeg0 + sizeof (TRB_TEMPLATE) * EvtRing->TrbNumber)) {
+ EvtRing->EventRingDequeue = EvtRing->EventRingSeg0;
+ }
+
+ return Status;
+}
+
+/**
+ Check if the Trb is a transaction of the URB.
+
+ @param Trb The TRB to be checked
+ @param Urb The transfer ring to be checked.
+
+ @retval TRUE It is a transaction of the URB.
+ @retval FALSE It is not any transaction of the URB.
+
+**/
+BOOLEAN
+IsTransferRingTrb (
+ IN TRB_TEMPLATE *Trb,
+ IN URB *Urb
+ )
+{
+ TRB_TEMPLATE *CheckedTrb;
+ TRANSFER_RING *Ring;
+ UINTN Index;
+
+ Ring = (TRANSFER_RING *)(UINTN) Urb->Ring;
+ CheckedTrb = (TRB_TEMPLATE *)(UINTN) Ring->RingSeg0;
+
+ ASSERT (Ring->TrbNumber == CMD_RING_TRB_NUMBER || Ring->TrbNumber == TR_RING_TRB_NUMBER);
+
+ for (Index = 0; Index < Ring->TrbNumber; Index++) {
+ if (Trb == CheckedTrb) {
+ return TRUE;
+ }
+ CheckedTrb++;
+ }
+
+ return FALSE;
+}
+
+/**
+ Check the URB's execution result and update the URB's
+ result accordingly.
+
+ @param Xhc The XHCI Instance.
+ @param Urb The URB to check result.
+
+ @return Whether the result of URB transfer is finialized.
+
+**/
+EFI_STATUS
+XhcCheckUrbResult (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN URB *Urb
+ )
+{
+ EVT_TRB_TRANSFER *EvtTrb;
+ TRB_TEMPLATE *TRBPtr;
+ UINTN Index;
+ UINT8 TRBType;
+ EFI_STATUS Status;
+ URB *CheckedUrb;
+ UINT64 XhcDequeue;
+ UINT32 High;
+ UINT32 Low;
+
+ ASSERT ((Xhc != NULL) && (Urb != NULL));
+
+ Status = EFI_SUCCESS;
+
+ if (Urb->Finished) {
+ goto EXIT;
+ }
+
+ EvtTrb = NULL;
+
+ //
+ // Traverse the event ring to find out all new events from the previous check.
+ //
+ XhcSyncEventRing (Xhc, &Xhc->EventRing);
+
+ for (Index = 0; Index < Xhc->EventRing.TrbNumber; Index++) {
+ Status = XhcCheckNewEvent (Xhc, &Xhc->EventRing, ((TRB_TEMPLATE **)&EvtTrb));
+ if (Status == EFI_NOT_READY) {
+ //
+ // All new events are handled, return directly.
+ //
+ goto EXIT;
+ }
+ //
+ // Only handle COMMAND_COMPLETETION_EVENT and TRANSFER_EVENT.
+ //
+ if ((EvtTrb->Type != TRB_TYPE_COMMAND_COMPLT_EVENT) && (EvtTrb->Type != TRB_TYPE_TRANS_EVENT)) {
+ continue;
+ }
+
+ TRBPtr = (TRB_TEMPLATE *)(UINTN)(EvtTrb->TRBPtrLo | LShiftU64 ((UINT64) EvtTrb->TRBPtrHi, 32));
+
+ //
+ // Update the status of Urb according to the finished event regardless of whether
+ // the urb is current checked one or in the XHCI's async transfer list.
+ // This way is used to avoid that those completed async transfer events don't get
+ // handled in time and are flushed by newer coming events.
+ //
+ if (IsTransferRingTrb (TRBPtr, Urb)) {
+ CheckedUrb = Urb;
+ } else {
+ continue;
+ }
+ switch (EvtTrb->Completecode) {
+ case TRB_COMPLETION_STALL_ERROR:
+ CheckedUrb->Result |= EFI_USB_ERR_STALL;
+ CheckedUrb->Finished = TRUE;
+ break;
+
+ case TRB_COMPLETION_BABBLE_ERROR:
+ CheckedUrb->Result |= EFI_USB_ERR_BABBLE;
+ CheckedUrb->Finished = TRUE;
+ break;
+
+ case TRB_COMPLETION_DATA_BUFFER_ERROR:
+ CheckedUrb->Result |= EFI_USB_ERR_BUFFER;
+ CheckedUrb->Finished = TRUE;
+ break;
+
+ case TRB_COMPLETION_USB_TRANSACTION_ERROR:
+ CheckedUrb->Result |= EFI_USB_ERR_TIMEOUT;
+ CheckedUrb->Finished = TRUE;
+ break;
+
+ case TRB_COMPLETION_SHORT_PACKET:
+ case TRB_COMPLETION_SUCCESS:
+ if (EvtTrb->Completecode == TRB_COMPLETION_SHORT_PACKET) {
+ }
+
+ TRBType = (UINT8) (TRBPtr->Type);
+ if ((TRBType == TRB_TYPE_DATA_STAGE) ||
+ (TRBType == TRB_TYPE_NORMAL) ||
+ (TRBType == TRB_TYPE_ISOCH)) {
+ CheckedUrb->Completed += (CheckedUrb->DataLen - EvtTrb->Length);
+ }
+
+ break;
+
+ default:
+ CheckedUrb->Result |= EFI_USB_ERR_TIMEOUT;
+ CheckedUrb->Finished = TRUE;
+ break;
+ }
+
+ //
+ // Only check first and end Trb event address
+ //
+
+ if ((EFI_PHYSICAL_ADDRESS)(UINTN) TRBPtr == CheckedUrb->TrbStart) {
+ CheckedUrb->StartDone = TRUE;
+ }
+
+ if ((EFI_PHYSICAL_ADDRESS)(UINTN) TRBPtr == CheckedUrb->TrbEnd) {
+ CheckedUrb->EndDone = TRUE;
+ }
+
+ if (CheckedUrb->StartDone && CheckedUrb->EndDone) {
+ CheckedUrb->Finished = TRUE;
+ }
+
+ }
+
+EXIT:
+ //
+ // Advance event ring to last available entry
+ //
+ // Some 3rd party XHCI external cards don't support single 64-bytes width register access,
+ // So divide it to two 32-bytes width register access.
+ //
+ Low = XhcReadDebugReg (Xhc, XHC_DC_DCERDP);
+ High = XhcReadDebugReg (Xhc, XHC_DC_DCERDP + 4);
+ XhcDequeue = (UINT64)(LShiftU64((UINT64)High, 32) | Low);
+
+ if ((XhcDequeue & (~0x0F)) != ((UINT64)(UINTN)Xhc->EventRing.EventRingDequeue & (~0x0F))) {
+ //
+ // Some 3rd party XHCI external cards don't support single 64-bytes width register access,
+ // So divide it to two 32-bytes width register access.
+ //
+ XhcWriteDebugReg (Xhc, XHC_DC_DCERDP, XHC_LOW_32BIT (Xhc->EventRing.EventRingDequeue));
+ XhcWriteDebugReg (Xhc, XHC_DC_DCERDP + 4, XHC_HIGH_32BIT (Xhc->EventRing.EventRingDequeue));
+ }
+
+ return Status;
+}
+
+/**
+ Ring the door bell to notify XHCI there is a transaction to be executed.
+
+ @param Xhc The XHCI Instance.
+ @param Urb The pointer to URB.
+
+ @retval EFI_SUCCESS Successfully ring the door bell.
+
+**/
+EFI_STATUS
+EFIAPI
+XhcRingDoorBell (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN URB *Urb
+ )
+{
+ UINT32 Dcdb;
+
+ //
+ // 7.6.8.2 DCDB Register
+ //
+ if (Urb->Direction == EfiUsbDataIn) {
+ Dcdb = 0x100;
+ } else {
+ Dcdb = 0x0;
+ }
+
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCDB,
+ Dcdb
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Execute the transfer by polling the URB. This is a synchronous operation.
+
+ @param Xhc The XHCI Instance.
+ @param Urb The URB to execute.
+ @param Timeout The time to wait before abort, in millisecond.
+
+ @return EFI_DEVICE_ERROR The transfer failed due to transfer error.
+ @return EFI_TIMEOUT The transfer failed due to time out.
+ @return EFI_SUCCESS The transfer finished OK.
+
+**/
+EFI_STATUS
+XhcExecTransfer (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN URB *Urb,
+ IN UINTN Timeout
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN Loop;
+ TRB_TEMPLATE *Trb;
+ TRANSFER_RING *Ring;
+ TRB_TEMPLATE *TrbStart;
+ TRB_TEMPLATE *TrbEnd;
+
+ Status = EFI_SUCCESS;
+
+ Loop = (Timeout * XHC_1_MILLISECOND / XHC_POLL_DELAY) + 1;
+ if (Timeout == 0) {
+ Loop = 0xFFFFFFFF;
+ }
+ XhcRingDoorBell (Xhc, Urb);
+ //
+ // DSCT BIT0: Event Ring Not Empty bit can only be set to 1 by XHC after ringing door bell with some delay.
+ //
+
+ for (Index = 0; Index < Loop; Index++) {
+ Status = XhcCheckUrbResult (Xhc, Urb);
+ if (Urb->Finished) {
+ break;
+ }
+ MicroSecondDelay (XHC_POLL_DELAY);
+ }
+ if (Index == Loop) {
+ Urb->Result = EFI_USB_ERR_TIMEOUT;
+ }
+
+ //
+ // If URB transfer is error, restore transfer ring to original value before URB transfer
+ // This will make the current transfer TRB is always at the latest unused one in transfer ring.
+ // Without this code, when there is read TRB from target, but host does not write anything, this TRB (A)
+ // will be still here, next read TRB (B) will be put next to TRB (A), when host write then, the TRB (A)
+ // will be used to contain data, not TRB(B), this will cause Finished flag will not be set and return error in this function.
+ //
+ Ring = (TRANSFER_RING *)(UINTN) Urb->Ring;
+ if (Urb->Result != EFI_USB_NOERROR) {
+ Ring->RingEnqueue = Urb->TrbStart;
+ //
+ // Clear CCS flag for next use
+ //
+ TrbStart = (TRB_TEMPLATE *)(UINTN) Urb->TrbStart;
+ TrbEnd = (TRB_TEMPLATE *)(UINTN) Urb->TrbEnd;
+ for (Trb = TrbStart; Trb <= TrbEnd; Trb++) {
+ Trb->CycleBit = ((~Ring->RingPCS) & BIT0);
+ }
+ }
+ return Status;
+}
+
+/**
+ Create a transfer TRB.
+
+ @param Xhc The XHCI Instance
+ @param Urb The urb used to construct the transfer TRB.
+
+ @return Created TRB or NULL
+
+**/
+EFI_STATUS
+XhcCreateTransferTrb (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN URB *Urb
+ )
+{
+ TRANSFER_RING *EPRing;
+ TRB *TrbStart;
+ UINT32 TotalLen;
+ UINT32 Len;
+ UINT32 TrbNum;
+
+ Urb->Finished = FALSE;
+ Urb->StartDone = FALSE;
+ Urb->EndDone = FALSE;
+ Urb->Completed = 0;
+ Urb->Result = EFI_USB_NOERROR;
+
+ if (Urb->Direction == EfiUsbDataIn) {
+ EPRing = &Xhc->TransferRingIn;
+ } else {
+ EPRing = &Xhc->TransferRingOut;
+ }
+
+ Urb->Ring = (EFI_PHYSICAL_ADDRESS)(UINTN) EPRing;
+ //
+ // Construct the TRB for ED_BULK_OUT and ED_BULK_IN
+ //
+ XhcSyncTrsRing (Xhc, EPRing);
+
+ Urb->TrbStart = EPRing->RingEnqueue;
+
+ TotalLen = 0;
+ Len = 0;
+ TrbNum = 0;
+ TrbStart = (TRB *)(UINTN)EPRing->RingEnqueue;
+
+ while (TotalLen < Urb->DataLen) {
+ if ((TotalLen + 0x10000) >= Urb->DataLen) {
+ Len = Urb->DataLen - TotalLen;
+ } else {
+ Len = 0x10000;
+ }
+ TrbStart = (TRB *)(UINTN)EPRing->RingEnqueue;
+ TrbStart->TrbNormal.TRBPtrLo = XHC_LOW_32BIT(Urb->Data + TotalLen);
+ TrbStart->TrbNormal.TRBPtrHi = XHC_HIGH_32BIT(Urb->Data + TotalLen);
+ TrbStart->TrbNormal.Length = Len;
+ TrbStart->TrbNormal.TDSize = 0;
+ TrbStart->TrbNormal.IntTarget = 0;
+ TrbStart->TrbNormal.ISP = 1;
+ TrbStart->TrbNormal.IOC = 1;
+ TrbStart->TrbNormal.Type = TRB_TYPE_NORMAL;
+
+ //
+ // Update the cycle bit
+ //
+ TrbStart->TrbNormal.CycleBit = EPRing->RingPCS & BIT0;
+
+ XhcSyncTrsRing (Xhc, EPRing);
+ TrbNum++;
+ TotalLen += Len;
+ }
+
+ Urb->TrbNum = TrbNum;
+
+ //
+ // Update to the last TRB
+ //
+ Urb->TrbEnd = (EFI_PHYSICAL_ADDRESS)(UINTN) TrbStart;
+ return EFI_SUCCESS;
+}
+
+/**
+ Create a new URB for a new transaction.
+
+ @param Xhc The XHCI Instance
+ @param Direction The direction of data flow.
+ @param Data The user data to transfer
+ @param DataLen The length of data buffer
+
+ @return Created URB or NULL
+
+**/
+URB*
+XhcCreateUrb (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN EFI_USB_DATA_DIRECTION Direction,
+ IN VOID *Data,
+ IN UINTN DataLen
+ )
+{
+ EFI_STATUS Status;
+ URB *Urb;
+ EFI_PHYSICAL_ADDRESS DataAddress;
+
+ Urb = &Xhc->Urb;
+ ASSERT (Urb->Data != 0);
+ DataAddress = Urb->Data;
+ ZeroMem (Urb, sizeof (URB));
+
+ Urb->Signature = USB3_DEBUG_PORT_INSTANCE_SIGNATURE;
+ Urb->Direction = Direction;
+ Urb->Data = DataAddress;
+
+ ZeroMem ((VOID*)(UINTN) Urb->Data, DataLen);
+ CopyMem ((VOID*)(UINTN) Urb->Data, Data, DataLen);
+
+ Urb->DataLen = (UINT32) DataLen;
+ Status = XhcCreateTransferTrb (Xhc, Urb);
+ ASSERT_EFI_ERROR (Status);
+
+ return Urb;
+}
+
+/**
+ Submits bulk transfer to a bulk endpoint of a USB device.
+
+ @param Xhc The instance of debug device.
+ @param Direction The direction of data transfer.
+ @param Data Array of pointers to the buffers of data to transmit
+ from or receive into.
+ @param DataLength The lenght of the data buffer.
+ @param Timeout Indicates the maximum time, in millisecond, which
+ the transfer is allowed to complete.
+ @param TransferResult Transfer result.
+
+ @retval EFI_SUCCESS The transfer was completed successfully.
+ @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.
+ @retval EFI_TIMEOUT The transfer failed due to timeout.
+ @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.
+
+**/
+EFI_STATUS
+EFIAPI
+XhcDataTransfer (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN EFI_USB_DATA_DIRECTION Direction,
+ IN OUT VOID *Data,
+ IN OUT UINTN *DataLength,
+ IN UINTN Timeout,
+ OUT UINT32 *TransferResult
+ )
+{
+ URB *Urb;
+ EFI_STATUS Status;
+
+ //
+ // Validate the parameters
+ //
+ if ((DataLength == NULL) || (*DataLength == 0) ||
+ (Data == NULL) || (TransferResult == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *TransferResult = EFI_USB_ERR_SYSTEM;
+ Status = EFI_DEVICE_ERROR;
+
+ //
+ // Create a new URB, insert it into the asynchronous
+ // schedule list, then poll the execution status.
+ //
+ Urb = XhcCreateUrb (Xhc, Direction, Data, *DataLength);
+
+ if (Urb == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto ON_EXIT;
+ }
+
+ Status = XhcExecTransfer (Xhc, Urb, Timeout);
+
+ *TransferResult = Urb->Result;
+ *DataLength = Urb->Completed;
+
+ if (*TransferResult == EFI_USB_NOERROR) {
+ Status = EFI_SUCCESS;
+ }
+
+ON_EXIT:
+
+ return Status;
+}
+
+/**
+ Check whether the MMIO Bar is within any of the SMRAM ranges.
+
+ @param[in] XhcMmioBase The address of the MMIO to be checked.
+
+ @retval TURE The XHCI MMIO is in SMRAM ranges.
+ @retval FALSE The XHCI MMIO is out of SMRAM ranges.
+**/
+BOOLEAN
+EFIAPI
+Usb3DebugIsAddressInSmram (
+ IN EFI_PHYSICAL_ADDRESS XhcMmioBase
+ )
+{
+ UINTN Index;
+
+ if (mSmramCheckRangeCount == 0) {
+ //
+ // When we invoke this function, we are already in SMM mode,
+ // but SmmAccess->GetCapabilities failed which kept mSmramCheckRanges as 0.
+ //
+ return TRUE;
+ }
+
+ for (Index = 0; Index < mSmramCheckRangeCount; Index ++) {
+ if (((XhcMmioBase >= mSmramCheckRanges[Index].CpuStart) && (XhcMmioBase < mSmramCheckRanges[Index].CpuStart + mSmramCheckRanges[Index].PhysicalSize)) ||
+ ((mSmramCheckRanges[Index].CpuStart >= XhcMmioBase) && (mSmramCheckRanges[Index].CpuStart < XhcMmioBase + mUsb3MmioSize))) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+/**
+ Transfer data via XHC controller.
+
+ @param Data Data buffer.
+ @param Length Data length.
+ @param Direction Transfer direction.
+
+**/
+VOID
+Usb3DebugPortDataTransfer (
+ UINT8 *Data,
+ UINTN *Length,
+ EFI_USB_DATA_DIRECTION Direction
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+ UINT16 Command;
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT32 TransferResult;
+ UINT32 Dcctrl;
+ EFI_PHYSICAL_ADDRESS UsbBase;
+ UINTN BytesToSend;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ EFI_STATUS Status;
+ USB3_DEBUG_PORT_INSTANCE UsbDbgInstance;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+
+ //
+ // MMIO base address is possible to clear, set it if it is cleared. (XhciMemorySpaceClose in PchUsbCommon.c)
+ //
+ XhcMmioBase = GetXhciBaseAddress ();
+ Command = GetXhciPciCommand ();
+
+ if ((XhcMmioBase == 0) || (XhcMmioBase == XHCI_BASE_ADDRESS_64_BIT_MASK)) {
+ //
+ // XHCI device MMIO base is cleared by someone, set it again
+ //
+ UsbBase = PcdGet32 (PcdXhciDefaultBaseAddress);
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET), (UINT32)UsbBase);
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4), 0x0);
+ UsbBase = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET)) & XHCI_BASE_ADDRESS_32_BIT_MASK;
+ if (UsbBase == 0 || UsbBase == XHCI_BASE_ADDRESS_32_BIT_MASK) {
+ return;
+ }
+ }
+
+ //
+ // Check if XHC debug MMIO range is in SMRAM
+ //
+ if ((mUsb3InSmm) && (Usb3DebugIsAddressInSmram (XhcMmioBase))) {
+ return;
+ }
+
+ //
+ // Save and set Command Register
+ //
+ if (((Command & EFI_PCI_COMMAND_MEMORY_SPACE) == 0) || ((Command & EFI_PCI_COMMAND_BUS_MASTER) == 0)) {
+ PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER);
+ PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ }
+
+ Instance = GetUsb3DebugPortInstance ();
+
+ if (Instance != NULL) {
+ if (!Instance->DebugSupport) {
+ //
+ // Debug device is not supported by XHCI, return
+ //
+ goto Done;
+ }
+ }
+
+ if ((Instance != NULL) && (Instance->Ready)) {
+ //
+ // Debug device is broken suddently (e.g. Windows OS), return
+ //
+ Dcctrl = XhcReadDebugReg (Instance, XHC_DC_DCCTRL);
+ if ((Dcctrl & BIT0) == 0) {
+ goto Done;
+ }
+ }
+
+ if ((Instance != NULL) && (!Instance->Ready)) {
+ //
+ // Debug host does not connect with target
+ //
+ goto Done;
+ }
+
+ if (Instance == NULL) {
+ ZeroMem (&UsbDbgInstance, sizeof (USB3_DEBUG_PORT_INSTANCE));
+ DiscoverUsb3DebugPort (&UsbDbgInstance);
+ if (UsbDbgInstance.DebugSupport) {
+ if (!IsAllocatePagesReady ()) {
+ //
+ // AllocatePages can not work, return
+ //
+ goto Done;
+ }
+ }
+ Status = USB3InitializeReal ();
+ if (EFI_ERROR (Status)) {
+ //
+ // Debug device is failed to initialize
+ //
+ goto Done;
+ }
+
+ //
+ // Update instance
+ //
+ Instance = GetUsb3DebugPortInstance ();
+
+ if (Instance == NULL) {
+ //
+ // Debug device instance is failed to create
+ //
+ goto Done;
+ }
+
+ if ((!Instance->Ready) || (!Instance->DebugSupport)) {
+ //
+ // Debug host does not connect at first or is not supported
+ //
+ goto Done;
+ }
+ }
+
+ BytesToSend = 0;
+ while (*Length > 0) {
+ BytesToSend = ((*Length) > XHC_DEBUG_PORT_DATA_LENGTH) ? XHC_DEBUG_PORT_DATA_LENGTH : *Length;
+ XhcDataTransfer (
+ Instance,
+ Direction,
+ Data,
+ &BytesToSend,
+ DATA_TRANSFER_TIME_OUT,
+ &TransferResult
+ );
+ if (TransferResult != EFI_USB_NOERROR) {
+ break;
+ }
+ *Length -= BytesToSend;
+ Data += BytesToSend;
+ }
+
+Done:
+ //
+ // Restore Command Register
+ //
+ PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command);
+
+}
+
+/**
+ Receive data over the USB3 debug cable.
+
+ @param[out] Data Pointer to data
+ @param[in, out] Length Pointer to data length
+
+**/
+RETURN_STATUS
+Usb3DbgIn (
+ OUT UINT8 *Data,
+ IN OUT UINTN *Length
+ )
+{
+ Usb3DebugPortDataTransfer (Data, Length, EfiUsbDataIn);
+ return EFI_SUCCESS;
+}
+
+/**
+ Send data over the USB3 debug cable.
+
+ @param[out] Data Pointer to data
+ @param[in, out] Length Pointer to data length
+
+**/
+VOID
+Usb3DbgOut (
+ OUT UINT8 *Data,
+ IN OUT UINTN *Length
+ )
+{
+ Usb3DebugPortDataTransfer (Data, Length, EfiUsbDataOut);
+}
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c
new file mode 100644
index 0000000000..37924b0b76
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c
@@ -0,0 +1,726 @@
+/** @file
+ Usb3 Debug Port initialization
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <PiPei.h>
+#include <Library/SerialPortLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PciLib.h>
+#include <Library/PcdLib.h>
+#include <Library/TimerLib.h>
+#include <Library/HobLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+#include "Usb3DebugPortLibInternal.h"
+
+UINT16 mString0Desc[] = {
+ // String Descriptor Type + Length
+ ( USB_DESC_TYPE_STRING << 8 ) + STRING0_DESC_LEN,
+ 0x0409
+};
+
+UINT16 mManufacturerStrDesc[] = {
+ // String Descriptor Type + Length
+ ( USB_DESC_TYPE_STRING << 8 ) + MANU_DESC_LEN,
+ 'I', 'n', 't', 'e', 'l'
+};
+
+//USB 3.0 Debug Cable
+UINT16 mProductStrDesc[] = {
+ // String Descriptor Type + Length
+ ( USB_DESC_TYPE_STRING << 8 ) + PRODUCT_DESC_LEN,
+ 'U', 'S', 'B', ' ', '3', '.', '0', ' ', 'D', 'e', 'b', 'u', 'g', ' ', 'C', 'a', 'b', 'l', 'e'
+};
+
+UINT16 mSerialNumberStrDesc[] = {
+ // String Descriptor Type + Length
+ ( USB_DESC_TYPE_STRING << 8 ) + SERIAL_DESC_LEN,
+ '1'
+};
+
+XHC_DC_CONTEXT DebugCapabilityContextTemplate = {
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ STRING0_DESC_LEN,
+ MANU_DESC_LEN,
+ PRODUCT_DESC_LEN,
+ SERIAL_DESC_LEN,
+ 0,
+ 0,
+ 0,
+ 0
+ },
+ {
+ 0, // EPState
+ 0, // RsvdZ1
+ 0, // Mult
+ 0, // MaxPStreams
+ 0, // LSA
+ 0, // Interval
+ 0, // RsvdZ2
+ 0, // RsvdZ3
+ 3, // CERR
+ ED_BULK_OUT, // EPType
+ 0, // RsvdZ4
+ 0, // HID
+ 0, // MaxBurstSize
+ 1024, // MaxPacketSize
+ 0, // PtrLo
+ 0, // PtrHi
+ 0x1000, // AverageTRBLength
+ 0, // MaxESITPayload
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ },
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 3, //CERR
+ ED_BULK_IN,
+ 0,
+ 0,
+ 0,
+ 1024, //MaxPacketSize
+ 0,
+ 0,
+ 0x1000,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ }
+};
+
+/**
+ Return command register value in XHCI controller.
+
+**/
+UINT16
+GetXhciPciCommand (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT16 Command;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+ Command = PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ return Command;
+}
+
+/**
+ Discover the USB3 debug device.
+
+ @param[in] Instance Pointer to USB3 debug port object instance.
+
+ @retval RETURN_SUCCESS The USB3 debug device was found.
+ @retval RETURN_DEVICE_ERROR The USB3 debug device was not found.
+
+**/
+RETURN_STATUS
+DiscoverUsb3DebugPort(
+ IN USB3_DEBUG_PORT_INSTANCE *Instance
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT16 Command;
+ EFI_PHYSICAL_ADDRESS UsbBase;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ EFI_PHYSICAL_ADDRESS CapabilityPointer;
+ UINT32 Capability;
+ BOOLEAN Flag;
+ UINT8 CapLength;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+ if ((PciRead8(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_CLASSCODE_OFFSET + 2)) != PCI_CLASS_SERIAL) ||
+ (PciRead8(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_CLASSCODE_OFFSET + 1)) != PCI_CLASS_SERIAL_USB) ||
+ (PciRead8(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_CLASSCODE_OFFSET)) != 0x30)) {
+ //
+ // The device is not XHCI controller
+ //
+ return RETURN_NOT_FOUND;
+ }
+
+ //
+ // USBBASE is at 10-13h, i.e. the first BAR, clear the low bits which is not part of base address
+ //
+ UsbBase = GetXhciBaseAddress ();
+
+ //
+ // Set XHCI MMIO base address if necessary
+ //
+ if ((UsbBase == 0) || (UsbBase == XHCI_BASE_ADDRESS_64_BIT_MASK)) {
+ UsbBase = PcdGet32 (PcdXhciDefaultBaseAddress);
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET), (UINT32)UsbBase);
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4), 0x0);
+ UsbBase = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET)) & XHCI_BASE_ADDRESS_32_BIT_MASK;
+ if (UsbBase == 0 || UsbBase == XHCI_BASE_ADDRESS_32_BIT_MASK) {
+ return RETURN_DEVICE_ERROR;
+ }
+ }
+
+ //
+ // Set MSE and BME bit - enable the address space
+ //
+ Command = PciRead16 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) == 0) {
+ PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE);
+ PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ }
+
+ CapLength = MmioRead8 ((UINTN) UsbBase);
+
+ //
+ // Get capability pointer from HCCPARAMS at offset 0x10
+ //
+ CapabilityPointer = UsbBase + (MmioRead32 ((UINTN)(UsbBase + XHC_HCCPARAMS_OFFSET)) >> 16) * 4;
+
+ //
+ // Search XHCI debug capability
+ //
+ Flag = FALSE;
+ Capability = MmioRead32 ((UINTN)CapabilityPointer);
+ while (TRUE) {
+ if ((Capability & XHC_CAPABILITY_ID_MASK) == PCI_CAPABILITY_ID_DEBUG_PORT) {
+ Flag = TRUE;
+ break;
+ }
+ if ((((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) & XHC_CAPABILITY_ID_MASK) == 0) {
+ //
+ // Reach the end of capability list, quit
+ //
+ break;
+ }
+ CapabilityPointer += ((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) * 4;
+ Capability = MmioRead32 ((UINTN)CapabilityPointer);
+ }
+
+ Instance->Signature = USB3_DEBUG_PORT_INSTANCE_SIGNATURE;
+
+ if (Flag) {
+ Instance->DebugSupport = TRUE;
+ Instance->DebugCapabilityBase = CapabilityPointer;
+ Instance->DebugCapabilityOffset = CapabilityPointer - UsbBase;
+
+ Instance->XhciOpRegister = UsbBase + CapLength;
+ Instance->XhcMmioBase = UsbBase;
+
+ Instance->PciBusNumber = Bus;
+ Instance->PciDeviceNumber = Device;
+ Instance->PciFunctionNumber = Function;
+ }
+
+ //
+ // Restore Command Register
+ //
+ PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command);
+
+ return RETURN_SUCCESS;
+}
+
+/**
+ Create XHCI event ring.
+
+ @param Xhc The XHCI Instance.
+ @param EventRing The created event ring.
+
+**/
+EFI_STATUS
+CreateEventRing (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ OUT EVENT_RING *EventRing
+ )
+{
+ VOID *Buf;
+ EVENT_RING_SEG_TABLE_ENTRY *ERSTBase;
+
+ ASSERT (EventRing != NULL);
+
+ //
+ // Allocate Event Ring
+ //
+ Buf = AllocateAlignBuffer (sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMBER);
+ ASSERT (Buf != NULL);
+ ASSERT (((UINTN) Buf & 0x3F) == 0);
+ ZeroMem (Buf, sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMBER);
+
+ EventRing->EventRingSeg0 = (EFI_PHYSICAL_ADDRESS)(UINTN) Buf;
+ EventRing->TrbNumber = EVENT_RING_TRB_NUMBER;
+ EventRing->EventRingDequeue = (EFI_PHYSICAL_ADDRESS)(UINTN) EventRing->EventRingSeg0;
+ EventRing->EventRingEnqueue = (EFI_PHYSICAL_ADDRESS)(UINTN) EventRing->EventRingSeg0;
+
+ //
+ // Software maintains an Event Ring Consumer Cycle State (CCS) bit, initializing it to '1'
+ // and toggling it every time the Event Ring Dequeue Pointer wraps back to the beginning of the Event Ring.
+ //
+ EventRing->EventRingCCS = 1;
+
+ //
+ // Allocate Event Ring Segment Table Entry 0 in Event Ring Segment Table
+ //
+ Buf = AllocateAlignBuffer (sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERST_NUMBER);
+ ASSERT (Buf != NULL);
+ ASSERT (((UINTN) Buf & 0x3F) == 0);
+ ZeroMem (Buf, sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERST_NUMBER);
+
+ ERSTBase = (EVENT_RING_SEG_TABLE_ENTRY *) Buf;
+ EventRing->ERSTBase = (EFI_PHYSICAL_ADDRESS)(UINTN) ERSTBase;
+
+ //
+ // Fill Event Segment address
+ //
+ ERSTBase->PtrLo = XHC_LOW_32BIT (EventRing->EventRingSeg0);
+ ERSTBase->PtrHi = XHC_HIGH_32BIT (EventRing->EventRingSeg0);
+ ERSTBase->RingTrbSize = EVENT_RING_TRB_NUMBER;
+
+ //
+ // Program the Interrupter Event Ring Dequeue Pointer (DCERDP) register (7.6.4.1)
+ //
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCERDP,
+ XHC_LOW_32BIT((UINT64)(UINTN)EventRing->EventRingDequeue)
+ );
+
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCERDP + 4,
+ XHC_HIGH_32BIT((UINT64)(UINTN)EventRing->EventRingDequeue)
+ );
+
+ //
+ // Program the Debug Capability Event Ring Segment Table Base Address (DCERSTBA) register(7.6.4.1)
+ //
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCERSTBA,
+ XHC_LOW_32BIT((UINT64)(UINTN)ERSTBase)
+ );
+
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCERSTBA + 4,
+ XHC_HIGH_32BIT((UINT64)(UINTN)ERSTBase)
+ );
+
+ //
+ // Program the Debug Capability Event Ring Segment Table Size (DCERSTSZ) register(7.6.4.1)
+ //
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCERSTSZ,
+ ERST_NUMBER
+ );
+ return EFI_SUCCESS;
+}
+
+/**
+ Create XHCI transfer ring.
+
+ @param Xhc The XHCI Instance.
+ @param TrbNum The number of TRB in the ring.
+ @param TransferRing The created transfer ring.
+
+**/
+VOID
+CreateTransferRing (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc,
+ IN UINT32 TrbNum,
+ OUT TRANSFER_RING *TransferRing
+ )
+{
+ VOID *Buf;
+ LINK_TRB *EndTrb;
+
+ Buf = AllocateAlignBuffer (sizeof (TRB_TEMPLATE) * TrbNum);
+ ASSERT (Buf != NULL);
+ ASSERT (((UINTN) Buf & 0xF) == 0);
+ ZeroMem (Buf, sizeof (TRB_TEMPLATE) * TrbNum);
+
+ TransferRing->RingSeg0 = (EFI_PHYSICAL_ADDRESS)(UINTN) Buf;
+ TransferRing->TrbNumber = TrbNum;
+ TransferRing->RingEnqueue = TransferRing->RingSeg0;
+ TransferRing->RingDequeue = TransferRing->RingSeg0;
+ TransferRing->RingPCS = 1;
+ //
+ // 4.9.2 Transfer Ring Management
+ // To form a ring (or circular queue) a Link TRB may be inserted at the end of a ring to
+ // point to the first TRB in the ring.
+ //
+ EndTrb = (LINK_TRB *) ((UINTN)Buf + sizeof (TRB_TEMPLATE) * (TrbNum - 1));
+ EndTrb->Type = TRB_TYPE_LINK;
+ EndTrb->PtrLo = XHC_LOW_32BIT (Buf);
+ EndTrb->PtrHi = XHC_HIGH_32BIT (Buf);
+ //
+ // Toggle Cycle (TC). When set to '1', the xHC shall toggle its interpretation of the Cycle bit.
+ //
+ EndTrb->TC = 1;
+ //
+ // Set Cycle bit as other TRB PCS init value
+ //
+ EndTrb->CycleBit = 0;
+}
+
+/**
+ Create debug capability context for XHC debug device.
+
+ @param Xhc The XHCI Instance.
+
+ @retval EFI_SUCCESS The bit successfully changed by host controller.
+ @retval EFI_TIMEOUT The time out occurred.
+
+**/
+EFI_STATUS
+CreateDebugCapabilityContext (
+ IN USB3_DEBUG_PORT_INSTANCE *Xhc
+ )
+{
+ VOID *Buf;
+ XHC_DC_CONTEXT *DebugCapabilityContext;
+ UINT8 *String0Desc;
+ UINT8 *ManufacturerStrDesc;
+ UINT8 *ProductStrDesc;
+ UINT8 *SerialNumberStrDesc;
+
+ //
+ // Allocate debug device context
+ //
+ Buf = AllocateAlignBuffer (sizeof (XHC_DC_CONTEXT));
+ ASSERT (Buf != NULL);
+ ASSERT (((UINTN) Buf & 0xF) == 0);
+ ZeroMem (Buf, sizeof (XHC_DC_CONTEXT));
+
+ DebugCapabilityContext = (XHC_DC_CONTEXT *)(UINTN) Buf;
+ Xhc->DebugCapabilityContext = (EFI_PHYSICAL_ADDRESS)(UINTN) DebugCapabilityContext;
+
+ CopyMem (DebugCapabilityContext, &DebugCapabilityContextTemplate, sizeof (XHC_DC_CONTEXT));
+
+ //
+ // Update string descriptor address
+ //
+ String0Desc = (UINT8 *) AllocateAlignBuffer (STRING0_DESC_LEN + MANU_DESC_LEN + PRODUCT_DESC_LEN + SERIAL_DESC_LEN);
+ ASSERT (String0Desc != NULL);
+ ZeroMem (String0Desc, STRING0_DESC_LEN + MANU_DESC_LEN + PRODUCT_DESC_LEN + SERIAL_DESC_LEN);
+ CopyMem (String0Desc, mString0Desc, STRING0_DESC_LEN);
+ DebugCapabilityContext->DbcInfoContext.String0DescAddress = (UINT64)(UINTN)String0Desc;
+
+ ManufacturerStrDesc = String0Desc + STRING0_DESC_LEN;
+ CopyMem (ManufacturerStrDesc, mManufacturerStrDesc, MANU_DESC_LEN);
+ DebugCapabilityContext->DbcInfoContext.ManufacturerStrDescAddress = (UINT64)(UINTN)ManufacturerStrDesc;
+
+ ProductStrDesc = ManufacturerStrDesc + MANU_DESC_LEN;
+ CopyMem (ProductStrDesc, mProductStrDesc, PRODUCT_DESC_LEN);
+ DebugCapabilityContext->DbcInfoContext.ProductStrDescAddress = (UINT64)(UINTN)ProductStrDesc;
+
+ SerialNumberStrDesc = ProductStrDesc + PRODUCT_DESC_LEN;
+ CopyMem (SerialNumberStrDesc, mSerialNumberStrDesc, SERIAL_DESC_LEN);
+ DebugCapabilityContext->DbcInfoContext.SerialNumberStrDescAddress = (UINT64)(UINTN)SerialNumberStrDesc;
+
+ //
+ // Allocate and initialize the Transfer Ring for the Input Endpoint Context.
+ //
+ ZeroMem (&Xhc->TransferRingIn, sizeof (TRANSFER_RING));
+ CreateTransferRing (Xhc, TR_RING_TRB_NUMBER, &Xhc->TransferRingIn);
+
+ //
+ // Can not set BIT0, otherwise there is no transfer ring detected.
+ //
+ DebugCapabilityContext->EpInContext.PtrLo = XHC_LOW_32BIT (Xhc->TransferRingIn.RingSeg0) | BIT0;
+ DebugCapabilityContext->EpInContext.PtrHi = XHC_HIGH_32BIT (Xhc->TransferRingIn.RingSeg0);
+
+ //
+ // Allocate and initialize the Transfer Ring for the Output Endpoint Context.
+ //
+ ZeroMem (&Xhc->TransferRingOut, sizeof (TRANSFER_RING));
+ CreateTransferRing (Xhc, TR_RING_TRB_NUMBER, &Xhc->TransferRingOut);
+
+ //
+ // Can not set BIT0, otherwise there is no transfer ring detected.
+ //
+ DebugCapabilityContext->EpOutContext.PtrLo = XHC_LOW_32BIT (Xhc->TransferRingOut.RingSeg0) | BIT0;
+ DebugCapabilityContext->EpOutContext.PtrHi = XHC_HIGH_32BIT (Xhc->TransferRingOut.RingSeg0);
+
+ //
+ // Program the Debug Capability Context Pointer (DCCP) register(7.6.8.7)
+ //
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCCP,
+ XHC_LOW_32BIT((UINT64)(UINTN)DebugCapabilityContext)
+ );
+ XhcWriteDebugReg (
+ Xhc,
+ XHC_DC_DCCP + 4,
+ XHC_HIGH_32BIT((UINT64)(UINTN)DebugCapabilityContext)
+ );
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize the USB3 debug Device hardware.
+
+ @param[in] Instance Pointer to USB3 debug port object instance.
+
+ @retval RETURN_SUCCESS The USB3 debug device was initialized successfully.
+ @retval !RETURN_SUCCESS Error.
+
+**/
+RETURN_STATUS
+InitializeUsb3DebugPort (
+ IN USB3_DEBUG_PORT_INSTANCE *Instance
+ )
+{
+ RETURN_STATUS Status;
+ UINT64 XhciOpRegister;
+ volatile UINT32 Dcctrl;
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT16 Command;
+ EFI_BOOT_MODE BootMode;
+ UINT64 TimeOut;
+ CHAR8 *TestString;
+ UINTN Length;
+ UINT32 TransferResult;
+
+ Bus = Instance->PciBusNumber;
+ Device = Instance->PciDeviceNumber;
+ Function = Instance->PciFunctionNumber;
+
+ Command = GetXhciPciCommand ();
+
+ //
+ // Save and set Command Register
+ //
+ if (((Command & EFI_PCI_COMMAND_MEMORY_SPACE) == 0) || ((Command & EFI_PCI_COMMAND_BUS_MASTER) == 0)) {
+ PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER);
+ PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ }
+
+ //
+ // Clear DCE bit and LSE bit in DCCTRL
+ //
+ if ((XhcReadDebugReg (Instance, XHC_DC_DCCTRL) & (BIT1|BIT31)) == (BIT1|BIT31)) {
+ XhcClearDebugRegBit (Instance, XHC_DC_DCCTRL, BIT1|BIT31);
+ }
+
+ XhciOpRegister = Instance->XhciOpRegister;
+
+ //
+ // Get current Boot Mode
+ //
+ BootMode = GetBootModeHob ();
+
+ if (BootMode != BOOT_ON_S3_RESUME) {
+ if (!XhcIsBitSet((UINTN)(XhciOpRegister + XHC_USBSTS_OFFSET), XHC_USBSTS_HALT)) {
+ XhcClrR32Bit((UINTN) XhciOpRegister + XHC_USBCMD_OFFSET, XHC_USBCMD_RUN);
+ while (!XhcIsBitSet((UINTN)(XhciOpRegister + XHC_USBSTS_OFFSET), XHC_USBSTS_HALT)) {
+ MicroSecondDelay (10);
+ }
+ }
+
+ //
+ // Reset host controller
+ //
+ XhcSetR32Bit((UINTN)XhciOpRegister + XHC_USBCMD_OFFSET, XHC_USBCMD_RESET);
+
+ //
+ // Ensure that the host controller is reset (RESET bit must be cleared after reset)
+ //
+ while (XhcIsBitSet((UINTN)XhciOpRegister + XHC_USBCMD_OFFSET, XHC_USBCMD_RESET)) {
+ MicroSecondDelay (10);
+ }
+ }
+
+ //
+ // Initialize event ring
+ //
+ ZeroMem (&Instance->EventRing, sizeof (EVENT_RING));
+ Status = CreateEventRing (Instance, &Instance->EventRing);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Init IN and OUT endpoint context
+ //
+ Status = CreateDebugCapabilityContext (Instance);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Init data buffer used to transfer
+ //
+ Instance->Urb.Data = (EFI_PHYSICAL_ADDRESS) (UINTN) AllocateAlignBuffer (XHC_DEBUG_PORT_DATA_LENGTH);
+
+ //
+ // Init DCDDI1 and DCDDI2
+ //
+ XhcWriteDebugReg (
+ Instance,
+ XHC_DC_DCDDI1,
+ (UINT32)((XHCI_DEBUG_DEVICE_VENDOR_ID << 16) | XHCI_DEBUG_DEVICE_PROTOCOL)
+ );
+
+ XhcWriteDebugReg (
+ Instance,
+ XHC_DC_DCDDI2,
+ (UINT32)((XHCI_DEBUG_DEVICE_REVISION << 16) | XHCI_DEBUG_DEVICE_PRODUCT_ID)
+ );
+
+ //
+ // Set DCE bit and LSE bit to "1" in DCCTRL
+ //
+ XhcSetDebugRegBit (Instance, XHC_DC_DCCTRL, BIT1|BIT31);
+
+ TimeOut = DivU64x32 (PcdGet64 (PcdXhciHostWaitTimeout), XHC_POLL_DELAY) + 1;
+ while (TimeOut != 0) {
+ //
+ // Check if debug device is in configured state
+ //
+ Dcctrl = XhcReadDebugReg (Instance, XHC_DC_DCCTRL);
+ if ((Dcctrl & BIT0) != 0) {
+ //
+ // Set the flag to indicate debug device is ready
+ //
+ Instance->Ready = TRUE;
+ break;
+ }
+ MicroSecondDelay (XHC_POLL_DELAY);
+ TimeOut--;
+ }
+
+ if (!Instance->Ready) {
+ XhcClearDebugRegBit (Instance, XHC_DC_DCCTRL, BIT1|BIT31);
+ } else {
+ TestString = "Usb 3.0 Debug Message Start\n";
+ Length = AsciiStrLen (TestString);
+ XhcDataTransfer (
+ Instance,
+ EfiUsbDataOut,
+ TestString,
+ &Length,
+ 0,
+ &TransferResult
+ );
+ }
+
+ //
+ // Restore Command Register
+ //
+ PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Update XHC hardware address when MMIO base is changed.
+
+ @param Instance The XHCI Instance.
+ @param XhcMmioBase XHCI MMIO base address.
+
+**/
+VOID
+FixUsb3InstanceResource (
+ IN OUT USB3_DEBUG_PORT_INSTANCE *Instance,
+ IN EFI_PHYSICAL_ADDRESS XhcMmioBase
+ )
+{
+ if ((Instance == NULL) || (Instance->XhcMmioBase == XhcMmioBase)) {
+ return;
+ }
+
+ //
+ // Need fix Instance data according to PCI resource
+ //
+ Instance->XhcMmioBase = XhcMmioBase;
+ Instance->DebugCapabilityBase = XhcMmioBase + Instance->DebugCapabilityOffset;
+ Instance->XhciOpRegister = XhcMmioBase + MmioRead8 ((UINTN)XhcMmioBase);
+}
+
+/**
+ Save USB3 instance address.
+
+ @param[in] Instance The XHCI Instance.
+
+**/
+VOID
+SaveUsb3InstanceAddress (
+ IN USB3_DEBUG_PORT_INSTANCE *Instance
+ )
+{
+ UINT16 Command;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+
+ Command = GetXhciPciCommand ();
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+
+ //
+ // Set Command Register
+ //
+ if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) == 0) {
+ PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE);
+ PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ }
+
+ //
+ // After debug device is finished to enumerate, use DCDDI2 register to store instance address
+ //
+ XhcWriteDebugReg (
+ Instance,
+ XHC_DC_DCDDI2,
+ (UINT32)(UINTN)Instance
+ );
+
+ //
+ // Restore Command Register
+ //
+ PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command);
+}
+
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c
new file mode 100644
index 0000000000..53572f934b
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c
@@ -0,0 +1,454 @@
+/** @file
+ Usb3 Debug Port library instance
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <PiDxe.h>
+#include <Library/SerialPortLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+#include <Library/PciLib.h>
+#include <Library/PcdLib.h>
+#include <Library/TimerLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+#include <Protocol/SmmBase2.h>
+#include <Protocol/SmmAccess2.h>
+#include "Usb3DebugPortLibInternal.h"
+
+extern EFI_SMRAM_DESCRIPTOR mSmramCheckRanges[MAX_SMRAM_RANGE];
+extern UINTN mSmramCheckRangeCount;
+extern BOOLEAN mUsb3InSmm;
+extern UINT64 mUsb3MmioSize;
+extern BOOLEAN mUsb3GetCapSuccess;
+
+GUID gUsb3DbgGuid = USB3_DBG_GUID;
+
+USB3_DEBUG_PORT_CONTROLLER mUsb3DebugPort;
+USB3_DEBUG_PORT_INSTANCE *mUsb3Instance = NULL;
+
+/**
+ Return XHCI MMIO base address.
+
+**/
+EFI_PHYSICAL_ADDRESS
+GetXhciBaseAddress (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ EFI_PHYSICAL_ADDRESS Address;
+ UINT32 Low;
+ UINT32 High;
+
+ if (mUsb3DebugPort.Controller == 0) {
+ mUsb3DebugPort.Controller = GetUsb3DebugPortController();
+ }
+
+ Bus = mUsb3DebugPort.PciAddress.Bus;
+ Device = mUsb3DebugPort.PciAddress.Device;
+ Function = mUsb3DebugPort.PciAddress.Function;
+
+ Low = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET));
+ High = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4));
+ Address = (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Low);
+ //
+ // Mask other parts which are not part of base address
+ //
+ Address &= XHCI_BASE_ADDRESS_64_BIT_MASK;
+ return Address;
+}
+
+/**
+ Return XHCI debug instance address.
+
+**/
+USB3_DEBUG_PORT_INSTANCE *
+GetUsb3DebugPortInstance (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+ UINT64 CapabilityPointer;
+ UINT32 Capability;
+ BOOLEAN Flag;
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT16 Command;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+
+ Instance = NULL;
+
+ XhcMmioBase = GetXhciBaseAddress ();
+
+ if ((XhcMmioBase == 0) || (XhcMmioBase == XHCI_BASE_ADDRESS_64_BIT_MASK)) {
+ return NULL;
+ }
+
+ if (mUsb3Instance != NULL) {
+ FixUsb3InstanceResource (mUsb3Instance, XhcMmioBase);
+ return mUsb3Instance;
+ }
+
+ Command = GetXhciPciCommand ();
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+
+ //
+ // Set Command Register
+ //
+ if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) == 0) {
+ PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE);
+ PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ }
+
+ //
+ // Calculate capability offset from HCCPARAMS [16:31], in 32-bit words
+ //
+ CapabilityPointer = XhcMmioBase + (MmioRead32 ((UINTN)(XhcMmioBase + XHC_HCCPARAMS_OFFSET)) >> 16) * 4;
+
+ //
+ // Search XHCI debug capability
+ //
+ Flag = FALSE;
+ Capability = MmioRead32 ((UINTN)CapabilityPointer);
+ while (TRUE) {
+ if ((Capability & XHC_CAPABILITY_ID_MASK) == PCI_CAPABILITY_ID_DEBUG_PORT) {
+ Flag = TRUE;
+ break;
+ }
+ if ((((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) & XHC_CAPABILITY_ID_MASK) == 0) {
+ //
+ // Reach the end of list, quit
+ //
+ break;
+ }
+ CapabilityPointer += ((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) * 4;
+ Capability = MmioRead32 ((UINTN)CapabilityPointer);
+ }
+
+ if (Flag) {
+ Instance = (USB3_DEBUG_PORT_INSTANCE *)(UINTN) MmioRead32 ((UINTN) (CapabilityPointer + XHC_DC_DCDDI2));
+
+ if (Instance != NULL) {
+ FixUsb3InstanceResource (Instance, XhcMmioBase);
+ }
+ }
+
+ //
+ // Restore Command Register
+ //
+ PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command);
+
+ return Instance;
+}
+
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The USB3 debug port was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3Initialize (
+ VOID
+ )
+{
+ //
+ // Leave it empty, we assume PEI phase already do initialization
+ //
+ return RETURN_SUCCESS;
+}
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3InitializeReal (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE UsbDbg;
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PHYSICAL_ADDRESS Address;
+ EFI_STATUS Status;
+
+ if ((gST == NULL) || (gBS == NULL)) {
+ //
+ // gST and gBS have not been initialized yet
+ //
+ return EFI_DEVICE_ERROR;
+ }
+
+ Status = EfiGetSystemConfigurationTable (&gUsb3DbgGuid, (VOID **) &mUsb3Instance);
+ if (!EFI_ERROR (Status)) {
+ return RETURN_SUCCESS;
+ }
+
+ //
+ // It is first time to run DXE instance, copy Instance from Hob to ACPINvs
+ // NOTE: Hob is not ready at this time, so copy it from XHCI register.
+ //
+ Instance = GetUsb3DebugPortInstance ();
+ if (Instance == NULL) {
+ //
+ // Initialize USB debug
+ //
+ SetMem (&UsbDbg, sizeof(UsbDbg), 0);
+ DiscoverUsb3DebugPort (&UsbDbg);
+ if (UsbDbg.DebugSupport) {
+ InitializeUsb3DebugPort (&UsbDbg);
+ }
+ Instance = &UsbDbg;
+ }
+ Address = SIZE_4GB;
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiACPIMemoryNVS,
+ EFI_SIZE_TO_PAGES (sizeof (USB3_DEBUG_PORT_INSTANCE)),
+ &Address
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ CopyMem (
+ (VOID *)(UINTN)Address,
+ Instance,
+ sizeof (USB3_DEBUG_PORT_INSTANCE)
+ );
+ mUsb3Instance = (USB3_DEBUG_PORT_INSTANCE *)(UINTN)Address;
+
+ Status = gBS->InstallConfigurationTable (&gUsb3DbgGuid, mUsb3Instance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (mUsb3Instance->DebugSupport) {
+ SaveUsb3InstanceAddress (mUsb3Instance);
+ }
+
+ return RETURN_SUCCESS;
+}
+
+/**
+ Calculate the size of XHCI MMIO space.
+
+ @retval TURE The XHCI MMIO is in SMRAM ranges.
+ @retval FALSE The XHCI MMIO is out of SMRAM ranges.
+**/
+UINT64
+CalculateMmioSize (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT32 Value;
+ UINT32 Mask;
+ UINT64 MmioSize;
+ UINT16 Command;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+
+ Mask = 0xFFFFFFF0;
+ MmioSize = 0;
+
+ XhcMmioBase = GetXhciBaseAddress ();
+
+ //
+ // Disable MSE
+ //
+ Command = PciRead16 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command & ~(EFI_PCI_COMMAND_MEMORY_SPACE));
+
+ //
+ // Get Mmio Size
+ //
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET), 0xFFFFFFFF);
+ Value = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET));
+
+ switch (Value & 0x07) {
+ case 0x0:
+ //
+ // Memory space: anywhere in 32 bit address space
+ //
+ MmioSize = (~(Value & Mask)) + 1;
+ break;
+ case 0x4:
+ //
+ // Memory space: anywhere in 64 bit address space
+ //
+ MmioSize = Value & Mask;
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4), 0xFFFFFFFF);
+ Value = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4));
+ //
+ // Fix the length to support some spefic 64 bit BAR
+ //
+ Value |= ((UINT32)(-1) << HighBitSet32 (Value));
+ //
+ // Calculate the size of 64bit bar
+ //
+ MmioSize |= LShiftU64 ((UINT64) Value, 32);
+ MmioSize = (~(MmioSize)) + 1;
+ break;
+ default:
+ //
+ // Unknown BAR type
+ //
+ MmioSize = (~(Value & Mask)) + 1;
+ break;
+ };
+
+
+ //
+ // Restore MMIO address
+ //
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET), (UINT32)XhcMmioBase);
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4), (UINT32) (XhcMmioBase >> 32));
+
+ PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE);
+
+ return MmioSize;
+}
+
+/**
+ The constructor function initialize USB3 debug port.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+Usb3DebugPortLibDxeConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_SMM_BASE2_PROTOCOL *SmmBase;
+ EFI_SMM_ACCESS2_PROTOCOL *SmmAccess;
+ UINTN Size;
+ EFI_STATUS Status;
+
+ //
+ // Do real initialization here, because we need copy data from Hob to ACPINvs.
+ // We must do it in constructor because it depends on UefiBootServicesTableLib.
+ //
+ if (FeaturePcdGet (PcdUsb3DebugFeatureEnable)) {
+ USB3InitializeReal ();
+ }
+
+ mUsb3MmioSize = CalculateMmioSize ();
+
+ if (gBS != NULL) {
+ SmmBase = NULL;
+ Status = gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID **)&SmmBase);
+ if (!EFI_ERROR (Status)) {
+ SmmBase->InSmm(SmmBase, &mUsb3InSmm);
+ }
+
+ if (mUsb3InSmm) {
+ //
+ // Get SMRAM information
+ //
+ SmmAccess = NULL;
+ Status = gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID **)&SmmAccess);
+ if (!EFI_ERROR (Status)) {
+ Size = sizeof (mSmramCheckRanges);
+
+ Status = SmmAccess->GetCapabilities (SmmAccess, &Size, mSmramCheckRanges);
+ if (!EFI_ERROR (Status)) {
+ mSmramCheckRangeCount = Size / sizeof (EFI_SMRAM_DESCRIPTOR);
+ }
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Allocate aligned memory for XHC's usage.
+
+ @param BufferSize The size, in bytes, of the Buffer.
+
+ @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID*
+AllocateAlignBuffer (
+ IN UINTN BufferSize
+ )
+{
+ VOID *Buf;
+ EFI_PHYSICAL_ADDRESS Address;
+ EFI_STATUS Status;
+
+ Buf = NULL;
+
+ if (gBS != NULL) {
+ Address = 0xFFFFFFFF;
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiACPIMemoryNVS,
+ EFI_SIZE_TO_PAGES (BufferSize),
+ &Address
+ );
+ if (!EFI_ERROR (Status)) {
+ Buf = (VOID *)(UINTN)Address;
+ }
+ }
+
+ return Buf;
+}
+
+/**
+ Check whether AllocatePages in permanent memory is ready.
+
+ @retval TRUE AllocatePages in permanent memory is ready.
+ @retval FALSE AllocatePages in permanent memory is not ready.
+
+**/
+BOOLEAN
+IsAllocatePagesReady (
+ VOID
+ )
+{
+ if (gBS != NULL) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c
new file mode 100644
index 0000000000..7d2b4fe18b
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c
@@ -0,0 +1,828 @@
+/** @file
+ Usb3 Debug Port library instance
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <PiDxe.h>
+#include <Library/SerialPortLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+#include <Library/PciLib.h>
+#include <Library/PcdLib.h>
+#include <Library/TimerLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+#include <Protocol/SmmBase2.h>
+#include <Protocol/SmmAccess2.h>
+#include <Protocol/IoMmu.h>
+#include <Protocol/PciIo.h>
+#include <Protocol/DxeSmmReadyToLock.h>
+#include "Usb3DebugPortLibInternal.h"
+
+extern EFI_SMRAM_DESCRIPTOR mSmramCheckRanges[MAX_SMRAM_RANGE];
+extern UINTN mSmramCheckRangeCount;
+extern BOOLEAN mUsb3InSmm;
+extern UINT64 mUsb3MmioSize;
+extern BOOLEAN mUsb3GetCapSuccess;
+
+GUID gUsb3DbgGuid = USB3_DBG_GUID;
+
+USB3_DEBUG_PORT_CONTROLLER mUsb3DebugPort;
+USB3_DEBUG_PORT_INSTANCE *mUsb3Instance = NULL;
+EFI_PCI_IO_PROTOCOL *mUsb3PciIo = NULL;
+
+/**
+ Creates a named event that can be signaled.
+
+ This function creates an event using NotifyTpl, NoifyFunction.
+ If Name is NULL, then ASSERT().
+ If NotifyTpl is not a legal TPL value, then ASSERT().
+ If NotifyFunction is NULL, then ASSERT().
+
+ @param Name Supplies the GUID name of the event.
+ @param NotifyTpl Supplies the task priority level of the event notifications.
+ @param NotifyFunction Supplies the function to notify when the event is signaled.
+ @param Event A pointer to the event created.
+
+ @retval EFI_SUCCESS A named event was created.
+ @retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.
+
+**/
+EFI_STATUS
+EFIAPI
+Usb3NamedEventListen (
+ IN CONST EFI_GUID *Name,
+ IN EFI_TPL NotifyTpl,
+ IN EFI_EVENT_NOTIFY NotifyFunction,
+ IN EFI_EVENT *Event
+ )
+{
+ EFI_STATUS Status;
+ VOID *RegistrationLocal;
+
+ ASSERT (Name != NULL);
+ ASSERT (NotifyFunction != NULL);
+ ASSERT (NotifyTpl <= TPL_HIGH_LEVEL);
+
+ //
+ // Create event
+ //
+ Status = gBS->CreateEvent (
+ EVT_NOTIFY_SIGNAL,
+ NotifyTpl,
+ NotifyFunction,
+ NULL,
+ Event
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Register for an installation of protocol interface
+ //
+ Status = gBS->RegisterProtocolNotify (
+ (EFI_GUID *) Name,
+ *Event,
+ &RegistrationLocal
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+/**
+ USB3 map one DMA buffer.
+
+ @param PciIo Pointer to PciIo for USB3 debug port.
+ @param Address DMA buffer address to be mapped.
+ @param NumberOfBytes Number of bytes to be mapped.
+
+**/
+VOID
+Usb3MapOneDmaBuffer (
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN EFI_PHYSICAL_ADDRESS Address,
+ IN UINTN NumberOfBytes
+ )
+{
+ EFI_STATUS Status;
+ VOID *HostAddress;
+ EFI_PHYSICAL_ADDRESS DeviceAddress;
+ VOID *Mapping;
+
+ HostAddress = (VOID *) (UINTN) Address;
+ Status = PciIo->Map (
+ PciIo,
+ EfiPciIoOperationBusMasterCommonBuffer,
+ HostAddress,
+ &NumberOfBytes,
+ &DeviceAddress,
+ &Mapping
+ );
+ ASSERT_EFI_ERROR (Status);
+ ASSERT (DeviceAddress == ((EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress));
+}
+
+/**
+ USB3 map DMA buffers.
+
+ @param Instance Pointer to USB3 debug port instance.
+ @param PciIo Pointer to PciIo for USB3 debug port.
+
+**/
+VOID
+Usb3MapDmaBuffers (
+ IN USB3_DEBUG_PORT_INSTANCE *Instance,
+ IN EFI_PCI_IO_PROTOCOL *PciIo
+ )
+{
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ Instance->Urb.Data,
+ XHC_DEBUG_PORT_DATA_LENGTH
+ );
+
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ Instance->TransferRingIn.RingSeg0,
+ sizeof (TRB_TEMPLATE) * TR_RING_TRB_NUMBER
+ );
+
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ Instance->TransferRingOut.RingSeg0,
+ sizeof (TRB_TEMPLATE) * TR_RING_TRB_NUMBER
+ );
+
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ Instance->EventRing.EventRingSeg0,
+ sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMBER
+ );
+
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ Instance->EventRing.ERSTBase,
+ sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERST_NUMBER
+ );
+
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ Instance->DebugCapabilityContext,
+ sizeof (XHC_DC_CONTEXT)
+ );
+
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ ((XHC_DC_CONTEXT *) (UINTN) Instance->DebugCapabilityContext)->DbcInfoContext.String0DescAddress,
+ STRING0_DESC_LEN + MANU_DESC_LEN + PRODUCT_DESC_LEN + SERIAL_DESC_LEN
+ );
+}
+
+/**
+ Invoke a notification event
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context The pointer to the notification function's context,
+ which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+Usb3DxeSmmReadyToLockNotify (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ ASSERT (mUsb3Instance != NULL);
+
+ //
+ // For the case that the USB3 debug port instance and DMA buffers are
+ // from PEI HOB with IOMMU enabled.
+ // Reinitialize USB3 debug port with granted DXE DMA buffer accessible
+ // by SMM environment.
+ //
+ InitializeUsb3DebugPort (mUsb3Instance);
+
+ SaveUsb3InstanceAddress (mUsb3Instance);
+
+ gBS->CloseEvent (Event);
+}
+
+/**
+ USB3 get IOMMU protocol.
+
+ @return Pointer to IOMMU protocol.
+
+**/
+EDKII_IOMMU_PROTOCOL *
+Usb3GetIoMmu (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EDKII_IOMMU_PROTOCOL *IoMmu;
+
+ IoMmu = NULL;
+ Status = gBS->LocateProtocol (
+ &gEdkiiIoMmuProtocolGuid,
+ NULL,
+ (VOID **) &IoMmu
+ );
+ if (!EFI_ERROR (Status) && (IoMmu != NULL)) {
+ return IoMmu;
+ }
+
+ return NULL;
+}
+
+/**
+ Invoke a notification event
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context The pointer to the notification function's context,
+ which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+Usb3PciIoNotify (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ UINTN PciIoHandleCount;
+ EFI_HANDLE *PciIoHandleBuffer;
+ UINTN Index;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UINTN PciSegment;
+ UINTN PciBusNumber;
+ UINTN PciDeviceNumber;
+ UINTN PciFunctionNumber;
+ EFI_EVENT SmmReadyToLockEvent;
+
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiPciIoProtocolGuid,
+ NULL,
+ &PciIoHandleCount,
+ &PciIoHandleBuffer
+ );
+ if (!EFI_ERROR (Status) &&
+ (PciIoHandleBuffer != NULL) &&
+ (PciIoHandleCount != 0)) {
+ for (Index = 0; Index < PciIoHandleCount; Index++) {
+ Status = gBS->HandleProtocol (
+ PciIoHandleBuffer[Index],
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PciIo->GetLocation (PciIo, &PciSegment, &PciBusNumber, &PciDeviceNumber, &PciFunctionNumber);
+ ASSERT_EFI_ERROR (Status);
+ if ((PciBusNumber == mUsb3DebugPort.PciAddress.Bus) &&
+ (PciDeviceNumber == mUsb3DebugPort.PciAddress.Device) &&
+ (PciFunctionNumber == mUsb3DebugPort.PciAddress.Function)) {
+ //
+ // Found the PciIo for USB3 debug port.
+ //
+ ASSERT (mUsb3Instance != NULL);
+ if (Usb3GetIoMmu () != NULL) {
+ Usb3MapDmaBuffers (mUsb3Instance, PciIo);
+
+ if (mUsb3Instance->FromHob) {
+ mUsb3PciIo = PciIo;
+ Usb3NamedEventListen (
+ &gEfiDxeSmmReadyToLockProtocolGuid,
+ TPL_NOTIFY,
+ Usb3DxeSmmReadyToLockNotify,
+ &SmmReadyToLockEvent
+ );
+ }
+ }
+ gBS->CloseEvent (Event);
+ break;
+ }
+ }
+
+ gBS->FreePool (PciIoHandleBuffer);
+ }
+}
+
+/**
+ Return XHCI MMIO base address.
+
+**/
+EFI_PHYSICAL_ADDRESS
+GetXhciBaseAddress (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ EFI_PHYSICAL_ADDRESS Address;
+ UINT32 Low;
+ UINT32 High;
+
+ if (mUsb3DebugPort.Controller == 0) {
+ mUsb3DebugPort.Controller = GetUsb3DebugPortController();
+ }
+
+ Bus = mUsb3DebugPort.PciAddress.Bus;
+ Device = mUsb3DebugPort.PciAddress.Device;
+ Function = mUsb3DebugPort.PciAddress.Function;
+
+ Low = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET));
+ High = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4));
+ Address = (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Low);
+ //
+ // Mask other parts which are not part of base address
+ //
+ Address &= XHCI_BASE_ADDRESS_64_BIT_MASK;
+ return Address;
+}
+
+/**
+ Return XHCI debug instance address.
+
+**/
+USB3_DEBUG_PORT_INSTANCE *
+GetUsb3DebugPortInstance (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+ UINT64 CapabilityPointer;
+ UINT32 Capability;
+ BOOLEAN Flag;
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT16 Command;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+
+ Instance = NULL;
+
+ XhcMmioBase = GetXhciBaseAddress ();
+
+ if ((XhcMmioBase == 0) || (XhcMmioBase == XHCI_BASE_ADDRESS_64_BIT_MASK)) {
+ return NULL;
+ }
+
+ if (mUsb3Instance != NULL) {
+ FixUsb3InstanceResource (mUsb3Instance, XhcMmioBase);
+ return mUsb3Instance;
+ }
+
+ Command = GetXhciPciCommand ();
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+
+ //
+ // Set Command Register
+ //
+ if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) == 0) {
+ PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE);
+ PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ }
+
+ //
+ // Calculate capability offset from HCCPARAMS [16:31], in 32-bit words
+ //
+ CapabilityPointer = XhcMmioBase + (MmioRead32 ((UINTN)(XhcMmioBase + XHC_HCCPARAMS_OFFSET)) >> 16) * 4;
+
+ //
+ // Search XHCI debug capability
+ //
+ Flag = FALSE;
+ Capability = MmioRead32 ((UINTN)CapabilityPointer);
+ while (TRUE) {
+ if ((Capability & XHC_CAPABILITY_ID_MASK) == PCI_CAPABILITY_ID_DEBUG_PORT) {
+ Flag = TRUE;
+ break;
+ }
+ if ((((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) & XHC_CAPABILITY_ID_MASK) == 0) {
+ //
+ // Reach the end of list, quit
+ //
+ break;
+ }
+ CapabilityPointer += ((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) * 4;
+ Capability = MmioRead32 ((UINTN)CapabilityPointer);
+ }
+
+ if (Flag) {
+ Instance = (USB3_DEBUG_PORT_INSTANCE *)(UINTN) MmioRead32 ((UINTN) (CapabilityPointer + XHC_DC_DCDDI2));
+
+ if (Instance != NULL) {
+ FixUsb3InstanceResource (Instance, XhcMmioBase);
+ }
+ }
+
+ //
+ // Restore Command Register
+ //
+ PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command);
+
+ return Instance;
+}
+
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The USB3 debug port was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3Initialize (
+ VOID
+ )
+{
+ //
+ // Leave it empty, we assume PEI phase already do initialization
+ //
+ return RETURN_SUCCESS;
+}
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3InitializeReal (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE UsbDbg;
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PHYSICAL_ADDRESS Address;
+ EFI_STATUS Status;
+ EFI_EVENT Event;
+
+ if ((gST == NULL) || (gBS == NULL)) {
+ //
+ // gST and gBS have not been initialized yet
+ //
+ return EFI_DEVICE_ERROR;
+ }
+
+ Status = EfiGetSystemConfigurationTable (&gUsb3DbgGuid, (VOID **) &mUsb3Instance);
+ if (!EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+ //
+ // It is first time to run DXE instance, copy Instance from Hob to ACPINvs
+ // NOTE: Hob is not ready at this time, so copy it from XHCI register.
+ //
+ Instance = GetUsb3DebugPortInstance ();
+ if (Instance == NULL) {
+ //
+ // Initialize USB debug
+ //
+ SetMem (&UsbDbg, sizeof(UsbDbg), 0);
+ DiscoverUsb3DebugPort (&UsbDbg);
+ if (UsbDbg.DebugSupport) {
+ InitializeUsb3DebugPort (&UsbDbg);
+ }
+ Instance = &UsbDbg;
+ }
+ Address = SIZE_4GB;
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiACPIMemoryNVS,
+ EFI_SIZE_TO_PAGES (sizeof (USB3_DEBUG_PORT_INSTANCE)),
+ &Address
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ CopyMem (
+ (VOID *)(UINTN)Address,
+ Instance,
+ sizeof (USB3_DEBUG_PORT_INSTANCE)
+ );
+ mUsb3Instance = (USB3_DEBUG_PORT_INSTANCE *)(UINTN)Address;
+
+ Status = gBS->InstallConfigurationTable (&gUsb3DbgGuid, mUsb3Instance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (mUsb3Instance->DebugSupport) {
+ SaveUsb3InstanceAddress (mUsb3Instance);
+ }
+
+Done:
+ if ((mUsb3Instance != NULL) && mUsb3Instance->Ready && (mUsb3Instance->PciIoEvent == 0)) {
+ Status = Usb3NamedEventListen (
+ &gEfiPciIoProtocolGuid,
+ TPL_NOTIFY,
+ Usb3PciIoNotify,
+ &Event
+ );
+ if (!EFI_ERROR (Status)) {
+ mUsb3Instance->PciIoEvent = (EFI_PHYSICAL_ADDRESS) (UINTN) Event;
+ }
+ }
+
+ return RETURN_SUCCESS;
+}
+
+/**
+ Calculate the size of XHCI MMIO space.
+
+ @retval TURE The XHCI MMIO is in SMRAM ranges.
+ @retval FALSE The XHCI MMIO is out of SMRAM ranges.
+**/
+UINT64
+CalculateMmioSize (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT32 Value;
+ UINT32 Mask;
+ UINT64 MmioSize;
+ UINT16 Command;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+
+ Mask = 0xFFFFFFF0;
+ MmioSize = 0;
+
+ XhcMmioBase = GetXhciBaseAddress ();
+
+ //
+ // Disable MSE
+ //
+ Command = PciRead16 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET));
+ PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command & ~(EFI_PCI_COMMAND_MEMORY_SPACE));
+
+ //
+ // Get Mmio Size
+ //
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET), 0xFFFFFFFF);
+ Value = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET));
+
+ switch (Value & 0x07) {
+ case 0x0:
+ //
+ // Memory space: anywhere in 32 bit address space
+ //
+ MmioSize = (~(Value & Mask)) + 1;
+ break;
+ case 0x4:
+ //
+ // Memory space: anywhere in 64 bit address space
+ //
+ MmioSize = Value & Mask;
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4), 0xFFFFFFFF);
+ Value = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4));
+ //
+ // Fix the length to support some spefic 64 bit BAR
+ //
+ Value |= ((UINT32)(-1) << HighBitSet32 (Value));
+ //
+ // Calculate the size of 64bit bar
+ //
+ MmioSize |= LShiftU64 ((UINT64) Value, 32);
+ MmioSize = (~(MmioSize)) + 1;
+ break;
+ default:
+ //
+ // Unknown BAR type
+ //
+ MmioSize = (~(Value & Mask)) + 1;
+ break;
+ };
+
+
+ //
+ // Restore MMIO address
+ //
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET), (UINT32)XhcMmioBase);
+ PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4), (UINT32) (XhcMmioBase >> 32));
+
+ PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), Command | EFI_PCI_COMMAND_MEMORY_SPACE);
+
+ return MmioSize;
+}
+
+/**
+ The constructor function initialize USB3 debug port.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+Usb3DebugPortLibDxeConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_SMM_BASE2_PROTOCOL *SmmBase;
+ EFI_SMM_ACCESS2_PROTOCOL *SmmAccess;
+ UINTN Size;
+ EFI_STATUS Status;
+
+ //
+ // Do real initialization here, because we need copy data from Hob to ACPINvs.
+ // We must do it in constructor because it depends on UefiBootServicesTableLib.
+ //
+ if (FeaturePcdGet (PcdUsb3DebugFeatureEnable)) {
+ USB3InitializeReal ();
+ }
+
+ mUsb3MmioSize = CalculateMmioSize ();
+
+ if (gBS != NULL) {
+ SmmBase = NULL;
+ Status = gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID **)&SmmBase);
+ if (!EFI_ERROR (Status)) {
+ SmmBase->InSmm(SmmBase, &mUsb3InSmm);
+ }
+
+ if (mUsb3InSmm) {
+ //
+ // Get SMRAM information
+ //
+ SmmAccess = NULL;
+ Status = gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID **)&SmmAccess);
+ if (!EFI_ERROR (Status)) {
+ Size = sizeof (mSmramCheckRanges);
+
+ Status = SmmAccess->GetCapabilities (SmmAccess, &Size, mSmramCheckRanges);
+ if (!EFI_ERROR (Status)) {
+ mSmramCheckRangeCount = Size / sizeof (EFI_SMRAM_DESCRIPTOR);
+ }
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ The destructor function.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The destructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+Usb3DebugPortLibDxeDestructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ if ((mUsb3Instance != NULL) && (mUsb3Instance->PciIoEvent != 0)) {
+ //
+ // Close the event created.
+ //
+ gBS->CloseEvent ((EFI_EVENT) (UINTN) mUsb3Instance->PciIoEvent);
+ mUsb3Instance->PciIoEvent = 0;
+ }
+ return EFI_SUCCESS;
+}
+
+/**
+ Allocates pages that are suitable for an OperationBusMasterCommonBuffer or
+ OperationBusMasterCommonBuffer64 mapping.
+
+ @param PciIo Pointer to PciIo for USB3 debug port.
+ @param Pages The number of pages to allocate.
+ @param Address A pointer to store the base system memory address of the
+ allocated range.
+
+ @retval EFI_SUCCESS The requested memory pages were allocated.
+ @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
+ MEMORY_WRITE_COMBINE and MEMORY_CACHED.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+ @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
+
+**/
+EFI_STATUS
+Usb3AllocateDmaBuffer (
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINTN Pages,
+ OUT VOID **Address
+ )
+{
+ EFI_STATUS Status;
+
+ *Address = NULL;
+ Status = PciIo->AllocateBuffer (
+ PciIo,
+ AllocateAnyPages,
+ EfiRuntimeServicesData,
+ Pages,
+ Address,
+ 0
+ );
+ if (!EFI_ERROR (Status)) {
+ Usb3MapOneDmaBuffer (
+ PciIo,
+ (EFI_PHYSICAL_ADDRESS) (UINTN) *Address,
+ EFI_PAGES_TO_SIZE (Pages)
+ );
+ }
+ return Status;
+}
+
+/**
+ Allocate aligned memory for XHC's usage.
+
+ @param BufferSize The size, in bytes, of the Buffer.
+
+ @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID*
+AllocateAlignBuffer (
+ IN UINTN BufferSize
+ )
+{
+ VOID *Buf;
+ EFI_PHYSICAL_ADDRESS Address;
+ EFI_STATUS Status;
+
+ Buf = NULL;
+
+ if (gBS != NULL) {
+ if (mUsb3PciIo != NULL) {
+ Usb3AllocateDmaBuffer (
+ mUsb3PciIo,
+ EFI_SIZE_TO_PAGES (BufferSize),
+ &Buf
+ );
+ } else {
+ Address = 0xFFFFFFFF;
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiACPIMemoryNVS,
+ EFI_SIZE_TO_PAGES (BufferSize),
+ &Address
+ );
+ if (!EFI_ERROR (Status)) {
+ Buf = (VOID *)(UINTN)Address;
+ }
+ }
+ }
+
+ return Buf;
+}
+
+/**
+ Check whether AllocatePages in permanent memory is ready.
+
+ @retval TRUE AllocatePages in permanent memory is ready.
+ @retval FALSE AllocatePages in permanent memory is not ready.
+
+**/
+BOOLEAN
+IsAllocatePagesReady (
+ VOID
+ )
+{
+ if (gBS != NULL) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c
new file mode 100644
index 0000000000..319cebecbb
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c
@@ -0,0 +1,103 @@
+/** @file
+ Usb Debug Port library NULL instance
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+/**
+ Initialize the USB3 debug port hardware.
+
+ If no initialization is required, then return RETURN_SUCCESS.
+ If the serial device was successfully initialized, then return RETURN_SUCCESS.
+ If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+ @retval RETURN_DEVICE_ERROR The serial device could not be initialized.
+
+**/
+RETURN_STATUS
+EFIAPI
+Usb3DebugPortInitialize (
+ VOID
+ )
+{
+ return RETURN_SUCCESS;
+}
+
+/**
+ Write data from buffer to USB3 debug port.
+
+ Writes NumberOfBytes data bytes from Buffer to the serial device.
+ The number of bytes actually written to the serial device is returned.
+ If the return value is less than NumberOfBytes, then the write operation failed.
+ If Buffer is NULL, then ASSERT().
+ If NumberOfBytes is zero, then return 0.
+
+ @param Buffer Pointer to the data buffer to be written.
+ @param NumberOfBytes Number of bytes to written to the serial device.
+
+ @retval 0 NumberOfBytes is 0.
+ @retval >0 The number of bytes written to the serial device.
+ If this value is less than NumberOfBytes, then the read operation failed.
+
+**/
+UINTN
+EFIAPI
+Usb3DebugPortWrite (
+ IN UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
+{
+ return 0;
+}
+
+
+/**
+ Read data from USB3 debug port and save the datas in buffer.
+
+ Reads NumberOfBytes data bytes from a serial device into the buffer
+ specified by Buffer. The number of bytes actually read is returned.
+ If the return value is less than NumberOfBytes, then the rest operation failed.
+ If Buffer is NULL, then ASSERT().
+ If NumberOfBytes is zero, then return 0.
+
+ @param Buffer Pointer to the data buffer to store the data read from the serial device.
+ @param NumberOfBytes Number of bytes which will be read.
+
+ @retval 0 Read data failed, no data is to be read.
+ @retval >0 Actual number of bytes read from serial device.
+
+**/
+UINTN
+EFIAPI
+Usb3DebugPortRead (
+ OUT UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
+{
+ return 0;
+}
+
+/**
+ Polls a USB3 debug port to see if there is any data waiting to be read.
+
+ Polls a serial device to see if there is any data waiting to be read.
+ If there is data waiting to be read from the serial device, then TRUE is returned.
+ If there is no data waiting to be read from the serial device, then FALSE is returned.
+
+ @retval TRUE Data is waiting to be read from the serial device.
+ @retval FALSE There is no data waiting to be read from the serial device.
+
+**/
+BOOLEAN
+EFIAPI
+Usb3DebugPortPoll (
+ VOID
+ )
+{
+ return FALSE;
+}
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c
new file mode 100644
index 0000000000..fa6eaad9bf
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c
@@ -0,0 +1,236 @@
+/** @file
+ Usb Debug Port library instance
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <PiPei.h>
+#include <Library/SerialPortLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PciLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+#include <Library/TimerLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+#include <Library/PeiServicesTablePointerLib.h>
+#include <Ppi/MemoryDiscovered.h>
+#include "Usb3DebugPortLibInternal.h"
+
+GUID gUsb3DbgGuid = USB3_DBG_GUID;
+
+/**
+ Return XHCI MMIO base address.
+
+**/
+EFI_PHYSICAL_ADDRESS
+GetXhciBaseAddress (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ EFI_PHYSICAL_ADDRESS Address;
+ UINT32 Low;
+ UINT32 High;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+ Low = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET));
+ High = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4));
+ Address = (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Low);
+
+ //
+ // Mask other parts which are not part of base address
+ //
+ Address &= XHCI_BASE_ADDRESS_64_BIT_MASK;
+ return Address;
+}
+
+/**
+ Return XHCI debug instance address.
+
+**/
+USB3_DEBUG_PORT_INSTANCE *
+GetUsb3DebugPortInstance (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PEI_HOB_POINTERS Hob;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+
+ Hob.Raw = GetFirstGuidHob (&gUsb3DbgGuid);
+ if (Hob.Raw == NULL) {
+ return NULL;
+ }
+ Instance = GET_GUID_HOB_DATA (Hob.Guid);
+
+ //
+ // Update XHCI MMIO base address
+ //
+ XhcMmioBase = GetXhciBaseAddress ();
+
+ FixUsb3InstanceResource (Instance, XhcMmioBase);
+
+ return Instance;
+}
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3Initialize (
+ VOID
+ )
+{
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3InitializeReal (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE UsbDbg;
+ VOID *DataPtr;
+ EFI_PEI_HOB_POINTERS Hob;
+
+ //
+ // USB Initilization has to be done only once. So this function should just return when
+ // it is called more than once.
+ //
+ Hob.Raw = GetFirstGuidHob (&gUsb3DbgGuid);
+ if (Hob.Raw != NULL) {
+ return RETURN_SUCCESS;
+ }
+
+ //
+ // Initialize USB debug for PEI at the first time
+ //
+ SetMem (&UsbDbg, sizeof(UsbDbg), 0);
+ UsbDbg.FromHob = TRUE;
+ DiscoverUsb3DebugPort (&UsbDbg);
+ if (UsbDbg.DebugSupport) {
+ InitializeUsb3DebugPort (&UsbDbg);
+ }
+
+ //
+ // Save Instance into HOB
+ //
+ DataPtr = BuildGuidDataHob (
+ &gUsb3DbgGuid,
+ (VOID*) &UsbDbg,
+ sizeof (UsbDbg)
+ );
+
+ if (UsbDbg.DebugSupport) {
+ SaveUsb3InstanceAddress ((USB3_DEBUG_PORT_INSTANCE *) DataPtr);
+ }
+
+ return RETURN_SUCCESS;
+}
+
+/**
+ Allocate aligned memory for XHC's usage.
+
+ @param BufferSize The size, in bytes, of the Buffer.
+
+ @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID*
+AllocateAlignBuffer (
+ IN UINTN BufferSize
+ )
+{
+ VOID *Buf;
+ EFI_PHYSICAL_ADDRESS Address;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_STATUS Status;
+ VOID *MemoryDiscoveredPpi;
+
+ Buf = NULL;
+ PeiServices = GetPeiServicesTablePointer ();
+
+ //
+ // Make sure the allocated memory is physical memory.
+ //
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEfiPeiMemoryDiscoveredPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &MemoryDiscoveredPpi
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = (*PeiServices)->AllocatePages (
+ PeiServices,
+ EfiACPIMemoryNVS,
+ EFI_SIZE_TO_PAGES (BufferSize),
+ &Address
+ );
+ if (!EFI_ERROR (Status)) {
+ Buf = (VOID *)(UINTN) Address;
+ }
+ }
+ return Buf;
+}
+
+/**
+ Check whether AllocatePages in permanent memory is ready.
+
+ @retval TRUE AllocatePages in permanent memory is ready.
+ @retval FALSE AllocatePages in permanent memory is not ready.
+
+**/
+BOOLEAN
+IsAllocatePagesReady (
+ VOID
+ )
+{
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_STATUS Status;
+ VOID *MemoryDiscoveredPpi;
+
+ PeiServices = GetPeiServicesTablePointer ();
+
+ //
+ // Make sure the allocated memory is physical memory.
+ //
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEfiPeiMemoryDiscoveredPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &MemoryDiscoveredPpi
+ );
+ if (!EFI_ERROR (Status)) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c
new file mode 100644
index 0000000000..9a7d10f39f
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c
@@ -0,0 +1,440 @@
+/** @file
+ Usb Debug Port library instance
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <PiPei.h>
+#include <Library/SerialPortLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PciLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+#include <Library/TimerLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+#include <Library/PeiServicesTablePointerLib.h>
+#include <Ppi/MemoryDiscovered.h>
+#include <Ppi/IoMmu.h>
+#include "Usb3DebugPortLibInternal.h"
+
+GUID gUsb3DbgGuid = USB3_DBG_GUID;
+
+/**
+ USB3 IOMMU PPI notify.
+
+ @param[in] PeiServices Pointer to PEI Services Table.
+ @param[in] NotifyDesc Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi Pointer to the PPI data associated with this function.
+
+ @retval EFI_STATUS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+EFIAPI
+Usb3IoMmuPpiNotify (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+
+ Instance = GetUsb3DebugPortInstance ();
+ ASSERT (Instance != NULL);
+ //
+ // Reinitialize USB3 debug port with granted DMA buffer from IOMMU PPI.
+ //
+ InitializeUsb3DebugPort (Instance);
+
+ SaveUsb3InstanceAddress (Instance);
+
+ return EFI_SUCCESS;
+}
+
+EFI_PEI_NOTIFY_DESCRIPTOR mUsb3IoMmuPpiNotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEdkiiIoMmuPpiGuid,
+ Usb3IoMmuPpiNotify
+};
+
+/**
+ Allocates pages that are suitable for an OperationBusMasterCommonBuffer or
+ OperationBusMasterCommonBuffer64 mapping.
+
+ @param IoMmu Pointer to IOMMU PPI.
+ @param Pages The number of pages to allocate.
+ @param HostAddress A pointer to store the base system memory address of the
+ allocated range.
+ @param DeviceAddress The resulting map address for the bus master PCI controller to use to
+ access the hosts HostAddress.
+ @param Mapping A resulting value to pass to Unmap().
+
+ @retval EFI_SUCCESS The requested memory pages were allocated.
+ @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
+ MEMORY_WRITE_COMBINE and MEMORY_CACHED.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+ @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
+
+**/
+EFI_STATUS
+IoMmuAllocateBuffer (
+ IN EDKII_IOMMU_PPI *IoMmu,
+ IN UINTN Pages,
+ OUT VOID **HostAddress,
+ OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
+ OUT VOID **Mapping
+ )
+{
+ EFI_STATUS Status;
+ UINTN NumberOfBytes;
+
+ *HostAddress = NULL;
+ *DeviceAddress = 0;
+ *Mapping = NULL;
+
+ Status = IoMmu->AllocateBuffer (
+ IoMmu,
+ EfiRuntimeServicesData,
+ Pages,
+ HostAddress,
+ 0
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ NumberOfBytes = EFI_PAGES_TO_SIZE (Pages);
+ Status = IoMmu->Map (
+ IoMmu,
+ EdkiiIoMmuOperationBusMasterCommonBuffer,
+ *HostAddress,
+ &NumberOfBytes,
+ DeviceAddress,
+ Mapping
+ );
+ if (EFI_ERROR (Status)) {
+ IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress);
+ *HostAddress = NULL;
+ return EFI_OUT_OF_RESOURCES;
+ }
+ Status = IoMmu->SetAttribute (
+ IoMmu,
+ *Mapping,
+ EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE
+ );
+ if (EFI_ERROR (Status)) {
+ IoMmu->Unmap (IoMmu, *Mapping);
+ IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress);
+ *Mapping = NULL;
+ *HostAddress = NULL;
+ return Status;
+ }
+
+ return Status;
+}
+
+/**
+ USB3 get IOMMU PPI.
+
+ @return Pointer to IOMMU PPI.
+
+**/
+EDKII_IOMMU_PPI *
+Usb3GetIoMmu (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EDKII_IOMMU_PPI *IoMmu;
+ CONST EFI_PEI_SERVICES **PeiServices;
+
+ PeiServices = GetPeiServicesTablePointer ();
+
+ IoMmu = NULL;
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEdkiiIoMmuPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &IoMmu
+ );
+ if (!EFI_ERROR (Status) && (IoMmu != NULL)) {
+ return IoMmu;
+ }
+
+ return NULL;
+}
+
+/**
+ Return XHCI MMIO base address.
+
+**/
+EFI_PHYSICAL_ADDRESS
+GetXhciBaseAddress (
+ VOID
+ )
+{
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+ EFI_PHYSICAL_ADDRESS Address;
+ UINT32 Low;
+ UINT32 High;
+
+ UsbDebugPort.Controller = GetUsb3DebugPortController();
+ Bus = UsbDebugPort.PciAddress.Bus;
+ Device = UsbDebugPort.PciAddress.Device;
+ Function = UsbDebugPort.PciAddress.Function;
+ Low = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET));
+ High = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4));
+ Address = (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Low);
+
+ //
+ // Mask other parts which are not part of base address
+ //
+ Address &= XHCI_BASE_ADDRESS_64_BIT_MASK;
+ return Address;
+}
+
+/**
+ Return XHCI debug instance address.
+
+**/
+USB3_DEBUG_PORT_INSTANCE *
+GetUsb3DebugPortInstance (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_INSTANCE *Instance;
+ EFI_PEI_HOB_POINTERS Hob;
+ EFI_PHYSICAL_ADDRESS XhcMmioBase;
+
+ Hob.Raw = GetFirstGuidHob (&gUsb3DbgGuid);
+ if (Hob.Raw == NULL) {
+ return NULL;
+ }
+ Instance = GET_GUID_HOB_DATA (Hob.Guid);
+
+ //
+ // Update XHCI MMIO base address
+ //
+ XhcMmioBase = GetXhciBaseAddress ();
+
+ FixUsb3InstanceResource (Instance, XhcMmioBase);
+
+ return Instance;
+}
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3Initialize (
+ VOID
+ )
+{
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize USB3 debug port.
+
+ This method invokes various internal functions to facilitate
+ detection and initialization of USB3 debug port.
+
+ @retval RETURN_SUCCESS The serial device was initialized.
+**/
+RETURN_STATUS
+EFIAPI
+USB3InitializeReal (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ USB3_DEBUG_PORT_INSTANCE UsbDbg;
+ VOID *DataPtr;
+ EFI_PEI_HOB_POINTERS Hob;
+ CONST EFI_PEI_SERVICES **PeiServices;
+
+ PeiServices = GetPeiServicesTablePointer ();
+
+ //
+ // USB Initilization has to be done only once. So this function should just return when
+ // it is called more than once.
+ //
+ Hob.Raw = GetFirstGuidHob (&gUsb3DbgGuid);
+ if (Hob.Raw != NULL) {
+ return RETURN_SUCCESS;
+ }
+
+ //
+ // Initialize USB debug for PEI at the first time
+ //
+ SetMem (&UsbDbg, sizeof(UsbDbg), 0);
+ UsbDbg.FromHob = TRUE;
+ DiscoverUsb3DebugPort (&UsbDbg);
+ if (UsbDbg.DebugSupport) {
+ InitializeUsb3DebugPort (&UsbDbg);
+ }
+
+ if (UsbDbg.Ready && (Usb3GetIoMmu () == NULL)) {
+ Status = (*PeiServices)->NotifyPpi (PeiServices, &mUsb3IoMmuPpiNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ //
+ // Save Instance into HOB
+ //
+ DataPtr = BuildGuidDataHob (
+ &gUsb3DbgGuid,
+ (VOID*) &UsbDbg,
+ sizeof (UsbDbg)
+ );
+
+ if (UsbDbg.DebugSupport) {
+ SaveUsb3InstanceAddress ((USB3_DEBUG_PORT_INSTANCE *) DataPtr);
+ }
+
+ return RETURN_SUCCESS;
+}
+
+/**
+ Allocate aligned memory for XHC's usage.
+
+ @param BufferSize The size, in bytes, of the Buffer.
+
+ @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID*
+AllocateAlignBuffer (
+ IN UINTN BufferSize
+ )
+{
+ VOID *Buf;
+ EFI_PHYSICAL_ADDRESS Address;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_STATUS Status;
+ VOID *MemoryDiscoveredPpi;
+ EDKII_IOMMU_PPI *IoMmu;
+ VOID *HostAddress;
+ VOID *Mapping;
+
+ Buf = NULL;
+ PeiServices = GetPeiServicesTablePointer ();
+
+ //
+ // Make sure the allocated memory is physical memory.
+ //
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEfiPeiMemoryDiscoveredPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &MemoryDiscoveredPpi
+ );
+ if (!EFI_ERROR (Status)) {
+ IoMmu = Usb3GetIoMmu ();
+ if (IoMmu != NULL) {
+ Status = IoMmuAllocateBuffer (
+ IoMmu,
+ EFI_SIZE_TO_PAGES (BufferSize),
+ &HostAddress,
+ &Address,
+ &Mapping
+ );
+ if (!EFI_ERROR (Status)) {
+ ASSERT (Address == ((EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress));
+ Buf = (VOID *)(UINTN) Address;
+ }
+ } else {
+ Status = (*PeiServices)->AllocatePages (
+ PeiServices,
+ EfiACPIMemoryNVS,
+ EFI_SIZE_TO_PAGES (BufferSize),
+ &Address
+ );
+ if (!EFI_ERROR (Status)) {
+ Buf = (VOID *)(UINTN) Address;
+ }
+ }
+ }
+ return Buf;
+}
+
+/**
+ Check whether AllocatePages in permanent memory is ready.
+
+ @retval TRUE AllocatePages in permanent memory is ready.
+ @retval FALSE AllocatePages in permanent memory is not ready.
+
+**/
+BOOLEAN
+IsAllocatePagesReady (
+ VOID
+ )
+{
+ CONST EFI_PEI_SERVICES **PeiServices;
+ EFI_STATUS Status;
+ VOID *MemoryDiscoveredPpi;
+ EDKII_IOMMU_PPI *IoMmu;
+ VOID *HostAddress;
+
+ PeiServices = GetPeiServicesTablePointer ();
+
+ //
+ // Make sure the allocated memory is physical memory.
+ //
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEfiPeiMemoryDiscoveredPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &MemoryDiscoveredPpi
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEdkiiIoMmuPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &IoMmu
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = IoMmu->AllocateBuffer (
+ IoMmu,
+ EfiRuntimeServicesData,
+ 1,
+ &HostAddress,
+ 0
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // DMA protection has been enabled,
+ // but DMA buffer could not be allocated yet.
+ //
+ return FALSE;
+ }
+ IoMmu->FreeBuffer (
+ IoMmu,
+ 1,
+ HostAddress
+ );
+ }
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.c b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.c
new file mode 100644
index 0000000000..84dfa25d8e
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortParamLibPcd/Usb3DebugPortParamLibPcd.c
@@ -0,0 +1,58 @@
+/** @file
+ USB3 debug Port Parameter library instance based on PCD.
+
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
+#include <Library/Usb3DebugPortParamLib.h>
+
+/**
+ Returns the USB3 debug port controller.
+ bit: 0~ 7: Function
+ bit: 8~15: Device
+ bit: 16~24: Bus
+
+ @return Controller information of USB debug port.
+
+**/
+UINT32
+EFIAPI
+GetUsb3DebugPortController (
+ VOID
+ )
+{
+ USB3_DEBUG_PORT_CONTROLLER UsbDebugPort;
+
+ UsbDebugPort.Controller = 0;
+ UsbDebugPort.PciAddress.Bus = PcdGet8(PcdUsbSerialXhciBus);
+ UsbDebugPort.PciAddress.Device = PcdGet8(PcdUsbSerialXhciDev);
+ UsbDebugPort.PciAddress.Function = PcdGet8(PcdUsbSerialXhciFunc);
+
+ return UsbDebugPort.Controller;
+}
+
+/**
+ Sets the USB debug port controller.
+ bit: 0~ 7: Function
+ bit: 8~15: Device
+ bit: 16~24: Bus
+
+ @param[in] Controller information of USB debug port value to be set.
+
+ @retval TRUE The controller of USB debug port was sucessfully set.
+ @retval FALSE The controller of USB debug port could not be set.
+
+**/
+BOOLEAN
+EFIAPI
+SetUsb3DebugPortController (
+ UINT32 Controller
+ )
+{
+ return FALSE;
+}
diff --git a/Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md
new file mode 100644
index 0000000000..969c7eed29
--- /dev/null
+++ b/Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md
@@ -0,0 +1,86 @@
+# Overview
+* **Feature Name:** USB3 Debug
+* **PI Phase(s) Supported:** PEI, DXE
+* **SMM Required?** No
+
+## Purpose
+*_TODO_*
+Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph.
+
+# High-Level Theory of Operation
+*_TODO_*
+A description of how the device works at a high-level.
+
+The description should not be constrained to implementation details but provide a simple mental model of how the
+feature is supposed to work.
+
+## Firmware Volumes
+*_TODO_*
+A bulleted list of the firmware volumes that feature module(s) are placed in.
+
+## Modules
+*_TODO_*
+A bulleted list of the modules that make up the feature.
+
+## <Module Name>
+*_TODO_*
+Each module in the feature should have a section that describes the module in a level of detail that is useful
+to better understand the module source code.
+
+## <Library Name>
+*_TODO_*
+Each library in the feature should have a section that describes the library in a level of detail that is useful
+to better understand the library source code.
+
+## Key Functions
+*_TODO_*
+A bulleted list of key functions for interacting with the feature.
+
+Not all features need to be listed. Only functions exposed through external interfaces that are important for feature
+users to be aware of.
+
+## Configuration
+*_TODO_*
+Information that is useful for configuring the feature.
+
+Not all configuration options need to be listed. This section is used to provide more background on configuration
+options than possible elsewhere.
+
+## Data Flows
+*_TODO_*
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+*_TODO_*
+Key control flows for the feature.
+
+## Build Flows
+*_TODO_*
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or require non-standard tool configuration. If the
+standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+*_TODO_*
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the feature is successful. If the test point is not
+implemented, this should be stated.
+
+## Functional Exit Criteria
+*_TODO_*
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board integrator can reference to ensure the feature is
+functional on their board.
+
+## Feature Enabling Checklist
+*_TODO_*
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+*_TODO_*
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 26/49] UserInterfaceFeaturePkg: Remove the User Authentication feature
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 26/49] UserInterfaceFeaturePkg: Remove the User Authentication feature Kubacki, Michael A
@ 2019-11-15 23:50 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:50 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A; +Cc: Bi, Dandan, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Bi, Dandan <dandan.bi@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 26/49] UserInterfaceFeaturePkg: Remove the User Authentication feature
Removes the User Authentication feature from
UserInterfaceFeaturePkg. The feature does not follow the advanced
feature design. A future change will add the feature back following
the advanced feature design.
Since the UserAuthentication feature is the only feature in
UserInterfaceFeaturePkg, the whole package is removed in this
change.
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec | 45 --
Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc | 101 ---
Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf | 39 -
Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf | 37 -
Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf | 41 -
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf | 53 --
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf | 63 --
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf | 53 --
Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthentication.h | 45 --
Platform/Intel/UserInterfaceFeaturePkg/Include/Library/PlatformPasswordLib.h | 48 --
Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordLib.h | 70 --
Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordUiLib.h | 37 -
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.h | 88 ---
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.h | 55 --
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.h | 138 ----
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeFormset.h | 23 -
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.h | 52 --
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeVfr.vfr | 39 -
Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c | 78 --
Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c | 274 -------
Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c | 522 -------------
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.c | 133 ----
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c | 484 ------------
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.c | 780 --------------------
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxePassword.c | 319 --------
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.c | 674 -----------------
Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni | 19 -
Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeStrings.uni | 30 -
28 files changed, 4340 deletions(-)
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec b/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
deleted file mode 100644
index 3c8fe1da01..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
+++ /dev/null
@@ -1,45 +0,0 @@
-## @file
-# This package provides UI related modules.
-#
-# The DEC files are used by the utilities that parse DSC and
-# INF files to generate AutoGen.c and AutoGen.h files
-# for the build infrastructure.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- DEC_SPECIFICATION = 0x00010017
- PACKAGE_NAME = UserInterfaceFeaturePkg
- PACKAGE_VERSION = 0.1
- PACKAGE_GUID = 5A92199C-C2ED-4A3F-9ED0-C278DEA0DA47
-
-[Includes]
- Include
-
-[LibraryClasses]
- ## @libraryclass Provides a platform-specific method to return password policy.
- PlatformPasswordLib|Include/Library/PlatformPasswordLib.h
-
- ## @libraryclass Provides services to set/verify password and return if the password is set.
- UserPasswordLib|Include/Library/UserPasswordLib.h
-
- ## @libraryclass Provides services to do password authentication.
- UserPasswordUiLib|Include/Library/UserPasswordUiLib.h
-
-[Guids]
- gEfiUserInterfaceFeaturePkgTokenSpaceGuid = { 0x13c2147c, 0x75b6, 0x48ee, { 0xa4, 0x4b, 0xfc, 0x4, 0xb, 0x44, 0x97, 0xbd } }
-
- ## Include Include/Guid/UserAuthentication.h
- gUserAuthenticationGuid = { 0xee24a7f7, 0x606b, 0x4724, { 0xb3, 0xc9, 0xf5, 0xae, 0x4a, 0x3b, 0x81, 0x65} }
-
-[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx]
- ## Indicate whether the password is cleared.
- # When it is configured to Dynamic or DynamicEx, it can be set through detection using
- # a platform-specific method (e.g. Board Jumper set) in a actual platform in early boot phase.<BR><BR>
- # @Prompt The password clear status
- gEfiUserInterfaceFeaturePkgTokenSpaceGuid.PcdPasswordCleared|FALSE|BOOLEAN|0x00000001
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc b/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
deleted file mode 100644
index bd09052f3c..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
+++ /dev/null
@@ -1,101 +0,0 @@
-## @file
-# This package provides UI related modules.
-# This package should only depend on EDKII Core packages and MinPlatformPkg.
-#
-# The DEC files are used by the utilities that parse DSC and
-# INF files to generate AutoGen.c and AutoGen.h files
-# for the build infrastructure.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- PLATFORM_NAME = UserInterfaceFeaturePkg
- PLATFORM_GUID = 66536B4C-84A3-42FD-B0AE-603414A4CE9E
- PLATFORM_VERSION = 0.1
- DSC_SPECIFICATION = 0x00010005
- OUTPUT_DIRECTORY = Build/UserInterfaceFeaturePkg
- SUPPORTED_ARCHITECTURES = IA32|X64
- BUILD_TARGETS = DEBUG|RELEASE|NOOPT
- SKUID_IDENTIFIER = DEFAULT
-
-[LibraryClasses]
- #######################################
- # Edk2 Packages
- #######################################
- BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
- BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
- IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
- IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
- OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
- TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
- UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
-
- #####################################
- # User Interface Feature Package
- #####################################
- PlatformPasswordLib|UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
- UserPasswordLib|UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
-
-[LibraryClasses.common.DXE_DRIVER]
- #######################################
- # Edk2 Packages
- #######################################
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
-
-[LibraryClasses.common.DXE_SMM_DRIVER]
- #######################################
- # Edk2 Packages
- #######################################
- BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
- MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
- SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
-
-###################################################################################################
-#
-# Components Section - list of the modules and components that will be processed by compilation
-# tools and the EDK II tools to generate PE32/PE32+/Coff image files.
-#
-# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
-# into firmware volume images. This section is just a list of modules to compile from
-# source into UEFI-compliant binaries.
-# It is the FDF file that contains information on combining binary files into firmware
-# volume images, whose concept is beyond UEFI and is described in PI specification.
-# Binary modules do not need to be listed in this section, as they should be
-# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi),
-# Logo (Logo.bmp), and etc.
-# There may also be modules listed in this section that are not required in the FDF file,
-# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
-# generated for it, but the binary will not be put into any firmware volume.
-#
-###################################################################################################
-[Components]
- #####################################
- # User Interface Feature Package
- #####################################
-
- # Add library instances here that are not included in package components and should be tested
- # in the package build.
- UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
- UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
- UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
-
- # Add components here that should be included in the package build.
- UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf
- UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf
- UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf
-
-[BuildOptions]
- *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf b/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
deleted file mode 100644
index 6f4e40f174..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
+++ /dev/null
@@ -1,39 +0,0 @@
-## @file
-# NULL platform password library instance that returns the password clear state based upon PCD.
-#
-# NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared
-# but returns the PCD value directly. This instance can be used to verify security
-# related features during platform enabling and development. It should be replaced
-# by a platform-specific method(e.g. Button pressed) in a real platform for product.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010006
- BASE_NAME = PlatformPasswordLibNull
- MODULE_UNI_FILE = PlatformPasswordLibNull.uni
- FILE_GUID = 27417BCA-0CCD-4089-9711-AD069A33C555
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = PlatformPasswordLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_DRIVER
- CONSTRUCTOR = PlatformPasswordLibNullConstructor
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 EBC
-#
-
-[Sources]
- PlatformPasswordLibNull.c
-
-[Packages]
- MdePkg/MdePkg.dec
- UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
-
-[Pcd]
- gEfiUserInterfaceFeaturePkgTokenSpaceGuid.PcdPasswordCleared ## CONSUMES
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
deleted file mode 100644
index 6dc6ca734f..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
+++ /dev/null
@@ -1,37 +0,0 @@
-## @file
-# UserPasswordLib instance provides services to set/verify password
-# and return if the password is set.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = UserPasswordLib
- FILE_GUID = 422BA58A-F162-4ECC-BD9A-AD84FE940F37
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = UserPasswordLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_DRIVER UEFI_APPLICATION
-
-[Sources]
- UserPasswordLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- DebugLib
- UefiLib
- BaseMemoryLib
-
-[Guids]
- gUserAuthenticationGuid ## CONSUMES ## GUID
- gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable
-
-[Protocols]
- gEfiSmmCommunicationProtocolGuid ## CONSUMES
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
deleted file mode 100644
index bdd8680ba0..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
+++ /dev/null
@@ -1,41 +0,0 @@
-## @file
-# UserPasswordUiLib instance provides services to do password authentication.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = UserPasswordUiLib
- FILE_GUID = E2E92636-F511-46BC-A08B-02F815AFA884
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = UserPasswordUiLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_DRIVER UEFI_APPLICATION
-
-[Sources]
- UserPasswordUiLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- UefiRuntimeServicesTableLib
- DebugLib
- UefiLib
- MemoryAllocationLib
- BaseMemoryLib
- PrintLib
- PlatformPasswordLib
- UserPasswordLib
-
-[Guids]
- gUserAuthenticationGuid ## CONSUMES ## GUID
- gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable
-
-[Protocols]
- gEfiSmmCommunicationProtocolGuid ## CONSUMES
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf
deleted file mode 100644
index d93d511005..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf
+++ /dev/null
@@ -1,53 +0,0 @@
-## @file
-# User Authentication 2 Dxe Driver.
-#
-# This Driver mainly provides Setup Form to change password.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = UserAuthentication2Dxe
- FILE_GUID = 4EF592F4-C716-40CC-8C07-1E4E3BD71F11
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 2.0
- ENTRY_POINT = UserAuthentication2Entry
- UNLOAD_IMAGE = UserAuthentication2Unload
-
-[Sources]
- UserAuthentication2Dxe.c
- UserAuthentication2Dxe.h
- UserAuthenticationDxeFormset.h
- UserAuthenticationDxeVfr.vfr
- UserAuthenticationDxeStrings.uni
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
-
-[LibraryClasses]
- BaseLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- UefiRuntimeServicesTableLib
- BaseMemoryLib
- DebugLib
- UefiLib
- HiiLib
- DevicePathLib
- MemoryAllocationLib
- UserPasswordLib
-
-[Protocols]
- gEfiDevicePathProtocolGuid ## PRODUCES
- gEfiHiiConfigAccessProtocolGuid ## PRODUCES
-
-[Depex]
- gEfiSimpleTextOutProtocolGuid AND
- gEfiSmmCommunicationProtocolGuid AND
- gEfiVariableArchProtocolGuid AND
- gEfiVariableWriteArchProtocolGuid
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf
deleted file mode 100644
index 61f5f27e63..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf
+++ /dev/null
@@ -1,63 +0,0 @@
-## @file
-# User Authentication Dxe Driver.
-#
-# This Driver mainly provides Setup Form to change password and
-# does user authentication before entering Setup.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = UserAuthenticationDxe
- FILE_GUID = 0683FB88-664C-4BA6-9ED4-1C0916EE43A4
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 2.0
- ENTRY_POINT = UserAuthenticationEntry
- UNLOAD_IMAGE = UserAuthenticationUnload
-
-
-[Sources]
- UserAuthenticationDxe.c
- UserAuthenticationDxe.h
- UserAuthenticationDxePassword.c
- UserAuthenticationDxeFormset.h
- UserAuthenticationDxeVfr.vfr
- UserAuthenticationDxeStrings.uni
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
-
-[LibraryClasses]
- BaseLib
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- UefiRuntimeServicesTableLib
- BaseMemoryLib
- DebugLib
- UefiLib
- HiiLib
- DevicePathLib
- MemoryAllocationLib
- PlatformPasswordLib
- PrintLib
-
-[Guids]
- gUserAuthenticationGuid ## CONSUMES ## GUID
- gEfiEventExitBootServicesGuid ## CONSUMES ## Event
- gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable
-
-[Protocols]
- gEfiRscHandlerProtocolGuid ## CONSUMES
- gEfiDevicePathProtocolGuid ## PRODUCES
- gEfiHiiConfigAccessProtocolGuid ## PRODUCES
- gEfiSmmCommunicationProtocolGuid ## CONSUMES
-
-[Depex]
- gEfiSimpleTextOutProtocolGuid AND
- gEfiSmmCommunicationProtocolGuid AND
- gEfiVariableArchProtocolGuid AND
- gEfiVariableWriteArchProtocolGuid
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf
deleted file mode 100644
index c5d15ada5e..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf
+++ /dev/null
@@ -1,53 +0,0 @@
-## @file
-# User Authentication Smm Driver.
-#
-# This driver provides SMM services for DXE user authentication module.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = UserAuthenticationSmm
- FILE_GUID = 8fc6aaaa-4561-4815-8cf7-b87312992dce
- MODULE_TYPE = DXE_SMM_DRIVER
- VERSION_STRING = 1.0
- PI_SPECIFICATION_VERSION = 0x0001000A
- ENTRY_POINT = PasswordSmmInit
-
-[Sources]
- UserAuthenticationSmm.c
- UserAuthenticationSmm.h
- KeyService.c
- KeyService.h
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- CryptoPkg/CryptoPkg.dec
- UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
-
-[LibraryClasses]
- UefiBootServicesTableLib
- UefiDriverEntryPoint
- DebugLib
- BaseLib
- BaseMemoryLib
- PrintLib
- SmmServicesTableLib
- MemoryAllocationLib
- UefiLib
- BaseCryptLib
- PlatformPasswordLib
-
-[Guids]
- gUserAuthenticationGuid ## CONSUMES ## GUID
-
-[Protocols]
- gEdkiiVariableLockProtocolGuid ## CONSUMES
- gEfiSmmVariableProtocolGuid ## CONSUMES
-
-[Depex]
- gEfiSmmVariableProtocolGuid AND gEfiVariableWriteArchProtocolGuid
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthentication.h b/Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthentication.h
deleted file mode 100644
index 2a41a46cdc..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthentication.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file
- GUID is for UserAuthentication SMM communication.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __USER_AUTHENTICATION_GUID_H__
-#define __USER_AUTHENTICATION_GUID_H__
-
-#define PASSWORD_MIN_SIZE 9 // MIN number of chars of password, including NULL.
-#define PASSWORD_MAX_SIZE 33 // MAX number of chars of password, including NULL.
-
-#define USER_AUTHENTICATION_GUID \
- { 0xf06e3ea7, 0x611c, 0x4b6b, { 0xb4, 0x10, 0xc2, 0xbf, 0x94, 0x3f, 0x38, 0xf2 } }
-
-extern EFI_GUID gUserAuthenticationGuid;
-
-typedef struct {
- UINTN Function;
- EFI_STATUS ReturnStatus;
-} SMM_PASSWORD_COMMUNICATE_HEADER;
-
-#define SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET 1
-#define SMM_PASSWORD_FUNCTION_SET_PASSWORD 2
-#define SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD 3
-#define SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY 4
-#define SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY 5
-#define SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED 6
-
-typedef struct {
- CHAR8 NewPassword[PASSWORD_MAX_SIZE];
- CHAR8 OldPassword[PASSWORD_MAX_SIZE];
-} SMM_PASSWORD_COMMUNICATE_SET_PASSWORD;
-
-typedef struct {
- CHAR8 Password[PASSWORD_MAX_SIZE];
-} SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD;
-
-typedef struct {
- BOOLEAN NeedReVerify;
-} SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY;
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/PlatformPasswordLib.h b/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/PlatformPasswordLib.h
deleted file mode 100644
index ce27947f6d..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/PlatformPasswordLib.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file
- Provides a platform-specific method to return password policy.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PLATFORM_PASSWORD_LIB_H__
-#define __PLATFORM_PASSWORD_LIB_H__
-
-/**
- This function is called at password driver entrypoint.
- This function should be called only once, to clear the password.
-
- This function provides a way to reset the password, just in case
- the platform owner forgets the password.
- The platform should provide a secure way to make sure
- only the platform owner is allowed to clear password.
-
- Once the password is cleared, the platform should provide a way
- to set a new password.
-
- @retval TRUE There is a platform request to clear the password.
- @retval FALSE There is no platform request to clear the password.
-**/
-BOOLEAN
-EFIAPI
-IsPasswordCleared (
- VOID
- );
-
-/**
- This function is called if the password driver finds that the password is not enrolled,
- when the password is required to input.
-
- This function should return the action according to platform policy.
-
- @retval TRUE The caller should force the user to enroll the password.
- @retval FALSE The caller may skip the password enroll.
-**/
-BOOLEAN
-EFIAPI
-NeedEnrollPassword (
- VOID
- );
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordLib.h b/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordLib.h
deleted file mode 100644
index b6aad224e9..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordLib.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/** @file
- Provides services to set/verify password and return if the password is set.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __USER_PASSWORD_LIB_H__
-#define __USER_PASSWORD_LIB_H__
-
-/**
- Validate if the password is correct.
-
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval EFI_SUCCESS The password is correct.
- @retval EFI_SECURITY_VIOLATION The password is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
-**/
-EFI_STATUS
-EFIAPI
-VerifyPassword (
- IN CHAR16 *Password,
- IN UINTN PasswordSize
- );
-
-/**
- Set a new password.
-
- @param[in] NewPassword The user input new password.
- NULL means clear password.
- @param[in] NewPasswordSize The size of NewPassword in byte.
- @param[in] OldPassword The user input old password.
- NULL means no old password.
- @param[in] OldPasswordSize The size of OldPassword in byte.
-
- @retval EFI_SUCCESS The NewPassword is set successfully.
- @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
- @retval EFI_UNSUPPORTED NewPassword is not strong enough.
- @retval EFI_ALREADY_STARTED NewPassword is in history.
-**/
-EFI_STATUS
-EFIAPI
-SetPassword (
- IN CHAR16 *NewPassword, OPTIONAL
- IN UINTN NewPasswordSize,
- IN CHAR16 *OldPassword, OPTIONAL
- IN UINTN OldPasswordSize
- );
-
-/**
- Return if the password is set.
-
- @retval TRUE The password is set.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-EFIAPI
-IsPasswordInstalled (
- VOID
- );
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordUiLib.h b/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordUiLib.h
deleted file mode 100644
index 117f480733..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordUiLib.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/** @file
- Provides services to do password authentication.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __USER_PASSWORD_UI_LIB_H__
-#define __USER_PASSWORD_UI_LIB_H__
-
-/**
- Do password authentication.
-
- @retval EFI_SUCCESS Password authentication pass.
-**/
-EFI_STATUS
-EFIAPI
-UiDoPasswordAuthentication (
- VOID
- );
-
-/**
- Set password verification policy.
-
- @param[in] NeedReVerify Need re-verify or not.
-
- @retval EFI_SUCCESS Set verification policy successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to set verification policy.
-**/
-EFI_STATUS
-EFIAPI
-UiSetPasswordVerificationPolicy (
- IN BOOLEAN NeedReVerify
- );
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.h
deleted file mode 100644
index d0b20851fa..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/** @file
- Header file for key service.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __KEY_LIB_H__
-#define __KEY_LIB_H__
-
-/**
- Compares the contents of two buffers with slow algorithm
-
- This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
- If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
- value returned is the first mismatched byte in SourceBuffer subtracted from the first
- mismatched byte in DestinationBuffer.
-
- If Length > 0 and DestinationBuffer is NULL, then ASSERT().
- If Length > 0 and SourceBuffer is NULL, then ASSERT().
- If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
- If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
-
- @param DestinationBuffer The pointer to the destination buffer to compare.
- @param SourceBuffer The pointer to the source buffer to compare.
- @param Length The number of bytes to compare.
-
- @return 0 All Length bytes of the two buffers are identical.
- @retval -1 The SourceBuffer is not identical to DestinationBuffer.
-
-**/
-INTN
-EFIAPI
-KeyLibSlowCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
- );
-
-/**
- Generate Salt value.
-
- @param[in, out] SaltValue Points to the salt buffer
- @param[in] SaltSize Size of the salt buffer
-
- @retval TRUE Salt is generated.
- @retval FALSE Salt is not generated.
-**/
-BOOLEAN
-EFIAPI
-KeyLibGenerateSalt(
- IN OUT UINT8 *SaltValue,
- IN UINTN SaltSize
- );
-
-#define HASH_TYPE_SHA256 0x000B
-#define DEFAULT_PBKDF2_ITERATION_COUNT 1000
-
-/**
- Hash the password with PBKDF2.
-
- @param[in] HashType Hash type
- @param[in] Key Points to the key buffer
- @param[in] KeySize Key buffer size
- @param[in] SaltValue Points to the salt buffer
- @param[in] SaltSize Size of the salt buffer
- @param[out] KeyHash Points to the hashed result
- @param[in] KeyHashSize Size of the hash buffer
-
- @retval TRUE Hash the data successfully.
- @retval FALSE Failed to hash the data.
-
-**/
-BOOLEAN
-EFIAPI
-KeyLibGeneratePBKDF2Hash (
- IN UINT32 HashType,
- IN VOID *Key,
- IN UINTN KeySize,
- IN UINT8 *SaltValue,
- IN UINTN SaltSize,
- OUT UINT8 *KeyHash,
- IN UINTN KeyHashSize
- );
-
-#endif
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.h
deleted file mode 100644
index 3b7fba026d..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/** @file
- Header file for UserAuthentication2Dxe.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _USER_AUTHENTICATION_DXE_H_
-#define _USER_AUTHENTICATION_DXE_H_
-
-
-#include <Protocol/ReportStatusCodeHandler.h>
-#include <Protocol/HiiConfigAccess.h>
-
-#include <Guid/MdeModuleHii.h>
-#include <Guid/HiiPlatformSetupFormset.h>
-#include <Guid/UserAuthentication.h>
-
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/BaseLib.h>
-#include <Library/UefiLib.h>
-#include <Library/HiiLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UserPasswordLib.h>
-
-#include "UserAuthenticationDxeFormset.h"
-
-extern UINT8 UserAuthenticationDxeVfrBin[];
-extern UINT8 UserAuthentication2DxeStrings[];
-
-typedef struct {
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
- EFI_HANDLE DriverHandle;
- EFI_HII_HANDLE HiiHandle;
- UINT8 PasswordState;
- CHAR16 OldPassword[PASSWORD_MAX_SIZE];
-} USER_AUTHENTICATION_PRIVATE_DATA;
-
-#pragma pack(1)
-///
-/// HII specific Vendor Device Path definition.
-///
-typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- EFI_DEVICE_PATH_PROTOCOL End;
-} HII_VENDOR_DEVICE_PATH;
-#pragma pack()
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.h
deleted file mode 100644
index e183424f35..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/** @file
- Header file for UserAuthenticationDxe.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _USER_AUTHENTICATION_DXE_H_
-#define _USER_AUTHENTICATION_DXE_H_
-
-
-#include <Protocol/ReportStatusCodeHandler.h>
-#include <Protocol/HiiConfigAccess.h>
-#include <Protocol/SmmCommunication.h>
-
-#include <Guid/MdeModuleHii.h>
-#include <Guid/HiiPlatformSetupFormset.h>
-#include <Guid/PiSmmCommunicationRegionTable.h>
-#include <Guid/UserAuthentication.h>
-
-#include <Library/PrintLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/BaseLib.h>
-#include <Library/UefiLib.h>
-#include <Library/HiiLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PlatformPasswordLib.h>
-
-#include "UserAuthenticationDxeFormset.h"
-
-extern UINT8 UserAuthenticationDxeVfrBin[];
-extern UINT8 UserAuthenticationDxeStrings[];
-extern EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication;
-
-typedef struct {
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
- EFI_HANDLE DriverHandle;
- EFI_HII_HANDLE HiiHandle;
- UINT8 PasswordState;
- CHAR16 OldPassword[PASSWORD_MAX_SIZE];
-} USER_AUTHENTICATION_PRIVATE_DATA;
-
-#pragma pack(1)
-///
-/// HII specific Vendor Device Path definition.
-///
-typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- EFI_DEVICE_PATH_PROTOCOL End;
-} HII_VENDOR_DEVICE_PATH;
-#pragma pack()
-
-/**
- Validate if the password is correct.
-
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval EFI_SUCCESS The password is correct.
- @retval EFI_SECURITY_VIOLATION The password is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
-**/
-EFI_STATUS
-VerifyPassword (
- IN CHAR16 *Password,
- IN UINTN PasswordSize
- );
-
-/**
- Set a new password.
-
- @param[in] NewPassword The user input new password.
- NULL means clear password.
- @param[in] NewPasswordSize The size of NewPassword in byte.
- @param[in] OldPassword The user input old password.
- NULL means no old password.
- @param[in] OldPasswordSize The size of OldPassword in byte.
-
- @retval EFI_SUCCESS The NewPassword is set successfully.
- @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
- @retval EFI_UNSUPPORTED NewPassword is not strong enough.
- @retval EFI_ALREADY_STARTED NewPassword is in history.
-**/
-EFI_STATUS
-SetPassword (
- IN CHAR16 *NewPassword, OPTIONAL
- IN UINTN NewPasswordSize,
- IN CHAR16 *OldPassword, OPTIONAL
- IN UINTN OldPasswordSize
- );
-
-/**
- Return if the password is set.
-
- @retval TRUE The password is set.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-IsPasswordInstalled (
- VOID
- );
-
-/**
- Get password verification policy.
-
- @param[out] VerifyPolicy Verification policy.
-
- @retval EFI_SUCCESS Get verification policy successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verification policy.
-**/
-EFI_STATUS
-GetPasswordVerificationPolicy (
- OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy
- );
-
-/**
- Return if the password was verified.
-
- @retval TRUE The password was verified.
- @retval FALSE The password was not verified.
-**/
-BOOLEAN
-WasPasswordVerified (
- VOID
- );
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeFormset.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeFormset.h
deleted file mode 100644
index 581849b534..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeFormset.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/** @file
- Header file for UserAuthentication formset.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _USER_AUTHENTICATION_DXE_FORMSET_H_
-#define _USER_AUTHENTICATION_DXE_FORMSET_H_
-
-//
-// Vendor GUID of the formset
-//
-#define USER_AUTHENTICATION_FORMSET_GUID \
- { 0x760e3022, 0xf149, 0x4560, {0x9c, 0x6f, 0x33, 0xaa, 0x7d, 0x48, 0x75, 0xfa} }
-
-#define ADMIN_PASSWORD_KEY_ID 0x2001
-
-#define MAX_PASSWORD_LEN 32
-#define MIN_PASSWORD_LEN 0
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.h
deleted file mode 100644
index 47bb95529f..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/** @file
- Header file for UserAuthenticationSmm.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __USER_AUTHENTICATION_SMM_H__
-#define __USER_AUTHENTICATION_SMM_H__
-
-#include <PiSmm.h>
-
-#include <Protocol/SmmVariable.h>
-#include <Protocol/VariableLock.h>
-
-#include <Guid/UserAuthentication.h>
-
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PrintLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/SmmServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/SmmServicesTableLib.h>
-#include <Library/BaseCryptLib.h>
-#include <Library/PlatformPasswordLib.h>
-
-#include "KeyService.h"
-
-#define PASSWORD_SALT_SIZE 32
-#define PASSWORD_HASH_SIZE 32 // SHA256_DIGEST_SIZE
-
-#define PASSWORD_MAX_TRY_COUNT 3
-#define PASSWORD_HISTORY_CHECK_COUNT 5
-
-//
-// Name of the variable
-//
-#define USER_AUTHENTICATION_VAR_NAME L"Password"
-#define USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME L"PasswordLast"
-
-//
-// Variable storage
-//
-typedef struct {
- UINT8 PasswordHash[PASSWORD_HASH_SIZE];
- UINT8 PasswordSalt[PASSWORD_SALT_SIZE];
-} USER_PASSWORD_VAR_STRUCT;
-
-#endif
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeVfr.vfr b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeVfr.vfr
deleted file mode 100644
index ca1d5ddec1..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeVfr.vfr
+++ /dev/null
@@ -1,39 +0,0 @@
-///** @file
-// UserAuthentication formset.
-//
-// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-//**/
-
-#include <Guid/HiiPlatformSetupFormset.h>
-#include "UserAuthenticationDxeFormset.h"
-
-formset
- guid = USER_AUTHENTICATION_FORMSET_GUID,
- title = STRING_TOKEN(STR_FORM_SET_TITLE),
- help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
- classguid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID,
-
- form formid = 1,
- title = STRING_TOKEN(STR_FORM_TITLE);
-
- grayoutif TRUE;
- text
- help = STRING_TOKEN(STR_ADMIN_PASSWORD_STS_HELP),
- text = STRING_TOKEN(STR_ADMIN_PASSWORD_STS_PROMPT),
- text = STRING_TOKEN(STR_ADMIN_PASSWORD_STS_CONTENT);
- endif;
-
- password
- prompt = STRING_TOKEN(STR_ADMIN_PASSWORD_PROMPT),
- help = STRING_TOKEN(STR_ADMIN_PASSWORD_HELP),
- flags = INTERACTIVE,
- key = ADMIN_PASSWORD_KEY_ID,
- minsize = MIN_PASSWORD_LEN,
- maxsize = MAX_PASSWORD_LEN,
- endpassword;
-
- endform;
-
-endformset;
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c b/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c
deleted file mode 100644
index 08e081aa99..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/** @file
- NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared
- but returns the PCD value directly. This instance can be used to verify security
- related features during platform enabling and development. It should be replaced
- by a platform-specific method(e.g. Button pressed) in a real platform for product.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-BOOLEAN mPasswordCleared = FALSE;
-
-/**
- This function is called at password driver entrypoint.
- This function should be called only once, to clear the password.
-
- This function provides a way to reset the password, just in case
- the platform owner forgets the password.
- The platform should provide a secure way to make sure
- only the platform owner is allowed to clear password.
-
- Once the password is cleared, the platform should provide a way
- to set a new password.
-
- @retval TRUE There is a platform request to clear the password.
- @retval FALSE There is no platform request to clear the password.
-**/
-BOOLEAN
-EFIAPI
-IsPasswordCleared (
- VOID
- )
-{
- return mPasswordCleared;
-}
-
-/**
- This function is called if the password driver finds that the password is not enrolled,
- when the password is required to input.
-
- This function should return the action according to platform policy.
-
- @retval TRUE The caller should force the user to enroll the password.
- @retval FALSE The caller may skip the password enroll.
-**/
-BOOLEAN
-EFIAPI
-NeedEnrollPassword (
- VOID
- )
-{
- return FALSE;
-}
-
-
-/**
- Save password clear state from a PCD to mPasswordCleared.
-
- @param ImageHandle ImageHandle of the loaded driver.
- @param SystemTable Pointer to the EFI System Table.
-
- @retval EFI_SUCCESS PcdPasswordCleared is got successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformPasswordLibNullConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
-
- mPasswordCleared = PcdGetBool(PcdPasswordCleared);
-
- return EFI_SUCCESS;
-}
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c
deleted file mode 100644
index cbaf572378..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/** @file
- UserPasswordLib instance implementation provides services to
- set/verify password and return if the password is set.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Protocol/SmmCommunication.h>
-
-#include <Guid/PiSmmCommunicationRegionTable.h>
-#include <Guid/UserAuthentication.h>
-
-#include <Library/DebugLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-
-/**
- Initialize the communicate buffer using DataSize and Function.
-
- @param[out] DataPtr Points to the data in the communicate buffer.
- @param[in] DataSize The data size to send to SMM.
- @param[in] Function The function number to initialize the communicate header.
-
- @return Communicate buffer.
-**/
-VOID*
-UserPasswordLibInitCommunicateBuffer (
- OUT VOID **DataPtr OPTIONAL,
- IN UINTN DataSize,
- IN UINTN Function
- )
-{
- EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
- VOID *Buffer;
- EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable;
- EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
- UINTN Index;
- UINTN Size;
- EFI_STATUS Status;
-
- Buffer = NULL;
- Status = EfiGetSystemConfigurationTable (
- &gEdkiiPiSmmCommunicationRegionTableGuid,
- (VOID **) &SmmCommRegionTable
- );
- if (EFI_ERROR (Status)) {
- return NULL;
- }
- ASSERT (SmmCommRegionTable != NULL);
- SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
- Size = 0;
- for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) {
- if (SmmCommMemRegion->Type == EfiConventionalMemory) {
- Size = EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages);
- if (Size >= (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) {
- break;
- }
- }
- SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRegion + SmmCommRegionTable->DescriptorSize);
- }
- ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
-
- Buffer = (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart;
- ASSERT (Buffer != NULL);
- SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
- CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid);
- SmmCommunicateHeader->MessageLength = DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data;
- ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER));
- SmmPasswordFunctionHeader->Function = Function;
- if (DataPtr != NULL) {
- *DataPtr = SmmPasswordFunctionHeader + 1;
- }
-
- return Buffer;
-}
-
-/**
- Send the data in communicate buffer to SMM.
-
- @param[in] Buffer Points to the data in the communicate buffer.
- @param[in] DataSize The data size to send to SMM.
-
- @retval EFI_SUCCESS Success is returned from the function in SMM.
- @retval Others Failure is returned from the function in SMM.
-
-**/
-EFI_STATUS
-UserPasswordLibSendCommunicateBuffer (
- IN VOID *Buffer,
- IN UINTN DataSize
- )
-{
- EFI_STATUS Status;
- UINTN CommSize;
- EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
- EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
-
- //
- // Locates SMM Communication protocol.
- //
- Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &SmmCommunication);
- ASSERT_EFI_ERROR (Status);
-
- CommSize = DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- Status = SmmCommunication->Communicate (SmmCommunication, Buffer, &CommSize);
- ASSERT_EFI_ERROR (Status);
-
- SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
- SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data;
- return SmmPasswordFunctionHeader->ReturnStatus;
-}
-
-/**
- Validate if the password is correct.
-
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval EFI_SUCCESS The password is correct.
- @retval EFI_SECURITY_VIOLATION The password is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
-**/
-EFI_STATUS
-EFIAPI
-VerifyPassword (
- IN CHAR16 *Password,
- IN UINTN PasswordSize
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD *VerifyPassword;
-
- ASSERT (Password != NULL);
-
- if (PasswordSize > sizeof(VerifyPassword->Password) * sizeof(CHAR16)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Buffer = UserPasswordLibInitCommunicateBuffer (
- (VOID**)&VerifyPassword,
- sizeof(*VerifyPassword),
- SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = UnicodeStrToAsciiStrS (Password, VerifyPassword->Password, sizeof(VerifyPassword->Password));
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
-
- Status = UserPasswordLibSendCommunicateBuffer (Buffer, sizeof(*VerifyPassword));
-
-EXIT:
- ZeroMem (VerifyPassword, sizeof(*VerifyPassword));
- return Status;
-}
-
-/**
- Set a new password.
-
- @param[in] NewPassword The user input new password.
- NULL means clear password.
- @param[in] NewPasswordSize The size of NewPassword in byte.
- @param[in] OldPassword The user input old password.
- NULL means no old password.
- @param[in] OldPasswordSize The size of OldPassword in byte.
-
- @retval EFI_SUCCESS The NewPassword is set successfully.
- @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
- @retval EFI_UNSUPPORTED NewPassword is not strong enough.
- @retval EFI_ALREADY_STARTED NewPassword is in history.
-**/
-EFI_STATUS
-EFIAPI
-SetPassword (
- IN CHAR16 *NewPassword, OPTIONAL
- IN UINTN NewPasswordSize,
- IN CHAR16 *OldPassword, OPTIONAL
- IN UINTN OldPasswordSize
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_SET_PASSWORD *SetPassword;
-
- if (NewPasswordSize > sizeof(SetPassword->NewPassword) * sizeof(CHAR16)) {
- return EFI_INVALID_PARAMETER;
- }
- if (OldPasswordSize > sizeof(SetPassword->OldPassword) * sizeof(CHAR16)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Buffer = UserPasswordLibInitCommunicateBuffer (
- (VOID**)&SetPassword,
- sizeof(*SetPassword),
- SMM_PASSWORD_FUNCTION_SET_PASSWORD
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (NewPassword != NULL) {
- Status = UnicodeStrToAsciiStrS (NewPassword, SetPassword->NewPassword, sizeof(SetPassword->NewPassword));
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- } else {
- SetPassword->NewPassword[0] = 0;
- }
-
- if (OldPassword != NULL) {
- Status = UnicodeStrToAsciiStrS (OldPassword, SetPassword->OldPassword, sizeof(SetPassword->OldPassword));
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- } else {
- SetPassword->OldPassword[0] = 0;
- }
-
- Status = UserPasswordLibSendCommunicateBuffer (Buffer, sizeof(*SetPassword));
-
-EXIT:
- ZeroMem (SetPassword, sizeof(*SetPassword));
- return Status;
-}
-
-/**
- Return if the password is set.
-
- @retval TRUE The password is set.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-EFIAPI
-IsPasswordInstalled (
- VOID
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
-
- Buffer = UserPasswordLibInitCommunicateBuffer (
- NULL,
- 0,
- SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET
- );
- if (Buffer == NULL) {
- return FALSE;
- }
-
- Status = UserPasswordLibSendCommunicateBuffer (Buffer, 0);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c
deleted file mode 100644
index 050bfda63a..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c
+++ /dev/null
@@ -1,522 +0,0 @@
-/** @file
- UserPasswordUiLib instance provides services to do password authentication.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Protocol/SmmCommunication.h>
-
-#include <Guid/PiSmmCommunicationRegionTable.h>
-#include <Guid/UserAuthentication.h>
-
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PrintLib.h>
-#include <Library/PlatformPasswordLib.h>
-#include <Library/UserPasswordLib.h>
-
-/**
- Initialize the communicate buffer using DataSize and Function.
-
- @param[out] DataPtr Points to the data in the communicate buffer.
- @param[in] DataSize The data size to send to SMM.
- @param[in] Function The function number to initialize the communicate header.
-
- @return Communicate buffer.
-**/
-VOID*
-UserPasswordUiLibInitCommunicateBuffer (
- OUT VOID **DataPtr OPTIONAL,
- IN UINTN DataSize,
- IN UINTN Function
- )
-{
- EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
- VOID *Buffer;
- EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable;
- EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
- UINTN Index;
- UINTN Size;
- EFI_STATUS Status;
-
- Buffer = NULL;
- Status = EfiGetSystemConfigurationTable (
- &gEdkiiPiSmmCommunicationRegionTableGuid,
- (VOID **) &SmmCommRegionTable
- );
- if (EFI_ERROR (Status)) {
- return NULL;
- }
- ASSERT (SmmCommRegionTable != NULL);
- SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
- Size = 0;
- for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) {
- if (SmmCommMemRegion->Type == EfiConventionalMemory) {
- Size = EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages);
- if (Size >= (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) {
- break;
- }
- }
- SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRegion + SmmCommRegionTable->DescriptorSize);
- }
- ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
-
- Buffer = (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart;
- ASSERT (Buffer != NULL);
- SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
- CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid);
- SmmCommunicateHeader->MessageLength = DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data;
- ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER));
- SmmPasswordFunctionHeader->Function = Function;
- if (DataPtr != NULL) {
- *DataPtr = SmmPasswordFunctionHeader + 1;
- }
-
- return Buffer;
-}
-
-/**
- Send the data in communicate buffer to SMM.
-
- @param[in] Buffer Points to the data in the communicate buffer.
- @param[in] DataSize The data size to send to SMM.
-
- @retval EFI_SUCCESS Success is returned from the function in SMM.
- @retval Others Failure is returned from the function in SMM.
-
-**/
-EFI_STATUS
-UserPasswordUiLibSendCommunicateBuffer (
- IN VOID *Buffer,
- IN UINTN DataSize
- )
-{
- EFI_STATUS Status;
- UINTN CommSize;
- EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
- EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
-
- //
- // Locates SMM Communication protocol.
- //
- Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &SmmCommunication);
- ASSERT_EFI_ERROR (Status);
-
- CommSize = DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- Status = SmmCommunication->Communicate (SmmCommunication, Buffer, &CommSize);
- ASSERT_EFI_ERROR (Status);
-
- SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
- SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data;
- return SmmPasswordFunctionHeader->ReturnStatus;
-}
-
-/**
- Set password verification policy.
-
- @param[in] NeedReVerify Need re-verify or not.
-
- @retval EFI_SUCCESS Set verification policy successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to set verification policy.
-**/
-EFI_STATUS
-EFIAPI
-UiSetPasswordVerificationPolicy (
- IN BOOLEAN NeedReVerify
- )
-{
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *SetVerifyPolicy;
-
- Buffer = UserPasswordUiLibInitCommunicateBuffer (
- (VOID**)&SetVerifyPolicy,
- sizeof(*SetVerifyPolicy),
- SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- SetVerifyPolicy->NeedReVerify = NeedReVerify;
-
- return UserPasswordUiLibSendCommunicateBuffer (Buffer, sizeof(*SetVerifyPolicy));
-}
-
-/**
- Get a user input string.
-
- @param[in] PopUpString A popup string to inform user.
- @param[in, out] UserInput The user input string
- @param[in] UserInputMaxLen The max unicode count of the UserInput without NULL terminator.
-**/
-EFI_STATUS
-GetUserInput (
- IN CHAR16 *PopUpString,
- IN OUT CHAR16 *UserInput,
- IN UINTN UserInputMaxLen
- )
-{
- EFI_INPUT_KEY InputKey;
- UINTN InputLength;
- CHAR16 *Mask;
-
- UserInput[0] = 0;
- Mask = AllocateZeroPool ((UserInputMaxLen + 1) * sizeof(CHAR16));
- if (Mask == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- InputLength = 0;
-
- while (TRUE) {
- if (InputLength < UserInputMaxLen) {
- Mask[InputLength] = L'_';
- }
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &InputKey,
- PopUpString,
- L"--------------------------------",
- Mask,
- NULL
- );
- if (InputKey.ScanCode == SCAN_NULL) {
- //
- // Check whether finish inputing password.
- //
- if (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN && InputLength > 0) {
- //
- // Add the null terminator.
- //
- UserInput[InputLength] = 0;
- break;
- } else if ((InputKey.UnicodeChar == CHAR_NULL) ||
- (InputKey.UnicodeChar == CHAR_LINEFEED) ||
- (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN)
- ) {
- continue;
- } else {
- //
- // delete last key entered
- //
- if (InputKey.UnicodeChar == CHAR_BACKSPACE) {
- if (InputLength > 0) {
- UserInput[InputLength] = 0;
- Mask[InputLength] = 0;
- InputLength--;
- }
- } else {
- if (InputLength == UserInputMaxLen) {
- Mask[InputLength] = 0;
- continue;
- }
- //
- // add Next key entry
- //
- UserInput[InputLength] = InputKey.UnicodeChar;
- Mask[InputLength] = L'*';
- InputLength++;
- }
- }
- }
- }
- FreePool (Mask);
- return EFI_SUCCESS;
-}
-
-/**
- Display a message box to end user.
-
- @param[in] DisplayString The string in message box.
-**/
-VOID
-MessageBox (
- IN CHAR16 *DisplayString
- )
-{
- EFI_INPUT_KEY Key;
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
-}
-
-/**
- Force system reset.
-**/
-VOID
-ForceSystemReset (
- VOID
- )
-{
- MessageBox (L"Password retry count reach, reset system!");
- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
- CpuDeadLoop();
-}
-
-/**
- Display message for set password.
-
- @param[in] ReturnStatus The return status for set password.
-**/
-VOID
-PrintSetPasswordStatus (
- IN EFI_STATUS ReturnStatus
- )
-{
- CHAR16 *DisplayString;
- CHAR16 *DisplayString2;
-
- EFI_INPUT_KEY Key;
-
- if (ReturnStatus == EFI_UNSUPPORTED) {
- DisplayString = L"New password is not strong enough!";
- DisplayString2 = L"Password must at least 8 chars and include lowercase, uppercase alphabetic, number and symbol";
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- DisplayString2,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- } else {
- if (ReturnStatus == EFI_SUCCESS) {
- DisplayString = L"New password is updated successfully!";
- } else if (ReturnStatus == EFI_ALREADY_STARTED) {
- DisplayString = L"New password is found in the history passwords!";
- } else {
- DisplayString = L"New password update fails!";
- }
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- }
-}
-
-/**
- Get password verification policy.
-
- @param[out] VerifyPolicy Verification policy.
-
- @retval EFI_SUCCESS Get verification policy successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verification policy.
-**/
-EFI_STATUS
-GetPasswordVerificationPolicy (
- OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *TempVerifyPolicy;
-
- Buffer = UserPasswordUiLibInitCommunicateBuffer (
- (VOID**)&TempVerifyPolicy,
- sizeof(*TempVerifyPolicy),
- SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = UserPasswordUiLibSendCommunicateBuffer (Buffer, sizeof(*TempVerifyPolicy));
- if (!EFI_ERROR (Status)) {
- CopyMem (VerifyPolicy, TempVerifyPolicy, sizeof (SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY));
- }
-
- return Status;
-}
-
-/**
- Return if the password was verified.
-
- @retval TRUE The password was verified.
- @retval FALSE The password was not verified.
-**/
-BOOLEAN
-WasPasswordVerified (
- VOID
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
-
- Buffer = UserPasswordUiLibInitCommunicateBuffer (
- NULL,
- 0,
- SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED
- );
- if (Buffer == NULL) {
- return FALSE;
- }
-
- Status = UserPasswordUiLibSendCommunicateBuffer (Buffer, 0);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- Require user input password.
-
- @retval TRUE User input correct password successfully.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-RequireUserPassword (
- VOID
- )
-{
- EFI_STATUS Status;
- CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
- CHAR16 *PopUpString;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY VerifyPolicy;
-
- Status = EFI_SUCCESS;
- ZeroMem(UserInputPw, sizeof(UserInputPw));
-
- if (!IsPasswordInstalled ()) {
- return FALSE;
- }
-
- Status = GetPasswordVerificationPolicy (&VerifyPolicy);
- if (!EFI_ERROR (Status)) {
- if (WasPasswordVerified() && (!VerifyPolicy.NeedReVerify)) {
- DEBUG ((DEBUG_INFO, "Password was verified and Re-verify is not needed\n"));
- return TRUE;
- }
- }
-
- PopUpString = L"Please input admin password";
-
- while (TRUE) {
- gST->ConOut->ClearScreen(gST->ConOut);
- GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
-
- Status = VerifyPassword (UserInputPw, StrSize(UserInputPw));
- if (!EFI_ERROR(Status)) {
- break;
- }
- if (Status == EFI_ACCESS_DENIED) {
- //
- // Password retry count reach.
- //
- ForceSystemReset ();
- }
- MessageBox (L"Incorrect password!");
- }
-
- ZeroMem(UserInputPw, sizeof(UserInputPw));
-
- gST->ConOut->ClearScreen(gST->ConOut);
-
- return TRUE;
-}
-
-/**
- Set user password.
-
-**/
-VOID
-SetUserPassword (
- VOID
- )
-{
- EFI_STATUS Status;
- CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
- CHAR16 TmpPassword[PASSWORD_MAX_SIZE];
- CHAR16 *PopUpString;
- CHAR16 *PopUpString2;
-
- ZeroMem(UserInputPw, sizeof(UserInputPw));
- ZeroMem(TmpPassword, sizeof(TmpPassword));
-
- PopUpString = L"Please set admin password";
-
- while (TRUE) {
- gST->ConOut->ClearScreen(gST->ConOut);
- GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
-
- PopUpString2 = L"Please confirm your new password";
- gST->ConOut->ClearScreen(gST->ConOut);
- GetUserInput (PopUpString2, TmpPassword, PASSWORD_MAX_SIZE - 1);
- if (StrCmp (TmpPassword, UserInputPw) != 0) {
- MessageBox (L"Password are not the same!");
- continue;
- }
-
- Status = SetPassword (UserInputPw, StrSize(UserInputPw), NULL, 0);
- PrintSetPasswordStatus (Status);
- if (!EFI_ERROR(Status)) {
- break;
- }
- }
-
- ZeroMem(UserInputPw, sizeof(UserInputPw));
- ZeroMem(TmpPassword, sizeof(TmpPassword));
-
- gST->ConOut->ClearScreen(gST->ConOut);
-}
-
-/**
- Do password authentication.
-
- @retval EFI_SUCCESS Password authentication pass.
-**/
-EFI_STATUS
-EFIAPI
-UiDoPasswordAuthentication (
- VOID
- )
-{
- BOOLEAN PasswordSet;
-
- PasswordSet = RequireUserPassword ();
- if (PasswordSet) {
- DEBUG ((DEBUG_INFO, "Welcome Admin!\n"));
- } else {
- DEBUG ((DEBUG_INFO, "Admin password is not set!\n"));
- if (NeedEnrollPassword()) {
- SetUserPassword ();
- }
- }
-
- return EFI_SUCCESS;
-}
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.c
deleted file mode 100644
index 8b06e58ca5..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/** @file
- Password key service.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Uefi.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/BaseCryptLib.h>
-#include "KeyService.h"
-
-/**
- Compares the contents of two buffers with slow algorithm
-
- This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
- If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
- value returned is the first mismatched byte in SourceBuffer subtracted from the first
- mismatched byte in DestinationBuffer.
-
- If Length > 0 and DestinationBuffer is NULL, then ASSERT().
- If Length > 0 and SourceBuffer is NULL, then ASSERT().
- If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
- If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
-
- @param DestinationBuffer The pointer to the destination buffer to compare.
- @param SourceBuffer The pointer to the source buffer to compare.
- @param Length The number of bytes to compare.
-
- @return 0 All Length bytes of the two buffers are identical.
- @retval -1 The SourceBuffer is not identical to DestinationBuffer.
-
-**/
-INTN
-EFIAPI
-KeyLibSlowCompareMem (
- IN CONST VOID *DestinationBuffer,
- IN CONST VOID *SourceBuffer,
- IN UINTN Length
- )
-{
- UINT8 Delta;
- UINTN Index;
- UINT8 *Destination;
- UINT8 *Source;
-
- Destination = (UINT8 *)DestinationBuffer;
- Source = (UINT8 *)SourceBuffer;
- Delta = 0;
- for (Index = 0; Index < Length; Index++) {
- Delta |= Destination[Index] ^ Source[Index];
- }
- if (Delta == 0) {
- return 0;
- } else {
- return -1;
- }
-}
-
-/**
- Generate Salt value.
-
- @param[in, out] SaltValue Points to the salt buffer
- @param[in] SaltSize Size of the salt buffer
-
- @retval TRUE Salt is generated.
- @retval FALSE Salt is not generated.
-**/
-BOOLEAN
-EFIAPI
-KeyLibGenerateSalt (
- IN OUT UINT8 *SaltValue,
- IN UINTN SaltSize
- )
-{
- if (SaltValue == NULL) {
- return FALSE;
- }
- RandomSeed(NULL, 0);
- RandomBytes(SaltValue, SaltSize);
- return TRUE;
-}
-
-/**
- Hash the password with PBKDF2.
-
- @param[in] HashType Hash type
- @param[in] Key Points to the key buffer
- @param[in] KeySize Key buffer size
- @param[in] SaltValue Points to the salt buffer
- @param[in] SaltSize Size of the salt buffer
- @param[out] KeyHash Points to the hashed result
- @param[in] KeyHashSize Size of the hash buffer
-
- @retval TRUE Hash the data successfully.
- @retval FALSE Failed to hash the data.
-
-**/
-BOOLEAN
-EFIAPI
-KeyLibGeneratePBKDF2Hash (
- IN UINT32 HashType,
- IN VOID *Key,
- IN UINTN KeySize,
- IN UINT8 *SaltValue,
- IN UINTN SaltSize,
- OUT UINT8 *KeyHash,
- IN UINTN KeyHashSize
- )
-{
- BOOLEAN Result;
-
- if (HashType != HASH_TYPE_SHA256) {
- return FALSE;
- }
- if (KeyHashSize != SHA256_DIGEST_SIZE) {
- return FALSE;
- }
-
- Result = Pkcs5HashPassword (
- KeySize,
- Key,
- SaltSize,
- SaltValue,
- DEFAULT_PBKDF2_ITERATION_COUNT,
- SHA256_DIGEST_SIZE,
- KeyHashSize,
- KeyHash
- );
- return Result;
-}
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c
deleted file mode 100644
index b4326d380f..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c
+++ /dev/null
@@ -1,484 +0,0 @@
-/** @file
- This Driver mainly provides Setup Form to change password.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "UserAuthentication2Dxe.h"
-
-USER_AUTHENTICATION_PRIVATE_DATA *mUserAuthenticationData = NULL;
-
-EFI_GUID mUserAuthenticationVendorGuid = USER_AUTHENTICATION_FORMSET_GUID;
-HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- }
- },
- USER_AUTHENTICATION_FORMSET_GUID
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
- }
- }
-};
-
-/**
- Display a message box to end user.
-
- @param[in] DisplayString The string in message box.
-**/
-VOID
-MessageBox (
- IN CHAR16 *DisplayString
- )
-{
- EFI_INPUT_KEY Key;
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
-}
-
-/**
- Force system reset.
-**/
-VOID
-ForceSystemReset (
- VOID
- )
-{
- MessageBox (L"Password retry count reach, reset system!");
- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
- CpuDeadLoop();
-}
-
-/**
- Display message for set password.
-
- @param[in] ReturnStatus The return status for set password.
-**/
-VOID
-PrintSetPasswordStatus (
- IN EFI_STATUS ReturnStatus
- )
-{
- CHAR16 *DisplayString;
- CHAR16 *DisplayString2;
-
- EFI_INPUT_KEY Key;
-
- if (ReturnStatus == EFI_UNSUPPORTED) {
- DisplayString = L"New password is not strong enough!";
- DisplayString2 = L"Password must at least 8 chars and include lowercase, uppercase alphabetic, number and symbol";
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- DisplayString2,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- } else {
- if (ReturnStatus == EFI_SUCCESS) {
- DisplayString = L"New password is updated successfully!";
- } else if (ReturnStatus == EFI_ALREADY_STARTED) {
- DisplayString = L"New password is found in the history passwords!";
- } else {
- DisplayString = L"New password update fails!";
- }
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- }
-}
-
-/**
- This function allows a caller to extract the current configuration for one
- or more named elements from the target driver.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Request A null-terminated Unicode string in
- <ConfigRequest> 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_SUCCESS The Results is filled with the requested values.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
- @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
- driver.
-
-**/
-EFI_STATUS
-EFIAPI
-ExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
- )
-{
- if (Progress == NULL || Results == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- *Progress = Request;
- return EFI_NOT_FOUND;
-}
-
-
-/**
- This function processes the results of changes in configuration.
-
- @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_SUCCESS The Results is processed successfully.
- @retval EFI_INVALID_PARAMETER Configuration is NULL.
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
- driver.
-
-**/
-EFI_STATUS
-EFIAPI
-RouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
- )
-{
- if (Configuration == NULL || Progress == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Progress = Configuration;
-
- return EFI_NOT_FOUND;
-}
-
-/**
- HII update Admin Password status.
-
-**/
-VOID
-HiiUpdateAdminPasswordStatus (
- VOID
- )
-{
- if (IsPasswordInstalled ()) {
- HiiSetString (
- mUserAuthenticationData->HiiHandle,
- STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
- L"Installed",
- NULL
- );
- } else {
- HiiSetString (
- mUserAuthenticationData->HiiHandle,
- STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
- L"Not Installed",
- NULL
- );
- }
-}
-
-/**
- This function processes the results of changes in configuration.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original
- exporting driver so that it can identify the type
- of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original
- exporting driver.
- @param ActionRequest On return, points to the action requested by the
- callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
- variable and its data.
- @retval EFI_DEVICE_ERROR The variable could not be saved.
- @retval EFI_UNSUPPORTED The specified Action is not supported by the
- callback.
-
-**/
-EFI_STATUS
-EFIAPI
-UserAuthenticationCallback (
- 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;
- CHAR16 *UserInputPassword;
-
- Status = EFI_SUCCESS;
-
- if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE)) ||
- (ActionRequest == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- switch (Action) {
- case EFI_BROWSER_ACTION_FORM_OPEN:
- {
- switch (QuestionId) {
- case ADMIN_PASSWORD_KEY_ID:
- HiiUpdateAdminPasswordStatus ();
- default:
- break;
- }
- }
- break;
- case EFI_BROWSER_ACTION_CHANGING:
- {
- switch (QuestionId) {
- case ADMIN_PASSWORD_KEY_ID:
- if ((Type == EFI_IFR_TYPE_STRING) && (Value->string == 0) &&
- (mUserAuthenticationData->PasswordState == BROWSER_STATE_SET_PASSWORD)) {
- mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
- ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
- return EFI_INVALID_PARAMETER;
- }
- //
- // The Callback is responsible for validating old password input by user,
- // If Callback return EFI_SUCCESS, it indicates validation pass.
- //
- switch (mUserAuthenticationData->PasswordState) {
- case BROWSER_STATE_VALIDATE_PASSWORD:
- UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
- if (UserInputPassword == NULL) {
- return EFI_UNSUPPORTED;
- }
- if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
- Status = EFI_NOT_READY;
- break;
- }
- if (UserInputPassword[0] == 0) {
- //
- // Setup will use an empty password to check whether the old password is set,
- // If the validation is successful, means there is no old password, return
- // success to set the new password. Or need to return EFI_NOT_READY to
- // let user input the old password.
- //
- Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
- if (Status == EFI_SUCCESS) {
- mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
- } else {
- Status = EFI_NOT_READY;
- }
- break;
- }
- Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
- if (Status == EFI_SUCCESS) {
- mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
- StrCpyS (
- mUserAuthenticationData->OldPassword,
- sizeof(mUserAuthenticationData->OldPassword)/sizeof(CHAR16),
- UserInputPassword
- );
- } else {
- //
- // Old password mismatch, return EFI_NOT_READY to prompt for error message.
- //
- if (Status == EFI_ACCESS_DENIED) {
- //
- // Password retry count reach.
- //
- ForceSystemReset ();
- }
- Status = EFI_NOT_READY;
- }
- break;
-
- case BROWSER_STATE_SET_PASSWORD:
- UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
- if (UserInputPassword == NULL) {
- return EFI_UNSUPPORTED;
- }
- if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
- Status = EFI_NOT_READY;
- break;
- }
- Status = SetPassword (UserInputPassword, StrSize (UserInputPassword), mUserAuthenticationData->OldPassword, StrSize(mUserAuthenticationData->OldPassword));
- PrintSetPasswordStatus (Status);
- ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
- mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
- HiiUpdateAdminPasswordStatus ();
- break;
-
- default:
- break;
- }
- default:
- break;
- }
- }
- break;
- default:
- break;
- }
- return Status;
-}
-
-/**
- User Authentication entry point.
-
- @param ImageHandle The image handle.
- @param SystemTable The system table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @return other Contain some other errors.
-
-**/
-EFI_STATUS
-EFIAPI
-UserAuthentication2Entry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE DriverHandle;
- EFI_HII_HANDLE HiiHandle;
-
- DriverHandle = NULL;
-
- mUserAuthenticationData = AllocateZeroPool (sizeof (USER_AUTHENTICATION_PRIVATE_DATA));
- if (mUserAuthenticationData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- mUserAuthenticationData->ConfigAccess.ExtractConfig = ExtractConfig;
- mUserAuthenticationData->ConfigAccess.RouteConfig = RouteConfig;
- mUserAuthenticationData->ConfigAccess.Callback = UserAuthenticationCallback;
- mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
-
- //
- // Install Config Access protocol to driver handle.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &mUserAuthenticationData->ConfigAccess,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- mUserAuthenticationData->DriverHandle = DriverHandle;
-
- //
- // Add HII data to database.
- //
- HiiHandle = HiiAddPackages (
- &mUserAuthenticationVendorGuid,
- DriverHandle,
- UserAuthentication2DxeStrings,
- UserAuthenticationDxeVfrBin,
- NULL
- );
- if (HiiHandle == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- mUserAuthenticationData->HiiHandle = HiiHandle;
-
- return EFI_SUCCESS;
-}
-
-/**
- Unloads the application and its installed protocol.
-
- @param[in] ImageHandle Handle that identifies the image to be unloaded.
-
- @retval EFI_SUCCESS The image has been unloaded.
-**/
-EFI_STATUS
-EFIAPI
-UserAuthentication2Unload (
- IN EFI_HANDLE ImageHandle
- )
-{
- ASSERT (mUserAuthenticationData != NULL);
-
- //
- // Uninstall Config Access Protocol.
- //
- if (mUserAuthenticationData->DriverHandle != NULL) {
- gBS->UninstallMultipleProtocolInterfaces (
- mUserAuthenticationData->DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &mUserAuthenticationData->ConfigAccess,
- NULL
- );
- mUserAuthenticationData->DriverHandle = NULL;
- }
-
- //
- // Remove Hii Data.
- //
- if (mUserAuthenticationData->HiiHandle != NULL) {
- HiiRemovePackages (mUserAuthenticationData->HiiHandle);
- }
-
- FreePool (mUserAuthenticationData);
- mUserAuthenticationData = NULL;
-
- return EFI_SUCCESS;
-}
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.c
deleted file mode 100644
index bba2057a96..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.c
+++ /dev/null
@@ -1,780 +0,0 @@
-/** @file
- This Driver mainly provides Setup Form to change password and
- does user authentication before entering Setup.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "UserAuthenticationDxe.h"
-
-EFI_EVENT mExitBootServicesEvent = NULL;
-EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
-USER_AUTHENTICATION_PRIVATE_DATA *mUserAuthenticationData = NULL;
-EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL;
-
-EFI_GUID mUserAuthenticationVendorGuid = USER_AUTHENTICATION_FORMSET_GUID;
-HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- }
- },
- USER_AUTHENTICATION_FORMSET_GUID
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
- }
- }
-};
-
-/**
- Get a user input string.
-
- @param[in] PopUpString A popup string to inform user.
- @param[in, out] UserInput The user input string
- @param[in] UserInputMaxLen The max unicode count of the UserInput without NULL terminator.
-**/
-EFI_STATUS
-GetUserInput (
- IN CHAR16 *PopUpString,
- IN OUT CHAR16 *UserInput,
- IN UINTN UserInputMaxLen
- )
-{
- EFI_INPUT_KEY InputKey;
- UINTN InputLength;
- CHAR16 *Mask;
-
- UserInput[0] = 0;
- Mask = AllocateZeroPool ((UserInputMaxLen + 1) * sizeof(CHAR16));
- if (Mask == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- InputLength = 0;
-
- while (TRUE) {
- if (InputLength < UserInputMaxLen) {
- Mask[InputLength] = L'_';
- }
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &InputKey,
- PopUpString,
- L"--------------------------------",
- Mask,
- NULL
- );
- if (InputKey.ScanCode == SCAN_NULL) {
- //
- // Check whether finish inputing password.
- //
- if (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN && InputLength > 0) {
- //
- // Add the null terminator.
- //
- UserInput[InputLength] = 0;
- break;
- } else if ((InputKey.UnicodeChar == CHAR_NULL) ||
- (InputKey.UnicodeChar == CHAR_LINEFEED) ||
- (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN)
- ) {
- continue;
- } else {
- //
- // delete last key entered
- //
- if (InputKey.UnicodeChar == CHAR_BACKSPACE) {
- if (InputLength > 0) {
- UserInput[InputLength] = 0;
- Mask[InputLength] = 0;
- InputLength--;
- }
- } else {
- if (InputLength == UserInputMaxLen) {
- Mask[InputLength] = 0;
- continue;
- }
- //
- // add Next key entry
- //
- UserInput[InputLength] = InputKey.UnicodeChar;
- Mask[InputLength] = L'*';
- InputLength++;
- }
- }
- }
- }
- FreePool (Mask);
- return EFI_SUCCESS;
-}
-
-/**
- Display a message box to end user.
-
- @param[in] DisplayString The string in message box.
-**/
-VOID
-MessageBox (
- IN CHAR16 *DisplayString
- )
-{
- EFI_INPUT_KEY Key;
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
-}
-
-/**
- Force system reset.
-**/
-VOID
-ForceSystemReset (
- VOID
- )
-{
- MessageBox (L"Password retry count reach, reset system!");
- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
- CpuDeadLoop();
-}
-
-/**
- Display message for set password.
-
- @param[in] ReturnStatus The return status for set password.
-**/
-VOID
-PrintSetPasswordStatus (
- IN EFI_STATUS ReturnStatus
- )
-{
- CHAR16 *DisplayString;
- CHAR16 *DisplayString2;
-
- EFI_INPUT_KEY Key;
-
- if (ReturnStatus == EFI_UNSUPPORTED) {
- DisplayString = L"New password is not strong enough!";
- DisplayString2 = L"Password must at least 8 chars and include lowercase, uppercase alphabetic, number and symbol";
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- DisplayString2,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- } else {
- if (ReturnStatus == EFI_SUCCESS) {
- DisplayString = L"New password is updated successfully!";
- } else if (ReturnStatus == EFI_ALREADY_STARTED) {
- DisplayString = L"New password is found in the history passwords!";
- } else {
- DisplayString = L"New password update fails!";
- }
-
- do {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"",
- DisplayString,
- L"Press ENTER to continue ...",
- L"",
- NULL
- );
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- }
-}
-
-/**
- Require user input password.
-
- @retval TRUE User input correct password successfully.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-RequireUserPassword (
- VOID
- )
-{
- EFI_STATUS Status;
- CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
- CHAR16 *PopUpString;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY VerifyPolicy;
-
- Status = EFI_SUCCESS;
- ZeroMem(UserInputPw, sizeof(UserInputPw));
-
- if (!IsPasswordInstalled ()) {
- return FALSE;
- }
-
- Status = GetPasswordVerificationPolicy (&VerifyPolicy);
- if (!EFI_ERROR (Status)) {
- if (WasPasswordVerified() && (!VerifyPolicy.NeedReVerify)) {
- DEBUG ((DEBUG_INFO, "Password was verified and Re-verify is not needed\n"));
- return TRUE;
- }
- }
-
- PopUpString = L"Please input admin password";
-
- while (TRUE) {
- gST->ConOut->ClearScreen(gST->ConOut);
- GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
-
- Status = VerifyPassword (UserInputPw, StrSize(UserInputPw));
- if (!EFI_ERROR(Status)) {
- break;
- }
- if (Status == EFI_ACCESS_DENIED) {
- //
- // Password retry count reach.
- //
- ForceSystemReset ();
- }
- MessageBox (L"Incorrect password!");
- }
-
- ZeroMem(UserInputPw, sizeof(UserInputPw));
-
- gST->ConOut->ClearScreen(gST->ConOut);
-
- return TRUE;
-}
-
-/**
- Set user password.
-
-**/
-VOID
-SetUserPassword (
- VOID
- )
-{
- EFI_STATUS Status;
- CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
- CHAR16 TmpPassword[PASSWORD_MAX_SIZE];
- CHAR16 *PopUpString;
- CHAR16 *PopUpString2;
-
- ZeroMem(UserInputPw, sizeof(UserInputPw));
- ZeroMem(TmpPassword, sizeof(TmpPassword));
-
- PopUpString = L"Please set admin password";
-
- while (TRUE) {
- gST->ConOut->ClearScreen(gST->ConOut);
- GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
-
- PopUpString2 = L"Please confirm your new password";
- gST->ConOut->ClearScreen(gST->ConOut);
- GetUserInput (PopUpString2, TmpPassword, PASSWORD_MAX_SIZE - 1);
- if (StrCmp (TmpPassword, UserInputPw) != 0) {
- MessageBox (L"Password are not the same!");
- continue;
- }
-
- Status = SetPassword (UserInputPw, StrSize(UserInputPw), NULL, 0);
- PrintSetPasswordStatus (Status);
- if (!EFI_ERROR(Status)) {
- break;
- }
- }
-
- ZeroMem(UserInputPw, sizeof(UserInputPw));
- ZeroMem(TmpPassword, sizeof(TmpPassword));
-
- gST->ConOut->ClearScreen(gST->ConOut);
-}
-
-/**
- Check password before entering into setup.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @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. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. 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.
- Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @retval EFI_SUCCESS Status code is what we expected.
- @retval EFI_UNSUPPORTED Status code not supported.
-
-**/
-EFI_STATUS
-EFIAPI
-CheckForPassword (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId, OPTIONAL
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- BOOLEAN PasswordSet;
-
- if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) &&
- (Value == (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP))) {
- //
- // Check whether enter setup page.
- //
- PasswordSet = RequireUserPassword ();
- if (PasswordSet) {
- DEBUG ((DEBUG_INFO, "Welcome Admin!\n"));
- } else {
- DEBUG ((DEBUG_INFO, "Admin password is not set!\n"));
- if (NeedEnrollPassword()) {
- SetUserPassword ();
- }
- }
-
- return EFI_SUCCESS;
- } else{
- return EFI_UNSUPPORTED;
- }
-}
-
-/**
- This function allows a caller to extract the current configuration for one
- or more named elements from the target driver.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Request A null-terminated Unicode string in
- <ConfigRequest> 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_SUCCESS The Results is filled with the requested values.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
- @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
- driver.
-
-**/
-EFI_STATUS
-EFIAPI
-ExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
- )
-{
- if (Progress == NULL || Results == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- *Progress = Request;
- return EFI_NOT_FOUND;
-}
-
-
-/**
- This function processes the results of changes in configuration.
-
- @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_SUCCESS The Results is processed successfully.
- @retval EFI_INVALID_PARAMETER Configuration is NULL.
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
- driver.
-
-**/
-EFI_STATUS
-EFIAPI
-RouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
- )
-{
- if (Configuration == NULL || Progress == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Progress = Configuration;
-
- return EFI_NOT_FOUND;
-}
-
-/**
- HII update Admin Password status.
-
-**/
-VOID
-HiiUpdateAdminPasswordStatus (
- VOID
- )
-{
- if (IsPasswordInstalled ()) {
- HiiSetString (
- mUserAuthenticationData->HiiHandle,
- STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
- L"Installed",
- NULL
- );
- } else {
- HiiSetString (
- mUserAuthenticationData->HiiHandle,
- STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
- L"Not Installed",
- NULL
- );
- }
-}
-
-/**
- This function processes the results of changes in configuration.
-
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param Action Specifies the type of action taken by the browser.
- @param QuestionId A unique value which is sent to the original
- exporting driver so that it can identify the type
- of data to expect.
- @param Type The type of value for the question.
- @param Value A pointer to the data being sent to the original
- exporting driver.
- @param ActionRequest On return, points to the action requested by the
- callback function.
-
- @retval EFI_SUCCESS The callback successfully handled the action.
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
- variable and its data.
- @retval EFI_DEVICE_ERROR The variable could not be saved.
- @retval EFI_UNSUPPORTED The specified Action is not supported by the
- callback.
-
-**/
-EFI_STATUS
-EFIAPI
-UserAuthenticationCallback (
- 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;
- CHAR16 *UserInputPassword;
-
- Status = EFI_SUCCESS;
-
- if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE)) ||
- (ActionRequest == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- switch (Action) {
- case EFI_BROWSER_ACTION_FORM_OPEN:
- {
- switch (QuestionId) {
- case ADMIN_PASSWORD_KEY_ID:
- HiiUpdateAdminPasswordStatus ();
- default:
- break;
- }
- }
- break;
- case EFI_BROWSER_ACTION_CHANGING:
- {
- switch (QuestionId) {
- case ADMIN_PASSWORD_KEY_ID:
- if ((Type == EFI_IFR_TYPE_STRING) && (Value->string == 0) &&
- (mUserAuthenticationData->PasswordState == BROWSER_STATE_SET_PASSWORD)) {
- mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
- ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
- return EFI_INVALID_PARAMETER;
- }
- //
- // The Callback is responsible for validating old password input by user,
- // If Callback return EFI_SUCCESS, it indicates validation pass.
- //
- switch (mUserAuthenticationData->PasswordState) {
- case BROWSER_STATE_VALIDATE_PASSWORD:
- UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
- if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
- Status = EFI_NOT_READY;
- break;
- }
- if (UserInputPassword[0] == 0) {
- //
- // Setup will use a NULL password to check whether the old password is set,
- // If the validation is successful, means there is no old password, return
- // success to set the new password. Or need to return EFI_NOT_READY to
- // let user input the old password.
- //
- Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
- if (Status == EFI_SUCCESS) {
- mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
- } else {
- Status = EFI_NOT_READY;
- }
- break;
- }
- Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
- if (Status == EFI_SUCCESS) {
- mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
- StrCpyS (
- mUserAuthenticationData->OldPassword,
- sizeof(mUserAuthenticationData->OldPassword)/sizeof(CHAR16),
- UserInputPassword
- );
- } else {
- //
- // Old password mismatch, return EFI_NOT_READY to prompt for error message.
- //
- if (Status == EFI_ACCESS_DENIED) {
- //
- // Password retry count reach.
- //
- ForceSystemReset ();
- }
- Status = EFI_NOT_READY;
- }
- break;
-
- case BROWSER_STATE_SET_PASSWORD:
- UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
- if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
- Status = EFI_NOT_READY;
- break;
- }
- Status = SetPassword (UserInputPassword, StrSize (UserInputPassword), mUserAuthenticationData->OldPassword, StrSize(mUserAuthenticationData->OldPassword));
- PrintSetPasswordStatus (Status);
- ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
- mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
- HiiUpdateAdminPasswordStatus ();
- break;
-
- default:
- break;
- }
- default:
- break;
- }
- }
- break;
- default:
- break;
- }
- return Status;
-}
-
-/**
- Unregister status code callback functions.
-
- @param Event Event whose notification function is being invoked.
- @param Context Pointer to the notification function's context, which is
- always zero in current implementation.
-
-**/
-VOID
-EFIAPI
-UnregisterBootTimeHandlers (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- mRscHandlerProtocol->Unregister (CheckForPassword);
-}
-
-/**
- User Authentication entry point.
-
- @param ImageHandle The image handle.
- @param SystemTable The system table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @return other Contain some other errors.
-
-**/
-EFI_STATUS
-EFIAPI
-UserAuthenticationEntry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE DriverHandle;
- EFI_HII_HANDLE HiiHandle;
-
- DriverHandle = NULL;
-
- mUserAuthenticationData = AllocateZeroPool (sizeof (USER_AUTHENTICATION_PRIVATE_DATA));
- if (mUserAuthenticationData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- mUserAuthenticationData->ConfigAccess.ExtractConfig = ExtractConfig;
- mUserAuthenticationData->ConfigAccess.RouteConfig = RouteConfig;
- mUserAuthenticationData->ConfigAccess.Callback = UserAuthenticationCallback;
- mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
-
- //
- // Install Config Access protocol to driver handle.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &mUserAuthenticationData->ConfigAccess,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- mUserAuthenticationData->DriverHandle = DriverHandle;
-
- //
- // Add HII data to database.
- //
- HiiHandle = HiiAddPackages (
- &mUserAuthenticationVendorGuid,
- DriverHandle,
- UserAuthenticationDxeStrings,
- UserAuthenticationDxeVfrBin,
- NULL
- );
- if (HiiHandle == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- mUserAuthenticationData->HiiHandle = HiiHandle;
-
- //
- // Locate report status code protocol.
- //
- Status = gBS->LocateProtocol (
- &gEfiRscHandlerProtocolGuid,
- NULL,
- (VOID **) &mRscHandlerProtocol
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- //Register the callback function for ReportStatusCode() notification.
- //
- mRscHandlerProtocol->Register (CheckForPassword, TPL_HIGH_LEVEL);
-
- //
- // Unregister boot time report status code listener at ExitBootService Event.
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- UnregisterBootTimeHandlers,
- NULL,
- &gEfiEventExitBootServicesGuid,
- &mExitBootServicesEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Locates SMM Communication protocol.
- //
- Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication);
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
-
-/**
- Unloads the application and its installed protocol.
-
- @param[in] ImageHandle Handle that identifies the image to be unloaded.
-
- @retval EFI_SUCCESS The image has been unloaded.
-**/
-EFI_STATUS
-EFIAPI
-UserAuthenticationUnload (
- IN EFI_HANDLE ImageHandle
- )
-{
- ASSERT (mUserAuthenticationData != NULL);
-
- //
- // Uninstall Config Access Protocol.
- //
- if (mUserAuthenticationData->DriverHandle != NULL) {
- gBS->UninstallMultipleProtocolInterfaces (
- mUserAuthenticationData->DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &mUserAuthenticationData->ConfigAccess,
- NULL
- );
- mUserAuthenticationData->DriverHandle = NULL;
- }
-
- //
- // Remove Hii Data.
- //
- if (mUserAuthenticationData->HiiHandle != NULL) {
- HiiRemovePackages (mUserAuthenticationData->HiiHandle);
- }
-
- FreePool (mUserAuthenticationData);
- mUserAuthenticationData = NULL;
-
- return EFI_SUCCESS;
-}
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxePassword.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxePassword.c
deleted file mode 100644
index 6e1fedfab7..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxePassword.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/** @file
- UserAuthentication DXE password wrapper.
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "UserAuthenticationDxe.h"
-
-/**
- Initialize the communicate buffer using DataSize and Function.
-
- @param[out] DataPtr Points to the data in the communicate buffer.
- @param[in] DataSize The data size to send to SMM.
- @param[in] Function The function number to initialize the communicate header.
-
- @return Communicate buffer.
-**/
-VOID*
-InitCommunicateBuffer (
- OUT VOID **DataPtr OPTIONAL,
- IN UINTN DataSize,
- IN UINTN Function
- )
-{
- EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
- VOID *Buffer;
- EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable;
- EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
- UINTN Index;
- UINTN Size;
- EFI_STATUS Status;
-
- Buffer = NULL;
- Status = EfiGetSystemConfigurationTable (
- &gEdkiiPiSmmCommunicationRegionTableGuid,
- (VOID **) &SmmCommRegionTable
- );
- if (EFI_ERROR (Status)) {
- return NULL;
- }
- ASSERT (SmmCommRegionTable != NULL);
- SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
- Size = 0;
- for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) {
- if (SmmCommMemRegion->Type == EfiConventionalMemory) {
- Size = EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages);
- if (Size >= (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) {
- break;
- }
- }
- SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRegion + SmmCommRegionTable->DescriptorSize);
- }
- ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
-
- Buffer = (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart;
- ASSERT (Buffer != NULL);
- SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
- CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid);
- SmmCommunicateHeader->MessageLength = DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data;
- ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER));
- SmmPasswordFunctionHeader->Function = Function;
- if (DataPtr != NULL) {
- *DataPtr = SmmPasswordFunctionHeader + 1;
- }
-
- return Buffer;
-}
-
-/**
- Send the data in communicate buffer to SMM.
-
- @param[in] Buffer Points to the data in the communicate buffer.
- @param[in] DataSize The data size to send to SMM.
-
- @retval EFI_SUCCESS Success is returned from the function in SMM.
- @retval Others Failure is returned from the function in SMM.
-
-**/
-EFI_STATUS
-SendCommunicateBuffer (
- IN VOID *Buffer,
- IN UINTN DataSize
- )
-{
- EFI_STATUS Status;
- UINTN CommSize;
- EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
-
- CommSize = DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- Status = mSmmCommunication->Communicate (mSmmCommunication, Buffer, &CommSize);
- ASSERT_EFI_ERROR (Status);
-
- SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
- SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data;
- return SmmPasswordFunctionHeader->ReturnStatus;
-}
-
-/**
- Validate if the password is correct.
-
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval EFI_SUCCESS The password is correct.
- @retval EFI_SECURITY_VIOLATION The password is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
-**/
-EFI_STATUS
-VerifyPassword (
- IN CHAR16 *Password,
- IN UINTN PasswordSize
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD *VerifyPassword;
-
- ASSERT (Password != NULL);
-
- if (PasswordSize > sizeof(VerifyPassword->Password) * sizeof(CHAR16)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Buffer = InitCommunicateBuffer (
- (VOID**)&VerifyPassword,
- sizeof(*VerifyPassword),
- SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = UnicodeStrToAsciiStrS (Password, VerifyPassword->Password, sizeof(VerifyPassword->Password));
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
-
- Status = SendCommunicateBuffer (Buffer, sizeof(*VerifyPassword));
-
-EXIT:
- ZeroMem (VerifyPassword, sizeof(*VerifyPassword));
- return Status;
-}
-
-/**
- Set a new password.
-
- @param[in] NewPassword The user input new password.
- NULL means clear password.
- @param[in] NewPasswordSize The size of NewPassword in byte.
- @param[in] OldPassword The user input old password.
- NULL means no old password.
- @param[in] OldPasswordSize The size of OldPassword in byte.
-
- @retval EFI_SUCCESS The NewPassword is set successfully.
- @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
- @retval EFI_INVALID_PARAMETER The password or size is invalid.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
- @retval EFI_ACCESS_DENIED Password retry count reach.
- @retval EFI_UNSUPPORTED NewPassword is not strong enough.
- @retval EFI_ALREADY_STARTED NewPassword is in history.
-**/
-EFI_STATUS
-SetPassword (
- IN CHAR16 *NewPassword, OPTIONAL
- IN UINTN NewPasswordSize,
- IN CHAR16 *OldPassword, OPTIONAL
- IN UINTN OldPasswordSize
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_SET_PASSWORD *SetPassword;
-
- if (NewPasswordSize > sizeof(SetPassword->NewPassword) * sizeof(CHAR16)) {
- return EFI_INVALID_PARAMETER;
- }
- if (OldPasswordSize > sizeof(SetPassword->OldPassword) * sizeof(CHAR16)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Buffer = InitCommunicateBuffer (
- (VOID**)&SetPassword,
- sizeof(*SetPassword),
- SMM_PASSWORD_FUNCTION_SET_PASSWORD
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (NewPassword != NULL) {
- Status = UnicodeStrToAsciiStrS (NewPassword, SetPassword->NewPassword, sizeof(SetPassword->NewPassword));
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- } else {
- SetPassword->NewPassword[0] = 0;
- }
-
- if (OldPassword != NULL) {
- Status = UnicodeStrToAsciiStrS (OldPassword, SetPassword->OldPassword, sizeof(SetPassword->OldPassword));
- if (EFI_ERROR(Status)) {
- goto EXIT;
- }
- } else {
- SetPassword->OldPassword[0] = 0;
- }
-
- Status = SendCommunicateBuffer (Buffer, sizeof(*SetPassword));
-
-EXIT:
- ZeroMem (SetPassword, sizeof(*SetPassword));
- return Status;
-}
-
-/**
- Return if the password is set.
-
- @retval TRUE The password is set.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-IsPasswordInstalled (
- VOID
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
-
- Buffer = InitCommunicateBuffer (
- NULL,
- 0,
- SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET
- );
- if (Buffer == NULL) {
- return FALSE;
- }
-
- Status = SendCommunicateBuffer (Buffer, 0);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- Get password verification policy.
-
- @param[out] VerifyPolicy Verification policy.
-
- @retval EFI_SUCCESS Get verification policy successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verification policy.
-**/
-EFI_STATUS
-GetPasswordVerificationPolicy (
- OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *GetVerifyPolicy;
-
- Buffer = InitCommunicateBuffer (
- (VOID**)&GetVerifyPolicy,
- sizeof(*GetVerifyPolicy),
- SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY
- );
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = SendCommunicateBuffer (Buffer, sizeof(*GetVerifyPolicy));
- if (!EFI_ERROR (Status)) {
- CopyMem (VerifyPolicy, GetVerifyPolicy, sizeof (SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY));
- }
-
- return Status;
-}
-
-/**
- Return if the password was verified.
-
- @retval TRUE The password was verified.
- @retval FALSE The password was not verified.
-**/
-BOOLEAN
-WasPasswordVerified (
- VOID
- )
-{
- EFI_STATUS Status;
- VOID *Buffer;
-
- Buffer = InitCommunicateBuffer (
- NULL,
- 0,
- SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED
- );
- if (Buffer == NULL) {
- return FALSE;
- }
-
- Status = SendCommunicateBuffer (Buffer, 0);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.c
deleted file mode 100644
index 07e834ebfa..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.c
+++ /dev/null
@@ -1,674 +0,0 @@
-/** @file
-
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "UserAuthenticationSmm.h"
-
-EFI_SMM_VARIABLE_PROTOCOL *mSmmVariable;
-
-UINTN mAdminPasswordTryCount = 0;
-
-BOOLEAN mNeedReVerify = TRUE;
-BOOLEAN mPasswordVerified = FALSE;
-
-/**
- Verify if the password is correct.
-
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
- @param[in] UserPasswordVarStruct The storage of password in variable.
-
- @retval EFI_SUCCESS The password is correct.
- @retval EFI_SECURITY_VIOLATION The password is incorrect.
-**/
-EFI_STATUS
-VerifyPassword (
- IN CHAR8 *Password,
- IN UINTN PasswordSize,
- IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
- )
-{
- BOOLEAN HashOk;
- UINT8 HashData[PASSWORD_HASH_SIZE];
-
- HashOk = KeyLibGeneratePBKDF2Hash (
- HASH_TYPE_SHA256,
- (UINT8 *)Password,
- PasswordSize,
- UserPasswordVarStruct->PasswordSalt,
- sizeof(UserPasswordVarStruct->PasswordSalt),
- HashData,
- sizeof(HashData)
- );
- if (!HashOk) {
- return EFI_DEVICE_ERROR;
- }
- if (KeyLibSlowCompareMem (UserPasswordVarStruct->PasswordHash, HashData, PASSWORD_HASH_SIZE) == 0) {
- return EFI_SUCCESS;
- } else {
- return EFI_SECURITY_VIOLATION;
- }
-}
-
-/**
- Get hash data of password from non-volatile variable region.
-
- @param[in] UserGuid The user GUID of the password variable.
- @param[in] Index The index of the password.
- 0 means current password.
- Non-0 means the password history.
- @param[out] UserPasswordVarStruct The storage of password in variable.
-
- @retval EFI_SUCCESS The password hash is returned successfully.
- @retval EFI_NOT_FOUND The password hash is not found.
-**/
-EFI_STATUS
-GetPasswordHashFromVariable (
- IN EFI_GUID *UserGuid,
- IN UINTN Index,
- OUT USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
- )
-{
- UINTN DataSize;
- CHAR16 PasswordName[sizeof(USER_AUTHENTICATION_VAR_NAME)/sizeof(CHAR16) + 5];
-
- if (Index != 0) {
- UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s%04x", USER_AUTHENTICATION_VAR_NAME, Index);
- } else {
- UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s", USER_AUTHENTICATION_VAR_NAME);
- }
-
- DataSize = sizeof(*UserPasswordVarStruct);
- return mSmmVariable->SmmGetVariable (
- PasswordName,
- UserGuid,
- NULL,
- &DataSize,
- UserPasswordVarStruct
- );
-}
-
-/**
- Save password hash data to non-volatile variable region.
-
- @param[in] UserGuid The user GUID of the password variable.
- @param[in] UserPasswordVarStruct The storage of password in variable.
-
- @retval EFI_SUCCESS The password hash is saved successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the password hash.
-**/
-EFI_STATUS
-SavePasswordHashToVariable (
- IN EFI_GUID *UserGuid,
- IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
- )
-{
- EFI_STATUS Status;
-
- if (UserPasswordVarStruct == NULL) {
- Status = mSmmVariable->SmmSetVariable (
- USER_AUTHENTICATION_VAR_NAME,
- UserGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- 0,
- NULL
- );
- } else {
- Status = mSmmVariable->SmmSetVariable (
- USER_AUTHENTICATION_VAR_NAME,
- UserGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof(*UserPasswordVarStruct),
- UserPasswordVarStruct
- );
- }
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "SavePasswordHashToVariable fails with %r\n", Status));
- }
-
- return Status;
-}
-
-/**
- Save old password hash data to non-volatile variable region as history.
-
- The number of password history variable is limited.
- If all the password history variables are used, the new password history
- will override the oldest one.
-
- @param[in] UserGuid The user GUID of the password variable.
- @param[in] UserPasswordVarStruct The storage of password in variable.
-
- @retval EFI_SUCCESS The password hash is saved successfully.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the password hash.
-**/
-EFI_STATUS
-SaveOldPasswordToHistory (
- IN EFI_GUID *UserGuid,
- IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
- )
-{
- EFI_STATUS Status;
- UINTN DataSize;
- UINT32 LastIndex;
- CHAR16 PasswordName[sizeof(USER_AUTHENTICATION_VAR_NAME)/sizeof(CHAR16) + 5];
-
- DEBUG ((DEBUG_INFO, "SaveOldPasswordToHistory\n"));
-
- DataSize = sizeof(LastIndex);
- Status = mSmmVariable->SmmGetVariable (
- USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME,
- UserGuid,
- NULL,
- &DataSize,
- &LastIndex
- );
- if (EFI_ERROR(Status)) {
- LastIndex = 0;
- }
- if (LastIndex >= PASSWORD_HISTORY_CHECK_COUNT) {
- LastIndex = 0;
- }
-
- LastIndex ++;
- UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s%04x", USER_AUTHENTICATION_VAR_NAME, LastIndex);
-
-
- Status = mSmmVariable->SmmSetVariable (
- PasswordName,
- UserGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof(*UserPasswordVarStruct),
- UserPasswordVarStruct
- );
- DEBUG ((DEBUG_INFO, " -- to %s, %r\n", PasswordName, Status));
- if (!EFI_ERROR(Status)) {
- Status = mSmmVariable->SmmSetVariable (
- USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME,
- UserGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof(LastIndex),
- &LastIndex
- );
- DEBUG ((DEBUG_INFO, " LastIndex - 0x%04x, %r\n", LastIndex, Status));
- }
-
- return Status;
-}
-
-/**
- Calculate password hash data and save it to non-volatile variable region.
-
- @param[in] UserGuid The user GUID of the password variable.
- @param[in] Password The user input password.
- NULL means delete the password variable.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval EFI_SUCCESS The password hash is calculated and saved.
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the password hash.
-**/
-EFI_STATUS
-SavePasswordToVariable (
- IN EFI_GUID *UserGuid,
- IN CHAR8 *Password, OPTIONAL
- IN UINTN PasswordSize
- )
-{
- EFI_STATUS Status;
- USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
- BOOLEAN HashOk;
-
- //
- // If password is NULL, it means we want to clean password field saved in variable region.
- //
- if (Password != NULL) {
- KeyLibGenerateSalt (UserPasswordVarStruct.PasswordSalt, sizeof(UserPasswordVarStruct.PasswordSalt));
- HashOk = KeyLibGeneratePBKDF2Hash (
- HASH_TYPE_SHA256,
- (UINT8 *)Password,
- PasswordSize,
- UserPasswordVarStruct.PasswordSalt,
- sizeof(UserPasswordVarStruct.PasswordSalt),
- UserPasswordVarStruct.PasswordHash,
- sizeof(UserPasswordVarStruct.PasswordHash)
- );
- if (!HashOk) {
- return EFI_DEVICE_ERROR;
- }
- Status = SavePasswordHashToVariable (UserGuid, &UserPasswordVarStruct);
- //
- // Save Password data to history variable
- //
- if (!EFI_ERROR(Status)) {
- SaveOldPasswordToHistory (UserGuid, &UserPasswordVarStruct);
- }
- } else {
- Status = SavePasswordHashToVariable (UserGuid, NULL);
- }
-
- return Status;
-}
-
-/**
- Verify the password.
- If the password variable does not exist, it passes the verification.
- If the password variable exists, it does verification based upon password variable.
-
- @param[in] UserGuid The user GUID of the password variable.
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval TRUE The verification passes.
- @retval FALSE The verification fails.
-**/
-BOOLEAN
-IsPasswordVerified (
- IN EFI_GUID *UserGuid,
- IN CHAR8 *Password,
- IN UINTN PasswordSize
- )
-{
- USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
- EFI_STATUS Status;
- UINTN *PasswordTryCount;
-
- PasswordTryCount = &mAdminPasswordTryCount;
-
- Status = GetPasswordHashFromVariable (UserGuid, 0, &UserPasswordVarStruct);
- if (EFI_ERROR(Status)) {
- return TRUE;
- }
-
- //
- // Old password exists
- //
- Status = VerifyPassword (Password, PasswordSize, &UserPasswordVarStruct);
- if (EFI_ERROR(Status)) {
- if (Password[0] != 0) {
- *PasswordTryCount = *PasswordTryCount + 1;
- }
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- Return if the password is set.
-
- @param[in] UserGuid The user GUID of the password variable.
-
- @retval TRUE The password is set.
- @retval FALSE The password is not set.
-**/
-BOOLEAN
-IsPasswordSet (
- IN EFI_GUID *UserGuid
- )
-{
- USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
- EFI_STATUS Status;
-
- Status = GetPasswordHashFromVariable(UserGuid, 0, &UserPasswordVarStruct);
- if (EFI_ERROR(Status)) {
- return FALSE;
- }
- return TRUE;
-}
-
-/**
- Return if the password is strong.
- Criteria:
- 1) length >= PASSWORD_MIN_SIZE
- 2) include lower case, upper case, number, symbol.
-
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval TRUE The password is strong.
- @retval FALSE The password is weak.
-**/
-BOOLEAN
-IsPasswordStrong (
- IN CHAR8 *Password,
- IN UINTN PasswordSize
- )
-{
- UINTN Index;
- BOOLEAN HasLowerCase;
- BOOLEAN HasUpperCase;
- BOOLEAN HasNumber;
- BOOLEAN HasSymbol;
-
- if (PasswordSize < PASSWORD_MIN_SIZE) {
- return FALSE;
- }
-
- HasLowerCase = FALSE;
- HasUpperCase = FALSE;
- HasNumber = FALSE;
- HasSymbol = FALSE;
- for (Index = 0; Index < PasswordSize - 1; Index++) {
- if (Password[Index] >= 'a' && Password[Index] <= 'z') {
- HasLowerCase = TRUE;
- } else if (Password[Index] >= 'A' && Password[Index] <= 'Z') {
- HasUpperCase = TRUE;
- } else if (Password[Index] >= '0' && Password[Index] <= '9') {
- HasNumber = TRUE;
- } else {
- HasSymbol = TRUE;
- }
- }
- if ((!HasLowerCase) || (!HasUpperCase) || (!HasNumber) || (!HasSymbol)) {
- return FALSE;
- }
- return TRUE;
-}
-
-/**
- Return if the password is set before in PASSWORD_HISTORY_CHECK_COUNT.
-
- @param[in] UserGuid The user GUID of the password variable.
- @param[in] Password The user input password.
- @param[in] PasswordSize The size of Password in byte.
-
- @retval TRUE The password is set before.
- @retval FALSE The password is not set before.
-**/
-BOOLEAN
-IsPasswordInHistory (
- IN EFI_GUID *UserGuid,
- IN CHAR8 *Password,
- IN UINTN PasswordSize
- )
-{
- EFI_STATUS Status;
- USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
- UINTN Index;
-
- for (Index = 1; Index <= PASSWORD_HISTORY_CHECK_COUNT; Index++) {
- Status = GetPasswordHashFromVariable (UserGuid, Index, &UserPasswordVarStruct);
- if (!EFI_ERROR(Status)) {
- Status = VerifyPassword (Password, PasswordSize, &UserPasswordVarStruct);
- if (!EFI_ERROR(Status)) {
- return TRUE;
- }
- }
- }
-
- return FALSE;
-}
-
-/**
- Communication service SMI Handler entry.
-
- This SMI handler provides services for password management.
-
- @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
-SmmPasswordHandler (
- IN EFI_HANDLE DispatchHandle,
- IN CONST VOID *RegisterContext,
- IN OUT VOID *CommBuffer,
- IN OUT UINTN *CommBufferSize
- )
-{
- EFI_STATUS Status;
- SMM_PASSWORD_COMMUNICATE_HEADER *SmmFunctionHeader;
- UINTN CommBufferPayloadSize;
- UINTN TempCommBufferSize;
- SMM_PASSWORD_COMMUNICATE_SET_PASSWORD SmmCommunicateSetPassword;
- SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD SmmCommunicateVerifyPassword;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY SmmCommunicateSetVerifyPolicy;
- SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *SmmCommunicateGetVerifyPolicy;
- UINTN PasswordLen;
- EFI_GUID *UserGuid;
- UINTN *PasswordTryCount;
-
- //
- // If input is invalid, stop processing this SMI
- //
- if (CommBuffer == NULL || CommBufferSize == NULL) {
- return EFI_SUCCESS;
- }
-
- TempCommBufferSize = *CommBufferSize;
- PasswordLen = 0;
-
- if (TempCommBufferSize < sizeof (SMM_PASSWORD_COMMUNICATE_HEADER)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SMM communication buffer size invalid!\n"));
- return EFI_SUCCESS;
- }
-
- CommBufferPayloadSize = TempCommBufferSize - sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
-
- Status = EFI_SUCCESS;
- SmmFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)CommBuffer;
-
- UserGuid = &gUserAuthenticationGuid;
- PasswordTryCount = &mAdminPasswordTryCount;
-
- switch (SmmFunctionHeader->Function) {
- case SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET:
- PasswordTryCount = NULL;
- if (CommBufferPayloadSize != 0) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: IS_PASSWORD_SET payload buffer invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- if (IsPasswordSet(UserGuid)) {
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_NOT_FOUND;
- }
- break;
- case SMM_PASSWORD_FUNCTION_SET_PASSWORD:
- if (*PasswordTryCount >= PASSWORD_MAX_TRY_COUNT) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_PASSWORD try count reach!\n"));
- PasswordTryCount = NULL;
- Status = EFI_ACCESS_DENIED;
- goto EXIT;
- }
- if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_SET_PASSWORD)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_PASSWORD payload buffer invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- CopyMem (&SmmCommunicateSetPassword, SmmFunctionHeader + 1, sizeof(SmmCommunicateSetPassword));
-
- PasswordLen = AsciiStrnLenS(SmmCommunicateSetPassword.OldPassword, sizeof(SmmCommunicateSetPassword.OldPassword));
- if (PasswordLen == sizeof(SmmCommunicateSetPassword.OldPassword)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: OldPassword invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
-
- if (!IsPasswordVerified (UserGuid, SmmCommunicateSetPassword.OldPassword, PasswordLen + 1)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: PasswordVerify - FAIL\n"));
- Status = EFI_SECURITY_VIOLATION;
- goto EXIT;
- }
-
- PasswordLen = AsciiStrnLenS(SmmCommunicateSetPassword.NewPassword, sizeof(SmmCommunicateSetPassword.NewPassword));
- if (PasswordLen == sizeof(SmmCommunicateSetPassword.NewPassword)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- if (PasswordLen != 0 && !IsPasswordStrong (SmmCommunicateSetPassword.NewPassword, PasswordLen + 1)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword too weak!\n"));
- Status = EFI_UNSUPPORTED;
- goto EXIT;
- }
- if (PasswordLen != 0 && IsPasswordInHistory (UserGuid, SmmCommunicateSetPassword.NewPassword, PasswordLen + 1)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword in history!\n"));
- Status = EFI_ALREADY_STARTED;
- goto EXIT;
- }
-
- if (PasswordLen == 0) {
- Status = SavePasswordToVariable (UserGuid, NULL, 0);
- } else {
- Status = SavePasswordToVariable (UserGuid, SmmCommunicateSetPassword.NewPassword, PasswordLen + 1);
- }
- break;
-
- case SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD:
- if (*PasswordTryCount >= PASSWORD_MAX_TRY_COUNT) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: VERIFY_PASSWORD try count reach!\n"));
- PasswordTryCount = NULL;
- Status = EFI_ACCESS_DENIED;
- goto EXIT;
- }
- if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: VERIFY_PASSWORD payload buffer invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- CopyMem (&SmmCommunicateVerifyPassword, SmmFunctionHeader + 1, sizeof(SmmCommunicateVerifyPassword));
-
- PasswordLen = AsciiStrnLenS(SmmCommunicateVerifyPassword.Password, sizeof(SmmCommunicateVerifyPassword.Password));
- if (PasswordLen == sizeof(SmmCommunicateVerifyPassword.Password)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: Password invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- if (!IsPasswordVerified (UserGuid, SmmCommunicateVerifyPassword.Password, PasswordLen + 1)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: PasswordVerify - FAIL\n"));
- Status = EFI_SECURITY_VIOLATION;
- goto EXIT;
- }
- mPasswordVerified = TRUE;
- Status = EFI_SUCCESS;
- break;
-
- case SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY:
- PasswordTryCount = NULL;
- if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_VERIFY_POLICY payload buffer invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- CopyMem (&SmmCommunicateSetVerifyPolicy, SmmFunctionHeader + 1, sizeof(SmmCommunicateSetVerifyPolicy));
- mNeedReVerify = SmmCommunicateSetVerifyPolicy.NeedReVerify;
- break;
-
- case SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY:
- PasswordTryCount = NULL;
- if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY)) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: GET_VERIFY_POLICY payload buffer invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- SmmCommunicateGetVerifyPolicy = (SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *) (SmmFunctionHeader + 1);
- SmmCommunicateGetVerifyPolicy->NeedReVerify = mNeedReVerify;
- break;
- case SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED:
- PasswordTryCount = NULL;
- if (CommBufferPayloadSize != 0) {
- DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: WAS_PASSWORD_VERIFIED payload buffer invalid!\n"));
- Status = EFI_INVALID_PARAMETER;
- goto EXIT;
- }
- if (mPasswordVerified) {
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_NOT_STARTED;
- }
- break;
-
- default:
- PasswordTryCount = NULL;
- Status = EFI_UNSUPPORTED;
- break;
- }
-
-EXIT:
- if (PasswordTryCount != NULL) {
- if (Status == EFI_SUCCESS) {
- *PasswordTryCount = 0;
- }
- }
- SmmFunctionHeader->ReturnStatus = Status;
-
- return EFI_SUCCESS;
-}
-
-/**
- Main entry for this driver.
-
- @param ImageHandle Image handle this driver.
- @param SystemTable Pointer to SystemTable.
-
- @retval EFI_SUCESS This function always complete successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-PasswordSmmInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE SmmHandle;
- EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;
- CHAR16 PasswordHistoryName[sizeof(USER_AUTHENTICATION_VAR_NAME)/sizeof(CHAR16) + 5];
- UINTN Index;
-
- ASSERT (PASSWORD_HASH_SIZE == SHA256_DIGEST_SIZE);
- ASSERT (PASSWORD_HISTORY_CHECK_COUNT < 0xFFFF);
-
- Status = gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID**)&mSmmVariable);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Make password variables read-only for DXE driver for security concern.
- //
- Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);
- if (!EFI_ERROR (Status)) {
- Status = VariableLock->RequestToLock (VariableLock, USER_AUTHENTICATION_VAR_NAME, &gUserAuthenticationGuid);
- ASSERT_EFI_ERROR (Status);
-
- for (Index = 1; Index <= PASSWORD_HISTORY_CHECK_COUNT; Index++) {
- UnicodeSPrint (PasswordHistoryName, sizeof (PasswordHistoryName), L"%s%04x", USER_AUTHENTICATION_VAR_NAME, Index);
- Status = VariableLock->RequestToLock (VariableLock, PasswordHistoryName, &gUserAuthenticationGuid);
- ASSERT_EFI_ERROR (Status);
- }
- Status = VariableLock->RequestToLock (VariableLock, USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME, &gUserAuthenticationGuid);
- ASSERT_EFI_ERROR (Status);
- }
-
- SmmHandle = NULL;
- Status = gSmst->SmiHandlerRegister (SmmPasswordHandler, &gUserAuthenticationGuid, &SmmHandle);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (IsPasswordCleared()) {
- DEBUG ((DEBUG_INFO, "IsPasswordCleared\n"));
- SavePasswordToVariable (&gUserAuthenticationGuid, NULL, 0);
- }
-
- return EFI_SUCCESS;
-}
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni b/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni
deleted file mode 100644
index b0255889e0..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni
+++ /dev/null
@@ -1,19 +0,0 @@
-// /** @file
-// NULL platform password library instance that returns the password clear state based upon PCD.
-//
-// NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared
-// but returns the PCD value directly. This instance can be used to verify security
-// related features during platform enabling and development. It should be replaced
-// by a platform-specific method(e.g. Button pressed) in a real platform for product.
-//
-// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "NULL platform password library instance that returns the password clear state based upon PCD."
-
-#string STR_MODULE_DESCRIPTION #language en-US "NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared but returns the PCD value directly. This instance can be used to verify security related features during platform enabling and development. It should be replaced by a platform-specific method(e.g. Button pressed) in a real platform for product."
-
diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeStrings.uni b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeStrings.uni
deleted file mode 100644
index 1e3a179677..0000000000
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeStrings.uni
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
-// String definitions for User Authentication formset.
-//
-// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-**/
-
-#langdef en-US "English"
-#langdef fr-FR "Francais"
-
-
-#string STR_FORM_SET_TITLE #language en-US "User Password Management"
- #language fr-FR "User Password Management"
-#string STR_FORM_SET_TITLE_HELP #language en-US "This Driver mainly handle user's password"
- #language fr-FR "This Driver mainly handle user's password"
-#string STR_FORM_TITLE #language en-US "Password Management Form"
- #language fr-FR "Password Management Form"
-#string STR_ADMIN_PASSWORD_PROMPT #language en-US "Change Admin Password"
- #language fr-FR "Change Admin Password"
-#string STR_ADMIN_PASSWORD_HELP #language en-US "Input old admin password if it was set, then you can change the password to a new one. After the change action, you may need input the new password when you enter UI. The new password must be between 8 and 32 chars include lowercase, uppercase alphabetic, number, and symbol. Input an empty password can clean old admin password, then no need input password to enter UI."
- #language fr-FR "Input old admin password if it was set, then you can change the password to a new one. After the change action, you may need input the new password when you enter UI. The new password must be between 8 and 32 chars include lowercase, uppercase alphabetic, number, and symbol. Input an empty password can clean old admin password, then no need input password to enter UI."
-#string STR_ADMIN_PASSWORD_STS_HELP #language en-US "Current Admin Password status: Installed or Not Installed."
- #language fr-FR "Current Admin Password status: Installed or Not Installed."
-#string STR_ADMIN_PASSWORD_STS_PROMPT #language en-US "Admin Password Status"
- #language fr-FR "Admin Password Status"
-#string STR_ADMIN_PASSWORD_STS_CONTENT #language en-US ""
- #language fr-FR ""
-
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 27/49] Features/Intel/UserAuthFeaturePkg: Add initial package
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 27/49] Features/Intel/UserAuthFeaturePkg: Add initial package Kubacki, Michael A
@ 2019-11-15 23:50 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:50 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A; +Cc: Bi, Dandan, Gao, Liming
Please at least fill in the "Purpose" section of all the new Readme.md files you are creating, don't leave the entire file as TODOs.
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Bi, Dandan <dandan.bi@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 27/49] Features/Intel/UserAuthFeaturePkg: Add initial package
Adds a new feature package for the User Authentication feature.
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec | 49 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc | 141 ++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dsc | 30 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf | 12 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf | 8 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf | 38 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf | 37 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf | 41 +
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.inf | 52 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.inf | 62 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.inf | 53 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Guid/UserAuthentication.h | 45 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/PlatformPasswordLib.h | 48 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordLib.h | 70 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordUiLib.h | 37 +
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.h | 88 +++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.h | 55 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.h | 138 ++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeFormset.h | 23 +
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.h | 52 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeVfr.vfr | 39 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c | 78 ++
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c | 274 +++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c | 522 +++++++++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.c | 133 ++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.c | 484 ++++++++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.c | 780 ++++++++++++++++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxePassword.c | 319 ++++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.c | 674 +++++++++++++++++
Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni | 19 +
Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md | 86 +++
Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeStrings.uni | 30 +
32 files changed, 4517 insertions(+)
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
new file mode 100644
index 0000000000..a9174edd54
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
@@ -0,0 +1,49 @@
+## @file
+# This package provides advanced feature functionality for User Authentication support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = UserAuthFeaturePkg
+ PACKAGE_GUID = 08737161-3956-422A-9ABD-FCE3C8DBA3D4
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[LibraryClasses]
+ ## @libraryclass Provides a platform-specific method to return the password policy.
+ PlatformPasswordLib|Include/Library/PlatformPasswordLib.h
+
+ ## @libraryclass Provides services to set/verify the password and return if the password is set.
+ UserPasswordLib|Include/Library/UserPasswordLib.h
+
+ ## @libraryclass Provides services to perform password authentication.
+ UserPasswordUiLib|Include/Library/UserPasswordUiLib.h
+
+[Guids]
+ gUserAuthFeaturePkgTokenSpaceGuid = {0xa2793a6e, 0x6af1, 0x45c4, {0x88, 0x4d, 0x3d, 0x0c, 0x7a, 0xfe, 0x91, 0xc6}}
+
+ ## Include Include/Guid/UserAuthentication.h
+ gUserAuthenticationGuid = { 0xee24a7f7, 0x606b, 0x4724, { 0xb3, 0xc9, 0xf5, 0xae, 0x4a, 0x3b, 0x81, 0x65}}
+
+[PcdsFeatureFlag]
+ ## This PCD specifies whether StatusCode is reported via USB3 Serial port.
+ gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable|FALSE|BOOLEAN|0xA0000001
+
+[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx]
+ ## Indicate whether the password is cleared.
+ # When it is configured to Dynamic or DynamicEx, it can be set through detection using
+ # a platform-specific method (e.g. Board Jumper set) in a actual platform in early boot phase.<BR><BR>
+ # @Prompt The password clear status
+ gUserAuthFeaturePkgTokenSpaceGuid.PcdPasswordCleared|FALSE|BOOLEAN|0xF0000001
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc
new file mode 100644
index 0000000000..e8d9a639bc
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc
@@ -0,0 +1,141 @@
+## @file
+# This is a build description file for the User Authentication advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+################################################################################
+[LibraryClasses]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+ IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+ OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+
+ #####################################
+ # User Authentication Feature Package
+ #####################################
+ PlatformPasswordLib|UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
+ UserPasswordLib|UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
+
+[LibraryClasses.common.DXE_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+
+[LibraryClasses.common.DXE_SMM_DRIVER]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
+ MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
+ SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
+
+###################################################################################################
+#
+# Components Section - list of the modules and components that will be processed by compilation
+# tools and the EDK II tools to generate PE32/PE32+/Coff image files.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# Binary modules do not need to be listed in this section, as they should be
+# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi),
+# Logo (Logo.bmp), and etc.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+###################################################################################################
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # User Authentication Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+
+ # Add components here that should be included in the package build.
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
+ #####################################
+ # User Authentication Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package components and should be tested
+ # in the package build.
+ UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
+
+ # Add components here that should be included in the package build.
+ UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.inf
+ UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.inf
+ UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.inf
+
+###################################################################################################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
+###################################################################################################
+[BuildOptions]
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dsc b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dsc
new file mode 100644
index 0000000000..74eb9213ce
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dsc
@@ -0,0 +1,30 @@
+## @file
+# This is a build description file for the User Authentication advanced feature.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and
+# INF files to generate AutoGen.c and AutoGen.h files
+# for the build infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ PLATFORM_NAME = UserAuthFeaturePkg
+ PLATFORM_GUID = E859E721-41C7-46A9-98DE-8C2F29097880
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#
+# This package always builds the feature.
+#
+!include Include/UserAuthFeature.dsc
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..f0b33aa44c
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,12 @@
+## @file
+# FDF file for post-memory modules that enable User Authentication.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+ INF UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.inf
+ INF UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.inf
+ INF UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.inf
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..512d1a2673
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory modules that enable User Authentication.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
new file mode 100644
index 0000000000..00be14df8a
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
@@ -0,0 +1,38 @@
+## @file
+# NULL platform password library instance that returns the password clear state based upon PCD.
+#
+# NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared
+# but returns the PCD value directly. This instance can be used to verify security
+# related features during platform enabling and development. It should be replaced
+# by a platform-specific method(e.g. Button pressed) in a real platform for product.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010006
+ BASE_NAME = PlatformPasswordLibNull
+ MODULE_UNI_FILE = PlatformPasswordLibNull.uni
+ FILE_GUID = 27417BCA-0CCD-4089-9711-AD069A33C555
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = PlatformPasswordLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_DRIVER
+ CONSTRUCTOR = PlatformPasswordLibNullConstructor
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC
+#
+
+[Sources]
+ PlatformPasswordLibNull.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[Pcd]
+ gUserAuthFeaturePkgTokenSpaceGuid.PcdPasswordCleared ## CONSUMES
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
new file mode 100644
index 0000000000..99d84ae637
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
@@ -0,0 +1,37 @@
+## @file
+# UserPasswordLib instance provides services to set/verify password
+# and return if the password is set.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UserPasswordLib
+ FILE_GUID = 422BA58A-F162-4ECC-BD9A-AD84FE940F37
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = UserPasswordLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_DRIVER UEFI_APPLICATION
+
+[Sources]
+ UserPasswordLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ DebugLib
+ UefiLib
+ BaseMemoryLib
+
+[Guids]
+ gUserAuthenticationGuid ## CONSUMES ## GUID
+ gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable
+
+[Protocols]
+ gEfiSmmCommunicationProtocolGuid ## CONSUMES
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
new file mode 100644
index 0000000000..9ab7d83319
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
@@ -0,0 +1,41 @@
+## @file
+# UserPasswordUiLib instance provides services to do password authentication.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UserPasswordUiLib
+ FILE_GUID = E2E92636-F511-46BC-A08B-02F815AFA884
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = UserPasswordUiLib|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_DRIVER UEFI_APPLICATION
+
+[Sources]
+ UserPasswordUiLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ UefiRuntimeServicesTableLib
+ DebugLib
+ UefiLib
+ MemoryAllocationLib
+ BaseMemoryLib
+ PrintLib
+ PlatformPasswordLib
+ UserPasswordLib
+
+[Guids]
+ gUserAuthenticationGuid ## CONSUMES ## GUID
+ gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable
+
+[Protocols]
+ gEfiSmmCommunicationProtocolGuid ## CONSUMES
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.inf b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.inf
new file mode 100644
index 0000000000..2c6c3661fb
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.inf
@@ -0,0 +1,52 @@
+## @file
+# User Authentication 2 Dxe Driver.
+#
+# This Driver mainly provides Setup Form to change password.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UserAuthentication2Dxe
+ FILE_GUID = 4EF592F4-C716-40CC-8C07-1E4E3BD71F11
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 2.0
+ ENTRY_POINT = UserAuthentication2Entry
+ UNLOAD_IMAGE = UserAuthentication2Unload
+[Sources]
+ UserAuthentication2Dxe.c
+ UserAuthentication2Dxe.h
+ UserAuthenticationDxeFormset.h
+ UserAuthenticationDxeVfr.vfr
+ UserAuthenticationDxeStrings.uni
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiRuntimeServicesTableLib
+ BaseMemoryLib
+ DebugLib
+ UefiLib
+ HiiLib
+ DevicePathLib
+ MemoryAllocationLib
+ UserPasswordLib
+
+[Protocols]
+ gEfiDevicePathProtocolGuid ## PRODUCES
+ gEfiHiiConfigAccessProtocolGuid ## PRODUCES
+
+[Depex]
+ gEfiSimpleTextOutProtocolGuid AND
+ gEfiSmmCommunicationProtocolGuid AND
+ gEfiVariableArchProtocolGuid AND
+ gEfiVariableWriteArchProtocolGuid
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.inf b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.inf
new file mode 100644
index 0000000000..58066b588c
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.inf
@@ -0,0 +1,62 @@
+## @file
+# User Authentication Dxe Driver.
+#
+# This Driver mainly provides Setup Form to change password and
+# does user authentication before entering Setup.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UserAuthenticationDxe
+ FILE_GUID = 0683FB88-664C-4BA6-9ED4-1C0916EE43A4
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 2.0
+ ENTRY_POINT = UserAuthenticationEntry
+ UNLOAD_IMAGE = UserAuthenticationUnload
+
+[Sources]
+ UserAuthenticationDxe.c
+ UserAuthenticationDxe.h
+ UserAuthenticationDxePassword.c
+ UserAuthenticationDxeFormset.h
+ UserAuthenticationDxeVfr.vfr
+ UserAuthenticationDxeStrings.uni
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiRuntimeServicesTableLib
+ BaseMemoryLib
+ DebugLib
+ UefiLib
+ HiiLib
+ DevicePathLib
+ MemoryAllocationLib
+ PlatformPasswordLib
+ PrintLib
+
+[Guids]
+ gUserAuthenticationGuid ## CONSUMES ## GUID
+ gEfiEventExitBootServicesGuid ## CONSUMES ## Event
+ gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable
+
+[Protocols]
+ gEfiRscHandlerProtocolGuid ## CONSUMES
+ gEfiDevicePathProtocolGuid ## PRODUCES
+ gEfiHiiConfigAccessProtocolGuid ## PRODUCES
+ gEfiSmmCommunicationProtocolGuid ## CONSUMES
+
+[Depex]
+ gEfiSimpleTextOutProtocolGuid AND
+ gEfiSmmCommunicationProtocolGuid AND
+ gEfiVariableArchProtocolGuid AND
+ gEfiVariableWriteArchProtocolGuid
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.inf b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.inf
new file mode 100644
index 0000000000..0b33b194aa
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.inf
@@ -0,0 +1,53 @@
+## @file
+# User Authentication Smm Driver.
+#
+# This driver provides SMM services for DXE user authentication module.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UserAuthenticationSmm
+ FILE_GUID = 8fc6aaaa-4561-4815-8cf7-b87312992dce
+ MODULE_TYPE = DXE_SMM_DRIVER
+ VERSION_STRING = 1.0
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ ENTRY_POINT = PasswordSmmInit
+
+[Sources]
+ UserAuthenticationSmm.c
+ UserAuthenticationSmm.h
+ KeyService.c
+ KeyService.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ CryptoPkg/CryptoPkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ DebugLib
+ BaseLib
+ BaseMemoryLib
+ PrintLib
+ SmmServicesTableLib
+ MemoryAllocationLib
+ UefiLib
+ BaseCryptLib
+ PlatformPasswordLib
+
+[Guids]
+ gUserAuthenticationGuid ## CONSUMES ## GUID
+
+[Protocols]
+ gEdkiiVariableLockProtocolGuid ## CONSUMES
+ gEfiSmmVariableProtocolGuid ## CONSUMES
+
+[Depex]
+ gEfiSmmVariableProtocolGuid AND gEfiVariableWriteArchProtocolGuid
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Guid/UserAuthentication.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Guid/UserAuthentication.h
new file mode 100644
index 0000000000..2a41a46cdc
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Guid/UserAuthentication.h
@@ -0,0 +1,45 @@
+/** @file
+ GUID is for UserAuthentication SMM communication.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USER_AUTHENTICATION_GUID_H__
+#define __USER_AUTHENTICATION_GUID_H__
+
+#define PASSWORD_MIN_SIZE 9 // MIN number of chars of password, including NULL.
+#define PASSWORD_MAX_SIZE 33 // MAX number of chars of password, including NULL.
+
+#define USER_AUTHENTICATION_GUID \
+ { 0xf06e3ea7, 0x611c, 0x4b6b, { 0xb4, 0x10, 0xc2, 0xbf, 0x94, 0x3f, 0x38, 0xf2 } }
+
+extern EFI_GUID gUserAuthenticationGuid;
+
+typedef struct {
+ UINTN Function;
+ EFI_STATUS ReturnStatus;
+} SMM_PASSWORD_COMMUNICATE_HEADER;
+
+#define SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET 1
+#define SMM_PASSWORD_FUNCTION_SET_PASSWORD 2
+#define SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD 3
+#define SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY 4
+#define SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY 5
+#define SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED 6
+
+typedef struct {
+ CHAR8 NewPassword[PASSWORD_MAX_SIZE];
+ CHAR8 OldPassword[PASSWORD_MAX_SIZE];
+} SMM_PASSWORD_COMMUNICATE_SET_PASSWORD;
+
+typedef struct {
+ CHAR8 Password[PASSWORD_MAX_SIZE];
+} SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD;
+
+typedef struct {
+ BOOLEAN NeedReVerify;
+} SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY;
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/PlatformPasswordLib.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/PlatformPasswordLib.h
new file mode 100644
index 0000000000..ce27947f6d
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/PlatformPasswordLib.h
@@ -0,0 +1,48 @@
+/** @file
+ Provides a platform-specific method to return password policy.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PLATFORM_PASSWORD_LIB_H__
+#define __PLATFORM_PASSWORD_LIB_H__
+
+/**
+ This function is called at password driver entrypoint.
+ This function should be called only once, to clear the password.
+
+ This function provides a way to reset the password, just in case
+ the platform owner forgets the password.
+ The platform should provide a secure way to make sure
+ only the platform owner is allowed to clear password.
+
+ Once the password is cleared, the platform should provide a way
+ to set a new password.
+
+ @retval TRUE There is a platform request to clear the password.
+ @retval FALSE There is no platform request to clear the password.
+**/
+BOOLEAN
+EFIAPI
+IsPasswordCleared (
+ VOID
+ );
+
+/**
+ This function is called if the password driver finds that the password is not enrolled,
+ when the password is required to input.
+
+ This function should return the action according to platform policy.
+
+ @retval TRUE The caller should force the user to enroll the password.
+ @retval FALSE The caller may skip the password enroll.
+**/
+BOOLEAN
+EFIAPI
+NeedEnrollPassword (
+ VOID
+ );
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordLib.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordLib.h
new file mode 100644
index 0000000000..b6aad224e9
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordLib.h
@@ -0,0 +1,70 @@
+/** @file
+ Provides services to set/verify password and return if the password is set.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USER_PASSWORD_LIB_H__
+#define __USER_PASSWORD_LIB_H__
+
+/**
+ Validate if the password is correct.
+
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval EFI_SUCCESS The password is correct.
+ @retval EFI_SECURITY_VIOLATION The password is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+**/
+EFI_STATUS
+EFIAPI
+VerifyPassword (
+ IN CHAR16 *Password,
+ IN UINTN PasswordSize
+ );
+
+/**
+ Set a new password.
+
+ @param[in] NewPassword The user input new password.
+ NULL means clear password.
+ @param[in] NewPasswordSize The size of NewPassword in byte.
+ @param[in] OldPassword The user input old password.
+ NULL means no old password.
+ @param[in] OldPasswordSize The size of OldPassword in byte.
+
+ @retval EFI_SUCCESS The NewPassword is set successfully.
+ @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+ @retval EFI_UNSUPPORTED NewPassword is not strong enough.
+ @retval EFI_ALREADY_STARTED NewPassword is in history.
+**/
+EFI_STATUS
+EFIAPI
+SetPassword (
+ IN CHAR16 *NewPassword, OPTIONAL
+ IN UINTN NewPasswordSize,
+ IN CHAR16 *OldPassword, OPTIONAL
+ IN UINTN OldPasswordSize
+ );
+
+/**
+ Return if the password is set.
+
+ @retval TRUE The password is set.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+EFIAPI
+IsPasswordInstalled (
+ VOID
+ );
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordUiLib.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordUiLib.h
new file mode 100644
index 0000000000..117f480733
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Include/Library/UserPasswordUiLib.h
@@ -0,0 +1,37 @@
+/** @file
+ Provides services to do password authentication.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USER_PASSWORD_UI_LIB_H__
+#define __USER_PASSWORD_UI_LIB_H__
+
+/**
+ Do password authentication.
+
+ @retval EFI_SUCCESS Password authentication pass.
+**/
+EFI_STATUS
+EFIAPI
+UiDoPasswordAuthentication (
+ VOID
+ );
+
+/**
+ Set password verification policy.
+
+ @param[in] NeedReVerify Need re-verify or not.
+
+ @retval EFI_SUCCESS Set verification policy successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to set verification policy.
+**/
+EFI_STATUS
+EFIAPI
+UiSetPasswordVerificationPolicy (
+ IN BOOLEAN NeedReVerify
+ );
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.h
new file mode 100644
index 0000000000..d0b20851fa
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.h
@@ -0,0 +1,88 @@
+/** @file
+ Header file for key service.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __KEY_LIB_H__
+#define __KEY_LIB_H__
+
+/**
+ Compares the contents of two buffers with slow algorithm
+
+ This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
+ If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
+ value returned is the first mismatched byte in SourceBuffer subtracted from the first
+ mismatched byte in DestinationBuffer.
+
+ If Length > 0 and DestinationBuffer is NULL, then ASSERT().
+ If Length > 0 and SourceBuffer is NULL, then ASSERT().
+ If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
+ If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
+
+ @param DestinationBuffer The pointer to the destination buffer to compare.
+ @param SourceBuffer The pointer to the source buffer to compare.
+ @param Length The number of bytes to compare.
+
+ @return 0 All Length bytes of the two buffers are identical.
+ @retval -1 The SourceBuffer is not identical to DestinationBuffer.
+
+**/
+INTN
+EFIAPI
+KeyLibSlowCompareMem (
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
+ );
+
+/**
+ Generate Salt value.
+
+ @param[in, out] SaltValue Points to the salt buffer
+ @param[in] SaltSize Size of the salt buffer
+
+ @retval TRUE Salt is generated.
+ @retval FALSE Salt is not generated.
+**/
+BOOLEAN
+EFIAPI
+KeyLibGenerateSalt(
+ IN OUT UINT8 *SaltValue,
+ IN UINTN SaltSize
+ );
+
+#define HASH_TYPE_SHA256 0x000B
+#define DEFAULT_PBKDF2_ITERATION_COUNT 1000
+
+/**
+ Hash the password with PBKDF2.
+
+ @param[in] HashType Hash type
+ @param[in] Key Points to the key buffer
+ @param[in] KeySize Key buffer size
+ @param[in] SaltValue Points to the salt buffer
+ @param[in] SaltSize Size of the salt buffer
+ @param[out] KeyHash Points to the hashed result
+ @param[in] KeyHashSize Size of the hash buffer
+
+ @retval TRUE Hash the data successfully.
+ @retval FALSE Failed to hash the data.
+
+**/
+BOOLEAN
+EFIAPI
+KeyLibGeneratePBKDF2Hash (
+ IN UINT32 HashType,
+ IN VOID *Key,
+ IN UINTN KeySize,
+ IN UINT8 *SaltValue,
+ IN UINTN SaltSize,
+ OUT UINT8 *KeyHash,
+ IN UINTN KeyHashSize
+ );
+
+#endif
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.h
new file mode 100644
index 0000000000..3b7fba026d
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.h
@@ -0,0 +1,55 @@
+/** @file
+ Header file for UserAuthentication2Dxe.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _USER_AUTHENTICATION_DXE_H_
+#define _USER_AUTHENTICATION_DXE_H_
+
+
+#include <Protocol/ReportStatusCodeHandler.h>
+#include <Protocol/HiiConfigAccess.h>
+
+#include <Guid/MdeModuleHii.h>
+#include <Guid/HiiPlatformSetupFormset.h>
+#include <Guid/UserAuthentication.h>
+
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/BaseLib.h>
+#include <Library/UefiLib.h>
+#include <Library/HiiLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UserPasswordLib.h>
+
+#include "UserAuthenticationDxeFormset.h"
+
+extern UINT8 UserAuthenticationDxeVfrBin[];
+extern UINT8 UserAuthentication2DxeStrings[];
+
+typedef struct {
+ EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
+ EFI_HANDLE DriverHandle;
+ EFI_HII_HANDLE HiiHandle;
+ UINT8 PasswordState;
+ CHAR16 OldPassword[PASSWORD_MAX_SIZE];
+} USER_AUTHENTICATION_PRIVATE_DATA;
+
+#pragma pack(1)
+///
+/// HII specific Vendor Device Path definition.
+///
+typedef struct {
+ VENDOR_DEVICE_PATH VendorDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL End;
+} HII_VENDOR_DEVICE_PATH;
+#pragma pack()
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.h
new file mode 100644
index 0000000000..e183424f35
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.h
@@ -0,0 +1,138 @@
+/** @file
+ Header file for UserAuthenticationDxe.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _USER_AUTHENTICATION_DXE_H_
+#define _USER_AUTHENTICATION_DXE_H_
+
+
+#include <Protocol/ReportStatusCodeHandler.h>
+#include <Protocol/HiiConfigAccess.h>
+#include <Protocol/SmmCommunication.h>
+
+#include <Guid/MdeModuleHii.h>
+#include <Guid/HiiPlatformSetupFormset.h>
+#include <Guid/PiSmmCommunicationRegionTable.h>
+#include <Guid/UserAuthentication.h>
+
+#include <Library/PrintLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/BaseLib.h>
+#include <Library/UefiLib.h>
+#include <Library/HiiLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PlatformPasswordLib.h>
+
+#include "UserAuthenticationDxeFormset.h"
+
+extern UINT8 UserAuthenticationDxeVfrBin[];
+extern UINT8 UserAuthenticationDxeStrings[];
+extern EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication;
+
+typedef struct {
+ EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
+ EFI_HANDLE DriverHandle;
+ EFI_HII_HANDLE HiiHandle;
+ UINT8 PasswordState;
+ CHAR16 OldPassword[PASSWORD_MAX_SIZE];
+} USER_AUTHENTICATION_PRIVATE_DATA;
+
+#pragma pack(1)
+///
+/// HII specific Vendor Device Path definition.
+///
+typedef struct {
+ VENDOR_DEVICE_PATH VendorDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL End;
+} HII_VENDOR_DEVICE_PATH;
+#pragma pack()
+
+/**
+ Validate if the password is correct.
+
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval EFI_SUCCESS The password is correct.
+ @retval EFI_SECURITY_VIOLATION The password is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+**/
+EFI_STATUS
+VerifyPassword (
+ IN CHAR16 *Password,
+ IN UINTN PasswordSize
+ );
+
+/**
+ Set a new password.
+
+ @param[in] NewPassword The user input new password.
+ NULL means clear password.
+ @param[in] NewPasswordSize The size of NewPassword in byte.
+ @param[in] OldPassword The user input old password.
+ NULL means no old password.
+ @param[in] OldPasswordSize The size of OldPassword in byte.
+
+ @retval EFI_SUCCESS The NewPassword is set successfully.
+ @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+ @retval EFI_UNSUPPORTED NewPassword is not strong enough.
+ @retval EFI_ALREADY_STARTED NewPassword is in history.
+**/
+EFI_STATUS
+SetPassword (
+ IN CHAR16 *NewPassword, OPTIONAL
+ IN UINTN NewPasswordSize,
+ IN CHAR16 *OldPassword, OPTIONAL
+ IN UINTN OldPasswordSize
+ );
+
+/**
+ Return if the password is set.
+
+ @retval TRUE The password is set.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+IsPasswordInstalled (
+ VOID
+ );
+
+/**
+ Get password verification policy.
+
+ @param[out] VerifyPolicy Verification policy.
+
+ @retval EFI_SUCCESS Get verification policy successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verification policy.
+**/
+EFI_STATUS
+GetPasswordVerificationPolicy (
+ OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy
+ );
+
+/**
+ Return if the password was verified.
+
+ @retval TRUE The password was verified.
+ @retval FALSE The password was not verified.
+**/
+BOOLEAN
+WasPasswordVerified (
+ VOID
+ );
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeFormset.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeFormset.h
new file mode 100644
index 0000000000..581849b534
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeFormset.h
@@ -0,0 +1,23 @@
+/** @file
+ Header file for UserAuthentication formset.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _USER_AUTHENTICATION_DXE_FORMSET_H_
+#define _USER_AUTHENTICATION_DXE_FORMSET_H_
+
+//
+// Vendor GUID of the formset
+//
+#define USER_AUTHENTICATION_FORMSET_GUID \
+ { 0x760e3022, 0xf149, 0x4560, {0x9c, 0x6f, 0x33, 0xaa, 0x7d, 0x48, 0x75, 0xfa} }
+
+#define ADMIN_PASSWORD_KEY_ID 0x2001
+
+#define MAX_PASSWORD_LEN 32
+#define MIN_PASSWORD_LEN 0
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.h b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.h
new file mode 100644
index 0000000000..47bb95529f
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.h
@@ -0,0 +1,52 @@
+/** @file
+ Header file for UserAuthenticationSmm.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __USER_AUTHENTICATION_SMM_H__
+#define __USER_AUTHENTICATION_SMM_H__
+
+#include <PiSmm.h>
+
+#include <Protocol/SmmVariable.h>
+#include <Protocol/VariableLock.h>
+
+#include <Guid/UserAuthentication.h>
+
+#include <Library/DebugLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PrintLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/SmmServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/SmmServicesTableLib.h>
+#include <Library/BaseCryptLib.h>
+#include <Library/PlatformPasswordLib.h>
+
+#include "KeyService.h"
+
+#define PASSWORD_SALT_SIZE 32
+#define PASSWORD_HASH_SIZE 32 // SHA256_DIGEST_SIZE
+
+#define PASSWORD_MAX_TRY_COUNT 3
+#define PASSWORD_HISTORY_CHECK_COUNT 5
+
+//
+// Name of the variable
+//
+#define USER_AUTHENTICATION_VAR_NAME L"Password"
+#define USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME L"PasswordLast"
+
+//
+// Variable storage
+//
+typedef struct {
+ UINT8 PasswordHash[PASSWORD_HASH_SIZE];
+ UINT8 PasswordSalt[PASSWORD_SALT_SIZE];
+} USER_PASSWORD_VAR_STRUCT;
+
+#endif
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeVfr.vfr b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeVfr.vfr
new file mode 100644
index 0000000000..ca1d5ddec1
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeVfr.vfr
@@ -0,0 +1,39 @@
+///** @file
+// UserAuthentication formset.
+//
+// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+//**/
+
+#include <Guid/HiiPlatformSetupFormset.h>
+#include "UserAuthenticationDxeFormset.h"
+
+formset
+ guid = USER_AUTHENTICATION_FORMSET_GUID,
+ title = STRING_TOKEN(STR_FORM_SET_TITLE),
+ help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
+ classguid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID,
+
+ form formid = 1,
+ title = STRING_TOKEN(STR_FORM_TITLE);
+
+ grayoutif TRUE;
+ text
+ help = STRING_TOKEN(STR_ADMIN_PASSWORD_STS_HELP),
+ text = STRING_TOKEN(STR_ADMIN_PASSWORD_STS_PROMPT),
+ text = STRING_TOKEN(STR_ADMIN_PASSWORD_STS_CONTENT);
+ endif;
+
+ password
+ prompt = STRING_TOKEN(STR_ADMIN_PASSWORD_PROMPT),
+ help = STRING_TOKEN(STR_ADMIN_PASSWORD_HELP),
+ flags = INTERACTIVE,
+ key = ADMIN_PASSWORD_KEY_ID,
+ minsize = MIN_PASSWORD_LEN,
+ maxsize = MAX_PASSWORD_LEN,
+ endpassword;
+
+ endform;
+
+endformset;
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c
new file mode 100644
index 0000000000..08e081aa99
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c
@@ -0,0 +1,78 @@
+/** @file
+ NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared
+ but returns the PCD value directly. This instance can be used to verify security
+ related features during platform enabling and development. It should be replaced
+ by a platform-specific method(e.g. Button pressed) in a real platform for product.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+BOOLEAN mPasswordCleared = FALSE;
+
+/**
+ This function is called at password driver entrypoint.
+ This function should be called only once, to clear the password.
+
+ This function provides a way to reset the password, just in case
+ the platform owner forgets the password.
+ The platform should provide a secure way to make sure
+ only the platform owner is allowed to clear password.
+
+ Once the password is cleared, the platform should provide a way
+ to set a new password.
+
+ @retval TRUE There is a platform request to clear the password.
+ @retval FALSE There is no platform request to clear the password.
+**/
+BOOLEAN
+EFIAPI
+IsPasswordCleared (
+ VOID
+ )
+{
+ return mPasswordCleared;
+}
+
+/**
+ This function is called if the password driver finds that the password is not enrolled,
+ when the password is required to input.
+
+ This function should return the action according to platform policy.
+
+ @retval TRUE The caller should force the user to enroll the password.
+ @retval FALSE The caller may skip the password enroll.
+**/
+BOOLEAN
+EFIAPI
+NeedEnrollPassword (
+ VOID
+ )
+{
+ return FALSE;
+}
+
+
+/**
+ Save password clear state from a PCD to mPasswordCleared.
+
+ @param ImageHandle ImageHandle of the loaded driver.
+ @param SystemTable Pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS PcdPasswordCleared is got successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+PlatformPasswordLibNullConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+
+ mPasswordCleared = PcdGetBool(PcdPasswordCleared);
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c
new file mode 100644
index 0000000000..cbaf572378
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c
@@ -0,0 +1,274 @@
+/** @file
+ UserPasswordLib instance implementation provides services to
+ set/verify password and return if the password is set.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Protocol/SmmCommunication.h>
+
+#include <Guid/PiSmmCommunicationRegionTable.h>
+#include <Guid/UserAuthentication.h>
+
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+#include <Library/BaseMemoryLib.h>
+
+/**
+ Initialize the communicate buffer using DataSize and Function.
+
+ @param[out] DataPtr Points to the data in the communicate buffer.
+ @param[in] DataSize The data size to send to SMM.
+ @param[in] Function The function number to initialize the communicate header.
+
+ @return Communicate buffer.
+**/
+VOID*
+UserPasswordLibInitCommunicateBuffer (
+ OUT VOID **DataPtr OPTIONAL,
+ IN UINTN DataSize,
+ IN UINTN Function
+ )
+{
+ EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
+ VOID *Buffer;
+ EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable;
+ EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
+ UINTN Index;
+ UINTN Size;
+ EFI_STATUS Status;
+
+ Buffer = NULL;
+ Status = EfiGetSystemConfigurationTable (
+ &gEdkiiPiSmmCommunicationRegionTableGuid,
+ (VOID **) &SmmCommRegionTable
+ );
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+ ASSERT (SmmCommRegionTable != NULL);
+ SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
+ Size = 0;
+ for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) {
+ if (SmmCommMemRegion->Type == EfiConventionalMemory) {
+ Size = EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages);
+ if (Size >= (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) {
+ break;
+ }
+ }
+ SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRegion + SmmCommRegionTable->DescriptorSize);
+ }
+ ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
+
+ Buffer = (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart;
+ ASSERT (Buffer != NULL);
+ SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
+ CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid);
+ SmmCommunicateHeader->MessageLength = DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data;
+ ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER));
+ SmmPasswordFunctionHeader->Function = Function;
+ if (DataPtr != NULL) {
+ *DataPtr = SmmPasswordFunctionHeader + 1;
+ }
+
+ return Buffer;
+}
+
+/**
+ Send the data in communicate buffer to SMM.
+
+ @param[in] Buffer Points to the data in the communicate buffer.
+ @param[in] DataSize The data size to send to SMM.
+
+ @retval EFI_SUCCESS Success is returned from the function in SMM.
+ @retval Others Failure is returned from the function in SMM.
+
+**/
+EFI_STATUS
+UserPasswordLibSendCommunicateBuffer (
+ IN VOID *Buffer,
+ IN UINTN DataSize
+ )
+{
+ EFI_STATUS Status;
+ UINTN CommSize;
+ EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
+ EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
+
+ //
+ // Locates SMM Communication protocol.
+ //
+ Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &SmmCommunication);
+ ASSERT_EFI_ERROR (Status);
+
+ CommSize = DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ Status = SmmCommunication->Communicate (SmmCommunication, Buffer, &CommSize);
+ ASSERT_EFI_ERROR (Status);
+
+ SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
+ SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data;
+ return SmmPasswordFunctionHeader->ReturnStatus;
+}
+
+/**
+ Validate if the password is correct.
+
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval EFI_SUCCESS The password is correct.
+ @retval EFI_SECURITY_VIOLATION The password is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+**/
+EFI_STATUS
+EFIAPI
+VerifyPassword (
+ IN CHAR16 *Password,
+ IN UINTN PasswordSize
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD *VerifyPassword;
+
+ ASSERT (Password != NULL);
+
+ if (PasswordSize > sizeof(VerifyPassword->Password) * sizeof(CHAR16)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Buffer = UserPasswordLibInitCommunicateBuffer (
+ (VOID**)&VerifyPassword,
+ sizeof(*VerifyPassword),
+ SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = UnicodeStrToAsciiStrS (Password, VerifyPassword->Password, sizeof(VerifyPassword->Password));
+ if (EFI_ERROR(Status)) {
+ goto EXIT;
+ }
+
+ Status = UserPasswordLibSendCommunicateBuffer (Buffer, sizeof(*VerifyPassword));
+
+EXIT:
+ ZeroMem (VerifyPassword, sizeof(*VerifyPassword));
+ return Status;
+}
+
+/**
+ Set a new password.
+
+ @param[in] NewPassword The user input new password.
+ NULL means clear password.
+ @param[in] NewPasswordSize The size of NewPassword in byte.
+ @param[in] OldPassword The user input old password.
+ NULL means no old password.
+ @param[in] OldPasswordSize The size of OldPassword in byte.
+
+ @retval EFI_SUCCESS The NewPassword is set successfully.
+ @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+ @retval EFI_UNSUPPORTED NewPassword is not strong enough.
+ @retval EFI_ALREADY_STARTED NewPassword is in history.
+**/
+EFI_STATUS
+EFIAPI
+SetPassword (
+ IN CHAR16 *NewPassword, OPTIONAL
+ IN UINTN NewPasswordSize,
+ IN CHAR16 *OldPassword, OPTIONAL
+ IN UINTN OldPasswordSize
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_SET_PASSWORD *SetPassword;
+
+ if (NewPasswordSize > sizeof(SetPassword->NewPassword) * sizeof(CHAR16)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ if (OldPasswordSize > sizeof(SetPassword->OldPassword) * sizeof(CHAR16)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Buffer = UserPasswordLibInitCommunicateBuffer (
+ (VOID**)&SetPassword,
+ sizeof(*SetPassword),
+ SMM_PASSWORD_FUNCTION_SET_PASSWORD
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (NewPassword != NULL) {
+ Status = UnicodeStrToAsciiStrS (NewPassword, SetPassword->NewPassword, sizeof(SetPassword->NewPassword));
+ if (EFI_ERROR(Status)) {
+ goto EXIT;
+ }
+ } else {
+ SetPassword->NewPassword[0] = 0;
+ }
+
+ if (OldPassword != NULL) {
+ Status = UnicodeStrToAsciiStrS (OldPassword, SetPassword->OldPassword, sizeof(SetPassword->OldPassword));
+ if (EFI_ERROR(Status)) {
+ goto EXIT;
+ }
+ } else {
+ SetPassword->OldPassword[0] = 0;
+ }
+
+ Status = UserPasswordLibSendCommunicateBuffer (Buffer, sizeof(*SetPassword));
+
+EXIT:
+ ZeroMem (SetPassword, sizeof(*SetPassword));
+ return Status;
+}
+
+/**
+ Return if the password is set.
+
+ @retval TRUE The password is set.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+EFIAPI
+IsPasswordInstalled (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+
+ Buffer = UserPasswordLibInitCommunicateBuffer (
+ NULL,
+ 0,
+ SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET
+ );
+ if (Buffer == NULL) {
+ return FALSE;
+ }
+
+ Status = UserPasswordLibSendCommunicateBuffer (Buffer, 0);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c
new file mode 100644
index 0000000000..050bfda63a
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c
@@ -0,0 +1,522 @@
+/** @file
+ UserPasswordUiLib instance provides services to do password authentication.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Protocol/SmmCommunication.h>
+
+#include <Guid/PiSmmCommunicationRegionTable.h>
+#include <Guid/UserAuthentication.h>
+
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PrintLib.h>
+#include <Library/PlatformPasswordLib.h>
+#include <Library/UserPasswordLib.h>
+
+/**
+ Initialize the communicate buffer using DataSize and Function.
+
+ @param[out] DataPtr Points to the data in the communicate buffer.
+ @param[in] DataSize The data size to send to SMM.
+ @param[in] Function The function number to initialize the communicate header.
+
+ @return Communicate buffer.
+**/
+VOID*
+UserPasswordUiLibInitCommunicateBuffer (
+ OUT VOID **DataPtr OPTIONAL,
+ IN UINTN DataSize,
+ IN UINTN Function
+ )
+{
+ EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
+ VOID *Buffer;
+ EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable;
+ EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
+ UINTN Index;
+ UINTN Size;
+ EFI_STATUS Status;
+
+ Buffer = NULL;
+ Status = EfiGetSystemConfigurationTable (
+ &gEdkiiPiSmmCommunicationRegionTableGuid,
+ (VOID **) &SmmCommRegionTable
+ );
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+ ASSERT (SmmCommRegionTable != NULL);
+ SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
+ Size = 0;
+ for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) {
+ if (SmmCommMemRegion->Type == EfiConventionalMemory) {
+ Size = EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages);
+ if (Size >= (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) {
+ break;
+ }
+ }
+ SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRegion + SmmCommRegionTable->DescriptorSize);
+ }
+ ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
+
+ Buffer = (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart;
+ ASSERT (Buffer != NULL);
+ SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
+ CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid);
+ SmmCommunicateHeader->MessageLength = DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data;
+ ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER));
+ SmmPasswordFunctionHeader->Function = Function;
+ if (DataPtr != NULL) {
+ *DataPtr = SmmPasswordFunctionHeader + 1;
+ }
+
+ return Buffer;
+}
+
+/**
+ Send the data in communicate buffer to SMM.
+
+ @param[in] Buffer Points to the data in the communicate buffer.
+ @param[in] DataSize The data size to send to SMM.
+
+ @retval EFI_SUCCESS Success is returned from the function in SMM.
+ @retval Others Failure is returned from the function in SMM.
+
+**/
+EFI_STATUS
+UserPasswordUiLibSendCommunicateBuffer (
+ IN VOID *Buffer,
+ IN UINTN DataSize
+ )
+{
+ EFI_STATUS Status;
+ UINTN CommSize;
+ EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
+ EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
+
+ //
+ // Locates SMM Communication protocol.
+ //
+ Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &SmmCommunication);
+ ASSERT_EFI_ERROR (Status);
+
+ CommSize = DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ Status = SmmCommunication->Communicate (SmmCommunication, Buffer, &CommSize);
+ ASSERT_EFI_ERROR (Status);
+
+ SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
+ SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data;
+ return SmmPasswordFunctionHeader->ReturnStatus;
+}
+
+/**
+ Set password verification policy.
+
+ @param[in] NeedReVerify Need re-verify or not.
+
+ @retval EFI_SUCCESS Set verification policy successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to set verification policy.
+**/
+EFI_STATUS
+EFIAPI
+UiSetPasswordVerificationPolicy (
+ IN BOOLEAN NeedReVerify
+ )
+{
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *SetVerifyPolicy;
+
+ Buffer = UserPasswordUiLibInitCommunicateBuffer (
+ (VOID**)&SetVerifyPolicy,
+ sizeof(*SetVerifyPolicy),
+ SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ SetVerifyPolicy->NeedReVerify = NeedReVerify;
+
+ return UserPasswordUiLibSendCommunicateBuffer (Buffer, sizeof(*SetVerifyPolicy));
+}
+
+/**
+ Get a user input string.
+
+ @param[in] PopUpString A popup string to inform user.
+ @param[in, out] UserInput The user input string
+ @param[in] UserInputMaxLen The max unicode count of the UserInput without NULL terminator.
+**/
+EFI_STATUS
+GetUserInput (
+ IN CHAR16 *PopUpString,
+ IN OUT CHAR16 *UserInput,
+ IN UINTN UserInputMaxLen
+ )
+{
+ EFI_INPUT_KEY InputKey;
+ UINTN InputLength;
+ CHAR16 *Mask;
+
+ UserInput[0] = 0;
+ Mask = AllocateZeroPool ((UserInputMaxLen + 1) * sizeof(CHAR16));
+ if (Mask == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ InputLength = 0;
+
+ while (TRUE) {
+ if (InputLength < UserInputMaxLen) {
+ Mask[InputLength] = L'_';
+ }
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &InputKey,
+ PopUpString,
+ L"--------------------------------",
+ Mask,
+ NULL
+ );
+ if (InputKey.ScanCode == SCAN_NULL) {
+ //
+ // Check whether finish inputing password.
+ //
+ if (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN && InputLength > 0) {
+ //
+ // Add the null terminator.
+ //
+ UserInput[InputLength] = 0;
+ break;
+ } else if ((InputKey.UnicodeChar == CHAR_NULL) ||
+ (InputKey.UnicodeChar == CHAR_LINEFEED) ||
+ (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN)
+ ) {
+ continue;
+ } else {
+ //
+ // delete last key entered
+ //
+ if (InputKey.UnicodeChar == CHAR_BACKSPACE) {
+ if (InputLength > 0) {
+ UserInput[InputLength] = 0;
+ Mask[InputLength] = 0;
+ InputLength--;
+ }
+ } else {
+ if (InputLength == UserInputMaxLen) {
+ Mask[InputLength] = 0;
+ continue;
+ }
+ //
+ // add Next key entry
+ //
+ UserInput[InputLength] = InputKey.UnicodeChar;
+ Mask[InputLength] = L'*';
+ InputLength++;
+ }
+ }
+ }
+ }
+ FreePool (Mask);
+ return EFI_SUCCESS;
+}
+
+/**
+ Display a message box to end user.
+
+ @param[in] DisplayString The string in message box.
+**/
+VOID
+MessageBox (
+ IN CHAR16 *DisplayString
+ )
+{
+ EFI_INPUT_KEY Key;
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+}
+
+/**
+ Force system reset.
+**/
+VOID
+ForceSystemReset (
+ VOID
+ )
+{
+ MessageBox (L"Password retry count reach, reset system!");
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+ CpuDeadLoop();
+}
+
+/**
+ Display message for set password.
+
+ @param[in] ReturnStatus The return status for set password.
+**/
+VOID
+PrintSetPasswordStatus (
+ IN EFI_STATUS ReturnStatus
+ )
+{
+ CHAR16 *DisplayString;
+ CHAR16 *DisplayString2;
+
+ EFI_INPUT_KEY Key;
+
+ if (ReturnStatus == EFI_UNSUPPORTED) {
+ DisplayString = L"New password is not strong enough!";
+ DisplayString2 = L"Password must at least 8 chars and include lowercase, uppercase alphabetic, number and symbol";
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ DisplayString2,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ } else {
+ if (ReturnStatus == EFI_SUCCESS) {
+ DisplayString = L"New password is updated successfully!";
+ } else if (ReturnStatus == EFI_ALREADY_STARTED) {
+ DisplayString = L"New password is found in the history passwords!";
+ } else {
+ DisplayString = L"New password update fails!";
+ }
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ }
+}
+
+/**
+ Get password verification policy.
+
+ @param[out] VerifyPolicy Verification policy.
+
+ @retval EFI_SUCCESS Get verification policy successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verification policy.
+**/
+EFI_STATUS
+GetPasswordVerificationPolicy (
+ OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *TempVerifyPolicy;
+
+ Buffer = UserPasswordUiLibInitCommunicateBuffer (
+ (VOID**)&TempVerifyPolicy,
+ sizeof(*TempVerifyPolicy),
+ SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = UserPasswordUiLibSendCommunicateBuffer (Buffer, sizeof(*TempVerifyPolicy));
+ if (!EFI_ERROR (Status)) {
+ CopyMem (VerifyPolicy, TempVerifyPolicy, sizeof (SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY));
+ }
+
+ return Status;
+}
+
+/**
+ Return if the password was verified.
+
+ @retval TRUE The password was verified.
+ @retval FALSE The password was not verified.
+**/
+BOOLEAN
+WasPasswordVerified (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+
+ Buffer = UserPasswordUiLibInitCommunicateBuffer (
+ NULL,
+ 0,
+ SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED
+ );
+ if (Buffer == NULL) {
+ return FALSE;
+ }
+
+ Status = UserPasswordUiLibSendCommunicateBuffer (Buffer, 0);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
+ Require user input password.
+
+ @retval TRUE User input correct password successfully.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+RequireUserPassword (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
+ CHAR16 *PopUpString;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY VerifyPolicy;
+
+ Status = EFI_SUCCESS;
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+
+ if (!IsPasswordInstalled ()) {
+ return FALSE;
+ }
+
+ Status = GetPasswordVerificationPolicy (&VerifyPolicy);
+ if (!EFI_ERROR (Status)) {
+ if (WasPasswordVerified() && (!VerifyPolicy.NeedReVerify)) {
+ DEBUG ((DEBUG_INFO, "Password was verified and Re-verify is not needed\n"));
+ return TRUE;
+ }
+ }
+
+ PopUpString = L"Please input admin password";
+
+ while (TRUE) {
+ gST->ConOut->ClearScreen(gST->ConOut);
+ GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
+
+ Status = VerifyPassword (UserInputPw, StrSize(UserInputPw));
+ if (!EFI_ERROR(Status)) {
+ break;
+ }
+ if (Status == EFI_ACCESS_DENIED) {
+ //
+ // Password retry count reach.
+ //
+ ForceSystemReset ();
+ }
+ MessageBox (L"Incorrect password!");
+ }
+
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+
+ gST->ConOut->ClearScreen(gST->ConOut);
+
+ return TRUE;
+}
+
+/**
+ Set user password.
+
+**/
+VOID
+SetUserPassword (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
+ CHAR16 TmpPassword[PASSWORD_MAX_SIZE];
+ CHAR16 *PopUpString;
+ CHAR16 *PopUpString2;
+
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+ ZeroMem(TmpPassword, sizeof(TmpPassword));
+
+ PopUpString = L"Please set admin password";
+
+ while (TRUE) {
+ gST->ConOut->ClearScreen(gST->ConOut);
+ GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
+
+ PopUpString2 = L"Please confirm your new password";
+ gST->ConOut->ClearScreen(gST->ConOut);
+ GetUserInput (PopUpString2, TmpPassword, PASSWORD_MAX_SIZE - 1);
+ if (StrCmp (TmpPassword, UserInputPw) != 0) {
+ MessageBox (L"Password are not the same!");
+ continue;
+ }
+
+ Status = SetPassword (UserInputPw, StrSize(UserInputPw), NULL, 0);
+ PrintSetPasswordStatus (Status);
+ if (!EFI_ERROR(Status)) {
+ break;
+ }
+ }
+
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+ ZeroMem(TmpPassword, sizeof(TmpPassword));
+
+ gST->ConOut->ClearScreen(gST->ConOut);
+}
+
+/**
+ Do password authentication.
+
+ @retval EFI_SUCCESS Password authentication pass.
+**/
+EFI_STATUS
+EFIAPI
+UiDoPasswordAuthentication (
+ VOID
+ )
+{
+ BOOLEAN PasswordSet;
+
+ PasswordSet = RequireUserPassword ();
+ if (PasswordSet) {
+ DEBUG ((DEBUG_INFO, "Welcome Admin!\n"));
+ } else {
+ DEBUG ((DEBUG_INFO, "Admin password is not set!\n"));
+ if (NeedEnrollPassword()) {
+ SetUserPassword ();
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.c
new file mode 100644
index 0000000000..8b06e58ca5
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/KeyService.c
@@ -0,0 +1,133 @@
+/** @file
+ Password key service.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/BaseCryptLib.h>
+#include "KeyService.h"
+
+/**
+ Compares the contents of two buffers with slow algorithm
+
+ This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
+ If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
+ value returned is the first mismatched byte in SourceBuffer subtracted from the first
+ mismatched byte in DestinationBuffer.
+
+ If Length > 0 and DestinationBuffer is NULL, then ASSERT().
+ If Length > 0 and SourceBuffer is NULL, then ASSERT().
+ If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
+ If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
+
+ @param DestinationBuffer The pointer to the destination buffer to compare.
+ @param SourceBuffer The pointer to the source buffer to compare.
+ @param Length The number of bytes to compare.
+
+ @return 0 All Length bytes of the two buffers are identical.
+ @retval -1 The SourceBuffer is not identical to DestinationBuffer.
+
+**/
+INTN
+EFIAPI
+KeyLibSlowCompareMem (
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
+ )
+{
+ UINT8 Delta;
+ UINTN Index;
+ UINT8 *Destination;
+ UINT8 *Source;
+
+ Destination = (UINT8 *)DestinationBuffer;
+ Source = (UINT8 *)SourceBuffer;
+ Delta = 0;
+ for (Index = 0; Index < Length; Index++) {
+ Delta |= Destination[Index] ^ Source[Index];
+ }
+ if (Delta == 0) {
+ return 0;
+ } else {
+ return -1;
+ }
+}
+
+/**
+ Generate Salt value.
+
+ @param[in, out] SaltValue Points to the salt buffer
+ @param[in] SaltSize Size of the salt buffer
+
+ @retval TRUE Salt is generated.
+ @retval FALSE Salt is not generated.
+**/
+BOOLEAN
+EFIAPI
+KeyLibGenerateSalt (
+ IN OUT UINT8 *SaltValue,
+ IN UINTN SaltSize
+ )
+{
+ if (SaltValue == NULL) {
+ return FALSE;
+ }
+ RandomSeed(NULL, 0);
+ RandomBytes(SaltValue, SaltSize);
+ return TRUE;
+}
+
+/**
+ Hash the password with PBKDF2.
+
+ @param[in] HashType Hash type
+ @param[in] Key Points to the key buffer
+ @param[in] KeySize Key buffer size
+ @param[in] SaltValue Points to the salt buffer
+ @param[in] SaltSize Size of the salt buffer
+ @param[out] KeyHash Points to the hashed result
+ @param[in] KeyHashSize Size of the hash buffer
+
+ @retval TRUE Hash the data successfully.
+ @retval FALSE Failed to hash the data.
+
+**/
+BOOLEAN
+EFIAPI
+KeyLibGeneratePBKDF2Hash (
+ IN UINT32 HashType,
+ IN VOID *Key,
+ IN UINTN KeySize,
+ IN UINT8 *SaltValue,
+ IN UINTN SaltSize,
+ OUT UINT8 *KeyHash,
+ IN UINTN KeyHashSize
+ )
+{
+ BOOLEAN Result;
+
+ if (HashType != HASH_TYPE_SHA256) {
+ return FALSE;
+ }
+ if (KeyHashSize != SHA256_DIGEST_SIZE) {
+ return FALSE;
+ }
+
+ Result = Pkcs5HashPassword (
+ KeySize,
+ Key,
+ SaltSize,
+ SaltValue,
+ DEFAULT_PBKDF2_ITERATION_COUNT,
+ SHA256_DIGEST_SIZE,
+ KeyHashSize,
+ KeyHash
+ );
+ return Result;
+}
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.c
new file mode 100644
index 0000000000..b4326d380f
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthentication2Dxe.c
@@ -0,0 +1,484 @@
+/** @file
+ This Driver mainly provides Setup Form to change password.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UserAuthentication2Dxe.h"
+
+USER_AUTHENTICATION_PRIVATE_DATA *mUserAuthenticationData = NULL;
+
+EFI_GUID mUserAuthenticationVendorGuid = USER_AUTHENTICATION_FORMSET_GUID;
+HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = {
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ {
+ (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ }
+ },
+ USER_AUTHENTICATION_FORMSET_GUID
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ (UINT8) (END_DEVICE_PATH_LENGTH),
+ (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
+ }
+ }
+};
+
+/**
+ Display a message box to end user.
+
+ @param[in] DisplayString The string in message box.
+**/
+VOID
+MessageBox (
+ IN CHAR16 *DisplayString
+ )
+{
+ EFI_INPUT_KEY Key;
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+}
+
+/**
+ Force system reset.
+**/
+VOID
+ForceSystemReset (
+ VOID
+ )
+{
+ MessageBox (L"Password retry count reach, reset system!");
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+ CpuDeadLoop();
+}
+
+/**
+ Display message for set password.
+
+ @param[in] ReturnStatus The return status for set password.
+**/
+VOID
+PrintSetPasswordStatus (
+ IN EFI_STATUS ReturnStatus
+ )
+{
+ CHAR16 *DisplayString;
+ CHAR16 *DisplayString2;
+
+ EFI_INPUT_KEY Key;
+
+ if (ReturnStatus == EFI_UNSUPPORTED) {
+ DisplayString = L"New password is not strong enough!";
+ DisplayString2 = L"Password must at least 8 chars and include lowercase, uppercase alphabetic, number and symbol";
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ DisplayString2,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ } else {
+ if (ReturnStatus == EFI_SUCCESS) {
+ DisplayString = L"New password is updated successfully!";
+ } else if (ReturnStatus == EFI_ALREADY_STARTED) {
+ DisplayString = L"New password is found in the history passwords!";
+ } else {
+ DisplayString = L"New password update fails!";
+ }
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ }
+}
+
+/**
+ This function allows a caller to extract the current configuration for one
+ or more named elements from the target driver.
+
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param Request A null-terminated Unicode string in
+ <ConfigRequest> 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_SUCCESS The Results is filled with the requested values.
+ @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
+ @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
+ driver.
+
+**/
+EFI_STATUS
+EFIAPI
+ExtractConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Request,
+ OUT EFI_STRING *Progress,
+ OUT EFI_STRING *Results
+ )
+{
+ if (Progress == NULL || Results == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ *Progress = Request;
+ return EFI_NOT_FOUND;
+}
+
+
+/**
+ This function processes the results of changes in configuration.
+
+ @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_SUCCESS The Results is processed successfully.
+ @retval EFI_INVALID_PARAMETER Configuration is NULL.
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
+ driver.
+
+**/
+EFI_STATUS
+EFIAPI
+RouteConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
+ )
+{
+ if (Configuration == NULL || Progress == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *Progress = Configuration;
+
+ return EFI_NOT_FOUND;
+}
+
+/**
+ HII update Admin Password status.
+
+**/
+VOID
+HiiUpdateAdminPasswordStatus (
+ VOID
+ )
+{
+ if (IsPasswordInstalled ()) {
+ HiiSetString (
+ mUserAuthenticationData->HiiHandle,
+ STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
+ L"Installed",
+ NULL
+ );
+ } else {
+ HiiSetString (
+ mUserAuthenticationData->HiiHandle,
+ STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
+ L"Not Installed",
+ NULL
+ );
+ }
+}
+
+/**
+ This function processes the results of changes in configuration.
+
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param Action Specifies the type of action taken by the browser.
+ @param QuestionId A unique value which is sent to the original
+ exporting driver so that it can identify the type
+ of data to expect.
+ @param Type The type of value for the question.
+ @param Value A pointer to the data being sent to the original
+ exporting driver.
+ @param ActionRequest On return, points to the action requested by the
+ callback function.
+
+ @retval EFI_SUCCESS The callback successfully handled the action.
+ @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
+ variable and its data.
+ @retval EFI_DEVICE_ERROR The variable could not be saved.
+ @retval EFI_UNSUPPORTED The specified Action is not supported by the
+ callback.
+
+**/
+EFI_STATUS
+EFIAPI
+UserAuthenticationCallback (
+ 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;
+ CHAR16 *UserInputPassword;
+
+ Status = EFI_SUCCESS;
+
+ if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE)) ||
+ (ActionRequest == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ switch (Action) {
+ case EFI_BROWSER_ACTION_FORM_OPEN:
+ {
+ switch (QuestionId) {
+ case ADMIN_PASSWORD_KEY_ID:
+ HiiUpdateAdminPasswordStatus ();
+ default:
+ break;
+ }
+ }
+ break;
+ case EFI_BROWSER_ACTION_CHANGING:
+ {
+ switch (QuestionId) {
+ case ADMIN_PASSWORD_KEY_ID:
+ if ((Type == EFI_IFR_TYPE_STRING) && (Value->string == 0) &&
+ (mUserAuthenticationData->PasswordState == BROWSER_STATE_SET_PASSWORD)) {
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
+ ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // The Callback is responsible for validating old password input by user,
+ // If Callback return EFI_SUCCESS, it indicates validation pass.
+ //
+ switch (mUserAuthenticationData->PasswordState) {
+ case BROWSER_STATE_VALIDATE_PASSWORD:
+ UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
+ if (UserInputPassword == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+ if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
+ Status = EFI_NOT_READY;
+ break;
+ }
+ if (UserInputPassword[0] == 0) {
+ //
+ // Setup will use an empty password to check whether the old password is set,
+ // If the validation is successful, means there is no old password, return
+ // success to set the new password. Or need to return EFI_NOT_READY to
+ // let user input the old password.
+ //
+ Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
+ if (Status == EFI_SUCCESS) {
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
+ } else {
+ Status = EFI_NOT_READY;
+ }
+ break;
+ }
+ Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
+ if (Status == EFI_SUCCESS) {
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
+ StrCpyS (
+ mUserAuthenticationData->OldPassword,
+ sizeof(mUserAuthenticationData->OldPassword)/sizeof(CHAR16),
+ UserInputPassword
+ );
+ } else {
+ //
+ // Old password mismatch, return EFI_NOT_READY to prompt for error message.
+ //
+ if (Status == EFI_ACCESS_DENIED) {
+ //
+ // Password retry count reach.
+ //
+ ForceSystemReset ();
+ }
+ Status = EFI_NOT_READY;
+ }
+ break;
+
+ case BROWSER_STATE_SET_PASSWORD:
+ UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
+ if (UserInputPassword == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+ if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
+ Status = EFI_NOT_READY;
+ break;
+ }
+ Status = SetPassword (UserInputPassword, StrSize (UserInputPassword), mUserAuthenticationData->OldPassword, StrSize(mUserAuthenticationData->OldPassword));
+ PrintSetPasswordStatus (Status);
+ ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
+ HiiUpdateAdminPasswordStatus ();
+ break;
+
+ default:
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ return Status;
+}
+
+/**
+ User Authentication entry point.
+
+ @param ImageHandle The image handle.
+ @param SystemTable The system table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+ @return other Contain some other errors.
+
+**/
+EFI_STATUS
+EFIAPI
+UserAuthentication2Entry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE DriverHandle;
+ EFI_HII_HANDLE HiiHandle;
+
+ DriverHandle = NULL;
+
+ mUserAuthenticationData = AllocateZeroPool (sizeof (USER_AUTHENTICATION_PRIVATE_DATA));
+ if (mUserAuthenticationData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mUserAuthenticationData->ConfigAccess.ExtractConfig = ExtractConfig;
+ mUserAuthenticationData->ConfigAccess.RouteConfig = RouteConfig;
+ mUserAuthenticationData->ConfigAccess.Callback = UserAuthenticationCallback;
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
+
+ //
+ // Install Config Access protocol to driver handle.
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &DriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mUserAuthenticationData->ConfigAccess,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ mUserAuthenticationData->DriverHandle = DriverHandle;
+
+ //
+ // Add HII data to database.
+ //
+ HiiHandle = HiiAddPackages (
+ &mUserAuthenticationVendorGuid,
+ DriverHandle,
+ UserAuthentication2DxeStrings,
+ UserAuthenticationDxeVfrBin,
+ NULL
+ );
+ if (HiiHandle == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ mUserAuthenticationData->HiiHandle = HiiHandle;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Unloads the application and its installed protocol.
+
+ @param[in] ImageHandle Handle that identifies the image to be unloaded.
+
+ @retval EFI_SUCCESS The image has been unloaded.
+**/
+EFI_STATUS
+EFIAPI
+UserAuthentication2Unload (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ ASSERT (mUserAuthenticationData != NULL);
+
+ //
+ // Uninstall Config Access Protocol.
+ //
+ if (mUserAuthenticationData->DriverHandle != NULL) {
+ gBS->UninstallMultipleProtocolInterfaces (
+ mUserAuthenticationData->DriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mUserAuthenticationData->ConfigAccess,
+ NULL
+ );
+ mUserAuthenticationData->DriverHandle = NULL;
+ }
+
+ //
+ // Remove Hii Data.
+ //
+ if (mUserAuthenticationData->HiiHandle != NULL) {
+ HiiRemovePackages (mUserAuthenticationData->HiiHandle);
+ }
+
+ FreePool (mUserAuthenticationData);
+ mUserAuthenticationData = NULL;
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.c
new file mode 100644
index 0000000000..bba2057a96
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxe.c
@@ -0,0 +1,780 @@
+/** @file
+ This Driver mainly provides Setup Form to change password and
+ does user authentication before entering Setup.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UserAuthenticationDxe.h"
+
+EFI_EVENT mExitBootServicesEvent = NULL;
+EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
+USER_AUTHENTICATION_PRIVATE_DATA *mUserAuthenticationData = NULL;
+EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL;
+
+EFI_GUID mUserAuthenticationVendorGuid = USER_AUTHENTICATION_FORMSET_GUID;
+HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = {
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ {
+ (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ }
+ },
+ USER_AUTHENTICATION_FORMSET_GUID
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ (UINT8) (END_DEVICE_PATH_LENGTH),
+ (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
+ }
+ }
+};
+
+/**
+ Get a user input string.
+
+ @param[in] PopUpString A popup string to inform user.
+ @param[in, out] UserInput The user input string
+ @param[in] UserInputMaxLen The max unicode count of the UserInput without NULL terminator.
+**/
+EFI_STATUS
+GetUserInput (
+ IN CHAR16 *PopUpString,
+ IN OUT CHAR16 *UserInput,
+ IN UINTN UserInputMaxLen
+ )
+{
+ EFI_INPUT_KEY InputKey;
+ UINTN InputLength;
+ CHAR16 *Mask;
+
+ UserInput[0] = 0;
+ Mask = AllocateZeroPool ((UserInputMaxLen + 1) * sizeof(CHAR16));
+ if (Mask == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ InputLength = 0;
+
+ while (TRUE) {
+ if (InputLength < UserInputMaxLen) {
+ Mask[InputLength] = L'_';
+ }
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &InputKey,
+ PopUpString,
+ L"--------------------------------",
+ Mask,
+ NULL
+ );
+ if (InputKey.ScanCode == SCAN_NULL) {
+ //
+ // Check whether finish inputing password.
+ //
+ if (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN && InputLength > 0) {
+ //
+ // Add the null terminator.
+ //
+ UserInput[InputLength] = 0;
+ break;
+ } else if ((InputKey.UnicodeChar == CHAR_NULL) ||
+ (InputKey.UnicodeChar == CHAR_LINEFEED) ||
+ (InputKey.UnicodeChar == CHAR_CARRIAGE_RETURN)
+ ) {
+ continue;
+ } else {
+ //
+ // delete last key entered
+ //
+ if (InputKey.UnicodeChar == CHAR_BACKSPACE) {
+ if (InputLength > 0) {
+ UserInput[InputLength] = 0;
+ Mask[InputLength] = 0;
+ InputLength--;
+ }
+ } else {
+ if (InputLength == UserInputMaxLen) {
+ Mask[InputLength] = 0;
+ continue;
+ }
+ //
+ // add Next key entry
+ //
+ UserInput[InputLength] = InputKey.UnicodeChar;
+ Mask[InputLength] = L'*';
+ InputLength++;
+ }
+ }
+ }
+ }
+ FreePool (Mask);
+ return EFI_SUCCESS;
+}
+
+/**
+ Display a message box to end user.
+
+ @param[in] DisplayString The string in message box.
+**/
+VOID
+MessageBox (
+ IN CHAR16 *DisplayString
+ )
+{
+ EFI_INPUT_KEY Key;
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+}
+
+/**
+ Force system reset.
+**/
+VOID
+ForceSystemReset (
+ VOID
+ )
+{
+ MessageBox (L"Password retry count reach, reset system!");
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+ CpuDeadLoop();
+}
+
+/**
+ Display message for set password.
+
+ @param[in] ReturnStatus The return status for set password.
+**/
+VOID
+PrintSetPasswordStatus (
+ IN EFI_STATUS ReturnStatus
+ )
+{
+ CHAR16 *DisplayString;
+ CHAR16 *DisplayString2;
+
+ EFI_INPUT_KEY Key;
+
+ if (ReturnStatus == EFI_UNSUPPORTED) {
+ DisplayString = L"New password is not strong enough!";
+ DisplayString2 = L"Password must at least 8 chars and include lowercase, uppercase alphabetic, number and symbol";
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ DisplayString2,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ } else {
+ if (ReturnStatus == EFI_SUCCESS) {
+ DisplayString = L"New password is updated successfully!";
+ } else if (ReturnStatus == EFI_ALREADY_STARTED) {
+ DisplayString = L"New password is found in the history passwords!";
+ } else {
+ DisplayString = L"New password update fails!";
+ }
+
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ DisplayString,
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ }
+}
+
+/**
+ Require user input password.
+
+ @retval TRUE User input correct password successfully.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+RequireUserPassword (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
+ CHAR16 *PopUpString;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY VerifyPolicy;
+
+ Status = EFI_SUCCESS;
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+
+ if (!IsPasswordInstalled ()) {
+ return FALSE;
+ }
+
+ Status = GetPasswordVerificationPolicy (&VerifyPolicy);
+ if (!EFI_ERROR (Status)) {
+ if (WasPasswordVerified() && (!VerifyPolicy.NeedReVerify)) {
+ DEBUG ((DEBUG_INFO, "Password was verified and Re-verify is not needed\n"));
+ return TRUE;
+ }
+ }
+
+ PopUpString = L"Please input admin password";
+
+ while (TRUE) {
+ gST->ConOut->ClearScreen(gST->ConOut);
+ GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
+
+ Status = VerifyPassword (UserInputPw, StrSize(UserInputPw));
+ if (!EFI_ERROR(Status)) {
+ break;
+ }
+ if (Status == EFI_ACCESS_DENIED) {
+ //
+ // Password retry count reach.
+ //
+ ForceSystemReset ();
+ }
+ MessageBox (L"Incorrect password!");
+ }
+
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+
+ gST->ConOut->ClearScreen(gST->ConOut);
+
+ return TRUE;
+}
+
+/**
+ Set user password.
+
+**/
+VOID
+SetUserPassword (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 UserInputPw[PASSWORD_MAX_SIZE];
+ CHAR16 TmpPassword[PASSWORD_MAX_SIZE];
+ CHAR16 *PopUpString;
+ CHAR16 *PopUpString2;
+
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+ ZeroMem(TmpPassword, sizeof(TmpPassword));
+
+ PopUpString = L"Please set admin password";
+
+ while (TRUE) {
+ gST->ConOut->ClearScreen(gST->ConOut);
+ GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1);
+
+ PopUpString2 = L"Please confirm your new password";
+ gST->ConOut->ClearScreen(gST->ConOut);
+ GetUserInput (PopUpString2, TmpPassword, PASSWORD_MAX_SIZE - 1);
+ if (StrCmp (TmpPassword, UserInputPw) != 0) {
+ MessageBox (L"Password are not the same!");
+ continue;
+ }
+
+ Status = SetPassword (UserInputPw, StrSize(UserInputPw), NULL, 0);
+ PrintSetPasswordStatus (Status);
+ if (!EFI_ERROR(Status)) {
+ break;
+ }
+ }
+
+ ZeroMem(UserInputPw, sizeof(UserInputPw));
+ ZeroMem(TmpPassword, sizeof(TmpPassword));
+
+ gST->ConOut->ClearScreen(gST->ConOut);
+}
+
+/**
+ Check password before entering into setup.
+
+ @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
+
+ @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. For progress codes, the operation is the current activity.
+ For error codes, it is the exception. For debug codes, it is not defined at this time.
+ Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
+ Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
+
+ @param Instance The enumeration of a hardware or software entity within the system.
+ A system may contain multiple entities that match a class/subclass pairing.
+ The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
+ not meaningful, or not relevant. 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.
+ Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.
+
+
+ @param Data This optional parameter may be used to pass additional data
+
+ @retval EFI_SUCCESS Status code is what we expected.
+ @retval EFI_UNSUPPORTED Status code not supported.
+
+**/
+EFI_STATUS
+EFIAPI
+CheckForPassword (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId, OPTIONAL
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+{
+ BOOLEAN PasswordSet;
+
+ if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) &&
+ (Value == (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP))) {
+ //
+ // Check whether enter setup page.
+ //
+ PasswordSet = RequireUserPassword ();
+ if (PasswordSet) {
+ DEBUG ((DEBUG_INFO, "Welcome Admin!\n"));
+ } else {
+ DEBUG ((DEBUG_INFO, "Admin password is not set!\n"));
+ if (NeedEnrollPassword()) {
+ SetUserPassword ();
+ }
+ }
+
+ return EFI_SUCCESS;
+ } else{
+ return EFI_UNSUPPORTED;
+ }
+}
+
+/**
+ This function allows a caller to extract the current configuration for one
+ or more named elements from the target driver.
+
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param Request A null-terminated Unicode string in
+ <ConfigRequest> 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_SUCCESS The Results is filled with the requested values.
+ @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
+ @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
+ driver.
+
+**/
+EFI_STATUS
+EFIAPI
+ExtractConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Request,
+ OUT EFI_STRING *Progress,
+ OUT EFI_STRING *Results
+ )
+{
+ if (Progress == NULL || Results == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ *Progress = Request;
+ return EFI_NOT_FOUND;
+}
+
+
+/**
+ This function processes the results of changes in configuration.
+
+ @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_SUCCESS The Results is processed successfully.
+ @retval EFI_INVALID_PARAMETER Configuration is NULL.
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this
+ driver.
+
+**/
+EFI_STATUS
+EFIAPI
+RouteConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
+ )
+{
+ if (Configuration == NULL || Progress == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *Progress = Configuration;
+
+ return EFI_NOT_FOUND;
+}
+
+/**
+ HII update Admin Password status.
+
+**/
+VOID
+HiiUpdateAdminPasswordStatus (
+ VOID
+ )
+{
+ if (IsPasswordInstalled ()) {
+ HiiSetString (
+ mUserAuthenticationData->HiiHandle,
+ STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
+ L"Installed",
+ NULL
+ );
+ } else {
+ HiiSetString (
+ mUserAuthenticationData->HiiHandle,
+ STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT),
+ L"Not Installed",
+ NULL
+ );
+ }
+}
+
+/**
+ This function processes the results of changes in configuration.
+
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param Action Specifies the type of action taken by the browser.
+ @param QuestionId A unique value which is sent to the original
+ exporting driver so that it can identify the type
+ of data to expect.
+ @param Type The type of value for the question.
+ @param Value A pointer to the data being sent to the original
+ exporting driver.
+ @param ActionRequest On return, points to the action requested by the
+ callback function.
+
+ @retval EFI_SUCCESS The callback successfully handled the action.
+ @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
+ variable and its data.
+ @retval EFI_DEVICE_ERROR The variable could not be saved.
+ @retval EFI_UNSUPPORTED The specified Action is not supported by the
+ callback.
+
+**/
+EFI_STATUS
+EFIAPI
+UserAuthenticationCallback (
+ 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;
+ CHAR16 *UserInputPassword;
+
+ Status = EFI_SUCCESS;
+
+ if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE)) ||
+ (ActionRequest == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ switch (Action) {
+ case EFI_BROWSER_ACTION_FORM_OPEN:
+ {
+ switch (QuestionId) {
+ case ADMIN_PASSWORD_KEY_ID:
+ HiiUpdateAdminPasswordStatus ();
+ default:
+ break;
+ }
+ }
+ break;
+ case EFI_BROWSER_ACTION_CHANGING:
+ {
+ switch (QuestionId) {
+ case ADMIN_PASSWORD_KEY_ID:
+ if ((Type == EFI_IFR_TYPE_STRING) && (Value->string == 0) &&
+ (mUserAuthenticationData->PasswordState == BROWSER_STATE_SET_PASSWORD)) {
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
+ ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // The Callback is responsible for validating old password input by user,
+ // If Callback return EFI_SUCCESS, it indicates validation pass.
+ //
+ switch (mUserAuthenticationData->PasswordState) {
+ case BROWSER_STATE_VALIDATE_PASSWORD:
+ UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
+ if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
+ Status = EFI_NOT_READY;
+ break;
+ }
+ if (UserInputPassword[0] == 0) {
+ //
+ // Setup will use a NULL password to check whether the old password is set,
+ // If the validation is successful, means there is no old password, return
+ // success to set the new password. Or need to return EFI_NOT_READY to
+ // let user input the old password.
+ //
+ Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
+ if (Status == EFI_SUCCESS) {
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
+ } else {
+ Status = EFI_NOT_READY;
+ }
+ break;
+ }
+ Status = VerifyPassword (UserInputPassword, StrSize (UserInputPassword));
+ if (Status == EFI_SUCCESS) {
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_SET_PASSWORD;
+ StrCpyS (
+ mUserAuthenticationData->OldPassword,
+ sizeof(mUserAuthenticationData->OldPassword)/sizeof(CHAR16),
+ UserInputPassword
+ );
+ } else {
+ //
+ // Old password mismatch, return EFI_NOT_READY to prompt for error message.
+ //
+ if (Status == EFI_ACCESS_DENIED) {
+ //
+ // Password retry count reach.
+ //
+ ForceSystemReset ();
+ }
+ Status = EFI_NOT_READY;
+ }
+ break;
+
+ case BROWSER_STATE_SET_PASSWORD:
+ UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
+ if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
+ Status = EFI_NOT_READY;
+ break;
+ }
+ Status = SetPassword (UserInputPassword, StrSize (UserInputPassword), mUserAuthenticationData->OldPassword, StrSize(mUserAuthenticationData->OldPassword));
+ PrintSetPasswordStatus (Status);
+ ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthenticationData->OldPassword));
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
+ HiiUpdateAdminPasswordStatus ();
+ break;
+
+ default:
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ return Status;
+}
+
+/**
+ Unregister status code callback functions.
+
+ @param Event Event whose notification function is being invoked.
+ @param Context Pointer to the notification function's context, which is
+ always zero in current implementation.
+
+**/
+VOID
+EFIAPI
+UnregisterBootTimeHandlers (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ mRscHandlerProtocol->Unregister (CheckForPassword);
+}
+
+/**
+ User Authentication entry point.
+
+ @param ImageHandle The image handle.
+ @param SystemTable The system table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+ @return other Contain some other errors.
+
+**/
+EFI_STATUS
+EFIAPI
+UserAuthenticationEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE DriverHandle;
+ EFI_HII_HANDLE HiiHandle;
+
+ DriverHandle = NULL;
+
+ mUserAuthenticationData = AllocateZeroPool (sizeof (USER_AUTHENTICATION_PRIVATE_DATA));
+ if (mUserAuthenticationData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mUserAuthenticationData->ConfigAccess.ExtractConfig = ExtractConfig;
+ mUserAuthenticationData->ConfigAccess.RouteConfig = RouteConfig;
+ mUserAuthenticationData->ConfigAccess.Callback = UserAuthenticationCallback;
+ mUserAuthenticationData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
+
+ //
+ // Install Config Access protocol to driver handle.
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &DriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mUserAuthenticationData->ConfigAccess,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ mUserAuthenticationData->DriverHandle = DriverHandle;
+
+ //
+ // Add HII data to database.
+ //
+ HiiHandle = HiiAddPackages (
+ &mUserAuthenticationVendorGuid,
+ DriverHandle,
+ UserAuthenticationDxeStrings,
+ UserAuthenticationDxeVfrBin,
+ NULL
+ );
+ if (HiiHandle == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ mUserAuthenticationData->HiiHandle = HiiHandle;
+
+ //
+ // Locate report status code protocol.
+ //
+ Status = gBS->LocateProtocol (
+ &gEfiRscHandlerProtocolGuid,
+ NULL,
+ (VOID **) &mRscHandlerProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ //Register the callback function for ReportStatusCode() notification.
+ //
+ mRscHandlerProtocol->Register (CheckForPassword, TPL_HIGH_LEVEL);
+
+ //
+ // Unregister boot time report status code listener at ExitBootService Event.
+ //
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ UnregisterBootTimeHandlers,
+ NULL,
+ &gEfiEventExitBootServicesGuid,
+ &mExitBootServicesEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Locates SMM Communication protocol.
+ //
+ Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication);
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Unloads the application and its installed protocol.
+
+ @param[in] ImageHandle Handle that identifies the image to be unloaded.
+
+ @retval EFI_SUCCESS The image has been unloaded.
+**/
+EFI_STATUS
+EFIAPI
+UserAuthenticationUnload (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ ASSERT (mUserAuthenticationData != NULL);
+
+ //
+ // Uninstall Config Access Protocol.
+ //
+ if (mUserAuthenticationData->DriverHandle != NULL) {
+ gBS->UninstallMultipleProtocolInterfaces (
+ mUserAuthenticationData->DriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mUserAuthenticationData->ConfigAccess,
+ NULL
+ );
+ mUserAuthenticationData->DriverHandle = NULL;
+ }
+
+ //
+ // Remove Hii Data.
+ //
+ if (mUserAuthenticationData->HiiHandle != NULL) {
+ HiiRemovePackages (mUserAuthenticationData->HiiHandle);
+ }
+
+ FreePool (mUserAuthenticationData);
+ mUserAuthenticationData = NULL;
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxePassword.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxePassword.c
new file mode 100644
index 0000000000..6e1fedfab7
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxePassword.c
@@ -0,0 +1,319 @@
+/** @file
+ UserAuthentication DXE password wrapper.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UserAuthenticationDxe.h"
+
+/**
+ Initialize the communicate buffer using DataSize and Function.
+
+ @param[out] DataPtr Points to the data in the communicate buffer.
+ @param[in] DataSize The data size to send to SMM.
+ @param[in] Function The function number to initialize the communicate header.
+
+ @return Communicate buffer.
+**/
+VOID*
+InitCommunicateBuffer (
+ OUT VOID **DataPtr OPTIONAL,
+ IN UINTN DataSize,
+ IN UINTN Function
+ )
+{
+ EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
+ VOID *Buffer;
+ EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable;
+ EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion;
+ UINTN Index;
+ UINTN Size;
+ EFI_STATUS Status;
+
+ Buffer = NULL;
+ Status = EfiGetSystemConfigurationTable (
+ &gEdkiiPiSmmCommunicationRegionTableGuid,
+ (VOID **) &SmmCommRegionTable
+ );
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+ ASSERT (SmmCommRegionTable != NULL);
+ SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1);
+ Size = 0;
+ for (Index = 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) {
+ if (SmmCommMemRegion->Type == EfiConventionalMemory) {
+ Size = EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages);
+ if (Size >= (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) {
+ break;
+ }
+ }
+ SmmCommMemRegion = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRegion + SmmCommRegionTable->DescriptorSize);
+ }
+ ASSERT (Index < SmmCommRegionTable->NumberOfEntries);
+
+ Buffer = (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart;
+ ASSERT (Buffer != NULL);
+ SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
+ CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid);
+ SmmCommunicateHeader->MessageLength = DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCommunicateHeader->Data;
+ ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER));
+ SmmPasswordFunctionHeader->Function = Function;
+ if (DataPtr != NULL) {
+ *DataPtr = SmmPasswordFunctionHeader + 1;
+ }
+
+ return Buffer;
+}
+
+/**
+ Send the data in communicate buffer to SMM.
+
+ @param[in] Buffer Points to the data in the communicate buffer.
+ @param[in] DataSize The data size to send to SMM.
+
+ @retval EFI_SUCCESS Success is returned from the function in SMM.
+ @retval Others Failure is returned from the function in SMM.
+
+**/
+EFI_STATUS
+SendCommunicateBuffer (
+ IN VOID *Buffer,
+ IN UINTN DataSize
+ )
+{
+ EFI_STATUS Status;
+ UINTN CommSize;
+ EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader;
+
+ CommSize = DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ Status = mSmmCommunication->Communicate (mSmmCommunication, Buffer, &CommSize);
+ ASSERT_EFI_ERROR (Status);
+
+ SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) Buffer;
+ SmmPasswordFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data;
+ return SmmPasswordFunctionHeader->ReturnStatus;
+}
+
+/**
+ Validate if the password is correct.
+
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval EFI_SUCCESS The password is correct.
+ @retval EFI_SECURITY_VIOLATION The password is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+**/
+EFI_STATUS
+VerifyPassword (
+ IN CHAR16 *Password,
+ IN UINTN PasswordSize
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD *VerifyPassword;
+
+ ASSERT (Password != NULL);
+
+ if (PasswordSize > sizeof(VerifyPassword->Password) * sizeof(CHAR16)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Buffer = InitCommunicateBuffer (
+ (VOID**)&VerifyPassword,
+ sizeof(*VerifyPassword),
+ SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = UnicodeStrToAsciiStrS (Password, VerifyPassword->Password, sizeof(VerifyPassword->Password));
+ if (EFI_ERROR(Status)) {
+ goto EXIT;
+ }
+
+ Status = SendCommunicateBuffer (Buffer, sizeof(*VerifyPassword));
+
+EXIT:
+ ZeroMem (VerifyPassword, sizeof(*VerifyPassword));
+ return Status;
+}
+
+/**
+ Set a new password.
+
+ @param[in] NewPassword The user input new password.
+ NULL means clear password.
+ @param[in] NewPasswordSize The size of NewPassword in byte.
+ @param[in] OldPassword The user input old password.
+ NULL means no old password.
+ @param[in] OldPasswordSize The size of OldPassword in byte.
+
+ @retval EFI_SUCCESS The NewPassword is set successfully.
+ @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect.
+ @retval EFI_INVALID_PARAMETER The password or size is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the password.
+ @retval EFI_ACCESS_DENIED Password retry count reach.
+ @retval EFI_UNSUPPORTED NewPassword is not strong enough.
+ @retval EFI_ALREADY_STARTED NewPassword is in history.
+**/
+EFI_STATUS
+SetPassword (
+ IN CHAR16 *NewPassword, OPTIONAL
+ IN UINTN NewPasswordSize,
+ IN CHAR16 *OldPassword, OPTIONAL
+ IN UINTN OldPasswordSize
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_SET_PASSWORD *SetPassword;
+
+ if (NewPasswordSize > sizeof(SetPassword->NewPassword) * sizeof(CHAR16)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ if (OldPasswordSize > sizeof(SetPassword->OldPassword) * sizeof(CHAR16)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Buffer = InitCommunicateBuffer (
+ (VOID**)&SetPassword,
+ sizeof(*SetPassword),
+ SMM_PASSWORD_FUNCTION_SET_PASSWORD
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (NewPassword != NULL) {
+ Status = UnicodeStrToAsciiStrS (NewPassword, SetPassword->NewPassword, sizeof(SetPassword->NewPassword));
+ if (EFI_ERROR(Status)) {
+ goto EXIT;
+ }
+ } else {
+ SetPassword->NewPassword[0] = 0;
+ }
+
+ if (OldPassword != NULL) {
+ Status = UnicodeStrToAsciiStrS (OldPassword, SetPassword->OldPassword, sizeof(SetPassword->OldPassword));
+ if (EFI_ERROR(Status)) {
+ goto EXIT;
+ }
+ } else {
+ SetPassword->OldPassword[0] = 0;
+ }
+
+ Status = SendCommunicateBuffer (Buffer, sizeof(*SetPassword));
+
+EXIT:
+ ZeroMem (SetPassword, sizeof(*SetPassword));
+ return Status;
+}
+
+/**
+ Return if the password is set.
+
+ @retval TRUE The password is set.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+IsPasswordInstalled (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+
+ Buffer = InitCommunicateBuffer (
+ NULL,
+ 0,
+ SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET
+ );
+ if (Buffer == NULL) {
+ return FALSE;
+ }
+
+ Status = SendCommunicateBuffer (Buffer, 0);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
+ Get password verification policy.
+
+ @param[out] VerifyPolicy Verification policy.
+
+ @retval EFI_SUCCESS Get verification policy successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verification policy.
+**/
+EFI_STATUS
+GetPasswordVerificationPolicy (
+ OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *GetVerifyPolicy;
+
+ Buffer = InitCommunicateBuffer (
+ (VOID**)&GetVerifyPolicy,
+ sizeof(*GetVerifyPolicy),
+ SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY
+ );
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = SendCommunicateBuffer (Buffer, sizeof(*GetVerifyPolicy));
+ if (!EFI_ERROR (Status)) {
+ CopyMem (VerifyPolicy, GetVerifyPolicy, sizeof (SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY));
+ }
+
+ return Status;
+}
+
+/**
+ Return if the password was verified.
+
+ @retval TRUE The password was verified.
+ @retval FALSE The password was not verified.
+**/
+BOOLEAN
+WasPasswordVerified (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ VOID *Buffer;
+
+ Buffer = InitCommunicateBuffer (
+ NULL,
+ 0,
+ SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED
+ );
+ if (Buffer == NULL) {
+ return FALSE;
+ }
+
+ Status = SendCommunicateBuffer (Buffer, 0);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.c b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.c
new file mode 100644
index 0000000000..07e834ebfa
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.c
@@ -0,0 +1,674 @@
+/** @file
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UserAuthenticationSmm.h"
+
+EFI_SMM_VARIABLE_PROTOCOL *mSmmVariable;
+
+UINTN mAdminPasswordTryCount = 0;
+
+BOOLEAN mNeedReVerify = TRUE;
+BOOLEAN mPasswordVerified = FALSE;
+
+/**
+ Verify if the password is correct.
+
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+ @param[in] UserPasswordVarStruct The storage of password in variable.
+
+ @retval EFI_SUCCESS The password is correct.
+ @retval EFI_SECURITY_VIOLATION The password is incorrect.
+**/
+EFI_STATUS
+VerifyPassword (
+ IN CHAR8 *Password,
+ IN UINTN PasswordSize,
+ IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
+ )
+{
+ BOOLEAN HashOk;
+ UINT8 HashData[PASSWORD_HASH_SIZE];
+
+ HashOk = KeyLibGeneratePBKDF2Hash (
+ HASH_TYPE_SHA256,
+ (UINT8 *)Password,
+ PasswordSize,
+ UserPasswordVarStruct->PasswordSalt,
+ sizeof(UserPasswordVarStruct->PasswordSalt),
+ HashData,
+ sizeof(HashData)
+ );
+ if (!HashOk) {
+ return EFI_DEVICE_ERROR;
+ }
+ if (KeyLibSlowCompareMem (UserPasswordVarStruct->PasswordHash, HashData, PASSWORD_HASH_SIZE) == 0) {
+ return EFI_SUCCESS;
+ } else {
+ return EFI_SECURITY_VIOLATION;
+ }
+}
+
+/**
+ Get hash data of password from non-volatile variable region.
+
+ @param[in] UserGuid The user GUID of the password variable.
+ @param[in] Index The index of the password.
+ 0 means current password.
+ Non-0 means the password history.
+ @param[out] UserPasswordVarStruct The storage of password in variable.
+
+ @retval EFI_SUCCESS The password hash is returned successfully.
+ @retval EFI_NOT_FOUND The password hash is not found.
+**/
+EFI_STATUS
+GetPasswordHashFromVariable (
+ IN EFI_GUID *UserGuid,
+ IN UINTN Index,
+ OUT USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
+ )
+{
+ UINTN DataSize;
+ CHAR16 PasswordName[sizeof(USER_AUTHENTICATION_VAR_NAME)/sizeof(CHAR16) + 5];
+
+ if (Index != 0) {
+ UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s%04x", USER_AUTHENTICATION_VAR_NAME, Index);
+ } else {
+ UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s", USER_AUTHENTICATION_VAR_NAME);
+ }
+
+ DataSize = sizeof(*UserPasswordVarStruct);
+ return mSmmVariable->SmmGetVariable (
+ PasswordName,
+ UserGuid,
+ NULL,
+ &DataSize,
+ UserPasswordVarStruct
+ );
+}
+
+/**
+ Save password hash data to non-volatile variable region.
+
+ @param[in] UserGuid The user GUID of the password variable.
+ @param[in] UserPasswordVarStruct The storage of password in variable.
+
+ @retval EFI_SUCCESS The password hash is saved successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the password hash.
+**/
+EFI_STATUS
+SavePasswordHashToVariable (
+ IN EFI_GUID *UserGuid,
+ IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
+ )
+{
+ EFI_STATUS Status;
+
+ if (UserPasswordVarStruct == NULL) {
+ Status = mSmmVariable->SmmSetVariable (
+ USER_AUTHENTICATION_VAR_NAME,
+ UserGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ 0,
+ NULL
+ );
+ } else {
+ Status = mSmmVariable->SmmSetVariable (
+ USER_AUTHENTICATION_VAR_NAME,
+ UserGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof(*UserPasswordVarStruct),
+ UserPasswordVarStruct
+ );
+ }
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "SavePasswordHashToVariable fails with %r\n", Status));
+ }
+
+ return Status;
+}
+
+/**
+ Save old password hash data to non-volatile variable region as history.
+
+ The number of password history variable is limited.
+ If all the password history variables are used, the new password history
+ will override the oldest one.
+
+ @param[in] UserGuid The user GUID of the password variable.
+ @param[in] UserPasswordVarStruct The storage of password in variable.
+
+ @retval EFI_SUCCESS The password hash is saved successfully.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the password hash.
+**/
+EFI_STATUS
+SaveOldPasswordToHistory (
+ IN EFI_GUID *UserGuid,
+ IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct
+ )
+{
+ EFI_STATUS Status;
+ UINTN DataSize;
+ UINT32 LastIndex;
+ CHAR16 PasswordName[sizeof(USER_AUTHENTICATION_VAR_NAME)/sizeof(CHAR16) + 5];
+
+ DEBUG ((DEBUG_INFO, "SaveOldPasswordToHistory\n"));
+
+ DataSize = sizeof(LastIndex);
+ Status = mSmmVariable->SmmGetVariable (
+ USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME,
+ UserGuid,
+ NULL,
+ &DataSize,
+ &LastIndex
+ );
+ if (EFI_ERROR(Status)) {
+ LastIndex = 0;
+ }
+ if (LastIndex >= PASSWORD_HISTORY_CHECK_COUNT) {
+ LastIndex = 0;
+ }
+
+ LastIndex ++;
+ UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s%04x", USER_AUTHENTICATION_VAR_NAME, LastIndex);
+
+
+ Status = mSmmVariable->SmmSetVariable (
+ PasswordName,
+ UserGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof(*UserPasswordVarStruct),
+ UserPasswordVarStruct
+ );
+ DEBUG ((DEBUG_INFO, " -- to %s, %r\n", PasswordName, Status));
+ if (!EFI_ERROR(Status)) {
+ Status = mSmmVariable->SmmSetVariable (
+ USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME,
+ UserGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof(LastIndex),
+ &LastIndex
+ );
+ DEBUG ((DEBUG_INFO, " LastIndex - 0x%04x, %r\n", LastIndex, Status));
+ }
+
+ return Status;
+}
+
+/**
+ Calculate password hash data and save it to non-volatile variable region.
+
+ @param[in] UserGuid The user GUID of the password variable.
+ @param[in] Password The user input password.
+ NULL means delete the password variable.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval EFI_SUCCESS The password hash is calculated and saved.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the password hash.
+**/
+EFI_STATUS
+SavePasswordToVariable (
+ IN EFI_GUID *UserGuid,
+ IN CHAR8 *Password, OPTIONAL
+ IN UINTN PasswordSize
+ )
+{
+ EFI_STATUS Status;
+ USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
+ BOOLEAN HashOk;
+
+ //
+ // If password is NULL, it means we want to clean password field saved in variable region.
+ //
+ if (Password != NULL) {
+ KeyLibGenerateSalt (UserPasswordVarStruct.PasswordSalt, sizeof(UserPasswordVarStruct.PasswordSalt));
+ HashOk = KeyLibGeneratePBKDF2Hash (
+ HASH_TYPE_SHA256,
+ (UINT8 *)Password,
+ PasswordSize,
+ UserPasswordVarStruct.PasswordSalt,
+ sizeof(UserPasswordVarStruct.PasswordSalt),
+ UserPasswordVarStruct.PasswordHash,
+ sizeof(UserPasswordVarStruct.PasswordHash)
+ );
+ if (!HashOk) {
+ return EFI_DEVICE_ERROR;
+ }
+ Status = SavePasswordHashToVariable (UserGuid, &UserPasswordVarStruct);
+ //
+ // Save Password data to history variable
+ //
+ if (!EFI_ERROR(Status)) {
+ SaveOldPasswordToHistory (UserGuid, &UserPasswordVarStruct);
+ }
+ } else {
+ Status = SavePasswordHashToVariable (UserGuid, NULL);
+ }
+
+ return Status;
+}
+
+/**
+ Verify the password.
+ If the password variable does not exist, it passes the verification.
+ If the password variable exists, it does verification based upon password variable.
+
+ @param[in] UserGuid The user GUID of the password variable.
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval TRUE The verification passes.
+ @retval FALSE The verification fails.
+**/
+BOOLEAN
+IsPasswordVerified (
+ IN EFI_GUID *UserGuid,
+ IN CHAR8 *Password,
+ IN UINTN PasswordSize
+ )
+{
+ USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
+ EFI_STATUS Status;
+ UINTN *PasswordTryCount;
+
+ PasswordTryCount = &mAdminPasswordTryCount;
+
+ Status = GetPasswordHashFromVariable (UserGuid, 0, &UserPasswordVarStruct);
+ if (EFI_ERROR(Status)) {
+ return TRUE;
+ }
+
+ //
+ // Old password exists
+ //
+ Status = VerifyPassword (Password, PasswordSize, &UserPasswordVarStruct);
+ if (EFI_ERROR(Status)) {
+ if (Password[0] != 0) {
+ *PasswordTryCount = *PasswordTryCount + 1;
+ }
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
+ Return if the password is set.
+
+ @param[in] UserGuid The user GUID of the password variable.
+
+ @retval TRUE The password is set.
+ @retval FALSE The password is not set.
+**/
+BOOLEAN
+IsPasswordSet (
+ IN EFI_GUID *UserGuid
+ )
+{
+ USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
+ EFI_STATUS Status;
+
+ Status = GetPasswordHashFromVariable(UserGuid, 0, &UserPasswordVarStruct);
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ Return if the password is strong.
+ Criteria:
+ 1) length >= PASSWORD_MIN_SIZE
+ 2) include lower case, upper case, number, symbol.
+
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval TRUE The password is strong.
+ @retval FALSE The password is weak.
+**/
+BOOLEAN
+IsPasswordStrong (
+ IN CHAR8 *Password,
+ IN UINTN PasswordSize
+ )
+{
+ UINTN Index;
+ BOOLEAN HasLowerCase;
+ BOOLEAN HasUpperCase;
+ BOOLEAN HasNumber;
+ BOOLEAN HasSymbol;
+
+ if (PasswordSize < PASSWORD_MIN_SIZE) {
+ return FALSE;
+ }
+
+ HasLowerCase = FALSE;
+ HasUpperCase = FALSE;
+ HasNumber = FALSE;
+ HasSymbol = FALSE;
+ for (Index = 0; Index < PasswordSize - 1; Index++) {
+ if (Password[Index] >= 'a' && Password[Index] <= 'z') {
+ HasLowerCase = TRUE;
+ } else if (Password[Index] >= 'A' && Password[Index] <= 'Z') {
+ HasUpperCase = TRUE;
+ } else if (Password[Index] >= '0' && Password[Index] <= '9') {
+ HasNumber = TRUE;
+ } else {
+ HasSymbol = TRUE;
+ }
+ }
+ if ((!HasLowerCase) || (!HasUpperCase) || (!HasNumber) || (!HasSymbol)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ Return if the password is set before in PASSWORD_HISTORY_CHECK_COUNT.
+
+ @param[in] UserGuid The user GUID of the password variable.
+ @param[in] Password The user input password.
+ @param[in] PasswordSize The size of Password in byte.
+
+ @retval TRUE The password is set before.
+ @retval FALSE The password is not set before.
+**/
+BOOLEAN
+IsPasswordInHistory (
+ IN EFI_GUID *UserGuid,
+ IN CHAR8 *Password,
+ IN UINTN PasswordSize
+ )
+{
+ EFI_STATUS Status;
+ USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct;
+ UINTN Index;
+
+ for (Index = 1; Index <= PASSWORD_HISTORY_CHECK_COUNT; Index++) {
+ Status = GetPasswordHashFromVariable (UserGuid, Index, &UserPasswordVarStruct);
+ if (!EFI_ERROR(Status)) {
+ Status = VerifyPassword (Password, PasswordSize, &UserPasswordVarStruct);
+ if (!EFI_ERROR(Status)) {
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+/**
+ Communication service SMI Handler entry.
+
+ This SMI handler provides services for password management.
+
+ @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
+SmmPasswordHandler (
+ IN EFI_HANDLE DispatchHandle,
+ IN CONST VOID *RegisterContext,
+ IN OUT VOID *CommBuffer,
+ IN OUT UINTN *CommBufferSize
+ )
+{
+ EFI_STATUS Status;
+ SMM_PASSWORD_COMMUNICATE_HEADER *SmmFunctionHeader;
+ UINTN CommBufferPayloadSize;
+ UINTN TempCommBufferSize;
+ SMM_PASSWORD_COMMUNICATE_SET_PASSWORD SmmCommunicateSetPassword;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD SmmCommunicateVerifyPassword;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY SmmCommunicateSetVerifyPolicy;
+ SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *SmmCommunicateGetVerifyPolicy;
+ UINTN PasswordLen;
+ EFI_GUID *UserGuid;
+ UINTN *PasswordTryCount;
+
+ //
+ // If input is invalid, stop processing this SMI
+ //
+ if (CommBuffer == NULL || CommBufferSize == NULL) {
+ return EFI_SUCCESS;
+ }
+
+ TempCommBufferSize = *CommBufferSize;
+ PasswordLen = 0;
+
+ if (TempCommBufferSize < sizeof (SMM_PASSWORD_COMMUNICATE_HEADER)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SMM communication buffer size invalid!\n"));
+ return EFI_SUCCESS;
+ }
+
+ CommBufferPayloadSize = TempCommBufferSize - sizeof (SMM_PASSWORD_COMMUNICATE_HEADER);
+
+ Status = EFI_SUCCESS;
+ SmmFunctionHeader = (SMM_PASSWORD_COMMUNICATE_HEADER *)CommBuffer;
+
+ UserGuid = &gUserAuthenticationGuid;
+ PasswordTryCount = &mAdminPasswordTryCount;
+
+ switch (SmmFunctionHeader->Function) {
+ case SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET:
+ PasswordTryCount = NULL;
+ if (CommBufferPayloadSize != 0) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: IS_PASSWORD_SET payload buffer invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ if (IsPasswordSet(UserGuid)) {
+ Status = EFI_SUCCESS;
+ } else {
+ Status = EFI_NOT_FOUND;
+ }
+ break;
+ case SMM_PASSWORD_FUNCTION_SET_PASSWORD:
+ if (*PasswordTryCount >= PASSWORD_MAX_TRY_COUNT) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_PASSWORD try count reach!\n"));
+ PasswordTryCount = NULL;
+ Status = EFI_ACCESS_DENIED;
+ goto EXIT;
+ }
+ if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_SET_PASSWORD)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_PASSWORD payload buffer invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ CopyMem (&SmmCommunicateSetPassword, SmmFunctionHeader + 1, sizeof(SmmCommunicateSetPassword));
+
+ PasswordLen = AsciiStrnLenS(SmmCommunicateSetPassword.OldPassword, sizeof(SmmCommunicateSetPassword.OldPassword));
+ if (PasswordLen == sizeof(SmmCommunicateSetPassword.OldPassword)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: OldPassword invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+
+ if (!IsPasswordVerified (UserGuid, SmmCommunicateSetPassword.OldPassword, PasswordLen + 1)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: PasswordVerify - FAIL\n"));
+ Status = EFI_SECURITY_VIOLATION;
+ goto EXIT;
+ }
+
+ PasswordLen = AsciiStrnLenS(SmmCommunicateSetPassword.NewPassword, sizeof(SmmCommunicateSetPassword.NewPassword));
+ if (PasswordLen == sizeof(SmmCommunicateSetPassword.NewPassword)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ if (PasswordLen != 0 && !IsPasswordStrong (SmmCommunicateSetPassword.NewPassword, PasswordLen + 1)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword too weak!\n"));
+ Status = EFI_UNSUPPORTED;
+ goto EXIT;
+ }
+ if (PasswordLen != 0 && IsPasswordInHistory (UserGuid, SmmCommunicateSetPassword.NewPassword, PasswordLen + 1)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword in history!\n"));
+ Status = EFI_ALREADY_STARTED;
+ goto EXIT;
+ }
+
+ if (PasswordLen == 0) {
+ Status = SavePasswordToVariable (UserGuid, NULL, 0);
+ } else {
+ Status = SavePasswordToVariable (UserGuid, SmmCommunicateSetPassword.NewPassword, PasswordLen + 1);
+ }
+ break;
+
+ case SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD:
+ if (*PasswordTryCount >= PASSWORD_MAX_TRY_COUNT) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: VERIFY_PASSWORD try count reach!\n"));
+ PasswordTryCount = NULL;
+ Status = EFI_ACCESS_DENIED;
+ goto EXIT;
+ }
+ if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: VERIFY_PASSWORD payload buffer invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ CopyMem (&SmmCommunicateVerifyPassword, SmmFunctionHeader + 1, sizeof(SmmCommunicateVerifyPassword));
+
+ PasswordLen = AsciiStrnLenS(SmmCommunicateVerifyPassword.Password, sizeof(SmmCommunicateVerifyPassword.Password));
+ if (PasswordLen == sizeof(SmmCommunicateVerifyPassword.Password)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: Password invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ if (!IsPasswordVerified (UserGuid, SmmCommunicateVerifyPassword.Password, PasswordLen + 1)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: PasswordVerify - FAIL\n"));
+ Status = EFI_SECURITY_VIOLATION;
+ goto EXIT;
+ }
+ mPasswordVerified = TRUE;
+ Status = EFI_SUCCESS;
+ break;
+
+ case SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY:
+ PasswordTryCount = NULL;
+ if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_VERIFY_POLICY payload buffer invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ CopyMem (&SmmCommunicateSetVerifyPolicy, SmmFunctionHeader + 1, sizeof(SmmCommunicateSetVerifyPolicy));
+ mNeedReVerify = SmmCommunicateSetVerifyPolicy.NeedReVerify;
+ break;
+
+ case SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY:
+ PasswordTryCount = NULL;
+ if (CommBufferPayloadSize != sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY)) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: GET_VERIFY_POLICY payload buffer invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ SmmCommunicateGetVerifyPolicy = (SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *) (SmmFunctionHeader + 1);
+ SmmCommunicateGetVerifyPolicy->NeedReVerify = mNeedReVerify;
+ break;
+ case SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED:
+ PasswordTryCount = NULL;
+ if (CommBufferPayloadSize != 0) {
+ DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: WAS_PASSWORD_VERIFIED payload buffer invalid!\n"));
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
+ }
+ if (mPasswordVerified) {
+ Status = EFI_SUCCESS;
+ } else {
+ Status = EFI_NOT_STARTED;
+ }
+ break;
+
+ default:
+ PasswordTryCount = NULL;
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+
+EXIT:
+ if (PasswordTryCount != NULL) {
+ if (Status == EFI_SUCCESS) {
+ *PasswordTryCount = 0;
+ }
+ }
+ SmmFunctionHeader->ReturnStatus = Status;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Main entry for this driver.
+
+ @param ImageHandle Image handle this driver.
+ @param SystemTable Pointer to SystemTable.
+
+ @retval EFI_SUCESS This function always complete successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+PasswordSmmInit (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE SmmHandle;
+ EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;
+ CHAR16 PasswordHistoryName[sizeof(USER_AUTHENTICATION_VAR_NAME)/sizeof(CHAR16) + 5];
+ UINTN Index;
+
+ ASSERT (PASSWORD_HASH_SIZE == SHA256_DIGEST_SIZE);
+ ASSERT (PASSWORD_HISTORY_CHECK_COUNT < 0xFFFF);
+
+ Status = gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID**)&mSmmVariable);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Make password variables read-only for DXE driver for security concern.
+ //
+ Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);
+ if (!EFI_ERROR (Status)) {
+ Status = VariableLock->RequestToLock (VariableLock, USER_AUTHENTICATION_VAR_NAME, &gUserAuthenticationGuid);
+ ASSERT_EFI_ERROR (Status);
+
+ for (Index = 1; Index <= PASSWORD_HISTORY_CHECK_COUNT; Index++) {
+ UnicodeSPrint (PasswordHistoryName, sizeof (PasswordHistoryName), L"%s%04x", USER_AUTHENTICATION_VAR_NAME, Index);
+ Status = VariableLock->RequestToLock (VariableLock, PasswordHistoryName, &gUserAuthenticationGuid);
+ ASSERT_EFI_ERROR (Status);
+ }
+ Status = VariableLock->RequestToLock (VariableLock, USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME, &gUserAuthenticationGuid);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ SmmHandle = NULL;
+ Status = gSmst->SmiHandlerRegister (SmmPasswordHandler, &gUserAuthenticationGuid, &SmmHandle);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (IsPasswordCleared()) {
+ DEBUG ((DEBUG_INFO, "IsPasswordCleared\n"));
+ SavePasswordToVariable (&gUserAuthenticationGuid, NULL, 0);
+ }
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni
new file mode 100644
index 0000000000..b0255889e0
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni
@@ -0,0 +1,19 @@
+// /** @file
+// NULL platform password library instance that returns the password clear state based upon PCD.
+//
+// NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared
+// but returns the PCD value directly. This instance can be used to verify security
+// related features during platform enabling and development. It should be replaced
+// by a platform-specific method(e.g. Button pressed) in a real platform for product.
+//
+// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "NULL platform password library instance that returns the password clear state based upon PCD."
+
+#string STR_MODULE_DESCRIPTION #language en-US "NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared but returns the PCD value directly. This instance can be used to verify security related features during platform enabling and development. It should be replaced by a platform-specific method(e.g. Button pressed) in a real platform for product."
+
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md b/Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md
new file mode 100644
index 0000000000..d2c492710e
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md
@@ -0,0 +1,86 @@
+# Overview
+* **Feature Name:** User Authentication
+* **PI Phase(s) Supported:** DXE
+* **SMM Required?** Yes
+
+## Purpose
+*_TODO_*
+Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph.
+
+# High-Level Theory of Operation
+*_TODO_*
+A description of how the device works at a high-level.
+
+The description should not be constrained to implementation details but provide a simple mental model of how the
+feature is supposed to work.
+
+## Firmware Volumes
+*_TODO_*
+A bulleted list of the firmware volumes that feature module(s) are placed in.
+
+## Modules
+*_TODO_*
+A bulleted list of the modules that make up the feature.
+
+## <Module Name>
+*_TODO_*
+Each module in the feature should have a section that describes the module in a level of detail that is useful
+to better understand the module source code.
+
+## <Library Name>
+*_TODO_*
+Each library in the feature should have a section that describes the library in a level of detail that is useful
+to better understand the library source code.
+
+## Key Functions
+*_TODO_*
+A bulleted list of key functions for interacting with the feature.
+
+Not all features need to be listed. Only functions exposed through external interfaces that are important for feature
+users to be aware of.
+
+## Configuration
+*_TODO_*
+Information that is useful for configuring the feature.
+
+Not all configuration options need to be listed. This section is used to provide more background on configuration
+options than possible elsewhere.
+
+## Data Flows
+*_TODO_*
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+*_TODO_*
+Key control flows for the feature.
+
+## Build Flows
+*_TODO_*
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or require non-standard tool configuration. If the
+standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+*_TODO_*
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the feature is successful. If the test point is not
+implemented, this should be stated.
+
+## Functional Exit Criteria
+*_TODO_*
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board integrator can reference to ensure the feature is
+functional on their board.
+
+## Feature Enabling Checklist
+*_TODO_*
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+*_TODO_*
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeStrings.uni b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeStrings.uni
new file mode 100644
index 0000000000..1e3a179677
--- /dev/null
+++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationDxeStrings.uni
@@ -0,0 +1,30 @@
+/** @file
+// String definitions for User Authentication formset.
+//
+// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+**/
+
+#langdef en-US "English"
+#langdef fr-FR "Francais"
+
+
+#string STR_FORM_SET_TITLE #language en-US "User Password Management"
+ #language fr-FR "User Password Management"
+#string STR_FORM_SET_TITLE_HELP #language en-US "This Driver mainly handle user's password"
+ #language fr-FR "This Driver mainly handle user's password"
+#string STR_FORM_TITLE #language en-US "Password Management Form"
+ #language fr-FR "Password Management Form"
+#string STR_ADMIN_PASSWORD_PROMPT #language en-US "Change Admin Password"
+ #language fr-FR "Change Admin Password"
+#string STR_ADMIN_PASSWORD_HELP #language en-US "Input old admin password if it was set, then you can change the password to a new one. After the change action, you may need input the new password when you enter UI. The new password must be between 8 and 32 chars include lowercase, uppercase alphabetic, number, and symbol. Input an empty password can clean old admin password, then no need input password to enter UI."
+ #language fr-FR "Input old admin password if it was set, then you can change the password to a new one. After the change action, you may need input the new password when you enter UI. The new password must be between 8 and 32 chars include lowercase, uppercase alphabetic, number, and symbol. Input an empty password can clean old admin password, then no need input password to enter UI."
+#string STR_ADMIN_PASSWORD_STS_HELP #language en-US "Current Admin Password status: Installed or Not Installed."
+ #language fr-FR "Current Admin Password status: Installed or Not Installed."
+#string STR_ADMIN_PASSWORD_STS_PROMPT #language en-US "Admin Password Status"
+ #language fr-FR "Admin Password Status"
+#string STR_ADMIN_PASSWORD_STS_CONTENT #language en-US ""
+ #language fr-FR ""
+
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 28/49] Features/Intel/NetworkFeaturePkg: Add initial package
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 28/49] Features/Intel/NetworkFeaturePkg: " Kubacki, Michael A
@ 2019-11-15 23:50 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:50 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Please at least fill in the "Purpose" section of Readme.md, don't leave the entire file as TODOs.
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 28/49] Features/Intel/NetworkFeaturePkg: Add initial package
Adds a new feature package for the Network feature.
The Network feature code is actually in edk2/NetworkPkg at this time so this package inclues the content from edk2/NetworkPkg. In the future, it is preferred to move the source code from NetworkPkg to NetworkFeaturePkg.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec | 30 ++++
Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc | 152 ++++++++++++++++++++
Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc | 30 ++++
Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf | 10 ++
Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf | 8 ++
Features/Intel/Network/NetworkFeaturePkg/Readme.md | 89 ++++++++++++
6 files changed, 319 insertions(+)
diff --git a/Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec b/Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec
new file mode 100644
index 0000000000..670b76e52f
--- /dev/null
+++ b/Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for Network support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and # INF
+files to generate AutoGen.c and AutoGen.h files # for the build
+infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010017
+ PACKAGE_NAME = NetworkFeaturePkg
+ PACKAGE_GUID = CA1BF91C-8B5E-40C2-9C4C-DD250D2170A9
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Include
+
+[LibraryClasses]
+
+[Guids]
+ gNetworkFeaturePkgTokenSpaceGuid = {0x990904ed, 0xb62a, 0x4b46,
+{0xa2, 0x9d, 0xe4, 0x09, 0xa6, 0x7f, 0x54, 0x68}}
+
+[PcdsFeatureFlag]
+
+gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable|FALSE|BOOLEAN|
+0xA0000001
diff --git a/Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc b/Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc
new file mode 100644
index 0000000000..c59c21ee6c
--- /dev/null
+++ b/Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.ds
+++ c
@@ -0,0 +1,152 @@
+## @file
+# This is a build description file for the Network advanced feature.
+# This file should be included into another package DSC file to build this feature.
+#
+# The DEC files are used by the utilities that parse DSC and # INF
+files to generate AutoGen.c and AutoGen.h files # for the build
+infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+#######################################################################
+#########
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+#######################################################################
+#########
+[Defines]
+!ifndef $(PEI_ARCH)
+ !error "PEI_ARCH must be specified to build this feature!"
+!endif
+!ifndef $(DXE_ARCH)
+ !error "DXE_ARCH must be specified to build this feature!"
+!endif
+
+ !include NetworkPkg/NetworkDefines.dsc.inc
+
+#######################################################################
+#########
+#
+# PCD Section - list of EDK II PCD Entries modified by the feature.
+#
+#######################################################################
+#########
+[PcdsFixedAtBuild]
+ !include NetworkPkg/NetworkPcds.dsc.inc
+
+#######################################################################
+#########
+#
+# Library Class section - list of all Library Classes needed by this feature.
+#
+#######################################################################
+#########
+[LibraryClasses]
+ !include NetworkPkg/NetworkLibs.dsc.inc
+
+ #######################################
+ # Edk2 Packages
+ #######################################
+ BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+
+ BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.i
+ nf DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+
+ FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.i
+ nf HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+ IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+ OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+
+ PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BaseP
+ eCoffGetEntryPointLib.inf
+ PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLi
+ bNull.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+
+ ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRep
+ ortStatusCodeLibNull.inf
+ SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTempl
+ ate.inf TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
+
+ UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootMan
+ agerLib.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiB
+ ootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEnt
+ ryPoint.inf
+ UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServ
+ icesLib.inf UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib
+ /UefiRuntimeServicesTableLib.inf
+
+[LibraryClasses.common.SEC,LibraryClasses.common.PEI_CORE,LibraryClasse
+s.common.PEIM]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+
+MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllo
+cationLib.inf
+ PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+
+[LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,Li
+braryClasses.common.SMM_CORE,LibraryClasses.common.DXE_DRIVER,LibraryCl
+asses.common.DXE_RUNTIME_DRIVER,LibraryClasses.common.UEFI_DRIVER,Libra
+ryClasses.common.UEFI_APPLICATION]
+ #######################################
+ # Edk2 Packages
+ #######################################
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+
+DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTable
+Lib.inf
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+
+MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAl
+locationLib.inf
+ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+
+#######################################################################
+#########
+#
+# Component section - list of all components that need built for this feature.
+#
+# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
+# into firmware volume images. This section is just a list of modules to compile from
+# source into UEFI-compliant binaries.
+# It is the FDF file that contains information on combining binary files into firmware
+# volume images, whose concept is beyond UEFI and is described in PI specification.
+# There may also be modules listed in this section that are not required in the FDF file,
+# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
+# generated for it, but the binary will not be put into any firmware volume.
+#
+#######################################################################
+#########
+#
+# Feature PEI Components
+#
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.IA32]
+ #####################################
+ # Network Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package
+ components and should be tested # in the package build.
+
+ # Add components here that should be included in the package build.
+
+#
+# Feature DXE Components
+#
+
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed.
+[Components.X64]
+ #####################################
+ # Network Feature Package
+ #####################################
+
+ # Add library instances here that are not included in package
+ components and should be tested # in the package build.
+
+ # Add components here that should be included in the package build.
+ !include NetworkPkg/NetworkComponents.dsc.inc
+
+#######################################################################
+############################
+#
+# BuildOptions Section - Define the module specific tool chain flags that should be used as
+# the default flags for a module. These flags are appended to any
+# standard flags that are defined by the build process. They can be
+# applied for any modules or only those modules with the specific
+# module style (EDK or EDKII) specified in [Components] section.
+#
+# For advanced features, it is recommended to enable [BuildOptions] in
+# the applicable INF file so it does not affect the whole board package
+# build when this DSC file is active.
+#
+#######################################################################
+############################
+[BuildOptions]
diff --git a/Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc b/Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc
new file mode 100644
index 0000000000..199686fa09
--- /dev/null
+++ b/Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc
@@ -0,0 +1,30 @@
+## @file
+# This package provides advanced feature functionality for Network support.
+# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg.
+#
+# The DEC files are used by the utilities that parse DSC and # INF
+files to generate AutoGen.c and AutoGen.h files # for the build
+infrastructure.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+[Defines]
+ PLATFORM_NAME = NetworkFeaturePkg
+ PLATFORM_GUID = 63D1D82C-965C-44A7-B90D-C8AA42E59152
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE|NOOPT
+ SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#
+# This package always builds the feature.
+#
+!include Include/NetworkFeature.dsc
diff --git a/Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf b/Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..819b839d60
--- /dev/null
+++ b/Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,10 @@
+## @file
+# FDF file for post-memory Network advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+!include NetworkPkg/Network.fdf.inc
diff --git a/Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf b/Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..25f17be40f
--- /dev/null
+++ b/Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,8 @@
+## @file
+# FDF file for pre-memory Network advanced feature modules.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
diff --git a/Features/Intel/Network/NetworkFeaturePkg/Readme.md b/Features/Intel/Network/NetworkFeaturePkg/Readme.md
new file mode 100644
index 0000000000..4ad5e2a3a3
--- /dev/null
+++ b/Features/Intel/Network/NetworkFeaturePkg/Readme.md
@@ -0,0 +1,89 @@
+# Overview
+* **Feature Name:** Network
+* **PI Phase(s) Supported:** DXE
+* **SMM Required?** No
+
+_Note:_ Network feature support is currently provided by including
+files exposed by NetworkPkg. In the future, it is preferable to relocate the source code in NetworkPkg to NetworkFeaturePkg.
+
+## Purpose
+*_TODO_*
+Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph.
+
+# High-Level Theory of Operation
+*_TODO_*
+A description of how the device works at a high-level.
+
+The description should not be constrained to implementation details but
+provide a simple mental model of how the feature is supposed to work.
+
+## Firmware Volumes
+*_TODO_*
+A bulleted list of the firmware volumes that feature module(s) are placed in.
+
+## Modules
+*_TODO_*
+A bulleted list of the modules that make up the feature.
+
+## <Module Name>
+*_TODO_*
+Each module in the feature should have a section that describes the
+module in a level of detail that is useful to better understand the module source code.
+
+## <Library Name>
+*_TODO_*
+Each library in the feature should have a section that describes the
+library in a level of detail that is useful to better understand the library source code.
+
+## Key Functions
+*_TODO_*
+A bulleted list of key functions for interacting with the feature.
+
+Not all features need to be listed. Only functions exposed through
+external interfaces that are important for feature users to be aware of.
+
+## Configuration
+*_TODO_*
+Information that is useful for configuring the feature.
+
+Not all configuration options need to be listed. This section is used
+to provide more background on configuration options than possible elsewhere.
+
+## Data Flows
+*_TODO_*
+Architecturally defined data structures and flows for the feature.
+
+## Control Flows
+*_TODO_*
+Key control flows for the feature.
+
+## Build Flows
+*_TODO_*
+Any special build flows should be described in this section.
+
+This is particularly useful for features that use custom build tools or
+require non-standard tool configuration. If the standard flow in the feature package template is used, this section may be empty.
+
+## Test Point Results
+*_TODO_*
+The test(s) that can verify porting is complete for the feature.
+
+Each feature must describe at least one test point to verify the
+feature is successful. If the test point is not implemented, this should be stated.
+
+## Functional Exit Criteria
+*_TODO_*
+The testable functionality for the feature.
+
+This section should provide an ordered list of criteria that a board
+integrator can reference to ensure the feature is functional on their board.
+
+## Feature Enabling Checklist
+*_TODO_*
+An ordered list of required activities to achieve desired functionality for the feature.
+
+## Common Optimizations
+*_TODO_*
+Common size or performance tuning options for this feature.
+
+This section is recommended but not required. If not used, the contents should be left empty.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 29/49] AdvancedFeaturePkg: Remove remaining contents
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 29/49] AdvancedFeaturePkg: Remove remaining contents Kubacki, Michael A
@ 2019-11-15 23:50 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:50 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 29/49] AdvancedFeaturePkg: Remove remaining contents
This change removes the remaining files in AdvancedFeaturePkg that are no longer part of the Minimum Platform Advanced Feature design.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 4 --
Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 56 --------------------
Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc | 15 ------
Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.dsc | 9 ----
Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf | 14 -----
Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf | 8 --- Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf | 9 ----
7 files changed, 115 deletions(-)
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
index 6cd333d498..7342539198 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
@@ -11,15 +11,12 @@
# SPDX-License-Identifier: BSD-2-Clause-Patent # ##
-
-
[Defines]
DEC_SPECIFICATION = 0x00010017
PACKAGE_NAME = AdvancedFeaturePkg
PACKAGE_VERSION = 0.1
PACKAGE_GUID = 290127D9-ABED-4DD8-A35D-73DCB4261BCB
-
[Includes]
Include
@@ -27,4 +24,3 @@ Include
gAdvancedFeaturePkgTokenSpaceGuid = {0xa8514688, 0x6693, 0x4ab5, {0xaa, 0xc8, 0xcc, 0xa9, 0x8d, 0xde, 0x90, 0xe1}}
[PcdsFeatureFlag]
- gAdvancedFeaturePkgTokenSpaceGuid.PcdNetworkEnable |FALSE|BOOLEAN|0xF00000A1
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index 4b8ccf3375..38298e15e4 100644
--- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -21,59 +21,3 @@
SUPPORTED_ARCHITECTURES = IA32|X64
BUILD_TARGETS = DEBUG|RELEASE
SKUID_IDENTIFIER = DEFAULT
-
-################################################################################
-#
-# SKU Identification section - list of all SKU IDs supported.
-#
-################################################################################
-[SkuIds]
- 0|DEFAULT # The entry: 0|DEFAULT is reserved and always required.
-
-################################################################################
-#
-# Pcd Section - list of all EDK II PCD Entries defined by this package.
-#
-################################################################################
-
-[PcdsFeatureFlag]
-
-################################################################################
-#
-# Library Class section - list of all Library Classes needed by this package.
-#
-################################################################################
-
-[LibraryClasses.common]
-
-###################################################################################################
-#
-# Components Section - list of the modules and components that will be processed by compilation
-# tools and the EDK II tools to generate PE32/PE32+/Coff image files.
-#
-# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
-# into firmware volume images. This section is just a list of modules to compile from
-# source into UEFI-compliant binaries.
-# It is the FDF file that contains information on combining binary files into firmware
-# volume images, whose concept is beyond UEFI and is described in PI specification.
-# Binary modules do not need to be listed in this section, as they should be
-# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi),
-# Logo (Logo.bmp), and etc.
-# There may also be modules listed in this section that are not required in the FDF file,
-# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
-# generated for it, but the binary will not be put into any firmware volume.
-#
-###################################################################################################
-
-[Components]
- #######################################
- # Advanced Feature Package
- #######################################
-
- # Add library instances here that are not included in package components and should be tested
- # in the package build.
-
- # Add components here that should be included in the package build.
-
-[BuildOptions]
- *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc b/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
deleted file mode 100644
index b74c0ef2bc..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
+++ /dev/null
@@ -1,15 +0,0 @@
-## @file
-# Platform description.
-#
-# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR> -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -##
-
-
- #
- # UEFI network modules
- #
- !include NetworkPkg/NetworkComponents.dsc.inc
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.dsc b/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.dsc
deleted file mode 100644
index 86b1ebfed0..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.dsc
+++ /dev/null
@@ -1,9 +0,0 @@
-## @file
-# Platform description.
-#
-# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -##
-
diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
deleted file mode 100644
index a86ecdc9d1..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
+++ /dev/null
@@ -1,14 +0,0 @@
-## @file
-# FDF file of Platform.
-#
-# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR> -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -##
-
-
-#
-# UEFI network modules
-#
-!include NetworkPkg/Network.fdf.inc
diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf
deleted file mode 100644
index 3c2716d672..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInclude.fdf
+++ /dev/null
@@ -1,8 +0,0 @@
-## @file
-# FDF file of Platform.
-#
-# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf
deleted file mode 100644
index 5b21f781a7..0000000000
--- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryInclude.fdf
+++ /dev/null
@@ -1,9 +0,0 @@
-## @file
-# FDF file of Platform.
-#
-# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -##
-
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 30/49] AdvancedFeaturePkg: Move to Features/Intel
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 30/49] AdvancedFeaturePkg: Move to Features/Intel Kubacki, Michael A
@ 2019-11-15 23:50 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:50 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
AdvancedFeaturePkg/AdvancedFeaturePkg.dsc - This is so much better than that we had before!
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 30/49] AdvancedFeaturePkg: Move to Features/Intel
This change moves AdvancedFeaturePkg to the Features/Intel directory. AdvancedFeaturePkg will be the only package that is located at the root level of Features/Intel.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
{Platform => Features}/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 0 {Platform => Features}/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 0
2 files changed, 0 insertions(+), 0 deletions(-)
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
similarity index 100%
rename from Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
rename to Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
similarity index 100%
rename from Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
rename to Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 31/49] AdvancedFeaturePkg: Add feature build support
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 31/49] AdvancedFeaturePkg: Add feature build support Kubacki, Michael A
@ 2019-11-15 23:50 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:50 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 31/49] AdvancedFeaturePkg: Add feature build support
This change adds the ability to build all currently available advanced features using the AdvancedFeaturePkg build. To build all advanced features, follow the instructions in the Feature/Intel/Readme.md file. The actual build is performed by executing the following command in the Features/Intel directory:
"build -p AdvancedFeaturePkg/AdvancedFeaturePkg.dsc -a IA32 -a X64"
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 9 +++-
Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 28 ++++++++++
Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc | 56 ++++++++++++++++++++
3 files changed, 91 insertions(+), 2 deletions(-)
diff --git a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
index 7342539198..36c72b98e1 100644
--- a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
+++ b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
@@ -1,6 +1,11 @@
## @file
-# This package provides the modules that build for a full feature platform.
-# This AdvancedFeaturePkg should only depend on EDKII Core packages and MinPlatformPkg.
+# Advanced Feature Package build declaration file.
+#
+# Advanced features allow a board package to be extended with advanced functionality.
+#
+# This package should not contain any specific advanced features. The package has two responsibilities:
+# 1. Present a consolidated and simplified view of all available advanced features to board packages.
+# 2. Provide a simple, single package build for all available advanced features.
#
# The DEC files are used by the utilities that parse DSC and # INF files to generate AutoGen.c and AutoGen.h files diff --git a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index 38298e15e4..50c0e81048 100644
--- a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -1,6 +1,12 @@
## @file
# Advanced Feature Package build description file.
#
+# Advanced features allow a board package to be extended with advanced functionality.
+#
+# This package should not contain any specific advanced features. The package has two responsibilities:
+# 1. Present a consolidated and simplified view of all available advanced features to board packages.
+# 2. Provide a simple, single package build for all available advanced features.
+#
# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -21,3 +27,25 @@
SUPPORTED_ARCHITECTURES = IA32|X64
BUILD_TARGETS = DEBUG|RELEASE
SKUID_IDENTIFIER = DEFAULT
+ PEI_ARCH = IA32
+ DXE_ARCH = X64
+
+#######################################################################
+#########
+#
+# Advanced Feature Enable section - all advanced features are enabling for the
+# AdvancedFeaturePkg build.
+#
+#######################################################################
+#########
+[PcdsFeatureFlag]
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable |TRUE
+ gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable |TRUE
+ gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable |TRUE
+ gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable |TRUE
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable |TRUE
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable |TRUE
+ gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable |TRUE
+
+#
+# This package builds all advanced features.
+#
+!include Include/AdvancedFeatures.dsc
diff --git a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
new file mode 100644
index 0000000000..649774edf7
--- /dev/null
+++ b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
@@ -0,0 +1,56 @@
+## @file
+# DSC file for advanced features.
+#
+# This file is intended to be included into another package so
+advanced features # can be conditionally built by enabling the respective feature via its FeaturePCD.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+#
+# Debug Advanced Features
+#
+!if gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable ==
+TRUE
+ !include Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeature.dsc
+!endif
+!if gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable ==
+TRUE
+ !include Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeature.dsc
+!endif
+
+#
+# Network Advanced Features
+#
+!if gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable == TRUE
+ !include Network/NetworkFeaturePkg/Include/NetworkFeature.dsc
+!endif
+
+#
+# Out-of-Band Management Advanced Features # !if
+gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable == TRUE
+ !include OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
+!endif
+
+#
+# Power Management Advanced Features
+#
+!if gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable == TRUE
+ !include PowerManagement/S3FeaturePkg/Include/S3Feature.dsc
+!endif
+
+#
+# System Information Advanced Features
+#
+!if gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable == TRUE
+ !include SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc
+!endif
+
+#
+# User Interface Advanced Features
+#
+!if
+gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable ==
+TRUE
+ !include UserInterface/UserAuthFeaturePkg/Include/UserAuthFeature.dsc
+!endif
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 32/49] AdvancedFeaturePkg: Add temporary build workaround
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 32/49] AdvancedFeaturePkg: Add temporary build workaround Kubacki, Michael A
@ 2019-11-15 23:50 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:50 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 32/49] AdvancedFeaturePkg: Add temporary build workaround
This change adds a temporary build workaround to allow the advanced feature PCDs to be used in conditional statements in DSC files even if they are not referenced in INF files.
Support to allow a FeaturePCD to be used in a conditional statement without being referenced in an INF file has been requested in the following Bugzilla item:
https://bugzilla.tianocore.org/show_bug.cgi?id=2270
This change can be reverted when that Bugzilla is completed and the change is submitted to edk2.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 2 +
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc | 74 ++++++++++++++++++++ Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.inf | 57 +++++++++++++++
Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c | 31 ++++++++
4 files changed, 164 insertions(+)
diff --git a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
index 50c0e81048..23e7c6474a 100644
--- a/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
+++ b/Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
@@ -30,6 +30,8 @@
PEI_ARCH = IA32
DXE_ARCH = X64
+!include
+AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.ds
+c
+
################################################################################
#
# Advanced Feature Enable section - all advanced features are enabling for the diff --git a/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc b/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.dsc
new file mode 100644
index 0000000000..227ae00908
--- /dev/null
+++ b/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
+++ ryBuildWorkaround.dsc
@@ -0,0 +1,74 @@
+## @file
+# Build description file for a temporary build workaround.
+#
+# The feature enable PCD for advanced features must be referenced in an
+INF # to be referenced in DSC/FDF files. This DSC only exists in the
+build to # allow the PCDs to be referenced. This workaround does not
+affect the final # flash image or boot in any way.
+#
+# The request to update BaseTools to allow a PCD to be referenced in
+DSC/FDF # files without requiring the PCD to be referenced in an INF
+file is tracked # here:
+https://bugzilla.tianocore.org/show_bug.cgi?id=2270
+#
+# When the BaseTools update is complete, this file can entirely be
+removed # from this package.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+#
+# BEGIN:Temporary Build Workaround (resolution:
+https://bugzilla.tianocore.org/show_bug.cgi?id=2270)
+#
+
+# THIS FILE IS TEMPORARY. PLEASE TRY TO LOOK PAST THE "HACKS" ASSOCIATED WITH IT.
+#
+# With the BaseTools change requested, the changes needed to move to the end state are simply:
+# 1. Remove the !include for this file in AdvancedFeatures.dsc # 2.
+Remove this directory
+
+!if $(PLATFORM_NAME) != AdvancedFeaturePkg # # AdvancedFeaturePkg
+initializes all FeaturePCDs to TRUE so they can conveniently be built in one package.
+# Board packages will normally only enable (and therefore reference) a
+small subset of advanced features # relative to the board. If an INF
+does not reference a package DEC file (which will be the case if the #
+feature is not enabled) then the DSC must set ("define") the PCD for the conditional statements based # on the PCD to work.
+#
+# AdvancedFeaturePkg has no problem as it naturally has a need to set al PCDs to TRUE for build.
+# The section below sets all PCDs to FALSE in the DSC file so if the
+feature is not enabled by a board, # the build will still be successful.
+#
+[PcdsFeatureFlag]
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable |FALSE
+ gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable |FALSE
+ gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable |FALSE
+ gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable |FALSE
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable |FALSE
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable |FALSE
+ gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable |FALSE
+!endif
+
+#
+# The LibraryClasses required to build TemporaryBuildWorkaround.inf #
+(mostly libraries requiring other libraries) # [LibraryClasses]
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+
+BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.in
+f
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
+ PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+
+PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt
+/PeiServicesTablePointerLibIdt.inf
+
+#
+# The driver that references all feature PCDs to satsify current build
+limitations # [Components]
+
+AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.in
+f
+#
+# END:Temporary Build Workaround (resolution:
+https://bugzilla.tianocore.org/show_bug.cgi?id=2270)
+#
diff --git a/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.inf b/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.inf
new file mode 100644
index 0000000000..74176d1989
--- /dev/null
+++ b/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
+++ ryBuildWorkaround.inf
@@ -0,0 +1,57 @@
+### @file
+# Component information file for a temporary build workaround.
+#
+# The feature enable PCD for this package must be referenced in an INF
+to be # referenced in DSC/FDF files. This driver is only included in
+the build to # allow the PCD to be referenced. This driver is not
+included in the flash # image and does not affect the boot in any way.
+#
+# The request to update BaseTools to allow a PCD to be referenced in
+DSC/FDF # files without requiring the PCD to be referenced in an INF
+file is tracked # here:
+https://bugzilla.tianocore.org/show_bug.cgi?id=2270
+#
+# When the BaseTools update is complete, this file can entirely be
+removed # from this package.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ###
+
+[Defines]
+ INF_VERSION = 0x00010017
+ BASE_NAME = TemporaryBuildWorkaround
+ FILE_GUID = 8846A81E-F552-4917-81F5-80B62E4EFBAC
+ VERSION_STRING = 1.0
+ MODULE_TYPE = PEIM
+ ENTRY_POINT = TemporaryBuildWorkaroundEntry
+
+[LibraryClasses]
+ BaseLib
+ PeimEntryPoint
+
+[Packages]
+ MdePkg/MdePkg.dec
+ Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
+ Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec
+ Network/NetworkFeaturePkg/NetworkFeaturePkg.dec
+ OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec
+ PowerManagement/S3FeaturePkg/S3FeaturePkg.dec
+ SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
+ UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.dec
+
+[FeaturePcd]
+ gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable
+ gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable
+ gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable
+ gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable
+ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable
+ gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable
+ gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable
+
+[Sources]
+ TemporaryBuildWorkaround.c
+
+[Depex]
+ TRUE
diff --git a/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c b/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.c
new file mode 100644
index 0000000000..2cd91b06f0
--- /dev/null
+++ b/Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
+++ ryBuildWorkaround.c
@@ -0,0 +1,31 @@
+/** @file
+ Source code file for a temporary build workaround.
+
+ The purpose of this workaround is described in the module INF file.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+#include <Library/BaseLib.h>
+
+/**
+ An empty entry point function.
+
+ @param FileHandle Handle of the file being invoked.
+ @param PeiServices Describes the list of possible PEI Services.
+
+ @retval EFI_SUCCESS This function always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+TemporaryBuildWorkaroundEntry (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+{
+ return EFI_SUCCESS;
+}
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 33/49] AdvancedFeaturePkg: Add FDF include files
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 33/49] AdvancedFeaturePkg: Add FDF include files Kubacki, Michael A
@ 2019-11-15 23:50 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:50 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A
Cc: Chaganty, Rangasai V, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 33/49] AdvancedFeaturePkg: Add FDF include files
Adds FDF files that group all currently available advanced features so they can be conveniently included into board packages.
The Minimum Platform defines two firmware volumes for advanced
features: FvAdvancedPreMemory and FvAdvanced.
This change provides all pre-memory advanced feature modules to be included in FvAdvancedPreMemory via AdvancedFeaturePkg/Include/PreMemory.fdf. All post-memory advanced feature modules to be included in FvAdvanced are available in AdvancedFeaturePkg/Include/PostMemory.fdf.
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf | 57 ++++++++++++++++++++ Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf | 57 ++++++++++++++++++++
2 files changed, 114 insertions(+)
diff --git a/Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf b/Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf
new file mode 100644
index 0000000000..57b29a42b9
--- /dev/null
+++ b/Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf
@@ -0,0 +1,57 @@
+## @file
+# FDF file for post-memory advanced features.
+#
+# This file is intended to be included into another package so
+advanced features # can be conditionally included in the flash image
+by enabling the respective # feature via its FeaturePCD.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+#
+# Debug Advanced Features
+#
+!if gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable ==
+TRUE
+ !include Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf
+!endif
+!if gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable ==
+TRUE
+ !include Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf
+!endif
+
+#
+# Network Advanced Features
+#
+!if gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable == TRUE
+ !include Network/NetworkFeaturePkg/Include/PostMemory.fdf
+!endif
+
+#
+# Out-of-Band Management Advanced Features # !if
+gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable == TRUE
+ !include OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf
+!endif
+
+#
+# Power Management Advanced Features
+#
+!if gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable == TRUE
+ !include PowerManagement/S3FeaturePkg/Include/PostMemory.fdf
+!endif
+
+#
+# System Information Advanced Features
+#
+!if gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable == TRUE
+ !include SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf
+!endif
+
+#
+# User Interface Advanced Features
+#
+!if
+gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable ==
+TRUE
+ !include UserInterface/UserAuthFeaturePkg/Include/PostMemory.fdf
+!endif
diff --git a/Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf b/Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf
new file mode 100644
index 0000000000..20d25dd173
--- /dev/null
+++ b/Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf
@@ -0,0 +1,57 @@
+## @file
+# FDF file for pre-memory advanced features.
+#
+# This file is intended to be included into another package so
+advanced features # can be conditionally included in the flash image
+by enabling the respective # feature via its FeaturePCD.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+#
+# Debug Advanced Features
+#
+!if gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable ==
+TRUE
+ !include Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf
+!endif
+!if gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable ==
+TRUE
+ !include Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf
+!endif
+
+#
+# Network Advanced Features
+#
+!if gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable == TRUE
+ !include Network/NetworkFeaturePkg/Include/PreMemory.fdf
+!endif
+
+#
+# Out-of-Band Management Advanced Features # !if
+gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable == TRUE
+ !include OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf
+!endif
+
+#
+# Power Management Advanced Features
+#
+!if gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable == TRUE
+ !include PowerManagement/S3FeaturePkg/Include/PreMemory.fdf
+!endif
+
+#
+# System Information Advanced Features
+#
+!if gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable == TRUE
+ !include SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf
+!endif
+
+#
+# User Interface Advanced Features
+#
+!if
+gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable ==
+TRUE
+ !include UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf
+!endif
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 34/49] KabylakeOpenBoardPkg/KabylakeRvp3: Add PEI_ARCH and DXE_ARCH
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 34/49] KabylakeOpenBoardPkg/KabylakeRvp3: Add PEI_ARCH and DXE_ARCH Kubacki, Michael A
@ 2019-11-15 23:51 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:51 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Chiu, Chasel
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms][PATCH V1 34/49] KabylakeOpenBoardPkg/KabylakeRvp3: Add PEI_ARCH and DXE_ARCH
This change adds two new macros to OpenBoardPkg.dsc that identify the build architecture for PEI and DXE modules. The intention of this macro is to ensure that all DSC files that compose the package build (such as those included from MinPlatformPkg or an advanced feature package) build phase-specific drivers for the architecture defined by the board package.
This is a macro that is required in all Minimum Platform board packages.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
index 1ce473432a..e4f0fcb1b5 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
@@ -13,6 +13,8 @@
DEFINE PLATFORM_BOARD_PACKAGE = KabylakeOpenBoardPkg
DEFINE BOARD = KabylakeRvp3
DEFINE PROJECT = $(PLATFORM_BOARD_PACKAGE)/$(BOARD)
+ DEFINE PEI_ARCH = IA32
+ DEFINE DXE_ARCH = X64
#
# Include PCD configuration for this board.
@@ -102,10 +104,15 @@
#######################################
# Component Includes
#######################################
+
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CorePeiInclude.dsc
!include $(PLATFORM_SI_PACKAGE)/SiPkgPei.dsc
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CoreDxeInclude.dsc
!include $(PLATFORM_SI_PACKAGE)/SiPkgDxe.dsc
@@ -266,6 +273,11 @@
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.inf
!endif
+#######################################
+# PEI Components
+#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
#######################################
# Edk2 Packages
@@ -373,6 +385,11 @@
!endif
$(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf
+#######################################
+# DXE Components
+#######################################
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
#######################################
# Edk2 Packages
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 35/49] KabylakeOpenBoardPkg/GalagoPro3: Add PEI_ARCH and DXE_ARCH
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 35/49] KabylakeOpenBoardPkg/GalagoPro3: " Kubacki, Michael A
@ 2019-11-15 23:51 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:51 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Chiu, Chasel
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms][PATCH V1 35/49] KabylakeOpenBoardPkg/GalagoPro3: Add PEI_ARCH and DXE_ARCH
This change adds two new macros to OpenBoardPkg.dsc that identify the build architecture for PEI and DXE modules. The intention of this macro is to ensure that all DSC files that compose the package build (such as those included from MinPlatformPkg or an advanced feature package) build phase-specific drivers for the architecture defined by the board package.
This is a macro that is required in all Minimum Platform board packages.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index e43c944201..280de880aa 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -14,6 +14,8 @@
DEFINE PLATFORM_BOARD_PACKAGE = KabylakeOpenBoardPkg
DEFINE BOARD = GalagoPro3
DEFINE PROJECT = $(PLATFORM_BOARD_PACKAGE)/$(BOARD)
+ DEFINE PEI_ARCH = IA32
+ DEFINE DXE_ARCH = X64
#
# Include PCD configuration for this board.
@@ -74,10 +76,14 @@
#######################################
# Component Includes
#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CorePeiInclude.dsc
!include $(PLATFORM_SI_PACKAGE)/SiPkgPei.dsc
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CoreDxeInclude.dsc
!include $(PLATFORM_SI_PACKAGE)/SiPkgDxe.dsc
@@ -228,6 +234,11 @@
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.inf
!endif
+#######################################
+# PEI Components
+#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
#######################################
# Edk2 Packages
@@ -301,6 +312,11 @@
!endif
$(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf
+#######################################
+# DXE Components
+#######################################
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
#######################################
# Edk2 Packages
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 36/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add PEI_ARCH and DXE_ARCH
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 36/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: " Kubacki, Michael A
@ 2019-11-15 23:51 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:51 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Chiu, Chasel
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms][PATCH V1 36/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add PEI_ARCH and DXE_ARCH
This change adds two new macros to OpenBoardPkg.dsc that identify the build architecture for PEI and DXE modules. The intention of this macro is to ensure that all DSC files that compose the package build (such as those included from MinPlatformPkg or an advanced feature package) build phase-specific drivers for the architecture defined by the board package.
This is a macro that is required in all Minimum Platform board packages.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index cdaf47b6f7..44623eb427 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
+++ g.dsc
@@ -15,6 +15,8 @@
DEFINE PLATFORM_BOARD_PACKAGE = WhiskeylakeOpenBoardPkg
DEFINE BOARD = WhiskeylakeURvp
DEFINE PROJECT = $(PLATFORM_BOARD_PACKAGE)/$(BOARD)
+ DEFINE PEI_ARCH = IA32
+ DEFINE DXE_ARCH = X64
#
# Include PCD configuration for this board.
@@ -73,10 +75,14 @@
#######################################
# Component Includes
#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CorePeiInclude.dsc
!include $(PLATFORM_SI_PACKAGE)/SiPkgPei.dsc
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CoreDxeInclude.dsc
!include $(PLATFORM_SI_PACKAGE)/SiPkgDxe.dsc
@@ -255,6 +261,11 @@
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.inf
!endif
+#######################################
+# PEI Components
+#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
#######################################
# Edk2 Packages
@@ -325,6 +336,11 @@
!endif
$(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf
+#######################################
+# DXE Components
+#######################################
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
#######################################
# Edk2 Packages
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH V1 37/49] SimicsOpenBoardPkg/BoardX58Ich10: Use PEI_ARCH and DXE_ARCH
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 37/49] SimicsOpenBoardPkg/BoardX58Ich10: Use " Kubacki, Michael A
@ 2019-11-15 23:51 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:51 UTC (permalink / raw)
To: devel@edk2.groups.io, Kubacki, Michael A; +Cc: Wei, David Y, Agyeman, Prince
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki, Michael A
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Wei, David Y <david.y.wei@intel.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-devel] [edk2-platforms][PATCH V1 37/49] SimicsOpenBoardPkg/BoardX58Ich10: Use PEI_ARCH and DXE_ARCH
This change updates OpenBoardPkg.dsc to use the PEI_ARCH and DXE_ARCH specified in the DSC file for the board package components.
An EDK II build limitation currently prevents the macros from being able to be used, so a todo has been placed with the action needed when the BaseTools update is completed as described in the following Bugzilla item:
https://bugzilla.tianocore.org/show_bug.cgi?id=2308
The intention of this macro is to ensure that all DSC files that compose the package build (such as those included from MinPlatformPkg or an advanced feature package) build phase-specific drivers for the architecture defined by the board package.
This is a macro that is required in all Minimum Platform board packages.
Cc: Wei David Y <david.y.wei@intel.com>
Cc: Agyeman Prince <prince.agyeman@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 761874de73..c6b2beee4d 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -61,10 +61,14 @@
#######################################
# Component Includes
#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CorePeiInclude.dsc
!include $(SKT_PKG)/SktPkgPei.dsc
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
!include $(PLATFORM_PACKAGE)/Include/Dsc/CoreDxeInclude.dsc
@@ -143,6 +147,11 @@
#######################################
SpiFlashCommonLib|$(PCH_PKG)/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.inf
+#######################################
+# PEI Components
+#######################################
+# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.IA32]
#######################################
# Edk2 Packages
@@ -192,6 +201,11 @@
PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
}
+#######################################
+# DXE Components
+#######################################
+# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308
+# is completed
[Components.X64]
#######################################
# Edk2 Packages
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 38/49] MinPlatformPkg: Add FvAdvancedPreMemory
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 38/49] MinPlatformPkg: Add FvAdvancedPreMemory Kubacki, Michael A
@ 2019-11-15 23:51 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-15 23:51 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Chiu, Chasel, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-platforms][PATCH V1 38/49] MinPlatformPkg: Add FvAdvancedPreMemory
This change adds a new firmware volume to MinPlatformPkg called FvAdvancedPreMemory. This firmware volume is used to hold advanced feature modules that must be available in pre-memory.
Previously, these modules were kept as an uncompressed child FV in FvAdvanced. However, in memory constrained environments before permanent memory is initialized, it is preferable to have a dedicated firmware volume that can simply be installed as a standalone firmware volume to reduce the need for creating FV HOBs for other post-memory advanced features if they are not needed and to simplify the FV layout and FV installation process.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec | 3 ++
Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf | 42 ++++++++++----------
Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c | 24 ++++++++---
3 files changed, 44 insertions(+), 25 deletions(-)
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index a851021c0b..28713108ed 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -168,6 +168,9 @@ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset|0x00000000|UINT32|0x2000000
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityBase|0x00000000|UINT32|0x20000010
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize|0x00000000|UINT32|0x20000011
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset|0x00000000|UINT32|0x20000012
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase|0x0000000
+0|UINT32|0x2000002D
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize|0x0000000
+0|UINT32|0x2000002E
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset|0x00000
+000|UINT32|0x2000002F
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedBase|0x00000000|UINT32|0x20000013
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize|0x00000000|UINT32|0x20000014
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedOffset|0x00000000|UINT32|0x20000015
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
index 4d96c9cf31..1ce3034fcc 100644
--- a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/
+++ PeiReportFvLib.inf
@@ -1,7 +1,7 @@
### @file
# Component information file for the Report Firmware Volume (FV) library.
#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights
+reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -30,22 +30,24 @@
PeiReportFvLib.c
[Pcd]
- gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBootMode ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaBaseAddress ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUSize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedBase ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBootMode ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaBaseAddress ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedBase ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize ## CONSUMES
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c
index 6e49b1239d..b61587f6e3 100644
--- a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/
+++ PeiReportFvLib.c
@@ -1,7 +1,7 @@
/** @file
Source code file for Report Firmware Volume (FV) library
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -40,11 +40,16 @@ ReportPreMemFv (
NULL,
0
);
- DEBUG ((DEBUG_INFO, "Install FlashFvAdvanced - 0x%x, 0x%x\n", PcdGet32 (PcdFlashFvAdvancedBase), PcdGet32 (PcdFlashFvAdvancedSize)));
+ DEBUG ((
+ DEBUG_INFO,
+ "Install FlashFvAdvancedPreMemory - 0x%x, 0x%x\n",
+ PcdGet32 (PcdFlashFvAdvancedPreMemoryBase),
+ PcdGet32 (PcdFlashFvAdvancedPreMemorySize)
+ ));
PeiServicesInstallFvInfo2Ppi (
- &(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFlashFvAdvancedBase))->FileSystemGuid),
- (VOID *) (UINTN) PcdGet32 (PcdFlashFvAdvancedBase),
- PcdGet32 (PcdFlashFvAdvancedSize),
+ &(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFlashFvAdvancedPreMemoryBase))->FileSystemGuid),
+ (VOID *) (UINTN) PcdGet32 (PcdFlashFvAdvancedPreMemoryBase),
+ PcdGet32 (PcdFlashFvAdvancedPreMemorySize),
NULL,
NULL,
0
@@ -117,6 +122,15 @@ ReportPostMemFv (
NULL,
0
);
+ DEBUG ((DEBUG_INFO, "Install FlashFvAdvanced - 0x%x, 0x%x\n", PcdGet32 (PcdFlashFvAdvancedBase), PcdGet32 (PcdFlashFvAdvancedSize)));
+ PeiServicesInstallFvInfo2Ppi (
+ &(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFlashFvAdvancedBase))->FileSystemGuid),
+ (VOID *) (UINTN) PcdGet32 (PcdFlashFvAdvancedBase),
+ PcdGet32 (PcdFlashFvAdvancedSize),
+ NULL,
+ NULL,
+ 0
+ );
}
//
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 39/49] KabylakeOpenBoardPkg/KabylakeRvp3: Add FvAdvancedPreMemory
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 39/49] KabylakeOpenBoardPkg/KabylakeRvp3: " Kubacki, Michael A
@ 2019-11-16 0:34 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-16 0:34 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Chiu, Chasel
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms][PATCH V1 39/49] KabylakeOpenBoardPkg/KabylakeRvp3: Add FvAdvancedPreMemory
This change adds a standalone firmware volume for pre-memory advanced features called FvAdvancedPreMemory to the flash map.
Pre-memory advanced feature modules were previously kept in a child firmware volume of FvAdvanced called FvAdvancedPreMem. This change simplifies the flash layout and separation of pre-memory and post-memory modules.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMapInclude.fdf | 30 +++++++------
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf | 46 +++++++-------------
2 files changed, 32 insertions(+), 44 deletions(-)
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMapInclude.fdf b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMapInclude.fdf
index 6cb49c941c..b5e3f66cea 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMapInclude.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/Flash
+++ MapInclude.fdf
@@ -1,5 +1,5 @@
## @file
-# FDF file of Platform.
+# FDF file for the KabylakeRvp3 board.
#
# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR> #
@@ -19,28 +19,30 @@ DEFINE FLASH_NUM_BLOCKS = 0x00000080
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageOffset = 0x00000000 # Flash addr (0xFF800000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageSize = 0x00040000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageVariableOffset = 0x00000000 # Flash addr (0xFF800000)
-SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize = 0x0001E000 #
+SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize = 0x0001E000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingOffset = 0x0001E000 # Flash addr (0xFF81E000)
-SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize = 0x00002000 #
+SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize =
+0x00002000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareOffset = 0x00020000 # Flash addr (0xFF820000)
-SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = 0x00020000 #
+SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = 0x00020000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedOffset = 0x00040000 # Flash addr (0xFF840000)
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00060000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x000A0000 # Flash addr (0xFF8A0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00050000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x00090000 # Flash addr (0xFF890000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize = 0x00070000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00110000 # Flash addr (0xFF910000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00100000 # Flash addr (0xFF900000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize = 0x00090000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x001A0000 # Flash addr (0xFF9A0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x00190000 # Flash addr (0xFF990000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize = 0x001E0000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x00380000 # Flash addr (0xFFB80000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x00370000 # Flash addr (0xFFB70000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize = 0x00180000 #
-SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x00500000 # Flash addr (0xFFD00000)
-SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = 0x000A0000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x005A0000 # Flash addr (0xFFDA0000)
+SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x004F0000 # Flash addr (0xFFCF0000)
+SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = 0x000A0000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00590000 # Flash addr (0xFFD90000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize = 0x00060000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x00600000 # Flash addr (0xFFE00000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x005F0000 # Flash addr (0xFFDF0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize = 0x000BC000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x006BC000 # Flash addr (0xFFEBC000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x006AC000 # Flash addr (0xFFEAC000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize = 0x00014000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset = 0x006C0000 # Flash addr (0xFFEC0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize = 0x00010000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset = 0x006D0000 # Flash addr (0xFFED0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize = 0x00130000 #
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
index 98eb7dcb5a..132015be5d 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
@@ -173,6 +173,10 @@ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTBase|gMinPlatformPkgTokenSpaceGuid.P
# FSP_T Section
FILE = $(PLATFORM_FSP_BIN_PACKAGE)/Fsp_Rebased_T.fd
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset|gMinPla
+tformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase|gMinPlatf
+ormPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+FV = FvAdvancedPreMemory
+
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
FV = FvPreMemory
@@ -611,7 +615,10 @@ FILE FV_IMAGE = C83522D9-80A1-4D95-8C25-3F1370497406 {
}
}
-[FV.FvAdvancedPreMem]
+#
+# Pre-memory Advanced Features
+#
+[FV.FvAdvancedPreMemory]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -634,7 +641,10 @@ FvNameGuid = 6053D78A-457E-4490-A237-31D0FBE2F305
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Pei/PeiTbtInit.inf
!endif
-[FV.FvAdvancedPostMem]
+#
+# Post-Memory Advanced Features
+#
+[FV.FvAdvancedUncompact]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -653,31 +663,15 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = BE3DF86F-E464-44A3-83F7-0D27E6B88C27
-[FV.FvAdvancedLate]
-FvAlignment = 16
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = 11F6E304-43F9-4B2F-90AB-B8FFEAD6205D
-
!if gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Dxe/TbtDxe.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/PciHotPlug/PciHotPlug.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Smm/TbtSmm.inf
!endif
+#
+# Compressed FV with Post-Memory Advanced Features #
[FV.FvAdvanced]
BlockSize = $(FLASH_BLOCK_SIZE)
FvAlignment = 16
@@ -698,17 +692,9 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = B23E7388-9953-45C7-9201-0473DDE5487A
-FILE FV_IMAGE = 35E7406A-5842-4F2B-BC62-19022C12AF74 {
- SECTION FV_IMAGE = FvAdvancedPreMem
- }
-
-FILE FV_IMAGE = F5DCB34F-27EA-48AC-9406-C894F6D587CA {
- SECTION FV_IMAGE = FvAdvancedPostMem
- }
-
FILE FV_IMAGE = 5248467B-B87B-4E74-AC02-398AF4BCB712 {
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FvAdvancedLate
+ SECTION FV_IMAGE = FvAdvancedUncompact
}
}
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 40/49] KabylakeOpenBoardPkg/GalagoPro3: Add FvAdvancedPreMemory
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 40/49] KabylakeOpenBoardPkg/GalagoPro3: " Kubacki, Michael A
@ 2019-11-16 0:34 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-16 0:34 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Chiu, Chasel
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms][PATCH V1 40/49] KabylakeOpenBoardPkg/GalagoPro3: Add FvAdvancedPreMemory
This change adds a standalone firmware volume for pre-memory advanced features called FvAdvancedPreMemory to the flash map.
Pre-memory advanced feature modules were previously kept in a child firmware volume of FvAdvanced called FvAdvancedPreMem. This change simplifies the flash layout and separation of pre-memory and post-memory modules.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapInclude.fdf | 20 +++++----
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf | 46 +++++++-------------
2 files changed, 27 insertions(+), 39 deletions(-)
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapInclude.fdf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapInclude.fdf
index c7f314ffe4..6cb6d54f55 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapInclude.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMa
+++ pInclude.fdf
@@ -27,22 +27,24 @@ SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = 0x00020000
SET gKabylakeOpenBoardPkgTokenSpaceGuid.PcdFlashNvDebugMessageOffset = 0x00040000 # Flash addr (0xFFA60000)
SET gKabylakeOpenBoardPkgTokenSpaceGuid.PcdFlashNvDebugMessageSize = 0x00010000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedOffset = 0x00050000 # Flash addr (0xFFA70000)
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00060000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x000B0000 # Flash addr (0xFFAD0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00050000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x000A0000 # Flash addr (0xFFAC0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize = 0x00070000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00120000 # Flash addr (0xFFB40000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00110000 # Flash addr (0xFFB30000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize = 0x00090000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x001B0000 # Flash addr (0xFFBD0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x001A0000 # Flash addr (0xFFBC0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize = 0x00140000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x002F0000 # Flash addr (0xFFD10000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x002E0000 # Flash addr (0xFFD00000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize = 0x000B0000 #
-SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x003A0000 # Flash addr (0xFFDC0000)
+SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x00390000 # Flash addr (0xFFDB0000)
SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = 0x000A0000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00440000 # Flash addr (0xFFE60000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00430000 # Flash addr (0xFFE50000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize = 0x00060000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x004A0000 # Flash addr (0xFFEC0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x00490000 # Flash addr (0xFFEB0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize = 0x000BA000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x0055A000 # Flash addr (0xFFF7A000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x0054A000 # Flash addr (0xFFF6A000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize = 0x00006000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset = 0x00550000 # Flash addr (0xFFF70000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize = 0x00010000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset = 0x00560000 # Flash addr (0xFFF80000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize = 0x00080000 #
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
index d5ae9dce41..0a9b933e40 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
@@ -177,6 +177,10 @@ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTBase|gMinPlatformPkgTokenSpaceGuid.P
# FSP_T Section
FILE = $(PLATFORM_FSP_BIN_PACKAGE)/Fsp_Rebased_T.fd
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset|gMinPla
+tformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase|gMinPlatf
+ormPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+FV = FvAdvancedPreMemory
+
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
FV = FvPreMemory
@@ -605,7 +609,10 @@ FILE FV_IMAGE = C83522D9-80A1-4D95-8C25-3F1370497406 {
}
}
-[FV.FvAdvancedPreMem]
+#
+# Pre-memory Advanced Features
+#
+[FV.FvAdvancedPreMemory]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -628,7 +635,10 @@ FvNameGuid = 6053D78A-457E-4490-A237-31D0FBE2F305
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Pei/PeiTbtInit.inf
!endif
-[FV.FvAdvancedPostMem]
+#
+# Post-Memory Advanced Features
+#
+[FV.FvAdvancedUncompact]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -647,31 +657,15 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = BE3DF86F-E464-44A3-83F7-0D27E6B88C27
-[FV.FvAdvancedLate]
-FvAlignment = 16
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = 11F6E304-43F9-4B2F-90AB-B8FFEAD6205D
-
!if gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Dxe/TbtDxe.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/PciHotPlug/PciHotPlug.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Smm/TbtSmm.inf
!endif
+#
+# Compressed FV with Post-Memory Advanced Features #
[FV.FvAdvanced]
BlockSize = $(FLASH_BLOCK_SIZE)
FvAlignment = 16
@@ -692,17 +686,9 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = B23E7388-9953-45C7-9201-0473DDE5487A
-FILE FV_IMAGE = 35E7406A-5842-4F2B-BC62-19022C12AF74 {
- SECTION FV_IMAGE = FvAdvancedPreMem
- }
-
-FILE FV_IMAGE = F5DCB34F-27EA-48AC-9406-C894F6D587CA {
- SECTION FV_IMAGE = FvAdvancedPostMem
- }
-
FILE FV_IMAGE = 5248467B-B87B-4E74-AC02-398AF4BCB712 {
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FvAdvancedLate
+ SECTION FV_IMAGE = FvAdvancedUncompact
}
}
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 41/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add FvAdvancedPreMemory
[not found] ` <20191113032816.4056-42-michael.a.kubacki@intel.com>
@ 2019-11-16 0:34 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-16 0:34 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Chiu, Chasel
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms][PATCH V1 41/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add FvAdvancedPreMemory
This change adds a standalone firmware volume for pre-memory advanced features called FvAdvancedPreMemory to the flash map.
Pre-memory advanced feature modules were previously kept in a child firmware volume of FvAdvanced called FvAdvancedPreMem. This change simplifies the flash layout and separation of pre-memory and post-memory modules.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf | 24 +++++-----
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf | 46 +++++++-------------
2 files changed, 28 insertions(+), 42 deletions(-)
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf
index 9209b9e88a..e0db381942 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf
+++ /FlashMapInclude.fdf
@@ -1,12 +1,10 @@
## @file
-# FDF file of Platform.
-#
+# FDF file for the WhiskeylakeURvp board.
#
# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # -# ##
#=================================================================================#
@@ -27,23 +25,25 @@ SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize = 0x00002000
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareOffset = 0x00020000 # Flash addr (0xFF820000)
SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = 0x00020000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedOffset = 0x00040000 # Flash addr (0xFF840000)
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00060000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x000A0000 # Flash addr (0xFF8A0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00050000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x00090000 # Flash addr (0xFF890000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize = 0x00070000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00110000 # Flash addr (0xFF910000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00100000 # Flash addr (0xFF900000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize = 0x00090000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x001A0000 # Flash addr (0xFF9A0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x00190000 # Flash addr (0xFF990000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize = 0x00190000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x00330000 # Flash addr (0xFFB30000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x00320000 # Flash addr (0xFFB20000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize = 0x00170000 #
-SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x004A0000 # Flash addr (0xFFCA0000)
+SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x00490000 # Flash addr (0xFFC90000)
SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = 0x000B0000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00550000 # Flash addr (0xFFD50000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00540000 # Flash addr (0xFFD40000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize = 0x00070000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x005C0000 # Flash addr (0xFFDC0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x005B0000 # Flash addr (0xFFDB0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize = 0x000EC000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x006AC000 # Flash addr (0xFFEAC000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x0069C000 # Flash addr (0xFFE9C000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize = 0x00014000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset = 0x006B0000 # Flash addr (0xFFEB0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize = 0x00010000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset = 0x006C0000 # Flash addr (0xFFEC0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize = 0x00140000 #
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
index 8a4fd973b4..130930ad40 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
+++ g.fdf
@@ -175,6 +175,10 @@ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTBase|gMinPlatformPkgTokenSpaceGuid.P
# FSP_T Section
FILE = $(PLATFORM_FSP_BIN_PACKAGE)/Fsp_Rebased_T.fd
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset|gMinPla
+tformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase|gMinPlatf
+ormPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+FV = FvAdvancedPreMemory
+
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
FV = FvPreMemory
@@ -597,7 +601,10 @@ FILE FV_IMAGE = C83522D9-80A1-4D95-8C25-3F1370497406 {
}
}
-[FV.FvAdvancedPreMem]
+#
+# Pre-memory Advanced Features
+#
+[FV.FvAdvancedPreMemory]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -620,7 +627,10 @@ FvNameGuid = 6053D78A-457E-4490-A237-31D0FBE2F305
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Pei/PeiTbtInit.inf
!endif
-[FV.FvAdvancedPostMem]
+#
+# Post-Memory Advanced Features
+#
+[FV.FvAdvancedUncompact]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -639,31 +649,15 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = BE3DF86F-E464-44A3-83F7-0D27E6B88C27
-[FV.FvAdvancedLate]
-FvAlignment = 16
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = 11F6E304-43F9-4B2F-90AB-B8FFEAD6205D
-
!if gWhiskeylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Dxe/TbtDxe.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/PciHotPlug/PciHotPlug.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Smm/TbtSmm.inf
!endif
+#
+# Compressed FV with Post-Memory Advanced Features #
[FV.FvAdvanced]
BlockSize = $(FLASH_BLOCK_SIZE)
FvAlignment = 16
@@ -684,17 +678,9 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = B23E7388-9953-45C7-9201-0473DDE5487A
-FILE FV_IMAGE = 35E7406A-5842-4F2B-BC62-19022C12AF74 {
- SECTION FV_IMAGE = FvAdvancedPreMem
- }
-
-FILE FV_IMAGE = F5DCB34F-27EA-48AC-9406-C894F6D587CA {
- SECTION FV_IMAGE = FvAdvancedPostMem
- }
-
FILE FV_IMAGE = 5248467B-B87B-4E74-AC02-398AF4BCB712 {
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FvAdvancedLate
+ SECTION FV_IMAGE = FvAdvancedUncompact
}
}
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 42/49] Platform/Intel: Add advanced feature build support
[not found] ` <20191113032816.4056-43-michael.a.kubacki@intel.com>
@ 2019-11-16 0:34 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-16 0:34 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io
Cc: Chiu, Chasel, Gao, Liming, Agyeman, Prince
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Gao, Liming <liming.gao@intel.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-platforms][PATCH V1 42/49] Platform/Intel: Add advanced feature build support
This change adds the ability for board packages built with build_bios.py to build advanced features located in Features/Intel.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Agyeman Prince <prince.agyeman@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/build.cfg | 1 +
Platform/Intel/build_bios.py | 3 +++
2 files changed, 4 insertions(+)
diff --git a/Platform/Intel/build.cfg b/Platform/Intel/build.cfg index e42db243f6..86a9115021 100644
--- a/Platform/Intel/build.cfg
+++ b/Platform/Intel/build.cfg
@@ -12,6 +12,7 @@ WORKSPACE_FSP_BIN = FSP EDK_TOOLS_BIN = edk2-BaseTools-win32 EDK_BASETOOLS = BaseTools WORKSPACE_DRIVERS = edk2-platforms/Drivers
+WORKSPACE_FEATURES = edk2-platforms/Features/Intel
WORKSPACE_PLATFORM = edk2-platforms/Platform/Intel WORKSPACE_SILICON = edk2-platforms/Silicon/Intel WORKSPACE_PLATFORM_BIN = diff --git a/Platform/Intel/build_bios.py b/Platform/Intel/build_bios.py index ea098de705..1ef35aca0a 100644
--- a/Platform/Intel/build_bios.py
+++ b/Platform/Intel/build_bios.py
@@ -104,6 +104,8 @@ def pre_build(build_config, build_type="DEBUG", silent=False, toolchain=None):
config["WORKSPACE_PLATFORM"])
config["WORKSPACE_SILICON"] = os.path.join(config["WORKSPACE"],
config["WORKSPACE_SILICON"])
+ config["WORKSPACE_FEATURES"] = os.path.join(config["WORKSPACE"],
+
+ config["WORKSPACE_FEATURES"])
config["WORKSPACE_DRIVERS"] = os.path.join(config["WORKSPACE"],
config["WORKSPACE_DRIVERS"])
config["WORKSPACE_PLATFORM_BIN"] = \ @@ -117,6 +119,7 @@ def pre_build(build_config, build_type="DEBUG", silent=False, toolchain=None):
config["PACKAGES_PATH"] = config["WORKSPACE_PLATFORM"]
config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_SILICON"]
config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_SILICON_BIN"]
+ config["PACKAGES_PATH"] += os.pathsep +
+ config["WORKSPACE_FEATURES"]
config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_DRIVERS"]
config["PACKAGES_PATH"] += os.pathsep + \
os.path.join(config["WORKSPACE"], "FSP")
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 43/49] Platform/Intel/Readme.md Content update
[not found] ` <20191113032816.4056-44-michael.a.kubacki@intel.com>
@ 2019-11-16 0:34 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-16 0:34 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io
Cc: Bi, Dandan, Chaganty, Rangasai V, Dong, Eric, Gao, Liming
Readme.md, line 269: Please also add a Linux/Mac example.
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Bi, Dandan <dandan.bi@intel.com>; Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Dong, Eric <eric.dong@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-platforms][PATCH V1 43/49] Platform/Intel/Readme.md Content update
Updates the advanced feature location referenced in Readme.md to edk2-platforms/Features/Intel.
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/Readme.md | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/Platform/Intel/Readme.md b/Platform/Intel/Readme.md index 0f86978fee..02d9517d19 100644
--- a/Platform/Intel/Readme.md
+++ b/Platform/Intel/Readme.md
@@ -89,8 +89,7 @@ A UEFI firmware implementation using MinPlatformPkg is constructed using the fol The board package follows the standard EDK II package structure with the following additional elements and guidelines:
* Only code usable across more than one board at the root level.
* Board-specific code in a directory. The directory name should match that of the board supported.
-* Features not essential to achieve stage 5 or earlier boots are maintained in a Features folder at the appropriate
- level in the package hierarchy.
+* Features not essential to achieve stage 5 or earlier boots are maintained in edk2-platforms/Features/Intel.
Shared resources in the package root directory can include interfaces described in header files, library instances, firmware modules, binaries, etc. The UEFI firmware implementation is built using the process described below from the @@ -260,16 +259,17 @@ return back to the minimum platform caller.
### **Package Builds**
-In some cases, such as AdvancedFeaturePkg, a package may provide a set of functionality that is included in other
+In some cases, such as BoardModulePkg, a package may provide a set of
+functionality that is included in other
packages. To test the build of the whole package, the "build" command should be used following the instructions below.
1. Execute edksetup.bat (Windows) or edksetup.sh (Linux).
2. Verify the "WORKSPACE" environment variable is set to the edk2 directory in your workspace.
-3. Set the "PACKAGES_PATH" environment variable to include the edk2-platforms/Platform/Intel and edk2-platforms/Silicon/Intel
- directories.
- * Windows example: set PACKAGES_PATH=c:\Edk2Workspace\edk2-platforms\Platform\Intel;c:\Edk2Workspace\edk2-platforms\Silicon\Intel
+3. Set the "PACKAGES_PATH" environment variable to include the edk2-platforms/Platform/Intel, edk2-platforms/Silicon/Intel,
+ and edk2-platforms/Features/Intel directories.
+ * Windows example: set PACKAGES_PATH=c:\Edk2Workspace\edk2-platforms\Platform\Intel;
+
+c:\Edk2Workspace\edk2-platforms\Silicon\Intel;c:\Edk2Workspace\edk2-pla
+tforms\Features\Intel
4. Build the package by specifying the package DSC as the platform build target from the Platform/Intel or Silicon/Intel directory:
- "build -p AdvancedFeaturePkg/AdvancedFeaturePkg.dsc"
+ "build -p BoardModulePkg/BoardModulePkg.dsc -a IA32 -a X64"
### **Firmware Image Flashing**
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 44/49] KabylakeOpenBoardPkg/GalagoPro3: Enable advanced features
[not found] ` <20191113032816.4056-45-michael.a.kubacki@intel.com>
@ 2019-11-16 0:34 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-16 0:34 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Chiu, Chasel
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms][PATCH V1 44/49] KabylakeOpenBoardPkg/GalagoPro3: Enable advanced features
This change enables advanced features to be used by the
GalagoPro3 board in KabylakeOpenBoardPkg.
Some platform macros in OpenBoardPkg.dsc are consolidated so all values are set at the top of the file before including advanced feature code.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc | 46 +++++++++-----------
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkgPcd.dsc | 1 +
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf | 4 ++
3 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index 280de880aa..30e8e179b7 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -16,38 +16,32 @@
DEFINE PROJECT = $(PLATFORM_BOARD_PACKAGE)/$(BOARD)
DEFINE PEI_ARCH = IA32
DEFINE DXE_ARCH = X64
-
- #
- # Include PCD configuration for this board.
- #
- !include OpenBoardPkgPcd.dsc
-
-################################################################################
-#
-# Defines Section - statements that will be processed to create a Makefile.
-#
-################################################################################
-[Defines]
- PLATFORM_NAME = $(PLATFORM_PACKAGE)
- PLATFORM_GUID = 7324F33D-4E96-4F8B-A550-544DE6162AB7
- PLATFORM_VERSION = 0.1
- DSC_SPECIFICATION = 0x00010005
- OUTPUT_DIRECTORY = Build/$(PROJECT)
- SUPPORTED_ARCHITECTURES = IA32|X64
- BUILD_TARGETS = DEBUG|RELEASE
- SKUID_IDENTIFIER = ALL
-
-
- FLASH_DEFINITION = $(PROJECT)/OpenBoardPkg.fdf
-
- FIX_LOAD_TOP_MEMORY_ADDRESS = 0x0
- DEFINE TOP_MEMORY_ADDRESS = 0x0
+ DEFINE TOP_MEMORY_ADDRESS = 0x0
#
# Default value for OpenBoardPkg.fdf use
#
DEFINE BIOS_SIZE_OPTION = SIZE_60
+ PLATFORM_NAME = $(PLATFORM_PACKAGE)
+ PLATFORM_GUID = 7324F33D-4E96-4F8B-A550-544DE6162AB7
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PROJECT)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE
+ SKUID_IDENTIFIER = ALL
+
+ FLASH_DEFINITION = $(PROJECT)/OpenBoardPkg.fdf
+ FIX_LOAD_TOP_MEMORY_ADDRESS = 0x0
+
+ #
+ # Include PCD configuration for this board.
+ #
+ !include
+ AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.d
+ sc
+ !include OpenBoardPkgPcd.dsc
+ !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
+
################################################################################
#
# SKU Identification section - list of all SKU IDs supported by this board.
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkgPcd.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkgPcd.dsc
index c6f5ae7534..7393897249 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkgPcd.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkgPcd.dsc
@@ -24,6 +24,7 @@
# Stage 3 - boot to shell only
# Stage 4 - boot to OS
# Stage 5 - boot to OS with security boot enabled
+ # Stage 6 - boot with advanced features enabled
#
gMinPlatformPkgTokenSpaceGuid.PcdBootStage|4
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
index 0a9b933e40..da94ed0cd1 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
@@ -631,6 +631,8 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = 6053D78A-457E-4490-A237-31D0FBE2F305
+!include AdvancedFeaturePkg/Include/PreMemory.fdf
+
!if gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Pei/PeiTbtInit.inf
!endif
@@ -657,6 +659,8 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = BE3DF86F-E464-44A3-83F7-0D27E6B88C27
+!include AdvancedFeaturePkg/Include/PostMemory.fdf
+
!if gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Dxe/TbtDxe.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/PciHotPlug/PciHotPlug.inf
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 45/49] KabylakeOpenBoardPkg/KabylakeRvp3: Enable advanced features
[not found] ` <20191113032816.4056-46-michael.a.kubacki@intel.com>
@ 2019-11-16 0:34 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-16 0:34 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Chiu, Chasel
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms][PATCH V1 45/49] KabylakeOpenBoardPkg/KabylakeRvp3: Enable advanced features
This change enables advanced features to be used by the
KabylakeRvp3 board in KabylakeOpenBoardPkg.
Some platform macros in OpenBoardPkg.dsc are consolidated so all values are set at the top of the file before including advanced feature code.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc | 44 +++++++++-----------
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc | 1 +
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf | 4 ++
3 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
index e4f0fcb1b5..4b24f6b8c9 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
@@ -15,11 +15,31 @@
DEFINE PROJECT = $(PLATFORM_BOARD_PACKAGE)/$(BOARD)
DEFINE PEI_ARCH = IA32
DEFINE DXE_ARCH = X64
+ DEFINE TOP_MEMORY_ADDRESS = 0x0
+
+ #
+ # Default value for OpenBoardPkg.fdf use # DEFINE BIOS_SIZE_OPTION
+ = SIZE_70
+
+ PLATFORM_NAME = $(PLATFORM_PACKAGE)
+ PLATFORM_GUID = 8470676C-18E8-467F-B126-28DB1941AA5A
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PROJECT)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE
+ SKUID_IDENTIFIER = ALL
+ FLASH_DEFINITION = $(PROJECT)/OpenBoardPkg.fdf
+
+ FIX_LOAD_TOP_MEMORY_ADDRESS = 0x0
#
# Include PCD configuration for this board.
#
+ !include
+ AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.d
+ sc
!include OpenBoardPkgPcd.dsc
+ !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
[Defines]
!if gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection == 1 @@ -51,30 +71,6 @@ !endif !endif
-################################################################################
-#
-# Defines Section - statements that will be processed to create a Makefile.
-#
-################################################################################
-[Defines]
- PLATFORM_NAME = $(PLATFORM_PACKAGE)
- PLATFORM_GUID = 8470676C-18E8-467F-B126-28DB1941AA5A
- PLATFORM_VERSION = 0.1
- DSC_SPECIFICATION = 0x00010005
- OUTPUT_DIRECTORY = Build/$(PROJECT)
- SUPPORTED_ARCHITECTURES = IA32|X64
- BUILD_TARGETS = DEBUG|RELEASE
- SKUID_IDENTIFIER = ALL
- FLASH_DEFINITION = $(PROJECT)/OpenBoardPkg.fdf
-
- FIX_LOAD_TOP_MEMORY_ADDRESS = 0x0
- DEFINE TOP_MEMORY_ADDRESS = 0x0
-
- #
- # Default value for OpenBoardPkg.fdf use
- #
- DEFINE BIOS_SIZE_OPTION = SIZE_70
-
################################################################################
#
# SKU Identification section - list of all SKU IDs supported by this board.
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc
index 580504cbc1..eea0a0b1b2 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.d
+++ sc
@@ -24,6 +24,7 @@
# Stage 3 - boot to shell only
# Stage 4 - boot to OS
# Stage 5 - boot to OS with security boot enabled
+ # Stage 6 - boot with advanced features enabled
#
gMinPlatformPkgTokenSpaceGuid.PcdBootStage|4
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
index 132015be5d..03bc559100 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
@@ -637,6 +637,8 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = 6053D78A-457E-4490-A237-31D0FBE2F305
+!include AdvancedFeaturePkg/Include/PreMemory.fdf
+
!if gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Pei/PeiTbtInit.inf
!endif
@@ -663,6 +665,8 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = BE3DF86F-E464-44A3-83F7-0D27E6B88C27
+!include AdvancedFeaturePkg/Include/PostMemory.fdf
+
!if gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Dxe/TbtDxe.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/PciHotPlug/PciHotPlug.inf
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 46/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Enable advanced features
[not found] ` <20191113032816.4056-47-michael.a.kubacki@intel.com>
@ 2019-11-16 0:34 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-16 0:34 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Chiu, Chasel
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms][PATCH V1 46/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Enable advanced features
This change enables advanced features to be used by the WhiskeylakeURvp board in WhiskeylakeOpenBoardPkg.
Some platform macros in OpenBoardPkg.dsc are consolidated so all values are set at the top of the file before including advanced feature code.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc | 44 +++++++++-----------
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkgPcd.dsc | 1 +
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf | 4 ++
3 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index 44623eb427..46686d6689 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
+++ g.dsc
@@ -17,36 +17,32 @@
DEFINE PROJECT = $(PLATFORM_BOARD_PACKAGE)/$(BOARD)
DEFINE PEI_ARCH = IA32
DEFINE DXE_ARCH = X64
-
- #
- # Include PCD configuration for this board.
- #
- !include OpenBoardPkgPcd.dsc
-
-################################################################################
-#
-# Defines Section - statements that will be processed to create a Makefile.
-#
-################################################################################
-[Defines]
- PLATFORM_NAME = $(PLATFORM_PACKAGE)
- PLATFORM_GUID = 84D0F5BD-0EF3-4CC0-9B09-F2D0F2AA5C5E
- PLATFORM_VERSION = 0.1
- DSC_SPECIFICATION = 0x00010005
- OUTPUT_DIRECTORY = Build/$(PROJECT)
- SUPPORTED_ARCHITECTURES = IA32|X64
- BUILD_TARGETS = DEBUG|RELEASE
- SKUID_IDENTIFIER = ALL
- FLASH_DEFINITION = $(PROJECT)/OpenBoardPkg.fdf
-
- FIX_LOAD_TOP_MEMORY_ADDRESS = 0x0
- DEFINE TOP_MEMORY_ADDRESS = 0x0
+ DEFINE TOP_MEMORY_ADDRESS = 0x0
#
# Default value for OpenBoardPkg.fdf use
#
DEFINE BIOS_SIZE_OPTION = SIZE_70
+ PLATFORM_NAME = $(PLATFORM_PACKAGE)
+ PLATFORM_GUID = 84D0F5BD-0EF3-4CC0-9B09-F2D0F2AA5C5E
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PROJECT)
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE
+ SKUID_IDENTIFIER = ALL
+
+ FLASH_DEFINITION = $(PROJECT)/OpenBoardPkg.fdf
+ FIX_LOAD_TOP_MEMORY_ADDRESS = 0x0
+
+ #
+ # Include PCD configuration for this board.
+ #
+ !include
+ AdvancedFeaturePkg/TemporaryBuildWorkaround/TemporaryBuildWorkaround.d
+ sc
+ !include OpenBoardPkgPcd.dsc
+ !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
+
################################################################################
#
# SKU Identification section - list of all SKU IDs supported by this board.
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkgPcd.dsc b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkgPcd.dsc
index 52471cb25b..906f7b7ade 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkgPcd.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
+++ gPcd.dsc
@@ -24,6 +24,7 @@
# Stage 3 - boot to shell only
# Stage 4 - boot to OS
# Stage 5 - boot to OS with security boot enabled
+ # Stage 6 - boot with advanced features enabled
#
gMinPlatformPkgTokenSpaceGuid.PcdBootStage|4
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
index 130930ad40..f39b41b186 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
+++ g.fdf
@@ -623,6 +623,8 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = 6053D78A-457E-4490-A237-31D0FBE2F305
+!include AdvancedFeaturePkg/Include/PreMemory.fdf
+
!if gWhiskeylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Pei/PeiTbtInit.inf
!endif
@@ -649,6 +651,8 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = BE3DF86F-E464-44A3-83F7-0D27E6B88C27
+!include AdvancedFeaturePkg/Include/PostMemory.fdf
+
!if gWhiskeylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Dxe/TbtDxe.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/PciHotPlug/PciHotPlug.inf
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 48/49] MinPlatformPkg: Install advanced feature FVs by stage enabled
[not found] ` <20191113032816.4056-49-michael.a.kubacki@intel.com>
@ 2019-11-16 0:34 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-16 0:34 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Chiu, Chasel, Gao, Liming
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 7:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-platforms][PATCH V1 48/49] MinPlatformPkg: Install advanced feature FVs by stage enabled
This change updates the FvReportLib instance in MinPlatformPkg to only install advanced feature firmware volumes if the advanced feature stage should be active.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec | 1 +
Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf | 1 +
Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c | 50 +++++++++++---------
3 files changed, 29 insertions(+), 23 deletions(-)
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index 28713108ed..cbbe3b2005 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -272,6 +272,7 @@ gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicEnable|0x0|UINT32|0x90000019
# Stage 3 - boot to shell only
# Stage 4 - boot to OS
# Stage 5 - boot to OS with security boot enabled
+ # Stage 6 - boot with advanced features enabled
#
gMinPlatformPkgTokenSpaceGuid.PcdBootStage|4|UINT8|0xF00000A0
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
index 1ce3034fcc..ef03e110bd 100644
--- a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/
+++ PeiReportFvLib.inf
@@ -30,6 +30,7 @@
PeiReportFvLib.c
[Pcd]
+ gMinPlatformPkgTokenSpaceGuid.PcdBootStage ## CONSUMES
gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBootMode ## CONSUMES
gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaBaseAddress ## CONSUMES
gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize ## CONSUMES
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c
index b61587f6e3..0d805d6fe7 100644
--- a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.c
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/
+++ PeiReportFvLib.c
@@ -40,20 +40,22 @@ ReportPreMemFv (
NULL,
0
);
- DEBUG ((
- DEBUG_INFO,
- "Install FlashFvAdvancedPreMemory - 0x%x, 0x%x\n",
- PcdGet32 (PcdFlashFvAdvancedPreMemoryBase),
- PcdGet32 (PcdFlashFvAdvancedPreMemorySize)
- ));
- PeiServicesInstallFvInfo2Ppi (
- &(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFlashFvAdvancedPreMemoryBase))->FileSystemGuid),
- (VOID *) (UINTN) PcdGet32 (PcdFlashFvAdvancedPreMemoryBase),
- PcdGet32 (PcdFlashFvAdvancedPreMemorySize),
- NULL,
- NULL,
- 0
- );
+ if (PcdGet8 (PcdBootStage) >= 6) {
+ DEBUG ((
+ DEBUG_INFO,
+ "Install FlashFvAdvancedPreMemory - 0x%x, 0x%x\n",
+ PcdGet32 (PcdFlashFvAdvancedPreMemoryBase),
+ PcdGet32 (PcdFlashFvAdvancedPreMemorySize)
+ ));
+ PeiServicesInstallFvInfo2Ppi (
+ &(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFlashFvAdvancedPreMemoryBase))->FileSystemGuid),
+ (VOID *) (UINTN) PcdGet32 (PcdFlashFvAdvancedPreMemoryBase),
+ PcdGet32 (PcdFlashFvAdvancedPreMemorySize),
+ NULL,
+ NULL,
+ 0
+ );
+ }
}
VOID
@@ -122,15 +124,17 @@ ReportPostMemFv (
NULL,
0
);
- DEBUG ((DEBUG_INFO, "Install FlashFvAdvanced - 0x%x, 0x%x\n", PcdGet32 (PcdFlashFvAdvancedBase), PcdGet32 (PcdFlashFvAdvancedSize)));
- PeiServicesInstallFvInfo2Ppi (
- &(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFlashFvAdvancedBase))->FileSystemGuid),
- (VOID *) (UINTN) PcdGet32 (PcdFlashFvAdvancedBase),
- PcdGet32 (PcdFlashFvAdvancedSize),
- NULL,
- NULL,
- 0
- );
+ if (PcdGet8 (PcdBootStage) >= 6) {
+ DEBUG ((DEBUG_INFO, "Install FlashFvAdvanced - 0x%x, 0x%x\n", PcdGet32 (PcdFlashFvAdvancedBase), PcdGet32 (PcdFlashFvAdvancedSize)));
+ PeiServicesInstallFvInfo2Ppi (
+ &(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFlashFvAdvancedBase))->FileSystemGuid),
+ (VOID *) (UINTN) PcdGet32 (PcdFlashFvAdvancedBase),
+ PcdGet32 (PcdFlashFvAdvancedSize),
+ NULL,
+ NULL,
+ 0
+ );
+ }
}
//
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 41/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add FvAdvancedPreMemory
[not found] ` <20191113040657.38540-2-michael.a.kubacki@intel.com>
@ 2019-11-16 0:35 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-16 0:35 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Chiu, Chasel
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 8:07 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms][PATCH V1 41/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add FvAdvancedPreMemory
This change adds a standalone firmware volume for pre-memory advanced features called FvAdvancedPreMemory to the flash map.
Pre-memory advanced feature modules were previously kept in a child firmware volume of FvAdvanced called FvAdvancedPreMem. This change simplifies the flash layout and separation of pre-memory and post-memory modules.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf | 24 +++++-----
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf | 46 +++++++-------------
2 files changed, 28 insertions(+), 42 deletions(-)
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf
index 9209b9e88a..e0db381942 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf
+++ /FlashMapInclude.fdf
@@ -1,12 +1,10 @@
## @file
-# FDF file of Platform.
-#
+# FDF file for the WhiskeylakeURvp board.
#
# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # -# ##
#=================================================================================#
@@ -27,23 +25,25 @@ SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize = 0x00002000
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareOffset = 0x00020000 # Flash addr (0xFF820000)
SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = 0x00020000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedOffset = 0x00040000 # Flash addr (0xFF840000)
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00060000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x000A0000 # Flash addr (0xFF8A0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00050000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x00090000 # Flash addr (0xFF890000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize = 0x00070000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00110000 # Flash addr (0xFF910000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00100000 # Flash addr (0xFF900000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize = 0x00090000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x001A0000 # Flash addr (0xFF9A0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x00190000 # Flash addr (0xFF990000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize = 0x00190000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x00330000 # Flash addr (0xFFB30000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x00320000 # Flash addr (0xFFB20000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize = 0x00170000 #
-SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x004A0000 # Flash addr (0xFFCA0000)
+SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x00490000 # Flash addr (0xFFC90000)
SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = 0x000B0000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00550000 # Flash addr (0xFFD50000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00540000 # Flash addr (0xFFD40000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize = 0x00070000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x005C0000 # Flash addr (0xFFDC0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x005B0000 # Flash addr (0xFFDB0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize = 0x000EC000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x006AC000 # Flash addr (0xFFEAC000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x0069C000 # Flash addr (0xFFE9C000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize = 0x00014000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset = 0x006B0000 # Flash addr (0xFFEB0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize = 0x00010000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset = 0x006C0000 # Flash addr (0xFFEC0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize = 0x00140000 #
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
index 8a4fd973b4..130930ad40 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
+++ g.fdf
@@ -175,6 +175,10 @@ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTBase|gMinPlatformPkgTokenSpaceGuid.P
# FSP_T Section
FILE = $(PLATFORM_FSP_BIN_PACKAGE)/Fsp_Rebased_T.fd
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset|gMinPla
+tformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase|gMinPlatf
+ormPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+FV = FvAdvancedPreMemory
+
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
FV = FvPreMemory
@@ -597,7 +601,10 @@ FILE FV_IMAGE = C83522D9-80A1-4D95-8C25-3F1370497406 {
}
}
-[FV.FvAdvancedPreMem]
+#
+# Pre-memory Advanced Features
+#
+[FV.FvAdvancedPreMemory]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -620,7 +627,10 @@ FvNameGuid = 6053D78A-457E-4490-A237-31D0FBE2F305
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Pei/PeiTbtInit.inf
!endif
-[FV.FvAdvancedPostMem]
+#
+# Post-Memory Advanced Features
+#
+[FV.FvAdvancedUncompact]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -639,31 +649,15 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = BE3DF86F-E464-44A3-83F7-0D27E6B88C27
-[FV.FvAdvancedLate]
-FvAlignment = 16
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = 11F6E304-43F9-4B2F-90AB-B8FFEAD6205D
-
!if gWhiskeylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Dxe/TbtDxe.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/PciHotPlug/PciHotPlug.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Smm/TbtSmm.inf
!endif
+#
+# Compressed FV with Post-Memory Advanced Features #
[FV.FvAdvanced]
BlockSize = $(FLASH_BLOCK_SIZE)
FvAlignment = 16
@@ -684,17 +678,9 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = B23E7388-9953-45C7-9201-0473DDE5487A
-FILE FV_IMAGE = 35E7406A-5842-4F2B-BC62-19022C12AF74 {
- SECTION FV_IMAGE = FvAdvancedPreMem
- }
-
-FILE FV_IMAGE = F5DCB34F-27EA-48AC-9406-C894F6D587CA {
- SECTION FV_IMAGE = FvAdvancedPostMem
- }
-
FILE FV_IMAGE = 5248467B-B87B-4E74-AC02-398AF4BCB712 {
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FvAdvancedLate
+ SECTION FV_IMAGE = FvAdvancedUncompact
}
}
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 41/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add FvAdvancedPreMemory
2019-11-13 4:37 ` [edk2-platforms][PATCH V1 41/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add FvAdvancedPreMemory Kubacki, Michael A
@ 2019-11-16 0:35 ` Nate DeSimone
0 siblings, 0 replies; 92+ messages in thread
From: Nate DeSimone @ 2019-11-16 0:35 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io; +Cc: Chiu, Chasel
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
-----Original Message-----
From: Kubacki, Michael A <michael.a.kubacki@intel.com>
Sent: Tuesday, November 12, 2019 8:38 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms][PATCH V1 41/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add FvAdvancedPreMemory
This change adds a standalone firmware volume for pre-memory advanced features called FvAdvancedPreMemory to the flash map.
Pre-memory advanced feature modules were previously kept in a child firmware volume of FvAdvanced called FvAdvancedPreMem. This change simplifies the flash layout and separation of pre-memory and post-memory modules.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf | 24 +++++-----
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf | 46 +++++++-------------
2 files changed, 28 insertions(+), 42 deletions(-)
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf
index 9209b9e88a..e0db381942 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/FlashMapInclude.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf
+++ /FlashMapInclude.fdf
@@ -1,12 +1,10 @@
## @file
-# FDF file of Platform.
-#
+# FDF file for the WhiskeylakeURvp board.
#
# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # -# ##
#=================================================================================#
@@ -27,23 +25,25 @@ SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize = 0x00002000
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareOffset = 0x00020000 # Flash addr (0xFF820000)
SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = 0x00020000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedOffset = 0x00040000 # Flash addr (0xFF840000)
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00060000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x000A0000 # Flash addr (0xFF8A0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize = 0x00050000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityOffset = 0x00090000 # Flash addr (0xFF890000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize = 0x00070000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00110000 # Flash addr (0xFF910000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootOffset = 0x00100000 # Flash addr (0xFF900000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize = 0x00090000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x001A0000 # Flash addr (0xFF9A0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x00190000 # Flash addr (0xFF990000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize = 0x00190000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x00330000 # Flash addr (0xFFB30000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x00320000 # Flash addr (0xFFB20000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize = 0x00170000 #
-SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x004A0000 # Flash addr (0xFFCA0000)
+SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x00490000 # Flash addr (0xFFC90000)
SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = 0x000B0000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00550000 # Flash addr (0xFFD50000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00540000 # Flash addr (0xFFD40000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize = 0x00070000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x005C0000 # Flash addr (0xFFDC0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x005B0000 # Flash addr (0xFFDB0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize = 0x000EC000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x006AC000 # Flash addr (0xFFEAC000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x0069C000 # Flash addr (0xFFE9C000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize = 0x00014000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset = 0x006B0000 # Flash addr (0xFFEB0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize = 0x00010000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset = 0x006C0000 # Flash addr (0xFFEC0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize = 0x00140000 #
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
index 8a4fd973b4..130930ad40 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
+++ g.fdf
@@ -175,6 +175,10 @@ gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTBase|gMinPlatformPkgTokenSpaceGuid.P
# FSP_T Section
FILE = $(PLATFORM_FSP_BIN_PACKAGE)/Fsp_Rebased_T.fd
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset|gMinPla
+tformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryBase|gMinPlatf
+ormPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize
+FV = FvAdvancedPreMemory
+
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
FV = FvPreMemory
@@ -597,7 +601,10 @@ FILE FV_IMAGE = C83522D9-80A1-4D95-8C25-3F1370497406 {
}
}
-[FV.FvAdvancedPreMem]
+#
+# Pre-memory Advanced Features
+#
+[FV.FvAdvancedPreMemory]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -620,7 +627,10 @@ FvNameGuid = 6053D78A-457E-4490-A237-31D0FBE2F305
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Pei/PeiTbtInit.inf
!endif
-[FV.FvAdvancedPostMem]
+#
+# Post-Memory Advanced Features
+#
+[FV.FvAdvancedUncompact]
FvAlignment = 16
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
@@ -639,31 +649,15 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = BE3DF86F-E464-44A3-83F7-0D27E6B88C27
-[FV.FvAdvancedLate]
-FvAlignment = 16
-ERASE_POLARITY = 1
-MEMORY_MAPPED = TRUE
-STICKY_WRITE = TRUE
-LOCK_CAP = TRUE
-LOCK_STATUS = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP = TRUE
-WRITE_STATUS = TRUE
-WRITE_LOCK_CAP = TRUE
-WRITE_LOCK_STATUS = TRUE
-READ_DISABLED_CAP = TRUE
-READ_ENABLED_CAP = TRUE
-READ_STATUS = TRUE
-READ_LOCK_CAP = TRUE
-READ_LOCK_STATUS = TRUE
-FvNameGuid = 11F6E304-43F9-4B2F-90AB-B8FFEAD6205D
-
!if gWhiskeylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Dxe/TbtDxe.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/PciHotPlug/PciHotPlug.inf
INF $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Smm/TbtSmm.inf
!endif
+#
+# Compressed FV with Post-Memory Advanced Features #
[FV.FvAdvanced]
BlockSize = $(FLASH_BLOCK_SIZE)
FvAlignment = 16
@@ -684,17 +678,9 @@ READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
FvNameGuid = B23E7388-9953-45C7-9201-0473DDE5487A
-FILE FV_IMAGE = 35E7406A-5842-4F2B-BC62-19022C12AF74 {
- SECTION FV_IMAGE = FvAdvancedPreMem
- }
-
-FILE FV_IMAGE = F5DCB34F-27EA-48AC-9406-C894F6D587CA {
- SECTION FV_IMAGE = FvAdvancedPostMem
- }
-
FILE FV_IMAGE = 5248467B-B87B-4E74-AC02-398AF4BCB712 {
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
- SECTION FV_IMAGE = FvAdvancedLate
+ SECTION FV_IMAGE = FvAdvancedUncompact
}
}
--
2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
` (46 preceding siblings ...)
[not found] ` <20191113032816.4056-49-michael.a.kubacki@intel.com>
@ 2019-11-18 8:40 ` Dandan Bi
2019-11-27 20:54 ` Kubacki, Michael A
47 siblings, 1 reply; 92+ messages in thread
From: Dandan Bi @ 2019-11-18 8:40 UTC (permalink / raw)
To: Kubacki, Michael A, devel@edk2.groups.io
Cc: Agyeman, Prince, Chiu, Chasel, Dong, Eric, Oram, Isaac W,
Gao, Liming, Desimone, Nathaniel L, Chaganty, Rangasai V,
Wei, David Y
Hi Michael,
One minor comment, could we add the features into Features/ folder firstly and then update consumer platforms if have (open platforms and close source platforms) to use the ones in the new location, at last delete the old ones in Platform/Intel folder?
Thanks,
Dandan
> -----Original Message-----
> From: Kubacki, Michael A
> Sent: Wednesday, November 13, 2019 11:27 AM
> To: devel@edk2.groups.io
> Cc: Agyeman, Prince <prince.agyeman@intel.com>; Chiu, Chasel
> <chasel.chiu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Dong, Eric
> <eric.dong@intel.com>; Oram, Isaac W <isaac.w.oram@intel.com>; Gao,
> Liming <liming.gao@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Chaganty, Rangasai V
> <rangasai.v.chaganty@intel.com>; Wei, David Y <david.y.wei@intel.com>
> Subject: [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor
>
> RFC:https://edk2.groups.io/g/devel/message/49880
>
> This patch series introduces a consistent design for Intel advanced features.
>
> Advanced features in this context refer to the definition stated in
> the EDK II Minimum Platform specification. Information regarding
> this feature design is provided in Features/Intel/Readme.md.
>
> An RFC was sent to the mailing list on 11/1/2019 that stated the
> intention of creating the Features directory in edk2-platforms for
> this purpose and that change is implemented in this patch series.
>
> Testing performed:
> * Feature packages and board packages build successfully
> * Board packages boot successfully to their supported OS
> * Board package Stage 4 and Stage 6 tested
>
> The actual feature source implementation was not functionally
> modified. Any issues reported by PatchCheck.py were fixed.
> Future changes will be made to individually address improving the
> quality of each feature and to add new features.
>
> This patch series is intended to provide a foundation for future
> changes to the advanced feature design as an incremental improvement
> over the current state and should not be considered the final state.
>
> Cc: Agyeman Prince <prince.agyeman@intel.com>
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Isaac W Oram <isaac.w.oram@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
> Cc: Wei David Y <david.y.wei@intel.com>
> Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
>
> Michael Kubacki (49):
> AdvancedFeaturePkg: Package DSC style cleanup
> DebugFeaturePkg: Package DSC style cleanup
> UserInterfaceFeaturePkg: Package DSC style cleanup
> Features/Intel: Add Readme.md
> Features/Intel/PowerManagement: Add Readme.md
> Features/Intel/OutOfBandManagement: Add Readme.md
> Features/Intel/SystemInformation: Add Readme.md
> Features/Intel/Debug: Add Readme.md
> Features/Intel/UserInterface: Add Readme.md
> Features/Intel/Network: Add Readme.md
> TemplateFeaturePkg: Add initial package
> SimicsOpenBoardPkg: Remove advanced feature references
> AdvancedFeaturePkg: Remove the S3 feature
> Features/Intel: Add S3FeaturePkg
> AdvancedFeaturePkg: Remove the IPMI feature
> Features/Intel/IpmiFeaturePkg: Add initial package
> Features/Intel/IpmiFeaturePkg: Add libraries
> Features/Intel/IpmiFeaturePkg: Add modules
> AdvancedFeaturePkg: Remove the SMBIOS feature
> Features/Intel/SmbiosFeaturePkg: Add initial package
> Features/Intel/SmbiosFeaturePkg: Update default strings
> DebugFeaturePkg: Remove the ACPI Debug feature
> Features/Intel/AcpiDebugFeaturePkg: Add initial package
> DebugFeaturePkg: Remove the USB3 Debug feature
> Features/Intel/Usb3DebugFeaturePkg: Add initial package
> UserInterfaceFeaturePkg: Remove the User Authentication feature
> Features/Intel/UserAuthFeaturePkg: Add initial package
> Features/Intel/NetworkFeaturePkg: Add initial package
> AdvancedFeaturePkg: Remove remaining contents
> AdvancedFeaturePkg: Move to Features/Intel
> AdvancedFeaturePkg: Add feature build support
> AdvancedFeaturePkg: Add temporary build workaround
> AdvancedFeaturePkg: Add FDF include files
> KabylakeOpenBoardPkg/KabylakeRvp3: Add PEI_ARCH and DXE_ARCH
> KabylakeOpenBoardPkg/GalagoPro3: Add PEI_ARCH and DXE_ARCH
> WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add PEI_ARCH and
> DXE_ARCH
> SimicsOpenBoardPkg/BoardX58Ich10: Use PEI_ARCH and DXE_ARCH
> MinPlatformPkg: Add FvAdvancedPreMemory
> KabylakeOpenBoardPkg/KabylakeRvp3: Add FvAdvancedPreMemory
> KabylakeOpenBoardPkg/GalagoPro3: Add FvAdvancedPreMemory
> WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add
> FvAdvancedPreMemory
> Platform/Intel: Add advanced feature build support
> Platform/Intel/Readme.md Content update
> KabylakeOpenBoardPkg/GalagoPro3: Enable advanced features
> KabylakeOpenBoardPkg/KabylakeRvp3: Enable advanced features
> WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Enable advanced features
> SimicsOpenBoardPkg: Enable advanced features
> MinPlatformPkg: Install advanced feature FVs by stage enabled
> Maintainers.txt: Update Intel feature maintainers
>
> Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
> | 31 +++
>
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
> | 39 ++++
>
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.d
> ec | 57
> +++++
> Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec
> | 30 +++
>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.d
> ec | 46
> ++++
> Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dec
> | 30 +++
>
> Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.d
> ec | 172
> +++++++++++++++
> Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec
> | 30 +++
> Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.de
> c | 24 +-
> Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
> | 153 -------------
> Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec
> | 66 ------
> Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> | 4 +
> Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> | 53 +++++
> Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
> | 56 +++++
>
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
> ryBuildWorkaround.dsc
> | 74 +++++++
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc
> | 30 +++
>
> Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeatur
> e.dsc | 125
> +++++++++++
>
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeatu
> re.dsc | 149
> +++++++++++++
>
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.d
> sc | 30
> +++
> Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc
> | 152 +++++++++++++
> Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc
> | 30 +++
>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeatu
> re.dsc | 144
> ++++++++++++
>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.ds
> c | 31
> +++
> Features/Intel/PowerManagement/S3FeaturePkg/Include/S3Feature.dsc
> | 122 ++++++++++
> Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dsc
> | 30 +++
>
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeatu
> re.dsc | 115
> ++++++++++
>
> Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.ds
> c | 30
> +++
> Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc
> | 113 ++++++++++
> Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc
> | 30 +++
>
> Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeatur
> e.dsc | 141
> ++++++++++++
>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.ds
> c | 30
> +++
> Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> | 156 -------------
>
> Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude
> .dsc | 19 --
>
> Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.
> dsc | 9 -
> Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
> | 101 ---------
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
> | 62 +++---
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkgPcd.dsc
> | 1 +
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
> | 61 +++--
>
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.ds
> c | 1 +
> Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
> | 25 ++-
> Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc
> | 12 +-
> Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
> | 80 -------
>
> Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
> g.dsc | 60
> +++--
>
> Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
> gPcd.dsc |
> 1 +
> Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf
> | 57 +++++
> Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf
> | 57 +++++
> Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf
> | 11 +
> Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf
> | 8 +
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf
> | 8 +
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf
> | 8 +
> Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf
> | 10 +
> Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf
> | 8 +
>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMem
> ory.fdf |
> 16 ++
>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemo
> ry.fdf | 11
> +
> Features/Intel/PowerManagement/S3FeaturePkg/Include/PostMemory.fdf
> | 8 +
> Features/Intel/PowerManagement/S3FeaturePkg/Include/PreMemory.fdf
> | 10 +
>
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory
> .fdf | 10 +
>
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.
> fdf | 8 +
> Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf
> | 8 +
> Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf
> | 8 +
>
> Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fd
> f | 12 +
> Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf
> | 8 +
>
> Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude
> .fdf | 20 --
>
> Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemor
> yInclude.fdf |
> 8 -
>
> Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemor
> yInclude.fdf |
> 9 -
>
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapIn
> clude.fdf | 20
> +-
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
> | 48 ++--
>
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMa
> pInclude.fdf |
> 30 +--
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
> | 48 ++--
> Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
> | 10 +-
>
> Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/F
> lashMapInclude.fdf
> | 24 +-
>
> Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
> g.fdf | 48
> ++--
>
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
> ryBuildWorkaround.inf
> | 57 +++++
> {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> DebugDxe.inf | 10 +-
> {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> DebugSmm.inf | 11 +-
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibDxe.inf | 12 +-
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibDxeIoMmu.inf | 12
> +-
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibNull.inf | 3 +-
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibPei.inf | 10 +-
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibPeiIoMmu.inf | 10
> +-
>
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortP
> aramLibPcd/Usb3DebugPortParamLibPcd.inf
> | 31 +++
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi
> .inf | 9 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog
> .inf | 5 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.inf
> | 10 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.inf
> | 10 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.i
> nf | 4 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiI
> nit.inf | 6 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiI
> nit.inf | 6 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> mandLib/IpmiCommandLib.inf | 6 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatfo
> rmHookLibNull/IpmiPlatformHookLibNull.inf | 9 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.inf
> | 7 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStat
> us.inf | 13 +-
> {Platform/Intel/AdvancedFeaturePkg/S3 =>
> Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.inf
> | 16 +-
>
> Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Smb
> iosBasicDxe.inf |
> 83 +++++++
> {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPassw
> ordLibNull/PlatformPasswordLibNull.inf | 5 +-
> {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLi
> b/UserPasswordLib.inf | 2 +-
> {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordU
> iLib/UserPasswordUiLib.inf | 2 +-
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthentication2Dxe.inf | 3 +-
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxe.inf | 3 +-
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationSmm.inf | 2 +-
>
> Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.in
> f | 28 ---
>
> Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicD
> xe.inf | 83 -
> ------
>
> Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/
> Usb3DebugPortParameterLibPcd.inf
> | 31 ---
>
> Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiRep
> ortFvLib.inf | 43
> ++--
>
> Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDx
> e.inf | 1 -
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Include/Library/Usb3De
> bugPortLib.h | 0
>
> Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameter
> Lib.h =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3Deb
> ugPortParamLib.h | 0
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibInternal.h | 0
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/Ip
> miCommandLib.h | 0
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/Ip
> miPlatformHookLib.h | 0
> {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Sm
> biosBasic.h | 4 +-
> {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Guid/UserAuth
> entication.h | 0
> {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/Platfor
> mPasswordLib.h | 0
> {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPa
> sswordLib.h | 0
> {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPa
> sswordUiLib.h | 0
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/KeyService.h | 0
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthentication2Dxe.h | 0
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxe.h | 0
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxeFormset.h | 0
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationSmm.h | 0
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxeVfr.vfr | 0
>
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
> ryBuildWorkaround.c
> | 31 +++
> {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> Debug.c | 54 +++--
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/MiscServices.c | 0
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortDataTransfer.c | 2 +-
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortInitialize.c | 2 +-
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibDxe.c | 4 +-
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibDxeIoMmu.c | 4
> +-
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibNull.c | 0
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibPei.c | 2 +-
> {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibPeiIoMmu.c | 2 +-
>
> Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/
> Usb3DebugPortParameterLibPcd.c =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortP
> aramLibPcd/Usb3DebugPortParamLibPcd.c | 2 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi
> .c | 0
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog
> .c | 0
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.c
> | 2 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.c
> | 4 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.c
> | 0
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiI
> nit.c | 8 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiI
> nit.c | 0
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> mandLib/IpmiCommandLibNetFnApp.c | 0
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> mandLib/IpmiCommandLibNetFnChassis.c | 0
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> mandLib/IpmiCommandLibNetFnStorage.c | 0
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> mandLib/IpmiCommandLibNetFnTransport.c |
> 0
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatfo
> rmHookLibNull/IpmiPlatformHookLibNull.c | 0
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.c
> | 2 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStat
> us.c | 6 +-
> {Platform/Intel/AdvancedFeaturePkg/S3 =>
> Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.c
> | 0
> {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Sm
> biosBasicEntryPoint.c | 8 +-
> {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> e0BiosVendorFunction.c | 2 +-
> {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> e1SystemManufacturerFunction.c | 2 +-
> {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> e2BaseBoardManufacturerFunction.c | 0
> {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> e32BootInformationFunction.c | 0
> {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> e3ChassisManufacturerFunction.c | 0
> {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPassw
> ordLibNull/PlatformPasswordLibNull.c | 0
> {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLi
> b/UserPasswordLib.c | 0
> {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordU
> iLib/UserPasswordUiLib.c | 0
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/KeyService.c | 0
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthentication2Dxe.c | 0
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxe.c | 0
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxePassword.c | 0
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationSmm.c | 0
> Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c
> | 45 ----
>
> Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiRep
> ortFvLib.c | 38
> +++-
> {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> Debug.asl | 3 +-
> Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md
> | 121 ++++++++++
> Features/Intel/Debugging/Readme.md
> | 7 +
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md
> | 86 ++++++++
> Features/Intel/Network/NetworkFeaturePkg/Readme.md
> | 89 ++++++++
> Features/Intel/Network/Readme.md
> | 5 +
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt
> /BmcSsdt.asl | 8 +-
> {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt
> /IpmiOprRegions.asi | 10 +-
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md
> | 86 ++++++++
> Features/Intel/OutOfBandManagement/Readme.md
> | 8 +
> Features/Intel/PowerManagement/Readme.md
> | 10 +
> Features/Intel/PowerManagement/S3FeaturePkg/Readme.md
> | 86 ++++++++
> Features/Intel/Readme.md
> | 232 ++++++++++++++++++++
> Features/Intel/SystemInformation/Readme.md
> | 8 +
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md
> | 86 ++++++++
> Features/Intel/TemplateFeaturePkg/Readme.md
> | 71 ++++++
> Features/Intel/UserInterface/Readme.md
> | 9 +
> {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPassw
> ordLibNull/PlatformPasswordLibNull.uni | 0
> Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md
> | 86 ++++++++
> {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxeStrings.uni | 0
> Maintainers.txt
> | 26 +--
> Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt
> | 31 ---
> Platform/Intel/Readme.md
> | 14 +-
> Platform/Intel/build.cfg
> | 1 +
> Platform/Intel/build_bios.py
> | 3 +
> 188 files changed, 3854 insertions(+), 1285 deletions(-)
> create mode 100644
> Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
> create mode 100644
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
> create mode 100644
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.d
> ec
> create mode 100644
> Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec
> create mode 100644
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.d
> ec
> create mode 100644
> Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dec
> create mode 100644
> Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.d
> ec
> create mode 100644
> Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec
> rename
> Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.de
> c (53%)
> delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
> delete mode 100644
> Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec
> create mode 100644
> Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> create mode 100644
> Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
> create mode 100644
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
> ryBuildWorkaround.dsc
> create mode 100644
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc
> create mode 100644
> Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeatur
> e.dsc
> create mode 100644
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeatu
> re.dsc
> create mode 100644
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.d
> sc
> create mode 100644
> Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc
> create mode 100644
> Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc
> create mode 100644
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeatu
> re.dsc
> create mode 100644
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.ds
> c
> create mode 100644
> Features/Intel/PowerManagement/S3FeaturePkg/Include/S3Feature.dsc
> create mode 100644
> Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dsc
> create mode 100644
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeatu
> re.dsc
> create mode 100644
> Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.ds
> c
> create mode 100644
> Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc
> create mode 100644
> Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc
> create mode 100644
> Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeatur
> e.dsc
> create mode 100644
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.ds
> c
> delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude
> .dsc
> delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.
> dsc
> delete mode 100644
> Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
> delete mode 100644
> Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
> create mode 100644
> Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf
> create mode 100644
> Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf
> create mode 100644
> Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf
> create mode 100644
> Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf
> create mode 100644
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf
> create mode 100644
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf
> create mode 100644
> Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf
> create mode 100644
> Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf
> create mode 100644
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMem
> ory.fdf
> create mode 100644
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemo
> ry.fdf
> create mode 100644
> Features/Intel/PowerManagement/S3FeaturePkg/Include/PostMemory.fdf
> create mode 100644
> Features/Intel/PowerManagement/S3FeaturePkg/Include/PreMemory.fdf
> create mode 100644
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory
> .fdf
> create mode 100644
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.
> fdf
> create mode 100644
> Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf
> create mode 100644
> Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf
> create mode 100644
> Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fd
> f
> create mode 100644
> Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf
> delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude
> .fdf
> delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemor
> yInclude.fdf
> delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemor
> yInclude.fdf
> create mode 100644
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
> ryBuildWorkaround.inf
> rename {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> DebugDxe.inf (77%)
> rename {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> DebugSmm.inf (74%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibDxe.inf (74%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibDxeIoMmu.inf (78%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibNull.inf (92%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibPei.inf (74%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibPeiIoMmu.inf (76%)
> create mode 100644
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortP
> aramLibPcd/Usb3DebugPortParamLibPcd.inf
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi
> .inf (78%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog
> .inf (78%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.inf
> (77%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.inf
> (64%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.i
> nf (78%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiI
> nit.inf (79%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiI
> nit.inf (78%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> mandLib/IpmiCommandLib.inf (80%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatfo
> rmHookLibNull/IpmiPlatformHookLibNull.inf (74%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.inf
> (79%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStat
> us.inf (66%)
> rename {Platform/Intel/AdvancedFeaturePkg/S3 =>
> Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.inf (52%)
> create mode 100644
> Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Smb
> iosBasicDxe.inf
> rename {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPassw
> ordLibNull/PlatformPasswordLibNull.inf (88%)
> rename {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLi
> b/UserPasswordLib.inf (91%)
> rename {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordU
> iLib/UserPasswordUiLib.inf (91%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthentication2Dxe.inf (92%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxe.inf (93%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationSmm.inf (92%)
> delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.in
> f
> delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicD
> xe.inf
> delete mode 100644
> Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/
> Usb3DebugPortParameterLibPcd.inf
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Include/Library/Usb3De
> bugPortLib.h (100%)
> rename
> Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameter
> Lib.h =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3Deb
> ugPortParamLib.h (100%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibInternal.h (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/Ip
> miCommandLib.h (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/Ip
> miPlatformHookLib.h (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Sm
> biosBasic.h (90%)
> rename {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Guid/UserAuth
> entication.h (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/Platfor
> mPasswordLib.h (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPa
> sswordLib.h (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPa
> sswordUiLib.h (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/KeyService.h (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthentication2Dxe.h (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxe.h (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxeFormset.h (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationSmm.h (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxeVfr.vfr (100%)
> create mode 100644
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
> ryBuildWorkaround.c
> rename {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> Debug.c (90%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/MiscServices.c (100%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortDataTransfer.c (96%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortInitialize.c (96%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibDxe.c (95%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibDxeIoMmu.c (95%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibNull.c (100%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibPei.c (95%)
> rename {Platform/Intel/DebugFeaturePkg =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> b/Usb3DebugPortLibPeiIoMmu.c (95%)
> rename
> Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/
> Usb3DebugPortParameterLibPcd.c =>
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortP
> aramLibPcd/Usb3DebugPortParamLibPcd.c (92%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi
> .c (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog
> .c (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.c
> (95%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.c (94%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.c
> (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiI
> nit.c (93%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiI
> nit.c (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> mandLib/IpmiCommandLibNetFnApp.c (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> mandLib/IpmiCommandLibNetFnChassis.c (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> mandLib/IpmiCommandLibNetFnStorage.c (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> mandLib/IpmiCommandLibNetFnTransport.c (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatfo
> rmHookLibNull/IpmiPlatformHookLibNull.c (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.c
> (94%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStat
> us.c (94%)
> rename {Platform/Intel/AdvancedFeaturePkg/S3 =>
> Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.c (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Sm
> biosBasicEntryPoint.c (89%)
> rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> e0BiosVendorFunction.c (95%)
> rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> e1SystemManufacturerFunction.c (96%)
> rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> e2BaseBoardManufacturerFunction.c (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> e32BootInformationFunction.c (100%)
> rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> e3ChassisManufacturerFunction.c (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPassw
> ordLibNull/PlatformPasswordLibNull.c (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLi
> b/UserPasswordLib.c (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordU
> iLib/UserPasswordUiLib.c (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/KeyService.c (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthentication2Dxe.c (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxe.c (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxePassword.c (100%)
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationSmm.c (100%)
> delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c
> rename {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> Debug.asl (95%)
> create mode 100644
> Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md
> create mode 100644 Features/Intel/Debugging/Readme.md
> create mode 100644
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md
> create mode 100644
> Features/Intel/Network/NetworkFeaturePkg/Readme.md
> create mode 100644 Features/Intel/Network/Readme.md
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt
> /BmcSsdt.asl (87%)
> rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt
> /IpmiOprRegions.asi (91%)
> create mode 100644
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md
> create mode 100644 Features/Intel/OutOfBandManagement/Readme.md
> create mode 100644 Features/Intel/PowerManagement/Readme.md
> create mode 100644
> Features/Intel/PowerManagement/S3FeaturePkg/Readme.md
> create mode 100644 Features/Intel/Readme.md
> create mode 100644 Features/Intel/SystemInformation/Readme.md
> create mode 100644
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md
> create mode 100644 Features/Intel/TemplateFeaturePkg/Readme.md
> create mode 100644 Features/Intel/UserInterface/Readme.md
> rename {Platform/Intel/UserInterfaceFeaturePkg =>
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPassw
> ordLibNull/PlatformPasswordLibNull.uni (100%)
> create mode 100644
> Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md
> rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> Smm}/UserAuthenticationDxeStrings.uni (100%)
> delete mode 100644
> Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt
>
> --
> 2.16.2.windows.1
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor
2019-11-18 8:40 ` [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Dandan Bi
@ 2019-11-27 20:54 ` Kubacki, Michael A
0 siblings, 0 replies; 92+ messages in thread
From: Kubacki, Michael A @ 2019-11-27 20:54 UTC (permalink / raw)
To: Bi, Dandan, devel@edk2.groups.io
Cc: Agyeman, Prince, Chiu, Chasel, Dong, Eric, Oram, Isaac W,
Gao, Liming, Desimone, Nathaniel L, Chaganty, Rangasai V
Yes, I reordered the patch series this way in V2 and I will update the closed source platforms before the old advanced feature dependencies are removed.
Thanks,
Michael
> -----Original Message-----
> From: Bi, Dandan <dandan.bi@intel.com>
> Sent: Monday, November 18, 2019 12:41 AM
> To: Kubacki, Michael A <michael.a.kubacki@intel.com>;
> devel@edk2.groups.io
> Cc: Agyeman, Prince <prince.agyeman@intel.com>; Chiu, Chasel
> <chasel.chiu@intel.com>; Dong, Eric <eric.dong@intel.com>; Oram, Isaac W
> <isaac.w.oram@intel.com>; Gao, Liming <liming.gao@intel.com>; Desimone,
> Nathaniel L <nathaniel.l.desimone@intel.com>; Chaganty, Rangasai V
> <rangasai.v.chaganty@intel.com>; Wei, David Y <david.y.wei@intel.com>
> Subject: RE: [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature
> Refactor
>
> Hi Michael,
>
> One minor comment, could we add the features into Features/ folder firstly
> and then update consumer platforms if have (open platforms and close
> source platforms) to use the ones in the new location, at last delete the old
> ones in Platform/Intel folder?
>
>
> Thanks,
> Dandan
> > -----Original Message-----
> > From: Kubacki, Michael A
> > Sent: Wednesday, November 13, 2019 11:27 AM
> > To: devel@edk2.groups.io
> > Cc: Agyeman, Prince <prince.agyeman@intel.com>; Chiu, Chasel
> > <chasel.chiu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Dong, Eric
> > <eric.dong@intel.com>; Oram, Isaac W <isaac.w.oram@intel.com>; Gao,
> > Liming <liming.gao@intel.com>; Desimone, Nathaniel L
> > <nathaniel.l.desimone@intel.com>; Chaganty, Rangasai V
> > <rangasai.v.chaganty@intel.com>; Wei, David Y <david.y.wei@intel.com>
> > Subject: [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature
> Refactor
> >
> > RFC:https://edk2.groups.io/g/devel/message/49880
> >
> > This patch series introduces a consistent design for Intel advanced
> features.
> >
> > Advanced features in this context refer to the definition stated in
> > the EDK II Minimum Platform specification. Information regarding
> > this feature design is provided in Features/Intel/Readme.md.
> >
> > An RFC was sent to the mailing list on 11/1/2019 that stated the
> > intention of creating the Features directory in edk2-platforms for
> > this purpose and that change is implemented in this patch series.
> >
> > Testing performed:
> > * Feature packages and board packages build successfully
> > * Board packages boot successfully to their supported OS
> > * Board package Stage 4 and Stage 6 tested
> >
> > The actual feature source implementation was not functionally
> > modified. Any issues reported by PatchCheck.py were fixed.
> > Future changes will be made to individually address improving the
> > quality of each feature and to add new features.
> >
> > This patch series is intended to provide a foundation for future
> > changes to the advanced feature design as an incremental improvement
> > over the current state and should not be considered the final state.
> >
> > Cc: Agyeman Prince <prince.agyeman@intel.com>
> > Cc: Chasel Chiu <chasel.chiu@intel.com>
> > Cc: Dandan Bi <dandan.bi@intel.com>
> > Cc: Eric Dong <eric.dong@intel.com>
> > Cc: Isaac W Oram <isaac.w.oram@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> > Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
> > Cc: Wei David Y <david.y.wei@intel.com>
> > Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
> >
> > Michael Kubacki (49):
> > AdvancedFeaturePkg: Package DSC style cleanup
> > DebugFeaturePkg: Package DSC style cleanup
> > UserInterfaceFeaturePkg: Package DSC style cleanup
> > Features/Intel: Add Readme.md
> > Features/Intel/PowerManagement: Add Readme.md
> > Features/Intel/OutOfBandManagement: Add Readme.md
> > Features/Intel/SystemInformation: Add Readme.md
> > Features/Intel/Debug: Add Readme.md
> > Features/Intel/UserInterface: Add Readme.md
> > Features/Intel/Network: Add Readme.md
> > TemplateFeaturePkg: Add initial package
> > SimicsOpenBoardPkg: Remove advanced feature references
> > AdvancedFeaturePkg: Remove the S3 feature
> > Features/Intel: Add S3FeaturePkg
> > AdvancedFeaturePkg: Remove the IPMI feature
> > Features/Intel/IpmiFeaturePkg: Add initial package
> > Features/Intel/IpmiFeaturePkg: Add libraries
> > Features/Intel/IpmiFeaturePkg: Add modules
> > AdvancedFeaturePkg: Remove the SMBIOS feature
> > Features/Intel/SmbiosFeaturePkg: Add initial package
> > Features/Intel/SmbiosFeaturePkg: Update default strings
> > DebugFeaturePkg: Remove the ACPI Debug feature
> > Features/Intel/AcpiDebugFeaturePkg: Add initial package
> > DebugFeaturePkg: Remove the USB3 Debug feature
> > Features/Intel/Usb3DebugFeaturePkg: Add initial package
> > UserInterfaceFeaturePkg: Remove the User Authentication feature
> > Features/Intel/UserAuthFeaturePkg: Add initial package
> > Features/Intel/NetworkFeaturePkg: Add initial package
> > AdvancedFeaturePkg: Remove remaining contents
> > AdvancedFeaturePkg: Move to Features/Intel
> > AdvancedFeaturePkg: Add feature build support
> > AdvancedFeaturePkg: Add temporary build workaround
> > AdvancedFeaturePkg: Add FDF include files
> > KabylakeOpenBoardPkg/KabylakeRvp3: Add PEI_ARCH and DXE_ARCH
> > KabylakeOpenBoardPkg/GalagoPro3: Add PEI_ARCH and DXE_ARCH
> > WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add PEI_ARCH and
> > DXE_ARCH
> > SimicsOpenBoardPkg/BoardX58Ich10: Use PEI_ARCH and DXE_ARCH
> > MinPlatformPkg: Add FvAdvancedPreMemory
> > KabylakeOpenBoardPkg/KabylakeRvp3: Add FvAdvancedPreMemory
> > KabylakeOpenBoardPkg/GalagoPro3: Add FvAdvancedPreMemory
> > WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add
> > FvAdvancedPreMemory
> > Platform/Intel: Add advanced feature build support
> > Platform/Intel/Readme.md Content update
> > KabylakeOpenBoardPkg/GalagoPro3: Enable advanced features
> > KabylakeOpenBoardPkg/KabylakeRvp3: Enable advanced features
> > WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Enable advanced features
> > SimicsOpenBoardPkg: Enable advanced features
> > MinPlatformPkg: Install advanced feature FVs by stage enabled
> > Maintainers.txt: Update Intel feature maintainers
> >
> > Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
> > | 31 +++
> >
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
> > | 39 ++++
> >
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.d
> > ec | 57
> > +++++
> > Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec
> > | 30 +++
> >
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.d
> > ec | 46
> > ++++
> > Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dec
> > | 30 +++
> >
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.d
> > ec | 172
> > +++++++++++++++
> > Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec
> > | 30 +++
> > Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.de
> > c | 24 +-
> > Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
> > | 153 -------------
> > Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec
> > | 66 ------
> > Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> > | 4 +
> > Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> > | 53 +++++
> > Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
> > | 56 +++++
> >
> >
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
> > ryBuildWorkaround.dsc
> > | 74 +++++++
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc
> > | 30 +++
> >
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeatur
> > e.dsc |
> 125
> > +++++++++++
> >
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeatu
> > re.dsc |
> 149
> > +++++++++++++
> >
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.d
> > sc | 30
> > +++
> >
> Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc
> > | 152 +++++++++++++
> > Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc
> > | 30 +++
> >
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeatu
> > re.dsc |
> 144
> > ++++++++++++
> >
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.ds
> > c | 31
> > +++
> > Features/Intel/PowerManagement/S3FeaturePkg/Include/S3Feature.dsc
> > | 122 ++++++++++
> > Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dsc
> > | 30 +++
> >
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeatu
> > re.dsc |
> 115
> > ++++++++++
> >
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.ds
> > c | 30
> > +++
> > Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc
> > | 113 ++++++++++
> > Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc
> > | 30 +++
> >
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeatur
> > e.dsc | 141
> > ++++++++++++
> >
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.ds
> > c | 30
> > +++
> > Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> > | 156 -------------
> >
> >
> Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude
> > .dsc | 19
> --
> >
> >
> Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.
> > dsc | 9 -
> > Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
> > | 101 ---------
> > Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
> > | 62 +++---
> >
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkgPcd.dsc
> > | 1 +
> > Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
> > | 61 +++--
> >
> >
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.ds
> > c | 1 +
> > Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
> > | 25 ++-
> >
> Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc
> > | 12 +-
> > Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
> > | 80 -------
> >
> >
> Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
> > g.dsc |
> 60
> > +++--
> >
> >
> Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
> > gPcd.dsc |
> > 1 +
> > Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf
> > | 57 +++++
> > Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf
> > | 57 +++++
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf
> > | 11 +
> > Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf
> > | 8 +
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf
> > | 8 +
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf
> > | 8 +
> > Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf
> > | 10 +
> > Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf
> > | 8 +
> >
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMem
> > ory.fdf |
> > 16 ++
> >
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemo
> > ry.fdf |
> 11
> > +
> >
> Features/Intel/PowerManagement/S3FeaturePkg/Include/PostMemory.fdf
> > | 8 +
> >
> Features/Intel/PowerManagement/S3FeaturePkg/Include/PreMemory.fdf
> > | 10 +
> >
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory
> > .fdf | 10
> +
> >
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.
> > fdf | 8
> +
> > Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf
> > | 8 +
> > Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf
> > | 8 +
> >
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fd
> > f | 12 +
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf
> > | 8 +
> >
> >
> Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude
> > .fdf | 20 -
> -
> >
> >
> Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemor
> > yInclude.fdf
> |
> > 8 -
> >
> >
> Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemor
> > yInclude.fdf
> |
> > 9 -
> >
> >
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapIn
> > clude.fdf |
> 20
> > +-
> > Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
> > | 48 ++--
> >
> >
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMa
> > pInclude.fdf
> |
> > 30 +--
> > Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
> > | 48 ++--
> > Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
> > | 10 +-
> >
> >
> Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/F
> > lashMapInclude.fdf
> > | 24 +-
> >
> >
> Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
> > g.fdf |
> 48
> > ++--
> >
> >
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
> > ryBuildWorkaround.inf
> > | 57 +++++
> > {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> > DebugDxe.inf | 10 +-
> > {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> > DebugSmm.inf | 11 +-
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibDxe.inf | 12 +-
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibDxeIoMmu.inf |
> 12
> > +-
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibNull.inf | 3 +-
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibPei.inf | 10 +-
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibPeiIoMmu.inf | 10
> > +-
> >
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortP
> > aramLibPcd/Usb3DebugPortParamLibPcd.inf
> > | 31 +++
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi
> > .inf | 9 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog
> > .inf | 5 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> > Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.inf
> > | 10 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> > Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.inf
> > | 10 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.i
> > nf | 4 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiI
> > nit.inf | 6 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiI
> > nit.inf | 6 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> > mandLib/IpmiCommandLib.inf | 6 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatfo
> > rmHookLibNull/IpmiPlatformHookLibNull.inf | 9
> +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.inf
> > | 7 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStat
> > us.inf | 13 +-
> > {Platform/Intel/AdvancedFeaturePkg/S3 =>
> > Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.inf
> > | 16 +-
> >
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Smb
> > iosBasicDxe.inf
> |
> > 83 +++++++
> > {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPassw
> > ordLibNull/PlatformPasswordLibNull.inf | 5 +-
> > {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLi
> > b/UserPasswordLib.inf | 2 +-
> > {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordU
> > iLib/UserPasswordUiLib.inf | 2 +-
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthentication2Dxe.inf | 3 +-
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxe.inf | 3 +-
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationSmm.inf | 2 +-
> >
> >
> Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.in
> > f | 28 ---
> >
> >
> Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicD
> > xe.inf |
> 83 -
> > ------
> >
> >
> Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/
> > Usb3DebugPortParameterLibPcd.inf
> > | 31 ---
> >
> >
> Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiRep
> > ortFvLib.inf |
> 43
> > ++--
> >
> >
> Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDx
> > e.inf | 1
> -
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Include/Library/Usb3De
> > bugPortLib.h | 0
> >
> >
> Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameter
> > Lib.h =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3Deb
> > ugPortParamLib.h | 0
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibInternal.h | 0
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/Ip
> > miCommandLib.h | 0
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/Ip
> > miPlatformHookLib.h | 0
> > {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Sm
> > biosBasic.h | 4 +-
> > {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Guid/UserAuth
> > entication.h | 0
> > {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/Platfor
> > mPasswordLib.h | 0
> > {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPa
> > sswordLib.h | 0
> > {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPa
> > sswordUiLib.h | 0
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/KeyService.h | 0
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthentication2Dxe.h | 0
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxe.h | 0
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxeFormset.h | 0
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationSmm.h | 0
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxeVfr.vfr | 0
> >
> >
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
> > ryBuildWorkaround.c
> > | 31 +++
> > {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> > Debug.c | 54 +++--
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/MiscServices.c | 0
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortDataTransfer.c | 2
> +-
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortInitialize.c | 2 +-
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibDxe.c | 4 +-
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibDxeIoMmu.c | 4
> > +-
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibNull.c | 0
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibPei.c | 2 +-
> > {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibPeiIoMmu.c | 2
> +-
> >
> >
> Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/
> > Usb3DebugPortParameterLibPcd.c =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortP
> > aramLibPcd/Usb3DebugPortParamLibPcd.c | 2 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi
> > .c | 0
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog
> > .c | 0
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> > Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.c
> > | 2 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> > Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.c
> > | 4 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.c
> > | 0
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiI
> > nit.c | 8 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiI
> > nit.c | 0
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> > mandLib/IpmiCommandLibNetFnApp.c | 0
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> > mandLib/IpmiCommandLibNetFnChassis.c |
> 0
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> > mandLib/IpmiCommandLibNetFnStorage.c |
> 0
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> > mandLib/IpmiCommandLibNetFnTransport.c |
> > 0
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatfo
> > rmHookLibNull/IpmiPlatformHookLibNull.c | 0
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.c
> > | 2 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStat
> > us.c | 6 +-
> > {Platform/Intel/AdvancedFeaturePkg/S3 =>
> > Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.c
> > | 0
> > {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Sm
> > biosBasicEntryPoint.c | 8 +-
> > {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> > e0BiosVendorFunction.c | 2 +-
> > {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> > e1SystemManufacturerFunction.c | 2 +-
> > {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> > e2BaseBoardManufacturerFunction.c | 0
> > {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> > e32BootInformationFunction.c | 0
> > {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> > e3ChassisManufacturerFunction.c | 0
> > {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPassw
> > ordLibNull/PlatformPasswordLibNull.c | 0
> > {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLi
> > b/UserPasswordLib.c | 0
> > {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordU
> > iLib/UserPasswordUiLib.c | 0
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/KeyService.c | 0
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthentication2Dxe.c | 0
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxe.c | 0
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxePassword.c | 0
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationSmm.c | 0
> >
> Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c
> > | 45 ----
> >
> >
> Platform/Intel/MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiRep
> > ortFvLib.c |
> 38
> > +++-
> > {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> > Debug.asl | 3 +-
> > Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md
> > | 121 ++++++++++
> > Features/Intel/Debugging/Readme.md
> > | 7 +
> > Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md
> > | 86 ++++++++
> > Features/Intel/Network/NetworkFeaturePkg/Readme.md
> > | 89 ++++++++
> > Features/Intel/Network/Readme.md
> > | 5 +
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt
> > /BmcSsdt.asl | 8 +-
> > {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt
> > /IpmiOprRegions.asi | 10 +-
> > Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md
> > | 86 ++++++++
> > Features/Intel/OutOfBandManagement/Readme.md
> > | 8 +
> > Features/Intel/PowerManagement/Readme.md
> > | 10 +
> > Features/Intel/PowerManagement/S3FeaturePkg/Readme.md
> > | 86 ++++++++
> > Features/Intel/Readme.md
> > | 232 ++++++++++++++++++++
> > Features/Intel/SystemInformation/Readme.md
> > | 8 +
> > Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md
> > | 86 ++++++++
> > Features/Intel/TemplateFeaturePkg/Readme.md
> > | 71 ++++++
> > Features/Intel/UserInterface/Readme.md
> > | 9 +
> > {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPassw
> > ordLibNull/PlatformPasswordLibNull.uni | 0
> > Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md
> > | 86 ++++++++
> > {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxeStrings.uni | 0
> > Maintainers.txt
> > | 26 +--
> > Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt
> > | 31 ---
> > Platform/Intel/Readme.md
> > | 14 +-
> > Platform/Intel/build.cfg
> > | 1 +
> > Platform/Intel/build_bios.py
> > | 3 +
> > 188 files changed, 3854 insertions(+), 1285 deletions(-)
> > create mode 100644
> > Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
> > create mode 100644
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec
> > create mode 100644
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.d
> > ec
> > create mode 100644
> > Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dec
> > create mode 100644
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.d
> > ec
> > create mode 100644
> > Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dec
> > create mode 100644
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.d
> > ec
> > create mode 100644
> > Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dec
> > rename
> > Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.de
> > c (53%)
> > delete mode 100644
> > Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
> > delete mode 100644
> > Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec
> > create mode 100644
> > Features/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> > create mode 100644
> > Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
> > create mode 100644
> >
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
> > ryBuildWorkaround.dsc
> > create mode 100644
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dsc
> > create mode 100644
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/AcpiDebugFeatur
> > e.dsc
> > create mode 100644
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Usb3DebugFeatu
> > re.dsc
> > create mode 100644
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.d
> > sc
> > create mode 100644
> >
> Features/Intel/Network/NetworkFeaturePkg/Include/NetworkFeature.dsc
> > create mode 100644
> > Features/Intel/Network/NetworkFeaturePkg/NetworkFeaturePkg.dsc
> > create mode 100644
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeatu
> > re.dsc
> > create mode 100644
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.ds
> > c
> > create mode 100644
> > Features/Intel/PowerManagement/S3FeaturePkg/Include/S3Feature.dsc
> > create mode 100644
> > Features/Intel/PowerManagement/S3FeaturePkg/S3FeaturePkg.dsc
> > create mode 100644
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeatu
> > re.dsc
> > create mode 100644
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.ds
> > c
> > create mode 100644
> > Features/Intel/TemplateFeaturePkg/Include/TemplateFeature.dsc
> > create mode 100644
> > Features/Intel/TemplateFeaturePkg/TemplateFeaturePkg.dsc
> > create mode 100644
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/Include/UserAuthFeatur
> > e.dsc
> > create mode 100644
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthFeaturePkg.ds
> > c
> > delete mode 100644
> > Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> > delete mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude
> > .dsc
> > delete mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.
> > dsc
> > delete mode 100644
> > Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
> > delete mode 100644
> > Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
> > create mode 100644
> > Features/Intel/AdvancedFeaturePkg/Include/PostMemory.fdf
> > create mode 100644
> > Features/Intel/AdvancedFeaturePkg/Include/PreMemory.fdf
> > create mode 100644
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PostMemory.fdf
> > create mode 100644
> > Features/Intel/Debugging/AcpiDebugFeaturePkg/Include/PreMemory.fdf
> > create mode 100644
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PostMemory.fdf
> > create mode 100644
> > Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/PreMemory.fdf
> > create mode 100644
> > Features/Intel/Network/NetworkFeaturePkg/Include/PostMemory.fdf
> > create mode 100644
> > Features/Intel/Network/NetworkFeaturePkg/Include/PreMemory.fdf
> > create mode 100644
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMem
> > ory.fdf
> > create mode 100644
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemo
> > ry.fdf
> > create mode 100644
> >
> Features/Intel/PowerManagement/S3FeaturePkg/Include/PostMemory.fdf
> > create mode 100644
> >
> Features/Intel/PowerManagement/S3FeaturePkg/Include/PreMemory.fdf
> > create mode 100644
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory
> > .fdf
> > create mode 100644
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.
> > fdf
> > create mode 100644
> > Features/Intel/TemplateFeaturePkg/Include/PostMemory.fdf
> > create mode 100644
> > Features/Intel/TemplateFeaturePkg/Include/PreMemory.fdf
> > create mode 100644
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PostMemory.fd
> > f
> > create mode 100644
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/Include/PreMemory.fdf
> > delete mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude
> > .fdf
> > delete mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemor
> > yInclude.fdf
> > delete mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemor
> > yInclude.fdf
> > create mode 100644
> >
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
> > ryBuildWorkaround.inf
> > rename {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> > DebugDxe.inf (77%)
> > rename {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> > DebugSmm.inf (74%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibDxe.inf (74%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibDxeIoMmu.inf (78%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibNull.inf (92%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibPei.inf (74%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibPeiIoMmu.inf (76%)
> > create mode 100644
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortP
> > aramLibPcd/Usb3DebugPortParamLibPcd.inf
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi
> > .inf (78%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog
> > .inf (78%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> > Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.inf
> > (77%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> > Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.inf
> > (64%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.i
> > nf (78%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiI
> > nit.inf (79%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiI
> > nit.inf (78%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> > mandLib/IpmiCommandLib.inf (80%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatfo
> > rmHookLibNull/IpmiPlatformHookLibNull.inf (74%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.inf
> > (79%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStat
> > us.inf (66%)
> > rename {Platform/Intel/AdvancedFeaturePkg/S3 =>
> > Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.inf (52%)
> > create mode 100644
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Smb
> > iosBasicDxe.inf
> > rename {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPassw
> > ordLibNull/PlatformPasswordLibNull.inf (88%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLi
> > b/UserPasswordLib.inf (91%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordU
> > iLib/UserPasswordUiLib.inf (91%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthentication2Dxe.inf (92%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxe.inf (93%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationSmm.inf (92%)
> > delete mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.in
> > f
> > delete mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicD
> > xe.inf
> > delete mode 100644
> >
> Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/
> > Usb3DebugPortParameterLibPcd.inf
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Include/Library/Usb3De
> > bugPortLib.h (100%)
> > rename
> >
> Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameter
> > Lib.h =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Include/Library/Usb3Deb
> > ugPortParamLib.h (100%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibInternal.h (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/Ip
> > miCommandLib.h (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Include/Library/Ip
> > miPlatformHookLib.h (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Sm
> > biosBasic.h (90%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Guid/UserAuth
> > entication.h (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/Platfor
> > mPasswordLib.h (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPa
> > sswordLib.h (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Include/Library/UserPa
> > sswordUiLib.h (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/KeyService.h (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthentication2Dxe.h (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxe.h (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxeFormset.h (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationSmm.h (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxeVfr.vfr (100%)
> > create mode 100644
> >
> Features/Intel/AdvancedFeaturePkg/TemporaryBuildWorkaround/Tempora
> > ryBuildWorkaround.c
> > rename {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> > Debug.c (90%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/MiscServices.c (100%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortDataTransfer.c (96%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortInitialize.c (96%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibDxe.c (95%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibDxeIoMmu.c (95%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibNull.c (100%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibPei.c (95%)
> > rename {Platform/Intel/DebugFeaturePkg =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg}/Library/Usb3DebugPortLi
> > b/Usb3DebugPortLibPeiIoMmu.c (95%)
> > rename
> >
> Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/
> > Usb3DebugPortParameterLibPcd.c =>
> >
> Features/Intel/Debugging/Usb3DebugFeaturePkg/Library/Usb3DebugPortP
> > aramLibPcd/Usb3DebugPortParamLibPcd.c (92%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcAcpi
> > .c (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcElog/BmcElog
> > .c (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> > Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbDxe.c
> > (95%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> > Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Frb/FrbPei.c
> (94%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiFru/IpmiFru.c
> > (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/DxeIpmiI
> > nit.c (93%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/IpmiInit/PeiIpmiI
> > nit.c (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> > mandLib/IpmiCommandLibNetFnApp.c (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> > mandLib/IpmiCommandLibNetFnChassis.c (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> > mandLib/IpmiCommandLibNetFnStorage.c (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiCom
> > mandLib/IpmiCommandLibNetFnTransport.c (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/Library/IpmiPlatfo
> > rmHookLibNull/IpmiPlatformHookLibNull.c (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/OsWdt/OsWdt.c
> > (94%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/SolStatus/SolStat
> > us.c (94%)
> > rename {Platform/Intel/AdvancedFeaturePkg/S3 =>
> > Features/Intel/PowerManagement/S3FeaturePkg/S3Pei}/S3Pei.c (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Sm
> > biosBasicEntryPoint.c (89%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> > e0BiosVendorFunction.c (95%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> > e1SystemManufacturerFunction.c (96%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> > e2BaseBoardManufacturerFunction.c (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> > e32BootInformationFunction.c (100%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Smbios =>
> >
> Features/Intel/SystemInformation/SmbiosFeaturePkg}/SmbiosBasicDxe/Typ
> > e3ChassisManufacturerFunction.c (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPassw
> > ordLibNull/PlatformPasswordLibNull.c (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordLi
> > b/UserPasswordLib.c (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/UserPasswordU
> > iLib/UserPasswordUiLib.c (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/KeyService.c (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthentication2Dxe.c (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxe.c (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxePassword.c (100%)
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationSmm.c (100%)
> > delete mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c
> > rename {Platform/Intel/DebugFeaturePkg/AcpiDebug =>
> >
> Features/Intel/Debugging/AcpiDebugFeaturePkg/AcpiDebugDxeSmm}/Acpi
> > Debug.asl (95%)
> > create mode 100644
> > Features/Intel/Debugging/AcpiDebugFeaturePkg/Readme.md
> > create mode 100644 Features/Intel/Debugging/Readme.md
> > create mode 100644
> > Features/Intel/Debugging/Usb3DebugFeaturePkg/Readme.md
> > create mode 100644
> > Features/Intel/Network/NetworkFeaturePkg/Readme.md
> > create mode 100644 Features/Intel/Network/Readme.md
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt
> > /BmcSsdt.asl (87%)
> > rename {Platform/Intel/AdvancedFeaturePkg/Ipmi =>
> >
> Features/Intel/OutOfBandManagement/IpmiFeaturePkg}/BmcAcpi/BmcSsdt
> > /IpmiOprRegions.asi (91%)
> > create mode 100644
> > Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Readme.md
> > create mode 100644 Features/Intel/OutOfBandManagement/Readme.md
> > create mode 100644 Features/Intel/PowerManagement/Readme.md
> > create mode 100644
> > Features/Intel/PowerManagement/S3FeaturePkg/Readme.md
> > create mode 100644 Features/Intel/Readme.md
> > create mode 100644 Features/Intel/SystemInformation/Readme.md
> > create mode 100644
> > Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md
> > create mode 100644 Features/Intel/TemplateFeaturePkg/Readme.md
> > create mode 100644 Features/Intel/UserInterface/Readme.md
> > rename {Platform/Intel/UserInterfaceFeaturePkg =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg}/Library/PlatformPassw
> > ordLibNull/PlatformPasswordLibNull.uni (100%)
> > create mode 100644
> > Features/Intel/UserInterface/UserAuthFeaturePkg/Readme.md
> > rename {Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication =>
> >
> Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe
> > Smm}/UserAuthenticationDxeStrings.uni (100%)
> > delete mode 100644
> > Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt
> >
> > --
> > 2.16.2.windows.1
>
^ permalink raw reply [flat|nested] 92+ messages in thread
end of thread, other threads:[~2019-11-27 20:54 UTC | newest]
Thread overview: 92+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-13 3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 01/49] AdvancedFeaturePkg: Package DSC style cleanup Kubacki, Michael A
2019-11-14 2:00 ` Chaganty, Rangasai V
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 02/49] DebugFeaturePkg: " Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 03/49] UserInterfaceFeaturePkg: " Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 04/49] Features/Intel: Add Readme.md Kubacki, Michael A
2019-11-15 23:47 ` Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 05/49] Features/Intel/PowerManagement: " Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 06/49] Features/Intel/OutOfBandManagement: " Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 07/49] Features/Intel/SystemInformation: " Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 08/49] Features/Intel/Debug: " Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 09/49] Features/Intel/UserInterface: " Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 10/49] Features/Intel/Network: " Kubacki, Michael A
2019-11-15 23:47 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 11/49] TemplateFeaturePkg: Add initial package Kubacki, Michael A
2019-11-15 23:48 ` Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 12/49] SimicsOpenBoardPkg: Remove advanced feature references Kubacki, Michael A
2019-11-15 23:48 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 13/49] AdvancedFeaturePkg: Remove the S3 feature Kubacki, Michael A
2019-11-15 23:48 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 14/49] Features/Intel: Add S3FeaturePkg Kubacki, Michael A
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 15/49] AdvancedFeaturePkg: Remove the IPMI feature Kubacki, Michael A
2019-11-15 23:48 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 16/49] Features/Intel/IpmiFeaturePkg: Add initial package Kubacki, Michael A
2019-11-15 23:48 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 17/49] Features/Intel/IpmiFeaturePkg: Add libraries Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 18/49] Features/Intel/IpmiFeaturePkg: Add modules Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 19/49] AdvancedFeaturePkg: Remove the SMBIOS feature Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 20/49] Features/Intel/SmbiosFeaturePkg: Add initial package Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 21/49] Features/Intel/SmbiosFeaturePkg: Update default strings Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 22/49] DebugFeaturePkg: Remove the ACPI Debug feature Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 23/49] Features/Intel/AcpiDebugFeaturePkg: Add initial package Kubacki, Michael A
2019-11-15 23:49 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 25/49] Features/Intel/Usb3DebugFeaturePkg: " Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 26/49] UserInterfaceFeaturePkg: Remove the User Authentication feature Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 27/49] Features/Intel/UserAuthFeaturePkg: Add initial package Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 28/49] Features/Intel/NetworkFeaturePkg: " Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 29/49] AdvancedFeaturePkg: Remove remaining contents Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 30/49] AdvancedFeaturePkg: Move to Features/Intel Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 31/49] AdvancedFeaturePkg: Add feature build support Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 32/49] AdvancedFeaturePkg: Add temporary build workaround Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:27 ` [edk2-platforms][PATCH V1 33/49] AdvancedFeaturePkg: Add FDF include files Kubacki, Michael A
2019-11-15 23:50 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 34/49] KabylakeOpenBoardPkg/KabylakeRvp3: Add PEI_ARCH and DXE_ARCH Kubacki, Michael A
2019-11-15 23:51 ` Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 35/49] KabylakeOpenBoardPkg/GalagoPro3: " Kubacki, Michael A
2019-11-15 23:51 ` Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 36/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: " Kubacki, Michael A
2019-11-15 23:51 ` Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 37/49] SimicsOpenBoardPkg/BoardX58Ich10: Use " Kubacki, Michael A
2019-11-15 23:51 ` [edk2-devel] " Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 38/49] MinPlatformPkg: Add FvAdvancedPreMemory Kubacki, Michael A
2019-11-15 23:51 ` Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 39/49] KabylakeOpenBoardPkg/KabylakeRvp3: " Kubacki, Michael A
2019-11-16 0:34 ` Nate DeSimone
2019-11-13 3:28 ` [edk2-platforms][PATCH V1 40/49] KabylakeOpenBoardPkg/GalagoPro3: " Kubacki, Michael A
2019-11-16 0:34 ` Nate DeSimone
2019-11-15 23:47 ` [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Nate DeSimone
[not found] ` <20191113032816.4056-42-michael.a.kubacki@intel.com>
2019-11-16 0:34 ` [edk2-platforms][PATCH V1 41/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add FvAdvancedPreMemory Nate DeSimone
[not found] ` <20191113032816.4056-43-michael.a.kubacki@intel.com>
2019-11-16 0:34 ` [edk2-platforms][PATCH V1 42/49] Platform/Intel: Add advanced feature build support Nate DeSimone
[not found] ` <20191113032816.4056-44-michael.a.kubacki@intel.com>
2019-11-16 0:34 ` [edk2-platforms][PATCH V1 43/49] Platform/Intel/Readme.md Content update Nate DeSimone
[not found] ` <20191113032816.4056-45-michael.a.kubacki@intel.com>
2019-11-16 0:34 ` [edk2-platforms][PATCH V1 44/49] KabylakeOpenBoardPkg/GalagoPro3: Enable advanced features Nate DeSimone
[not found] ` <20191113032816.4056-46-michael.a.kubacki@intel.com>
2019-11-16 0:34 ` [edk2-platforms][PATCH V1 45/49] KabylakeOpenBoardPkg/KabylakeRvp3: " Nate DeSimone
[not found] ` <20191113032816.4056-47-michael.a.kubacki@intel.com>
2019-11-16 0:34 ` [edk2-platforms][PATCH V1 46/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: " Nate DeSimone
[not found] ` <20191113032816.4056-49-michael.a.kubacki@intel.com>
2019-11-16 0:34 ` [edk2-platforms][PATCH V1 48/49] MinPlatformPkg: Install advanced feature FVs by stage enabled Nate DeSimone
2019-11-18 8:40 ` [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Dandan Bi
2019-11-27 20:54 ` Kubacki, Michael A
-- strict thread matches above, loose matches on Subject: below --
2019-11-13 4:37 [edk2-platforms][PATCH V1 24/49] DebugFeaturePkg: Remove the USB3 Debug feature Kubacki, Michael A
2019-11-13 4:37 ` [edk2-platforms][PATCH V1 41/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add FvAdvancedPreMemory Kubacki, Michael A
2019-11-16 0:35 ` Nate DeSimone
[not found] <20191113040657.38540-1-michael.a.kubacki@intel.com>
[not found] ` <20191113040657.38540-2-michael.a.kubacki@intel.com>
2019-11-16 0:35 ` Nate DeSimone
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox