1 /* Microsoft Reference Implementation for TPM 2.0
2  *
3  *  The copyright in this software is being made available under the BSD License,
4  *  included below. This software may be subject to other third party and
5  *  contributor rights, including patent rights, and no such rights are granted
6  *  under this license.
7  *
8  *  Copyright (c) Microsoft Corporation
9  *
10  *  All rights reserved.
11  *
12  *  BSD License
13  *
14  *  Redistribution and use in source and binary forms, with or without modification,
15  *  are permitted provided that the following conditions are met:
16  *
17  *  Redistributions of source code must retain the above copyright notice, this list
18  *  of conditions and the following disclaimer.
19  *
20  *  Redistributions in binary form must reproduce the above copyright notice, this
21  *  list of conditions and the following disclaimer in the documentation and/or
22  *  other materials provided with the distribution.
23  *
24  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS""
25  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27  *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
28  *  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31  *  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 // This file contains the definitions for the ACT macros and data types used in the
36 // ACT implementation.
37 
38 #ifndef _PLATFORM_ACT_H_
39 #define _PLATFORM_ACT_H_
40 
41 typedef struct ACT_DATA
42 {
43     uint32_t            remaining;
44     uint32_t            newValue;
45     uint8_t             signaled;
46     uint8_t             pending;
47     uint8_t             number;
48 } ACT_DATA, *P_ACT_DATA;
49 
50 #if !(defined RH_ACT_0) || (RH_ACT_0 != YES)
51 #   undef   RH_ACT_0
52 #   define  RH_ACT_0 NO
53 #   define IF_ACT_0_IMPLEMENTED(op)
54 #else
55 #   define IF_ACT_0_IMPLEMENTED(op) op(0)
56 #endif
57 #if !(defined RH_ACT_1) || (RH_ACT_1 != YES)
58 #   undef   RH_ACT_1
59 #   define  RH_ACT_1 NO
60 #   define IF_ACT_1_IMPLEMENTED(op)
61 #else
62 #   define IF_ACT_1_IMPLEMENTED(op) op(1)
63 #endif
64 #if !(defined RH_ACT_2) || (RH_ACT_2 != YES)
65 #   undef   RH_ACT_2
66 #   define  RH_ACT_2 NO
67 #   define IF_ACT_2_IMPLEMENTED(op)
68 #else
69 #   define IF_ACT_2_IMPLEMENTED(op) op(2)
70 #endif
71 #if !(defined RH_ACT_3) || (RH_ACT_3 != YES)
72 #   undef   RH_ACT_3
73 #   define  RH_ACT_3 NO
74 #   define IF_ACT_3_IMPLEMENTED(op)
75 #else
76 #   define IF_ACT_3_IMPLEMENTED(op) op(3)
77 #endif
78 #if !(defined RH_ACT_4) || (RH_ACT_4 != YES)
79 #   undef   RH_ACT_4
80 #   define  RH_ACT_4 NO
81 #   define IF_ACT_4_IMPLEMENTED(op)
82 #else
83 #   define IF_ACT_4_IMPLEMENTED(op) op(4)
84 #endif
85 #if !(defined RH_ACT_5) || (RH_ACT_5 != YES)
86 #   undef   RH_ACT_5
87 #   define  RH_ACT_5 NO
88 #   define IF_ACT_5_IMPLEMENTED(op)
89 #else
90 #   define IF_ACT_5_IMPLEMENTED(op) op(5)
91 #endif
92 #if !(defined RH_ACT_6) || (RH_ACT_6 != YES)
93 #   undef   RH_ACT_6
94 #   define  RH_ACT_6 NO
95 #   define IF_ACT_6_IMPLEMENTED(op)
96 #else
97 #   define IF_ACT_6_IMPLEMENTED(op) op(6)
98 #endif
99 #if !(defined RH_ACT_7) || (RH_ACT_7 != YES)
100 #   undef   RH_ACT_7
101 #   define  RH_ACT_7 NO
102 #   define IF_ACT_7_IMPLEMENTED(op)
103 #else
104 #   define IF_ACT_7_IMPLEMENTED(op) op(7)
105 #endif
106 #if !(defined RH_ACT_8) || (RH_ACT_8 != YES)
107 #   undef   RH_ACT_8
108 #   define  RH_ACT_8 NO
109 #   define IF_ACT_8_IMPLEMENTED(op)
110 #else
111 #   define IF_ACT_8_IMPLEMENTED(op) op(8)
112 #endif
113 #if !(defined RH_ACT_9) || (RH_ACT_9 != YES)
114 #   undef   RH_ACT_9
115 #   define  RH_ACT_9 NO
116 #   define IF_ACT_9_IMPLEMENTED(op)
117 #else
118 #   define IF_ACT_9_IMPLEMENTED(op) op(9)
119 #endif
120 #if !(defined RH_ACT_A) || (RH_ACT_A != YES)
121 #   undef   RH_ACT_A
122 #   define  RH_ACT_A NO
123 #   define IF_ACT_A_IMPLEMENTED(op)
124 #else
125 #   define IF_ACT_A_IMPLEMENTED(op) op(A)
126 #endif
127 #if !(defined RH_ACT_B) || (RH_ACT_B != YES)
128 #   undef   RH_ACT_B
129 #   define  RH_ACT_B NO
130 #   define IF_ACT_B_IMPLEMENTED(op)
131 #else
132 #   define IF_ACT_B_IMPLEMENTED(op) op(B)
133 #endif
134 #if !(defined RH_ACT_C) || (RH_ACT_C != YES)
135 #   undef   RH_ACT_C
136 #   define  RH_ACT_C NO
137 #   define IF_ACT_C_IMPLEMENTED(op)
138 #else
139 #   define IF_ACT_C_IMPLEMENTED(op) op(C)
140 #endif
141 #if !(defined RH_ACT_D) || (RH_ACT_D != YES)
142 #   undef   RH_ACT_D
143 #   define  RH_ACT_D NO
144 #   define IF_ACT_D_IMPLEMENTED(op)
145 #else
146 #   define IF_ACT_D_IMPLEMENTED(op) op(D)
147 #endif
148 #if !(defined RH_ACT_E) || (RH_ACT_E != YES)
149 #   undef   RH_ACT_E
150 #   define  RH_ACT_E NO
151 #   define IF_ACT_E_IMPLEMENTED(op)
152 #else
153 #   define IF_ACT_E_IMPLEMENTED(op) op(E)
154 #endif
155 #if !(defined RH_ACT_F) || (RH_ACT_F != YES)
156 #   undef   RH_ACT_F
157 #   define  RH_ACT_F NO
158 #   define IF_ACT_F_IMPLEMENTED(op)
159 #else
160 #   define IF_ACT_F_IMPLEMENTED(op) op(F)
161 #endif
162 
163 #define FOR_EACH_ACT(op)                                                            \
164     IF_ACT_0_IMPLEMENTED(op)                                                        \
165     IF_ACT_1_IMPLEMENTED(op)                                                        \
166     IF_ACT_2_IMPLEMENTED(op)                                                        \
167     IF_ACT_3_IMPLEMENTED(op)                                                        \
168     IF_ACT_4_IMPLEMENTED(op)                                                        \
169     IF_ACT_5_IMPLEMENTED(op)                                                        \
170     IF_ACT_6_IMPLEMENTED(op)                                                        \
171     IF_ACT_7_IMPLEMENTED(op)                                                        \
172     IF_ACT_8_IMPLEMENTED(op)                                                        \
173     IF_ACT_9_IMPLEMENTED(op)                                                        \
174     IF_ACT_A_IMPLEMENTED(op)                                                        \
175     IF_ACT_B_IMPLEMENTED(op)                                                        \
176     IF_ACT_C_IMPLEMENTED(op)                                                        \
177     IF_ACT_D_IMPLEMENTED(op)                                                        \
178     IF_ACT_E_IMPLEMENTED(op)                                                        \
179     IF_ACT_F_IMPLEMENTED(op)
180 
181 #endif // _PLATFORM_ACT_H_
182