]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/DxePiLib.h
Update minor comments for Smbus, PcdLib, PeiServicesLib library instance. And change...
[mirror_edk2.git] / MdePkg / Include / Library / DxePiLib.h
CommitLineData
1c280088 1/** @file\r
2 MDE PI library functions and macros\r
3\r
4 Copyright (c) 2007, Intel Corporation \r
5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
13**/\r
14\r
15#ifndef __PI_LIB_H__\r
16#define __PI_LIB_H__\r
17\r
18#include <Pi/PiFirmwareFile.h>\r
19\r
b0d803fe 20\r
21/**\r
ff197efb 22 Locates a requested firmware section within a file and returns it to a buffer allocated by this function. \r
23\r
24 PiLibGetSectionFromAnyFv () is used to read a specific section from a file within a firmware volume. The function\r
25 will search the first file with the specified name in all firmware volumes in the system. The search order for firmware \r
26 volumes in the system is determistic but abitrary if no new firmware volume is added into the system between \r
27 each calls of this function. \r
28\r
29 After the specific file is located, the function searches the specifc firmware section with type SectionType in this file. \r
30 The details of this search order is defined in description of EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection () \r
31 found in PI Specification.\r
32\r
33 If SectionType is EFI_SECTION_TE, EFI_SECTION_TE is used as section type to start the search. If EFI_SECTION_TE section \r
34 is not found, EFI_SECTION_PE32 will be used to try the search again. If no EFI_SECTION_PE32 section is found, EFI_NOT_FOUND \r
35 is returned.\r
36\r
37 The data and size is returned by Buffer and Size. The caller is responsible to free the Buffer allocated \r
38 by this function. This function can only be called at TPL_NOTIFY and below.\r
39\r
40 If NameGuid is NULL, then ASSERT();\r
41 If Buffer is NULL, then ASSERT();\r
42 If Size is NULL, then ASSERT().\r
43\r
44 @param NameGuid Pointer to an EFI_GUID, which indicates the file name from which the requested \r
45 section will be read. Type EFI_GUID is defined in \r
46 InstallProtocolInterface() in the UEFI 2.0 specification. \r
47 @param SectionType Indicates the section type to return. SectionType in conjunction with \r
48 SectionInstance indicates which section to return. Type \r
49 EFI_SECTION_TYPE is defined in EFI_COMMON_SECTION_HEADER.\r
50 @param SectionInstance Indicates which instance of sections with a type of SectionType to return. \r
51 SectionType in conjunction with SectionInstance indicates which section to \r
52 return. SectionInstance is zero based.\r
53 @param Buffer Pointer to a pointer to a buffer in which the section contents are returned, not \r
54 including the section header. Caller is responsible to free this memory.\r
55 @param Size Pointer to a caller-allocated UINTN. It indicates the size of the memory represented by \r
56 *Buffer.\r
57\r
58 @retval EFI_SUCCESS The image is found and data and size is returned.\r
59 @retval EFI_NOT_FOUND The image specified by NameGuid and SectionType can't be found.\r
60 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the output data buffer or complete the operations.\r
61 @retval EFI_DEVICE_ERROR A hardware error occurs during reading from the Firmware Volume.\r
62 @retval EFI_ACCESS_DENIED The firmware volume containing the searched Firmware File is configured to disallow reads.\r
63\r
f80b0830 64**/\r
b0d803fe 65EFI_STATUS\r
66EFIAPI\r
166152e8 67PiLibGetSectionFromAnyFv (\r
b0d803fe 68 IN CONST EFI_GUID *NameGuid,\r
69 IN EFI_SECTION_TYPE SectionType,\r
ff197efb 70 IN UINTN SectionInstance,\r
b0d803fe 71 OUT VOID **Buffer,\r
72 OUT UINTN *Size\r
ed66e1bc 73 );\r
b0d803fe 74\r
75/**\r
ff197efb 76 Locates a requested firmware section within a file and returns it to a buffer allocated by this function. \r
77\r
78 PiLibGetSectionFromCurrentFv () is used to read a specific section from a file within the same firmware volume from which\r
79 the running image is loaded. If the specific file is found, the function searches the specifc firmware section with type SectionType. \r
80 The details of this search order is defined in description of EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection () \r
81 found in PI Specification.\r
82\r
83 If SectionType is EFI_SECTION_TE, EFI_SECTION_TE is used as section type to start the search. If EFI_SECTION_TE section \r
84 is not found, EFI_SECTION_PE32 will be used to try the search again. If no EFI_SECTION_PE32 section is found, EFI_NOT_FOUND \r
85 is returned.\r
86\r
87 The data and size is returned by Buffer and Size. The caller is responsible to free the Buffer allocated \r
88 by this function. This function can be only called at TPL_NOTIFY and below.\r
89\r
90 If NameGuid is NULL, then ASSERT();\r
91 If Buffer is NULL, then ASSERT();\r
92 If Size is NULL, then ASSERT().\r
93\r
94 @param NameGuid Pointer to an EFI_GUID, which indicates the file name from which the requested \r
95 section will be read. Type EFI_GUID is defined in \r
96 InstallProtocolInterface() in the UEFI 2.0 specification. \r
97 @param SectionType Indicates the section type to return. SectionType in conjunction with \r
98 SectionInstance indicates which section to return. Type \r
99 EFI_SECTION_TYPE is defined in EFI_COMMON_SECTION_HEADER.\r
100 @param SectionInstance Indicates which instance of sections with a type of SectionType to return. \r
101 SectionType in conjunction with SectionInstance indicates which section to \r
102 return. SectionInstance is zero based.\r
103 @param Buffer Pointer to a pointer to a buffer in which the section contents are returned, not \r
104 including the section header. Caller is responsible to free this memory.\r
105 @param Size Pointer to a caller-allocated UINTN. It indicates the size of the memory represented by \r
106 *Buffer.\r
107\r
108\r
109 @retval EFI_SUCCESS The image is found and data and size is returned.\r
110 @retval EFI_UNSUPPORTED FvHandle does not support EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
111 @retval EFI_NOT_FOUND The image specified by NameGuid and SectionType can't be found.\r
112 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the output data buffer or complete the operations.\r
113 @retval EFI_DEVICE_ERROR A hardware error occurs during reading from the Firmware Volume.\r
114 @retval EFI_ACCESS_DENIED The firmware volume containing the searched Firmware File is configured to disallow reads.\r
b0d803fe 115 \r
f80b0830 116**/\r
b0d803fe 117EFI_STATUS\r
118EFIAPI\r
166152e8 119PiLibGetSectionFromCurrentFv (\r
b0d803fe 120 IN CONST EFI_GUID *NameGuid,\r
121 IN EFI_SECTION_TYPE SectionType,\r
ff197efb 122 IN UINTN SectionInstance,\r
b0d803fe 123 OUT VOID **Buffer,\r
124 OUT UINTN *Size\r
ed66e1bc 125 );\r
b0d803fe 126\r
127\r
128/**\r
ff197efb 129 Locates a requested firmware section within a file and returns it to a buffer allocated by this function. \r
130\r
131 PiLibGetSectionFromCurrentFfs () searches the specifc firmware section with type SectionType in the same firmware file from\r
132 which the running image is loaded. The details of this search order is defined in description of \r
133 EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection () found in PI Specification.\r
134\r
135 If SectionType is EFI_SECTION_TE, EFI_SECTION_TE is used as section type to start the search. If EFI_SECTION_TE section \r
136 is not found, EFI_SECTION_PE32 will be used to try the search again. If no EFI_SECTION_PE32 section is found, EFI_NOT_FOUND \r
137 is returned.\r
138\r
139\r
140 The data and size is returned by Buffer and Size. The caller is responsible to free the Buffer allocated \r
141 by this function. This function can only be called at TPL_NOTIFY and below.\r
142\r
143 If Buffer is NULL, then ASSERT();\r
144 If Size is NULL, then ASSERT().\r
145\r
146 @param SectionType Indicates the section type to return. SectionType in conjunction with \r
147 SectionInstance indicates which section to return. Type \r
148 EFI_SECTION_TYPE is defined in EFI_COMMON_SECTION_HEADER.\r
149 @param SectionInstance Indicates which instance of sections with a type of SectionType to return. \r
150 SectionType in conjunction with SectionInstance indicates which section to \r
151 return. SectionInstance is zero based.\r
152 @param Buffer Pointer to a pointer to a buffer in which the section contents are returned, not \r
153 including the section header. Caller is responsible to free this memory.\r
154 @param Size Pointer to a caller-allocated UINTN. It indicates the size of the memory represented by \r
155 *Buffer.\r
156\r
157 @retval EFI_SUCCESS The image is found and data and size is returned.\r
158 @retval EFI_NOT_FOUND The image specified by NameGuid and SectionType can't be found.\r
159 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the output data buffer or complete the operations.\r
160 @retval EFI_DEVICE_ERROR A hardware error occurs during reading from the Firmware Volume.\r
161 @retval EFI_ACCESS_DENIED The firmware volume containing the searched Firmware File is configured to disallow reads.\r
b0d803fe 162 \r
f80b0830 163**/\r
b0d803fe 164EFI_STATUS\r
165EFIAPI\r
166152e8 166PiLibGetSectionFromCurrentFfs (\r
b0d803fe 167 IN EFI_SECTION_TYPE SectionType,\r
ff197efb 168 IN UINTN SectionInstance,\r
b0d803fe 169 OUT VOID **Buffer,\r
170 OUT UINTN *Size\r
ed66e1bc 171 );\r
1c280088 172\r
173#endif\r
174\r