Sync tianocompress with upstream and more warning fixes

This commit is contained in:
vit9696 2018-05-08 19:02:25 +03:00
parent 9ee937a429
commit f352fa0cab
5 changed files with 154 additions and 163 deletions

View file

@ -56,22 +56,20 @@ extern "C" {
--*/ --*/
EFI_STATUS EFI_STATUS
TianoCompress( TianoCompress (
CONST VOID *SrcBuffer, IN CONST VOID *SrcBuffer,
UINT32 SrcSize, IN UINT32 SrcSize,
VOID *DstBuffer, IN VOID *DstBuffer,
UINT32 *DstSize IN OUT UINT32 *DstSize
) );
;
EFI_STATUS EFI_STATUS
TianoCompressLegacy( TianoCompressLegacy(
CONST VOID *SrcBuffer, CONST VOID *SrcBuffer,
UINT32 SrcSize, UINT32 SrcSize,
VOID *DstBuffer, VOID *DstBuffer,
UINT32 *DstSize UINT32 *DstSize
) );
;
/*++ /*++
Routine Description: Routine Description:
@ -96,21 +94,20 @@ extern "C" {
--*/ --*/
EFI_STATUS EFI_STATUS
EfiCompress( EfiCompress (
CONST VOID *SrcBuffer, IN CONST VOID *SrcBuffer,
UINT32 SrcSize, IN UINT32 SrcSize,
VOID *DstBuffer, IN VOID *DstBuffer,
UINT32 *DstSize IN OUT UINT32 *DstSize
) );
;
EFI_STATUS EFI_STATUS
EfiCompressLegacy( EfiCompressLegacy(
CONST VOID *SrcBuffer, CONST VOID *SrcBuffer,
UINT32 SrcSize, UINT32 SrcSize,
VOID *DstBuffer, VOID *DstBuffer,
UINT32 *DstSize UINT32 *DstSize
) );
;
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -79,12 +79,6 @@ typedef struct {
UINT8 mPBit; UINT8 mPBit;
} SCRATCH_DATA; } SCRATCH_DATA;
STATIC
VOID
FillBuf(
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
)
/*++ /*++
Routine Description: Routine Description:
@ -99,6 +93,12 @@ NumOfBits - The number of bits to shift and read.
Returns: (VOID) Returns: (VOID)
--*/ --*/
STATIC
VOID
FillBuf (
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
)
{ {
Sd->mBitBuf = (UINT32) (((UINT64)Sd->mBitBuf) << NumOfBits); Sd->mBitBuf = (UINT32) (((UINT64)Sd->mBitBuf) << NumOfBits);
@ -127,12 +127,6 @@ Returns: (VOID)
Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount; Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
} }
STATIC
UINT32
GetBits(
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
)
/*++ /*++
Routine Description: Routine Description:
@ -151,6 +145,12 @@ Returns:
The bits that are popped out. The bits that are popped out.
--*/ --*/
STATIC
UINT32
GetBits (
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
)
{ {
UINT32 OutBits; UINT32 OutBits;
@ -161,15 +161,6 @@ The bits that are popped out.
return OutBits; return OutBits;
} }
STATIC
UINT16
MakeTable(
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfChar,
IN UINT8 *BitLen,
IN UINT16 TableBits,
OUT UINT16 *Table
)
/*++ /*++
Routine Description: Routine Description:
@ -190,6 +181,15 @@ Returns:
BAD_TABLE - The table is corrupted. BAD_TABLE - The table is corrupted.
--*/ --*/
STATIC
UINT16
MakeTable (
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfChar,
IN UINT8 *BitLen,
IN UINT16 TableBits,
OUT UINT16 *Table
)
{ {
UINT16 Count[17]; UINT16 Count[17];
UINT16 Weight[17]; UINT16 Weight[17];
@ -321,11 +321,6 @@ BAD_TABLE - The table is corrupted.
return 0; return 0;
} }
STATIC
UINT32
DecodeP(
IN SCRATCH_DATA *Sd
)
/*++ /*++
Routine Description: Routine Description:
@ -341,6 +336,11 @@ Returns:
The position value decoded. The position value decoded.
--*/ --*/
STATIC
UINT32
DecodeP (
IN SCRATCH_DATA *Sd
)
{ {
UINT16 Val; UINT16 Val;
UINT32 Mask; UINT32 Mask;
@ -375,14 +375,6 @@ The position value decoded.
return Pos; return Pos;
} }
STATIC
UINT16
ReadPTLen(
IN SCRATCH_DATA *Sd,
IN UINT16 nn,
IN UINT16 nbit,
IN UINT16 Special
)
/*++ /*++
Routine Description: Routine Description:
@ -402,6 +394,14 @@ Returns:
BAD_TABLE - Table is corrupted. BAD_TABLE - Table is corrupted.
--*/ --*/
STATIC
UINT16
ReadPTLen (
IN SCRATCH_DATA *Sd,
IN UINT16 nn,
IN UINT16 nbit,
IN UINT16 Special
)
{ {
UINT16 Number; UINT16 Number;
UINT16 CharC; UINT16 CharC;
@ -469,11 +469,6 @@ BAD_TABLE - Table is corrupted.
return MakeTable(Sd, nn, Sd->mPTLen, 8, Sd->mPTTable); return MakeTable(Sd, nn, Sd->mPTLen, 8, Sd->mPTTable);
} }
STATIC
VOID
ReadCLen(
SCRATCH_DATA *Sd
)
/*++ /*++
Routine Description: Routine Description:
@ -487,6 +482,11 @@ Sd - the global scratch data
Returns: (VOID) Returns: (VOID)
--*/ --*/
STATIC
VOID
ReadCLen (
SCRATCH_DATA *Sd
)
{ {
UINT16 Number; UINT16 Number;
UINT16 CharC; UINT16 CharC;
@ -560,11 +560,6 @@ Returns: (VOID)
return; return;
} }
STATIC
UINT16
DecodeC(
SCRATCH_DATA *Sd
)
/*++ /*++
Routine Description: Routine Description:
@ -580,6 +575,11 @@ Returns:
The value decoded. The value decoded.
--*/ --*/
STATIC
UINT16
DecodeC (
SCRATCH_DATA *Sd
)
{ {
UINT16 Index2; UINT16 Index2;
UINT32 Mask; UINT32 Mask;
@ -627,11 +627,6 @@ The value decoded.
return Index2; return Index2;
} }
STATIC
VOID
Decode(
SCRATCH_DATA *Sd
)
/*++ /*++
Routine Description: Routine Description:
@ -645,6 +640,11 @@ Sd - The global scratch data
Returns: (VOID) Returns: (VOID)
--*/ --*/
STATIC
VOID
Decode (
SCRATCH_DATA *Sd
)
{ {
UINT16 BytesRemain; UINT16 BytesRemain;
UINT32 DataIdx; UINT32 DataIdx;
@ -700,13 +700,6 @@ Returns: (VOID)
} }
} }
EFI_STATUS
GetInfo(
IN const VOID *Source,
IN UINT32 SrcSize,
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
)
/*++ /*++
Routine Description: Routine Description:
@ -726,6 +719,13 @@ EFI_SUCCESS - The size of destination buffer and the size of scratch b
EFI_INVALID_PARAMETER - The source data is corrupted EFI_INVALID_PARAMETER - The source data is corrupted
--*/ --*/
EFI_STATUS
GetInfo(
IN const VOID *Source,
IN UINT32 SrcSize,
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
)
{ {
const UINT8 *Src; const UINT8 *Src;
@ -740,16 +740,6 @@ EFI_INVALID_PARAMETER - The source data is corrupted
return EFI_SUCCESS; return EFI_SUCCESS;
} }
EFI_STATUS
Decompress(
IN const VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize,
IN UINT8 Version
)
/*++ /*++
Routine Description: Routine Description:
@ -774,6 +764,16 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted EFI_INVALID_PARAMETER - The source data is corrupted
--*/ --*/
EFI_STATUS
Decompress (
IN CONST VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize,
IN UINT8 Version
)
{ {
UINT32 Index; UINT32 Index;
UINT32 CompSize; UINT32 CompSize;
@ -866,14 +866,6 @@ EFI_INVALID_PARAMETER - The source data is corrupted
return Status; return Status;
} }
EFI_STATUS
EFIAPI
EfiTianoGetInfo(
IN const VOID *Source,
IN UINT32 SrcSize,
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
)
/*++ /*++
Routine Description: Routine Description:
@ -894,25 +886,18 @@ EFI_SUCCESS - The size of destination buffer and the size of scratch b
EFI_INVALID_PARAMETER - The source data is corrupted EFI_INVALID_PARAMETER - The source data is corrupted
--*/ --*/
{
return GetInfo(
Source,
SrcSize,
DstSize,
ScratchSize
);
}
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
EfiDecompress( EfiTianoGetInfo(
IN const VOID *Source, IN CONST VOID *Source,
IN UINT32 SrcSize, IN UINT32 SrcSize,
IN OUT VOID *Destination, OUT UINT32 *DstSize,
IN UINT32 DstSize, OUT UINT32 *ScratchSize
IN OUT VOID *Scratch, )
IN UINT32 ScratchSize {
) return GetInfo (Source, SrcSize, DstSize, ScratchSize);
}
/*++ /*++
Routine Description: Routine Description:
@ -935,11 +920,21 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted EFI_INVALID_PARAMETER - The source data is corrupted
--*/ --*/
EFI_STATUS
EFIAPI
EfiDecompress (
IN CONST VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
)
{ {
// //
// For EFI 1.1 de/compression algorithm, the version is 1. // For EFI 1.1 de/compression algorithm, the version is 1.
// //
return Decompress( return Decompress (
Source, Source,
SrcSize, SrcSize,
Destination, Destination,
@ -950,16 +945,6 @@ EFI_INVALID_PARAMETER - The source data is corrupted
); );
} }
EFI_STATUS
EFIAPI
TianoDecompress(
IN const VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
)
/*++ /*++
Routine Description: Routine Description:
@ -982,11 +967,21 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted EFI_INVALID_PARAMETER - The source data is corrupted
--*/ --*/
EFI_STATUS
EFIAPI
TianoDecompress (
IN CONST VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
)
{ {
// //
// For Tiano de/compression algorithm, the version is 2. // For Tiano de/compression algorithm, the version is 2.
// //
return Decompress( return Decompress (
Source, Source,
SrcSize, SrcSize,
Destination, Destination,

View file

@ -37,14 +37,6 @@ typedef struct EFI_TIANO_HEADER_ {
UINT32 OrigSize; UINT32 OrigSize;
} EFI_TIANO_HEADER; } EFI_TIANO_HEADER;
EFI_STATUS
EFIAPI
EfiTianoGetInfo(
const VOID *Source,
UINT32 SrcSize,
UINT32 *DstSize,
UINT32 *ScratchSize
)
/*++ /*++
Routine Description: Routine Description:
@ -64,18 +56,16 @@ EFI_SUCCESS - The size of destination buffer and the size of scratch b
EFI_INVALID_PARAMETER - The source data is corrupted EFI_INVALID_PARAMETER - The source data is corrupted
--*/ --*/
;
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
EfiDecompress( EfiTianoGetInfo (
const VOID *Source, IN CONST VOID *Source,
UINT32 SrcSize, IN UINT32 SrcSize,
VOID *Destination, OUT UINT32 *DstSize,
UINT32 DstSize, OUT UINT32 *ScratchSize
VOID *Scratch, );
UINT32 ScratchSize
);
/*++ /*++
Routine Description: Routine Description:
@ -97,18 +87,17 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted EFI_INVALID_PARAMETER - The source data is corrupted
--*/ --*/
;
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
TianoDecompress( EfiDecompress(
const VOID *Source, IN CONST VOID *Source,
UINT32 SrcSize, IN UINT32 SrcSize,
VOID *Destination, IN OUT VOID *Destination,
UINT32 DstSize, IN UINT32 DstSize,
VOID *Scratch, IN OUT VOID *Scratch,
UINT32 ScratchSize IN UINT32 ScratchSize
) );
/*++ /*++
Routine Description: Routine Description:
@ -130,7 +119,16 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted EFI_INVALID_PARAMETER - The source data is corrupted
--*/ --*/
; EFI_STATUS
EFIAPI
TianoDecompress(
IN CONST VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -16,8 +16,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <stdarg.h> #include <stdarg.h>
#include <stdint.h> #include <stdint.h>
#include <stddef.h>
typedef uint8_t USTATUS; typedef size_t USTATUS;
#define U_SUCCESS 0 #define U_SUCCESS 0
#define U_INVALID_PARAMETER 1 #define U_INVALID_PARAMETER 1
#define U_BUFFER_TOO_SMALL 2 #define U_BUFFER_TOO_SMALL 2
@ -79,7 +80,7 @@ typedef int64_t INT64;
typedef uint64_t UINT64; typedef uint64_t UINT64;
typedef char CHAR8; typedef char CHAR8;
typedef uint16_t CHAR16; typedef uint16_t CHAR16;
typedef unsigned int UINTN; typedef size_t UINTN;
#define CONST const #define CONST const
#define VOID void #define VOID void
@ -161,11 +162,11 @@ typedef struct EFI_TIME_ {
UINT8 Hour; // Hour: 0 - 23 UINT8 Hour; // Hour: 0 - 23
UINT8 Minute; // Minute: 0 - 59 UINT8 Minute; // Minute: 0 - 59
UINT8 Second; // Second: 0 - 59 UINT8 Second; // Second: 0 - 59
UINT8 : 8; UINT8 Reserved0;
UINT32 Nanosecond; // Nanosecond: 0 - 999,999,999 UINT32 Nanosecond; // Nanosecond: 0 - 999,999,999
INT16 TimeZone; // TimeZone: -1440 to 1440 or UNSPECIFIED (0x07FF) INT16 TimeZone; // TimeZone: -1440 to 1440 or UNSPECIFIED (0x07FF)
UINT8 Daylight; // Daylight: ADJUST_DAYLIGHT (1) or IN_DAYLIGHT (2) UINT8 Daylight; // Daylight: ADJUST_DAYLIGHT (1) or IN_DAYLIGHT (2)
UINT8 : 8; UINT8 Reserved1;
} EFI_TIME; } EFI_TIME;
// Align to 4 or 8 bytes // Align to 4 or 8 bytes

View file

@ -1390,7 +1390,7 @@ USTATUS NvramParser::parseVssStoreBody(const UModelIndex & index, UINT8 alignmen
UINT32 storedCrc32 = 0; UINT32 storedCrc32 = 0;
UINT32 calculatedCrc32 = 0; UINT32 calculatedCrc32 = 0;
UINT64 monotonicCounter = 0; UINT64 monotonicCounter = 0;
EFI_TIME timestamp = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; EFI_TIME timestamp = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
UINT32 pubKeyIndex = 0; UINT32 pubKeyIndex = 0;
UINT8 subtype = 0; UINT8 subtype = 0;