]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Universal/SetupBrowserDxe/Setup.h
Added Spd2Dec.exe and Fpd2Dsc.exe tools
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / SetupBrowserDxe / Setup.h
1 /**@file
2
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _SETUP_H
16 #define _SETUP_H
17
18
19 #include <PiDxe.h>
20
21 #include <Protocol/FormCallbackFramework.h>
22 #include <Protocol/FormBrowserFramework.h>
23 #include <Protocol/HiiFramework.h>
24 #include <Protocol/Print.h>
25
26 #include <Library/BaseLib.h>
27 #include <Library/DebugLib.h>
28 #include <Library/BaseMemoryLib.h>
29 #include <Library/MemoryAllocationLib.h>
30 #include <Library/UefiDriverEntryPoint.h>
31 #include <Library/PrintLib.h>
32 #include <Library/UefiBootServicesTableLib.h>
33 #include <Library/UefiRuntimeServicesTableLib.h>
34 #include <Library/HiiLibFramework.h>
35 #include <Library/GraphicsLib.h>
36
37
38 //
39 // This is the generated header file which includes whatever needs to be exported (strings + IFR)
40 //
41 extern UINT8 SetupBrowserStrings[];
42
43 //
44 // Screen definitions
45 //
46 #define BANNER_HEIGHT 4
47 #define BANNER_COLUMNS 3
48
49 #define FRONT_PAGE_HEADER_HEIGHT 4
50 #define NONE_FRONT_PAGE_HEADER_HEIGHT 3
51 #define LEFT_SKIPPED_COLUMNS 4
52 #define FOOTER_HEIGHT 4
53 #define STATUS_BAR_HEIGHT 1
54 #define SCROLL_ARROW_HEIGHT 1
55 #define POPUP_PAD_SPACE_COUNT 5
56 #define POPUP_FRAME_WIDTH 2
57
58
59 #define EFI_SETUP_APPLICATION_SUBCLASS 0x00
60 #define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
61 #define EFI_FRONT_PAGE_SUBCLASS 0x02
62 #define EFI_SINGLE_USE_SUBCLASS 0x03 // Used to display a single entity and then exit
63 //
64 // Definition for function key setting
65 //
66 #define NONE_FUNCTION_KEY_SETTING 0
67 #define DEFAULT_FUNCTION_KEY_SETTING (FUNCTION_ONE | FUNCTION_TWO | FUNCTION_NINE | FUNCTION_TEN)
68
69 #define FUNCTION_ONE (1 << 0)
70 #define FUNCTION_TWO (1 << 1)
71 #define FUNCTION_NINE (1 << 2)
72 #define FUNCTION_TEN (1 << 3)
73
74 typedef struct {
75 EFI_GUID FormSetGuid;
76 UINTN KeySetting;
77 } FUNCTIION_KEY_SETTING;
78
79 //
80 // Character definitions
81 //
82 #define CHAR_SPACE 0x0020
83 #define UPPER_LOWER_CASE_OFFSET 0x20
84
85 //
86 // Time definitions
87 //
88 #define ONE_SECOND 10000000
89
90 //
91 // Display definitions
92 //
93 #define LEFT_HYPER_DELIMITER L'<'
94 #define RIGHT_HYPER_DELIMITER L'>'
95
96 #define LEFT_ONEOF_DELIMITER L'<'
97 #define RIGHT_ONEOF_DELIMITER L'>'
98
99 #define LEFT_NUMERIC_DELIMITER L'['
100 #define RIGHT_NUMERIC_DELIMITER L']'
101
102 #define LEFT_CHECKBOX_DELIMITER L"["
103 #define RIGHT_CHECKBOX_DELIMITER L"]"
104
105 #define CHECK_ON L"X"
106 #define CHECK_OFF L" "
107
108 #define TIME_SEPARATOR L':'
109 #define DATE_SEPARATOR L'/'
110
111 #define YES_ANSWER L'Y'
112 #define NO_ANSWER L'N'
113
114 //
115 // Up to how many lines does the ordered list display
116 //
117 #define ORDERED_LIST_SIZE 4
118
119 //
120 // This is the Input Error Message
121 //
122 #define INPUT_ERROR 1
123
124 //
125 // This is the NV RAM update required Message
126 //
127 #define NV_UPDATE_REQUIRED 2
128
129 //
130 // Refresh the Status Bar with flags
131 //
132 #define REFRESH_STATUS_BAR 0xff
133
134 //
135 // This width is basically the sum of the prompt and option widths
136 //
137 #define QUESTION_BLOCK_WIDTH 50
138
139 //
140 // Width of the Language Description (Using ISO-639-2 3 ASCII letter standard)
141 //
142 #define LANG_DESC_WIDTH 3
143
144 //
145 // Maximum Number of Binaries we can see
146 //
147 #define MAX_BINARIES 255
148
149 //
150 // Invalid Handle
151 //
152 #define EFI_HII_INVALID_HANDLE 0xFFFF
153
154 //
155 // Invalid Offset Value
156 //
157 #define INVALID_OFFSET_VALUE 0xFFFF
158
159 struct StringPart {
160 struct StringPart *Next;
161 CHAR8 String[QUESTION_BLOCK_WIDTH + 2];
162 };
163
164 //
165 // The tag definition defines the data associated with a tag (an operation
166 // in the IFR lingo). The tag is thus a modified union of all the data
167 // required for tags. The user should be careful to only rely upon information
168 // relevant to that tag as the contents of other fields is undefined.
169 //
170 // The intent here is for this to be all of the data associated with a particular tag.
171 // Some of this data is extracted from the IFR and left alone. Other data will be derived
172 // when the page is selected (since that's the first time we really know what language the
173 // page is to be displayed in) and still other data will vary based on the selection.
174 // If you'd like to consider alternatives, let me know. This structure has grown somewhat organically.
175 // It gets a new item stuffed in it when a new item is needed. When I finally decided I needed the
176 // StringPart structure, items got added here, for example.
177 //
178 typedef struct {
179 UINT8 Operand; // The operand (first byte) of the variable length tag.
180 EFI_GUID GuidValue; // Primarily for FormSet data
181 EFI_PHYSICAL_ADDRESS CallbackHandle;
182 UINT16 Class;
183 UINT16 SubClass;
184 UINT16 NumberOfLines; // The number of lines the tag takes up on the page. Adjusted when we display the page as it can change from language to language.
185 UINT16 PageLine;
186 UINT16 PageColumn;
187 UINT16 OptionWidth; // The option can be wider than the column usually associated with options. This is the width on the last option line
188 STRING_REF Text; // Used for title, subtitle, prompt, etc. This is the string token associated with the string. This token is language independent.
189 STRING_REF TextTwo; // Used for title, subtitle, prompt, etc. This is the string token associated with the string. This token is language independent.
190 STRING_REF Help; // Null means no help Same as above but for languages.
191 UINT16 Consistency; // Do we need to check this opcode against consistency? If > 0, yes.
192 UINT16 Id;
193 UINT16 Id2; // The questions (mainly) have identifiers associated with them. These are filled in from the IFR tags and used by e.g. the RPN calculations. (com1 is set to, versus com2 is set to)
194 //
195 // These are the three values that are created to determine where in the variable the data is stored. This should, in general,
196 // be allocated by the build tool. The one major issue is, once storage is allocated for something, it can't be reallocated or we will get a mess.
197 //
198 UINT16 StorageStart;
199 //
200 // These are the three values that are created to determine where in the variable the data is stored. This should, in general,
201 // be allocated by the build tool. The one major issue is, once storage is allocated for something, it can't be reallocated or we will get a mess.
202 //
203 UINT8 StorageWidth;
204 //
205 // These are the three values that are created to determine where in the variable the data is stored. This should, in general,
206 // be allocated by the build tool. The one major issue is, once storage is allocated for something, it can't be reallocated or we will get a mess.
207 //
208 UINT16 Value;
209 //
210 // (Default or current)
211 //
212 UINT8 Flags;
213 UINT16 Key;
214 //
215 // Used to preserve a value during late consistency checking
216 //
217 UINT16 OldValue;
218 UINT16 Minimum;
219 UINT16 Maximum;
220 UINT16 Step;
221 UINT16 Default;
222 UINT16 NvDataSize;
223 UINT16 ConsistencyId;
224 BOOLEAN GrayOut;
225 BOOLEAN Suppress;
226 UINT16 Encoding; // Data from the tags. The first three are used by the numeric input. Encoding is used by the password stuff (a placeholder today - may go away).
227 UINT16 *IntList; // List of the values possible for a list question
228 //
229 // The string is obtained from the string list and formatted into lines and the lines are held in this linked list.
230 // If we have more than a screen's worth of items, we will end up with cases where we have to display the last couple
231 // lines of a tag's string above the currently selected one, or, display a few lines of a tag at the bottom of a screen.
232 //
233 struct StringPart *StringList;
234 BOOLEAN ResetRequired; // Primarily used to determine if a reset is required by changing this op-code.
235 UINT16 VariableNumber; // Used to define which variable the StorageStart will be pertinent for (0-based) For single variable VFR this will always be 0.
236 //
237 // Used to define which variable the StorageStart will be pertinent for (0-based) This is used for boolean check of ID versus ID
238 // so that a user can compare the value of one variable.field content versus another variable.field content.
239 //
240 UINT16 VariableNumber2;
241 } EFI_TAG;
242
243 #define EFI_FORM_DATA_SIGNATURE EFI_SIGNATURE_32 ('F', 'o', 'r', 'm')
244
245 typedef struct {
246 UINTN Signature;
247
248 EFI_HII_PROTOCOL *Hii;
249 EFI_FORM_BROWSER_PROTOCOL FormConfig;
250 } EFI_FORM_CONFIGURATION_DATA;
251
252 #define EFI_FORM_DATA_FROM_THIS(a) CR (a, EFI_FORM_CONFIGURATION_DATA, FormConfig, EFI_FORM_DATA_SIGNATURE)
253
254 typedef struct _EFI_VARIABLE_DEFINITION {
255 CHAR8 *NvRamMap;
256 CHAR8 *FakeNvRamMap; // This is where the storage for NULL devices go (e.g. RTC)
257 EFI_GUID Guid;
258 UINT16 VariableId;
259 UINT16 VariableSize;
260 UINT16 VariableFakeSize; // For dynamically created and NULL device options, this is the latest size
261 CHAR16 *VariableName;
262 struct _EFI_VARIABLE_DEFINITION *Next;
263 struct _EFI_VARIABLE_DEFINITION *Previous;
264 } EFI_VARIABLE_DEFINITION;
265
266 typedef struct {
267 UINT32 Length; // Length in bytes between beginning of struc and end of Strings
268 CHAR8 LanguageCode[4]; // ISO-639-2 language code with a null-terminator
269 RELOFST PrintableLanguageName; // Translated name of the Language, "English"/"Espanol" etc
270 UINT32 Attributes; // If on, the language is intended to be printed right to left. The default (off) is to print left to right.
271 RELOFST StringsPointers[1]; // Pointing to string offset from beginning of String Binary
272 EFI_STRING Strings[1]; // Array of String Entries. Note the number of entries for Strings and StringsPointers will be the same
273 } EFI_LANGUAGE_SET;
274
275 //
276 // This encapsulates all the pointers associated with found IFR binaries
277 //
278 typedef struct _EFI_IFR_BINARY {
279 struct _EFI_IFR_BINARY *Next;
280 VOID *IfrPackage; // Handy for use in freeing the data later since this is the header of the buffer
281 VOID *FormBinary;
282 EFI_HII_HANDLE Handle;
283 STRING_REF TitleToken;
284 BOOLEAN UnRegisterOnExit;
285 } EFI_IFR_BINARY;
286
287 //
288 // This encapsulates all the questions (tags) for a particular Form Set
289 //
290 typedef struct _EFI_FORM_TAGS {
291 struct _EFI_FORM_TAGS *Next;
292 EFI_TAG *Tags;
293 } EFI_FORM_TAGS;
294
295 //
296 // This is the database of all inconsistency data. Each op-code associated
297 // with inconsistency will be tracked here. This optimizes the search requirement
298 // since we will back mark the main tag structure with the op-codes that have reference
299 // to inconsistency data. This way when parsing the main tag structure and encountering
300 // the inconsistency mark - we can search this database to know what the inconsistency
301 // parameters are for that entry.
302 //
303 typedef struct _EFI_INCONSISTENCY_DATA {
304 struct _EFI_INCONSISTENCY_DATA *Next;
305 struct _EFI_INCONSISTENCY_DATA *Previous;
306 UINT8 Operand;
307 STRING_REF Popup;
308 UINT16 QuestionId1;
309 UINT16 QuestionId2;
310 UINT16 Value;
311 UINT16 ListLength;
312 UINT16 ConsistencyId;
313 UINT16 *ValueList;
314 UINT16 VariableNumber;
315 UINT16 VariableNumber2;
316 UINT8 Width;
317 } EFI_INCONSISTENCY_DATA;
318
319 //
320 // Encapsulating all found Tag information from all sources
321 // Each encapsulation also contains the NvRamMap buffer and the Size of the NV store
322 //
323 typedef struct _EFI_FILE_FORM_TAGS {
324 struct _EFI_FILE_FORM_TAGS *NextFile;
325 EFI_INCONSISTENCY_DATA *InconsistentTags;
326 EFI_VARIABLE_DEFINITION *VariableDefinitions;
327 EFI_FORM_TAGS FormTags;
328 } EFI_FILE_FORM_TAGS;
329
330 typedef struct {
331 STRING_REF Banner[BANNER_HEIGHT][BANNER_COLUMNS];
332 } BANNER_DATA;
333
334 //
335 // Head of the Binary structures
336 //
337 EFI_IFR_BINARY *gBinaryDataHead;
338
339 //
340 // The IFR binary that the user chose to run
341 //
342 UINTN gActiveIfr;
343
344 EFI_HII_PROTOCOL *Hii;
345
346 VOID *CachedNVEntry;
347 BANNER_DATA *BannerData;
348 EFI_HII_HANDLE FrontPageHandle;
349 STRING_REF FrontPageTimeOutTitle;
350 INT16 FrontPageTimeOutValue;
351 UINTN gClassOfVfr;
352 UINTN gFunctionKeySetting;
353 BOOLEAN gResetRequired;
354 BOOLEAN gExitRequired;
355 BOOLEAN gSaveRequired;
356 BOOLEAN gNvUpdateRequired;
357 UINT16 gConsistencyId;
358 UINTN gPriorMenuEntry;
359 EFI_HII_HANDLE gHiiHandle;
360 BOOLEAN gFirstIn;
361 VOID *gPreviousValue;
362 UINT16 gDirection;
363 EFI_SCREEN_DESCRIPTOR gScreenDimensions;
364 BOOLEAN gUpArrow;
365 BOOLEAN gDownArrow;
366 BOOLEAN gTimeOnScreen;
367 BOOLEAN gDateOnScreen;
368
369 //
370 // Browser Global Strings
371 //
372 CHAR16 *gFunctionOneString;
373 CHAR16 *gFunctionTwoString;
374 CHAR16 *gFunctionNineString;
375 CHAR16 *gFunctionTenString;
376 CHAR16 *gEnterString;
377 CHAR16 *gEnterCommitString;
378 CHAR16 *gEscapeString;
379 CHAR16 *gMoveHighlight;
380 CHAR16 *gMakeSelection;
381 CHAR16 *gNumericInput;
382 CHAR16 *gToggleCheckBox;
383 CHAR16 *gPromptForPassword;
384 CHAR16 *gPromptForNewPassword;
385 CHAR16 *gConfirmPassword;
386 CHAR16 *gConfirmError;
387 CHAR16 *gPressEnter;
388 CHAR16 *gEmptyString;
389 CHAR16 *gAreYouSure;
390 CHAR16 *gYesResponse;
391 CHAR16 *gNoResponse;
392 CHAR16 *gMiniString;
393 CHAR16 *gPlusString;
394 CHAR16 *gMinusString;
395 CHAR16 *gAdjustNumber;
396
397 CHAR16 gPromptBlockWidth;
398 CHAR16 gOptionBlockWidth;
399 CHAR16 gHelpBlockWidth;
400
401 //
402 // Global Procedure Defines
403 //
404 VOID
405 InitializeBrowserStrings (
406 VOID
407 )
408 ;
409
410 UINTN
411 Print (
412 IN CHAR16 *fmt,
413 ...
414 )
415 ;
416
417 UINTN
418 PrintString (
419 CHAR16 *String
420 )
421 ;
422
423 UINTN
424 PrintChar (
425 CHAR16 Character
426 )
427 ;
428
429 UINTN
430 PrintAt (
431 IN UINTN Column,
432 IN UINTN Row,
433 IN CHAR16 *fmt,
434 ...
435 )
436 ;
437
438 UINTN
439 PrintStringAt (
440 IN UINTN Column,
441 IN UINTN Row,
442 CHAR16 *String
443 )
444 ;
445
446 UINTN
447 PrintCharAt (
448 IN UINTN Column,
449 IN UINTN Row,
450 CHAR16 Character
451 )
452 ;
453
454 VOID
455 DisplayPageFrame (
456 VOID
457 )
458 ;
459
460 CHAR16 *
461 GetToken (
462 IN STRING_REF IfrBinaryTitle,
463 IN EFI_HII_HANDLE HiiHandle
464 )
465 ;
466
467 VOID
468 GetTagCount (
469 IN UINT8 *RawFormSet,
470 IN OUT UINT16 *NumberOfTags
471 )
472 ;
473
474 VOID
475 GetNumericHeader (
476 IN EFI_TAG *Tag,
477 IN UINT8 *RawFormSet,
478 IN UINT16 Index,
479 IN UINT16 NumberOfLines,
480 IN EFI_FILE_FORM_TAGS *FileFormTags,
481 IN UINT16 CurrentVariable
482 )
483 ;
484
485 VOID
486 GetQuestionHeader (
487 IN EFI_TAG *Tag,
488 IN UINT8 *RawFormSet,
489 IN UINT16 Index,
490 IN EFI_FILE_FORM_TAGS *FileFormTags,
491 IN UINT16 CurrentVariable
492 )
493 ;
494
495 VOID
496 CreateSharedPopUp (
497 IN UINTN RequestedWidth,
498 IN UINTN NumberOfLines,
499 IN CHAR16 **ArrayOfStrings
500 )
501 ;
502
503 EFI_STATUS
504 CreateDialog (
505 IN UINTN NumberOfLines,
506 IN BOOLEAN HotKey,
507 IN UINTN MaximumStringSize,
508 OUT CHAR16 *StringBuffer,
509 OUT EFI_INPUT_KEY *KeyValue,
510 IN CHAR16 *String,
511 ...
512 )
513 ;
514
515 #endif