]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/SectionExtraction.h
Committing changes to the comments, after review with engineers.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SectionExtraction.h
1 /** @file
2 This file declares Section Extraction Protocol.
3
4 This interface provides a means of decoding a set of sections into a linked list of
5 leaf sections. This provides for an extensible and flexible file format.
6
7 Copyright (c) 2006 - 2009, Intel Corporation
8 All rights reserved. This program and the accompanying
9 materials are licensed and made available under the terms and
10 conditions of the BSD License which accompanies this
11 distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
13
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16
17 @par Revision Reference:
18 This protocol is defined in Firmware Volume Specification.
19 Version 0.9
20
21 **/
22
23 #ifndef _SECTION_EXTRACTION_PROTOCOL_H_
24 #define _SECTION_EXTRACTION_PROTOCOL_H_
25
26 //
27 // Protocol GUID definition
28 //
29 #define EFI_SECTION_EXTRACTION_PROTOCOL_GUID \
30 { \
31 0x448F5DA4, 0x6DD7, 0x4FE1, {0x93, 0x07, 0x69, 0x22, 0x41, 0x92, 0x21, 0x5D } \
32 }
33
34 typedef struct _EFI_SECTION_EXTRACTION_PROTOCOL EFI_SECTION_EXTRACTION_PROTOCOL;
35
36 //
37 // Protocol member functions
38 //
39 /**
40 Creates and returns a new section stream handle to represent the new section stream.
41
42 @param This Indicates the EFI_SECTION_EXTRACTION_PROTOCOL instance.
43 @param SectionStreamLength Size in bytes of the section stream.
44 @param SectionStream Buffer containing the new section stream.
45 @param SectionStreamHandle A pointer to a caller-allocated UINTN that,
46 on output, contains the new section stream handle.
47
48 @retval EFI_SUCCESS The SectionStream was successfully processed and
49 the section stream handle was returned.
50 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to
51 process the request.
52 @retval EFI_INVALID_PARAMETER The section stream may be corrupt or the value
53 of SectionStreamLength may be incorrect.
54
55 **/
56 typedef
57 EFI_STATUS
58 (EFIAPI *EFI_OPEN_SECTION_STREAM)(
59 IN EFI_SECTION_EXTRACTION_PROTOCOL *This,
60 IN UINTN SectionStreamLength,
61 IN VOID *SectionStream,
62 OUT UINTN *SectionStreamHandle
63 );
64
65 /**
66 Reads and returns a single section from a section stream.
67
68 @param This Indicates the EFI_SECTION_EXTRACTION_PROTOCOL instance.
69 @param SectionStreamHandle Indicates from which section stream to read.
70 @param SectionType Pointer to an EFI_SECTION_TYPE. If SectionType == NULL, the contents of the
71 entire section stream are returned in Buffer. If SectionType is not NULL,
72 only the requested section is returned. EFI_SECTION_ALL matches all section
73 types and can be used as a wild card to extract all sections in order.
74 @param SectionDefinitionGuid Pointer to an EFI_GUID. If SectionType ==
75 EFI_SECTION_GUID_DEFINED, SectionDefinitionGuid indicates what section GUID
76 to search for. If SectionType !=EFI_SECTION_GUID_DEFINED, then
77 SectionDefinitionGuid is unused and is ignored.
78 @param SectionInstance Indicates which instance of the requested section
79 type to return when SectionType is not NULL.
80 @param SectionStreamHandle A pointer to a caller-allocated UINTN that, on output,
81 contains the new section stream handle.
82 @param Buffer Pointer to a pointer to a buffer in which the section
83 contents are returned.
84 @param BufferSize Pointer to a caller-allocated UINTN.
85 @param AuthenticationStatus Pointer to a caller-allocated UINT32 in
86 which any meta-data from encapsulation GUID-defined sections is returned.
87
88 @retval EFI_SUCCESS The SectionStream was successfully processed and
89 the section contents were returned in Buffer.
90 @retval EFI_PROTOCOL_ERROR A GUID-defined section was encountered in
91 the section stream with its EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
92 but there was no corresponding GUIDed Section Extraction Protocol in
93 the handle database.
94 @retval EFI_NOT_FOUND An error was encountered when parsing the SectionStream,
95 which indicates that the SectionStream is not correctly formatted.
96 Or The requested section does not exist.
97 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
98 the request.
99 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
100 @retval EFI_WARN_BUFFER_TOO_SMALL The size of the input buffer is insufficient to contain the requested
101 section. The input buffer is filled and section contents are truncated.
102
103 **/
104 typedef
105 EFI_STATUS
106 (EFIAPI *EFI_GET_SECTION)(
107 IN EFI_SECTION_EXTRACTION_PROTOCOL *This,
108 IN UINTN SectionStreamHandle,
109 IN EFI_SECTION_TYPE *SectionType,
110 IN EFI_GUID *SectionDefinitionGuid,
111 IN UINTN SectionInstance,
112 IN VOID **Buffer,
113 IN OUT UINTN *BufferSize,
114 OUT UINT32 *AuthenticationStatus
115 );
116
117 /**
118 Deletes a section stream handle and returns all associated resources to the system.
119
120 @param This Indicates the EFI_SECTION_EXTRACTION_PROTOCOL instance.
121 @param SectionStreamHandle Indicates the section stream to close.
122 @retval EFI_SUCCESS The SectionStream was successfully processed and
123 the section stream handle was returned.
124 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
125
126 **/
127 typedef
128 EFI_STATUS
129 (EFIAPI *EFI_CLOSE_SECTION_STREAM)(
130 IN EFI_SECTION_EXTRACTION_PROTOCOL *This,
131 IN UINTN SectionStreamHandle
132 );
133
134 //
135 // Protocol definition
136 //
137 struct _EFI_SECTION_EXTRACTION_PROTOCOL {
138 ///
139 /// Takes a bounded stream of sections and returns a section stream handle.
140 ///
141 EFI_OPEN_SECTION_STREAM OpenSectionStream;
142
143 ///
144 /// Given a section stream handle, retrieves the requested section and
145 /// meta-data from the section stream.
146 ///
147 EFI_GET_SECTION GetSection;
148
149 ///
150 /// Given a section stream handle, closes the section stream.
151 ///
152 EFI_CLOSE_SECTION_STREAM CloseSectionStream;
153 };
154
155 extern EFI_GUID gEfiSectionExtractionProtocolGuid;
156
157 #endif