From 621854b12c10cc16e39a8a22b9971dceae59fe93 Mon Sep 17 00:00:00 2001
From: Brendan Jackman <Brendan.Jackman@arm.com>
Date: Tue, 18 Feb 2014 14:50:00 +0000
Subject: ShellCommands/SetVar: Make '-rt' imply '-bs'

It's invalid to set a variable that's available from runtime services but not
from boot services.

Currently if you pass '-rt' without '-bs' you get a generic
'Invalid Parameter' message. We should either print a more useful message in
this case, or make '-rt' imply '-bs' (as this patch does). The Shell Spec is
ambiguous on the matter.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brendan Jackman <Brendan.Jackman@arm.com>
Reviewed-By: Olivier Martin <olivier.martin@arm.com>
---
 ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c
index 7c3aa54..9e57998 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c
@@ -139,7 +139,8 @@ ShellCommandRunSetVar (
           Attributes |= EFI_VARIABLE_BOOTSERVICE_ACCESS;
         }
         if (ShellCommandLineGetFlag(Package, L"-rt")) {
-          Attributes |= EFI_VARIABLE_RUNTIME_ACCESS;
+          Attributes |= EFI_VARIABLE_RUNTIME_ACCESS |
+                        EFI_VARIABLE_BOOTSERVICE_ACCESS;
         }
         if (ShellCommandLineGetFlag(Package, L"-nv")) {
           Attributes |= EFI_VARIABLE_NON_VOLATILE;
-- 
1.8.5

