]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
7 years agoArmVirtPkg/PlatformPeiLib: honor DT node 'status' property
Ard Biesheuvel [Tue, 4 Apr 2017 13:20:12 +0000 (14:20 +0100)]
ArmVirtPkg/PlatformPeiLib: honor DT node 'status' property

In some cases, (e.g., when running QEMU with TrustZone emulation), the
DT may contain DT nodes whose status is set to 'secure'. Similarly, the
status may be set to 'disabled' if the consumer of the DT image is
expected to treat it as if it weren't there.

So check whether a 'status' property is present, and if so, ignore the
node if the status is not 'okay'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoArmVirtPkg/FdtPL011SerialPortLib: honor DT node 'status' property
Ard Biesheuvel [Tue, 4 Apr 2017 13:07:16 +0000 (14:07 +0100)]
ArmVirtPkg/FdtPL011SerialPortLib: honor DT node 'status' property

In some cases, (e.g., when running QEMU with TrustZone emulation), the
DT may contain DT nodes whose status is set to 'secure'. Similarly, the
status may be set to 'disabled' if the consumer of the DT image is
expected to treat it as if it weren't there.

So check whether a 'status' property is present, and if so, ignore the
node if the status is not 'okay'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoArmVirtPkg/FdtClientDxe: honor memory DT node 'status' property
Ard Biesheuvel [Tue, 4 Apr 2017 12:55:44 +0000 (13:55 +0100)]
ArmVirtPkg/FdtClientDxe: honor memory DT node 'status' property

In some cases, (e.g., when running QEMU with TrustZone emulation), the
DT may contain memory nodes whose status is set to 'secure'. Similarly,
the status may be set to 'disabled' if the consumer of the DT image is
expected to treat it as if it weren't there.

So check whether a 'status' property is present, and if so, ignore the
node if the status is not 'okay'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoNetworkPkg: Fix some bugs related to iSCSI keyword configuration.
Zhang, Lubo [Fri, 24 Mar 2017 08:43:04 +0000 (16:43 +0800)]
NetworkPkg: Fix some bugs related to iSCSI keyword configuration.

Add check logic and error message for some keywords validity.
show target address in URL format and MAC address correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
7 years agoMdeModulePkg/DxeHttpLib: Avoid the pointless comparison of UINTN with zero
Jiaxin Wu [Sat, 1 Apr 2017 00:21:03 +0000 (08:21 +0800)]
MdeModulePkg/DxeHttpLib: Avoid the pointless comparison of UINTN with zero

UINTN is unsigned integer, so it's pointless to compare it with zero.

Cc: Bi Dandan <dandan.bi@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
7 years agoBaseTools: Enhance StrDefs.h to include ImageDefs.h
Yonghong Zhu [Fri, 31 Mar 2017 14:05:28 +0000 (22:05 +0800)]
BaseTools: Enhance StrDefs.h to include ImageDefs.h

Enhance StrDefs.h to include ImageDefs.h for VfrCompiler to support
IMAGE_TOKEN usage.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoBaseTools: Enhance expression to support some more operation
Yonghong Zhu [Fri, 31 Mar 2017 13:47:59 +0000 (21:47 +0800)]
BaseTools: Enhance expression to support some more operation

Enhance expression to support some more operation that allowed in the
spec, eg: *, /, %, <<, >>, ~.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoVlv2TbltDevicePkg: Fix build failure by adding UefiBootManagerLib
Ruiyu Ni [Sat, 1 Apr 2017 05:14:57 +0000 (13:14 +0800)]
Vlv2TbltDevicePkg: Fix build failure by adding UefiBootManagerLib

Recent ConPlatformDxe driver change depends on UefiBootManagerLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoMdePkg/Shell.h: Update Shell version from 2.1 to 2.2
Ruiyu Ni [Fri, 31 Mar 2017 14:23:13 +0000 (22:23 +0800)]
MdePkg/Shell.h: Update Shell version from 2.1 to 2.2

All the Shell 2.2 features are implemented except DMEM/MM
changes which are pending on spec change.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Kinney D Michael <kinney.d.michael@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Update saved SMM ranges check in SmmProfile
Jeff Fan [Tue, 28 Mar 2017 06:01:24 +0000 (14:01 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Update saved SMM ranges check in SmmProfile

SmmProfile feature required to protect all SMM ranges by structure
mProtectionMemRangeTemplate. This update is to add additonal save SMM ranges
into mProtectionMemRangeTemplate besides the range specified by
mCpuHotPlugData.SmrrBase/mCpuHotPlugData.SmrrSiz.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
7 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Add IsInSmmRanges() to check SMM range
Jeff Fan [Tue, 28 Mar 2017 05:51:52 +0000 (13:51 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Add IsInSmmRanges() to check SMM range

Internal function IsInSmmRanges() is added t check SMM range by saved SMM ranges
beside by mCpuHotPlugData.SmrrBase/mCpuHotPlugData.SmrrSiz.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
7 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Save SMM ranges info into global variables
Jeff Fan [Tue, 28 Mar 2017 00:48:17 +0000 (08:48 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Save SMM ranges info into global variables

v2:
  Add #define SMRR_MAX_ADDRESS to clarify SMRR requirement.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
7 years agoUefiCpuPkg/MtrrLib: Fix GCC build failure
Ruiyu Ni [Fri, 31 Mar 2017 14:04:17 +0000 (22:04 +0800)]
UefiCpuPkg/MtrrLib: Fix GCC build failure

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoShellPkg/setvar: Support data format in Shell 2.2 spec
Chen A Chen [Wed, 29 Mar 2017 02:23:09 +0000 (10:23 +0800)]
ShellPkg/setvar: Support data format in Shell 2.2 spec

Shell 2.2 spec defines =0x/=0X, =H/=h, =S, =L and =P for
hex number, hex array, ascii string, unicode string and
device path data.
The patch adds such support.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
7 years agoEmbeddedPkg/DtPlatformDxe: load platform DTB via new library
Ard Biesheuvel [Wed, 29 Mar 2017 11:05:01 +0000 (12:05 +0100)]
EmbeddedPkg/DtPlatformDxe: load platform DTB via new library

To give platforms some room to decide which DTB is suitable and where
to load it from, load the DTB image indirectly via the new
DtPlatformDtbLoaderLib library class.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoEmbeddedPkg: add base DtPlatformDtbLoaderLib implementation
Ard Biesheuvel [Fri, 31 Mar 2017 10:35:13 +0000 (11:35 +0100)]
EmbeddedPkg: add base DtPlatformDtbLoaderLib implementation

Introduce an implementation of the new DtPlatformDtbLoaderLib library
class that simply retrieves the first raw section of an FV file named
'gDtPlatformDefaultDtbFileGuid'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoEmbeddedPkg: add DtPlatformDtbLoaderLib library class
Ard Biesheuvel [Fri, 31 Mar 2017 10:32:36 +0000 (11:32 +0100)]
EmbeddedPkg: add DtPlatformDtbLoaderLib library class

To abstract the way a platform reasons about which DTB is appropriate,
and the way it ultimately supplies the DTB image, introduce a new library
class to encapsulate this functionality.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoEmbeddedPkg: add DtPlatformDxe to .dsc file
Ard Biesheuvel [Fri, 31 Mar 2017 12:16:40 +0000 (13:16 +0100)]
EmbeddedPkg: add DtPlatformDxe to .dsc file

Add the new DtPlatformDxe driver to EmbeddedPkg's .dsc file so that
we can build it outside the context of a platform.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoArmVirtPkg/PlatformHasAcpiDtDxe: allow guest level ACPI disable override
Ard Biesheuvel [Wed, 29 Mar 2017 17:50:39 +0000 (18:50 +0100)]
ArmVirtPkg/PlatformHasAcpiDtDxe: allow guest level ACPI disable override

In general, we should not present two separate (and inevitably different)
hardware descriptions to the OS, in the form of ACPI tables and a device
tree blob. For this reason, we recently added the logic to ArmVirtQemu to
only expose the ACPI 2.0 entry point if no DT binary is being passed, and
vice versa.

However, this is arguably a regression for those who relied on DT
descriptions being available, even if the former behavior can be
restored by passing the -no-acpi switch to QEMU.

So allow a secret handshake with the UEFI Shell, to set a variable that
will result in ACPI to be disabled on subsequent boots even if -no-acpi
was not passed on the QEMU command line.

  setvar -nv -bs -guid 50bea1e5-a2c5-46e9-9b3a-59596516b00a ForceNoAcpi =01

To delete the variable and revert to the old situation, simply omit the
value after the =

  setvar -nv -bs -guid 50bea1e5-a2c5-46e9-9b3a-59596516b00a ForceNoAcpi =

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
7 years agoBeagleBoardPkg: add missing BootLogoLib resolution
Ard Biesheuvel [Fri, 31 Mar 2017 09:44:32 +0000 (10:44 +0100)]
BeagleBoardPkg: add missing BootLogoLib resolution

Recent changes to the PlatformBootManagerLib implementation in ArmPkg
require its users to define a resolution for BootLogoLib. So add this
missing resolution to Beagle.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoBeagleBoardPkg: remove ArmCpuLib reference
Ard Biesheuvel [Fri, 31 Mar 2017 08:44:02 +0000 (09:44 +0100)]
BeagleBoardPkg: remove ArmCpuLib reference

ArmCpuLib is not used, and will be removed. So drop the reference from
our .DSC

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoArmVirtPkg: remove ArmCpuLib references
Ard Biesheuvel [Fri, 31 Mar 2017 08:43:14 +0000 (09:43 +0100)]
ArmVirtPkg: remove ArmCpuLib references

ArmCpuLib is never used anywhere, and is about to be removed. So remove
any references from our .DSC files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoBaseTools/GCC AARCH64: force disable PIC code generation
Ard Biesheuvel [Fri, 31 Mar 2017 08:22:56 +0000 (09:22 +0100)]
BaseTools/GCC AARCH64: force disable PIC code generation

As a security measure, some distro toolchains now default to PIC code
generation, allowing executables (as opposed to shared libraries) using
the objects to be built as PIE binaries, which can be loaded at a random
virtual offset.

However, our ELF to PE/COFF generation code does not deal with the
resulting relocation types (i.e., GOT based), and so the use of PIC code
leads to GenFw errors.

Given that
a) our non-PIC PE/COFF executables are already relocatable,
b) PIC code leads to all symbol references to be indirected via GOT
   entries containing absolute addresses, each requiring an entry in the
   relocation table,
c) the AArch64 ISA makes it perfectly feasible to built PIE executables
   from non-PIC code,

there is absolutely no upside to using PIC code for building EDK2 modules,
and so we're better off simply disabling it unconditionally.

Note that when running under the OS, the GOT has an additional advantage,
i.e., that all .text/.rodata pages remain clean and so can be shared between
processes. This does not apply to the UEFI environment, however.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
7 years agoUefiCpuPkg/MtrrLib: All functions use definitions in Msr.h
Ruiyu Ni [Fri, 2 Sep 2016 11:48:29 +0000 (19:48 +0800)]
UefiCpuPkg/MtrrLib: All functions use definitions in Msr.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
7 years agoUefiCpuPkg/MtrrLib: Refine MtrrGetMemoryAttributeByAddressWorker
Ruiyu Ni [Fri, 2 Sep 2016 10:10:45 +0000 (18:10 +0800)]
UefiCpuPkg/MtrrLib: Refine MtrrGetMemoryAttributeByAddressWorker

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
7 years agoUefiCpuPkg/MtrrLib: Use a better algorithm to calculate MTRR
Ruiyu Ni [Fri, 2 Sep 2016 04:09:54 +0000 (12:09 +0800)]
UefiCpuPkg/MtrrLib: Use a better algorithm to calculate MTRR

The new algorithm finds out the more optimal MTRR solution for
current memory type settings.
Compare against the original algorithm, the new one guarantees
to find the correct MTRR solution, but doesn't guarantee to
find the most optimal MTRR solution.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
7 years agoUefiCpuPkg/MtrrLib: MtrrLibInitializeMtrrMask() uses definitions in CpuId.h
Ruiyu Ni [Fri, 2 Sep 2016 12:23:35 +0000 (20:23 +0800)]
UefiCpuPkg/MtrrLib: MtrrLibInitializeMtrrMask() uses definitions in CpuId.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
7 years agoUefiCpuPkg/MtrrLib: Add MtrrLib prefix to several internal functions
Ruiyu Ni [Fri, 2 Sep 2016 02:45:53 +0000 (10:45 +0800)]
UefiCpuPkg/MtrrLib: Add MtrrLib prefix to several internal functions

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
7 years agoUefiCpuPkg/MtrrLib: Add MtrrLib prefix to ProgramFixedMtrr
Ruiyu Ni [Fri, 2 Sep 2016 02:41:28 +0000 (10:41 +0800)]
UefiCpuPkg/MtrrLib: Add MtrrLib prefix to ProgramFixedMtrr

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
7 years agoUefiCpuPkg/MtrrLib: GetVariableMtrrCountWorker uses definitions in Msr.h
Ruiyu Ni [Fri, 2 Sep 2016 02:35:45 +0000 (10:35 +0800)]
UefiCpuPkg/MtrrLib: GetVariableMtrrCountWorker uses definitions in Msr.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
7 years agoUefiCpuPkg/MtrrLib: IsMtrrSupported uses definitions in Msr.h
Ruiyu Ni [Fri, 2 Sep 2016 02:27:29 +0000 (10:27 +0800)]
UefiCpuPkg/MtrrLib: IsMtrrSupported uses definitions in Msr.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
7 years agoUefiCpuPkg/MtrrLib: Add CacheInvalid enum type to MtrrLib.h
Ruiyu Ni [Tue, 23 Aug 2016 02:38:02 +0000 (10:38 +0800)]
UefiCpuPkg/MtrrLib: Add CacheInvalid enum type to MtrrLib.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
7 years agoUefiCpuPkg/MtrrLib: Correct typo in comments and remove TABs
Ruiyu Ni [Thu, 18 Aug 2016 07:34:54 +0000 (15:34 +0800)]
UefiCpuPkg/MtrrLib: Correct typo in comments and remove TABs

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
7 years agoBaseTools: Update Brotli and BrotliCompress mode and format
Song, BinX [Thu, 30 Mar 2017 08:23:10 +0000 (16:23 +0800)]
BaseTools: Update Brotli and BrotliCompress mode and format

V2:
- Update correct patch info

V1:
- Add x mode for Brotli and BrotliCompress
- Change Brotli and BrotliCompress format from DOS to UNIX

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdeModulePkg/SmmCore: Fix memory leak on Profile unregistered.
Jiewen Yao [Mon, 27 Mar 2017 15:01:02 +0000 (23:01 +0800)]
MdeModulePkg/SmmCore: Fix memory leak on Profile unregistered.

Issue reported at bugzillar 445.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
7 years agoOvmfPkg: Allow multiple add-pointer linker commands to same ACPI table
Phil Dennis-Jordan [Thu, 30 Mar 2017 10:40:57 +0000 (23:40 +1300)]
OvmfPkg: Allow multiple add-pointer linker commands to same ACPI table

ACPI tables may contain multiple fields which point to the same
destination table. For example, in some revisions, the FADT contains
both DSDT and X_DSDT fields, and they may both point to the DSDT.

Previously, if Qemu created QEMU_LOADER_ADD_POINTER linker commands for
such instances, the linking process would attempt to install the same
pointed-to table repeatedly. For tables of which there must only be one
instance, the call to AcpiProtocol->InstallAcpiTable() would fail during
the second linker command pointing to the same table, thus entirely
aborting the ACPI table linking process. In the case of tables of which
there may be multiple instances, the table would end up duplicated.

This change adds a memoisation data structure which tracks the table
pointers that have already been processed; even if the same pointer is
encountered multiple times, it is only processed once.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: DSDT<->XSDT typo, debug msg, and coding style fixups]
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=368
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
7 years agoCryptoPkg/BaseCryptLib: Fix Build Warning issue in PEI Module
Qin Long [Thu, 30 Mar 2017 07:53:21 +0000 (15:53 +0800)]
CryptoPkg/BaseCryptLib: Fix Build Warning issue in PEI Module

The memory free operation is empty function in PEI. The compiler
optimization will bring the build warning in openssl/crypto/mem.c:
      warning C4718: 'CRYPTO_free': recursive call has no side
                     effects, deleting
This patch uses '/wd4718' to silence the build warning for PEI
module building.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
7 years agoMdeModulePkg/DxeHttpLib: Fix the incorrect return status if URI port is invalid
Jiaxin Wu [Mon, 27 Mar 2017 06:45:50 +0000 (14:45 +0800)]
MdeModulePkg/DxeHttpLib: Fix the incorrect return status if URI port is invalid

Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
7 years agoMdePkg/UefiDevicePathLib: Refine the DevPathFromTextiSCSI protocol parsing
Jiaxin Wu [Fri, 24 Mar 2017 01:53:50 +0000 (09:53 +0800)]
MdePkg/UefiDevicePathLib: Refine the DevPathFromTextiSCSI protocol parsing

For current iSCSI protocol parsing, UINT16 truncation may be happened. Since
the Spec already have declaimed that 0 is TCP Protocol and 1+ is reserved, the
parsing can be refined as below:

  if (StrCmp (ProtocolStr, L"TCP") == 0) {
    ISCSIDevPath->NetworkProtocol = 0;
  } else {
    //
    // Undefined and reserved.
    //
    ISCSIDevPath->NetworkProtocol = 1;
  }

Cc: Warner Losh <imp@bsdimp.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Warner Losh <imp@bsdimp.com>
7 years agoNetworkPkg/DnsDxe: Fix zero StationIp configuration failure of DNSv6
Jiaxin Wu [Thu, 23 Mar 2017 03:35:14 +0000 (11:35 +0800)]
NetworkPkg/DnsDxe: Fix zero StationIp configuration failure of DNSv6

According UEFI Spec, set to zero StationIp means to let the underlying
IPv6 driver choose a source address. But currently, DNSv6 always return
EFI_NO_MAPPING. The issue is caused by below bugs in DnsDxe:
* Incorrect TPL(TPL_CALLBACK) usage during UDP configuration.
* Failed to create the timer used to get IPv6 mapping
* Doesn't check the Ip6Mode.IsStarted flag.

Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
7 years agoMdeModulePkg/PeiCore: avoid EFI_IMAGE_MACHINE_TYPE_SUPPORTED to check arch
Ard Biesheuvel [Mon, 27 Mar 2017 12:22:16 +0000 (13:22 +0100)]
MdeModulePkg/PeiCore: avoid EFI_IMAGE_MACHINE_TYPE_SUPPORTED to check arch

The EFI_IMAGE_MACHINE_TYPE_SUPPORTED() macro is abused in the PeiCore
code to decide whether the system we are compiling for can deal with
executable code being copied elsewhere and executed from there.

As stated in the comment, this is fundamentally a property of the compiler
target, and so this should be made dependent on MDE_CPU_xxx preprocessor
defines, and not on whether or not the runtime target can deal with
PE/COFF images of a certain machine type.

On X86/IA32, this mostly boils down to the same thing, but not on other
architectures, so let's clean this up.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdeModulePkg/DxeCore: add missing id-to-string mapping for AARCH64
Ard Biesheuvel [Mon, 27 Mar 2017 11:19:53 +0000 (12:19 +0100)]
MdeModulePkg/DxeCore: add missing id-to-string mapping for AARCH64

Add a mapping for EFI_IMAGE_MACHINE_AARCH64 to mMachineTypeInfo[]

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoBaseTools: Update Pkcs7 and RSA2048 tool with shell=True
Yonghong Zhu [Tue, 28 Mar 2017 07:04:13 +0000 (15:04 +0800)]
BaseTools: Update Pkcs7 and RSA2048 tool with shell=True

Pkcs7Sign, Rsa2048Sha256Sign and Rsa2048Sha256GenerateKeys doesn't work
on Linux. It needs to be changed with shell=True.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoCryptoPkg/TlsLib: Update TLS Wrapper to align with OpenSSL changes.
Qin Long [Thu, 23 Mar 2017 12:53:45 +0000 (20:53 +0800)]
CryptoPkg/TlsLib: Update TLS Wrapper to align with OpenSSL changes.

This patch update the wrapper implementation in TlsLib to align
with the latest OpenSSL-1.1.0xx API changes.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Palmer Thomas <thomas.palmer@hpe.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
7 years agoCryptoPkg: Update PK Cipher Wrappers work with opaque objects.
Qin Long [Tue, 21 Mar 2017 14:58:07 +0000 (22:58 +0800)]
CryptoPkg: Update PK Cipher Wrappers work with opaque objects.

OpenSSL-1.1.xx makes most data structures opaque.
This patch updates Public Key Cipher Wrapper implementations in
BaseCryptLib to use the accessor APIs for opaque object access.
The impacted interfaces includes RSA, DH, X509, PKCS7, etc.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Gary Lin <glin@suse.com>
7 years agoCryptoPkg: Update HMAC Wrapper with opaque HMAC_CTX object.
Qin Long [Thu, 23 Mar 2017 12:47:34 +0000 (20:47 +0800)]
CryptoPkg: Update HMAC Wrapper with opaque HMAC_CTX object.

OpenSSL-1.1.xx makes most data structures opaque.
This patch updated HMAC Wrapper implementation with opaque
HMAC_CTX object.
The HmacXXGetContextSize() is marked as deprecated, and updated
to use the fixed HMAC_CTX size, which is just kept for compatibility.
New APIs (HmacXXNew(), HmacXXFree()) were added  as the recommended
HMAC_CTX usage interfaces for HMAC-XXXX operations.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
7 years agoCryptoPkg: Add extra build option to disable VS build warning
Qin Long [Thu, 23 Mar 2017 12:26:45 +0000 (20:26 +0800)]
CryptoPkg: Add extra build option to disable VS build warning

openssl/include/openssl/lhash.h will bring C4090 build warning
issue, which is one known issue for OpenSSL under Visual Studio
toolchain.
Refer to https://github.com/openssl/openssl/issues/2214 for more
discussions against this.
Use /wd4090 to silence this build warning until OpenSSL fix this.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
7 years agoCryptoPkg: Clean-up CRT Library Wrapper.
Qin Long [Thu, 23 Mar 2017 12:19:39 +0000 (20:19 +0800)]
CryptoPkg: Clean-up CRT Library Wrapper.

Cleaning-up CRT Library Wrapper for the third-party cryptography
library building. The changes includes
1. Rename OpenSslSupport.h to CrtLibSupport.h for future alternative
   crypto provider support.
2. Remove all un-referenced CRT APIs and headers.

(NOTE: More cleans-up could be possible after OpenSSL integrate the
      extra PR request: https://github.com/openssl/openssl/pull/2961)

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Gary Lin <glin@suse.com>
7 years agoCryptoPkg: Fix handling of &strcmp function pointers
Qin Long [Thu, 23 Mar 2017 12:09:17 +0000 (20:09 +0800)]
CryptoPkg: Fix handling of &strcmp function pointers

In a couple of places, OpenSSL code uses the address of the
strcmp() function, and assigns it to another comparator function
pointer.

Unfortunately, this falls foul of the inconsistent function ABI
that we use in EDKII. We '#define strcmp AsciiStrCmp' but AsciiStrCmp
is an EFIAPI function with the Microsoft ABI. And we're assigning its
address to a non-EFIAPI function, which may well have a different ABI.

Fix this by providing an actual strcmp() function in the default ABI.
We already *had* a prototype for it in OpenSslSupport.h, which was
then superseded by the #define strcmp AsciiStrCmp.

Now, OpenSSL code *can* use &strcmp without problems.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Gary Lin <glin@suse.com>
7 years agoCryptoPkg/OpensslLib: Add new OpenSSL-HOWTO document.
Qin Long [Thu, 23 Mar 2017 12:06:00 +0000 (20:06 +0800)]
CryptoPkg/OpensslLib: Add new OpenSSL-HOWTO document.

Add one new OpenSSL-HOWTO.txt to introduce how to clone / download
the latest OpenSSL release source for build.
ALso update buildinf.h to reflect the latest update time.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Gary Lin <glin@suse.com>
Tested-by: Gary Lin <glin@suse.com>
7 years agoCryptoPkg/OpensslLib: Add new Perl script for file list generation.
Qin Long [Thu, 23 Mar 2017 11:37:00 +0000 (19:37 +0800)]
CryptoPkg/OpensslLib: Add new Perl script for file list generation.

OpenSSL-1.1.0xx configure mechanism was updated with new configdata.
This patch update process_file.sh script to new Perl-based script for
auto generation of file list and openssl config file (opensslconf.h).

This only needs to be done once by a developer when updating to a new
version of OpenSSL (or changing options, etc.). Normal users do not
need to do this, since the results are already stored in the EDK2 git
repository.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
7 years agoCryptoPkg/OpensslLib: Remove patch file and installation scripts.
Qin Long [Thu, 23 Mar 2017 08:27:46 +0000 (16:27 +0800)]
CryptoPkg/OpensslLib: Remove patch file and installation scripts.

This patch removes the EDKII-openssl-xxxx.patch, installation scripts,
and Patch-HOWTO.txt which were used for old OpenSSL-1.0.2xx enabling.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
7 years agoCryptoPkg: Update .gitignore for OpenSSL source masking
Qin Long [Thu, 23 Mar 2017 08:21:31 +0000 (16:21 +0800)]
CryptoPkg: Update .gitignore for OpenSSL source masking

Updates .gitignore that masks the OpenSSL source:
1. Remove "Include/openssl" from .gitignore since we needn't duplicate
   openssl headers now
2. Update "openssl-*" to "openssl*", since we use "openssl" instead of
   "openssl-x.x.xx" as main source directory.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
7 years agoCryptoPkg/OpensslLib: Update INF files to support OpenSSL-1.1.0x build
Qin Long [Thu, 23 Mar 2017 08:14:16 +0000 (16:14 +0800)]
CryptoPkg/OpensslLib: Update INF files to support OpenSSL-1.1.0x build

Update OpensslLib INF files to support OpenSSL-1.1.0x source build.
The file list was generated from the latest OpenSSL-1.1.0e release.

Main changes to support OpensslLib build in this patch include:
1. Use "openssl" instead of "openssl-x.x.xx" as main source directory,
   Also update include path in CryptoPkg.dec
2. Enable warnings in GCC builds;
3. Update Visual Studio build options to silence current possible build
   warnings.
4. Move the default opensslconf.h to Include/openssl, and add one dummy
   dso_conf.h for native UEFI build.

The OpensslLib module build was validated as
  build -t VSXXXX -a XX -p CryptoPkg/CryptoPkg.dsc
        -m CryptoPkg/Library/OpensslLib/OpensslLib.inf

(NOTE: The extra build options for ARM/RVCT/XCODE were kept, which expect
       further optimizations from community)

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Gary Lin <glin@suse.com>
7 years agoSignedCapsulePkg: Update RecoveryModuleLoadPei to report the correct FvInfo
Liming Gao [Tue, 28 Mar 2017 06:11:24 +0000 (14:11 +0800)]
SignedCapsulePkg: Update RecoveryModuleLoadPei to report the correct FvInfo

Update logic to install FvInfo PPI with its file system guid.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
7 years agoBaseTools: Add Brotli algorithm tool
Song, BinX [Thu, 23 Mar 2017 02:16:16 +0000 (10:16 +0800)]
BaseTools: Add Brotli algorithm tool

- Add Brotli algorithm tool support

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoBaseTools: Copy Brotli algorithm 3rd party source code for tool
Song, BinX [Thu, 23 Mar 2017 02:16:15 +0000 (10:16 +0800)]
BaseTools: Copy Brotli algorithm 3rd party source code for tool

- Copy Brotli algorithm 3rd party source code for tool

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdeModulePkg: Add Brotli algorithm decompression library
Song, BinX [Thu, 23 Mar 2017 02:16:02 +0000 (10:16 +0800)]
MdeModulePkg: Add Brotli algorithm decompression library

- Add Brotli algorithm decompression library support

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdeModulePkg: Copy Brotli algorithm 3rd party source code for library
Song, BinX [Thu, 23 Mar 2017 02:15:58 +0000 (10:15 +0800)]
MdeModulePkg: Copy Brotli algorithm 3rd party source code for library

- Copy Brotli algorithm 3rd party source code for library

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoShellPkg/Shell: Avoid potential null pointer deference
Ruiyu Ni [Tue, 28 Mar 2017 02:26:07 +0000 (10:26 +0800)]
ShellPkg/Shell: Avoid potential null pointer deference

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
7 years agoEmbeddedPkg: add DT platform driver to select between DT and ACPI
Ard Biesheuvel [Mon, 27 Mar 2017 09:57:31 +0000 (10:57 +0100)]
EmbeddedPkg: add DT platform driver to select between DT and ACPI

As a follow up to the changes proposed by Laszlo to make ACPI and DT
mutually exclusive on ArmVirtQemu, this patch proposes a DT platform
DXE driver that either installs the NULL protocol PlatformHasAcpiGuid,
or installs the FV embedded DTB binary as a configuration table under
the appropriate GUID, depending on a preference setting recorded as
a UEFI variable, and configurable via a HII screen.

The DTB binary can be embedded in the firmware image by adding the
following to the platform .fdf file:

  FILE FREEFORM = 25462CDA-221F-47DF-AC1D-259CFAA4E326 {
    SECTION RAW = SomePkg/path/to/foo.dtb
  }

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoArmVirtPkg: remove PURE_ACPI_BOOT_ENABLE and PcdPureAcpiBoot
Laszlo Ersek [Fri, 17 Mar 2017 16:54:50 +0000 (17:54 +0100)]
ArmVirtPkg: remove PURE_ACPI_BOOT_ENABLE and PcdPureAcpiBoot

The build flag and the FeaturePCD have no effect any longer, remove them.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoArmVirtPkg/PlatformHasAcpiDtDxe: don't expose DT if QEMU provides ACPI
Laszlo Ersek [Fri, 17 Mar 2017 16:50:24 +0000 (17:50 +0100)]
ArmVirtPkg/PlatformHasAcpiDtDxe: don't expose DT if QEMU provides ACPI

This will let QEMU's "-no-acpi" option exclusively expose DT vs. ACPI to
the guest. Showing both is never needed (it is actually detrimental to the
adoption of standards, such as SBSA / SBBR).

* Without "-no-acpi", the firmware logs (from PlatformHasAcpiDtDxe)

> Found FwCfg @ 0x9020008/0x9020000
> Found FwCfg DMA @ 0x9020010
> InstallProtocolInterface: [EdkiiPlatformHasAcpi] 0

plus the usual messages. Later the guest kernel logs

> [    0.000000] efi:  SMBIOS 3.0=0x13bdb0000  ACPI 2.0=0x138440000
>                      MEMATTR=0x13a675018

before it lists the ACPI tables one by one.

In addition, in the guest, the "/sys/firmware/devicetree/*" shell pattern
matches no files, while the "/sys/firmware/acpi/tables/*" pattern matches
the ACPI tables.

* With "-no-acpi", the firmware logs:

> PlatformHasAcpiDtDxe | Found FwCfg @ 0x9020008/0x9020000
> PlatformHasAcpiDtDxe | Found FwCfg DMA @ 0x9020010
> PlatformHasAcpiDtDxe | InstallProtocolInterface:
> PlatformHasAcpiDtDxe | [EdkiiPlatformHasDeviceTree] 0
> FdtClientDxe         | OnPlatformHasDeviceTree: exposing DTB @
> FdtClientDxe         | 0x13FFBF000 to OS
> ...
> DXE_CORE             | Driver [AcpiTableDxe] was discovered but not
> DXE_CORE             | loaded!!
> DXE_CORE             | Driver [QemuFwCfgAcpiPlatform] was discovered but
> DXE_CORE             | not loaded!!
> ...
> RamDiskDxe           | RamDiskAcpiCheck: Cannot locate the EFI ACPI
> RamDiskDxe           | Table Protocol, unable to publish RAM disks to
> RamDiskDxe           | NFIT.

(BootGraphicsResourceTableDxe's ReadyToBoot callback --
InstallBootGraphicsResourceTable() -- handles the lack of
EFI_ACPI_TABLE_PROTOCOL silently.) Later the guest kernel logs

> [    0.000000] efi:  SMBIOS 3.0=0x13bdb0000  MEMATTR=0x138caa018

In addition, in the guest, the "/sys/firmware/devicetree/*" shell pattern
matches the directory "/sys/firmware/devicetree/base", which contains a
large number of DT nodes, while the "/sys/firmware/acpi/tables/*" pattern
matches no files.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1430262
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoArmVirtPkg/FdtClientDxe: install DT as sysconfig table in protocol notify
Laszlo Ersek [Fri, 17 Mar 2017 15:56:04 +0000 (16:56 +0100)]
ArmVirtPkg/FdtClientDxe: install DT as sysconfig table in protocol notify

Replace the dependency on PcdPureAcpiBoot with a Platform Has Device Tree
notification callback. Move the sysconfig table installation from the
entry point function to the callback.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoArmVirtPkg: enable AcpiTableDxe and EFI_ACPI_TABLE_PROTOCOL dynamically
Laszlo Ersek [Fri, 17 Mar 2017 14:46:40 +0000 (15:46 +0100)]
ArmVirtPkg: enable AcpiTableDxe and EFI_ACPI_TABLE_PROTOCOL dynamically

In this patch, the ACPI protocol / driver chain is enabled dynamically,
when appropriate. This is being done in one larger patch, because
ArmVirt.dsc.inc, where AcpiTableDxe is built, is used by all the platform
DSCs.

No change in behavior should be observable after this patch on any
ArmVirtPkg platform.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoArmVirtPkg: add XenPlatformHasAcpiDtDxe
Laszlo Ersek [Fri, 17 Mar 2017 14:12:28 +0000 (15:12 +0100)]
ArmVirtPkg: add XenPlatformHasAcpiDtDxe

This driver produces the EDKII Platform Has ACPI and Platform Has Device
Tree protocols, exactly matching the current ACPI / DT exposure on Xen,
according to ARM vs. AARCH64. At this point it differs from the QEMU
driver PlatformHasAcpiDtDxe in that this one always installs the DT.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoArmVirtPkg: add PlatformHasAcpiDtDxe
Laszlo Ersek [Fri, 17 Mar 2017 14:12:28 +0000 (15:12 +0100)]
ArmVirtPkg: add PlatformHasAcpiDtDxe

This driver produces the EDKII Platform Has ACPI and Platform Has Device
Tree protocols, exactly matching the current ACPI / DT exposure on QEMU,
according to ARM vs. AARCH64, and (in the latter case) to PcdPureAcpiBoot.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoEmbeddedPkg: introduce EDKII Platform Has Device Tree GUID
Laszlo Ersek [Fri, 17 Mar 2017 12:47:35 +0000 (13:47 +0100)]
EmbeddedPkg: introduce EDKII Platform Has Device Tree GUID

The presence of this GUID in the PPI database, and/or in the DXE protocol
database (as dictated by the platform's needs in these firmware phases)
implies that the platform provides the operating system with a Device
Tree-based hardware description. This is not necessarily exclusive with
other types of hardware description (for example, an ACPI-based one).

A platform PEIM and/or DXE driver is supposed to produce a single instance
of the PPI and/or protocol (with NULL contents), if appropriate. The
decision to produce the PPI and/or protocol is platform specific; for
example, in the DXE phase, it could depend on an HII checkbox / underlying
non-volatile UEFI variable.

In the DXE phase, the protocol is meant to be consumed by the platform
driver that
- owns the Device Tree description of the hardware, and
- is responsible for installing it as a system configuration table.

Said FDT-owner driver can wait for the protocol via DEPEX or protocol
notify.

Because this GUID is not standard, it is prefixed with EDKII / Edkii, as
seen elsewhere (for example in MdeModulePkg and SecurityPkg).

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoEmbeddedPkg: introduce PlatformHasAcpiLib
Laszlo Ersek [Fri, 17 Mar 2017 12:47:35 +0000 (13:47 +0100)]
EmbeddedPkg: introduce PlatformHasAcpiLib

Add the shorter-term library instance outlined in the previous patch to
EmbeddedPkg, so that we can imbue AcpiTableDxe with a protocol dependency
on EDKII_PLATFORM_HAS_ACPI_GUID.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoEmbeddedPkg: introduce EDKII Platform Has ACPI GUID
Laszlo Ersek [Fri, 17 Mar 2017 12:47:35 +0000 (13:47 +0100)]
EmbeddedPkg: introduce EDKII Platform Has ACPI GUID

The presence of this GUID in the PPI database, and/or in the DXE protocol
database (as dictated by the platform's needs in these firmware phases)
implies that the platform provides the operating system with an ACPI-based
hardware description. This is not necessarily exclusive with other types
of hardware description (for example, a Device Tree-based one).

A platform PEIM and/or DXE driver is supposed to produce a single instance
of the PPI and/or protocol (with NULL contents), if appropriate. The
decision to produce the PPI and/or protocol is platform specific; for
example, in the DXE phase, it could depend on an HII checkbox / underlying
non-volatile UEFI variable.

In the DXE phase, the protocol is meant to be depended-upon by
"MdeModulePkg/Universal/Acpi/AcpiTableDxe", indirectly:

* In the long term, interested platforms will establish this dependency by
  hooking an (upcoming) NULL-class DepexLib instance into AcpiTableDxe in
  their DSC files, pointing DepexLib's DEPEX through a FixedAtBuild PCD to
  the GUID introduced here. (For the prerequisite BaseTools feature, refer
  to <https://bugzilla.tianocore.org/show_bug.cgi?id=443>).

* In the short term, an interested platform may hook a private NULL-class
  library instance (called e.g. "PlatformHasAcpiLib") into AcpiTableDxe.
  Such a library instance would be a specialization of the above described
  generic DepexLib, with the DEPEX open-coded on the GUID introduced here.

Either way, the platform makes EFI_ACPI_TABLE_PROTOCOL and (if enabled)
EFI_ACPI_SDT_PROTOCOL dependent on the platform's dynamic decision to
produce or not to produce a NULL protocol instance with this GUID.

In turn, other (platform and universal) DXE drivers that produce ACPI
tables will wait for EFI_ACPI_TABLE_PROTOCOL / EFI_ACPI_SDT_PROTOCOL, via
DEPEX, protocol notify, or a simple gBS->LocateProtocol() in a "late
enough" callback (such as Ready To Boot).

Because this GUID is not standard, it is prefixed with EDKII / Edkii, as
seen elsewhere in MdeModulePkg and SecurityPkg. In addition, an effort is
made to avoid the phrase "AcpiPlatform", as that belongs to drivers /
libraries that produce platform specific ACPI content (as opposed to
deciding whether the entire firmware will have access to
EFI_ACPI_TABLE_PROTOCOL, or any similar facilities in the PEI phase).

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoArmVirtPkg/XenAcpiPlatformDxe: don't cast UINT64 to pointer directly
Laszlo Ersek [Fri, 17 Mar 2017 15:07:53 +0000 (16:07 +0100)]
ArmVirtPkg/XenAcpiPlatformDxe: don't cast UINT64 to pointer directly

Because that breaks the (potential) 32-bit build of the driver.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoRevert "ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot"
Laszlo Ersek [Fri, 17 Mar 2017 12:44:41 +0000 (13:44 +0100)]
Revert "ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot"

This reverts commit 18f6d4df9ece8b91b86511bcdd1cf7da478c3627.

We realized that DXE drivers that are independent of AcpiPlatformDxe (that
is, independent of QEMU's ACPI generation), such as RamDiskDxe and
BootGraphicsResourceTableDxe, may produce and/or manipulate ACPI tables,
at driver dispatch or even at Ready To Boot.

This makes it unsafe for us to check for ACPI presence in the UEFI system
config table in a Ready To Boot callback, in order to decide about
exposing the DT.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoRevert "ArmVirtPkg/FdtClientDxe: make DT table installation !ACPI dependent"
Laszlo Ersek [Fri, 17 Mar 2017 12:37:47 +0000 (13:37 +0100)]
Revert "ArmVirtPkg/FdtClientDxe: make DT table installation !ACPI dependent"

This reverts commit 78c41ff519b187d8979cda7074f007a6323f9acd.

We realized that DXE drivers that are independent of AcpiPlatformDxe (that
is, independent of QEMU's ACPI generation), such as RamDiskDxe and
BootGraphicsResourceTableDxe, may produce and/or manipulate ACPI tables,
at driver dispatch or even at Ready To Boot.

This makes it unsafe for us to check for ACPI presence in the UEFI system
config table in a Ready To Boot callback, in order to decide about
exposing the DT.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoShellPkg/Shell: Make comments align with the function
Dandan Bi [Tue, 28 Mar 2017 00:53:37 +0000 (08:53 +0800)]
ShellPkg/Shell: Make comments align with the function

Cc: Chen A Chen <chen.a.chen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoMdeModulePkg/MemoryProtection: Fix coding style issue
Dandan Bi [Tue, 28 Mar 2017 00:50:17 +0000 (08:50 +0800)]
MdeModulePkg/MemoryProtection: Fix coding style issue

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg/MpLib.c: Add checking CR0 PG bit
Jeff Fan [Mon, 27 Mar 2017 07:00:00 +0000 (15:00 +0800)]
UefiCpuPkg/MpLib.c: Add checking CR0 PG bit

If CR0 PG bit is not set, it means paging is not enabled on BSP. Thus, Execute
Disable feature is not working actually. Thus, we cannot enable it on APs.

v2:
  Correct the commit log.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg: Add new PCDs PROMPT/HELP string in UNI file
Jeff Fan [Mon, 27 Mar 2017 02:42:22 +0000 (10:42 +0800)]
UefiCpuPkg: Add new PCDs PROMPT/HELP string in UNI file

Correct PCD declaration comments and add new PCDs in UNI file.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg/CpuCommonFeaturesLib: Generate new INF GUID value
Jeff Fan [Mon, 27 Mar 2017 02:20:07 +0000 (10:20 +0800)]
UefiCpuPkg/CpuCommonFeaturesLib: Generate new INF GUID value

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Fix meta data comments
Jeff Fan [Mon, 27 Mar 2017 02:14:37 +0000 (10:14 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Fix meta data comments

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Remove static type
Jeff Fan [Mon, 27 Mar 2017 01:46:18 +0000 (09:46 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Remove static type

Using one specific name for global variable to save MP services protocol
pointer.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Fix the function header issues
Jeff Fan [Mon, 27 Mar 2017 01:14:30 +0000 (09:14 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Fix the function header issues

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoArmPkg/ArmExceptionLib: use EL0 stack for synchronous exceptions
Ard Biesheuvel [Wed, 15 Mar 2017 16:26:41 +0000 (16:26 +0000)]
ArmPkg/ArmExceptionLib: use EL0 stack for synchronous exceptions

In order to be able to produce meaningful diagnostic output when taking
synchronous exceptions that have been caused by corruption of the stack
pointer, prepare the EL0 stack pointer and switch to it when handling the
'Sync exception using SPx' exception class.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Add ASSERT on allocated memory
Jeff Fan [Thu, 23 Mar 2017 07:19:43 +0000 (15:19 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Add ASSERT on allocated memory

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg/AcpiCpuData.h: Support >4GB MMIO address
Jeff Fan [Thu, 23 Mar 2017 05:19:49 +0000 (13:19 +0800)]
UefiCpuPkg/AcpiCpuData.h: Support >4GB MMIO address

The current CPU_REGISTER_TABLE_ENTRY structure only defined UINT32 Index to
indicate MSR/MMIO address. It's ok for MSR because MSR address is UINT32 type
actually. But for MMIO address, UINT32 limits MMIO address exceeds 4GB.

This update on CPU_REGISTER_TABLE_ENTRY is to add additional UINT32 field
HighIndex to indicate the high 32bit MMIO address and original Index still
indicate the low 32bit MMIO address.

This update makes use of original padding space between ValidBitLength and
Value to add HighIndex.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Define Index to UINT64
Jeff Fan [Thu, 23 Mar 2017 04:55:26 +0000 (12:55 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Define Index to UINT64

The input parameter Index of PreSmmCpuRegisterTableWrite() and
CpuRegisterTableWrite() is defined as UINT32. Index is MSR/MMIO address that
will be saved in CPU register table. UINT32 blocks the MMIO address > 4GB.

This fix is to define Index to UINT64 instead of UINT32.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoShellPkg/mm: Support UINT16 segment number
Ruiyu Ni [Tue, 21 Mar 2017 05:47:08 +0000 (13:47 +0800)]
ShellPkg/mm: Support UINT16 segment number

It's to follow the Shell 2.2 spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
7 years agoBaseTools: Fix build failure for DynamicEx Pcd used in the Library
Yonghong Zhu [Tue, 21 Mar 2017 09:06:47 +0000 (17:06 +0800)]
BaseTools: Fix build failure for DynamicEx Pcd used in the Library

Update DynExPcdTokenNumberMapping logic, currently even it is Library,
its self's Pcd is saved into ModulePcdList.

Fixes:https://bugzilla.tianocore.org/show_bug.cgi?id=434
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoBaseTools: Skip module AutoGen by comparing timestamp.
Derek Lin [Fri, 24 Feb 2017 07:26:19 +0000 (15:26 +0800)]
BaseTools: Skip module AutoGen by comparing timestamp.

[Introduction]

The BaseTool Build.py AutoGen parse INF meta-file and generate
AutoGen.c/AutoGen.h/makefile. When we only change .c .h code, the
AutoGen might be not necessary, but Build.py spend a lot of time on it.
There's a -u flag to skip all module's AutoGen. In my environment, it save
35%~50% of time in rebuild a ROM.
However, if user change one .INF meta-file, then -u flag is not available.

[Idea]

AutoGen can compare meta-file's timestamp and decide if the module's
AutoGen can be skipped. With this, when a module's INF is changed, we
only run this module's AutoGen, we don't need to run other module's.

[Implementation]

In the end of a module's AutoGen, we create a AutoGenTimeStamp.
The file save a file list that related to this module's AutoGen.
In other word, the file list in AutoGenTimeStamp is INPUT files of
module AutoGen, AutoGenTimeStamp file is OUTPUT.
During rebuild, we compare time stamp between INPUT and OUTPUT, and
decide if we can skip it.

Below is the Input/Output of a module's AutoGen.

[Input]
  1. All the DSC/DEC/FDF used by the platform.
  2. Macro and PCD defined by Build Options such as "build -D AAA=TRUE
     --pcd BbbPcd=0".
  3. INF file of a module.
  4. Source files of a module, list in [Sources] section of INF.
  5. All the library link by the module.
  6. All the .h files included by the module's sources.

[Output]
  AutoGen.c/AutoGen.h/makefile/AutoGenTimeStamp

[Testing]

This patch save my build time. When I make a change without touching
DSC/DEC/FDF, it is absolutely much faster than original rebuild,
35%~50% time saving in my environment
(compare to original tool rebuild time).
If I change any DSC/DEC/FDF, there's no performance improve, because it
can't skip any module's AutoGen.

Please note that if your environment will generate DSC/FDF during prebuild,
it will not skip any AutoGen because of DSC timestamp is changed. This will
require prebuild script not to update metafile when content is not changed.

7 years agoMdePkg/DevicePathLib: Fix FromText bug for multi-instance devicepath
Ruiyu Ni [Thu, 23 Mar 2017 05:09:45 +0000 (13:09 +0800)]
MdePkg/DevicePathLib: Fix FromText bug for multi-instance devicepath

UefiDevicePathLibConvertTextToDevicePath correctly detects when it
has hit a ',' splicing together multiple paths. However, the code
that tries to cope with it:
{code}
if (IsInstanceEnd) {
  DeviceNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (
                                   END_DEVICE_PATH_LENGTH);
  ASSERT (DeviceNode != NULL);
  SetDevicePathEndNode (DeviceNode);

  NewDevicePath = AppendDevicePathNode (DevicePath, DeviceNode);
  FreePool (DevicePath);
  FreePool (DeviceNode);
  DevicePath = NewDevicePath;
}
{code}
causes a problem. The END node that's appended it the node for the
entire list. So when the node is appended in AppendDevicePathNode,
it winds up disappearing. This leads to the path
'PciRoot(0x0),PciRoot(0x0)' parsing as if 'PciRoot(0x0)/PciRoot(0x0)'
were specified. These are two very different things.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoShellPkg: Add Shell invocation option '-exit'
Chen A Chen [Thu, 16 Mar 2017 05:22:40 +0000 (13:22 +0800)]
ShellPkg: Add Shell invocation option '-exit'

According to Shell spec 2.2 '-exit' invocation option is used to specify
that after running the command line when launched, the UEFI Shell must
immediately exit.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
7 years agoShellPkg: Fix shell not able to run startup.nsh
Chen A Chen [Tue, 21 Mar 2017 06:41:18 +0000 (14:41 +0800)]
ShellPkg: Fix shell not able to run startup.nsh

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
7 years agoNetworkPkg/IScsiDxe: Fix the incorrect error handling in DriverEntryPoint
Jiaxin Wu [Wed, 22 Mar 2017 01:22:07 +0000 (09:22 +0800)]
NetworkPkg/IScsiDxe: Fix the incorrect error handling in DriverEntryPoint

Currently, error handling in IScsiDriverEntryPoint is incorrect. For
example, if IScsiCreateAttempts() return error due to the limited max
variable size, iSCSI will not unload the configuration entries.

Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
7 years agoNetworkPkg: Fix potential ASSERT if NetIp4IsUnicast is called
Jiaxin Wu [Tue, 21 Mar 2017 03:36:31 +0000 (11:36 +0800)]
NetworkPkg: Fix potential ASSERT if NetIp4IsUnicast is called

Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Cc: Subramanian Sriram <sriram-s@hpe.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
7 years agoMdeModulePkg/Network: Fix potential ASSERT if NetIp4IsUnicast is called
Jiaxin Wu [Tue, 21 Mar 2017 03:36:04 +0000 (11:36 +0800)]
MdeModulePkg/Network: Fix potential ASSERT if NetIp4IsUnicast is called

Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Cc: Subramanian Sriram <sriram-s@hpe.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
7 years agoUefiCpuPkg/RegisterCpuFeaturesLib: Set CpuFeatureEntry initial value
Jeff Fan [Thu, 23 Mar 2017 01:37:47 +0000 (09:37 +0800)]
UefiCpuPkg/RegisterCpuFeaturesLib: Set CpuFeatureEntry initial value

CpuFeatureEntry will be set before using it. But VS2012 build reported the build
warning "potentially uninitialized local variable 'CpuFeatureEntry' used".

This fix is to set CpuFeatureEntry initial value and add ASSERT check later.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg/CpuCommonFeaturesLib: Fix case write issue
Jeff Fan [Thu, 23 Mar 2017 01:13:02 +0000 (09:13 +0800)]
UefiCpuPkg/CpuCommonFeaturesLib: Fix case write issue

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoArmPkg/DefaultExceptionHandlerLib: walk call stack unconditionally
Ard Biesheuvel [Thu, 16 Mar 2017 13:23:42 +0000 (13:23 +0000)]
ArmPkg/DefaultExceptionHandlerLib: walk call stack unconditionally

Currently, we only attempt to walk the call stack and print a backtrace
if the program counter refers to a location covered by a PE/COFF image.
However, regardless of the value of PC, the frame pointer may still have
a meaningful value, and so we can still produce the remainder of the
backtrace.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoArmPkg/DefaultExceptionHandlerLib: add missing GUID to .inf
Ard Biesheuvel [Fri, 10 Mar 2017 21:43:10 +0000 (22:43 +0100)]
ArmPkg/DefaultExceptionHandlerLib: add missing GUID to .inf

Add the gEfiDebugImageInfoTableGuid, which is referenced in the code,
to both .INF files describing this module.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoArmPkg/PlatformBootManagerLib: move to BootLogoLib for boot splash support
Ard Biesheuvel [Sat, 18 Mar 2017 21:20:46 +0000 (21:20 +0000)]
ArmPkg/PlatformBootManagerLib: move to BootLogoLib for boot splash support

Replace the duplicated and outdated code in QuietBoot.c with a reference
to BootLogoLib, which provides the same functionality. This also allows
us to drop all references to IntelFrameworkModulePkg in this module.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoQuarkPlatformPkg/PlatformBootManagerLib: use new UefiShellFileGuid definition
Ard Biesheuvel [Wed, 22 Mar 2017 13:37:43 +0000 (13:37 +0000)]
QuarkPlatformPkg/PlatformBootManagerLib: use new UefiShellFileGuid definition

Move to the new definition of UefiShellFileGuid, which is defined in the
ShellPkg package declaration file rather than hardcoded in this module.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>