]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c
Add doxygen style comments for functions in DxeMain.
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / SectionExtraction / CoreSectionExtraction.c
Content-type: text/html ]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c


500 - Internal Server Error

Malformed UTF-8 character (fatal) at (eval 6) line 1, <$fd> line 593.
CommitLineData
162ed594 1/** @file\r
28a00297 2 Section Extraction Protocol implementation.\r
3 \r
4 Stream database is implemented as a linked list of section streams,\r
5 where each stream contains a linked list of children, which may be leaves or\r
6 encapsulations. \r
7 \r
8 Children that are encapsulations generate new stream entries\r
9 when they are created. Streams can also be created by calls to \r
10 SEP->OpenSectionStream().\r
11 \r
12 The database is only created far enough to return the requested data from\r
13 any given stream, or to determine that the requested data is not found.\r
14 \r
15 If a GUIDed encapsulation is encountered, there are three possiblilites.\r
16 \r
17 1) A support protocol is found, in which the stream is simply processed with\r
18 the support protocol.\r
19 \r
20 2) A support protocol is not found, but the data is available to be read\r
21 without processing. In this case, the database is built up through the\r
22 recursions to return the data, and a RPN event is set that will enable\r
23 the stream in question to be refreshed if and when the required section\r
24 extraction protocol is published.This insures the AuthenticationStatus \r
25 does not become stale in the cache.\r
26 \r
27 3) A support protocol is not found, and the data is not available to be read\r
28 without it. This results in EFI_PROTOCOL_ERROR.\r
797a9d67 29 \r
162ed594 30Copyright (c) 2006 - 2008, Intel Corporation \r
797a9d67 31All rights reserved. This program and the accompanying materials \r
32are licensed and made available under the terms and conditions of the BSD License \r
33which accompanies this distribution. The full text of the license may be found at \r
34http://opensource.org/licenses/bsd-license.php \r
35 \r
36THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
37WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
38\r
39**/\r
28a00297 40\r
41#include <DxeMain.h>\r
42\r
43//\r
44// Local defines and typedefs\r
45//\r
46#define CORE_SECTION_CHILD_SIGNATURE EFI_SIGNATURE_32('S','X','C','S')\r
47#define CHILD_SECTION_NODE_FROM_LINK(Node) \\r
48 CR (Node, CORE_SECTION_CHILD_NODE, Link, CORE_SECTION_CHILD_SIGNATURE)\r
49\r
50typedef struct {\r
51 UINT32 Signature;\r
52 LIST_ENTRY Link;\r
53 UINT32 Type;\r
54 UINT32 Size;\r
55 //\r
56 // StreamBase + OffsetInStream == pointer to section header in stream. The\r
57 // stream base is always known when walking the sections within.\r
58 //\r
59 UINT32 OffsetInStream;\r
60 //\r
61 // Then EncapsulatedStreamHandle below is always 0 if the section is NOT an\r
62 // encapsulating section. Otherwise, it contains the stream handle\r
63 // of the encapsulated stream. This handle is ALWAYS produced any time an\r
64 // encapsulating child is encountered, irrespective of whether the\r
65 // encapsulated stream is processed further.\r
66 //\r
67 UINTN EncapsulatedStreamHandle;\r
68 EFI_GUID *EncapsulationGuid;\r
69} CORE_SECTION_CHILD_NODE;\r
70\r
71#define CORE_SECTION_STREAM_SIGNATURE EFI_SIGNATURE_32('S','X','S','S')\r
72#define STREAM_NODE_FROM_LINK(Node) \\r
73 CR (Node, CORE_SECTION_STREAM_NODE, Link, CORE_SECTION_STREAM_SIGNATURE)\r
74\r
75typedef struct {\r
76 UINT32 Signature;\r
77 LIST_ENTRY Link;\r
78 UINTN StreamHandle;\r
79 UINT8 *StreamBuffer;\r
80 UINTN StreamLength;\r
81 LIST_ENTRY Children;\r
82 //\r
83 // Authentication status is from GUIDed encapsulations.\r
84 //\r
85 UINT32 AuthenticationStatus;\r
86} CORE_SECTION_STREAM_NODE;\r
87\r
88#define NULL_STREAM_HANDLE 0\r
89\r
90typedef struct {\r
91 CORE_SECTION_CHILD_NODE *ChildNode;\r
92 CORE_SECTION_STREAM_NODE *ParentStream;\r
93 VOID *Registration;\r
94 EFI_EVENT Event;\r
95} RPN_EVENT_CONTEXT;\r
96 \r
97 \r
98\r
99//\r
100// Local prototypes\r
101//\r
102\r
162ed594 103/**\r
104 Worker function. Determine if the input stream:child matches the input type.\r
105\r
106 @param Stream Indicates the section stream associated with the \r
107 child \r
108 @param Child Indicates the child to check \r
109 @param SearchType Indicates the type of section to check against \r
110 for \r
111 @param SectionDefinitionGuid Indicates the GUID to check against if the type \r
112 is EFI_SECTION_GUID_DEFINED \r
113\r
114 @retval TRUE The child matches \r
115 @retval FALSE The child doesn't match\r
116\r
117**/\r
28a00297 118STATIC\r
119BOOLEAN\r
120ChildIsType (\r
121 IN CORE_SECTION_STREAM_NODE *Stream,\r
122 IN CORE_SECTION_CHILD_NODE *Child,\r
123 IN EFI_SECTION_TYPE SearchType,\r
124 IN EFI_GUID *SectionDefinitionGuid\r
125 );\r
126\r
d1f07630 127#if 0\r
162ed594 128/**\r
129 RPN callback function. Removes a stale section stream and re-initializes it\r
130 with an updated AuthenticationStatus.\r
131\r
132 @param Event The event that fired \r
133 @param RpnContext A pointer to the context that allows us to \r
134 identify the relevent encapsulation...\r
135\r
136**/\r
28a00297 137STATIC\r
138VOID\r
139EFIAPI\r
140NotifyGuidedExtraction (\r
141 IN EFI_EVENT Event,\r
142 IN VOID *RpnContext\r
143 );\r
d1f07630 144#endif\r
28a00297 145\r
d1f07630 146#if 0\r
162ed594 147/**\r
148 Worker function. Constructor for RPN event if needed to keep AuthenticationStatus\r
149 cache correct when a missing GUIDED_SECTION_EXTRACTION_PROTOCOL appears.\r
150\r
151 @param ParentStream Indicates the parent of the ecnapsulation \r
152 section (child) \r
153 @param ChildNode Indicates the child node that is the \r
154 encapsulation section.\r
155\r
156**/\r
28a00297 157STATIC\r
158VOID\r
159CreateGuidedExtractionRpnEvent (\r
160 IN CORE_SECTION_STREAM_NODE *ParentStream,\r
161 IN CORE_SECTION_CHILD_NODE *ChildNode\r
162 );\r
d1f07630 163#endif\r
28a00297 164\r
162ed594 165/**\r
166 Worker function. Search stream database for requested stream handle.\r
167\r
168 @param SearchHandle Indicates which stream to look for. \r
169 @param FoundStream Output pointer to the found stream. \r
170\r
171 @retval EFI_SUCCESS StreamHandle was found and *FoundStream contains \r
172 the stream node. \r
173 @retval EFI_NOT_FOUND SearchHandle was not found in the stream \r
174 database.\r
175\r
176**/\r
28a00297 177STATIC\r
178EFI_STATUS\r
179FindStreamNode (\r
180 IN UINTN SearchHandle,\r
181 OUT CORE_SECTION_STREAM_NODE **FoundStream\r
182 );\r
183 \r
162ed594 184/**\r
185 Worker function Recursively searches / builds section stream database\r
186 looking for requested section.\r
187\r
188 @param SourceStream Indicates the section stream in which to do the \r
189 search. \r
190 @param SearchType Indicates the type of section to search for. \r
191 @param SectionInstance Indicates which instance of section to find. \r
192 This is an in/out parameter to deal with \r
193 recursions. \r
194 @param SectionDefinitionGuid Guid of section definition \r
195 @param FoundChild Output indicating the child node that is found. \r
196 @param FoundStream Output indicating which section stream the child \r
197 was found in. If this stream was generated as a \r
198 result of an encapsulation section, the \r
199 streamhandle is visible within the SEP driver \r
200 only.\r
201 @param AuthenticationStatus Indicates the authentication status of the found section. \r
202\r
203 @retval EFI_SUCCESS Child node was found and returned. \r
204 EFI_OUT_OF_RESOURCES- Memory allocation failed. \r
205 @retval EFI_NOT_FOUND Requested child node does not exist. \r
206 @retval EFI_PROTOCOL_ERROR a required GUIDED section extraction protocol \r
207 does not exist\r
208\r
209**/\r
28a00297 210STATIC\r
211EFI_STATUS\r
212FindChildNode (\r
213 IN CORE_SECTION_STREAM_NODE *SourceStream,\r
214 IN EFI_SECTION_TYPE SearchType,\r
215 IN UINTN *SectionInstance,\r
216 IN EFI_GUID *SectionDefinitionGuid,\r
217 OUT CORE_SECTION_CHILD_NODE **FoundChild,\r
218 OUT CORE_SECTION_STREAM_NODE **FoundStream,\r
219 OUT UINT32 *AuthenticationStatus\r
220 );\r
221 \r
162ed594 222/**\r
223 Worker function. Constructor for new child nodes.\r
224\r
225 @param Stream Indicates the section stream in which to add the \r
226 child. \r
227 @param ChildOffset Indicates the offset in Stream that is the \r
228 beginning of the child section. \r
229 @param ChildNode Indicates the Callee allocated and initialized \r
230 child. \r
231\r
232 @retval EFI_SUCCESS Child node was found and returned. \r
233 EFI_OUT_OF_RESOURCES- Memory allocation failed. \r
234 @retval EFI_PROTOCOL_ERROR Encapsulation sections produce new stream \r
235 handles when the child node is created. If the \r
236 section type is GUID defined, and the extraction \r
237 GUID does not exist, and producing the stream \r
238 requires the GUID, then a protocol error is \r
239 generated and no child is produced. Values \r
240 returned by OpenSectionStreamEx.\r
241\r
242**/\r
28a00297 243STATIC\r
244EFI_STATUS\r
245CreateChildNode (\r
246 IN CORE_SECTION_STREAM_NODE *Stream,\r
247 IN UINT32 ChildOffset,\r
248 OUT CORE_SECTION_CHILD_NODE **ChildNode\r
249 );\r
250 \r
162ed594 251/**\r
252 Worker function. Destructor for child nodes.\r
253\r
254 @param ChildNode Indicates the node to destroy\r
255\r
256**/\r
28a00297 257STATIC\r
258VOID\r
259FreeChildNode (\r
260 IN CORE_SECTION_CHILD_NODE *ChildNode\r
261 );\r
262 \r
162ed594 263/**\r
264 Worker function. Constructor for section streams.\r
265\r
266 @param SectionStreamLength Size in bytes of the section stream. \r
267 @param SectionStream Buffer containing the new section stream. \r
268 @param AllocateBuffer Indicates whether the stream buffer is to be \r
269 copied or the input buffer is to be used in \r
270 place. AuthenticationStatus- Indicates the \r
271 default authentication status for the new \r
272 stream. \r
273 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that\r
274 indicates the authentication status of the\r
275