]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
3 years agoOvmfPkg: add TimeBaseLib resolution for OvmfXen
Leif Lindholm [Fri, 8 Jan 2021 14:08:53 +0000 (14:08 +0000)]
OvmfPkg: add TimeBaseLib resolution for OvmfXen

Commit 55ee36b0c490
("EmbeddedPkg/RealTimeClockRuntimeDxe: Use helper functions from TimeBaseLib")
added a TimeBaseLib dependency to RealTimeClockRuntimeDxe, which now breaks
build of OvmfXen.dsc.

Add a resolution for EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien@xen.org>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoEmbeddedPkg: add TimeBaseLib resolution to EmbeddedPkg.dsc
Leif Lindholm [Thu, 7 Jan 2021 19:35:39 +0000 (19:35 +0000)]
EmbeddedPkg: add TimeBaseLib resolution to EmbeddedPkg.dsc

Commit 55ee36b0c490
("EmbeddedPkg/RealTimeClockRuntimeDxe: Use helper functions from TimeBaseLib")
added a TimeBaseLib dependency to RealTimeClockRuntimeDxe, which now breaks
build of EmbeddedPkg.dsc.

Add a resolution for EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf.

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Nhi Pham <nhi@os.amperecomputing.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoEmbeddedPkg/PrePiMemoryAllocationLib: use correct size for pool hob
Ard Biesheuvel [Wed, 6 Jan 2021 10:26:34 +0000 (11:26 +0100)]
EmbeddedPkg/PrePiMemoryAllocationLib: use correct size for pool hob

Use the correct type in the sizeof() expression to calculate the size
of the newly allocated EFI_HOB_MEMORY_POOL hob.

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3139
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
3 years agoMdeModulePkg Lzma: Update LZMA SDK version to 19.00
Liu, WeiX C [Tue, 5 Jan 2021 06:14:03 +0000 (14:14 +0800)]
MdeModulePkg Lzma: Update LZMA SDK version to 19.00

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3101
New formal release in https://www.7-zip.org/sdk.html is 19.00.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Wei Liu <weix.c.liu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoBaseTools LzmaCompress: Update LZMA to new 19.00 version
Liu, WeiX C [Tue, 5 Jan 2021 06:14:02 +0000 (14:14 +0800)]
BaseTools LzmaCompress: Update LZMA to new 19.00 version

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3101
New formal release in https://www.7-zip.org/sdk.html is 19.00.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Wei Liu <weix.c.liu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoShellPkg/Acpiview: AEST Parser
Marc Moisson-Franckhauser [Tue, 3 Nov 2020 14:32:02 +0000 (22:32 +0800)]
ShellPkg/Acpiview: AEST Parser

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

Add a new parser for the Arm Error Source Table (AEST) described in
the ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document,
dated 28 September 2020.
(https://developer.arm.com/documentation/den0085/0101/)

AEST enables kernel-first handling of errors in a system that supports
the Armv8 RAS extensions. It covers Armv8.2+ RAS extensions for PEs
and the RAS system architecture for non-PE system components.

Signed-off-by: Marc Moisson-Franckhauser <marc.moisson-franckhauser@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
3 years agoMdePkg/IndustryStandard: AEST Table definition
Marc Moisson-Franckhauser [Tue, 3 Nov 2020 14:32:01 +0000 (22:32 +0800)]
MdePkg/IndustryStandard: AEST Table definition

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

Add definition for the Arm Error Source Table (AEST) described in
the ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document,
dated 28 September 2020.
(https://developer.arm.com/documentation/den0085/0101/)

Signed-off-by: Marc Moisson-Franckhauser <marc.moisson-franckhauser@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
3 years agoOvfmPkg/VmgExitLib: Validate #VC MMIO is to un-encrypted memory
Tom Lendacky [Thu, 7 Jan 2021 18:48:25 +0000 (12:48 -0600)]
OvfmPkg/VmgExitLib: Validate #VC MMIO is to un-encrypted memory

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

When SEV-ES is active, and MMIO operation will trigger a #VC and the
VmgExitLib exception handler will process this MMIO operation.

A malicious hypervisor could try to extract information from encrypted
memory by setting a reserved bit in the guests nested page tables for
a non-MMIO area. This can result in the encrypted data being copied into
the GHCB shared buffer area and accessed by the hypervisor.

Prevent this by ensuring that the MMIO source/destination is un-encrypted
memory. For the APIC register space, access is allowed in general.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <0cf28470ad5e694af45f7f0b35296628f819567d.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmfPkg/PlatformPei: Reserve GHCB backup pages if S3 is supported
Tom Lendacky [Thu, 7 Jan 2021 18:48:24 +0000 (12:48 -0600)]
OvmfPkg/PlatformPei: Reserve GHCB backup pages if S3 is supported

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

Protect the GHCB backup pages used by an SEV-ES guest when S3 is
supported.

Regarding the lifecycle of the GHCB backup pages:
  PcdOvmfSecGhcbBackupBase

(a) when and how it is initialized after first boot of the VM

  If SEV-ES is enabled, the GHCB backup pages are initialized when a
  nested #VC is received during the SEC phase
  [OvmfPkg/Library/VmgExitLib/SecVmgExitVcHandler.c].

(b) how it is protected from memory allocations during DXE

  If S3 and SEV-ES are enabled, then InitializeRamRegions()
  [OvmfPkg/PlatformPei/MemDetect.c] protects the ranges with an AcpiNVS
  memory allocation HOB, in PEI.

  If S3 is disabled, then these ranges are not protected. PEI switches to
  the GHCB backup pages in permanent PEI memory and DXE will use these
  PEI GHCB backup pages, so we don't have to preserve
  PcdOvmfSecGhcbBackupBase.

(c) how it is protected from the OS

  If S3 is enabled, then (b) reserves it from the OS too.

  If S3 is disabled, then the range needs no protection.

(d) how it is accessed on the S3 resume path

  It is rewritten same as in (a), which is fine because (b) reserved it.

(e) how it is accessed on the warm reset path

  It is rewritten same as in (a).

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien@xen.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <119102a3d14caa70d81aee334a2e0f3f925e1a60.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmfPkg/VmgExitLib: Support nested #VCs
Tom Lendacky [Thu, 7 Jan 2021 18:48:23 +0000 (12:48 -0600)]
OvmfPkg/VmgExitLib: Support nested #VCs

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

In order to be able to issue messages or make interface calls that cause
another #VC (e.g. GetLocalApicBaseAddress () issues RDMSR), add support
for nested #VCs.

In order to support nested #VCs, GHCB backup pages are required. If a #VC
is received while currently processing a #VC, a backup of the current GHCB
content is made. This allows the #VC handler to continue processing the
new #VC. Upon completion of the new #VC, the GHCB is restored from the
backup page. The #VC recursion level is tracked in the per-vCPU variable
area.

Support is added to handle up to one nested #VC (or two #VCs total). If
a second nested #VC is encountered, an ASSERT will be issued and the vCPU
will enter CpuDeadLoop ().

For SEC, the GHCB backup pages are reserved in the OvmfPkgX64.fdf memory
layout, with two new fixed PCDs to provide the address and size of the
backup area.

For PEI/DXE, the GHCB backup pages are allocated as boot services pages
using the memory allocation library.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <ac2e8203fc41a351b43f60d68bdad6b57c4fb106.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmfPkg/MemEncryptSevLib: Address range encryption state interface
Tom Lendacky [Thu, 7 Jan 2021 18:48:22 +0000 (12:48 -0600)]
OvmfPkg/MemEncryptSevLib: Address range encryption state interface

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

Update the MemEncryptSevLib library to include an interface that can
report the encryption state on a range of memory. The values will
represent the range as being unencrypted, encrypted, a mix of unencrypted
and encrypted, and error (e.g. ranges that aren't mapped).

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <0d98f4d42a2b67310c29bac7bcdcf1eda6835847.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmfPkg/MemEncryptSevLib: Make the MemEncryptSevLib available for SEC
Tom Lendacky [Thu, 7 Jan 2021 18:48:21 +0000 (12:48 -0600)]
OvmfPkg/MemEncryptSevLib: Make the MemEncryptSevLib available for SEC

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

In preparation for a new interface to be added to the MemEncryptSevLib
library that will be used in SEC, create an SEC version of the library.

This requires the creation of SEC specific files.

Some of the current MemEncryptSevLib functions perform memory allocations
which cannot be performed in SEC, so these interfaces will return an error
during SEC. Also, the current MemEncryptSevLib library uses some static
variables to optimize access to variables, which cannot be used in SEC.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <bc7fa76cc23784ab3f37356b6c10dfec61942c38.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmfPkg/MemEncryptSevLib: Coding style fixes in prep for SEC library
Tom Lendacky [Thu, 7 Jan 2021 18:48:20 +0000 (12:48 -0600)]
OvmfPkg/MemEncryptSevLib: Coding style fixes in prep for SEC library

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

Creating an SEC version of the library requires renaming an existing file
which will result in the existing code failing ECC. Prior to renaming the
existing file, fix the coding style to avoid the ECC failure.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <f765d867da4a703e0a0db35e26515a911482fd40.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmfPkg/VmgExitLib: Check for an explicit DR7 cached value
Tom Lendacky [Thu, 7 Jan 2021 18:48:19 +0000 (12:48 -0600)]
OvmfPkg/VmgExitLib: Check for an explicit DR7 cached value

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

Check the DR7 cached indicator against a specific value. This makes it
harder for a hypervisor to just write random data into that field in an
attempt to use an invalid DR7 value.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <65157c1155a9c058c43678400dfc0b486e327a3e.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmfPkg/AmdSevDxe: Clear encryption bit on PCIe MMCONFIG range
Tom Lendacky [Thu, 7 Jan 2021 18:48:18 +0000 (12:48 -0600)]
OvmfPkg/AmdSevDxe: Clear encryption bit on PCIe MMCONFIG range

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

The PCIe MMCONFIG range should be treated as an MMIO range. However,
there is a comment in the code explaining why AddIoMemoryBaseSizeHob()
is not called. The AmdSevDxe walks the GCD map looking for MemoryMappedIo
or NonExistent type memory and will clear the encryption bit for these
ranges.

Since the MMCONFIG range does not have one of these types, the encryption
bit is not cleared for this range. Add support to detect the presence of
the MMCONFIG range and clear the encryption bit. This will be needed for
follow-on support that will validate that MMIO is not being performed to
an encrypted address range under SEV-ES.

Even though the encryption bit was set for this range, this still worked
under both SEV and SEV-ES because the address range is marked by the
hypervisor as MMIO in the nested page tables:
- For SEV, access to this address range triggers a nested page fault (NPF)
  and the hardware supplies the guest physical address (GPA) in the VMCB's
  EXITINFO2 field as part of the exit information. However, the encryption
  bit is not set in the GPA, so the hypervisor can process the request
  without any issues.
- For SEV-ES, access to this address range triggers a #VC. Since OVMF runs
  identity mapped (VA == PA), the virtual address is used to avoid the
  lookup of the physical address. The virtual address does not have the
  encryption bit set, so the hypervisor can process the request without
  any issues.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <711ae2dcb6cb29e4c60862c18330cff627269b81.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmfPkg: Obtain SEV encryption mask with the new MemEncryptSevLib API
Tom Lendacky [Thu, 7 Jan 2021 18:48:17 +0000 (12:48 -0600)]
OvmfPkg: Obtain SEV encryption mask with the new MemEncryptSevLib API

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

The early assembler code performs validation for some of the SEV-related
information, specifically the encryption bit position. The new
MemEncryptSevGetEncryptionMask() interface provides access to this
validated value.

To ensure that we always use a validated encryption mask for an SEV-ES
guest, update all locations that use CPUID to calculate the encryption
mask to use the new interface.

Also, clean up some call areas where extra masking was being performed
and where a function call was being used instead of the local variable
that was just set using the function.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien@xen.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <9de678c0d66443c6cc33e004a4cac0a0223c2ebc.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmfPkg/MemEncryptSevLib: Add an interface to retrieve the encryption mask
Tom Lendacky [Thu, 7 Jan 2021 18:48:16 +0000 (12:48 -0600)]
OvmfPkg/MemEncryptSevLib: Add an interface to retrieve the encryption mask

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

To ensure that we always use a validated encryption mask for an SEV-ES
guest, create a new interface in the MemEncryptSevLib library to return
the encryption mask. This can be used in place of the multiple locations
where CPUID is used to retrieve the value (which would require validation
again) and allows the validated mask to be returned.

The PEI phase will use the value from the SEV-ES work area. Since the
SEV-ES work area isn't valid in the DXE phase, the DXE phase will use the
PcdPteMemoryEncryptionAddressOrMask PCD which is set during PEI.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien@xen.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <e12044dc01b21e6fc2e9535760ddf3a38a142a71.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmfPkg/ResetVector: Save the encryption mask at boot time
Tom Lendacky [Thu, 7 Jan 2021 18:48:15 +0000 (12:48 -0600)]
OvmfPkg/ResetVector: Save the encryption mask at boot time

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

The early assembler code performs validation for some of the SEV-related
information, specifically the encryption bit position. To avoid having to
re-validate the encryption bit position as the system proceeds through its
boot phases, save the validated encryption bit position in the SEV-ES work
area for use by later phases.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <2609724859cf21f0c6d45bc323e94465dca4e621.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmfPkg/ResetVector: Perform a simple SEV-ES sanity check
Tom Lendacky [Thu, 7 Jan 2021 18:48:14 +0000 (12:48 -0600)]
OvmfPkg/ResetVector: Perform a simple SEV-ES sanity check

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

If a hypervisor incorrectly reports through CPUID that SEV-ES is not
active, ensure that a #VC exception was not taken. If it is found that
a #VC was taken, then the code enters a HLT loop.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <afa2030b95b852313b13982df82d472187e59b92.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmfPkg/ResetVector: Validate the encryption bit position for SEV/SEV-ES
Tom Lendacky [Thu, 7 Jan 2021 18:48:13 +0000 (12:48 -0600)]
OvmfPkg/ResetVector: Validate the encryption bit position for SEV/SEV-ES

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

To help mitigate against ROP attacks, add some checks to validate the
encryption bit position that is reported by the hypervisor.

The first check is to ensure that the hypervisor reports a bit position
above bit 31. After extracting the encryption bit position from the CPUID
information, the code checks that the value is above 31. If the value is
not above 31, then the bit position is not valid, so the code enters a
HLT loop.

The second check is specific to SEV-ES guests and is a two step process.
The first step will obtain random data using RDRAND and store that data to
memory before paging is enabled. When paging is not enabled, all writes to
memory are encrypted. The random data is maintained in registers, which
are protected. The second step is that, after enabling paging, the random
data in memory is compared to the register contents. If they don't match,
then the reported bit position is not valid, so the code enters a HLT
loop.

The third check is after switching to 64-bit long mode. Use the fact that
instruction fetches are automatically decrypted, while a memory fetch is
decrypted only if the encryption bit is set in the page table. By
comparing the bytes of an instruction fetch against a memory read of that
same instruction, the encryption bit position can be validated. If the
compare is not equal, then SEV/SEV-ES is active but the reported bit
position is not valid, so the code enters a HLT loop.

To keep the changes local to the OvmfPkg, an OvmfPkg version of the
Flat32ToFlat64.asm file has been created based on the UefiCpuPkg file
UefiCpuPkg/ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <cb9c5ab23ab02096cd964ed64115046cc706ce67.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmfPkg/Sec: Move SEV-ES SEC workarea definition to common header file
Tom Lendacky [Thu, 7 Jan 2021 18:48:12 +0000 (12:48 -0600)]
OvmfPkg/Sec: Move SEV-ES SEC workarea definition to common header file

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

In order to allow for the SEV-ES workarea to be used for other purposes
and by other files, move the definition into the BaseMemEncryptSevLib
header file, MemEncryptSevLib.h.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <07d66f3384bd54da97d540e89b9f3473a6d17231.1610045305.git.thomas.lendacky@amd.com>

3 years agoOvmf/ResetVector: Simplify and consolidate the SEV features checks
Tom Lendacky [Thu, 7 Jan 2021 18:48:11 +0000 (12:48 -0600)]
Ovmf/ResetVector: Simplify and consolidate the SEV features checks

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

Simplify and consolidate the SEV and SEV-ES checks into a single routine.
This new routine will use CPUID to check for the appropriate CPUID leaves
and the required values, as well as read the non-interceptable SEV status
MSR (0xc0010131) to check SEV and SEV-ES enablement.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <43a660624c32b5f6c2610bf42ee39101c21aff68.1610045305.git.thomas.lendacky@amd.com>

3 years agoEmbeddedPkg/RealTimeClockRuntimeDxe: Use helper functions from TimeBaseLib
Nhi Pham [Wed, 6 Jan 2021 16:09:03 +0000 (23:09 +0700)]
EmbeddedPkg/RealTimeClockRuntimeDxe: Use helper functions from TimeBaseLib

This patch replaces all time checking functions and leverage the helper
functions in TimeBaseLib library.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
3 years agoEmbeddedPkg/TimeBaseLib: Add function to check Timezone and Daylight
Nhi Pham [Wed, 6 Jan 2021 16:09:02 +0000 (23:09 +0700)]
EmbeddedPkg/TimeBaseLib: Add function to check Timezone and Daylight

This adds two functions IsValidTimeZone() and IsValidDaylight() to check
the time zone and daylight value from EFI time. These functions are
retrieved from the RealTimeClockRuntimeDxe module as they reduce
duplicated code in RTC modules.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
3 years agoEmbeddedPkg/TimeBaseLib: Fix for minor code formatting
Nhi Pham [Wed, 6 Jan 2021 16:09:01 +0000 (23:09 +0700)]
EmbeddedPkg/TimeBaseLib: Fix for minor code formatting

There is no functional modification in this change.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
3 years agoEmbeddedPkg/TimeBaseLib: Update comment blocks for API functions
Nhi Pham [Wed, 6 Jan 2021 16:09:00 +0000 (23:09 +0700)]
EmbeddedPkg/TimeBaseLib: Update comment blocks for API functions

This updates Doxygen comment blocks for API library functions.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
3 years agoArmPlatformPkg: Enable support for flash in 64-bit address space
Vijayenthiran Subramaniam [Wed, 6 Jan 2021 09:04:00 +0000 (14:34 +0530)]
ArmPlatformPkg: Enable support for flash in 64-bit address space

The existing NOR Flash DXE and StandaloneMm driver supports NOR flash
devices connected in the 32-bit address space. Extend these drivers to
allow NOR flash devices connected to 64-bit address space to be usable
as well. Also, convert the base address and size sanity check from
ASSERT() to if condition so that even if the firmware is build in
release mode, it can return error if the parameter(s) is/are invalid.

Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
Tested-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoOvmfPkg/VirtioFsDxe: call IsTimeValid() before EfiTimeToEpoch()
Laszlo Ersek [Thu, 7 Jan 2021 09:50:51 +0000 (10:50 +0100)]
OvmfPkg/VirtioFsDxe: call IsTimeValid() before EfiTimeToEpoch()

EmbeddedPkg/TimeBaseLib provides a verification function called
IsTimeValid(), for enforcing the UEFI spec requirements on an EFI_TIME
object.

When EFI_FILE_PROTOCOL.SetInfo() is called in order to update the
timestamps on the file, let's invoke IsTimeValid() first, before passing
the new EFI_FILE_INFO.{CreateTime,LastAccessTime,ModificationTime} values
to EfiTimeToEpoch().

This patch is not expected to make a practical difference, but it's better
to ascertain the preconditions of EfiTimeToEpoch() on the
EFI_FILE_PROTOCOL.SetInfo() caller. The FAT driver (EnhancedFatDxe) has a
similar check, namely in FatSetFileInfo() -> FatIsValidTime().

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210107095051.22715-1-lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years ago.pytool: CI Settings to support StandaloneMmPkg
Sami Mujawar [Thu, 3 Dec 2020 10:27:51 +0000 (10:27 +0000)]
.pytool: CI Settings to support StandaloneMmPkg

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

Update pytools configuration to enable StandaloneMmPkg
and update package status in documentation.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years ago.azurepipelines: Add StandaloneMmPkg to CI matrix
Sami Mujawar [Thu, 3 Dec 2020 10:27:32 +0000 (10:27 +0000)]
.azurepipelines: Add StandaloneMmPkg to CI matrix

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

Add StandaloneMmPkg to the Core CI matrix.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Add EDK2 Core CI support
Sami Mujawar [Thu, 3 Dec 2020 14:44:38 +0000 (14:44 +0000)]
StandaloneMmPkg: Add EDK2 Core CI support

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

The TianoCore EDKII project has introduced a Core CI infrastructure
using TianoCore EDKII Tools PIP modules:
  * https://pypi.org/project/edk2-pytool-library/
  * https://pypi.org/project/edk2-pytool-extensions/

The edk2\.pytool\Readme.md provides information to configure the
environment and to run local builds.

This patch defines the necessary settings for enabling the Core CI
builds for StandaloneMmPkg.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Remove dependency on ArmPlatformPkg.dec
Sami Mujawar [Thu, 17 Dec 2020 10:15:15 +0000 (10:15 +0000)]
StandaloneMmPkg: Remove dependency on ArmPlatformPkg.dec

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

Update StandaloneMmCoreEntryPoint to remove the unnecessary
dependency on ArmPlatformPkg.dec.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 8005 in StandaloneMmCoreEntryPoint
Sami Mujawar [Mon, 7 Dec 2020 13:49:55 +0000 (13:49 +0000)]
StandaloneMmPkg: Fix ECC error 8005 in StandaloneMmCoreEntryPoint

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

The ECC tool reports error [8005] Variable name does not follow the rules:
  1. First character should be upper case
  2. Must contain lower case characters
  3. No white space characters
  4. Global variable name must start with a 'g'
for the constants SPM_MAJOR_VER, SPM_MINOR_VER & BOOT_PAYLOAD_VERSION.

Fix this by changing converting these constant variables to #defined
values.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 4002 in StandaloneMmCpu
Sami Mujawar [Mon, 7 Dec 2020 12:55:48 +0000 (12:55 +0000)]
StandaloneMmPkg: Fix ECC error 4002 in StandaloneMmCpu

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

Fix the ECC reported error "[4002] Function header doesn't exist".

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 9002 in CoreMemoryAllocationLib
Sami Mujawar [Mon, 7 Dec 2020 12:46:04 +0000 (12:46 +0000)]
StandaloneMmPkg: Fix ECC error 9002 in CoreMemoryAllocationLib

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

Fix the ECC reported error "[9002] The function headers should follow
Doxygen special documentation blocks in section 2.3.5".

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 9001 in Standalone MM Core
Sami Mujawar [Mon, 7 Dec 2020 12:37:54 +0000 (12:37 +0000)]
StandaloneMmPkg: Fix ECC error 9001 in Standalone MM Core

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

Fix the ECC reported error "[9001] The file headers should follow
Doxygen special documentation blocks in section 2.3.5"

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 9001 in StandaloneMmCpu
Sami Mujawar [Mon, 7 Dec 2020 12:29:37 +0000 (12:29 +0000)]
StandaloneMmPkg: Fix ECC error 9001 in StandaloneMmCpu

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

Fix the ECC reported error "[9001] The file headers should follow
Doxygen special documentation blocks in section 2.3.5".

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 4002 in StandaloneMmCpu
Sami Mujawar [Mon, 7 Dec 2020 12:25:36 +0000 (12:25 +0000)]
StandaloneMmPkg: Fix ECC error 4002 in StandaloneMmCpu

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

Fix the ECC reported error "[4002] Function header doesn't exist".

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 9003 in StandaloneMmCoreEntryPoint
Sami Mujawar [Mon, 7 Dec 2020 12:16:37 +0000 (12:16 +0000)]
StandaloneMmPkg: Fix ECC error 9003 in StandaloneMmCoreEntryPoint

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

Fix the ECC reported error "[9003] The first line of text in a comment
block should be a brief description of the element being documented and
the brief description must end with a period. Comment description should
end with period '.'".

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 9002 in StandaloneMmCoreEntryPoint
Sami Mujawar [Mon, 7 Dec 2020 12:10:43 +0000 (12:10 +0000)]
StandaloneMmPkg: Fix ECC error 9002 in StandaloneMmCoreEntryPoint

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

Fix the ECC reported error "[9002] The function headers should follow
Doxygen special documentation blocks in section 2.3.5 in Comment".

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 9002 in StandaloneMmMemLib
Sami Mujawar [Mon, 7 Dec 2020 12:03:20 +0000 (12:03 +0000)]
StandaloneMmPkg: Fix ECC error 9002 in StandaloneMmMemLib

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

Fix the ECC reported error: "[9002] The function headers should
follow Doxygen special documentation blocks in section 2.3.5".

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 4002 in StandaloneMmCoreEntryPoint
Sami Mujawar [Mon, 7 Dec 2020 11:22:43 +0000 (11:22 +0000)]
StandaloneMmPkg: Fix ECC error 4002 in StandaloneMmCoreEntryPoint

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

Add doxygen style function headers to fix ECC reported errors
"[4002] Function header doesn't exist Function".

Also update the corresponding declaration to add IN/OUT doxygen
style reference tags.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 4002 and 9002 in StandaloneMmCore
Sami Mujawar [Mon, 7 Dec 2020 11:04:26 +0000 (11:04 +0000)]
StandaloneMmPkg: Fix ECC error 4002 and 9002 in StandaloneMmCore

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

Add doxygen style function documentation headers to fix the ECC
reported errors:
 - [4002] Function header doesn't exist.
 - [9002] The function headers should follow Doxygen special
   documentation blocks in section 2.3.5.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 10014 in StandaloneMmCpu
Sami Mujawar [Thu, 3 Dec 2020 21:16:48 +0000 (21:16 +0000)]
StandaloneMmPkg: Fix ECC error 10014 in StandaloneMmCpu

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

Fix ECC error "[10014] No used module files found. The source file
[StandaloneMmCpu.h] is existing in module directory but it is not
described in INF file."

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 5007 in StandaloneMmCore
Sami Mujawar [Thu, 3 Dec 2020 20:52:01 +0000 (20:52 +0000)]
StandaloneMmPkg: Fix ECC error 5007 in StandaloneMmCore

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

Fix ECC error "[5007] There should be no initialization of a variable
as part of its declaration Variable."

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 5007 in StandaloneMmCpu
Sami Mujawar [Thu, 3 Dec 2020 20:22:22 +0000 (20:22 +0000)]
StandaloneMmPkg: Fix ECC error 5007 in StandaloneMmCpu

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

Fix ECC error "[5007] There should be no initialization of a variable
as part of its declaration Variable."

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 5007 in StandaloneMmCoreEntryPoint
Sami Mujawar [Thu, 3 Dec 2020 19:49:51 +0000 (19:49 +0000)]
StandaloneMmPkg: Fix ECC error 5007 in StandaloneMmCoreEntryPoint

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

Fix ECC error "[5007] There should be no initialization of a variable
as part of its declaration Variable."

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 4002 in FwVol helper
Sami Mujawar [Thu, 3 Dec 2020 19:39:00 +0000 (19:39 +0000)]
StandaloneMmPkg: Fix ECC error 4002 in FwVol helper

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

Fix ECC Error "[4002] Function header doesn't exist
Function [MmCoreFfsFindMmDriver] has NO comment immediately
preceding it."

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 3002 in StandaloneMmCpu
Sami Mujawar [Thu, 3 Dec 2020 18:33:58 +0000 (18:33 +0000)]
StandaloneMmPkg: Fix ECC error 3002 in StandaloneMmCpu

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

Fix the ECC tool reported error "[3002] Non-Boolean comparisons
should use a compare operator".

Also fix the following:
 - add curly braces for 'if' condition statements to comply
   with the coding standard.
 - The value returned by GET_GUID_HOB_DATA() is stored in
   *HobData. Therefore, check *HobData against NULL. The
   original code was checking HobData which is incorrect.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 1001 in SMM Memory pool management
Sami Mujawar [Thu, 3 Dec 2020 13:56:48 +0000 (13:56 +0000)]
StandaloneMmPkg: Fix ECC error 1001 in SMM Memory pool management

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

Fix the following error reported by the Ecc tool:
[1001] 'TAB' character is not allowed in source code, please
replace each 'TAB' with two spaces.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix ECC error 9002 in Core dispatcher
Sami Mujawar [Thu, 3 Dec 2020 12:41:43 +0000 (12:41 +0000)]
StandaloneMmPkg: Fix ECC error 9002 in Core dispatcher

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

Fix the ECC reported error "[9002] The function headers should follow
Doxygen special documentation blocks in section 2.3.5 in Comment"

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Fix spell check reported errors
Sami Mujawar [Thu, 3 Dec 2020 12:30:25 +0000 (12:30 +0000)]
StandaloneMmPkg: Fix spell check reported errors

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

Fix the spelling mistakes reported by the spell check utility
that is run as part of the Core CI.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Add library files to DSC
Sami Mujawar [Thu, 3 Dec 2020 11:33:03 +0000 (11:33 +0000)]
StandaloneMmPkg: Add library files to DSC

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

The Core CI reports a critical error if the library files are
not included in the DSC.

Therefore, add the missing library files to the package DSC.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoStandaloneMmPkg: Add library header files to DEC
Sami Mujawar [Thu, 3 Dec 2020 11:10:37 +0000 (11:10 +0000)]
StandaloneMmPkg: Add library header files to DEC

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

Declare the library header files in the package DEC file to
fix errors reported by Core CI.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoMdeModulePkg/Library/VarCheckLib: Allow SetVariable from SMM
Michael D Kinney [Wed, 6 Jan 2021 03:48:55 +0000 (19:48 -0800)]
MdeModulePkg/Library/VarCheckLib: Allow SetVariable from SMM

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

Update VarCheckLibSetVariableCheck() to allow locked variables
to be updated if the RequestSource is VarCheckFromTrusted even
if one or more variable check handlers return EFI_WRITE_PROTECTED.
RequestSource is only set to VarCheckFromTrusted if the request
is through the EFI_SMM_VARAIBLE_PROTOCOL.

Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
3 years agoIntelFsp2Pkg: Support FSP private temporary memory.
Chasel Chiu [Tue, 5 Jan 2021 08:55:25 +0000 (16:55 +0800)]
IntelFsp2Pkg: Support FSP private temporary memory.

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

In FSP the temporary memory provided by bootloader typically will be
totally given to PeiCore as Heap, but in some cases FSP may have to
reserve some more temporary memory for private usage.

This commit adds this flexibility for FSP to reserve some
temporary memory before giving them to PeiCore.

Cc: Maurice Ma <maurice.ma@intel.com>
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>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoArmPkg: Fix Ecc error 5007 in DefaultExceptionHandlerLib
Pierre Gondois [Tue, 15 Dec 2020 17:16:02 +0000 (17:16 +0000)]
ArmPkg: Fix Ecc error 5007 in DefaultExceptionHandlerLib

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Fixing this error implies extracting the CpsrChar
array from CpsrString and making it a static variable.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5007 in StandaloneMmMmuLib
Pierre Gondois [Thu, 10 Dec 2020 13:14:49 +0000 (13:14 +0000)]
ArmPkg: Fix Ecc error 5007 in StandaloneMmMmuLib

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5007 in SemihostLib
Pierre Gondois [Thu, 10 Dec 2020 13:14:07 +0000 (13:14 +0000)]
ArmPkg: Fix Ecc error 5007 in SemihostLib

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5007 in SemiHostingSerialPortLib
Pierre Gondois [Thu, 10 Dec 2020 13:13:23 +0000 (13:13 +0000)]
ArmPkg: Fix Ecc error 5007 in SemiHostingSerialPortLib

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5007 in ArmMmuLib
Pierre Gondois [Thu, 10 Dec 2020 13:12:36 +0000 (13:12 +0000)]
ArmPkg: Fix Ecc error 5007 in ArmMmuLib

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5007 in ArmLib
Pierre Gondois [Thu, 10 Dec 2020 13:12:00 +0000 (13:12 +0000)]
ArmPkg: Fix Ecc error 5007 in ArmLib

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5007 in ArmDisassemblerLib
Pierre Gondois [Thu, 10 Dec 2020 13:10:42 +0000 (13:10 +0000)]
ArmPkg: Fix Ecc error 5007 in ArmDisassemblerLib

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5007 in ArmCacheMaintenanceLib
Pierre Gondois [Thu, 10 Dec 2020 13:10:05 +0000 (13:10 +0000)]
ArmPkg: Fix Ecc error 5007 in ArmCacheMaintenanceLib

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5007 in SemihostFs
Pierre Gondois [Thu, 10 Dec 2020 13:09:30 +0000 (13:09 +0000)]
ArmPkg: Fix Ecc error 5007 in SemihostFs

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5007 in TimerDxe
Pierre Gondois [Thu, 10 Dec 2020 13:08:14 +0000 (13:08 +0000)]
ArmPkg: Fix Ecc error 5007 in TimerDxe

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5007 in CpuDxe
Pierre Gondois [Thu, 10 Dec 2020 13:07:43 +0000 (13:07 +0000)]
ArmPkg: Fix Ecc error 5007 in CpuDxe

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5007 in ArmScmiDxe
Pierre Gondois [Thu, 10 Dec 2020 13:05:24 +0000 (13:05 +0000)]
ArmPkg: Fix Ecc error 5007 in ArmScmiDxe

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5007 in CompilerIntrinsicsLib
Pierre Gondois [Thu, 10 Dec 2020 13:04:26 +0000 (13:04 +0000)]
ArmPkg: Fix Ecc error 5007 in CompilerIntrinsicsLib

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5005 in ArmExceptionLib
Pierre Gondois [Thu, 10 Dec 2020 10:55:34 +0000 (10:55 +0000)]
ArmPkg: Fix Ecc error 5005 in ArmExceptionLib

This patch fixes the following Ecc reported error:
The body of a function should be contained by open
and close braces that must be in the first column

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 5005 in CpuDxe
Pierre Gondois [Thu, 10 Dec 2020 10:54:12 +0000 (10:54 +0000)]
ArmPkg: Fix Ecc error 5005 in CpuDxe

This patch fixes the following Ecc reported error:
The body of a function should be contained by open
and close braces that must be in the first column

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 3001 in SemihostFs
Pierre Gondois [Thu, 10 Dec 2020 10:46:33 +0000 (10:46 +0000)]
ArmPkg: Fix Ecc error 3001 in SemihostFs

This patch fixes the following Ecc reported error:
Boolean values and variable type BOOLEAN should not use
explicit comparisons to TRUE or FALSE

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 3002 in ArmDisassemblerLib
Pierre Gondois [Thu, 10 Dec 2020 10:40:51 +0000 (10:40 +0000)]
ArmPkg: Fix Ecc error 3002 in ArmDisassemblerLib

This patch fixes the following Ecc reported error:
Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 3002 in SemihostFs
Pierre Gondois [Thu, 10 Dec 2020 10:38:26 +0000 (10:38 +0000)]
ArmPkg: Fix Ecc error 3002 in SemihostFs

This patch fixes the following Ecc reported error:
Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 3002 in CpuDxe
Pierre Gondois [Thu, 10 Dec 2020 16:50:22 +0000 (16:50 +0000)]
ArmPkg: Fix Ecc error 3002 in CpuDxe

This patch fixes the following Ecc reported error:
Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 3002 in MmCommunicationDxe
Pierre Gondois [Thu, 10 Dec 2020 10:18:56 +0000 (10:18 +0000)]
ArmPkg: Fix Ecc error 3002 in MmCommunicationDxe

This patch fixes the following Ecc reported error:
Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 3002 in TimerDxe
Pierre Gondois [Thu, 10 Dec 2020 10:18:19 +0000 (10:18 +0000)]
ArmPkg: Fix Ecc error 3002 in TimerDxe

This patch fixes the following Ecc reported error:
Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 3002 in ArmMmuLib
Pierre Gondois [Thu, 10 Dec 2020 10:17:24 +0000 (10:17 +0000)]
ArmPkg: Fix Ecc error 3002 in ArmMmuLib

This patch fixes the following Ecc reported error:
Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 3002 in OpteeLib
Pierre Gondois [Thu, 10 Dec 2020 10:16:13 +0000 (10:16 +0000)]
ArmPkg: Fix Ecc error 3002 in OpteeLib

This patch fixes the following Ecc reported error:
Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Fix Ecc error 3002 in CompilerIntrinsicsLib
Pierre Gondois [Thu, 10 Dec 2020 10:11:59 +0000 (10:11 +0000)]
ArmPkg: Fix Ecc error 3002 in CompilerIntrinsicsLib

This patch fixes the following Ecc reported error:
Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Brackets are also added to comply to with the coding
standard.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPkg: Format header to fix Ecc crash in ArmMmuLib
Pierre Gondois [Thu, 5 Nov 2020 15:57:44 +0000 (15:57 +0000)]
ArmPkg: Format header to fix Ecc crash in ArmMmuLib

The header of the file is not formatted properly, making
the Ecc tool crash when running on the ArmPkg.

The following command was run:
  ./BaseTools/BinWrappers/PosixLike/Ecc
    -c BaseTools/Source/Python/Ecc/config.ini
    -e BaseTools/Source/Python/Ecc/exception.xml
    -t ArmPkg -r ArmPkgEcc.xls

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoMdeModulePkg BrotliCustomDecompressLib: Remove the duplicated functions
gaoliming [Wed, 30 Dec 2020 06:30:22 +0000 (14:30 +0800)]
MdeModulePkg BrotliCustomDecompressLib: Remove the duplicated functions

The same functions have been defined in BrotliDecUefiSupport.c.

Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
3 years agoMdeModulePkg/ConSplitter: Change StdErr color to EFI_LIGHTGRAY
Samer El-Haj-Mahmoud [Sun, 20 Dec 2020 13:53:55 +0000 (21:53 +0800)]
MdeModulePkg/ConSplitter: Change StdErr color to EFI_LIGHTGRAY

ConSplitter is using EFI_LIGHTGRAY foreground color for ConOut
and EFI_MAGENTA for StdErr consoles. This is impacting the DebugLib
output on that same serial console (e.g. DebugLibSerialPort) after
gEfiStandardErrorDeviceGuid is installed on that port. The impact
also extends to Linux serial console output in OVMF because it inherits
the color setting from the firmware.

This is inconsistent and annoying, with MAGENTA being barely legible on
a black background.

Let's change StdErr default color to LIGHTGRAY for consistency and
readability. This results in the same color being used for all consoles
sharing the same serial port (ConOut, StdErr, DebugLib, OS console).
Platforms wishing to distinguish the colors of consoles can do so in
their own Platform BDS initialization.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Ard Biesheuvel <Ard.Biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
Tested-by: Pete Batard <pete@akeo.ie>
(On an RPi 4 platform where this was another annoyance)

3 years agoMdeModulePkg/Graphics: Fix spelling mistakes
Samer El-Haj-Mahmoud [Sun, 20 Dec 2020 13:53:54 +0000 (21:53 +0800)]
MdeModulePkg/Graphics: Fix spelling mistakes

Fix various spelling mistakes in GraphicsConsoleDxe, ConsPlitter,
and SimpleTextOut header

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Ard Biesheuvel <Ard.Biesheuvel@arm.com>
Cc: Pete Batard <pete@akeo.ie>
Signed-off-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
3 years agoMdeModulePkg/GraphicsConsoleDxe: Change default CursorVisible to FALSE
Samer El-Haj-Mahmoud [Sun, 20 Dec 2020 13:53:53 +0000 (21:53 +0800)]
MdeModulePkg/GraphicsConsoleDxe: Change default CursorVisible to FALSE

REF: https://github.com/pftf/RPi4/issues/115

GraphicsConsoleDxe defaults the ConOut Mode.CursorVisible to TRUE.
However, the driver never draws the cursor during init. This results
in the first call to disable the cursor (using ConOut->EnableCursor(FALSE))
to actually draw the cursor on the screen, as the logic in FlushCursor
depends on the Mode.CursorVisible state to determine if it should draw or
erase the cursor.

Fix by changing the default CursorVisible in this driver to FALSE.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Ard Biesheuvel <Ard.Biesheuvel@arm.com>
Cc: Pete Batard <pete@akeo.ie>
Signed-off-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
Tested-by: Pete Batard <pete@akeo.ie>
(On an RPi4 platform where we had this annoyance of an unwanted cursor
displaying on top of the platform logo)

3 years agoBaseTools/CommonLib.h: Build failed due to MAX_LONG_FILE_PATH
Enze Zhu [Thu, 17 Dec 2020 02:19:52 +0000 (10:19 +0800)]
BaseTools/CommonLib.h: Build failed due to MAX_LONG_FILE_PATH

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

We had a build fail due to the hard coded MAX_LONG_FILE_PATH value.
We should use PATH_MAX if it is available.

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: Enze Zhu <zhuenze@byosoft.com.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
3 years agoBaseTools: Fix the improper error logging
Irene Park [Tue, 29 Dec 2020 01:46:54 +0000 (09:46 +0800)]
BaseTools: Fix the improper error logging

EdkLogger.ERROR() was replaced with EdkLogger.error() to deliver the
expected error message when an error occurs.

Signed-off-by: Irene Park <ipark@nvidia.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoBaseTools: Fix the issue caused by tostring() removal on Py39
Bob Feng [Tue, 29 Dec 2020 09:03:53 +0000 (17:03 +0800)]
BaseTools: Fix the issue caused by tostring() removal on Py39

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

Python 3.9 remove the array.array.tostring and
array.array.fromstring() function. This patch
is to use other method to replace tostring() and
fromstring()

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: Mingyue Liang <mingyuex.liang@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoNetworkPkg/DnsDxe: cosmetic fixups
wenyi,xie via groups.io [Fri, 4 Dec 2020 07:05:03 +0000 (15:05 +0800)]
NetworkPkg/DnsDxe: cosmetic fixups

add whitespace according to coding style.

Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
3 years agoArmPlatformPkg/NorFlashDxe: implement standalone MM version
Masahisa Kojima [Fri, 18 Dec 2020 10:05:16 +0000 (19:05 +0900)]
ArmPlatformPkg/NorFlashDxe: implement standalone MM version

Implement a version of the NOR Flash driver that can execute
in standalone MM context.
This is used to access the secure variable storage, it only
supports EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg/NorFlashDxe: factor out DXE specific pieces
Masahisa Kojima [Fri, 18 Dec 2020 10:05:15 +0000 (19:05 +0900)]
ArmPlatformPkg/NorFlashDxe: factor out DXE specific pieces

In preparation of creating a standalone MM version of the
NOR Flash driver, refactor the existing pieces into a core
driver. NorFlashDxe.c has the DXE instantiation code,
FVB initialization code and some common functions.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 8005
Pierre Gondois [Fri, 13 Nov 2020 12:39:38 +0000 (12:39 +0000)]
ArmPlatformPkg: Fix Ecc error 8005

This patch fixes the following Ecc reported error:
Variable name does not follow the rules:
1. First character should be upper case
2. Must contain lower case characters
3. No white space characters
4. Global variable name must start with a 'g'

Indeed, according to the EDK II C Coding Standards
Specification, s5.6.2.2 "Enumerated Types" and
s4.3.4 Function and Data Names, elements of an
enumerated type shoud be a mixed upper- and
lower-case text.

A max element is also added, as advised by
s5.6.2.2.3 of the same document.

Reference:
https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoMdeModulePkg/Bus/Pci/PciBusDxe: Support PCIe Resizable BAR Capability
Luo, Heng [Mon, 4 Jan 2021 06:59:54 +0000 (14:59 +0800)]
MdeModulePkg/Bus/Pci/PciBusDxe: Support PCIe Resizable BAR Capability

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

Add PcdPcieResizableBarSupport to enable/disable PCIe Resizable
BAR Capability fearture.
Program the Resizable BAR Register if the device suports PCIe Resizable
BAR Capability and PcdPcieResizableBarSupport is TRUE.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Heng Luo <heng.luo@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
3 years agoMdePkg: Define structures for Resizable BAR Capability
Luo, Heng [Mon, 4 Jan 2021 06:59:53 +0000 (14:59 +0800)]
MdePkg: Define structures for Resizable BAR Capability

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

Define structures for Resizable BAR Capability in
MdePkg/Include/IndustryStandard/PciExpress21.h,
Change ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
to use new structures.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Heng Luo <heng.luo@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoRedfishPkg/DxeRestExLib: DxeRestExLib
Abner Chang [Thu, 17 Dec 2020 14:38:54 +0000 (22:38 +0800)]
RedfishPkg/DxeRestExLib: DxeRestExLib

Add EFI REST EX helper library to create child instance of
REST EX service.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Fan Wang <fan.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Peter O'Hanley <peter.ohanley@hpe.com>
Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
3 years agoMdeModulePkg/VarCheckPolicyLib: implement standalone MM version
Masahisa Kojima [Mon, 21 Dec 2020 06:17:34 +0000 (14:17 +0800)]
MdeModulePkg/VarCheckPolicyLib: implement standalone MM version

This commit adds the VarCheckPolicyLib that will be able to
execute in the context of standalone MM.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Co-authored-by: Kun Qin <kun.q@outlook.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoBaseTools: Should always define PCD TOKEN value as Zero for static PCD
Yunhua Feng [Thu, 17 Dec 2020 01:09:51 +0000 (09:09 +0800)]
BaseTools: Should always define PCD TOKEN value as Zero for static PCD

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3120
FixedAtBuild, PatchableInModule and FeatureFlag PCD don't use PCD TOKEN.
Their PCD TOKEN value can always be zero.
AutoGen.h will not be changed when static PCD is added or removed.
Dynamic PCD add or remove will still cause dynamic PCD token value be
changed.

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: Yunhua Feng <fengyunhua@byosoft.com.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
3 years ago.mergify: Enable Mergify for stable/* branches
Michael D Kinney [Sat, 19 Dec 2020 02:21:10 +0000 (18:21 -0800)]
.mergify: Enable Mergify for stable/* branches

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoOvmfPkg/.azurepipelines: Enable EDK II CI for stable/* branches
Michael D Kinney [Sat, 19 Dec 2020 02:19:09 +0000 (18:19 -0800)]
OvmfPkg/.azurepipelines: Enable EDK II CI for stable/* branches

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

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoEmulatorPkg/.azurepipelines: Enable EDK II CI for stable/* branches
Michael D Kinney [Sat, 19 Dec 2020 02:18:21 +0000 (18:18 -0800)]
EmulatorPkg/.azurepipelines: Enable EDK II CI for stable/* branches

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

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>