mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 00:24:07 +02:00
MdeModulePkg/CapsuleLib: Support result rolling over.
According to UEFI spec, capsule result variable may roll over to 0. Cc: Feng Tian <feng.tian@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Chao Zhang <chao.b.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
parent
8f6db16134
commit
777034ce83
@ -167,7 +167,7 @@ WriteNewCapsuleResultVariableCache (
|
|||||||
Get a new capsule status variable index.
|
Get a new capsule status variable index.
|
||||||
|
|
||||||
@return A new capsule status variable index.
|
@return A new capsule status variable index.
|
||||||
@retval -1 No new capsule status variable index.
|
@retval 0 No new capsule status variable index. Rolling over.
|
||||||
**/
|
**/
|
||||||
INTN
|
INTN
|
||||||
GetNewCapsuleResultIndex (
|
GetNewCapsuleResultIndex (
|
||||||
@ -178,7 +178,8 @@ GetNewCapsuleResultIndex (
|
|||||||
|
|
||||||
CurrentIndex = GetCurrentCapsuleLastIndex();
|
CurrentIndex = GetCurrentCapsuleLastIndex();
|
||||||
if (CurrentIndex >= PcdGet16(PcdCapsuleMax)) {
|
if (CurrentIndex >= PcdGet16(PcdCapsuleMax)) {
|
||||||
return -1;
|
DEBUG((DEBUG_INFO, " CapsuleResult variable Rolling Over!\n"));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CurrentIndex + 1;
|
return CurrentIndex + 1;
|
||||||
@ -206,9 +207,7 @@ WriteNewCapsuleResultVariable (
|
|||||||
|
|
||||||
CapsuleResultIndex = GetNewCapsuleResultIndex();
|
CapsuleResultIndex = GetNewCapsuleResultIndex();
|
||||||
DEBUG((DEBUG_INFO, "New CapsuleResultIndex - 0x%x\n", CapsuleResultIndex));
|
DEBUG((DEBUG_INFO, "New CapsuleResultIndex - 0x%x\n", CapsuleResultIndex));
|
||||||
if (CapsuleResultIndex == -1) {
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
UnicodeSPrint(
|
UnicodeSPrint(
|
||||||
CapsuleResultStr,
|
CapsuleResultStr,
|
||||||
sizeof(CapsuleResultStr),
|
sizeof(CapsuleResultStr),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user