mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/PciSioSerial: Fix a bug that wrongly produces 2 UARTs
When PciSioSerial is firstly started with a non-NULL remaining device path, the UART instance is created using the parameters specified in the remaining device path. Later when the driver is started again on the same UART controller with NULL remaining device path, the correct logic is to directly return SUCCESS instead of current buggy implementation which wrongly produces another UART using the default parameters. The bug causes two UARTs are created when the UART is configured in 57600 baud rate. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com>
This commit is contained in:
parent
faabc5d497
commit
4ab04a72f5
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Serial driver for PCI or SIO UARTS.
|
||||
|
||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2016, 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
|
||||
|
@ -863,11 +863,18 @@ SerialControllerDriverStart (
|
|||
ControllerNumber = 0;
|
||||
ContainsControllerNode = FALSE;
|
||||
SerialDevices = GetChildSerialDevices (Controller, IoProtocolGuid, &SerialDeviceCount);
|
||||
|
||||
if (SerialDeviceCount != 0) {
|
||||
if (RemainingDevicePath == NULL) {
|
||||
//
|
||||
// If the SerialIo instance specified by RemainingDevicePath is already created,
|
||||
// update the attributes/control.
|
||||
// If the SerialIo instance is already created, NULL as RemainingDevicePath is treated
|
||||
// as to create the same SerialIo instance.
|
||||
//
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
//
|
||||
// Update the attributes/control of the SerialIo instance specified by RemainingDevicePath.
|
||||
//
|
||||
if ((SerialDeviceCount != 0) && (RemainingDevicePath != NULL)) {
|
||||
Uart = (UART_DEVICE_PATH *) SkipControllerDevicePathNode (RemainingDevicePath, &ContainsControllerNode, &ControllerNumber);
|
||||
for (Index = 0; Index < SerialDeviceCount; Index++) {
|
||||
ASSERT ((SerialDevices != NULL) && (SerialDevices[Index] != NULL));
|
||||
|
@ -924,6 +931,7 @@ SerialControllerDriverStart (
|
|||
return Status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (RemainingDevicePath != NULL) {
|
||||
Uart = (UART_DEVICE_PATH *) SkipControllerDevicePathNode (RemainingDevicePath, &ContainsControllerNode, &ControllerNumber);
|
||||
|
|
Loading…
Reference in New Issue