]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.c
Adjust directory structures.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / PciBus / Dxe / pcibus.c
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.c b/IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.c
deleted file mode 100644 (file)
index 0f9d944..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
-/*++\r
-\r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-Module Name:\r
-\r
-  PciBus.c\r
-\r
-Abstract:\r
-\r
-  PCI Bus Driver\r
-\r
-Revision History\r
-\r
---*/\r
-\r
-#include "pcibus.h"\r
-\r
-//\r
-// PCI Bus Driver Global Variables\r
-//\r
-\r
-EFI_DRIVER_BINDING_PROTOCOL                   gPciBusDriverBinding = {\r
-  PciBusDriverBindingSupported,\r
-  PciBusDriverBindingStart,\r
-  PciBusDriverBindingStop,\r
-  0xa,\r
-  NULL,\r
-  NULL\r
-};\r
-\r
-EFI_HANDLE                                    gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];\r
-UINTN                                         gPciHostBridgeNumber;\r
-BOOLEAN                                       gFullEnumeration;\r
-UINT64                                        gAllOne   = 0xFFFFFFFFFFFFFFFFULL;\r
-UINT64                                        gAllZero  = 0;\r
-\r
-EFI_PCI_PLATFORM_PROTOCOL                     *gPciPlatformProtocol;\r
-\r
-//\r
-// PCI Bus Driver Support Functions\r
-//\r
-EFI_STATUS\r
-EFIAPI\r
-PciBusEntryPoint (\r
-  IN EFI_HANDLE         ImageHandle,\r
-  IN EFI_SYSTEM_TABLE   *SystemTable\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Initialize the global variables\r
-  publish the driver binding protocol\r
-\r
-Arguments:\r
-\r
-  IN EFI_HANDLE     ImageHandle,\r
-  IN EFI_SYSTEM_TABLE   *SystemTable\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS\r
-  EFI_DEVICE_ERROR\r
-\r
---*/\r
-// TODO:    ImageHandle - add argument and description to function comment\r
-// TODO:    SystemTable - add argument and description to function comment\r
-{\r
-  EFI_STATUS  Status;\r
-\r
-  InitializePciDevicePool ();\r
-\r
-  gFullEnumeration      = TRUE;\r
-\r
-  gPciHostBridgeNumber  = 0;\r
-  \r
-  //\r
-  // Install driver model protocol(s).\r
-  //\r
-  Status = EfiLibInstallAllDriverProtocols (\r
-             ImageHandle,\r
-             SystemTable,\r
-             &gPciBusDriverBinding,\r
-             ImageHandle,\r
-             &gPciBusComponentName,\r
-             NULL,\r
-             NULL\r
-             );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  InstallHotPlugRequestProtocol (&Status);\r
-  \r
-  return Status;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PciBusDriverBindingSupported (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,\r
-  IN EFI_HANDLE                     Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check to see if pci bus driver supports the given controller\r
-\r
-Arguments:\r
-\r
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,\r
-  IN EFI_HANDLE                     Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS\r
-\r
---*/\r
-// TODO:    This - add argument and description to function comment\r
-// TODO:    Controller - add argument and description to function comment\r
-// TODO:    RemainingDevicePath - add argument and description to function comment\r
-// TODO:    EFI_UNSUPPORTED - add return value to function comment\r
-{\r
-  EFI_STATUS                      Status;\r
-  EFI_DEVICE_PATH_PROTOCOL        *ParentDevicePath;\r
-  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;\r
-  EFI_DEV_PATH_PTR                Node;\r
-\r
-  if (RemainingDevicePath != NULL) {\r
-    Node.DevPath = RemainingDevicePath;\r
-    if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||\r
-        Node.DevPath->SubType != HW_PCI_DP         ||\r
-        DevicePathNodeLength(Node.DevPath) != sizeof(PCI_DEVICE_PATH)) {\r
-      return EFI_UNSUPPORTED;\r
-    }\r
-  }\r
-  //\r
-  // Open the IO Abstraction(s) needed to perform the supported test\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 (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
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiPciRootBridgeIoProtocolGuid,\r
-                  (VOID **) &PciRootBridgeIo,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_BY_DRIVER\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
-        &gEfiPciRootBridgeIoProtocolGuid,\r
-        This->DriverBindingHandle,\r
-        Controller\r
-        );\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PciBusDriverBindingStart (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
-  IN EFI_HANDLE                   Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Start to management the controller passed in\r
-\r
-Arguments:\r
-\r
-  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
-  IN EFI_HANDLE                   Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
-\r
-Returns:\r
-\r
-\r
---*/\r
-// TODO:    This - add argument and description to function comment\r
-// TODO:    Controller - add argument and description to function comment\r
-// TODO:    RemainingDevicePath - add argument and description to function comment\r
-// TODO:    EFI_SUCCESS - add return value to function comment\r
-{\r
-  EFI_STATUS  Status;\r
-\r
-  //\r
-  // If PCI Platform protocol is available, get it now.\r
-  // If the platform implements this, it must be installed before BDS phase\r
-  //\r
-  gPciPlatformProtocol = NULL;\r
-  gBS->LocateProtocol (\r
-        &gEfiPciPlatformProtocolGuid,\r
-        NULL,\r
-        (VOID **) &gPciPlatformProtocol\r
-        );\r
-\r
-  gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : TRUE));\r
-\r
-  //\r
-  // Enumerate the entire host bridge\r
-  // After enumeration, a database that records all the device information will be created\r
-  //\r
-  //\r
-  Status = PciEnumerator (Controller);\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Enable PCI device specified by remaining device path. BDS or other driver can call the\r
-  // start more than once.\r
-  //\r
-\r
-  StartPciDevices (Controller, RemainingDevicePath);\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PciBusDriverBindingStop (\r
-  IN  EFI_DRIVER_BINDING_PROTOCOL   *This,\r
-  IN  EFI_HANDLE                    Controller,\r
-  IN  UINTN                         NumberOfChildren,\r
-  IN  EFI_HANDLE                    *ChildHandleBuffer\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Stop one or more children created at start of pci bus driver\r
-  if all the the children get closed, close the protocol\r
-\r
-Arguments:\r
-\r
-  IN  EFI_DRIVER_BINDING_PROTOCOL   *This,\r
-  IN  EFI_HANDLE                    Controller,\r
-  IN  UINTN                         NumberOfChildren,\r
-  IN  EFI_HANDLE                    *ChildHandleBuffer\r
-\r
-Returns:\r
-\r
-\r
---*/\r
-// TODO:    This - add argument and description to function comment\r
-// TODO:    Controller - add argument and description to function comment\r
-// TODO:    NumberOfChildren - add argument and description to function comment\r
-// TODO:    ChildHandleBuffer - add argument and description to function comment\r
-// TODO:    EFI_SUCCESS - add return value to function comment\r
-// TODO:    EFI_DEVICE_ERROR - add return value to function comment\r
-// TODO:    EFI_SUCCESS - add return value to function comment\r
-{\r
-  EFI_STATUS  Status;\r
-  UINTN       Index;\r
-  BOOLEAN     AllChildrenStopped;\r
-\r
-  if (NumberOfChildren == 0) {\r
-    //\r
-    // Close the bus driver\r
-    //\r
-    gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiDevicePathProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
-    gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiPciRootBridgeIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
-\r
-    DestroyRootBridgeByHandle (\r
-      Controller\r
-      );\r
-\r
-    return EFI_SUCCESS;\r
-  }\r
-\r
-  //\r
-  // Stop all the children\r
-  //\r
-\r
-  AllChildrenStopped = TRUE;\r
-\r
-  for (Index = 0; Index < NumberOfChildren; Index++) {\r
-\r
-    //\r
-    // De register all the pci device\r
-    //\r
-    Status = DeRegisterPciDevice (Controller, ChildHandleBuffer[Index]);\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