TianoCore EDK2 master
Loading...
Searching...
No Matches
BootMaintenance.c
Go to the documentation of this file.
1
10
11#define FRONT_PAGE_KEY_OFFSET 0x4000
12//
13// Boot video resolution and text mode.
14//
15UINT32 mBmmBootHorizontalResolution = 0;
16UINT32 mBmmBootVerticalResolution = 0;
17UINT32 mBmmBootTextModeColumn = 0;
18UINT32 mBmmBootTextModeRow = 0;
19//
20// BIOS setup video resolution and text mode.
21//
22UINT32 mBmmSetupTextModeColumn = 0;
23UINT32 mBmmSetupTextModeRow = 0;
24UINT32 mBmmSetupHorizontalResolution = 0;
25UINT32 mBmmSetupVerticalResolution = 0;
26
27BOOLEAN mBmmModeInitialized = FALSE;
28
29EFI_DEVICE_PATH_PROTOCOL EndDevicePath[] = {
30 {
31 END_DEVICE_PATH_TYPE,
32 END_ENTIRE_DEVICE_PATH_SUBTYPE,
33 {
34 END_DEVICE_PATH_LENGTH,
35 0
36 }
37 }
38};
39
40HII_VENDOR_DEVICE_PATH mBmmHiiVendorDevicePath = {
41 {
42 {
45 {
46 (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
47 (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
48 }
49 },
50 //
51 // {165A028F-0BB2-4b5f-8747-77592E3F6499}
52 //
53 { 0x165a028f, 0xbb2, 0x4b5f, { 0x87, 0x47, 0x77, 0x59, 0x2e, 0x3f, 0x64, 0x99 }
54 }
55 },
56 {
57 END_DEVICE_PATH_TYPE,
58 END_ENTIRE_DEVICE_PATH_SUBTYPE,
59 {
60 (UINT8)(END_DEVICE_PATH_LENGTH),
61 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
62 }
63 }
64};
65
66EFI_GUID mBootMaintGuid = BOOT_MAINT_FORMSET_GUID;
67
68CHAR16 mBootMaintStorageName[] = L"BmmData";
69BMM_CALLBACK_DATA gBootMaintenancePrivate = {
70 BMM_CALLBACK_DATA_SIGNATURE,
71 NULL,
72 NULL,
73 {
77 }
78};
79
80BMM_CALLBACK_DATA *mBmmCallbackInfo = &gBootMaintenancePrivate;
81BOOLEAN mAllMenuInit = FALSE;
82BOOLEAN mFirstEnterBMMForm = FALSE;
83
90VOID
92 IN BMM_CALLBACK_DATA *CallbackData
93 );
94
99VOID
101 VOID
102 );
103
109VOID
111 VOID
112 );
113
126 BOOLEAN IsSetupMode
127 )
128{
129 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
130 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
131 UINTN SizeOfInfo;
133 UINT32 MaxGopMode;
134 UINT32 MaxTextMode;
135 UINT32 ModeNumber;
136 UINT32 NewHorizontalResolution;
137 UINT32 NewVerticalResolution;
138 UINT32 NewColumns;
139 UINT32 NewRows;
140 UINTN HandleCount;
141 EFI_HANDLE *HandleBuffer;
142 EFI_STATUS Status;
143 UINTN Index;
144 UINTN CurrentColumn;
145 UINTN CurrentRow;
146
147 MaxGopMode = 0;
148 MaxTextMode = 0;
149
150 //
151 // Get current video resolution and text mode
152 //
153 Status = gBS->HandleProtocol (
155 &gEfiGraphicsOutputProtocolGuid,
156 (VOID **)&GraphicsOutput
157 );
158 if (EFI_ERROR (Status)) {
159 GraphicsOutput = NULL;
160 }
161
162 Status = gBS->HandleProtocol (
164 &gEfiSimpleTextOutProtocolGuid,
165 (VOID **)&SimpleTextOut
166 );
167 if (EFI_ERROR (Status)) {
168 SimpleTextOut = NULL;
169 }
170
171 if ((GraphicsOutput == NULL) || (SimpleTextOut == NULL)) {
172 return EFI_UNSUPPORTED;
173 }
174
175 if (IsSetupMode) {
176 //
177 // The required resolution and text mode is setup mode.
178 //
179 NewHorizontalResolution = mBmmSetupHorizontalResolution;
180 NewVerticalResolution = mBmmSetupVerticalResolution;
181 NewColumns = mBmmSetupTextModeColumn;
182 NewRows = mBmmSetupTextModeRow;
183 } else {
184 //
185 // The required resolution and text mode is boot mode.
186 //
187 NewHorizontalResolution = mBmmBootHorizontalResolution;
188 NewVerticalResolution = mBmmBootVerticalResolution;
189 NewColumns = mBmmBootTextModeColumn;
190 NewRows = mBmmBootTextModeRow;
191 }
192
193 if (GraphicsOutput != NULL) {
194 MaxGopMode = GraphicsOutput->Mode->MaxMode;
195 }
196
197 if (SimpleTextOut != NULL) {
198 MaxTextMode = SimpleTextOut->Mode->MaxMode;
199 }
200
201 //
202 // 1. If current video resolution is same with required video resolution,
203 // video resolution need not be changed.
204 // 1.1. If current text mode is same with required text mode, text mode need not be changed.
205 // 1.2. If current text mode is different from required text mode, text mode need be changed.
206 // 2. If current video resolution is different from required video resolution, we need restart whole console drivers.
207 //
208 for (ModeNumber = 0; ModeNumber < MaxGopMode; ModeNumber++) {
209 Status = GraphicsOutput->QueryMode (
210 GraphicsOutput,
211 ModeNumber,
212 &SizeOfInfo,
213 &Info
214 );
215 if (!EFI_ERROR (Status)) {
216 if ((Info->HorizontalResolution == NewHorizontalResolution) &&
217 (Info->VerticalResolution == NewVerticalResolution))
218 {
219 if ((GraphicsOutput->Mode->Info->HorizontalResolution == NewHorizontalResolution) &&
220 (GraphicsOutput->Mode->Info->VerticalResolution == NewVerticalResolution))
221 {
222 //
223 // Current resolution is same with required resolution, check if text mode need be set
224 //
225 Status = SimpleTextOut->QueryMode (SimpleTextOut, SimpleTextOut->Mode->Mode, &CurrentColumn, &CurrentRow);
226 ASSERT_EFI_ERROR (Status);
227 if ((CurrentColumn == NewColumns) && (CurrentRow == NewRows)) {
228 //
229 // If current text mode is same with required text mode. Do nothing
230 //
231 FreePool (Info);
232 return EFI_SUCCESS;
233 } else {
234 //
235 // If current text mode is different from required text mode. Set new video mode
236 //
237 for (Index = 0; Index < MaxTextMode; Index++) {
238 Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow);
239 if (!EFI_ERROR (Status)) {
240 if ((CurrentColumn == NewColumns) && (CurrentRow == NewRows)) {
241 //
242 // Required text mode is supported, set it.
243 //
244 Status = SimpleTextOut->SetMode (SimpleTextOut, Index);
245 ASSERT_EFI_ERROR (Status);
246 //
247 // Update text mode PCD.
248 //
249 Status = PcdSet32S (PcdConOutColumn, mBmmSetupTextModeColumn);
250 ASSERT_EFI_ERROR (Status);
251 Status = PcdSet32S (PcdConOutRow, mBmmSetupTextModeRow);
252 ASSERT_EFI_ERROR (Status);
253 FreePool (Info);
254 return EFI_SUCCESS;
255 }
256 }
257 }
258
259 if (Index == MaxTextMode) {
260 //
261 // If required text mode is not supported, return error.
262 //
263 FreePool (Info);
264 return EFI_UNSUPPORTED;
265 }
266 }
267 } else {
268 //
269 // If current video resolution is not same with the new one, set new video resolution.
270 // In this case, the driver which produces simple text out need be restarted.
271 //
272 Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);
273 if (!EFI_ERROR (Status)) {
274 FreePool (Info);
275 break;
276 }
277 }
278 }
279
280 FreePool (Info);
281 }
282 }
283
284 if (ModeNumber == MaxGopMode) {
285 //
286 // If the resolution is not supported, return error.
287 //
288 return EFI_UNSUPPORTED;
289 }
290
291 //
292 // Set PCD to Inform GraphicsConsole to change video resolution.
293 // Set PCD to Inform Consplitter to change text mode.
294 //
295 Status = PcdSet32S (PcdVideoHorizontalResolution, NewHorizontalResolution);
296 ASSERT_EFI_ERROR (Status);
297 Status = PcdSet32S (PcdVideoVerticalResolution, NewVerticalResolution);
298 ASSERT_EFI_ERROR (Status);
299 Status = PcdSet32S (PcdConOutColumn, NewColumns);
300 ASSERT_EFI_ERROR (Status);
301 Status = PcdSet32S (PcdConOutRow, NewRows);
302 ASSERT_EFI_ERROR (Status);
303
304 //
305 // Video mode is changed, so restart graphics console driver and higher level driver.
306 // Reconnect graphics console driver and higher level driver.
307 // Locate all the handles with GOP protocol and reconnect it.
308 //
309 Status = gBS->LocateHandleBuffer (
311 &gEfiSimpleTextOutProtocolGuid,
312 NULL,
313 &HandleCount,
314 &HandleBuffer
315 );
316 if (!EFI_ERROR (Status)) {
317 for (Index = 0; Index < HandleCount; Index++) {
318 gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
319 }
320
321 for (Index = 0; Index < HandleCount; Index++) {
322 gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
323 }
324
325 if (HandleBuffer != NULL) {
326 FreePool (HandleBuffer);
327 }
328 }
329
330 return EFI_SUCCESS;
331}
332
341CHAR16 *
344 )
345{
346 EFI_STATUS Status;
347 CHAR16 *ToText;
349
350 if (DevPath == NULL) {
351 return NULL;
352 }
353
354 Status = gBS->LocateProtocol (
355 &gEfiDevicePathToTextProtocolGuid,
356 NULL,
357 (VOID **)&DevPathToText
358 );
359 ASSERT_EFI_ERROR (Status);
360 ToText = DevPathToText->ConvertDevicePathToText (
361 DevPath,
362 FALSE,
363 TRUE
364 );
365 ASSERT (ToText != NULL);
366 return ToText;
367}
368
378CHAR16 *
380 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
381 )
382{
383 CHAR16 *String;
384 CHAR16 *MatchString;
385 CHAR16 *LastMatch;
386 CHAR16 *FileName;
387 UINTN Length;
388
389 ASSERT (DevicePath != NULL);
390
391 String = UiDevicePathToStr (DevicePath);
392 MatchString = String;
393 LastMatch = String;
394 FileName = NULL;
395
396 while (MatchString != NULL) {
397 LastMatch = MatchString + 1;
398 MatchString = StrStr (LastMatch, L"\\");
399 }
400
401 Length = StrLen (LastMatch);
402 FileName = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), LastMatch);
403 if (FileName != NULL) {
404 *(FileName + Length) = 0;
405 }
406
407 FreePool (String);
408
409 return FileName;
410}
411
421CHAR16 *
423 IN EFI_HII_HANDLE Handle
424 )
425{
426 EFI_STATUS Status;
427 EFI_HANDLE DriverHandle;
428
429 ASSERT (Handle != NULL);
430
431 if (Handle == NULL) {
432 return NULL;
433 }
434
435 Status = gHiiDatabase->GetPackageListHandle (gHiiDatabase, Handle, &DriverHandle);
436 if (EFI_ERROR (Status)) {
437 return NULL;
438 }
439
440 //
441 // Get device path string.
442 //
444}
445
453VOID
455 IN EFI_STRING ConfigString
456 )
457{
458 EFI_STRING String;
459 BOOLEAN Lower;
460
461 ASSERT (ConfigString != NULL);
462
463 //
464 // Convert all hex digits in range [A-F] in the configuration header to [a-f]
465 //
466 for (String = ConfigString, Lower = FALSE; *String != L'\0'; String++) {
467 if (*String == L'=') {
468 Lower = TRUE;
469 } else if (*String == L'&') {
470 Lower = FALSE;
471 } else if (Lower && (*String >= L'A') && (*String <= L'F')) {
472 *String = (CHAR16)(*String - L'A' + L'a');
473 }
474 }
475}
476
484EFI_STRING
486 IN UINTN Offset,
487 IN EFI_STRING Configuration
488 )
489{
490 UINTN Length;
491 EFI_STRING StringPtr;
492 EFI_STRING ReturnString;
493
494 StringPtr = NULL;
495 ReturnString = NULL;
496
497 //
498 // &OFFSET=XXXX followed by a Null-terminator.
499 // Length = StrLen (L"&OFFSET=") + 4 + 1
500 //
501 Length = StrLen (L"&OFFSET=") + 4 + 1;
502
503 StringPtr = AllocateZeroPool (Length * sizeof (CHAR16));
504
505 if (StringPtr == NULL) {
506 return NULL;
507 }
508
510 StringPtr,
511 (8 + 4 + 1) * sizeof (CHAR16),
512 L"&OFFSET=%04x",
513 Offset
514 );
515
516 ReturnString = StrStr (Configuration, StringPtr);
517
518 if (ReturnString == NULL) {
519 //
520 // If doesn't find the string in Configuration, convert the string to lower case then search again.
521 //
522 HiiToLower (StringPtr);
523 ReturnString = StrStr (Configuration, StringPtr);
524 }
525
526 FreePool (StringPtr);
527
528 return ReturnString;
529}
530
537VOID
539 IN BMM_FAKE_NV_DATA *BmmData
540 )
541{
542 UINT16 Index;
543 BM_TERMINAL_CONTEXT *NewTerminalContext;
544 BM_MENU_ENTRY *NewMenuEntry;
545
546 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
547 NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
548 ASSERT (NewMenuEntry != NULL);
549 NewTerminalContext = (BM_TERMINAL_CONTEXT *)NewMenuEntry->VariableContext;
550 NewTerminalContext->BaudRateIndex = BmmData->COMBaudRate[Index];
551 ASSERT (BmmData->COMBaudRate[Index] < (ARRAY_SIZE (BaudRateList)));
552 NewTerminalContext->BaudRate = BaudRateList[BmmData->COMBaudRate[Index]].Value;
553 NewTerminalContext->DataBitsIndex = BmmData->COMDataRate[Index];
554 ASSERT (BmmData->COMDataRate[Index] < (ARRAY_SIZE (DataBitsList)));
555 NewTerminalContext->DataBits = (UINT8)DataBitsList[BmmData->COMDataRate[Index]].Value;
556 NewTerminalContext->StopBitsIndex = BmmData->COMStopBits[Index];
557 ASSERT (BmmData->COMStopBits[Index] < (ARRAY_SIZE (StopBitsList)));
558 NewTerminalContext->StopBits = (UINT8)StopBitsList[BmmData->COMStopBits[Index]].Value;
559 NewTerminalContext->ParityIndex = BmmData->COMParity[Index];
560 ASSERT (BmmData->COMParity[Index] < (ARRAY_SIZE (ParityList)));
561 NewTerminalContext->Parity = (UINT8)ParityList[BmmData->COMParity[Index]].Value;
562 NewTerminalContext->TerminalType = BmmData->COMTerminalType[Index];
563 NewTerminalContext->FlowControl = BmmData->COMFlowControl[Index];
565 NewTerminalContext->DevicePath,
566 FALSE
567 );
568 }
569}
570
578VOID
580 IN CHAR16 *ConsoleName,
581 IN BMM_FAKE_NV_DATA *BmmData
582 )
583{
584 UINT16 Index;
585 BM_CONSOLE_CONTEXT *NewConsoleContext;
586 BM_TERMINAL_CONTEXT *NewTerminalContext;
587 BM_MENU_ENTRY *NewMenuEntry;
588
589 if (StrCmp (ConsoleName, L"ConIn") == 0) {
590 for (Index = 0; Index < ConsoleInpMenu.MenuNumber; Index++) {
591 NewMenuEntry = BOpt_GetMenuEntry (&ConsoleInpMenu, Index);
592 NewConsoleContext = (BM_CONSOLE_CONTEXT *)NewMenuEntry->VariableContext;
593 ASSERT (Index < MAX_MENU_NUMBER);
594 NewConsoleContext->IsActive = BmmData->ConsoleInCheck[Index];
595 }
596
597 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
598 NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
599 NewTerminalContext = (BM_TERMINAL_CONTEXT *)NewMenuEntry->VariableContext;
600 ASSERT (Index + ConsoleInpMenu.MenuNumber < MAX_MENU_NUMBER);
601 NewTerminalContext->IsConIn = BmmData->ConsoleInCheck[Index + ConsoleInpMenu.MenuNumber];
602 }
603 }
604
605 if (StrCmp (ConsoleName, L"ConOut") == 0) {
606 for (Index = 0; Index < ConsoleOutMenu.MenuNumber; Index++) {
607 NewMenuEntry = BOpt_GetMenuEntry (&ConsoleOutMenu, Index);
608 NewConsoleContext = (BM_CONSOLE_CONTEXT *)NewMenuEntry->VariableContext;
609 ASSERT (Index < MAX_MENU_NUMBER);
610 NewConsoleContext->IsActive = BmmData->ConsoleOutCheck[Index];
611 }
612
613 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
614 NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
615 NewTerminalContext = (BM_TERMINAL_CONTEXT *)NewMenuEntry->VariableContext;
616 ASSERT (Index + ConsoleOutMenu.MenuNumber < MAX_MENU_NUMBER);
617 NewTerminalContext->IsConOut = BmmData->ConsoleOutCheck[Index + ConsoleOutMenu.MenuNumber];
618 }
619 }
620
621 if (StrCmp (ConsoleName, L"ErrOut") == 0) {
622 for (Index = 0; Index < ConsoleErrMenu.MenuNumber; Index++) {
623 NewMenuEntry = BOpt_GetMenuEntry (&ConsoleErrMenu, Index);
624 NewConsoleContext = (BM_CONSOLE_CONTEXT *)NewMenuEntry->VariableContext;
625 ASSERT (Index < MAX_MENU_NUMBER);
626 NewConsoleContext->IsActive = BmmData->ConsoleErrCheck[Index];
627 }
628
629 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
630 NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
631 NewTerminalContext = (BM_TERMINAL_CONTEXT *)NewMenuEntry->VariableContext;
632 ASSERT (Index + ConsoleErrMenu.MenuNumber < MAX_MENU_NUMBER);
633 NewTerminalContext->IsStdErr = BmmData->ConsoleErrCheck[Index + ConsoleErrMenu.MenuNumber];
634 }
635 }
636}
637
660EFIAPI
663 IN CONST EFI_STRING Request,
664 OUT EFI_STRING *Progress,
665 OUT EFI_STRING *Results
666 )
667{
668 EFI_STATUS Status;
669 UINTN BufferSize;
670 BMM_CALLBACK_DATA *Private;
671 EFI_STRING ConfigRequestHdr;
672 EFI_STRING ConfigRequest;
673 BOOLEAN AllocatedRequest;
674 UINTN Size;
675
676 if ((Progress == NULL) || (Results == NULL)) {
677 return EFI_INVALID_PARAMETER;
678 }
679
680 *Progress = Request;
681 if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &mBootMaintGuid, mBootMaintStorageName)) {
682 return EFI_NOT_FOUND;
683 }
684
685 ConfigRequestHdr = NULL;
686 ConfigRequest = NULL;
687 AllocatedRequest = FALSE;
688 Size = 0;
689
690 Private = BMM_CALLBACK_DATA_FROM_THIS (This);
691 //
692 // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
693 //
694 BufferSize = sizeof (BMM_FAKE_NV_DATA);
695 ConfigRequest = Request;
696 if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
697 //
698 // Request has no request element, construct full request string.
699 // Allocate and fill a buffer large enough to hold the <ConfigHdr> template
700 // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
701 //
702 ConfigRequestHdr = HiiConstructConfigHdr (&mBootMaintGuid, mBootMaintStorageName, Private->BmmDriverHandle);
703 Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
704 ConfigRequest = AllocateZeroPool (Size);
705 ASSERT (ConfigRequest != NULL);
706 AllocatedRequest = TRUE;
707 UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
708 FreePool (ConfigRequestHdr);
709 }
710
711 Status = gHiiConfigRouting->BlockToConfig (
713 ConfigRequest,
714 (UINT8 *)&Private->BmmFakeNvData,
715 BufferSize,
716 Results,
717 Progress
718 );
719 //
720 // Free the allocated config request string.
721 //
722 if (AllocatedRequest) {
723 FreePool (ConfigRequest);
724 ConfigRequest = NULL;
725 }
726
727 //
728 // Set Progress string to the original request string.
729 //
730 if (Request == NULL) {
731 *Progress = NULL;
732 } else if (StrStr (Request, L"OFFSET") == NULL) {
733 *Progress = Request + StrLen (Request);
734 }
735
736 return Status;
737}
738
773EFIAPI
776 IN CONST EFI_STRING Configuration,
777 OUT EFI_STRING *Progress
778 )
779{
780 EFI_STATUS Status;
781 UINTN BufferSize;
782 EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting;
783 BMM_FAKE_NV_DATA *NewBmmData;
784 BMM_FAKE_NV_DATA *OldBmmData;
785 BM_MENU_ENTRY *NewMenuEntry;
786 BM_LOAD_CONTEXT *NewLoadContext;
787 UINT16 Index;
788 BOOLEAN TerminalAttChange;
789 BMM_CALLBACK_DATA *Private;
790 UINTN Offset;
791
792 if (Progress == NULL) {
793 return EFI_INVALID_PARAMETER;
794 }
795
796 *Progress = Configuration;
797
798 if (Configuration == NULL) {
799 return EFI_INVALID_PARAMETER;
800 }
801
802 //
803 // Check routing data in <ConfigHdr>.
804 // Note: there is no name for Name/Value storage, only GUID will be checked
805 //
806 if (!HiiIsConfigHdrMatch (Configuration, &mBootMaintGuid, mBootMaintStorageName)) {
807 return EFI_NOT_FOUND;
808 }
809
810 Status = gBS->LocateProtocol (
811 &gEfiHiiConfigRoutingProtocolGuid,
812 NULL,
813 (VOID **)&ConfigRouting
814 );
815 if (EFI_ERROR (Status)) {
816 return Status;
817 }
818
819 Private = BMM_CALLBACK_DATA_FROM_THIS (This);
820 //
821 // Get Buffer Storage data from EFI variable
822 //
823 BufferSize = sizeof (BMM_FAKE_NV_DATA);
824 OldBmmData = &Private->BmmOldFakeNVData;
825 NewBmmData = &Private->BmmFakeNvData;
826 Offset = 0;
827 //
828 // Convert <ConfigResp> to buffer data by helper function ConfigToBlock()
829 //
830 Status = ConfigRouting->ConfigToBlock (
831 ConfigRouting,
832 Configuration,
833 (UINT8 *)NewBmmData,
834 &BufferSize,
835 Progress
836 );
837 ASSERT_EFI_ERROR (Status);
838 //
839 // Compare new and old BMM configuration data and only do action for modified item to
840 // avoid setting unnecessary non-volatile variable
841 //
842
843 //
844 // Check data which located in BMM main page and save the settings if need
845 //
846 if (CompareMem (&NewBmmData->BootNext, &OldBmmData->BootNext, sizeof (NewBmmData->BootNext)) != 0) {
847 Status = Var_UpdateBootNext (Private);
848 if (EFI_ERROR (Status)) {
849 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, BootNext);
850 goto Exit;
851 }
852 }
853
854 //
855 // Check data which located in Boot Options Menu and save the settings if need
856 //
857 if (CompareMem (NewBmmData->BootOptionDel, OldBmmData->BootOptionDel, sizeof (NewBmmData->BootOptionDel)) != 0) {
858 for (Index = 0;
859 ((Index < BootOptionMenu.MenuNumber) && (Index < (sizeof (NewBmmData->BootOptionDel) / sizeof (NewBmmData->BootOptionDel[0]))));
860 Index++)
861 {
862 NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
863 NewLoadContext = (BM_LOAD_CONTEXT *)NewMenuEntry->VariableContext;
864 NewLoadContext->Deleted = NewBmmData->BootOptionDel[Index];
865 NewBmmData->BootOptionDel[Index] = FALSE;
866 NewBmmData->BootOptionDelMark[Index] = FALSE;
867 }
868
869 Status = Var_DelBootOption ();
870 if (EFI_ERROR (Status)) {
871 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, BootOptionDel);
872 goto Exit;
873 }
874 }
875
876 if (CompareMem (NewBmmData->BootOptionOrder, OldBmmData->BootOptionOrder, sizeof (NewBmmData->BootOptionOrder)) != 0) {
877 Status = Var_UpdateBootOrder (Private);
878 if (EFI_ERROR (Status)) {
879 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, BootOptionOrder);
880 goto Exit;
881 }
882 }
883
884 if (CompareMem (&NewBmmData->BootTimeOut, &OldBmmData->BootTimeOut, sizeof (NewBmmData->BootTimeOut)) != 0) {
885 Status = gRT->SetVariable (
886 L"Timeout",
887 &gEfiGlobalVariableGuid,
888 EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
889 sizeof (UINT16),
890 &(NewBmmData->BootTimeOut)
891 );
892 if (EFI_ERROR (Status)) {
893 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, BootTimeOut);
894 goto Exit;
895 }
896
897 Private->BmmOldFakeNVData.BootTimeOut = NewBmmData->BootTimeOut;
898 }
899
900 //
901 // Check data which located in Driver Options Menu and save the settings if need
902 //
903 if (CompareMem (NewBmmData->DriverOptionDel, OldBmmData->DriverOptionDel, sizeof (NewBmmData->DriverOptionDel)) != 0) {
904 for (Index = 0;
905 ((Index < DriverOptionMenu.MenuNumber) && (Index < (sizeof (NewBmmData->DriverOptionDel) / sizeof (NewBmmData->DriverOptionDel[0]))));
906 Index++)
907 {
908 NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
909 NewLoadContext = (BM_LOAD_CONTEXT *)NewMenuEntry->VariableContext;
910 NewLoadContext->Deleted = NewBmmData->DriverOptionDel[Index];
911 NewBmmData->DriverOptionDel[Index] = FALSE;
912 NewBmmData->DriverOptionDelMark[Index] = FALSE;
913 }
914
915 Status = Var_DelDriverOption ();
916 if (EFI_ERROR (Status)) {
917 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, DriverOptionDel);
918 goto Exit;
919 }
920 }
921
922 if (CompareMem (NewBmmData->DriverOptionOrder, OldBmmData->DriverOptionOrder, sizeof (NewBmmData->DriverOptionOrder)) != 0) {
923 Status = Var_UpdateDriverOrder (Private);
924 if (EFI_ERROR (Status)) {
925 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, DriverOptionOrder);
926 goto Exit;
927 }
928 }
929
930 if (CompareMem (&NewBmmData->ConsoleOutMode, &OldBmmData->ConsoleOutMode, sizeof (NewBmmData->ConsoleOutMode)) != 0) {
931 Status = Var_UpdateConMode (Private);
932 if (EFI_ERROR (Status)) {
933 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, ConsoleOutMode);
934 goto Exit;
935 }
936 }
937
938 TerminalAttChange = FALSE;
939 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
940 //
941 // only need update modified items
942 //
943 if ((CompareMem (&NewBmmData->COMBaudRate[Index], &OldBmmData->COMBaudRate[Index], sizeof (NewBmmData->COMBaudRate[Index])) == 0) &&
944 (CompareMem (&NewBmmData->COMDataRate[Index], &OldBmmData->COMDataRate[Index], sizeof (NewBmmData->COMDataRate[Index])) == 0) &&
945 (CompareMem (&NewBmmData->COMStopBits[Index], &OldBmmData->COMStopBits[Index], sizeof (NewBmmData->COMStopBits[Index])) == 0) &&
946 (CompareMem (&NewBmmData->COMParity[Index], &OldBmmData->COMParity[Index], sizeof (NewBmmData->COMParity[Index])) == 0) &&
947 (CompareMem (&NewBmmData->COMTerminalType[Index], &OldBmmData->COMTerminalType[Index], sizeof (NewBmmData->COMTerminalType[Index])) == 0) &&
948 (CompareMem (&NewBmmData->COMFlowControl[Index], &OldBmmData->COMFlowControl[Index], sizeof (NewBmmData->COMFlowControl[Index])) == 0))
949 {
950 continue;
951 }
952
953 TerminalAttChange = TRUE;
954 }
955
956 if (TerminalAttChange) {
957 if (CompareMem (&NewBmmData->COMBaudRate[Index], &OldBmmData->COMBaudRate[Index], sizeof (NewBmmData->COMBaudRate[Index])) != 0) {
958 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, COMBaudRate);
959 } else if (CompareMem (&NewBmmData->COMDataRate[Index], &OldBmmData->COMDataRate[Index], sizeof (NewBmmData->COMDataRate[Index])) != 0) {
960 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, COMDataRate);
961 } else if (CompareMem (&NewBmmData->COMStopBits[Index], &OldBmmData->COMStopBits[Index], sizeof (NewBmmData->COMStopBits[Index])) != 0) {
962 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, COMStopBits);
963 } else if (CompareMem (&NewBmmData->COMParity[Index], &OldBmmData->COMParity[Index], sizeof (NewBmmData->COMParity[Index])) != 0) {
964 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, COMParity);
965 } else if (CompareMem (&NewBmmData->COMTerminalType[Index], &OldBmmData->COMTerminalType[Index], sizeof (NewBmmData->COMTerminalType[Index])) != 0) {
966 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, COMTerminalType);
967 } else if (CompareMem (&NewBmmData->COMFlowControl[Index], &OldBmmData->COMFlowControl[Index], sizeof (NewBmmData->COMFlowControl[Index])) != 0) {
968 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, COMFlowControl);
969 }
970
971 Status = Var_UpdateConsoleInpOption ();
972 if (EFI_ERROR (Status)) {
973 goto Exit;
974 }
975
976 Status = Var_UpdateConsoleOutOption ();
977 if (EFI_ERROR (Status)) {
978 goto Exit;
979 }
980
981 Status = Var_UpdateErrorOutOption ();
982 if (EFI_ERROR (Status)) {
983 goto Exit;
984 }
985 }
986
987 //
988 // Check data which located in Console Options Menu and save the settings if need
989 //
990 if (CompareMem (NewBmmData->ConsoleInCheck, OldBmmData->ConsoleInCheck, sizeof (NewBmmData->ConsoleInCheck)) != 0) {
991 Status = Var_UpdateConsoleInpOption ();
992 if (EFI_ERROR (Status)) {
993 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, ConsoleInCheck);
994 goto Exit;
995 }
996 }
997
998 if (CompareMem (NewBmmData->ConsoleOutCheck, OldBmmData->ConsoleOutCheck, sizeof (NewBmmData->ConsoleOutCheck)) != 0) {
999 Status = Var_UpdateConsoleOutOption ();
1000 if (EFI_ERROR (Status)) {
1001 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, ConsoleOutCheck);
1002 goto Exit;
1003 }
1004 }
1005
1006 if (CompareMem (NewBmmData->ConsoleErrCheck, OldBmmData->ConsoleErrCheck, sizeof (NewBmmData->ConsoleErrCheck)) != 0) {
1007 Status = Var_UpdateErrorOutOption ();
1008 if (EFI_ERROR (Status)) {
1009 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, ConsoleErrCheck);
1010 goto Exit;
1011 }
1012 }
1013
1014 if ((CompareMem (NewBmmData->BootDescriptionData, OldBmmData->BootDescriptionData, sizeof (NewBmmData->BootDescriptionData)) != 0) ||
1015 (CompareMem (NewBmmData->BootOptionalData, OldBmmData->BootOptionalData, sizeof (NewBmmData->BootOptionalData)) != 0))
1016 {
1017 Status = Var_UpdateBootOption (Private);
1018 NewBmmData->BootOptionChanged = FALSE;
1019 if (EFI_ERROR (Status)) {
1020 if (CompareMem (NewBmmData->BootDescriptionData, OldBmmData->BootDescriptionData, sizeof (NewBmmData->BootDescriptionData)) != 0) {
1021 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, BootDescriptionData);
1022 } else {
1023 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, BootOptionalData);
1024 }
1025
1026 goto Exit;
1027 }
1028
1029 BOpt_GetBootOptions (Private);
1030 }
1031
1032 if ((CompareMem (NewBmmData->DriverDescriptionData, OldBmmData->DriverDescriptionData, sizeof (NewBmmData->DriverDescriptionData)) != 0) ||
1033 (CompareMem (NewBmmData->DriverOptionalData, OldBmmData->DriverOptionalData, sizeof (NewBmmData->DriverOptionalData)) != 0))
1034 {
1035 Status = Var_UpdateDriverOption (
1036 Private,
1037 Private->BmmHiiHandle,
1038 NewBmmData->DriverDescriptionData,
1039 NewBmmData->DriverOptionalData,
1040 NewBmmData->ForceReconnect
1041 );
1042 NewBmmData->DriverOptionChanged = FALSE;
1043 NewBmmData->ForceReconnect = TRUE;
1044 if (EFI_ERROR (Status)) {
1045 if (CompareMem (NewBmmData->DriverDescriptionData, OldBmmData->DriverDescriptionData, sizeof (NewBmmData->DriverDescriptionData)) != 0) {
1046 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, DriverDescriptionData);
1047 } else {
1048 Offset = OFFSET_OF (BMM_FAKE_NV_DATA, DriverOptionalData);
1049 }
1050
1051 goto Exit;
1052 }
1053
1054 BOpt_GetDriverOptions (Private);
1055 }
1056
1057 //
1058 // After user do the save action, need to update OldBmmData.
1059 //
1060 CopyMem (OldBmmData, NewBmmData, sizeof (BMM_FAKE_NV_DATA));
1061
1062 return EFI_SUCCESS;
1063
1064Exit:
1065 //
1066 // Fail to save the data, update the progress string.
1067 //
1068 *Progress = UpdateProgress (Offset, Configuration);
1069 if (Status == EFI_OUT_OF_RESOURCES) {
1070 return Status;
1071 } else {
1072 return EFI_NOT_FOUND;
1073 }
1074}
1075
1095EFIAPI
1098 IN EFI_BROWSER_ACTION Action,
1099 IN EFI_QUESTION_ID QuestionId,
1100 IN UINT8 Type,
1101 IN EFI_IFR_TYPE_VALUE *Value,
1102 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
1103 )
1104{
1105 BMM_CALLBACK_DATA *Private;
1106 BM_MENU_ENTRY *NewMenuEntry;
1107 BMM_FAKE_NV_DATA *CurrentFakeNVMap;
1108 BMM_FAKE_NV_DATA *OldFakeNVMap;
1109 UINTN Index;
1111
1112 if ((Action != EFI_BROWSER_ACTION_CHANGING) && (Action != EFI_BROWSER_ACTION_CHANGED) && (Action != EFI_BROWSER_ACTION_FORM_OPEN)) {
1113 //
1114 // Do nothing for other UEFI Action. Only do call back when data is changed or the form is open.
1115 //
1116 return EFI_UNSUPPORTED;
1117 }
1118
1119 Private = BMM_CALLBACK_DATA_FROM_THIS (This);
1120
1121 if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
1122 if (QuestionId == KEY_VALUE_TRIGGER_FORM_OPEN_ACTION) {
1123 if (!mFirstEnterBMMForm) {
1124 //
1125 // BMMUiLib depends on LegacyUi library to show legacy menus.
1126 // If we want to show Legacy menus correctly in BMM page,
1127 // we must do it after the LegacyUi library has already been initialized.
1128 // Opening the BMM form is the appropriate time that the LegacyUi library has already been initialized.
1129 // So we do the tasks which are related to legacy menus here.
1130 // 1. Update the menus (including legacy munu) show in BootMiantenanceManager page.
1131 // 2. Re-scan the BootOption menus (including the legacy boot option).
1132 //
1133 CustomizeMenus ();
1135 BOpt_GetBootOptions (Private);
1136 mFirstEnterBMMForm = TRUE;
1137 }
1138 }
1139 }
1140
1141 //
1142 // Retrieve uncommitted data from Form Browser
1143 //
1144 CurrentFakeNVMap = &Private->BmmFakeNvData;
1145 OldFakeNVMap = &Private->BmmOldFakeNVData;
1146 HiiGetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *)CurrentFakeNVMap);
1147
1148 if (Action == EFI_BROWSER_ACTION_CHANGING) {
1149 if (Value == NULL) {
1150 return EFI_INVALID_PARAMETER;
1151 }
1152
1153 UpdatePageId (Private, QuestionId);
1154
1155 if (QuestionId < FILE_OPTION_OFFSET) {
1156 if (QuestionId < CONFIG_OPTION_OFFSET) {
1157 switch (QuestionId) {
1158 case FORM_BOOT_ADD_ID:
1159 // Leave BMM and enter FileExplorer.
1160 ChooseFile (NULL, L".efi", CreateBootOptionFromFile, &File);
1161 break;
1162
1163 case FORM_DRV_ADD_FILE_ID:
1164 // Leave BMM and enter FileExplorer.
1165 ChooseFile (NULL, L".efi", CreateDriverOptionFromFile, &File);
1166 break;
1167
1168 case FORM_DRV_ADD_HANDLE_ID:
1169 CleanUpPage (FORM_DRV_ADD_HANDLE_ID, Private);
1170 UpdateDrvAddHandlePage (Private);
1171 break;
1172
1173 case FORM_BOOT_DEL_ID:
1174 CleanUpPage (FORM_BOOT_DEL_ID, Private);
1175 UpdateBootDelPage (Private);
1176 break;
1177
1178 case FORM_BOOT_CHG_ID:
1179 case FORM_DRV_CHG_ID:
1180 UpdatePageBody (QuestionId, Private);
1181 break;
1182
1183 case FORM_DRV_DEL_ID:
1184 CleanUpPage (FORM_DRV_DEL_ID, Private);
1185 UpdateDrvDelPage (Private);
1186 break;
1187
1188 case FORM_CON_IN_ID:
1189 case FORM_CON_OUT_ID:
1190 case FORM_CON_ERR_ID:
1191 UpdatePageBody (QuestionId, Private);
1192 break;
1193
1194 case FORM_CON_MODE_ID:
1195 CleanUpPage (FORM_CON_MODE_ID, Private);
1196 UpdateConModePage (Private);
1197 break;
1198
1199 case FORM_CON_COM_ID:
1200 CleanUpPage (FORM_CON_COM_ID, Private);
1201 UpdateConCOMPage (Private);
1202 break;
1203
1204 default:
1205 break;
1206 }
1207 } else if ((QuestionId >= TERMINAL_OPTION_OFFSET) && (QuestionId < CONSOLE_OPTION_OFFSET)) {
1208 Index = (UINT16)(QuestionId - TERMINAL_OPTION_OFFSET);
1209 Private->CurrentTerminal = Index;
1210
1211 CleanUpPage (FORM_CON_COM_SETUP_ID, Private);
1212 UpdateTerminalPage (Private);
1213 } else if (QuestionId >= HANDLE_OPTION_OFFSET) {
1214 Index = (UINT16)(QuestionId - HANDLE_OPTION_OFFSET);
1215
1216 NewMenuEntry = BOpt_GetMenuEntry (&DriverMenu, Index);
1217 ASSERT (NewMenuEntry != NULL);
1218 Private->HandleContext = (BM_HANDLE_CONTEXT *)NewMenuEntry->VariableContext;
1219
1220 CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID, Private);
1221
1222 Private->MenuEntry = NewMenuEntry;
1223 Private->LoadContext->FilePathList = Private->HandleContext->DevicePath;
1224
1226 }
1227 }
1228
1229 if (QuestionId == KEY_VALUE_BOOT_FROM_FILE) {
1230 // Leave BMM and enter FileExplorer.
1231 ChooseFile (NULL, L".efi", BootFromFile, &File);
1232 }
1233 } else if (Action == EFI_BROWSER_ACTION_CHANGED) {
1234 if ((Value == NULL) || (ActionRequest == NULL)) {
1235 return EFI_INVALID_PARAMETER;
1236 }
1237
1238 if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_BOOT) {
1239 CleanUselessBeforeSubmit (Private);
1240 CurrentFakeNVMap->BootOptionChanged = FALSE;
1241 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
1242 } else if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_DRIVER) {
1243 CleanUselessBeforeSubmit (Private);
1244 CurrentFakeNVMap->DriverOptionChanged = FALSE;
1245 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
1246 } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) {
1247 //
1248 // Discard changes and exit formset
1249 //
1250 ZeroMem (CurrentFakeNVMap->DriverOptionalData, sizeof (CurrentFakeNVMap->DriverOptionalData));
1251 ZeroMem (CurrentFakeNVMap->BootDescriptionData, sizeof (CurrentFakeNVMap->BootDescriptionData));
1252 ZeroMem (OldFakeNVMap->DriverOptionalData, sizeof (OldFakeNVMap->DriverOptionalData));
1253 ZeroMem (OldFakeNVMap->DriverDescriptionData, sizeof (OldFakeNVMap->DriverDescriptionData));
1254 CurrentFakeNVMap->DriverOptionChanged = FALSE;
1255 CurrentFakeNVMap->ForceReconnect = TRUE;
1256 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
1257 } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_BOOT) {
1258 //
1259 // Discard changes and exit formset
1260 //
1261 ZeroMem (CurrentFakeNVMap->BootOptionalData, sizeof (CurrentFakeNVMap->BootOptionalData));
1262 ZeroMem (CurrentFakeNVMap->BootDescriptionData, sizeof (CurrentFakeNVMap->BootDescriptionData));
1263 ZeroMem (OldFakeNVMap->BootOptionalData, sizeof (OldFakeNVMap->BootOptionalData));
1264 ZeroMem (OldFakeNVMap->BootDescriptionData, sizeof (OldFakeNVMap->BootDescriptionData));
1265 CurrentFakeNVMap->BootOptionChanged = FALSE;
1266 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
1267 } else if ((QuestionId == KEY_VALUE_BOOT_DESCRIPTION) || (QuestionId == KEY_VALUE_BOOT_OPTION)) {
1268 CurrentFakeNVMap->BootOptionChanged = TRUE;
1269 } else if ((QuestionId == KEY_VALUE_DRIVER_DESCRIPTION) || (QuestionId == KEY_VALUE_DRIVER_OPTION)) {
1270 CurrentFakeNVMap->DriverOptionChanged = TRUE;
1271 }
1272
1273 if ((QuestionId >= BOOT_OPTION_DEL_QUESTION_ID) && (QuestionId < BOOT_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) {
1274 if (Value->b) {
1275 //
1276 // Means user try to delete this boot option but not press F10 or "Commit Changes and Exit" menu.
1277 //
1278 CurrentFakeNVMap->BootOptionDelMark[QuestionId - BOOT_OPTION_DEL_QUESTION_ID] = TRUE;
1279 } else {
1280 //
1281 // Means user remove the old check status.
1282 //
1283 CurrentFakeNVMap->BootOptionDelMark[QuestionId - BOOT_OPTION_DEL_QUESTION_ID] = FALSE;
1284 }
1285 } else if ((QuestionId >= DRIVER_OPTION_DEL_QUESTION_ID) && (QuestionId < DRIVER_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) {
1286 if (Value->b) {
1287 CurrentFakeNVMap->DriverOptionDelMark[QuestionId - DRIVER_OPTION_DEL_QUESTION_ID] = TRUE;
1288 } else {
1289 CurrentFakeNVMap->DriverOptionDelMark[QuestionId - DRIVER_OPTION_DEL_QUESTION_ID] = FALSE;
1290 }
1291 } else {
1292 switch (QuestionId) {
1293 case KEY_VALUE_SAVE_AND_EXIT:
1294 case KEY_VALUE_NO_SAVE_AND_EXIT:
1295 if (QuestionId == KEY_VALUE_SAVE_AND_EXIT) {
1296 CleanUselessBeforeSubmit (Private);
1297 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
1298 } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT) {
1299 DiscardChangeHandler (Private, CurrentFakeNVMap);
1300 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
1301 }
1302
1303 break;
1304
1305 case FORM_RESET:
1306 gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
1307 return EFI_UNSUPPORTED;
1308
1309 default:
1310 break;
1311 }
1312 }
1313
1314 //
1315 // Update the content in Terminal menu and Console menu here.
1316 //
1317 if ((QuestionId == COM_BAUD_RATE_QUESTION_ID + Private->CurrentTerminal) || (QuestionId == COM_DATA_RATE_QUESTION_ID + Private->CurrentTerminal) ||
1318 (QuestionId == COM_PARITY_QUESTION_ID + Private->CurrentTerminal) || (QuestionId == COM_STOP_BITS_QUESTION_ID + Private->CurrentTerminal) ||
1319 (QuestionId == COM_TERMINAL_QUESTION_ID + Private->CurrentTerminal) || (QuestionId == COM_FLOWCONTROL_QUESTION_ID + Private->CurrentTerminal)
1320 )
1321 {
1322 UpdateTerminalContent (CurrentFakeNVMap);
1323 }
1324
1325 if ((QuestionId >= CON_IN_DEVICE_QUESTION_ID) && (QuestionId < CON_IN_DEVICE_QUESTION_ID + MAX_MENU_NUMBER)) {
1326 UpdateConsoleContent (L"ConIn", CurrentFakeNVMap);
1327 } else if ((QuestionId >= CON_OUT_DEVICE_QUESTION_ID) && (QuestionId < CON_OUT_DEVICE_QUESTION_ID + MAX_MENU_NUMBER)) {
1328 UpdateConsoleContent (L"ConOut", CurrentFakeNVMap);
1329 } else if ((QuestionId >= CON_ERR_DEVICE_QUESTION_ID) && (QuestionId < CON_ERR_DEVICE_QUESTION_ID + MAX_MENU_NUMBER)) {
1330 UpdateConsoleContent (L"ErrOut", CurrentFakeNVMap);
1331 }
1332 }
1333
1334 //
1335 // Pass changed uncommitted data back to Form Browser
1336 //
1337 HiiSetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *)CurrentFakeNVMap, NULL);
1338
1339 return EFI_SUCCESS;
1340}
1341
1350VOID
1352 IN BMM_CALLBACK_DATA *Private,
1353 IN BMM_FAKE_NV_DATA *CurrentFakeNVMap
1354 )
1355{
1356 UINT16 Index;
1357
1358 switch (Private->BmmPreviousPageId) {
1359 case FORM_BOOT_CHG_ID:
1360 CopyMem (CurrentFakeNVMap->BootOptionOrder, Private->BmmOldFakeNVData.BootOptionOrder, sizeof (CurrentFakeNVMap->BootOptionOrder));
1361 break;
1362
1363 case FORM_DRV_CHG_ID:
1364 CopyMem (CurrentFakeNVMap->DriverOptionOrder, Private->BmmOldFakeNVData.DriverOptionOrder, sizeof (CurrentFakeNVMap->DriverOptionOrder));
1365 break;
1366
1367 case FORM_BOOT_DEL_ID:
1368 ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->BootOptionDel) / sizeof (CurrentFakeNVMap->BootOptionDel[0])));
1369 for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
1370 CurrentFakeNVMap->BootOptionDel[Index] = FALSE;
1371 }
1372
1373 break;
1374
1375 case FORM_DRV_DEL_ID:
1376 ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->DriverOptionDel) / sizeof (CurrentFakeNVMap->DriverOptionDel[0])));
1377 for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
1378 CurrentFakeNVMap->DriverOptionDel[Index] = FALSE;
1379 }
1380
1381 break;
1382
1383 case FORM_BOOT_NEXT_ID:
1384 CurrentFakeNVMap->BootNext = Private->BmmOldFakeNVData.BootNext;
1385 break;
1386
1387 case FORM_TIME_OUT_ID:
1388 CurrentFakeNVMap->BootTimeOut = Private->BmmOldFakeNVData.BootTimeOut;
1389 break;
1390
1391 case FORM_DRV_ADD_HANDLE_DESC_ID:
1392 case FORM_DRV_ADD_FILE_ID:
1393 case FORM_DRV_ADD_HANDLE_ID:
1394 CurrentFakeNVMap->DriverAddHandleDesc[0] = 0x0000;
1395 CurrentFakeNVMap->DriverAddHandleOptionalData[0] = 0x0000;
1396 break;
1397
1398 default:
1399 break;
1400 }
1401}
1402
1409VOID
1411 IN BMM_CALLBACK_DATA *Private
1412 )
1413{
1414 UINT16 Index;
1415
1416 if (Private->BmmPreviousPageId != FORM_BOOT_DEL_ID) {
1417 for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
1418 if (Private->BmmFakeNvData.BootOptionDel[Index] && !Private->BmmFakeNvData.BootOptionDelMark[Index]) {
1419 Private->BmmFakeNvData.BootOptionDel[Index] = FALSE;
1420 Private->BmmOldFakeNVData.BootOptionDel[Index] = FALSE;
1421 }
1422 }
1423 }
1424
1425 if (Private->BmmPreviousPageId != FORM_DRV_DEL_ID) {
1426 for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
1427 if (Private->BmmFakeNvData.DriverOptionDel[Index] && !Private->BmmFakeNvData.DriverOptionDelMark[Index]) {
1428 Private->BmmFakeNvData.DriverOptionDel[Index] = FALSE;
1429 Private->BmmOldFakeNVData.DriverOptionDel[Index] = FALSE;
1430 }
1431 }
1432 }
1433}
1434
1440VOID
1442 VOID
1443 )
1444{
1445 VOID *StartOpCodeHandle;
1446 VOID *EndOpCodeHandle;
1447 EFI_IFR_GUID_LABEL *StartGuidLabel;
1448 EFI_IFR_GUID_LABEL *EndGuidLabel;
1449
1450 //
1451 // Allocate space for creation of UpdateData Buffer
1452 //
1453 StartOpCodeHandle = HiiAllocateOpCodeHandle ();
1454 ASSERT (StartOpCodeHandle != NULL);
1455
1456 EndOpCodeHandle = HiiAllocateOpCodeHandle ();
1457 ASSERT (EndOpCodeHandle != NULL);
1458 //
1459 // Create Hii Extend Label OpCode as the start opcode
1460 //
1461 StartGuidLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
1462 StartGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
1463 StartGuidLabel->Number = LABEL_FORM_MAIN_START;
1464 //
1465 // Create Hii Extend Label OpCode as the end opcode
1466 //
1467 EndGuidLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
1468 EndGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
1469 EndGuidLabel->Number = LABEL_FORM_MAIN_END;
1470
1471 //
1472 // Updata Front Page form
1473 //
1475 mBmmCallbackInfo->BmmHiiHandle,
1476 StartOpCodeHandle
1477 );
1478
1480 mBmmCallbackInfo->BmmHiiHandle,
1481 &mBootMaintGuid,
1482 FORM_MAIN_ID,
1483 StartOpCodeHandle,
1484 EndOpCodeHandle
1485 );
1486
1487 HiiFreeOpCodeHandle (StartOpCodeHandle);
1488 HiiFreeOpCodeHandle (EndOpCodeHandle);
1489}
1490
1498VOID
1500 IN BMM_CALLBACK_DATA *CallbackData
1501 )
1502{
1503 BM_MENU_ENTRY *NewMenuEntry;
1504 BM_LOAD_CONTEXT *NewLoadContext;
1505 UINT16 Index;
1506
1507 ASSERT (CallbackData != NULL);
1508
1509 //
1510 // Initialize data which located in BMM main page
1511 //
1512 CallbackData->BmmFakeNvData.BootNext = NONE_BOOTNEXT_VALUE;
1513 for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
1514 NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
1515 NewLoadContext = (BM_LOAD_CONTEXT *)NewMenuEntry->VariableContext;
1516
1517 if (NewLoadContext->IsBootNext) {
1518 CallbackData->BmmFakeNvData.BootNext = Index;
1519 break;
1520 }
1521 }
1522
1523 CallbackData->BmmFakeNvData.BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut);
1524
1525 //
1526 // Initialize data which located in Boot Options Menu
1527 //
1528 GetBootOrder (CallbackData);
1529
1530 //
1531 // Initialize data which located in Driver Options Menu
1532 //
1533 GetDriverOrder (CallbackData);
1534
1535 //
1536 // Initialize data which located in Console Options Menu
1537 //
1538 GetConsoleOutMode (CallbackData);
1539 GetConsoleInCheck (CallbackData);
1540 GetConsoleOutCheck (CallbackData);
1541 GetConsoleErrCheck (CallbackData);
1542 GetTerminalAttribute (CallbackData);
1543
1544 CallbackData->BmmFakeNvData.ForceReconnect = TRUE;
1545
1546 //
1547 // Backup Initialize BMM configuartion data to BmmOldFakeNVData
1548 //
1549 CopyMem (&CallbackData->BmmOldFakeNVData, &CallbackData->BmmFakeNvData, sizeof (BMM_FAKE_NV_DATA));
1550}
1551
1558VOID
1560 IN BMM_CALLBACK_DATA *CallbackData
1561 )
1562{
1565 BOpt_GetBootOptions (CallbackData);
1566 BOpt_GetDriverOptions (CallbackData);
1571 InitializeListHead (&TerminalMenu.Head);
1572 LocateSerialIo ();
1573 GetAllConsoles ();
1574 mAllMenuInit = TRUE;
1575}
1576
1581VOID
1583 VOID
1584 )
1585{
1586 if (!mAllMenuInit) {
1587 return;
1588 }
1589
1593 FreeAllConsoles ();
1594 mAllMenuInit = FALSE;
1595}
1596
1601VOID
1603 VOID
1604 )
1605{
1606 EFI_STATUS Status;
1607 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
1608 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
1609 UINTN BootTextColumn;
1610 UINTN BootTextRow;
1611
1612 if (mBmmModeInitialized) {
1613 return;
1614 }
1615
1616 //
1617 // After the console is ready, get current video resolution
1618 // and text mode before launching setup at first time.
1619 //
1620 Status = gBS->HandleProtocol (
1622 &gEfiGraphicsOutputProtocolGuid,
1623 (VOID **)&GraphicsOutput
1624 );
1625 if (EFI_ERROR (Status)) {
1626 GraphicsOutput = NULL;
1627 }
1628
1629 Status = gBS->HandleProtocol (
1631 &gEfiSimpleTextOutProtocolGuid,
1632 (VOID **)&SimpleTextOut
1633 );
1634 if (EFI_ERROR (Status)) {
1635 SimpleTextOut = NULL;
1636 }
1637
1638 if (GraphicsOutput != NULL) {
1639 //
1640 // Get current video resolution and text mode.
1641 //
1642 mBmmBootHorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
1643 mBmmBootVerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
1644 }
1645
1646 if (SimpleTextOut != NULL) {
1647 Status = SimpleTextOut->QueryMode (
1648 SimpleTextOut,
1649 SimpleTextOut->Mode->Mode,
1650 &BootTextColumn,
1651 &BootTextRow
1652 );
1653 mBmmBootTextModeColumn = (UINT32)BootTextColumn;
1654 mBmmBootTextModeRow = (UINT32)BootTextRow;
1655 }
1656
1657 //
1658 // Get user defined text mode for setup.
1659 //
1660 mBmmSetupHorizontalResolution = PcdGet32 (PcdSetupVideoHorizontalResolution);
1661 mBmmSetupVerticalResolution = PcdGet32 (PcdSetupVideoVerticalResolution);
1662 mBmmSetupTextModeColumn = PcdGet32 (PcdSetupConOutColumn);
1663 mBmmSetupTextModeRow = PcdGet32 (PcdSetupConOutRow);
1664
1665 mBmmModeInitialized = TRUE;
1666}
1667
1680EFIAPI
1682 IN EFI_HANDLE ImageHandle,
1683 IN EFI_SYSTEM_TABLE *SystemTable
1684 )
1685
1686{
1687 EFI_STATUS Status;
1688 UINT8 *Ptr;
1689
1690 Status = EFI_SUCCESS;
1691
1692 //
1693 // Install Device Path Protocol and Config Access protocol to driver handle
1694 //
1695 Status = gBS->InstallMultipleProtocolInterfaces (
1696 &mBmmCallbackInfo->BmmDriverHandle,
1697 &gEfiDevicePathProtocolGuid,
1698 &mBmmHiiVendorDevicePath,
1699 &gEfiHiiConfigAccessProtocolGuid,
1700 &mBmmCallbackInfo->BmmConfigAccess,
1701 NULL
1702 );
1703 ASSERT_EFI_ERROR (Status);
1704
1705 //
1706 // Post our Boot Maint VFR binary to the HII database.
1707 //
1708 mBmmCallbackInfo->BmmHiiHandle = HiiAddPackages (
1709 &mBootMaintGuid,
1710 mBmmCallbackInfo->BmmDriverHandle,
1711 BootMaintenanceManagerBin,
1712 BootMaintenanceManagerUiLibStrings,
1713 NULL
1714 );
1715 ASSERT (mBmmCallbackInfo->BmmHiiHandle != NULL);
1716
1717 //
1718 // Locate Formbrowser2 protocol
1719 //
1720 Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **)&mBmmCallbackInfo->FormBrowser2);
1721 ASSERT_EFI_ERROR (Status);
1722
1723 //
1724 // Create LoadOption in BmmCallbackInfo for Driver Callback
1725 //
1726 Ptr = AllocateZeroPool (sizeof (BM_LOAD_CONTEXT) + sizeof (BM_FILE_CONTEXT) + sizeof (BM_HANDLE_CONTEXT) + sizeof (BM_MENU_ENTRY));
1727 ASSERT (Ptr != NULL);
1728
1729 //
1730 // Initialize Bmm callback data.
1731 //
1732 mBmmCallbackInfo->LoadContext = (BM_LOAD_CONTEXT *)Ptr;
1733 Ptr += sizeof (BM_LOAD_CONTEXT);
1734
1735 mBmmCallbackInfo->FileContext = (BM_FILE_CONTEXT *)Ptr;
1736 Ptr += sizeof (BM_FILE_CONTEXT);
1737
1738 mBmmCallbackInfo->HandleContext = (BM_HANDLE_CONTEXT *)Ptr;
1739 Ptr += sizeof (BM_HANDLE_CONTEXT);
1740
1741 mBmmCallbackInfo->MenuEntry = (BM_MENU_ENTRY *)Ptr;
1742
1743 mBmmCallbackInfo->BmmPreviousPageId = FORM_MAIN_ID;
1744 mBmmCallbackInfo->BmmCurrentPageId = FORM_MAIN_ID;
1745
1746 InitAllMenu (mBmmCallbackInfo);
1747
1749 //
1750 // Update boot maintenance manager page
1751 //
1752 InitializeBmmConfig (mBmmCallbackInfo);
1753
1755
1756 return EFI_SUCCESS;
1757}
1758
1769EFIAPI
1771 IN EFI_HANDLE ImageHandle,
1772 IN EFI_SYSTEM_TABLE *SystemTable
1773 )
1774
1775{
1776 if (mStartOpCodeHandle != NULL) {
1777 HiiFreeOpCodeHandle (mStartOpCodeHandle);
1778 }
1779
1780 if (mEndOpCodeHandle != NULL) {
1781 HiiFreeOpCodeHandle (mEndOpCodeHandle);
1782 }
1783
1784 FreeAllMenu ();
1785
1786 //
1787 // Remove our IFR data from HII database
1788 //
1789 HiiRemovePackages (mBmmCallbackInfo->BmmHiiHandle);
1790
1791 gBS->UninstallMultipleProtocolInterfaces (
1792 mBmmCallbackInfo->BmmDriverHandle,
1793 &gEfiDevicePathProtocolGuid,
1794 &mBmmHiiVendorDevicePath,
1795 &gEfiHiiConfigAccessProtocolGuid,
1796 &mBmmCallbackInfo->BmmConfigAccess,
1797 NULL
1798 );
1799
1800 FreePool (mBmmCallbackInfo->LoadContext);
1801 mBmmCallbackInfo->BmmDriverHandle = NULL;
1802
1803 return EFI_SUCCESS;
1804}
UINT64 UINTN
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
Definition: String.c:109
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
Definition: LinkedList.c:182
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
Definition: String.c:30
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
Definition: String.c:224
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID FreeAllMenu(VOID)
EFI_STATUS EFIAPI BootMaintCallback(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest)
EFI_STRING UpdateProgress(IN UINTN Offset, IN EFI_STRING Configuration)
VOID InitializeBmmConfig(IN BMM_CALLBACK_DATA *CallbackData)
VOID DiscardChangeHandler(IN BMM_CALLBACK_DATA *Private, IN BMM_FAKE_NV_DATA *CurrentFakeNVMap)
VOID InitAllMenu(IN BMM_CALLBACK_DATA *CallbackData)
EFI_STATUS EFIAPI BootMaintExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
EFI_STATUS EFIAPI BootMaintenanceManagerUiLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID BmmInitialBootModeInfo(VOID)
VOID CleanUselessBeforeSubmit(IN BMM_CALLBACK_DATA *Private)
CHAR16 * BmmExtractDevicePathFromHiiHandle(IN EFI_HII_HANDLE Handle)
CHAR16 * UiDevicePathToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
VOID HiiToLower(IN EFI_STRING ConfigString)
VOID CustomizeMenus(VOID)
VOID UpdateTerminalContent(IN BMM_FAKE_NV_DATA *BmmData)
EFI_STATUS EFIAPI BootMaintRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
EFI_STATUS EFIAPI BootMaintenanceManagerUiLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
CHAR16 * ExtractFileNameFromDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
VOID UpdateConsoleContent(IN CHAR16 *ConsoleName, IN BMM_FAKE_NV_DATA *BmmData)
EFI_STATUS BmmSetConsoleMode(BOOLEAN IsSetupMode)
VOID BOpt_FreeMenu(BM_MENU_OPTION *FreeMenu)
Definition: BootOption.c:256
BM_MENU_ENTRY * BOpt_GetMenuEntry(BM_MENU_OPTION *MenuOption, UINTN MenuNumber)
Definition: BootOption.c:229
EFI_STATUS Var_DelBootOption(VOID)
Definition: Variable.c:21
VOID UpdateConModePage(IN BMM_CALLBACK_DATA *CallbackData)
Definition: UpdatePage.c:678
BM_MENU_OPTION DriverMenu
Definition: Data.c:92
VOID CleanUpPage(IN UINT16 LabelId, IN BMM_CALLBACK_DATA *CallbackData)
Definition: UpdatePage.c:165
VOID UpdateConCOMPage(IN BMM_CALLBACK_DATA *CallbackData)
Definition: UpdatePage.c:192
EFI_STATUS Var_UpdateDriverOption(IN BMM_CALLBACK_DATA *CallbackData, IN EFI_HII_HANDLE HiiHandle, IN UINT16 *DescriptionData, IN UINT16 *OptionalData, IN UINT8 ForceReconnect)
Definition: Variable.c:289
EFI_STATUS GetAllConsoles(VOID)
COM_ATTR DataBitsList[4]
Definition: Data.c:189
VOID GetTerminalAttribute(IN BMM_CALLBACK_DATA *CallbackData)
COM_ATTR BaudRateList[19]
Definition: Data.c:107
COM_ATTR ParityList[5]
Definition: Data.c:211
VOID UpdateDrvAddHandlePage(IN BMM_CALLBACK_DATA *CallbackData)
Definition: UpdatePage.c:283
VOID GetConsoleOutCheck(IN BMM_CALLBACK_DATA *CallbackData)
EFI_STATUS Var_UpdateErrorOutOption(VOID)
Definition: Variable.c:263
EFI_STATUS BOpt_GetDriverOptions(IN BMM_CALLBACK_DATA *CallbackData)
Definition: BootOption.c:678
VOID GetConsoleOutMode(IN BMM_CALLBACK_DATA *CallbackData)
VOID UpdateBootDelPage(IN BMM_CALLBACK_DATA *CallbackData)
Definition: UpdatePage.c:227
BOOLEAN EFIAPI CreateDriverOptionFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
Definition: BootOption.c:1012
EFI_STATUS LocateSerialIo(VOID)
VOID CreateUpdateData(VOID)
Definition: UpdatePage.c:16
EFI_STATUS Var_UpdateBootOrder(IN BMM_CALLBACK_DATA *CallbackData)
Definition: Variable.c:590
VOID GetConsoleErrCheck(IN BMM_CALLBACK_DATA *CallbackData)
EFI_STATUS Var_UpdateBootNext(IN BMM_CALLBACK_DATA *CallbackData)
Definition: Variable.c:533
VOID UpdatePageBody(IN UINT16 UpdatePageId, IN BMM_CALLBACK_DATA *CallbackData)
Definition: UpdatePage.c:1103
VOID UpdateTerminalPage(IN BMM_CALLBACK_DATA *CallbackData)
Definition: UpdatePage.c:805
BOOLEAN EFIAPI CreateBootOptionFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
Definition: BootOption.c:994
EFI_STATUS Var_UpdateConMode(IN BMM_CALLBACK_DATA *CallbackData)
Definition: Variable.c:714
BM_MENU_OPTION ConsoleErrMenu
Definition: Data.c:65
BM_MENU_OPTION DriverOptionMenu
Definition: Data.c:83
EFI_STATUS BOpt_FindDrivers(VOID)
Definition: BootOption.c:492
VOID GetBootOrder(IN BMM_CALLBACK_DATA *CallbackData)
Definition: BootOption.c:811
BM_MENU_OPTION ConsoleOutMenu
Definition: Data.c:56
EFI_STATUS Var_UpdateConsoleInpOption(VOID)
Definition: Variable.c:233
EFI_STATUS Var_UpdateDriverOrder(IN BMM_CALLBACK_DATA *CallbackData)
Definition: Variable.c:652
BM_MENU_OPTION BootOptionMenu
Definition: Data.c:74
EFI_STATUS FreeAllConsoles(VOID)
VOID GetConsoleInCheck(IN BMM_CALLBACK_DATA *CallbackData)
VOID UpdateDriverAddHandleDescPage(IN BMM_CALLBACK_DATA *CallbackData)
Definition: UpdatePage.c:372
EFI_STATUS ChangeTerminalDevicePath(IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN ChangeTerminal)
VOID UpdatePageId(BMM_CALLBACK_DATA *Private, UINT16 NewPageId)
Definition: UpdatePage.c:1143
EFI_STATUS Var_UpdateBootOption(IN BMM_CALLBACK_DATA *CallbackData)
Definition: Variable.c:414
VOID GetDriverOrder(IN BMM_CALLBACK_DATA *CallbackData)
Definition: BootOption.c:858
BM_MENU_OPTION ConsoleInpMenu
Definition: Data.c:47
COM_ATTR StopBitsList[3]
Definition: Data.c:237
EFI_STATUS Var_UpdateConsoleOutOption(VOID)
Definition: Variable.c:248
VOID UpdateDrvDelPage(IN BMM_CALLBACK_DATA *CallbackData)
Definition: UpdatePage.c:318
EFI_STATUS Var_DelDriverOption(VOID)
Definition: Variable.c:78
BOOLEAN EFIAPI BootFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
Definition: BootOption.c:908
EFI_STATUS BOpt_GetBootOptions(IN BMM_CALLBACK_DATA *CallbackData)
Definition: BootOption.c:288
VOID UiCustomizeBMMPage(IN EFI_HII_HANDLE HiiHandle, IN VOID *StartOpCodeHandle)
#define HARDWARE_DEVICE_PATH
Definition: DevicePath.h:68
#define HW_VENDOR_DP
Definition: DevicePath.h:133
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DevicePathFromHandle(IN EFI_HANDLE Handle)
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
EFI_STATUS EFIAPI ChooseFile(IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory, IN CHAR16 *FileType OPTIONAL, IN CHOOSE_HANDLER ChooseHandler OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL)
EFI_STRING EFIAPI HiiConstructConfigHdr(IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL, IN EFI_HANDLE DriverHandle)
Definition: HiiLib.c:723
BOOLEAN EFIAPI HiiGetBrowserData(IN CONST EFI_GUID *VariableGuid OPTIONAL, IN CONST CHAR16 *VariableName OPTIONAL, IN UINTN BufferSize, OUT UINT8 *Buffer)
Definition: HiiLib.c:2872
VOID *EFIAPI HiiAllocateOpCodeHandle(VOID)
Definition: HiiLib.c:3051
VOID EFIAPI HiiFreeOpCodeHandle(VOID *OpCodeHandle)
Definition: HiiLib.c:3085
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
Definition: HiiLib.c:141
UINT8 *EFIAPI HiiCreateGuidOpCode(IN VOID *OpCodeHandle, IN CONST EFI_GUID *Guid, IN CONST VOID *GuidOpCode OPTIONAL, IN UINTN OpCodeSize)
Definition: HiiLib.c:3411
BOOLEAN EFIAPI HiiSetBrowserData(IN CONST EFI_GUID *VariableGuid OPTIONAL, IN CONST CHAR16 *VariableName OPTIONAL, IN UINTN BufferSize, IN CONST UINT8 *Buffer, IN CONST CHAR16 *RequestElement OPTIONAL)
Definition: HiiLib.c:2954
EFI_STATUS EFIAPI HiiUpdateForm(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid OPTIONAL, IN EFI_FORM_ID FormId, IN VOID *StartOpCodeHandle, IN VOID *EndOpCodeHandle OPTIONAL)
Definition: HiiLib.c:4410
BOOLEAN EFIAPI HiiIsConfigHdrMatch(IN CONST EFI_STRING ConfigHdr, IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL)
Definition: HiiLib.c:2813
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
Definition: HiiLib.c:253
#define EFI_IFR_EXTEND_OP_LABEL
Definition: MdeModuleHii.h:33
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
Definition: PrintLib.c:408
EFI_RUNTIME_SERVICES * gRT
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define ARRAY_SIZE(Array)
Definition: Base.h:1393
#define IN
Definition: Base.h:279
#define OFFSET_OF(TYPE, Field)
Definition: Base.h:758
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define PcdGet16(TokenName)
Definition: PcdLib.h:349
#define PcdGet32(TokenName)
Definition: PcdLib.h:362
#define PcdSet32S(TokenName, Value)
Definition: PcdLib.h:497
VOID EFIAPI Exit(IN EFI_STATUS Status)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
VOID EFIAPI EfiBootManagerRefreshAllBootOption(VOID)
Definition: BmBoot.c:2388
EFI_SYSTEM_TABLE * gST
EFI_BOOT_SERVICES * gBS
EFI_HII_CONFIG_ROUTING_PROTOCOL * gHiiConfigRouting
EFI_HII_DATABASE_PROTOCOL * gHiiDatabase
VOID * EFI_HII_HANDLE
@ EfiResetCold
#define EFI_VARIABLE_NON_VOLATILE
@ ByProtocol
Definition: UefiSpec.h:1518
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE * Mode
EFI_SIMPLE_TEXT_OUTPUT_MODE * Mode
EFI_HII_CONFIG_ACCESS_PROTOCOL BmmConfigAccess
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * Info
EFI_HANDLE ConsoleOutHandle
Definition: UefiSpec.h:2059
Definition: Base.h:213