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