ArmPlatformPkg/ArmVExpressPkg: Added support to differentiate ARMv8 FVP variants

There are three FVP variants for the Base and Foundation models:
- model with GICv2 legacy memory map (same location as the Versatile Express model)
- model with GICv2 and Base model memory map
- model with GICv3 and Base model memory map

The new code detects the variants to load the appropriate device tree.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16932 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Olivier Martin 2015-02-25 19:15:39 +00:00 committed by oliviermartin
parent dff720276a
commit d0c1d371fb
5 changed files with 75 additions and 20 deletions

View File

@ -13,9 +13,10 @@
**/ **/
#include "ArmVExpressInternal.h" #include "ArmVExpressInternal.h"
#include <Library/ArmGicLib.h>
// //
// Description of the two AARCH64 model platforms : // Description of the AARCH64 model platforms :
// just the platform id for the time being. // just the platform id for the time being.
// Platform ids are defined in ArmVExpressInternal.h for // Platform ids are defined in ArmVExpressInternal.h for
// all "ArmVExpress-like" platforms (AARCH64 or ARM architecture, // all "ArmVExpress-like" platforms (AARCH64 or ARM architecture,
@ -23,8 +24,12 @@
// //
CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = { CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = {
{ ARM_FVP_VEXPRESS_AEMv8x4 }, { ARM_FVP_VEXPRESS_AEMv8x4 },
{ ARM_FVP_BASE_AEMv8x4_AEMv8x4 }, { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2 },
{ ARM_FVP_FOUNDATION }, { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY },
{ ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3 },
{ ARM_FVP_FOUNDATION_GICV2 },
{ ARM_FVP_FOUNDATION_GICV2_LEGACY },
{ ARM_FVP_FOUNDATION_GICV3 },
{ ARM_FVP_VEXPRESS_UNKNOWN } { ARM_FVP_VEXPRESS_UNKNOWN }
}; };
@ -47,6 +52,9 @@ ArmVExpressGetPlatform (
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT32 SysId; UINT32 SysId;
UINT32 FvpSysId;
UINT32 VariantSysId;
ARM_GIC_ARCH_REVISION GicRevision;
ASSERT (Platform != NULL); ASSERT (Platform != NULL);
@ -54,15 +62,46 @@ ArmVExpressGetPlatform (
SysId = MmioRead32 (ARM_VE_SYS_ID_REG); SysId = MmioRead32 (ARM_VE_SYS_ID_REG);
if (SysId != ARM_RTSM_SYS_ID) { if (SysId != ARM_RTSM_SYS_ID) {
// Take out the FVP GIC variant to reduce the permutations. The GIC driver // Remove the GIC variant to identify if we are running on the FVP Base or
// detects the version and does the right thing. // Foundation models
SysId &= ~ARM_FVP_SYS_ID_VARIANT_MASK; FvpSysId = SysId & (ARM_FVP_SYS_ID_HBI_MASK |
if (SysId == (ARM_FVP_BASE_SYS_ID & ~ARM_FVP_SYS_ID_VARIANT_MASK)) { ARM_FVP_SYS_ID_PLAT_MASK );
Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4, Platform); // Extract the variant from the SysId
} else if (SysId == (ARM_FVP_FOUNDATION_SYS_ID & ~ARM_FVP_SYS_ID_VARIANT_MASK)) { VariantSysId = SysId & ARM_FVP_SYS_ID_VARIANT_MASK;
Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION, Platform);
if (FvpSysId == ARM_FVP_BASE_BOARD_SYS_ID) {
if (VariantSysId == ARM_FVP_GIC_VE_MMAP) {
// FVP Base Model with legacy GIC memory map
Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY, Platform);
} else {
GicRevision = ArmGicGetSupportedArchRevision ();
if (GicRevision == ARM_GIC_ARCH_REVISION_2) {
// FVP Base Model with GICv2 support
Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2, Platform);
} else {
// FVP Base Model with GICv3 support
Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3, Platform);
}
}
} else if (FvpSysId == ARM_FVP_FOUNDATION_BOARD_SYS_ID) {
if (VariantSysId == ARM_FVP_GIC_VE_MMAP) {
// FVP Foundation Model with legacy GIC memory map
Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV2_LEGACY, Platform);
} else {
GicRevision = ArmGicGetSupportedArchRevision ();
if (GicRevision == ARM_GIC_ARCH_REVISION_2) {
// FVP Foundation Model with GICv2
Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV2, Platform);
} else {
// FVP Foundation Model with GICv3
Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV3, Platform);
}
}
} }
} else { } else {
// FVP Versatile Express AEMv8
Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_AEMv8x4, Platform); Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_AEMv8x4, Platform);
} }

View File

@ -1,6 +1,6 @@
#/** @file #/** @file
# #
# Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR> # Copyright (c) 2013-2015, ARM Ltd. All rights reserved.<BR>
# #
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
@ -45,3 +45,6 @@
UefiDriverEntryPoint UefiDriverEntryPoint
UefiBootServicesTableLib UefiBootServicesTableLib
VirtioMmioDeviceLib VirtioMmioDeviceLib
[LibraryClasses.AARCH64]
ArmGicLib

View File

@ -36,8 +36,12 @@ typedef enum {
ARM_FVP_VEXPRESS_A15x1_A7x1, ARM_FVP_VEXPRESS_A15x1_A7x1,
ARM_FVP_VEXPRESS_A15x4_A7x4, ARM_FVP_VEXPRESS_A15x4_A7x4,
ARM_FVP_VEXPRESS_AEMv8x4, ARM_FVP_VEXPRESS_AEMv8x4,
ARM_FVP_BASE_AEMv8x4_AEMv8x4, ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2,
ARM_FVP_FOUNDATION, ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY,
ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3,
ARM_FVP_FOUNDATION_GICV2,
ARM_FVP_FOUNDATION_GICV2_LEGACY,
ARM_FVP_FOUNDATION_GICV3,
ARM_HW_A9x4, ARM_HW_A9x4,
ARM_HW_A15x2_A7x3, ARM_HW_A15x2_A7x3,
ARM_HW_A15, ARM_HW_A15,

View File

@ -1,7 +1,7 @@
/** @file /** @file
* Header defining Versatile Express constants (Base addresses, sizes, flags) * Header defining Versatile Express constants (Base addresses, sizes, flags)
* *
* Copyright (c) 2011-2014, ARM Limited. All rights reserved. * Copyright (c) 2011-2015, ARM Limited. All rights reserved.
* *
* This program and the accompanying materials * This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License * are licensed and made available under the terms and conditions of the BSD License
@ -121,11 +121,20 @@
//GICH 0x2c004000 0x2c010000 //GICH 0x2c004000 0x2c010000
//GICV 0x2c006000 0x2c020000 //GICV 0x2c006000 0x2c020000
#define ARM_FVP_BASE_BOARD_SYS_ID (0x00200100)
#define ARM_FVP_FOUNDATION_BOARD_SYS_ID (0x00100100)
#define ARM_FVP_SYS_ID_REV_MASK (UINT32)(0xFUL << 28)
#define ARM_FVP_SYS_ID_HBI_MASK (UINT32)(0xFFFUL << 16)
#define ARM_FVP_SYS_ID_VARIANT_MASK (UINT32)(0xFUL << 12)
#define ARM_FVP_SYS_ID_PLAT_MASK (UINT32)(0xFUL << 8 )
#define ARM_FVP_SYS_ID_FPGA_MASK (UINT32)(0xFFUL << 0 )
#define ARM_FVP_GIC_VE_MMAP 0x0
#define ARM_FVP_GIC_BASE_MMAP (UINT32)(1 << 12)
// The default SYS_IDs. These can be changed when starting the model. // The default SYS_IDs. These can be changed when starting the model.
#define ARM_RTSM_SYS_ID (0x225F500) #define ARM_RTSM_SYS_ID (0x225F500)
#define ARM_FVP_BASE_SYS_ID (0x00201100) #define ARM_FVP_BASE_SYS_ID (ARM_FVP_BASE_BOARD_SYS_ID | ARM_FVP_GIC_BASE_MMAP)
#define ARM_FVP_FOUNDATION_SYS_ID (0x00101100) #define ARM_FVP_FOUNDATION_SYS_ID (ARM_FVP_FOUNDATION_BOARD_SYS_ID | ARM_FVP_GIC_BASE_MMAP)
#define ARM_FVP_SYS_ID_VARIANT_MASK (UINT32)(0xFUL << 12)
#endif /* VEXPRESSMOTHERBOARD_H_ */ #endif /* VEXPRESSMOTHERBOARD_H_ */

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2011-2013, ARM Ltd. All rights reserved.<BR> Copyright (c) 2011-2015, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -269,7 +269,7 @@ LcdPlatformSetMode (
if (SysId != ARM_RTSM_SYS_ID) { if (SysId != ARM_RTSM_SYS_ID) {
// Take out the FVP GIC variant to reduce the permutations. // Take out the FVP GIC variant to reduce the permutations.
SysId &= ~ARM_FVP_SYS_ID_VARIANT_MASK; SysId &= ~ARM_FVP_SYS_ID_VARIANT_MASK;
if (SysId != (ARM_FVP_BASE_SYS_ID & ~ARM_FVP_SYS_ID_VARIANT_MASK)) { if (SysId != ARM_FVP_BASE_BOARD_SYS_ID) {
// Set the DVI into the new mode // Set the DVI into the new mode
Status = ArmPlatformSysConfigSet (SYS_CFG_DVIMODE, mResolutions[ModeNumber].Mode); Status = ArmPlatformSysConfigSet (SYS_CFG_DVIMODE, mResolutions[ModeNumber].Mode);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {