From af4a63857cd189964cc2c6b53b54483efaba78a3 Mon Sep 17 00:00:00 2001 From: vanjeff Date: Mon, 14 Sep 2009 08:55:03 +0000 Subject: updated the Bus Driver that is able to create all or one of its child handles on each call to Start() not to create new child handle if RemainingDeviepath is the End of Device Path Node, per UEFI 2.3. The others changes include: 1. Check RemainingDevicePath at beginning of Supported(), make sure it has been verified before Start() is called. 2. Check IO protocol firstly rather than EfiDevicePathProtocolGuid, reduce the times entering into Start() function because EfiDevicePathProtocolGuid existed on most of handle. 3. If no any child device is created on last time, and RemainingDevicePath is valid Uart Devcie path, go on creating child device handle based on this RemainingDevicePath. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9262 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c') diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c index c59565fd1e..2275d6efc9 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c @@ -2,7 +2,7 @@ Wrapper function for usb host controller interface. -Copyright (c) 2007, Intel Corporation +Copyright (c) 2007 - 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 @@ -1109,7 +1109,7 @@ UsbBusAddWantedUsbIoDP ( // // Check whether remaining device path is valid // - if (RemainingDevicePath != NULL) { + if (RemainingDevicePath != NULL && !IsDevicePathEnd (RemainingDevicePath)) { if ((RemainingDevicePath->Type != MESSAGING_DEVICE_PATH) || (RemainingDevicePath->SubType != MSG_USB_DP && RemainingDevicePath->SubType != MSG_USB_CLASS_DP @@ -1127,24 +1127,31 @@ UsbBusAddWantedUsbIoDP ( if (RemainingDevicePath == NULL) { // - // RemainingDevicePath== NULL means all Usb devices in this bus are wanted. + // RemainingDevicePath == NULL means all Usb devices in this bus are wanted. // Here use a Usb class Device Path in WantedUsbIoDPList to indicate all Usb devices // are wanted Usb devices // Status = UsbBusFreeUsbDPList (&Bus->WantedUsbIoDPList); ASSERT (!EFI_ERROR (Status)); DevicePathPtr = DuplicateDevicePath ((EFI_DEVICE_PATH_PROTOCOL *) &mAllUsbClassDevicePath); - } else { + } else if (!IsDevicePathEnd (RemainingDevicePath)) { // + // If RemainingDevicePath isn't the End of Device Path Node, // Create new Usb device path according to the usb part in remaining device path // DevicePathPtr = GetUsbDPFromFullDP (RemainingDevicePath); + } else { + // + // If RemainingDevicePath is the End of Device Path Node, + // skip enumerate any device and return EFI_SUCESSS + // + return EFI_SUCCESS; } ASSERT (DevicePathPtr != NULL); Status = AddUsbDPToList (DevicePathPtr, &Bus->WantedUsbIoDPList); ASSERT (!EFI_ERROR (Status)); - gBS->FreePool (DevicePathPtr); + FreePool (DevicePathPtr); return EFI_SUCCESS; } -- cgit v1.2.3