Revert "Platform/RaspberryPi: Setup option for disabling Fast Boot"

This reverts commit efdc159ef7.

This commit is not longer required as Boot Discovery Policy has been
implemented for Raspberry Pi.

Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
Reviewed-by: Sunny Wang <sunny.wang@arm.com>
Reviewed-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
Tested-by: Pete Batard <pete@akeo.ie>
This commit is contained in:
Grzegorz Bernacki
2021-08-03 18:35:35 +02:00
committed by Ard Biesheuvel
parent 2e87ce84dc
commit 2f0188b56e
16 changed files with 1654 additions and 79 deletions

View File

@@ -1,6 +1,6 @@
/** @file
*
* Copyright (c) 2019 - 2021, ARM Limited. All rights reserved.
* Copyright (c) 2019 - 2020, ARM Limited. All rights reserved.
* Copyright (c) 2018 - 2020, Andrei Warkentin <andrey.warkentin@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -286,15 +286,6 @@ SetupVariables (
);
}
Size = sizeof (UINT32);
Status = gRT->GetVariable (L"BootPolicy",
&gConfigDxeFormSetGuid,
NULL, &Size, &Var32);
if (EFI_ERROR (Status)) {
Status = PcdSet32S (PcdBootPolicy, PcdGet32 (PcdBootPolicy));
ASSERT_EFI_ERROR (Status);
}
Size = sizeof (UINT32);
Status = gRT->GetVariable (L"SdIsArasan",
&gConfigDxeFormSetGuid,

View File

@@ -2,7 +2,7 @@
#
# Component description file for the RasbperryPi DXE platform config driver.
#
# Copyright (c) 2019 - 2021, ARM Limited. All rights reserved.
# Copyright (c) 2019 - 2020, ARM Limited. All rights reserved.
# Copyright (c) 2018 - 2020, Andrei Warkentin <andrey.warkentin@gmail.com>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -93,7 +93,6 @@
gRaspberryPiTokenSpaceGuid.PcdRamLimitTo3GB
gRaspberryPiTokenSpaceGuid.PcdFanOnGpio
gRaspberryPiTokenSpaceGuid.PcdFanTemp
gRaspberryPiTokenSpaceGuid.PcdBootPolicy
gRaspberryPiTokenSpaceGuid.PcdUartInUse
[Depex]

View File

@@ -1,7 +1,7 @@
/** @file
*
* Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.
* Copyright (c) 2020, ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
@@ -60,14 +60,6 @@
#string STR_ADVANCED_ASSET_TAG_PROMPT #language en-US "Asset Tag"
#string STR_ADVANCED_ASSET_TAG_HELP #language en-US "Set the system Asset Tag"
#string STR_BOOT_POLICY_PROMPT #language en-US "Boot Policy"
#string STR_BOOT_POLICY_HELP #language en-US "When Fast Boot is selected, only required devices will be discovered for reducing "
"the boot time. "
"When Full Discovery is selected, all the devices will be discovered for some "
"scenarios such as system deployment and diagnostic tests."
#string STR_FAST_BOOT #language en-US "Fast Boot"
#string STR_FULL_DISCOVERY #language en-US "Full Discovery"
/*
* MMC/SD configuration.
*/

View File

@@ -1,7 +1,7 @@
/** @file
*
* Copyright (c) 2018 Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.
* Copyright (c) 2020, ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
@@ -116,11 +116,6 @@ formset
name = DisplayEnableSShot,
guid = CONFIGDXE_FORM_SET_GUID;
efivarstore BOOT_POLICY_VARSTORE_DATA,
attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
name = BootPolicy,
guid = CONFIGDXE_FORM_SET_GUID;
form formid = 1,
title = STRING_TOKEN(STR_FORM_SET_TITLE);
subtitle text = STRING_TOKEN(STR_NULL_STRING);
@@ -195,14 +190,6 @@ formset
option text = STRING_TOKEN(STR_ADVANCED_SYSTAB_DT), value = SYSTEM_TABLE_MODE_DT, flags = DEFAULT;
endoneof;
oneof varid = BootPolicy.BootPolicy,
prompt = STRING_TOKEN(STR_BOOT_POLICY_PROMPT),
help = STRING_TOKEN(STR_BOOT_POLICY_HELP),
flags = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED,
option text = STRING_TOKEN(STR_FAST_BOOT), value = FAST_BOOT , flags = 0;
option text = STRING_TOKEN(STR_FULL_DISCOVERY), value = FULL_DISCOVERY, flags = DEFAULT;
endoneof;
#if (RPI_MODEL == 4)
grayoutif NOT ideqval SystemTableMode.Mode == SYSTEM_TABLE_MODE_ACPI;
oneof varid = FanOnGpio.Enabled,
@@ -233,7 +220,6 @@ formset
minsize = 0,
maxsize = ASSET_TAG_STR_MAX_LEN,
endstring;
endform;
form formid = 0x1003,

View File

@@ -1,7 +1,7 @@
/** @file
*
* Copyright (c) 2020, Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.
* Copyright (c) 2020, ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
@@ -143,14 +143,4 @@ typedef struct {
UINT32 EnableDma;
} MMC_EMMC_DMA_VARSTORE_DATA;
#define FAST_BOOT 0
#define FULL_DISCOVERY 1
typedef struct {
/*
* 0 - Fast Boot
* 1 - Full Discovery (Connect All)
*/
UINT32 BootPolicy;
} BOOT_POLICY_VARSTORE_DATA;
#endif /* CONFIG_VARS_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
--- Platform/RaspberryPi/Library/DualSerialPortLib/DualSerialPortLib.c
+++ Platform/RaspberryPi/Library/DualSerialPortLib/DualSerialPortLib.c
@@ -34,25 +34,16 @@ SerialPortGetDivisor (
UINT32 SerialBaudRate
)
{
- UINT64 BaseClockRate;
+ UINT32 BaseClockRate;
UINT32 Divisor;
- //
- // On the Raspberry Pi, the clock to use for the 16650-compatible UART
- // is the base clock divided by the 12.12 fixed point VPU clock divisor.
- //
- BaseClockRate = (UINT64)PcdGet32 (PcdSerialClockRate);
-#if (RPI_MODEL == 4)
- Divisor = MmioRead32(BCM2836_CM_BASE + BCM2836_CM_VPU_CLOCK_DIVISOR) & 0xFFFFFF;
- if (Divisor != 0)
- BaseClockRate = (BaseClockRate << 12) / Divisor;
-#endif
+ BaseClockRate = PcdGet32 (PcdSerialClockRate);
//
// As per the BCM2xxx datasheets:
// baudrate = system_clock_freq / (8 * (divisor + 1)).
//
- Divisor = (UINT32)BaseClockRate / (SerialBaudRate * 8);
+ Divisor = BaseClockRate / (SerialBaudRate * 8);
if (Divisor != 0) {
Divisor--;
}

View File

@@ -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-2021, ARM Ltd. All rights reserved.
* Copyright (c) 2014-2020, ARM Ltd. All rights reserved.
* Copyright (c) 2004-2016, Intel Corporation. All rights reserved.
* Copyright (c) 2021, Semihalf All rights reserved.
*
@@ -28,11 +28,10 @@
#include <Guid/BootDiscoveryPolicy.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)\n"
#define BOOT_PROMPT L"ESC (setup), F1 (shell), ENTER (boot)"
#define DP_NODE_LEN(Type) { (UINT8)sizeof (Type), (UINT8)(sizeof (Type) >> 8) }
@@ -720,16 +719,6 @@ 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 = BootDiscoveryPolicyHandler ();
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "Error applying Boot Discovery Policy:%r\n", Status));

View File

@@ -64,7 +64,6 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
gRaspberryPiTokenSpaceGuid.PcdBootPolicy
[Guids]
gBootDiscoveryPolicyMgrFormsetGuid

View File

@@ -0,0 +1,180 @@
/** @file
*
* Copyright (c) 2020, Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) 2019-2020, Pete Batard <pete@akeo.ie>
* Copyright (c) 2016, Linaro Limited. All rights reserved.
* Copyright (c) 2011-2020, ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
**/
#include <AsmMacroIoLibV8.h>
#include <Library/ArmLib.h>
#include <IndustryStandard/Bcm2836.h>
#include <IndustryStandard/RpiMbox.h>
.macro drain
mov x5, #RPI_MBOX_MAX_TRIES
0: ldr w6, [x4, #BCM2836_MBOX_STATUS_OFFSET]
tbnz w6, #BCM2836_MBOX_STATUS_EMPTY, 1f
dmb ld
ldr wzr, [x4, #BCM2836_MBOX_READ_OFFSET]
subs x5, x5, #1
b.ne 0b
1:
.endm
.macro poll, status
mov x5, #RPI_MBOX_MAX_TRIES
0: ldr w6, [x4, #BCM2836_MBOX_STATUS_OFFSET]
tbz w6, #\status, 1f
dmb ld
subs x5, x5, #1
b.ne 0b
1:
.endm
.macro run, command_buffer
adr x0, \command_buffer
orr x0, x0, #RPI_MBOX_VC_CHANNEL
add x0, x0, x1
poll BCM2836_MBOX_STATUS_FULL
str w0, [x4, #BCM2836_MBOX_WRITE_OFFSET]
dmb sy
poll BCM2836_MBOX_STATUS_EMPTY
dmb sy
ldr wzr, [x4, #BCM2836_MBOX_READ_OFFSET]
dmb ld
.endm
ASM_FUNC (ArmPlatformPeiBootAction)
mov x1, #FixedPcdGet64 (PcdDmaDeviceOffset)
orr x0, x0, #RPI_MBOX_VC_CHANNEL
// x1 holds the value of PcdDmaDeviceOffset throughout this function
MOV32 (x4, BCM2836_MBOX_BASE_ADDRESS)
drain
run .Lmeminfo_buffer
ldr w0, .Lmembase
adr x2, mSystemMemoryBase
str x0, [x2]
ldr w0, .Lmemsize
sub x0, x0, #1
adr x2, mSystemMemoryEnd
str x0, [x2]
run .Lvcinfo_buffer
ldr w0, .Lvcbase
adr x2, mVideoCoreBase
str x0, [x2]
ldr w0, .Lvcsize
adr x2, mVideoCoreSize
str x0, [x2]
run .Lrevinfo_buffer
ldr w0, .Lrevision
adr x2, mBoardRevision
str w0, [x2]
#if (RPI_MODEL == 3)
run .Lclkinfo_buffer
ldr w0, .Lfrequency
adr x2, _gPcd_BinaryPatch_PcdSerialClockRate
str w0, [x2]
#endif
ret
.align 4
.Lmeminfo_buffer:
.long .Lmeminfo_size
.long 0x0
.long RPI_MBOX_GET_ARM_MEMSIZE
.long 8 // buf size
.long 0 // input len
.Lmembase:
.long 0 // mem base
.Lmemsize:
.long 0 // mem size
.long 0 // end tag
.set .Lmeminfo_size, . - .Lmeminfo_buffer
.align 4
.Lvcinfo_buffer:
.long .Lvcinfo_size
.long 0x0
.long RPI_MBOX_GET_VC_MEMSIZE
.long 8 // buf size
.long 0 // input len
.Lvcbase:
.long 0 // videocore base
.Lvcsize:
.long 0 // videocore size
.long 0 // end tag
.set .Lvcinfo_size, . - .Lvcinfo_buffer
.align 4
.Lrevinfo_buffer:
.long .Lrevinfo_size
.long 0x0
.long RPI_MBOX_GET_BOARD_REVISION
.long 4 // buf size
.long 0 // input len
.Lrevision:
.long 0 // revision
.long 0 // end tag
.set .Lrevinfo_size, . - .Lrevinfo_buffer
#if (RPI_MODEL == 3)
.align 4
.Lclkinfo_buffer:
.long .Lclkinfo_size
.long 0x0
.long RPI_MBOX_GET_CLOCK_RATE
.long 8 // buf size
.long 4 // input len
.long 4 // clock id: 0x04 = Core/VPU
.Lfrequency:
.long 0 // frequency
.long 0 // end tag
.set .Lclkinfo_size, . - .Lclkinfo_buffer
#endif
//UINTN
//ArmPlatformGetPrimaryCoreMpId (
// VOID
// );
ASM_FUNC (ArmPlatformGetPrimaryCoreMpId)
MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore))
ret
//UINTN
//ArmPlatformIsPrimaryCore (
// IN UINTN MpId
// );
ASM_FUNC (ArmPlatformIsPrimaryCore)
mov x0, #1
ret
//UINTN
//ArmPlatformGetCorePosition (
// IN UINTN MpId
// );
// With this function: CorePos = (ClusterId * 4) + CoreId
ASM_FUNC (ArmPlatformGetCorePosition)
and x1, x0, #ARM_CORE_MASK
and x0, x0, #ARM_CLUSTER_MASK
add x0, x1, x0, LSR #6
ret
ASM_FUNCTION_REMOVE_IF_UNREFERENCED

View File

@@ -0,0 +1,32 @@
--- Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S
+++ Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S
@@ -85,13 +85,11 @@ ASM_FUNC (ArmPlatformPeiBootAction)
adr x2, mBoardRevision
str w0, [x2]
-#if (RPI_MODEL == 3)
run .Lclkinfo_buffer
ldr w0, .Lfrequency
adr x2, _gPcd_BinaryPatch_PcdSerialClockRate
str w0, [x2]
-#endif
ret
@@ -135,7 +133,6 @@ ASM_FUNC (ArmPlatformPeiBootAction)
.long 0 // end tag
.set .Lrevinfo_size, . - .Lrevinfo_buffer
-#if (RPI_MODEL == 3)
.align 4
.Lclkinfo_buffer:
.long .Lclkinfo_size
@@ -148,7 +145,6 @@ ASM_FUNC (ArmPlatformPeiBootAction)
.long 0 // frequency
.long 0 // end tag
.set .Lclkinfo_size, . - .Lclkinfo_buffer
-#endif
//UINTN
//ArmPlatformGetPrimaryCoreMpId (

View File

@@ -1,6 +1,6 @@
# @file
#
# Copyright (c) 2011 - 2021, ARM Limited. All rights reserved.
# Copyright (c) 2011 - 2020, ARM Limited. All rights reserved.
# Copyright (c) 2014, Linaro Limited. All rights reserved.
# Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
# Copyright (c) 2017 - 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
@@ -512,13 +512,6 @@
gRaspberryPiTokenSpaceGuid.PcdFanOnGpio|L"FanOnGpio"|gConfigDxeFormSetGuid|0x0|0
gRaspberryPiTokenSpaceGuid.PcdFanTemp|L"FanTemp"|gConfigDxeFormSetGuid|0x0|0
#
# Boot Policy
# 0 - Fast Boot
# 1 - Full Discovery (Connect All)
#
gRaspberryPiTokenSpaceGuid.PcdBootPolicy|L"BootPolicy"|gConfigDxeFormSetGuid|0x0|1
#
# Reset-related.
#

View File

@@ -1,6 +1,6 @@
# @file
#
# Copyright (c) 2011 - 2021, ARM Limited. All rights reserved.
# Copyright (c) 2011 - 2020, ARM Limited. All rights reserved.
# Copyright (c) 2017 - 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
# Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
# Copyright (c) 2014, Linaro Limited. All rights reserved.
@@ -528,13 +528,6 @@
gRaspberryPiTokenSpaceGuid.PcdFanOnGpio|L"FanOnGpio"|gConfigDxeFormSetGuid|0x0|0
gRaspberryPiTokenSpaceGuid.PcdFanTemp|L"FanTemp"|gConfigDxeFormSetGuid|0x0|60
#
# Boot Policy
# 0 - Fast Boot
# 1 - Full Discovery (Connect All)
#
gRaspberryPiTokenSpaceGuid.PcdBootPolicy|L"BootPolicy"|gConfigDxeFormSetGuid|0x0|1
#
# Reset-related.
#

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
--- Platform/RaspberryPi/RPi4/RPi4.dsc
+++ Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -429,7 +429,6 @@ [PcdsFixedAtBuild.common]
gArmPlatformTokenSpaceGuid.PL011UartClkInHz|48000000
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|4
- gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|1000000000
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl|0x27
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize|8
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200
@@ -465,6 +464,9 @@ [PcdsFixedAtBuild.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"EDK2"
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE
+[PcdsPatchableInModule]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|500000000
+
[PcdsDynamicHii.common.DEFAULT]
#
@@ -621,7 +623,7 @@ [Components.common]
MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
MdeModulePkg/Universal/SerialDxe/SerialDxe.inf {
<LibraryClasses>
- SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DualSerialPortLib.inf
+ SerialPortLib|Platform/RaspberryPi/Library/DualSerialPortLib/DualSerialPortDxeLib.inf
}
Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.inf
EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.inf

View File

@@ -2,7 +2,6 @@
#
# Copyright (c) 2016, Linaro, Ltd. All rights reserved.
# Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
# Copyright (c) 2021, ARM Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -71,5 +70,4 @@
gRaspberryPiTokenSpaceGuid.PcdFanTemp|0|UINT32|0x0000001D
gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|0|UINT32|0x0000001E
gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|0|UINT32|0x0000001F
gRaspberryPiTokenSpaceGuid.PcdBootPolicy|0|UINT32|0x00000020
gRaspberryPiTokenSpaceGuid.PcdUartInUse|1|UINT32|0x00000021