]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/GenericBdsLib/R8Lib.c
Update all files to follow doxygen style file header.
[mirror_edk2.git] / MdeModulePkg / Library / GenericBdsLib / R8Lib.c
CommitLineData
93e3992d 1/**@file
2 Copyright (c) 2007, Intel Corporation
3
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12
13**/
14
15#include "InternalBdsLib.h"
16
17/**
18 Get current boot mode.
19
20 @param HobStart Start pointer of hob list
21 @param BootMode Current boot mode recorded in PHIT hob
22
23 @retval EFI_NOT_FOUND Invalid hob header
24 @retval EFI_SUCCESS Boot mode found
25
26**/
27EFI_STATUS
28R8_GetHobBootMode (
29 IN VOID *HobStart,
30 OUT EFI_BOOT_MODE *BootMode
31 )
32{
33 //
34 // Porting Guide:
35 // This library interface is simply obsolete.
36 // Include the source code to user code.
37 // In fact, since EFI_HANDOFF_HOB must be the first Hob,
38 // the following code can retrieve boot mode.
39 //
40 // EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
41 //
42 // HandOffHob = GetHobList ();
43 // ASSERT (HandOffHob->Header.HobType == EFI_HOB_TYPE_HANDOFF);
44 //
45 // BootMode = HandOffHob->BootMode;
46 //
47 EFI_PEI_HOB_POINTERS Hob;
48
49 Hob.Raw = HobStart;
50 if (Hob.Header->HobType != EFI_HOB_TYPE_HANDOFF) {
51 return EFI_NOT_FOUND;
52 }
53
54 *BootMode = Hob.HandoffInformationTable->BootMode;
55 return EFI_SUCCESS;
56}
57
58
59
60
61/**
62 Get the next guid hob.
63
64 @param HobStart A pointer to the start hob.
65 @param Guid A pointer to a guid.
66 @param Buffer A pointer to the buffer.
67 @param BufferSize Buffer size.
68
69 @retval EFI_NOT_FOUND Next Guid hob not found
70 @retval EFI_SUCCESS Next Guid hob found and data for this Guid got
71 @retval EFI_INVALID_PARAMETER invalid parameter
72
73**/
74EFI_STATUS
75R8_GetNextGuidHob (
76 IN OUT VOID **HobStart,
77 IN EFI_GUID * Guid,
78 OUT VOID **Buffer,
79 OUT UINTN *BufferSize OPTIONAL
80 )
81{
82 //
83 // Porting Guide:
84 // This library interface is changed substantially with R9 counerpart GetNextGuidHob ().
85 // 1. R9 GetNextGuidHob has two parameters and returns the matched GUID HOB from the StartHob.
86 // 2. R9 GetNextGuidHob does not strip the HOB header, so caller is required to apply
87 // GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () to extract the data section and its
88 // size info respectively.
89 // 3. this function does not skip the starting HOB pointer unconditionally:
90 // it returns HobStart back if HobStart itself meets the requirement;
91 // caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.
92 //
93 EFI_PEI_HOB_POINTERS GuidHob;
94
95 if (Buffer == NULL) {
96 return EFI_INVALID_PARAMETER;
97 }
98
99 GuidHob.Raw = GetNextGuidHob (Guid, *HobStart);
100 if (GuidHob.Raw == NULL) {
101 return EFI_NOT_FOUND;
102 }
103
104 *Buffer = GET_GUID_HOB_DATA (GuidHob.Guid);
105 if (BufferSize != NULL) {
106 *BufferSize = GET_GUID_HOB_DATA_SIZE (GuidHob.Guid);
107 }
108
109 *HobStart = GET_NEXT_HOB (GuidHob);
110
111 return EFI_SUCCESS;
112}
113
114