]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c
Correct parameter UINTN to UINT32. Fix UINTN conver to UINT32
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / BaseUefiTianoCustomDecompressLib / BaseUefiTianoCustomDecompressLib.c
index c516c35e546cd14e346c9051677de070265640f8..061222dae00b683e3108338ef99caaa04aaa65d8 100644 (file)
@@ -1,5 +1,6 @@
-/*++\r
-\r
+/**@file\r
+  UEFI and Custom Decompress Library \r
+  \r
 Copyright (c) 2006, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
@@ -9,21 +10,9 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 \r
-Module Name:\r
-\r
-  BaseUefiTianoCustomDecompressLib.c\r
-\r
-Abstract:\r
-\r
-  UEFI and Custom Decompress Library \r
-\r
---*/\r
-\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
+**/\r
 \r
+#include <Guid/CustomDecompress.h>\r
 #include "BaseUefiTianoCustomDecompressLibInternals.h"\r
 \r
 VOID\r
@@ -787,6 +776,7 @@ Returns:
 RETURN_STATUS\r
 EFIAPI\r
 CustomDecompressGetInfo (\r
+  IN  CONST GUID *DecompressGuid,\r
   IN  CONST VOID  *Source,\r
   IN  UINT32      SourceSize,\r
   OUT UINT32      *DestinationSize,\r
@@ -799,7 +789,7 @@ Routine Description:
   The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().\r
 \r
 Arguments:\r
-\r
+  DecompressGuid    The guid matches this decompress method.\r
   Source          - The source buffer containing the compressed data.\r
   SourceSize      - The size of source buffer\r
   DestinationSize - The size of destination buffer.\r
@@ -809,15 +799,21 @@ Returns:
 \r
   RETURN_SUCCESS           - The size of destination buffer and the size of scratch buffer are successull retrieved.\r
   RETURN_INVALID_PARAMETER - The source data is corrupted\r
+  RETURN_UNSUPPORTED       - Decompress method is not supported.\r
 \r
 --*/\r
 {\r
-  return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r
+  if (CompareGuid (DecompressGuid, &gTianoCustomDecompressGuid)) {\r
+    return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r
+  } else {\r
+    return RETURN_UNSUPPORTED;\r
+  }\r
 }\r
 \r
 RETURN_STATUS\r
 EFIAPI\r
 CustomDecompress (\r
+  IN  CONST GUID *DecompressGuid,\r
   IN CONST VOID  *Source,\r
   IN OUT VOID    *Destination,\r
   IN OUT VOID    *Scratch\r
@@ -829,7 +825,7 @@ Routine Description:
   The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().\r
 \r
 Arguments:\r
-\r
+  DecompressGuid    The guid matches this decompress method.\r
   Source          - The source buffer containing the compressed data.\r
   Destination     - The destination buffer to store the decompressed data\r
   Scratch         - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.\r
@@ -838,8 +834,50 @@ Returns:
 \r
   RETURN_SUCCESS           - Decompression is successfull\r
   RETURN_INVALID_PARAMETER - The source data is corrupted\r
+  RETURN_UNSUPPORTED       - Decompress method is not supported.\r
 \r
 --*/\r
 {\r
-  return UefiTianoDecompress (Source, Destination, Scratch, 2);\r
+  if (CompareGuid (DecompressGuid, &gTianoCustomDecompressGuid)) {\r
+    return UefiTianoDecompress (Source, Destination, Scratch, 2);\r
+  } else {\r
+    return RETURN_UNSUPPORTED;\r
+  }\r
 }\r
+\r
+/**
+  Get decompress method guid list.\r
+\r
+  @param[in, out]  AlgorithmGuidTable   The decompress method guid list.
+  @param[in, out]  NumberOfAlgorithms   The number of decompress methods.
+
+  @retval  RETURN_SUCCESS            Get all algorithmes list successfully.
+  @retval  RETURN_INVALID_PARAMETER  Input paramter error.\r
+  @retval  RETURN_OUT_OF_RESOURCES   Source is not enough.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+CustomDecompressGetAlgorithms (\r
+   IN OUT  GUID    **AlgorithmGuidTable,\r
+   IN OUT  UINT32  *NumberOfAlgorithms\r
+  )\r
+{\r
+  if (NumberOfAlgorithms == NULL) {\r
+    return RETURN_INVALID_PARAMETER;\r
+  }\r
+  \r
+  if (*NumberOfAlgorithms < 1) {\r
+    *NumberOfAlgorithms = 1;\r
+    return RETURN_OUT_OF_RESOURCES;\r
+  }\r
+  \r
+  if (AlgorithmGuidTable == NULL) {\r
+    return RETURN_INVALID_PARAMETER;\r
+  }\r
+\r
+  AlgorithmGuidTable [0] = &gTianoCustomDecompressGuid;\r
+  *NumberOfAlgorithms = 1;\r
+  \r
+  return RETURN_SUCCESS;  \r
+}
\ No newline at end of file