From dc07b3d549c2baaa4aa394d7b5350e4755d8c720 Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Mon, 21 Sep 2009 14:26:05 +0000 Subject: 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 --- MdeModulePkg/Core/Dxe/Hand/Locate.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'MdeModulePkg/Core') diff --git a/MdeModulePkg/Core/Dxe/Hand/Locate.c b/MdeModulePkg/Core/Dxe/Hand/Locate.c index ec5c2584de..861cf12ee6 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.
+Copyright (c) 2006 - 2009, Intel Corporation.
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); -- cgit v1.2.3