Enhance DxeCore LocateDevicePath() boot service to handle muli-instance device path.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9294 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2009-09-21 14:26:05 +00:00
parent 47e1a80bbc
commit dc07b3d549
1 changed files with 15 additions and 3 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Locate handle functions Locate handle functions
Copyright (c) 2006 - 2008, Intel Corporation. <BR> Copyright (c) 2006 - 2009, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -451,7 +451,19 @@ CoreLocateDevicePath (
*Device = NULL; *Device = NULL;
SourcePath = *DevicePath; SourcePath = *DevicePath;
SourceSize = GetDevicePathSize (SourcePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); TmpDevicePath = SourcePath;
while (!IsDevicePathEnd (TmpDevicePath)) {
if (IsDevicePathEndInstance (TmpDevicePath)) {
//
// If DevicePath is a multi-instance device path,
// the function will operate on the first instance
//
break;
}
TmpDevicePath = NextDevicePathNode (TmpDevicePath);
}
SourceSize = (UINTN) TmpDevicePath - (UINTN) SourcePath;
// //
// The source path can only have 1 instance // The source path can only have 1 instance
@ -487,7 +499,7 @@ CoreLocateDevicePath (
if ((Size <= SourceSize) && CompareMem (SourcePath, TmpDevicePath, Size) == 0) { if ((Size <= SourceSize) && CompareMem (SourcePath, TmpDevicePath, Size) == 0) {
// //
// If the size is equal to the best match, then we // If the size is equal to the best match, then we
// have a duplice device path for 2 different device // have a duplicate device path for 2 different device
// handles // handles
// //
ASSERT (Size != BestMatch); ASSERT (Size != BestMatch);