]> git.proxmox.com Git - mirror_edk2.git/commit
ShellPkg/ShellLib: Fix dynamic command fails to start during boot
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 28 Nov 2017 11:38:39 +0000 (19:38 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 29 Nov 2017 02:31:54 +0000 (10:31 +0800)
commit68b07ebae5d7c4124ff7b2a8d35e2f8b6cda18b8
tree38b06fefffc3f8d73b540061fb9efe0ec70ffc1a
parent0c83ac57f5c236a70766673ada65fff6b78596d6
ShellPkg/ShellLib: Fix dynamic command fails to start during boot

The previous change in ShellLib: "commit
3d29f8c5e361525a0d2accfa7f5bb0a7210b8927
* ShellPkg/ShellLib: Constructor doesn't depend on ShellParameters"
resolved the issue when loading dynamic command driver from Shell
environment.
But when dynamic command driver is built into FV and started during
boot, the driver still fails to start because Shell protocol doesn't
exist at that time.

The patch changes ShellLib to:
1. Do not look for Shell and ShellParameters protocol when they are
   non-NULL in ShellLibConstructorWorker();
   The two protocols are assumed to be set by DynamicCommand.Handler.
   When ShellInitialize() is called in DynamicCommand.Handler, this
   change can prevent the two protocols to be changed to NULL by
   the locating logic.
2. Do not reset the Shell and ShellParameters protocol to NULL in
   ShellLibDestructor() when CloseProtocol() fails;
   Dynamic command driver needs to set the PcdShellLibAutoInitialize
   to FALSE in order to skip the constructor.
   Current logic calls ShellLibDestructor() when the PCD is FALSE when
   ShellInitialize() is called. The change prevent the two protocols
   to be changed to NULL.

The two changes don't impact existing usage case so they are backward
compatible.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
ShellPkg/Library/UefiShellLib/UefiShellLib.c