Enhance the ConPlatform driver's matching algorithm to manage the console controller when it shares the same parent with a certain instance in the "ConOut".

Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Elvin Li <elvin.li@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13356 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
niruiyu 2012-05-24 03:33:39 +00:00
parent 25918452ed
commit 19f508823e
1 changed files with 49 additions and 2 deletions

View File

@ -2,7 +2,7 @@
Console Platform DXE Driver, install Console Device Guids and update Console
Environment Variables.
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2012, 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
@ -771,6 +771,53 @@ ConPlatformGetVariable (
return Buffer;
}
/**
Function returns TRUE when the two input device paths point to the two
GOP child handles that have the same parent.
@param Left A pointer to a device path data structure.
@param Right A pointer to a device path data structure.
@retval TRUE Left and Right share the same parent.
@retval FALSE Left and Right don't share the same parent or either of them is not
a GOP device path.
**/
BOOLEAN
IsGopSibling (
IN EFI_DEVICE_PATH_PROTOCOL *Left,
IN EFI_DEVICE_PATH_PROTOCOL *Right
)
{
EFI_DEVICE_PATH_PROTOCOL *NodeLeft;
EFI_DEVICE_PATH_PROTOCOL *NodeRight;
for (NodeLeft = Left; !IsDevicePathEndType (NodeLeft); NodeLeft = NextDevicePathNode (NodeLeft)) {
if (DevicePathType (NodeLeft) == ACPI_DEVICE_PATH && DevicePathSubType (NodeLeft) == ACPI_ADR_DP) {
break;
}
}
if (IsDevicePathEndType (NodeLeft)) {
return FALSE;
}
for (NodeRight = Right; !IsDevicePathEndType (NodeRight); NodeRight = NextDevicePathNode (NodeRight)) {
if (DevicePathType (NodeRight) == ACPI_DEVICE_PATH && DevicePathSubType (NodeRight) == ACPI_ADR_DP) {
break;
}
}
if (IsDevicePathEndType (NodeRight)) {
return FALSE;
}
if (((UINTN) NodeLeft - (UINTN) Left) != ((UINTN) NodeRight - (UINTN) Right)) {
return FALSE;
}
return (BOOLEAN) (CompareMem (Left, Right, (UINTN) NodeLeft - (UINTN) Left) == 0);
}
/**
Function compares a device path data structure to that of all the nodes of a
second device path instance.
@ -830,7 +877,7 @@ ConPlatformMatchDevicePaths (
// Search for the match of 'Single' in 'Multi'
//
while (DevicePathInst != NULL) {
if (CompareMem (Single, DevicePathInst, Size) == 0) {
if ((CompareMem (Single, DevicePathInst, Size) == 0) || IsGopSibling (Single, DevicePathInst)) {
if (!Delete) {
//
// If Delete is FALSE, return EFI_SUCCESS if Single is found in Multi.