summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c
diff options
context:
space:
mode:
Diffstat (limited to 'IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c')
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c49
1 files changed, 13 insertions, 36 deletions
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c
index 0e456dd51..f487aa611 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c
@@ -1,7 +1,7 @@
/** @file
BDS Lib functions which relate with connect the device
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -65,17 +65,14 @@ BdsLibGenericConnectAll (
BdsLibConnectAllConsoles ();
}
-
/**
This function will create all handles associate with every device
path node. If the handle associate with one device path node can not
- be created successfully, Dispatch service which load the missing drivers
- is called according to input parameter, since in some cases no driver
- dependency is assumed exist, so may need not to call this service.
+ be created successfully, then still give chance to do the dispatch,
+ which load the missing drivers if possible.
@param DevicePathToConnect The device path which will be connected, it can be
a multi-instance device path
- @param NeedDispatch Whether requires dispatch service during connection
@retval EFI_SUCCESS All handles associate with every device path node
have been created
@@ -85,9 +82,9 @@ BdsLibGenericConnectAll (
**/
EFI_STATUS
-ConnectDevicePathInternal (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect,
- IN BOOLEAN NeedDispatch
+EFIAPI
+BdsLibConnectDevicePath (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
)
{
EFI_STATUS Status;
@@ -99,11 +96,14 @@ ConnectDevicePathInternal (
EFI_HANDLE Handle;
EFI_HANDLE PreviousHandle;
UINTN Size;
+ EFI_TPL CurrentTpl;
if (DevicePathToConnect == NULL) {
return EFI_SUCCESS;
}
+ CurrentTpl = EfiGetCurrentTpl ();
+
DevicePath = DuplicateDevicePath (DevicePathToConnect);
if (DevicePath == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -152,7 +152,10 @@ ConnectDevicePathInternal (
// Status == EFI_SUCCESS means a driver was dispatched
// Status == EFI_NOT_FOUND means no new drivers were dispatched
//
- if (NeedDispatch) {
+ if (CurrentTpl == TPL_APPLICATION) {
+ //
+ // Dispatch calls LoadImage/StartImage which cannot run at TPL > TPL_APPLICATION
+ //
Status = gDS->Dispatch ();
} else {
//
@@ -199,32 +202,6 @@ ConnectDevicePathInternal (
return Status;
}
-
-/**
- This function will create all handles associate with every device
- path node. If the handle associate with one device path node can not
- be created successfully, then still give chance to do the dispatch,
- which load the missing drivers if possible.
-
- @param DevicePathToConnect The device path which will be connected, it can be
- a multi-instance device path
-
- @retval EFI_SUCCESS All handles associate with every device path node
- have been created
- @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles
- @retval EFI_NOT_FOUND Create the handle associate with one device path
- node failed
-
-**/
-EFI_STATUS
-EFIAPI
-BdsLibConnectDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
- )
-{
- return ConnectDevicePathInternal(DevicePathToConnect, TRUE);
-}
-
/**
This function will connect all current system handles recursively.