X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FMnpDxe%2FMnpDriver.c;h=b6c0138b517ed54b29131c052f51e193a3ef3876;hp=0ca41516c72dc880eecdd4abaf74677cd4f4ce07;hb=b6c4ecad36684d6d83c36dbf0db6d383eb2fdded;hpb=b58baf6bd467fdc81c16b681e1d253e6fd5ab525 diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c index 0ca41516c7..b6c0138b51 100644 --- a/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c +++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c @@ -31,18 +31,22 @@ EFI_DRIVER_BINDING_PROTOCOL gMnpDriverBinding = { NULL }; - /** - Test to see if this driver supports ControllerHandle. - - @param This Protocol instance pointer. - @param ControllerHandle Handle of device to test. - @param RemainingDevicePath Optional parameter use to pick a specific child - device to start. - - @retval EFI_SUCCES This driver supports this device. - @retval EFI_ALREADY_STARTED This driver is already running on this device. - @retval other This driver does not support this device. + Test to see if this driver supports ControllerHandle. This service + is called by the EFI boot service ConnectController(). In + order to make drivers as small as possible, there are a few calling + restrictions for this service. ConnectController() must + follow these calling restrictions. If any other agent wishes to call + Supported() it must also follow these calling restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to test + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device + @retval EFI_ALREADY_STARTED This driver is already running on this device + @retval other This driver does not support this device **/ EFI_STATUS @@ -102,17 +106,21 @@ MnpDriverBindingSupported ( /** - Start this driver on ControllerHandle. - - @param This Protocol instance pointer. - @param ControllerHandle Handle of device to bind driver to. - @param RemainingDevicePath Optional parameter use to pick a specific child - device to start. - - @retval EFI_SUCCES This driver is added to ControllerHandle. - @retval EFI_ALREADY_STARTED This driver is already running on - ControllerHandle. - @retval other This driver does not support this device. + Start this driver on ControllerHandle. This service is called by the + EFI boot service ConnectController(). In order to make + drivers as small as possible, there are a few calling restrictions for + this service. ConnectController() must follow these + calling restrictions. If any other agent wishes to call Start() it + must also follow these calling restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to bind driver to. + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver is added to ControllerHandle + @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle + @retval other This driver does not support this device **/ EFI_STATUS @@ -166,37 +174,31 @@ ErrorExit: // // Flush the Mnp Service Data. // - MnpFlushServiceData (MnpServiceData); + MnpFlushServiceData (MnpServiceData, This->DriverBindingHandle); } - // - // Close the Simple Network Protocol. - // - gBS->CloseProtocol ( - ControllerHandle, - &gEfiSimpleNetworkProtocolGuid, - This->DriverBindingHandle, - ControllerHandle - ); - gBS->FreePool (MnpServiceData); } return Status; } - /** - Stop this driver on ControllerHandle. - - @param This Protocol instance pointer. - @param ControllerHandle Handle of device to stop driver on. - @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number - of children is zero stop the entire bus driver. - @param ChildHandleBuffer List of Child Handles to Stop. - - @retval EFI_SUCCES This driver is removed ControllerHandle. - @retval other This driver was not removed from this device. + Stop this driver on ControllerHandle. This service is called by the + EFI boot service DisconnectController(). In order to + make drivers as small as possible, there are a few calling + restrictions for this service. DisconnectController() + must follow these calling restrictions. If any other agent wishes + to call Stop() it must also follow these calling restrictions. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle + @retval other This driver was not removed from this device **/ EFI_STATUS @@ -247,20 +249,10 @@ MnpDriverBindingStop ( NULL ); - // - // Close the openned Snp protocol. - // - gBS->CloseProtocol ( - ControllerHandle, - &gEfiSimpleNetworkProtocolGuid, - This->DriverBindingHandle, - ControllerHandle - ); - // // Flush the Mnp service data. // - MnpFlushServiceData (MnpServiceData); + MnpFlushServiceData (MnpServiceData, This->DriverBindingHandle); gBS->FreePool (MnpServiceData); } else { @@ -525,31 +517,24 @@ MnpServiceBindingDestroyChild ( return Status; } +/** + The entry point for Mnp driver which installs the driver binding and component + name protocol on its ImageHandle. + + @param ImageHandle The image handle of the driver. + @param SystemTable The system table. + @retval EFI_SUCCES the driver binding and component name protocols are + successfully installed. + @retval other failed. + +**/ EFI_STATUS EFIAPI MnpDriverEntryPoint ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) -/*++ - -Routine Description: - - The entry point for Mnp driver which installs the driver binding and component name - protocol on its ImageHandle. - -Arguments: - - ImageHandle - The image handle of the driver. - SystemTable - The system table. - -Returns: - - EFI_SUCCESS - If the driver binding and component name protocols are successfully - installed, otherwise if failed. - ---*/ { return EfiLibInstallDriverBindingComponentName2 ( ImageHandle,