This patch adds PlatformDxe support for Morello SoC platform. It includes the registration of ramdisk device.
Signed-off-by: Chandni Cherukuri <chandni.cheruk...@arm.com> --- Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeSoc.inf | 43 +++++++++++++ Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeSoc.c | 67 ++++++++++++++++++++ 2 files changed, 110 insertions(+) diff --git a/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeSoc.inf b/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeSoc.inf new file mode 100644 index 000000000000..a5d8ac36a3f2 --- /dev/null +++ b/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeSoc.inf @@ -0,0 +1,43 @@ +## @file +# Platform DXE driver for Morello SoC Platform +# +# Copyright (c) 2021, ARM Limited. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = PlatformDxe + FILE_GUID = D75DB98F-5750-47C8-A46F-3140965537FC + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = ArmMorelloEntryPoint + +[Sources.common] + PlatformDxeSoc.c + +[Packages] + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + Platform/ARM/Morello/MorelloPlatform.dec + +[LibraryClasses] + UefiDriverEntryPoint + +[Protocols] + gEfiRamDiskProtocolGuid + +[FeaturePcd] + gArmMorelloTokenSpaceGuid.PcdRamDiskSupported + +[FixedPcd] + gArmMorelloTokenSpaceGuid.PcdRamDiskBase + gArmMorelloTokenSpaceGuid.PcdRamDiskSize + +[Depex] + gEfiRamDiskProtocolGuid + +[Guids] + gEfiVirtualCdGuid ## SOMETIMES_CONSUMES ## GUID diff --git a/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeSoc.c b/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeSoc.c new file mode 100644 index 000000000000..358c80acc7ee --- /dev/null +++ b/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeSoc.c @@ -0,0 +1,67 @@ +/** @file + + Copyright (c) 2021, ARM Limited. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include <Library/DebugLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Protocol/RamDisk.h> + +/** + Entrypoint of Platform Dxe Driver + + @param ImageHandle[in] The firmware allocated handle for the EFI image. + @param SystemTable[in] A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. +**/ +EFI_STATUS +EFIAPI +ArmMorelloEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_RAM_DISK_PROTOCOL *RamDisk; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + + Status = EFI_SUCCESS; + + if (FeaturePcdGet (PcdRamDiskSupported)) { + Status = gBS->LocateProtocol ( + &gEfiRamDiskProtocolGuid, + NULL, + (VOID **)&RamDisk + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "Couldn't find the RAM Disk protocol %r\n", + __FUNCTION__, + Status + )); + return Status; + } + + Status = RamDisk->Register ( + (UINTN)PcdGet32 (PcdRamDiskBase), + (UINTN)PcdGet32 (PcdRamDiskSize), + &gEfiVirtualCdGuid, + NULL, + &DevicePath + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed to register RAM Disk - %r\n", + __FUNCTION__, + Status + )); + } + } + + return Status; +} -- 2.17.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#84341): https://edk2.groups.io/g/devel/message/84341 Mute This Topic: https://groups.io/mt/87497020/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-