]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/DxePiLib.h
Use doxygen comment style for document entity such as struct, enum, variable that...
[mirror_edk2.git] / MdePkg / Include / Library / DxePiLib.h
1 /** @file
2 MDE PI library functions and macros
3
4 Copyright (c) 2007, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this 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,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef __PI_LIB_H__
16 #define __PI_LIB_H__
17
18 #include <Pi/PiFirmwareFile.h>
19
20
21 /**
22 Allocate and fill a buffer from the Firmware Section identified by a Firmware File GUID name and a Firmware
23 Section type and instance number from any Firmware Volumes in the system.
24
25 The function will read the first Firmware Section sepcifed by NameGuid, SectionType and Instance by searching
26 for all Firmware Volumes in the system.
27
28 The search order for Firmware Volumes in the system is determistic but abitrary if no new Firmware Volume is installed
29 into the system. The search order for the section specified by SectionType within a Firmware File is defined by
30 EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection (). Please check Section 2.4 of Volume 3: Platform Initialization
31 Shared Architectural Elements for detailes.
32
33 If SectionType is EFI_SECTION_TE, EFI_SECTION_TE will be used as Firmware Section type to read Firmware Section
34 data from the Firmware File. If no such section exists, EFI_SECTION_PE32 will be used as Firmware Section type to
35 read Firmware Section data from the Firmware File. If no such section specified is found to match ,
36 EFI_NOT_FOUND is returned.
37
38 The data and size is returned by Buffer and Size. The caller is responsible to free the Buffer allocated
39 by this function. This function can only be called at TPL_NOTIFY and below.
40
41 If NameGuid is NULL, then ASSERT();
42 If Buffer is NULL, then ASSERT();
43 If Size is NULL, then ASSERT().
44
45 @param NameGuid The GUID name of a Firmware File.
46 @param SectionType The Firmware Section type.
47 @param Instance The instance number of Firmware Section to read from starting from 0.
48 @param Buffer On output, Buffer contains the the data read from the section in the Firmware File found.
49 @param Size On output, the size of Buffer.
50
51 @retval EFI_SUCCESS The image is found and data and size is returned.
52 @retval EFI_NOT_FOUND The image specified by NameGuid and SectionType can't be found.
53 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the output data buffer or complete the operations.
54 @retval EFI_DEVICE_ERROR A hardware error occurs during reading from the Firmware Volume.
55 @retval EFI_ACCESS_DENIED The firmware volume containing the searched Firmware File is configured to disallow reads.
56
57 **/
58 EFI_STATUS
59 EFIAPI
60 PiLibGetSectionFromAnyFv (
61 IN CONST EFI_GUID *NameGuid,
62 IN EFI_SECTION_TYPE SectionType,
63 IN UINTN Instance,
64 OUT VOID **Buffer,
65 OUT UINTN *Size
66 )
67 ;
68
69 /**
70 Allocate and fill a buffer from a Firmware Section identified by a Firmware File GUID name, a Firmware
71 Section type and instance number from the same Firmware Volume with the caller's FFS.
72
73 This functions first locates the EFI_FIRMWARE_VOLUME2_PROTOCOL protocol instance for same Firmrware Volume
74 which also contains the FFS of the caller in order to carry out the Firmware Volume read operation.
75 The function then reads the Firmware Section found sepcifed by NameGuid, SectionType and Instance.
76
77 The search order for the section specified by SectionType within a Firmware File is defined by
78 EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection (). Please check Section 2.4 of Volume 3: Platform Initialization
79 Shared Architectural Elements for detailes.
80
81 If SectionType is EFI_SECTION_TE, EFI_SECTION_TE will be used as Firmware Section type to read Firmware Section
82 data from the Firmware File. If no such section exists, EFI_SECTION_PE32 will be used as Firmware Section type to
83 read Firmware Section data from the Firmware File. If no such section specified is found to match ,
84 EFI_NOT_FOUND is returned.
85
86 The data and size is returned by Buffer and Size. The caller is responsible to free the Buffer allocated
87 by this function. This function can be only called at TPL_NOTIFY and below.
88
89 If FvHandle is NULL, then ASSERT ();
90 If NameGuid is NULL, then ASSERT();
91 If Buffer is NULL, then ASSERT();
92 If Size is NULL, then ASSERT().
93
94 @param NameGuid The GUID name of a Firmware File.
95 @param SectionType The Firmware Section type.
96 @param Instance The instance number of Firmware Section to read from starting from 0.
97 @param Buffer On output, Buffer contains the the data read from the section in the Firmware File found.
98 @param Size On output, the size of Buffer.
99
100 @retval EFI_SUCCESS The image is found and data and size is returned.
101 @retval EFI_UNSUPPORTED FvHandle does not support EFI_FIRMWARE_VOLUME2_PROTOCOL.
102 @retval EFI_NOT_FOUND The image specified by NameGuid and SectionType can't be found.
103 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the output data buffer or complete the operations.
104 @retval EFI_DEVICE_ERROR A hardware error occurs during reading from the Firmware Volume.
105 @retval EFI_ACCESS_DENIED The firmware volume containing the searched Firmware File is configured to disallow reads.
106
107 **/
108 EFI_STATUS
109 EFIAPI
110 PiLibGetSectionFromCurrentFv (
111 IN CONST EFI_GUID *NameGuid,
112 IN EFI_SECTION_TYPE SectionType,
113 IN UINTN Instance,
114 OUT VOID **Buffer,
115 OUT UINTN *Size
116 )
117 ;
118
119
120 /**
121 Allocate and fill a buffer from the first Firmware Section in the same Firmware File as the caller of this function.
122
123 The function will read the first Firmware Section found sepcifed by NameGuid and SectionType from the
124 Firmware Volume specified by FvHandle. On this FvHandle, an EFI_FIRMWARE_VOLUME2_PROTOCOL protocol instance
125 should be located succesfully in order to carry out the Firmware Volume operations.
126
127 The search order for the section type specified by SectionType in the Firmware File is using a depth-first
128 and left-to-right algorithm through all sections. The first section found to match SectionType will be returned.
129
130 If SectionType is EFI_SECTION_PE32, EFI_SECTION_PE32 will be used as Firmware Section type
131 to read Firmware Section data from the Firmware File. If no such section exists, the function will try
132 to read a Firmware File named with NameGuid. If no such file exists, EFI_NOT_FOUND is returned.
133
134 If SectionType is EFI_SECTION_TE, EFI_SECTION_TE will be used as Firmware Section type to read Firmware Section
135 data from the Firmware File. If no such section exists, EFI_SECTION_PE32 will be used as Firmware Section type to
136 read Firmware Section data from the Firmware File. If no such section exists, the function will try to read a Firmware
137 File named with NameGuid. If no such file exists, EFI_NOT_FOUND is returned.
138
139 The data and size is returned by Buffer and Size. The caller is responsible to free the Buffer allocated
140 by this function. This function can only be called at TPL_NOTIFY and below.
141
142 If Buffer is NULL, then ASSERT();
143 If Size is NULL, then ASSERT().
144
145 @param SectionType The Firmware Section type.
146 @param Instance Instance number of a section.
147 @param Buffer On output, Buffer contains the the data read from the section in the Firmware File found.
148 @param Size On output, the size of Buffer.
149
150 @retval EFI_SUCCESS The image is found and data and size is returned.
151 @retval EFI_NOT_FOUND The image specified by NameGuid and SectionType can't be found.
152 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the output data buffer or complete the operations.
153 @retval EFI_DEVICE_ERROR A hardware error occurs during reading from the Firmware Volume.
154 @retval EFI_ACCESS_DENIED The firmware volume containing the searched Firmware File is configured to disallow reads.
155
156 **/
157 EFI_STATUS
158 EFIAPI
159 PiLibGetSectionFromCurrentFfs (
160 IN EFI_SECTION_TYPE SectionType,
161 IN UINTN Instance,
162 OUT VOID **Buffer,
163 OUT UINTN *Size
164 )
165 ;
166
167 #endif
168