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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
/** @file
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _TEST_POINT_LIB_H_
#define _TEST_POINT_LIB_H_
#include <PiPei.h>
#include <Uefi.h>
//
// Below is Test Point report definition.
//
//
// We reuse HSTI stype definition.
// ADAPTER_INFO_PLATFORM_TEST_POINT is similar to ADAPTER_INFO_PLATFORM_SECURITY.
//
#define PLATFORM_TEST_POINT_VERSION 0x00000001
#define PLATFORM_TEST_POINT_ROLE_PLATFORM_REFERENCE 0x00000001
#define PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV 0x00000002
#define PLATFORM_TEST_POINT_ROLE_IMPLEMENTOR_OEM 0x00000003
#define PLATFORM_TEST_POINT_ROLE_IMPLEMENTOR_ODM 0x00000004
#define TEST_POINT_FEATURES_ITEM_NUMBER 2
typedef struct {
UINT32 Version;
UINT32 Role;
CHAR16 ImplementationID[256];
UINT32 FeaturesSize;
//UINT8 FeaturesImplemented[];
//UINT8 FeaturesVerified[];
//CHAR16 ErrorString[];
} ADAPTER_INFO_PLATFORM_TEST_POINT;
//
// Below is test point report library
//
/**
Publish TestPoint table in AIP protocol.
One system should have only one PLATFORM_TEST_POINT_ROLE_PLATFORM_REFERENCE.
@param TestPoint TestPoint data
@param TestPointSize TestPoint size
@retval EFI_SUCCESS The TestPoint data is published in AIP protocol.
@retval EFI_ALREADY_STARTED There is already TestPoint table with Role and ImplementationID published in system.
@retval EFI_VOLUME_CORRUPTED The input TestPoint data is invalid.
@retval EFI_OUT_OF_RESOURCES There is not enough system resource to publish TestPoint data in AIP protocol.
**/
EFI_STATUS
EFIAPI
TestPointLibSetTable (
IN VOID *TestPoint,
IN UINTN TestPointSize
);
/**
Search TestPoint table in AIP protocol, and return the data.
This API will return the TestPoint table with indicated Role and ImplementationID,
NULL ImplementationID means to find the first TestPoint table with indicated Role.
@param Role Role of TestPoint data.
@param ImplementationID ImplementationID of TestPoint data.
NULL means find the first one match Role.
@param TestPoint TestPoint data. This buffer is allocated by callee, and it
is the responsibility of the caller to free it after
using it.
@param TestPointSize TestPoint size
@retval EFI_SUCCESS The TestPoint data in AIP protocol is returned.
@retval EFI_NOT_FOUND There is not TestPoint table with the Role and ImplementationID published in system.
**/
EFI_STATUS
EFIAPI
TestPointLibGetTable (
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
OUT VOID **TestPoint,
OUT UINTN *TestPointSize
);
/**
Set FeaturesVerified in published TestPoint table.
This API will update the TestPoint table with indicated Role and ImplementationID,
NULL ImplementationID means to find the first TestPoint table with indicated Role.
@param Role Role of TestPoint data.
@param ImplementationID ImplementationID of TestPoint data.
NULL means find the first one match Role.
@param ByteIndex Byte index of FeaturesVerified of TestPoint data.
@param BitMask Bit mask of FeaturesVerified of TestPoint data.
@retval EFI_SUCCESS The FeaturesVerified of TestPoint data updated in AIP protocol.
@retval EFI_NOT_STARTED There is not TestPoint table with the Role and ImplementationID published in system.
@retval EFI_UNSUPPORTED The ByteIndex is invalid.
**/
EFI_STATUS
EFIAPI
TestPointLibSetFeaturesVerified (
IN UINT32 Role,
IN CHAR16 *ImplementationID, OPTIONAL
IN UINT32 ByteIndex,
IN UINT8 BitMask
);
/**
Clear FeaturesVerified in published TestPoint table.
This API will update the TestPoint table with indicated Role and ImplementationID,
NULL ImplementationID means to find the first TestPoint table with indicated Role.
@param Role Role of TestPoint data.
@param ImplementationID ImplementationID of TestPoint data.
NULL means find the first one match Role.
@param ByteIndex Byte index of FeaturesVerified of TestPoint data.
@param BitMask Bit mask of FeaturesVerified of TestPoint data.
@retval EFI_SUCCESS The FeaturesVerified of TestPoint data updated in AIP protocol.
@retval EFI_NOT_STARTED There is not TestPoint table with the Role and ImplementationID published in system.
@retval EFI_UNSUPPORTED The ByteIndex is invalid.
**/
EFI_STATUS
EFIAPI
TestPointLibClearFeaturesVerified (
IN UINT32 Role,
IN CHAR16 *ImplementationID, OPTIONAL
IN UINT32 ByteIndex,
IN UINT8 BitMask
);
/**
Append ErrorString in published TestPoint table.
This API will update the TestPoint table with indicated Role and ImplementationID,
NULL ImplementationID means to find the first TestPoint table with indicated Role.
@param Role Role of TestPoint data.
@param ImplementationID ImplementationID of TestPoint data.
NULL means find the first one match Role.
@param ErrorString ErrorString of TestPoint data.
@retval EFI_SUCCESS The ErrorString of TestPoint data is updated in AIP protocol.
@retval EFI_NOT_STARTED There is not TestPoint table with the Role and ImplementationID published in system.
@retval EFI_OUT_OF_RESOURCES There is not enough system resource to update ErrorString.
**/
EFI_STATUS
EFIAPI
TestPointLibAppendErrorString (
IN UINT32 Role,
IN CHAR16 *ImplementationID, OPTIONAL
IN CHAR16 *ErrorString
);
/**
Set a new ErrorString in published TestPoint table.
This API will update the TestPoint table with indicated Role and ImplementationID,
NULL ImplementationID means to find the first TestPoint table with indicated Role.
@param Role Role of TestPoint data.
@param ImplementationID ImplementationID of TestPoint data.
NULL means find the first one match Role.
@param ErrorString ErrorString of TestPoint data.
@retval EFI_SUCCESS The ErrorString of TestPoint data is updated in AIP protocol.
@retval EFI_NOT_STARTED There is not TestPoint table with the Role and ImplementationID published in system.
@retval EFI_OUT_OF_RESOURCES There is not enough system resource to update ErrorString.
**/
EFI_STATUS
EFIAPI
TestPointLibSetErrorString (
IN UINT32 Role,
IN CHAR16 *ImplementationID, OPTIONAL
IN CHAR16 *ErrorString
);
//
// TEST POINT SMM Communication command
//
#define SMI_HANDLER_TEST_POINT_COMMAND_GET_INFO 0x1
#define SMI_HANDLER_TEST_POINT_COMMAND_GET_DATA_BY_OFFSET 0x2
typedef struct {
UINT32 Command;
UINT32 DataLength;
UINT64 ReturnStatus;
} SMI_HANDLER_TEST_POINT_PARAMETER_HEADER;
typedef struct {
SMI_HANDLER_TEST_POINT_PARAMETER_HEADER Header;
UINT64 DataSize;
} SMI_HANDLER_TEST_POINT_PARAMETER_GET_INFO;
typedef struct {
SMI_HANDLER_TEST_POINT_PARAMETER_HEADER Header;
//
// On input, data buffer size.
// On output, actual data buffer size copied.
//
UINT64 DataSize;
PHYSICAL_ADDRESS DataBuffer;
//
// On input, data buffer offset to copy.
// On output, next time data buffer offset to copy.
//
UINT64 DataOffset;
} SMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET;
extern EFI_GUID gAdapterInfoPlatformTestPointGuid;
#endif
|