]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BeagleBoardPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.c
EmbeddedPkg BeagleBoardPkg: move special HOB reuse libraries into platform
[mirror_edk2.git] / BeagleBoardPkg / Library / LzmaHobCustomDecompressLib / LzmaHobCustomDecompressLib.c
diff --git a/BeagleBoardPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.c b/BeagleBoardPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.c
new file mode 100644 (file)
index 0000000..2a91a98
--- /dev/null
@@ -0,0 +1,50 @@
+/** @file\r
+  LZMA Decompress GUIDed Section Extraction Library.\r
+  It wraps Lzma decompress interfaces to GUIDed Section Extraction interfaces\r
+  and registers them into GUIDed handler table.\r
+\r
+  Copyright (c) 2009, 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
+\r
+  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
+**/\r
+\r
+#include <PiDxe.h>\r
+#include <Library/HobLib.h>\r
+#include <Library/ExtractGuidedSectionLib.h>\r
+\r
+#include <Guid/ExtractSection.h>\r
+#include <Guid/LzmaDecompress.h>\r
+\r
+\r
+/**\r
+  Register LzmaDecompress and LzmaDecompressGetInfo handlers with LzmaCustomerDecompressGuid.\r
+\r
+  @retval  RETURN_SUCCESS            Register successfully.\r
+  @retval  RETURN_OUT_OF_RESOURCES   No enough memory to store this handler.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+LzmaDecompressLibConstructor (\r
+  )\r
+{\r
+  EXTRACT_SECTION_HOB   *Hob;\r
+\r
+  Hob = GetFirstGuidHob (&gLzmaCustomDecompressGuid);\r
+  if (Hob == NULL) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  // Locate Guided Hob\r
+\r
+  return ExtractGuidedSectionRegisterHandlers (\r
+          &gLzmaCustomDecompressGuid,\r
+          Hob->Data.SectionGetInfo,\r
+          Hob->Data.SectionExtraction\r
+          );\r
+}\r