summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2009-09-21 14:26:05 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2009-09-21 14:26:05 +0000
commitdc07b3d549c2baaa4aa394d7b5350e4755d8c720 (patch)
tree19760e236ef628ba112970996879f5e94b3c1ad7 /MdeModulePkg
parent47e1a80bbcd1584d72d6bd8eec10b1c3ae9320af (diff)
downloadedk2-dc07b3d549c2baaa4aa394d7b5350e4755d8c720.zip
edk2-dc07b3d549c2baaa4aa394d7b5350e4755d8c720.tar.gz
edk2-dc07b3d549c2baaa4aa394d7b5350e4755d8c720.tar.bz2
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
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/Dxe/Hand/Locate.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/MdeModulePkg/Core/Dxe/Hand/Locate.c b/MdeModulePkg/Core/Dxe/Hand/Locate.c
index ec5c258..861cf12 100644
--- a/MdeModulePkg/Core/Dxe/Hand/Locate.c
+++ b/MdeModulePkg/Core/Dxe/Hand/Locate.c
@@ -1,7 +1,7 @@
/** @file
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
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
@@ -451,7 +451,19 @@ CoreLocateDevicePath (
*Device = NULL;
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
@@ -487,7 +499,7 @@ CoreLocateDevicePath (
if ((Size <= SourceSize) && CompareMem (SourcePath, TmpDevicePath, Size) == 0) {
//
// 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
//
ASSERT (Size != BestMatch);