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