Coverage Report

Created: 2025-10-12 06:32

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/tpm2/PowerPlat.c
Line
Count
Source
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
19
_plat__Signal_PowerOn(
20
     void
21
     )
22
165
{
23
     // Start clock
24
165
     _plat__ClockReset();
25
     // Initialize locality
26
165
     s_locality = 0;
27
     // Command cancel
28
165
      s_isCanceled = FALSE;
29
     // Need to indicate that we lost power
30
165
     s_powerLost = TRUE;
31
165
     return 0;
32
165
}
33
//
34
//
35
//          _plat__WasPowerLost()
36
//
37
//     Test whether power was lost before a _TPM_Init()
38
//
39
LIB_EXPORT BOOL
40
_plat__WasPowerLost(
41
     BOOL                 clear
42
     )
43
165
{
44
165
     BOOL        retVal = s_powerLost;
45
165
     if(clear)
46
165
         s_powerLost = FALSE;
47
165
     return retVal;
48
165
}
49
//
50
//
51
//          _plat_Signal_Reset()
52
//
53
//     This a TPM reset without a power loss.
54
//
55
LIB_EXPORT int
56
_plat__Signal_Reset(
57
     void
58
     )
59
0
{
60
     // Need to reset the clock
61
0
     _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
0
   return 0;
65
0
}
66
//
67
//
68
//        _plat__Signal_PowerOff()
69
//
70
//     Signal platform power off
71
//
72
LIB_EXPORT void
73
_plat__Signal_PowerOff(
74
   void
75
   )
76
0
{
77
   // Prepare NV memory for power off
78
0
   _plat__NVDisable();
79
0
   return;
80
0
}