From 777034ce83a8ee4a13cda7c45524933459237595 Mon Sep 17 00:00:00 2001 From: Jiewen Yao Date: Sat, 24 Dec 2016 00:00:51 +0800 Subject: MdeModulePkg/CapsuleLib: Support result rolling over. According to UEFI spec, capsule result variable may roll over to 0. Cc: Feng Tian Cc: Star Zeng Cc: Chao Zhang Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao Reviewed-by: Star Zeng --- MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'MdeModulePkg/Library') diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c index 61ede5cfa9..ce79a5a619 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c @@ -167,7 +167,7 @@ WriteNewCapsuleResultVariableCache ( Get 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 GetNewCapsuleResultIndex ( @@ -178,7 +178,8 @@ GetNewCapsuleResultIndex ( CurrentIndex = GetCurrentCapsuleLastIndex(); if (CurrentIndex >= PcdGet16(PcdCapsuleMax)) { - return -1; + DEBUG((DEBUG_INFO, " CapsuleResult variable Rolling Over!\n")); + return 0; } return CurrentIndex + 1; @@ -206,9 +207,7 @@ WriteNewCapsuleResultVariable ( CapsuleResultIndex = GetNewCapsuleResultIndex(); DEBUG((DEBUG_INFO, "New CapsuleResultIndex - 0x%x\n", CapsuleResultIndex)); - if (CapsuleResultIndex == -1) { - return EFI_OUT_OF_RESOURCES; - } + UnicodeSPrint( CapsuleResultStr, sizeof(CapsuleResultStr), -- cgit v1.2.3