]> git.proxmox.com Git - mirror_edk2.git/blame - QuarkPlatformPkg/Application/ForceRecovery/ForceRecovery.c
QuarkPlatformPkg: Replace BSD License with BSD+Patent License
[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
0eb3de2e 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
9c3dea8d
MK
6\r
7**/\r
8\r
9#include <Uefi.h>\r
10\r
11#include <Library/UefiRuntimeServicesTableLib.h>\r
12#include <Library/QNCAccessLib.h>\r
13\r
14/**\r
15 The user Entry Point for Application. The user code starts with this function\r
16 as the real entry point for the application.\r
17\r
18 @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
19 @param[in] SystemTable A pointer to the EFI System Table.\r
20\r
21 @retval EFI_SUCCESS The entry point is executed successfully.\r
22 @retval other Some error occurs when executing this entry point.\r
23\r
24**/\r
25EFI_STATUS\r
26EFIAPI\r
27UefiMain (\r
28 IN EFI_HANDLE ImageHandle,\r
29 IN EFI_SYSTEM_TABLE *SystemTable\r
30 )\r
31{\r
32 //\r
33 // Set 'B_CFG_STICKY_RW_FORCE_RECOVERY' sticky bit so we know we need to do a recovery following warm reset\r
34 //\r
35 QNCAltPortWrite (\r
36 QUARK_SCSS_SOC_UNIT_SB_PORT_ID,\r
37 QUARK_SCSS_SOC_UNIT_CFG_STICKY_RW,\r
38 QNCAltPortRead (QUARK_SCSS_SOC_UNIT_SB_PORT_ID, QUARK_SCSS_SOC_UNIT_CFG_STICKY_RW) | B_CFG_STICKY_RW_FORCE_RECOVERY\r
39 );\r
40\r
41 //\r
42 // Do a warm reset\r
43 //\r
44 gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);\r
45\r
46 return EFI_SUCCESS;\r
47}\r