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