public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jiewen Yao <jiewen.yao@intel.com>
To: edk2-devel@lists.01.org
Cc: Feng Tian <feng.tian@intel.com>, Star Zeng <star.zeng@intel.com>,
	Chao Zhang <chao.b.zhang@intel.com>
Subject: [PATCH] MdeModulePkg/CapsuleLib: Support result rolling over.
Date: Sat, 24 Dec 2016 00:04:35 +0800	[thread overview]
Message-ID: <1482509075-13456-1-git-send-email-jiewen.yao@intel.com> (raw)

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>
---
 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



             reply	other threads:[~2016-12-23 16:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-23 16:04 Jiewen Yao [this message]
2016-12-26  2:52 ` [PATCH] MdeModulePkg/CapsuleLib: Support result rolling over Zeng, Star
2016-12-26  2:56 ` Zeng, Star

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1482509075-13456-1-git-send-email-jiewen.yao@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox