summaryrefslogtreecommitdiff
path: root/DuetPkg
diff options
context:
space:
mode:
authorgikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-06 03:44:47 +0000
committergikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-06 03:44:47 +0000
commit8b85412a1d3a2648e43a10f6b07e8ffa81c980d3 (patch)
tree151daf32d038cb2579eeef881ed45bb1990b81a6 /DuetPkg
parent6672d625fe088b7e3b6c4135d07e388791da8421 (diff)
downloadedk2-platforms-8b85412a1d3a2648e43a10f6b07e8ffa81c980d3.tar.xz
Ported LZMA to DUET platform.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8245 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'DuetPkg')
-rw-r--r--DuetPkg/DuetPkg.dsc1
-rw-r--r--DuetPkg/EfiLdr/EfiLdr.inf5
-rw-r--r--DuetPkg/EfiLdr/EfiLoader.c37
-rw-r--r--DuetPkg/EfiLdr/LzmaDecompress.h57
-rw-r--r--DuetPkg/PostBuild.bat6
5 files changed, 77 insertions, 29 deletions
diff --git a/DuetPkg/DuetPkg.dsc b/DuetPkg/DuetPkg.dsc
index 1a38c06d36..08b40b74ff 100644
--- a/DuetPkg/DuetPkg.dsc
+++ b/DuetPkg/DuetPkg.dsc
@@ -138,6 +138,7 @@
DuetPkg/EfiLdr/EfiLdr.inf {
<LibraryClasses>
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
}
IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf {
<LibraryClasses>
diff --git a/DuetPkg/EfiLdr/EfiLdr.inf b/DuetPkg/EfiLdr/EfiLdr.inf
index 8294f2050a..c644877784 100644
--- a/DuetPkg/EfiLdr/EfiLdr.inf
+++ b/DuetPkg/EfiLdr/EfiLdr.inf
@@ -47,8 +47,9 @@
Debug.c
PeLoader.c
Support.c
- TianoDecompress.c
- TianoDecompress.h
+ #TianoDecompress.c
+ #TianoDecompress.h
+ LzmaDecompress.h
[Guids.common]
gTianoCustomDecompressGuid
diff --git a/DuetPkg/EfiLdr/EfiLoader.c b/DuetPkg/EfiLdr/EfiLoader.c
index b193f31536..c37fba89ec 100644
--- a/DuetPkg/EfiLdr/EfiLoader.c
+++ b/DuetPkg/EfiLdr/EfiLoader.c
@@ -22,7 +22,7 @@ Revision History:
#include "Support.h"
#include "Debug.h"
#include "PeLoader.h"
-#include "TianoDecompress.h"
+#include "LzmaDecompress.h"
VOID
SystemHang(
@@ -40,7 +40,6 @@ EfiLoader (
)
{
BIOS_MEMORY_MAP *BiosMemoryMap;
- //EFILDR_HEADER *EFILDRHeader;
EFILDR_IMAGE *EFILDRImage;
EFI_MEMORY_DESCRIPTOR EfiMemoryDescriptor[EFI_MAX_MEMORY_DESCRIPTORS];
EFI_STATUS Status;
@@ -96,8 +95,7 @@ EfiLoader (
(UINTN)(EFILDR_HEADER_ADDRESS + EFILDRImage->Offset),
EFILDRImage->Offset);
PrintString (PrintBuffer);
-
- Status = TianoGetInfo (
+ Status = LzmaUefiDecompressGetInfo (
(VOID *)(UINTN)(EFILDR_HEADER_ADDRESS + EFILDRImage->Offset),
EFILDRImage->Length,
&DestinationSize,
@@ -113,15 +111,12 @@ EfiLoader (
AsciiSPrint (PrintBuffer, 256, "BFV decompress: DestinationSize=0x%X, ScratchSize=0x%X!\n",
DestinationSize, ScratchSize);
PrintString (PrintBuffer);
+ Status = LzmaUefiDecompress (
+ (VOID *)(UINTN)(EFILDR_HEADER_ADDRESS + EFILDRImage->Offset),
+ (VOID *)(UINTN)EFI_DECOMPRESSED_BUFFER_ADDRESS,
+ (VOID *)(UINTN)((EFI_DECOMPRESSED_BUFFER_ADDRESS + DestinationSize + 0x1000) & 0xfffff000)
+ );
- Status = TianoDecompress (
- (VOID *)(UINTN)(EFILDR_HEADER_ADDRESS + EFILDRImage->Offset),
- EFILDRImage->Length,
- (VOID *)(UINTN)EFI_DECOMPRESSED_BUFFER_ADDRESS,
- DestinationSize,
- (VOID *)(UINTN)((EFI_DECOMPRESSED_BUFFER_ADDRESS + DestinationSize + 0x1000) & 0xfffff000),
- ScratchSize
- );
if (EFI_ERROR (Status)) {
AsciiSPrint (PrintBuffer, 256, "Fail to decompress BFV!\n");
@@ -153,7 +148,7 @@ EfiLoader (
EFILDRImage->Offset);
PrintString (PrintBuffer);
- Status = TianoGetInfo (
+ Status = LzmaUefiDecompressGetInfo (
(VOID *)(UINTN)(EFILDR_HEADER_ADDRESS + EFILDRImage->Offset),
EFILDRImage->Length,
&DestinationSize,
@@ -165,13 +160,10 @@ EfiLoader (
SystemHang();
}
- Status = TianoDecompress (
+ Status = LzmaUefiDecompress (
(VOID *)(UINTN)(EFILDR_HEADER_ADDRESS + EFILDRImage->Offset),
- EFILDRImage->Length,
(VOID *)(UINTN)EFI_DECOMPRESSED_BUFFER_ADDRESS,
- DestinationSize,
- (VOID *)(UINTN)((EFI_DECOMPRESSED_BUFFER_ADDRESS + DestinationSize + 0x1000) & 0xfffff000),
- ScratchSize
+ (VOID *)(UINTN)((EFI_DECOMPRESSED_BUFFER_ADDRESS + DestinationSize + 0x1000) & 0xfffff000)
);
if (EFI_ERROR (Status)) {
AsciiSPrint (PrintBuffer, 256, "Fail to decompress DxeIpl image\n");
@@ -220,7 +212,7 @@ PrintHeader ('C');
EFILDRImage->Offset);
PrintString (PrintBuffer);
- Status = TianoGetInfo (
+ Status = LzmaUefiDecompressGetInfo (
(VOID *)(UINTN)(EFILDR_HEADER_ADDRESS + EFILDRImage->Offset),
EFILDRImage->Length,
&DestinationSize,
@@ -232,13 +224,10 @@ PrintHeader ('C');
SystemHang();
}
- Status = TianoDecompress (
+ Status = LzmaUefiDecompress (
(VOID *)(UINTN)(EFILDR_HEADER_ADDRESS + EFILDRImage->Offset),
- EFILDRImage->Length,
(VOID *)(UINTN)EFI_DECOMPRESSED_BUFFER_ADDRESS,
- DestinationSize,
- (VOID *)(UINTN)((EFI_DECOMPRESSED_BUFFER_ADDRESS + DestinationSize + 0x1000) & 0xfffff000),
- ScratchSize
+ (VOID *)(UINTN)((EFI_DECOMPRESSED_BUFFER_ADDRESS + DestinationSize + 0x1000) & 0xfffff000)
);
if (EFI_ERROR (Status)) {
SystemHang();
diff --git a/DuetPkg/EfiLdr/LzmaDecompress.h b/DuetPkg/EfiLdr/LzmaDecompress.h
new file mode 100644
index 0000000000..fbf645e987
--- /dev/null
+++ b/DuetPkg/EfiLdr/LzmaDecompress.h
@@ -0,0 +1,57 @@
+/** @file
+ LZMA Decompress Library header file
+
+ Copyright (c) 2006 - 2009, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __LZMADECOMPRESS_H__
+#define __LZMADECOMPRESS_H__
+
+/**
+ The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
+
+ @param Source The source buffer containing the compressed data.
+ @param SourceSize The size of source buffer
+ @param DestinationSize The size of destination buffer.
+ @param ScratchSize The size of scratch buffer.
+
+ @retval RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
+ @retval RETURN_INVALID_PARAMETER - The source data is corrupted
+**/
+RETURN_STATUS
+EFIAPI
+LzmaUefiDecompressGetInfo (
+ IN CONST VOID *Source,
+ IN UINT32 SourceSize,
+ OUT UINT32 *DestinationSize,
+ OUT UINT32 *ScratchSize
+ );
+
+/**
+ The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
+
+ @param Source - The source buffer containing the compressed data.
+ @param Destination - The destination buffer to store the decompressed data
+ @param Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
+
+ @retval RETURN_SUCCESS - Decompression is successfull
+ @retval RETURN_INVALID_PARAMETER - The source data is corrupted
+**/
+RETURN_STATUS
+EFIAPI
+LzmaUefiDecompress (
+ IN CONST VOID *Source,
+ IN OUT VOID *Destination,
+ IN OUT VOID *Scratch
+ );
+
+#endif // __LZMADECOMPRESS_H__
+
diff --git a/DuetPkg/PostBuild.bat b/DuetPkg/PostBuild.bat
index b73eed0049..8ed7943e29 100644
--- a/DuetPkg/PostBuild.bat
+++ b/DuetPkg/PostBuild.bat
@@ -17,13 +17,13 @@
@set BOOTSECTOR_OUTPUT_DIR=%BUILD_DIR%\IA32\DuetPkg\BootSector\BootSector\OUTPUT
@echo Compressing DUETEFIMainFv.FV ...
-@%BASETOOLS_DIR%\TianoCompress -e -o %BUILD_DIR%\FV\DUETEFIMAINFV.z %BUILD_DIR%\FV\DUETEFIMAINFV.Fv
+@%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DUETEFIMAINFV.z %BUILD_DIR%\FV\DUETEFIMAINFV.Fv
@echo Compressing DxeMain.efi ...
-@%BASETOOLS_DIR%\TianoCompress -e -o %BUILD_DIR%\FV\DxeMain.z %BUILD_DIR%\%PROCESSOR%\DxeCore.efi
+@%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DxeMain.z %BUILD_DIR%\%PROCESSOR%\DxeCore.efi
@echo Compressing DxeIpl.efi ...
-@%BASETOOLS_DIR%\TianoCompress -e -o %BUILD_DIR%\FV\DxeIpl.z %BUILD_DIR%\%PROCESSOR%\DxeIpl.efi
+@%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DxeIpl.z %BUILD_DIR%\%PROCESSOR%\DxeIpl.efi
@echo Generate Loader Image ...
@if "%PROCESSOR%"=="IA32" goto GENERATE_IMAGE_IA32