From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.24478.1638621060457999844 for ; Sat, 04 Dec 2021 04:31:00 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: chandni.cherukuri@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 86B971570; Sat, 4 Dec 2021 04:30:57 -0800 (PST) Received: from usa.arm.com (a074744.blr.arm.com [10.162.17.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DA0DD3F766; Sat, 4 Dec 2021 04:30:55 -0800 (PST) From: "chandni cherukuri" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Chandni Cherukuri Subject: [edk2-platforms][PATCH V1 03/11] Platform/ARM/Morello: Add PlatformDxe for Morello SoC Date: Sat, 4 Dec 2021 18:00:34 +0530 Message-Id: <20211204123042.32140-4-chandni.cherukuri@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211204123042.32140-1-chandni.cherukuri@arm.com> References: <20211204123042.32140-1-chandni.cherukuri@arm.com> This patch adds PlatformDxe support for Morello SoC platform. It includes the registration of ramdisk device. Signed-off-by: Chandni Cherukuri --- 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.
+# +# 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.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include + +/** + 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