summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg
diff options
context:
space:
mode:
authorRonald Cron <Ronald.Cron@arm.com>2015-02-26 10:57:27 +0000
committeroliviermartin <oliviermartin@Edk2>2015-02-26 10:57:27 +0000
commit7aec2926b926ad90d09fb026af0ee04c4c831237 (patch)
treeb4e9bc435f6168a08261387f29a68e07e2f4030e /ArmPlatformPkg
parentcae7af275ed6bc8873fb5469b861f37b59685e07 (diff)
downloadedk2-platforms-7aec2926b926ad90d09fb026af0ee04c4c831237.tar.xz
ArmPlatformPkg/ArmJunoDxe: Set the platform dependent FDT device path
The MIDR register of the CPU on which the UEFI firmware is running on is used to infer if the platform is a Juno r0 or a Juno r1. The right device path to the platform FDT is then stored in the "gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths" dynamic PCD. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ronald Cron <Ronald.Cron@arm.com> Reviewed-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16939 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg')
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/ArmJuno.dec6
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc29
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf5
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c55
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf7
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxeInternal.h5
6 files changed, 83 insertions, 24 deletions
diff --git a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dec b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dec
index 051ffbbb60..2ce207ef30 100644
--- a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dec
+++ b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dec
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2013-2014, ARM Limited. All rights reserved.
+# Copyright (c) 2013-2015, ARM Limited. All rights reserved.
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -34,3 +34,7 @@
[PcdsFixedAtBuild.common]
gArmJunoTokenSpaceGuid.PcdSynopsysUsbOhciBaseAddress|0x7FFB0000|UINT32|0x00000004
gArmJunoTokenSpaceGuid.PcdSynopsysUsbEhciBaseAddress|0x7FFC0000|UINT32|0x00000005
+
+ # Juno Device Trees are loaded from NOR Flash
+ gArmJunoTokenSpaceGuid.PcdR0FdtDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/juno_r0.dtb"|VOID*|0x00000006
+ gArmJunoTokenSpaceGuid.PcdR1FdtDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/juno_r1.dtb"|VOID*|0x00000007
diff --git a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
index 1639bf4269..9b12528922 100644
--- a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
+++ b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2013-2014, ARM Limited. All rights reserved.
+# Copyright (c) 2013-2015, ARM Limited. All rights reserved.
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -59,6 +59,9 @@
PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
+[LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.DXE_DRIVER]
+ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+
[BuildOptions]
*_*_*_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmJunoPkg/Include
@@ -133,22 +136,6 @@
gArmPlatformTokenSpaceGuid.PcdBootMonFsSupportedDevicePaths|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)"
#
- # Define the device path to the FDT for its installation
- #
-!ifdef $(JUNO_EMULATOR)
- # From DRAM
- gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L"VenHw(30F57E4A-69CE-4FB7-B7A1-4C7CE49D57A6)/MemoryMapped(0x0,0x88000000,0x88200000)"
-!else
-!ifdef $(JUNO_MODEL)
- # From semi-hosting
- gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/juno.dtb"
-!else
- # From NOR flash
- gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/juno.dtb"
-!endif
-!endif
-
- #
# ARM OS Loader
#
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NOR Flash"
@@ -174,6 +161,14 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1920
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|1080
+[PcdsDynamicDefault.common]
+ #
+ # The size of a dynamic PCD of the (VOID*) type can not be increased at run
+ # time from its size at build time. Set the "PcdFdtDevicePaths" PCD to a 128
+ # character "empty" string, to allow to be able to set FDT text device paths
+ # up to 128 characters long.
+ #
+ gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L" "
################################################################################
#
diff --git a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf
index b36c77ab90..f399c91ffe 100644
--- a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf
+++ b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf
@@ -85,7 +85,12 @@ READ_STATUS = TRUE
READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
+ APRIORI DXE {
+ INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+ }
+
INF MdeModulePkg/Core/Dxe/DxeMain.inf
+ INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
#
# PI DXE Drivers producing Architectural Protocols (EFI Services)
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c
index 7f92931518..2d41cd2ee1 100644
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c
+++ b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c
@@ -26,8 +26,14 @@ ArmJunoEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS HypBase;
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS HypBase;
+ CHAR16 *TextDevicePath;
+ UINTN TextDevicePathSize;
+ VOID *Buffer;
+ UINT32 Midr;
+ UINT32 CpuType;
+ UINT32 CpuRev;
Status = PciEmulationEntryPoint ();
if (EFI_ERROR (Status)) {
@@ -77,11 +83,52 @@ ArmJunoEntryPoint (
DEBUG ((EFI_D_ERROR, "ArmJunoDxe: Failed to install ShellDynCmdRunAxf\n"));
}
- // Try to install the ACPI Tables
- Status = LocateAndInstallAcpiFromFv (&mJunoAcpiTableFile);
+ //
+ // Set up the device path to the FDT.
+ // We detect whether we are running on a Juno r0 or Juno r1 board at
+ // runtime by checking the value of the MIDR register.
+ //
+
+ Midr = ArmReadMidr ();
+ CpuType = (Midr >> ARM_CPU_TYPE_SHIFT) & ARM_CPU_TYPE_MASK;
+ CpuRev = Midr & ARM_CPU_REV_MASK;
+ TextDevicePath = NULL;
+
+ switch (CpuType) {
+ case ARM_CPU_TYPE_A53:
+ if (CpuRev == ARM_CPU_REV (0, 0)) {
+ TextDevicePath = (CHAR16*)FixedPcdGetPtr (PcdR0FdtDevicePath);
+ } else if (CpuRev == ARM_CPU_REV (0, 3)) {
+ TextDevicePath = (CHAR16*)FixedPcdGetPtr (PcdR1FdtDevicePath);
+ }
+ break;
+
+ case ARM_CPU_TYPE_A57:
+ if (CpuRev == ARM_CPU_REV (0, 0)) {
+ TextDevicePath = (CHAR16*)FixedPcdGetPtr (PcdR0FdtDevicePath);
+ } else if (CpuRev == ARM_CPU_REV (1, 1)) {
+ TextDevicePath = (CHAR16*)FixedPcdGetPtr (PcdR1FdtDevicePath);
+ }
+ }
+
+ if (TextDevicePath != NULL) {
+ TextDevicePathSize = StrSize (TextDevicePath);
+ Buffer = PcdSetPtr (PcdFdtDevicePaths, &TextDevicePathSize, TextDevicePath);
+ Status = (Buffer != NULL) ? EFI_SUCCESS : EFI_BUFFER_TOO_SMALL;
+ } else {
+ Status = EFI_NOT_FOUND;
+ }
+
if (EFI_ERROR (Status)) {
+ DEBUG (
+ (EFI_D_ERROR,
+ "ArmJunoDxe: Setting of FDT device path in PcdFdtDevicePaths failed - %r\n", Status)
+ );
return Status;
}
+ // Try to install the ACPI Tables
+ Status = LocateAndInstallAcpiFromFv (&mJunoAcpiTableFile);
+
return Status;
}
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
index d29703b20f..323ed5f49d 100644
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
+++ b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
@@ -32,6 +32,7 @@
[LibraryClasses]
AcpiLib
+ ArmLib
ArmShellCmdRunAxfLib
BaseMemoryLib
BdsLib
@@ -68,7 +69,11 @@
gArmJunoTokenSpaceGuid.PcdSynopsysUsbEhciBaseAddress
gArmJunoTokenSpaceGuid.PcdSynopsysUsbOhciBaseAddress
- gArmPlatformTokenSpaceGuid.PcdFdtDevicePath
+ gArmJunoTokenSpaceGuid.PcdR0FdtDevicePath
+ gArmJunoTokenSpaceGuid.PcdR1FdtDevicePath
+
+[Pcd]
+ gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths
[Depex]
TRUE
diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxeInternal.h b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxeInternal.h
index a9f58dd00b..c7b1865877 100644
--- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxeInternal.h
+++ b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxeInternal.h
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2013-2014, ARM Limited. All rights reserved.
+* Copyright (c) 2013-2015, ARM Limited. All rights reserved.
*
* This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License
@@ -17,6 +17,9 @@
#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/ArmLib.h>
+#include <Library/AcpiLib.h>
#include <Library/DebugLib.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/UefiBootServicesTableLib.h>