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