summaryrefslogtreecommitdiff
path: root/Tools/CCode
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2006-12-07 11:32:26 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2006-12-07 11:32:26 +0000
commit4afc6a7bf2e75801630c298a312a0ab552a1369f (patch)
tree22efaa56864d5964f50574118c54e2728a85a484 /Tools/CCode
parent77206d75adb5b2f1763352e57e5211edb07a6101 (diff)
downloadedk2-4afc6a7bf2e75801630c298a312a0ab552a1369f.zip
edk2-4afc6a7bf2e75801630c298a312a0ab552a1369f.tar.gz
edk2-4afc6a7bf2e75801630c298a312a0ab552a1369f.tar.bz2
(1) Using EfiCompress in place of TianoCompress as EFI_STANDARD_COMPRESSION type to conform to spec.
(2) Remove unused library class EdkPeCoffLoaderX64Lib and library instance EdkPeCoffLoaderX64Lib, because current BasePeCoffLib can supports IA32, EBC, & X64 images all. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2069 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/CCode')
-rw-r--r--Tools/CCode/Source/Common/Decompress.c (renamed from Tools/CCode/Source/Common/EfiDecompress.c)155
-rw-r--r--Tools/CCode/Source/Common/Decompress.h (renamed from Tools/CCode/Source/Common/EfiDecompress.h)76
-rw-r--r--Tools/CCode/Source/CompressDll/CompressDll.c10
-rw-r--r--Tools/CCode/Source/GenFfsFile/GenFfsFile.c4
-rw-r--r--Tools/CCode/Source/GenSection/GenSection.c2
5 files changed, 218 insertions, 29 deletions
diff --git a/Tools/CCode/Source/Common/EfiDecompress.c b/Tools/CCode/Source/Common/Decompress.c
index 288c425..07b2b8c 100644
--- a/Tools/CCode/Source/Common/EfiDecompress.c
+++ b/Tools/CCode/Source/Common/Decompress.c
@@ -11,15 +11,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
- EfiDecompress.c
+ Decompress.c
Abstract:
- Decompressor. Algorithm Ported from OPSD code (Decomp.asm)
+ Decompressor. Algorithm Ported from OPSD code (Decomp.asm)
+ for Efi and Tiano compress algorithm.
--*/
-#include "EfiDecompress.h"
+#include "Decompress.h"
//
// Decompression algorithm begins here
@@ -33,11 +34,12 @@ Abstract:
//
// C: Char&Len Set; P: Position Set; T: exTra Set
//
-#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
-#define CBIT 9
-#define PBIT 5
-#define TBIT 5
-#define MAXNP ((1U << PBIT) - 1)
+#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
+#define CBIT 9
+#define EFIPBIT 4
+#define MAXPBIT 5
+#define TBIT 5
+#define MAXNP ((1U << MAXPBIT) - 1)
#define NT (CODE_BIT + 3)
#if NT > MAXNP
#define NPT NT
@@ -68,6 +70,8 @@ typedef struct {
UINT16 mPTTable[256];
} SCRATCH_DATA;
+STATIC UINT16 mPbit = EFIPBIT;
+
STATIC
VOID
FillBuf (
@@ -556,7 +560,7 @@ Returns:
ReadCLen (Sd);
- Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, PBIT, (UINT16) (-1));
+ Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, mPbit, (UINT16) (-1));
if (Sd->mBadTableFlag != 0) {
return 0;
}
@@ -706,11 +710,10 @@ Decompress (
Routine Description:
- The implementation of EFI_DECOMPRESS_PROTOCOL.Decompress().
+ The implementation Efi and Tiano Decompress().
Arguments:
- This - The protocol instance pointer
Source - The source buffer containing the compressed data.
SrcSize - The size of source buffer
Destination - The destination buffer to store the decompressed data
@@ -788,3 +791,133 @@ Returns:
return Status;
}
+
+EFI_STATUS
+EfiGetInfo (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ OUT UINT32 *DstSize,
+ OUT UINT32 *ScratchSize
+ )
+/*++
+
+Routine Description:
+
+ The implementation Efi Decompress GetInfo().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ DstSize - The size of destination buffer.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+--*/
+{
+ return GetInfo (Source, SrcSize, DstSize, ScratchSize);
+}
+
+EFI_STATUS
+TianoGetInfo (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ OUT UINT32 *DstSize,
+ OUT UINT32 *ScratchSize
+ )
+/*++
+
+Routine Description:
+
+ The implementation Tiano Decompress GetInfo().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ DstSize - The size of destination buffer.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+--*/
+{
+ return GetInfo (Source, SrcSize, DstSize, ScratchSize);
+}
+
+EFI_STATUS
+EfiDecompress (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
+ )
+/*++
+
+Routine Description:
+
+ The implementation of Efi Decompress().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ Destination - The destination buffer to store the decompressed data
+ DstSize - The size of destination buffer.
+ Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - Decompression is successfull
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+--*/
+{
+ mPbit = EFIPBIT;
+ return Decompress (Source, SrcSize, Destination, DstSize, Scratch, ScratchSize);
+}
+
+EFI_STATUS
+TianoDecompress (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
+ )
+/*++
+
+Routine Description:
+
+ The implementation of Tiano Decompress().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ Destination - The destination buffer to store the decompressed data
+ DstSize - The size of destination buffer.
+ Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - Decompression is successfull
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+--*/
+{
+ mPbit = MAXPBIT;
+ return Decompress (Source, SrcSize, Destination, DstSize, Scratch, ScratchSize);
+}
diff --git a/Tools/CCode/Source/Common/EfiDecompress.h b/Tools/CCode/Source/Common/Decompress.h
index 3f82ac6..5984e0b 100644
--- a/Tools/CCode/Source/Common/EfiDecompress.h
+++ b/Tools/CCode/Source/Common/Decompress.h
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004, Intel Corporation
+Copyright (c) 2006, Intel Corporation
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
@@ -11,7 +11,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
- EfiDecompress.h
+ Decompress.h
Abstract:
@@ -25,18 +25,17 @@ Abstract:
#include <Common/UefiBaseTypes.h>
EFI_STATUS
-GetInfo (
+EfiGetInfo (
IN VOID *Source,
IN UINT32 SrcSize,
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
);
-
/*++
Routine Description:
- The implementation of EFI_DECOMPRESS_PROTOCOL.GetInfo().
+ The implementation Efi Decompress GetInfo().
Arguments:
@@ -51,26 +50,82 @@ Returns:
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
+
EFI_STATUS
-Decompress (
+EfiDecompress (
IN VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
- )
-;
+ );
+/*++
+Routine Description:
+
+ The implementation of Efi Decompress().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ Destination - The destination buffer to store the decompressed data
+ DstSize - The size of destination buffer.
+ Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - Decompression is successfull
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+--*/
+
+EFI_STATUS
+TianoGetInfo (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ OUT UINT32 *DstSize,
+ OUT UINT32 *ScratchSize
+ );
/*++
Routine Description:
- The implementation of EFI_DECOMPRESS_PROTOCOL.Decompress().
+ The implementation Tiano Decompress GetInfo().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ DstSize - The size of destination buffer.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+--*/
+
+EFI_STATUS
+TianoDecompress (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
+ );
+/*++
+
+Routine Description:
+
+ The implementation of Tiano Decompress().
Arguments:
- This - The protocol instance pointer
Source - The source buffer containing the compressed data.
SrcSize - The size of source buffer
Destination - The destination buffer to store the decompressed data
@@ -84,6 +139,7 @@ Returns:
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
+
typedef
EFI_STATUS
(*GETINFO_FUNCTION) (
diff --git a/Tools/CCode/Source/CompressDll/CompressDll.c b/Tools/CCode/Source/CompressDll/CompressDll.c
index f46e603..00cff56 100644
--- a/Tools/CCode/Source/CompressDll/CompressDll.c
+++ b/Tools/CCode/Source/CompressDll/CompressDll.c
@@ -19,7 +19,7 @@ typedef long long __int64;/*For cygwin build*/
extern
EFI_STATUS
-TianoCompress (
+EfiCompress (
IN UINT8 *SrcBuffer,
IN UINT32 SrcSize,
IN UINT8 *DstBuffer,
@@ -47,7 +47,7 @@ JNIEXPORT jbyteArray JNICALL Java_org_tianocore_framework_tasks_Compress_CallCo
// First call compress function and get need buffer size
//
- Result = TianoCompress (
+ Result = EfiCompress (
(char*) InputBuffer,
SourceSize,
DestBuffer,
@@ -61,12 +61,12 @@ JNIEXPORT jbyteArray JNICALL Java_org_tianocore_framework_tasks_Compress_CallCo
//
// Second call compress and get the DestBuffer value
//
- Result = TianoCompress(
- (char*) InputBuffer,
+ Result = EfiCompress(
+ (char*) InputBuffer,
SourceSize,
DestBuffer,
&DestSize
- );
+ );
//
// new a MV array to store the return compressed buffer
diff --git a/Tools/CCode/Source/GenFfsFile/GenFfsFile.c b/Tools/CCode/Source/GenFfsFile/GenFfsFile.c
index 2ee7c44..d4e5468 100644
--- a/Tools/CCode/Source/GenFfsFile/GenFfsFile.c
+++ b/Tools/CCode/Source/GenFfsFile/GenFfsFile.c
@@ -591,14 +591,14 @@ Returns:
// Added "Dummy" to keep backward compatibility.
//
CompressionType = EFI_STANDARD_COMPRESSION;
- CompressFunction = (COMPRESS_FUNCTION) TianoCompress;
+ CompressFunction = (COMPRESS_FUNCTION) EfiCompress;
} else if (strcmpi (Type, "LZH") == 0) {
//
// EFI stardard compression (LZH)
//
CompressionType = EFI_STANDARD_COMPRESSION;
- CompressFunction = (COMPRESS_FUNCTION) TianoCompress;
+ CompressFunction = (COMPRESS_FUNCTION) EfiCompress;
} else {
//
diff --git a/Tools/CCode/Source/GenSection/GenSection.c b/Tools/CCode/Source/GenSection/GenSection.c
index 8599346..3209b1e 100644
--- a/Tools/CCode/Source/GenSection/GenSection.c
+++ b/Tools/CCode/Source/GenSection/GenSection.c
@@ -429,7 +429,7 @@ Returns:
break;
case EFI_STANDARD_COMPRESSION:
- CompressFunction = (COMPRESS_FUNCTION) TianoCompress;
+ CompressFunction = (COMPRESS_FUNCTION) EfiCompress;
break;
case EFI_CUSTOMIZED_COMPRESSION: