Fast Boot feature added a few PCDs to common Dasharo modules. These
PCDs have to be defined as DynamicDefault in the platform DSC file.
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
The RegisterFvBootOption and UnregisterFvBootOption functions shared
a lot of code. Merge those two functions into a new SyncFvBootOption
which checks for file presence and registers the option accordingly or
removes it if the file does not exist or should be removed explicitly.
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
The UefiDevicePathLib from MdePkg is used everywhere, so no need
to define the same library three times in different places. Removed
redunant entries with UefiDevicePathLib.
Also the FileHandleLib seems to be used by QEMU Q35 target and is not
compiled when Shell is removed. Move it to common section with libraries.
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
When updating firmware to a build without UEFI Shell, the settings may be preserved,
including the boot options from previous firmware, which results in the non-existent
UEFI Shell still being presented as an active boot option. To avoid confusion, check
the existence of a file before registering a boot option.
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
When trying to build without EFI Shell, a build issue appears saying that
PcdAllowHttpConnections is not declared in DEC files referenced in INF files
in FDF. It occurred that NetworkPcds.dsc.inc initializes a that PCD, but
modules that use this PCD are only built and included into the image if
NETWORK_ENABLE is TRUE. As a result a PCD was defined, but not a single
module actually existed in the image to use it, i.e. use the NetworkPkg.dec
file. This bug lived silently until EFI Shell was removed, because one of the
EFI Shell module INF files included NetworkPkg.dec.
To solve this, guard the network defines with NETWORK_ENABLE, so that the
PCD is only initialized in case where network is actually enabled.
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
For NVC laptops it is required to issue KBEN command only to get
the keyboard working on coldboot paths with Windows. This commmit
will be squashed with previous commits once it is verified to work
on MSI desktops.
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
After the minimal KBC initialization is done on fast boot path, we still
need to issue KBEN command. This is a workaround for NVC EC implementation
of KBC which enables keyboard scanning on KBEN command. It has been
verified that Windows does not issue this command, os it is required to get
the keyboard working on cold boot paths on NovaCustom laptops. Verfied that
this command did not need to be issued on MSI desktops.
TEST=Boot NovaCustom V560TNX after shutdown from Windows without AC
connected and confirm the internal keyboard still works.
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Previously the PS/2 keyboard was attempted to be detected when the i8042
controller was not initialized yet. Ps2KeyboardDxe module requires the
keyboard to be added to the ConIn and the real i8042 controller and keyboard
initialization happens when the console is connected (using DriverBindingStart).
That is why checking for keyboard presence in PlatformBootManagerBeforeConsole
is too early, because the controller is not yet ready to issue commands to the
keyboard. When all consoles are connected on non-fastboot path, we can
check the keyboard presence and remove it from ConIn if it is not detected.
That way we avoid the huge delay when booting Ventoy
(https://github.com/Dasharo/dasharo-issues/issues/160), which called the
ConIn->Reset multiple times. The console reset on PS/2 keyboard is very
time-consuming.
TEST=Verify PS/2 keyboard is initialized properly on MSI Z690-A DDR4 with
Media-Tech MT122K PS/2 keyboard and NovaCustom V540TND.
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
One seconds seems a bit too excessive to detect the keyboard. Lower the
detection timeout to half a second.
TEST=Verify PS/2 keyboard is initialized properly on MSI Z690-A DDR4 with
Media-Tech MT122K PS/2 keyboard and NovaCustom V540TND.
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
On fast boot path the i8042 controller was not being initialized at all if
Windows was being booted. This resulted in the keyboard not working after
shutdown and even after reset from Windows. It only worked when the keyboard
was initialized earlier properly and no shutdown occurred. On Linux boot
path, GRUB was calling ReadKeyStroke which triggered connecting consoles and
performing a full PS/2 initialization.
On fast boot path, add minimal i8042 controller initialization without
actual keyboard initialization and extended verification. It is sufficient
for both Linux and Windows to set up the PS/2 keyboard properly.
Also move setting the FastPs2Detection PCD to the Ps2KeyboardDxe, as it
caused most of the i8042 controller initialization to be skipped. Once the
controller is initialized on module start, the extra initialization may be
skipped later on fast boot path.
TEST=PS/2 keyboard works in both Ubuntu Linux and Windows after shutdown and
restart on NovaCustom V540TND.
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Recursively connect drivers to storage devices, so that all protocols
will be installed on the storage handles.
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Use a depex file containing a NOT gDasharoFastBootPolicyGuid to
prevent loading the module if fast boot is enabled.
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>