]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/EfiLdr/TianoDecompress.h
DuetPkg: Removing ipf which is no longer supported from edk2.
[mirror_edk2.git] / DuetPkg / EfiLdr / TianoDecompress.h
index 54ae620996190beb2ec86dd668358a186da668ee..e9cb016acf89da39db52f38879bb993f60f54823 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
-  Internal include file for Base UEFI Decompress Libary.\r
+  Internal include file for Base UEFI Decompress Library.\r
 \r
-  Copyright (c) 2006, Intel Corporation\r
-  All rights reserved. This program and the accompanying materials\r
+  Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   http://opensource.org/licenses/bsd-license.php\r
 #include <Library/DebugLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 \r
-//\r
-// Decompression algorithm begins here\r
-//\r
-#define BITBUFSIZ 32\r
-#define MAXMATCH  256\r
-#define THRESHOLD 3\r
-#define CODE_BIT  16\r
-#define BAD_TABLE - 1\r
-\r
-//\r
-// C: Char&Len Set; P: Position Set; T: exTra Set\r
-//\r
-#define NC      (0xff + MAXMATCH + 2 - THRESHOLD)\r
-#define CBIT    9\r
-#define MAXPBIT 5\r
-#define TBIT    5\r
-#define MAXNP   ((1U << MAXPBIT) - 1)\r
-#define NT      (CODE_BIT + 3)\r
-#if NT > MAXNP\r
-#define NPT NT\r
-#else\r
-#define NPT MAXNP\r
-#endif\r
-\r
-typedef struct {\r
-  UINT8   *mSrcBase;  // Starting address of compressed data\r
-  UINT8   *mDstBase;  // Starting address of decompressed data\r
-  UINT32  mOutBuf;\r
-  UINT32  mInBuf;\r
-\r
-  UINT16  mBitCount;\r
-  UINT32  mBitBuf;\r
-  UINT32  mSubBitBuf;\r
-  UINT16  mBlockSize;\r
-  UINT32  mCompSize;\r
-  UINT32  mOrigSize;\r
-\r
-  UINT16  mBadTableFlag;\r
-\r
-  UINT16  mLeft[2 * NC - 1];\r
-  UINT16  mRight[2 * NC - 1];\r
-  UINT8   mCLen[NC];\r
-  UINT8   mPTLen[NPT];\r
-  UINT16  mCTable[4096];\r
-  UINT16  mPTTable[256];\r
-\r
-  //\r
-  // The length of the field 'Position Set Code Length Array Size' in Block Header.\r
-  // For UEFI 2.0 de/compression algorithm, mPBit = 4\r
-  // For Tiano de/compression algorithm, mPBit = 5\r
-  //\r
-  UINT8   mPBit;\r
-} SCRATCH_DATA;\r
-\r
-/**\r
-  Read NumOfBit of bits from source into mBitBuf\r
-\r
-  Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.\r
-\r
-  @param  Sd        The global scratch data\r
-  @param  NumOfBits The number of bits to shift and read.\r
-\r
-**/\r
-VOID\r
-FillBuf (\r
-  IN  SCRATCH_DATA  *Sd,\r
-  IN  UINT16        NumOfBits\r
-  );\r
-\r
-/**\r
-  Get NumOfBits of bits out from mBitBuf\r
-\r
-  Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent \r
-  NumOfBits of bits from source. Returns NumOfBits of bits that are \r
-  popped out.\r
-\r
-  @param  Sd        The global scratch data.\r
-  @param  NumOfBits The number of bits to pop and read.\r
-\r
-  @return The bits that are popped out.\r
-\r
-**/\r
-UINT32\r
-GetBits (\r
-  IN  SCRATCH_DATA  *Sd,\r
-  IN  UINT16        NumOfBits\r
-  );\r
-\r
-/**\r
-  Creates Huffman Code mapping table according to code length array.\r
-\r
-  Creates Huffman Code mapping table for Extra Set, Char&Len Set \r
-  and Position Set according to code length array.\r
-\r
-  @param  Sd        The global scratch data\r
-  @param  NumOfChar Number of symbols in the symbol set\r
-  @param  BitLen    Code length array\r
-  @param  TableBits The width of the mapping table\r
-  @param  Table     The table\r
-\r
-  @retval  0 OK.\r
-  @retval  BAD_TABLE The table is corrupted.\r
-\r
-**/\r
-UINT16\r
-MakeTable (\r
-  IN  SCRATCH_DATA  *Sd,\r
-  IN  UINT16        NumOfChar,\r
-  IN  UINT8         *BitLen,\r
-  IN  UINT16        TableBits,\r
-  OUT UINT16        *Table\r
-  );\r
-\r
-/**\r
-  Decodes a position value.\r
-\r
-  Get a position value according to Position Huffman Table.\r
-  \r
-  @param  Sd the global scratch data\r
-\r
-  @return The position value decoded.\r
+EFI_STATUS\r
+EFIAPI\r
+TianoGetInfo (\r
+  IN      VOID                          *Source,\r
+  IN      UINT32                        SrcSize,\r
+  OUT     UINT32                        *DstSize,\r
+  OUT     UINT32                        *ScratchSize\r
+  )\r
+/*++\r
 \r
-**/\r
-UINT32\r
-DecodeP (\r
-  IN  SCRATCH_DATA  *Sd\r
-  );\r
+Routine Description:\r
 \r
-/**\r
-  Reads code lengths for the Extra Set or the Position Set.\r
+  The implementation is same as that of EFI_TIANO_DECOMPRESS_PROTOCOL.GetInfo().\r
 \r
-  Read in the Extra Set or Pointion Set Length Arrary, then\r
-  generate the Huffman code mapping for them.\r
+Arguments:\r
 \r
-  @param  Sd      The global scratch data.\r
-  @param  nn      Number of symbols.\r
-  @param  nbit    Number of bits needed to represent nn.\r
-  @param  Special The special symbol that needs to be taken care of.\r
+  This        - The protocol instance pointer\r
+  Source      - The source buffer containing the compressed data.\r
+  SrcSize     - The size of source buffer\r
+  DstSize     - The size of destination buffer.\r
+  ScratchSize - The size of scratch buffer.\r
 \r
-  @retval  0 OK.\r
-  @retval  BAD_TABLE Table is corrupted.\r
+Returns:\r
 \r
-**/\r
-UINT16\r
-ReadPTLen (\r
-  IN  SCRATCH_DATA  *Sd,\r
-  IN  UINT16        nn,\r
-  IN  UINT16        nbit,\r
-  IN  UINT16        Special\r
-  );\r
-\r
-/**\r
-  Reads code lengths for Char&Len Set.\r
-  \r
-  Read in and decode the Char&Len Set Code Length Array, then\r
-  generate the Huffman Code mapping table for the Char&Len Set.\r
-\r
-  @param  Sd the global scratch data\r
+  EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successfully retrieved.\r
+  EFI_INVALID_PARAMETER - The source data is corrupted\r
 \r
-**/\r
-VOID\r
-ReadCLen (\r
-  SCRATCH_DATA  *Sd\r
-  );\r
+--*/\r
+;\r
 \r
-/**\r
-  Decode a character/length value.\r
-  \r
-  Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates\r
-  Huffman code mapping table for Extra Set, Code&Len Set and\r
-  Position Set.\r
+EFI_STATUS\r
+EFIAPI\r
+TianoDecompress (\r
+  IN      VOID                          *Source,\r
+  IN      UINT32                        SrcSize,\r
+  IN OUT  VOID                          *Destination,\r
+  IN      UINT32                        DstSize,\r
+  IN OUT  VOID                          *Scratch,\r
+  IN      UINT32                        ScratchSize\r
+  )\r
+/*++\r
 \r
-  @param  Sd The global scratch data.\r
+Routine Description:\r
 \r
-  @return The value decoded.\r
+  The implementation is same as that  of EFI_TIANO_DECOMPRESS_PROTOCOL.Decompress().\r
 \r
-**/\r
-UINT16\r
-DecodeC (\r
-  SCRATCH_DATA  *Sd\r
-  );\r
+Arguments:\r
 \r
-/**\r
-  Decode the source data and put the resulting data into the destination buffer.\r
+  This        - The protocol instance pointer\r
+  Source      - The source buffer containing the compressed data.\r
+  SrcSize     - The size of source buffer\r
+  Destination - The destination buffer to store the decompressed data\r
+  DstSize     - The size of destination buffer.\r
+  Scratch     - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.\r
+  ScratchSize - The size of scratch buffer.\r
 \r
-  Decode the source data and put the resulting data into the destination buffer.\r
-  \r
-  @param  Sd The global scratch data\r
+Returns:\r
 \r
-**/\r
-VOID\r
-Decode (\r
-  SCRATCH_DATA  *Sd\r
-  );\r
+  EFI_SUCCESS           - Decompression is successfull\r
+  EFI_INVALID_PARAMETER - The source data is corrupted\r
 \r
-RETURN_STATUS\r
-EFIAPI\r
-UefiTianoDecompress (\r
-  IN CONST VOID  *Source,\r
-  IN OUT VOID    *Destination,\r
-  IN OUT VOID    *Scratch,\r
-  IN UINT32      Version\r
-  );\r
+--*/\r
+;\r
 \r
 #endif\r