1 /** @file
2 This file includes the function that can be customized by OEM.
3 
4 Copyright (c) 2013-2015 Intel Corporation.
5 
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution.  The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10 
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 #include "CommonHeader.h"
17 
18 /**
19   This function allows the user to force a system recovery
20 
21 **/
22 VOID
23 EFIAPI
OemInitiateRecovery(VOID)24 OemInitiateRecovery (
25   VOID
26   )
27 {
28   UINT32          Data32;
29 
30   //
31   // Set 'B_CFG_STICKY_RW_FORCE_RECOVERY' sticky bit so we know we need to do a recovery following warm reset
32   //
33   Data32 = QNCAltPortRead (QUARK_SCSS_SOC_UNIT_SB_PORT_ID, QUARK_SCSS_SOC_UNIT_CFG_STICKY_RW);
34   Data32 |= B_CFG_STICKY_RW_FORCE_RECOVERY;
35   QNCAltPortWrite (QUARK_SCSS_SOC_UNIT_SB_PORT_ID, QUARK_SCSS_SOC_UNIT_CFG_STICKY_RW, Data32);
36 
37   //
38   // Initialte the warm reset
39   //
40   ResetWarm ();
41 }
42 
43 /**
44   This function allows the user to force a system recovery and deadloop.
45 
46   Deadloop required since system should not execute beyond this point.
47   Deadloop should never happen since OemInitiateRecovery () called within
48   this routine should never return since it executes a Warm Reset.
49 
50 **/
51 VOID
52 EFIAPI
OemInitiateRecoveryAndWait(VOID)53 OemInitiateRecoveryAndWait (
54   VOID
55   )
56 {
57   volatile UINTN  Index;
58 
59   OemInitiateRecovery ();
60   for (Index = 0; Index == 0;);
61 }
62