Platform/RaspberryPi: Setup option for disabling Fast Boot

This is a fix for https://github.com/pftf/RPi4/issues/114.

Changes:
  1. Add a setup option called BootPolicy and consume the setting
     during boot to decide whether to perform or skip ConnectAll.
  2. The Default setting is set to Full discovery because it is not
     worth enabling Fast boot by default on RaspberryPi systems.
     Enabling it just saves boot time about 1 second, but caused a
     lot of issues.

Testing Done:
  - Booted to Standalone UEFI shell on SD card and use drivers
    command to check the result with Fast Boot and Full discovery
    settings. Then, child/device handles are created as expected.

Note and to-do items:
  - The root cause looks like that boot loaders and some tools like
    grub and iPXE haven't supported selective connect/Fast boot.
    However, system firmware should still provide a setup option for
    user to enable Fast boot with old version boot loaders and tools,
    which is why we proposed this change. We will also report this
    issue to boot loader and tool vendors/open source GitHubs.
  - We will add more options for connecting specific type devices so
    that we can still have the shortest boot time for all use cases.

Cc: Jeremy Linton <jeremy.linton@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Link: https://github.com/pftf/RPi4/issues/144
Link: https://github.com/pftf/RPi4/issues/114
Signed-off-by: Sunny Wang <sunny.wang@arm.com>
Acked-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
This commit is contained in:
Sunny Wang
2021-04-13 15:14:49 +08:00
committed by Ard Biesheuvel
parent 7545558886
commit efdc159ef7
10 changed files with 79 additions and 9 deletions
@@ -4,7 +4,7 @@
* Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) 2016, Linaro Ltd. All rights reserved.
* Copyright (c) 2015-2016, Red Hat, Inc.
* Copyright (c) 2014-2020, ARM Ltd. All rights reserved.
* Copyright (c) 2014-2021, ARM Ltd. All rights reserved.
* Copyright (c) 2004-2016, Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -25,10 +25,11 @@
#include <Protocol/LoadedImage.h>
#include <Guid/EventGroup.h>
#include <Guid/TtyTerm.h>
#include <ConfigVars.h>
#include "PlatformBm.h"
#define BOOT_PROMPT L"ESC (setup), F1 (shell), ENTER (boot)"
#define BOOT_PROMPT L"ESC (setup), F1 (shell), ENTER (boot)\n"
#define DP_NODE_LEN(Type) { (UINT8)sizeof (Type), (UINT8)(sizeof (Type) >> 8) }
@@ -633,6 +634,16 @@ PlatformBootManagerAfterConsole (
Print (BOOT_PROMPT);
}
//
// Connect the rest of the devices if the boot polcy is set to Full discovery
//
if (PcdGet32 (PcdBootPolicy) == FULL_DISCOVERY) {
DEBUG ((DEBUG_INFO, "Boot Policy is Full Discovery. Connect all devices\n"));
EfiBootManagerConnectAll ();
} else if (PcdGet32 (PcdBootPolicy) == FAST_BOOT) {
DEBUG ((DEBUG_INFO, "Boot Policy is Fast Boot. Skip connecting all devices\n"));
}
Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL, (VOID**)&EsrtManagement);
if (!EFI_ERROR (Status)) {
EsrtManagement->SyncEsrtFmp ();
@@ -63,6 +63,7 @@
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
gRaspberryPiTokenSpaceGuid.PcdBootPolicy
[Guids]
gEfiFileInfoGuid