Recent versions of shim (15.6 and 15.7) crash when the newly added EFI_MEMORY_ATTRIBUTE_PROTOCOL is provided by the firmware. To allow existing installations to boot, provide a workaround in form of a Pcd that allows tuning it off at build time (defaults to 'enabled').
Additionally, check the return code of the protocol installation calls. Signed-off-by: Oliver Steffen <ostef...@redhat.com> --- PR: https://github.com/tianocore/edk2/pull/4560 --- ArmPkg/ArmPkg.dec | 3 +++ ArmPkg/Drivers/CpuDxe/CpuDxe.inf | 1 + ArmPkg/Drivers/CpuDxe/CpuDxe.c | 13 +++++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index 1a16d044c94b..bd612c8c4b93 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -172,6 +172,9 @@ [PcdsFixedAtBuild.common] gArmTokenSpaceGuid.PcdCpuVectorBaseAddress|0xffff0000|UINT64|0x00000004 gArmTokenSpaceGuid.PcdCpuResetAddress|0x00000000|UINT32|0x00000005 + # Enable/Disable EFI_MEMORY_ATTRIBUTE_PROTOCOL + gArmTokenSpaceGuid.PcdEnableEfiMemoryAttributeProtocol|TRUE|BOOLEAN|0x000000EE + # # ARM Secure Firmware PCDs # diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.inf b/ArmPkg/Drivers/CpuDxe/CpuDxe.inf index 7d8132200e64..feb4f28b65f1 100644 --- a/ArmPkg/Drivers/CpuDxe/CpuDxe.inf +++ b/ArmPkg/Drivers/CpuDxe/CpuDxe.inf @@ -66,6 +66,7 @@ [Guids] [Pcd.common] gArmTokenSpaceGuid.PcdVFPEnabled gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy + gArmTokenSpaceGuid.PcdEnableEfiMemoryAttributeProtocol [FeaturePcd.common] gArmTokenSpaceGuid.PcdDebuggerExceptionSupport diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.c b/ArmPkg/Drivers/CpuDxe/CpuDxe.c index f820f3f62189..927b91bde36e 100644 --- a/ArmPkg/Drivers/CpuDxe/CpuDxe.c +++ b/ArmPkg/Drivers/CpuDxe/CpuDxe.c @@ -329,10 +329,19 @@ CpuDxeInitialize ( &mCpuHandle, &gEfiCpuArchProtocolGuid, &mCpu, - &gEfiMemoryAttributeProtocolGuid, - &mMemoryAttribute, NULL ); + ASSERT_EFI_ERROR (Status); + + if (PcdGetBool (PcdEnableEfiMemoryAttributeProtocol)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &mCpuHandle, + &gEfiMemoryAttributeProtocolGuid, + &mMemoryAttribute, + NULL + ); + ASSERT_EFI_ERROR (Status); + } // // Make sure GCD and MMU settings match. This API calls gDS->SetMemorySpaceAttributes () -- 2.41.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106181): https://edk2.groups.io/g/devel/message/106181 Mute This Topic: https://groups.io/mt/99631663/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-