]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
7 years agoMdePkg/SmiHandlerProfileLibNull: Add NULL instance.
Jiewen Yao [Mon, 30 Jan 2017 14:42:01 +0000 (06:42 -0800)]
MdePkg/SmiHandlerProfileLibNull: Add NULL instance.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdePkg/Include: Add SmiHandlerProfileLib.h
Jiewen Yao [Mon, 30 Jan 2017 14:40:41 +0000 (06:40 -0800)]
MdePkg/Include: Add SmiHandlerProfileLib.h

This library should be linked by SmmChildDispatch to
report the hardware SMI handler maintained by SmmChildDispatch.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoUefiCpuPkg/CpuDxe: Fix hard code actual TimerPeriod value
Jeff Fan [Mon, 20 Feb 2017 08:17:05 +0000 (16:17 +0800)]
UefiCpuPkg/CpuDxe: Fix hard code actual TimerPeriod value

Current CpuGetTimerValue() implementation return hard code TimerPeriod value. We
could calculate the actual TimerPeriod value over period of time (100us) at the
first time invoking CpuGetTimerValue() and save the TimerPeriod value into one
global variable to avoid delay at the next CpuGetTimerValue() invoking.

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

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael D 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/CpuDxe: Add Local APIC memory mapped space in GCD
Jeff Fan [Tue, 21 Feb 2017 02:35:47 +0000 (10:35 +0800)]
UefiCpuPkg/CpuDxe: Add Local APIC memory mapped space in GCD

Local APIC memory mapped space should be added into GCD and be allocated.
Otherwise, UEFI firmware cannot get correct memory map for it. For example,
SMM profile feature needs to get the completed MMIO map to protect them.

v2:
  Consume AddMemoryMappedIoSpace() to handle the case that Local APIC
  memory space has already been added before.

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

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
7 years agoUefiCpuPkg/CpuDxe: Copy two functions from PciHostBridge
Jeff Fan [Tue, 21 Feb 2017 02:21:23 +0000 (10:21 +0800)]
UefiCpuPkg/CpuDxe: Copy two functions from PciHostBridge

Copy AddMemoryMappedIoSpace() and IntersectMemoryDescriptor() from
MdeModulePkg\Bus\Pci\PciHostBridgeDxe\PciHostBridge.c.

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

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
7 years agoMdeModulePkg/DxeCore: Add UEFI image protection.
Jiewen Yao [Sat, 14 Jan 2017 07:04:10 +0000 (23:04 -0800)]
MdeModulePkg/DxeCore: Add UEFI image protection.

If the UEFI image is page aligned, the image code section is set to read
only and the image data section is set to non-executable.

1) This policy is applied for all UEFI image including boot service driver,
runtime driver or application.
2) This policy is applied only if the UEFI image meets the page alignment
requirement.
3) This policy is applied only if the Source UEFI image matches the
PcdImageProtectionPolicy definition.
4) This policy is not applied to the non-PE image region.

The DxeCore calls CpuArchProtocol->SetMemoryAttributes() to protect
the image. If the CpuArch protocol is not installed yet, the DxeCore
enqueues the protection request. Once the CpuArch is installed, the
DxeCore dequeues the protection request and applies policy.

Once the image is unloaded, the protection is removed automatically.

The UEFI runtime image protection is teared down at ExitBootServices(),
the runtime image code relocation need write code segment at
SetVirtualAddressMap(). We cannot assume OS/Loader has taken over
page table at that time.

NOTE: It is per-requisite that code section and data section
should not be not merged. That is same criteria for SMM/runtime driver.

We are not able to detect during BIOS boot, because
we can only get LINK warning below:
"LINK : warning LNK4254: section '.data' (C0000040) merged into
'.text' (60000020) with different attributes"
But final attribute in PE code section is same.

Cc: Star Zeng <star.zeng@intel.com>
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: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoMdeModulePkg/dec: add PcdImageProtectionPolicy.
Jiewen Yao [Mon, 6 Feb 2017 15:32:54 +0000 (07:32 -0800)]
MdeModulePkg/dec: add PcdImageProtectionPolicy.

Add PCD for image protection policy.

Cc: Star Zeng <star.zeng@intel.com>
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: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoUefiCpuPkg/CpuDxe: Add memory attribute setting.
Jiewen Yao [Sat, 14 Jan 2017 07:40:20 +0000 (15:40 +0800)]
UefiCpuPkg/CpuDxe: Add memory attribute setting.

Add memory attribute setting in CpuArch protocol.
Previous SetMemoryAttributes() API only supports cache attribute setting.

This patch updated SetMemoryAttributes() API to support memory attribute
setting by updating CPU page table.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.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 agoVfrCompile: fix invalid comparison between pointer and integer
Paolo Bonzini [Mon, 13 Feb 2017 12:54:00 +0000 (20:54 +0800)]
VfrCompile: fix invalid comparison between pointer and integer

This would be valid C but is not valid C++, so change the comparison to do what it has always been doing.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
7 years agoBaseTools: add error check for Macro usage in the INF file
Yonghong Zhu [Mon, 20 Feb 2017 10:49:32 +0000 (18:49 +0800)]
BaseTools: add error check for Macro usage in the INF file

Use of MACRO statements in the EDK II INF files is limited to local
usage only; global or external macros are not permitted. This patch
add the check for not defined macros.

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 agoOvmfPkg/QemuFwCfg: introduce FW_CFG_IO_DMA_ADDRESS, adapt the package
Laszlo Ersek [Tue, 21 Feb 2017 13:43:00 +0000 (14:43 +0100)]
OvmfPkg/QemuFwCfg: introduce FW_CFG_IO_DMA_ADDRESS, adapt the package

Introduce the FW_CFG_IO_DMA_ADDRESS macro for IO Ports 0x514 and 0x518
(most significant and least significant halves of the DMA Address
Register, respectively), and update all references in OvmfPkg.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg/QemuFwCfg: introduce FW_CFG_IO_DATA, adapt the package
Laszlo Ersek [Tue, 21 Feb 2017 13:43:00 +0000 (14:43 +0100)]
OvmfPkg/QemuFwCfg: introduce FW_CFG_IO_DATA, adapt the package

Introduce the FW_CFG_IO_DATA macro for IO Port 0x511 (the Data Register),
and update all references in OvmfPkg.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg/QemuFwCfg: introduce FW_CFG_IO_SELECTOR, adapt the package
Laszlo Ersek [Tue, 21 Feb 2017 13:43:00 +0000 (14:43 +0100)]
OvmfPkg/QemuFwCfg: introduce FW_CFG_IO_SELECTOR, adapt the package

Introduce the FW_CFG_IO_SELECTOR macro for IO Port 0x510 (the Selector
Register), and update all references in OvmfPkg.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg/QemuFwCfgLib: move types/macros from lib class to IndustryStandard
Laszlo Ersek [Tue, 21 Feb 2017 13:29:10 +0000 (14:29 +0100)]
OvmfPkg/QemuFwCfgLib: move types/macros from lib class to IndustryStandard

Cc: Jordan Justen <jordan.l.justen@intel.com>
Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg/AcpiPlatformDxe: update PointerValue comments in "BootScript.c"
Laszlo Ersek [Tue, 21 Feb 2017 12:56:48 +0000 (13:56 +0100)]
OvmfPkg/AcpiPlatformDxe: update PointerValue comments in "BootScript.c"

Commit df73df138d9d ("OvmfPkg/AcpiPlatformDxe: replay
QEMU_LOADER_WRITE_POINTER commands at S3", 2017-02-09) added
"BootScript.c" with such comments on the PointerValue field of
CONDENSED_WRITE_POINTER, and on the corresponding PointerValue parameter
of SaveCondensedWritePointerToS3Context(), that did not consider the
then-latest update of the QEMU_LOADER_WRITE_POINTER structure. (Namely,
the introduction of the PointeeOffset field.)

The code is fine as-is -- ProcessCmdWritePointer() already calls
SaveCondensedWritePointerToS3Context() correctly, and "BootScript.c"
itself is indifferent to the exact values --, but the comments in
"BootScript.c" should match reality too. Update them.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg/AcpiPlatformDxe: drop double right shift in ADD/WRITE POINTER cmds
Laszlo Ersek [Tue, 21 Feb 2017 12:30:48 +0000 (13:30 +0100)]
OvmfPkg/AcpiPlatformDxe: drop double right shift in ADD/WRITE POINTER cmds

The Count parameter of RShiftU64() must be strictly smaller than 64.
ProcessCmdAddPointer() and ProcessCmdWritePointer() currently ensure this
by "cleverly" breaking the last bit of a potentially 8-byte right shift
out to a separate operation.

Instead, exclude the Count==64 case explicitly (in which case the
preexistent outer RShiftU64() would return 0), and keep only the inner
RShiftU64(), with the direct Count however.

This is not a functional change, just style improvement.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoUefiCpuPkg/ExceptionHandlerAsm.S: Fix code length issue with GCC 5.4
Jeff Fan [Tue, 21 Feb 2017 03:29:45 +0000 (11:29 +0800)]
UefiCpuPkg/ExceptionHandlerAsm.S: Fix code length issue with GCC 5.4

X64\ExceptionHandlerAsm.S define MARCO to set up 32 IDT entries header.
It assume GCC compiler will generate the same code length on the following
instrction for each IDT entry.
  jmp    ASM_PFX(CommonInterruptEntry)

It works with GCC 4.x. However, GCC 5.4 will generate different code size of IDT
entry code per the offset value from CommonInterruptEntry address. We should use
DB to make sure each IDT entry header has the same size whatever compiler
version.

.ASM and .nasm used the different solution and do not have this issue.

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

Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoArmPkg/ArmMmuLib: AARCH64: add support for modifying only permissions
Ard Biesheuvel [Wed, 15 Feb 2017 17:11:56 +0000 (17:11 +0000)]
ArmPkg/ArmMmuLib: AARCH64: add support for modifying only permissions

Since the new DXE page protection for PE/COFF images may invoke
EFI_CPU_ARCH_PROTOCOL.SetMemoryAttributes() with only permission
attributes set, add support for this in the AARCH64 MMU code.

Move the EFI_MEMORY_CACHETYPE_MASK macro to a shared location between
CpuDxe and ArmMmuLib so we don't have to introduce yet another
definition.

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/CpuDxe: ARM: ignore page table updates that only change permissions
Ard Biesheuvel [Wed, 15 Feb 2017 17:11:55 +0000 (17:11 +0000)]
ArmPkg/CpuDxe: ARM: ignore page table updates that only change permissions

Currently, we have not implemented support on 32-bit ARM for managing
permission bits in the page tables. Since the new DXE page protection
for PE/COFF images may invoke EFI_CPU_ARCH_PROTOCOL.SetMemoryAttributes()
with only permission attributes set, let's simply ignore those for now.

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/CpuDxe: translate invalid memory types in EfiAttributeToArmAttribute
Ard Biesheuvel [Wed, 15 Feb 2017 17:11:54 +0000 (17:11 +0000)]
ArmPkg/CpuDxe: translate invalid memory types in EfiAttributeToArmAttribute

The single user of EfiAttributeToArmAttribute () is the protocol
method EFI_CPU_ARCH_PROTOCOL.SetMemoryAttributes(), which uses the
return value to compare against the ARM attributes of an existing mapping,
to infer whether it is actually necessary to change anything, or whether
the requested update is redundant. This saves some cache and TLB
maintenance on 32-bit ARM systems that use uncached translation tables.

However, EFI_CPU_ARCH_PROTOCOL.SetMemoryAttributes() may be invoked with
only permission bits set, in which case the implied requested action is to
update the permissions of the region without modifying the cacheability
attributes. This is currently not possible, because
EfiAttributeToArmAttribute () ASSERT()s [on AArch64] on Attributes arguments
that lack a cacheability bit.

So let's simply return TT_ATTR_INDX_MASK (AArch64) or
TT_DESCRIPTOR_SECTION_TYPE_FAULT (ARM) in these cases (or'ed with the
appropriate permission bits). This way, the return value is equally
suitable for checking whether the attributes need to be modified, but
in a way that accommodates the use without a cacheability bit set.

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/CpuDxe: Correct EFI_MEMORY_RO usage
Jiewen Yao [Thu, 9 Feb 2017 07:20:30 +0000 (23:20 -0800)]
ArmPkg/CpuDxe: Correct EFI_MEMORY_RO usage

Current Arm CpuDxe driver uses EFI_MEMORY_WP for write protection,
according to UEFI spec, we should use EFI_MEMORY_RO for write protection.
The EFI_MEMORY_WP is the cache attribute instead of memory attribute.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoOvmfPkg/AcpiPlatformDxe: replay QEMU_LOADER_WRITE_POINTER commands at S3
Laszlo Ersek [Thu, 9 Feb 2017 16:32:40 +0000 (17:32 +0100)]
OvmfPkg/AcpiPlatformDxe: replay QEMU_LOADER_WRITE_POINTER commands at S3

Ultimately, each QEMU_LOADER_WRITE_POINTER command creates a guest memory
reference in some QEMU device. When the virtual machine is reset, the
device willfully forgets the guest address, since the guest memory is
wholly invalidated during platform reset.

... Unless the reset is part of S3 resume. Then the guest memory is
preserved intact, and the firmware must reprogram those devices with the
original guest memory allocation addresses.

This patch accumulates the fw_cfg select, skip and write operations of
ProcessCmdWritePointer() in a validated / condensed form, and turns them
into an ACPI S3 Boot Script fragment at the very end of
InstallQemuFwCfgTables().

Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg/AcpiPlatformDxe: implement the QEMU_LOADER_WRITE_POINTER command
Laszlo Ersek [Wed, 8 Feb 2017 20:53:02 +0000 (21:53 +0100)]
OvmfPkg/AcpiPlatformDxe: implement the QEMU_LOADER_WRITE_POINTER command

The QEMU_LOADER_WRITE_POINTER command instructs the firmware to write the
address of a field within a previously allocated/downloaded fw_cfg blob
into another (writeable) fw_cfg file at a specific offset.

Put differently, QEMU_LOADER_WRITE_POINTER propagates, to QEMU, the
address that QEMU_LOADER_ALLOCATE placed the designated fw_cfg blob at, as
adjusted for the given field inside the allocated blob.

The implementation is similar to that of QEMU_LOADER_ADD_POINTER. Since
here we "patch" a pointer object in "fw_cfg file space", not guest memory
space, we utilize the QemuFwCfgSkipBytes() and QemuFwCfgWriteBytes() APIs
completed in commit range 465663e9f128..7fcb73541299.

An interesting aspect is that QEMU_LOADER_WRITE_POINTER creates a
host-level reference to a guest memory location. Therefore, if we fail to
process the linker/loader script for any reason, we have to clear out
those references first, before we release the guest memory allocations in
response to the error.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg/AcpiPlatformDxe: rewrap license block in "QemuFwCfgAcpi.c"
Laszlo Ersek [Wed, 8 Feb 2017 13:15:01 +0000 (14:15 +0100)]
OvmfPkg/AcpiPlatformDxe: rewrap license block in "QemuFwCfgAcpi.c"

The longest line is currently 84 characters long.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg/AcpiPlatformDxe: add QEMU_LOADER_WRITE_POINTER definitions
Laszlo Ersek [Wed, 8 Feb 2017 16:14:34 +0000 (17:14 +0100)]
OvmfPkg/AcpiPlatformDxe: add QEMU_LOADER_WRITE_POINTER definitions

Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg/AcpiPlatformDxe: prepare for QEMU_LOADER_WRITE_POINTER definitions
Laszlo Ersek [Wed, 8 Feb 2017 13:25:01 +0000 (14:25 +0100)]
OvmfPkg/AcpiPlatformDxe: prepare for QEMU_LOADER_WRITE_POINTER definitions

No functional changes in this patch, just prepare the grounds with some
reformatting (trailing comma after the last enumeration constant,
horizontal whitespace insertion) so that the next patch can be cleaner.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoMdeModulePkg/BMMUiLib: Remove old useless data before new save action
Dandan Bi [Thu, 16 Feb 2017 10:30:20 +0000 (18:30 +0800)]
MdeModulePkg/BMMUiLib: Remove old useless data before new save action

There exits the case that when saving changes in form A,
the old saved data in form B are not cleaned, will be saved
again with the new save. Thus incorrect UI behavior will be
shown. This patch is to remove some useless data.

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

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
7 years agoMdeModulePkg/HiiDatabase: clean the value before setting default string
Dandan Bi [Mon, 20 Feb 2017 02:20:08 +0000 (10:20 +0800)]
MdeModulePkg/HiiDatabase: clean the value before setting default string

For string op-code, the default string may not reach the
maximum size, so when generating <AltResp> string, we should
clean the value before setting the default string.

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

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
7 years agoMdeMoudlePkg/DisplayEngine: Fix incorrect index used in array "InputText"
Dandan Bi [Thu, 9 Feb 2017 13:17:34 +0000 (21:17 +0800)]
MdeMoudlePkg/DisplayEngine: Fix incorrect index used in array "InputText"

When set value to the array "InputText", the index was used incorrectly.
And the array "InputText" is not initialized. These will cause some value
in the array is random, so it will be shown incorrectly sometimes.
This patch is to fix this issue.

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

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Wang Cloud <winggundum82@163.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
7 years agoSecurityPkg/TpmCommandLib: Add Tpm2ReadPublic.
Jiewen Yao [Thu, 9 Feb 2017 15:04:32 +0000 (07:04 -0800)]
SecurityPkg/TpmCommandLib: Add Tpm2ReadPublic.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Long Qin <qin.long@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yao Jiewen <jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
7 years agoMdeModulePkg/PrintLib: Add safe print functions [A|U]ValueToStringS
Hao Wu [Wed, 8 Feb 2017 05:52:33 +0000 (13:52 +0800)]
MdeModulePkg/PrintLib: Add safe print functions [A|U]ValueToStringS

Add the following 2 APIs:
UnicodeValueToStringS
AsciiValueToStringS

These safe version APIs are used to enhance their counterpart (APIs
without trailing 'S' in function names).

They perform checks to the input parameters and will return relative
status to reflect the check result.

Return RETURN_INVALID_PARAMETER when:
1). The input Buffer is NULL.
2). The input BufferSize is greater than (PcdMaximumUnicodeStringLength *
sizeof (CHAR16) + 1) for UnicodeValueToStringS or greater than
PcdMaximumAsciiStringLength for AsciiValueToStringS.
3). The input Flags is not set properly.
4). The input Width is not smaller than MAXIMUM_VALUE_CHARACTERS.

Return RETURN_BUFFER_TOO_SMALL when:
1). The input BufferSize cannot hold the converted value.

These APIs in the MdeModulePkg/DxePrintLibPrint2Protocol instance
follow the same rules with MdePkg/BasePrintLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdeModulePkg/PrintLib: Use EFI_PRINT2S_PROTOCOL for this instance
Hao Wu [Wed, 8 Feb 2017 05:43:02 +0000 (13:43 +0800)]
MdeModulePkg/PrintLib: Use EFI_PRINT2S_PROTOCOL for this instance

The commit updates the PrintLib instance
MdeModulePkg/Library/DxePrintLibPrint2Protocol to use EFI_PRINT2S_PROTOCOL
to implement the APIs.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdeModulePkg: Add the EFI_PRINT2S_PROTOCOL
Hao Wu [Wed, 8 Feb 2017 03:20:37 +0000 (11:20 +0800)]
MdeModulePkg: Add the EFI_PRINT2S_PROTOCOL

Add the EFI_PRINT2S_PROTOCOL as a safe version of the EFI_PRINT2_PROTOCOL,
the EFI_PRINT2S_PROTOCOL replaces the following 2 services in
EFI_PRINT2_PROTOCOL:
UNICODE_VALUE_TO_STRING
ASCII_VALUE_TO_STRING

with:
UNICODE_VALUE_TO_STRING_S
ASCII_VALUE_TO_STRING_S

The 2 new services perform checks to the input parameters and will return
relative status to reflect the check result.

Return RETURN_INVALID_PARAMETER when:
1). The input Buffer is NULL.
2). The input BufferSize is greater than (PcdMaximumUnicodeStringLength *
sizeof (CHAR16) + 1) for UnicodeValueToStringS or greater than
PcdMaximumAsciiStringLength for AsciiValueToStringS.
3). The input Flags is not set properly.
4). The input Width is not smaller than MAXIMUM_VALUE_CHARACTERS.

Return RETURN_BUFFER_TOO_SMALL when:
1). The input BufferSize cannot hold the converted value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdePkg/BasePrintLib: Add safe print functions [A|U]ValueToStringS
Hao Wu [Fri, 23 Dec 2016 06:34:26 +0000 (14:34 +0800)]
MdePkg/BasePrintLib: Add safe print functions [A|U]ValueToStringS

Add the following 2 APIs:
UnicodeValueToStringS
AsciiValueToStringS

These safe version APIs are used to enhance their counterpart (APIs
without trailing 'S' in function names).

They perform checks to the input parameters and will return relative
status to reflect the check result.

Return RETURN_INVALID_PARAMETER when:
1). The input Buffer is NULL.
2). The input BufferSize is greater than (PcdMaximumUnicodeStringLength *
sizeof (CHAR16) + 1) for UnicodeValueToStringS or greater than
PcdMaximumAsciiStringLength for AsciiValueToStringS.
3). The input Flags is not set properly.
4). The input Width is not smaller than MAXIMUM_VALUE_CHARACTERS.

Return RETURN_BUFFER_TOO_SMALL when:
1). The input BufferSize cannot hold the converted value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdeModulePkg: Refine the services comments in EFI_PRINT2_PROTOCOL
Hao Wu [Wed, 8 Feb 2017 02:48:14 +0000 (10:48 +0800)]
MdeModulePkg: Refine the services comments in EFI_PRINT2_PROTOCOL

For the following 8 services in EFI_PRINT2_PROTOCOL:
UNICODE_BS_PRINT
UNICODE_S_PRINT
UNICODE_BS_PRINT_ASCII_FORMAT
UNICODE_S_PRINT_ASCII_FORMAT
ASCII_BS_PRINT
ASCII_S_PRINT
ASCII_BS_PRINT_UNICODE_FORMAT
ASCII_S_PRINT_UNICODE_FORMAT

They will ASSERT when:
1) The input parameter 'StartOfBuffer' is NULL if 'BufferSize' indicates
at least 1 Ascii/Unicode character can be held.
2) The input parameter 'FormatString' is NULL if 'BufferSize' indicates at
least 1 Ascii/Unicode character can be held.
3) The input parameter 'FormatString' contains more than
PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters.
4) The produced string contains more than
PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters.

This commits removes the ASSERT case 4) and add the following new ASSERT
case:
4) The input parameter 'BufferSize' is greater than
(PcdMaximumAsciiStringLength * sizeof (CHAR8)) for Ascii format string or
(PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1) for Unicode format
string.

And for those ASSERT cases, 0 will be returned by those services.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdeModulePkg/PrintLib: Refine the SPrint functions
Hao Wu [Mon, 19 Dec 2016 07:01:22 +0000 (15:01 +0800)]
MdeModulePkg/PrintLib: Refine the SPrint functions

For the following 12 APIs in MdeModulePkg/DxePrintLibPrint2Protocol:
UnicodeVSPrint
UnicodeBSPrint
UnicodeSPrint
UnicodeVSPrintAsciiFormat
UnicodeBSPrintAsciiFormat
UnicodeSPrintAsciiFormat
AsciiVSPrint
AsciiBSPrint
AsciiSPrint
AsciiVSPrintUnicodeFormat
AsciiBSPrintUnicodeFormat
AsciiSPrintUnicodeFormat

They will ASSERT when:
1) The input parameter 'StartOfBuffer' is NULL if 'BufferSize' indicates
at least 1 Ascii/Unicode character can be held.
2) The input parameter 'FormatString' is NULL if 'BufferSize' indicates at
least 1 Ascii/Unicode character can be held.
3) The input parameter 'FormatString' contains more than
PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters.
4) The produced string contains more than
PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters.

This commits removes the ASSERT case 4) and add the following new ASSERT
case:
4) The input parameter 'BufferSize' is greater than
(PcdMaximumAsciiStringLength * sizeof (CHAR8)) for Ascii format string or
(PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1) for Unicode format
string.

And for those ASSERT cases, 0 will be returned by those 12 APIs.

For the following 2 APIs in MdeModulePkg/DxePrintLibPrint2Protocol:
SPrintLength
SPrintLengthAsciiFormat

They will ASSERT when:
1) The input parameter 'FormatString' is NULL.
2) The input parameter 'FormatString' contains more than
PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters.

And for those ASSERT cases, 0 will be returned by those 2 APIs.

Now these APIs in the MdeModulePkg/DxePrintLibPrint2Protocol instance
follow the same rules with MdePkg/BasePrintLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdePkg/BasePrintLib: Refine the SPrint functions
Hao Wu [Mon, 19 Dec 2016 01:30:57 +0000 (09:30 +0800)]
MdePkg/BasePrintLib: Refine the SPrint functions

For the following 12 APIs in MdePkg/BasePrintLib:
UnicodeVSPrint
UnicodeBSPrint
UnicodeSPrint
UnicodeVSPrintAsciiFormat
UnicodeBSPrintAsciiFormat
UnicodeSPrintAsciiFormat
AsciiVSPrint
AsciiBSPrint
AsciiSPrint
AsciiVSPrintUnicodeFormat
AsciiBSPrintUnicodeFormat
AsciiSPrintUnicodeFormat

They will ASSERT when:
1) The input parameter 'StartOfBuffer' is NULL if 'BufferSize' indicates
at least 1 Ascii/Unicode character can be held.
2) The input parameter 'FormatString' is NULL if 'BufferSize' indicates at
least 1 Ascii/Unicode character can be held.
3) The input parameter 'FormatString' contains more than
PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters.
4) The produced string contains more than
PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters.

This commits removes the ASSERT case 4) and add the following new ASSERT
case:
4) The input parameter 'BufferSize' is greater than
(PcdMaximumAsciiStringLength * sizeof (CHAR8)) for Ascii format string or
(PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1) for Unicode format
string.

And for those ASSERT cases, 0 will be returned by those 12 APIs.

For the following 2 APIs in MdePkg/BasePrintLib:
SPrintLength
SPrintLengthAsciiFormat

They will ASSERT when:
1) The input parameter 'FormatString' is NULL.
2) The input parameter 'FormatString' contains more than
PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters.

And for those ASSERT cases, 0 will be returned by those 2 APIs.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdeModulePkg/PciBusDxe: Refine code to make it more readable
Ruiyu Ni [Mon, 20 Feb 2017 06:25:13 +0000 (14:25 +0800)]
MdeModulePkg/PciBusDxe: Refine code to make it more readable

The patch doesn't impact functionality.

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 agoMdeModulePkg/SdMmc: Avoid assigning 0 to the BlockSize of Trb
Hao Wu [Thu, 5 Jan 2017 01:43:21 +0000 (09:43 +0800)]
MdeModulePkg/SdMmc: Avoid assigning 0 to the BlockSize of Trb

Refine code to avoid potential divide by zero when calculating block
number.

Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoNetworkPkg/IpSecDxe: Add check to avoid possible divide by zero
Hao Wu [Wed, 16 Nov 2016 05:52:20 +0000 (13:52 +0800)]
NetworkPkg/IpSecDxe: Add check to avoid possible divide by zero

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
7 years agoSecurity Tcg2Smm: Add missing gEfiTcg2ProtocolGuid dependency
Star Zeng [Mon, 20 Feb 2017 06:13:42 +0000 (14:13 +0800)]
Security Tcg2Smm: Add missing gEfiTcg2ProtocolGuid dependency

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

gEfiTcgProtocolGuid dependency was added in TcgSmm.
But gEfiTcg2ProtocolGuid dependency is missing in Tcg2Smm.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
7 years agoSecurityPkg: enhance secure boot Config Dxe & Time Based AuthVariable.
Zhang Lubo [Thu, 5 Jan 2017 06:58:05 +0000 (14:58 +0800)]
SecurityPkg: enhance secure boot Config Dxe & Time Based AuthVariable.

V3: code clean up

prohibit Image SHA-1 hash option in SecureBootConfigDxe.
Timebased Auth Variable driver should ensure AuthAlgorithm
is SHA256 before further verification

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Long Qin <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
7 years agoNetworkPkg:Generate the correct operational state of the interface.
Zhang Lubo [Fri, 10 Feb 2017 03:05:34 +0000 (11:05 +0800)]
NetworkPkg:Generate the correct operational state of the interface.

Currently, When there are more than 9 Ethernet ports available,
'ifconfig6 -l' is not listing all the ports, only show the ports 0 to 9.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Santhapur Naveen <naveens@amiindia.co.in>
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>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
7 years agoMdeModulePkg:Generate the correct operational state of the interface.
Zhang Lubo [Fri, 10 Feb 2017 02:47:39 +0000 (10:47 +0800)]
MdeModulePkg:Generate the correct operational state of the interface.

Currently, When there are more than 9 Ethernet ports available,
'ifconfig -l' is not listing all the ports, only show the ports 0 to 9.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Santhapur Naveen <naveens@amiindia.co.in>
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>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
7 years agoMdeModulePkg/PciBusDxe: Fix IA32 build failure
Ruiyu Ni [Thu, 16 Feb 2017 06:01:53 +0000 (14:01 +0800)]
MdeModulePkg/PciBusDxe: Fix IA32 build failure

Compiler calculates the PciBar[BarIndex] using
sizeof (PciBar[0]) * BarIndex, when BarIndex is type of UINT64,
the above calculation generates assembly code using _allmul.

Change BarIndex to UINTN to avoid the build failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
7 years agoBaseTools: Fix bug for GUIDED tool path override by DSC [BuildOptions]
Yonghong Zhu [Wed, 15 Feb 2017 06:47:47 +0000 (14:47 +0800)]
BaseTools: Fix bug for GUIDED tool path override by DSC [BuildOptions]

Current the GUIDED tool path can't be override to the different path in
the [BuildOptions] of DSC file. This patch fix the bug.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=283
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 agoNetworkPkg/HttpBootDxe: Update to check specified media type
Jiaxin Wu [Wed, 15 Feb 2017 06:32:14 +0000 (14:32 +0800)]
NetworkPkg/HttpBootDxe: Update to check specified media type

IANA has approved below new media type for EFI http(s) boot usage:
  application/vnd.efi.img
  application/vnd.efi.iso

HTTP boot driver should be updated to check the above media type
from Content-Type header field.

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: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
7 years agoNetworkPkg/HttpBootDxe: Declare the functions as EFIAPI to pass the GCC build
Jiaxin Wu [Thu, 16 Feb 2017 01:15:11 +0000 (09:15 +0800)]
NetworkPkg/HttpBootDxe: Declare the functions as EFIAPI to pass the GCC build

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.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: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
7 years agoArmPlatformPkg/PL061Gpio: fix the offset value in Get function
Haojian Zhuang [Mon, 13 Feb 2017 07:53:00 +0000 (15:53 +0800)]
ArmPlatformPkg/PL061Gpio: fix the offset value in Get function

When call PL061GetPins() or PL061SetPins(), should use GPIO_PIN_MASK(offset)
as parameter, not offset.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG
Haojian Zhuang [Mon, 13 Feb 2017 07:52:59 +0000 (15:52 +0800)]
ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG

PL061_GPIO_DATA_REG offset is referenced in PL061EffectiveAddress ()
already. So remove the duplicated reference when invoke PL061GetPins ()
or PL061SetPins ().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoShellPkg/pci: Report error when invalid value is specified for "-ec"
Ruiyu Ni [Thu, 9 Feb 2017 09:24:05 +0000 (17:24 +0800)]
ShellPkg/pci: Report error when invalid value is specified for "-ec"

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 agoMdeModulePkg UefiBootManagerLib: Correct usages of GUID and Protocol
Liming Gao [Wed, 15 Feb 2017 08:40:07 +0000 (16:40 +0800)]
MdeModulePkg UefiBootManagerLib: Correct usages of GUID and Protocol

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

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoMdePkg/BaseLib: Refine logic for (Ascii)StrnLenS to handle MaxSize = 0
Hao Wu [Tue, 14 Feb 2017 02:11:58 +0000 (10:11 +0800)]
MdePkg/BaseLib: Refine logic for (Ascii)StrnLenS to handle MaxSize = 0

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

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
7 years agoNetworkPkg/HttpBootDxe: Request HTTP token notify as a DPC at TPL_CALLBACK
Jiaxin Wu [Tue, 14 Feb 2017 08:36:36 +0000 (16:36 +0800)]
NetworkPkg/HttpBootDxe: Request HTTP token notify as a DPC at TPL_CALLBACK

This patch is to update the HTTP token notify as a DPC at
TPL_CALLBACK to align with UEFI Spec.

Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.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: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
7 years agoNetworkPkg/iSCSIDxe: Update the condition for IScsiStart Abort
hegdenag [Mon, 13 Feb 2017 07:20:17 +0000 (15:20 +0800)]
NetworkPkg/iSCSIDxe: Update the condition for IScsiStart Abort

Update existing #define and add a new #define used for the
PCD PcdIScsiAIPNetworkBootPolicy. Update the code in iScsiStart
according to the #define changes in iScsiDriver.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
7 years agoNetworkPkg/NetworkPkg.dec: Update comments for the PCD
hegdenag [Mon, 13 Feb 2017 07:20:18 +0000 (15:20 +0800)]
NetworkPkg/NetworkPkg.dec: Update comments for the PCD

Update comment section for the PCD PcdIScsiAIPNetworkBootPolicy.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
7 years agoBaseTools: Enhance BaseTools supports FixedAtBuild usage in VFR file
Yonghong Zhu [Mon, 13 Feb 2017 05:10:43 +0000 (13:10 +0800)]
BaseTools: Enhance BaseTools supports FixedAtBuild usage in VFR file

This patch is to update BaseTools generate Fixed PCD APIs and Value into
$(MODULE_NAME)StrDefs.h for VFR only. If the module has VFR files, and it
directly consumes FixedAtBuild PCD, BaseTool will generate those
FixedAtBuild PCD value into its $(MODULE_NAME)StrDefs.h. FixedPcdGetXX
macro are always generated. Every FixedPcd _PCD_VALUE_PcdName will be
generated without the postfix U or UL or ULL.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=348
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 agoMdePkg ACPI: Incorrect definition name for ACPI IORT Table signature
Star Zeng [Fri, 10 Feb 2017 07:31:40 +0000 (15:31 +0800)]
MdePkg ACPI: Incorrect definition name for ACPI IORT Table signature

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

The definition name for ACPI IO Remapping Table signature is incorrect
in Acpi60.h and Acpi61.h as below:
EFI_ACPI_6_0_INTERRUPT_SOURCE_OVERRIDE_SIGNATURE
EFI_ACPI_6_1_INTERRUPT_SOURCE_OVERRIDE_SIGNATURE

The name should be changed to
EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE
EFI_ACPI_6_1_IO_REMAPPING_TABLE_SIGNATURE

The comments
///
/// "IORT" Interrupt Source Override
///
will be also changed to
///
/// "IORT" I/O Remapping Table
///

Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
7 years agoBaseTools: Add NOOPT target in CLANG38 tool chain
Liming Gao [Thu, 9 Feb 2017 06:09:02 +0000 (14:09 +0800)]
BaseTools: Add NOOPT target in CLANG38 tool chain

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

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
7 years agoMdePkg/Pci22.h: Deprecate out-of-Spec IncompatiblePciDevice macros
Ruiyu Ni [Wed, 25 Jan 2017 07:18:13 +0000 (15:18 +0800)]
MdePkg/Pci22.h: Deprecate out-of-Spec IncompatiblePciDevice macros

DEVICE_ID_NOCARE is defined as 0xFFFF but Spec says (UINT64) -1
should be used to match any VendorId/DeviceId/RevisionId/
SubsystemVendorId/SubsystemDeviceId.

PCI_BAR_OLD_ALIGN/PCI_BAR_EVEN_ALIGN/PCI_BAR_SQUAD_ALIGN/
PCI_BAR_DQUAD_ALIGN are defined but Spec doesn't have such
definitions.

PCI_BAR_ALL is defined as 0xFF but Spec says (UINT64)-1 should be
used to match all BARs.

PCI_ACPI_UNUSED and PCI_BAR_NOCHANGE are defined as 0 which
compliant with Spec but the name is too general and causes confusing.
IncompatiblePciDeviceSupport could directly use 0.

All of the above macros are marked as deprecated.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
7 years agoOvmfPkg/IncompatiblePci: Do not use deprecated macros
Ruiyu Ni [Mon, 6 Feb 2017 03:28:29 +0000 (11:28 +0800)]
OvmfPkg/IncompatiblePci: Do not use deprecated macros

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoMdeModulePkg/IncompatiblePci: Use MAX_UINTN to match any IDs
Ruiyu Ni [Thu, 26 Jan 2017 05:59:20 +0000 (13:59 +0800)]
MdeModulePkg/IncompatiblePci: Use MAX_UINTN to match any IDs

When the VendorId/DeviceId/RevisionId/SubsystemVendorId
/SubsystemDeviceId is MAX_UINTN, IncompatiblePciDeviceSupport
driver doesn't use it to match any IDs.
The patch fixes this bug.
Since PciBus driver always calls IncompatiblePciDeviceSupport
using IDs read from HW, MAX_UINTN is never passed to this
driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoMdeModulePkg/IncompatiblePciDevice: Do not use deprecated macros
Ruiyu Ni [Wed, 25 Jan 2017 08:06:49 +0000 (16:06 +0800)]
MdeModulePkg/IncompatiblePciDevice: Do not use deprecated macros

The patch replaces the following macros:
DEVICE_ID_NOCARE (0xFF) --> MAX_UINT64
PCI_ACPI_UNUSED (0) --> 0
PCI_BAR_ALL (0xFF) --> MAX_UINT64
PCI_BAR_NOCHANGE (0) --> 0
PCI_BAR_EVEN_ALIGN --> EVEN_ALIGN (local definition)

Since the PciBus driver was updated to accept Spec defined values
in previous commit, the above replacements don't impact
functionality.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoMdeModulePkg/PciBus: Accept Spec values as BarIndex and Alignment
Ruiyu Ni [Wed, 25 Jan 2017 07:55:55 +0000 (15:55 +0800)]
MdeModulePkg/PciBus: Accept Spec values as BarIndex and Alignment

PI spec IncompatiblePciSupport part defines (UINT64)-1 as all BARs
and 0 to use existing alignment. PciBus driver didn't accept these
values. It treated 0xFF as all BARs and 0xFFFFFFFFFFFFFFFFULL to use
existing alignment.
The patch changes the code to still accept old values while also
accept values defined in PI spec. So that the driver can provide
backward compatibility and follow spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoMdeModulePkg/PciSioSerialDxe: Use MAX_UINT8 instead of PCI_BAR_ALL
Ruiyu Ni [Wed, 25 Jan 2017 07:22:54 +0000 (15:22 +0800)]
MdeModulePkg/PciSioSerialDxe: Use MAX_UINT8 instead of PCI_BAR_ALL

When BarIndex equals to 0xFF, default value 0 is used as the BAR
index. Though PCI_BAR_ALL and MAX_UINT8 shares the same value,
using PCI_BAR_ALL is like to match any BAR not BAR 0, it's more
proper to use MAX_UINT8 here.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoShellPkg SmbiosView: Correct some outputs for Type 0/3/10
Star Zeng [Thu, 9 Feb 2017 09:06:24 +0000 (17:06 +0800)]
ShellPkg SmbiosView: Correct some outputs for Type 0/3/10

Type 0: Update "EDD Enhanced Disk Driver)..." to
"EDD (Enhanced Disk Driver)..." for
STR_SMBIOSVIEW_PRINTINFO_EDD_ENHANCED_DRIVER

Type 3: Use L"  Laptop" instead of L"  LapTop" in
SystemEnclosureTypeTable to match SMBIOS spec.

Type 10: The BIT7 of Device Type is representing the
status of device whether it is enabled or disabled.
But current code is not considering the BIT7 and will
print "Undefined Value" for enabled device. Type 41
has same definition of Device Type, the code is
correct and will be applied to Type 10 by this patch.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
7 years agoShellPkg SmbiosView: Eliminate trailing " | " in PrintBitsInfo()
Star Zeng [Wed, 18 Jan 2017 08:53:33 +0000 (16:53 +0800)]
ShellPkg SmbiosView: Eliminate trailing " | " in PrintBitsInfo()

Current PrintBitsInfo() will always print an additional trailing
" | " for the bit flags, for example,

Base Board Feature Flags: Hosting board |  Replaceable |

Th patch is to eliminate trailing " | " in PrintBitsInfo(), then
the output will be like below

Base Board Feature Flags: Hosting board |  Replaceable

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
7 years agoMdeModulePkg PiSmmIpl: Update SmmCommunication comments to match code logic
Liming Gao [Thu, 9 Feb 2017 07:03:18 +0000 (15:03 +0800)]
MdeModulePkg PiSmmIpl: Update SmmCommunication comments to match code logic

Cc: Star Zeng <star.zeng@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoMdeModulePkg PeiCore: Don't cache GUIDED section with AUTH_NOT_TESTED
Liming Gao [Sat, 4 Feb 2017 06:41:50 +0000 (14:41 +0800)]
MdeModulePkg PeiCore: Don't cache GUIDED section with AUTH_NOT_TESTED

If GUIDED section authentication has EFI_AUTH_STATUS_NOT_TESTED, its
matched extraction ppi may not be installed. So, don't cache its data.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
7 years agoMdeModulePkg PeiCore: Reset PeimNeedingDispatch when its security violation
Liming Gao [Sat, 4 Feb 2017 06:36:40 +0000 (14:36 +0800)]
MdeModulePkg PeiCore: Reset PeimNeedingDispatch when its security violation

When PEIM is security violation, its matched extraction ppi may not be
installed. So, its PeimNeedingDispatch will still reset to TRUE.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
7 years agoOvmfPkg/QemuBootOrderLib: Fix NOOPT build failure
Dandan Bi [Wed, 8 Feb 2017 05:39:40 +0000 (13:39 +0800)]
OvmfPkg/QemuBootOrderLib: Fix NOOPT build failure

This patch is to fix the IA32/NOOPT/VS Toolchain build failure.
The VS2015 failure log as below:
QemuBootOrderLib.lib(ExtraRootBusMap.obj) :
error LNK2001: unresolved external symbol __allmul
s:\..\Build\OvmfIa32\NOOPT_VS2015\IA32\MdeModulePkg\
Universal\BdsDxe\BdsDxe\DEBUG\BdsDxe.dll :
fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077:
'"C:\Program Files\Microsoft Visual Studio 14.0\Vc\bin\link.exe"' :
return code '0x460'
Stop.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoSignedCapsulePkg/EdkiiSystemCapsuleLib: Fix logic error.
Jiewen Yao [Tue, 7 Feb 2017 06:32:49 +0000 (22:32 -0800)]
SignedCapsulePkg/EdkiiSystemCapsuleLib: Fix logic error.

This patch fixes https://bugzilla.tianocore.org/show_bug.cgi?id=367

Cc: Wang Cloud <winggundum82@163.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Wang Cloud <winggundum82@163.com>
7 years agoNetworkPkg/NetworkPkg.uni: Define the prompt and help information for PcdAllowHttpCon...
Jiaxin Wu [Wed, 8 Feb 2017 04:56:54 +0000 (12:56 +0800)]
NetworkPkg/NetworkPkg.uni: Define the prompt and help information for PcdAllowHttpConnections

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: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
7 years agoMdeModulePkg/DxeHttpLib: Correct the return status for the HTTP Port/ContentLength
Jiaxin Wu [Wed, 8 Feb 2017 03:56:54 +0000 (11:56 +0800)]
MdeModulePkg/DxeHttpLib: Correct the return status for the HTTP Port/ContentLength

Replace AsciiStrDecimalToUintn with AsciiStrDecimalToUintnS to
return the correct status for the HTTP Port/ContentLength.

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: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
7 years agoSecurityPkg HashLibRouter: Avoid incorrect PcdTcg2HashAlgorithmBitmap
Star Zeng [Tue, 17 Jan 2017 09:58:26 +0000 (17:58 +0800)]
SecurityPkg HashLibRouter: Avoid incorrect PcdTcg2HashAlgorithmBitmap

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

Currently, when software HashLib (HashLibBaseCryptoRouter) and related
HashInstanceLib instances are used, PcdTcg2HashAlgorithmBitmap is
expected to be configured to 0 in platform dsc.
But PcdTcg2HashAlgorithmBitmap has default value 0xFFFFFFFF in
SecurityPkg.dec, and some platforms forget to configure it to 0 or
still configure it to 0xFFFFFFFF in platform dsc, that will make final
PcdTcg2HashAlgorithmBitmap value incorrect.

This patch is to add CONSTRUCTOR in HashLib (HashLibBaseCryptoRouter)
and PcdTcg2HashAlgorithmBitmap will be set to 0 in the CONSTRUCTOR.

Current HASH_LIB_PEI_ROUTER_GUID HOB created in
HashLibBaseCryptoRouterPei is shared between modules that link
HashLibBaseCryptoRouterPei.
To avoid mutual interference, separated HASH_LIB_PEI_ROUTER_GUID HOBs
with gEfiCallerIdGuid Identifier will be created for those modules.

This patch is also to add check in HashLib (HashLibBaseCryptoRouter)
for the mismatch of supported HashMask between modules that may link
different HashInstanceLib instances, warning will be reported if
mismatch is found.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
7 years agoMdeModulePkg/UefiBootManagerLib: Initialize Handle before using it
Ruiyu Ni [Mon, 6 Feb 2017 02:00:33 +0000 (10:00 +0800)]
MdeModulePkg/UefiBootManagerLib: Initialize Handle before using it

BmExpandMediaDevicePath contains a bug that it uses the
uninitialized Handle.

Since the function is called when the Handle supports BlockIo
or SimpleFileSystem, when there is no SimpleFileSystem installed
on the Handle, BlockIo is *guaranteed* to be installed on the Handle.
The fix initializes the Handle by locating the BlockIo protocol
from the device path.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Sunny Wang <sunnywang@hpe.com>
7 years agoVlv2DeviceRefCodePkg: Fixed thermal issue.
lushifex [Wed, 8 Feb 2017 02:42:35 +0000 (10:42 +0800)]
Vlv2DeviceRefCodePkg: Fixed thermal issue.

Fixed System auto shutdown when it reached minus 20 degree.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lushifex <shifeix.a.lu@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoEdkCompatibilityPkg: Fix some typos of "according"
Liming Gao [Wed, 8 Feb 2017 06:49:21 +0000 (14:49 +0800)]
EdkCompatibilityPkg: Fix some typos of "according"

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Rebecca Cran <rebecca@bluestop.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: He Junjie <junjie.he@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
7 years agoNetworkPkg: Fix some typos of "according"
Liming Gao [Wed, 8 Feb 2017 06:48:44 +0000 (14:48 +0800)]
NetworkPkg: Fix some typos of "according"

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Rebecca Cran <rebecca@bluestop.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: He Junjie <junjie.he@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
7 years agoMdeModulePkg: Fix some typos of "according"
Liming Gao [Wed, 8 Feb 2017 06:48:02 +0000 (14:48 +0800)]
MdeModulePkg: Fix some typos of "according"

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Rebecca Cran <rebecca@bluestop.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: He Junjie <junjie.he@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
7 years agoBaseTools: Fix the bug to parse the short varname in map file
Yonghong Zhu [Tue, 7 Feb 2017 08:05:13 +0000 (16:05 +0800)]
BaseTools: Fix the bug to parse the short varname in map file

current in the map file, there have two ways for var to save its offset,
if the varname is short, then the offset will in the same line with
varname, otherwise, it saved in the next line.

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 agoOvmfPkg/SmmControl2Dxe: select broadcast SMI if available
Laszlo Ersek [Wed, 30 Nov 2016 19:06:34 +0000 (20:06 +0100)]
OvmfPkg/SmmControl2Dxe: select broadcast SMI if available

When writing to IO port 0xB2 (ICH9_APM_CNT), QEMU by default injects an
SMI only on the VCPU that is writing the port. This has exposed corner
cases and strange behavior with edk2 code, which generally expects a
software SMI to affect all CPUs at once. We've experienced instability
despite the fact that OVMF sets PcdCpuSmmApSyncTimeout and
PcdCpuSmmSyncMode differently from the UefiCpuPkg defaults, such that they
match QEMU's unicast SMIs better. (Refer to edk2 commits 9b1e378811ff and
bb0f18b0bce6.)

Using the new fw_cfg-based SMI feature negotiation in QEMU (see commits
50de920b372b "hw/isa/lpc_ich9: add SMI feature negotiation via fw_cfg" and
5ce45c7a2b15 "hw/isa/lpc_ich9: add broadcast SMI feature"), we can ask
QEMU to broadcast SMIs. Extensive testing from earlier proves that
broadcast SMIs are only reliable if we use the UefiCpuPkg defaults for the
above PCDs. With those settings however, the broadcast is very reliable --
the most reliable configuration encountered thus far.

Therefore negotiate broadcast SMIs with QEMU, and if the negotiation is
successful, dynamically revert the PCDs to the UefiCpuPkg defaults.

Setting the PCDs in this module is safe:

- only PiSmmCpuDxeSmm consumes them,

- PiSmmCpuDxeSmm is a DXE_SMM_DRIVER, launched by the SMM_CORE
  (MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf),

- the SMM_CORE is launched by the SMM IPL runtime DXE driver
  (MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf),

- the SMM IPL has a DEPEX on EFI_SMM_CONTROL2_PROTOCOL,

- OvmfPkg/SmmControl2Dxe produces that protocol.

The end result is that PiSmmCpuDxeSmm cannot be dispatched before
SmmControl2Dxe installs EFI_SMM_CONTROL2_PROTOCOL and returns from its
entry point. Hence we can set the PCD's consumed by PiSmmCpuDxeSmm in
SmmControl2Dxe.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=230
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg: dynamic defaults for PcdCpuSmmApSyncTimeout, PcdCpuSmmSyncMode
Laszlo Ersek [Thu, 17 Nov 2016 21:21:35 +0000 (22:21 +0100)]
OvmfPkg: dynamic defaults for PcdCpuSmmApSyncTimeout, PcdCpuSmmSyncMode

Move the platform-specific default values for these PCDs from the
[PcdsFixedAtBuild] / [PcdsFixedAtBuild.X64] sections to the
[PcdsDynamicDefault] section.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=230
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoArmPkg/GenericWatchdogDxe: Declare MMIO PCDs as UINT64
Alexei [Mon, 6 Feb 2017 19:05:54 +0000 (19:05 +0000)]
ArmPkg/GenericWatchdogDxe: Declare MMIO PCDs as UINT64

PcdGenericWatchdogControlBase & PcdGenericWatchdogRefreshBase
are declared as UINT32 values in ArmPkg.dec, but for platforms
with addresses in the memory range above 4GB this causes build
error F000: Too large PCD value for datum type [UINT32]
of PCD gArmTokenSpaceGuid.PcdGenericWatchdogControlBase

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Alexei Fedorov <alexei.fedorov@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=361
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoBaseTools: Update top VS Makefile with the absolute path
Liming Gao [Fri, 3 Feb 2017 06:49:47 +0000 (14:49 +0800)]
BaseTools: Update top VS Makefile with the absolute path

After this update, BaseTools/Makefile can be trig at the other directory.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
7 years agoMdePkg: UefiTcgPlatform.h: Add TCG_PCR_EVENT2_HDR definition
Zhang, Chao B [Sat, 4 Feb 2017 01:19:00 +0000 (09:19 +0800)]
MdePkg: UefiTcgPlatform.h: Add TCG_PCR_EVENT2_HDR definition

Add TCG_PCR_EVENT2_HDR definition.
Follow TCG EFI Spec 2.0 00.13 Section 5.2 Crypto Agile Log Entry Format
https://trustedcomputinggroup.org/wp-content/uploads/EFI-Protocol-Specification-rev13-160330final.pdf
Cc: Long Qin <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
7 years agoSecurityPkg: Tcg2Dxe: Log EV_NO_ACTION event in TCG_PCR_EVENT2 format
Zhang, Chao B [Sat, 4 Feb 2017 01:17:19 +0000 (09:17 +0800)]
SecurityPkg: Tcg2Dxe: Log EV_NO_ACTION event in TCG_PCR_EVENT2 format

All the event log entry in TCG2 Event log format should be TCG_PCR_EVENT2
except event log header. Defined by TCG EFI Spec 2.0 00.13
https://trustedcomputinggroup.org/wp-content/uploads/EFI-Protocol-Specification-rev13-160330final.pdf

Cc: Long Qin <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
7 years agoShellPkg/cd: Do not print the destination dir when CD exits
Ruiyu Ni [Thu, 26 Jan 2017 04:32:33 +0000 (12:32 +0800)]
ShellPkg/cd: Do not print the destination dir when CD exits

Before the "cd fs0:dir" fix, CD only prints destination directory
when the destination contains ":".
However, the "cd fs0:dir" fix changed CD to always print destination
directory.

This patch changes CD to never print destination directory.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Cc: Chris J Phillips <chrisp@hpe.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
7 years agoArmVirtPkg/QemuFwCfgLib: implement QemuFwCfgSkipBytes() API
Laszlo Ersek [Fri, 27 Jan 2017 07:10:15 +0000 (08:10 +0100)]
ArmVirtPkg/QemuFwCfgLib: implement QemuFwCfgSkipBytes() API

We are now sufficiently equipped to implement the new QemuFwCfgSkipBytes()
API.

The previous patch and this one enable ArmVirtPkg/QemuFwCfgLib to
overwrite part of a writeable fw_cfg file, which will be particularly
useful for the upcoming QEMU_LOADER_WRITE_POINTER command in
OvmfPkg/AcpiPlatformDxe.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoArmVirtPkg/QemuFwCfgLib: use DMA for QemuFwCfgWriteBytes() if available
Laszlo Ersek [Fri, 27 Jan 2017 06:29:12 +0000 (07:29 +0100)]
ArmVirtPkg/QemuFwCfgLib: use DMA for QemuFwCfgWriteBytes() if available

We use the "InternalQemuFwCfgReadBytes" static function pointer to
dispatch the reading of fw_cfg bytes between MMIO and DMA. This pointer is
initialized to MMIO, and we set it to DMA in the library constructor if
DMA is available.

Unlike the above, we write fw_cfg bytes only with MMIO at the moment.
Extend the write functionality so that it follows the read pattern:
- introduce the new function typedef WRITE_BYTES_FUNCTION,
- extract the current (MMIO-only) write internals from
  QemuFwCfgWriteBytes() to MmioWriteBytes(),
- provide a DMA-based implementation in DmaWriteBytes() -- a thin wrapper
  around DmaTransferBytes(),
- set the new static function pointer "InternalQemuFwCfgWriteBytes"
  according to the DMA feature provided by QEMU,
- In QemuFwCfgWriteBytes(), call the best available method through
  "InternalQemuFwCfgWriteBytes".

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoArmVirtPkg/QemuFwCfgLib: extract generic DmaTransferBytes() function
Laszlo Ersek [Fri, 27 Jan 2017 05:56:19 +0000 (06:56 +0100)]
ArmVirtPkg/QemuFwCfgLib: extract generic DmaTransferBytes() function

The DmaReadBytes() function that we currently use only for reading --
through the InternalQemuFwCfgReadBytes function pointer, in case the DMA
interface is available -- is suitable with minimal changes for two more
operations provided by the DMA interface, WRITE and SKIP. Expose the
Control parameter in the function prototype, rename the function to
DmaTransferBytes(), and rebase DmaReadBytes() to it.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg/QemuFwCfgLib: add QemuFwCfgSkipBytes()
Laszlo Ersek [Fri, 27 Jan 2017 05:35:41 +0000 (06:35 +0100)]
OvmfPkg/QemuFwCfgLib: add QemuFwCfgSkipBytes()

Introduce the new public API QemuFwCfgSkipBytes(), for advancing over
bytes in the selected firmware configuration item without transferring
data between the item and the caller.

When the DMA interface is available (the common case), the operation is
instantaneous. As a fallback, provide a loop of chunked reads into a small
stack-allocated scratch buffer.

This patch enables OvmfPkg/QemuFwCfgLib to overwrite part of a writeable
fw_cfg file, which will be particularly useful for the upcoming
QEMU_LOADER_WRITE_POINTER command in OvmfPkg/AcpiPlatformDxe.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg/QemuFwCfgLib: generalize InternalQemuFwCfgDmaBytes() to SKIP op
Laszlo Ersek [Fri, 27 Jan 2017 04:49:03 +0000 (05:49 +0100)]
OvmfPkg/QemuFwCfgLib: generalize InternalQemuFwCfgDmaBytes() to SKIP op

The fw_cfg DMA interface provides a simple method to skip over bytes in an
fw_cfg blob before reading or writing more bytes.
InternalQemuFwCfgDmaBytes() can support it easily, we just have to expose
the Control parameter more flexibly than the current "Write" BOOLEAN.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoArmPlatformPkg/TZASC: Allow specifying subregions to be disabled
Bhupesh Sharma [Fri, 20 Jan 2017 11:40:45 +0000 (17:10 +0530)]
ArmPlatformPkg/TZASC: Allow specifying subregions to be disabled

ARM TZASC-380 IP provides a mechanism to split memory regions being
protected via it into eight equal-sized sub-regions. A bit-setting
allows the corresponding subregion to be disabled.

Several NXP/FSL SoCs support the TZASC-380 IP block and allow
the DDR connected via the TZASC to be partitioned into regions
having different security settings and also allow subregions
to be disabled.

This patch enables this support and can be used for SoCs which
support such a partition of DDR regions.

Details of the 'subregion_disable' register can be viewed here:
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0431c/CHDIGDCI.html

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@nxp.com>
[bhupesh.linux@gmail.com : Added gmail ID as NXP one is no longer valid]
Signed-off-by: Bhupesh Sharma <bhupesh.linux@gmail.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoSecurityPkg: Tcg2Dxe: Update PCR[4] measure logic
Zhang, Chao B [Wed, 25 Jan 2017 04:50:55 +0000 (12:50 +0800)]
SecurityPkg: Tcg2Dxe: Update PCR[4] measure logic

Update PCR[4] measure logic for each boot attempt.
1. Measure event to PCR[4] instead of PCR[5]
2. Measure “Calling UEFI Application from Boot Option”
http://www.trustedcomputinggroup.org/wp-content/uploads/PC-ClientSpecific_Platform_Profile_for_TPM_2p0_Systems_v21.pdf

Cc: Star Zeng <star.zeng@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
7 years agoSecurityPkg/Tpm12CommandLib: Always check response returnCode
Michael Kinney [Tue, 10 Jan 2017 16:46:20 +0000 (08:46 -0800)]
SecurityPkg/Tpm12CommandLib: Always check response returnCode

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

Update the Tpm12CommandLib to consistently check the returnCode
field of a response packet.  These checks are missing from the
GetCapability and SelfTest commands.  The functions
Tpm12ContinueSelfTest(), Tpm12GetCapabilityFlagPermanent(), and
Tpm12GetCapabilityFlagVolatile() are updated to verify that the
response returnCode is not an error.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
7 years agoArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe: Fixed crash on Juno R0
Daniil Egranov [Tue, 24 Jan 2017 02:01:06 +0000 (20:01 -0600)]
ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe: Fixed crash on Juno R0

The Marvell Yukon MAC address load supported only on Juno R1 and R2.
It disabled for Juno R0 due to PCI issues on this board.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daniil Egranov <daniil.egranov@arm.com>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoShellPkg/pci: Fix extended register dumping for MFVC capability
Ruiyu Ni [Tue, 24 Jan 2017 06:40:30 +0000 (14:40 +0800)]
ShellPkg/pci: Fix extended register dumping for MFVC capability

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

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 agoShellPkg/pci: Support interpreting specific PCIE ext cap thru "-ec"
Ruiyu Ni [Mon, 23 Jan 2017 10:49:33 +0000 (18:49 +0800)]
ShellPkg/pci: Support interpreting specific PCIE ext cap thru "-ec"

The implementation was already there but through a private flag
"-_e". The patch removes "-_e" support and add "-ec" support.
Removing old "-_e" support makes the pci command more clean.

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 agoShellPkg/pci: Use PCI definitions defined in MdePkg
Ruiyu Ni [Mon, 23 Jan 2017 10:43:26 +0000 (18:43 +0800)]
ShellPkg/pci: Use PCI definitions defined in MdePkg

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

The patch removes the local PCI definitions and uses the definitions
defined in MdePkg/Include/IndustryStandard folder.
There is no functionality impact.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jarben.carsey@intel.com>