public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg CapsuleApp: Add -NR (no-reset) option support
@ 2017-03-20  9:20 Star Zeng
  2017-03-21  2:41 ` Yao, Jiewen
  0 siblings, 1 reply; 4+ messages in thread
From: Star Zeng @ 2017-03-20  9:20 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Jiewen Yao, Xiaofeng Wang

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=388

Add -NR (no-reset) option support, once the option is specified,
no reset will be trigger for the capsule with flag
CAPSULE_FLAGS_PERSIST_ACROSS_RESET and no CAPSULE_FLAGS_INITIATE_RESET.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Xiaofeng Wang <winggundum82@163.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>

Note: the related discussion was at
https://lists.01.org/pipermail/edk2-devel/2017-February/007513.html.
---
 MdeModulePkg/Application/CapsuleApp/CapsuleApp.c | 28 +++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
index 84ed4d738bc4..62bc12a88afe 100644
--- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
+++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
@@ -670,7 +670,7 @@ PrintUsage (
   )
 {
   Print(L"CapsuleApp:  usage\n");
-  Print(L"  CapsuleApp <Capsule...>\n");
+  Print(L"  CapsuleApp <Capsule...> [-NR]\n");
   Print(L"  CapsuleApp -S\n");
   Print(L"  CapsuleApp -C\n");
   Print(L"  CapsuleApp -P\n");
@@ -680,6 +680,8 @@ PrintUsage (
   Print(L"  CapsuleApp -D <Capsule>\n");
   Print(L"  CapsuleApp -P GET <ImageTypeId> <Index> -O <FileName>\n");
   Print(L"Parameter:\n");
+  Print(L"  -NR: No reset will be trigger for the capsule with flag\n");
+  Print(L"       CAPSULE_FLAGS_PERSIST_ACROSS_RESET but no CAPSULE_FLAGS_INITIATE_RESET.\n");
   Print(L"  -S:  Dump capsule report variable (EFI_CAPSULE_REPORT_GUID),\n");
   Print(L"       which is defined in UEFI specification.\n");
   Print(L"  -C:  Clear capsule report variable (EFI_CAPSULE_RPORT_GUID),\n");
@@ -721,6 +723,7 @@ UefiMain (
   UINT64                         MaxCapsuleSize;
   EFI_RESET_TYPE                 ResetType;
   BOOLEAN                        NeedReset;
+  BOOLEAN                        NoReset;
   CHAR16                         *CapsuleName;
   UINTN                          CapsuleNum;
   UINTN                          Index;
@@ -783,7 +786,13 @@ UefiMain (
     return EFI_SUCCESS;
   }
   CapsuleFirstIndex = 1;
-  CapsuleLastIndex = Argc - 1;
+  NoReset = FALSE;
+  if ((Argc > 1) && (StrCmp(Argv[Argc - 1], L"-NR") == 0)) {
+    NoReset = TRUE;
+    CapsuleLastIndex = Argc - 2;
+  } else {
+    CapsuleLastIndex = Argc - 1;
+  }
   CapsuleNum = CapsuleLastIndex - CapsuleFirstIndex + 1;
 
   if (CapsuleFirstIndex > CapsuleLastIndex) {
@@ -855,10 +864,19 @@ UefiMain (
       goto Done;
     }
     //
-    // For capsule who has reset flag, after calling UpdateCapsule service,triger a
-    // system reset to process capsule persist across a system reset.
+    // For capsule with flags CAPSULE_FLAGS_PERSIST_ACROSS_RESET + CAPSULE_FLAGS_INITIATE_RESET,
+    // a system reset should have been triggered by gRT->UpdateCapsule() calling above.
+    //
+    // For capsule with flag CAPSULE_FLAGS_PERSIST_ACROSS_RESET but no CAPSULE_FLAGS_INITIATE_RESET,
+    // check if -NR (no-reset) has been specified or not.
     //
-    gRT->ResetSystem (ResetType, EFI_SUCCESS, 0, NULL);
+    if (!NoReset) {
+      //
+      // For capsule who has reset flag and no -NR (no-reset) has been specified, after calling UpdateCapsule service,
+      // trigger a system reset to process capsule persist across a system reset.
+      //
+      gRT->ResetSystem (ResetType, EFI_SUCCESS, 0, NULL);
+    }
   } else {
     //
     // For capsule who has no reset flag, only call UpdateCapsule Service without a
-- 
2.7.0.windows.1



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

* Re: [PATCH] MdeModulePkg CapsuleApp: Add -NR (no-reset) option support
  2017-03-20  9:20 [PATCH] MdeModulePkg CapsuleApp: Add -NR (no-reset) option support Star Zeng
@ 2017-03-21  2:41 ` Yao, Jiewen
  2017-03-21  2:57   ` Zeng, Star
  0 siblings, 1 reply; 4+ messages in thread
From: Yao, Jiewen @ 2017-03-21  2:41 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Xiaofeng Wang

I feel a little confused on "but no CAPSULE_FLAGS_INITIATE_RESET".

> +  Print(L"  -NR: No reset will be trigger for the capsule with flag\n");
> +  Print(L"       CAPSULE_FLAGS_PERSIST_ACROSS_RESET but no CAPSULE_FLAGS_INITIATE_RESET.\n");


Do you mean "No impact to CAPSULE_FLAGS_INITIATE_RESET", because this flag is consumed by Capsule driver, but not this APP?

If so, we can update the help info to make it clear?
> +  Print(L"  -NR: No reset will be trigger for the capsule with CAPSULE_FLAGS_PERSIST_ACROSS_RESET.\n");
> +  Print(L"      -NR has no impact for the capsule with CAPSULE_FLAGS_INITIATE_RESET.\n");



> -----Original Message-----
> From: Zeng, Star
> Sent: Monday, March 20, 2017 5:21 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> Xiaofeng Wang <winggundum82@163.com>
> Subject: [PATCH] MdeModulePkg CapsuleApp: Add -NR (no-reset) option
> support
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=388
> 
> Add -NR (no-reset) option support, once the option is specified,
> no reset will be trigger for the capsule with flag
> CAPSULE_FLAGS_PERSIST_ACROSS_RESET and no
> CAPSULE_FLAGS_INITIATE_RESET.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Xiaofeng Wang <winggundum82@163.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> 
> Note: the related discussion was at
> https://lists.01.org/pipermail/edk2-devel/2017-February/007513.html.
> ---
>  MdeModulePkg/Application/CapsuleApp/CapsuleApp.c | 28
> +++++++++++++++++++-----
>  1 file changed, 23 insertions(+), 5 deletions(-)
> 
> diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> index 84ed4d738bc4..62bc12a88afe 100644
> --- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> @@ -670,7 +670,7 @@ PrintUsage (
>    )
>  {
>    Print(L"CapsuleApp:  usage\n");
> -  Print(L"  CapsuleApp <Capsule...>\n");
> +  Print(L"  CapsuleApp <Capsule...> [-NR]\n");
>    Print(L"  CapsuleApp -S\n");
>    Print(L"  CapsuleApp -C\n");
>    Print(L"  CapsuleApp -P\n");
> @@ -680,6 +680,8 @@ PrintUsage (
>    Print(L"  CapsuleApp -D <Capsule>\n");
>    Print(L"  CapsuleApp -P GET <ImageTypeId> <Index> -O <FileName>\n");
>    Print(L"Parameter:\n");
> +  Print(L"  -NR: No reset will be trigger for the capsule with flag\n");
> +  Print(L"       CAPSULE_FLAGS_PERSIST_ACROSS_RESET but no
> CAPSULE_FLAGS_INITIATE_RESET.\n");
>    Print(L"  -S:  Dump capsule report variable
> (EFI_CAPSULE_REPORT_GUID),\n");
>    Print(L"       which is defined in UEFI specification.\n");
>    Print(L"  -C:  Clear capsule report variable
> (EFI_CAPSULE_RPORT_GUID),\n");
> @@ -721,6 +723,7 @@ UefiMain (
>    UINT64                         MaxCapsuleSize;
>    EFI_RESET_TYPE                 ResetType;
>    BOOLEAN                        NeedReset;
> +  BOOLEAN                        NoReset;
>    CHAR16                         *CapsuleName;
>    UINTN                          CapsuleNum;
>    UINTN                          Index;
> @@ -783,7 +786,13 @@ UefiMain (
>      return EFI_SUCCESS;
>    }
>    CapsuleFirstIndex = 1;
> -  CapsuleLastIndex = Argc - 1;
> +  NoReset = FALSE;
> +  if ((Argc > 1) && (StrCmp(Argv[Argc - 1], L"-NR") == 0)) {
> +    NoReset = TRUE;
> +    CapsuleLastIndex = Argc - 2;
> +  } else {
> +    CapsuleLastIndex = Argc - 1;
> +  }
>    CapsuleNum = CapsuleLastIndex - CapsuleFirstIndex + 1;
> 
>    if (CapsuleFirstIndex > CapsuleLastIndex) {
> @@ -855,10 +864,19 @@ UefiMain (
>        goto Done;
>      }
>      //
> -    // For capsule who has reset flag, after calling UpdateCapsule service,triger
> a
> -    // system reset to process capsule persist across a system reset.
> +    // For capsule with flags CAPSULE_FLAGS_PERSIST_ACROSS_RESET +
> CAPSULE_FLAGS_INITIATE_RESET,
> +    // a system reset should have been triggered by gRT->UpdateCapsule()
> calling above.
> +    //
> +    // For capsule with flag CAPSULE_FLAGS_PERSIST_ACROSS_RESET but no
> CAPSULE_FLAGS_INITIATE_RESET,
> +    // check if -NR (no-reset) has been specified or not.
>      //
> -    gRT->ResetSystem (ResetType, EFI_SUCCESS, 0, NULL);
> +    if (!NoReset) {
> +      //
> +      // For capsule who has reset flag and no -NR (no-reset) has been
> specified, after calling UpdateCapsule service,
> +      // trigger a system reset to process capsule persist across a system reset.
> +      //
> +      gRT->ResetSystem (ResetType, EFI_SUCCESS, 0, NULL);
> +    }
>    } else {
>      //
>      // For capsule who has no reset flag, only call UpdateCapsule Service
> without a
> --
> 2.7.0.windows.1



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

* Re: [PATCH] MdeModulePkg CapsuleApp: Add -NR (no-reset) option support
  2017-03-21  2:41 ` Yao, Jiewen
@ 2017-03-21  2:57   ` Zeng, Star
  2017-03-21  3:05     ` Yao, Jiewen
  0 siblings, 1 reply; 4+ messages in thread
From: Zeng, Star @ 2017-03-21  2:57 UTC (permalink / raw)
  To: Yao, Jiewen, edk2-devel@lists.01.org; +Cc: Xiaofeng Wang, Zeng, Star

Yes, right.

How about to like below?

  Print(L"  -NR: No reset will be triggered for the capsule\n");
  Print(L"       with CAPSULE_FLAGS_PERSIST_ACROSS_RESET and without CAPSULE_FLAGS_INITIATE_RESET.\n");

Thanks,
Star
-----Original Message-----
From: Yao, Jiewen 
Sent: Tuesday, March 21, 2017 10:41 AM
To: Zeng, Star <star.zeng@intel.com>; edk2-devel@lists.01.org
Cc: Xiaofeng Wang <winggundum82@163.com>
Subject: RE: [PATCH] MdeModulePkg CapsuleApp: Add -NR (no-reset) option support

I feel a little confused on "but no CAPSULE_FLAGS_INITIATE_RESET".

> +  Print(L"  -NR: No reset will be trigger for the capsule with flag\n");
> +  Print(L"       CAPSULE_FLAGS_PERSIST_ACROSS_RESET but no CAPSULE_FLAGS_INITIATE_RESET.\n");


Do you mean "No impact to CAPSULE_FLAGS_INITIATE_RESET", because this flag is consumed by Capsule driver, but not this APP?

If so, we can update the help info to make it clear?
> +  Print(L"  -NR: No reset will be trigger for the capsule with CAPSULE_FLAGS_PERSIST_ACROSS_RESET.\n");
> +  Print(L"      -NR has no impact for the capsule with CAPSULE_FLAGS_INITIATE_RESET.\n");



> -----Original Message-----
> From: Zeng, Star
> Sent: Monday, March 20, 2017 5:21 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Yao, Jiewen 
> <jiewen.yao@intel.com>; Xiaofeng Wang <winggundum82@163.com>
> Subject: [PATCH] MdeModulePkg CapsuleApp: Add -NR (no-reset) option 
> support
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=388
> 
> Add -NR (no-reset) option support, once the option is specified, no 
> reset will be trigger for the capsule with flag 
> CAPSULE_FLAGS_PERSIST_ACROSS_RESET and no 
> CAPSULE_FLAGS_INITIATE_RESET.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Xiaofeng Wang <winggundum82@163.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> 
> Note: the related discussion was at
> https://lists.01.org/pipermail/edk2-devel/2017-February/007513.html.
> ---
>  MdeModulePkg/Application/CapsuleApp/CapsuleApp.c | 28
> +++++++++++++++++++-----
>  1 file changed, 23 insertions(+), 5 deletions(-)
> 
> diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> index 84ed4d738bc4..62bc12a88afe 100644
> --- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> @@ -670,7 +670,7 @@ PrintUsage (
>    )
>  {
>    Print(L"CapsuleApp:  usage\n");
> -  Print(L"  CapsuleApp <Capsule...>\n");
> +  Print(L"  CapsuleApp <Capsule...> [-NR]\n");
>    Print(L"  CapsuleApp -S\n");
>    Print(L"  CapsuleApp -C\n");
>    Print(L"  CapsuleApp -P\n");
> @@ -680,6 +680,8 @@ PrintUsage (
>    Print(L"  CapsuleApp -D <Capsule>\n");
>    Print(L"  CapsuleApp -P GET <ImageTypeId> <Index> -O <FileName>\n");
>    Print(L"Parameter:\n");
> +  Print(L"  -NR: No reset will be trigger for the capsule with flag\n");
> +  Print(L"       CAPSULE_FLAGS_PERSIST_ACROSS_RESET but no
> CAPSULE_FLAGS_INITIATE_RESET.\n");
>    Print(L"  -S:  Dump capsule report variable 
> (EFI_CAPSULE_REPORT_GUID),\n");
>    Print(L"       which is defined in UEFI specification.\n");
>    Print(L"  -C:  Clear capsule report variable 
> (EFI_CAPSULE_RPORT_GUID),\n"); @@ -721,6 +723,7 @@ UefiMain (
>    UINT64                         MaxCapsuleSize;
>    EFI_RESET_TYPE                 ResetType;
>    BOOLEAN                        NeedReset;
> +  BOOLEAN                        NoReset;
>    CHAR16                         *CapsuleName;
>    UINTN                          CapsuleNum;
>    UINTN                          Index;
> @@ -783,7 +786,13 @@ UefiMain (
>      return EFI_SUCCESS;
>    }
>    CapsuleFirstIndex = 1;
> -  CapsuleLastIndex = Argc - 1;
> +  NoReset = FALSE;
> +  if ((Argc > 1) && (StrCmp(Argv[Argc - 1], L"-NR") == 0)) {
> +    NoReset = TRUE;
> +    CapsuleLastIndex = Argc - 2;
> +  } else {
> +    CapsuleLastIndex = Argc - 1;
> +  }
>    CapsuleNum = CapsuleLastIndex - CapsuleFirstIndex + 1;
> 
>    if (CapsuleFirstIndex > CapsuleLastIndex) { @@ -855,10 +864,19 @@ 
> UefiMain (
>        goto Done;
>      }
>      //
> -    // For capsule who has reset flag, after calling UpdateCapsule service,triger
> a
> -    // system reset to process capsule persist across a system reset.
> +    // For capsule with flags CAPSULE_FLAGS_PERSIST_ACROSS_RESET +
> CAPSULE_FLAGS_INITIATE_RESET,
> +    // a system reset should have been triggered by 
> + gRT->UpdateCapsule()
> calling above.
> +    //
> +    // For capsule with flag CAPSULE_FLAGS_PERSIST_ACROSS_RESET but 
> + no
> CAPSULE_FLAGS_INITIATE_RESET,
> +    // check if -NR (no-reset) has been specified or not.
>      //
> -    gRT->ResetSystem (ResetType, EFI_SUCCESS, 0, NULL);
> +    if (!NoReset) {
> +      //
> +      // For capsule who has reset flag and no -NR (no-reset) has 
> + been
> specified, after calling UpdateCapsule service,
> +      // trigger a system reset to process capsule persist across a system reset.
> +      //
> +      gRT->ResetSystem (ResetType, EFI_SUCCESS, 0, NULL);
> +    }
>    } else {
>      //
>      // For capsule who has no reset flag, only call UpdateCapsule 
> Service without a
> --
> 2.7.0.windows.1



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

* Re: [PATCH] MdeModulePkg CapsuleApp: Add -NR (no-reset) option support
  2017-03-21  2:57   ` Zeng, Star
@ 2017-03-21  3:05     ` Yao, Jiewen
  0 siblings, 0 replies; 4+ messages in thread
From: Yao, Jiewen @ 2017-03-21  3:05 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Xiaofeng Wang

OK

Reviewed-by: Jiewen.yao@intel.com

From: Zeng, Star
Sent: Tuesday, March 21, 2017 10:57 AM
To: Yao, Jiewen <jiewen.yao@intel.com>; edk2-devel@lists.01.org
Cc: Xiaofeng Wang <winggundum82@163.com>; Zeng, Star <star.zeng@intel.com>
Subject: RE: [PATCH] MdeModulePkg CapsuleApp: Add -NR (no-reset) option support

Yes, right.

How about to like below?

  Print(L"  -NR: No reset will be triggered for the capsule\n");
  Print(L"       with CAPSULE_FLAGS_PERSIST_ACROSS_RESET and without CAPSULE_FLAGS_INITIATE_RESET.\n");

Thanks,
Star
-----Original Message-----
From: Yao, Jiewen
Sent: Tuesday, March 21, 2017 10:41 AM
To: Zeng, Star <star.zeng@intel.com<mailto:star.zeng@intel.com>>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
Cc: Xiaofeng Wang <winggundum82@163.com<mailto:winggundum82@163.com>>
Subject: RE: [PATCH] MdeModulePkg CapsuleApp: Add -NR (no-reset) option support

I feel a little confused on "but no CAPSULE_FLAGS_INITIATE_RESET".

> +  Print(L"  -NR: No reset will be trigger for the capsule with flag\n");
> +  Print(L"       CAPSULE_FLAGS_PERSIST_ACROSS_RESET but no CAPSULE_FLAGS_INITIATE_RESET.\n");


Do you mean "No impact to CAPSULE_FLAGS_INITIATE_RESET", because this flag is consumed by Capsule driver, but not this APP?

If so, we can update the help info to make it clear?
> +  Print(L"  -NR: No reset will be trigger for the capsule with CAPSULE_FLAGS_PERSIST_ACROSS_RESET.\n");
> +  Print(L"      -NR has no impact for the capsule with CAPSULE_FLAGS_INITIATE_RESET.\n");



> -----Original Message-----
> From: Zeng, Star
> Sent: Monday, March 20, 2017 5:21 PM
> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> Cc: Zeng, Star <star.zeng@intel.com<mailto:star.zeng@intel.com>>; Yao, Jiewen
> <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>; Xiaofeng Wang <winggundum82@163.com<mailto:winggundum82@163.com>>
> Subject: [PATCH] MdeModulePkg CapsuleApp: Add -NR (no-reset) option
> support
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=388
>
> Add -NR (no-reset) option support, once the option is specified, no
> reset will be trigger for the capsule with flag
> CAPSULE_FLAGS_PERSIST_ACROSS_RESET and no
> CAPSULE_FLAGS_INITIATE_RESET.
>
> Cc: Jiewen Yao <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>
> Cc: Xiaofeng Wang <winggundum82@163.com<mailto:winggundum82@163.com>>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng <star.zeng@intel.com<mailto:star.zeng@intel.com>>
>
> Note: the related discussion was at
> https://lists.01.org/pipermail/edk2-devel/2017-February/007513.html.
> ---
>  MdeModulePkg/Application/CapsuleApp/CapsuleApp.c | 28
> +++++++++++++++++++-----
>  1 file changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> index 84ed4d738bc4..62bc12a88afe 100644
> --- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
> @@ -670,7 +670,7 @@ PrintUsage (
>    )
>  {
>    Print(L"CapsuleApp:  usage\n");
> -  Print(L"  CapsuleApp <Capsule...>\n");
> +  Print(L"  CapsuleApp <Capsule...> [-NR]\n");
>    Print(L"  CapsuleApp -S\n");
>    Print(L"  CapsuleApp -C\n");
>    Print(L"  CapsuleApp -P\n");
> @@ -680,6 +680,8 @@ PrintUsage (
>    Print(L"  CapsuleApp -D <Capsule>\n");
>    Print(L"  CapsuleApp -P GET <ImageTypeId> <Index> -O <FileName>\n");
>    Print(L"Parameter:\n");
> +  Print(L"  -NR: No reset will be trigger for the capsule with flag\n");
> +  Print(L"       CAPSULE_FLAGS_PERSIST_ACROSS_RESET but no
> CAPSULE_FLAGS_INITIATE_RESET.\n");
>    Print(L"  -S:  Dump capsule report variable
> (EFI_CAPSULE_REPORT_GUID),\n");
>    Print(L"       which is defined in UEFI specification.\n");
>    Print(L"  -C:  Clear capsule report variable
> (EFI_CAPSULE_RPORT_GUID),\n"); @@ -721,6 +723,7 @@ UefiMain (
>    UINT64                         MaxCapsuleSize;
>    EFI_RESET_TYPE                 ResetType;
>    BOOLEAN                        NeedReset;
> +  BOOLEAN                        NoReset;
>    CHAR16                         *CapsuleName;
>    UINTN                          CapsuleNum;
>    UINTN                          Index;
> @@ -783,7 +786,13 @@ UefiMain (
>      return EFI_SUCCESS;
>    }
>    CapsuleFirstIndex = 1;
> -  CapsuleLastIndex = Argc - 1;
> +  NoReset = FALSE;
> +  if ((Argc > 1) && (StrCmp(Argv[Argc - 1], L"-NR") == 0)) {
> +    NoReset = TRUE;
> +    CapsuleLastIndex = Argc - 2;
> +  } else {
> +    CapsuleLastIndex = Argc - 1;
> +  }
>    CapsuleNum = CapsuleLastIndex - CapsuleFirstIndex + 1;
>
>    if (CapsuleFirstIndex > CapsuleLastIndex) { @@ -855,10 +864,19 @@
> UefiMain (
>        goto Done;
>      }
>      //
> -    // For capsule who has reset flag, after calling UpdateCapsule service,triger
> a
> -    // system reset to process capsule persist across a system reset.
> +    // For capsule with flags CAPSULE_FLAGS_PERSIST_ACROSS_RESET +
> CAPSULE_FLAGS_INITIATE_RESET,
> +    // a system reset should have been triggered by
> + gRT->UpdateCapsule()
> calling above.
> +    //
> +    // For capsule with flag CAPSULE_FLAGS_PERSIST_ACROSS_RESET but
> + no
> CAPSULE_FLAGS_INITIATE_RESET,
> +    // check if -NR (no-reset) has been specified or not.
>      //
> -    gRT->ResetSystem (ResetType, EFI_SUCCESS, 0, NULL);
> +    if (!NoReset) {
> +      //
> +      // For capsule who has reset flag and no -NR (no-reset) has
> + been
> specified, after calling UpdateCapsule service,
> +      // trigger a system reset to process capsule persist across a system reset.
> +      //
> +      gRT->ResetSystem (ResetType, EFI_SUCCESS, 0, NULL);
> +    }
>    } else {
>      //
>      // For capsule who has no reset flag, only call UpdateCapsule
> Service without a
> --
> 2.7.0.windows.1


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

end of thread, other threads:[~2017-03-21  3:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-20  9:20 [PATCH] MdeModulePkg CapsuleApp: Add -NR (no-reset) option support Star Zeng
2017-03-21  2:41 ` Yao, Jiewen
2017-03-21  2:57   ` Zeng, Star
2017-03-21  3:05     ` Yao, Jiewen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox