From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D8802820B5 for ; Fri, 23 Dec 2016 08:04:42 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP; 23 Dec 2016 08:04:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,393,1477983600"; d="scan'208";a="45857290" Received: from jyao1-mobl.ccr.corp.intel.com ([10.254.209.84]) by orsmga005.jf.intel.com with ESMTP; 23 Dec 2016 08:04:41 -0800 From: Jiewen Yao To: edk2-devel@lists.01.org Cc: Feng Tian , Star Zeng , Chao Zhang Date: Sat, 24 Dec 2016 00:04:35 +0800 Message-Id: <1482509075-13456-1-git-send-email-jiewen.yao@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 Subject: [PATCH] MdeModulePkg/CapsuleLib: Support result rolling over. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 16:04:42 -0000 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 --- MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c index bba30b5..a591beb 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), -- 2.7.4.windows.1