mirror_edk2.git
3 years agoMdeModulePkg Variable: Align TPL level for (Smm)EndOfDxe callback
Star Zeng [Wed, 28 Mar 2018 09:27:50 +0000 (17:27 +0800)]
MdeModulePkg Variable: Align TPL level for (Smm)EndOfDxe callback

VariableRuntimeDxe will have OnEndOfDxe() callback function at
TPL_NOTIFY level on EndOfDxe event when DXE variable solution is
used.
  Status = gBS->CreateEventEx (
                  EVT_NOTIFY_SIGNAL,
                  TPL_NOTIFY,
                  OnEndOfDxe,
                  NULL,
                  &gEfiEndOfDxeEventGroupGuid,
                  &EndOfDxeEvent
                  );

VariableSmm will have SmmEndOfDxeCallback() callback function at
TPL_CALLBACK level on SmmEndOfDxe event when SMM variable solution
is used.
SmmIplGuidedEventNotify()  -  PiSmmIpl.c TPL_CALLBACK on EndOfDxe
->
SmmEndOfDxeHandler()  -  PiSmmCore.c install SmmEndOfDxe protocol
->
SmmEndOfDxeCallback() - VariableSmm.c

The TPL level for (Smm)EndOfDxe callback between VariableRuntimeDxe
and VariableSmm is inconsistent, it will make the unified platform
code could not make sure its TPL_NOTIFY EndOfDxe callback function
(to use variable lock/check) executed before (Smm)EndOfDxe callback
function in variable driver. The variable lock/check will start to
protect after (Smm)EndOfDxe callback function in variable driver is
executed.

This patch is to algin the TPL level to TPL_CALLBACK for (Smm)EndOfDxe
callback between VariableRuntimeDxe and VariableSmm.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
3 years agoBaseTools: cleanup class heirarchy
Carsey, Jaben [Thu, 29 Mar 2018 00:02:20 +0000 (08:02 +0800)]
BaseTools: cleanup class heirarchy

remove totally empty classes from class heirarchy

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: remove loop and variables.
Carsey, Jaben [Thu, 29 Mar 2018 00:02:19 +0000 (08:02 +0800)]
BaseTools: remove loop and variables.

this loop does nothing. none of Key, Item, nor DevicePathList
are ever used.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: use in to compare single chars
Carsey, Jaben [Thu, 29 Mar 2018 00:02:18 +0000 (08:02 +0800)]
BaseTools: use in to compare single chars

instead if 3 Startswith for single chars, just use in with a list of chars

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: no need to do int() API work for it
Carsey, Jaben [Thu, 29 Mar 2018 00:02:17 +0000 (08:02 +0800)]
BaseTools: no need to do int() API work for it

int() with base=0 will already auto determine base from preceeding 0x/0X

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Remove equality operator with None
Carsey, Jaben [Mon, 26 Mar 2018 20:25:43 +0000 (04:25 +0800)]
BaseTools: Remove equality operator with None

replace "== None" with "is None" and "!= None" with "is not None"

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoCorebootPayloadPkg: Conditionally add DebugAgentLib for DXE drivers
Alex James [Mon, 26 Mar 2018 16:15:10 +0000 (00:15 +0800)]
CorebootPayloadPkg: Conditionally add DebugAgentLib for DXE drivers

To fix building with SOURCE_DEBUG_ENABLE, add DebugAgentLib for
LibraryClasses.common.DXE_DRIVER, as is done with Vlv2TbltDevicePkg.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Alex James <theracermaster@gmail.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
3 years agoBaseTools: compare GUID value should not case-sensitive
Bin Wang [Mon, 26 Feb 2018 08:19:30 +0000 (16:19 +0800)]
BaseTools: compare GUID value should not case-sensitive

build report error when the same Guid value in FDF file use lowercase,
in tools_def.txt file use uppercase.
The guid value's compare should not case-sensitive.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bin Wang <binx.a.wang@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: refactor repeated RegExp when no special searching is needed.
Carsey, Jaben [Tue, 27 Mar 2018 00:33:08 +0000 (08:33 +0800)]
BaseTools: refactor repeated RegExp when no special searching is needed.

use str.replace and try/except.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: dont use enumerate when un-needed
Carsey, Jaben [Tue, 27 Mar 2018 23:42:47 +0000 (07:42 +0800)]
BaseTools: dont use enumerate when un-needed

Since we only use the item from the list and not the numeric value,
dont bother with enumerate()

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: move regular expression compile out of function call.
Carsey, Jaben [Tue, 27 Mar 2018 23:42:46 +0000 (07:42 +0800)]
BaseTools: move regular expression compile out of function call.

move to the root of the file and dont recompile.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: expression can use single in instead of 3 API calls.
Carsey, Jaben [Tue, 27 Mar 2018 23:42:45 +0000 (07:42 +0800)]
BaseTools: expression can use single in instead of 3 API calls.

change 3 StartsWith() calls to a single 'in' operation.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: remove local hex number regular expression
Carsey, Jaben [Fri, 16 Mar 2018 23:27:46 +0000 (07:27 +0800)]
BaseTools: remove local hex number regular expression

Change to using the new shared hex number regular expression

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Use precompiled RegExp
Carsey, Jaben [Fri, 16 Mar 2018 23:27:44 +0000 (07:27 +0800)]
BaseTools: Use precompiled RegExp

avoid recompiling the regular expression for each use in a while loop

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: use new shared GUID regular expressions
Carsey, Jaben [Fri, 16 Mar 2018 23:27:41 +0000 (07:27 +0800)]
BaseTools: use new shared GUID regular expressions

remove local variables that are GUID matching and replace with shared
expression.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoMdeModulePkg/PartitionDxe: Add partition type guid to installed handle
Jeff Brasen [Mon, 26 Mar 2018 08:57:04 +0000 (16:57 +0800)]
MdeModulePkg/PartitionDxe: Add partition type guid to installed handle

Add the partition type GUID for every partition to the installed handle,
this is required per the UEFI specification.

"The firmware must add the PartitionTypeGuid to the handle of every
active GPT partition using EFI_BOOT_SERVICES.InstallProtocolInterface()."

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jeff Brasen <jbrasen.qdt@qualcommdatacenter.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoBaseTools: GlobalData Add a regular expression for a hex number
Carsey, Jaben [Fri, 16 Mar 2018 23:27:45 +0000 (07:27 +0800)]
BaseTools: GlobalData Add a regular expression for a hex number

add a shared precompiled regular expression

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Add new RegExp for future use
Carsey, Jaben [Wed, 28 Mar 2018 16:04:58 +0000 (00:04 +0800)]
BaseTools: Add new RegExp for future use

Add a precompiled RegExp for 4 hex chars.
v2: fixed incorrect numbers of {}

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Regular Expressions refactor out the hex char for later reuse
Carsey, Jaben [Fri, 23 Mar 2018 17:48:56 +0000 (01:48 +0800)]
BaseTools: Regular Expressions refactor out the hex char for later reuse

move hex character info from GUID expressions into seperate variable to
facilitate reuse.

I had a type with insufficient {} in the first version.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: add GUID pattern to global data
Carsey, Jaben [Fri, 16 Mar 2018 23:27:40 +0000 (07:27 +0800)]
BaseTools: add GUID pattern to global data

add a shared global regular expression for GUID matching

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: GlobalData share same MACRO name definition
Carsey, Jaben [Fri, 16 Mar 2018 23:27:39 +0000 (07:27 +0800)]
BaseTools: GlobalData share same MACRO name definition

use the same MACRO name definition across shared regular expression patterns.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: FdfParser and FdfParserLite share reg exp
Carsey, Jaben [Wed, 28 Mar 2018 16:04:57 +0000 (00:04 +0800)]
BaseTools: FdfParser and FdfParserLite share reg exp

FdfParser can share regular expression from FdfParserLite.
reduce overlap and reduce recompile of the same expression.
v2: fix missed replacement of Pattern with shared variable

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoVlv2TbltDevicePkg: Sync FLASH libraries from UDK2017 branch
Kinney, Michael D [Tue, 27 Mar 2018 23:51:06 +0000 (16:51 -0700)]
Vlv2TbltDevicePkg: Sync FLASH libraries from UDK2017 branch

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

Update Minnow Max FLASH libraries to match libraries in
the UDK2017 development branch in edk2-platforms.

https://github.com/tianocore/edk2-platforms/tree/devel-MinnowBoardMax-UDK2017

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>
Reviewed-by: Guo Mang <mang.guo@intel.com>
3 years agoVlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE
Kinney, Michael D [Tue, 27 Mar 2018 23:52:36 +0000 (16:52 -0700)]
Vlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE

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

Update PlatformBdsLib to show boot logo when the boot
mode is BOOT_ON_FLASH_UPDATE.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>
3 years agoVlv2TbltDevicePkg: Fix build issues in DSC/FDF
Kinney, Michael D [Tue, 27 Mar 2018 23:47:05 +0000 (16:47 -0700)]
Vlv2TbltDevicePkg: Fix build issues in DSC/FDF

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

Fix a the following issues in DSC/FDF files

* Remove references to  drivers that are not present
* Enable the Tianocore boot logo and BGRT table
* Enable full UEFI shell
* Enable more debug messages in DXE phase

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>
3 years agoVlv2TbltDevicePkg: Fix VS2015 build breaks
Kinney, Michael D [Tue, 27 Mar 2018 23:40:05 +0000 (16:40 -0700)]
Vlv2TbltDevicePkg: Fix VS2015 build breaks

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

Fix minor code issues that break VS2015 builds.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>
3 years agoVlv2TbltDevicePkg: Fix build scripts
Michael D Kinney [Thu, 28 Dec 2017 23:17:31 +0000 (15:17 -0800)]
Vlv2TbltDevicePkg: Fix build scripts

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

Update build scripts to work with edk2 and Vlv2Binaries
in PACKAGES_PATH.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>
Reviewed-by: Guo Mang <mang.guo@intel.com>
3 years agoBaseTools/BinToPcd: Add support for multiple binary input files
Kinney, Michael D [Wed, 21 Feb 2018 02:07:06 +0000 (18:07 -0800)]
BaseTools/BinToPcd: Add support for multiple binary input files

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

There are use cases where a VOID * PCD needs to be generated from multiple
binary input files.  This can be in the form of an array of fixed size
elements or a set of variable sized elements.

Update BinToPcd to support multiple one or more -i INPUTFILE arguments.
By default, the contents of each binary input file are concatenated in
the order provided.  This supports generating a PCD that is an array of
fixed size elements

Add -x, --xdr flags to BinToPcd  to encodes the PCD using the
Variable-Length Opaque Data of RFC 4506 External Data Representation
Standard (XDR).

    https://tools.ietf.org/html/rfc4506
    https://tools.ietf.org/html/rfc4506#section-4.10

The data format from RFC 4506 meets the requirements for a PCD that is a
set of variable sized elements in the Variable-Length Opaque Data format.
The overhead of this format is a 32-bit length and 0 to 3 bytes of padding
to align the next element at a 32-bit boundary.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoOvmfPkg/PlatformPei: debug log "etc/reserved-memory-end" from fw_cfg
Laszlo Ersek [Wed, 28 Mar 2018 11:26:35 +0000 (13:26 +0200)]
OvmfPkg/PlatformPei: debug log "etc/reserved-memory-end" from fw_cfg

QEMU calculates the UINT64 value in "etc/reserved-memory-end" in a quite
complex way, in the pc_memory_init() function. Log the value as a
DEBUG_VERBOSE message to support debugging.

Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1353591
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoNetworkPkg/TlsAuthConfigDxe: preserve TlsCaCertificate variable attributes
Laszlo Ersek [Thu, 22 Mar 2018 15:50:55 +0000 (16:50 +0100)]
NetworkPkg/TlsAuthConfigDxe: preserve TlsCaCertificate variable attributes

If the platform creates the "TlsCaCertificate" variable as volatile, then
EnrollX509toVariable() shouldn't fail to extend it just because
TLS_AUTH_CONFIG_VAR_BASE_ATTR contains the EFI_VARIABLE_NON_VOLATILE
attribute.

Thus, if the variable exists, add the EFI_VARIABLE_APPEND_WRITE attribute
to the variable's current attributes. This is what DeleteCert() does
already.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoNetworkPkg/HttpDxe: sanity-check the TlsCaCertificate variable before use
Laszlo Ersek [Thu, 22 Mar 2018 11:00:55 +0000 (12:00 +0100)]
NetworkPkg/HttpDxe: sanity-check the TlsCaCertificate variable before use

In TlsConfigCertificate(), make sure that the set of EFI_SIGNATURE_LIST
objects that the platform stored to "TlsCaCertificate" is well-formed.

In addition, because HttpInstance->TlsConfiguration->SetData() expects
X509 certificates only, ensure that the EFI_SIGNATURE_LIST objects only
report X509 certificates, as described under EFI_CERT_X509_GUID in the
UEFI-2.7 spec.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=909
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoNetworkPkg/HttpDxe: drop misleading comment / status code in cert config
Laszlo Ersek [Thu, 22 Mar 2018 09:59:59 +0000 (10:59 +0100)]
NetworkPkg/HttpDxe: drop misleading comment / status code in cert config

For TlsConfigureSession(), it makes sense to exempt EFI_NOT_FOUND from
TlsConfigCipherList() / gRT->GetVariable(), because there is a default
cipher list (SSL_DEFAULT_CIPHER_LIST) we can fall back to.

The same is not true of TlsConfigCertificate(), because there is no
default CA cert list. The platform (or the user of the Setup utility) is
required to configure a CA cert list first.

Remove the misleading comment and status code mapping in
TlsConfigCertificate().

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoNetworkPkg/HttpDxe: use error handler epilogue in TlsConfigCertificate()
Laszlo Ersek [Thu, 22 Mar 2018 09:31:55 +0000 (10:31 +0100)]
NetworkPkg/HttpDxe: use error handler epilogue in TlsConfigCertificate()

Introduce a FreeCACert label near the end of the function, so that we can
keep the FreePool(CACert) statement centralized for error and success
exits.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoNetworkPkg/HttpBootDxe: fix typo in DHCPv4 packet parsing
Laszlo Ersek [Thu, 22 Mar 2018 13:22:40 +0000 (14:22 +0100)]
NetworkPkg/HttpBootDxe: fix typo in DHCPv4 packet parsing

The string "HTTPClient" has 10 non-NUL characters; the value 9 is a
copy-paste leftover from "PXEClient". Check for all 10 characters in the
vendor-class-identifier option when determining whether the DHCP offer is
an HTTP offer.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoOvmfPkg:Fix VS2012 build failure
Dandan Bi [Fri, 23 Mar 2018 03:21:56 +0000 (11:21 +0800)]
OvmfPkg:Fix VS2012 build failure

Initialize local variable to suppress warning C4701/C4703:
potentially uninitialized local variable/pointer variable.

1.In VirtualMemory.c:
Read of "PageMapLevel4Entry" in SetMemoryEncDe() is only
reached when "PageMapLevel4Entry" is got correctly.

2.In VirtioBlk.c:
Reads (dereferences) of "BufferMapping" and "BufferDeviceAddress"
in SynchronousRequest() are only reached if "BufferSize > 0" *and*
we map the data buffer successfully.

3.In VirtioScsi.c:
Reads (dereferences) of "InDataMapping" and "InDataDeviceAddress",
in VirtioScsiPassThru() are only reached if
"Packet->InTransferLength > 0" on input, *and* we map the
input buffer successfully. The similar reason for "OutDataMapping"
and "OutDataDeviceAddress".

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoBaseTools: Update Rsa2048Sha256Sign to use openssl dgst option
Liming Gao [Tue, 27 Mar 2018 12:55:27 +0000 (20:55 +0800)]
BaseTools: Update Rsa2048Sha256Sign to use openssl dgst option

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Qin Long <qin.long@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
3 years agoBaseTools: Update Rsa2048Sha256Sign to use openssl standard options
Liming Gao [Tue, 27 Mar 2018 02:29:48 +0000 (10:29 +0800)]
BaseTools: Update Rsa2048Sha256Sign to use openssl standard options

sha256 is not the standard option. It should be replaced by sha -sha256.
Otherwise, it doesn't work in MAC OS.

In V2, update the option to sha1 -sha256.
In late openssl version >= 1.1, there is no sha option, but has sha1,sha256.
In previous openssl version < 1.1, there is no sha256, but has sha,sha1.
To work with all openssl version, use sha1 -sha256 for it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liao Jui-peng <jui-pengx.liao@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Autogen - modify to use standard parent/child class relationships
Carsey, Jaben [Thu, 15 Mar 2018 00:20:27 +0000 (08:20 +0800)]
BaseTools: Autogen - modify to use standard parent/child class relationships

use __new__ and __init__ to create/manage/initialize objects in standard flow.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools/ECC: Add a new exception support
Hess Chen [Wed, 21 Mar 2018 08:07:45 +0000 (16:07 +0800)]
BaseTools/ECC: Add a new exception support

Add a new exception support for the checkPoint of no use C type.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoOvmfPkg/QemuVideoDxe: handle invalid BltOperation gracefully
Laszlo Ersek [Fri, 23 Mar 2018 21:36:41 +0000 (22:36 +0100)]
OvmfPkg/QemuVideoDxe: handle invalid BltOperation gracefully

According to the UEFI spec, EFI_GRAPHICS_OUTPUT_PROTOCOL.Blt() is supposed
to catch an invalid BltOperation, and report it with
EFI_INVALID_PARAMETER.

Remove the assertion from QemuVideoGraphicsOutputBlt() that prevents this
from working in NOOPT and DEBUG builds.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Rocky <xingrong.ni@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Reported-by: Rocky <xingrong.ni@intel.com>
Analyzed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=897
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoNetworkPkg: Correct HttpTlsCipherList.h file format to DOS
Liming Gao [Mon, 26 Mar 2018 02:10:09 +0000 (10:10 +0800)]
NetworkPkg: Correct HttpTlsCipherList.h file format to DOS

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoMdeModulePkg/Usb: Replace macro USB_BOOT_IO_BLOCKS
Ming Huang [Thu, 22 Mar 2018 07:44:26 +0000 (15:44 +0800)]
MdeModulePkg/Usb: Replace macro USB_BOOT_IO_BLOCKS

Booting from USB may fail while the macro USB_BOOT_IO_BLOCKS
set to 128 because the block size of some USB devices are exceeded
512, like some virtual CD-ROM from BMC, the block size is 2048.
So,the count blocks to transfer should be calculated by block
size of the USB devices.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang <ming.huang@linaro.org>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoMdeModulePkg/UsbKb: fix shell edit cannot read '!@#$%^&*' characters
Ruiyu Ni [Fri, 23 Mar 2018 04:45:14 +0000 (12:45 +0800)]
MdeModulePkg/UsbKb: fix shell edit cannot read '!@#$%^&*' characters

Commit 5563281fa2b31093a1cbd415553b9264c5136e89
* ShellPkg/[hex]edit: use SimpleTextInEx to read console
changes shell edit and hexedit to read input through SimpleTextInEx.

It exposes a issue in UsbKeyboard driver:
Per UEFI Spec,
When interpreting the data from this function (ReadKeyStrokeEx), it
should be noted that if a class of printable characters that are
normally adjusted by shift modifiers (e.g. Shift Key + "f" key) would
be presented solely as a KeyData.Key.UnicodeChar without the
associated shift state. So in the previous example of a Shift Key +
"f" key being pressed, the only pertinent data returned would be
KeyData.Key.UnicodeChar with the value of "F".

UsbKeyboard driver does convert Shift Key + "f" to "F" without the
shift state. But it doesn't do the conversion for all printable
characters, e.g.: Shift Key + "1" --> "!".

The root cause is today's logic to check whether a character is
printable or not is as below:
  if ((KeyDescriptor->AffectedAttribute & EFI_AFFECTED_BY_CAPS_LOCK)
      != 0) {

So it only converts Shift + "a"-"z", but doesn't for Shift + "0"-"9",
and Shift + "["...

The patch updates the check logic as below to fix the issue:
  if ((KeyDescriptor->Unicode != CHAR_NULL) &&
      (KeyDescriptor->ShiftedUnicode != CHAR_NULL) &&
      (KeyDescriptor->Unicode != KeyDescriptor->ShiftedUnicode)) {

The above check is TRUE when the character is printable and
it's *really* affected by Shift key.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoBaseTool/VfrCompile: Fix potential memory leak issue
Bi, Dandan [Tue, 27 Feb 2018 05:53:47 +0000 (13:53 +0800)]
BaseTool/VfrCompile: Fix potential memory leak issue

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

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTool/VfrCompile: make delete[] match with new[]
Bi, Dandan [Tue, 27 Feb 2018 05:53:46 +0000 (13:53 +0800)]
BaseTool/VfrCompile: make delete[] match with new[]

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

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTool: Fixed the issue of empty PcdDB.
BobCF [Fri, 23 Mar 2018 02:24:03 +0000 (10:24 +0800)]
BaseTool: Fixed the issue of empty PcdDB.

If there is no dynamic pcds, there should be DB header
in the Pcd DataBase.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: Add the missing package include directory in PcdValueInit Makefile
Liming Gao [Thu, 22 Mar 2018 15:22:06 +0000 (23:22 +0800)]
BaseTools: Add the missing package include directory in PcdValueInit Makefile

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Feng Bob C <bob.c.feng@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoVlv2TbltDevicePkg: Remove DxeTcg2PhysicalPresenceLibNull
Kinney, Michael D [Wed, 21 Mar 2018 17:48:24 +0000 (10:48 -0700)]
Vlv2TbltDevicePkg: Remove DxeTcg2PhysicalPresenceLibNull

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

The following commit that to use Tcg2 instead of TrEE breaks the
build of Vlv2TbltDevicePkg\Library\DxeTcg2PhysicalPresenceLibNull

https://github.com/tianocore/edk2/commit/9461604e1490f73fdbcc8e957dbe75f75c73b027#diff-c85873f3649e35873a11936ace983807

The correct fix is to remove the DxeTcg2PhysicalPresenceLibNull
library instance and update library mappings in DSC files.

Cc: Jiewen Yao <jiewen.yao@intel.com>
C: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoMdeModulePkg/CapsuleApp: Center bitmap at bottom of screen
Michael D Kinney [Wed, 21 Mar 2018 20:21:10 +0000 (13:21 -0700)]
MdeModulePkg/CapsuleApp: Center bitmap at bottom of screen

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

When -G option is used to convert a BMP file to a UX capsule,
the bitmap is centered horizontally and placed in the lower
half of the screen below the boot logo.

This matches examples shown in the following pages:

https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/user-experience-for-uefi-firmware-updates
https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/boot-screen-components

Checks are also made to make sure the bitmap provided
fits in the current GOP mode.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoMdeModulePkg/CapsuleApp: Fix logic bug in CleanGatherList()
Michael D Kinney [Tue, 20 Mar 2018 02:56:35 +0000 (19:56 -0700)]
MdeModulePkg/CapsuleApp: Fix logic bug in CleanGatherList()

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

Fix pointer math when more than one capsule is passed
to the CapsuleApp.  Use the ContinuationPointer from
the last array entry instead of the first array entry.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoNetworkPkg/UefiPxeBcDxe: Configure the ARP Instance/RouteTable with new address
Jiaxin Wu [Tue, 13 Mar 2018 08:53:18 +0000 (16:53 +0800)]
NetworkPkg/UefiPxeBcDxe: Configure the ARP Instance/RouteTable with new address

After completed a DHCP D.O.R.A process and got the new address, the ARP Instance
and RouteTable should be configured so as to avoid the later Pxe.Arp failure.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoNetworkPkg/HttpDxe: Handle the large data request via HTTPS channel.
Jiaxin Wu [Thu, 15 Mar 2018 10:38:58 +0000 (18:38 +0800)]
NetworkPkg/HttpDxe: Handle the large data request via HTTPS channel.

Cc: Karunakar P <karunakarp@amiindia.co.in>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Karunakar p <karunakarp@amiindia.co.in>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoNetworkPkg/TlsDxe: Handle the multiple TLS record messages encryption/decryption.
Jiaxin Wu [Thu, 15 Mar 2018 10:37:34 +0000 (18:37 +0800)]
NetworkPkg/TlsDxe: Handle the multiple TLS record messages encryption/decryption.

Cc: Karunakar P <karunakarp@amiindia.co.in>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Karunakar p <karunakarp@amiindia.co.in>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoMdePkg/Tls1.h: Add TLS record header length and max payload length.
Jiaxin Wu [Thu, 15 Mar 2018 10:33:54 +0000 (18:33 +0800)]
MdePkg/Tls1.h: Add TLS record header length and max payload length.

Cc: Karunakar P <karunakarp@amiindia.co.in>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Karunakar p <karunakarp@amiindia.co.in>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
3 years agoBaseTools/PosixLike: honor pre-set PYTHONPATH
Laszlo Ersek [Wed, 14 Mar 2018 09:58:34 +0000 (10:58 +0100)]
BaseTools/PosixLike: honor pre-set PYTHONPATH

Utilities written in Python may depend on external (preinstalled) Python
packages; for example, Ecc depends on "antlr_python_runtime-3.0.1". Such
packages need not be installed system-wide, as long as they are reachable
through PYTHONPATH. Therefore we shouldn't overwrite the user's PYTHONPATH
with "BaseTools/Source/Python"; instead, we should prepend the latter to
the former.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=896
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoSecurityPkg Tpm12CommandLib: Fix TPM12 GetCapability response error
Zhang, Chao B [Tue, 20 Mar 2018 15:10:26 +0000 (23:10 +0800)]
SecurityPkg Tpm12CommandLib: Fix TPM12 GetCapability response error

TPM12 command lib doesn't convert Response Size before using. Add logic
to fix the issue.

Cc: Long Qin <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
3 years agoSecurityPkg Tpm2CommandLib: Fix TPM2.0 response memory overflow
Zhang, Chao B [Tue, 20 Mar 2018 08:32:11 +0000 (16:32 +0800)]
SecurityPkg Tpm2CommandLib: Fix TPM2.0 response memory overflow

TPM2.0 command lib always assumes TPM device and transmission channel can
respond correctly. But it is not true when communication channel is exploited
and wrong data is spoofed. Add more logic to prohibit memory overflow attack.

Cc: Long Qin <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
3 years agoBaseTools: FdfParser remove class never used.
Carsey, Jaben [Thu, 15 Mar 2018 21:39:08 +0000 (05:39 +0800)]
BaseTools: FdfParser remove class never used.

the MacroProfile class is never instantiated nor referenced.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: FdfParser & FdfParserLite refactor regular expression for GUIDs
Carsey, Jaben [Thu, 15 Mar 2018 21:39:07 +0000 (05:39 +0800)]
BaseTools: FdfParser & FdfParserLite refactor regular expression for GUIDs

Instead of recompiling it each time the API is called, just use
the global one that exists.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: StrGather remove functions no one calls
Carsey, Jaben [Thu, 15 Mar 2018 21:39:06 +0000 (05:39 +0800)]
BaseTools: StrGather remove functions no one calls

simplify the code and remove functions not called anymore

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: StrGather simplify string/int conversion functions
Carsey, Jaben [Thu, 15 Mar 2018 21:39:05 +0000 (05:39 +0800)]
BaseTools: StrGather simplify string/int conversion functions

use ''.format instead of eval() and use some list comprehension for making list
delete some unused variables

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: StrGather has redundant declaration
Carsey, Jaben [Thu, 15 Mar 2018 21:39:04 +0000 (05:39 +0800)]
BaseTools: StrGather has redundant declaration

remove COMPATIBLE_STRING_TOKEN as it is the same as STRING_TOKEN
remove if statement that used one or the other (identical) re

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Override Max size by build Option Pcd for HII type
Yonghong Zhu [Wed, 21 Mar 2018 02:36:59 +0000 (10:36 +0800)]
BaseTools: Override Max size by build Option Pcd for HII type

Current code will generate maxsize for HII type PCD when parser DSC
file, while this HII type PCD value maybe override in build command
per --pcd option, so the max size need re-calculate.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMaintainers.txt: Add StandaloneMmPkg and maintainers
Achin Gupta [Thu, 15 Feb 2018 13:31:50 +0000 (13:31 +0000)]
Maintainers.txt: Add StandaloneMmPkg and maintainers

This patch adds maintainers, reviewer and directory for the
StandaloneMmPkg. This package will host an implementation of Standalone
Management Mode as specified in the Platform Initialization (PI)
Specification, Volume 4: Management Mode Core Interface.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Reviewed-by: Jiewen.yao@intel.com
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoSourceLevelDebugPkg DebugCommUsb3: Return error when debug cap is reset
Star Zeng [Mon, 19 Mar 2018 12:01:58 +0000 (20:01 +0800)]
SourceLevelDebugPkg DebugCommUsb3: Return error when debug cap is reset

When source level debug is enabled, but debug cable is not connected,
XhcResetHC() in XhciReg.c will reset the host controller, the debug
capability registers will be also reset. After the code in
InitializeUsbDebugHardware() sets DCE bit and LSE bit to "1" in DCCTRL,
there will be DMA on 0 (the value of some debug capability registers
for data transfer is 0) address buffer, fault info like below will
appear when IOMMU based on VTd is enabled.

  VER_REG     - 0x00000010
  CAP_REG     - 0x00D2008C40660462
  ECAP_REG    - 0x0000000000F050DA
  GSTS_REG    - 0xC0000000
  RTADDR_REG  - 0x0000000086512000
  CCMD_REG    - 0x2800000000000000
  FSTS_REG    - 0x00000002
  FECTL_REG   - 0xC0000000
  FEDATA_REG  - 0x00000000
  FEADDR_REG  - 0x00000000
  FEUADDR_REG - 0x00000000
  FRCD_REG[0] - 0xC0000006000000A0 0000000000000000
    Fault Info - 0x0000000000000000
    Source - B00 D14 F00
    Type - 1 (read)
    Reason - 6
  IVA_REG     - 0x0000000000000000
  IOTLB_REG   - 0x1200000000000000

This patch is to return error for the case.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
3 years agoBaseTools: Fix bug for --pcd VOID* type when no max size is specified
Yonghong Zhu [Tue, 20 Mar 2018 05:16:12 +0000 (13:16 +0800)]
BaseTools: Fix bug for --pcd VOID* type when no max size is specified

when VOID* type non-structure pcd used in --pcd, and its max size is not
specified in DSC or its value is hex value, build break due to the code
int(Pcd.MaxDatumSize,10).
Now this patch remove this code, because tool will calculate the size
info in later phase.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: Add Feature Flag Pcd Type into Override list
Yonghong Zhu [Tue, 20 Mar 2018 06:57:04 +0000 (14:57 +0800)]
BaseTools: Add Feature Flag Pcd Type into Override list

when only define the PCD in the DEC file, and use --pcd feature,
we also need cover this case for Feature Flag Type.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdeModulePkg/DxeMain: Fix BSP interrupts reenabled in ExitBootServices
Hao Wu [Mon, 19 Mar 2018 07:02:59 +0000 (15:02 +0800)]
MdeModulePkg/DxeMain: Fix BSP interrupts reenabled in ExitBootServices

Within function CoreExitBootServices(), this commit will move the call
of:

MemoryProtectionExitBootServicesCallback();

before:

SaveAndSetDebugTimerInterrupt (FALSE);
and
gCpu->DisableInterrupt (gCpu);

The reason is that, within MemoryProtectionExitBootServicesCallback(),
APIs like RaiseTpl and RestoreTpl maybe called. An example will be:

DebugLib (using PeiDxeDebugLibReportStatusCode instance)
 |
 v
ReportStatusCodeLib (using DxeReportStatusCodeLib instance)
 |
 v
Raise/RestoreTpl

The call of Raise/RestoreTpl APIs will re-enable BSP interrupts. Hence,
this commit refine the calling sequence to ensure BSP interrupts before
leaving CoreExitBootServices().

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoUefiCpuPkg/MpInitLib: Disable interrupt at ExitBootServices AP Mwait
Hao Wu [Mon, 19 Mar 2018 05:00:13 +0000 (13:00 +0800)]
UefiCpuPkg/MpInitLib: Disable interrupt at ExitBootServices AP Mwait

Within function ApWakeupFunction():

When source level debugger is enabled, AP interrupts will be enabled by
EnableDebugAgent(). Then the AP function will be executed by:

Procedure (Parameter);

After the AP function returns, AP interrupts will be disabled when the
APs are placed in loop mode (both HltLoop and MwaiLoop).

However, at ExitBootServices, ApWakeupFunction() is called with
'Procedure' equals to RelocateApLoop().

(ExitBootServices callback registered within InitMpGlobalData())

RelocateApLoop() never returns, so it has to disable the AP interrupts by
itself. However, we find that interrupts are only disabled for the
HltLoop case, but not for the MwaitLoop case (within file MpFuncs.nasm).

This commit adds the missing disabling of AP interrupts for MwaitLoop.

Also, for X64, this commit will disable the interrupts before switching to
32-bit mode.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
3 years agoMdePkg BaseStackCheckLib: Correct style of file header
Liming Gao [Fri, 16 Mar 2018 01:09:25 +0000 (09:09 +0800)]
MdePkg BaseStackCheckLib: Correct style of file header

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bi Dandan <dandan.bi@intel.com>
3 years agoMdePkg/Library/BaseLib/AArch64: Comment style harmonization
Pete Batard [Mon, 19 Mar 2018 12:48:15 +0000 (20:48 +0800)]
MdePkg/Library/BaseLib/AArch64: Comment style harmonization

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoIntelSiliconPkg/Vtd: Add more debug info.
Jiewen Yao [Sun, 18 Mar 2018 15:39:13 +0000 (23:39 +0800)]
IntelSiliconPkg/Vtd: Add more debug info.

Add more debug info for reason code.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoBaseTools/Conf: Add VS2017/ARM64 support
Pete Batard [Fri, 23 Feb 2018 09:50:03 +0000 (17:50 +0800)]
BaseTools/Conf: Add VS2017/ARM64 support

Build options for ARM64 are the same as for ARM, except for /BASE:0
which is removed from DLINK flags to avoid LNK1355 error:
invalid base address 0x0; ARM64 image cannot have base address below 4GB

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdePkg/Include: Add VA list support for VS2017/ARM64
Pete Batard [Fri, 23 Feb 2018 09:50:02 +0000 (17:50 +0800)]
MdePkg/Include: Add VA list support for VS2017/ARM64

We need to explicitly call the built-in __va_start() for ARM64, otherwise
the variable parameters are not properly enqueued for the next function
calls.
Also do the same for ARM, as as it doesn't harm us.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdePkg/Library/BaseLib: Enable VS2017/ARM64 builds
Pete Batard [Fri, 23 Feb 2018 09:50:01 +0000 (17:50 +0800)]
MdePkg/Library/BaseLib: Enable VS2017/ARM64 builds

Required GCC assembly files are converted for the MSFT assembler

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdePkg: Disable some Level 4 warnings for VS2017/ARM64
Pete Batard [Fri, 23 Feb 2018 09:50:00 +0000 (17:50 +0800)]
MdePkg: Disable some Level 4 warnings for VS2017/ARM64

We disable the exact same warnings as IA32 and X64.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoShellBinPkg: Update ReadMe.txt
Ruiyu Ni [Mon, 19 Mar 2018 06:39:02 +0000 (14:39 +0800)]
ShellBinPkg: Update ReadMe.txt

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoShellBinPkg: Ia32/X64 Shell binary update.
Ruiyu Ni [Mon, 19 Mar 2018 06:11:06 +0000 (14:11 +0800)]
ShellBinPkg: Ia32/X64 Shell binary update.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoBaseTool: Error handling for PCD datumtype.
Feng, Bob C [Mon, 19 Mar 2018 04:05:19 +0000 (12:05 +0800)]
BaseTool: Error handling for PCD datumtype.

Report error if the Pcd DatumType is wrong.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdeModulePkg: Fix coding style issues in file/function comments
Dandan Bi [Fri, 16 Mar 2018 03:30:53 +0000 (11:30 +0800)]
MdeModulePkg: Fix coding style issues in file/function comments

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoBaseTools: RangeExpression - remove unused variable
Carsey, Jaben [Tue, 13 Mar 2018 23:11:35 +0000 (07:11 +0800)]
BaseTools: RangeExpression - remove unused variable

remove a never used variable.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Expression - remove variable
Carsey, Jaben [Tue, 13 Mar 2018 23:11:34 +0000 (07:11 +0800)]
BaseTools: Expression - remove variable

The InArary variable serves no purpose.  just do the work immediately.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Expression - change from series of if to elif
Carsey, Jaben [Tue, 13 Mar 2018 23:11:33 +0000 (07:11 +0800)]
BaseTools: Expression - change from series of if to elif

since the first character of the string cannot be found by multiple if
statements, use elif to optomize the behavior.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Expression refactor function
Carsey, Jaben [Tue, 13 Mar 2018 23:11:32 +0000 (07:11 +0800)]
BaseTools: Expression refactor function

The function is about C Names, not C Strings.
Move the re.compile outside the function call

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Expression - remove redundant variable
Carsey, Jaben [Tue, 13 Mar 2018 23:11:31 +0000 (07:11 +0800)]
BaseTools: Expression - remove redundant variable

Str is created and not needed.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools: Add PackageDocumentTools into Scripts folder
Yonghong Zhu [Thu, 15 Mar 2018 06:40:57 +0000 (14:40 +0800)]
BaseTools: Add PackageDocumentTools into Scripts folder

This tool is used to generate the document for edk2 packages. The
generated document will be in UDK release. For example, UDK2017
document can be found in:
https://github.com/tianocore/tianocore.github.io/wiki/UDK2017#documentation

Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoBaseTools: Fix bug for VOID* DynamicDefault Pcd use Flexible format
Yonghong Zhu [Thu, 15 Mar 2018 11:40:18 +0000 (19:40 +0800)]
BaseTools: Fix bug for VOID* DynamicDefault Pcd use Flexible format

define a flexible pcd format in Dyanmic/DynamicExDefault section,
it cause build error.
[PcdsDynamicExDefault.common.DEFAULT]
  pcdToken.Name|{GUID("11111111-2222-42eb-b5eb-fef31d207cb4")}

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: Detect structure pcd header file change.
BobCF [Fri, 16 Mar 2018 09:40:00 +0000 (17:40 +0800)]
BaseTools: Detect structure pcd header file change.

Detect structure pcd header file change

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: --hash --binary-destination generate wrong binary path
Feng, YunhuaX [Fri, 16 Mar 2018 07:03:16 +0000 (15:03 +0800)]
BaseTools: --hash --binary-destination generate wrong binary path

Option --hash --binary-destination generate Binaries section in
the inf file, but the path of ASL file is begin with
Output directory,  so need replace Output directory with '',
will get the file name RamDisk.aml

Incorrect AML file path in inf file on linux:
[Binaries.X64]
  PE32|RamDiskDxe.efi

ASL|home/tiano/Desktop/hash/edk2/Build/OvmfX64/RELEASE_GCC5/X64
/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe/OUTPUT/RamDisk.aml
  DXE_DEPEX|RamDiskDxe.depex
  BIN|RamDiskDxeOffset.bin

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoSecurityPkg OpalPasswordDxe:Fix wrong BufferSize input to UnicodeSPrint
Star Zeng [Thu, 15 Mar 2018 05:50:31 +0000 (13:50 +0800)]
SecurityPkg OpalPasswordDxe:Fix wrong BufferSize input to UnicodeSPrint

Current code uses string length as BufferSize input to UnicodeSPrint,
it is wrong and makes the pop up string trimmed. The BufferSize input
to UnicodeSPrint should be the size, in bytes, of the output buffer.

This is to use sizeof (mPopUpString) as the BufferSize input to
UnicodeSPrint, it also updates array size of mPopUpString from 256 to
100 that is enough, otherwise the pop up string may be too long.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoSecurityPkg OpalPasswordPei: Go next when AhciModeInitialize is failed
Star Zeng [Tue, 13 Mar 2018 07:41:41 +0000 (15:41 +0800)]
SecurityPkg OpalPasswordPei: Go next when AhciModeInitialize is failed

Go to next loop instead of going to unlock OPAL password when
AhciModeInitialize is failed.

It is just error handling.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoSecurityPkg OpalPasswordDxe: Move OPAL request variable definition
Star Zeng [Tue, 13 Mar 2018 01:23:38 +0000 (09:23 +0800)]
SecurityPkg OpalPasswordDxe: Move OPAL request variable definition

Move OPAL request variable definition from OpalHiiFormValues.h to
OpalHii.h.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoSecurityPkg OpalPasswordDxe: Return directly if no any device
Star Zeng [Tue, 13 Mar 2018 01:18:03 +0000 (09:18 +0800)]
SecurityPkg OpalPasswordDxe: Return directly if no any device

Return directly if no any device in EndOfDxe notification.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoOvmfPkg/PlatformBootManagerLib: process "-kernel" before boot devices
Laszlo Ersek [Thu, 15 Mar 2018 11:49:26 +0000 (12:49 +0100)]
OvmfPkg/PlatformBootManagerLib: process "-kernel" before boot devices

This improves the UEFI boot time for VMs that have "-kernel", many disks
or NICs, and no "bootindex" properties.

(Unlike in ArmVirt commit 23d04b58e27b, in OvmfPkg commit 52fba28994e9 we
introduced TryRunningQemuKernel() right from the start *after*
BdsLibConnectAll(). Therefore, unlike in patch
'ArmVirtPkg/PlatformBootManagerLib: return to "-kernel before boot
devices"', we adopt the logic as new in this patch.)

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Gabriel Somlo <gsomlo@gmail.com>
3 years agoOvmfPkg/PlatformBootManagerLib: hoist PciAcpiInitialization()
Laszlo Ersek [Thu, 15 Mar 2018 14:20:08 +0000 (15:20 +0100)]
OvmfPkg/PlatformBootManagerLib: hoist PciAcpiInitialization()

  PlatformBootManagerAfterConsole()
                              <--------------------------------+
    PlatformBdsConnectSequence()                               |
      ConnectDevicesFromQemu() / EfiBootManagerConnectAll()    |
      PciAcpiInitialization() ---------------------------------+
    TryRunningQemuKernel()

Functionally this is a no-op:

- PciAcpiInitialization() iterates over PciIo protocol instances, which
  are available just the same at the new call site.

- The PCI interrupt line register exists only to inform system software
  (it doesn't affect hardware) and UEFI drivers don't use PCI interrupts
  anyway.

(More background in commits 2e70cf8ade0d and 5218c27950c4.)

This change will let us move TryRunningQemuKernel() between
PciAcpiInitialization() and PlatformBdsConnectSequence() in the next
patch.

Cc: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Gabriel Somlo <gsomlo@gmail.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Gabriel Somlo <gsomlo@gmail.com>
3 years agoOvmfPkg/PlatformBootManagerLib: rejuvenate old-style function comments
Laszlo Ersek [Thu, 15 Mar 2018 13:57:39 +0000 (14:57 +0100)]
OvmfPkg/PlatformBootManagerLib: rejuvenate old-style function comments

The old-style "Routine Description: ..." comments use the leftmost column
and are placed between the parameter list and the function body. Therefore
they cause git-diff to produce bogus hunk headers that fail to name the
function being patched.

Convert these comment blocks to the current edk2 style. While at it, clean
them up too.

For PlatformBootManagerBeforeConsole() and
PlatformBootManagerAfterConsole(), copy the descriptions from the call
sites in "MdeModulePkg/Universal/BdsDxe/BdsEntry.c". They are more
detailed than the comments in the lib class header
"MdeModulePkg/Include/Library/PlatformBootManagerLib.h"; ArmVirtPkg
already uses these comments.

No functional changes.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Gabriel Somlo <gsomlo@gmail.com>
3 years agoOvmfPkg/PlatformBootManagerLib: wrap overlong lines in "BdsPlatform.c"
Laszlo Ersek [Thu, 15 Mar 2018 13:19:22 +0000 (14:19 +0100)]
OvmfPkg/PlatformBootManagerLib: wrap overlong lines in "BdsPlatform.c"

No functional changes.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Gabriel Somlo <gsomlo@gmail.com>
3 years agoArmVirtPkg/PlatformBootManagerLib: return to "-kernel before boot devices"
Laszlo Ersek [Thu, 15 Mar 2018 11:49:26 +0000 (12:49 +0100)]
ArmVirtPkg/PlatformBootManagerLib: return to "-kernel before boot devices"

Move the TryRunningQemuKernel() call back to its original place. This
improves the UEFI boot time for VMs that have "-kernel", many disks or
NICs, and no "bootindex" properties. A well-known example is
guestfish/libguestfs.

For more info on the TryRunningQemuKernel() location, see the following
commits: 23d04b58e27ba78c4836ea0b158990b941e4.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Xiang Zheng <xiang.zheng@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoMdeModulePkg/DxeCapsuleLibFmp: Add more check for the UX capsule
Ruiyu Ni [Fri, 16 Mar 2018 07:04:05 +0000 (15:04 +0800)]
MdeModulePkg/DxeCapsuleLibFmp: Add more check for the UX capsule

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoMdeModulePkg/PiSmmCore: fix #PF caused by freeing read-only memory
Jian J Wang [Thu, 15 Mar 2018 06:19:00 +0000 (14:19 +0800)]
MdeModulePkg/PiSmmCore: fix #PF caused by freeing read-only memory

SMM core will add a HEADER before each allocated pool memory and clean
up this header once it's freed. If a block of allocated pool is marked
as read-only after allocation (EfiRuntimeServicesCode type of pool in
SMM will always be marked as read-only), #PF exception will be triggered
during memory pool freeing.

Normally EfiRuntimeServicesCode type of pool should not be freed in the
real world. But some test suites will actually do memory free for all
types of memory for the purpose of functionality and conformance test.
So this issue should be fixed anyway.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>