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