mirror of
				https://github.com/acidanthera/audk.git
				synced 2025-11-03 21:17:23 +01:00 
			
		
		
		
	Make GuidedSection library instance to follow the value of GuidedSectionExtraction protocol/PPI defined in PI spec.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4165 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
		
							parent
							
								
									d7f73f568f
								
							
						
					
					
						commit
						e6c560aad6
					
				@ -796,6 +796,7 @@ Returns:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  RETURN_SUCCESS           - The size of destination buffer and the size of scratch buffer are successull retrieved.
 | 
					  RETURN_SUCCESS           - The size of destination buffer and the size of scratch buffer are successull retrieved.
 | 
				
			||||||
  RETURN_INVALID_PARAMETER - The source data is corrupted
 | 
					  RETURN_INVALID_PARAMETER - The source data is corrupted
 | 
				
			||||||
 | 
					                             The GUID in InputSection does not match this instance guid.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
--*/
 | 
					--*/
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -804,6 +805,12 @@ Returns:
 | 
				
			|||||||
  if (InputSection == NULL) {
 | 
					  if (InputSection == NULL) {
 | 
				
			||||||
    return RETURN_INVALID_PARAMETER;
 | 
					    return RETURN_INVALID_PARAMETER;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!CompareGuid (
 | 
				
			||||||
 | 
					        &gTianoCustomDecompressGuid, 
 | 
				
			||||||
 | 
					        &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
 | 
				
			||||||
 | 
					    return RETURN_INVALID_PARAMETER;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Get guid attribute of guid section. 
 | 
					  // Get guid attribute of guid section. 
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
@ -846,7 +853,8 @@ Arguments:
 | 
				
			|||||||
Returns:
 | 
					Returns:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  RETURN_SUCCESS           - Decompression is successfull
 | 
					  RETURN_SUCCESS           - Decompression is successfull
 | 
				
			||||||
  RETURN_INVALID_PARAMETER - The source data is corrupted
 | 
					  RETURN_INVALID_PARAMETER - The source data is corrupted, or
 | 
				
			||||||
 | 
					                             The GUID in InputSection does not match this instance guid.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
--*/
 | 
					--*/
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -855,6 +863,13 @@ Returns:
 | 
				
			|||||||
  if (InputSection == NULL) {
 | 
					  if (InputSection == NULL) {
 | 
				
			||||||
    return RETURN_INVALID_PARAMETER;
 | 
					    return RETURN_INVALID_PARAMETER;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!CompareGuid (
 | 
				
			||||||
 | 
					        &gTianoCustomDecompressGuid, 
 | 
				
			||||||
 | 
					        &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
 | 
				
			||||||
 | 
					    return RETURN_INVALID_PARAMETER;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Set Authentication to Zero.
 | 
					  // Set Authentication to Zero.
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
 | 
				
			|||||||
@ -42,6 +42,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[LibraryClasses]
 | 
					[LibraryClasses]
 | 
				
			||||||
  DebugLib
 | 
					  DebugLib
 | 
				
			||||||
 | 
					  BaseMemoryLib
 | 
				
			||||||
  ExtractGuidedSectionLib
 | 
					  ExtractGuidedSectionLib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Guids]
 | 
					[Guids]
 | 
				
			||||||
 | 
				
			|||||||
@ -21,6 +21,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <Library/UefiDecompressLib.h>
 | 
					#include <Library/UefiDecompressLib.h>
 | 
				
			||||||
#include <Library/DebugLib.h>
 | 
					#include <Library/DebugLib.h>
 | 
				
			||||||
 | 
					#include <Library/BaseMemoryLib.h>
 | 
				
			||||||
#include <Library/ExtractGuidedSectionLib.h>
 | 
					#include <Library/ExtractGuidedSectionLib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
 | 
				
			|||||||
@ -27,6 +27,7 @@ Abstract:
 | 
				
			|||||||
#include <Protocol/SecurityPolicy.h>
 | 
					#include <Protocol/SecurityPolicy.h>
 | 
				
			||||||
#include <Library/ExtractGuidedSectionLib.h>
 | 
					#include <Library/ExtractGuidedSectionLib.h>
 | 
				
			||||||
#include <Library/DebugLib.h>
 | 
					#include <Library/DebugLib.h>
 | 
				
			||||||
 | 
					#include <Library/BaseMemoryLib.h>
 | 
				
			||||||
#include <Library/UefiBootServicesTableLib.h>
 | 
					#include <Library/UefiBootServicesTableLib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
@ -57,10 +58,16 @@ Arguments:
 | 
				
			|||||||
Returns:
 | 
					Returns:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successull retrieved.
 | 
					  EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successull retrieved.
 | 
				
			||||||
  EFI_INVALID_PARAMETER - The source data is corrupted
 | 
					  EFI_INVALID_PARAMETER - The source data is corrupted, or
 | 
				
			||||||
 | 
					                          The GUID in InputSection does not match this instance guid.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
--*/
 | 
					--*/
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  if (!CompareGuid (
 | 
				
			||||||
 | 
					        &gEfiCrc32GuidedSectionExtractionProtocolGuid, 
 | 
				
			||||||
 | 
					        &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
 | 
				
			||||||
 | 
					    return EFI_INVALID_PARAMETER;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Retrieve the size and attribute of the input section data.
 | 
					  // Retrieve the size and attribute of the input section data.
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
@ -97,8 +104,9 @@ Arguments:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Returns:
 | 
					Returns:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  EFI_SUCCESS           - Decompression is successfull
 | 
					  RETURN_SUCCESS           - Decompression is successfull
 | 
				
			||||||
  EFI_INVALID_PARAMETER - The source data is corrupted
 | 
					  RETURN_INVALID_PARAMETER - The source data is corrupted, or
 | 
				
			||||||
 | 
					                             The GUID in InputSection does not match this instance guid.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
--*/
 | 
					--*/
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -108,6 +116,12 @@ Returns:
 | 
				
			|||||||
  UINT32                    OutputBufferSize;
 | 
					  UINT32                    OutputBufferSize;
 | 
				
			||||||
  VOID                      *DummyInterface;
 | 
					  VOID                      *DummyInterface;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!CompareGuid (
 | 
				
			||||||
 | 
					        &gEfiCrc32GuidedSectionExtractionProtocolGuid, 
 | 
				
			||||||
 | 
					        &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
 | 
				
			||||||
 | 
					    return EFI_INVALID_PARAMETER;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Crc32Checksum = 0;
 | 
					  Crc32Checksum = 0;
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Points to the Crc32 section header
 | 
					  // Points to the Crc32 section header
 | 
				
			||||||
 | 
				
			|||||||
@ -41,6 +41,7 @@
 | 
				
			|||||||
  ExtractGuidedSectionLib
 | 
					  ExtractGuidedSectionLib
 | 
				
			||||||
  UefiBootServicesTableLib
 | 
					  UefiBootServicesTableLib
 | 
				
			||||||
  DebugLib
 | 
					  DebugLib
 | 
				
			||||||
 | 
					  BaseMemoryLib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Protocols]
 | 
					[Protocols]
 | 
				
			||||||
  gEfiCrc32GuidedSectionExtractionProtocolGuid
 | 
					  gEfiCrc32GuidedSectionExtractionProtocolGuid
 | 
				
			||||||
 | 
				
			|||||||
@ -141,7 +141,7 @@ ExtractGuidedSectionRegisterHandlers (
 | 
				
			|||||||
  Get information from the guided section. This function first gets the guid value
 | 
					  Get information from the guided section. This function first gets the guid value
 | 
				
			||||||
  from guided section header, then match this guid in the registered extract Handler list
 | 
					  from guided section header, then match this guid in the registered extract Handler list
 | 
				
			||||||
  to its corresponding getinfo Handler. 
 | 
					  to its corresponding getinfo Handler. 
 | 
				
			||||||
  If not found, RETURN_UNSUPPORTED will be return. 
 | 
					  If not found, RETURN_INVALID_PARAMETER will be return. 
 | 
				
			||||||
  If found, it will call the getinfo Handler to get the required size and attribute.
 | 
					  If found, it will call the getinfo Handler to get the required size and attribute.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  It will ASSERT () if the pointer to OutputBufferSize is NULL.
 | 
					  It will ASSERT () if the pointer to OutputBufferSize is NULL.
 | 
				
			||||||
@ -154,8 +154,8 @@ ExtractGuidedSectionRegisterHandlers (
 | 
				
			|||||||
  @param[out] SectionAttribute      The attribute of the input guided section.
 | 
					  @param[out] SectionAttribute      The attribute of the input guided section.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @retval  RETURN_SUCCESS           Get the required information successfully.
 | 
					  @retval  RETURN_SUCCESS           Get the required information successfully.
 | 
				
			||||||
  @retval  RETURN_UNSUPPORTED       Guided section data is not supported.
 | 
					 | 
				
			||||||
  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. 
 | 
					  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. 
 | 
				
			||||||
 | 
					                                    The GUID in InputSection does not match any registered guid list.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**/
 | 
					**/
 | 
				
			||||||
RETURN_STATUS
 | 
					RETURN_STATUS
 | 
				
			||||||
@ -190,7 +190,7 @@ ExtractGuidedSectionGetInfo (
 | 
				
			|||||||
  // Not found, the input guided section is not supported. 
 | 
					  // Not found, the input guided section is not supported. 
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  if (Index == mNumberOfExtractHandler) {
 | 
					  if (Index == mNumberOfExtractHandler) {
 | 
				
			||||||
    return RETURN_UNSUPPORTED;
 | 
					    return RETURN_INVALID_PARAMETER;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
@ -208,7 +208,7 @@ ExtractGuidedSectionGetInfo (
 | 
				
			|||||||
  Extract data from the guided section. This function first gets the guid value
 | 
					  Extract data from the guided section. This function first gets the guid value
 | 
				
			||||||
  from guided section header, then match this guid in the registered extract Handler list
 | 
					  from guided section header, then match this guid in the registered extract Handler list
 | 
				
			||||||
  to its corresponding extract Handler. 
 | 
					  to its corresponding extract Handler. 
 | 
				
			||||||
  If not found, RETURN_UNSUPPORTED will be return. 
 | 
					  If not found, RETURN_INVALID_PARAMETER will be return. 
 | 
				
			||||||
  If found, it will call this extract Handler to get output data and AuthenticationStatus.
 | 
					  If found, it will call this extract Handler to get output data and AuthenticationStatus.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  It will ASSERT () if the pointer to OutputBuffer is NULL.
 | 
					  It will ASSERT () if the pointer to OutputBuffer is NULL.
 | 
				
			||||||
@ -225,8 +225,8 @@ ExtractGuidedSectionGetInfo (
 | 
				
			|||||||
                            authentication status of the output buffer. 
 | 
					                            authentication status of the output buffer. 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @retval  RETURN_SUCCESS           Get the output data, size and AuthenticationStatus successfully.
 | 
					  @retval  RETURN_SUCCESS           Get the output data, size and AuthenticationStatus successfully.
 | 
				
			||||||
  @retval  RETURN_UNSUPPORTED       Guided section data is not supported to be decoded.
 | 
					 | 
				
			||||||
  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. 
 | 
					  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. 
 | 
				
			||||||
 | 
					                                    The GUID in InputSection does not match any registered guid.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**/
 | 
					**/
 | 
				
			||||||
RETURN_STATUS
 | 
					RETURN_STATUS
 | 
				
			||||||
@ -260,7 +260,7 @@ ExtractGuidedSectionDecode (
 | 
				
			|||||||
  // Not found, the input guided section is not supported. 
 | 
					  // Not found, the input guided section is not supported. 
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  if (Index == mNumberOfExtractHandler) {
 | 
					  if (Index == mNumberOfExtractHandler) {
 | 
				
			||||||
    return RETURN_UNSUPPORTED;
 | 
					    return RETURN_INVALID_PARAMETER;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
 | 
				
			|||||||
@ -188,7 +188,7 @@ ExtractGuidedSectionRegisterHandlers (
 | 
				
			|||||||
  Get information from the guided section. This function first gets the guid value
 | 
					  Get information from the guided section. This function first gets the guid value
 | 
				
			||||||
  from guided section header, then match this guid in the registered extract Handler list
 | 
					  from guided section header, then match this guid in the registered extract Handler list
 | 
				
			||||||
  to its corresponding getinfo Handler. 
 | 
					  to its corresponding getinfo Handler. 
 | 
				
			||||||
  If not found, RETURN_UNSUPPORTED will be return. 
 | 
					  If not found, RETURN_INVALID_PARAMETER will be return. 
 | 
				
			||||||
  If found, it will call the getinfo Handler to get the required size and attribute.
 | 
					  If found, it will call the getinfo Handler to get the required size and attribute.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  It will ASSERT () if the pointer to OutputBufferSize is NULL.
 | 
					  It will ASSERT () if the pointer to OutputBufferSize is NULL.
 | 
				
			||||||
@ -201,8 +201,8 @@ ExtractGuidedSectionRegisterHandlers (
 | 
				
			|||||||
  @param[out] SectionAttribute      The attribute of the input guided section.
 | 
					  @param[out] SectionAttribute      The attribute of the input guided section.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @retval  RETURN_SUCCESS           Get the required information successfully.
 | 
					  @retval  RETURN_SUCCESS           Get the required information successfully.
 | 
				
			||||||
  @retval  RETURN_UNSUPPORTED       Guided section data is not supported.
 | 
					 | 
				
			||||||
  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. 
 | 
					  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. 
 | 
				
			||||||
 | 
					                                    The GUID in InputSection does not match any registered guid list.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**/
 | 
					**/
 | 
				
			||||||
RETURN_STATUS
 | 
					RETURN_STATUS
 | 
				
			||||||
@ -250,7 +250,7 @@ ExtractGuidedSectionGetInfo (
 | 
				
			|||||||
  // Not found, the input guided section is not supported. 
 | 
					  // Not found, the input guided section is not supported. 
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  if (Index == HandlerInfo->NumberOfExtractHandler) {
 | 
					  if (Index == HandlerInfo->NumberOfExtractHandler) {
 | 
				
			||||||
    return RETURN_UNSUPPORTED;
 | 
					    return RETURN_INVALID_PARAMETER;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
@ -268,7 +268,7 @@ ExtractGuidedSectionGetInfo (
 | 
				
			|||||||
  Extract data from the guided section. This function first gets the guid value
 | 
					  Extract data from the guided section. This function first gets the guid value
 | 
				
			||||||
  from guided section header, then match this guid in the registered extract Handler list
 | 
					  from guided section header, then match this guid in the registered extract Handler list
 | 
				
			||||||
  to its corresponding extract Handler. 
 | 
					  to its corresponding extract Handler. 
 | 
				
			||||||
  If not found, RETURN_UNSUPPORTED will be return. 
 | 
					  If not found, RETURN_INVALID_PARAMETER will be return. 
 | 
				
			||||||
  If found, it will call this extract Handler to get output data and AuthenticationStatus.
 | 
					  If found, it will call this extract Handler to get output data and AuthenticationStatus.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  It will ASSERT () if the pointer to OutputBuffer is NULL.
 | 
					  It will ASSERT () if the pointer to OutputBuffer is NULL.
 | 
				
			||||||
@ -285,8 +285,8 @@ ExtractGuidedSectionGetInfo (
 | 
				
			|||||||
                            authentication status of the output buffer. 
 | 
					                            authentication status of the output buffer. 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @retval  RETURN_SUCCESS           Get the output data, size and AuthenticationStatus successfully.
 | 
					  @retval  RETURN_SUCCESS           Get the output data, size and AuthenticationStatus successfully.
 | 
				
			||||||
  @retval  RETURN_UNSUPPORTED       Guided section data is not supported to be decoded.
 | 
					 | 
				
			||||||
  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. 
 | 
					  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. 
 | 
				
			||||||
 | 
					                                    The GUID in InputSection does not match any registered guid list.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**/
 | 
					**/
 | 
				
			||||||
RETURN_STATUS
 | 
					RETURN_STATUS
 | 
				
			||||||
@ -327,7 +327,7 @@ ExtractGuidedSectionDecode (
 | 
				
			|||||||
  // Not found, the input guided section is not supported. 
 | 
					  // Not found, the input guided section is not supported. 
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  if (Index == HandlerInfo->NumberOfExtractHandler) {
 | 
					  if (Index == HandlerInfo->NumberOfExtractHandler) {
 | 
				
			||||||
    return RETURN_UNSUPPORTED;
 | 
					    return RETURN_INVALID_PARAMETER;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user