fix a misspelling.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10905 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey 2010-10-04 16:25:24 +00:00
parent 3c865f2064
commit 40d7a9cfaa
2 changed files with 30 additions and 9 deletions

View File

@ -321,7 +321,7 @@ ConvertHandleIndexToHandle(
**/ **/
EFI_HANDLE* EFI_HANDLE*
EFIAPI EFIAPI
GetHandleListByPotocol ( GetHandleListByProtocol (
IN CONST EFI_GUID *ProtocolGuid OPTIONAL IN CONST EFI_GUID *ProtocolGuid OPTIONAL
); );
@ -335,7 +335,7 @@ GetHandleListByPotocol (
**/ **/
EFI_HANDLE* EFI_HANDLE*
EFIAPI EFIAPI
GetHandleListByPotocolList ( GetHandleListByProtocolList (
IN CONST EFI_GUID **ProtocolGuids IN CONST EFI_GUID **ProtocolGuids
); );

View File

@ -1116,7 +1116,7 @@ ParseHandleDatabaseForChildControllers(
return Status; return Status;
} }
HandleBufferForReturn = GetHandleListByPotocol(&gEfiDriverBindingProtocolGuid); HandleBufferForReturn = GetHandleListByProtocol(&gEfiDriverBindingProtocolGuid);
if (HandleBufferForReturn == NULL) { if (HandleBufferForReturn == NULL) {
FreePool (DriverBindingHandleBuffer); FreePool (DriverBindingHandleBuffer);
return Status; return Status;
@ -1311,7 +1311,7 @@ ParseHandleDatabaseForChildDevices(
**/ **/
EFI_HANDLE* EFI_HANDLE*
EFIAPI EFIAPI
GetHandleListByPotocol ( GetHandleListByProtocol (
IN CONST EFI_GUID *ProtocolGuid OPTIONAL IN CONST EFI_GUID *ProtocolGuid OPTIONAL
) )
{ {
@ -1329,6 +1329,9 @@ GetHandleListByPotocol (
Status = gBS->LocateHandle(AllHandles, NULL, NULL, &Size, HandleList); Status = gBS->LocateHandle(AllHandles, NULL, NULL, &Size, HandleList);
if (Status == EFI_BUFFER_TOO_SMALL) { if (Status == EFI_BUFFER_TOO_SMALL) {
HandleList = AllocatePool(Size + sizeof(EFI_HANDLE)); HandleList = AllocatePool(Size + sizeof(EFI_HANDLE));
if (HandleList == NULL) {
return (NULL);
}
Status = gBS->LocateHandle(AllHandles, NULL, NULL, &Size, HandleList); Status = gBS->LocateHandle(AllHandles, NULL, NULL, &Size, HandleList);
HandleList[Size/sizeof(EFI_HANDLE)] = NULL; HandleList[Size/sizeof(EFI_HANDLE)] = NULL;
} }
@ -1336,6 +1339,9 @@ GetHandleListByPotocol (
Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)ProtocolGuid, NULL, &Size, HandleList); Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)ProtocolGuid, NULL, &Size, HandleList);
if (Status == EFI_BUFFER_TOO_SMALL) { if (Status == EFI_BUFFER_TOO_SMALL) {
HandleList = AllocatePool(Size + sizeof(EFI_HANDLE)); HandleList = AllocatePool(Size + sizeof(EFI_HANDLE));
if (HandleList == NULL) {
return (NULL);
}
Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)ProtocolGuid, NULL, &Size, HandleList); Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)ProtocolGuid, NULL, &Size, HandleList);
HandleList[Size/sizeof(EFI_HANDLE)] = NULL; HandleList[Size/sizeof(EFI_HANDLE)] = NULL;
} }
@ -1359,13 +1365,14 @@ GetHandleListByPotocol (
**/ **/
EFI_HANDLE* EFI_HANDLE*
EFIAPI EFIAPI
GetHandleListByPotocolList ( GetHandleListByProtocolList (
IN CONST EFI_GUID **ProtocolGuids IN CONST EFI_GUID **ProtocolGuids
) )
{ {
EFI_HANDLE *HandleList; EFI_HANDLE *HandleList;
UINTN Size; UINTN Size;
UINTN TotalSize; UINTN TotalSize;
UINTN TempSize;
EFI_STATUS Status; EFI_STATUS Status;
CONST EFI_GUID **GuidWalker; CONST EFI_GUID **GuidWalker;
EFI_HANDLE *HandleWalker1; EFI_HANDLE *HandleWalker1;
@ -1381,7 +1388,15 @@ GetHandleListByPotocolList (
TotalSize += Size; TotalSize += Size;
} }
} }
HandleList = AllocatePool(TotalSize);
//
// No handles were found...
//
if (TotalSize == sizeof(EFI_HANDLE)) {
return (NULL);
}
HandleList = AllocateZeroPool(TotalSize);
ASSERT(HandleList != NULL); ASSERT(HandleList != NULL);
if (HandleList == NULL) { if (HandleList == NULL) {
return (NULL); return (NULL);
@ -1389,9 +1404,15 @@ GetHandleListByPotocolList (
Size = 0; Size = 0;
for (GuidWalker = ProtocolGuids ; GuidWalker != NULL && *GuidWalker != NULL ; GuidWalker++){ for (GuidWalker = ProtocolGuids ; GuidWalker != NULL && *GuidWalker != NULL ; GuidWalker++){
Size = TotalSize - Size; TempSize = TotalSize - Size;
Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)(*GuidWalker), NULL, &Size, HandleList+((TotalSize - Size)/sizeof(EFI_HANDLE))); Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)(*GuidWalker), NULL, &TempSize, HandleList+((TotalSize - Size)/sizeof(EFI_HANDLE)));
ASSERT_EFI_ERROR(Status);
//
// Allow for missing protocols... Only update the 'used' size upon success.
//
if (!EFI_ERROR(Status)) {
Size = TempSize;
}
} }
HandleList[(TotalSize/sizeof(EFI_HANDLE))-1] = NULL; HandleList[(TotalSize/sizeof(EFI_HANDLE))-1] = NULL;