]>
Commit | Line | Data |
---|---|---|
dff72027 OM |
1 | /** @file\r |
2 | \r | |
3 | Copyright (c) 2014-2015, ARM Ltd. All rights reserved.\r | |
4 | \r | |
5 | This program and the accompanying materials are licensed and made available\r | |
6 | under the terms and conditions of the BSD License which accompanies this\r | |
7 | distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r | |
11 | WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include "ArmVExpressInternal.h"\r | |
d0c1d371 | 16 | #include <Library/ArmGicLib.h>\r |
dff72027 OM |
17 | \r |
18 | //\r | |
d0c1d371 | 19 | // Description of the AARCH64 model platforms :\r |
dff72027 OM |
20 | // Platform ids are defined in ArmVExpressInternal.h for\r |
21 | // all "ArmVExpress-like" platforms (AARCH64 or ARM architecture,\r | |
22 | // model or hardware platforms).\r | |
23 | //\r | |
24 | CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = {\r | |
5af5259c AB |
25 | { ARM_FVP_VEXPRESS_AEMv8x4, FixedPcdGetPtr(PcdFdtFvpVExpressAEMv8x4), L"rtsm_ve-aemv8a.dtb" }, |
26 | { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2, FixedPcdGetPtr(PcdFdtFvpBaseAEMv8x4GicV2), L"fvp-base-gicv2-psci.dtb" }, | |
27 | { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY, FixedPcdGetPtr(PcdFdtFvpBaseAEMv8x4GicV2Legacy), L"fvp-base-gicv2legacy-psci.dtb" }, | |
28 | { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3, FixedPcdGetPtr(PcdFdtFvpBaseAEMv8x4GicV3), L"fvp-base-gicv3-psci.dtb" }, | |
29 | { ARM_FVP_FOUNDATION_GICV2, FixedPcdGetPtr(PcdFdtFvpFoundationGicV2), L"fvp-foundation-gicv2-psci.dtb" }, | |
30 | { ARM_FVP_FOUNDATION_GICV2_LEGACY, FixedPcdGetPtr(PcdFdtFvpFoundationGicV2Legacy), L"fvp-foundation-gicv2legacy-psci.dtb" }, | |
31 | { ARM_FVP_FOUNDATION_GICV3, FixedPcdGetPtr(PcdFdtFvpFoundationGicV3), L"fvp-foundation-gicv3-psci.dtb" }, | |
32 | { ARM_FVP_VEXPRESS_UNKNOWN } | |
dff72027 OM |
33 | };\r |
34 | \r | |
35 | /**\r | |
36 | Get information about the VExpress platform the firmware is running on.\r | |
37 | \r | |
38 | @param[out] Platform Address where the pointer to the platform information\r | |
39 | (type ARM_VEXPRESS_PLATFORM*) should be stored.\r | |
40 | The returned pointer does not point to an allocated\r | |
41 | memory area.\r | |
42 | \r | |
43 | @retval EFI_SUCCESS The platform information was returned.\r | |
44 | @retval EFI_NOT_FOUND The platform was not recognised.\r | |
45 | \r | |
46 | **/\r | |
47 | EFI_STATUS\r | |
48 | ArmVExpressGetPlatform (\r | |
49 | OUT CONST ARM_VEXPRESS_PLATFORM** Platform\r | |
50 | )\r | |
51 | {\r | |
52 | EFI_STATUS Status;\r | |
53 | UINT32 SysId;\r | |
d0c1d371 OM |
54 | UINT32 FvpSysId;\r |
55 | UINT32 VariantSysId;\r | |
56 | ARM_GIC_ARCH_REVISION GicRevision;\r | |
dff72027 OM |
57 | \r |
58 | ASSERT (Platform != NULL);\r | |
59 | \r | |
60 | Status = EFI_NOT_FOUND;\r | |
61 | \r | |
62 | SysId = MmioRead32 (ARM_VE_SYS_ID_REG);\r | |
63 | if (SysId != ARM_RTSM_SYS_ID) {\r | |
d0c1d371 OM |
64 | // Remove the GIC variant to identify if we are running on the FVP Base or\r |
65 | // Foundation models\r | |
66 | FvpSysId = SysId & (ARM_FVP_SYS_ID_HBI_MASK |\r | |
67 | ARM_FVP_SYS_ID_PLAT_MASK );\r | |
68 | // Extract the variant from the SysId\r | |
69 | VariantSysId = SysId & ARM_FVP_SYS_ID_VARIANT_MASK;\r | |
70 | \r | |
71 | if (FvpSysId == ARM_FVP_BASE_BOARD_SYS_ID) {\r | |
72 | if (VariantSysId == ARM_FVP_GIC_VE_MMAP) {\r | |
73 | // FVP Base Model with legacy GIC memory map\r | |
74 | Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY, Platform);\r | |
75 | } else {\r | |
76 | GicRevision = ArmGicGetSupportedArchRevision ();\r | |
77 | \r | |
78 | if (GicRevision == ARM_GIC_ARCH_REVISION_2) {\r | |
79 | // FVP Base Model with GICv2 support\r | |
80 | Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2, Platform);\r | |
81 | } else {\r | |
82 | // FVP Base Model with GICv3 support\r | |
83 | Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3, Platform);\r | |
84 | }\r | |
85 | }\r | |
86 | } else if (FvpSysId == ARM_FVP_FOUNDATION_BOARD_SYS_ID) {\r | |
87 | if (VariantSysId == ARM_FVP_GIC_VE_MMAP) {\r | |
88 | // FVP Foundation Model with legacy GIC memory map\r | |
89 | Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV2_LEGACY, Platform);\r | |
90 | } else {\r | |
91 | GicRevision = ArmGicGetSupportedArchRevision ();\r | |
92 | \r | |
93 | if (GicRevision == ARM_GIC_ARCH_REVISION_2) {\r | |
94 | // FVP Foundation Model with GICv2\r | |
95 | Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV2, Platform);\r | |
96 | } else {\r | |
97 | // FVP Foundation Model with GICv3\r | |
98 | Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV3, Platform);\r | |
99 | }\r | |
100 | }\r | |
dff72027 OM |
101 | }\r |
102 | } else {\r | |
d0c1d371 | 103 | // FVP Versatile Express AEMv8\r |
dff72027 OM |
104 | Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_AEMv8x4, Platform);\r |
105 | }\r | |
106 | \r | |
107 | if (EFI_ERROR (Status)) {\r | |
108 | DEBUG ((EFI_D_ERROR, "Unsupported AArch64 RTSM (SysId:0x%X).\n", SysId));\r | |
109 | ASSERT_EFI_ERROR (Status);\r | |
110 | }\r | |
111 | \r | |
112 | return Status;\r | |
113 | }\r |