From 022c6d45ef78605c173023f53984e4dfaf7b11f4 Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Thu, 24 Jul 2008 02:54:45 +0000 Subject: Code Scrub for Dxe Core. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5560 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Hand/DriverSupport.c | 224 ++++++++++---------- MdeModulePkg/Core/Dxe/Hand/Handle.c | 322 ++++++++++++++--------------- MdeModulePkg/Core/Dxe/Hand/Locate.c | 189 +++++++++-------- MdeModulePkg/Core/Dxe/Hand/Notify.c | 46 ++--- 4 files changed, 389 insertions(+), 392 deletions(-) (limited to 'MdeModulePkg/Core/Dxe/Hand') diff --git a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c index 3c2980301d..773165232f 100644 --- a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c +++ b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c @@ -21,22 +21,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /** Connects one or more drivers to a controller. - @param ControllerHandle Handle of the controller to be - connected. - @param DriverImageHandle DriverImageHandle A pointer to an - ordered list of driver image - handles. - @param RemainingDevicePath RemainingDevicePath A pointer to - the device path that specifies a - child of the controller specified - by ControllerHandle. - @param Recursive Whether the function would be - called recursively or not. + @param ControllerHandle Handle of the controller to be + connected. + @param DriverImageHandle DriverImageHandle A pointer to an + ordered list of driver image + handles. + @param RemainingDevicePath RemainingDevicePath A pointer to + the device path that specifies a + child of the controller specified + by ControllerHandle. + @param Recursive Whether the function would be + called recursively or not. @return Status code. **/ -EFI_STATUS +EFI_STATUS EFIAPI CoreConnectController ( IN EFI_HANDLE ControllerHandle, @@ -56,7 +56,7 @@ CoreConnectController ( EFI_HANDLE *ChildHandleBuffer; UINTN ChildHandleCount; UINTN Index; - + // // Make sure ControllerHandle is valid // @@ -124,8 +124,8 @@ CoreConnectController ( // for (Link = Handle->Protocols.ForwardLink, ChildHandleCount = 0; Link != &Handle->Protocols; Link = Link->ForwardLink) { Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); - for (ProtLink = Prot->OpenList.ForwardLink; - ProtLink != &Prot->OpenList; + for (ProtLink = Prot->OpenList.ForwardLink; + ProtLink != &Prot->OpenList; ProtLink = ProtLink->ForwardLink) { OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { @@ -144,8 +144,8 @@ CoreConnectController ( // for (Link = Handle->Protocols.ForwardLink, ChildHandleCount = 0; Link != &Handle->Protocols; Link = Link->ForwardLink) { Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); - for (ProtLink = Prot->OpenList.ForwardLink; - ProtLink != &Prot->OpenList; + for (ProtLink = Prot->OpenList.ForwardLink; + ProtLink != &Prot->OpenList; ProtLink = ProtLink->ForwardLink) { OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { @@ -169,7 +169,7 @@ CoreConnectController ( NULL, NULL, TRUE - ); + ); } // @@ -186,17 +186,17 @@ CoreConnectController ( Add Driver Binding Protocols from Context Driver Image Handles to sorted Driver Binding Protocol list. - @param DriverBindingHandle Handle of the driver binding - protocol. - @param NumberOfSortedDriverBindingProtocols Number Of sorted driver binding - protocols - @param SortedDriverBindingProtocols The sorted protocol list. - @param DriverBindingHandleCount Driver Binding Handle Count. - @param DriverBindingHandleBuffer The buffer of driver binding - protocol to be modified. - @param IsImageHandle Indicate whether - DriverBindingHandle is an image - handle + @param DriverBindingHandle Handle of the driver binding + protocol. + @param NumberOfSortedDriverBindingProtocols Number Of sorted driver binding + protocols + @param SortedDriverBindingProtocols The sorted protocol list. + @param DriverBindingHandleCount Driver Binding Handle Count. + @param DriverBindingHandleBuffer The buffer of driver binding + protocol to be modified. + @param IsImageHandle Indicate whether + DriverBindingHandle is an image + handle @return None. @@ -204,7 +204,7 @@ CoreConnectController ( VOID AddSortedDriverBindingProtocol ( IN EFI_HANDLE DriverBindingHandle, - IN OUT UINTN *NumberOfSortedDriverBindingProtocols, + IN OUT UINTN *NumberOfSortedDriverBindingProtocols, IN OUT EFI_DRIVER_BINDING_PROTOCOL **SortedDriverBindingProtocols, IN UINTN DriverBindingHandleCount, IN OUT EFI_HANDLE *DriverBindingHandleBuffer, @@ -251,7 +251,7 @@ AddSortedDriverBindingProtocol ( if (DriverBinding->ImageHandle == DriverBindingHandle) { AddSortedDriverBindingProtocol ( DriverBindingHandleBuffer[Index], - NumberOfSortedDriverBindingProtocols, + NumberOfSortedDriverBindingProtocols, SortedDriverBindingProtocols, DriverBindingHandleCount, DriverBindingHandleBuffer, @@ -303,34 +303,34 @@ AddSortedDriverBindingProtocol ( } } } - + /** Connects a controller to a driver. - @param ControllerHandle Handle of the controller to be - connected. - @param ContextDriverImageHandles DriverImageHandle A pointer to an - ordered list of driver image - handles. - @param RemainingDevicePath RemainingDevicePath A pointer to - the device path that specifies a - child of the controller - specified by ControllerHandle. - - @retval EFI_SUCCESS One or more drivers were - connected to ControllerHandle. - @retval EFI_OUT_OF_RESOURCES No enough system resources to - complete the request. - @retval EFI_NOT_FOUND No drivers were connected to + @param ControllerHandle Handle of the controller to be + connected. + @param ContextDriverImageHandles DriverImageHandle A pointer to an + ordered list of driver image + handles. + @param RemainingDevicePath RemainingDevicePath A pointer to + the device path that specifies a + child of the controller + specified by ControllerHandle. + + @retval EFI_SUCCESS One or more drivers were + connected to ControllerHandle. + @retval EFI_OUT_OF_RESOURCES No enough system resources to + complete the request. + @retval EFI_NOT_FOUND No drivers were connected to ControllerHandle. **/ -EFI_STATUS +EFI_STATUS CoreConnectSingleController ( IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE *ContextDriverImageHandles OPTIONAL, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL ) { EFI_STATUS Status; @@ -363,10 +363,10 @@ CoreConnectSingleController ( // Get list of all Driver Binding Protocol Instances // Status = CoreLocateHandleBuffer ( - ByProtocol, - &gEfiDriverBindingProtocolGuid, + ByProtocol, + &gEfiDriverBindingProtocolGuid, NULL, - &DriverBindingHandleCount, + &DriverBindingHandleCount, &DriverBindingHandleBuffer ); if (EFI_ERROR (Status) || (DriverBindingHandleCount == 0)) { @@ -389,7 +389,7 @@ CoreConnectSingleController ( for (Index = 0; ContextDriverImageHandles[Index] != NULL; Index++) { AddSortedDriverBindingProtocol ( ContextDriverImageHandles[Index], - &NumberOfSortedDriverBindingProtocols, + &NumberOfSortedDriverBindingProtocols, SortedDriverBindingProtocols, DriverBindingHandleCount, DriverBindingHandleBuffer, @@ -402,8 +402,8 @@ CoreConnectSingleController ( // Add the Platform Driver Override Protocol drivers for ControllerHandle next // Status = CoreLocateProtocol ( - &gEfiPlatformDriverOverrideProtocolGuid, - NULL, + &gEfiPlatformDriverOverrideProtocolGuid, + NULL, (VOID **) &PlatformDriverOverride ); if (!EFI_ERROR (Status) && (PlatformDriverOverride != NULL)) { @@ -417,7 +417,7 @@ CoreConnectSingleController ( if (!EFI_ERROR (Status)) { AddSortedDriverBindingProtocol ( DriverImageHandle, - &NumberOfSortedDriverBindingProtocols, + &NumberOfSortedDriverBindingProtocols, SortedDriverBindingProtocols, DriverBindingHandleCount, DriverBindingHandleBuffer, @@ -431,8 +431,8 @@ CoreConnectSingleController ( // Get the Bus Specific Driver Override Protocol instance on the Controller Handle // Status = CoreHandleProtocol ( - ControllerHandle, - &gEfiBusSpecificDriverOverrideProtocolGuid, + ControllerHandle, + &gEfiBusSpecificDriverOverrideProtocolGuid, (VOID **) &BusSpecificDriverOverride ); if (!EFI_ERROR (Status) && (BusSpecificDriverOverride != NULL)) { @@ -445,7 +445,7 @@ CoreConnectSingleController ( if (!EFI_ERROR (Status)) { AddSortedDriverBindingProtocol ( DriverImageHandle, - &NumberOfSortedDriverBindingProtocols, + &NumberOfSortedDriverBindingProtocols, SortedDriverBindingProtocols, DriverBindingHandleCount, DriverBindingHandleBuffer, @@ -462,7 +462,7 @@ CoreConnectSingleController ( for (Index = 0; Index < DriverBindingHandleCount; Index++) { AddSortedDriverBindingProtocol ( DriverBindingHandleBuffer[Index], - &NumberOfSortedDriverBindingProtocols, + &NumberOfSortedDriverBindingProtocols, SortedDriverBindingProtocols, DriverBindingHandleCount, DriverBindingHandleBuffer, @@ -480,10 +480,10 @@ CoreConnectSingleController ( // EFI_NOT_READY, so it will be restarted // Status = CoreLocateHandleBuffer ( - ByProtocol, - &gEfiDriverBindingProtocolGuid, + ByProtocol, + &gEfiDriverBindingProtocolGuid, NULL, - &NewDriverBindingHandleCount, + &NewDriverBindingHandleCount, &NewDriverBindingHandleBuffer ); CoreFreePool (NewDriverBindingHandleBuffer); @@ -524,7 +524,7 @@ CoreConnectSingleController ( // // Loop through the sorted Driver Binding Protocol Instances in order, and see if - // any of the Driver Binding Protocols support the controller specified by + // any of the Driver Binding Protocols support the controller specified by // ControllerHandle. // DriverBinding = NULL; @@ -533,7 +533,7 @@ CoreConnectSingleController ( if (SortedDriverBindingProtocols[Index] != NULL) { DriverBinding = SortedDriverBindingProtocols[Index]; Status = DriverBinding->Supported( - DriverBinding, + DriverBinding, ControllerHandle, RemainingDevicePath ); @@ -547,7 +547,7 @@ CoreConnectSingleController ( // PERF_START (DriverBinding->DriverBindingHandle, DRIVERBINDING_START_TOK, NULL, 0); Status = DriverBinding->Start ( - DriverBinding, + DriverBinding, ControllerHandle, RemainingDevicePath ); @@ -574,7 +574,7 @@ CoreConnectSingleController ( // if (OneStarted) { return EFI_SUCCESS; - } + } // // If no drivers started and RemainingDevicePath is an End Device Path Node, then return EFI_SUCCESS @@ -583,7 +583,7 @@ CoreConnectSingleController ( if (IsDevicePathEnd (RemainingDevicePath)) { return EFI_SUCCESS; } - } + } // // Otherwise, no drivers were started on ControllerHandle, so return EFI_NOT_FOUND @@ -596,37 +596,37 @@ CoreConnectSingleController ( /** Disonnects a controller from a driver - @param ControllerHandle ControllerHandle The handle of - the controller from which - driver(s) are to be - disconnected. - @param DriverImageHandle DriverImageHandle The driver to - disconnect from ControllerHandle. - @param ChildHandle ChildHandle The handle of the - child to destroy. - - @retval EFI_SUCCESS One or more drivers were - disconnected from the controller. - @retval EFI_SUCCESS On entry, no drivers are managing - ControllerHandle. - @retval EFI_SUCCESS DriverImageHandle is not NULL, - and on entry DriverImageHandle is - not managing ControllerHandle. - @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid - EFI_HANDLE. - @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL, - and it is not a valid EFI_HANDLE. - @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it - is not a valid EFI_HANDLE. - @retval EFI_OUT_OF_RESOURCES There are not enough resources - available to disconnect any - drivers from ControllerHandle. - @retval EFI_DEVICE_ERROR The controller could not be - disconnected because of a device + @param ControllerHandle ControllerHandle The handle of + the controller from which + driver(s) are to be + disconnected. + @param DriverImageHandle DriverImageHandle The driver to + disconnect from ControllerHandle. + @param ChildHandle ChildHandle The handle of the + child to destroy. + + @retval EFI_SUCCESS One or more drivers were + disconnected from the controller. + @retval EFI_SUCCESS On entry, no drivers are managing + ControllerHandle. + @retval EFI_SUCCESS DriverImageHandle is not NULL, + and on entry DriverImageHandle is + not managing ControllerHandle. + @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid + EFI_HANDLE. + @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL, + and it is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it + is not a valid EFI_HANDLE. + @retval EFI_OUT_OF_RESOURCES There are not enough resources + available to disconnect any + drivers from ControllerHandle. + @retval EFI_DEVICE_ERROR The controller could not be + disconnected because of a device error. **/ -EFI_STATUS +EFI_STATUS EFIAPI CoreDisconnectController ( IN EFI_HANDLE ControllerHandle, @@ -677,8 +677,8 @@ CoreDisconnectController ( // Get list of drivers that are currently managing ControllerHandle // DriverImageHandleBuffer = NULL; - DriverImageHandleCount = 1; - + DriverImageHandleCount = 1; + if (DriverImageHandle == NULL) { // // Look at each protocol interface for a match @@ -688,8 +688,8 @@ CoreDisconnectController ( CoreAcquireProtocolLock (); for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) { Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); - for (ProtLink = Prot->OpenList.ForwardLink; - ProtLink != &Prot->OpenList; + for (ProtLink = Prot->OpenList.ForwardLink; + ProtLink != &Prot->OpenList; ProtLink = ProtLink->ForwardLink) { OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { @@ -698,7 +698,7 @@ CoreDisconnectController ( } } CoreReleaseProtocolLock (); - + // // If there are no drivers managing this controller, then return EFI_SUCCESS // @@ -718,8 +718,8 @@ CoreDisconnectController ( CoreAcquireProtocolLock (); for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) { Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); - for (ProtLink = Prot->OpenList.ForwardLink; - ProtLink != &Prot->OpenList; + for (ProtLink = Prot->OpenList.ForwardLink; + ProtLink != &Prot->OpenList; ProtLink = ProtLink->ForwardLink) { OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { @@ -751,8 +751,8 @@ CoreDisconnectController ( // Get the Driver Binding Protocol of the driver that is managing this controller // Status = CoreHandleProtocol ( - DriverImageHandle, - &gEfiDriverBindingProtocolGuid, + DriverImageHandle, + &gEfiDriverBindingProtocolGuid, (VOID **)&DriverBinding ); if (EFI_ERROR (Status)) { @@ -769,14 +769,14 @@ CoreDisconnectController ( CoreAcquireProtocolLock (); for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) { Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); - for (ProtLink = Prot->OpenList.ForwardLink; - ProtLink != &Prot->OpenList; + for (ProtLink = Prot->OpenList.ForwardLink; + ProtLink != &Prot->OpenList; ProtLink = ProtLink->ForwardLink) { OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); if (OpenData->AgentHandle == DriverImageHandle) { if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { ChildBufferCount++; - } + } if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { DriverImageHandleValid = TRUE; } @@ -800,8 +800,8 @@ CoreDisconnectController ( CoreAcquireProtocolLock (); for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) { Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); - for (ProtLink = Prot->OpenList.ForwardLink; - ProtLink != &Prot->OpenList; + for (ProtLink = Prot->OpenList.ForwardLink; + ProtLink != &Prot->OpenList; ProtLink = ProtLink->ForwardLink) { OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); if ((OpenData->AgentHandle == DriverImageHandle) && @@ -857,8 +857,8 @@ CoreDisconnectController ( } else { Status = EFI_NOT_FOUND; } - -Done: + +Done: if (DriverImageHandleBuffer != NULL) { CoreFreePool (DriverImageHandleBuffer); diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index 72657d8756..7f59ce9a9d 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -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 - - @retval EFI_INVALID_PARAMETER Invalid parameter - @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate + @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_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. - - @retval EFI_INVALID_PARAMETER Protocol is NULL. + @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_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. - - @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 + @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 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. - - @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 + @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 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); } diff --git a/MdeModulePkg/Core/Dxe/Hand/Locate.c b/MdeModulePkg/Core/Dxe/Hand/Locate.c index 373bf9f2d2..55211e2637 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Locate.c +++ b/MdeModulePkg/Core/Dxe/Hand/Locate.c @@ -30,7 +30,7 @@ typedef struct { PROTOCOL_ENTRY *ProtEntry; } LOCATE_POSITION; -typedef +typedef IHANDLE * (* CORE_GET_NEXT) ( IN OUT LOCATE_POSITION *Position, @@ -40,13 +40,12 @@ IHANDLE * /** Routine to get the next Handle, when you are searching for all handles. - @param Position Information about which Handle to seach for. - @param Interface Return the interface structure for the matching - protocol. + @param Position Information about which Handle to seach for. + @param Interface Return the interface structure for the matching + protocol. - @retval IHANDLE An IHANDLE is returned if the next Position is - not the end of the list. A NULL_HANDLE is - returned if it's the end of the list. + @return An pointer to IHANDLE if the next Position is not the end of the list. + Otherwise,NULL_HANDLE is returned. **/ IHANDLE * @@ -59,13 +58,12 @@ CoreGetNextLocateAllHandles ( Routine to get the next Handle, when you are searching for register protocol notifies. - @param Position Information about which Handle to seach for. - @param Interface Return the interface structure for the matching - protocol. + @param Position Information about which Handle to seach for. + @param Interface Return the interface structure for the matching + protocol. - @retval IHANDLE An IHANDLE is returned if the next Position is - not the end of the list. A NULL_HANDLE is - returned if it's the end of the list. + @return An pointer to IHANDLE if the next Position is not the end of the list. + Otherwise,NULL_HANDLE is returned. **/ IHANDLE * @@ -77,13 +75,12 @@ CoreGetNextLocateByRegisterNotify ( /** Routine to get the next Handle, when you are searching for a given protocol. - @param Position Information about which Handle to seach for. - @param Interface Return the interface structure for the matching - protocol. + @param Position Information about which Handle to seach for. + @param Interface Return the interface structure for the matching + protocol. - @retval IHANDLE An IHANDLE is returned if the next Position is - not the end of the list. A NULL_HANDLE is - returned if it's the end of the list. + @return An pointer to IHANDLE if the next Position is not the end of the list. + Otherwise,NULL_HANDLE is returned. **/ IHANDLE * @@ -96,18 +93,18 @@ CoreGetNextLocateByProtocol ( /** Locates the requested handle(s) and returns them in Buffer. - @param SearchType The type of search to perform to locate the - handles - @param Protocol The protocol to search for - @param SearchKey Dependant on SearchType - @param BufferSize On input the size of Buffer. On output the - size of data returned. - @param Buffer The buffer to return the results in - - @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is - returned in BufferSize. - @retval EFI_INVALID_PARAMETER Invalid parameter - @retval EFI_SUCCESS Successfully found the requested handle(s) and + @param SearchType The type of search to perform to locate the + handles + @param Protocol The protocol to search for + @param SearchKey Dependant on SearchType + @param BufferSize On input the size of Buffer. On output the + size of data returned. + @param Buffer The buffer to return the results in + + @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is + returned in BufferSize. + @retval EFI_INVALID_PARAMETER Invalid parameter + @retval EFI_SUCCESS Successfully found the requested handle(s) and returns them in Buffer. **/ @@ -129,15 +126,15 @@ CoreLocateHandle ( IHANDLE *Handle; IHANDLE **ResultBuffer; VOID *Interface; - + if (BufferSize == NULL) { Status = EFI_INVALID_PARAMETER; } - + if ((*BufferSize > 0) && (Buffer == NULL)) { return EFI_INVALID_PARAMETER; } - + GetNext = NULL; // @@ -160,11 +157,11 @@ CoreLocateHandle ( // Get the search function based on type // switch (SearchType) { - case AllHandles: - GetNext = CoreGetNextLocateAllHandles; + case AllHandles: + GetNext = CoreGetNextLocateAllHandles; break; - case ByRegisterNotify: + case ByRegisterNotify: // // Must have SearchKey for locate ByRegisterNotify // @@ -172,10 +169,10 @@ CoreLocateHandle ( Status = EFI_INVALID_PARAMETER; break; } - GetNext = CoreGetNextLocateByRegisterNotify; + GetNext = CoreGetNextLocateByRegisterNotify; break; - case ByProtocol: + case ByProtocol: GetNext = CoreGetNextLocateByProtocol; if (Protocol == NULL) { Status = EFI_INVALID_PARAMETER; @@ -239,15 +236,15 @@ CoreLocateHandle ( // if (ResultSize > *BufferSize) { Status = EFI_BUFFER_TOO_SMALL; - } - + } + *BufferSize = ResultSize; if (SearchType == ByRegisterNotify && !EFI_ERROR(Status)) { // // If this is a search by register notify and a handle was // returned, update the register notification position - // + // ProtNotify = SearchKey; ProtNotify->Position = ProtNotify->Position->ForwardLink; } @@ -262,9 +259,9 @@ CoreLocateHandle ( /** Routine to get the next Handle, when you are searching for all handles. - @param Position Information about which Handle to seach for. - @param Interface Return the interface structure for the matching - protocol. + @param Position Information about which Handle to seach for. + @param Interface Return the interface structure for the matching + protocol. @return An pointer to IHANDLE if the next Position is not the end of the list. Otherwise,NULL_HANDLE is returned. @@ -301,9 +298,9 @@ CoreGetNextLocateAllHandles ( Routine to get the next Handle, when you are searching for register protocol notifies. - @param Position Information about which Handle to seach for. - @param Interface Return the interface structure for the matching - protocol. + @param Position Information about which Handle to seach for. + @param Interface Return the interface structure for the matching + protocol. @return An pointer to IHANDLE if the next Position is not the end of the list. Otherwise,NULL_HANDLE is returned. @@ -318,7 +315,7 @@ CoreGetNextLocateByRegisterNotify ( IHANDLE *Handle; PROTOCOL_NOTIFY *ProtNotify; PROTOCOL_INTERFACE *Prot; - LIST_ENTRY *Link; + LIST_ENTRY *Link; Handle = NULL_HANDLE; *Interface = NULL; @@ -339,7 +336,7 @@ CoreGetNextLocateByRegisterNotify ( Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE); Handle = (IHANDLE *) Prot->Handle; *Interface = Prot->Interface; - } + } } return Handle; @@ -349,9 +346,9 @@ CoreGetNextLocateByRegisterNotify ( /** Routine to get the next Handle, when you are searching for a given protocol. - @param Position Information about which Handle to seach for. - @param Interface Return the interface structure for the matching - protocol. + @param Position Information about which Handle to seach for. + @param Interface Return the interface structure for the matching + protocol. @return An pointer to IHANDLE if the next Position is not the end of the list. Otherwise,NULL_HANDLE is returned. @@ -366,7 +363,7 @@ CoreGetNextLocateByProtocol ( IHANDLE *Handle; LIST_ENTRY *Link; PROTOCOL_INTERFACE *Prot; - + Handle = NULL_HANDLE; *Interface = NULL; for (; ;) { @@ -392,7 +389,7 @@ CoreGetNextLocateByProtocol ( *Interface = Prot->Interface; // - // If this handle has not been returned this request, then + // If this handle has not been returned this request, then // return it now // if (Handle->LocateRequest != mEfiLocateHandleRequest) { @@ -408,15 +405,15 @@ CoreGetNextLocateByProtocol ( /** Locates the handle to a device on the device path that best matches the specified protocol. - @param Protocol The protocol to search for. - @param DevicePath On input, a pointer to a pointer to the device - path. On output, the device path pointer is - modified to point to the remaining part of the - devicepath. - @param Device A pointer to the returned device handle. + @param Protocol The protocol to search for. + @param DevicePath On input, a pointer to a pointer to the device + path. On output, the device path pointer is + modified to point to the remaining part of the + devicepath. + @param Device A pointer to the returned device handle. - @retval EFI_SUCCESS The resulting handle was returned. - @retval EFI_NOT_FOUND No handles matched the search. + @retval EFI_SUCCESS The resulting handle was returned. + @retval EFI_NOT_FOUND No handles matched the search. @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. **/ @@ -438,23 +435,23 @@ CoreLocateDevicePath ( EFI_HANDLE Handle; EFI_DEVICE_PATH_PROTOCOL *SourcePath; EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath; - + if (Protocol == NULL) { return EFI_INVALID_PARAMETER; } - + if ((DevicePath == NULL) || (*DevicePath == NULL)) { return EFI_INVALID_PARAMETER; } - + if (Device == NULL) { return EFI_INVALID_PARAMETER; } - + *Device = NULL_HANDLE; SourcePath = *DevicePath; SourceSize = CoreDevicePathSize (SourcePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); - + // // The source path can only have 1 instance // @@ -493,7 +490,7 @@ CoreLocateDevicePath ( // handles // ASSERT (Size != BestMatch); - + // // We've got a match, see if it's the best match so far // @@ -505,9 +502,9 @@ CoreLocateDevicePath ( } CoreFreePool (Handles); - + // - // If there wasn't any match, then no parts of the device path was found. + // If there wasn't any match, then no parts of the device path was found. // Which is strange since there is likely a "root level" device path in the system. // if (BestMatch == -1) { @@ -528,13 +525,13 @@ CoreLocateDevicePath ( to the system. If Retistration is NULL return the first Protocol Interface you find. - @param Protocol The protocol to search for - @param Registration Optional Registration Key returned from - RegisterProtocolNotify() - @param Interface Return the Protocol interface (instance). + @param Protocol The protocol to search for + @param Registration Optional Registration Key returned from + RegisterProtocolNotify() + @param Interface Return the Protocol interface (instance). - @retval EFI_SUCCESS If a valid Interface is returned - @retval EFI_INVALID_PARAMETER Invalid parameter + @retval EFI_SUCCESS If a valid Interface is returned + @retval EFI_INVALID_PARAMETER Invalid parameter @retval EFI_NOT_FOUND Protocol interface not found **/ @@ -554,11 +551,11 @@ CoreLocateProtocol ( if (Interface == NULL) { return EFI_INVALID_PARAMETER; } - + if (Protocol == NULL) { return EFI_NOT_FOUND; } - + *Interface = NULL; Status = EFI_SUCCESS; @@ -568,7 +565,7 @@ CoreLocateProtocol ( Position.Protocol = Protocol; Position.SearchKey = Registration; Position.Position = &gHandleList; - + // // Lock the protocol database // @@ -589,7 +586,7 @@ CoreLocateProtocol ( Handle = CoreGetNextLocateByProtocol (&Position, Interface); } else { - Handle = CoreGetNextLocateByRegisterNotify (&Position, Interface); + Handle = CoreGetNextLocateByRegisterNotify (&Position, Interface); } if (Handle == NULL) { @@ -598,7 +595,7 @@ CoreLocateProtocol ( // // If this is a search by register notify and a handle was // returned, update the register notification position - // + // ProtNotify = Registration; ProtNotify->Position = ProtNotify->Position->ForwardLink; } @@ -614,20 +611,20 @@ Done: in a buffer allocated from pool. This is a version of CoreLocateHandle() that allocates a buffer for the caller. - @param SearchType Specifies which handle(s) are to be returned. - @param Protocol Provides the protocol to search by. This - parameter is only valid for SearchType - ByProtocol. - @param SearchKey Supplies the search key depending on the - SearchType. - @param NumberHandles The number of handles returned in Buffer. - @param Buffer A pointer to the buffer to return the requested - array of handles that support Protocol. - - @retval EFI_SUCCESS The result array of handles was returned. - @retval EFI_NOT_FOUND No handles match the search. - @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the - matching results. + @param SearchType Specifies which handle(s) are to be returned. + @param Protocol Provides the protocol to search by. This + parameter is only valid for SearchType + ByProtocol. + @param SearchKey Supplies the search key depending on the + SearchType. + @param NumberHandles The number of handles returned in Buffer. + @param Buffer A pointer to the buffer to return the requested + array of handles that support Protocol. + + @retval EFI_SUCCESS The result array of handles was returned. + @retval EFI_NOT_FOUND No handles match the search. + @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the + matching results. @retval EFI_INVALID_PARAMETER One or more paramters are not valid. **/ diff --git a/MdeModulePkg/Core/Dxe/Hand/Notify.c b/MdeModulePkg/Core/Dxe/Hand/Notify.c index 67fce28bd2..db3dfa1641 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Notify.c +++ b/MdeModulePkg/Core/Dxe/Hand/Notify.c @@ -42,9 +42,9 @@ CoreNotifyProtocolEntry ( /** Removes Protocol from the protocol list (but not the handle list). - @param Handle The handle to remove protocol on. - @param Protocol GUID of the protocol to be moved - @param Interface The interface of the protocol + @param Handle The handle to remove protocol on. + @param Protocol GUID of the protocol to be moved + @param Interface The interface of the protocol @return Protocol Entry @@ -92,13 +92,13 @@ CoreRemoveInterfaceFromProtocol ( /** Add a new protocol notification record for the request protocol. - @param Protocol The requested protocol to add the notify - registration - @param Event The event to signal - @param Registration Returns the registration record + @param Protocol The requested protocol to add the notify + registration + @param Event The event to signal + @param Registration Returns the registration record - @retval EFI_INVALID_PARAMETER Invalid parameter - @retval EFI_SUCCESS Successfully returned the registration record + @retval EFI_INVALID_PARAMETER Invalid parameter + @retval EFI_SUCCESS Successfully returned the registration record that has been added **/ @@ -113,7 +113,7 @@ CoreRegisterProtocolNotify ( PROTOCOL_ENTRY *ProtEntry; PROTOCOL_NOTIFY *ProtNotify; EFI_STATUS Status; - + if ((Protocol == NULL) || (Event == NULL) || (Registration == NULL)) { return EFI_INVALID_PARAMETER; } @@ -121,7 +121,7 @@ CoreRegisterProtocolNotify ( CoreAcquireProtocolLock (); ProtNotify = NULL; - + // // Get the protocol entry to add the notification too // @@ -134,14 +134,14 @@ CoreRegisterProtocolNotify ( // ProtNotify = CoreAllocateBootServicesPool (sizeof(PROTOCOL_NOTIFY)); if (ProtNotify != NULL) { - + ProtNotify->Signature = PROTOCOL_NOTIFY_SIGNATURE; ProtNotify->Protocol = ProtEntry; ProtNotify->Event = Event; // // start at the begining // - ProtNotify->Position = &ProtEntry->Protocols; + ProtNotify->Position = &ProtEntry->Protocols; InsertTailList (&ProtEntry->Notify, &ProtNotify->Link); } @@ -167,11 +167,11 @@ CoreRegisterProtocolNotify ( /** Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface. - @param UserHandle Handle on which the interface is to be - reinstalled - @param Protocol The numeric ID of the interface - @param OldInterface A pointer to the old interface - @param NewInterface A pointer to the new interface + @param UserHandle Handle on which the interface is to be + reinstalled + @param Protocol The numeric ID of the interface + @param OldInterface A pointer to the old interface + @param NewInterface A pointer to the new interface @retval EFI_SUCCESS The protocol interface was installed @retval EFI_NOT_FOUND The OldInterface on the handle was not found @@ -266,19 +266,19 @@ CoreReinstallProtocolInterface ( // CoreReleaseProtocolLock (); Status = CoreConnectController ( - UserHandle, - NULL, - NULL, + UserHandle, + NULL, + NULL, TRUE ); CoreAcquireProtocolLock (); - + // // Notify the notification list for this protocol // CoreNotifyProtocolEntry (ProtEntry); CoreReleaseProtocolLock (); - + return EFI_SUCCESS; } -- cgit v1.2.3