Our UEFI guest firmware takes ownership of the emulated NOR flash in order to support the variable runtime services, and it does not expect the OS to interfere with the underlying storage directly. So disable the NOR flash DT nodes as we discover them, in a way similar to how we disable the PL031 RTC in the device tree when we attach our RTC runtime driver to it.
Signed-off-by: Ard Biesheuvel <ard.biesheu...@arm.com> --- ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c b/ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c index 9b1d1184bdd3..c676039785be 100644 --- a/ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c +++ b/ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c @@ -86,6 +86,18 @@ NorFlashPlatformGetDevices ( mNorFlashDevices[Num].BlockSize = QEMU_NOR_BLOCK_SIZE; Num++; } + + // + // UEFI takes ownership of the NOR flash, and exposes its functionality + // through the UEFI Runtime Services GetVariable, SetVariable, etc. This + // means we need to disable it in the device tree to prevent the OS from + // attaching its device driver as well. + // + Status = FdtClient->SetNodeProperty (FdtClient, Node, "status", + "disabled", sizeof ("disabled")); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_WARN, "Failed to set NOR flash status to 'disabled'\n")); + } } *NorFlashDescriptions = mNorFlashDevices; -- 2.27.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#61614): https://edk2.groups.io/g/devel/message/61614 Mute This Topic: https://groups.io/mt/75065345/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-