]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
Retired PciIncompatibleDeviceSupportLib from IntelFrameworkModulePkg.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / PciBusDxe / PciEnumeratorSupport.c
index 445d1cbbbce5d093eb3d89eb7025f190863c4776..c3157d4374c349ccb8948df2ba1a7b12b1f7c507 100644 (file)
@@ -47,27 +47,25 @@ PciDevicePresent (
   //\r
   // Read the Vendor ID register\r
   //\r
-  Status = PciRootBridgeIoRead (\r
-             PciRootBridgeIo,\r
-             NULL,\r
-             EfiPciWidthUint32,\r
-             Address,\r
-             1,\r
-             Pci\r
-             );\r
+  Status = PciRootBridgeIo->Pci.Read (\r
+                                  PciRootBridgeIo,\r
+                                  EfiPciWidthUint32,\r
+                                  Address,\r
+                                  1,\r
+                                  Pci\r
+                                  );\r
 \r
   if (!EFI_ERROR (Status) && (Pci->Hdr).VendorId != 0xffff) {\r
     //\r
     // Read the entire config header for the device\r
     //\r
-    Status = PciRootBridgeIoRead (\r
-               PciRootBridgeIo,\r
-               NULL,\r
-               EfiPciWidthUint32,\r
-               Address,\r
-               sizeof (PCI_TYPE00) / sizeof (UINT32),\r
-               Pci\r
-               );\r
+    Status = PciRootBridgeIo->Pci.Read (\r
+                                    PciRootBridgeIo,\r
+                                    EfiPciWidthUint32,\r
+                                    Address,\r
+                                    sizeof (PCI_TYPE00) / sizeof (UINT32),\r
+                                    Pci\r
+                                    );\r
 \r
     return EFI_SUCCESS;\r
   }\r
@@ -149,7 +147,7 @@ PciPciDeviceInfoCollector (
           //\r
           PciIo   = &(PciIoDevice->PciIo);\r
 \r
-          Status  = PciIoRead (PciIo, EfiPciIoWidthUint8, PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET, 1, &SecBus);\r
+          Status  = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET, 1, &SecBus);\r
 \r
           if (EFI_ERROR (Status)) {\r
             return Status;\r
@@ -446,10 +444,10 @@ GatherPpbInfo (
   //\r
   // Test whether it support 32 decode or not\r
   //\r
-  PciIoRead (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Temp);\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &gAllOne);\r
-  PciIoRead (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Value);\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Temp);\r
+  PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Temp);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &gAllOne);\r
+  PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Value);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Temp);\r
 \r
   if (Value != 0) {\r
     if ((Value & 0x01) != 0) {\r
@@ -629,20 +627,20 @@ BarExisted (
   //\r
   // Preserve the original value\r
   //\r
-  PciIoRead (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &OriginalValue);\r
+  PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &OriginalValue);\r
 \r
   //\r
   // Raise TPL to high level to disable timer interrupt while the BAR is probed\r
   //\r
   OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
 \r
-  PciIoWrite (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &gAllOne);\r
-  PciIoRead (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &Value);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &gAllOne);\r
+  PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &Value);\r
 \r
   //\r
   // Write back the original value\r
   //\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &OriginalValue);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &OriginalValue);\r
 \r
   //\r
   // Restore TPL to its original level\r
@@ -860,7 +858,7 @@ GetFastBackToBackSupport (
   // Read the status register\r
   //\r
   PciIo   = &PciIoDevice->PciIo;\r
-  Status  = PciIoRead (PciIo, EfiPciIoWidthUint16, StatusIndex, 1, &StatusRegister);\r
+  Status  = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, StatusIndex, 1, &StatusRegister);\r
   if (EFI_ERROR (Status)) {\r
     return EFI_UNSUPPORTED;\r
   }\r
@@ -1049,23 +1047,22 @@ DetermineDeviceAttribute (
 /**\r
   This routine is used to update the bar information for those incompatible PCI device.\r
 \r
-  @param PciIoDevice      Pci device instance.\r
+  @param PciIoDevice      Input Pci device instance. Output Pci device instance with updated\r
+                          Bar information.\r
 \r
   @retval EFI_SUCCESS     Successfully updated bar information.\r
   @retval EFI_UNSUPPORTED Given PCI device doesn't belong to incompatible PCI device list.\r
-  @retval other           Failed to check incompatibility device.\r
 \r
 **/\r
 EFI_STATUS\r
 UpdatePciInfo (\r
-  IN PCI_IO_DEVICE  *PciIoDevice\r
+  IN OUT PCI_IO_DEVICE    *PciIoDevice\r
   )\r
 {\r
   EFI_STATUS                        Status;\r
   UINTN                             BarIndex;\r
   UINTN                             BarEndIndex;\r
   BOOLEAN                           SetFlag;\r
-  EFI_PCI_DEVICE_INFO               PciDeviceInfo;\r
   VOID                              *Configuration;\r
   EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;\r
 \r
@@ -1100,22 +1097,6 @@ UpdatePciInfo (
 \r
   }\r
 \r
-  if (EFI_ERROR (Status)) {\r
-    //\r
-    // Check whether the device belongs to incompatible devices from library or not\r
-    // If it is , then get its special requirement in the ACPI table\r
-    //\r
-    if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT) {\r
-      PciDeviceInfo.VendorID          = PciIoDevice->Pci.Hdr.VendorId;\r
-      PciDeviceInfo.DeviceID          = PciIoDevice->Pci.Hdr.DeviceId;\r
-      PciDeviceInfo.RevisionID        = PciIoDevice->Pci.Hdr.RevisionID;\r
-      PciDeviceInfo.SubsystemVendorID = PciIoDevice->Pci.Device.SubsystemVendorID;\r
-      PciDeviceInfo.SubsystemID       = PciIoDevice->Pci.Device.SubsystemID;\r
-\r
-      Status = PciResourceUpdateCheck (&PciDeviceInfo, &Configuration);\r
-    }\r
-  }\r
-\r
   if (EFI_ERROR (Status) || Configuration == NULL ) {\r
     return EFI_UNSUPPORTED;\r
   }\r
@@ -1193,9 +1174,7 @@ UpdatePciInfo (
     Ptr++;\r
   }\r
 \r
-  if (Configuration != NULL) {\r
-    FreePool (Configuration);\r
-  }\r
+  FreePool (Configuration);\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -1203,14 +1182,14 @@ UpdatePciInfo (
 /**\r
   This routine will update the alignment with the new alignment.\r
 \r
-  @param Alignment    Old alignment.\r
+  @param Alignment    Input Old alignment. Output updated alignment.\r
   @param NewAlignment New alignment.\r
 \r
 **/\r
 VOID\r
 SetNewAlign (\r
-  IN UINT64     *Alignment,\r
-  IN UINT64     NewAlignment\r
+  IN OUT UINT64     *Alignment,\r
+  IN     UINT64     NewAlignment\r
   )\r
 {\r
   UINT64  OldAlignment;\r
@@ -1298,11 +1277,11 @@ PciParseBar (
   Value         = 0;\r
 \r
   Status = BarExisted (\r
-            PciIoDevice,\r
-            Offset,\r
-            &Value,\r
-            &OriginalValue\r
-            );\r
+             PciIoDevice,\r
+             Offset,\r
+             &Value,\r
+             &OriginalValue\r
+             );\r
 \r
   if (EFI_ERROR (Status)) {\r
     PciIoDevice->PciBar[BarIndex].BaseAddress = 0;\r
@@ -1400,11 +1379,11 @@ PciParseBar (
       Offset += 4;\r
 \r
       Status = BarExisted (\r
-                PciIoDevice,\r
-                Offset,\r
-                &Value,\r
-                &OriginalValue\r
-                );\r
+                 PciIoDevice,\r
+                 Offset,\r
+                 &Value,\r
+                 &OriginalValue\r
+                 );\r
 \r
       if (EFI_ERROR (Status)) {\r
         return Offset + 4;\r
@@ -1482,7 +1461,7 @@ InitializePciDevice (
   // has not been alloacted\r
   //\r
   for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {\r
-    PciIoWrite (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllOne);\r
+    PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllOne);\r
   }\r
 }\r
 \r
@@ -1506,28 +1485,28 @@ InitializePpb (
   // Io32, pMem32, pMem64 to quiescent state\r
   // Resource base all ones, Resource limit all zeros\r
   //\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &gAllOne);\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x1D, 1, &gAllZero);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &gAllOne);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x1D, 1, &gAllZero);\r
 \r
-  PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x20, 1, &gAllOne);\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x22, 1, &gAllZero);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0x20, 1, &gAllOne);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0x22, 1, &gAllZero);\r
 \r
-  PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x24, 1, &gAllOne);\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x26, 1, &gAllZero);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0x24, 1, &gAllOne);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0x26, 1, &gAllZero);\r
 \r
-  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x28, 1, &gAllOne);\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x2C, 1, &gAllZero);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x28, 1, &gAllOne);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x2C, 1, &gAllZero);\r
 \r
   //\r
-  // don't support use io32 as for now\r
+  // Don't support use io32 as for now\r
   //\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x30, 1, &gAllOne);\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x32, 1, &gAllZero);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0x30, 1, &gAllOne);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0x32, 1, &gAllZero);\r
 \r
   //\r
   // Force Interrupt line to zero for cards that come up randomly\r
   //\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);\r
 }\r
 \r
 /**\r
@@ -1550,22 +1529,22 @@ InitializeP2C (
   // Io32, pMem32, pMem64 to quiescent state(\r
   // Resource base all ones, Resource limit all zeros\r
   //\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x1c, 1, &gAllOne);\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x20, 1, &gAllZero);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x1c, 1, &gAllOne);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x20, 1, &gAllZero);\r
 \r
-  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x24, 1, &gAllOne);\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x28, 1, &gAllZero);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x24, 1, &gAllOne);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x28, 1, &gAllZero);\r
 \r
-  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x2c, 1, &gAllOne);\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x30, 1, &gAllZero);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x2c, 1, &gAllOne);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x30, 1, &gAllZero);\r
 \r
-  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x34, 1, &gAllOne);\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x38, 1, &gAllZero);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x34, 1, &gAllOne);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x38, 1, &gAllZero);\r
 \r
   //\r
   // Force Interrupt line to zero for cards that come up randomly\r
   //\r
-  PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);\r
 }\r
 \r
 /**\r
@@ -1722,9 +1701,9 @@ PciEnumeratorLight (
     RootBridgeDev->PciRootBridgeIo = PciRootBridgeIo;\r
 \r
     Status = PciPciDeviceInfoCollector (\r
-              RootBridgeDev,\r
-              (UINT8) MinBus\r
-              );\r
+               RootBridgeDev,\r
+               (UINT8) MinBus\r
+               );\r
 \r
     if (!EFI_ERROR (Status)) {\r
 \r
@@ -1995,25 +1974,24 @@ ResetAllPpbBusNumber (
       // Check to see whether a pci device is present\r
       //\r
       Status = PciDevicePresent (\r
-                PciRootBridgeIo,\r
-                &Pci,\r
-                StartBusNumber,\r
-                Device,\r
-                Func\r
-                );\r
+                 PciRootBridgeIo,\r
+                 &Pci,\r
+                 StartBusNumber,\r
+                 Device,\r
+                 Func\r
+                 );\r
 \r
       if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci))) {\r
 \r
         Register  = 0;\r
         Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);\r
-        Status   = PciRootBridgeIoRead (\r
-                                        PciRootBridgeIo,\r
-                                        &Pci,\r
-                                        EfiPciWidthUint32,\r
-                                        Address,\r
-                                        1,\r
-                                        &Register\r
-                                        );\r
+        Status    = PciRootBridgeIo->Pci.Read (\r
+                                           PciRootBridgeIo,\r
+                                           EfiPciWidthUint32,\r
+                                           Address,\r
+                                           1,\r
+                                           &Register\r
+                                           );\r
         SecondaryBus = (UINT8)(Register >> 8);\r
 \r
         if (SecondaryBus != 0) {\r
@@ -2024,9 +2002,8 @@ ResetAllPpbBusNumber (
         // Reset register 18h, 19h, 1Ah on PCI Bridge\r
         //\r
         Register &= 0xFF000000;\r
-        Status = PciRootBridgeIoWrite (\r
+        Status = PciRootBridgeIo->Pci.Write (\r
                                         PciRootBridgeIo,\r
-                                        &Pci,\r
                                         EfiPciWidthUint32,\r
                                         Address,\r
                                         1,\r