From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 9FF0681C71 for ; Fri, 4 Nov 2016 08:35:08 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP; 04 Nov 2016 08:35:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,443,1473145200"; d="scan'208";a="897759515" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga003.jf.intel.com with ESMTP; 04 Nov 2016 08:35:11 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.170]) by FMSMSX106.amr.corp.intel.com ([169.254.5.171]) with mapi id 14.03.0248.002; Fri, 4 Nov 2016 08:35:09 -0700 From: "Carsey, Jaben" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Chen, Chen A" , "Carsey, Jaben" Thread-Topic: [PATCH] ShellPkg/reset: Support "-fwui" flag Thread-Index: AQHSNnhFEbtYs9+WPEWp4wspeS05i6DI9RTw Date: Fri, 4 Nov 2016 15:35:08 +0000 Message-ID: References: <20161104084756.388044-1-ruiyu.ni@intel.com> In-Reply-To: <20161104084756.388044-1-ruiyu.ni@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTVkNDY2NDItM2JhNS00ZWI5LWExYzUtYTJiOWViM2Q3YjIyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkF4dnFITkd5bTVyM0luZVVMSElwWXdQMlQ3d3hNN2wyNWE0d3N1Tmt4dWM9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.108] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg/reset: Support "-fwui" flag X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 15:35:08 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey > -----Original Message----- > From: Ni, Ruiyu > Sent: Friday, November 04, 2016 1:48 AM > To: edk2-devel@lists.01.org > Cc: Chen, Chen A ; Carsey, Jaben > > Subject: [PATCH] ShellPkg/reset: Support "-fwui" flag > Importance: High >=20 > From: Chen A Chen >=20 > The patch adds "-fwui" support to reset command which is newly added > to Shell 2.2 spec. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Chen A Chen > Reviewed-by: Ruiyu Ni > Cc: Jaben Carsey > --- > .../Library/UefiShellLevel2CommandsLib/Reset.c | 48 > +++++++++++++++++++--- > .../UefiShellLevel2CommandsLib.h | 1 + > 2 files changed, 44 insertions(+), 5 deletions(-) >=20 > diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c > b/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c > index 7d4cfb4..40ad8d9 100644 > --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c > +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c > @@ -2,7 +2,7 @@ > Main file for attrib shell level 2 function. >=20 > (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
> - Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
> + Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD > License > which accompanies this distribution. The full text of the license may= be > found at > @@ -16,10 +16,11 @@ > #include "UefiShellLevel2CommandsLib.h" >=20 > STATIC CONST SHELL_PARAM_ITEM ResetParamList[] =3D { > - {L"-w", TypeValue}, > - {L"-s", TypeValue}, > - {L"-c", TypeValue}, > - {NULL, TypeMax} > + {L"-w", TypeValue}, > + {L"-s", TypeValue}, > + {L"-c", TypeValue}, > + {L"-fwui", TypeFlag }, > + {NULL, TypeMax } > }; >=20 > /** > @@ -40,6 +41,9 @@ ShellCommandRunReset ( > CONST CHAR16 *String; > CHAR16 *ProblemParam; > SHELL_STATUS ShellStatus; > + UINT64 OsIndications; > + UINT32 Attr; > + UINTN DataSize; >=20 > ShellStatus =3D SHELL_SUCCESS; > ProblemParam =3D NULL; > @@ -72,6 +76,39 @@ ShellCommandRunReset ( > ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), > gShellLevel2HiiHandle, L"reset"); > ShellStatus =3D SHELL_INVALID_PARAMETER; > } else { > + > + if (ShellCommandLineGetFlag (Package, L"-fwui")) { > + > + DataSize =3D sizeof (OsIndications); > + Status =3D gRT->GetVariable ( > + EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME, > &gEfiGlobalVariableGuid, > + &Attr, &DataSize, &OsIndications > + ); > + if (!EFI_ERROR (Status)) { > + if ((OsIndications & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) !=3D 0)= { > + DataSize =3D sizeof (OsIndications); > + Status =3D gRT->GetVariable ( > + EFI_OS_INDICATIONS_VARIABLE_NAME, > &gEfiGlobalVariableGuid, > + &Attr, &DataSize, &OsIndications > + ); > + if (!EFI_ERROR (Status)) { > + OsIndications |=3D EFI_OS_INDICATIONS_BOOT_TO_FW_UI; > + } else { > + OsIndications =3D EFI_OS_INDICATIONS_BOOT_TO_FW_UI; > + } > + Status =3D gRT->SetVariable ( > + EFI_OS_INDICATIONS_VARIABLE_NAME, > &gEfiGlobalVariableGuid, > + EFI_VARIABLE_NON_VOLATILE | > EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, > + sizeof (OsIndications), &OsIndications > + ); > + } > + } > + if (EFI_ERROR (Status)) { > + ShellStatus =3D SHELL_UNSUPPORTED; > + goto Error; > + } > + } > + > // > // check for warm reset flag, then shutdown reset flag, then cold > (default) reset flag > // > @@ -119,6 +156,7 @@ ShellCommandRunReset ( > // as the ResetSystem function should not return... > // >=20 > +Error: > // > // free the command line package > // > diff --git > a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Commands > Lib.h > b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Commands > Lib.h > index c262bb5..857487f 100644 > --- > a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Commands > Lib.h > +++ > b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Commands > Lib.h > @@ -25,6 +25,7 @@ >=20 > #include >=20 > +#include > #include >=20 > #include > -- > 2.9.0.windows.1