Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quiet and fast boot #204

Open
wants to merge 19 commits into
base: dasharo
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c149537
MdeModulePkg/BootMaintenanceManagerUiLib: Add quiet and fast boot opt…
miczyg1 Jan 15, 2025
33bae05
DasharoModulePkg/DasharoVariablesLib: Add quiet and fast boot variables
miczyg1 Jan 15, 2025
60b8921
Handle quiet and fast boot
miczyg1 Jan 17, 2025
7989b82
DasharoModulePkg/DasharoBootPolicies: Create Fast Boot policy
miczyg1 Jan 28, 2025
c0803e3
DasharoPayloadPkg: Do not run CrScreenshotDxe on fast boot path
miczyg1 Jan 28, 2025
2192542
DasharoModulePkg/DasharoBootPolicies: Use console on demand with fast…
miczyg1 Jan 28, 2025
2158fb8
MdeModulePkg/Bus/Isa/Ps2KeyboardDxe: Don't do extended verification o…
miczyg1 Jan 28, 2025
235b801
DasharoModulePkg/DasharoBootPolicies: Use fast PS/2 detection on fast…
miczyg1 Jan 28, 2025
42daac4
DasharoPayloadPkg/PlatformBootManagerLib: Do not register iPXE boot o…
miczyg1 Jan 28, 2025
0b8a181
DasharoPayloadPkg/PciPlatformDxe: Load VGA ROMs only on fast boot
miczyg1 Jan 28, 2025
14a988b
FSDrivers: Do not load FS drivers on fast boot path
miczyg1 Jan 28, 2025
3e54b39
MdePkg/Include/IndustryStandard/Pci22.h: Add macro for mass storage c…
miczyg1 Jan 28, 2025
58bb388
PlatformBootManagerLib: Connect drivers to mass storage only on fast …
miczyg1 Jan 28, 2025
0331f86
DasharoPayloadPkg/PlatformBootManagerLib: Skip PS/2 detection of fast…
miczyg1 Jan 28, 2025
204b9ab
Dasharo: Treat FUM boot as non-fast boot
miczyg1 Jan 28, 2025
435efc9
DasharoPayloadPkg/DasharoPayloadPkg.fdf: Do not load LAN ROM on fast …
miczyg1 Jan 28, 2025
83d5000
MdeModulePkg/Bus/Isa/Ps2KeyboardDxe: Perform minimal i8042 controller…
miczyg1 Feb 17, 2025
9148023
MdeModulePkg/Bus/Isa/Ps2KeyboardDxe: Lower the PS/2 KBD detection tim…
miczyg1 Feb 17, 2025
b35b28d
DasharoPayloadPKg/PlatformBootManagerLib: Improve PS/2 KBD detection
miczyg1 Feb 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion DasharoModulePkg/DasharoBootPolicies/BootPolicies.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ USB_STACK_POLICY_PROTOCOL mUsbStackPolicy;
USB_MASS_STORAGE_POLICY_PROTOCOL mUsbMassStoragePolicy;
PS2_CONTROLLER_POLICY_PROTOCOL mPs2ControllerPolicy;
SERIAL_REDIRECTION_POLICY_PROTOCOL mSerialRedirectionPolicy;
FAST_BOOT_POLICY_PROTOCOL mFastBootPolicy;

/**
Entry point for the Boot Policies Driver.
Expand All @@ -41,6 +42,7 @@ InitializeBootPolicies (
EFI_STATUS Status = EFI_SUCCESS;
BOOLEAN *EfiVar;
UINTN VarSize = sizeof(BOOLEAN);
BOOLEAN FUMEnabled;

gBS = SystemTable->BootServices;
gRT = SystemTable->RuntimeServices;
Expand All @@ -53,8 +55,10 @@ InitializeBootPolicies (
mUsbMassStoragePolicy.UsbMassStorageEnabled = TRUE;
mPs2ControllerPolicy.Revision = PS2_CONTROLLER_POLICY_PROTOCOL_REVISION_01;
mPs2ControllerPolicy.Ps2ControllerEnabled = TRUE;
mSerialRedirectionPolicy.Revision = PS2_CONTROLLER_POLICY_PROTOCOL_REVISION_01;
mSerialRedirectionPolicy.Revision = SERIAL_REDIRECTION_POLICY_PROTOCOL_REVISION_01;
mSerialRedirectionPolicy.SerialRedirectionEnabled = FALSE;
mFastBootPolicy.Revision = FAST_BOOT_POLICY_PROTOCOL_REVISION_01;
mFastBootPolicy.FastBootEnabled = FALSE;

Status = GetVariable2 (
DASHARO_VAR_NETWORK_BOOT,
Expand Down Expand Up @@ -189,5 +193,45 @@ InitializeBootPolicies (
DEBUG ((EFI_D_INFO, "Boot Policy: Enabling Serial Redirection\n"));
}

VarSize = sizeof (FUMEnabled);

Status = GetVariable2 (
DASHARO_VAR_FIRMWARE_UPDATE_MODE,
&gDasharoSystemFeaturesGuid,
(VOID **) &EfiVar,
&VarSize
);

if (EFI_ERROR(Status) || VarSize != sizeof(FUMEnabled)) {
FUMEnabled = FALSE;
} else {
FUMEnabled = *EfiVar;
}

VarSize = sizeof(BOOLEAN);
Status = GetVariable2(
DASHARO_VAR_FAST_BOOT,
&gDasharoSystemFeaturesGuid,
(VOID **) &EfiVar,
&VarSize
);
if (EFI_ERROR (Status))
mFastBootPolicy.FastBootEnabled = FALSE;
else if (!EFI_ERROR (Status) && (VarSize == sizeof(*EfiVar)))
mFastBootPolicy.FastBootEnabled = *EfiVar;

if (mFastBootPolicy.FastBootEnabled && !FUMEnabled) {
PcdSetBoolS(PcdConInConnectOnDemand, TRUE);
PcdSetBoolS(PcdFastPS2Detection, TRUE);

gBS->InstallMultipleProtocolInterfaces (
&ImageHandle,
&gDasharoFastBootPolicyGuid,
&mFastBootPolicy,
NULL
);
DEBUG ((EFI_D_INFO, "Boot Policy: Enabling Fast Boot\n"));
}

return EFI_SUCCESS;
}
10 changes: 10 additions & 0 deletions DasharoModulePkg/DasharoBootPolicies/BootPolicies.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved
#define DASHARO_SERIAL_REDIRECTION_POLICY_PROTOCOL_GUID \
{ 0x0cd9776f, 0xd803, 0x42b4, 0x95, 0xa4, 0xa8, 0x58, 0x46, 0x46, 0x23, 0xc9 }

#define DASHARO_FAST_BOOT_POLICY_PROTOCOL_GUID \
{ 0xb28a95e5, 0xb41f, 0x4ea1, 0xb2, 0x2a, 0xad, 0x4e, 0xdc, 0x3a, 0x77, 0x7c }

#define NETWORK_BOOT_POLICY_PROTOCOL_REVISION_01 0x01
#define USB_STACK_POLICY_PROTOCOL_REVISION_01 0x01
#define USB_MASS_STORAGE_POLICY_PROTOCOL_REVISION_01 0x01
#define PS2_CONTROLLER_POLICY_PROTOCOL_REVISION_01 0x01
#define SERIAL_REDIRECTION_POLICY_PROTOCOL_REVISION_01 0x01
#define FAST_BOOT_POLICY_PROTOCOL_REVISION_01 0x01

typedef struct _NETWORK_BOOT_POLICY_PROTOCOL {
UINT32 Revision;
Expand All @@ -57,6 +61,11 @@ typedef struct _SERIAL_REDIRECTION_POLICY_PROTOCOL {
BOOLEAN SerialRedirectionEnabled;
} SERIAL_REDIRECTION_POLICY_PROTOCOL;

typedef struct _FAST_BOOT_POLICY_PROTOCOL {
UINT32 Revision;
BOOLEAN FastBootEnabled;
} FAST_BOOT_POLICY_PROTOCOL;

//
// Extern the GUID for protocol users.
//
Expand All @@ -65,5 +74,6 @@ extern EFI_GUID gDasharoUsbDriverPolicyGuid;
extern EFI_GUID gDasharoUsbMassStoragePolicyGuid;
extern EFI_GUID gDasharoPs2ControllerPolicyGuid;
extern EFI_GUID gDasharoSerialRedirectionPolicyGuid;
extern EFI_GUID gDasharoFastBootPolicyGuid;

#endif
4 changes: 4 additions & 0 deletions DasharoModulePkg/DasharoBootPolicies/DasharoBootPolicies.inf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
DasharoModulePkg/DasharoModulePkg.dec

[LibraryClasses]
Expand All @@ -45,12 +46,15 @@
gDasharoUsbMassStoragePolicyGuid ### PROVIDES
gDasharoPs2ControllerPolicyGuid ### PROVIDES
gDasharoSerialRedirectionPolicyGuid ### PROVIDES
gDasharoFastBootPolicyGuid ### PROVIDES

[Pcd]
gDasharoSystemFeaturesTokenSpaceGuid.PcdDefaultNetworkBootEnable
gDasharoSystemFeaturesTokenSpaceGuid.PcdSerialRedirectionDefaultState
gDasharoSystemFeaturesTokenSpaceGuid.PcdSerialRedirection2DefaultState
gDasharoSystemFeaturesTokenSpaceGuid.PcdHave2ndUart
gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand
gEfiMdeModulePkgTokenSpaceGuid.PcdFastPS2Detection

[Depex]
gEfiVariableArchProtocolGuid
1 change: 1 addition & 0 deletions DasharoModulePkg/DasharoModulePkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
gDasharoUsbMassStoragePolicyGuid = { 0xd7d1a290, 0x651a, 0x4c90, { 0xbf, 0x09, 0x1b, 0x7c, 0x56, 0x7c, 0xd5, 0x9c }}
gDasharoPs2ControllerPolicyGuid = { 0x4885b96d, 0xbdf1, 0x496d, { 0xbc, 0x3d, 0x3e, 0x79, 0x57, 0x74, 0xcd, 0x40 }}
gDasharoSerialRedirectionPolicyGuid = { 0x0cd9776f, 0xd803, 0x42b4, { 0x95, 0xa4, 0xa8, 0x58, 0x46, 0x46, 0x23, 0xc9 }}
gDasharoFastBootPolicyGuid = { 0xb28a95e5, 0xb41f, 0x4ea1, { 0xb2, 0x2a, 0xad, 0x4e, 0xdc, 0x3a, 0x77, 0x7c }}

[PcdsFixedAtBuild]
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowMenu|FALSE|BOOLEAN|0x00000001
Expand Down
3 changes: 3 additions & 0 deletions DasharoModulePkg/Include/DasharoOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define DASHARO_VAR_SMBIOS_UUID L"Type1UUID"
#define DASHARO_VAR_SMBIOS_SN L"Type2SN"

#define DASHARO_VAR_QUIET_BOOT L"QuietBoot"
#define DASHARO_VAR_FAST_BOOT L"FastBoot"

//
// Constants for some of the above EFI variables which typically have a value of
// UINT8 type.
Expand Down
10 changes: 10 additions & 0 deletions DasharoModulePkg/Library/DasharoVariablesLib/DasharoVariablesLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ STATIC CONST AUTO_VARIABLE mAutoCreatedVariables[] = {
{ DASHARO_VAR_SMALL_CORE_ACTIVE_COUNT, FixedPcdGetBool (PcdShowCpuMenu) && FixedPcdGetBool (PcdShowCpuCoreDisable) },
{ DASHARO_VAR_CORE_ACTIVE_COUNT, FixedPcdGetBool (PcdShowCpuMenu) && FixedPcdGetBool (PcdShowCpuCoreDisable) },
{ DASHARO_VAR_HYPER_THREADING, FixedPcdGetBool (PcdShowCpuMenu) && FixedPcdGetBool (PcdShowCpuHyperThreading) },
{ DASHARO_VAR_QUIET_BOOT, TRUE },
{ DASHARO_VAR_FAST_BOOT, TRUE },
};

/**
Expand Down Expand Up @@ -179,6 +181,14 @@ GetVariableInfo (
} else if (StrCmp (VarName, DASHARO_VAR_HYPER_THREADING) == 0) {
Data.Boolean = FixedPcdGetBool (PcdCpuHyperThreadingDefault);
Size = sizeof (Data.Boolean);
} else if (StrCmp (VarName, DASHARO_VAR_QUIET_BOOT) == 0) {
Data.Boolean = FALSE;
Size = sizeof (Data.Boolean);
ExtraAttrs = EFI_VARIABLE_RUNTIME_ACCESS;
} else if (StrCmp (VarName, DASHARO_VAR_FAST_BOOT) == 0) {
Data.Boolean = FALSE;
Size = sizeof (Data.Boolean);
ExtraAttrs = EFI_VARIABLE_RUNTIME_ACCESS;
} else {
DEBUG ((EFI_D_ERROR, "%a(): Unknown variable: %s.\n", __FUNCTION__, VarName));
ASSERT ((0 && "No default value set for a variable."));
Expand Down
4 changes: 3 additions & 1 deletion DasharoPayloadPkg/DasharoPayloadPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,6 @@
gDasharoPayloadPkgTokenSpaceGuid.PcdSkipPs2Detect|TRUE
!endif


################################################################################
#
# Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform
Expand Down Expand Up @@ -636,6 +635,9 @@
gIntelSiliconPkgTokenSpaceGuid.PcdVTdPolicyPropertyMask|1
!endif

gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand|FALSE
gEfiMdeModulePkgTokenSpaceGuid.PcdFastPS2Detection|FALSE

[PcdsDynamicHii]
!if $(TPM_ENABLE) == TRUE
gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS
Expand Down
18 changes: 16 additions & 2 deletions DasharoPayloadPkg/DasharoPayloadPkg.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ INF SecurityPkg/Pkcs7Verify/Pkcs7VerifyDxe/Pkcs7VerifyDxe.inf
# Typically will be done per platform needs by coreboot.
#
FILE DRIVER = DEB917C0-C56A-4860-A05B-BF2F22EBB717 {
SECTION DXE_DEPEX_EXP = {gDasharoNetworkBootPolicyGuid}
SECTION DXE_DEPEX_EXP = {gDasharoNetworkBootPolicyGuid AND NOT gDasharoFastBootPolicyGuid}
SECTION PE32 = DasharoPayloadPkg/NetworkDrivers/LanRom.efi
}
!endif
Expand Down Expand Up @@ -390,7 +390,13 @@ INF RuleOverride = BINARY USE = X64 ShellBinPkg/UefiShell/UefiShell.inf
!endif
!endif

INF CrScreenshotDxe/CrScreenshotDxe.inf
# A hacky way to add gDasharoFastBootPolicyGuid to the CrScreenshotDxe depex
# without forking.
FILE DRIVER = CAB058DF-E938-4F85-8978-1F7E6AABDB96 {
SECTION DXE_DEPEX_EXP = {gEfiGraphicsOutputProtocolGuid AND gEfiSimpleTextInputExProtocolGuid AND NOT gDasharoFastBootPolicyGuid}
SECTION PE32 = CrScreenshotDxe/CrScreenshotDxe.inf
SECTION UI = "CrScreenshotDxe"
}

!if $(CAPSULE_SUPPORT) == TRUE
INF MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf
Expand Down Expand Up @@ -464,6 +470,14 @@ INF MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
}

[Rule.Common.UEFI_DRIVER.BINARY]
FILE DRIVER = $(NAMED_GUID) {
DXE_DEPEX DXE_DEPEX Optional |.depex
PE32 PE32 |.efi
UI STRING="$(MODULE_NAME)" Optional
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
}

[Rule.Common.UEFI_APPLICATION]
FILE APPLICATION = $(NAMED_GUID) {
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
Expand Down
Loading
Loading