aboutsummaryrefslogtreecommitdiff
path: root/PowerPlat.c
blob: b3e96d1e0df77c2511ffe28f972dbceaaf5663f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// This file was extracted from the TCG Published
// Trusted Platform Module Library
// Part 4: Supporting Routines
// Family "2.0"
// Level 00 Revision 01.16
// October 30, 2014

#include       "PlatformData.h"
#include       "Platform.h"
//
//
//          Functions
//
//          _plat__Signal_PowerOn()
//
//     Signal platform power on
//
LIB_EXPORT int
_plat__Signal_PowerOn(
     void
     )
{
     // Start clock
     _plat__ClockReset();
     // Initialize locality
     s_locality = 0;
     // Command cancel
      s_isCanceled = FALSE;
     // Need to indicate that we lost power
     s_powerLost = TRUE;
     return 0;
}
//
//
//          _plat__WasPowerLost()
//
//     Test whether power was lost before a _TPM_Init()
//
LIB_EXPORT BOOL
_plat__WasPowerLost(
     BOOL                 clear
     )
{
     BOOL        retVal = s_powerLost;
     if(clear)
         s_powerLost = FALSE;
     return retVal;
}
//
//
//          _plat_Signal_Reset()
//
//     This a TPM reset without a power loss.
//
LIB_EXPORT int
_plat__Signal_Reset(
     void
     )
{
     // Need to reset the clock
     _plat__ClockReset();
   // if we are doing reset but did not have a power failure, then we should
   // not need to reload NV ...
   return 0;
}
//
//
//        _plat__Signal_PowerOff()
//
//     Signal platform power off
//
LIB_EXPORT void
_plat__Signal_PowerOff(
   void
   )
{
   // Prepare NV memory for power off
   _plat__NVDisable();
   return;
}