From e94a9ff7271367e649ee4f9a86da1f1bea6d112e Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Fri, 18 Jul 2008 09:50:09 +0000 Subject: Code scrub for DxeCore git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5520 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Hand/DriverSupport.c | 47 +++++------------------------- MdeModulePkg/Core/Dxe/Hand/Handle.c | 4 +-- MdeModulePkg/Core/Dxe/Hand/Locate.c | 37 +++++++++-------------- MdeModulePkg/Core/Dxe/Hand/Notify.c | 24 +++++---------- 4 files changed, 31 insertions(+), 81 deletions(-) (limited to 'MdeModulePkg/Core/Dxe/Hand') diff --git a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c index 930003304a..3c2980301d 100644 --- a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c +++ b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c @@ -14,41 +14,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include -// -// Driver Support Function Prototypes -// -/** - 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 - ControllerHandle. - -**/ -EFI_STATUS -CoreConnectSingleController ( - IN EFI_HANDLE ControllerHandle, - IN EFI_HANDLE *ContextDriverImageHandles OPTIONAL, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL - ); // // Driver Support Functions // - /** Connects one or more drivers to a controller. @@ -114,10 +83,10 @@ CoreConnectController ( // do { ReturnStatus = CoreConnectSingleController ( - ControllerHandle, - DriverImageHandle, - AlignedRemainingDevicePath - ); + ControllerHandle, + DriverImageHandle, + AlignedRemainingDevicePath + ); } while (ReturnStatus == EFI_NOT_READY); // @@ -269,7 +238,7 @@ AddSortedDriverBindingProtocol ( Status = CoreHandleProtocol ( DriverBindingHandleBuffer[Index], &gEfiDriverBindingProtocolGuid, - (VOID **)&DriverBinding + (VOID **) &DriverBinding ); if (EFI_ERROR (Status) || DriverBinding == NULL) { continue; @@ -299,7 +268,7 @@ AddSortedDriverBindingProtocol ( Status = CoreHandleProtocol( DriverBindingHandle, &gEfiDriverBindingProtocolGuid, - (VOID **)&DriverBinding + (VOID **) &DriverBinding ); // // If DriverBindingHandle does not support the Driver Binding Protocol then return @@ -435,7 +404,7 @@ CoreConnectSingleController ( Status = CoreLocateProtocol ( &gEfiPlatformDriverOverrideProtocolGuid, NULL, - (VOID **)&PlatformDriverOverride + (VOID **) &PlatformDriverOverride ); if (!EFI_ERROR (Status) && (PlatformDriverOverride != NULL)) { DriverImageHandle = NULL; @@ -464,7 +433,7 @@ CoreConnectSingleController ( Status = CoreHandleProtocol ( ControllerHandle, &gEfiBusSpecificDriverOverrideProtocolGuid, - (VOID **)&BusSpecificDriverOverride + (VOID **) &BusSpecificDriverOverride ); if (!EFI_ERROR (Status) && (BusSpecificDriverOverride != NULL)) { DriverImageHandle = NULL; diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index b07a3a2a58..72657d8756 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -21,7 +21,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // gProtocolDatabaseLock - Lock to protect the mProtocolDatabase // gHandleDatabaseKey - The Key to show that the handle has been created/modified // -STATIC LIST_ENTRY mProtocolDatabase = INITIALIZE_LIST_HEAD_VARIABLE (mProtocolDatabase); +LIST_ENTRY mProtocolDatabase = INITIALIZE_LIST_HEAD_VARIABLE (mProtocolDatabase); LIST_ENTRY gHandleList = INITIALIZE_LIST_HEAD_VARIABLE (gHandleList); EFI_LOCK gProtocolDatabaseLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY); UINT64 gHandleDatabaseKey = 0; @@ -139,7 +139,7 @@ CoreFindProtocolEntry ( // Initialize new protocol entry structure // ProtEntry->Signature = PROTOCOL_ENTRY_SIGNATURE; - CopyMem ((VOID *)&ProtEntry->ProtocolID, Protocol, sizeof (EFI_GUID)); + CopyGuid ((VOID *)&ProtEntry->ProtocolID, Protocol); InitializeListHead (&ProtEntry->Protocols); InitializeListHead (&ProtEntry->Notify); diff --git a/MdeModulePkg/Core/Dxe/Hand/Locate.c b/MdeModulePkg/Core/Dxe/Hand/Locate.c index c8ea7a83a8..373bf9f2d2 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Locate.c +++ b/MdeModulePkg/Core/Dxe/Hand/Locate.c @@ -139,10 +139,10 @@ CoreLocateHandle ( } GetNext = NULL; + // // Set initial position // - Position.Protocol = Protocol; Position.SearchKey = SearchKey; Position.Position = &gHandleList; @@ -154,7 +154,6 @@ CoreLocateHandle ( // // Lock the protocol database // - CoreAcquireProtocolLock (); // @@ -267,9 +266,8 @@ CoreLocateHandle ( @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 * @@ -307,9 +305,8 @@ CoreGetNextLocateAllHandles ( @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 * @@ -349,7 +346,6 @@ CoreGetNextLocateByRegisterNotify ( } - /** Routine to get the next Handle, when you are searching for a given protocol. @@ -357,9 +353,8 @@ CoreGetNextLocateByRegisterNotify ( @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 * @@ -410,8 +405,6 @@ CoreGetNextLocateByProtocol ( } - - /** Locates the handle to a device on the device path that best matches the specified protocol. @@ -529,9 +522,7 @@ CoreLocateDevicePath ( } - - -/** + /** Return the first Protocol Interface that matches the Protocol GUID. If Registration is pasased in return a Protocol Instance that was just add to the system. If Retistration is NULL return the first Protocol Interface @@ -585,7 +576,7 @@ CoreLocateProtocol ( mEfiLocateHandleRequest += 1; - if (NULL == Registration) { + if (Registration == NULL) { // // Look up the protocol entry and set the head pointer // @@ -601,9 +592,9 @@ CoreLocateProtocol ( Handle = CoreGetNextLocateByRegisterNotify (&Position, Interface); } - if (NULL == Handle) { + if (Handle == NULL) { Status = EFI_NOT_FOUND; - } else if (NULL != Registration) { + } else if (Registration != NULL) { // // If this is a search by register notify and a handle was // returned, update the register notification position @@ -618,8 +609,6 @@ Done: } - - /** Function returns an array of handles that support the requested protocol in a buffer allocated from pool. This is a version of CoreLocateHandle() @@ -639,7 +628,7 @@ Done: @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 Invalid parameter + @retval EFI_INVALID_PARAMETER One or more paramters are not valid. **/ EFI_STATUS @@ -699,7 +688,7 @@ CoreLocateHandleBuffer ( *Buffer ); - *NumberHandles = BufferSize/sizeof(EFI_HANDLE); + *NumberHandles = BufferSize / sizeof(EFI_HANDLE); if (EFI_ERROR(Status)) { *NumberHandles = 0; } diff --git a/MdeModulePkg/Core/Dxe/Hand/Notify.c b/MdeModulePkg/Core/Dxe/Hand/Notify.c index 395cdd4577..67fce28bd2 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Notify.c +++ b/MdeModulePkg/Core/Dxe/Hand/Notify.c @@ -71,7 +71,6 @@ CoreRemoveInterfaceFromProtocol ( // // If there's a protocol notify location pointing to this entry, back it up one // - for(Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) { ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE); @@ -83,7 +82,6 @@ CoreRemoveInterfaceFromProtocol ( // // Remove the protocol interface entry // - RemoveEntryList (&Prot->ByProtocol); } @@ -91,8 +89,6 @@ CoreRemoveInterfaceFromProtocol ( } - - /** Add a new protocol notification record for the request protocol. @@ -111,11 +107,11 @@ EFIAPI CoreRegisterProtocolNotify ( IN EFI_GUID *Protocol, IN EFI_EVENT Event, - OUT VOID **Registration + OUT VOID **Registration ) { - PROTOCOL_ENTRY *ProtEntry; - PROTOCOL_NOTIFY *ProtNotify; + PROTOCOL_ENTRY *ProtEntry; + PROTOCOL_NOTIFY *ProtNotify; EFI_STATUS Status; if ((Protocol == NULL) || (Event == NULL) || (Registration == NULL)) { @@ -136,9 +132,7 @@ CoreRegisterProtocolNotify ( // // Allocate a new notification record // - ProtNotify = CoreAllocateBootServicesPool (sizeof(PROTOCOL_NOTIFY)); - if (ProtNotify != NULL) { ProtNotify->Signature = PROTOCOL_NOTIFY_SIGNATURE; @@ -170,8 +164,6 @@ CoreRegisterProtocolNotify ( } - - /** Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface. @@ -274,11 +266,11 @@ CoreReinstallProtocolInterface ( // CoreReleaseProtocolLock (); Status = CoreConnectController ( - UserHandle, - NULL, - NULL, - TRUE - ); + UserHandle, + NULL, + NULL, + TRUE + ); CoreAcquireProtocolLock (); // -- cgit v1.2.3