/** @file
handles console redirection from boot manager
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BootMaint.h"
{
(UINT8)(sizeof(UART_FLOW_CONTROL_DEVICE_PATH)),
};
/**
Check the device path node whether it's the Flow Control node or not.
@param[in] FlowControl The device path node to be checked.
@retval TRUE It's the Flow Control node.
@retval FALSE It's not.
**/
)
{
return (BOOLEAN) (
);
}
/**
Check whether the device path node is ISA Serial Node.
@param Acpi Device path node to be checked
@retval TRUE It's ISA Serial Node.
@retval FALSE It's NOT ISA Serial Node.
**/
)
{
return (BOOLEAN) (
);
}
/**
Update Com Ports attributes from DevicePath
@param DevicePath DevicePath that contains Com ports
@retval EFI_SUCCESS The update is successful.
**/
);
/**
Update the multi-instance device path of Terminal Device based on
the global TerminalMenu. If ChangeTernimal is TRUE, the terminal
device path in the Terminal Device in TerminalMenu is also updated.
@param DevicePath The multi-instance device path.
@param ChangeTerminal TRUE, then device path in the Terminal Device
in TerminalMenu is also updated; FALSE, no update.
@return EFI_SUCCESS The function completes successfully.
**/
)
{
Node = *DevicePath;
Com = 0;
while (!IsDevicePathEnd (Node)) {
if (IsIsaSerialNode (Acpi)) {
}
if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
CopyMem (
sizeof (UINT64)
);
CopyMem (
sizeof (UINT8)
);
CopyMem (
sizeof (UINT8)
);
CopyMem (
sizeof (UINT8)
);
if (IsUartFlowControlNode (FlowControlNode)) {
} else {
//
// Append the Flow control device node when user enable flow control.
//
if (NewTerminalContext->FlowControl != 0) {
);
}
}
//
// Change the device path in the ComPort
//
if (ChangeTerminal) {
while (!IsDevicePathEnd (Node1)) {
if ((DevicePathType (Node1) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node1) == MSG_UART_DP)) {
CopyMem (
sizeof (UINT64)
);
CopyMem (
sizeof (UINT8)
);
CopyMem (
sizeof (UINT8)
);
CopyMem (
sizeof (UINT8)
);
break;
}
//
// end if
//
}
//
// end while
//
break;
}
}
}
return EFI_SUCCESS;
}
/**
Update the device path that describing a terminal device
based on the new BaudRate, Data Bits, parity and Stop Bits
set.
@param DevicePath terminal device's path
**/
)
{
Node = DevicePath;
Com = 0;
while (!IsDevicePathEnd (Node)) {
if (IsIsaSerialNode (Acpi)) {
}
if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
);
CopyMem (
sizeof (UINT64)
);
CopyMem (
sizeof (UINT8)
);
CopyMem (
sizeof (UINT8)
);
CopyMem (
sizeof (UINT8)
);
}
}
}
/**
Retrieve ACPI UID of UART from device path
@param Handle The handle for the UART device.
@param AcpiUid The ACPI UID on output.
@retval TRUE Find valid UID from device path
@retval FALSE Can't find
**/
)
{
(VOID **) &DevicePath
);
return FALSE;
}
if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (DevicePath) == MSG_UART_DP)) {
break;
}
//
// Acpi points to the node before the Uart node
//
}
}
return TRUE;
} else {
return FALSE;
}
}
/**
Sort Uart handles array with Acpi->UID from low to high.
@param Handles EFI_SERIAL_IO_PROTOCOL handle buffer
@param NoHandles EFI_SERIAL_IO_PROTOCOL handle count
**/
)
{
continue;
}
continue;
}
if (AcpiUid2 < TempAcpiUid) {
}
}
}
}
/**
Test whether DevicePath is a valid Terminal
@param DevicePath DevicePath to be checked
@param Termi If DevicePath is valid Terminal, terminal type is returned.
@param Com If DevicePath is valid Terminal, Com Port type is returned.
@retval TRUE If DevicePath point to a Terminal.
@retval FALSE If DevicePath does not point to a Terminal.
**/
);
/**
Build a list containing all serial devices.
@retval EFI_SUCCESS The function complete successfully.
@retval EFI_UNSUPPORTED No serial ports present.
**/
)
{
//
// Get all handles that have SerialIo protocol installed
//
TerminalMenu.MenuNumber = 0;
NULL,
);
//
// No serial ports present
//
return EFI_UNSUPPORTED;
}
//
// Sort Uart handles array with Acpi->UID from low to high
// then Terminal menu can be built from low Acpi->UID to high Acpi->UID
//
//
// Check to see whether the handle has DevicePath Protocol installed
//
(VOID **) &DevicePath
);
if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
break;
}
//
// Acpi points to the node before Uart node
//
}
if (NewMenuEntry == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// BugBug: I have no choice, calling EfiLibStrFromDatahub will hang the system!
// coz' the misc data for each platform is not correct, actually it's the device path stored in
// datahub which is not completed, so a searching for end of device path will enter a
// dead-loop.
//
}
);
CopyMem (
sizeof (UINT64)
);
CopyMem (
sizeof (UINT8)
);
CopyMem (
sizeof (UINT8)
);
CopyMem (
sizeof (UINT8)
);
if ((FlowControl & EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE) != 0) {
}
}
}
}
//
// Get L"ConOut", L"ConIn" and L"ErrOut" from the Var
//
if (OutDevicePath != NULL) {
}
if (InpDevicePath != NULL) {
}
if (ErrDevicePath != NULL) {
}
if (NULL == NewMenuEntry) {
return EFI_NOT_FOUND;
}
);
}
//
// NewMenuEntry->HelpString = DevicePathToStr (NewDevicePath);
// NewMenuEntry->DisplayString = NewMenuEntry->HelpString;
//
}
}
}
}
}
return EFI_SUCCESS;
}
/**
Update Com Ports attributes from DevicePath
@param DevicePath DevicePath that contains Com ports
@retval EFI_SUCCESS The update is successful.
@retval EFI_NOT_FOUND Can not find specific menu entry
**/
)
{
Node = DevicePath;
TerminalNumber = 0;
while (!IsDevicePathEnd (Node)) {
if (IsIsaSerialNode (Acpi)) {
}
if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
if (NULL == NewMenuEntry) {
return EFI_NOT_FOUND;
}
CopyMem (
sizeof (UINT64)
);
CopyMem (
sizeof (UINT8)
);
CopyMem (
sizeof (UINT8)
);
CopyMem (
sizeof (UINT8)
);
if (IsUartFlowControlNode (FlowControlNode)) {
} else if (NewTerminalContext->FlowControl != 0) {
//
// No Flow Control device path node, assumption no Flow control
//
}
while (!IsDevicePathEnd (SerialNode)) {
if ((DevicePathType (SerialNode) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (SerialNode) == MSG_UART_DP)) {
//
// Update following device paths according to
// previous acquired uart attributes
//
CopyMem (
sizeof (UINT64)
);
CopyMem (
sizeof (UINT8)
);
CopyMem (
sizeof (UINT8)
);
CopyMem (
sizeof (UINT8)
);
if (IsUartFlowControlNode (FlowControlNode)) {
} else {
if (HasFlowControlNode) {
);
}
}
break;
}
}
//
// end while
//
}
}
//
// end while
//
}
return EFI_SUCCESS;
}
/**
Build up Console Menu based on types passed in. The type can
be BM_CONSOLE_IN_CONTEXT_SELECT, BM_CONSOLE_OUT_CONTEXT_SELECT
and BM_CONSOLE_ERR_CONTEXT_SELECT.
@param ConsoleMenuType Can be BM_CONSOLE_IN_CONTEXT_SELECT, BM_CONSOLE_OUT_CONTEXT_SELECT
and BM_CONSOLE_ERR_CONTEXT_SELECT.
@retval EFI_UNSUPPORTED The type passed in is not in the 3 types defined.
@retval EFI_NOT_FOUND If the EFI Variable defined in UEFI spec with name "ConOutDev",
"ConInDev" or "ConErrDev" doesn't exists.
@retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operations.
@retval EFI_SUCCESS Function completes successfully.
**/
)
{
DevicePath = NULL;
AllCount = 0;
switch (ConsoleMenuType) {
L"ConIn",
);
L"ConInDev",
);
break;
L"ConOut",
);
L"ConOutDev",
);
break;
L"ErrOut",
);
L"ErrOutDev",
);
break;
default:
return EFI_UNSUPPORTED;
}
if (NULL == AllDevicePath) {
return EFI_NOT_FOUND;
}
ConsoleMenu->MenuNumber = 0;
//
// Following is menu building up for Console Devices selected.
//
Index2 = 0;
if (NULL == NewMenuEntry) {
return EFI_OUT_OF_RESOURCES;
}
}
&Terminal,
&Com
);
);
if (NewConsoleContext->IsTerminal) {
} else {
Index2++;
}
}
return EFI_SUCCESS;
}
/**
Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
@retval EFI_SUCCESS The function always complete successfully.
**/
)
{
return EFI_SUCCESS;
}
/**
Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
@retval EFI_SUCCESS The function always complete successfully.
**/
)
{
return EFI_SUCCESS;
}
/**
Test whether DevicePath is a valid Terminal
@param DevicePath DevicePath to be checked
@param Termi If DevicePath is valid Terminal, terminal type is returned.
@param Com If DevicePath is valid Terminal, Com Port type is returned.
@retval TRUE If DevicePath point to a Terminal.
@retval FALSE If DevicePath does not point to a Terminal.
**/
)
{
IsTerminal = FALSE;
//
// Vendor points to the node before the End node
//
if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
}
//
// Acpi points to the node before the UART node
//
}
}
return FALSE;
}
//
// There are four kinds of Terminal types
// check to see whether this devicepath
// is one of that type
//
IsTerminal = TRUE;
} else {
IsTerminal = TRUE;
} else {
IsTerminal = TRUE;
} else {
IsTerminal = TRUE;
} else {
IsTerminal = FALSE;
}
}
}
}
if (!IsTerminal) {
return FALSE;
}
} else {
return FALSE;
}
return TRUE;
}
/**
Get mode number according to column and row
@param CallbackData The BMM context data.
**/
)
{
break;
}
}
}
}