]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
4 years agoEmulatorPkg/Win/Host: Fix image unload regression
Michael D Kinney [Thu, 22 Aug 2019 02:36:09 +0000 (10:36 +0800)]
EmulatorPkg/Win/Host: Fix image unload regression

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

When UEFI Applications or UEFI Drivers are unloaded,
the PeCoffLoaderUnloadImageExtraAction() needs to unload
the image using FreeLibrary() if the image was successfully
loaded using LoadLibrrayEx().

This is a regression from the Nt32Pkg that supported
unloading applications and drivers as well as loading
the same application or driver multiple times.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>
Tested-by: Tim Lewis <tim.lewis@insyde.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
4 years agoBaseTools: Incorrect error message for library instance not found
Feng, Bob C [Wed, 21 Aug 2019 04:03:05 +0000 (12:03 +0800)]
BaseTools: Incorrect error message for library instance not found

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2099
This is a regression issue introduced by commit e8449e.

This patch is to fix this issue.

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Fix incremental build genmake issue
Feng, Bob C [Wed, 21 Aug 2019 09:50:54 +0000 (17:50 +0800)]
BaseTools: Fix incremental build genmake issue

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

This is a regression issue introduced by commit e8449e.
This patch is going to fix this issue.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Support long file path in windows for misc functions
Shi, Steven [Thu, 22 Aug 2019 02:43:59 +0000 (10:43 +0800)]
BaseTools: Support long file path in windows for misc functions

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

Current CopyFileOnChange() and SaveFileOnChange() in
BaseTools\Source\Python\Common\Misc.py don't use the dedicated
long file path API to handle the file path strings and cannot
support the long file path copy and save in windows. This patch
enhances them to support the long file path copy and save
correctly.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Steven Shi <steven.shi@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoOvmfPkg/OvmfXen: use RealTimeClockRuntimeDxe from EmbeddedPkg
Anthony PERARD [Tue, 13 Aug 2019 11:31:19 +0000 (12:31 +0100)]
OvmfPkg/OvmfXen: use RealTimeClockRuntimeDxe from EmbeddedPkg

A Xen PVH guest doesn't have a RTC that OVMF would expect, so
PcatRealTimeClockRuntimeDxe fails to initialize and prevent the
firmware from finish to boot. To prevent that, we will use
XenRealTimeClockLib which simply always return the same time.
This will work on both Xen PVH and HVM guests.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-36-anthony.perard@citrix.com>

4 years agoOvmfPkg: Move XenRealTimeClockLib from ArmVirtPkg
Anthony PERARD [Tue, 13 Aug 2019 11:31:18 +0000 (12:31 +0100)]
OvmfPkg: Move XenRealTimeClockLib from ArmVirtPkg

Move XenRealTimeClockLib from ArmVirtPkg to OvmfPkg so it can be used
from the OvmfPkg by the following patch, "OvmfPkg/OvmfXen: use
RealTimeClockRuntimeDxe from EmbeddedPkg"

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-35-anthony.perard@citrix.com>

4 years agoOvmfPkg: Introduce XenIoPvhDxe to initialize Grant Tables
Anthony PERARD [Tue, 13 Aug 2019 11:31:17 +0000 (12:31 +0100)]
OvmfPkg: Introduce XenIoPvhDxe to initialize Grant Tables

XenIoPvhDxe use XenIoMmioLib to reserve some space to be use by the
Grant Tables.

The call is only done if it is necessary, we simply detect if the
guest is PVH, as in this case there is currently no PCI bus, and no
PCI Xen platform device which would start the XenIoPciDxe and allocate
the space for the Grant Tables.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-34-anthony.perard@citrix.com>

4 years agoOvmfPkg: Introduce PcdXenGrantFrames
Anthony PERARD [Tue, 13 Aug 2019 11:31:16 +0000 (12:31 +0100)]
OvmfPkg: Introduce PcdXenGrantFrames

Introduce PcdXenGrantFrames to replace a define in XenBusDxe and allow
the same value to be used in a different module.

The reason for the number of page to be 4 doesn't exist anymore, so
simply remove the comment.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-33-anthony.perard@citrix.com>

4 years agoOvmfPkg/PlatformBootManagerLib: Use a Xen console for ConOut/ConIn
Anthony PERARD [Tue, 13 Aug 2019 11:31:15 +0000 (12:31 +0100)]
OvmfPkg/PlatformBootManagerLib: Use a Xen console for ConOut/ConIn

On a Xen PVH guest, none of the existing serial or console interface
works, so we add a new one, based on XenConsoleSerialPortLib, and
implemented via SerialDxe.

That is a simple console implementation that can work on both PVH
guest and HVM guests, even if it is rarely going to be used on HVM.

Have PlatformBootManagerLib look for the new console, when running as a
Xen guest.

Since we use VENDOR_UART_DEVICE_PATH, fix its description and coding
style.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-32-anthony.perard@citrix.com>

4 years agoOvmfPkg/OvmfXen: Introduce XenTimerDxe
Anthony PERARD [Tue, 13 Aug 2019 11:31:14 +0000 (12:31 +0100)]
OvmfPkg/OvmfXen: Introduce XenTimerDxe

"OvmfPkg/8254TimerDxe" is replaced with a Xen-specific
EFI_TIMER_ARCH_PROTOCOL implementation. Also remove
8259InterruptControllerDxe as it is not used anymore.

This Timer uses the local APIC timer as time source as it can work on
both a Xen PVH guest and an HVM one.

Based on the "OvmfPkg/8254TimerDxe" implementation.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-31-anthony.perard@citrix.com>

4 years agoOvmfPkg/OvmfXen: Override PcdFSBClock to Xen vLAPIC timer frequency
Anthony PERARD [Tue, 13 Aug 2019 11:31:13 +0000 (12:31 +0100)]
OvmfPkg/OvmfXen: Override PcdFSBClock to Xen vLAPIC timer frequency

PcdFSBClock is used by SecPeiDxeTimerLibCpu, the TimerLib
implementation. It will also be used by XenTimerDxe. Override
PcdFSBClock to match Xen vLAPIC timer frequency.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-30-anthony.perard@citrix.com>

4 years agoOvmfPkg/PlatformBootManagerLib: Handle the absence of PCI bus on Xen PVH
Anthony PERARD [Tue, 13 Aug 2019 11:31:12 +0000 (12:31 +0100)]
OvmfPkg/PlatformBootManagerLib: Handle the absence of PCI bus on Xen PVH

When running in a Xen PVH guest, there's nothing to do in
PciAcpiInitialization() because there isn't any PCI bus. When the Host
Bridge DID isn't recognised, simply continue. (The value of
PcdOvmfHostBridgePciDevId would be 0 because it isn't set.)

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-29-anthony.perard@citrix.com>

4 years agoOvmfPkg/PlatformBootManagerLib: Use XenDetected from XenPlatformLib
Anthony PERARD [Tue, 13 Aug 2019 11:31:11 +0000 (12:31 +0100)]
OvmfPkg/PlatformBootManagerLib: Use XenDetected from XenPlatformLib

Replace the XenDetected() implementation by the one from
XenPlatformLib.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-28-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenPlatformLib: Cache result for XenDetected
Anthony PERARD [Tue, 13 Aug 2019 11:31:10 +0000 (12:31 +0100)]
OvmfPkg/XenPlatformLib: Cache result for XenDetected

We are going to replace XenDetected() implementation in
PlatformBootManagerLib by the one in XenPlatformLib.
PlatformBootManagerLib's implementation does cache the result of
GetFirstGuidHob(), so we do something similar in XenPlatformLib.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-27-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenPlatformPei: Ignore missing PCI Host Bridge on Xen PVH
Anthony PERARD [Tue, 13 Aug 2019 11:31:09 +0000 (12:31 +0100)]
OvmfPkg/XenPlatformPei: Ignore missing PCI Host Bridge on Xen PVH

When the device ID of the host bridge is unknown, check if we are
running as a PVH guest as there is no PCI bus in that case.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-26-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenPlatformPei: Reserve VGA memory region, to boot Linux
Anthony PERARD [Tue, 13 Aug 2019 11:31:08 +0000 (12:31 +0100)]
OvmfPkg/XenPlatformPei: Reserve VGA memory region, to boot Linux

Linux panic if the VGA region isn't reserved.

When Linux is booted on EFI system, it expects the memory at 0xa0000 to
_not_ be conventional memory. Otherwise a variable isn't initialised
properly and Linux panic when a virtual console/terminal is asked to be
created.

See for more detail:
https://lists.xenproject.org/archives/html/xen-devel/2019-03/msg02139.html

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-25-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenPlatformPei: Rework memory detection
Anthony PERARD [Tue, 13 Aug 2019 11:31:07 +0000 (12:31 +0100)]
OvmfPkg/XenPlatformPei: Rework memory detection

When running as a Xen PVH guest, there is no CMOS to read the memory
size from.  Rework GetSystemMemorySize(Below|Above)4gb() so they can
work without CMOS by reading the e820 table.

Rework XenPublishRamRegions to also care for the reserved and ACPI
entry in the e820 table. The region that was added by InitializeXen()
isn't needed as that same entry is in the e820 table provided by
hvmloader.

MTRR settings aren't modified anymore, on HVM it's already done by
hvmloader, on PVH it is supposed to have sane default. MTRR will need
to be done properly but keeping what's already been done by programs
that have run before OVMF will do for now.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-24-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenPlatformPei: no hvmloader: get the E820 table via hypercall
Anthony PERARD [Tue, 13 Aug 2019 11:31:06 +0000 (12:31 +0100)]
OvmfPkg/XenPlatformPei: no hvmloader: get the E820 table via hypercall

When the Xen PVH entry point has been used, hvmloader hasn't run and
hasn't prepared an E820 table. The only way left to get an E820 table
is to ask Xen via an hypercall.  We keep the result cached to avoid
making a second hypercall which would give the same result.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-23-anthony.perard@citrix.com>

4 years agoOvmfPkg: Import XENMEM_memory_map hypercall to Xen/memory.h
Anthony PERARD [Tue, 13 Aug 2019 11:31:05 +0000 (12:31 +0100)]
OvmfPkg: Import XENMEM_memory_map hypercall to Xen/memory.h

The informations to make a XENMEM_memory_map hypercall is copied over
from the public header of the Xen Project, with the type name modified
to build on OVMF.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-22-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenPlatformPei: Introduce XenPvhDetected
Anthony PERARD [Tue, 13 Aug 2019 11:31:04 +0000 (12:31 +0100)]
OvmfPkg/XenPlatformPei: Introduce XenPvhDetected

XenPvhDetected() can be used to figure out if OVMF has started via the
Xen PVH entry point.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-21-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenPlatformPei: Setup HyperPages earlier
Anthony PERARD [Tue, 13 Aug 2019 11:31:03 +0000 (12:31 +0100)]
OvmfPkg/XenPlatformPei: Setup HyperPages earlier

We are going to need to make an hypercall in order to retreive the E820
table from the hypervisor before been able to setup the memory.

Calling XenConnect earlier will allow to setup the XenHypercallLib
earlier to allow to make hypercalls.

While here, add some comments in XenConnect().

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-20-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenPlatformPei: Introduce XenHvmloaderDetected
Anthony PERARD [Tue, 13 Aug 2019 11:31:02 +0000 (12:31 +0100)]
OvmfPkg/XenPlatformPei: Introduce XenHvmloaderDetected

This new XenHvmloaderDetected() return true if the hvmloader firmware
has runned before OVMF.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-19-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenPlatformPei: Reinit XenHypercallLib
Anthony PERARD [Tue, 13 Aug 2019 11:31:01 +0000 (12:31 +0100)]
OvmfPkg/XenPlatformPei: Reinit XenHypercallLib

The XenPlatformPei needs to make hypercalls, but the XenHypercallLib was
initialised before the HyperPage was ready. Now that XenPlatformPei has
initialised the HyperPage, reinitialise the XenHypercallLib.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-18-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenHypercallLib: Enable it in PEIM
Anthony PERARD [Tue, 13 Aug 2019 11:31:00 +0000 (12:31 +0100)]
OvmfPkg/XenHypercallLib: Enable it in PEIM

Allow to use Xen hypercalls earlier, during the PEIM stage, but
XenHypercallLibInit() must be called once the XenInfo HOB is created
with the HyperPage setup.

Change the return value of XenHypercallLibInit so failure can be
detected when the call shouldn't fail, but still have the constructor
always succeed.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-17-anthony.perard@citrix.com>

4 years agoOvmfPkg/AcpiPlatformDxe: Use Xen PVH RSDP if it exist
Anthony PERARD [Tue, 13 Aug 2019 11:30:59 +0000 (12:30 +0100)]
OvmfPkg/AcpiPlatformDxe: Use Xen PVH RSDP if it exist

If the firmware have been started via the Xen PVH entry point, a RSDP
pointer would have been provided. Use it.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-16-anthony.perard@citrix.com>

4 years agoOvmfPkg/AcpiPlatformDxe: Use XenPlatformLib
Anthony PERARD [Tue, 13 Aug 2019 11:30:58 +0000 (12:30 +0100)]
OvmfPkg/AcpiPlatformDxe: Use XenPlatformLib

This patch replace the XenDetected() function by the one in
XenPlatformLib.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-15-anthony.perard@citrix.com>

4 years agoOvmfPkg/Library/XenPlatformLib: New library
Anthony PERARD [Tue, 13 Aug 2019 11:30:57 +0000 (12:30 +0100)]
OvmfPkg/Library/XenPlatformLib: New library

The purpose of XenPlatformLib is to regroup the few functions that are
used in several places to detect if Xen is detected, and to get the
XenInfo HOB.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-14-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenPlatformPei: Grab RSDP from PVH guest start of day struct
Anthony PERARD [Tue, 13 Aug 2019 11:30:56 +0000 (12:30 +0100)]
OvmfPkg/XenPlatformPei: Grab RSDP from PVH guest start of day struct

Check if there's a start of the day struct provided to PVH guest, save
the ACPI RSDP address for later.

This patch import import arch-x86/hvm/start_info.h from xen.git.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-13-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenPlatformPei: Use mXenHvmloaderInfo to get E820
Anthony PERARD [Tue, 13 Aug 2019 11:30:55 +0000 (12:30 +0100)]
OvmfPkg/XenPlatformPei: Use mXenHvmloaderInfo to get E820

Use the already checked pointer mXenHvmloaderInfo to retrieve the E820
table produced by hvmloader.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-12-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenPlatformPei: Detect OVMF_INFO from hvmloader
Anthony PERARD [Tue, 13 Aug 2019 11:30:54 +0000 (12:30 +0100)]
OvmfPkg/XenPlatformPei: Detect OVMF_INFO from hvmloader

EFI_XEN_OVMF_INFO is only useful to retrieve the E820 table. The
mXenHvmloaderInfo isn't used yet, but will be use in a further patch to
retrieve the E820 table.

Also remove the unused pointer from the XenInfo HOB as that information
is only useful in the XenPlatformPei.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-11-anthony.perard@citrix.com>

4 years agoOvmfPkg/OvmfXen: use a TimerLib instance that depends only on the CPU
Anthony PERARD [Tue, 13 Aug 2019 11:30:53 +0000 (12:30 +0100)]
OvmfPkg/OvmfXen: use a TimerLib instance that depends only on the CPU

The ACPI Timer isn't present in a PVH guest, but local APIC works on
both PVH and HVM.

Note that the use of SecPeiDxeTimerLibCpu might be an issue with a
driver of type DXE_RUNTIME_DRIVER. I've attempted to find out which of
the DXE_RUNTIME_DRIVER uses the TimerLib at runtime. I've done that by
replacing the TimerLib evaluation in
[LibraryClasses.common.DXE_RUNTIME_DRIVER] by a different one and
checking every module that uses it (with the --report-file=report
build option).

ResetSystemRuntimeDxe is calling the TimerLib API at runtime to do the
operation "EfiResetCold", so this may never complete if the OS have
disabled the Local APIC Timer.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-10-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenResetVector: Allow jumpstart from either hvmloader or PVH
Anthony PERARD [Tue, 13 Aug 2019 11:30:52 +0000 (12:30 +0100)]
OvmfPkg/XenResetVector: Allow jumpstart from either hvmloader or PVH

This patch allows the ResetVector to be run indenpendently from build
time addresses.

The goal of the patch is to avoid having to create RAM just below 4G
when creating a Xen PVH guest while being compatible with the way
hvmloader currently load OVMF, just below 4G.

Only the new PVH entry point will do the calculation.

The ResetVector will figure out its current running address by creating
a temporary stack, make a call and calculate the difference between the
build time address and the address at run time.

This patch copies and make the necessary modification to some other asm
files:
- copy of UefiCpuPkg/.../Flat32ToFlat64.asm:
  Allow Transition32FlatTo64Flat to be run from anywhere in memory
- copy of UefiCpuPkg/../SearchForBfvBase.asm:
  Add a extra parameter to indicate where to start the search for the
  boot firmware volume.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-9-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenResetVector: Saving start of day pointer for PVH guests
Anthony PERARD [Tue, 13 Aug 2019 11:30:51 +0000 (12:30 +0100)]
OvmfPkg/XenResetVector: Saving start of day pointer for PVH guests

As described in the Xen PVH documentation [1], "ebx: contains the
physical memory address where the loader has placed the boot start info
structure". To have this pointer saved to be able to use it later in the
PEI phase, we allocate some space in the MEMFD for it. We use 'XPVH' as
a signature (for "Xen PVH").

[1] https://xenbits.xenproject.org/docs/unstable/misc/pvh.html

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-8-anthony.perard@citrix.com>

4 years agoOvmfPkg/XenResetVector: Add new entry point for Xen PVH
Anthony PERARD [Tue, 13 Aug 2019 11:30:50 +0000 (12:30 +0100)]
OvmfPkg/XenResetVector: Add new entry point for Xen PVH

Add a new entry point for Xen PVH that enter directly in 32bits.

Information on the expected state of the machine when this entry point
is used can be found at:
https://xenbits.xenproject.org/docs/unstable/misc/pvh.html

Also, compare to the original file [1], the two `nop' of the "resetVector"
entry point are removed. There were introduced by 8332983e2e33
("UefiCpuPkg: Replace the un-necessary WBINVD instruction at the reset
vector with two NOPs in VTF0.", 2011-08-04), but don't seems to be
useful. This is the entry point used by HVM guest (hvmloader).

[1] UefiCpuPkg/ResetVector/Vtf0/Ia16/ResetVectorVtf0.asm

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-7-anthony.perard@citrix.com>

4 years agoOvmfPkg/OvmfXen: Creating an ELF header
Anthony PERARD [Tue, 13 Aug 2019 11:30:49 +0000 (12:30 +0100)]
OvmfPkg/OvmfXen: Creating an ELF header

This patch changes the flash device image of OvmfXen to make it look
like it's an ELF. For this, we replace the empty embedded variable store
by a binary array, which is a ELF file header.

The ELF header explain to a loader to load the binary at the address
1MB, then jump to the PVH entry point which will be created in a later
patch. The header also includes a Xen ELF note that is part of the
PVH ABI.

That patch include OvmfXenElfHeaderGenerator.c which can be use to
regenerate the ELF header, but this will be a manual step.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-6-anthony.perard@citrix.com>

4 years agoOvmfPkg: Introduce XenPlatformPei
Anthony PERARD [Tue, 13 Aug 2019 11:30:48 +0000 (12:30 +0100)]
OvmfPkg: Introduce XenPlatformPei

Introduce XenPlatformPei, a copy of OvmfPkg/PlatformPei without some
of QEMU specific initialization, Xen does not support QemuFwCfg.

This new module will be adjusted to accommodate Xen PVH.

fw_cfg dependents that have been removed, which are dynamically skipped
when running PlatformPei on Xen:
- GetFirstNonAddress(): controlling the 64-bit PCI MMIO aperture via the
(experimental) "opt/ovmf/X-PciMmio64Mb" file
- GetFirstNonAddress(): honoring the hotplug DIMM area
("etc/reserved-memory-end") in the placement of the 64-bit PCI MMIO
aperture
- NoexecDxeInitialization() is removed, so PcdPropertiesTableEnable and
PcdSetNxForStack are left constant FALSE (not set dynamically from
fw_cfg "opt/ovmf/PcdXxxx")
- MaxCpuCountInitialization(), PublishPeiMemory(): the max CPU count is
not taken from the QemuFwCfgItemSmpCpuCount fw_cfg key;
PcdCpuMaxLogicalProcessorNumber is used intact and
PcdCpuApInitTimeOutInMicroSeconds is never changed or used.
- InitializeXenPlatform(), S3Verification(): S3 is assumed disabled (not
consulting "etc/system-states" via QemuFwCfgS3Enabled()).
- InstallFeatureControlCallback(): the feature control MSR is not set
from "etc/msr_feature_control"
(also removed FeatureControl.c as there is nothing been executed)

Also removed:
- SMRAM/TSEG-related low mem size adjusting (PcdSmmSmramRequire is
assumed FALSE) in PublishPeiMemory(),
- QemuInitializeRam() entirely,

Xen related changes:
- Have removed the module variable mXen, as it should be always true.
- Have the platform PEI initialization fails if Xen has not been
  detected.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-5-anthony.perard@citrix.com>

4 years agoOvmfPkg: Introduce XenResetVector
Anthony PERARD [Tue, 13 Aug 2019 11:30:47 +0000 (12:30 +0100)]
OvmfPkg: Introduce XenResetVector

Introduce XenResetVector, a copy of OvmfPkg/ResetVector, with one
changes:
  - SEC_DEFAULT_CR0: enable cache (bit 30 or CD set to 0)

Xen copies the OVMF code to RAM, there is no need to disable cache.

This new module will later be modified to add a new entry point, more
detail in a following commit "OvmfPkg/XenResetVector: Add new entry point
for Xen PVH"

Value FILE_GUID of XenResetVector have not changed compare to ResetVector
because it is a special value (gEfiFirmwareVolumeTopFileGuid).

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-4-anthony.perard@citrix.com>

4 years agoOvmfPkg: Create platform OvmfXen
Anthony PERARD [Tue, 13 Aug 2019 11:30:46 +0000 (12:30 +0100)]
OvmfPkg: Create platform OvmfXen

OvmfXen is a copy of OvmfX64, removing VirtIO and some SMM.

This new platform will be changed to make it works on two types of Xen
guest: HVM and PVH.

Compare to OvmfX64, this patch:

- changed: PLATFORM_GUID, OUTPUT_DIRECTORY, FLASH_DEFINITION
- removed: VirtioLib class resolution
- removed: all UEFI_DRIVER modules for virtio devices
- removed: DXE_SMM_DRIVER and SMM_CORE lib class resolutions
- removed: DXE_SMM_DRIVER and SMM_CORE FDF rules
- removed: Everything related to SMM_REQUIRE==true
- removed: Everything related to SECURE_BOOT_ENABLE==true
- removed: Everything related to TPM2_ENABLE==true
- changed: PcdPciDisableBusEnumeration dynamic default flipped to TRUE
- changed: default FD_SIZE_IN_KB to 2M.
- reverted d272449d9e1e, "OvmfPkg: raise DXEFV size to 11 MB"

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-3-anthony.perard@citrix.com>

4 years agoOvmfPkg/ResetSystemLib: Add missing dependency on PciLib
Anthony PERARD [Tue, 13 Aug 2019 11:30:45 +0000 (12:30 +0100)]
OvmfPkg/ResetSystemLib: Add missing dependency on PciLib

Add missing dependency on PciLib
and remove extra includes of OvmfPlatforms.h.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190813113119.14804-2-anthony.perard@citrix.com>

4 years agoUefiCpuPkg: Adding a new TSC library by using CPUID(0x15) TSC leaf
Donald Kuo [Mon, 12 Aug 2019 04:34:39 +0000 (12:34 +0800)]
UefiCpuPkg: Adding a new TSC library by using CPUID(0x15) TSC leaf

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

Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Amy Chan <amy.chan@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Signed-off-by: Donald Kuo <donald.kuo@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoUefiCpuPkg/CpuCommonFeaturesLib: Use new macros.
Dong, Eric [Fri, 16 Aug 2019 03:57:30 +0000 (11:57 +0800)]
UefiCpuPkg/CpuCommonFeaturesLib: Use new macros.

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

Below code is current implementation:
  if (MsrRegister[ProcessorNumber].Bits.Lock == 0) {
    CPU_REGISTER_TABLE_WRITE_FIELD (
      ProcessorNumber,
      Msr,
      MSR_IA32_FEATURE_CONTROL,
      MSR_IA32_FEATURE_CONTROL_REGISTER,
      Bits.Lock,
      1
    );
  }

1. In first normal boot, the Bits.Lock is 0, 1 will be added
   into the register table and then will set to the MSR.
2. Trig warm reboot, MSR value preserves. After normal boot phase,
   the Bits.Lock is 1, so it will not be added into the register
   table during the warm reboot phase.
3. Trig S3 then resume, the Bits.Lock change to 0 and Bits.Lock is
   not added in register table, so it's still 0 after resume. This
   is not an expect behavior. The expect value is the value should
   always 1 after booting or resuming from S3.

The root cause for this issue is
1. driver bases on current value to insert the "set value action" to
   the register table.
2. Some MSRs may reserve their value during warm reboot.

The solution for this issue is using new added macros for the MSRs which
preserve value during warm reboot.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Supports test then write new value logic.
Dong, Eric [Fri, 16 Aug 2019 03:57:29 +0000 (11:57 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Supports test then write new value logic.

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

Supports new logic which test current value before write new value.
Only write new value when current value not same as new value.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Combine CR read/write action.
Dong, Eric [Fri, 16 Aug 2019 03:57:28 +0000 (11:57 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Combine CR read/write action.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Supports test then write new value logic.
Dong, Eric [Fri, 16 Aug 2019 03:57:27 +0000 (11:57 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Supports test then write new value logic.

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

Supports new logic which test current value before write new value.
Only write new value when current value not same as new value.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Combine CR read/write action.
Dong, Eric [Fri, 16 Aug 2019 03:57:26 +0000 (11:57 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Combine CR read/write action.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Add "Test Then Write" Macros.
Dong, Eric [Fri, 16 Aug 2019 03:57:25 +0000 (11:57 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Add "Test Then Write" Macros.

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

Add below new micros which test the current value before write the new
value. Only write new value when current value not same as new value.
  CPU_REGISTER_TABLE_TEST_THEN_WRITE32
  CPU_REGISTER_TABLE_TEST_THEN_WRITE64
  CPU_REGISTER_TABLE_TEST_THEN_WRITE_FIELD

Also add below API:
  CpuRegisterTableTestThenWrite

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: don't free page table pages that are required to handle...
Damian Nikodem [Mon, 19 Aug 2019 17:48:45 +0000 (01:48 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: don't free page table pages that are required to handle current page fault

Reclaim may free page table pages that are required to handle current page
fault. This causes a page leak, and, after sufficent number of specific
page fault+reclaim pairs, we run out of reclaimable pages and hit:

ASSERT (MinAcc != (UINT64)-1);

To remedy, prevent pages essential to handling current page fault:
(1) from being considered as reclaim candidates (first reclaim phase)
(2) from being freed as part of "branch cleanup" (second reclaim phase)

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Krzysztof Rusocki <krzysztof.rusocki@intel.com>
4 years agoMdeModulePkg DxeCore: Fix for missing Memory Attributes Table (MAT) update
Mike Turner [Fri, 16 Aug 2019 15:39:35 +0000 (23:39 +0800)]
MdeModulePkg DxeCore: Fix for missing Memory Attributes Table (MAT) update

The Fpdt driver (FirmwarePerformanceDxe) saves a memory address across
reboots, and then does an AllocatePage for that memory address.
If, on this boot, that memory comes from a Runtime memory bucket,
the MAT table is not updated. This causes Windows to boot into Recovery.

This patch blocks the memory manager from changing the page
from a special bucket to a different memory type.  Once the buckets are
allocated, we freeze the memory ranges for the OS, and fragmenting
the special buckets will cause errors resuming from hibernate (S4).

The references to S4 here are the use case that fails.  This
failure is root caused to an inconsistent behavior of the
core memory services themselves when type AllocateAddress is used.

The main issue is apparently with the UEFI memory map -- the UEFI memory
map reflects the pre-allocated bins, but the actual allocations at fixed
addresses may go out of sync with that. Everything else, such as:
- EFI_MEMORY_ATTRIBUTES_TABLE (page protections) being out of sync,
- S4 failing
are just symptoms / consequences.

This patch is cherry pick from Project Mu:
https://github.com/microsoft/mu_basecore/commit/a9be767d9be96af94016ebd391ea6f340920735a
With the minor change,
1. Update commit message format to keep the message in 80 characters one line.
2. Remove // MU_CHANGE comments in source code.
3. Update comments style to follow edk2 style.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Acked-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoBaseTools: Update incorrect variable name 'DataPile'
Fan, ZhijuX [Tue, 20 Aug 2019 00:48:53 +0000 (08:48 +0800)]
BaseTools: Update incorrect variable name 'DataPile'

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

The PlatformAutoGen object has a DataPipe property but no DataPile property
So change the variable name 'DataPile' to 'DataPipe' in BuildReport.py

This patch is going to fix that issue.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Improve the file saving and copying reliability
Shi, Steven [Thu, 15 Aug 2019 14:26:21 +0000 (22:26 +0800)]
BaseTools: Improve the file saving and copying reliability

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

The Basetool CopyFileOnChange() and SaveFileOnChange()
functions might raise the IOError occasionally when build
in Windows with multi-process and build cache enabled.
The CopyFileOnChange() and SaveFileOnChange() might be invoked
in multiple sub-processes simultaneously, and this patch adds
global locks to sync these functions invoking which can
harden their reliability.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Steven Shi <steven.shi@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoBaseTools: Add GenFds multi-thread support in build cache
Shi, Steven [Thu, 15 Aug 2019 14:26:20 +0000 (22:26 +0800)]
BaseTools: Add GenFds multi-thread support in build cache

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

Fix the issue that the GenFds multi-thread will build fail
if enable the build cache together.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Steven Shi <steven.shi@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoBaseTools: Change the [Arch][Name] module key in Build cache
Shi, Steven [Thu, 15 Aug 2019 14:26:19 +0000 (22:26 +0800)]
BaseTools: Change the [Arch][Name] module key in Build cache

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

Current build cache use the module's [self.Arch][self.Name]
info as the ModuleAutoGen object key in hash list and dictionary.
The [self.Arch][self.Name] is not safe as the module key because
there could be two modules with same module name and arch name in
one platform. E.g. A platform can override a module or library
instance in another different path, the overriding module can has
the same module name and arch name as the original one.
Directly use the ModuleAutoGen obj self as the key, because
the obj __hash__ and __repr__ attributes already contain the
full path and arch name.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Steven Shi <steven.shi@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoBaseTools: Print first cache missing file for build cachle
Shi, Steven [Thu, 15 Aug 2019 14:26:18 +0000 (22:26 +0800)]
BaseTools: Print first cache missing file for build cachle

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

When a module build cache miss, add support to print the first
cache missing file path and name.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Steven Shi <steven.shi@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoBaseTools: Improve the cache hit in the edk2 build cache
Shi, Steven [Thu, 15 Aug 2019 14:26:17 +0000 (22:26 +0800)]
BaseTools: Improve the cache hit in the edk2 build cache

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

Current cache hash algorithm does not parse and generate
the makefile to get the accurate dependency files for a
module. It instead use the platform and package meta files
to get the module depenedency in a quick but over approximate
way. These meta files are monolithic and involve many redundant
dependency for the module, which cause the module build
cache miss easily.
This patch introduces one more cache checkpoint and a new
hash algorithm besides the current quick one. The new hash
algorithm leverages the module makefile to achieve more
accurate and precise dependency info for a module. When
the build cache miss with the first quick hash, the
Basetool will caculate new one after makefile is generated
and then check again.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Steven Shi <steven.shi@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoShellPkg/UefiShellDriver1CommandsLib: Make array big enough
Zhichao Gao [Mon, 15 Jul 2019 06:45:29 +0000 (14:45 +0800)]
ShellPkg/UefiShellDriver1CommandsLib: Make array big enough

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

The two CHAR16 array ChildCountStr and DeviceCountStr is
defined to hold the decimal string data of UINTN. The max
of UINTN is 18446744073709551615 and it contain 20 characters.
So make their size to 21 CHAR16s to hold the string data with
a null-terminate.
UnicodeValueToStringS regard the value input as INT64, and
21 CHARs is enough to hold the lowest value with minus '-'.
Although the value shouldn't be such big.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Oleksiy <oleksiyy@ami.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Linson Augustine <Linson.augustine@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoBaseTools/tools_def.template: Add -gdwarf to XCODE5 X64
Andrew Fish [Thu, 15 Aug 2019 20:11:59 +0000 (13:11 -0700)]
BaseTools/tools_def.template: Add -gdwarf to XCODE5 X64

Add -gdwarf to XCODE5 X64 builds to generate symbols for
source level debug using lldb.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Andrew Fish <afish@apple.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Andrew Fish <afish@apple.com>
4 years agoEmulatorPkg/Sec: Change scope of PpiArray[10]
Andrew Fish [Thu, 15 Aug 2019 20:00:31 +0000 (13:00 -0700)]
EmulatorPkg/Sec: Change scope of PpiArray[10]

The local variable PpiArray[10] is declared in the middle
of the SEC module _ModuleEntryPoint() with its own scope.
However, PpiArray has a dangling reference to its location
on the stack after the scope is closed.  This causes issues
with some compilers (e.g. XCODE5).

The fix is to move the declaration of PpiArray[10] to
the beginning of the function, so it is scoped correctly
for all references to this local variable and references
to its location.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Andrew Fish <afish@apple.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Andrew Fish <afish@apple.com>
4 years agoEmulatorPkg: Disable TftpDynamicCommand and LogoDxe for XCODE5
Andrew Fish [Thu, 15 Aug 2019 16:59:41 +0000 (09:59 -0700)]
EmulatorPkg: Disable TftpDynamicCommand and LogoDxe for XCODE5

Disable TftpDynamicCommand for XCODE5 because this command
places HII content in an PE/COFF resource section that is not
supported by the XCODE5 tool chain, and the missing HII
content causes the load of this command to ASSERT().

Disable the LogoDxe module that places the logo bitmap in
a PE/COFF resource section that is not supported by the
XCODE5 tool chain, and the missing HII content causes
the load of this module to ASSERT().

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Andrew Fish <afish@apple.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Andrew Fish <afish@apple.com>
4 years agoEmulatorPkg/Unix/Host: Remove debug code from BerkeleyPacketFilter.c
Andrew Fish [Fri, 16 Aug 2019 21:34:02 +0000 (14:34 -0700)]
EmulatorPkg/Unix/Host: Remove debug code from BerkeleyPacketFilter.c

Remove old debug code that generates an exception.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Andrew Fish <afish@apple.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Andrew Fish <afish@apple.com>
4 years agoEmulatorPkg/Unix/Host: Initialize field in BerkeleyPacketFilter.c
Andrew Fish [Thu, 15 Aug 2019 16:55:06 +0000 (09:55 -0700)]
EmulatorPkg/Unix/Host: Initialize field in BerkeleyPacketFilter.c

Initialize Private->ReadBuffer to NULL.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Andrew Fish <afish@apple.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Andrew Fish <afish@apple.com>
4 years agoEmulatorPkg: Fix XCODE5 lldb issues
Andrew Fish [Thu, 15 Aug 2019 16:50:01 +0000 (09:50 -0700)]
EmulatorPkg: Fix XCODE5 lldb issues

Fix scripts to support lldb symbolic debugging when
using XCODE5 tool chain.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Andrew Fish <afish@apple.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Andrew Fish <afish@apple.com>
4 years agoEmulatorPkg/Unix/Host: Disable inline/optimizations for XCODE5
Andrew Fish [Thu, 15 Aug 2019 16:48:57 +0000 (09:48 -0700)]
EmulatorPkg/Unix/Host: Disable inline/optimizations for XCODE5

* Disable XCODE5 compiler optimizations fort Unix/Host.
* Disable inline of SecGdbScriptBreak() to improve
  compatibility with XCODE5
* For X64 XCODE5 builds place output Host application
  in $(BIN_DIR) to match all other EmulatorPkg Host
  application builds.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Andrew Fish <afish@apple.com>
4 years agoEmulatorPkg: Add support for NOOPT target
Michael D Kinney [Fri, 9 Aug 2019 22:00:01 +0000 (15:00 -0700)]
EmulatorPkg: Add support for NOOPT target

Add NOOPT to BUILD_TARGETS in DSC file.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Andrew Fish <afish@apple.com>
4 years agoEmulatorPkg: Add -D DISABLE_NEW_DEPRECATED_INTERFACES
Michael D Kinney [Wed, 7 Aug 2019 00:10:03 +0000 (17:10 -0700)]
EmulatorPkg: Add -D DISABLE_NEW_DEPRECATED_INTERFACES

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

Update EmulatorPkg specific modules and libraries to use
safe string functions in BaseLib and safe PcdSetxx()
functions in PcdLib.  With these updates, the define
DISABLE_NEW_DEPRECATED_INTERFACES is enabled in the DSC
file.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Andrew Fish <afish@apple.com>
4 years agoEmulatorPkg: Remove UNIX_SEC_BUILD/WIN_SEC_BUILD
Michael D Kinney [Thu, 8 Aug 2019 02:18:56 +0000 (19:18 -0700)]
EmulatorPkg: Remove UNIX_SEC_BUILD/WIN_SEC_BUILD

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

Remove the use of the defines UNIX_SEC_BUILD and
WIN_SEC_BUILD.  This simplifies the build command
for the EmulatorPkg.  Instead, use !if statements
in the DSC file using $(ARCH) and $(FAMILY) to
determine if the build is for a Windows or POSIX
environment.

The Readme.md, BAT, and sh files are also updated
to remove the use of these defines.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Andrew Fish <afish@apple.com>
4 years agoEmulatorPkg: Fix VS20xx IA32 boot failure
Michael D Kinney [Tue, 6 Aug 2019 19:37:19 +0000 (12:37 -0700)]
EmulatorPkg: Fix VS20xx IA32 boot failure

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

The IA32 build of the EmulatorPkg for VS20xx does not boot
because the default value of PCD PcdPeiServicesTablePage
rarely succeeds to be mapped on IA32 Windows Host Environments.
Change the DEC default value for this PCD to a value that
is compatible with Windows and POSIX host environments for
IA32 and X64.  For IA32 builds, this 64-bit PCD is truncated
to a 32-bit value.

PcdPeiServicesTablePage is changed from 0x1003000000 to
0x1013000000.  With this new value, no boot failures are
observed.  However, the use of this hard coded value can
potentially cause a boot failure if this address specified
by the PCD is already allocated in the user process.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Andrew Fish <afish@apple.com>
4 years agoBaseTools: Fixed issue of incorrect Module Unique Name
Feng, Bob C [Fri, 16 Aug 2019 05:52:46 +0000 (13:52 +0800)]
BaseTools: Fixed issue of incorrect Module Unique Name

https://bugzilla.tianocore.org/show_bug.cgi?id=2088
If there are more than one override instance for a same module,
the Module Unique Name is generated incorrectly.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Steven Shi <steven.shi@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoShellPkg/UefiShellAcpiViewCommandLib: Replace shift logical left
Shenglei Zhang [Thu, 15 Aug 2019 07:32:59 +0000 (15:32 +0800)]
ShellPkg/UefiShellAcpiViewCommandLib: Replace shift logical left

Replace the operation to shift logical left with the function
LShiftU64, which has the same functionality.
The original code causes ShellPkg build failure with build
target"-b NOOPT".

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoCryptoPkg: Fix coding style
Shenglei Zhang [Fri, 16 Aug 2019 06:50:35 +0000 (14:50 +0800)]
CryptoPkg: Fix coding style

Update attribute "Out" to "out".
The original "Out" can not pass ECC check.

Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoUefiCpuPkg/Cpuid: Add description for parameter LeafFunction
Shenglei Zhang [Thu, 15 Aug 2019 08:13:46 +0000 (16:13 +0800)]
UefiCpuPkg/Cpuid: Add description for parameter LeafFunction

LeafFunction needs to be described in comments.
https://bugzilla.tianocore.org/show_bug.cgi?id=2052

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoShellPkg/UefiShellAcpiViewCommandLib: Initialize local variables
Shenglei Zhang [Thu, 15 Aug 2019 05:35:42 +0000 (13:35 +0800)]
ShellPkg/UefiShellAcpiViewCommandLib: Initialize local variables

At latest edk2 version, there is build failure when building ShellPkg
with VS2012x86, which results from uninitialized local variables.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoCryptoPkg/OpensslLib: Add missing header files in INF file
Shenglei Zhang [Tue, 13 Aug 2019 16:50:17 +0000 (16:50 +0000)]
CryptoPkg/OpensslLib: Add missing header files in INF file

The header files are used but missing in INF,which causes
warning message when building them.
https://bugzilla.tianocore.org/show_bug.cgi?id=2036

Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoSecurityPkg/SecurityPkg.uni: Add missing strings for new PCDs
Jian J Wang [Wed, 14 Aug 2019 08:58:58 +0000 (16:58 +0800)]
SecurityPkg/SecurityPkg.uni: Add missing strings for new PCDs

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

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Shenglei Zhang <shenglei.zhang@intel.com>
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
4 years agoMdeModulePkg/DxeIplPeim: Initialize pointer PageMapLevel5Entry
Zhang, Shenglei [Thu, 15 Aug 2019 02:23:14 +0000 (10:23 +0800)]
MdeModulePkg/DxeIplPeim: Initialize pointer PageMapLevel5Entry

Initialize PageMapLevel5Entry at the beginning of the function.

This commit will fix a GCC 4.8.5 build failure introduced by commit
b3527dedc3951f061c5a73cb4fb2b0f95f47e08b.

OvmfPkg build failure wtih gcc 4.8.5 still exists at latest edk2 version.
The commit 46f8a6891606746ca8b1e684ac379ce271306dc0 seems not to fix
the build failure completely.

Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoBaseTools/Capsule: Tool to generate Windows Firmware Update Driver
Jin, Eric [Mon, 12 Aug 2019 07:45:12 +0000 (15:45 +0800)]
BaseTools/Capsule: Tool to generate Windows Firmware Update Driver

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

The tool is designed to generate Windows Firmware Update Drivers,
the input is one drivername.cap with related parameters, the output
Windows Driver package are composed by drivername.cap, drivername.inf
and drivername.cat to update the single payload in device.

usage:
GenerateWindowsDriver [-h] [--output-folder OUTPUTFOLDER]
                      [--product-fmp-guid PRODUCTFMPGUID]
                      [--capsuleversion-dotstring CAPSULEVERSION_DOTSTRING]
                      [--capsuleversion-hexstring CAPSULEVERSION_HEXSTRING]
                      [--product-fw-provider PRODUCTFWPROVIDER]
                      [--product-fw-mfg-name PRODUCTFWMFGNAME]
                      [--product-fw-desc PRODUCTFWDESC]
                      [--capsule-file-name CAPSULEFILENAME]
                      [--pfx-file PFXFILE] [--arch ARCH]
                      [--operating-system-string OPERATINGSYSTEMSTRING]

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Kinney Michael D <michael.d.kinney@intel.com>
Signed-off-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoBaseTools/Capsule: Add WindowsCapsuleSupportHelper
Sean Brogan [Mon, 12 Aug 2019 07:43:59 +0000 (15:43 +0800)]
BaseTools/Capsule: Add WindowsCapsuleSupportHelper

Add initial version WindowsCapsuleSupportHelper.py
original source comes from
https://github.com/microsoft/mu_basecore/blob/dev/201905/BaseTools/Plugin/WindowsCapsuleSupportHelper/WindowsCapsuleSupportHelper.py
commit ebd9aad90dee3a3094b575928670cf81b8c685b5
Convert EOL to CRLF

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoFmpDevicePkg/FmpDxe: Remove use of CatSprint()
Eric Jin [Fri, 26 Jul 2019 07:48:44 +0000 (15:48 +0800)]
FmpDevicePkg/FmpDxe: Remove use of CatSprint()

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

The size overhead for CatSPrint() is large.  This function
is only used to generate variable names with HardwareInstance
value appended.  Use UnicodeValueToStringS() instead that is
much smaller.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoFmpDevicePkg/FmpDxe: Add PcdFmpDeviceStorageAccessEnable
Eric Jin [Fri, 26 Jul 2019 07:45:19 +0000 (15:45 +0800)]
FmpDevicePkg/FmpDxe: Add PcdFmpDeviceStorageAccessEnable

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

Add PCD PcdFmpDeviceStorageAccessEnable.  If this PCD is
TRUE, then the Firmware Management Protocol supports access
to the firmware storage device.  This is the default setting.
If FALSE, then Firmware Management Protocol services that
access the firmware storage device return EFI_UNSUPPORTED
except GetImageInfo().  Setting this value to FALSE produces
the smallest possible FmpDxe driver that still advertises the
updatable firmware component in the ESRT.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoFmpDevicePkg/FmpDxe: Add PcdFmpDeviceImageTypeIdGuid
Eric Jin [Fri, 26 Jul 2019 07:40:37 +0000 (15:40 +0800)]
FmpDevicePkg/FmpDxe: Add PcdFmpDeviceImageTypeIdGuid

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

Add PCD PcdFmpDeviceImageTypeIdGuid that contains an Image
Type ID GUID value that is used if one is not provided by
FmpDeviceLib. If this PCD is not a valid GUID value,  then
gEfiCallerIdGuid is used.

Update FmpDevicePkg DSC to use PcdFmpDeviceImageTypeIdGuid
as a PatchableInModule PCD.

This content is based on the following commit.

https://github.com/microsoft/mu_tiano_plus/commit/a2c7da88d3a73dbe9b6b75952d6866179c905f28#diff-025d4889f6d3a482b49638a25e432d6d

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoFmpDevicePkg/FmpDxe: Improve all DEBUG() messages
Eric Jin [Fri, 26 Jul 2019 07:34:31 +0000 (15:34 +0800)]
FmpDevicePkg/FmpDxe: Improve all DEBUG() messages

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

Update all DEBUG() messages to include the name of the
FMP device from PcdFmpDeviceImageIdName.

Based on content from the following commit, but expanded
to cover all DEBUG() messages.

https://github.com/microsoft/mu_tiano_plus/commit/a2c7da88d3a73dbe9b6b75952d6866179c905f28#diff-025d4889f6d3a482b49638a25e432d6d

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoFmpDevicePkg: Add Capsule Update Policy Protocol
Eric Jin [Sun, 11 Aug 2019 05:36:46 +0000 (13:36 +0800)]
FmpDevicePkg: Add Capsule Update Policy Protocol

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

* Add Capsule Update Policy Protocol to FmpDevicePkg
* Add CapsuleUpdatePolicyLib instance that uses the services
  of the Capsule Update Policy Protocol
* Add module that produces the Capsule Update Policy
  Protocol using the services of the CapsuleUpdatePolicyLib
  class.
* Update FmpDevicePkg DSC to build the new library instance
  and the new module and update builds of FmpDxe modules
  to demonstrate the use of the different CapsuleUpdatePolicyLib
  instances.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoFmpDevicePkg/FmpDxe: Different variable for each FMP Descriptor
Eric Jin [Mon, 12 Aug 2019 05:00:59 +0000 (13:00 +0800)]
FmpDevicePkg/FmpDxe: Different variable for each FMP Descriptor

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoFmpDevicePkg/FmpDxe: Use new FmpDeviceLib APIs
Eric Jin [Sun, 11 Aug 2019 03:38:13 +0000 (11:38 +0800)]
FmpDevicePkg/FmpDxe: Use new FmpDeviceLib APIs

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

Update FmpDxe to support multiple controllers and use
new FmpDeviceLib APIs to support Stop/Unload and to
set the context for the worker functions in the
FmpDeviceLib.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg/MdeModulePkg.dec: Remove gEfiDpcProtocolGuid
Shenglei Zhang [Mon, 12 Aug 2019 08:16:42 +0000 (16:16 +0800)]
MdeModulePkg/MdeModulePkg.dec: Remove gEfiDpcProtocolGuid

Since the transfer has been finished in previous patches,
gEfiDpcProtocolGuid can be removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1949

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoNetworkPkg: Move Dpc.h from MdeModulePkg to NetworkPkg
Shenglei Zhang [Mon, 12 Aug 2019 08:09:35 +0000 (16:09 +0800)]
NetworkPkg: Move Dpc.h from MdeModulePkg to NetworkPkg

Move Dpc.h from MdeModulePkg to NetworkPkg. And remove the
dependency on MdeModulePkg.dec in INFs.
https://bugzilla.tianocore.org/show_bug.cgi?id=1949

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoNetworkPkg: Add Dpc protocol
Shenglei Zhang [Mon, 12 Aug 2019 08:02:18 +0000 (16:02 +0800)]
NetworkPkg: Add Dpc protocol

To move Dpc.h from MdeModulePkg to NetworkPkg,
we need to introduce the Guid of protocol first.
https://bugzilla.tianocore.org/show_bug.cgi?id=1949

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoBaseTools/Scripts: Add GetUtcDateTime script.
Chasel Chiu [Thu, 8 Aug 2019 12:43:46 +0000 (20:43 +0800)]
BaseTools/Scripts: Add GetUtcDateTime script.

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

A script that can return UTC date and time in ascii
format which is convenient for patching build time
information in any binary.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoShellPkg/UefiShellAcpiViewCommandLib: Remove the variable "Index"
Shenglei Zhang [Wed, 14 Aug 2019 03:04:45 +0000 (11:04 +0800)]
ShellPkg/UefiShellAcpiViewCommandLib: Remove the variable "Index"

In IortParser.c ,the variable Index is set but not used in
function DumpIortNodeNamedComponent. This will cause build failure
when building ShellPkg with GCC.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoCryptoPkg/OpensslLib: remove clone commands
Jian J Wang [Mon, 8 Jul 2019 09:07:08 +0000 (17:07 +0800)]
CryptoPkg/OpensslLib: remove clone commands

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

edk2/Readme.md has added a section to explain the correct clone
commands for submodules. Detailed steps in the OpenSSL-HOWTO.txt
are removed to avoid any inconsistency.

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoReadme.md: add submodule policy and clone commands
Jian J Wang [Mon, 8 Jul 2019 09:02:42 +0000 (17:02 +0800)]
Readme.md: add submodule policy and clone commands

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

A section 'Submodules' is added to clarify the submodule policy
in edk2 repo. Git commands are also added to show the correct
way to clone submodule repos, in which '--recursive' is removed
because it's not needed but recommended in other document.

Related commits:
Openssl-1.1.1b upgrade: acfb90911840c38a0beb9bcfe0065668244d2b4d
berkeley-softfloat-3:   3cc57695df5a6e8c65fb46b993836c315cabf49d

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg/DxeCapsuleLibFmp: Improve comparisons in CapsuleOnDisk.c
Xu, Wei6 [Tue, 13 Aug 2019 10:53:49 +0000 (18:53 +0800)]
MdeModulePkg/DxeCapsuleLibFmp: Improve comparisons in CapsuleOnDisk.c

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

Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=).

Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/CapsuleApp: Improve comparisons in CapsuleOnDisk.c
Xu, Wei6 [Tue, 13 Aug 2019 10:53:17 +0000 (18:53 +0800)]
MdeModulePkg/CapsuleApp: Improve comparisons in CapsuleOnDisk.c

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

Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=).

Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoBaseTools: Move buildoptions.py to Common folder
Bob Feng [Tue, 13 Aug 2019 09:39:39 +0000 (17:39 +0800)]
BaseTools: Move buildoptions.py to Common folder

buildoptions is used by build.py and TargetTxtClassObj.py
Move buildoptions.py to Common folder so that
build tool and ECC tool work fine.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoFmpDEvicePkg/FmpDeviceLibNull: Implement new APIs
Eric Jin [Sun, 11 Aug 2019 03:04:32 +0000 (11:04 +0800)]
FmpDEvicePkg/FmpDeviceLibNull: Implement new APIs

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoFmpDevicePkg: Add APIs to FmpDeviceLib
Eric Jin [Sun, 11 Aug 2019 02:55:13 +0000 (10:55 +0800)]
FmpDevicePkg: Add APIs to FmpDeviceLib

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1525
Add new APIs to FmpDevideLib to support multiple controllers
* RegisterFmpUninstaller()
* FmpDeviceSetContext()
* FmpDeviceGetHardwareInstance()

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoFmpDevicePkg: Add UEFI_DRIVER support
Eric Jin [Fri, 26 Jul 2019 02:39:04 +0000 (10:39 +0800)]
FmpDevicePkg: Add UEFI_DRIVER support

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1525
Allow libs to be used with modules of type UEFI_DRIVE.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Fix checking for Sources section in INF file
Rodriguez, Christian [Mon, 12 Aug 2019 15:32:11 +0000 (23:32 +0800)]
BaseTools: Fix checking for Sources section in INF file

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

The check to see if [Sources] section lists all the header type
files of a module is missing the exclusion of source files that
fall under the scope of Package includes. This change adds the
exclusions.

Signed-off-by: Christian Rodriguez <christian.rodriguez@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Tested-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoBaseTools: Add "-" in a re to parse line in .map file
Feng, Bob C [Tue, 13 Aug 2019 01:56:37 +0000 (09:56 +0800)]
BaseTools: Add "-" in a re to parse line in .map file

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

If there are multiple module instances with different
guid used in .dsc file, the temp path of the module will
contain 8-4-4-4-12 format guid string. So "-" need to be
added into the regular expression for parsing it correctly.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Fix incremental build bug
Feng, Bob C [Tue, 13 Aug 2019 04:09:17 +0000 (12:09 +0800)]
BaseTools: Fix incremental build bug

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

This is a build tool regression issue that
is introduced by multiple-process-autogen.

The workspace timestamp value is not pass
to module autogen object correctly, so build tool
does not detect the change of .dsc and ignore the autogen.

This patch is to fix this issue.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
4 years agoMdeModulePkg/DxeIplPeim: Relocate operation of PageMapLevel5Entry++
Zhang, Shenglei [Mon, 12 Aug 2019 06:24:44 +0000 (14:24 +0800)]
MdeModulePkg/DxeIplPeim: Relocate operation of PageMapLevel5Entry++

This commit will fix a GCC 4.8.5 build failure introduced by commit
b3527dedc3951f061c5a73cb4fb2b0f95f47e08b.

PageMapLevel5Entry may be uninitialized in original code, which means
uninitialized pointer will be modified at some circumstance.
So relocate the operation of PageMapLevel5Entry++ in order to make sure
the pointer could be modified only when it is initialized.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>