+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2014, ARM Ltd. All rights reserved.\r
-\r
- This program and the accompanying materials are licensed and made available\r
- under the terms and conditions of the BSD License which accompanies this\r
- distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
- WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "ArmVExpressInternal.h"\r
-#include <Library/ArmPlatformLib.h> // To get Core Count\r
-\r
-//\r
-// Description of the four ARM model platforms :\r
-// Platform ids are defined in ArmVExpressInternal.h for\r
-// all "ArmVExpress-like" platforms (AARCH64 or ARM architecture,\r
-// model or hardware platforms).\r
-//\r
-CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = {\r
- { ARM_FVP_VEXPRESS_A9x4, FixedPcdGetPtr (PcdFdtVExpressFvpA9x4), L"rtsm_ve-cortex_a9x4.dtb" },\r
- { ARM_FVP_VEXPRESS_A15x1, FixedPcdGetPtr (PcdFdtVExpressFvpA15x1), L"rtsm_ve-cortex_a15x1.dtb" },\r
- { ARM_FVP_VEXPRESS_A15x2, FixedPcdGetPtr (PcdFdtVExpressFvpA15x2), L"rtsm_ve-cortex_a15x2.dtb" },\r
- { ARM_FVP_VEXPRESS_A15x4, FixedPcdGetPtr (PcdFdtVExpressFvpA15x4), L"rtsm_ve-cortex_a15x4.dtb" },\r
- { ARM_FVP_VEXPRESS_UNKNOWN, }\r
-};\r
-\r
-/**\r
- Get information about the VExpress platform the firmware is running on.\r
-\r
- @param[out] Platform Address where the pointer to the platform information\r
- (type ARM_VEXPRESS_PLATFORM*) should be stored.\r
- The returned pointer does not point to an allocated\r
- memory area.\r
-\r
- @retval EFI_SUCCESS The platform information was returned.\r
- @retval EFI_NOT_FOUND The platform was not recognised.\r
-\r
-**/\r
-EFI_STATUS\r
-ArmVExpressGetPlatform (\r
- OUT CONST ARM_VEXPRESS_PLATFORM** Platform\r
- )\r
-{\r
- UINT32 SysId;\r
- UINTN CpuType;\r
- EFI_STATUS Status;\r
- UINTN CoreCount;\r
-\r
- ASSERT (Platform != NULL);\r
-\r
- CpuType = 0;\r
- Status = EFI_NOT_FOUND;\r
- *Platform = NULL;\r
-\r
- SysId = MmioRead32 (ARM_VE_SYS_ID_REG);\r
- if (SysId == ARM_RTSM_SYS_ID) {\r
- // Get the Cortex-A version\r
- CpuType = (ArmReadMidr () >> 4) & ARM_CPU_TYPE_MASK;\r
- if (CpuType == ARM_CPU_TYPE_A9) {\r
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_A9x4, Platform);\r
- } else if (CpuType == ARM_CPU_TYPE_A15) {\r
- CoreCount = ArmGetCpuCountPerCluster ();\r
- if (CoreCount == 1) {\r
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_A15x1, Platform);\r
- } else if (CoreCount == 2) {\r
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_A15x2, Platform);\r
- } else if (CoreCount == 4) {\r
- Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_A15x4, Platform);\r
- }\r
- }\r
- }\r
-\r
- if (EFI_ERROR (Status)) {\r
- DEBUG ((EFI_D_ERROR, "Unsupported platform (SysId:0x%X, CpuType:0x%X)\n", SysId, CpuType));\r
- ASSERT_EFI_ERROR (Status);\r
- }\r
-\r
- return Status;\r
-}\r