mirror of
https://github.com/edk2-porting/edk2-rk3588.git
synced 2025-12-17 11:04:41 +08:00
Add upstream EFI Memory Attribute Protocol state manager
Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
#
|
||||
# Copyright (c) 2021-2022, Rockchip Limited. All rights reserved.
|
||||
# Copyright (c) 2023, Mario Bălănică <mariobalanica02@gmail.com>
|
||||
# Copyright (c) 2023-2024, Mario Bălănică <mariobalanica02@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@@ -205,6 +205,11 @@
|
||||
INF Drivers/ASIX/Bus/Usb/UsbNetworking/Ax88772c/Ax88772c.inf
|
||||
!endif
|
||||
|
||||
#
|
||||
# EFI Memory Attribute Protocol state manager (rhboot shim workaround)
|
||||
#
|
||||
INF EmbeddedPkg/Drivers/MemoryAttributeManagerDxe/MemoryAttributeManagerDxe.inf
|
||||
|
||||
#
|
||||
# Bds
|
||||
#
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2021, Rockchip Limited. All rights reserved.
|
||||
* Copyright (c) 2023, Mario Bălănică <mariobalanica02@gmail.com>
|
||||
* Copyright (c) 2023-2024, Mario Bălănică <mariobalanica02@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
**/
|
||||
|
||||
#include <Uefi.h>
|
||||
#include <Protocol/MemoryAttribute.h>
|
||||
#include <Library/ArmLib.h>
|
||||
#include <Library/CacheMaintenanceLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
@@ -408,69 +407,6 @@ RK3588NotifyReadyToBoot (
|
||||
gBS->CloseEvent (Event);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function uninstalls the recently added EFI_MEMORY_ATTRIBUTE_PROTOCOL
|
||||
to workaround older versions of OS loaders/shims using it incorrectly and
|
||||
throwing a Synchronous Exception.
|
||||
|
||||
See:
|
||||
- https://github.com/microsoft/mu_silicon_arm_tiano/issues/124
|
||||
- https://edk2.groups.io/g/devel/topic/99631663
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
UninstallMemoryAttributeProtocol (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE *Handles;
|
||||
UINTN HandleCount;
|
||||
EFI_MEMORY_ATTRIBUTE_PROTOCOL *MemoryAttributeProtocol;
|
||||
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiMemoryAttributeProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&Handles
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
ASSERT (HandleCount == 1);
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
Handles[0],
|
||||
&gEfiMemoryAttributeProtocolGuid,
|
||||
(VOID **)&MemoryAttributeProtocol
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
Handles[0],
|
||||
&gEfiMemoryAttributeProtocolGuid,
|
||||
MemoryAttributeProtocol,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
gBS->FreePool (Handles);
|
||||
}
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
RK3588NotifyEndOfDxe (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
gBS->CloseEvent (Event);
|
||||
|
||||
UninstallMemoryAttributeProtocol ();
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
RK3588EntryPoint (
|
||||
@@ -501,14 +437,6 @@ RK3588EntryPoint (
|
||||
&Event);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
RK3588NotifyEndOfDxe,
|
||||
NULL,
|
||||
&gEfiEndOfDxeEventGroupGuid,
|
||||
&Event);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = RK3588InitPeripherals ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
|
||||
@@ -113,7 +113,6 @@
|
||||
|
||||
[Guids]
|
||||
gRK3588DxeFormSetGuid
|
||||
gEfiEndOfDxeEventGroupGuid
|
||||
|
||||
[Depex]
|
||||
TRUE
|
||||
|
||||
@@ -734,6 +734,11 @@ FspiLib|Silicon/Rockchip/Library/FspiLib/FspiLib.inf
|
||||
Drivers/ASIX/Bus/Usb/UsbNetworking/Ax88772c/Ax88772c.inf
|
||||
!endif
|
||||
|
||||
#
|
||||
# EFI Memory Attribute Protocol state manager (rhboot shim workaround)
|
||||
#
|
||||
EmbeddedPkg/Drivers/MemoryAttributeManagerDxe/MemoryAttributeManagerDxe.inf
|
||||
|
||||
#
|
||||
# Bds
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user