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