From nobody Fri May 3 02:07:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+58925+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58925+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1588985162; cv=none; d=zohomail.com; s=zohoarc; b=HHUKsFHkGDEFZBlxek4XkCiZZ9fY26GWwOFw1D7tbRI8dBpXmmN89tGyX+PYV/uOqTTFc5BEOPThZsG8uj5FXjO2PHYWaHtUGTi6VDoe4rDP+vqmHp9idSQ5XOinaw6G4yK/ExiFiw8BLbq6I7vVJYNC2z63Li+tHXalJKU0I4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588985162; h=Content-Transfer-Encoding:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=hTk6SauIYSv1pcPQyJdSAfNdOMgMk/5DiL58vKMCapE=; b=OMvgv3xXXdlU1xCQN6H9r6Qovq63Nba+ALAoDzJTTHjIjlV3RrScrxcR5phfoxvnlpJzxDQTI94BhCRxvQQIGbLDEHgoN3KW40xCr9fxz7AywO4qnnSZq7VfhHTThcjt+XsCaJGKk9/E3hI6X2EW+WsPROq6dm+FQRlAeIl3h5I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58925+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1588985162729367.0802982252404; Fri, 8 May 2020 17:46:02 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 4kkWYY1788612xURWYvt1BYZ; Fri, 08 May 2020 17:46:02 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web12.2323.1588985160856128074 for ; Fri, 08 May 2020 17:46:01 -0700 IronPort-SDR: aEpQvWjCIijzSIf7QagSPmygjuYkEDnap73H+8UtS1xa6jb0Ut65dThywiaSXicY7jYcWFucRu Tco+cIbO33pA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2020 17:45:59 -0700 IronPort-SDR: IHKOfZytKtHEEQYG0NDHnb1gb6ADv/RRsgQ80UUl5EUUPDADkJVC81F+9jfQZXtGoNCOZC21MC UUsbhY7uVr9w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,369,1583222400"; d="scan'208";a="250613882" X-Received: from ydong10-desktop.ccr.corp.intel.com ([10.239.158.133]) by fmsmga007.fm.intel.com with ESMTP; 08 May 2020 17:45:56 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Subject: [edk2-devel] [edk2-platform][PATCH] Platform/Intel: Remove deprecated packages Date: Sat, 9 May 2020 08:45:48 +0800 Message-Id: <20200509004548.1535-1-eric.dong@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,eric.dong@intel.com X-Gm-Message-State: BV79wUMso2zz0fRNcTGBBPrJx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1588985162; bh=/pbgOz3PCTtZYcnk3/l4s6ocVMC+k5QteU0HeFF1WaY=; h=Date:From:Reply-To:Subject:To; b=AXOVZQrSt/KgcJRB9s0WvAFy2lJv2MLl3gxsWBeJYAWDtsHoptMaSOy1tJMDayjXonE 7/y0ayhPHdWnhUC1HNRy4ttW0QlRLlWM1aWOOz0ScS1uU6PpyTdzmBbO1/rN0gL/8EL39 q518IW7GO8ag6NzUyKe1O2uYzgQMSoao7pQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" After moving the AdvancedFeaturePkg, UserInterfaceFeaturePkg and DebugFeaturePkg to Features/Intel Package, remove deprecated packages in Platform/Intel folder. 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/CoreAdvan= cedDxeInclude.dsc delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvan= cedPeiInclude.dsc delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvan= cedLateInclude.fdf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvan= cedPostMemoryInclude.fdf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvan= cedPreMemoryInclude.fdf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.= inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/= BmcSsdt.asl delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/= IpmiOprRegions.asi delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.= inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/= IpmiCommandLib.h delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/= IpmiPlatformHookLib.h delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.= inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmi= Init.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmi= Init.inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmi= Init.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmi= Init.inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiComm= andLib/IpmiCommandLib.inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiComm= andLib/IpmiCommandLibNetFnApp.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiComm= andLib/IpmiCommandLibNetFnChassis.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiComm= andLib/IpmiCommandLibNetFnStorage.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiComm= andLib/IpmiCommandLibNetFnTransport.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibN= ull/IpmiLibNull.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibN= ull/IpmiLibNull.inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlat= formHookLibNull/IpmiPlatformHookLibNull.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlat= formHookLibNull/IpmiPlatformHookLibNull.inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolSta= tus.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolSta= tus.inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe= /SmbiosBasic.h delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe= /SmbiosBasicDxe.inf delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe= /SmbiosBasicEntryPoint.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe= /Type0BiosVendorFunction.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe= /Type1SystemManufacturerFunction.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe= /Type2BaseBoardManufacturerFunction.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe= /Type32BootInformationFunction.c delete mode 100644 Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe= /Type3ChassisManufacturerFunction.c delete mode 100644 Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl delete mode 100644 Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c delete mode 100644 Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.i= nf delete mode 100644 Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.i= nf 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/Usb3Debu= gPortLib.h delete mode 100644 Platform/Intel/DebugFeaturePkg/Include/Library/Usb3Debu= gPortParameterLib.h delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /MiscServices.c delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortDataTransfer.c delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortInitialize.c delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortLibDxe.c delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortLibDxe.inf delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortLibDxeIoMmu.c delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortLibDxeIoMmu.inf delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortLibInternal.h delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortLibNull.c delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortLibNull.inf delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortLibPei.c delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortLibPei.inf delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortLibPeiIoMmu.c delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortLibPeiIoMmu.inf delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortPar= ameterLibPcd/Usb3DebugPortParameterLibPcd.c delete mode 100644 Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortPar= ameterLibPcd/Usb3DebugPortParameterLibPcd.inf delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/Use= rAuthentication.h delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Include/Library/= PlatformPasswordLib.h delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Include/Library/= UserPasswordLib.h delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Include/Library/= UserPasswordUiLib.h delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/Platform= PasswordLibNull/PlatformPasswordLibNull.c delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/Platform= PasswordLibNull/PlatformPasswordLibNull.inf delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/Platform= PasswordLibNull/PlatformPasswordLibNull.uni delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/UserPass= wordLib/UserPasswordLib.c delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/UserPass= wordLib/UserPasswordLib.inf delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/UserPass= wordUiLib/UserPasswordUiLib.c delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/Library/UserPass= wordUiLib/UserPasswordUiLib.inf delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/KeyService.c delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/KeyService.h delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/UserAuthentication2Dxe.c delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/UserAuthentication2Dxe.h delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/UserAuthentication2Dxe.inf delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/UserAuthenticationDxe.c delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/UserAuthenticationDxe.h delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/UserAuthenticationDxe.inf delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/UserAuthenticationDxeFormset.h delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/UserAuthenticationDxePassword.c delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/UserAuthenticationDxeStrings.uni delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/UserAuthenticationDxeVfr.vfr delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/UserAuthenticationSmm.c delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/UserAuthenticationSmm.h delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserAuthenticati= on/UserAuthenticationSmm.inf delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFea= turePkg.dec delete mode 100644 Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFea= turePkg.dsc diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec b/Pla= tform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec deleted file mode 100644 index 44e5de64db..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dec +++ /dev/null @@ -1,153 +0,0 @@ -## @file -# This package provides the modules that build for a full feature platform. -# This AdvancedFeaturePkg should only depend on EDKII Core packages and Mi= nPlatformPkg. -# -# The DEC files are used by the utilities that parse DSC and -# INF files to generate AutoGen.c and AutoGen.h files -# for the build infrastructure. -# -# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - - -[Defines] -DEC_SPECIFICATION =3D 0x00010017 -PACKAGE_NAME =3D AdvancedFeaturePkg -PACKAGE_VERSION =3D 0.1 -PACKAGE_GUID =3D 290127D9-ABED-4DD8-A35D-73DCB4261BCB - - -[Includes] -Include -Ipmi/Include - -[Guids] -gAdvancedFeaturePkgTokenSpaceGuid =3D {0xa8514688, 0x6693, 0x4ab5= , {0xaa, 0xc8, 0xcc, 0xa9, 0x8d, 0xde, 0x90, 0xe1}} - -[PcdsDynamic, PcdsDynamicEx] - - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation|{0x0}|SM= BIOS_TABLE_TYPE0|0x80010000 { - - IndustryStandard/SmBios.h - - MdePkg/MdePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - } - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.Vendor|0= x1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosVers= ion|0x2 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSegm= ent|0xF000 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosRele= aseDate|0x3 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSize= |0xFF - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.PciIsSupported|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.PlugAndPlayIsSupported|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.BiosIsUpgradable|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.BiosShadowingAllowed|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.BootFromCdIsSupported|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.SelectableBootIsSupported|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.EDDSpecificationIsSupported|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.Floppy525_12IsSupported|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.Floppy35_720IsSupported|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.Floppy35_288IsSupported|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.PrintScreenIsSupported|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.Keyboard8042IsSupported|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.SerialIsSupported|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.PrinterIsSupported|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChar= acteristics.CgaMonoIsSupported|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSChar= acteristicsExtensionBytes[0]|0x33 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSChar= acteristicsExtensionBytes[1]|0x0F - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor|"Intel Corp= oration"|VOID*|0x80010001 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"PURLE= Y CV/CRB BIOS Internal"|VOID*|0x80010002 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|"2= 008-12-23"|VOID*|0x80010003 - - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation|{0x0}|= SMBIOS_TABLE_TYPE1|0x80010100 { - - IndustryStandard/SmBios.h - - MdePkg/MdePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - } - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Manufa= cturer|0x1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Produc= tName|0x2 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Versio= n|0x3 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Serial= Number|0x4 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Uuid|{= GUID("88888888-8887-8888-8888-878888888888")} - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.WakeUp= Type|SystemWakeupTypePowerSwitch - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SKUNum= ber|0x5 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Family= |0x6 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer|"Inte= l Corporation"|VOID*|0x80010101 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"PURLE= Y"|VOID*|0x80010102 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion|"1.0"|VOID= *|0x80010103 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber|"UNKN= OWN"|VOID*|0x80010104 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber|"SKU Num= ber"|VOID*|0x80010105 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily|"Family"|VO= ID*|0x80010106 - - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation|{0x= 0}|SMBIOS_TABLE_TYPE2|0x80010200 { - - IndustryStandard/SmBios.h - - MdePkg/MdePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - } - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Man= ufacturer|0x1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Pro= ductName|0x2 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Ver= sion|0x3 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Ser= ialNumber|0x4 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Ass= etTag|0x5 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Fea= tureFlag.Motherboard|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Fea= tureFlag.Replaceable|1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Loc= ationInChassis|0x6 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Boa= rdType|BaseBoardTypeMotherBoard - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer|"Inte= l Corporation"|VOID*|0x80010201 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"PURLE= Y"|VOID*|0x80010202 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion|"E63448-40= 0"|VOID*|0x80010203 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber|"SPRO= 03200016"|VOID*|0x80010204 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag|"Base Boa= rd Asset Tag"|VOID*|0x80010205 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis|= "Part Component"|VOID*|0x80010206 - - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis|{= 0x0}|SMBIOS_TABLE_TYPE3|0x80010300 { - - IndustryStandard/SmBios.h - - MdePkg/MdePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - } - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.M= anufacturer|0x1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.T= ype|MiscChassisTypeRackMountChassis - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.V= ersion|0x2 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.S= erialNumber|0x3 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.A= ssetTag|0x4 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.B= ootupState|ChassisStateSafe - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.P= owerSupplyState|ChassisStateSafe - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.T= hermalState|ChassisStateSafe - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.S= ecurityStatus|ChassisSecurityStatusNone - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer|"Inte= l Corporation"|VOID*|0x80010301 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion|"0.1"|VOID= *|0x80010302 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber|"UNKN= OWN"|VOID*|0x80010303 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag|"Chassis = Asset Tag"|VOID*|0x80010304 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber|"SKU Num= ber"|VOID*|0x80010305 - - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation|{= 0x0}|SMBIOS_TABLE_TYPE32|0x80012000 { - - IndustryStandard/SmBios.h - - MdePkg/MdePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - } - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation.B= ootStatus|BootInformationStatusNoError - -[PcdsFixedAtBuild] - gAdvancedFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels|0x3|UINT8|0x40000009 - -[PcdsDynamic, PcdsDynamicEx] - gAdvancedFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress|0xCA2|UINT16|0x90= 000022 - gAdvancedFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag|TRUE|BOOLEAN|0x1000= 0030 - gAdvancedFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue|360|UINT16|0x100000= 40 - -[PcdsFeatureFlag] - gAdvancedFeaturePkgTokenSpaceGuid.PcdNetworkEnable |FALSE|BOOLE= AN|0xF00000A1 - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable |FALSE|BOOLE= AN|0xF00000A2 - gAdvancedFeaturePkgTokenSpaceGuid.PcdIpmiEnable |FALSE|BOOLE= AN|0xF00000A3 - diff --git a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc b/Pla= tform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc deleted file mode 100644 index b83e72b48c..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/AdvancedFeaturePkg.dsc +++ /dev/null @@ -1,165 +0,0 @@ -## @file -# Advanced Feature Package build description file. -# -# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -##########################################################################= ###### -# -# Defines Section - statements that will be processed to create a Makefile. -# -##########################################################################= ###### -[Defines] - PLATFORM_NAME =3D AdvancedFeaturePkg - PLATFORM_GUID =3D 5E4C05BC-C5F0-4843-BAE1-3AAFE269= DB8F - PLATFORM_VERSION =3D 0.1 - DSC_SPECIFICATION =3D 0x00010005 - OUTPUT_DIRECTORY =3D Build/AdvancedFeaturePkg - SUPPORTED_ARCHITECTURES =3D IA32|X64 - BUILD_TARGETS =3D DEBUG|RELEASE - SKUID_IDENTIFIER =3D DEFAULT - -##########################################################################= ###### -# -# SKU Identification section - list of all SKU IDs supported. -# -##########################################################################= ###### -[SkuIds] - 0|DEFAULT # The entry: 0|DEFAULT is reserved and always req= uired. - -##########################################################################= ###### -# -# Pcd Section - list of all EDK II PCD Entries defined by this package. -# -##########################################################################= ###### - -[PcdsFeatureFlag] - -##########################################################################= ###### -# -# Library Class section - list of all Library Classes needed by this packa= ge. -# -##########################################################################= ###### - -[LibraryClasses.common] - ####################################### - # Edk2 Packages - ####################################### - BaseLib|MdePkg/Library/BaseLib/BaseLib.inf - BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf - BasePciLibPciExpress|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciEx= press.inf - CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMain= tenanceLib.inf - CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf - DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf - DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf - DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableL= ib.inf - HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf - PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf - PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf - PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.i= nf - PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeC= offExtraActionLibNull.inf - PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf - PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf - PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf - PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf - PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf - PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf - PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf - ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRepor= tStatusCodeLibNull.inf - SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPort= Lib16550.inf - SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf - TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplat= e.inf - UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA= pplicationEntryPoint.inf - UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf - UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf - UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompres= sLib.inf - UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf - UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServic= esLib.inf - UefiLib|MdePkg/Library/UefiLib/UefiLib.inf - UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf - UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/U= efiRuntimeServicesTableLib.inf - - ####################################### - # Advanced Feature Package - ####################################### - IpmiCommandLib|AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiComman= dLib.inf - IpmiLib|AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNull.inf - IpmiPlatformHookLib|AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibN= ull/IpmiPlatformHookLibNull.inf - -[LibraryClasses.common.SEC,LibraryClasses.common.PEI_CORE,LibraryClasses.c= ommon.PEIM] - ####################################### - # Edk2 Packages - ####################################### - HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf - MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf - PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf - - ####################################### - # Silicon Initialization Package - ####################################### - SmmAccessLib|IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/P= eiSmmAccessLib.inf - -[LibraryClasses.common.DXE_CORE,LibraryClasses.common.DXE_SMM_DRIVER,Libra= ryClasses.common.SMM_CORE,LibraryClasses.common.DXE_DRIVER,LibraryClasses.c= ommon.DXE_RUNTIME_DRIVER,LibraryClasses.common.UEFI_DRIVER,LibraryClasses.c= ommon.UEFI_APPLICATION] - ####################################### - # Edk2 Packages - ####################################### - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf - PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - -[LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.SMM_CORE] - ####################################### - # Edk2 Packages - ####################################### - SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableL= ib.inf - -##########################################################################= ######################### -# -# Components Section - list of the modules and components that will be pro= cessed by compilation -# tools and the EDK II tools to generate PE32/PE32+/C= off image files. -# -# Note: The EDK II DSC file is not used to specify how compiled binary ima= ges get placed -# into firmware volume images. This section is just a list of module= s to compile from -# source into UEFI-compliant binaries. -# It is the FDF file that contains information on combining binary f= iles into firmware -# volume images, whose concept is beyond UEFI and is described in PI= specification. -# Binary modules do not need to be listed in this section, as they s= hould be -# specified in the FDF file. For example: Shell binary (Shell_Full.e= fi), FAT binary (Fat.efi), -# Logo (Logo.bmp), and etc. -# There may also be modules listed in this section that are not requ= ired in the FDF file, -# When a module listed here is excluded from FDF file, then UEFI-com= pliant binary will be -# generated for it, but the binary will not be put into any firmware= volume. -# -##########################################################################= ######################### - -[Components] - ####################################### - # Advanced Feature Package - ####################################### - - # Add library instances here that are not included in package components= and should be tested - # in the package build. - - # Add components here that should be included in the package build. - AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf - AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf - AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf - AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf - AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf - AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf - AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf - AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf - AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf - AdvancedFeaturePkg/S3/S3Pei.inf - AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf - -[BuildOptions] - *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeI= nclude.dsc b/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeI= nclude.dsc deleted file mode 100644 index fceaadc100..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedDxeInclude.= dsc +++ /dev/null @@ -1,19 +0,0 @@ -## @file -# Platform description. -# -# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - - - # - # UEFI network modules - # - !include NetworkPkg/NetworkComponents.dsc.inc - -!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable =3D=3D TRUE - MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf -!endif - diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiI= nclude.dsc b/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiI= nclude.dsc deleted file mode 100644 index 86b1ebfed0..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Include/Dsc/CoreAdvancedPeiInclude.= dsc +++ /dev/null @@ -1,9 +0,0 @@ -## @file -# Platform description. -# -# Copyright (c) 2017, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLate= Include.fdf b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLat= eInclude.fdf deleted file mode 100644 index d980e673a8..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedLateInclude= .fdf +++ /dev/null @@ -1,20 +0,0 @@ -## @file -# FDF file of Platform. -# -# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - - -# -# UEFI network modules -# -!include NetworkPkg/Network.fdf.inc - -!if gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosEnable =3D=3D TRUE -INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf -!endif - - diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPost= MemoryInclude.fdf b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvan= cedPostMemoryInclude.fdf deleted file mode 100644 index 3c2716d672..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPostMemoryI= nclude.fdf +++ /dev/null @@ -1,8 +0,0 @@ -## @file -# FDF file of Platform. -# -# Copyright (c) 2017, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## diff --git a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreM= emoryInclude.fdf b/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvanc= edPreMemoryInclude.fdf deleted file mode 100644 index 5b21f781a7..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Include/Fdf/CoreAdvancedPreMemoryIn= clude.fdf +++ /dev/null @@ -1,9 +0,0 @@ -## @file -# FDF file of Platform. -# -# Copyright (c) 2017, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c b/Pla= tform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c deleted file mode 100644 index 990b4b9e83..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.c +++ /dev/null @@ -1,257 +0,0 @@ -/** @file - BMC ACPI. - -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -// -// Statements that include other header files -// -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#ifndef EFI_ACPI_CREATOR_ID -#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('M', 'S', 'F', 'T') -#endif -#ifndef EFI_ACPI_CREATOR_REVISION -#define EFI_ACPI_CREATOR_REVISION 0x0100000D -#endif - -/** - - Locate the first instance of a protocol. If the protocol requested is an - FV protocol, then it will return the first FV that contains the ACPI tab= le - storage file. - - @param Protocol - The protocol to find. - Instance - Return pointer to the first instance of the protocol. - Type - The type of protocol to locate. - - @retval EFI_SUCCESS - The function completed successfully. - @retval EFI_NOT_FOUND - The protocol could not be located. - @retval EFI_OUT_OF_RESOURCES - There are not enough resources to find = the protocol. - -**/ -EFI_STATUS -LocateSupportProtocol ( - IN EFI_GUID *Protocol, - OUT VOID **Instance, - IN UINT32 Type - ) -{ - EFI_STATUS Status; - EFI_HANDLE *HandleBuffer; - UINTN NumberOfHandles; - EFI_FV_FILETYPE FileType; - UINT32 FvStatus =3D 0; - EFI_FV_FILE_ATTRIBUTES Attributes; - UINTN Size; - UINTN Index; - - Status =3D gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NumberO= fHandles, &HandleBuffer); - if (EFI_ERROR (Status)) { - return Status; - } - // - // Looking for FV with ACPI storage file - // - for (Index =3D 0; Index < NumberOfHandles; Index++) { - Status =3D gBS->HandleProtocol (HandleBuffer[Index], Protocol, Instanc= e); - ASSERT (!EFI_ERROR (Status)); - - if (!Type) { - // - // Not looking for the FV protocol, so find the first instance of the - // protocol. There should not be any errors because our handle buff= er - // should always contain at least one or LocateHandleBuffer would ha= ve - // returned not found. - // - break; - } - // - // See if it has the ACPI storage file - // - Status =3D ((EFI_FIRMWARE_VOLUME2_PROTOCOL *) (*Instance))->ReadFile ( - *Instance, - &gEfiCallerI= dGuid, - NULL, - &Size, - &FileType, - &Attributes, - &FvStatus - ); - - // - // If we found it, then we are done - // - if (!EFI_ERROR (Status)) { - break; - } - } - - gBS->FreePool (HandleBuffer); - return Status; -} - - -EFI_STATUS -UpdateDeviceSsdtTable ( - IN OUT EFI_ACPI_COMMON_HEADER *Table - ) -{ - EFI_ACPI_DESCRIPTION_HEADER *TableHeader =3D NULL; - UINT64 TempOemTableId; - UINT8 *DataPtr; - EFI_ACPI_IO_PORT_DESCRIPTOR *IoRsc; - - TableHeader =3D (EFI_ACPI_DESCRIPTION_HEADER *)Table; - - // - // Update the OEMID and OEM Table ID. - // - CopyMem (&TableHeader->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof(Ta= bleHeader->OemId)); - TempOemTableId =3D PcdGet64 (PcdAcpiDefaultOemTableId); - CopyMem (&TableHeader->OemTableId, &TempOemTableId, sizeof(UINT64)); - TableHeader->CreatorId =3D EFI_ACPI_CREATOR_ID; - TableHeader->CreatorRevision =3D EFI_ACPI_CREATOR_REVISION; - - // - // Update IO(Decode16, 0xCA2, 0xCA2, 0, 2) - // - DEBUG ((DEBUG_INFO, "UpdateDeviceSsdtTable - IPMI\n")); - for (DataPtr =3D (UINT8 *)(Table + 1); - DataPtr < (UINT8 *) ((UINT8 *) Table + Table->Length - 4); - DataPtr++) { - if (CompareMem(DataPtr, "_CRS", 4) =3D=3D 0) { - DataPtr +=3D 4; // Skip _CRS - ASSERT (*DataPtr =3D=3D AML_BUFFER_OP); - DataPtr ++; // Skip AML_BUFFER_OP - ASSERT ((*DataPtr & (BIT7|BIT6)) =3D=3D 0); - DataPtr ++; // Skip PkgLength - 0xD - ASSERT ((*DataPtr) =3D=3D AML_BYTE_PREFIX); - DataPtr ++; // Skip BufferSize OpCode - DataPtr ++; // Skip BufferSize - 0xA - IoRsc =3D (VOID *)DataPtr; - ASSERT (IoRsc->Header.Bits.Type =3D=3D ACPI_SMALL_ITEM_FLAG); - ASSERT (IoRsc->Header.Bits.Name =3D=3D ACPI_SMALL_IO_PORT_DESCRIPTOR= _NAME); - ASSERT (IoRsc->Header.Bits.Length =3D=3D sizeof(EFI_ACPI_IO_PORT_DES= CRIPTOR) - sizeof(ACPI_SMALL_RESOURCE_HEADER)); - DEBUG ((DEBUG_INFO, "IPMI IO Base in ASL update - 0x%04x <=3D 0x%04x= \n", IoRsc->BaseAddressMin, PcdGet16(PcdIpmiIoBaseAddress))); - IoRsc->BaseAddressMin =3D PcdGet16(PcdIpmiIoBaseAddress); - IoRsc->BaseAddressMax =3D PcdGet16(PcdIpmiIoBaseAddress); - } - } - - return EFI_SUCCESS; -} - -/** - - Entry point for Acpi platform driver. - - @param ImageHandle - A handle for the image that is initializing this = driver. - @param SystemTable - A pointer to the EFI system table. - - @retval EFI_SUCCESS - Driver initialized successfully. - @retval EFI_LOAD_ERROR - Failed to Initialize or has been loaded. - @retval EFI_OUT_OF_RESOURCES - Could not allocate needed resources. - -**/ -EFI_STATUS -EFIAPI -BmcAcpiEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - EFI_STATUS AcpiStatus; - - EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol; - INTN Instance =3D 0; - EFI_ACPI_COMMON_HEADER *CurrentTable =3D NULL; - UINTN TableHandle =3D 0; - UINT32 FvStatus; - UINT32 Size; - - EFI_ACPI_TABLE_PROTOCOL *AcpiTable; - UINTN TableSize; - - - // - // Find the AcpiTable protocol - // - Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID*= *)&AcpiTable); - if (EFI_ERROR (Status)) { - return EFI_ABORTED; - } - - // - // Locate the firmware volume protocol - // - Status =3D LocateSupportProtocol (&gEfiFirmwareVolume2ProtocolGuid, (VOI= D **) &FwVol, 1); - if (EFI_ERROR (Status)) { - return Status; - } - - Status =3D EFI_SUCCESS; - Instance =3D 0; - - // - // Read tables from the storage file. - // - while (!EFI_ERROR (Status)) { - CurrentTable =3D NULL; - - Status =3D FwVol->ReadSection ( - FwVol, - &gEfiCallerIdGuid, - EFI_SECTION_RAW, - Instance, - (VOID **) &CurrentTable, - (UINTN *) &Size, - &FvStatus - ); - if (!EFI_ERROR (Status)) { - // - // Perform any table specific updates. - // - AcpiStatus =3D UpdateDeviceSsdtTable (CurrentTable); - if (!EFI_ERROR (AcpiStatus)) { - - TableHandle =3D 0; - TableSize =3D ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Leng= th; - ASSERT (Size >=3D TableSize); - - Status =3D AcpiTable->InstallAcpiTable ( - AcpiTable, - CurrentTable, - TableSize, - &TableHandle - ); - - ASSERT_EFI_ERROR (Status); - } - - // - // Increment the instance - // - Instance++; - } - } - - return EFI_SUCCESS; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf b/P= latform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf deleted file mode 100644 index 17b75dfbcc..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcAcpi.inf +++ /dev/null @@ -1,48 +0,0 @@ -### @file -# Component description file for BMC ACPI. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D BmcAcpi - FILE_GUID =3D F59DAA23-D5D5-4d16-91FC-D03ABDC12FFE - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D BmcAcpiEntryPoint - -[Sources] - BmcAcpi.c - BmcSsdt/BmcSsdt.asl - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - UefiDriverEntryPoint - BaseMemoryLib - DebugLib - UefiLib - -[Protocols] - gEfiFirmwareVolume2ProtocolGuid - gEfiAcpiTableProtocolGuid - -[Pcd] - gAdvancedFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress - gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId - gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId - -[Depex] - gEfiAcpiTableProtocolGuid - -[BuildOptions] =20 - *_*_*_ASL_FLAGS =3D -oi - diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/BmcSsdt= .asl b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/BmcSsdt.asl deleted file mode 100644 index 0daa175205..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/BmcSsdt.asl +++ /dev/null @@ -1,28 +0,0 @@ -/** @file - BMC ACPI SSDT. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -DefinitionBlock ( - "BmcSsdt.aml", - "SSDT", - 0x02, // SSDT revision. - // A Revision field value greater than or equal to 2 sig= nifies that integers=20 - // declared within the Definition Block are to be evalua= ted as 64-bit values - "INTEL", // OEM ID (6 byte string) - "BMCACPI", // OEM table ID (8 byte string) - 0x0 // OEM version of DSDT table (4 byte Integer) - ) -{ - - External(\_SB.PC00.LPC0, DeviceObj) - =20 - Scope (\_SB.PC00.LPC0)=20 - { - #include "IpmiOprRegions.asi" - }=20 - -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOpr= Regions.asi b/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOp= rRegions.asi deleted file mode 100644 index d2ae5fc40a..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcAcpi/BmcSsdt/IpmiOprRegions= .asi +++ /dev/null @@ -1,58 +0,0 @@ -/** @file - IPMI ACPI SSDT. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -Device(IPMC) -{ - // Config DWord, modified during POST - // Bit definitions are the same as PPMFlags: - // [00] =3D Plug and Play BMC Detection enabled in setup - // [31:01] =3D Reserved =3D 0 - =20 - Name(ECFL, 0x80000000) - =20 - // Return the interface specification revision - Method(_SRV) - { - // IPMI Specification Revision v2.0 - Return(0x0200) =20 - } - - Method(_STA, 0)=20 - {=20 - // - // Assume OK - // - Store (0xF, Local0) - - Return(Local0) - - // Bit 0 - Set if the device is present. - // Bit 1 - Set if the device is enabled and decoding its resources. - // Bit 2 - Set if the device should be shown in the UI. - // Bit 3 - Set if the device is functioning properly (cleared if t= he device failed its diagnostics). - // Bit 4 - Set if the battery is present. - // Bit 5 - Reserved (must be cleared). - } // end of _STA - - // Return the x86 resources consumed by BMC - Name(_CRS, ResourceTemplate() - { - // Uses 8-bit ports 0xCA2-0xCA5 - IO(Decode16, 0xCA2, 0xCA2, 0, 2) - }) - - Name(_HID, "IPI0001") // IPMI device - Name(_IFT, 0x1) // KCS system interface type - Name(_STR, Unicode("IPMI_KCS")) - - Name(_UID, 0) // First interface. - - -} // end of Device(IPMC) - - diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c b/Pla= tform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c deleted file mode 100644 index a6d075b19c..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.c +++ /dev/null @@ -1,236 +0,0 @@ -/** @file - BMC Event Log functions. - -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include -#include -#include -#include - -EFI_STATUS -EFIAPI -CheckIfSelIsFull ( - VOID - ); - -/*++ - - Routine Description: - This function verifies the BMC SEL is full and When it is reports the = error to the Error Manager. - - Arguments: - None - - Returns: - EFI_SUCCESS - EFI_DEVICE_ERROR - ---*/ -EFI_STATUS -WaitTillErased ( - UINT8 *ResvId - ) -/*++ - -Routine Description: - -Arguments: - - BmcElogPrivateData - Bmc event log instance - ResvId - Reserved ID - -Returns: - - EFI_SUCCESS - EFI_NO_RESPONSE - ---*/ -{ - INTN Counter; - IPMI_CLEAR_SEL_REQUEST ClearSel; - IPMI_CLEAR_SEL_RESPONSE ClearSelResponse; - - Counter =3D 0x200; - ZeroMem (&ClearSelResponse, sizeof(ClearSelResponse)); - - while (TRUE) { - ZeroMem (&ClearSel, sizeof(ClearSel)); - ClearSel.Reserve[0] =3D ResvId[0]; - ClearSel.Reserve[1] =3D ResvId[1]; - ClearSel.AscC =3D 0x43; - ClearSel.AscL =3D 0x4C; - ClearSel.AscR =3D 0x52; - ClearSel.Erase =3D 0x00; - - IpmiClearSel ( - &ClearSel, - &ClearSelResponse - ); - - if ((ClearSelResponse.ErasureProgress & 0xf) =3D=3D 1) { - return EFI_SUCCESS; - } - // - // If there is not a response from the BMC controller we need to retu= rn and not hang. - // - --Counter; - if (Counter =3D=3D 0x0) { - return EFI_NO_RESPONSE; - } - } -} - -EFI_STATUS -EfiActivateBmcElog ( - IN BOOLEAN *EnableElog, - OUT BOOLEAN *ElogStatus - ) -/*++ - -Routine Description: - -Arguments: - - This - Protocol pointer - DataType - indicate event log type - EnableElog - Enable/Disable event log - ElogStatus - return log status - -Returns: - - EFI_STATUS - ---*/ -{ - EFI_STATUS Status; - UINT8 ElogStat; - IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST SetBmcGlobalEnables; - IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE GetBmcGlobalEnables; - UINT8 CompletionCode; - - Status =3D EFI_SUCCESS; - ElogStat =3D 0; - - Status =3D IpmiGetBmcGlobalEnables (&GetBmcGlobalEnables); - if (EFI_ERROR(Status)) { - return Status; - } - - if (EnableElog =3D=3D NULL) { - *ElogStatus =3D GetBmcGlobalEnables.GetEnables.Bits.SystemEventLogging; - } else { - if (Status =3D=3D EFI_SUCCESS) { - if (*EnableElog) { - ElogStat =3D 1; - } - - CopyMem (&SetBmcGlobalEnables, (UINT8 *)&GetBmcGlobalEnables + 1, si= zeof(UINT8)); - SetBmcGlobalEnables.SetEnables.Bits.SystemEventLogging =3D ElogStat; - - Status =3D IpmiSetBmcGlobalEnables (&SetBmcGlobalEnables, &Completio= nCode); - } - } - - return Status; -} - -EFI_STATUS -SetElogRedirInstall ( - VOID - ) -/*++ - -Routine Description: - -Arguments: - - None - -Returns: - - EFI_SUCCESS - ---*/ -{ - BOOLEAN EnableElog; - BOOLEAN ElogStatus; - - // - // Activate the Event Log (This should depend upon Setup). - // - EfiActivateBmcElog (&EnableElog, &ElogStatus); - return EFI_SUCCESS; -} - -EFI_STATUS -EFIAPI -InitializeBmcElogLayer ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -/*++ - -Routine Description: - -Arguments: - - ImageHandle - ImageHandle of the loaded driver - SystemTable - Pointer to the System Table - -Returns: - - EFI_STATUS - ---*/ -{ - SetElogRedirInstall (); - - CheckIfSelIsFull (); - - return EFI_SUCCESS; -} - -EFI_STATUS -EFIAPI -CheckIfSelIsFull ( - VOID - ) -/*++ - - Routine Description: - This function verifies the BMC SEL is full and When it is reports the = error to the Error Manager. - - Arguments: - None - - Returns: - EFI_SUCCESS - EFI_DEVICE_ERROR - ---*/ -{ - EFI_STATUS Status; - UINT8 SelIsFull; - IPMI_GET_SEL_INFO_RESPONSE SelInfo; - - Status =3D IpmiGetSelInfo (&SelInfo); - if (EFI_ERROR (Status)) { - return EFI_DEVICE_ERROR; - } - - // - // Check the Bit7 of the OperationByte if SEL is OverFlow. - // - SelIsFull =3D (SelInfo.OperationSupport & 0x80); - DEBUG ((DEBUG_INFO, "SelIsFull - 0x%x\n", SelIsFull)); - - return EFI_SUCCESS; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf b/P= latform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf deleted file mode 100644 index 85591efb5d..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/BmcElog/BmcElog.inf +++ /dev/null @@ -1,34 +0,0 @@ -### @file -# Component description file for BMC ELOG. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D BmcElog - FILE_GUID =3D 8A17F6CA-BF1A-45C4-FFFF-FFFF0C829DDD - MODULE_TYPE =3D DXE_DRIVER - PI_SPECIFICATION_VERSION =3D 0x0001000A - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D InitializeBmcElogLayer - -[Sources] - BmcElog.c - -[Packages] - MdePkg/MdePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - DebugLib - UefiBootServicesTableLib - IpmiCommandLib - -[Depex] - TRUE - diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c b/Platform= /Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c deleted file mode 100644 index 74c52a74eb..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.c +++ /dev/null @@ -1,236 +0,0 @@ -/** @file - IPMI FRB Driver. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -EFI_STATUS -EfiDisableFrb ( - VOID - ) -/*++ - - Routine Description: - This routine disables the specified FRB timer. - - Arguments: - This - This pointer - FrbType - Type of FRB timer to get data on - - Returns: - EFI_SUCCESS - FRB timer was disabled - EFI_ABORTED - Timer was already stopped - EFI_UNSUPPORTED - This type of FRB timer is not supported. - ---*/ -{ - EFI_STATUS Status; - IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer; - UINT8 CompletionCode; - IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; - - Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Check if timer is still running, if not abort disable routine. - // - if (GetWatchdogTimer.TimerUse.Bits.TimerRunning =3D=3D 0) { - return EFI_ABORTED; - } - - ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer)); - // - // Just flip the Timer Use bit. This should release the timer. - // - SetWatchdogTimer.TimerUse.Bits.TimerRunning =3D 0; - SetWatchdogTimer.TimerUse.Bits.TimerUse =3D IPMI_WATCHDOG_TIMER_B= IOS_FRB2; - SetWatchdogTimer.TimerUseExpirationFlagsClear &=3D ~BIT2; - SetWatchdogTimer.TimerUseExpirationFlagsClear |=3D BIT1 | BIT4; - - Status =3D IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode); - return Status; -} - -VOID -EFIAPI -DisableFRB2Handler ( - IN EFI_EVENT Event, - IN VOID *Context - ) -/*++ - - Routine Description: - Disables FRB2. This function gets called each time the - EFI_EVENT_SIGNAL_READY_TO_BOOT gets signaled - - Arguments: - Standard event notification function arguments: - Event - the event that is signaled. - Context - not used here. - - Returns: - ---*/ -{ - DEBUG((EFI_D_ERROR, "!!! enter DisableFRB2Handler()!!!\n")); - - EfiDisableFrb (); -} - -EFI_STATUS -CheckForAndReportErrors( - VOID - ) -/*++ - - Routine Description: - Check the Watchdog timer expiration flags and report the kind of watch= dog - timeout occurred to the Error Manager. - - Arguments: - - Returns: - EFI_SUCCESS - Errors retrieved and reported - ---*/ -{ - EFI_STATUS Status; - IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; - IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer; - UINT8 CompletionCode; - - // - // Get the Watchdog timer info to find out what kind of timer expiration= occurred. - // - Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); - if (EFI_ERROR (Status)) { - return Status; - } - // - // If FRB2 Failure occurred, report it to the error manager and log a SE= L. - // - if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT1) !=3D 0) { - // - // Report the FRB2 time-out error - // - } else if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT3) !=3D 0= ) { - // - // Report the OS Watchdog timer failure - // - } - - // - // Need to clear Timer expiration flags after checking. - // - ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer)); - SetWatchdogTimer.TimerUse =3D GetWatchdogTimer.Tim= erUse; - SetWatchdogTimer.TimerActions =3D GetWatchdogTimer.Tim= erActions; - SetWatchdogTimer.PretimeoutInterval =3D GetWatchdogTimer.Pre= timeoutInterval; - SetWatchdogTimer.TimerUseExpirationFlagsClear =3D GetWatchdogTimer.Tim= erUseExpirationFlagsClear; - SetWatchdogTimer.InitialCountdownValue =3D GetWatchdogTimer.Ini= tialCountdownValue; - SetWatchdogTimer.TimerUse.Bits.TimerRunning =3D 1; - SetWatchdogTimer.TimerUseExpirationFlagsClear |=3D BIT1 | BIT2 | BIT3; - - Status =3D IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode); - - return Status; -} - -EFI_STATUS -ReportFrb2Status ( - VOID - ) -/*++ - - Routine Description: - This routine is built only when DEBUG_MODE is enabled. It is used - to report the status of FRB2 when the FRB2 driver is installed. - - Arguments: - none - - Returns: - EFI_SUCCESS: All info was retrieved and reported - EFI_ERROR: There was an error during info retrieval - ---*/ -{ - EFI_STATUS Status; - IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; - - // - // Get the Watchdog timer info to find out what kind of timer expiration= occurred. - // - Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_INFO, "Failed to get Watchdog Timer info from BMC.\n")); - return Status; - } - - // - // Check if timer is running, report status to DEBUG_MODE output. - // - if (GetWatchdogTimer.TimerUse.Bits.TimerRunning =3D=3D 1) { - DEBUG ((DEBUG_INFO, "FRB2 Timer is running.\n")); - } else { - DEBUG ((DEBUG_INFO, "FRB2 Timer is not running.\n")); - } - - return EFI_SUCCESS; -} - -EFI_STATUS -EFIAPI -FrbDxeEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -/*++ - - Routine Description: - This is the standard EFI driver point. This function intitializes - the private data required for creating FRB Driver. - - Arguments: - ImageHandle - Handle for the image of this driver - SystemTable - Pointer to the EFI System Table - - Returns: - EFI_SUCCESS - Protocol successfully started and installed - EFI_UNSUPPORTED - Protocol can't be started - ---*/ -{ - EFI_EVENT ReadyToBootEvent; - EFI_STATUS Status; - - CheckForAndReportErrors(); - ReportFrb2Status (); - - // - // Register the event to Disable FRB2 before Boot. - // - Status =3D EfiCreateEventReadyToBootEx ( - TPL_NOTIFY, - DisableFRB2Handler, - NULL, - &ReadyToBootEvent - ); - - return Status; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf b/Platfo= rm/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf deleted file mode 100644 index 3aa29889b1..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbDxe.inf +++ /dev/null @@ -1,37 +0,0 @@ -### @file -# Component description file for IPMI FRB. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D FrbDxe - FILE_GUID =3D F6C7812D-81BF-4e6d-A87D-E75AF17BD511 - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D FrbDxeEntryPoint - -[Sources] - FrbDxe.c -=20 -[Packages] =20 - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - UefiDriverEntryPoint - MemoryAllocationLib - UefiLib - DebugLib - BaseMemoryLib - IpmiCommandLib - PcdLib - =20 -[Depex] - TRUE diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c b/Platform= /Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c deleted file mode 100644 index 5d33df0103..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.c +++ /dev/null @@ -1,84 +0,0 @@ -/** @file - IPMI FRB PEIM. - -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include -#include - -#include - -VOID -SetWatchDogTimer ( - IN BOOLEAN Frb2Enabled - ) =20 -{ - EFI_STATUS Status; - IPMI_SET_WATCHDOG_TIMER_REQUEST FrbTimer; - IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; - UINT8 CompletionCode; - - Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); - if (EFI_ERROR(Status)) { - return ; - } - - if (Frb2Enabled) { - ZeroMem (&FrbTimer, sizeof(FrbTimer)); - //Byte 1 - FrbTimer.TimerUse.Bits.TimerUse =3D IPMI_WATCHDOG_TIMER_BIOS_FRB2; - //Byte 2=20 - FrbTimer.TimerActions.Uint8 =3D 0; //NormalBoot, NoTimeOutInterrupt= . i.e no action when BMC watchdog timeout - //Byte 3 - FrbTimer.PretimeoutInterval =3D 0; - //Byte 4 - FrbTimer.TimerUseExpirationFlagsClear |=3D BIT1; //set Frb2Expiration= Flag - - //Data Byte 5/6 - FrbTimer.InitialCountdownValue =3D PcdGet16(PcdFRBTimeoutValue) * 10; - - //Set BMC watchdog timer - Status =3D IpmiSetWatchdogTimer (&FrbTimer, &CompletionCode); - Status =3D IpmiResetWatchdogTimer (&CompletionCode); - } -} - -EFI_STATUS -EFIAPI -InitializeFrbPei ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ) -/*++ - -Routine Description: - -Arguments: - - FfsHeader - PeiServices - -Returns: - - EFI_SUCCESS - ---*/ -{ - BOOLEAN Frb2Enabled; - - // - // If we are booting with defaults, then make sure FRB2 is enabled. - // - Frb2Enabled =3D PcdGetBool (PcdFRB2EnabledFlag); - - SetWatchDogTimer (Frb2Enabled); - - return EFI_SUCCESS; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf b/Platfo= rm/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf deleted file mode 100644 index 1882453ffe..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Frb/FrbPei.inf +++ /dev/null @@ -1,37 +0,0 @@ -### @file -# Component description file for IPMI FRB PEIM. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D FrbPei - FILE_GUID =3D 7F9F9788-9F1F-4725-895C-3932F1A04DE8 - MODULE_TYPE =3D PEIM - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D InitializeFrbPei - -[Sources] - FrbPei.c - -[Packages] =20 - MdePkg/MdePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - -[LibraryClasses] - PeimEntryPoint - DebugLib - BaseMemoryLib - PcdLib - IpmiCommandLib - -[Pcd] - gAdvancedFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag - gAdvancedFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue =20 - -[Depex] - TRUE diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiCom= mandLib.h b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiComm= andLib.h deleted file mode 100644 index 9b761717d4..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiCommandLib= .h +++ /dev/null @@ -1,235 +0,0 @@ -/** @file - This library abstract how to send/receive IPMI command. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef _IPMI_COMMAND_LIB_H_ -#define _IPMI_COMMAND_LIB_H_ - -#include -#include - -// -// NetFnApp -// -EFI_STATUS -EFIAPI -IpmiGetDeviceId ( - OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId - ); - -EFI_STATUS -EFIAPI -IpmiGetSelfTestResult ( - OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult - ); - -EFI_STATUS -EFIAPI -IpmiResetWatchdogTimer ( - OUT UINT8 *CompletionCode - ); - -EFI_STATUS -EFIAPI -IpmiSetWatchdogTimer ( - IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer, - OUT UINT8 *CompletionCode - ); - -EFI_STATUS -EFIAPI -IpmiGetWatchdogTimer ( - OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer - ); - -EFI_STATUS -EFIAPI -IpmiSetBmcGlobalEnables ( - IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables, - OUT UINT8 *CompletionCode - ); - -EFI_STATUS -EFIAPI -IpmiGetBmcGlobalEnables ( - OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables - ); - -EFI_STATUS -EFIAPI -IpmiClearMessageFlags ( - IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest, - OUT UINT8 *CompletionCode - ); - -EFI_STATUS -EFIAPI -IpmiGetMessageFlags ( - OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse - ); - -EFI_STATUS -EFIAPI -IpmiGetMessage ( - OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse, - IN OUT UINT32 *GetMessageResponseSize - ); - -EFI_STATUS -EFIAPI -IpmiSendMessage ( - IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest, - IN UINT32 SendMessageRequestSize, - OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse, - IN OUT UINT32 *SendMessageResponseSize - ); - -// -// NetFnTransport -// -EFI_STATUS -EFIAPI -IpmiSolActivating ( - IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest, - OUT UINT8 *CompletionCode - ); - -EFI_STATUS -EFIAPI -IpmiSetSolConfigurationParameters ( - IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationPara= metersRequest, - IN UINT32 SetConfigurationParam= etersRequestSize, - OUT UINT8 *CompletionCode - ); - -EFI_STATUS -EFIAPI -IpmiGetSolConfigurationParameters ( - IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationPara= metersRequest, - OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationPara= metersResponse, - IN OUT UINT32 *GetConfigurationPara= metersResponseSize - ); - -// -// NetFnChasis -// -EFI_STATUS -EFIAPI -IpmiGetChassisCapabilities ( - OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesRespo= nse - ); - -EFI_STATUS -EFIAPI -IpmiGetChassisStatus ( - OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse - ); - -EFI_STATUS -EFIAPI -IpmiChassisControl ( - IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest, - OUT UINT8 *CompletionCode - ); - -EFI_STATUS -EFIAPI -IpmiSetPowerRestorePolicy ( - IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest, - OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse - ); - -// -// NetFnStorage -// -EFI_STATUS -EFIAPI -IpmiGetFruInventoryAreaInfo ( - IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoR= equest, - OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoR= esponse - ); - -EFI_STATUS -EFIAPI -IpmiReadFruData ( - IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest, - OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse, - IN OUT UINT32 *ReadFruDataResponseSize - ); - -EFI_STATUS -EFIAPI -IpmiWriteFruData ( - IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest, - IN UINT32 WriteFruDataRequestSize, - OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse - ); - -EFI_STATUS -EFIAPI -IpmiGetSelInfo ( - OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse - ); - -EFI_STATUS -EFIAPI -IpmiGetSelEntry ( - IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest, - OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse, - IN OUT UINT32 *GetSelEntryResponseSize - ); - -EFI_STATUS -EFIAPI -IpmiAddSelEntry ( - IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest, - OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse - ); - -EFI_STATUS -EFIAPI -IpmiPartialAddSelEntry ( - IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest, - IN UINT32 PartialAddSelEntryRequestSize, - OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse - ); - -EFI_STATUS -EFIAPI -IpmiClearSel ( - IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest, - OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse - ); - -EFI_STATUS -EFIAPI -IpmiGetSelTime ( - OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse - ); - -EFI_STATUS -EFIAPI -IpmiSetSelTime ( - IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest, - OUT UINT8 *CompletionCode - ); - -EFI_STATUS -EFIAPI -IpmiGetSdrRepositoryInfo ( - OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp - ); - -EFI_STATUS -EFIAPI -IpmiGetSdr ( - IN IPMI_GET_SDR_REQUEST *GetSdrRequest, - OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse, - IN OUT UINT32 *GetSdrResponseSize - ); - -#endif diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiPla= tformHookLib.h b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/Ipm= iPlatformHookLib.h deleted file mode 100644 index 8359e3f38b..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Include/Library/IpmiPlatformHo= okLib.h +++ /dev/null @@ -1,23 +0,0 @@ -/** @file - This library abstract the platform specific hook for IPMI. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef _IPMI_PLATFORM_UPDATE_LIB_H_ -#define _IPMI_PLATFORM_UPDATE_LIB_H_ - -#include -#include -#include - -EFI_STATUS -EFIAPI -PlatformIpmiIoRangeSet( - UINT16 IpmiIoBase - ); - -#endif - diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c b/Pla= tform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c deleted file mode 100644 index 58e1fb4d7e..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.c +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - IPMI FRU Driver. - -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include -#include -#include - -EFI_STATUS -EFIAPI -InitializeFru ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -/*++ - -Routine Description: - - Initialize SM Redirection Fru Layer - -Arguments: - - ImageHandle - ImageHandle of the loaded driver - SystemTable - Pointer to the System Table - -Returns: - - EFI_STATUS - ---*/ -{ - EFI_STATUS Status; - IPMI_GET_DEVICE_ID_RESPONSE ControllerInfo; - IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST GetFruInventoryAreaInfoReques= t; - IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE GetFruInventoryAreaInfoRespon= se; - - // - // Get all the SDR Records from BMC and retrieve the Record ID from the= structure for future use. - // - Status =3D IpmiGetDeviceId (&ControllerInfo); - if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetDeviceId Status=3D%x\n", Stat= us)); - return Status; - } - - DEBUG((DEBUG_ERROR, "!!! IpmiFru FruInventorySupport %x\n", ControllerI= nfo.DeviceSupport.Bits.FruInventorySupport)); - - if (ControllerInfo.DeviceSupport.Bits.FruInventorySupport) { - GetFruInventoryAreaInfoRequest.DeviceId =3D 0; - Status =3D IpmiGetFruInventoryAreaInfo (&GetFruInventoryAreaInfoReques= t, &GetFruInventoryAreaInfoResponse); - if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetFruInventoryAreaInfo Status= =3D%x\n", Status)); - return Status; - } - DEBUG((DEBUG_ERROR, "!!! IpmiFru InventoryAreaSize=3D%x\n", GetFruInv= entoryAreaInfoResponse.InventoryAreaSize)); - } - - return EFI_SUCCESS; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf b/P= latform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf deleted file mode 100644 index a2556e92d2..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiFru/IpmiFru.inf +++ /dev/null @@ -1,35 +0,0 @@ -### @file -# Component description file for IPMI FRU. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D IpmiFru - FILE_GUID =3D 3F1D6464-2B4C-4640-BAC4-3DD905D26CDA - MODULE_TYPE =3D DXE_DRIVER - PI_SPECIFICATION_VERSION =3D 0x0001000A - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D InitializeFru - -[Sources] - IpmiFru.c - -[Packages] - MdePkg/MdePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - UefiLib - DebugLib - UefiBootServicesTableLib - BaseMemoryLib - IpmiCommandLib - -[Depex] - TRUE diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.c = b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.c deleted file mode 100644 index fccbb3b5dc..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.c +++ /dev/null @@ -1,150 +0,0 @@ -/** @file - IPMI stack initialization. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include - -#define BMC_TIMEOUT 30 // [s] How long shall BIOS wait for BMC -#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout - -EFI_STATUS -GetSelfTest ( - VOID - ) -/*++ - -Routine Description: - - Execute the Get Self Test results command to determine whether or not th= e BMC self tests - have passed - -Arguments: - - mIpmiInstance - Data structure describing BMC variables and used for s= ending commands - StatusCodeValue - An array used to accumulate error codes for later repo= rting. - ErrorCount - Counter used to keep track of error codes in StatusCod= eValue - -Returns:=20 - - EFI_SUCCESS - BMC Self test results are retrieved and saved into B= mcStatus - EFI_DEVICE_ERROR - BMC failed to return self test results. - ---*/ -{ - EFI_STATUS Status; - IPMI_SELF_TEST_RESULT_RESPONSE TestResult; - - // - // Get the SELF TEST Results. - // - Status =3D IpmiGetSelfTestResult (&TestResult); - if (EFI_ERROR(Status)) { - DEBUG((DEBUG_ERROR, "\n[IPMI] BMC does not respond (status: %r)!\n\n",= Status)); - return Status; - } - - DEBUG((DEBUG_INFO, "[IPMI] BMC self-test result: %02X-%02X\n", TestResul= t.Result, TestResult.Param)); - - return EFI_SUCCESS; -} - -EFI_STATUS -GetDeviceId ( - OUT BOOLEAN *UpdateMode - ) -/*++ - -Routine Description: - Execute the Get Device ID command to determine whether or not the BMC is= in Force Update - Mode. If it is, then report it to the error manager. - -Arguments: - -Returns:=20 - Status - ---*/ -{ - EFI_STATUS Status; - IPMI_GET_DEVICE_ID_RESPONSE BmcInfo; - UINT32 Retries; - =20 - // - // Set up a loop to retry for up to 30 seconds. Calculate retries not ti= meout - // so that in case KCS is not enabled and EfiIpmiSendCommand() returns - // immediately we will not wait all the 30 seconds. - // - Retries =3D BMC_TIMEOUT / BMC_KCS_TIMEOUT + 1; - // - // Get the device ID information for the BMC. - // - do { - Status =3D IpmiGetDeviceId (&BmcInfo); - if (!EFI_ERROR(Status)) { - break; - } - DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d ret= ries left\n", Status, Retries)); - MicroSecondDelay(50 * 1000); - if (Retries-- =3D=3D 0) { - return Status; - } - } while (TRUE); - - DEBUG(( - DEBUG_INFO, - "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n", - BmcInfo.DeviceId, - BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev, - BmcInfo.MinorFirmwareRev - )); - *UpdateMode =3D (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode; - return Status; -} - -/** - The entry point of the Ipmi DXE. - -@param[in] ImageHandle - Handle of this driver image -@param[in] SystemTable - Table containing standard EFI services - -@retval EFI_SUCCESS - Always success is returned even if KCS does not func= tion - - **/ -EFI_STATUS -EFIAPI -IpmiInterfaceInit ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - BOOLEAN UpdateMode; - EFI_STATUS Status; - - DEBUG((EFI_D_ERROR,"IPMI Dxe:Get BMC Device Id\n")); - - // - // Get the Device ID and check if the system is in Force Update mode. - // - Status =3D GetDeviceId (&UpdateMode); - // - // Do not continue initialization if the BMC is in Force Update Mode. - // - if (!EFI_ERROR(Status) && !UpdateMode) { - // - // Get the SELF TEST Results. - // - GetSelfTest (); - } - - return EFI_SUCCESS; -} - - diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.in= f b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf deleted file mode 100644 index 2e544270a3..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/DxeIpmiInit.inf +++ /dev/null @@ -1,34 +0,0 @@ -### @file -# Component description file for IPMI initialization. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D DxeIpmiInit - FILE_GUID =3D 07A01ACF-46D5-48de-A63D-74FA92AA8450 - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D IpmiInterfaceInit - -[Sources] - DxeIpmiInit.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - DebugLib - UefiDriverEntryPoint - IpmiCommandLib - TimerLib - -[Depex] - TRUE \ No newline at end of file diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.c = b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.c deleted file mode 100644 index 062d20c44e..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.c +++ /dev/null @@ -1,96 +0,0 @@ -/** @file - IPMI stack initialization in PEI. - -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include - -#define BMC_TIMEOUT_PEI 50 // [s] How long shall BIOS wait for BMC -#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout - -EFI_STATUS -GetDeviceId ( - OUT BOOLEAN *UpdateMode - ) -/*++ - -Routine Description: - Execute the Get Device ID command to determine whether or not the BMC is= in Force Update - Mode. If it is, then report it to the error manager. - -Arguments: - -Returns: - Status - ---*/ -{ - EFI_STATUS Status; - IPMI_GET_DEVICE_ID_RESPONSE BmcInfo; - UINT32 Retries; - - // - // Set up a loop to retry for up to 30 seconds. Calculate retries not ti= meout - // so that in case KCS is not enabled and EfiIpmiSendCommand() returns - // immediately we will not wait all the 30 seconds. - // - Retries =3D BMC_TIMEOUT_PEI/ BMC_KCS_TIMEOUT + 1; - // - // Get the device ID information for the BMC. - // - do { - Status =3D IpmiGetDeviceId (&BmcInfo); - if (!EFI_ERROR(Status)) { - break; - } - DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d ret= ries left\n", Status, Retries)); - if (Retries-- =3D=3D 0) { - return Status; - } - } while (TRUE); - - DEBUG(( - DEBUG_INFO, - "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n", - BmcInfo.DeviceId, - BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev, - BmcInfo.MinorFirmwareRev - )); - *UpdateMode =3D (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode; - return Status; -} - -/** - The entry point of the Ipmi PEIM. - - @param FileHandle Handle of the file being invoked. - @param PeiServices Describes the list of possible PEI Services. - - @retval EFI_SUCCESS Indicates that Ipmi initialization completed succe= ssfully. - @retval Others Indicates that Ipmi initialization could not compl= ete successfully. -**/ -EFI_STATUS -EFIAPI -PeimIpmiInterfaceInit ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ) -{ - BOOLEAN UpdateMode; - EFI_STATUS Status; - - DEBUG ((DEBUG_INFO, "IPMI Peim:Get BMC Device Id\n")); - - // - // Get the Device ID and check if the system is in Force Update mode. - // - Status =3D GetDeviceId (&UpdateMode); - return Status; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.in= f b/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf deleted file mode 100644 index 5e00f4bd33..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/IpmiInit/PeiIpmiInit.inf +++ /dev/null @@ -1,32 +0,0 @@ -### @file -# Component description file for IPMI initialization in PEI. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D PeiIpmiInit - FILE_GUID =3D D8F57F4E-D67D-4f2c-8351-C7092986542F - MODULE_TYPE =3D PEIM - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D PeimIpmiInterfaceInit - -[Sources] - PeiIpmiInit.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - -[LibraryClasses] - PeimEntryPoint - DebugLib - IpmiCommandLib - -[Depex] - TRUE \ No newline at end of file diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/= IpmiCommandLib.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCom= mandLib/IpmiCommandLib.inf deleted file mode 100644 index 89e7a66f60..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCom= mandLib.inf +++ /dev/null @@ -1,32 +0,0 @@ -### @file -# Component description file for IPMI Command Library. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D IpmiCommandLib - FILE_GUID =3D E599C9C7-5913-40A0-8669-67282E2BEC53 - MODULE_TYPE =3D UEFI_DRIVER - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D IpmiCommandLib - -[sources] - IpmiCommandLibNetFnApp.c - IpmiCommandLibNetFnTransport.c - IpmiCommandLibNetFnChassis.c - IpmiCommandLibNetFnStorage.c - =20 -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - -[LibraryClasses] - BaseMemoryLib - DebugLib - IpmiLib diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/= IpmiCommandLibNetFnApp.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/I= pmiCommandLib/IpmiCommandLibNetFnApp.c deleted file mode 100644 index b57db50610..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCom= mandLibNetFnApp.c +++ /dev/null @@ -1,248 +0,0 @@ -/** @file - IPMI Command - NetFnApp. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include - -#include - -EFI_STATUS -EFIAPI -IpmiGetDeviceId ( - OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*DeviceId); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_APP, - IPMI_APP_GET_DEVICE_ID, - NULL, - 0, - (VOID *)DeviceId, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiGetSelfTestResult ( - OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*SelfTestResult); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_APP, - IPMI_APP_GET_SELFTEST_RESULTS, - NULL, - 0, - (VOID *)SelfTestResult, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiResetWatchdogTimer ( - OUT UINT8 *CompletionCode - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*CompletionCode); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_APP, - IPMI_APP_RESET_WATCHDOG_TIMER, - NULL, - 0, - (VOID *)CompletionCode, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiSetWatchdogTimer ( - IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer, - OUT UINT8 *CompletionCode - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*CompletionCode); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_APP, - IPMI_APP_SET_WATCHDOG_TIMER, - (VOID *)SetWatchdogTimer, - sizeof(*SetWatchdogTimer), - (VOID *)CompletionCode, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiGetWatchdogTimer ( - OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*GetWatchdogTimer); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_APP, - IPMI_APP_GET_WATCHDOG_TIMER, - NULL, - 0, - (VOID *)GetWatchdogTimer, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiSetBmcGlobalEnables ( - IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables, - OUT UINT8 *CompletionCode - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*CompletionCode); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_APP, - IPMI_APP_SET_BMC_GLOBAL_ENABLES, - (VOID *)SetBmcGlobalEnables, - sizeof(*SetBmcGlobalEnables), - (VOID *)CompletionCode, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiGetBmcGlobalEnables ( - OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*GetBmcGlobalEnables); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_APP, - IPMI_APP_GET_BMC_GLOBAL_ENABLES, - NULL, - 0, - (VOID *)GetBmcGlobalEnables, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiClearMessageFlags ( - IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest, - OUT UINT8 *CompletionCode - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*CompletionCode); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_APP, - IPMI_APP_CLEAR_MESSAGE_FLAGS, - (VOID *)ClearMessageFlagsRequest, - sizeof(*ClearMessageFlagsRequest), - (VOID *)CompletionCode, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiGetMessageFlags ( - OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*GetMessageFlagsResponse); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_APP, - IPMI_APP_GET_MESSAGE_FLAGS, - NULL, - 0, - (VOID *)GetMessageFlagsResponse, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiGetMessage ( - OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse, - IN OUT UINT32 *GetMessageResponseSize - ) -{ - EFI_STATUS Status; - - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_APP, - IPMI_APP_GET_MESSAGE, - NULL, - 0, - (VOID *)GetMessageResponse, - GetMessageResponseSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiSendMessage ( - IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest, - IN UINT32 SendMessageRequestSize, - OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse, - IN OUT UINT32 *SendMessageResponseSize - ) -{ - EFI_STATUS Status; - - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_APP, - IPMI_APP_SEND_MESSAGE, - (VOID *)SendMessageRequest, - SendMessageRequestSize, - (VOID *)SendMessageResponse, - SendMessageResponseSize - ); - return Status; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/= IpmiCommandLibNetFnChassis.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Libra= ry/IpmiCommandLib/IpmiCommandLibNetFnChassis.c deleted file mode 100644 index 1b86aa888e..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCom= mandLibNetFnChassis.c +++ /dev/null @@ -1,101 +0,0 @@ -/** @file - IPMI Command - NetFnChassis. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include - -#include - - -EFI_STATUS -EFIAPI -IpmiGetChassisCapabilities ( - OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesRespo= nse - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*GetChassisCapabilitiesResponse); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_CHASSIS, - IPMI_CHASSIS_GET_CAPABILITIES, - NULL, - 0, - (VOID *)GetChassisCapabilitiesResponse, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiGetChassisStatus ( - OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*GetChassisStatusResponse); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_CHASSIS, - IPMI_CHASSIS_GET_STATUS, - NULL, - 0, - (VOID *)GetChassisStatusResponse, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiChassisControl ( - IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest, - OUT UINT8 *CompletionCode - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*CompletionCode); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_CHASSIS, - IPMI_CHASSIS_CONTROL, - (VOID *)ChassisControlRequest, - sizeof(*ChassisControlRequest), - (VOID *)CompletionCode, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiSetPowerRestorePolicy ( - IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *ChassisControlRequest, - OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *ChassisControlResponse - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*ChassisControlResponse); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_CHASSIS, - IPMI_CHASSIS_SET_POWER_RESTORE_POLICY, - (VOID *)ChassisControlRequest, - sizeof(*ChassisControlRequest), - (VOID *)ChassisControlResponse, - &DataSize - ); - return Status; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/= IpmiCommandLibNetFnStorage.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Libra= ry/IpmiCommandLib/IpmiCommandLibNetFnStorage.c deleted file mode 100644 index 8e892c5f84..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCom= mandLibNetFnStorage.c +++ /dev/null @@ -1,275 +0,0 @@ -/** @file - IPMI Command - NetFnStorage. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include - -#include - - -EFI_STATUS -EFIAPI -IpmiGetFruInventoryAreaInfo ( - IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoR= equest, - OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoR= esponse - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*GetFruInventoryAreaInfoResponse); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_STORAGE, - IPMI_STORAGE_GET_FRU_INVENTORY_AREAINFO, - (VOID *)GetFruInventoryAreaInfoRequest, - sizeof(*GetFruInventoryAreaInfoRequest), - (VOID *)GetFruInventoryAreaInfoResponse, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiReadFruData ( - IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest, - OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse, - IN OUT UINT32 *ReadFruDataResponseSize - ) -{ - EFI_STATUS Status; - - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_STORAGE, - IPMI_STORAGE_READ_FRU_DATA, - (VOID *)ReadFruDataRequest, - sizeof(*ReadFruDataRequest), - (VOID *)ReadFruDataResponse, - ReadFruDataResponseSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiWriteFruData ( - IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest, - IN UINT32 WriteFruDataRequestSize, - OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*WriteFruDataResponse); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_STORAGE, - IPMI_STORAGE_WRITE_FRU_DATA, - (VOID *)WriteFruDataRequest, - WriteFruDataRequestSize, - (VOID *)WriteFruDataResponse, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiGetSelInfo ( - OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*GetSelInfoResponse); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_STORAGE, - IPMI_STORAGE_GET_SEL_INFO, - NULL, - 0, - (VOID *)GetSelInfoResponse, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiGetSelEntry ( - IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest, - OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse, - IN OUT UINT32 *GetSelEntryResponseSize - ) -{ - EFI_STATUS Status; - - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_STORAGE, - IPMI_STORAGE_GET_SEL_ENTRY, - (VOID *)GetSelEntryRequest, - sizeof(*GetSelEntryRequest), - (VOID *)GetSelEntryResponse, - GetSelEntryResponseSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiAddSelEntry ( - IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest, - OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*AddSelEntryResponse); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_STORAGE, - IPMI_STORAGE_ADD_SEL_ENTRY, - (VOID *)AddSelEntryRequest, - sizeof(*AddSelEntryRequest), - (VOID *)AddSelEntryResponse, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiPartialAddSelEntry ( - IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest, - IN UINT32 PartialAddSelEntryRequestSize, - OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*PartialAddSelEntryResponse); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_STORAGE, - IPMI_STORAGE_PARTIAL_ADD_SEL_ENTRY, - (VOID *)PartialAddSelEntryRequest, - PartialAddSelEntryRequestSize, - (VOID *)PartialAddSelEntryResponse, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiClearSel ( - IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest, - OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*ClearSelResponse); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_STORAGE, - IPMI_STORAGE_CLEAR_SEL, - (VOID *)ClearSelRequest, - sizeof(*ClearSelRequest), - (VOID *)ClearSelResponse, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiGetSelTime ( - OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*GetSelTimeResponse); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_STORAGE, - IPMI_STORAGE_GET_SEL_TIME, - NULL, - 0, - (VOID *)GetSelTimeResponse, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiSetSelTime ( - IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest, - OUT UINT8 *CompletionCode - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*CompletionCode); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_STORAGE, - IPMI_STORAGE_SET_SEL_TIME, - (VOID *)SetSelTimeRequest, - sizeof(*SetSelTimeRequest), - (VOID *)CompletionCode, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiGetSdrRepositoryInfo ( - OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*GetSdrRepositoryInfoResp); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_STORAGE, - IPMI_STORAGE_GET_SDR_REPOSITORY_INFO, - NULL, - 0, - (VOID *)GetSdrRepositoryInfoResp, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiGetSdr ( - IN IPMI_GET_SDR_REQUEST *GetSdrRequest, - OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse, - IN OUT UINT32 *GetSdrResponseSize - ) -{ - EFI_STATUS Status; - - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_STORAGE, - IPMI_STORAGE_GET_SDR, - (VOID *)GetSdrRequest, - sizeof(*GetSdrRequest), - (VOID *)GetSdrResponse, - GetSdrResponseSize - ); - return Status; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/= IpmiCommandLibNetFnTransport.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Lib= rary/IpmiCommandLib/IpmiCommandLibNetFnTransport.c deleted file mode 100644 index 3b9b17b909..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiCommandLib/IpmiCom= mandLibNetFnTransport.c +++ /dev/null @@ -1,81 +0,0 @@ -/** @file - IPMI Command - NetFnTransport. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include - -#include - - -EFI_STATUS -EFIAPI -IpmiSolActivating ( - IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest, - OUT UINT8 *CompletionCode - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*CompletionCode); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_TRANSPORT, - IPMI_TRANSPORT_SOL_ACTIVATING, - (VOID *)SolActivatingRequest, - sizeof(*SolActivatingRequest), - (VOID *)CompletionCode, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiSetSolConfigurationParameters ( - IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationPara= metersRequest, - IN UINT32 SetConfigurationParam= etersRequestSize, - OUT UINT8 *CompletionCode - ) -{ - EFI_STATUS Status; - UINT32 DataSize; - - DataSize =3D sizeof(*CompletionCode); - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_TRANSPORT, - IPMI_TRANSPORT_SET_SOL_CONFIG_PARAM, - (VOID *)SetConfigurationParametersRequest, - SetConfigurationParametersRequestSize, - (VOID *)CompletionCode, - &DataSize - ); - return Status; -} - -EFI_STATUS -EFIAPI -IpmiGetSolConfigurationParameters ( - IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationPara= metersRequest, - OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationPara= metersResponse, - IN OUT UINT32 *GetConfigurationPara= metersResponseSize - ) -{ - EFI_STATUS Status; - - Status =3D IpmiSubmitCommand ( - IPMI_NETFN_TRANSPORT, - IPMI_TRANSPORT_GET_SOL_CONFIG_PARAM, - (VOID *)GetConfigurationParametersRequest, - sizeof(*GetConfigurationParametersRequest), - (VOID *)GetConfigurationParametersResponse, - GetConfigurationParametersResponseSize - ); - return Status; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/Ipm= iLibNull.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/Ipm= iLibNull.c deleted file mode 100644 index db4c7ada7e..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNul= l.c +++ /dev/null @@ -1,45 +0,0 @@ -/** @file - IPMI library. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include - -#include - -/** - This service enables submitting commands via Ipmi. - - @param[in] NetFunction Net function of the command. - @param[in] Command IPMI Command. - @param[in] RequestData Command Request Data. - @param[in] RequestDataSize Size of Command Request Data. - @param[out] ResponseData Command Response Data. The completi= on code is the first byte of response data. - @param[in, out] ResponseDataSize Size of Command Response Data. - - @retval EFI_SUCCESS The command byte stream was successfully = submit to the device and a response was successfully received. - @retval EFI_NOT_FOUND The command was not successfully sent to = the device or a response was not successfully received from the device. - @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command= access. - @retval EFI_DEVICE_ERROR Ipmi Device hardware error. - @retval EFI_TIMEOUT The command time out. - @retval EFI_UNSUPPORTED The command was not successfully sent to = the device. - @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource= or data size error. -**/ -EFI_STATUS -EFIAPI -IpmiSubmitCommand ( - IN UINT8 NetFunction, - IN UINT8 Command, - IN UINT8 *RequestData, - IN UINT32 RequestDataSize, - OUT UINT8 *ResponseData, - IN OUT UINT32 *ResponseDataSize - ) -{ - return EFI_UNSUPPORTED; -} - diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/Ipm= iLibNull.inf b/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/I= pmiLibNull.inf deleted file mode 100644 index c042b8beed..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiLibNull/IpmiLibNul= l.inf +++ /dev/null @@ -1,28 +0,0 @@ -### @file -# Component description file for IPMI NULL Library. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D IpmiLibNull - FILE_GUID =3D DDF0E1D9-F53F-429A-BD9C-5D12A321E625 - MODULE_TYPE =3D UEFI_DRIVER - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D IpmiLib - -[sources] - IpmiLibNull.c - =20 -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - -[LibraryClasses] - -[Pcd] diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHoo= kLibNull/IpmiPlatformHookLibNull.c b/Platform/Intel/AdvancedFeaturePkg/Ipmi= /Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.c deleted file mode 100644 index bdc8d23827..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNul= l/IpmiPlatformHookLibNull.c +++ /dev/null @@ -1,36 +0,0 @@ -/** @file - IPMI platform hook library. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include - -// -// Prototype definitions for IPMI Platform Update Library -// -EFI_STATUS -EFIAPI -PlatformIpmiIoRangeSet( - UINT16 IpmiIoBase - ) -/*++ - - Routine Description: - - This function sets IPMI Io range - - Arguments: - - IpmiIoBase - - Returns: - - Status - ---*/ -{ - return EFI_SUCCESS; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHoo= kLibNull/IpmiPlatformHookLibNull.inf b/Platform/Intel/AdvancedFeaturePkg/Ip= mi/Library/IpmiPlatformHookLibNull/IpmiPlatformHookLibNull.inf deleted file mode 100644 index 458b40f626..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/Library/IpmiPlatformHookLibNul= l/IpmiPlatformHookLibNull.inf +++ /dev/null @@ -1,29 +0,0 @@ -### @file -# Component description file for IPMI platform Library. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D IpmiPlatformHookLibNull - FILE_GUID =3D C31A5B17-81DB-4D86-B376-17711BB6E0A5 - MODULE_TYPE =3D BASE - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D IpmiPlatformHookLib - -[sources] - IpmiPlatformHookLibNull.c - =20 -[Packages] - MdePkg/MdePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - -[LibraryClasses] - DebugLib -=20 -[Protocols] - gEfiIpmiTransportProtocolGuid diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c b/Platfor= m/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c deleted file mode 100644 index 25139eadba..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.c +++ /dev/null @@ -1,112 +0,0 @@ -/** @file - IPMI Os watchdog timer Driver. - -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include -#include - -BOOLEAN mOsWdtFlag =3D FALSE; - -EFI_EVENT mExitBootServicesEvent; - -VOID -EFIAPI -EnableEfiOsBootWdtHandler ( - IN EFI_EVENT Event, - IN VOID *Context - ) -/*++ - -Routine Description: - Enable the OS Boot Watchdog Timer. - Is called only on legacy or EFI OS boot. - -Arguments: - Event - Event type - *Context - Context for the event - -Returns: - None - ---*/ -{ - EFI_STATUS Status; - IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer; - UINT8 CompletionCode; - IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; - static BOOLEAN OsWdtEventHandled =3D FALSE; - - DEBUG((EFI_D_ERROR, "!!! EnableEfiOsBootWdtHandler()!!!\n")); - - // - // Make sure it processes once only. And proceess it only if OsWdtFlag= =3D=3DTRUE; - // - if (OsWdtEventHandled || !mOsWdtFlag) { - return ; - } - - OsWdtEventHandled =3D TRUE; - - Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); - if (EFI_ERROR (Status)) { - return ; - } - - ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer)); - // - // Just flip the Timer Use bit. This should release the timer. - // - SetWatchdogTimer.TimerUse.Bits.TimerRunning =3D 1; - SetWatchdogTimer.TimerUse.Bits.TimerUse =3D IPMI_WATCHDOG_TIMER_O= S_LOADER; - SetWatchdogTimer.TimerActions.Uint8 =3D IPMI_WATCHDOG_TIMER_A= CTION_HARD_RESET; - SetWatchdogTimer.TimerUseExpirationFlagsClear &=3D ~BIT4; - SetWatchdogTimer.TimerUseExpirationFlagsClear |=3D BIT1 | BIT2; - SetWatchdogTimer.InitialCountdownValue =3D 600; // 100ms / count - - Status =3D IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode); - return ; -} - -EFI_STATUS -EFIAPI -DriverInit ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -/*++ - -Routine Description: - This is the standard EFI driver point. This function intitializes - the private data required for creating ASRR Driver. - -Arguments: - As required for DXE driver enrty routine. - ImageHandle - ImageHandle of the loaded driver - SystemTable - Pointer to the System Table - -Returns: - @retval EFI_SUCCESS Protocol successfully started and installe= d. - @retval EFI_OUT_OF_RESOURCES The event could not be allocated. - ---*/ -{ - EFI_STATUS Status; - - Status =3D gBS->CreateEvent ( - EVT_SIGNAL_EXIT_BOOT_SERVICES, - TPL_NOTIFY, - EnableEfiOsBootWdtHandler, - NULL, - &mExitBootServicesEvent - ); - - return Status; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf b/Platf= orm/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf deleted file mode 100644 index e49942c198..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/OsWdt/OsWdt.inf +++ /dev/null @@ -1,34 +0,0 @@ -### @file -# Component description file for IPMI OS watch dog timer driver. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D OsWdt - FILE_GUID =3D BE9B694A-B5D9-48e0-A527-6E1A49EB7028 - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D DriverInit - -[Sources] - OsWdt.c - -[Packages] - MdePkg/MdePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - DebugLib - UefiBootServicesTableLib - BaseMemoryLib - IpmiCommandLib - =20 -[Depex] - TRUE - diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.c b= /Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.c deleted file mode 100644 index 47bec1975a..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.c +++ /dev/null @@ -1,164 +0,0 @@ -/** @file - IPMI Serial Over Lan Driver. - -Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SOL_CMD_RETRY_COUNT 10 - -/*++ - -Routine Description: - - This routine gets the SOL payload status or settings for a specific ch= annel. - -Arguments: - Channel - LAN channel naumber. - ParamSel - Configuration parameter selection. - Data - Information returned from BMC. -Returns: - EFI_SUCCESS - SOL configuration parameters are successfully read f= rom BMC. - Others - SOL configuration parameters could not be read from = BMC. - ---*/ -EFI_STATUS -GetSOLStatus ( - IN UINT8 Channel, - IN UINT8 ParamSel, - IN OUT UINT8 *Data - ) -{ - EFI_STATUS Status =3D EFI_SUCCESS; - IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST GetConfigurationParameter= sRequest; - IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE GetConfigurationParameter= sResponse; - UINT32 DataSize; - UINT8 RetryCount; - - for (RetryCount =3D 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) { - ZeroMem (&GetConfigurationParametersRequest, sizeof(GetConfigurationPa= rametersRequest)); - GetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber =3D= Channel; - GetConfigurationParametersRequest.ParameterSelector =3D= ParamSel; - - ZeroMem (&GetConfigurationParametersResponse, sizeof(GetConfigurationP= arametersResponse)); - - DataSize =3D sizeof(GetConfigurationParametersResponse); - Status =3D IpmiGetSolConfigurationParameters ( - &GetConfigurationParametersRequest, - &GetConfigurationParametersResponse, - &DataSize - ); - - if (Status =3D=3D EFI_SUCCESS){ - break; - } else { - gBS->Stall(100000); - } - } - - if (Status =3D=3D EFI_SUCCESS) { - *Data =3D GetConfigurationParametersResponse.ParameterData[0]; - } - - return Status; -} - -/*++ - -Routine Description: - - This routine sets the SOL payload configuration parameters for a speci= fic channel. - -Arguments: - Channel - LAN channel naumber. - ParamSel - Configuration parameter selection. - Data - Configuration parameter values. -Returns: - EFI_SUCCESS - SOL configuration parameters are sent to BMC. - Others - SOL configuration parameters could not be sent to BM= C. - ---*/ -EFI_STATUS -SetSOLParams ( - IN UINT8 Channel, - IN UINT8 ParamSel, - IN UINT8 Data - ) -{ - EFI_STATUS Status =3D EFI_SUCCESS; - IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST SetConfigurationParameter= sRequest; - UINT8 CompletionCode; - UINT8 RetryCount; - - for (RetryCount =3D 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) { - ZeroMem (&SetConfigurationParametersRequest, sizeof(SetConfigurationPa= rametersRequest)); - SetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber =3D= Channel; - SetConfigurationParametersRequest.ParameterSelector =3D= ParamSel; - SetConfigurationParametersRequest.ParameterData[0] =3D= Data; - - CompletionCode =3D 0; - - Status =3D IpmiSetSolConfigurationParameters ( - &SetConfigurationParametersRequest, - sizeof(SetConfigurationParametersRequest), - &CompletionCode - ); - - if (Status =3D=3D EFI_SUCCESS) { - break; - } else { - gBS->Stall(100000); - } - } - - return Status; -} - -EFI_STATUS -EFIAPI -SolStatusEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -/*++ - - Routine Description: - This is the standard EFI driver point. This function intitializes - the private data required for creating SOL Status Driver. - - Arguments: - ImageHandle - Handle for the image of this driver - SystemTable - Pointer to the EFI System Table - - Returns: - EFI_SUCCESS - Protocol successfully installed - EFI_UNSUPPORTED - Protocol can't be installed. - ---*/ -{ - EFI_STATUS Status =3D EFI_SUCCESS; - UINT8 Channel; - BOOLEAN SolEnabled =3D FALSE; - - for (Channel =3D 1; Channel <=3D PcdGet8 (PcdMaxSOLChannels); Channel++)= { - Status =3D GetSOLStatus (Channel, IPMI_SOL_CONFIGURATION_PARAMETER_SOL= _ENABLE, &SolEnabled); - if (Status =3D=3D EFI_SUCCESS) { - DEBUG ((DEBUG_ERROR, "SOL enabling status for channel %x is %x\n", C= hannel, SolEnabled)); - } else { - DEBUG ((DEBUG_ERROR, "Failed to get channel %x SOL status from BMC!,= status is %x\n", Channel, Status)); - } - } - - return Status; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf= b/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf deleted file mode 100644 index 07f2c03f6a..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Ipmi/SolStatus/SolStatus.inf +++ /dev/null @@ -1,38 +0,0 @@ -### @file -# Component description file for IPMI Serial Over LAN driver. -# -# Copyright (c) 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D SolStatus - FILE_GUID =3D F9887B5E-2D46-4213-8794-14F1FD39F6B8 - MODULE_TYPE =3D DXE_DRIVER - PI_SPECIFICATION_VERSION =3D 0x0001000A - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D SolStatusEntryPoint - -[Sources] - SolStatus.c - -[Packages] - MdePkg/MdePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - =20 -[Pcd] - gAdvancedFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels - =20 -[LibraryClasses] - UefiDriverEntryPoint - DebugLib - UefiBootServicesTableLib - IpmiCommandLib - PcdLib - -[Depex] - TRUE - diff --git a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c b/Platform/Intel/= AdvancedFeaturePkg/S3/S3Pei.c deleted file mode 100644 index b0aaa04962..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.c +++ /dev/null @@ -1,36 +0,0 @@ -/** @file - Source code file for S3 PEI module - -Copyright (c) 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include - -/** - S3 PEI module entry point - - @param[in] FileHandle Not used. - @param[in] PeiServices General purpose services available to e= very PEIM. - - @retval EFI_SUCCESS The function completes successfully - @retval EFI_OUT_OF_RESOURCES Insufficient resources to create databa= se -**/ -EFI_STATUS -EFIAPI -S3PeiEntryPoint ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ) -{ - EFI_STATUS Status; - - // - // Install EFI_PEI_MM_ACCESS_PPI for S3 resume case - // - Status =3D PeiInstallSmmAccessPpi (); - - return Status; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.inf b/Platform/Inte= l/AdvancedFeaturePkg/S3/S3Pei.inf deleted file mode 100644 index 847edd20c0..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/S3/S3Pei.inf +++ /dev/null @@ -1,31 +0,0 @@ -### @file -# Component information file for the S3 PEI module. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010017 - BASE_NAME =3D S3Pei - FILE_GUID =3D 8683EFB2-FDE1-4AFF-B2DB-E96449FDD4E9 - VERSION_STRING =3D 1.0 - MODULE_TYPE =3D PEIM - ENTRY_POINT =3D S3PeiEntryPoint - -[LibraryClasses] - PeimEntryPoint - PeiServicesLib - SmmAccessLib - -[Packages] - MdePkg/MdePkg.dec - IntelSiliconPkg/IntelSiliconPkg.dec - -[Sources] - S3Pei.c - -[Depex] - gEfiPeiMemoryDiscoveredPpiGuid diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Smbios= Basic.h b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBas= ic.h deleted file mode 100644 index 944946b5b8..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h +++ /dev/null @@ -1,45 +0,0 @@ -/** @file - Smbios basic header file. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef _SMBIOS_BASIC_DRIVER_H -#define _SMBIOS_BASIC_DRIVER_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/** - Add an SMBIOS record. - - @param Smbios The EFI_SMBIOS_PROTOCOL instance. - @param SmbiosHandle A unique handle will be assigned to the SM= BIOS record. - @param Record The data for the fixed portion of the SMBI= OS record. The format of the record is - determined by EFI_SMBIOS_TABLE_HEADER.Type= . The size of the formatted area is defined=20 - by EFI_SMBIOS_TABLE_HEADER.Length and eith= er followed by a double-null (0x0000) or=20 - a set of null terminated strings and a nul= l. - - @retval EFI_SUCCESS Record was added. - @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system= resources. - -**/ -EFI_STATUS -AddSmbiosRecord ( - IN EFI_SMBIOS_PROTOCOL *Smbios, - OUT EFI_SMBIOS_HANDLE *SmbiosHandle, - IN EFI_SMBIOS_TABLE_HEADER *Record - ); - -#endif diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Smbios= BasicDxe.inf b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Smbi= osBasicDxe.inf deleted file mode 100644 index c3ec4f7885..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDx= e.inf +++ /dev/null @@ -1,83 +0,0 @@ -### @file -# Component description file for Smbios Misc module. -# -# Copyright (c) 2018-2019, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D SmbiosBasic - FILE_GUID =3D 03ADF4A1-A27A-45E3-B211-3177C6C2E7ED - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D SmbiosBasicEntryPoint - -# -# The following information is for reference only and not required by the = build tools. -# -# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC -# - -[Sources] - SmbiosBasicEntryPoint.c - SmbiosBasic.h - Type0BiosVendorFunction.c - Type1SystemManufacturerFunction.c - Type2BaseBoardManufacturerFunction.c - Type3ChassisManufacturerFunction.c - Type32BootInformationFunction.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - AdvancedFeaturePkg/AdvancedFeaturePkg.dec - -[LibraryClasses] - PcdLib - MemoryAllocationLib - DevicePathLib - BaseMemoryLib - BaseLib - DebugLib - UefiBootServicesTableLib - UefiDriverEntryPoint - UefiLib - HobLib - -[Protocols] - gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED - gEfiVariableArchProtocolGuid - =20 -[Pcd] - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber - gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation - -[Depex] - gEfiSmbiosProtocolGuid AND - gEfiVariableArchProtocolGuid diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Smbios= BasicEntryPoint.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe= /SmbiosBasicEntryPoint.c deleted file mode 100644 index 8e68629ef6..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEn= tryPoint.c +++ /dev/null @@ -1,125 +0,0 @@ -/** @file - Smbios basic entry point. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "SmbiosBasic.h" - -EFI_STATUS -EFIAPI -BiosVendorFunction( - IN EFI_SMBIOS_PROTOCOL *Smbios - ); - -EFI_STATUS -EFIAPI -SystemManufacturerFunction( - IN EFI_SMBIOS_PROTOCOL *Smbios - ); - -EFI_STATUS -EFIAPI -BaseBoardManufacturerFunction( - IN EFI_SMBIOS_PROTOCOL *Smbios - ); - -EFI_STATUS -EFIAPI -ChassisManufacturerFunction( - IN EFI_SMBIOS_PROTOCOL *Smbios - ); - -EFI_STATUS -EFIAPI -BootInfoStatusFunction( - IN EFI_SMBIOS_PROTOCOL *Smbios - ); - -typedef -EFI_STATUS -(EFIAPI EFI_BASIC_SMBIOS_DATA_FUNCTION) ( - IN EFI_SMBIOS_PROTOCOL *Smbios - ); - -typedef struct { - EFI_BASIC_SMBIOS_DATA_FUNCTION *Function; -} EFI_BASIC_SMBIOS_DATA; - -EFI_BASIC_SMBIOS_DATA mSmbiosBasicDataFuncTable[] =3D { - {&BiosVendorFunction}, - {&SystemManufacturerFunction}, - {&BaseBoardManufacturerFunction}, - {&ChassisManufacturerFunction}, - {&BootInfoStatusFunction}, -}; - -/** - Standard EFI driver point. This driver parses the mSmbiosMiscDataTable - structure and reports any generated data using SMBIOS protocol. - - @param ImageHandle Handle for the image of this driver - @param SystemTable Pointer to the EFI System Table - - @retval EFI_SUCCESS The data was successfully stored. - -**/ -EFI_STATUS -EFIAPI -SmbiosBasicEntryPoint( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - UINTN Index; - EFI_STATUS EfiStatus; - EFI_SMBIOS_PROTOCOL *Smbios; - - EfiStatus =3D gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID**= )&Smbios); - if (EFI_ERROR(EfiStatus)) { - DEBUG((EFI_D_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStat= us)); - return EfiStatus; - } - - for (Index =3D 0; Index < sizeof(mSmbiosBasicDataFuncTable)/sizeof(mSmbi= osBasicDataFuncTable[0]); ++Index) { - EfiStatus =3D (*mSmbiosBasicDataFuncTable[Index].Function) (Smbios); - if (EFI_ERROR(EfiStatus)) { - DEBUG((EFI_D_ERROR, "Basic smbios store error. Index=3D%d, ReturnSt= atus=3D%r\n", Index, EfiStatus)); - return EfiStatus; - } - } - - return EfiStatus; -} - -/** - Add an SMBIOS record. - - @param Smbios The EFI_SMBIOS_PROTOCOL instance. - @param SmbiosHandle A unique handle will be assigned to the SM= BIOS record. - @param Record The data for the fixed portion of the SMBI= OS record. The format of the record is - determined by EFI_SMBIOS_TABLE_HEADER.Type= . The size of the formatted area is defined=20 - by EFI_SMBIOS_TABLE_HEADER.Length and eith= er followed by a double-null (0x0000) or=20 - a set of null terminated strings and a nul= l. - - @retval EFI_SUCCESS Record was added. - @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system= resources. - -**/ -EFI_STATUS -AddSmbiosRecord ( - IN EFI_SMBIOS_PROTOCOL *Smbios, - OUT EFI_SMBIOS_HANDLE *SmbiosHandle, - IN EFI_SMBIOS_TABLE_HEADER *Record - ) -{ - *SmbiosHandle =3D SMBIOS_HANDLE_PI_RESERVED; - return Smbios->Add ( - Smbios, - NULL, - SmbiosHandle, - Record - ); -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0B= iosVendorFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicD= xe/Type0BiosVendorFunction.c deleted file mode 100644 index 331efc8614..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVend= orFunction.c +++ /dev/null @@ -1,81 +0,0 @@ -/** @file - Smbios type 0. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "SmbiosBasic.h" - -/** - This function makes boot time changes to the contents of the - BiosVendor (Type 0). - - @retval EFI_SUCCESS All parameters were valid. - @retval EFI_UNSUPPORTED Unexpected RecordType value. - @retval EFI_INVALID_PARAMETER Invalid parameter was found. - -**/ -EFI_STATUS -EFIAPI -BiosVendorFunction( - IN EFI_SMBIOS_PROTOCOL *Smbios - ) -{ - EFI_STATUS Status;=20 - CHAR8 *VendorStr; - UINTN VendorStrLen; - CHAR8 *VersionStr; - UINTN VerStrLen; - CHAR8 *DateStr; - UINTN DateStrLen; - SMBIOS_TABLE_TYPE0 *SmbiosRecord; - SMBIOS_TABLE_TYPE0 *PcdSmbiosRecord; - EFI_SMBIOS_HANDLE SmbiosHandle; - UINTN StringOffset; - - PcdSmbiosRecord =3D PcdGetPtr (PcdSmbiosType0BiosInformation); - - VendorStr =3D PcdGetPtr (PcdSmbiosType0StringVendor); - VendorStrLen =3D AsciiStrLen (VendorStr); - ASSERT (VendorStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - VersionStr =3D PcdGetPtr (PcdSmbiosType0StringBiosVersion); - VerStrLen =3D AsciiStrLen (VersionStr); - ASSERT (VerStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - DateStr =3D PcdGetPtr (PcdSmbiosType0StringBiosReleaseDate); - DateStrLen =3D AsciiStrLen (DateStr); - ASSERT (DateStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - // - // Two zeros following the last string. - // - SmbiosRecord =3D AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE0) + VendorS= trLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1); - if (SmbiosRecord =3D=3D NULL) { - ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); - return EFI_OUT_OF_RESOURCES; - } - - CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE0)); - - SmbiosRecord->Hdr.Type =3D SMBIOS_TYPE_BIOS_INFORMATION; - SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE0); - SmbiosRecord->Hdr.Handle =3D 0; - - StringOffset =3D SmbiosRecord->Hdr.Length; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VendorStr, VendorStrLen); - StringOffset +=3D VendorStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen); - StringOffset +=3D VerStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, DateStr, DateStrLen); - - // - // Now we have got the full smbios record, call smbios protocol to add t= his record. - // - Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEA= DER *) SmbiosRecord); - - FreePool (SmbiosRecord); - return Status; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1S= ystemManufacturerFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/Smbi= osBasicDxe/Type1SystemManufacturerFunction.c deleted file mode 100644 index 2314d09695..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemMa= nufacturerFunction.c +++ /dev/null @@ -1,114 +0,0 @@ -/** @file - Smbios type 1. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "SmbiosBasic.h" - -/** - This function makes boot time changes to the contents of the - SystemManufacturer (Type 1). - - @retval EFI_SUCCESS All parameters were valid. - @retval EFI_UNSUPPORTED Unexpected RecordType value. - @retval EFI_INVALID_PARAMETER Invalid parameter was found. - -**/ -EFI_STATUS -EFIAPI -SystemManufacturerFunction( - IN EFI_SMBIOS_PROTOCOL *Smbios - ) -{ - EFI_STATUS Status;=20 - CHAR8 *ManufacturerStr; - CHAR8 *ProductNameStr; - CHAR8 *VersionStr; - CHAR8 *SerialNumberStr; - CHAR8 *SKUNumberStr; - CHAR8 *FamilyStr; - UINTN ManufacturerStrLen; - UINTN ProductNameStrLen; - UINTN VersionStrLen; - UINTN SerialNumberStrLen; - UINTN SKUNumberStrLen; - UINTN FamilyStrLen; - UINTN TableSize; - SMBIOS_TABLE_TYPE1 *PcdSmbiosRecord; - SMBIOS_TABLE_TYPE1 *SmbiosRecord; - EFI_SMBIOS_HANDLE SmbiosHandle; - UINTN StringOffset; - - PcdSmbiosRecord =3D PcdGetPtr (PcdSmbiosType1SystemInformation); - - ManufacturerStr =3D PcdGetPtr (PcdSmbiosType1StringManufacturer); - ManufacturerStrLen =3D AsciiStrLen (ManufacturerStr); - ASSERT (ManufacturerStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - ProductNameStr =3D PcdGetPtr (PcdSmbiosType1StringProductName); - ProductNameStrLen =3D AsciiStrLen (ProductNameStr); - ASSERT (ProductNameStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - VersionStr =3D PcdGetPtr (PcdSmbiosType1StringVersion); - VersionStrLen =3D AsciiStrLen (VersionStr); - ASSERT (VersionStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - SerialNumberStr =3D PcdGetPtr (PcdSmbiosType1StringSerialNumber); - SerialNumberStrLen =3D AsciiStrLen (SerialNumberStr); - ASSERT (SerialNumberStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - SKUNumberStr =3D PcdGetPtr (PcdSmbiosType1StringSKUNumber); - SKUNumberStrLen =3D AsciiStrLen (SKUNumberStr); - ASSERT (SKUNumberStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - FamilyStr =3D PcdGetPtr (PcdSmbiosType1StringFamily); - FamilyStrLen =3D AsciiStrLen (FamilyStr); - ASSERT (FamilyStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - // - // Create table size based on string lengths - // - TableSize =3D sizeof (SMBIOS_TABLE_TYPE1) + ManufacturerStrLen + 1 + Pro= ductNameStrLen + 1 + VersionStrLen + 1 + SerialNumberStrLen + 1 + SKUNumber= StrLen + 1 + FamilyStrLen + 1 + 1; - SmbiosRecord =3D AllocateZeroPool (TableSize); - if (SmbiosRecord =3D=3D NULL) { - ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); - return EFI_OUT_OF_RESOURCES; - } - - CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE1)); - - // - // Fill in Type 1 fields - // - - SmbiosRecord->Hdr.Type =3D SMBIOS_TYPE_SYSTEM_INFORMATION; - SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE1); - SmbiosRecord->Hdr.Handle =3D 0; - - // - // Add strings to bottom of data block - // - StringOffset =3D SmbiosRecord->Hdr.Length; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, Manufact= urerStrLen); - StringOffset +=3D ManufacturerStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductNameStr, ProductNa= meStrLen); - StringOffset +=3D ProductNameStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VersionStrLen= ); - StringOffset +=3D VersionStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNu= mberStrLen); - StringOffset +=3D SerialNumberStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberSt= rLen); - StringOffset +=3D SKUNumberStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, FamilyStr, FamilyStrLen); - - // - // Now we have got the full smbios record, call smbios protocol to add t= his record. - // - Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEA= DER *) SmbiosRecord); - - FreePool(SmbiosRecord); - return Status; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2B= aseBoardManufacturerFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/S= mbiosBasicDxe/Type2BaseBoardManufacturerFunction.c deleted file mode 100644 index 9193cb0be7..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoar= dManufacturerFunction.c +++ /dev/null @@ -1,131 +0,0 @@ -/** @file - Smbios type 2. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "SmbiosBasic.h" - -/** - This function makes boot time changes to the contents of the - BaseBoardManufacturer (Type 2). - - @retval EFI_SUCCESS All parameters were valid. - @retval EFI_UNSUPPORTED Unexpected RecordType value. - @retval EFI_INVALID_PARAMETER Invalid parameter was found. - -**/ -EFI_STATUS -EFIAPI -BaseBoardManufacturerFunction( - IN EFI_SMBIOS_PROTOCOL *Smbios - ) -{ - EFI_STATUS Status; - CHAR8 *ManufacturerStr; - CHAR8 *ProductStr; - CHAR8 *VersionStr; - CHAR8 *SerialNumberStr; - CHAR8 *AssertTagStr; - CHAR8 *ChassisStr; - UINTN ManuStrLen; - UINTN ProductStrLen; - UINTN VerStrLen; - UINTN AssertTagStrLen; - UINTN SerialNumStrLen; - UINTN ChassisStrLen; - EFI_SMBIOS_HANDLE SmbiosHandle; - SMBIOS_TABLE_TYPE2 *PcdSmbiosRecord; - SMBIOS_TABLE_TYPE2 *SmbiosRecord; - UINTN SourceSize; - UINTN TotalSize; - UINTN StringOffset; - - PcdSmbiosRecord =3D PcdGetPtr (PcdSmbiosType2BaseBoardInformation); - - // - // Get BoardManufacturer String. - // - ManufacturerStr =3D PcdGetPtr (PcdSmbiosType2StringManufacturer); - ManuStrLen =3D AsciiStrLen (ManufacturerStr); - ASSERT (ManuStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - // - // Get Board ProductName String. - // - ProductStr =3D PcdGetPtr (PcdSmbiosType2StringProductName); - ProductStrLen =3D AsciiStrLen (ProductStr); - ASSERT (ProductStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - // - // Get Board Version String. - // - VersionStr =3D PcdGetPtr (PcdSmbiosType2StringVersion); - VerStrLen =3D AsciiStrLen (VersionStr); - ASSERT (VerStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - // - // Get Board Serial Number String. - // - SerialNumberStr =3D PcdGetPtr (PcdSmbiosType2StringSerialNumber); - SerialNumStrLen =3D AsciiStrLen (SerialNumberStr); - ASSERT (SerialNumStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - // - // Get Board Asset Tag String. - // - AssertTagStr =3D PcdGetPtr (PcdSmbiosType2StringAssetTag); - AssertTagStrLen =3D AsciiStrLen (AssertTagStr); - ASSERT (AssertTagStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - // - // Get Board Chassis Location Tag String. - // - ChassisStr =3D PcdGetPtr (PcdSmbiosType2StringLocationInChassis); - ChassisStrLen =3D AsciiStrLen (ChassisStr); - ASSERT (ChassisStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - // - // Two zeros following the last string. - // - SourceSize =3D PcdGetSize (PcdSmbiosType2BaseBoardInformation); - TotalSize =3D SourceSize + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLe= n + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen + 1 + 1; - SmbiosRecord =3D AllocateZeroPool(TotalSize); - if (SmbiosRecord =3D=3D NULL) { - ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); - return EFI_OUT_OF_RESOURCES; - } - - CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize); - - SmbiosRecord->Hdr.Type =3D SMBIOS_TYPE_BASEBOARD_INFORMATION; - SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE2); - if (PcdSmbiosRecord->NumberOfContainedObjectHandles >=3D 2) { - SmbiosRecord->Hdr.Length +=3D (PcdSmbiosRecord->NumberOfContainedObjec= tHandles - 1) * sizeof(PcdSmbiosRecord->ContainedObjectHandles); - } - ASSERT(SourceSize >=3D SmbiosRecord->Hdr.Length); - SmbiosRecord->Hdr.Handle =3D 0; - - StringOffset =3D SmbiosRecord->Hdr.Length; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrL= en); - StringOffset +=3D ManuStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductStr, ProductStrLen= ); - StringOffset +=3D ProductStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen); - StringOffset +=3D VerStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNu= mStrLen); - StringOffset +=3D SerialNumStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagSt= rLen); - StringOffset +=3D AssertTagStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ChassisStr, ChassisStrLen= ); - - // - // Now we have got the full smbios record, call smbios protocol to add t= his record. - // - Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEA= DER *) SmbiosRecord); - - FreePool(SmbiosRecord); - return Status; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32= BootInformationFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/Smbios= BasicDxe/Type32BootInformationFunction.c deleted file mode 100644 index 87bfd045da..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInf= ormationFunction.c +++ /dev/null @@ -1,56 +0,0 @@ -/** @file - Smbios type 32. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "SmbiosBasic.h" - - -/** - This function makes boot time changes to the contents of the - BootInformation (Type 32). - - @retval EFI_SUCCESS All parameters were valid. - @retval EFI_UNSUPPORTED Unexpected RecordType value. - @retval EFI_INVALID_PARAMETER Invalid parameter was found. - -**/ -EFI_STATUS -EFIAPI -BootInfoStatusFunction( - IN EFI_SMBIOS_PROTOCOL *Smbios - ) -{ - EFI_STATUS Status; - EFI_SMBIOS_HANDLE SmbiosHandle; - SMBIOS_TABLE_TYPE32 *PcdSmbiosRecord; - SMBIOS_TABLE_TYPE32 *SmbiosRecord; - - PcdSmbiosRecord =3D PcdGetPtr (PcdSmbiosType32SystemBootInformation); - - // - // Two zeros following the last string. - // - SmbiosRecord =3D AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1); - if (SmbiosRecord =3D=3D NULL) { - ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); - return EFI_OUT_OF_RESOURCES; - } - - CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE32)); - - SmbiosRecord->Hdr.Type =3D EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION; - SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE32); - SmbiosRecord->Hdr.Handle =3D 0; - - // - // Now we have got the full smbios record, call smbios protocol to add t= his record. - // - Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEA= DER *) SmbiosRecord); - - FreePool(SmbiosRecord); - return Status; -} diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3C= hassisManufacturerFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/Smb= iosBasicDxe/Type3ChassisManufacturerFunction.c deleted file mode 100644 index 33732bc9ca..0000000000 --- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisM= anufacturerFunction.c +++ /dev/null @@ -1,125 +0,0 @@ -/** @file - Smbios type 3. - -Copyright (c) 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "SmbiosBasic.h" - -/** - This function makes boot time changes to the contents of the - ChassisManufacturer (Type 3). - - @retval EFI_SUCCESS All parameters were valid. - @retval EFI_UNSUPPORTED Unexpected RecordType value. - @retval EFI_INVALID_PARAMETER Invalid parameter was found. - -**/ -EFI_STATUS -EFIAPI -ChassisManufacturerFunction( - IN EFI_SMBIOS_PROTOCOL *Smbios - ) -{ - UINTN ManuStrLen; - UINTN VerStrLen; - UINTN AssertTagStrLen; - UINTN SerialNumStrLen; - UINTN SKUNumberStrLen; - EFI_STATUS Status; - CHAR8 *ManufacturerStr; - CHAR8 *VersionStr; - CHAR8 *SerialNumberStr; - CHAR8 *AssertTagStr; - CHAR8 *SKUNumberStr; - SMBIOS_TABLE_STRING *SKUNumberPtr; - EFI_SMBIOS_HANDLE SmbiosHandle; - SMBIOS_TABLE_TYPE3 *SmbiosRecord; - SMBIOS_TABLE_TYPE3 *PcdSmbiosRecord; - UINTN SourceSize; - UINTN TotalSize; - UINTN StringOffset; - - PcdSmbiosRecord =3D PcdGetPtr (PcdSmbiosType3SystemEnclosureChassis); - - // - // Get ChassisManufacturer String. - // - ManufacturerStr =3D PcdGetPtr (PcdSmbiosType3StringManufacturer); - ManuStrLen =3D AsciiStrLen (ManufacturerStr); - ASSERT (ManuStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - // - // Get ChassisVersion String. - // - VersionStr =3D PcdGetPtr (PcdSmbiosType3StringVersion); - VerStrLen =3D AsciiStrLen (VersionStr); - ASSERT (VerStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - // - // Get ChassisSerialNumber String. - // - SerialNumberStr =3D PcdGetPtr (PcdSmbiosType3StringSerialNumber); - SerialNumStrLen =3D AsciiStrLen (SerialNumberStr); - ASSERT (SerialNumStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - // - // Get ChassisAssetTag String. - // - AssertTagStr =3D PcdGetPtr (PcdSmbiosType3StringAssetTag); - AssertTagStrLen =3D AsciiStrLen (AssertTagStr); - ASSERT (AssertTagStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - // - // Get ChassisSKUNumber String. - // - SKUNumberStr =3D PcdGetPtr (PcdSmbiosType3StringSKUNumber); - SKUNumberStrLen =3D AsciiStrLen (SKUNumberStr); - ASSERT (SKUNumberStrLen <=3D SMBIOS_STRING_MAX_LENGTH); - - // - // Two zeros following the last string. - // - SourceSize =3D PcdGetSize(PcdSmbiosType3SystemEnclosureChassis); - TotalSize =3D SourceSize + sizeof(SMBIOS_TABLE_STRING) + ManuStrLen + 1 = + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + SKUNumberStrL= en + 1 + 1; - SmbiosRecord =3D AllocateZeroPool(TotalSize); - if (SmbiosRecord =3D=3D NULL) { - ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); - return EFI_OUT_OF_RESOURCES; - } - - CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize); - - SmbiosRecord->Hdr.Type =3D EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE; - SmbiosRecord->Hdr.Length =3D OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedEle= ments) + sizeof(SMBIOS_TABLE_STRING); - if (PcdSmbiosRecord->ContainedElementCount >=3D 1) { - SmbiosRecord->Hdr.Length +=3D PcdSmbiosRecord->ContainedElementCount *= PcdSmbiosRecord->ContainedElementRecordLength; - } - SmbiosRecord->Hdr.Handle =3D 0; - - if ((PcdSmbiosRecord->ContainedElementCount =3D=3D 0) || (SourceSize < (= UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length)) { - SKUNumberPtr =3D (SMBIOS_TABLE_STRING *)((UINTN)SmbiosRecord + SmbiosR= ecord->Hdr.Length - sizeof(SMBIOS_TABLE_STRING)); - *SKUNumberPtr =3D 5; - } - - StringOffset =3D SmbiosRecord->Hdr.Length; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrL= en); - StringOffset +=3D ManuStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen); - StringOffset +=3D VerStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNu= mStrLen); - StringOffset +=3D SerialNumStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagSt= rLen); - StringOffset +=3D AssertTagStrLen + 1; - CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberSt= rLen); - - // - // Now we have got the full smbios record, call smbios protocol to add t= his record. - // - Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEA= DER *) SmbiosRecord); - - FreePool(SmbiosRecord); - return Status; -} diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl b/Platf= orm/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl deleted file mode 100644 index cbfe085b56..0000000000 --- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl +++ /dev/null @@ -1,103 +0,0 @@ -/** @file - Acpi Debug ASL code. - -Copyright (c) 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -DefinitionBlock ( - "AcpiDebug.aml", - "SSDT", - 2, - "Intel ", - "ADebTabl", - 0x1000 - ) -{ - Scope(\) - { - // - // These pointers are patched during POST. - // - Name (DPTR, 0x80000000) // Address of Acpi debug memory buffer, fixed = up during POST - Name (EPTR, 0x80000000) // End of Acpi debug memory buffer, fixed up d= uring POST - Name (CPTR, 0x80000000) // Current pointer used as an index into the b= uffer(starts after the Acpi Debug head), fixed up during POST - - // - // Use a Mutex to prevent multiple calls from simutaneously writing to= the same memory. - // - Mutex (MMUT, 0) - - // - // Operational region for SMI port access - // - OperationRegion (ADBP, SystemIO, 0xB2, 2) - Field (ADBP, ByteAcc, NoLock, Preserve) - { - B2PT, 8, - B3PT, 8, - } - - // - // Write a string to a memory buffer - // - Method (MDBG, 1, Serialized) - { - OperationRegion (ADHD, SystemMemory, DPTR, 32) // Operation region f= or Acpi Debug buffer first 0x20 bytes - Field (ADHD, ByteAcc, NoLock, Preserve) - { - Offset (0x0), - ASIG, 128, // 16 bytes is Signature - Offset (0x10), - ASIZ, 32, // 4 bytes is buffer size - ACHP, 32, // 4 bytes is current head pointer, normally is DP= TR + 0x20, - // if there's SMM handler to print, then it's th= e starting of the info hasn't been printed yet. - ACTP, 32, // 4 bytes is current tail pointer, is the same as= CPTR - SMIN, 8, // 1 byte of SMI Number for trigger callback - WRAP, 8, // 1 byte of wrap status - SMMV, 8, // 1 byte of SMM version status - TRUN, 8 // 1 byte of truncate status - } - - Store (Acquire (MMUT, 1000), Local0) // save Acquire result so we ca= n check for Mutex acquired - If (LEqual (Local0, Zero)) // check for Mutex acquired - { - OperationRegion (ABLK, SystemMemory, CPTR, 32) // Operation region= to allow writes to ACPI debug buffer - Field (ABLK, ByteAcc, NoLock, Preserve) - { - Offset (0x0), - AAAA, 256 // 32 bytes is max size for string or data - } - ToHexString (Arg0, Local1) // convert argument to Hexadecimal Stri= ng - Store (0, TRUN) - If (LGreaterEqual (SizeOf (Local1), 32)) - { - Store (1, TRUN) // the input from ASL >=3D 32 - } - Mid (Local1, 0, 31, AAAA) // extract the input to current buffer - - Add (CPTR, 32, CPTR) // advance current pointer to next string loc= ation in memory buffer - If (LGreaterEqual (CPTR, EPTR) ) // check for end of 64kb Acpi deb= ug buffer - { - Add (DPTR, 32, CPTR) // wrap around to beginning of buffer if th= e end has been reached - Store (1, WRAP) - } - Store (CPTR, ACTP) - - If (SMMV) - { - // - // Trigger the SMI to print - // - Store (SMIN, B2PT) - } - Release (MMUT) - } - - Return (Local0) // return error code indicating whether Mutex was ac= quired - } - - } // End Scope -} // End SSDT - diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c b/Platfor= m/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c deleted file mode 100644 index f99d80f687..0000000000 --- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c +++ /dev/null @@ -1,523 +0,0 @@ -/** @file - Acpi Debug driver code. - -Copyright (c) 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define ACPI_DEBUG_STR "INTEL ACPI DEBUG" - -// -// ASL NAME structure -// -#pragma pack(1) -typedef struct { - UINT8 NameOp; // Byte [0]=3D0x08:NameOp. - UINT32 NameString; // Byte [4:1]=3DName of object. - UINT8 DWordPrefix; // Byte [5]=3D0x0C:DWord Prefix. - UINT32 Value; // 0 ; Value of named object. -} NAME_LAYOUT; -#pragma pack() - -#pragma pack(1) -typedef struct { - UINT8 Signature[16]; // "INTEL ACPI DEBUG" - UINT32 BufferSize; // Total size of Acpi Debug buffer including h= eader structure - UINT32 Head; // Current buffer pointer for SMM to print out - UINT32 Tail; // Current buffer pointer for ASL to input - UINT8 SmiTrigger; // Value to trigger the SMI via B2 port - UINT8 Wrap; // If current Tail < Head - UINT8 SmmVersion; // If SMM version - UINT8 Truncate; // If the input from ASL > MAX_BUFFER_SIZE -} ACPI_DEBUG_HEAD; -#pragma pack() - -#define AD_SIZE sizeof (ACPI_DEBUG_HEAD) // This is 0x20 - -#define MAX_BUFFER_SIZE 32 - -UINT32 mBufferEnd =3D 0; -ACPI_DEBUG_HEAD *mAcpiDebug =3D NULL; - -EFI_SMM_SYSTEM_TABLE2 *mSmst =3D NULL; - -/** - Patch and load ACPI table. - - @param[in] AcpiDebugAddress Address of Acpi debug memory buffer. - @param[in] BufferIndex Index that starts after the Acpi Debug hea= d. - @param[in] BufferEnd End of Acpi debug memory buffer. - -**/ -VOID -PatchAndLoadAcpiTable ( - IN ACPI_DEBUG_HEAD *AcpiDebugAddress, - IN UINT32 BufferIndex, - IN UINT32 BufferEnd - ) -{ - EFI_STATUS Status; - EFI_ACPI_TABLE_PROTOCOL *AcpiTable; - UINTN Size; - EFI_ACPI_DESCRIPTION_HEADER *TableHeader; - UINTN TableKey; - UINT8 *CurrPtr; - UINT32 *Signature; - NAME_LAYOUT *NamePtr; - UINT8 UpdateCounter; - - Status =3D GetSectionFromFv ( - &gEfiCallerIdGuid, - EFI_SECTION_RAW, - 0, - (VOID **) &TableHeader, - &Size - ); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return; - } - - // - // This is Acpi Debug SSDT. Acpi Debug should be enabled if we reach her= e so load the table. - // - ASSERT (((EFI_ACPI_DESCRIPTION_HEADER *) TableHeader)->OemTableId =3D=3D= SIGNATURE_64 ('A', 'D', 'e', 'b', 'T', 'a', 'b', 'l')); - - // - // Patch some pointers for the ASL code before loading the SSDT. - // - - // - // Count pointer updates, so we can stop after all three pointers are pa= tched. - // - UpdateCounter =3D 1; - for (CurrPtr =3D (UINT8 *) TableHeader; CurrPtr <=3D ((UINT8 *) TableHea= der + TableHeader->Length) && UpdateCounter < 4; CurrPtr++) { - Signature =3D (UINT32 *) (CurrPtr + 1); - // - // patch DPTR (address of Acpi debug memory buffer) - // - if ((*CurrPtr =3D=3D AML_NAME_OP) && *Signature =3D=3D SIGNATURE_32 ('= D', 'P', 'T', 'R')) { - NamePtr =3D (NAME_LAYOUT *) CurrPtr; - NamePtr->Value =3D (UINT32) (UINTN) AcpiDebugAddress; - UpdateCounter++; - } - // - // patch EPTR (end of Acpi debug memory buffer) - // - if ((*CurrPtr =3D=3D AML_NAME_OP) && *Signature =3D=3D SIGNATURE_32 ('= E', 'P', 'T', 'R')) { - NamePtr =3D (NAME_LAYOUT *) CurrPtr; - NamePtr->Value =3D BufferEnd; - UpdateCounter++; - } - // - // patch CPTR (used as an index that starts after the Acpi Debug head) - // - if ((*CurrPtr =3D=3D AML_NAME_OP) && *Signature =3D=3D SIGNATURE_32 ('= C', 'P', 'T', 'R')) { - NamePtr =3D (NAME_LAYOUT *) CurrPtr; - NamePtr->Value =3D BufferIndex; - UpdateCounter++; - } - } - - // - // Add the table - // - Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID = **)&AcpiTable); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - goto Done; - } - - TableKey =3D 0; - Status =3D AcpiTable->InstallAcpiTable ( - AcpiTable, - TableHeader, - Size, - &TableKey - ); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - goto Done; - } - -Done: - gBS->FreePool (TableHeader); - return ; -} - -/** - Allocate Acpi Debug memory. - - @param[out] BufferSize Pointer to Acpi debug memory buffer size. - - @return Address of Acpi debug memory buffer. 0 if PcdAcpiDebugEnable is = FALSE. - -**/ -EFI_PHYSICAL_ADDRESS -AllocateAcpiDebugMemory ( - OUT UINT32 *BufferSize - ) -{ - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS AcpiDebugAddress; - UINTN PagesNum; - - AcpiDebugAddress =3D 0; - *BufferSize =3D 0; - - if (PcdGetBool (PcdAcpiDebugEnable)) { - // - // Reserve memory to store Acpi Debug data. - // - AcpiDebugAddress =3D 0xFFFFFFFF; - PagesNum =3D EFI_SIZE_TO_PAGES (PcdGet32 (PcdAcpiDebugBufferSize)); - Status =3D gBS->AllocatePages ( - AllocateMaxAddress, - EfiReservedMemoryType, - PagesNum, - &AcpiDebugAddress - ); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return 0; - } - - DEBUG ((DEBUG_INFO, "AcpiDebugAddress - 0x%08x\n", AcpiDebugAddress)); - - Status =3D PcdSet32S (PcdAcpiDebugAddress, (UINT32) AcpiDebugAddress); - ASSERT_EFI_ERROR (Status); - - if (EFI_ERROR (Status)) { - gBS->FreePages (AcpiDebugAddress, PagesNum); - return 0; - } - - *BufferSize =3D PcdGet32 (PcdAcpiDebugBufferSize); - } - - return AcpiDebugAddress; -} - -/** - Acpi Debug EndOfDxe notification. - - @param[in] Event Event whose notification function is being invoked. - @param[in] Context Pointer to the notification function's context. - -**/ -VOID -EFIAPI -AcpiDebugEndOfDxeNotification ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - UINT32 BufferSize; - UINT32 BufferIndex; - - mAcpiDebug =3D (ACPI_DEBUG_HEAD *) (UINTN) AllocateAcpiDebugMemory (&Buf= ferSize); - if (mAcpiDebug !=3D NULL) { - // - // Init ACPI DEBUG buffer to lower case 'x'. - // - SetMem ((VOID *) mAcpiDebug, BufferSize, 0x78); - - // - // Clear header of AD_SIZE bytes. - // - ZeroMem ((VOID *) mAcpiDebug, AD_SIZE); - - // - // Write a signature to the first line of the buffer, "INTEL ACPI DEBU= G". - // - CopyMem ((VOID *) mAcpiDebug, ACPI_DEBUG_STR, sizeof (ACPI_DEBUG_STR) = - 1); - - BufferIndex =3D (UINT32) (UINTN) mAcpiDebug; - mBufferEnd =3D BufferIndex + BufferSize; - - // - // Leave the Index after the Acpi Debug head. - // - BufferIndex +=3D AD_SIZE; - - // - // Patch and Load the SSDT ACPI Tables. - // - PatchAndLoadAcpiTable (mAcpiDebug, BufferIndex, mBufferEnd); - - mAcpiDebug->Head =3D BufferIndex; - mAcpiDebug->Tail =3D BufferIndex; - mAcpiDebug->BufferSize =3D BufferSize; - } - - // - // Close event, so it will not be invoked again. - // - gBS->CloseEvent (Event); - - return ; -} - -/** - Initialize ACPI Debug. - - @param[in] ImageHandle The firmware allocated handle for the EFI imag= e. - @param[in] SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The driver initializes correctly. - -**/ -EFI_STATUS -EFIAPI -InitializeAcpiDebugDxe ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - EFI_EVENT EndOfDxeEvent; - - // - // Register EndOfDxe notification - // that point could ensure the Acpi Debug related PCDs initialized. - // - Status =3D gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - TPL_CALLBACK, - AcpiDebugEndOfDxeNotification, - NULL, - &gEfiEndOfDxeEventGroupGuid, - &EndOfDxeEvent - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - Software SMI callback for ACPI Debug which is called from ACPI method. - - @param[in] DispatchHandle The unique handle assigned to this han= dler by SmiHandlerRegister(). - @param[in] Context Points to an optional handler context = which was specified when the - handler was registered. - @param[in, out] CommBuffer A pointer to a collection of data in m= emory that will - be conveyed from a non-SMM environment= into an SMM environment. - @param[in, out] CommBufferSize The size of the CommBuffer. - - @retval EFI_SUCCESS The interrupt was handled successfully. - -**/ -EFI_STATUS -EFIAPI -AcpiDebugSmmCallback ( - IN EFI_HANDLE DispatchHandle, - IN CONST VOID *Context, - IN OUT VOID *CommBuffer, - IN OUT UINTN *CommBufferSize - ) -{ - UINT8 Buffer[MAX_BUFFER_SIZE]; - - // - // Validate the fields in mAcpiDebug to ensure there is no harm to SMI h= andler. - // mAcpiDebug is below 4GB and the start address of whole buffer. - // - if ((mAcpiDebug->BufferSize !=3D (mBufferEnd - (UINT32) (UINTN) mAcpiDeb= ug)) || - (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) || - (mAcpiDebug->Head > mBufferEnd) || - (mAcpiDebug->Tail < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) || - (mAcpiDebug->Tail > mBufferEnd)) { - // - // If some fields in mAcpiDebug are invaid, return directly. - // - return EFI_SUCCESS; - } - - if (!(BOOLEAN)mAcpiDebug->Wrap && ((mAcpiDebug->Head >=3D (UINT32) ((UIN= TN) mAcpiDebug + AD_SIZE)) - && (mAcpiDebug->Head < mAcpiDebug->Tail))){ - // - // If curent ----- buffer + 020 - // ... - // ... Head - // ... Data for SMM print - // ... Tail - // ... Vacant for ASL input - // ----- buffer end - // - // skip NULL block - // - while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head =3D=3D '\0') && (mAcpiDebu= g->Head < mAcpiDebug->Tail)) { - mAcpiDebug->Head ++; - } - - if (mAcpiDebug->Head < mAcpiDebug->Tail) { - ZeroMem (Buffer, MAX_BUFFER_SIZE); - AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *) (UINTN) = mAcpiDebug->Head, MAX_BUFFER_SIZE - 1); - - DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcpiD= ebug->Truncate ? "..." : "")); - mAcpiDebug->Head +=3D MAX_BUFFER_SIZE; - - if (mAcpiDebug->Head >=3D (mAcpiDebug->Tail)) { - // - // When head =3D=3D tail, we do nothing in handler. - // - mAcpiDebug->Head =3D mAcpiDebug->Tail; - } - } - } else if ((BOOLEAN) mAcpiDebug->Wrap && ((mAcpiDebug->Head > mAcpiDebug= ->Tail) - && (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->Buff= erSize)))){ - // - // If curent ----- buffer + 020 - // ... Tail - // ... Vacant for ASL input - // ... Head - // ... Data for SMM print - // ----- buffer end - // - while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head =3D=3D '\0') && (mAcpiDebu= g->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize))) { - mAcpiDebug->Head ++; - } - if (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->Buff= erSize)){ - ZeroMem (Buffer, MAX_BUFFER_SIZE); - AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *) (UINTN) = mAcpiDebug->Head, MAX_BUFFER_SIZE - 1); - DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcpiD= ebug->Truncate ? "..." : "")); - mAcpiDebug->Head +=3D MAX_BUFFER_SIZE; - - if (mAcpiDebug->Head >=3D (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug-= >BufferSize)) { - // - // We met end of buffer. - // - mAcpiDebug->Wrap =3D 0; - mAcpiDebug->Head =3D (UINT32) ((UINTN) mAcpiDebug + AD_SIZE); - } - } - } - - return EFI_SUCCESS; -} - -/** - Acpi Debug SmmEndOfDxe notification. - - @param[in] Protocol Points to the protocol's unique identifier. - @param[in] Interface Points to the interface instance. - @param[in] Handle The handle on which the interface was installed. - - @retval EFI_SUCCESS Notification runs successfully. - - **/ -EFI_STATUS -EFIAPI -AcpiDebugSmmEndOfDxeNotification ( - IN CONST EFI_GUID *Protocol, - IN VOID *Interface, - IN EFI_HANDLE Handle - ) -{ - EFI_STATUS Status; - EFI_SMM_SW_DISPATCH2_PROTOCOL *SwDispatch; - EFI_SMM_SW_REGISTER_CONTEXT SwContext; - EFI_HANDLE SwHandle; - - AcpiDebugEndOfDxeNotification (NULL, NULL); - - if (mAcpiDebug !=3D NULL) { - // - // Get the Sw dispatch protocol and register SMI callback function. - // - SwDispatch =3D NULL; - Status =3D mSmst->SmmLocateProtocol (&gEfiSmmSwDispatch2ProtocolGuid, = NULL, (VOID **) &SwDispatch); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return Status; - } - - SwContext.SwSmiInputValue =3D (UINTN) -1; - Status =3D SwDispatch->Register (SwDispatch, AcpiDebugSmmCallback, &Sw= Context, &SwHandle); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return Status; - } - - mAcpiDebug->SmiTrigger =3D (UINT8) SwContext.SwSmiInputValue; - mAcpiDebug->SmmVersion =3D 1; - } - - return EFI_SUCCESS; -} - -/** - Initialize ACPI Debug. - - @param[in] ImageHandle The firmware allocated handle for the EFI imag= e. - @param[in] SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The driver initializes correctly. - -**/ -EFI_STATUS -EFIAPI -InitializeAcpiDebugSmm ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - VOID *Registration; - EFI_SMM_BASE2_PROTOCOL *SmmBase2; - BOOLEAN InSmm; - - Status =3D gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID *= *) &SmmBase2); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return Status; - } - - Status =3D SmmBase2->InSmm (SmmBase2, &InSmm); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return Status; - } - - ASSERT (InSmm); - - if (!InSmm) { - return EFI_UNSUPPORTED; - } - - Status =3D SmmBase2->GetSmstLocation (SmmBase2, &mSmst); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Register SmmEndOfDxe notification - // that point could ensure the Acpi Debug related PCDs initialized. - // - Registration =3D NULL; - Status =3D mSmst->SmmRegisterProtocolNotify ( - &gEfiSmmEndOfDxeProtocolGuid, - AcpiDebugSmmEndOfDxeNotification, - &Registration - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf b/Pl= atform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf deleted file mode 100644 index 7473126b11..0000000000 --- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf +++ /dev/null @@ -1,57 +0,0 @@ -### @file -# Component description file for Acpi debug module. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D AcpiDebugDxe - FILE_GUID =3D EC98FF95-242C-4513-B1BC-69FA24111C58 - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D InitializeAcpiDebugDxe -# -# The following information is for reference only and not required by the = build tools. -# -# VALID_ARCHITECTURES =3D IA32 X64 IPF -# - -[LibraryClasses] - BaseLib - BaseMemoryLib - UefiBootServicesTableLib - UefiDriverEntryPoint - DebugLib - PcdLib - DxeServicesLib - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - DebugFeaturePkg/DebugFeaturePkg.dec - -[Pcd] - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable ## CONSUMES - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize ## CONSUMES - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress ## PRODUCES - -[Sources] - AcpiDebug.c - AcpiDebug.asl - -[Protocols] - gEfiAcpiTableProtocolGuid ## CONSUMES - gEfiSmmBase2ProtocolGuid ## CONSUMES # only for SMM version - gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES # only for SMM version - gEfiSmmEndOfDxeProtocolGuid ## NOTIFY # only for SMM version - -[Guids] - gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event - -[Depex] - gEfiAcpiTableProtocolGuid - diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf b/Pl= atform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf deleted file mode 100644 index 679f9eb014..0000000000 --- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf +++ /dev/null @@ -1,59 +0,0 @@ -### @file -# Component description file for Acpi Debug module. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D AcpiDebugSmm - FILE_GUID =3D 9069C144-0A7E-41ef-9C07-418BCA9BF939 - MODULE_TYPE =3D DXE_SMM_DRIVER - VERSION_STRING =3D 1.0 - PI_SPECIFICATION_VERSION =3D 0x0001000A - ENTRY_POINT =3D InitializeAcpiDebugSmm -# -# The following information is for reference only and not required by the = build tools. -# -# VALID_ARCHITECTURES =3D IA32 X64 IPF -# - -[LibraryClasses] - BaseLib - BaseMemoryLib - UefiBootServicesTableLib - UefiDriverEntryPoint - DebugLib - PcdLib - DxeServicesLib - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - DebugFeaturePkg/DebugFeaturePkg.dec - -[Pcd] - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable ## CONSUMES - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize ## CONSUMES - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress ## PRODUCES - -[Sources] - AcpiDebug.c - AcpiDebug.asl - -[Protocols] - gEfiAcpiTableProtocolGuid ## CONSUMES - gEfiSmmBase2ProtocolGuid ## CONSUMES - gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES - gEfiSmmEndOfDxeProtocolGuid ## NOTIFY - -[Guids] - gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event # only for DXE ve= rsion - -[Depex] - gEfiAcpiTableProtocolGuid AND - gEfiSmmBase2ProtocolGuid AND - gEfiSmmSwDispatch2ProtocolGuid diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt b/Platform= /Intel/DebugFeaturePkg/AcpiDebug/Readme.txt deleted file mode 100644 index 71284ec77f..0000000000 --- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt +++ /dev/null @@ -1,31 +0,0 @@ -ACPI Debug feature - an alternative to Port 80 and WinDBG - -How it works: - Acpi Debug does this: - Opens a 64kb memory buffer during POST. - Patches the buffer address in SSDT ASL code. - Save the address in gAdvancedFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddres= s for user reference. - Write strings or numbers to the buffer from ASL code with the ADBG metho= d. - -How to use it: - 1. Enable it by set gAdvancedFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable= to TRUE. - 2. The ACPI ASL code must be instrumented with the debug method. - Strings up to 32 characters (shorter strings will be padded with Zero= 's, longer strings will be truncated) - Examples: - ADBG("This is a test.") - ADBG(Arg0) - - DXE version: The bios engineer will read the strings from the buffer on = the target machine with read/write memory utility. - SMM version: Check debug serial that would show debug strings. - - Sample code for ADBG: - External (MDBG, MethodObj) - Method (ADBG, 1, Serialized) - { - If (CondRefOf (MDBG)) // Check if ACPI Debug SSDT is loaded - { - Return (MDBG (Arg0)) - } - Return (0) - } - diff --git a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec b/Platform/= Intel/DebugFeaturePkg/DebugFeaturePkg.dec deleted file mode 100644 index 37ebe6da4d..0000000000 --- a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dec +++ /dev/null @@ -1,66 +0,0 @@ -## @file -# This package provides the modules that build for debug feature. -# This DebugFeaturePkg should only depend on EDKII Core packages and MinPl= atformPkg. -# -# The DEC files are used by the utilities that parse DSC and -# INF files to generate AutoGen.c and AutoGen.h files -# for the build infrastructure. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - DEC_SPECIFICATION =3D 0x00010005 - PACKAGE_NAME =3D DebugFeaturePkg - PACKAGE_GUID =3D 58B6F2BB-A94F-4EB9-89DA-2F06ED59CE39 - PACKAGE_VERSION =3D 0.1 - -[Includes] - Include - -[LibraryClasses] - ## @libraryclass Provide capability to get/set USB3 debug port param= eter. - Usb3DebugPortParameterLib|Include/Library/Usb3DebugPortParameterLib.h - - ## @libraryclass Provide common USB3 debug port functions. - Usb3DebugPortLib|Include/Library/Usb3DebugPortLib.h - -[Guids] - gDebugFeaturePkgTokenSpaceGuid =3D { 0xdbf3ac70, 0x3f73, 0x40aa, { = 0xbd, 0xd6, 0xac, 0xf2, 0x1a, 0x1b, 0x2f, 0xe2 } } - -[PcdsFixedAtBuild] - ## These PCD specify XHCI controller Bus/Device/Function, which are used= to enable - # XHCI debug device. - gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciBus|0x00|UINT8|0x00000001 - gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciDev|0x14|UINT8|0x00000002 - gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciFunc|0x00|UINT8|0x00000003 - gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress|0xFEA10000|UINT= 32|0x00000004 - - ## This PCD specifies the wait timeout value in microsecond if USB debug= cable is detected but host not connected. - # Default timeout value is 2000000 microseconds. - # If user does not want system stall for long time, it can be set to sm= all value. - gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout|2000000|UINT64|0x0= 0000005 - - ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes sp= ace. - gDebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortBusIndex|0x59|UINT8|0x000= 00006 - ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes sp= ace. - gDebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortDeviceIndex|0x5A|UINT8|0x= 00000007 - ## This PCD sepcifies the start index in CMOS, it will occupy 1 bytes sp= ace. - gDebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugPortFunctionIndex|0x5B|UINT8|= 0x00000008 - -[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx] - ## This PCD specifies AcpiDebug feature is enable/disable. - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable|FALSE|BOOLEAN|0x000000= 09 - ## This PCD specifies AcpiDebug buffer size. - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize|0x10000|UINT32|0x0= 000000A - -[PcdsDynamic, PcdsDynamicEx] - ## This PCD specifies AcpiDebug buffer address - gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress|0|UINT32|0x0000000B - -[PcdsFeatureFlag] - ## This PCD specifies whether StatusCode is reported via USB3 Serial por= t. - gDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseUsb3Serial|TRUE|BOOLEAN|0= x0000000C diff --git a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc b/Platform/= Intel/DebugFeaturePkg/DebugFeaturePkg.dsc deleted file mode 100644 index efe705bd76..0000000000 --- a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc +++ /dev/null @@ -1,120 +0,0 @@ -## @file -# This package provides the modules that build for debug feature. -# This package should only depend on EDKII Core packages and MinPlatformPk= g. -# -# The DEC files are used by the utilities that parse DSC and -# INF files to generate AutoGen.c and AutoGen.h files -# for the build infrastructure. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - PLATFORM_NAME =3D DebugFeaturePkg - PLATFORM_GUID =3D 3A0DBEF4-3C16-4F6B-8B55-BABB260D30B9 - PLATFORM_VERSION =3D 0.1 - DSC_SPECIFICATION =3D 0x00010005 - OUTPUT_DIRECTORY =3D Build/DebugFeaturePkg - SUPPORTED_ARCHITECTURES =3D IA32|X64 - BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT - SKUID_IDENTIFIER =3D DEFAULT - -[LibraryClasses] - ####################################### - # Edk2 Packages - ####################################### - BaseLib|MdePkg/Library/BaseLib/BaseLib.inf - BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf - DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf - PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf - TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplat= e.inf - UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf - UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf - UefiLib|MdePkg/Library/UefiLib/UefiLib.inf - UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/U= efiRuntimeServicesTableLib.inf - -[LibraryClasses.common.PEIM] - ####################################### - # Edk2 Packages - ####################################### - HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf - MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf - PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf - -[LibraryClasses.common.DXE_DRIVER] - ####################################### - # Edk2 Packages - ####################################### - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf - -[LibraryClasses.common.UEFI_DRIVER] - ####################################### - # Edk2 Packages - ####################################### - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf - -[LibraryClasses.common.DXE_RUNTIME_DRIVER] - ####################################### - # Edk2 Packages - ####################################### - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf - UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf - -[LibraryClasses.common.DXE_SMM_DRIVER] - ####################################### - # Edk2 Packages - ####################################### - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf - MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAlloc= ationLib.inf - SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableL= ib.inf - -##########################################################################= ######################### -# -# Components Section - list of the modules and components that will be pro= cessed by compilation -# tools and the EDK II tools to generate PE32/PE32+/C= off image files. -# -# Note: The EDK II DSC file is not used to specify how compiled binary ima= ges get placed -# into firmware volume images. This section is just a list of module= s to compile from -# source into UEFI-compliant binaries. -# It is the FDF file that contains information on combining binary f= iles into firmware -# volume images, whose concept is beyond UEFI and is described in PI= specification. -# Binary modules do not need to be listed in this section, as they s= hould be -# specified in the FDF file. For example: Shell binary (Shell_Full.e= fi), FAT binary (Fat.efi), -# Logo (Logo.bmp), and etc. -# There may also be modules listed in this section that are not requ= ired in the FDF file, -# When a module listed here is excluded from FDF file, then UEFI-com= pliant binary will be -# generated for it, but the binary will not be put into any firmware= volume. -# -##########################################################################= ######################### - -[Components] - ####################################### - # Debug Feature Package - ####################################### - - # Add library instances here that are not included in package components= and should be tested - # in the package build. - DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxe.inf - DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibDxeIoMmu.inf - DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibNull.inf - DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPei.inf - DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPortLibPeiIoMmu.inf - DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParame= terLibPcd.inf - - # Add components here that should be included in the package build. - DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf - DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf - -[BuildOptions] - *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortLi= b.h b/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h deleted file mode 100644 index 0bee2b63dd..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortLib.h +++ /dev/null @@ -1,71 +0,0 @@ -/** @file - This library class provides common USB3 debug port functions. - - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef __USB3_DEBUG_PORT_LIB__ -#define __USB3_DEBUG_PORT_LIB__ - -/** - Initialize the USB3 debug port hardware. - - If no initialization is required, then return RETURN_SUCCESS. - If the serial device was successfully initialized, then return RETURN_SU= CCESS. - If the serial device could not be initialized, then return RETURN_DEVICE= _ERROR. - - @retval RETURN_SUCCESS The serial device was initialized. - @retval RETURN_DEVICE_ERROR The serial device could not be initialized. - -**/ -RETURN_STATUS -EFIAPI -Usb3DebugPortInitialize ( - VOID - ); - -/** - Write data from buffer to USB3 debug port. - - Writes NumberOfBytes data bytes from Buffer to the serial device. - The number of bytes actually written to the serial device is returned. - If the return value is less than NumberOfBytes, then the write operation= failed. - If Buffer is NULL, then ASSERT(). - If NumberOfBytes is zero, then return 0. - - @param Buffer Pointer to the data buffer to be written. - @param NumberOfBytes Number of bytes to written to the serial device. - - @retval 0 NumberOfBytes is 0. - @retval >0 The number of bytes written to the serial devic= e. - If this value is less than NumberOfBytes, then = the read operation failed. - -**/ -UINTN -EFIAPI -Usb3DebugPortWrite ( - IN UINT8 *Buffer, - IN UINTN NumberOfBytes - ); - - -/** - Polls a USB3 debug port to see if there is any data waiting to be read. - - Polls a serial device to see if there is any data waiting to be read. - If there is data waiting to be read from the serial device, then TRUE is= returned. - If there is no data waiting to be read from the serial device, then FALS= E is returned. - - @retval TRUE Data is waiting to be read from the serial devi= ce. - @retval FALSE There is no data waiting to be read from the se= rial device. - -**/ -BOOLEAN -EFIAPI -Usb3DebugPortPoll ( - VOID - ); - -#endif diff --git a/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortPa= rameterLib.h b/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPort= ParameterLib.h deleted file mode 100644 index 167c607e9f..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Include/Library/Usb3DebugPortParameter= Lib.h +++ /dev/null @@ -1,56 +0,0 @@ -/** @file - This library class provides capability to get/set usb3 debug port parame= ter. - - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef __USB3_DEBUG_PORT_PARAMETER_LIB__ -#define __USB3_DEBUG_PORT_PARAMETER_LIB__ - -typedef struct { - UINT8 Function; - UINT8 Device; - UINT8 Bus; -} PCI_ADDRESS; - -typedef union { - UINT32 Controller; - PCI_ADDRESS PciAddress; -} USB3_DEBUG_PORT_CONTROLLER; - -/** - Returns the USB debug port controller. - bit: 0~ 7: Function - bit: 8~15: Device - bit: 16~24: Bus - - @return Controller information of USB debug port. - -**/ -UINT32 -EFIAPI -GetUsb3DebugPortController ( - VOID - ); - -/** - Sets the USB debug port controller. - bit: 0~ 7: Function - bit: 8~15: Device - bit: 16~24: Bus - - @param[in] Controller information of USB debug port value to be set. - - @retval TRUE The controller of USB debug port was sucessfully= set. - @retval FALSE The controller of USB debug port could not be se= t. - -**/ -BOOLEAN -EFIAPI -SetUsb3DebugPortController ( - UINT32 Controller - ); - -#endif diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/MiscSe= rvices.c b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServ= ices.c deleted file mode 100644 index cb29a880e6..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/MiscServices.c +++ /dev/null @@ -1,385 +0,0 @@ -/** @file - Miscellaneous services internal to USB debug port implementation. - - Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "Usb3DebugPortLibInternal.h" - -/** - Verifies if the bit positions specified by a mask are set in a register. - - @param[in, out] Register UNITN register - @param[in] BitMask 32-bit mask - - @return BOOLEAN - TRUE if all bits specified by the mask are enabled. - - FALSE even if one of the bits specified by the mask - is not enabled. -**/ -BOOLEAN -XhcIsBitSet( - IN OUT UINTN Register, - IN UINT32 BitMask - ) -{ - if ((MmioRead32 (Register) & (BitMask)) !=3D 0) { - return TRUE; - } - return FALSE; -} - -/** - Sets bits as per the enabled bit positions in the mask. - - @param[in, out] Register UINTN register - @param[in] BitMask 32-bit mask -**/ -VOID -XhcSetR32Bit( - IN OUT UINTN Register, - IN UINT32 BitMask - ) -{ - UINT32 RegisterValue; - - RegisterValue =3D MmioRead32 (Register); - RegisterValue |=3D (UINT32)(BitMask); - MmioWrite32 (Register, RegisterValue); -} - -/** - Clears bits as per the enabled bit positions in the mask. - - @param[in, out] Register UINTN register - @param[in] BitMask 32-bit mask -**/ -VOID -XhcClrR32Bit( - IN OUT UINTN Register, - IN UINT32 BitMask - ) -{ - UINT32 RegisterValue; - - RegisterValue =3D MmioRead32 (Register); - RegisterValue &=3D (UINT32)(~(BitMask)); - MmioWrite32 (Register, RegisterValue); -} - -/** - Initialize the USB debug port hardware. - - If no initialization is required, then return RETURN_SUCCESS. - If the serial device was successfully initialized, then return RETURN_SU= CCESS. - If the serial device could not be initialized, then return RETURN_DEVICE= _ERROR. - - @retval RETURN_SUCCESS The serial device was initialized. - @retval RETURN_DEVICE_ERROR The serial device could not be initialized. -**/ -RETURN_STATUS -EFIAPI -Usb3DebugPortInitialize ( - VOID - ) -{ - USB3Initialize (); - return RETURN_SUCCESS; -} - -/** - Write data from buffer to USB debug port. - - Writes NumberOfBytes data bytes from Buffer to the serial device. - The number of bytes actually written to the serial device is returned. - If the return value is less than NumberOfBytes, then the write operation= failed. - If Buffer is NULL, then ASSERT(). - If NumberOfBytes is zero, then return 0. - - @param Buffer Pointer to the data buffer to be written. - @param NumberOfBytes Number of bytes to written to the serial device. - - @retval 0 NumberOfBytes is 0. - @retval >0 The number of bytes written to the serial devic= e. - If this value is less than NumberOfBytes, then = the read operation failed. -**/ -UINTN -EFIAPI -Usb3DebugPortWrite ( - IN UINT8 *Buffer, - IN UINTN NumberOfBytes - ) -{ - Usb3DbgOut (Buffer, &NumberOfBytes); - return NumberOfBytes; -} - -/** - Read data from USB debug port and save the datas in buffer. - - Reads NumberOfBytes data bytes from a serial device into the buffer - specified by Buffer. The number of bytes actually read is returned. - If the return value is less than NumberOfBytes, then the rest operation = failed. - If Buffer is NULL, then ASSERT(). - If NumberOfBytes is zero, then return 0. - - @param Buffer Pointer to the data buffer to store the data re= ad from the serial device. - @param NumberOfBytes Number of bytes which will be read. - - @retval 0 Read data failed, no data is to be read. - @retval >0 Actual number of bytes read from serial device. -**/ -UINTN -EFIAPI -Usb3DebugPortRead ( - OUT UINT8 *Buffer, - IN UINTN NumberOfBytes - ) -{ - Usb3DbgIn (Buffer, &NumberOfBytes); - return NumberOfBytes; -} - -/** - Polls a USB debug port to see if there is any data waiting to be read. - - Polls a serial device to see if there is any data waiting to be read. - If there is data waiting to be read from the serial device, then TRUE is= returned. - If there is no data waiting to be read from the serial device, then FALS= E is returned. - - @retval TRUE Data is waiting to be read from the serial devi= ce. - @retval FALSE There is no data waiting to be read from the se= rial device. -**/ -BOOLEAN -EFIAPI -Usb3DebugPortPoll ( - VOID - ) -{ - return FALSE; -} - -/** - Write the data to the XHCI debug register. - - @param Xhc The XHCI Instance. - @param Offset The offset of the runtime register. - @param Data The data to write. - -**/ -VOID -XhcWriteDebugReg ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Data - ) -{ - EFI_PHYSICAL_ADDRESS DebugCapabilityBase; - - DebugCapabilityBase =3D Xhc->DebugCapabilityBase; - - MmioWrite32 ((UINTN)(DebugCapabilityBase + Offset), Data); - - return; -} - -/** - Read XHCI debug register. - - @param Xhc The XHCI Instance. - @param Offset The offset of the debug register. - - @return The register content read - -**/ -UINT32 -XhcReadDebugReg ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset - ) -{ - UINT32 Data; - EFI_PHYSICAL_ADDRESS DebugCapabilityBase; - - DebugCapabilityBase =3D Xhc->DebugCapabilityBase; - - Data =3D MmioRead32 ((UINTN)(DebugCapabilityBase + Offset)); - - return Data; -} - -/** - Set one bit of the debug register while keeping other bits. - - @param Xhc The XHCI Instance. - @param Offset The offset of the debug register. - @param Bit The bit mask of the register to set. - -**/ -VOID -XhcSetDebugRegBit ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Bit - ) -{ - UINT32 Data; - - Data =3D XhcReadDebugReg (Xhc, Offset); - Data |=3D Bit; - XhcWriteDebugReg (Xhc, Offset, Data); -} - -/** - Clear one bit of the debug register while keeping other bits. - - @param Xhc The XHCI Instance. - @param Offset The offset of the debug register. - @param Bit The bit mask of the register to set. - -**/ -VOID -XhcClearDebugRegBit ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Bit - ) -{ - UINT32 Data; - - Data =3D XhcReadDebugReg (Xhc, Offset); - Data &=3D ~Bit; - XhcWriteDebugReg (Xhc, Offset, Data); -} - -/** - Write the data to the XHCI MMIO register. - - @param Xhc The XHCI Instance. - @param Offset The offset of the runtime register. - @param Data The data to write. - -**/ -VOID -XhcWriteMmioReg ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Data - ) -{ - EFI_PHYSICAL_ADDRESS MmioBase; - - MmioBase =3D Xhc->XhcMmioBase; - MmioWrite32 ((UINTN)(MmioBase + Offset), Data); - - return; -} - -/** - Read XHCI MMIO register. - - @param Xhc The XHCI Instance. - @param Offset The offset of the runtime register. - - @return The register content read - -**/ -UINT32 -XhcReadMmioReg ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset - ) -{ - UINT32 Data; - EFI_PHYSICAL_ADDRESS MmioBase; - - MmioBase =3D Xhc->XhcMmioBase; - - Data =3D MmioRead32 ((UINTN)(MmioBase + Offset)); - - return Data; -} - -/** - Set one bit of the operational register while keeping other bits. - - @param Xhc The XHCI Instance. - @param Offset The offset of the runtime register. - @param Bit The bit mask of the register to set. - -**/ -VOID -XhcSetMmioRegBit ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Bit - ) -{ - UINT32 Data; - - Data =3D XhcReadMmioReg (Xhc, Offset); - Data |=3D Bit; - XhcWriteMmioReg (Xhc, Offset, Data); -} - -/** - Clear one bit of the operational register while keeping other bits. - - @param Xhc The XHCI Instance. - @param Offset The offset of the runtime register. - @param Bit The bit mask of the register to set. - -**/ -VOID -XhcClearMmioRegBit ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Bit - ) -{ - UINT32 Data; - - Data =3D XhcReadMmioReg (Xhc, Offset); - Data &=3D ~Bit; - XhcWriteMmioReg (Xhc, Offset, Data); -} - -/** - Wait the operation register's bit as specified by Bit - to be set (or clear). - - @param Xhc The XHCI Instance. - @param Offset The offset of the operational register. - @param Bit The bit of the register to wait for. - @param WaitToSet Wait the bit to set or clear. - @param Timeout The time to wait before abort (in millisecond, ms). - - @retval EFI_SUCCESS The bit successfully changed by host controller. - @retval EFI_TIMEOUT The time out occurred. - -**/ -EFI_STATUS -XhcWaitMmioRegBit ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Bit, - IN BOOLEAN WaitToSet, - IN UINT32 Timeout - ) -{ - UINT32 Index; - UINTN Loop; - - Loop =3D (Timeout * XHC_1_MILLISECOND / XHC_POLL_DELAY) + 1; - - for (Index =3D 0; Index < Loop; Index++) { - if (XHC_REG_BIT_IS_SET (Xhc, Offset, Bit) =3D=3D WaitToSet) { - return EFI_SUCCESS; - } - - MicroSecondDelay (XHC_POLL_DELAY); - } - - return EFI_TIMEOUT; -} diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3De= bugPortDataTransfer.c b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPor= tLib/Usb3DebugPortDataTransfer.c deleted file mode 100644 index 53478a49b8..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPort= DataTransfer.c +++ /dev/null @@ -1,892 +0,0 @@ -/** @file - Usb3 Debug Port library instance - - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include "Usb3DebugPortLibInternal.h" - -EFI_SMRAM_DESCRIPTOR mSmramCheckRanges[MAX_SMRAM_RANGE]; -UINTN mSmramCheckRangeCount =3D 0; -BOOLEAN mUsb3InSmm =3D FALSE; -UINT64 mUsb3MmioSize =3D 0; - -/** - Synchronize the specified transfer ring to update the enqueue and dequeu= e pointer. - - @param Xhc The XHCI Instance. - @param TrsRing The transfer ring to sync. - - @retval EFI_SUCCESS The transfer ring is synchronized successfully. - -**/ -EFI_STATUS -EFIAPI -XhcSyncTrsRing ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN TRANSFER_RING *TrsRing - ) -{ - UINTN Index; - TRB_TEMPLATE *TrsTrb; - - ASSERT (TrsRing !=3D NULL); - - // - // Calculate the latest RingEnqueue and RingPCS - // - TrsTrb =3D (TRB_TEMPLATE *)(UINTN) TrsRing->RingEnqueue; - - ASSERT (TrsTrb !=3D NULL); - - for (Index =3D 0; Index < TrsRing->TrbNumber; Index++) { - if (TrsTrb->CycleBit !=3D (TrsRing->RingPCS & BIT0)) { - break; - } - TrsTrb++; - if ((UINT8) TrsTrb->Type =3D=3D TRB_TYPE_LINK) { - ASSERT (((LINK_TRB*)TrsTrb)->TC !=3D 0); - // - // set cycle bit in Link TRB as normal - // - ((LINK_TRB*)TrsTrb)->CycleBit =3D TrsRing->RingPCS & BIT0; - // - // Toggle PCS maintained by software - // - TrsRing->RingPCS =3D (TrsRing->RingPCS & BIT0) ? 0 : 1; - TrsTrb =3D (TRB_TEMPLATE *)(UINTN)((TrsTrb->Parameter1 | L= ShiftU64 ((UINT64)TrsTrb->Parameter2, 32)) & ~0x0F); - } - } - ASSERT (Index !=3D TrsRing->TrbNumber); - - if ((EFI_PHYSICAL_ADDRESS)(UINTN) TrsTrb !=3D TrsRing->RingEnqueue) { - TrsRing->RingEnqueue =3D (EFI_PHYSICAL_ADDRESS)(UINTN) TrsTrb; - } - - // - // Clear the Trb context for enqueue, but reserve the PCS bit - // - TrsTrb->Parameter1 =3D 0; - TrsTrb->Parameter2 =3D 0; - TrsTrb->Status =3D 0; - TrsTrb->RsvdZ1 =3D 0; - TrsTrb->Type =3D 0; - TrsTrb->Control =3D 0; - - return EFI_SUCCESS; -} - -/** - Synchronize the specified event ring to update the enqueue and dequeue p= ointer. - - @param Xhc The XHCI Instance. - @param EvtRing The event ring to sync. - - @retval EFI_SUCCESS The event ring is synchronized successfully. - -**/ -EFI_STATUS -EFIAPI -XhcSyncEventRing ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN EVENT_RING *EvtRing - ) -{ - UINTN Index; - TRB_TEMPLATE *EvtTrb1; - - ASSERT (EvtRing !=3D NULL); - - // - // Calculate the EventRingEnqueue and EventRingCCS. - // Note: only support single Segment - // - EvtTrb1 =3D (TRB_TEMPLATE *)(UINTN) EvtRing->EventRingDequeue; - - for (Index =3D 0; Index < EvtRing->TrbNumber; Index++) { - if (EvtTrb1->CycleBit !=3D EvtRing->EventRingCCS) { - break; - } - - EvtTrb1++; - - if ((UINTN)EvtTrb1 >=3D ((UINTN) EvtRing->EventRingSeg0 + sizeof (TRB_= TEMPLATE) * EvtRing->TrbNumber)) { - EvtTrb1 =3D (TRB_TEMPLATE *)(UINTN) EvtRing->EventRingSeg0; - EvtRing->EventRingCCS =3D (EvtRing->EventRingCCS) ? 0 : 1; - } - } - - if (Index < EvtRing->TrbNumber) { - EvtRing->EventRingEnqueue =3D (EFI_PHYSICAL_ADDRESS)(UINTN)EvtTrb1; - } else { - ASSERT (FALSE); - } - - return EFI_SUCCESS; -} - -/** - Check if there is a new generated event. - - @param Xhc The XHCI Instance. - @param EvtRing The event ring to check. - @param NewEvtTrb The new event TRB found. - - @retval EFI_SUCCESS Found a new event TRB at the event ring. - @retval EFI_NOT_READY The event ring has no new event. - -**/ -EFI_STATUS -EFIAPI -XhcCheckNewEvent ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN EVENT_RING *EvtRing, - OUT TRB_TEMPLATE **NewEvtTrb - ) -{ - EFI_STATUS Status; - - ASSERT (EvtRing !=3D NULL); - - *NewEvtTrb =3D (TRB_TEMPLATE *)(UINTN) EvtRing->EventRingDequeue; - - if (EvtRing->EventRingDequeue =3D=3D EvtRing->EventRingEnqueue) { - return EFI_NOT_READY; - } - - Status =3D EFI_SUCCESS; - - EvtRing->EventRingDequeue +=3D sizeof (TRB_TEMPLATE); - // - // If the dequeue pointer is beyond the ring, then roll-back it to the b= egining of the ring. - // - if ((UINTN)EvtRing->EventRingDequeue >=3D ((UINTN) EvtRing->EventRingSeg= 0 + sizeof (TRB_TEMPLATE) * EvtRing->TrbNumber)) { - EvtRing->EventRingDequeue =3D EvtRing->EventRingSeg0; - } - - return Status; -} - -/** - Check if the Trb is a transaction of the URB. - - @param Trb The TRB to be checked - @param Urb The transfer ring to be checked. - - @retval TRUE It is a transaction of the URB. - @retval FALSE It is not any transaction of the URB. - -**/ -BOOLEAN -IsTransferRingTrb ( - IN TRB_TEMPLATE *Trb, - IN URB *Urb - ) -{ - TRB_TEMPLATE *CheckedTrb; - TRANSFER_RING *Ring; - UINTN Index; - - Ring =3D (TRANSFER_RING *)(UINTN) Urb->Ring; - CheckedTrb =3D (TRB_TEMPLATE *)(UINTN) Ring->RingSeg0; - - ASSERT (Ring->TrbNumber =3D=3D CMD_RING_TRB_NUMBER || Ring->TrbNumber = =3D=3D TR_RING_TRB_NUMBER); - - for (Index =3D 0; Index < Ring->TrbNumber; Index++) { - if (Trb =3D=3D CheckedTrb) { - return TRUE; - } - CheckedTrb++; - } - - return FALSE; -} - -/** - Check the URB's execution result and update the URB's - result accordingly. - - @param Xhc The XHCI Instance. - @param Urb The URB to check result. - - @return Whether the result of URB transfer is finialized. - -**/ -EFI_STATUS -XhcCheckUrbResult ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN URB *Urb - ) -{ - EVT_TRB_TRANSFER *EvtTrb; - TRB_TEMPLATE *TRBPtr; - UINTN Index; - UINT8 TRBType; - EFI_STATUS Status; - URB *CheckedUrb; - UINT64 XhcDequeue; - UINT32 High; - UINT32 Low; - - ASSERT ((Xhc !=3D NULL) && (Urb !=3D NULL)); - - Status =3D EFI_SUCCESS; - - if (Urb->Finished) { - goto EXIT; - } - - EvtTrb =3D NULL; - - // - // Traverse the event ring to find out all new events from the previous = check. - // - XhcSyncEventRing (Xhc, &Xhc->EventRing); - - for (Index =3D 0; Index < Xhc->EventRing.TrbNumber; Index++) { - Status =3D XhcCheckNewEvent (Xhc, &Xhc->EventRing, ((TRB_TEMPLATE **)&= EvtTrb)); - if (Status =3D=3D EFI_NOT_READY) { - // - // All new events are handled, return directly. - // - goto EXIT; - } - // - // Only handle COMMAND_COMPLETETION_EVENT and TRANSFER_EVENT. - // - if ((EvtTrb->Type !=3D TRB_TYPE_COMMAND_COMPLT_EVENT) && (EvtTrb->Type= !=3D TRB_TYPE_TRANS_EVENT)) { - continue; - } - - TRBPtr =3D (TRB_TEMPLATE *)(UINTN)(EvtTrb->TRBPtrLo | LShiftU64 ((UINT= 64) EvtTrb->TRBPtrHi, 32)); - - // - // Update the status of Urb according to the finished event regardless= of whether - // the urb is current checked one or in the XHCI's async transfer list. - // This way is used to avoid that those completed async transfer event= s don't get - // handled in time and are flushed by newer coming events. - // - if (IsTransferRingTrb (TRBPtr, Urb)) { - CheckedUrb =3D Urb; - } else { - continue; - } - switch (EvtTrb->Completecode) { - case TRB_COMPLETION_STALL_ERROR: - CheckedUrb->Result |=3D EFI_USB_ERR_STALL; - CheckedUrb->Finished =3D TRUE; - break; - - case TRB_COMPLETION_BABBLE_ERROR: - CheckedUrb->Result |=3D EFI_USB_ERR_BABBLE; - CheckedUrb->Finished =3D TRUE; - break; - - case TRB_COMPLETION_DATA_BUFFER_ERROR: - CheckedUrb->Result |=3D EFI_USB_ERR_BUFFER; - CheckedUrb->Finished =3D TRUE; - break; - - case TRB_COMPLETION_USB_TRANSACTION_ERROR: - CheckedUrb->Result |=3D EFI_USB_ERR_TIMEOUT; - CheckedUrb->Finished =3D TRUE; - break; - - case TRB_COMPLETION_SHORT_PACKET: - case TRB_COMPLETION_SUCCESS: - if (EvtTrb->Completecode =3D=3D TRB_COMPLETION_SHORT_PACKET) { - } - - TRBType =3D (UINT8) (TRBPtr->Type); - if ((TRBType =3D=3D TRB_TYPE_DATA_STAGE) || - (TRBType =3D=3D TRB_TYPE_NORMAL) || - (TRBType =3D=3D TRB_TYPE_ISOCH)) { - CheckedUrb->Completed +=3D (CheckedUrb->DataLen - EvtTrb->Length= ); - } - - break; - - default: - CheckedUrb->Result |=3D EFI_USB_ERR_TIMEOUT; - CheckedUrb->Finished =3D TRUE; - break; - } - - // - // Only check first and end Trb event address - // - - if ((EFI_PHYSICAL_ADDRESS)(UINTN) TRBPtr =3D=3D CheckedUrb->TrbStart) { - CheckedUrb->StartDone =3D TRUE; - } - - if ((EFI_PHYSICAL_ADDRESS)(UINTN) TRBPtr =3D=3D CheckedUrb->TrbEnd) { - CheckedUrb->EndDone =3D TRUE; - } - - if (CheckedUrb->StartDone && CheckedUrb->EndDone) { - CheckedUrb->Finished =3D TRUE; - } - - } - -EXIT: - // - // Advance event ring to last available entry - // - // Some 3rd party XHCI external cards don't support single 64-bytes widt= h register access, - // So divide it to two 32-bytes width register access. - // - Low =3D XhcReadDebugReg (Xhc, XHC_DC_DCERDP); - High =3D XhcReadDebugReg (Xhc, XHC_DC_DCERDP + 4); - XhcDequeue =3D (UINT64)(LShiftU64((UINT64)High, 32) | Low); - - if ((XhcDequeue & (~0x0F)) !=3D ((UINT64)(UINTN)Xhc->EventRing.EventRing= Dequeue & (~0x0F))) { - // - // Some 3rd party XHCI external cards don't support single 64-bytes wi= dth register access, - // So divide it to two 32-bytes width register access. - // - XhcWriteDebugReg (Xhc, XHC_DC_DCERDP, XHC_LOW_32BIT (Xhc->EventRing.Ev= entRingDequeue)); - XhcWriteDebugReg (Xhc, XHC_DC_DCERDP + 4, XHC_HIGH_32BIT (Xhc->EventRi= ng.EventRingDequeue)); - } - - return Status; -} - -/** - Ring the door bell to notify XHCI there is a transaction to be executed. - - @param Xhc The XHCI Instance. - @param Urb The pointer to URB. - - @retval EFI_SUCCESS Successfully ring the door bell. - -**/ -EFI_STATUS -EFIAPI -XhcRingDoorBell ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN URB *Urb - ) -{ - UINT32 Dcdb; - - // - // 7.6.8.2 DCDB Register - // - if (Urb->Direction =3D=3D EfiUsbDataIn) { - Dcdb =3D 0x100; - } else { - Dcdb =3D 0x0; - } - - XhcWriteDebugReg ( - Xhc, - XHC_DC_DCDB, - Dcdb - ); - - return EFI_SUCCESS; -} - -/** - Execute the transfer by polling the URB. This is a synchronous operation. - - @param Xhc The XHCI Instance. - @param Urb The URB to execute. - @param Timeout The time to wait before abort, in millisecond. - - @return EFI_DEVICE_ERROR The transfer failed due to transfer error. - @return EFI_TIMEOUT The transfer failed due to time out. - @return EFI_SUCCESS The transfer finished OK. - -**/ -EFI_STATUS -XhcExecTransfer ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN URB *Urb, - IN UINTN Timeout - ) -{ - EFI_STATUS Status; - UINTN Index; - UINTN Loop; - TRB_TEMPLATE *Trb; - TRANSFER_RING *Ring; - TRB_TEMPLATE *TrbStart; - TRB_TEMPLATE *TrbEnd; - - Status =3D EFI_SUCCESS; - - Loop =3D (Timeout * XHC_1_MILLISECOND / XHC_POLL_DELAY) + 1; - if (Timeout =3D=3D 0) { - Loop =3D 0xFFFFFFFF; - } - XhcRingDoorBell (Xhc, Urb); - // - // DSCT BIT0: Event Ring Not Empty bit can only be set to 1 by XHC after= ringing door bell with some delay. - // - - for (Index =3D 0; Index < Loop; Index++) { - Status =3D XhcCheckUrbResult (Xhc, Urb); - if (Urb->Finished) { - break; - } - MicroSecondDelay (XHC_POLL_DELAY); - } - if (Index =3D=3D Loop) { - Urb->Result =3D EFI_USB_ERR_TIMEOUT; - } - - // - // If URB transfer is error, restore transfer ring to original value bef= ore URB transfer - // This will make the current transfer TRB is always at the latest unuse= d one in transfer ring. - // Without this code, when there is read TRB from target, but host does = not write anything, this TRB (A) - // will be still here, next read TRB (B) will be put next to TRB (A), wh= en host write then, the TRB (A) - // will be used to contain data, not TRB(B), this will cause Finished fl= ag will not be set and return error in this function. - // - Ring =3D (TRANSFER_RING *)(UINTN) Urb->Ring; - if (Urb->Result !=3D EFI_USB_NOERROR) { - Ring->RingEnqueue =3D Urb->TrbStart; - // - // Clear CCS flag for next use - // - TrbStart =3D (TRB_TEMPLATE *)(UINTN) Urb->TrbStart; - TrbEnd =3D (TRB_TEMPLATE *)(UINTN) Urb->TrbEnd; - for (Trb =3D TrbStart; Trb <=3D TrbEnd; Trb++) { - Trb->CycleBit =3D ((~Ring->RingPCS) & BIT0); - } - } - return Status; -} - -/** - Create a transfer TRB. - - @param Xhc The XHCI Instance - @param Urb The urb used to construct the transfer TRB. - - @return Created TRB or NULL - -**/ -EFI_STATUS -XhcCreateTransferTrb ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN URB *Urb - ) -{ - TRANSFER_RING *EPRing; - TRB *TrbStart; - UINT32 TotalLen; - UINT32 Len; - UINT32 TrbNum; - - Urb->Finished =3D FALSE; - Urb->StartDone =3D FALSE; - Urb->EndDone =3D FALSE; - Urb->Completed =3D 0; - Urb->Result =3D EFI_USB_NOERROR; - - if (Urb->Direction =3D=3D EfiUsbDataIn) { - EPRing =3D &Xhc->TransferRingIn; - } else { - EPRing =3D &Xhc->TransferRingOut; - } - - Urb->Ring =3D (EFI_PHYSICAL_ADDRESS)(UINTN) EPRing; - // - // Construct the TRB for ED_BULK_OUT and ED_BULK_IN - // - XhcSyncTrsRing (Xhc, EPRing); - - Urb->TrbStart =3D EPRing->RingEnqueue; - - TotalLen =3D 0; - Len =3D 0; - TrbNum =3D 0; - TrbStart =3D (TRB *)(UINTN)EPRing->RingEnqueue; - - while (TotalLen < Urb->DataLen) { - if ((TotalLen + 0x10000) >=3D Urb->DataLen) { - Len =3D Urb->DataLen - TotalLen; - } else { - Len =3D 0x10000; - } - TrbStart =3D (TRB *)(UINTN)EPRing->RingEnqueue; - TrbStart->TrbNormal.TRBPtrLo =3D XHC_LOW_32BIT(Urb->Data + TotalLen); - TrbStart->TrbNormal.TRBPtrHi =3D XHC_HIGH_32BIT(Urb->Data + TotalLen); - TrbStart->TrbNormal.Length =3D Len; - TrbStart->TrbNormal.TDSize =3D 0; - TrbStart->TrbNormal.IntTarget =3D 0; - TrbStart->TrbNormal.ISP =3D 1; - TrbStart->TrbNormal.IOC =3D 1; - TrbStart->TrbNormal.Type =3D TRB_TYPE_NORMAL; - - // - // Update the cycle bit - // - TrbStart->TrbNormal.CycleBit =3D EPRing->RingPCS & BIT0; - - XhcSyncTrsRing (Xhc, EPRing); - TrbNum++; - TotalLen +=3D Len; - } - - Urb->TrbNum =3D TrbNum; - - // - // Update to the last TRB - // - Urb->TrbEnd =3D (EFI_PHYSICAL_ADDRESS)(UINTN) TrbStart; - return EFI_SUCCESS; -} - -/** - Create a new URB for a new transaction. - - @param Xhc The XHCI Instance - @param Direction The direction of data flow. - @param Data The user data to transfer - @param DataLen The length of data buffer - - @return Created URB or NULL - -**/ -URB* -XhcCreateUrb ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN EFI_USB_DATA_DIRECTION Direction, - IN VOID *Data, - IN UINTN DataLen - ) -{ - EFI_STATUS Status; - URB *Urb; - EFI_PHYSICAL_ADDRESS DataAddress; - - Urb =3D &Xhc->Urb; - ASSERT (Urb->Data !=3D 0); - DataAddress =3D Urb->Data; - ZeroMem (Urb, sizeof (URB)); - - Urb->Signature =3D USB3_DEBUG_PORT_INSTANCE_SIGNATURE; - Urb->Direction =3D Direction; - Urb->Data =3D DataAddress; - - ZeroMem ((VOID*)(UINTN) Urb->Data, DataLen); - CopyMem ((VOID*)(UINTN) Urb->Data, Data, DataLen); - - Urb->DataLen =3D (UINT32) DataLen; - Status =3D XhcCreateTransferTrb (Xhc, Urb); - ASSERT_EFI_ERROR (Status); - - return Urb; -} - -/** - Submits bulk transfer to a bulk endpoint of a USB device. - - @param Xhc The instance of debug device. - @param Direction The direction of data transfer. - @param Data Array of pointers to the buffers of data t= o transmit - from or receive into. - @param DataLength The lenght of the data buffer. - @param Timeout Indicates the maximum time, in millisecond= , which - the transfer is allowed to complete. - @param TransferResult Transfer result. - - @retval EFI_SUCCESS The transfer was completed successfully. - @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resourc= e. - @retval EFI_INVALID_PARAMETER Some parameters are invalid. - @retval EFI_TIMEOUT The transfer failed due to timeout. - @retval EFI_DEVICE_ERROR The transfer failed due to host controller= error. - -**/ -EFI_STATUS -EFIAPI -XhcDataTransfer ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN EFI_USB_DATA_DIRECTION Direction, - IN OUT VOID *Data, - IN OUT UINTN *DataLength, - IN UINTN Timeout, - OUT UINT32 *TransferResult - ) -{ - URB *Urb; - EFI_STATUS Status; - - // - // Validate the parameters - // - if ((DataLength =3D=3D NULL) || (*DataLength =3D=3D 0) || - (Data =3D=3D NULL) || (TransferResult =3D=3D NULL)) { - return EFI_INVALID_PARAMETER; - } - - *TransferResult =3D EFI_USB_ERR_SYSTEM; - Status =3D EFI_DEVICE_ERROR; - - // - // Create a new URB, insert it into the asynchronous - // schedule list, then poll the execution status. - // - Urb =3D XhcCreateUrb (Xhc, Direction, Data, *DataLength); - - if (Urb =3D=3D NULL) { - Status =3D EFI_OUT_OF_RESOURCES; - goto ON_EXIT; - } - - Status =3D XhcExecTransfer (Xhc, Urb, Timeout); - - *TransferResult =3D Urb->Result; - *DataLength =3D Urb->Completed; - - if (*TransferResult =3D=3D EFI_USB_NOERROR) { - Status =3D EFI_SUCCESS; - } - -ON_EXIT: - - return Status; -} - -/** - Check whether the MMIO Bar is within any of the SMRAM ranges. - - @param[in] XhcMmioBase The address of the MMIO to be checked. - - @retval TURE The XHCI MMIO is in SMRAM ranges. - @retval FALSE The XHCI MMIO is out of SMRAM ranges. -**/ -BOOLEAN -EFIAPI -Usb3DebugIsAddressInSmram ( - IN EFI_PHYSICAL_ADDRESS XhcMmioBase - ) -{ - UINTN Index; - - if (mSmramCheckRangeCount =3D=3D 0) { - // - // When we invoke this function, we are already in SMM mode, - // but SmmAccess->GetCapabilities failed which kept mSmramCheckRanges = as 0. - // - return TRUE; - } - - for (Index =3D 0; Index < mSmramCheckRangeCount; Index ++) { - if (((XhcMmioBase >=3D mSmramCheckRanges[Index].CpuStart) && (XhcMmioB= ase < mSmramCheckRanges[Index].CpuStart + mSmramCheckRanges[Index].Physical= Size)) || - ((mSmramCheckRanges[Index].CpuStart >=3D XhcMmioBase) && (mSmramCh= eckRanges[Index].CpuStart < XhcMmioBase + mUsb3MmioSize))) { - return TRUE; - } - } - - return FALSE; -} - -/** - Transfer data via XHC controller. - - @param Data Data buffer. - @param Length Data length. - @param Direction Transfer direction. - -**/ -VOID -Usb3DebugPortDataTransfer ( - UINT8 *Data, - UINTN *Length, - EFI_USB_DATA_DIRECTION Direction - ) -{ - USB3_DEBUG_PORT_INSTANCE *Instance; - EFI_PHYSICAL_ADDRESS XhcMmioBase; - UINT16 Command; - UINT8 Bus; - UINT8 Device; - UINT8 Function; - UINT32 TransferResult; - UINT32 Dcctrl; - EFI_PHYSICAL_ADDRESS UsbBase; - UINTN BytesToSend; - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; - EFI_STATUS Status; - USB3_DEBUG_PORT_INSTANCE UsbDbgInstance; - - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); - Bus =3D UsbDebugPort.PciAddress.Bus; - Device =3D UsbDebugPort.PciAddress.Device; - Function =3D UsbDebugPort.PciAddress.Function; - - // - // MMIO base address is possible to clear, set it if it is cleared. (Xhc= iMemorySpaceClose in PchUsbCommon.c) - // - XhcMmioBase =3D GetXhciBaseAddress (); - Command =3D GetXhciPciCommand (); - - if ((XhcMmioBase =3D=3D 0) || (XhcMmioBase =3D=3D XHCI_BASE_ADDRESS_64_B= IT_MASK)) { - // - // XHCI device MMIO base is cleared by someone, set it again - // - UsbBase =3D PcdGet32 (PcdXhciDefaultBaseAddress); - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG= _OFFSET), (UINT32)UsbBase); - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG= _OFFSET + 4), 0x0); - UsbBase =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE= _ADDRESSREG_OFFSET)) & XHCI_BASE_ADDRESS_32_BIT_MASK; - if (UsbBase =3D=3D 0 || UsbBase =3D=3D XHCI_BASE_ADDRESS_32_BIT_MASK) { - return; - } - } - - // - // Check if XHC debug MMIO range is in SMRAM - // - if ((mUsb3InSmm) && (Usb3DebugIsAddressInSmram (XhcMmioBase))) { - return; - } - - // - // Save and set Command Register - // - if (((Command & EFI_PCI_COMMAND_MEMORY_SPACE) =3D=3D 0) || ((Command & E= FI_PCI_COMMAND_BUS_MASTER) =3D=3D 0)) { - PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET),= Command | EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER); - PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET)); - } - - Instance =3D GetUsb3DebugPortInstance (); - - if (Instance !=3D NULL) { - if (!Instance->DebugSupport) { - // - // Debug device is not supported by XHCI, return - // - goto Done; - } - } - - if ((Instance !=3D NULL) && (Instance->Ready)) { - // - // Debug device is broken suddently (e.g. Windows OS), return - // - Dcctrl =3D XhcReadDebugReg (Instance, XHC_DC_DCCTRL); - if ((Dcctrl & BIT0) =3D=3D 0) { - goto Done; - } - } - - if ((Instance !=3D NULL) && (!Instance->Ready)) { - // - // Debug host does not connect with target - // - goto Done; - } - - if (Instance =3D=3D NULL) { - ZeroMem (&UsbDbgInstance, sizeof (USB3_DEBUG_PORT_INSTANCE)); - DiscoverUsb3DebugPort (&UsbDbgInstance); - if (UsbDbgInstance.DebugSupport) { - if (!IsAllocatePagesReady ()) { - // - // AllocatePages can not work, return - // - goto Done; - } - } - Status =3D USB3InitializeReal (); - if (EFI_ERROR (Status)) { - // - // Debug device is failed to initialize - // - goto Done; - } - - // - // Update instance - // - Instance =3D GetUsb3DebugPortInstance (); - - if (Instance =3D=3D NULL) { - // - // Debug device instance is failed to create - // - goto Done; - } - - if ((!Instance->Ready) || (!Instance->DebugSupport)) { - // - // Debug host does not connect at first or is not supported - // - goto Done; - } - } - - BytesToSend =3D 0; - while (*Length > 0) { - BytesToSend =3D ((*Length) > XHC_DEBUG_PORT_DATA_LENGTH) ? XHC_DEBUG_P= ORT_DATA_LENGTH : *Length; - XhcDataTransfer ( - Instance, - Direction, - Data, - &BytesToSend, - DATA_TRANSFER_TIME_OUT, - &TransferResult - ); - if (TransferResult !=3D EFI_USB_NOERROR) { - break; - } - *Length -=3D BytesToSend; - Data +=3D BytesToSend; - } - -Done: - // - // Restore Command Register - // - PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), = Command); - -} - -/** - Receive data over the USB3 debug cable. - - @param[out] Data Pointer to data - @param[in, out] Length Pointer to data length - -**/ -RETURN_STATUS -Usb3DbgIn ( - OUT UINT8 *Data, - IN OUT UINTN *Length - ) -{ - Usb3DebugPortDataTransfer (Data, Length, EfiUsbDataIn); - return EFI_SUCCESS; -} - -/** - Send data over the USB3 debug cable. - - @param[out] Data Pointer to data - @param[in, out] Length Pointer to data length - -**/ -VOID -Usb3DbgOut ( - OUT UINT8 *Data, - IN OUT UINTN *Length - ) -{ - Usb3DebugPortDataTransfer (Data, Length, EfiUsbDataOut); -} diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3De= bugPortInitialize.c b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortL= ib/Usb3DebugPortInitialize.c deleted file mode 100644 index dbdae59253..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPort= Initialize.c +++ /dev/null @@ -1,726 +0,0 @@ -/** @file - Usb3 Debug Port initialization - - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include "Usb3DebugPortLibInternal.h" - -UINT16 mString0Desc[] =3D { - // String Descriptor Type + Length - ( USB_DESC_TYPE_STRING << 8 ) + STRING0_DESC_LEN, - 0x0409 -}; - -UINT16 mManufacturerStrDesc[] =3D { - // String Descriptor Type + Length - ( USB_DESC_TYPE_STRING << 8 ) + MANU_DESC_LEN, - 'I', 'n', 't', 'e', 'l' -}; - -//USB 3.0 Debug Cable -UINT16 mProductStrDesc[] =3D { - // String Descriptor Type + Length - ( USB_DESC_TYPE_STRING << 8 ) + PRODUCT_DESC_LEN, - 'U', 'S', 'B', ' ', '3', '.', '0', ' ', 'D', 'e', 'b', 'u', 'g', ' ', 'C= ', 'a', 'b', 'l', 'e' -}; - -UINT16 mSerialNumberStrDesc[] =3D { - // String Descriptor Type + Length - ( USB_DESC_TYPE_STRING << 8 ) + SERIAL_DESC_LEN, - '1' -}; - -XHC_DC_CONTEXT DebugCapabilityContextTemplate =3D { - { - 0, - 0, - 0, - 0, - STRING0_DESC_LEN, - MANU_DESC_LEN, - PRODUCT_DESC_LEN, - SERIAL_DESC_LEN, - 0, - 0, - 0, - 0 - }, - { - 0, // EPState - 0, // RsvdZ1 - 0, // Mult - 0, // MaxPStreams - 0, // LSA - 0, // Interval - 0, // RsvdZ2 - 0, // RsvdZ3 - 3, // CERR - ED_BULK_OUT, // EPType - 0, // RsvdZ4 - 0, // HID - 0, // MaxBurstSize - 1024, // MaxPacketSize - 0, // PtrLo - 0, // PtrHi - 0x1000, // AverageTRBLength - 0, // MaxESITPayload - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - }, - { - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 3, //CERR - ED_BULK_IN, - 0, - 0, - 0, - 1024, //MaxPacketSize - 0, - 0, - 0x1000, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - } -}; - -/** - Return command register value in XHCI controller. - -**/ -UINT16 -GetXhciPciCommand ( - VOID - ) -{ - UINT8 Bus; - UINT8 Device; - UINT8 Function; - UINT16 Command; - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; - - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); - - Bus =3D UsbDebugPort.PciAddress.Bus; - Device =3D UsbDebugPort.PciAddress.Device; - Function =3D UsbDebugPort.PciAddress.Function; - Command =3D PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND= _OFFSET)); - return Command; -} - -/** - Discover the USB3 debug device. - - @param[in] Instance Pointer to USB3 debug port object instance. - - @retval RETURN_SUCCESS The USB3 debug device was found. - @retval RETURN_DEVICE_ERROR The USB3 debug device was not found. - -**/ -RETURN_STATUS -DiscoverUsb3DebugPort( - IN USB3_DEBUG_PORT_INSTANCE *Instance - ) -{ - UINT8 Bus; - UINT8 Device; - UINT8 Function; - UINT16 Command; - EFI_PHYSICAL_ADDRESS UsbBase; - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; - EFI_PHYSICAL_ADDRESS CapabilityPointer; - UINT32 Capability; - BOOLEAN Flag; - UINT8 CapLength; - - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); - Bus =3D UsbDebugPort.PciAddress.Bus; - Device =3D UsbDebugPort.PciAddress.Device; - Function =3D UsbDebugPort.PciAddress.Function; - if ((PciRead8(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_CLASSCODE_OFFSE= T + 2)) !=3D PCI_CLASS_SERIAL) || - (PciRead8(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_CLASSCODE_OFFSE= T + 1)) !=3D PCI_CLASS_SERIAL_USB) || - (PciRead8(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_CLASSCODE_OFFSE= T)) !=3D 0x30)) { - // - // The device is not XHCI controller - // - return RETURN_NOT_FOUND; - } - - // - // USBBASE is at 10-13h, i.e. the first BAR, clear the low bits which is= not part of base address - // - UsbBase =3D GetXhciBaseAddress (); - - // - // Set XHCI MMIO base address if necessary - // - if ((UsbBase =3D=3D 0) || (UsbBase =3D=3D XHCI_BASE_ADDRESS_64_BIT_MASK)= ) { - UsbBase =3D PcdGet32 (PcdXhciDefaultBaseAddress); - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG= _OFFSET), (UINT32)UsbBase); - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG= _OFFSET + 4), 0x0); - UsbBase =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE= _ADDRESSREG_OFFSET)) & XHCI_BASE_ADDRESS_32_BIT_MASK; - if (UsbBase =3D=3D 0 || UsbBase =3D=3D XHCI_BASE_ADDRESS_32_BIT_MASK) { - return RETURN_DEVICE_ERROR; - } - } - - // - // Set MSE and BME bit - enable the address space - // - Command =3D PciRead16 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAN= D_OFFSET)); - if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) =3D=3D 0) { - PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET),= Command | EFI_PCI_COMMAND_MEMORY_SPACE); - PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET)); - } - - CapLength =3D MmioRead8 ((UINTN) UsbBase); - - // - // Get capability pointer from HCCPARAMS at offset 0x10 - // - CapabilityPointer =3D UsbBase + (MmioRead32 ((UINTN)(UsbBase + XHC_HCCPA= RAMS_OFFSET)) >> 16) * 4; - - // - // Search XHCI debug capability - // - Flag =3D FALSE; - Capability =3D MmioRead32 ((UINTN)CapabilityPointer); - while (TRUE) { - if ((Capability & XHC_CAPABILITY_ID_MASK) =3D=3D PCI_CAPABILITY_ID_DEB= UG_PORT) { - Flag =3D TRUE; - break; - } - if ((((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) & XHC_CAPABILITY_I= D_MASK) =3D=3D 0) { - // - // Reach the end of capability list, quit - // - break; - } - CapabilityPointer +=3D ((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) = * 4; - Capability =3D MmioRead32 ((UINTN)CapabilityPointer); - } - - Instance->Signature =3D USB3_DEBUG_PORT_INSTANCE_SIGNATURE; - - if (Flag) { - Instance->DebugSupport =3D TRUE; - Instance->DebugCapabilityBase =3D CapabilityPointer; - Instance->DebugCapabilityOffset =3D CapabilityPointer - UsbBase; - - Instance->XhciOpRegister =3D UsbBase + CapLength; - Instance->XhcMmioBase =3D UsbBase; - - Instance->PciBusNumber =3D Bus; - Instance->PciDeviceNumber =3D Device; - Instance->PciFunctionNumber =3D Function; - } - - // - // Restore Command Register - // - PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), = Command); - - return RETURN_SUCCESS; -} - -/** - Create XHCI event ring. - - @param Xhc The XHCI Instance. - @param EventRing The created event ring. - -**/ -EFI_STATUS -CreateEventRing ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - OUT EVENT_RING *EventRing - ) -{ - VOID *Buf; - EVENT_RING_SEG_TABLE_ENTRY *ERSTBase; - - ASSERT (EventRing !=3D NULL); - - // - // Allocate Event Ring - // - Buf =3D AllocateAlignBuffer (sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMB= ER); - ASSERT (Buf !=3D NULL); - ASSERT (((UINTN) Buf & 0x3F) =3D=3D 0); - ZeroMem (Buf, sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMBER); - - EventRing->EventRingSeg0 =3D (EFI_PHYSICAL_ADDRESS)(UINTN) Buf; - EventRing->TrbNumber =3D EVENT_RING_TRB_NUMBER; - EventRing->EventRingDequeue =3D (EFI_PHYSICAL_ADDRESS)(UINTN) EventRing-= >EventRingSeg0; - EventRing->EventRingEnqueue =3D (EFI_PHYSICAL_ADDRESS)(UINTN) EventRing-= >EventRingSeg0; - - // - // Software maintains an Event Ring Consumer Cycle State (CCS) bit, init= ializing it to '1' - // and toggling it every time the Event Ring Dequeue Pointer wraps back = to the beginning of the Event Ring. - // - EventRing->EventRingCCS =3D 1; - - // - // Allocate Event Ring Segment Table Entry 0 in Event Ring Segment Table - // - Buf =3D AllocateAlignBuffer (sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERST_= NUMBER); - ASSERT (Buf !=3D NULL); - ASSERT (((UINTN) Buf & 0x3F) =3D=3D 0); - ZeroMem (Buf, sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERST_NUMBER); - - ERSTBase =3D (EVENT_RING_SEG_TABLE_ENTRY *) Buf; - EventRing->ERSTBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN) ERSTBase; - - // - // Fill Event Segment address - // - ERSTBase->PtrLo =3D XHC_LOW_32BIT (EventRing->EventRingSeg0); - ERSTBase->PtrHi =3D XHC_HIGH_32BIT (EventRing->EventRingSeg0); - ERSTBase->RingTrbSize =3D EVENT_RING_TRB_NUMBER; - - // - // Program the Interrupter Event Ring Dequeue Pointer (DCERDP) register = (7.6.4.1) - // - XhcWriteDebugReg ( - Xhc, - XHC_DC_DCERDP, - XHC_LOW_32BIT((UINT64)(UINTN)EventRing->EventRingDequeue) - ); - - XhcWriteDebugReg ( - Xhc, - XHC_DC_DCERDP + 4, - XHC_HIGH_32BIT((UINT64)(UINTN)EventRing->EventRingDequeue) - ); - - // - // Program the Debug Capability Event Ring Segment Table Base Address (D= CERSTBA) register(7.6.4.1) - // - XhcWriteDebugReg ( - Xhc, - XHC_DC_DCERSTBA, - XHC_LOW_32BIT((UINT64)(UINTN)ERSTBase) - ); - - XhcWriteDebugReg ( - Xhc, - XHC_DC_DCERSTBA + 4, - XHC_HIGH_32BIT((UINT64)(UINTN)ERSTBase) - ); - - // - // Program the Debug Capability Event Ring Segment Table Size (DCERSTSZ)= register(7.6.4.1) - // - XhcWriteDebugReg ( - Xhc, - XHC_DC_DCERSTSZ, - ERST_NUMBER - ); - return EFI_SUCCESS; -} - -/** - Create XHCI transfer ring. - - @param Xhc The XHCI Instance. - @param TrbNum The number of TRB in the ring. - @param TransferRing The created transfer ring. - -**/ -VOID -CreateTransferRing ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 TrbNum, - OUT TRANSFER_RING *TransferRing - ) -{ - VOID *Buf; - LINK_TRB *EndTrb; - - Buf =3D AllocateAlignBuffer (sizeof (TRB_TEMPLATE) * TrbNum); - ASSERT (Buf !=3D NULL); - ASSERT (((UINTN) Buf & 0xF) =3D=3D 0); - ZeroMem (Buf, sizeof (TRB_TEMPLATE) * TrbNum); - - TransferRing->RingSeg0 =3D (EFI_PHYSICAL_ADDRESS)(UINTN) Buf; - TransferRing->TrbNumber =3D TrbNum; - TransferRing->RingEnqueue =3D TransferRing->RingSeg0; - TransferRing->RingDequeue =3D TransferRing->RingSeg0; - TransferRing->RingPCS =3D 1; - // - // 4.9.2 Transfer Ring Management - // To form a ring (or circular queue) a Link TRB may be inserted at the = end of a ring to - // point to the first TRB in the ring. - // - EndTrb =3D (LINK_TRB *) ((UINTN)Buf + sizeof (TRB_TEMPLATE) * (Tr= bNum - 1)); - EndTrb->Type =3D TRB_TYPE_LINK; - EndTrb->PtrLo =3D XHC_LOW_32BIT (Buf); - EndTrb->PtrHi =3D XHC_HIGH_32BIT (Buf); - // - // Toggle Cycle (TC). When set to '1', the xHC shall toggle its interpre= tation of the Cycle bit. - // - EndTrb->TC =3D 1; - // - // Set Cycle bit as other TRB PCS init value - // - EndTrb->CycleBit =3D 0; -} - -/** - Create debug capability context for XHC debug device. - - @param Xhc The XHCI Instance. - - @retval EFI_SUCCESS The bit successfully changed by host controller. - @retval EFI_TIMEOUT The time out occurred. - -**/ -EFI_STATUS -CreateDebugCapabilityContext ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc - ) -{ - VOID *Buf; - XHC_DC_CONTEXT *DebugCapabilityContext; - UINT8 *String0Desc; - UINT8 *ManufacturerStrDesc; - UINT8 *ProductStrDesc; - UINT8 *SerialNumberStrDesc; - - // - // Allocate debug device context - // - Buf =3D AllocateAlignBuffer (sizeof (XHC_DC_CONTEXT)); - ASSERT (Buf !=3D NULL); - ASSERT (((UINTN) Buf & 0xF) =3D=3D 0); - ZeroMem (Buf, sizeof (XHC_DC_CONTEXT)); - - DebugCapabilityContext =3D (XHC_DC_CONTEXT *)(UINTN) Buf; - Xhc->DebugCapabilityContext =3D (EFI_PHYSICAL_ADDRESS)(UINTN) DebugCapab= ilityContext; - - CopyMem (DebugCapabilityContext, &DebugCapabilityContextTemplate, sizeof= (XHC_DC_CONTEXT)); - - // - // Update string descriptor address - // - String0Desc =3D (UINT8 *) AllocateAlignBuffer (STRING0_DESC_LEN + MANU_D= ESC_LEN + PRODUCT_DESC_LEN + SERIAL_DESC_LEN); - ASSERT (String0Desc !=3D NULL); - ZeroMem (String0Desc, STRING0_DESC_LEN + MANU_DESC_LEN + PRODUCT_DESC_LE= N + SERIAL_DESC_LEN); - CopyMem (String0Desc, mString0Desc, STRING0_DESC_LEN); - DebugCapabilityContext->DbcInfoContext.String0DescAddress =3D (UINT64)(U= INTN)String0Desc; - - ManufacturerStrDesc =3D String0Desc + STRING0_DESC_LEN; - CopyMem (ManufacturerStrDesc, mManufacturerStrDesc, MANU_DESC_LEN); - DebugCapabilityContext->DbcInfoContext.ManufacturerStrDescAddress =3D (U= INT64)(UINTN)ManufacturerStrDesc; - - ProductStrDesc =3D ManufacturerStrDesc + MANU_DESC_LEN; - CopyMem (ProductStrDesc, mProductStrDesc, PRODUCT_DESC_LEN); - DebugCapabilityContext->DbcInfoContext.ProductStrDescAddress =3D (UINT64= )(UINTN)ProductStrDesc; - - SerialNumberStrDesc =3D ProductStrDesc + PRODUCT_DESC_LEN; - CopyMem (SerialNumberStrDesc, mSerialNumberStrDesc, SERIAL_DESC_LEN); - DebugCapabilityContext->DbcInfoContext.SerialNumberStrDescAddress =3D (U= INT64)(UINTN)SerialNumberStrDesc; - - // - // Allocate and initialize the Transfer Ring for the Input Endpoint Cont= ext. - // - ZeroMem (&Xhc->TransferRingIn, sizeof (TRANSFER_RING)); - CreateTransferRing (Xhc, TR_RING_TRB_NUMBER, &Xhc->TransferRingIn); - - // - // Can not set BIT0, otherwise there is no transfer ring detected. - // - DebugCapabilityContext->EpInContext.PtrLo =3D XHC_LOW_32BIT (Xhc->Transf= erRingIn.RingSeg0) | BIT0; - DebugCapabilityContext->EpInContext.PtrHi =3D XHC_HIGH_32BIT (Xhc->Trans= ferRingIn.RingSeg0); - - // - // Allocate and initialize the Transfer Ring for the Output Endpoint Con= text. - // - ZeroMem (&Xhc->TransferRingOut, sizeof (TRANSFER_RING)); - CreateTransferRing (Xhc, TR_RING_TRB_NUMBER, &Xhc->TransferRingOut); - - // - // Can not set BIT0, otherwise there is no transfer ring detected. - // - DebugCapabilityContext->EpOutContext.PtrLo =3D XHC_LOW_32BIT (Xhc->Trans= ferRingOut.RingSeg0) | BIT0; - DebugCapabilityContext->EpOutContext.PtrHi =3D XHC_HIGH_32BIT (Xhc->Tran= sferRingOut.RingSeg0); - - // - // Program the Debug Capability Context Pointer (DCCP) register(7.6.8.7) - // - XhcWriteDebugReg ( - Xhc, - XHC_DC_DCCP, - XHC_LOW_32BIT((UINT64)(UINTN)DebugCapabilityContext) - ); - XhcWriteDebugReg ( - Xhc, - XHC_DC_DCCP + 4, - XHC_HIGH_32BIT((UINT64)(UINTN)DebugCapabilityContext) - ); - return EFI_SUCCESS; -} - -/** - Initialize the USB3 debug Device hardware. - - @param[in] Instance Pointer to USB3 debug port object instance. - - @retval RETURN_SUCCESS The USB3 debug device was initialized successf= ully. - @retval !RETURN_SUCCESS Error. - -**/ -RETURN_STATUS -InitializeUsb3DebugPort ( - IN USB3_DEBUG_PORT_INSTANCE *Instance - ) -{ - RETURN_STATUS Status; - UINT64 XhciOpRegister; - volatile UINT32 Dcctrl; - UINT8 Bus; - UINT8 Device; - UINT8 Function; - UINT16 Command; - EFI_BOOT_MODE BootMode; - UINT64 TimeOut; - CHAR8 *TestString; - UINTN Length; - UINT32 TransferResult; - - Bus =3D Instance->PciBusNumber; - Device =3D Instance->PciDeviceNumber; - Function =3D Instance->PciFunctionNumber; - - Command =3D GetXhciPciCommand (); - - // - // Save and set Command Register - // - if (((Command & EFI_PCI_COMMAND_MEMORY_SPACE) =3D=3D 0) || ((Command & E= FI_PCI_COMMAND_BUS_MASTER) =3D=3D 0)) { - PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET),= Command | EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER); - PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET)); - } - - // - // Clear DCE bit and LSE bit in DCCTRL - // - if ((XhcReadDebugReg (Instance, XHC_DC_DCCTRL) & (BIT1|BIT31)) =3D=3D (B= IT1|BIT31)) { - XhcClearDebugRegBit (Instance, XHC_DC_DCCTRL, BIT1|BIT31); - } - - XhciOpRegister =3D Instance->XhciOpRegister; - - // - // Get current Boot Mode - // - BootMode =3D GetBootModeHob (); - - if (BootMode !=3D BOOT_ON_S3_RESUME) { - if (!XhcIsBitSet((UINTN)(XhciOpRegister + XHC_USBSTS_OFFSET), XHC_USBS= TS_HALT)) { - XhcClrR32Bit((UINTN) XhciOpRegister + XHC_USBCMD_OFFSET, XHC_USBCMD_= RUN); - while (!XhcIsBitSet((UINTN)(XhciOpRegister + XHC_USBSTS_OFFSET), XHC= _USBSTS_HALT)) { - MicroSecondDelay (10); - } - } - - // - // Reset host controller - // - XhcSetR32Bit((UINTN)XhciOpRegister + XHC_USBCMD_OFFSET, XHC_USBCMD_RES= ET); - - // - // Ensure that the host controller is reset (RESET bit must be cleared= after reset) - // - while (XhcIsBitSet((UINTN)XhciOpRegister + XHC_USBCMD_OFFSET, XHC_USBC= MD_RESET)) { - MicroSecondDelay (10); - } - } - - // - // Initialize event ring - // - ZeroMem (&Instance->EventRing, sizeof (EVENT_RING)); - Status =3D CreateEventRing (Instance, &Instance->EventRing); - ASSERT_EFI_ERROR (Status); - - // - // Init IN and OUT endpoint context - // - Status =3D CreateDebugCapabilityContext (Instance); - ASSERT_EFI_ERROR (Status); - - // - // Init data buffer used to transfer - // - Instance->Urb.Data =3D (EFI_PHYSICAL_ADDRESS) (UINTN) AllocateAlignBuffe= r (XHC_DEBUG_PORT_DATA_LENGTH); - - // - // Init DCDDI1 and DCDDI2 - // - XhcWriteDebugReg ( - Instance, - XHC_DC_DCDDI1, - (UINT32)((XHCI_DEBUG_DEVICE_VENDOR_ID << 16) | XHCI_DEBUG_DEVICE_PROTOC= OL) - ); - - XhcWriteDebugReg ( - Instance, - XHC_DC_DCDDI2, - (UINT32)((XHCI_DEBUG_DEVICE_REVISION << 16) | XHCI_DEBUG_DEVICE_PRODUCT= _ID) - ); - - // - // Set DCE bit and LSE bit to "1" in DCCTRL - // - XhcSetDebugRegBit (Instance, XHC_DC_DCCTRL, BIT1|BIT31); - - TimeOut =3D DivU64x32 (PcdGet64 (PcdXhciHostWaitTimeout), XHC_POLL_DELAY= ) + 1; - while (TimeOut !=3D 0) { - // - // Check if debug device is in configured state - // - Dcctrl =3D XhcReadDebugReg (Instance, XHC_DC_DCCTRL); - if ((Dcctrl & BIT0) !=3D 0) { - // - // Set the flag to indicate debug device is ready - // - Instance->Ready =3D TRUE; - break; - } - MicroSecondDelay (XHC_POLL_DELAY); - TimeOut--; - } - - if (!Instance->Ready) { - XhcClearDebugRegBit (Instance, XHC_DC_DCCTRL, BIT1|BIT31); - } else { - TestString =3D "Usb 3.0 Debug Message Start\n"; - Length =3D AsciiStrLen (TestString); - XhcDataTransfer ( - Instance, - EfiUsbDataOut, - TestString, - &Length, - 0, - &TransferResult - ); - } - - // - // Restore Command Register - // - PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET),= Command); - - return EFI_SUCCESS; -} - -/** - Update XHC hardware address when MMIO base is changed. - - @param Instance The XHCI Instance. - @param XhcMmioBase XHCI MMIO base address. - -**/ -VOID -FixUsb3InstanceResource ( - IN OUT USB3_DEBUG_PORT_INSTANCE *Instance, - IN EFI_PHYSICAL_ADDRESS XhcMmioBase - ) -{ - if ((Instance =3D=3D NULL) || (Instance->XhcMmioBase =3D=3D XhcMmioBase)= ) { - return; - } - - // - // Need fix Instance data according to PCI resource - // - Instance->XhcMmioBase =3D XhcMmioBase; - Instance->DebugCapabilityBase =3D XhcMmioBase + Instance->DebugCapabilit= yOffset; - Instance->XhciOpRegister =3D XhcMmioBase + MmioRead8 ((UINTN)XhcMmi= oBase); -} - -/** - Save USB3 instance address. - - @param[in] Instance The XHCI Instance. - -**/ -VOID -SaveUsb3InstanceAddress ( - IN USB3_DEBUG_PORT_INSTANCE *Instance - ) -{ - UINT16 Command; - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; - UINT8 Bus; - UINT8 Device; - UINT8 Function; - - Command =3D GetXhciPciCommand (); - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); - Bus =3D UsbDebugPort.PciAddress.Bus; - Device =3D UsbDebugPort.PciAddress.Device; - Function =3D UsbDebugPort.PciAddress.Function; - - // - // Set Command Register - // - if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) =3D=3D 0) { - PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET),= Command | EFI_PCI_COMMAND_MEMORY_SPACE); - PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET)); - } - - // - // After debug device is finished to enumerate, use DCDDI2 register to s= tore instance address - // - XhcWriteDebugReg ( - Instance, - XHC_DC_DCDDI2, - (UINT32)(UINTN)Instance - ); - - // - // Restore Command Register - // - PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET),= Command); -} - diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3De= bugPortLibDxe.c b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/U= sb3DebugPortLibDxe.c deleted file mode 100644 index 8c3dd999db..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPort= LibDxe.c +++ /dev/null @@ -1,454 +0,0 @@ -/** @file - Usb3 Debug Port library instance - - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Usb3DebugPortLibInternal.h" - -extern EFI_SMRAM_DESCRIPTOR mSmramCheckRanges[MAX_SMRAM_RANGE]; -extern UINTN mSmramCheckRangeCount; -extern BOOLEAN mUsb3InSmm; -extern UINT64 mUsb3MmioSize; -extern BOOLEAN mUsb3GetCapSuccess; - -GUID gUsb3DbgGuid =3D USB3_DBG_GUID; - -USB3_DEBUG_PORT_CONTROLLER mUsb3DebugPort; -USB3_DEBUG_PORT_INSTANCE *mUsb3Instance =3D NULL; - -/** - Return XHCI MMIO base address. - -**/ -EFI_PHYSICAL_ADDRESS -GetXhciBaseAddress ( - VOID - ) -{ - UINT8 Bus; - UINT8 Device; - UINT8 Function; - EFI_PHYSICAL_ADDRESS Address; - UINT32 Low; - UINT32 High; - - if (mUsb3DebugPort.Controller =3D=3D 0) { - mUsb3DebugPort.Controller =3D GetUsb3DebugPortController(); - } - - Bus =3D mUsb3DebugPort.PciAddress.Bus; - Device =3D mUsb3DebugPort.PciAddress.Device; - Function =3D mUsb3DebugPort.PciAddress.Function; - - Low =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRE= SSREG_OFFSET)); - High =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDR= ESSREG_OFFSET + 4)); - Address =3D (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Low); - // - // Mask other parts which are not part of base address - // - Address &=3D XHCI_BASE_ADDRESS_64_BIT_MASK; - return Address; -} - -/** - Return XHCI debug instance address. - -**/ -USB3_DEBUG_PORT_INSTANCE * -GetUsb3DebugPortInstance ( - VOID - ) -{ - USB3_DEBUG_PORT_INSTANCE *Instance; - EFI_PHYSICAL_ADDRESS XhcMmioBase; - UINT64 CapabilityPointer; - UINT32 Capability; - BOOLEAN Flag; - UINT8 Bus; - UINT8 Device; - UINT8 Function; - UINT16 Command; - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; - - Instance =3D NULL; - - XhcMmioBase =3D GetXhciBaseAddress (); - - if ((XhcMmioBase =3D=3D 0) || (XhcMmioBase =3D=3D XHCI_BASE_ADDRESS_64_B= IT_MASK)) { - return NULL; - } - - if (mUsb3Instance !=3D NULL) { - FixUsb3InstanceResource (mUsb3Instance, XhcMmioBase); - return mUsb3Instance; - } - - Command =3D GetXhciPciCommand (); - - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); - Bus =3D UsbDebugPort.PciAddress.Bus; - Device =3D UsbDebugPort.PciAddress.Device; - Function =3D UsbDebugPort.PciAddress.Function; - - // - // Set Command Register - // - if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) =3D=3D 0) { - PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET),= Command | EFI_PCI_COMMAND_MEMORY_SPACE); - PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET)); - } - - // - // Calculate capability offset from HCCPARAMS [16:31], in 32-bit words - // - CapabilityPointer =3D XhcMmioBase + (MmioRead32 ((UINTN)(XhcMmioBase + X= HC_HCCPARAMS_OFFSET)) >> 16) * 4; - - // - // Search XHCI debug capability - // - Flag =3D FALSE; - Capability =3D MmioRead32 ((UINTN)CapabilityPointer); - while (TRUE) { - if ((Capability & XHC_CAPABILITY_ID_MASK) =3D=3D PCI_CAPABILITY_ID_DEB= UG_PORT) { - Flag =3D TRUE; - break; - } - if ((((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) & XHC_CAPABILITY_I= D_MASK) =3D=3D 0) { - // - // Reach the end of list, quit - // - break; - } - CapabilityPointer +=3D ((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) = * 4; - Capability =3D MmioRead32 ((UINTN)CapabilityPointer); - } - - if (Flag) { - Instance =3D (USB3_DEBUG_PORT_INSTANCE *)(UINTN) MmioRead32 ((UINTN) (= CapabilityPointer + XHC_DC_DCDDI2)); - - if (Instance !=3D NULL) { - FixUsb3InstanceResource (Instance, XhcMmioBase); - } - } - - // - // Restore Command Register - // - PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), = Command); - - return Instance; -} - - -/** - Initialize USB3 debug port. - - This method invokes various internal functions to facilitate - detection and initialization of USB3 debug port. - - @retval RETURN_SUCCESS The USB3 debug port was initialized. -**/ -RETURN_STATUS -EFIAPI -USB3Initialize ( - VOID - ) -{ - // - // Leave it empty, we assume PEI phase already do initialization - // - return RETURN_SUCCESS; -} - -/** - Initialize USB3 debug port. - - This method invokes various internal functions to facilitate - detection and initialization of USB3 debug port. - - @retval RETURN_SUCCESS The serial device was initialized. -**/ -RETURN_STATUS -EFIAPI -USB3InitializeReal ( - VOID - ) -{ - USB3_DEBUG_PORT_INSTANCE UsbDbg; - USB3_DEBUG_PORT_INSTANCE *Instance; - EFI_PHYSICAL_ADDRESS Address; - EFI_STATUS Status; - - if ((gST =3D=3D NULL) || (gBS =3D=3D NULL)) { - // - // gST and gBS have not been initialized yet - // - return EFI_DEVICE_ERROR; - } - - Status =3D EfiGetSystemConfigurationTable (&gUsb3DbgGuid, (VOID **) &mUs= b3Instance); - if (!EFI_ERROR (Status)) { - return RETURN_SUCCESS; - } - - // - // It is first time to run DXE instance, copy Instance from Hob to ACPIN= vs - // NOTE: Hob is not ready at this time, so copy it from XHCI register. - // - Instance =3D GetUsb3DebugPortInstance (); - if (Instance =3D=3D NULL) { - // - // Initialize USB debug - // - SetMem (&UsbDbg, sizeof(UsbDbg), 0); - DiscoverUsb3DebugPort (&UsbDbg); - if (UsbDbg.DebugSupport) { - InitializeUsb3DebugPort (&UsbDbg); - } - Instance =3D &UsbDbg; - } - Address =3D SIZE_4GB; - Status =3D gBS->AllocatePages ( - AllocateMaxAddress, - EfiACPIMemoryNVS, - EFI_SIZE_TO_PAGES (sizeof (USB3_DEBUG_PORT_INSTANCE)), - &Address - ); - if (EFI_ERROR (Status)) { - return Status; - } - - CopyMem ( - (VOID *)(UINTN)Address, - Instance, - sizeof (USB3_DEBUG_PORT_INSTANCE) - ); - mUsb3Instance =3D (USB3_DEBUG_PORT_INSTANCE *)(UINTN)Address; - - Status =3D gBS->InstallConfigurationTable (&gUsb3DbgGuid, mUsb3Instance); - if (EFI_ERROR (Status)) { - return Status; - } - - if (mUsb3Instance->DebugSupport) { - SaveUsb3InstanceAddress (mUsb3Instance); - } - - return RETURN_SUCCESS; -} - -/** - Calculate the size of XHCI MMIO space. - - @retval TURE The XHCI MMIO is in SMRAM ranges. - @retval FALSE The XHCI MMIO is out of SMRAM ranges. -**/ -UINT64 -CalculateMmioSize ( - VOID - ) -{ - UINT8 Bus; - UINT8 Device; - UINT8 Function; - UINT32 Value; - UINT32 Mask; - UINT64 MmioSize; - UINT16 Command; - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; - EFI_PHYSICAL_ADDRESS XhcMmioBase; - - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); - Bus =3D UsbDebugPort.PciAddress.Bus; - Device =3D UsbDebugPort.PciAddress.Device; - Function =3D UsbDebugPort.PciAddress.Function; - - Mask =3D 0xFFFFFFF0; - MmioSize =3D 0; - - XhcMmioBase =3D GetXhciBaseAddress (); - - // - // Disable MSE - // - Command =3D PciRead16 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAN= D_OFFSET)); - PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET),= Command & ~(EFI_PCI_COMMAND_MEMORY_SPACE)); - - // - // Get Mmio Size - // - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_O= FFSET), 0xFFFFFFFF); - Value =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_= ADDRESSREG_OFFSET)); - - switch (Value & 0x07) { - case 0x0: - // - // Memory space: anywhere in 32 bit address space - // - MmioSize =3D (~(Value & Mask)) + 1; - break; - case 0x4: - // - // Memory space: anywhere in 64 bit address space - // - MmioSize =3D Value & Mask; - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSR= EG_OFFSET + 4), 0xFFFFFFFF); - Value =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_B= ASE_ADDRESSREG_OFFSET + 4)); - // - // Fix the length to support some spefic 64 bit BAR - // - Value |=3D ((UINT32)(-1) << HighBitSet32 (Value)); - // - // Calculate the size of 64bit bar - // - MmioSize |=3D LShiftU64 ((UINT64) Value, 32); - MmioSize =3D (~(MmioSize)) + 1; - break; - default: - // - // Unknown BAR type - // - MmioSize =3D (~(Value & Mask)) + 1; - break; - }; - - - // - // Restore MMIO address - // - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_O= FFSET), (UINT32)XhcMmioBase); - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_O= FFSET + 4), (UINT32) (XhcMmioBase >> 32)); - - PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET),= Command | EFI_PCI_COMMAND_MEMORY_SPACE); - - return MmioSize; -} - -/** - The constructor function initialize USB3 debug port. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -Usb3DebugPortLibDxeConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_SMM_BASE2_PROTOCOL *SmmBase; - EFI_SMM_ACCESS2_PROTOCOL *SmmAccess; - UINTN Size; - EFI_STATUS Status; - - // - // Do real initialization here, because we need copy data from Hob to AC= PINvs. - // We must do it in constructor because it depends on UefiBootServicesTa= bleLib. - // - if (FeaturePcdGet (PcdStatusCodeUseUsb3Serial)) { - USB3InitializeReal (); - } - - mUsb3MmioSize =3D CalculateMmioSize (); - - if (gBS !=3D NULL) { - SmmBase =3D NULL; - Status =3D gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID= **)&SmmBase); - if (!EFI_ERROR (Status)) { - SmmBase->InSmm(SmmBase, &mUsb3InSmm); - } - - if (mUsb3InSmm) { - // - // Get SMRAM information - // - SmmAccess =3D NULL; - Status =3D gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (= VOID **)&SmmAccess); - if (!EFI_ERROR (Status)) { - Size =3D sizeof (mSmramCheckRanges); - - Status =3D SmmAccess->GetCapabilities (SmmAccess, &Size, mSmramChe= ckRanges); - if (!EFI_ERROR (Status)) { - mSmramCheckRangeCount =3D Size / sizeof (EFI_SMRAM_DESCRIPTOR); - } - } - } - } - - return EFI_SUCCESS; -} - -/** - Allocate aligned memory for XHC's usage. - - @param BufferSize The size, in bytes, of the Buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID* -AllocateAlignBuffer ( - IN UINTN BufferSize - ) -{ - VOID *Buf; - EFI_PHYSICAL_ADDRESS Address; - EFI_STATUS Status; - - Buf =3D NULL; - - if (gBS !=3D NULL) { - Address =3D 0xFFFFFFFF; - Status =3D gBS->AllocatePages ( - AllocateMaxAddress, - EfiACPIMemoryNVS, - EFI_SIZE_TO_PAGES (BufferSize), - &Address - ); - if (!EFI_ERROR (Status)) { - Buf =3D (VOID *)(UINTN)Address; - } - } - - return Buf; -} - -/** - Check whether AllocatePages in permanent memory is ready. - - @retval TRUE AllocatePages in permanent memory is ready. - @retval FALSE AllocatePages in permanent memory is not ready. - -**/ -BOOLEAN -IsAllocatePagesReady ( - VOID - ) -{ - if (gBS !=3D NULL) { - return TRUE; - } - - return FALSE; -} - diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3De= bugPortLibDxe.inf b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortLibDxe.inf deleted file mode 100644 index e238fa0de9..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPort= LibDxe.inf +++ /dev/null @@ -1,55 +0,0 @@ -## @file -# Usb3 debug port library. -# -# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D Usb3DebugPortLibDxe - FILE_GUID =3D 08A575C4-D962-4ca5-8855-D3B4AE93A141 - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D Usb3DebugPortLib|DXE_CORE DXE_DRIVER = DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIV= ER SMM_CORE - CONSTRUCTOR =3D Usb3DebugPortLibDxeConstructor - -# -# The following information is for reference only and not required by the = build tools. -# -# VALID_ARCHITECTURES =3D IA32 X64 IPF -# - -[Sources] - Usb3DebugPortLibDxe.c - Usb3DebugPortDataTransfer.c - Usb3DebugPortInitialize.c - MiscServices.c - Usb3DebugPortLibInternal.h - -[Packages] - MdePkg/MdePkg.dec - DebugFeaturePkg/DebugFeaturePkg.dec - -[LibraryClasses] - BaseLib - PcdLib - IoLib - PciLib - TimerLib - UefiBootServicesTableLib - UefiLib - HobLib - Usb3DebugPortParameterLib - -[Protocols] - gEfiSmmAccess2ProtocolGuid ## CONSUMES - gEfiSmmBase2ProtocolGuid ## CONSUMES - -[Pcd] - gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOMETIME= S_CONSUMES - gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONSUMES - -[FeaturePcd] - gDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseUsb3Serial ## CONSUMES diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3De= bugPortLibDxeIoMmu.c b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPort= Lib/Usb3DebugPortLibDxeIoMmu.c deleted file mode 100644 index 97c3f88113..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPort= LibDxeIoMmu.c +++ /dev/null @@ -1,828 +0,0 @@ -/** @file - Usb3 Debug Port library instance - - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Usb3DebugPortLibInternal.h" - -extern EFI_SMRAM_DESCRIPTOR mSmramCheckRanges[MAX_SMRAM_RANGE]; -extern UINTN mSmramCheckRangeCount; -extern BOOLEAN mUsb3InSmm; -extern UINT64 mUsb3MmioSize; -extern BOOLEAN mUsb3GetCapSuccess; - -GUID gUsb3DbgGuid =3D USB3_DBG_GUID; - -USB3_DEBUG_PORT_CONTROLLER mUsb3DebugPort; -USB3_DEBUG_PORT_INSTANCE *mUsb3Instance =3D NULL; -EFI_PCI_IO_PROTOCOL *mUsb3PciIo =3D NULL; - -/** - Creates a named event that can be signaled. - - This function creates an event using NotifyTpl, NoifyFunction. - If Name is NULL, then ASSERT(). - If NotifyTpl is not a legal TPL value, then ASSERT(). - If NotifyFunction is NULL, then ASSERT(). - - @param Name Supplies the GUID name of the event. - @param NotifyTpl Supplies the task priority level of the ev= ent notifications. - @param NotifyFunction Supplies the function to notify when the e= vent is signaled. - @param Event A pointer to the event created. - - @retval EFI_SUCCESS A named event was created. - @retval EFI_OUT_OF_RESOURCES There are not enough resource to create th= e named event. - -**/ -EFI_STATUS -EFIAPI -Usb3NamedEventListen ( - IN CONST EFI_GUID *Name, - IN EFI_TPL NotifyTpl, - IN EFI_EVENT_NOTIFY NotifyFunction, - IN EFI_EVENT *Event - ) -{ - EFI_STATUS Status; - VOID *RegistrationLocal; - - ASSERT (Name !=3D NULL); - ASSERT (NotifyFunction !=3D NULL); - ASSERT (NotifyTpl <=3D TPL_HIGH_LEVEL); - - // - // Create event - // - Status =3D gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - NotifyTpl, - NotifyFunction, - NULL, - Event - ); - ASSERT_EFI_ERROR (Status); - - // - // Register for an installation of protocol interface - // - Status =3D gBS->RegisterProtocolNotify ( - (EFI_GUID *) Name, - *Event, - &RegistrationLocal - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - USB3 map one DMA buffer. - - @param PciIo Pointer to PciIo for USB3 debug port. - @param Address DMA buffer address to be mapped. - @param NumberOfBytes Number of bytes to be mapped. - -**/ -VOID -Usb3MapOneDmaBuffer ( - IN EFI_PCI_IO_PROTOCOL *PciIo, - IN EFI_PHYSICAL_ADDRESS Address, - IN UINTN NumberOfBytes - ) -{ - EFI_STATUS Status; - VOID *HostAddress; - EFI_PHYSICAL_ADDRESS DeviceAddress; - VOID *Mapping; - - HostAddress =3D (VOID *) (UINTN) Address; - Status =3D PciIo->Map ( - PciIo, - EfiPciIoOperationBusMasterCommonBuffer, - HostAddress, - &NumberOfBytes, - &DeviceAddress, - &Mapping - ); - ASSERT_EFI_ERROR (Status); - ASSERT (DeviceAddress =3D=3D ((EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress= )); -} - -/** - USB3 map DMA buffers. - - @param Instance Pointer to USB3 debug port instance. - @param PciIo Pointer to PciIo for USB3 debug port. - -**/ -VOID -Usb3MapDmaBuffers ( - IN USB3_DEBUG_PORT_INSTANCE *Instance, - IN EFI_PCI_IO_PROTOCOL *PciIo - ) -{ - Usb3MapOneDmaBuffer ( - PciIo, - Instance->Urb.Data, - XHC_DEBUG_PORT_DATA_LENGTH - ); - - Usb3MapOneDmaBuffer ( - PciIo, - Instance->TransferRingIn.RingSeg0, - sizeof (TRB_TEMPLATE) * TR_RING_TRB_NUMBER - ); - - Usb3MapOneDmaBuffer ( - PciIo, - Instance->TransferRingOut.RingSeg0, - sizeof (TRB_TEMPLATE) * TR_RING_TRB_NUMBER - ); - - Usb3MapOneDmaBuffer ( - PciIo, - Instance->EventRing.EventRingSeg0, - sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMBER - ); - - Usb3MapOneDmaBuffer ( - PciIo, - Instance->EventRing.ERSTBase, - sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERST_NUMBER - ); - - Usb3MapOneDmaBuffer ( - PciIo, - Instance->DebugCapabilityContext, - sizeof (XHC_DC_CONTEXT) - ); - - Usb3MapOneDmaBuffer ( - PciIo, - ((XHC_DC_CONTEXT *) (UINTN) Instance->DebugCapabilityContext)->DbcInfo= Context.String0DescAddress, - STRING0_DESC_LEN + MANU_DESC_LEN + PRODUCT_DESC_LEN + SERIAL_DESC_LEN - ); -} - -/** - Invoke a notification event - - @param[in] Event Event whose notification function is b= eing invoked. - @param[in] Context The pointer to the notification functi= on's context, - which is implementation-dependent. - -**/ -VOID -EFIAPI -Usb3DxeSmmReadyToLockNotify ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - ASSERT (mUsb3Instance !=3D NULL); - - // - // For the case that the USB3 debug port instance and DMA buffers are - // from PEI HOB with IOMMU enabled. - // Reinitialize USB3 debug port with granted DXE DMA buffer accessible - // by SMM environment. - // - InitializeUsb3DebugPort (mUsb3Instance); - - SaveUsb3InstanceAddress (mUsb3Instance); - - gBS->CloseEvent (Event); -} - -/** - USB3 get IOMMU protocol. - - @return Pointer to IOMMU protocol. - -**/ -EDKII_IOMMU_PROTOCOL * -Usb3GetIoMmu ( - VOID - ) -{ - EFI_STATUS Status; - EDKII_IOMMU_PROTOCOL *IoMmu; - - IoMmu =3D NULL; - Status =3D gBS->LocateProtocol ( - &gEdkiiIoMmuProtocolGuid, - NULL, - (VOID **) &IoMmu - ); - if (!EFI_ERROR (Status) && (IoMmu !=3D NULL)) { - return IoMmu; - } - - return NULL; -} - -/** - Invoke a notification event - - @param[in] Event Event whose notification function is b= eing invoked. - @param[in] Context The pointer to the notification functi= on's context, - which is implementation-dependent. - -**/ -VOID -EFIAPI -Usb3PciIoNotify ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - EFI_STATUS Status; - UINTN PciIoHandleCount; - EFI_HANDLE *PciIoHandleBuffer; - UINTN Index; - EFI_PCI_IO_PROTOCOL *PciIo; - UINTN PciSegment; - UINTN PciBusNumber; - UINTN PciDeviceNumber; - UINTN PciFunctionNumber; - EFI_EVENT SmmReadyToLockEvent; - - Status =3D gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiPciIoProtocolGuid, - NULL, - &PciIoHandleCount, - &PciIoHandleBuffer - ); - if (!EFI_ERROR (Status) && - (PciIoHandleBuffer !=3D NULL) && - (PciIoHandleCount !=3D 0)) { - for (Index =3D 0; Index < PciIoHandleCount; Index++) { - Status =3D gBS->HandleProtocol ( - PciIoHandleBuffer[Index], - &gEfiPciIoProtocolGuid, - (VOID **) &PciIo - ); - ASSERT_EFI_ERROR (Status); - Status =3D PciIo->GetLocation (PciIo, &PciSegment, &PciBusNumber, &P= ciDeviceNumber, &PciFunctionNumber); - ASSERT_EFI_ERROR (Status); - if ((PciBusNumber =3D=3D mUsb3DebugPort.PciAddress.Bus) && - (PciDeviceNumber =3D=3D mUsb3DebugPort.PciAddress.Device) && - (PciFunctionNumber =3D=3D mUsb3DebugPort.PciAddress.Function)) { - // - // Found the PciIo for USB3 debug port. - // - ASSERT (mUsb3Instance !=3D NULL); - if (Usb3GetIoMmu () !=3D NULL) { - Usb3MapDmaBuffers (mUsb3Instance, PciIo); - - if (mUsb3Instance->FromHob) { - mUsb3PciIo =3D PciIo; - Usb3NamedEventListen ( - &gEfiDxeSmmReadyToLockProtocolGuid, - TPL_NOTIFY, - Usb3DxeSmmReadyToLockNotify, - &SmmReadyToLockEvent - ); - } - } - gBS->CloseEvent (Event); - break; - } - } - - gBS->FreePool (PciIoHandleBuffer); - } -} - -/** - Return XHCI MMIO base address. - -**/ -EFI_PHYSICAL_ADDRESS -GetXhciBaseAddress ( - VOID - ) -{ - UINT8 Bus; - UINT8 Device; - UINT8 Function; - EFI_PHYSICAL_ADDRESS Address; - UINT32 Low; - UINT32 High; - - if (mUsb3DebugPort.Controller =3D=3D 0) { - mUsb3DebugPort.Controller =3D GetUsb3DebugPortController(); - } - - Bus =3D mUsb3DebugPort.PciAddress.Bus; - Device =3D mUsb3DebugPort.PciAddress.Device; - Function =3D mUsb3DebugPort.PciAddress.Function; - - Low =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRE= SSREG_OFFSET)); - High =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDR= ESSREG_OFFSET + 4)); - Address =3D (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Low); - // - // Mask other parts which are not part of base address - // - Address &=3D XHCI_BASE_ADDRESS_64_BIT_MASK; - return Address; -} - -/** - Return XHCI debug instance address. - -**/ -USB3_DEBUG_PORT_INSTANCE * -GetUsb3DebugPortInstance ( - VOID - ) -{ - USB3_DEBUG_PORT_INSTANCE *Instance; - EFI_PHYSICAL_ADDRESS XhcMmioBase; - UINT64 CapabilityPointer; - UINT32 Capability; - BOOLEAN Flag; - UINT8 Bus; - UINT8 Device; - UINT8 Function; - UINT16 Command; - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; - - Instance =3D NULL; - - XhcMmioBase =3D GetXhciBaseAddress (); - - if ((XhcMmioBase =3D=3D 0) || (XhcMmioBase =3D=3D XHCI_BASE_ADDRESS_64_B= IT_MASK)) { - return NULL; - } - - if (mUsb3Instance !=3D NULL) { - FixUsb3InstanceResource (mUsb3Instance, XhcMmioBase); - return mUsb3Instance; - } - - Command =3D GetXhciPciCommand (); - - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); - Bus =3D UsbDebugPort.PciAddress.Bus; - Device =3D UsbDebugPort.PciAddress.Device; - Function =3D UsbDebugPort.PciAddress.Function; - - // - // Set Command Register - // - if ((Command & EFI_PCI_COMMAND_MEMORY_SPACE) =3D=3D 0) { - PciWrite16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET),= Command | EFI_PCI_COMMAND_MEMORY_SPACE); - PciRead16(PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAND_OFFSET)); - } - - // - // Calculate capability offset from HCCPARAMS [16:31], in 32-bit words - // - CapabilityPointer =3D XhcMmioBase + (MmioRead32 ((UINTN)(XhcMmioBase + X= HC_HCCPARAMS_OFFSET)) >> 16) * 4; - - // - // Search XHCI debug capability - // - Flag =3D FALSE; - Capability =3D MmioRead32 ((UINTN)CapabilityPointer); - while (TRUE) { - if ((Capability & XHC_CAPABILITY_ID_MASK) =3D=3D PCI_CAPABILITY_ID_DEB= UG_PORT) { - Flag =3D TRUE; - break; - } - if ((((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) & XHC_CAPABILITY_I= D_MASK) =3D=3D 0) { - // - // Reach the end of list, quit - // - break; - } - CapabilityPointer +=3D ((Capability & XHC_NEXT_CAPABILITY_MASK) >> 8) = * 4; - Capability =3D MmioRead32 ((UINTN)CapabilityPointer); - } - - if (Flag) { - Instance =3D (USB3_DEBUG_PORT_INSTANCE *)(UINTN) MmioRead32 ((UINTN) (= CapabilityPointer + XHC_DC_DCDDI2)); - - if (Instance !=3D NULL) { - FixUsb3InstanceResource (Instance, XhcMmioBase); - } - } - - // - // Restore Command Register - // - PciWrite16(PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), = Command); - - return Instance; -} - - -/** - Initialize USB3 debug port. - - This method invokes various internal functions to facilitate - detection and initialization of USB3 debug port. - - @retval RETURN_SUCCESS The USB3 debug port was initialized. -**/ -RETURN_STATUS -EFIAPI -USB3Initialize ( - VOID - ) -{ - // - // Leave it empty, we assume PEI phase already do initialization - // - return RETURN_SUCCESS; -} - -/** - Initialize USB3 debug port. - - This method invokes various internal functions to facilitate - detection and initialization of USB3 debug port. - - @retval RETURN_SUCCESS The serial device was initialized. -**/ -RETURN_STATUS -EFIAPI -USB3InitializeReal ( - VOID - ) -{ - USB3_DEBUG_PORT_INSTANCE UsbDbg; - USB3_DEBUG_PORT_INSTANCE *Instance; - EFI_PHYSICAL_ADDRESS Address; - EFI_STATUS Status; - EFI_EVENT Event; - - if ((gST =3D=3D NULL) || (gBS =3D=3D NULL)) { - // - // gST and gBS have not been initialized yet - // - return EFI_DEVICE_ERROR; - } - - Status =3D EfiGetSystemConfigurationTable (&gUsb3DbgGuid, (VOID **) &mUs= b3Instance); - if (!EFI_ERROR (Status)) { - goto Done; - } - - // - // It is first time to run DXE instance, copy Instance from Hob to ACPIN= vs - // NOTE: Hob is not ready at this time, so copy it from XHCI register. - // - Instance =3D GetUsb3DebugPortInstance (); - if (Instance =3D=3D NULL) { - // - // Initialize USB debug - // - SetMem (&UsbDbg, sizeof(UsbDbg), 0); - DiscoverUsb3DebugPort (&UsbDbg); - if (UsbDbg.DebugSupport) { - InitializeUsb3DebugPort (&UsbDbg); - } - Instance =3D &UsbDbg; - } - Address =3D SIZE_4GB; - Status =3D gBS->AllocatePages ( - AllocateMaxAddress, - EfiACPIMemoryNVS, - EFI_SIZE_TO_PAGES (sizeof (USB3_DEBUG_PORT_INSTANCE)), - &Address - ); - if (EFI_ERROR (Status)) { - return Status; - } - - CopyMem ( - (VOID *)(UINTN)Address, - Instance, - sizeof (USB3_DEBUG_PORT_INSTANCE) - ); - mUsb3Instance =3D (USB3_DEBUG_PORT_INSTANCE *)(UINTN)Address; - - Status =3D gBS->InstallConfigurationTable (&gUsb3DbgGuid, mUsb3Instance); - if (EFI_ERROR (Status)) { - return Status; - } - - if (mUsb3Instance->DebugSupport) { - SaveUsb3InstanceAddress (mUsb3Instance); - } - -Done: - if ((mUsb3Instance !=3D NULL) && mUsb3Instance->Ready && (mUsb3Instance-= >PciIoEvent =3D=3D 0)) { - Status =3D Usb3NamedEventListen ( - &gEfiPciIoProtocolGuid, - TPL_NOTIFY, - Usb3PciIoNotify, - &Event - ); - if (!EFI_ERROR (Status)) { - mUsb3Instance->PciIoEvent =3D (EFI_PHYSICAL_ADDRESS) (UINTN) Event; - } - } - - return RETURN_SUCCESS; -} - -/** - Calculate the size of XHCI MMIO space. - - @retval TURE The XHCI MMIO is in SMRAM ranges. - @retval FALSE The XHCI MMIO is out of SMRAM ranges. -**/ -UINT64 -CalculateMmioSize ( - VOID - ) -{ - UINT8 Bus; - UINT8 Device; - UINT8 Function; - UINT32 Value; - UINT32 Mask; - UINT64 MmioSize; - UINT16 Command; - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; - EFI_PHYSICAL_ADDRESS XhcMmioBase; - - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); - Bus =3D UsbDebugPort.PciAddress.Bus; - Device =3D UsbDebugPort.PciAddress.Device; - Function =3D UsbDebugPort.PciAddress.Function; - - Mask =3D 0xFFFFFFF0; - MmioSize =3D 0; - - XhcMmioBase =3D GetXhciBaseAddress (); - - // - // Disable MSE - // - Command =3D PciRead16 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_COMMAN= D_OFFSET)); - PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET),= Command & ~(EFI_PCI_COMMAND_MEMORY_SPACE)); - - // - // Get Mmio Size - // - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_O= FFSET), 0xFFFFFFFF); - Value =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_= ADDRESSREG_OFFSET)); - - switch (Value & 0x07) { - case 0x0: - // - // Memory space: anywhere in 32 bit address space - // - MmioSize =3D (~(Value & Mask)) + 1; - break; - case 0x4: - // - // Memory space: anywhere in 64 bit address space - // - MmioSize =3D Value & Mask; - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSR= EG_OFFSET + 4), 0xFFFFFFFF); - Value =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_B= ASE_ADDRESSREG_OFFSET + 4)); - // - // Fix the length to support some spefic 64 bit BAR - // - Value |=3D ((UINT32)(-1) << HighBitSet32 (Value)); - // - // Calculate the size of 64bit bar - // - MmioSize |=3D LShiftU64 ((UINT64) Value, 32); - MmioSize =3D (~(MmioSize)) + 1; - break; - default: - // - // Unknown BAR type - // - MmioSize =3D (~(Value & Mask)) + 1; - break; - }; - - - // - // Restore MMIO address - // - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_O= FFSET), (UINT32)XhcMmioBase); - PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_O= FFSET + 4), (UINT32) (XhcMmioBase >> 32)); - - PciWrite16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET),= Command | EFI_PCI_COMMAND_MEMORY_SPACE); - - return MmioSize; -} - -/** - The constructor function initialize USB3 debug port. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -Usb3DebugPortLibDxeConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_SMM_BASE2_PROTOCOL *SmmBase; - EFI_SMM_ACCESS2_PROTOCOL *SmmAccess; - UINTN Size; - EFI_STATUS Status; - - // - // Do real initialization here, because we need copy data from Hob to AC= PINvs. - // We must do it in constructor because it depends on UefiBootServicesTa= bleLib. - // - if (FeaturePcdGet (PcdStatusCodeUseUsb3Serial)) { - USB3InitializeReal (); - } - - mUsb3MmioSize =3D CalculateMmioSize (); - - if (gBS !=3D NULL) { - SmmBase =3D NULL; - Status =3D gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID= **)&SmmBase); - if (!EFI_ERROR (Status)) { - SmmBase->InSmm(SmmBase, &mUsb3InSmm); - } - - if (mUsb3InSmm) { - // - // Get SMRAM information - // - SmmAccess =3D NULL; - Status =3D gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (= VOID **)&SmmAccess); - if (!EFI_ERROR (Status)) { - Size =3D sizeof (mSmramCheckRanges); - - Status =3D SmmAccess->GetCapabilities (SmmAccess, &Size, mSmramChe= ckRanges); - if (!EFI_ERROR (Status)) { - mSmramCheckRangeCount =3D Size / sizeof (EFI_SMRAM_DESCRIPTOR); - } - } - } - } - - return EFI_SUCCESS; -} - -/** - The destructor function. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The destructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -Usb3DebugPortLibDxeDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - if ((mUsb3Instance !=3D NULL) && (mUsb3Instance->PciIoEvent !=3D 0)) { - // - // Close the event created. - // - gBS->CloseEvent ((EFI_EVENT) (UINTN) mUsb3Instance->PciIoEvent); - mUsb3Instance->PciIoEvent =3D 0; - } - return EFI_SUCCESS; -} - -/** - Allocates pages that are suitable for an OperationBusMasterCommonBuffer = or - OperationBusMasterCommonBuffer64 mapping. - - @param PciIo Pointer to PciIo for USB3 debug port. - @param Pages The number of pages to allocate. - @param Address A pointer to store the base system memory = address of the - allocated range. - - @retval EFI_SUCCESS The requested memory pages were allocated. - @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal = attribute bits are - MEMORY_WRITE_COMBINE and MEMORY_CACHED. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. - @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. - -**/ -EFI_STATUS -Usb3AllocateDmaBuffer ( - IN EFI_PCI_IO_PROTOCOL *PciIo, - IN UINTN Pages, - OUT VOID **Address - ) -{ - EFI_STATUS Status; - - *Address =3D NULL; - Status =3D PciIo->AllocateBuffer ( - PciIo, - AllocateAnyPages, - EfiRuntimeServicesData, - Pages, - Address, - 0 - ); - if (!EFI_ERROR (Status)) { - Usb3MapOneDmaBuffer ( - PciIo, - (EFI_PHYSICAL_ADDRESS) (UINTN) *Address, - EFI_PAGES_TO_SIZE (Pages) - ); - } - return Status; -} - -/** - Allocate aligned memory for XHC's usage. - - @param BufferSize The size, in bytes, of the Buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID* -AllocateAlignBuffer ( - IN UINTN BufferSize - ) -{ - VOID *Buf; - EFI_PHYSICAL_ADDRESS Address; - EFI_STATUS Status; - - Buf =3D NULL; - - if (gBS !=3D NULL) { - if (mUsb3PciIo !=3D NULL) { - Usb3AllocateDmaBuffer ( - mUsb3PciIo, - EFI_SIZE_TO_PAGES (BufferSize), - &Buf - ); - } else { - Address =3D 0xFFFFFFFF; - Status =3D gBS->AllocatePages ( - AllocateMaxAddress, - EfiACPIMemoryNVS, - EFI_SIZE_TO_PAGES (BufferSize), - &Address - ); - if (!EFI_ERROR (Status)) { - Buf =3D (VOID *)(UINTN)Address; - } - } - } - - return Buf; -} - -/** - Check whether AllocatePages in permanent memory is ready. - - @retval TRUE AllocatePages in permanent memory is ready. - @retval FALSE AllocatePages in permanent memory is not ready. - -**/ -BOOLEAN -IsAllocatePagesReady ( - VOID - ) -{ - if (gBS !=3D NULL) { - return TRUE; - } - - return FALSE; -} - diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3De= bugPortLibDxeIoMmu.inf b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPo= rtLib/Usb3DebugPortLibDxeIoMmu.inf deleted file mode 100644 index c9c56d7ade..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPort= LibDxeIoMmu.inf +++ /dev/null @@ -1,63 +0,0 @@ -## @file -# Usb3 debug port library. -# -# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D Usb3DebugPortLibDxeIoMmu - FILE_GUID =3D BC48A65D-5E5E-4512-8ACC-90E79E2D80C2 - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D Usb3DebugPortLib|DXE_CORE DXE_DRIVER = DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIV= ER SMM_CORE - CONSTRUCTOR =3D Usb3DebugPortLibDxeConstructor - DESTRUCTOR =3D Usb3DebugPortLibDxeDestructor - -# -# The following information is for reference only and not required by the = build tools. -# -# VALID_ARCHITECTURES =3D IA32 X64 IPF -# - -[Sources] - Usb3DebugPortLibDxeIoMmu.c - Usb3DebugPortDataTransfer.c - Usb3DebugPortInitialize.c - MiscServices.c - Usb3DebugPortLibInternal.h - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - DebugFeaturePkg/DebugFeaturePkg.dec - -[LibraryClasses] - BaseLib - PcdLib - IoLib - PciLib - TimerLib - UefiBootServicesTableLib - UefiLib - HobLib - Usb3DebugPortParameterLib - -[Protocols] - gEfiSmmAccess2ProtocolGuid ## CONSUMES - gEfiSmmBase2ProtocolGuid ## CONSUMES - ## NOTIFY - ## SOMETIMES_CONSUMES - gEfiPciIoProtocolGuid - gEdkiiIoMmuProtocolGuid ## SOMETIMES_CONSUMES - ## NOTIFY - gEfiDxeSmmReadyToLockProtocolGuid - -[Pcd] - gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOMETIME= S_CONSUMES - gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONSUMES - -[FeaturePcd] - gDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseUsb3Serial ## CONSUMES diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3De= bugPortLibInternal.h b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPort= Lib/Usb3DebugPortLibInternal.h deleted file mode 100644 index 3641cc1d52..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPort= LibInternal.h +++ /dev/null @@ -1,887 +0,0 @@ -/** @file - This library class provides common Usb debug port functions. - - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef __USB3_DEBUG_PORT_LIB_INTERNAL__ -#define __USB3_DEBUG_PORT_LIB_INTERNAL__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// -// USB Debug GUID value -// -#define USB3_DBG_GUID \ - { \ - 0xb2a56f4d, 0x9177, 0x4fc8, { 0xa6, 0x77, 0xdd, 0x96, 0x3e, 0xb4, 0x= cb, 0x1b } \ - } - -// -// Define the maximum of SMRAM ranges -// -#define MAX_SMRAM_RANGE 8 - -#define XHCI_DEBUG_DEVICE_VENDOR_ID 0x8086 -#define XHCI_DEBUG_DEVICE_PRODUCT_ID 0x1234 -#define XHCI_DEBUG_DEVICE_PROTOCOL 0xFF -#define XHCI_DEBUG_DEVICE_REVISION 0x00 - -#define XHCI_BASE_ADDRESS_64_BIT_MASK 0xFFFFFFFFFFFF0000ULL -#define XHCI_BASE_ADDRESS_32_BIT_MASK 0xFFFF0000 - -#define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A -#define XHC_HCCPARAMS_OFFSET 0x10 -#define XHC_CAPABILITY_ID_MASK 0xFF -#define XHC_NEXT_CAPABILITY_MASK 0xFF00 - -#define XHC_USBCMD_OFFSET 0x0 // USB Command Register Offset -#define XHC_USBSTS_OFFSET 0x4 // USB Status Register Offset - -#define XHC_USBCMD_RUN BIT0 // Run/Stop -#define XHC_USBCMD_RESET BIT1 // Host Controller Reset - -#define XHC_USBSTS_HALT BIT0 - -// -// Transfer the data of 8 bytes each time -// -#define XHC_DEBUG_PORT_DATA_LENGTH 8 - -// -// Indicate the timeout when data is transferred. 0 means infinite timeout. -// -#define DATA_TRANSFER_TIME_OUT 0 - -// -// USB debug device string descritpor (header size + unicode string length) -// -#define STRING0_DESC_LEN 4 -#define MANU_DESC_LEN 12 -#define PRODUCT_DESC_LEN 40 -#define SERIAL_DESC_LEN 4 - -// -// Debug Capability Register Offset -// -#define XHC_DC_DCID 0x0 -#define XHC_DC_DCDB 0x4 -#define XHC_DC_DCERSTSZ 0x8 -#define XHC_DC_DCERSTBA 0x10 -#define XHC_DC_DCERDP 0x18 -#define XHC_DC_DCCTRL 0x20 -#define XHC_DC_DCST 0x24 -#define XHC_DC_DCPORTSC 0x28 -#define XHC_DC_DCCP 0x30 -#define XHC_DC_DCDDI1 0x38 -#define XHC_DC_DCDDI2 0x3C - -#define TRB_TYPE_LINK 6 - -#define ERST_NUMBER 0x01 -#define TR_RING_TRB_NUMBER 0x100 -#define EVENT_RING_TRB_NUMBER 0x200 -#define CMD_RING_TRB_NUMBER 0x100 - -#define ED_BULK_OUT 2 -#define ED_BULK_IN 6 - -#define XHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0xFFF= FFFFF)) -#define XHC_HIGH_32BIT(Addr64) ((UINT32)(RShiftU64((UINT64)(UINTN)= (Addr64), 32) & 0xFFFFFFFF)) -#define XHC_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) =3D=3D = (Bit))) - -#define XHC_REG_BIT_IS_SET(Xhc, Offset, Bit) \ - (XHC_BIT_IS_SET(XhcReadMmioReg ((Xhc), (Offset)), (Bit))) - -// -// Endpoint Type (EP Type). -// -#define ED_NOT_VALID 0 -#define ED_ISOCH_OUT 1 -#define ED_BULK_OUT 2 -#define ED_INTERRUPT_OUT 3 -#define ED_CONTROL_BIDIR 4 -#define ED_ISOCH_IN 5 -#define ED_BULK_IN 6 -#define ED_INTERRUPT_IN 7 - -// -// 6.4.5 TRB Completion Codes -// -#define TRB_COMPLETION_INVALID 0 -#define TRB_COMPLETION_SUCCESS 1 -#define TRB_COMPLETION_DATA_BUFFER_ERROR 2 -#define TRB_COMPLETION_BABBLE_ERROR 3 -#define TRB_COMPLETION_USB_TRANSACTION_ERROR 4 -#define TRB_COMPLETION_TRB_ERROR 5 -#define TRB_COMPLETION_STALL_ERROR 6 -#define TRB_COMPLETION_SHORT_PACKET 13 - -// -// 6.4.6 TRB Types -// -#define TRB_TYPE_NORMAL 1 -#define TRB_TYPE_SETUP_STAGE 2 -#define TRB_TYPE_DATA_STAGE 3 -#define TRB_TYPE_STATUS_STAGE 4 -#define TRB_TYPE_ISOCH 5 -#define TRB_TYPE_LINK 6 -#define TRB_TYPE_EVENT_DATA 7 -#define TRB_TYPE_NO_OP 8 -#define TRB_TYPE_EN_SLOT 9 -#define TRB_TYPE_DIS_SLOT 10 -#define TRB_TYPE_ADDRESS_DEV 11 -#define TRB_TYPE_CON_ENDPOINT 12 -#define TRB_TYPE_EVALU_CONTXT 13 -#define TRB_TYPE_RESET_ENDPOINT 14 -#define TRB_TYPE_STOP_ENDPOINT 15 -#define TRB_TYPE_SET_TR_DEQUE 16 -#define TRB_TYPE_RESET_DEV 17 -#define TRB_TYPE_GET_PORT_BANW 21 -#define TRB_TYPE_FORCE_HEADER 22 -#define TRB_TYPE_NO_OP_COMMAND 23 -#define TRB_TYPE_TRANS_EVENT 32 -#define TRB_TYPE_COMMAND_COMPLT_EVENT 33 -#define TRB_TYPE_PORT_STATUS_CHANGE_EVENT 34 -#define TRB_TYPE_HOST_CONTROLLER_EVENT 37 -#define TRB_TYPE_DEVICE_NOTIFI_EVENT 38 -#define TRB_TYPE_MFINDEX_WRAP_EVENT 39 - -// -// Convert millisecond to microsecond. -// -#define XHC_1_MILLISECOND (1000) -#define XHC_POLL_DELAY (1000) -#define XHC_GENERIC_TIMEOUT (10 * 1000) - -#define EFI_USB_SPEED_FULL 0x0000 ///< 12 Mb/s, USB 1.= 1 OHCI and UHCI HC. -#define EFI_USB_SPEED_LOW 0x0001 ///< 1 Mb/s, USB 1.1= OHCI and UHCI HC. -#define EFI_USB_SPEED_HIGH 0x0002 ///< 480 Mb/s, USB 2= .0 EHCI HC. -#define EFI_USB_SPEED_SUPER 0x0003 ///< 4.8 Gb/s, USB 3= .0 XHCI HC. - -// -// Transfer types, used in URB to identify the transfer type -// -#define XHC_CTRL_TRANSFER 0x01 -#define XHC_BULK_TRANSFER 0x02 -#define XHC_INT_TRANSFER_SYNC 0x04 -#define XHC_INT_TRANSFER_ASYNC 0x08 -#define XHC_INT_ONLY_TRANSFER_ASYNC 0x10 - -// -// USB Transfer Results -// -#define EFI_USB_NOERROR 0x00 -#define EFI_USB_ERR_NOTEXECUTE 0x01 -#define EFI_USB_ERR_STALL 0x02 -#define EFI_USB_ERR_BUFFER 0x04 -#define EFI_USB_ERR_BABBLE 0x08 -#define EFI_USB_ERR_NAK 0x10 -#define EFI_USB_ERR_CRC 0x20 -#define EFI_USB_ERR_TIMEOUT 0x40 -#define EFI_USB_ERR_BITSTUFF 0x80 -#define EFI_USB_ERR_SYSTEM 0x100 - -#define USB3_DEBUG_PORT_INSTANCE_SIGNATURE SIGNATURE_32('D', 'B', 'G', '= P') - -#pragma pack(1) - -// -// 7.6.9 OUT/IN EP Context: 64 bytes -// 7.6.9.2 When used by the DbC it is always a 64 byte data structure -// -typedef struct _ENDPOINT_CONTEXT_64 { - UINT32 EPState:3; - UINT32 RsvdZ1:5; - UINT32 Mult:2; // set to 0 - UINT32 MaxPStreams:5; // set to 0 - UINT32 LSA:1; // set to 0 - UINT32 Interval:8; // set to 0 - UINT32 RsvdZ2:8; - - UINT32 RsvdZ3:1; - UINT32 CErr:2; - UINT32 EPType:3; - UINT32 RsvdZ4:1; - UINT32 HID:1; // set to 0 - UINT32 MaxBurstSize:8; - UINT32 MaxPacketSize:16; - - UINT32 PtrLo; - - UINT32 PtrHi; - - UINT32 AverageTRBLength:16; - UINT32 MaxESITPayload:16; // set to 0 - - UINT32 RsvdZ5; // Reserved - UINT32 RsvdZ6; - UINT32 RsvdZ7; - - UINT32 RsvdZ8; - UINT32 RsvdZ9; - UINT32 RsvdZ10; - UINT32 RsvdZ11; - - UINT32 RsvdZ12; - UINT32 RsvdZ13; - UINT32 RsvdZ14; - UINT32 RsvdZ15; -} ENDPOINT_CONTEXT_64; - -// -// 6.4.1.1 Normal TRB: 16 bytes -// A Normal TRB is used in several ways; exclusively on Bulk and Interrupt= Transfer Rings for normal and -// Scatter/Gather operations, to define additional data buffers for Scatte= r/Gather operations on Isoch Transfer -// Rings, and to define the Data stage information for Control Transfer Ri= ngs. -// -typedef struct _TRANSFER_TRB_NORMAL { - UINT32 TRBPtrLo; - - UINT32 TRBPtrHi; - - UINT32 Length:17; - UINT32 TDSize:5; - UINT32 IntTarget:10; - - UINT32 CycleBit:1; - UINT32 ENT:1; - UINT32 ISP:1; - UINT32 NS:1; - UINT32 CH:1; - UINT32 IOC:1; - UINT32 IDT:1; - UINT32 RsvdZ1:2; - UINT32 BEI:1; - UINT32 Type:6; - UINT32 RsvdZ2:16; -} TRANSFER_TRB_NORMAL; - -// -// 6.4.2.1 Transfer Event TRB: 16 bytes -// A Transfer Event provides the completion status associated with a Trans= fer TRB. Refer to section 4.11.3.1 -// for more information on the use and operation of Transfer Events. -// -typedef struct _EVT_TRB_TRANSFER { - UINT32 TRBPtrLo; - - UINT32 TRBPtrHi; - - UINT32 Length:24; - UINT32 Completecode:8; - - UINT32 CycleBit:1; - UINT32 RsvdZ1:1; - UINT32 ED:1; - UINT32 RsvdZ2:7; - UINT32 Type:6; - UINT32 EndpointId:5; - UINT32 RsvdZ3:3; - UINT32 SlotId:8; -} EVT_TRB_TRANSFER; - -// -// 6.4.4.1 Link TRB: 16 bytes -// A Link TRB provides support for non-contiguous TRB Rings. -// -typedef struct _LINK_TRB { - UINT32 PtrLo; - - UINT32 PtrHi; - - UINT32 RsvdZ1:22; - UINT32 InterTarget:10; - - UINT32 CycleBit:1; - UINT32 TC:1; - UINT32 RsvdZ2:2; - UINT32 CH:1; - UINT32 IOC:1; - UINT32 RsvdZ3:4; - UINT32 Type:6; - UINT32 RsvdZ4:16; -} LINK_TRB; - -// -// TRB Template: 16 bytes -// -typedef struct _TRB_TEMPLATE { - UINT32 Parameter1; - - UINT32 Parameter2; - - UINT32 Status; - - UINT32 CycleBit:1; - UINT32 RsvdZ1:9; - UINT32 Type:6; - UINT32 Control:16; -} TRB_TEMPLATE; - -// -// Refer to XHCI 6.5 Event Ring Segment Table: 16 bytes -// -typedef struct _EVENT_RING_SEG_TABLE_ENTRY { - UINT32 PtrLo; - UINT32 PtrHi; - UINT32 RingTrbSize:16; - UINT32 RsvdZ1:16; - UINT32 RsvdZ2; -} EVENT_RING_SEG_TABLE_ENTRY; - -// -// Size: 40 bytes -// -typedef struct _EVENT_RING { - EFI_PHYSICAL_ADDRESS ERSTBase; - EFI_PHYSICAL_ADDRESS EventRingSeg0; - UINT32 TrbNumber; - EFI_PHYSICAL_ADDRESS EventRingEnqueue; - EFI_PHYSICAL_ADDRESS EventRingDequeue; - UINT32 EventRingCCS; -} EVENT_RING; - -// Size: 32 bytes -typedef struct _TRANSFER_RING { - EFI_PHYSICAL_ADDRESS RingSeg0; - UINT32 TrbNumber; - EFI_PHYSICAL_ADDRESS RingEnqueue; - EFI_PHYSICAL_ADDRESS RingDequeue; - UINT32 RingPCS; -} TRANSFER_RING; - -// -// Size: 64 bytes -// -typedef struct _DBC_INFO_CONTEXT { - UINT64 String0DescAddress; - UINT64 ManufacturerStrDescAddress; - UINT64 ProductStrDescAddress; - UINT64 SerialNumberStrDescAddress; - UINT64 String0Length:8; - UINT64 ManufacturerStrLength:8; - UINT64 ProductStrLength:8; - UINT64 SerialNumberStrLength:8; - UINT64 RsvdZ1:32; - UINT64 RsvdZ2; - UINT64 RsvdZ3; - UINT64 RsvdZ4; -} DBC_INFO_CONTEXT; - -// -// Debug Capability Context Data Structure: 192 bytes -// -typedef struct _XHC_DC_CONTEXT { - DBC_INFO_CONTEXT DbcInfoContext; - ENDPOINT_CONTEXT_64 EpOutContext; - ENDPOINT_CONTEXT_64 EpInContext; -} XHC_DC_CONTEXT; - -// -// Size: 16 bytes -// -typedef union _TRB { - TRB_TEMPLATE TrbTemplate; - TRANSFER_TRB_NORMAL TrbNormal; -} TRB; - -/// -/// USB data transfer direction -/// -typedef enum { - EfiUsbDataIn, - EfiUsbDataOut, - EfiUsbNoData -} EFI_USB_DATA_DIRECTION; - -// -// URB (Usb Request Block) contains information for all kinds of -// usb requests. -// -typedef struct _URB { - UINT32 Signature; - // - // Transfer data - // - EFI_PHYSICAL_ADDRESS Data; - UINT32 DataLen; - // - // Execute result - // - UINT32 Result; - // - // Completed data length - // - UINT32 Completed; - // - // Tranfer Ring info - // - EFI_PHYSICAL_ADDRESS Ring; - EFI_PHYSICAL_ADDRESS TrbStart; - EFI_PHYSICAL_ADDRESS TrbEnd; - UINT32 TrbNum; - BOOLEAN StartDone; - BOOLEAN EndDone; - BOOLEAN Finished; - EFI_USB_DATA_DIRECTION Direction; -} URB; - -// -// Size: 90 bytes -// -typedef struct _USB3_DEBUG_PORT_INSTANCE { - UINT32 Signature; - - UINT8 PciBusNumber; - UINT8 PciDeviceNumber; - UINT8 PciFunctionNumber; - - // - // The flag indicates debug capability is supported - // - BOOLEAN DebugSupport; - - // - // The flag indicates debug device is ready - // - BOOLEAN Ready; - - // - // The flag indicates the instance is from HOB - // - BOOLEAN FromHob; - - // - // PciIo protocol event - // - EFI_PHYSICAL_ADDRESS PciIoEvent; - - // - // XHCI MMIO Base address - // - EFI_PHYSICAL_ADDRESS XhcMmioBase; - - // - // XHCI OP RegisterBase address - // - EFI_PHYSICAL_ADDRESS XhciOpRegister; - - // - // XHCI Debug Register Base Address - // - EFI_PHYSICAL_ADDRESS DebugCapabilityBase; - - // - // XHCI Debug Capability offset - // - UINT64 DebugCapabilityOffset; - - // - // XHCI Debug Context Address - // - EFI_PHYSICAL_ADDRESS DebugCapabilityContext; - - // - // Transfer Ring - // - TRANSFER_RING TransferRingOut; - TRANSFER_RING TransferRingIn; - - // - // EventRing - // - EVENT_RING EventRing; - - // - // URB - // - URB Urb; -} USB3_DEBUG_PORT_INSTANCE; - -#pragma pack() - -/** - Clear one bit of the debug register while keeping other bits. - - @param Xhc The XHCI Instance. - @param Offset The offset of the debug register. - @param Bit The bit mask of the register to set. - -**/ -VOID -XhcClearDebugRegBit ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Bit - ); - -/** - Clear one bit of the MMIO register while keeping other bits. - - @param Xhc The XHCI Instance. - @param Offset The offset of the MMIO register. - @param Bit The bit mask of the register to set. - -**/ -VOID -XhcClearMmioRegBit ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Bit - ); - -/** - Read XHCI debug register. - - @param Xhc The XHCI Instance. - @param Offset The offset of the debug register. - - @return The register content read - -**/ -UINT32 -XhcReadDebugReg ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset - ); - -/** - Read XHCI MMIO register. - - @param Xhc The XHCI Instance. - @param Offset The offset of the MMIO register. - - @return The register content read - -**/ -UINT32 -XhcReadMmioReg ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset - ); - -/** - Set one bit of the debug register while keeping other bits. - - @param Xhc The XHCI Instance. - @param Offset The offset of the debug register. - @param Bit The bit mask of the register to set. - -**/ -VOID -XhcSetDebugRegBit ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Bit - ); - -/** - Set one bit of the MMIO register while keeping other bits. - - @param Xhc The XHCI Instance. - @param Offset The offset of the MMIO register. - @param Bit The bit mask of the register to set. - -**/ -VOID -XhcSetMmioRegBit ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Bit - ); - -/** - Wait the MMIO register's bit as specified by Bit - to be set (or clear). - - @param Xhc The XHCI Instance. - @param Offset The offset of the MMIO register. - @param Bit The bit of the register to wait for. - @param WaitToSet Wait the bit to set or clear. - @param Timeout The time to wait before abort (in millisecond, ms). - - @retval EFI_SUCCESS The bit successfully changed by host controller. - @retval EFI_TIMEOUT The time out occurred. - -**/ -EFI_STATUS -XhcWaitMmioRegBit ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Bit, - IN BOOLEAN WaitToSet, - IN UINT32 Timeout - ); - -/** - Write the data to the debug register. - - @param Xhc The XHCI Instance. - @param Offset The offset of the debug register. - @param Data The data to write. - -**/ -VOID -XhcWriteDebugReg ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Data - ); - -/** - Write the data to the MMIO register. - - @param Xhc The XHCI Instance. - @param Offset The offset of the MMIO register. - @param Data The data to write. - -**/ -VOID -XhcWriteMmioReg ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN UINT32 Offset, - IN UINT32 Data - ); - -/** - Discover the USB3 debug device. - - @param[in] Instance Pointer to USB3 debug port object instance. - - @retval RETURN_SUCCESS The USB3 debug device was found. - @retval RETURN_DEVICE_ERROR The USB3 debug device was not found. - -**/ -RETURN_STATUS -DiscoverUsb3DebugPort( - IN USB3_DEBUG_PORT_INSTANCE *Instance - ); - -/** - Initialize the USB3 debug Device hardware. - - @param[in] Instance Pointer to USB3 debug port object instance. - - @retval RETURN_SUCCESS The USB3 debug device was initialized successf= ully. - @retval !RETURN_SUCCESS Error. - -**/ -RETURN_STATUS -InitializeUsb3DebugPort ( - IN USB3_DEBUG_PORT_INSTANCE *Instance - ); - -/** - Return XHCI MMIO base address. - -**/ -EFI_PHYSICAL_ADDRESS -GetXhciBaseAddress ( - VOID - ); - -/** - Return XHCI debug instance address. - -**/ -USB3_DEBUG_PORT_INSTANCE * -GetUsb3DebugPortInstance ( - VOID - ); - -/** - Send data over the USB3 debug cable. - - @param[out] Data Pointer to data - @param[in, out] Length Pointer to data length - -**/ -VOID -Usb3DbgOut ( - OUT UINT8 *Data, - IN OUT UINTN *Length - ); - -/** - Receive data over the USB3 debug cable. - - @param[out] Data Pointer to data - @param[in, out] Length Pointer to data length - -**/ -RETURN_STATUS -Usb3DbgIn ( - OUT UINT8 *Data, - IN OUT UINTN *Length - ); - -/** - Verifies if the bit positions specified by a mask are set in a register. - - @param[in, out] Register UNITN register - @param[in] BitMask 32-bit mask - - @return BOOLEAN - TRUE if all bits specified by the mask are enabled. - - FALSE even if one of the bits specified by the mask - is not enabled. -**/ -BOOLEAN -XhcIsBitSet( - UINTN Register, - UINT32 BitMask - ); - -/** - Sets bits as per the enabled bit positions in the mask. - - @param[in, out] Register UINTN register - @param[in] BitMask 32-bit mask -**/ -VOID -XhcSetR32Bit( - UINTN Register, - UINT32 BitMask - ); - -/** - Clears bits as per the enabled bit positions in the mask. - - @param[in, out] Register UINTN register - @param[in] BitMask 32-bit mask -**/ -VOID -XhcClrR32Bit( - UINTN Register, - UINT32 BitMask - ); - -/** - Initialize USB3 debug port. - - This method invokes various internal functions to facilitate - detection and initialization of USB3 debug port. - - @retval RETURN_SUCCESS The serial device was initialized. -**/ -RETURN_STATUS -EFIAPI -USB3Initialize ( - VOID - ); - -/** - Return command register value in XHCI controller. - -**/ -UINT16 -GetXhciPciCommand ( - VOID - ); - -/** - Allocate aligned memory for XHC's usage. - - @param BufferSize The size, in bytes, of the Buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID* -AllocateAlignBuffer ( - IN UINTN BufferSize - ); - -/** - Check whether AllocatePages in permanent memory is ready. - - @retval TRUE AllocatePages in permanent memory is ready. - @retval FALSE AllocatePages in permanent memory is not ready. - -**/ -BOOLEAN -IsAllocatePagesReady ( - VOID - ); - -/** - The real function to initialize USB3 debug port. - - This method invokes various internal functions to facilitate - detection and initialization of USB3 debug port. - - @retval RETURN_SUCCESS The serial device was initialized. -**/ -RETURN_STATUS -EFIAPI -USB3InitializeReal ( - VOID - ); - -/** - Update XHC hardware address when MMIO base is changed. - - @param Instance The XHCI Instance. - @param XhcMmioBase XHCI MMIO base address. - -**/ -VOID -FixUsb3InstanceResource ( - IN OUT USB3_DEBUG_PORT_INSTANCE *Instance, - IN EFI_PHYSICAL_ADDRESS XhcMmioBase - ); - -/** - Save USB3 instance address. - - @param[in] Instance The XHCI Instance. - -**/ -VOID -SaveUsb3InstanceAddress ( - IN USB3_DEBUG_PORT_INSTANCE *Instance - ); - -/** - Submits bulk transfer to a bulk endpoint of a USB device. - - @param Xhc The instance of debug device. - @param Direction The direction of data transfer. - @param Data Array of pointers to the buffers of data t= o transmit - from or receive into. - @param DataLength The lenght of the data buffer. - @param Timeout Indicates the maximum time, in millisecond= , which - the transfer is allowed to complete. - @param TransferResult Transfer result. - - @retval EFI_SUCCESS The transfer was completed successfully. - @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resourc= e. - @retval EFI_INVALID_PARAMETER Some parameters are invalid. - @retval EFI_TIMEOUT The transfer failed due to timeout. - @retval EFI_DEVICE_ERROR The transfer failed due to host controller= error. - -**/ -EFI_STATUS -EFIAPI -XhcDataTransfer ( - IN USB3_DEBUG_PORT_INSTANCE *Xhc, - IN EFI_USB_DATA_DIRECTION Direction, - IN OUT VOID *Data, - IN OUT UINTN *DataLength, - IN UINTN Timeout, - OUT UINT32 *TransferResult - ); - -#endif //__SERIAL_PORT_LIB_USB__ diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3De= bugPortLibNull.c b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/= Usb3DebugPortLibNull.c deleted file mode 100644 index 319cebecbb..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPort= LibNull.c +++ /dev/null @@ -1,103 +0,0 @@ -/** @file - Usb Debug Port library NULL instance - - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include - -/** - Initialize the USB3 debug port hardware. - - If no initialization is required, then return RETURN_SUCCESS. - If the serial device was successfully initialized, then return RETURN_SU= CCESS. - If the serial device could not be initialized, then return RETURN_DEVICE= _ERROR. - - @retval RETURN_SUCCESS The serial device was initialized. - @retval RETURN_DEVICE_ERROR The serial device could not be initialized. - -**/ -RETURN_STATUS -EFIAPI -Usb3DebugPortInitialize ( - VOID - ) -{ - return RETURN_SUCCESS; -} - -/** - Write data from buffer to USB3 debug port. - - Writes NumberOfBytes data bytes from Buffer to the serial device. - The number of bytes actually written to the serial device is returned. - If the return value is less than NumberOfBytes, then the write operation= failed. - If Buffer is NULL, then ASSERT(). - If NumberOfBytes is zero, then return 0. - - @param Buffer Pointer to the data buffer to be written. - @param NumberOfBytes Number of bytes to written to the serial device. - - @retval 0 NumberOfBytes is 0. - @retval >0 The number of bytes written to the serial devic= e. - If this value is less than NumberOfBytes, then = the read operation failed. - -**/ -UINTN -EFIAPI -Usb3DebugPortWrite ( - IN UINT8 *Buffer, - IN UINTN NumberOfBytes - ) -{ - return 0; -} - - -/** - Read data from USB3 debug port and save the datas in buffer. - - Reads NumberOfBytes data bytes from a serial device into the buffer - specified by Buffer. The number of bytes actually read is returned. - If the return value is less than NumberOfBytes, then the rest operation = failed. - If Buffer is NULL, then ASSERT(). - If NumberOfBytes is zero, then return 0. - - @param Buffer Pointer to the data buffer to store the data re= ad from the serial device. - @param NumberOfBytes Number of bytes which will be read. - - @retval 0 Read data failed, no data is to be read. - @retval >0 Actual number of bytes read from serial device. - -**/ -UINTN -EFIAPI -Usb3DebugPortRead ( - OUT UINT8 *Buffer, - IN UINTN NumberOfBytes - ) -{ - return 0; -} - -/** - Polls a USB3 debug port to see if there is any data waiting to be read. - - Polls a serial device to see if there is any data waiting to be read. - If there is data waiting to be read from the serial device, then TRUE is= returned. - If there is no data waiting to be read from the serial device, then FALS= E is returned. - - @retval TRUE Data is waiting to be read from the serial devi= ce. - @retval FALSE There is no data waiting to be read from the se= rial device. - -**/ -BOOLEAN -EFIAPI -Usb3DebugPortPoll ( - VOID - ) -{ - return FALSE; -} diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3De= bugPortLibNull.inf b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLi= b/Usb3DebugPortLibNull.inf deleted file mode 100644 index f632150c26..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPort= LibNull.inf +++ /dev/null @@ -1,28 +0,0 @@ -## @file -# Usb3 debug port library. -# -# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D USB3DebugPortLibNull - FILE_GUID =3D 3E895F08-0A69-42a2-AF4A-3E9EFAA40361 - MODULE_TYPE =3D BASE - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D Usb3DebugPortLib - -# -# The following information is for reference only and not required by the = build tools. -# -# VALID_ARCHITECTURES =3D IA32 X64 IPF -# - -[Sources] - Usb3DebugPortLibNull.c - -[Packages] - MdePkg/MdePkg.dec - diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3De= bugPortLibPei.c b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/U= sb3DebugPortLibPei.c deleted file mode 100644 index a1e0bdbf6d..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPort= LibPei.c +++ /dev/null @@ -1,236 +0,0 @@ -/** @file - Usb Debug Port library instance - - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Usb3DebugPortLibInternal.h" - -GUID gUsb3DbgGuid =3D USB3_DBG_GUID; - -/** - Return XHCI MMIO base address. - -**/ -EFI_PHYSICAL_ADDRESS -GetXhciBaseAddress ( - VOID - ) -{ - UINT8 Bus; - UINT8 Device; - UINT8 Function; - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; - EFI_PHYSICAL_ADDRESS Address; - UINT32 Low; - UINT32 High; - - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); - Bus =3D UsbDebugPort.PciAddress.Bus; - Device =3D UsbDebugPort.PciAddress.Device; - Function =3D UsbDebugPort.PciAddress.Function; - Low =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRE= SSREG_OFFSET)); - High =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDR= ESSREG_OFFSET + 4)); - Address =3D (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Low); - - // - // Mask other parts which are not part of base address - // - Address &=3D XHCI_BASE_ADDRESS_64_BIT_MASK; - return Address; -} - -/** - Return XHCI debug instance address. - -**/ -USB3_DEBUG_PORT_INSTANCE * -GetUsb3DebugPortInstance ( - VOID - ) -{ - USB3_DEBUG_PORT_INSTANCE *Instance; - EFI_PEI_HOB_POINTERS Hob; - EFI_PHYSICAL_ADDRESS XhcMmioBase; - - Hob.Raw =3D GetFirstGuidHob (&gUsb3DbgGuid); - if (Hob.Raw =3D=3D NULL) { - return NULL; - } - Instance =3D GET_GUID_HOB_DATA (Hob.Guid); - - // - // Update XHCI MMIO base address - // - XhcMmioBase =3D GetXhciBaseAddress (); - - FixUsb3InstanceResource (Instance, XhcMmioBase); - - return Instance; -} - -/** - Initialize USB3 debug port. - - This method invokes various internal functions to facilitate - detection and initialization of USB3 debug port. - - @retval RETURN_SUCCESS The serial device was initialized. -**/ -RETURN_STATUS -EFIAPI -USB3Initialize ( - VOID - ) -{ - return EFI_SUCCESS; -} - -/** - Initialize USB3 debug port. - - This method invokes various internal functions to facilitate - detection and initialization of USB3 debug port. - - @retval RETURN_SUCCESS The serial device was initialized. -**/ -RETURN_STATUS -EFIAPI -USB3InitializeReal ( - VOID - ) -{ - USB3_DEBUG_PORT_INSTANCE UsbDbg; - VOID *DataPtr; - EFI_PEI_HOB_POINTERS Hob; - - // - // USB Initilization has to be done only once. So this function should j= ust return when - // it is called more than once. - // - Hob.Raw =3D GetFirstGuidHob (&gUsb3DbgGuid); - if (Hob.Raw !=3D NULL) { - return RETURN_SUCCESS; - } - - // - // Initialize USB debug for PEI at the first time - // - SetMem (&UsbDbg, sizeof(UsbDbg), 0); - UsbDbg.FromHob =3D TRUE; - DiscoverUsb3DebugPort (&UsbDbg); - if (UsbDbg.DebugSupport) { - InitializeUsb3DebugPort (&UsbDbg); - } - - // - // Save Instance into HOB - // - DataPtr =3D BuildGuidDataHob ( - &gUsb3DbgGuid, - (VOID*) &UsbDbg, - sizeof (UsbDbg) - ); - - if (UsbDbg.DebugSupport) { - SaveUsb3InstanceAddress ((USB3_DEBUG_PORT_INSTANCE *) DataPtr); - } - - return RETURN_SUCCESS; -} - -/** - Allocate aligned memory for XHC's usage. - - @param BufferSize The size, in bytes, of the Buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID* -AllocateAlignBuffer ( - IN UINTN BufferSize - ) -{ - VOID *Buf; - EFI_PHYSICAL_ADDRESS Address; - CONST EFI_PEI_SERVICES **PeiServices; - EFI_STATUS Status; - VOID *MemoryDiscoveredPpi; - - Buf =3D NULL; - PeiServices =3D GetPeiServicesTablePointer (); - - // - // Make sure the allocated memory is physical memory. - // - Status =3D (*PeiServices)->LocatePpi ( - PeiServices, - &gEfiPeiMemoryDiscoveredPpiGuid, - 0, - NULL, - (VOID **) &MemoryDiscoveredPpi - ); - if (!EFI_ERROR (Status)) { - Status =3D (*PeiServices)->AllocatePages ( - PeiServices, - EfiACPIMemoryNVS, - EFI_SIZE_TO_PAGES (BufferSize), - &Address - ); - if (!EFI_ERROR (Status)) { - Buf =3D (VOID *)(UINTN) Address; - } - } - return Buf; -} - -/** - Check whether AllocatePages in permanent memory is ready. - - @retval TRUE AllocatePages in permanent memory is ready. - @retval FALSE AllocatePages in permanent memory is not ready. - -**/ -BOOLEAN -IsAllocatePagesReady ( - VOID - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_STATUS Status; - VOID *MemoryDiscoveredPpi; - - PeiServices =3D GetPeiServicesTablePointer (); - - // - // Make sure the allocated memory is physical memory. - // - Status =3D (*PeiServices)->LocatePpi ( - PeiServices, - &gEfiPeiMemoryDiscoveredPpiGuid, - 0, - NULL, - (VOID **) &MemoryDiscoveredPpi - ); - if (!EFI_ERROR (Status)) { - return TRUE; - } - - return FALSE; -} - diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3De= bugPortLibPei.inf b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib= /Usb3DebugPortLibPei.inf deleted file mode 100644 index 0edde82769..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPort= LibPei.inf +++ /dev/null @@ -1,48 +0,0 @@ -## @file -# Usb3 debug port library. -# -# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D USB3DebugPortLibPei - FILE_GUID =3D 62C974F0-D0E0-4963-B93A-22FBCEB69AB4 - MODULE_TYPE =3D PEIM - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D Usb3DebugPortLib|PEIM PEI_CORE - -# -# The following information is for reference only and not required by the = build tools. -# -# VALID_ARCHITECTURES =3D IA32 X64 IPF -# - -[Sources] - Usb3DebugPortLibPei.c - Usb3DebugPortDataTransfer.c - Usb3DebugPortInitialize.c - MiscServices.c - Usb3DebugPortLibInternal.h - -[Packages] - MdePkg/MdePkg.dec - DebugFeaturePkg/DebugFeaturePkg.dec - -[LibraryClasses] - BaseLib - PcdLib - IoLib - PciLib - TimerLib - HobLib - Usb3DebugPortParameterLib - PeiServicesTablePointerLib - -[Ppis] - gEfiPeiMemoryDiscoveredPpiGuid ## CONSUMES - -[Pcd] - gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOME= TIMES_CONSUMES - gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONS= UMES diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3De= bugPortLibPeiIoMmu.c b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPort= Lib/Usb3DebugPortLibPeiIoMmu.c deleted file mode 100644 index 68543c8562..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPort= LibPeiIoMmu.c +++ /dev/null @@ -1,440 +0,0 @@ -/** @file - Usb Debug Port library instance - - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Usb3DebugPortLibInternal.h" - -GUID gUsb3DbgGuid =3D USB3_DBG_GUID; - -/** - USB3 IOMMU PPI notify. - - @param[in] PeiServices Pointer to PEI Services Table. - @param[in] NotifyDesc Pointer to the descriptor for the Notification= event that - caused this function to execute. - @param[in] Ppi Pointer to the PPI data associated with this f= unction. - - @retval EFI_STATUS Always return EFI_SUCCESS -**/ -EFI_STATUS -EFIAPI -Usb3IoMmuPpiNotify ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, - IN VOID *Ppi - ) -{ - USB3_DEBUG_PORT_INSTANCE *Instance; - - Instance =3D GetUsb3DebugPortInstance (); - ASSERT (Instance !=3D NULL); - // - // Reinitialize USB3 debug port with granted DMA buffer from IOMMU PPI. - // - InitializeUsb3DebugPort (Instance); - - SaveUsb3InstanceAddress (Instance); - - return EFI_SUCCESS; -} - -EFI_PEI_NOTIFY_DESCRIPTOR mUsb3IoMmuPpiNotifyDesc =3D { - (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINA= TE_LIST), - &gEdkiiIoMmuPpiGuid, - Usb3IoMmuPpiNotify -}; - -/** - Allocates pages that are suitable for an OperationBusMasterCommonBuffer = or - OperationBusMasterCommonBuffer64 mapping. - - @param IoMmu Pointer to IOMMU PPI. - @param Pages The number of pages to allocate. - @param HostAddress A pointer to store the base system memory = address of the - allocated range. - @param DeviceAddress The resulting map address for the bus mast= er PCI controller to use to - access the hosts HostAddress. - @param Mapping A resulting value to pass to Unmap(). - - @retval EFI_SUCCESS The requested memory pages were allocated. - @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal = attribute bits are - MEMORY_WRITE_COMBINE and MEMORY_CACHED. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. - @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. - -**/ -EFI_STATUS -IoMmuAllocateBuffer ( - IN EDKII_IOMMU_PPI *IoMmu, - IN UINTN Pages, - OUT VOID **HostAddress, - OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, - OUT VOID **Mapping - ) -{ - EFI_STATUS Status; - UINTN NumberOfBytes; - - *HostAddress =3D NULL; - *DeviceAddress =3D 0; - *Mapping =3D NULL; - - Status =3D IoMmu->AllocateBuffer ( - IoMmu, - EfiRuntimeServicesData, - Pages, - HostAddress, - 0 - ); - if (EFI_ERROR (Status)) { - return EFI_OUT_OF_RESOURCES; - } - - NumberOfBytes =3D EFI_PAGES_TO_SIZE (Pages); - Status =3D IoMmu->Map ( - IoMmu, - EdkiiIoMmuOperationBusMasterCommonBuffer, - *HostAddress, - &NumberOfBytes, - DeviceAddress, - Mapping - ); - if (EFI_ERROR (Status)) { - IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress); - *HostAddress =3D NULL; - return EFI_OUT_OF_RESOURCES; - } - Status =3D IoMmu->SetAttribute ( - IoMmu, - *Mapping, - EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE - ); - if (EFI_ERROR (Status)) { - IoMmu->Unmap (IoMmu, *Mapping); - IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress); - *Mapping =3D NULL; - *HostAddress =3D NULL; - return Status; - } - - return Status; -} - -/** - USB3 get IOMMU PPI. - - @return Pointer to IOMMU PPI. - -**/ -EDKII_IOMMU_PPI * -Usb3GetIoMmu ( - VOID - ) -{ - EFI_STATUS Status; - EDKII_IOMMU_PPI *IoMmu; - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices =3D GetPeiServicesTablePointer (); - - IoMmu =3D NULL; - Status =3D (*PeiServices)->LocatePpi ( - PeiServices, - &gEdkiiIoMmuPpiGuid, - 0, - NULL, - (VOID **) &IoMmu - ); - if (!EFI_ERROR (Status) && (IoMmu !=3D NULL)) { - return IoMmu; - } - - return NULL; -} - -/** - Return XHCI MMIO base address. - -**/ -EFI_PHYSICAL_ADDRESS -GetXhciBaseAddress ( - VOID - ) -{ - UINT8 Bus; - UINT8 Device; - UINT8 Function; - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; - EFI_PHYSICAL_ADDRESS Address; - UINT32 Low; - UINT32 High; - - UsbDebugPort.Controller =3D GetUsb3DebugPortController(); - Bus =3D UsbDebugPort.PciAddress.Bus; - Device =3D UsbDebugPort.PciAddress.Device; - Function =3D UsbDebugPort.PciAddress.Function; - Low =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRE= SSREG_OFFSET)); - High =3D PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDR= ESSREG_OFFSET + 4)); - Address =3D (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Low); - - // - // Mask other parts which are not part of base address - // - Address &=3D XHCI_BASE_ADDRESS_64_BIT_MASK; - return Address; -} - -/** - Return XHCI debug instance address. - -**/ -USB3_DEBUG_PORT_INSTANCE * -GetUsb3DebugPortInstance ( - VOID - ) -{ - USB3_DEBUG_PORT_INSTANCE *Instance; - EFI_PEI_HOB_POINTERS Hob; - EFI_PHYSICAL_ADDRESS XhcMmioBase; - - Hob.Raw =3D GetFirstGuidHob (&gUsb3DbgGuid); - if (Hob.Raw =3D=3D NULL) { - return NULL; - } - Instance =3D GET_GUID_HOB_DATA (Hob.Guid); - - // - // Update XHCI MMIO base address - // - XhcMmioBase =3D GetXhciBaseAddress (); - - FixUsb3InstanceResource (Instance, XhcMmioBase); - - return Instance; -} - -/** - Initialize USB3 debug port. - - This method invokes various internal functions to facilitate - detection and initialization of USB3 debug port. - - @retval RETURN_SUCCESS The serial device was initialized. -**/ -RETURN_STATUS -EFIAPI -USB3Initialize ( - VOID - ) -{ - return EFI_SUCCESS; -} - -/** - Initialize USB3 debug port. - - This method invokes various internal functions to facilitate - detection and initialization of USB3 debug port. - - @retval RETURN_SUCCESS The serial device was initialized. -**/ -RETURN_STATUS -EFIAPI -USB3InitializeReal ( - VOID - ) -{ - EFI_STATUS Status; - USB3_DEBUG_PORT_INSTANCE UsbDbg; - VOID *DataPtr; - EFI_PEI_HOB_POINTERS Hob; - CONST EFI_PEI_SERVICES **PeiServices; - - PeiServices =3D GetPeiServicesTablePointer (); - - // - // USB Initilization has to be done only once. So this function should j= ust return when - // it is called more than once. - // - Hob.Raw =3D GetFirstGuidHob (&gUsb3DbgGuid); - if (Hob.Raw !=3D NULL) { - return RETURN_SUCCESS; - } - - // - // Initialize USB debug for PEI at the first time - // - SetMem (&UsbDbg, sizeof(UsbDbg), 0); - UsbDbg.FromHob =3D TRUE; - DiscoverUsb3DebugPort (&UsbDbg); - if (UsbDbg.DebugSupport) { - InitializeUsb3DebugPort (&UsbDbg); - } - - if (UsbDbg.Ready && (Usb3GetIoMmu () =3D=3D NULL)) { - Status =3D (*PeiServices)->NotifyPpi (PeiServices, &mUsb3IoMmuPpiNotif= yDesc); - ASSERT_EFI_ERROR (Status); - } - - // - // Save Instance into HOB - // - DataPtr =3D BuildGuidDataHob ( - &gUsb3DbgGuid, - (VOID*) &UsbDbg, - sizeof (UsbDbg) - ); - - if (UsbDbg.DebugSupport) { - SaveUsb3InstanceAddress ((USB3_DEBUG_PORT_INSTANCE *) DataPtr); - } - - return RETURN_SUCCESS; -} - -/** - Allocate aligned memory for XHC's usage. - - @param BufferSize The size, in bytes, of the Buffer. - - @return A pointer to the allocated buffer or NULL if allocation fails. - -**/ -VOID* -AllocateAlignBuffer ( - IN UINTN BufferSize - ) -{ - VOID *Buf; - EFI_PHYSICAL_ADDRESS Address; - CONST EFI_PEI_SERVICES **PeiServices; - EFI_STATUS Status; - VOID *MemoryDiscoveredPpi; - EDKII_IOMMU_PPI *IoMmu; - VOID *HostAddress; - VOID *Mapping; - - Buf =3D NULL; - PeiServices =3D GetPeiServicesTablePointer (); - - // - // Make sure the allocated memory is physical memory. - // - Status =3D (*PeiServices)->LocatePpi ( - PeiServices, - &gEfiPeiMemoryDiscoveredPpiGuid, - 0, - NULL, - (VOID **) &MemoryDiscoveredPpi - ); - if (!EFI_ERROR (Status)) { - IoMmu =3D Usb3GetIoMmu (); - if (IoMmu !=3D NULL) { - Status =3D IoMmuAllocateBuffer ( - IoMmu, - EFI_SIZE_TO_PAGES (BufferSize), - &HostAddress, - &Address, - &Mapping - ); - if (!EFI_ERROR (Status)) { - ASSERT (Address =3D=3D ((EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress= )); - Buf =3D (VOID *)(UINTN) Address; - } - } else { - Status =3D (*PeiServices)->AllocatePages ( - PeiServices, - EfiACPIMemoryNVS, - EFI_SIZE_TO_PAGES (BufferSize), - &Address - ); - if (!EFI_ERROR (Status)) { - Buf =3D (VOID *)(UINTN) Address; - } - } - } - return Buf; -} - -/** - Check whether AllocatePages in permanent memory is ready. - - @retval TRUE AllocatePages in permanent memory is ready. - @retval FALSE AllocatePages in permanent memory is not ready. - -**/ -BOOLEAN -IsAllocatePagesReady ( - VOID - ) -{ - CONST EFI_PEI_SERVICES **PeiServices; - EFI_STATUS Status; - VOID *MemoryDiscoveredPpi; - EDKII_IOMMU_PPI *IoMmu; - VOID *HostAddress; - - PeiServices =3D GetPeiServicesTablePointer (); - - // - // Make sure the allocated memory is physical memory. - // - Status =3D (*PeiServices)->LocatePpi ( - PeiServices, - &gEfiPeiMemoryDiscoveredPpiGuid, - 0, - NULL, - (VOID **) &MemoryDiscoveredPpi - ); - if (!EFI_ERROR (Status)) { - Status =3D (*PeiServices)->LocatePpi ( - PeiServices, - &gEdkiiIoMmuPpiGuid, - 0, - NULL, - (VOID **) &IoMmu - ); - if (!EFI_ERROR (Status)) { - Status =3D IoMmu->AllocateBuffer ( - IoMmu, - EfiRuntimeServicesData, - 1, - &HostAddress, - 0 - ); - if (EFI_ERROR (Status)) { - // - // DMA protection has been enabled, - // but DMA buffer could not be allocated yet. - // - return FALSE; - } - IoMmu->FreeBuffer ( - IoMmu, - 1, - HostAddress - ); - } - return TRUE; - } - - return FALSE; -} - diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3De= bugPortLibPeiIoMmu.inf b/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPo= rtLib/Usb3DebugPortLibPeiIoMmu.inf deleted file mode 100644 index f27c23faab..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortLib/Usb3DebugPort= LibPeiIoMmu.inf +++ /dev/null @@ -1,51 +0,0 @@ -## @file -# Usb3 debug port library. -# -# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D USB3DebugPortLibPeiIoMmu - FILE_GUID =3D C973C5E8-A0D8-4FEE-A0F0-7DA6C3C72451 - MODULE_TYPE =3D PEIM - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D Usb3DebugPortLib|PEIM PEI_CORE - -# -# The following information is for reference only and not required by the = build tools. -# -# VALID_ARCHITECTURES =3D IA32 X64 IPF -# - -[Sources] - Usb3DebugPortLibPeiIoMmu.c - Usb3DebugPortDataTransfer.c - Usb3DebugPortInitialize.c - MiscServices.c - Usb3DebugPortLibInternal.h - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - DebugFeaturePkg/DebugFeaturePkg.dec - -[LibraryClasses] - BaseLib - PcdLib - IoLib - PciLib - TimerLib - HobLib - Usb3DebugPortParameterLib - PeiServicesTablePointerLib - -[Ppis] - gEfiPeiMemoryDiscoveredPpiGuid ## CONSUMES - gEdkiiIoMmuPpiGuid ## SOMETIMES_CONSUMES - -[Pcd] - gDebugFeaturePkgTokenSpaceGuid.PcdXhciDefaultBaseAddress ## SOME= TIMES_CONSUMES - gDebugFeaturePkgTokenSpaceGuid.PcdXhciHostWaitTimeout ## CONS= UMES diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterL= ibPcd/Usb3DebugPortParameterLibPcd.c b/Platform/Intel/DebugFeaturePkg/Libra= ry/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.c deleted file mode 100644 index 747c5dccc9..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/U= sb3DebugPortParameterLibPcd.c +++ /dev/null @@ -1,58 +0,0 @@ -/** @file - USB3 debug Port Parameter library instance based on PCD. - - Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include - -/** - Returns the USB3 debug port controller. - bit: 0~ 7: Function - bit: 8~15: Device - bit: 16~24: Bus - - @return Controller information of USB debug port. - -**/ -UINT32 -EFIAPI -GetUsb3DebugPortController ( - VOID - ) -{ - USB3_DEBUG_PORT_CONTROLLER UsbDebugPort; - - UsbDebugPort.Controller =3D 0; - UsbDebugPort.PciAddress.Bus =3D PcdGet8(PcdUsbSerialXhciBus); - UsbDebugPort.PciAddress.Device =3D PcdGet8(PcdUsbSerialXhciDev); - UsbDebugPort.PciAddress.Function =3D PcdGet8(PcdUsbSerialXhciFunc); - - return UsbDebugPort.Controller; -} - -/** - Sets the USB debug port controller. - bit: 0~ 7: Function - bit: 8~15: Device - bit: 16~24: Bus - - @param[in] Controller information of USB debug port value to be set. - - @retval TRUE The controller of USB debug port was sucessfully= set. - @retval FALSE The controller of USB debug port could not be se= t. - -**/ -BOOLEAN -EFIAPI -SetUsb3DebugPortController ( - UINT32 Controller - ) -{ - return FALSE; -} diff --git a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterL= ibPcd/Usb3DebugPortParameterLibPcd.inf b/Platform/Intel/DebugFeaturePkg/Lib= rary/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf deleted file mode 100644 index 09f44920f6..0000000000 --- a/Platform/Intel/DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/U= sb3DebugPortParameterLibPcd.inf +++ /dev/null @@ -1,31 +0,0 @@ -## @file -# USB3 debug Port Parameter library instance based on PCD. -# -# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D Usb3DebugPortParameterLibPcd - FILE_GUID =3D 4990A700-4002-4d08-8E00-622720032662 - MODULE_TYPE =3D BASE - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D Usb3DebugPortParameterLib - -[Sources] - Usb3DebugPortParameterLibPcd.c - -[LibraryClasses] - BaseLib - DebugLib - -[Packages] - MdePkg/MdePkg.dec - DebugFeaturePkg/DebugFeaturePkg.dec - -[Pcd] - gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciBus ## CONSUMES - gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciDev ## CONSUMES - gDebugFeaturePkgTokenSpaceGuid.PcdUsbSerialXhciFunc ## CONSUMES diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthen= tication.h b/Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthen= tication.h deleted file mode 100644 index 2a41a46cdc..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Guid/UserAuthenticatio= n.h +++ /dev/null @@ -1,45 +0,0 @@ -/** @file - GUID is for UserAuthentication SMM communication. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef __USER_AUTHENTICATION_GUID_H__ -#define __USER_AUTHENTICATION_GUID_H__ - -#define PASSWORD_MIN_SIZE 9 // MIN number of chars of password, includ= ing NULL. -#define PASSWORD_MAX_SIZE 33 // MAX number of chars of password, includ= ing NULL. - -#define USER_AUTHENTICATION_GUID \ - { 0xf06e3ea7, 0x611c, 0x4b6b, { 0xb4, 0x10, 0xc2, 0xbf, 0x94, 0x3f, 0x38= , 0xf2 } } - -extern EFI_GUID gUserAuthenticationGuid; - -typedef struct { - UINTN Function; - EFI_STATUS ReturnStatus; -} SMM_PASSWORD_COMMUNICATE_HEADER; - -#define SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET 1 -#define SMM_PASSWORD_FUNCTION_SET_PASSWORD 2 -#define SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD 3 -#define SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY 4 -#define SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY 5 -#define SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED 6 - -typedef struct { - CHAR8 NewPassword[PASSWORD_MAX_SIZE]; - CHAR8 OldPassword[PASSWORD_MAX_SIZE]; -} SMM_PASSWORD_COMMUNICATE_SET_PASSWORD; - -typedef struct { - CHAR8 Password[PASSWORD_MAX_SIZE]; -} SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD; - -typedef struct { - BOOLEAN NeedReVerify; -} SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY; - -#endif diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/Platfor= mPasswordLib.h b/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/Pla= tformPasswordLib.h deleted file mode 100644 index ce27947f6d..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/PlatformPasswo= rdLib.h +++ /dev/null @@ -1,48 +0,0 @@ -/** @file - Provides a platform-specific method to return password policy. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef __PLATFORM_PASSWORD_LIB_H__ -#define __PLATFORM_PASSWORD_LIB_H__ - -/** - This function is called at password driver entrypoint. - This function should be called only once, to clear the password. - - This function provides a way to reset the password, just in case - the platform owner forgets the password. - The platform should provide a secure way to make sure - only the platform owner is allowed to clear password. - - Once the password is cleared, the platform should provide a way - to set a new password. - - @retval TRUE There is a platform request to clear the password. - @retval FALSE There is no platform request to clear the password. -**/ -BOOLEAN -EFIAPI -IsPasswordCleared ( - VOID - ); - -/** - This function is called if the password driver finds that the password i= s not enrolled, - when the password is required to input. - - This function should return the action according to platform policy. - - @retval TRUE The caller should force the user to enroll the password. - @retval FALSE The caller may skip the password enroll. -**/ -BOOLEAN -EFIAPI -NeedEnrollPassword ( - VOID - ); - -#endif diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPas= swordLib.h b/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPas= swordLib.h deleted file mode 100644 index b6aad224e9..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordLi= b.h +++ /dev/null @@ -1,70 +0,0 @@ -/** @file - Provides services to set/verify password and return if the password is s= et. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef __USER_PASSWORD_LIB_H__ -#define __USER_PASSWORD_LIB_H__ - -/** - Validate if the password is correct. - - @param[in] Password The user input password. - @param[in] PasswordSize The size of Password in byte. - - @retval EFI_SUCCESS The password is correct. - @retval EFI_SECURITY_VIOLATION The password is incorrect. - @retval EFI_INVALID_PARAMETER The password or size is invalid. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the p= assword. - @retval EFI_ACCESS_DENIED Password retry count reach. -**/ -EFI_STATUS -EFIAPI -VerifyPassword ( - IN CHAR16 *Password, - IN UINTN PasswordSize - ); - -/** - Set a new password. - - @param[in] NewPassword The user input new password. - NULL means clear password. - @param[in] NewPasswordSize The size of NewPassword in byte. - @param[in] OldPassword The user input old password. - NULL means no old password. - @param[in] OldPasswordSize The size of OldPassword in byte. - - @retval EFI_SUCCESS The NewPassword is set successfully. - @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect. - @retval EFI_INVALID_PARAMETER The password or size is invalid. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the pass= word. - @retval EFI_ACCESS_DENIED Password retry count reach. - @retval EFI_UNSUPPORTED NewPassword is not strong enough. - @retval EFI_ALREADY_STARTED NewPassword is in history. -**/ -EFI_STATUS -EFIAPI -SetPassword ( - IN CHAR16 *NewPassword, OPTIONAL - IN UINTN NewPasswordSize, - IN CHAR16 *OldPassword, OPTIONAL - IN UINTN OldPasswordSize - ); - -/** - Return if the password is set. - - @retval TRUE The password is set. - @retval FALSE The password is not set. -**/ -BOOLEAN -EFIAPI -IsPasswordInstalled ( - VOID - ); - -#endif diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPas= swordUiLib.h b/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserP= asswordUiLib.h deleted file mode 100644 index 117f480733..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/Include/Library/UserPasswordUi= Lib.h +++ /dev/null @@ -1,37 +0,0 @@ -/** @file - Provides services to do password authentication. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef __USER_PASSWORD_UI_LIB_H__ -#define __USER_PASSWORD_UI_LIB_H__ - -/** - Do password authentication. - - @retval EFI_SUCCESS Password authentication pass. -**/ -EFI_STATUS -EFIAPI -UiDoPasswordAuthentication ( - VOID - ); - -/** - Set password verification policy. - - @param[in] NeedReVerify Need re-verify or not. - - @retval EFI_SUCCESS Set verification policy successfully. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to set verifica= tion policy. -**/ -EFI_STATUS -EFIAPI -UiSetPasswordVerificationPolicy ( - IN BOOLEAN NeedReVerify - ); - -#endif diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswor= dLibNull/PlatformPasswordLibNull.c b/Platform/Intel/UserInterfaceFeaturePkg= /Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c deleted file mode 100644 index 08e081aa99..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNul= l/PlatformPasswordLibNull.c +++ /dev/null @@ -1,78 +0,0 @@ -/** @file - NULL PlatformPasswordLib instance does NOT really detect whether the pas= sword 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 fo= r product. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -BOOLEAN mPasswordCleared =3D FALSE; - -/** - This function is called at password driver entrypoint. - This function should be called only once, to clear the password. - - This function provides a way to reset the password, just in case - the platform owner forgets the password. - The platform should provide a secure way to make sure - only the platform owner is allowed to clear password. - - Once the password is cleared, the platform should provide a way - to set a new password. - - @retval TRUE There is a platform request to clear the password. - @retval FALSE There is no platform request to clear the password. -**/ -BOOLEAN -EFIAPI -IsPasswordCleared ( - VOID - ) -{ - return mPasswordCleared; -} - -/** - This function is called if the password driver finds that the password i= s not enrolled, - when the password is required to input. - - This function should return the action according to platform policy. - - @retval TRUE The caller should force the user to enroll the password. - @retval FALSE The caller may skip the password enroll. -**/ -BOOLEAN -EFIAPI -NeedEnrollPassword ( - VOID - ) -{ - return FALSE; -} - - -/** - Save password clear state from a PCD to mPasswordCleared. - - @param ImageHandle ImageHandle of the loaded driver. - @param SystemTable Pointer to the EFI System Table. - - @retval EFI_SUCCESS PcdPasswordCleared is got successfully. - -**/ -EFI_STATUS -EFIAPI -PlatformPasswordLibNullConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - - mPasswordCleared =3D PcdGetBool(PcdPasswordCleared); - - return EFI_SUCCESS; -} - diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswor= dLibNull/PlatformPasswordLibNull.inf b/Platform/Intel/UserInterfaceFeatureP= kg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf deleted file mode 100644 index 6f4e40f174..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNul= l/PlatformPasswordLibNull.inf +++ /dev/null @@ -1,39 +0,0 @@ -## @file -# NULL platform password library instance that returns the password clear= state based upon PCD. -# -# NULL PlatformPasswordLib instance does NOT really detect whether the pa= ssword 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 f= or product. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION =3D 0x00010006 - BASE_NAME =3D PlatformPasswordLibNull - MODULE_UNI_FILE =3D PlatformPasswordLibNull.uni - FILE_GUID =3D 27417BCA-0CCD-4089-9711-AD069A33C555 - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D PlatformPasswordLib|DXE_RUNTIME_DRIVE= R DXE_SMM_DRIVER DXE_DRIVER - CONSTRUCTOR =3D PlatformPasswordLibNullConstructor - -# -# The following information is for reference only and not required by the = build tools. -# -# VALID_ARCHITECTURES =3D IA32 X64 EBC -# - -[Sources] - PlatformPasswordLibNull.c - -[Packages] - MdePkg/MdePkg.dec - UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec - -[Pcd] - gEfiUserInterfaceFeaturePkgTokenSpaceGuid.PcdPasswordCleared ## CONSU= MES - diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswor= dLibNull/PlatformPasswordLibNull.uni b/Platform/Intel/UserInterfaceFeatureP= kg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni deleted file mode 100644 index b0255889e0..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/PlatformPasswordLibNul= l/PlatformPasswordLibNull.uni +++ /dev/null @@ -1,19 +0,0 @@ -// /** @file -// NULL platform password library instance that returns the password clear= state based upon PCD. -// -// NULL PlatformPasswordLib instance does NOT really detect whether the pa= ssword 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 f= or product. -// -// Copyright (c) 2019, Intel Corporation. All rights reserved.
-// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "NULL platform pas= sword library instance that returns the password clear state based upon PCD= ." - -#string STR_MODULE_DESCRIPTION #language en-US "NULL PlatformPass= wordLib instance does NOT really detect whether the password is cleared but= returns the PCD value directly. This instance can be used to verify securi= ty related features during platform enabling and development. It should be = replaced by a platform-specific method(e.g. Button pressed) in a real platf= orm for product." - diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib= /UserPasswordLib.c b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPas= swordLib/UserPasswordLib.c deleted file mode 100644 index cbaf572378..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPa= sswordLib.c +++ /dev/null @@ -1,274 +0,0 @@ -/** @file - UserPasswordLib instance implementation provides services to - set/verify password and return if the password is set. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include - -#include -#include - -#include -#include -#include -#include - -/** - Initialize the communicate buffer using DataSize and Function. - - @param[out] DataPtr Points to the data in the communicate = buffer. - @param[in] DataSize The data size to send to SMM. - @param[in] Function The function number to initialize the = communicate header. - - @return Communicate buffer. -**/ -VOID* -UserPasswordLibInitCommunicateBuffer ( - OUT VOID **DataPtr OPTIONAL, - IN UINTN DataSize, - IN UINTN Function - ) -{ - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; - SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader; - VOID *Buffer; - EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable; - EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion; - UINTN Index; - UINTN Size; - EFI_STATUS Status; - - Buffer =3D NULL; - Status =3D EfiGetSystemConfigurationTable ( - &gEdkiiPiSmmCommunicationRegionTableGuid, - (VOID **) &SmmCommRegionTable - ); - if (EFI_ERROR (Status)) { - return NULL; - } - ASSERT (SmmCommRegionTable !=3D NULL); - SmmCommMemRegion =3D (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1); - Size =3D 0; - for (Index =3D 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) { - if (SmmCommMemRegion->Type =3D=3D EfiConventionalMemory) { - Size =3D EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages); - if (Size >=3D (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Dat= a) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) { - break; - } - } - SmmCommMemRegion =3D (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRe= gion + SmmCommRegionTable->DescriptorSize); - } - ASSERT (Index < SmmCommRegionTable->NumberOfEntries); - - Buffer =3D (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart; - ASSERT (Buffer !=3D NULL); - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) Buffer; - CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid); - SmmCommunicateHeader->MessageLength =3D DataSize + sizeof (SMM_PASSWORD_= COMMUNICATE_HEADER); - - SmmPasswordFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCom= municateHeader->Data; - ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMM= UNICATE_HEADER)); - SmmPasswordFunctionHeader->Function =3D Function; - if (DataPtr !=3D NULL) { - *DataPtr =3D SmmPasswordFunctionHeader + 1; - } - - return Buffer; -} - -/** - Send the data in communicate buffer to SMM. - - @param[in] Buffer Points to the data in the communicat= e buffer. - @param[in] DataSize The data size to send to SMM. - - @retval EFI_SUCCESS Success is returned from the functio= n in SMM. - @retval Others Failure is returned from the functio= n in SMM. - -**/ -EFI_STATUS -UserPasswordLibSendCommunicateBuffer ( - IN VOID *Buffer, - IN UINTN DataSize - ) -{ - EFI_STATUS Status; - UINTN CommSize; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; - SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader; - EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication; - - // - // Locates SMM Communication protocol. - // - Status =3D gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL,= (VOID **) &SmmCommunication); - ASSERT_EFI_ERROR (Status); - - CommSize =3D DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + s= izeof (SMM_PASSWORD_COMMUNICATE_HEADER); - - Status =3D SmmCommunication->Communicate (SmmCommunication, Buffer, &Com= mSize); - ASSERT_EFI_ERROR (Status); - - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) Buffer; - SmmPasswordFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmComm= unicateHeader->Data; - return SmmPasswordFunctionHeader->ReturnStatus; -} - -/** - Validate if the password is correct. - - @param[in] Password The user input password. - @param[in] PasswordSize The size of Password in byte. - - @retval EFI_SUCCESS The password is correct. - @retval EFI_SECURITY_VIOLATION The password is incorrect. - @retval EFI_INVALID_PARAMETER The password or size is invalid. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the p= assword. - @retval EFI_ACCESS_DENIED Password retry count reach. -**/ -EFI_STATUS -EFIAPI -VerifyPassword ( - IN CHAR16 *Password, - IN UINTN PasswordSize - ) -{ - EFI_STATUS Status; - VOID *Buffer; - SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD *VerifyPassword; - - ASSERT (Password !=3D NULL); - - if (PasswordSize > sizeof(VerifyPassword->Password) * sizeof(CHAR16)) { - return EFI_INVALID_PARAMETER; - } - - Buffer =3D UserPasswordLibInitCommunicateBuffer ( - (VOID**)&VerifyPassword, - sizeof(*VerifyPassword), - SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD - ); - if (Buffer =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Status =3D UnicodeStrToAsciiStrS (Password, VerifyPassword->Password, si= zeof(VerifyPassword->Password)); - if (EFI_ERROR(Status)) { - goto EXIT; - } - - Status =3D UserPasswordLibSendCommunicateBuffer (Buffer, sizeof(*VerifyP= assword)); - -EXIT: - ZeroMem (VerifyPassword, sizeof(*VerifyPassword)); - return Status; -} - -/** - Set a new password. - - @param[in] NewPassword The user input new password. - NULL means clear password. - @param[in] NewPasswordSize The size of NewPassword in byte. - @param[in] OldPassword The user input old password. - NULL means no old password. - @param[in] OldPasswordSize The size of OldPassword in byte. - - @retval EFI_SUCCESS The NewPassword is set successfully. - @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect. - @retval EFI_INVALID_PARAMETER The password or size is invalid. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the pass= word. - @retval EFI_ACCESS_DENIED Password retry count reach. - @retval EFI_UNSUPPORTED NewPassword is not strong enough. - @retval EFI_ALREADY_STARTED NewPassword is in history. -**/ -EFI_STATUS -EFIAPI -SetPassword ( - IN CHAR16 *NewPassword, OPTIONAL - IN UINTN NewPasswordSize, - IN CHAR16 *OldPassword, OPTIONAL - IN UINTN OldPasswordSize - ) -{ - EFI_STATUS Status; - VOID *Buffer; - SMM_PASSWORD_COMMUNICATE_SET_PASSWORD *SetPassword; - - if (NewPasswordSize > sizeof(SetPassword->NewPassword) * sizeof(CHAR16))= { - return EFI_INVALID_PARAMETER; - } - if (OldPasswordSize > sizeof(SetPassword->OldPassword) * sizeof(CHAR16))= { - return EFI_INVALID_PARAMETER; - } - - Buffer =3D UserPasswordLibInitCommunicateBuffer ( - (VOID**)&SetPassword, - sizeof(*SetPassword), - SMM_PASSWORD_FUNCTION_SET_PASSWORD - ); - if (Buffer =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - if (NewPassword !=3D NULL) { - Status =3D UnicodeStrToAsciiStrS (NewPassword, SetPassword->NewPasswor= d, sizeof(SetPassword->NewPassword)); - if (EFI_ERROR(Status)) { - goto EXIT; - } - } else { - SetPassword->NewPassword[0] =3D 0; - } - - if (OldPassword !=3D NULL) { - Status =3D UnicodeStrToAsciiStrS (OldPassword, SetPassword->OldPasswor= d, sizeof(SetPassword->OldPassword)); - if (EFI_ERROR(Status)) { - goto EXIT; - } - } else { - SetPassword->OldPassword[0] =3D 0; - } - - Status =3D UserPasswordLibSendCommunicateBuffer (Buffer, sizeof(*SetPass= word)); - -EXIT: - ZeroMem (SetPassword, sizeof(*SetPassword)); - return Status; -} - -/** - Return if the password is set. - - @retval TRUE The password is set. - @retval FALSE The password is not set. -**/ -BOOLEAN -EFIAPI -IsPasswordInstalled ( - VOID - ) -{ - EFI_STATUS Status; - VOID *Buffer; - - Buffer =3D UserPasswordLibInitCommunicateBuffer ( - NULL, - 0, - SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET - ); - if (Buffer =3D=3D NULL) { - return FALSE; - } - - Status =3D UserPasswordLibSendCommunicateBuffer (Buffer, 0); - if (EFI_ERROR (Status)) { - return FALSE; - } - - return TRUE; -} - diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib= /UserPasswordLib.inf b/Platform/Intel/UserInterfaceFeaturePkg/Library/UserP= asswordLib/UserPasswordLib.inf deleted file mode 100644 index 6dc6ca734f..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPa= sswordLib.inf +++ /dev/null @@ -1,37 +0,0 @@ -## @file -# UserPasswordLib instance provides services to set/verify password -# and return if the password is set. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D UserPasswordLib - FILE_GUID =3D 422BA58A-F162-4ECC-BD9A-AD84FE940F37 - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D UserPasswordLib|DXE_RUNTIME_DRIVER DX= E_SMM_DRIVER DXE_DRIVER UEFI_APPLICATION - -[Sources] - UserPasswordLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - DebugLib - UefiLib - BaseMemoryLib - -[Guids] - gUserAuthenticationGuid ## CONSUMES ## GUID - gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable - -[Protocols] - gEfiSmmCommunicationProtocolGuid ## CONSUMES diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiL= ib/UserPasswordUiLib.c b/Platform/Intel/UserInterfaceFeaturePkg/Library/Use= rPasswordUiLib/UserPasswordUiLib.c deleted file mode 100644 index 050bfda63a..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/User= PasswordUiLib.c +++ /dev/null @@ -1,522 +0,0 @@ -/** @file - UserPasswordUiLib instance provides services to do password authenticati= on. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/** - Initialize the communicate buffer using DataSize and Function. - - @param[out] DataPtr Points to the data in the communicate = buffer. - @param[in] DataSize The data size to send to SMM. - @param[in] Function The function number to initialize the = communicate header. - - @return Communicate buffer. -**/ -VOID* -UserPasswordUiLibInitCommunicateBuffer ( - OUT VOID **DataPtr OPTIONAL, - IN UINTN DataSize, - IN UINTN Function - ) -{ - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; - SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader; - VOID *Buffer; - EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable; - EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion; - UINTN Index; - UINTN Size; - EFI_STATUS Status; - - Buffer =3D NULL; - Status =3D EfiGetSystemConfigurationTable ( - &gEdkiiPiSmmCommunicationRegionTableGuid, - (VOID **) &SmmCommRegionTable - ); - if (EFI_ERROR (Status)) { - return NULL; - } - ASSERT (SmmCommRegionTable !=3D NULL); - SmmCommMemRegion =3D (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1); - Size =3D 0; - for (Index =3D 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) { - if (SmmCommMemRegion->Type =3D=3D EfiConventionalMemory) { - Size =3D EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages); - if (Size >=3D (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Dat= a) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) { - break; - } - } - SmmCommMemRegion =3D (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRe= gion + SmmCommRegionTable->DescriptorSize); - } - ASSERT (Index < SmmCommRegionTable->NumberOfEntries); - - Buffer =3D (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart; - ASSERT (Buffer !=3D NULL); - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) Buffer; - CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid); - SmmCommunicateHeader->MessageLength =3D DataSize + sizeof (SMM_PASSWORD_= COMMUNICATE_HEADER); - - SmmPasswordFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCom= municateHeader->Data; - ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMM= UNICATE_HEADER)); - SmmPasswordFunctionHeader->Function =3D Function; - if (DataPtr !=3D NULL) { - *DataPtr =3D SmmPasswordFunctionHeader + 1; - } - - return Buffer; -} - -/** - Send the data in communicate buffer to SMM. - - @param[in] Buffer Points to the data in the communicat= e buffer. - @param[in] DataSize The data size to send to SMM. - - @retval EFI_SUCCESS Success is returned from the functio= n in SMM. - @retval Others Failure is returned from the functio= n in SMM. - -**/ -EFI_STATUS -UserPasswordUiLibSendCommunicateBuffer ( - IN VOID *Buffer, - IN UINTN DataSize - ) -{ - EFI_STATUS Status; - UINTN CommSize; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; - SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader; - EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication; - - // - // Locates SMM Communication protocol. - // - Status =3D gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL,= (VOID **) &SmmCommunication); - ASSERT_EFI_ERROR (Status); - - CommSize =3D DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + s= izeof (SMM_PASSWORD_COMMUNICATE_HEADER); - - Status =3D SmmCommunication->Communicate (SmmCommunication, Buffer, &Com= mSize); - ASSERT_EFI_ERROR (Status); - - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) Buffer; - SmmPasswordFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmComm= unicateHeader->Data; - return SmmPasswordFunctionHeader->ReturnStatus; -} - -/** - Set password verification policy. - - @param[in] NeedReVerify Need re-verify or not. - - @retval EFI_SUCCESS Set verification policy successfully. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to set verifica= tion policy. -**/ -EFI_STATUS -EFIAPI -UiSetPasswordVerificationPolicy ( - IN BOOLEAN NeedReVerify - ) -{ - VOID *Buffer; - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *SetVerifyPolicy; - - Buffer =3D UserPasswordUiLibInitCommunicateBuffer ( - (VOID**)&SetVerifyPolicy, - sizeof(*SetVerifyPolicy), - SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY - ); - if (Buffer =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - SetVerifyPolicy->NeedReVerify =3D NeedReVerify; - - return UserPasswordUiLibSendCommunicateBuffer (Buffer, sizeof(*SetVerify= Policy)); -} - -/** - Get a user input string. - - @param[in] PopUpString A popup string to inform user. - @param[in, out] UserInput The user input string - @param[in] UserInputMaxLen The max unicode count of the UserInput= without NULL terminator. -**/ -EFI_STATUS -GetUserInput ( - IN CHAR16 *PopUpString, - IN OUT CHAR16 *UserInput, - IN UINTN UserInputMaxLen - ) -{ - EFI_INPUT_KEY InputKey; - UINTN InputLength; - CHAR16 *Mask; - - UserInput[0] =3D 0; - Mask =3D AllocateZeroPool ((UserInputMaxLen + 1) * sizeof(CHAR16)); - if (Mask =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - InputLength =3D 0; - - while (TRUE) { - if (InputLength < UserInputMaxLen) { - Mask[InputLength] =3D L'_'; - } - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &InputKey, - PopUpString, - L"--------------------------------", - Mask, - NULL - ); - if (InputKey.ScanCode =3D=3D SCAN_NULL) { - // - // Check whether finish inputing password. - // - if (InputKey.UnicodeChar =3D=3D CHAR_CARRIAGE_RETURN && InputLength = > 0) { - // - // Add the null terminator. - // - UserInput[InputLength] =3D 0; - break; - } else if ((InputKey.UnicodeChar =3D=3D CHAR_NULL) || - (InputKey.UnicodeChar =3D=3D CHAR_LINEFEED) || - (InputKey.UnicodeChar =3D=3D CHAR_CARRIAGE_RETURN) - ) { - continue; - } else { - // - // delete last key entered - // - if (InputKey.UnicodeChar =3D=3D CHAR_BACKSPACE) { - if (InputLength > 0) { - UserInput[InputLength] =3D 0; - Mask[InputLength] =3D 0; - InputLength--; - } - } else { - if (InputLength =3D=3D UserInputMaxLen) { - Mask[InputLength] =3D 0; - continue; - } - // - // add Next key entry - // - UserInput[InputLength] =3D InputKey.UnicodeChar; - Mask[InputLength] =3D L'*'; - InputLength++; - } - } - } - } - FreePool (Mask); - return EFI_SUCCESS; -} - -/** - Display a message box to end user. - - @param[in] DisplayString The string in message box. -**/ -VOID -MessageBox ( - IN CHAR16 *DisplayString - ) -{ - EFI_INPUT_KEY Key; - - do { - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &Key, - L"", - DisplayString, - L"Press ENTER to continue ...", - L"", - NULL - ); - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); -} - -/** - Force system reset. -**/ -VOID -ForceSystemReset ( - VOID - ) -{ - MessageBox (L"Password retry count reach, reset system!"); - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); - CpuDeadLoop(); -} - -/** - Display message for set password. - - @param[in] ReturnStatus The return status for set password. -**/ -VOID -PrintSetPasswordStatus ( - IN EFI_STATUS ReturnStatus - ) -{ - CHAR16 *DisplayString; - CHAR16 *DisplayString2; - - EFI_INPUT_KEY Key; - - if (ReturnStatus =3D=3D EFI_UNSUPPORTED) { - DisplayString =3D L"New password is not strong enough!"; - DisplayString2 =3D L"Password must at least 8 chars and include lowerc= ase, uppercase alphabetic, number and symbol"; - - do { - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &Key, - L"", - DisplayString, - DisplayString2, - L"Press ENTER to continue ...", - L"", - NULL - ); - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); - } else { - if (ReturnStatus =3D=3D EFI_SUCCESS) { - DisplayString =3D L"New password is updated successfully!"; - } else if (ReturnStatus =3D=3D EFI_ALREADY_STARTED) { - DisplayString =3D L"New password is found in the history passwords!"; - } else { - DisplayString =3D L"New password update fails!"; - } - - do { - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &Key, - L"", - DisplayString, - L"Press ENTER to continue ...", - L"", - NULL - ); - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); - } -} - -/** - Get password verification policy. - - @param[out] VerifyPolicy Verification policy. - - @retval EFI_SUCCESS Get verification policy successfully. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verifica= tion policy. -**/ -EFI_STATUS -GetPasswordVerificationPolicy ( - OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy - ) -{ - EFI_STATUS Status; - VOID *Buffer; - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *TempVerifyPolicy; - - Buffer =3D UserPasswordUiLibInitCommunicateBuffer ( - (VOID**)&TempVerifyPolicy, - sizeof(*TempVerifyPolicy), - SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY - ); - if (Buffer =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Status =3D UserPasswordUiLibSendCommunicateBuffer (Buffer, sizeof(*TempV= erifyPolicy)); - if (!EFI_ERROR (Status)) { - CopyMem (VerifyPolicy, TempVerifyPolicy, sizeof (SMM_PASSWORD_COMMUNIC= ATE_VERIFY_POLICY)); - } - - return Status; -} - -/** - Return if the password was verified. - - @retval TRUE The password was verified. - @retval FALSE The password was not verified. -**/ -BOOLEAN -WasPasswordVerified ( - VOID - ) -{ - EFI_STATUS Status; - VOID *Buffer; - - Buffer =3D UserPasswordUiLibInitCommunicateBuffer ( - NULL, - 0, - SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED - ); - if (Buffer =3D=3D NULL) { - return FALSE; - } - - Status =3D UserPasswordUiLibSendCommunicateBuffer (Buffer, 0); - if (EFI_ERROR (Status)) { - return FALSE; - } - - return TRUE; -} - -/** - Require user input password. - - @retval TRUE User input correct password successfully. - @retval FALSE The password is not set. -**/ -BOOLEAN -RequireUserPassword ( - VOID - ) -{ - EFI_STATUS Status; - CHAR16 UserInputPw[PASSWORD_MAX_SIZE]; - CHAR16 *PopUpString; - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY VerifyPolicy; - - Status =3D EFI_SUCCESS; - ZeroMem(UserInputPw, sizeof(UserInputPw)); - - if (!IsPasswordInstalled ()) { - return FALSE; - } - - Status =3D GetPasswordVerificationPolicy (&VerifyPolicy); - if (!EFI_ERROR (Status)) { - if (WasPasswordVerified() && (!VerifyPolicy.NeedReVerify)) { - DEBUG ((DEBUG_INFO, "Password was verified and Re-verify is not need= ed\n")); - return TRUE; - } - } - - PopUpString =3D L"Please input admin password"; - - while (TRUE) { - gST->ConOut->ClearScreen(gST->ConOut); - GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1); - - Status =3D VerifyPassword (UserInputPw, StrSize(UserInputPw)); - if (!EFI_ERROR(Status)) { - break; - } - if (Status =3D=3D EFI_ACCESS_DENIED) { - // - // Password retry count reach. - // - ForceSystemReset (); - } - MessageBox (L"Incorrect password!"); - } - - ZeroMem(UserInputPw, sizeof(UserInputPw)); - - gST->ConOut->ClearScreen(gST->ConOut); - - return TRUE; -} - -/** - Set user password. - -**/ -VOID -SetUserPassword ( - VOID - ) -{ - EFI_STATUS Status; - CHAR16 UserInputPw[PASSWORD_MAX_SIZE]; - CHAR16 TmpPassword[PASSWORD_MAX_SIZE]; - CHAR16 *PopUpString; - CHAR16 *PopUpString2; - - ZeroMem(UserInputPw, sizeof(UserInputPw)); - ZeroMem(TmpPassword, sizeof(TmpPassword)); - - PopUpString =3D L"Please set admin password"; - - while (TRUE) { - gST->ConOut->ClearScreen(gST->ConOut); - GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1); - - PopUpString2 =3D L"Please confirm your new password"; - gST->ConOut->ClearScreen(gST->ConOut); - GetUserInput (PopUpString2, TmpPassword, PASSWORD_MAX_SIZE - 1); - if (StrCmp (TmpPassword, UserInputPw) !=3D 0) { - MessageBox (L"Password are not the same!"); - continue; - } - - Status =3D SetPassword (UserInputPw, StrSize(UserInputPw), NULL, 0); - PrintSetPasswordStatus (Status); - if (!EFI_ERROR(Status)) { - break; - } - } - - ZeroMem(UserInputPw, sizeof(UserInputPw)); - ZeroMem(TmpPassword, sizeof(TmpPassword)); - - gST->ConOut->ClearScreen(gST->ConOut); -} - -/** - Do password authentication. - - @retval EFI_SUCCESS Password authentication pass. -**/ -EFI_STATUS -EFIAPI -UiDoPasswordAuthentication ( - VOID - ) -{ - BOOLEAN PasswordSet; - - PasswordSet =3D RequireUserPassword (); - if (PasswordSet) { - DEBUG ((DEBUG_INFO, "Welcome Admin!\n")); - } else { - DEBUG ((DEBUG_INFO, "Admin password is not set!\n")); - if (NeedEnrollPassword()) { - SetUserPassword (); - } - } - - return EFI_SUCCESS; -} - diff --git a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiL= ib/UserPasswordUiLib.inf b/Platform/Intel/UserInterfaceFeaturePkg/Library/U= serPasswordUiLib/UserPasswordUiLib.inf deleted file mode 100644 index bdd8680ba0..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/Library/UserPasswordUiLib/User= PasswordUiLib.inf +++ /dev/null @@ -1,41 +0,0 @@ -## @file -# UserPasswordUiLib instance provides services to do password authenticat= ion. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D UserPasswordUiLib - FILE_GUID =3D E2E92636-F511-46BC-A08B-02F815AFA884 - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D UserPasswordUiLib|DXE_RUNTIME_DRIVER = DXE_SMM_DRIVER DXE_DRIVER UEFI_APPLICATION - -[Sources] - UserPasswordUiLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - DebugLib - UefiLib - MemoryAllocationLib - BaseMemoryLib - PrintLib - PlatformPasswordLib - UserPasswordLib - -[Guids] - gUserAuthenticationGuid ## CONSUMES ## GUID - gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable - -[Protocols] - gEfiSmmCommunicationProtocolGuid ## CONSUMES diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyS= ervice.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeySer= vice.c deleted file mode 100644 index 8b06e58ca5..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.c +++ /dev/null @@ -1,133 +0,0 @@ -/** @file - Password key service. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include "KeyService.h" - -/** - Compares the contents of two buffers with slow algorithm - - This function compares Length bytes of SourceBuffer to Length bytes of D= estinationBuffer. - If all Length bytes of the two buffers are identical, then 0 is returned= . Otherwise, the - value returned is the first mismatched byte in SourceBuffer subtracted f= rom the first - mismatched byte in DestinationBuffer. - - If Length > 0 and DestinationBuffer is NULL, then ASSERT(). - If Length > 0 and SourceBuffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then AS= SERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(= ). - - @param DestinationBuffer The pointer to the destination buffer to compa= re. - @param SourceBuffer The pointer to the source buffer to compare. - @param Length The number of bytes to compare. - - @return 0 All Length bytes of the two buffers are identi= cal. - @retval -1 The SourceBuffer is not identical to Destinati= onBuffer. - -**/ -INTN -EFIAPI -KeyLibSlowCompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ) -{ - UINT8 Delta; - UINTN Index; - UINT8 *Destination; - UINT8 *Source; - - Destination =3D (UINT8 *)DestinationBuffer; - Source =3D (UINT8 *)SourceBuffer; - Delta =3D 0; - for (Index =3D 0; Index < Length; Index++) { - Delta |=3D Destination[Index] ^ Source[Index]; - } - if (Delta =3D=3D 0) { - return 0; - } else { - return -1; - } -} - -/** - Generate Salt value. - - @param[in, out] SaltValue Points to the salt buffer - @param[in] SaltSize Size of the salt buffer - - @retval TRUE Salt is generated. - @retval FALSE Salt is not generated. -**/ -BOOLEAN -EFIAPI -KeyLibGenerateSalt ( - IN OUT UINT8 *SaltValue, - IN UINTN SaltSize - ) -{ - if (SaltValue =3D=3D NULL) { - return FALSE; - } - RandomSeed(NULL, 0); - RandomBytes(SaltValue, SaltSize); - return TRUE; -} - -/** - Hash the password with PBKDF2. - - @param[in] HashType Hash type - @param[in] Key Points to the key buffer - @param[in] KeySize Key buffer size - @param[in] SaltValue Points to the salt buffer - @param[in] SaltSize Size of the salt buffer - @param[out] KeyHash Points to the hashed result - @param[in] KeyHashSize Size of the hash buffer - - @retval TRUE Hash the data successfully. - @retval FALSE Failed to hash the data. - -**/ -BOOLEAN -EFIAPI -KeyLibGeneratePBKDF2Hash ( - IN UINT32 HashType, - IN VOID *Key, - IN UINTN KeySize, - IN UINT8 *SaltValue, - IN UINTN SaltSize, - OUT UINT8 *KeyHash, - IN UINTN KeyHashSize - ) -{ - BOOLEAN Result; - - if (HashType !=3D HASH_TYPE_SHA256) { - return FALSE; - } - if (KeyHashSize !=3D SHA256_DIGEST_SIZE) { - return FALSE; - } - - Result =3D Pkcs5HashPassword ( - KeySize, - Key, - SaltSize, - SaltValue, - DEFAULT_PBKDF2_ITERATION_COUNT, - SHA256_DIGEST_SIZE, - KeyHashSize, - KeyHash - ); - return Result; -} diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyS= ervice.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeySer= vice.h deleted file mode 100644 index d0b20851fa..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/KeyService.h +++ /dev/null @@ -1,88 +0,0 @@ -/** @file - Header file for key service. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef __KEY_LIB_H__ -#define __KEY_LIB_H__ - -/** - Compares the contents of two buffers with slow algorithm - - This function compares Length bytes of SourceBuffer to Length bytes of D= estinationBuffer. - If all Length bytes of the two buffers are identical, then 0 is returned= . Otherwise, the - value returned is the first mismatched byte in SourceBuffer subtracted f= rom the first - mismatched byte in DestinationBuffer. - - If Length > 0 and DestinationBuffer is NULL, then ASSERT(). - If Length > 0 and SourceBuffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then AS= SERT(). - If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT(= ). - - @param DestinationBuffer The pointer to the destination buffer to compa= re. - @param SourceBuffer The pointer to the source buffer to compare. - @param Length The number of bytes to compare. - - @return 0 All Length bytes of the two buffers are identi= cal. - @retval -1 The SourceBuffer is not identical to Destinati= onBuffer. - -**/ -INTN -EFIAPI -KeyLibSlowCompareMem ( - IN CONST VOID *DestinationBuffer, - IN CONST VOID *SourceBuffer, - IN UINTN Length - ); - -/** - Generate Salt value. - - @param[in, out] SaltValue Points to the salt buffer - @param[in] SaltSize Size of the salt buffer - - @retval TRUE Salt is generated. - @retval FALSE Salt is not generated. -**/ -BOOLEAN -EFIAPI -KeyLibGenerateSalt( - IN OUT UINT8 *SaltValue, - IN UINTN SaltSize - ); - -#define HASH_TYPE_SHA256 0x000B -#define DEFAULT_PBKDF2_ITERATION_COUNT 1000 - -/** - Hash the password with PBKDF2. - - @param[in] HashType Hash type - @param[in] Key Points to the key buffer - @param[in] KeySize Key buffer size - @param[in] SaltValue Points to the salt buffer - @param[in] SaltSize Size of the salt buffer - @param[out] KeyHash Points to the hashed result - @param[in] KeyHashSize Size of the hash buffer - - @retval TRUE Hash the data successfully. - @retval FALSE Failed to hash the data. - -**/ -BOOLEAN -EFIAPI -KeyLibGeneratePBKDF2Hash ( - IN UINT32 HashType, - IN VOID *Key, - IN UINTN KeySize, - IN UINT8 *SaltValue, - IN UINTN SaltSize, - OUT UINT8 *KeyHash, - IN UINTN KeyHashSize - ); - -#endif - diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/User= Authentication2Dxe.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentic= ation/UserAuthentication2Dxe.c deleted file mode 100644 index b4326d380f..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthent= ication2Dxe.c +++ /dev/null @@ -1,484 +0,0 @@ -/** @file - This Driver mainly provides Setup Form to change password. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "UserAuthentication2Dxe.h" - -USER_AUTHENTICATION_PRIVATE_DATA *mUserAuthenticationData =3D NULL; - -EFI_GUID mUserAuthenticationVendorGuid =3D USER_AUTHENTICATION_FORMSET_GUI= D; -HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath =3D { - { - { - HARDWARE_DEVICE_PATH, - HW_VENDOR_DP, - { - (UINT8) (sizeof (VENDOR_DEVICE_PATH)), - (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) - } - }, - USER_AUTHENTICATION_FORMSET_GUID - }, - { - END_DEVICE_PATH_TYPE, - END_ENTIRE_DEVICE_PATH_SUBTYPE, - { - (UINT8) (END_DEVICE_PATH_LENGTH), - (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8) - } - } -}; - -/** - Display a message box to end user. - - @param[in] DisplayString The string in message box. -**/ -VOID -MessageBox ( - IN CHAR16 *DisplayString - ) -{ - EFI_INPUT_KEY Key; - - do { - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &Key, - L"", - DisplayString, - L"Press ENTER to continue ...", - L"", - NULL - ); - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); -} - -/** - Force system reset. -**/ -VOID -ForceSystemReset ( - VOID - ) -{ - MessageBox (L"Password retry count reach, reset system!"); - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); - CpuDeadLoop(); -} - -/** - Display message for set password. - - @param[in] ReturnStatus The return status for set password. -**/ -VOID -PrintSetPasswordStatus ( - IN EFI_STATUS ReturnStatus - ) -{ - CHAR16 *DisplayString; - CHAR16 *DisplayString2; - - EFI_INPUT_KEY Key; - - if (ReturnStatus =3D=3D EFI_UNSUPPORTED) { - DisplayString =3D L"New password is not strong enough!"; - DisplayString2 =3D L"Password must at least 8 chars and include lowerc= ase, uppercase alphabetic, number and symbol"; - - do { - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &Key, - L"", - DisplayString, - DisplayString2, - L"Press ENTER to continue ...", - L"", - NULL - ); - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); - } else { - if (ReturnStatus =3D=3D EFI_SUCCESS) { - DisplayString =3D L"New password is updated successfully!"; - } else if (ReturnStatus =3D=3D EFI_ALREADY_STARTED) { - DisplayString =3D L"New password is found in the history passwords!"; - } else { - DisplayString =3D L"New password update fails!"; - } - - do { - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &Key, - L"", - DisplayString, - L"Press ENTER to continue ...", - L"", - NULL - ); - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); - } -} - -/** - This function allows a caller to extract the current configuration for o= ne - or more named elements from the target driver. - - @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. - @param Request A null-terminated Unicode string in - format. - @param Progress On return, points to a character in the R= equest - string. Points to the string's null termi= nator if - request was successful. Points to the mos= t recent - '&' before the first failing name/value p= air (or - the beginning of the string if the failur= e is in - the first name/value pair) if the request= was not - successful. - @param Results A null-terminated Unicode string in - format which has all valu= es filled - in for the names in the Request string. S= tring to - be allocated by the called function. - - @retval EFI_SUCCESS The Results is filled with the requested = values. - @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. - @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown nam= e. - @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this - driver. - -**/ -EFI_STATUS -EFIAPI -ExtractConfig ( - IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, - IN CONST EFI_STRING Request, - OUT EFI_STRING *Progress, - OUT EFI_STRING *Results - ) -{ - if (Progress =3D=3D NULL || Results =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } - *Progress =3D Request; - return EFI_NOT_FOUND; -} - - -/** - This function processes the results of changes in configuration. - - @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. - @param Configuration A null-terminated Unicode string in - format. - @param Progress A pointer to a string filled in with the = offset of - the most recent '&' before the first fail= ing - name/value pair (or the beginning of the = string if - the failure is in the first name/value pa= ir) or - the terminating NULL if all was successfu= l. - - @retval EFI_SUCCESS The Results is processed successfully. - @retval EFI_INVALID_PARAMETER Configuration is NULL. - @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this - driver. - -**/ -EFI_STATUS -EFIAPI -RouteConfig ( - IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, - IN CONST EFI_STRING Configuration, - OUT EFI_STRING *Progress - ) -{ - if (Configuration =3D=3D NULL || Progress =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } - - *Progress =3D Configuration; - - return EFI_NOT_FOUND; -} - -/** - HII update Admin Password status. - -**/ -VOID -HiiUpdateAdminPasswordStatus ( - VOID - ) -{ - if (IsPasswordInstalled ()) { - HiiSetString ( - mUserAuthenticationData->HiiHandle, - STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT), - L"Installed", - NULL - ); - } else { - HiiSetString ( - mUserAuthenticationData->HiiHandle, - STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT), - L"Not Installed", - NULL - ); - } -} - -/** - This function processes the results of changes in configuration. - - @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. - @param Action Specifies the type of action taken by the= browser. - @param QuestionId A unique value which is sent to the origi= nal - exporting driver so that it can identify = the type - of data to expect. - @param Type The type of value for the question. - @param Value A pointer to the data being sent to the o= riginal - exporting driver. - @param ActionRequest On return, points to the action requested= by the - callback function. - - @retval EFI_SUCCESS The callback successfully handled the act= ion. - @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold t= he - variable and its data. - @retval EFI_DEVICE_ERROR The variable could not be saved. - @retval EFI_UNSUPPORTED The specified Action is not supported by = the - callback. - -**/ -EFI_STATUS -EFIAPI -UserAuthenticationCallback ( - IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, - IN EFI_BROWSER_ACTION Action, - IN EFI_QUESTION_ID QuestionId, - IN UINT8 Type, - IN EFI_IFR_TYPE_VALUE *Value, - OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest - ) -{ - EFI_STATUS Status; - CHAR16 *UserInputPassword; - - Status =3D EFI_SUCCESS; - - if (((Value =3D=3D NULL) && (Action !=3D EFI_BROWSER_ACTION_FORM_OPEN) &= & (Action !=3D EFI_BROWSER_ACTION_FORM_CLOSE)) || - (ActionRequest =3D=3D NULL)) { - return EFI_INVALID_PARAMETER; - } - - switch (Action) { - case EFI_BROWSER_ACTION_FORM_OPEN: - { - switch (QuestionId) { - case ADMIN_PASSWORD_KEY_ID: - HiiUpdateAdminPasswordStatus (); - default: - break; - } - } - break; - case EFI_BROWSER_ACTION_CHANGING: - { - switch (QuestionId) { - case ADMIN_PASSWORD_KEY_ID: - if ((Type =3D=3D EFI_IFR_TYPE_STRING) && (Value->string =3D=3D 0) = && - (mUserAuthenticationData->PasswordState =3D=3D BROWSER_STATE_S= ET_PASSWORD)) { - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_VALIDAT= E_PASSWORD; - ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthe= nticationData->OldPassword)); - return EFI_INVALID_PARAMETER; - } - // - // The Callback is responsible for validating old password input b= y user, - // If Callback return EFI_SUCCESS, it indicates validation pass. - // - switch (mUserAuthenticationData->PasswordState) { - case BROWSER_STATE_VALIDATE_PASSWORD: - UserInputPassword =3D HiiGetString (mUserAuthenticationData->Hii= Handle, Value->string, NULL); - if (UserInputPassword =3D=3D NULL) { - return EFI_UNSUPPORTED; - } - if ((StrLen (UserInputPassword) >=3D PASSWORD_MAX_SIZE)) { - Status =3D EFI_NOT_READY; - break; - } - if (UserInputPassword[0] =3D=3D 0) { - // - // Setup will use an empty password to check whether the old p= assword is set, - // If the validation is successful, means there is no old pass= word, return - // success to set the new password. Or need to return EFI_NOT_= READY to - // let user input the old password. - // - Status =3D VerifyPassword (UserInputPassword, StrSize (UserInp= utPassword)); - if (Status =3D=3D EFI_SUCCESS) { - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_SET= _PASSWORD; - } else { - Status =3D EFI_NOT_READY; - } - break; - } - Status =3D VerifyPassword (UserInputPassword, StrSize (UserInput= Password)); - if (Status =3D=3D EFI_SUCCESS) { - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_SET_P= ASSWORD; - StrCpyS ( - mUserAuthenticationData->OldPassword, - sizeof(mUserAuthenticationData->OldPassword)/sizeof(CHAR16), - UserInputPassword - ); - } else { - // - // Old password mismatch, return EFI_NOT_READY to prompt for e= rror message. - // - if (Status =3D=3D EFI_ACCESS_DENIED) { - // - // Password retry count reach. - // - ForceSystemReset (); - } - Status =3D EFI_NOT_READY; - } - break; - - case BROWSER_STATE_SET_PASSWORD: - UserInputPassword =3D HiiGetString (mUserAuthenticationData->Hii= Handle, Value->string, NULL); - if (UserInputPassword =3D=3D NULL) { - return EFI_UNSUPPORTED; - } - if ((StrLen (UserInputPassword) >=3D PASSWORD_MAX_SIZE)) { - Status =3D EFI_NOT_READY; - break; - } - Status =3D SetPassword (UserInputPassword, StrSize (UserInputPas= sword), mUserAuthenticationData->OldPassword, StrSize(mUserAuthenticationDa= ta->OldPassword)); - PrintSetPasswordStatus (Status); - ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthe= nticationData->OldPassword)); - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_VALIDAT= E_PASSWORD; - HiiUpdateAdminPasswordStatus (); - break; - - default: - break; - } - default: - break; - } - } - break; - default: - break; - } - return Status; -} - -/** - User Authentication entry point. - - @param ImageHandle The image handle. - @param SystemTable The system table. - - @retval EFI_SUCCESS The entry point is executed successfully. - @return other Contain some other errors. - -**/ -EFI_STATUS -EFIAPI -UserAuthentication2Entry ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - EFI_HANDLE DriverHandle; - EFI_HII_HANDLE HiiHandle; - - DriverHandle =3D NULL; - - mUserAuthenticationData =3D AllocateZeroPool (sizeof (USER_AUTHENTICATIO= N_PRIVATE_DATA)); - if (mUserAuthenticationData =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - mUserAuthenticationData->ConfigAccess.ExtractConfig =3D ExtractConfig; - mUserAuthenticationData->ConfigAccess.RouteConfig =3D RouteConfig; - mUserAuthenticationData->ConfigAccess.Callback =3D UserAuthenticationCal= lback; - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_VALIDATE_PASSWO= RD; - - // - // Install Config Access protocol to driver handle. - // - Status =3D gBS->InstallMultipleProtocolInterfaces ( - &DriverHandle, - &gEfiDevicePathProtocolGuid, - &mHiiVendorDevicePath, - &gEfiHiiConfigAccessProtocolGuid, - &mUserAuthenticationData->ConfigAccess, - NULL - ); - ASSERT_EFI_ERROR (Status); - mUserAuthenticationData->DriverHandle =3D DriverHandle; - - // - // Add HII data to database. - // - HiiHandle =3D HiiAddPackages ( - &mUserAuthenticationVendorGuid, - DriverHandle, - UserAuthentication2DxeStrings, - UserAuthenticationDxeVfrBin, - NULL - ); - if (HiiHandle =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - mUserAuthenticationData->HiiHandle =3D HiiHandle; - - return EFI_SUCCESS; -} - -/** - Unloads the application and its installed protocol. - - @param[in] ImageHandle Handle that identifies the image to be unl= oaded. - - @retval EFI_SUCCESS The image has been unloaded. -**/ -EFI_STATUS -EFIAPI -UserAuthentication2Unload ( - IN EFI_HANDLE ImageHandle - ) -{ - ASSERT (mUserAuthenticationData !=3D NULL); - - // - // Uninstall Config Access Protocol. - // - if (mUserAuthenticationData->DriverHandle !=3D NULL) { - gBS->UninstallMultipleProtocolInterfaces ( - mUserAuthenticationData->DriverHandle, - &gEfiDevicePathProtocolGuid, - &mHiiVendorDevicePath, - &gEfiHiiConfigAccessProtocolGuid, - &mUserAuthenticationData->ConfigAccess, - NULL - ); - mUserAuthenticationData->DriverHandle =3D NULL; - } - - // - // Remove Hii Data. - // - if (mUserAuthenticationData->HiiHandle !=3D NULL) { - HiiRemovePackages (mUserAuthenticationData->HiiHandle); - } - - FreePool (mUserAuthenticationData); - mUserAuthenticationData =3D NULL; - - return EFI_SUCCESS; -} - diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/User= Authentication2Dxe.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentic= ation/UserAuthentication2Dxe.h deleted file mode 100644 index 3b7fba026d..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthent= ication2Dxe.h +++ /dev/null @@ -1,55 +0,0 @@ -/** @file - Header file for UserAuthentication2Dxe. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef _USER_AUTHENTICATION_DXE_H_ -#define _USER_AUTHENTICATION_DXE_H_ - - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "UserAuthenticationDxeFormset.h" - -extern UINT8 UserAuthenticationDxeVfrBin[]; -extern UINT8 UserAuthentication2DxeStrings[]; - -typedef struct { - EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; - EFI_HANDLE DriverHandle; - EFI_HII_HANDLE HiiHandle; - UINT8 PasswordState; - CHAR16 OldPassword[PASSWORD_MAX_SIZE]; -} USER_AUTHENTICATION_PRIVATE_DATA; - -#pragma pack(1) -/// -/// HII specific Vendor Device Path definition. -/// -typedef struct { - VENDOR_DEVICE_PATH VendorDevicePath; - EFI_DEVICE_PATH_PROTOCOL End; -} HII_VENDOR_DEVICE_PATH; -#pragma pack() - -#endif diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/User= Authentication2Dxe.inf b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthent= ication/UserAuthentication2Dxe.inf deleted file mode 100644 index d93d511005..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthent= ication2Dxe.inf +++ /dev/null @@ -1,53 +0,0 @@ -## @file -# User Authentication 2 Dxe Driver. -# -# This Driver mainly provides Setup Form to change password. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D UserAuthentication2Dxe - FILE_GUID =3D 4EF592F4-C716-40CC-8C07-1E4E3BD71F11 - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 2.0 - ENTRY_POINT =3D UserAuthentication2Entry - UNLOAD_IMAGE =3D UserAuthentication2Unload - -[Sources] - UserAuthentication2Dxe.c - UserAuthentication2Dxe.h - UserAuthenticationDxeFormset.h - UserAuthenticationDxeVfr.vfr - UserAuthenticationDxeStrings.uni - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec - -[LibraryClasses] - BaseLib - UefiBootServicesTableLib - UefiDriverEntryPoint - UefiRuntimeServicesTableLib - BaseMemoryLib - DebugLib - UefiLib - HiiLib - DevicePathLib - MemoryAllocationLib - UserPasswordLib - -[Protocols] - gEfiDevicePathProtocolGuid ## PRODUCES - gEfiHiiConfigAccessProtocolGuid ## PRODUCES - -[Depex] - gEfiSimpleTextOutProtocolGuid AND - gEfiSmmCommunicationProtocolGuid AND - gEfiVariableArchProtocolGuid AND - gEfiVariableWriteArchProtocolGuid diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/User= AuthenticationDxe.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationDxe.c deleted file mode 100644 index bba2057a96..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthent= icationDxe.c +++ /dev/null @@ -1,780 +0,0 @@ -/** @file - This Driver mainly provides Setup Form to change password and - does user authentication before entering Setup. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "UserAuthenticationDxe.h" - -EFI_EVENT mExitBootServicesEvent =3D NULL; -EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol =3D NULL; -USER_AUTHENTICATION_PRIVATE_DATA *mUserAuthenticationData =3D NULL; -EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication =3D NULL; - -EFI_GUID mUserAuthenticationVendorGuid =3D USER_AUTHENTICATION_FORMSET_GUI= D; -HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath =3D { - { - { - HARDWARE_DEVICE_PATH, - HW_VENDOR_DP, - { - (UINT8) (sizeof (VENDOR_DEVICE_PATH)), - (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) - } - }, - USER_AUTHENTICATION_FORMSET_GUID - }, - { - END_DEVICE_PATH_TYPE, - END_ENTIRE_DEVICE_PATH_SUBTYPE, - { - (UINT8) (END_DEVICE_PATH_LENGTH), - (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8) - } - } -}; - -/** - Get a user input string. - - @param[in] PopUpString A popup string to inform user. - @param[in, out] UserInput The user input string - @param[in] UserInputMaxLen The max unicode count of the UserInput= without NULL terminator. -**/ -EFI_STATUS -GetUserInput ( - IN CHAR16 *PopUpString, - IN OUT CHAR16 *UserInput, - IN UINTN UserInputMaxLen - ) -{ - EFI_INPUT_KEY InputKey; - UINTN InputLength; - CHAR16 *Mask; - - UserInput[0] =3D 0; - Mask =3D AllocateZeroPool ((UserInputMaxLen + 1) * sizeof(CHAR16)); - if (Mask =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - InputLength =3D 0; - - while (TRUE) { - if (InputLength < UserInputMaxLen) { - Mask[InputLength] =3D L'_'; - } - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &InputKey, - PopUpString, - L"--------------------------------", - Mask, - NULL - ); - if (InputKey.ScanCode =3D=3D SCAN_NULL) { - // - // Check whether finish inputing password. - // - if (InputKey.UnicodeChar =3D=3D CHAR_CARRIAGE_RETURN && InputLength = > 0) { - // - // Add the null terminator. - // - UserInput[InputLength] =3D 0; - break; - } else if ((InputKey.UnicodeChar =3D=3D CHAR_NULL) || - (InputKey.UnicodeChar =3D=3D CHAR_LINEFEED) || - (InputKey.UnicodeChar =3D=3D CHAR_CARRIAGE_RETURN) - ) { - continue; - } else { - // - // delete last key entered - // - if (InputKey.UnicodeChar =3D=3D CHAR_BACKSPACE) { - if (InputLength > 0) { - UserInput[InputLength] =3D 0; - Mask[InputLength] =3D 0; - InputLength--; - } - } else { - if (InputLength =3D=3D UserInputMaxLen) { - Mask[InputLength] =3D 0; - continue; - } - // - // add Next key entry - // - UserInput[InputLength] =3D InputKey.UnicodeChar; - Mask[InputLength] =3D L'*'; - InputLength++; - } - } - } - } - FreePool (Mask); - return EFI_SUCCESS; -} - -/** - Display a message box to end user. - - @param[in] DisplayString The string in message box. -**/ -VOID -MessageBox ( - IN CHAR16 *DisplayString - ) -{ - EFI_INPUT_KEY Key; - - do { - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &Key, - L"", - DisplayString, - L"Press ENTER to continue ...", - L"", - NULL - ); - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); -} - -/** - Force system reset. -**/ -VOID -ForceSystemReset ( - VOID - ) -{ - MessageBox (L"Password retry count reach, reset system!"); - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); - CpuDeadLoop(); -} - -/** - Display message for set password. - - @param[in] ReturnStatus The return status for set password. -**/ -VOID -PrintSetPasswordStatus ( - IN EFI_STATUS ReturnStatus - ) -{ - CHAR16 *DisplayString; - CHAR16 *DisplayString2; - - EFI_INPUT_KEY Key; - - if (ReturnStatus =3D=3D EFI_UNSUPPORTED) { - DisplayString =3D L"New password is not strong enough!"; - DisplayString2 =3D L"Password must at least 8 chars and include lowerc= ase, uppercase alphabetic, number and symbol"; - - do { - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &Key, - L"", - DisplayString, - DisplayString2, - L"Press ENTER to continue ...", - L"", - NULL - ); - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); - } else { - if (ReturnStatus =3D=3D EFI_SUCCESS) { - DisplayString =3D L"New password is updated successfully!"; - } else if (ReturnStatus =3D=3D EFI_ALREADY_STARTED) { - DisplayString =3D L"New password is found in the history passwords!"; - } else { - DisplayString =3D L"New password update fails!"; - } - - do { - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &Key, - L"", - DisplayString, - L"Press ENTER to continue ...", - L"", - NULL - ); - } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); - } -} - -/** - Require user input password. - - @retval TRUE User input correct password successfully. - @retval FALSE The password is not set. -**/ -BOOLEAN -RequireUserPassword ( - VOID - ) -{ - EFI_STATUS Status; - CHAR16 UserInputPw[PASSWORD_MAX_S= IZE]; - CHAR16 *PopUpString; - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY VerifyPolicy; - - Status =3D EFI_SUCCESS; - ZeroMem(UserInputPw, sizeof(UserInputPw)); - - if (!IsPasswordInstalled ()) { - return FALSE; - } - - Status =3D GetPasswordVerificationPolicy (&VerifyPolicy); - if (!EFI_ERROR (Status)) { - if (WasPasswordVerified() && (!VerifyPolicy.NeedReVerify)) { - DEBUG ((DEBUG_INFO, "Password was verified and Re-verify is not need= ed\n")); - return TRUE; - } - } - - PopUpString =3D L"Please input admin password"; - - while (TRUE) { - gST->ConOut->ClearScreen(gST->ConOut); - GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1); - - Status =3D VerifyPassword (UserInputPw, StrSize(UserInputPw)); - if (!EFI_ERROR(Status)) { - break; - } - if (Status =3D=3D EFI_ACCESS_DENIED) { - // - // Password retry count reach. - // - ForceSystemReset (); - } - MessageBox (L"Incorrect password!"); - } - - ZeroMem(UserInputPw, sizeof(UserInputPw)); - - gST->ConOut->ClearScreen(gST->ConOut); - - return TRUE; -} - -/** - Set user password. - -**/ -VOID -SetUserPassword ( - VOID - ) -{ - EFI_STATUS Status; - CHAR16 UserInputPw[PASSWORD_MAX_SIZE]; - CHAR16 TmpPassword[PASSWORD_MAX_SIZE]; - CHAR16 *PopUpString; - CHAR16 *PopUpString2; - - ZeroMem(UserInputPw, sizeof(UserInputPw)); - ZeroMem(TmpPassword, sizeof(TmpPassword)); - - PopUpString =3D L"Please set admin password"; - - while (TRUE) { - gST->ConOut->ClearScreen(gST->ConOut); - GetUserInput (PopUpString, UserInputPw, PASSWORD_MAX_SIZE - 1); - - PopUpString2 =3D L"Please confirm your new password"; - gST->ConOut->ClearScreen(gST->ConOut); - GetUserInput (PopUpString2, TmpPassword, PASSWORD_MAX_SIZE - 1); - if (StrCmp (TmpPassword, UserInputPw) !=3D 0) { - MessageBox (L"Password are not the same!"); - continue; - } - - Status =3D SetPassword (UserInputPw, StrSize(UserInputPw), NULL, 0); - PrintSetPasswordStatus (Status); - if (!EFI_ERROR(Status)) { - break; - } - } - - ZeroMem(UserInputPw, sizeof(UserInputPw)); - ZeroMem(TmpPassword, sizeof(TmpPassword)); - - gST->ConOut->ClearScreen(gST->ConOut); -} - -/** - Check password before entering into setup. - - @param CodeType Indicates the type of status code being reported. = Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below. - - @param Value Describes the current status of a hardware or soft= ware entity. - This included information about the class and subc= lass that is used to classify the entity - as well as an operation. For progress codes, the = operation is the current activity. - For error codes, it is the exception. For debug c= odes, it is not defined at this time. - Type EFI_STATUS_CODE_VALUE is defined in "Related = Definitions" below. - Specific values are discussed in the Intel? Platfo= rm Innovation Framework for EFI Status Code Specification. - - @param Instance The enumeration of a hardware or software entity w= ithin the system. - A system may contain multiple entities that match = a class/subclass pairing. - The instance differentiates between them. An inst= ance of 0 indicates that instance information is unavailable, - not meaningful, or not relevant. Valid instance n= umbers start with 1. - - - @param CallerId This optional parameter may be used to identify th= e caller. - This parameter allows the status code driver to ap= ply different rules to different callers. - Type EFI_GUID is defined in InstallProtocolInterfa= ce() in the UEFI 2.0 Specification. - - - @param Data This optional parameter may be used to pass additi= onal data - - @retval EFI_SUCCESS Status code is what we expected. - @retval EFI_UNSUPPORTED Status code not supported. - -**/ -EFI_STATUS -EFIAPI -CheckForPassword ( - IN EFI_STATUS_CODE_TYPE CodeType, - IN EFI_STATUS_CODE_VALUE Value, - IN UINT32 Instance, - IN EFI_GUID *CallerId, OPTIONAL - IN EFI_STATUS_CODE_DATA *Data OPTIONAL - ) -{ - BOOLEAN PasswordSet; - - if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) =3D=3D EFI_PROGRESS_CODE) && - (Value =3D=3D (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP))) { - // - // Check whether enter setup page. - // - PasswordSet =3D RequireUserPassword (); - if (PasswordSet) { - DEBUG ((DEBUG_INFO, "Welcome Admin!\n")); - } else { - DEBUG ((DEBUG_INFO, "Admin password is not set!\n")); - if (NeedEnrollPassword()) { - SetUserPassword (); - } - } - - return EFI_SUCCESS; - } else{ - return EFI_UNSUPPORTED; - } -} - -/** - This function allows a caller to extract the current configuration for o= ne - or more named elements from the target driver. - - @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. - @param Request A null-terminated Unicode string in - format. - @param Progress On return, points to a character in the R= equest - string. Points to the string's null termi= nator if - request was successful. Points to the mos= t recent - '&' before the first failing name/value p= air (or - the beginning of the string if the failur= e is in - the first name/value pair) if the request= was not - successful. - @param Results A null-terminated Unicode string in - format which has all valu= es filled - in for the names in the Request string. S= tring to - be allocated by the called function. - - @retval EFI_SUCCESS The Results is filled with the requested = values. - @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. - @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown nam= e. - @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this - driver. - -**/ -EFI_STATUS -EFIAPI -ExtractConfig ( - IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, - IN CONST EFI_STRING Request, - OUT EFI_STRING *Progress, - OUT EFI_STRING *Results - ) -{ - if (Progress =3D=3D NULL || Results =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } - *Progress =3D Request; - return EFI_NOT_FOUND; -} - - -/** - This function processes the results of changes in configuration. - - @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. - @param Configuration A null-terminated Unicode string in - format. - @param Progress A pointer to a string filled in with the = offset of - the most recent '&' before the first fail= ing - name/value pair (or the beginning of the = string if - the failure is in the first name/value pa= ir) or - the terminating NULL if all was successfu= l. - - @retval EFI_SUCCESS The Results is processed successfully. - @retval EFI_INVALID_PARAMETER Configuration is NULL. - @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this - driver. - -**/ -EFI_STATUS -EFIAPI -RouteConfig ( - IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, - IN CONST EFI_STRING Configuration, - OUT EFI_STRING *Progress - ) -{ - if (Configuration =3D=3D NULL || Progress =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } - - *Progress =3D Configuration; - - return EFI_NOT_FOUND; -} - -/** - HII update Admin Password status. - -**/ -VOID -HiiUpdateAdminPasswordStatus ( - VOID - ) -{ - if (IsPasswordInstalled ()) { - HiiSetString ( - mUserAuthenticationData->HiiHandle, - STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT), - L"Installed", - NULL - ); - } else { - HiiSetString ( - mUserAuthenticationData->HiiHandle, - STRING_TOKEN (STR_ADMIN_PASSWORD_STS_CONTENT), - L"Not Installed", - NULL - ); - } -} - -/** - This function processes the results of changes in configuration. - - @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. - @param Action Specifies the type of action taken by the= browser. - @param QuestionId A unique value which is sent to the origi= nal - exporting driver so that it can identify = the type - of data to expect. - @param Type The type of value for the question. - @param Value A pointer to the data being sent to the o= riginal - exporting driver. - @param ActionRequest On return, points to the action requested= by the - callback function. - - @retval EFI_SUCCESS The callback successfully handled the act= ion. - @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold t= he - variable and its data. - @retval EFI_DEVICE_ERROR The variable could not be saved. - @retval EFI_UNSUPPORTED The specified Action is not supported by = the - callback. - -**/ -EFI_STATUS -EFIAPI -UserAuthenticationCallback ( - IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, - IN EFI_BROWSER_ACTION Action, - IN EFI_QUESTION_ID QuestionId, - IN UINT8 Type, - IN EFI_IFR_TYPE_VALUE *Value, - OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest - ) -{ - EFI_STATUS Status; - CHAR16 *UserInputPassword; - - Status =3D EFI_SUCCESS; - - if (((Value =3D=3D NULL) && (Action !=3D EFI_BROWSER_ACTION_FORM_OPEN) &= & (Action !=3D EFI_BROWSER_ACTION_FORM_CLOSE)) || - (ActionRequest =3D=3D NULL)) { - return EFI_INVALID_PARAMETER; - } - - switch (Action) { - case EFI_BROWSER_ACTION_FORM_OPEN: - { - switch (QuestionId) { - case ADMIN_PASSWORD_KEY_ID: - HiiUpdateAdminPasswordStatus (); - default: - break; - } - } - break; - case EFI_BROWSER_ACTION_CHANGING: - { - switch (QuestionId) { - case ADMIN_PASSWORD_KEY_ID: - if ((Type =3D=3D EFI_IFR_TYPE_STRING) && (Value->string =3D=3D 0) = && - (mUserAuthenticationData->PasswordState =3D=3D BROWSER_STATE_S= ET_PASSWORD)) { - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_VALIDAT= E_PASSWORD; - ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthe= nticationData->OldPassword)); - return EFI_INVALID_PARAMETER; - } - // - // The Callback is responsible for validating old password input b= y user, - // If Callback return EFI_SUCCESS, it indicates validation pass. - // - switch (mUserAuthenticationData->PasswordState) { - case BROWSER_STATE_VALIDATE_PASSWORD: - UserInputPassword =3D HiiGetString (mUserAuthenticationData->Hii= Handle, Value->string, NULL); - if ((StrLen (UserInputPassword) >=3D PASSWORD_MAX_SIZE)) { - Status =3D EFI_NOT_READY; - break; - } - if (UserInputPassword[0] =3D=3D 0) { - // - // Setup will use a NULL password to check whether the old pas= sword is set, - // If the validation is successful, means there is no old pass= word, return - // success to set the new password. Or need to return EFI_NOT_= READY to - // let user input the old password. - // - Status =3D VerifyPassword (UserInputPassword, StrSize (UserInp= utPassword)); - if (Status =3D=3D EFI_SUCCESS) { - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_SET= _PASSWORD; - } else { - Status =3D EFI_NOT_READY; - } - break; - } - Status =3D VerifyPassword (UserInputPassword, StrSize (UserInput= Password)); - if (Status =3D=3D EFI_SUCCESS) { - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_SET_P= ASSWORD; - StrCpyS ( - mUserAuthenticationData->OldPassword, - sizeof(mUserAuthenticationData->OldPassword)/sizeof(CHAR16), - UserInputPassword - ); - } else { - // - // Old password mismatch, return EFI_NOT_READY to prompt for e= rror message. - // - if (Status =3D=3D EFI_ACCESS_DENIED) { - // - // Password retry count reach. - // - ForceSystemReset (); - } - Status =3D EFI_NOT_READY; - } - break; - - case BROWSER_STATE_SET_PASSWORD: - UserInputPassword =3D HiiGetString (mUserAuthenticationData->Hii= Handle, Value->string, NULL); - if ((StrLen (UserInputPassword) >=3D PASSWORD_MAX_SIZE)) { - Status =3D EFI_NOT_READY; - break; - } - Status =3D SetPassword (UserInputPassword, StrSize (UserInputPas= sword), mUserAuthenticationData->OldPassword, StrSize(mUserAuthenticationDa= ta->OldPassword)); - PrintSetPasswordStatus (Status); - ZeroMem (mUserAuthenticationData->OldPassword, sizeof(mUserAuthe= nticationData->OldPassword)); - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_VALIDAT= E_PASSWORD; - HiiUpdateAdminPasswordStatus (); - break; - - default: - break; - } - default: - break; - } - } - break; - default: - break; - } - return Status; -} - -/** - Unregister status code callback functions. - - @param Event Event whose notification function is being invoked. - @param Context Pointer to the notification function's context, wh= ich is - always zero in current implementation. - -**/ -VOID -EFIAPI -UnregisterBootTimeHandlers ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - mRscHandlerProtocol->Unregister (CheckForPassword); -} - -/** - User Authentication entry point. - - @param ImageHandle The image handle. - @param SystemTable The system table. - - @retval EFI_SUCCESS The entry point is executed successfully. - @return other Contain some other errors. - -**/ -EFI_STATUS -EFIAPI -UserAuthenticationEntry ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - EFI_HANDLE DriverHandle; - EFI_HII_HANDLE HiiHandle; - - DriverHandle =3D NULL; - - mUserAuthenticationData =3D AllocateZeroPool (sizeof (USER_AUTHENTICATIO= N_PRIVATE_DATA)); - if (mUserAuthenticationData =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - mUserAuthenticationData->ConfigAccess.ExtractConfig =3D ExtractConfig; - mUserAuthenticationData->ConfigAccess.RouteConfig =3D RouteConfig; - mUserAuthenticationData->ConfigAccess.Callback =3D UserAuthenticationCal= lback; - mUserAuthenticationData->PasswordState =3D BROWSER_STATE_VALIDATE_PASSWO= RD; - - // - // Install Config Access protocol to driver handle. - // - Status =3D gBS->InstallMultipleProtocolInterfaces ( - &DriverHandle, - &gEfiDevicePathProtocolGuid, - &mHiiVendorDevicePath, - &gEfiHiiConfigAccessProtocolGuid, - &mUserAuthenticationData->ConfigAccess, - NULL - ); - ASSERT_EFI_ERROR (Status); - mUserAuthenticationData->DriverHandle =3D DriverHandle; - - // - // Add HII data to database. - // - HiiHandle =3D HiiAddPackages ( - &mUserAuthenticationVendorGuid, - DriverHandle, - UserAuthenticationDxeStrings, - UserAuthenticationDxeVfrBin, - NULL - ); - if (HiiHandle =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - mUserAuthenticationData->HiiHandle =3D HiiHandle; - - // - // Locate report status code protocol. - // - Status =3D gBS->LocateProtocol ( - &gEfiRscHandlerProtocolGuid, - NULL, - (VOID **) &mRscHandlerProtocol - ); - ASSERT_EFI_ERROR (Status); - - // - //Register the callback function for ReportStatusCode() notification. - // - mRscHandlerProtocol->Register (CheckForPassword, TPL_HIGH_LEVEL); - - // - // Unregister boot time report status code listener at ExitBootService E= vent. - // - Status =3D gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - UnregisterBootTimeHandlers, - NULL, - &gEfiEventExitBootServicesGuid, - &mExitBootServicesEvent - ); - ASSERT_EFI_ERROR (Status); - - // - // Locates SMM Communication protocol. - // - Status =3D gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL,= (VOID **) &mSmmCommunication); - ASSERT_EFI_ERROR (Status); - - return EFI_SUCCESS; -} - -/** - Unloads the application and its installed protocol. - - @param[in] ImageHandle Handle that identifies the image to be unl= oaded. - - @retval EFI_SUCCESS The image has been unloaded. -**/ -EFI_STATUS -EFIAPI -UserAuthenticationUnload ( - IN EFI_HANDLE ImageHandle - ) -{ - ASSERT (mUserAuthenticationData !=3D NULL); - - // - // Uninstall Config Access Protocol. - // - if (mUserAuthenticationData->DriverHandle !=3D NULL) { - gBS->UninstallMultipleProtocolInterfaces ( - mUserAuthenticationData->DriverHandle, - &gEfiDevicePathProtocolGuid, - &mHiiVendorDevicePath, - &gEfiHiiConfigAccessProtocolGuid, - &mUserAuthenticationData->ConfigAccess, - NULL - ); - mUserAuthenticationData->DriverHandle =3D NULL; - } - - // - // Remove Hii Data. - // - if (mUserAuthenticationData->HiiHandle !=3D NULL) { - HiiRemovePackages (mUserAuthenticationData->HiiHandle); - } - - FreePool (mUserAuthenticationData); - mUserAuthenticationData =3D NULL; - - return EFI_SUCCESS; -} - diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/User= AuthenticationDxe.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationDxe.h deleted file mode 100644 index e183424f35..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthent= icationDxe.h +++ /dev/null @@ -1,138 +0,0 @@ -/** @file - Header file for UserAuthenticationDxe. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef _USER_AUTHENTICATION_DXE_H_ -#define _USER_AUTHENTICATION_DXE_H_ - - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "UserAuthenticationDxeFormset.h" - -extern UINT8 UserAuthenticationDxeVfrBin[]; -extern UINT8 UserAuthenticationDxeStrings[]; -extern EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication; - -typedef struct { - EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; - EFI_HANDLE DriverHandle; - EFI_HII_HANDLE HiiHandle; - UINT8 PasswordState; - CHAR16 OldPassword[PASSWORD_MAX_SIZE]; -} USER_AUTHENTICATION_PRIVATE_DATA; - -#pragma pack(1) -/// -/// HII specific Vendor Device Path definition. -/// -typedef struct { - VENDOR_DEVICE_PATH VendorDevicePath; - EFI_DEVICE_PATH_PROTOCOL End; -} HII_VENDOR_DEVICE_PATH; -#pragma pack() - -/** - Validate if the password is correct. - - @param[in] Password The user input password. - @param[in] PasswordSize The size of Password in byte. - - @retval EFI_SUCCESS The password is correct. - @retval EFI_SECURITY_VIOLATION The password is incorrect. - @retval EFI_INVALID_PARAMETER The password or size is invalid. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the p= assword. - @retval EFI_ACCESS_DENIED Password retry count reach. -**/ -EFI_STATUS -VerifyPassword ( - IN CHAR16 *Password, - IN UINTN PasswordSize - ); - -/** - Set a new password. - - @param[in] NewPassword The user input new password. - NULL means clear password. - @param[in] NewPasswordSize The size of NewPassword in byte. - @param[in] OldPassword The user input old password. - NULL means no old password. - @param[in] OldPasswordSize The size of OldPassword in byte. - - @retval EFI_SUCCESS The NewPassword is set successfully. - @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect. - @retval EFI_INVALID_PARAMETER The password or size is invalid. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the pass= word. - @retval EFI_ACCESS_DENIED Password retry count reach. - @retval EFI_UNSUPPORTED NewPassword is not strong enough. - @retval EFI_ALREADY_STARTED NewPassword is in history. -**/ -EFI_STATUS -SetPassword ( - IN CHAR16 *NewPassword, OPTIONAL - IN UINTN NewPasswordSize, - IN CHAR16 *OldPassword, OPTIONAL - IN UINTN OldPasswordSize - ); - -/** - Return if the password is set. - - @retval TRUE The password is set. - @retval FALSE The password is not set. -**/ -BOOLEAN -IsPasswordInstalled ( - VOID - ); - -/** - Get password verification policy. - - @param[out] VerifyPolicy Verification policy. - - @retval EFI_SUCCESS Get verification policy successfully. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verifica= tion policy. -**/ -EFI_STATUS -GetPasswordVerificationPolicy ( - OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy - ); - -/** - Return if the password was verified. - - @retval TRUE The password was verified. - @retval FALSE The password was not verified. -**/ -BOOLEAN -WasPasswordVerified ( - VOID - ); - -#endif diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/User= AuthenticationDxe.inf b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthenti= cation/UserAuthenticationDxe.inf deleted file mode 100644 index 61f5f27e63..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthent= icationDxe.inf +++ /dev/null @@ -1,63 +0,0 @@ -## @file -# User Authentication Dxe Driver. -# -# This Driver mainly provides Setup Form to change password and -# does user authentication before entering Setup. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D UserAuthenticationDxe - FILE_GUID =3D 0683FB88-664C-4BA6-9ED4-1C0916EE43A4 - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 2.0 - ENTRY_POINT =3D UserAuthenticationEntry - UNLOAD_IMAGE =3D UserAuthenticationUnload - - -[Sources] - UserAuthenticationDxe.c - UserAuthenticationDxe.h - UserAuthenticationDxePassword.c - UserAuthenticationDxeFormset.h - UserAuthenticationDxeVfr.vfr - UserAuthenticationDxeStrings.uni - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec - -[LibraryClasses] - BaseLib - UefiBootServicesTableLib - UefiDriverEntryPoint - UefiRuntimeServicesTableLib - BaseMemoryLib - DebugLib - UefiLib - HiiLib - DevicePathLib - MemoryAllocationLib - PlatformPasswordLib - PrintLib - -[Guids] - gUserAuthenticationGuid ## CONSUMES ## GUID - gEfiEventExitBootServicesGuid ## CONSUMES ## Event - gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## SystemTable - -[Protocols] - gEfiRscHandlerProtocolGuid ## CONSUMES - gEfiDevicePathProtocolGuid ## PRODUCES - gEfiHiiConfigAccessProtocolGuid ## PRODUCES - gEfiSmmCommunicationProtocolGuid ## CONSUMES - -[Depex] - gEfiSimpleTextOutProtocolGuid AND - gEfiSmmCommunicationProtocolGuid AND - gEfiVariableArchProtocolGuid AND - gEfiVariableWriteArchProtocolGuid diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/User= AuthenticationDxeFormset.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAut= hentication/UserAuthenticationDxeFormset.h deleted file mode 100644 index 581849b534..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthent= icationDxeFormset.h +++ /dev/null @@ -1,23 +0,0 @@ -/** @file - Header file for UserAuthentication formset. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef _USER_AUTHENTICATION_DXE_FORMSET_H_ -#define _USER_AUTHENTICATION_DXE_FORMSET_H_ - -// -// Vendor GUID of the formset -// -#define USER_AUTHENTICATION_FORMSET_GUID \ - { 0x760e3022, 0xf149, 0x4560, {0x9c, 0x6f, 0x33, 0xaa, 0x7d, 0x48, 0x75,= 0xfa} } - -#define ADMIN_PASSWORD_KEY_ID 0x2001 - -#define MAX_PASSWORD_LEN 32 -#define MIN_PASSWORD_LEN 0 - -#endif diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/User= AuthenticationDxePassword.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAu= thentication/UserAuthenticationDxePassword.c deleted file mode 100644 index 6e1fedfab7..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthent= icationDxePassword.c +++ /dev/null @@ -1,319 +0,0 @@ -/** @file - UserAuthentication DXE password wrapper. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "UserAuthenticationDxe.h" - -/** - Initialize the communicate buffer using DataSize and Function. - - @param[out] DataPtr Points to the data in the communicate = buffer. - @param[in] DataSize The data size to send to SMM. - @param[in] Function The function number to initialize the = communicate header. - - @return Communicate buffer. -**/ -VOID* -InitCommunicateBuffer ( - OUT VOID **DataPtr OPTIONAL, - IN UINTN DataSize, - IN UINTN Function - ) -{ - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; - SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader; - VOID *Buffer; - EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable; - EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion; - UINTN Index; - UINTN Size; - EFI_STATUS Status; - - Buffer =3D NULL; - Status =3D EfiGetSystemConfigurationTable ( - &gEdkiiPiSmmCommunicationRegionTableGuid, - (VOID **) &SmmCommRegionTable - ); - if (EFI_ERROR (Status)) { - return NULL; - } - ASSERT (SmmCommRegionTable !=3D NULL); - SmmCommMemRegion =3D (EFI_MEMORY_DESCRIPTOR *) (SmmCommRegionTable + 1); - Size =3D 0; - for (Index =3D 0; Index < SmmCommRegionTable->NumberOfEntries; Index++) { - if (SmmCommMemRegion->Type =3D=3D EfiConventionalMemory) { - Size =3D EFI_PAGES_TO_SIZE ((UINTN) SmmCommMemRegion->NumberOfPages); - if (Size >=3D (DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Dat= a) + sizeof (SMM_PASSWORD_COMMUNICATE_HEADER))) { - break; - } - } - SmmCommMemRegion =3D (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) SmmCommMemRe= gion + SmmCommRegionTable->DescriptorSize); - } - ASSERT (Index < SmmCommRegionTable->NumberOfEntries); - - Buffer =3D (VOID*)(UINTN)SmmCommMemRegion->PhysicalStart; - ASSERT (Buffer !=3D NULL); - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) Buffer; - CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gUserAuthenticationGuid); - SmmCommunicateHeader->MessageLength =3D DataSize + sizeof (SMM_PASSWORD_= COMMUNICATE_HEADER); - - SmmPasswordFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *) SmmCom= municateHeader->Data; - ZeroMem (SmmPasswordFunctionHeader, DataSize + sizeof (SMM_PASSWORD_COMM= UNICATE_HEADER)); - SmmPasswordFunctionHeader->Function =3D Function; - if (DataPtr !=3D NULL) { - *DataPtr =3D SmmPasswordFunctionHeader + 1; - } - - return Buffer; -} - -/** - Send the data in communicate buffer to SMM. - - @param[in] Buffer Points to the data in the communicat= e buffer. - @param[in] DataSize The data size to send to SMM. - - @retval EFI_SUCCESS Success is returned from the functio= n in SMM. - @retval Others Failure is returned from the functio= n in SMM. - -**/ -EFI_STATUS -SendCommunicateBuffer ( - IN VOID *Buffer, - IN UINTN DataSize - ) -{ - EFI_STATUS Status; - UINTN CommSize; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; - SMM_PASSWORD_COMMUNICATE_HEADER *SmmPasswordFunctionHeader; - - CommSize =3D DataSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + s= izeof (SMM_PASSWORD_COMMUNICATE_HEADER); - - Status =3D mSmmCommunication->Communicate (mSmmCommunication, Buffer, &C= ommSize); - ASSERT_EFI_ERROR (Status); - - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) Buffer; - SmmPasswordFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *)SmmComm= unicateHeader->Data; - return SmmPasswordFunctionHeader->ReturnStatus; -} - -/** - Validate if the password is correct. - - @param[in] Password The user input password. - @param[in] PasswordSize The size of Password in byte. - - @retval EFI_SUCCESS The password is correct. - @retval EFI_SECURITY_VIOLATION The password is incorrect. - @retval EFI_INVALID_PARAMETER The password or size is invalid. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to verify the p= assword. - @retval EFI_ACCESS_DENIED Password retry count reach. -**/ -EFI_STATUS -VerifyPassword ( - IN CHAR16 *Password, - IN UINTN PasswordSize - ) -{ - EFI_STATUS Status; - VOID *Buffer; - SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD *VerifyPassword; - - ASSERT (Password !=3D NULL); - - if (PasswordSize > sizeof(VerifyPassword->Password) * sizeof(CHAR16)) { - return EFI_INVALID_PARAMETER; - } - - Buffer =3D InitCommunicateBuffer ( - (VOID**)&VerifyPassword, - sizeof(*VerifyPassword), - SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD - ); - if (Buffer =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Status =3D UnicodeStrToAsciiStrS (Password, VerifyPassword->Password, si= zeof(VerifyPassword->Password)); - if (EFI_ERROR(Status)) { - goto EXIT; - } - - Status =3D SendCommunicateBuffer (Buffer, sizeof(*VerifyPassword)); - -EXIT: - ZeroMem (VerifyPassword, sizeof(*VerifyPassword)); - return Status; -} - -/** - Set a new password. - - @param[in] NewPassword The user input new password. - NULL means clear password. - @param[in] NewPasswordSize The size of NewPassword in byte. - @param[in] OldPassword The user input old password. - NULL means no old password. - @param[in] OldPasswordSize The size of OldPassword in byte. - - @retval EFI_SUCCESS The NewPassword is set successfully. - @retval EFI_SECURITY_VIOLATION The OldPassword is incorrect. - @retval EFI_INVALID_PARAMETER The password or size is invalid. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to set the pass= word. - @retval EFI_ACCESS_DENIED Password retry count reach. - @retval EFI_UNSUPPORTED NewPassword is not strong enough. - @retval EFI_ALREADY_STARTED NewPassword is in history. -**/ -EFI_STATUS -SetPassword ( - IN CHAR16 *NewPassword, OPTIONAL - IN UINTN NewPasswordSize, - IN CHAR16 *OldPassword, OPTIONAL - IN UINTN OldPasswordSize - ) -{ - EFI_STATUS Status; - VOID *Buffer; - SMM_PASSWORD_COMMUNICATE_SET_PASSWORD *SetPassword; - - if (NewPasswordSize > sizeof(SetPassword->NewPassword) * sizeof(CHAR16))= { - return EFI_INVALID_PARAMETER; - } - if (OldPasswordSize > sizeof(SetPassword->OldPassword) * sizeof(CHAR16))= { - return EFI_INVALID_PARAMETER; - } - - Buffer =3D InitCommunicateBuffer ( - (VOID**)&SetPassword, - sizeof(*SetPassword), - SMM_PASSWORD_FUNCTION_SET_PASSWORD - ); - if (Buffer =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - if (NewPassword !=3D NULL) { - Status =3D UnicodeStrToAsciiStrS (NewPassword, SetPassword->NewPasswor= d, sizeof(SetPassword->NewPassword)); - if (EFI_ERROR(Status)) { - goto EXIT; - } - } else { - SetPassword->NewPassword[0] =3D 0; - } - - if (OldPassword !=3D NULL) { - Status =3D UnicodeStrToAsciiStrS (OldPassword, SetPassword->OldPasswor= d, sizeof(SetPassword->OldPassword)); - if (EFI_ERROR(Status)) { - goto EXIT; - } - } else { - SetPassword->OldPassword[0] =3D 0; - } - - Status =3D SendCommunicateBuffer (Buffer, sizeof(*SetPassword)); - -EXIT: - ZeroMem (SetPassword, sizeof(*SetPassword)); - return Status; -} - -/** - Return if the password is set. - - @retval TRUE The password is set. - @retval FALSE The password is not set. -**/ -BOOLEAN -IsPasswordInstalled ( - VOID - ) -{ - EFI_STATUS Status; - VOID *Buffer; - - Buffer =3D InitCommunicateBuffer ( - NULL, - 0, - SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET - ); - if (Buffer =3D=3D NULL) { - return FALSE; - } - - Status =3D SendCommunicateBuffer (Buffer, 0); - if (EFI_ERROR (Status)) { - return FALSE; - } - - return TRUE; -} - -/** - Get password verification policy. - - @param[out] VerifyPolicy Verification policy. - - @retval EFI_SUCCESS Get verification policy successfully. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to get verifica= tion policy. -**/ -EFI_STATUS -GetPasswordVerificationPolicy ( - OUT SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *VerifyPolicy - ) -{ - EFI_STATUS Status; - VOID *Buffer; - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *GetVerifyPolicy; - - Buffer =3D InitCommunicateBuffer ( - (VOID**)&GetVerifyPolicy, - sizeof(*GetVerifyPolicy), - SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY - ); - if (Buffer =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Status =3D SendCommunicateBuffer (Buffer, sizeof(*GetVerifyPolicy)); - if (!EFI_ERROR (Status)) { - CopyMem (VerifyPolicy, GetVerifyPolicy, sizeof (SMM_PASSWORD_COMMUNICA= TE_VERIFY_POLICY)); - } - - return Status; -} - -/** - Return if the password was verified. - - @retval TRUE The password was verified. - @retval FALSE The password was not verified. -**/ -BOOLEAN -WasPasswordVerified ( - VOID - ) -{ - EFI_STATUS Status; - VOID *Buffer; - - Buffer =3D InitCommunicateBuffer ( - NULL, - 0, - SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED - ); - if (Buffer =3D=3D NULL) { - return FALSE; - } - - Status =3D SendCommunicateBuffer (Buffer, 0); - if (EFI_ERROR (Status)) { - return FALSE; - } - - return TRUE; -} diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/User= AuthenticationDxeStrings.uni b/Platform/Intel/UserInterfaceFeaturePkg/UserA= uthentication/UserAuthenticationDxeStrings.uni deleted file mode 100644 index 1e3a179677..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthent= icationDxeStrings.uni +++ /dev/null @@ -1,30 +0,0 @@ -/** @file -// String definitions for User Authentication formset. -// -// Copyright (c) 2019, Intel Corporation. All rights reserved.
-// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -**/ - -#langdef en-US "English" -#langdef fr-FR "Francais" - - -#string STR_FORM_SET_TITLE #language en-US "User Password Mana= gement" - #language fr-FR "User Password Mana= gement" -#string STR_FORM_SET_TITLE_HELP #language en-US "This Driver mainly= handle user's password" - #language fr-FR "This Driver mainly= handle user's password" -#string STR_FORM_TITLE #language en-US "Password Managemen= t Form" - #language fr-FR "Password Managemen= t Form" -#string STR_ADMIN_PASSWORD_PROMPT #language en-US "Change Admin Passw= ord" - #language fr-FR "Change Admin Passw= ord" -#string STR_ADMIN_PASSWORD_HELP #language en-US "Input old admin pa= ssword if it was set, then you can change the password to a new one. After = the change action, you may need input the new password when you enter UI. T= he new password must be between 8 and 32 chars include lowercase, uppercase= alphabetic, number, and symbol. Input an empty password can clean old admi= n password, then no need input password to enter UI." - #language fr-FR "Input old admin pa= ssword if it was set, then you can change the password to a new one. After = the change action, you may need input the new password when you enter UI. T= he new password must be between 8 and 32 chars include lowercase, uppercase= alphabetic, number, and symbol. Input an empty password can clean old admi= n password, then no need input password to enter UI." -#string STR_ADMIN_PASSWORD_STS_HELP #language en-US "Current Admin Pass= word status: Installed or Not Installed." - #language fr-FR "Current Admin Pass= word status: Installed or Not Installed." -#string STR_ADMIN_PASSWORD_STS_PROMPT #language en-US "Admin Password Sta= tus" - #language fr-FR "Admin Password Sta= tus" -#string STR_ADMIN_PASSWORD_STS_CONTENT #language en-US "" - #language fr-FR "" - diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/User= AuthenticationDxeVfr.vfr b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthe= ntication/UserAuthenticationDxeVfr.vfr deleted file mode 100644 index ca1d5ddec1..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthent= icationDxeVfr.vfr +++ /dev/null @@ -1,39 +0,0 @@ -///** @file -// UserAuthentication formset. -// -// Copyright (c) 2019, Intel Corporation. All rights reserved.
-// SPDX-License-Identifier: BSD-2-Clause-Patent -// -//**/ - -#include -#include "UserAuthenticationDxeFormset.h" - -formset - guid =3D USER_AUTHENTICATION_FORMSET_GUID, - title =3D STRING_TOKEN(STR_FORM_SET_TITLE), - help =3D STRING_TOKEN(STR_FORM_SET_TITLE_HELP), - classguid =3D EFI_HII_PLATFORM_SETUP_FORMSET_GUID, - - form formid =3D 1, - title =3D STRING_TOKEN(STR_FORM_TITLE); - - grayoutif TRUE; - text - help =3D STRING_TOKEN(STR_ADMIN_PASSWORD_STS_HELP), - text =3D STRING_TOKEN(STR_ADMIN_PASSWORD_STS_PROMPT), - text =3D STRING_TOKEN(STR_ADMIN_PASSWORD_STS_CONTENT); - endif; - - password - prompt =3D STRING_TOKEN(STR_ADMIN_PASSWORD_PROMPT), - help =3D STRING_TOKEN(STR_ADMIN_PASSWORD_HELP), - flags =3D INTERACTIVE, - key =3D ADMIN_PASSWORD_KEY_ID, - minsize =3D MIN_PASSWORD_LEN, - maxsize =3D MAX_PASSWORD_LEN, - endpassword; - - endform; - -endformset; diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/User= AuthenticationSmm.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationSmm.c deleted file mode 100644 index 07e834ebfa..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthent= icationSmm.c +++ /dev/null @@ -1,674 +0,0 @@ -/** @file - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "UserAuthenticationSmm.h" - -EFI_SMM_VARIABLE_PROTOCOL *mSmmVariable; - -UINTN mAdminPasswordTryCount =3D 0; - -BOOLEAN mNeedReVerify =3D TRUE; -BOOLEAN mPasswordVerified =3D FALSE; - -/** - Verify if the password is correct. - - @param[in] Password The user input password. - @param[in] PasswordSize The size of Password in byte. - @param[in] UserPasswordVarStruct The storage of password in variable. - - @retval EFI_SUCCESS The password is correct. - @retval EFI_SECURITY_VIOLATION The password is incorrect. -**/ -EFI_STATUS -VerifyPassword ( - IN CHAR8 *Password, - IN UINTN PasswordSize, - IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct - ) -{ - BOOLEAN HashOk; - UINT8 HashData[PASSWORD_HASH_SIZE]; - - HashOk =3D KeyLibGeneratePBKDF2Hash ( - HASH_TYPE_SHA256, - (UINT8 *)Password, - PasswordSize, - UserPasswordVarStruct->PasswordSalt, - sizeof(UserPasswordVarStruct->PasswordSalt), - HashData, - sizeof(HashData) - ); - if (!HashOk) { - return EFI_DEVICE_ERROR; - } - if (KeyLibSlowCompareMem (UserPasswordVarStruct->PasswordHash, HashData,= PASSWORD_HASH_SIZE) =3D=3D 0) { - return EFI_SUCCESS; - } else { - return EFI_SECURITY_VIOLATION; - } -} - -/** - Get hash data of password from non-volatile variable region. - - @param[in] UserGuid The user GUID of the password variab= le. - @param[in] Index The index of the password. - 0 means current password. - Non-0 means the password history. - @param[out] UserPasswordVarStruct The storage of password in variable. - - @retval EFI_SUCCESS The password hash is returned successful= ly. - @retval EFI_NOT_FOUND The password hash is not found. -**/ -EFI_STATUS -GetPasswordHashFromVariable ( - IN EFI_GUID *UserGuid, - IN UINTN Index, - OUT USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct - ) -{ - UINTN DataSize; - CHAR16 PasswordName[sizeof(USER_AUTHENTICATIO= N_VAR_NAME)/sizeof(CHAR16) + 5]; - - if (Index !=3D 0) { - UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s%04x", USER_AU= THENTICATION_VAR_NAME, Index); - } else { - UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s", USER_AUTHEN= TICATION_VAR_NAME); - } - - DataSize =3D sizeof(*UserPasswordVarStruct); - return mSmmVariable->SmmGetVariable ( - PasswordName, - UserGuid, - NULL, - &DataSize, - UserPasswordVarStruct - ); -} - -/** - Save password hash data to non-volatile variable region. - - @param[in] UserGuid The user GUID of the password variab= le. - @param[in] UserPasswordVarStruct The storage of password in variable. - - @retval EFI_SUCCESS The password hash is saved successfully. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the passw= ord hash. -**/ -EFI_STATUS -SavePasswordHashToVariable ( - IN EFI_GUID *UserGuid, - IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct - ) -{ - EFI_STATUS Status; - - if (UserPasswordVarStruct =3D=3D NULL) { - Status =3D mSmmVariable->SmmSetVariable ( - USER_AUTHENTICATION_VAR_NAME, - UserGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABL= E_NON_VOLATILE, - 0, - NULL - ); - } else { - Status =3D mSmmVariable->SmmSetVariable ( - USER_AUTHENTICATION_VAR_NAME, - UserGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABL= E_NON_VOLATILE, - sizeof(*UserPasswordVarStruct), - UserPasswordVarStruct - ); - } - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "SavePasswordHashToVariable fails with %r\n", Sta= tus)); - } - - return Status; -} - -/** - Save old password hash data to non-volatile variable region as history. - - The number of password history variable is limited. - If all the password history variables are used, the new password history - will override the oldest one. - - @param[in] UserGuid The user GUID of the password variab= le. - @param[in] UserPasswordVarStruct The storage of password in variable. - - @retval EFI_SUCCESS The password hash is saved successfully. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the passw= ord hash. -**/ -EFI_STATUS -SaveOldPasswordToHistory ( - IN EFI_GUID *UserGuid, - IN USER_PASSWORD_VAR_STRUCT *UserPasswordVarStruct - ) -{ - EFI_STATUS Status; - UINTN DataSize; - UINT32 LastIndex; - CHAR16 PasswordName[sizeof(USER_AUTHENTICATIO= N_VAR_NAME)/sizeof(CHAR16) + 5]; - - DEBUG ((DEBUG_INFO, "SaveOldPasswordToHistory\n")); - - DataSize =3D sizeof(LastIndex); - Status =3D mSmmVariable->SmmGetVariable ( - USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME, - UserGuid, - NULL, - &DataSize, - &LastIndex - ); - if (EFI_ERROR(Status)) { - LastIndex =3D 0; - } - if (LastIndex >=3D PASSWORD_HISTORY_CHECK_COUNT) { - LastIndex =3D 0; - } - - LastIndex ++; - UnicodeSPrint (PasswordName, sizeof (PasswordName), L"%s%04x", USER_AUTH= ENTICATION_VAR_NAME, LastIndex); - - - Status =3D mSmmVariable->SmmSetVariable ( - PasswordName, - UserGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_= NON_VOLATILE, - sizeof(*UserPasswordVarStruct), - UserPasswordVarStruct - ); - DEBUG ((DEBUG_INFO, " -- to %s, %r\n", PasswordName, Status)); - if (!EFI_ERROR(Status)) { - Status =3D mSmmVariable->SmmSetVariable ( - USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME, - UserGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABL= E_NON_VOLATILE, - sizeof(LastIndex), - &LastIndex - ); - DEBUG ((DEBUG_INFO, " LastIndex - 0x%04x, %r\n", LastIndex, Status)); - } - - return Status; -} - -/** - Calculate password hash data and save it to non-volatile variable region. - - @param[in] UserGuid The user GUID of the password variabl= e. - @param[in] Password The user input password. - NULL means delete the password variab= le. - @param[in] PasswordSize The size of Password in byte. - - @retval EFI_SUCCESS The password hash is calculated and save= d. - @retval EFI_OUT_OF_RESOURCES Insufficient resources to save the passw= ord hash. -**/ -EFI_STATUS -SavePasswordToVariable ( - IN EFI_GUID *UserGuid, - IN CHAR8 *Password, OPTIONAL - IN UINTN PasswordSize - ) -{ - EFI_STATUS Status; - USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct; - BOOLEAN HashOk; - - // - // If password is NULL, it means we want to clean password field saved i= n variable region. - // - if (Password !=3D NULL) { - KeyLibGenerateSalt (UserPasswordVarStruct.PasswordSalt, sizeof(UserPas= swordVarStruct.PasswordSalt)); - HashOk =3D KeyLibGeneratePBKDF2Hash ( - HASH_TYPE_SHA256, - (UINT8 *)Password, - PasswordSize, - UserPasswordVarStruct.PasswordSalt, - sizeof(UserPasswordVarStruct.PasswordSalt), - UserPasswordVarStruct.PasswordHash, - sizeof(UserPasswordVarStruct.PasswordHash) - ); - if (!HashOk) { - return EFI_DEVICE_ERROR; - } - Status =3D SavePasswordHashToVariable (UserGuid, &UserPasswordVarStruc= t); - // - // Save Password data to history variable - // - if (!EFI_ERROR(Status)) { - SaveOldPasswordToHistory (UserGuid, &UserPasswordVarStruct); - } - } else { - Status =3D SavePasswordHashToVariable (UserGuid, NULL); - } - - return Status; -} - -/** - Verify the password. - If the password variable does not exist, it passes the verification. - If the password variable exists, it does verification based upon passwor= d variable. - - @param[in] UserGuid The user GUID of the password variabl= e. - @param[in] Password The user input password. - @param[in] PasswordSize The size of Password in byte. - - @retval TRUE The verification passes. - @retval FALSE The verification fails. -**/ -BOOLEAN -IsPasswordVerified ( - IN EFI_GUID *UserGuid, - IN CHAR8 *Password, - IN UINTN PasswordSize - ) -{ - USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct; - EFI_STATUS Status; - UINTN *PasswordTryCount; - - PasswordTryCount =3D &mAdminPasswordTryCount; - - Status =3D GetPasswordHashFromVariable (UserGuid, 0, &UserPasswordVarStr= uct); - if (EFI_ERROR(Status)) { - return TRUE; - } - - // - // Old password exists - // - Status =3D VerifyPassword (Password, PasswordSize, &UserPasswordVarStruc= t); - if (EFI_ERROR(Status)) { - if (Password[0] !=3D 0) { - *PasswordTryCount =3D *PasswordTryCount + 1; - } - return FALSE; - } - - return TRUE; -} - -/** - Return if the password is set. - - @param[in] UserGuid The user GUID of the password variabl= e. - - @retval TRUE The password is set. - @retval FALSE The password is not set. -**/ -BOOLEAN -IsPasswordSet ( - IN EFI_GUID *UserGuid - ) -{ - USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct; - EFI_STATUS Status; - - Status =3D GetPasswordHashFromVariable(UserGuid, 0, &UserPasswordVarStru= ct); - if (EFI_ERROR(Status)) { - return FALSE; - } - return TRUE; -} - -/** - Return if the password is strong. - Criteria: - 1) length >=3D PASSWORD_MIN_SIZE - 2) include lower case, upper case, number, symbol. - - @param[in] Password The user input password. - @param[in] PasswordSize The size of Password in byte. - - @retval TRUE The password is strong. - @retval FALSE The password is weak. -**/ -BOOLEAN -IsPasswordStrong ( - IN CHAR8 *Password, - IN UINTN PasswordSize - ) -{ - UINTN Index; - BOOLEAN HasLowerCase; - BOOLEAN HasUpperCase; - BOOLEAN HasNumber; - BOOLEAN HasSymbol; - - if (PasswordSize < PASSWORD_MIN_SIZE) { - return FALSE; - } - - HasLowerCase =3D FALSE; - HasUpperCase =3D FALSE; - HasNumber =3D FALSE; - HasSymbol =3D FALSE; - for (Index =3D 0; Index < PasswordSize - 1; Index++) { - if (Password[Index] >=3D 'a' && Password[Index] <=3D 'z') { - HasLowerCase =3D TRUE; - } else if (Password[Index] >=3D 'A' && Password[Index] <=3D 'Z') { - HasUpperCase =3D TRUE; - } else if (Password[Index] >=3D '0' && Password[Index] <=3D '9') { - HasNumber =3D TRUE; - } else { - HasSymbol =3D TRUE; - } - } - if ((!HasLowerCase) || (!HasUpperCase) || (!HasNumber) || (!HasSymbol)) { - return FALSE; - } - return TRUE; -} - -/** - Return if the password is set before in PASSWORD_HISTORY_CHECK_COUNT. - - @param[in] UserGuid The user GUID of the password variabl= e. - @param[in] Password The user input password. - @param[in] PasswordSize The size of Password in byte. - - @retval TRUE The password is set before. - @retval FALSE The password is not set before. -**/ -BOOLEAN -IsPasswordInHistory ( - IN EFI_GUID *UserGuid, - IN CHAR8 *Password, - IN UINTN PasswordSize - ) -{ - EFI_STATUS Status; - USER_PASSWORD_VAR_STRUCT UserPasswordVarStruct; - UINTN Index; - - for (Index =3D 1; Index <=3D PASSWORD_HISTORY_CHECK_COUNT; Index++) { - Status =3D GetPasswordHashFromVariable (UserGuid, Index, &UserPassword= VarStruct); - if (!EFI_ERROR(Status)) { - Status =3D VerifyPassword (Password, PasswordSize, &UserPasswordVarS= truct); - if (!EFI_ERROR(Status)) { - return TRUE; - } - } - } - - return FALSE; -} - -/** - Communication service SMI Handler entry. - - This SMI handler provides services for password management. - - @param[in] DispatchHandle The unique handle assigned to this handle= r by SmiHandlerRegister(). - @param[in] RegisterContext Points to an optional handler context whi= ch was specified when the - handler was registered. - @param[in, out] CommBuffer A pointer to a collection of data in memo= ry that will - be conveyed from a non-SMM environment in= to an SMM environment. - @param[in, out] CommBufferSize The size of the CommBuffer. - - @retval EFI_SUCCESS The interrupt was handled an= d quiesced. No other handlers - should still be called. - @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quies= ced but other handlers should - still be called. - @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pendi= ng and other handlers should still - be called. - @retval EFI_INTERRUPT_PENDING The interrupt could not be q= uiesced. -**/ -EFI_STATUS -EFIAPI -SmmPasswordHandler ( - IN EFI_HANDLE DispatchHandle, - IN CONST VOID *RegisterContext, - IN OUT VOID *CommBuffer, - IN OUT UINTN *CommBufferSize - ) -{ - EFI_STATUS Status; - SMM_PASSWORD_COMMUNICATE_HEADER *SmmFunctionHeader; - UINTN CommBufferPayloadSize; - UINTN TempCommBufferSize; - SMM_PASSWORD_COMMUNICATE_SET_PASSWORD SmmCommunicateSetPassword; - SMM_PASSWORD_COMMUNICATE_VERIFY_PASSWORD SmmCommunicateVerifyPassword; - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY SmmCommunicateSetVerifyPolicy; - SMM_PASSWORD_COMMUNICATE_VERIFY_POLICY *SmmCommunicateGetVerifyPolicy; - UINTN PasswordLen; - EFI_GUID *UserGuid; - UINTN *PasswordTryCount; - - // - // If input is invalid, stop processing this SMI - // - if (CommBuffer =3D=3D NULL || CommBufferSize =3D=3D NULL) { - return EFI_SUCCESS; - } - - TempCommBufferSize =3D *CommBufferSize; - PasswordLen =3D 0; - - if (TempCommBufferSize < sizeof (SMM_PASSWORD_COMMUNICATE_HEADER)) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SMM communication buffer siz= e invalid!\n")); - return EFI_SUCCESS; - } - - CommBufferPayloadSize =3D TempCommBufferSize - sizeof (SMM_PASSWORD_COMM= UNICATE_HEADER); - - Status =3D EFI_SUCCESS; - SmmFunctionHeader =3D (SMM_PASSWORD_COMMUNICATE_HEADER *)CommBuffer; - - UserGuid =3D &gUserAuthenticationGuid; - PasswordTryCount =3D &mAdminPasswordTryCount; - - switch (SmmFunctionHeader->Function) { - case SMM_PASSWORD_FUNCTION_IS_PASSWORD_SET: - PasswordTryCount =3D NULL; - if (CommBufferPayloadSize !=3D 0) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: IS_PASSWORD_SET payload bu= ffer invalid!\n")); - Status =3D EFI_INVALID_PARAMETER; - goto EXIT; - } - if (IsPasswordSet(UserGuid)) { - Status =3D EFI_SUCCESS; - } else { - Status =3D EFI_NOT_FOUND; - } - break; - case SMM_PASSWORD_FUNCTION_SET_PASSWORD: - if (*PasswordTryCount >=3D PASSWORD_MAX_TRY_COUNT) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_PASSWORD try count rea= ch!\n")); - PasswordTryCount =3D NULL; - Status =3D EFI_ACCESS_DENIED; - goto EXIT; - } - if (CommBufferPayloadSize !=3D sizeof(SMM_PASSWORD_COMMUNICATE_SET_PAS= SWORD)) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_PASSWORD payload buffe= r invalid!\n")); - Status =3D EFI_INVALID_PARAMETER; - goto EXIT; - } - CopyMem (&SmmCommunicateSetPassword, SmmFunctionHeader + 1, sizeof(Smm= CommunicateSetPassword)); - - PasswordLen =3D AsciiStrnLenS(SmmCommunicateSetPassword.OldPassword, s= izeof(SmmCommunicateSetPassword.OldPassword)); - if (PasswordLen =3D=3D sizeof(SmmCommunicateSetPassword.OldPassword)) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: OldPassword invalid!\n")); - Status =3D EFI_INVALID_PARAMETER; - goto EXIT; - } - - if (!IsPasswordVerified (UserGuid, SmmCommunicateSetPassword.OldPasswo= rd, PasswordLen + 1)) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: PasswordVerify - FAIL\n")); - Status =3D EFI_SECURITY_VIOLATION; - goto EXIT; - } - - PasswordLen =3D AsciiStrnLenS(SmmCommunicateSetPassword.NewPassword, s= izeof(SmmCommunicateSetPassword.NewPassword)); - if (PasswordLen =3D=3D sizeof(SmmCommunicateSetPassword.NewPassword)) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword invalid!\n")); - Status =3D EFI_INVALID_PARAMETER; - goto EXIT; - } - if (PasswordLen !=3D 0 && !IsPasswordStrong (SmmCommunicateSetPassword= .NewPassword, PasswordLen + 1)) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword too weak!\n")); - Status =3D EFI_UNSUPPORTED; - goto EXIT; - } - if (PasswordLen !=3D 0 && IsPasswordInHistory (UserGuid, SmmCommunicat= eSetPassword.NewPassword, PasswordLen + 1)) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: NewPassword in history!\n"= )); - Status =3D EFI_ALREADY_STARTED; - goto EXIT; - } - - if (PasswordLen =3D=3D 0) { - Status =3D SavePasswordToVariable (UserGuid, NULL, 0); - } else { - Status =3D SavePasswordToVariable (UserGuid, SmmCommunicateSetPasswo= rd.NewPassword, PasswordLen + 1); - } - break; - - case SMM_PASSWORD_FUNCTION_VERIFY_PASSWORD: - if (*PasswordTryCount >=3D PASSWORD_MAX_TRY_COUNT) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: VERIFY_PASSWORD try count = reach!\n")); - PasswordTryCount =3D NULL; - Status =3D EFI_ACCESS_DENIED; - goto EXIT; - } - if (CommBufferPayloadSize !=3D sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_= PASSWORD)) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: VERIFY_PASSWORD payload bu= ffer invalid!\n")); - Status =3D EFI_INVALID_PARAMETER; - goto EXIT; - } - CopyMem (&SmmCommunicateVerifyPassword, SmmFunctionHeader + 1, sizeof(= SmmCommunicateVerifyPassword)); - - PasswordLen =3D AsciiStrnLenS(SmmCommunicateVerifyPassword.Password, s= izeof(SmmCommunicateVerifyPassword.Password)); - if (PasswordLen =3D=3D sizeof(SmmCommunicateVerifyPassword.Password)) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: Password invalid!\n")); - Status =3D EFI_INVALID_PARAMETER; - goto EXIT; - } - if (!IsPasswordVerified (UserGuid, SmmCommunicateVerifyPassword.Passwo= rd, PasswordLen + 1)) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: PasswordVerify - FAIL\n")); - Status =3D EFI_SECURITY_VIOLATION; - goto EXIT; - } - mPasswordVerified =3D TRUE; - Status =3D EFI_SUCCESS; - break; - - case SMM_PASSWORD_FUNCTION_SET_VERIFY_POLICY: - PasswordTryCount =3D NULL; - if (CommBufferPayloadSize !=3D sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_= POLICY)) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: SET_VERIFY_POLICY payload = buffer invalid!\n")); - Status =3D EFI_INVALID_PARAMETER; - goto EXIT; - } - CopyMem (&SmmCommunicateSetVerifyPolicy, SmmFunctionHeader + 1, sizeof= (SmmCommunicateSetVerifyPolicy)); - mNeedReVerify =3D SmmCommunicateSetVerifyPolicy.NeedReVerify; - break; - - case SMM_PASSWORD_FUNCTION_GET_VERIFY_POLICY: - PasswordTryCount =3D NULL; - if (CommBufferPayloadSize !=3D sizeof(SMM_PASSWORD_COMMUNICATE_VERIFY_= POLICY)) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: GET_VERIFY_POLICY payload = buffer invalid!\n")); - Status =3D EFI_INVALID_PARAMETER; - goto EXIT; - } - SmmCommunicateGetVerifyPolicy =3D (SMM_PASSWORD_COMMUNICATE_VERIFY_POL= ICY *) (SmmFunctionHeader + 1); - SmmCommunicateGetVerifyPolicy->NeedReVerify =3D mNeedReVerify; - break; - case SMM_PASSWORD_FUNCTION_WAS_PASSWORD_VERIFIED: - PasswordTryCount =3D NULL; - if (CommBufferPayloadSize !=3D 0) { - DEBUG ((DEBUG_ERROR, "SmmPasswordHandler: WAS_PASSWORD_VERIFIED payl= oad buffer invalid!\n")); - Status =3D EFI_INVALID_PARAMETER; - goto EXIT; - } - if (mPasswordVerified) { - Status =3D EFI_SUCCESS; - } else { - Status =3D EFI_NOT_STARTED; - } - break; - - default: - PasswordTryCount =3D NULL; - Status =3D EFI_UNSUPPORTED; - break; - } - -EXIT: - if (PasswordTryCount !=3D NULL) { - if (Status =3D=3D EFI_SUCCESS) { - *PasswordTryCount =3D 0; - } - } - SmmFunctionHeader->ReturnStatus =3D Status; - - return EFI_SUCCESS; -} - -/** - Main entry for this driver. - - @param ImageHandle Image handle this driver. - @param SystemTable Pointer to SystemTable. - - @retval EFI_SUCESS This function always complete successfully. - -**/ -EFI_STATUS -EFIAPI -PasswordSmmInit ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - EFI_HANDLE SmmHandle; - EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock; - CHAR16 PasswordHistoryName[sizeof(USER_AU= THENTICATION_VAR_NAME)/sizeof(CHAR16) + 5]; - UINTN Index; - - ASSERT (PASSWORD_HASH_SIZE =3D=3D SHA256_DIGEST_SIZE); - ASSERT (PASSWORD_HISTORY_CHECK_COUNT < 0xFFFF); - - Status =3D gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL,= (VOID**)&mSmmVariable); - ASSERT_EFI_ERROR (Status); - - // - // Make password variables read-only for DXE driver for security concern. - // - Status =3D gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (= VOID **) &VariableLock); - if (!EFI_ERROR (Status)) { - Status =3D VariableLock->RequestToLock (VariableLock, USER_AUTHENTICAT= ION_VAR_NAME, &gUserAuthenticationGuid); - ASSERT_EFI_ERROR (Status); - - for (Index =3D 1; Index <=3D PASSWORD_HISTORY_CHECK_COUNT; Index++) { - UnicodeSPrint (PasswordHistoryName, sizeof (PasswordHistoryName), L"= %s%04x", USER_AUTHENTICATION_VAR_NAME, Index); - Status =3D VariableLock->RequestToLock (VariableLock, PasswordHistor= yName, &gUserAuthenticationGuid); - ASSERT_EFI_ERROR (Status); - } - Status =3D VariableLock->RequestToLock (VariableLock, USER_AUTHENTICAT= ION_HISTORY_LAST_VAR_NAME, &gUserAuthenticationGuid); - ASSERT_EFI_ERROR (Status); - } - - SmmHandle =3D NULL; - Status =3D gSmst->SmiHandlerRegister (SmmPasswordHandler, &gUserAuthe= nticationGuid, &SmmHandle); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return Status; - } - - if (IsPasswordCleared()) { - DEBUG ((DEBUG_INFO, "IsPasswordCleared\n")); - SavePasswordToVariable (&gUserAuthenticationGuid, NULL, 0); - } - - return EFI_SUCCESS; -} - diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/User= AuthenticationSmm.h b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentica= tion/UserAuthenticationSmm.h deleted file mode 100644 index 47bb95529f..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthent= icationSmm.h +++ /dev/null @@ -1,52 +0,0 @@ -/** @file - Header file for UserAuthenticationSmm. - - Copyright (c) 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef __USER_AUTHENTICATION_SMM_H__ -#define __USER_AUTHENTICATION_SMM_H__ - -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "KeyService.h" - -#define PASSWORD_SALT_SIZE 32 -#define PASSWORD_HASH_SIZE 32 // SHA256_DIGEST_SIZE - -#define PASSWORD_MAX_TRY_COUNT 3 -#define PASSWORD_HISTORY_CHECK_COUNT 5 - -// -// Name of the variable -// -#define USER_AUTHENTICATION_VAR_NAME L"Password" -#define USER_AUTHENTICATION_HISTORY_LAST_VAR_NAME L"PasswordLast" - -// -// Variable storage -// -typedef struct { - UINT8 PasswordHash[PASSWORD_HASH_SIZE]; - UINT8 PasswordSalt[PASSWORD_SALT_SIZE]; -} USER_PASSWORD_VAR_STRUCT; - -#endif diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/User= AuthenticationSmm.inf b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthenti= cation/UserAuthenticationSmm.inf deleted file mode 100644 index c5d15ada5e..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthent= icationSmm.inf +++ /dev/null @@ -1,53 +0,0 @@ -## @file -# User Authentication Smm Driver. -# -# This driver provides SMM services for DXE user authentication module. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D UserAuthenticationSmm - FILE_GUID =3D 8fc6aaaa-4561-4815-8cf7-b87312992dce - MODULE_TYPE =3D DXE_SMM_DRIVER - VERSION_STRING =3D 1.0 - PI_SPECIFICATION_VERSION =3D 0x0001000A - ENTRY_POINT =3D PasswordSmmInit - -[Sources] - UserAuthenticationSmm.c - UserAuthenticationSmm.h - KeyService.c - KeyService.h - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - CryptoPkg/CryptoPkg.dec - UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - UefiDriverEntryPoint - DebugLib - BaseLib - BaseMemoryLib - PrintLib - SmmServicesTableLib - MemoryAllocationLib - UefiLib - BaseCryptLib - PlatformPasswordLib - -[Guids] - gUserAuthenticationGuid ## CONSUMES ## GUID - -[Protocols] - gEdkiiVariableLockProtocolGuid ## CONSUMES - gEfiSmmVariableProtocolGuid ## CONSUMES - -[Depex] - gEfiSmmVariableProtocolGuid AND gEfiVariableWriteArchProtocolGuid diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg= .dec b/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec deleted file mode 100644 index 3c8fe1da01..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dec +++ /dev/null @@ -1,45 +0,0 @@ -## @file -# This package provides UI related modules. -# -# The DEC files are used by the utilities that parse DSC and -# INF files to generate AutoGen.c and AutoGen.h files -# for the build infrastructure. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - DEC_SPECIFICATION =3D 0x00010017 - PACKAGE_NAME =3D UserInterfaceFeaturePkg - PACKAGE_VERSION =3D 0.1 - PACKAGE_GUID =3D 5A92199C-C2ED-4A3F-9ED0-C278DEA0DA47 - -[Includes] - Include - -[LibraryClasses] - ## @libraryclass Provides a platform-specific method to return passwor= d policy. - PlatformPasswordLib|Include/Library/PlatformPasswordLib.h - - ## @libraryclass Provides services to set/verify password and return i= f the password is set. - UserPasswordLib|Include/Library/UserPasswordLib.h - - ## @libraryclass Provides services to do password authentication. - UserPasswordUiLib|Include/Library/UserPasswordUiLib.h - -[Guids] - gEfiUserInterfaceFeaturePkgTokenSpaceGuid =3D { 0x13c2147c, 0x75b6, 0x4= 8ee, { 0xa4, 0x4b, 0xfc, 0x4, 0xb, 0x44, 0x97, 0xbd } } - - ## Include Include/Guid/UserAuthentication.h - gUserAuthenticationGuid =3D { 0xee24a7f7, 0x606b, 0x4724, { 0xb3, 0xc9, = 0xf5, 0xae, 0x4a, 0x3b, 0x81, 0x65} } - -[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx] - ## Indicate whether the password is cleared. - # When it is configured to Dynamic or DynamicEx, it can be set through d= etection using - # a platform-specific method (e.g. Board Jumper set) in a actual platfor= m in early boot phase.

- # @Prompt The password clear status - gEfiUserInterfaceFeaturePkgTokenSpaceGuid.PcdPasswordCleared|FALSE|BOOLE= AN|0x00000001 - diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg= .dsc b/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc deleted file mode 100644 index bd09052f3c..0000000000 --- a/Platform/Intel/UserInterfaceFeaturePkg/UserInterfaceFeaturePkg.dsc +++ /dev/null @@ -1,101 +0,0 @@ -## @file -# This package provides UI related modules. -# This package should only depend on EDKII Core packages and MinPlatformPk= g. -# -# The DEC files are used by the utilities that parse DSC and -# INF files to generate AutoGen.c and AutoGen.h files -# for the build infrastructure. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - PLATFORM_NAME =3D UserInterfaceFeaturePkg - PLATFORM_GUID =3D 66536B4C-84A3-42FD-B0AE-603414A4CE9E - PLATFORM_VERSION =3D 0.1 - DSC_SPECIFICATION =3D 0x00010005 - OUTPUT_DIRECTORY =3D Build/UserInterfaceFeaturePkg - SUPPORTED_ARCHITECTURES =3D IA32|X64 - BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT - SKUID_IDENTIFIER =3D DEFAULT - -[LibraryClasses] - ####################################### - # Edk2 Packages - ####################################### - BaseLib|MdePkg/Library/BaseLib/BaseLib.inf - BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf - HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf - IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf - OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf - TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplat= e.inf - UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf - UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf - UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServic= esLib.inf - UefiLib|MdePkg/Library/UefiLib/UefiLib.inf - UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/U= efiRuntimeServicesTableLib.inf - - ##################################### - # User Interface Feature Package - ##################################### - PlatformPasswordLib|UserInterfaceFeaturePkg/Library/PlatformPasswordLibN= ull/PlatformPasswordLibNull.inf - UserPasswordLib|UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPass= wordLib.inf - -[LibraryClasses.common.DXE_DRIVER] - ####################################### - # Edk2 Packages - ####################################### - MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf - -[LibraryClasses.common.DXE_SMM_DRIVER] - ####################################### - # Edk2 Packages - ####################################### - BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf - MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAlloc= ationLib.inf - SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableL= ib.inf - -##########################################################################= ######################### -# -# Components Section - list of the modules and components that will be pro= cessed by compilation -# tools and the EDK II tools to generate PE32/PE32+/C= off image files. -# -# Note: The EDK II DSC file is not used to specify how compiled binary ima= ges get placed -# into firmware volume images. This section is just a list of module= s to compile from -# source into UEFI-compliant binaries. -# It is the FDF file that contains information on combining binary f= iles into firmware -# volume images, whose concept is beyond UEFI and is described in PI= specification. -# Binary modules do not need to be listed in this section, as they s= hould be -# specified in the FDF file. For example: Shell binary (Shell_Full.e= fi), FAT binary (Fat.efi), -# Logo (Logo.bmp), and etc. -# There may also be modules listed in this section that are not requ= ired in the FDF file, -# When a module listed here is excluded from FDF file, then UEFI-com= pliant binary will be -# generated for it, but the binary will not be put into any firmware= volume. -# -##########################################################################= ######################### -[Components] - ##################################### - # User Interface Feature Package - ##################################### - - # Add library instances here that are not included in package components= and should be tested - # in the package build. - UserInterfaceFeaturePkg/Library/PlatformPasswordLibNull/PlatformPassword= LibNull.inf - UserInterfaceFeaturePkg/Library/UserPasswordLib/UserPasswordLib.inf - UserInterfaceFeaturePkg/Library/UserPasswordUiLib/UserPasswordUiLib.inf - - # Add components here that should be included in the package build. - UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationDxe.inf - UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.inf - UserInterfaceFeaturePkg/UserAuthentication/UserAuthenticationSmm.inf - -[BuildOptions] - *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES --=20 2.23.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#58925): https://edk2.groups.io/g/devel/message/58925 Mute This Topic: https://groups.io/mt/74087549/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-