]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressCommon.c
ArmPlatformPkg/ArmVExpressDxe: Identify the current platform
[mirror_edk2.git] / ArmPlatformPkg / ArmVExpressPkg / ArmVExpressDxe / ArmVExpressCommon.c
1 /** @file
2
3 Copyright (c) 2014, ARM Ltd. All rights reserved.
4
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
9
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.
12
13 **/
14
15 #include "ArmVExpressInternal.h"
16
17 /**
18 Get information about the VExpress platform the firmware is running on given its Id.
19
20 @param[in] PlatformId Id of the VExpress platform.
21 @param[out] Platform Address where the pointer to the platform information
22 (type ARM_VEXPRESS_PLATFORM*) should be stored.
23 The returned pointer does not point to an allocated
24 memory area.
25
26 @retval EFI_SUCCESS The platform information was returned.
27 @retval EFI_NOT_FOUND The platform was not recognised.
28
29 **/
30 EFI_STATUS
31 ArmVExpressGetPlatformFromId (
32 IN CONST ARM_VEXPRESS_PLATFORM_ID PlatformId,
33 OUT CONST ARM_VEXPRESS_PLATFORM** Platform
34 )
35 {
36 UINTN Index;
37
38 ASSERT (Platform != NULL);
39
40 for (Index = 0; ArmVExpressPlatforms[Index].Id != ARM_FVP_VEXPRESS_UNKNOWN; Index++) {
41 if (ArmVExpressPlatforms[Index].Id == PlatformId) {
42 *Platform = &ArmVExpressPlatforms[Index];
43 return EFI_SUCCESS;
44 }
45 }
46
47 return EFI_NOT_FOUND;
48 }