]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppy.c
Remove IntelFrameworkModulePkg
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / IsaFloppyDxe / IsaFloppy.c
diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppy.c b/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppy.c
deleted file mode 100644 (file)
index 6d7edd6..0000000
+++ /dev/null
@@ -1,509 +0,0 @@
-/** @file\r
-  ISA Floppy Disk UEFI Driver conforming to the UEFI driver model\r
-\r
-  1. Support two types diskette drive\r
-     1.44M drive and 2.88M drive (and now only support 1.44M)\r
-  2. Support two diskette drives per floppy disk controller\r
-  3. Use DMA channel 2 to transfer data\r
-  4. Do not use interrupt\r
-  5. Support diskette change line signal and write protect\r
-\r
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include "IsaFloppy.h"\r
-\r
-LIST_ENTRY  mControllerHead = INITIALIZE_LIST_HEAD_VARIABLE (mControllerHead);\r
-\r
-//\r
-// ISA Floppy Driver Binding Protocol\r
-//\r
-EFI_DRIVER_BINDING_PROTOCOL gFdcControllerDriver = {\r
-  FdcControllerDriverSupported,\r
-  FdcControllerDriverStart,\r
-  FdcControllerDriverStop,\r
-  0xa,\r
-  NULL,\r
-  NULL\r
-};\r
-\r
-\r
-/**\r
-  The main Entry Point for this driver.\r
-\r
-  @param[in] ImageHandle  The firmware allocated handle for the EFI image.\r
-  @param[in] SystemTable  A pointer to the EFI System Table.\r
-\r
-  @retval EFI_SUCCESS     The entry point is executed successfully.\r
-  @retval other           Some error occurs when executing this entry point.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeIsaFloppy(\r
-  IN EFI_HANDLE           ImageHandle,\r
-  IN EFI_SYSTEM_TABLE     *SystemTable\r
-  )\r
-{\r
-  EFI_STATUS  Status;\r
-\r
-  //\r
-  // Install driver model protocol(s).\r
-  //\r
-  Status = EfiLibInstallDriverBindingComponentName2 (\r
-             ImageHandle,\r
-             SystemTable,\r
-             &gFdcControllerDriver,\r
-             ImageHandle,\r
-             &gIsaFloppyComponentName,\r
-             &gIsaFloppyComponentName2\r
-             );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  return Status;\r
-}\r
-\r
-/**\r
-  Test if the controller is a floppy disk drive device\r
-\r
-  @param[in] This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
-  @param[in] Controller           The handle of the controller to test.\r
-  @param[in] RemainingDevicePath  A pointer to the remaining portion of a device path.\r
-\r
-  @retval EFI_SUCCESS             The device is supported by this driver.\r
-  @retval EFI_ALREADY_STARTED     The device is already being managed by this driver.\r
-  @retval EFI_ACCESS_DENIED       The device is already being managed by a different driver\r
-                                  or an application that requires exclusive access.\r
-  @retval EFI_UNSUPPORTED         The device is is not supported by this driver.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FdcControllerDriverSupported (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
-  IN EFI_HANDLE                   Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
-  )\r
-{\r
-  EFI_STATUS                Status;\r
-  EFI_ISA_IO_PROTOCOL       *IsaIo;\r
-  EFI_DEVICE_PATH_PROTOCOL  *ParentDevicePath;\r
-\r
-  //\r
-  // Ignore the parameter RemainingDevicePath because this is a device driver.\r
-  //\r
-\r
-  //\r
-  // Open the device path protocol\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  (VOID **) &ParentDevicePath,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  gBS->CloseProtocol (\r
-         Controller,\r
-         &gEfiDevicePathProtocolGuid,\r
-         This->DriverBindingHandle,\r
-         Controller\r
-         );\r
-\r
-  //\r
-  // Open the ISA I/O Protocol\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiIsaIoProtocolGuid,\r
-                  (VOID **) &IsaIo,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-  //\r
-  // Use the ISA I/O Protocol to see if Controller is a floppy disk drive device\r
-  //\r
-  Status = EFI_SUCCESS;\r
-  if (IsaIo->ResourceList->Device.HID != EISA_PNP_ID (0x604)) {\r
-    Status = EFI_UNSUPPORTED;\r
-  }\r
-  //\r
-  // Close the ISA I/O Protocol\r
-  //\r
-  gBS->CloseProtocol (\r
-         Controller,\r
-         &gEfiIsaIoProtocolGuid,\r
-         This->DriverBindingHandle,\r
-         Controller\r
-         );\r
-\r
-  return Status;\r
-}\r
-\r
-/**\r
-  Start this driver on Controller.\r
-\r
-  @param[in] This                  A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
-  @param[in] ControllerHandle      The handle of the controller to start. This handle\r
-                                   must support a protocol interface that supplies\r
-                                   an I/O abstraction to the driver.\r
-  @param[in] RemainingDevicePath   A pointer to the remaining portion of a device path.\r
-                                   This parameter is ignored by device drivers, and is optional for bus drivers.\r
-\r
-  @retval EFI_SUCCESS              The device was started.\r
-  @retval EFI_DEVICE_ERROR         The device could not be started due to a device error.\r
-                                   Currently not implemented.\r
-  @retval EFI_OUT_OF_RESOURCES     The request could not be completed due to a lack of resources.\r
-  @retval Others                   The driver failded to start the device.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FdcControllerDriverStart (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
-  IN EFI_HANDLE                   Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
-  )\r
-{\r
-  EFI_STATUS                Status;\r
-  FDC_BLK_IO_DEV            *FdcDev;\r
-  EFI_ISA_IO_PROTOCOL       *IsaIo;\r
-  UINTN                     Index;\r
-  LIST_ENTRY                *List;\r
-  BOOLEAN                   Found;\r
-  EFI_DEVICE_PATH_PROTOCOL  *ParentDevicePath;\r
-\r
-  FdcDev  = NULL;\r
-  IsaIo   = NULL;\r
-\r
-  //\r
-  // Open the device path protocol\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  (VOID **) &ParentDevicePath,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-  //\r
-  // Report enable progress code\r
-  //\r
-  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
-    EFI_PROGRESS_CODE,\r
-    EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_ENABLE,\r
-    ParentDevicePath\r
-    );\r
-\r
-  //\r
-  // Open the ISA I/O Protocol\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiIsaIoProtocolGuid,\r
-                  (VOID **) &IsaIo,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    goto Done;\r
-  }\r
-  //\r
-  // Allocate the floppy device's Device structure\r
-  //\r
-  FdcDev = AllocateZeroPool (sizeof (FDC_BLK_IO_DEV));\r
-  if (FdcDev == NULL) {\r
-    goto Done;\r
-  }\r
-  //\r
-  // Initialize the floppy device's device structure\r
-  //\r
-  FdcDev->Signature       = FDC_BLK_IO_DEV_SIGNATURE;\r
-  FdcDev->Handle          = Controller;\r
-  FdcDev->IsaIo           = IsaIo;\r
-  FdcDev->Disk            = (EFI_FDC_DISK) IsaIo->ResourceList->Device.UID;\r
-  FdcDev->Cache           = NULL;\r
-  FdcDev->Event           = NULL;\r
-  FdcDev->ControllerState = NULL;\r
-  FdcDev->DevicePath      = ParentDevicePath;\r
-\r
-  FdcDev->ControllerNameTable = NULL;\r
-  AddName (FdcDev);\r
-\r
-  //\r
-  // Look up the base address of the Floppy Disk Controller which controls this floppy device\r
-  //\r
-  for (Index = 0; FdcDev->IsaIo->ResourceList->ResourceItem[Index].Type != EfiIsaAcpiResourceEndOfList; Index++) {\r
-    if (FdcDev->IsaIo->ResourceList->ResourceItem[Index].Type == EfiIsaAcpiResourceIo) {\r
-      FdcDev->BaseAddress = (UINT16) FdcDev->IsaIo->ResourceList->ResourceItem[Index].StartRange;\r
-    }\r
-  }\r
-  //\r
-  // Maintain the list of floppy disk controllers\r
-  //\r
-  Found = FALSE;\r
-  List  = mControllerHead.ForwardLink;\r
-  while (List != &mControllerHead) {\r
-    FdcDev->ControllerState = FLOPPY_CONTROLLER_FROM_LIST_ENTRY (List);\r
-    if (FdcDev->BaseAddress == FdcDev->ControllerState->BaseAddress) {\r
-      Found = TRUE;\r
-      break;\r
-    }\r
-\r
-    List = List->ForwardLink;\r
-  }\r
-\r
-  if (!Found) {\r
-    //\r
-    // A new floppy disk controller controlling this floppy disk drive is found\r
-    //\r
-    FdcDev->ControllerState = AllocatePool (sizeof (FLOPPY_CONTROLLER_CONTEXT));\r
-    if (FdcDev->ControllerState == NULL) {\r
-      goto Done;\r
-    }\r
-\r
-    FdcDev->ControllerState->Signature          = FLOPPY_CONTROLLER_CONTEXT_SIGNATURE;\r
-    FdcDev->ControllerState->FddResetPerformed  = FALSE;\r
-    FdcDev->ControllerState->NeedRecalibrate    = FALSE;\r
-    FdcDev->ControllerState->BaseAddress        = FdcDev->BaseAddress;\r
-    FdcDev->ControllerState->NumberOfDrive      = 0;\r
-\r
-    InsertTailList (&mControllerHead, &FdcDev->ControllerState->Link);\r
-  }\r
-  //\r
-  // Create a timer event for each floppy disk drive device.\r
-  // This timer event is used to control the motor on and off\r
-  //\r
-  Status = gBS->CreateEvent (\r
-                  EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
-                  TPL_NOTIFY,\r
-                  FddTimerProc,\r
-                  FdcDev,\r
-                  &FdcDev->Event\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    goto Done;\r
-  }\r
-  //\r
-  // Reset the Floppy Disk Controller\r
-  //\r
-  if (!FdcDev->ControllerState->FddResetPerformed) {\r
-    FdcDev->ControllerState->FddResetPerformed  = TRUE;\r
-    FdcDev->ControllerState->FddResetStatus     = FddReset (FdcDev);\r
-  }\r
-\r
-  if (EFI_ERROR (FdcDev->ControllerState->FddResetStatus)) {\r
-    Status = EFI_DEVICE_ERROR;\r
-    goto Done;\r
-  }\r
-\r
-  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
-    EFI_PROGRESS_CODE,\r
-    EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_PRESENCE_DETECT,\r
-    ParentDevicePath\r
-    );\r
-\r
-  //\r
-  // Discover the Floppy Drive\r
-  //\r
-  Status = DiscoverFddDevice (FdcDev);\r
-  if (EFI_ERROR (Status)) {\r
-    Status = EFI_DEVICE_ERROR;\r
-    goto Done;\r
-  }\r
-  //\r
-  // Install protocol interfaces for the serial device.\r
-  //\r
-  Status = gBS->InstallMultipleProtocolInterfaces (\r
-                  &Controller,\r
-                  &gEfiBlockIoProtocolGuid,\r
-                  &FdcDev->BlkIo,\r
-                  NULL\r
-                  );\r
-  if (!EFI_ERROR (Status)) {\r
-    FdcDev->ControllerState->NumberOfDrive++;\r
-  }\r
-\r
-Done:\r
-  if (EFI_ERROR (Status)) {\r
-\r
-    REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
-      EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
-      EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_CONTROLLER_ERROR,\r
-      ParentDevicePath\r
-      );\r
-\r
-    //\r
-    // If a floppy drive device structure was allocated, then free it\r
-    //\r
-    if (FdcDev != NULL) {\r
-      if (FdcDev->Event != NULL) {\r
-        //\r
-        // Close the event for turning the motor off\r
-        //\r
-        gBS->CloseEvent (FdcDev->Event);\r
-      }\r
-\r
-      FreeUnicodeStringTable (FdcDev->ControllerNameTable);\r
-      FreePool (FdcDev);\r
-    }\r
-\r
-    //\r
-    // Close the ISA I/O Protocol\r
-    //\r
-    if (IsaIo != NULL) {\r
-      gBS->CloseProtocol (\r
-             Controller,\r
-             &gEfiIsaIoProtocolGuid,\r
-             This->DriverBindingHandle,\r
-             Controller\r
-             );\r
-    }\r
-\r
-    //\r
-    // Close the device path protocol\r
-    //\r
-    gBS->CloseProtocol (\r
-           Controller,\r
-           &gEfiDevicePathProtocolGuid,\r
-           This->DriverBindingHandle,\r
-           Controller\r
-           );\r
-  }\r
-\r
-  return Status;\r
-}\r
-\r
-/**\r
-  Stop this driver on ControllerHandle.\r
-\r
-  @param[in] This               A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
-  @param[in] ControllerHandle   A handle to the device being stopped. The handle must\r
-                                support a bus specific I/O protocol for the driver\r
-                                to use to stop the device.\r
-  @param[in] NumberOfChildren   The number of child device handles in ChildHandleBuffer.\r
-  @param[in] ChildHandleBuffer  An array of child handles to be freed. May be NULL\r
-                                if NumberOfChildren is 0.\r
-\r
-  @retval EFI_SUCCESS           The device was stopped.\r
-  @retval EFI_DEVICE_ERROR      The device could not be stopped due to a device error.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FdcControllerDriverStop (\r
-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,\r
-  IN  EFI_HANDLE                   Controller,\r
-  IN  UINTN                        NumberOfChildren,\r
-  IN  EFI_HANDLE                   *ChildHandleBuffer\r
-  )\r
-{\r
-  EFI_STATUS            Status;\r
-  EFI_BLOCK_IO_PROTOCOL *BlkIo;\r
-  FDC_BLK_IO_DEV        *FdcDev;\r
-\r
-  //\r
-  // Ignore NumberOfChildren since this is a device driver\r
-  //\r
-\r
-  //\r
-  // Get the Block I/O Protocol on Controller\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiBlockIoProtocolGuid,\r
-                  (VOID **) &BlkIo,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-  //\r
-  // Get the floppy drive device's Device structure\r
-  //\r
-  FdcDev = FDD_BLK_IO_FROM_THIS (BlkIo);\r
-\r
-  //\r
-  // Report disable progress code\r
-  //\r
-  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
-    EFI_PROGRESS_CODE,\r
-    EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_DISABLE,\r
-    FdcDev->DevicePath\r
-    );\r
-\r
-  //\r
-  // Uninstall the Block I/O Protocol\r
-  //\r
-  Status = gBS->UninstallProtocolInterface (\r
-                  Controller,\r
-                  &gEfiBlockIoProtocolGuid,\r
-                  &FdcDev->BlkIo\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Close the event for turning the motor off\r
-  //\r
-  gBS->CloseEvent (FdcDev->Event);\r
-\r
-  //\r
-  // Turn the motor off on the floppy drive device\r
-  //\r
-  FddTimerProc (FdcDev->Event, FdcDev);\r
-\r
-  //\r
-  // Close the device path protocol\r
-  //\r
-  gBS->CloseProtocol (\r
-         Controller,\r
-         &gEfiDevicePathProtocolGuid,\r
-         This->DriverBindingHandle,\r
-         Controller\r
-         );\r
-\r
-  //\r
-  // Close the ISA I/O Protocol\r
-  //\r
-  gBS->CloseProtocol (\r
-         Controller,\r
-         &gEfiIsaIoProtocolGuid,\r
-         This->DriverBindingHandle,\r
-         Controller\r
-         );\r
-\r
-  //\r
-  // Free the controller list if needed\r
-  //\r
-  FdcDev->ControllerState->NumberOfDrive--;\r
-\r
-  //\r
-  // Free the cache if one was allocated\r
-  //\r
-  FdcFreeCache (FdcDev);\r
-\r
-  //\r
-  // Free the floppy drive device's device structure\r
-  //\r
-  FreeUnicodeStringTable (FdcDev->ControllerNameTable);\r
-  FreePool (FdcDev);\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r