]> git.proxmox.com Git - mirror_edk2.git/blame - QuarkPlatformPkg/Application/ForceRecovery/ForceRecovery.c
QuarkPlatformPkg/ForceRecovery: Add UEFI application to force recovery
[mirror_edk2.git] / QuarkPlatformPkg / Application / ForceRecovery / ForceRecovery.c
CommitLineData
9c3dea8d
MK
1/** @file\r
2 Application that sets a sticky bit to force recovery on next reset.\r
3\r
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include <Uefi.h>\r
16\r
17#include <Library/UefiRuntimeServicesTableLib.h>\r
18#include <Library/QNCAccessLib.h>\r
19\r
20/**\r
21 The user Entry Point for Application. The user code starts with this function\r
22 as the real entry point for the application.\r
23\r
24 @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
25 @param[in] SystemTable A pointer to the EFI System Table.\r
26\r
27 @retval EFI_SUCCESS The entry point is executed successfully.\r
28 @retval other Some error occurs when executing this entry point.\r
29\r
30**/\r
31EFI_STATUS\r
32EFIAPI\r
33UefiMain (\r
34 IN EFI_HANDLE ImageHandle,\r
35 IN EFI_SYSTEM_TABLE *SystemTable\r
36 )\r
37{\r
38 //\r
39 // Set 'B_CFG_STICKY_RW_FORCE_RECOVERY' sticky bit so we know we need to do a recovery following warm reset\r
40 //\r
41 QNCAltPortWrite (\r
42 QUARK_SCSS_SOC_UNIT_SB_PORT_ID,\r
43 QUARK_SCSS_SOC_UNIT_CFG_STICKY_RW,\r
44 QNCAltPortRead (QUARK_SCSS_SOC_UNIT_SB_PORT_ID, QUARK_SCSS_SOC_UNIT_CFG_STICKY_RW) | B_CFG_STICKY_RW_FORCE_RECOVERY\r
45 );\r
46\r
47 //\r
48 // Do a warm reset\r
49 //\r
50 gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);\r
51\r
52 return EFI_SUCCESS;\r
53}\r