mirror of https://github.com/acidanthera/audk.git
Updated to use new PCD settings
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3664 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
29c3622cdf
commit
6b88ceec9b
|
@ -65,7 +65,14 @@
|
||||||
gEfiSerialIoProtocolGuid # PROTOCOL BY_START
|
gEfiSerialIoProtocolGuid # PROTOCOL BY_START
|
||||||
gEfiDevicePathProtocolGuid # PROTOCOL TO_START
|
gEfiDevicePathProtocolGuid # PROTOCOL TO_START
|
||||||
|
|
||||||
|
|
||||||
[PcdsFeatureFlag.common]
|
[PcdsFeatureFlag.common]
|
||||||
PcdNtEmulatorEnable|gEfiMdeModulePkgTokenSpaceGuid
|
PcdNtEmulatorEnable|gEfiMdeModulePkgTokenSpaceGuid
|
||||||
|
|
||||||
|
|
||||||
|
[PcdsFixedAtBuild.common]
|
||||||
|
PcdUartDefaultBaudRate|gEfiMdePkgTokenSpaceGuid|115200
|
||||||
|
PcdUartDefaultDataBits|gEfiMdePkgTokenSpaceGuid|8
|
||||||
|
PcdUartDefaultParity|gEfiMdePkgTokenSpaceGuid|1
|
||||||
|
PcdUartDefaultStopBits|gEfiMdePkgTokenSpaceGuid|1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,63 @@ EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
SERIAL_DEV gSerialDevTempate = {
|
||||||
|
SERIAL_DEV_SIGNATURE,
|
||||||
|
NULL,
|
||||||
|
{ // SerialIo
|
||||||
|
SERIAL_IO_INTERFACE_REVISION,
|
||||||
|
IsaSerialReset,
|
||||||
|
IsaSerialSetAttributes,
|
||||||
|
IsaSerialSetControl,
|
||||||
|
IsaSerialGetControl,
|
||||||
|
IsaSerialWrite,
|
||||||
|
IsaSerialRead,
|
||||||
|
NULL
|
||||||
|
},
|
||||||
|
{ // SerialMode
|
||||||
|
SERIAL_PORT_DEFAULT_CONTROL_MASK,
|
||||||
|
SERIAL_PORT_DEFAULT_TIMEOUT,
|
||||||
|
FixedPcdGet64 (PcdUartDefaultBaudRate), // BaudRate
|
||||||
|
SERIAL_PORT_DEFAULT_RECEIVE_FIFO_DEPTH,
|
||||||
|
FixedPcdGet8 (PcdUartDefaultDataBits), // DataBits
|
||||||
|
FixedPcdGet8 (PcdUartDefaultParity), // Parity
|
||||||
|
FixedPcdGet8 (PcdUartDefaultStopBits) // StopBits
|
||||||
|
},
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
{ // UartDevicePath
|
||||||
|
{
|
||||||
|
MESSAGING_DEVICE_PATH,
|
||||||
|
MSG_UART_DP,
|
||||||
|
(UINT8) (sizeof (UART_DEVICE_PATH)),
|
||||||
|
(UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8),
|
||||||
|
},
|
||||||
|
0,
|
||||||
|
FixedPcdGet64 (PcdUartDefaultBaudRate),
|
||||||
|
FixedPcdGet8 (PcdUartDefaultDataBits),
|
||||||
|
FixedPcdGet8 (PcdUartDefaultParity),
|
||||||
|
FixedPcdGet8 (PcdUartDefaultStopBits)
|
||||||
|
},
|
||||||
|
NULL,
|
||||||
|
0, //BaseAddress
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
SERIAL_MAX_BUFFER_SIZE,
|
||||||
|
{ 0 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
SERIAL_MAX_BUFFER_SIZE,
|
||||||
|
{ 0 }
|
||||||
|
},
|
||||||
|
FALSE,
|
||||||
|
FALSE,
|
||||||
|
UART16550A,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The user Entry Point for module IsaSerial. The user code starts with this function.
|
The user Entry Point for module IsaSerial. The user code starts with this function.
|
||||||
|
|
||||||
|
@ -39,7 +96,7 @@ EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver = {
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InitializeIsaSerial(
|
InitializeIsaSerial (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
|
@ -333,17 +390,15 @@ SerialControllerDriverStart (
|
||||||
//
|
//
|
||||||
// Initialize the serial device instance
|
// Initialize the serial device instance
|
||||||
//
|
//
|
||||||
SerialDevice = AllocatePool (sizeof (SERIAL_DEV));
|
SerialDevice = AllocateCopyPool (sizeof (SERIAL_DEV), &gSerialDevTempate);
|
||||||
if (SerialDevice == NULL) {
|
if (SerialDevice == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMem (SerialDevice, sizeof (SERIAL_DEV));
|
SerialDevice->SerialIo.Mode = &(SerialDevice->SerialMode);
|
||||||
|
|
||||||
SerialDevice->IsaIo = IsaIo;
|
SerialDevice->IsaIo = IsaIo;
|
||||||
SerialDevice->ParentDevicePath = ParentDevicePath;
|
SerialDevice->ParentDevicePath = ParentDevicePath;
|
||||||
SerialDevice->ControllerNameTable = NULL;
|
|
||||||
|
|
||||||
ADD_SERIAL_NAME (SerialDevice, IsaIo);
|
ADD_SERIAL_NAME (SerialDevice, IsaIo);
|
||||||
|
|
||||||
|
@ -371,30 +426,6 @@ SerialControllerDriverStart (
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
SerialDevice->Signature = SERIAL_DEV_SIGNATURE;
|
|
||||||
SerialDevice->Type = UART16550A;
|
|
||||||
SerialDevice->SoftwareLoopbackEnable = FALSE;
|
|
||||||
SerialDevice->HardwareFlowControl = FALSE;
|
|
||||||
SerialDevice->Handle = NULL;
|
|
||||||
SerialDevice->Receive.First = 0;
|
|
||||||
SerialDevice->Receive.Last = 0;
|
|
||||||
SerialDevice->Receive.Surplus = SERIAL_MAX_BUFFER_SIZE;
|
|
||||||
SerialDevice->Transmit.First = 0;
|
|
||||||
SerialDevice->Transmit.Last = 0;
|
|
||||||
SerialDevice->Transmit.Surplus = SERIAL_MAX_BUFFER_SIZE;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Serial I/O
|
|
||||||
//
|
|
||||||
SerialDevice->SerialIo.Revision = SERIAL_IO_INTERFACE_REVISION;
|
|
||||||
SerialDevice->SerialIo.Reset = IsaSerialReset;
|
|
||||||
SerialDevice->SerialIo.SetAttributes = IsaSerialSetAttributes;
|
|
||||||
SerialDevice->SerialIo.SetControl = IsaSerialSetControl;
|
|
||||||
SerialDevice->SerialIo.GetControl = IsaSerialGetControl;
|
|
||||||
SerialDevice->SerialIo.Write = IsaSerialWrite;
|
|
||||||
SerialDevice->SerialIo.Read = IsaSerialRead;
|
|
||||||
SerialDevice->SerialIo.Mode = &(SerialDevice->SerialMode);
|
|
||||||
|
|
||||||
if (RemainingDevicePath != NULL) {
|
if (RemainingDevicePath != NULL) {
|
||||||
//
|
//
|
||||||
// Match the configuration of the RemainingDevicePath. IsHandleSupported()
|
// Match the configuration of the RemainingDevicePath. IsHandleSupported()
|
||||||
|
@ -404,14 +435,9 @@ SerialControllerDriverStart (
|
||||||
CopyMem (&SerialDevice->UartDevicePath, RemainingDevicePath, sizeof (UART_DEVICE_PATH));
|
CopyMem (&SerialDevice->UartDevicePath, RemainingDevicePath, sizeof (UART_DEVICE_PATH));
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Build the device path by appending the UART node to the ParentDevicePath
|
// Use the values from the gSerialDevTempate as no remaining device path was
|
||||||
// from the WinNtIo handle. The Uart setings are zero here, since
|
// passed in.
|
||||||
// SetAttribute() will update them to match the default setings.
|
|
||||||
//
|
//
|
||||||
ZeroMem (&SerialDevice->UartDevicePath, sizeof (UART_DEVICE_PATH));
|
|
||||||
SerialDevice->UartDevicePath.Header.Type = MESSAGING_DEVICE_PATH;
|
|
||||||
SerialDevice->UartDevicePath.Header.SubType = MSG_UART_DP;
|
|
||||||
SetDevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) &SerialDevice->UartDevicePath, sizeof (UART_DEVICE_PATH));
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Build the device path by appending the UART node to the ParentDevicePath
|
// Build the device path by appending the UART node to the ParentDevicePath
|
||||||
|
@ -420,20 +446,17 @@ SerialControllerDriverStart (
|
||||||
//
|
//
|
||||||
SerialDevice->DevicePath = AppendDevicePathNode (
|
SerialDevice->DevicePath = AppendDevicePathNode (
|
||||||
ParentDevicePath,
|
ParentDevicePath,
|
||||||
(EFI_DEVICE_PATH_PROTOCOL *) &SerialDevice->UartDevicePath
|
(EFI_DEVICE_PATH_PROTOCOL *)&SerialDevice->UartDevicePath
|
||||||
);
|
);
|
||||||
|
|
||||||
if (SerialDevice->DevicePath == NULL) {
|
if (SerialDevice->DevicePath == NULL) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fill in Serial I/O Mode structure based on either the RemainingDevicePath or defaults.
|
// Fill in Serial I/O Mode structure based on either the RemainingDevicePath or defaults.
|
||||||
//
|
//
|
||||||
SerialDevice->SerialMode.ControlMask = SERIAL_PORT_DEFAULT_CONTROL_MASK;
|
|
||||||
SerialDevice->SerialMode.Timeout = SERIAL_PORT_DEFAULT_TIMEOUT;
|
|
||||||
SerialDevice->SerialMode.BaudRate = SerialDevice->UartDevicePath.BaudRate;
|
SerialDevice->SerialMode.BaudRate = SerialDevice->UartDevicePath.BaudRate;
|
||||||
SerialDevice->SerialMode.ReceiveFifoDepth = SERIAL_PORT_DEFAULT_RECEIVE_FIFO_DEPTH;
|
|
||||||
SerialDevice->SerialMode.DataBits = SerialDevice->UartDevicePath.DataBits;
|
SerialDevice->SerialMode.DataBits = SerialDevice->UartDevicePath.DataBits;
|
||||||
SerialDevice->SerialMode.Parity = SerialDevice->UartDevicePath.Parity;
|
SerialDevice->SerialMode.Parity = SerialDevice->UartDevicePath.Parity;
|
||||||
SerialDevice->SerialMode.StopBits = SerialDevice->UartDevicePath.StopBits;
|
SerialDevice->SerialMode.StopBits = SerialDevice->UartDevicePath.StopBits;
|
||||||
|
@ -1132,7 +1155,7 @@ IsaSerialSetAttributes (
|
||||||
// Check for default settings and fill in actual values.
|
// Check for default settings and fill in actual values.
|
||||||
//
|
//
|
||||||
if (BaudRate == 0) {
|
if (BaudRate == 0) {
|
||||||
BaudRate = SERIAL_PORT_DEFAULT_BAUD_RATE;
|
BaudRate = FixedPcdGet64 (PcdUartDefaultBaudRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ReceiveFifoDepth == 0) {
|
if (ReceiveFifoDepth == 0) {
|
||||||
|
@ -1144,15 +1167,15 @@ IsaSerialSetAttributes (
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Parity == DefaultParity) {
|
if (Parity == DefaultParity) {
|
||||||
Parity = SERIAL_PORT_DEFAULT_PARITY;
|
Parity = FixedPcdGet8 (PcdUartDefaultParity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DataBits == 0) {
|
if (DataBits == 0) {
|
||||||
DataBits = SERIAL_PORT_DEFAULT_DATA_BITS;
|
DataBits = FixedPcdGet8 (PcdUartDefaultDataBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StopBits == DefaultStopBits) {
|
if (StopBits == DefaultStopBits) {
|
||||||
StopBits = (EFI_STOP_BITS_TYPE) SERIAL_PORT_DEFAULT_STOP_BITS;
|
StopBits = (EFI_STOP_BITS_TYPE) FixedPcdGet8 (PcdUartDefaultStopBits);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// 5 and 6 data bits can not be verified on a 16550A UART
|
// 5 and 6 data bits can not be verified on a 16550A UART
|
||||||
|
@ -1801,8 +1824,7 @@ IsaSerialPortPresent (
|
||||||
Temp = READ_SCR (SerialDevice->IsaIo, SerialDevice->BaseAddress);
|
Temp = READ_SCR (SerialDevice->IsaIo, SerialDevice->BaseAddress);
|
||||||
WRITE_SCR (SerialDevice->IsaIo, SerialDevice->BaseAddress, 0xAA);
|
WRITE_SCR (SerialDevice->IsaIo, SerialDevice->BaseAddress, 0xAA);
|
||||||
|
|
||||||
if (READ_SCR (SerialDevice->IsaIo, SerialDevice->BaseAddress) != 0xAA)
|
if (READ_SCR (SerialDevice->IsaIo, SerialDevice->BaseAddress) != 0xAA) {
|
||||||
{
|
|
||||||
if (!FeaturePcdGet (PcdNtEmulatorEnable)) {
|
if (!FeaturePcdGet (PcdNtEmulatorEnable)) {
|
||||||
Status = FALSE;
|
Status = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1810,8 +1832,7 @@ IsaSerialPortPresent (
|
||||||
|
|
||||||
WRITE_SCR (SerialDevice->IsaIo, SerialDevice->BaseAddress, 0x55);
|
WRITE_SCR (SerialDevice->IsaIo, SerialDevice->BaseAddress, 0x55);
|
||||||
|
|
||||||
if (READ_SCR (SerialDevice->IsaIo, SerialDevice->BaseAddress) != 0x55)
|
if (READ_SCR (SerialDevice->IsaIo, SerialDevice->BaseAddress) != 0x55) {
|
||||||
{
|
|
||||||
if (!FeaturePcdGet (PcdNtEmulatorEnable)) {
|
if (!FeaturePcdGet (PcdNtEmulatorEnable)) {
|
||||||
Status = FALSE;
|
Status = FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,14 +121,18 @@ extern EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver;
|
||||||
//
|
//
|
||||||
// Serial Driver Defaults
|
// Serial Driver Defaults
|
||||||
//
|
//
|
||||||
#define SERIAL_PORT_DEFAULT_BAUD_RATE 115200
|
|
||||||
#define SERIAL_PORT_DEFAULT_RECEIVE_FIFO_DEPTH 1
|
#define SERIAL_PORT_DEFAULT_RECEIVE_FIFO_DEPTH 1
|
||||||
#define SERIAL_PORT_DEFAULT_TIMEOUT 1000000
|
#define SERIAL_PORT_DEFAULT_TIMEOUT 1000000
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define SERIAL_PORT_DEFAULT_BAUD_RATE 115200
|
||||||
#define SERIAL_PORT_DEFAULT_PARITY NoParity
|
#define SERIAL_PORT_DEFAULT_PARITY NoParity
|
||||||
#define SERIAL_PORT_DEFAULT_DATA_BITS 8
|
#define SERIAL_PORT_DEFAULT_DATA_BITS 8
|
||||||
#define SERIAL_PORT_DEFAULT_STOP_BITS 1
|
#define SERIAL_PORT_DEFAULT_STOP_BITS 1
|
||||||
|
*/
|
||||||
#define SERIAL_PORT_DEFAULT_CONTROL_MASK 0
|
#define SERIAL_PORT_DEFAULT_CONTROL_MASK 0
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// (24000000/13)MHz input clock
|
// (24000000/13)MHz input clock
|
||||||
//
|
//
|
||||||
|
|
|
@ -20,7 +20,6 @@ Revision History:
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "Terminal.h"
|
#include "Terminal.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -36,6 +35,70 @@ EFI_DRIVER_BINDING_PROTOCOL gTerminalDriverBinding = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
EFI_GUID *gTerminalType[] = {
|
||||||
|
&gEfiPcAnsiGuid,
|
||||||
|
&gEfiVT100Guid,
|
||||||
|
&gEfiVT100PlusGuid,
|
||||||
|
&gEfiVTUTF8Guid
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
TERMINAL_DEV gTerminalDevTemplate = {
|
||||||
|
TERMINAL_DEV_SIGNATURE,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
{ // SimpleTextInput
|
||||||
|
TerminalConInReset,
|
||||||
|
TerminalConInReadKeyStroke,
|
||||||
|
NULL
|
||||||
|
},
|
||||||
|
{ // SimpleTextOutput
|
||||||
|
TerminalConOutReset,
|
||||||
|
TerminalConOutOutputString,
|
||||||
|
TerminalConOutTestString,
|
||||||
|
TerminalConOutQueryMode,
|
||||||
|
TerminalConOutSetMode,
|
||||||
|
TerminalConOutSetAttribute,
|
||||||
|
TerminalConOutClearScreen,
|
||||||
|
TerminalConOutSetCursorPosition,
|
||||||
|
TerminalConOutEnableCursor,
|
||||||
|
NULL
|
||||||
|
},
|
||||||
|
{ // SimpleTextOutputMode
|
||||||
|
1, // MaxMode
|
||||||
|
0, // Mode?
|
||||||
|
EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK), // Attribute
|
||||||
|
0, // CursorColumn
|
||||||
|
0, // CursorRow
|
||||||
|
TRUE // CursorVisible
|
||||||
|
},
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{ 0 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{ 0 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{ 0 }
|
||||||
|
},
|
||||||
|
NULL, // ControllerNameTable
|
||||||
|
NULL,
|
||||||
|
INPUT_STATE_DEFAULT,
|
||||||
|
RESET_STATE_DEFAULT,
|
||||||
|
FALSE
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
TerminalDriverBindingSupported (
|
TerminalDriverBindingSupported (
|
||||||
|
@ -276,62 +339,48 @@ TerminalDriverBindingStart (
|
||||||
// If RemainingDevicePath is NULL, then create default device path node
|
// If RemainingDevicePath is NULL, then create default device path node
|
||||||
//
|
//
|
||||||
if (RemainingDevicePath == NULL) {
|
if (RemainingDevicePath == NULL) {
|
||||||
DefaultNode = AllocatePool (sizeof (VENDOR_DEVICE_PATH));
|
DefaultNode = AllocateZeroPool (sizeof (VENDOR_DEVICE_PATH));
|
||||||
if (DefaultNode == NULL) {
|
if (DefaultNode == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (&DefaultNode->Guid, &gEfiPcAnsiGuid, sizeof (EFI_GUID));
|
TerminalType = FixedPcdGet8 (PcdDefaultTerminalType);
|
||||||
RemainingDevicePath = (EFI_DEVICE_PATH_PROTOCOL*) DefaultNode;
|
// must be between PcAnsiType (0) and VTUTF8Type (3)
|
||||||
}
|
ASSERT (TerminalType <= VTUTF8Type);
|
||||||
//
|
|
||||||
// Use the RemainingDevicePath to determine the terminal type
|
|
||||||
//
|
|
||||||
Node = (VENDOR_DEVICE_PATH *) RemainingDevicePath;
|
|
||||||
|
|
||||||
if (CompareGuid (&Node->Guid, &gEfiPcAnsiGuid)) {
|
|
||||||
|
|
||||||
TerminalType = PcAnsiType;
|
|
||||||
|
|
||||||
} else if (CompareGuid (&Node->Guid, &gEfiVT100Guid)) {
|
|
||||||
|
|
||||||
TerminalType = VT100Type;
|
|
||||||
|
|
||||||
} else if (CompareGuid (&Node->Guid, &gEfiVT100PlusGuid)) {
|
|
||||||
|
|
||||||
TerminalType = VT100PlusType;
|
|
||||||
|
|
||||||
} else if (CompareGuid (&Node->Guid, &gEfiVTUTF8Guid)) {
|
|
||||||
|
|
||||||
TerminalType = VTUTF8Type;
|
|
||||||
|
|
||||||
|
CopyMem (&DefaultNode->Guid, gTerminalType[TerminalType], sizeof (EFI_GUID));
|
||||||
|
RemainingDevicePath = (EFI_DEVICE_PATH_PROTOCOL*)DefaultNode;
|
||||||
} else {
|
} else {
|
||||||
goto Error;
|
//
|
||||||
|
// Use the RemainingDevicePath to determine the terminal type
|
||||||
|
//
|
||||||
|
Node = (VENDOR_DEVICE_PATH *)RemainingDevicePath;
|
||||||
|
if (CompareGuid (&Node->Guid, &gEfiPcAnsiGuid)) {
|
||||||
|
TerminalType = PcAnsiType;
|
||||||
|
} else if (CompareGuid (&Node->Guid, &gEfiVT100Guid)) {
|
||||||
|
TerminalType = VT100Type;
|
||||||
|
} else if (CompareGuid (&Node->Guid, &gEfiVT100PlusGuid)) {
|
||||||
|
TerminalType = VT100PlusType;
|
||||||
|
} else if (CompareGuid (&Node->Guid, &gEfiVTUTF8Guid)) {
|
||||||
|
TerminalType = VTUTF8Type;
|
||||||
|
} else {
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the Terminal Dev
|
// Initialize the Terminal Dev
|
||||||
//
|
//
|
||||||
TerminalDevice = AllocatePool (sizeof (TERMINAL_DEV));
|
TerminalDevice = AllocateCopyPool (sizeof (TERMINAL_DEV), &gTerminalDevTemplate);
|
||||||
if (TerminalDevice == NULL) {
|
if (TerminalDevice == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMem (TerminalDevice, sizeof (TERMINAL_DEV));
|
|
||||||
|
|
||||||
TerminalDevice->Signature = TERMINAL_DEV_SIGNATURE;
|
|
||||||
|
|
||||||
TerminalDevice->TerminalType = TerminalType;
|
TerminalDevice->TerminalType = TerminalType;
|
||||||
|
|
||||||
TerminalDevice->SerialIo = SerialIo;
|
TerminalDevice->SerialIo = SerialIo;
|
||||||
|
|
||||||
//
|
|
||||||
// Simple Input Protocol
|
|
||||||
//
|
|
||||||
TerminalDevice->SimpleInput.Reset = TerminalConInReset;
|
|
||||||
TerminalDevice->SimpleInput.ReadKeyStroke = TerminalConInReadKeyStroke;
|
|
||||||
|
|
||||||
Status = gBS->CreateEvent (
|
Status = gBS->CreateEvent (
|
||||||
EVT_NOTIFY_WAIT,
|
EVT_NOTIFY_WAIT,
|
||||||
TPL_NOTIFY,
|
TPL_NOTIFY,
|
||||||
|
@ -342,6 +391,7 @@ TerminalDriverBindingStart (
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// initialize the FIFO buffer used for accommodating
|
// initialize the FIFO buffer used for accommodating
|
||||||
// the pre-read pending characters
|
// the pre-read pending characters
|
||||||
|
@ -355,7 +405,6 @@ TerminalDriverBindingStart (
|
||||||
// keystroke response performance issue
|
// keystroke response performance issue
|
||||||
//
|
//
|
||||||
Mode = TerminalDevice->SerialIo->Mode;
|
Mode = TerminalDevice->SerialIo->Mode;
|
||||||
|
|
||||||
SerialInTimeOut = 0;
|
SerialInTimeOut = 0;
|
||||||
if (Mode->BaudRate != 0) {
|
if (Mode->BaudRate != 0) {
|
||||||
SerialInTimeOut = (1 + Mode->DataBits + Mode->StopBits) * 2 * 1000000 / (UINTN) Mode->BaudRate;
|
SerialInTimeOut = (1 + Mode->DataBits + Mode->StopBits) * 2 * 1000000 / (UINTN) Mode->BaudRate;
|
||||||
|
@ -409,24 +458,8 @@ TerminalDriverBindingStart (
|
||||||
//
|
//
|
||||||
// Simple Text Output Protocol
|
// Simple Text Output Protocol
|
||||||
//
|
//
|
||||||
TerminalDevice->SimpleTextOutput.Reset = TerminalConOutReset;
|
|
||||||
TerminalDevice->SimpleTextOutput.OutputString = TerminalConOutOutputString;
|
|
||||||
TerminalDevice->SimpleTextOutput.TestString = TerminalConOutTestString;
|
|
||||||
TerminalDevice->SimpleTextOutput.QueryMode = TerminalConOutQueryMode;
|
|
||||||
TerminalDevice->SimpleTextOutput.SetMode = TerminalConOutSetMode;
|
|
||||||
TerminalDevice->SimpleTextOutput.SetAttribute = TerminalConOutSetAttribute;
|
|
||||||
TerminalDevice->SimpleTextOutput.ClearScreen = TerminalConOutClearScreen;
|
|
||||||
TerminalDevice->SimpleTextOutput.SetCursorPosition = TerminalConOutSetCursorPosition;
|
|
||||||
TerminalDevice->SimpleTextOutput.EnableCursor = TerminalConOutEnableCursor;
|
|
||||||
TerminalDevice->SimpleTextOutput.Mode = &TerminalDevice->SimpleTextOutputMode;
|
TerminalDevice->SimpleTextOutput.Mode = &TerminalDevice->SimpleTextOutputMode;
|
||||||
|
|
||||||
TerminalDevice->SimpleTextOutputMode.MaxMode = 1;
|
|
||||||
//
|
|
||||||
// For terminal devices, cursor is always visible
|
|
||||||
//
|
|
||||||
TerminalDevice->SimpleTextOutputMode.CursorVisible = TRUE;
|
|
||||||
TerminalDevice->SimpleTextOutputMode.Attribute = EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK);
|
|
||||||
|
|
||||||
Status = TerminalDevice->SimpleTextOutput.Reset (
|
Status = TerminalDevice->SimpleTextOutput.Reset (
|
||||||
&TerminalDevice->SimpleTextOutput,
|
&TerminalDevice->SimpleTextOutput,
|
||||||
FALSE
|
FALSE
|
||||||
|
@ -450,11 +483,6 @@ TerminalDriverBindingStart (
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ReportError;
|
goto ReportError;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
TerminalDevice->InputState = INPUT_STATE_DEFAULT;
|
|
||||||
TerminalDevice->ResetState = RESET_STATE_DEFAULT;
|
|
||||||
|
|
||||||
Status = gBS->CreateEvent (
|
Status = gBS->CreateEvent (
|
||||||
EVT_TIMER,
|
EVT_TIMER,
|
||||||
|
|
|
@ -74,7 +74,6 @@ typedef struct {
|
||||||
UINT8 TerminalType;
|
UINT8 TerminalType;
|
||||||
EFI_SERIAL_IO_PROTOCOL *SerialIo;
|
EFI_SERIAL_IO_PROTOCOL *SerialIo;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
VENDOR_DEVICE_PATH Node;
|
|
||||||
EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput;
|
EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput;
|
||||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
|
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
|
||||||
EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
|
EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
|
||||||
|
@ -85,7 +84,7 @@ typedef struct {
|
||||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||||
EFI_EVENT TwoSecondTimeOut;
|
EFI_EVENT TwoSecondTimeOut;
|
||||||
UINT32 InputState;
|
UINT32 InputState;
|
||||||
UINT32 ResetState;
|
UINT32 ResetState;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Esc could not be output to the screen by user,
|
// Esc could not be output to the screen by user,
|
||||||
|
@ -94,7 +93,7 @@ typedef struct {
|
||||||
// This boolean is used by the terminal driver only
|
// This boolean is used by the terminal driver only
|
||||||
// to indicate whether the Esc could be sent or not.
|
// to indicate whether the Esc could be sent or not.
|
||||||
//
|
//
|
||||||
BOOLEAN OutputEscChar;
|
BOOLEAN OutputEscChar;
|
||||||
} TERMINAL_DEV;
|
} TERMINAL_DEV;
|
||||||
|
|
||||||
#define INPUT_STATE_DEFAULT 0x00
|
#define INPUT_STATE_DEFAULT 0x00
|
||||||
|
|
|
@ -73,8 +73,10 @@
|
||||||
gEfiSimpleTextInProtocolGuid # PROTOCOL BY_START
|
gEfiSimpleTextInProtocolGuid # PROTOCOL BY_START
|
||||||
gEfiSimpleTextOutProtocolGuid # PROTOCOL BY_START
|
gEfiSimpleTextOutProtocolGuid # PROTOCOL BY_START
|
||||||
|
|
||||||
[PcdsFixedAtBuild]
|
[PcdsDynamic]
|
||||||
PcdStatusCodeValueRemoteConsoleError|gEfiMdePkgTokenSpaceGuid
|
PcdStatusCodeValueRemoteConsoleError|gEfiMdePkgTokenSpaceGuid
|
||||||
PcdStatusCodeValueRemoteConsoleReset|gEfiMdePkgTokenSpaceGuid
|
PcdStatusCodeValueRemoteConsoleReset|gEfiMdePkgTokenSpaceGuid
|
||||||
PcdStatusCodeValueRemoteConsoleInputError|gEfiMdePkgTokenSpaceGuid
|
PcdStatusCodeValueRemoteConsoleInputError|gEfiMdePkgTokenSpaceGuid
|
||||||
PcdStatusCodeValueRemoteConsoleOutputError|gEfiMdePkgTokenSpaceGuid
|
PcdStatusCodeValueRemoteConsoleOutputError|gEfiMdePkgTokenSpaceGuid
|
||||||
|
PcdDefaultTerminalType|gEfiMdePkgTokenSpaceGuid
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue