mirror of https://github.com/acidanthera/audk.git
1) Update some comment.
2) Add in handle for the out_of_resource cases 3) Add in Done label to clean up the code. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5853 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
599979d4ce
commit
6c857d668c
|
@ -41,7 +41,7 @@ typedef struct {
|
||||||
#define PROTOCOL_ENTRY_SIGNATURE EFI_SIGNATURE_32('p','r','t','e')
|
#define PROTOCOL_ENTRY_SIGNATURE EFI_SIGNATURE_32('p','r','t','e')
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
LIST_ENTRY AllEntries; // All entries
|
LIST_ENTRY AllEntries; // Link Entry inserted to mProtocolDatabase
|
||||||
EFI_GUID ProtocolID; // ID of the protocol
|
EFI_GUID ProtocolID; // ID of the protocol
|
||||||
LIST_ENTRY Protocols; // All protocol interfaces
|
LIST_ENTRY Protocols; // All protocol interfaces
|
||||||
LIST_ENTRY Notify; // Registerd notification handlers
|
LIST_ENTRY Notify; // Registerd notification handlers
|
||||||
|
@ -55,8 +55,8 @@ typedef struct {
|
||||||
#define PROTOCOL_INTERFACE_SIGNATURE EFI_SIGNATURE_32('p','i','f','c')
|
#define PROTOCOL_INTERFACE_SIGNATURE EFI_SIGNATURE_32('p','i','f','c')
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
IHANDLE *Handle; // Back pointer
|
|
||||||
LIST_ENTRY Link; // Link on IHANDLE.Protocols
|
LIST_ENTRY Link; // Link on IHANDLE.Protocols
|
||||||
|
IHANDLE *Handle; // Back pointer
|
||||||
LIST_ENTRY ByProtocol; // Link on PROTOCOL_ENTRY.Protocols
|
LIST_ENTRY ByProtocol; // Link on PROTOCOL_ENTRY.Protocols
|
||||||
PROTOCOL_ENTRY *Protocol; // The protocol ID
|
PROTOCOL_ENTRY *Protocol; // The protocol ID
|
||||||
VOID *Interface; // The interface value
|
VOID *Interface; // The interface value
|
||||||
|
@ -70,7 +70,7 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
LIST_ENTRY Link;
|
LIST_ENTRY Link; //Link on PROTOCOL_INTERFACE.OpenList
|
||||||
|
|
||||||
EFI_HANDLE AgentHandle;
|
EFI_HANDLE AgentHandle;
|
||||||
EFI_HANDLE ControllerHandle;
|
EFI_HANDLE ControllerHandle;
|
||||||
|
|
|
@ -73,6 +73,10 @@ CoreConnectController (
|
||||||
AlignedRemainingDevicePath = NULL;
|
AlignedRemainingDevicePath = NULL;
|
||||||
if (RemainingDevicePath != NULL) {
|
if (RemainingDevicePath != NULL) {
|
||||||
AlignedRemainingDevicePath = DuplicateDevicePath (RemainingDevicePath);
|
AlignedRemainingDevicePath = DuplicateDevicePath (RemainingDevicePath);
|
||||||
|
|
||||||
|
if (AlignedRemainingDevicePath == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -138,6 +142,9 @@ CoreConnectController (
|
||||||
// Allocate a handle buffer for ControllerHandle's children
|
// Allocate a handle buffer for ControllerHandle's children
|
||||||
//
|
//
|
||||||
ChildHandleBuffer = AllocatePool (ChildHandleCount * sizeof(EFI_HANDLE));
|
ChildHandleBuffer = AllocatePool (ChildHandleCount * sizeof(EFI_HANDLE));
|
||||||
|
if (ChildHandleBuffer == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fill in a handle buffer with ControllerHandle's children
|
// Fill in a handle buffer with ControllerHandle's children
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/** @file
|
/** @file
|
||||||
UEFI notify infrastructure
|
Support functions for UEFI protocol notification infrastructure.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
|
@ -213,8 +213,8 @@ CoreReinstallProtocolInterface (
|
||||||
//
|
//
|
||||||
Prot = CoreFindProtocolInterface (UserHandle, Protocol, OldInterface);
|
Prot = CoreFindProtocolInterface (UserHandle, Protocol, OldInterface);
|
||||||
if (Prot == NULL) {
|
if (Prot == NULL) {
|
||||||
CoreReleaseProtocolLock ();
|
Status = EFI_NOT_FOUND;
|
||||||
return EFI_NOT_FOUND;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -228,8 +228,7 @@ CoreReinstallProtocolInterface (
|
||||||
//
|
//
|
||||||
// One or more drivers refused to release, so return the error
|
// One or more drivers refused to release, so return the error
|
||||||
//
|
//
|
||||||
CoreReleaseProtocolLock ();
|
goto Done;
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -238,8 +237,8 @@ CoreReinstallProtocolInterface (
|
||||||
Prot = CoreRemoveInterfaceFromProtocol (Handle, Protocol, OldInterface);
|
Prot = CoreRemoveInterfaceFromProtocol (Handle, Protocol, OldInterface);
|
||||||
|
|
||||||
if (Prot == NULL) {
|
if (Prot == NULL) {
|
||||||
CoreReleaseProtocolLock ();
|
Status = EFI_NOT_FOUND;
|
||||||
return EFI_NOT_FOUND;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProtEntry = Prot->Protocol;
|
ProtEntry = Prot->Protocol;
|
||||||
|
@ -265,12 +264,15 @@ CoreReinstallProtocolInterface (
|
||||||
// Release the lock and connect all drivers to UserHandle
|
// Release the lock and connect all drivers to UserHandle
|
||||||
//
|
//
|
||||||
CoreReleaseProtocolLock ();
|
CoreReleaseProtocolLock ();
|
||||||
Status = CoreConnectController (
|
//
|
||||||
UserHandle,
|
// Return code is ignored on purpose.
|
||||||
NULL,
|
//
|
||||||
NULL,
|
CoreConnectController (
|
||||||
TRUE
|
UserHandle,
|
||||||
);
|
NULL,
|
||||||
|
NULL,
|
||||||
|
TRUE
|
||||||
|
);
|
||||||
CoreAcquireProtocolLock ();
|
CoreAcquireProtocolLock ();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -280,5 +282,8 @@ CoreReinstallProtocolInterface (
|
||||||
|
|
||||||
CoreReleaseProtocolLock ();
|
CoreReleaseProtocolLock ();
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
|
Done:
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue