public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/CapsuleLib: Support result rolling over.
@ 2016-12-23 16:04 Jiewen Yao
  2016-12-26  2:52 ` Zeng, Star
  2016-12-26  2:56 ` Zeng, Star
  0 siblings, 2 replies; 3+ messages in thread
From: Jiewen Yao @ 2016-12-23 16:04 UTC (permalink / raw)
  To: edk2-devel; +Cc: Feng Tian, Star Zeng, Chao Zhang

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] MdeModulePkg/CapsuleLib: Support result rolling over.
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Zeng, Star @ 2016-12-26  2:52 UTC (permalink / raw)
  To: Yao, Jiewen, edk2-devel@lists.01.org
  Cc: Tian, Feng, Zhang, Chao B, Zeng, Star

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] MdeModulePkg/CapsuleLib: Support result rolling over.
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Zeng, Star @ 2016-12-26  2:56 UTC (permalink / raw)
  To: Yao, Jiewen, edk2-devel@lists.01.org
  Cc: Tian, Feng, Zhang, Chao B, Zeng, Star

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-26  2:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox