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