mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
cae7af275e
commit
7aec2926b9
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2011 - 2015, ARM Ltd. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -44,12 +44,14 @@
|
|||
#define SCR_AW (1 << 5)
|
||||
|
||||
// MIDR - Main ID Register definitions
|
||||
#define ARM_CPU_TYPE_SHIFT 4
|
||||
#define ARM_CPU_TYPE_MASK 0xFFF
|
||||
#define ARM_CPU_TYPE_AEMv8 0xD0F
|
||||
#define ARM_CPU_TYPE_A53 0xD03
|
||||
#define ARM_CPU_TYPE_A57 0xD07
|
||||
#define ARM_CPU_TYPE_A15 0xC0F
|
||||
#define ARM_CPU_TYPE_A9 0xC09
|
||||
#define ARM_CPU_TYPE_A7 0xC07
|
||||
#define ARM_CPU_TYPE_A5 0xC05
|
||||
|
||||
#define ARM_CPU_REV_MASK ((0xF << 20) | (0xF) )
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2011-2015, ARM Ltd. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -75,12 +75,15 @@
|
|||
#define SCR_AW (1 << 5)
|
||||
|
||||
// MIDR - Main ID Register definitions
|
||||
#define ARM_CPU_TYPE_SHIFT 4
|
||||
#define ARM_CPU_TYPE_MASK 0xFFF
|
||||
#define ARM_CPU_TYPE_AEMv8 0xD0F
|
||||
#define ARM_CPU_TYPE_A53 0xD03
|
||||
#define ARM_CPU_TYPE_A57 0xD07
|
||||
#define ARM_CPU_TYPE_A15 0xC0F
|
||||
#define ARM_CPU_TYPE_A12 0xC0D
|
||||
#define ARM_CPU_TYPE_A9 0xC09
|
||||
#define ARM_CPU_TYPE_A7 0xC07
|
||||
#define ARM_CPU_TYPE_A5 0xC05
|
||||
|
||||
#define ARM_CPU_REV_MASK ((0xF << 20) | (0xF) )
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -132,22 +135,6 @@
|
|||
# List of Device Paths that support BootMonFs
|
||||
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
|
||||
#
|
||||
|
@ -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" "
|
||||
|
||||
################################################################################
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue