]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBus.c
Remove IntelFrameworkModulePkg
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / IsaBusDxe / IsaBus.c
diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBus.c b/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBus.c
deleted file mode 100644 (file)
index 93097a8..0000000
+++ /dev/null
@@ -1,667 +0,0 @@
-/** @file\r
-  ISA Bus UEFI driver.\r
-\r
-  Discovers all the ISA Controllers and their resources by using the ISA ACPI\r
-  Protocol, produces an instance of the ISA I/O Protocol for every ISA\r
-  Controller found. This driver is designed to manage a PCI-to-ISA bridge Device\r
-  such as LPC bridge.\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 "InternalIsaBus.h"\r
-\r
-//\r
-// ISA Bus Driver Global Variables\r
-//\r
-EFI_DRIVER_BINDING_PROTOCOL gIsaBusControllerDriver = {\r
-  IsaBusControllerDriverSupported,\r
-  IsaBusControllerDriverStart,\r
-  IsaBusControllerDriverStop,\r
-  0xa,\r
-  NULL,\r
-  NULL\r
-};\r
-\r
-/**\r
-  The main entry point for the ISA Bus 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 EFI_OUT_OF_RESOURCES  There was not enough memory in pool to install all the protocols.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeIsaBus(\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
-             &gIsaBusControllerDriver,\r
-             ImageHandle,\r
-             &gIsaBusComponentName,\r
-             &gIsaBusComponentName2\r
-             );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  return Status;\r
-}\r
-\r
-/**\r
-  Tests to see if a controller can be managed by the ISA Bus Driver. If a child device is provided,\r
-  it further tests to see if this driver supports creating a handle for the specified child device.\r
-\r
-  Note that the ISA Bus driver always creates all of its child handles on the first call to Start().\r
-  How the Start() function of a driver is implemented can affect how the Supported() function is implemented.\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
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IsaBusControllerDriverSupported (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
-  IN EFI_HANDLE                   Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
-  )\r
-{\r
-  EFI_STATUS                Status;\r
-  EFI_DEVICE_PATH_PROTOCOL  *ParentDevicePath;\r
-  EFI_ISA_ACPI_PROTOCOL     *IsaAcpi;\r
-\r
-  //\r
-  // If RemainingDevicePath is not NULL, it should verify that the first device\r
-  // path node in RemainingDevicePath is an ACPI Device path node which is a\r
-  // legal Device Path Node for this bus driver's children.\r
-  //\r
-  if (RemainingDevicePath != NULL) {\r
-    if (RemainingDevicePath->Type != ACPI_DEVICE_PATH) {\r
-      return EFI_UNSUPPORTED;\r
-    } else if (RemainingDevicePath->SubType == ACPI_DP) {\r
-      if (DevicePathNodeLength (RemainingDevicePath) != sizeof (ACPI_HID_DEVICE_PATH)) {\r
-        return EFI_UNSUPPORTED;\r
-      }\r
-    } else if (RemainingDevicePath->SubType == ACPI_EXTENDED_DP) {\r
-      if (DevicePathNodeLength (RemainingDevicePath) != sizeof (ACPI_EXTENDED_HID_DEVICE_PATH)) {\r
-        return EFI_UNSUPPORTED;\r
-      }\r
-    } else {\r
-      return EFI_UNSUPPORTED;\r
-    }\r
-  }\r
-  //\r
-  // Try to open EFI DEVICE PATH protocol on the controller\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
-  //\r
-  // Although this driver creates all child handles at one time,\r
-  // but because all child handles may be not stopped at one time in EFI Driver Binding.Stop(),\r
-  // So it is allowed to create child handles again in successive calls to EFI Driver Binding.Start().\r
-  //\r
-  if (Status == EFI_ALREADY_STARTED) {\r
-    return EFI_SUCCESS;\r
-  }\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
-  // Try to get Pci IO Protocol because it is assumed\r
-  // to have been opened by ISA ACPI driver\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiPciIoProtocolGuid,\r
-                  NULL,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Try to open the Isa Acpi protocol on the controller\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiIsaAcpiProtocolGuid,\r
-                  (VOID **) &IsaAcpi,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Add more check to see if the child device is valid by calling IsaAcpi->DeviceEnumerate?\r
-  //\r
-\r
-  gBS->CloseProtocol (\r
-         Controller,\r
-         &gEfiIsaAcpiProtocolGuid,\r
-         This->DriverBindingHandle,\r
-         Controller\r
-         );\r
-\r
-  return Status;\r
-}\r
-\r
-/**\r
-  Start this driver on ControllerHandle.\r
-\r
-  Note that the ISA Bus driver always creates all of its child handles on the first call to Start().\r
-  The Start() function is designed to be invoked from the EFI boot service ConnectController().\r
-  As a result, much of the error checking on the parameters to Start() has been moved into this\r
-  common boot service. It is legal to call Start() from other locations, but the following calling\r
-  restrictions must be followed or the system behavior will not be deterministic.\r
-  1. ControllerHandle must be a valid EFI_HANDLE.\r
-  2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r
-     EFI_DEVICE_PATH_PROTOCOL.\r
-  3. Prior to calling Start(), the Supported() function for the driver specified by This must\r
-     have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.\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
-IsaBusControllerDriverStart (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
-  IN EFI_HANDLE                   Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
-  )\r
-{\r
-  EFI_STATUS                            Status;\r
-  EFI_PCI_IO_PROTOCOL                   *PciIo;\r
-  EFI_DEVICE_PATH_PROTOCOL              *ParentDevicePath;\r
-  EFI_ISA_ACPI_PROTOCOL                 *IsaAcpi;\r
-  EFI_ISA_ACPI_DEVICE_ID                *IsaDevice;\r
-  EFI_ISA_ACPI_RESOURCE_LIST            *ResourceList;\r
-  EFI_GENERIC_MEMORY_TEST_PROTOCOL      *GenMemoryTest;\r
-\r
-  //\r
-  // Local variables declaration for StatusCode reporting\r
-  //\r
-  EFI_DEVICE_PATH_PROTOCOL              *DevicePathData;\r
-\r
-  DevicePathData = NULL;\r
-\r
-  //\r
-  // Get Pci IO Protocol\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiPciIoProtocolGuid,\r
-                  (VOID **) &PciIo,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Open 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) && Status != EFI_ALREADY_STARTED) {\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Open ISA Acpi Protocol\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiIsaAcpiProtocolGuid,\r
-                  (VOID **) &IsaAcpi,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
-                  );\r
-  if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {\r
-    //\r
-    // Close opened protocol\r
-    //\r
-    gBS->CloseProtocol (\r
-           Controller,\r
-           &gEfiDevicePathProtocolGuid,\r
-           This->DriverBindingHandle,\r
-           Controller\r
-           );\r
-    return Status;\r
-  }\r
-  //\r
-  // The IsaBus driver will use memory below 16M, which is not tested yet,\r
-  // so call CompatibleRangeTest to test them. Since memory below 1M should\r
-  // be reserved to CSM, and 15M~16M might be reserved for Isa hole, test 1M\r
-  // ~15M here\r
-  //\r
-  Status = gBS->LocateProtocol (\r
-                  &gEfiGenericMemTestProtocolGuid,\r
-                  NULL,\r
-                  (VOID **) &GenMemoryTest\r
-                  );\r
-\r
-  if (!EFI_ERROR (Status)) {\r
-    Status = GenMemoryTest->CompatibleRangeTest (\r
-                              GenMemoryTest,\r
-                              0x100000,\r
-                              0xE00000\r
-                              );\r
-  }\r
-  //\r
-  // Report Status Code here since we will initialize the host controller\r
-  //\r
-  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
-    EFI_PROGRESS_CODE,\r
-    (EFI_IO_BUS_LPC | EFI_IOB_PC_INIT),\r
-    ParentDevicePath\r
-    );\r
-\r
-  //\r
-  // first init ISA interface\r
-  //\r
-  IsaAcpi->InterfaceInit (IsaAcpi);\r
-\r
-  //\r
-  // Report Status Code here since we will enable the host controller\r
-  //\r
-  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
-    EFI_PROGRESS_CODE,\r
-    (EFI_IO_BUS_LPC | EFI_IOB_PC_ENABLE),\r
-    ParentDevicePath\r
-    );\r
-\r
-  //\r
-  // Create each ISA device handle in this ISA bus\r
-  //\r
-  IsaDevice = NULL;\r
-  do {\r
-    Status = IsaAcpi->DeviceEnumerate (IsaAcpi, &IsaDevice);\r
-    if (EFI_ERROR (Status)) {\r
-      break;\r
-    }\r
-    //\r
-    // Get current resource of this ISA device\r
-    //\r
-    ResourceList  = NULL;\r
-    Status        = IsaAcpi->GetCurResource (IsaAcpi, IsaDevice, &ResourceList);\r
-    if (EFI_ERROR (Status)) {\r
-      continue;\r
-    }\r
-\r
-    //\r
-    // Create handle for this ISA device\r
-    //\r
-    // If any child device handle was created in previous call to Start() and not stopped\r
-    // in previous call to Stop(), it will not be created again because the\r
-    // InstallMultipleProtocolInterfaces() boot service will reject same device path.\r
-    //\r
-    Status = IsaCreateDevice (\r
-               This,\r
-               Controller,\r
-               PciIo,\r
-               ParentDevicePath,\r
-               ResourceList,\r
-               &DevicePathData\r
-               );\r
-\r
-    if (EFI_ERROR (Status)) {\r
-      continue;\r
-    }\r
-    //\r
-    // Initialize ISA device\r
-    //\r
-    IsaAcpi->InitDevice (IsaAcpi, IsaDevice);\r
-\r
-    //\r
-    // Set resources for this ISA device\r
-    //\r
-    Status = IsaAcpi->SetResource (IsaAcpi, IsaDevice, ResourceList);\r
-\r
-    //\r
-    // Report Status Code here when failed to resource conflicts\r
-    //\r
-    if (EFI_ERROR (Status) && (Status != EFI_UNSUPPORTED)) {\r
-      //\r
-      // It's hard to tell which resource conflicts\r
-      //\r
-      REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
-         EFI_ERROR_CODE,\r
-         (EFI_IO_BUS_LPC | EFI_IOB_EC_RESOURCE_CONFLICT),\r
-         DevicePathData\r
-         );\r
-\r
-    }\r
-    //\r
-    // Set power for this ISA device\r
-    //\r
-    IsaAcpi->SetPower (IsaAcpi, IsaDevice, TRUE);\r
-\r
-    //\r
-    // Enable this ISA device\r
-    //\r
-    IsaAcpi->EnableDevice (IsaAcpi, IsaDevice, TRUE);\r
-\r
-  } while (TRUE);\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  Stop this driver on ControllerHandle.\r
-\r
-  The Stop() function is designed to be invoked from the EFI boot service DisconnectController().\r
-  As a result, much of the error checking on the parameters to Stop() has been moved\r
-  into this common boot service. It is legal to call Stop() from other locations,\r
-  but the following calling restrictions must be followed or the system behavior will not be deterministic.\r
-  1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r
-     same driver's Start() function.\r
-  2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r
-     EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
-     Start() function, and the Start() function must have called OpenProtocol() on\r
-     ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\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
-IsaBusControllerDriverStop (\r
-  IN  EFI_DRIVER_BINDING_PROTOCOL  * This,\r
-  IN  EFI_HANDLE                   Controller,\r
-  IN  UINTN                        NumberOfChildren,\r
-  IN  EFI_HANDLE                   * ChildHandleBuffer OPTIONAL\r
-  )\r
-{\r
-  EFI_STATUS                          Status;\r
-  UINTN                               Index;\r
-  BOOLEAN                             AllChildrenStopped;\r
-  ISA_IO_DEVICE                       *IsaIoDevice;\r
-  EFI_ISA_IO_PROTOCOL                 *IsaIo;\r
-  EFI_PCI_IO_PROTOCOL                 *PciIo;\r
-\r
-  if (NumberOfChildren == 0) {\r
-    //\r
-    // Close the bus driver\r
-    //\r
-    Status = gBS->CloseProtocol (\r
-                    Controller,\r
-                    &gEfiDevicePathProtocolGuid,\r
-                    This->DriverBindingHandle,\r
-                    Controller\r
-                    );\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
-\r
-    Status = gBS->CloseProtocol (\r
-                    Controller,\r
-                    &gEfiIsaAcpiProtocolGuid,\r
-                    This->DriverBindingHandle,\r
-                    Controller\r
-                    );\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
-\r
-    return EFI_SUCCESS;\r
-  }\r
-  //\r
-  // Complete all outstanding transactions to Controller.\r
-  // Don't allow any new transaction to Controller to be started.\r
-  //\r
-  //\r
-  // Stop all the children\r
-  // Find all the ISA devices that were discovered on this PCI to ISA Bridge\r
-  // with the Start() function.\r
-  //\r
-  AllChildrenStopped = TRUE;\r
-\r
-  for (Index = 0; Index < NumberOfChildren; Index++) {\r
-\r
-    Status = gBS->OpenProtocol (\r
-                    ChildHandleBuffer[Index],\r
-                    &gEfiIsaIoProtocolGuid,\r
-                    (VOID **) &IsaIo,\r
-                    This->DriverBindingHandle,\r
-                    Controller,\r
-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                    );\r
-    if (!EFI_ERROR (Status)) {\r
-\r
-      IsaIoDevice = ISA_IO_DEVICE_FROM_ISA_IO_THIS (IsaIo);\r
-\r
-      //\r
-      // Close the child handle\r
-      //\r
-\r
-      Status = gBS->CloseProtocol (\r
-                      Controller,\r
-                      &gEfiPciIoProtocolGuid,\r
-                      This->DriverBindingHandle,\r
-                      ChildHandleBuffer[Index]\r
-                      );\r
-      Status = gBS->UninstallMultipleProtocolInterfaces (\r
-                      ChildHandleBuffer[Index],\r
-                      &gEfiDevicePathProtocolGuid,\r
-                      IsaIoDevice->DevicePath,\r
-                      &gEfiIsaIoProtocolGuid,\r
-                      &IsaIoDevice->IsaIo,\r
-                      NULL\r
-                      );\r
-\r
-      if (!EFI_ERROR (Status)) {\r
-        FreePool (IsaIoDevice->DevicePath);\r
-        FreePool (IsaIoDevice);\r
-      } else {\r
-        //\r
-        // Re-open PCI IO Protocol on behalf of the child device\r
-        // because of failure of destroying the child device handle\r
-        //\r
-        gBS->OpenProtocol (\r
-               Controller,\r
-               &gEfiPciIoProtocolGuid,\r
-               (VOID **) &PciIo,\r
-               This->DriverBindingHandle,\r
-               ChildHandleBuffer[Index],\r
-               EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
-               );\r
-      }\r
-    }\r
-\r
-    if (EFI_ERROR (Status)) {\r
-      AllChildrenStopped = FALSE;\r
-    }\r
-  }\r
-\r
-  if (!AllChildrenStopped) {\r
-    return EFI_DEVICE_ERROR;\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-//\r
-// Internal Function\r
-//\r
-\r
-/**\r
-  Create EFI Handle for a ISA device found via ISA ACPI Protocol\r
-\r
-  @param[in] This                   The EFI_DRIVER_BINDING_PROTOCOL instance.\r
-  @param[in] Controller             The handle of ISA bus controller(PCI to ISA bridge)\r
-  @param[in] PciIo                  The Pointer to the PCI protocol\r
-  @param[in] ParentDevicePath       Device path of the ISA bus controller\r
-  @param[in] IsaDeviceResourceList  The resource list of the ISA device\r
-  @param[out] ChildDevicePath       The pointer to the child device.\r
-\r
-  @retval EFI_SUCCESS               The handle for the child device was created.\r
-  @retval EFI_OUT_OF_RESOURCES      The request could not be completed due to a lack of resources.\r
-  @retval EFI_DEVICE_ERROR          The handle for the child device can not be created.\r
-**/\r
-EFI_STATUS\r
-IsaCreateDevice (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
-  IN EFI_HANDLE                   Controller,\r
-  IN EFI_PCI_IO_PROTOCOL          *PciIo,\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *ParentDevicePath,\r
-  IN EFI_ISA_ACPI_RESOURCE_LIST   *IsaDeviceResourceList,\r
-  OUT EFI_DEVICE_PATH_PROTOCOL    **ChildDevicePath\r
-  )\r
-{\r
-  EFI_STATUS    Status;\r
-  ISA_IO_DEVICE *IsaIoDevice;\r
-  EFI_DEV_PATH  Node;\r
-\r
-  //\r
-  // Initialize the PCI_IO_DEVICE structure\r
-  //\r
-  IsaIoDevice = AllocateZeroPool (sizeof (ISA_IO_DEVICE));\r
-  if (IsaIoDevice == NULL) {\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  IsaIoDevice->Signature  = ISA_IO_DEVICE_SIGNATURE;\r
-  IsaIoDevice->Handle     = NULL;\r
-  IsaIoDevice->PciIo      = PciIo;\r
-\r
-  //\r
-  // Initialize the ISA I/O instance structure\r
-  //\r
-  InitializeIsaIoInstance (IsaIoDevice, IsaDeviceResourceList);\r
-\r
-  //\r
-  // Build the child device path\r
-  //\r
-  Node.DevPath.Type     = ACPI_DEVICE_PATH;\r
-  Node.DevPath.SubType  = ACPI_DP;\r
-  SetDevicePathNodeLength (&Node.DevPath, sizeof (ACPI_HID_DEVICE_PATH));\r
-  Node.Acpi.HID = IsaDeviceResourceList->Device.HID;\r
-  Node.Acpi.UID = IsaDeviceResourceList->Device.UID;\r
-\r
-  IsaIoDevice->DevicePath = AppendDevicePathNode (\r
-                              ParentDevicePath,\r
-                              &Node.DevPath\r
-                              );\r
-\r
-  if (IsaIoDevice->DevicePath == NULL) {\r
-    Status = EFI_OUT_OF_RESOURCES;\r
-    goto Done;\r
-  }\r
-\r
-  *ChildDevicePath = IsaIoDevice->DevicePath;\r
-\r
-  //\r
-  // Create a child handle and install Device Path and ISA I/O protocols\r
-  //\r
-  Status = gBS->InstallMultipleProtocolInterfaces (\r
-                  &IsaIoDevice->Handle,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  IsaIoDevice->DevicePath,\r
-                  &gEfiIsaIoProtocolGuid,\r
-                  &IsaIoDevice->IsaIo,\r
-                  NULL\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    goto Done;\r
-  }\r
-\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiPciIoProtocolGuid,\r
-                  (VOID **) &PciIo,\r
-                  This->DriverBindingHandle,\r
-                  IsaIoDevice->Handle,\r
-                  EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    gBS->UninstallMultipleProtocolInterfaces (\r
-           IsaIoDevice->Handle,\r
-           &gEfiDevicePathProtocolGuid,\r
-           IsaIoDevice->DevicePath,\r
-           &gEfiIsaIoProtocolGuid,\r
-           &IsaIoDevice->IsaIo,\r
-           NULL\r
-           );\r
-  }\r
-\r
-Done:\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    if (IsaIoDevice->DevicePath != NULL) {\r
-      FreePool (IsaIoDevice->DevicePath);\r
-    }\r
-\r
-    FreePool (IsaIoDevice);\r
-  }\r
-\r
-  return Status;\r
-}\r
-\r