public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zeng, Star" <star.zeng@intel.com>
To: "Yao, Jiewen" <jiewen.yao@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Tian, Feng" <feng.tian@intel.com>,
	"Zhang, Chao B" <chao.b.zhang@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH] MdeModulePkg/CapsuleLib: Support result rolling over.
Date: Mon, 26 Dec 2016 02:56:33 +0000	[thread overview]
Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B7F0F5A@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1482509075-13456-1-git-send-email-jiewen.yao@intel.com>

Reviewed-by: Star Zeng <star.zeng@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiewen Yao
Sent: Saturday, December 24, 2016 12:05 AM
To: edk2-devel@lists.01.org
Cc: Tian, Feng <feng.tian@intel.com>; Zhang, Chao B <chao.b.zhang@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [edk2] [PATCH] 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>
---
 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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


      parent reply	other threads:[~2016-12-26  2:56 UTC|newest]

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

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=0C09AFA07DD0434D9E2A0C6AEB0483103B7F0F5A@shsmsx102.ccr.corp.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