This commit is contained in:
Alex Matrosov 2018-04-29 22:38:54 -07:00
parent 956a804dd5
commit a5ce9ab3d9
16 changed files with 3575 additions and 3514 deletions

View File

@ -62,9 +62,9 @@ INT32
EFIAPI EFIAPI
LzmaCompress( LzmaCompress(
CONST UINT8 *Source, CONST UINT8 *Source,
UINT32 SourceSize, UINTN SourceSize,
UINT8 *Destination, UINT8 *Destination,
UINT32 *DestinationSize UINTN *DestinationSize
) )
{ {
SRes LzmaResult; SRes LzmaResult;
@ -98,7 +98,7 @@ UINT32 *DestinationSize
*DestinationSize = destLen + LZMA_HEADER_SIZE; *DestinationSize = destLen + LZMA_HEADER_SIZE;
SetEncodedSizeOfBuf((UINT64)SourceSize, Destination); SetEncodedSizeOfBuf(SourceSize, Destination);
if (LzmaResult == SZ_OK) { if (LzmaResult == SZ_OK) {
return ERR_SUCCESS; return ERR_SUCCESS;

View File

@ -28,9 +28,9 @@ extern "C" {
EFIAPI EFIAPI
LzmaCompress( LzmaCompress(
const UINT8 *Source, const UINT8 *Source,
UINT32 SourceSize, UINTN SourceSize,
UINT8 *Destination, UINT8 *Destination,
UINT32 *DestinationSize UINTN *DestinationSize
); );
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -89,17 +89,13 @@ INT32
EFIAPI EFIAPI
LzmaGetInfo( LzmaGetInfo(
CONST VOID *Source, CONST VOID *Source,
UINT32 SourceSize, UINTN SourceSize,
UINT32 *DestinationSize UINTN *DestinationSize
) )
{ {
UInt64 DecodedSize;
ASSERT(SourceSize >= LZMA_HEADER_SIZE); (void)SourceSize; ASSERT(SourceSize >= LZMA_HEADER_SIZE); (void)SourceSize;
DecodedSize = GetDecodedSizeOfBuf((UINT8*)Source); *DestinationSize = (UINTN)GetDecodedSizeOfBuf((UINT8*)Source);
*DestinationSize = (UINT32)DecodedSize;
return ERR_SUCCESS; return ERR_SUCCESS;
} }
@ -126,7 +122,7 @@ INT32
EFIAPI EFIAPI
LzmaDecompress( LzmaDecompress(
CONST VOID *Source, CONST VOID *Source,
UINT32 SourceSize, UINTN SourceSize,
VOID *Destination VOID *Destination
) )
{ {

View File

@ -61,8 +61,8 @@ extern "C" {
EFIAPI EFIAPI
LzmaGetInfo( LzmaGetInfo(
const VOID *Source, const VOID *Source,
UINT32 SourceSize, UINTN SourceSize,
UINT32 *DestinationSize UINTN *DestinationSize
); );
/* /*
@ -88,7 +88,7 @@ extern "C" {
EFIAPI EFIAPI
LzmaDecompress( LzmaDecompress(
const VOID *Source, const VOID *Source,
UINT32 SourceSize, UINTN SourceSize,
VOID *Destination VOID *Destination
); );

View File

@ -69,18 +69,15 @@ PutDword(
STATIC STATIC
EFI_STATUS EFI_STATUS
AllocateMemory ( AllocateMemory(VOID);
);
STATIC STATIC
VOID VOID
FreeMemory ( FreeMemory(VOID);
);
STATIC STATIC
VOID VOID
InitSlide ( InitSlide(VOID);
);
STATIC STATIC
NODE NODE
@ -105,28 +102,23 @@ Split (
STATIC STATIC
VOID VOID
InsertNode ( InsertNode(VOID);
);
STATIC STATIC
VOID VOID
DeleteNode ( DeleteNode(VOID);
);
STATIC STATIC
VOID VOID
GetNextMatch ( GetNextMatch(VOID);
);
STATIC STATIC
EFI_STATUS EFI_STATUS
Encode ( Encode(VOID);
);
STATIC STATIC
VOID VOID
CountTFreq ( CountTFreq(VOID);
);
STATIC STATIC
VOID VOID
@ -138,8 +130,7 @@ WritePTLen (
STATIC STATIC
VOID VOID
WriteCLen ( WriteCLen(VOID);
);
STATIC STATIC
VOID VOID
@ -155,8 +146,7 @@ EncodeP (
STATIC STATIC
VOID VOID
SendBlock ( SendBlock(VOID);
);
STATIC STATIC
VOID VOID
@ -167,18 +157,15 @@ Output (
STATIC STATIC
VOID VOID
HufEncodeStart ( HufEncodeStart(VOID);
);
STATIC STATIC
VOID VOID
HufEncodeEnd ( HufEncodeEnd(VOID);
);
STATIC STATIC
VOID VOID
MakeCrcTable ( MakeCrcTable(VOID);
);
STATIC STATIC
VOID VOID
@ -196,8 +183,7 @@ FreadCrc (
STATIC STATIC
VOID VOID
InitPutBits ( InitPutBits(VOID);
);
STATIC STATIC
VOID VOID
@ -346,7 +332,8 @@ Returns:
if (mCompSize + 1 + 8 > *DstSize) { if (mCompSize + 1 + 8 > *DstSize) {
*DstSize = mCompSize + 1 + 8; *DstSize = mCompSize + 1 + 8;
return EFI_BUFFER_TOO_SMALL; return EFI_BUFFER_TOO_SMALL;
} else { }
else {
*DstSize = mCompSize + 1 + 8; *DstSize = mCompSize + 1 + 8;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -506,6 +493,9 @@ Returns:
UINT32 i; UINT32 i;
mText = malloc(WNDSIZ * 2 + MAXMATCH); mText = malloc(WNDSIZ * 2 + MAXMATCH);
if (NULL == mText)
return EFI_OUT_OF_RESOURCES;
for (i = 0; i < WNDSIZ * 2 + MAXMATCH; i++) { for (i = 0; i < WNDSIZ * 2 + MAXMATCH; i++) {
mText[i] = 0; mText[i] = 0;
} }
@ -687,7 +677,7 @@ Returns: (VOID)
STATIC STATIC
VOID VOID
Split ( Split (
NODE Old IN NODE Old
) )
/*++ /*++
@ -765,7 +755,8 @@ Returns: (VOID)
if (t < (NODE)WNDSIZ) { if (t < (NODE)WNDSIZ) {
mPosition[t] = (NODE)(mPos | PERC_FLAG); mPosition[t] = (NODE)(mPos | PERC_FLAG);
} }
} else { }
else {
// //
// Locate the target tree // Locate the target tree
@ -791,7 +782,8 @@ Returns: (VOID)
if (r >= (NODE)WNDSIZ) { if (r >= (NODE)WNDSIZ) {
j = MAXMATCH; j = MAXMATCH;
mMatchPos = r; mMatchPos = r;
} else { }
else {
j = mLevel[r]; j = mLevel[r];
mMatchPos = (NODE)(mPosition[r] & ~PERC_FLAG); mMatchPos = (NODE)(mPosition[r] & ~PERC_FLAG);
} }
@ -995,7 +987,8 @@ Returns:
// //
Output(mText[mPos - 1], 0); Output(mText[mPos - 1], 0);
} else { }
else {
// //
// Outputting a pointer is beneficial enough, do it. // Outputting a pointer is beneficial enough, do it.
@ -1052,15 +1045,19 @@ Returns: (VOID)
} }
if (Count <= 2) { if (Count <= 2) {
mTFreq[0] = (UINT16)(mTFreq[0] + Count); mTFreq[0] = (UINT16)(mTFreq[0] + Count);
} else if (Count <= 18) { }
else if (Count <= 18) {
mTFreq[1]++; mTFreq[1]++;
} else if (Count == 19) { }
else if (Count == 19) {
mTFreq[0]++; mTFreq[0]++;
mTFreq[1]++; mTFreq[1]++;
} else { }
else {
mTFreq[2]++; mTFreq[2]++;
} }
} else { }
else {
mTFreq[k + 2]++; mTFreq[k + 2]++;
} }
} }
@ -1100,7 +1097,8 @@ Returns: (VOID)
k = mPTLen[i++]; k = mPTLen[i++];
if (k <= 6) { if (k <= 6) {
PutBits(3, k); PutBits(3, k);
} else { }
else {
PutBits(k - 3, (1U << (k - 3)) - 2); PutBits(k - 3, (1U << (k - 3)) - 2);
} }
if (i == Special) { if (i == Special) {
@ -1147,18 +1145,22 @@ Returns: (VOID)
for (k = 0; k < Count; k++) { for (k = 0; k < Count; k++) {
PutBits(mPTLen[0], mPTCode[0]); PutBits(mPTLen[0], mPTCode[0]);
} }
} else if (Count <= 18) { }
else if (Count <= 18) {
PutBits(mPTLen[1], mPTCode[1]); PutBits(mPTLen[1], mPTCode[1]);
PutBits(4, Count - 3); PutBits(4, Count - 3);
} else if (Count == 19) { }
else if (Count == 19) {
PutBits(mPTLen[0], mPTCode[0]); PutBits(mPTLen[0], mPTCode[0]);
PutBits(mPTLen[1], mPTCode[1]); PutBits(mPTLen[1], mPTCode[1]);
PutBits(4, 15); PutBits(4, 15);
} else { }
else {
PutBits(mPTLen[2], mPTCode[2]); PutBits(mPTLen[2], mPTCode[2]);
PutBits(CBIT, Count - 20); PutBits(CBIT, Count - 20);
} }
} else { }
else {
PutBits(mPTLen[k + 2], mPTCode[k + 2]); PutBits(mPTLen[k + 2], mPTCode[k + 2]);
} }
} }
@ -1219,12 +1221,14 @@ Returns: (VOID)
Root = MakeTree(NT, mTFreq, mPTLen, mPTCode); Root = MakeTree(NT, mTFreq, mPTLen, mPTCode);
if (Root >= NT) { if (Root >= NT) {
WritePTLen(NT, TBIT, 3); WritePTLen(NT, TBIT, 3);
} else { }
else {
PutBits(TBIT, 0); PutBits(TBIT, 0);
PutBits(TBIT, Root); PutBits(TBIT, Root);
} }
WriteCLen(); WriteCLen();
} else { }
else {
PutBits(TBIT, 0); PutBits(TBIT, 0);
PutBits(TBIT, 0); PutBits(TBIT, 0);
PutBits(CBIT, 0); PutBits(CBIT, 0);
@ -1233,7 +1237,8 @@ Returns: (VOID)
Root = MakeTree(NP, mPFreq, mPTLen, mPTCode); Root = MakeTree(NP, mPFreq, mPTLen, mPTCode);
if (Root >= NP) { if (Root >= NP) {
WritePTLen(NP, gPBIT, -1); WritePTLen(NP, gPBIT, -1);
} else { }
else {
PutBits(gPBIT, 0); PutBits(gPBIT, 0);
PutBits(gPBIT, Root); PutBits(gPBIT, Root);
} }
@ -1241,7 +1246,8 @@ Returns: (VOID)
for (i = 0; i < Size; i++) { for (i = 0; i < Size; i++) {
if (i % UINT8_BIT == 0) { if (i % UINT8_BIT == 0) {
Flags = mBuf[Pos++]; Flags = mBuf[Pos++];
} else { }
else {
Flags <<= 1; Flags <<= 1;
} }
if (Flags & (1U << (UINT8_BIT - 1))) { if (Flags & (1U << (UINT8_BIT - 1))) {
@ -1249,7 +1255,8 @@ Returns: (VOID)
k = mBuf[Pos++] << UINT8_BIT; k = mBuf[Pos++] << UINT8_BIT;
k += mBuf[Pos++]; k += mBuf[Pos++];
EncodeP(k); EncodeP(k);
} else { }
else {
EncodeC(mBuf[Pos++]); EncodeC(mBuf[Pos++]);
} }
} }
@ -1352,7 +1359,8 @@ MakeCrcTable ()
for (j = 0; j < UINT8_BIT; j++) { for (j = 0; j < UINT8_BIT; j++) {
if (r & 1) { if (r & 1) {
r = (r >> 1) ^ CRCPOLY; r = (r >> 1) ^ CRCPOLY;
} else { }
else {
r >>= 1; r >>= 1;
} }
} }
@ -1385,7 +1393,8 @@ Returns: (VOID)
if (n < mBitCount) { if (n < mBitCount) {
mSubBitBuf |= x << (mBitCount -= n); mSubBitBuf |= x << (mBitCount -= n);
} else { }
else {
Temp = (UINT8)(mSubBitBuf | (x >> (n -= mBitCount))); Temp = (UINT8)(mSubBitBuf | (x >> (n -= mBitCount)));
if (mDst < mDstUpperLimit) { if (mDst < mDstUpperLimit) {
@ -1395,7 +1404,8 @@ Returns: (VOID)
if (n < UINT8_BIT) { if (n < UINT8_BIT) {
mSubBitBuf = x << (mBitCount = UINT8_BIT - n); mSubBitBuf = x << (mBitCount = UINT8_BIT - n);
} else { }
else {
Temp = (UINT8)(x >> (n - UINT8_BIT)); Temp = (UINT8)(x >> (n - UINT8_BIT));
if (mDst < mDstUpperLimit) { if (mDst < mDstUpperLimit) {
@ -1478,7 +1488,8 @@ Returns: (VOID)
if (i < mN) { if (i < mN) {
mLenCnt[(Depth < 16) ? Depth : 16]++; mLenCnt[(Depth < 16) ? Depth : 16]++;
} else { }
else {
Depth++; Depth++;
CountLen(mLeft[i]); CountLen(mLeft[i]);
CountLen(mRight[i]); CountLen(mRight[i]);

View File

@ -57,12 +57,11 @@ 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(
@ -70,8 +69,7 @@ extern "C" {
UINT32 SrcSize, UINT32 SrcSize,
VOID *DstBuffer, VOID *DstBuffer,
UINT32 *DstSize UINT32 *DstSize
) );
;
/*++ /*++
Routine Description: Routine Description:
@ -97,20 +95,19 @@ 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

@ -463,7 +463,8 @@ UINT32 *DstSize
if (mCompSize + 1 + 8 > *DstSize) { if (mCompSize + 1 + 8 > *DstSize) {
*DstSize = mCompSize + 1 + 8; *DstSize = mCompSize + 1 + 8;
return EFI_BUFFER_TOO_SMALL; return EFI_BUFFER_TOO_SMALL;
} else { }
else {
*DstSize = mCompSize + 1 + 8; *DstSize = mCompSize + 1 + 8;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -530,6 +531,9 @@ STATIC
UINT32 Index; UINT32 Index;
mText = malloc(WNDSIZ * 2 + MAXMATCH); mText = malloc(WNDSIZ * 2 + MAXMATCH);
if (NULL == mText)
return EFI_OUT_OF_RESOURCES;
for (Index = 0; Index < WNDSIZ * 2 + MAXMATCH; Index++) { for (Index = 0; Index < WNDSIZ * 2 + MAXMATCH; Index++) {
mText[Index] = 0; mText[Index] = 0;
} }
@ -813,7 +817,8 @@ STATIC
if (NodeT < (NODE)WNDSIZ) { if (NodeT < (NODE)WNDSIZ) {
mPosition[NodeT] = (NODE)(mPos | (UINT32)PERC_FLAG); mPosition[NodeT] = (NODE)(mPos | (UINT32)PERC_FLAG);
} }
} else { }
else {
// //
// Locate the target tree // Locate the target tree
// //
@ -837,7 +842,8 @@ STATIC
if (NodeR >= (NODE)WNDSIZ) { if (NodeR >= (NODE)WNDSIZ) {
Index2 = MAXMATCH; Index2 = MAXMATCH;
mMatchPos = NodeR; mMatchPos = NodeR;
} else { }
else {
Index2 = mLevel[NodeR]; Index2 = mLevel[NodeR];
mMatchPos = (NODE)(mPosition[NodeR] & (UINT32)~PERC_FLAG); mMatchPos = (NODE)(mPosition[NodeR] & (UINT32)~PERC_FLAG);
} }
@ -1076,7 +1082,8 @@ STATIC
// //
Output(mText[mPos - 1], 0); Output(mText[mPos - 1], 0);
} else { }
else {
if (LastMatchLen == THRESHOLD) { if (LastMatchLen == THRESHOLD) {
if (((mPos - LastMatchPos - 2) & (WNDSIZ - 1)) > (1U << 11)) { if (((mPos - LastMatchPos - 2) & (WNDSIZ - 1)) > (1U << 11)) {
@ -1151,15 +1158,19 @@ STATIC
if (Count <= 2) { if (Count <= 2) {
mTFreq[0] = (UINT16)(mTFreq[0] + Count); mTFreq[0] = (UINT16)(mTFreq[0] + Count);
} else if (Count <= 18) { }
else if (Count <= 18) {
mTFreq[1]++; mTFreq[1]++;
} else if (Count == 19) { }
else if (Count == 19) {
mTFreq[0]++; mTFreq[0]++;
mTFreq[1]++; mTFreq[1]++;
} else { }
else {
mTFreq[2]++; mTFreq[2]++;
} }
} else { }
else {
mTFreq[Index3 + 2]++; mTFreq[Index3 + 2]++;
} }
} }
@ -1201,7 +1212,8 @@ STATIC
Index3 = mPTLen[Index++]; Index3 = mPTLen[Index++];
if (Index3 <= 6) { if (Index3 <= 6) {
PutBits(3, Index3); PutBits(3, Index3);
} else { }
else {
PutBits(Index3 - 3, (1U << (Index3 - 3)) - 2); PutBits(Index3 - 3, (1U << (Index3 - 3)) - 2);
} }
@ -1257,18 +1269,22 @@ STATIC
for (Index3 = 0; Index3 < Count; Index3++) { for (Index3 = 0; Index3 < Count; Index3++) {
PutBits(mPTLen[0], mPTCode[0]); PutBits(mPTLen[0], mPTCode[0]);
} }
} else if (Count <= 18) { }
else if (Count <= 18) {
PutBits(mPTLen[1], mPTCode[1]); PutBits(mPTLen[1], mPTCode[1]);
PutBits(4, Count - 3); PutBits(4, Count - 3);
} else if (Count == 19) { }
else if (Count == 19) {
PutBits(mPTLen[0], mPTCode[0]); PutBits(mPTLen[0], mPTCode[0]);
PutBits(mPTLen[1], mPTCode[1]); PutBits(mPTLen[1], mPTCode[1]);
PutBits(4, 15); PutBits(4, 15);
} else { }
else {
PutBits(mPTLen[2], mPTCode[2]); PutBits(mPTLen[2], mPTCode[2]);
PutBits(CBIT, Count - 20); PutBits(CBIT, Count - 20);
} }
} else { }
else {
PutBits(mPTLen[Index3 + 2], mPTCode[Index3 + 2]); PutBits(mPTLen[Index3 + 2], mPTCode[Index3 + 2]);
} }
} }
@ -1341,13 +1357,15 @@ STATIC
Root = MakeTree(NT, mTFreq, mPTLen, mPTCode); Root = MakeTree(NT, mTFreq, mPTLen, mPTCode);
if (Root >= NT) { if (Root >= NT) {
WritePTLen(NT, TBIT, 3); WritePTLen(NT, TBIT, 3);
} else { }
else {
PutBits(TBIT, 0); PutBits(TBIT, 0);
PutBits(TBIT, Root); PutBits(TBIT, Root);
} }
WriteCLen(); WriteCLen();
} else { }
else {
PutBits(TBIT, 0); PutBits(TBIT, 0);
PutBits(TBIT, 0); PutBits(TBIT, 0);
PutBits(CBIT, 0); PutBits(CBIT, 0);
@ -1357,7 +1375,8 @@ STATIC
Root = MakeTree(NP, mPFreq, mPTLen, mPTCode); Root = MakeTree(NP, mPFreq, mPTLen, mPTCode);
if (Root >= NP) { if (Root >= NP) {
WritePTLen(NP, mPbit, -1); WritePTLen(NP, mPbit, -1);
} else { }
else {
PutBits(mPbit, 0); PutBits(mPbit, 0);
PutBits(mPbit, Root); PutBits(mPbit, Root);
} }
@ -1366,7 +1385,8 @@ STATIC
for (Index = 0; Index < Size; Index++) { for (Index = 0; Index < Size; Index++) {
if (Index % UINT8_BIT == 0) { if (Index % UINT8_BIT == 0) {
Flags = mBuf[Pos++]; Flags = mBuf[Pos++];
} else { }
else {
Flags <<= 1; Flags <<= 1;
} }
@ -1379,7 +1399,8 @@ STATIC
} }
EncodeP(Index3); EncodeP(Index3);
} else { }
else {
EncodeC(mBuf[Pos++]); EncodeC(mBuf[Pos++]);
} }
} }
@ -1502,7 +1523,8 @@ STATIC
for (Index2 = 0; Index2 < UINT8_BIT; Index2++) { for (Index2 = 0; Index2 < UINT8_BIT; Index2++) {
if (Temp & 1) { if (Temp & 1) {
Temp = (Temp >> 1) ^ CRCPOLY; Temp = (Temp >> 1) ^ CRCPOLY;
} else { }
else {
Temp >>= 1; Temp >>= 1;
} }
} }
@ -1626,7 +1648,8 @@ STATIC
if (Index < mN) { if (Index < mN) {
mLenCnt[(Depth < 16) ? Depth : 16]++; mLenCnt[(Depth < 16) ? Depth : 16]++;
} else { }
else {
Depth++; Depth++;
CountLen(mLeft[Index]); CountLen(mLeft[Index]);
CountLen(mRight[Index]); CountLen(mRight[Index]);

View File

@ -38,12 +38,11 @@ extern "C" {
} EFI_TIANO_HEADER; } EFI_TIANO_HEADER;
EFI_STATUS EFI_STATUS
EFIAPI
EfiTianoGetInfo( EfiTianoGetInfo(
const VOID *Source, IN const VOID *Source,
UINT32 SrcSize, IN UINT32 SrcSize,
UINT32 *DstSize, OUT UINT32 *DstSize,
UINT32 *ScratchSize OUT UINT32 *ScratchSize
) )
/*++ /*++
@ -70,12 +69,12 @@ extern "C" {
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
EfiDecompress( 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
) )
/*++ /*++
@ -104,12 +103,12 @@ extern "C" {
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
TianoDecompress( TianoDecompress(
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
) )
/*++ /*++

View File

@ -52,8 +52,9 @@ F7731B4C-58A2-4DF4-8980-5645D39ECE58 10 P:0FBA6C24380F:0FBA7424380F
299D6F8B-2EC9-4E40-9EC6-DDAA7EBF5FD9 10 P:81E10080000033C1:9090909090909090 299D6F8B-2EC9-4E40-9EC6-DDAA7EBF5FD9 10 P:81E10080000033C1:9090909090909090
299D6F8B-2EC9-4E40-9EC6-DDAA7EBF5FD9 12 P:81E10080000033C1:9090909090909090 299D6F8B-2EC9-4E40-9EC6-DDAA7EBF5FD9 12 P:81E10080000033C1:9090909090909090
# PpmInitialize | Skylake-X # SiInit | Skylake-X
3FFCAE95-23CF-4967-94F5-16352F68E43B 10 P:742CB9E2000000:752CB9E2000000 D71C8BA4-4AF2-4D0D-B1BA-F2409F0C20D3 10 P:81E10080000033C1:9090909090909090
D71C8BA4-4AF2-4D0D-B1BA-F2409F0C20D3 12 P:81E10080000033C1:9090909090909090
# CpuInitPei | Skylake-X # PpmInitialize | Skylake-X, Kaby Lake-X
01359D99-9446-456D-ADA4-50A711C03ADA 12 P:BE0080000023CE0B:BE0000000023CE0B 3FFCAE95-23CF-4967-94F5-16352F68E43B 10 P:0FBAE80F:0FBAE00F

View File

@ -95,6 +95,7 @@ public:
UINT8 replace(const QModelIndex & index, const QByteArray & object, const UINT8 mode); UINT8 replace(const QModelIndex & index, const QByteArray & object, const UINT8 mode);
UINT8 remove(const QModelIndex & index); UINT8 remove(const QModelIndex & index);
UINT8 rebuild(const QModelIndex & index); UINT8 rebuild(const QModelIndex & index);
UINT8 doNotRebuild(const QModelIndex & index);
UINT8 dump(const QModelIndex & index, const QString & path, const QString & filter = QString()); UINT8 dump(const QModelIndex & index, const QString & path, const QString & filter = QString());
UINT8 patch(const QModelIndex & index, const QVector<PatchData> & patches); UINT8 patch(const QModelIndex & index, const QVector<PatchData> & patches);

View File

@ -150,6 +150,8 @@ QString actionTypeToQString(const UINT8 action)
return QObject::tr("Rebuild"); return QObject::tr("Rebuild");
case Actions::Rebase: case Actions::Rebase:
return QObject::tr("Rebase"); return QObject::tr("Rebase");
case Actions::DoNotRebuild:
return QObject::tr("Do not rebuild");
default: default:
return QObject::tr("Unknown"); return QObject::tr("Unknown");
} }

View File

@ -26,7 +26,8 @@ namespace Actions
Replace, Replace,
Remove, Remove,
Rebuild, Rebuild,
Rebase Rebase,
DoNotRebuild
}; };
} }

View File

@ -17,7 +17,7 @@
UEFITool::UEFITool(QWidget *parent) : UEFITool::UEFITool(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::UEFITool), ui(new Ui::UEFITool),
version(tr("0.22.4")) version(tr("0.23.0"))
{ {
clipboard = QApplication::clipboard(); clipboard = QApplication::clipboard();
@ -43,6 +43,7 @@ version(tr("0.22.4"))
connect(ui->actionReplaceBody, SIGNAL(triggered()), this, SLOT(replaceBody())); connect(ui->actionReplaceBody, SIGNAL(triggered()), this, SLOT(replaceBody()));
connect(ui->actionRemove, SIGNAL(triggered()), this, SLOT(remove())); connect(ui->actionRemove, SIGNAL(triggered()), this, SLOT(remove()));
connect(ui->actionRebuild, SIGNAL(triggered()), this, SLOT(rebuild())); connect(ui->actionRebuild, SIGNAL(triggered()), this, SLOT(rebuild()));
connect(ui->actionDoNotRebuild, SIGNAL(triggered()), this, SLOT(doNotRebuild()));
connect(ui->actionMessagesCopy, SIGNAL(triggered()), this, SLOT(copyMessage())); connect(ui->actionMessagesCopy, SIGNAL(triggered()), this, SLOT(copyMessage()));
connect(ui->actionMessagesCopyAll, SIGNAL(triggered()), this, SLOT(copyAllMessages())); connect(ui->actionMessagesCopyAll, SIGNAL(triggered()), this, SLOT(copyAllMessages()));
connect(ui->actionMessagesClear, SIGNAL(triggered()), this, SLOT(clearMessages())); connect(ui->actionMessagesClear, SIGNAL(triggered()), this, SLOT(clearMessages()));
@ -146,6 +147,7 @@ void UEFITool::populateUi(const QModelIndex &current)
// Enable actions // Enable actions
ui->actionExtract->setDisabled(model->hasEmptyHeader(current) && model->hasEmptyBody(current)); ui->actionExtract->setDisabled(model->hasEmptyHeader(current) && model->hasEmptyBody(current));
ui->actionRebuild->setEnabled(type == Types::Volume || type == Types::File || type == Types::Section); ui->actionRebuild->setEnabled(type == Types::Volume || type == Types::File || type == Types::Section);
ui->actionDoNotRebuild->setEnabled(type== Types::Region || type == Types::Volume || type == Types::File || type == Types::Section);
ui->actionExtractBody->setDisabled(model->hasEmptyBody(current)); ui->actionExtractBody->setDisabled(model->hasEmptyBody(current));
ui->actionRemove->setEnabled(type == Types::Volume || type == Types::File || type == Types::Section); ui->actionRemove->setEnabled(type == Types::Volume || type == Types::File || type == Types::Section);
ui->actionInsertInto->setEnabled((type == Types::Volume && subtype != Subtypes::UnknownVolume) || ui->actionInsertInto->setEnabled((type == Types::Volume && subtype != Subtypes::UnknownVolume) ||
@ -220,6 +222,18 @@ void UEFITool::rebuild()
ui->actionSaveImageFile->setEnabled(true); ui->actionSaveImageFile->setEnabled(true);
} }
void UEFITool::doNotRebuild()
{
QModelIndex index = ui->structureTreeView->selectionModel()->currentIndex();
if (!index.isValid())
return;
UINT8 result = ffsEngine->doNotRebuild(index);
if (result == ERR_SUCCESS)
ui->actionSaveImageFile->setEnabled(true);
}
void UEFITool::remove() void UEFITool::remove()
{ {
QModelIndex index = ui->structureTreeView->selectionModel()->currentIndex(); QModelIndex index = ui->structureTreeView->selectionModel()->currentIndex();

View File

@ -78,6 +78,7 @@ public:
void replaceBody(); void replaceBody();
void rebuild(); void rebuild();
void doNotRebuild();
void remove(); void remove();

View File

@ -180,7 +180,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>21</height> <height>31</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">
@ -225,6 +225,8 @@
</property> </property>
<addaction name="actionExtract"/> <addaction name="actionExtract"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionDoNotRebuild"/>
<addaction name="separator"/>
<addaction name="actionReplace"/> <addaction name="actionReplace"/>
</widget> </widget>
<widget class="QMenu" name="menuPaddingActions"> <widget class="QMenu" name="menuPaddingActions">
@ -243,6 +245,7 @@
<addaction name="actionExtractBody"/> <addaction name="actionExtractBody"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionRebuild"/> <addaction name="actionRebuild"/>
<addaction name="actionDoNotRebuild"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionInsertInto"/> <addaction name="actionInsertInto"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -257,6 +260,7 @@
<addaction name="actionExtractBody"/> <addaction name="actionExtractBody"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionRebuild"/> <addaction name="actionRebuild"/>
<addaction name="actionDoNotRebuild"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionInsertInto"/> <addaction name="actionInsertInto"/>
<addaction name="actionInsertBefore"/> <addaction name="actionInsertBefore"/>
@ -275,6 +279,7 @@
<addaction name="actionExtractBody"/> <addaction name="actionExtractBody"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionRebuild"/> <addaction name="actionRebuild"/>
<addaction name="actionDoNotRebuild"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionInsertInto"/> <addaction name="actionInsertInto"/>
<addaction name="actionInsertBefore"/> <addaction name="actionInsertBefore"/>
@ -284,7 +289,6 @@
<addaction name="actionReplaceBody"/> <addaction name="actionReplaceBody"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionRemove"/> <addaction name="actionRemove"/>
<addaction name="separator"/>
</widget> </widget>
<widget class="QMenu" name="menuMessages"> <widget class="QMenu" name="menuMessages">
<property name="title"> <property name="title">
@ -536,6 +540,17 @@
<string>Ctrl+Shift+O</string> <string>Ctrl+Shift+O</string>
</property> </property>
</action> </action>
<action name="actionDoNotRebuild">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Do not rebuild</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+Space</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources/> <resources/>