diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-10-13 06:05:24 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-10-13 06:05:24 +0000 |
commit | 6fb05c6ff39c1b9254f9fd8fdf886499cddddee0 (patch) | |
tree | b0282fd743533a84b48cd3a1d88db979a3afb908 | |
parent | aaa4a08c7c86a88c711a6a637f310a80eeb7df37 (diff) | |
download | edk2-6fb05c6ff39c1b9254f9fd8fdf886499cddddee0.tar.gz |
sync patch r10351, r10352, r10353, r10354 from main trunk.
1. IsaSerialIo, WinNtSerialIo, UnixSerialIo drivers were changed to produce the flow
control device path node when the remaining device path contains such node.
And it will return unsupported when receiving a remaining device path only contains
UART node and it's already produced the flow control node.
2. BMM driver was enhanced to take care of the optional flow control node.
3. Update DevicePath.h to add the UART_FLOW_CONTROL_HARDWARE and UART_FLOW_CONTROL_XON_XOFF.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010@10921 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf | 3 | ||||
-rw-r--r-- | IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c | 250 | ||||
-rw-r--r-- | IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h | 12 | ||||
-rw-r--r-- | IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c | 170 | ||||
-rw-r--r-- | MdePkg/Include/Protocol/DevicePath.h | 3 | ||||
-rw-r--r-- | Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c | 253 | ||||
-rw-r--r-- | Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.h | 15 | ||||
-rw-r--r-- | Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIoDxe.inf | 1 | ||||
-rw-r--r-- | UnixPkg/UnixSerialIoDxe/UnixSerialIo.c | 281 | ||||
-rw-r--r-- | UnixPkg/UnixSerialIoDxe/UnixSerialIo.h | 15 | ||||
-rw-r--r-- | UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf | 4 |
11 files changed, 773 insertions, 234 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf index 1c8e762923..b47023d149 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf @@ -52,6 +52,9 @@ UefiDriverEntryPoint
DebugLib
+[Guids]
+ gEfiUartDevicePathGuid
+
[Protocols]
gEfiIsaIoProtocolGuid ## TO_START
gEfiDevicePathProtocolGuid ## TO_START
diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c index 04d6373592..b842112230 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c @@ -41,7 +41,7 @@ SERIAL_DEV gSerialDevTempate = { NULL
},
{ // SerialMode
- SERIAL_PORT_DEFAULT_CONTROL_MASK,
+ SERIAL_PORT_SUPPORT_CONTROL_MASK,
SERIAL_PORT_DEFAULT_TIMEOUT,
FixedPcdGet64 (PcdUartDefaultBaudRate), // BaudRate
SERIAL_PORT_DEFAULT_RECEIVE_FIFO_DEPTH,
@@ -87,6 +87,51 @@ SERIAL_DEV gSerialDevTempate = { };
/**
+ 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.
+
+**/
+BOOLEAN
+IsUartFlowControlNode (
+ IN UART_FLOW_CONTROL_DEVICE_PATH *FlowControl
+ )
+{
+ return (BOOLEAN) (
+ (DevicePathType (FlowControl) == MESSAGING_DEVICE_PATH) &&
+ (DevicePathSubType (FlowControl) == MSG_VENDOR_DP) &&
+ (CompareGuid (&FlowControl->Guid, &gEfiUartDevicePathGuid))
+ );
+}
+
+/**
+ Check the device path node whether it contains Flow Control node or not.
+
+ @param[in] DevicePath The device path to be checked.
+
+ @retval TRUE It contains the Flow Control node.
+ @retval FALSE It doesn't.
+
+**/
+BOOLEAN
+ContainsFlowControl (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ )
+{
+ while (!IsDevicePathEnd (DevicePath)) {
+ if (IsUartFlowControlNode ((UART_FLOW_CONTROL_DEVICE_PATH *) DevicePath)) {
+ return TRUE;
+ }
+ DevicePath = NextDevicePathNode (DevicePath);
+ }
+
+ return FALSE;
+}
+
+/**
The user Entry Point for module IsaSerial. The user code starts with this function.
@param[in] ImageHandle The firmware allocated handle for the EFI image.
@@ -145,6 +190,11 @@ SerialControllerDriverSupported ( EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
EFI_ISA_IO_PROTOCOL *IsaIo;
UART_DEVICE_PATH *UartNode;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ UART_FLOW_CONTROL_DEVICE_PATH *FlowControlNode;
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
+ UINTN EntryCount;
+ UINTN Index;
//
// Check RemainingDevicePath validation
@@ -192,8 +242,17 @@ SerialControllerDriverSupported ( if ((UartNode->DataBits >= 6) && (UartNode->DataBits <= 8) && (UartNode->StopBits == OneFiveStopBits)) {
goto Error;
}
-
- Status = EFI_SUCCESS;
+
+ FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (UartNode);
+ if (IsUartFlowControlNode (FlowControlNode)) {
+ //
+ // If the second node is Flow Control Node,
+ // return error when it request other than hardware flow control.
+ //
+ if ((ReadUnaligned32 (&FlowControlNode->FlowControlMap) & ~UART_FLOW_CONTROL_HARDWARE) != 0) {
+ goto Error;
+ }
+ }
}
}
@@ -209,7 +268,45 @@ SerialControllerDriverSupported ( EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
+ if (RemainingDevicePath == NULL || IsDevicePathEnd (RemainingDevicePath)) {
+ //
+ // If RemainingDevicePath is NULL or is the End of Device Path Node
+ //
+ return EFI_SUCCESS;
+ }
+ //
+ // When the driver has produced device path with flow control node but RemainingDevicePath only contains UART node,
+ // return unsupported, and vice versa.
+ //
+ Status = gBS->OpenProtocolInformation (
+ Controller,
+ &gEfiIsaIoProtocolGuid,
+ &OpenInfoBuffer,
+ &EntryCount
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ for (Index = 0; Index < EntryCount; Index++) {
+ if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
+ Status = gBS->OpenProtocol (
+ OpenInfoBuffer[Index].ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &DevicePath,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status) &&
+ (ContainsFlowControl (RemainingDevicePath) ^ ContainsFlowControl (DevicePath))) {
+ Status = EFI_UNSUPPORTED;
+ }
+ break;
+ }
+ }
+ FreePool (OpenInfoBuffer);
+ return Status;
}
if (EFI_ERROR (Status)) {
@@ -295,7 +392,11 @@ SerialControllerDriverStart ( EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
UINTN EntryCount;
EFI_SERIAL_IO_PROTOCOL *SerialIo;
- UART_DEVICE_PATH *UartNode;
+ UART_DEVICE_PATH *Uart;
+ UINT32 FlowControlMap;
+ UART_FLOW_CONTROL_DEVICE_PATH *FlowControl;
+ EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
+ UINT32 Control;
SerialDevice = NULL;
//
@@ -371,16 +472,35 @@ SerialControllerDriverStart ( EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (!EFI_ERROR (Status)) {
- UartNode = (UART_DEVICE_PATH *) RemainingDevicePath;
+ Uart = (UART_DEVICE_PATH *) RemainingDevicePath;
Status = SerialIo->SetAttributes (
SerialIo,
- UartNode->BaudRate,
+ Uart->BaudRate,
SerialIo->Mode->ReceiveFifoDepth,
SerialIo->Mode->Timeout,
- (EFI_PARITY_TYPE) UartNode->Parity,
- UartNode->DataBits,
- (EFI_STOP_BITS_TYPE) UartNode->StopBits
+ (EFI_PARITY_TYPE) Uart->Parity,
+ Uart->DataBits,
+ (EFI_STOP_BITS_TYPE) Uart->StopBits
);
+
+ FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (Uart);
+ if (!EFI_ERROR (Status) && IsUartFlowControlNode (FlowControl)) {
+ Status = SerialIo->GetControl (SerialIo, &Control);
+ if (!EFI_ERROR (Status)) {
+ if (ReadUnaligned32 (&FlowControl->FlowControlMap) == UART_FLOW_CONTROL_HARDWARE) {
+ Control |= EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
+ } else {
+ Control &= ~EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
+ }
+ //
+ // Clear the bits that are not allowed to pass to SetControl
+ //
+ Control &= (EFI_SERIAL_REQUEST_TO_SEND | EFI_SERIAL_DATA_TERMINAL_READY |
+ EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE |
+ EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE);
+ Status = SerialIo->SetControl (SerialIo, Control);
+ }
+ }
}
break;
}
@@ -412,6 +532,8 @@ SerialControllerDriverStart ( SerialDevice->SerialIo.Mode = &(SerialDevice->SerialMode);
SerialDevice->IsaIo = IsaIo;
SerialDevice->ParentDevicePath = ParentDevicePath;
+ FlowControl = NULL;
+ FlowControlMap = 0;
//
// Check if RemainingDevicePath is NULL,
@@ -426,6 +548,12 @@ SerialControllerDriverStart ( // that we can support.
//
CopyMem (&SerialDevice->UartDevicePath, RemainingDevicePath, sizeof (UART_DEVICE_PATH));
+ FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (RemainingDevicePath);
+ if (IsUartFlowControlNode (FlowControl)) {
+ FlowControlMap = ReadUnaligned32 (&FlowControl->FlowControlMap);
+ } else {
+ FlowControl = NULL;
+ }
}
AddName (SerialDevice, IsaIo);
@@ -435,6 +563,9 @@ SerialControllerDriverStart ( SerialDevice->BaseAddress = (UINT16) SerialDevice->IsaIo->ResourceList->ResourceItem[Index].StartRange;
}
}
+
+ SerialDevice->HardwareFlowControl = (BOOLEAN) (FlowControlMap == UART_FLOW_CONTROL_HARDWARE);
+
//
// Report status code the serial present
//
@@ -456,15 +587,28 @@ SerialControllerDriverStart ( //
// Build the device path by appending the UART node to the ParentDevicePath.
- //The Uart setings are zero here, since SetAttribute() will update them to match
+ // The Uart setings are zero here, since SetAttribute() will update them to match
// the default setings.
//
SerialDevice->DevicePath = AppendDevicePathNode (
ParentDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *)&SerialDevice->UartDevicePath
+ (EFI_DEVICE_PATH_PROTOCOL *) &SerialDevice->UartDevicePath
);
+ //
+ // Only produce the Flow Control node when remaining device path has it
+ //
+ if (FlowControl != NULL) {
+ TempDevicePath = SerialDevice->DevicePath;
+ if (TempDevicePath != NULL) {
+ SerialDevice->DevicePath = AppendDevicePathNode (
+ TempDevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *) FlowControl
+ );
+ FreePool (TempDevicePath);
+ }
+ }
if (SerialDevice->DevicePath == NULL) {
- Status = EFI_DEVICE_ERROR;
+ Status = EFI_OUT_OF_RESOURCES;
goto Error;
}
@@ -968,6 +1112,7 @@ IsaSerialReset ( SERIAL_PORT_MCR Mcr;
SERIAL_PORT_FCR Fcr;
EFI_TPL Tpl;
+ UINT32 Control;
SerialDevice = SERIAL_DEV_FROM_THIS (This);
@@ -1039,9 +1184,16 @@ IsaSerialReset ( //
// Go set the current control bits
//
+ Control = 0;
+ if (SerialDevice->HardwareFlowControl) {
+ Control |= EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
+ }
+ if (SerialDevice->SoftwareLoopbackEnable) {
+ Control |= EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE;
+ }
Status = This->SetControl (
This,
- This->Mode->ControlMask
+ Control
);
if (EFI_ERROR (Status)) {
@@ -1108,7 +1260,7 @@ IsaSerialSetAttributes ( UINT32 Divisor;
UINT32 Remained;
SERIAL_PORT_LCR Lcr;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
+ UART_DEVICE_PATH *Uart;
EFI_TPL Tpl;
SerialDevice = SERIAL_DEV_FROM_THIS (This);
@@ -1347,37 +1499,25 @@ IsaSerialSetAttributes ( SerialDevice->UartDevicePath.Parity = (UINT8) Parity;
SerialDevice->UartDevicePath.StopBits = (UINT8) StopBits;
- NewDevicePath = AppendDevicePathNode (
- SerialDevice->ParentDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &SerialDevice->UartDevicePath
- );
- if (NewDevicePath == NULL) {
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
+ Status = EFI_SUCCESS;
if (SerialDevice->Handle != NULL) {
+ Uart = (UART_DEVICE_PATH *) (
+ (UINTN) SerialDevice->DevicePath
+ + GetDevicePathSize (SerialDevice->ParentDevicePath)
+ - END_DEVICE_PATH_LENGTH
+ );
+ CopyMem (Uart, &SerialDevice->UartDevicePath, sizeof (UART_DEVICE_PATH));
Status = gBS->ReinstallProtocolInterface (
SerialDevice->Handle,
&gEfiDevicePathProtocolGuid,
SerialDevice->DevicePath,
- NewDevicePath
+ SerialDevice->DevicePath
);
- if (EFI_ERROR (Status)) {
- gBS->RestoreTPL (Tpl);
- return Status;
- }
- }
-
- if (SerialDevice->DevicePath != NULL) {
- gBS->FreePool (SerialDevice->DevicePath);
}
- SerialDevice->DevicePath = NewDevicePath;
-
gBS->RestoreTPL (Tpl);
- return EFI_SUCCESS;
+ return Status;
}
/**
@@ -1397,9 +1537,11 @@ IsaSerialSetControl ( IN UINT32 Control
)
{
- SERIAL_DEV *SerialDevice;
- SERIAL_PORT_MCR Mcr;
- EFI_TPL Tpl;
+ SERIAL_DEV *SerialDevice;
+ SERIAL_PORT_MCR Mcr;
+ EFI_TPL Tpl;
+ UART_FLOW_CONTROL_DEVICE_PATH *FlowControl;
+ EFI_STATUS Status;
//
// The control bits that can be set are :
@@ -1407,13 +1549,16 @@ IsaSerialSetControl ( // EFI_SERIAL_REQUEST_TO_SEND: 0x0002 // WO
// EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE: 0x1000 // RW
// EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE: 0x2000 // RW
+ // EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE: 0x4000 // RW
//
SerialDevice = SERIAL_DEV_FROM_THIS (This);
//
// first determine the parameter is invalid
//
- if ((Control & 0xffff8ffc) != 0) {
+ if (Control & (~(EFI_SERIAL_REQUEST_TO_SEND | EFI_SERIAL_DATA_TERMINAL_READY |
+ EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE |
+ EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE))) {
return EFI_UNSUPPORTED;
}
@@ -1448,9 +1593,32 @@ IsaSerialSetControl ( SerialDevice->SoftwareLoopbackEnable = TRUE;
}
+ Status = EFI_SUCCESS;
+ if (SerialDevice->Handle != NULL) {
+ FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) (
+ (UINTN) SerialDevice->DevicePath
+ + GetDevicePathSize (SerialDevice->ParentDevicePath)
+ - END_DEVICE_PATH_LENGTH
+ + sizeof (UART_DEVICE_PATH)
+ );
+ if (IsUartFlowControlNode (FlowControl) &&
+ ((ReadUnaligned32 (&FlowControl->FlowControlMap) == UART_FLOW_CONTROL_HARDWARE) ^ SerialDevice->HardwareFlowControl)) {
+ //
+ // Flow Control setting is changed, need to reinstall device path protocol
+ //
+ WriteUnaligned32 (&FlowControl->FlowControlMap, SerialDevice->HardwareFlowControl ? UART_FLOW_CONTROL_HARDWARE : 0);
+ Status = gBS->ReinstallProtocolInterface (
+ SerialDevice->Handle,
+ &gEfiDevicePathProtocolGuid,
+ SerialDevice->DevicePath,
+ SerialDevice->DevicePath
+ );
+ }
+ }
+
gBS->RestoreTPL (Tpl);
- return EFI_SUCCESS;
+ return Status;
}
/**
diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h index deb7926526..db5bd21b92 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h @@ -116,7 +116,17 @@ typedef struct { //
#define SERIAL_PORT_DEFAULT_RECEIVE_FIFO_DEPTH 1
#define SERIAL_PORT_DEFAULT_TIMEOUT 1000000
-#define SERIAL_PORT_DEFAULT_CONTROL_MASK 0
+#define SERIAL_PORT_SUPPORT_CONTROL_MASK (EFI_SERIAL_CLEAR_TO_SEND | \
+ EFI_SERIAL_DATA_SET_READY | \
+ EFI_SERIAL_RING_INDICATE | \
+ EFI_SERIAL_CARRIER_DETECT | \
+ EFI_SERIAL_REQUEST_TO_SEND | \
+ EFI_SERIAL_DATA_TERMINAL_READY | \
+ EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | \
+ EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE | \
+ EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE | \
+ EFI_SERIAL_OUTPUT_BUFFER_EMPTY | \
+ EFI_SERIAL_INPUT_BUFFER_EMPTY)
//
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c index c6c9915f55..e79b3f6a30 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c @@ -1,7 +1,7 @@ /** @file
handles console redirection from boot manager
-Copyright (c) 2004 - 2009, Intel Corporation. <BR>
+Copyright (c) 2004 - 2010, Intel Corporation. <BR>
All rights reserved. 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
@@ -15,6 +15,27 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "BootMaint.h"
/**
+ 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.
+
+**/
+BOOLEAN
+IsIsaSerialNode (
+ IN ACPI_HID_DEVICE_PATH *Acpi
+ )
+{
+ return (BOOLEAN) (
+ (DevicePathType (Acpi) == ACPI_DEVICE_PATH) &&
+ (DevicePathSubType (Acpi) == ACPI_DP) &&
+ (ReadUnaligned32 (&Acpi->HID) == EISA_PNP_ID (0x0501))
+ );
+}
+
+/**
Update Com Ports attributes from DevicePath
@param DevicePath DevicePath that contains Com ports
@@ -51,20 +72,16 @@ ChangeTerminalDevicePath ( UART_DEVICE_PATH *Uart;
UART_DEVICE_PATH *Uart1;
UINTN Com;
- UINT32 Match;
BM_TERMINAL_CONTEXT *NewTerminalContext;
BM_MENU_ENTRY *NewMenuEntry;
- Match = EISA_PNP_ID (0x0501);
Node = DevicePath;
Node = NextDevicePathNode (Node);
Com = 0;
while (!IsDevicePathEnd (Node)) {
- if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
- CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
- }
+ Acpi = (ACPI_HID_DEVICE_PATH *) Node;
+ if (IsIsaSerialNode (Acpi)) {
+ CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
}
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Com);
@@ -165,20 +182,16 @@ ChangeVariableDevicePath ( ACPI_HID_DEVICE_PATH *Acpi;
UART_DEVICE_PATH *Uart;
UINTN Com;
- UINT32 Match;
BM_TERMINAL_CONTEXT *NewTerminalContext;
BM_MENU_ENTRY *NewMenuEntry;
- Match = EISA_PNP_ID (0x0501);
Node = DevicePath;
Node = NextDevicePathNode (Node);
Com = 0;
while (!IsDevicePathEnd (Node)) {
- if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
- CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
- }
+ Acpi = (ACPI_HID_DEVICE_PATH *) Node;
+ if (IsIsaSerialNode (Acpi)) {
+ CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
}
if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
@@ -234,29 +247,33 @@ RetrieveUartUid ( IN OUT UINT32 *AcpiUid
)
{
- UINT32 Match;
- UINT8 *Ptr;
+ EFI_STATUS Status;
ACPI_HID_DEVICE_PATH *Acpi;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- gBS->HandleProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath
- );
- Ptr = (UINT8 *) DevicePath;
-
- while (*Ptr != END_DEVICE_PATH_TYPE) {
- Ptr++;
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &DevicePath
+ );
+ if (EFI_ERROR (Status)) {
+ return FALSE;
}
- Ptr = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);
- Acpi = (ACPI_HID_DEVICE_PATH *) Ptr;
- Match = EISA_PNP_ID (0x0501);
+ Acpi = NULL;
+ for (; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) {
+ if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (DevicePath) == MSG_UART_DP)) {
+ break;
+ }
+ //
+ // Acpi points to the node before the Uart node
+ //
+ Acpi = (ACPI_HID_DEVICE_PATH *) DevicePath;
+ }
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
+ if ((Acpi != NULL) && IsIsaSerialNode (Acpi)) {
if (AcpiUid != NULL) {
- *AcpiUid = Acpi->UID;
+ CopyMem (AcpiUid, &Acpi->UID, sizeof (UINT32));
}
return TRUE;
} else {
@@ -339,7 +356,6 @@ LocateSerialIo ( VOID
)
{
- UINT8 *Ptr;
UINTN Index;
UINTN Index2;
UINTN NoHandles;
@@ -347,8 +363,8 @@ LocateSerialIo ( EFI_STATUS Status;
ACPI_HID_DEVICE_PATH *Acpi;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UINT32 Match;
EFI_SERIAL_IO_PROTOCOL *SerialIo;
+ EFI_DEVICE_PATH_PROTOCOL *Node;
EFI_DEVICE_PATH_PROTOCOL *OutDevicePath;
EFI_DEVICE_PATH_PROTOCOL *InpDevicePath;
EFI_DEVICE_PATH_PROTOCOL *ErrDevicePath;
@@ -390,16 +406,19 @@ LocateSerialIo ( &gEfiDevicePathProtocolGuid,
(VOID **) &DevicePath
);
- Ptr = (UINT8 *) DevicePath;
- while (*Ptr != END_DEVICE_PATH_TYPE) {
- Ptr++;
- }
- Ptr = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);
- Acpi = (ACPI_HID_DEVICE_PATH *) Ptr;
- Match = EISA_PNP_ID (0x0501);
+ Acpi = NULL;
+ for (Node = DevicePath; !IsDevicePathEnd (Node); Node = NextDevicePathNode (Node)) {
+ if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
+ break;
+ }
+ //
+ // Acpi points to the node before Uart node
+ //
+ Acpi = (ACPI_HID_DEVICE_PATH *) Node;
+ }
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
+ if ((Acpi != NULL) && IsIsaSerialNode (Acpi)) {
NewMenuEntry = BOpt_CreateMenuEntry (BM_TERMINAL_CONTEXT_SELECT);
if (NewMenuEntry == NULL) {
FreePool (Handles);
@@ -547,23 +566,19 @@ UpdateComAttributeFromVariable ( ACPI_HID_DEVICE_PATH *Acpi;
UART_DEVICE_PATH *Uart;
UART_DEVICE_PATH *Uart1;
- UINT32 Match;
UINTN TerminalNumber;
BM_MENU_ENTRY *NewMenuEntry;
BM_TERMINAL_CONTEXT *NewTerminalContext;
UINTN Index;
- Match = EISA_PNP_ID (0x0501);
Node = DevicePath;
Node = NextDevicePathNode (Node);
TerminalNumber = 0;
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
while (!IsDevicePathEnd (Node)) {
- if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
- CopyMem (&TerminalNumber, &Acpi->UID, sizeof (UINT32));
- }
+ Acpi = (ACPI_HID_DEVICE_PATH *) Node;
+ if (IsIsaSerialNode (Acpi)) {
+ CopyMem (&TerminalNumber, &Acpi->UID, sizeof (UINT32));
}
if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
@@ -837,46 +852,60 @@ IsTerminalDevicePath ( OUT UINTN *Com
)
{
- UINT8 *Ptr;
- BOOLEAN IsTerminal;
- VENDOR_DEVICE_PATH *Vendor;
- ACPI_HID_DEVICE_PATH *Acpi;
- UINT32 Match;
- EFI_GUID TempGuid;
+ BOOLEAN IsTerminal;
+ EFI_DEVICE_PATH_PROTOCOL *Node;
+ VENDOR_DEVICE_PATH *Vendor;
+ UART_DEVICE_PATH *Uart;
+ ACPI_HID_DEVICE_PATH *Acpi;
IsTerminal = FALSE;
- //
- // Parse the Device Path, should be change later!!!
- //
- Ptr = (UINT8 *) DevicePath;
- while (*Ptr != END_DEVICE_PATH_TYPE) {
- Ptr++;
+ Uart = NULL;
+ Vendor = NULL;
+ Acpi = NULL;
+ for (Node = DevicePath; !IsDevicePathEnd (Node); Node = NextDevicePathNode (Node)) {
+ //
+ // Vendor points to the node before the End node
+ //
+ Vendor = (VENDOR_DEVICE_PATH *) Node;
+
+ if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
+ Uart = (UART_DEVICE_PATH *) Node;
+ }
+
+ if (Uart == NULL) {
+ //
+ // Acpi points to the node before the UART node
+ //
+ Acpi = (ACPI_HID_DEVICE_PATH *) Node;
+ }
}
- Ptr = Ptr - sizeof (VENDOR_DEVICE_PATH);
- Vendor = (VENDOR_DEVICE_PATH *) Ptr;
+ if (Vendor == NULL ||
+ DevicePathType (Vendor) != MESSAGING_DEVICE_PATH ||
+ DevicePathSubType (Vendor) != MSG_VENDOR_DP ||
+ Uart == NULL) {
+ return FALSE;
+ }
//
// There are four kinds of Terminal types
// check to see whether this devicepath
// is one of that type
//
- CopyMem (&TempGuid, &Vendor->Guid, sizeof (EFI_GUID));
-
- if (CompareGuid (&TempGuid, &TerminalTypeGuid[0])) {
+ if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[0])) {
*Termi = TerminalTypePcAnsi;
IsTerminal = TRUE;
} else {
- if (CompareGuid (&TempGuid, &TerminalTypeGuid[1])) {
+ if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[1])) {
*Termi = TerminalTypeVt100;
IsTerminal = TRUE;
} else {
- if (CompareGuid (&TempGuid, &TerminalTypeGuid[2])) {
+ if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[2])) {
*Termi = TerminalTypeVt100Plus;
IsTerminal = TRUE;
} else {
- if (CompareGuid (&TempGuid, &TerminalTypeGuid[3])) {
+ if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[3])) {
*Termi = TerminalTypeVtUtf8;
IsTerminal = TRUE;
} else {
@@ -890,10 +919,7 @@ IsTerminalDevicePath ( return FALSE;
}
- Ptr = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);
- Acpi = (ACPI_HID_DEVICE_PATH *) Ptr;
- Match = EISA_PNP_ID (0x0501);
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
+ if ((Acpi != NULL) && IsIsaSerialNode (Acpi)) {
CopyMem (Com, &Acpi->UID, sizeof (UINT32));
} else {
return FALSE;
diff --git a/MdePkg/Include/Protocol/DevicePath.h b/MdePkg/Include/Protocol/DevicePath.h index dee780c35f..30beadecb3 100644 --- a/MdePkg/Include/Protocol/DevicePath.h +++ b/MdePkg/Include/Protocol/DevicePath.h @@ -687,6 +687,9 @@ typedef struct { UINT32 FlowControlMap;
} UART_FLOW_CONTROL_DEVICE_PATH;
+#define UART_FLOW_CONTROL_HARDWARE 0x00000001
+#define UART_FLOW_CONTROL_XON_XOFF 0x00000010
+
#define DEVICE_PATH_MESSAGING_SAS EFI_SAS_DEVICE_PATH_GUID
///
/// Serial Attached SCSI (SAS) devices.
diff --git a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c index b2c9089572..44bc510d7c 100644 --- a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c +++ b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c @@ -62,6 +62,51 @@ EFI_DRIVER_BINDING_PROTOCOL gWinNtSerialIoDriverBinding = { UINT64 mBaudRateCurrentSupport[] = {50, 75, 110, 134, 150, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 7200, 9600, 19200, 38400, 57600, 115200, SERIAL_PORT_MAX_BAUD_RATE + 1};
/**
+ 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.
+
+**/
+BOOLEAN
+IsUartFlowControlNode (
+ IN UART_FLOW_CONTROL_DEVICE_PATH *FlowControl
+ )
+{
+ return (BOOLEAN) (
+ (DevicePathType (FlowControl) == MESSAGING_DEVICE_PATH) &&
+ (DevicePathSubType (FlowControl) == MSG_VENDOR_DP) &&
+ (CompareGuid (&FlowControl->Guid, &gEfiUartDevicePathGuid))
+ );
+}
+
+/**
+ Check the device path node whether it contains Flow Control node or not.
+
+ @param[in] DevicePath The device path to be checked.
+
+ @retval TRUE It contains the Flow Control node.
+ @retval FALSE It doesn't.
+
+**/
+BOOLEAN
+ContainsFlowControl (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ )
+{
+ while (!IsDevicePathEnd (DevicePath)) {
+ if (IsUartFlowControlNode ((UART_FLOW_CONTROL_DEVICE_PATH *) DevicePath)) {
+ return TRUE;
+ }
+ DevicePath = NextDevicePathNode (DevicePath);
+ }
+
+ return FALSE;
+}
+
+/**
The user Entry Point for module WinNtSerialIo. The user code starts with this function.
@param[in] ImageHandle The firmware allocated handle for the EFI image.
@@ -121,10 +166,15 @@ Returns: // TODO: EFI_SUCCESS - add return value to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
- UART_DEVICE_PATH *UartNode;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
+ UART_DEVICE_PATH *UartNode;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ UART_FLOW_CONTROL_DEVICE_PATH *FlowControlNode;
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
+ UINTN EntryCount;
+ UINTN Index;
//
// Check RemainingDevicePath validation
@@ -165,6 +215,17 @@ Returns: if ((UartNode->DataBits >= 6) && (UartNode->DataBits <= 8) && (UartNode->StopBits == OneFiveStopBits)) {
goto Error;
}
+
+ FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (UartNode);
+ if (IsUartFlowControlNode (FlowControlNode)) {
+ //
+ // If the second node is Flow Control Node,
+ // return error when it request other than hardware flow control.
+ //
+ if ((FlowControlNode->FlowControlMap & ~UART_FLOW_CONTROL_HARDWARE) != 0) {
+ goto Error;
+ }
+ }
}
}
@@ -180,7 +241,45 @@ Returns: EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
+ if (RemainingDevicePath == NULL || IsDevicePathEnd (RemainingDevicePath)) {
+ //
+ // If RemainingDevicePath is NULL or is the End of Device Path Node
+ //
+ return EFI_SUCCESS;
+ }
+ //
+ // When the driver has produced device path with flow control node but RemainingDevicePath only contains UART node,
+ // return unsupported, and vice versa.
+ //
+ Status = gBS->OpenProtocolInformation (
+ Handle,
+ &gEfiWinNtIoProtocolGuid,
+ &OpenInfoBuffer,
+ &EntryCount
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ for (Index = 0; Index < EntryCount; Index++) {
+ if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
+ Status = gBS->OpenProtocol (
+ OpenInfoBuffer[Index].ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &DevicePath,
+ This->DriverBindingHandle,
+ Handle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status) &&
+ (ContainsFlowControl (RemainingDevicePath) ^ ContainsFlowControl (DevicePath))) {
+ Status = EFI_UNSUPPORTED;
+ }
+ break;
+ }
+ }
+ FreePool (OpenInfoBuffer);
+ return Status;
}
if (EFI_ERROR (Status)) {
@@ -276,19 +375,23 @@ Returns: EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;
HANDLE NtHandle;
- UART_DEVICE_PATH Node;
+ UART_DEVICE_PATH UartNode;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
UINTN EntryCount;
UINTN Index;
EFI_SERIAL_IO_PROTOCOL *SerialIo;
- UART_DEVICE_PATH *UartNode;
+ UART_DEVICE_PATH *Uart;
+ UINT32 FlowControlMap;
+ UART_FLOW_CONTROL_DEVICE_PATH *FlowControl;
+ EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
+ UINT32 Control;
Private = NULL;
NtHandle = INVALID_HANDLE_VALUE;
//
- // Grab the protocols we need
+ // Get the Parent Device Path
//
Status = gBS->OpenProtocol (
Handle,
@@ -348,7 +451,7 @@ Returns: Status = EFI_ALREADY_STARTED;
for (Index = 0; Index < EntryCount; Index++) {
- if (OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) {
+ if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
Status = gBS->OpenProtocol (
OpenInfoBuffer[Index].ControllerHandle,
&gEfiSerialIoProtocolGuid,
@@ -358,16 +461,34 @@ Returns: EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (!EFI_ERROR (Status)) {
- UartNode = (UART_DEVICE_PATH *) RemainingDevicePath;
+ Uart = (UART_DEVICE_PATH *) RemainingDevicePath;
Status = SerialIo->SetAttributes (
- SerialIo,
- UartNode->BaudRate,
- SerialIo->Mode->ReceiveFifoDepth,
- SerialIo->Mode->Timeout,
- (EFI_PARITY_TYPE)UartNode->Parity,
- UartNode->DataBits,
- (EFI_STOP_BITS_TYPE)UartNode->StopBits
- );
+ SerialIo,
+ Uart->BaudRate,
+ SerialIo->Mode->ReceiveFifoDepth,
+ SerialIo->Mode->Timeout,
+ (EFI_PARITY_TYPE) Uart->Parity,
+ Uart->DataBits,
+ (EFI_STOP_BITS_TYPE) Uart->StopBits
+ );
+ FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (Uart);
+ if (!EFI_ERROR (Status) && IsUartFlowControlNode (FlowControl)) {
+ Status = SerialIo->GetControl (SerialIo, &Control);
+ if (!EFI_ERROR (Status)) {
+ if (FlowControl->FlowControlMap == UART_FLOW_CONTROL_HARDWARE) {
+ Control |= EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
+ } else {
+ Control &= ~EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
+ }
+ //
+ // Clear the bits that are not allowed to pass to SetControl
+ //
+ Control &= (EFI_SERIAL_REQUEST_TO_SEND | EFI_SERIAL_DATA_TERMINAL_READY |
+ EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE |
+ EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE);
+ Status = SerialIo->SetControl (SerialIo, Control);
+ }
+ }
}
break;
}
@@ -377,16 +498,18 @@ Returns: return Status;
}
+ FlowControl = NULL;
+ FlowControlMap = 0;
if (RemainingDevicePath == NULL) {
//
// Build the device path by appending the UART node to the ParentDevicePath
// from the WinNtIo handle. The Uart setings are zero here, since
// SetAttribute() will update them to match the default setings.
//
- ZeroMem (&Node, sizeof (UART_DEVICE_PATH));
- Node.Header.Type = MESSAGING_DEVICE_PATH;
- Node.Header.SubType = MSG_UART_DP;
- SetDevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) &Node, sizeof (UART_DEVICE_PATH));
+ ZeroMem (&UartNode, sizeof (UART_DEVICE_PATH));
+ UartNode.Header.Type = MESSAGING_DEVICE_PATH;
+ UartNode.Header.SubType = MSG_UART_DP;
+ SetDevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) &UartNode, sizeof (UART_DEVICE_PATH));
} else if (!IsDevicePathEnd (RemainingDevicePath)) {
//
@@ -398,7 +521,13 @@ Returns: // already checked to make sure the RemainingDevicePath contains settings
// that we can support.
//
- CopyMem (&Node, RemainingDevicePath, sizeof (UART_DEVICE_PATH));
+ CopyMem (&UartNode, RemainingDevicePath, sizeof (UART_DEVICE_PATH));
+ FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (RemainingDevicePath);
+ if (IsUartFlowControlNode (FlowControl)) {
+ FlowControlMap = FlowControl->FlowControlMap;
+ } else {
+ FlowControl = NULL;
+ }
} else {
//
@@ -447,12 +576,12 @@ Returns: Private->SoftwareLoopbackEnable = FALSE;
Private->HardwareLoopbackEnable = FALSE;
- Private->HardwareFlowControl = FALSE;
+ Private->HardwareFlowControl = (BOOLEAN) (FlowControlMap == UART_FLOW_CONTROL_HARDWARE);
Private->Fifo.First = 0;
Private->Fifo.Last = 0;
Private->Fifo.Surplus = SERIAL_MAX_BUFFER_SIZE;
- CopyMem (&Private->UartDevicePath, &Node, sizeof (UART_DEVICE_PATH));
+ CopyMem (&Private->UartDevicePath, &UartNode, sizeof (UART_DEVICE_PATH));
AddUnicodeString2 (
"eng",
@@ -488,6 +617,19 @@ Returns: ParentDevicePath,
(EFI_DEVICE_PATH_PROTOCOL *) &Private->UartDevicePath
);
+ //
+ // Only produce the FlowControl node when remaining device path has it
+ //
+ if (FlowControl != NULL) {
+ TempDevicePath = Private->DevicePath;
+ if (TempDevicePath != NULL) {
+ Private->DevicePath = AppendDevicePathNode (
+ TempDevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *) FlowControl
+ );
+ FreePool (TempDevicePath);
+ }
+ }
if (Private->DevicePath == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Error;
@@ -791,7 +933,7 @@ Returns: COMMTIMEOUTS PortTimeOuts;
DWORD ConvertedTime;
BOOL Result;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
+ UART_DEVICE_PATH *Uart;
EFI_TPL Tpl;
Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
@@ -841,7 +983,7 @@ Returns: break;
}
}
-
+
if ((ReceiveFifoDepth < 1) || (ReceiveFifoDepth > SERIAL_PORT_MAX_RECEIVE_FIFO_DEPTH)) {
return EFI_INVALID_PARAMETER;
}
@@ -976,37 +1118,25 @@ Returns: Private->UartDevicePath.Parity = (UINT8) Parity;
Private->UartDevicePath.StopBits = (UINT8) StopBits;
- NewDevicePath = AppendDevicePathNode (
- Private->ParentDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &Private->UartDevicePath
- );
- if (NewDevicePath == NULL) {
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
+ Status = EFI_SUCCESS;
if (Private->Handle != NULL) {
+ Uart = (UART_DEVICE_PATH *) (
+ (UINTN) Private->DevicePath
+ + GetDevicePathSize (Private->ParentDevicePath)
+ - END_DEVICE_PATH_LENGTH
+ );
+ CopyMem (Uart, &Private->UartDevicePath, sizeof (UART_DEVICE_PATH));
Status = gBS->ReinstallProtocolInterface (
Private->Handle,
&gEfiDevicePathProtocolGuid,
Private->DevicePath,
- NewDevicePath
+ Private->DevicePath
);
- if (EFI_ERROR (Status)) {
- gBS->RestoreTPL (Tpl);
- return Status;
- }
- }
-
- if (Private->DevicePath != NULL) {
- FreePool (Private->DevicePath);
}
- Private->DevicePath = NewDevicePath;
-
gBS->RestoreTPL (Tpl);
- return EFI_SUCCESS;
+ return Status;
}
EFI_STATUS
@@ -1038,6 +1168,8 @@ Returns: BOOL Result;
DCB Dcb;
EFI_TPL Tpl;
+ UART_FLOW_CONTROL_DEVICE_PATH *FlowControl;
+ EFI_STATUS Status;
//
// first determine the parameter is invalid
@@ -1099,9 +1231,32 @@ Returns: return EFI_DEVICE_ERROR;
}
+ Status = EFI_SUCCESS;
+ if (Private->Handle != NULL) {
+ FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) (
+ (UINTN) Private->DevicePath
+ + GetDevicePathSize (Private->ParentDevicePath)
+ - END_DEVICE_PATH_LENGTH
+ + sizeof (UART_DEVICE_PATH)
+ );
+ if (IsUartFlowControlNode (FlowControl) &&
+ ((FlowControl->FlowControlMap == UART_FLOW_CONTROL_HARDWARE) ^ Private->HardwareFlowControl)) {
+ //
+ // Flow Control setting is changed, need to reinstall device path protocol
+ //
+ FlowControl->FlowControlMap = Private->HardwareFlowControl ? UART_FLOW_CONTROL_HARDWARE : 0;
+ Status = gBS->ReinstallProtocolInterface (
+ Private->Handle,
+ &gEfiDevicePathProtocolGuid,
+ Private->DevicePath,
+ Private->DevicePath
+ );
+ }
+ }
+
gBS->RestoreTPL (Tpl);
- return EFI_SUCCESS;
+ return Status;
}
EFI_STATUS
diff --git a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.h b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.h index 348cca82b4..53fd459360 100644 --- a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.h +++ b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.h @@ -120,12 +120,15 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gWinNtSerialIoComponentName2; #define SERIAL_PARITY_DEFAULT DefaultParity
#define SERIAL_STOPBITS_DEFAULT DefaultStopBits
-#define SERIAL_CONTROL_MASK (EFI_SERIAL_CLEAR_TO_SEND | \
- EFI_SERIAL_DATA_SET_READY | \
- EFI_SERIAL_RING_INDICATE | \
- EFI_SERIAL_CARRIER_DETECT | \
- EFI_SERIAL_REQUEST_TO_SEND | \
- EFI_SERIAL_DATA_TERMINAL_READY | \
+#define SERIAL_CONTROL_MASK (EFI_SERIAL_CLEAR_TO_SEND | \
+ EFI_SERIAL_DATA_SET_READY | \
+ EFI_SERIAL_RING_INDICATE | \
+ EFI_SERIAL_CARRIER_DETECT | \
+ EFI_SERIAL_REQUEST_TO_SEND | \
+ EFI_SERIAL_DATA_TERMINAL_READY | \
+ EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | \
+ EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE | \
+ EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE | \
EFI_SERIAL_INPUT_BUFFER_EMPTY)
#define ConvertBaud2Nt(x) (DWORD) x
diff --git a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIoDxe.inf b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIoDxe.inf index 9be5441911..d4574ba541 100644 --- a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIoDxe.inf +++ b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIoDxe.inf @@ -53,6 +53,7 @@ [Guids]
gEfiWinNtSerialPortGuid # ALWAYS_CONSUMED
+ gEfiUartDevicePathGuid
[Protocols]
gEfiSerialIoProtocolGuid # PROTOCOL BY_START
diff --git a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c index e41e74964f..436df8ca96 100644 --- a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c +++ b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2006 - 2009, Intel Corporation
+Copyright (c) 2006 - 2010, Intel Corporation
All rights reserved. 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
@@ -56,6 +56,51 @@ EFI_DRIVER_BINDING_PROTOCOL gUnixSerialIoDriverBinding = { NULL
};
+/**
+ 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.
+
+**/
+BOOLEAN
+IsUartFlowControlNode (
+ IN UART_FLOW_CONTROL_DEVICE_PATH *FlowControl
+ )
+{
+ return (BOOLEAN) (
+ (DevicePathType (FlowControl) == MESSAGING_DEVICE_PATH) &&
+ (DevicePathSubType (FlowControl) == MSG_VENDOR_DP) &&
+ (CompareGuid (&FlowControl->Guid, &gEfiUartDevicePathGuid))
+ );
+}
+
+/**
+ Check the device path node whether it contains Flow Control node or not.
+
+ @param[in] DevicePath The device path to be checked.
+
+ @retval TRUE It contains the Flow Control node.
+ @retval FALSE It doesn't.
+
+**/
+BOOLEAN
+ContainsFlowControl (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ )
+{
+ while (!IsDevicePathEnd (DevicePath)) {
+ if (IsUartFlowControlNode ((UART_FLOW_CONTROL_DEVICE_PATH *) DevicePath)) {
+ return TRUE;
+ }
+ DevicePath = NextDevicePathNode (DevicePath);
+ }
+
+ return FALSE;
+}
+
UINTN
ConvertBaud2Unix (
UINT64 BaudRate
@@ -217,10 +262,15 @@ Returns: --*/
{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_UNIX_IO_PROTOCOL *UnixIo;
- UART_DEVICE_PATH *UartNode;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EFI_UNIX_IO_PROTOCOL *UnixIo;
+ UART_DEVICE_PATH *UartNode;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ UART_FLOW_CONTROL_DEVICE_PATH *FlowControlNode;
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
+ UINTN EntryCount;
+ UINTN Index;
//
// Check RemainingDevicePath validation
@@ -260,6 +310,17 @@ Returns: if ((UartNode->DataBits >= 6) && (UartNode->DataBits <= 8) && (UartNode->StopBits == OneFiveStopBits)) {
goto Error;
}
+
+ FlowControlNode = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (UartNode);
+ if (IsUartFlowControlNode (FlowControlNode)) {
+ //
+ // If the second node is Flow Control Node,
+ // return error when it request other than hardware flow control.
+ //
+ if ((FlowControlNode->FlowControlMap & ~UART_FLOW_CONTROL_HARDWARE) != 0) {
+ goto Error;
+ }
+ }
}
}
@@ -275,7 +336,45 @@ Returns: EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
+ if (RemainingDevicePath == NULL || IsDevicePathEnd (RemainingDevicePath)) {
+ //
+ // If RemainingDevicePath is NULL or is the End of Device Path Node
+ //
+ return EFI_SUCCESS;
+ }
+ //
+ // When the driver has produced device path with flow control node but RemainingDevicePath only contains UART node,
+ // return unsupported, and vice versa.
+ //
+ Status = gBS->OpenProtocolInformation (
+ Handle,
+ &gEfiUnixIoProtocolGuid,
+ &OpenInfoBuffer,
+ &EntryCount
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ for (Index = 0; Index < EntryCount; Index++) {
+ if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
+ Status = gBS->OpenProtocol (
+ OpenInfoBuffer[Index].ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &DevicePath,
+ This->DriverBindingHandle,
+ Handle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status) &&
+ (ContainsFlowControl (RemainingDevicePath) ^ ContainsFlowControl (DevicePath))) {
+ Status = EFI_UNSUPPORTED;
+ }
+ break;
+ }
+ }
+ FreePool (OpenInfoBuffer);
+ return Status;
}
if (EFI_ERROR (Status)) {
@@ -366,21 +465,25 @@ Returns: EFI_UNIX_IO_PROTOCOL *UnixIo;
UNIX_SERIAL_IO_PRIVATE_DATA *Private;
UINTN UnixHandle;
- UART_DEVICE_PATH Node;
+ UART_DEVICE_PATH UartNode;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
UINTN EntryCount;
UINTN Index;
EFI_SERIAL_IO_PROTOCOL *SerialIo;
CHAR8 AsciiDevName[1024];
- UART_DEVICE_PATH *UartNode;
+ UART_DEVICE_PATH *Uart;
+ UINT32 FlowControlMap;
+ UART_FLOW_CONTROL_DEVICE_PATH *FlowControl;
+ EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
+ UINT32 Control;
DEBUG ((EFI_D_INFO, "SerialIo drive binding start!\r\n"));
Private = NULL;
UnixHandle = -1;
//
- // Grab the protocols we need
+ // Get the Parent Device Path
//
Status = gBS->OpenProtocol (
Handle,
@@ -440,7 +543,7 @@ Returns: Status = EFI_ALREADY_STARTED;
for (Index = 0; Index < EntryCount; Index++) {
- if (OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) {
+ if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
Status = gBS->OpenProtocol (
OpenInfoBuffer[Index].ControllerHandle,
&gEfiSerialIoProtocolGuid,
@@ -450,16 +553,35 @@ Returns: EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (!EFI_ERROR (Status)) {
- UartNode = (UART_DEVICE_PATH *) RemainingDevicePath;
+ Uart = (UART_DEVICE_PATH *) RemainingDevicePath;
Status = SerialIo->SetAttributes (
- SerialIo,
- UartNode->BaudRate,
- SerialIo->Mode->ReceiveFifoDepth,
- SerialIo->Mode->Timeout,
- UartNode->Parity,
- UartNode->DataBits,
- UartNode->StopBits
- );
+ SerialIo,
+ Uart->BaudRate,
+ SerialIo->Mode->ReceiveFifoDepth,
+ SerialIo->Mode->Timeout,
+ (EFI_PARITY_TYPE) Uart->Parity,
+ Uart->DataBits,
+ (EFI_STOP_BITS_TYPE) Uart->StopBits
+ );
+
+ FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (Uart);
+ if (!EFI_ERROR (Status) && IsUartFlowControlNode (FlowControl)) {
+ Status = SerialIo->GetControl (SerialIo, &Control);
+ if (!EFI_ERROR (Status)) {
+ if (FlowControl->FlowControlMap == UART_FLOW_CONTROL_HARDWARE) {
+ Control |= EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
+ } else {
+ Control &= ~EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
+ }
+ //
+ // Clear the bits that are not allowed to pass to SetControl
+ //
+ Control &= (EFI_SERIAL_REQUEST_TO_SEND | EFI_SERIAL_DATA_TERMINAL_READY |
+ EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE |
+ EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE);
+ Status = SerialIo->SetControl (SerialIo, Control);
+ }
+ }
}
break;
}
@@ -469,16 +591,18 @@ Returns: return Status;
}
+ FlowControl = NULL;
+ FlowControlMap = 0;
if (RemainingDevicePath == NULL) {
//
// Build the device path by appending the UART node to the ParentDevicePath
// from the UnixIo handle. The Uart setings are zero here, since
// SetAttribute() will update them to match the default setings.
//
- ZeroMem (&Node, sizeof (UART_DEVICE_PATH));
- Node.Header.Type = MESSAGING_DEVICE_PATH;
- Node.Header.SubType = MSG_UART_DP;
- SetDevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) &Node, sizeof (UART_DEVICE_PATH));
+ ZeroMem (&UartNode, sizeof (UART_DEVICE_PATH));
+ UartNode.Header.Type = MESSAGING_DEVICE_PATH;
+ UartNode.Header.SubType = MSG_UART_DP;
+ SetDevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) &UartNode, sizeof (UART_DEVICE_PATH));
} else if (!IsDevicePathEnd (RemainingDevicePath)) {
//
@@ -490,7 +614,13 @@ Returns: // already checked to make sure the RemainingDevicePath contains settings
// that we can support.
//
- CopyMem (&Node, RemainingDevicePath, sizeof (UART_DEVICE_PATH));
+ CopyMem (&UartNode, RemainingDevicePath, sizeof (UART_DEVICE_PATH));
+ FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (RemainingDevicePath);
+ if (IsUartFlowControlNode (FlowControl)) {
+ FlowControlMap = FlowControl->FlowControlMap;
+ } else {
+ FlowControl = NULL;
+ }
} else {
//
@@ -536,12 +666,12 @@ Returns: Private->SoftwareLoopbackEnable = FALSE;
Private->HardwareLoopbackEnable = FALSE;
- Private->HardwareFlowControl = FALSE;
+ Private->HardwareFlowControl = (BOOLEAN) (FlowControlMap == UART_FLOW_CONTROL_HARDWARE);
Private->Fifo.First = 0;
Private->Fifo.Last = 0;
Private->Fifo.Surplus = SERIAL_MAX_BUFFER_SIZE;
- CopyMem (&Private->UartDevicePath, &Node, sizeof (UART_DEVICE_PATH));
+ CopyMem (&Private->UartDevicePath, &UartNode, sizeof (UART_DEVICE_PATH));
AddUnicodeString (
"eng",
@@ -570,6 +700,19 @@ Returns: ParentDevicePath,
(EFI_DEVICE_PATH_PROTOCOL *) &Private->UartDevicePath
);
+ //
+ // Only produce the FlowControl node when remaining device path has it
+ //
+ if (FlowControl != NULL) {
+ TempDevicePath = Private->DevicePath;
+ if (TempDevicePath != NULL) {
+ Private->DevicePath = AppendDevicePathNode (
+ TempDevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *) FlowControl
+ );
+ FreePool (TempDevicePath);
+ }
+ }
if (Private->DevicePath == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Error;
@@ -876,8 +1019,8 @@ Returns: {
EFI_STATUS Status;
UNIX_SERIAL_IO_PRIVATE_DATA *Private;
+ UART_DEVICE_PATH *Uart;
EFI_TPL Tpl;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
Tpl = gBS->RaiseTPL (TPL_NOTIFY);
Private = UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
@@ -977,9 +1120,10 @@ Returns: &Private->UnixTermios
)) {
DEBUG ((EFI_D_INFO, "Fail to set options for serial device!\r\n"));
+ gBS->RestoreTPL (Tpl);
return EFI_DEVICE_ERROR;
}
-
+
//
// Update mode
//
@@ -989,6 +1133,7 @@ Returns: Private->SerialIoMode.Parity = Parity;
Private->SerialIoMode.DataBits = DataBits;
Private->SerialIoMode.StopBits = StopBits;
+
//
// See if Device Path Node has actually changed
//
@@ -1008,37 +1153,25 @@ Returns: Private->UartDevicePath.Parity = (UINT8) Parity;
Private->UartDevicePath.StopBits = (UINT8) StopBits;
- NewDevicePath = AppendDevicePathNode (
- Private->ParentDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &Private->UartDevicePath
- );
- if (NewDevicePath == NULL) {
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
+ Status = EFI_SUCCESS;
if (Private->Handle != NULL) {
+ Uart = (UART_DEVICE_PATH *) (
+ (UINTN) Private->DevicePath
+ + GetDevicePathSize (Private->ParentDevicePath)
+ - END_DEVICE_PATH_LENGTH
+ );
+ CopyMem (Uart, &Private->UartDevicePath, sizeof (UART_DEVICE_PATH));
Status = gBS->ReinstallProtocolInterface (
Private->Handle,
&gEfiDevicePathProtocolGuid,
Private->DevicePath,
- NewDevicePath
+ Private->DevicePath
);
- if (EFI_ERROR (Status)) {
- gBS->RestoreTPL (Tpl);
- return Status;
- }
- }
-
- if (Private->DevicePath != NULL) {
- FreePool (Private->DevicePath);
}
- Private->DevicePath = NewDevicePath;
-
gBS->RestoreTPL (Tpl);
- return EFI_SUCCESS;
+ return Status;
}
EFI_STATUS
@@ -1066,17 +1199,28 @@ Returns: --*/
{
- UNIX_SERIAL_IO_PRIVATE_DATA *Private;
- UINTN Result;
- UINTN Status;
- struct termios Options;
- EFI_TPL Tpl;
+ UNIX_SERIAL_IO_PRIVATE_DATA *Private;
+ UINTN Result;
+ UINTN IoStatus;
+ struct termios Options;
+ EFI_TPL Tpl;
+ UART_FLOW_CONTROL_DEVICE_PATH *FlowControl;
+ EFI_STATUS Status;
+
+ //
+ // first determine the parameter is invalid
+ //
+ if (Control & (~(EFI_SERIAL_REQUEST_TO_SEND | EFI_SERIAL_DATA_TERMINAL_READY |
+ EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE |
+ EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE))) {
+ return EFI_UNSUPPORTED;
+ }
Tpl = gBS->RaiseTPL (TPL_NOTIFY);
Private = UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
- Result = Private->UnixThunk->IoCtl (Private->UnixHandle, TIOCMGET, &Status);
+ Result = Private->UnixThunk->IoCtl (Private->UnixHandle, TIOCMGET, &IoStatus);
if (Result == -1) {
Private->UnixThunk->Perror ("SerialSetControl");
@@ -1108,7 +1252,7 @@ Returns: Private->HardwareLoopbackEnable = TRUE;
}
- Result = Private->UnixThunk->IoCtl (Private->UnixHandle, TIOCMSET, &Status);
+ Result = Private->UnixThunk->IoCtl (Private->UnixHandle, TIOCMSET, &IoStatus);
if (Result == -1) {
Private->UnixThunk->Perror ("SerialSetControl");
@@ -1116,9 +1260,32 @@ Returns: return EFI_DEVICE_ERROR;
}
+ Status = EFI_SUCCESS;
+ if (Private->Handle != NULL) {
+ FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) (
+ (UINTN) Private->DevicePath
+ + GetDevicePathSize (Private->ParentDevicePath)
+ - END_DEVICE_PATH_LENGTH
+ + sizeof (UART_DEVICE_PATH)
+ );
+ if (IsUartFlowControlNode (FlowControl) &&
+ ((FlowControl->FlowControlMap == UART_FLOW_CONTROL_HARDWARE) ^ Private->HardwareFlowControl)) {
+ //
+ // Flow Control setting is changed, need to reinstall device path protocol
+ //
+ FlowControl->FlowControlMap = Private->HardwareFlowControl ? UART_FLOW_CONTROL_HARDWARE : 0;
+ Status = gBS->ReinstallProtocolInterface (
+ Private->Handle,
+ &gEfiDevicePathProtocolGuid,
+ Private->DevicePath,
+ Private->DevicePath
+ );
+ }
+ }
+
gBS->RestoreTPL (Tpl);
- return EFI_SUCCESS;
+ return Status;
}
EFI_STATUS
diff --git a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.h b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.h index bcd8018e4c..d392f95e80 100644 --- a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.h +++ b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.h @@ -120,12 +120,15 @@ extern EFI_COMPONENT_NAME_PROTOCOL gUnixSerialIoComponentName; #define SERIAL_PARITY_DEFAULT DefaultParity
#define SERIAL_STOPBITS_DEFAULT DefaultStopBits
-#define SERIAL_CONTROL_MASK (EFI_SERIAL_CLEAR_TO_SEND | \
- EFI_SERIAL_DATA_SET_READY | \
- EFI_SERIAL_RING_INDICATE | \
- EFI_SERIAL_CARRIER_DETECT | \
- EFI_SERIAL_REQUEST_TO_SEND | \
- EFI_SERIAL_DATA_TERMINAL_READY | \
+#define SERIAL_CONTROL_MASK (EFI_SERIAL_CLEAR_TO_SEND | \
+ EFI_SERIAL_DATA_SET_READY | \
+ EFI_SERIAL_RING_INDICATE | \
+ EFI_SERIAL_CARRIER_DETECT | \
+ EFI_SERIAL_REQUEST_TO_SEND | \
+ EFI_SERIAL_DATA_TERMINAL_READY | \
+ EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | \
+ EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE | \
+ EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE | \
EFI_SERIAL_INPUT_BUFFER_EMPTY)
#define ConvertBaud2Nt(x) (DWORD) x
diff --git a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf index 0dd672b313..e951d80736 100644 --- a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf +++ b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf @@ -57,8 +57,8 @@ [Guids]
- gEfiUnixSerialPortGuid # ALWAYS_CONSUMED
-
+ gEfiUnixSerialPortGuid # ALWAYS_CONSUMED
+ gEfiUartDevicePathGuid # BY_START
[Protocols]
gEfiSerialIoProtocolGuid # PROTOCOL BY_START
|