2 Copyright (c) 2004 - 2008, Intel Corporation
3 All rights reserved. This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 handles console redirection from boot manager
24 #include "BootMaint.h"
26 EFI_DEVICE_PATH_PROTOCOL
*
27 DevicePathInstanceDup (
28 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
32 UpdateComAttributeFromVariable (
33 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
37 ChangeTerminalDevicePath (
38 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
39 BOOLEAN ChangeTerminal
42 EFI_DEVICE_PATH_PROTOCOL
*Node
;
43 EFI_DEVICE_PATH_PROTOCOL
*Node1
;
44 ACPI_HID_DEVICE_PATH
*Acpi
;
45 UART_DEVICE_PATH
*Uart
;
46 UART_DEVICE_PATH
*Uart1
;
49 BM_TERMINAL_CONTEXT
*NewTerminalContext
;
50 BM_MENU_ENTRY
*NewMenuEntry
;
52 Match
= EISA_PNP_ID (0x0501);
54 Node
= NextDevicePathNode (Node
);
56 while (!IsDevicePathEnd (Node
)) {
57 if ((DevicePathType (Node
) == ACPI_DEVICE_PATH
) && (DevicePathSubType (Node
) == ACPI_DP
)) {
58 Acpi
= (ACPI_HID_DEVICE_PATH
*) Node
;
59 if (CompareMem (&Acpi
->HID
, &Match
, sizeof (UINT32
)) == 0) {
60 CopyMem (&Com
, &Acpi
->UID
, sizeof (UINT32
));
64 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Com
);
65 if (NULL
== NewMenuEntry
) {
69 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
70 if ((DevicePathType (Node
) == MESSAGING_DEVICE_PATH
) && (DevicePathSubType (Node
) == MSG_UART_DP
)) {
71 Uart
= (UART_DEVICE_PATH
*) Node
;
74 &NewTerminalContext
->BaudRate
,
80 &NewTerminalContext
->DataBits
,
86 &NewTerminalContext
->Parity
,
92 &NewTerminalContext
->StopBits
,
96 // Change the device path in the ComPort
99 Node1
= NewTerminalContext
->DevicePath
;
100 Node1
= NextDevicePathNode (Node1
);
101 while (!IsDevicePathEnd (Node1
)) {
102 if ((DevicePathType (Node1
) == MESSAGING_DEVICE_PATH
) && (DevicePathSubType (Node1
) == MSG_UART_DP
)) {
103 Uart1
= (UART_DEVICE_PATH
*) Node1
;
106 &NewTerminalContext
->BaudRate
,
112 &NewTerminalContext
->DataBits
,
118 &NewTerminalContext
->Parity
,
124 &NewTerminalContext
->StopBits
,
132 Node1
= NextDevicePathNode (Node1
);
141 Node
= NextDevicePathNode (Node
);
149 ChangeVariableDevicePath (
150 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
153 EFI_DEVICE_PATH_PROTOCOL
*Node
;
154 ACPI_HID_DEVICE_PATH
*Acpi
;
155 UART_DEVICE_PATH
*Uart
;
158 BM_TERMINAL_CONTEXT
*NewTerminalContext
;
159 BM_MENU_ENTRY
*NewMenuEntry
;
161 Match
= EISA_PNP_ID (0x0501);
163 Node
= NextDevicePathNode (Node
);
165 while (!IsDevicePathEnd (Node
)) {
166 if ((DevicePathType (Node
) == ACPI_DEVICE_PATH
) && (DevicePathSubType (Node
) == ACPI_DP
)) {
167 Acpi
= (ACPI_HID_DEVICE_PATH
*) Node
;
168 if (CompareMem (&Acpi
->HID
, &Match
, sizeof (UINT32
)) == 0) {
169 CopyMem (&Com
, &Acpi
->UID
, sizeof (UINT32
));
173 if ((DevicePathType (Node
) == MESSAGING_DEVICE_PATH
) && (DevicePathSubType (Node
) == MSG_UART_DP
)) {
174 NewMenuEntry
= BOpt_GetMenuEntry (
178 ASSERT (NewMenuEntry
!= NULL
);
179 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
180 Uart
= (UART_DEVICE_PATH
*) Node
;
183 &NewTerminalContext
->BaudRate
,
189 &NewTerminalContext
->DataBits
,
195 &NewTerminalContext
->Parity
,
201 &NewTerminalContext
->StopBits
,
206 Node
= NextDevicePathNode (Node
);
214 IN EFI_HANDLE Handle
,
215 IN OUT UINT32
*AcpiUid
220 Retrieve ACPI UID of UART from device path
223 Handles - EFI_SERIAL_IO_PROTOCOL handle
226 TRUE - Find valid UID from device path
233 ACPI_HID_DEVICE_PATH
*Acpi
;
234 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
236 gBS
->HandleProtocol (
238 &gEfiDevicePathProtocolGuid
,
239 (VOID
**) &DevicePath
241 Ptr
= (UINT8
*) DevicePath
;
243 while (*Ptr
!= END_DEVICE_PATH_TYPE
) {
247 Ptr
= Ptr
- sizeof (UART_DEVICE_PATH
) - sizeof (ACPI_HID_DEVICE_PATH
);
248 Acpi
= (ACPI_HID_DEVICE_PATH
*) Ptr
;
249 Match
= EISA_PNP_ID (0x0501);
251 if (CompareMem (&Acpi
->HID
, &Match
, sizeof (UINT32
)) == 0) {
252 if (AcpiUid
!= NULL
) {
253 *AcpiUid
= Acpi
->UID
;
263 IN EFI_HANDLE
*Handles
,
269 Sort Uart handles array with Acpi->UID from low to high
272 Handles - EFI_SERIAL_IO_PROTOCOL handle buffer
273 NoHandles - EFI_SERIAL_IO_PROTOCOL handle count
286 EFI_HANDLE TempHandle
;
288 for (Index1
= 0; Index1
< NoHandles
-1; Index1
++) {
289 if (!RetrieveUartUid (Handles
[Index1
], &AcpiUid1
)) {
292 TempHandle
= Handles
[Index1
];
294 TempAcpiUid
= AcpiUid1
;
296 for (Index2
= Index1
+1; Index2
< NoHandles
; Index2
++) {
297 if (!RetrieveUartUid (Handles
[Index2
], &AcpiUid2
)) {
300 if (AcpiUid2
< TempAcpiUid
) {
301 TempAcpiUid
= AcpiUid2
;
302 TempHandle
= Handles
[Index2
];
306 Handles
[Position
] = Handles
[Index1
];
307 Handles
[Index1
] = TempHandle
;
312 IsTerminalDevicePath (
313 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
314 OUT TYPE_OF_TERMINAL
*Termi
,
325 Build a list containing all serial devices
339 ACPI_HID_DEVICE_PATH
*Acpi
;
340 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
342 EFI_SERIAL_IO_PROTOCOL
*SerialIo
;
343 EFI_DEVICE_PATH_PROTOCOL
*OutDevicePath
;
344 EFI_DEVICE_PATH_PROTOCOL
*InpDevicePath
;
345 EFI_DEVICE_PATH_PROTOCOL
*ErrDevicePath
;
346 BM_MENU_ENTRY
*NewMenuEntry
;
347 BM_TERMINAL_CONTEXT
*NewTerminalContext
;
348 EFI_DEVICE_PATH_PROTOCOL
*NewDevicePath
;
349 VENDOR_DEVICE_PATH Vendor
;
351 // Get all handles that have SerialIo protocol installed
353 InitializeListHead (&TerminalMenu
.Head
);
354 TerminalMenu
.MenuNumber
= 0;
355 Status
= gBS
->LocateHandleBuffer (
357 &gEfiSerialIoProtocolGuid
,
362 if (EFI_ERROR (Status
)) {
364 // No serial ports present
366 return EFI_UNSUPPORTED
;
370 // Sort Uart handles array with Acpi->UID from low to high
371 // then Terminal menu can be built from low Acpi->UID to high Acpi->UID
373 SortedUartHandle (Handles
, NoHandles
);
375 for (Index
= 0; Index
< NoHandles
; Index
++) {
377 // Check to see whether the handle has DevicePath Protocol installed
379 gBS
->HandleProtocol (
381 &gEfiDevicePathProtocolGuid
,
382 (VOID
**) &DevicePath
384 Ptr
= (UINT8
*) DevicePath
;
385 while (*Ptr
!= END_DEVICE_PATH_TYPE
) {
389 Ptr
= Ptr
- sizeof (UART_DEVICE_PATH
) - sizeof (ACPI_HID_DEVICE_PATH
);
390 Acpi
= (ACPI_HID_DEVICE_PATH
*) Ptr
;
391 Match
= EISA_PNP_ID (0x0501);
393 if (CompareMem (&Acpi
->HID
, &Match
, sizeof (UINT32
)) == 0) {
394 NewMenuEntry
= BOpt_CreateMenuEntry (BM_TERMINAL_CONTEXT_SELECT
);
396 SafeFreePool (Handles
);
397 return EFI_OUT_OF_RESOURCES
;
400 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
401 CopyMem (&NewMenuEntry
->OptionNumber
, &Acpi
->UID
, sizeof (UINT32
));
402 NewTerminalContext
->DevicePath
= DevicePathInstanceDup (DevicePath
);
404 // BugBug: I have no choice, calling EfiLibStrFromDatahub will hang the system!
405 // coz' the misc data for each platform is not correct, actually it's the device path stored in
406 // datahub which is not completed, so a searching for end of device path will enter a
409 NewMenuEntry
->DisplayString
= EfiLibStrFromDatahub (DevicePath
);
410 if (NULL
== NewMenuEntry
->DisplayString
) {
411 NewMenuEntry
->DisplayString
= DevicePathToStr (DevicePath
);
414 NewMenuEntry
->HelpString
= NULL
;
416 gBS
->HandleProtocol (
418 &gEfiSerialIoProtocolGuid
,
423 &NewTerminalContext
->BaudRate
,
424 &SerialIo
->Mode
->BaudRate
,
429 &NewTerminalContext
->DataBits
,
430 &SerialIo
->Mode
->DataBits
,
435 &NewTerminalContext
->Parity
,
436 &SerialIo
->Mode
->Parity
,
441 &NewTerminalContext
->StopBits
,
442 &SerialIo
->Mode
->StopBits
,
445 InsertTailList (&TerminalMenu
.Head
, &NewMenuEntry
->Link
);
446 TerminalMenu
.MenuNumber
++;
449 SafeFreePool (Handles
);
452 // Get L"ConOut", L"ConIn" and L"ErrOut" from the Var
454 OutDevicePath
= EfiLibGetVariable (L
"ConOut", &gEfiGlobalVariableGuid
);
455 InpDevicePath
= EfiLibGetVariable (L
"ConIn", &gEfiGlobalVariableGuid
);
456 ErrDevicePath
= EfiLibGetVariable (L
"ErrOut", &gEfiGlobalVariableGuid
);
458 UpdateComAttributeFromVariable (OutDevicePath
);
462 UpdateComAttributeFromVariable (InpDevicePath
);
466 UpdateComAttributeFromVariable (ErrDevicePath
);
469 for (Index
= 0; Index
< TerminalMenu
.MenuNumber
; Index
++) {
470 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Index
);
471 if (NULL
== NewMenuEntry
) {
472 return EFI_NOT_FOUND
;
475 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
477 NewTerminalContext
->TerminalType
= 0;
478 NewTerminalContext
->IsConIn
= FALSE
;
479 NewTerminalContext
->IsConOut
= FALSE
;
480 NewTerminalContext
->IsStdErr
= FALSE
;
482 Vendor
.Header
.Type
= MESSAGING_DEVICE_PATH
;
483 Vendor
.Header
.SubType
= MSG_VENDOR_DP
;
485 for (Index2
= 0; Index2
< 4; Index2
++) {
486 CopyMem (&Vendor
.Guid
, &Guid
[Index2
], sizeof (EFI_GUID
));
487 SetDevicePathNodeLength (&Vendor
.Header
, sizeof (VENDOR_DEVICE_PATH
));
488 NewDevicePath
= AppendDevicePathNode (
489 NewTerminalContext
->DevicePath
,
490 (EFI_DEVICE_PATH_PROTOCOL
*) &Vendor
492 SafeFreePool (NewMenuEntry
->HelpString
);
494 // NewMenuEntry->HelpString = DevicePathToStr (NewDevicePath);
495 // NewMenuEntry->DisplayString = NewMenuEntry->HelpString;
497 NewMenuEntry
->HelpString
= NULL
;
499 if (BdsLibMatchDevicePaths (OutDevicePath
, NewDevicePath
)) {
500 NewTerminalContext
->IsConOut
= TRUE
;
501 NewTerminalContext
->TerminalType
= (UINT8
) Index2
;
504 if (BdsLibMatchDevicePaths (InpDevicePath
, NewDevicePath
)) {
505 NewTerminalContext
->IsConIn
= TRUE
;
506 NewTerminalContext
->TerminalType
= (UINT8
) Index2
;
509 if (BdsLibMatchDevicePaths (ErrDevicePath
, NewDevicePath
)) {
510 NewTerminalContext
->IsStdErr
= TRUE
;
511 NewTerminalContext
->TerminalType
= (UINT8
) Index2
;
520 UpdateComAttributeFromVariable (
521 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
526 Update Com Ports attributes from DevicePath
529 DevicePath - DevicePath that contains Com ports
535 EFI_DEVICE_PATH_PROTOCOL
*Node
;
536 EFI_DEVICE_PATH_PROTOCOL
*SerialNode
;
537 ACPI_HID_DEVICE_PATH
*Acpi
;
538 UART_DEVICE_PATH
*Uart
;
539 UART_DEVICE_PATH
*Uart1
;
541 UINTN TerminalNumber
;
542 BM_MENU_ENTRY
*NewMenuEntry
;
543 BM_TERMINAL_CONTEXT
*NewTerminalContext
;
546 Match
= EISA_PNP_ID (0x0501);
548 Node
= NextDevicePathNode (Node
);
550 for (Index
= 0; Index
< TerminalMenu
.MenuNumber
; Index
++) {
551 while (!IsDevicePathEnd (Node
)) {
552 if ((DevicePathType (Node
) == ACPI_DEVICE_PATH
) && (DevicePathSubType (Node
) == ACPI_DP
)) {
553 Acpi
= (ACPI_HID_DEVICE_PATH
*) Node
;
554 if (CompareMem (&Acpi
->HID
, &Match
, sizeof (UINT32
)) == 0) {
555 CopyMem (&TerminalNumber
, &Acpi
->UID
, sizeof (UINT32
));
559 if ((DevicePathType (Node
) == MESSAGING_DEVICE_PATH
) && (DevicePathSubType (Node
) == MSG_UART_DP
)) {
560 Uart
= (UART_DEVICE_PATH
*) Node
;
561 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, TerminalNumber
);
562 if (NULL
== NewMenuEntry
) {
563 return EFI_NOT_FOUND
;
566 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
568 &NewTerminalContext
->BaudRate
,
574 &NewTerminalContext
->DataBits
,
580 &NewTerminalContext
->Parity
,
586 &NewTerminalContext
->StopBits
,
591 SerialNode
= NewTerminalContext
->DevicePath
;
592 SerialNode
= NextDevicePathNode (SerialNode
);
593 while (!IsDevicePathEnd (SerialNode
)) {
594 if ((DevicePathType (SerialNode
) == MESSAGING_DEVICE_PATH
) && (DevicePathSubType (SerialNode
) == MSG_UART_DP
)) {
596 // Update following device paths according to
597 // previous acquired uart attributes
599 Uart1
= (UART_DEVICE_PATH
*) SerialNode
;
602 &NewTerminalContext
->BaudRate
,
608 &NewTerminalContext
->DataBits
,
613 &NewTerminalContext
->Parity
,
618 &NewTerminalContext
->StopBits
,
625 SerialNode
= NextDevicePathNode (SerialNode
);
632 Node
= NextDevicePathNode (Node
);
642 EFI_DEVICE_PATH_PROTOCOL
*
643 DevicePathInstanceDup (
644 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
649 Function creates a device path data structure that identically matches the
650 device path passed in.
653 DevPath - A pointer to a device path data structure.
657 The new copy of DevPath is created to identically match the input.
658 Otherwise, NULL is returned.
662 EFI_DEVICE_PATH_PROTOCOL
*NewDevPath
;
663 EFI_DEVICE_PATH_PROTOCOL
*DevicePathInst
;
664 EFI_DEVICE_PATH_PROTOCOL
*Temp
;
669 // get the size of an instance from the input
672 DevicePathInst
= GetNextDevicePathInstance (&Temp
, &Size
);
675 // Make a copy and set proper end type
679 NewDevPath
= EfiAllocateZeroPool (Size
);
680 ASSERT (NewDevPath
!= NULL
);
684 CopyMem (NewDevPath
, DevicePathInst
, Size
);
685 Ptr
= (UINT8
*) NewDevPath
;
686 Ptr
+= Size
- sizeof (EFI_DEVICE_PATH_PROTOCOL
);
687 Temp
= (EFI_DEVICE_PATH_PROTOCOL
*) Ptr
;
688 SetDevicePathEndNode (Temp
);
696 IN UINTN ConsoleMenuType
699 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
700 EFI_DEVICE_PATH_PROTOCOL
*AllDevicePath
;
701 EFI_DEVICE_PATH_PROTOCOL
*MultiDevicePath
;
702 EFI_DEVICE_PATH_PROTOCOL
*DevicePathInst
;
707 BM_MENU_ENTRY
*NewMenuEntry
;
708 BM_CONSOLE_CONTEXT
*NewConsoleContext
;
709 TYPE_OF_TERMINAL Terminal
;
711 BM_MENU_OPTION
*ConsoleMenu
;
714 AllDevicePath
= NULL
;
716 switch (ConsoleMenuType
) {
717 case BM_CONSOLE_IN_CONTEXT_SELECT
:
718 ConsoleMenu
= &ConsoleInpMenu
;
719 DevicePath
= EfiLibGetVariable (
721 &gEfiGlobalVariableGuid
724 AllDevicePath
= EfiLibGetVariable (
726 &gEfiGlobalVariableGuid
730 case BM_CONSOLE_OUT_CONTEXT_SELECT
:
731 ConsoleMenu
= &ConsoleOutMenu
;
732 DevicePath
= EfiLibGetVariable (
734 &gEfiGlobalVariableGuid
737 AllDevicePath
= EfiLibGetVariable (
739 &gEfiGlobalVariableGuid
743 case BM_CONSOLE_ERR_CONTEXT_SELECT
:
744 ConsoleMenu
= &ConsoleErrMenu
;
745 DevicePath
= EfiLibGetVariable (
747 &gEfiGlobalVariableGuid
750 AllDevicePath
= EfiLibGetVariable (
752 &gEfiGlobalVariableGuid
757 return EFI_UNSUPPORTED
;
760 if (NULL
== AllDevicePath
) {
761 return EFI_NOT_FOUND
;
764 InitializeListHead (&ConsoleMenu
->Head
);
766 AllCount
= EfiDevicePathInstanceCount (AllDevicePath
);
767 ConsoleMenu
->MenuNumber
= 0;
769 // Following is menu building up for Console Out Devices
771 MultiDevicePath
= AllDevicePath
;
773 for (Index
= 0; Index
< AllCount
; Index
++) {
774 DevicePathInst
= GetNextDevicePathInstance (&MultiDevicePath
, &Size
);
776 NewMenuEntry
= BOpt_CreateMenuEntry (BM_CONSOLE_CONTEXT_SELECT
);
777 if (NULL
== NewMenuEntry
) {
778 return EFI_OUT_OF_RESOURCES
;
781 NewConsoleContext
= (BM_CONSOLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
782 NewMenuEntry
->OptionNumber
= Index2
;
784 NewConsoleContext
->DevicePath
= DevicePathInstanceDup (DevicePathInst
);
785 NewMenuEntry
->DisplayString
= EfiLibStrFromDatahub (NewConsoleContext
->DevicePath
);
786 if (NULL
== NewMenuEntry
->DisplayString
) {
787 NewMenuEntry
->DisplayString
= DevicePathToStr (NewConsoleContext
->DevicePath
);
790 NewConsoleContext
->IsTerminal
= IsTerminalDevicePath (
791 NewConsoleContext
->DevicePath
,
796 NewConsoleContext
->IsActive
= BdsLibMatchDevicePaths (
798 NewConsoleContext
->DevicePath
801 if (NewConsoleContext
->IsTerminal
) {
802 BOpt_DestroyMenuEntry (NewMenuEntry
);
805 ConsoleMenu
->MenuNumber
++;
806 InsertTailList (&ConsoleMenu
->Head
, &NewMenuEntry
->Link
);
820 Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
830 GetConsoleMenu (BM_CONSOLE_IN_CONTEXT_SELECT
);
831 GetConsoleMenu (BM_CONSOLE_OUT_CONTEXT_SELECT
);
832 GetConsoleMenu (BM_CONSOLE_ERR_CONTEXT_SELECT
);
843 Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
853 BOpt_FreeMenu (&ConsoleOutMenu
);
854 BOpt_FreeMenu (&ConsoleInpMenu
);
855 BOpt_FreeMenu (&ConsoleErrMenu
);
856 BOpt_FreeMenu (&TerminalMenu
);
861 IsTerminalDevicePath (
862 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
863 OUT TYPE_OF_TERMINAL
*Termi
,
869 Test whether DevicePath is a valid Terminal
872 DevicePath - DevicePath to be checked
873 Termi - If is terminal, give its type
874 Com - If is Com Port, give its type
877 TRUE - If DevicePath point to a Terminal
884 VENDOR_DEVICE_PATH
*Vendor
;
885 ACPI_HID_DEVICE_PATH
*Acpi
;
892 // Parse the Device Path, should be change later!!!
894 Ptr
= (UINT8
*) DevicePath
;
895 while (*Ptr
!= END_DEVICE_PATH_TYPE
) {
899 Ptr
= Ptr
- sizeof (VENDOR_DEVICE_PATH
);
900 Vendor
= (VENDOR_DEVICE_PATH
*) Ptr
;
903 // There are four kinds of Terminal types
904 // check to see whether this devicepath
905 // is one of that type
907 CopyMem (&TempGuid
, &Vendor
->Guid
, sizeof (EFI_GUID
));
909 if (CompareGuid (&TempGuid
, &Guid
[0])) {
913 if (CompareGuid (&TempGuid
, &Guid
[1])) {
917 if (CompareGuid (&TempGuid
, &Guid
[2])) {
918 *Termi
= VT_100_PLUS
;
921 if (CompareGuid (&TempGuid
, &Guid
[3])) {
935 Ptr
= Ptr
- sizeof (UART_DEVICE_PATH
) - sizeof (ACPI_HID_DEVICE_PATH
);
936 Acpi
= (ACPI_HID_DEVICE_PATH
*) Ptr
;
937 Match
= EISA_PNP_ID (0x0501);
938 if (CompareMem (&Acpi
->HID
, &Match
, sizeof (UINT32
)) == 0) {
939 CopyMem (Com
, &Acpi
->UID
, sizeof (UINT32
));
949 IN BMM_CALLBACK_DATA
*CallbackData
954 Get mode number according to column and row
957 CallbackData - BMM_CALLBACK_DATA
971 CONSOLE_OUT_MODE
*ModeInfo
;
972 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*ConOut
;
974 ConOut
= gST
->ConOut
;
975 MaxMode
= (UINTN
) (ConOut
->Mode
->MaxMode
);
976 ModeInfo
= EfiLibGetVariable (VarConOutMode
, &gEfiGenericPlatformVariableGuid
);
978 if (ModeInfo
!= NULL
) {
979 CurrentCol
= ModeInfo
->Column
;
980 CurrentRow
= ModeInfo
->Row
;
981 for (Mode
= 0; Mode
< MaxMode
; Mode
++) {
982 Status
= ConOut
->QueryMode (ConOut
, Mode
, &Col
, &Row
);
983 if (!EFI_ERROR(Status
)) {
984 if (CurrentCol
== Col
&& CurrentRow
== Row
) {
985 CallbackData
->BmmFakeNvData
.ConsoleOutMode
= (UINT16
) Mode
;
991 SafeFreePool (ModeInfo
);