public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Dong, Eric" <eric.dong@intel.com>
Subject: Re: [edk2-devel] [edk2-platform][PATCH] Platform/Intel: Remove deprecated packages
Date: Sat, 9 May 2020 01:52:48 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C530936@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20200509004548.1535-1-eric.dong@intel.com>

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Dong, Eric
> Sent: Saturday, May 9, 2020 8:46 AM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [edk2-platform][PATCH] Platform/Intel: Remove deprecated packages
> 
> After moving the AdvancedFeaturePkg, UserInterfaceFeaturePkg
> and DebugFeaturePkg to Features/Intel Package, remove deprecated
> packages in Platform/Intel folder.
> 
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
>  .../AdvancedFeaturePkg/AdvancedFeaturePkg.dec | 153 ---
>  .../AdvancedFeaturePkg/AdvancedFeaturePkg.dsc | 165 ----
>  .../Include/Dsc/CoreAdvancedDxeInclude.dsc    |  19 -
>  .../Include/Dsc/CoreAdvancedPeiInclude.dsc    |   9 -
>  .../Include/Fdf/CoreAdvancedLateInclude.fdf   |  20 -
>  .../Fdf/CoreAdvancedPostMemoryInclude.fdf     |   8 -
>  .../Fdf/CoreAdvancedPreMemoryInclude.fdf      |   9 -
>  .../AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c | 257 -----
>  .../Ipmi/BmcAcpi/BmcAcpi.inf                  |  48 -
>  .../Ipmi/BmcAcpi/BmcSsdt/BmcSsdt.asl          |  28 -
>  .../Ipmi/BmcAcpi/BmcSsdt/IpmiOprRegions.asi   |  58 --
>  .../AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c | 236 -----
>  .../Ipmi/BmcElog/BmcElog.inf                  |  34 -
>  .../AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c      | 236 -----
>  .../AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf    |  37 -
>  .../AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c      |  84 --
>  .../AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf    |  37 -
>  .../Ipmi/Include/Library/IpmiCommandLib.h     | 235 -----
>  .../Include/Library/IpmiPlatformHookLib.h     |  23 -
>  .../AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c |  67 --
>  .../Ipmi/IpmiFru/IpmiFru.inf                  |  35 -
>  .../Ipmi/IpmiInit/DxeIpmiInit.c               | 150 ---
>  .../Ipmi/IpmiInit/DxeIpmiInit.inf             |  34 -
>  .../Ipmi/IpmiInit/PeiIpmiInit.c               |  96 --
>  .../Ipmi/IpmiInit/PeiIpmiInit.inf             |  32 -
>  .../Library/IpmiCommandLib/IpmiCommandLib.inf |  32 -
>  .../IpmiCommandLib/IpmiCommandLibNetFnApp.c   | 248 -----
>  .../IpmiCommandLibNetFnChassis.c              | 101 --
>  .../IpmiCommandLibNetFnStorage.c              | 275 ------
>  .../IpmiCommandLibNetFnTransport.c            |  81 --
>  .../Ipmi/Library/IpmiLibNull/IpmiLibNull.c    |  45 -
>  .../Ipmi/Library/IpmiLibNull/IpmiLibNull.inf  |  28 -
>  .../IpmiPlatformHookLibNull.c                 |  36 -
>  .../IpmiPlatformHookLibNull.inf               |  29 -
>  .../AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c     | 112 ---
>  .../AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf   |  34 -
>  .../Ipmi/SolStatus/SolStatus.c                | 164 ----
>  .../Ipmi/SolStatus/SolStatus.inf              |  38 -
>  Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c  |  36 -
>  .../Intel/AdvancedFeaturePkg/S3/S3Pei.inf     |  31 -
>  .../Smbios/SmbiosBasicDxe/SmbiosBasic.h       |  45 -
>  .../Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf  |  83 --
>  .../SmbiosBasicDxe/SmbiosBasicEntryPoint.c    | 125 ---
>  .../SmbiosBasicDxe/Type0BiosVendorFunction.c  |  81 --
>  .../Type1SystemManufacturerFunction.c         | 114 ---
>  .../Type2BaseBoardManufacturerFunction.c      | 131 ---
>  .../Type32BootInformationFunction.c           |  56 --
>  .../Type3ChassisManufacturerFunction.c        | 125 ---
>  .../DebugFeaturePkg/AcpiDebug/AcpiDebug.asl   | 103 --
>  .../DebugFeaturePkg/AcpiDebug/AcpiDebug.c     | 523 ----------
>  .../AcpiDebug/AcpiDebugDxe.inf                |  57 --
>  .../AcpiDebug/AcpiDebugSmm.inf                |  59 --
>  .../DebugFeaturePkg/AcpiDebug/Readme.txt      |  31 -
>  .../Intel/DebugFeaturePkg/DebugFeaturePkg.dec |  66 --
>  .../Intel/DebugFeaturePkg/DebugFeaturePkg.dsc | 120 ---
>  .../Include/Library/Usb3DebugPortLib.h        |  71 --
>  .../Library/Usb3DebugPortParameterLib.h       |  56 --
>  .../Library/Usb3DebugPortLib/MiscServices.c   | 385 --------
>  .../Usb3DebugPortDataTransfer.c               | 892 ------------------
>  .../Usb3DebugPortInitialize.c                 | 726 --------------
>  .../Usb3DebugPortLib/Usb3DebugPortLibDxe.c    | 454 ---------
>  .../Usb3DebugPortLib/Usb3DebugPortLibDxe.inf  |  55 --
>  .../Usb3DebugPortLibDxeIoMmu.c                | 828 ----------------
>  .../Usb3DebugPortLibDxeIoMmu.inf              |  63 --
>  .../Usb3DebugPortLibInternal.h                | 887 -----------------
>  .../Usb3DebugPortLib/Usb3DebugPortLibNull.c   | 103 --
>  .../Usb3DebugPortLib/Usb3DebugPortLibNull.inf |  28 -
>  .../Usb3DebugPortLib/Usb3DebugPortLibPei.c    | 236 -----
>  .../Usb3DebugPortLib/Usb3DebugPortLibPei.inf  |  48 -
>  .../Usb3DebugPortLibPeiIoMmu.c                | 440 ---------
>  .../Usb3DebugPortLibPeiIoMmu.inf              |  51 -
>  .../Usb3DebugPortParameterLibPcd.c            |  58 --
>  .../Usb3DebugPortParameterLibPcd.inf          |  31 -
>  .../Include/Guid/UserAuthentication.h         |  45 -
>  .../Include/Library/PlatformPasswordLib.h     |  48 -
>  .../Include/Library/UserPasswordLib.h         |  70 --
>  .../Include/Library/UserPasswordUiLib.h       |  37 -
>  .../PlatformPasswordLibNull.c                 |  78 --
>  .../PlatformPasswordLibNull.inf               |  39 -
>  .../PlatformPasswordLibNull.uni               |  19 -
>  .../Library/UserPasswordLib/UserPasswordLib.c | 274 ------
>  .../UserPasswordLib/UserPasswordLib.inf       |  37 -
>  .../UserPasswordUiLib/UserPasswordUiLib.c     | 522 ----------
>  .../UserPasswordUiLib/UserPasswordUiLib.inf   |  41 -
>  .../UserAuthentication/KeyService.c           | 133 ---
>  .../UserAuthentication/KeyService.h           |  88 --
>  .../UserAuthentication2Dxe.c                  | 484 ----------
>  .../UserAuthentication2Dxe.h                  |  55 --
>  .../UserAuthentication2Dxe.inf                |  53 --
>  .../UserAuthenticationDxe.c                   | 780 ---------------
>  .../UserAuthenticationDxe.h                   | 138 ---
>  .../UserAuthenticationDxe.inf                 |  63 --
>  .../UserAuthenticationDxeFormset.h            |  23 -
>  .../UserAuthenticationDxePassword.c           | 319 -------
>  .../UserAuthenticationDxeStrings.uni          |  30 -
>  .../UserAuthenticationDxeVfr.vfr              |  39 -
>  .../UserAuthenticationSmm.c                   | 674 -------------
>  .../UserAuthenticationSmm.h                   |  52 -
>  .../UserAuthenticationSmm.inf                 |  53 --
>  .../UserInterfaceFeaturePkg.dec               |  45 -
>  .../UserInterfaceFeaturePkg.dsc               | 101 --
>  101 files changed, 14871 deletions(-)
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
>  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/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
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/BmcSsdt.asl
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOprRegions.asi
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiCommandLib.h
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiPlatformHookLib.h
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLib.inf
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c
>  delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf
>  delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c
>  delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.inf
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntryPoint.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendorFunction.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManufacturerFunction.c
>  delete mode 100644
> Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInformationFunction.c
>  delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameterLib.h
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c
>  delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
>  delete mode 100644
> Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.c
>  delete mode 100644
> Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthentication.h
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Include/Library/PlatformPasswordLib.h
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordLib.h
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordUiLib.h
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c
>  delete mode 100644
> Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf
>  delete mode 100644
> Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.c
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.c
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.c
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.h
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.h
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.c
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.h
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeFormset.h
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxePassword.c
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeStrings.uni
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxeVfr.vfr
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.c
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.h
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec
>  delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc
> 
> diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
> b/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
> deleted file mode 100644
> index 44e5de64db..0000000000
> --- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec
> +++ /dev/null
> @@ -1,153 +0,0 @@
> -## @file
> 
> -# This package provides the modules that build for a full feature platform.
> 
> -# This AdvancedFeaturePkg 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) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
> 
> -#
> 
> -# 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
> 
> -Ipmi/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|0x8001200
> 0 {
> 
> -    <HeaderFiles>
> 
> -      IndustryStandard/SmBios.h
> 
> -    <Packages>
> 
> -      MdePkg/MdePkg.dec
> 
> -      AdvancedFeaturePkg/AdvancedFeaturePkg.dec
> 
> -  }
> 
> -
> gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation.BootStatus|BootInformationStatusNoErr
> or
> 
> -
> 
> -[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
> deleted file mode 100644
> index b83e72b48c..0000000000
> --- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
> +++ /dev/null
> @@ -1,165 +0,0 @@
> -## @file
> 
> -#  Advanced Feature Package build description file.
> 
> -#
> 
> -# Copyright (c) 2017 - 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]
> 
> -  PLATFORM_NAME                       = AdvancedFeaturePkg
> 
> -  PLATFORM_GUID                       = 5E4C05BC-C5F0-4843-BAE1-3AAFE269DB8F
> 
> -  PLATFORM_VERSION                    = 0.1
> 
> -  DSC_SPECIFICATION                   = 0x00010005
> 
> -  OUTPUT_DIRECTORY                    = Build/AdvancedFeaturePkg
> 
> -  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]
> 
> -  #######################################
> 
> -  # Edk2 Packages
> 
> -  #######################################
> 
> -  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
> 
> -
> 
> -  #######################################
> 
> -  # Silicon Initialization Package
> 
> -  #######################################
> 
> -  SmmAccessLib|IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.inf
> 
> -
> 
> -
> [LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE,LibraryC
> lasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRIVER,LibraryClasses.common.UEFI_DRIVER,LibraryCla
> sses.common.UEFI_APPLICATION]
> 
> -  #######################################
> 
> -  # Edk2 Packages
> 
> -  #######################################
> 
> -  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.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
> 
> -
> 
> -###################################################################################################
> 
> -#
> 
> -# 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.
> 
> -  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/S3/S3Pei.inf
> 
> -  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
> deleted file mode 100644
> index fceaadc100..0000000000
> --- a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.dsc
> +++ /dev/null
> @@ -1,19 +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
> 
> -
> 
> -!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable == TRUE
> 
> -  MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
> 
> -!endif
> 
> -
> 
> 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 d980e673a8..0000000000
> --- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.fdf
> +++ /dev/null
> @@ -1,20 +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
> 
> -
> 
> -!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable == TRUE
> 
> -INF  MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
> 
> -!endif
> 
> -
> 
> -
> 
> 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
> 
> -#
> 
> -##
> 
> -
> 
> 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/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/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)
> 
> -
> 
> -
> 
> 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/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.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/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.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/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/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/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/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.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/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.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/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/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/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.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/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.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/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.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/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/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;
> 
> -}
> 
> 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/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/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/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;
> 
> -}
> 
> 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/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/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/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)
> 
> -    }
> 
> -
> 
> diff --git a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec
> deleted file mode 100644
> index 37ebe6da4d..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec
> +++ /dev/null
> @@ -1,66 +0,0 @@
> -## @file
> 
> -# This package provides the modules that build for debug feature.
> 
> -# This DebugFeaturePkg 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]
> 
> -  DEC_SPECIFICATION              = 0x00010005
> 
> -  PACKAGE_NAME                   = DebugFeaturePkg
> 
> -  PACKAGE_GUID                   = 58B6F2BB-A94F-4EB9-89DA-2F06ED59CE39
> 
> -  PACKAGE_VERSION                = 0.1
> 
> -
> 
> -[Includes]
> 
> -  Include
> 
> -
> 
> -[LibraryClasses]
> 
> -  ##  @libraryclass    Provide capability to get/set USB3 debug port parameter.
> 
> -  Usb3DebugPortParameterLib|Include/Library/Usb3DebugPortParameterLib.h
> 
> -
> 
> -  ##  @libraryclass    Provide common USB3 debug port functions.
> 
> -  Usb3DebugPortLib|Include/Library/Usb3DebugPortLib.h
> 
> -
> 
> -[Guids]
> 
> -  gDebugFeaturePkgTokenSpaceGuid      = { 0xdbf3ac70, 0x3f73, 0x40aa, { 0xbd, 0xd6, 0xac, 0xf2, 0x1a, 0x1b, 0x2f, 0xe2 } }
> 
> -
> 
> -[PcdsFixedAtBuild]
> 
> -  ## These PCD specify XHCI controller Bus/Device/Function, which are used to enable
> 
> -  #  XHCI debug device.
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciBus|0x00|UINT8|0x00000001
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciDev|0x14|UINT8|0x00000002
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciFunc|0x00|UINT8|0x00000003
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress|0xFEA10000|UINT32|0x00000004
> 
> -
> 
> -  ## 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.
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout|2000000|UINT64|0x00000005
> 
> -
> 
> -  ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes space.
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortBusIndex|0x59|UINT8|0x00000006
> 
> -  ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes space.
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortDeviceIndex|0x5A|UINT8|0x00000007
> 
> -  ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes space.
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortFunctionIndex|0x5B|UINT8|0x00000008
> 
> -
> 
> -[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx]
> 
> -  ## This PCD specifies AcpiDebug feature is enable/disable.
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable|FALSE|BOOLEAN|0x00000009
> 
> -  ## This PCD specifies AcpiDebug buffer size.
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize|0x10000|UINT32|0x0000000A
> 
> -
> 
> -[PcdsDynamic, PcdsDynamicEx]
> 
> -  ## This PCD specifies AcpiDebug buffer address
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress|0|UINT32|0x0000000B
> 
> -
> 
> -[PcdsFeatureFlag]
> 
> -  ## This PCD specifies whether StatusCode is reported via USB3 Serial port.
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseUsb3Serial|TRUE|BOOLEAN|0x0000000C
> 
> diff --git a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
> deleted file mode 100644
> index efe705bd76..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
> +++ /dev/null
> @@ -1,120 +0,0 @@
> -## @file
> 
> -# This package provides the modules that build for debug feature.
> 
> -# 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                  = DebugFeaturePkg
> 
> -  PLATFORM_GUID                  = 3A0DBEF4-3C16-4F6B-8B55-BABB260D30B9
> 
> -  PLATFORM_VERSION               = 0.1
> 
> -  DSC_SPECIFICATION              = 0x00010005
> 
> -  OUTPUT_DIRECTORY               = Build/DebugFeaturePkg
> 
> -  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
> 
> -  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.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
> 
> -
> 
> -###################################################################################################
> 
> -#
> 
> -# 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]
> 
> -  #######################################
> 
> -  # 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/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
> 
> -
> 
> -[BuildOptions]
> 
> -  *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
> 
> diff --git a/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h
> b/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h
> deleted file mode 100644
> index 0bee2b63dd..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h
> +++ /dev/null
> @@ -1,71 +0,0 @@
> -/** @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/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameterLib.h
> b/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameterLib.h
> deleted file mode 100644
> index 167c607e9f..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameterLib.h
> +++ /dev/null
> @@ -1,56 +0,0 @@
> -/** @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/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c
> deleted file mode 100644
> index cb29a880e6..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c
> +++ /dev/null
> @@ -1,385 +0,0 @@
> -/** @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/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c
> deleted file mode 100644
> index 53478a49b8..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortDataTransfer.c
> +++ /dev/null
> @@ -1,892 +0,0 @@
> -/** @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/Usb3DebugPortParameterLib.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/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c
> deleted file mode 100644
> index dbdae59253..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortInitialize.c
> +++ /dev/null
> @@ -1,726 +0,0 @@
> -/** @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/Usb3DebugPortParameterLib.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/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c
> deleted file mode 100644
> index 8c3dd999db..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.c
> +++ /dev/null
> @@ -1,454 +0,0 @@
> -/** @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/Usb3DebugPortParameterLib.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 (PcdStatusCodeUseUsb3Serial)) {
> 
> -    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/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
> deleted file mode 100644
> index e238fa0de9..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf
> +++ /dev/null
> @@ -1,55 +0,0 @@
> -## @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
> 
> -  DebugFeaturePkg/DebugFeaturePkg.dec
> 
> -
> 
> -[LibraryClasses]
> 
> -  BaseLib
> 
> -  PcdLib
> 
> -  IoLib
> 
> -  PciLib
> 
> -  TimerLib
> 
> -  UefiBootServicesTableLib
> 
> -  UefiLib
> 
> -  HobLib
> 
> -  Usb3DebugPortParameterLib
> 
> -
> 
> -[Protocols]
> 
> -  gEfiSmmAccess2ProtocolGuid                       ## CONSUMES
> 
> -  gEfiSmmBase2ProtocolGuid                         ## CONSUMES
> 
> -
> 
> -[Pcd]
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress     ## SOMETIMES_CONSUMES
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout        ## CONSUMES
> 
> -
> 
> -[FeaturePcd]
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseUsb3Serial    ## CONSUMES
> 
> diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c
> deleted file mode 100644
> index 97c3f88113..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.c
> +++ /dev/null
> @@ -1,828 +0,0 @@
> -/** @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/Usb3DebugPortParameterLib.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 (PcdStatusCodeUseUsb3Serial)) {
> 
> -    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/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf
> deleted file mode 100644
> index c9c56d7ade..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf
> +++ /dev/null
> @@ -1,63 +0,0 @@
> -## @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
> 
> -  DebugFeaturePkg/DebugFeaturePkg.dec
> 
> -
> 
> -[LibraryClasses]
> 
> -  BaseLib
> 
> -  PcdLib
> 
> -  IoLib
> 
> -  PciLib
> 
> -  TimerLib
> 
> -  UefiBootServicesTableLib
> 
> -  UefiLib
> 
> -  HobLib
> 
> -  Usb3DebugPortParameterLib
> 
> -
> 
> -[Protocols]
> 
> -  gEfiSmmAccess2ProtocolGuid                       ## CONSUMES
> 
> -  gEfiSmmBase2ProtocolGuid                         ## CONSUMES
> 
> -   ## NOTIFY
> 
> -   ## SOMETIMES_CONSUMES
> 
> -  gEfiPciIoProtocolGuid
> 
> -  gEdkiiIoMmuProtocolGuid                          ## SOMETIMES_CONSUMES
> 
> -   ## NOTIFY
> 
> -  gEfiDxeSmmReadyToLockProtocolGuid
> 
> -
> 
> -[Pcd]
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress     ## SOMETIMES_CONSUMES
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout        ## CONSUMES
> 
> -
> 
> -[FeaturePcd]
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseUsb3Serial    ## CONSUMES
> 
> diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h
> deleted file mode 100644
> index 3641cc1d52..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibInternal.h
> +++ /dev/null
> @@ -1,887 +0,0 @@
> -/** @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/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c
> deleted file mode 100644
> index 319cebecbb..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.c
> +++ /dev/null
> @@ -1,103 +0,0 @@
> -/** @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/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
> deleted file mode 100644
> index f632150c26..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -## @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/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c
> deleted file mode 100644
> index a1e0bdbf6d..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.c
> +++ /dev/null
> @@ -1,236 +0,0 @@
> -/** @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/Usb3DebugPortParameterLib.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/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf
> deleted file mode 100644
> index 0edde82769..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf
> +++ /dev/null
> @@ -1,48 +0,0 @@
> -## @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
> 
> -  DebugFeaturePkg/DebugFeaturePkg.dec
> 
> -
> 
> -[LibraryClasses]
> 
> -  BaseLib
> 
> -  PcdLib
> 
> -  IoLib
> 
> -  PciLib
> 
> -  TimerLib
> 
> -  HobLib
> 
> -  Usb3DebugPortParameterLib
> 
> -  PeiServicesTablePointerLib
> 
> -
> 
> -[Ppis]
> 
> -  gEfiPeiMemoryDiscoveredPpiGuid                ## CONSUMES
> 
> -
> 
> -[Pcd]
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress         ## SOMETIMES_CONSUMES
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout            ## CONSUMES
> 
> diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c
> deleted file mode 100644
> index 68543c8562..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.c
> +++ /dev/null
> @@ -1,440 +0,0 @@
> -/** @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/Usb3DebugPortParameterLib.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/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
> deleted file mode 100644
> index f27c23faab..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -## @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
> 
> -  DebugFeaturePkg/DebugFeaturePkg.dec
> 
> -
> 
> -[LibraryClasses]
> 
> -  BaseLib
> 
> -  PcdLib
> 
> -  IoLib
> 
> -  PciLib
> 
> -  TimerLib
> 
> -  HobLib
> 
> -  Usb3DebugPortParameterLib
> 
> -  PeiServicesTablePointerLib
> 
> -
> 
> -[Ppis]
> 
> -  gEfiPeiMemoryDiscoveredPpiGuid                ## CONSUMES
> 
> -  gEdkiiIoMmuPpiGuid                            ## SOMETIMES_CONSUMES
> 
> -
> 
> -[Pcd]
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress         ## SOMETIMES_CONSUMES
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout            ## CONSUMES
> 
> diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.c
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.c
> deleted file mode 100644
> index 747c5dccc9..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.c
> +++ /dev/null
> @@ -1,58 +0,0 @@
> -/** @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/Usb3DebugPortParameterLib.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/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf
> b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf
> deleted file mode 100644
> index 09f44920f6..0000000000
> --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -## @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                      = Usb3DebugPortParameterLibPcd
> 
> -  FILE_GUID                      = 4990A700-4002-4d08-8E00-622720032662
> 
> -  MODULE_TYPE                    = BASE
> 
> -  VERSION_STRING                 = 1.0
> 
> -  LIBRARY_CLASS                  = Usb3DebugPortParameterLib
> 
> -
> 
> -[Sources]
> 
> -  Usb3DebugPortParameterLibPcd.c
> 
> -
> 
> -[LibraryClasses]
> 
> -  BaseLib
> 
> -  DebugLib
> 
> -
> 
> -[Packages]
> 
> -  MdePkg/MdePkg.dec
> 
> -  DebugFeaturePkg/DebugFeaturePkg.dec
> 
> -
> 
> -[Pcd]
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciBus     ## CONSUMES
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciDev     ## CONSUMES
> 
> -  gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciFunc    ## CONSUMES
> 
> 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/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/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/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/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/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.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/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/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/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.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/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/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.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/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/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/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/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/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 ""
> 
> -
> 
> 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/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/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/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/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
> 
> --
> 2.23.0.windows.1
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> 
> View/Reply Online (#58925): https://edk2.groups.io/g/devel/message/58925
> Mute This Topic: https://groups.io/mt/74087549/1712937
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub  [ray.ni@intel.com]
> -=-=-=-=-=-=


      reply	other threads:[~2020-05-09  1:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09  0:45 [edk2-platform][PATCH] Platform/Intel: Remove deprecated packages Dong, Eric
2020-05-09  1:52 ` Ni, Ray [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=734D49CCEBEEF84792F5B80ED585239D5C530936@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox