/** @file\r
Support functions to connect/disconnect UEFI Driver model Protocol\r
\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
\r
**/\r
\r
-#include <DxeMain.h>\r
+#include "DxeMain.h"\r
+#include "Handle.h"\r
\r
\r
//\r
//\r
AlignedRemainingDevicePath = NULL;\r
if (RemainingDevicePath != NULL) {\r
- AlignedRemainingDevicePath = CoreDuplicateDevicePath (RemainingDevicePath);\r
+ AlignedRemainingDevicePath = DuplicateDevicePath (RemainingDevicePath);\r
+\r
+ if (AlignedRemainingDevicePath == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
}\r
\r
//\r
//\r
// Allocate a handle buffer for ControllerHandle's children\r
//\r
- ChildHandleBuffer = CoreAllocateBootServicesPool (ChildHandleCount * sizeof(EFI_HANDLE));\r
+ ChildHandleBuffer = AllocatePool (ChildHandleCount * sizeof(EFI_HANDLE));\r
+ if (ChildHandleBuffer == NULL) {\r
+ CoreReleaseProtocolLock ();\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
\r
//\r
// Fill in a handle buffer with ControllerHandle's children\r
//\r
// Allocate a duplicate array for the sorted Driver Binding Protocol Instances\r
//\r
- SortedDriverBindingProtocols = CoreAllocateBootServicesPool (sizeof (VOID *) * DriverBindingHandleCount);\r
+ SortedDriverBindingProtocols = AllocatePool (sizeof (VOID *) * DriverBindingHandleCount);\r
if (SortedDriverBindingProtocols == NULL) {\r
CoreFreePool (DriverBindingHandleBuffer);\r
return EFI_OUT_OF_RESOURCES;\r
for (Index = 0; (Index < NumberOfSortedDriverBindingProtocols) && !DriverFound; Index++) {\r
if (SortedDriverBindingProtocols[Index] != NULL) {\r
DriverBinding = SortedDriverBindingProtocols[Index];\r
+ PERF_START (DriverBinding->DriverBindingHandle, "DB:Support:", NULL, 0);\r
Status = DriverBinding->Supported(\r
DriverBinding,\r
ControllerHandle,\r
RemainingDevicePath\r
);\r
+ PERF_END (DriverBinding->DriverBindingHandle, "DB:Support:", NULL, 0);\r
if (!EFI_ERROR (Status)) {\r
SortedDriverBindingProtocols[Index] = NULL;\r
DriverFound = TRUE;\r
// A driver was found that supports ControllerHandle, so attempt to start the driver\r
// on ControllerHandle.\r
//\r
- PERF_START (DriverBinding->DriverBindingHandle, DRIVERBINDING_START_TOK, NULL, 0);\r
+ PERF_START (DriverBinding->DriverBindingHandle, "DB:Start:", NULL, 0);\r
Status = DriverBinding->Start (\r
DriverBinding,\r
ControllerHandle,\r
RemainingDevicePath\r
);\r
- PERF_END (DriverBinding->DriverBindingHandle, DRIVERBINDING_START_TOK, NULL, 0);\r
+ PERF_END (DriverBinding->DriverBindingHandle, "DB:Start:", NULL, 0);\r
\r
if (!EFI_ERROR (Status)) {\r
//\r
goto Done;\r
}\r
\r
- DriverImageHandleBuffer = CoreAllocateBootServicesPool (sizeof (EFI_HANDLE) * DriverImageHandleCount);\r
+ DriverImageHandleBuffer = AllocatePool (sizeof (EFI_HANDLE) * DriverImageHandleCount);\r
if (DriverImageHandleBuffer == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
goto Done;\r
&gEfiDriverBindingProtocolGuid,\r
(VOID **)&DriverBinding\r
);\r
- if (EFI_ERROR (Status)) {\r
+ if (EFI_ERROR (Status) || DriverBinding == NULL) {\r
Status = EFI_INVALID_PARAMETER;\r
goto Done;\r
}\r
ChildHandleValid = FALSE;\r
ChildBuffer = NULL;\r
if (ChildBufferCount != 0) {\r
- ChildBuffer = CoreAllocateBootServicesPool (sizeof (EFI_HANDLE) * ChildBufferCount);\r
+ ChildBuffer = AllocatePool (sizeof (EFI_HANDLE) * ChildBufferCount);\r
if (ChildBuffer == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
goto Done;\r