]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
4 years agoShellPkg/UefiShellLib: clarify workaround for unfixable EdkShell bug
Laszlo Ersek [Fri, 6 Sep 2019 22:19:29 +0000 (00:19 +0200)]
ShellPkg/UefiShellLib: clarify workaround for unfixable EdkShell bug

The EDK 1 Shell (available at <https://github.com/tianocore/edk-Shell>)
has a bug in its EFI_SHELL_ENVIRONMENT2.Execute() implementation that
edk2's UefiShellLib has no choice but to work around.

Improve the explanation in the code. Also, document the implicit
EFI_HANDLE -> (EFI_HANDLE*) conversion, which happens implicitly after
dereferencing ParentHandle, with an explicit cast.

In practice, this patch is a no-op.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoShellPkg/UefiShellDebug1CommandsLib: fix ShellCloseFile() call
Laszlo Ersek [Fri, 6 Sep 2019 21:29:03 +0000 (23:29 +0200)]
ShellPkg/UefiShellDebug1CommandsLib: fix ShellCloseFile() call

In the FileBufferSave() function, we invoke ShellCloseFile() if "Directory
Can Not Be Saved".

The ShellCloseFile() function takes a (SHELL_FILE_HANDLE*) parameter
called "FileHandle", and correctly passes the de-referenced (*FileHandle)
to EFI_SHELL_CLOSE_FILE, which takes a SHELL_FILE_HANDLE.

However, FileBufferSave() passes SHELL_FILE_HANDLE to ShellCloseFile(),
not the expected (SHELL_FILE_HANDLE*). Correct it.

This fixes an actual bug that has remained hidden for two reasons:

- pointer-to-VOID converts from/to any pointer-to-object type silently,
- the bug is on an error path which has likely never fired in practice.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: stop taking EFI_HANDLE in place of SHELL_FILE_HANDLE
Laszlo Ersek [Fri, 6 Sep 2019 21:40:37 +0000 (23:40 +0200)]
ShellPkg: stop taking EFI_HANDLE in place of SHELL_FILE_HANDLE

The TouchFileByHandle() and IsDirectoryEmpty() functions are passed
SHELL_FILE_HANDLE parameters, and they use those parameters correctly.
However, their parameter lists say EFI_HANDLE.

Spell out the right type in the parameter lists.

In practice, this change is a no-op (because, quite regrettably, both
EFI_HANDLE and SHELL_FILE_HANDLE are specified to be typedefs of (VOID*)).

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: stop using EFI_HANDLE in place of EFI_HII_HANDLE
Laszlo Ersek [Fri, 6 Sep 2019 21:15:42 +0000 (23:15 +0200)]
ShellPkg: stop using EFI_HANDLE in place of EFI_HII_HANDLE

The UefiShell*CommandsLib instances have constructor functions that do
something like:

  gHiiHandle = HiiAddPackages (...);
  ...
  ShellCommandRegisterCommandName (..., gHiiHandle, ...);

and destructor functions that implement the following pattern:

  HiiRemovePackages (gHiiHandle);

The -- semantic, not functional -- problem is that "gHiiHandle" is
declared with type EFI_HANDLE, and not EFI_HII_HANDLE, in all of these
library instances, even though HiiAddPackages() correctly returns
EFI_HII_HANDLE, and HiiRemovePackages() takes EFI_HII_HANDLE.

Once we fix the type of "gHiiHandle", it causes sort of a butterfly
effect, because it is passed around widely. Track down and update all of
those locations.

The DynamicCommand lib instances use a similar pattern, so they are
affected too.

NOTE: in practice, this patch is a no-op, as both EFI_HII_HANDLE and
EFI_HANDLE are typedefs to (VOID*). However, we shouldn't use EFI_HANDLE
where semantically EFI_HII_HANDLE is passed around.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg/UefiShellDriver1CommandsLib: fix parameter list typo
Laszlo Ersek [Fri, 6 Sep 2019 20:02:06 +0000 (22:02 +0200)]
ShellPkg/UefiShellDriver1CommandsLib: fix parameter list typo

The ShellCommandRunConnect() function passes EFI_HANDLE -- (VOID*) --
objects to ConvertAndConnectControllers(), and
ConvertAndConnectControllers() passes those to gBS->OpenProtocol().

Accordingly, ConvertAndConnectControllers() should specify EFI_HANDLE
parameter types, not (EFI_HANDLE*) -- (VOID**) -- types.

This typo is masked because (VOID*) converts to and from any
pointer-to-object type silently.

Note that functionally speaking there is no problem, so this patch does
not change beavior, only cleans up the code.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoSecurityPkg: stop abusing EFI_EVENT for protocol notify registration
Laszlo Ersek [Fri, 6 Sep 2019 22:58:19 +0000 (00:58 +0200)]
SecurityPkg: stop abusing EFI_EVENT for protocol notify registration

EfiCreateProtocolNotifyEvent() takes a (VOID**) for "Registration",
similarly to gBS->RegisterProtocolNotify(). We should pass the address of
an actual pointer-to-VOID, and not the address of an EFI_EVENT. EFI_EVENT
just happens to be specified as (VOID*), and has nothing to do with the
registration.

This change is a no-op in practice; it's a semantic improvement.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
4 years agoSecurityPkg: fix UninstallMultipleProtocolInterfaces() calls
Laszlo Ersek [Fri, 6 Sep 2019 22:50:42 +0000 (00:50 +0200)]
SecurityPkg: fix UninstallMultipleProtocolInterfaces() calls

Unlike the InstallMultipleProtocolInterfaces() boot service, which takes
an (EFI_HANDLE*) as first parameter, the
UninstallMultipleProtocolInterfaces() boot service takes an EFI_HANDLE as
first parameter.

These are actual bugs. They must have remained hidden until now because
they are all in Unload() functions, which are probably exercised
infrequently. Fix the UninstallMultipleProtocolInterfaces() calls.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
4 years agoOvmfPkg/PlatformDxe: fix EFI_HII_HANDLE parameters of internal functions
Laszlo Ersek [Thu, 12 Sep 2019 21:53:16 +0000 (23:53 +0200)]
OvmfPkg/PlatformDxe: fix EFI_HII_HANDLE parameters of internal functions

In the following call tree:

 PlatformInit ()
   mInstalledPackages = HiiAddPackages ()
 GopInstalled ()
    PopulateForm (PackageList = mInstalledPackages)
      CreateResolutionOptions (PackageList)
        HiiSetString (PackageList
      HiiUpdateForm (PackageList)

PlatformDxe passes around an EFI_HII_HANDLE that (a) originates from
HiiAddPackages() and (b) is ultimately passed to HiiSetString() and
HiiUpdateForm(). The intermediate functions PopulateForm() and
CreateResolutionOptions() however take that parameter as an
(EFI_HII_HANDLE*).

There is no bug in practice (because the affected functions never try to
de-reference the "PackageList" parameter, they just pass it on), but the
function prototypes are semantically wrong. Fix that.

This could remain hidden so long because pointer-to-VOID silently converts
to/from any pointer-to-object type, and the UEFI spec mandates that
EFI_HII_HANDLE be a typedef to (VOID*).

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4 years agoOvmfPkg/VirtioNetDxe: fix SignalEvent() call
Laszlo Ersek [Thu, 12 Sep 2019 21:27:56 +0000 (23:27 +0200)]
OvmfPkg/VirtioNetDxe: fix SignalEvent() call

The SignalEvent() boot service takes an EFI_EVENT, not an (EFI_EVENT*).
Fix the call in the notification function of
"EFI_SIMPLE_NETWORK_PROTOCOL.WaitForPacket".

This is an actual bug. The reason it's never been triggered is likely that
the "SNP.WaitForPacket" event is rarely waited for by applications -- edk2
itself has zero instances of that, for example.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4 years agoOvmfPkg/XenBusDxe: fix UninstallMultipleProtocolInterfaces() call
Laszlo Ersek [Fri, 6 Sep 2019 22:50:42 +0000 (00:50 +0200)]
OvmfPkg/XenBusDxe: fix UninstallMultipleProtocolInterfaces() call

Unlike the InstallMultipleProtocolInterfaces() boot service, which takes
an (EFI_HANDLE*) as first parameter, the
UninstallMultipleProtocolInterfaces() boot service takes an EFI_HANDLE as
first parameter.

This is an actual bug. It must have remained hidden until now because it's
on an error path. Fix the UninstallMultipleProtocolInterfaces() call.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@arm.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoNetworkPkg/TcpDxe: fix SockFreeFoo() parameter list
Laszlo Ersek [Sat, 7 Sep 2019 18:17:24 +0000 (20:17 +0200)]
NetworkPkg/TcpDxe: fix SockFreeFoo() parameter list

The SockFreeFoo() callback function for NetbufFromExt() has to match the
NET_VECTOR_EXT_FREE prototype, which takes a (VOID*) as callback argument
(Arg). EFI_EVENT has nothing to do with NET_VECTOR_EXT_FREE. Fix the
SockFreeFoo() parameter list.

This change is a no-op in practice.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoNetworkPkg/Ip4Dxe: fix NetLibDestroyServiceChild() call
Laszlo Ersek [Sat, 7 Sep 2019 12:25:43 +0000 (14:25 +0200)]
NetworkPkg/Ip4Dxe: fix NetLibDestroyServiceChild() call

Both NetLibDestroyServiceChild() and EFI_SERVICE_BINDING_DESTROY_CHILD
take an EFI_HANDLE for the "ChildHandle" parameter, not an (EFI_HANDLE*).

This patch fixes a real bug.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoNetworkPkg: fix CloseProtocol & UninstallMultipleProtocolInterfaces calls
Laszlo Ersek [Sat, 7 Sep 2019 12:11:31 +0000 (14:11 +0200)]
NetworkPkg: fix CloseProtocol & UninstallMultipleProtocolInterfaces calls

Both the "ControllerHandle" parameter of CloseProtocol() and the "Handle"
parameter of UninstallMultipleProtocolInterfaces() have type EFI_HANDLE,
not (EFI_HANDLE*).

This patch fixes actual bugs. The issues have been dormant likely because
they are on error paths. (Or, in case of TlsAuthConfigDxe, because the
driver is unloaded likely very infrequently.)

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agoNetworkPkg/DxeNetLib: fix type typo in NetLibGetMacAddress()
Laszlo Ersek [Fri, 6 Sep 2019 22:37:31 +0000 (00:37 +0200)]
NetworkPkg/DxeNetLib: fix type typo in NetLibGetMacAddress()

NetLibGetSnpHandle() returns an EFI_HANDLE, not an (EFI_HANDLE*).
NetLibGetMacAddress() only uses the return value ("SnpHandle") for a
NULL-check. Fix the type of "SnpHandle".

This patch is a no-op.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoMdePkg/DxeServicesLib: remove bogus cast
Laszlo Ersek [Fri, 6 Sep 2019 22:40:56 +0000 (00:40 +0200)]
MdePkg/DxeServicesLib: remove bogus cast

The HandleProtocol() boot service takes an EFI_HANDLE, not an
(EFI_HANDLE*). Remove the bogus cast in the
InternalImageHandleToFvHandle() function.

This is a semantic cleanup; there is no change in behavior.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg/S3SaveState: cast Position for S3BootScriptLib explicitly
Laszlo Ersek [Fri, 13 Sep 2019 17:33:38 +0000 (19:33 +0200)]
MdeModulePkg/S3SaveState: cast Position for S3BootScriptLib explicitly

The BootScriptInsert() and BootScriptLabel() functions take the in/out
parameter "Position" as (EFI_S3_BOOT_SCRIPT_POSITION*), and pass it to
S3BootScriptMoveLastOpcode() and S3BootScriptLabel(), respectively.

The callees take the in/out parameter "Position" as (VOID**). Add explicit
casts for clarity.

There is no change in functionality.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/PiSmmCore: make type punning consistent
Laszlo Ersek [Thu, 12 Sep 2019 22:29:43 +0000 (00:29 +0200)]
MdeModulePkg/PiSmmCore: make type punning consistent

The SmiHandlerRegister() function explicitly casts "SmiHandler" (of type
(SMI_HANDLER*)) to EFI_HANDLE, when outputting "DispatchHandle".

Apply the same cast in the counterpart function SmiHandlerUnRegister(),
which compares multiple "SmiHandler"s against the input "DispatchHandle".

This is a semantic cleanup; there is no functional change.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: fix UninstallMultipleProtocolInterfaces() calls
Laszlo Ersek [Fri, 6 Sep 2019 22:50:42 +0000 (00:50 +0200)]
MdeModulePkg: fix UninstallMultipleProtocolInterfaces() calls

Unlike the InstallMultipleProtocolInterfaces() boot service, which takes
an (EFI_HANDLE*) as first parameter, the
UninstallMultipleProtocolInterfaces() boot service takes an EFI_HANDLE as
first parameter.

These are actual bugs. They must have remained hidden until now because
they are on error paths. Fix the UninstallMultipleProtocolInterfaces()
calls.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: PEI Core: clean up "AprioriFile" handling in FindFileEx()
Laszlo Ersek [Sat, 7 Sep 2019 13:13:39 +0000 (15:13 +0200)]
MdeModulePkg: PEI Core: clean up "AprioriFile" handling in FindFileEx()

Clean up two issues around FindFileEx():

- The "AprioriFile" parameter's type differs between the function
  declaration and the function definition. The correct type is
  (EFI_PEI_FILE_HANDLE*).

- "FfsFileHeader" has type (EFI_FFS_FILE_HEADER*); for clarity, we should
  cast it explicitly to EFI_PEI_FILE_HANDLE when assigning it to
  (*AprioriFile).

This is a semantic cleanup, there is no functional change.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: stop abusing EFI_HANDLE for keystroke notify registration
Laszlo Ersek [Sat, 7 Sep 2019 11:34:09 +0000 (13:34 +0200)]
MdeModulePkg: stop abusing EFI_HANDLE for keystroke notify registration

EFI_REGISTER_KEYSTROKE_NOTIFY and EFI_UNREGISTER_KEYSTROKE_NOTIFY require
the notification handle to have type (VOID*). The notification handle has
nothing to do with the EFI_HANDLE type.

This change is a semantic fix; functionally, it's a no-op.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: document workaround for EFI_RUNTIME_EVENT_ENTRY PI spec bug
Laszlo Ersek [Sat, 7 Sep 2019 11:17:49 +0000 (13:17 +0200)]
MdeModulePkg: document workaround for EFI_RUNTIME_EVENT_ENTRY PI spec bug

The PI spec (v1.7) correctly specifies "EFI_RUNTIME_EVENT_ENTRY.Event" in
natural language, but the field type in the structure definition itself is
wrong -- it should be EFI_EVENT, not (EFI_EVENT*).

This spec bug is likely unfixable for compatibility reasons, and so edk2
works it around already. We should clearly document the workaround.

Functionally, this patch is a no-op.

(I've also requested a non-normative (informative) clarification for the
PI spec: <https://mantis.uefi.org/mantis/view.php?id=2017>.)

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/PlatformVarCleanupLib: fix HiiConstructConfigHdr() call
Laszlo Ersek [Sat, 7 Sep 2019 09:48:58 +0000 (11:48 +0200)]
MdeModulePkg/PlatformVarCleanupLib: fix HiiConstructConfigHdr() call

The HiiConstructConfigHdr() function takes the "DriverHandle" parameter in
order to fetch the device path from it, and then turn the device path into
PATH routing information.

The HiiConstructConfigHdr() function is called from
VariableCleanupHiiExtractConfig(), which is only installed when "Type" is
"VarCleanupManually" in PlatformVarCleanup().

In that case, we create "Private->DriverHandle" as a new handle, and
install "mVarCleanupHiiVendorDevicePath" on it. Then we pass
"Private->DriverHandle" to HiiAddPackages(), which consumes the device
path for routing purposes.

It follows that the "DriverHandle" argument passed to
HiiConstructConfigHdr() should be the same driver handle, for matching
routing.

Currently we pass "Private->HiiHandle", which is clearly a typo, because
it is the return value of HiiAddPackages(), and stands for the published
HII package list.

Therefore this patch addresses an actual bug.

The typo has not been flagged by compilers because the UEFI spec
regrettably defines both EFI_HANDLE and EFI_HII_HANDLE as (VOID*).

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: stop abusing EFI_EVENT for protocol notify registration
Laszlo Ersek [Fri, 6 Sep 2019 22:58:19 +0000 (00:58 +0200)]
MdeModulePkg: stop abusing EFI_EVENT for protocol notify registration

EfiCreateProtocolNotifyEvent() takes a (VOID**) for "Registration",
similarly to gBS->RegisterProtocolNotify(). We should pass the address of
an actual pointer-to-VOID, and not the address of an EFI_EVENT. EFI_EVENT
just happens to be specified as (VOID*), and has nothing to do with the
registration.

The same applies to gMmst->MmRegisterProtocolNotify().

"mFtwRegistration", "mFvRegistration", and "mFvbRegistration" are used for
nothing else.

This change is a no-op in practice; it's a semantic improvement.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg/UefiHiiLib: stop using EFI_HANDLE in place of EFI_HII_HANDLE
Laszlo Ersek [Fri, 6 Sep 2019 22:45:38 +0000 (00:45 +0200)]
MdeModulePkg/UefiHiiLib: stop using EFI_HANDLE in place of EFI_HII_HANDLE

HiiGetHiiHandles() returns an array of EFI_HII_HANDLEs, not EFI_HANDLEs.
HiiGetString() takes an EFI_HII_HANDLE, not an EFI_HANDLE.

This change is a no-op in practice; it's a semantic improvement.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg: fix cast in GetModuleInfoFromHandle() calls
Laszlo Ersek [Fri, 6 Sep 2019 19:40:32 +0000 (21:40 +0200)]
MdeModulePkg: fix cast in GetModuleInfoFromHandle() calls

GetModuleInfoFromHandle() takes an EFI_HANDLE -- (VOID*) -- as first
parameter, but InsertFpdtRecord() passes (EFI_HANDLE*) -- (VOID**).
(VOID**) converts silently to (VOID*), which is why the wrong cast is
masked.

Note that the *value* that is passed is alright -- therefore this patch
does not change behavior --, it's just semantically wrong to pass an
(EFI_HANDLE*) where an EFI_HANDLE is expected.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoEmulatorPkg: stop abusing EFI_HANDLE for keystroke notify registration
Laszlo Ersek [Sat, 7 Sep 2019 11:34:09 +0000 (13:34 +0200)]
EmulatorPkg: stop abusing EFI_HANDLE for keystroke notify registration

EFI_REGISTER_KEYSTROKE_NOTIFY and EFI_UNREGISTER_KEYSTROKE_NOTIFY require
the notification handle to have type (VOID*). The notification handle has
nothing to do with the EFI_HANDLE type.

This change is a semantic fix; functionally, it's a no-op.

Cc: Andrew Fish <afish@apple.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoEmulatorPkg/DxeTimerLib: drop superfluous cast
Laszlo Ersek [Sat, 7 Sep 2019 00:07:55 +0000 (02:07 +0200)]
EmulatorPkg/DxeTimerLib: drop superfluous cast

"gTimerEvent" has type EFI_EVENT already, drop the superfluous cast.

Cc: Andrew Fish <afish@apple.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoEmbeddedPkg/Universal/MmcDxe: "fix" CloseProtocol() call in BindingStop()
Laszlo Ersek [Fri, 6 Sep 2019 23:43:28 +0000 (01:43 +0200)]
EmbeddedPkg/Universal/MmcDxe: "fix" CloseProtocol() call in BindingStop()

The 3rd and 4th parameters of the CloseProtocol() call are wrong.

Given that we're not dissociating a child controller from a parent
controller (= closing a BY_CHILD_CONTROLLER open), but closing a BY_DRIVER
open, the 4th parameter (ControllerHandle) should equal the 1st parameter
(Handle).

It's unclear why this code hasn't crashed before.

Note that the patch doesn't fix the underlying driver model bug. I don't
understand what the loop in MmcDriverBindingStop() attempts to do. Is this
driver supposed to be a bus driver? It seems to create new handles, and to
append device path nodes. But it doesn't set up proper parent/child
protocol opens, and it doesn't close them.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4 years agoEmbeddedPkg/AndroidFastbootTransportTcpDxe: fix DestroyChild() call
Laszlo Ersek [Fri, 6 Sep 2019 23:25:10 +0000 (01:25 +0200)]
EmbeddedPkg/AndroidFastbootTransportTcpDxe: fix DestroyChild() call

- The 2nd parameter of EFI_SERVICE_BINDING_CREATE_CHILD is:

  IN OUT EFI_HANDLE *ChildHandle

- The 2nd parameter of EFI_SERVICE_BINDING_DESTROY_CHILD is:

  IN EFI_HANDLE ChildHandle

Fix the DestroyChild() call in TcpFastbootTransportStop().

This is an actual bugfix; I don't know why the current code doesn't crash.
Perhaps the function is never reached in practice? (It could be tied to an
error path.)

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4 years agoEmbeddedPkg: add missing EFIAPI calling convention specifiers
Laszlo Ersek [Tue, 17 Sep 2019 11:05:09 +0000 (13:05 +0200)]
EmbeddedPkg: add missing EFIAPI calling convention specifiers

This patch is unrelated to the rest of the series; it just makes sure that
"EmbeddedPkg/EmbeddedPkg.dsc" builds for all platforms advertised in
SUPPORTED_ARCHITECTURES (in particular, X64).

No functional changes.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoMdeModulePkg/BdsDxe: Also call PlatformBootManagerWaitCallback on 0
Pete Batard [Wed, 25 Sep 2019 15:50:05 +0000 (23:50 +0800)]
MdeModulePkg/BdsDxe: Also call PlatformBootManagerWaitCallback on 0

The existing loop is set to call PlatformBootManagerWaitCallback every
second except the last one. We believe this is a mistake as it prevents
the called code from performing timeout expiration tasks such as, for
instance, ensuring that the last segment of a progress bar is displayed
before continuing (which is a current issue for the RPi3 platform).

Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoMaintainers.txt: Move ShellBin maintainers to EDK II Releases section
Liming Gao [Fri, 27 Sep 2019 00:23:30 +0000 (08:23 +0800)]
Maintainers.txt: Move ShellBin maintainers to EDK II Releases section

ShellBinPkg is generated for each edk2 stable tag release.

Cc: Andrew Fish <afish@apple.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoNetworkPkg: Remove unnecessary MdeModulePkg/MdeModulePkg.dec dependency in INF
Liming Gao [Tue, 17 Sep 2019 02:58:59 +0000 (10:58 +0800)]
NetworkPkg: Remove unnecessary MdeModulePkg/MdeModulePkg.dec dependency in INF

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoMdeModulePkg: Remove PCD gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize
Liming Gao [Tue, 17 Sep 2019 02:58:58 +0000 (10:58 +0800)]
MdeModulePkg: Remove PCD gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2195
This PCD has been moved to NetworkPkg.dec file.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoNetworkPkg UefiPxeBcDxe: Consume PcdTftpBlockSize defined in NetworkPkg.dec
Liming Gao [Tue, 17 Sep 2019 02:58:57 +0000 (10:58 +0800)]
NetworkPkg UefiPxeBcDxe: Consume PcdTftpBlockSize defined in NetworkPkg.dec

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

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoNetworkPkg: Add PcdTftpBlockSize in NetworkPkg.dec
Liming Gao [Tue, 17 Sep 2019 02:58:56 +0000 (10:58 +0800)]
NetworkPkg: Add PcdTftpBlockSize in NetworkPkg.dec

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2195
PcdTftpBlockSize is network related PCD. It should be defined in NetworkPkg.dec.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoMdeModulePkg: Remove network related guid definitions from MdeModulePkg.dec
Liming Gao [Tue, 17 Sep 2019 02:58:55 +0000 (10:58 +0800)]
MdeModulePkg: Remove network related guid definitions from MdeModulePkg.dec

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2196
Network related guid definitions have been moved into NetworkPkg.dec.
So, they can be removed from MdeModulePkg.dec.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoNetworkPkg: Move network related header files from MdeModulePkg to NetworkPkg
Liming Gao [Tue, 17 Sep 2019 02:58:54 +0000 (10:58 +0800)]
NetworkPkg: Move network related header files from MdeModulePkg to NetworkPkg

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

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
4 years agoUefiCpuPkg: strip trailing whitespace
Leif Lindholm [Thu, 19 Sep 2019 12:05:06 +0000 (13:05 +0100)]
UefiCpuPkg: strip trailing whitespace

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoOvmfPkg: strip trailing whitespace
Leif Lindholm [Thu, 19 Sep 2019 12:05:00 +0000 (13:05 +0100)]
OvmfPkg: strip trailing whitespace

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg: strip trailing whitespace
Leif Lindholm [Thu, 19 Sep 2019 12:04:53 +0000 (13:04 +0100)]
MdeModulePkg: strip trailing whitespace

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoEmulatorPkg: strip trailing whitespace
Leif Lindholm [Thu, 19 Sep 2019 12:04:40 +0000 (13:04 +0100)]
EmulatorPkg: strip trailing whitespace

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoBaseTools: strip trailing whitespace
Leif Lindholm [Tue, 1 Oct 2019 12:42:32 +0000 (13:42 +0100)]
BaseTools: strip trailing whitespace

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
4 years agoArmPlatformPkg: strip trailing whitespace
Leif Lindholm [Thu, 19 Sep 2019 12:04:27 +0000 (13:04 +0100)]
ArmPlatformPkg: strip trailing whitespace

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoArmPkg: strip trailing whitespace
Leif Lindholm [Thu, 19 Sep 2019 12:04:22 +0000 (13:04 +0100)]
ArmPkg: strip trailing whitespace

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoEmbeddedPkg: convert Lauterbach README.txt to 7-bit safe Readme.md
Leif Lindholm [Wed, 18 Sep 2019 21:44:56 +0000 (22:44 +0100)]
EmbeddedPkg: convert Lauterbach README.txt to 7-bit safe Readme.md

This file contained what looked like windows 1250 encoded single
quotation marks. Convert them to regular 's. Rework the file to
markdown format and and rename it Readme.md while we're at it.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoBaseTools: correct line endings for ConvertFce Python script
Leif Lindholm [Wed, 18 Sep 2019 21:41:08 +0000 (22:41 +0100)]
BaseTools: correct line endings for ConvertFce Python script

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoArmPkg: ArmScmiDxe - convert .h to from 8859-x to 7-bit
Leif Lindholm [Wed, 18 Sep 2019 21:38:46 +0000 (22:38 +0100)]
ArmPkg: ArmScmiDxe - convert .h to from 8859-x to 7-bit

A paragraph sign in a comment came from some ISO8859 encoding,
convert it to the word "section" to remain 7-bit safe, since we're
not actually doing anything special.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoDynamicTablesPkg: fix .dsc line ending
Leif Lindholm [Wed, 18 Sep 2019 20:40:42 +0000 (21:40 +0100)]
DynamicTablesPkg: fix .dsc line ending

Correct line ending in package .dsc.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Sami Mujawar <Sami.Mujawar@arm.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoBaseTools: fix line endings in SetupGit.py Conf files
Leif Lindholm [Wed, 18 Sep 2019 20:35:08 +0000 (21:35 +0100)]
BaseTools: fix line endings in SetupGit.py Conf files

A file header license/copyright header copied around in commit
5b3e695d8ac5 ("BaseTools: add centralized location for git config files")
was missing a CR - add it in both faulty locations.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoEmbeddedPkg: delete outdated FdtLib README.txt
Leif Lindholm [Wed, 18 Sep 2019 20:26:44 +0000 (21:26 +0100)]
EmbeddedPkg: delete outdated FdtLib README.txt

While looking at encoding and line ending errors, I found this file
in fact simply points to a sourceforge page which no longer exists.
Since there is nothing more to say than "this is an import of
libfdt", let's just delete it.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoNetworkPkg: add missing newline at end of file
Leif Lindholm [Wed, 18 Sep 2019 08:23:05 +0000 (09:23 +0100)]
NetworkPkg: add missing newline at end of file

Add missing newline at end of WifiConnectionManagerDxe .uni.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoEmbeddedPkg: add missing newline at end of TemplateResetSystemLib.inf
Leif Lindholm [Wed, 18 Sep 2019 08:22:52 +0000 (09:22 +0100)]
EmbeddedPkg: add missing newline at end of TemplateResetSystemLib.inf

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoBaseTools: add missing newlines at end of files
Leif Lindholm [Wed, 18 Sep 2019 08:22:15 +0000 (09:22 +0100)]
BaseTools: add missing newlines at end of files

Some scripts in Source/Python were missing newlines at end of files,
so add them.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoBaseTools: Fix GenMake multi-workspace failure
Kubacki, Michael A [Tue, 1 Oct 2019 22:57:56 +0000 (06:57 +0800)]
BaseTools: Fix GenMake multi-workspace failure

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

Commit 0075ab2cec introduced an issue that causes an exception
when multiple workspace packages paths are specified. For example,
if edk2-platforms is used, the root directory will contain an edk
and edk2-platforms directory representing the respective
repositories.

In GenMake, the path to the package DEC file for a module is
discovered by getting the relative path of the INF to the
workspace root directory. Each directory in the relative path
is incrementally joined to the WORKSPACE directory. The file
list in the joined path is searched for a DEC file.

As an example, if the build command is used on a package outside
the edk2 repository, the INF file path is relative to the
edk2-platforms directory not edk2. This causes directory paths
to be built that do not exist. Commit 0075ab2cec replaced the
os.path.exists() call with a try except block that always fails
when os.listdir() is invoked to enumerate the list of files in
the built directory path on packages outside edk2.

This commit restores the original conditional statement which
avoids calling os.listdir() with an invalid directory path.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoBaseTools: use stdint.h for GCC ProcessorBind.h typedefs
Leif Lindholm [Thu, 26 Sep 2019 19:28:18 +0000 (20:28 +0100)]
BaseTools: use stdint.h for GCC ProcessorBind.h typedefs

The AArch64 definitions of UINT64/INT64 differ from the X64 ones.
Since this is on the tool side, doing like X64 and picking the
definitions from stdint.h feels like a better idea than hardcoding
them. So copy the pattern from X64/ProcessorBind.h.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg: Enable/Disable S3BootScript dynamically.
Chasel Chiu [Wed, 4 Sep 2019 00:43:22 +0000 (08:43 +0800)]
MdeModulePkg: Enable/Disable S3BootScript dynamically.

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

In binary model the same binary may have to support both
S3 enabled and disabled scenarios, however not all DXE
drivers linking PiDxeS3BootScriptLib can return error to
invoke library DESTRUCTOR for releasing resource.

To support this usage model below PCD is used to skip
S3BootScript functions when PCD set to FALSE:
  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable

Test: Verified on internal platform and S3BootScript
      functions can be skipped by PCD during boot time.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
4 years agoBaseTools/LzmaCompress: Fix the option "d" dictionary size
Zhang, Shenglei [Mon, 30 Sep 2019 03:52:28 +0000 (11:52 +0800)]
BaseTools/LzmaCompress: Fix the option "d" dictionary size

The range of dictionary size is set from [0,30] to [0,27].
And update the help information for this.
The previous logic for processing the parameter dict size is incorrect.
Now fix the logic.
The option "d" is added at 6b80310f34199d1f62e45e40fa902734735091fa.
(https://bugzilla.tianocore.org/show_bug.cgi?id=2077)

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/ScsiDiskDxe: Support Storage Security Command Protocol
Zurcher, Christopher J [Fri, 27 Sep 2019 02:20:00 +0000 (10:20 +0800)]
MdeModulePkg/ScsiDiskDxe: Support Storage Security Command Protocol

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

This patch implements the EFI_STORAGE_SECURITY_COMMAND_PROTOCOL in the
ScsiDiskDxe driver.

Support is currently limited to the RPMB Well-known LUN for UFS devices.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/ScsiBusDxe: Clean up Peripheral Type check
Zurcher, Christopher J [Fri, 27 Sep 2019 02:19:59 +0000 (10:19 +0800)]
MdeModulePkg/ScsiBusDxe: Clean up Peripheral Type check

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

Replacing "magic numbers" in the Peripheral Type check with defines for
the reserved range from IndustryStandard/Scsi.h

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/UfsPassThruDxe: Check for RPMB W-LUN (SecurityLun)
Zurcher, Christopher J [Fri, 27 Sep 2019 02:19:58 +0000 (10:19 +0800)]
MdeModulePkg/UfsPassThruDxe: Check for RPMB W-LUN (SecurityLun)

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

Currently UfsPassThru only checks for 8 common LUNs. This adds a check
for the RPMB Well-known LUN and sets the corresponding bit-mask. Further
handling of the WLUN is already present in the driver.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdePkg: Implement SCSI commands for Security Protocol In/Out
Zurcher, Christopher J [Fri, 27 Sep 2019 02:19:57 +0000 (10:19 +0800)]
MdePkg: Implement SCSI commands for Security Protocol In/Out

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

This patch implements the Security Protocol In and Security Protocol Out
commands in UefiScsiLib to prepare support for the Storage Security
Command Protocol.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Fix the lib order in static_library_files.lst
Feng, Bob C [Fri, 27 Sep 2019 11:35:23 +0000 (19:35 +0800)]
BaseTools: Fix the lib order in static_library_files.lst

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

This patch is going to fix the lib order in static_library_files.lst.
This issue is introduced by commit 673d09a2dd.
Before 673d09a2dd, build tool apply build rule for the module's library
firstly and then apply build rule for module itself. Now, build tool
apply build rule for module self and then for its library. That behavior
impact the lib order in static_library_files.lst.

This patch is to call module's LibraryAutoGenList function
explicitly, where the applying build rule action for
library is triggered.

Cc: Liming Gao <liming.gao@intel.com>
Cc: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Tested-by: dann frazier <dann.frazier@canonical.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg/SdMmcPciHcDxe: Fix SdMmcMmcLegacy bus timing handling
Albecki, Mateusz [Thu, 26 Sep 2019 14:27:44 +0000 (22:27 +0800)]
MdeModulePkg/SdMmcPciHcDxe: Fix SdMmcMmcLegacy bus timing handling

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

There is a bug in current driver code that makes
it impossible for it to work with devices that
only work in legacy speed mode since the function
EmmcSwitchToHighSpeed will return with EFI_INVALID_PARAMETER
for such bus mode. Since the logic in that function will
work well for SdMmcMmcLegacy this patch just allows
to call this function with SdMmcMmcLegacy bus mode.

Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Tested-by: Hao A Wu <hao.a.wu@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
4 years agoMdeModulePkg/SdMmcPciHcDxe: Fix bus timing switch sequence
Albecki, Mateusz [Thu, 26 Sep 2019 14:27:43 +0000 (22:27 +0800)]
MdeModulePkg/SdMmcPciHcDxe: Fix bus timing switch sequence

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

SD specification recommends switching card bus timing before
switching bus timing in controller. Emmc driver used to do
this switch other way around. This commit adds controller
timing switch in EmmcSwitchBusTiming function to enforce this
order and removes all controller timing programming from
EmmcSwitchToXXX functions.

Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Tested-by: Hao A Wu <hao.a.wu@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
4 years agoMdeModulePkg/SdMmcPciHcDxe: Remove clock stop from HS200 switch
Albecki, Mateusz [Thu, 26 Sep 2019 14:27:42 +0000 (22:27 +0800)]
MdeModulePkg/SdMmcPciHcDxe: Remove clock stop from HS200 switch

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

Stopping the SD clock before switching host controller
bus timing is only necessary if preset value enable is
set in host controller. Code that performs switch to
HS200 doesn't check this condition right now and we also
don't do the SD clock stop before any other bus timing switch
in host controller. Since the driver is generally not ready to support
host controller with preset value enable set we removed this
code.

Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Tested-by: Hao A Wu <hao.a.wu@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
4 years agoMdeModulePkg/TerminalDxe: Enhance the arrow keys support
Gao, Zhichao [Fri, 27 Sep 2019 01:08:31 +0000 (09:08 +0800)]
MdeModulePkg/TerminalDxe: Enhance the arrow keys support

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

First previous patch remove the VT100Plus's arrow keys' support.
Add it back.

The arrow keys would send ESC [A through to ESC [D. Add this
support for the new introduced terminal type.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoBaseTools:"--exclude" don't apply if parameter ends with separator
Fan, ZhijuX [Thu, 19 Sep 2019 07:45:28 +0000 (15:45 +0800)]
BaseTools:"--exclude" don't apply if parameter ends with separator

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

FormatDosFiles.py Intel\ServerSiliconPkg --exclude Library\SimRegisters\

Its parameter "Library\SimRegisters\" ends with '\'
but I can't seem to get it to exclude the SimRegisters directory

This patch is going to fix this issue

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
4 years agoUefiCpuPkg/CpuDxe: clean up PAGE_TABLE_LIB_PAGING_CONTEXT usage.
Dong, Eric [Thu, 12 Sep 2019 05:22:18 +0000 (13:22 +0800)]
UefiCpuPkg/CpuDxe: clean up PAGE_TABLE_LIB_PAGING_CONTEXT usage.

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

Current implementation not checks system mode before using
PAGE_TABLE_LIB_PAGING_CONTEXT.ContextData.X64 or
PAGE_TABLE_LIB_PAGING_CONTEXT.ContextData.Ia32. This patch check the
mode before using the correct one.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoMdePkg Base.h: Define STATIC_ASSERT macro as empty for EBC arch
Liming Gao [Tue, 24 Sep 2019 15:04:33 +0000 (23:04 +0800)]
MdePkg Base.h: Define STATIC_ASSERT macro as empty for EBC arch

EBC compiler doesn't support C11 static_assert macro.
So, define STATIC_ASSERT as empty to pass EBC arch build.
STATIC_ASSERT macro is introduced @204ae9da230ecbf0910c21acac7aa5d5e8cbb8d0

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
4 years agoMdeModulePkg: Add missing sourceX for Blt
Gris87 [Mon, 16 Sep 2019 14:21:47 +0000 (22:21 +0800)]
MdeModulePkg: Add missing sourceX for Blt

There is no sourceX offset in case when
Configure->PixelFormat == PixelBlueGreenRedReserved8BitPerColor.
We are copying most left pixels instead of copying required rectangle.

Signed-off-by: Gris87 <Gris87@yandex.ru>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Tested-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoShellPkg: Unload image on EFI_SECURITY_VIOLATION
Dandan Bi [Wed, 4 Sep 2019 07:41:19 +0000 (15:41 +0800)]
ShellPkg: Unload image on EFI_SECURITY_VIOLATION

For the LoadImage() boot service, with EFI_SECURITY_VIOLATION retval,
the Image was loaded and an ImageHandle was created with a valid
EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now.
This follows UEFI Spec.

But if the caller of LoadImage() doesn't have the option to defer
the execution of an image, we can not treat EFI_SECURITY_VIOLATION
like any other LoadImage() error, we should unload image for the
EFI_SECURITY_VIOLATION to avoid resource leak.

This patch is to do error handling for EFI_SECURITY_VIOLATION explicitly
for the callers in ShellPkg which don't have the policy to defer the
execution of the image.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Philippe Mathieu-Daude <philmd@redhat.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1992
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg/PlatformDriOverride: Unload image on EFI_SECURITY_VIOLATION
Dandan Bi [Thu, 5 Sep 2019 07:08:26 +0000 (15:08 +0800)]
MdeModulePkg/PlatformDriOverride: Unload image on EFI_SECURITY_VIOLATION

For the LoadImage() boot service, with EFI_SECURITY_VIOLATION retval,
the Image was loaded and an ImageHandle was created with a valid
EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now.
This follows UEFI Spec.

But if the caller of LoadImage() doesn't have the option to defer
the execution of an image, we can not treat EFI_SECURITY_VIOLATION
like any other LoadImage() error, we should unload image for the
EFI_SECURITY_VIOLATION to avoid resource leak.

This patch is to do error handling for EFI_SECURITY_VIOLATION explicitly
for the caller in PlatformDriOverrideDxe which don't have the policy to
defer the execution of the image.

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>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Philippe Mathieu-Daude <philmd@redhat.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1992
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg/UefiBootManager: Unload image on EFI_SECURITY_VIOLATION
Dandan Bi [Thu, 5 Sep 2019 07:06:13 +0000 (15:06 +0800)]
MdeModulePkg/UefiBootManager: Unload image on EFI_SECURITY_VIOLATION

For the LoadImage() boot service, with EFI_SECURITY_VIOLATION retval,
the Image was loaded and an ImageHandle was created with a valid
EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now.
This follows UEFI Spec.

But if the caller of LoadImage() doesn't have the option to defer
the execution of an image, we can not treat EFI_SECURITY_VIOLATION
like any other LoadImage() error, we should unload image for the
EFI_SECURITY_VIOLATION to avoid resource leak.

This patch is to do error handling for EFI_SECURITY_VIOLATION explicitly
for the callers in UefiBootManagerLib which don't have the policy to defer
the execution of the image.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Philippe Mathieu-Daude <philmd@redhat.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1992
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg/DxeCapsuleLibFmp: Unload image on EFI_SECURITY_VIOLATION
Dandan Bi [Thu, 5 Sep 2019 07:05:15 +0000 (15:05 +0800)]
MdeModulePkg/DxeCapsuleLibFmp: Unload image on EFI_SECURITY_VIOLATION

For the LoadImage() boot service, with EFI_SECURITY_VIOLATION retval,
the Image was loaded and an ImageHandle was created with a valid
EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now.
This follows UEFI Spec.

But if the caller of LoadImage() doesn't have the option to defer
the execution of an image, we can not treat EFI_SECURITY_VIOLATION
like any other LoadImage() error, we should unload image for the
EFI_SECURITY_VIOLATION to avoid resource leak.

This patch is to do error handling for EFI_SECURITY_VIOLATION explicitly
for the callers in DxeCapsuleLibFmp which don't have the policy to defer
the execution of the image.

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>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Philippe Mathieu-Daude <philmd@redhat.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1992
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoEmbeddedPkg: Unload image on EFI_SECURITY_VIOLATION
Dandan Bi [Tue, 3 Sep 2019 07:58:40 +0000 (15:58 +0800)]
EmbeddedPkg: Unload image on EFI_SECURITY_VIOLATION

For the LoadImage() boot service, with EFI_SECURITY_VIOLATION retval,
the Image was loaded and an ImageHandle was created with a valid
EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now.
This follows UEFI Spec.

But if the caller of LoadImage() doesn't have the option to defer
the execution of an image, we can not treat EFI_SECURITY_VIOLATION
like any other LoadImage() error, we should unload image for the
EFI_SECURITY_VIOLATION to avoid resource leak.

This patch is to do error handling for EFI_SECURITY_VIOLATION explicitly
for the callers in EmbeddedPkg which don't have the policy to defer the
execution of the image.

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Philippe Mathieu-Daude <philmd@redhat.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1992
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg/BM_UI: Add the new terminal types to related menu
Zhichao Gao [Fri, 6 Sep 2019 08:44:40 +0000 (16:44 +0800)]
MdeModulePkg/BM_UI: Add the new terminal types to related menu

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

Add the new introduced terminal types to related setup menu to change
the terminal type from setup. Most platforms would have its own
configure setup menu and they need to change it to support these.
The new introduced terminal types are Linux, XtermR6, VT400 and SCO.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
4 years agoMdeModulePkg/TerminalDxe: Extend the terminal console support types
Zhichao Gao [Fri, 6 Sep 2019 07:38:00 +0000 (15:38 +0800)]
MdeModulePkg/TerminalDxe: Extend the terminal console support types

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

Extend the support types of terminal console driver. New added types
are Linux, XtermR6, VT400 and SCO.

Refer to
https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-funkeys

Add the missing VT100+ function keys map.

Add F1-F12 function keys map for Linux, XtermR6, VT400 and SCO.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoMdeModulePkg: Extend the support keyboard type of Terminal console
Zhichao Gao [Fri, 6 Sep 2019 02:05:36 +0000 (10:05 +0800)]
MdeModulePkg: Extend the support keyboard type of Terminal console

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

A common terminal console software Putty support various types of
keyboard type, such as normal mode, Linux mode, Xterm R6, Vt400,
VT100+ and SCO. Refer to the link:
https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-funkeys

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoBaseTools: init DependencyHeaderFileSet for each MakeFile class
Feng, Bob C [Wed, 18 Sep 2019 06:54:34 +0000 (14:54 +0800)]
BaseTools: init DependencyHeaderFileSet for each MakeFile class

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

This patch is going to fix a regression issue that
build breaks when the custom makefile exist.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Steven Shi <steven.shi@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoAdd VS2019 Support on ToolSetup Batches
Cheng, Ching JenX [Thu, 19 Sep 2019 08:52:26 +0000 (16:52 +0800)]
Add VS2019 Support on ToolSetup Batches

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

Inorder to support VS2019, we add VS2019 config process
in Setup Batch Files,
Because VS2019 and VS2017 could using same vswhere.exe
to detect the InstallationPath,
So we add the -version as the parameter of vswhere
to get the correct VS2017/VS2019's InstallationPath

v3: In BaseTools\set_vsprefix_envs.bat,
    move WINSDK10_PREFIX setting into VCToolsInstallDir check condition.

Cc: Amy Chan <amy.chan@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Ching JenX Cheng <ching.jenx.cheng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
4 years agoAdd VS2019 Toolchain def
Cheng, Ching JenX [Thu, 19 Sep 2019 08:52:25 +0000 (16:52 +0800)]
Add VS2019 Toolchain def

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

In order to support VS2019,
the first thing need to do is add 2019 toolchain on tools_def.template

v2: add ARM/AARCH64/EBC Definitions, Combine VS2017_HOST and VS2019_HOST to VS_HOST

Cc: Amy Chan <amy.chan@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Ching JenX Cheng <ching.jenx.cheng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
4 years agoBaseTools/LzmaCompress: Add two switches
Zhang, Shenglei [Tue, 17 Sep 2019 05:59:05 +0000 (13:59 +0800)]
BaseTools/LzmaCompress: Add two switches

As is requested in the BZ 2077, add two switches to support setting
compression mode and dictionary size.
(https://bugzilla.tianocore.org/show_bug.cgi?id=2077)

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 agoRevert "BaseTools: Improve GetDependencyList function"
Liming Gao [Fri, 20 Sep 2019 06:00:12 +0000 (14:00 +0800)]
Revert "BaseTools: Improve GetDependencyList function"

This reverts commit bc9e4194cf3edaf9524c83098ba3f72008c70190.
This change causes the dependent header files are missing in Makefile.
It makes the incremental build not work. So, revert this change.

Cc: Bob Feng<bob.c.feng@Intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng<bob.c.feng@Intel.com>
4 years agoUefiCpuPkg/CpuExceptionHandlerLib: Fix split lock
John E Lofgren [Wed, 18 Sep 2019 15:43:23 +0000 (23:43 +0800)]
UefiCpuPkg/CpuExceptionHandlerLib: Fix split lock

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

v4:
The v3 posting didn't do what it promised to do, so do it now for real.

V3 changes:
change to mov instruction (non locking instuction) instead
of xchg to simplify design.

V2 changes:
Add xchg 16 bit instructions to handle sgdt and sidt base
63:48 bits and 47:32 bits.
Add comment to explain why xchg 64bit isnt being used

Split lock happens when a locking instruction is used on mis-aligned data
that crosses two cachelines. If close source platform enables Alignment
Check Exception(#AC), They can hit a double fault due to split lock being
in CpuExceptionHandlerLib.

sigt and sgdt saves 10 bytes to memory, 8 bytes is base and 2 bytes is limit.
The data is mis-aligned, can cross two cacheline, and a xchg
instruction(locking instuction) is being utilize.

Signed-off-by: John E Lofgren <john.e.lofgren@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg: Fix potential spinLock issue in SmmStartupThisAp
Damian Nikodem [Wed, 11 Sep 2019 08:23:01 +0000 (16:23 +0800)]
UefiCpuPkg: Fix potential spinLock issue in SmmStartupThisAp

Due to needs a tackling the deficiency of the AP API, it's necessary to
ensure that in non-blocking mode previous AP executed command is
finished before starting new one.

To remedy above:
  1) execute AcquireSpinLock instead AcquireSpinLockOrFail - this will
     ensure time "window" to eliminate potential race condition between
     BSP and AP spinLock release in non-blocking mode.
     This also will eliminate possibility to start executing new AP
     function before last is finished.
  2) remove returns EFI_STATUS - EFI_NOT_READY - in new scenario returned
     status is not necessary to caller.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Krzysztof Rusocki <krzysztof.rusocki@intel.com>
4 years agoMaintainers.txt update for ShellPkg
Carsey, Jaben [Wed, 21 Aug 2019 20:40:13 +0000 (04:40 +0800)]
Maintainers.txt update for ShellPkg

removing myself from maintainer
promoting Zhichao

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <Zhichao.gao@intel.com>
Cc: Mike Kinney <michael.d.kinney@intel.com>
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoMaintainers.txt: Unify one maintainer name
Jian J Wang [Thu, 19 Sep 2019 02:29:20 +0000 (10:29 +0800)]
Maintainers.txt: Unify one maintainer name

Update all occurrences of "Jian Wang" to be "Jian J Wang".

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoBaseTools:Fix the issue that build report failed
Fan, ZhijuX [Thu, 19 Sep 2019 09:04:29 +0000 (17:04 +0800)]
BaseTools:Fix the issue that build report failed

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

An error occurs using special VpdPcd that is not used in the Inf file

In dsc:
[PcdsDynamicExVpd.common.DEFAULT]
gBoardModuleTokenSpaceGuid.test1|*|{CODE({
  {0x0}  // terminator
})}

In dec:
[PcdsDynamicEx]
# Vpd GPIO table
  gBoardModuleTokenSpaceGuid.test1|{0}|GPIO_INIT_CONFIG[]|0x50000018 {
  <HeaderFiles>
    Library/GpioLib.h
  <Packages>
    MdePkg/MdePkg.dec
}
ValueError: invalid literal for int() with base 0: '*'

This Patch is going to fix issue

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoEmulatorPkg/TimerLib: Add missing GetTimeInNanoSecond function
Michael Johnson [Wed, 12 Jun 2019 22:59:08 +0000 (15:59 -0700)]
EmulatorPkg/TimerLib: Add missing GetTimeInNanoSecond function

Add GetTimeInNanoSecond, already declared in the TimerLib API,
to EmulatorPkg implementations of TimerLib.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael Johnson <michael.johnson@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoUefiCpuPkg: Remove PcdCpuSmmStaticPageTable
Ray Ni [Sun, 25 Aug 2019 22:42:05 +0000 (06:42 +0800)]
UefiCpuPkg: Remove PcdCpuSmmStaticPageTable

PcdCpuSmmRestrictedMemoryAccess is introduced to replace
PcdCpuSmmStaticPageTable.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoBaseTools: Add more parameter checking for CopyFileOnChange()
Steven Shi [Wed, 18 Sep 2019 03:21:09 +0000 (11:21 +0800)]
BaseTools: Add more parameter checking for CopyFileOnChange()

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

The current CopyFileOnChange() method in Misc.py does not
accept the input SrcFile parameter as a dir, but the method
does not check the SrcFile is dir or not. This patch is to
add more input parameter type checking and error message output
for method CopyFileOnChange.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Steven Shi <steven.shi@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoStandaloneMmPkg: make package .DSC file build again
Ard Biesheuvel [Fri, 13 Sep 2019 19:02:42 +0000 (20:02 +0100)]
StandaloneMmPkg: make package .DSC file build again

The StandaloneMmPkg .DSC file went out of sync with the changes
applied to the package when I enabled this code on the Synquacer
platform in edk2-platforms. So apply the necessary changes to make
this package build in isolation.

Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4 years agoMdeModulePkg SerialDxe.inf: Fix wrong FILE_GUID format
Liming Gao [Tue, 17 Sep 2019 06:45:15 +0000 (14:45 +0800)]
MdeModulePkg SerialDxe.inf: Fix wrong FILE_GUID format

Fix regression issue caused by 0d85e67714e31e0dbe4241ab2ebb7c423aba174d

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoBaseTools:Remove the unnecessary operation of renaming a file.
Feng, Bob C [Wed, 4 Sep 2019 05:09:00 +0000 (13:09 +0800)]
BaseTools:Remove the unnecessary operation of renaming a file.

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

This patch is going to remove rename call to reduce unnecessary
io operation so that saving build time.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: remove unnecessary calls of os.exist
Feng, Bob C [Wed, 4 Sep 2019 05:00:37 +0000 (13:00 +0800)]
BaseTools: remove unnecessary calls of os.exist

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

This patch is going to remove unnecessary calls
of os.exist()

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: Improve GetDependencyList function
Feng, Bob C [Wed, 28 Aug 2019 08:56:11 +0000 (16:56 +0800)]
BaseTools: Improve GetDependencyList function

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

GetDependencyList get the header file via
re.findall in the whole header file.

This patch is to pre-process the header file and
to feed the shorter string to re.findall.

This patch is to improve GetDependencyList() efficiency

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools:change some incorrect parameter defaults
Fan, ZhijuX [Thu, 12 Sep 2019 08:18:27 +0000 (16:18 +0800)]
BaseTools:change some incorrect parameter defaults

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

for Dict={},There are pitfalls in the way this default parameter is set
and Dict is not used in functions, other functions have these two cases,
I will change some incorrect parameter defaults

This patch is going to fix this issue

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoBaseTools:Replace PlatformInfo with PlatformAutoGen for Moudle
Fan, ZhijuX [Thu, 12 Sep 2019 08:18:58 +0000 (16:18 +0800)]
BaseTools:Replace PlatformInfo with PlatformAutoGen for Moudle

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

build -p MdeModulePkg\MdeModulePkg.dsc -a IA32 -m
MdeModulePkg\Universal\PCD\Pei\Pcd.inf

Error:
AttributeError: 'PlatformInfo' object has no attribute
'DynamicPcdList'

The DSC data object used to build a separate module today
is PlatformInfo rather than PlatformAutoGen
'PlatformAutoGen' object has attribute 'DynamicPcdList'

This patch is going to fixed this issue

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoMdePkg: UefiLib: Add a function to check if a language is supported
Tom Zhao [Tue, 20 Aug 2019 14:08:43 +0000 (15:08 +0100)]
MdePkg: UefiLib: Add a function to check if a language is supported

Add a function that checks if a target language is in the supported
languages list. Add some calls to this function where appropriate in
UefiLib.c

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Tom Zhao <tzhao@solarflare.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>