Home | History | Annotate | Download | only in PrePi
      1 /** @file
      2   LZMA Decompress Library header file
      3 
      4   Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
      5   This program and the accompanying materials
      6   are licensed and made available under the terms and conditions of the BSD License
      7   which accompanies this distribution.  The full text of the license may be found at
      8   http://opensource.org/licenses/bsd-license.php
      9 
     10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     12 
     13 **/
     14 
     15 #ifndef __LZMA_DECOMPRESS_H___
     16 #define __LZMA_DECOMPRESS_H___
     17 
     18 /**
     19   Examines a GUIDed section and returns the size of the decoded buffer and the
     20   size of an scratch buffer required to actually decode the data in a GUIDed section.
     21 
     22   Examines a GUIDed section specified by InputSection.
     23   If GUID for InputSection does not match the GUID that this handler supports,
     24   then RETURN_UNSUPPORTED is returned.
     25   If the required information can not be retrieved from InputSection,
     26   then RETURN_INVALID_PARAMETER is returned.
     27   If the GUID of InputSection does match the GUID that this handler supports,
     28   then the size required to hold the decoded buffer is returned in OututBufferSize,
     29   the size of an optional scratch buffer is returned in ScratchSize, and the Attributes field
     30   from EFI_GUID_DEFINED_SECTION header of InputSection is returned in SectionAttribute.
     31 
     32   If InputSection is NULL, then ASSERT().
     33   If OutputBufferSize is NULL, then ASSERT().
     34   If ScratchBufferSize is NULL, then ASSERT().
     35   If SectionAttribute is NULL, then ASSERT().
     36 
     37 
     38   @param[in]  InputSection       A pointer to a GUIDed section of an FFS formatted file.
     39   @param[out] OutputBufferSize   A pointer to the size, in bytes, of an output buffer required
     40                                  if the buffer specified by InputSection were decoded.
     41   @param[out] ScratchBufferSize  A pointer to the size, in bytes, required as scratch space
     42                                  if the buffer specified by InputSection were decoded.
     43   @param[out] SectionAttribute   A pointer to the attributes of the GUIDed section. See the Attributes
     44                                  field of EFI_GUID_DEFINED_SECTION in the PI Specification.
     45 
     46   @retval  RETURN_SUCCESS            The information about InputSection was returned.
     47   @retval  RETURN_UNSUPPORTED        The section specified by InputSection does not match the GUID this handler supports.
     48   @retval  RETURN_INVALID_PARAMETER  The information can not be retrieved from the section specified by InputSection.
     49 
     50 **/
     51 RETURN_STATUS
     52 EFIAPI
     53 LzmaGuidedSectionGetInfo (
     54   IN  CONST VOID  *InputSection,
     55   OUT UINT32      *OutputBufferSize,
     56   OUT UINT32      *ScratchBufferSize,
     57   OUT UINT16      *SectionAttribute
     58   );
     59 
     60 /**
     61   Decompress a LZAM compressed GUIDed section into a caller allocated output buffer.
     62 
     63   Decodes the GUIDed section specified by InputSection.
     64   If GUID for InputSection does not match the GUID that this handler supports, then RETURN_UNSUPPORTED is returned.
     65   If the data in InputSection can not be decoded, then RETURN_INVALID_PARAMETER is returned.
     66   If the GUID of InputSection does match the GUID that this handler supports, then InputSection
     67   is decoded into the buffer specified by OutputBuffer and the authentication status of this
     68   decode operation is returned in AuthenticationStatus.  If the decoded buffer is identical to the
     69   data in InputSection, then OutputBuffer is set to point at the data in InputSection.  Otherwise,
     70   the decoded data will be placed in caller allocated buffer specified by OutputBuffer.
     71 
     72   If InputSection is NULL, then ASSERT().
     73   If OutputBuffer is NULL, then ASSERT().
     74   If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT().
     75   If AuthenticationStatus is NULL, then ASSERT().
     76 
     77 
     78   @param[in]  InputSection  A pointer to a GUIDed section of an FFS formatted file.
     79   @param[out] OutputBuffer  A pointer to a buffer that contains the result of a decode operation.
     80   @param[out] ScratchBuffer A caller allocated buffer that may be required by this function
     81                             as a scratch buffer to perform the decode operation.
     82   @param[out] AuthenticationStatus
     83                             A pointer to the authentication status of the decoded output buffer.
     84                             See the definition of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI
     85                             section of the PI Specification. EFI_AUTH_STATUS_PLATFORM_OVERRIDE must
     86                             never be set by this handler.
     87 
     88   @retval  RETURN_SUCCESS            The buffer specified by InputSection was decoded.
     89   @retval  RETURN_UNSUPPORTED        The section specified by InputSection does not match the GUID this handler supports.
     90   @retval  RETURN_INVALID_PARAMETER  The section specified by InputSection can not be decoded.
     91 
     92 **/
     93 RETURN_STATUS
     94 EFIAPI
     95 LzmaGuidedSectionExtraction (
     96   IN CONST  VOID    *InputSection,
     97   OUT       VOID    **OutputBuffer,
     98   OUT       VOID    *ScratchBuffer,        OPTIONAL
     99   OUT       UINT32  *AuthenticationStatus
    100   );
    101 
    102 #endif // __LZMADECOMPRESS_H__
    103 
    104