878ddf1f |
1 | /*++\r |
2 | Copyright (c) 2006, Intel Corporation \r |
3 | All rights reserved. This program and the accompanying materials \r |
4 | are licensed and made available under the terms and conditions of the BSD License \r |
5 | which accompanies this distribution. The full text of the license may be found at \r |
6 | http://opensource.org/licenses/bsd-license.php \r |
7 | \r |
8 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r |
9 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r |
10 | \r |
11 | Module Name:\r |
12 | DriverSample.c\r |
13 | \r |
14 | Abstract:\r |
15 | \r |
16 | This is an example of how a driver might export data to the HII protocol to be \r |
17 | later utilized by the Setup Protocol\r |
18 | \r |
19 | --*/\r |
20 | \r |
21 | #include "DriverSample.h"\r |
22 | \r |
23 | #define DISPLAY_ONLY_MY_ITEM 0x0001\r |
24 | \r |
25 | #define STRING_PACK_GUID \\r |
26 | { \\r |
27 | 0x8160a85f, 0x934d, 0x468b, { 0xa2, 0x35, 0x72, 0x89, 0x59, 0x14, 0xf6, 0xfc } \\r |
28 | }\r |
29 | \r |
30 | EFI_GUID mFormSetGuid = FORMSET_GUID;\r |
31 | EFI_GUID mStringPackGuid = STRING_PACK_GUID; \r |
32 | \r |
33 | EFI_STATUS\r |
34 | EFIAPI\r |
35 | DriverCallback (\r |
36 | IN EFI_FORM_CALLBACK_PROTOCOL *This,\r |
37 | IN UINT16 KeyValue,\r |
38 | IN EFI_IFR_DATA_ARRAY *Data,\r |
39 | OUT EFI_HII_CALLBACK_PACKET **Packet\r |
40 | )\r |
41 | /*++\r |
42 | \r |
43 | Routine Description:\r |
44 | \r |
45 | This is the function that is called to provide results data to the driver. This data\r |
46 | consists of a unique key which is used to identify what data is either being passed back\r |
47 | or being asked for. \r |
48 | \r |
49 | Arguments:\r |
50 | \r |
51 | KeyValue - A unique value which is sent to the original exporting driver so that it\r |
52 | can identify the type of data to expect. The format of the data tends to\r |
53 | vary based on the op-code that geerated the callback.\r |
54 | \r |
55 | Data - A pointer to the data being sent to the original exporting driver.\r |
56 | \r |
57 | Returns: \r |
58 | \r |
59 | --*/\r |
60 | {\r |
61 | EFI_CALLBACK_INFO *Private;\r |
62 | EFI_HII_UPDATE_DATA *UpdateData;\r |
63 | EFI_STATUS Status;\r |
64 | UINT8 *Location;\r |
65 | EFI_HII_CALLBACK_PACKET *DataPacket;\r |
66 | UINT16 Value;\r |
67 | CHAR16 VariableName[40];\r |
68 | STATIC UINT16 QuestionId = 0;\r |
69 | IFR_OPTION *OptionList;\r |
70 | UINTN Index;\r |
71 | MyIfrNVData NVStruc;\r |
72 | \r |
73 | Private = EFI_CALLBACK_INFO_FROM_THIS (This);\r |
74 | \r |
75 | //\r |
76 | // This should tell me the first offset AFTER the end of the compiled NV map\r |
77 | // If op-code results are not going to be saved to NV locations ensure the QuestionId\r |
78 | // is beyond the end of the NVRAM mapping.\r |
79 | //\r |
80 | if (QuestionId == 0) {\r |
81 | QuestionId = sizeof (MyIfrNVData);\r |
82 | }\r |
83 | \r |
84 | ZeroMem (VariableName, (sizeof (CHAR16) * 40));\r |
85 | \r |
86 | switch (KeyValue) {\r |
87 | case 0x0001:\r |
88 | //\r |
89 | // Create a small boot order list\r |
90 | //\r |
91 | QuestionId = (UINT16) ((UINTN) (&NVStruc.BootOrder) - (UINTN) (&NVStruc));\r |
92 | \r |
93 | //\r |
94 | // Need some memory for OptionList. Allow for up to 8 options.\r |
95 | //\r |
96 | OptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 8);\r |
97 | \r |
98 | //\r |
99 | // Allocate space for creation of Buffer\r |
100 | //\r |
101 | UpdateData = AllocateZeroPool (0x1000);\r |
102 | \r |
103 | //\r |
104 | // Remove all the op-codes starting with Label 0x2222 to next Label (second label is for convenience\r |
105 | // so we don't have to keep track of how many op-codes we added or subtracted. The rules for removal\r |
106 | // of op-codes are simply that the removal will always stop as soon as a label or the end of a form is\r |
107 | // encountered. Therefore, giving a large obnoxious count such as below takes care of other complexities.\r |
108 | //\r |
109 | UpdateData->DataCount = 0xFF;\r |
110 | \r |
111 | //\r |
112 | // Delete set of op-codes\r |
113 | //\r |
114 | Private->Hii->UpdateForm (\r |
115 | Private->Hii,\r |
116 | Private->RegisteredHandle,\r |
117 | (EFI_FORM_LABEL) 0x2222,\r |
118 | FALSE, // If we aren't adding, we are deleting\r |
119 | UpdateData\r |
120 | );\r |
121 | \r |
122 | //\r |
123 | // Create 3 options\r |
124 | //\r |
125 | for (Index = 0; Index < 3; Index++) {\r |
126 | OptionList[Index].StringToken = (UINT16) (STR_BOOT_OPTION1 + Index);\r |
127 | OptionList[Index].Value = (UINT16) (Index + 1);\r |
128 | OptionList[Index].Flags = RESET_REQUIRED;\r |
129 | }\r |
130 | \r |
131 | CreateOrderedListOpCode (\r |
132 | QuestionId, // Question ID\r |
133 | 8, // Max Entries\r |
134 | (UINT16) STRING_TOKEN (STR_BOOT_OPTIONS), // Token value for the Prompt\r |
135 | (UINT16) STRING_TOKEN (STR_NULL_STRING), // Token value for the Help\r |
136 | OptionList,\r |
137 | 3,\r |
138 | &UpdateData->Data // Buffer location to place op-codes\r |
139 | );\r |
140 | \r |
141 | //\r |
142 | // For one-of/ordered lists commands, they really consist of 2 op-codes (a header and a footer)\r |
143 | // Each option within a one-of/ordered list is also an op-code\r |
144 | // So this example has 5 op-codes it is adding since we have a one-of header + 3 options + one-of footer\r |
145 | //\r |
146 | UpdateData->DataCount = 0x5;\r |
147 | \r |
148 | //\r |
149 | // Add one op-code\r |
150 | //\r |
151 | Private->Hii->UpdateForm (\r |
152 | Private->Hii,\r |
153 | Private->RegisteredHandle,\r |
154 | (EFI_FORM_LABEL) 0x2222,\r |
155 | TRUE,\r |
156 | UpdateData\r |
157 | );\r |
158 | \r |
159 | gBS->FreePool (UpdateData);\r |
160 | gBS->FreePool (OptionList);\r |
161 | break;\r |
162 | \r |
163 | case 0x0002:\r |
164 | //\r |
165 | // Create a large boot order list\r |
166 | //\r |
167 | QuestionId = (UINT16) ((UINTN) (&NVStruc.BootOrder) - (UINTN) (&NVStruc));\r |
168 | \r |
169 | //\r |
170 | // Need some memory for OptionList. Allow for up to 8 options.\r |
171 | //\r |
172 | OptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 8);\r |
173 | \r |
174 | //\r |
175 | // Allocate space for creation of Buffer\r |
176 | //\r |
177 | UpdateData = AllocateZeroPool (0x1000);\r |
178 | \r |
179 | //\r |
180 | // Remove all the op-codes starting with Label 0x2222 to next Label (second label is for convenience\r |
181 | // so we don't have to keep track of how many op-codes we added or subtracted\r |
182 | //\r |
183 | UpdateData->DataCount = 0xFF;\r |
184 | \r |
185 | //\r |
186 | // Delete one op-code\r |
187 | //\r |
188 | Private->Hii->UpdateForm (\r |
189 | Private->Hii,\r |
190 | Private->RegisteredHandle,\r |
191 | (EFI_FORM_LABEL) 0x2222,\r |
192 | FALSE,\r |
193 | UpdateData\r |
194 | );\r |
195 | \r |
196 | //\r |
197 | // Create 4 options\r |
198 | //\r |
199 | for (Index = 0; Index < 4; Index++) {\r |
200 | OptionList[Index].StringToken = (UINT16) (STR_BOOT_OPTION1 + Index);\r |
201 | OptionList[Index].Value = (UINT16) (Index + 1);\r |
202 | OptionList[Index].Flags = RESET_REQUIRED;\r |
203 | }\r |
204 | \r |
205 | CreateOrderedListOpCode (\r |
206 | QuestionId, // Question ID\r |
207 | 8, // Max Entries\r |
208 | (UINT16) STRING_TOKEN (STR_BOOT_OPTIONS), // Token value for the Prompt\r |
209 | (UINT16) STRING_TOKEN (STR_NULL_STRING), // Token value for the Help\r |
210 | OptionList,\r |
211 | 4,\r |
212 | &UpdateData->Data // Buffer location to place op-codes\r |
213 | );\r |
214 | \r |
215 | //\r |
216 | // For one-of commands, they really consist of 2 op-codes (a header and a footer)\r |
217 | // Each option within a one-of is also an op-code\r |
218 | // So this example has 6 op-codes it is adding since we have a one-of header + 4 options + one-of footer\r |
219 | //\r |
220 | UpdateData->DataCount = 0x6;\r |
221 | \r |
222 | //\r |
223 | // Add one op-code\r |
224 | //\r |
225 | Private->Hii->UpdateForm (\r |
226 | Private->Hii,\r |
227 | Private->RegisteredHandle,\r |
228 | (EFI_FORM_LABEL) 0x2222,\r |
229 | TRUE,\r |
230 | UpdateData\r |
231 | );\r |
232 | \r |
233 | gBS->FreePool (UpdateData);\r |
234 | gBS->FreePool (OptionList);\r |
235 | break;\r |
236 | \r |
237 | case 0x1234:\r |
238 | //\r |
239 | // Allocate space for creation of Buffer\r |
240 | //\r |
241 | QuestionId = (UINT16) ((UINTN) (&NVStruc.DynamicCheck));\r |
242 | Status = gBS->AllocatePool (\r |
243 | EfiBootServicesData,\r |
244 | 0x1000,\r |
245 | (VOID **) &UpdateData\r |
246 | );\r |
247 | \r |
248 | ZeroMem (UpdateData, 0x1000);\r |
249 | \r |
250 | Location = (UINT8 *) &UpdateData->Data;\r |
251 | \r |
252 | UpdateData->FormSetUpdate = TRUE;\r |
253 | UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) Private->CallbackHandle;\r |
254 | UpdateData->FormUpdate = FALSE;\r |
255 | UpdateData->FormTitle = 0;\r |
256 | UpdateData->DataCount = 2;\r |
257 | \r |
258 | CreateGotoOpCode (\r |
259 | 1,\r |
260 | STR_GOTO_FORM1, // Token value for the Prompt\r |
261 | 0, // Goto Help\r |
262 | 0, // Flags\r |
263 | 0, // Key\r |
264 | &UpdateData->Data // Buffer location to place op-codes\r |
265 | );\r |
266 | \r |
267 | Location = Location + ((EFI_IFR_OP_HEADER *) &UpdateData->Data)->Length;\r |
268 | \r |
269 | CreateCheckBoxOpCode (\r |
270 | QuestionId, // Question ID\r |
271 | 1, // Data width (BOOLEAN = 1)\r |
272 | (UINT16) STRING_TOKEN (STR_CHECK_DYNAMIC_PROMPT), // Token value for the Prompt\r |
273 | (UINT16) STRING_TOKEN (STR_CHECK_DYNAMIC_HELP), // Token value for the Help\r |
274 | EFI_IFR_FLAG_INTERACTIVE, // Flags\r |
275 | 0x1236, // Key\r |
276 | Location // Buffer location to place op-codes\r |
277 | );\r |
278 | \r |
279 | Private->Hii->UpdateForm (\r |
280 | Private->Hii,\r |
281 | Private->RegisteredHandle,\r |
282 | (EFI_FORM_LABEL) 0x1234,\r |
283 | TRUE,\r |
284 | UpdateData\r |
285 | );\r |
286 | \r |
287 | gBS->FreePool (UpdateData);\r |
288 | QuestionId++;\r |
289 | break;\r |
290 | \r |
291 | case 0x1235:\r |
292 | //\r |
293 | // Allocate space for creation of Buffer\r |
294 | //\r |
295 | Status = gBS->AllocatePool (\r |
296 | EfiBootServicesData,\r |
297 | 0x1000,\r |
298 | (VOID **)&UpdateData\r |
299 | );\r |
300 | \r |
301 | ZeroMem (UpdateData, 0x1000);\r |
302 | \r |
303 | //\r |
304 | // Initialize DataPacket with information intended to remove all\r |
305 | // previously created op-codes in the dynamic page\r |
306 | //\r |
307 | UpdateData->FormSetUpdate = FALSE;\r |
308 | UpdateData->FormCallbackHandle = 0;\r |
309 | UpdateData->FormUpdate = FALSE;\r |
310 | UpdateData->FormTitle = 0;\r |
311 | //\r |
312 | // Unlikely to be more than 0xff op-codes in the dynamic page to remove\r |
313 | //\r |
314 | UpdateData->DataCount = 0xff;\r |
315 | UpdateData->Data = NULL;\r |
316 | \r |
317 | //\r |
318 | // Remove all op-codes from dynamic page\r |
319 | //\r |
320 | Private->Hii->UpdateForm (\r |
321 | Private->Hii,\r |
322 | Private->RegisteredHandle,\r |
323 | (EFI_FORM_LABEL) 0x1234, // Label 0x1234\r |
324 | FALSE, // Remove Op-codes (will never remove form/endform)\r |
325 | UpdateData // Significant value is UpdateData->DataCount\r |
326 | );\r |
327 | \r |
328 | UpdateData->FormSetUpdate = FALSE;\r |
329 | UpdateData->FormCallbackHandle = 0;\r |
330 | UpdateData->FormUpdate = FALSE;\r |
331 | UpdateData->FormTitle = 0;\r |
332 | UpdateData->DataCount = 1;\r |
333 | \r |
334 | CreateGotoOpCode (\r |
335 | 1,\r |
336 | STR_GOTO_FORM1, // Token value for the Prompt\r |
337 | 0, // Goto Help\r |
338 | 0, // Flags\r |
339 | 0, // Key\r |
340 | &UpdateData->Data // Buffer location to place op-codes\r |
341 | );\r |
342 | \r |
343 | Private->Hii->UpdateForm (\r |
344 | Private->Hii,\r |
345 | Private->RegisteredHandle,\r |
346 | (EFI_FORM_LABEL) 0x1234,\r |
347 | TRUE,\r |
348 | UpdateData\r |
349 | );\r |
350 | \r |
351 | gBS->FreePool (UpdateData);\r |
352 | break;\r |
353 | \r |
354 | case 0x1236:\r |
355 | //\r |
356 | // If I hit the checkbox, I enter this case statement...\r |
357 | //\r |
358 | //\r |
359 | // Since I am returning an error (for test purposes) I need to pass in the string for the error\r |
360 | // I will allocate space for the return value. If an error occurs (which is the case) I can simply return\r |
361 | // an error and fill in the string parameter, otherwise, I will return information in the DataArray structure.\r |
362 | // The browser will free this packet structure\r |
363 | //\r |
364 | Status = gBS->AllocatePool (\r |
365 | EfiBootServicesData,\r |
366 | sizeof (EFI_HII_CALLBACK_PACKET) + sizeof (SAMPLE_STRING) + 2,\r |
367 | (VOID **) Packet\r |
368 | );\r |
369 | \r |
370 | ZeroMem (*Packet, sizeof (EFI_HII_CALLBACK_PACKET) + sizeof (SAMPLE_STRING) + 2);\r |
371 | \r |
372 | //\r |
373 | // Assign the buffer address to DataPacket\r |
374 | //\r |
375 | DataPacket = *Packet;\r |
376 | \r |
377 | StrCpy (DataPacket->String, (CHAR16 *) SAMPLE_STRING);\r |
378 | return EFI_DEVICE_ERROR;\r |
379 | \r |
380 | case 0x1237:\r |
381 | \r |
382 | Status = gBS->AllocatePool (\r |
383 | EfiBootServicesData,\r |
384 | sizeof (EFI_HII_CALLBACK_PACKET) + 2,\r |
385 | (VOID **) Packet\r |
386 | );\r |
387 | \r |
388 | ZeroMem (*Packet, sizeof (EFI_HII_CALLBACK_PACKET) + 2);\r |
389 | \r |
390 | //\r |
391 | // Assign the buffer address to DataPacket\r |
392 | //\r |
393 | DataPacket = *Packet;\r |
394 | \r |
395 | DataPacket->DataArray.EntryCount = 1;\r |
396 | DataPacket->DataArray.NvRamMap = NULL;\r |
397 | ((EFI_IFR_DATA_ENTRY *) (&DataPacket->DataArray + 1))->Flags = EXIT_REQUIRED;\r |
398 | break;\r |
399 | \r |
400 | case 0x1555:\r |
401 | Value = 0x0001;\r |
402 | UnicodeSPrint (VariableName, 0x80, (CHAR16 *) L"%d", VAR_EQ_TEST_NAME);\r |
403 | \r |
404 | Status = gRT->SetVariable (\r |
405 | VariableName,\r |
406 | &mFormSetGuid,\r |
407 | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r |
408 | 2,\r |
409 | (VOID *) &Value\r |
410 | );\r |
411 | break;\r |
412 | \r |
413 | case 0x1556:\r |
414 | Value = 0x1000;\r |
415 | UnicodeSPrint (VariableName, 0x80, (CHAR16 *) L"%d", VAR_EQ_TEST_NAME);\r |
416 | \r |
417 | Status = gRT->SetVariable (\r |
418 | VariableName,\r |
419 | &mFormSetGuid,\r |
420 | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r |
421 | 2,\r |
422 | (VOID *) &Value\r |
423 | );\r |
424 | break;\r |
425 | \r |
426 | case 0x1557:\r |
427 | Value = 0x0000;\r |
428 | UnicodeSPrint (VariableName, 0x80, (CHAR16 *) L"%d", VAR_EQ_TEST_NAME);\r |
429 | \r |
430 | Status = gRT->SetVariable (\r |
431 | VariableName,\r |
432 | &mFormSetGuid,\r |
433 | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r |
434 | 2,\r |
435 | (VOID *) &Value\r |
436 | );\r |
437 | break;\r |
438 | \r |
439 | default:\r |
440 | break;\r |
441 | }\r |
442 | \r |
443 | return EFI_SUCCESS;\r |
444 | }\r |
445 | \r |
446 | EFI_STATUS\r |
447 | EFIAPI\r |
448 | DriverSampleInit (\r |
449 | IN EFI_HANDLE ImageHandle,\r |
450 | IN EFI_SYSTEM_TABLE *SystemTable\r |
451 | )\r |
452 | {\r |
453 | EFI_STATUS Status;\r |
454 | EFI_HII_PROTOCOL *Hii;\r |
455 | //\r |
456 | // EFI_FORM_BROWSER_PROTOCOL *FormConfig;\r |
457 | //\r |
458 | EFI_HII_PACKAGES *PackageList;\r |
459 | EFI_HII_HANDLE HiiHandle;\r |
460 | STRING_REF TokenToUpdate;\r |
461 | STRING_REF TokenToUpdate2;\r |
462 | STRING_REF TokenToUpdate3;\r |
463 | CHAR16 *NewString;\r |
464 | EFI_HII_UPDATE_DATA *UpdateData;\r |
465 | EFI_CALLBACK_INFO *CallbackInfo;\r |
466 | EFI_HANDLE Handle;\r |
467 | EFI_SCREEN_DESCRIPTOR Screen;\r |
468 | \r |
469 | ZeroMem (&Screen, sizeof (EFI_SCREEN_DESCRIPTOR));\r |
470 | \r |
471 | gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &Screen.RightColumn, &Screen.BottomRow);\r |
472 | \r |
473 | //\r |
474 | // Remove 3 characters from top and bottom\r |
475 | //\r |
476 | Screen.TopRow = 3;\r |
477 | Screen.BottomRow = Screen.BottomRow - 3;\r |
478 | \r |
479 | //\r |
480 | // There should only be one HII protocol\r |
481 | //\r |
482 | Status = gBS->LocateProtocol (\r |
483 | &gEfiHiiProtocolGuid,\r |
484 | NULL,\r |
485 | (VOID **) &Hii\r |
486 | );\r |
487 | if (EFI_ERROR (Status)) {\r |
488 | return Status;;\r |
489 | }\r |
490 | \r |
491 | /*\r |
492 | //\r |
493 | // There should only be one Form Configuration protocol\r |
494 | //\r |
495 | Status = gBS->LocateProtocol (\r |
496 | &gEfiFormBrowserProtocolGuid, \r |
497 | NULL, \r |
498 | &FormConfig\r |
499 | );\r |
500 | if (EFI_ERROR (Status)) {\r |
501 | return Status;;\r |
502 | }\r |
503 | */\r |
504 | Status = gBS->AllocatePool (\r |
505 | EfiBootServicesData,\r |
506 | sizeof (EFI_CALLBACK_INFO),\r |
507 | (VOID **) &CallbackInfo\r |
508 | );\r |
509 | if (EFI_ERROR (Status)) {\r |
510 | return Status;\r |
511 | }\r |
512 | \r |
513 | CallbackInfo->Signature = EFI_CALLBACK_INFO_SIGNATURE;\r |
514 | CallbackInfo->Hii = Hii;\r |
515 | \r |
516 | //\r |
517 | // This example does not implement worker functions for the NV accessor functions. Only a callback evaluator\r |
518 | //\r |
519 | CallbackInfo->DriverCallback.NvRead = NULL;\r |
520 | CallbackInfo->DriverCallback.NvWrite = NULL;\r |
521 | CallbackInfo->DriverCallback.Callback = DriverCallback;\r |
522 | \r |
523 | //\r |
524 | // Install protocol interface\r |
525 | //\r |
526 | Handle = NULL;\r |
527 | Status = gBS->InstallProtocolInterface (\r |
528 | &Handle,\r |
529 | &gEfiFormCallbackProtocolGuid,\r |
530 | EFI_NATIVE_INTERFACE,\r |
531 | &CallbackInfo->DriverCallback\r |
532 | );\r |
533 | \r |
534 | ASSERT_EFI_ERROR (Status);\r |
535 | \r |
536 | CallbackInfo->CallbackHandle = Handle;\r |
537 | \r |
538 | PackageList = PreparePackages (1, &mStringPackGuid, DriverSampleStrings);\r |
539 | Status = Hii->NewPack (Hii, PackageList, &HiiHandle);\r |
540 | gBS->FreePool (PackageList);\r |
541 | \r |
542 | PackageList = PreparePackages (1, &mStringPackGuid, InventoryBin);\r |
543 | Status = Hii->NewPack (Hii, PackageList, &HiiHandle);\r |
544 | gBS->FreePool (PackageList);\r |
545 | \r |
546 | PackageList = PreparePackages (1, &mStringPackGuid, VfrBin);\r |
547 | Status = Hii->NewPack (Hii, PackageList, &HiiHandle);\r |
548 | gBS->FreePool (PackageList);\r |
549 | \r |
550 | CallbackInfo->RegisteredHandle = HiiHandle;\r |
551 | \r |
552 | //\r |
553 | // Very simple example of how one would update a string that is already\r |
554 | // in the HII database\r |
555 | //\r |
556 | TokenToUpdate = (STRING_REF) STR_CPU_STRING2;\r |
557 | NewString = (CHAR16 *) L"700 Mhz";\r |
558 | \r |
559 | Hii->NewString (Hii, NULL, HiiHandle, &TokenToUpdate, NewString);\r |
560 | \r |
561 | //\r |
562 | // Add a string - if 0 will be updated with new Token number\r |
563 | //\r |
564 | TokenToUpdate = (STRING_REF) 0;\r |
565 | \r |
566 | //\r |
567 | // Add a string - if 0 will be updated with new Token number\r |
568 | //\r |
569 | TokenToUpdate2 = (STRING_REF) 0;\r |
570 | \r |
571 | //\r |
572 | // Add a string - if 0 will be updated with new Token number\r |
573 | //\r |
574 | TokenToUpdate3 = (STRING_REF) 0;\r |
575 | \r |
576 | Hii->NewString (Hii, NULL, HiiHandle, &TokenToUpdate, (CHAR16 *) L"Desired Speed");\r |
577 | Hii->NewString (Hii, NULL, HiiHandle, &TokenToUpdate2, (CHAR16 *) L"5 Thz");\r |
578 | Hii->NewString (Hii, NULL, HiiHandle, &TokenToUpdate3, (CHAR16 *) L"This is next year's desired speed - right?");\r |
579 | \r |
580 | //\r |
581 | // Allocate space for creation of Buffer\r |
582 | //\r |
583 | Status = gBS->AllocatePool (\r |
584 | EfiBootServicesData,\r |
585 | 0x1000,\r |
586 | (VOID **) &UpdateData\r |
587 | );\r |
588 | \r |
589 | ZeroMem (UpdateData, 0x1000);\r |
590 | \r |
591 | //\r |
592 | // Flag update pending in FormSet\r |
593 | //\r |
594 | UpdateData->FormSetUpdate = TRUE;\r |
595 | //\r |
596 | // Register CallbackHandle data for FormSet\r |
597 | //\r |
598 | UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackInfo->CallbackHandle;\r |
599 | UpdateData->FormUpdate = FALSE;\r |
600 | UpdateData->FormTitle = 0;\r |
601 | UpdateData->DataCount = 1;\r |
602 | \r |
603 | CreateTextOpCode (TokenToUpdate, TokenToUpdate2, TokenToUpdate3, 0, 0, &UpdateData->Data);\r |
604 | \r |
605 | Hii->UpdateForm (Hii, HiiHandle, (EFI_FORM_LABEL) 100, TRUE, UpdateData);\r |
606 | \r |
607 | gBS->FreePool (UpdateData);\r |
608 | \r |
609 | //\r |
610 | // Example of how to display only the item we sent to HII\r |
611 | //\r |
612 | if (DISPLAY_ONLY_MY_ITEM == 0x0001) {\r |
613 | //\r |
614 | // Have the browser pull out our copy of the data, and only display our data\r |
615 | //\r |
616 | // Status = FormConfig->SendForm (FormConfig, TRUE, HiiHandle, NULL, NULL, NULL, &Screen, NULL);\r |
617 | //\r |
618 | } else {\r |
619 | //\r |
620 | // Have the browser pull out all the data in the HII Database and display it.\r |
621 | //\r |
622 | // Status = FormConfig->SendForm (FormConfig, TRUE, 0, NULL, NULL, NULL, NULL, NULL);\r |
623 | //\r |
624 | }\r |
625 | \r |
626 | if (EFI_ERROR (Status)) {\r |
627 | return Status;\r |
628 | }\r |
629 | \r |
630 | return EFI_SUCCESS;\r |
631 | }\r |