Minor code enhancement.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Ppi / SectionExtraction.h
CommitLineData
3e5a3960 1/** @file\r
2 This file declares Section Extraction PPI.\r
3\r
61c244aa 4 This PPI is defined in PEI CIS version 0.91. It supports encapsulating sections,\r
5 such as GUIDed sections used to authenticate the file encapsulation of other domain-specific wrapping.\r
6\r
7 Copyright (c) 2006-2009, Intel Corporation\r
b80fbe85 8 All rights reserved. This program and the accompanying materials\r
9 are licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
3e5a3960 12\r
b80fbe85 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
3e5a3960 15\r
3e5a3960 16**/\r
17\r
61c244aa 18#ifndef __SECTION_EXTRACTION_H__\r
19#define __SECTION_EXTRACTION_H__\r
3e5a3960 20\r
21#define EFI_PEI_SECTION_EXTRACTION_PPI_GUID \\r
22 { \\r
23 0x4F89E208, 0xE144, 0x4804, {0x9E, 0xC8, 0x0F, 0x89, 0x4F, 0x7E, 0x36, 0xD7 } \\r
24 }\r
25\r
26typedef struct _EFI_PEI_SECTION_EXTRACTION_PPI EFI_PEI_SECTION_EXTRACTION_PPI;\r
27\r
28//\r
29// Bit values for AuthenticationStatus\r
30//\r
61c244aa 31#define EFI_AUTH_STATUS_PLATFORM_OVERRIDE 0x01\r
32#define EFI_AUTH_STATUS_IMAGE_SIGNED 0x02\r
33#define EFI_AUTH_STATUS_NOT_TESTED 0x04\r
34#define EFI_AUTH_STATUS_TEST_FAILED 0x08\r
3e5a3960 35\r
36/**\r
37 The function is used to retrieve a section from within a section file.\r
38 It will retrieve both encapsulation sections and leaf sections in their entirety,\r
39 exclusive of the section header.\r
40\r
61c244aa 41 @param PeiServices Pointer to the PEI Services Table.\r
42 @param This Indicates the calling context\r
43 @param SectionType Pointer to an EFI_SECTION_TYPE. If SectionType == NULL,\r
44 the contents of the entire section are returned in Buffer. If SectionType\r
45 is not NULL, only the requested section is returned.\r
46 @param SectionDefinitionGuid Pointer to an EFI_GUID.\r
47 If SectionType == EFI_SECTION_GUID_DEFINED, SectionDefinitionGuid\r
48 indicates for which section GUID to search.\r
49 If SectionType != EFI_SECTION_GUID_DEFINED, SectionDefinitionGuid\r
50 is unused and is ignored.\r
51 @param SectionInstance If SectionType is not NULL, indicates which\r
52 instance of the requested section type to return.\r
53 @param Buffer Pointer to a pointer to a buffer in which the section\r
54 contents are returned.\r
5259c97d 55 @param BufferSize A pointer to a caller-allocated UINT32. On input, *BufferSize\r
56 indicates the size in bytes of the memory region pointed to by Buffer. On output,\r
61c244aa 57 *BufferSize contains the number of bytes required to read the section.\r
58 @param AuthenticationStatus A pointer to a caller-allocated UINT32 in\r
59 which any metadata from encapsulating GUID-defined sections is returned.\r
3e5a3960 60\r
61 @retval EFI_SUCCESS The section was successfully processed and the section\r
62 contents were returned in Buffer.\r
63 @retval EFI_PROTOCOL_ERROR A GUID-defined section was encountered in\r
64 the file with its EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set, but\r
65 there was no corresponding GUIDed Section Extraction Protocol in the\r
5259c97d 66 handle database. *Buffer is unmodified.\r
3e5a3960 67 @retval EFI_NOT_FOUND The requested section does not exist.*Buffer is unmodified.\r
68 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process the request.\r
69 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.\r
70 @retval EFI_WARN_TOO_SMALL The size of the input buffer is insufficient to\r
71 contain the requested section. The input buffer is filled and contents are\r
72 section contents are truncated.\r
73\r
74**/\r
75typedef\r
76EFI_STATUS\r
69686d56 77(EFIAPI *EFI_PEI_GET_SECTION)(\r
3e5a3960 78 IN EFI_PEI_SERVICES **PeiServices,\r
79 IN EFI_PEI_SECTION_EXTRACTION_PPI *This,\r
80 IN EFI_SECTION_TYPE *SectionType,\r
81 IN EFI_GUID *SectionDefinitionGuid, OPTIONAL\r
82 IN UINTN SectionInstance,\r
83 IN VOID **Buffer,\r
84 IN OUT UINT32 *BufferSize,\r
85 OUT UINT32 *AuthenticationStatus\r
86 );\r
87\r
88/**\r
b80fbe85 89 This PPI supports encapsulating sections, such as GUIDed sections used to\r
3e5a3960 90 authenticate the file encapsulation of other domain-specific wrapping.\r
3e5a3960 91**/\r
92struct _EFI_PEI_SECTION_EXTRACTION_PPI {\r
aa4a31e3 93 EFI_PEI_GET_SECTION GetSection; ///< Retrieves a section from within a section file.\r
3e5a3960 94};\r
95\r
96extern EFI_GUID gEfiPeiSectionExtractionPpiGuid;\r
97\r
98#endif\r
61c244aa 99\r