]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
2 years agoMdeModulePkg/GraphicsConsoleDxe: add modes
Gerd Hoffmann [Fri, 22 Apr 2022 12:41:18 +0000 (14:41 +0200)]
MdeModulePkg/GraphicsConsoleDxe: add modes

Add modes for a few common display resolutions higher than 800x600,
specifically 1024x768, 1280x800 and 1920x1080, so ConSplitterDxe has
more options available.

The mode list is not use as-is, InitializeGraphicsConsoleTextMode() will
check the list and filter out any modes which don't fit to the screen,
so this will also work fine for small displays.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years ago.pytool/Plugin/UncrustifyCheck: Add Azure DevOps UI debug instructions
Michael Kubacki [Wed, 20 Apr 2022 01:13:18 +0000 (21:13 -0400)]
.pytool/Plugin/UncrustifyCheck: Add Azure DevOps UI debug instructions

Adds a link to the log output that contains instructions on how find
detailed file formatting errors in the Azure DevOps UI.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
2 years ago.azurepipelines: Add NOOPT to all package builds
Michael Kubacki [Wed, 20 Apr 2022 00:12:56 +0000 (20:12 -0400)]
.azurepipelines: Add NOOPT to all package builds

The NOOPT build target is used for host-based unit tests. This
change adds the NOOPT target for all packages to ensure that tests
are executed if present.

If the host-based DSC is not specified in the packages CI YAML file,
the host-based compiler plugin will be reported as a skipped test.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
2 years agoBaseTools: Move gPlatformFinalPcd to Datapipe and optimize size
Li, Yi1 [Mon, 18 Apr 2022 08:15:21 +0000 (16:15 +0800)]
BaseTools: Move gPlatformFinalPcd to Datapipe and optimize size

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3828

This is a bugfix of
bf9230a9f3dde065c3c8b4175ccd32e44e8f0362.

1.In the current code, gPlatformFinalPcd will save all PCDs used at
whole compile process, which wastes runtime memory and is unnecessary.

This patch makes gPlatformFinalPcd save only the PCDes which are
assigned in the DSC file, and the PCD that has not been assigned will
use the default value in DEC.

2.During the compilation process, gPlatformFinalPcd may be lost, and
the current code cannot selectively assign PCD in DSC by specifying ARCH.

This patch moves gPlatformFinalPcd into datapipe and modifies the
assignment logicto fix this.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: yi1 li <yi1.li@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2 years agoUefiPayloadPkg: Fix IA32 entry build failure
Tan, Dun [Tue, 19 Apr 2022 00:51:10 +0000 (17:51 -0700)]
UefiPayloadPkg: Fix IA32 entry build failure

The ObjCopyFlag and EntryOutputDir need to be modified when
building IA32 UniversalPayload Entry

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2 years agoShellPkg: Update smbiosview type 9 with SMBIOS 3.5 fields
Bo Chang Ke [Thu, 21 Apr 2022 10:54:46 +0000 (18:54 +0800)]
ShellPkg: Update smbiosview type 9 with SMBIOS 3.5 fields

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3896

update smbiosview type 9 related fileds.

Signed-off-by: Bo Chang Ke <bo-changx.ke@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2 years agoMdePkg: Update smbiosview type 9 with SMBIOS 3.5 fields
Bo Chang Ke [Thu, 21 Apr 2022 10:54:45 +0000 (18:54 +0800)]
MdePkg: Update smbiosview type 9 with SMBIOS 3.5 fields

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3896

update smbiosview type 9 related fileds.

Signed-off-by: Bo Chang Ke <bo-changx.ke@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoCryptoPkg: Declare PcdEcEnabled in Library consuming OpensslLib
Yi Li [Tue, 19 Apr 2022 14:37:38 +0000 (22:37 +0800)]
CryptoPkg: Declare PcdEcEnabled in Library consuming OpensslLib

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3679
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3828

Tls/Base/Pei/Smm/RuntimeCryptLib.inf will use OpensslLib,
and the opensslconf.h in openssllib will use PcdEcEnabled,
but it is not declared in the inf file now,
it will cause warnings in some compilers.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Yi Li <yi1.li@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg/OvmfPkgX64: Adjust load sequence of TdxDxe and AmdSevDxe driver
Min Xu [Thu, 21 Apr 2022 00:45:29 +0000 (08:45 +0800)]
OvmfPkg/OvmfPkgX64: Adjust load sequence of TdxDxe and AmdSevDxe driver

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3904

TdxDxe driver is introduced for Intel TDX feature. Unfortunately, this
driver also breaks boot process in SEV-ES guest. The root cause is in
the PciLib which is imported by TdxDxe driver.

In a SEV-ES guest the AmdSevDxe driver performs a
MemEncryptSevClearMmioPageEncMask() call against the
PcdPciExpressBaseAddress range to mark it shared/unencrypted. However,
the TdxDxe driver is loaded before the AmdSevDxe driver, and the PciLib
in TdxDxe is DxePciLibI440FxQ35 which will access the
PcdPciExpressBaseAddress range. Since the range has not been marked
shared/unencrypted, the #VC handler terminates the guest for trying to
do MMIO to an encrypted region.

Adjusting the load sequence of TdxDxe and AmdSevDxe can fix the issue.

Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
SEV-Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
TDX-Tested-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
2 years agoPrmPkg/DxePrmContextBufferLib: Fix unit test GCC compilation errors
Michael Kubacki [Tue, 12 Apr 2022 19:05:09 +0000 (15:05 -0400)]
PrmPkg/DxePrmContextBufferLib: Fix unit test GCC compilation errors

https://bugzilla.tianocore.org/show_bug.cgi?id=3905

Fixes GCC compilation errors in DxePrmContextBufferLibUnitTest.c.

Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoCryptoPkg/Crt: fix strcpy build on older VS compilers
Gerd Hoffmann [Wed, 20 Apr 2022 06:16:56 +0000 (14:16 +0800)]
CryptoPkg/Crt: fix strcpy build on older VS compilers

Drop 'restrict' keyword which older visual studio compiler
versions complain about.

Fixes: fab6285a73c4 ("CryptoPkg/CrtLibSupport: fix strcpy")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: Call CcProbe in SecMain.c instead of TsIsEnabled
Min Xu [Tue, 19 Apr 2022 00:26:28 +0000 (08:26 +0800)]
OvmfPkg: Call CcProbe in SecMain.c instead of TsIsEnabled

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3902

TdIsEnabled() uses the CPUID instruction. At this point, exception
handling is not established and a CPUID instruction will generate
a #VC and cause the booting guest to crash.

CcProbe() checks Ovmf work area to return the guest type. So call
of CcProbe() instead of TdIsEnabled() to fix the above issue.

Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
2 years agoMdePkg: Probe Cc guest in BaseIoLibIntrinsicSev
Min Xu [Tue, 19 Apr 2022 00:26:27 +0000 (08:26 +0800)]
MdePkg: Probe Cc guest in BaseIoLibIntrinsicSev

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3902

Bad IO performance in SEC phase is observed after TDX features was
introduced. (after commit b6b2de884864 - "MdePkg: Support mmio for
Tdx guest in BaseIoLibIntrinsic").

This is because IsTdxGuest() will be called in each MMIO operation.
It is trying to cache the result of the probe in the efi data segment.
However, that doesn't work in SEC, because the data segment is read only
(so the write seems to succeed but a read will always return the
original value), leading to us calling TdIsEnabled() check for every
mmio we do, which is causing the slowdown because it's very expensive.

This patch is to call CcProbe instead of TdIsEnabled in IsTdxGuest.
Null instance of CcProbe always returns CCGuestTypeNonEncrypted. Its
OvmfPkg version returns the guest type in Ovmf work area.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
2 years agoOvmfPkg: Add CcProbeLib in *.dsc
Min Xu [Tue, 19 Apr 2022 00:26:26 +0000 (08:26 +0800)]
OvmfPkg: Add CcProbeLib in *.dsc

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3902

CcProbeLib is imported in BaseIoLibIntrinsicSev.
OvmfPkg/Library/CcProbeLib is the OvmfPkg version which checks
OvmfWorkArea to return the Cc guest type. It is included
in OvmfPkgX64.dsc and IntelTdx/IntelTdxX64.dsc.

Other .dsc include the MdePkg/Library/CcProbeLibNull because Cc guest
is not supported in those projects.

Cc: James Bottomley <jejb@linux.ibm.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
2 years agoOvmfPkg: Add CcProbeLib
Min Xu [Tue, 19 Apr 2022 00:26:25 +0000 (08:26 +0800)]
OvmfPkg: Add CcProbeLib

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3902

This is the OvmfPkg specific CcProbeLib. It checks the Ovmf WorkArea
(PcdOvmfWorkAreaBase) to return the guest type.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
2 years agoMdePkg: Add CcProbeLibNull
Min Xu [Tue, 19 Apr 2022 00:26:24 +0000 (08:26 +0800)]
MdePkg: Add CcProbeLibNull

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3902

CcProbeLib is used to probe the Confidential Computing guest type.
This library is designed to run on SEC / PEI / DXE phases. A null
instance of the library always returns CCGuestTypeNonEncrypted.
A platform specific CcProbeLib will be implemented, for example,
in OvmfPkg.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
2 years agoOvmfPkg: Replace GUEST_TYPE with CC_GUEST_TYPE
Min Xu [Tue, 19 Apr 2022 00:26:23 +0000 (08:26 +0800)]
OvmfPkg: Replace GUEST_TYPE with CC_GUEST_TYPE

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3902

Replace GUEST_TYPE with CC_GUEST_TYPE which is defined in
MdePkg/Include/ConfidentialComputingGuestAttr.h.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
2 years agoMdePkg: Add CC_GUEST_TYPE in ConfidentialComputingGuestAttr.h
Min Xu [Tue, 19 Apr 2022 00:26:22 +0000 (08:26 +0800)]
MdePkg: Add CC_GUEST_TYPE in ConfidentialComputingGuestAttr.h

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3902

The confidential computing guest type (GUEST_TYPE) was defined in
OvmfPkg/Include/WorkArea.h. Now it is to be moved to
MdePkg/Include/ConfidentialComputingGuestAttr.h and renamed as
CC_GUEST_TYPE.

There are 2 reasons for this change.
1. CC_GUEST_TYPE is a generic definition and will be used in CcProbeLib
   which is defined in MdePkg.
2. Based on the latest edk2 coding style:
 - First character should be upper case
 - Must contain lower case characters
 - No white space characters
 - Global variable name must start with a 'g'

As the first step CC_GUEST_TYPE is defined in this patch. In the
next patch GUEST_TYPE will be deleted. This is to make sure the
bisect work correctly.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
2 years agoIntelFsp2WrapperPkg: SecFspWrapperPlatformSecLibSample support for X64
Ted Kuo [Fri, 15 Apr 2022 08:37:43 +0000 (01:37 -0700)]
IntelFsp2WrapperPkg: SecFspWrapperPlatformSecLibSample support for X64

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3893
1.Added SecFspWrapperPlatformSecLibSample support for X64.
2.Adopted FSPT_ARCH2_UPD in SecFspWrapperPlatformSecLibSample.
3.Moved Fsp.h up one level to be shared across IA32 and X64.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2 years agoIntelFsp2WrapperPkg: BaseFspWrapperApiLib support for X64
Ted Kuo [Fri, 15 Apr 2022 08:37:42 +0000 (01:37 -0700)]
IntelFsp2WrapperPkg: BaseFspWrapperApiLib support for X64

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3893
Add Execute64BitCode to execute 64bit code from long mode directly
in PEI 64bit.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2 years agoIntelFsp2WrapperPkg: Adopt FSPM_UPD_COMMON_FSP24 for X64
Ted Kuo [Fri, 15 Apr 2022 08:37:41 +0000 (01:37 -0700)]
IntelFsp2WrapperPkg: Adopt FSPM_UPD_COMMON_FSP24 for X64

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3893
Adopt FSPM_UPD_COMMON_FSP24 in FspmWrapperPeim to support X64.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2 years agoIntelFsp2Pkg: SecFspSecPlatformLibNull support for X64
Ted Kuo [Fri, 15 Apr 2022 08:37:40 +0000 (01:37 -0700)]
IntelFsp2Pkg: SecFspSecPlatformLibNull support for X64

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3893
1.Added SecFspSecPlatformLibNull support for X64.
2.Added X64 support to IntelFsp2Pkg.dsc.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2 years agoIntelFsp2Pkg: FspSecCore support for X64
Ted Kuo [Fri, 15 Apr 2022 08:37:39 +0000 (01:37 -0700)]
IntelFsp2Pkg: FspSecCore support for X64

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3893
1.Added FspSecCore support for X64.
2.Bumped FSP header revision to 7 to indicate FSP 64bit is supported.
3.Corrected few typos.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2 years agoIntelFsp2Pkg: Update FSP_GLOBAL_DATA and FSP_PLAT_DATA for X64
Ted Kuo [Fri, 15 Apr 2022 08:37:38 +0000 (01:37 -0700)]
IntelFsp2Pkg: Update FSP_GLOBAL_DATA and FSP_PLAT_DATA for X64

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3893
Updated FSP_GLOBAL_DATA and FSP_PLAT_DATA structures to support
both IA32 and X64.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2 years agoIntelFsp2Pkg: Add FSPx_ARCH2_UPD support for X64
Ted Kuo [Fri, 15 Apr 2022 08:37:37 +0000 (01:37 -0700)]
IntelFsp2Pkg: Add FSPx_ARCH2_UPD support for X64

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3893
1.Added FSPx_ARCH2_UPD structures which support both IA32 and X64.
2.Added FSPx_UPD_COMMON_FSP24 structures.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2 years agoIntelFsp2Pkg: X64 compatible changes to support PEI in 64bit
Ted Kuo [Fri, 15 Apr 2022 08:37:36 +0000 (01:37 -0700)]
IntelFsp2Pkg: X64 compatible changes to support PEI in 64bit

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3893
1.Added EFIAPI to FspNotifyPhasePeimEntryPoint, SwapStack and
  PEI_CORE_ENTRY.
2.Treat both MAX_ADDRESS and MAX_UINT32 as invalid address for
  FSP global data in FspApiCallingCheck().
3.Changed AsmReadEsp to AsmReadStackPointer.
4.Changed the type of the return value of AsmReadStackPointer
  from UINT32 to UINTN.
5.Changed the type of TemporaryMemoryBase, PermenentMemoryBase
  and BootLoaderStack from UINT32 to UINTN.
6.Some type casting to pointers are UINT32. Changed them to
  UINTN to accommodate both IA32 and X64.
7.Corrected some typos.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2 years agoShellPkg: Update smbiosview type 41 with SMBIOS 3.5 fields
Ke, Bo-ChangX [Mon, 11 Apr 2022 07:17:50 +0000 (15:17 +0800)]
ShellPkg: Update smbiosview type 41 with SMBIOS 3.5 fields

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3900

update smbiosview type 41 related fileds.

Signed-off-by: Bo Chang Ke <bo-changx.ke@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2 years agoUefiPayloadPkg: Fix the build failure
Guo Dong [Wed, 13 Apr 2022 20:42:09 +0000 (13:42 -0700)]
UefiPayloadPkg: Fix the build failure

When Quite parameter is not provided, its default value would
be "None" instead of "". So update its default value not to
impact the build.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Guo Dong <guo.dong@intel.com>
Acked-by: Dun Tan <dun.tan@intel.com>
2 years agoCryptoPkg/TlsLibNull: Remove MU_CHANGE comment markers
Michael Kubacki [Wed, 6 Apr 2022 00:50:00 +0000 (08:50 +0800)]
CryptoPkg/TlsLibNull: Remove MU_CHANGE comment markers

MU_CHANGE tags are used in a different project (Project Mu) to
highlight deviations from Tianocore. Therefore, the comments are
not needed when the changes are present in a Tianocore repository.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoCryptoPkg: Make EC source file config-able
yi1 li [Wed, 13 Apr 2022 07:02:02 +0000 (15:02 +0800)]
CryptoPkg: Make EC source file config-able

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3679
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3828

Use PCD gEfiCryptoPkgTokenSpaceGuid.PcdEcEnabled to config-able
source files list in OpensslLib.inf and OpensslLibCrypto.inf.
If PcdEcEnabled equals to FALSE, this file will not be compiled.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: yi1 li <yi1.li@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoCryptoPkg: Reconfigure OpensslLib to add EC algorithms
yi1 li [Wed, 13 Apr 2022 07:02:01 +0000 (15:02 +0800)]
CryptoPkg: Reconfigure OpensslLib to add EC algorithms

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3679
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3828

Reconfigure OpensslLib to add elliptic curve cipher algorithms.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: yi1 li <yi1.li@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoCryptoPkg: Add instrinsics to support building ECC on IA32 windows
yi1 li [Wed, 13 Apr 2022 07:02:00 +0000 (15:02 +0800)]
CryptoPkg: Add instrinsics to support building ECC on IA32 windows

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3679

This dependency is needed to build openssl lib with ECC ciphers
under IA32 Windows and adds implementation for _allmul and _allshr
instrinsics.

It is taken from Project Mu:
microsoft/mu_basecore@b55b341

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: yi1 li <yi1.li@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoMaintainers.txt: Add Michael Kubacki as UnitTestFrameworkPkg maintainer
Michael D Kinney [Wed, 13 Apr 2022 15:40:49 +0000 (08:40 -0700)]
Maintainers.txt: Add Michael Kubacki as UnitTestFrameworkPkg maintainer

Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
2 years agopip-requirements.txt: Update basetools version to 0.1.17
Bob Feng [Tue, 12 Apr 2022 11:49:12 +0000 (19:49 +0800)]
pip-requirements.txt: Update basetools version to 0.1.17

Synced the basetools patch from edk2 repo to
edk2-basetools repo. Update the basetools pip module version
to the latest.

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2 years agoCryptoPkg/UnitTest: fix DH testcase
Gerd Hoffmann [Mon, 11 Apr 2022 11:24:57 +0000 (19:24 +0800)]
CryptoPkg/UnitTest: fix DH testcase

openssl 3.0 wants at least 512 bytes, otherwise it throws an error:

error:0280007E:Diffie-Hellman routines::modulus too small

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoCryptoPkg/CrtLibSupport: fix strcpy
Gerd Hoffmann [Mon, 11 Apr 2022 11:24:56 +0000 (19:24 +0800)]
CryptoPkg/CrtLibSupport: fix strcpy

strcpy() returns a pointer to the destination string, AsciiStrCpyS()
does not.  So a simple #define does not work.  Create a function
instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoCryptoPkg/CrtLibSupport: add off_t
Gerd Hoffmann [Mon, 11 Apr 2022 11:24:55 +0000 (19:24 +0800)]
CryptoPkg/CrtLibSupport: add off_t

Add typedef for off_t.
Will be needed by openssl 3.0.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoCryptoPkg/CrtLibSupport: add MODULESDIR
Gerd Hoffmann [Mon, 11 Apr 2022 11:24:54 +0000 (19:24 +0800)]
CryptoPkg/CrtLibSupport: add MODULESDIR

Add dummy MODULESDIR #define
Will be needed by openssl 3.0.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoCryptoPkg/CrtLibSupport: add UINT_MAX
Gerd Hoffmann [Mon, 11 Apr 2022 11:24:53 +0000 (19:24 +0800)]
CryptoPkg/CrtLibSupport: add UINT_MAX

Add define for UINT_MAX.
Will be needed by openssl 3.0.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoCryptoPkg/CrtLibSupport: add INT_MIN
Gerd Hoffmann [Mon, 11 Apr 2022 11:24:52 +0000 (19:24 +0800)]
CryptoPkg/CrtLibSupport: add INT_MIN

Add #define for INT_MIN.
Will be needed by openssl 3.0.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoCryptoPkg/CrtLibSupport: add strstr()
Gerd Hoffmann [Mon, 11 Apr 2022 11:24:51 +0000 (19:24 +0800)]
CryptoPkg/CrtLibSupport: add strstr()

Add #define for strstr().
Will be needed by openssl 3.0.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoCryptoPkg/CrtLibSupport: add fcntl.h
Gerd Hoffmann [Mon, 11 Apr 2022 11:24:50 +0000 (19:24 +0800)]
CryptoPkg/CrtLibSupport: add fcntl.h

Add fcntl.h header file.
Will be needed by openssl 3.0.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoBaseTools: Fix DevicePath tool build failure issue
Feng, Bob C [Mon, 4 Apr 2022 03:46:21 +0000 (11:46 +0800)]
BaseTools: Fix DevicePath tool build failure issue

Fix the DevicePath tool build failure that was introduced by
the fixes: 22130dcd98b4 ("Basetools: turn off gcc12 warning").
Failure cases are:
1. clang 13.1.6 on macOS
2. gcc5.4

Reported-by: Rebecca Cran <rebecca@bsdio.com>
Reported-by: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
2 years agoNetworkPkg/HttpDxe: Detect HTTP/1.0 servers
Oliver Steffen [Tue, 22 Mar 2022 13:30:08 +0000 (14:30 +0100)]
NetworkPkg/HttpDxe: Detect HTTP/1.0 servers

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720

Force connection close before the next request if
the server identifies as version 1.0.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoNetworkPkg/HttpDxe: Detect 'Connection: close' header
Oliver Steffen [Tue, 22 Mar 2022 13:30:07 +0000 (14:30 +0100)]
NetworkPkg/HttpDxe: Detect 'Connection: close' header

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720

Force connection close before the next request if
the server sends the 'Connection: close' header.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoNetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL
Oliver Steffen [Tue, 22 Mar 2022 13:30:06 +0000 (14:30 +0100)]
NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720

Add ConnectionClose flag to HTTP_PROTOCOL.
This boolean is FALSE by default. If set to TRUE, a reconfigure
of the Http instance is forced on the next request. The flag
is then reset.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoNetworkPkg/HttpDxe: Decofigure Tcp6 before reconfiguring
Oliver Steffen [Tue, 22 Mar 2022 13:30:05 +0000 (14:30 +0100)]
NetworkPkg/HttpDxe: Decofigure Tcp6 before reconfiguring

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720

Check if the state of the HTTP instance is HTTP_STATE_TCP_CONNECTED, or
HTTP_STATE_TCP_CLOSED and de-configure the Tcp6 instance before
configuring it again.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoNetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring
Oliver Steffen [Tue, 22 Mar 2022 13:30:04 +0000 (14:30 +0100)]
NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720

Check if the state of the HTTP instance is HTTP_STATE_TCP_CONNECTED, or
HTTP_STATE_TCP_CLOSED and de-configure the Tcp4 instance before
configuring it again.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoNetworkPkg: Add PCDs for HTTP DNS RetryCount and RetryInterval
Heng Luo [Sun, 3 Apr 2022 06:14:10 +0000 (14:14 +0800)]
NetworkPkg: Add PCDs for HTTP DNS RetryCount and RetryInterval

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3889

Currently the HTTP DNS Retry Interval is 2 second and no retry attempt.
If DNS response can't arrive in 2 second, the DNS request is failed,
and then HTTP boot is failed.
In order to resolve this issue, Add PCDs to support RetryCount
and RetryInterval configured in Platform.

Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Signed-off-by: Heng Luo <heng.luo@intel.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
2 years agoUefiPayloadPkg: Add --quiet argument to Universal Payload build script
Guo Dong [Sun, 10 Apr 2022 20:45:58 +0000 (13:45 -0700)]
UefiPayloadPkg: Add --quiet argument to Universal Payload build script

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2 years agoUefiPayloadPkg: Add dependency of VariableSmm driver.
Li, Zhihao [Tue, 29 Mar 2022 07:12:01 +0000 (00:12 -0700)]
UefiPayloadPkg: Add dependency of VariableSmm driver.

REF? https://bugzilla.tianocore.org/show_bug.cgi?id=3882

UefiCpuPkg define a new Protocol with the new services
SmmWaitForAllProcessor(), which can be used by SMI handler
to optionally wait for other APs to complete SMM rendezvous in
relaxed AP mode.

VariableSmm driver need use SmmCpuRendezvousLib, So add
SmmCpuRendezvousLib dependency in UefiPayloadPkg which use
VariableSmm driver.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Zhihao Li <zhihao.li@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2 years agoUefiPayloadPkg: Support IA32 Build
Guo Dong [Tue, 29 Mar 2022 17:35:36 +0000 (10:35 -0700)]
UefiPayloadPkg: Support IA32 Build

The payload entry module should support to build as IA32 image
beside X64 image so that it could work with 32bit bootloaders.

This patch adds a option build parameter for arch selection.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2 years agoUefiPayloadPkg: Fix PciHostBridgeLib
Lean Sheng Tan [Wed, 30 Mar 2022 18:29:02 +0000 (11:29 -0700)]
UefiPayloadPkg: Fix PciHostBridgeLib

Don't assume a 64bit register always holds an address greater than 4GB.
Check the value in the register and decide which Aperature it should be
assigned to.

Fixes assertion
"ASSERT [PciHostBridgeDxe] Bridge->MemAbove4G.Base >= 0x0000000100000000ULL".

Tested with coreboot as bootloader on platforms that have PCI resource
above 4GiB and on platforms that don't have resource above 4GiB.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-by Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2 years agoBaseTools: Scripts/efi_lldb.py: Add lldb EFI commands and pretty Print
Rebecca Cran [Mon, 21 Mar 2022 20:20:48 +0000 (04:20 +0800)]
BaseTools: Scripts/efi_lldb.py: Add lldb EFI commands and pretty Print

https://bugzilla.tianocore.org/show_bug.cgi?id=3500

Use efi_debugging.py Python Classes to implement EFI gdb commands:
efi_symbols, guid, table, hob, and devicepath

You can attach to any standard gdb or kdp remote server and get EFI
symbols. No modifications of EFI are required.

Example usage:
OvmfPkg/build.sh qemu -gdb tcp::9000
lldb -o "gdb-remote localhost:9000" -o "command script import efi_lldb.py"
Note you may also have to teach lldb about QEMU:
-o "settings set plugin.process.gdb-remote.target-definition-file
 x86_64_target_definition.py"

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoBaseTools: Scripts/efi_gdb.py: Add gdb EFI commands and pretty Print
Rebecca Cran [Mon, 21 Mar 2022 20:20:47 +0000 (04:20 +0800)]
BaseTools: Scripts/efi_gdb.py: Add gdb EFI commands and pretty Print

https://bugzilla.tianocore.org/show_bug.cgi?id=3500

Use efi_debugging.py Python Classes to implement EFI gdb commands:
(gdb) help efi
Commands for debugging EFI. efi <cmd>

List of efi subcommands:

efi devicepath -- Display an EFI device path.
efi guid -- Display info about EFI GUID's.
efi hob -- Dump EFI HOBs. Type 'hob -h' for more info.
efi symbols -- Load Symbols for EFI. Type 'efi_symbols -h' for more info.
efi table -- Dump EFI System Tables. Type 'table -h' for more info.

This module is coded against a generic gdb remote serial stub. It should
work with QEMU, JTAG debugger, or a generic EFI gdb remote serial stub.
No modifications of EFI is required to load symbols.

Example usage:
OvmfPkg/build.sh qemu -gdb tcp::9000
gdb -ex "target remote localhost:9000" -ex "source efi_gdb.py"

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoBaseTools: efi_debugging.py: Add debugger agnostic dbg Python Classes
Rebecca Cran [Mon, 21 Mar 2022 20:20:46 +0000 (04:20 +0800)]
BaseTools: efi_debugging.py: Add debugger agnostic dbg Python Classes

Add Scripts/efi_debugging.py to provide debugger agnostic debugging
utility Python classes.

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoMdeModulePkg/HiiDatabase: Fix Setup numeric default value incorrect issue
Chen, Lin Z [Fri, 1 Apr 2022 06:09:05 +0000 (14:09 +0800)]
MdeModulePkg/HiiDatabase: Fix Setup numeric default value incorrect issue

When default/manufacturing flag get removed from numeric varid, it can't
get default value from StructurePcd in 'UpdateDefaultSettingInFormPackage'
function since there is no EFI_IFR_DEFAULT_OP opcode in IFR file. Add a
chance to get numeric default value from StructurePcd in the case that
numeric minimum value will be used as default value.

Signed-off-by: Chen Lin Z <lin.z.chen@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoPrmPkg: Apply uncrustify changes
Michael Kubacki [Tue, 15 Mar 2022 18:46:34 +0000 (14:46 -0400)]
PrmPkg: Apply uncrustify changes

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in PrmPkg.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Changes for edk2 repo transition
Michael Kubacki [Tue, 18 Jan 2022 21:54:51 +0000 (16:54 -0500)]
PrmPkg: Changes for edk2 repo transition

Updates the Readme.md files to remove information that was specific
to the package in edk2-staging and adds key definitions being added
for PRM support in the ACPI Specification.

Adds PrmPkg/PrmPkg.ci.yaml to support CI.

Adds PrmPkg to .pytool/CISettings.py.

Adds PrmPkg maintainers to Maintainers.txt.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoReadme.md: Add a link to PRM Specification
Michael Kubacki [Tue, 13 Apr 2021 22:21:22 +0000 (15:21 -0700)]
Readme.md: Add a link to PRM Specification

Adds a link to the PRM Specification now that it is available on uefi.org.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Remove the concept of OS services
Michael Kubacki [Tue, 17 Nov 2020 17:37:25 +0000 (09:37 -0800)]
PrmPkg: Remove the concept of OS services

OS services are no longer supported as of the current PRM design.

1. Removes OS services from PrmSampleHardwareAccessModule
2. Removes the PrmOsServices.h file

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/Samples: Remove PrmSamplePrintModule
Michael Kubacki [Tue, 17 Nov 2020 18:45:32 +0000 (10:45 -0800)]
PrmPkg/Samples: Remove PrmSamplePrintModule

This sample module is removed since it directly depends on OS
services which are no longer supported as of the current PRM
design.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/Samples: Remove PrmSampleMemoryAllocationModule
Michael Kubacki [Tue, 17 Nov 2020 18:36:10 +0000 (10:36 -0800)]
PrmPkg/Samples: Remove PrmSampleMemoryAllocationModule

Removes PrmSampleMemoryAllocationModule since the module depends
upon the deprecated concept of OS services.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Replace PcdPrmPlatformGuid with EDKII_DSC_PLATFORM_GUID
Michael Kubacki [Mon, 12 Oct 2020 15:23:44 +0000 (08:23 -0700)]
PrmPkg: Replace PcdPrmPlatformGuid with EDKII_DSC_PLATFORM_GUID

Bugzilla request https://bugzilla.tianocore.org/show_bug.cgi?id=2969
was recently completed which causes the PLATFORM_GUID value from the
DSC file to be placed into Autogen file .c & .h files. With this
change, the PRM Platform GUID can be directly matched to the DSC
PLATFORM_GUID value.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoReadme.md: Add iASL note and QEMU sample link
Michael Kubacki [Wed, 9 Sep 2020 23:47:09 +0000 (16:47 -0700)]
Readme.md: Add iASL note and QEMU sample link

Adds a note that the build now depends on an ASL compiler supporting
PlatformRtMechanism by default. The minimum iASL version supported
is noted in addition to an alternative to remove the code that
requires the new OperationRegion.

Also, a link is provided to an example of how to integrate the
package into a platform using QEMU/OvmfPkg as the sample platform
and firmware.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Update PRM OpRegion
Liu Yun Y [Tue, 8 Sep 2020 06:57:18 +0000 (14:57 +0800)]
PrmPkg: Update PRM OpRegion

1. Enable new PRM OpRegion structure
2. Add PRM Handler Update Lock/Unlock support

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Liu Yun <yun.y.liu@intel.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Add PlatformGuid
Michael Kubacki [Mon, 29 Jun 2020 22:54:01 +0000 (15:54 -0700)]
PrmPkg: Add PlatformGuid

Adds a "platform GUID" field to the PRM ACPI table. This field
is used by a platform to uniquely identify itself such that it
can be targeted by runtime PRM module updates for that platform.

Platforms using PRM are currently required to set a unique value
for gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid in their platform
DSC.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/DxePrmModuleDiscoveryLib: Add initial host-based unit tests
Michael Kubacki [Wed, 17 Jun 2020 19:09:54 +0000 (12:09 -0700)]
PrmPkg/DxePrmModuleDiscoveryLib: Add initial host-based unit tests

Adds host-based unit tests for DxePrmModuleDiscoveryLib. This is
an initial set of support, more tests should be added in the
future.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/Library/DxePrmContextBufferLib: Add host-based unit tests
Michael Kubacki [Tue, 16 Jun 2020 04:56:48 +0000 (21:56 -0700)]
PrmPkg/Library/DxePrmContextBufferLib: Add host-based unit tests

Adds host-based unit tests for DxePrmContextBufferLib. This tests
each function in DxePrmContextBufferLib.

Any changes to DxePrmContextBufferLib moving forward must pass the unit
tests. The unit tests should be updated as needed if the library API
changes.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/Test/UnitTest/Library: Add initial UEFI Boot Services test lib
Michael Kubacki [Tue, 16 Jun 2020 05:18:18 +0000 (22:18 -0700)]
PrmPkg/Test/UnitTest/Library: Add initial UEFI Boot Services test lib

Adds a host-based specific implementation of UefiBootServicesTableLib.
This library implements relatively simple versions of the functionality
in the actual boot services implementation and does not depend on
dynamic linking to the boot services table.

Most unit tests can install the dependencies their code under test
depends on prior to invocation and uninstall those dependencies after
the test to test code that directly depends on boot services.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/Test/PrmPkgHostTest.dsc: Add initial file
Michael Kubacki [Tue, 16 Jun 2020 04:55:07 +0000 (21:55 -0700)]
PrmPkg/Test/PrmPkgHostTest.dsc: Add initial file

Adds a new DSC file that will be used to build host-based unit tests
in PrmPkg.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Enforce stricter types
Michael Kubacki [Tue, 16 Jun 2020 16:32:38 +0000 (09:32 -0700)]
PrmPkg: Enforce stricter types

Makes the following changes to enforce stricter types:

1. PrmPkg/PrmConfigDxe

   The function PrmConfigEndOfDxeNotification () is used as a notify
   function (of type EFI_EVENT_NOTIFY), however it has a return type
   of EFI_STATUS whereas the return type should actually be VOID.

2. PrmPkg/PrmLoaderDxe

   Updates the following types to be more accurate than were allowed
   in the VS compiler:
   * 3rd actual argument given to GetModuleContextBuffers () is
     explicitly marked as CONST PRM_MODULE_CONTEXT_BUFFERS **

   * 3rd actual argument given to GetContextBuffer () is
     explicitly marked as CONST PRM_CONTEXT_BUFFER **

   * PrmLoaderEndOfDxeNotification () return type is changed to VOID
     to align with the EFI_EVENT_NOTIFY type

3. PrmPkg/Application/PrmInfo

   Updates the following types to be more accurate than were allowed
   in the VS compiler:
   * SHELL_STATUS in ParseParameterList () is now EFI_STATUS

   * 3rd actual argument given to GetModuleContextBuffers () is
     explicitly marked as CONST PRM_MODULE_CONTEXT_BUFFERS **

   * 3rd actual argument given to GetContextBuffer () is
     explicitly marked as CONST PRM_CONTEXT_BUFFER **

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/Application/PrmInfo: Add initial application
Michael Kubacki [Wed, 10 Jun 2020 18:06:07 +0000 (11:06 -0700)]
PrmPkg/Application/PrmInfo: Add initial application

Adds a new UEFI application called "PrmInfo" that allows a user
to display and test Platform Runtime Mechanism (PRM) modules.

Execute the application help command for detailed usage
instructions and examples of how to use the application:
  "PrmInfo -?"

This application is intended to be helpful during PRM enabling
by allowing the user to:

1. Confirm that their firmware port of the PRM infrastructure
   implemented in this package is functioning correctly.

2. Quickly get information about what PRM modules and handlers
   are present on a given system.

3. Quickly test PRM handlers without booting to a fully featured
   operating system.

4. Develop and exercise PRM handlers prior to the availability of
   an operating system that is PRM aware.

Adds a brief section to Readme.md about the PrmInfo UEFI application
with a link to allow the reader to find more information about the
application if interested.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Refactor some PrmLoaderDxe functionality into libraries
Michael Kubacki [Fri, 12 Jun 2020 21:24:46 +0000 (14:24 -0700)]
PrmPkg: Refactor some PrmLoaderDxe functionality into libraries

This change breaks out two sets of responsibilities in
PrmLoaderDxe into libraries:
  * PE/COFF functions -> PrmPeCoffLib
  * PRM module discovery functions -> PrmModuleDiscoveryLib

This is core infrastructure code for PRM functionality that needs
to be directly reused and tested in other places. At this time,
the primary motivating factor is to use this code in two other
locations:
  1.) Link the functionality into unit testing modules
  2.) Link the functionality into a PRM UEFI application

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/Samples/Readme.md: Add initial file
Michael Kubacki [Fri, 12 Jun 2020 18:34:41 +0000 (11:34 -0700)]
PrmPkg/Samples/Readme.md: Add initial file

Adds a Readme.md file for the Samples to help a user get started
building and using the PRM sample modules.

Includes a reference to the Samples/Readme.md file in the top-level
file to help make the reader aware the file exists.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/HardwareAccessModuleConfigLib: Add initial library
Michael Kubacki [Thu, 11 Jun 2020 00:28:55 +0000 (17:28 -0700)]
PrmPkg/HardwareAccessModuleConfigLib: Add initial library

Adds a PRM module configuration library for PrmSampleHardwareAccessModule
that demonstrates marking a runtime MMIO range. In the case of this
sample module, the range used is for HPET.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/SampleAcpiParameterBufferModule: Add initial module
Michael Kubacki [Wed, 10 Jun 2020 23:55:02 +0000 (16:55 -0700)]
PrmPkg/SampleAcpiParameterBufferModule: Add initial module

Adds a new PRM module called SampleAcpiParameterBufferModule that
demonstrates how a PRM module can use an ACPI parameter buffer with
a PRM handler.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/PrmSampleHardwareAccessModule: Add non-print PRM handlers
Michael Kubacki [Wed, 10 Jun 2020 23:28:30 +0000 (16:28 -0700)]
PrmPkg/PrmSampleHardwareAccessModule: Add non-print PRM handlers

For each PRM handler that is currently present, a corresponding PRM
handler is added that does not print. This allows a caller to execute
a sample hardware access PRM handler without requiring that caller to
provide a debug print service.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/PrmSampleContextBufferModule: Remove OS debug print requirement
Michael Kubacki [Tue, 9 Jun 2020 16:44:25 +0000 (09:44 -0700)]
PrmPkg/PrmSampleContextBufferModule: Remove OS debug print requirement

Removes the expectation that the parameter buffer contain an OS
debug print service at the beginning of the buffer. All supporting
code related to printing is also removed.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/PrmLoaderDxe: Add ACPI parameter buffer support
Michael Kubacki [Mon, 8 Jun 2020 23:59:01 +0000 (16:59 -0700)]
PrmPkg/PrmLoaderDxe: Add ACPI parameter buffer support

Adds support to PrmLoaderDxe to move the ACPI parameter buffer
address for a given PRM handler to the corresponding field
in the PRM handler information structure (PRMT ACPI table).

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/PrmContextBuffer.h: Add ACPI parameter support structures
Michael Kubacki [Mon, 8 Jun 2020 23:32:34 +0000 (16:32 -0700)]
PrmPkg/PrmContextBuffer.h: Add ACPI parameter support structures

Adds a new type ACPI_PARAMETER_BUFFER_DESCRIPTOR that can be
used by PRM module configuration code to associate a PRM handler
GUID with an ACPI parameter buffer allocated by the PRM module
configuration code.

The ACPI parameter buffer descriptors for a given PRM module
are tracked in the firmware internal structure
PRM_MODULE_CONTEXT_BUFFERS produced by the module configuration
code.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Remove ALLOCATE_CONTEXT_BUFFER_IN_FW build flag
Michael Kubacki [Mon, 8 Jun 2020 18:06:44 +0000 (11:06 -0700)]
PrmPkg: Remove ALLOCATE_CONTEXT_BUFFER_IN_FW build flag

The POR is firmly to use an OS allocated context buffer now so the
build flag that allows firmware to allocate the context buffer
is removed along with supporting code.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Remove PRM Module Update Lock
Michael Kubacki [Wed, 27 May 2020 19:47:00 +0000 (12:47 -0700)]
PrmPkg: Remove PRM Module Update Lock

Per latest design direction, we've abandoned treating the PRM Module
Update Lock as an exported object. There was concern sharing the PRM
module address space (where the lock structure resided in a data section)
with the OS kernel mode driver. The lock will now be entirely maintained
in OS context with interaces to control the lock available to ASL
(for _DSM invocation) and OS native code (for direct call).

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Add initial PrmSsdtInstallDxe module
Michael Kubacki [Wed, 20 May 2020 17:56:03 +0000 (10:56 -0700)]
PrmPkg: Add initial PrmSsdtInstallDxe module

Adds a new module that installs a PRM SSDT.

Note: A library class would allow a high degree of flexibility for
platforms that choose:
  1. To not install a PRM SSDT at all (using a NULL library instance)
  2. To install a specific PRM SSDT implementation

However, it is implemented as a driver since build tools are not
linking ACPI tables to drivers from linked library classes.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Export major/minor version in PRM module PE COFF header
Liu [Thu, 7 May 2020 06:48:07 +0000 (14:48 +0800)]
PrmPkg: Export major/minor version in PRM module PE COFF header

PRMT ACPI defined major version and minor version for each PRM module.

PRM module will build its major/minor version in its PE COFF header.
In boot time, PRM loader will collect the major/minor version from PE COFF
header and fill them into PRMT ACPI table.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Liu Yun <yun.y.liu@intel.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Publish PRM operation region to support PRM ACPI _DSM invocation
Liu [Thu, 7 May 2020 06:42:03 +0000 (14:42 +0800)]
PrmPkg: Publish PRM operation region to support PRM ACPI _DSM invocation

A PRM Handler has a 1-to-1 mapping to the corresponding _DSM method.
The UUID of the _DSM Method will be passed by the ASL code to the
OpRegionHandler which will look up the PRMT Table to extract the
pointer of the corresponding PRM Handler.

PRM loader pre-builds an SSDT that includes this PRM operation region.
In boot time, the PRM loader will load and publish this SSDT, so that
in OS runtime ACPI _DSM can invoke the PRM handler by pass the UUID to
PRM operation region.

The pre-build SSDT also includes a PRMT device as a Sample ACPI _DSM to
invoke PRM handler.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Liu Yun <yun.y.liu@intel.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Enable variable growth for the PRM_MODULE_EXPORT macro
Michael Kubacki [Thu, 23 Apr 2020 01:06:23 +0000 (18:06 -0700)]
PrmPkg: Enable variable growth for the PRM_MODULE_EXPORT macro

The PRM_MODULE_EXPORT parameterized macro allows a caller to produce
a static PRM module export descriptor structure in the binary by
simply passing PRM_HANDLER_EXPORT_ENTRY arguments with each argument
representing a PRM handler to be exported by the module.

Previously, the PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT used in the
PRM_MODULE_EXPORT macro was fixed to a maximum of three handlers.

This change removes that restriction and allows the structure to
grow based on the number of PRM handlers given to the macro. This
means a local type will be customized per PRM module. The reference
type PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT keeps a field at the end
that allows array access to PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT
members.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Add ALLOCATE_CONTEXT_BUFFER_IN_FW build option
Michael Kubacki [Mon, 13 Apr 2020 23:38:19 +0000 (16:38 -0700)]
PrmPkg: Add ALLOCATE_CONTEXT_BUFFER_IN_FW build option

There's currently two approaches being considered for how to allocate the
context buffer passed to PRM handlers:

1. The context buffer is allocated and populated in firmware. As such, the
   FW converts all pointers internal to the buffer to virtual memory
   addresses at the virtual address change event. A single context buffer
   pointer is given to the OS via the PRM ACPI table and the OS converts
   this single physical address to a virtual address when it passes the
   context buffer as a pointer to PRM handlers.

2. The context buffer is allocated and populated in the OS. The OS gets
   all the information needed to populate the context buffer from other
   pre-existing resources (mainly physical addresses in the PRM ACPI
   table). The OS converts all the physical addresses to virtual addresses,
   allocates the context buffer instances, and fills in the information.
   The OS passes the context buffer virtual address to PRM handlers.

The prior behavior was (1). The current POR behavior has moved to (2).
Until (2) is used more widely, it can be kept around with fairly minimal
overhead via a build flag in a few places.

So the default behavior is now (2) (the expected permanent behavior) with
(1) easily enabled by defining "ALLOCATE_CONTEXT_BUFFER_IN_FW" in the
compiler defined macros. A DSC define was added in PrmPkg.dsc to set this
compiler macro in the package  build.

At some point in the future, all code (and some peripheral code)
surrounded with this build flag can be removed if (2) is fully
decided upon.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoReadme.md: Add initial content
Michael Kubacki [Thu, 9 Apr 2020 23:59:25 +0000 (16:59 -0700)]
Readme.md: Add initial content

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3812

Adds the following content to Readme.md:

1. A basic explanation of how the package is organized and where to
   find important items.

2. Adds instructions for building PrmPkg with edk2.

3. Adds a "Build Flags" section to the build instructions to explain
   any build flags that may be passed to influence the build.

   The final package will not have any build flags. A reasonable
   number are temporarily used to test different flows until final
   decisions are made as to which flow to keep.

   Most notably, only Visual Studio tool chains are currently
   supported due to the modifications made to support export tables.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Add initial package DSC file
Michael Kubacki [Tue, 7 Apr 2020 18:34:47 +0000 (11:34 -0700)]
PrmPkg: Add initial package DSC file

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3812

Adds the PrmPkg DSC file so all of the contents can be built as a
stand-alone package.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Add initial PrmSampleContextBufferModule
Michael Kubacki [Tue, 7 Apr 2020 18:33:23 +0000 (11:33 -0700)]
PrmPkg: Add initial PrmSampleContextBufferModule

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3812

Adds a sample PRM module that demonstrates:
  1. How to write a PRM module
  2. How to use a basic PRM OS services
  3. How to use a basic PRM module configuration library
  4. How to use a context buffer during PRM handler execution

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Add initial PrmSampleHardwareAccessModule
Michael Kubacki [Tue, 7 Apr 2020 18:31:15 +0000 (11:31 -0700)]
PrmPkg: Add initial PrmSampleHardwareAccessModule

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3812

Adds a sample PRM module that demonstrates:
  1. How to write a PRM module
  2. How to use multiple PRM handlers in a module
  3. How to use a basic PRM OS service
  4. MSR access at OS runtime

Note: This module contains a PRM handler to read from the HPET MMIO
      range but the memory map changes needed for this to succeed
      are currently not implemented. These will be implemented in a
      future change.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Add initial PrmSampleMemoryAllocationModule
Michael Kubacki [Tue, 7 Apr 2020 18:30:21 +0000 (11:30 -0700)]
PrmPkg: Add initial PrmSampleMemoryAllocationModule

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3812

DEPRECATED: This module is no longer relevant since OS Services that
allow memory allocation have been removed. It is still present in the
source tree in the event dynamic memory allocation at OS runtime is
needed again.

  Adds a sample PRM module that demonstrates:
  1. How to write a PRM module
  2. How to use a basic PRM OS service
  3. How to dynamically allocate memory at OS runtime

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Add initial PrmSamplePrintModule
Michael Kubacki [Tue, 7 Apr 2020 18:28:36 +0000 (11:28 -0700)]
PrmPkg: Add initial PrmSamplePrintModule

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3812

Adds a simple sample PRM module that demonstrates:
  1. How to write a PRM module
  2. How to use multiple PRM handlers in a module
  3. How to use a basic PRM OS service

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/PrmConfigDxe: Add initial driver
Michael Kubacki [Tue, 7 Apr 2020 18:23:22 +0000 (11:23 -0700)]
PrmPkg/PrmConfigDxe: Add initial driver

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3812

This driver serves as a generic PRM configuration driver. Its primary
role is to prepare PRM resources published by PRM module configuration
libraries for OS runtime. As such, it locates all PRM Configuration
Protocol instances and consumes the information to ready those resources.

For example, set runtime memory attributes on MMIO ranges and convert
physical addresses to virtual addresses in PRM buffers.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg/PrmContextBufferLib: Add initial library instance
Michael Kubacki [Tue, 7 Apr 2020 18:19:49 +0000 (11:19 -0700)]
PrmPkg/PrmContextBufferLib: Add initial library instance

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3812

This library is introduced to add  a general abstraction for PRM context
buffer management.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Add PrmConfig protocol interface
Michael Kubacki [Tue, 7 Apr 2020 18:17:43 +0000 (11:17 -0700)]
PrmPkg: Add PrmConfig protocol interface

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3812

The PRM Configuration protocol is used by PRM module configuration
libraries to describe their resources so that a generic PRM Configuration
DXE driver can prepare those resources for OS runtime.

Therefore, multiple instances are expected in the system per boot with
approximately one instance per PRM module. All PRM Configuration Protocol
instances must be installed prior to end of DXE.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoPrmPkg: Add package and include headers
Michael Kubacki [Tue, 7 Apr 2020 18:00:28 +0000 (11:00 -0700)]
PrmPkg: Add package and include headers

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3812

Adds a new package to maintain Platform Runtime Mechanism (PRM)
support.

This package is intended to include generic code that provides a
common infrastructure to support PRM in firmware and a collection
of sample PRM modules that demonstrate how to use the interfaces
and other package resources to author a PRM module.

The following initial headers are included in this commit:

* Prm.h - Includes common content for PRM with no dependencies on
  other PRM header files.

* PrmContextBuffer.h - Includes definitions for PRM context buffers.

  Context buffers are standardized structures that point to various
  resources available to a PRM handler during its execution.

* PrmDataBuffer.h - Includes definitions for PRM data buffers.

  Within the context of PRM, these data buffers are composed of a
  generic header followed by a variable length blob of arbitrary
  data.

* PrmExportDescriptor.h - Includes definitions for  creating PRM
  export descriptors.

  A PRM export descriptor is a structure referenced in the export
  table of PRM module that contains PRM-specific metadata about the
  module.

* PrmMmio.h - Includes definitions for describing MMIO ranges uses
  by PRM modules.

* PrmModule.h - Includes definitions commonly used by PRM module
  authors.

  This file is provided to serve as a convenient include for PRM
  module authors.

* PrmOsServices.h - Includes content specific to PRM OS services.

  OS Services will not planned to be present in the final version
  of PRM. The OS Services have been reduced to a simple debug print
  function. So this is currently planned to be a temporary file to
  support debugging during PRM development.

Note: Modules built for the UEFI environment can be built by Visual
      Studio and non-Visual Studio toolchains. However, PRM modules
      are currently only supported on Visual Studio toolchain due to
      usage of export tables.

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2 years agoOvmfPkg: Do not check VbeShim.h formatting with Uncrustify
Michael Kubacki [Mon, 21 Mar 2022 20:13:31 +0000 (16:13 -0400)]
OvmfPkg: Do not check VbeShim.h formatting with Uncrustify

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3875

The following files:
  OvmfPkg/Bhyve/BhyveRfbDxe/VbeShim.h
  OvmfPkg/QemuVideoDxe/VbeShim.h

Are auto generated by the following generators:
  OvmfPkg/Bhyve/BhyveRfbDxe/VbeShim.sh
  OvmfPkg/QemuVideoDxe/VbeShim.sh

Therefore, Uncrustify causes a file update to produce a very large
diff due to formatting changes.

This change does the following:
  1. Reverts the Uncrustify changes applied to the files in commit
     ac0a286f4d74.
  2. Uses a new UncrustifyCheck CI plugin configuration option to
     exclude the files from future formatting checks.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2 years agoOvmfPkg: Revert Uncrustify formatting in VbeShim.h files
Michael Kubacki [Mon, 21 Mar 2022 20:49:20 +0000 (16:49 -0400)]
OvmfPkg: Revert Uncrustify formatting in VbeShim.h files

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3875

Reverts changes automatically applied by Uncrustify in commit
ac0a286.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>