11#define FRONT_PAGE_KEY_OFFSET 0x4000
15UINT32 mBmmBootHorizontalResolution = 0;
16UINT32 mBmmBootVerticalResolution = 0;
17UINT32 mBmmBootTextModeColumn = 0;
18UINT32 mBmmBootTextModeRow = 0;
22UINT32 mBmmSetupTextModeColumn = 0;
23UINT32 mBmmSetupTextModeRow = 0;
24UINT32 mBmmSetupHorizontalResolution = 0;
25UINT32 mBmmSetupVerticalResolution = 0;
27BOOLEAN mBmmModeInitialized =
FALSE;
32 END_ENTIRE_DEVICE_PATH_SUBTYPE,
34 END_DEVICE_PATH_LENGTH,
53 { 0x165a028f, 0xbb2, 0x4b5f, { 0x87, 0x47, 0x77, 0x59, 0x2e, 0x3f, 0x64, 0x99 }
58 END_ENTIRE_DEVICE_PATH_SUBTYPE,
60 (UINT8)(END_DEVICE_PATH_LENGTH),
61 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
66EFI_GUID mBootMaintGuid = BOOT_MAINT_FORMSET_GUID;
68CHAR16 mBootMaintStorageName[] = L
"BmmData";
70 BMM_CALLBACK_DATA_SIGNATURE,
81BOOLEAN mAllMenuInit =
FALSE;
82BOOLEAN mFirstEnterBMMForm =
FALSE;
136 UINT32 NewHorizontalResolution;
137 UINT32 NewVerticalResolution;
153 Status =
gBS->HandleProtocol (
155 &gEfiGraphicsOutputProtocolGuid,
156 (VOID **)&GraphicsOutput
158 if (EFI_ERROR (Status)) {
159 GraphicsOutput =
NULL;
162 Status =
gBS->HandleProtocol (
164 &gEfiSimpleTextOutProtocolGuid,
165 (VOID **)&SimpleTextOut
167 if (EFI_ERROR (Status)) {
168 SimpleTextOut =
NULL;
171 if ((GraphicsOutput ==
NULL) || (SimpleTextOut ==
NULL)) {
172 return EFI_UNSUPPORTED;
179 NewHorizontalResolution = mBmmSetupHorizontalResolution;
180 NewVerticalResolution = mBmmSetupVerticalResolution;
181 NewColumns = mBmmSetupTextModeColumn;
182 NewRows = mBmmSetupTextModeRow;
187 NewHorizontalResolution = mBmmBootHorizontalResolution;
188 NewVerticalResolution = mBmmBootVerticalResolution;
189 NewColumns = mBmmBootTextModeColumn;
190 NewRows = mBmmBootTextModeRow;
193 if (GraphicsOutput !=
NULL) {
197 if (SimpleTextOut !=
NULL) {
208 for (ModeNumber = 0; ModeNumber < MaxGopMode; ModeNumber++) {
209 Status = GraphicsOutput->QueryMode (
215 if (!EFI_ERROR (Status)) {
225 Status = SimpleTextOut->QueryMode (SimpleTextOut, SimpleTextOut->
Mode->
Mode, &CurrentColumn, &CurrentRow);
227 if ((CurrentColumn == NewColumns) && (CurrentRow == NewRows)) {
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)) {
244 Status = SimpleTextOut->SetMode (SimpleTextOut, Index);
249 Status =
PcdSet32S (PcdConOutColumn, mBmmSetupTextModeColumn);
251 Status =
PcdSet32S (PcdConOutRow, mBmmSetupTextModeRow);
259 if (Index == MaxTextMode) {
264 return EFI_UNSUPPORTED;
272 Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);
273 if (!EFI_ERROR (Status)) {
284 if (ModeNumber == MaxGopMode) {
288 return EFI_UNSUPPORTED;
295 Status =
PcdSet32S (PcdVideoHorizontalResolution, NewHorizontalResolution);
297 Status =
PcdSet32S (PcdVideoVerticalResolution, NewVerticalResolution);
299 Status =
PcdSet32S (PcdConOutColumn, NewColumns);
301 Status =
PcdSet32S (PcdConOutRow, NewRows);
309 Status =
gBS->LocateHandleBuffer (
311 &gEfiSimpleTextOutProtocolGuid,
316 if (!EFI_ERROR (Status)) {
317 for (Index = 0; Index < HandleCount; Index++) {
318 gBS->DisconnectController (HandleBuffer[Index],
NULL,
NULL);
321 for (Index = 0; Index < HandleCount; Index++) {
325 if (HandleBuffer !=
NULL) {
350 if (DevPath ==
NULL) {
354 Status =
gBS->LocateProtocol (
355 &gEfiDevicePathToTextProtocolGuid,
357 (VOID **)&DevPathToText
360 ToText = DevPathToText->ConvertDevicePathToText (
365 ASSERT (ToText !=
NULL);
389 ASSERT (DevicePath !=
NULL);
392 MatchString = String;
396 while (MatchString !=
NULL) {
397 LastMatch = MatchString + 1;
398 MatchString =
StrStr (LastMatch, L
"\\");
401 Length =
StrLen (LastMatch);
403 if (FileName !=
NULL) {
404 *(FileName + Length) = 0;
429 ASSERT (Handle !=
NULL);
431 if (Handle ==
NULL) {
436 if (EFI_ERROR (Status)) {
455 IN EFI_STRING ConfigString
461 ASSERT (ConfigString !=
NULL);
466 for (String = ConfigString, Lower =
FALSE; *String != L
'\0'; String++) {
467 if (*String == L
'=') {
469 }
else if (*String == L
'&') {
471 }
else if (Lower && (*String >= L
'A') && (*String <= L
'F')) {
472 *String = (CHAR16)(*String - L
'A' + L
'a');
487 IN EFI_STRING Configuration
491 EFI_STRING StringPtr;
492 EFI_STRING ReturnString;
501 Length =
StrLen (L
"&OFFSET=") + 4 + 1;
505 if (StringPtr ==
NULL) {
511 (8 + 4 + 1) *
sizeof (CHAR16),
516 ReturnString =
StrStr (Configuration, StringPtr);
518 if (ReturnString ==
NULL) {
523 ReturnString =
StrStr (Configuration, StringPtr);
546 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
548 ASSERT (NewMenuEntry !=
NULL);
550 NewTerminalContext->BaudRateIndex = BmmData->COMBaudRate[Index];
552 NewTerminalContext->BaudRate =
BaudRateList[BmmData->COMBaudRate[Index]].Value;
553 NewTerminalContext->DataBitsIndex = BmmData->COMDataRate[Index];
555 NewTerminalContext->DataBits = (UINT8)
DataBitsList[BmmData->COMDataRate[Index]].Value;
556 NewTerminalContext->StopBitsIndex = BmmData->COMStopBits[Index];
558 NewTerminalContext->StopBits = (UINT8)
StopBitsList[BmmData->COMStopBits[Index]].Value;
559 NewTerminalContext->ParityIndex = BmmData->COMParity[Index];
561 NewTerminalContext->Parity = (UINT8)
ParityList[BmmData->COMParity[Index]].Value;
562 NewTerminalContext->TerminalType = BmmData->COMTerminalType[Index];
563 NewTerminalContext->FlowControl = BmmData->COMFlowControl[Index];
565 NewTerminalContext->DevicePath,
580 IN CHAR16 *ConsoleName,
589 if (
StrCmp (ConsoleName, L
"ConIn") == 0) {
593 ASSERT (Index < MAX_MENU_NUMBER);
594 NewConsoleContext->IsActive = BmmData->ConsoleInCheck[Index];
597 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
601 NewTerminalContext->IsConIn = BmmData->ConsoleInCheck[Index +
ConsoleInpMenu.MenuNumber];
605 if (
StrCmp (ConsoleName, L
"ConOut") == 0) {
609 ASSERT (Index < MAX_MENU_NUMBER);
610 NewConsoleContext->IsActive = BmmData->ConsoleOutCheck[Index];
613 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
617 NewTerminalContext->IsConOut = BmmData->ConsoleOutCheck[Index +
ConsoleOutMenu.MenuNumber];
621 if (
StrCmp (ConsoleName, L
"ErrOut") == 0) {
625 ASSERT (Index < MAX_MENU_NUMBER);
626 NewConsoleContext->IsActive = BmmData->ConsoleErrCheck[Index];
629 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
633 NewTerminalContext->IsStdErr = BmmData->ConsoleErrCheck[Index +
ConsoleErrMenu.MenuNumber];
664 OUT EFI_STRING *Progress,
665 OUT EFI_STRING *Results
671 EFI_STRING ConfigRequestHdr;
672 EFI_STRING ConfigRequest;
673 BOOLEAN AllocatedRequest;
676 if ((Progress ==
NULL) || (Results ==
NULL)) {
677 return EFI_INVALID_PARAMETER;
682 return EFI_NOT_FOUND;
685 ConfigRequestHdr =
NULL;
686 ConfigRequest =
NULL;
687 AllocatedRequest =
FALSE;
690 Private = BMM_CALLBACK_DATA_FROM_THIS (This);
695 ConfigRequest = Request;
702 ConfigRequestHdr =
HiiConstructConfigHdr (&mBootMaintGuid, mBootMaintStorageName, Private->BmmDriverHandle);
703 Size = (
StrLen (ConfigRequestHdr) + 32 + 1) *
sizeof (CHAR16);
705 ASSERT (ConfigRequest !=
NULL);
706 AllocatedRequest =
TRUE;
707 UnicodeSPrint (ConfigRequest, Size, L
"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
714 (UINT8 *)&Private->BmmFakeNvData,
722 if (AllocatedRequest) {
724 ConfigRequest =
NULL;
730 if (Request ==
NULL) {
732 }
else if (
StrStr (Request, L
"OFFSET") ==
NULL) {
733 *Progress = Request +
StrLen (Request);
776 IN CONST EFI_STRING Configuration,
777 OUT EFI_STRING *Progress
788 BOOLEAN TerminalAttChange;
792 if (Progress ==
NULL) {
793 return EFI_INVALID_PARAMETER;
796 *Progress = Configuration;
798 if (Configuration ==
NULL) {
799 return EFI_INVALID_PARAMETER;
807 return EFI_NOT_FOUND;
810 Status =
gBS->LocateProtocol (
811 &gEfiHiiConfigRoutingProtocolGuid,
813 (VOID **)&ConfigRouting
815 if (EFI_ERROR (Status)) {
819 Private = BMM_CALLBACK_DATA_FROM_THIS (This);
824 OldBmmData = &Private->BmmOldFakeNVData;
825 NewBmmData = &Private->BmmFakeNvData;
830 Status = ConfigRouting->ConfigToBlock (
846 if (
CompareMem (&NewBmmData->BootNext, &OldBmmData->BootNext, sizeof (NewBmmData->BootNext)) != 0) {
848 if (EFI_ERROR (Status)) {
857 if (
CompareMem (NewBmmData->BootOptionDel, OldBmmData->BootOptionDel, sizeof (NewBmmData->BootOptionDel)) != 0) {
859 ((Index <
BootOptionMenu.MenuNumber) && (Index < (
sizeof (NewBmmData->BootOptionDel) / sizeof (NewBmmData->BootOptionDel[0]))));
864 NewLoadContext->Deleted = NewBmmData->BootOptionDel[Index];
865 NewBmmData->BootOptionDel[Index] =
FALSE;
866 NewBmmData->BootOptionDelMark[Index] =
FALSE;
870 if (EFI_ERROR (Status)) {
876 if (
CompareMem (NewBmmData->BootOptionOrder, OldBmmData->BootOptionOrder, sizeof (NewBmmData->BootOptionOrder)) != 0) {
878 if (EFI_ERROR (Status)) {
884 if (
CompareMem (&NewBmmData->BootTimeOut, &OldBmmData->BootTimeOut, sizeof (NewBmmData->BootTimeOut)) != 0) {
885 Status =
gRT->SetVariable (
887 &gEfiGlobalVariableGuid,
890 &(NewBmmData->BootTimeOut)
892 if (EFI_ERROR (Status)) {
897 Private->BmmOldFakeNVData.BootTimeOut = NewBmmData->BootTimeOut;
903 if (
CompareMem (NewBmmData->DriverOptionDel, OldBmmData->DriverOptionDel, sizeof (NewBmmData->DriverOptionDel)) != 0) {
905 ((Index <
DriverOptionMenu.MenuNumber) && (Index < (
sizeof (NewBmmData->DriverOptionDel) / sizeof (NewBmmData->DriverOptionDel[0]))));
910 NewLoadContext->Deleted = NewBmmData->DriverOptionDel[Index];
911 NewBmmData->DriverOptionDel[Index] =
FALSE;
912 NewBmmData->DriverOptionDelMark[Index] =
FALSE;
916 if (EFI_ERROR (Status)) {
922 if (
CompareMem (NewBmmData->DriverOptionOrder, OldBmmData->DriverOptionOrder, sizeof (NewBmmData->DriverOptionOrder)) != 0) {
924 if (EFI_ERROR (Status)) {
930 if (
CompareMem (&NewBmmData->ConsoleOutMode, &OldBmmData->ConsoleOutMode, sizeof (NewBmmData->ConsoleOutMode)) != 0) {
932 if (EFI_ERROR (Status)) {
938 TerminalAttChange =
FALSE;
939 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
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))
953 TerminalAttChange =
TRUE;
956 if (TerminalAttChange) {
957 if (
CompareMem (&NewBmmData->COMBaudRate[Index], &OldBmmData->COMBaudRate[Index], sizeof (NewBmmData->COMBaudRate[Index])) != 0) {
959 }
else if (
CompareMem (&NewBmmData->COMDataRate[Index], &OldBmmData->COMDataRate[Index], sizeof (NewBmmData->COMDataRate[Index])) != 0) {
961 }
else if (
CompareMem (&NewBmmData->COMStopBits[Index], &OldBmmData->COMStopBits[Index], sizeof (NewBmmData->COMStopBits[Index])) != 0) {
963 }
else if (
CompareMem (&NewBmmData->COMParity[Index], &OldBmmData->COMParity[Index], sizeof (NewBmmData->COMParity[Index])) != 0) {
965 }
else if (
CompareMem (&NewBmmData->COMTerminalType[Index], &OldBmmData->COMTerminalType[Index], sizeof (NewBmmData->COMTerminalType[Index])) != 0) {
967 }
else if (
CompareMem (&NewBmmData->COMFlowControl[Index], &OldBmmData->COMFlowControl[Index], sizeof (NewBmmData->COMFlowControl[Index])) != 0) {
972 if (EFI_ERROR (Status)) {
977 if (EFI_ERROR (Status)) {
982 if (EFI_ERROR (Status)) {
990 if (
CompareMem (NewBmmData->ConsoleInCheck, OldBmmData->ConsoleInCheck, sizeof (NewBmmData->ConsoleInCheck)) != 0) {
992 if (EFI_ERROR (Status)) {
998 if (
CompareMem (NewBmmData->ConsoleOutCheck, OldBmmData->ConsoleOutCheck, sizeof (NewBmmData->ConsoleOutCheck)) != 0) {
1000 if (EFI_ERROR (Status)) {
1006 if (
CompareMem (NewBmmData->ConsoleErrCheck, OldBmmData->ConsoleErrCheck, sizeof (NewBmmData->ConsoleErrCheck)) != 0) {
1008 if (EFI_ERROR (Status)) {
1014 if ((
CompareMem (NewBmmData->BootDescriptionData, OldBmmData->BootDescriptionData, sizeof (NewBmmData->BootDescriptionData)) != 0) ||
1015 (
CompareMem (NewBmmData->BootOptionalData, OldBmmData->BootOptionalData, sizeof (NewBmmData->BootOptionalData)) != 0))
1018 NewBmmData->BootOptionChanged =
FALSE;
1019 if (EFI_ERROR (Status)) {
1020 if (
CompareMem (NewBmmData->BootDescriptionData, OldBmmData->BootDescriptionData, sizeof (NewBmmData->BootDescriptionData)) != 0) {
1032 if ((
CompareMem (NewBmmData->DriverDescriptionData, OldBmmData->DriverDescriptionData, sizeof (NewBmmData->DriverDescriptionData)) != 0) ||
1033 (
CompareMem (NewBmmData->DriverOptionalData, OldBmmData->DriverOptionalData, sizeof (NewBmmData->DriverOptionalData)) != 0))
1037 Private->BmmHiiHandle,
1038 NewBmmData->DriverDescriptionData,
1039 NewBmmData->DriverOptionalData,
1040 NewBmmData->ForceReconnect
1042 NewBmmData->DriverOptionChanged =
FALSE;
1043 NewBmmData->ForceReconnect =
TRUE;
1044 if (EFI_ERROR (Status)) {
1045 if (
CompareMem (NewBmmData->DriverDescriptionData, OldBmmData->DriverDescriptionData, sizeof (NewBmmData->DriverDescriptionData)) != 0) {
1069 if (Status == EFI_OUT_OF_RESOURCES) {
1072 return EFI_NOT_FOUND;
1098 IN EFI_BROWSER_ACTION Action,
1099 IN EFI_QUESTION_ID QuestionId,
1102 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
1112 if ((Action != EFI_BROWSER_ACTION_CHANGING) && (Action != EFI_BROWSER_ACTION_CHANGED) && (Action != EFI_BROWSER_ACTION_FORM_OPEN)) {
1116 return EFI_UNSUPPORTED;
1119 Private = BMM_CALLBACK_DATA_FROM_THIS (This);
1121 if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
1122 if (QuestionId == KEY_VALUE_TRIGGER_FORM_OPEN_ACTION) {
1123 if (!mFirstEnterBMMForm) {
1136 mFirstEnterBMMForm =
TRUE;
1144 CurrentFakeNVMap = &Private->BmmFakeNvData;
1145 OldFakeNVMap = &Private->BmmOldFakeNVData;
1148 if (Action == EFI_BROWSER_ACTION_CHANGING) {
1149 if (Value ==
NULL) {
1150 return EFI_INVALID_PARAMETER;
1155 if (QuestionId < FILE_OPTION_OFFSET) {
1156 if (QuestionId < CONFIG_OPTION_OFFSET) {
1157 switch (QuestionId) {
1158 case FORM_BOOT_ADD_ID:
1163 case FORM_DRV_ADD_FILE_ID:
1168 case FORM_DRV_ADD_HANDLE_ID:
1173 case FORM_BOOT_DEL_ID:
1178 case FORM_BOOT_CHG_ID:
1179 case FORM_DRV_CHG_ID:
1183 case FORM_DRV_DEL_ID:
1188 case FORM_CON_IN_ID:
1189 case FORM_CON_OUT_ID:
1190 case FORM_CON_ERR_ID:
1194 case FORM_CON_MODE_ID:
1199 case FORM_CON_COM_ID:
1207 }
else if ((QuestionId >= TERMINAL_OPTION_OFFSET) && (QuestionId < CONSOLE_OPTION_OFFSET)) {
1208 Index = (UINT16)(QuestionId - TERMINAL_OPTION_OFFSET);
1209 Private->CurrentTerminal = Index;
1213 }
else if (QuestionId >= HANDLE_OPTION_OFFSET) {
1214 Index = (UINT16)(QuestionId - HANDLE_OPTION_OFFSET);
1217 ASSERT (NewMenuEntry !=
NULL);
1220 CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID, Private);
1222 Private->MenuEntry = NewMenuEntry;
1223 Private->LoadContext->FilePathList = Private->HandleContext->DevicePath;
1229 if (QuestionId == KEY_VALUE_BOOT_FROM_FILE) {
1233 }
else if (Action == EFI_BROWSER_ACTION_CHANGED) {
1234 if ((Value ==
NULL) || (ActionRequest ==
NULL)) {
1235 return EFI_INVALID_PARAMETER;
1238 if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_BOOT) {
1240 CurrentFakeNVMap->BootOptionChanged =
FALSE;
1241 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
1242 }
else if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_DRIVER) {
1244 CurrentFakeNVMap->DriverOptionChanged =
FALSE;
1245 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
1246 }
else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) {
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) {
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;
1273 if ((QuestionId >= BOOT_OPTION_DEL_QUESTION_ID) && (QuestionId < BOOT_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) {
1278 CurrentFakeNVMap->BootOptionDelMark[QuestionId - BOOT_OPTION_DEL_QUESTION_ID] =
TRUE;
1283 CurrentFakeNVMap->BootOptionDelMark[QuestionId - BOOT_OPTION_DEL_QUESTION_ID] =
FALSE;
1285 }
else if ((QuestionId >= DRIVER_OPTION_DEL_QUESTION_ID) && (QuestionId < DRIVER_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) {
1287 CurrentFakeNVMap->DriverOptionDelMark[QuestionId - DRIVER_OPTION_DEL_QUESTION_ID] =
TRUE;
1289 CurrentFakeNVMap->DriverOptionDelMark[QuestionId - DRIVER_OPTION_DEL_QUESTION_ID] =
FALSE;
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) {
1297 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
1298 }
else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT) {
1300 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
1307 return EFI_UNSUPPORTED;
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)
1325 if ((QuestionId >= CON_IN_DEVICE_QUESTION_ID) && (QuestionId < CON_IN_DEVICE_QUESTION_ID + MAX_MENU_NUMBER)) {
1327 }
else if ((QuestionId >= CON_OUT_DEVICE_QUESTION_ID) && (QuestionId < CON_OUT_DEVICE_QUESTION_ID + MAX_MENU_NUMBER)) {
1329 }
else if ((QuestionId >= CON_ERR_DEVICE_QUESTION_ID) && (QuestionId < CON_ERR_DEVICE_QUESTION_ID + MAX_MENU_NUMBER)) {
1358 switch (Private->BmmPreviousPageId) {
1359 case FORM_BOOT_CHG_ID:
1360 CopyMem (CurrentFakeNVMap->BootOptionOrder, Private->BmmOldFakeNVData.BootOptionOrder, sizeof (CurrentFakeNVMap->BootOptionOrder));
1363 case FORM_DRV_CHG_ID:
1364 CopyMem (CurrentFakeNVMap->DriverOptionOrder, Private->BmmOldFakeNVData.DriverOptionOrder, sizeof (CurrentFakeNVMap->DriverOptionOrder));
1367 case FORM_BOOT_DEL_ID:
1368 ASSERT (
BootOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->BootOptionDel) / sizeof (CurrentFakeNVMap->BootOptionDel[0])));
1370 CurrentFakeNVMap->BootOptionDel[Index] =
FALSE;
1375 case FORM_DRV_DEL_ID:
1376 ASSERT (
DriverOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->DriverOptionDel) / sizeof (CurrentFakeNVMap->DriverOptionDel[0])));
1378 CurrentFakeNVMap->DriverOptionDel[Index] =
FALSE;
1383 case FORM_BOOT_NEXT_ID:
1384 CurrentFakeNVMap->BootNext = Private->BmmOldFakeNVData.BootNext;
1387 case FORM_TIME_OUT_ID:
1388 CurrentFakeNVMap->BootTimeOut = Private->BmmOldFakeNVData.BootTimeOut;
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;
1416 if (Private->BmmPreviousPageId != FORM_BOOT_DEL_ID) {
1418 if (Private->BmmFakeNvData.BootOptionDel[Index] && !Private->BmmFakeNvData.BootOptionDelMark[Index]) {
1419 Private->BmmFakeNvData.BootOptionDel[Index] =
FALSE;
1420 Private->BmmOldFakeNVData.BootOptionDel[Index] =
FALSE;
1425 if (Private->BmmPreviousPageId != FORM_DRV_DEL_ID) {
1427 if (Private->BmmFakeNvData.DriverOptionDel[Index] && !Private->BmmFakeNvData.DriverOptionDelMark[Index]) {
1428 Private->BmmFakeNvData.DriverOptionDel[Index] =
FALSE;
1429 Private->BmmOldFakeNVData.DriverOptionDel[Index] =
FALSE;
1445 VOID *StartOpCodeHandle;
1446 VOID *EndOpCodeHandle;
1454 ASSERT (StartOpCodeHandle !=
NULL);
1457 ASSERT (EndOpCodeHandle !=
NULL);
1463 StartGuidLabel->
Number = LABEL_FORM_MAIN_START;
1469 EndGuidLabel->
Number = LABEL_FORM_MAIN_END;
1475 mBmmCallbackInfo->BmmHiiHandle,
1480 mBmmCallbackInfo->BmmHiiHandle,
1507 ASSERT (CallbackData !=
NULL);
1512 CallbackData->BmmFakeNvData.BootNext = NONE_BOOTNEXT_VALUE;
1517 if (NewLoadContext->IsBootNext) {
1518 CallbackData->BmmFakeNvData.BootNext = Index;
1523 CallbackData->BmmFakeNvData.BootTimeOut =
PcdGet16 (PcdPlatformBootTimeOut);
1544 CallbackData->BmmFakeNvData.ForceReconnect =
TRUE;
1574 mAllMenuInit =
TRUE;
1586 if (!mAllMenuInit) {
1594 mAllMenuInit =
FALSE;
1609 UINTN BootTextColumn;
1612 if (mBmmModeInitialized) {
1620 Status =
gBS->HandleProtocol (
1622 &gEfiGraphicsOutputProtocolGuid,
1623 (VOID **)&GraphicsOutput
1625 if (EFI_ERROR (Status)) {
1626 GraphicsOutput =
NULL;
1629 Status =
gBS->HandleProtocol (
1631 &gEfiSimpleTextOutProtocolGuid,
1632 (VOID **)&SimpleTextOut
1634 if (EFI_ERROR (Status)) {
1635 SimpleTextOut =
NULL;
1638 if (GraphicsOutput !=
NULL) {
1646 if (SimpleTextOut !=
NULL) {
1647 Status = SimpleTextOut->QueryMode (
1653 mBmmBootTextModeColumn = (UINT32)BootTextColumn;
1654 mBmmBootTextModeRow = (UINT32)BootTextRow;
1660 mBmmSetupHorizontalResolution =
PcdGet32 (PcdSetupVideoHorizontalResolution);
1661 mBmmSetupVerticalResolution =
PcdGet32 (PcdSetupVideoVerticalResolution);
1662 mBmmSetupTextModeColumn =
PcdGet32 (PcdSetupConOutColumn);
1663 mBmmSetupTextModeRow =
PcdGet32 (PcdSetupConOutRow);
1665 mBmmModeInitialized =
TRUE;
1695 Status =
gBS->InstallMultipleProtocolInterfaces (
1696 &mBmmCallbackInfo->BmmDriverHandle,
1697 &gEfiDevicePathProtocolGuid,
1698 &mBmmHiiVendorDevicePath,
1699 &gEfiHiiConfigAccessProtocolGuid,
1710 mBmmCallbackInfo->BmmDriverHandle,
1711 BootMaintenanceManagerBin,
1712 BootMaintenanceManagerUiLibStrings,
1715 ASSERT (mBmmCallbackInfo->BmmHiiHandle !=
NULL);
1720 Status =
gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid,
NULL, (VOID **)&mBmmCallbackInfo->FormBrowser2);
1727 ASSERT (Ptr !=
NULL);
1743 mBmmCallbackInfo->BmmPreviousPageId = FORM_MAIN_ID;
1744 mBmmCallbackInfo->BmmCurrentPageId = FORM_MAIN_ID;
1776 if (mStartOpCodeHandle !=
NULL) {
1780 if (mEndOpCodeHandle !=
NULL) {
1791 gBS->UninstallMultipleProtocolInterfaces (
1792 mBmmCallbackInfo->BmmDriverHandle,
1793 &gEfiDevicePathProtocolGuid,
1794 &mBmmHiiVendorDevicePath,
1795 &gEfiHiiConfigAccessProtocolGuid,
1800 FreePool (mBmmCallbackInfo->LoadContext);
1801 mBmmCallbackInfo->BmmDriverHandle =
NULL;
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
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)
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)
BM_MENU_ENTRY * BOpt_GetMenuEntry(BM_MENU_OPTION *MenuOption, UINTN MenuNumber)
EFI_STATUS Var_DelBootOption(VOID)
VOID UpdateConModePage(IN BMM_CALLBACK_DATA *CallbackData)
BM_MENU_OPTION DriverMenu
VOID CleanUpPage(IN UINT16 LabelId, IN BMM_CALLBACK_DATA *CallbackData)
VOID UpdateConCOMPage(IN BMM_CALLBACK_DATA *CallbackData)
EFI_STATUS Var_UpdateDriverOption(IN BMM_CALLBACK_DATA *CallbackData, IN EFI_HII_HANDLE HiiHandle, IN UINT16 *DescriptionData, IN UINT16 *OptionalData, IN UINT8 ForceReconnect)
EFI_STATUS GetAllConsoles(VOID)
VOID GetTerminalAttribute(IN BMM_CALLBACK_DATA *CallbackData)
COM_ATTR BaudRateList[19]
VOID UpdateDrvAddHandlePage(IN BMM_CALLBACK_DATA *CallbackData)
VOID GetConsoleOutCheck(IN BMM_CALLBACK_DATA *CallbackData)
EFI_STATUS Var_UpdateErrorOutOption(VOID)
EFI_STATUS BOpt_GetDriverOptions(IN BMM_CALLBACK_DATA *CallbackData)
VOID GetConsoleOutMode(IN BMM_CALLBACK_DATA *CallbackData)
VOID UpdateBootDelPage(IN BMM_CALLBACK_DATA *CallbackData)
BOOLEAN EFIAPI CreateDriverOptionFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
EFI_STATUS LocateSerialIo(VOID)
VOID CreateUpdateData(VOID)
EFI_STATUS Var_UpdateBootOrder(IN BMM_CALLBACK_DATA *CallbackData)
VOID GetConsoleErrCheck(IN BMM_CALLBACK_DATA *CallbackData)
EFI_STATUS Var_UpdateBootNext(IN BMM_CALLBACK_DATA *CallbackData)
VOID UpdatePageBody(IN UINT16 UpdatePageId, IN BMM_CALLBACK_DATA *CallbackData)
VOID UpdateTerminalPage(IN BMM_CALLBACK_DATA *CallbackData)
BOOLEAN EFIAPI CreateBootOptionFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
EFI_STATUS Var_UpdateConMode(IN BMM_CALLBACK_DATA *CallbackData)
BM_MENU_OPTION ConsoleErrMenu
BM_MENU_OPTION DriverOptionMenu
EFI_STATUS BOpt_FindDrivers(VOID)
VOID GetBootOrder(IN BMM_CALLBACK_DATA *CallbackData)
BM_MENU_OPTION ConsoleOutMenu
EFI_STATUS Var_UpdateConsoleInpOption(VOID)
EFI_STATUS Var_UpdateDriverOrder(IN BMM_CALLBACK_DATA *CallbackData)
BM_MENU_OPTION BootOptionMenu
EFI_STATUS FreeAllConsoles(VOID)
VOID GetConsoleInCheck(IN BMM_CALLBACK_DATA *CallbackData)
VOID UpdateDriverAddHandleDescPage(IN BMM_CALLBACK_DATA *CallbackData)
EFI_STATUS ChangeTerminalDevicePath(IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN ChangeTerminal)
VOID UpdatePageId(BMM_CALLBACK_DATA *Private, UINT16 NewPageId)
EFI_STATUS Var_UpdateBootOption(IN BMM_CALLBACK_DATA *CallbackData)
VOID GetDriverOrder(IN BMM_CALLBACK_DATA *CallbackData)
BM_MENU_OPTION ConsoleInpMenu
EFI_STATUS Var_UpdateConsoleOutOption(VOID)
VOID UpdateDrvDelPage(IN BMM_CALLBACK_DATA *CallbackData)
EFI_STATUS Var_DelDriverOption(VOID)
BOOLEAN EFIAPI BootFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
EFI_STATUS BOpt_GetBootOptions(IN BMM_CALLBACK_DATA *CallbackData)
VOID UiCustomizeBMMPage(IN EFI_HII_HANDLE HiiHandle, IN VOID *StartOpCodeHandle)
#define HARDWARE_DEVICE_PATH
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)
BOOLEAN EFIAPI HiiGetBrowserData(IN CONST EFI_GUID *VariableGuid OPTIONAL, IN CONST CHAR16 *VariableName OPTIONAL, IN UINTN BufferSize, OUT UINT8 *Buffer)
VOID *EFIAPI HiiAllocateOpCodeHandle(VOID)
VOID EFIAPI HiiFreeOpCodeHandle(VOID *OpCodeHandle)
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
UINT8 *EFIAPI HiiCreateGuidOpCode(IN VOID *OpCodeHandle, IN CONST EFI_GUID *Guid, IN CONST VOID *GuidOpCode OPTIONAL, IN UINTN OpCodeSize)
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)
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)
BOOLEAN EFIAPI HiiIsConfigHdrMatch(IN CONST EFI_STRING ConfigHdr, IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL)
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
#define EFI_IFR_EXTEND_OP_LABEL
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
EFI_RUNTIME_SERVICES * gRT
#define ARRAY_SIZE(Array)
#define OFFSET_OF(TYPE, Field)
#define ASSERT_EFI_ERROR(StatusParameter)
#define PcdGet16(TokenName)
#define PcdGet32(TokenName)
#define PcdSet32S(TokenName, Value)
VOID EFIAPI Exit(IN EFI_STATUS Status)
VOID EFIAPI EfiBootManagerRefreshAllBootOption(VOID)
EFI_HII_CONFIG_ROUTING_PROTOCOL * gHiiConfigRouting
EFI_HII_DATABASE_PROTOCOL * gHiiDatabase
#define EFI_VARIABLE_NON_VOLATILE
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE * Mode
EFI_SIMPLE_TEXT_OUTPUT_MODE * Mode
EFI_HII_CONFIG_ACCESS_PROTOCOL BmmConfigAccess
UINT32 VerticalResolution
UINT32 HorizontalResolution
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * Info
EFI_HANDLE ConsoleOutHandle