Code Scrub for Dxe Core.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5560 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8
2008-07-24 02:54:45 +00:00
parent 11c11e4ecf
commit 022c6d45ef
38 changed files with 2499 additions and 2504 deletions

View File

@ -59,9 +59,9 @@ CoreReleaseProtocolLock (
/**
Check whether a handle is a valid EFI_HANDLE
@param UserHandle The handle to check
@param UserHandle The handle to check
@retval EFI_INVALID_PARAMETER The handle is NULL or not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER The handle is NULL or not a valid EFI_HANDLE.
@retval EFI_SUCCESS The handle is valid EFI_HANDLE.
**/
@ -88,8 +88,8 @@ CoreValidateHandle (
Finds the protocol entry for the requested protocol.
The gProtocolDatabaseLock must be owned
@param Protocol The ID of the protocol
@param Create Create a new entry if not found
@param Protocol The ID of the protocol
@param Create Create a new entry if not found
@return Protocol entry
@ -111,8 +111,8 @@ CoreFindProtocolEntry (
//
ProtEntry = NULL;
for (Link = mProtocolDatabase.ForwardLink;
Link != &mProtocolDatabase;
for (Link = mProtocolDatabase.ForwardLink;
Link != &mProtocolDatabase;
Link = Link->ForwardLink) {
Item = CR(Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);
@ -128,12 +128,12 @@ CoreFindProtocolEntry (
}
//
// If the protocol entry was not found and Create is TRUE, then
// If the protocol entry was not found and Create is TRUE, then
// allocate a new entry
//
//
if ((ProtEntry == NULL) && Create) {
ProtEntry = CoreAllocateBootServicesPool (sizeof(PROTOCOL_ENTRY));
if (ProtEntry != NULL) {
//
// Initialize new protocol entry structure
@ -160,9 +160,9 @@ CoreFindProtocolEntry (
Note: This function doesn't do parameters checking, it's caller's responsibility
to pass in valid parameters.
@param Handle The handle to search the protocol on
@param Protocol GUID of the protocol
@param Interface The interface for the protocol being searched
@param Handle The handle to search the protocol on
@param Protocol GUID of the protocol
@param Interface The interface for the protocol being searched
@return Protocol instance (NULL: Not found)
@ -212,8 +212,8 @@ CoreFindProtocolInterface (
/**
Removes an event from a register protocol notify list on a protocol.
@param Event The event to search for in the protocol
database.
@param Event The event to search for in the protocol
database.
@return EFI_SUCCESS if the event was found and removed.
@return EFI_NOT_FOUND if the event was not found in the protocl database.
@ -231,14 +231,14 @@ CoreUnregisterProtocolNotifyEvent (
CoreAcquireProtocolLock ();
for ( Link = mProtocolDatabase.ForwardLink;
Link != &mProtocolDatabase;
for ( Link = mProtocolDatabase.ForwardLink;
Link != &mProtocolDatabase;
Link = Link->ForwardLink) {
ProtEntry = CR(Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);
for ( NotifyLink = ProtEntry->Notify.ForwardLink;
NotifyLink != &ProtEntry->Notify;
for ( NotifyLink = ProtEntry->Notify.ForwardLink;
NotifyLink != &ProtEntry->Notify;
NotifyLink = NotifyLink->ForwardLink) {
ProtNotify = CR(NotifyLink, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
@ -261,8 +261,8 @@ CoreUnregisterProtocolNotifyEvent (
/**
Removes all the events in the protocol database that match Event.
@param Event The event to search for in the protocol
database.
@param Event The event to search for in the protocol
database.
@return EFI_SUCCESS when done searching the entire database.
@ -288,12 +288,12 @@ CoreUnregisterProtocolNotify (
Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
Calls the private one which contains a BOOLEAN parameter for notifications
@param UserHandle The handle to install the protocol handler on,
or NULL if a new handle is to be allocated
@param Protocol The protocol to add to the handle
@param InterfaceType Indicates whether Interface is supplied in
native form.
@param Interface The interface for the protocol being added
@param UserHandle The handle to install the protocol handler on,
or NULL if a new handle is to be allocated
@param Protocol The protocol to add to the handle
@param InterfaceType Indicates whether Interface is supplied in
native form.
@param Interface The interface for the protocol being added
@return Status code
@ -308,10 +308,10 @@ CoreInstallProtocolInterface (
)
{
return CoreInstallProtocolInterfaceNotify (
UserHandle,
Protocol,
InterfaceType,
Interface,
UserHandle,
Protocol,
InterfaceType,
Interface,
TRUE
);
}
@ -320,17 +320,17 @@ CoreInstallProtocolInterface (
/**
Installs a protocol interface into the boot services environment.
@param UserHandle The handle to install the protocol handler on,
or NULL if a new handle is to be allocated
@param Protocol The protocol to add to the handle
@param InterfaceType Indicates whether Interface is supplied in
native form.
@param Interface The interface for the protocol being added
@param Notify indicates whether notify the notification list
for this protocol
@param UserHandle The handle to install the protocol handler on,
or NULL if a new handle is to be allocated
@param Protocol The protocol to add to the handle
@param InterfaceType Indicates whether Interface is supplied in
native form.
@param Interface The interface for the protocol being added
@param Notify indicates whether notify the notification list
for this protocol
@retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
@retval EFI_INVALID_PARAMETER Invalid parameter
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
@retval EFI_SUCCESS Protocol interface successfully installed
**/
@ -380,7 +380,7 @@ CoreInstallProtocolInterfaceNotify (
}
//
// Lock the protocol database
// Lock the protocol database
//
CoreAcquireProtocolLock ();
@ -429,7 +429,7 @@ CoreInstallProtocolInterfaceNotify (
// in the system
//
InsertTailList (&gHandleList, &Handle->AllHandles);
}
}
Status = CoreValidateHandle (Handle);
if (EFI_ERROR (Status)) {
@ -456,19 +456,19 @@ CoreInstallProtocolInterfaceNotify (
Prot->OpenListCount = 0;
//
// Add this protocol interface to the head of the supported
// Add this protocol interface to the head of the supported
// protocol list for this handle
//
InsertHeadList (&Handle->Protocols, &Prot->Link);
//
// Add this protocol interface to the tail of the
// Add this protocol interface to the tail of the
// protocol entry
//
//
InsertTailList (&ProtEntry->Protocols, &Prot->ByProtocol);
//
// Notify the notification list for this protocol
// Notify the notification list for this protocol
//
if (Notify) {
CoreNotifyProtocolEntry (ProtEntry);
@ -506,14 +506,14 @@ Done:
occures all the protocols added by this function are removed. This is
basically a lib function to save space.
@param Handle The handle to install the protocol handlers on,
or NULL if a new handle is to be allocated
@param ... EFI_GUID followed by protocol instance. A NULL
terminates the list. The pairs are the
arguments to InstallProtocolInterface(). All the
protocols are added to Handle.
@param Handle The handle to install the protocol handlers on,
or NULL if a new handle is to be allocated
@param ... EFI_GUID followed by protocol instance. A NULL
terminates the list. The pairs are the
arguments to InstallProtocolInterface(). All the
protocols are added to Handle.
@retval EFI_INVALID_PARAMETER Handle is NULL.
@retval EFI_INVALID_PARAMETER Handle is NULL.
@retval EFI_SUCCESS Protocol interfaces successfully installed.
**/
@ -533,14 +533,14 @@ CoreInstallMultipleProtocolInterfaces (
EFI_HANDLE OldHandle;
EFI_HANDLE DeviceHandle;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
if (Handle == NULL) {
return EFI_INVALID_PARAMETER;
}
//
// Syncronize with notifcations.
//
// Syncronize with notifcations.
//
OldTpl = CoreRaiseTpl (TPL_NOTIFY);
OldHandle = *Handle;
@ -571,13 +571,13 @@ CoreInstallMultipleProtocolInterfaces (
continue;
}
}
//
// Install it
//
Status = CoreInstallProtocolInterface (Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);
}
//
// If there was an error, remove all the interfaces that were installed without any errors
//
@ -590,7 +590,7 @@ CoreInstallMultipleProtocolInterfaces (
Protocol = VA_ARG (Args, EFI_GUID *);
Interface = VA_ARG (Args, VOID *);
CoreUninstallProtocolInterface (*Handle, Protocol, Interface);
}
}
*Handle = OldHandle;
}
@ -608,11 +608,11 @@ CoreInstallMultipleProtocolInterfaces (
Note: This function doesn't do parameters checking, it's caller's responsibility
to pass in valid parameters.
@param UserHandle The handle on which the protocol is installed
@param Prot The protocol to disconnect drivers from
@param UserHandle The handle on which the protocol is installed
@param Prot The protocol to disconnect drivers from
@retval EFI_SUCCESS Drivers using the protocol interface are all
disconnected
@retval EFI_SUCCESS Drivers using the protocol interface are all
disconnected
@retval EFI_ACCESS_DENIED Failed to disconnect one or all of the drivers
**/
@ -628,7 +628,7 @@ CoreDisconnectControllersUsingProtocolInterface (
OPEN_PROTOCOL_DATA *OpenData;
Status = EFI_SUCCESS;
//
// Attempt to disconnect all drivers from this protocol interface
//
@ -661,10 +661,10 @@ CoreDisconnectControllersUsingProtocolInterface (
(Link != &Prot->OpenList) && !ItemFound;
Link = Link->ForwardLink ) {
OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
if (OpenData->Attributes &
if (OpenData->Attributes &
(EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET_PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) {
ItemFound = TRUE;
RemoveEntryList (&OpenData->Link);
RemoveEntryList (&OpenData->Link);
Prot->OpenListCount--;
CoreFreePool (OpenData);
}
@ -692,11 +692,11 @@ CoreDisconnectControllersUsingProtocolInterface (
If the last protocol interface is remove from the handle, the
handle is freed.
@param UserHandle The handle to remove the protocol handler from
@param Protocol The protocol, of protocol:interface, to remove
@param Interface The interface, of protocol:interface, to remove
@param UserHandle The handle to remove the protocol handler from
@param Protocol The protocol, of protocol:interface, to remove
@param Interface The interface, of protocol:interface, to remove
@retval EFI_INVALID_PARAMETER Protocol is NULL.
@retval EFI_INVALID_PARAMETER Protocol is NULL.
@retval EFI_SUCCESS Protocol interface successfully uninstalled.
**/
@ -768,7 +768,7 @@ CoreUninstallProtocolInterface (
//
gHandleDatabaseKey++;
Handle->Key = gHandleDatabaseKey;
//
// Remove the protocol interface from the handle
//
@ -791,7 +791,7 @@ CoreUninstallProtocolInterface (
CoreFreePool (Handle);
}
Done:
Done:
//
// Done, unlock the database and return
//
@ -807,11 +807,11 @@ Done:
This function calls UnisatllProtocolInterface() in a loop. This is
basically a lib function to save space.
@param Handle The handle to uninstall the protocol
@param ... EFI_GUID followed by protocol instance. A NULL
terminates the list. The pairs are the
arguments to UninstallProtocolInterface(). All
the protocols are added to Handle.
@param Handle The handle to uninstall the protocol
@param ... EFI_GUID followed by protocol instance. A NULL
terminates the list. The pairs are the
arguments to UninstallProtocolInterface(). All
the protocols are added to Handle.
@return Status code
@ -860,18 +860,18 @@ CoreUninstallMultipleProtocolInterfaces (
Protocol = VA_ARG(Args, EFI_GUID *);
Interface = VA_ARG(Args, VOID *);
CoreInstallProtocolInterface (&Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);
}
}
}
return Status;
}
}
/**
Locate a certain GUID protocol interface in a Handle's protocols.
@param UserHandle The handle to obtain the protocol interface on
@param Protocol The GUID of the protocol
@param UserHandle The handle to obtain the protocol interface on
@param Protocol The GUID of the protocol
@return The requested protocol interface for the handle
@ -892,7 +892,7 @@ CoreGetProtocolInterface (
if (EFI_ERROR (Status)) {
return NULL;
}
Handle = (IHANDLE *)UserHandle;
//
@ -913,10 +913,10 @@ CoreGetProtocolInterface (
/**
Queries a handle to determine if it supports a specified protocol.
@param UserHandle The handle being queried.
@param Protocol The published unique identifier of the protocol.
@param Interface Supplies the address where a pointer to the
corresponding Protocol Interface is returned.
@param UserHandle The handle being queried.
@param Protocol The published unique identifier of the protocol.
@param Interface Supplies the address where a pointer to the
corresponding Protocol Interface is returned.
@return The requested protocol interface for the handle
@ -930,11 +930,11 @@ CoreHandleProtocol (
)
{
return CoreOpenProtocol (
UserHandle,
Protocol,
Interface,
gDxeCoreImageHandle,
NULL,
UserHandle,
Protocol,
Interface,
gDxeCoreImageHandle,
NULL,
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
);
}
@ -946,18 +946,18 @@ CoreHandleProtocol (
invokes it to obtain the protocol interface. Usage information
is registered in the protocol data base.
@param UserHandle The handle to obtain the protocol interface on
@param Protocol The ID of the protocol
@param Interface The location to return the protocol interface
@param ImageHandle The handle of the Image that is opening the
protocol interface specified by Protocol and
Interface.
@param ControllerHandle The controller handle that is requiring this
interface.
@param Attributes The open mode of the protocol interface
specified by Handle and Protocol.
@param UserHandle The handle to obtain the protocol interface on
@param Protocol The ID of the protocol
@param Interface The location to return the protocol interface
@param ImageHandle The handle of the Image that is opening the
protocol interface specified by Protocol and
Interface.
@param ControllerHandle The controller handle that is requiring this
interface.
@param Attributes The open mode of the protocol interface
specified by Handle and Protocol.
@retval EFI_INVALID_PARAMETER Protocol is NULL.
@retval EFI_INVALID_PARAMETER Protocol is NULL.
@retval EFI_SUCCESS Get the protocol interface.
**/
@ -998,7 +998,7 @@ CoreOpenProtocol (
*Interface = NULL;
}
}
//
// Check for invalid UserHandle
//
@ -1065,7 +1065,7 @@ CoreOpenProtocol (
//
// This is the protocol interface entry for this protocol
//
//
if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {
*Interface = Prot->Interface;
}
@ -1075,7 +1075,7 @@ CoreOpenProtocol (
Exclusive = FALSE;
for ( Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList; Link = Link->ForwardLink) {
OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
ExactMatch = (BOOLEAN)((OpenData->AgentHandle == ImageHandle) &&
ExactMatch = (BOOLEAN)((OpenData->AgentHandle == ImageHandle) &&
(OpenData->Attributes == Attributes) &&
(OpenData->ControllerHandle == ControllerHandle));
if (OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) {
@ -1131,7 +1131,7 @@ CoreOpenProtocol (
}
}
} while (Disconnect);
}
}
break;
case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER :
case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL :
@ -1174,25 +1174,25 @@ Done:
/**
Closes a protocol on a handle that was opened using OpenProtocol().
@param UserHandle The handle for the protocol interface that was
previously opened with OpenProtocol(), and is
now being closed.
@param Protocol The published unique identifier of the protocol.
It is the caller's responsibility to pass in a
valid GUID.
@param AgentHandle The handle of the agent that is closing the
protocol interface.
@param ControllerHandle If the agent that opened a protocol is a driver
that follows the EFI Driver Model, then this
parameter is the controller handle that required
the protocol interface. If the agent does not
follow the EFI Driver Model, then this parameter
is optional and may be NULL.
@param UserHandle The handle for the protocol interface that was
previously opened with OpenProtocol(), and is
now being closed.
@param Protocol The published unique identifier of the protocol.
It is the caller's responsibility to pass in a
valid GUID.
@param AgentHandle The handle of the agent that is closing the
protocol interface.
@param ControllerHandle If the agent that opened a protocol is a driver
that follows the EFI Driver Model, then this
parameter is the controller handle that required
the protocol interface. If the agent does not
follow the EFI Driver Model, then this parameter
is optional and may be NULL.
@retval EFI_SUCCESS The protocol instance was closed.
@retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
valid EFI_HANDLE.
@retval EFI_NOT_FOUND Can not find the specified protocol or
@retval EFI_SUCCESS The protocol instance was closed.
@retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
valid EFI_HANDLE.
@retval EFI_NOT_FOUND Can not find the specified protocol or
AgentHandle.
**/
@ -1202,7 +1202,7 @@ CoreCloseProtocol (
IN EFI_HANDLE UserHandle,
IN EFI_GUID *Protocol,
IN EFI_HANDLE AgentHandle,
IN EFI_HANDLE ControllerHandle
IN EFI_HANDLE ControllerHandle
)
{
EFI_STATUS Status;
@ -1253,7 +1253,7 @@ CoreCloseProtocol (
OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
Link = Link->ForwardLink;
if ((OpenData->AgentHandle == AgentHandle) && (OpenData->ControllerHandle == ControllerHandle)) {
RemoveEntryList (&OpenData->Link);
RemoveEntryList (&OpenData->Link);
ProtocolInterface->OpenListCount--;
CoreFreePool (OpenData);
Status = EFI_SUCCESS;
@ -1274,11 +1274,11 @@ Done:
/**
Return information about Opened protocols in the system
@param UserHandle The handle to close the protocol interface on
@param Protocol The ID of the protocol
@param EntryBuffer A pointer to a buffer of open protocol
information in the form of
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
@param UserHandle The handle to close the protocol interface on
@param Protocol The ID of the protocol
@param EntryBuffer A pointer to a buffer of open protocol
information in the form of
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
@param EntryCount Number of EntryBuffer entries
**/
@ -1319,11 +1319,11 @@ CoreOpenProtocolInformation (
//
// Count the number of Open Entries
//
for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;
for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;
(Link != &ProtocolInterface->OpenList) ;
Link = Link->ForwardLink ) {
Count++;
}
}
ASSERT (Count == ProtocolInterface->OpenListCount);
@ -1340,7 +1340,7 @@ CoreOpenProtocolInformation (
}
Status = EFI_SUCCESS;
for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;
for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;
(Link != &ProtocolInterface->OpenList);
Link = Link->ForwardLink, Count++ ) {
OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
@ -1349,11 +1349,11 @@ CoreOpenProtocolInformation (
Buffer[Count].ControllerHandle = OpenData->ControllerHandle;
Buffer[Count].Attributes = OpenData->Attributes;
Buffer[Count].OpenCount = OpenData->OpenCount;
}
}
*EntryBuffer = Buffer;
*EntryCount = Count;
Done:
//
// Done. Release the database lock are return
@ -1369,22 +1369,22 @@ Done:
Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
from pool.
@param UserHandle The handle from which to retrieve the list of
protocol interface GUIDs.
@param ProtocolBuffer A pointer to the list of protocol interface GUID
pointers that are installed on Handle.
@param ProtocolBufferCount A pointer to the number of GUID pointers present
in ProtocolBuffer.
@param UserHandle The handle from which to retrieve the list of
protocol interface GUIDs.
@param ProtocolBuffer A pointer to the list of protocol interface GUID
pointers that are installed on Handle.
@param ProtocolBufferCount A pointer to the number of GUID pointers present
in ProtocolBuffer.
@retval EFI_SUCCESS The list of protocol interface GUIDs installed
on Handle was returned in ProtocolBuffer. The
number of protocol interface GUIDs was returned
in ProtocolBufferCount.
@retval EFI_INVALID_PARAMETER Handle is NULL.
@retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
@retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
@retval EFI_SUCCESS The list of protocol interface GUIDs installed
on Handle was returned in ProtocolBuffer. The
number of protocol interface GUIDs was returned
in ProtocolBufferCount.
@retval EFI_INVALID_PARAMETER Handle is NULL.
@retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
@retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
results.
**/
@ -1423,7 +1423,7 @@ CoreProtocolsPerHandle (
ProtocolCount = 0;
CoreAcquireProtocolLock ();
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
ProtocolCount++;
}
@ -1446,7 +1446,7 @@ CoreProtocolsPerHandle (
*ProtocolBufferCount = ProtocolCount;
for ( Link = Handle->Protocols.ForwardLink, ProtocolCount = 0;
Link != &Handle->Protocols;
Link != &Handle->Protocols;
Link = Link->ForwardLink, ProtocolCount++) {
Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
Buffer[ProtocolCount] = &(Prot->Protocol->ProtocolID);
@ -1480,7 +1480,7 @@ CoreGetHandleDatabaseKey (
/**
Go connect any handles that were created or modified while a image executed.
@param Key The Key to show that the handle has been
@param Key The Key to show that the handle has been
created/modified
**/
@ -1512,7 +1512,7 @@ CoreConnectHandlesByKey (
CoreReleaseProtocolLock ();
return;
}
for (Link = gHandleList.ForwardLink, Count = 0; Link != &gHandleList; Link = Link->ForwardLink) {
Handle = CR (Link, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
if (Handle->Key > Key) {
@ -1531,6 +1531,6 @@ CoreConnectHandlesByKey (
for (Index = 0; Index < Count; Index++) {
CoreConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
}
CoreFreePool(HandleBuffer);
}