public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Carsey, Jaben" <jaben.carsey@intel.com>
To: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Chen, Chen A" <chen.a.chen@intel.com>,
	"Carsey, Jaben" <jaben.carsey@intel.com>
Subject: Re: [PATCH] ShellPkg/reset: Support "-fwui" flag
Date: Fri, 4 Nov 2016 15:35:08 +0000	[thread overview]
Message-ID: <CB6E33457884FA40993F35157061515C54ABD2FA@FMSMSX103.amr.corp.intel.com> (raw)
In-Reply-To: <20161104084756.388044-1-ruiyu.ni@intel.com>

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Friday, November 04, 2016 1:48 AM
> To: edk2-devel@lists.01.org
> Cc: Chen, Chen A <chen.a.chen@intel.com>; Carsey, Jaben
> <jaben.carsey@intel.com>
> Subject: [PATCH] ShellPkg/reset: Support "-fwui" flag
> Importance: High
> 
> From: Chen A Chen <chen.a.chen@intel.com>
> 
> The patch adds "-fwui" support to reset command which is newly added
> to Shell 2.2 spec.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> ---
>  .../Library/UefiShellLevel2CommandsLib/Reset.c     | 48
> +++++++++++++++++++---
>  .../UefiShellLevel2CommandsLib.h                   |  1 +
>  2 files changed, 44 insertions(+), 5 deletions(-)
> 
> 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.
> 
>    (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
> -  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
>    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"
> 
>  STATIC CONST SHELL_PARAM_ITEM ResetParamList[] = {
> -  {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  }
>    };
> 
>  /**
> @@ -40,6 +41,9 @@ ShellCommandRunReset (
>    CONST CHAR16  *String;
>    CHAR16        *ProblemParam;
>    SHELL_STATUS  ShellStatus;
> +  UINT64        OsIndications;
> +  UINT32        Attr;
> +  UINTN         DataSize;
> 
>    ShellStatus = SHELL_SUCCESS;
>    ProblemParam = NULL;
> @@ -72,6 +76,39 @@ ShellCommandRunReset (
>        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY),
> gShellLevel2HiiHandle, L"reset");
>        ShellStatus = SHELL_INVALID_PARAMETER;
>      } else {
> +
> +      if (ShellCommandLineGetFlag (Package, L"-fwui")) {
> +
> +        DataSize  = sizeof (OsIndications);
> +        Status = 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) != 0) {
> +            DataSize = sizeof (OsIndications);
> +            Status = gRT->GetVariable (
> +                            EFI_OS_INDICATIONS_VARIABLE_NAME,
> &gEfiGlobalVariableGuid,
> +                            &Attr, &DataSize, &OsIndications
> +                            );
> +            if (!EFI_ERROR (Status)) {
> +              OsIndications |= EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
> +            } else {
> +              OsIndications = EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
> +            }
> +            Status = 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 = 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...
>    //
> 
> +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 @@
> 
>  #include <Uefi.h>
> 
> +#include <Guid/GlobalVariable.h>
>  #include <Guid/ShellLibHiiGuid.h>
> 
>  #include <Protocol/Shell.h>
> --
> 2.9.0.windows.1



      reply	other threads:[~2016-11-04 15:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-04  8:47 [PATCH] ShellPkg/reset: Support "-fwui" flag Ruiyu Ni
2016-11-04 15:35 ` Carsey, Jaben [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=CB6E33457884FA40993F35157061515C54ABD2FA@FMSMSX103.amr.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