From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web11.3277.1588989179085523247 for ; Fri, 08 May 2020 18:52:59 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: ray.ni@intel.com) IronPort-SDR: 1AOQAXLp8NiY42n/AdWb8pmgH7cXGz3epsHHQIqbq3UDPCFe9au/wxHWFktZBqLhXXTeEw2VKC CUuy+b1mMB5Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2020 18:52:57 -0700 IronPort-SDR: qIh2NIDuPR62cJBo/6B5gMvjIYMh2UpRUt63obZq5/7iaEN0N5LwrP8tRDPE4cm7DmPhE1WvE8 aAKpUTaxP64Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,369,1583222400"; d="scan'208";a="285658539" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 08 May 2020 18:52:56 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 8 May 2020 18:52:55 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 8 May 2020 18:52:55 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.210]) by shsmsx102.ccr.corp.intel.com ([169.254.2.38]) with mapi id 14.03.0439.000; Sat, 9 May 2020 09:52:50 +0800 From: "Ni, Ray" To: "devel@edk2.groups.io" , "Dong, Eric" Subject: Re: [edk2-devel] [edk2-platform][PATCH] Platform/Intel: Remove deprecated packages Thread-Topic: [edk2-devel] [edk2-platform][PATCH] Platform/Intel: Remove deprecated packages Thread-Index: AQHWJZtFf4/OWgn01UCqKZz+BLkzIaie/XgA Date: Sat, 9 May 2020 01:52:48 +0000 Deferred-Delivery: Sat, 9 May 2020 01:52:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C530936@SHSMSX104.ccr.corp.intel.com> References: <20200509004548.1535-1-eric.dong@intel.com> In-Reply-To: <20200509004548.1535-1-eric.dong@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: 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 depre= cated packages >=20 > After moving the AdvancedFeaturePkg, UserInterfaceFeaturePkg > and DebugFeaturePkg to Features/Intel Package, remove deprecated > packages in Platform/Intel folder. >=20 > Signed-off-by: Eric Dong > --- > .../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/CoreAdv= ancedDxeInclude.dsc > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdv= ancedPeiInclude.dsc > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdv= ancedLateInclude.fdf > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdv= ancedPostMemoryInclude.fdf > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdv= ancedPreMemoryInclude.fdf > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcp= i.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcp= i.inf > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsd= t/BmcSsdt.asl > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsd= t/IpmiOprRegions.asi > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElo= g.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElo= g.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/Librar= y/IpmiCommandLib.h > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Librar= y/IpmiPlatformHookLib.h > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFr= u.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFr= u.inf > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIp= miInit.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIp= miInit.inf > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIp= miInit.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIp= miInit.inf > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCo= mmandLib/IpmiCommandLib.inf > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCo= mmandLib/IpmiCommandLibNetFnApp.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCo= mmandLib/IpmiCommandLibNetFnChassis.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCo= mmandLib/IpmiCommandLibNetFnStorage.c > delete mode 100644 > Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCommand= LibNetFnTransport.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLi= bNull/IpmiLibNull.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLi= bNull/IpmiLibNull.inf > delete mode 100644 > Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/Ip= miPlatformHookLibNull.c > delete mode 100644 > Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/Ip= miPlatformHookLibNull.inf > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.in= f > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolS= tatus.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolS= tatus.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/SmbiosBasicD= xe/SmbiosBasic.h > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicD= xe/SmbiosBasicDxe.inf > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicD= xe/SmbiosBasicEntryPoint.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicD= xe/Type0BiosVendorFunction.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicD= xe/Type1SystemManufacturerFunction.c > delete mode 100644 > Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardMan= ufacturerFunction.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicD= xe/Type32BootInformationFunction.c > delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicD= xe/Type3ChassisManufacturerFunction.c > delete mode 100644 Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.as= l > 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/Usb3De= bugPortLib.h > delete mode 100644 Platform/Intel/DebugFeaturePkg/Include/Library/Usb3De= bugPortParameterLib.h > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/MiscServices.c > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortDataTransfer.c > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortInitialize.c > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortLibDxe.c > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortLibDxe.inf > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortLibDxeIoMmu.c > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortLibDxeIoMmu.inf > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortLibInternal.h > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortLibNull.c > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortLibNull.inf > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortLibPei.c > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortLibPei.inf > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortLibPeiIoMmu.c > delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortLibPeiIoMmu.inf > delete mode 100644 > Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3D= ebugPortParameterLibPcd.c > delete mode 100644 > Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3D= ebugPortParameterLibPcd.inf > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/U= serAuthentication.h > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Include/Librar= y/PlatformPasswordLib.h > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Include/Librar= y/UserPasswordLib.h > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Include/Librar= y/UserPasswordUiLib.h > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/Platfo= rmPasswordLibNull/PlatformPasswordLibNull.c > delete mode 100644 > Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/Pl= atformPasswordLibNull.inf > delete mode 100644 > Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/Pl= atformPasswordLibNull.uni > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/UserPa= sswordLib/UserPasswordLib.c > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/UserPa= sswordLib/UserPasswordLib.inf > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/UserPa= sswordUiLib/UserPasswordUiLib.c > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/UserPa= sswordUiLib/UserPasswordUiLib.inf > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/KeyService.c > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/KeyService.h > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthentication2Dxe.c > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthentication2Dxe.h > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthentication2Dxe.inf > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationDxe.c > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationDxe.h > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationDxe.inf > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationDxeFormset.h > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationDxePassword.c > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationDxeStrings.uni > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationDxeVfr.vfr > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationSmm.c > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationSmm.h > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationSmm.inf > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceF= eaturePkg.dec > delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceF= eaturePkg.dsc >=20 > 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 >=20 > -# This package provides the modules that build for a full feature platfo= rm. >=20 > -# This AdvancedFeaturePkg should only depend on EDKII Core packages and = MinPlatformPkg. >=20 > -# >=20 > -# The DEC files are used by the utilities that parse DSC and >=20 > -# INF files to generate AutoGen.c and AutoGen.h files >=20 > -# for the build infrastructure. >=20 > -# >=20 > -# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > - >=20 > -[Defines] >=20 > -DEC_SPECIFICATION =3D 0x00010017 >=20 > -PACKAGE_NAME =3D AdvancedFeaturePkg >=20 > -PACKAGE_VERSION =3D 0.1 >=20 > -PACKAGE_GUID =3D 290127D9-ABED-4DD8-A35D-73DCB4261BCB >=20 > - >=20 > - >=20 > -[Includes] >=20 > -Include >=20 > -Ipmi/Include >=20 > - >=20 > -[Guids] >=20 > -gAdvancedFeaturePkgTokenSpaceGuid =3D {0xa8514688, 0x6693, 0x4a= b5, {0xaa, 0xc8, 0xcc, 0xa9, 0x8d, 0xde, 0x90, > 0xe1}} >=20 > - >=20 > -[PcdsDynamic, PcdsDynamicEx] >=20 > - >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation|{0x0}|= SMBIOS_TABLE_TYPE0|0x80010000 { >=20 > - >=20 > - IndustryStandard/SmBios.h >=20 > - >=20 > - MdePkg/MdePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - } >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.Vendor= |0x1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosVe= rsion|0x2 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSe= gment|0xF000 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosRe= leaseDate|0x3 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSi= ze|0xFF >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.PciIsSupported|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.PlugAndPlayIsSupported|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.BiosIsUpgradable|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.BiosShadowingAllowed|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.BootFromCdIsSupported|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.SelectableBootIsSupported|1 >=20 > - > gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.EDDSpecificationIsSupported|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.Floppy525_12IsSupported|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.Floppy35_720IsSupported|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.Floppy35_288IsSupported|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.PrintScreenIsSupported|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.Keyboard8042IsSupported|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.SerialIsSupported|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.PrinterIsSupported|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCh= aracteristics.CgaMonoIsSupported|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCh= aracteristicsExtensionBytes[0]|0x33 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCh= aracteristicsExtensionBytes[1]|0x0F >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor|"Intel Co= rporation"|VOID*|0x80010001 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"PUR= LEY CV/CRB BIOS > Internal"|VOID*|0x80010002 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|= "2008-12-23"|VOID*|0x80010003 >=20 > - >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation|{0x0= }|SMBIOS_TABLE_TYPE1|0x80010100 { >=20 > - >=20 > - IndustryStandard/SmBios.h >=20 > - >=20 > - MdePkg/MdePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - } >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Manu= facturer|0x1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Prod= uctName|0x2 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Vers= ion|0x3 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Seri= alNumber|0x4 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Uuid= |{GUID("88888888-8887-8888-8888- > 878888888888")} >=20 > - > gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.WakeUpT= ype|SystemWakeupTypePowerSwitch >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SKUN= umber|0x5 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Fami= ly|0x6 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer|"In= tel Corporation"|VOID*|0x80010101 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"PUR= LEY"|VOID*|0x80010102 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion|"1.0"|VO= ID*|0x80010103 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber|"UN= KNOWN"|VOID*|0x80010104 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber|"SKU N= umber"|VOID*|0x80010105 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily|"Family"|= VOID*|0x80010106 >=20 > - >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation|{= 0x0}|SMBIOS_TABLE_TYPE2|0x80010200 > { >=20 > - >=20 > - IndustryStandard/SmBios.h >=20 > - >=20 > - MdePkg/MdePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - } >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.M= anufacturer|0x1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.P= roductName|0x2 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.V= ersion|0x3 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.S= erialNumber|0x4 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.A= ssetTag|0x5 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.F= eatureFlag.Motherboard|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.F= eatureFlag.Replaceable|1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.L= ocationInChassis|0x6 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.B= oardType|BaseBoardTypeMotherBoard >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer|"In= tel Corporation"|VOID*|0x80010201 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"PUR= LEY"|VOID*|0x80010202 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion|"E63448-= 400"|VOID*|0x80010203 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber|"SP= RO03200016"|VOID*|0x80010204 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag|"Base B= oard Asset Tag"|VOID*|0x80010205 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassi= s|"Part Component"|VOID*|0x80010206 >=20 > - >=20 > - > gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis|{0= x0}|SMBIOS_TABLE_TYPE3|0x80010300 { >=20 > - >=20 > - IndustryStandard/SmBios.h >=20 > - >=20 > - MdePkg/MdePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - } >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis= .Manufacturer|0x1 >=20 > - > gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Ty= pe|MiscChassisTypeRackMountChassis >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis= .Version|0x2 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis= .SerialNumber|0x3 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis= .AssetTag|0x4 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis= .BootupState|ChassisStateSafe >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis= .PowerSupplyState|ChassisStateSafe >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis= .ThermalState|ChassisStateSafe >=20 > - > gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Se= curityStatus|ChassisSecurityStatusNone >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer|"In= tel Corporation"|VOID*|0x80010301 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion|"0.1"|VO= ID*|0x80010302 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber|"UN= KNOWN"|VOID*|0x80010303 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag|"Chassi= s Asset Tag"|VOID*|0x80010304 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber|"SKU N= umber"|VOID*|0x80010305 >=20 > - >=20 > - > gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation|{0= x0}|SMBIOS_TABLE_TYPE32|0x8001200 > 0 { >=20 > - >=20 > - IndustryStandard/SmBios.h >=20 > - >=20 > - MdePkg/MdePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - } >=20 > - > gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation.Bo= otStatus|BootInformationStatusNoErr > or >=20 > - >=20 > -[PcdsFixedAtBuild] >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels|0x3|UINT8|0x400000= 09 >=20 > - >=20 > -[PcdsDynamic, PcdsDynamicEx] >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress|0xCA2|UINT16|0x= 90000022 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag|TRUE|BOOLEAN|0x10= 000030 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue|360|UINT16|0x1000= 0040 >=20 > - >=20 > -[PcdsFeatureFlag] >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdNetworkEnable |FALSE|BOO= LEAN|0xF00000A1 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable |FALSE|BOO= LEAN|0xF00000A2 >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdIpmiEnable |FALSE|BOO= LEAN|0xF00000A3 >=20 > - >=20 > 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 >=20 > -# Advanced Feature Package build description file. >=20 > -# >=20 > -# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -########################################################################= ######## >=20 > -# >=20 > -# Defines Section - statements that will be processed to create a Makefi= le. >=20 > -# >=20 > -########################################################################= ######## >=20 > -[Defines] >=20 > - PLATFORM_NAME =3D AdvancedFeaturePkg >=20 > - PLATFORM_GUID =3D 5E4C05BC-C5F0-4843-BAE1-3AAFE2= 69DB8F >=20 > - PLATFORM_VERSION =3D 0.1 >=20 > - DSC_SPECIFICATION =3D 0x00010005 >=20 > - OUTPUT_DIRECTORY =3D Build/AdvancedFeaturePkg >=20 > - SUPPORTED_ARCHITECTURES =3D IA32|X64 >=20 > - BUILD_TARGETS =3D DEBUG|RELEASE >=20 > - SKUID_IDENTIFIER =3D DEFAULT >=20 > - >=20 > -########################################################################= ######## >=20 > -# >=20 > -# SKU Identification section - list of all SKU IDs supported. >=20 > -# >=20 > -########################################################################= ######## >=20 > -[SkuIds] >=20 > - 0|DEFAULT # The entry: 0|DEFAULT is reserved and always r= equired. >=20 > - >=20 > -########################################################################= ######## >=20 > -# >=20 > -# Pcd Section - list of all EDK II PCD Entries defined by this package. >=20 > -# >=20 > -########################################################################= ######## >=20 > - >=20 > -[PcdsFeatureFlag] >=20 > - >=20 > -########################################################################= ######## >=20 > -# >=20 > -# Library Class section - list of all Library Classes needed by this pac= kage. >=20 > -# >=20 > -########################################################################= ######## >=20 > - >=20 > -[LibraryClasses.common] >=20 > - ####################################### >=20 > - # Edk2 Packages >=20 > - ####################################### >=20 > - BaseLib|MdePkg/Library/BaseLib/BaseLib.inf >=20 > - BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.i= nf >=20 > - BasePciLibPciExpress|MdePkg/Library/BasePciLibPciExpress/BasePciLibPci= Express.inf >=20 > - CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMa= intenanceLib.inf >=20 > - CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf >=20 > - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf >=20 > - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf >=20 > - DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.i= nf >=20 > - DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf >=20 > - DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTabl= eLib.inf >=20 > - HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf >=20 > - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf >=20 > - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf >=20 > - PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf >=20 > - PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf >=20 > - PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf >=20 > - PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci= .inf >=20 > - PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BaseP= eCoffExtraActionLibNull.inf >=20 > - PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BaseP= eCoffGetEntryPointLib.inf >=20 > - PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf >=20 > - PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.i= nf >=20 > - PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf >=20 > - PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf >=20 > - PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibId= t/PeiServicesTablePointerLibIdt.inf >=20 > - PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf >=20 > - ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRep= ortStatusCodeLibNull.inf >=20 > - SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPo= rtLib16550.inf >=20 > - SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf >=20 > - TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTempl= ate.inf >=20 > - UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/Uef= iApplicationEntryPoint.inf >=20 > - UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiB= ootServicesTableLib.inf >=20 > - UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf >=20 > - UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompr= essLib.inf >=20 > - UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEnt= ryPoint.inf >=20 > - UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServ= icesLib.inf >=20 > - UefiLib|MdePkg/Library/UefiLib/UefiLib.inf >=20 > - UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf >=20 > - UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib= /UefiRuntimeServicesTableLib.inf >=20 > - >=20 > - ####################################### >=20 > - # Advanced Feature Package >=20 > - ####################################### >=20 > - IpmiCommandLib|AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiComm= andLib.inf >=20 > - IpmiLib|AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf >=20 > - IpmiPlatformHookLib|AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLi= bNull/IpmiPlatformHookLibNull.inf >=20 > - >=20 > -[LibraryClasses.common.SEC,LibraryClasses.common.PEI_CORE,LibraryClasses= .common.PEIM] >=20 > - ####################################### >=20 > - # Edk2 Packages >=20 > - ####################################### >=20 > - HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf >=20 > - MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAll= ocationLib.inf >=20 > - PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf >=20 > - >=20 > - ####################################### >=20 > - # Silicon Initialization Package >=20 > - ####################################### >=20 > - SmmAccessLib|IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib= /PeiSmmAccessLib.inf >=20 > - >=20 > - > [LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,Libr= aryClasses.common.SMM_CORE,LibraryC > lasses.common.DXE_DRIVER,LibraryClasses.common.DXE_RUNTIME_DRIVER,Library= Classes.common.UEFI_DRIVER,LibraryCla > sses.common.UEFI_APPLICATION] >=20 > - ####################################### >=20 > - # Edk2 Packages >=20 > - ####################################### >=20 > - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 > - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryA= llocationLib.inf >=20 > - PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf >=20 > - >=20 > -[LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE] >=20 > - ####################################### >=20 > - # Edk2 Packages >=20 > - ####################################### >=20 > - SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTabl= eLib.inf >=20 > - >=20 > -########################################################################= ########################### >=20 > -# >=20 > -# Components Section - list of the modules and components that will be p= rocessed by compilation >=20 > -# tools and the EDK II tools to generate PE32/PE32+= /Coff image files. >=20 > -# >=20 > -# Note: The EDK II DSC file is not used to specify how compiled binary i= mages get placed >=20 > -# into firmware volume images. This section is just a list of modu= les to compile from >=20 > -# source into UEFI-compliant binaries. >=20 > -# It is the FDF file that contains information on combining binary= files into firmware >=20 > -# volume images, whose concept is beyond UEFI and is described in = PI specification. >=20 > -# Binary modules do not need to be listed in this section, as they= should be >=20 > -# specified in the FDF file. For example: Shell binary (Shell_Full= .efi), FAT binary (Fat.efi), >=20 > -# Logo (Logo.bmp), and etc. >=20 > -# There may also be modules listed in this section that are not re= quired in the FDF file, >=20 > -# When a module listed here is excluded from FDF file, then UEFI-c= ompliant binary will be >=20 > -# generated for it, but the binary will not be put into any firmwa= re volume. >=20 > -# >=20 > -########################################################################= ########################### >=20 > - >=20 > -[Components] >=20 > - ####################################### >=20 > - # Advanced Feature Package >=20 > - ####################################### >=20 > - >=20 > - # Add library instances here that are not included in package componen= ts and should be tested >=20 > - # in the package build. >=20 > - >=20 > - # Add components here that should be included in the package build. >=20 > - AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf >=20 > - AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf >=20 > - AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf >=20 > - AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf >=20 > - AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf >=20 > - AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf >=20 > - AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf >=20 > - AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf >=20 > - AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf >=20 > - AdvancedFeaturePkg/S3/S3Pei.inf >=20 > - AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf >=20 > - >=20 > -[BuildOptions] >=20 > - *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDx= eInclude.dsc > b/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.ds= c > deleted file mode 100644 > index fceaadc100..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclud= e.dsc > +++ /dev/null > @@ -1,19 +0,0 @@ > -## @file >=20 > -# Platform description. >=20 > -# >=20 > -# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > - >=20 > - # >=20 > - # UEFI network modules >=20 > - # >=20 > - !include NetworkPkg/NetworkComponents.dsc.inc >=20 > - >=20 > -!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable =3D=3D TRUE >=20 > - MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf >=20 > -!endif >=20 > - >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPe= iInclude.dsc > b/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.ds= c > deleted file mode 100644 > index 86b1ebfed0..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclud= e.dsc > +++ /dev/null > @@ -1,9 +0,0 @@ > -## @file >=20 > -# Platform description. >=20 > -# >=20 > -# Copyright (c) 2017, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLa= teInclude.fdf > b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude.f= df > deleted file mode 100644 > index d980e673a8..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclu= de.fdf > +++ /dev/null > @@ -1,20 +0,0 @@ > -## @file >=20 > -# FDF file of Platform. >=20 > -# >=20 > -# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > - >=20 > -# >=20 > -# UEFI network modules >=20 > -# >=20 > -!include NetworkPkg/Network.fdf.inc >=20 > - >=20 > -!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable =3D=3D TRUE >=20 > -INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf >=20 > -!endif >=20 > - >=20 > - >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPo= stMemoryInclude.fdf > b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryInc= lude.fdf > deleted file mode 100644 > index 3c2716d672..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemor= yInclude.fdf > +++ /dev/null > @@ -1,8 +0,0 @@ > -## @file >=20 > -# FDF file of Platform. >=20 > -# >=20 > -# Copyright (c) 2017, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPr= eMemoryInclude.fdf > b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryIncl= ude.fdf > deleted file mode 100644 > index 5b21f781a7..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemory= Include.fdf > +++ /dev/null > @@ -1,9 +0,0 @@ > -## @file >=20 > -# FDF file of Platform. >=20 > -# >=20 > -# Copyright (c) 2017, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > 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 >=20 > - BMC ACPI. >=20 > - >=20 > -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -// >=20 > -// Statements that include other header files >=20 > -// >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#ifndef EFI_ACPI_CREATOR_ID >=20 > -#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('M', 'S', 'F', 'T') >=20 > -#endif >=20 > -#ifndef EFI_ACPI_CREATOR_REVISION >=20 > -#define EFI_ACPI_CREATOR_REVISION 0x0100000D >=20 > -#endif >=20 > - >=20 > -/** >=20 > - >=20 > - Locate the first instance of a protocol. If the protocol requested is= an >=20 > - FV protocol, then it will return the first FV that contains the ACPI t= able >=20 > - storage file. >=20 > - >=20 > - @param Protocol - The protocol to find. >=20 > - Instance - Return pointer to the first instance of the protocol. >=20 > - Type - The type of protocol to locate. >=20 > - >=20 > - @retval EFI_SUCCESS - The function completed successfully. >=20 > - @retval EFI_NOT_FOUND - The protocol could not be located. >=20 > - @retval EFI_OUT_OF_RESOURCES - There are not enough resources to fin= d the protocol. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -LocateSupportProtocol ( >=20 > - IN EFI_GUID *Protocol, >=20 > - OUT VOID **Instance, >=20 > - IN UINT32 Type >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - EFI_HANDLE *HandleBuffer; >=20 > - UINTN NumberOfHandles; >=20 > - EFI_FV_FILETYPE FileType; >=20 > - UINT32 FvStatus =3D 0; >=20 > - EFI_FV_FILE_ATTRIBUTES Attributes; >=20 > - UINTN Size; >=20 > - UINTN Index; >=20 > - >=20 > - Status =3D gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &Numbe= rOfHandles, &HandleBuffer); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - // >=20 > - // Looking for FV with ACPI storage file >=20 > - // >=20 > - for (Index =3D 0; Index < NumberOfHandles; Index++) { >=20 > - Status =3D gBS->HandleProtocol (HandleBuffer[Index], Protocol, Insta= nce); >=20 > - ASSERT (!EFI_ERROR (Status)); >=20 > - >=20 > - if (!Type) { >=20 > - // >=20 > - // Not looking for the FV protocol, so find the first instance of = the >=20 > - // protocol. There should not be any errors because our handle bu= ffer >=20 > - // should always contain at least one or LocateHandleBuffer would = have >=20 > - // returned not found. >=20 > - // >=20 > - break; >=20 > - } >=20 > - // >=20 > - // See if it has the ACPI storage file >=20 > - // >=20 > - Status =3D ((EFI_FIRMWARE_VOLUME2_PROTOCOL *) (*Instance))->ReadFile= ( >=20 > - *Instance, >=20 > - &gEfiCalle= rIdGuid, >=20 > - NULL, >=20 > - &Size, >=20 > - &FileType, >=20 > - &Attribute= s, >=20 > - &FvStatus >=20 > - ); >=20 > - >=20 > - // >=20 > - // If we found it, then we are done >=20 > - // >=20 > - if (!EFI_ERROR (Status)) { >=20 > - break; >=20 > - } >=20 > - } >=20 > - >=20 > - gBS->FreePool (HandleBuffer); >=20 > - return Status; >=20 > -} >=20 > - >=20 > - >=20 > -EFI_STATUS >=20 > -UpdateDeviceSsdtTable ( >=20 > - IN OUT EFI_ACPI_COMMON_HEADER *Table >=20 > - ) >=20 > -{ >=20 > - EFI_ACPI_DESCRIPTION_HEADER *TableHeader =3D NULL; >=20 > - UINT64 TempOemTableId; >=20 > - UINT8 *DataPtr; >=20 > - EFI_ACPI_IO_PORT_DESCRIPTOR *IoRsc; >=20 > - >=20 > - TableHeader =3D (EFI_ACPI_DESCRIPTION_HEADER *)Table; >=20 > - >=20 > - // >=20 > - // Update the OEMID and OEM Table ID. >=20 > - // >=20 > - CopyMem (&TableHeader->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof(= TableHeader->OemId)); >=20 > - TempOemTableId =3D PcdGet64 (PcdAcpiDefaultOemTableId); >=20 > - CopyMem (&TableHeader->OemTableId, &TempOemTableId, sizeof(UINT64)); >=20 > - TableHeader->CreatorId =3D EFI_ACPI_CREATOR_ID; >=20 > - TableHeader->CreatorRevision =3D EFI_ACPI_CREATOR_REVISION; >=20 > - >=20 > - // >=20 > - // Update IO(Decode16, 0xCA2, 0xCA2, 0, 2) >=20 > - // >=20 > - DEBUG ((DEBUG_INFO, "UpdateDeviceSsdtTable - IPMI\n")); >=20 > - for (DataPtr =3D (UINT8 *)(Table + 1); >=20 > - DataPtr < (UINT8 *) ((UINT8 *) Table + Table->Length - 4); >=20 > - DataPtr++) { >=20 > - if (CompareMem(DataPtr, "_CRS", 4) =3D=3D 0) { >=20 > - DataPtr +=3D 4; // Skip _CRS >=20 > - ASSERT (*DataPtr =3D=3D AML_BUFFER_OP); >=20 > - DataPtr ++; // Skip AML_BUFFER_OP >=20 > - ASSERT ((*DataPtr & (BIT7|BIT6)) =3D=3D 0); >=20 > - DataPtr ++; // Skip PkgLength - 0xD >=20 > - ASSERT ((*DataPtr) =3D=3D AML_BYTE_PREFIX); >=20 > - DataPtr ++; // Skip BufferSize OpCode >=20 > - DataPtr ++; // Skip BufferSize - 0xA >=20 > - IoRsc =3D (VOID *)DataPtr; >=20 > - ASSERT (IoRsc->Header.Bits.Type =3D=3D ACPI_SMALL_ITEM_FLAG); >=20 > - ASSERT (IoRsc->Header.Bits.Name =3D=3D ACPI_SMALL_IO_PORT_DESCRIPT= OR_NAME); >=20 > - ASSERT (IoRsc->Header.Bits.Length =3D=3D sizeof(EFI_ACPI_IO_PORT_D= ESCRIPTOR) - > sizeof(ACPI_SMALL_RESOURCE_HEADER)); >=20 > - DEBUG ((DEBUG_INFO, "IPMI IO Base in ASL update - 0x%04x <=3D 0x%0= 4x\n", IoRsc->BaseAddressMin, > PcdGet16(PcdIpmiIoBaseAddress))); >=20 > - IoRsc->BaseAddressMin =3D PcdGet16(PcdIpmiIoBaseAddress); >=20 > - IoRsc->BaseAddressMax =3D PcdGet16(PcdIpmiIoBaseAddress); >=20 > - } >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - >=20 > - Entry point for Acpi platform driver. >=20 > - >=20 > - @param ImageHandle - A handle for the image that is initializing thi= s driver. >=20 > - @param SystemTable - A pointer to the EFI system table. >=20 > - >=20 > - @retval EFI_SUCCESS - Driver initialized successfully. >=20 > - @retval EFI_LOAD_ERROR - Failed to Initialize or has been load= ed. >=20 > - @retval EFI_OUT_OF_RESOURCES - Could not allocate needed resources. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -BmcAcpiEntryPoint ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - EFI_STATUS AcpiStatus; >=20 > - >=20 > - EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol; >=20 > - INTN Instance =3D 0; >=20 > - EFI_ACPI_COMMON_HEADER *CurrentTable =3D NULL; >=20 > - UINTN TableHandle =3D 0; >=20 > - UINT32 FvStatus; >=20 > - UINT32 Size; >=20 > - >=20 > - EFI_ACPI_TABLE_PROTOCOL *AcpiTable; >=20 > - UINTN TableSize; >=20 > - >=20 > - >=20 > - // >=20 > - // Find the AcpiTable protocol >=20 > - // >=20 > - Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOI= D**)&AcpiTable); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return EFI_ABORTED; >=20 > - } >=20 > - >=20 > - // >=20 > - // Locate the firmware volume protocol >=20 > - // >=20 > - Status =3D LocateSupportProtocol (&gEfiFirmwareVolume2ProtocolGuid, (V= OID **) &FwVol, 1); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - >=20 > - Status =3D EFI_SUCCESS; >=20 > - Instance =3D 0; >=20 > - >=20 > - // >=20 > - // Read tables from the storage file. >=20 > - // >=20 > - while (!EFI_ERROR (Status)) { >=20 > - CurrentTable =3D NULL; >=20 > - >=20 > - Status =3D FwVol->ReadSection ( >=20 > - FwVol, >=20 > - &gEfiCallerIdGuid, >=20 > - EFI_SECTION_RAW, >=20 > - Instance, >=20 > - (VOID **) &CurrentTable, >=20 > - (UINTN *) &Size, >=20 > - &FvStatus >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - // >=20 > - // Perform any table specific updates. >=20 > - // >=20 > - AcpiStatus =3D UpdateDeviceSsdtTable (CurrentTable); >=20 > - if (!EFI_ERROR (AcpiStatus)) { >=20 > - >=20 > - TableHandle =3D 0; >=20 > - TableSize =3D ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Le= ngth; >=20 > - ASSERT (Size >=3D TableSize); >=20 > - >=20 > - Status =3D AcpiTable->InstallAcpiTable ( >=20 > - AcpiTable, >=20 > - CurrentTable, >=20 > - TableSize, >=20 > - &TableHandle >=20 > - ); >=20 > - >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - } >=20 > - >=20 > - // >=20 > - // Increment the instance >=20 > - // >=20 > - Instance++; >=20 > - } >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > 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 >=20 > -# Component description file for BMC ACPI. >=20 > -# >=20 > -# Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D BmcAcpi >=20 > - FILE_GUID =3D F59DAA23-D5D5-4d16-91FC-D03ABDC12FFE >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - ENTRY_POINT =3D BmcAcpiEntryPoint >=20 > - >=20 > -[Sources] >=20 > - BmcAcpi.c >=20 > - BmcSsdt/BmcSsdt.asl >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - UefiBootServicesTableLib >=20 > - UefiDriverEntryPoint >=20 > - BaseMemoryLib >=20 > - DebugLib >=20 > - UefiLib >=20 > - >=20 > -[Protocols] >=20 > - gEfiFirmwareVolume2ProtocolGuid >=20 > - gEfiAcpiTableProtocolGuid >=20 > - >=20 > -[Pcd] >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress >=20 > - gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId >=20 > - gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId >=20 > - >=20 > -[Depex] >=20 > - gEfiAcpiTableProtocolGuid >=20 > - >=20 > -[BuildOptions] >=20 > - *_*_*_ASL_FLAGS =3D -oi >=20 > - >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/BmcSs= dt.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 >=20 > - BMC ACPI SSDT. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -DefinitionBlock ( >=20 > - "BmcSsdt.aml", >=20 > - "SSDT", >=20 > - 0x02, // SSDT revision. >=20 > - // A Revision field value greater than or equal to 2 s= ignifies that integers >=20 > - // declared within the Definition Block are to be eval= uated as 64-bit values >=20 > - "INTEL", // OEM ID (6 byte string) >=20 > - "BMCACPI", // OEM table ID (8 byte string) >=20 > - 0x0 // OEM version of DSDT table (4 byte Integer) >=20 > - ) >=20 > -{ >=20 > - >=20 > - External(\_SB.PC00.LPC0, DeviceObj) >=20 > - >=20 > - Scope (\_SB.PC00.LPC0) >=20 > - { >=20 > - #include "IpmiOprRegions.asi" >=20 > - } >=20 > - >=20 > -} >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiO= prRegions.asi > b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOprRegions.a= si > deleted file mode 100644 > index d2ae5fc40a..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOprRegio= ns.asi > +++ /dev/null > @@ -1,58 +0,0 @@ > -/** @file >=20 > - IPMI ACPI SSDT. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -Device(IPMC) >=20 > -{ >=20 > - // Config DWord, modified during POST >=20 > - // Bit definitions are the same as PPMFlags: >=20 > - // [00] =3D Plug and Play BMC Detection enabled in setup >=20 > - // [31:01] =3D Reserved =3D 0 >=20 > - >=20 > - Name(ECFL, 0x80000000) >=20 > - >=20 > - // Return the interface specification revision >=20 > - Method(_SRV) >=20 > - { >=20 > - // IPMI Specification Revision v2.0 >=20 > - Return(0x0200) >=20 > - } >=20 > - >=20 > - Method(_STA, 0) >=20 > - { >=20 > - // >=20 > - // Assume OK >=20 > - // >=20 > - Store (0xF, Local0) >=20 > - >=20 > - Return(Local0) >=20 > - >=20 > - // Bit 0 - Set if the device is present. >=20 > - // Bit 1 - Set if the device is enabled and decoding its resourc= es. >=20 > - // Bit 2 - Set if the device should be shown in the UI. >=20 > - // Bit 3 - Set if the device is functioning properly (cleared if= the device failed its diagnostics). >=20 > - // Bit 4 - Set if the battery is present. >=20 > - // Bit 5 - Reserved (must be cleared). >=20 > - } // end of _STA >=20 > - >=20 > - // Return the x86 resources consumed by BMC >=20 > - Name(_CRS, ResourceTemplate() >=20 > - { >=20 > - // Uses 8-bit ports 0xCA2-0xCA5 >=20 > - IO(Decode16, 0xCA2, 0xCA2, 0, 2) >=20 > - }) >=20 > - >=20 > - Name(_HID, "IPI0001") // IPMI device >=20 > - Name(_IFT, 0x1) // KCS system interface type >=20 > - Name(_STR, Unicode("IPMI_KCS")) >=20 > - >=20 > - Name(_UID, 0) // First interface. >=20 > - >=20 > - >=20 > -} // end of Device(IPMC) >=20 > - >=20 > - >=20 > 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 >=20 > - BMC Event Log functions. >=20 > - >=20 > -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -CheckIfSelIsFull ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -/*++ >=20 > - >=20 > - Routine Description: >=20 > - This function verifies the BMC SEL is full and When it is reports th= e error to the Error Manager. >=20 > - >=20 > - Arguments: >=20 > - None >=20 > - >=20 > - Returns: >=20 > - EFI_SUCCESS >=20 > - EFI_DEVICE_ERROR >=20 > - >=20 > ---*/ >=20 > -EFI_STATUS >=20 > -WaitTillErased ( >=20 > - UINT8 *ResvId >=20 > - ) >=20 > -/*++ >=20 > - >=20 > -Routine Description: >=20 > - >=20 > -Arguments: >=20 > - >=20 > - BmcElogPrivateData - Bmc event log instance >=20 > - ResvId - Reserved ID >=20 > - >=20 > -Returns: >=20 > - >=20 > - EFI_SUCCESS >=20 > - EFI_NO_RESPONSE >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - INTN Counter; >=20 > - IPMI_CLEAR_SEL_REQUEST ClearSel; >=20 > - IPMI_CLEAR_SEL_RESPONSE ClearSelResponse; >=20 > - >=20 > - Counter =3D 0x200; >=20 > - ZeroMem (&ClearSelResponse, sizeof(ClearSelResponse)); >=20 > - >=20 > - while (TRUE) { >=20 > - ZeroMem (&ClearSel, sizeof(ClearSel)); >=20 > - ClearSel.Reserve[0] =3D ResvId[0]; >=20 > - ClearSel.Reserve[1] =3D ResvId[1]; >=20 > - ClearSel.AscC =3D 0x43; >=20 > - ClearSel.AscL =3D 0x4C; >=20 > - ClearSel.AscR =3D 0x52; >=20 > - ClearSel.Erase =3D 0x00; >=20 > - >=20 > - IpmiClearSel ( >=20 > - &ClearSel, >=20 > - &ClearSelResponse >=20 > - ); >=20 > - >=20 > - if ((ClearSelResponse.ErasureProgress & 0xf) =3D=3D 1) { >=20 > - return EFI_SUCCESS; >=20 > - } >=20 > - // >=20 > - // If there is not a response from the BMC controller we need to re= turn and not hang. >=20 > - // >=20 > - --Counter; >=20 > - if (Counter =3D=3D 0x0) { >=20 > - return EFI_NO_RESPONSE; >=20 > - } >=20 > - } >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EfiActivateBmcElog ( >=20 > - IN BOOLEAN *EnableElog, >=20 > - OUT BOOLEAN *ElogStatus >=20 > - ) >=20 > -/*++ >=20 > - >=20 > -Routine Description: >=20 > - >=20 > -Arguments: >=20 > - >=20 > - This - Protocol pointer >=20 > - DataType - indicate event log type >=20 > - EnableElog - Enable/Disable event log >=20 > - ElogStatus - return log status >=20 > - >=20 > -Returns: >=20 > - >=20 > - EFI_STATUS >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT8 ElogStat; >=20 > - IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST SetBmcGlobalEnables; >=20 > - IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE GetBmcGlobalEnables; >=20 > - UINT8 CompletionCode; >=20 > - >=20 > - Status =3D EFI_SUCCESS; >=20 > - ElogStat =3D 0; >=20 > - >=20 > - Status =3D IpmiGetBmcGlobalEnables (&GetBmcGlobalEnables); >=20 > - if (EFI_ERROR(Status)) { >=20 > - return Status; >=20 > - } >=20 > - >=20 > - if (EnableElog =3D=3D NULL) { >=20 > - *ElogStatus =3D GetBmcGlobalEnables.GetEnables.Bits.SystemEventLoggi= ng; >=20 > - } else { >=20 > - if (Status =3D=3D EFI_SUCCESS) { >=20 > - if (*EnableElog) { >=20 > - ElogStat =3D 1; >=20 > - } >=20 > - >=20 > - CopyMem (&SetBmcGlobalEnables, (UINT8 *)&GetBmcGlobalEnables + 1, = sizeof(UINT8)); >=20 > - SetBmcGlobalEnables.SetEnables.Bits.SystemEventLogging =3D ElogSta= t; >=20 > - >=20 > - Status =3D IpmiSetBmcGlobalEnables (&SetBmcGlobalEnables, &Complet= ionCode); >=20 > - } >=20 > - } >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -SetElogRedirInstall ( >=20 > - VOID >=20 > - ) >=20 > -/*++ >=20 > - >=20 > -Routine Description: >=20 > - >=20 > -Arguments: >=20 > - >=20 > - None >=20 > - >=20 > -Returns: >=20 > - >=20 > - EFI_SUCCESS >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - BOOLEAN EnableElog; >=20 > - BOOLEAN ElogStatus; >=20 > - >=20 > - // >=20 > - // Activate the Event Log (This should depend upon Setup). >=20 > - // >=20 > - EfiActivateBmcElog (&EnableElog, &ElogStatus); >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -InitializeBmcElogLayer ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -/*++ >=20 > - >=20 > -Routine Description: >=20 > - >=20 > -Arguments: >=20 > - >=20 > - ImageHandle - ImageHandle of the loaded driver >=20 > - SystemTable - Pointer to the System Table >=20 > - >=20 > -Returns: >=20 > - >=20 > - EFI_STATUS >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - SetElogRedirInstall (); >=20 > - >=20 > - CheckIfSelIsFull (); >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -CheckIfSelIsFull ( >=20 > - VOID >=20 > - ) >=20 > -/*++ >=20 > - >=20 > - Routine Description: >=20 > - This function verifies the BMC SEL is full and When it is reports th= e error to the Error Manager. >=20 > - >=20 > - Arguments: >=20 > - None >=20 > - >=20 > - Returns: >=20 > - EFI_SUCCESS >=20 > - EFI_DEVICE_ERROR >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT8 SelIsFull; >=20 > - IPMI_GET_SEL_INFO_RESPONSE SelInfo; >=20 > - >=20 > - Status =3D IpmiGetSelInfo (&SelInfo); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return EFI_DEVICE_ERROR; >=20 > - } >=20 > - >=20 > - // >=20 > - // Check the Bit7 of the OperationByte if SEL is OverFlow. >=20 > - // >=20 > - SelIsFull =3D (SelInfo.OperationSupport & 0x80); >=20 > - DEBUG ((DEBUG_INFO, "SelIsFull - 0x%x\n", SelIsFull)); >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > 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 >=20 > -# Component description file for BMC ELOG. >=20 > -# >=20 > -# Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D BmcElog >=20 > - FILE_GUID =3D 8A17F6CA-BF1A-45C4-FFFF-FFFF0C829DDD >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - PI_SPECIFICATION_VERSION =3D 0x0001000A >=20 > - VERSION_STRING =3D 1.0 >=20 > - ENTRY_POINT =3D InitializeBmcElogLayer >=20 > - >=20 > -[Sources] >=20 > - BmcElog.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - UefiDriverEntryPoint >=20 > - DebugLib >=20 > - UefiBootServicesTableLib >=20 > - IpmiCommandLib >=20 > - >=20 > -[Depex] >=20 > - TRUE >=20 > - >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c b/Platfo= rm/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 >=20 > - IPMI FRB Driver. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -EFI_STATUS >=20 > -EfiDisableFrb ( >=20 > - VOID >=20 > - ) >=20 > -/*++ >=20 > - >=20 > - Routine Description: >=20 > - This routine disables the specified FRB timer. >=20 > - >=20 > - Arguments: >=20 > - This - This pointer >=20 > - FrbType - Type of FRB timer to get data on >=20 > - >=20 > - Returns: >=20 > - EFI_SUCCESS - FRB timer was disabled >=20 > - EFI_ABORTED - Timer was already stopped >=20 > - EFI_UNSUPPORTED - This type of FRB timer is not supported. >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer; >=20 > - UINT8 CompletionCode; >=20 > - IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; >=20 > - >=20 > - Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - >=20 > - // >=20 > - // Check if timer is still running, if not abort disable routine. >=20 > - // >=20 > - if (GetWatchdogTimer.TimerUse.Bits.TimerRunning =3D=3D 0) { >=20 > - return EFI_ABORTED; >=20 > - } >=20 > - >=20 > - ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer)); >=20 > - // >=20 > - // Just flip the Timer Use bit. This should release the timer. >=20 > - // >=20 > - SetWatchdogTimer.TimerUse.Bits.TimerRunning =3D 0; >=20 > - SetWatchdogTimer.TimerUse.Bits.TimerUse =3D IPMI_WATCHDOG_TIMER= _BIOS_FRB2; >=20 > - SetWatchdogTimer.TimerUseExpirationFlagsClear &=3D ~BIT2; >=20 > - SetWatchdogTimer.TimerUseExpirationFlagsClear |=3D BIT1 | BIT4; >=20 > - >=20 > - Status =3D IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -VOID >=20 > -EFIAPI >=20 > -DisableFRB2Handler ( >=20 > - IN EFI_EVENT Event, >=20 > - IN VOID *Context >=20 > - ) >=20 > -/*++ >=20 > - >=20 > - Routine Description: >=20 > - Disables FRB2. This function gets called each time the >=20 > - EFI_EVENT_SIGNAL_READY_TO_BOOT gets signaled >=20 > - >=20 > - Arguments: >=20 > - Standard event notification function arguments: >=20 > - Event - the event that is signaled. >=20 > - Context - not used here. >=20 > - >=20 > - Returns: >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - DEBUG((EFI_D_ERROR, "!!! enter DisableFRB2Handler()!!!\n")); >=20 > - >=20 > - EfiDisableFrb (); >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -CheckForAndReportErrors( >=20 > - VOID >=20 > - ) >=20 > -/*++ >=20 > - >=20 > - Routine Description: >=20 > - Check the Watchdog timer expiration flags and report the kind of wat= chdog >=20 > - timeout occurred to the Error Manager. >=20 > - >=20 > - Arguments: >=20 > - >=20 > - Returns: >=20 > - EFI_SUCCESS - Errors retrieved and reported >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; >=20 > - IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer; >=20 > - UINT8 CompletionCode; >=20 > - >=20 > - // >=20 > - // Get the Watchdog timer info to find out what kind of timer expirati= on occurred. >=20 > - // >=20 > - Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - // >=20 > - // If FRB2 Failure occurred, report it to the error manager and log a = SEL. >=20 > - // >=20 > - if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT1) !=3D 0) { >=20 > - // >=20 > - // Report the FRB2 time-out error >=20 > - // >=20 > - } else if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT3) !=3D= 0) { >=20 > - // >=20 > - // Report the OS Watchdog timer failure >=20 > - // >=20 > - } >=20 > - >=20 > - // >=20 > - // Need to clear Timer expiration flags after checking. >=20 > - // >=20 > - ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer)); >=20 > - SetWatchdogTimer.TimerUse =3D GetWatchdogTimer.T= imerUse; >=20 > - SetWatchdogTimer.TimerActions =3D GetWatchdogTimer.T= imerActions; >=20 > - SetWatchdogTimer.PretimeoutInterval =3D GetWatchdogTimer.P= retimeoutInterval; >=20 > - SetWatchdogTimer.TimerUseExpirationFlagsClear =3D GetWatchdogTimer.T= imerUseExpirationFlagsClear; >=20 > - SetWatchdogTimer.InitialCountdownValue =3D GetWatchdogTimer.I= nitialCountdownValue; >=20 > - SetWatchdogTimer.TimerUse.Bits.TimerRunning =3D 1; >=20 > - SetWatchdogTimer.TimerUseExpirationFlagsClear |=3D BIT1 | BIT2 | BIT3= ; >=20 > - >=20 > - Status =3D IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode); >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -ReportFrb2Status ( >=20 > - VOID >=20 > - ) >=20 > -/*++ >=20 > - >=20 > - Routine Description: >=20 > - This routine is built only when DEBUG_MODE is enabled. It is used >=20 > - to report the status of FRB2 when the FRB2 driver is installed. >=20 > - >=20 > - Arguments: >=20 > - none >=20 > - >=20 > - Returns: >=20 > - EFI_SUCCESS: All info was retrieved and reported >=20 > - EFI_ERROR: There was an error during info retrieval >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; >=20 > - >=20 > - // >=20 > - // Get the Watchdog timer info to find out what kind of timer expirati= on occurred. >=20 > - // >=20 > - Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); >=20 > - if (EFI_ERROR (Status)) { >=20 > - DEBUG ((DEBUG_INFO, "Failed to get Watchdog Timer info from BMC.\n")= ); >=20 > - return Status; >=20 > - } >=20 > - >=20 > - // >=20 > - // Check if timer is running, report status to DEBUG_MODE output. >=20 > - // >=20 > - if (GetWatchdogTimer.TimerUse.Bits.TimerRunning =3D=3D 1) { >=20 > - DEBUG ((DEBUG_INFO, "FRB2 Timer is running.\n")); >=20 > - } else { >=20 > - DEBUG ((DEBUG_INFO, "FRB2 Timer is not running.\n")); >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -FrbDxeEntryPoint ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -/*++ >=20 > - >=20 > - Routine Description: >=20 > - This is the standard EFI driver point. This function intitializes >=20 > - the private data required for creating FRB Driver. >=20 > - >=20 > - Arguments: >=20 > - ImageHandle - Handle for the image of this driver >=20 > - SystemTable - Pointer to the EFI System Table >=20 > - >=20 > - Returns: >=20 > - EFI_SUCCESS - Protocol successfully started and installed >=20 > - EFI_UNSUPPORTED - Protocol can't be started >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - EFI_EVENT ReadyToBootEvent; >=20 > - EFI_STATUS Status; >=20 > - >=20 > - CheckForAndReportErrors(); >=20 > - ReportFrb2Status (); >=20 > - >=20 > - // >=20 > - // Register the event to Disable FRB2 before Boot. >=20 > - // >=20 > - Status =3D EfiCreateEventReadyToBootEx ( >=20 > - TPL_NOTIFY, >=20 > - DisableFRB2Handler, >=20 > - NULL, >=20 > - &ReadyToBootEvent >=20 > - ); >=20 > - >=20 > - return Status; >=20 > -} >=20 > 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 >=20 > -# Component description file for IPMI FRB. >=20 > -# >=20 > -# Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D FrbDxe >=20 > - FILE_GUID =3D F6C7812D-81BF-4e6d-A87D-E75AF17BD511 >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - ENTRY_POINT =3D FrbDxeEntryPoint >=20 > - >=20 > -[Sources] >=20 > - FrbDxe.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - UefiBootServicesTableLib >=20 > - UefiDriverEntryPoint >=20 > - MemoryAllocationLib >=20 > - UefiLib >=20 > - DebugLib >=20 > - BaseMemoryLib >=20 > - IpmiCommandLib >=20 > - PcdLib >=20 > - >=20 > -[Depex] >=20 > - TRUE >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c b/Platfo= rm/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 >=20 > - IPMI FRB PEIM. >=20 > - >=20 > -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > - >=20 > -VOID >=20 > -SetWatchDogTimer ( >=20 > - IN BOOLEAN Frb2Enabled >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - IPMI_SET_WATCHDOG_TIMER_REQUEST FrbTimer; >=20 > - IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; >=20 > - UINT8 CompletionCode; >=20 > - >=20 > - Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); >=20 > - if (EFI_ERROR(Status)) { >=20 > - return ; >=20 > - } >=20 > - >=20 > - if (Frb2Enabled) { >=20 > - ZeroMem (&FrbTimer, sizeof(FrbTimer)); >=20 > - //Byte 1 >=20 > - FrbTimer.TimerUse.Bits.TimerUse =3D IPMI_WATCHDOG_TIMER_BIOS_FRB2; >=20 > - //Byte 2 >=20 > - FrbTimer.TimerActions.Uint8 =3D 0; //NormalBoot, NoTimeOutInterru= pt. i.e no action when BMC watchdog timeout >=20 > - //Byte 3 >=20 > - FrbTimer.PretimeoutInterval =3D 0; >=20 > - //Byte 4 >=20 > - FrbTimer.TimerUseExpirationFlagsClear |=3D BIT1; //set Frb2Expirati= onFlag >=20 > - >=20 > - //Data Byte 5/6 >=20 > - FrbTimer.InitialCountdownValue =3D PcdGet16(PcdFRBTimeoutValue) * 10= ; >=20 > - >=20 > - //Set BMC watchdog timer >=20 > - Status =3D IpmiSetWatchdogTimer (&FrbTimer, &CompletionCode); >=20 > - Status =3D IpmiResetWatchdogTimer (&CompletionCode); >=20 > - } >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -InitializeFrbPei ( >=20 > - IN EFI_PEI_FILE_HANDLE FileHandle, >=20 > - IN CONST EFI_PEI_SERVICES **PeiServices >=20 > - ) >=20 > -/*++ >=20 > - >=20 > -Routine Description: >=20 > - >=20 > -Arguments: >=20 > - >=20 > - FfsHeader >=20 > - PeiServices >=20 > - >=20 > -Returns: >=20 > - >=20 > - EFI_SUCCESS >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - BOOLEAN Frb2Enabled; >=20 > - >=20 > - // >=20 > - // If we are booting with defaults, then make sure FRB2 is enabled. >=20 > - // >=20 > - Frb2Enabled =3D PcdGetBool (PcdFRB2EnabledFlag); >=20 > - >=20 > - SetWatchDogTimer (Frb2Enabled); >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > 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 >=20 > -# Component description file for IPMI FRB PEIM. >=20 > -# >=20 > -# Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D FrbPei >=20 > - FILE_GUID =3D 7F9F9788-9F1F-4725-895C-3932F1A04DE8 >=20 > - MODULE_TYPE =3D PEIM >=20 > - VERSION_STRING =3D 1.0 >=20 > - ENTRY_POINT =3D InitializeFrbPei >=20 > - >=20 > -[Sources] >=20 > - FrbPei.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - PeimEntryPoint >=20 > - DebugLib >=20 > - BaseMemoryLib >=20 > - PcdLib >=20 > - IpmiCommandLib >=20 > - >=20 > -[Pcd] >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue >=20 > - >=20 > -[Depex] >=20 > - TRUE >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiC= ommandLib.h > b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiCommandLib.h > deleted file mode 100644 > index 9b761717d4..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiCommandL= ib.h > +++ /dev/null > @@ -1,235 +0,0 @@ > -/** @file >=20 > - This library abstract how to send/receive IPMI command. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef _IPMI_COMMAND_LIB_H_ >=20 > -#define _IPMI_COMMAND_LIB_H_ >=20 > - >=20 > -#include >=20 > -#include >=20 > - >=20 > -// >=20 > -// NetFnApp >=20 > -// >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetDeviceId ( >=20 > - OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSelfTestResult ( >=20 > - OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiResetWatchdogTimer ( >=20 > - OUT UINT8 *CompletionCode >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSetWatchdogTimer ( >=20 > - IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer, >=20 > - OUT UINT8 *CompletionCode >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetWatchdogTimer ( >=20 > - OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSetBmcGlobalEnables ( >=20 > - IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables, >=20 > - OUT UINT8 *CompletionCode >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetBmcGlobalEnables ( >=20 > - OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiClearMessageFlags ( >=20 > - IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest, >=20 > - OUT UINT8 *CompletionCode >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetMessageFlags ( >=20 > - OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetMessage ( >=20 > - OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse, >=20 > - IN OUT UINT32 *GetMessageResponseSize >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSendMessage ( >=20 > - IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest, >=20 > - IN UINT32 SendMessageRequestSize, >=20 > - OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse, >=20 > - IN OUT UINT32 *SendMessageResponseSize >=20 > - ); >=20 > - >=20 > -// >=20 > -// NetFnTransport >=20 > -// >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSolActivating ( >=20 > - IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest, >=20 > - OUT UINT8 *CompletionCode >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSetSolConfigurationParameters ( >=20 > - IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationPa= rametersRequest, >=20 > - IN UINT32 SetConfigurationPar= ametersRequestSize, >=20 > - OUT UINT8 *CompletionCode >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSolConfigurationParameters ( >=20 > - IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationPa= rametersRequest, >=20 > - OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationPa= rametersResponse, >=20 > - IN OUT UINT32 *GetConfigurationPa= rametersResponseSize >=20 > - ); >=20 > - >=20 > -// >=20 > -// NetFnChasis >=20 > -// >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetChassisCapabilities ( >=20 > - OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesRes= ponse >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetChassisStatus ( >=20 > - OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiChassisControl ( >=20 > - IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest, >=20 > - OUT UINT8 *CompletionCode >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSetPowerRestorePolicy ( >=20 > - IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest, >=20 > - OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse >=20 > - ); >=20 > - >=20 > -// >=20 > -// NetFnStorage >=20 > -// >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetFruInventoryAreaInfo ( >=20 > - IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInf= oRequest, >=20 > - OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInf= oResponse >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiReadFruData ( >=20 > - IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest, >=20 > - OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse, >=20 > - IN OUT UINT32 *ReadFruDataResponseSize >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiWriteFruData ( >=20 > - IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest, >=20 > - IN UINT32 WriteFruDataRequestSize, >=20 > - OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSelInfo ( >=20 > - OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSelEntry ( >=20 > - IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest, >=20 > - OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse, >=20 > - IN OUT UINT32 *GetSelEntryResponseSize >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiAddSelEntry ( >=20 > - IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest, >=20 > - OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiPartialAddSelEntry ( >=20 > - IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest, >=20 > - IN UINT32 PartialAddSelEntryRequestSize= , >=20 > - OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiClearSel ( >=20 > - IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest, >=20 > - OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSelTime ( >=20 > - OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSetSelTime ( >=20 > - IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest, >=20 > - OUT UINT8 *CompletionCode >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSdrRepositoryInfo ( >=20 > - OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSdr ( >=20 > - IN IPMI_GET_SDR_REQUEST *GetSdrRequest, >=20 > - OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse, >=20 > - IN OUT UINT32 *GetSdrResponseSize >=20 > - ); >=20 > - >=20 > -#endif >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiP= latformHookLib.h > b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiPlatformHook= Lib.h > deleted file mode 100644 > index 8359e3f38b..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiPlatform= HookLib.h > +++ /dev/null > @@ -1,23 +0,0 @@ > -/** @file >=20 > - This library abstract the platform specific hook for IPMI. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef _IPMI_PLATFORM_UPDATE_LIB_H_ >=20 > -#define _IPMI_PLATFORM_UPDATE_LIB_H_ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -PlatformIpmiIoRangeSet( >=20 > - UINT16 IpmiIoBase >=20 > - ); >=20 > - >=20 > -#endif >=20 > - >=20 > 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 >=20 > - IPMI FRU Driver. >=20 > - >=20 > -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -InitializeFru ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -/*++ >=20 > - >=20 > -Routine Description: >=20 > - >=20 > - Initialize SM Redirection Fru Layer >=20 > - >=20 > -Arguments: >=20 > - >=20 > - ImageHandle - ImageHandle of the loaded driver >=20 > - SystemTable - Pointer to the System Table >=20 > - >=20 > -Returns: >=20 > - >=20 > - EFI_STATUS >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - IPMI_GET_DEVICE_ID_RESPONSE ControllerInfo; >=20 > - IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST GetFruInventoryAreaInfoRequ= est; >=20 > - IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE GetFruInventoryAreaInfoResp= onse; >=20 > - >=20 > - // >=20 > - // Get all the SDR Records from BMC and retrieve the Record ID from t= he structure for future use. >=20 > - // >=20 > - Status =3D IpmiGetDeviceId (&ControllerInfo); >=20 > - if (EFI_ERROR (Status)) { >=20 > - DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetDeviceId Status=3D%x\n", St= atus)); >=20 > - return Status; >=20 > - } >=20 > - >=20 > - DEBUG((DEBUG_ERROR, "!!! IpmiFru FruInventorySupport %x\n", > ControllerInfo.DeviceSupport.Bits.FruInventorySupport)); >=20 > - >=20 > - if (ControllerInfo.DeviceSupport.Bits.FruInventorySupport) { >=20 > - GetFruInventoryAreaInfoRequest.DeviceId =3D 0; >=20 > - Status =3D IpmiGetFruInventoryAreaInfo (&GetFruInventoryAreaInfoRequ= est, &GetFruInventoryAreaInfoResponse); >=20 > - if (EFI_ERROR (Status)) { >=20 > - DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetFruInventoryAreaInfo Stat= us=3D%x\n", Status)); >=20 > - return Status; >=20 > - } >=20 > - DEBUG((DEBUG_ERROR, "!!! IpmiFru InventoryAreaSize=3D%x\n", GetFruI= nventoryAreaInfoResponse.InventoryAreaSize)); >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > 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 >=20 > -# Component description file for IPMI FRU. >=20 > -# >=20 > -# Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D IpmiFru >=20 > - FILE_GUID =3D 3F1D6464-2B4C-4640-BAC4-3DD905D26CDA >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - PI_SPECIFICATION_VERSION =3D 0x0001000A >=20 > - VERSION_STRING =3D 1.0 >=20 > - ENTRY_POINT =3D InitializeFru >=20 > - >=20 > -[Sources] >=20 > - IpmiFru.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - UefiDriverEntryPoint >=20 > - UefiLib >=20 > - DebugLib >=20 > - UefiBootServicesTableLib >=20 > - BaseMemoryLib >=20 > - IpmiCommandLib >=20 > - >=20 > -[Depex] >=20 > - TRUE >=20 > 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 >=20 > - IPMI stack initialization. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#define BMC_TIMEOUT 30 // [s] How long shall BIOS wait for BMC >=20 > -#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout >=20 > - >=20 > -EFI_STATUS >=20 > -GetSelfTest ( >=20 > - VOID >=20 > - ) >=20 > -/*++ >=20 > - >=20 > -Routine Description: >=20 > - >=20 > - Execute the Get Self Test results command to determine whether or not = the BMC self tests >=20 > - have passed >=20 > - >=20 > -Arguments: >=20 > - >=20 > - mIpmiInstance - Data structure describing BMC variables and used for= sending commands >=20 > - StatusCodeValue - An array used to accumulate error codes for later re= porting. >=20 > - ErrorCount - Counter used to keep track of error codes in StatusC= odeValue >=20 > - >=20 > -Returns: >=20 > - >=20 > - EFI_SUCCESS - BMC Self test results are retrieved and saved into= BmcStatus >=20 > - EFI_DEVICE_ERROR - BMC failed to return self test results. >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - IPMI_SELF_TEST_RESULT_RESPONSE TestResult; >=20 > - >=20 > - // >=20 > - // Get the SELF TEST Results. >=20 > - // >=20 > - Status =3D IpmiGetSelfTestResult (&TestResult); >=20 > - if (EFI_ERROR(Status)) { >=20 > - DEBUG((DEBUG_ERROR, "\n[IPMI] BMC does not respond (status: %r)!\n\n= ", Status)); >=20 > - return Status; >=20 > - } >=20 > - >=20 > - DEBUG((DEBUG_INFO, "[IPMI] BMC self-test result: %02X-%02X\n", TestRes= ult.Result, TestResult.Param)); >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -GetDeviceId ( >=20 > - OUT BOOLEAN *UpdateMode >=20 > - ) >=20 > -/*++ >=20 > - >=20 > -Routine Description: >=20 > - Execute the Get Device ID command to determine whether or not the BMC = is in Force Update >=20 > - Mode. If it is, then report it to the error manager. >=20 > - >=20 > -Arguments: >=20 > - >=20 > -Returns: >=20 > - Status >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - IPMI_GET_DEVICE_ID_RESPONSE BmcInfo; >=20 > - UINT32 Retries; >=20 > - >=20 > - // >=20 > - // Set up a loop to retry for up to 30 seconds. Calculate retries not = timeout >=20 > - // so that in case KCS is not enabled and EfiIpmiSendCommand() returns >=20 > - // immediately we will not wait all the 30 seconds. >=20 > - // >=20 > - Retries =3D BMC_TIMEOUT / BMC_KCS_TIMEOUT + 1; >=20 > - // >=20 > - // Get the device ID information for the BMC. >=20 > - // >=20 > - do { >=20 > - Status =3D IpmiGetDeviceId (&BmcInfo); >=20 > - if (!EFI_ERROR(Status)) { >=20 > - break; >=20 > - } >=20 > - DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d r= etries left\n", Status, Retries)); >=20 > - MicroSecondDelay(50 * 1000); >=20 > - if (Retries-- =3D=3D 0) { >=20 > - return Status; >=20 > - } >=20 > - } while (TRUE); >=20 > - >=20 > - DEBUG(( >=20 > - DEBUG_INFO, >=20 > - "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n", >=20 > - BmcInfo.DeviceId, >=20 > - BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev, >=20 > - BmcInfo.MinorFirmwareRev >=20 > - )); >=20 > - *UpdateMode =3D (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode; >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - The entry point of the Ipmi DXE. >=20 > - >=20 > -@param[in] ImageHandle - Handle of this driver image >=20 > -@param[in] SystemTable - Table containing standard EFI services >=20 > - >=20 > -@retval EFI_SUCCESS - Always success is returned even if KCS does not fu= nction >=20 > - >=20 > - **/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiInterfaceInit ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -{ >=20 > - BOOLEAN UpdateMode; >=20 > - EFI_STATUS Status; >=20 > - >=20 > - DEBUG((EFI_D_ERROR,"IPMI Dxe:Get BMC Device Id\n")); >=20 > - >=20 > - // >=20 > - // Get the Device ID and check if the system is in Force Update mode. >=20 > - // >=20 > - Status =3D GetDeviceId (&UpdateMode); >=20 > - // >=20 > - // Do not continue initialization if the BMC is in Force Update Mode. >=20 > - // >=20 > - if (!EFI_ERROR(Status) && !UpdateMode) { >=20 > - // >=20 > - // Get the SELF TEST Results. >=20 > - // >=20 > - GetSelfTest (); >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > - >=20 > 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 >=20 > -# Component description file for IPMI initialization. >=20 > -# >=20 > -# Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D DxeIpmiInit >=20 > - FILE_GUID =3D 07A01ACF-46D5-48de-A63D-74FA92AA845= 0 >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - ENTRY_POINT =3D IpmiInterfaceInit >=20 > - >=20 > -[Sources] >=20 > - DxeIpmiInit.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - UefiBootServicesTableLib >=20 > - DebugLib >=20 > - UefiDriverEntryPoint >=20 > - IpmiCommandLib >=20 > - TimerLib >=20 > - >=20 > -[Depex] >=20 > - 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 >=20 > - IPMI stack initialization in PEI. >=20 > - >=20 > -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#define BMC_TIMEOUT_PEI 50 // [s] How long shall BIOS wait for BMC >=20 > -#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout >=20 > - >=20 > -EFI_STATUS >=20 > -GetDeviceId ( >=20 > - OUT BOOLEAN *UpdateMode >=20 > - ) >=20 > -/*++ >=20 > - >=20 > -Routine Description: >=20 > - Execute the Get Device ID command to determine whether or not the BMC = is in Force Update >=20 > - Mode. If it is, then report it to the error manager. >=20 > - >=20 > -Arguments: >=20 > - >=20 > -Returns: >=20 > - Status >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - IPMI_GET_DEVICE_ID_RESPONSE BmcInfo; >=20 > - UINT32 Retries; >=20 > - >=20 > - // >=20 > - // Set up a loop to retry for up to 30 seconds. Calculate retries not = timeout >=20 > - // so that in case KCS is not enabled and EfiIpmiSendCommand() returns >=20 > - // immediately we will not wait all the 30 seconds. >=20 > - // >=20 > - Retries =3D BMC_TIMEOUT_PEI/ BMC_KCS_TIMEOUT + 1; >=20 > - // >=20 > - // Get the device ID information for the BMC. >=20 > - // >=20 > - do { >=20 > - Status =3D IpmiGetDeviceId (&BmcInfo); >=20 > - if (!EFI_ERROR(Status)) { >=20 > - break; >=20 > - } >=20 > - DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d r= etries left\n", Status, Retries)); >=20 > - if (Retries-- =3D=3D 0) { >=20 > - return Status; >=20 > - } >=20 > - } while (TRUE); >=20 > - >=20 > - DEBUG(( >=20 > - DEBUG_INFO, >=20 > - "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n", >=20 > - BmcInfo.DeviceId, >=20 > - BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev, >=20 > - BmcInfo.MinorFirmwareRev >=20 > - )); >=20 > - *UpdateMode =3D (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode; >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - The entry point of the Ipmi PEIM. >=20 > - >=20 > - @param FileHandle Handle of the file being invoked. >=20 > - @param PeiServices Describes the list of possible PEI Services. >=20 > - >=20 > - @retval EFI_SUCCESS Indicates that Ipmi initialization completed suc= cessfully. >=20 > - @retval Others Indicates that Ipmi initialization could not com= plete successfully. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -PeimIpmiInterfaceInit ( >=20 > - IN EFI_PEI_FILE_HANDLE FileHandle, >=20 > - IN CONST EFI_PEI_SERVICES **PeiServices >=20 > - ) >=20 > -{ >=20 > - BOOLEAN UpdateMode; >=20 > - EFI_STATUS Status; >=20 > - >=20 > - DEBUG ((DEBUG_INFO, "IPMI Peim:Get BMC Device Id\n")); >=20 > - >=20 > - // >=20 > - // Get the Device ID and check if the system is in Force Update mode. >=20 > - // >=20 > - Status =3D GetDeviceId (&UpdateMode); >=20 > - return Status; >=20 > -} >=20 > 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 >=20 > -# Component description file for IPMI initialization in PEI. >=20 > -# >=20 > -# Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D PeiIpmiInit >=20 > - FILE_GUID =3D D8F57F4E-D67D-4f2c-8351-C7092986542= F >=20 > - MODULE_TYPE =3D PEIM >=20 > - VERSION_STRING =3D 1.0 >=20 > - ENTRY_POINT =3D PeimIpmiInterfaceInit >=20 > - >=20 > -[Sources] >=20 > - PeiIpmiInit.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - PeimEntryPoint >=20 > - DebugLib >=20 > - IpmiCommandLib >=20 > - >=20 > -[Depex] >=20 > - TRUE > \ No newline at end of file > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLi= b/IpmiCommandLib.inf > b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiComma= ndLib.inf > deleted file mode 100644 > index 89e7a66f60..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiC= ommandLib.inf > +++ /dev/null > @@ -1,32 +0,0 @@ > -### @file >=20 > -# Component description file for IPMI Command Library. >=20 > -# >=20 > -# Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D IpmiCommandLib >=20 > - FILE_GUID =3D E599C9C7-5913-40A0-8669-67282E2BEC5= 3 >=20 > - MODULE_TYPE =3D UEFI_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D IpmiCommandLib >=20 > - >=20 > -[sources] >=20 > - IpmiCommandLibNetFnApp.c >=20 > - IpmiCommandLibNetFnTransport.c >=20 > - IpmiCommandLibNetFnChassis.c >=20 > - IpmiCommandLibNetFnStorage.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - BaseMemoryLib >=20 > - DebugLib >=20 > - IpmiLib >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLi= b/IpmiCommandLibNetFnApp.c > b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiComma= ndLibNetFnApp.c > deleted file mode 100644 > index b57db50610..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiC= ommandLibNetFnApp.c > +++ /dev/null > @@ -1,248 +0,0 @@ > -/** @file >=20 > - IPMI Command - NetFnApp. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetDeviceId ( >=20 > - OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*DeviceId); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_APP, >=20 > - IPMI_APP_GET_DEVICE_ID, >=20 > - NULL, >=20 > - 0, >=20 > - (VOID *)DeviceId, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSelfTestResult ( >=20 > - OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*SelfTestResult); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_APP, >=20 > - IPMI_APP_GET_SELFTEST_RESULTS, >=20 > - NULL, >=20 > - 0, >=20 > - (VOID *)SelfTestResult, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiResetWatchdogTimer ( >=20 > - OUT UINT8 *CompletionCode >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*CompletionCode); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_APP, >=20 > - IPMI_APP_RESET_WATCHDOG_TIMER, >=20 > - NULL, >=20 > - 0, >=20 > - (VOID *)CompletionCode, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSetWatchdogTimer ( >=20 > - IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer, >=20 > - OUT UINT8 *CompletionCode >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*CompletionCode); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_APP, >=20 > - IPMI_APP_SET_WATCHDOG_TIMER, >=20 > - (VOID *)SetWatchdogTimer, >=20 > - sizeof(*SetWatchdogTimer), >=20 > - (VOID *)CompletionCode, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetWatchdogTimer ( >=20 > - OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*GetWatchdogTimer); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_APP, >=20 > - IPMI_APP_GET_WATCHDOG_TIMER, >=20 > - NULL, >=20 > - 0, >=20 > - (VOID *)GetWatchdogTimer, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSetBmcGlobalEnables ( >=20 > - IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables, >=20 > - OUT UINT8 *CompletionCode >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*CompletionCode); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_APP, >=20 > - IPMI_APP_SET_BMC_GLOBAL_ENABLES, >=20 > - (VOID *)SetBmcGlobalEnables, >=20 > - sizeof(*SetBmcGlobalEnables), >=20 > - (VOID *)CompletionCode, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetBmcGlobalEnables ( >=20 > - OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*GetBmcGlobalEnables); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_APP, >=20 > - IPMI_APP_GET_BMC_GLOBAL_ENABLES, >=20 > - NULL, >=20 > - 0, >=20 > - (VOID *)GetBmcGlobalEnables, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiClearMessageFlags ( >=20 > - IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest, >=20 > - OUT UINT8 *CompletionCode >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*CompletionCode); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_APP, >=20 > - IPMI_APP_CLEAR_MESSAGE_FLAGS, >=20 > - (VOID *)ClearMessageFlagsRequest, >=20 > - sizeof(*ClearMessageFlagsRequest), >=20 > - (VOID *)CompletionCode, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetMessageFlags ( >=20 > - OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*GetMessageFlagsResponse); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_APP, >=20 > - IPMI_APP_GET_MESSAGE_FLAGS, >=20 > - NULL, >=20 > - 0, >=20 > - (VOID *)GetMessageFlagsResponse, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetMessage ( >=20 > - OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse, >=20 > - IN OUT UINT32 *GetMessageResponseSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_APP, >=20 > - IPMI_APP_GET_MESSAGE, >=20 > - NULL, >=20 > - 0, >=20 > - (VOID *)GetMessageResponse, >=20 > - GetMessageResponseSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSendMessage ( >=20 > - IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest, >=20 > - IN UINT32 SendMessageRequestSize, >=20 > - OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse, >=20 > - IN OUT UINT32 *SendMessageResponseSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_APP, >=20 > - IPMI_APP_SEND_MESSAGE, >=20 > - (VOID *)SendMessageRequest, >=20 > - SendMessageRequestSize, >=20 > - (VOID *)SendMessageResponse, >=20 > - SendMessageResponseSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLi= b/IpmiCommandLibNetFnChassis.c > b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiComma= ndLibNetFnChassis.c > deleted file mode 100644 > index 1b86aa888e..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiC= ommandLibNetFnChassis.c > +++ /dev/null > @@ -1,101 +0,0 @@ > -/** @file >=20 > - IPMI Command - NetFnChassis. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > - >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetChassisCapabilities ( >=20 > - OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesRes= ponse >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*GetChassisCapabilitiesResponse); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_CHASSIS, >=20 > - IPMI_CHASSIS_GET_CAPABILITIES, >=20 > - NULL, >=20 > - 0, >=20 > - (VOID *)GetChassisCapabilitiesResponse, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetChassisStatus ( >=20 > - OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*GetChassisStatusResponse); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_CHASSIS, >=20 > - IPMI_CHASSIS_GET_STATUS, >=20 > - NULL, >=20 > - 0, >=20 > - (VOID *)GetChassisStatusResponse, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiChassisControl ( >=20 > - IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest, >=20 > - OUT UINT8 *CompletionCode >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*CompletionCode); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_CHASSIS, >=20 > - IPMI_CHASSIS_CONTROL, >=20 > - (VOID *)ChassisControlRequest, >=20 > - sizeof(*ChassisControlRequest), >=20 > - (VOID *)CompletionCode, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSetPowerRestorePolicy ( >=20 > - IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest, >=20 > - OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*ChassisControlResponse); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_CHASSIS, >=20 > - IPMI_CHASSIS_SET_POWER_RESTORE_POLICY, >=20 > - (VOID *)ChassisControlRequest, >=20 > - sizeof(*ChassisControlRequest), >=20 > - (VOID *)ChassisControlResponse, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLi= b/IpmiCommandLibNetFnStorage.c > b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiComma= ndLibNetFnStorage.c > deleted file mode 100644 > index 8e892c5f84..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiC= ommandLibNetFnStorage.c > +++ /dev/null > @@ -1,275 +0,0 @@ > -/** @file >=20 > - IPMI Command - NetFnStorage. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > - >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetFruInventoryAreaInfo ( >=20 > - IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInf= oRequest, >=20 > - OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInf= oResponse >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*GetFruInventoryAreaInfoResponse); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_STORAGE, >=20 > - IPMI_STORAGE_GET_FRU_INVENTORY_AREAINFO, >=20 > - (VOID *)GetFruInventoryAreaInfoRequest, >=20 > - sizeof(*GetFruInventoryAreaInfoRequest), >=20 > - (VOID *)GetFruInventoryAreaInfoResponse, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiReadFruData ( >=20 > - IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest, >=20 > - OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse, >=20 > - IN OUT UINT32 *ReadFruDataResponseSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_STORAGE, >=20 > - IPMI_STORAGE_READ_FRU_DATA, >=20 > - (VOID *)ReadFruDataRequest, >=20 > - sizeof(*ReadFruDataRequest), >=20 > - (VOID *)ReadFruDataResponse, >=20 > - ReadFruDataResponseSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiWriteFruData ( >=20 > - IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest, >=20 > - IN UINT32 WriteFruDataRequestSize, >=20 > - OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*WriteFruDataResponse); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_STORAGE, >=20 > - IPMI_STORAGE_WRITE_FRU_DATA, >=20 > - (VOID *)WriteFruDataRequest, >=20 > - WriteFruDataRequestSize, >=20 > - (VOID *)WriteFruDataResponse, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSelInfo ( >=20 > - OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*GetSelInfoResponse); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_STORAGE, >=20 > - IPMI_STORAGE_GET_SEL_INFO, >=20 > - NULL, >=20 > - 0, >=20 > - (VOID *)GetSelInfoResponse, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSelEntry ( >=20 > - IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest, >=20 > - OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse, >=20 > - IN OUT UINT32 *GetSelEntryResponseSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_STORAGE, >=20 > - IPMI_STORAGE_GET_SEL_ENTRY, >=20 > - (VOID *)GetSelEntryRequest, >=20 > - sizeof(*GetSelEntryRequest), >=20 > - (VOID *)GetSelEntryResponse, >=20 > - GetSelEntryResponseSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiAddSelEntry ( >=20 > - IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest, >=20 > - OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*AddSelEntryResponse); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_STORAGE, >=20 > - IPMI_STORAGE_ADD_SEL_ENTRY, >=20 > - (VOID *)AddSelEntryRequest, >=20 > - sizeof(*AddSelEntryRequest), >=20 > - (VOID *)AddSelEntryResponse, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiPartialAddSelEntry ( >=20 > - IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest, >=20 > - IN UINT32 PartialAddSelEntryRequestSize= , >=20 > - OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*PartialAddSelEntryResponse); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_STORAGE, >=20 > - IPMI_STORAGE_PARTIAL_ADD_SEL_ENTRY, >=20 > - (VOID *)PartialAddSelEntryRequest, >=20 > - PartialAddSelEntryRequestSize, >=20 > - (VOID *)PartialAddSelEntryResponse, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiClearSel ( >=20 > - IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest, >=20 > - OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*ClearSelResponse); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_STORAGE, >=20 > - IPMI_STORAGE_CLEAR_SEL, >=20 > - (VOID *)ClearSelRequest, >=20 > - sizeof(*ClearSelRequest), >=20 > - (VOID *)ClearSelResponse, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSelTime ( >=20 > - OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*GetSelTimeResponse); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_STORAGE, >=20 > - IPMI_STORAGE_GET_SEL_TIME, >=20 > - NULL, >=20 > - 0, >=20 > - (VOID *)GetSelTimeResponse, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSetSelTime ( >=20 > - IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest, >=20 > - OUT UINT8 *CompletionCode >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*CompletionCode); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_STORAGE, >=20 > - IPMI_STORAGE_SET_SEL_TIME, >=20 > - (VOID *)SetSelTimeRequest, >=20 > - sizeof(*SetSelTimeRequest), >=20 > - (VOID *)CompletionCode, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSdrRepositoryInfo ( >=20 > - OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*GetSdrRepositoryInfoResp); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_STORAGE, >=20 > - IPMI_STORAGE_GET_SDR_REPOSITORY_INFO, >=20 > - NULL, >=20 > - 0, >=20 > - (VOID *)GetSdrRepositoryInfoResp, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSdr ( >=20 > - IN IPMI_GET_SDR_REQUEST *GetSdrRequest, >=20 > - OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse, >=20 > - IN OUT UINT32 *GetSdrResponseSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_STORAGE, >=20 > - IPMI_STORAGE_GET_SDR, >=20 > - (VOID *)GetSdrRequest, >=20 > - sizeof(*GetSdrRequest), >=20 > - (VOID *)GetSdrResponse, >=20 > - GetSdrResponseSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLi= b/IpmiCommandLibNetFnTransport.c > b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiComma= ndLibNetFnTransport.c > deleted file mode 100644 > index 3b9b17b909..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiC= ommandLibNetFnTransport.c > +++ /dev/null > @@ -1,81 +0,0 @@ > -/** @file >=20 > - IPMI Command - NetFnTransport. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > - >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSolActivating ( >=20 > - IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest, >=20 > - OUT UINT8 *CompletionCode >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*CompletionCode); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_TRANSPORT, >=20 > - IPMI_TRANSPORT_SOL_ACTIVATING, >=20 > - (VOID *)SolActivatingRequest, >=20 > - sizeof(*SolActivatingRequest), >=20 > - (VOID *)CompletionCode, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSetSolConfigurationParameters ( >=20 > - IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationPa= rametersRequest, >=20 > - IN UINT32 SetConfigurationPar= ametersRequestSize, >=20 > - OUT UINT8 *CompletionCode >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINT32 DataSize; >=20 > - >=20 > - DataSize =3D sizeof(*CompletionCode); >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_TRANSPORT, >=20 > - IPMI_TRANSPORT_SET_SOL_CONFIG_PARAM, >=20 > - (VOID *)SetConfigurationParametersRequest, >=20 > - SetConfigurationParametersRequestSize, >=20 > - (VOID *)CompletionCode, >=20 > - &DataSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiGetSolConfigurationParameters ( >=20 > - IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationPa= rametersRequest, >=20 > - OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationPa= rametersResponse, >=20 > - IN OUT UINT32 *GetConfigurationPa= rametersResponseSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - >=20 > - Status =3D IpmiSubmitCommand ( >=20 > - IPMI_NETFN_TRANSPORT, >=20 > - IPMI_TRANSPORT_GET_SOL_CONFIG_PARAM, >=20 > - (VOID *)GetConfigurationParametersRequest, >=20 > - sizeof(*GetConfigurationParametersRequest), >=20 > - (VOID *)GetConfigurationParametersResponse, >=20 > - GetConfigurationParametersResponseSize >=20 > - ); >=20 > - return Status; >=20 > -} >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/I= pmiLibNull.c > b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.= c > deleted file mode 100644 > index db4c7ada7e..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibN= ull.c > +++ /dev/null > @@ -1,45 +0,0 @@ > -/** @file >=20 > - IPMI library. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > - >=20 > -/** >=20 > - This service enables submitting commands via Ipmi. >=20 > - >=20 > - @param[in] NetFunction Net function of the command. >=20 > - @param[in] Command IPMI Command. >=20 > - @param[in] RequestData Command Request Data. >=20 > - @param[in] RequestDataSize Size of Command Request Data. >=20 > - @param[out] ResponseData Command Response Data. The comple= tion code is the first byte of response data. >=20 > - @param[in, out] ResponseDataSize Size of Command Response Data. >=20 > - >=20 > - @retval EFI_SUCCESS The command byte stream was successfull= y submit to the device and a response was > successfully received. >=20 > - @retval EFI_NOT_FOUND The command was not successfully sent t= o the device or a response was not successfully > received from the device. >=20 > - @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi comma= nd access. >=20 > - @retval EFI_DEVICE_ERROR Ipmi Device hardware error. >=20 > - @retval EFI_TIMEOUT The command time out. >=20 > - @retval EFI_UNSUPPORTED The command was not successfully sent t= o the device. >=20 > - @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resour= ce or data size error. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -IpmiSubmitCommand ( >=20 > - IN UINT8 NetFunction, >=20 > - IN UINT8 Command, >=20 > - IN UINT8 *RequestData, >=20 > - IN UINT32 RequestDataSize, >=20 > - OUT UINT8 *ResponseData, >=20 > - IN OUT UINT32 *ResponseDataSize >=20 > - ) >=20 > -{ >=20 > - return EFI_UNSUPPORTED; >=20 > -} >=20 > - >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/I= pmiLibNull.inf > b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.= inf > deleted file mode 100644 > index c042b8beed..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibN= ull.inf > +++ /dev/null > @@ -1,28 +0,0 @@ > -### @file >=20 > -# Component description file for IPMI NULL Library. >=20 > -# >=20 > -# Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D IpmiLibNull >=20 > - FILE_GUID =3D DDF0E1D9-F53F-429A-BD9C-5D12A321E62= 5 >=20 > - MODULE_TYPE =3D UEFI_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D IpmiLib >=20 > - >=20 > -[sources] >=20 > - IpmiLibNull.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - >=20 > -[Pcd] >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformH= ookLibNull/IpmiPlatformHookLibNull.c > b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/= IpmiPlatformHookLibNull.c > deleted file mode 100644 > index bdc8d23827..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibN= ull/IpmiPlatformHookLibNull.c > +++ /dev/null > @@ -1,36 +0,0 @@ > -/** @file >=20 > - IPMI platform hook library. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > - >=20 > -// >=20 > -// Prototype definitions for IPMI Platform Update Library >=20 > -// >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -PlatformIpmiIoRangeSet( >=20 > - UINT16 IpmiIoBase >=20 > - ) >=20 > -/*++ >=20 > - >=20 > - Routine Description: >=20 > - >=20 > - This function sets IPMI Io range >=20 > - >=20 > - Arguments: >=20 > - >=20 > - IpmiIoBase >=20 > - >=20 > - Returns: >=20 > - >=20 > - Status >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformH= ookLibNull/IpmiPlatformHookLibNull.inf > b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNull/= IpmiPlatformHookLibNull.inf > deleted file mode 100644 > index 458b40f626..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibN= ull/IpmiPlatformHookLibNull.inf > +++ /dev/null > @@ -1,29 +0,0 @@ > -### @file >=20 > -# Component description file for IPMI platform Library. >=20 > -# >=20 > -# Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D IpmiPlatformHookLibNull >=20 > - FILE_GUID =3D C31A5B17-81DB-4D86-B376-17711BB6E0A= 5 >=20 > - MODULE_TYPE =3D BASE >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D IpmiPlatformHookLib >=20 > - >=20 > -[sources] >=20 > - IpmiPlatformHookLibNull.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - DebugLib >=20 > - >=20 > -[Protocols] >=20 > - gEfiIpmiTransportProtocolGuid >=20 > 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 >=20 > - IPMI Os watchdog timer Driver. >=20 > - >=20 > -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -BOOLEAN mOsWdtFlag =3D FALSE; >=20 > - >=20 > -EFI_EVENT mExitBootServicesEvent; >=20 > - >=20 > -VOID >=20 > -EFIAPI >=20 > -EnableEfiOsBootWdtHandler ( >=20 > - IN EFI_EVENT Event, >=20 > - IN VOID *Context >=20 > - ) >=20 > -/*++ >=20 > - >=20 > -Routine Description: >=20 > - Enable the OS Boot Watchdog Timer. >=20 > - Is called only on legacy or EFI OS boot. >=20 > - >=20 > -Arguments: >=20 > - Event - Event type >=20 > - *Context - Context for the event >=20 > - >=20 > -Returns: >=20 > - None >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer; >=20 > - UINT8 CompletionCode; >=20 > - IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; >=20 > - static BOOLEAN OsWdtEventHandled =3D FALSE; >=20 > - >=20 > - DEBUG((EFI_D_ERROR, "!!! EnableEfiOsBootWdtHandler()!!!\n")); >=20 > - >=20 > - // >=20 > - // Make sure it processes once only. And proceess it only if OsWdtFlag= =3D=3DTRUE; >=20 > - // >=20 > - if (OsWdtEventHandled || !mOsWdtFlag) { >=20 > - return ; >=20 > - } >=20 > - >=20 > - OsWdtEventHandled =3D TRUE; >=20 > - >=20 > - Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return ; >=20 > - } >=20 > - >=20 > - ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer)); >=20 > - // >=20 > - // Just flip the Timer Use bit. This should release the timer. >=20 > - // >=20 > - SetWatchdogTimer.TimerUse.Bits.TimerRunning =3D 1; >=20 > - SetWatchdogTimer.TimerUse.Bits.TimerUse =3D IPMI_WATCHDOG_TIMER= _OS_LOADER; >=20 > - SetWatchdogTimer.TimerActions.Uint8 =3D IPMI_WATCHDOG_TIMER= _ACTION_HARD_RESET; >=20 > - SetWatchdogTimer.TimerUseExpirationFlagsClear &=3D ~BIT4; >=20 > - SetWatchdogTimer.TimerUseExpirationFlagsClear |=3D BIT1 | BIT2; >=20 > - SetWatchdogTimer.InitialCountdownValue =3D 600; // 100ms / cou= nt >=20 > - >=20 > - Status =3D IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode); >=20 > - return ; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -DriverInit ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -/*++ >=20 > - >=20 > -Routine Description: >=20 > - This is the standard EFI driver point. This function intitializes >=20 > - the private data required for creating ASRR Driver. >=20 > - >=20 > -Arguments: >=20 > - As required for DXE driver enrty routine. >=20 > - ImageHandle - ImageHandle of the loaded driver >=20 > - SystemTable - Pointer to the System Table >=20 > - >=20 > -Returns: >=20 > - @retval EFI_SUCCESS Protocol successfully started and instal= led. >=20 > - @retval EFI_OUT_OF_RESOURCES The event could not be allocated. >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - >=20 > - Status =3D gBS->CreateEvent ( >=20 > - EVT_SIGNAL_EXIT_BOOT_SERVICES, >=20 > - TPL_NOTIFY, >=20 > - EnableEfiOsBootWdtHandler, >=20 > - NULL, >=20 > - &mExitBootServicesEvent >=20 > - ); >=20 > - >=20 > - return Status; >=20 > -} >=20 > 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 >=20 > -# Component description file for IPMI OS watch dog timer driver. >=20 > -# >=20 > -# Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D OsWdt >=20 > - FILE_GUID =3D BE9B694A-B5D9-48e0-A527-6E1A49EB702= 8 >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - ENTRY_POINT =3D DriverInit >=20 > - >=20 > -[Sources] >=20 > - OsWdt.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - UefiDriverEntryPoint >=20 > - DebugLib >=20 > - UefiBootServicesTableLib >=20 > - BaseMemoryLib >=20 > - IpmiCommandLib >=20 > - >=20 > -[Depex] >=20 > - TRUE >=20 > - >=20 > 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 >=20 > - IPMI Serial Over Lan Driver. >=20 > - >=20 > -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#define SOL_CMD_RETRY_COUNT 10 >=20 > - >=20 > -/*++ >=20 > - >=20 > -Routine Description: >=20 > - >=20 > - This routine gets the SOL payload status or settings for a specific = channel. >=20 > - >=20 > -Arguments: >=20 > - Channel - LAN channel naumber. >=20 > - ParamSel - Configuration parameter selection. >=20 > - Data - Information returned from BMC. >=20 > -Returns: >=20 > - EFI_SUCCESS - SOL configuration parameters are successfully read= from BMC. >=20 > - Others - SOL configuration parameters could not be read fro= m BMC. >=20 > - >=20 > ---*/ >=20 > -EFI_STATUS >=20 > -GetSOLStatus ( >=20 > - IN UINT8 Channel, >=20 > - IN UINT8 ParamSel, >=20 > - IN OUT UINT8 *Data >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status =3D EFI_SUCCESS; >=20 > - IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST GetConfigurationParamet= ersRequest; >=20 > - IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE GetConfigurationParamet= ersResponse; >=20 > - UINT32 DataSize; >=20 > - UINT8 RetryCount; >=20 > - >=20 > - for (RetryCount =3D 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++)= { >=20 > - ZeroMem (&GetConfigurationParametersRequest, sizeof(GetConfiguration= ParametersRequest)); >=20 > - GetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber = =3D Channel; >=20 > - GetConfigurationParametersRequest.ParameterSelector = =3D ParamSel; >=20 > - >=20 > - ZeroMem (&GetConfigurationParametersResponse, sizeof(GetConfiguratio= nParametersResponse)); >=20 > - >=20 > - DataSize =3D sizeof(GetConfigurationParametersResponse); >=20 > - Status =3D IpmiGetSolConfigurationParameters ( >=20 > - &GetConfigurationParametersRequest, >=20 > - &GetConfigurationParametersResponse, >=20 > - &DataSize >=20 > - ); >=20 > - >=20 > - if (Status =3D=3D EFI_SUCCESS){ >=20 > - break; >=20 > - } else { >=20 > - gBS->Stall(100000); >=20 > - } >=20 > - } >=20 > - >=20 > - if (Status =3D=3D EFI_SUCCESS) { >=20 > - *Data =3D GetConfigurationParametersResponse.ParameterData[0]; >=20 > - } >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/*++ >=20 > - >=20 > -Routine Description: >=20 > - >=20 > - This routine sets the SOL payload configuration parameters for a spe= cific channel. >=20 > - >=20 > -Arguments: >=20 > - Channel - LAN channel naumber. >=20 > - ParamSel - Configuration parameter selection. >=20 > - Data - Configuration parameter values. >=20 > -Returns: >=20 > - EFI_SUCCESS - SOL configuration parameters are sent to BMC. >=20 > - Others - SOL configuration parameters could not be sent to = BMC. >=20 > - >=20 > ---*/ >=20 > -EFI_STATUS >=20 > -SetSOLParams ( >=20 > - IN UINT8 Channel, >=20 > - IN UINT8 ParamSel, >=20 > - IN UINT8 Data >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status =3D EFI_SUCCESS; >=20 > - IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST SetConfigurationParamet= ersRequest; >=20 > - UINT8 CompletionCode; >=20 > - UINT8 RetryCount; >=20 > - >=20 > - for (RetryCount =3D 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++)= { >=20 > - ZeroMem (&SetConfigurationParametersRequest, sizeof(SetConfiguration= ParametersRequest)); >=20 > - SetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber = =3D Channel; >=20 > - SetConfigurationParametersRequest.ParameterSelector = =3D ParamSel; >=20 > - SetConfigurationParametersRequest.ParameterData[0] = =3D Data; >=20 > - >=20 > - CompletionCode =3D 0; >=20 > - >=20 > - Status =3D IpmiSetSolConfigurationParameters ( >=20 > - &SetConfigurationParametersRequest, >=20 > - sizeof(SetConfigurationParametersRequest), >=20 > - &CompletionCode >=20 > - ); >=20 > - >=20 > - if (Status =3D=3D EFI_SUCCESS) { >=20 > - break; >=20 > - } else { >=20 > - gBS->Stall(100000); >=20 > - } >=20 > - } >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -SolStatusEntryPoint ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -/*++ >=20 > - >=20 > - Routine Description: >=20 > - This is the standard EFI driver point. This function intitializes >=20 > - the private data required for creating SOL Status Driver. >=20 > - >=20 > - Arguments: >=20 > - ImageHandle - Handle for the image of this driver >=20 > - SystemTable - Pointer to the EFI System Table >=20 > - >=20 > - Returns: >=20 > - EFI_SUCCESS - Protocol successfully installed >=20 > - EFI_UNSUPPORTED - Protocol can't be installed. >=20 > - >=20 > ---*/ >=20 > -{ >=20 > - EFI_STATUS Status =3D EFI_SUCCESS; >=20 > - UINT8 Channel; >=20 > - BOOLEAN SolEnabled =3D FALSE; >=20 > - >=20 > - for (Channel =3D 1; Channel <=3D PcdGet8 (PcdMaxSOLChannels); Channel+= +) { >=20 > - Status =3D GetSOLStatus (Channel, IPMI_SOL_CONFIGURATION_PARAMETER_S= OL_ENABLE, &SolEnabled); >=20 > - if (Status =3D=3D EFI_SUCCESS) { >=20 > - DEBUG ((DEBUG_ERROR, "SOL enabling status for channel %x is %x\n",= Channel, SolEnabled)); >=20 > - } else { >=20 > - DEBUG ((DEBUG_ERROR, "Failed to get channel %x SOL status from BMC= !, status is %x\n", Channel, Status)); >=20 > - } >=20 > - } >=20 > - >=20 > - return Status; >=20 > -} >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.i= nf > 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 >=20 > -# Component description file for IPMI Serial Over LAN driver. >=20 > -# >=20 > -# Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D SolStatus >=20 > - FILE_GUID =3D F9887B5E-2D46-4213-8794-14F1FD39F6B8 >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - PI_SPECIFICATION_VERSION =3D 0x0001000A >=20 > - VERSION_STRING =3D 1.0 >=20 > - ENTRY_POINT =3D SolStatusEntryPoint >=20 > - >=20 > -[Sources] >=20 > - SolStatus.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - >=20 > -[Pcd] >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels >=20 > - >=20 > -[LibraryClasses] >=20 > - UefiDriverEntryPoint >=20 > - DebugLib >=20 > - UefiBootServicesTableLib >=20 > - IpmiCommandLib >=20 > - PcdLib >=20 > - >=20 > -[Depex] >=20 > - TRUE >=20 > - >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c b/Platform/Inte= l/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 >=20 > - Source code file for S3 PEI module >=20 > - >=20 > -Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > - >=20 > -/** >=20 > - S3 PEI module entry point >=20 > - >=20 > - @param[in] FileHandle Not used. >=20 > - @param[in] PeiServices General purpose services available to= every PEIM. >=20 > - >=20 > - @retval EFI_SUCCESS The function completes successfully >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to create data= base >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -S3PeiEntryPoint ( >=20 > - IN EFI_PEI_FILE_HANDLE FileHandle, >=20 > - IN CONST EFI_PEI_SERVICES **PeiServices >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - >=20 > - // >=20 > - // Install EFI_PEI_MM_ACCESS_PPI for S3 resume case >=20 > - // >=20 > - Status =3D PeiInstallSmmAccessPpi (); >=20 > - >=20 > - return Status; >=20 > -} >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.inf b/Platform/In= tel/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 >=20 > -# Component information file for the S3 PEI module. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010017 >=20 > - BASE_NAME =3D S3Pei >=20 > - FILE_GUID =3D 8683EFB2-FDE1-4AFF-B2DB-E96449FDD4E= 9 >=20 > - VERSION_STRING =3D 1.0 >=20 > - MODULE_TYPE =3D PEIM >=20 > - ENTRY_POINT =3D S3PeiEntryPoint >=20 > - >=20 > -[LibraryClasses] >=20 > - PeimEntryPoint >=20 > - PeiServicesLib >=20 > - SmmAccessLib >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - IntelSiliconPkg/IntelSiliconPkg.dec >=20 > - >=20 > -[Sources] >=20 > - S3Pei.c >=20 > - >=20 > -[Depex] >=20 > - gEfiPeiMemoryDiscoveredPpiGuid >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Smbi= osBasic.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 >=20 > - Smbios basic header file. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef _SMBIOS_BASIC_DRIVER_H >=20 > -#define _SMBIOS_BASIC_DRIVER_H >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -/** >=20 > - Add an SMBIOS record. >=20 > - >=20 > - @param Smbios The EFI_SMBIOS_PROTOCOL instance. >=20 > - @param SmbiosHandle A unique handle will be assigned to the = SMBIOS record. >=20 > - @param Record The data for the fixed portion of the SM= BIOS record. The format of the record is >=20 > - determined by EFI_SMBIOS_TABLE_HEADER.Ty= pe. The size of the formatted area is defined >=20 > - by EFI_SMBIOS_TABLE_HEADER.Length and ei= ther followed by a double-null (0x0000) or >=20 > - a set of null terminated strings and a n= ull. >=20 > - >=20 > - @retval EFI_SUCCESS Record was added. >=20 > - @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of syst= em resources. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -AddSmbiosRecord ( >=20 > - IN EFI_SMBIOS_PROTOCOL *Smbios, >=20 > - OUT EFI_SMBIOS_HANDLE *SmbiosHandle, >=20 > - IN EFI_SMBIOS_TABLE_HEADER *Record >=20 > - ); >=20 > - >=20 > -#endif >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Smbi= osBasicDxe.inf > b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.= inf > deleted file mode 100644 > index c3ec4f7885..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic= Dxe.inf > +++ /dev/null > @@ -1,83 +0,0 @@ > -### @file >=20 > -# Component description file for Smbios Misc module. >=20 > -# >=20 > -# Copyright (c) 2018-2019, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D SmbiosBasic >=20 > - FILE_GUID =3D 03ADF4A1-A27A-45E3-B211-3177C6C2E7E= D >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - ENTRY_POINT =3D SmbiosBasicEntryPoint >=20 > - >=20 > -# >=20 > -# The following information is for reference only and not required by th= e build tools. >=20 > -# >=20 > -# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC >=20 > -# >=20 > - >=20 > -[Sources] >=20 > - SmbiosBasicEntryPoint.c >=20 > - SmbiosBasic.h >=20 > - Type0BiosVendorFunction.c >=20 > - Type1SystemManufacturerFunction.c >=20 > - Type2BaseBoardManufacturerFunction.c >=20 > - Type3ChassisManufacturerFunction.c >=20 > - Type32BootInformationFunction.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - AdvancedFeaturePkg/AdvancedFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - PcdLib >=20 > - MemoryAllocationLib >=20 > - DevicePathLib >=20 > - BaseMemoryLib >=20 > - BaseLib >=20 > - DebugLib >=20 > - UefiBootServicesTableLib >=20 > - UefiDriverEntryPoint >=20 > - UefiLib >=20 > - HobLib >=20 > - >=20 > -[Protocols] >=20 > - gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUME= D >=20 > - gEfiVariableArchProtocolGuid >=20 > - >=20 > -[Pcd] >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassi= s >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber >=20 > - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation >=20 > - >=20 > -[Depex] >=20 > - gEfiSmbiosProtocolGuid AND >=20 > - gEfiVariableArchProtocolGuid >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Smbi= osBasicEntryPoint.c > b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntr= yPoint.c > deleted file mode 100644 > index 8e68629ef6..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic= EntryPoint.c > +++ /dev/null > @@ -1,125 +0,0 @@ > -/** @file >=20 > - Smbios basic entry point. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include "SmbiosBasic.h" >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -BiosVendorFunction( >=20 > - IN EFI_SMBIOS_PROTOCOL *Smbios >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -SystemManufacturerFunction( >=20 > - IN EFI_SMBIOS_PROTOCOL *Smbios >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -BaseBoardManufacturerFunction( >=20 > - IN EFI_SMBIOS_PROTOCOL *Smbios >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -ChassisManufacturerFunction( >=20 > - IN EFI_SMBIOS_PROTOCOL *Smbios >=20 > - ); >=20 > - >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -BootInfoStatusFunction( >=20 > - IN EFI_SMBIOS_PROTOCOL *Smbios >=20 > - ); >=20 > - >=20 > -typedef >=20 > -EFI_STATUS >=20 > -(EFIAPI EFI_BASIC_SMBIOS_DATA_FUNCTION) ( >=20 > - IN EFI_SMBIOS_PROTOCOL *Smbios >=20 > - ); >=20 > - >=20 > -typedef struct { >=20 > - EFI_BASIC_SMBIOS_DATA_FUNCTION *Function; >=20 > -} EFI_BASIC_SMBIOS_DATA; >=20 > - >=20 > -EFI_BASIC_SMBIOS_DATA mSmbiosBasicDataFuncTable[] =3D { >=20 > - {&BiosVendorFunction}, >=20 > - {&SystemManufacturerFunction}, >=20 > - {&BaseBoardManufacturerFunction}, >=20 > - {&ChassisManufacturerFunction}, >=20 > - {&BootInfoStatusFunction}, >=20 > -}; >=20 > - >=20 > -/** >=20 > - Standard EFI driver point. This driver parses the mSmbiosMiscDataTabl= e >=20 > - structure and reports any generated data using SMBIOS protocol. >=20 > - >=20 > - @param ImageHandle Handle for the image of this driver >=20 > - @param SystemTable Pointer to the EFI System Table >=20 > - >=20 > - @retval EFI_SUCCESS The data was successfully stored. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -SmbiosBasicEntryPoint( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -{ >=20 > - UINTN Index; >=20 > - EFI_STATUS EfiStatus; >=20 > - EFI_SMBIOS_PROTOCOL *Smbios; >=20 > - >=20 > - EfiStatus =3D gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID= **)&Smbios); >=20 > - if (EFI_ERROR(EfiStatus)) { >=20 > - DEBUG((EFI_D_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiSt= atus)); >=20 > - return EfiStatus; >=20 > - } >=20 > - >=20 > - for (Index =3D 0; Index < sizeof(mSmbiosBasicDataFuncTable)/sizeof(mSm= biosBasicDataFuncTable[0]); ++Index) { >=20 > - EfiStatus =3D (*mSmbiosBasicDataFuncTable[Index].Function) (Smbios); >=20 > - if (EFI_ERROR(EfiStatus)) { >=20 > - DEBUG((EFI_D_ERROR, "Basic smbios store error. Index=3D%d, Return= Status=3D%r\n", Index, EfiStatus)); >=20 > - return EfiStatus; >=20 > - } >=20 > - } >=20 > - >=20 > - return EfiStatus; >=20 > -} >=20 > - >=20 > -/** >=20 > - Add an SMBIOS record. >=20 > - >=20 > - @param Smbios The EFI_SMBIOS_PROTOCOL instance. >=20 > - @param SmbiosHandle A unique handle will be assigned to the = SMBIOS record. >=20 > - @param Record The data for the fixed portion of the SM= BIOS record. The format of the record is >=20 > - determined by EFI_SMBIOS_TABLE_HEADER.Ty= pe. The size of the formatted area is defined >=20 > - by EFI_SMBIOS_TABLE_HEADER.Length and ei= ther followed by a double-null (0x0000) or >=20 > - a set of null terminated strings and a n= ull. >=20 > - >=20 > - @retval EFI_SUCCESS Record was added. >=20 > - @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of syst= em resources. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -AddSmbiosRecord ( >=20 > - IN EFI_SMBIOS_PROTOCOL *Smbios, >=20 > - OUT EFI_SMBIOS_HANDLE *SmbiosHandle, >=20 > - IN EFI_SMBIOS_TABLE_HEADER *Record >=20 > - ) >=20 > -{ >=20 > - *SmbiosHandle =3D SMBIOS_HANDLE_PI_RESERVED; >=20 > - return Smbios->Add ( >=20 > - Smbios, >=20 > - NULL, >=20 > - SmbiosHandle, >=20 > - Record >=20 > - ); >=20 > -} >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type= 0BiosVendorFunction.c > b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendor= Function.c > deleted file mode 100644 > index 331efc8614..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVe= ndorFunction.c > +++ /dev/null > @@ -1,81 +0,0 @@ > -/** @file >=20 > - Smbios type 0. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include "SmbiosBasic.h" >=20 > - >=20 > -/** >=20 > - This function makes boot time changes to the contents of the >=20 > - BiosVendor (Type 0). >=20 > - >=20 > - @retval EFI_SUCCESS All parameters were valid. >=20 > - @retval EFI_UNSUPPORTED Unexpected RecordType value. >=20 > - @retval EFI_INVALID_PARAMETER Invalid parameter was found. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -BiosVendorFunction( >=20 > - IN EFI_SMBIOS_PROTOCOL *Smbios >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - CHAR8 *VendorStr; >=20 > - UINTN VendorStrLen; >=20 > - CHAR8 *VersionStr; >=20 > - UINTN VerStrLen; >=20 > - CHAR8 *DateStr; >=20 > - UINTN DateStrLen; >=20 > - SMBIOS_TABLE_TYPE0 *SmbiosRecord; >=20 > - SMBIOS_TABLE_TYPE0 *PcdSmbiosRecord; >=20 > - EFI_SMBIOS_HANDLE SmbiosHandle; >=20 > - UINTN StringOffset; >=20 > - >=20 > - PcdSmbiosRecord =3D PcdGetPtr (PcdSmbiosType0BiosInformation); >=20 > - >=20 > - VendorStr =3D PcdGetPtr (PcdSmbiosType0StringVendor); >=20 > - VendorStrLen =3D AsciiStrLen (VendorStr); >=20 > - ASSERT (VendorStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - VersionStr =3D PcdGetPtr (PcdSmbiosType0StringBiosVersion); >=20 > - VerStrLen =3D AsciiStrLen (VersionStr); >=20 > - ASSERT (VerStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - DateStr =3D PcdGetPtr (PcdSmbiosType0StringBiosReleaseDate); >=20 > - DateStrLen =3D AsciiStrLen (DateStr); >=20 > - ASSERT (DateStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - // >=20 > - // Two zeros following the last string. >=20 > - // >=20 > - SmbiosRecord =3D AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE0) + Vendo= rStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1); >=20 > - if (SmbiosRecord =3D=3D NULL) { >=20 > - ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE0)); >=20 > - >=20 > - SmbiosRecord->Hdr.Type =3D SMBIOS_TYPE_BIOS_INFORMATION; >=20 > - SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE0); >=20 > - SmbiosRecord->Hdr.Handle =3D 0; >=20 > - >=20 > - StringOffset =3D SmbiosRecord->Hdr.Length; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VendorStr, VendorStrLen= ); >=20 > - StringOffset +=3D VendorStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen); >=20 > - StringOffset +=3D VerStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, DateStr, DateStrLen); >=20 > - >=20 > - // >=20 > - // Now we have got the full smbios record, call smbios protocol to add= this record. >=20 > - // >=20 > - Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_H= EADER *) SmbiosRecord); >=20 > - >=20 > - FreePool (SmbiosRecord); >=20 > - return Status; >=20 > -} >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type= 1SystemManufacturerFunction.c > b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManu= facturerFunction.c > deleted file mode 100644 > index 2314d09695..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1System= ManufacturerFunction.c > +++ /dev/null > @@ -1,114 +0,0 @@ > -/** @file >=20 > - Smbios type 1. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include "SmbiosBasic.h" >=20 > - >=20 > -/** >=20 > - This function makes boot time changes to the contents of the >=20 > - SystemManufacturer (Type 1). >=20 > - >=20 > - @retval EFI_SUCCESS All parameters were valid. >=20 > - @retval EFI_UNSUPPORTED Unexpected RecordType value. >=20 > - @retval EFI_INVALID_PARAMETER Invalid parameter was found. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -SystemManufacturerFunction( >=20 > - IN EFI_SMBIOS_PROTOCOL *Smbios >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - CHAR8 *ManufacturerStr; >=20 > - CHAR8 *ProductNameStr; >=20 > - CHAR8 *VersionStr; >=20 > - CHAR8 *SerialNumberStr; >=20 > - CHAR8 *SKUNumberStr; >=20 > - CHAR8 *FamilyStr; >=20 > - UINTN ManufacturerStrLen; >=20 > - UINTN ProductNameStrLen; >=20 > - UINTN VersionStrLen; >=20 > - UINTN SerialNumberStrLen; >=20 > - UINTN SKUNumberStrLen; >=20 > - UINTN FamilyStrLen; >=20 > - UINTN TableSize; >=20 > - SMBIOS_TABLE_TYPE1 *PcdSmbiosRecord; >=20 > - SMBIOS_TABLE_TYPE1 *SmbiosRecord; >=20 > - EFI_SMBIOS_HANDLE SmbiosHandle; >=20 > - UINTN StringOffset; >=20 > - >=20 > - PcdSmbiosRecord =3D PcdGetPtr (PcdSmbiosType1SystemInformation); >=20 > - >=20 > - ManufacturerStr =3D PcdGetPtr (PcdSmbiosType1StringManufacturer); >=20 > - ManufacturerStrLen =3D AsciiStrLen (ManufacturerStr); >=20 > - ASSERT (ManufacturerStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - ProductNameStr =3D PcdGetPtr (PcdSmbiosType1StringProductName); >=20 > - ProductNameStrLen =3D AsciiStrLen (ProductNameStr); >=20 > - ASSERT (ProductNameStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - VersionStr =3D PcdGetPtr (PcdSmbiosType1StringVersion); >=20 > - VersionStrLen =3D AsciiStrLen (VersionStr); >=20 > - ASSERT (VersionStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - SerialNumberStr =3D PcdGetPtr (PcdSmbiosType1StringSerialNumber); >=20 > - SerialNumberStrLen =3D AsciiStrLen (SerialNumberStr); >=20 > - ASSERT (SerialNumberStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - SKUNumberStr =3D PcdGetPtr (PcdSmbiosType1StringSKUNumber); >=20 > - SKUNumberStrLen =3D AsciiStrLen (SKUNumberStr); >=20 > - ASSERT (SKUNumberStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - FamilyStr =3D PcdGetPtr (PcdSmbiosType1StringFamily); >=20 > - FamilyStrLen =3D AsciiStrLen (FamilyStr); >=20 > - ASSERT (FamilyStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - // >=20 > - // Create table size based on string lengths >=20 > - // >=20 > - TableSize =3D sizeof (SMBIOS_TABLE_TYPE1) + ManufacturerStrLen + 1 + P= roductNameStrLen + 1 + VersionStrLen + 1 + > SerialNumberStrLen + 1 + SKUNumberStrLen + 1 + FamilyStrLen + 1 + 1; >=20 > - SmbiosRecord =3D AllocateZeroPool (TableSize); >=20 > - if (SmbiosRecord =3D=3D NULL) { >=20 > - ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE1)); >=20 > - >=20 > - // >=20 > - // Fill in Type 1 fields >=20 > - // >=20 > - >=20 > - SmbiosRecord->Hdr.Type =3D SMBIOS_TYPE_SYSTEM_INFORMATION; >=20 > - SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE1); >=20 > - SmbiosRecord->Hdr.Handle =3D 0; >=20 > - >=20 > - // >=20 > - // Add strings to bottom of data block >=20 > - // >=20 > - StringOffset =3D SmbiosRecord->Hdr.Length; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, Manufa= cturerStrLen); >=20 > - StringOffset +=3D ManufacturerStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductNameStr, Product= NameStrLen); >=20 > - StringOffset +=3D ProductNameStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VersionStrL= en); >=20 > - StringOffset +=3D VersionStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, Serial= NumberStrLen); >=20 > - StringOffset +=3D SerialNumberStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumber= StrLen); >=20 > - StringOffset +=3D SKUNumberStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, FamilyStr, FamilyStrLen= ); >=20 > - >=20 > - // >=20 > - // Now we have got the full smbios record, call smbios protocol to add= this record. >=20 > - // >=20 > - Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_H= EADER *) SmbiosRecord); >=20 > - >=20 > - FreePool(SmbiosRecord); >=20 > - return Status; >=20 > -} >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type= 2BaseBoardManufacturerFunction.c > b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardM= anufacturerFunction.c > deleted file mode 100644 > index 9193cb0be7..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBo= ardManufacturerFunction.c > +++ /dev/null > @@ -1,131 +0,0 @@ > -/** @file >=20 > - Smbios type 2. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include "SmbiosBasic.h" >=20 > - >=20 > -/** >=20 > - This function makes boot time changes to the contents of the >=20 > - BaseBoardManufacturer (Type 2). >=20 > - >=20 > - @retval EFI_SUCCESS All parameters were valid. >=20 > - @retval EFI_UNSUPPORTED Unexpected RecordType value. >=20 > - @retval EFI_INVALID_PARAMETER Invalid parameter was found. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -BaseBoardManufacturerFunction( >=20 > - IN EFI_SMBIOS_PROTOCOL *Smbios >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - CHAR8 *ManufacturerStr; >=20 > - CHAR8 *ProductStr; >=20 > - CHAR8 *VersionStr; >=20 > - CHAR8 *SerialNumberStr; >=20 > - CHAR8 *AssertTagStr; >=20 > - CHAR8 *ChassisStr; >=20 > - UINTN ManuStrLen; >=20 > - UINTN ProductStrLen; >=20 > - UINTN VerStrLen; >=20 > - UINTN AssertTagStrLen; >=20 > - UINTN SerialNumStrLen; >=20 > - UINTN ChassisStrLen; >=20 > - EFI_SMBIOS_HANDLE SmbiosHandle; >=20 > - SMBIOS_TABLE_TYPE2 *PcdSmbiosRecord; >=20 > - SMBIOS_TABLE_TYPE2 *SmbiosRecord; >=20 > - UINTN SourceSize; >=20 > - UINTN TotalSize; >=20 > - UINTN StringOffset; >=20 > - >=20 > - PcdSmbiosRecord =3D PcdGetPtr (PcdSmbiosType2BaseBoardInformation); >=20 > - >=20 > - // >=20 > - // Get BoardManufacturer String. >=20 > - // >=20 > - ManufacturerStr =3D PcdGetPtr (PcdSmbiosType2StringManufacturer); >=20 > - ManuStrLen =3D AsciiStrLen (ManufacturerStr); >=20 > - ASSERT (ManuStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - // >=20 > - // Get Board ProductName String. >=20 > - // >=20 > - ProductStr =3D PcdGetPtr (PcdSmbiosType2StringProductName); >=20 > - ProductStrLen =3D AsciiStrLen (ProductStr); >=20 > - ASSERT (ProductStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - // >=20 > - // Get Board Version String. >=20 > - // >=20 > - VersionStr =3D PcdGetPtr (PcdSmbiosType2StringVersion); >=20 > - VerStrLen =3D AsciiStrLen (VersionStr); >=20 > - ASSERT (VerStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - // >=20 > - // Get Board Serial Number String. >=20 > - // >=20 > - SerialNumberStr =3D PcdGetPtr (PcdSmbiosType2StringSerialNumber); >=20 > - SerialNumStrLen =3D AsciiStrLen (SerialNumberStr); >=20 > - ASSERT (SerialNumStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - // >=20 > - // Get Board Asset Tag String. >=20 > - // >=20 > - AssertTagStr =3D PcdGetPtr (PcdSmbiosType2StringAssetTag); >=20 > - AssertTagStrLen =3D AsciiStrLen (AssertTagStr); >=20 > - ASSERT (AssertTagStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - // >=20 > - // Get Board Chassis Location Tag String. >=20 > - // >=20 > - ChassisStr =3D PcdGetPtr (PcdSmbiosType2StringLocationInChassis); >=20 > - ChassisStrLen =3D AsciiStrLen (ChassisStr); >=20 > - ASSERT (ChassisStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - // >=20 > - // Two zeros following the last string. >=20 > - // >=20 > - SourceSize =3D PcdGetSize (PcdSmbiosType2BaseBoardInformation); >=20 > - TotalSize =3D SourceSize + ManuStrLen + 1 + ProductStrLen + 1 + VerStr= Len + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 > + ChassisStrLen + 1 + 1; >=20 > - SmbiosRecord =3D AllocateZeroPool(TotalSize); >=20 > - if (SmbiosRecord =3D=3D NULL) { >=20 > - ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize); >=20 > - >=20 > - SmbiosRecord->Hdr.Type =3D SMBIOS_TYPE_BASEBOARD_INFORMATION; >=20 > - SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE2); >=20 > - if (PcdSmbiosRecord->NumberOfContainedObjectHandles >=3D 2) { >=20 > - SmbiosRecord->Hdr.Length +=3D (PcdSmbiosRecord->NumberOfContainedObj= ectHandles - 1) * sizeof(PcdSmbiosRecord- > >ContainedObjectHandles); >=20 > - } >=20 > - ASSERT(SourceSize >=3D SmbiosRecord->Hdr.Length); >=20 > - SmbiosRecord->Hdr.Handle =3D 0; >=20 > - >=20 > - StringOffset =3D SmbiosRecord->Hdr.Length; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuSt= rLen); >=20 > - StringOffset +=3D ManuStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductStr, ProductStrL= en); >=20 > - StringOffset +=3D ProductStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen); >=20 > - StringOffset +=3D VerStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, Serial= NumStrLen); >=20 > - StringOffset +=3D SerialNumStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTag= StrLen); >=20 > - StringOffset +=3D AssertTagStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ChassisStr, ChassisStrL= en); >=20 > - >=20 > - // >=20 > - // Now we have got the full smbios record, call smbios protocol to add= this record. >=20 > - // >=20 > - Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_H= EADER *) SmbiosRecord); >=20 > - >=20 > - FreePool(SmbiosRecord); >=20 > - return Status; >=20 > -} >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type= 32BootInformationFunction.c > b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInfor= mationFunction.c > deleted file mode 100644 > index 87bfd045da..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootI= nformationFunction.c > +++ /dev/null > @@ -1,56 +0,0 @@ > -/** @file >=20 > - Smbios type 32. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include "SmbiosBasic.h" >=20 > - >=20 > - >=20 > -/** >=20 > - This function makes boot time changes to the contents of the >=20 > - BootInformation (Type 32). >=20 > - >=20 > - @retval EFI_SUCCESS All parameters were valid. >=20 > - @retval EFI_UNSUPPORTED Unexpected RecordType value. >=20 > - @retval EFI_INVALID_PARAMETER Invalid parameter was found. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -BootInfoStatusFunction( >=20 > - IN EFI_SMBIOS_PROTOCOL *Smbios >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - EFI_SMBIOS_HANDLE SmbiosHandle; >=20 > - SMBIOS_TABLE_TYPE32 *PcdSmbiosRecord; >=20 > - SMBIOS_TABLE_TYPE32 *SmbiosRecord; >=20 > - >=20 > - PcdSmbiosRecord =3D PcdGetPtr (PcdSmbiosType32SystemBootInformation); >=20 > - >=20 > - // >=20 > - // Two zeros following the last string. >=20 > - // >=20 > - SmbiosRecord =3D AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1= ); >=20 > - if (SmbiosRecord =3D=3D NULL) { >=20 > - ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE32)); >=20 > - >=20 > - SmbiosRecord->Hdr.Type =3D EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION; >=20 > - SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE32); >=20 > - SmbiosRecord->Hdr.Handle =3D 0; >=20 > - >=20 > - // >=20 > - // Now we have got the full smbios record, call smbios protocol to add= this record. >=20 > - // >=20 > - Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_H= EADER *) SmbiosRecord); >=20 > - >=20 > - FreePool(SmbiosRecord); >=20 > - return Status; >=20 > -} >=20 > diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type= 3ChassisManufacturerFunction.c > b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisMan= ufacturerFunction.c > deleted file mode 100644 > index 33732bc9ca..0000000000 > --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3Chassi= sManufacturerFunction.c > +++ /dev/null > @@ -1,125 +0,0 @@ > -/** @file >=20 > - Smbios type 3. >=20 > - >=20 > -Copyright (c) 2018, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include "SmbiosBasic.h" >=20 > - >=20 > -/** >=20 > - This function makes boot time changes to the contents of the >=20 > - ChassisManufacturer (Type 3). >=20 > - >=20 > - @retval EFI_SUCCESS All parameters were valid. >=20 > - @retval EFI_UNSUPPORTED Unexpected RecordType value. >=20 > - @retval EFI_INVALID_PARAMETER Invalid parameter was found. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -ChassisManufacturerFunction( >=20 > - IN EFI_SMBIOS_PROTOCOL *Smbios >=20 > - ) >=20 > -{ >=20 > - UINTN ManuStrLen; >=20 > - UINTN VerStrLen; >=20 > - UINTN AssertTagStrLen; >=20 > - UINTN SerialNumStrLen; >=20 > - UINTN SKUNumberStrLen; >=20 > - EFI_STATUS Status; >=20 > - CHAR8 *ManufacturerStr; >=20 > - CHAR8 *VersionStr; >=20 > - CHAR8 *SerialNumberStr; >=20 > - CHAR8 *AssertTagStr; >=20 > - CHAR8 *SKUNumberStr; >=20 > - SMBIOS_TABLE_STRING *SKUNumberPtr; >=20 > - EFI_SMBIOS_HANDLE SmbiosHandle; >=20 > - SMBIOS_TABLE_TYPE3 *SmbiosRecord; >=20 > - SMBIOS_TABLE_TYPE3 *PcdSmbiosRecord; >=20 > - UINTN SourceSize; >=20 > - UINTN TotalSize; >=20 > - UINTN StringOffset; >=20 > - >=20 > - PcdSmbiosRecord =3D PcdGetPtr (PcdSmbiosType3SystemEnclosureChassis); >=20 > - >=20 > - // >=20 > - // Get ChassisManufacturer String. >=20 > - // >=20 > - ManufacturerStr =3D PcdGetPtr (PcdSmbiosType3StringManufacturer); >=20 > - ManuStrLen =3D AsciiStrLen (ManufacturerStr); >=20 > - ASSERT (ManuStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - // >=20 > - // Get ChassisVersion String. >=20 > - // >=20 > - VersionStr =3D PcdGetPtr (PcdSmbiosType3StringVersion); >=20 > - VerStrLen =3D AsciiStrLen (VersionStr); >=20 > - ASSERT (VerStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - // >=20 > - // Get ChassisSerialNumber String. >=20 > - // >=20 > - SerialNumberStr =3D PcdGetPtr (PcdSmbiosType3StringSerialNumber); >=20 > - SerialNumStrLen =3D AsciiStrLen (SerialNumberStr); >=20 > - ASSERT (SerialNumStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - // >=20 > - // Get ChassisAssetTag String. >=20 > - // >=20 > - AssertTagStr =3D PcdGetPtr (PcdSmbiosType3StringAssetTag); >=20 > - AssertTagStrLen =3D AsciiStrLen (AssertTagStr); >=20 > - ASSERT (AssertTagStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - // >=20 > - // Get ChassisSKUNumber String. >=20 > - // >=20 > - SKUNumberStr =3D PcdGetPtr (PcdSmbiosType3StringSKUNumber); >=20 > - SKUNumberStrLen =3D AsciiStrLen (SKUNumberStr); >=20 > - ASSERT (SKUNumberStrLen <=3D SMBIOS_STRING_MAX_LENGTH); >=20 > - >=20 > - // >=20 > - // Two zeros following the last string. >=20 > - // >=20 > - SourceSize =3D PcdGetSize(PcdSmbiosType3SystemEnclosureChassis); >=20 > - TotalSize =3D SourceSize + sizeof(SMBIOS_TABLE_STRING) + ManuStrLen + = 1 + VerStrLen + 1 + SerialNumStrLen + 1 + > AssertTagStrLen + 1 + SKUNumberStrLen + 1 + 1; >=20 > - SmbiosRecord =3D AllocateZeroPool(TotalSize); >=20 > - if (SmbiosRecord =3D=3D NULL) { >=20 > - ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize); >=20 > - >=20 > - SmbiosRecord->Hdr.Type =3D EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE; >=20 > - SmbiosRecord->Hdr.Length =3D OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedE= lements) + sizeof(SMBIOS_TABLE_STRING); >=20 > - if (PcdSmbiosRecord->ContainedElementCount >=3D 1) { >=20 > - SmbiosRecord->Hdr.Length +=3D PcdSmbiosRecord->ContainedElementCount= * PcdSmbiosRecord- > >ContainedElementRecordLength; >=20 > - } >=20 > - SmbiosRecord->Hdr.Handle =3D 0; >=20 > - >=20 > - if ((PcdSmbiosRecord->ContainedElementCount =3D=3D 0) || (SourceSize <= (UINTN)SmbiosRecord + SmbiosRecord- > >Hdr.Length)) { >=20 > - SKUNumberPtr =3D (SMBIOS_TABLE_STRING *)((UINTN)SmbiosRecord + Smbio= sRecord->Hdr.Length - > sizeof(SMBIOS_TABLE_STRING)); >=20 > - *SKUNumberPtr =3D 5; >=20 > - } >=20 > - >=20 > - StringOffset =3D SmbiosRecord->Hdr.Length; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuSt= rLen); >=20 > - StringOffset +=3D ManuStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen); >=20 > - StringOffset +=3D VerStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, Serial= NumStrLen); >=20 > - StringOffset +=3D SerialNumStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTag= StrLen); >=20 > - StringOffset +=3D AssertTagStrLen + 1; >=20 > - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumber= StrLen); >=20 > - >=20 > - // >=20 > - // Now we have got the full smbios record, call smbios protocol to add= this record. >=20 > - // >=20 > - Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_H= EADER *) SmbiosRecord); >=20 > - >=20 > - FreePool(SmbiosRecord); >=20 > - return Status; >=20 > -} >=20 > 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 >=20 > - Acpi Debug ASL code. >=20 > - >=20 > -Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -DefinitionBlock ( >=20 > - "AcpiDebug.aml", >=20 > - "SSDT", >=20 > - 2, >=20 > - "Intel ", >=20 > - "ADebTabl", >=20 > - 0x1000 >=20 > - ) >=20 > -{ >=20 > - Scope(\) >=20 > - { >=20 > - // >=20 > - // These pointers are patched during POST. >=20 > - // >=20 > - Name (DPTR, 0x80000000) // Address of Acpi debug memory buffer, fixe= d up during POST >=20 > - Name (EPTR, 0x80000000) // End of Acpi debug memory buffer, fixed up= during POST >=20 > - Name (CPTR, 0x80000000) // Current pointer used as an index into the= buffer(starts after the Acpi Debug head), fixed > up during POST >=20 > - >=20 > - // >=20 > - // Use a Mutex to prevent multiple calls from simutaneously writing = to the same memory. >=20 > - // >=20 > - Mutex (MMUT, 0) >=20 > - >=20 > - // >=20 > - // Operational region for SMI port access >=20 > - // >=20 > - OperationRegion (ADBP, SystemIO, 0xB2, 2) >=20 > - Field (ADBP, ByteAcc, NoLock, Preserve) >=20 > - { >=20 > - B2PT, 8, >=20 > - B3PT, 8, >=20 > - } >=20 > - >=20 > - // >=20 > - // Write a string to a memory buffer >=20 > - // >=20 > - Method (MDBG, 1, Serialized) >=20 > - { >=20 > - OperationRegion (ADHD, SystemMemory, DPTR, 32) // Operation region= for Acpi Debug buffer first 0x20 bytes >=20 > - Field (ADHD, ByteAcc, NoLock, Preserve) >=20 > - { >=20 > - Offset (0x0), >=20 > - ASIG, 128, // 16 bytes is Signature >=20 > - Offset (0x10), >=20 > - ASIZ, 32, // 4 bytes is buffer size >=20 > - ACHP, 32, // 4 bytes is current head pointer, normally is = DPTR + 0x20, >=20 > - // if there's SMM handler to print, then it's = the starting of the info hasn't been printed yet. >=20 > - ACTP, 32, // 4 bytes is current tail pointer, is the same = as CPTR >=20 > - SMIN, 8, // 1 byte of SMI Number for trigger callback >=20 > - WRAP, 8, // 1 byte of wrap status >=20 > - SMMV, 8, // 1 byte of SMM version status >=20 > - TRUN, 8 // 1 byte of truncate status >=20 > - } >=20 > - >=20 > - Store (Acquire (MMUT, 1000), Local0) // save Acquire result so we = can check for Mutex acquired >=20 > - If (LEqual (Local0, Zero)) // check for Mutex acquired >=20 > - { >=20 > - OperationRegion (ABLK, SystemMemory, CPTR, 32) // Operation regi= on to allow writes to ACPI debug buffer >=20 > - Field (ABLK, ByteAcc, NoLock, Preserve) >=20 > - { >=20 > - Offset (0x0), >=20 > - AAAA, 256 // 32 bytes is max size for string or data >=20 > - } >=20 > - ToHexString (Arg0, Local1) // convert argument to Hexadecimal St= ring >=20 > - Store (0, TRUN) >=20 > - If (LGreaterEqual (SizeOf (Local1), 32)) >=20 > - { >=20 > - Store (1, TRUN) // the input from ASL >=3D 32 >=20 > - } >=20 > - Mid (Local1, 0, 31, AAAA) // extract the input to current buffer >=20 > - >=20 > - Add (CPTR, 32, CPTR) // advance current pointer to next string l= ocation in memory buffer >=20 > - If (LGreaterEqual (CPTR, EPTR) ) // check for end of 64kb Acpi d= ebug buffer >=20 > - { >=20 > - Add (DPTR, 32, CPTR) // wrap around to beginning of buffer if = the end has been reached >=20 > - Store (1, WRAP) >=20 > - } >=20 > - Store (CPTR, ACTP) >=20 > - >=20 > - If (SMMV) >=20 > - { >=20 > - // >=20 > - // Trigger the SMI to print >=20 > - // >=20 > - Store (SMIN, B2PT) >=20 > - } >=20 > - Release (MMUT) >=20 > - } >=20 > - >=20 > - Return (Local0) // return error code indicating whether Mutex was = acquired >=20 > - } >=20 > - >=20 > - } // End Scope >=20 > -} // End SSDT >=20 > - >=20 > 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 >=20 > - Acpi Debug driver code. >=20 > - >=20 > -Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#define ACPI_DEBUG_STR "INTEL ACPI DEBUG" >=20 > - >=20 > -// >=20 > -// ASL NAME structure >=20 > -// >=20 > -#pragma pack(1) >=20 > -typedef struct { >=20 > - UINT8 NameOp; // Byte [0]=3D0x08:NameOp. >=20 > - UINT32 NameString; // Byte [4:1]=3DName of object. >=20 > - UINT8 DWordPrefix; // Byte [5]=3D0x0C:DWord Prefix. >=20 > - UINT32 Value; // 0 ; Value of named object. >=20 > -} NAME_LAYOUT; >=20 > -#pragma pack() >=20 > - >=20 > -#pragma pack(1) >=20 > -typedef struct { >=20 > - UINT8 Signature[16]; // "INTEL ACPI DEBUG" >=20 > - UINT32 BufferSize; // Total size of Acpi Debug buffer including= header structure >=20 > - UINT32 Head; // Current buffer pointer for SMM to print o= ut >=20 > - UINT32 Tail; // Current buffer pointer for ASL to input >=20 > - UINT8 SmiTrigger; // Value to trigger the SMI via B2 port >=20 > - UINT8 Wrap; // If current Tail < Head >=20 > - UINT8 SmmVersion; // If SMM version >=20 > - UINT8 Truncate; // If the input from ASL > MAX_BUFFER_SIZE >=20 > -} ACPI_DEBUG_HEAD; >=20 > -#pragma pack() >=20 > - >=20 > -#define AD_SIZE sizeof (ACPI_DEBUG_HEAD) // This is 0x20 >=20 > - >=20 > -#define MAX_BUFFER_SIZE 32 >=20 > - >=20 > -UINT32 mBufferEnd =3D 0; >=20 > -ACPI_DEBUG_HEAD *mAcpiDebug =3D NULL; >=20 > - >=20 > -EFI_SMM_SYSTEM_TABLE2 *mSmst =3D NULL; >=20 > - >=20 > -/** >=20 > - Patch and load ACPI table. >=20 > - >=20 > - @param[in] AcpiDebugAddress Address of Acpi debug memory buffer. >=20 > - @param[in] BufferIndex Index that starts after the Acpi Debug h= ead. >=20 > - @param[in] BufferEnd End of Acpi debug memory buffer. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -PatchAndLoadAcpiTable ( >=20 > - IN ACPI_DEBUG_HEAD *AcpiDebugAddress, >=20 > - IN UINT32 BufferIndex, >=20 > - IN UINT32 BufferEnd >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - EFI_ACPI_TABLE_PROTOCOL *AcpiTable; >=20 > - UINTN Size; >=20 > - EFI_ACPI_DESCRIPTION_HEADER *TableHeader; >=20 > - UINTN TableKey; >=20 > - UINT8 *CurrPtr; >=20 > - UINT32 *Signature; >=20 > - NAME_LAYOUT *NamePtr; >=20 > - UINT8 UpdateCounter; >=20 > - >=20 > - Status =3D GetSectionFromFv ( >=20 > - &gEfiCallerIdGuid, >=20 > - EFI_SECTION_RAW, >=20 > - 0, >=20 > - (VOID **) &TableHeader, >=20 > - &Size >=20 > - ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return; >=20 > - } >=20 > - >=20 > - // >=20 > - // This is Acpi Debug SSDT. Acpi Debug should be enabled if we reach h= ere so load the table. >=20 > - // >=20 > - ASSERT (((EFI_ACPI_DESCRIPTION_HEADER *) TableHeader)->OemTableId =3D= =3D SIGNATURE_64 ('A', 'D', 'e', 'b', 'T', 'a', 'b', 'l')); >=20 > - >=20 > - // >=20 > - // Patch some pointers for the ASL code before loading the SSDT. >=20 > - // >=20 > - >=20 > - // >=20 > - // Count pointer updates, so we can stop after all three pointers are = patched. >=20 > - // >=20 > - UpdateCounter =3D 1; >=20 > - for (CurrPtr =3D (UINT8 *) TableHeader; CurrPtr <=3D ((UINT8 *) TableH= eader + TableHeader->Length) && UpdateCounter < 4; > CurrPtr++) { >=20 > - Signature =3D (UINT32 *) (CurrPtr + 1); >=20 > - // >=20 > - // patch DPTR (address of Acpi debug memory buffer) >=20 > - // >=20 > - if ((*CurrPtr =3D=3D AML_NAME_OP) && *Signature =3D=3D SIGNATURE_32 = ('D', 'P', 'T', 'R')) { >=20 > - NamePtr =3D (NAME_LAYOUT *) CurrPtr; >=20 > - NamePtr->Value =3D (UINT32) (UINTN) AcpiDebugAddress; >=20 > - UpdateCounter++; >=20 > - } >=20 > - // >=20 > - // patch EPTR (end of Acpi debug memory buffer) >=20 > - // >=20 > - if ((*CurrPtr =3D=3D AML_NAME_OP) && *Signature =3D=3D SIGNATURE_32 = ('E', 'P', 'T', 'R')) { >=20 > - NamePtr =3D (NAME_LAYOUT *) CurrPtr; >=20 > - NamePtr->Value =3D BufferEnd; >=20 > - UpdateCounter++; >=20 > - } >=20 > - // >=20 > - // patch CPTR (used as an index that starts after the Acpi Debug hea= d) >=20 > - // >=20 > - if ((*CurrPtr =3D=3D AML_NAME_OP) && *Signature =3D=3D SIGNATURE_32 = ('C', 'P', 'T', 'R')) { >=20 > - NamePtr =3D (NAME_LAYOUT *) CurrPtr; >=20 > - NamePtr->Value =3D BufferIndex; >=20 > - UpdateCounter++; >=20 > - } >=20 > - } >=20 > - >=20 > - // >=20 > - // Add the table >=20 > - // >=20 > - Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOI= D **)&AcpiTable); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - if (EFI_ERROR (Status)) { >=20 > - goto Done; >=20 > - } >=20 > - >=20 > - TableKey =3D 0; >=20 > - Status =3D AcpiTable->InstallAcpiTable ( >=20 > - AcpiTable, >=20 > - TableHeader, >=20 > - Size, >=20 > - &TableKey >=20 > - ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - if (EFI_ERROR (Status)) { >=20 > - goto Done; >=20 > - } >=20 > - >=20 > -Done: >=20 > - gBS->FreePool (TableHeader); >=20 > - return ; >=20 > -} >=20 > - >=20 > -/** >=20 > - Allocate Acpi Debug memory. >=20 > - >=20 > - @param[out] BufferSize Pointer to Acpi debug memory buffer size. >=20 > - >=20 > - @return Address of Acpi debug memory buffer. 0 if PcdAcpiDebugEnable i= s FALSE. >=20 > - >=20 > -**/ >=20 > -EFI_PHYSICAL_ADDRESS >=20 > -AllocateAcpiDebugMemory ( >=20 > - OUT UINT32 *BufferSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - EFI_PHYSICAL_ADDRESS AcpiDebugAddress; >=20 > - UINTN PagesNum; >=20 > - >=20 > - AcpiDebugAddress =3D 0; >=20 > - *BufferSize =3D 0; >=20 > - >=20 > - if (PcdGetBool (PcdAcpiDebugEnable)) { >=20 > - // >=20 > - // Reserve memory to store Acpi Debug data. >=20 > - // >=20 > - AcpiDebugAddress =3D 0xFFFFFFFF; >=20 > - PagesNum =3D EFI_SIZE_TO_PAGES (PcdGet32 (PcdAcpiDebugBufferSize)); >=20 > - Status =3D gBS->AllocatePages ( >=20 > - AllocateMaxAddress, >=20 > - EfiReservedMemoryType, >=20 > - PagesNum, >=20 > - &AcpiDebugAddress >=20 > - ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return 0; >=20 > - } >=20 > - >=20 > - DEBUG ((DEBUG_INFO, "AcpiDebugAddress - 0x%08x\n", AcpiDebugAddress)= ); >=20 > - >=20 > - Status =3D PcdSet32S (PcdAcpiDebugAddress, (UINT32) AcpiDebugAddress= ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - if (EFI_ERROR (Status)) { >=20 > - gBS->FreePages (AcpiDebugAddress, PagesNum); >=20 > - return 0; >=20 > - } >=20 > - >=20 > - *BufferSize =3D PcdGet32 (PcdAcpiDebugBufferSize); >=20 > - } >=20 > - >=20 > - return AcpiDebugAddress; >=20 > -} >=20 > - >=20 > -/** >=20 > - Acpi Debug EndOfDxe notification. >=20 > - >=20 > - @param[in] Event Event whose notification function is being invok= ed. >=20 > - @param[in] Context Pointer to the notification function's context. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -EFIAPI >=20 > -AcpiDebugEndOfDxeNotification ( >=20 > - IN EFI_EVENT Event, >=20 > - IN VOID *Context >=20 > - ) >=20 > -{ >=20 > - UINT32 BufferSize; >=20 > - UINT32 BufferIndex; >=20 > - >=20 > - mAcpiDebug =3D (ACPI_DEBUG_HEAD *) (UINTN) AllocateAcpiDebugMemory (&B= ufferSize); >=20 > - if (mAcpiDebug !=3D NULL) { >=20 > - // >=20 > - // Init ACPI DEBUG buffer to lower case 'x'. >=20 > - // >=20 > - SetMem ((VOID *) mAcpiDebug, BufferSize, 0x78); >=20 > - >=20 > - // >=20 > - // Clear header of AD_SIZE bytes. >=20 > - // >=20 > - ZeroMem ((VOID *) mAcpiDebug, AD_SIZE); >=20 > - >=20 > - // >=20 > - // Write a signature to the first line of the buffer, "INTEL ACPI DE= BUG". >=20 > - // >=20 > - CopyMem ((VOID *) mAcpiDebug, ACPI_DEBUG_STR, sizeof (ACPI_DEBUG_STR= ) - 1); >=20 > - >=20 > - BufferIndex =3D (UINT32) (UINTN) mAcpiDebug; >=20 > - mBufferEnd =3D BufferIndex + BufferSize; >=20 > - >=20 > - // >=20 > - // Leave the Index after the Acpi Debug head. >=20 > - // >=20 > - BufferIndex +=3D AD_SIZE; >=20 > - >=20 > - // >=20 > - // Patch and Load the SSDT ACPI Tables. >=20 > - // >=20 > - PatchAndLoadAcpiTable (mAcpiDebug, BufferIndex, mBufferEnd); >=20 > - >=20 > - mAcpiDebug->Head =3D BufferIndex; >=20 > - mAcpiDebug->Tail =3D BufferIndex; >=20 > - mAcpiDebug->BufferSize =3D BufferSize; >=20 > - } >=20 > - >=20 > - // >=20 > - // Close event, so it will not be invoked again. >=20 > - // >=20 > - gBS->CloseEvent (Event); >=20 > - >=20 > - return ; >=20 > -} >=20 > - >=20 > -/** >=20 > - Initialize ACPI Debug. >=20 > - >=20 > - @param[in] ImageHandle The firmware allocated handle for the EFI im= age. >=20 > - @param[in] SystemTable A pointer to the EFI System Table. >=20 > - >=20 > - @retval EFI_SUCCESS The driver initializes correctly. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -InitializeAcpiDebugDxe ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - EFI_EVENT EndOfDxeEvent; >=20 > - >=20 > - // >=20 > - // Register EndOfDxe notification >=20 > - // that point could ensure the Acpi Debug related PCDs initialized. >=20 > - // >=20 > - Status =3D gBS->CreateEventEx ( >=20 > - EVT_NOTIFY_SIGNAL, >=20 > - TPL_CALLBACK, >=20 > - AcpiDebugEndOfDxeNotification, >=20 > - NULL, >=20 > - &gEfiEndOfDxeEventGroupGuid, >=20 > - &EndOfDxeEvent >=20 > - ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Software SMI callback for ACPI Debug which is called from ACPI method. >=20 > - >=20 > - @param[in] DispatchHandle The unique handle assigned to this h= andler by SmiHandlerRegister(). >=20 > - @param[in] Context Points to an optional handler contex= t which was specified when the >=20 > - handler was registered. >=20 > - @param[in, out] CommBuffer A pointer to a collection of data in= memory that will >=20 > - be conveyed from a non-SMM environme= nt into an SMM environment. >=20 > - @param[in, out] CommBufferSize The size of the CommBuffer. >=20 > - >=20 > - @retval EFI_SUCCESS The interrupt was handled successful= ly. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -AcpiDebugSmmCallback ( >=20 > - IN EFI_HANDLE DispatchHandle, >=20 > - IN CONST VOID *Context, >=20 > - IN OUT VOID *CommBuffer, >=20 > - IN OUT UINTN *CommBufferSize >=20 > - ) >=20 > -{ >=20 > - UINT8 Buffer[MAX_BUFFER_SIZE]; >=20 > - >=20 > - // >=20 > - // Validate the fields in mAcpiDebug to ensure there is no harm to SMI= handler. >=20 > - // mAcpiDebug is below 4GB and the start address of whole buffer. >=20 > - // >=20 > - if ((mAcpiDebug->BufferSize !=3D (mBufferEnd - (UINT32) (UINTN) mAcpiD= ebug)) || >=20 > - (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) || >=20 > - (mAcpiDebug->Head > mBufferEnd) || >=20 > - (mAcpiDebug->Tail < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) || >=20 > - (mAcpiDebug->Tail > mBufferEnd)) { >=20 > - // >=20 > - // If some fields in mAcpiDebug are invaid, return directly. >=20 > - // >=20 > - return EFI_SUCCESS; >=20 > - } >=20 > - >=20 > - if (!(BOOLEAN)mAcpiDebug->Wrap && ((mAcpiDebug->Head >=3D (UINT32) ((U= INTN) mAcpiDebug + AD_SIZE)) >=20 > - && (mAcpiDebug->Head < mAcpiDebug->Tail))){ >=20 > - // >=20 > - // If curent ----- buffer + 020 >=20 > - // ... >=20 > - // ... Head >=20 > - // ... Data for SMM print >=20 > - // ... Tail >=20 > - // ... Vacant for ASL input >=20 > - // ----- buffer end >=20 > - // >=20 > - // skip NULL block >=20 > - // >=20 > - while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head =3D=3D '\0') && (mAcpiDe= bug->Head < mAcpiDebug->Tail)) { >=20 > - mAcpiDebug->Head ++; >=20 > - } >=20 > - >=20 > - if (mAcpiDebug->Head < mAcpiDebug->Tail) { >=20 > - ZeroMem (Buffer, MAX_BUFFER_SIZE); >=20 > - AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *) (UINTN= ) mAcpiDebug->Head, MAX_BUFFER_SIZE - 1); >=20 > - >=20 > - DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcp= iDebug->Truncate ? "..." : "")); >=20 > - mAcpiDebug->Head +=3D MAX_BUFFER_SIZE; >=20 > - >=20 > - if (mAcpiDebug->Head >=3D (mAcpiDebug->Tail)) { >=20 > - // >=20 > - // When head =3D=3D tail, we do nothing in handler. >=20 > - // >=20 > - mAcpiDebug->Head =3D mAcpiDebug->Tail; >=20 > - } >=20 > - } >=20 > - } else if ((BOOLEAN) mAcpiDebug->Wrap && ((mAcpiDebug->Head > mAcpiDeb= ug->Tail) >=20 > - && (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->Bu= fferSize)))){ >=20 > - // >=20 > - // If curent ----- buffer + 020 >=20 > - // ... Tail >=20 > - // ... Vacant for ASL input >=20 > - // ... Head >=20 > - // ... Data for SMM print >=20 > - // ----- buffer end >=20 > - // >=20 > - while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head =3D=3D '\0') && (mAcpiDe= bug->Head < (UINT32) ((UINTN) mAcpiDebug + > mAcpiDebug->BufferSize))) { >=20 > - mAcpiDebug->Head ++; >=20 > - } >=20 > - if (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->Bu= fferSize)){ >=20 > - ZeroMem (Buffer, MAX_BUFFER_SIZE); >=20 > - AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *) (UINTN= ) mAcpiDebug->Head, MAX_BUFFER_SIZE - 1); >=20 > - DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcp= iDebug->Truncate ? "..." : "")); >=20 > - mAcpiDebug->Head +=3D MAX_BUFFER_SIZE; >=20 > - >=20 > - if (mAcpiDebug->Head >=3D (UINT32) ((UINTN) mAcpiDebug + mAcpiDebu= g->BufferSize)) { >=20 > - // >=20 > - // We met end of buffer. >=20 > - // >=20 > - mAcpiDebug->Wrap =3D 0; >=20 > - mAcpiDebug->Head =3D (UINT32) ((UINTN) mAcpiDebug + AD_SIZE); >=20 > - } >=20 > - } >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Acpi Debug SmmEndOfDxe notification. >=20 > - >=20 > - @param[in] Protocol Points to the protocol's unique identifier. >=20 > - @param[in] Interface Points to the interface instance. >=20 > - @param[in] Handle The handle on which the interface was installed. >=20 > - >=20 > - @retval EFI_SUCCESS Notification runs successfully. >=20 > - >=20 > - **/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -AcpiDebugSmmEndOfDxeNotification ( >=20 > - IN CONST EFI_GUID *Protocol, >=20 > - IN VOID *Interface, >=20 > - IN EFI_HANDLE Handle >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - EFI_SMM_SW_DISPATCH2_PROTOCOL *SwDispatch; >=20 > - EFI_SMM_SW_REGISTER_CONTEXT SwContext; >=20 > - EFI_HANDLE SwHandle; >=20 > - >=20 > - AcpiDebugEndOfDxeNotification (NULL, NULL); >=20 > - >=20 > - if (mAcpiDebug !=3D NULL) { >=20 > - // >=20 > - // Get the Sw dispatch protocol and register SMI callback function. >=20 > - // >=20 > - SwDispatch =3D NULL; >=20 > - Status =3D mSmst->SmmLocateProtocol (&gEfiSmmSwDispatch2ProtocolGuid= , NULL, (VOID **) &SwDispatch); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - >=20 > - SwContext.SwSmiInputValue =3D (UINTN) -1; >=20 > - Status =3D SwDispatch->Register (SwDispatch, AcpiDebugSmmCallback, &= SwContext, &SwHandle); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - >=20 > - mAcpiDebug->SmiTrigger =3D (UINT8) SwContext.SwSmiInputValue; >=20 > - mAcpiDebug->SmmVersion =3D 1; >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Initialize ACPI Debug. >=20 > - >=20 > - @param[in] ImageHandle The firmware allocated handle for the EFI im= age. >=20 > - @param[in] SystemTable A pointer to the EFI System Table. >=20 > - >=20 > - @retval EFI_SUCCESS The driver initializes correctly. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -InitializeAcpiDebugSmm ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - VOID *Registration; >=20 > - EFI_SMM_BASE2_PROTOCOL *SmmBase2; >=20 > - BOOLEAN InSmm; >=20 > - >=20 > - Status =3D gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID= **) &SmmBase2); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - >=20 > - Status =3D SmmBase2->InSmm (SmmBase2, &InSmm); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - >=20 > - ASSERT (InSmm); >=20 > - >=20 > - if (!InSmm) { >=20 > - return EFI_UNSUPPORTED; >=20 > - } >=20 > - >=20 > - Status =3D SmmBase2->GetSmstLocation (SmmBase2, &mSmst); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - >=20 > - // >=20 > - // Register SmmEndOfDxe notification >=20 > - // that point could ensure the Acpi Debug related PCDs initialized. >=20 > - // >=20 > - Registration =3D NULL; >=20 > - Status =3D mSmst->SmmRegisterProtocolNotify ( >=20 > - &gEfiSmmEndOfDxeProtocolGuid, >=20 > - AcpiDebugSmmEndOfDxeNotification, >=20 > - &Registration >=20 > - ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - return Status; >=20 > -} >=20 > 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 >=20 > -# Component description file for Acpi debug module. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D AcpiDebugDxe >=20 > - FILE_GUID =3D EC98FF95-242C-4513-B1BC-69FA24111C5= 8 >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - ENTRY_POINT =3D InitializeAcpiDebugDxe >=20 > -# >=20 > -# The following information is for reference only and not required by th= e build tools. >=20 > -# >=20 > -# VALID_ARCHITECTURES =3D IA32 X64 IPF >=20 > -# >=20 > - >=20 > -[LibraryClasses] >=20 > - BaseLib >=20 > - BaseMemoryLib >=20 > - UefiBootServicesTableLib >=20 > - UefiDriverEntryPoint >=20 > - DebugLib >=20 > - PcdLib >=20 > - DxeServicesLib >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - DebugFeaturePkg/DebugFeaturePkg.dec >=20 > - >=20 > -[Pcd] >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable ## CONSUMES >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize ## CONSUMES >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress ## PRODUCES >=20 > - >=20 > -[Sources] >=20 > - AcpiDebug.c >=20 > - AcpiDebug.asl >=20 > - >=20 > -[Protocols] >=20 > - gEfiAcpiTableProtocolGuid ## CONSUMES >=20 > - gEfiSmmBase2ProtocolGuid ## CONSUMES # only for SMM version >=20 > - gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES # only for SMM version >=20 > - gEfiSmmEndOfDxeProtocolGuid ## NOTIFY # only for SMM version >=20 > - >=20 > -[Guids] >=20 > - gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event >=20 > - >=20 > -[Depex] >=20 > - gEfiAcpiTableProtocolGuid >=20 > - >=20 > 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 >=20 > -# Component description file for Acpi Debug module. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -### >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D AcpiDebugSmm >=20 > - FILE_GUID =3D 9069C144-0A7E-41ef-9C07-418BCA9BF93= 9 >=20 > - MODULE_TYPE =3D DXE_SMM_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - PI_SPECIFICATION_VERSION =3D 0x0001000A >=20 > - ENTRY_POINT =3D InitializeAcpiDebugSmm >=20 > -# >=20 > -# The following information is for reference only and not required by th= e build tools. >=20 > -# >=20 > -# VALID_ARCHITECTURES =3D IA32 X64 IPF >=20 > -# >=20 > - >=20 > -[LibraryClasses] >=20 > - BaseLib >=20 > - BaseMemoryLib >=20 > - UefiBootServicesTableLib >=20 > - UefiDriverEntryPoint >=20 > - DebugLib >=20 > - PcdLib >=20 > - DxeServicesLib >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - DebugFeaturePkg/DebugFeaturePkg.dec >=20 > - >=20 > -[Pcd] >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable ## CONSUMES >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize ## CONSUMES >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress ## PRODUCES >=20 > - >=20 > -[Sources] >=20 > - AcpiDebug.c >=20 > - AcpiDebug.asl >=20 > - >=20 > -[Protocols] >=20 > - gEfiAcpiTableProtocolGuid ## CONSUMES >=20 > - gEfiSmmBase2ProtocolGuid ## CONSUMES >=20 > - gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES >=20 > - gEfiSmmEndOfDxeProtocolGuid ## NOTIFY >=20 > - >=20 > -[Guids] >=20 > - gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event # only for DXE = version >=20 > - >=20 > -[Depex] >=20 > - gEfiAcpiTableProtocolGuid AND >=20 > - gEfiSmmBase2ProtocolGuid AND >=20 > - gEfiSmmSwDispatch2ProtocolGuid >=20 > 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 >=20 > - >=20 > -How it works: >=20 > - Acpi Debug does this: >=20 > - Opens a 64kb memory buffer during POST. >=20 > - Patches the buffer address in SSDT ASL code. >=20 > - Save the address in gAdvancedFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddr= ess for user reference. >=20 > - Write strings or numbers to the buffer from ASL code with the ADBG met= hod. >=20 > - >=20 > -How to use it: >=20 > - 1. Enable it by set gAdvancedFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnab= le to TRUE. >=20 > - 2. The ACPI ASL code must be instrumented with the debug method. >=20 > - Strings up to 32 characters (shorter strings will be padded with Ze= ro's, longer strings will be truncated) >=20 > - Examples: >=20 > - ADBG("This is a test.") >=20 > - ADBG(Arg0) >=20 > - >=20 > - DXE version: The bios engineer will read the strings from the buffer o= n the target machine with read/write memory > utility. >=20 > - SMM version: Check debug serial that would show debug strings. >=20 > - >=20 > - Sample code for ADBG: >=20 > - External (MDBG, MethodObj) >=20 > - Method (ADBG, 1, Serialized) >=20 > - { >=20 > - If (CondRefOf (MDBG)) // Check if ACPI Debug SSDT is loaded >=20 > - { >=20 > - Return (MDBG (Arg0)) >=20 > - } >=20 > - Return (0) >=20 > - } >=20 > - >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec b/Platfor= m/Intel/DebugFeaturePkg/DebugFeaturePkg.dec > deleted file mode 100644 > index 37ebe6da4d..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec > +++ /dev/null > @@ -1,66 +0,0 @@ > -## @file >=20 > -# This package provides the modules that build for debug feature. >=20 > -# This DebugFeaturePkg should only depend on EDKII Core packages and Min= PlatformPkg. >=20 > -# >=20 > -# The DEC files are used by the utilities that parse DSC and >=20 > -# INF files to generate AutoGen.c and AutoGen.h files >=20 > -# for the build infrastructure. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - DEC_SPECIFICATION =3D 0x00010005 >=20 > - PACKAGE_NAME =3D DebugFeaturePkg >=20 > - PACKAGE_GUID =3D 58B6F2BB-A94F-4EB9-89DA-2F06ED59CE3= 9 >=20 > - PACKAGE_VERSION =3D 0.1 >=20 > - >=20 > -[Includes] >=20 > - Include >=20 > - >=20 > -[LibraryClasses] >=20 > - ## @libraryclass Provide capability to get/set USB3 debug port par= ameter. >=20 > - Usb3DebugPortParameterLib|Include/Library/Usb3DebugPortParameterLib.h >=20 > - >=20 > - ## @libraryclass Provide common USB3 debug port functions. >=20 > - Usb3DebugPortLib|Include/Library/Usb3DebugPortLib.h >=20 > - >=20 > -[Guids] >=20 > - gDebugFeaturePkgTokenSpaceGuid =3D { 0xdbf3ac70, 0x3f73, 0x40aa, = { 0xbd, 0xd6, 0xac, 0xf2, 0x1a, 0x1b, 0x2f, 0xe2 } } >=20 > - >=20 > -[PcdsFixedAtBuild] >=20 > - ## These PCD specify XHCI controller Bus/Device/Function, which are us= ed to enable >=20 > - # XHCI debug device. >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciBus|0x00|UINT8|0x000000= 01 >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciDev|0x14|UINT8|0x000000= 02 >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciFunc|0x00|UINT8|0x00000= 003 >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress|0xFEA10000|UI= NT32|0x00000004 >=20 > - >=20 > - ## This PCD specifies the wait timeout value in microsecond if USB deb= ug cable is detected but host not connected. >=20 > - # Default timeout value is 2000000 microseconds. >=20 > - # If user does not want system stall for long time, it can be set to = small value. >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout|2000000|UINT64|0= x00000005 >=20 > - >=20 > - ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes = space. >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortBusIndex|0x59|UINT8|0x0= 0000006 >=20 > - ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes = space. >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortDeviceIndex|0x5A|UINT8|= 0x00000007 >=20 > - ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes = space. >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortFunctionIndex|0x5B|UINT= 8|0x00000008 >=20 > - >=20 > -[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx] >=20 > - ## This PCD specifies AcpiDebug feature is enable/disable. >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable|FALSE|BOOLEAN|0x0000= 0009 >=20 > - ## This PCD specifies AcpiDebug buffer size. >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize|0x10000|UINT32|0= x0000000A >=20 > - >=20 > -[PcdsDynamic, PcdsDynamicEx] >=20 > - ## This PCD specifies AcpiDebug buffer address >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress|0|UINT32|0x0000000B >=20 > - >=20 > -[PcdsFeatureFlag] >=20 > - ## This PCD specifies whether StatusCode is reported via USB3 Serial p= ort. >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseUsb3Serial|TRUE|BOOLEAN= |0x0000000C >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc b/Platfor= m/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc > deleted file mode 100644 > index efe705bd76..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc > +++ /dev/null > @@ -1,120 +0,0 @@ > -## @file >=20 > -# This package provides the modules that build for debug feature. >=20 > -# This package should only depend on EDKII Core packages and MinPlatform= Pkg. >=20 > -# >=20 > -# The DEC files are used by the utilities that parse DSC and >=20 > -# INF files to generate AutoGen.c and AutoGen.h files >=20 > -# for the build infrastructure. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - PLATFORM_NAME =3D DebugFeaturePkg >=20 > - PLATFORM_GUID =3D 3A0DBEF4-3C16-4F6B-8B55-BABB260D30B= 9 >=20 > - PLATFORM_VERSION =3D 0.1 >=20 > - DSC_SPECIFICATION =3D 0x00010005 >=20 > - OUTPUT_DIRECTORY =3D Build/DebugFeaturePkg >=20 > - SUPPORTED_ARCHITECTURES =3D IA32|X64 >=20 > - BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT >=20 > - SKUID_IDENTIFIER =3D DEFAULT >=20 > - >=20 > -[LibraryClasses] >=20 > - ####################################### >=20 > - # Edk2 Packages >=20 > - ####################################### >=20 > - BaseLib|MdePkg/Library/BaseLib/BaseLib.inf >=20 > - BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf >=20 > - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf >=20 > - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf >=20 > - DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf >=20 > - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf >=20 > - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf >=20 > - PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf >=20 > - PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf >=20 > - TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTempl= ate.inf >=20 > - UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiB= ootServicesTableLib.inf >=20 > - UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEnt= ryPoint.inf >=20 > - UefiLib|MdePkg/Library/UefiLib/UefiLib.inf >=20 > - UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib= /UefiRuntimeServicesTableLib.inf >=20 > - >=20 > -[LibraryClasses.common.PEIM] >=20 > - ####################################### >=20 > - # Edk2 Packages >=20 > - ####################################### >=20 > - HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf >=20 > - MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAll= ocationLib.inf >=20 > - PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibId= t/PeiServicesTablePointerLibIdt.inf >=20 > - >=20 > -[LibraryClasses.common.DXE_DRIVER] >=20 > - ####################################### >=20 > - # Edk2 Packages >=20 > - ####################################### >=20 > - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 > - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryA= llocationLib.inf >=20 > - >=20 > -[LibraryClasses.common.UEFI_DRIVER] >=20 > - ####################################### >=20 > - # Edk2 Packages >=20 > - ####################################### >=20 > - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 > - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryA= llocationLib.inf >=20 > - >=20 > -[LibraryClasses.common.DXE_RUNTIME_DRIVER] >=20 > - ####################################### >=20 > - # Edk2 Packages >=20 > - ####################################### >=20 > - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 > - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryA= llocationLib.inf >=20 > - UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf >=20 > - >=20 > -[LibraryClasses.common.DXE_SMM_DRIVER] >=20 > - ####################################### >=20 > - # Edk2 Packages >=20 > - ####################################### >=20 > - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 > - MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAll= ocationLib.inf >=20 > - SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTabl= eLib.inf >=20 > - >=20 > -########################################################################= ########################### >=20 > -# >=20 > -# Components Section - list of the modules and components that will be p= rocessed by compilation >=20 > -# tools and the EDK II tools to generate PE32/PE32+= /Coff image files. >=20 > -# >=20 > -# Note: The EDK II DSC file is not used to specify how compiled binary i= mages get placed >=20 > -# into firmware volume images. This section is just a list of modu= les to compile from >=20 > -# source into UEFI-compliant binaries. >=20 > -# It is the FDF file that contains information on combining binary= files into firmware >=20 > -# volume images, whose concept is beyond UEFI and is described in = PI specification. >=20 > -# Binary modules do not need to be listed in this section, as they= should be >=20 > -# specified in the FDF file. For example: Shell binary (Shell_Full= .efi), FAT binary (Fat.efi), >=20 > -# Logo (Logo.bmp), and etc. >=20 > -# There may also be modules listed in this section that are not re= quired in the FDF file, >=20 > -# When a module listed here is excluded from FDF file, then UEFI-c= ompliant binary will be >=20 > -# generated for it, but the binary will not be put into any firmwa= re volume. >=20 > -# >=20 > -########################################################################= ########################### >=20 > - >=20 > -[Components] >=20 > - ####################################### >=20 > - # Debug Feature Package >=20 > - ####################################### >=20 > - >=20 > - # Add library instances here that are not included in package componen= ts and should be tested >=20 > - # in the package build. >=20 > - DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf >=20 > - DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf >=20 > - DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf >=20 > - DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf >=20 > - DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf >=20 > - DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortPara= meterLibPcd.inf >=20 > - >=20 > - # Add components here that should be included in the package build. >=20 > - DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf >=20 > - DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf >=20 > - >=20 > -[BuildOptions] >=20 > - *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPort= Lib.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 >=20 > - This library class provides common USB3 debug port functions. >=20 > - >=20 > - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef __USB3_DEBUG_PORT_LIB__ >=20 > -#define __USB3_DEBUG_PORT_LIB__ >=20 > - >=20 > -/** >=20 > - Initialize the USB3 debug port hardware. >=20 > - >=20 > - If no initialization is required, then return RETURN_SUCCESS. >=20 > - If the serial device was successfully initialized, then return RETURN_= SUCCESS. >=20 > - If the serial device could not be initialized, then return RETURN_DEVI= CE_ERROR. >=20 > - >=20 > - @retval RETURN_SUCCESS The serial device was initialized. >=20 > - @retval RETURN_DEVICE_ERROR The serial device could not be initializ= ed. >=20 > - >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -EFIAPI >=20 > -Usb3DebugPortInitialize ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -/** >=20 > - Write data from buffer to USB3 debug port. >=20 > - >=20 > - Writes NumberOfBytes data bytes from Buffer to the serial device. >=20 > - The number of bytes actually written to the serial device is returned. >=20 > - If the return value is less than NumberOfBytes, then the write operati= on failed. >=20 > - If Buffer is NULL, then ASSERT(). >=20 > - If NumberOfBytes is zero, then return 0. >=20 > - >=20 > - @param Buffer Pointer to the data buffer to be written. >=20 > - @param NumberOfBytes Number of bytes to written to the serial devi= ce. >=20 > - >=20 > - @retval 0 NumberOfBytes is 0. >=20 > - @retval >0 The number of bytes written to the serial dev= ice. >=20 > - If this value is less than NumberOfBytes, the= n the read operation failed. >=20 > - >=20 > -**/ >=20 > -UINTN >=20 > -EFIAPI >=20 > -Usb3DebugPortWrite ( >=20 > - IN UINT8 *Buffer, >=20 > - IN UINTN NumberOfBytes >=20 > - ); >=20 > - >=20 > - >=20 > -/** >=20 > - Polls a USB3 debug port to see if there is any data waiting to be read= . >=20 > - >=20 > - Polls a serial device to see if there is any data waiting to be read. >=20 > - If there is data waiting to be read from the serial device, then TRUE = is returned. >=20 > - If there is no data waiting to be read from the serial device, then FA= LSE is returned. >=20 > - >=20 > - @retval TRUE Data is waiting to be read from the serial de= vice. >=20 > - @retval FALSE There is no data waiting to be read from the = serial device. >=20 > - >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -Usb3DebugPortPoll ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -#endif >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPort= ParameterLib.h > b/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameterLi= b.h > deleted file mode 100644 > index 167c607e9f..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParamet= erLib.h > +++ /dev/null > @@ -1,56 +0,0 @@ > -/** @file >=20 > - This library class provides capability to get/set usb3 debug port para= meter. >=20 > - >=20 > - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef __USB3_DEBUG_PORT_PARAMETER_LIB__ >=20 > -#define __USB3_DEBUG_PORT_PARAMETER_LIB__ >=20 > - >=20 > -typedef struct { >=20 > - UINT8 Function; >=20 > - UINT8 Device; >=20 > - UINT8 Bus; >=20 > -} PCI_ADDRESS; >=20 > - >=20 > -typedef union { >=20 > - UINT32 Controller; >=20 > - PCI_ADDRESS PciAddress; >=20 > -} USB3_DEBUG_PORT_CONTROLLER; >=20 > - >=20 > -/** >=20 > - Returns the USB debug port controller. >=20 > - bit: 0~ 7: Function >=20 > - bit: 8~15: Device >=20 > - bit: 16~24: Bus >=20 > - >=20 > - @return Controller information of USB debug port. >=20 > - >=20 > -**/ >=20 > -UINT32 >=20 > -EFIAPI >=20 > -GetUsb3DebugPortController ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -/** >=20 > - Sets the USB debug port controller. >=20 > - bit: 0~ 7: Function >=20 > - bit: 8~15: Device >=20 > - bit: 16~24: Bus >=20 > - >=20 > - @param[in] Controller information of USB debug port value to be set= . >=20 > - >=20 > - @retval TRUE The controller of USB debug port was sucessful= ly set. >=20 > - @retval FALSE The controller of USB debug port could not be = set. >=20 > - >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -SetUsb3DebugPortController ( >=20 > - UINT32 Controller >=20 > - ); >=20 > - >=20 > -#endif >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Misc= Services.c > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c > deleted file mode 100644 > index cb29a880e6..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/MiscService= s.c > +++ /dev/null > @@ -1,385 +0,0 @@ > -/** @file >=20 > - Miscellaneous services internal to USB debug port implementation. >=20 > - >=20 > - Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include "Usb3DebugPortLibInternal.h" >=20 > - >=20 > -/** >=20 > - Verifies if the bit positions specified by a mask are set in a registe= r. >=20 > - >=20 > - @param[in, out] Register UNITN register >=20 > - @param[in] BitMask 32-bit mask >=20 > - >=20 > - @return BOOLEAN - TRUE if all bits specified by the mask are enable= d. >=20 > - - FALSE even if one of the bits specified by the mas= k >=20 > - is not enabled. >=20 > -**/ >=20 > -BOOLEAN >=20 > -XhcIsBitSet( >=20 > - IN OUT UINTN Register, >=20 > - IN UINT32 BitMask >=20 > - ) >=20 > -{ >=20 > - if ((MmioRead32 (Register) & (BitMask)) !=3D 0) { >=20 > - return TRUE; >=20 > - } >=20 > - return FALSE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Sets bits as per the enabled bit positions in the mask. >=20 > - >=20 > - @param[in, out] Register UINTN register >=20 > - @param[in] BitMask 32-bit mask >=20 > -**/ >=20 > -VOID >=20 > -XhcSetR32Bit( >=20 > - IN OUT UINTN Register, >=20 > - IN UINT32 BitMask >=20 > - ) >=20 > -{ >=20 > - UINT32 RegisterValue; >=20 > - >=20 > - RegisterValue =3D MmioRead32 (Register); >=20 > - RegisterValue |=3D (UINT32)(BitMask); >=20 > - MmioWrite32 (Register, RegisterValue); >=20 > -} >=20 > - >=20 > -/** >=20 > - Clears bits as per the enabled bit positions in the mask. >=20 > - >=20 > - @param[in, out] Register UINTN register >=20 > - @param[in] BitMask 32-bit mask >=20 > -**/ >=20 > -VOID >=20 > -XhcClrR32Bit( >=20 > - IN OUT UINTN Register, >=20 > - IN UINT32 BitMask >=20 > - ) >=20 > -{ >=20 > - UINT32 RegisterValue; >=20 > - >=20 > - RegisterValue =3D MmioRead32 (Register); >=20 > - RegisterValue &=3D (UINT32)(~(BitMask)); >=20 > - MmioWrite32 (Register, RegisterValue); >=20 > -} >=20 > - >=20 > -/** >=20 > - Initialize the USB debug port hardware. >=20 > - >=20 > - If no initialization is required, then return RETURN_SUCCESS. >=20 > - If the serial device was successfully initialized, then return RETURN_= SUCCESS. >=20 > - If the serial device could not be initialized, then return RETURN_DEVI= CE_ERROR. >=20 > - >=20 > - @retval RETURN_SUCCESS The serial device was initialized. >=20 > - @retval RETURN_DEVICE_ERROR The serial device could not be initializ= ed. >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -EFIAPI >=20 > -Usb3DebugPortInitialize ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - USB3Initialize (); >=20 > - return RETURN_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Write data from buffer to USB debug port. >=20 > - >=20 > - Writes NumberOfBytes data bytes from Buffer to the serial device. >=20 > - The number of bytes actually written to the serial device is returned. >=20 > - If the return value is less than NumberOfBytes, then the write operati= on failed. >=20 > - If Buffer is NULL, then ASSERT(). >=20 > - If NumberOfBytes is zero, then return 0. >=20 > - >=20 > - @param Buffer Pointer to the data buffer to be written. >=20 > - @param NumberOfBytes Number of bytes to written to the serial devi= ce. >=20 > - >=20 > - @retval 0 NumberOfBytes is 0. >=20 > - @retval >0 The number of bytes written to the serial dev= ice. >=20 > - If this value is less than NumberOfBytes, the= n the read operation failed. >=20 > -**/ >=20 > -UINTN >=20 > -EFIAPI >=20 > -Usb3DebugPortWrite ( >=20 > - IN UINT8 *Buffer, >=20 > - IN UINTN NumberOfBytes >=20 > - ) >=20 > -{ >=20 > - Usb3DbgOut (Buffer, &NumberOfBytes); >=20 > - return NumberOfBytes; >=20 > -} >=20 > - >=20 > -/** >=20 > - Read data from USB debug port and save the datas in buffer. >=20 > - >=20 > - Reads NumberOfBytes data bytes from a serial device into the buffer >=20 > - specified by Buffer. The number of bytes actually read is returned. >=20 > - If the return value is less than NumberOfBytes, then the rest operatio= n failed. >=20 > - If Buffer is NULL, then ASSERT(). >=20 > - If NumberOfBytes is zero, then return 0. >=20 > - >=20 > - @param Buffer Pointer to the data buffer to store the data = read from the serial device. >=20 > - @param NumberOfBytes Number of bytes which will be read. >=20 > - >=20 > - @retval 0 Read data failed, no data is to be read. >=20 > - @retval >0 Actual number of bytes read from serial devic= e. >=20 > -**/ >=20 > -UINTN >=20 > -EFIAPI >=20 > -Usb3DebugPortRead ( >=20 > - OUT UINT8 *Buffer, >=20 > - IN UINTN NumberOfBytes >=20 > - ) >=20 > -{ >=20 > - Usb3DbgIn (Buffer, &NumberOfBytes); >=20 > - return NumberOfBytes; >=20 > -} >=20 > - >=20 > -/** >=20 > - Polls a USB debug port to see if there is any data waiting to be read. >=20 > - >=20 > - Polls a serial device to see if there is any data waiting to be read. >=20 > - If there is data waiting to be read from the serial device, then TRUE = is returned. >=20 > - If there is no data waiting to be read from the serial device, then FA= LSE is returned. >=20 > - >=20 > - @retval TRUE Data is waiting to be read from the serial de= vice. >=20 > - @retval FALSE There is no data waiting to be read from the = serial device. >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -Usb3DebugPortPoll ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - return FALSE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Write the data to the XHCI debug register. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the runtime register. >=20 > - @param Data The data to write. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -XhcWriteDebugReg ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Data >=20 > - ) >=20 > -{ >=20 > - EFI_PHYSICAL_ADDRESS DebugCapabilityBase; >=20 > - >=20 > - DebugCapabilityBase =3D Xhc->DebugCapabilityBase; >=20 > - >=20 > - MmioWrite32 ((UINTN)(DebugCapabilityBase + Offset), Data); >=20 > - >=20 > - return; >=20 > -} >=20 > - >=20 > -/** >=20 > - Read XHCI debug register. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the debug register. >=20 > - >=20 > - @return The register content read >=20 > - >=20 > -**/ >=20 > -UINT32 >=20 > -XhcReadDebugReg ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset >=20 > - ) >=20 > -{ >=20 > - UINT32 Data; >=20 > - EFI_PHYSICAL_ADDRESS DebugCapabilityBase; >=20 > - >=20 > - DebugCapabilityBase =3D Xhc->DebugCapabilityBase; >=20 > - >=20 > - Data =3D MmioRead32 ((UINTN)(DebugCapabilityBase + Offset)); >=20 > - >=20 > - return Data; >=20 > -} >=20 > - >=20 > -/** >=20 > - Set one bit of the debug register while keeping other bits. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the debug register. >=20 > - @param Bit The bit mask of the register to set. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -XhcSetDebugRegBit ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Bit >=20 > - ) >=20 > -{ >=20 > - UINT32 Data; >=20 > - >=20 > - Data =3D XhcReadDebugReg (Xhc, Offset); >=20 > - Data |=3D Bit; >=20 > - XhcWriteDebugReg (Xhc, Offset, Data); >=20 > -} >=20 > - >=20 > -/** >=20 > - Clear one bit of the debug register while keeping other bits. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the debug register. >=20 > - @param Bit The bit mask of the register to set. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -XhcClearDebugRegBit ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Bit >=20 > - ) >=20 > -{ >=20 > - UINT32 Data; >=20 > - >=20 > - Data =3D XhcReadDebugReg (Xhc, Offset); >=20 > - Data &=3D ~Bit; >=20 > - XhcWriteDebugReg (Xhc, Offset, Data); >=20 > -} >=20 > - >=20 > -/** >=20 > - Write the data to the XHCI MMIO register. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the runtime register. >=20 > - @param Data The data to write. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -XhcWriteMmioReg ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Data >=20 > - ) >=20 > -{ >=20 > - EFI_PHYSICAL_ADDRESS MmioBase; >=20 > - >=20 > - MmioBase =3D Xhc->XhcMmioBase; >=20 > - MmioWrite32 ((UINTN)(MmioBase + Offset), Data); >=20 > - >=20 > - return; >=20 > -} >=20 > - >=20 > -/** >=20 > - Read XHCI MMIO register. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the runtime register. >=20 > - >=20 > - @return The register content read >=20 > - >=20 > -**/ >=20 > -UINT32 >=20 > -XhcReadMmioReg ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset >=20 > - ) >=20 > -{ >=20 > - UINT32 Data; >=20 > - EFI_PHYSICAL_ADDRESS MmioBase; >=20 > - >=20 > - MmioBase =3D Xhc->XhcMmioBase; >=20 > - >=20 > - Data =3D MmioRead32 ((UINTN)(MmioBase + Offset)); >=20 > - >=20 > - return Data; >=20 > -} >=20 > - >=20 > -/** >=20 > - Set one bit of the operational register while keeping other bits. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the runtime register. >=20 > - @param Bit The bit mask of the register to set. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -XhcSetMmioRegBit ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Bit >=20 > - ) >=20 > -{ >=20 > - UINT32 Data; >=20 > - >=20 > - Data =3D XhcReadMmioReg (Xhc, Offset); >=20 > - Data |=3D Bit; >=20 > - XhcWriteMmioReg (Xhc, Offset, Data); >=20 > -} >=20 > - >=20 > -/** >=20 > - Clear one bit of the operational register while keeping other bits. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the runtime register. >=20 > - @param Bit The bit mask of the register to set. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -XhcClearMmioRegBit ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Bit >=20 > - ) >=20 > -{ >=20 > - UINT32 Data; >=20 > - >=20 > - Data =3D XhcReadMmioReg (Xhc, Offset); >=20 > - Data &=3D ~Bit; >=20 > - XhcWriteMmioReg (Xhc, Offset, Data); >=20 > -} >=20 > - >=20 > -/** >=20 > - Wait the operation register's bit as specified by Bit >=20 > - to be set (or clear). >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the operational register. >=20 > - @param Bit The bit of the register to wait for. >=20 > - @param WaitToSet Wait the bit to set or clear. >=20 > - @param Timeout The time to wait before abort (in millisecond, ms= ). >=20 > - >=20 > - @retval EFI_SUCCESS The bit successfully changed by host controller. >=20 > - @retval EFI_TIMEOUT The time out occurred. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -XhcWaitMmioRegBit ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Bit, >=20 > - IN BOOLEAN WaitToSet, >=20 > - IN UINT32 Timeout >=20 > - ) >=20 > -{ >=20 > - UINT32 Index; >=20 > - UINTN Loop; >=20 > - >=20 > - Loop =3D (Timeout * XHC_1_MILLISECOND / XHC_POLL_DELAY) + 1; >=20 > - >=20 > - for (Index =3D 0; Index < Loop; Index++) { >=20 > - if (XHC_REG_BIT_IS_SET (Xhc, Offset, Bit) =3D=3D WaitToSet) { >=20 > - return EFI_SUCCESS; >=20 > - } >=20 > - >=20 > - MicroSecondDelay (XHC_POLL_DELAY); >=20 > - } >=20 > - >=20 > - return EFI_TIMEOUT; >=20 > -} >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3= DebugPortDataTransfer.c > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortDa= taTransfer.c > deleted file mode 100644 > index 53478a49b8..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPo= rtDataTransfer.c > +++ /dev/null > @@ -1,892 +0,0 @@ > -/** @file >=20 > - Usb3 Debug Port library instance >=20 > - >=20 > - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include "Usb3DebugPortLibInternal.h" >=20 > - >=20 > -EFI_SMRAM_DESCRIPTOR mSmramCheckRanges[MAX_SMRAM_RANGE]; >=20 > -UINTN mSmramCheckRangeCount =3D 0; >=20 > -BOOLEAN mUsb3InSmm =3D FALSE; >=20 > -UINT64 mUsb3MmioSize =3D 0; >=20 > - >=20 > -/** >=20 > - Synchronize the specified transfer ring to update the enqueue and dequ= eue pointer. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param TrsRing The transfer ring to sync. >=20 > - >=20 > - @retval EFI_SUCCESS The transfer ring is synchronized successfully. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -XhcSyncTrsRing ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN TRANSFER_RING *TrsRing >=20 > - ) >=20 > -{ >=20 > - UINTN Index; >=20 > - TRB_TEMPLATE *TrsTrb; >=20 > - >=20 > - ASSERT (TrsRing !=3D NULL); >=20 > - >=20 > - // >=20 > - // Calculate the latest RingEnqueue and RingPCS >=20 > - // >=20 > - TrsTrb =3D (TRB_TEMPLATE *)(UINTN) TrsRing->RingEnqueue; >=20 > - >=20 > - ASSERT (TrsTrb !=3D NULL); >=20 > - >=20 > - for (Index =3D 0; Index < TrsRing->TrbNumber; Index++) { >=20 > - if (TrsTrb->CycleBit !=3D (TrsRing->RingPCS & BIT0)) { >=20 > - break; >=20 > - } >=20 > - TrsTrb++; >=20 > - if ((UINT8) TrsTrb->Type =3D=3D TRB_TYPE_LINK) { >=20 > - ASSERT (((LINK_TRB*)TrsTrb)->TC !=3D 0); >=20 > - // >=20 > - // set cycle bit in Link TRB as normal >=20 > - // >=20 > - ((LINK_TRB*)TrsTrb)->CycleBit =3D TrsRing->RingPCS & BIT0; >=20 > - // >=20 > - // Toggle PCS maintained by software >=20 > - // >=20 > - TrsRing->RingPCS =3D (TrsRing->RingPCS & BIT0) ? 0 : 1; >=20 > - TrsTrb =3D (TRB_TEMPLATE *)(UINTN)((TrsTrb->Parameter1 |= LShiftU64 ((UINT64)TrsTrb->Parameter2, 32)) & ~0x0F); >=20 > - } >=20 > - } >=20 > - ASSERT (Index !=3D TrsRing->TrbNumber); >=20 > - >=20 > - if ((EFI_PHYSICAL_ADDRESS)(UINTN) TrsTrb !=3D TrsRing->RingEnqueue) { >=20 > - TrsRing->RingEnqueue =3D (EFI_PHYSICAL_ADDRESS)(UINTN) TrsTrb; >=20 > - } >=20 > - >=20 > - // >=20 > - // Clear the Trb context for enqueue, but reserve the PCS bit >=20 > - // >=20 > - TrsTrb->Parameter1 =3D 0; >=20 > - TrsTrb->Parameter2 =3D 0; >=20 > - TrsTrb->Status =3D 0; >=20 > - TrsTrb->RsvdZ1 =3D 0; >=20 > - TrsTrb->Type =3D 0; >=20 > - TrsTrb->Control =3D 0; >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Synchronize the specified event ring to update the enqueue and dequeue= pointer. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param EvtRing The event ring to sync. >=20 > - >=20 > - @retval EFI_SUCCESS The event ring is synchronized successfully. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -XhcSyncEventRing ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN EVENT_RING *EvtRing >=20 > - ) >=20 > -{ >=20 > - UINTN Index; >=20 > - TRB_TEMPLATE *EvtTrb1; >=20 > - >=20 > - ASSERT (EvtRing !=3D NULL); >=20 > - >=20 > - // >=20 > - // Calculate the EventRingEnqueue and EventRingCCS. >=20 > - // Note: only support single Segment >=20 > - // >=20 > - EvtTrb1 =3D (TRB_TEMPLATE *)(UINTN) EvtRing->EventRingDequeue; >=20 > - >=20 > - for (Index =3D 0; Index < EvtRing->TrbNumber; Index++) { >=20 > - if (EvtTrb1->CycleBit !=3D EvtRing->EventRingCCS) { >=20 > - break; >=20 > - } >=20 > - >=20 > - EvtTrb1++; >=20 > - >=20 > - if ((UINTN)EvtTrb1 >=3D ((UINTN) EvtRing->EventRingSeg0 + sizeof (TR= B_TEMPLATE) * EvtRing->TrbNumber)) { >=20 > - EvtTrb1 =3D (TRB_TEMPLATE *)(UINTN) EvtRing->EventRingSeg0; >=20 > - EvtRing->EventRingCCS =3D (EvtRing->EventRingCCS) ? 0 : 1; >=20 > - } >=20 > - } >=20 > - >=20 > - if (Index < EvtRing->TrbNumber) { >=20 > - EvtRing->EventRingEnqueue =3D (EFI_PHYSICAL_ADDRESS)(UINTN)EvtTrb1; >=20 > - } else { >=20 > - ASSERT (FALSE); >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Check if there is a new generated event. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param EvtRing The event ring to check. >=20 > - @param NewEvtTrb The new event TRB found. >=20 > - >=20 > - @retval EFI_SUCCESS Found a new event TRB at the event ring. >=20 > - @retval EFI_NOT_READY The event ring has no new event. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -XhcCheckNewEvent ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN EVENT_RING *EvtRing, >=20 > - OUT TRB_TEMPLATE **NewEvtTrb >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - >=20 > - ASSERT (EvtRing !=3D NULL); >=20 > - >=20 > - *NewEvtTrb =3D (TRB_TEMPLATE *)(UINTN) EvtRing->EventRingDequeue; >=20 > - >=20 > - if (EvtRing->EventRingDequeue =3D=3D EvtRing->EventRingEnqueue) { >=20 > - return EFI_NOT_READY; >=20 > - } >=20 > - >=20 > - Status =3D EFI_SUCCESS; >=20 > - >=20 > - EvtRing->EventRingDequeue +=3D sizeof (TRB_TEMPLATE); >=20 > - // >=20 > - // If the dequeue pointer is beyond the ring, then roll-back it to the= begining of the ring. >=20 > - // >=20 > - if ((UINTN)EvtRing->EventRingDequeue >=3D ((UINTN) EvtRing->EventRingS= eg0 + sizeof (TRB_TEMPLATE) * EvtRing- > >TrbNumber)) { >=20 > - EvtRing->EventRingDequeue =3D EvtRing->EventRingSeg0; >=20 > - } >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Check if the Trb is a transaction of the URB. >=20 > - >=20 > - @param Trb The TRB to be checked >=20 > - @param Urb The transfer ring to be checked. >=20 > - >=20 > - @retval TRUE It is a transaction of the URB. >=20 > - @retval FALSE It is not any transaction of the URB. >=20 > - >=20 > -**/ >=20 > -BOOLEAN >=20 > -IsTransferRingTrb ( >=20 > - IN TRB_TEMPLATE *Trb, >=20 > - IN URB *Urb >=20 > - ) >=20 > -{ >=20 > - TRB_TEMPLATE *CheckedTrb; >=20 > - TRANSFER_RING *Ring; >=20 > - UINTN Index; >=20 > - >=20 > - Ring =3D (TRANSFER_RING *)(UINTN) Urb->Ring; >=20 > - CheckedTrb =3D (TRB_TEMPLATE *)(UINTN) Ring->RingSeg0; >=20 > - >=20 > - ASSERT (Ring->TrbNumber =3D=3D CMD_RING_TRB_NUMBER || Ring->TrbNumber = =3D=3D TR_RING_TRB_NUMBER); >=20 > - >=20 > - for (Index =3D 0; Index < Ring->TrbNumber; Index++) { >=20 > - if (Trb =3D=3D CheckedTrb) { >=20 > - return TRUE; >=20 > - } >=20 > - CheckedTrb++; >=20 > - } >=20 > - >=20 > - return FALSE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Check the URB's execution result and update the URB's >=20 > - result accordingly. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Urb The URB to check result. >=20 > - >=20 > - @return Whether the result of URB transfer is finialized. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -XhcCheckUrbResult ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN URB *Urb >=20 > - ) >=20 > -{ >=20 > - EVT_TRB_TRANSFER *EvtTrb; >=20 > - TRB_TEMPLATE *TRBPtr; >=20 > - UINTN Index; >=20 > - UINT8 TRBType; >=20 > - EFI_STATUS Status; >=20 > - URB *CheckedUrb; >=20 > - UINT64 XhcDequeue; >=20 > - UINT32 High; >=20 > - UINT32 Low; >=20 > - >=20 > - ASSERT ((Xhc !=3D NULL) && (Urb !=3D NULL)); >=20 > - >=20 > - Status =3D EFI_SUCCESS; >=20 > - >=20 > - if (Urb->Finished) { >=20 > - goto EXIT; >=20 > - } >=20 > - >=20 > - EvtTrb =3D NULL; >=20 > - >=20 > - // >=20 > - // Traverse the event ring to find out all new events from the previou= s check. >=20 > - // >=20 > - XhcSyncEventRing (Xhc, &Xhc->EventRing); >=20 > - >=20 > - for (Index =3D 0; Index < Xhc->EventRing.TrbNumber; Index++) { >=20 > - Status =3D XhcCheckNewEvent (Xhc, &Xhc->EventRing, ((TRB_TEMPLATE **= )&EvtTrb)); >=20 > - if (Status =3D=3D EFI_NOT_READY) { >=20 > - // >=20 > - // All new events are handled, return directly. >=20 > - // >=20 > - goto EXIT; >=20 > - } >=20 > - // >=20 > - // Only handle COMMAND_COMPLETETION_EVENT and TRANSFER_EVENT. >=20 > - // >=20 > - if ((EvtTrb->Type !=3D TRB_TYPE_COMMAND_COMPLT_EVENT) && (EvtTrb->Ty= pe !=3D TRB_TYPE_TRANS_EVENT)) { >=20 > - continue; >=20 > - } >=20 > - >=20 > - TRBPtr =3D (TRB_TEMPLATE *)(UINTN)(EvtTrb->TRBPtrLo | LShiftU64 ((UI= NT64) EvtTrb->TRBPtrHi, 32)); >=20 > - >=20 > - // >=20 > - // Update the status of Urb according to the finished event regardle= ss of whether >=20 > - // the urb is current checked one or in the XHCI's async transfer li= st. >=20 > - // This way is used to avoid that those completed async transfer eve= nts don't get >=20 > - // handled in time and are flushed by newer coming events. >=20 > - // >=20 > - if (IsTransferRingTrb (TRBPtr, Urb)) { >=20 > - CheckedUrb =3D Urb; >=20 > - } else { >=20 > - continue; >=20 > - } >=20 > - switch (EvtTrb->Completecode) { >=20 > - case TRB_COMPLETION_STALL_ERROR: >=20 > - CheckedUrb->Result |=3D EFI_USB_ERR_STALL; >=20 > - CheckedUrb->Finished =3D TRUE; >=20 > - break; >=20 > - >=20 > - case TRB_COMPLETION_BABBLE_ERROR: >=20 > - CheckedUrb->Result |=3D EFI_USB_ERR_BABBLE; >=20 > - CheckedUrb->Finished =3D TRUE; >=20 > - break; >=20 > - >=20 > - case TRB_COMPLETION_DATA_BUFFER_ERROR: >=20 > - CheckedUrb->Result |=3D EFI_USB_ERR_BUFFER; >=20 > - CheckedUrb->Finished =3D TRUE; >=20 > - break; >=20 > - >=20 > - case TRB_COMPLETION_USB_TRANSACTION_ERROR: >=20 > - CheckedUrb->Result |=3D EFI_USB_ERR_TIMEOUT; >=20 > - CheckedUrb->Finished =3D TRUE; >=20 > - break; >=20 > - >=20 > - case TRB_COMPLETION_SHORT_PACKET: >=20 > - case TRB_COMPLETION_SUCCESS: >=20 > - if (EvtTrb->Completecode =3D=3D TRB_COMPLETION_SHORT_PACKET) { >=20 > - } >=20 > - >=20 > - TRBType =3D (UINT8) (TRBPtr->Type); >=20 > - if ((TRBType =3D=3D TRB_TYPE_DATA_STAGE) || >=20 > - (TRBType =3D=3D TRB_TYPE_NORMAL) || >=20 > - (TRBType =3D=3D TRB_TYPE_ISOCH)) { >=20 > - CheckedUrb->Completed +=3D (CheckedUrb->DataLen - EvtTrb->Leng= th); >=20 > - } >=20 > - >=20 > - break; >=20 > - >=20 > - default: >=20 > - CheckedUrb->Result |=3D EFI_USB_ERR_TIMEOUT; >=20 > - CheckedUrb->Finished =3D TRUE; >=20 > - break; >=20 > - } >=20 > - >=20 > - // >=20 > - // Only check first and end Trb event address >=20 > - // >=20 > - >=20 > - if ((EFI_PHYSICAL_ADDRESS)(UINTN) TRBPtr =3D=3D CheckedUrb->TrbStart= ) { >=20 > - CheckedUrb->StartDone =3D TRUE; >=20 > - } >=20 > - >=20 > - if ((EFI_PHYSICAL_ADDRESS)(UINTN) TRBPtr =3D=3D CheckedUrb->TrbEnd) = { >=20 > - CheckedUrb->EndDone =3D TRUE; >=20 > - } >=20 > - >=20 > - if (CheckedUrb->StartDone && CheckedUrb->EndDone) { >=20 > - CheckedUrb->Finished =3D TRUE; >=20 > - } >=20 > - >=20 > - } >=20 > - >=20 > -EXIT: >=20 > - // >=20 > - // Advance event ring to last available entry >=20 > - // >=20 > - // Some 3rd party XHCI external cards don't support single 64-bytes wi= dth register access, >=20 > - // So divide it to two 32-bytes width register access. >=20 > - // >=20 > - Low =3D XhcReadDebugReg (Xhc, XHC_DC_DCERDP); >=20 > - High =3D XhcReadDebugReg (Xhc, XHC_DC_DCERDP + 4); >=20 > - XhcDequeue =3D (UINT64)(LShiftU64((UINT64)High, 32) | Low); >=20 > - >=20 > - if ((XhcDequeue & (~0x0F)) !=3D ((UINT64)(UINTN)Xhc->EventRing.EventRi= ngDequeue & (~0x0F))) { >=20 > - // >=20 > - // Some 3rd party XHCI external cards don't support single 64-bytes = width register access, >=20 > - // So divide it to two 32-bytes width register access. >=20 > - // >=20 > - XhcWriteDebugReg (Xhc, XHC_DC_DCERDP, XHC_LOW_32BIT (Xhc->EventRing.= EventRingDequeue)); >=20 > - XhcWriteDebugReg (Xhc, XHC_DC_DCERDP + 4, XHC_HIGH_32BIT (Xhc->Event= Ring.EventRingDequeue)); >=20 > - } >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Ring the door bell to notify XHCI there is a transaction to be execute= d. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Urb The pointer to URB. >=20 > - >=20 > - @retval EFI_SUCCESS Successfully ring the door bell. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -XhcRingDoorBell ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN URB *Urb >=20 > - ) >=20 > -{ >=20 > - UINT32 Dcdb; >=20 > - >=20 > - // >=20 > - // 7.6.8.2 DCDB Register >=20 > - // >=20 > - if (Urb->Direction =3D=3D EfiUsbDataIn) { >=20 > - Dcdb =3D 0x100; >=20 > - } else { >=20 > - Dcdb =3D 0x0; >=20 > - } >=20 > - >=20 > - XhcWriteDebugReg ( >=20 > - Xhc, >=20 > - XHC_DC_DCDB, >=20 > - Dcdb >=20 > - ); >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Execute the transfer by polling the URB. This is a synchronous operati= on. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Urb The URB to execute. >=20 > - @param Timeout The time to wait before abort, in millisecon= d. >=20 > - >=20 > - @return EFI_DEVICE_ERROR The transfer failed due to transfer error. >=20 > - @return EFI_TIMEOUT The transfer failed due to time out. >=20 > - @return EFI_SUCCESS The transfer finished OK. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -XhcExecTransfer ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN URB *Urb, >=20 > - IN UINTN Timeout >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINTN Index; >=20 > - UINTN Loop; >=20 > - TRB_TEMPLATE *Trb; >=20 > - TRANSFER_RING *Ring; >=20 > - TRB_TEMPLATE *TrbStart; >=20 > - TRB_TEMPLATE *TrbEnd; >=20 > - >=20 > - Status =3D EFI_SUCCESS; >=20 > - >=20 > - Loop =3D (Timeout * XHC_1_MILLISECOND / XHC_POLL_DELAY) + 1; >=20 > - if (Timeout =3D=3D 0) { >=20 > - Loop =3D 0xFFFFFFFF; >=20 > - } >=20 > - XhcRingDoorBell (Xhc, Urb); >=20 > - // >=20 > - // DSCT BIT0: Event Ring Not Empty bit can only be set to 1 by XHC aft= er ringing door bell with some delay. >=20 > - // >=20 > - >=20 > - for (Index =3D 0; Index < Loop; Index++) { >=20 > - Status =3D XhcCheckUrbResult (Xhc, Urb); >=20 > - if (Urb->Finished) { >=20 > - break; >=20 > - } >=20 > - MicroSecondDelay (XHC_POLL_DELAY); >=20 > - } >=20 > - if (Index =3D=3D Loop) { >=20 > - Urb->Result =3D EFI_USB_ERR_TIMEOUT; >=20 > - } >=20 > - >=20 > - // >=20 > - // If URB transfer is error, restore transfer ring to original value b= efore URB transfer >=20 > - // This will make the current transfer TRB is always at the latest unu= sed one in transfer ring. >=20 > - // Without this code, when there is read TRB from target, but host doe= s not write anything, this TRB (A) >=20 > - // will be still here, next read TRB (B) will be put next to TRB (A), = when host write then, the TRB (A) >=20 > - // will be used to contain data, not TRB(B), this will cause Finished = flag will not be set and return error in this function. >=20 > - // >=20 > - Ring =3D (TRANSFER_RING *)(UINTN) Urb->Ring; >=20 > - if (Urb->Result !=3D EFI_USB_NOERROR) { >=20 > - Ring->RingEnqueue =3D Urb->TrbStart; >=20 > - // >=20 > - // Clear CCS flag for next use >=20 > - // >=20 > - TrbStart =3D (TRB_TEMPLATE *)(UINTN) Urb->TrbStart; >=20 > - TrbEnd =3D (TRB_TEMPLATE *)(UINTN) Urb->TrbEnd; >=20 > - for (Trb =3D TrbStart; Trb <=3D TrbEnd; Trb++) { >=20 > - Trb->CycleBit =3D ((~Ring->RingPCS) & BIT0); >=20 > - } >=20 > - } >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Create a transfer TRB. >=20 > - >=20 > - @param Xhc The XHCI Instance >=20 > - @param Urb The urb used to construct the transfer TRB. >=20 > - >=20 > - @return Created TRB or NULL >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -XhcCreateTransferTrb ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN URB *Urb >=20 > - ) >=20 > -{ >=20 > - TRANSFER_RING *EPRing; >=20 > - TRB *TrbStart; >=20 > - UINT32 TotalLen; >=20 > - UINT32 Len; >=20 > - UINT32 TrbNum; >=20 > - >=20 > - Urb->Finished =3D FALSE; >=20 > - Urb->StartDone =3D FALSE; >=20 > - Urb->EndDone =3D FALSE; >=20 > - Urb->Completed =3D 0; >=20 > - Urb->Result =3D EFI_USB_NOERROR; >=20 > - >=20 > - if (Urb->Direction =3D=3D EfiUsbDataIn) { >=20 > - EPRing =3D &Xhc->TransferRingIn; >=20 > - } else { >=20 > - EPRing =3D &Xhc->TransferRingOut; >=20 > - } >=20 > - >=20 > - Urb->Ring =3D (EFI_PHYSICAL_ADDRESS)(UINTN) EPRing; >=20 > - // >=20 > - // Construct the TRB for ED_BULK_OUT and ED_BULK_IN >=20 > - // >=20 > - XhcSyncTrsRing (Xhc, EPRing); >=20 > - >=20 > - Urb->TrbStart =3D EPRing->RingEnqueue; >=20 > - >=20 > - TotalLen =3D 0; >=20 > - Len =3D 0; >=20 > - TrbNum =3D 0; >=20 > - TrbStart =3D (TRB *)(UINTN)EPRing->RingEnqueue; >=20 > - >=20 > - while (TotalLen < Urb->DataLen) { >=20 > - if ((TotalLen + 0x10000) >=3D Urb->DataLen) { >=20 > - Len =3D Urb->DataLen - TotalLen; >=20 > - } else { >=20 > - Len =3D 0x10000; >=20 > - } >=20 > - TrbStart =3D (TRB *)(UINTN)EPRing->RingEnqueue; >=20 > - TrbStart->TrbNormal.TRBPtrLo =3D XHC_LOW_32BIT(Urb->Data + TotalLen= ); >=20 > - TrbStart->TrbNormal.TRBPtrHi =3D XHC_HIGH_32BIT(Urb->Data + TotalLe= n); >=20 > - TrbStart->TrbNormal.Length =3D Len; >=20 > - TrbStart->TrbNormal.TDSize =3D 0; >=20 > - TrbStart->TrbNormal.IntTarget =3D 0; >=20 > - TrbStart->TrbNormal.ISP =3D 1; >=20 > - TrbStart->TrbNormal.IOC =3D 1; >=20 > - TrbStart->TrbNormal.Type =3D TRB_TYPE_NORMAL; >=20 > - >=20 > - // >=20 > - // Update the cycle bit >=20 > - // >=20 > - TrbStart->TrbNormal.CycleBit =3D EPRing->RingPCS & BIT0; >=20 > - >=20 > - XhcSyncTrsRing (Xhc, EPRing); >=20 > - TrbNum++; >=20 > - TotalLen +=3D Len; >=20 > - } >=20 > - >=20 > - Urb->TrbNum =3D TrbNum; >=20 > - >=20 > - // >=20 > - // Update to the last TRB >=20 > - // >=20 > - Urb->TrbEnd =3D (EFI_PHYSICAL_ADDRESS)(UINTN) TrbStart; >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Create a new URB for a new transaction. >=20 > - >=20 > - @param Xhc The XHCI Instance >=20 > - @param Direction The direction of data flow. >=20 > - @param Data The user data to transfer >=20 > - @param DataLen The length of data buffer >=20 > - >=20 > - @return Created URB or NULL >=20 > - >=20 > -**/ >=20 > -URB* >=20 > -XhcCreateUrb ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN EFI_USB_DATA_DIRECTION Direction, >=20 > - IN VOID *Data, >=20 > - IN UINTN DataLen >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - URB *Urb; >=20 > - EFI_PHYSICAL_ADDRESS DataAddress; >=20 > - >=20 > - Urb =3D &Xhc->Urb; >=20 > - ASSERT (Urb->Data !=3D 0); >=20 > - DataAddress =3D Urb->Data; >=20 > - ZeroMem (Urb, sizeof (URB)); >=20 > - >=20 > - Urb->Signature =3D USB3_DEBUG_PORT_INSTANCE_SIGNATURE; >=20 > - Urb->Direction =3D Direction; >=20 > - Urb->Data =3D DataAddress; >=20 > - >=20 > - ZeroMem ((VOID*)(UINTN) Urb->Data, DataLen); >=20 > - CopyMem ((VOID*)(UINTN) Urb->Data, Data, DataLen); >=20 > - >=20 > - Urb->DataLen =3D (UINT32) DataLen; >=20 > - Status =3D XhcCreateTransferTrb (Xhc, Urb); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - return Urb; >=20 > -} >=20 > - >=20 > -/** >=20 > - Submits bulk transfer to a bulk endpoint of a USB device. >=20 > - >=20 > - @param Xhc The instance of debug device. >=20 > - @param Direction The direction of data transfer. >=20 > - @param Data Array of pointers to the buffers of data= to transmit >=20 > - from or receive into. >=20 > - @param DataLength The lenght of the data buffer. >=20 > - @param Timeout Indicates the maximum time, in milliseco= nd, which >=20 > - the transfer is allowed to complete. >=20 > - @param TransferResult Transfer result. >=20 > - >=20 > - @retval EFI_SUCCESS The transfer was completed successfully. >=20 > - @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resou= rce. >=20 > - @retval EFI_INVALID_PARAMETER Some parameters are invalid. >=20 > - @retval EFI_TIMEOUT The transfer failed due to timeout. >=20 > - @retval EFI_DEVICE_ERROR The transfer failed due to host controll= er error. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -XhcDataTransfer ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN EFI_USB_DATA_DIRECTION Direction, >=20 > - IN OUT VOID *Data, >=20 > - IN OUT UINTN *DataLength, >=20 > - IN UINTN Timeout, >=20 > - OUT UINT32 *TransferResult >=20 > - ) >=20 > -{ >=20 > - URB *Urb; >=20 > - EFI_STATUS Status; >=20 > - >=20 > - // >=20 > - // Validate the parameters >=20 > - // >=20 > - if ((DataLength =3D=3D NULL) || (*DataLength =3D=3D 0) || >=20 > - (Data =3D=3D NULL) || (TransferResult =3D=3D NULL)) { >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - >=20 > - *TransferResult =3D EFI_USB_ERR_SYSTEM; >=20 > - Status =3D EFI_DEVICE_ERROR; >=20 > - >=20 > - // >=20 > - // Create a new URB, insert it into the asynchronous >=20 > - // schedule list, then poll the execution status. >=20 > - // >=20 > - Urb =3D XhcCreateUrb (Xhc, Direction, Data, *DataLength); >=20 > - >=20 > - if (Urb =3D=3D NULL) { >=20 > - Status =3D EFI_OUT_OF_RESOURCES; >=20 > - goto ON_EXIT; >=20 > - } >=20 > - >=20 > - Status =3D XhcExecTransfer (Xhc, Urb, Timeout); >=20 > - >=20 > - *TransferResult =3D Urb->Result; >=20 > - *DataLength =3D Urb->Completed; >=20 > - >=20 > - if (*TransferResult =3D=3D EFI_USB_NOERROR) { >=20 > - Status =3D EFI_SUCCESS; >=20 > - } >=20 > - >=20 > -ON_EXIT: >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Check whether the MMIO Bar is within any of the SMRAM ranges. >=20 > - >=20 > - @param[in] XhcMmioBase The address of the MMIO to be checked. >=20 > - >=20 > - @retval TURE The XHCI MMIO is in SMRAM ranges. >=20 > - @retval FALSE The XHCI MMIO is out of SMRAM ranges. >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -Usb3DebugIsAddressInSmram ( >=20 > - IN EFI_PHYSICAL_ADDRESS XhcMmioBase >=20 > - ) >=20 > -{ >=20 > - UINTN Index; >=20 > - >=20 > - if (mSmramCheckRangeCount =3D=3D 0) { >=20 > - // >=20 > - // When we invoke this function, we are already in SMM mode, >=20 > - // but SmmAccess->GetCapabilities failed which kept mSmramCheckRange= s as 0. >=20 > - // >=20 > - return TRUE; >=20 > - } >=20 > - >=20 > - for (Index =3D 0; Index < mSmramCheckRangeCount; Index ++) { >=20 > - if (((XhcMmioBase >=3D mSmramCheckRanges[Index].CpuStart) && (XhcMmi= oBase < mSmramCheckRanges[Index].CpuStart > + mSmramCheckRanges[Index].PhysicalSize)) || >=20 > - ((mSmramCheckRanges[Index].CpuStart >=3D XhcMmioBase) && (mSmram= CheckRanges[Index].CpuStart < XhcMmioBase > + mUsb3MmioSize))) { >=20 > - return TRUE; >=20 > - } >=20 > - } >=20 > - >=20 > - return FALSE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Transfer data via XHC controller. >=20 > - >=20 > - @param Data Data buffer. >=20 > - @param Length Data length. >=20 > - @param Direction Transfer direction. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -Usb3DebugPortDataTransfer ( >=20 > - UINT8 *Data, >=20 > - UINTN *Length, >=20 > - EFI_USB_DATA_DIRECTION Direction >=20 > - ) >=20 > -{ >=20 > - USB3_DEBUG_PORT_INSTANCE *Instance; >=20 > - EFI_PHYSICAL_ADDRESS XhcMmioBase; >=20 > - UINT16 Command; >=20 > - UINT8 Bus; >=20 > - UINT8 Device; >=20 > - UINT8 Function; >=20 > - UINT32 TransferResult; >=20 > - UINT32 Dcctrl; >=20 > - EFI_PHYSICAL_ADDRESS UsbBase; >=20 > - UINTN BytesToSend; >=20 > - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; >=20 > - EFI_STATUS Status; >=20 > - USB3_DEBUG_PORT_INSTANCE UsbDbgInstance; >=20 > - >=20 > - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); >=20 > - Bus =3D UsbDebugPort.PciAddress.Bus; >=20 > - Device =3D UsbDebugPort.PciAddress.Device; >=20 > - Function =3D UsbDebugPort.PciAddress.Function; >=20 > - >=20 > - // >=20 > - // MMIO base address is possible to clear, set it if it is cleared. (X= hciMemorySpaceClose in PchUsbCommon.c) >=20 > - // >=20 > - XhcMmioBase =3D GetXhciBaseAddress (); >=20 > - Command =3D GetXhciPciCommand (); >=20 > - >=20 > - if ((XhcMmioBase =3D=3D 0) || (XhcMmioBase =3D=3D XHCI_BASE_ADDRESS_64= _BIT_MASK)) { >=20 > - // >=20 > - // XHCI device MMIO base is cleared by someone, set it again >=20 > - // >=20 > - UsbBase =3D PcdGet32 (PcdXhciDefaultBaseAddress); >=20 > - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSR= EG_OFFSET), (UINT32)UsbBase); >=20 > - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSR= EG_OFFSET + 4), 0x0); >=20 > - UsbBase =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BA= SE_ADDRESSREG_OFFSET)) & > XHCI_BASE_ADDRESS_32_BIT_MASK; >=20 > - if (UsbBase =3D=3D 0 || UsbBase =3D=3D XHCI_BASE_ADDRESS_32_BIT_MASK= ) { >=20 > - return; >=20 > - } >=20 > - } >=20 > - >=20 > - // >=20 > - // Check if XHC debug MMIO range is in SMRAM >=20 > - // >=20 > - if ((mUsb3InSmm) && (Usb3DebugIsAddressInSmram (XhcMmioBase))) { >=20 > - return; >=20 > - } >=20 > - >=20 > - // >=20 > - // Save and set Command Register >=20 > - // >=20 > - if (((Command & EFI_PCI_COMMAND_MEMORY_SPACE) =3D=3D 0) || ((Command &= EFI_PCI_COMMAND_BUS_MASTER) =3D=3D 0)) > { >=20 > - PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET= ), Command | > EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER); >=20 > - PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET)= ); >=20 > - } >=20 > - >=20 > - Instance =3D GetUsb3DebugPortInstance (); >=20 > - >=20 > - if (Instance !=3D NULL) { >=20 > - if (!Instance->DebugSupport) { >=20 > - // >=20 > - // Debug device is not supported by XHCI, return >=20 > - // >=20 > - goto Done; >=20 > - } >=20 > - } >=20 > - >=20 > - if ((Instance !=3D NULL) && (Instance->Ready)) { >=20 > - // >=20 > - // Debug device is broken suddently (e.g. Windows OS), return >=20 > - // >=20 > - Dcctrl =3D XhcReadDebugReg (Instance, XHC_DC_DCCTRL); >=20 > - if ((Dcctrl & BIT0) =3D=3D 0) { >=20 > - goto Done; >=20 > - } >=20 > - } >=20 > - >=20 > - if ((Instance !=3D NULL) && (!Instance->Ready)) { >=20 > - // >=20 > - // Debug host does not connect with target >=20 > - // >=20 > - goto Done; >=20 > - } >=20 > - >=20 > - if (Instance =3D=3D NULL) { >=20 > - ZeroMem (&UsbDbgInstance, sizeof (USB3_DEBUG_PORT_INSTANCE)); >=20 > - DiscoverUsb3DebugPort (&UsbDbgInstance); >=20 > - if (UsbDbgInstance.DebugSupport) { >=20 > - if (!IsAllocatePagesReady ()) { >=20 > - // >=20 > - // AllocatePages can not work, return >=20 > - // >=20 > - goto Done; >=20 > - } >=20 > - } >=20 > - Status =3D USB3InitializeReal (); >=20 > - if (EFI_ERROR (Status)) { >=20 > - // >=20 > - // Debug device is failed to initialize >=20 > - // >=20 > - goto Done; >=20 > - } >=20 > - >=20 > - // >=20 > - // Update instance >=20 > - // >=20 > - Instance =3D GetUsb3DebugPortInstance (); >=20 > - >=20 > - if (Instance =3D=3D NULL) { >=20 > - // >=20 > - // Debug device instance is failed to create >=20 > - // >=20 > - goto Done; >=20 > - } >=20 > - >=20 > - if ((!Instance->Ready) || (!Instance->DebugSupport)) { >=20 > - // >=20 > - // Debug host does not connect at first or is not supported >=20 > - // >=20 > - goto Done; >=20 > - } >=20 > - } >=20 > - >=20 > - BytesToSend =3D 0; >=20 > - while (*Length > 0) { >=20 > - BytesToSend =3D ((*Length) > XHC_DEBUG_PORT_DATA_LENGTH) ? XHC_DEBUG= _PORT_DATA_LENGTH : *Length; >=20 > - XhcDataTransfer ( >=20 > - Instance, >=20 > - Direction, >=20 > - Data, >=20 > - &BytesToSend, >=20 > - DATA_TRANSFER_TIME_OUT, >=20 > - &TransferResult >=20 > - ); >=20 > - if (TransferResult !=3D EFI_USB_NOERROR) { >=20 > - break; >=20 > - } >=20 > - *Length -=3D BytesToSend; >=20 > - Data +=3D BytesToSend; >=20 > - } >=20 > - >=20 > -Done: >=20 > - // >=20 > - // Restore Command Register >=20 > - // >=20 > - PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET)= , Command); >=20 > - >=20 > -} >=20 > - >=20 > -/** >=20 > - Receive data over the USB3 debug cable. >=20 > - >=20 > - @param[out] Data Pointer to data >=20 > - @param[in, out] Length Pointer to data length >=20 > - >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -Usb3DbgIn ( >=20 > - OUT UINT8 *Data, >=20 > - IN OUT UINTN *Length >=20 > - ) >=20 > -{ >=20 > - Usb3DebugPortDataTransfer (Data, Length, EfiUsbDataIn); >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Send data over the USB3 debug cable. >=20 > - >=20 > - @param[out] Data Pointer to data >=20 > - @param[in, out] Length Pointer to data length >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -Usb3DbgOut ( >=20 > - OUT UINT8 *Data, >=20 > - IN OUT UINTN *Length >=20 > - ) >=20 > -{ >=20 > - Usb3DebugPortDataTransfer (Data, Length, EfiUsbDataOut); >=20 > -} >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3= DebugPortInitialize.c > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortIn= itialize.c > deleted file mode 100644 > index dbdae59253..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPo= rtInitialize.c > +++ /dev/null > @@ -1,726 +0,0 @@ > -/** @file >=20 > - Usb3 Debug Port initialization >=20 > - >=20 > - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include "Usb3DebugPortLibInternal.h" >=20 > - >=20 > -UINT16 mString0Desc[] =3D { >=20 > - // String Descriptor Type + Length >=20 > - ( USB_DESC_TYPE_STRING << 8 ) + STRING0_DESC_LEN, >=20 > - 0x0409 >=20 > -}; >=20 > - >=20 > -UINT16 mManufacturerStrDesc[] =3D { >=20 > - // String Descriptor Type + Length >=20 > - ( USB_DESC_TYPE_STRING << 8 ) + MANU_DESC_LEN, >=20 > - 'I', 'n', 't', 'e', 'l' >=20 > -}; >=20 > - >=20 > -//USB 3.0 Debug Cable >=20 > -UINT16 mProductStrDesc[] =3D { >=20 > - // String Descriptor Type + Length >=20 > - ( USB_DESC_TYPE_STRING << 8 ) + PRODUCT_DESC_LEN, >=20 > - 'U', 'S', 'B', ' ', '3', '.', '0', ' ', 'D', 'e', 'b', 'u', 'g', ' ', = 'C', 'a', 'b', 'l', 'e' >=20 > -}; >=20 > - >=20 > -UINT16 mSerialNumberStrDesc[] =3D { >=20 > - // String Descriptor Type + Length >=20 > - ( USB_DESC_TYPE_STRING << 8 ) + SERIAL_DESC_LEN, >=20 > - '1' >=20 > -}; >=20 > - >=20 > -XHC_DC_CONTEXT DebugCapabilityContextTemplate =3D { >=20 > - { >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - STRING0_DESC_LEN, >=20 > - MANU_DESC_LEN, >=20 > - PRODUCT_DESC_LEN, >=20 > - SERIAL_DESC_LEN, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0 >=20 > - }, >=20 > - { >=20 > - 0, // EPState >=20 > - 0, // RsvdZ1 >=20 > - 0, // Mult >=20 > - 0, // MaxPStreams >=20 > - 0, // LSA >=20 > - 0, // Interval >=20 > - 0, // RsvdZ2 >=20 > - 0, // RsvdZ3 >=20 > - 3, // CERR >=20 > - ED_BULK_OUT, // EPType >=20 > - 0, // RsvdZ4 >=20 > - 0, // HID >=20 > - 0, // MaxBurstSize >=20 > - 1024, // MaxPacketSize >=20 > - 0, // PtrLo >=20 > - 0, // PtrHi >=20 > - 0x1000, // AverageTRBLength >=20 > - 0, // MaxESITPayload >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0 >=20 > - }, >=20 > - { >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 3, //CERR >=20 > - ED_BULK_IN, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 1024, //MaxPacketSize >=20 > - 0, >=20 > - 0, >=20 > - 0x1000, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0, >=20 > - 0 >=20 > - } >=20 > -}; >=20 > - >=20 > -/** >=20 > - Return command register value in XHCI controller. >=20 > - >=20 > -**/ >=20 > -UINT16 >=20 > -GetXhciPciCommand ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - UINT8 Bus; >=20 > - UINT8 Device; >=20 > - UINT8 Function; >=20 > - UINT16 Command; >=20 > - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; >=20 > - >=20 > - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); >=20 > - >=20 > - Bus =3D UsbDebugPort.PciAddress.Bus; >=20 > - Device =3D UsbDebugPort.PciAddress.Device; >=20 > - Function =3D UsbDebugPort.PciAddress.Function; >=20 > - Command =3D PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMA= ND_OFFSET)); >=20 > - return Command; >=20 > -} >=20 > - >=20 > -/** >=20 > - Discover the USB3 debug device. >=20 > - >=20 > - @param[in] Instance Pointer to USB3 debug port object instan= ce. >=20 > - >=20 > - @retval RETURN_SUCCESS The USB3 debug device was found. >=20 > - @retval RETURN_DEVICE_ERROR The USB3 debug device was not found. >=20 > - >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -DiscoverUsb3DebugPort( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Instance >=20 > - ) >=20 > -{ >=20 > - UINT8 Bus; >=20 > - UINT8 Device; >=20 > - UINT8 Function; >=20 > - UINT16 Command; >=20 > - EFI_PHYSICAL_ADDRESS UsbBase; >=20 > - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; >=20 > - EFI_PHYSICAL_ADDRESS CapabilityPointer; >=20 > - UINT32 Capability; >=20 > - BOOLEAN Flag; >=20 > - UINT8 CapLength; >=20 > - >=20 > - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); >=20 > - Bus =3D UsbDebugPort.PciAddress.Bus; >=20 > - Device =3D UsbDebugPort.PciAddress.Device; >=20 > - Function =3D UsbDebugPort.PciAddress.Function; >=20 > - if ((PciRead8(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_CLASSCODE_OFF= SET + 2)) !=3D PCI_CLASS_SERIAL) || >=20 > - (PciRead8(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_CLASSCODE_OFF= SET + 1)) !=3D PCI_CLASS_SERIAL_USB) || >=20 > - (PciRead8(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_CLASSCODE_OFF= SET)) !=3D 0x30)) { >=20 > - // >=20 > - // The device is not XHCI controller >=20 > - // >=20 > - return RETURN_NOT_FOUND; >=20 > - } >=20 > - >=20 > - // >=20 > - // USBBASE is at 10-13h, i.e. the first BAR, clear the low bits which = is not part of base address >=20 > - // >=20 > - UsbBase =3D GetXhciBaseAddress (); >=20 > - >=20 > - // >=20 > - // Set XHCI MMIO base address if necessary >=20 > - // >=20 > - if ((UsbBase =3D=3D 0) || (UsbBase =3D=3D XHCI_BASE_ADDRESS_64_BIT_MAS= K)) { >=20 > - UsbBase =3D PcdGet32 (PcdXhciDefaultBaseAddress); >=20 > - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSR= EG_OFFSET), (UINT32)UsbBase); >=20 > - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSR= EG_OFFSET + 4), 0x0); >=20 > - UsbBase =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BA= SE_ADDRESSREG_OFFSET)) & > XHCI_BASE_ADDRESS_32_BIT_MASK; >=20 > - if (UsbBase =3D=3D 0 || UsbBase =3D=3D XHCI_BASE_ADDRESS_32_BIT_MASK= ) { >=20 > - return RETURN_DEVICE_ERROR; >=20 > - } >=20 > - } >=20 > - >=20 > - // >=20 > - // Set MSE and BME bit - enable the address space >=20 > - // >=20 > - Command =3D PciRead16 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMM= AND_OFFSET)); >=20 > - if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) =3D=3D 0) { >=20 > - PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET= ), Command | > EFI_PCI_COMMAND_MEMORY_SPACE); >=20 > - PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET)= ); >=20 > - } >=20 > - >=20 > - CapLength =3D MmioRead8 ((UINTN) UsbBase); >=20 > - >=20 > - // >=20 > - // Get capability pointer from HCCPARAMS at offset 0x10 >=20 > - // >=20 > - CapabilityPointer =3D UsbBase + (MmioRead32 ((UINTN)(UsbBase + XHC_HCC= PARAMS_OFFSET)) >> 16) * 4; >=20 > - >=20 > - // >=20 > - // Search XHCI debug capability >=20 > - // >=20 > - Flag =3D FALSE; >=20 > - Capability =3D MmioRead32 ((UINTN)CapabilityPointer); >=20 > - while (TRUE) { >=20 > - if ((Capability & XHC_CAPABILITY_ID_MASK) =3D=3D PCI_CAPABILITY_ID_D= EBUG_PORT) { >=20 > - Flag =3D TRUE; >=20 > - break; >=20 > - } >=20 > - if ((((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) & XHC_CAPABILITY= _ID_MASK) =3D=3D 0) { >=20 > - // >=20 > - // Reach the end of capability list, quit >=20 > - // >=20 > - break; >=20 > - } >=20 > - CapabilityPointer +=3D ((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8= ) * 4; >=20 > - Capability =3D MmioRead32 ((UINTN)CapabilityPointer); >=20 > - } >=20 > - >=20 > - Instance->Signature =3D USB3_DEBUG_PORT_INSTANCE_SIGNATURE= ; >=20 > - >=20 > - if (Flag) { >=20 > - Instance->DebugSupport =3D TRUE; >=20 > - Instance->DebugCapabilityBase =3D CapabilityPointer; >=20 > - Instance->DebugCapabilityOffset =3D CapabilityPointer - UsbBase; >=20 > - >=20 > - Instance->XhciOpRegister =3D UsbBase + CapLength; >=20 > - Instance->XhcMmioBase =3D UsbBase; >=20 > - >=20 > - Instance->PciBusNumber =3D Bus; >=20 > - Instance->PciDeviceNumber =3D Device; >=20 > - Instance->PciFunctionNumber =3D Function; >=20 > - } >=20 > - >=20 > - // >=20 > - // Restore Command Register >=20 > - // >=20 > - PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET)= , Command); >=20 > - >=20 > - return RETURN_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Create XHCI event ring. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param EventRing The created event ring. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -CreateEventRing ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - OUT EVENT_RING *EventRing >=20 > - ) >=20 > -{ >=20 > - VOID *Buf; >=20 > - EVENT_RING_SEG_TABLE_ENTRY *ERSTBase; >=20 > - >=20 > - ASSERT (EventRing !=3D NULL); >=20 > - >=20 > - // >=20 > - // Allocate Event Ring >=20 > - // >=20 > - Buf =3D AllocateAlignBuffer (sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NU= MBER); >=20 > - ASSERT (Buf !=3D NULL); >=20 > - ASSERT (((UINTN) Buf & 0x3F) =3D=3D 0); >=20 > - ZeroMem (Buf, sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMBER); >=20 > - >=20 > - EventRing->EventRingSeg0 =3D (EFI_PHYSICAL_ADDRESS)(UINTN) Buf; >=20 > - EventRing->TrbNumber =3D EVENT_RING_TRB_NUMBER; >=20 > - EventRing->EventRingDequeue =3D (EFI_PHYSICAL_ADDRESS)(UINTN) EventRin= g->EventRingSeg0; >=20 > - EventRing->EventRingEnqueue =3D (EFI_PHYSICAL_ADDRESS)(UINTN) EventRin= g->EventRingSeg0; >=20 > - >=20 > - // >=20 > - // Software maintains an Event Ring Consumer Cycle State (CCS) bit, in= itializing it to '1' >=20 > - // and toggling it every time the Event Ring Dequeue Pointer wraps bac= k to the beginning of the Event Ring. >=20 > - // >=20 > - EventRing->EventRingCCS =3D 1; >=20 > - >=20 > - // >=20 > - // Allocate Event Ring Segment Table Entry 0 in Event Ring Segment Tab= le >=20 > - // >=20 > - Buf =3D AllocateAlignBuffer (sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERS= T_NUMBER); >=20 > - ASSERT (Buf !=3D NULL); >=20 > - ASSERT (((UINTN) Buf & 0x3F) =3D=3D 0); >=20 > - ZeroMem (Buf, sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERST_NUMBER); >=20 > - >=20 > - ERSTBase =3D (EVENT_RING_SEG_TABLE_ENTRY *) Buf; >=20 > - EventRing->ERSTBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN) ERSTBase; >=20 > - >=20 > - // >=20 > - // Fill Event Segment address >=20 > - // >=20 > - ERSTBase->PtrLo =3D XHC_LOW_32BIT (EventRing->EventRingSeg0); >=20 > - ERSTBase->PtrHi =3D XHC_HIGH_32BIT (EventRing->EventRingSeg0); >=20 > - ERSTBase->RingTrbSize =3D EVENT_RING_TRB_NUMBER; >=20 > - >=20 > - // >=20 > - // Program the Interrupter Event Ring Dequeue Pointer (DCERDP) registe= r (7.6.4.1) >=20 > - // >=20 > - XhcWriteDebugReg ( >=20 > - Xhc, >=20 > - XHC_DC_DCERDP, >=20 > - XHC_LOW_32BIT((UINT64)(UINTN)EventRing->EventRingDequeue) >=20 > - ); >=20 > - >=20 > - XhcWriteDebugReg ( >=20 > - Xhc, >=20 > - XHC_DC_DCERDP + 4, >=20 > - XHC_HIGH_32BIT((UINT64)(UINTN)EventRing->EventRingDequeue) >=20 > - ); >=20 > - >=20 > - // >=20 > - // Program the Debug Capability Event Ring Segment Table Base Address = (DCERSTBA) register(7.6.4.1) >=20 > - // >=20 > - XhcWriteDebugReg ( >=20 > - Xhc, >=20 > - XHC_DC_DCERSTBA, >=20 > - XHC_LOW_32BIT((UINT64)(UINTN)ERSTBase) >=20 > - ); >=20 > - >=20 > - XhcWriteDebugReg ( >=20 > - Xhc, >=20 > - XHC_DC_DCERSTBA + 4, >=20 > - XHC_HIGH_32BIT((UINT64)(UINTN)ERSTBase) >=20 > - ); >=20 > - >=20 > - // >=20 > - // Program the Debug Capability Event Ring Segment Table Size (DCERSTS= Z) register(7.6.4.1) >=20 > - // >=20 > - XhcWriteDebugReg ( >=20 > - Xhc, >=20 > - XHC_DC_DCERSTSZ, >=20 > - ERST_NUMBER >=20 > - ); >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Create XHCI transfer ring. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param TrbNum The number of TRB in the ring. >=20 > - @param TransferRing The created transfer ring. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -CreateTransferRing ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 TrbNum, >=20 > - OUT TRANSFER_RING *TransferRing >=20 > - ) >=20 > -{ >=20 > - VOID *Buf; >=20 > - LINK_TRB *EndTrb; >=20 > - >=20 > - Buf =3D AllocateAlignBuffer (sizeof (TRB_TEMPLATE) * TrbNum); >=20 > - ASSERT (Buf !=3D NULL); >=20 > - ASSERT (((UINTN) Buf & 0xF) =3D=3D 0); >=20 > - ZeroMem (Buf, sizeof (TRB_TEMPLATE) * TrbNum); >=20 > - >=20 > - TransferRing->RingSeg0 =3D (EFI_PHYSICAL_ADDRESS)(UINTN) Buf; >=20 > - TransferRing->TrbNumber =3D TrbNum; >=20 > - TransferRing->RingEnqueue =3D TransferRing->RingSeg0; >=20 > - TransferRing->RingDequeue =3D TransferRing->RingSeg0; >=20 > - TransferRing->RingPCS =3D 1; >=20 > - // >=20 > - // 4.9.2 Transfer Ring Management >=20 > - // To form a ring (or circular queue) a Link TRB may be inserted at th= e end of a ring to >=20 > - // point to the first TRB in the ring. >=20 > - // >=20 > - EndTrb =3D (LINK_TRB *) ((UINTN)Buf + sizeof (TRB_TEMPLATE) * (= TrbNum - 1)); >=20 > - EndTrb->Type =3D TRB_TYPE_LINK; >=20 > - EndTrb->PtrLo =3D XHC_LOW_32BIT (Buf); >=20 > - EndTrb->PtrHi =3D XHC_HIGH_32BIT (Buf); >=20 > - // >=20 > - // Toggle Cycle (TC). When set to '1', the xHC shall toggle its interp= retation of the Cycle bit. >=20 > - // >=20 > - EndTrb->TC =3D 1; >=20 > - // >=20 > - // Set Cycle bit as other TRB PCS init value >=20 > - // >=20 > - EndTrb->CycleBit =3D 0; >=20 > -} >=20 > - >=20 > -/** >=20 > - Create debug capability context for XHC debug device. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - >=20 > - @retval EFI_SUCCESS The bit successfully changed by host controller. >=20 > - @retval EFI_TIMEOUT The time out occurred. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -CreateDebugCapabilityContext ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc >=20 > - ) >=20 > -{ >=20 > - VOID *Buf; >=20 > - XHC_DC_CONTEXT *DebugCapabilityContext; >=20 > - UINT8 *String0Desc; >=20 > - UINT8 *ManufacturerStrDesc; >=20 > - UINT8 *ProductStrDesc; >=20 > - UINT8 *SerialNumberStrDesc; >=20 > - >=20 > - // >=20 > - // Allocate debug device context >=20 > - // >=20 > - Buf =3D AllocateAlignBuffer (sizeof (XHC_DC_CONTEXT)); >=20 > - ASSERT (Buf !=3D NULL); >=20 > - ASSERT (((UINTN) Buf & 0xF) =3D=3D 0); >=20 > - ZeroMem (Buf, sizeof (XHC_DC_CONTEXT)); >=20 > - >=20 > - DebugCapabilityContext =3D (XHC_DC_CONTEXT *)(UINTN) Buf; >=20 > - Xhc->DebugCapabilityContext =3D (EFI_PHYSICAL_ADDRESS)(UINTN) DebugCap= abilityContext; >=20 > - >=20 > - CopyMem (DebugCapabilityContext, &DebugCapabilityContextTemplate, size= of (XHC_DC_CONTEXT)); >=20 > - >=20 > - // >=20 > - // Update string descriptor address >=20 > - // >=20 > - String0Desc =3D (UINT8 *) AllocateAlignBuffer (STRING0_DESC_LEN + MANU= _DESC_LEN + PRODUCT_DESC_LEN + > SERIAL_DESC_LEN); >=20 > - ASSERT (String0Desc !=3D NULL); >=20 > - ZeroMem (String0Desc, STRING0_DESC_LEN + MANU_DESC_LEN + PRODUCT_DESC_= LEN + SERIAL_DESC_LEN); >=20 > - CopyMem (String0Desc, mString0Desc, STRING0_DESC_LEN); >=20 > - DebugCapabilityContext->DbcInfoContext.String0DescAddress =3D (UINT64)= (UINTN)String0Desc; >=20 > - >=20 > - ManufacturerStrDesc =3D String0Desc + STRING0_DESC_LEN; >=20 > - CopyMem (ManufacturerStrDesc, mManufacturerStrDesc, MANU_DESC_LEN); >=20 > - DebugCapabilityContext->DbcInfoContext.ManufacturerStrDescAddress =3D = (UINT64)(UINTN)ManufacturerStrDesc; >=20 > - >=20 > - ProductStrDesc =3D ManufacturerStrDesc + MANU_DESC_LEN; >=20 > - CopyMem (ProductStrDesc, mProductStrDesc, PRODUCT_DESC_LEN); >=20 > - DebugCapabilityContext->DbcInfoContext.ProductStrDescAddress =3D (UINT= 64)(UINTN)ProductStrDesc; >=20 > - >=20 > - SerialNumberStrDesc =3D ProductStrDesc + PRODUCT_DESC_LEN; >=20 > - CopyMem (SerialNumberStrDesc, mSerialNumberStrDesc, SERIAL_DESC_LEN); >=20 > - DebugCapabilityContext->DbcInfoContext.SerialNumberStrDescAddress =3D = (UINT64)(UINTN)SerialNumberStrDesc; >=20 > - >=20 > - // >=20 > - // Allocate and initialize the Transfer Ring for the Input Endpoint Co= ntext. >=20 > - // >=20 > - ZeroMem (&Xhc->TransferRingIn, sizeof (TRANSFER_RING)); >=20 > - CreateTransferRing (Xhc, TR_RING_TRB_NUMBER, &Xhc->TransferRingIn); >=20 > - >=20 > - // >=20 > - // Can not set BIT0, otherwise there is no transfer ring detected. >=20 > - // >=20 > - DebugCapabilityContext->EpInContext.PtrLo =3D XHC_LOW_32BIT (Xhc->Tran= sferRingIn.RingSeg0) | BIT0; >=20 > - DebugCapabilityContext->EpInContext.PtrHi =3D XHC_HIGH_32BIT (Xhc->Tra= nsferRingIn.RingSeg0); >=20 > - >=20 > - // >=20 > - // Allocate and initialize the Transfer Ring for the Output Endpoint C= ontext. >=20 > - // >=20 > - ZeroMem (&Xhc->TransferRingOut, sizeof (TRANSFER_RING)); >=20 > - CreateTransferRing (Xhc, TR_RING_TRB_NUMBER, &Xhc->TransferRingOut); >=20 > - >=20 > - // >=20 > - // Can not set BIT0, otherwise there is no transfer ring detected. >=20 > - // >=20 > - DebugCapabilityContext->EpOutContext.PtrLo =3D XHC_LOW_32BIT (Xhc->Tra= nsferRingOut.RingSeg0) | BIT0; >=20 > - DebugCapabilityContext->EpOutContext.PtrHi =3D XHC_HIGH_32BIT (Xhc->Tr= ansferRingOut.RingSeg0); >=20 > - >=20 > - // >=20 > - // Program the Debug Capability Context Pointer (DCCP) register(7.6.8.= 7) >=20 > - // >=20 > - XhcWriteDebugReg ( >=20 > - Xhc, >=20 > - XHC_DC_DCCP, >=20 > - XHC_LOW_32BIT((UINT64)(UINTN)DebugCapabilityContext) >=20 > - ); >=20 > - XhcWriteDebugReg ( >=20 > - Xhc, >=20 > - XHC_DC_DCCP + 4, >=20 > - XHC_HIGH_32BIT((UINT64)(UINTN)DebugCapabilityContext) >=20 > - ); >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Initialize the USB3 debug Device hardware. >=20 > - >=20 > - @param[in] Instance Pointer to USB3 debug port object instance. >=20 > - >=20 > - @retval RETURN_SUCCESS The USB3 debug device was initialized succes= sfully. >=20 > - @retval !RETURN_SUCCESS Error. >=20 > - >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -InitializeUsb3DebugPort ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Instance >=20 > - ) >=20 > -{ >=20 > - RETURN_STATUS Status; >=20 > - UINT64 XhciOpRegister; >=20 > - volatile UINT32 Dcctrl; >=20 > - UINT8 Bus; >=20 > - UINT8 Device; >=20 > - UINT8 Function; >=20 > - UINT16 Command; >=20 > - EFI_BOOT_MODE BootMode; >=20 > - UINT64 TimeOut; >=20 > - CHAR8 *TestString; >=20 > - UINTN Length; >=20 > - UINT32 TransferResult; >=20 > - >=20 > - Bus =3D Instance->PciBusNumber; >=20 > - Device =3D Instance->PciDeviceNumber; >=20 > - Function =3D Instance->PciFunctionNumber; >=20 > - >=20 > - Command =3D GetXhciPciCommand (); >=20 > - >=20 > - // >=20 > - // Save and set Command Register >=20 > - // >=20 > - if (((Command & EFI_PCI_COMMAND_MEMORY_SPACE) =3D=3D 0) || ((Command &= EFI_PCI_COMMAND_BUS_MASTER) =3D=3D 0)) > { >=20 > - PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET= ), Command | > EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER); >=20 > - PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET)= ); >=20 > - } >=20 > - >=20 > - // >=20 > - // Clear DCE bit and LSE bit in DCCTRL >=20 > - // >=20 > - if ((XhcReadDebugReg (Instance, XHC_DC_DCCTRL) & (BIT1|BIT31)) =3D=3D = (BIT1|BIT31)) { >=20 > - XhcClearDebugRegBit (Instance, XHC_DC_DCCTRL, BIT1|BIT31); >=20 > - } >=20 > - >=20 > - XhciOpRegister =3D Instance->XhciOpRegister; >=20 > - >=20 > - // >=20 > - // Get current Boot Mode >=20 > - // >=20 > - BootMode =3D GetBootModeHob (); >=20 > - >=20 > - if (BootMode !=3D BOOT_ON_S3_RESUME) { >=20 > - if (!XhcIsBitSet((UINTN)(XhciOpRegister + XHC_USBSTS_OFFSET), XHC_US= BSTS_HALT)) { >=20 > - XhcClrR32Bit((UINTN) XhciOpRegister + XHC_USBCMD_OFFSET, XHC_USBCM= D_RUN); >=20 > - while (!XhcIsBitSet((UINTN)(XhciOpRegister + XHC_USBSTS_OFFSET), X= HC_USBSTS_HALT)) { >=20 > - MicroSecondDelay (10); >=20 > - } >=20 > - } >=20 > - >=20 > - // >=20 > - // Reset host controller >=20 > - // >=20 > - XhcSetR32Bit((UINTN)XhciOpRegister + XHC_USBCMD_OFFSET, XHC_USBCMD_R= ESET); >=20 > - >=20 > - // >=20 > - // Ensure that the host controller is reset (RESET bit must be clear= ed after reset) >=20 > - // >=20 > - while (XhcIsBitSet((UINTN)XhciOpRegister + XHC_USBCMD_OFFSET, XHC_US= BCMD_RESET)) { >=20 > - MicroSecondDelay (10); >=20 > - } >=20 > - } >=20 > - >=20 > - // >=20 > - // Initialize event ring >=20 > - // >=20 > - ZeroMem (&Instance->EventRing, sizeof (EVENT_RING)); >=20 > - Status =3D CreateEventRing (Instance, &Instance->EventRing); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - // >=20 > - // Init IN and OUT endpoint context >=20 > - // >=20 > - Status =3D CreateDebugCapabilityContext (Instance); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - // >=20 > - // Init data buffer used to transfer >=20 > - // >=20 > - Instance->Urb.Data =3D (EFI_PHYSICAL_ADDRESS) (UINTN) AllocateAlignBuf= fer (XHC_DEBUG_PORT_DATA_LENGTH); >=20 > - >=20 > - // >=20 > - // Init DCDDI1 and DCDDI2 >=20 > - // >=20 > - XhcWriteDebugReg ( >=20 > - Instance, >=20 > - XHC_DC_DCDDI1, >=20 > - (UINT32)((XHCI_DEBUG_DEVICE_VENDOR_ID << 16) | XHCI_DEBUG_DEVICE_PROT= OCOL) >=20 > - ); >=20 > - >=20 > - XhcWriteDebugReg ( >=20 > - Instance, >=20 > - XHC_DC_DCDDI2, >=20 > - (UINT32)((XHCI_DEBUG_DEVICE_REVISION << 16) | XHCI_DEBUG_DEVICE_PRODU= CT_ID) >=20 > - ); >=20 > - >=20 > - // >=20 > - // Set DCE bit and LSE bit to "1" in DCCTRL >=20 > - // >=20 > - XhcSetDebugRegBit (Instance, XHC_DC_DCCTRL, BIT1|BIT31); >=20 > - >=20 > - TimeOut =3D DivU64x32 (PcdGet64 (PcdXhciHostWaitTimeout), XHC_POLL_DEL= AY) + 1; >=20 > - while (TimeOut !=3D 0) { >=20 > - // >=20 > - // Check if debug device is in configured state >=20 > - // >=20 > - Dcctrl =3D XhcReadDebugReg (Instance, XHC_DC_DCCTRL); >=20 > - if ((Dcctrl & BIT0) !=3D 0) { >=20 > - // >=20 > - // Set the flag to indicate debug device is ready >=20 > - // >=20 > - Instance->Ready =3D TRUE; >=20 > - break; >=20 > - } >=20 > - MicroSecondDelay (XHC_POLL_DELAY); >=20 > - TimeOut--; >=20 > - } >=20 > - >=20 > - if (!Instance->Ready) { >=20 > - XhcClearDebugRegBit (Instance, XHC_DC_DCCTRL, BIT1|BIT31); >=20 > - } else { >=20 > - TestString =3D "Usb 3.0 Debug Message Start\n"; >=20 > - Length =3D AsciiStrLen (TestString); >=20 > - XhcDataTransfer ( >=20 > - Instance, >=20 > - EfiUsbDataOut, >=20 > - TestString, >=20 > - &Length, >=20 > - 0, >=20 > - &TransferResult >=20 > - ); >=20 > - } >=20 > - >=20 > - // >=20 > - // Restore Command Register >=20 > - // >=20 > - PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET= ), Command); >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Update XHC hardware address when MMIO base is changed. >=20 > - >=20 > - @param Instance The XHCI Instance. >=20 > - @param XhcMmioBase XHCI MMIO base address. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -FixUsb3InstanceResource ( >=20 > - IN OUT USB3_DEBUG_PORT_INSTANCE *Instance, >=20 > - IN EFI_PHYSICAL_ADDRESS XhcMmioBase >=20 > - ) >=20 > -{ >=20 > - if ((Instance =3D=3D NULL) || (Instance->XhcMmioBase =3D=3D XhcMmioBas= e)) { >=20 > - return; >=20 > - } >=20 > - >=20 > - // >=20 > - // Need fix Instance data according to PCI resource >=20 > - // >=20 > - Instance->XhcMmioBase =3D XhcMmioBase; >=20 > - Instance->DebugCapabilityBase =3D XhcMmioBase + Instance->DebugCapabil= ityOffset; >=20 > - Instance->XhciOpRegister =3D XhcMmioBase + MmioRead8 ((UINTN)XhcM= mioBase); >=20 > -} >=20 > - >=20 > -/** >=20 > - Save USB3 instance address. >=20 > - >=20 > - @param[in] Instance The XHCI Instance. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -SaveUsb3InstanceAddress ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Instance >=20 > - ) >=20 > -{ >=20 > - UINT16 Command; >=20 > - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; >=20 > - UINT8 Bus; >=20 > - UINT8 Device; >=20 > - UINT8 Function; >=20 > - >=20 > - Command =3D GetXhciPciCommand (); >=20 > - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); >=20 > - Bus =3D UsbDebugPort.PciAddress.Bus; >=20 > - Device =3D UsbDebugPort.PciAddress.Device; >=20 > - Function =3D UsbDebugPort.PciAddress.Function; >=20 > - >=20 > - // >=20 > - // Set Command Register >=20 > - // >=20 > - if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) =3D=3D 0) { >=20 > - PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET= ), Command | > EFI_PCI_COMMAND_MEMORY_SPACE); >=20 > - PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET)= ); >=20 > - } >=20 > - >=20 > - // >=20 > - // After debug device is finished to enumerate, use DCDDI2 register to= store instance address >=20 > - // >=20 > - XhcWriteDebugReg ( >=20 > - Instance, >=20 > - XHC_DC_DCDDI2, >=20 > - (UINT32)(UINTN)Instance >=20 > - ); >=20 > - >=20 > - // >=20 > - // Restore Command Register >=20 > - // >=20 > - PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET= ), Command); >=20 > -} >=20 > - >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3= DebugPortLibDxe.c > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLi= bDxe.c > deleted file mode 100644 > index 8c3dd999db..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPo= rtLibDxe.c > +++ /dev/null > @@ -1,454 +0,0 @@ > -/** @file >=20 > - Usb3 Debug Port library instance >=20 > - >=20 > - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include "Usb3DebugPortLibInternal.h" >=20 > - >=20 > -extern EFI_SMRAM_DESCRIPTOR mSmramCheckRanges[MAX_SMRAM_RANGE]; >=20 > -extern UINTN mSmramCheckRangeCount; >=20 > -extern BOOLEAN mUsb3InSmm; >=20 > -extern UINT64 mUsb3MmioSize; >=20 > -extern BOOLEAN mUsb3GetCapSuccess; >=20 > - >=20 > -GUID gUsb3DbgGuid =3D USB3_DBG_GUID; >=20 > - >=20 > -USB3_DEBUG_PORT_CONTROLLER mUsb3DebugPort; >=20 > -USB3_DEBUG_PORT_INSTANCE *mUsb3Instance =3D NULL; >=20 > - >=20 > -/** >=20 > - Return XHCI MMIO base address. >=20 > - >=20 > -**/ >=20 > -EFI_PHYSICAL_ADDRESS >=20 > -GetXhciBaseAddress ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - UINT8 Bus; >=20 > - UINT8 Device; >=20 > - UINT8 Function; >=20 > - EFI_PHYSICAL_ADDRESS Address; >=20 > - UINT32 Low; >=20 > - UINT32 High; >=20 > - >=20 > - if (mUsb3DebugPort.Controller =3D=3D 0) { >=20 > - mUsb3DebugPort.Controller =3D GetUsb3DebugPortController(); >=20 > - } >=20 > - >=20 > - Bus =3D mUsb3DebugPort.PciAddress.Bus; >=20 > - Device =3D mUsb3DebugPort.PciAddress.Device; >=20 > - Function =3D mUsb3DebugPort.PciAddress.Function; >=20 > - >=20 > - Low =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADD= RESSREG_OFFSET)); >=20 > - High =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_AD= DRESSREG_OFFSET + 4)); >=20 > - Address =3D (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Lo= w); >=20 > - // >=20 > - // Mask other parts which are not part of base address >=20 > - // >=20 > - Address &=3D XHCI_BASE_ADDRESS_64_BIT_MASK; >=20 > - return Address; >=20 > -} >=20 > - >=20 > -/** >=20 > - Return XHCI debug instance address. >=20 > - >=20 > -**/ >=20 > -USB3_DEBUG_PORT_INSTANCE * >=20 > -GetUsb3DebugPortInstance ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - USB3_DEBUG_PORT_INSTANCE *Instance; >=20 > - EFI_PHYSICAL_ADDRESS XhcMmioBase; >=20 > - UINT64 CapabilityPointer; >=20 > - UINT32 Capability; >=20 > - BOOLEAN Flag; >=20 > - UINT8 Bus; >=20 > - UINT8 Device; >=20 > - UINT8 Function; >=20 > - UINT16 Command; >=20 > - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; >=20 > - >=20 > - Instance =3D NULL; >=20 > - >=20 > - XhcMmioBase =3D GetXhciBaseAddress (); >=20 > - >=20 > - if ((XhcMmioBase =3D=3D 0) || (XhcMmioBase =3D=3D XHCI_BASE_ADDRESS_64= _BIT_MASK)) { >=20 > - return NULL; >=20 > - } >=20 > - >=20 > - if (mUsb3Instance !=3D NULL) { >=20 > - FixUsb3InstanceResource (mUsb3Instance, XhcMmioBase); >=20 > - return mUsb3Instance; >=20 > - } >=20 > - >=20 > - Command =3D GetXhciPciCommand (); >=20 > - >=20 > - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); >=20 > - Bus =3D UsbDebugPort.PciAddress.Bus; >=20 > - Device =3D UsbDebugPort.PciAddress.Device; >=20 > - Function =3D UsbDebugPort.PciAddress.Function; >=20 > - >=20 > - // >=20 > - // Set Command Register >=20 > - // >=20 > - if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) =3D=3D 0) { >=20 > - PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET= ), Command | > EFI_PCI_COMMAND_MEMORY_SPACE); >=20 > - PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET)= ); >=20 > - } >=20 > - >=20 > - // >=20 > - // Calculate capability offset from HCCPARAMS [16:31], in 32-bit words >=20 > - // >=20 > - CapabilityPointer =3D XhcMmioBase + (MmioRead32 ((UINTN)(XhcMmioBase += XHC_HCCPARAMS_OFFSET)) >> 16) * 4; >=20 > - >=20 > - // >=20 > - // Search XHCI debug capability >=20 > - // >=20 > - Flag =3D FALSE; >=20 > - Capability =3D MmioRead32 ((UINTN)CapabilityPointer); >=20 > - while (TRUE) { >=20 > - if ((Capability & XHC_CAPABILITY_ID_MASK) =3D=3D PCI_CAPABILITY_ID_D= EBUG_PORT) { >=20 > - Flag =3D TRUE; >=20 > - break; >=20 > - } >=20 > - if ((((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) & XHC_CAPABILITY= _ID_MASK) =3D=3D 0) { >=20 > - // >=20 > - // Reach the end of list, quit >=20 > - // >=20 > - break; >=20 > - } >=20 > - CapabilityPointer +=3D ((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8= ) * 4; >=20 > - Capability =3D MmioRead32 ((UINTN)CapabilityPointer); >=20 > - } >=20 > - >=20 > - if (Flag) { >=20 > - Instance =3D (USB3_DEBUG_PORT_INSTANCE *)(UINTN) MmioRead32 ((UINTN)= (CapabilityPointer + XHC_DC_DCDDI2)); >=20 > - >=20 > - if (Instance !=3D NULL) { >=20 > - FixUsb3InstanceResource (Instance, XhcMmioBase); >=20 > - } >=20 > - } >=20 > - >=20 > - // >=20 > - // Restore Command Register >=20 > - // >=20 > - PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET)= , Command); >=20 > - >=20 > - return Instance; >=20 > -} >=20 > - >=20 > - >=20 > -/** >=20 > - Initialize USB3 debug port. >=20 > - >=20 > - This method invokes various internal functions to facilitate >=20 > - detection and initialization of USB3 debug port. >=20 > - >=20 > - @retval RETURN_SUCCESS The USB3 debug port was initialized. >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -EFIAPI >=20 > -USB3Initialize ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - // >=20 > - // Leave it empty, we assume PEI phase already do initialization >=20 > - // >=20 > - return RETURN_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Initialize USB3 debug port. >=20 > - >=20 > - This method invokes various internal functions to facilitate >=20 > - detection and initialization of USB3 debug port. >=20 > - >=20 > - @retval RETURN_SUCCESS The serial device was initialized. >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -EFIAPI >=20 > -USB3InitializeReal ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - USB3_DEBUG_PORT_INSTANCE UsbDbg; >=20 > - USB3_DEBUG_PORT_INSTANCE *Instance; >=20 > - EFI_PHYSICAL_ADDRESS Address; >=20 > - EFI_STATUS Status; >=20 > - >=20 > - if ((gST =3D=3D NULL) || (gBS =3D=3D NULL)) { >=20 > - // >=20 > - // gST and gBS have not been initialized yet >=20 > - // >=20 > - return EFI_DEVICE_ERROR; >=20 > - } >=20 > - >=20 > - Status =3D EfiGetSystemConfigurationTable (&gUsb3DbgGuid, (VOID **) &m= Usb3Instance); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - return RETURN_SUCCESS; >=20 > - } >=20 > - >=20 > - // >=20 > - // It is first time to run DXE instance, copy Instance from Hob to ACP= INvs >=20 > - // NOTE: Hob is not ready at this time, so copy it from XHCI register. >=20 > - // >=20 > - Instance =3D GetUsb3DebugPortInstance (); >=20 > - if (Instance =3D=3D NULL) { >=20 > - // >=20 > - // Initialize USB debug >=20 > - // >=20 > - SetMem (&UsbDbg, sizeof(UsbDbg), 0); >=20 > - DiscoverUsb3DebugPort (&UsbDbg); >=20 > - if (UsbDbg.DebugSupport) { >=20 > - InitializeUsb3DebugPort (&UsbDbg); >=20 > - } >=20 > - Instance =3D &UsbDbg; >=20 > - } >=20 > - Address =3D SIZE_4GB; >=20 > - Status =3D gBS->AllocatePages ( >=20 > - AllocateMaxAddress, >=20 > - EfiACPIMemoryNVS, >=20 > - EFI_SIZE_TO_PAGES (sizeof (USB3_DEBUG_PORT_INSTANCE)), >=20 > - &Address >=20 > - ); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - >=20 > - CopyMem ( >=20 > - (VOID *)(UINTN)Address, >=20 > - Instance, >=20 > - sizeof (USB3_DEBUG_PORT_INSTANCE) >=20 > - ); >=20 > - mUsb3Instance =3D (USB3_DEBUG_PORT_INSTANCE *)(UINTN)Address; >=20 > - >=20 > - Status =3D gBS->InstallConfigurationTable (&gUsb3DbgGuid, mUsb3Instanc= e); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - >=20 > - if (mUsb3Instance->DebugSupport) { >=20 > - SaveUsb3InstanceAddress (mUsb3Instance); >=20 > - } >=20 > - >=20 > - return RETURN_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Calculate the size of XHCI MMIO space. >=20 > - >=20 > - @retval TURE The XHCI MMIO is in SMRAM ranges. >=20 > - @retval FALSE The XHCI MMIO is out of SMRAM ranges. >=20 > -**/ >=20 > -UINT64 >=20 > -CalculateMmioSize ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - UINT8 Bus; >=20 > - UINT8 Device; >=20 > - UINT8 Function; >=20 > - UINT32 Value; >=20 > - UINT32 Mask; >=20 > - UINT64 MmioSize; >=20 > - UINT16 Command; >=20 > - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; >=20 > - EFI_PHYSICAL_ADDRESS XhcMmioBase; >=20 > - >=20 > - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); >=20 > - Bus =3D UsbDebugPort.PciAddress.Bus; >=20 > - Device =3D UsbDebugPort.PciAddress.Device; >=20 > - Function =3D UsbDebugPort.PciAddress.Function; >=20 > - >=20 > - Mask =3D 0xFFFFFFF0; >=20 > - MmioSize =3D 0; >=20 > - >=20 > - XhcMmioBase =3D GetXhciBaseAddress (); >=20 > - >=20 > - // >=20 > - // Disable MSE >=20 > - // >=20 > - Command =3D PciRead16 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMM= AND_OFFSET)); >=20 > - PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET= ), Command & > ~(EFI_PCI_COMMAND_MEMORY_SPACE)); >=20 > - >=20 > - // >=20 > - // Get Mmio Size >=20 > - // >=20 > - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG= _OFFSET), 0xFFFFFFFF); >=20 > - Value =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BAS= E_ADDRESSREG_OFFSET)); >=20 > - >=20 > - switch (Value & 0x07) { >=20 > - case 0x0: >=20 > - // >=20 > - // Memory space: anywhere in 32 bit address space >=20 > - // >=20 > - MmioSize =3D (~(Value & Mask)) + 1; >=20 > - break; >=20 > - case 0x4: >=20 > - // >=20 > - // Memory space: anywhere in 64 bit address space >=20 > - // >=20 > - MmioSize =3D Value & Mask; >=20 > - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRES= SREG_OFFSET + 4), 0xFFFFFFFF); >=20 > - Value =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI= _BASE_ADDRESSREG_OFFSET + 4)); >=20 > - // >=20 > - // Fix the length to support some spefic 64 bit BAR >=20 > - // >=20 > - Value |=3D ((UINT32)(-1) << HighBitSet32 (Value)); >=20 > - // >=20 > - // Calculate the size of 64bit bar >=20 > - // >=20 > - MmioSize |=3D LShiftU64 ((UINT64) Value, 32); >=20 > - MmioSize =3D (~(MmioSize)) + 1; >=20 > - break; >=20 > - default: >=20 > - // >=20 > - // Unknown BAR type >=20 > - // >=20 > - MmioSize =3D (~(Value & Mask)) + 1; >=20 > - break; >=20 > - }; >=20 > - >=20 > - >=20 > - // >=20 > - // Restore MMIO address >=20 > - // >=20 > - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG= _OFFSET), (UINT32)XhcMmioBase); >=20 > - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG= _OFFSET + 4), (UINT32) (XhcMmioBase >> 32)); >=20 > - >=20 > - PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET= ), Command | > EFI_PCI_COMMAND_MEMORY_SPACE); >=20 > - >=20 > - return MmioSize; >=20 > -} >=20 > - >=20 > -/** >=20 > - The constructor function initialize USB3 debug port. >=20 > - >=20 > - @param ImageHandle The firmware allocated handle for the EFI image. >=20 > - @param SystemTable A pointer to the EFI System Table. >=20 > - >=20 > - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -Usb3DebugPortLibDxeConstructor ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -{ >=20 > - EFI_SMM_BASE2_PROTOCOL *SmmBase; >=20 > - EFI_SMM_ACCESS2_PROTOCOL *SmmAccess; >=20 > - UINTN Size; >=20 > - EFI_STATUS Status; >=20 > - >=20 > - // >=20 > - // Do real initialization here, because we need copy data from Hob to = ACPINvs. >=20 > - // We must do it in constructor because it depends on UefiBootServices= TableLib. >=20 > - // >=20 > - if (FeaturePcdGet (PcdStatusCodeUseUsb3Serial)) { >=20 > - USB3InitializeReal (); >=20 > - } >=20 > - >=20 > - mUsb3MmioSize =3D CalculateMmioSize (); >=20 > - >=20 > - if (gBS !=3D NULL) { >=20 > - SmmBase =3D NULL; >=20 > - Status =3D gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VO= ID **)&SmmBase); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - SmmBase->InSmm(SmmBase, &mUsb3InSmm); >=20 > - } >=20 > - >=20 > - if (mUsb3InSmm) { >=20 > - // >=20 > - // Get SMRAM information >=20 > - // >=20 > - SmmAccess =3D NULL; >=20 > - Status =3D gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL,= (VOID **)&SmmAccess); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - Size =3D sizeof (mSmramCheckRanges); >=20 > - >=20 > - Status =3D SmmAccess->GetCapabilities (SmmAccess, &Size, mSmramC= heckRanges); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - mSmramCheckRangeCount =3D Size / sizeof (EFI_SMRAM_DESCRIPTOR)= ; >=20 > - } >=20 > - } >=20 > - } >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Allocate aligned memory for XHC's usage. >=20 > - >=20 > - @param BufferSize The size, in bytes, of the Buffer. >=20 > - >=20 > - @return A pointer to the allocated buffer or NULL if allocation fails. >=20 > - >=20 > -**/ >=20 > -VOID* >=20 > -AllocateAlignBuffer ( >=20 > - IN UINTN BufferSize >=20 > - ) >=20 > -{ >=20 > - VOID *Buf; >=20 > - EFI_PHYSICAL_ADDRESS Address; >=20 > - EFI_STATUS Status; >=20 > - >=20 > - Buf =3D NULL; >=20 > - >=20 > - if (gBS !=3D NULL) { >=20 > - Address =3D 0xFFFFFFFF; >=20 > - Status =3D gBS->AllocatePages ( >=20 > - AllocateMaxAddress, >=20 > - EfiACPIMemoryNVS, >=20 > - EFI_SIZE_TO_PAGES (BufferSize), >=20 > - &Address >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - Buf =3D (VOID *)(UINTN)Address; >=20 > - } >=20 > - } >=20 > - >=20 > - return Buf; >=20 > -} >=20 > - >=20 > -/** >=20 > - Check whether AllocatePages in permanent memory is ready. >=20 > - >=20 > - @retval TRUE AllocatePages in permanent memory is ready. >=20 > - @retval FALSE AllocatePages in permanent memory is not ready. >=20 > - >=20 > -**/ >=20 > -BOOLEAN >=20 > -IsAllocatePagesReady ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - if (gBS !=3D NULL) { >=20 > - return TRUE; >=20 > - } >=20 > - >=20 > - return FALSE; >=20 > -} >=20 > - >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3= DebugPortLibDxe.inf > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLi= bDxe.inf > deleted file mode 100644 > index e238fa0de9..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPo= rtLibDxe.inf > +++ /dev/null > @@ -1,55 +0,0 @@ > -## @file >=20 > -# Usb3 debug port library. >=20 > -# >=20 > -# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D Usb3DebugPortLibDxe >=20 > - FILE_GUID =3D 08A575C4-D962-4ca5-8855-D3B4AE93A14= 1 >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D Usb3DebugPortLib|DXE_CORE DXE_DRIVE= R DXE_RUNTIME_DRIVER DXE_SAL_DRIVER > DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE >=20 > - CONSTRUCTOR =3D Usb3DebugPortLibDxeConstructor >=20 > - >=20 > -# >=20 > -# The following information is for reference only and not required by th= e build tools. >=20 > -# >=20 > -# VALID_ARCHITECTURES =3D IA32 X64 IPF >=20 > -# >=20 > - >=20 > -[Sources] >=20 > - Usb3DebugPortLibDxe.c >=20 > - Usb3DebugPortDataTransfer.c >=20 > - Usb3DebugPortInitialize.c >=20 > - MiscServices.c >=20 > - Usb3DebugPortLibInternal.h >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - DebugFeaturePkg/DebugFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - BaseLib >=20 > - PcdLib >=20 > - IoLib >=20 > - PciLib >=20 > - TimerLib >=20 > - UefiBootServicesTableLib >=20 > - UefiLib >=20 > - HobLib >=20 > - Usb3DebugPortParameterLib >=20 > - >=20 > -[Protocols] >=20 > - gEfiSmmAccess2ProtocolGuid ## CONSUMES >=20 > - gEfiSmmBase2ProtocolGuid ## CONSUMES >=20 > - >=20 > -[Pcd] >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOMETI= MES_CONSUMES >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONSUM= ES >=20 > - >=20 > -[FeaturePcd] >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseUsb3Serial ## CONSUM= ES >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3= DebugPortLibDxeIoMmu.c > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLi= bDxeIoMmu.c > deleted file mode 100644 > index 97c3f88113..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPo= rtLibDxeIoMmu.c > +++ /dev/null > @@ -1,828 +0,0 @@ > -/** @file >=20 > - Usb3 Debug Port library instance >=20 > - >=20 > - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include "Usb3DebugPortLibInternal.h" >=20 > - >=20 > -extern EFI_SMRAM_DESCRIPTOR mSmramCheckRanges[MAX_SMRAM_RANGE]; >=20 > -extern UINTN mSmramCheckRangeCount; >=20 > -extern BOOLEAN mUsb3InSmm; >=20 > -extern UINT64 mUsb3MmioSize; >=20 > -extern BOOLEAN mUsb3GetCapSuccess; >=20 > - >=20 > -GUID gUsb3DbgGuid =3D USB3_DBG_GUID; >=20 > - >=20 > -USB3_DEBUG_PORT_CONTROLLER mUsb3DebugPort; >=20 > -USB3_DEBUG_PORT_INSTANCE *mUsb3Instance =3D NULL; >=20 > -EFI_PCI_IO_PROTOCOL *mUsb3PciIo =3D NULL; >=20 > - >=20 > -/** >=20 > - Creates a named event that can be signaled. >=20 > - >=20 > - This function creates an event using NotifyTpl, NoifyFunction. >=20 > - If Name is NULL, then ASSERT(). >=20 > - If NotifyTpl is not a legal TPL value, then ASSERT(). >=20 > - If NotifyFunction is NULL, then ASSERT(). >=20 > - >=20 > - @param Name Supplies the GUID name of the event. >=20 > - @param NotifyTpl Supplies the task priority level of the = event notifications. >=20 > - @param NotifyFunction Supplies the function to notify when the= event is signaled. >=20 > - @param Event A pointer to the event created. >=20 > - >=20 > - @retval EFI_SUCCESS A named event was created. >=20 > - @retval EFI_OUT_OF_RESOURCES There are not enough resource to create = the named event. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -Usb3NamedEventListen ( >=20 > - IN CONST EFI_GUID *Name, >=20 > - IN EFI_TPL NotifyTpl, >=20 > - IN EFI_EVENT_NOTIFY NotifyFunction, >=20 > - IN EFI_EVENT *Event >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - VOID *RegistrationLocal; >=20 > - >=20 > - ASSERT (Name !=3D NULL); >=20 > - ASSERT (NotifyFunction !=3D NULL); >=20 > - ASSERT (NotifyTpl <=3D TPL_HIGH_LEVEL); >=20 > - >=20 > - // >=20 > - // Create event >=20 > - // >=20 > - Status =3D gBS->CreateEvent ( >=20 > - EVT_NOTIFY_SIGNAL, >=20 > - NotifyTpl, >=20 > - NotifyFunction, >=20 > - NULL, >=20 > - Event >=20 > - ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - // >=20 > - // Register for an installation of protocol interface >=20 > - // >=20 > - Status =3D gBS->RegisterProtocolNotify ( >=20 > - (EFI_GUID *) Name, >=20 > - *Event, >=20 > - &RegistrationLocal >=20 > - ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - USB3 map one DMA buffer. >=20 > - >=20 > - @param PciIo Pointer to PciIo for USB3 debug port. >=20 > - @param Address DMA buffer address to be mapped. >=20 > - @param NumberOfBytes Number of bytes to be mapped. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -Usb3MapOneDmaBuffer ( >=20 > - IN EFI_PCI_IO_PROTOCOL *PciIo, >=20 > - IN EFI_PHYSICAL_ADDRESS Address, >=20 > - IN UINTN NumberOfBytes >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - VOID *HostAddress; >=20 > - EFI_PHYSICAL_ADDRESS DeviceAddress; >=20 > - VOID *Mapping; >=20 > - >=20 > - HostAddress =3D (VOID *) (UINTN) Address; >=20 > - Status =3D PciIo->Map ( >=20 > - PciIo, >=20 > - EfiPciIoOperationBusMasterCommonBuffer, >=20 > - HostAddress, >=20 > - &NumberOfBytes, >=20 > - &DeviceAddress, >=20 > - &Mapping >=20 > - ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - ASSERT (DeviceAddress =3D=3D ((EFI_PHYSICAL_ADDRESS) (UINTN) HostAddre= ss)); >=20 > -} >=20 > - >=20 > -/** >=20 > - USB3 map DMA buffers. >=20 > - >=20 > - @param Instance Pointer to USB3 debug port instance. >=20 > - @param PciIo Pointer to PciIo for USB3 debug port. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -Usb3MapDmaBuffers ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Instance, >=20 > - IN EFI_PCI_IO_PROTOCOL *PciIo >=20 > - ) >=20 > -{ >=20 > - Usb3MapOneDmaBuffer ( >=20 > - PciIo, >=20 > - Instance->Urb.Data, >=20 > - XHC_DEBUG_PORT_DATA_LENGTH >=20 > - ); >=20 > - >=20 > - Usb3MapOneDmaBuffer ( >=20 > - PciIo, >=20 > - Instance->TransferRingIn.RingSeg0, >=20 > - sizeof (TRB_TEMPLATE) * TR_RING_TRB_NUMBER >=20 > - ); >=20 > - >=20 > - Usb3MapOneDmaBuffer ( >=20 > - PciIo, >=20 > - Instance->TransferRingOut.RingSeg0, >=20 > - sizeof (TRB_TEMPLATE) * TR_RING_TRB_NUMBER >=20 > - ); >=20 > - >=20 > - Usb3MapOneDmaBuffer ( >=20 > - PciIo, >=20 > - Instance->EventRing.EventRingSeg0, >=20 > - sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMBER >=20 > - ); >=20 > - >=20 > - Usb3MapOneDmaBuffer ( >=20 > - PciIo, >=20 > - Instance->EventRing.ERSTBase, >=20 > - sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERST_NUMBER >=20 > - ); >=20 > - >=20 > - Usb3MapOneDmaBuffer ( >=20 > - PciIo, >=20 > - Instance->DebugCapabilityContext, >=20 > - sizeof (XHC_DC_CONTEXT) >=20 > - ); >=20 > - >=20 > - Usb3MapOneDmaBuffer ( >=20 > - PciIo, >=20 > - ((XHC_DC_CONTEXT *) (UINTN) Instance->DebugCapabilityContext)->DbcIn= foContext.String0DescAddress, >=20 > - STRING0_DESC_LEN + MANU_DESC_LEN + PRODUCT_DESC_LEN + SERIAL_DESC_LE= N >=20 > - ); >=20 > -} >=20 > - >=20 > -/** >=20 > - Invoke a notification event >=20 > - >=20 > - @param[in] Event Event whose notification function is= being invoked. >=20 > - @param[in] Context The pointer to the notification func= tion's context, >=20 > - which is implementation-dependent. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -EFIAPI >=20 > -Usb3DxeSmmReadyToLockNotify ( >=20 > - IN EFI_EVENT Event, >=20 > - IN VOID *Context >=20 > - ) >=20 > -{ >=20 > - ASSERT (mUsb3Instance !=3D NULL); >=20 > - >=20 > - // >=20 > - // For the case that the USB3 debug port instance and DMA buffers are >=20 > - // from PEI HOB with IOMMU enabled. >=20 > - // Reinitialize USB3 debug port with granted DXE DMA buffer accessible >=20 > - // by SMM environment. >=20 > - // >=20 > - InitializeUsb3DebugPort (mUsb3Instance); >=20 > - >=20 > - SaveUsb3InstanceAddress (mUsb3Instance); >=20 > - >=20 > - gBS->CloseEvent (Event); >=20 > -} >=20 > - >=20 > -/** >=20 > - USB3 get IOMMU protocol. >=20 > - >=20 > - @return Pointer to IOMMU protocol. >=20 > - >=20 > -**/ >=20 > -EDKII_IOMMU_PROTOCOL * >=20 > -Usb3GetIoMmu ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - EDKII_IOMMU_PROTOCOL *IoMmu; >=20 > - >=20 > - IoMmu =3D NULL; >=20 > - Status =3D gBS->LocateProtocol ( >=20 > - &gEdkiiIoMmuProtocolGuid, >=20 > - NULL, >=20 > - (VOID **) &IoMmu >=20 > - ); >=20 > - if (!EFI_ERROR (Status) && (IoMmu !=3D NULL)) { >=20 > - return IoMmu; >=20 > - } >=20 > - >=20 > - return NULL; >=20 > -} >=20 > - >=20 > -/** >=20 > - Invoke a notification event >=20 > - >=20 > - @param[in] Event Event whose notification function is= being invoked. >=20 > - @param[in] Context The pointer to the notification func= tion's context, >=20 > - which is implementation-dependent. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -EFIAPI >=20 > -Usb3PciIoNotify ( >=20 > - IN EFI_EVENT Event, >=20 > - IN VOID *Context >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINTN PciIoHandleCount; >=20 > - EFI_HANDLE *PciIoHandleBuffer; >=20 > - UINTN Index; >=20 > - EFI_PCI_IO_PROTOCOL *PciIo; >=20 > - UINTN PciSegment; >=20 > - UINTN PciBusNumber; >=20 > - UINTN PciDeviceNumber; >=20 > - UINTN PciFunctionNumber; >=20 > - EFI_EVENT SmmReadyToLockEvent; >=20 > - >=20 > - Status =3D gBS->LocateHandleBuffer ( >=20 > - ByProtocol, >=20 > - &gEfiPciIoProtocolGuid, >=20 > - NULL, >=20 > - &PciIoHandleCount, >=20 > - &PciIoHandleBuffer >=20 > - ); >=20 > - if (!EFI_ERROR (Status) && >=20 > - (PciIoHandleBuffer !=3D NULL) && >=20 > - (PciIoHandleCount !=3D 0)) { >=20 > - for (Index =3D 0; Index < PciIoHandleCount; Index++) { >=20 > - Status =3D gBS->HandleProtocol ( >=20 > - PciIoHandleBuffer[Index], >=20 > - &gEfiPciIoProtocolGuid, >=20 > - (VOID **) &PciIo >=20 > - ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - Status =3D PciIo->GetLocation (PciIo, &PciSegment, &PciBusNumber, = &PciDeviceNumber, &PciFunctionNumber); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - if ((PciBusNumber =3D=3D mUsb3DebugPort.PciAddress.Bus) && >=20 > - (PciDeviceNumber =3D=3D mUsb3DebugPort.PciAddress.Device) && >=20 > - (PciFunctionNumber =3D=3D mUsb3DebugPort.PciAddress.Function))= { >=20 > - // >=20 > - // Found the PciIo for USB3 debug port. >=20 > - // >=20 > - ASSERT (mUsb3Instance !=3D NULL); >=20 > - if (Usb3GetIoMmu () !=3D NULL) { >=20 > - Usb3MapDmaBuffers (mUsb3Instance, PciIo); >=20 > - >=20 > - if (mUsb3Instance->FromHob) { >=20 > - mUsb3PciIo =3D PciIo; >=20 > - Usb3NamedEventListen ( >=20 > - &gEfiDxeSmmReadyToLockProtocolGuid, >=20 > - TPL_NOTIFY, >=20 > - Usb3DxeSmmReadyToLockNotify, >=20 > - &SmmReadyToLockEvent >=20 > - ); >=20 > - } >=20 > - } >=20 > - gBS->CloseEvent (Event); >=20 > - break; >=20 > - } >=20 > - } >=20 > - >=20 > - gBS->FreePool (PciIoHandleBuffer); >=20 > - } >=20 > -} >=20 > - >=20 > -/** >=20 > - Return XHCI MMIO base address. >=20 > - >=20 > -**/ >=20 > -EFI_PHYSICAL_ADDRESS >=20 > -GetXhciBaseAddress ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - UINT8 Bus; >=20 > - UINT8 Device; >=20 > - UINT8 Function; >=20 > - EFI_PHYSICAL_ADDRESS Address; >=20 > - UINT32 Low; >=20 > - UINT32 High; >=20 > - >=20 > - if (mUsb3DebugPort.Controller =3D=3D 0) { >=20 > - mUsb3DebugPort.Controller =3D GetUsb3DebugPortController(); >=20 > - } >=20 > - >=20 > - Bus =3D mUsb3DebugPort.PciAddress.Bus; >=20 > - Device =3D mUsb3DebugPort.PciAddress.Device; >=20 > - Function =3D mUsb3DebugPort.PciAddress.Function; >=20 > - >=20 > - Low =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADD= RESSREG_OFFSET)); >=20 > - High =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_AD= DRESSREG_OFFSET + 4)); >=20 > - Address =3D (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Lo= w); >=20 > - // >=20 > - // Mask other parts which are not part of base address >=20 > - // >=20 > - Address &=3D XHCI_BASE_ADDRESS_64_BIT_MASK; >=20 > - return Address; >=20 > -} >=20 > - >=20 > -/** >=20 > - Return XHCI debug instance address. >=20 > - >=20 > -**/ >=20 > -USB3_DEBUG_PORT_INSTANCE * >=20 > -GetUsb3DebugPortInstance ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - USB3_DEBUG_PORT_INSTANCE *Instance; >=20 > - EFI_PHYSICAL_ADDRESS XhcMmioBase; >=20 > - UINT64 CapabilityPointer; >=20 > - UINT32 Capability; >=20 > - BOOLEAN Flag; >=20 > - UINT8 Bus; >=20 > - UINT8 Device; >=20 > - UINT8 Function; >=20 > - UINT16 Command; >=20 > - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; >=20 > - >=20 > - Instance =3D NULL; >=20 > - >=20 > - XhcMmioBase =3D GetXhciBaseAddress (); >=20 > - >=20 > - if ((XhcMmioBase =3D=3D 0) || (XhcMmioBase =3D=3D XHCI_BASE_ADDRESS_64= _BIT_MASK)) { >=20 > - return NULL; >=20 > - } >=20 > - >=20 > - if (mUsb3Instance !=3D NULL) { >=20 > - FixUsb3InstanceResource (mUsb3Instance, XhcMmioBase); >=20 > - return mUsb3Instance; >=20 > - } >=20 > - >=20 > - Command =3D GetXhciPciCommand (); >=20 > - >=20 > - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); >=20 > - Bus =3D UsbDebugPort.PciAddress.Bus; >=20 > - Device =3D UsbDebugPort.PciAddress.Device; >=20 > - Function =3D UsbDebugPort.PciAddress.Function; >=20 > - >=20 > - // >=20 > - // Set Command Register >=20 > - // >=20 > - if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) =3D=3D 0) { >=20 > - PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET= ), Command | > EFI_PCI_COMMAND_MEMORY_SPACE); >=20 > - PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET)= ); >=20 > - } >=20 > - >=20 > - // >=20 > - // Calculate capability offset from HCCPARAMS [16:31], in 32-bit words >=20 > - // >=20 > - CapabilityPointer =3D XhcMmioBase + (MmioRead32 ((UINTN)(XhcMmioBase += XHC_HCCPARAMS_OFFSET)) >> 16) * 4; >=20 > - >=20 > - // >=20 > - // Search XHCI debug capability >=20 > - // >=20 > - Flag =3D FALSE; >=20 > - Capability =3D MmioRead32 ((UINTN)CapabilityPointer); >=20 > - while (TRUE) { >=20 > - if ((Capability & XHC_CAPABILITY_ID_MASK) =3D=3D PCI_CAPABILITY_ID_D= EBUG_PORT) { >=20 > - Flag =3D TRUE; >=20 > - break; >=20 > - } >=20 > - if ((((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) & XHC_CAPABILITY= _ID_MASK) =3D=3D 0) { >=20 > - // >=20 > - // Reach the end of list, quit >=20 > - // >=20 > - break; >=20 > - } >=20 > - CapabilityPointer +=3D ((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8= ) * 4; >=20 > - Capability =3D MmioRead32 ((UINTN)CapabilityPointer); >=20 > - } >=20 > - >=20 > - if (Flag) { >=20 > - Instance =3D (USB3_DEBUG_PORT_INSTANCE *)(UINTN) MmioRead32 ((UINTN)= (CapabilityPointer + XHC_DC_DCDDI2)); >=20 > - >=20 > - if (Instance !=3D NULL) { >=20 > - FixUsb3InstanceResource (Instance, XhcMmioBase); >=20 > - } >=20 > - } >=20 > - >=20 > - // >=20 > - // Restore Command Register >=20 > - // >=20 > - PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET)= , Command); >=20 > - >=20 > - return Instance; >=20 > -} >=20 > - >=20 > - >=20 > -/** >=20 > - Initialize USB3 debug port. >=20 > - >=20 > - This method invokes various internal functions to facilitate >=20 > - detection and initialization of USB3 debug port. >=20 > - >=20 > - @retval RETURN_SUCCESS The USB3 debug port was initialized. >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -EFIAPI >=20 > -USB3Initialize ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - // >=20 > - // Leave it empty, we assume PEI phase already do initialization >=20 > - // >=20 > - return RETURN_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Initialize USB3 debug port. >=20 > - >=20 > - This method invokes various internal functions to facilitate >=20 > - detection and initialization of USB3 debug port. >=20 > - >=20 > - @retval RETURN_SUCCESS The serial device was initialized. >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -EFIAPI >=20 > -USB3InitializeReal ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - USB3_DEBUG_PORT_INSTANCE UsbDbg; >=20 > - USB3_DEBUG_PORT_INSTANCE *Instance; >=20 > - EFI_PHYSICAL_ADDRESS Address; >=20 > - EFI_STATUS Status; >=20 > - EFI_EVENT Event; >=20 > - >=20 > - if ((gST =3D=3D NULL) || (gBS =3D=3D NULL)) { >=20 > - // >=20 > - // gST and gBS have not been initialized yet >=20 > - // >=20 > - return EFI_DEVICE_ERROR; >=20 > - } >=20 > - >=20 > - Status =3D EfiGetSystemConfigurationTable (&gUsb3DbgGuid, (VOID **) &m= Usb3Instance); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - goto Done; >=20 > - } >=20 > - >=20 > - // >=20 > - // It is first time to run DXE instance, copy Instance from Hob to ACP= INvs >=20 > - // NOTE: Hob is not ready at this time, so copy it from XHCI register. >=20 > - // >=20 > - Instance =3D GetUsb3DebugPortInstance (); >=20 > - if (Instance =3D=3D NULL) { >=20 > - // >=20 > - // Initialize USB debug >=20 > - // >=20 > - SetMem (&UsbDbg, sizeof(UsbDbg), 0); >=20 > - DiscoverUsb3DebugPort (&UsbDbg); >=20 > - if (UsbDbg.DebugSupport) { >=20 > - InitializeUsb3DebugPort (&UsbDbg); >=20 > - } >=20 > - Instance =3D &UsbDbg; >=20 > - } >=20 > - Address =3D SIZE_4GB; >=20 > - Status =3D gBS->AllocatePages ( >=20 > - AllocateMaxAddress, >=20 > - EfiACPIMemoryNVS, >=20 > - EFI_SIZE_TO_PAGES (sizeof (USB3_DEBUG_PORT_INSTANCE)), >=20 > - &Address >=20 > - ); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - >=20 > - CopyMem ( >=20 > - (VOID *)(UINTN)Address, >=20 > - Instance, >=20 > - sizeof (USB3_DEBUG_PORT_INSTANCE) >=20 > - ); >=20 > - mUsb3Instance =3D (USB3_DEBUG_PORT_INSTANCE *)(UINTN)Address; >=20 > - >=20 > - Status =3D gBS->InstallConfigurationTable (&gUsb3DbgGuid, mUsb3Instanc= e); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - >=20 > - if (mUsb3Instance->DebugSupport) { >=20 > - SaveUsb3InstanceAddress (mUsb3Instance); >=20 > - } >=20 > - >=20 > -Done: >=20 > - if ((mUsb3Instance !=3D NULL) && mUsb3Instance->Ready && (mUsb3Instanc= e->PciIoEvent =3D=3D 0)) { >=20 > - Status =3D Usb3NamedEventListen ( >=20 > - &gEfiPciIoProtocolGuid, >=20 > - TPL_NOTIFY, >=20 > - Usb3PciIoNotify, >=20 > - &Event >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - mUsb3Instance->PciIoEvent =3D (EFI_PHYSICAL_ADDRESS) (UINTN) Event= ; >=20 > - } >=20 > - } >=20 > - >=20 > - return RETURN_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Calculate the size of XHCI MMIO space. >=20 > - >=20 > - @retval TURE The XHCI MMIO is in SMRAM ranges. >=20 > - @retval FALSE The XHCI MMIO is out of SMRAM ranges. >=20 > -**/ >=20 > -UINT64 >=20 > -CalculateMmioSize ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - UINT8 Bus; >=20 > - UINT8 Device; >=20 > - UINT8 Function; >=20 > - UINT32 Value; >=20 > - UINT32 Mask; >=20 > - UINT64 MmioSize; >=20 > - UINT16 Command; >=20 > - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; >=20 > - EFI_PHYSICAL_ADDRESS XhcMmioBase; >=20 > - >=20 > - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); >=20 > - Bus =3D UsbDebugPort.PciAddress.Bus; >=20 > - Device =3D UsbDebugPort.PciAddress.Device; >=20 > - Function =3D UsbDebugPort.PciAddress.Function; >=20 > - >=20 > - Mask =3D 0xFFFFFFF0; >=20 > - MmioSize =3D 0; >=20 > - >=20 > - XhcMmioBase =3D GetXhciBaseAddress (); >=20 > - >=20 > - // >=20 > - // Disable MSE >=20 > - // >=20 > - Command =3D PciRead16 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMM= AND_OFFSET)); >=20 > - PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET= ), Command & > ~(EFI_PCI_COMMAND_MEMORY_SPACE)); >=20 > - >=20 > - // >=20 > - // Get Mmio Size >=20 > - // >=20 > - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG= _OFFSET), 0xFFFFFFFF); >=20 > - Value =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BAS= E_ADDRESSREG_OFFSET)); >=20 > - >=20 > - switch (Value & 0x07) { >=20 > - case 0x0: >=20 > - // >=20 > - // Memory space: anywhere in 32 bit address space >=20 > - // >=20 > - MmioSize =3D (~(Value & Mask)) + 1; >=20 > - break; >=20 > - case 0x4: >=20 > - // >=20 > - // Memory space: anywhere in 64 bit address space >=20 > - // >=20 > - MmioSize =3D Value & Mask; >=20 > - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRES= SREG_OFFSET + 4), 0xFFFFFFFF); >=20 > - Value =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI= _BASE_ADDRESSREG_OFFSET + 4)); >=20 > - // >=20 > - // Fix the length to support some spefic 64 bit BAR >=20 > - // >=20 > - Value |=3D ((UINT32)(-1) << HighBitSet32 (Value)); >=20 > - // >=20 > - // Calculate the size of 64bit bar >=20 > - // >=20 > - MmioSize |=3D LShiftU64 ((UINT64) Value, 32); >=20 > - MmioSize =3D (~(MmioSize)) + 1; >=20 > - break; >=20 > - default: >=20 > - // >=20 > - // Unknown BAR type >=20 > - // >=20 > - MmioSize =3D (~(Value & Mask)) + 1; >=20 > - break; >=20 > - }; >=20 > - >=20 > - >=20 > - // >=20 > - // Restore MMIO address >=20 > - // >=20 > - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG= _OFFSET), (UINT32)XhcMmioBase); >=20 > - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG= _OFFSET + 4), (UINT32) (XhcMmioBase >> 32)); >=20 > - >=20 > - PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET= ), Command | > EFI_PCI_COMMAND_MEMORY_SPACE); >=20 > - >=20 > - return MmioSize; >=20 > -} >=20 > - >=20 > -/** >=20 > - The constructor function initialize USB3 debug port. >=20 > - >=20 > - @param ImageHandle The firmware allocated handle for the EFI image. >=20 > - @param SystemTable A pointer to the EFI System Table. >=20 > - >=20 > - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -Usb3DebugPortLibDxeConstructor ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -{ >=20 > - EFI_SMM_BASE2_PROTOCOL *SmmBase; >=20 > - EFI_SMM_ACCESS2_PROTOCOL *SmmAccess; >=20 > - UINTN Size; >=20 > - EFI_STATUS Status; >=20 > - >=20 > - // >=20 > - // Do real initialization here, because we need copy data from Hob to = ACPINvs. >=20 > - // We must do it in constructor because it depends on UefiBootServices= TableLib. >=20 > - // >=20 > - if (FeaturePcdGet (PcdStatusCodeUseUsb3Serial)) { >=20 > - USB3InitializeReal (); >=20 > - } >=20 > - >=20 > - mUsb3MmioSize =3D CalculateMmioSize (); >=20 > - >=20 > - if (gBS !=3D NULL) { >=20 > - SmmBase =3D NULL; >=20 > - Status =3D gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VO= ID **)&SmmBase); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - SmmBase->InSmm(SmmBase, &mUsb3InSmm); >=20 > - } >=20 > - >=20 > - if (mUsb3InSmm) { >=20 > - // >=20 > - // Get SMRAM information >=20 > - // >=20 > - SmmAccess =3D NULL; >=20 > - Status =3D gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL,= (VOID **)&SmmAccess); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - Size =3D sizeof (mSmramCheckRanges); >=20 > - >=20 > - Status =3D SmmAccess->GetCapabilities (SmmAccess, &Size, mSmramC= heckRanges); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - mSmramCheckRangeCount =3D Size / sizeof (EFI_SMRAM_DESCRIPTOR)= ; >=20 > - } >=20 > - } >=20 > - } >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - The destructor function. >=20 > - >=20 > - @param ImageHandle The firmware allocated handle for the EFI image. >=20 > - @param SystemTable A pointer to the EFI System Table. >=20 > - >=20 > - @retval EFI_SUCCESS The destructor always returns EFI_SUCCESS. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -Usb3DebugPortLibDxeDestructor ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -{ >=20 > - if ((mUsb3Instance !=3D NULL) && (mUsb3Instance->PciIoEvent !=3D 0)) { >=20 > - // >=20 > - // Close the event created. >=20 > - // >=20 > - gBS->CloseEvent ((EFI_EVENT) (UINTN) mUsb3Instance->PciIoEvent); >=20 > - mUsb3Instance->PciIoEvent =3D 0; >=20 > - } >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Allocates pages that are suitable for an OperationBusMasterCommonBuffe= r or >=20 > - OperationBusMasterCommonBuffer64 mapping. >=20 > - >=20 > - @param PciIo Pointer to PciIo for USB3 debug port. >=20 > - @param Pages The number of pages to allocate. >=20 > - @param Address A pointer to store the base system memor= y address of the >=20 > - allocated range. >=20 > - >=20 > - @retval EFI_SUCCESS The requested memory pages were allocate= d. >=20 > - @retval EFI_UNSUPPORTED Attributes is unsupported. The only lega= l attribute bits are >=20 > - MEMORY_WRITE_COMBINE and MEMORY_CACHED. >=20 > - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. >=20 > - @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -Usb3AllocateDmaBuffer ( >=20 > - IN EFI_PCI_IO_PROTOCOL *PciIo, >=20 > - IN UINTN Pages, >=20 > - OUT VOID **Address >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - >=20 > - *Address =3D NULL; >=20 > - Status =3D PciIo->AllocateBuffer ( >=20 > - PciIo, >=20 > - AllocateAnyPages, >=20 > - EfiRuntimeServicesData, >=20 > - Pages, >=20 > - Address, >=20 > - 0 >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - Usb3MapOneDmaBuffer ( >=20 > - PciIo, >=20 > - (EFI_PHYSICAL_ADDRESS) (UINTN) *Address, >=20 > - EFI_PAGES_TO_SIZE (Pages) >=20 > - ); >=20 > - } >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Allocate aligned memory for XHC's usage. >=20 > - >=20 > - @param BufferSize The size, in bytes, of the Buffer. >=20 > - >=20 > - @return A pointer to the allocated buffer or NULL if allocation fails. >=20 > - >=20 > -**/ >=20 > -VOID* >=20 > -AllocateAlignBuffer ( >=20 > - IN UINTN BufferSize >=20 > - ) >=20 > -{ >=20 > - VOID *Buf; >=20 > - EFI_PHYSICAL_ADDRESS Address; >=20 > - EFI_STATUS Status; >=20 > - >=20 > - Buf =3D NULL; >=20 > - >=20 > - if (gBS !=3D NULL) { >=20 > - if (mUsb3PciIo !=3D NULL) { >=20 > - Usb3AllocateDmaBuffer ( >=20 > - mUsb3PciIo, >=20 > - EFI_SIZE_TO_PAGES (BufferSize), >=20 > - &Buf >=20 > - ); >=20 > - } else { >=20 > - Address =3D 0xFFFFFFFF; >=20 > - Status =3D gBS->AllocatePages ( >=20 > - AllocateMaxAddress, >=20 > - EfiACPIMemoryNVS, >=20 > - EFI_SIZE_TO_PAGES (BufferSize), >=20 > - &Address >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - Buf =3D (VOID *)(UINTN)Address; >=20 > - } >=20 > - } >=20 > - } >=20 > - >=20 > - return Buf; >=20 > -} >=20 > - >=20 > -/** >=20 > - Check whether AllocatePages in permanent memory is ready. >=20 > - >=20 > - @retval TRUE AllocatePages in permanent memory is ready. >=20 > - @retval FALSE AllocatePages in permanent memory is not ready. >=20 > - >=20 > -**/ >=20 > -BOOLEAN >=20 > -IsAllocatePagesReady ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - if (gBS !=3D NULL) { >=20 > - return TRUE; >=20 > - } >=20 > - >=20 > - return FALSE; >=20 > -} >=20 > - >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3= DebugPortLibDxeIoMmu.inf > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLi= bDxeIoMmu.inf > deleted file mode 100644 > index c9c56d7ade..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPo= rtLibDxeIoMmu.inf > +++ /dev/null > @@ -1,63 +0,0 @@ > -## @file >=20 > -# Usb3 debug port library. >=20 > -# >=20 > -# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D Usb3DebugPortLibDxeIoMmu >=20 > - FILE_GUID =3D BC48A65D-5E5E-4512-8ACC-90E79E2D80C= 2 >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D Usb3DebugPortLib|DXE_CORE DXE_DRIVE= R DXE_RUNTIME_DRIVER DXE_SAL_DRIVER > DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE >=20 > - CONSTRUCTOR =3D Usb3DebugPortLibDxeConstructor >=20 > - DESTRUCTOR =3D Usb3DebugPortLibDxeDestructor >=20 > - >=20 > -# >=20 > -# The following information is for reference only and not required by th= e build tools. >=20 > -# >=20 > -# VALID_ARCHITECTURES =3D IA32 X64 IPF >=20 > -# >=20 > - >=20 > -[Sources] >=20 > - Usb3DebugPortLibDxeIoMmu.c >=20 > - Usb3DebugPortDataTransfer.c >=20 > - Usb3DebugPortInitialize.c >=20 > - MiscServices.c >=20 > - Usb3DebugPortLibInternal.h >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - DebugFeaturePkg/DebugFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - BaseLib >=20 > - PcdLib >=20 > - IoLib >=20 > - PciLib >=20 > - TimerLib >=20 > - UefiBootServicesTableLib >=20 > - UefiLib >=20 > - HobLib >=20 > - Usb3DebugPortParameterLib >=20 > - >=20 > -[Protocols] >=20 > - gEfiSmmAccess2ProtocolGuid ## CONSUMES >=20 > - gEfiSmmBase2ProtocolGuid ## CONSUMES >=20 > - ## NOTIFY >=20 > - ## SOMETIMES_CONSUMES >=20 > - gEfiPciIoProtocolGuid >=20 > - gEdkiiIoMmuProtocolGuid ## SOMETIMES_CONSUMES >=20 > - ## NOTIFY >=20 > - gEfiDxeSmmReadyToLockProtocolGuid >=20 > - >=20 > -[Pcd] >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOMETI= MES_CONSUMES >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONSUM= ES >=20 > - >=20 > -[FeaturePcd] >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseUsb3Serial ## CONSUM= ES >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3= DebugPortLibInternal.h > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLi= bInternal.h > deleted file mode 100644 > index 3641cc1d52..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPo= rtLibInternal.h > +++ /dev/null > @@ -1,887 +0,0 @@ > -/** @file >=20 > - This library class provides common Usb debug port functions. >=20 > - >=20 > - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef __USB3_DEBUG_PORT_LIB_INTERNAL__ >=20 > -#define __USB3_DEBUG_PORT_LIB_INTERNAL__ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -// >=20 > -// USB Debug GUID value >=20 > -// >=20 > -#define USB3_DBG_GUID \ >=20 > - { \ >=20 > - 0xb2a56f4d, 0x9177, 0x4fc8, { 0xa6, 0x77, 0xdd, 0x96, 0x3e, 0xb4, = 0xcb, 0x1b } \ >=20 > - } >=20 > - >=20 > -// >=20 > -// Define the maximum of SMRAM ranges >=20 > -// >=20 > -#define MAX_SMRAM_RANGE 8 >=20 > - >=20 > -#define XHCI_DEBUG_DEVICE_VENDOR_ID 0x8086 >=20 > -#define XHCI_DEBUG_DEVICE_PRODUCT_ID 0x1234 >=20 > -#define XHCI_DEBUG_DEVICE_PROTOCOL 0xFF >=20 > -#define XHCI_DEBUG_DEVICE_REVISION 0x00 >=20 > - >=20 > -#define XHCI_BASE_ADDRESS_64_BIT_MASK 0xFFFFFFFFFFFF0000ULL >=20 > -#define XHCI_BASE_ADDRESS_32_BIT_MASK 0xFFFF0000 >=20 > - >=20 > -#define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A >=20 > -#define XHC_HCCPARAMS_OFFSET 0x10 >=20 > -#define XHC_CAPABILITY_ID_MASK 0xFF >=20 > -#define XHC_NEXT_CAPABILITY_MASK 0xFF00 >=20 > - >=20 > -#define XHC_USBCMD_OFFSET 0x0 // USB Command Register Offset >=20 > -#define XHC_USBSTS_OFFSET 0x4 // USB Status Register Offset >=20 > - >=20 > -#define XHC_USBCMD_RUN BIT0 // Run/Stop >=20 > -#define XHC_USBCMD_RESET BIT1 // Host Controller Reset >=20 > - >=20 > -#define XHC_USBSTS_HALT BIT0 >=20 > - >=20 > -// >=20 > -// Transfer the data of 8 bytes each time >=20 > -// >=20 > -#define XHC_DEBUG_PORT_DATA_LENGTH 8 >=20 > - >=20 > -// >=20 > -// Indicate the timeout when data is transferred. 0 means infinite timeo= ut. >=20 > -// >=20 > -#define DATA_TRANSFER_TIME_OUT 0 >=20 > - >=20 > -// >=20 > -// USB debug device string descritpor (header size + unicode string leng= th) >=20 > -// >=20 > -#define STRING0_DESC_LEN 4 >=20 > -#define MANU_DESC_LEN 12 >=20 > -#define PRODUCT_DESC_LEN 40 >=20 > -#define SERIAL_DESC_LEN 4 >=20 > - >=20 > -// >=20 > -// Debug Capability Register Offset >=20 > -// >=20 > -#define XHC_DC_DCID 0x0 >=20 > -#define XHC_DC_DCDB 0x4 >=20 > -#define XHC_DC_DCERSTSZ 0x8 >=20 > -#define XHC_DC_DCERSTBA 0x10 >=20 > -#define XHC_DC_DCERDP 0x18 >=20 > -#define XHC_DC_DCCTRL 0x20 >=20 > -#define XHC_DC_DCST 0x24 >=20 > -#define XHC_DC_DCPORTSC 0x28 >=20 > -#define XHC_DC_DCCP 0x30 >=20 > -#define XHC_DC_DCDDI1 0x38 >=20 > -#define XHC_DC_DCDDI2 0x3C >=20 > - >=20 > -#define TRB_TYPE_LINK 6 >=20 > - >=20 > -#define ERST_NUMBER 0x01 >=20 > -#define TR_RING_TRB_NUMBER 0x100 >=20 > -#define EVENT_RING_TRB_NUMBER 0x200 >=20 > -#define CMD_RING_TRB_NUMBER 0x100 >=20 > - >=20 > -#define ED_BULK_OUT 2 >=20 > -#define ED_BULK_IN 6 >=20 > - >=20 > -#define XHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0xF= FFFFFFF)) >=20 > -#define XHC_HIGH_32BIT(Addr64) ((UINT32)(RShiftU64((UINT64)(UINT= N)(Addr64), 32) & 0xFFFFFFFF)) >=20 > -#define XHC_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) =3D= =3D (Bit))) >=20 > - >=20 > -#define XHC_REG_BIT_IS_SET(Xhc, Offset, Bit) \ >=20 > - (XHC_BIT_IS_SET(XhcReadMmioReg ((Xhc), (Offset)), (Bit))) >=20 > - >=20 > -// >=20 > -// Endpoint Type (EP Type). >=20 > -// >=20 > -#define ED_NOT_VALID 0 >=20 > -#define ED_ISOCH_OUT 1 >=20 > -#define ED_BULK_OUT 2 >=20 > -#define ED_INTERRUPT_OUT 3 >=20 > -#define ED_CONTROL_BIDIR 4 >=20 > -#define ED_ISOCH_IN 5 >=20 > -#define ED_BULK_IN 6 >=20 > -#define ED_INTERRUPT_IN 7 >=20 > - >=20 > -// >=20 > -// 6.4.5 TRB Completion Codes >=20 > -// >=20 > -#define TRB_COMPLETION_INVALID 0 >=20 > -#define TRB_COMPLETION_SUCCESS 1 >=20 > -#define TRB_COMPLETION_DATA_BUFFER_ERROR 2 >=20 > -#define TRB_COMPLETION_BABBLE_ERROR 3 >=20 > -#define TRB_COMPLETION_USB_TRANSACTION_ERROR 4 >=20 > -#define TRB_COMPLETION_TRB_ERROR 5 >=20 > -#define TRB_COMPLETION_STALL_ERROR 6 >=20 > -#define TRB_COMPLETION_SHORT_PACKET 13 >=20 > - >=20 > -// >=20 > -// 6.4.6 TRB Types >=20 > -// >=20 > -#define TRB_TYPE_NORMAL 1 >=20 > -#define TRB_TYPE_SETUP_STAGE 2 >=20 > -#define TRB_TYPE_DATA_STAGE 3 >=20 > -#define TRB_TYPE_STATUS_STAGE 4 >=20 > -#define TRB_TYPE_ISOCH 5 >=20 > -#define TRB_TYPE_LINK 6 >=20 > -#define TRB_TYPE_EVENT_DATA 7 >=20 > -#define TRB_TYPE_NO_OP 8 >=20 > -#define TRB_TYPE_EN_SLOT 9 >=20 > -#define TRB_TYPE_DIS_SLOT 10 >=20 > -#define TRB_TYPE_ADDRESS_DEV 11 >=20 > -#define TRB_TYPE_CON_ENDPOINT 12 >=20 > -#define TRB_TYPE_EVALU_CONTXT 13 >=20 > -#define TRB_TYPE_RESET_ENDPOINT 14 >=20 > -#define TRB_TYPE_STOP_ENDPOINT 15 >=20 > -#define TRB_TYPE_SET_TR_DEQUE 16 >=20 > -#define TRB_TYPE_RESET_DEV 17 >=20 > -#define TRB_TYPE_GET_PORT_BANW 21 >=20 > -#define TRB_TYPE_FORCE_HEADER 22 >=20 > -#define TRB_TYPE_NO_OP_COMMAND 23 >=20 > -#define TRB_TYPE_TRANS_EVENT 32 >=20 > -#define TRB_TYPE_COMMAND_COMPLT_EVENT 33 >=20 > -#define TRB_TYPE_PORT_STATUS_CHANGE_EVENT 34 >=20 > -#define TRB_TYPE_HOST_CONTROLLER_EVENT 37 >=20 > -#define TRB_TYPE_DEVICE_NOTIFI_EVENT 38 >=20 > -#define TRB_TYPE_MFINDEX_WRAP_EVENT 39 >=20 > - >=20 > -// >=20 > -// Convert millisecond to microsecond. >=20 > -// >=20 > -#define XHC_1_MILLISECOND (1000) >=20 > -#define XHC_POLL_DELAY (1000) >=20 > -#define XHC_GENERIC_TIMEOUT (10 * 1000) >=20 > - >=20 > -#define EFI_USB_SPEED_FULL 0x0000 ///< 12 Mb/s, USB = 1.1 OHCI and UHCI HC. >=20 > -#define EFI_USB_SPEED_LOW 0x0001 ///< 1 Mb/s, USB 1= .1 OHCI and UHCI HC. >=20 > -#define EFI_USB_SPEED_HIGH 0x0002 ///< 480 Mb/s, USB= 2.0 EHCI HC. >=20 > -#define EFI_USB_SPEED_SUPER 0x0003 ///< 4.8 Gb/s, USB= 3.0 XHCI HC. >=20 > - >=20 > -// >=20 > -// Transfer types, used in URB to identify the transfer type >=20 > -// >=20 > -#define XHC_CTRL_TRANSFER 0x01 >=20 > -#define XHC_BULK_TRANSFER 0x02 >=20 > -#define XHC_INT_TRANSFER_SYNC 0x04 >=20 > -#define XHC_INT_TRANSFER_ASYNC 0x08 >=20 > -#define XHC_INT_ONLY_TRANSFER_ASYNC 0x10 >=20 > - >=20 > -// >=20 > -// USB Transfer Results >=20 > -// >=20 > -#define EFI_USB_NOERROR 0x00 >=20 > -#define EFI_USB_ERR_NOTEXECUTE 0x01 >=20 > -#define EFI_USB_ERR_STALL 0x02 >=20 > -#define EFI_USB_ERR_BUFFER 0x04 >=20 > -#define EFI_USB_ERR_BABBLE 0x08 >=20 > -#define EFI_USB_ERR_NAK 0x10 >=20 > -#define EFI_USB_ERR_CRC 0x20 >=20 > -#define EFI_USB_ERR_TIMEOUT 0x40 >=20 > -#define EFI_USB_ERR_BITSTUFF 0x80 >=20 > -#define EFI_USB_ERR_SYSTEM 0x100 >=20 > - >=20 > -#define USB3_DEBUG_PORT_INSTANCE_SIGNATURE SIGNATURE_32('D', 'B', 'G',= 'P') >=20 > - >=20 > -#pragma pack(1) >=20 > - >=20 > -// >=20 > -// 7.6.9 OUT/IN EP Context: 64 bytes >=20 > -// 7.6.9.2 When used by the DbC it is always a 64 byte data structure >=20 > -// >=20 > -typedef struct _ENDPOINT_CONTEXT_64 { >=20 > - UINT32 EPState:3; >=20 > - UINT32 RsvdZ1:5; >=20 > - UINT32 Mult:2; // set to 0 >=20 > - UINT32 MaxPStreams:5; // set to 0 >=20 > - UINT32 LSA:1; // set to 0 >=20 > - UINT32 Interval:8; // set to 0 >=20 > - UINT32 RsvdZ2:8; >=20 > - >=20 > - UINT32 RsvdZ3:1; >=20 > - UINT32 CErr:2; >=20 > - UINT32 EPType:3; >=20 > - UINT32 RsvdZ4:1; >=20 > - UINT32 HID:1; // set to 0 >=20 > - UINT32 MaxBurstSize:8; >=20 > - UINT32 MaxPacketSize:16; >=20 > - >=20 > - UINT32 PtrLo; >=20 > - >=20 > - UINT32 PtrHi; >=20 > - >=20 > - UINT32 AverageTRBLength:16; >=20 > - UINT32 MaxESITPayload:16; // set to 0 >=20 > - >=20 > - UINT32 RsvdZ5; // Reserved >=20 > - UINT32 RsvdZ6; >=20 > - UINT32 RsvdZ7; >=20 > - >=20 > - UINT32 RsvdZ8; >=20 > - UINT32 RsvdZ9; >=20 > - UINT32 RsvdZ10; >=20 > - UINT32 RsvdZ11; >=20 > - >=20 > - UINT32 RsvdZ12; >=20 > - UINT32 RsvdZ13; >=20 > - UINT32 RsvdZ14; >=20 > - UINT32 RsvdZ15; >=20 > -} ENDPOINT_CONTEXT_64; >=20 > - >=20 > -// >=20 > -// 6.4.1.1 Normal TRB: 16 bytes >=20 > -// A Normal TRB is used in several ways; exclusively on Bulk and Interru= pt Transfer Rings for normal and >=20 > -// Scatter/Gather operations, to define additional data buffers for Scat= ter/Gather operations on Isoch Transfer >=20 > -// Rings, and to define the Data stage information for Control Transfer = Rings. >=20 > -// >=20 > -typedef struct _TRANSFER_TRB_NORMAL { >=20 > - UINT32 TRBPtrLo; >=20 > - >=20 > - UINT32 TRBPtrHi; >=20 > - >=20 > - UINT32 Length:17; >=20 > - UINT32 TDSize:5; >=20 > - UINT32 IntTarget:10; >=20 > - >=20 > - UINT32 CycleBit:1; >=20 > - UINT32 ENT:1; >=20 > - UINT32 ISP:1; >=20 > - UINT32 NS:1; >=20 > - UINT32 CH:1; >=20 > - UINT32 IOC:1; >=20 > - UINT32 IDT:1; >=20 > - UINT32 RsvdZ1:2; >=20 > - UINT32 BEI:1; >=20 > - UINT32 Type:6; >=20 > - UINT32 RsvdZ2:16; >=20 > -} TRANSFER_TRB_NORMAL; >=20 > - >=20 > -// >=20 > -// 6.4.2.1 Transfer Event TRB: 16 bytes >=20 > -// A Transfer Event provides the completion status associated with a Tra= nsfer TRB. Refer to section 4.11.3.1 >=20 > -// for more information on the use and operation of Transfer Events. >=20 > -// >=20 > -typedef struct _EVT_TRB_TRANSFER { >=20 > - UINT32 TRBPtrLo; >=20 > - >=20 > - UINT32 TRBPtrHi; >=20 > - >=20 > - UINT32 Length:24; >=20 > - UINT32 Completecode:8; >=20 > - >=20 > - UINT32 CycleBit:1; >=20 > - UINT32 RsvdZ1:1; >=20 > - UINT32 ED:1; >=20 > - UINT32 RsvdZ2:7; >=20 > - UINT32 Type:6; >=20 > - UINT32 EndpointId:5; >=20 > - UINT32 RsvdZ3:3; >=20 > - UINT32 SlotId:8; >=20 > -} EVT_TRB_TRANSFER; >=20 > - >=20 > -// >=20 > -// 6.4.4.1 Link TRB: 16 bytes >=20 > -// A Link TRB provides support for non-contiguous TRB Rings. >=20 > -// >=20 > -typedef struct _LINK_TRB { >=20 > - UINT32 PtrLo; >=20 > - >=20 > - UINT32 PtrHi; >=20 > - >=20 > - UINT32 RsvdZ1:22; >=20 > - UINT32 InterTarget:10; >=20 > - >=20 > - UINT32 CycleBit:1; >=20 > - UINT32 TC:1; >=20 > - UINT32 RsvdZ2:2; >=20 > - UINT32 CH:1; >=20 > - UINT32 IOC:1; >=20 > - UINT32 RsvdZ3:4; >=20 > - UINT32 Type:6; >=20 > - UINT32 RsvdZ4:16; >=20 > -} LINK_TRB; >=20 > - >=20 > -// >=20 > -// TRB Template: 16 bytes >=20 > -// >=20 > -typedef struct _TRB_TEMPLATE { >=20 > - UINT32 Parameter1; >=20 > - >=20 > - UINT32 Parameter2; >=20 > - >=20 > - UINT32 Status; >=20 > - >=20 > - UINT32 CycleBit:1; >=20 > - UINT32 RsvdZ1:9; >=20 > - UINT32 Type:6; >=20 > - UINT32 Control:16; >=20 > -} TRB_TEMPLATE; >=20 > - >=20 > -// >=20 > -// Refer to XHCI 6.5 Event Ring Segment Table: 16 bytes >=20 > -// >=20 > -typedef struct _EVENT_RING_SEG_TABLE_ENTRY { >=20 > - UINT32 PtrLo; >=20 > - UINT32 PtrHi; >=20 > - UINT32 RingTrbSize:16; >=20 > - UINT32 RsvdZ1:16; >=20 > - UINT32 RsvdZ2; >=20 > -} EVENT_RING_SEG_TABLE_ENTRY; >=20 > - >=20 > -// >=20 > -// Size: 40 bytes >=20 > -// >=20 > -typedef struct _EVENT_RING { >=20 > - EFI_PHYSICAL_ADDRESS ERSTBase; >=20 > - EFI_PHYSICAL_ADDRESS EventRingSeg0; >=20 > - UINT32 TrbNumber; >=20 > - EFI_PHYSICAL_ADDRESS EventRingEnqueue; >=20 > - EFI_PHYSICAL_ADDRESS EventRingDequeue; >=20 > - UINT32 EventRingCCS; >=20 > -} EVENT_RING; >=20 > - >=20 > -// Size: 32 bytes >=20 > -typedef struct _TRANSFER_RING { >=20 > - EFI_PHYSICAL_ADDRESS RingSeg0; >=20 > - UINT32 TrbNumber; >=20 > - EFI_PHYSICAL_ADDRESS RingEnqueue; >=20 > - EFI_PHYSICAL_ADDRESS RingDequeue; >=20 > - UINT32 RingPCS; >=20 > -} TRANSFER_RING; >=20 > - >=20 > -// >=20 > -// Size: 64 bytes >=20 > -// >=20 > -typedef struct _DBC_INFO_CONTEXT { >=20 > - UINT64 String0DescAddress; >=20 > - UINT64 ManufacturerStrDescAddress; >=20 > - UINT64 ProductStrDescAddress; >=20 > - UINT64 SerialNumberStrDescAddress; >=20 > - UINT64 String0Length:8; >=20 > - UINT64 ManufacturerStrLength:8; >=20 > - UINT64 ProductStrLength:8; >=20 > - UINT64 SerialNumberStrLength:8; >=20 > - UINT64 RsvdZ1:32; >=20 > - UINT64 RsvdZ2; >=20 > - UINT64 RsvdZ3; >=20 > - UINT64 RsvdZ4; >=20 > -} DBC_INFO_CONTEXT; >=20 > - >=20 > -// >=20 > -// Debug Capability Context Data Structure: 192 bytes >=20 > -// >=20 > -typedef struct _XHC_DC_CONTEXT { >=20 > - DBC_INFO_CONTEXT DbcInfoContext; >=20 > - ENDPOINT_CONTEXT_64 EpOutContext; >=20 > - ENDPOINT_CONTEXT_64 EpInContext; >=20 > -} XHC_DC_CONTEXT; >=20 > - >=20 > -// >=20 > -// Size: 16 bytes >=20 > -// >=20 > -typedef union _TRB { >=20 > - TRB_TEMPLATE TrbTemplate; >=20 > - TRANSFER_TRB_NORMAL TrbNormal; >=20 > -} TRB; >=20 > - >=20 > -/// >=20 > -/// USB data transfer direction >=20 > -/// >=20 > -typedef enum { >=20 > - EfiUsbDataIn, >=20 > - EfiUsbDataOut, >=20 > - EfiUsbNoData >=20 > -} EFI_USB_DATA_DIRECTION; >=20 > - >=20 > -// >=20 > -// URB (Usb Request Block) contains information for all kinds of >=20 > -// usb requests. >=20 > -// >=20 > -typedef struct _URB { >=20 > - UINT32 Signature; >=20 > - // >=20 > - // Transfer data >=20 > - // >=20 > - EFI_PHYSICAL_ADDRESS Data; >=20 > - UINT32 DataLen; >=20 > - // >=20 > - // Execute result >=20 > - // >=20 > - UINT32 Result; >=20 > - // >=20 > - // Completed data length >=20 > - // >=20 > - UINT32 Completed; >=20 > - // >=20 > - // Tranfer Ring info >=20 > - // >=20 > - EFI_PHYSICAL_ADDRESS Ring; >=20 > - EFI_PHYSICAL_ADDRESS TrbStart; >=20 > - EFI_PHYSICAL_ADDRESS TrbEnd; >=20 > - UINT32 TrbNum; >=20 > - BOOLEAN StartDone; >=20 > - BOOLEAN EndDone; >=20 > - BOOLEAN Finished; >=20 > - EFI_USB_DATA_DIRECTION Direction; >=20 > -} URB; >=20 > - >=20 > -// >=20 > -// Size: 90 bytes >=20 > -// >=20 > -typedef struct _USB3_DEBUG_PORT_INSTANCE { >=20 > - UINT32 Signature; >=20 > - >=20 > - UINT8 PciBusNumber; >=20 > - UINT8 PciDeviceNumber; >=20 > - UINT8 PciFunctionNumber; >=20 > - >=20 > - // >=20 > - // The flag indicates debug capability is supported >=20 > - // >=20 > - BOOLEAN DebugSupport; >=20 > - >=20 > - // >=20 > - // The flag indicates debug device is ready >=20 > - // >=20 > - BOOLEAN Ready; >=20 > - >=20 > - // >=20 > - // The flag indicates the instance is from HOB >=20 > - // >=20 > - BOOLEAN FromHob; >=20 > - >=20 > - // >=20 > - // PciIo protocol event >=20 > - // >=20 > - EFI_PHYSICAL_ADDRESS PciIoEvent; >=20 > - >=20 > - // >=20 > - // XHCI MMIO Base address >=20 > - // >=20 > - EFI_PHYSICAL_ADDRESS XhcMmioBase; >=20 > - >=20 > - // >=20 > - // XHCI OP RegisterBase address >=20 > - // >=20 > - EFI_PHYSICAL_ADDRESS XhciOpRegister; >=20 > - >=20 > - // >=20 > - // XHCI Debug Register Base Address >=20 > - // >=20 > - EFI_PHYSICAL_ADDRESS DebugCapabilityBase; >=20 > - >=20 > - // >=20 > - // XHCI Debug Capability offset >=20 > - // >=20 > - UINT64 DebugCapabilityOffset; >=20 > - >=20 > - // >=20 > - // XHCI Debug Context Address >=20 > - // >=20 > - EFI_PHYSICAL_ADDRESS DebugCapabilityContext; >=20 > - >=20 > - // >=20 > - // Transfer Ring >=20 > - // >=20 > - TRANSFER_RING TransferRingOut; >=20 > - TRANSFER_RING TransferRingIn; >=20 > - >=20 > - // >=20 > - // EventRing >=20 > - // >=20 > - EVENT_RING EventRing; >=20 > - >=20 > - // >=20 > - // URB >=20 > - // >=20 > - URB Urb; >=20 > -} USB3_DEBUG_PORT_INSTANCE; >=20 > - >=20 > -#pragma pack() >=20 > - >=20 > -/** >=20 > - Clear one bit of the debug register while keeping other bits. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the debug register. >=20 > - @param Bit The bit mask of the register to set. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -XhcClearDebugRegBit ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Bit >=20 > - ); >=20 > - >=20 > -/** >=20 > - Clear one bit of the MMIO register while keeping other bits. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the MMIO register. >=20 > - @param Bit The bit mask of the register to set. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -XhcClearMmioRegBit ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Bit >=20 > - ); >=20 > - >=20 > -/** >=20 > - Read XHCI debug register. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the debug register. >=20 > - >=20 > - @return The register content read >=20 > - >=20 > -**/ >=20 > -UINT32 >=20 > -XhcReadDebugReg ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset >=20 > - ); >=20 > - >=20 > -/** >=20 > - Read XHCI MMIO register. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the MMIO register. >=20 > - >=20 > - @return The register content read >=20 > - >=20 > -**/ >=20 > -UINT32 >=20 > -XhcReadMmioReg ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset >=20 > - ); >=20 > - >=20 > -/** >=20 > - Set one bit of the debug register while keeping other bits. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the debug register. >=20 > - @param Bit The bit mask of the register to set. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -XhcSetDebugRegBit ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Bit >=20 > - ); >=20 > - >=20 > -/** >=20 > - Set one bit of the MMIO register while keeping other bits. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the MMIO register. >=20 > - @param Bit The bit mask of the register to set. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -XhcSetMmioRegBit ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Bit >=20 > - ); >=20 > - >=20 > -/** >=20 > - Wait the MMIO register's bit as specified by Bit >=20 > - to be set (or clear). >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the MMIO register. >=20 > - @param Bit The bit of the register to wait for. >=20 > - @param WaitToSet Wait the bit to set or clear. >=20 > - @param Timeout The time to wait before abort (in millisecond, ms= ). >=20 > - >=20 > - @retval EFI_SUCCESS The bit successfully changed by host controller. >=20 > - @retval EFI_TIMEOUT The time out occurred. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -XhcWaitMmioRegBit ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Bit, >=20 > - IN BOOLEAN WaitToSet, >=20 > - IN UINT32 Timeout >=20 > - ); >=20 > - >=20 > -/** >=20 > - Write the data to the debug register. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the debug register. >=20 > - @param Data The data to write. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -XhcWriteDebugReg ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Data >=20 > - ); >=20 > - >=20 > -/** >=20 > - Write the data to the MMIO register. >=20 > - >=20 > - @param Xhc The XHCI Instance. >=20 > - @param Offset The offset of the MMIO register. >=20 > - @param Data The data to write. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -XhcWriteMmioReg ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN UINT32 Offset, >=20 > - IN UINT32 Data >=20 > - ); >=20 > - >=20 > -/** >=20 > - Discover the USB3 debug device. >=20 > - >=20 > - @param[in] Instance Pointer to USB3 debug port object instan= ce. >=20 > - >=20 > - @retval RETURN_SUCCESS The USB3 debug device was found. >=20 > - @retval RETURN_DEVICE_ERROR The USB3 debug device was not found. >=20 > - >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -DiscoverUsb3DebugPort( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Instance >=20 > - ); >=20 > - >=20 > -/** >=20 > - Initialize the USB3 debug Device hardware. >=20 > - >=20 > - @param[in] Instance Pointer to USB3 debug port object instance. >=20 > - >=20 > - @retval RETURN_SUCCESS The USB3 debug device was initialized succes= sfully. >=20 > - @retval !RETURN_SUCCESS Error. >=20 > - >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -InitializeUsb3DebugPort ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Instance >=20 > - ); >=20 > - >=20 > -/** >=20 > - Return XHCI MMIO base address. >=20 > - >=20 > -**/ >=20 > -EFI_PHYSICAL_ADDRESS >=20 > -GetXhciBaseAddress ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -/** >=20 > - Return XHCI debug instance address. >=20 > - >=20 > -**/ >=20 > -USB3_DEBUG_PORT_INSTANCE * >=20 > -GetUsb3DebugPortInstance ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -/** >=20 > - Send data over the USB3 debug cable. >=20 > - >=20 > - @param[out] Data Pointer to data >=20 > - @param[in, out] Length Pointer to data length >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -Usb3DbgOut ( >=20 > - OUT UINT8 *Data, >=20 > - IN OUT UINTN *Length >=20 > - ); >=20 > - >=20 > -/** >=20 > - Receive data over the USB3 debug cable. >=20 > - >=20 > - @param[out] Data Pointer to data >=20 > - @param[in, out] Length Pointer to data length >=20 > - >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -Usb3DbgIn ( >=20 > - OUT UINT8 *Data, >=20 > - IN OUT UINTN *Length >=20 > - ); >=20 > - >=20 > -/** >=20 > - Verifies if the bit positions specified by a mask are set in a registe= r. >=20 > - >=20 > - @param[in, out] Register UNITN register >=20 > - @param[in] BitMask 32-bit mask >=20 > - >=20 > - @return BOOLEAN - TRUE if all bits specified by the mask are enable= d. >=20 > - - FALSE even if one of the bits specified by the mas= k >=20 > - is not enabled. >=20 > -**/ >=20 > -BOOLEAN >=20 > -XhcIsBitSet( >=20 > - UINTN Register, >=20 > - UINT32 BitMask >=20 > - ); >=20 > - >=20 > -/** >=20 > - Sets bits as per the enabled bit positions in the mask. >=20 > - >=20 > - @param[in, out] Register UINTN register >=20 > - @param[in] BitMask 32-bit mask >=20 > -**/ >=20 > -VOID >=20 > -XhcSetR32Bit( >=20 > - UINTN Register, >=20 > - UINT32 BitMask >=20 > - ); >=20 > - >=20 > -/** >=20 > - Clears bits as per the enabled bit positions in the mask. >=20 > - >=20 > - @param[in, out] Register UINTN register >=20 > - @param[in] BitMask 32-bit mask >=20 > -**/ >=20 > -VOID >=20 > -XhcClrR32Bit( >=20 > - UINTN Register, >=20 > - UINT32 BitMask >=20 > - ); >=20 > - >=20 > -/** >=20 > - Initialize USB3 debug port. >=20 > - >=20 > - This method invokes various internal functions to facilitate >=20 > - detection and initialization of USB3 debug port. >=20 > - >=20 > - @retval RETURN_SUCCESS The serial device was initialized. >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -EFIAPI >=20 > -USB3Initialize ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -/** >=20 > - Return command register value in XHCI controller. >=20 > - >=20 > -**/ >=20 > -UINT16 >=20 > -GetXhciPciCommand ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -/** >=20 > - Allocate aligned memory for XHC's usage. >=20 > - >=20 > - @param BufferSize The size, in bytes, of the Buffer. >=20 > - >=20 > - @return A pointer to the allocated buffer or NULL if allocation fails. >=20 > - >=20 > -**/ >=20 > -VOID* >=20 > -AllocateAlignBuffer ( >=20 > - IN UINTN BufferSize >=20 > - ); >=20 > - >=20 > -/** >=20 > - Check whether AllocatePages in permanent memory is ready. >=20 > - >=20 > - @retval TRUE AllocatePages in permanent memory is ready. >=20 > - @retval FALSE AllocatePages in permanent memory is not ready. >=20 > - >=20 > -**/ >=20 > -BOOLEAN >=20 > -IsAllocatePagesReady ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -/** >=20 > - The real function to initialize USB3 debug port. >=20 > - >=20 > - This method invokes various internal functions to facilitate >=20 > - detection and initialization of USB3 debug port. >=20 > - >=20 > - @retval RETURN_SUCCESS The serial device was initialized. >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -EFIAPI >=20 > -USB3InitializeReal ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -/** >=20 > - Update XHC hardware address when MMIO base is changed. >=20 > - >=20 > - @param Instance The XHCI Instance. >=20 > - @param XhcMmioBase XHCI MMIO base address. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -FixUsb3InstanceResource ( >=20 > - IN OUT USB3_DEBUG_PORT_INSTANCE *Instance, >=20 > - IN EFI_PHYSICAL_ADDRESS XhcMmioBase >=20 > - ); >=20 > - >=20 > -/** >=20 > - Save USB3 instance address. >=20 > - >=20 > - @param[in] Instance The XHCI Instance. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -SaveUsb3InstanceAddress ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Instance >=20 > - ); >=20 > - >=20 > -/** >=20 > - Submits bulk transfer to a bulk endpoint of a USB device. >=20 > - >=20 > - @param Xhc The instance of debug device. >=20 > - @param Direction The direction of data transfer. >=20 > - @param Data Array of pointers to the buffers of data= to transmit >=20 > - from or receive into. >=20 > - @param DataLength The lenght of the data buffer. >=20 > - @param Timeout Indicates the maximum time, in milliseco= nd, which >=20 > - the transfer is allowed to complete. >=20 > - @param TransferResult Transfer result. >=20 > - >=20 > - @retval EFI_SUCCESS The transfer was completed successfully. >=20 > - @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resou= rce. >=20 > - @retval EFI_INVALID_PARAMETER Some parameters are invalid. >=20 > - @retval EFI_TIMEOUT The transfer failed due to timeout. >=20 > - @retval EFI_DEVICE_ERROR The transfer failed due to host controll= er error. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -XhcDataTransfer ( >=20 > - IN USB3_DEBUG_PORT_INSTANCE *Xhc, >=20 > - IN EFI_USB_DATA_DIRECTION Direction, >=20 > - IN OUT VOID *Data, >=20 > - IN OUT UINTN *DataLength, >=20 > - IN UINTN Timeout, >=20 > - OUT UINT32 *TransferResult >=20 > - ); >=20 > - >=20 > -#endif //__SERIAL_PORT_LIB_USB__ >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3= DebugPortLibNull.c > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLi= bNull.c > deleted file mode 100644 > index 319cebecbb..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPo= rtLibNull.c > +++ /dev/null > @@ -1,103 +0,0 @@ > -/** @file >=20 > - Usb Debug Port library NULL instance >=20 > - >=20 > - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > - >=20 > -/** >=20 > - Initialize the USB3 debug port hardware. >=20 > - >=20 > - If no initialization is required, then return RETURN_SUCCESS. >=20 > - If the serial device was successfully initialized, then return RETURN_= SUCCESS. >=20 > - If the serial device could not be initialized, then return RETURN_DEVI= CE_ERROR. >=20 > - >=20 > - @retval RETURN_SUCCESS The serial device was initialized. >=20 > - @retval RETURN_DEVICE_ERROR The serial device could not be initializ= ed. >=20 > - >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -EFIAPI >=20 > -Usb3DebugPortInitialize ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - return RETURN_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Write data from buffer to USB3 debug port. >=20 > - >=20 > - Writes NumberOfBytes data bytes from Buffer to the serial device. >=20 > - The number of bytes actually written to the serial device is returned. >=20 > - If the return value is less than NumberOfBytes, then the write operati= on failed. >=20 > - If Buffer is NULL, then ASSERT(). >=20 > - If NumberOfBytes is zero, then return 0. >=20 > - >=20 > - @param Buffer Pointer to the data buffer to be written. >=20 > - @param NumberOfBytes Number of bytes to written to the serial devi= ce. >=20 > - >=20 > - @retval 0 NumberOfBytes is 0. >=20 > - @retval >0 The number of bytes written to the serial dev= ice. >=20 > - If this value is less than NumberOfBytes, the= n the read operation failed. >=20 > - >=20 > -**/ >=20 > -UINTN >=20 > -EFIAPI >=20 > -Usb3DebugPortWrite ( >=20 > - IN UINT8 *Buffer, >=20 > - IN UINTN NumberOfBytes >=20 > - ) >=20 > -{ >=20 > - return 0; >=20 > -} >=20 > - >=20 > - >=20 > -/** >=20 > - Read data from USB3 debug port and save the datas in buffer. >=20 > - >=20 > - Reads NumberOfBytes data bytes from a serial device into the buffer >=20 > - specified by Buffer. The number of bytes actually read is returned. >=20 > - If the return value is less than NumberOfBytes, then the rest operatio= n failed. >=20 > - If Buffer is NULL, then ASSERT(). >=20 > - If NumberOfBytes is zero, then return 0. >=20 > - >=20 > - @param Buffer Pointer to the data buffer to store the data = read from the serial device. >=20 > - @param NumberOfBytes Number of bytes which will be read. >=20 > - >=20 > - @retval 0 Read data failed, no data is to be read. >=20 > - @retval >0 Actual number of bytes read from serial devic= e. >=20 > - >=20 > -**/ >=20 > -UINTN >=20 > -EFIAPI >=20 > -Usb3DebugPortRead ( >=20 > - OUT UINT8 *Buffer, >=20 > - IN UINTN NumberOfBytes >=20 > - ) >=20 > -{ >=20 > - return 0; >=20 > -} >=20 > - >=20 > -/** >=20 > - Polls a USB3 debug port to see if there is any data waiting to be read= . >=20 > - >=20 > - Polls a serial device to see if there is any data waiting to be read. >=20 > - If there is data waiting to be read from the serial device, then TRUE = is returned. >=20 > - If there is no data waiting to be read from the serial device, then FA= LSE is returned. >=20 > - >=20 > - @retval TRUE Data is waiting to be read from the serial de= vice. >=20 > - @retval FALSE There is no data waiting to be read from the = serial device. >=20 > - >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -Usb3DebugPortPoll ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - return FALSE; >=20 > -} >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3= DebugPortLibNull.inf > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLi= bNull.inf > deleted file mode 100644 > index f632150c26..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPo= rtLibNull.inf > +++ /dev/null > @@ -1,28 +0,0 @@ > -## @file >=20 > -# Usb3 debug port library. >=20 > -# >=20 > -# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D USB3DebugPortLibNull >=20 > - FILE_GUID =3D 3E895F08-0A69-42a2-AF4A-3E9EFAA4036= 1 >=20 > - MODULE_TYPE =3D BASE >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D Usb3DebugPortLib >=20 > - >=20 > -# >=20 > -# The following information is for reference only and not required by th= e build tools. >=20 > -# >=20 > -# VALID_ARCHITECTURES =3D IA32 X64 IPF >=20 > -# >=20 > - >=20 > -[Sources] >=20 > - Usb3DebugPortLibNull.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3= DebugPortLibPei.c > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLi= bPei.c > deleted file mode 100644 > index a1e0bdbf6d..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPo= rtLibPei.c > +++ /dev/null > @@ -1,236 +0,0 @@ > -/** @file >=20 > - Usb Debug Port library instance >=20 > - >=20 > - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include "Usb3DebugPortLibInternal.h" >=20 > - >=20 > -GUID gUsb3DbgGuid =3D USB3_DBG_GUID; >=20 > - >=20 > -/** >=20 > - Return XHCI MMIO base address. >=20 > - >=20 > -**/ >=20 > -EFI_PHYSICAL_ADDRESS >=20 > -GetXhciBaseAddress ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - UINT8 Bus; >=20 > - UINT8 Device; >=20 > - UINT8 Function; >=20 > - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; >=20 > - EFI_PHYSICAL_ADDRESS Address; >=20 > - UINT32 Low; >=20 > - UINT32 High; >=20 > - >=20 > - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); >=20 > - Bus =3D UsbDebugPort.PciAddress.Bus; >=20 > - Device =3D UsbDebugPort.PciAddress.Device; >=20 > - Function =3D UsbDebugPort.PciAddress.Function; >=20 > - Low =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADD= RESSREG_OFFSET)); >=20 > - High =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_AD= DRESSREG_OFFSET + 4)); >=20 > - Address =3D (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Lo= w); >=20 > - >=20 > - // >=20 > - // Mask other parts which are not part of base address >=20 > - // >=20 > - Address &=3D XHCI_BASE_ADDRESS_64_BIT_MASK; >=20 > - return Address; >=20 > -} >=20 > - >=20 > -/** >=20 > - Return XHCI debug instance address. >=20 > - >=20 > -**/ >=20 > -USB3_DEBUG_PORT_INSTANCE * >=20 > -GetUsb3DebugPortInstance ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - USB3_DEBUG_PORT_INSTANCE *Instance; >=20 > - EFI_PEI_HOB_POINTERS Hob; >=20 > - EFI_PHYSICAL_ADDRESS XhcMmioBase; >=20 > - >=20 > - Hob.Raw =3D GetFirstGuidHob (&gUsb3DbgGuid); >=20 > - if (Hob.Raw =3D=3D NULL) { >=20 > - return NULL; >=20 > - } >=20 > - Instance =3D GET_GUID_HOB_DATA (Hob.Guid); >=20 > - >=20 > - // >=20 > - // Update XHCI MMIO base address >=20 > - // >=20 > - XhcMmioBase =3D GetXhciBaseAddress (); >=20 > - >=20 > - FixUsb3InstanceResource (Instance, XhcMmioBase); >=20 > - >=20 > - return Instance; >=20 > -} >=20 > - >=20 > -/** >=20 > - Initialize USB3 debug port. >=20 > - >=20 > - This method invokes various internal functions to facilitate >=20 > - detection and initialization of USB3 debug port. >=20 > - >=20 > - @retval RETURN_SUCCESS The serial device was initialized. >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -EFIAPI >=20 > -USB3Initialize ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Initialize USB3 debug port. >=20 > - >=20 > - This method invokes various internal functions to facilitate >=20 > - detection and initialization of USB3 debug port. >=20 > - >=20 > - @retval RETURN_SUCCESS The serial device was initialized. >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -EFIAPI >=20 > -USB3InitializeReal ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - USB3_DEBUG_PORT_INSTANCE UsbDbg; >=20 > - VOID *DataPtr; >=20 > - EFI_PEI_HOB_POINTERS Hob; >=20 > - >=20 > - // >=20 > - // USB Initilization has to be done only once. So this function should= just return when >=20 > - // it is called more than once. >=20 > - // >=20 > - Hob.Raw =3D GetFirstGuidHob (&gUsb3DbgGuid); >=20 > - if (Hob.Raw !=3D NULL) { >=20 > - return RETURN_SUCCESS; >=20 > - } >=20 > - >=20 > - // >=20 > - // Initialize USB debug for PEI at the first time >=20 > - // >=20 > - SetMem (&UsbDbg, sizeof(UsbDbg), 0); >=20 > - UsbDbg.FromHob =3D TRUE; >=20 > - DiscoverUsb3DebugPort (&UsbDbg); >=20 > - if (UsbDbg.DebugSupport) { >=20 > - InitializeUsb3DebugPort (&UsbDbg); >=20 > - } >=20 > - >=20 > - // >=20 > - // Save Instance into HOB >=20 > - // >=20 > - DataPtr =3D BuildGuidDataHob ( >=20 > - &gUsb3DbgGuid, >=20 > - (VOID*) &UsbDbg, >=20 > - sizeof (UsbDbg) >=20 > - ); >=20 > - >=20 > - if (UsbDbg.DebugSupport) { >=20 > - SaveUsb3InstanceAddress ((USB3_DEBUG_PORT_INSTANCE *) DataPtr); >=20 > - } >=20 > - >=20 > - return RETURN_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Allocate aligned memory for XHC's usage. >=20 > - >=20 > - @param BufferSize The size, in bytes, of the Buffer. >=20 > - >=20 > - @return A pointer to the allocated buffer or NULL if allocation fails. >=20 > - >=20 > -**/ >=20 > -VOID* >=20 > -AllocateAlignBuffer ( >=20 > - IN UINTN BufferSize >=20 > - ) >=20 > -{ >=20 > - VOID *Buf; >=20 > - EFI_PHYSICAL_ADDRESS Address; >=20 > - CONST EFI_PEI_SERVICES **PeiServices; >=20 > - EFI_STATUS Status; >=20 > - VOID *MemoryDiscoveredPpi; >=20 > - >=20 > - Buf =3D NULL; >=20 > - PeiServices =3D GetPeiServicesTablePointer (); >=20 > - >=20 > - // >=20 > - // Make sure the allocated memory is physical memory. >=20 > - // >=20 > - Status =3D (*PeiServices)->LocatePpi ( >=20 > - PeiServices, >=20 > - &gEfiPeiMemoryDiscoveredPpiGuid, >=20 > - 0, >=20 > - NULL, >=20 > - (VOID **) &MemoryDiscoveredPpi >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - Status =3D (*PeiServices)->AllocatePages ( >=20 > - PeiServices, >=20 > - EfiACPIMemoryNVS, >=20 > - EFI_SIZE_TO_PAGES (BufferSize), >=20 > - &Address >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - Buf =3D (VOID *)(UINTN) Address; >=20 > - } >=20 > - } >=20 > - return Buf; >=20 > -} >=20 > - >=20 > -/** >=20 > - Check whether AllocatePages in permanent memory is ready. >=20 > - >=20 > - @retval TRUE AllocatePages in permanent memory is ready. >=20 > - @retval FALSE AllocatePages in permanent memory is not ready. >=20 > - >=20 > -**/ >=20 > -BOOLEAN >=20 > -IsAllocatePagesReady ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - CONST EFI_PEI_SERVICES **PeiServices; >=20 > - EFI_STATUS Status; >=20 > - VOID *MemoryDiscoveredPpi; >=20 > - >=20 > - PeiServices =3D GetPeiServicesTablePointer (); >=20 > - >=20 > - // >=20 > - // Make sure the allocated memory is physical memory. >=20 > - // >=20 > - Status =3D (*PeiServices)->LocatePpi ( >=20 > - PeiServices, >=20 > - &gEfiPeiMemoryDiscoveredPpiGuid, >=20 > - 0, >=20 > - NULL, >=20 > - (VOID **) &MemoryDiscoveredPpi >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - return TRUE; >=20 > - } >=20 > - >=20 > - return FALSE; >=20 > -} >=20 > - >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3= DebugPortLibPei.inf > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLi= bPei.inf > deleted file mode 100644 > index 0edde82769..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPo= rtLibPei.inf > +++ /dev/null > @@ -1,48 +0,0 @@ > -## @file >=20 > -# Usb3 debug port library. >=20 > -# >=20 > -# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D USB3DebugPortLibPei >=20 > - FILE_GUID =3D 62C974F0-D0E0-4963-B93A-22FBCEB69AB= 4 >=20 > - MODULE_TYPE =3D PEIM >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D Usb3DebugPortLib|PEIM PEI_CORE >=20 > - >=20 > -# >=20 > -# The following information is for reference only and not required by th= e build tools. >=20 > -# >=20 > -# VALID_ARCHITECTURES =3D IA32 X64 IPF >=20 > -# >=20 > - >=20 > -[Sources] >=20 > - Usb3DebugPortLibPei.c >=20 > - Usb3DebugPortDataTransfer.c >=20 > - Usb3DebugPortInitialize.c >=20 > - MiscServices.c >=20 > - Usb3DebugPortLibInternal.h >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - DebugFeaturePkg/DebugFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - BaseLib >=20 > - PcdLib >=20 > - IoLib >=20 > - PciLib >=20 > - TimerLib >=20 > - HobLib >=20 > - Usb3DebugPortParameterLib >=20 > - PeiServicesTablePointerLib >=20 > - >=20 > -[Ppis] >=20 > - gEfiPeiMemoryDiscoveredPpiGuid ## CONSUMES >=20 > - >=20 > -[Pcd] >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SO= METIMES_CONSUMES >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CO= NSUMES >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3= DebugPortLibPeiIoMmu.c > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLi= bPeiIoMmu.c > deleted file mode 100644 > index 68543c8562..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPo= rtLibPeiIoMmu.c > +++ /dev/null > @@ -1,440 +0,0 @@ > -/** @file >=20 > - Usb Debug Port library instance >=20 > - >=20 > - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include "Usb3DebugPortLibInternal.h" >=20 > - >=20 > -GUID gUsb3DbgGuid =3D USB3_DBG_GUID; >=20 > - >=20 > -/** >=20 > - USB3 IOMMU PPI notify. >=20 > - >=20 > - @param[in] PeiServices Pointer to PEI Services Table. >=20 > - @param[in] NotifyDesc Pointer to the descriptor for the Notificati= on event that >=20 > - caused this function to execute. >=20 > - @param[in] Ppi Pointer to the PPI data associated with this= function. >=20 > - >=20 > - @retval EFI_STATUS Always return EFI_SUCCESS >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -Usb3IoMmuPpiNotify ( >=20 > - IN EFI_PEI_SERVICES **PeiServices, >=20 > - IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, >=20 > - IN VOID *Ppi >=20 > - ) >=20 > -{ >=20 > - USB3_DEBUG_PORT_INSTANCE *Instance; >=20 > - >=20 > - Instance =3D GetUsb3DebugPortInstance (); >=20 > - ASSERT (Instance !=3D NULL); >=20 > - // >=20 > - // Reinitialize USB3 debug port with granted DMA buffer from IOMMU PPI= . >=20 > - // >=20 > - InitializeUsb3DebugPort (Instance); >=20 > - >=20 > - SaveUsb3InstanceAddress (Instance); >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -EFI_PEI_NOTIFY_DESCRIPTOR mUsb3IoMmuPpiNotifyDesc =3D { >=20 > - (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMI= NATE_LIST), >=20 > - &gEdkiiIoMmuPpiGuid, >=20 > - Usb3IoMmuPpiNotify >=20 > -}; >=20 > - >=20 > -/** >=20 > - Allocates pages that are suitable for an OperationBusMasterCommonBuffe= r or >=20 > - OperationBusMasterCommonBuffer64 mapping. >=20 > - >=20 > - @param IoMmu Pointer to IOMMU PPI. >=20 > - @param Pages The number of pages to allocate. >=20 > - @param HostAddress A pointer to store the base system memor= y address of the >=20 > - allocated range. >=20 > - @param DeviceAddress The resulting map address for the bus ma= ster PCI controller to use to >=20 > - access the hosts HostAddress. >=20 > - @param Mapping A resulting value to pass to Unmap(). >=20 > - >=20 > - @retval EFI_SUCCESS The requested memory pages were allocate= d. >=20 > - @retval EFI_UNSUPPORTED Attributes is unsupported. The only lega= l attribute bits are >=20 > - MEMORY_WRITE_COMBINE and MEMORY_CACHED. >=20 > - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. >=20 > - @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -IoMmuAllocateBuffer ( >=20 > - IN EDKII_IOMMU_PPI *IoMmu, >=20 > - IN UINTN Pages, >=20 > - OUT VOID **HostAddress, >=20 > - OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, >=20 > - OUT VOID **Mapping >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINTN NumberOfBytes; >=20 > - >=20 > - *HostAddress =3D NULL; >=20 > - *DeviceAddress =3D 0; >=20 > - *Mapping =3D NULL; >=20 > - >=20 > - Status =3D IoMmu->AllocateBuffer ( >=20 > - IoMmu, >=20 > - EfiRuntimeServicesData, >=20 > - Pages, >=20 > - HostAddress, >=20 > - 0 >=20 > - ); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - NumberOfBytes =3D EFI_PAGES_TO_SIZE (Pages); >=20 > - Status =3D IoMmu->Map ( >=20 > - IoMmu, >=20 > - EdkiiIoMmuOperationBusMasterCommonBuffer, >=20 > - *HostAddress, >=20 > - &NumberOfBytes, >=20 > - DeviceAddress, >=20 > - Mapping >=20 > - ); >=20 > - if (EFI_ERROR (Status)) { >=20 > - IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress); >=20 > - *HostAddress =3D NULL; >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - Status =3D IoMmu->SetAttribute ( >=20 > - IoMmu, >=20 > - *Mapping, >=20 > - EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE >=20 > - ); >=20 > - if (EFI_ERROR (Status)) { >=20 > - IoMmu->Unmap (IoMmu, *Mapping); >=20 > - IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress); >=20 > - *Mapping =3D NULL; >=20 > - *HostAddress =3D NULL; >=20 > - return Status; >=20 > - } >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - USB3 get IOMMU PPI. >=20 > - >=20 > - @return Pointer to IOMMU PPI. >=20 > - >=20 > -**/ >=20 > -EDKII_IOMMU_PPI * >=20 > -Usb3GetIoMmu ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - EDKII_IOMMU_PPI *IoMmu; >=20 > - CONST EFI_PEI_SERVICES **PeiServices; >=20 > - >=20 > - PeiServices =3D GetPeiServicesTablePointer (); >=20 > - >=20 > - IoMmu =3D NULL; >=20 > - Status =3D (*PeiServices)->LocatePpi ( >=20 > - PeiServices, >=20 > - &gEdkiiIoMmuPpiGuid, >=20 > - 0, >=20 > - NULL, >=20 > - (VOID **) &IoMmu >=20 > - ); >=20 > - if (!EFI_ERROR (Status) && (IoMmu !=3D NULL)) { >=20 > - return IoMmu; >=20 > - } >=20 > - >=20 > - return NULL; >=20 > -} >=20 > - >=20 > -/** >=20 > - Return XHCI MMIO base address. >=20 > - >=20 > -**/ >=20 > -EFI_PHYSICAL_ADDRESS >=20 > -GetXhciBaseAddress ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - UINT8 Bus; >=20 > - UINT8 Device; >=20 > - UINT8 Function; >=20 > - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; >=20 > - EFI_PHYSICAL_ADDRESS Address; >=20 > - UINT32 Low; >=20 > - UINT32 High; >=20 > - >=20 > - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); >=20 > - Bus =3D UsbDebugPort.PciAddress.Bus; >=20 > - Device =3D UsbDebugPort.PciAddress.Device; >=20 > - Function =3D UsbDebugPort.PciAddress.Function; >=20 > - Low =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADD= RESSREG_OFFSET)); >=20 > - High =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_AD= DRESSREG_OFFSET + 4)); >=20 > - Address =3D (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Lo= w); >=20 > - >=20 > - // >=20 > - // Mask other parts which are not part of base address >=20 > - // >=20 > - Address &=3D XHCI_BASE_ADDRESS_64_BIT_MASK; >=20 > - return Address; >=20 > -} >=20 > - >=20 > -/** >=20 > - Return XHCI debug instance address. >=20 > - >=20 > -**/ >=20 > -USB3_DEBUG_PORT_INSTANCE * >=20 > -GetUsb3DebugPortInstance ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - USB3_DEBUG_PORT_INSTANCE *Instance; >=20 > - EFI_PEI_HOB_POINTERS Hob; >=20 > - EFI_PHYSICAL_ADDRESS XhcMmioBase; >=20 > - >=20 > - Hob.Raw =3D GetFirstGuidHob (&gUsb3DbgGuid); >=20 > - if (Hob.Raw =3D=3D NULL) { >=20 > - return NULL; >=20 > - } >=20 > - Instance =3D GET_GUID_HOB_DATA (Hob.Guid); >=20 > - >=20 > - // >=20 > - // Update XHCI MMIO base address >=20 > - // >=20 > - XhcMmioBase =3D GetXhciBaseAddress (); >=20 > - >=20 > - FixUsb3InstanceResource (Instance, XhcMmioBase); >=20 > - >=20 > - return Instance; >=20 > -} >=20 > - >=20 > -/** >=20 > - Initialize USB3 debug port. >=20 > - >=20 > - This method invokes various internal functions to facilitate >=20 > - detection and initialization of USB3 debug port. >=20 > - >=20 > - @retval RETURN_SUCCESS The serial device was initialized. >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -EFIAPI >=20 > -USB3Initialize ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Initialize USB3 debug port. >=20 > - >=20 > - This method invokes various internal functions to facilitate >=20 > - detection and initialization of USB3 debug port. >=20 > - >=20 > - @retval RETURN_SUCCESS The serial device was initialized. >=20 > -**/ >=20 > -RETURN_STATUS >=20 > -EFIAPI >=20 > -USB3InitializeReal ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - USB3_DEBUG_PORT_INSTANCE UsbDbg; >=20 > - VOID *DataPtr; >=20 > - EFI_PEI_HOB_POINTERS Hob; >=20 > - CONST EFI_PEI_SERVICES **PeiServices; >=20 > - >=20 > - PeiServices =3D GetPeiServicesTablePointer (); >=20 > - >=20 > - // >=20 > - // USB Initilization has to be done only once. So this function should= just return when >=20 > - // it is called more than once. >=20 > - // >=20 > - Hob.Raw =3D GetFirstGuidHob (&gUsb3DbgGuid); >=20 > - if (Hob.Raw !=3D NULL) { >=20 > - return RETURN_SUCCESS; >=20 > - } >=20 > - >=20 > - // >=20 > - // Initialize USB debug for PEI at the first time >=20 > - // >=20 > - SetMem (&UsbDbg, sizeof(UsbDbg), 0); >=20 > - UsbDbg.FromHob =3D TRUE; >=20 > - DiscoverUsb3DebugPort (&UsbDbg); >=20 > - if (UsbDbg.DebugSupport) { >=20 > - InitializeUsb3DebugPort (&UsbDbg); >=20 > - } >=20 > - >=20 > - if (UsbDbg.Ready && (Usb3GetIoMmu () =3D=3D NULL)) { >=20 > - Status =3D (*PeiServices)->NotifyPpi (PeiServices, &mUsb3IoMmuPpiNot= ifyDesc); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - } >=20 > - >=20 > - // >=20 > - // Save Instance into HOB >=20 > - // >=20 > - DataPtr =3D BuildGuidDataHob ( >=20 > - &gUsb3DbgGuid, >=20 > - (VOID*) &UsbDbg, >=20 > - sizeof (UsbDbg) >=20 > - ); >=20 > - >=20 > - if (UsbDbg.DebugSupport) { >=20 > - SaveUsb3InstanceAddress ((USB3_DEBUG_PORT_INSTANCE *) DataPtr); >=20 > - } >=20 > - >=20 > - return RETURN_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Allocate aligned memory for XHC's usage. >=20 > - >=20 > - @param BufferSize The size, in bytes, of the Buffer. >=20 > - >=20 > - @return A pointer to the allocated buffer or NULL if allocation fails. >=20 > - >=20 > -**/ >=20 > -VOID* >=20 > -AllocateAlignBuffer ( >=20 > - IN UINTN BufferSize >=20 > - ) >=20 > -{ >=20 > - VOID *Buf; >=20 > - EFI_PHYSICAL_ADDRESS Address; >=20 > - CONST EFI_PEI_SERVICES **PeiServices; >=20 > - EFI_STATUS Status; >=20 > - VOID *MemoryDiscoveredPpi; >=20 > - EDKII_IOMMU_PPI *IoMmu; >=20 > - VOID *HostAddress; >=20 > - VOID *Mapping; >=20 > - >=20 > - Buf =3D NULL; >=20 > - PeiServices =3D GetPeiServicesTablePointer (); >=20 > - >=20 > - // >=20 > - // Make sure the allocated memory is physical memory. >=20 > - // >=20 > - Status =3D (*PeiServices)->LocatePpi ( >=20 > - PeiServices, >=20 > - &gEfiPeiMemoryDiscoveredPpiGuid, >=20 > - 0, >=20 > - NULL, >=20 > - (VOID **) &MemoryDiscoveredPpi >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - IoMmu =3D Usb3GetIoMmu (); >=20 > - if (IoMmu !=3D NULL) { >=20 > - Status =3D IoMmuAllocateBuffer ( >=20 > - IoMmu, >=20 > - EFI_SIZE_TO_PAGES (BufferSize), >=20 > - &HostAddress, >=20 > - &Address, >=20 > - &Mapping >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - ASSERT (Address =3D=3D ((EFI_PHYSICAL_ADDRESS) (UINTN) HostAddre= ss)); >=20 > - Buf =3D (VOID *)(UINTN) Address; >=20 > - } >=20 > - } else { >=20 > - Status =3D (*PeiServices)->AllocatePages ( >=20 > - PeiServices, >=20 > - EfiACPIMemoryNVS, >=20 > - EFI_SIZE_TO_PAGES (BufferSize), >=20 > - &Address >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - Buf =3D (VOID *)(UINTN) Address; >=20 > - } >=20 > - } >=20 > - } >=20 > - return Buf; >=20 > -} >=20 > - >=20 > -/** >=20 > - Check whether AllocatePages in permanent memory is ready. >=20 > - >=20 > - @retval TRUE AllocatePages in permanent memory is ready. >=20 > - @retval FALSE AllocatePages in permanent memory is not ready. >=20 > - >=20 > -**/ >=20 > -BOOLEAN >=20 > -IsAllocatePagesReady ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - CONST EFI_PEI_SERVICES **PeiServices; >=20 > - EFI_STATUS Status; >=20 > - VOID *MemoryDiscoveredPpi; >=20 > - EDKII_IOMMU_PPI *IoMmu; >=20 > - VOID *HostAddress; >=20 > - >=20 > - PeiServices =3D GetPeiServicesTablePointer (); >=20 > - >=20 > - // >=20 > - // Make sure the allocated memory is physical memory. >=20 > - // >=20 > - Status =3D (*PeiServices)->LocatePpi ( >=20 > - PeiServices, >=20 > - &gEfiPeiMemoryDiscoveredPpiGuid, >=20 > - 0, >=20 > - NULL, >=20 > - (VOID **) &MemoryDiscoveredPpi >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - Status =3D (*PeiServices)->LocatePpi ( >=20 > - PeiServices, >=20 > - &gEdkiiIoMmuPpiGuid, >=20 > - 0, >=20 > - NULL, >=20 > - (VOID **) &IoMmu >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - Status =3D IoMmu->AllocateBuffer ( >=20 > - IoMmu, >=20 > - EfiRuntimeServicesData, >=20 > - 1, >=20 > - &HostAddress, >=20 > - 0 >=20 > - ); >=20 > - if (EFI_ERROR (Status)) { >=20 > - // >=20 > - // DMA protection has been enabled, >=20 > - // but DMA buffer could not be allocated yet. >=20 > - // >=20 > - return FALSE; >=20 > - } >=20 > - IoMmu->FreeBuffer ( >=20 > - IoMmu, >=20 > - 1, >=20 > - HostAddress >=20 > - ); >=20 > - } >=20 > - return TRUE; >=20 > - } >=20 > - >=20 > - return FALSE; >=20 > -} >=20 > - >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3= DebugPortLibPeiIoMmu.inf > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLi= bPeiIoMmu.inf > deleted file mode 100644 > index f27c23faab..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPo= rtLibPeiIoMmu.inf > +++ /dev/null > @@ -1,51 +0,0 @@ > -## @file >=20 > -# Usb3 debug port library. >=20 > -# >=20 > -# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D USB3DebugPortLibPeiIoMmu >=20 > - FILE_GUID =3D C973C5E8-A0D8-4FEE-A0F0-7DA6C3C7245= 1 >=20 > - MODULE_TYPE =3D PEIM >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D Usb3DebugPortLib|PEIM PEI_CORE >=20 > - >=20 > -# >=20 > -# The following information is for reference only and not required by th= e build tools. >=20 > -# >=20 > -# VALID_ARCHITECTURES =3D IA32 X64 IPF >=20 > -# >=20 > - >=20 > -[Sources] >=20 > - Usb3DebugPortLibPeiIoMmu.c >=20 > - Usb3DebugPortDataTransfer.c >=20 > - Usb3DebugPortInitialize.c >=20 > - MiscServices.c >=20 > - Usb3DebugPortLibInternal.h >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - DebugFeaturePkg/DebugFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - BaseLib >=20 > - PcdLib >=20 > - IoLib >=20 > - PciLib >=20 > - TimerLib >=20 > - HobLib >=20 > - Usb3DebugPortParameterLib >=20 > - PeiServicesTablePointerLib >=20 > - >=20 > -[Ppis] >=20 > - gEfiPeiMemoryDiscoveredPpiGuid ## CONSUMES >=20 > - gEdkiiIoMmuPpiGuid ## SOMETIMES_CONSUMES >=20 > - >=20 > -[Pcd] >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SO= METIMES_CONSUMES >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CO= NSUMES >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParamete= rLibPcd/Usb3DebugPortParameterLibPcd.c > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb= 3DebugPortParameterLibPcd.c > deleted file mode 100644 > index 747c5dccc9..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd= /Usb3DebugPortParameterLibPcd.c > +++ /dev/null > @@ -1,58 +0,0 @@ > -/** @file >=20 > - USB3 debug Port Parameter library instance based on PCD. >=20 > - >=20 > - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -/** >=20 > - Returns the USB3 debug port controller. >=20 > - bit: 0~ 7: Function >=20 > - bit: 8~15: Device >=20 > - bit: 16~24: Bus >=20 > - >=20 > - @return Controller information of USB debug port. >=20 > - >=20 > -**/ >=20 > -UINT32 >=20 > -EFIAPI >=20 > -GetUsb3DebugPortController ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; >=20 > - >=20 > - UsbDebugPort.Controller =3D 0; >=20 > - UsbDebugPort.PciAddress.Bus =3D PcdGet8(PcdUsbSerialXhciBus); >=20 > - UsbDebugPort.PciAddress.Device =3D PcdGet8(PcdUsbSerialXhciDev); >=20 > - UsbDebugPort.PciAddress.Function =3D PcdGet8(PcdUsbSerialXhciFunc); >=20 > - >=20 > - return UsbDebugPort.Controller; >=20 > -} >=20 > - >=20 > -/** >=20 > - Sets the USB debug port controller. >=20 > - bit: 0~ 7: Function >=20 > - bit: 8~15: Device >=20 > - bit: 16~24: Bus >=20 > - >=20 > - @param[in] Controller information of USB debug port value to be set= . >=20 > - >=20 > - @retval TRUE The controller of USB debug port was sucessful= ly set. >=20 > - @retval FALSE The controller of USB debug port could not be = set. >=20 > - >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -SetUsb3DebugPortController ( >=20 > - UINT32 Controller >=20 > - ) >=20 > -{ >=20 > - return FALSE; >=20 > -} >=20 > diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParamete= rLibPcd/Usb3DebugPortParameterLibPcd.inf > b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb= 3DebugPortParameterLibPcd.inf > deleted file mode 100644 > index 09f44920f6..0000000000 > --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd= /Usb3DebugPortParameterLibPcd.inf > +++ /dev/null > @@ -1,31 +0,0 @@ > -## @file >=20 > -# USB3 debug Port Parameter library instance based on PCD. >=20 > -# >=20 > -# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D Usb3DebugPortParameterLibPcd >=20 > - FILE_GUID =3D 4990A700-4002-4d08-8E00-62272003266= 2 >=20 > - MODULE_TYPE =3D BASE >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D Usb3DebugPortParameterLib >=20 > - >=20 > -[Sources] >=20 > - Usb3DebugPortParameterLibPcd.c >=20 > - >=20 > -[LibraryClasses] >=20 > - BaseLib >=20 > - DebugLib >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - DebugFeaturePkg/DebugFeaturePkg.dec >=20 > - >=20 > -[Pcd] >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciBus ## CONSUMES >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciDev ## CONSUMES >=20 > - gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciFunc ## CONSUMES >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuth= entication.h > b/Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthentication.= h > deleted file mode 100644 > index 2a41a46cdc..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthenticat= ion.h > +++ /dev/null > @@ -1,45 +0,0 @@ > -/** @file >=20 > - GUID is for UserAuthentication SMM communication. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef __USER_AUTHENTICATION_GUID_H__ >=20 > -#define __USER_AUTHENTICATION_GUID_H__ >=20 > - >=20 > -#define PASSWORD_MIN_SIZE 9 // MIN number of chars of password, incl= uding NULL. >=20 > -#define PASSWORD_MAX_SIZE 33 // MAX number of chars of password, incl= uding NULL. >=20 > - >=20 > -#define USER_AUTHENTICATION_GUID \ >=20 > - { 0xf06e3ea7, 0x611c, 0x4b6b, { 0xb4, 0x10, 0xc2, 0xbf, 0x94, 0x3f, 0x= 38, 0xf2 } } >=20 > - >=20 > -extern EFI_GUID gUserAuthenticationGuid; >=20 > - >=20 > -typedef struct { >=20 > - UINTN Function; >=20 > - EFI_STATUS ReturnStatus; >=20 > -} SMM_PASSWORD_COMMUNICATE_HEADER; >=20 > - >=20 > -#define SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET 1 >=20 > -#define SMM_PASSWORD_FUNCTION_SET_PASSWORD 2 >=20 > -#define SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD 3 >=20 > -#define SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY 4 >=20 > -#define SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY 5 >=20 > -#define SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED 6 >=20 > - >=20 > -typedef struct { >=20 > - CHAR8 NewPassword[PASSWORD_MAX_SIZE]; >=20 > - CHAR8 OldPassword[PASSWORD_MAX_SIZE]; >=20 > -} SMM_PASSWORD_COMMUNICATE_SET_PASSWORD; >=20 > - >=20 > -typedef struct { >=20 > - CHAR8 Password[PASSWORD_MAX_SIZE]; >=20 > -} SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD; >=20 > - >=20 > -typedef struct { >=20 > - BOOLEAN NeedReVerify; >=20 > -} SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY; >=20 > - >=20 > -#endif >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/Platf= ormPasswordLib.h > b/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/PlatformPassword= Lib.h > deleted file mode 100644 > index ce27947f6d..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/PlatformPass= wordLib.h > +++ /dev/null > @@ -1,48 +0,0 @@ > -/** @file >=20 > - Provides a platform-specific method to return password policy. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef __PLATFORM_PASSWORD_LIB_H__ >=20 > -#define __PLATFORM_PASSWORD_LIB_H__ >=20 > - >=20 > -/** >=20 > - This function is called at password driver entrypoint. >=20 > - This function should be called only once, to clear the password. >=20 > - >=20 > - This function provides a way to reset the password, just in case >=20 > - the platform owner forgets the password. >=20 > - The platform should provide a secure way to make sure >=20 > - only the platform owner is allowed to clear password. >=20 > - >=20 > - Once the password is cleared, the platform should provide a way >=20 > - to set a new password. >=20 > - >=20 > - @retval TRUE There is a platform request to clear the password. >=20 > - @retval FALSE There is no platform request to clear the password. >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -IsPasswordCleared ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -/** >=20 > - This function is called if the password driver finds that the password= is not enrolled, >=20 > - when the password is required to input. >=20 > - >=20 > - This function should return the action according to platform policy. >=20 > - >=20 > - @retval TRUE The caller should force the user to enroll the password. >=20 > - @retval FALSE The caller may skip the password enroll. >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -NeedEnrollPassword ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -#endif >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserP= asswordLib.h > b/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordLib.= h > deleted file mode 100644 > index b6aad224e9..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPassword= Lib.h > +++ /dev/null > @@ -1,70 +0,0 @@ > -/** @file >=20 > - Provides services to set/verify password and return if the password is= set. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef __USER_PASSWORD_LIB_H__ >=20 > -#define __USER_PASSWORD_LIB_H__ >=20 > - >=20 > -/** >=20 > - Validate if the password is correct. >=20 > - >=20 > - @param[in] Password The user input password. >=20 > - @param[in] PasswordSize The size of Password in byte. >=20 > - >=20 > - @retval EFI_SUCCESS The password is correct. >=20 > - @retval EFI_SECURITY_VIOLATION The password is incorrect. >=20 > - @retval EFI_INVALID_PARAMETER The password or size is invalid. >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the= password. >=20 > - @retval EFI_ACCESS_DENIED Password retry count reach. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -VerifyPassword ( >=20 > - IN CHAR16 *Password, >=20 > - IN UINTN PasswordSize >=20 > - ); >=20 > - >=20 > -/** >=20 > - Set a new password. >=20 > - >=20 > - @param[in] NewPassword The user input new password. >=20 > - NULL means clear password. >=20 > - @param[in] NewPasswordSize The size of NewPassword in byte. >=20 > - @param[in] OldPassword The user input old password. >=20 > - NULL means no old password. >=20 > - @param[in] OldPasswordSize The size of OldPassword in byte. >=20 > - >=20 > - @retval EFI_SUCCESS The NewPassword is set successfully. >=20 > - @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect. >=20 > - @retval EFI_INVALID_PARAMETER The password or size is invalid. >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the pa= ssword. >=20 > - @retval EFI_ACCESS_DENIED Password retry count reach. >=20 > - @retval EFI_UNSUPPORTED NewPassword is not strong enough. >=20 > - @retval EFI_ALREADY_STARTED NewPassword is in history. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -SetPassword ( >=20 > - IN CHAR16 *NewPassword, OPTIONAL >=20 > - IN UINTN NewPasswordSize, >=20 > - IN CHAR16 *OldPassword, OPTIONAL >=20 > - IN UINTN OldPasswordSize >=20 > - ); >=20 > - >=20 > -/** >=20 > - Return if the password is set. >=20 > - >=20 > - @retval TRUE The password is set. >=20 > - @retval FALSE The password is not set. >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -IsPasswordInstalled ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -#endif >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserP= asswordUiLib.h > b/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordUiLi= b.h > deleted file mode 100644 > index 117f480733..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPassword= UiLib.h > +++ /dev/null > @@ -1,37 +0,0 @@ > -/** @file >=20 > - Provides services to do password authentication. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef __USER_PASSWORD_UI_LIB_H__ >=20 > -#define __USER_PASSWORD_UI_LIB_H__ >=20 > - >=20 > -/** >=20 > - Do password authentication. >=20 > - >=20 > - @retval EFI_SUCCESS Password authentication pass. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -UiDoPasswordAuthentication ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -/** >=20 > - Set password verification policy. >=20 > - >=20 > - @param[in] NeedReVerify Need re-verify or not. >=20 > - >=20 > - @retval EFI_SUCCESS Set verification policy successfully= . >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to set verifi= cation policy. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -UiSetPasswordVerificationPolicy ( >=20 > - IN BOOLEAN NeedReVerify >=20 > - ); >=20 > - >=20 > -#endif >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPassw= ordLibNull/PlatformPasswordLibNull.c > b/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/= PlatformPasswordLibNull.c > deleted file mode 100644 > index 08e081aa99..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibN= ull/PlatformPasswordLibNull.c > +++ /dev/null > @@ -1,78 +0,0 @@ > -/** @file >=20 > - NULL PlatformPasswordLib instance does NOT really detect whether the p= assword is cleared >=20 > - but returns the PCD value directly. This instance can be used to verif= y security >=20 > - related features during platform enabling and development. It should b= e replaced >=20 > - by a platform-specific method(e.g. Button pressed) in a real platform = for product. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -BOOLEAN mPasswordCleared =3D FALSE; >=20 > - >=20 > -/** >=20 > - This function is called at password driver entrypoint. >=20 > - This function should be called only once, to clear the password. >=20 > - >=20 > - This function provides a way to reset the password, just in case >=20 > - the platform owner forgets the password. >=20 > - The platform should provide a secure way to make sure >=20 > - only the platform owner is allowed to clear password. >=20 > - >=20 > - Once the password is cleared, the platform should provide a way >=20 > - to set a new password. >=20 > - >=20 > - @retval TRUE There is a platform request to clear the password. >=20 > - @retval FALSE There is no platform request to clear the password. >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -IsPasswordCleared ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - return mPasswordCleared; >=20 > -} >=20 > - >=20 > -/** >=20 > - This function is called if the password driver finds that the password= is not enrolled, >=20 > - when the password is required to input. >=20 > - >=20 > - This function should return the action according to platform policy. >=20 > - >=20 > - @retval TRUE The caller should force the user to enroll the password. >=20 > - @retval FALSE The caller may skip the password enroll. >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -NeedEnrollPassword ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - return FALSE; >=20 > -} >=20 > - >=20 > - >=20 > -/** >=20 > - Save password clear state from a PCD to mPasswordCleared. >=20 > - >=20 > - @param ImageHandle ImageHandle of the loaded driver. >=20 > - @param SystemTable Pointer to the EFI System Table. >=20 > - >=20 > - @retval EFI_SUCCESS PcdPasswordCleared is got successfully. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -PlatformPasswordLibNullConstructor ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -{ >=20 > - >=20 > - mPasswordCleared =3D PcdGetBool(PcdPasswordCleared); >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPassw= ordLibNull/PlatformPasswordLibNull.inf > b/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/= PlatformPasswordLibNull.inf > deleted file mode 100644 > index 6f4e40f174..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibN= ull/PlatformPasswordLibNull.inf > +++ /dev/null > @@ -1,39 +0,0 @@ > -## @file >=20 > -# NULL platform password library instance that returns the password cle= ar state based upon PCD. >=20 > -# >=20 > -# NULL PlatformPasswordLib instance does NOT really detect whether the = password is cleared >=20 > -# but returns the PCD value directly. This instance can be used to veri= fy security >=20 > -# related features during platform enabling and development. It should = be replaced >=20 > -# by a platform-specific method(e.g. Button pressed) in a real platform= for product. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010006 >=20 > - BASE_NAME =3D PlatformPasswordLibNull >=20 > - MODULE_UNI_FILE =3D PlatformPasswordLibNull.uni >=20 > - FILE_GUID =3D 27417BCA-0CCD-4089-9711-AD069A33C55= 5 >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D PlatformPasswordLib|DXE_RUNTIME_DRI= VER DXE_SMM_DRIVER DXE_DRIVER >=20 > - CONSTRUCTOR =3D PlatformPasswordLibNullConstructor >=20 > - >=20 > -# >=20 > -# The following information is for reference only and not required by th= e build tools. >=20 > -# >=20 > -# VALID_ARCHITECTURES =3D IA32 X64 EBC >=20 > -# >=20 > - >=20 > -[Sources] >=20 > - PlatformPasswordLibNull.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec >=20 > - >=20 > -[Pcd] >=20 > - gEfiUserInterfaceFeaturePkgTokenSpaceGuid.PcdPasswordCleared ## CON= SUMES >=20 > - >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPassw= ordLibNull/PlatformPasswordLibNull.uni > b/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/= PlatformPasswordLibNull.uni > deleted file mode 100644 > index b0255889e0..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibN= ull/PlatformPasswordLibNull.uni > +++ /dev/null > @@ -1,19 +0,0 @@ > -// /** @file >=20 > -// NULL platform password library instance that returns the password cle= ar state based upon PCD. >=20 > -// >=20 > -// NULL PlatformPasswordLib instance does NOT really detect whether the = password is cleared >=20 > -// but returns the PCD value directly. This instance can be used to veri= fy security >=20 > -// related features during platform enabling and development. It should = be replaced >=20 > -// by a platform-specific method(e.g. Button pressed) in a real platform= for product. >=20 > -// >=20 > -// Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -// >=20 > -// SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -// >=20 > -// **/ >=20 > - >=20 > - >=20 > -#string STR_MODULE_ABSTRACT #language en-US "NULL platform p= assword library instance that returns the > password clear state based upon PCD." >=20 > - >=20 > -#string STR_MODULE_DESCRIPTION #language en-US "NULL PlatformPa= sswordLib 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." >=20 > - >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordL= ib/UserPasswordLib.c > b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPass= wordLib.c > deleted file mode 100644 > index cbaf572378..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/User= PasswordLib.c > +++ /dev/null > @@ -1,274 +0,0 @@ > -/** @file >=20 > - UserPasswordLib instance implementation provides services to >=20 > - set/verify password and return if the password is set. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -/** >=20 > - Initialize the communicate buffer using DataSize and Function. >=20 > - >=20 > - @param[out] DataPtr Points to the data in the communicat= e buffer. >=20 > - @param[in] DataSize The data size to send to SMM. >=20 > - @param[in] Function The function number to initialize th= e communicate header. >=20 > - >=20 > - @return Communicate buffer. >=20 > -**/ >=20 > -VOID* >=20 > -UserPasswordLibInitCommunicateBuffer ( >=20 > - OUT VOID **DataPtr OPTIONAL, >=20 > - IN UINTN DataSize, >=20 > - IN UINTN Function >=20 > - ) >=20 > -{ >=20 > - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; >=20 > - SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader; >=20 > - VOID *Buffer; >=20 > - EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable; >=20 > - EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion; >=20 > - UINTN Index; >=20 > - UINTN Size; >=20 > - EFI_STATUS Status; >=20 > - >=20 > - Buffer =3D NULL; >=20 > - Status =3D EfiGetSystemConfigurationTable ( >=20 > - &gEdkiiPiSmmCommunicationRegionTableGuid, >=20 > - (VOID **) &SmmCommRegionTable >=20 > - ); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return NULL; >=20 > - } >=20 > - ASSERT (SmmCommRegionTable !=3D NULL); >=20 > - SmmCommMemRegion =3D (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1= ); >=20 > - Size =3D 0; >=20 > - for (Index =3D 0; Index < SmmCommRegionTable->NumberOfEntries; Index++= ) { >=20 > - if (SmmCommMemRegion->Type =3D=3D EfiConventionalMemory) { >=20 > - Size =3D EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPage= s); >=20 > - if (Size >=3D (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, D= ata) + sizeof > (SMM_PASSWORD_COMMUNICATE_HEADER))) { >=20 > - break; >=20 > - } >=20 > - } >=20 > - SmmCommMemRegion =3D (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMem= Region + SmmCommRegionTable- > >DescriptorSize); >=20 > - } >=20 > - ASSERT (Index < SmmCommRegionTable->NumberOfEntries); >=20 > - >=20 > - Buffer =3D (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart; >=20 > - ASSERT (Buffer !=3D NULL); >=20 > - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) Buffer; >=20 > - CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid)= ; >=20 > - SmmCommunicateHeader->MessageLength =3D DataSize + sizeof (SMM_PASSWOR= D_COMMUNICATE_HEADER); >=20 > - >=20 > - SmmPasswordFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmC= ommunicateHeader->Data; >=20 > - ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_CO= MMUNICATE_HEADER)); >=20 > - SmmPasswordFunctionHeader->Function =3D Function; >=20 > - if (DataPtr !=3D NULL) { >=20 > - *DataPtr =3D SmmPasswordFunctionHeader + 1; >=20 > - } >=20 > - >=20 > - return Buffer; >=20 > -} >=20 > - >=20 > -/** >=20 > - Send the data in communicate buffer to SMM. >=20 > - >=20 > - @param[in] Buffer Points to the data in the communic= ate buffer. >=20 > - @param[in] DataSize The data size to send to SMM. >=20 > - >=20 > - @retval EFI_SUCCESS Success is returned from the funct= ion in SMM. >=20 > - @retval Others Failure is returned from the funct= ion in SMM. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -UserPasswordLibSendCommunicateBuffer ( >=20 > - IN VOID *Buffer, >=20 > - IN UINTN DataSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINTN CommSize; >=20 > - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; >=20 > - SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader; >=20 > - EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication; >=20 > - >=20 > - // >=20 > - // Locates SMM Communication protocol. >=20 > - // >=20 > - Status =3D gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NUL= L, (VOID **) &SmmCommunication); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - CommSize =3D DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) += sizeof > (SMM_PASSWORD_COMMUNICATE_HEADER); >=20 > - >=20 > - Status =3D SmmCommunication->Communicate (SmmCommunication, Buffer, &C= ommSize); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) Buffer; >=20 > - SmmPasswordFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCo= mmunicateHeader->Data; >=20 > - return SmmPasswordFunctionHeader->ReturnStatus; >=20 > -} >=20 > - >=20 > -/** >=20 > - Validate if the password is correct. >=20 > - >=20 > - @param[in] Password The user input password. >=20 > - @param[in] PasswordSize The size of Password in byte. >=20 > - >=20 > - @retval EFI_SUCCESS The password is correct. >=20 > - @retval EFI_SECURITY_VIOLATION The password is incorrect. >=20 > - @retval EFI_INVALID_PARAMETER The password or size is invalid. >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the= password. >=20 > - @retval EFI_ACCESS_DENIED Password retry count reach. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -VerifyPassword ( >=20 > - IN CHAR16 *Password, >=20 > - IN UINTN PasswordSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - VOID *Buffer; >=20 > - SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD *VerifyPassword; >=20 > - >=20 > - ASSERT (Password !=3D NULL); >=20 > - >=20 > - if (PasswordSize > sizeof(VerifyPassword->Password) * sizeof(CHAR16)) = { >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - >=20 > - Buffer =3D UserPasswordLibInitCommunicateBuffer ( >=20 > - (VOID**)&VerifyPassword, >=20 > - sizeof(*VerifyPassword), >=20 > - SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD >=20 > - ); >=20 > - if (Buffer =3D=3D NULL) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - Status =3D UnicodeStrToAsciiStrS (Password, VerifyPassword->Password, = sizeof(VerifyPassword->Password)); >=20 > - if (EFI_ERROR(Status)) { >=20 > - goto EXIT; >=20 > - } >=20 > - >=20 > - Status =3D UserPasswordLibSendCommunicateBuffer (Buffer, sizeof(*Verif= yPassword)); >=20 > - >=20 > -EXIT: >=20 > - ZeroMem (VerifyPassword, sizeof(*VerifyPassword)); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Set a new password. >=20 > - >=20 > - @param[in] NewPassword The user input new password. >=20 > - NULL means clear password. >=20 > - @param[in] NewPasswordSize The size of NewPassword in byte. >=20 > - @param[in] OldPassword The user input old password. >=20 > - NULL means no old password. >=20 > - @param[in] OldPasswordSize The size of OldPassword in byte. >=20 > - >=20 > - @retval EFI_SUCCESS The NewPassword is set successfully. >=20 > - @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect. >=20 > - @retval EFI_INVALID_PARAMETER The password or size is invalid. >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the pa= ssword. >=20 > - @retval EFI_ACCESS_DENIED Password retry count reach. >=20 > - @retval EFI_UNSUPPORTED NewPassword is not strong enough. >=20 > - @retval EFI_ALREADY_STARTED NewPassword is in history. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -SetPassword ( >=20 > - IN CHAR16 *NewPassword, OPTIONAL >=20 > - IN UINTN NewPasswordSize, >=20 > - IN CHAR16 *OldPassword, OPTIONAL >=20 > - IN UINTN OldPasswordSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - VOID *Buffer; >=20 > - SMM_PASSWORD_COMMUNICATE_SET_PASSWORD *SetPassword; >=20 > - >=20 > - if (NewPasswordSize > sizeof(SetPassword->NewPassword) * sizeof(CHAR16= )) { >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - if (OldPasswordSize > sizeof(SetPassword->OldPassword) * sizeof(CHAR16= )) { >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - >=20 > - Buffer =3D UserPasswordLibInitCommunicateBuffer ( >=20 > - (VOID**)&SetPassword, >=20 > - sizeof(*SetPassword), >=20 > - SMM_PASSWORD_FUNCTION_SET_PASSWORD >=20 > - ); >=20 > - if (Buffer =3D=3D NULL) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - if (NewPassword !=3D NULL) { >=20 > - Status =3D UnicodeStrToAsciiStrS (NewPassword, SetPassword->NewPassw= ord, sizeof(SetPassword->NewPassword)); >=20 > - if (EFI_ERROR(Status)) { >=20 > - goto EXIT; >=20 > - } >=20 > - } else { >=20 > - SetPassword->NewPassword[0] =3D 0; >=20 > - } >=20 > - >=20 > - if (OldPassword !=3D NULL) { >=20 > - Status =3D UnicodeStrToAsciiStrS (OldPassword, SetPassword->OldPassw= ord, sizeof(SetPassword->OldPassword)); >=20 > - if (EFI_ERROR(Status)) { >=20 > - goto EXIT; >=20 > - } >=20 > - } else { >=20 > - SetPassword->OldPassword[0] =3D 0; >=20 > - } >=20 > - >=20 > - Status =3D UserPasswordLibSendCommunicateBuffer (Buffer, sizeof(*SetPa= ssword)); >=20 > - >=20 > -EXIT: >=20 > - ZeroMem (SetPassword, sizeof(*SetPassword)); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Return if the password is set. >=20 > - >=20 > - @retval TRUE The password is set. >=20 > - @retval FALSE The password is not set. >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -IsPasswordInstalled ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - VOID *Buffer; >=20 > - >=20 > - Buffer =3D UserPasswordLibInitCommunicateBuffer ( >=20 > - NULL, >=20 > - 0, >=20 > - SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET >=20 > - ); >=20 > - if (Buffer =3D=3D NULL) { >=20 > - return FALSE; >=20 > - } >=20 > - >=20 > - Status =3D UserPasswordLibSendCommunicateBuffer (Buffer, 0); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return FALSE; >=20 > - } >=20 > - >=20 > - return TRUE; >=20 > -} >=20 > - >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordL= ib/UserPasswordLib.inf > b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPass= wordLib.inf > deleted file mode 100644 > index 6dc6ca734f..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/User= PasswordLib.inf > +++ /dev/null > @@ -1,37 +0,0 @@ > -## @file >=20 > -# UserPasswordLib instance provides services to set/verify password >=20 > -# and return if the password is set. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D UserPasswordLib >=20 > - FILE_GUID =3D 422BA58A-F162-4ECC-BD9A-AD84FE940F3= 7 >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D UserPasswordLib|DXE_RUNTIME_DRIVER = DXE_SMM_DRIVER DXE_DRIVER UEFI_APPLICATION >=20 > - >=20 > -[Sources] >=20 > - UserPasswordLib.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - UefiBootServicesTableLib >=20 > - DebugLib >=20 > - UefiLib >=20 > - BaseMemoryLib >=20 > - >=20 > -[Guids] >=20 > - gUserAuthenticationGuid ## CONSUMES ## GUID >=20 > - gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTa= ble >=20 > - >=20 > -[Protocols] >=20 > - gEfiSmmCommunicationProtocolGuid ## CONSUMES >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordU= iLib/UserPasswordUiLib.c > b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPa= sswordUiLib.c > deleted file mode 100644 > index 050bfda63a..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/Us= erPasswordUiLib.c > +++ /dev/null > @@ -1,522 +0,0 @@ > -/** @file >=20 > - UserPasswordUiLib instance provides services to do password authentica= tion. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -/** >=20 > - Initialize the communicate buffer using DataSize and Function. >=20 > - >=20 > - @param[out] DataPtr Points to the data in the communicat= e buffer. >=20 > - @param[in] DataSize The data size to send to SMM. >=20 > - @param[in] Function The function number to initialize th= e communicate header. >=20 > - >=20 > - @return Communicate buffer. >=20 > -**/ >=20 > -VOID* >=20 > -UserPasswordUiLibInitCommunicateBuffer ( >=20 > - OUT VOID **DataPtr OPTIONAL, >=20 > - IN UINTN DataSize, >=20 > - IN UINTN Function >=20 > - ) >=20 > -{ >=20 > - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; >=20 > - SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader; >=20 > - VOID *Buffer; >=20 > - EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable; >=20 > - EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion; >=20 > - UINTN Index; >=20 > - UINTN Size; >=20 > - EFI_STATUS Status; >=20 > - >=20 > - Buffer =3D NULL; >=20 > - Status =3D EfiGetSystemConfigurationTable ( >=20 > - &gEdkiiPiSmmCommunicationRegionTableGuid, >=20 > - (VOID **) &SmmCommRegionTable >=20 > - ); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return NULL; >=20 > - } >=20 > - ASSERT (SmmCommRegionTable !=3D NULL); >=20 > - SmmCommMemRegion =3D (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1= ); >=20 > - Size =3D 0; >=20 > - for (Index =3D 0; Index < SmmCommRegionTable->NumberOfEntries; Index++= ) { >=20 > - if (SmmCommMemRegion->Type =3D=3D EfiConventionalMemory) { >=20 > - Size =3D EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPage= s); >=20 > - if (Size >=3D (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, D= ata) + sizeof > (SMM_PASSWORD_COMMUNICATE_HEADER))) { >=20 > - break; >=20 > - } >=20 > - } >=20 > - SmmCommMemRegion =3D (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMem= Region + SmmCommRegionTable- > >DescriptorSize); >=20 > - } >=20 > - ASSERT (Index < SmmCommRegionTable->NumberOfEntries); >=20 > - >=20 > - Buffer =3D (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart; >=20 > - ASSERT (Buffer !=3D NULL); >=20 > - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) Buffer; >=20 > - CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid)= ; >=20 > - SmmCommunicateHeader->MessageLength =3D DataSize + sizeof (SMM_PASSWOR= D_COMMUNICATE_HEADER); >=20 > - >=20 > - SmmPasswordFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmC= ommunicateHeader->Data; >=20 > - ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_CO= MMUNICATE_HEADER)); >=20 > - SmmPasswordFunctionHeader->Function =3D Function; >=20 > - if (DataPtr !=3D NULL) { >=20 > - *DataPtr =3D SmmPasswordFunctionHeader + 1; >=20 > - } >=20 > - >=20 > - return Buffer; >=20 > -} >=20 > - >=20 > -/** >=20 > - Send the data in communicate buffer to SMM. >=20 > - >=20 > - @param[in] Buffer Points to the data in the communic= ate buffer. >=20 > - @param[in] DataSize The data size to send to SMM. >=20 > - >=20 > - @retval EFI_SUCCESS Success is returned from the funct= ion in SMM. >=20 > - @retval Others Failure is returned from the funct= ion in SMM. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -UserPasswordUiLibSendCommunicateBuffer ( >=20 > - IN VOID *Buffer, >=20 > - IN UINTN DataSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINTN CommSize; >=20 > - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; >=20 > - SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader; >=20 > - EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication; >=20 > - >=20 > - // >=20 > - // Locates SMM Communication protocol. >=20 > - // >=20 > - Status =3D gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NUL= L, (VOID **) &SmmCommunication); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - CommSize =3D DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) += sizeof > (SMM_PASSWORD_COMMUNICATE_HEADER); >=20 > - >=20 > - Status =3D SmmCommunication->Communicate (SmmCommunication, Buffer, &C= ommSize); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) Buffer; >=20 > - SmmPasswordFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCo= mmunicateHeader->Data; >=20 > - return SmmPasswordFunctionHeader->ReturnStatus; >=20 > -} >=20 > - >=20 > -/** >=20 > - Set password verification policy. >=20 > - >=20 > - @param[in] NeedReVerify Need re-verify or not. >=20 > - >=20 > - @retval EFI_SUCCESS Set verification policy successfully= . >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to set verifi= cation policy. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -UiSetPasswordVerificationPolicy ( >=20 > - IN BOOLEAN NeedReVerify >=20 > - ) >=20 > -{ >=20 > - VOID *Buffer; >=20 > - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *SetVerifyPolicy; >=20 > - >=20 > - Buffer =3D UserPasswordUiLibInitCommunicateBuffer ( >=20 > - (VOID**)&SetVerifyPolicy, >=20 > - sizeof(*SetVerifyPolicy), >=20 > - SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY >=20 > - ); >=20 > - if (Buffer =3D=3D NULL) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - SetVerifyPolicy->NeedReVerify =3D NeedReVerify; >=20 > - >=20 > - return UserPasswordUiLibSendCommunicateBuffer (Buffer, sizeof(*SetVeri= fyPolicy)); >=20 > -} >=20 > - >=20 > -/** >=20 > - Get a user input string. >=20 > - >=20 > - @param[in] PopUpString A popup string to inform user. >=20 > - @param[in, out] UserInput The user input string >=20 > - @param[in] UserInputMaxLen The max unicode count of the UserInp= ut without NULL terminator. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -GetUserInput ( >=20 > - IN CHAR16 *PopUpString, >=20 > - IN OUT CHAR16 *UserInput, >=20 > - IN UINTN UserInputMaxLen >=20 > - ) >=20 > -{ >=20 > - EFI_INPUT_KEY InputKey; >=20 > - UINTN InputLength; >=20 > - CHAR16 *Mask; >=20 > - >=20 > - UserInput[0] =3D 0; >=20 > - Mask =3D AllocateZeroPool ((UserInputMaxLen + 1) * sizeof(CHAR16)); >=20 > - if (Mask =3D=3D NULL) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - InputLength =3D 0; >=20 > - >=20 > - while (TRUE) { >=20 > - if (InputLength < UserInputMaxLen) { >=20 > - Mask[InputLength] =3D L'_'; >=20 > - } >=20 > - CreatePopUp ( >=20 > - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, >=20 > - &InputKey, >=20 > - PopUpString, >=20 > - L"--------------------------------", >=20 > - Mask, >=20 > - NULL >=20 > - ); >=20 > - if (InputKey.ScanCode =3D=3D SCAN_NULL) { >=20 > - // >=20 > - // Check whether finish inputing password. >=20 > - // >=20 > - if (InputKey.UnicodeChar =3D=3D CHAR_CARRIAGE_RETURN && InputLengt= h > 0) { >=20 > - // >=20 > - // Add the null terminator. >=20 > - // >=20 > - UserInput[InputLength] =3D 0; >=20 > - break; >=20 > - } else if ((InputKey.UnicodeChar =3D=3D CHAR_NULL) || >=20 > - (InputKey.UnicodeChar =3D=3D CHAR_LINEFEED) || >=20 > - (InputKey.UnicodeChar =3D=3D CHAR_CARRIAGE_RETURN) >=20 > - ) { >=20 > - continue; >=20 > - } else { >=20 > - // >=20 > - // delete last key entered >=20 > - // >=20 > - if (InputKey.UnicodeChar =3D=3D CHAR_BACKSPACE) { >=20 > - if (InputLength > 0) { >=20 > - UserInput[InputLength] =3D 0; >=20 > - Mask[InputLength] =3D 0; >=20 > - InputLength--; >=20 > - } >=20 > - } else { >=20 > - if (InputLength =3D=3D UserInputMaxLen) { >=20 > - Mask[InputLength] =3D 0; >=20 > - continue; >=20 > - } >=20 > - // >=20 > - // add Next key entry >=20 > - // >=20 > - UserInput[InputLength] =3D InputKey.UnicodeChar; >=20 > - Mask[InputLength] =3D L'*'; >=20 > - InputLength++; >=20 > - } >=20 > - } >=20 > - } >=20 > - } >=20 > - FreePool (Mask); >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Display a message box to end user. >=20 > - >=20 > - @param[in] DisplayString The string in message box. >=20 > -**/ >=20 > -VOID >=20 > -MessageBox ( >=20 > - IN CHAR16 *DisplayString >=20 > - ) >=20 > -{ >=20 > - EFI_INPUT_KEY Key; >=20 > - >=20 > - do { >=20 > - CreatePopUp ( >=20 > - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, >=20 > - &Key, >=20 > - L"", >=20 > - DisplayString, >=20 > - L"Press ENTER to continue ...", >=20 > - L"", >=20 > - NULL >=20 > - ); >=20 > - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); >=20 > -} >=20 > - >=20 > -/** >=20 > - Force system reset. >=20 > -**/ >=20 > -VOID >=20 > -ForceSystemReset ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - MessageBox (L"Password retry count reach, reset system!"); >=20 > - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); >=20 > - CpuDeadLoop(); >=20 > -} >=20 > - >=20 > -/** >=20 > - Display message for set password. >=20 > - >=20 > - @param[in] ReturnStatus The return status for set password. >=20 > -**/ >=20 > -VOID >=20 > -PrintSetPasswordStatus ( >=20 > - IN EFI_STATUS ReturnStatus >=20 > - ) >=20 > -{ >=20 > - CHAR16 *DisplayString; >=20 > - CHAR16 *DisplayString2; >=20 > - >=20 > - EFI_INPUT_KEY Key; >=20 > - >=20 > - if (ReturnStatus =3D=3D EFI_UNSUPPORTED) { >=20 > - DisplayString =3D L"New password is not strong enough!"; >=20 > - DisplayString2 =3D L"Password must at least 8 chars and include lowe= rcase, uppercase alphabetic, number and symbol"; >=20 > - >=20 > - do { >=20 > - CreatePopUp ( >=20 > - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, >=20 > - &Key, >=20 > - L"", >=20 > - DisplayString, >=20 > - DisplayString2, >=20 > - L"Press ENTER to continue ...", >=20 > - L"", >=20 > - NULL >=20 > - ); >=20 > - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); >=20 > - } else { >=20 > - if (ReturnStatus =3D=3D EFI_SUCCESS) { >=20 > - DisplayString =3D L"New password is updated successfully!"; >=20 > - } else if (ReturnStatus =3D=3D EFI_ALREADY_STARTED) { >=20 > - DisplayString =3D L"New password is found in the history passwords= !"; >=20 > - } else { >=20 > - DisplayString =3D L"New password update fails!"; >=20 > - } >=20 > - >=20 > - do { >=20 > - CreatePopUp ( >=20 > - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, >=20 > - &Key, >=20 > - L"", >=20 > - DisplayString, >=20 > - L"Press ENTER to continue ...", >=20 > - L"", >=20 > - NULL >=20 > - ); >=20 > - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); >=20 > - } >=20 > -} >=20 > - >=20 > -/** >=20 > - Get password verification policy. >=20 > - >=20 > - @param[out] VerifyPolicy Verification policy. >=20 > - >=20 > - @retval EFI_SUCCESS Get verification policy successfully= . >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verifi= cation policy. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -GetPasswordVerificationPolicy ( >=20 > - OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - VOID *Buffer; >=20 > - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *TempVerifyPolicy; >=20 > - >=20 > - Buffer =3D UserPasswordUiLibInitCommunicateBuffer ( >=20 > - (VOID**)&TempVerifyPolicy, >=20 > - sizeof(*TempVerifyPolicy), >=20 > - SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY >=20 > - ); >=20 > - if (Buffer =3D=3D NULL) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - Status =3D UserPasswordUiLibSendCommunicateBuffer (Buffer, sizeof(*Tem= pVerifyPolicy)); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - CopyMem (VerifyPolicy, TempVerifyPolicy, sizeof (SMM_PASSWORD_COMMUN= ICATE_VERIFY_POLICY)); >=20 > - } >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Return if the password was verified. >=20 > - >=20 > - @retval TRUE The password was verified. >=20 > - @retval FALSE The password was not verified. >=20 > -**/ >=20 > -BOOLEAN >=20 > -WasPasswordVerified ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - VOID *Buffer; >=20 > - >=20 > - Buffer =3D UserPasswordUiLibInitCommunicateBuffer ( >=20 > - NULL, >=20 > - 0, >=20 > - SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED >=20 > - ); >=20 > - if (Buffer =3D=3D NULL) { >=20 > - return FALSE; >=20 > - } >=20 > - >=20 > - Status =3D UserPasswordUiLibSendCommunicateBuffer (Buffer, 0); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return FALSE; >=20 > - } >=20 > - >=20 > - return TRUE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Require user input password. >=20 > - >=20 > - @retval TRUE User input correct password successfully. >=20 > - @retval FALSE The password is not set. >=20 > -**/ >=20 > -BOOLEAN >=20 > -RequireUserPassword ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - CHAR16 UserInputPw[PASSWORD_MAX_SIZ= E]; >=20 > - CHAR16 *PopUpString; >=20 > - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY VerifyPolicy; >=20 > - >=20 > - Status =3D EFI_SUCCESS; >=20 > - ZeroMem(UserInputPw, sizeof(UserInputPw)); >=20 > - >=20 > - if (!IsPasswordInstalled ()) { >=20 > - return FALSE; >=20 > - } >=20 > - >=20 > - Status =3D GetPasswordVerificationPolicy (&VerifyPolicy); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - if (WasPasswordVerified() && (!VerifyPolicy.NeedReVerify)) { >=20 > - DEBUG ((DEBUG_INFO, "Password was verified and Re-verify is not ne= eded\n")); >=20 > - return TRUE; >=20 > - } >=20 > - } >=20 > - >=20 > - PopUpString =3D L"Please input admin password"; >=20 > - >=20 > - while (TRUE) { >=20 > - gST->ConOut->ClearScreen(gST->ConOut); >=20 > - GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1); >=20 > - >=20 > - Status =3D VerifyPassword (UserInputPw, StrSize(UserInputPw)); >=20 > - if (!EFI_ERROR(Status)) { >=20 > - break; >=20 > - } >=20 > - if (Status =3D=3D EFI_ACCESS_DENIED) { >=20 > - // >=20 > - // Password retry count reach. >=20 > - // >=20 > - ForceSystemReset (); >=20 > - } >=20 > - MessageBox (L"Incorrect password!"); >=20 > - } >=20 > - >=20 > - ZeroMem(UserInputPw, sizeof(UserInputPw)); >=20 > - >=20 > - gST->ConOut->ClearScreen(gST->ConOut); >=20 > - >=20 > - return TRUE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Set user password. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -SetUserPassword ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - CHAR16 UserInputPw[PASSWORD_MAX_SIZE]; >=20 > - CHAR16 TmpPassword[PASSWORD_MAX_SIZE]; >=20 > - CHAR16 *PopUpString; >=20 > - CHAR16 *PopUpString2; >=20 > - >=20 > - ZeroMem(UserInputPw, sizeof(UserInputPw)); >=20 > - ZeroMem(TmpPassword, sizeof(TmpPassword)); >=20 > - >=20 > - PopUpString =3D L"Please set admin password"; >=20 > - >=20 > - while (TRUE) { >=20 > - gST->ConOut->ClearScreen(gST->ConOut); >=20 > - GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1); >=20 > - >=20 > - PopUpString2 =3D L"Please confirm your new password"; >=20 > - gST->ConOut->ClearScreen(gST->ConOut); >=20 > - GetUserInput (PopUpString2, TmpPassword, PASSWORD_MAX_SIZE - 1); >=20 > - if (StrCmp (TmpPassword, UserInputPw) !=3D 0) { >=20 > - MessageBox (L"Password are not the same!"); >=20 > - continue; >=20 > - } >=20 > - >=20 > - Status =3D SetPassword (UserInputPw, StrSize(UserInputPw), NULL, 0); >=20 > - PrintSetPasswordStatus (Status); >=20 > - if (!EFI_ERROR(Status)) { >=20 > - break; >=20 > - } >=20 > - } >=20 > - >=20 > - ZeroMem(UserInputPw, sizeof(UserInputPw)); >=20 > - ZeroMem(TmpPassword, sizeof(TmpPassword)); >=20 > - >=20 > - gST->ConOut->ClearScreen(gST->ConOut); >=20 > -} >=20 > - >=20 > -/** >=20 > - Do password authentication. >=20 > - >=20 > - @retval EFI_SUCCESS Password authentication pass. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -UiDoPasswordAuthentication ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - BOOLEAN PasswordSet; >=20 > - >=20 > - PasswordSet =3D RequireUserPassword (); >=20 > - if (PasswordSet) { >=20 > - DEBUG ((DEBUG_INFO, "Welcome Admin!\n")); >=20 > - } else { >=20 > - DEBUG ((DEBUG_INFO, "Admin password is not set!\n")); >=20 > - if (NeedEnrollPassword()) { >=20 > - SetUserPassword (); >=20 > - } >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordU= iLib/UserPasswordUiLib.inf > b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPa= sswordUiLib.inf > deleted file mode 100644 > index bdd8680ba0..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/Us= erPasswordUiLib.inf > +++ /dev/null > @@ -1,41 +0,0 @@ > -## @file >=20 > -# UserPasswordUiLib instance provides services to do password authentic= ation. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D UserPasswordUiLib >=20 > - FILE_GUID =3D E2E92636-F511-46BC-A08B-02F815AFA88= 4 >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - LIBRARY_CLASS =3D UserPasswordUiLib|DXE_RUNTIME_DRIVE= R DXE_SMM_DRIVER DXE_DRIVER > UEFI_APPLICATION >=20 > - >=20 > -[Sources] >=20 > - UserPasswordUiLib.c >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - UefiBootServicesTableLib >=20 > - UefiRuntimeServicesTableLib >=20 > - DebugLib >=20 > - UefiLib >=20 > - MemoryAllocationLib >=20 > - BaseMemoryLib >=20 > - PrintLib >=20 > - PlatformPasswordLib >=20 > - UserPasswordLib >=20 > - >=20 > -[Guids] >=20 > - gUserAuthenticationGuid ## CONSUMES ## GUID >=20 > - gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTa= ble >=20 > - >=20 > -[Protocols] >=20 > - gEfiSmmCommunicationProtocolGuid ## CONSUMES >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Ke= yService.c > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.c > deleted file mode 100644 > index 8b06e58ca5..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyServic= e.c > +++ /dev/null > @@ -1,133 +0,0 @@ > -/** @file >=20 > - Password key service. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include "KeyService.h" >=20 > - >=20 > -/** >=20 > - Compares the contents of two buffers with slow algorithm >=20 > - >=20 > - This function compares Length bytes of SourceBuffer to Length bytes of= DestinationBuffer. >=20 > - If all Length bytes of the two buffers are identical, then 0 is return= ed. Otherwise, the >=20 > - value returned is the first mismatched byte in SourceBuffer subtracted= from the first >=20 > - mismatched byte in DestinationBuffer. >=20 > - >=20 > - If Length > 0 and DestinationBuffer is NULL, then ASSERT(). >=20 > - If Length > 0 and SourceBuffer is NULL, then ASSERT(). >=20 > - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then = ASSERT(). >=20 > - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSER= T(). >=20 > - >=20 > - @param DestinationBuffer The pointer to the destination buffer to com= pare. >=20 > - @param SourceBuffer The pointer to the source buffer to compare. >=20 > - @param Length The number of bytes to compare. >=20 > - >=20 > - @return 0 All Length bytes of the two buffers are iden= tical. >=20 > - @retval -1 The SourceBuffer is not identical to Destina= tionBuffer. >=20 > - >=20 > -**/ >=20 > -INTN >=20 > -EFIAPI >=20 > -KeyLibSlowCompareMem ( >=20 > - IN CONST VOID *DestinationBuffer, >=20 > - IN CONST VOID *SourceBuffer, >=20 > - IN UINTN Length >=20 > - ) >=20 > -{ >=20 > - UINT8 Delta; >=20 > - UINTN Index; >=20 > - UINT8 *Destination; >=20 > - UINT8 *Source; >=20 > - >=20 > - Destination =3D (UINT8 *)DestinationBuffer; >=20 > - Source =3D (UINT8 *)SourceBuffer; >=20 > - Delta =3D 0; >=20 > - for (Index =3D 0; Index < Length; Index++) { >=20 > - Delta |=3D Destination[Index] ^ Source[Index]; >=20 > - } >=20 > - if (Delta =3D=3D 0) { >=20 > - return 0; >=20 > - } else { >=20 > - return -1; >=20 > - } >=20 > -} >=20 > - >=20 > -/** >=20 > - Generate Salt value. >=20 > - >=20 > - @param[in, out] SaltValue Points to the salt buffer >=20 > - @param[in] SaltSize Size of the salt buffer >=20 > - >=20 > - @retval TRUE Salt is generated. >=20 > - @retval FALSE Salt is not generated. >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -KeyLibGenerateSalt ( >=20 > - IN OUT UINT8 *SaltValue, >=20 > - IN UINTN SaltSize >=20 > - ) >=20 > -{ >=20 > - if (SaltValue =3D=3D NULL) { >=20 > - return FALSE; >=20 > - } >=20 > - RandomSeed(NULL, 0); >=20 > - RandomBytes(SaltValue, SaltSize); >=20 > - return TRUE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Hash the password with PBKDF2. >=20 > - >=20 > - @param[in] HashType Hash type >=20 > - @param[in] Key Points to the key buffer >=20 > - @param[in] KeySize Key buffer size >=20 > - @param[in] SaltValue Points to the salt buffer >=20 > - @param[in] SaltSize Size of the salt buffer >=20 > - @param[out] KeyHash Points to the hashed result >=20 > - @param[in] KeyHashSize Size of the hash buffer >=20 > - >=20 > - @retval TRUE Hash the data successfully. >=20 > - @retval FALSE Failed to hash the data. >=20 > - >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -KeyLibGeneratePBKDF2Hash ( >=20 > - IN UINT32 HashType, >=20 > - IN VOID *Key, >=20 > - IN UINTN KeySize, >=20 > - IN UINT8 *SaltValue, >=20 > - IN UINTN SaltSize, >=20 > - OUT UINT8 *KeyHash, >=20 > - IN UINTN KeyHashSize >=20 > - ) >=20 > -{ >=20 > - BOOLEAN Result; >=20 > - >=20 > - if (HashType !=3D HASH_TYPE_SHA256) { >=20 > - return FALSE; >=20 > - } >=20 > - if (KeyHashSize !=3D SHA256_DIGEST_SIZE) { >=20 > - return FALSE; >=20 > - } >=20 > - >=20 > - Result =3D Pkcs5HashPassword ( >=20 > - KeySize, >=20 > - Key, >=20 > - SaltSize, >=20 > - SaltValue, >=20 > - DEFAULT_PBKDF2_ITERATION_COUNT, >=20 > - SHA256_DIGEST_SIZE, >=20 > - KeyHashSize, >=20 > - KeyHash >=20 > - ); >=20 > - return Result; >=20 > -} >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Ke= yService.h > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.h > deleted file mode 100644 > index d0b20851fa..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyServic= e.h > +++ /dev/null > @@ -1,88 +0,0 @@ > -/** @file >=20 > - Header file for key service. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef __KEY_LIB_H__ >=20 > -#define __KEY_LIB_H__ >=20 > - >=20 > -/** >=20 > - Compares the contents of two buffers with slow algorithm >=20 > - >=20 > - This function compares Length bytes of SourceBuffer to Length bytes of= DestinationBuffer. >=20 > - If all Length bytes of the two buffers are identical, then 0 is return= ed. Otherwise, the >=20 > - value returned is the first mismatched byte in SourceBuffer subtracted= from the first >=20 > - mismatched byte in DestinationBuffer. >=20 > - >=20 > - If Length > 0 and DestinationBuffer is NULL, then ASSERT(). >=20 > - If Length > 0 and SourceBuffer is NULL, then ASSERT(). >=20 > - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then = ASSERT(). >=20 > - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSER= T(). >=20 > - >=20 > - @param DestinationBuffer The pointer to the destination buffer to com= pare. >=20 > - @param SourceBuffer The pointer to the source buffer to compare. >=20 > - @param Length The number of bytes to compare. >=20 > - >=20 > - @return 0 All Length bytes of the two buffers are iden= tical. >=20 > - @retval -1 The SourceBuffer is not identical to Destina= tionBuffer. >=20 > - >=20 > -**/ >=20 > -INTN >=20 > -EFIAPI >=20 > -KeyLibSlowCompareMem ( >=20 > - IN CONST VOID *DestinationBuffer, >=20 > - IN CONST VOID *SourceBuffer, >=20 > - IN UINTN Length >=20 > - ); >=20 > - >=20 > -/** >=20 > - Generate Salt value. >=20 > - >=20 > - @param[in, out] SaltValue Points to the salt buffer >=20 > - @param[in] SaltSize Size of the salt buffer >=20 > - >=20 > - @retval TRUE Salt is generated. >=20 > - @retval FALSE Salt is not generated. >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -KeyLibGenerateSalt( >=20 > - IN OUT UINT8 *SaltValue, >=20 > - IN UINTN SaltSize >=20 > - ); >=20 > - >=20 > -#define HASH_TYPE_SHA256 0x000B >=20 > -#define DEFAULT_PBKDF2_ITERATION_COUNT 1000 >=20 > - >=20 > -/** >=20 > - Hash the password with PBKDF2. >=20 > - >=20 > - @param[in] HashType Hash type >=20 > - @param[in] Key Points to the key buffer >=20 > - @param[in] KeySize Key buffer size >=20 > - @param[in] SaltValue Points to the salt buffer >=20 > - @param[in] SaltSize Size of the salt buffer >=20 > - @param[out] KeyHash Points to the hashed result >=20 > - @param[in] KeyHashSize Size of the hash buffer >=20 > - >=20 > - @retval TRUE Hash the data successfully. >=20 > - @retval FALSE Failed to hash the data. >=20 > - >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -KeyLibGeneratePBKDF2Hash ( >=20 > - IN UINT32 HashType, >=20 > - IN VOID *Key, >=20 > - IN UINTN KeySize, >=20 > - IN UINT8 *SaltValue, >=20 > - IN UINTN SaltSize, >=20 > - OUT UINT8 *KeyHash, >=20 > - IN UINTN KeyHashSize >=20 > - ); >=20 > - >=20 > -#endif >=20 > - >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Us= erAuthentication2Dxe.c > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentic= ation2Dxe.c > deleted file mode 100644 > index b4326d380f..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthe= ntication2Dxe.c > +++ /dev/null > @@ -1,484 +0,0 @@ > -/** @file >=20 > - This Driver mainly provides Setup Form to change password. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include "UserAuthentication2Dxe.h" >=20 > - >=20 > -USER_AUTHENTICATION_PRIVATE_DATA *mUserAuthenticationData =3D NULL; >=20 > - >=20 > -EFI_GUID mUserAuthenticationVendorGuid =3D USER_AUTHENTICATION_FORMSET_G= UID; >=20 > -HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath =3D { >=20 > - { >=20 > - { >=20 > - HARDWARE_DEVICE_PATH, >=20 > - HW_VENDOR_DP, >=20 > - { >=20 > - (UINT8) (sizeof (VENDOR_DEVICE_PATH)), >=20 > - (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) >=20 > - } >=20 > - }, >=20 > - USER_AUTHENTICATION_FORMSET_GUID >=20 > - }, >=20 > - { >=20 > - END_DEVICE_PATH_TYPE, >=20 > - END_ENTIRE_DEVICE_PATH_SUBTYPE, >=20 > - { >=20 > - (UINT8) (END_DEVICE_PATH_LENGTH), >=20 > - (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8) >=20 > - } >=20 > - } >=20 > -}; >=20 > - >=20 > -/** >=20 > - Display a message box to end user. >=20 > - >=20 > - @param[in] DisplayString The string in message box. >=20 > -**/ >=20 > -VOID >=20 > -MessageBox ( >=20 > - IN CHAR16 *DisplayString >=20 > - ) >=20 > -{ >=20 > - EFI_INPUT_KEY Key; >=20 > - >=20 > - do { >=20 > - CreatePopUp ( >=20 > - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, >=20 > - &Key, >=20 > - L"", >=20 > - DisplayString, >=20 > - L"Press ENTER to continue ...", >=20 > - L"", >=20 > - NULL >=20 > - ); >=20 > - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); >=20 > -} >=20 > - >=20 > -/** >=20 > - Force system reset. >=20 > -**/ >=20 > -VOID >=20 > -ForceSystemReset ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - MessageBox (L"Password retry count reach, reset system!"); >=20 > - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); >=20 > - CpuDeadLoop(); >=20 > -} >=20 > - >=20 > -/** >=20 > - Display message for set password. >=20 > - >=20 > - @param[in] ReturnStatus The return status for set password. >=20 > -**/ >=20 > -VOID >=20 > -PrintSetPasswordStatus ( >=20 > - IN EFI_STATUS ReturnStatus >=20 > - ) >=20 > -{ >=20 > - CHAR16 *DisplayString; >=20 > - CHAR16 *DisplayString2; >=20 > - >=20 > - EFI_INPUT_KEY Key; >=20 > - >=20 > - if (ReturnStatus =3D=3D EFI_UNSUPPORTED) { >=20 > - DisplayString =3D L"New password is not strong enough!"; >=20 > - DisplayString2 =3D L"Password must at least 8 chars and include lowe= rcase, uppercase alphabetic, number and symbol"; >=20 > - >=20 > - do { >=20 > - CreatePopUp ( >=20 > - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, >=20 > - &Key, >=20 > - L"", >=20 > - DisplayString, >=20 > - DisplayString2, >=20 > - L"Press ENTER to continue ...", >=20 > - L"", >=20 > - NULL >=20 > - ); >=20 > - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); >=20 > - } else { >=20 > - if (ReturnStatus =3D=3D EFI_SUCCESS) { >=20 > - DisplayString =3D L"New password is updated successfully!"; >=20 > - } else if (ReturnStatus =3D=3D EFI_ALREADY_STARTED) { >=20 > - DisplayString =3D L"New password is found in the history passwords= !"; >=20 > - } else { >=20 > - DisplayString =3D L"New password update fails!"; >=20 > - } >=20 > - >=20 > - do { >=20 > - CreatePopUp ( >=20 > - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, >=20 > - &Key, >=20 > - L"", >=20 > - DisplayString, >=20 > - L"Press ENTER to continue ...", >=20 > - L"", >=20 > - NULL >=20 > - ); >=20 > - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); >=20 > - } >=20 > -} >=20 > - >=20 > -/** >=20 > - This function allows a caller to extract the current configuration for= one >=20 > - or more named elements from the target driver. >=20 > - >=20 > - @param This Points to the EFI_HII_CONFIG_ACCESS_PRO= TOCOL. >=20 > - @param Request A null-terminated Unicode string in >=20 > - format. >=20 > - @param Progress On return, points to a character in the= Request >=20 > - string. Points to the string's null ter= minator if >=20 > - request was successful. Points to the m= ost recent >=20 > - '&' before the first failing name/value= pair (or >=20 > - the beginning of the string if the fail= ure is in >=20 > - the first name/value pair) if the reque= st was not >=20 > - successful. >=20 > - @param Results A null-terminated Unicode string in >=20 > - format which has all va= lues filled >=20 > - in for the names in the Request string.= String to >=20 > - be allocated by the called function. >=20 > - >=20 > - @retval EFI_SUCCESS The Results is filled with the requeste= d values. >=20 > - @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. >=20 > - @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown n= ame. >=20 > - @retval EFI_NOT_FOUND Routing data doesn't match any storage = in this >=20 > - driver. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -ExtractConfig ( >=20 > - IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, >=20 > - IN CONST EFI_STRING Request, >=20 > - OUT EFI_STRING *Progress, >=20 > - OUT EFI_STRING *Results >=20 > - ) >=20 > -{ >=20 > - if (Progress =3D=3D NULL || Results =3D=3D NULL) { >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - *Progress =3D Request; >=20 > - return EFI_NOT_FOUND; >=20 > -} >=20 > - >=20 > - >=20 > -/** >=20 > - This function processes the results of changes in configuration. >=20 > - >=20 > - @param This Points to the EFI_HII_CONFIG_ACCESS_PRO= TOCOL. >=20 > - @param Configuration A null-terminated Unicode string in >=20 > - format. >=20 > - @param Progress A pointer to a string filled in with th= e offset of >=20 > - the most recent '&' before the first fa= iling >=20 > - name/value pair (or the beginning of th= e string if >=20 > - the failure is in the first name/value = pair) or >=20 > - the terminating NULL if all was success= ful. >=20 > - >=20 > - @retval EFI_SUCCESS The Results is processed successfully. >=20 > - @retval EFI_INVALID_PARAMETER Configuration is NULL. >=20 > - @retval EFI_NOT_FOUND Routing data doesn't match any storage = in this >=20 > - driver. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -RouteConfig ( >=20 > - IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, >=20 > - IN CONST EFI_STRING Configuration, >=20 > - OUT EFI_STRING *Progress >=20 > - ) >=20 > -{ >=20 > - if (Configuration =3D=3D NULL || Progress =3D=3D NULL) { >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - >=20 > - *Progress =3D Configuration; >=20 > - >=20 > - return EFI_NOT_FOUND; >=20 > -} >=20 > - >=20 > -/** >=20 > - HII update Admin Password status. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -HiiUpdateAdminPasswordStatus ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - if (IsPasswordInstalled ()) { >=20 > - HiiSetString ( >=20 > - mUserAuthenticationData->HiiHandle, >=20 > - STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT), >=20 > - L"Installed", >=20 > - NULL >=20 > - ); >=20 > - } else { >=20 > - HiiSetString ( >=20 > - mUserAuthenticationData->HiiHandle, >=20 > - STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT), >=20 > - L"Not Installed", >=20 > - NULL >=20 > - ); >=20 > - } >=20 > -} >=20 > - >=20 > -/** >=20 > - This function processes the results of changes in configuration. >=20 > - >=20 > - @param This Points to the EFI_HII_CONFIG_ACCESS_PRO= TOCOL. >=20 > - @param Action Specifies the type of action taken by t= he browser. >=20 > - @param QuestionId A unique value which is sent to the ori= ginal >=20 > - exporting driver so that it can identif= y the type >=20 > - of data to expect. >=20 > - @param Type The type of value for the question. >=20 > - @param Value A pointer to the data being sent to the= original >=20 > - exporting driver. >=20 > - @param ActionRequest On return, points to the action request= ed by the >=20 > - callback function. >=20 > - >=20 > - @retval EFI_SUCCESS The callback successfully handled the a= ction. >=20 > - @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold= the >=20 > - variable and its data. >=20 > - @retval EFI_DEVICE_ERROR The variable could not be saved. >=20 > - @retval EFI_UNSUPPORTED The specified Action is not supported b= y the >=20 > - callback. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -UserAuthenticationCallback ( >=20 > - IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, >=20 > - IN EFI_BROWSER_ACTION Action, >=20 > - IN EFI_QUESTION_ID QuestionId, >=20 > - IN UINT8 Type, >=20 > - IN EFI_IFR_TYPE_VALUE *Value, >=20 > - OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - CHAR16 *UserInputPassword; >=20 > - >=20 > - Status =3D EFI_SUCCESS; >=20 > - >=20 > - if (((Value =3D=3D NULL) && (Action !=3D EFI_BROWSER_ACTION_FORM_OPEN)= && (Action !=3D > EFI_BROWSER_ACTION_FORM_CLOSE)) || >=20 > - (ActionRequest =3D=3D NULL)) { >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - >=20 > - switch (Action) { >=20 > - case EFI_BROWSER_ACTION_FORM_OPEN: >=20 > - { >=20 > - switch (QuestionId) { >=20 > - case ADMIN_PASSWORD_KEY_ID: >=20 > - HiiUpdateAdminPasswordStatus (); >=20 > - default: >=20 > - break; >=20 > - } >=20 > - } >=20 > - break; >=20 > - case EFI_BROWSER_ACTION_CHANGING: >=20 > - { >=20 > - switch (QuestionId) { >=20 > - case ADMIN_PASSWORD_KEY_ID: >=20 > - if ((Type =3D=3D EFI_IFR_TYPE_STRING) && (Value->string =3D=3D 0= ) && >=20 > - (mUserAuthenticationData->PasswordState =3D=3D BROWSER_STATE= _SET_PASSWORD)) { >=20 > - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_VALID= ATE_PASSWORD; >=20 > - ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAut= henticationData->OldPassword)); >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - // >=20 > - // The Callback is responsible for validating old password input= by user, >=20 > - // If Callback return EFI_SUCCESS, it indicates validation pass. >=20 > - // >=20 > - switch (mUserAuthenticationData->PasswordState) { >=20 > - case BROWSER_STATE_VALIDATE_PASSWORD: >=20 > - UserInputPassword =3D HiiGetString (mUserAuthenticationData->H= iiHandle, Value->string, NULL); >=20 > - if (UserInputPassword =3D=3D NULL) { >=20 > - return EFI_UNSUPPORTED; >=20 > - } >=20 > - if ((StrLen (UserInputPassword) >=3D PASSWORD_MAX_SIZE)) { >=20 > - Status =3D EFI_NOT_READY; >=20 > - break; >=20 > - } >=20 > - if (UserInputPassword[0] =3D=3D 0) { >=20 > - // >=20 > - // Setup will use an empty password to check whether the old= password is set, >=20 > - // If the validation is successful, means there is no old pa= ssword, return >=20 > - // success to set the new password. Or need to return EFI_NO= T_READY to >=20 > - // let user input the old password. >=20 > - // >=20 > - Status =3D VerifyPassword (UserInputPassword, StrSize (UserI= nputPassword)); >=20 > - if (Status =3D=3D EFI_SUCCESS) { >=20 > - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_S= ET_PASSWORD; >=20 > - } else { >=20 > - Status =3D EFI_NOT_READY; >=20 > - } >=20 > - break; >=20 > - } >=20 > - Status =3D VerifyPassword (UserInputPassword, StrSize (UserInp= utPassword)); >=20 > - if (Status =3D=3D EFI_SUCCESS) { >=20 > - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_SET= _PASSWORD; >=20 > - StrCpyS ( >=20 > - mUserAuthenticationData->OldPassword, >=20 > - sizeof(mUserAuthenticationData->OldPassword)/sizeof(CHAR16= ), >=20 > - UserInputPassword >=20 > - ); >=20 > - } else { >=20 > - // >=20 > - // Old password mismatch, return EFI_NOT_READY to prompt for= error message. >=20 > - // >=20 > - if (Status =3D=3D EFI_ACCESS_DENIED) { >=20 > - // >=20 > - // Password retry count reach. >=20 > - // >=20 > - ForceSystemReset (); >=20 > - } >=20 > - Status =3D EFI_NOT_READY; >=20 > - } >=20 > - break; >=20 > - >=20 > - case BROWSER_STATE_SET_PASSWORD: >=20 > - UserInputPassword =3D HiiGetString (mUserAuthenticationData->H= iiHandle, Value->string, NULL); >=20 > - if (UserInputPassword =3D=3D NULL) { >=20 > - return EFI_UNSUPPORTED; >=20 > - } >=20 > - if ((StrLen (UserInputPassword) >=3D PASSWORD_MAX_SIZE)) { >=20 > - Status =3D EFI_NOT_READY; >=20 > - break; >=20 > - } >=20 > - Status =3D SetPassword (UserInputPassword, StrSize (UserInputP= assword), mUserAuthenticationData->OldPassword, > StrSize(mUserAuthenticationData->OldPassword)); >=20 > - PrintSetPasswordStatus (Status); >=20 > - ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAut= henticationData->OldPassword)); >=20 > - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_VALID= ATE_PASSWORD; >=20 > - HiiUpdateAdminPasswordStatus (); >=20 > - break; >=20 > - >=20 > - default: >=20 > - break; >=20 > - } >=20 > - default: >=20 > - break; >=20 > - } >=20 > - } >=20 > - break; >=20 > - default: >=20 > - break; >=20 > - } >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - User Authentication entry point. >=20 > - >=20 > - @param ImageHandle The image handle. >=20 > - @param SystemTable The system table. >=20 > - >=20 > - @retval EFI_SUCCESS The entry point is executed successfully. >=20 > - @return other Contain some other errors. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -UserAuthentication2Entry ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - EFI_HANDLE DriverHandle; >=20 > - EFI_HII_HANDLE HiiHandle; >=20 > - >=20 > - DriverHandle =3D NULL; >=20 > - >=20 > - mUserAuthenticationData =3D AllocateZeroPool (sizeof (USER_AUTHENTICAT= ION_PRIVATE_DATA)); >=20 > - if (mUserAuthenticationData =3D=3D NULL) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - mUserAuthenticationData->ConfigAccess.ExtractConfig =3D ExtractConfig; >=20 > - mUserAuthenticationData->ConfigAccess.RouteConfig =3D RouteConfig; >=20 > - mUserAuthenticationData->ConfigAccess.Callback =3D UserAuthenticationC= allback; >=20 > - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_VALIDATE_PASS= WORD; >=20 > - >=20 > - // >=20 > - // Install Config Access protocol to driver handle. >=20 > - // >=20 > - Status =3D gBS->InstallMultipleProtocolInterfaces ( >=20 > - &DriverHandle, >=20 > - &gEfiDevicePathProtocolGuid, >=20 > - &mHiiVendorDevicePath, >=20 > - &gEfiHiiConfigAccessProtocolGuid, >=20 > - &mUserAuthenticationData->ConfigAccess, >=20 > - NULL >=20 > - ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - mUserAuthenticationData->DriverHandle =3D DriverHandle; >=20 > - >=20 > - // >=20 > - // Add HII data to database. >=20 > - // >=20 > - HiiHandle =3D HiiAddPackages ( >=20 > - &mUserAuthenticationVendorGuid, >=20 > - DriverHandle, >=20 > - UserAuthentication2DxeStrings, >=20 > - UserAuthenticationDxeVfrBin, >=20 > - NULL >=20 > - ); >=20 > - if (HiiHandle =3D=3D NULL) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - mUserAuthenticationData->HiiHandle =3D HiiHandle; >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Unloads the application and its installed protocol. >=20 > - >=20 > - @param[in] ImageHandle Handle that identifies the image to be u= nloaded. >=20 > - >=20 > - @retval EFI_SUCCESS The image has been unloaded. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -UserAuthentication2Unload ( >=20 > - IN EFI_HANDLE ImageHandle >=20 > - ) >=20 > -{ >=20 > - ASSERT (mUserAuthenticationData !=3D NULL); >=20 > - >=20 > - // >=20 > - // Uninstall Config Access Protocol. >=20 > - // >=20 > - if (mUserAuthenticationData->DriverHandle !=3D NULL) { >=20 > - gBS->UninstallMultipleProtocolInterfaces ( >=20 > - mUserAuthenticationData->DriverHandle, >=20 > - &gEfiDevicePathProtocolGuid, >=20 > - &mHiiVendorDevicePath, >=20 > - &gEfiHiiConfigAccessProtocolGuid, >=20 > - &mUserAuthenticationData->ConfigAccess, >=20 > - NULL >=20 > - ); >=20 > - mUserAuthenticationData->DriverHandle =3D NULL; >=20 > - } >=20 > - >=20 > - // >=20 > - // Remove Hii Data. >=20 > - // >=20 > - if (mUserAuthenticationData->HiiHandle !=3D NULL) { >=20 > - HiiRemovePackages (mUserAuthenticationData->HiiHandle); >=20 > - } >=20 > - >=20 > - FreePool (mUserAuthenticationData); >=20 > - mUserAuthenticationData =3D NULL; >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Us= erAuthentication2Dxe.h > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentic= ation2Dxe.h > deleted file mode 100644 > index 3b7fba026d..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthe= ntication2Dxe.h > +++ /dev/null > @@ -1,55 +0,0 @@ > -/** @file >=20 > - Header file for UserAuthentication2Dxe. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef _USER_AUTHENTICATION_DXE_H_ >=20 > -#define _USER_AUTHENTICATION_DXE_H_ >=20 > - >=20 > - >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include "UserAuthenticationDxeFormset.h" >=20 > - >=20 > -extern UINT8 UserAuthenticationDxeVfrBin[]; >=20 > -extern UINT8 UserAuthentication2DxeStrings[]; >=20 > - >=20 > -typedef struct { >=20 > - EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; >=20 > - EFI_HANDLE DriverHandle; >=20 > - EFI_HII_HANDLE HiiHandle; >=20 > - UINT8 PasswordState; >=20 > - CHAR16 OldPassword[PASSWORD_MAX_SIZE]; >=20 > -} USER_AUTHENTICATION_PRIVATE_DATA; >=20 > - >=20 > -#pragma pack(1) >=20 > -/// >=20 > -/// HII specific Vendor Device Path definition. >=20 > -/// >=20 > -typedef struct { >=20 > - VENDOR_DEVICE_PATH VendorDevicePath; >=20 > - EFI_DEVICE_PATH_PROTOCOL End; >=20 > -} HII_VENDOR_DEVICE_PATH; >=20 > -#pragma pack() >=20 > - >=20 > -#endif >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Us= erAuthentication2Dxe.inf > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentic= ation2Dxe.inf > deleted file mode 100644 > index d93d511005..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthe= ntication2Dxe.inf > +++ /dev/null > @@ -1,53 +0,0 @@ > -## @file >=20 > -# User Authentication 2 Dxe Driver. >=20 > -# >=20 > -# This Driver mainly provides Setup Form to change password. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D UserAuthentication2Dxe >=20 > - FILE_GUID =3D 4EF592F4-C716-40CC-8C07-1E4E3BD71F1= 1 >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 2.0 >=20 > - ENTRY_POINT =3D UserAuthentication2Entry >=20 > - UNLOAD_IMAGE =3D UserAuthentication2Unload >=20 > - >=20 > -[Sources] >=20 > - UserAuthentication2Dxe.c >=20 > - UserAuthentication2Dxe.h >=20 > - UserAuthenticationDxeFormset.h >=20 > - UserAuthenticationDxeVfr.vfr >=20 > - UserAuthenticationDxeStrings.uni >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - BaseLib >=20 > - UefiBootServicesTableLib >=20 > - UefiDriverEntryPoint >=20 > - UefiRuntimeServicesTableLib >=20 > - BaseMemoryLib >=20 > - DebugLib >=20 > - UefiLib >=20 > - HiiLib >=20 > - DevicePathLib >=20 > - MemoryAllocationLib >=20 > - UserPasswordLib >=20 > - >=20 > -[Protocols] >=20 > - gEfiDevicePathProtocolGuid ## PRODUCES >=20 > - gEfiHiiConfigAccessProtocolGuid ## PRODUCES >=20 > - >=20 > -[Depex] >=20 > - gEfiSimpleTextOutProtocolGuid AND >=20 > - gEfiSmmCommunicationProtocolGuid AND >=20 > - gEfiVariableArchProtocolGuid AND >=20 > - gEfiVariableWriteArchProtocolGuid >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Us= erAuthenticationDxe.c > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentic= ationDxe.c > deleted file mode 100644 > index bba2057a96..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthe= nticationDxe.c > +++ /dev/null > @@ -1,780 +0,0 @@ > -/** @file >=20 > - This Driver mainly provides Setup Form to change password and >=20 > - does user authentication before entering Setup. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include "UserAuthenticationDxe.h" >=20 > - >=20 > -EFI_EVENT mExitBootServicesEvent =3D NULL; >=20 > -EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol =3D NULL; >=20 > -USER_AUTHENTICATION_PRIVATE_DATA *mUserAuthenticationData =3D NULL; >=20 > -EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication =3D NULL; >=20 > - >=20 > -EFI_GUID mUserAuthenticationVendorGuid =3D USER_AUTHENTICATION_FORMSET_G= UID; >=20 > -HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath =3D { >=20 > - { >=20 > - { >=20 > - HARDWARE_DEVICE_PATH, >=20 > - HW_VENDOR_DP, >=20 > - { >=20 > - (UINT8) (sizeof (VENDOR_DEVICE_PATH)), >=20 > - (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) >=20 > - } >=20 > - }, >=20 > - USER_AUTHENTICATION_FORMSET_GUID >=20 > - }, >=20 > - { >=20 > - END_DEVICE_PATH_TYPE, >=20 > - END_ENTIRE_DEVICE_PATH_SUBTYPE, >=20 > - { >=20 > - (UINT8) (END_DEVICE_PATH_LENGTH), >=20 > - (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8) >=20 > - } >=20 > - } >=20 > -}; >=20 > - >=20 > -/** >=20 > - Get a user input string. >=20 > - >=20 > - @param[in] PopUpString A popup string to inform user. >=20 > - @param[in, out] UserInput The user input string >=20 > - @param[in] UserInputMaxLen The max unicode count of the UserInp= ut without NULL terminator. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -GetUserInput ( >=20 > - IN CHAR16 *PopUpString, >=20 > - IN OUT CHAR16 *UserInput, >=20 > - IN UINTN UserInputMaxLen >=20 > - ) >=20 > -{ >=20 > - EFI_INPUT_KEY InputKey; >=20 > - UINTN InputLength; >=20 > - CHAR16 *Mask; >=20 > - >=20 > - UserInput[0] =3D 0; >=20 > - Mask =3D AllocateZeroPool ((UserInputMaxLen + 1) * sizeof(CHAR16)); >=20 > - if (Mask =3D=3D NULL) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - InputLength =3D 0; >=20 > - >=20 > - while (TRUE) { >=20 > - if (InputLength < UserInputMaxLen) { >=20 > - Mask[InputLength] =3D L'_'; >=20 > - } >=20 > - CreatePopUp ( >=20 > - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, >=20 > - &InputKey, >=20 > - PopUpString, >=20 > - L"--------------------------------", >=20 > - Mask, >=20 > - NULL >=20 > - ); >=20 > - if (InputKey.ScanCode =3D=3D SCAN_NULL) { >=20 > - // >=20 > - // Check whether finish inputing password. >=20 > - // >=20 > - if (InputKey.UnicodeChar =3D=3D CHAR_CARRIAGE_RETURN && InputLengt= h > 0) { >=20 > - // >=20 > - // Add the null terminator. >=20 > - // >=20 > - UserInput[InputLength] =3D 0; >=20 > - break; >=20 > - } else if ((InputKey.UnicodeChar =3D=3D CHAR_NULL) || >=20 > - (InputKey.UnicodeChar =3D=3D CHAR_LINEFEED) || >=20 > - (InputKey.UnicodeChar =3D=3D CHAR_CARRIAGE_RETURN) >=20 > - ) { >=20 > - continue; >=20 > - } else { >=20 > - // >=20 > - // delete last key entered >=20 > - // >=20 > - if (InputKey.UnicodeChar =3D=3D CHAR_BACKSPACE) { >=20 > - if (InputLength > 0) { >=20 > - UserInput[InputLength] =3D 0; >=20 > - Mask[InputLength] =3D 0; >=20 > - InputLength--; >=20 > - } >=20 > - } else { >=20 > - if (InputLength =3D=3D UserInputMaxLen) { >=20 > - Mask[InputLength] =3D 0; >=20 > - continue; >=20 > - } >=20 > - // >=20 > - // add Next key entry >=20 > - // >=20 > - UserInput[InputLength] =3D InputKey.UnicodeChar; >=20 > - Mask[InputLength] =3D L'*'; >=20 > - InputLength++; >=20 > - } >=20 > - } >=20 > - } >=20 > - } >=20 > - FreePool (Mask); >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Display a message box to end user. >=20 > - >=20 > - @param[in] DisplayString The string in message box. >=20 > -**/ >=20 > -VOID >=20 > -MessageBox ( >=20 > - IN CHAR16 *DisplayString >=20 > - ) >=20 > -{ >=20 > - EFI_INPUT_KEY Key; >=20 > - >=20 > - do { >=20 > - CreatePopUp ( >=20 > - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, >=20 > - &Key, >=20 > - L"", >=20 > - DisplayString, >=20 > - L"Press ENTER to continue ...", >=20 > - L"", >=20 > - NULL >=20 > - ); >=20 > - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); >=20 > -} >=20 > - >=20 > -/** >=20 > - Force system reset. >=20 > -**/ >=20 > -VOID >=20 > -ForceSystemReset ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - MessageBox (L"Password retry count reach, reset system!"); >=20 > - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); >=20 > - CpuDeadLoop(); >=20 > -} >=20 > - >=20 > -/** >=20 > - Display message for set password. >=20 > - >=20 > - @param[in] ReturnStatus The return status for set password. >=20 > -**/ >=20 > -VOID >=20 > -PrintSetPasswordStatus ( >=20 > - IN EFI_STATUS ReturnStatus >=20 > - ) >=20 > -{ >=20 > - CHAR16 *DisplayString; >=20 > - CHAR16 *DisplayString2; >=20 > - >=20 > - EFI_INPUT_KEY Key; >=20 > - >=20 > - if (ReturnStatus =3D=3D EFI_UNSUPPORTED) { >=20 > - DisplayString =3D L"New password is not strong enough!"; >=20 > - DisplayString2 =3D L"Password must at least 8 chars and include lowe= rcase, uppercase alphabetic, number and symbol"; >=20 > - >=20 > - do { >=20 > - CreatePopUp ( >=20 > - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, >=20 > - &Key, >=20 > - L"", >=20 > - DisplayString, >=20 > - DisplayString2, >=20 > - L"Press ENTER to continue ...", >=20 > - L"", >=20 > - NULL >=20 > - ); >=20 > - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); >=20 > - } else { >=20 > - if (ReturnStatus =3D=3D EFI_SUCCESS) { >=20 > - DisplayString =3D L"New password is updated successfully!"; >=20 > - } else if (ReturnStatus =3D=3D EFI_ALREADY_STARTED) { >=20 > - DisplayString =3D L"New password is found in the history passwords= !"; >=20 > - } else { >=20 > - DisplayString =3D L"New password update fails!"; >=20 > - } >=20 > - >=20 > - do { >=20 > - CreatePopUp ( >=20 > - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, >=20 > - &Key, >=20 > - L"", >=20 > - DisplayString, >=20 > - L"Press ENTER to continue ...", >=20 > - L"", >=20 > - NULL >=20 > - ); >=20 > - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); >=20 > - } >=20 > -} >=20 > - >=20 > -/** >=20 > - Require user input password. >=20 > - >=20 > - @retval TRUE User input correct password successfully. >=20 > - @retval FALSE The password is not set. >=20 > -**/ >=20 > -BOOLEAN >=20 > -RequireUserPassword ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - CHAR16 UserInputPw[PASSWORD_MAX= _SIZE]; >=20 > - CHAR16 *PopUpString; >=20 > - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY VerifyPolicy; >=20 > - >=20 > - Status =3D EFI_SUCCESS; >=20 > - ZeroMem(UserInputPw, sizeof(UserInputPw)); >=20 > - >=20 > - if (!IsPasswordInstalled ()) { >=20 > - return FALSE; >=20 > - } >=20 > - >=20 > - Status =3D GetPasswordVerificationPolicy (&VerifyPolicy); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - if (WasPasswordVerified() && (!VerifyPolicy.NeedReVerify)) { >=20 > - DEBUG ((DEBUG_INFO, "Password was verified and Re-verify is not ne= eded\n")); >=20 > - return TRUE; >=20 > - } >=20 > - } >=20 > - >=20 > - PopUpString =3D L"Please input admin password"; >=20 > - >=20 > - while (TRUE) { >=20 > - gST->ConOut->ClearScreen(gST->ConOut); >=20 > - GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1); >=20 > - >=20 > - Status =3D VerifyPassword (UserInputPw, StrSize(UserInputPw)); >=20 > - if (!EFI_ERROR(Status)) { >=20 > - break; >=20 > - } >=20 > - if (Status =3D=3D EFI_ACCESS_DENIED) { >=20 > - // >=20 > - // Password retry count reach. >=20 > - // >=20 > - ForceSystemReset (); >=20 > - } >=20 > - MessageBox (L"Incorrect password!"); >=20 > - } >=20 > - >=20 > - ZeroMem(UserInputPw, sizeof(UserInputPw)); >=20 > - >=20 > - gST->ConOut->ClearScreen(gST->ConOut); >=20 > - >=20 > - return TRUE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Set user password. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -SetUserPassword ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - CHAR16 UserInputPw[PASSWORD_MAX_SIZE]; >=20 > - CHAR16 TmpPassword[PASSWORD_MAX_SIZE]; >=20 > - CHAR16 *PopUpString; >=20 > - CHAR16 *PopUpString2; >=20 > - >=20 > - ZeroMem(UserInputPw, sizeof(UserInputPw)); >=20 > - ZeroMem(TmpPassword, sizeof(TmpPassword)); >=20 > - >=20 > - PopUpString =3D L"Please set admin password"; >=20 > - >=20 > - while (TRUE) { >=20 > - gST->ConOut->ClearScreen(gST->ConOut); >=20 > - GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1); >=20 > - >=20 > - PopUpString2 =3D L"Please confirm your new password"; >=20 > - gST->ConOut->ClearScreen(gST->ConOut); >=20 > - GetUserInput (PopUpString2, TmpPassword, PASSWORD_MAX_SIZE - 1); >=20 > - if (StrCmp (TmpPassword, UserInputPw) !=3D 0) { >=20 > - MessageBox (L"Password are not the same!"); >=20 > - continue; >=20 > - } >=20 > - >=20 > - Status =3D SetPassword (UserInputPw, StrSize(UserInputPw), NULL, 0); >=20 > - PrintSetPasswordStatus (Status); >=20 > - if (!EFI_ERROR(Status)) { >=20 > - break; >=20 > - } >=20 > - } >=20 > - >=20 > - ZeroMem(UserInputPw, sizeof(UserInputPw)); >=20 > - ZeroMem(TmpPassword, sizeof(TmpPassword)); >=20 > - >=20 > - gST->ConOut->ClearScreen(gST->ConOut); >=20 > -} >=20 > - >=20 > -/** >=20 > - Check password before entering into setup. >=20 > - >=20 > - @param CodeType Indicates the type of status code being reported= . Type EFI_STATUS_CODE_TYPE is defined in > "Related Definitions" below. >=20 > - >=20 > - @param Value Describes the current status of a hardware or so= ftware entity. >=20 > - This included information about the class and su= bclass that is used to classify the entity >=20 > - as well as an operation. For progress codes, th= e operation is the current activity. >=20 > - For error codes, it is the exception. For debug= codes, it is not defined at this time. >=20 > - Type EFI_STATUS_CODE_VALUE is defined in "Relate= d Definitions" below. >=20 > - Specific values are discussed in the Intel? Plat= form Innovation Framework for EFI Status Code Specification. >=20 > - >=20 > - @param Instance The enumeration of a hardware or software entity= within the system. >=20 > - A system may contain multiple entities that matc= h a class/subclass pairing. >=20 > - The instance differentiates between them. An in= stance of 0 indicates that instance information is > unavailable, >=20 > - not meaningful, or not relevant. Valid instance= numbers start with 1. >=20 > - >=20 > - >=20 > - @param CallerId This optional parameter may be used to identify = the caller. >=20 > - This parameter allows the status code driver to = apply different rules to different callers. >=20 > - Type EFI_GUID is defined in InstallProtocolInter= face() in the UEFI 2.0 Specification. >=20 > - >=20 > - >=20 > - @param Data This optional parameter may be used to pass addi= tional data >=20 > - >=20 > - @retval EFI_SUCCESS Status code is what we expected. >=20 > - @retval EFI_UNSUPPORTED Status code not supported. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -CheckForPassword ( >=20 > - IN EFI_STATUS_CODE_TYPE CodeType, >=20 > - IN EFI_STATUS_CODE_VALUE Value, >=20 > - IN UINT32 Instance, >=20 > - IN EFI_GUID *CallerId, OPTIONAL >=20 > - IN EFI_STATUS_CODE_DATA *Data OPTIONAL >=20 > - ) >=20 > -{ >=20 > - BOOLEAN PasswordSet; >=20 > - >=20 > - if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) =3D=3D EFI_PROGRESS_CODE) = && >=20 > - (Value =3D=3D (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP))= ) { >=20 > - // >=20 > - // Check whether enter setup page. >=20 > - // >=20 > - PasswordSet =3D RequireUserPassword (); >=20 > - if (PasswordSet) { >=20 > - DEBUG ((DEBUG_INFO, "Welcome Admin!\n")); >=20 > - } else { >=20 > - DEBUG ((DEBUG_INFO, "Admin password is not set!\n")); >=20 > - if (NeedEnrollPassword()) { >=20 > - SetUserPassword (); >=20 > - } >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > - } else{ >=20 > - return EFI_UNSUPPORTED; >=20 > - } >=20 > -} >=20 > - >=20 > -/** >=20 > - This function allows a caller to extract the current configuration for= one >=20 > - or more named elements from the target driver. >=20 > - >=20 > - @param This Points to the EFI_HII_CONFIG_ACCESS_PRO= TOCOL. >=20 > - @param Request A null-terminated Unicode string in >=20 > - format. >=20 > - @param Progress On return, points to a character in the= Request >=20 > - string. Points to the string's null ter= minator if >=20 > - request was successful. Points to the m= ost recent >=20 > - '&' before the first failing name/value= pair (or >=20 > - the beginning of the string if the fail= ure is in >=20 > - the first name/value pair) if the reque= st was not >=20 > - successful. >=20 > - @param Results A null-terminated Unicode string in >=20 > - format which has all va= lues filled >=20 > - in for the names in the Request string.= String to >=20 > - be allocated by the called function. >=20 > - >=20 > - @retval EFI_SUCCESS The Results is filled with the requeste= d values. >=20 > - @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. >=20 > - @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown n= ame. >=20 > - @retval EFI_NOT_FOUND Routing data doesn't match any storage = in this >=20 > - driver. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -ExtractConfig ( >=20 > - IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, >=20 > - IN CONST EFI_STRING Request, >=20 > - OUT EFI_STRING *Progress, >=20 > - OUT EFI_STRING *Results >=20 > - ) >=20 > -{ >=20 > - if (Progress =3D=3D NULL || Results =3D=3D NULL) { >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - *Progress =3D Request; >=20 > - return EFI_NOT_FOUND; >=20 > -} >=20 > - >=20 > - >=20 > -/** >=20 > - This function processes the results of changes in configuration. >=20 > - >=20 > - @param This Points to the EFI_HII_CONFIG_ACCESS_PRO= TOCOL. >=20 > - @param Configuration A null-terminated Unicode string in >=20 > - format. >=20 > - @param Progress A pointer to a string filled in with th= e offset of >=20 > - the most recent '&' before the first fa= iling >=20 > - name/value pair (or the beginning of th= e string if >=20 > - the failure is in the first name/value = pair) or >=20 > - the terminating NULL if all was success= ful. >=20 > - >=20 > - @retval EFI_SUCCESS The Results is processed successfully. >=20 > - @retval EFI_INVALID_PARAMETER Configuration is NULL. >=20 > - @retval EFI_NOT_FOUND Routing data doesn't match any storage = in this >=20 > - driver. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -RouteConfig ( >=20 > - IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, >=20 > - IN CONST EFI_STRING Configuration, >=20 > - OUT EFI_STRING *Progress >=20 > - ) >=20 > -{ >=20 > - if (Configuration =3D=3D NULL || Progress =3D=3D NULL) { >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - >=20 > - *Progress =3D Configuration; >=20 > - >=20 > - return EFI_NOT_FOUND; >=20 > -} >=20 > - >=20 > -/** >=20 > - HII update Admin Password status. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -HiiUpdateAdminPasswordStatus ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - if (IsPasswordInstalled ()) { >=20 > - HiiSetString ( >=20 > - mUserAuthenticationData->HiiHandle, >=20 > - STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT), >=20 > - L"Installed", >=20 > - NULL >=20 > - ); >=20 > - } else { >=20 > - HiiSetString ( >=20 > - mUserAuthenticationData->HiiHandle, >=20 > - STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT), >=20 > - L"Not Installed", >=20 > - NULL >=20 > - ); >=20 > - } >=20 > -} >=20 > - >=20 > -/** >=20 > - This function processes the results of changes in configuration. >=20 > - >=20 > - @param This Points to the EFI_HII_CONFIG_ACCESS_PRO= TOCOL. >=20 > - @param Action Specifies the type of action taken by t= he browser. >=20 > - @param QuestionId A unique value which is sent to the ori= ginal >=20 > - exporting driver so that it can identif= y the type >=20 > - of data to expect. >=20 > - @param Type The type of value for the question. >=20 > - @param Value A pointer to the data being sent to the= original >=20 > - exporting driver. >=20 > - @param ActionRequest On return, points to the action request= ed by the >=20 > - callback function. >=20 > - >=20 > - @retval EFI_SUCCESS The callback successfully handled the a= ction. >=20 > - @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold= the >=20 > - variable and its data. >=20 > - @retval EFI_DEVICE_ERROR The variable could not be saved. >=20 > - @retval EFI_UNSUPPORTED The specified Action is not supported b= y the >=20 > - callback. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -UserAuthenticationCallback ( >=20 > - IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, >=20 > - IN EFI_BROWSER_ACTION Action, >=20 > - IN EFI_QUESTION_ID QuestionId, >=20 > - IN UINT8 Type, >=20 > - IN EFI_IFR_TYPE_VALUE *Value, >=20 > - OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - CHAR16 *UserInputPassword; >=20 > - >=20 > - Status =3D EFI_SUCCESS; >=20 > - >=20 > - if (((Value =3D=3D NULL) && (Action !=3D EFI_BROWSER_ACTION_FORM_OPEN)= && (Action !=3D > EFI_BROWSER_ACTION_FORM_CLOSE)) || >=20 > - (ActionRequest =3D=3D NULL)) { >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - >=20 > - switch (Action) { >=20 > - case EFI_BROWSER_ACTION_FORM_OPEN: >=20 > - { >=20 > - switch (QuestionId) { >=20 > - case ADMIN_PASSWORD_KEY_ID: >=20 > - HiiUpdateAdminPasswordStatus (); >=20 > - default: >=20 > - break; >=20 > - } >=20 > - } >=20 > - break; >=20 > - case EFI_BROWSER_ACTION_CHANGING: >=20 > - { >=20 > - switch (QuestionId) { >=20 > - case ADMIN_PASSWORD_KEY_ID: >=20 > - if ((Type =3D=3D EFI_IFR_TYPE_STRING) && (Value->string =3D=3D 0= ) && >=20 > - (mUserAuthenticationData->PasswordState =3D=3D BROWSER_STATE= _SET_PASSWORD)) { >=20 > - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_VALID= ATE_PASSWORD; >=20 > - ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAut= henticationData->OldPassword)); >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - // >=20 > - // The Callback is responsible for validating old password input= by user, >=20 > - // If Callback return EFI_SUCCESS, it indicates validation pass. >=20 > - // >=20 > - switch (mUserAuthenticationData->PasswordState) { >=20 > - case BROWSER_STATE_VALIDATE_PASSWORD: >=20 > - UserInputPassword =3D HiiGetString (mUserAuthenticationData->H= iiHandle, Value->string, NULL); >=20 > - if ((StrLen (UserInputPassword) >=3D PASSWORD_MAX_SIZE)) { >=20 > - Status =3D EFI_NOT_READY; >=20 > - break; >=20 > - } >=20 > - if (UserInputPassword[0] =3D=3D 0) { >=20 > - // >=20 > - // Setup will use a NULL password to check whether the old p= assword is set, >=20 > - // If the validation is successful, means there is no old pa= ssword, return >=20 > - // success to set the new password. Or need to return EFI_NO= T_READY to >=20 > - // let user input the old password. >=20 > - // >=20 > - Status =3D VerifyPassword (UserInputPassword, StrSize (UserI= nputPassword)); >=20 > - if (Status =3D=3D EFI_SUCCESS) { >=20 > - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_S= ET_PASSWORD; >=20 > - } else { >=20 > - Status =3D EFI_NOT_READY; >=20 > - } >=20 > - break; >=20 > - } >=20 > - Status =3D VerifyPassword (UserInputPassword, StrSize (UserInp= utPassword)); >=20 > - if (Status =3D=3D EFI_SUCCESS) { >=20 > - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_SET= _PASSWORD; >=20 > - StrCpyS ( >=20 > - mUserAuthenticationData->OldPassword, >=20 > - sizeof(mUserAuthenticationData->OldPassword)/sizeof(CHAR16= ), >=20 > - UserInputPassword >=20 > - ); >=20 > - } else { >=20 > - // >=20 > - // Old password mismatch, return EFI_NOT_READY to prompt for= error message. >=20 > - // >=20 > - if (Status =3D=3D EFI_ACCESS_DENIED) { >=20 > - // >=20 > - // Password retry count reach. >=20 > - // >=20 > - ForceSystemReset (); >=20 > - } >=20 > - Status =3D EFI_NOT_READY; >=20 > - } >=20 > - break; >=20 > - >=20 > - case BROWSER_STATE_SET_PASSWORD: >=20 > - UserInputPassword =3D HiiGetString (mUserAuthenticationData->H= iiHandle, Value->string, NULL); >=20 > - if ((StrLen (UserInputPassword) >=3D PASSWORD_MAX_SIZE)) { >=20 > - Status =3D EFI_NOT_READY; >=20 > - break; >=20 > - } >=20 > - Status =3D SetPassword (UserInputPassword, StrSize (UserInputP= assword), mUserAuthenticationData->OldPassword, > StrSize(mUserAuthenticationData->OldPassword)); >=20 > - PrintSetPasswordStatus (Status); >=20 > - ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAut= henticationData->OldPassword)); >=20 > - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_VALID= ATE_PASSWORD; >=20 > - HiiUpdateAdminPasswordStatus (); >=20 > - break; >=20 > - >=20 > - default: >=20 > - break; >=20 > - } >=20 > - default: >=20 > - break; >=20 > - } >=20 > - } >=20 > - break; >=20 > - default: >=20 > - break; >=20 > - } >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Unregister status code callback functions. >=20 > - >=20 > - @param Event Event whose notification function is being invok= ed. >=20 > - @param Context Pointer to the notification function's context, = which is >=20 > - always zero in current implementation. >=20 > - >=20 > -**/ >=20 > -VOID >=20 > -EFIAPI >=20 > -UnregisterBootTimeHandlers ( >=20 > - IN EFI_EVENT Event, >=20 > - IN VOID *Context >=20 > - ) >=20 > -{ >=20 > - mRscHandlerProtocol->Unregister (CheckForPassword); >=20 > -} >=20 > - >=20 > -/** >=20 > - User Authentication entry point. >=20 > - >=20 > - @param ImageHandle The image handle. >=20 > - @param SystemTable The system table. >=20 > - >=20 > - @retval EFI_SUCCESS The entry point is executed successfully. >=20 > - @return other Contain some other errors. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -UserAuthenticationEntry ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - EFI_HANDLE DriverHandle; >=20 > - EFI_HII_HANDLE HiiHandle; >=20 > - >=20 > - DriverHandle =3D NULL; >=20 > - >=20 > - mUserAuthenticationData =3D AllocateZeroPool (sizeof (USER_AUTHENTICAT= ION_PRIVATE_DATA)); >=20 > - if (mUserAuthenticationData =3D=3D NULL) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - mUserAuthenticationData->ConfigAccess.ExtractConfig =3D ExtractConfig; >=20 > - mUserAuthenticationData->ConfigAccess.RouteConfig =3D RouteConfig; >=20 > - mUserAuthenticationData->ConfigAccess.Callback =3D UserAuthenticationC= allback; >=20 > - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_VALIDATE_PASS= WORD; >=20 > - >=20 > - // >=20 > - // Install Config Access protocol to driver handle. >=20 > - // >=20 > - Status =3D gBS->InstallMultipleProtocolInterfaces ( >=20 > - &DriverHandle, >=20 > - &gEfiDevicePathProtocolGuid, >=20 > - &mHiiVendorDevicePath, >=20 > - &gEfiHiiConfigAccessProtocolGuid, >=20 > - &mUserAuthenticationData->ConfigAccess, >=20 > - NULL >=20 > - ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - mUserAuthenticationData->DriverHandle =3D DriverHandle; >=20 > - >=20 > - // >=20 > - // Add HII data to database. >=20 > - // >=20 > - HiiHandle =3D HiiAddPackages ( >=20 > - &mUserAuthenticationVendorGuid, >=20 > - DriverHandle, >=20 > - UserAuthenticationDxeStrings, >=20 > - UserAuthenticationDxeVfrBin, >=20 > - NULL >=20 > - ); >=20 > - if (HiiHandle =3D=3D NULL) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - mUserAuthenticationData->HiiHandle =3D HiiHandle; >=20 > - >=20 > - // >=20 > - // Locate report status code protocol. >=20 > - // >=20 > - Status =3D gBS->LocateProtocol ( >=20 > - &gEfiRscHandlerProtocolGuid, >=20 > - NULL, >=20 > - (VOID **) &mRscHandlerProtocol >=20 > - ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - // >=20 > - //Register the callback function for ReportStatusCode() notification. >=20 > - // >=20 > - mRscHandlerProtocol->Register (CheckForPassword, TPL_HIGH_LEVEL); >=20 > - >=20 > - // >=20 > - // Unregister boot time report status code listener at ExitBootService= Event. >=20 > - // >=20 > - Status =3D gBS->CreateEventEx ( >=20 > - EVT_NOTIFY_SIGNAL, >=20 > - TPL_NOTIFY, >=20 > - UnregisterBootTimeHandlers, >=20 > - NULL, >=20 > - &gEfiEventExitBootServicesGuid, >=20 > - &mExitBootServicesEvent >=20 > - ); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - // >=20 > - // Locates SMM Communication protocol. >=20 > - // >=20 > - Status =3D gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NUL= L, (VOID **) &mSmmCommunication); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Unloads the application and its installed protocol. >=20 > - >=20 > - @param[in] ImageHandle Handle that identifies the image to be u= nloaded. >=20 > - >=20 > - @retval EFI_SUCCESS The image has been unloaded. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -UserAuthenticationUnload ( >=20 > - IN EFI_HANDLE ImageHandle >=20 > - ) >=20 > -{ >=20 > - ASSERT (mUserAuthenticationData !=3D NULL); >=20 > - >=20 > - // >=20 > - // Uninstall Config Access Protocol. >=20 > - // >=20 > - if (mUserAuthenticationData->DriverHandle !=3D NULL) { >=20 > - gBS->UninstallMultipleProtocolInterfaces ( >=20 > - mUserAuthenticationData->DriverHandle, >=20 > - &gEfiDevicePathProtocolGuid, >=20 > - &mHiiVendorDevicePath, >=20 > - &gEfiHiiConfigAccessProtocolGuid, >=20 > - &mUserAuthenticationData->ConfigAccess, >=20 > - NULL >=20 > - ); >=20 > - mUserAuthenticationData->DriverHandle =3D NULL; >=20 > - } >=20 > - >=20 > - // >=20 > - // Remove Hii Data. >=20 > - // >=20 > - if (mUserAuthenticationData->HiiHandle !=3D NULL) { >=20 > - HiiRemovePackages (mUserAuthenticationData->HiiHandle); >=20 > - } >=20 > - >=20 > - FreePool (mUserAuthenticationData); >=20 > - mUserAuthenticationData =3D NULL; >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Us= erAuthenticationDxe.h > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentic= ationDxe.h > deleted file mode 100644 > index e183424f35..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthe= nticationDxe.h > +++ /dev/null > @@ -1,138 +0,0 @@ > -/** @file >=20 > - Header file for UserAuthenticationDxe. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef _USER_AUTHENTICATION_DXE_H_ >=20 > -#define _USER_AUTHENTICATION_DXE_H_ >=20 > - >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include "UserAuthenticationDxeFormset.h" >=20 > - >=20 > -extern UINT8 UserAuthenticationDxeVfrBin[]; >=20 > -extern UINT8 UserAuthenticationDxeStrings[]; >=20 > -extern EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication; >=20 > - >=20 > -typedef struct { >=20 > - EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; >=20 > - EFI_HANDLE DriverHandle; >=20 > - EFI_HII_HANDLE HiiHandle; >=20 > - UINT8 PasswordState; >=20 > - CHAR16 OldPassword[PASSWORD_MAX_SIZE]; >=20 > -} USER_AUTHENTICATION_PRIVATE_DATA; >=20 > - >=20 > -#pragma pack(1) >=20 > -/// >=20 > -/// HII specific Vendor Device Path definition. >=20 > -/// >=20 > -typedef struct { >=20 > - VENDOR_DEVICE_PATH VendorDevicePath; >=20 > - EFI_DEVICE_PATH_PROTOCOL End; >=20 > -} HII_VENDOR_DEVICE_PATH; >=20 > -#pragma pack() >=20 > - >=20 > -/** >=20 > - Validate if the password is correct. >=20 > - >=20 > - @param[in] Password The user input password. >=20 > - @param[in] PasswordSize The size of Password in byte. >=20 > - >=20 > - @retval EFI_SUCCESS The password is correct. >=20 > - @retval EFI_SECURITY_VIOLATION The password is incorrect. >=20 > - @retval EFI_INVALID_PARAMETER The password or size is invalid. >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the= password. >=20 > - @retval EFI_ACCESS_DENIED Password retry count reach. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -VerifyPassword ( >=20 > - IN CHAR16 *Password, >=20 > - IN UINTN PasswordSize >=20 > - ); >=20 > - >=20 > -/** >=20 > - Set a new password. >=20 > - >=20 > - @param[in] NewPassword The user input new password. >=20 > - NULL means clear password. >=20 > - @param[in] NewPasswordSize The size of NewPassword in byte. >=20 > - @param[in] OldPassword The user input old password. >=20 > - NULL means no old password. >=20 > - @param[in] OldPasswordSize The size of OldPassword in byte. >=20 > - >=20 > - @retval EFI_SUCCESS The NewPassword is set successfully. >=20 > - @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect. >=20 > - @retval EFI_INVALID_PARAMETER The password or size is invalid. >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the pa= ssword. >=20 > - @retval EFI_ACCESS_DENIED Password retry count reach. >=20 > - @retval EFI_UNSUPPORTED NewPassword is not strong enough. >=20 > - @retval EFI_ALREADY_STARTED NewPassword is in history. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -SetPassword ( >=20 > - IN CHAR16 *NewPassword, OPTIONAL >=20 > - IN UINTN NewPasswordSize, >=20 > - IN CHAR16 *OldPassword, OPTIONAL >=20 > - IN UINTN OldPasswordSize >=20 > - ); >=20 > - >=20 > -/** >=20 > - Return if the password is set. >=20 > - >=20 > - @retval TRUE The password is set. >=20 > - @retval FALSE The password is not set. >=20 > -**/ >=20 > -BOOLEAN >=20 > -IsPasswordInstalled ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -/** >=20 > - Get password verification policy. >=20 > - >=20 > - @param[out] VerifyPolicy Verification policy. >=20 > - >=20 > - @retval EFI_SUCCESS Get verification policy successfully= . >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verifi= cation policy. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -GetPasswordVerificationPolicy ( >=20 > - OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy >=20 > - ); >=20 > - >=20 > -/** >=20 > - Return if the password was verified. >=20 > - >=20 > - @retval TRUE The password was verified. >=20 > - @retval FALSE The password was not verified. >=20 > -**/ >=20 > -BOOLEAN >=20 > -WasPasswordVerified ( >=20 > - VOID >=20 > - ); >=20 > - >=20 > -#endif >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Us= erAuthenticationDxe.inf > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentic= ationDxe.inf > deleted file mode 100644 > index 61f5f27e63..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthe= nticationDxe.inf > +++ /dev/null > @@ -1,63 +0,0 @@ > -## @file >=20 > -# User Authentication Dxe Driver. >=20 > -# >=20 > -# This Driver mainly provides Setup Form to change password and >=20 > -# does user authentication before entering Setup. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D UserAuthenticationDxe >=20 > - FILE_GUID =3D 0683FB88-664C-4BA6-9ED4-1C0916EE43A= 4 >=20 > - MODULE_TYPE =3D DXE_DRIVER >=20 > - VERSION_STRING =3D 2.0 >=20 > - ENTRY_POINT =3D UserAuthenticationEntry >=20 > - UNLOAD_IMAGE =3D UserAuthenticationUnload >=20 > - >=20 > - >=20 > -[Sources] >=20 > - UserAuthenticationDxe.c >=20 > - UserAuthenticationDxe.h >=20 > - UserAuthenticationDxePassword.c >=20 > - UserAuthenticationDxeFormset.h >=20 > - UserAuthenticationDxeVfr.vfr >=20 > - UserAuthenticationDxeStrings.uni >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - BaseLib >=20 > - UefiBootServicesTableLib >=20 > - UefiDriverEntryPoint >=20 > - UefiRuntimeServicesTableLib >=20 > - BaseMemoryLib >=20 > - DebugLib >=20 > - UefiLib >=20 > - HiiLib >=20 > - DevicePathLib >=20 > - MemoryAllocationLib >=20 > - PlatformPasswordLib >=20 > - PrintLib >=20 > - >=20 > -[Guids] >=20 > - gUserAuthenticationGuid ## CONSUMES ## GUID >=20 > - gEfiEventExitBootServicesGuid ## CONSUMES ## Event >=20 > - gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTa= ble >=20 > - >=20 > -[Protocols] >=20 > - gEfiRscHandlerProtocolGuid ## CONSUMES >=20 > - gEfiDevicePathProtocolGuid ## PRODUCES >=20 > - gEfiHiiConfigAccessProtocolGuid ## PRODUCES >=20 > - gEfiSmmCommunicationProtocolGuid ## CONSUMES >=20 > - >=20 > -[Depex] >=20 > - gEfiSimpleTextOutProtocolGuid AND >=20 > - gEfiSmmCommunicationProtocolGuid AND >=20 > - gEfiVariableArchProtocolGuid AND >=20 > - gEfiVariableWriteArchProtocolGuid >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Us= erAuthenticationDxeFormset.h > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentic= ationDxeFormset.h > deleted file mode 100644 > index 581849b534..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthe= nticationDxeFormset.h > +++ /dev/null > @@ -1,23 +0,0 @@ > -/** @file >=20 > - Header file for UserAuthentication formset. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef _USER_AUTHENTICATION_DXE_FORMSET_H_ >=20 > -#define _USER_AUTHENTICATION_DXE_FORMSET_H_ >=20 > - >=20 > -// >=20 > -// Vendor GUID of the formset >=20 > -// >=20 > -#define USER_AUTHENTICATION_FORMSET_GUID \ >=20 > - { 0x760e3022, 0xf149, 0x4560, {0x9c, 0x6f, 0x33, 0xaa, 0x7d, 0x48, 0x7= 5, 0xfa} } >=20 > - >=20 > -#define ADMIN_PASSWORD_KEY_ID 0x2001 >=20 > - >=20 > -#define MAX_PASSWORD_LEN 32 >=20 > -#define MIN_PASSWORD_LEN 0 >=20 > - >=20 > -#endif >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Us= erAuthenticationDxePassword.c > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentic= ationDxePassword.c > deleted file mode 100644 > index 6e1fedfab7..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthe= nticationDxePassword.c > +++ /dev/null > @@ -1,319 +0,0 @@ > -/** @file >=20 > - UserAuthentication DXE password wrapper. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include "UserAuthenticationDxe.h" >=20 > - >=20 > -/** >=20 > - Initialize the communicate buffer using DataSize and Function. >=20 > - >=20 > - @param[out] DataPtr Points to the data in the communicat= e buffer. >=20 > - @param[in] DataSize The data size to send to SMM. >=20 > - @param[in] Function The function number to initialize th= e communicate header. >=20 > - >=20 > - @return Communicate buffer. >=20 > -**/ >=20 > -VOID* >=20 > -InitCommunicateBuffer ( >=20 > - OUT VOID **DataPtr OPTIONAL, >=20 > - IN UINTN DataSize, >=20 > - IN UINTN Function >=20 > - ) >=20 > -{ >=20 > - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; >=20 > - SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader; >=20 > - VOID *Buffer; >=20 > - EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable; >=20 > - EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion; >=20 > - UINTN Index; >=20 > - UINTN Size; >=20 > - EFI_STATUS Status; >=20 > - >=20 > - Buffer =3D NULL; >=20 > - Status =3D EfiGetSystemConfigurationTable ( >=20 > - &gEdkiiPiSmmCommunicationRegionTableGuid, >=20 > - (VOID **) &SmmCommRegionTable >=20 > - ); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return NULL; >=20 > - } >=20 > - ASSERT (SmmCommRegionTable !=3D NULL); >=20 > - SmmCommMemRegion =3D (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1= ); >=20 > - Size =3D 0; >=20 > - for (Index =3D 0; Index < SmmCommRegionTable->NumberOfEntries; Index++= ) { >=20 > - if (SmmCommMemRegion->Type =3D=3D EfiConventionalMemory) { >=20 > - Size =3D EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPage= s); >=20 > - if (Size >=3D (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, D= ata) + sizeof > (SMM_PASSWORD_COMMUNICATE_HEADER))) { >=20 > - break; >=20 > - } >=20 > - } >=20 > - SmmCommMemRegion =3D (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMem= Region + SmmCommRegionTable- > >DescriptorSize); >=20 > - } >=20 > - ASSERT (Index < SmmCommRegionTable->NumberOfEntries); >=20 > - >=20 > - Buffer =3D (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart; >=20 > - ASSERT (Buffer !=3D NULL); >=20 > - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) Buffer; >=20 > - CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid)= ; >=20 > - SmmCommunicateHeader->MessageLength =3D DataSize + sizeof (SMM_PASSWOR= D_COMMUNICATE_HEADER); >=20 > - >=20 > - SmmPasswordFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmC= ommunicateHeader->Data; >=20 > - ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_CO= MMUNICATE_HEADER)); >=20 > - SmmPasswordFunctionHeader->Function =3D Function; >=20 > - if (DataPtr !=3D NULL) { >=20 > - *DataPtr =3D SmmPasswordFunctionHeader + 1; >=20 > - } >=20 > - >=20 > - return Buffer; >=20 > -} >=20 > - >=20 > -/** >=20 > - Send the data in communicate buffer to SMM. >=20 > - >=20 > - @param[in] Buffer Points to the data in the communic= ate buffer. >=20 > - @param[in] DataSize The data size to send to SMM. >=20 > - >=20 > - @retval EFI_SUCCESS Success is returned from the funct= ion in SMM. >=20 > - @retval Others Failure is returned from the funct= ion in SMM. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -SendCommunicateBuffer ( >=20 > - IN VOID *Buffer, >=20 > - IN UINTN DataSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINTN CommSize; >=20 > - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; >=20 > - SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader; >=20 > - >=20 > - CommSize =3D DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) += sizeof > (SMM_PASSWORD_COMMUNICATE_HEADER); >=20 > - >=20 > - Status =3D mSmmCommunication->Communicate (mSmmCommunication, Buffer, = &CommSize); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) Buffer; >=20 > - SmmPasswordFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmCo= mmunicateHeader->Data; >=20 > - return SmmPasswordFunctionHeader->ReturnStatus; >=20 > -} >=20 > - >=20 > -/** >=20 > - Validate if the password is correct. >=20 > - >=20 > - @param[in] Password The user input password. >=20 > - @param[in] PasswordSize The size of Password in byte. >=20 > - >=20 > - @retval EFI_SUCCESS The password is correct. >=20 > - @retval EFI_SECURITY_VIOLATION The password is incorrect. >=20 > - @retval EFI_INVALID_PARAMETER The password or size is invalid. >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the= password. >=20 > - @retval EFI_ACCESS_DENIED Password retry count reach. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -VerifyPassword ( >=20 > - IN CHAR16 *Password, >=20 > - IN UINTN PasswordSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - VOID *Buffer; >=20 > - SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD *VerifyPassword; >=20 > - >=20 > - ASSERT (Password !=3D NULL); >=20 > - >=20 > - if (PasswordSize > sizeof(VerifyPassword->Password) * sizeof(CHAR16)) = { >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - >=20 > - Buffer =3D InitCommunicateBuffer ( >=20 > - (VOID**)&VerifyPassword, >=20 > - sizeof(*VerifyPassword), >=20 > - SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD >=20 > - ); >=20 > - if (Buffer =3D=3D NULL) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - Status =3D UnicodeStrToAsciiStrS (Password, VerifyPassword->Password, = sizeof(VerifyPassword->Password)); >=20 > - if (EFI_ERROR(Status)) { >=20 > - goto EXIT; >=20 > - } >=20 > - >=20 > - Status =3D SendCommunicateBuffer (Buffer, sizeof(*VerifyPassword)); >=20 > - >=20 > -EXIT: >=20 > - ZeroMem (VerifyPassword, sizeof(*VerifyPassword)); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Set a new password. >=20 > - >=20 > - @param[in] NewPassword The user input new password. >=20 > - NULL means clear password. >=20 > - @param[in] NewPasswordSize The size of NewPassword in byte. >=20 > - @param[in] OldPassword The user input old password. >=20 > - NULL means no old password. >=20 > - @param[in] OldPasswordSize The size of OldPassword in byte. >=20 > - >=20 > - @retval EFI_SUCCESS The NewPassword is set successfully. >=20 > - @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect. >=20 > - @retval EFI_INVALID_PARAMETER The password or size is invalid. >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the pa= ssword. >=20 > - @retval EFI_ACCESS_DENIED Password retry count reach. >=20 > - @retval EFI_UNSUPPORTED NewPassword is not strong enough. >=20 > - @retval EFI_ALREADY_STARTED NewPassword is in history. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -SetPassword ( >=20 > - IN CHAR16 *NewPassword, OPTIONAL >=20 > - IN UINTN NewPasswordSize, >=20 > - IN CHAR16 *OldPassword, OPTIONAL >=20 > - IN UINTN OldPasswordSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - VOID *Buffer; >=20 > - SMM_PASSWORD_COMMUNICATE_SET_PASSWORD *SetPassword; >=20 > - >=20 > - if (NewPasswordSize > sizeof(SetPassword->NewPassword) * sizeof(CHAR16= )) { >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - if (OldPasswordSize > sizeof(SetPassword->OldPassword) * sizeof(CHAR16= )) { >=20 > - return EFI_INVALID_PARAMETER; >=20 > - } >=20 > - >=20 > - Buffer =3D InitCommunicateBuffer ( >=20 > - (VOID**)&SetPassword, >=20 > - sizeof(*SetPassword), >=20 > - SMM_PASSWORD_FUNCTION_SET_PASSWORD >=20 > - ); >=20 > - if (Buffer =3D=3D NULL) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - if (NewPassword !=3D NULL) { >=20 > - Status =3D UnicodeStrToAsciiStrS (NewPassword, SetPassword->NewPassw= ord, sizeof(SetPassword->NewPassword)); >=20 > - if (EFI_ERROR(Status)) { >=20 > - goto EXIT; >=20 > - } >=20 > - } else { >=20 > - SetPassword->NewPassword[0] =3D 0; >=20 > - } >=20 > - >=20 > - if (OldPassword !=3D NULL) { >=20 > - Status =3D UnicodeStrToAsciiStrS (OldPassword, SetPassword->OldPassw= ord, sizeof(SetPassword->OldPassword)); >=20 > - if (EFI_ERROR(Status)) { >=20 > - goto EXIT; >=20 > - } >=20 > - } else { >=20 > - SetPassword->OldPassword[0] =3D 0; >=20 > - } >=20 > - >=20 > - Status =3D SendCommunicateBuffer (Buffer, sizeof(*SetPassword)); >=20 > - >=20 > -EXIT: >=20 > - ZeroMem (SetPassword, sizeof(*SetPassword)); >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Return if the password is set. >=20 > - >=20 > - @retval TRUE The password is set. >=20 > - @retval FALSE The password is not set. >=20 > -**/ >=20 > -BOOLEAN >=20 > -IsPasswordInstalled ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - VOID *Buffer; >=20 > - >=20 > - Buffer =3D InitCommunicateBuffer ( >=20 > - NULL, >=20 > - 0, >=20 > - SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET >=20 > - ); >=20 > - if (Buffer =3D=3D NULL) { >=20 > - return FALSE; >=20 > - } >=20 > - >=20 > - Status =3D SendCommunicateBuffer (Buffer, 0); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return FALSE; >=20 > - } >=20 > - >=20 > - return TRUE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Get password verification policy. >=20 > - >=20 > - @param[out] VerifyPolicy Verification policy. >=20 > - >=20 > - @retval EFI_SUCCESS Get verification policy successfully= . >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verifi= cation policy. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -GetPasswordVerificationPolicy ( >=20 > - OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - VOID *Buffer; >=20 > - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *GetVerifyPolicy; >=20 > - >=20 > - Buffer =3D InitCommunicateBuffer ( >=20 > - (VOID**)&GetVerifyPolicy, >=20 > - sizeof(*GetVerifyPolicy), >=20 > - SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY >=20 > - ); >=20 > - if (Buffer =3D=3D NULL) { >=20 > - return EFI_OUT_OF_RESOURCES; >=20 > - } >=20 > - >=20 > - Status =3D SendCommunicateBuffer (Buffer, sizeof(*GetVerifyPolicy)); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - CopyMem (VerifyPolicy, GetVerifyPolicy, sizeof (SMM_PASSWORD_COMMUNI= CATE_VERIFY_POLICY)); >=20 > - } >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Return if the password was verified. >=20 > - >=20 > - @retval TRUE The password was verified. >=20 > - @retval FALSE The password was not verified. >=20 > -**/ >=20 > -BOOLEAN >=20 > -WasPasswordVerified ( >=20 > - VOID >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - VOID *Buffer; >=20 > - >=20 > - Buffer =3D InitCommunicateBuffer ( >=20 > - NULL, >=20 > - 0, >=20 > - SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED >=20 > - ); >=20 > - if (Buffer =3D=3D NULL) { >=20 > - return FALSE; >=20 > - } >=20 > - >=20 > - Status =3D SendCommunicateBuffer (Buffer, 0); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return FALSE; >=20 > - } >=20 > - >=20 > - return TRUE; >=20 > -} >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Us= erAuthenticationDxeStrings.uni > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentic= ationDxeStrings.uni > deleted file mode 100644 > index 1e3a179677..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthe= nticationDxeStrings.uni > +++ /dev/null > @@ -1,30 +0,0 @@ > -/** @file >=20 > -// String definitions for User Authentication formset. >=20 > -// >=20 > -// Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -// >=20 > -// SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -// >=20 > -**/ >=20 > - >=20 > -#langdef en-US "English" >=20 > -#langdef fr-FR "Francais" >=20 > - >=20 > - >=20 > -#string STR_FORM_SET_TITLE #language en-US "User Password Ma= nagement" >=20 > - #language fr-FR "User Password Ma= nagement" >=20 > -#string STR_FORM_SET_TITLE_HELP #language en-US "This Driver main= ly handle user's password" >=20 > - #language fr-FR "This Driver main= ly handle user's password" >=20 > -#string STR_FORM_TITLE #language en-US "Password Managem= ent Form" >=20 > - #language fr-FR "Password Managem= ent Form" >=20 > -#string STR_ADMIN_PASSWORD_PROMPT #language en-US "Change Admin Pas= sword" >=20 > - #language fr-FR "Change Admin Pas= sword" >=20 > -#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 th= e new password when you enter UI. The new > password must be between 8 and 32 chars include lowercase, uppercase alph= abetic, number, and symbol. Input an empty > password can clean old admin password, then no need input password to ent= er UI." >=20 > - #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 whe= n you enter UI. The new password must be > between 8 and 32 chars include lowercase, uppercase alphabetic, number, a= nd symbol. Input an empty password can > clean old admin password, then no need input password to enter UI." >=20 > -#string STR_ADMIN_PASSWORD_STS_HELP #language en-US "Current Admin Pa= ssword status: Installed or Not Installed." >=20 > - #language fr-FR "Current Admin Pa= ssword status: Installed or Not Installed." >=20 > -#string STR_ADMIN_PASSWORD_STS_PROMPT #language en-US "Admin Password S= tatus" >=20 > - #language fr-FR "Admin Password S= tatus" >=20 > -#string STR_ADMIN_PASSWORD_STS_CONTENT #language en-US "" >=20 > - #language fr-FR "" >=20 > - >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Us= erAuthenticationDxeVfr.vfr > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentic= ationDxeVfr.vfr > deleted file mode 100644 > index ca1d5ddec1..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthe= nticationDxeVfr.vfr > +++ /dev/null > @@ -1,39 +0,0 @@ > -///** @file >=20 > -// UserAuthentication formset. >=20 > -// >=20 > -// Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -// SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -// >=20 > -//**/ >=20 > - >=20 > -#include >=20 > -#include "UserAuthenticationDxeFormset.h" >=20 > - >=20 > -formset >=20 > - guid =3D USER_AUTHENTICATION_FORMSET_GUID, >=20 > - title =3D STRING_TOKEN(STR_FORM_SET_TITLE), >=20 > - help =3D STRING_TOKEN(STR_FORM_SET_TITLE_HELP), >=20 > - classguid =3D EFI_HII_PLATFORM_SETUP_FORMSET_GUID, >=20 > - >=20 > - form formid =3D 1, >=20 > - title =3D STRING_TOKEN(STR_FORM_TITLE); >=20 > - >=20 > - grayoutif TRUE; >=20 > - text >=20 > - help =3D STRING_TOKEN(STR_ADMIN_PASSWORD_STS_HELP), >=20 > - text =3D STRING_TOKEN(STR_ADMIN_PASSWORD_STS_PROMPT), >=20 > - text =3D STRING_TOKEN(STR_ADMIN_PASSWORD_STS_CONTENT); >=20 > - endif; >=20 > - >=20 > - password >=20 > - prompt =3D STRING_TOKEN(STR_ADMIN_PASSWORD_PROMPT), >=20 > - help =3D STRING_TOKEN(STR_ADMIN_PASSWORD_HELP), >=20 > - flags =3D INTERACTIVE, >=20 > - key =3D ADMIN_PASSWORD_KEY_ID, >=20 > - minsize =3D MIN_PASSWORD_LEN, >=20 > - maxsize =3D MAX_PASSWORD_LEN, >=20 > - endpassword; >=20 > - >=20 > - endform; >=20 > - >=20 > -endformset; >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Us= erAuthenticationSmm.c > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentic= ationSmm.c > deleted file mode 100644 > index 07e834ebfa..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthe= nticationSmm.c > +++ /dev/null > @@ -1,674 +0,0 @@ > -/** @file >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#include "UserAuthenticationSmm.h" >=20 > - >=20 > -EFI_SMM_VARIABLE_PROTOCOL *mSmmVariable; >=20 > - >=20 > -UINTN mAdminPasswordTryCount =3D 0; >=20 > - >=20 > -BOOLEAN mNeedReVerify =3D TRUE; >=20 > -BOOLEAN mPasswordVerified =3D FALSE; >=20 > - >=20 > -/** >=20 > - Verify if the password is correct. >=20 > - >=20 > - @param[in] Password The user input password. >=20 > - @param[in] PasswordSize The size of Password in byte. >=20 > - @param[in] UserPasswordVarStruct The storage of password in variable= . >=20 > - >=20 > - @retval EFI_SUCCESS The password is correct. >=20 > - @retval EFI_SECURITY_VIOLATION The password is incorrect. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -VerifyPassword ( >=20 > - IN CHAR8 *Password, >=20 > - IN UINTN PasswordSize, >=20 > - IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct >=20 > - ) >=20 > -{ >=20 > - BOOLEAN HashOk; >=20 > - UINT8 HashData[PASSWORD_HASH_SIZE]; >=20 > - >=20 > - HashOk =3D KeyLibGeneratePBKDF2Hash ( >=20 > - HASH_TYPE_SHA256, >=20 > - (UINT8 *)Password, >=20 > - PasswordSize, >=20 > - UserPasswordVarStruct->PasswordSalt, >=20 > - sizeof(UserPasswordVarStruct->PasswordSalt), >=20 > - HashData, >=20 > - sizeof(HashData) >=20 > - ); >=20 > - if (!HashOk) { >=20 > - return EFI_DEVICE_ERROR; >=20 > - } >=20 > - if (KeyLibSlowCompareMem (UserPasswordVarStruct->PasswordHash, HashDat= a, PASSWORD_HASH_SIZE) =3D=3D 0) { >=20 > - return EFI_SUCCESS; >=20 > - } else { >=20 > - return EFI_SECURITY_VIOLATION; >=20 > - } >=20 > -} >=20 > - >=20 > -/** >=20 > - Get hash data of password from non-volatile variable region. >=20 > - >=20 > - @param[in] UserGuid The user GUID of the password vari= able. >=20 > - @param[in] Index The index of the password. >=20 > - 0 means current password. >=20 > - Non-0 means the password history. >=20 > - @param[out] UserPasswordVarStruct The storage of password in variabl= e. >=20 > - >=20 > - @retval EFI_SUCCESS The password hash is returned successf= ully. >=20 > - @retval EFI_NOT_FOUND The password hash is not found. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -GetPasswordHashFromVariable ( >=20 > - IN EFI_GUID *UserGuid, >=20 > - IN UINTN Index, >=20 > - OUT USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct >=20 > - ) >=20 > -{ >=20 > - UINTN DataSize; >=20 > - CHAR16 PasswordName[sizeof(USER_AUTHENTICAT= ION_VAR_NAME)/sizeof(CHAR16) + 5]; >=20 > - >=20 > - if (Index !=3D 0) { >=20 > - UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s%04x", USER_= AUTHENTICATION_VAR_NAME, Index); >=20 > - } else { >=20 > - UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s", USER_AUTH= ENTICATION_VAR_NAME); >=20 > - } >=20 > - >=20 > - DataSize =3D sizeof(*UserPasswordVarStruct); >=20 > - return mSmmVariable->SmmGetVariable ( >=20 > - PasswordName, >=20 > - UserGuid, >=20 > - NULL, >=20 > - &DataSize, >=20 > - UserPasswordVarStruct >=20 > - ); >=20 > -} >=20 > - >=20 > -/** >=20 > - Save password hash data to non-volatile variable region. >=20 > - >=20 > - @param[in] UserGuid The user GUID of the password vari= able. >=20 > - @param[in] UserPasswordVarStruct The storage of password in variabl= e. >=20 > - >=20 > - @retval EFI_SUCCESS The password hash is saved successfull= y. >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the pas= sword hash. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -SavePasswordHashToVariable ( >=20 > - IN EFI_GUID *UserGuid, >=20 > - IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - >=20 > - if (UserPasswordVarStruct =3D=3D NULL) { >=20 > - Status =3D mSmmVariable->SmmSetVariable ( >=20 > - USER_AUTHENTICATION_VAR_NAME, >=20 > - UserGuid, >=20 > - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIA= BLE_NON_VOLATILE, >=20 > - 0, >=20 > - NULL >=20 > - ); >=20 > - } else { >=20 > - Status =3D mSmmVariable->SmmSetVariable ( >=20 > - USER_AUTHENTICATION_VAR_NAME, >=20 > - UserGuid, >=20 > - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIA= BLE_NON_VOLATILE, >=20 > - sizeof(*UserPasswordVarStruct), >=20 > - UserPasswordVarStruct >=20 > - ); >=20 > - } >=20 > - if (EFI_ERROR (Status)) { >=20 > - DEBUG ((DEBUG_ERROR, "SavePasswordHashToVariable fails with %r\n", S= tatus)); >=20 > - } >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Save old password hash data to non-volatile variable region as history= . >=20 > - >=20 > - The number of password history variable is limited. >=20 > - If all the password history variables are used, the new password histo= ry >=20 > - will override the oldest one. >=20 > - >=20 > - @param[in] UserGuid The user GUID of the password vari= able. >=20 > - @param[in] UserPasswordVarStruct The storage of password in variabl= e. >=20 > - >=20 > - @retval EFI_SUCCESS The password hash is saved successfull= y. >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the pas= sword hash. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -SaveOldPasswordToHistory ( >=20 > - IN EFI_GUID *UserGuid, >=20 > - IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - UINTN DataSize; >=20 > - UINT32 LastIndex; >=20 > - CHAR16 PasswordName[sizeof(USER_AUTHENTICAT= ION_VAR_NAME)/sizeof(CHAR16) + 5]; >=20 > - >=20 > - DEBUG ((DEBUG_INFO, "SaveOldPasswordToHistory\n")); >=20 > - >=20 > - DataSize =3D sizeof(LastIndex); >=20 > - Status =3D mSmmVariable->SmmGetVariable ( >=20 > - USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME, >=20 > - UserGuid, >=20 > - NULL, >=20 > - &DataSize, >=20 > - &LastIndex >=20 > - ); >=20 > - if (EFI_ERROR(Status)) { >=20 > - LastIndex =3D 0; >=20 > - } >=20 > - if (LastIndex >=3D PASSWORD_HISTORY_CHECK_COUNT) { >=20 > - LastIndex =3D 0; >=20 > - } >=20 > - >=20 > - LastIndex ++; >=20 > - UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s%04x", USER_AU= THENTICATION_VAR_NAME, LastIndex); >=20 > - >=20 > - >=20 > - Status =3D mSmmVariable->SmmSetVariable ( >=20 > - PasswordName, >=20 > - UserGuid, >=20 > - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABL= E_NON_VOLATILE, >=20 > - sizeof(*UserPasswordVarStruct), >=20 > - UserPasswordVarStruct >=20 > - ); >=20 > - DEBUG ((DEBUG_INFO, " -- to %s, %r\n", PasswordName, Status)); >=20 > - if (!EFI_ERROR(Status)) { >=20 > - Status =3D mSmmVariable->SmmSetVariable ( >=20 > - USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME, >=20 > - UserGuid, >=20 > - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIA= BLE_NON_VOLATILE, >=20 > - sizeof(LastIndex), >=20 > - &LastIndex >=20 > - ); >=20 > - DEBUG ((DEBUG_INFO, " LastIndex - 0x%04x, %r\n", LastIndex, Status))= ; >=20 > - } >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Calculate password hash data and save it to non-volatile variable regi= on. >=20 > - >=20 > - @param[in] UserGuid The user GUID of the password varia= ble. >=20 > - @param[in] Password The user input password. >=20 > - NULL means delete the password vari= able. >=20 > - @param[in] PasswordSize The size of Password in byte. >=20 > - >=20 > - @retval EFI_SUCCESS The password hash is calculated and sa= ved. >=20 > - @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the pas= sword hash. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -SavePasswordToVariable ( >=20 > - IN EFI_GUID *UserGuid, >=20 > - IN CHAR8 *Password, OPTIONAL >=20 > - IN UINTN PasswordSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct; >=20 > - BOOLEAN HashOk; >=20 > - >=20 > - // >=20 > - // If password is NULL, it means we want to clean password field saved= in variable region. >=20 > - // >=20 > - if (Password !=3D NULL) { >=20 > - KeyLibGenerateSalt (UserPasswordVarStruct.PasswordSalt, sizeof(UserP= asswordVarStruct.PasswordSalt)); >=20 > - HashOk =3D KeyLibGeneratePBKDF2Hash ( >=20 > - HASH_TYPE_SHA256, >=20 > - (UINT8 *)Password, >=20 > - PasswordSize, >=20 > - UserPasswordVarStruct.PasswordSalt, >=20 > - sizeof(UserPasswordVarStruct.PasswordSalt), >=20 > - UserPasswordVarStruct.PasswordHash, >=20 > - sizeof(UserPasswordVarStruct.PasswordHash) >=20 > - ); >=20 > - if (!HashOk) { >=20 > - return EFI_DEVICE_ERROR; >=20 > - } >=20 > - Status =3D SavePasswordHashToVariable (UserGuid, &UserPasswordVarStr= uct); >=20 > - // >=20 > - // Save Password data to history variable >=20 > - // >=20 > - if (!EFI_ERROR(Status)) { >=20 > - SaveOldPasswordToHistory (UserGuid, &UserPasswordVarStruct); >=20 > - } >=20 > - } else { >=20 > - Status =3D SavePasswordHashToVariable (UserGuid, NULL); >=20 > - } >=20 > - >=20 > - return Status; >=20 > -} >=20 > - >=20 > -/** >=20 > - Verify the password. >=20 > - If the password variable does not exist, it passes the verification. >=20 > - If the password variable exists, it does verification based upon passw= ord variable. >=20 > - >=20 > - @param[in] UserGuid The user GUID of the password varia= ble. >=20 > - @param[in] Password The user input password. >=20 > - @param[in] PasswordSize The size of Password in byte. >=20 > - >=20 > - @retval TRUE The verification passes. >=20 > - @retval FALSE The verification fails. >=20 > -**/ >=20 > -BOOLEAN >=20 > -IsPasswordVerified ( >=20 > - IN EFI_GUID *UserGuid, >=20 > - IN CHAR8 *Password, >=20 > - IN UINTN PasswordSize >=20 > - ) >=20 > -{ >=20 > - USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct; >=20 > - EFI_STATUS Status; >=20 > - UINTN *PasswordTryCount; >=20 > - >=20 > - PasswordTryCount =3D &mAdminPasswordTryCount; >=20 > - >=20 > - Status =3D GetPasswordHashFromVariable (UserGuid, 0, &UserPasswordVarS= truct); >=20 > - if (EFI_ERROR(Status)) { >=20 > - return TRUE; >=20 > - } >=20 > - >=20 > - // >=20 > - // Old password exists >=20 > - // >=20 > - Status =3D VerifyPassword (Password, PasswordSize, &UserPasswordVarStr= uct); >=20 > - if (EFI_ERROR(Status)) { >=20 > - if (Password[0] !=3D 0) { >=20 > - *PasswordTryCount =3D *PasswordTryCount + 1; >=20 > - } >=20 > - return FALSE; >=20 > - } >=20 > - >=20 > - return TRUE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Return if the password is set. >=20 > - >=20 > - @param[in] UserGuid The user GUID of the password varia= ble. >=20 > - >=20 > - @retval TRUE The password is set. >=20 > - @retval FALSE The password is not set. >=20 > -**/ >=20 > -BOOLEAN >=20 > -IsPasswordSet ( >=20 > - IN EFI_GUID *UserGuid >=20 > - ) >=20 > -{ >=20 > - USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct; >=20 > - EFI_STATUS Status; >=20 > - >=20 > - Status =3D GetPasswordHashFromVariable(UserGuid, 0, &UserPasswordVarSt= ruct); >=20 > - if (EFI_ERROR(Status)) { >=20 > - return FALSE; >=20 > - } >=20 > - return TRUE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Return if the password is strong. >=20 > - Criteria: >=20 > - 1) length >=3D PASSWORD_MIN_SIZE >=20 > - 2) include lower case, upper case, number, symbol. >=20 > - >=20 > - @param[in] Password The user input password. >=20 > - @param[in] PasswordSize The size of Password in byte. >=20 > - >=20 > - @retval TRUE The password is strong. >=20 > - @retval FALSE The password is weak. >=20 > -**/ >=20 > -BOOLEAN >=20 > -IsPasswordStrong ( >=20 > - IN CHAR8 *Password, >=20 > - IN UINTN PasswordSize >=20 > - ) >=20 > -{ >=20 > - UINTN Index; >=20 > - BOOLEAN HasLowerCase; >=20 > - BOOLEAN HasUpperCase; >=20 > - BOOLEAN HasNumber; >=20 > - BOOLEAN HasSymbol; >=20 > - >=20 > - if (PasswordSize < PASSWORD_MIN_SIZE) { >=20 > - return FALSE; >=20 > - } >=20 > - >=20 > - HasLowerCase =3D FALSE; >=20 > - HasUpperCase =3D FALSE; >=20 > - HasNumber =3D FALSE; >=20 > - HasSymbol =3D FALSE; >=20 > - for (Index =3D 0; Index < PasswordSize - 1; Index++) { >=20 > - if (Password[Index] >=3D 'a' && Password[Index] <=3D 'z') { >=20 > - HasLowerCase =3D TRUE; >=20 > - } else if (Password[Index] >=3D 'A' && Password[Index] <=3D 'Z') { >=20 > - HasUpperCase =3D TRUE; >=20 > - } else if (Password[Index] >=3D '0' && Password[Index] <=3D '9') { >=20 > - HasNumber =3D TRUE; >=20 > - } else { >=20 > - HasSymbol =3D TRUE; >=20 > - } >=20 > - } >=20 > - if ((!HasLowerCase) || (!HasUpperCase) || (!HasNumber) || (!HasSymbol)= ) { >=20 > - return FALSE; >=20 > - } >=20 > - return TRUE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Return if the password is set before in PASSWORD_HISTORY_CHECK_COUNT. >=20 > - >=20 > - @param[in] UserGuid The user GUID of the password varia= ble. >=20 > - @param[in] Password The user input password. >=20 > - @param[in] PasswordSize The size of Password in byte. >=20 > - >=20 > - @retval TRUE The password is set before. >=20 > - @retval FALSE The password is not set before. >=20 > -**/ >=20 > -BOOLEAN >=20 > -IsPasswordInHistory ( >=20 > - IN EFI_GUID *UserGuid, >=20 > - IN CHAR8 *Password, >=20 > - IN UINTN PasswordSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct; >=20 > - UINTN Index; >=20 > - >=20 > - for (Index =3D 1; Index <=3D PASSWORD_HISTORY_CHECK_COUNT; Index++) { >=20 > - Status =3D GetPasswordHashFromVariable (UserGuid, Index, &UserPasswo= rdVarStruct); >=20 > - if (!EFI_ERROR(Status)) { >=20 > - Status =3D VerifyPassword (Password, PasswordSize, &UserPasswordVa= rStruct); >=20 > - if (!EFI_ERROR(Status)) { >=20 > - return TRUE; >=20 > - } >=20 > - } >=20 > - } >=20 > - >=20 > - return FALSE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Communication service SMI Handler entry. >=20 > - >=20 > - This SMI handler provides services for password management. >=20 > - >=20 > - @param[in] DispatchHandle The unique handle assigned to this hand= ler by SmiHandlerRegister(). >=20 > - @param[in] RegisterContext Points to an optional handler context w= hich was specified when the >=20 > - handler was registered. >=20 > - @param[in, out] CommBuffer A pointer to a collection of data in me= mory that will >=20 > - be conveyed from a non-SMM environment = into an SMM environment. >=20 > - @param[in, out] CommBufferSize The size of the CommBuffer. >=20 > - >=20 > - @retval EFI_SUCCESS The interrupt was handled = and quiesced. No other handlers >=20 > - should still be called. >=20 > - @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been qui= esced but other handlers should >=20 > - still be called. >=20 > - @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pen= ding and other handlers should still >=20 > - be called. >=20 > - @retval EFI_INTERRUPT_PENDING The interrupt could not be= quiesced. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -SmmPasswordHandler ( >=20 > - IN EFI_HANDLE DispatchHandle, >=20 > - IN CONST VOID *RegisterContext, >=20 > - IN OUT VOID *CommBuffer, >=20 > - IN OUT UINTN *CommBufferSize >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - SMM_PASSWORD_COMMUNICATE_HEADER *SmmFunctionHeader; >=20 > - UINTN CommBufferPayloadSize; >=20 > - UINTN TempCommBufferSize; >=20 > - SMM_PASSWORD_COMMUNICATE_SET_PASSWORD SmmCommunicateSetPassword; >=20 > - SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD SmmCommunicateVerifyPassword= ; >=20 > - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY SmmCommunicateSetVerifyPolic= y; >=20 > - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *SmmCommunicateGetVerifyPoli= cy; >=20 > - UINTN PasswordLen; >=20 > - EFI_GUID *UserGuid; >=20 > - UINTN *PasswordTryCount; >=20 > - >=20 > - // >=20 > - // If input is invalid, stop processing this SMI >=20 > - // >=20 > - if (CommBuffer =3D=3D NULL || CommBufferSize =3D=3D NULL) { >=20 > - return EFI_SUCCESS; >=20 > - } >=20 > - >=20 > - TempCommBufferSize =3D *CommBufferSize; >=20 > - PasswordLen =3D 0; >=20 > - >=20 > - if (TempCommBufferSize < sizeof (SMM_PASSWORD_COMMUNICATE_HEADER)) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SMM communication buffer s= ize invalid!\n")); >=20 > - return EFI_SUCCESS; >=20 > - } >=20 > - >=20 > - CommBufferPayloadSize =3D TempCommBufferSize - sizeof (SMM_PASSWORD_CO= MMUNICATE_HEADER); >=20 > - >=20 > - Status =3D EFI_SUCCESS; >=20 > - SmmFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *)CommBuffer; >=20 > - >=20 > - UserGuid =3D &gUserAuthenticationGuid; >=20 > - PasswordTryCount =3D &mAdminPasswordTryCount; >=20 > - >=20 > - switch (SmmFunctionHeader->Function) { >=20 > - case SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET: >=20 > - PasswordTryCount =3D NULL; >=20 > - if (CommBufferPayloadSize !=3D 0) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: IS_PASSWORD_SET payload = buffer invalid!\n")); >=20 > - Status =3D EFI_INVALID_PARAMETER; >=20 > - goto EXIT; >=20 > - } >=20 > - if (IsPasswordSet(UserGuid)) { >=20 > - Status =3D EFI_SUCCESS; >=20 > - } else { >=20 > - Status =3D EFI_NOT_FOUND; >=20 > - } >=20 > - break; >=20 > - case SMM_PASSWORD_FUNCTION_SET_PASSWORD: >=20 > - if (*PasswordTryCount >=3D PASSWORD_MAX_TRY_COUNT) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_PASSWORD try count r= each!\n")); >=20 > - PasswordTryCount =3D NULL; >=20 > - Status =3D EFI_ACCESS_DENIED; >=20 > - goto EXIT; >=20 > - } >=20 > - if (CommBufferPayloadSize !=3D sizeof(SMM_PASSWORD_COMMUNICATE_SET_P= ASSWORD)) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_PASSWORD payload buf= fer invalid!\n")); >=20 > - Status =3D EFI_INVALID_PARAMETER; >=20 > - goto EXIT; >=20 > - } >=20 > - CopyMem (&SmmCommunicateSetPassword, SmmFunctionHeader + 1, sizeof(S= mmCommunicateSetPassword)); >=20 > - >=20 > - PasswordLen =3D AsciiStrnLenS(SmmCommunicateSetPassword.OldPassword, > sizeof(SmmCommunicateSetPassword.OldPassword)); >=20 > - if (PasswordLen =3D=3D sizeof(SmmCommunicateSetPassword.OldPassword)= ) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: OldPassword invalid!\n")= ); >=20 > - Status =3D EFI_INVALID_PARAMETER; >=20 > - goto EXIT; >=20 > - } >=20 > - >=20 > - if (!IsPasswordVerified (UserGuid, SmmCommunicateSetPassword.OldPass= word, PasswordLen + 1)) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: PasswordVerify - FAIL\n"= )); >=20 > - Status =3D EFI_SECURITY_VIOLATION; >=20 > - goto EXIT; >=20 > - } >=20 > - >=20 > - PasswordLen =3D AsciiStrnLenS(SmmCommunicateSetPassword.NewPassword, > sizeof(SmmCommunicateSetPassword.NewPassword)); >=20 > - if (PasswordLen =3D=3D sizeof(SmmCommunicateSetPassword.NewPassword)= ) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword invalid!\n")= ); >=20 > - Status =3D EFI_INVALID_PARAMETER; >=20 > - goto EXIT; >=20 > - } >=20 > - if (PasswordLen !=3D 0 && !IsPasswordStrong (SmmCommunicateSetPasswo= rd.NewPassword, PasswordLen + 1)) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword too weak!\n"= )); >=20 > - Status =3D EFI_UNSUPPORTED; >=20 > - goto EXIT; >=20 > - } >=20 > - if (PasswordLen !=3D 0 && IsPasswordInHistory (UserGuid, SmmCommunic= ateSetPassword.NewPassword, PasswordLen + > 1)) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword in history!\= n")); >=20 > - Status =3D EFI_ALREADY_STARTED; >=20 > - goto EXIT; >=20 > - } >=20 > - >=20 > - if (PasswordLen =3D=3D 0) { >=20 > - Status =3D SavePasswordToVariable (UserGuid, NULL, 0); >=20 > - } else { >=20 > - Status =3D SavePasswordToVariable (UserGuid, SmmCommunicateSetPass= word.NewPassword, PasswordLen + 1); >=20 > - } >=20 > - break; >=20 > - >=20 > - case SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD: >=20 > - if (*PasswordTryCount >=3D PASSWORD_MAX_TRY_COUNT) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: VERIFY_PASSWORD try coun= t reach!\n")); >=20 > - PasswordTryCount =3D NULL; >=20 > - Status =3D EFI_ACCESS_DENIED; >=20 > - goto EXIT; >=20 > - } >=20 > - if (CommBufferPayloadSize !=3D sizeof(SMM_PASSWORD_COMMUNICATE_VERIF= Y_PASSWORD)) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: VERIFY_PASSWORD payload = buffer invalid!\n")); >=20 > - Status =3D EFI_INVALID_PARAMETER; >=20 > - goto EXIT; >=20 > - } >=20 > - CopyMem (&SmmCommunicateVerifyPassword, SmmFunctionHeader + 1, sizeo= f(SmmCommunicateVerifyPassword)); >=20 > - >=20 > - PasswordLen =3D AsciiStrnLenS(SmmCommunicateVerifyPassword.Password, > sizeof(SmmCommunicateVerifyPassword.Password)); >=20 > - if (PasswordLen =3D=3D sizeof(SmmCommunicateVerifyPassword.Password)= ) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: Password invalid!\n")); >=20 > - Status =3D EFI_INVALID_PARAMETER; >=20 > - goto EXIT; >=20 > - } >=20 > - if (!IsPasswordVerified (UserGuid, SmmCommunicateVerifyPassword.Pass= word, PasswordLen + 1)) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: PasswordVerify - FAIL\n"= )); >=20 > - Status =3D EFI_SECURITY_VIOLATION; >=20 > - goto EXIT; >=20 > - } >=20 > - mPasswordVerified =3D TRUE; >=20 > - Status =3D EFI_SUCCESS; >=20 > - break; >=20 > - >=20 > - case SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY: >=20 > - PasswordTryCount =3D NULL; >=20 > - if (CommBufferPayloadSize !=3D sizeof(SMM_PASSWORD_COMMUNICATE_VERIF= Y_POLICY)) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_VERIFY_POLICY payloa= d buffer invalid!\n")); >=20 > - Status =3D EFI_INVALID_PARAMETER; >=20 > - goto EXIT; >=20 > - } >=20 > - CopyMem (&SmmCommunicateSetVerifyPolicy, SmmFunctionHeader + 1, size= of(SmmCommunicateSetVerifyPolicy)); >=20 > - mNeedReVerify =3D SmmCommunicateSetVerifyPolicy.NeedReVerify; >=20 > - break; >=20 > - >=20 > - case SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY: >=20 > - PasswordTryCount =3D NULL; >=20 > - if (CommBufferPayloadSize !=3D sizeof(SMM_PASSWORD_COMMUNICATE_VERIF= Y_POLICY)) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: GET_VERIFY_POLICY payloa= d buffer invalid!\n")); >=20 > - Status =3D EFI_INVALID_PARAMETER; >=20 > - goto EXIT; >=20 > - } >=20 > - SmmCommunicateGetVerifyPolicy =3D (SMM_PASSWORD_COMMUNICATE_VERIFY_P= OLICY *) (SmmFunctionHeader + 1); >=20 > - SmmCommunicateGetVerifyPolicy->NeedReVerify =3D mNeedReVerify; >=20 > - break; >=20 > - case SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED: >=20 > - PasswordTryCount =3D NULL; >=20 > - if (CommBufferPayloadSize !=3D 0) { >=20 > - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: WAS_PASSWORD_VERIFIED pa= yload buffer invalid!\n")); >=20 > - Status =3D EFI_INVALID_PARAMETER; >=20 > - goto EXIT; >=20 > - } >=20 > - if (mPasswordVerified) { >=20 > - Status =3D EFI_SUCCESS; >=20 > - } else { >=20 > - Status =3D EFI_NOT_STARTED; >=20 > - } >=20 > - break; >=20 > - >=20 > - default: >=20 > - PasswordTryCount =3D NULL; >=20 > - Status =3D EFI_UNSUPPORTED; >=20 > - break; >=20 > - } >=20 > - >=20 > -EXIT: >=20 > - if (PasswordTryCount !=3D NULL) { >=20 > - if (Status =3D=3D EFI_SUCCESS) { >=20 > - *PasswordTryCount =3D 0; >=20 > - } >=20 > - } >=20 > - SmmFunctionHeader->ReturnStatus =3D Status; >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > -/** >=20 > - Main entry for this driver. >=20 > - >=20 > - @param ImageHandle Image handle this driver. >=20 > - @param SystemTable Pointer to SystemTable. >=20 > - >=20 > - @retval EFI_SUCESS This function always complete successfully. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -PasswordSmmInit ( >=20 > - IN EFI_HANDLE ImageHandle, >=20 > - IN EFI_SYSTEM_TABLE *SystemTable >=20 > - ) >=20 > -{ >=20 > - EFI_STATUS Status; >=20 > - EFI_HANDLE SmmHandle; >=20 > - EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock; >=20 > - CHAR16 PasswordHistoryName[sizeof(USER_= AUTHENTICATION_VAR_NAME)/sizeof(CHAR16) + 5]; >=20 > - UINTN Index; >=20 > - >=20 > - ASSERT (PASSWORD_HASH_SIZE =3D=3D SHA256_DIGEST_SIZE); >=20 > - ASSERT (PASSWORD_HISTORY_CHECK_COUNT < 0xFFFF); >=20 > - >=20 > - Status =3D gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, NUL= L, (VOID**)&mSmmVariable); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - // >=20 > - // Make password variables read-only for DXE driver for security conce= rn. >=20 > - // >=20 > - Status =3D gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL,= (VOID **) &VariableLock); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - Status =3D VariableLock->RequestToLock (VariableLock, USER_AUTHENTIC= ATION_VAR_NAME, &gUserAuthenticationGuid); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - >=20 > - for (Index =3D 1; Index <=3D PASSWORD_HISTORY_CHECK_COUNT; Index++) = { >=20 > - UnicodeSPrint (PasswordHistoryName, sizeof (PasswordHistoryName), = L"%s%04x", > USER_AUTHENTICATION_VAR_NAME, Index); >=20 > - Status =3D VariableLock->RequestToLock (VariableLock, PasswordHist= oryName, &gUserAuthenticationGuid); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - } >=20 > - Status =3D VariableLock->RequestToLock (VariableLock, USER_AUTHENTIC= ATION_HISTORY_LAST_VAR_NAME, > &gUserAuthenticationGuid); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - } >=20 > - >=20 > - SmmHandle =3D NULL; >=20 > - Status =3D gSmst->SmiHandlerRegister (SmmPasswordHandler, &gUserAut= henticationGuid, &SmmHandle); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - if (EFI_ERROR (Status)) { >=20 > - return Status; >=20 > - } >=20 > - >=20 > - if (IsPasswordCleared()) { >=20 > - DEBUG ((DEBUG_INFO, "IsPasswordCleared\n")); >=20 > - SavePasswordToVariable (&gUserAuthenticationGuid, NULL, 0); >=20 > - } >=20 > - >=20 > - return EFI_SUCCESS; >=20 > -} >=20 > - >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Us= erAuthenticationSmm.h > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentic= ationSmm.h > deleted file mode 100644 > index 47bb95529f..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthe= nticationSmm.h > +++ /dev/null > @@ -1,52 +0,0 @@ > -/** @file >=20 > - Header file for UserAuthenticationSmm. >=20 > - >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > - SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > - >=20 > -**/ >=20 > - >=20 > -#ifndef __USER_AUTHENTICATION_SMM_H__ >=20 > -#define __USER_AUTHENTICATION_SMM_H__ >=20 > - >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include >=20 > - >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > -#include >=20 > - >=20 > -#include "KeyService.h" >=20 > - >=20 > -#define PASSWORD_SALT_SIZE 32 >=20 > -#define PASSWORD_HASH_SIZE 32 // SHA256_DIGEST_SIZE >=20 > - >=20 > -#define PASSWORD_MAX_TRY_COUNT 3 >=20 > -#define PASSWORD_HISTORY_CHECK_COUNT 5 >=20 > - >=20 > -// >=20 > -// Name of the variable >=20 > -// >=20 > -#define USER_AUTHENTICATION_VAR_NAME L"Password" >=20 > -#define USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME L"PasswordLast" >=20 > - >=20 > -// >=20 > -// Variable storage >=20 > -// >=20 > -typedef struct { >=20 > - UINT8 PasswordHash[PASSWORD_HASH_SIZE]; >=20 > - UINT8 PasswordSalt[PASSWORD_SALT_SIZE]; >=20 > -} USER_PASSWORD_VAR_STRUCT; >=20 > - >=20 > -#endif >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/Us= erAuthenticationSmm.inf > b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentic= ationSmm.inf > deleted file mode 100644 > index c5d15ada5e..0000000000 > --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthe= nticationSmm.inf > +++ /dev/null > @@ -1,53 +0,0 @@ > -## @file >=20 > -# User Authentication Smm Driver. >=20 > -# >=20 > -# This driver provides SMM services for DXE user authentication module. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - INF_VERSION =3D 0x00010005 >=20 > - BASE_NAME =3D UserAuthenticationSmm >=20 > - FILE_GUID =3D 8fc6aaaa-4561-4815-8cf7-b87312992dc= e >=20 > - MODULE_TYPE =3D DXE_SMM_DRIVER >=20 > - VERSION_STRING =3D 1.0 >=20 > - PI_SPECIFICATION_VERSION =3D 0x0001000A >=20 > - ENTRY_POINT =3D PasswordSmmInit >=20 > - >=20 > -[Sources] >=20 > - UserAuthenticationSmm.c >=20 > - UserAuthenticationSmm.h >=20 > - KeyService.c >=20 > - KeyService.h >=20 > - >=20 > -[Packages] >=20 > - MdePkg/MdePkg.dec >=20 > - MdeModulePkg/MdeModulePkg.dec >=20 > - CryptoPkg/CryptoPkg.dec >=20 > - UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec >=20 > - >=20 > -[LibraryClasses] >=20 > - UefiBootServicesTableLib >=20 > - UefiDriverEntryPoint >=20 > - DebugLib >=20 > - BaseLib >=20 > - BaseMemoryLib >=20 > - PrintLib >=20 > - SmmServicesTableLib >=20 > - MemoryAllocationLib >=20 > - UefiLib >=20 > - BaseCryptLib >=20 > - PlatformPasswordLib >=20 > - >=20 > -[Guids] >=20 > - gUserAuthenticationGuid ## CONSUMES ## GUID >=20 > - >=20 > -[Protocols] >=20 > - gEdkiiVariableLockProtocolGuid ## CONSUMES >=20 > - gEfiSmmVariableProtocolGuid ## CONSUMES >=20 > - >=20 > -[Depex] >=20 > - gEfiSmmVariableProtocolGuid AND gEfiVariableWriteArchProtocolGuid >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeatureP= kg.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 >=20 > -# This package provides UI related modules. >=20 > -# >=20 > -# The DEC files are used by the utilities that parse DSC and >=20 > -# INF files to generate AutoGen.c and AutoGen.h files >=20 > -# for the build infrastructure. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - DEC_SPECIFICATION =3D 0x00010017 >=20 > - PACKAGE_NAME =3D UserInterfaceFeaturePkg >=20 > - PACKAGE_VERSION =3D 0.1 >=20 > - PACKAGE_GUID =3D 5A92199C-C2ED-4A3F-9ED0-C278DEA0DA47 >=20 > - >=20 > -[Includes] >=20 > - Include >=20 > - >=20 > -[LibraryClasses] >=20 > - ## @libraryclass Provides a platform-specific method to return passw= ord policy. >=20 > - PlatformPasswordLib|Include/Library/PlatformPasswordLib.h >=20 > - >=20 > - ## @libraryclass Provides services to set/verify password and return= if the password is set. >=20 > - UserPasswordLib|Include/Library/UserPasswordLib.h >=20 > - >=20 > - ## @libraryclass Provides services to do password authentication. >=20 > - UserPasswordUiLib|Include/Library/UserPasswordUiLib.h >=20 > - >=20 > -[Guids] >=20 > - gEfiUserInterfaceFeaturePkgTokenSpaceGuid =3D { 0x13c2147c, 0x75b6, 0= x48ee, { 0xa4, 0x4b, 0xfc, 0x4, 0xb, 0x44, 0x97, > 0xbd } } >=20 > - >=20 > - ## Include Include/Guid/UserAuthentication.h >=20 > - gUserAuthenticationGuid =3D { 0xee24a7f7, 0x606b, 0x4724, { 0xb3, 0xc9= , 0xf5, 0xae, 0x4a, 0x3b, 0x81, 0x65} } >=20 > - >=20 > -[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx] >=20 > - ## Indicate whether the password is cleared. >=20 > - # When it is configured to Dynamic or DynamicEx, it can be set through= detection using >=20 > - # a platform-specific method (e.g. Board Jumper set) in a actual platf= orm in early boot phase.

>=20 > - # @Prompt The password clear status >=20 > - gEfiUserInterfaceFeaturePkgTokenSpaceGuid.PcdPasswordCleared|FALSE|BOO= LEAN|0x00000001 >=20 > - >=20 > diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeatureP= kg.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 >=20 > -# This package provides UI related modules. >=20 > -# This package should only depend on EDKII Core packages and MinPlatform= Pkg. >=20 > -# >=20 > -# The DEC files are used by the utilities that parse DSC and >=20 > -# INF files to generate AutoGen.c and AutoGen.h files >=20 > -# for the build infrastructure. >=20 > -# >=20 > -# Copyright (c) 2019, Intel Corporation. All rights reserved.
>=20 > -# >=20 > -# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > -# >=20 > -## >=20 > - >=20 > -[Defines] >=20 > - PLATFORM_NAME =3D UserInterfaceFeaturePkg >=20 > - PLATFORM_GUID =3D 66536B4C-84A3-42FD-B0AE-603414A4CE9= E >=20 > - PLATFORM_VERSION =3D 0.1 >=20 > - DSC_SPECIFICATION =3D 0x00010005 >=20 > - OUTPUT_DIRECTORY =3D Build/UserInterfaceFeaturePkg >=20 > - SUPPORTED_ARCHITECTURES =3D IA32|X64 >=20 > - BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT >=20 > - SKUID_IDENTIFIER =3D DEFAULT >=20 > - >=20 > -[LibraryClasses] >=20 > - ####################################### >=20 > - # Edk2 Packages >=20 > - ####################################### >=20 > - BaseLib|MdePkg/Library/BaseLib/BaseLib.inf >=20 > - BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf >=20 > - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf >=20 > - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf >=20 > - HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf >=20 > - IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf >=20 > - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf >=20 > - OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf >=20 > - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf >=20 > - PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf >=20 > - TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTempl= ate.inf >=20 > - UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiB= ootServicesTableLib.inf >=20 > - UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEnt= ryPoint.inf >=20 > - UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServ= icesLib.inf >=20 > - UefiLib|MdePkg/Library/UefiLib/UefiLib.inf >=20 > - UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib= /UefiRuntimeServicesTableLib.inf >=20 > - >=20 > - ##################################### >=20 > - # User Interface Feature Package >=20 > - ##################################### >=20 > - PlatformPasswordLib|UserInterfaceFeaturePkg/Library/PlatformPasswordLi= bNull/PlatformPasswordLibNull.inf >=20 > - UserPasswordLib|UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPa= sswordLib.inf >=20 > - >=20 > -[LibraryClasses.common.DXE_DRIVER] >=20 > - ####################################### >=20 > - # Edk2 Packages >=20 > - ####################################### >=20 > - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryA= llocationLib.inf >=20 > - >=20 > -[LibraryClasses.common.DXE_SMM_DRIVER] >=20 > - ####################################### >=20 > - # Edk2 Packages >=20 > - ####################################### >=20 > - BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf >=20 > - MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAll= ocationLib.inf >=20 > - SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTabl= eLib.inf >=20 > - >=20 > -########################################################################= ########################### >=20 > -# >=20 > -# Components Section - list of the modules and components that will be p= rocessed by compilation >=20 > -# tools and the EDK II tools to generate PE32/PE32+= /Coff image files. >=20 > -# >=20 > -# Note: The EDK II DSC file is not used to specify how compiled binary i= mages get placed >=20 > -# into firmware volume images. This section is just a list of modu= les to compile from >=20 > -# source into UEFI-compliant binaries. >=20 > -# It is the FDF file that contains information on combining binary= files into firmware >=20 > -# volume images, whose concept is beyond UEFI and is described in = PI specification. >=20 > -# Binary modules do not need to be listed in this section, as they= should be >=20 > -# specified in the FDF file. For example: Shell binary (Shell_Full= .efi), FAT binary (Fat.efi), >=20 > -# Logo (Logo.bmp), and etc. >=20 > -# There may also be modules listed in this section that are not re= quired in the FDF file, >=20 > -# When a module listed here is excluded from FDF file, then UEFI-c= ompliant binary will be >=20 > -# generated for it, but the binary will not be put into any firmwa= re volume. >=20 > -# >=20 > -########################################################################= ########################### >=20 > -[Components] >=20 > - ##################################### >=20 > - # User Interface Feature Package >=20 > - ##################################### >=20 > - >=20 > - # Add library instances here that are not included in package componen= ts and should be tested >=20 > - # in the package build. >=20 > - UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPasswo= rdLibNull.inf >=20 > - UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf >=20 > - UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.in= f >=20 > - >=20 > - # Add components here that should be included in the package build. >=20 > - UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf >=20 > - UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf >=20 > - UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf >=20 > - >=20 > -[BuildOptions] >=20 > - *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES >=20 > -- > 2.23.0.windows.1 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. >=20 > 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] > -=3D-=3D-=3D-=3D-=3D-=3D