1 // This file was extracted from the TCG Published
2 // Trusted Platform Module Library
3 // Part 4: Supporting Routines
4 // Family "2.0"
5 // Level 00 Revision 01.16
6 // October 30, 2014
7 
8 #include       "PlatformData.h"
9 #include       "Platform.h"
10 //
11 //
12 //          Functions
13 //
14 //          _plat__Signal_PowerOn()
15 //
16 //     Signal platform power on
17 //
18 LIB_EXPORT int
_plat__Signal_PowerOn(void)19 _plat__Signal_PowerOn(
20      void
21      )
22 {
23      // Start clock
24      _plat__ClockReset();
25      // Initialize locality
26      s_locality = 0;
27      // Command cancel
28       s_isCanceled = FALSE;
29      // Need to indicate that we lost power
30      s_powerLost = TRUE;
31      return 0;
32 }
33 //
34 //
35 //          _plat__WasPowerLost()
36 //
37 //     Test whether power was lost before a _TPM_Init()
38 //
39 LIB_EXPORT BOOL
_plat__WasPowerLost(BOOL clear)40 _plat__WasPowerLost(
41      BOOL                 clear
42      )
43 {
44      BOOL        retVal = s_powerLost;
45      if(clear)
46          s_powerLost = FALSE;
47      return retVal;
48 }
49 //
50 //
51 //          _plat_Signal_Reset()
52 //
53 //     This a TPM reset without a power loss.
54 //
55 LIB_EXPORT int
_plat__Signal_Reset(void)56 _plat__Signal_Reset(
57      void
58      )
59 {
60      // Need to reset the clock
61      _plat__ClockReset();
62    // if we are doing reset but did not have a power failure, then we should
63    // not need to reload NV ...
64    return 0;
65 }
66 //
67 //
68 //        _plat__Signal_PowerOff()
69 //
70 //     Signal platform power off
71 //
72 LIB_EXPORT void
_plat__Signal_PowerOff(void)73 _plat__Signal_PowerOff(
74    void
75    )
76 {
77    // Prepare NV memory for power off
78    _plat__NVDisable();
79    return;
80 }
81