/** Start the MTFTP driver on this controller. MTFTP driver will install a MTFTP SERVICE BINDING protocol on the supported controller, which can be used to create/destroy MTFTP children. @param This The MTFTP driver binding protocol. @param Controller The controller to manage. @param RemainingDevicePath Remaining device path. @retval EFI_ALREADY_STARTED The MTFTP service binding protocol has been started on the controller. @retval EFI_SUCCESS The MTFTP service binding is installed on the controller. **/ EFI_STATUS EFIAPI Mtftp4DriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) { MTFTP4_SERVICE *MtftpSb; EFI_STATUS Status; // // Directly return if driver is already running. // Status = gBS->OpenProtocol ( Controller, &gEfiMtftp4ServiceBindingProtocolGuid, NULL, This->DriverBindingHandle, Controller, EFI_OPEN_PROTOCOL_TEST_PROTOCOL ); if (Status == EFI_SUCCESS) { return EFI_ALREADY_STARTED; } Status = Mtftp4CreateService (Controller, This->DriverBindingHandle, &MtftpSb); if (EFI_ERROR (Status)) { return Status; } ASSERT (MtftpSb != NULL); Status = gBS->SetTimer (MtftpSb->Timer, TimerPeriodic, TICKS_PER_SECOND); if (EFI_ERROR (Status)) { goto ON_ERROR; } // // Install the Mtftp4ServiceBinding Protocol onto Controller // Status = gBS->InstallMultipleProtocolInterfaces ( &Controller, &gEfiMtftp4ServiceBindingProtocolGuid, &MtftpSb->ServiceBinding, NULL ); if (EFI_ERROR (Status)) { goto ON_ERROR; } return EFI_SUCCESS; ON_ERROR: Mtftp4CleanService (MtftpSb); FreePool (MtftpSb); return Status; }
EFI_STATUS Mtftp4DriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) /*++ Routine Description: Start the MTFTP driver on this controller. MTFTP driver will install a MTFTP SERVICE BINDING protocol on the supported controller, which can be used to create/destroy MTFTP children. Arguments: This - The MTFTP driver binding protocol. Controller - The controller to manage. RemainingDevicePath - Remaining device path. Returns: EFI_ALREADY_STARTED - The MTFTP service binding protocol has been started on the controller. EFI_SUCCESS - The MTFTP service binding is installed on the controller. --*/ { MTFTP4_SERVICE *MtftpSb; EFI_STATUS Status; // // Directly return if driver is already running. // Status = gBS->OpenProtocol ( Controller, &gEfiMtftp4ServiceBindingProtocolGuid, NULL, This->DriverBindingHandle, Controller, EFI_OPEN_PROTOCOL_TEST_PROTOCOL ); if (Status == EFI_SUCCESS) { return EFI_ALREADY_STARTED; } Status = Mtftp4CreateService (Controller, This->DriverBindingHandle, &MtftpSb); if (EFI_ERROR (Status)) { return Status; } Status = gBS->SetTimer (MtftpSb->Timer, TimerPeriodic, TICKS_PER_SECOND); if (EFI_ERROR (Status)) { goto ON_ERROR; } // // Install the Mtftp4ServiceBinding Protocol onto Controller // Status = gBS->InstallMultipleProtocolInterfaces ( &Controller, &gEfiMtftp4ServiceBindingProtocolGuid, &MtftpSb->ServiceBinding, NULL ); if (EFI_ERROR (Status)) { goto ON_ERROR; } return EFI_SUCCESS; ON_ERROR: Mtftp4CleanService (MtftpSb); NetFreePool (MtftpSb); return Status; }