]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
19 months agoBaseTools: Fix DevicePath GNUmakefile for macOS edk2-stable202208
Rebecca Cran [Fri, 26 Aug 2022 01:31:46 +0000 (09:31 +0800)]
BaseTools: Fix DevicePath GNUmakefile for macOS

On macOS, /usr/bin/gcc is clang, and so doesn't have
the -Wno-error=stringop-overflow flag that was added
for gcc 12.
Update the GNUmakefile for DevicePath to skip setting
that on macOS.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
19 months agoRevert "BaseTools: Fix DSC LibraryClass precedence rule"
Liming Gao [Fri, 26 Aug 2022 02:06:20 +0000 (10:06 +0800)]
Revert "BaseTools: Fix DSC LibraryClass precedence rule"

This reverts commit 039bdb4d3e96f9c9264abf135b8a0eef2e2b4860 for tag202208.
This brings the behavior changes, and needs more discussion.

Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Bob Feng <bob.c.feng@intel.com>
19 months agoRevert "ShellPkg: Adds Local APIC parser to AcpiView"
Liming Gao [Fri, 26 Aug 2022 02:06:01 +0000 (10:06 +0800)]
Revert "ShellPkg: Adds Local APIC parser to AcpiView"

This reverts commit d5fd86f256b9ab5b4e3aff70d3c177c18faea892 for tag202208.
This feature will be merged after stable tag 202208 is created.

Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
19 months agoRevert "UefiCpuPkg/CpuPageTableLib/UnitTest: Add host based unit test"
Liming Gao [Fri, 26 Aug 2022 02:05:50 +0000 (10:05 +0800)]
Revert "UefiCpuPkg/CpuPageTableLib/UnitTest: Add host based unit test"

This reverts commit 2812668bfc121ee792cf3302195176ef4a2ad0bc for tag202208.
This feature will be merged after stable tag 202208 is created.

Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
19 months agoMaintainers.txt: Update maintainers list
Abner Chang [Thu, 25 Aug 2022 10:33:36 +0000 (18:33 +0800)]
Maintainers.txt: Update maintainers list

Update package maintainers for below package/arch,

1. RISCV64 Architecture:
   Abner is stepping out from RISC-V stuff for now and hand over edk2 RISC-V
   responsibilities to Sunil.
   Daniel Schaefer is no longer with HPE. Update his email address for
   RISCV64 arch. He will keep helping on RISC-V stuff with his personal
   email.

2. EmbeddedPkg:
   Daniel Schaefer is no longer with HPE. Update his email address for
   EmbeddedPkg.

3. EmulatorPkg and RedfishPkg:
   Nickle Wang is no longer with HPE. Update his email address for
   EmulatorPkg and RedfishPkg packages. He will use the personal email for
   the time being until he gets ready with his next journey.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Cc: Nickle Wang <nickle@csie.io>
Reviewed-by: Daniel Schaefer <git@danielschaefer.me>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Nickle Wang <nickle@csie.io>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
19 months agoShellPkg: Add revision check for DSDT Header on Arm
Edward Pickup [Wed, 20 Jul 2022 08:59:49 +0000 (16:59 +0800)]
ShellPkg: Add revision check for DSDT Header on Arm

Bugzilla: 3995 (https://bugzilla.tianocore.org/show_bug.cgi?id=3995)

ACPI 6.4 spec states that if the revision field in the DSDT header is less
than 2, then all integers are restricted in width to 32 bits, including in
SSDTs.

Arm Base boot requirements state that platforms must conform to ACPI 6.3
or later, and that legacy tables are not supported.

Adds a check for this field and raise warning if revision is less
than 2 on arm.

Signed-off-by: Edward Pickup <edward.pickup@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
19 months agoUefiPayloadPkg: Fix Coverity report defect
James Lu [Tue, 23 Aug 2022 03:13:55 +0000 (11:13 +0800)]
UefiPayloadPkg: Fix Coverity report defect

https://bugzilla.tianocore.org/show_bug.cgi?id=4018
Coverity report FORWARD_NULL and OVERFLOW_BEFORE_WIDEN potential defect
in UefiPayloadPkg.

Signed-off-by: Gregx Yeh <gregx.yeh@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: James Lu <james.lu@intel.com>
19 months agoRedfishPkg: Redfish functions for REST requests are not fully spec complied
Abner Chang [Tue, 23 Aug 2022 02:09:37 +0000 (10:09 +0800)]
RedfishPkg: Redfish functions for REST requests are not fully spec complied

There is no function to send POST request with the
ContentType different from "application\json".
There is no function to send DELETE request with the body.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Signed-off-by: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
19 months agoRedfishPkg: Redfish modules may need to use the functions which are private
Abner Chang [Wed, 17 Aug 2022 03:28:25 +0000 (11:28 +0800)]
RedfishPkg: Redfish modules may need to use the functions which are private

Definitions of the required functions to send requests to BMC
are in the PrivateInclude folder. So they cannot be used by
the other Redfish packages.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Signed-off-by: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
19 months agoRedfishPkg/RedfishDiscoverDxe: USB Redfish host interface is not supported
Abner Chang [Mon, 15 Aug 2022 01:47:30 +0000 (09:47 +0800)]
RedfishPkg/RedfishDiscoverDxe: USB Redfish host interface is not supported

Host Interface details are described by the SMBIOS Type 42
table. The table is published by the RedfishHostInterfaceDxe
driver. That driver supports PCI-E and USB host interface
types.The table is consumed by the edfishGetHostInterfaceProtocolData
function in the RedfishDiscoverDxe driver. The function only supports
PCI-E host interface type.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Signed-off-by: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
19 months agoUefiPayloadPkg: Add macro to control NvmExpressDxe
Kavya [Mon, 22 Aug 2022 13:50:15 +0000 (19:20 +0530)]
UefiPayloadPkg: Add macro to control NvmExpressDxe

Add NVME_ENABLE macro to control NvmExpressDxe driver.

Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Signed-off-by: Kavya <k.kavyax.sravanthi@intel.com>
19 months agoUefiPayloadPkg: Return PciRootBridges instead of NULL
Kavya [Mon, 22 Aug 2022 13:19:30 +0000 (18:49 +0530)]
UefiPayloadPkg: Return PciRootBridges instead of NULL

Return PciRootBridges instead of NULL and set
PcdPciDisableBusEnumeration to FALSE when
root bridge count is zero.

Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Signed-off-by: Kavya <k.kavyax.sravanthi@intel.com>
19 months agoShellPkg: Adds Local APIC parser to AcpiView
Abdul Lateef Attar [Tue, 9 Aug 2022 06:49:10 +0000 (14:49 +0800)]
ShellPkg: Adds Local APIC parser to AcpiView

Parse Type 0 or Local APIC structure.
Also parse the Local APIC Flags as bitfields.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Abdul Lateef Attar <abdattar@amd.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
20 months agoBaseTools/Source/C/GenSec: Fix EFI_SECTION_FREEFORM_SUBTYPE_GUID header
Michael D Kinney [Tue, 16 Aug 2022 01:15:24 +0000 (18:15 -0700)]
BaseTools/Source/C/GenSec: Fix EFI_SECTION_FREEFORM_SUBTYPE_GUID header

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

When the size of a EFI_SECTION_FREEFORM_SUBTYPE_GUID section required
the use of EFI_FREEFORM_SUBTYPE_GUID_SECTION2 header, set the section
type to EFI_SECTION_FREEFORM_SUBTYPE_GUID.

Cc: Leif Lindholm <llindhol@qti.qualcomm.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Konstantin Aladyshev <aladyshev22@gmail.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: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Leif Lindholm <llindhol@qti.qualcomm.com>
20 months agoMdePkg: Added support for SMBIOS spec v3.6.0 to Smbios.h
Sainadh Nagolu [Wed, 17 Aug 2022 07:38:28 +0000 (13:08 +0530)]
MdePkg: Added support for SMBIOS spec v3.6.0 to Smbios.h

Updated SmBios.h with new fields added as part of SMBIOS 3.6.0 spec update.

Signed-off-by: Sainadh Nagolu <sainadhn@ami.com>
Cc: Vasudevan Sambandan <vasudevans@ami.com>
Cc: Sundaresan S <sundaresans@ami.com>
Reviewed-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
20 months agoShellPkg: Improved Smbios Type 9 table changes in PrintInfo.c
Sainadh Nagolu [Wed, 17 Aug 2022 07:35:23 +0000 (15:35 +0800)]
ShellPkg: Improved Smbios Type 9 table changes in PrintInfo.c

Since PeerGroups has a variable number of entries, new fields added
after PeerGroups are defined in a extended structure.
Done changes in PrintInfo.c to access those fields using
SMBIOS_TABLE_TYPE9_EXTENDED structure from SmBios.h.

Signed-off-by: Sainadh Nagolu <sainadhn@ami.com>
Cc: Vasudevan Sambandan <vasudevans@ami.com>
Cc: Sundaresan S <sundaresans@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
20 months agoMdePkg: Improved Smbios Type9 table and Smbios spec v3.5.0 Changes
Sainadh Nagolu [Wed, 17 Aug 2022 07:35:23 +0000 (15:35 +0800)]
MdePkg: Improved Smbios Type9 table and Smbios spec v3.5.0 Changes

In Type9 structure since PeerGroups has a variable
number of entries, must not define new fields in the structure.So added an
extended structure and defined new fields added after PeerGroups. Also done
some improvements to Smbios 3.5.0 spec changes.

Signed-off-by: Sainadh Nagolu <sainadhn@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
20 months agoMdeModulePkg/DumpDynPcd: Remove unsupported format specifiers
Konstantin Aladyshev [Wed, 27 Jul 2022 08:45:03 +0000 (16:45 +0800)]
MdeModulePkg/DumpDynPcd: Remove unsupported format specifiers

Some print statements use format specifiers like %N/%H/%E/%B that are
only supported in the shell print functions. In the ordinary 'Print'
function they are just displayed as letters N/H/E/B.
Remove these unsupported format specifiers from the 'Print' statements
to fix the issue.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
20 months agoOvmfPkg/VirtioFsDxe: Check GetDriverName arguments
Dimitrije Pavlov [Mon, 15 Aug 2022 16:31:19 +0000 (11:31 -0500)]
OvmfPkg/VirtioFsDxe: Check GetDriverName arguments

The current implementation does not check if Language or DriverName
are NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these pointers
are NULL.

Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
Reviewed-by: Sunny Wang <sunny.wang@arm.com>
20 months agoOvmfPkg/VirtioGpuDxe: Check QueryMode arguments
Dimitrije Pavlov [Tue, 16 Aug 2022 20:28:36 +0000 (15:28 -0500)]
OvmfPkg/VirtioGpuDxe: Check QueryMode arguments

The current implementation does not check if Info or SizeInfo
pointers are NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these
pointers are NULL.

Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
Reviewed-by: Sunny Wang <sunny.wang@arm.com>
20 months agoOvmfPkg/PlatformDxe: Check ExtractConfig and RouteConfig arguments
Dimitrije Pavlov [Tue, 16 Aug 2022 20:28:35 +0000 (15:28 -0500)]
OvmfPkg/PlatformDxe: Check ExtractConfig and RouteConfig arguments

The current implementation does not check if Progress or Results
pointers in ExtractConfig are NULL, or if Progress pointer in
RouteConfig is NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these pointers
are NULL.

Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
Reviewed-by: Sunny Wang <sunny.wang@arm.com>
20 months agoUefiCpuPkg/CpuPageTableLib/UnitTest: Add host based unit test
Zhiguang Liu [Mon, 27 Jun 2022 08:58:48 +0000 (16:58 +0800)]
UefiCpuPkg/CpuPageTableLib/UnitTest: Add host based unit test

Add host based unit tests for the CpuPageTableLib services.

Unit test focuses on PageTableMap function, containing two kinds of test
cases: manual test case and random test case.
Manual test case creates some corner case to test function PageTableMap.
Random test case generates multiple random memory entries (with random
attribute) as the input of function PageTableMap to get the output
pagetable. Output pagetable will be validated and be parsed to get output
memory entries, and then the input and output memory entries will be
compared to verify the functionality.

The unit test is not perfect yet. There are options for random test, and
some of them control the test coverage, and some option are not ready.
Will enhance in the future.

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
20 months agoMdeModulePkg: Update the SMBIOS version by UPL
KasimX Liu [Fri, 5 Aug 2022 08:17:21 +0000 (16:17 +0800)]
MdeModulePkg: Update the SMBIOS version by UPL

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

For the SMBIOS version can be update by UPL,we create
the gUniversalPayloadSmbios3TableGuid HOB to store
the value then updated version.

Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: James Lu <james.lu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Signed-off-by: KasimX Liu <kasimx.liu@intel.com>
20 months agoIntelFsp2Pkg: FSPM_ARCH2_UPD mismatching bug.
Chasel Chiu [Mon, 15 Aug 2022 06:13:01 +0000 (23:13 -0700)]
IntelFsp2Pkg: FSPM_ARCH2_UPD mismatching bug.

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

FSPM_ARCH2_UPD in FspApiEntryM.nasm was not up-to-date and
should be fixed for both IA32 and X64 builds.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
20 months agoUefiPayloadPkg: Remove clearing CR0.WP when protecting pagetable
Dun Tan [Wed, 10 Aug 2022 03:31:57 +0000 (11:31 +0800)]
UefiPayloadPkg: Remove clearing CR0.WP when protecting pagetable

Remove clearing CR0.WP when marking the memory used for page table
as read-only in the page table itself created by UefiPayloadEntry.
This page table address is written to Cr3 after these protection
steps. Till this, the memory used for page table is always RW.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Ray Ni <ray.ni@intel.com>
20 months agoMdeModulePkg/DxeIpl: Remove clearing CR0.WP when protecting pagetable
Dun Tan [Tue, 26 Jul 2022 14:13:40 +0000 (22:13 +0800)]
MdeModulePkg/DxeIpl: Remove clearing CR0.WP when protecting pagetable

Remove clearing CR0.WP when marking the memory used for page table
as read-only in the page table itself created by DxeIpl. This page
table address is written to Cr3 after these protection steps. Till
this, the memory used for page table is always RW.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Ray Ni <ray.ni@intel.com>
20 months agoUefiCpuPkg/PiSmmCpuDxeSmm: Remove mInternalCr3 in PiSmmCpuDxeSmm
Dun Tan [Tue, 9 Aug 2022 07:58:28 +0000 (15:58 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Remove mInternalCr3 in PiSmmCpuDxeSmm

This patch is code refactoring and doesn't change any functionality.
Remove mInternalCr3 in PiSmmCpuDxe pagetable related code. In previous
code, mInternalCr3 is used to pass address of page table which is
different from Cr3 register in different level of SetMemoryAttributes
function. Now remove it and pass the page table base address from the
root function parameter to simplify the code logic.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
20 months agoUefiCpuPkg/PiSmmCpuDxeSmm: Add a new mIsShadowStack flag
Dun Tan [Tue, 9 Aug 2022 07:22:07 +0000 (15:22 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Add a new mIsShadowStack flag

This patch is code refactoring and doesn't change any functionality.
Add a new mIsShadowStack flag to identify whether current memory is
shadow stack. Previous smm code logic regards a RO range as shadow
stack and set the dirty bit in corresponding page table entry if
mInternalCr3 is not 0, which may be confusing.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
20 months agoShellPkg/SmbiosView: Display extended memory info in smbiosview -t 17
Shengfengx Xue [Sat, 6 Aug 2022 02:02:13 +0000 (10:02 +0800)]
ShellPkg/SmbiosView: Display extended memory info in smbiosview -t 17

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

If Configured Memory Speed is 65,535 MT/s or greater,
and the actual speed is stored in the Extended Configured Memory Speed
field. but current Smbiosview have no this logic.

Signed-off-by: Shengfengx Xue <shengfengx.xue@intel.com>
20 months agoMdeModulePkg: Enhance bus scan for all root bridge instances
Foster Nong [Fri, 22 Jul 2022 09:10:26 +0000 (17:10 +0800)]
MdeModulePkg: Enhance bus scan for all root bridge instances

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

Change flow to bus scan all root bridge instances even when any
one root bridge meet bus resource OUT_OF_RESOURCE case.
thus platform handler  of "EfiPciHostBridgeEndBusAllocation" has
an chance to do relative pci bus rebalance to handle this case.

Signed-off-by: Foster Nong <foster.nong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
20 months agoMdePkg/Library/UefiDevicePathLib: Add back StandaloneMm INF file
Michael D Kinney [Wed, 10 Aug 2022 04:22:54 +0000 (21:22 -0700)]
MdePkg/Library/UefiDevicePathLib: Add back StandaloneMm INF file

REF: https://github.com/tianocore/edk2/pull/3130

The above PR removed UefiDevicePathLibStandaloneMm.inf, which is
a non-backwards compatible change and does not provide time for
downstream platforms to use the UefiDevicePathLibBase.inf.

Add UefiDevicePathLibStandaloneMm.inf back, but add comments that
it is deprecated and that UefiDevicePathLibBase.inf should be used
instead.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Mateusz Albecki <mateusz.albecki@intel.com>
Cc: Yanbo Huang <yanbo.huang@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
20 months agoCpuPageTableLib: define IA32_PAGE_LEVEL enum type internally
Ray Ni [Mon, 18 Jul 2022 09:00:29 +0000 (17:00 +0800)]
CpuPageTableLib: define IA32_PAGE_LEVEL enum type internally

The change doesn't change functionality behavior.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
20 months agoCpuPageTableLib: Fix bug that wrongly requires extra size for mapping
Ray Ni [Mon, 18 Jul 2022 08:41:37 +0000 (16:41 +0800)]
CpuPageTableLib: Fix bug that wrongly requires extra size for mapping

With following paging structure to map
  [2M-4K, 2M] as P = 1, RW = 0,
  [2M, 4M]    as P = 1, RW = 1:

PML4[0] -> PDPTE[0] -> PDE[0](RW = 0) -> PTE[255](P = 0, RW = 0)
                    -> PDE[1](RW = 1)

When a new request to map [2M-4K, 2M+4K] as P = 1, RW = 1,
CpuPageTableMap() wrongly requests 4K buffer size for the new mapping
request.

But in fact, for [2M-4K, 2M] request, PTE[255] can be changed in place,
for [2M, 2M+4K], no change is needed because PDE[1].RW = 1 already.

The change fixes the bug.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
20 months agoCpuPageTableLib: Fix a bug to avoid unnecessary changing to page table
Ray Ni [Fri, 15 Jul 2022 12:40:29 +0000 (20:40 +0800)]
CpuPageTableLib: Fix a bug to avoid unnecessary changing to page table

With the following paging structure that maps [0, 2G] with ReadWrite
bit set.
PML4[0] --> PDPTE[0] --> PDE[0-255]
              \-> PDPTE[1] --> PDE[0-255]

If ReadWrite bit is cleared in PML4[0] and PageTableMap() is called
to change [0, 2M] as read-only, today's logic unnecessarily changes
the paging structure in 2 aspects:
1. When setting PageTableBaseAddress in the entry, the code clears
    all attributes.
2. Even the ReadWrite bit in parent entry is not set, the code clears
    the ReadWrite bit in the leaf entry.

First change is wrong. It should not change other attributes when
setting the PA.
Second change is unnecessary. Because the parent entry already
declares the whole region as read-only, there is no need to clear
ReadWrite bit in the leaf entry again.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
20 months agoCpuPageTableLib: Fix parent attributes are not inherited properly
Ray Ni [Fri, 15 Jul 2022 12:10:08 +0000 (20:10 +0800)]
CpuPageTableLib: Fix parent attributes are not inherited properly

With the following paging structure that maps [0, 2G] with ReadWrite
bit set.
PML4[0] --> PDPTE[0] --> PDE[0-255]
              \-> PDPTE[1] --> PDE[0-255]

If ReadWrite bit is cleared in PML4[0] and PageTableMap() is called
to change [0, 2M] as writable, today's logic doesn't inherit the
parent entry's attributes when determining the child entry's
attributes. It just sets the PDPTE[0].PDE[0].ReadWrite bit.
But since the PML4[0].ReadWrite is 0, [0, 2M] is still read-only.

The change fixes the bug.
If the inheritable attributes in ParentPagingEntry conflicts with the
requested attributes, let the child entries take the parent attributes
and loosen the attribute in the parent entry.

E.g.: when PDPTE[0].ReadWrite = 0 but caller wants to map [0-2MB as
ReadWrite = 1 (PDE[0].ReadWrite = 1), we need to change
PDPTE[0].ReadWrite = 1 and let all PDE[0-255].ReadWrite = 0 first.
Then change PDE[0].ReadWrite = 1.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
20 months agoCpuPageTableLib: Avoid treating non-leaf entry as leaf one
Ray Ni [Fri, 15 Jul 2022 07:22:57 +0000 (15:22 +0800)]
CpuPageTableLib: Avoid treating non-leaf entry as leaf one

Today's logic wrongly treats the non-leaf entry as leaf entry and
updates its paging attributes.

The patch fixes the bug to only update paging attributes for
non-present entries or leaf entries.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
20 months agoCpuPageTableLib: Split the page entry when LA is aligned but PA is not
Ray Ni [Thu, 14 Jul 2022 12:08:29 +0000 (20:08 +0800)]
CpuPageTableLib: Split the page entry when LA is aligned but PA is not

When PageTableMap() is called to create non 1:1 mapping
such as [0, 1G) to [8K, 1G+8K), it should split the page entry to the
4K page level, but old logic has a bug that it just uses 1G page
entry.

The patch fixes the bug.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
20 months agoCpuPageTableLib: Refactor the logic
Ray Ni [Thu, 14 Jul 2022 10:00:47 +0000 (18:00 +0800)]
CpuPageTableLib: Refactor the logic

The patch replaces
  LinearAddress + Offset == RegionStart
with
  ((LinearAddress + Offset) & RegionMask) == 0

The replace should not cause any behavior change.

Because:
1. In first loop of while when LinearAddress + Offset == RegionStart,
  because the lower "BitStart" bits of RegionStart are all-zero,
  all lower "BitStart" bits of (LinearAddress + Offset) are all-zero.
  Because all lower "BitStart" bits of RegionMask is all-one and
  bits are all-zero, ((LinearAddress + Offset) & RegionMask) == 0.

2. In following loops of the while, even RegionStart is increased
  by RegionLength, the lower "BitStart" bits are still all-zero.
  So the two expressions still semantically equal to each other.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
20 months agoCpuPageTableLib: Fix a bug when a bit is 1 in Attribute, 0 in Mask
Ray Ni [Thu, 14 Jul 2022 08:03:11 +0000 (16:03 +0800)]
CpuPageTableLib: Fix a bug when a bit is 1 in Attribute, 0 in Mask

To reproduce the issue:
  UINTN               PageTable;
  VOID                *Buffer;
  UINTN               PageTableBufferSize;
  IA32_MAP_ATTRIBUTE  Attribute;
  IA32_MAP_ATTRIBUTE  Mask;
  RETURN_STATUS       Status;

  Attribute.Uint64       = 0;
  Mask.Uint64            = 0;
  PageTableBufferSize    = 0;
  PageTable              = 0;
  Buffer                 = NULL;
  Attribute.Bits.Present = 1;
  Attribute.Bits.Nx      = 1;
  Mask.Bits.Present      = 1;
  Mask.Uint64            = MAX_UINT64;

  //
  // Create page table to cover [0, 10M)
  //
  Status = PageTableMap (
             &PageTable, PagingMode, Buffer, &PageTableBufferSize,
             0, (UINT64)SIZE_2MB * 5, &Attribute, &Mask
             );
  ASSERT (Status == RETURN_BUFFER_TOO_SMALL);
  Buffer = AllocatePages (EFI_SIZE_TO_PAGES (PageTableBufferSize));
  Status = PageTableMap (
             &PageTable, PagingMode, Buffer, &PageTableBufferSize,
             0, (UINT64)SIZE_2MB * 5, &Attribute, &Mask
             );
  ASSERT (Status == RETURN_SUCCESS);

  //
  // Change the mapping for [0, 4KB)
  // No change actually. Just clear Nx bit in Mask.
  //
  Mask.Bits.Nx        = 0;
  PageTableBufferSize = 0;

  Status = PageTableMap (
             &PageTable, PagingMode, NULL, &PageTableBufferSize,
             0, (UINT64)SIZE_4KB, &Attribute, &Mask
             );
  ASSERT (Status == RETURN_SUCCESS); // FAIL!!

The root cause is when comparing the existing mapping attributes
against the requested one, Mask is not used but it should be used.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
20 months agoUefiCpuPkg/CpuPageTableLib: Return error on invalid parameters
Ray Ni [Thu, 14 Jul 2022 07:36:09 +0000 (15:36 +0800)]
UefiCpuPkg/CpuPageTableLib: Return error on invalid parameters

When LinearAddress or Length is not aligned on 4KB, PageTableMap()
should return Invalid Parameter.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
20 months agoUefiCpuPkg: Create CpuPageTableLib for manipulating X86 paging structs
Ray Ni [Thu, 14 Jul 2022 06:33:18 +0000 (14:33 +0800)]
UefiCpuPkg: Create CpuPageTableLib for manipulating X86 paging structs

The lib includes two APIs:
* PageTableMap
  It creates/updates mapping from LA to PA.
  The implementation only supports paging structures used in 64bit
  mode now. PAE paging structure support will be added in future.

* PageTableParse
   It parses the page table and returns the mapping relations in an
  array of IA32_MAP_ENTRY.

It passed some stress tests. These test code will be upstreamed in
other patches following edk2 Unit Test framework.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
20 months agoUefiCpuPkg: Simplify the struct definition of CPU_EXCEPTION_INIT_DATA
Liu, Zhiguang [Tue, 9 Aug 2022 01:25:37 +0000 (09:25 +0800)]
UefiCpuPkg: Simplify the struct definition of CPU_EXCEPTION_INIT_DATA

CPU_EXCEPTION_INIT_DATA is now an internal implementation of
CpuExceptionHandlerLib. Union can be removed since Ia32 and X64 have the
same definition. Also, two fields (Revision and InitDefaultHandlers)are
useless, can be removed.

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
20 months agoMdeModulePkg: Move CPU_EXCEPTION_INIT_DATA to UefiCpuPkg
Liu, Zhiguang [Tue, 9 Aug 2022 01:25:36 +0000 (09:25 +0800)]
MdeModulePkg: Move CPU_EXCEPTION_INIT_DATA to UefiCpuPkg

Since the API InitializeSeparateExceptionStacks is simplified and does't
use the struct CPU_EXCEPTION_INIT_DATA, CPU_EXCEPTION_INIT_DATA become
a inner implementation of CpuExcetionHandlerLib.

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
20 months agoUefiCpuPkg: Simplify InitializeSeparateExceptionStacks
Liu, Zhiguang [Tue, 9 Aug 2022 01:25:35 +0000 (09:25 +0800)]
UefiCpuPkg: Simplify InitializeSeparateExceptionStacks

Hide the Exception implementation details in CpuExcetionHandlerLib and
caller only need to provide buffer

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
20 months agoPrmPkg: Add details on AArch64 build to the Readme.
Jose Marinho [Tue, 26 Jul 2022 16:54:42 +0000 (17:54 +0100)]
PrmPkg: Add details on AArch64 build to the Readme.

Specify how to build the PrmPkg for the AArch64 architecture.
Make the 2 following notes:
 - the PrmPkg has only been tested on AArch64 using the GCC5
toolchain.
 - All symbols to be listed in the PRMT as well as the
PrmModuleExportDescriptor must be explicitly preserved by resorting to
the --require-defined linker flag.

Signed-off-by: Jose Marinho <jose.marinho@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
20 months agoPrmPkg: Support AArch64 builds using GCC
Jose Marinho [Fri, 18 Dec 2020 14:01:55 +0000 (14:01 +0000)]
PrmPkg: Support AArch64 builds using GCC

Add support to build PrmPkg for AArch64 using the GCC compiler.

Add AARCH64 architecture to the list of supported architectures.
Add BaseStackCheck library to allow for Prm module builds on AARCH64.

Also update the CI to add dependency on ArmPkg.

Signed-off-by: Jose Marinho <jose.marinho@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
20 months agoPrmPkg: Build Prm Samples with GCC for AARCH64
Jose Marinho [Tue, 5 Apr 2022 17:57:23 +0000 (18:57 +0100)]
PrmPkg: Build Prm Samples with GCC for AARCH64

- Add the --prm flag to the GENFW_FLAGS
- Add the --no-gc-section to the linker flags so that apparently
unreferenced symbols are not prematurely removed from the .dll which
is used to generate the Prm module .efi.
- Force the linker to maintain the PrmModuleExportDescriptor symbol.
- Force the linker to maintain the PRM handler funtion's symbol.

Signed-off-by: Jose Marinho <jose.marinho@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
20 months agoPrmPkg: Enable external visibility on PRM symbols
Jose Marinho [Tue, 5 Apr 2022 17:53:25 +0000 (18:53 +0100)]
PrmPkg: Enable external visibility on PRM symbols

Enable GCC compilations to keep external symbols when generating a PRM
module.

Signed-off-by: Jose Marinho <jose.marinho@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
20 months agoBasetools/GenFw: Allow AARCH64 builds to use the --prm flag
Jose Marinho [Fri, 29 Oct 2021 16:48:26 +0000 (17:48 +0100)]
Basetools/GenFw: Allow AARCH64 builds to use the --prm flag

The GenFw invocation with the --prm flag was previously reserved for
X64.
AArch64 platforms, built with GCC5, can also deploy PRM modules, hence
the --prm flag is also applicable in builds targeting the AARCH64
architecture.

This commit enables the --prm flag to be used for EDK2 builds targeting
AARCH64.

Signed-off-by: Jose Marinho <jose.marinho@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
20 months agoBaseTools/GenSec: Support EFI_SECTION_FREEFORM_SUBTYPE_GUID sections
Konstantin Aladyshev [Wed, 20 Jul 2022 14:08:12 +0000 (22:08 +0800)]
BaseTools/GenSec: Support EFI_SECTION_FREEFORM_SUBTYPE_GUID sections

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
20 months agoBaseTools/VolInfo: Parse EFI_SECTION_FREEFORM_SUBTYPE_GUID header
Konstantin Aladyshev [Wed, 20 Jul 2022 12:00:39 +0000 (20:00 +0800)]
BaseTools/VolInfo: Parse EFI_SECTION_FREEFORM_SUBTYPE_GUID header

Print 'SubtypeGuid' field from the EFI_FREEFORM_SUBTYPE_GUID_SECTION
structure.
This value describes the raw data inside the section.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Bob Feng<bob.c.feng@intel.com>
20 months agoBaseTools/VolInfo: Show FV section boundaries
Konstantin Aladyshev [Tue, 19 Jul 2022 15:45:52 +0000 (23:45 +0800)]
BaseTools/VolInfo: Show FV section boundaries

Currently there is no labels for start and end of the
EFI_SECTION_FIRMWARE_VOLUME_IMAGE type section. Therefore it is not
possible to see where the FV section ends and another section starts.
Add labels for start and end of the FV sections to fix the issue.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
20 months agoBaseTools/GenSec: Fix typo
Konstantin Aladyshev [Tue, 19 Jul 2022 14:27:10 +0000 (22:27 +0800)]
BaseTools/GenSec: Fix typo

Fix typo in the help message.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
20 months agoDynamicTablesPkg: Fix using RmrNodeCount unitlitialised
Edward Pickup [Thu, 4 Aug 2022 09:20:50 +0000 (10:20 +0100)]
DynamicTablesPkg: Fix using RmrNodeCount unitlitialised

Fix using RmrNodeCount uninitliased by initliasing it to zero. Also, add
an additional check for ACPI version. This fixes a crash running on
kvmtool.

Signed-off-by: Edward Pickup <edward.pickup@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
20 months agoMdeModulePkg/AhciPei: Use PCI_DEVICE_PPI to manage AHCI device
Czajkowski, Maciej [Mon, 1 Aug 2022 17:00:09 +0000 (01:00 +0800)]
MdeModulePkg/AhciPei: Use PCI_DEVICE_PPI to manage AHCI device

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

This change modifies AhciPei library to allow usage both EDKII_PCI_DEVICE_PPI
and EDKII_PEI_ATA_AHCI_HOST_CONTROLLER_PPI to manage ATA HDD working under
AHCI mode.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Maciej Czajkowski <maciej.czajkowski@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
20 months agoMdeModulePkg: Add EDKII_PCI_DEVICE_PPI definition
Czajkowski, Maciej [Mon, 1 Aug 2022 17:00:08 +0000 (01:00 +0800)]
MdeModulePkg: Add EDKII_PCI_DEVICE_PPI definition

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

This commit introduces EDKII_PCI_DEVICE_PPI. The purpose of this PPI is
to provide a way of accessing PCI devices to drvice drivers such as
NvmExpressPei or AhciPei.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Maciej Czajkowski <maciej.czajkowski@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
20 months agoUefiPayloadPkg: Load Boot Logo into ACPI table
Sean Rhodes [Sun, 10 Jul 2022 18:27:46 +0000 (19:27 +0100)]
UefiPayloadPkg: Load Boot Logo into ACPI table

If the boot logo is enabled, this will allow edk2 to pass the logo
to the OS via ACPI.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
20 months agoUefiPayloadPkg: Add a Macro to enable Boot Logo
Sean Rhodes [Sun, 10 Jul 2022 18:20:40 +0000 (19:20 +0100)]
UefiPayloadPkg: Add a Macro to enable Boot Logo

Add a macro called BOOTSPLASH_IMAGE, which when enabled, will
display a logo at boot time.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
20 months agoUefiPayloadPkg/PlatformBootManagerLib: Correct spacing in boot prompt
Sean Rhodes [Mon, 4 Jul 2022 19:36:31 +0000 (20:36 +0100)]
UefiPayloadPkg/PlatformBootManagerLib: Correct spacing in boot prompt

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>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
20 months agoMaintainers.txt: Add missing Github IDs for OvmfPkg TPM/TGC modules
Michael D Kinney [Thu, 28 Jul 2022 00:48:30 +0000 (17:48 -0700)]
Maintainers.txt: Add missing Github IDs for OvmfPkg TPM/TGC modules

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: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Ard Biesheuvel <ardb+tianocore@kernel.org>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
20 months agoArmVirtPkg: Fix KVM Guest Firmware
Edward Pickup [Tue, 2 Aug 2022 16:27:27 +0000 (17:27 +0100)]
ArmVirtPkg: Fix KVM Guest Firmware

Fix build of KVM Guest Firmware, broken by commit

  4c55f6394faf ("MdePkg: IORT header update for IORT Rev E.d spec")

Signed-off-by: Edward Pickup <edward.pickup@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
20 months agoOvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode
Dimitrije Pavlov [Thu, 28 Jul 2022 21:30:42 +0000 (16:30 -0500)]
OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode

Ensure that the PixelInformation field of the
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is zeroed out in
EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode() and
EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() when PixelFormat is
PixelBlueGreenRedReserved8BitPerColor.

According to UEFI 2.9 Section 12.9, PixelInformation field of the
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is valid only if
PixelFormat is PixelBitMask. This means that firmware is not required
to fill out the PixelInformation field for other PixelFormat types,
which implies that the QemuVideoDxe implementation is technically
correct.

However, not zeroing out those fields will leak the contents of the
memory returned by the memory allocator, so it is better to explicitly
set them to zero.

In addition, the SCT test suite relies on PixelInformation always
having a consistent value, which causes failures.

Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
20 months agoSecurityPkg: Add retry mechanism for tpm command
Qi Zhang [Fri, 29 Jul 2022 01:02:21 +0000 (09:02 +0800)]
SecurityPkg: Add retry mechanism for tpm command

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

As per TCG PC Client Device Driver Design Principle document,
if tpm commands fails due to timeout condition, then it should
have retry mechanism (3 retry attempts).
Existing implementation of PtpCrbTpmCommand does not have retry
mechanism if it fails with EFI_TIMEOUT.

See TCG PC Client Device Driver Design Principles for TPM 2.0
https://trustedcomputinggroup.org/wp-content/uploads/TCG_PCClient_Device_Driver_Design_Principles_TPM2p0_v1p1_r4_211104_final.pdf
Vision 1.1, Revision 0.04
Section 7.2.1

Signed-off-by: Qi Zhang <qi1.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Tested-by: Swapnil Patil <S.Keshavrao.Patil@dell.com>
20 months agoDynamicTablesPkg: IORT generator updates for Rev E.d spec
Sami Mujawar [Thu, 14 Jul 2022 16:50:31 +0000 (17:50 +0100)]
DynamicTablesPkg: IORT generator updates for Rev E.d spec

Bugzilla: 3458 - Add support IORT Rev E.d specification updates
          (https://bugzilla.tianocore.org/show_bug.cgi?id=3458)

The IO Remapping Table, Platform Design Document, Revision E.d,
Feb 2022 (https://developer.arm.com/documentation/den0049/)
introduces the following updates, collectively including the
updates and errata fixes to Rev E, Rev E.a, Rev E.b, Rev E.c:
 - increments the IORT table revision to 5.
 - updates the node definition to add an 'Identifier' field.
 - adds definition of node type 6 - Reserved Memory Range node.
 - adds definition for Memory Range Descriptors.
 - adds flag to indicate PRI support for root complexes.
 - adds flag to indicate if the root complex supports forwarding
   of PASID information on translated transactions to the SMMU.
 - adds flag to indicate if the root complex supports PASID.
 - adds flags to define access privilege and attributes for the
   memory ranges.

Therefore, update the IORT generator to:
  - increment IORT table revision count to 5.
  - populate Identifier filed if revision is greater than 4.
  - add support to populate Reserved Memory Range nodes and
    the Memory range descriptors.
  - add validation to check that the Identifier field is
    unique.
  - Populate the PASID capabilities and Flags field of the
    Root complex node.
 - Added checks to not generate IORT Rev E, Rev E.<a,b,c>.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
20 months agoDynamicTablesPkg: Update ArmNameSpaceObjects for IORT Rev E.d
Sami Mujawar [Thu, 14 Jul 2022 16:50:30 +0000 (17:50 +0100)]
DynamicTablesPkg: Update ArmNameSpaceObjects for IORT Rev E.d

Bugzilla: 3458 - Add support IORT Rev E.d specification updates
          (https://bugzilla.tianocore.org/show_bug.cgi?id=3458)

The IO Remapping Table, Platform Design Document, Revision E.d,
    Feb 2022 (https://developer.arm.com/documentation/den0049/)
    introduces the following updates, collectively including the
    updates and errata fixes to Rev E, Rev E.a, Rev E.b, Rev E.c:
     - increments the IORT table revision to 5.
     - updates the node definition to add an 'Identifier' field.
     - adds definition of node type 6 - Reserved Memory Range node.
     - adds definition for Memory Range Descriptors.
     - adds flag to indicate PRI support for root complexes.
     - adds flag to indicate if the root complex supports forwarding
       of PASID information on translated transactions to the SMMU.
     - adds flag to indicate if the root complex supports PASID.
     - adds flags to define access privilege and attributes for the
       memory ranges.

Therefore, update the Arm namespace objects to:
  - add Identifier field to IORT nodes.
  - introduce enums to represent RMR nodes and Memory Range
    descriptors.
  - add definition of node type 6 - Reserved Memory Range node.
  - add definition for Memory Range Descriptors.
  - add PASID capabilities and flags field to Root Complex node.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
20 months agoShellPkg: Acpiview: IORT parser update for IORT Rev E.d spec
Sami Mujawar [Thu, 14 Jul 2022 16:50:29 +0000 (17:50 +0100)]
ShellPkg: Acpiview: IORT parser update for IORT Rev E.d spec

Bugzilla: 3458 - Add support IORT Rev E.d specification updates
          (https://bugzilla.tianocore.org/show_bug.cgi?id=3458)

The IO Remapping Table, Platform Design Document, Revision E.d,
Feb 2022 (https://developer.arm.com/documentation/den0049/)
introduces the following updates, collectively including the
updates and errata fixes to Rev E, Rev E.a, Rev E.b, Rev E.c:
 - increments the IORT table revision to 5.
 - updates the node definition to add an 'Identifier' field.
 - adds definition of node type 6 - Reserved Memory Range node.
 - adds definition for Memory Range Descriptors.
 - adds flag to indicate PRI support for root complexes.
 - adds flag to indicate if the root complex supports forwarding
   of PASID information on translated transactions to the SMMU.
 - adds flag to indicate if the root complex supports PASID.
 - adds flags to define access privilege and attributes for the
   memory ranges.

Therefore, update the IORT parser to:
  - parse the Identifier field.
  - parse Reserved Memory Range node.
  - parse Memory Range Descriptors.
  - add validations to check that the physical range base
    and size of the Memory Range Descriptor is 64KB aligned.
  - add validation to check that the IORT Table Revision is
    not 4 as IORT Rev E.c is deprecated.
  - add validation to check that the IORT RMR node revision
    is not 2 as it breaks backward compatibility and was
    deprecated as part of IORT Rev E.c.
  - skip parsing of IORT Rev E, Rev E.a, Rev E.b, Rev E.c as
    some fields were deprecated in these revisions.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
20 months agoMdePkg: IORT header update for IORT Rev E.d spec
Sami Mujawar [Thu, 14 Jul 2022 16:50:28 +0000 (17:50 +0100)]
MdePkg: IORT header update for IORT Rev E.d spec

Bugzilla: 3458 - Add support IORT Rev E.d specification updates
          (https://bugzilla.tianocore.org/show_bug.cgi?id=3458)

The IO Remapping Table, Platform Design Document, Revision E.d,
Feb 2022 (https://developer.arm.com/documentation/den0049/)
introduces the following updates, collectively including the
updates and errata fixes to Rev E, Rev E.a, Rev E.b, Rev E.c:
  - increments the IORT table revision to 5.
  - updates the node definition to add an 'Identifier' field.
  - adds definition of node type 6 - Reserved Memory Range node.
  - adds definition for Memory Range Descriptors.
  - adds flag to indicate PRI support for root complexes.
  - adds flag to indicate if the root complex supports forwarding
    of PASID information on translated transactions to the SMMU.
  - adds flag to indicate if the root complex supports PASID.
  - adds flags to define access privilege and attributes for the
    memory ranges.

Therefore, update the IORT header file to reflect these changes,
and also rename the EFI_ACPI_IO_REMAPPING_TABLE_REVISION macro to
EFI_ACPI_IO_REMAPPING_TABLE_REVISION_00.

Also update the IORT generator in DynamicTablesPkg to fix the
compilation errors so that Git Bisect can work.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
20 months agoDynamicTablesPkg: IORT set reference to interrupt array if present
Sami Mujawar [Thu, 14 Jul 2022 16:50:27 +0000 (17:50 +0100)]
DynamicTablesPkg: IORT set reference to interrupt array if present

The IORT generator is populating the reference field for Context and
PMU interrupts even if their count is zero.

Update the IORT generator to set the references only if the interrupt
count is not 0. Also add checks to ensure a valid reference token has
been provided.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
20 months agoDynamicTablesPkg: IORT set reference to Id array only if present
Sami Mujawar [Thu, 14 Jul 2022 16:50:26 +0000 (17:50 +0100)]
DynamicTablesPkg: IORT set reference to Id array only if present

The IORT table generator is setting up a reference to ID array for
nodes even when the ID Mapping count is zero. This is not an issue as an
OS would only access the ID Reference if the ID mapping count is not zero.

However, it would be good to set the reference to ID array to zero when
the ID Mapping count is zero rather than populating it with an incorrect
value.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
20 months agoDynamicTablesPkg: Handle error when IdMappingToken is NULL
Sami Mujawar [Thu, 14 Jul 2022 16:50:25 +0000 (17:50 +0100)]
DynamicTablesPkg: Handle error when IdMappingToken is NULL

Add error handling when the IdMappingCount is not zero and the
IdMappingToken is NULL.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
20 months agoShellPkg: Acpiview: Abbreviate field names to preserve alignment
Sami Mujawar [Thu, 14 Jul 2022 16:50:24 +0000 (17:50 +0100)]
ShellPkg: Acpiview: Abbreviate field names to preserve alignment

Some field names in the IORT table parser were longer than the
OUTPUT_FIELD_COLUMN_WIDTH plus indentation, resulting in loss of
the output print alignment. Therefore, abbreviate the field names.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
20 months agoIntelFsp2Pkg: Fix GenCfgOpt bug for FSPI_UPD support.
Chasel Chiu [Fri, 29 Jul 2022 02:52:49 +0000 (19:52 -0700)]
IntelFsp2Pkg: Fix GenCfgOpt bug for FSPI_UPD support.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3993
Fixed a logic bug in GenCfgOpt.py to skip FSPI_UPD when platforms
do not support.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
20 months agoIntelFsp2Pkg: FSPI_UPD is not mandatory.
Chasel Chiu [Mon, 25 Jul 2022 19:03:51 +0000 (12:03 -0700)]
IntelFsp2Pkg: FSPI_UPD is not mandatory.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3993
FSPI_UPD is required only When platforms implemented FSP_I component.
Updated the scripts to allow FSPI_UPD not present scenario.
Also fixed FSP_GLOBAL_DATA structure alignment issue and unnecessary
non-backward compatibility change in previous FSP_I patch.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
20 months agoOvmfPkg/XenHypercallLib: Fix naming of AArch64
Anthony PERARD [Wed, 20 Jul 2022 13:17:10 +0000 (06:17 -0700)]
OvmfPkg/XenHypercallLib: Fix naming of AArch64

Fix path to follow naming convention of "AArch64", and allow the path
in "Maintainers.txt" to work as expected.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3982
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
20 months agoMaintainers.txt: Remove MptScsi and PvScsi reviewers
Michael D Kinney [Tue, 26 Jul 2022 19:43:03 +0000 (12:43 -0700)]
Maintainers.txt: Remove MptScsi and PvScsi reviewers

The email addresses for the reviewers of the MptScsi and
PvScsi in the OvmfPkg are no longer valid.  Remove the
reviewers for the MptScsi and PvScsi drivers until new
maintainers/reviewers can be identified.

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
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>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
20 months agoOvmfPkg: Change default to disable MptScsi and PvScsi
Michael D Kinney [Tue, 26 Jul 2022 19:40:00 +0000 (12:40 -0700)]
OvmfPkg: Change default to disable MptScsi and PvScsi

The email addresses for the reviewers of the MptScsi and
PvScsi are no longer valid.  Disable the MptScsi and PvScsi
drivers in all DSC files until new maintainers/reviewers can
be identified.

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: Sebastien Boeuf <sebastien.boeuf@intel.com>
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: Min Xu <min.m.xu@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
20 months agoUefiPayloadPkg: Add support for logging to CBMEM console
Benjamin Doron [Sun, 22 May 2022 18:20:55 +0000 (14:20 -0400)]
UefiPayloadPkg: Add support for logging to CBMEM console

Writes TianoCore debug logs into the CBMEM console ringbuffer, from
where the user can retrieve them with the `cbmem` userspace utility.

The intention is to aid in debugging non-fatal issues even in release
builds, or simply make TianoCore's logs available to those interested.
Consequently, MDEPKG_NDEBUG must be masked. As an in-memory debug
logging library, ASSERTs must be non-fatal to be seen, so they neither
dead-loop nor create a breakpoint. It is assumed that ASSERT() neither
enforces fatal conditions nor security integrity, as release builds do
not call DebugAssert() from the ASSERT macro.

More detailed debug logs are produced with the DEBUG_CODE macro, but
this guards other debug-related code throughout the codebase. To avoid
changing behaviour on release builds, this is only set for debug builds.

Tested on QEMU, dumping the appropriate memory region in the UEFI shell
shows the TianoCore log. An improved revision of the debug library used
in several coreboot-related EDK2 forks, including MrChromebox's.
Previous revisions also tested on an Acer Aspire VN7-572G laptop.

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: Benjamin Doron <benjamin.doron00@gmail.com>
20 months agoUefiPayloadPkg: Fix RelaAddress type always mismatch in if condition
James Lu [Mon, 11 Jul 2022 05:05:31 +0000 (22:05 -0700)]
UefiPayloadPkg: Fix RelaAddress type always mismatch in if condition

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

Under function RolocateElfDynamic() in Elf32Lib.c
if (RelaAddress == MAX_UINT64) is always FALSE while RelaAddress is UINT32
Fix is to  modify if condition check to "if (RelaAddress == MAX_UINT32)"

Cc: Ray Ni <ray.ni@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: James Lu <james.lu@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
20 months agoBaseTools/VolInfo: Show encapsulation sections
Konstantin Aladyshev [Tue, 19 Jul 2022 12:29:17 +0000 (20:29 +0800)]
BaseTools/VolInfo: Show encapsulation sections

Currently there is no labels for start and end of the encapsulation
sections. Therefore it is not possible to see where the encapsulation
section ends and another section starts.
Add labels for start and end of encapsulation sections to fix the
issue.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
20 months agoBaseTools/Capsule: Support signtool input subject name to sign capsule file
Jason1 Lin [Mon, 25 Jul 2022 15:31:08 +0000 (23:31 +0800)]
BaseTools/Capsule: Support signtool input subject name to sign capsule file

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

Windows-based system using signtool.exe to sign the capsule.
Add the support to using "--subject-name" argument to assign
the subject name used to sign the capsule file.
This argument would pass to signtool.exe as a part of input
argument with "/n" flag.

NOTE: If using signtool.exe to sign capsule at least need to
      choose one of "--pfx-file" and "--subject-name"
      argument to input the value.

Signed-off-by: Jason1 Lin <jason1.lin@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Dakota Chiang <dakota.chiang@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
20 months agoMaintainers.txt: Remove reviewer Harry Han
Michael D Kinney [Wed, 20 Jul 2022 20:02:12 +0000 (13:02 -0700)]
Maintainers.txt: Remove reviewer Harry Han

Cc: Harry Han <harry.han@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Harry Han <harry.han@intel.com>
Reviewed-by: Andrew Fish <afish@apple.com>
20 months agoMaintainers.txt: Add missing github ids
Michael D Kinney [Wed, 20 Jul 2022 17:30:50 +0000 (10:30 -0700)]
Maintainers.txt: Add missing github ids

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: Debkumar De <debkumar.de@intel.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gary Lin <gary.lin@hpe.com>
Cc: Julien Grall <julien@xen.org>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Debkumar De <debkumar.de@intel.com>
Acked-by: Gary Lin <gary.lin@hpe.com>
Reviewed-by: Andrew Fish <afish@apple.com>
20 months agoMaintainers.txt: Remove OvmfPkg/XenTimerDxe reference
Michael D Kinney [Wed, 20 Jul 2022 17:28:28 +0000 (10:28 -0700)]
Maintainers.txt: Remove OvmfPkg/XenTimerDxe reference

XenTimerDxe has been removed from the OvmfPkg.  Remove
file pattern for XenTimerDxe reviews from Maintainers.txt.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien@xen.org>
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Andrew Fish <afish@apple.com>
20 months agoUefiPayloadPkg: Add macro to support selection of CryptoDxe driver
PaytonX Hsieh [Fri, 22 Jul 2022 06:50:09 +0000 (14:50 +0800)]
UefiPayloadPkg: Add macro to support selection of CryptoDxe driver

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

Add CRYPTO_PROTOCOL_SUPPORT to decide CryptoDxe built into UPL.efi
If CRYPTO_PROTOCOL_SUPPORT is true, BIOS will use crypto protocol
instead of building OpensslLib into drivers.

Reviewed-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: James Lu <james.lu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Signed-off-by: PaytonX Hsieh <paytonx.hsieh@intel.com>
20 months agoUefiCpuPkg: Fix nasm warning "signed byte value exceeds"
Zhiguang Liu [Wed, 6 Jul 2022 13:10:13 +0000 (21:10 +0800)]
UefiCpuPkg: Fix nasm warning "signed byte value exceeds"

Currently, "push byte %[Vector]" causes nasm warning when Vector is larger
than 0x7F. This is because push accepts a signed value, and byte means
signed int8. Maximum signed int8 is 0x7F.
When Vector is larger the 0x7F, for example, when Vector is 255, byte 255
turns to -1, and causes the warning "signed byte value exceeds".
To avoid such warning, use dword instead of byte, this will increase 3 bytes
for each IdtVector.
For IA32, the size of IdtVector will increase from 10 bytes to 13 bytes.
For X64, the size of IdtVector will increase from 15 bytes to 18 bytes.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Debkumar De <debkumar.de@intel.com>
Cc: Harry Han <harry.han@intel.com>
Cc: Catharine West <catharine.west@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
20 months agoBaseTools/VolInfo: Correct EFI_SECTION_VERSION display
Konstantin Aladyshev [Mon, 18 Jul 2022 09:43:52 +0000 (17:43 +0800)]
BaseTools/VolInfo: Correct EFI_SECTION_VERSION display

- Correct typo in print statement,
- "BuildNumber" field is UINT16, therefore it needs "0x%04X" format
modifier,
- "VersionString" field is CHAR16, therefore the input data should be
processed to be displayed with "%s" printf modifier.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
20 months agoBaseTools/VolInfo: Increase define for highest section value
Konstantin Aladyshev [Mon, 18 Jul 2022 12:55:53 +0000 (20:55 +0800)]
BaseTools/VolInfo: Increase define for highest section value

Currently sections with unknown types are displayed as
`EFI_SECTION_SMM_DEPEX` which is wrong.
Increase the highest value for the section type to 0x1C
for correct parsing.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Yuwei Chen<yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
20 months agoBaseTools/VolInfo: Correct alignment attributes display
Konstantin Aladyshev [Wed, 13 Jul 2022 13:11:02 +0000 (21:11 +0800)]
BaseTools/VolInfo: Correct alignment attributes display

Alignment attribute is not a bitmask, therefore we need to compare
field value with all alignment defines.
Remove duplicate print statements. Unify indent with other attribute
print statements.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
20 months agoBaseTools: INF should use latest Pcd value instead of default value
Li, Yi1 [Mon, 11 Jul 2022 05:48:14 +0000 (13:48 +0800)]
BaseTools: INF should use latest Pcd value instead of default value

This patch is a bug fix about FeatureFlagExpression in INF file:
 INF [Source] section now unconditionally use Pcd default value in DEC
 when handling FeatureFlagExpression, it is wrong.
 If a Pcd value has been set in the DSC file, we should use latest
 value in DSC instead of default value.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Yi Li <yi1.li@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
20 months agoMdeModulePkg/Include: Long debug string is truncated to 104 char
Cosmo Lai [Tue, 19 Jul 2022 05:58:32 +0000 (13:58 +0800)]
MdeModulePkg/Include: Long debug string is truncated to 104 char

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

The EFI_STATUS_CODE_DATA_MAX_SIZE is defined as 200 in MdeModulePkg.
After reducing 96byte buffer for variable parameters it is limited to
only 104 char debug string. This is a non-necessary limitation.
This change sets EFI_STATUS_CODE_DATA_MAX_SIZE to 0x200, and moves
MAX_EXTENDED_DATA_SIZE definition to the same header file with value
of EFI_STATUS_CODE_DATA_MAX_SIZE + sizeof (EFI_STATUS_CODE_DATA)
which is used in ReportStatusCodeLib to support longer debug string.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Cosmo Lai <cosmo.lai@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
20 months agoMdePkg/UefiDevicePathLib: Add support for PEIMs
Mateusz Albecki [Fri, 1 Jul 2022 14:11:47 +0000 (22:11 +0800)]
MdePkg/UefiDevicePathLib: Add support for PEIMs

DevicePathLib utilities are useful in PEI to locate the devices which need
an opal unlock on S3 resume. This commit reuses the implementation done
for standalone MM support and makes the StandaloneMm library Base.

Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
20 months agoIntelFsp2Pkg: Add FSPI_ARCH_UPD.
Chasel Chiu [Wed, 20 Jul 2022 18:51:49 +0000 (11:51 -0700)]
IntelFsp2Pkg: Add FSPI_ARCH_UPD.

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

Adding the missing FSPI_ARCH_UPD, FSP_GLOBAL_DATA_VERSION bumpping up,
and some comments for clarification.
Also fixed a bug in SplitFspBin.py for FSP-I support.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
20 months agoArmPkg/CpuDxe: drop ARM_PROCESSOR_TABLE pseudo-ACPI table
Ard Biesheuvel [Fri, 17 Dec 2021 21:34:03 +0000 (22:34 +0100)]
ArmPkg/CpuDxe: drop ARM_PROCESSOR_TABLE pseudo-ACPI table

The ARM_PROCESSOR_TABLE pseudo-ACPI table (which carries a ACPI-table
like header but is published as a EFI config table) is not described in
any relevant spec, and is not known to be relied upon by any OS. Let's
just get rid of it.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Tested-by: Sami Mujawar <sami.mujawar@arm.com>
20 months agoMdeModulePkg/SetupBrowserDxe:Follow spec'd way to reconnect driver
Walon Li [Fri, 24 Jun 2022 06:07:47 +0000 (14:07 +0800)]
MdeModulePkg/SetupBrowserDxe:Follow spec'd way to reconnect driver

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

In UEFI spec, it defines reconnect timing that will be activated upon
exiting of the formset or the browser. However, we did't use this kind
of way to check reconnect conditioncode. Code only blocks reconnect if
page is updated dynamically. That's not matched spec'd way. We should
check current formset whether is exiting, then reconnect driver.

Signed-off-by: Walon Li <walon.li@hpe.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
20 months agoMdeModulePkg/CoreDxe: Allow DXE Drivers to use untested memory
Stacy Howell [Fri, 7 Jan 2022 19:36:12 +0000 (03:36 +0800)]
MdeModulePkg/CoreDxe: Allow DXE Drivers to use untested memory

REF: https://https://bugzilla.tianocore.org/show_bug.cgi?id=3795
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Updated CoreInternalAllocatePages() to call PromoteMemoryResource() and
re-attempt the allocation if unable to convert the specified memory range

Signed-off-by: Stacy Howell <stacy.howell@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
20 months agoEmulatorPkg/PosixFileSystem: Add NULL check on memory allocation
Shindo, Miki [Tue, 19 Jul 2022 20:28:26 +0000 (04:28 +0800)]
EmulatorPkg/PosixFileSystem: Add NULL check on memory allocation

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

This commit adds NULL check on memory allocation of the size
for FileName in ASCII string format at PosixFileSetInfo().

Signed-off-by: Miki Shindo <miki.shindo@intel.com>
Cc: Andrew Fish <afish@apple.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
21 months agoMaintainers.txt: update Gary's email address
Gary Lin [Fri, 13 Aug 2021 02:11:11 +0000 (19:11 -0700)]
Maintainers.txt: update Gary's email address

I've left SUSE last month, so the original email address is not
functional anymore. Update my email address to the new one.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Gary Lin <gary.lin@hpe.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
21 months agoIntelFsp2Pkg/FspSecCore: Add FSP-I API for SMM support.
Hongbin1 Zhang [Tue, 19 Jul 2022 17:09:15 +0000 (10:09 -0700)]
IntelFsp2Pkg/FspSecCore: Add FSP-I API for SMM support.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3993
Add FSP-I API entry point for SMM support.
Also update 64bit API entry code to assign ApiIdx to RAX
to avoid confusion.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Signed-off-by: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
21 months agoIntelFsp2WrapperPkg: Support 64bit FspResetType for X64 build.
Chasel Chiu [Tue, 19 Jul 2022 04:08:31 +0000 (21:08 -0700)]
IntelFsp2WrapperPkg: Support 64bit FspResetType for X64 build.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3999
FspResetType will be either 32bit or 64 bit basing on
the build type.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
21 months agoIntelFsp2Pkg: Support 64bit FspResetType for X64 build.
Chasel Chiu [Tue, 19 Jul 2022 03:28:17 +0000 (20:28 -0700)]
IntelFsp2Pkg: Support 64bit FspResetType for X64 build.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3999
FspResetType will be either 32bit or 64 bit basing on
the build type.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>