/** Stop this driver on ControllerHandle. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. @param[in] ControllerHandle A handle to the device being stopped. The handle must support a bus specific I/O protocol for the driver to use to stop the device. @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer. @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL if NumberOfChildren is 0. @retval EFI_SUCCESS The device was stopped. @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error. **/ EFI_STATUS EFIAPI FdcControllerDriverStop ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer ) { EFI_STATUS Status; EFI_BLOCK_IO_PROTOCOL *BlkIo; FDC_BLK_IO_DEV *FdcDev; // // Ignore NumberOfChildren since this is a device driver // // // Get the Block I/O Protocol on Controller // Status = gBS->OpenProtocol ( Controller, &gEfiBlockIoProtocolGuid, (VOID **) &BlkIo, This->DriverBindingHandle, Controller, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (EFI_ERROR (Status)) { return Status; } // // Get the floppy drive device's Device structure // FdcDev = FDD_BLK_IO_FROM_THIS (BlkIo); // // Report disable progress code // REPORT_STATUS_CODE_WITH_DEVICE_PATH ( EFI_PROGRESS_CODE, EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_DISABLE, FdcDev->DevicePath ); // // Uninstall the Block I/O Protocol // Status = gBS->UninstallProtocolInterface ( Controller, &gEfiBlockIoProtocolGuid, &FdcDev->BlkIo ); if (EFI_ERROR (Status)) { return Status; } // // Close the event for turning the motor off // gBS->CloseEvent (FdcDev->Event); // // Turn the motor off on the floppy drive device // FddTimerProc (FdcDev->Event, FdcDev); // // Close the device path protocol // gBS->CloseProtocol ( Controller, &gEfiDevicePathProtocolGuid, This->DriverBindingHandle, Controller ); // // Close the ISA I/O Protocol // gBS->CloseProtocol ( Controller, &gEfiIsaIoProtocolGuid, This->DriverBindingHandle, Controller ); // // Free the controller list if needed // FdcDev->ControllerState->NumberOfDrive--; // // Free the cache if one was allocated // FdcFreeCache (FdcDev); // // Free the floppy drive device's device structure // FreeUnicodeStringTable (FdcDev->ControllerNameTable); FreePool (FdcDev); return EFI_SUCCESS; }
EFI_STATUS EFIAPI FdcControllerDriverStop ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer ) /*++ Routine Description: Arguments: Returns: --*/ // GC_TODO: This - add argument and description to function comment // GC_TODO: Controller - add argument and description to function comment // GC_TODO: NumberOfChildren - add argument and description to function comment // GC_TODO: ChildHandleBuffer - add argument and description to function comment // GC_TODO: EFI_SUCCESS - add return value to function comment { EFI_STATUS Status; EFI_BLOCK_IO_PROTOCOL *BlkIo; FDC_BLK_IO_DEV *FdcDev; // // Get the Block I/O Protocol on Controller // Status = gBS->OpenProtocol ( Controller, &gEfiBlockIoProtocolGuid, (VOID **) &BlkIo, This->DriverBindingHandle, Controller, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (EFI_ERROR (Status)) { return Status; } // // Get the Floppy Disk Controller's Device structure // FdcDev = FDD_BLK_IO_FROM_THIS (BlkIo); // // Report disable progress code // ReportStatusCodeWithDevicePath ( EFI_PROGRESS_CODE, EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_DISABLE, 0, &gEfiCallerIdGuid, FdcDev->DevicePath ); // // Turn the motor off on the Floppy Disk Controller // FddTimerProc (FdcDev->Event, FdcDev); // // Uninstall the Block I/O Protocol // Status = gBS->UninstallProtocolInterface ( Controller, &gEfiBlockIoProtocolGuid, &FdcDev->BlkIo ); if (EFI_ERROR (Status)) { return Status; } // // Close the device path protocol // gBS->CloseProtocol ( Controller, &gEfiDevicePathProtocolGuid, This->DriverBindingHandle, Controller ); // // Close the ISA I/O Protocol // gBS->CloseProtocol ( Controller, EFI_ISA_IO_PROTOCOL_VERSION, This->DriverBindingHandle, Controller ); // // Free the controller list if needed // FdcDev->ControllerState->NumberOfDrive--; // // Close the event for turning the motor off // gBS->CloseEvent (FdcDev->Event); // // Free the cache if one was allocated // FdcFreeCache (FdcDev); // // Free the Floppy Disk Controller's Device structure // EfiLibFreeUnicodeStringTable (FdcDev->ControllerNameTable); gBS->FreePool (FdcDev); return EFI_SUCCESS; }