34 if ((Multi ==
NULL) || (Single ==
NULL)) {
44 while (DevicePathInst !=
NULL) {
49 if (
CompareMem (Single, DevicePathInst, Size) == 0) {
110 IN BOOLEAN ChangeTerminal
138 &NewTerminalContext->BaudRate,
144 &NewTerminalContext->DataBits,
150 &NewTerminalContext->Parity,
156 &NewTerminalContext->StopBits,
162 if (ChangeTerminal) {
163 Node1 = NewTerminalContext->DevicePath;
170 &NewTerminalContext->BaudRate,
176 &NewTerminalContext->DataBits,
182 &NewTerminalContext->Parity,
188 &NewTerminalContext->StopBits,
247 ASSERT (NewMenuEntry !=
NULL);
252 &NewTerminalContext->BaudRate,
258 &NewTerminalContext->DataBits,
264 &NewTerminalContext->Parity,
270 &NewTerminalContext->StopBits,
292 IN OUT UINT32 *AcpiUid
299 Status =
gBS->HandleProtocol (
301 &gEfiDevicePathProtocolGuid,
304 if (EFI_ERROR (Status)) {
321 if (AcpiUid !=
NULL) {
322 CopyMem (AcpiUid, &Acpi->
UID, sizeof (UINT32));
351 for (Index1 = 0; Index1 < NoHandles-1; Index1++) {
356 TempHandle = Handles[Index1];
358 TempAcpiUid = AcpiUid1;
360 for (Index2 = Index1+1; Index2 < NoHandles; Index2++) {
365 if (AcpiUid2 < TempAcpiUid) {
366 TempAcpiUid = AcpiUid2;
367 TempHandle = Handles[Index2];
372 Handles[Position] = Handles[Index1];
373 Handles[Index1] = TempHandle;
392 OUT TYPE_OF_TERMINAL *Termi,
430 TerminalMenu.MenuNumber = 0;
431 Status =
gBS->LocateHandleBuffer (
433 &gEfiSerialIoProtocolGuid,
438 if (EFI_ERROR (Status)) {
442 return EFI_UNSUPPORTED;
451 for (Index = 0; Index < NoHandles; Index++) {
455 gBS->HandleProtocol (
457 &gEfiDevicePathProtocolGuid,
475 if (NewMenuEntry ==
NULL) {
477 return EFI_OUT_OF_RESOURCES;
481 CopyMem (&NewMenuEntry->OptionNumber, &Acpi->
UID, sizeof (UINT32));
490 if (
NULL == NewMenuEntry->DisplayString) {
494 NewMenuEntry->HelpString =
NULL;
496 NewMenuEntry->DisplayStringToken =
HiiSetString (mBmmCallbackInfo->BmmHiiHandle, 0, NewMenuEntry->DisplayString,
NULL);
498 NewMenuEntry->HelpStringToken = NewMenuEntry->DisplayStringToken;
500 gBS->HandleProtocol (
502 &gEfiSerialIoProtocolGuid,
507 &NewTerminalContext->BaudRate,
508 &SerialIo->Mode->BaudRate,
513 &NewTerminalContext->DataBits,
514 &SerialIo->Mode->DataBits,
519 &NewTerminalContext->Parity,
520 &SerialIo->Mode->Parity,
525 &NewTerminalContext->StopBits,
526 &SerialIo->Mode->StopBits,
530 TerminalMenu.MenuNumber++;
534 if (Handles !=
NULL) {
544 if (OutDevicePath !=
NULL) {
548 if (InpDevicePath !=
NULL) {
552 if (ErrDevicePath !=
NULL) {
556 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
558 if (
NULL == NewMenuEntry) {
559 return EFI_NOT_FOUND;
564 NewTerminalContext->TerminalType = 0;
565 NewTerminalContext->IsConIn =
FALSE;
566 NewTerminalContext->IsConOut =
FALSE;
567 NewTerminalContext->IsStdErr =
FALSE;
570 Vendor.Header.
SubType = MSG_VENDOR_DP;
576 NewTerminalContext->DevicePath,
579 if (NewMenuEntry->HelpString !=
NULL) {
580 FreePool (NewMenuEntry->HelpString);
587 NewMenuEntry->HelpString =
NULL;
589 NewMenuEntry->DisplayStringToken =
HiiSetString (mBmmCallbackInfo->BmmHiiHandle, 0, NewMenuEntry->DisplayString,
NULL);
591 NewMenuEntry->HelpStringToken = NewMenuEntry->DisplayStringToken;
594 NewTerminalContext->IsConOut =
TRUE;
595 NewTerminalContext->TerminalType = (UINT8)Index2;
599 NewTerminalContext->IsConIn =
TRUE;
600 NewTerminalContext->TerminalType = (UINT8)Index2;
604 NewTerminalContext->IsStdErr =
TRUE;
605 NewTerminalContext->TerminalType = (UINT8)Index2;
631 UINTN TerminalNumber;
639 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
643 CopyMem (&TerminalNumber, &Acpi->
UID, sizeof (UINT32));
649 if (
NULL == NewMenuEntry) {
650 return EFI_NOT_FOUND;
655 &NewTerminalContext->BaudRate,
661 &NewTerminalContext->DataBits,
667 &NewTerminalContext->Parity,
673 &NewTerminalContext->StopBits,
678 SerialNode = NewTerminalContext->DevicePath;
689 &NewTerminalContext->BaudRate,
695 &NewTerminalContext->DataBits,
700 &NewTerminalContext->Parity,
705 &NewTerminalContext->StopBits,
761 TYPE_OF_TERMINAL Terminal;
766 AllDevicePath =
NULL;
768 switch (ConsoleMenuType) {
769 case BM_CONSOLE_IN_CONTEXT_SELECT:
775 case BM_CONSOLE_OUT_CONTEXT_SELECT:
781 case BM_CONSOLE_ERR_CONTEXT_SELECT:
788 return EFI_UNSUPPORTED;
791 if (
NULL == AllDevicePath) {
792 return EFI_NOT_FOUND;
798 ConsoleMenu->MenuNumber = 0;
802 MultiDevicePath = AllDevicePath;
804 for (Index = 0; Index < AllCount; Index++) {
808 if (
NULL == NewMenuEntry) {
809 return EFI_OUT_OF_RESOURCES;
813 NewMenuEntry->OptionNumber = Index2;
816 ASSERT (NewConsoleContext->DevicePath !=
NULL);
818 if (
NULL == NewMenuEntry->DisplayString) {
822 NewMenuEntry->DisplayStringToken =
HiiSetString (mBmmCallbackInfo->BmmHiiHandle, 0, NewMenuEntry->DisplayString,
NULL);
824 if (
NULL == NewMenuEntry->HelpString) {
825 NewMenuEntry->HelpStringToken = NewMenuEntry->DisplayStringToken;
827 NewMenuEntry->HelpStringToken =
HiiSetString (mBmmCallbackInfo->BmmHiiHandle, 0, NewMenuEntry->HelpString,
NULL);
831 NewConsoleContext->DevicePath,
838 NewConsoleContext->DevicePath
841 if (NewConsoleContext->IsTerminal) {
845 ConsoleMenu->MenuNumber++;
902 OUT TYPE_OF_TERMINAL *Termi,
936 if ((Vendor ==
NULL) ||
994 MaxMode = (
UINTN)(ConOut->Mode->MaxMode);
996 CurrentCol =
PcdGet32 (PcdSetupConOutColumn);
997 CurrentRow =
PcdGet32 (PcdSetupConOutRow);
998 for (Mode = 0; Mode < MaxMode; Mode++) {
999 Status = ConOut->QueryMode (ConOut, Mode, &Col, &Row);
1000 if (!EFI_ERROR (Status)) {
1001 if ((CurrentCol == Col) && (CurrentRow == Row)) {
1002 CallbackData->BmmFakeNvData.ConsoleOutMode = (UINT16)Mode;
1028 ASSERT (CallbackData !=
NULL);
1030 ConInCheck = &CallbackData->BmmFakeNvData.ConsoleInCheck[0];
1032 (Index < MAX_MENU_NUMBER)); Index++)
1036 ConInCheck[Index] = NewConsoleContext->IsActive;
1039 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
1043 ConInCheck[Index +
ConsoleInpMenu.MenuNumber] = NewTerminalContext->IsConIn;
1066 ASSERT (CallbackData !=
NULL);
1067 ConOutCheck = &CallbackData->BmmFakeNvData.ConsoleOutCheck[0];
1069 (Index < MAX_MENU_NUMBER)); Index++)
1073 ConOutCheck[Index] = NewConsoleContext->IsActive;
1076 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
1080 ConOutCheck[Index +
ConsoleOutMenu.MenuNumber] = NewTerminalContext->IsConOut;
1103 ASSERT (CallbackData !=
NULL);
1104 ConErrCheck = &CallbackData->BmmFakeNvData.ConsoleErrCheck[0];
1106 (Index < MAX_MENU_NUMBER)); Index++)
1110 ConErrCheck[Index] = NewConsoleContext->IsActive;
1113 for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
1117 ConErrCheck[Index +
ConsoleErrMenu.MenuNumber] = NewTerminalContext->IsStdErr;
1137 UINT16 TerminalIndex;
1138 UINT8 AttributeIndex;
1140 ASSERT (CallbackData !=
NULL);
1142 CurrentFakeNVMap = &CallbackData->BmmFakeNvData;
1143 for (TerminalIndex = 0; ((TerminalIndex < TerminalMenu.MenuNumber) && \
1144 (TerminalIndex < MAX_MENU_NUMBER)); TerminalIndex++)
1149 if (NewTerminalContext->BaudRate == (UINT64)(
BaudRateList[AttributeIndex].Value)) {
1150 NewTerminalContext->BaudRateIndex = AttributeIndex;
1156 if (NewTerminalContext->DataBits == (UINT64)(
DataBitsList[AttributeIndex].Value)) {
1157 NewTerminalContext->DataBitsIndex = AttributeIndex;
1163 if (NewTerminalContext->Parity == (UINT64)(
ParityList[AttributeIndex].Value)) {
1164 NewTerminalContext->ParityIndex = AttributeIndex;
1170 if (NewTerminalContext->StopBits == (UINT64)(
StopBitsList[AttributeIndex].Value)) {
1171 NewTerminalContext->StopBitsIndex = AttributeIndex;
1176 CurrentFakeNVMap->COMBaudRate[TerminalIndex] = NewTerminalContext->BaudRateIndex;
1177 CurrentFakeNVMap->COMDataRate[TerminalIndex] = NewTerminalContext->DataBitsIndex;
1178 CurrentFakeNVMap->COMStopBits[TerminalIndex] = NewTerminalContext->StopBitsIndex;
1179 CurrentFakeNVMap->COMParity[TerminalIndex] = NewTerminalContext->ParityIndex;
1180 CurrentFakeNVMap->COMTerminalType[TerminalIndex] = NewTerminalContext->TerminalType;
1181 CurrentFakeNVMap->COMFlowControl[TerminalIndex] = NewTerminalContext->FlowControl;
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
UINT32 EFIAPI ReadUnaligned32(IN CONST UINT32 *Buffer)
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)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
UINTN EfiDevicePathInstanceCount(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
UINT16 * EfiLibStrFromDatahub(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
CHAR16 * UiDevicePathToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
VOID BOpt_FreeMenu(BM_MENU_OPTION *FreeMenu)
BM_MENU_ENTRY * BOpt_GetMenuEntry(BM_MENU_OPTION *MenuOption, UINTN MenuNumber)
VOID BOpt_DestroyMenuEntry(BM_MENU_ENTRY *MenuEntry)
BM_MENU_ENTRY * BOpt_CreateMenuEntry(UINTN MenuType)
COM_ATTR BaudRateList[19]
BM_MENU_OPTION ConsoleErrMenu
BM_MENU_OPTION ConsoleOutMenu
BM_MENU_OPTION ConsoleInpMenu
EFI_GUID TerminalTypeGuid[9]
VOID ChangeVariableDevicePath(IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath)
BOOLEAN MatchDevicePaths(IN EFI_DEVICE_PATH_PROTOCOL *Multi, IN EFI_DEVICE_PATH_PROTOCOL *Single)
EFI_STATUS GetAllConsoles(VOID)
VOID GetTerminalAttribute(IN BMM_CALLBACK_DATA *CallbackData)
VOID GetConsoleOutCheck(IN BMM_CALLBACK_DATA *CallbackData)
VOID GetConsoleOutMode(IN BMM_CALLBACK_DATA *CallbackData)
EFI_STATUS LocateSerialIo(VOID)
VOID GetConsoleErrCheck(IN BMM_CALLBACK_DATA *CallbackData)
VOID SortedUartHandle(IN EFI_HANDLE *Handles, IN UINTN NoHandles)
EFI_STATUS GetConsoleMenu(IN UINTN ConsoleMenuType)
EFI_STATUS UpdateComAttributeFromVariable(EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS FreeAllConsoles(VOID)
VOID GetConsoleInCheck(IN BMM_CALLBACK_DATA *CallbackData)
BOOLEAN RetrieveUartUid(IN EFI_HANDLE Handle, IN OUT UINT32 *AcpiUid)
EFI_STATUS ChangeTerminalDevicePath(IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN ChangeTerminal)
BOOLEAN IsTerminalDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT TYPE_OF_TERMINAL *Termi, OUT UINTN *Com)
BOOLEAN IsIsaSerialNode(IN ACPI_HID_DEVICE_PATH *Acpi)
#define MESSAGING_DEVICE_PATH
UINT8 EFIAPI DevicePathType(IN CONST VOID *Node)
UINT16 EFIAPI SetDevicePathNodeLength(IN OUT VOID *Node, IN UINTN Length)
UINT8 EFIAPI DevicePathSubType(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI AppendDevicePathNode(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL)
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI GetNextDevicePathInstance(IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT UINTN *Size)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DuplicateDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
#define ARRAY_SIZE(Array)
#define PcdGet32(TokenName)
EFI_STATUS EFIAPI GetEfiGlobalVariable2(IN CONST CHAR16 *Name, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut