From faef695239ece2a24a0e7065ef447b97a27a53ef Mon Sep 17 00:00:00 2001 From: Ruiyu Ni Date: Sun, 12 Jun 2016 15:07:17 +0800 Subject: [PATCH] IntelFrameworkModulePkg/LegacyBios: Get COM base from SerialIo parent Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Reviewed-by: Eric Dong --- .../Csm/LegacyBiosDxe/LegacyBiosDxe.inf | 3 ++- .../Csm/LegacyBiosDxe/LegacyBiosInterface.h | 3 ++- .../Csm/LegacyBiosDxe/LegacySio.c | 17 +++++++++++------ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf index f8cc4f3fc4..9090c912aa 100644 --- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf +++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf @@ -3,7 +3,7 @@ # # This driver installs Legacy Bios Protocol to support CSM module work in EFI system. # -# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions @@ -133,6 +133,7 @@ gEfiLegacyInterruptProtocolGuid ## CONSUMES gEfiLegacyRegion2ProtocolGuid ## CONSUMES gEfiLegacyBiosProtocolGuid ## PRODUCES + gEfiSerialIoProtocolGuid ## CONSUMES [Pcd] gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLegacyBiosCacheLegacyRegion ## CONSUMES diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h index fcc0190d1e..3869e06718 100644 --- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h +++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h @@ -1,6 +1,6 @@ /** @file -Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions @@ -44,6 +44,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacySio.c b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacySio.c index 9844d64fd6..a27a477eaa 100644 --- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacySio.c +++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacySio.c @@ -49,8 +49,7 @@ LegacyBiosBuildSioDataFromIsaIo ( UINTN EntryCount; EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer; EFI_BLOCK_IO_PROTOCOL *BlockIo; - - + EFI_SERIAL_IO_PROTOCOL *SerialIo; // // Get the list of ISA controllers in the system @@ -137,10 +136,16 @@ LegacyBiosBuildSioDataFromIsaIo ( // We want resource for legacy even if no 32-bit driver installed // for (ChildIndex = 0; ChildIndex < EntryCount; ChildIndex++) { - SioSerial = &SioPtr->Serial[ResourceList->Device.UID]; - SioSerial->Address = (UINT16) IoResource->StartRange; - SioSerial->Irq = (UINT8) InterruptResource->StartRange; - SioSerial->Mode = DEVICE_SERIAL_MODE_NORMAL | DEVICE_SERIAL_MODE_DUPLEX_HALF; + if ((OpenInfoBuffer[ChildIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { + Status = gBS->HandleProtocol (OpenInfoBuffer[ChildIndex].AgentHandle, &gEfiSerialIoProtocolGuid, (VOID **) &SerialIo); + if (!EFI_ERROR (Status)) { + SioSerial = &SioPtr->Serial[ResourceList->Device.UID]; + SioSerial->Address = (UINT16) IoResource->StartRange; + SioSerial->Irq = (UINT8) InterruptResource->StartRange; + SioSerial->Mode = DEVICE_SERIAL_MODE_NORMAL | DEVICE_SERIAL_MODE_DUPLEX_HALF; + break; + } + } } FreePool (OpenInfoBuffer);