QuarkPlatformPkg/ForceRecovery: Add UEFI application to force recovery
authorMichael Kinney <michael.d.kinney@intel.com>
Mon, 3 Oct 2016 18:09:58 +0000 (11:09 -0700)
committerMichael Kinney <michael.d.kinney@intel.com>
Fri, 7 Oct 2016 22:00:15 +0000 (15:00 -0700)

This UEFI Application sets a sticky bit that persists across reset
to force a boot mode of BOOT_IN_RECOVERY_MODE.  It then performs
a warm reset using the UEFI Runtime Service ResetSystem().

Cc: Kelly Steele <kelly.steele@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Kelly Steele <kelly.steele@intel.com>
QuarkPlatformPkg/Application/ForceRecovery/ForceRecovery.c [new file with mode: 0644]
QuarkPlatformPkg/Application/ForceRecovery/ForceRecovery.inf [new file with mode: 0644]

diff --git a/QuarkPlatformPkg/Application/ForceRecovery/ForceRecovery.c b/QuarkPlatformPkg/Application/ForceRecovery/ForceRecovery.c
new file mode 100644 (file)
index 0000000..82912b9
--- /dev/null
@@ -0,0 +1,53 @@
+/** @file\r
+  Application that sets a sticky bit to force recovery on next reset.\r
+  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+#include <Uefi.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/QNCAccessLib.h>\r
+  The user Entry Point for Application. The user code starts with this function\r
+  as the real entry point for the application.\r
+  @param[in] ImageHandle    The firmware allocated handle for the EFI image.\r
+  @param[in] SystemTable    A pointer to the EFI System Table.\r
+  @retval EFI_SUCCESS       The entry point is executed successfully.\r
+  @retval other             Some error occurs when executing this entry point.\r
+UefiMain (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  )\r
+  //\r
+  // Set 'B_CFG_STICKY_RW_FORCE_RECOVERY' sticky bit so we know we need to do a recovery following warm reset\r
+  //\r
+  QNCAltPortWrite (\r
+    );\r
+  //\r
+  // Do a warm reset\r
+  //\r
+  gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);\r
+  return EFI_SUCCESS;\r
diff --git a/QuarkPlatformPkg/Application/ForceRecovery/ForceRecovery.inf b/QuarkPlatformPkg/Application/ForceRecovery/ForceRecovery.inf
new file mode 100644 (file)
index 0000000..e0d174e
--- /dev/null
@@ -0,0 +1,39 @@
+## @file\r
+#  Application that sets a sticky bit to force recovery on next reset.\r
+#  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+#  This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution. The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = ForceRecovery\r
+  FILE_GUID                      = 3A61FD45-69A0-42AD-B261-24DA451BF442\r
+  MODULE_TYPE                    = UEFI_APPLICATION\r
+  VERSION_STRING                 = 1.0\r
+  ENTRY_POINT                    = UefiMain\r
+# The following information is for reference only and not required by the build tools.\r
+#  VALID_ARCHITECTURES           = IA32\r
+  ForceRecovery.c\r
+  MdePkg/MdePkg.dec\r
+  QuarkSocPkg/QuarkSocPkg.dec\r
+  UefiApplicationEntryPoint\r
+  UefiRuntimeServicesTableLib\r
+  QNCAccessLib\r