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
|
/** @file
Header file for Reference code Firmware Version Info Interface Lib implementation.
@copyright
Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
This software and associated documentation (if any) is furnished
under a license and may only be used or copied in accordance
with the terms of the license. Except as permitted by such
license, no part of this software or documentation may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any means without the express written consent of
Intel Corporation.
This file contains a 'Sample Driver' and is licensed as such
under the terms of your license agreement with Intel or your
vendor. This file may be modified by the user, subject to
the additional terms of the license agreement
**/
#ifndef _RC_FVI_DXE_LIB_H_
#define _RC_FVI_DXE_LIB_H_
#include "Smbios.h"
#pragma pack(1)
///
/// FviSmbios Type table -
/// {
/// FVI_HEADER;
/// FVI_ELEMENTS;
///...FVI_ELEMENTS;
/// .....
/// }
///
typedef struct {
UINT8 MajorVersion;
UINT8 MinorVersion;
UINT8 Revision;
UINT16 BuildNum;
} RC_VERSION;
///
/// If string is implemented for ComponentName or VersionString, and then string index of
/// ComponentName or VersionString can't be zero. The string index of ComponentName and
/// VersionString will be updated and calculated when collect all elements.
/// String index must contain zero if not implemented.
///
typedef struct {
UINT8 ComponentName;
UINT8 VersionString;
RC_VERSION Version;
UINT8 NameString[SMBIOS_STRING_MAX_LENGTH];
UINT8 VerString[SMBIOS_STRING_MAX_LENGTH];
} FVI_ELEMENTS;
#define FVI_ELEMENTS_SIZE_NOSTRING (sizeof(FVI_ELEMENTS) - SMBIOS_STRING_MAX_LENGTH * 2)
#define DEFAULT_FVI_ELEMENT_DATA(Name) \
{ \
0x1, \
0x00, \
{ \
(UINT8) (((Name ## _RC_VERSION) & 0xFF000000) >> 24), \
(UINT8) (((Name ## _RC_VERSION) & 0x00FF0000) >> 16), \
(UINT8) (((Name ## _RC_VERSION) & 0x0000FF00) >> 8), \
(UINT16) (((Name ## _RC_VERSION) & 0x000000FF)), \
}, \
Name ## _FVI_STRING, \
0 \
}
///
/// This is the definitions for SMBIOS FviSmbios Type table
///
typedef struct {
SMBIOS_STRUCTURE_HDR Header;
UINT8 Count; ///< Number of elements included
} FVI_HEADER;
///
/// This is definition for Misc sub class data hub
///
typedef struct {
EFI_SUBCLASS_TYPE1_HEADER Header;
FVI_HEADER FviHdr;
} MISC_SUBCLASS_FVI_HEADER;
///
/// Use the OEM Data Record for SMBIOS Type 0x80-0xFF
///
#define MISC_SUBCLASS_TYPE1_HEADER_DATA(Name) \
{ \
EFI_MISC_SUBCLASS_VERSION, \
sizeof(EFI_SUBCLASS_TYPE1_HEADER), \
Name ## _FVI_SMBIOS_INSTANCE, \
0x1, \
EFI_MISC_SMBIOS_STRUCT_ENCAP_RECORD_NUMBER \
}
#define DEFAULT_FVI_HEADER_DATA(Name) \
{ \
{ \
Name ## _FVI_SMBIOS_TYPE, \
sizeof(FVI_HEADER), \
0x00, \
}, \
0x1 \
}
///
/// Initialize per-record portion of subclass header and fvi header, also fill
/// static data into data portion of record
///
#define MISC_SUBCLASS_FVI_HEADER_ENTRY(Name) \
{\
MISC_SUBCLASS_TYPE1_HEADER_DATA(Name), \
DEFAULT_FVI_HEADER_DATA(Name) \
}
///
/// The function to update the element before log to Data Hub
///
typedef EFI_STATUS (EFIAPI FVI_ELEMENT_FUNCTION) (
IN OUT FVI_ELEMENTS *Element
);
typedef struct {
FVI_ELEMENTS Element;
FVI_ELEMENT_FUNCTION *Function;
} FVI_ELEMENT_AND_FUNCTION;
typedef struct {
MISC_SUBCLASS_FVI_HEADER FviHeader;
FVI_ELEMENT_AND_FUNCTION *Elements; ///< Pointer to elements.
} FVI_DATA_HUB_CALLBACK_CONTEXT;
#pragma pack()
/**
Initialize callback context for Firmware Version Info (FVI) Interface Spec v0.7
implementation.
Invoke this routine to initialize data hub and context for log,
all elements can be updated before execute CreateRcFviDatahub or updated by
the element hook that registered as FVI_ELEMENT_FUNCTION
@param[in] Type Value is defined in SMBIOS Type 14 - Group Associaction structure - item type.
@param[in] Count Number of elements included by this SMBIOS table
@param[in] FviContext Context of FVI elements for data hub log
@retval None
**/
VOID
InitFviDataHubCbContext (
IN UINT8 Type,
IN UINT8 Count,
IN FVI_DATA_HUB_CALLBACK_CONTEXT *FviContext
);
/**
Create the Reference code version info as per Firmware Version Info (FVI) Interface Spec v0.7
to Data Hub.
Invoke this routine to log record when all Fvi elements are finialized
@param[in] FviContext Pointer to the notification functions context, which is context of FVI
elements for data hub log
@retval None
**/
VOID
CreateRcFviDatahub (
IN FVI_DATA_HUB_CALLBACK_CONTEXT *FviContext
)
;
#endif
|