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