1 /** @file
2   LZMA Decompress GUIDed Section Extraction Library.
3   It wraps Lzma decompress interfaces to GUIDed Section Extraction interfaces
4   and registers them into GUIDed handler table.
5 
6   Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
7   This program and the accompanying materials
8   are licensed and made available under the terms and conditions of the BSD License
9   which accompanies this distribution.  The full text of the license may be found at
10   http://opensource.org/licenses/bsd-license.php
11 
12   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 
15 **/
16 
17 #include <PiDxe.h>
18 #include <Library/HobLib.h>
19 #include <Library/ExtractGuidedSectionLib.h>
20 
21 #include <Guid/ExtractSection.h>
22 #include <Guid/LzmaDecompress.h>
23 
24 
25 /**
26   Register LzmaDecompress and LzmaDecompressGetInfo handlers with LzmaCustomerDecompressGuid.
27 
28   @retval  RETURN_SUCCESS            Register successfully.
29   @retval  RETURN_OUT_OF_RESOURCES   No enough memory to store this handler.
30 **/
31 EFI_STATUS
32 EFIAPI
LzmaDecompressLibConstructor()33 LzmaDecompressLibConstructor (
34   )
35 {
36   EXTRACT_SECTION_HOB   *Hob;
37 
38   Hob = GetFirstGuidHob (&gLzmaCustomDecompressGuid);
39   if (Hob == NULL) {
40     return EFI_NOT_FOUND;
41   }
42 
43   // Locate Guided Hob
44 
45   return ExtractGuidedSectionRegisterHandlers (
46           &gLzmaCustomDecompressGuid,
47           Hob->Data.SectionGetInfo,
48           Hob->Data.SectionExtraction
49           );
50 }
51