From nobody Sat Nov 2 12:21:43 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1490001639851348.927230744088; Mon, 20 Mar 2017 02:20:39 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A118D802A7; Mon, 20 Mar 2017 02:20:37 -0700 (PDT) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 599EA80292 for ; Mon, 20 Mar 2017 02:20:36 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2017 02:20:36 -0700 Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.9.22]) by fmsmga006.fm.intel.com with ESMTP; 20 Mar 2017 02:20:34 -0700 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490001636; x=1521537636; h=from:to:cc:subject:date:message-id; bh=+6lF/61EQTJ/GyetfmGgYtCkajPF4ze/XKGFcjxKriY=; b=RL8eWoOPJRLDLEZUEBxlrZG5j8z8JsGsxpYkG9m3uXq88hBiYDxwHsOs 7jelDHGL7dBc6WCiKuZLzqKcRaOxEw==; X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,193,1486454400"; d="scan'208";a="78908641" From: Star Zeng To: edk2-devel@lists.01.org Date: Mon, 20 Mar 2017 17:20:32 +0800 Message-Id: <1490001632-35572-1-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [edk2] [PATCH] MdeModulePkg CapsuleApp: Add -NR (no-reset) option support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiewen Yao , Xiaofeng Wang , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D388 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 Cc: Xiaofeng Wang Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng Note: the related discussion was at https://lists.01.org/pipermail/edk2-devel/2017-February/007513.html. Reviewed-by: Jiewen.yao@intel.com --- MdeModulePkg/Application/CapsuleApp/CapsuleApp.c | 28 +++++++++++++++++++-= ---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c b/MdeModulePk= g/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 \n"); + Print(L" CapsuleApp [-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 \n"); Print(L" CapsuleApp -P GET -O \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_I= NITIATE_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 =3D 1; - CapsuleLastIndex =3D Argc - 1; + NoReset =3D FALSE; + if ((Argc > 1) && (StrCmp(Argv[Argc - 1], L"-NR") =3D=3D 0)) { + NoReset =3D TRUE; + CapsuleLastIndex =3D Argc - 2; + } else { + CapsuleLastIndex =3D Argc - 1; + } CapsuleNum =3D CapsuleLastIndex - CapsuleFirstIndex + 1; =20 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() c= alling above. + // + // For capsule with flag CAPSULE_FLAGS_PERSIST_ACROSS_RESET but no CAP= SULE_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 spe= cified, 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 --=20 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel