]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/Library/MultiPlatformLib/PlatformInfoHob.c
Upload BSD-licensed Vlv2TbltDevicePkg and Vlv2DeviceRefCodePkg to
[mirror_edk2.git] / Vlv2TbltDevicePkg / Library / MultiPlatformLib / PlatformInfoHob.c
1 /** @file
2 Platform Hob access interface for multiplatform.
3
4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
5
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14
15 **/
16
17 #include <MultiPlatformLib.h>
18
19 /**
20 Returns the Platform Info of the platform from the HOB.
21
22 @param PeiServices General purpose services available to every PEIM.
23 @param PlatformInfoHob Pointer to the PLATFORM_INFO_HOB Pointer
24
25 @retval EFI_SUCCESS The function completed successfully.
26 @retval EFI_NOT_FOUND PlatformInfoHob data doesn't exist, use default instead.
27
28 **/
29 EFI_STATUS
30 GetPlatformInfoHob (
31 IN CONST EFI_PEI_SERVICES **PeiServices,
32 OUT EFI_PLATFORM_INFO_HOB **PlatformInfoHob
33 )
34 {
35 EFI_PEI_HOB_POINTERS GuidHob;
36
37 //
38 // Find the PlatformInfo HOB
39 //
40 GuidHob.Raw = GetHobList ();
41 if (GuidHob.Raw == NULL) {
42 return EFI_NOT_FOUND;
43 }
44
45 if ((GuidHob.Raw = GetNextGuidHob (&gEfiPlatformInfoGuid, GuidHob.Raw)) != NULL) {
46 *PlatformInfoHob = GET_GUID_HOB_DATA (GuidHob.Guid);
47 }
48
49 //
50 // PlatformInfo PEIM should provide this HOB data, if not ASSERT and return error.
51 //
52 ASSERT_EFI_ERROR (*PlatformInfoHob != NULL);
53 if (!(*PlatformInfoHob)) {
54 return EFI_NOT_FOUND;
55 }
56
57 return EFI_SUCCESS;
58 }
59