summaryrefslogtreecommitdiff
path: root/Platform/ARM/N1Sdp/Drivers
diff options
context:
space:
mode:
authorKhasim Syed Mohammed <khasim.mohammed@arm.com>2021-04-02 23:00:52 +0530
committerKhasim Syed Mohammed <khasim.mohammed@arm.com>2021-04-02 23:00:52 +0530
commit19671e81e0f926728d14f70ef4501f2586d7c11b (patch)
treeaf080e170dc1ccf6181053b38b8c19dbf199a2e8 /Platform/ARM/N1Sdp/Drivers
parent95494c2c94dc24caf4ede66ccc75d72771d1ceb6 (diff)
Platform/ARM/N1Sdp: Introduce platform DXE driver
Add an initial platform DXE driver and support for ramdisk devices. Change-Id: Idf61fdc3dbde384e0414a80739078bb206784fc3 Signed-off-by: Deepak Pandey <Deepak.Pandey@arm.com> Signed-off-by: Khasim Syed Mohammed <khasim.mohammed@arm.com>
Diffstat (limited to 'Platform/ARM/N1Sdp/Drivers')
-rw-r--r--Platform/ARM/N1Sdp/Drivers/PlatformDxe/PlatformDxe.c43
-rw-r--r--Platform/ARM/N1Sdp/Drivers/PlatformDxe/PlatformDxe.inf43
2 files changed, 86 insertions, 0 deletions
diff --git a/Platform/ARM/N1Sdp/Drivers/PlatformDxe/PlatformDxe.c b/Platform/ARM/N1Sdp/Drivers/PlatformDxe/PlatformDxe.c
new file mode 100644
index 00000000..c9eac1e4
--- /dev/null
+++ b/Platform/ARM/N1Sdp/Drivers/PlatformDxe/PlatformDxe.c
@@ -0,0 +1,43 @@
+/** @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>
+
+EFI_STATUS
+EFIAPI
+ArmN1SdpEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_RAM_DISK_PROTOCOL *RamDisk;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ Status = EFI_UNSUPPORTED;
+ if (FeaturePcdGet (PcdRamDiskSupported)) {
+ Status = gBS->LocateProtocol (&gEfiRamDiskProtocolGuid, NULL, (VOID**) &RamDisk);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: 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;
+}
diff --git a/Platform/ARM/N1Sdp/Drivers/PlatformDxe/PlatformDxe.inf b/Platform/ARM/N1Sdp/Drivers/PlatformDxe/PlatformDxe.inf
new file mode 100644
index 00000000..0a391573
--- /dev/null
+++ b/Platform/ARM/N1Sdp/Drivers/PlatformDxe/PlatformDxe.inf
@@ -0,0 +1,43 @@
+## @file
+#
+# 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 = 11fc8b5a-377d-47a8-aee9-0093d3d3407f
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = ArmN1SdpEntryPoint
+
+[Sources.common]
+ PlatformDxe.c
+
+[Packages]
+ ArmPkg/ArmPkg.dec
+ ArmPlatformPkg/ArmPlatformPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ Platform/ARM/N1Sdp/N1SdpPlatform.dec
+
+[LibraryClasses]
+ HobLib
+ UefiDriverEntryPoint
+
+[Protocols]
+ gEfiRamDiskProtocolGuid
+
+[FeaturePcd]
+ gArmN1SdpTokenSpaceGuid.PcdRamDiskSupported
+
+[FixedPcd]
+ gArmN1SdpTokenSpaceGuid.PcdRamDiskBase
+ gArmN1SdpTokenSpaceGuid.PcdRamDiskSize
+
+[Depex]
+ gEfiRamDiskProtocolGuid