From 5f018316e82cce67f33b520f119a869f447d2a92 Mon Sep 17 00:00:00 2001 From: Rairii <2650838+Wack0@users.noreply.github.com> Date: Fri, 13 Sep 2024 12:24:46 +0100 Subject: [PATCH 1/2] Pi2BoardPkg: Add resource groups to CSRT so winload can load additional HAL extensions For pre-th1 support. --- Pi2BoardPkg/AcpiTables/Common/CSRT.aslc | 36 ++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Pi2BoardPkg/AcpiTables/Common/CSRT.aslc b/Pi2BoardPkg/AcpiTables/Common/CSRT.aslc index 017aa49b3..885e079a0 100644 --- a/Pi2BoardPkg/AcpiTables/Common/CSRT.aslc +++ b/Pi2BoardPkg/AcpiTables/Common/CSRT.aslc @@ -79,6 +79,12 @@ typedef struct // Standard ACPI Header EFI_ACPI_DESCRIPTION_HEADER CsrtHeader; +// Timer resource group (GIT for M2-M3) + EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER TimerResourceGroup; + +// Interrupt controller resource group + EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER InterruptControllerResourceGroup; + // DMA Resource Group RG_DMA DmaResourceGroup; @@ -93,7 +99,7 @@ EFI_ACPI_5_0_CSRT_TABLE Csrt = //------------------------------------------------------------------------ { EFI_ACPI_5_0_CORE_SYSTEM_RESOURCE_TABLE_SIGNATURE, // Signature "CSRT" - sizeof(EFI_ACPI_DESCRIPTION_HEADER) + sizeof(RG_DMA), // was sizeof(EFI_ACPI_5_0_CSRT_TABLE), // Length + sizeof(EFI_ACPI_DESCRIPTION_HEADER) + sizeof(EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER) + sizeof(EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER) + sizeof(RG_DMA), // was sizeof(EFI_ACPI_5_0_CSRT_TABLE), // Length EFI_ACPI_5_0_CSRT_REVISION, // Revision 0x00, // Checksum calculated at runtime. EFI_ACPI_OEM_ID, // OEMID is a 6 bytes long field "BC2836" @@ -103,6 +109,34 @@ EFI_ACPI_5_0_CSRT_TABLE Csrt = EFI_ACPI_CREATOR_REVISION // ASL compiler revision number. }, + //------------------------------------------------------------------------ + // Timer Resource Group (GIT for M2-M3) -- halextgit.dll + //------------------------------------------------------------------------ + { + sizeof(EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER), // Resource Group Length + SIGNATURE_32('A','R','M','.'), // VendorId + 0, // SubvendorId + 1, // DeviceId 1 + 0, // SubdeviceId + 0, // Revision + 0, // Reserved + 0 // SharedInfoLength + }, + + //------------------------------------------------------------------------ + // Interrupt Controller Resource Group - halextbcm2709.dll + //------------------------------------------------------------------------ + { + sizeof(EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER), // Resource Group Length + SIGNATURE_32('B','R','C','M'), // VendorId + 0, // SubvendorId + 0x2709, // DeviceId 0x2709 + 0, // SubdeviceId + 0, // Revision + 0, // Reserved + 0 // SharedInfoLength + }, + //------------------------------------------------------------------------ // DMA Resource Group //------------------------------------------------------------------------ From d414dbcb24ba7d8d707897aab667c1ccf3989fe7 Mon Sep 17 00:00:00 2001 From: Rairii <2650838+Wack0@users.noreply.github.com> Date: Fri, 13 Sep 2024 12:28:05 +0100 Subject: [PATCH 2/2] ArmPlatformPkg/Bds: add additional hardcoded standards-compliant boot option as well as PcdDefaultBootAppPath if they differ For more easily booting into WinPE/etc, and to align with other ARMv7 NT systems that fallback to the standards compliant path --- ArmPlatformPkg/Bds/Bds.c | 95 +++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 46 deletions(-) diff --git a/ArmPlatformPkg/Bds/Bds.c b/ArmPlatformPkg/Bds/Bds.c index cbe0dbc31..7d1a3b721 100644 --- a/ArmPlatformPkg/Bds/Bds.c +++ b/ArmPlatformPkg/Bds/Bds.c @@ -701,61 +701,64 @@ DefineDefaultBootAppBootEntries ( { EFI_STATUS Status; UINTN Index = 0; - CHAR16 *UnicodeBootAppPath = NULL; - CHAR8 *AsciiBootAppPath; + UINTN PathIndex = 1; + UINTN PathIterator; + CHAR16 *UnicodeBootAppPath[2] = { NULL, L"\\EFI\\BOOT\\BOOTARM.EFI" }; + CHAR8 *AsciiBootAppPath[2] = { NULL, "\\EFI\\BOOT\\BOOTARM.EFI" }; EFI_DEVICE_PATH *FullPath = NULL; BDS_LOAD_OPTION *BdsLoadOption = NULL; - AsciiBootAppPath = (CHAR8*)PcdGetPtr (PcdDefaultBootAppPath); - if (AsciiBootAppPath == NULL) { - return EFI_UNSUPPORTED; - } - - Status = ConvertAllocAsciiStrToUnicodeStr ( - AsciiBootAppPath, - &UnicodeBootAppPath); - if (EFI_ERROR (Status)) { - DEBUG ((EFI_D_ERROR, "FAIL to cconvert boot app path to unicode format\n")); - goto Exit; + AsciiBootAppPath[0] = (CHAR8*)PcdGetPtr (PcdDefaultBootAppPath); + if (AsciiBootAppPath[0] == NULL || !AsciiStriCmp(AsciiBootAppPath[0], AsciiBootAppPath[1])) { + PathIndex = 1; + } else { + Status = ConvertAllocAsciiStrToUnicodeStr ( + AsciiBootAppPath[0], + &UnicodeBootAppPath[0]); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "FAIL to cconvert boot app path to unicode format\n")); + PathIndex = 1; + } } // Attempt to create boot option if the boot app if found. Will add multiple // option if the boot app is found in multiple file system. - do { - Status = FindFileFullDevicePath ( - &Index, - AsciiBootAppPath, - UnicodeBootAppPath, - &FullPath - ); - if (Status == EFI_SUCCESS) { - Status = BootOptionCreate (LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT, - L"Default EFI Boot Application", - FullPath, - BDS_LOADER_EFI_APPLICATION, - NULL, - 0, - &BdsLoadOption - ); - if (EFI_ERROR (Status)) { - DEBUG ((EFI_D_ERROR, "Fail to create boot option for %s\n", AsciiBootAppPath)); - } else { - DEBUG ((DEBUG_INIT, "Created boot option for %s\n", AsciiBootAppPath)); - } - if (BdsLoadOption) { - FreePool (BdsLoadOption); - BdsLoadOption = NULL; - } - if (FullPath) { - FreePool (FullPath); - FullPath = NULL; + for (PathIterator = PathIndex; PathIterator < 2; PathIterator++) { + do { + Status = FindFileFullDevicePath ( + &Index, + AsciiBootAppPath[PathIterator], + UnicodeBootAppPath[PathIterator], + &FullPath + ); + if (Status == EFI_SUCCESS) { + Status = BootOptionCreate (LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT, + L"Default EFI Boot Application", + FullPath, + BDS_LOADER_EFI_APPLICATION, + NULL, + 0, + &BdsLoadOption + ); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "Fail to create boot option for %s\n", AsciiBootAppPath)); + } else { + DEBUG ((DEBUG_INIT, "Created boot option for %s\n", AsciiBootAppPath)); + } + if (BdsLoadOption) { + FreePool (BdsLoadOption); + BdsLoadOption = NULL; + } + if (FullPath) { + FreePool (FullPath); + FullPath = NULL; + } } - } - } while (Status != EFI_NOT_FOUND); + } while (Status != EFI_NOT_FOUND); + } -Exit: - if (UnicodeBootAppPath) { - FreePool (UnicodeBootAppPath); + if (UnicodeBootAppPath[0]) { + FreePool (UnicodeBootAppPath[0]); } return Status; }