3 Copyright (c) 2014-2015, ARM Ltd. All rights reserved.
5 This program and the accompanying materials are licensed and made available
6 under the terms and conditions of the BSD License which accompanies this
7 distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
11 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "ArmVExpressInternal.h"
16 #include <Library/ArmGicLib.h>
19 // Description of the AARCH64 model platforms :
20 // just the platform id for the time being.
21 // Platform ids are defined in ArmVExpressInternal.h for
22 // all "ArmVExpress-like" platforms (AARCH64 or ARM architecture,
23 // model or hardware platforms).
25 CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms
[] = {
26 { ARM_FVP_VEXPRESS_AEMv8x4
, { 0x240d627e, 0xeb4d, 0x447d, { 0x86, 0x30, 0xf2, 0x12, 0x3b, 0xc3, 0x89, 0x3f } }, L
"rtsm_ve-aemv8a.dtb" },
27 { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2
, { 0xfbed0b94, 0x3c81, 0x49e4, { 0xbd, 0xec, 0xd4, 0xf4, 0xa8, 0x47, 0xeb, 0x51 } }, L
"fvp-base-gicv2-psci.dtb" },
28 { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY
, { 0x6d8dfd91, 0x431a, 0x4e6c, { 0x84, 0x5a, 0x15, 0xf1, 0xfc, 0x8d, 0x9b, 0xe2 } }, L
"fvp-base-gicv2legacy-psci.dtb" },
29 { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3
, { 0xa8ac2953, 0xc4bb, 0x4914, { 0x87, 0xf5, 0xc5, 0x97, 0x5d, 0x7b, 0x32, 0xd1 } }, L
"fvp-base-gicv3-psci.dtb" },
30 { ARM_FVP_FOUNDATION_GICV2
, { 0x4328cb83, 0x6e50, 0x4cb8, { 0xaa, 0x8c, 0xfb, 0x7a, 0xba, 0xba, 0x37, 0xd8 } }, L
"fvp-foundation-gicv2-psci.dtb" },
31 { ARM_FVP_FOUNDATION_GICV2_LEGACY
, { 0x6af00d18, 0x6dfe, 0x45ed, { 0xa6, 0xc4, 0xb4, 0x4d, 0x57, 0xfd, 0xd8, 0xf5 } }, L
"fvp-foundation-gicv2legacy-psci.dtb" },
32 { ARM_FVP_FOUNDATION_GICV3
, { 0x4a17b7fa, 0xf052, 0x4dc1, { 0x92, 0x79, 0x43, 0x80, 0x92, 0x41, 0xf9, 0x98 } }, L
"fvp-foundation-gicv3-psci.dtb" },
33 { ARM_FVP_VEXPRESS_UNKNOWN
, { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } } }
37 Get information about the VExpress platform the firmware is running on.
39 @param[out] Platform Address where the pointer to the platform information
40 (type ARM_VEXPRESS_PLATFORM*) should be stored.
41 The returned pointer does not point to an allocated
44 @retval EFI_SUCCESS The platform information was returned.
45 @retval EFI_NOT_FOUND The platform was not recognised.
49 ArmVExpressGetPlatform (
50 OUT CONST ARM_VEXPRESS_PLATFORM
** Platform
57 ARM_GIC_ARCH_REVISION GicRevision
;
59 ASSERT (Platform
!= NULL
);
61 Status
= EFI_NOT_FOUND
;
63 SysId
= MmioRead32 (ARM_VE_SYS_ID_REG
);
64 if (SysId
!= ARM_RTSM_SYS_ID
) {
65 // Remove the GIC variant to identify if we are running on the FVP Base or
67 FvpSysId
= SysId
& (ARM_FVP_SYS_ID_HBI_MASK
|
68 ARM_FVP_SYS_ID_PLAT_MASK
);
69 // Extract the variant from the SysId
70 VariantSysId
= SysId
& ARM_FVP_SYS_ID_VARIANT_MASK
;
72 if (FvpSysId
== ARM_FVP_BASE_BOARD_SYS_ID
) {
73 if (VariantSysId
== ARM_FVP_GIC_VE_MMAP
) {
74 // FVP Base Model with legacy GIC memory map
75 Status
= ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY
, Platform
);
77 GicRevision
= ArmGicGetSupportedArchRevision ();
79 if (GicRevision
== ARM_GIC_ARCH_REVISION_2
) {
80 // FVP Base Model with GICv2 support
81 Status
= ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2
, Platform
);
83 // FVP Base Model with GICv3 support
84 Status
= ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3
, Platform
);
87 } else if (FvpSysId
== ARM_FVP_FOUNDATION_BOARD_SYS_ID
) {
88 if (VariantSysId
== ARM_FVP_GIC_VE_MMAP
) {
89 // FVP Foundation Model with legacy GIC memory map
90 Status
= ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV2_LEGACY
, Platform
);
92 GicRevision
= ArmGicGetSupportedArchRevision ();
94 if (GicRevision
== ARM_GIC_ARCH_REVISION_2
) {
95 // FVP Foundation Model with GICv2
96 Status
= ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV2
, Platform
);
98 // FVP Foundation Model with GICv3
99 Status
= ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV3
, Platform
);
104 // FVP Versatile Express AEMv8
105 Status
= ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_AEMv8x4
, Platform
);
108 if (EFI_ERROR (Status
)) {
109 DEBUG ((EFI_D_ERROR
, "Unsupported AArch64 RTSM (SysId:0x%X).\n", SysId
));
110 ASSERT_EFI_ERROR (Status
);