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

Fixes and improvements for Ampere-based platforms. Add support for ASRock boards. #260

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
deab439
Silicon/Ampere: Add PcdFirmwareVersionNumber for capsule updates
Dec 16, 2024
e51677d
Silicon/Ampere: Enable FMP capsule updates in AmpereAltraPkg.dsc.inc
Dec 16, 2024
8fa320d
Silicon/Ampere: Increase max auth variable sizes
Dec 16, 2024
a1f2a89
Platform/Ampere: Change BMC config file to bmc.conf
Dec 16, 2024
2f2fdd4
Silicon/Ampere: Check that flash size is greater than NV storage size
Dec 16, 2024
3e01ac6
Ampere: Add SHELL_ENABLE define (TRUE by default)
Dec 16, 2024
6201206
Silicon/Ampere: Set PcdFdSize to 32MB
Dec 16, 2024
f5fe911
Silicon/Ampere: Reduce PcdPlatformBootTimeOut to 5s
Dec 16, 2024
7d02fc3
Silicon/Ampere: Add the BGRT driver
Dec 16, 2024
b4c155f
Platform/ADLINK: Update SMBIOS Type17 to use JedecJep106Lib
Dec 16, 2024
4ae043a
Platform/{ADLINK,Ampere}: Rework capsule updates
Dec 16, 2024
6dfd038
Platform/Ampere: Rework buildfw.sh to support capsules and secure boot
Dec 16, 2024
c25841c
Platform/Ampere: Use full space allocated for NVRAM
Dec 16, 2024
3abeb17
Platform/ADLINK: Minor cleanups of ComHpcAltBoardSetting.cfg
Dec 16, 2024
07a417d
Silicon/Ampere: Don't use yoda conditions
Dec 16, 2024
4c28053
Platform/ADLINK: Improve MmcLib I2C brd config
Dec 16, 2024
dc90d93
Platform/ADLINK: Enable building with or without X86 emulator
Dec 16, 2024
46c06e3
Silicon/Ampere: Add LogoDxe to display logo during boot
Dec 16, 2024
42686f0
Silicon/Ampere: Add RemoveStaleFvFileOptions from OVMF
Dec 16, 2024
064149f
Silicon/Ampere: Add checks around PerformanceLib
Dec 16, 2024
9c2af49
Silicon/Ampere: Add extra 3MB for FPDT boot records
Dec 16, 2024
dce0531
Platform/ADLINK: Add BGRT driver
Dec 16, 2024
de7fcaa
Platform/ADLINK: Move FirmwarePerformancePei earlier
Dec 16, 2024
ababe4e
Platform/ADLINK: Add SecureBoot keys
Dec 16, 2024
5e964f4
Platform/ADLINK: Add boot manager drivers
Dec 16, 2024
f90ffd5
Platform/ADLINK: configure video resolution to max
Dec 16, 2024
99e10f5
Platform/Ampere: Add SecureBoot tools
Dec 16, 2024
52910cc
Silicon/Ampere: Use DxeRuntimeDebugLibSerialPort in RELEASE builds
Dec 17, 2024
0a32973
Platform/Ampere: Add macOS support to buildfw.sh
Feb 11, 2025
67bd322
Platform/ASRockRack: Add ALTRAD8UD-1L2T and ALTRAD8UD2-1L2Q platforms
Feb 11, 2025
73b18a3
Silicon/Ampere: Fix GetNumberOfSupportedSockets
Feb 11, 2025
8b8c18b
Silicon/Ampere: Check if INCLUDE_TFTP_COMMAND is TRUE
Feb 11, 2025
a4d9f29
Ampere: Rename SECURE_BOOT_ENABLE to UEFI_SECURE_BOOT_ENABLE
Feb 11, 2025
4c71b68
Silicon/Ampere: sync up with edk2 ArmPkg changes
Feb 11, 2025
ac2900d
Platform/Ampere: List the build.conf defaults in help output
Feb 11, 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
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
#include <Guid/EdkiiSystemFmpCapsule.h>
#include <Protocol/FirmwareManagement.h>

#include "HostFwInfo.h"

#define PACKAGE_VERSION 0xFFFFFFFF
#define PACKAGE_VERSION_STRING L"Unknown"

#define CURRENT_FIRMWARE_VERSION 0x7E841A00 // YearMonthDayBuild (0xYYYMDDBB)
#define CURRENT_FIRMWARE_VERSION_STRING L"2024.04.26.00"
#define LOWEST_SUPPORTED_FIRMWARE_VERSION 0x0204640C

#define IMAGE_ID SIGNATURE_64('A', 'A', 'D', 'P', '_', 'F', 'W', ' ')
#define IMAGE_ID_STRING L"ADLINK AADP System Firmware"
#define IMAGE_ID_STRING L"ADLINK AADP Host Firmware"

// PcdSystemFmpCapsuleImageTypeIdGuid
#define IMAGE_TYPE_ID_GUID { 0xcdcdd0b7, 0x8afb, 0x4883, { 0x85, 0x3a, 0xae, 0x93, 0x98, 0x07, 0x7a, 0x0e } }
Expand All @@ -35,7 +33,7 @@ typedef struct {
CHAR16 PackageVersionNameStr[sizeof(PACKAGE_VERSION_STRING)/sizeof(CHAR16)];
} IMAGE_DESCRIPTOR;

STATIC IMAGE_DESCRIPTOR mImageDescriptor =
STATIC IMAGE_DESCRIPTOR mHostImageDescriptor =
{
{
EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE,
Expand All @@ -51,15 +49,17 @@ STATIC IMAGE_DESCRIPTOR mImageDescriptor =
CURRENT_FIRMWARE_VERSION, // Version;
OFFSET_OF (IMAGE_DESCRIPTOR, VersionNameStr), // VersionName;
{0x0}, // Reserved2
0, // Size;
0xA00000, // Size;
IMAGE_ATTRIBUTE_IMAGE_UPDATABLE |
IMAGE_ATTRIBUTE_RESET_REQUIRED |
IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED |
IMAGE_ATTRIBUTE_IN_USE, // AttributesSupported;
IMAGE_ATTRIBUTE_IN_USE |
IMAGE_ATTRIBUTE_UEFI_IMAGE, // AttributesSupported;
IMAGE_ATTRIBUTE_IMAGE_UPDATABLE |
IMAGE_ATTRIBUTE_RESET_REQUIRED |
IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED |
IMAGE_ATTRIBUTE_IN_USE, // AttributesSetting;
IMAGE_ATTRIBUTE_IN_USE |
IMAGE_ATTRIBUTE_UEFI_IMAGE, // AttributesSetting;
0x0, // Compatibilities;
LOWEST_SUPPORTED_FIRMWARE_VERSION, // LowestSupportedImageVersion;
0x00000000, // LastAttemptVersion;
Expand All @@ -73,4 +73,4 @@ STATIC IMAGE_DESCRIPTOR mImageDescriptor =
PACKAGE_VERSION_STRING,
};

VOID* CONST ReferenceAcpiTable = &mImageDescriptor;
VOID* CONST ReferenceAcpiTable = &mHostImageDescriptor;
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
PeiServicesLib
PeimEntryPoint

[FixedPcd]

[Pcd]
gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
[Head]
NumOfUpdate = 1
NumOfRecovery = 0
Update0 = AADP_UEFI_TFA
Update0 = AADP_TFA_UEFI

[AADP_UEFI_TFA]
FirmwareType = 2147483650 # SystemFirmware: 0x80000002 - OEM UEFI and ARM Trusted Firmware
[AADP_TFA_UEFI]
FirmwareType = 2147483650 # SystemFirmware: 0x80000002 - ARM Trusted Firmware and OEM UEFI
AddressType = 1 # 0 - relative address, 1 - absolute address.
BaseAddress = 0x00000000 # Base address offset on flash
Length = 0x00D10000 # Length
ImageOffset = 0x00000000 # Image offset of this SystemFirmware image
FileGuid = c07b0079-b3a2-448d-8c9c-46ba3c42b33e # PcdEdkiiSystemFirmwareFileGuid
FileGuid = 074c21e5-7d17-48e9-808d-f0c85e52a7db # PcdEdkiiSystemFirmwareFileGuid
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
[Head]
NumOfUpdate = 1
NumOfRecovery = 0
Update0 = AltraSCP
Update0 = AADP_UEFI

[AltraSCP]
FirmwareType = 2147483649 # 0x80000001: SMpro/PMpro Firmware
[AADP_UEFI]
FirmwareType = 2147483651 # SystemFirmware: 0x80000003 - OEM UEFI
AddressType = 1 # 0 - relative address, 1 - absolute address.
BaseAddress = 0x00000000 # Base address offset on flash
Length = 0x00050000 # Length
Length = 0x00A10000 # Length
ImageOffset = 0x00000000 # Image offset of this SystemFirmware image
FileGuid = c07b0079-b3a2-448d-8c9c-46ba3c42b33e # PcdEdkiiSystemFirmwareFileGuid
108 changes: 70 additions & 38 deletions Platform/ADLINK/ComHpcAltPkg/ComHpcAlt.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@
DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
!endif

DEFINE FIRMWARE_VER = 2024.01.01-01
DEFINE FIRMWARE_VER = 00.01.01-00
DEFINE FIRMWARE_VER_HEX = 0x00010100
DEFINE CAPSULE_ENABLE = TRUE
DEFINE INCLUDE_TFA_FW = TRUE
DEFINE SECURE_BOOT_ENABLE = TRUE
DEFINE TPM2_ENABLE = TRUE
DEFINE SHELL_ENABLE = TRUE
DEFINE INCLUDE_TFTP_COMMAND = TRUE
DEFINE PLATFORM_CONFIG_UUID = 0690C53C-01B5-40AD-A65B-5399AC0B1E9B

Expand All @@ -73,31 +77,10 @@
DEFINE PERFORMANCE_MEASUREMENT_ENABLE = FALSE
DEFINE HEAP_GUARD_ENABLE = FALSE

# How to enable Secure Boot support
# From https://github.com/edk2-porting/edk2-rk3588/issues/69

# In case you haven't seen how we do it on the Pi, this is relatively
# easy to add during the EDK2 build process.
#
# Basically you want to first get all the needed Secure Boot certificates
# and dbx, most of which can be downloaded directly:
# https://github.com/pftf/RPi4/blob/master/.github/workflows/linux_edk2.yml#L50-L58
#
# Note that, because we sure don't want any third party (including
# ourselves) to have control over somebody else's machine when it comes
# to Secure Boot, we always generate a new PK as part of the build process and then discard the private key altogether.
#
# Then, at EDK2 build time, you just need to feed the
# -D SECURE_BOOT_ENABLE=TRUE option along with something like
# -D DEFAULT_KEYS=TRUE -D PK_DEFAULT_FILE=$WORKSPACE/keys/pk.cer
# -D KEK_DEFAULT_FILE1=$WORKSPACE/keys/ms_kek.cer
# -D DB_DEFAULT_FILE1=$WORKSPACE/keys/ms_db1.cer
# -D DB_DEFAULT_FILE2=$WORKSPACE/keys/ms_db2.cer
# -D DBX_DEFAULT_FILE1=$WORKSPACE/keys/arm64_dbx.bin:
# https://github.com/pftf/RPi4/blob/master/.github/workflows/linux_edk2.yml#L64-L65
#
# And with this, you should have a UEFI firmware that both Windows and
# Linux are happy with when it comes to Secure Boot.
!if $(CAPSULE_ENABLE) == TRUE
DEFINE UEFI_IMAGE = Build/ComHpcAlt/comhpcalt_uefi.bin
DEFINE TFA_UEFI_IMAGE = Build/ComHpcAlt/comhpcalt_tfa_uefi.bin
!endif

!include MdePkg/MdeLibs.dsc.inc

Expand All @@ -112,6 +95,7 @@
[LibraryClasses]

OemMiscLib|Platform/ADLINK/ComHpcAltPkg/Library/OemMiscLib/OemMiscLib.inf
JedecJep106Lib|MdePkg/Library/JedecJep106Lib/JedecJep106Lib.inf

#
# ACPI Libraries
Expand Down Expand Up @@ -169,6 +153,8 @@
#
gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.UseDefaultConfig|FALSE

gEfiMdeModulePkgTokenSpaceGuid.PcdSupportUpdateCapsuleReset|TRUE

[PcdsFixedAtBuild]

gAmpereTokenSpaceGuid.PcdPcieHotPlugGpioResetMap|0x3F
Expand Down Expand Up @@ -198,6 +184,17 @@

gAmpereTokenSpaceGuid.PcdSmbusI2cBusSpeed|100000

# We should support CoD in future, since it provides a nicer
# upgrade experience (e.g. a progress bar).
gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleOnDiskSupport|FALSE

!if $(SECURE_BOOT_ENABLE) == TRUE
gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer|{0}
!include Platform/ADLINK/ComHpcAltPkg/root.cer.gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer.inc
!endif

gAmpereTokenSpaceGuid.PcdFirmwareVersionNumber|$(FIRMWARE_VER_HEX)

gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode|TRUE

[PcdsFixedAtBuild.common]
Expand Down Expand Up @@ -289,8 +286,19 @@

[PcdsDynamicExDefault.common.DEFAULT]
gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor|{0x0}|VOID*|0x100
gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{0xf6, 0xc8, 0x4a, 0x70, 0x39, 0xcb, 0xb7, 0x47, 0x8f, 0x26, 0x39, 0x6c, 0xe9, 0xdb, 0x69, 0x71}
gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareFileGuid|{0x79, 0x00, 0x7b, 0xc0, 0xa2, 0xb3, 0x8d, 0x44, 0x8c, 0x9c, 0x46, 0xba, 0x3c, 0x42, 0xb3, 0x3e}
gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{GUID("cdcdd0b7-8afb-4883-853a-ae9398077a0e")}|VOID*|0x10
gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareFileGuid|{GUID("074c21e5-7d17-48e9-808d-f0c85e52a7db")}|VOID*|0x10

# Default Video Resolution
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|0 # 0 - Maximum
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|0 # 0 - Maximum
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|0 # 0 - Maximum
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|0 # 0 - Maximum
# Setup Video Resolution
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|0 # 0 - Maximum
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|0 # 0 - Maximum
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn|0 # 0 - Maximum
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|0 # 0 - Maximum

[PcdsPatchableInModule]
#
Expand Down Expand Up @@ -357,15 +365,6 @@
ManageabilityPkg/Universal/IpmiBlobTransferDxe/IpmiBlobTransferDxe.inf
Features/ManageabilityPkg/Universal/IpmiProtocol/Dxe/IpmiProtocolDxe.inf

#
# Firmware Capsule Update
#
Platform/ADLINK/ComHpcAltPkg/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf
MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf
SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.inf
SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.inf
MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf

#
# HII
#
Expand All @@ -377,6 +376,32 @@
Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.inf
Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigDxe.inf

#
# Firmware Capsule Update
#
!if $(CAPSULE_ENABLE) == TRUE
Platform/ADLINK/ComHpcAltPkg/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf
MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf
MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmpDxe.inf
SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.inf {
<LibraryClasses>
FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf
}
SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.inf {
<LibraryClasses>
FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf
}
MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf {
<LibraryClasses>
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
}

#
# System Firmware Update
#
Silicon/Ampere/AmpereAltraPkg/Drivers/SystemFirmwareUpdateDxe/SystemFirmwareUpdateDxe.inf
!endif

# Redfish
#
!if $(NETWORK_ENABLE) == TRUE
Expand Down Expand Up @@ -416,10 +441,17 @@
!if $(PERFORMANCE_MEASUREMENT_ENABLE) == TRUE
MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf
MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf
ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
!if $(SHELL_ENABLE) == TRUE
ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf {
<PcdsFixedAtBuild>
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
}
!endif
!endif

#
# OpRom emulator
#
!if $(X86_EMULATOR_ENABLE) == TRUE
Emulator/X86EmulatorDxe/X86EmulatorDxe.inf
!endif
Loading