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