]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Sample/Tools/Source/VfrCompile/EfiVfr.h
Sync all bug fixes between EDK1.04 and EDK1.06 into EdkCompatibilityPkg.
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Tools / Source / VfrCompile / EfiVfr.h
CommitLineData
3eb9473e 1/*++\r
2\r
3e99020d 3Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
4b1e1121 4This program and the accompanying materials \r
3eb9473e 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 EfiVfr.h\r
15\r
16Abstract:\r
17\r
18 Defines and prototypes for the EFI internal forms representation\r
19 setup protocol and drivers\r
20 \r
21--*/\r
22\r
23#ifndef _EFI_VFR_H_\r
24#define _EFI_VFR_H_\r
25\r
26#include "Tiano.h"\r
27#include "EfiInternalFormRepresentation.h"\r
28#include <string.h>\r
29\r
30//\r
31// This number should be incremented with each change to the VFR compiler.\r
32// We write the version to the output list file for debug purposes.\r
33//\r
3e99020d
LG
34#define UTILITY_VERSION "v1.9"\r
35#define UTILITY_NAME "VfrCompile"\r
3eb9473e 36\r
37//\r
38// Maximum file path for filenames\r
39//\r
40#define MAX_PATH 255\r
41#define MAX_QUEUE_COUNT 255\r
42#define MAX_LINE_LEN 1024\r
3eb9473e 43\r
44//\r
45// We parse C-style structure definitions which can then be referenced\r
46// in VFR statements.\r
47// We need to define an internal structure that can be used to\r
48// track the fields in a structure definition, and another structure\r
49// to keep track of the structure name and subfields.\r
50//\r
51typedef struct _STRUCT_FIELD_DEFINITION {\r
52 struct _STRUCT_FIELD_DEFINITION *Next;\r
53 int DataSize;\r
54 int Offset; // from the start of the structure\r
55 int ArrayLength;\r
56 char IsArray;\r
57 char *Name;\r
58} STRUCT_FIELD_DEFINITION;\r
59\r
60typedef struct _STRUCT_DEFINITION {\r
61 struct _STRUCT_DEFINITION *Next;\r
62 int Size;\r
63 int LineNum; // line number where the structure was defined\r
64 int IsNonNV; // if this is the non-NV data structure definition\r
65 int Referenced; // if it's referenced anywhere in the VFR\r
66 int VarStoreIdValid; // found a 'varstore' statement for it in the VFR\r
67 unsigned short VarStoreId; // key from a varstore IFR statement\r
68 int VarStoreLineNum; // line number where VARSTORE was defined\r
69 char *Name;\r
70 STRUCT_FIELD_DEFINITION *Field;\r
71 STRUCT_FIELD_DEFINITION *LastField;\r
72} STRUCT_DEFINITION;\r
73\r
74//\r
75// For the IdEqValList variable list of UINT16's, keep track of them using\r
76// a linked list until we know how many there are.\r
77// We also use a linked list of these to keep track of labels used in\r
78// the VFR script so we can catch duplicates.\r
79// We'll also use it to keep track of defined varstore id's so we can\r
80// detect duplicate definitions.\r
81//\r
82typedef struct _UINT16_LIST {\r
83 struct _UINT16_LIST *Next;\r
84 UINT16 Value;\r
85 UINT32 LineNum;\r
86} UINT16_LIST;\r
87\r
88typedef struct _GOTO_REFERENCE {\r
89 struct _GOTO_REFERENCE *Next;\r
90 UINT32 RefLineNum; // line number of source file where referenced\r
91 UINT16 Value;\r
92} GOTO_REFERENCE;\r
93\r
94typedef struct _FORM_ID_VALUE {\r
95 struct _FORM_ID_VALUE *Next;\r
96 UINT32 LineNum;\r
97 UINT16 Value;\r
98} FORM_ID_VALUE;\r
99\r
100//\r
101// We keep track in the parser of all "#line 4 "x.y"" strings so we\r
102// can cross-reference the line numbers in the preprocessor output .i file\r
103// to the original input files.\r
104//\r
105typedef struct _PARSER_LINE_DEFINITION {\r
106 struct _PARSER_LINE_DEFINITION *Next;\r
107 UINT32 HashLineNum; // from the #line stmt\r
108 UINT32 TokenLineNum; // line number in the .i file\r
109 INT8 *FileName; // from the #line stmt\r
110} PARSER_LINE_DEFINITION;\r
111\r
112extern PARSER_LINE_DEFINITION *gLineDefinition;\r
113extern PARSER_LINE_DEFINITION *gLastLineDefinition;\r
114\r
115extern\r
116char *\r
117ConvertLineNumber (\r
118 UINT32 *LineNum\r
119 )\r
120/*++\r
121\r
122Routine Description:\r
123 Given the line number in the preprocessor-output file, use the line number\r
124 information we've saved to determine the source file name and line number\r
125 where the code originally came from. This is required for error reporting.\r
126\r
127Arguments:\r
128 LineNum - the line number in the preprocessor-output file.\r
129\r
130Returns:\r
131 Returns a pointer to the source file name. Also returns the line number \r
132 in the provided LineNum argument\r
133\r
134--*/\r
135;\r
136\r
137typedef struct _IFR_BYTE {\r
138 struct _IFR_BYTE *Next;\r
139 UINT32 LineNum;\r
140 UINT8 OpcodeByte;\r
141 UINT8 KeyByte;\r
142} IFR_BYTE;\r
143\r
144typedef struct {\r
145 INT8 VfrFileName[MAX_PATH];\r
146 INT8 VfrListFileName[MAX_PATH];\r
147 INT8 CreateListFile;\r
148 INT8 CreateIfrBinFile;\r
149 INT8 IfrOutputFileName[MAX_PATH];\r
150 INT8 OutputDirectory[MAX_PATH];\r
151 INT8 PreprocessorOutputFileName[MAX_PATH];\r
152 INT8 VfrBaseFileName[MAX_PATH]; // name of input VFR file with no path or extension\r
153 INT8 *IncludePaths;\r
154 INT8 *CPreprocessorOptions;\r
155} OPTIONS;\r
156\r
157extern OPTIONS gOptions;\r
158\r
159VOID\r
160WriteStandardFileHeader (\r
161 FILE *OutFptr\r
162 )\r
163/*++\r
164\r
165Routine Description:\r
166 This function is invoked to emit a standard header to an\r
167 output text file.\r
168 \r
169Arguments:\r
170 OutFptr - file to write the header to\r
171\r
172Returns:\r
173 None\r
174\r
175--*/\r
176;\r
177\r
178#endif // #ifndef _EFI_VFR_H_\r