From: BigfootACA Date: 星期三, 23 Feb 2022 14:48:16 +0000 (+0800) Subject: (TEST) SimpleInit: add Boot Menu and Linux Boot X-Git-Tag: v2.0rc1~14 X-Git-Url: https://git.renegade-project.org/?a=commitdiff_plain;h=384b87752563a7a768d04701465c032dcb5b3e86;p=edk2-sdm845.git (TEST) SimpleInit: add Boot Menu and Linux Boot note: at present, the downstream android kernel cannot be started normally --- diff --git a/sdm845Pkg/Binary b/sdm845Pkg/Binary index c775d7f..a1954c6 160000 --- a/sdm845Pkg/Binary +++ b/sdm845Pkg/Binary @@ -1 +1 @@ -Subproject commit c775d7fe1713b041219c7dfafc6265219c901d6d +Subproject commit a1954c67cb3feb0ed937844ef0bd7be02642b71d diff --git a/sdm845Pkg/CommonDsc.dsc.inc b/sdm845Pkg/CommonDsc.dsc.inc index ca5ca38..884d9ea 100644 --- a/sdm845Pkg/CommonDsc.dsc.inc +++ b/sdm845Pkg/CommonDsc.dsc.inc @@ -14,7 +14,7 @@ # !include MdePkg/MdeLibs.dsc.inc -!include sdm845Pkg/Library/SimpleInit/SimpleInit.inc +!include SimpleInit.inc [LibraryClasses.common] !if $(TARGET) == RELEASE @@ -340,4 +340,4 @@ gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|32 [PcdsDynamicHii.common.DEFAULT] - gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|3 # Variable: L"Timeout" + gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|0 # Variable: L"Timeout" diff --git a/sdm845Pkg/Devices/845.fdf b/sdm845Pkg/Devices/845.fdf index 2bda0f5..c064d5f 100644 --- a/sdm845Pkg/Devices/845.fdf +++ b/sdm845Pkg/Devices/845.fdf @@ -180,6 +180,11 @@ APRIORI DXE { SECTION UI = "PlatformInfoDxeDriver" } + FILE DRIVER = 7DB0793A-4402-4BE1-906E-D0FABAD2707E { + SECTION PE32 = sdm845Pkg/Binary/845/DDRInfoDxe/DDRInfoDxe.efi + SECTION UI = "DDRInfoDxe" + } + FILE DRIVER = 9A00771F-36D4-4DD5-8916-C48ED9B16B86 { SECTION DXE_DEPEX = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.depex SECTION PE32 = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.efi @@ -583,6 +588,8 @@ APRIORI DXE { # INF src/main/SimpleInitMain.inf + INF src/kernelfdt/KernelFdtDxe.inf + [FV.FVMAIN_COMPACT] FvAlignment = 8 ERASE_POLARITY = 1 diff --git a/sdm845Pkg/Devices/beryllium.fdf b/sdm845Pkg/Devices/beryllium.fdf index 8f8e5c4..de57b6e 100644 --- a/sdm845Pkg/Devices/beryllium.fdf +++ b/sdm845Pkg/Devices/beryllium.fdf @@ -180,6 +180,11 @@ APRIORI DXE { SECTION UI = "PlatformInfoDxeDriver" } + FILE DRIVER = 7DB0793A-4402-4BE1-906E-D0FABAD2707E { + SECTION PE32 = sdm845Pkg/Binary/845/DDRInfoDxe/DDRInfoDxe.efi + SECTION UI = "DDRInfoDxe" + } + FILE DRIVER = 9A00771F-36D4-4DD5-8916-C48ED9B16B86 { SECTION DXE_DEPEX = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.depex SECTION PE32 = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.efi @@ -577,6 +582,8 @@ APRIORI DXE { INF MdeModulePkg/Application/UiApp/UiApp.inf INF sdm845Pkg/Drivers/LogoDxe/LogoDxe.inf + INF src/kernelfdt/KernelFdtDxe.inf + [FV.FVMAIN_COMPACT] FvAlignment = 8 ERASE_POLARITY = 1 diff --git a/sdm845Pkg/Devices/dipper.fdf b/sdm845Pkg/Devices/dipper.fdf index 31af8ee..757446a 100644 --- a/sdm845Pkg/Devices/dipper.fdf +++ b/sdm845Pkg/Devices/dipper.fdf @@ -180,6 +180,11 @@ APRIORI DXE { SECTION UI = "PlatformInfoDxeDriver" } + FILE DRIVER = 7DB0793A-4402-4BE1-906E-D0FABAD2707E { + SECTION PE32 = sdm845Pkg/Binary/845/DDRInfoDxe/DDRInfoDxe.efi + SECTION UI = "DDRInfoDxe" + } + FILE DRIVER = 9A00771F-36D4-4DD5-8916-C48ED9B16B86 { SECTION DXE_DEPEX = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.depex SECTION PE32 = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.efi @@ -571,6 +576,7 @@ APRIORI DXE { # INF src/main/SimpleInitMain.inf + INF src/kernelfdt/KernelFdtDxe.inf [FV.FVMAIN_COMPACT] FvAlignment = 8 diff --git a/sdm845Pkg/Devices/enchilada.fdf b/sdm845Pkg/Devices/enchilada.fdf index 36e641c..43d99f6 100644 --- a/sdm845Pkg/Devices/enchilada.fdf +++ b/sdm845Pkg/Devices/enchilada.fdf @@ -180,6 +180,11 @@ APRIORI DXE { SECTION UI = "PlatformInfoDxeDriver" } + FILE DRIVER = 7DB0793A-4402-4BE1-906E-D0FABAD2707E { + SECTION PE32 = sdm845Pkg/Binary/845/DDRInfoDxe/DDRInfoDxe.efi + SECTION UI = "DDRInfoDxe" + } + FILE DRIVER = 9A00771F-36D4-4DD5-8916-C48ED9B16B86 { SECTION DXE_DEPEX = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.depex SECTION PE32 = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.efi @@ -606,6 +611,8 @@ APRIORI DXE { # INF src/main/SimpleInitMain.inf + INF src/kernelfdt/KernelFdtDxe.inf + [FV.FVMAIN_COMPACT] FvAlignment = 8 ERASE_POLARITY = 1 diff --git a/sdm845Pkg/Devices/fajita.fdf b/sdm845Pkg/Devices/fajita.fdf index f28cbb5..1025436 100644 --- a/sdm845Pkg/Devices/fajita.fdf +++ b/sdm845Pkg/Devices/fajita.fdf @@ -180,6 +180,11 @@ APRIORI DXE { SECTION UI = "PlatformInfoDxeDriver" } + FILE DRIVER = 7DB0793A-4402-4BE1-906E-D0FABAD2707E { + SECTION PE32 = sdm845Pkg/Binary/845/DDRInfoDxe/DDRInfoDxe.efi + SECTION UI = "DDRInfoDxe" + } + FILE DRIVER = 9A00771F-36D4-4DD5-8916-C48ED9B16B86 { SECTION DXE_DEPEX = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.depex SECTION PE32 = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.efi @@ -609,6 +614,8 @@ APRIORI DXE { # INF src/main/SimpleInitMain.inf + INF src/kernelfdt/KernelFdtDxe.inf + [FV.FVMAIN_COMPACT] FvAlignment = 8 ERASE_POLARITY = 1 diff --git a/sdm845Pkg/Devices/m1892.fdf b/sdm845Pkg/Devices/m1892.fdf index a9abeff..cb55bbd 100644 --- a/sdm845Pkg/Devices/m1892.fdf +++ b/sdm845Pkg/Devices/m1892.fdf @@ -180,6 +180,11 @@ APRIORI DXE { SECTION UI = "PlatformInfoDxeDriver" } + FILE DRIVER = 7DB0793A-4402-4BE1-906E-D0FABAD2707E { + SECTION PE32 = sdm845Pkg/Binary/845/DDRInfoDxe/DDRInfoDxe.efi + SECTION UI = "DDRInfoDxe" + } + FILE DRIVER = 9A00771F-36D4-4DD5-8916-C48ED9B16B86 { SECTION DXE_DEPEX = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.depex SECTION PE32 = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.efi @@ -589,6 +594,8 @@ APRIORI DXE { # #INF sdm845Pkg/Drivers/Op6tSlotDxe/Op6tSlotDxe.inf + INF src/kernelfdt/KernelFdtDxe.inf + [FV.FVMAIN_COMPACT] FvAlignment = 8 ERASE_POLARITY = 1 diff --git a/sdm845Pkg/Devices/odin.fdf b/sdm845Pkg/Devices/odin.fdf index d82112e..92c4d1d 100644 --- a/sdm845Pkg/Devices/odin.fdf +++ b/sdm845Pkg/Devices/odin.fdf @@ -180,6 +180,11 @@ APRIORI DXE { SECTION UI = "PlatformInfoDxeDriver" } + FILE DRIVER = 7DB0793A-4402-4BE1-906E-D0FABAD2707E { + SECTION PE32 = sdm845Pkg/Binary/845/DDRInfoDxe/DDRInfoDxe.efi + SECTION UI = "DDRInfoDxe" + } + FILE DRIVER = 9A00771F-36D4-4DD5-8916-C48ED9B16B86 { SECTION DXE_DEPEX = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.depex SECTION PE32 = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.efi @@ -570,6 +575,8 @@ APRIORI DXE { # INF src/main/SimpleInitMain.inf + INF src/kernelfdt/KernelFdtDxe.inf + [FV.FVMAIN_COMPACT] FvAlignment = 8 ERASE_POLARITY = 1 diff --git a/sdm845Pkg/Devices/perseus.fdf b/sdm845Pkg/Devices/perseus.fdf index ff9d6c0..80552f9 100644 --- a/sdm845Pkg/Devices/perseus.fdf +++ b/sdm845Pkg/Devices/perseus.fdf @@ -180,6 +180,11 @@ APRIORI DXE { SECTION UI = "PlatformInfoDxeDriver" } + FILE DRIVER = 7DB0793A-4402-4BE1-906E-D0FABAD2707E { + SECTION PE32 = sdm845Pkg/Binary/845/DDRInfoDxe/DDRInfoDxe.efi + SECTION UI = "DDRInfoDxe" + } + FILE DRIVER = 9A00771F-36D4-4DD5-8916-C48ED9B16B86 { SECTION DXE_DEPEX = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.depex SECTION PE32 = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.efi @@ -581,6 +586,8 @@ APRIORI DXE { # INF src/main/SimpleInitMain.inf + INF src/kernelfdt/KernelFdtDxe.inf + [FV.FVMAIN_COMPACT] FvAlignment = 8 ERASE_POLARITY = 1 diff --git a/sdm845Pkg/Devices/polaris.fdf b/sdm845Pkg/Devices/polaris.fdf index 43edb2e..b715af7 100644 --- a/sdm845Pkg/Devices/polaris.fdf +++ b/sdm845Pkg/Devices/polaris.fdf @@ -179,6 +179,11 @@ APRIORI DXE { SECTION UI = "PlatformInfoDxeDriver" } + FILE DRIVER = 7DB0793A-4402-4BE1-906E-D0FABAD2707E { + SECTION PE32 = sdm845Pkg/Binary/845/DDRInfoDxe/DDRInfoDxe.efi + SECTION UI = "DDRInfoDxe" + } + FILE DRIVER = 9A00771F-36D4-4DD5-8916-C48ED9B16B86 { SECTION DXE_DEPEX = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.depex SECTION PE32 = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.efi @@ -580,6 +585,8 @@ APRIORI DXE { # INF src/main/SimpleInitMain.inf + INF src/kernelfdt/KernelFdtDxe.inf + [FV.FVMAIN_COMPACT] FvAlignment = 8 ERASE_POLARITY = 1 diff --git a/sdm845Pkg/Devices/trident.fdf b/sdm845Pkg/Devices/trident.fdf index 4acccd3..39f783c 100644 --- a/sdm845Pkg/Devices/trident.fdf +++ b/sdm845Pkg/Devices/trident.fdf @@ -180,6 +180,11 @@ APRIORI DXE { SECTION UI = "PlatformInfoDxeDriver" } + FILE DRIVER = 7DB0793A-4402-4BE1-906E-D0FABAD2707E { + SECTION PE32 = sdm845Pkg/Binary/845/DDRInfoDxe/DDRInfoDxe.efi + SECTION UI = "DDRInfoDxe" + } + FILE DRIVER = 9A00771F-36D4-4DD5-8916-C48ED9B16B86 { SECTION DXE_DEPEX = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.depex SECTION PE32 = sdm845Pkg/Binary/845/HALIOMMU/HALIOMMU.efi @@ -595,6 +600,8 @@ APRIORI DXE { # INF sdm845Pkg/Drivers/Op6tSlotDxe/Op6tSlotDxe.inf # !endif #$(AB_SLOTS_SUPPORT) + INF src/kernelfdt/KernelFdtDxe.inf + [FV.FVMAIN_COMPACT] FvAlignment = 8 ERASE_POLARITY = 1 diff --git a/sdm845Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf b/sdm845Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf index cf4d014..cde1284 100644 --- a/sdm845Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf +++ b/sdm845Pkg/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf @@ -54,12 +54,14 @@ gsdm845PkgTokenSpaceGuid.PcdDeviceVendor gsdm845PkgTokenSpaceGuid.PcdDeviceProduct gsdm845PkgTokenSpaceGuid.PcdDeviceCodeName - gsdm845PkgTokenSpaceGuid.DeviceTreeStore [Protocols] gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED + gKernelFdtProtocolGuid [Guids] [Depex] - gEfiSmbiosProtocolGuid + gEfiSmbiosProtocolGuid AND + gKernelFdtProtocolGuid + diff --git a/sdm845Pkg/Include/Library/FdtParserLib.h b/sdm845Pkg/Include/Library/FdtParserLib.h index 0c8dd93..26e8767 100644 --- a/sdm845Pkg/Include/Library/FdtParserLib.h +++ b/sdm845Pkg/Include/Library/FdtParserLib.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -22,16 +23,35 @@ fdt* EFIAPI GetFdt(VOID) { - EFI_PHYSICAL_ADDRESS FdtStore = (EFI_PHYSICAL_ADDRESS)FixedPcdGet64(DeviceTreeStore); - EFI_PHYSICAL_ADDRESS FdtAddress = *(EFI_PHYSICAL_ADDRESS*)FdtStore; + EFI_PHYSICAL_ADDRESS FdtAddress; + #ifndef FDT_DIRECT + EFI_STATUS Status; + KERNEL_FDT_PROTOCOL *Fdt; - DEBUG((EFI_D_INFO, "Device Tree Address: 0x%016lx\n",FdtAddress)); + Status = gBS->LocateProtocol ( + &gKernelFdtProtocolGuid, + NULL, + (VOID**)&Fdt + ); + if (EFI_ERROR (Status)) { + DEBUG((EFI_D_ERROR, "Locate Kernel Fdt Protocol failed: %r\n", Status)); + return NULL; + } + if (Fdt == NULL || Fdt->Fdt == NULL) { + DEBUG((EFI_D_ERROR, "Invalid Device Tree\n")); + return NULL; + } + FdtAddress = (EFI_PHYSICAL_ADDRESS)Fdt->Fdt; + #else + FdtAddress = *(EFI_PHYSICAL_ADDRESS*)FixedPcdGet64 (PcdDeviceTreeStore); if (FdtAddress < PcdGet64(PcdSystemMemoryBase)){ DEBUG((EFI_D_INFO, "Invalid Device Tree Address\n")); return NULL; } + #endif + DEBUG((EFI_D_INFO, "Device Tree Address: 0x%016lx\n", FdtAddress)); return get_fdt_from_pointer ((VOID*)FdtAddress); } diff --git a/sdm845Pkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c b/sdm845Pkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c index db27491..66b78f6 100644 --- a/sdm845Pkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c +++ b/sdm845Pkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c @@ -13,6 +13,7 @@ * **/ +#define FDT_DIRECT #include #include diff --git a/sdm845Pkg/Library/MemoryInitPeiLib/PeiMemoryAllocationLib.inf b/sdm845Pkg/Library/MemoryInitPeiLib/PeiMemoryAllocationLib.inf index 550e909..93fe4d8 100644 --- a/sdm845Pkg/Library/MemoryInitPeiLib/PeiMemoryAllocationLib.inf +++ b/sdm845Pkg/Library/MemoryInitPeiLib/PeiMemoryAllocationLib.inf @@ -48,7 +48,7 @@ [FixedPcd] gArmTokenSpaceGuid.PcdSystemMemoryBase gArmTokenSpaceGuid.PcdSystemMemorySize - gsdm845PkgTokenSpaceGuid.DeviceTreeStore + gSimpleInitTokenSpaceGuid.PcdDeviceTreeStore [Depex] TRUE diff --git a/sdm845Pkg/Library/PlatformBootManagerLib/PlatformBm.c b/sdm845Pkg/Library/PlatformBootManagerLib/PlatformBm.c index c403727..2a6af24 100644 --- a/sdm845Pkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/sdm845Pkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -446,10 +446,6 @@ VOID PlatformRegisterOptionsAndKeys(VOID) Status = EfiBootManagerGetBootManagerMenu(&BootOption); ASSERT_EFI_ERROR(Status); #ifdef ENABLE_SIMPLE_INIT - // - // Search all boot options - // - EfiBootManagerRefreshAllBootOption(); // // Register Simple Init GUI APP @@ -463,9 +459,6 @@ VOID PlatformRegisterOptionsAndKeys(VOID) NULL, (UINT16)BootOption.OptionNumber, 0, &UP, NULL); #endif ASSERT(Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED); - Status = EfiBootManagerAddKeyOptionVariable( - NULL, (UINT16)BootOption.OptionNumber, 0, &Esc, NULL); - ASSERT(Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED); } // diff --git a/sdm845Pkg/Library/SimpleInit b/sdm845Pkg/Library/SimpleInit index 4cc02c4..0556e34 160000 --- a/sdm845Pkg/Library/SimpleInit +++ b/sdm845Pkg/Library/SimpleInit @@ -1 +1 @@ -Subproject commit 4cc02c44f289cad0bbf18cfc7f9f97655f5946f4 +Subproject commit 0556e34886c92513a4ec7ac909a082c7afb06fd2 diff --git a/sdm845Pkg/Library/sdm845Lib/sdm845Helper.S b/sdm845Pkg/Library/sdm845Lib/sdm845Helper.S index 1f27486..5988c04 100644 --- a/sdm845Pkg/Library/sdm845Lib/sdm845Helper.S +++ b/sdm845Pkg/Library/sdm845Lib/sdm845Helper.S @@ -26,7 +26,7 @@ startlabel: bne docopy ret docopy: - mov x10, FixedPcdGet64 (DeviceTreeStore) + mov x10, FixedPcdGet64 (PcdDeviceTreeStore) str x0, [x10] // oh my fdt // find our start address by getting our expected offset, then subtracting it from our actual address ldr x6, =FixedPcdGet64 (PcdFdBaseAddress) diff --git a/sdm845Pkg/Library/sdm845Lib/sdm845Lib.inf b/sdm845Pkg/Library/sdm845Lib/sdm845Lib.inf index 856d5df..86b87c9 100644 --- a/sdm845Pkg/Library/sdm845Lib/sdm845Lib.inf +++ b/sdm845Pkg/Library/sdm845Lib/sdm845Lib.inf @@ -25,6 +25,7 @@ MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec sdm845Pkg/sdm845Pkg.dec + SimpleInit.dec [LibraryClasses] ArmLib @@ -44,4 +45,4 @@ gArmTokenSpaceGuid.PcdSystemMemorySize gArmTokenSpaceGuid.PcdFdBaseAddress gArmTokenSpaceGuid.PcdFdSize - gsdm845PkgTokenSpaceGuid.DeviceTreeStore + gSimpleInitTokenSpaceGuid.PcdDeviceTreeStore diff --git a/sdm845Pkg/sdm845Pkg.dec b/sdm845Pkg/sdm845Pkg.dec index be9076f..878065c 100644 --- a/sdm845Pkg/sdm845Pkg.dec +++ b/sdm845Pkg/sdm845Pkg.dec @@ -61,5 +61,3 @@ gsdm845PkgTokenSpaceGuid.PcdDeviceVendor|"Qualcomm"|VOID*|0x0000a301 gsdm845PkgTokenSpaceGuid.PcdDeviceProduct|"Snapdragon 845 Device"|VOID*|0x0000a302 gsdm845PkgTokenSpaceGuid.PcdDeviceCodeName|"sdm845"|VOID*|0x0000a303 - - gsdm845PkgTokenSpaceGuid.DeviceTreeStore|0x83300000|UINT64|0x0000a501 diff --git a/sdm845Pkg/sdm845Pkg.dsc b/sdm845Pkg/sdm845Pkg.dsc index 6d77c60..cba1b22 100644 --- a/sdm845Pkg/sdm845Pkg.dsc +++ b/sdm845Pkg/sdm845Pkg.dsc @@ -116,6 +116,8 @@ gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000 gArmTokenSpaceGuid.PcdSystemMemorySize|0xC0000000 + gSimpleInitTokenSpaceGuid.PcdDeviceTreeStore|0x83300000 + # We bring up eight cores here! gArmPlatformTokenSpaceGuid.PcdCoreCount|8 gArmPlatformTokenSpaceGuid.PcdClusterCount|2 @@ -135,7 +137,7 @@ # GUID of the UI app gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 } - gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|5 + gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0 gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE