]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
4 years agoNetworkPkg/Ip6Dxe: Validate source data record length
Michael Kubacki [Wed, 8 Apr 2020 05:46:37 +0000 (22:46 -0700)]
NetworkPkg/Ip6Dxe: Validate source data record length

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

Ip6ConfigReadConfigData() reads configuration data from a UEFI variable
and copies the data to another buffer. This change checks that the
length
of the data record being copied does not exceed the size of the source
UEFI variable data buffer.

If the size is exceeded, this change follows existing logic to treat the
variable as corrupted and deletes the variable so it will be set again.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
4 years agoNetworkPkg/SnpDxe: Prevent invalid PCI BAR access
Michael Kubacki [Thu, 9 Apr 2020 03:02:05 +0000 (20:02 -0700)]
NetworkPkg/SnpDxe: Prevent invalid PCI BAR access

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

SnpDxe initializes values for MemoryBarIndex and IoBarIndex to 0 and 1
respectively even if calls to PciIo->GetBarAttributes never return
success.

Later, if the BAR is used to perform IO/Mem reads/writes, a potentially
non-existent BAR index may be accessed. This change initializes the
values
to an invalid BAR index (PCI_MAX_BAR) so the condition can be explicitly
checked to avoid an invalid BAR access.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
4 years agoNetworkPkg/SnpDxe: Register SnpNotifyExitBootServices at TPL_CALLBACK
Michael Kubacki [Thu, 9 Apr 2020 18:16:20 +0000 (11:16 -0700)]
NetworkPkg/SnpDxe: Register SnpNotifyExitBootServices at TPL_CALLBACK

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

The current SnpDxe implementation registers its ExitBootServices event
notification function (SnpNotifyExitBootServices ()) at TPL_NOTIFY. This
function calls PxeShutdown() which issues an UNDI  shutdown operation.
Ultimately, this may invoke Shutdown() in EFI_SIMPLE_NETWORK_PROTOCOL.

The UEFI specification 2.8A Table 27 "TPL Restrictions" restricts the
TPL
for Simple Network Protocol to <= TPL_CALLBACK. In addition, it has been
observed in some 3rd party UNDI drivers to cause an issue further down
the call stack if the TPL is higher than TPL_CALLBACK on invocation.

Therefore, this commit changes the TPL of SnpNotifyExitBootServices() to
TPL_CALLBACK.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
4 years agoMdePkg: Add AML FieldList OpCode definitions
Pierre Gondois [Mon, 30 Mar 2020 08:52:38 +0000 (16:52 +0800)]
MdePkg: Add AML FieldList OpCode definitions

The ACPI specification, version 6.3, January 2019,
defines the Named Objects Encoding for FieldElements
in section '20.2.5.2 Named Objects Encoding'.
FieldElements can be one of the following:
NamedField | ReservedField | AccessField |
ExtendedAccessField | ConnectField

Some of these keywords are starting with an opcode,
allowing to identify their type.
E.g.: ReservedField := 0x00 PkgLength

This patch adds these FieldElement opcodes definitions to
the list of AML Opcode definitions.

Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
4 years agoMdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro
Laszlo Ersek [Thu, 9 Apr 2020 11:30:17 +0000 (13:30 +0200)]
MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro

NonDiscoverablePciDeviceDxe currently #defines the module-internal
PCI_MAX_BARS macro, with value 6 (and type "int").

Remove this private macro definition, and adopt PCI_MAX_BAR from
"MdePkg/Include/IndustryStandard/Pci22.h". Both the value and the type
remain unchanged (the standard PCI_MAX_BAR macro expands to 0x0006).

"NonDiscoverablePciDeviceIo.h" gets the definition of PCI_MAX_BAR via its
existent #include <IndustryStandard/Pci.h> directive.

Build-tested only.

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20200409113017.18233-1-lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoBaseTools: Make brotli a submodule
Shenglei Zhang [Fri, 21 Feb 2020 02:21:06 +0000 (10:21 +0800)]
BaseTools: Make brotli a submodule

Use submodule way to access brotli in BaseTools based on
brotli version 666c3280cc11dc433c303d79a83d4ffbdd12cc8d.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2558

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg/BrotliCustomDecompressLib: Make brotli a submodule
Shenglei Zhang [Wed, 12 Feb 2020 10:08:15 +0000 (18:08 +0800)]
MdeModulePkg/BrotliCustomDecompressLib: Make brotli a submodule

Use submodule way to access brotli in MdeModulePkg based on
brotli version 666c3280cc11dc433c303d79a83d4ffbdd12cc8d.
The newly added BrotliDecUefiSupport.h/.c are used by directory
'brotli'.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2559

Cc: Liming Gao <liming.gao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdePkg/UefiScsiLib: Set FUA bit for synchronous SCSI Write operations
Zurcher, Christopher J [Thu, 26 Mar 2020 07:34:24 +0000 (15:34 +0800)]
MdePkg/UefiScsiLib: Set FUA bit for synchronous SCSI Write operations

The FUA (Force Unit Access) bit forces data to be written directly to
disk instead of the write cache. This prevents data from being lost if a
shutdown or reset is requested immediately after a SCSI write operation.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
4 years agoMdePkg DebugLib: Enable FILE NAME as DEBUG ASSERT for CLANG
Zhiguang Liu [Wed, 18 Mar 2020 01:39:30 +0000 (09:39 +0800)]
MdePkg DebugLib: Enable FILE NAME as DEBUG ASSERT for CLANG

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1548
For clang compiler, This change will make the generated image not include the
absolute file path. If so, the generated debug image can be reproduced in the
different root directory. Also, it will reduce the size of debug image size.
To do so, use __FILE_NAME__ macro to replace __FILE__. __FILE_NAME__ is
Clang-specific extension that functions similar to __FILE__ but only renders
the last path component (the filename) instead of an invocation dependent full
path to that file, and __FILE_NAME__ is introduced since clang 9.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
4 years agoBaseTools/WindowsVsToolChain.py: Update toolchain plugin
Shenglei Zhang [Tue, 7 Apr 2020 06:19:55 +0000 (14:19 +0800)]
BaseTools/WindowsVsToolChain.py: Update toolchain plugin

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2659
Allow WindowsVsToolChain Plugin to add libraries and headers
of user defined ARCH for VS2017 and VS2019.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
4 years ago.azurepiplines/pr-gate-steps.yml: Update python to 3.8.x for ci build
Shenglei Zhang [Tue, 7 Apr 2020 03:13:08 +0000 (11:13 +0800)]
.azurepiplines/pr-gate-steps.yml: Update python to 3.8.x for ci build

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2617
Update edk2 build and test ci to use Python 3.8.x

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
4 years agopip-requirements.txt: Update extensions min version to 0.13.3
Shenglei Zhang [Tue, 7 Apr 2020 03:07:50 +0000 (11:07 +0800)]
pip-requirements.txt: Update extensions min version to 0.13.3

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2616
Pytool extensions are locked on 0.12.x but extensions has
moved to 0.13.x. So update the pip-requirements.txt.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Remove useless code in ResetTokens.
Dong, Eric [Fri, 10 Apr 2020 06:54:01 +0000 (14:54 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Remove useless code in ResetTokens.

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

After remove Used parameter, below code in ResetTokens can also be
removed:
1. The RunningApCount parameter will be reset in GetFreeToken.
2. The ReleaseSpinLock should be called in ReleaseToken function,
   Code in this function seems like a later fix if ReleaseToken not
   Release it. We should remove code here and fix the real issue if
   existed.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Remove Used parameter.
Dong, Eric [Fri, 10 Apr 2020 06:54:00 +0000 (14:54 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Remove Used parameter.

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

After patch "UefiCpuPkg/PiSmmCpuDxeSmm: Improve the
performance of GetFreeToken()" which adds new parameter
FirstFreeToken, it's not need to use Uses parameter.
This patch used to remove this parameter.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Improve the performance of GetFreeToken()
Ray Ni [Fri, 10 Apr 2020 02:51:26 +0000 (10:51 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Improve the performance of GetFreeToken()

Today's GetFreeToken() runs at the algorithm complexity of O(n)
where n is the size of the token list.

The change introduces a new global variable FirstFreeToken and it
always points to the first free token. So the algorithm complexity
of GetFreeToken() decreases from O(n) to O(1).

The improvement matters when some SMI code uses StartupThisAP()
service for each of the AP such that the algorithm complexity
becomes O(n) * O(m) where m is the AP count.

As next steps,
1. PROCEDURE_TOKEN.Used field can be optimized out because
all tokens before FirstFreeToken should have "Used" set while all
after FirstFreeToken should have "Used" cleared.
2. ResetTokens() can be optimized to only reset tokens before
FirstFreeToken.

v2: add missing line in InitializeDataForMmMp.
v3: update copyright year to 2020.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoEmulatorPkg: Add MagicPageLib header file declaration.
Guomin Jiang [Tue, 7 Apr 2020 09:42:55 +0000 (17:42 +0800)]
EmulatorPkg: Add MagicPageLib header file declaration.

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

Add the public header file declaration.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoEmulatorPkg/WinHost: Add link flags for VS2019 tool chains.
Guomin Jiang [Thu, 19 Mar 2020 06:15:46 +0000 (14:15 +0800)]
EmulatorPkg/WinHost: Add link flags for VS2019 tool chains.

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

The link flags for VS2019 is absent and result the build fail.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoMdeModulePkg/RegularExpressionDxe: Make oniguruma a submodule in edk2.
Shenglei Zhang [Fri, 27 Dec 2019 06:28:20 +0000 (14:28 +0800)]
MdeModulePkg/RegularExpressionDxe: Make oniguruma a submodule in edk2.

Use submodule way to access oniguruma. And upgrade oniguruma
version from v6.9.3 to v6.9.4_mark1.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2073

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoArmVirtPkg: Include NVMe support in ArmVirtQemu*
Leendert van Doorn [Fri, 4 Jan 2019 21:18:15 +0000 (15:18 -0600)]
ArmVirtPkg: Include NVMe support in ArmVirtQemu*

Enable support for NVMe storage in ArmVirtQemu/QemVirtQemuKernel in order
to simplify booting/installing operating systems that don't support
virtio.

Signed-off-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years ago.mailmap: add entry for Eugene Cohen reflecting email change
Eugene Cohen [Tue, 7 Apr 2020 22:16:51 +0000 (16:16 -0600)]
.mailmap: add entry for Eugene Cohen reflecting email change

Signed-off-by: Eugene Cohen <eugene@nuviainc.com>
Message-Id: <c9030879814f4b911492a5a3ef631a7f7fc08336.1586295726.git.eugene@nuviainc.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
4 years ago.mailmap: update description to account for job changes
Eugene Cohen [Tue, 7 Apr 2020 22:16:50 +0000 (16:16 -0600)]
.mailmap: update description to account for job changes

Signed-off-by: Eugene Cohen <eugene@nuviainc.com>
Message-Id: <6b312e3cb962d149db146f009237cda2a8df132d.1586295726.git.eugene@nuviainc.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
4 years agoBaseTools: Use SEH exceptions in CLANGPDB for IA32
Vitaly Cheptsov [Fri, 27 Mar 2020 10:45:59 +0000 (18:45 +0800)]
BaseTools: Use SEH exceptions in CLANGPDB for IA32

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

This patch reduces the size of IA32 binaries by ensuring that
no .debug_frame / .eh_frame sections are generated through forcing
SEH exception model, which is already the default in clang for X64.

EDK II does not support exceptions, and in future we should disable
them instead of switching to some other variant. Currently this
is not possible due to the following LLVM bugs:

https://bugs.llvm.org/show_bug.cgi?id=45324
https://bugs.llvm.org/show_bug.cgi?id=45325

Upon applying this patch OvmfPkgIA32.dsc compilation in DEBUG mode
gets the following size decrease with clang 9.0.1.

Before: FV Space Information
SECFV [11%Full] 212992 total, 24512 used, 188480 free
PEIFV [22%Full] 917504 total, 203048 used, 714456 free
DXEFV [36%Full] 11534336 total, 4215672 used, 7318664 free
FVMAIN_COMPACT [37%Full] 3440640 total, 1287776 used, 2152864 free

After: FV Space Information
SECFV [10%Full] 212992 total, 22112 used, 190880 free
PEIFV [19%Full] 917504 total, 176392 used, 741112 free
DXEFV [31%Full] 11534336 total, 3657112 used, 7877224 free
FVMAIN_COMPACT [33%Full] 3440640 total, 1153896 used, 2286744 free

Cc: Liming Gao <liming.gao@intel.com>
Cc: Marvin H?user <mhaeuser@outlook.de>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
4 years agoOvmfPkg: supply missing lib class declarations in the DEC file
Laszlo Ersek [Tue, 7 Apr 2020 10:05:45 +0000 (12:05 +0200)]
OvmfPkg: supply missing lib class declarations in the DEC file

List the header files in the OvmfPkg DEC file for the following lib
classes:

- MemEncryptSevLib (one instance: BaseMemEncryptSevLib)

- PlatformFvbLib (two instances: EmuVariableFvbLib, PlatformFvbLibNull)

- VirtioLib (one instance: VirtioLib)

- VirtioMmioDeviceLib (one instance: VirtioMmioDeviceLib)

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2662
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20200407100545.25406-1-lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agoMdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index
Guomin Jiang [Fri, 3 Apr 2020 04:11:17 +0000 (12:11 +0800)]
MdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2272
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2287
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2288
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2289
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2290

Index should be off-by one than size of array, so when check
array, the max index should less than size of array.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoCryptoPkg/BaseHashApiLib: Rename BaseHashApiLib by HashApiLib
GuoMinJ [Thu, 5 Mar 2020 06:40:56 +0000 (14:40 +0800)]
CryptoPkg/BaseHashApiLib: Rename BaseHashApiLib by HashApiLib

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

According to CryptoPkg.dsc, the library class only have HashApiLib, so i
think the BaseHashApiLib should be considered as base name rather than
library class.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
Reviewed-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
4 years agoCryptoPkg/BaseCryptLibOnProtocolPpi: Add missing comments
GuoMinJ [Thu, 5 Mar 2020 06:40:55 +0000 (14:40 +0800)]
CryptoPkg/BaseCryptLibOnProtocolPpi: Add missing comments

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

DxeCryptLibConstructor have no comments for it, add comments for it.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
Reviewed-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
4 years agoRevert "TlsAuthConfigDxe: fix TlsCaCertificate attributes retrieval"
Michael Kubacki [Sat, 28 Mar 2020 05:55:36 +0000 (05:55 +0000)]
Revert "TlsAuthConfigDxe: fix TlsCaCertificate attributes retrieval"

This reverts commit 6896efdec2709e530b23c688cf0f31706709a0c5.

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

GetVariable() now returns attributes when it fails with
EFI_BUFFER_TOO_SMALL. Therefore, commit 6896efdec270 is
reverted since it is no longer relevant.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoMdeModulePkg VariablePei: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL
Michael Kubacki [Fri, 27 Mar 2020 21:55:35 +0000 (05:55 +0800)]
MdeModulePkg VariablePei: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL

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

This commit makes the behavior for PeiGetVariable() match the following
specification-defined behavior. It is now consistent with the DXE/SMM
variable driver implementation.

The UEFI specification v2.8 Errata A Section 8.2 "GetVariable()"
"Attributes" parameter description states:

"If not NULL, a pointer to the memory location to return the
 attributes bitmask for the variable. See 'Related Definitions.'
 If not NULL, then Attributes is set on output both when
 EFI_SUCCESS and when EFI_BUFFER_TOO_SMALL is returned."

The attributes were previously only returned from the implementation
in Variable.c on EFI_SUCCESS. They are now returned on EFI_SUCCESS or
EFI_BUFFER_TOO_SMALL according to spec.

Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Guomin Jiang <guomin.jiang@intel.com>
4 years agoMdeModulePkg Variable: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL
Michael Kubacki [Fri, 27 Mar 2020 21:55:34 +0000 (05:55 +0800)]
MdeModulePkg Variable: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL

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

The UEFI specification v2.8 Errata A Section 8.2 "GetVariable()"
"Attributes" parameter description states:

"If not NULL, a pointer to the memory location to return the
 attributes bitmask for the variable. See 'Related Definitions.'
 If not NULL, then Attributes is set on output both when
 EFI_SUCCESS and when EFI_BUFFER_TOO_SMALL is returned."

The attributes were previously only returned from the implementation
in Variable.c on EFI_SUCCESS. They are now returned on EFI_SUCCESS or
EFI_BUFFER_TOO_SMALL according to spec.

Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Guomin Jiang <guomin.jiang@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years ago.azurepipelines: Update CI steps
Sean Brogan [Wed, 1 Apr 2020 07:14:37 +0000 (00:14 -0700)]
.azurepipelines: Update CI steps

Update CI steps to build base tools after setup and update,
as basetools might have dependencies that need to be resolved.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg/DxeCore: merge properties table routines into MAT handling
Ard Biesheuvel [Tue, 7 Apr 2020 07:48:30 +0000 (09:48 +0200)]
MdeModulePkg/DxeCore: merge properties table routines into MAT handling

The memory attributes table handling code shared some parts of the
properties table handling code when it was introduced. The latter has
been dropped, and so we can merge the remaining pieces into the former.

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=2633
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoMdePkg: remove PropertiesTable GUID
Ard Biesheuvel [Tue, 7 Apr 2020 07:48:25 +0000 (09:48 +0200)]
MdePkg: remove PropertiesTable GUID

Remove the GUID definition that describes the deprecated properties table,
which is no longer generated by the DXE core.

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=2633
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoMdeModulePkg: disable properties table generation but retain the code
Ard Biesheuvel [Tue, 7 Apr 2020 07:48:19 +0000 (09:48 +0200)]
MdeModulePkg: disable properties table generation but retain the code

This is the minimal change required to stop exposing the EFI properties
table, which is deprecated. Given how the implementation is entangled
with the code that exposes the related memory attributes table, most of
the code is retained, and further cleanups are relegated to subsequent
patches.

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=2633
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoOvmfPkg: remove handling of properties table
Ard Biesheuvel [Tue, 7 Apr 2020 07:48:06 +0000 (09:48 +0200)]
OvmfPkg: remove handling of properties table

The UEFI properties table and the associated memory protection feature was
severely broken from the start, and has been deprecated for a while. Let's
drop all references to it from OVMF so we can safely remove it from the
DXE core as well.

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=2633
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoBaseTools: Update Edk2ToolsBuild.py to use multiple threads on Linux
Sean Brogan [Thu, 2 Apr 2020 17:04:52 +0000 (01:04 +0800)]
BaseTools: Update Edk2ToolsBuild.py to use multiple threads on Linux

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

Azure Pipelines agents have 2 threads. This commit has been shown to
reduce the build time in half on those agents.

Cc: Bob C Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Bob C Feng <bob.c.feng@intel.com>
4 years agoArmPkg: rename misleading local #define in CpuDxe
Leif Lindholm [Fri, 3 Apr 2020 11:30:46 +0000 (12:30 +0100)]
ArmPkg: rename misleading local #define in CpuDxe

The local #define TT_ATTR_INDX_INVALID is used as a local error code
in the AArch64 implementation, but is misleadingly named to match the
definitions in ArmPkg/Include/Chipset/AArch64Mmu.h.

Rename it INVALID_ENTRY to reduce confusion and improve readability.

Signed-off-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
4 years ago.python/SpellCheck: Add "RISCV" to "words" section
Abner Chang [Mon, 30 Mar 2020 06:23:24 +0000 (14:23 +0800)]
.python/SpellCheck: Add "RISCV" to "words" section

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

Add RISCV to "words" section in cspell.base.yaml file to avoid spelling check error.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg: Use LockBoxNullLib for RISC-V
Abner Chang [Fri, 27 Mar 2020 03:14:17 +0000 (11:14 +0800)]
MdeModulePkg: Use LockBoxNullLib for RISC-V

RISC-V doesn't have SMM.

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

Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Cc: Abner Chang <abner.chang@hpe.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
# Conflicts:
# MdeModulePkg/MdeModulePkg.dsc

4 years agoMdePkg/DxeServicesLib: Add RISC-V architecture
Daniel Schaefer [Tue, 3 Mar 2020 17:31:30 +0000 (18:31 +0100)]
MdePkg/DxeServicesLib: Add RISC-V architecture

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

Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Cc: Abner Chang <abner.chang@hpe.com>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
4 years agoUnitTestFrameworkPkg: Add RISC-V architecture for RISC-V EDK2 CI.
Abner Chang [Fri, 28 Feb 2020 14:30:54 +0000 (22:30 +0800)]
UnitTestFrameworkPkg: Add RISC-V architecture for RISC-V EDK2 CI.

Add RISC-V architecture to UnitTestFrameworkPkg for RISC-V EDK2 CI.

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

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
4 years agoShellPkg: Shell package changes for RISC-V EDK2 CI.
Abner Chang [Fri, 28 Feb 2020 14:26:38 +0000 (22:26 +0800)]
ShellPkg: Shell package changes for RISC-V EDK2 CI.

Add RISC-V architecture to ShellPkg for EDK2 CI testing.

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

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Acked-by: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
4 years agoSecurityPkg: Security package changes for RISC-V EDK2 CI.
Abner Chang [Fri, 28 Feb 2020 14:23:27 +0000 (22:23 +0800)]
SecurityPkg: Security package changes for RISC-V EDK2 CI.

Add RISC-V architecture to SecurityPkg for EDK2 CI testing.

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

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
4 years agoMdePkg/Include: Add RISC-V related definitions EDK2 CI.
Abner Chang [Fri, 28 Feb 2020 14:19:45 +0000 (22:19 +0800)]
MdePkg/Include: Add RISC-V related definitions EDK2 CI.

HTTP/PXE boot RISC-V related definitions for EDK2 CI.

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

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
4 years agoCryptoPkg: Add RISC-V architecture for EDK2 CI.
Abner Chang [Fri, 27 Mar 2020 03:08:01 +0000 (11:08 +0800)]
CryptoPkg: Add RISC-V architecture for EDK2 CI.

Add RISC-V architecture for EDK2 CI testing.

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

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Co-authored-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
4 years agoNetworkPkg/HttpBootDxe: Add RISC-V architecture for EDK2 CI.
Abner Chang [Fri, 28 Feb 2020 07:41:47 +0000 (15:41 +0800)]
NetworkPkg/HttpBootDxe: Add RISC-V architecture for EDK2 CI.

Add RISC-V architecture for EDK2 CI testing.

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

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
4 years agoNetworkPkg: Add RISC-V architecture for EDK2 CI.
Abner Chang [Fri, 28 Feb 2020 07:40:44 +0000 (15:40 +0800)]
NetworkPkg: Add RISC-V architecture for EDK2 CI.

Add RISC-V architecture for EDK2 CI testing.

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

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
4 years agoFmpDevicePkg: Add RISC-V architecture for EDK2 CI.
Abner Chang [Fri, 28 Feb 2020 07:38:04 +0000 (15:38 +0800)]
FmpDevicePkg: Add RISC-V architecture for EDK2 CI.

Add RISC-V architecture for EDK2 CI testing.

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

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
4 years agoFatPkg: Add RISC-V architecture for EDK2 CI.
Abner Chang [Fri, 28 Feb 2020 07:29:52 +0000 (15:29 +0800)]
FatPkg: Add RISC-V architecture for EDK2 CI.

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

Add RISC-V architecture for EDK2 CI testing.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
4 years agoArmPkg/ArmMmuLib: drop unused TT_ATTR_INDX_INVALID CPP macro
Ard Biesheuvel [Tue, 31 Mar 2020 17:25:11 +0000 (19:25 +0200)]
ArmPkg/ArmMmuLib: drop unused TT_ATTR_INDX_INVALID CPP macro

TT_ATTR_INDX_INVALID is #define'd but never used so drop it. Note
that this leaves a CPP macro of the same name in CpuDxe, but there,
it is actually being used, and although the name suggests that this
value is somehow defined by the architecture, this is really not the
case and it only has meaning within the scope of CpuDxe's implementation.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
4 years agoArmPkg/ArmMmuLib: get rid of GetRootTranslationTableInfo()
Ard Biesheuvel [Tue, 31 Mar 2020 17:25:06 +0000 (19:25 +0200)]
ArmPkg/ArmMmuLib: get rid of GetRootTranslationTableInfo()

Only a single call to GetRootTranslationTableInfo() remains, which
only provides the root table level. So let's create a new static
helper function that returns just this value, and use it instead.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
4 years agoArmPkg/ArmMmuLib: drop pointless LookupAddresstoRootTable() routine
Ard Biesheuvel [Tue, 31 Mar 2020 17:25:02 +0000 (19:25 +0200)]
ArmPkg/ArmMmuLib: drop pointless LookupAddresstoRootTable() routine

LookupAddresstoRootTable() uses a loop to go over its MaxAddress
argument, essentially to do a log2() and determine how many bits are
needed to represent it. Since the argument is the result of a shift-left
expression, there is some room for improvement here, and we can simply
use the bit count directly to calculate the value of T0SZ. At the same
time, we can omit calling GetRootTranslationTableInfo() to determine the
number of root table entries, and add a new helper that applies the
trivial calculation directly.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
4 years agoArmPkg/CpuDxe: move PageAttributeToGcdAttribute() out of ArmMmuLib
Ard Biesheuvel [Tue, 31 Mar 2020 17:24:57 +0000 (19:24 +0200)]
ArmPkg/CpuDxe: move PageAttributeToGcdAttribute() out of ArmMmuLib

The routine PageAttributeToGcdAttribute() is exported by ArmMmuLib
but only ever used in the implementation of CpuDxe. So let's move
the function there and make it STATIC.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
4 years agoArmPkg/CpuDxe: use private copy of GetRootTranslationTableInfo()
Ard Biesheuvel [Tue, 31 Mar 2020 17:24:45 +0000 (19:24 +0200)]
ArmPkg/CpuDxe: use private copy of GetRootTranslationTableInfo()

Before getting rid of GetRootTranslationTableInfo() and the related
LookupAddresstoRootTable() in AARCH64's version of ArmMmuLib, add a
version of the former to CpuDxe, which will be its only remaining
user. While at it, simplify it a bit, since in the CpuDxe cases,
both OUT arguments are always provided.

Note that this removes the declaration of GetRootTranslationTableInfo()
as well, but this is a declaration that is private to CpuDxe, and it
really doesn't belong here in the first place. Since ArmMmuLib's version
of GetRootTranslationTableInfo() is going to be replaced shortly anyway,
don't bother moving this .h declaration elsewhere.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
4 years agoNetworkPkg/Ip6Dxe: Fix ASSERT logic in Ip6ProcessRouterAdvertise()
Maciej Rabeda [Wed, 1 Apr 2020 09:43:55 +0000 (11:43 +0200)]
NetworkPkg/Ip6Dxe: Fix ASSERT logic in Ip6ProcessRouterAdvertise()

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

This patch fixes reversed logic of recently added ASSERTs which should
ensure that Ip6IsNDOptionValid() implementation properly reacts to invalid
packets.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Fixes: 9c20342eed70ec99ec50cd73cb81804299f05403
4 years agoOvmfPkg/PvScsiDxe: Refactor setup of rings to separate function
Liran Alon [Tue, 31 Mar 2020 22:56:37 +0000 (01:56 +0300)]
OvmfPkg/PvScsiDxe: Refactor setup of rings to separate function

Previous to this change, PvScsiFreeRings() was not undoing all
operations that was done by PvScsiInitRings().
This is because PvScsiInitRings() was both preparing rings (Allocate
memory and map it for device DMA) and setup the rings against device by
issueing a device command. While PvScsiFreeRings() only unmaps the rings
and free their memory.

Driver do not have a functional error as it makes sure to reset device
before every call site to PvScsiFreeRings(). However, this is not
intuitive.

Therefore, prefer to refactor the setup of the ring against device to a
separate function than PvScsiInitRings().

Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200331225637.123318-1-liran.alon@oracle.com>
[lersek@redhat.com: rename FreeDMACommBuffer label to FreeDmaCommBuffer]
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoOvmfPkg/PvScsiDxe: Fix VS2019 build error because of implicit cast
Liran Alon [Tue, 31 Mar 2020 11:04:52 +0000 (14:04 +0300)]
OvmfPkg/PvScsiDxe: Fix VS2019 build error because of implicit cast

Sean reported that VS2019 build produce the following build error:
INFO - PvScsi.c
INFO - Generating code
INFO - d:\a\1\s\OvmfPkg\PvScsiDxe\PvScsi.c(459): error C2220: the
       following warning is treated as an error
INFO - d:\a\1\s\OvmfPkg\PvScsiDxe\PvScsi.c(459): warning C4244: '=':
       conversion from 'const UINT16' to 'UINT8', possible loss of data

This result from an implicit cast from PVSCSI Response->ScsiStatus
(Which is UINT16) to Packet->TargetResponse (Which is UINT8).

Fix this issue by adding an appropriate explicit cast and verify with
assert that this truncation do not result in loss of data.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2651
Reported-by: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200331110452.51992-1-liran.alon@oracle.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: rewrap VS2019 diags in commit msg for PatchCheck.py]

4 years agoMaintainers.txt: Add Liran and Nikita as OvmfPkg/PvScsiDxe reviewers
Liran Alon [Tue, 31 Mar 2020 11:02:44 +0000 (14:02 +0300)]
Maintainers.txt: Add Liran and Nikita as OvmfPkg/PvScsiDxe reviewers

Laszlo suggested that as I have contributed the OvmfPkg PVSCSI driver, I
will also register myself as a reviewer in Maintainers.txt.

In addition, as Nikita have assisted the development of the PVSCSI
driver and have developed another similar OvmfPkg SCSI driver, add him
as a reviewer to PVSCSI driver as-well.

Cc: Nikita Leshenko <nikita.leshchenko@oracle.com>
Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200331110244.51409-1-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
[lersek@redhat.com: fixup "F:" pattern by appending slash character]
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoNetworkPkg/UefiPxeBcDxe: handle competing DHCP servers (more) gracefully
Laszlo Ersek [Tue, 31 Mar 2020 00:47:49 +0000 (02:47 +0200)]
NetworkPkg/UefiPxeBcDxe: handle competing DHCP servers (more) gracefully

When DHCP is misconfigured on a network segment, such that two DHCP
servers attempt to reply to requests (and therefore race with each other),
the edk2 PXE client can confuse itself.

In PxeBcDhcp4BootInfo() / PxeBcDhcp6BootInfo(), the client may refer to a
DHCP reply packet as an "earlier" packet from the "same" DHCP server, when
in reality both packets are unrelated, and arrive from different DHCP
servers.

While the edk2 PXE client can do nothing to fix this, it should at least
not ASSERT() -- ASSERT() is for catching programming errors (violations of
invariants that are under the control of the programmer). ASSERT()s should
in particular not refer to external data (such as network packets). What's
more, in RELEASE builds, we get NULL pointer references.

Check the problem conditions with actual "if"s, and return
EFI_PROTOCOL_ERROR. This will trickle out to PxeBcLoadBootFile(), and be
reported as "PXE-E99: Unexpected network error".

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20200331004749.16128-1-lersek@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
4 years agoOvmfPkg: Fix SMM/RT driver section alignment for XCODE5/CLANGPDB
Vitaly Cheptsov [Sun, 29 Mar 2020 13:21:58 +0000 (16:21 +0300)]
OvmfPkg: Fix SMM/RT driver section alignment for XCODE5/CLANGPDB

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

This patch resolves the problem of using memory protection
attributes when OVMF firmware is compiled with XCODE5 and CLANGPDB.

Cc: Andrew Fish <afish@apple.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Marvin Häuser <mhaeuser@outlook.de>
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
Message-Id: <20200329132158.35259-2-cheptsov@ispras.ru>
Acked-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: fix whitespace issues reported by git-am]
[lersek@redhat.com: replace "CC:" tags with "Cc:" ones for PatchCheck.py]

4 years agoShellPkg: Fix 'ping' command Ip4 receive flow.
Maciej Rabeda [Thu, 27 Feb 2020 10:30:43 +0000 (11:30 +0100)]
ShellPkg: Fix 'ping' command Ip4 receive flow.

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

'ping' command's receive flow utilizes a single Rx token which it
attempts to reuse before recycling the previously received packet.
This causes a situation where under ICMP traffic,
Ping6OnEchoReplyReceived() function will receive an already
recycled packet with EFI_SUCCESS token status and finally
dereference invalid pointers from RxData structure.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Acked-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoDynamicTablesPkg: SRAT: Fix uninitialized memory usage
Sami Mujawar [Mon, 18 Nov 2019 16:37:30 +0000 (16:37 +0000)]
DynamicTablesPkg: SRAT: Fix uninitialized memory usage

On enabling the /analyse option the VS2017 compiler
reports: warning C6001: Using uninitialized memory.

This warning is reported for the Status variable in
AddGenericInitiatorAffinity() as it is not initialised
to a default value. This condition is only valid if
GenInitAffCount is equal to 0. Since GenInitAffCount
is already checked in BuildSratTable() this condition
can never happen.

The value of the Status variable is returned in
failure cases from appropriate locations in
AddGenericInitiatorAffinity(). The only case
where Status value is being used un-initialised
is the return statement at the end of
AddGenericInitiatorAffinity().

Therefore, to fix this issue EFI_SUCCESS can be
safely returned instead of returning the Status
variable at the end of the function.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
4 years agoDynamicTablesPkg: SRAT: Fix entry points
Sami Mujawar [Mon, 18 Nov 2019 16:30:16 +0000 (16:30 +0000)]
DynamicTablesPkg: SRAT: Fix entry points

VS2017 reports 'warning C4028: formal parameter 2 different
from declaration' for the library constructor and destructor
interfaces for the SRAT Generator modules.

Remove the CONST qualifier for the ImageHandle and the
SystemTable pointer in the library constructor and destructor
to make it compatible with the formal declaration.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4 years agoMaintainers: switch to my Arm email address
Ard Biesheuvel [Thu, 5 Mar 2020 11:17:23 +0000 (12:17 +0100)]
Maintainers: switch to my Arm email address

I no longer work for Linaro (and haven't for a while) so in anticipation
of losing access to my @linaro.org mailbox, let's switch to the ARM one
for my Tiancore contributions and maintainerships.

Cc: Andrew Fish <afish@apple.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoBaseTools:GuidedSectionTools.txt is not generated correctly
Fan, ZhijuX [Thu, 26 Mar 2020 09:48:04 +0000 (17:48 +0800)]
BaseTools:GuidedSectionTools.txt is not generated correctly

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

For LzmaCompress or BrotliCompress, the platform may use the different
options and add their batch file, such as LzmaCompressPlatform.
Then, specify it in platform.dsc [BuildOptions] to override the default
one in tools_def.txt.

*_*_*_LZMA_PATH = LzmaCompressPlatform

This override tool will be used. But, its name is not specified in the
generated GuidedSectionTools.txt.

Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoOvmfPkg/PvScsiDxe: Enable device 64-bit DMA addresses
Liran Alon [Sat, 28 Mar 2020 20:01:00 +0000 (23:01 +0300)]
OvmfPkg/PvScsiDxe: Enable device 64-bit DMA addresses

Enable PCI dual-address cycle attribute to signal device
supports 64-bit DMA addresses.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-18-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoOvmfPkg/PvScsiDxe: Reset device on ExitBootServices()
Liran Alon [Sat, 28 Mar 2020 20:00:59 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Reset device on ExitBootServices()

This causes the device to forget about the request/completion rings.
We allocated said rings in EfiBootServicesData type memory, and code
executing after ExitBootServices() is permitted to overwrite it.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-17-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoOvmfPkg/PvScsiDxe: Support sending SCSI request and receive response
Liran Alon [Sat, 28 Mar 2020 20:00:58 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Support sending SCSI request and receive response

Implement EXT_SCSI_PASS_THRU.PassThru().

Machines should be able to boot after this commit.
Tested with Ubuntu 16.04 guest.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-16-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoOvmfPkg/PvScsiDxe: Introduce DMA communication buffer
Liran Alon [Sat, 28 Mar 2020 20:00:57 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Introduce DMA communication buffer

In case device is constrained by IOMMU or guest is running under AMD SEV,
input/output buffers provided to device (DataBuffer and SenseData) needs
to be explicitly mapped to device by PciIo->Map().

To avoid the overhead of mapping/unmapping the DataBuffer and SenseData
to the device for every SCSI requst (and to simplify code), introduce a
single DMA communication buffer that will be mapped to device on
initialization. When a SCSI request needs to be sent to device, the
DataBuffer and SenseData will be copied from/to the DMA communication
buffer as required. This will be done by the following commits.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-15-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoOvmfPkg/PvScsiDxe: Setup requests and completions rings
Liran Alon [Sat, 28 Mar 2020 20:00:56 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Setup requests and completions rings

These rings are shared memory buffers between host and device in which
a cyclic buffer is managed to send request descriptors from host to
device and receive completion descriptors from device to host.

Note that because device may be constrained by IOMMU or guest may be run
under AMD SEV, we make sure to map these rings to device by using
PciIo->Map().

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-14-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoOvmfPkg/PvScsiDxe: Reset adapter on init
Liran Alon [Sat, 28 Mar 2020 20:00:55 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Reset adapter on init

The following commits will complete the implementation of
device initialization.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-13-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoOvmfPkg/PvScsiDxe: Define device interface structures and constants
Liran Alon [Sat, 28 Mar 2020 20:00:54 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Define device interface structures and constants

These definitions will be used by the following commits to complete the
implementation of PVSCSI device driver.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Acked-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-12-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoOvmfPkg/PvScsiDxe: Enable MMIO-Space & Bus-Mastering in PCI attributes
Liran Alon [Sat, 28 Mar 2020 20:00:53 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Enable MMIO-Space & Bus-Mastering in PCI attributes

Enable MMIO-Space & Bus-Mastering PCI attributes when device is started.
Note that original PCI attributes are restored when device is stopped.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-11-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoOvmfPkg/PvScsiDxe: Backup/Restore PCI attributes on Init/UnInit
Liran Alon [Sat, 28 Mar 2020 20:00:52 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Backup/Restore PCI attributes on Init/UnInit

This commit doesn't change semantics.
It is done as a preparation for future commits which will modify
PCI attributes.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-10-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoOvmfPkg/PvScsiDxe: Open PciIo protocol for later use
Liran Alon [Sat, 28 Mar 2020 20:00:51 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Open PciIo protocol for later use

This will give us an exclusive access to the PciIo of this device
after it was started and until it will be stopped.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-9-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoOvmfPkg/PvScsiDxe: Translate Target & LUN to/from DevicePath
Liran Alon [Sat, 28 Mar 2020 20:00:50 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Translate Target & LUN to/from DevicePath

Implement EXT_SCSI_PASS_THRU.BuildDevicePath() and
EXT_SCSI_PASS_THRU.GetTargetLun().

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-8-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoOvmfPkg/PvScsiDxe: Report the number of targets and LUNs
Liran Alon [Sat, 28 Mar 2020 20:00:49 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Report the number of targets and LUNs

Implement EXT_SCSI_PASS_THRU.GetNextTarget() and
EXT_SCSI_PASS_THRU.GetNextTargetLun().

ScsiBusDxe scans all MaxTarget * MaxLun possible devices.
This can take unnecessarily long for large number of targets.
To deal with this, VirtioScsiDxe has defined PCDs to limit the
MaxTarget & MaxLun to desired values which gives sufficient
performance. It is very important in virtio-scsi as it can have
very big MaxTarget & MaxLun.
Even though a common PVSCSI device has a default MaxTarget=64 and
MaxLun=0, we implement similar mechanism as virtio-scsi for completeness.
This may be useful in the future when PVSCSI will have bigger values
for MaxTarget and MaxLun.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-7-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoOvmfPkg/PvScsiDxe: Install stubbed EXT_SCSI_PASS_THRU
Liran Alon [Sat, 28 Mar 2020 20:00:48 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Install stubbed EXT_SCSI_PASS_THRU

Support dynamic insertion and removal of the protocol.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-6-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoOvmfPkg/PvScsiDxe: Probe PCI devices and look for PvScsi
Liran Alon [Sat, 28 Mar 2020 20:00:47 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Probe PCI devices and look for PvScsi

PvScsiControllerSupported() is called on handles passed in
by the ConnectController() boot service and if the handle is the
PVSCSI controller, the function would return success. A success
return value will attach our driver to the device.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-5-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoOvmfPkg/PvScsiDxe: Report name of driver
Liran Alon [Sat, 28 Mar 2020 20:00:46 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Report name of driver

Install Component Name protocols to have a nice display name for the
driver in places such as UEFI shell.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-4-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoOvmfPkg/PvScsiDxe: Install DriverBinding protocol
Liran Alon [Sat, 28 Mar 2020 20:00:45 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Install DriverBinding protocol

In order to probe and connect to the PvScsi device we need this
protocol. Currently it does nothing.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-3-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoOvmfPkg/PvScsiDxe: Create empty driver
Liran Alon [Sat, 28 Mar 2020 20:00:44 +0000 (23:00 +0300)]
OvmfPkg/PvScsiDxe: Create empty driver

In preparation for support booting from PvScsi devices, create a
basic scaffolding for a driver.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-2-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
4 years agoEmbeddedPkg/AcpiLib: add GICC table init macro for ACPI 6.3
Pete Batard [Fri, 27 Mar 2020 13:01:17 +0000 (13:01 +0000)]
EmbeddedPkg/AcpiLib: add GICC table init macro for ACPI 6.3

ACPI 6.3 added a 16-bit SPE overflow Interrupt field, replacing
2 of the 3 reserved bytes that are defined at the end of the
GICC structure for 6.0.

Add a new macro to initialise the new field.

Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4 years agoNetworkPkg/Ip6Dxe: Improve Neightbor Discovery message validation.
Maciej Rabeda [Mon, 2 Mar 2020 12:25:20 +0000 (13:25 +0100)]
NetworkPkg/Ip6Dxe: Improve Neightbor Discovery message validation.

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

Problem has been identified with Ip6ProcessRouterAdvertise() when
Router Advertise packet contains options with malicious/invalid
'Length' field. This can lead to platform entering infinite loop
when processing options from that packet.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoOvmfPkg/GenericQemuLoadImageLib: Fix VS2019 UINT32 conversion error
Ard Biesheuvel [Sun, 29 Mar 2020 13:44:38 +0000 (15:44 +0200)]
OvmfPkg/GenericQemuLoadImageLib: Fix VS2019 UINT32 conversion error

Building OVMF for X64 with secure boot enabled on VS2019 results in
the following error:

  d:\a\1\s\OvmfPkg\Library\GenericQemuLoadImageLib\GenericQemuLoadImageLib.c(154):
    error C2220: the following warning is treated as an error
  d:\a\1\s\OvmfPkg\Library\GenericQemuLoadImageLib\GenericQemuLoadImageLib.c(154):
    warning C4244: '=': conversion from 'UINTN' to 'UINT32', possible loss of data

Suppress the error by making the cast explicit.

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=2636
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoMdeModulePkg: Remove gEfiFormBrowserExProtocolGuid Protocol Guid
GuoMinJ [Fri, 21 Feb 2020 10:10:41 +0000 (18:10 +0800)]
MdeModulePkg: Remove gEfiFormBrowserExProtocolGuid Protocol Guid

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

Replace the gEfiFormBrowserExProtocolGuid with
gEdkiiFormBrowserExProtocolGuid, remove the unnecessary declaration.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
Acked-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoDynamicTablesPkg: Option for VS2017 static code analysis
Sami Mujawar [Fri, 16 Aug 2019 15:24:22 +0000 (16:24 +0100)]
DynamicTablesPkg: Option for VS2017 static code analysis

Add build option STATIC_ANALYSIS to enable VS2017 static
code analysis.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
4 years agoDynamicTablesPkg: Remove erroneous use of EFIAPI
Sami Mujawar [Fri, 16 Aug 2019 16:58:54 +0000 (17:58 +0100)]
DynamicTablesPkg: Remove erroneous use of EFIAPI

The Dynamic Tables Factory protocol has an erroneous
EFIAPI calling convention macro in the function
pointer declaration.

Remove the erroneous EFIAPI calling convention macro
from the interface declarations.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoDynamicTablesPkg: PPTT: Fix uninitialized memory usage
Sami Mujawar [Mon, 5 Aug 2019 15:43:37 +0000 (16:43 +0100)]
DynamicTablesPkg: PPTT: Fix uninitialized memory usage

On enabling the /analyse option the VS2017 compiler
reports: warning C6001: Using uninitialized memory.

This warning is reported as some variables that were
being logged were uninitialised. To fix this, moved
the logging code after the variables being logged are
initialised.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
4 years agoDynamicTablesPkg: IORT: Fix uninitialized memory usage
Sami Mujawar [Mon, 5 Aug 2019 15:30:38 +0000 (16:30 +0100)]
DynamicTablesPkg: IORT: Fix uninitialized memory usage

On enabling the /analyse option the VS2017 compiler
reports: warning C6001: Using uninitialized memory.

This warning is reported as some variables that were
being logged were uninitialised. To fix this, moved
the logging code after the variables being logged are
initialised.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
4 years agoDynamicTablesPkg: Fix IORT node length assignment
Sami Mujawar [Tue, 9 Jul 2019 15:50:42 +0000 (16:50 +0100)]
DynamicTablesPkg: Fix IORT node length assignment

The VS2017 compiler reports 'warning C4267: 'return': conversion
from 'size_t' to 'UINT32', possible loss of data' for a number of
functions that compute the IORT node length. Similarly, it reports
warnings for IORT node length field assignments as the length
field is 16-bit wide.

This patch adds type casts at appropriate places and also implements
validations to ensure that the max width of the respective fields
is not exceeded.

This patch also fixes a typo in one of the local variable names.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
4 years agoDynamicTablesPkg: Remove redundant frame count check
Sami Mujawar [Tue, 9 Jul 2019 15:40:43 +0000 (16:40 +0100)]
DynamicTablesPkg: Remove redundant frame count check

Removing GT Block frame count check from AddGTBlockTimerFrames()
as this is already validated in BuildGtdtTable().

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
4 years agoDynamicTablesPkg: Serial debug port initialisation
Sami Mujawar [Tue, 9 Jul 2019 15:18:27 +0000 (16:18 +0100)]
DynamicTablesPkg: Serial debug port initialisation

The ARM DCC serial port subtype is an option that is
supported by the DBG2 generator. However, the serial
port initialisation should only be done for PL011/SBSA
compatible UARTs.

Add check to conditionally initialise the serial port.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoDynamicTablesPkg: Fix unaligned pointers usage
Sami Mujawar [Tue, 9 Jul 2019 14:58:37 +0000 (15:58 +0100)]
DynamicTablesPkg: Fix unaligned pointers usage

The VS2017 compiler reports 'warning C4366: The result of
the unary '&' operator may be unaligned' if an address of
an unaligned structure member is passed as an argument to
a function.

Fix this warning by using local variables in place of
unaligned structure members.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
4 years agoDynamicTablesPkg: Fix ACPI table rev field width
Sami Mujawar [Tue, 9 Jul 2019 14:11:49 +0000 (15:11 +0100)]
DynamicTablesPkg: Fix ACPI table rev field width

The VS2017 compiler reports 'warning C4244: '=': conversion from
'const UINT32' to 'UINT8', possible loss of data' when the ACPI
table revision field is being updated.

The width of the revision field in the EFI_ACPI_DESCRIPTION_HEADER
struct is 8-bit wide. Therefore, to fix the above warning make the
ACPI Table revision field usage 8-bit wide across Dynamic Tables
Framework.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
4 years agoDynamicTablesPkg: Fix Boot arch flag width
Sami Mujawar [Tue, 9 Jul 2019 14:04:45 +0000 (15:04 +0100)]
DynamicTablesPkg: Fix Boot arch flag width

The ArmBootArch field of the FADT table is 16-bit wide. The
VS2017 compiler reports 'warning C4244: '=': conversion from
'UINT32' to 'UINT16', possible loss of data' when assigning the
CM_ARM_BOOT_ARCH_INFO.BootArchFlags value as the width of this
field in CM_ARM_BOOT_ARCH_INFO is 32-bit wide.

To fix this warning, update the CM_ARM_BOOT_ARCH_INFO struct
to make the  BootArchFlags field 16-bit wide. This also makes
it compatible with the ACPI FADT specification.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
4 years agoDynamicTablesPkg: Fix GT Block length assignment
Sami Mujawar [Tue, 9 Jul 2019 12:54:04 +0000 (13:54 +0100)]
DynamicTablesPkg: Fix GT Block length assignment

The VS2017 compiler reports 'warning C4267: '=': conversion from
'size_t' to 'UINT16', possible loss of data'.

The sizeof() operator is used to calculate the size of the
GT Block structure. The length field in the GT Block structure
is 16-bit wide. Since the return type of sizeof() operator
is size_t the VS2017 compiler reports the above warning.

To fix the warning, an explicit type cast is added. An additional
check is also performed to ensure that the calculated GT Block
length does not exceed MAX_UINT16.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoDynamicTablesPkg: Fix Proc node length assignment
Sami Mujawar [Tue, 9 Jul 2019 12:35:02 +0000 (13:35 +0100)]
DynamicTablesPkg: Fix Proc node length assignment

The length field for the Processor Hierarchy node structure is
8-bit wide while the number of private resource field is 32-bit
wide. Therefore, the GetProcHierarchyNodeSize() returns the size
as a 32-bit value.

The VS2017 compiler reports 'warning C4244: '=': conversion from
'UINT32' to 'UINT8', possible loss of data' while assigning the
length field of the Processor Hierarchy node structure.

To fix this, a type cast is added. In addition, there is a check
to ensure that the Processor Hierarchy node size does not exceed
MAX_UINT8.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
4 years agoDynamicTablesPkg: Fix serial port subtype warning
Sami Mujawar [Tue, 9 Jul 2019 10:56:14 +0000 (11:56 +0100)]
DynamicTablesPkg: Fix serial port subtype warning

The VS2017 compiler reports 'warning C4244: '=': conversion
from 'UINT16' to 'UINT8', possible loss of data' for the
SPCR InterfaceType field assignment.

The SPCR InterfaceType field uses the same encoding as that
of the DBG2 table Port Subtype field. However SPCR.InterfaceType
is 8-bit while the Port Subtype field in DBG2 table is 16-bit.

Since the Configuration Manager represents the Serial port
information using the struct CM_ARM_SERIAL_PORT_INFO, the
PortSubtype member in this struct is 16-bit.

To fix the warning an explicit type case is added. A validation
is also added to ensure that the Serial Port Subtype value
provided by the Configuration Manager is within the 8-bit
range (less than 256).

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoDynamicTablesPkg: Remove struct CM_ARM_CPU_INFO
Sami Mujawar [Tue, 9 Jul 2019 10:48:33 +0000 (11:48 +0100)]
DynamicTablesPkg: Remove struct CM_ARM_CPU_INFO

The VS2017 compiler reports 'error C2016: C requires that
a struct or union has at least one member' for the struct
CM_ARM_CPU_INFO.

Remove struct CM_ARM_CPU_INFO as this is not in use.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
4 years agoDynamicTablesPkg: Fix missing local header warning
Sami Mujawar [Tue, 9 Jul 2019 09:18:51 +0000 (10:18 +0100)]
DynamicTablesPkg: Fix missing local header warning

The edk2 BaseTools report a warning if a local header file
is not listed under the [Sources] section in the INF file.

Add header files to the [Sources] section in the respective
INF files to fix the warnings.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>