]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/AArch64/ArmFvpDxeAArch64.c
ArmPlatformPkg/ArmVExpressDxe: Identify the current platform
[mirror_edk2.git] / ArmPlatformPkg / ArmVExpressPkg / ArmVExpressDxe / AArch64 / ArmFvpDxeAArch64.c
CommitLineData
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
16\r
17//\r
18// Description of the two AARCH64 model platforms :\r
19// just the platform id for the time being.\r
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
24CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = {\r
25 { ARM_FVP_VEXPRESS_AEMv8x4 },\r
26 { ARM_FVP_BASE_AEMv8x4_AEMv8x4 },\r
27 { ARM_FVP_FOUNDATION },\r
28 { ARM_FVP_VEXPRESS_UNKNOWN }\r
29};\r
30\r
31/**\r
32 Get information about the VExpress platform the firmware is running on.\r
33\r
34 @param[out] Platform Address where the pointer to the platform information\r
35 (type ARM_VEXPRESS_PLATFORM*) should be stored.\r
36 The returned pointer does not point to an allocated\r
37 memory area.\r
38\r
39 @retval EFI_SUCCESS The platform information was returned.\r
40 @retval EFI_NOT_FOUND The platform was not recognised.\r
41\r
42**/\r
43EFI_STATUS\r
44ArmVExpressGetPlatform (\r
45 OUT CONST ARM_VEXPRESS_PLATFORM** Platform\r
46 )\r
47{\r
48 EFI_STATUS Status;\r
49 UINT32 SysId;\r
50\r
51 ASSERT (Platform != NULL);\r
52\r
53 Status = EFI_NOT_FOUND;\r
54\r
55 SysId = MmioRead32 (ARM_VE_SYS_ID_REG);\r
56 if (SysId != ARM_RTSM_SYS_ID) {\r
57 // Take out the FVP GIC variant to reduce the permutations. The GIC driver\r
58 // detects the version and does the right thing.\r
59 SysId &= ~ARM_FVP_SYS_ID_VARIANT_MASK;\r
60 if (SysId == (ARM_FVP_BASE_SYS_ID & ~ARM_FVP_SYS_ID_VARIANT_MASK)) {\r
61 Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4, Platform);\r
62 } else if (SysId == (ARM_FVP_FOUNDATION_SYS_ID & ~ARM_FVP_SYS_ID_VARIANT_MASK)) {\r
63 Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION, Platform);\r
64 }\r
65 } else {\r
66 Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_AEMv8x4, Platform);\r
67 }\r
68\r
69 if (EFI_ERROR (Status)) {\r
70 DEBUG ((EFI_D_ERROR, "Unsupported AArch64 RTSM (SysId:0x%X).\n", SysId));\r
71 ASSERT_EFI_ERROR (Status);\r
72 }\r
73\r
74 return Status;\r
75}\r