]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Added EdkPciIncompatibleDeviceSupportLib in EdkModulePkg, this library is used...
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 12 Apr 2007 09:07:01 +0000 (09:07 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 12 Apr 2007 09:07:01 +0000 (09:07 +0000)
2. Used EdkPciIncompatibleDeviceSupportLib in PciBus driver.
3. Redirect all Pci Configuration access to new APIs added in PciLib.c for PciBus driver.
4. Added one PCD PcdIncompatibleDeviceSupportMask in EdkModulePkg.spd to provide mask of PCI devices incompatibility check.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2562 6f19259b-4bc3-4df7-8a09-765794883524

18 files changed:
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.c
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.c
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.c
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.c
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.h
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.c
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciPowerManagement.c
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.c
EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.c
EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.h
EdkModulePkg/EdkModulePkg.fpd
EdkModulePkg/EdkModulePkg.spd
EdkModulePkg/Include/Library/PciIncompatibleDeviceSupportLib.h [new file with mode: 0644]
EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.c [new file with mode: 0644]
EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.msa [new file with mode: 0644]
EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h [new file with mode: 0644]

index 712ae999da6998f95b1a7f85e8d356533033c7e7..f29121862441d89da8a90456723a6f9daf26f93c 100644 (file)
@@ -57,6 +57,9 @@
     <LibraryClass Usage="ALWAYS_CONSUMED">\r
       <Keyword>PcdLib</Keyword>\r
     </LibraryClass>\r
     <LibraryClass Usage="ALWAYS_CONSUMED">\r
       <Keyword>PcdLib</Keyword>\r
     </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PciIncompatibleDeviceSupportLib</Keyword>\r
+    </LibraryClass>\r
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>pcibus.h</Filename>\r
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>pcibus.h</Filename>\r
       <DefaultValue>TRUE</DefaultValue>\r
       <HelpText>If TRUE, the PCI bus driver will support hot plug device. If not hot plug device is supported, this feature flag can be set to FALSE to save size.</HelpText>\r
     </PcdEntry>\r
       <DefaultValue>TRUE</DefaultValue>\r
       <HelpText>If TRUE, the PCI bus driver will support hot plug device. If not hot plug device is supported, this feature flag can be set to FALSE to save size.</HelpText>\r
     </PcdEntry>\r
+    <PcdEntry PcdItemType="FIXED_AT_BUILD" Usage="ALWAYS_CONSUMED">\r
+      <C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>\r
+      <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+      <HelpText>The PCD masks for PCI incompatible devices support</HelpText>\r
+    </PcdEntry>\r
   </PcdCoded>\r
 </ModuleSurfaceArea>\r
   </PcdCoded>\r
 </ModuleSurfaceArea>\r
index 6b472448d97ed689fb9f554474c5d41480eb18d4..dd4b65061226ea06e611d38ca03ec9496692927c 100644 (file)
@@ -1,18 +1,18 @@
 /*++\r
 \r
 /*++\r
 \r
-Copyright (c) 2006, 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
+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
   PciCommand.c\r
 \r
 Module Name:\r
 \r
   PciCommand.c\r
-  \r
+\r
 Abstract:\r
 \r
   PCI Bus Driver\r
 Abstract:\r
 \r
   PCI Bus Driver\r
@@ -56,13 +56,13 @@ Returns:
   PciIo       = &PciIoDevice->PciIo;\r
 \r
   if (Operation != EFI_SET_REGISTER) {\r
   PciIo       = &PciIoDevice->PciIo;\r
 \r
   if (Operation != EFI_SET_REGISTER) {\r
-    Status = PciIo->Pci.Read (\r
-                          PciIo,\r
-                          EfiPciIoWidthUint16,\r
-                          Offset,\r
-                          1,\r
-                          &OldCommand\r
-                          );\r
+    Status = PciIoRead (\r
+                         PciIo,\r
+                         EfiPciIoWidthUint16,\r
+                         Offset,\r
+                         1,\r
+                         &OldCommand\r
+                        );\r
 \r
     if (Operation == EFI_GET_REGISTER) {\r
       *PtrCommand = OldCommand;\r
 \r
     if (Operation == EFI_GET_REGISTER) {\r
       *PtrCommand = OldCommand;\r
@@ -78,13 +78,13 @@ Returns:
     OldCommand = Command;\r
   }\r
 \r
     OldCommand = Command;\r
   }\r
 \r
-  return PciIo->Pci.Write (\r
+  return PciIoWrite (\r
                       PciIo,\r
                       EfiPciIoWidthUint16,\r
                       Offset,\r
                       1,\r
                       &OldCommand\r
                       PciIo,\r
                       EfiPciIoWidthUint16,\r
                       Offset,\r
                       1,\r
                       &OldCommand\r
-                      );\r
+                    );\r
 }\r
 \r
 BOOLEAN\r
 }\r
 \r
 BOOLEAN\r
@@ -98,7 +98,7 @@ Routine Description:
 Arguments:\r
 \r
 Returns:\r
 Arguments:\r
 \r
 Returns:\r
-  \r
+\r
   None\r
 \r
 --*/\r
   None\r
 \r
 --*/\r
@@ -131,7 +131,7 @@ Arguments:
   NextRegBlock        - A pointer to the next block.\r
 \r
 Returns:\r
   NextRegBlock        - A pointer to the next block.\r
 \r
 Returns:\r
-  \r
+\r
   None\r
 \r
 --*/\r
   None\r
 \r
 --*/\r
@@ -157,22 +157,22 @@ Returns:
     CapabilityPtr = 0;\r
     if (IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {\r
 \r
     CapabilityPtr = 0;\r
     if (IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {\r
 \r
-      PciIoDevice->PciIo.Pci.Read (\r
-                              &PciIoDevice->PciIo,\r
-                              EfiPciIoWidthUint8,\r
-                              EFI_PCI_CARDBUS_BRIDGE_CAPABILITY_PTR,\r
-                              1,\r
-                              &CapabilityPtr\r
-                              );\r
+      PciIoRead (\r
+                  &PciIoDevice->PciIo,\r
+                  EfiPciIoWidthUint8,\r
+                  EFI_PCI_CARDBUS_BRIDGE_CAPABILITY_PTR,\r
+                  1,\r
+                  &CapabilityPtr\r
+                );\r
     } else {\r
 \r
     } else {\r
 \r
-      PciIoDevice->PciIo.Pci.Read (\r
-                              &PciIoDevice->PciIo,\r
-                              EfiPciIoWidthUint8,\r
-                              EFI_PCI_CAPABILITY_PTR,\r
-                              1,\r
-                              &CapabilityPtr\r
-                              );\r
+      PciIoRead (\r
+                  &PciIoDevice->PciIo,\r
+                  EfiPciIoWidthUint8,\r
+                  EFI_PCI_CAPABILITY_PTR,\r
+                  1,\r
+                  &CapabilityPtr\r
+                );\r
     }\r
   }\r
 \r
     }\r
   }\r
 \r
@@ -181,13 +181,13 @@ Returns:
     // Mask it to DWORD alignment per PCI spec\r
     //\r
     CapabilityPtr &= 0xFC;\r
     // Mask it to DWORD alignment per PCI spec\r
     //\r
     CapabilityPtr &= 0xFC;\r
-    PciIoDevice->PciIo.Pci.Read (\r
-                            &PciIoDevice->PciIo,\r
-                            EfiPciIoWidthUint16,\r
-                            CapabilityPtr,\r
-                            1,\r
-                            &CapabilityEntry\r
-                            );\r
+    PciIoRead (\r
+                &PciIoDevice->PciIo,\r
+                EfiPciIoWidthUint16,\r
+                CapabilityPtr,\r
+                1,\r
+                &CapabilityEntry\r
+              );\r
 \r
     CapabilityID = (UINT8) CapabilityEntry;\r
 \r
 \r
     CapabilityID = (UINT8) CapabilityEntry;\r
 \r
index cbbc00b18383998f5e322dd0b7682c737f04c4cd..0e95dc18653d6f631d0cdc8698c7d75b96126089 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
 /*++\r
 \r
-Copyright (c) 2006, Intel Corporation\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
 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
@@ -335,14 +335,13 @@ Returns:
   if (!EFI_ERROR (Status)) {\r
     PciIoDevice->IsPciExp = TRUE;\r
   }\r
   if (!EFI_ERROR (Status)) {\r
     PciIoDevice->IsPciExp = TRUE;\r
   }\r
-\r
+  \r
   //\r
   // Force Interrupt line to "Unknown" or "No Connection"\r
   //\r
   PciIo = &(PciIoDevice->PciIo);\r
   Data8 = PCI_INT_LINE_UNKNOWN;\r
   //\r
   // Force Interrupt line to "Unknown" or "No Connection"\r
   //\r
   PciIo = &(PciIoDevice->PciIo);\r
   Data8 = PCI_INT_LINE_UNKNOWN;\r
-\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &Data8);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &Data8);\r
 \r
   //\r
   // Process Platform OpRom\r
 \r
   //\r
   // Process Platform OpRom\r
index 384e86ff348c89d02e827f296ab6c0072c43d366..e7a05a2ec9be40c4eebfa2c6442fce3f971508f2 100644 (file)
@@ -1,18 +1,18 @@
 /*++\r
 \r
 /*++\r
 \r
-Copyright (c) 2006, 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
+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
   PciEnumerator.c\r
 \r
 Module Name:\r
 \r
   PciEnumerator.c\r
-  \r
+\r
 Abstract:\r
 \r
   PCI Bus Driver\r
 Abstract:\r
 \r
   PCI Bus Driver\r
@@ -34,7 +34,7 @@ PciEnumerator (
 \r
 Routine Description:\r
 \r
 \r
 Routine Description:\r
 \r
-  This routine is used to enumerate entire pci bus system \r
+  This routine is used to enumerate entire pci bus system\r
   in a given platform\r
 \r
 Arguments:\r
   in a given platform\r
 \r
 Arguments:\r
@@ -118,7 +118,7 @@ Returns:
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-      \r
+\r
   //\r
   // Submit the resource request\r
   //\r
   //\r
   // Submit the resource request\r
   //\r
@@ -127,7 +127,7 @@ Returns:
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
   //\r
   // Process P2C\r
   //\r
   //\r
   // Process P2C\r
   //\r
@@ -136,7 +136,7 @@ Returns:
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
   //\r
   // Process attributes for devices on this host bridge\r
   //\r
   //\r
   // Process attributes for devices on this host bridge\r
   //\r
@@ -286,7 +286,7 @@ Returns:
   while (CurrentLink && CurrentLink != &Bridge->ChildList) {\r
     Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);\r
     if (!IsListEmpty (&Temp->ChildList)) {\r
   while (CurrentLink && CurrentLink != &Bridge->ChildList) {\r
     Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);\r
     if (!IsListEmpty (&Temp->ChildList)) {\r
-      \r
+\r
       //\r
       // Go further to process the option rom under this bridge\r
       //\r
       //\r
       // Go further to process the option rom under this bridge\r
       //\r
@@ -294,7 +294,7 @@ Returns:
     }\r
 \r
     if (Temp->RomSize != 0 && Temp->RomSize <= MaxLength) {\r
     }\r
 \r
     if (Temp->RomSize != 0 && Temp->RomSize <= MaxLength) {\r
-     \r
+\r
       //\r
       // Load and process the option rom\r
       //\r
       //\r
       // Load and process the option rom\r
       //\r
@@ -382,8 +382,9 @@ Returns:
 \r
         Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);\r
 \r
 \r
         Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);\r
 \r
-        Status = PciRootBridgeIo->Pci.Write (\r
+        Status = PciRootBridgeIoWrite (\r
                                         PciRootBridgeIo,\r
                                         PciRootBridgeIo,\r
+                                        &Pci,\r
                                         EfiPciWidthUint16,\r
                                         Address,\r
                                         1,\r
                                         EfiPciWidthUint16,\r
                                         Address,\r
                                         1,\r
@@ -394,8 +395,9 @@ Returns:
         // Initialize SubBusNumber to SecondBus\r
         //\r
         Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
         // Initialize SubBusNumber to SecondBus\r
         //\r
         Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
-        Status = PciRootBridgeIo->Pci.Write (\r
+        Status = PciRootBridgeIoWrite (\r
                                         PciRootBridgeIo,\r
                                         PciRootBridgeIo,\r
+                                        &Pci,\r
                                         EfiPciWidthUint8,\r
                                         Address,\r
                                         1,\r
                                         EfiPciWidthUint8,\r
                                         Address,\r
                                         1,\r
@@ -407,8 +409,9 @@ Returns:
         if (IS_PCI_BRIDGE (&Pci)) {\r
 \r
           Register8 = 0xFF;\r
         if (IS_PCI_BRIDGE (&Pci)) {\r
 \r
           Register8 = 0xFF;\r
-          Status = PciRootBridgeIo->Pci.Write (\r
+          Status = PciRootBridgeIoWrite (\r
                                           PciRootBridgeIo,\r
                                           PciRootBridgeIo,\r
+                                          &Pci,\r
                                           EfiPciWidthUint8,\r
                                           Address,\r
                                           1,\r
                                           EfiPciWidthUint8,\r
                                           Address,\r
                                           1,\r
@@ -432,8 +435,9 @@ Returns:
 \r
         Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
 \r
 \r
         Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
 \r
-        Status = PciRootBridgeIo->Pci.Write (\r
+        Status = PciRootBridgeIoWrite (\r
                                         PciRootBridgeIo,\r
                                         PciRootBridgeIo,\r
+                                        &Pci,\r
                                         EfiPciWidthUint8,\r
                                         Address,\r
                                         1,\r
                                         EfiPciWidthUint8,\r
                                         Address,\r
                                         1,\r
@@ -503,7 +507,7 @@ Returns:
   // Here is the point where PCI bus driver calls HOST bridge allocation protocol\r
   // Currently we hardcoded for ea815\r
   //\r
   // Here is the point where PCI bus driver calls HOST bridge allocation protocol\r
   // Currently we hardcoded for ea815\r
   //\r
-  \r
+\r
   if (Attributes & EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM) {\r
     RootBridgeDev->Decodes |= EFI_BRIDGE_PMEM_MEM_COMBINE_SUPPORTED;\r
   }\r
   if (Attributes & EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM) {\r
     RootBridgeDev->Decodes |= EFI_BRIDGE_PMEM_MEM_COMBINE_SUPPORTED;\r
   }\r
@@ -526,7 +530,7 @@ GetMaxOptionRomSize (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
     Get Max Option Rom size on this bridge\r
 \r
 Arguments:\r
     Get Max Option Rom size on this bridge\r
 \r
 Arguments:\r
@@ -552,7 +556,7 @@ Returns:
   while (CurrentLink && CurrentLink != &Bridge->ChildList) {\r
     Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);\r
     if (!IsListEmpty (&Temp->ChildList)) {\r
   while (CurrentLink && CurrentLink != &Bridge->ChildList) {\r
     Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);\r
     if (!IsListEmpty (&Temp->ChildList)) {\r
-      \r
+\r
       //\r
       // Get max option rom size under this bridge\r
       //\r
       //\r
       // Get max option rom size under this bridge\r
       //\r
@@ -567,13 +571,13 @@ Returns:
       }\r
 \r
     } else {\r
       }\r
 \r
     } else {\r
-      \r
+\r
       //\r
       // For devices get the rom size directly\r
       //\r
       TempOptionRomSize = Temp->RomSize;\r
     }\r
       //\r
       // For devices get the rom size directly\r
       //\r
       TempOptionRomSize = Temp->RomSize;\r
     }\r
-    \r
+\r
     //\r
     // Get the largest rom size on this bridge\r
     //\r
     //\r
     // Get the largest rom size on this bridge\r
     //\r
@@ -594,7 +598,7 @@ PciHostBridgeDeviceAttribute (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
     Process attributes of devices on this host bridge\r
 \r
 Arguments:\r
     Process attributes of devices on this host bridge\r
 \r
 Arguments:\r
@@ -650,7 +654,7 @@ GetResourceAllocationStatus (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
     Get resource allocation status from the ACPI pointer\r
 \r
 Arguments:\r
     Get resource allocation status from the ACPI pointer\r
 \r
 Arguments:\r
@@ -736,7 +740,7 @@ RejectPciDevice (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
     Remove a PCI device from device pool and mark its bar\r
 \r
 Arguments:\r
     Remove a PCI device from device pool and mark its bar\r
 \r
 Arguments:\r
@@ -789,7 +793,7 @@ Returns:
     //\r
     InitializeP2C (PciDevice);\r
   }\r
     //\r
     InitializeP2C (PciDevice);\r
   }\r
-    \r
+\r
   //\r
   // Remove the device\r
   //\r
   //\r
   // Remove the device\r
   //\r
@@ -817,7 +821,7 @@ IsRejectiveDevice (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
     Determine whethter a PCI device can be rejected\r
 \r
 Arguments:\r
     Determine whethter a PCI device can be rejected\r
 \r
 Arguments:\r
@@ -839,7 +843,7 @@ Returns:
   if (!Temp) {\r
     return FALSE;\r
   }\r
   if (!Temp) {\r
     return FALSE;\r
   }\r
-    \r
+\r
   //\r
   // PPB and RB should go ahead\r
   //\r
   //\r
   // PPB and RB should go ahead\r
   //\r
@@ -853,7 +857,7 @@ Returns:
   if ((Temp->Parent) && (Temp->BusNumber == 0)) {\r
     return FALSE;\r
   }\r
   if ((Temp->Parent) && (Temp->BusNumber == 0)) {\r
     return FALSE;\r
   }\r
-  \r
+\r
   //\r
   // Skip VGA\r
   //\r
   //\r
   // Skip VGA\r
   //\r
@@ -872,7 +876,7 @@ GetLargerConsumerDevice (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
     Get the larger resource consumer\r
 \r
 Arguments:\r
     Get the larger resource consumer\r
 \r
 Arguments:\r
@@ -914,8 +918,8 @@ GetMaxResourceConsumerDevice (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
-  \r
-    Get the max resource consumer in the host resource pool \r
+\r
+    Get the max resource consumer in the host resource pool\r
 \r
 Arguments:\r
 \r
 \r
 Arguments:\r
 \r
@@ -974,7 +978,7 @@ PciHostBridgeAdjustAllocation (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
     Adjust host bridge allocation so as to reduce resource requirement\r
 \r
 Arguments:\r
     Adjust host bridge allocation so as to reduce resource requirement\r
 \r
 Arguments:\r
@@ -1039,7 +1043,7 @@ Returns:
       //\r
       return EFI_ABORTED;\r
     }\r
       //\r
       return EFI_ABORTED;\r
     }\r
-    \r
+\r
     //\r
     // Hostbridge hasn't enough resource\r
     //\r
     //\r
     // Hostbridge hasn't enough resource\r
     //\r
@@ -1047,7 +1051,7 @@ Returns:
     if (!PciResNode) {\r
       continue;\r
     }\r
     if (!PciResNode) {\r
       continue;\r
     }\r
-    \r
+\r
     //\r
     // Check if the device has been removed before\r
     //\r
     //\r
     // Check if the device has been removed before\r
     //\r
@@ -1056,13 +1060,13 @@ Returns:
         continue;\r
       }\r
     }\r
         continue;\r
       }\r
     }\r
-    \r
+\r
     //\r
     // Remove the device if it isn't in the array\r
     //\r
     Status = RejectPciDevice (PciResNode->PciDev);\r
     if (Status == EFI_SUCCESS) {\r
     //\r
     // Remove the device if it isn't in the array\r
     //\r
     Status = RejectPciDevice (PciResNode->PciDev);\r
     if (Status == EFI_SUCCESS) {\r
-      \r
+\r
       //\r
       // Raise the EFI_IOB_EC_RESOURCE_CONFLICT status code\r
       //\r
       //\r
       // Raise the EFI_IOB_EC_RESOURCE_CONFLICT status code\r
       //\r
@@ -1399,7 +1403,7 @@ Returns:
       // Memory type aperture\r
       //\r
       case 0:\r
       // Memory type aperture\r
       //\r
       case 0:\r
-  \r
+\r
         //\r
         // Check to see the granularity\r
         //\r
         //\r
         // Check to see the granularity\r
         //\r
@@ -1471,7 +1475,7 @@ Returns:
   SubBusNumber    = 0;\r
   StartBusNumber  = 0;\r
   PciIo           = &(BridgeDev->PciIo);\r
   SubBusNumber    = 0;\r
   StartBusNumber  = 0;\r
   PciIo           = &(BridgeDev->PciIo);\r
-  Status          = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x19, 1, &StartBusNumber);\r
+  Status          = PciIoRead (PciIo, EfiPciIoWidthUint8, 0x19, 1, &StartBusNumber);\r
 \r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
 \r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
@@ -1896,7 +1900,7 @@ Returns:
   if (EFI_ERROR (Status)) {\r
     return EFI_UNSUPPORTED;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return EFI_UNSUPPORTED;\r
   }\r
-  \r
+\r
   //\r
   // Get Root Brige Handle\r
   //\r
   //\r
   // Get Root Brige Handle\r
   //\r
@@ -1965,7 +1969,7 @@ PciHotPlugRequestNotify (
 Routine Description:\r
 \r
   Hot plug request notify.\r
 Routine Description:\r
 \r
   Hot plug request notify.\r
-  \r
+\r
 Arguments:\r
 \r
   This                 - A pointer to the hot plug request protocol.\r
 Arguments:\r
 \r
   This                 - A pointer to the hot plug request protocol.\r
@@ -2082,7 +2086,7 @@ SearchHostBridgeHandle (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
 Arguments:\r
 \r
 Returns:\r
 Arguments:\r
 \r
 Returns:\r
@@ -2130,7 +2134,7 @@ AddHostBridgeEnumerator (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
 Arguments:\r
 \r
 Returns:\r
 Arguments:\r
 \r
 Returns:\r
index 0403402ddd62181ad96ebb753912a8ff46ded4c7..52a3a7bee5bed9769504d89093ca7474113306ee 100644 (file)
@@ -1,18 +1,18 @@
 /*++\r
 \r
 /*++\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
+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
   PciEnumeratorSupport.c\r
 \r
 Module Name:\r
 \r
   PciEnumeratorSupport.c\r
-  \r
+\r
 Abstract:\r
 \r
   PCI Bus Driver\r
 Abstract:\r
 \r
   PCI Bus Driver\r
@@ -66,8 +66,9 @@ Returns:
   //\r
   // Read the Vendor Id register\r
   //\r
   //\r
   // Read the Vendor Id register\r
   //\r
-  Status = PciRootBridgeIo->Pci.Read (\r
+  Status = PciRootBridgeIoRead (\r
                                   PciRootBridgeIo,\r
                                   PciRootBridgeIo,\r
+                                  NULL,\r
                                   EfiPciWidthUint32,\r
                                   Address,\r
                                   1,\r
                                   EfiPciWidthUint32,\r
                                   Address,\r
                                   1,\r
@@ -80,8 +81,9 @@ Returns:
     // Read the entire config header for the device\r
     //\r
 \r
     // Read the entire config header for the device\r
     //\r
 \r
-    Status = PciRootBridgeIo->Pci.Read (\r
+    Status = PciRootBridgeIoRead (\r
                                     PciRootBridgeIo,\r
                                     PciRootBridgeIo,\r
+                                    NULL,\r
                                     EfiPciWidthUint32,\r
                                     Address,\r
                                     sizeof (PCI_TYPE00) / sizeof (UINT32),\r
                                     EfiPciWidthUint32,\r
                                     Address,\r
                                     sizeof (PCI_TYPE00) / sizeof (UINT32),\r
@@ -172,12 +174,12 @@ Returns:
           //\r
           PciIo   = &(PciIoDevice->PciIo);\r
 \r
           //\r
           PciIo   = &(PciIoDevice->PciIo);\r
 \r
-          Status  = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x19, 1, &SecBus);\r
+          Status  = PciIoRead (PciIo, EfiPciIoWidthUint8, 0x19, 1, &SecBus);\r
 \r
           if (EFI_ERROR (Status)) {\r
             return Status;\r
           }\r
 \r
           if (EFI_ERROR (Status)) {\r
             return Status;\r
           }\r
-              \r
+\r
           //\r
           // Get resource padding for PPB\r
           //\r
           //\r
           // Get resource padding for PPB\r
           //\r
@@ -256,7 +258,7 @@ Returns:
                       Func\r
                       );\r
       if ((PciIoDevice != NULL) && gFullEnumeration) {\r
                       Func\r
                       );\r
       if ((PciIoDevice != NULL) && gFullEnumeration) {\r
-        InitializeP2C (PciIoDevice);      \r
+        InitializeP2C (PciIoDevice);\r
       }\r
     } else {\r
 \r
       }\r
     } else {\r
 \r
@@ -297,16 +299,18 @@ Returns:
   if (!PciIoDevice) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
   if (!PciIoDevice) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  \r
+\r
   //\r
   // Update the bar information for this PCI device so as to support some specific device\r
   //\r
   //\r
   // Update the bar information for this PCI device so as to support some specific device\r
   //\r
-  UpdatePciInfo (PciIoDevice);\r
+  if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT) {\r
+    UpdatePciInfo (PciIoDevice);\r
+  }\r
 \r
   if (PciIoDevice->DevicePath == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
   if (PciIoDevice->DevicePath == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  \r
+\r
   //\r
   // Detect this function has option rom\r
   //\r
   //\r
   // Detect this function has option rom\r
   //\r
@@ -321,7 +325,7 @@ Returns:
     ResetPowerManagementFeature (PciIoDevice);\r
 \r
   }\r
     ResetPowerManagementFeature (PciIoDevice);\r
 \r
   }\r
\r
+\r
   //\r
   // Insert it into a global tree for future reference\r
   //\r
   //\r
   // Insert it into a global tree for future reference\r
   //\r
@@ -452,7 +456,7 @@ Returns:
   if (!PciIoDevice) {\r
     return NULL;\r
   }\r
   if (!PciIoDevice) {\r
     return NULL;\r
   }\r
-  \r
+\r
   //\r
   // Create a device path for this PCI device and store it into its private data\r
   //\r
   //\r
   // Create a device path for this PCI device and store it into its private data\r
   //\r
@@ -486,10 +490,10 @@ Returns:
   //\r
   // Test whether it support 32 decode or not\r
   //\r
   //\r
   // Test whether it support 32 decode or not\r
   //\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
+  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
 \r
   if (Value) {\r
     if (Value & 0x01) {\r
 \r
   if (Value) {\r
     if (Value & 0x01) {\r
@@ -684,20 +688,20 @@ Returns:
   // Preserve the original value\r
   //\r
 \r
   // Preserve the original value\r
   //\r
 \r
-  PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &OriginalValue);\r
+  PciIoRead (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 (EFI_TPL_HIGH_LEVEL);\r
 \r
 \r
   //\r
   // Raise TPL to high level to disable timer interrupt while the BAR is probed\r
   //\r
   OldTpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);\r
 \r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &gAllOne);\r
-  PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &Value);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &gAllOne);\r
+  PciIoRead (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &Value);\r
 \r
   //\r
   // Write back the original value\r
   //\r
 \r
   //\r
   // Write back the original value\r
   //\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &OriginalValue);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &OriginalValue);\r
 \r
   //\r
   // Restore TPL to its original level\r
 \r
   //\r
   // Restore TPL to its original level\r
@@ -771,7 +775,7 @@ Returns:
   gBS->RestoreTPL (OldTpl);\r
 \r
   if (IS_PCI_BRIDGE (&PciIoDevice->Pci) || IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {\r
   gBS->RestoreTPL (OldTpl);\r
 \r
   if (IS_PCI_BRIDGE (&PciIoDevice->Pci) || IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {\r
-    \r
+\r
     //\r
     // Preserve the original value\r
     //\r
     //\r
     // Preserve the original value\r
     //\r
@@ -813,7 +817,7 @@ PciSetDeviceAttribute (
 /*++\r
 \r
   Routine Description:\r
 /*++\r
 \r
   Routine Description:\r
-    Set the supported or current attributes of a PCI device    \r
+    Set the supported or current attributes of a PCI device\r
 \r
   Arguments:\r
     PciIoDevice   - Structure pointer for PCI device.\r
 \r
   Arguments:\r
     PciIoDevice   - Structure pointer for PCI device.\r
@@ -821,7 +825,7 @@ PciSetDeviceAttribute (
     BridgeControl - Bridge control value for PPB or P2C.\r
     Option        - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.\r
 \r
     BridgeControl - Bridge control value for PPB or P2C.\r
     Option        - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.\r
 \r
-  Returns:    \r
+  Returns:\r
 \r
 --*/\r
 \r
 \r
 --*/\r
 \r
@@ -829,15 +833,15 @@ PciSetDeviceAttribute (
 \r
 Routine Description:\r
 \r
 \r
 Routine Description:\r
 \r
-  \r
+\r
 \r
 Arguments:\r
 \r
 Arguments:\r
\r
-  \r
+\r
+\r
 Returns:\r
 Returns:\r
-  \r
+\r
   EFI_SUCCESS   Always success\r
   EFI_SUCCESS   Always success\r
-  \r
+\r
 \r
 --*/\r
 {\r
 \r
 --*/\r
 {\r
@@ -878,7 +882,7 @@ Returns:
 \r
   if (Option == EFI_SET_SUPPORTS) {\r
 \r
 \r
   if (Option == EFI_SET_SUPPORTS) {\r
 \r
-    Attributes |= EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE | \r
+    Attributes |= EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE |\r
                   EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED        |\r
                   EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE       |\r
                   EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE      |\r
                   EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED        |\r
                   EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE       |\r
                   EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE      |\r
@@ -929,7 +933,7 @@ GetFastBackToBackSupport (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
\r
+\r
   Determine if the device can support Fast Back to Back attribute\r
 \r
 Arguments:\r
   Determine if the device can support Fast Back to Back attribute\r
 \r
 Arguments:\r
@@ -953,11 +957,11 @@ Returns:
   // Read the status register\r
   //\r
   PciIo   = &PciIoDevice->PciIo;\r
   // Read the status register\r
   //\r
   PciIo   = &PciIoDevice->PciIo;\r
-  Status  = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, StatusIndex, 1, &StatusRegister);\r
+  Status  = PciIoRead (PciIo, EfiPciIoWidthUint16, StatusIndex, 1, &StatusRegister);\r
   if (EFI_ERROR (Status)) {\r
     return EFI_UNSUPPORTED;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return EFI_UNSUPPORTED;\r
   }\r
-  \r
+\r
   //\r
   // Check the Fast B2B bit\r
   //\r
   //\r
   // Check the Fast B2B bit\r
   //\r
@@ -977,7 +981,7 @@ ProcessOptionRomLight (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
\r
+\r
   Process the option ROM for all the children of the specified parent PCI device.\r
   It can only be used after the first full Option ROM process.\r
 \r
   Process the option ROM for all the children of the specified parent PCI device.\r
   It can only be used after the first full Option ROM process.\r
 \r
@@ -1020,7 +1024,7 @@ DetermineDeviceAttribute (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
\r
+\r
   Determine the related attributes of all devices under a Root Bridge\r
 \r
 Arguments:\r
   Determine the related attributes of all devices under a Root Bridge\r
 \r
 Arguments:\r
@@ -1061,7 +1065,7 @@ Returns:
       return Status;\r
     }\r
   } else {\r
       return Status;\r
     }\r
   } else {\r
-  \r
+\r
     //\r
     // Set the attributes to be checked for common PCI devices and PPB or P2C\r
     // Since some devices only support part of them, it is better to set the\r
     //\r
     // Set the attributes to be checked for common PCI devices and PPB or P2C\r
     // Since some devices only support part of them, it is better to set the\r
@@ -1100,30 +1104,30 @@ Returns:
     /*\r
     if (IS_PCI_IDE(&PciIoDevice->Pci)) {\r
 \r
     /*\r
     if (IS_PCI_IDE(&PciIoDevice->Pci)) {\r
 \r
-      PciIo = &PciIoDevice->PciIo;  \r
+      PciIo = &PciIoDevice->PciIo;\r
 \r
 \r
-      PciIo->Pci.Read (\r
-                              PciIo, \r
-                              EfiPciIoWidthUint8, \r
-                              0x09, \r
-                              1, \r
+      PciIoRead (\r
+                              PciIo,\r
+                              EfiPciIoWidthUint8,\r
+                              0x09,\r
+                              1,\r
                               &IdePI\r
                               );\r
                               &IdePI\r
                               );\r
-      \r
+\r
       //\r
       // Set native mode if it can be supported\r
       //\r
       // Set native mode if it can be supported\r
-      //      \r
+      //\r
       IdePI |= (((IdePI & 0x0F) >> 1) & 0x05);\r
 \r
       IdePI |= (((IdePI & 0x0F) >> 1) & 0x05);\r
 \r
-      PciIo->Pci.Write (\r
-                              PciIo, \r
-                              EfiPciIoWidthUint8, \r
-                              0x09, \r
-                              1, \r
+      PciIoWrite (\r
+                              PciIo,\r
+                              EfiPciIoWidthUint8,\r
+                              0x09,\r
+                              1,\r
                               &IdePI\r
                               &IdePI\r
-                              );  \r
-    \r
-    }  \r
+                              );\r
+\r
+    }\r
     */\r
   }\r
 \r
     */\r
   }\r
 \r
@@ -1135,7 +1139,7 @@ Returns:
   if (IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {\r
     FastB2BSupport = FALSE;\r
   }\r
   if (IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {\r
     FastB2BSupport = FALSE;\r
   }\r
-  \r
+\r
   //\r
   // For RootBridge, PPB , P2C, go recursively to traverse all its children\r
   //\r
   //\r
   // For RootBridge, PPB , P2C, go recursively to traverse all its children\r
   //\r
@@ -1216,45 +1220,28 @@ Returns:
   UINTN                             BarIndex;\r
   UINTN                             BarEndIndex;\r
   BOOLEAN                           SetFlag;\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
   Configuration = NULL;\r
 \r
   VOID                              *Configuration;\r
   EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;\r
 \r
   Configuration = NULL;\r
 \r
-  //\r
-  // It can only be supported after the Incompatible PCI Device\r
-  // Support Protocol has been installed\r
-  //\r
-  if (gEfiIncompatiblePciDeviceSupport == NULL) {\r
-\r
-    Status = gBS->LocateProtocol (\r
-                    &gEfiIncompatiblePciDeviceSupportProtocolGuid,\r
-                    NULL,\r
-                    (VOID **) &gEfiIncompatiblePciDeviceSupport\r
-                    );\r
-    if (EFI_ERROR (Status)) {\r
-      return EFI_UNSUPPORTED;\r
-    }\r
-  }\r
-  \r
   //\r
   // Check whether the device belongs to incompatible devices or not\r
   // If it is , then get its special requirement in the ACPI table\r
   //\r
   //\r
   // Check whether the device belongs to incompatible devices or not\r
   // If it is , then get its special requirement in the ACPI table\r
   //\r
-  Status = gEfiIncompatiblePciDeviceSupport->CheckDevice (\r
-                                              gEfiIncompatiblePciDeviceSupport,\r
-                                              PciIoDevice->Pci.Hdr.VendorId,\r
-                                              PciIoDevice->Pci.Hdr.DeviceId,\r
-                                              PciIoDevice->Pci.Hdr.RevisionID,\r
-                                              PciIoDevice->Pci.Device.SubsystemVendorID,\r
-                                              PciIoDevice->Pci.Device.SubsystemID,\r
-                                              &Configuration\r
-                                              );\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
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
   //\r
   // Update PCI device information from the ACPI table\r
   //\r
   //\r
   // Update PCI device information from the ACPI table\r
   //\r
@@ -1289,7 +1276,7 @@ Returns:
       SetFlag = FALSE;\r
       switch (Ptr->ResType) {\r
       case ACPI_ADDRESS_SPACE_TYPE_MEM:\r
       SetFlag = FALSE;\r
       switch (Ptr->ResType) {\r
       case ACPI_ADDRESS_SPACE_TYPE_MEM:\r
-          \r
+\r
         //\r
         // Make sure the bar is memory type\r
         //\r
         //\r
         // Make sure the bar is memory type\r
         //\r
@@ -1299,7 +1286,7 @@ Returns:
         break;\r
 \r
       case ACPI_ADDRESS_SPACE_TYPE_IO:\r
         break;\r
 \r
       case ACPI_ADDRESS_SPACE_TYPE_IO:\r
-          \r
+\r
         //\r
         // Make sure the bar is IO type\r
         //\r
         //\r
         // Make sure the bar is IO type\r
         //\r
@@ -1310,7 +1297,7 @@ Returns:
       }\r
 \r
       if (SetFlag) {\r
       }\r
 \r
       if (SetFlag) {\r
-        \r
+\r
         //\r
         // Update the new alignment for the device\r
         //\r
         //\r
         // Update the new alignment for the device\r
         //\r
@@ -1367,9 +1354,9 @@ Returns:
   //\r
   // Check the validity of the parameter\r
   //\r
   //\r
   // Check the validity of the parameter\r
   //\r
-   if (NewAlignment != PCI_BAR_EVEN_ALIGN  && \r
+   if (NewAlignment != PCI_BAR_EVEN_ALIGN  &&\r
        NewAlignment != PCI_BAR_SQUAD_ALIGN &&\r
        NewAlignment != PCI_BAR_SQUAD_ALIGN &&\r
-       NewAlignment != PCI_BAR_DQUAD_ALIGN ) {         \r
+       NewAlignment != PCI_BAR_DQUAD_ALIGN ) {\r
     *Alignment = NewAlignment;\r
     return ;\r
   }\r
     *Alignment = NewAlignment;\r
     return ;\r
   }\r
@@ -1384,7 +1371,7 @@ Returns:
     OldAlignment = RShiftU64 (OldAlignment, 4);\r
     ShiftBit += 4;\r
   }\r
     OldAlignment = RShiftU64 (OldAlignment, 4);\r
     ShiftBit += 4;\r
   }\r
-   \r
+\r
   //\r
   // Adjust the alignment to even, quad or double quad boundary\r
   //\r
   //\r
   // Adjust the alignment to even, quad or double quad boundary\r
   //\r
@@ -1401,7 +1388,7 @@ Returns:
       OldAlignment = OldAlignment + 8 - (OldAlignment & 0x07);\r
     }\r
   }\r
       OldAlignment = OldAlignment + 8 - (OldAlignment & 0x07);\r
     }\r
   }\r
-   \r
+\r
   //\r
   // Update the old value\r
   //\r
   //\r
   // Update the old value\r
   //\r
@@ -1563,7 +1550,7 @@ Returns:
       for (Data = Value; Data != 0; Data >>= 1) {\r
        Index ++;\r
       }\r
       for (Data = Value; Data != 0; Data >>= 1) {\r
        Index ++;\r
       }\r
-      Value |= ((UINT32)(-1) << Index); \r
+      Value |= ((UINT32)(-1) << Index);\r
 \r
       //\r
       // Calculate the size of 64bit bar\r
 \r
       //\r
       // Calculate the size of 64bit bar\r
@@ -1587,7 +1574,7 @@ Returns:
       break;\r
     }\r
   }\r
       break;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Check the length again so as to keep compatible with some special bars\r
   //\r
   //\r
   // Check the length again so as to keep compatible with some special bars\r
   //\r
@@ -1596,7 +1583,7 @@ Returns:
     PciIoDevice->PciBar[BarIndex].BaseAddress = 0;\r
     PciIoDevice->PciBar[BarIndex].Alignment   = 0;\r
   }\r
     PciIoDevice->PciBar[BarIndex].BaseAddress = 0;\r
     PciIoDevice->PciBar[BarIndex].Alignment   = 0;\r
   }\r
-  \r
+\r
   //\r
   // Increment number of bar\r
   //\r
   //\r
   // Increment number of bar\r
   //\r
@@ -1610,7 +1597,7 @@ InitializePciDevice (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
\r
+\r
   This routine is used to initialize the bar of a PCI device\r
   It can be called typically when a device is going to be rejected\r
 \r
   This routine is used to initialize the bar of a PCI device\r
   It can be called typically when a device is going to be rejected\r
 \r
@@ -1635,7 +1622,7 @@ Returns:
   // has not been alloacted\r
   //\r
   for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {\r
   // has not been alloacted\r
   //\r
   for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {\r
-    PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllOne);\r
+    PciIoWrite (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllOne);\r
   }\r
 \r
   return EFI_SUCCESS;\r
   }\r
 \r
   return EFI_SUCCESS;\r
@@ -1668,28 +1655,28 @@ Returns:
   // Io32, pMem32, pMem64 to quiescent state\r
   // Resource base all ones, Resource limit all zeros\r
   //\r
   // Io32, pMem32, pMem64 to quiescent state\r
   // Resource base all ones, Resource limit all zeros\r
   //\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &gAllOne);\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x1D, 1, &gAllZero);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &gAllOne);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x1D, 1, &gAllZero);\r
 \r
 \r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0x20, 1, &gAllOne);\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0x22, 1, &gAllZero);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x20, 1, &gAllOne);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x22, 1, &gAllZero);\r
 \r
 \r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0x24, 1, &gAllOne);\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0x26, 1, &gAllZero);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x24, 1, &gAllOne);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x26, 1, &gAllZero);\r
 \r
 \r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x28, 1, &gAllOne);\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x2C, 1, &gAllZero);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x28, 1, &gAllOne);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x2C, 1, &gAllZero);\r
 \r
   //\r
   // don't support use io32 as for now\r
   //\r
 \r
   //\r
   // don't support use io32 as for now\r
   //\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0x30, 1, &gAllOne);\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0x32, 1, &gAllZero);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x30, 1, &gAllOne);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x32, 1, &gAllZero);\r
 \r
   //\r
   // Force Interrupt line to zero for cards that come up randomly\r
   //\r
 \r
   //\r
   // Force Interrupt line to zero for cards that come up randomly\r
   //\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -1721,22 +1708,22 @@ Returns:
   // Io32, pMem32, pMem64 to quiescent state(\r
   // Resource base all ones, Resource limit all zeros\r
   //\r
   // Io32, pMem32, pMem64 to quiescent state(\r
   // Resource base all ones, Resource limit all zeros\r
   //\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x1c, 1, &gAllOne);\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x20, 1, &gAllZero);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x1c, 1, &gAllOne);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x20, 1, &gAllZero);\r
 \r
 \r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x24, 1, &gAllOne);\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x28, 1, &gAllZero);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x24, 1, &gAllOne);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x28, 1, &gAllZero);\r
 \r
 \r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x2c, 1, &gAllOne);\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x30, 1, &gAllZero);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x2c, 1, &gAllOne);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x30, 1, &gAllZero);\r
 \r
 \r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x34, 1, &gAllOne);\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x38, 1, &gAllZero);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x34, 1, &gAllOne);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x38, 1, &gAllZero);\r
 \r
   //\r
   // Force Interrupt line to zero for cards that come up randomly\r
   //\r
 \r
   //\r
   // Force Interrupt line to zero for cards that come up randomly\r
   //\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);\r
+  PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);\r
   return EFI_SUCCESS;\r
 }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -1845,7 +1832,7 @@ PciEnumeratorLight (
 \r
 Routine Description:\r
 \r
 \r
 Routine Description:\r
 \r
-  This routine is used to enumerate entire pci bus system \r
+  This routine is used to enumerate entire pci bus system\r
   in a given platform\r
 \r
 Arguments:\r
   in a given platform\r
 \r
 Arguments:\r
@@ -1910,7 +1897,7 @@ Returns:
       Descriptors++;\r
       continue;\r
     }\r
       Descriptors++;\r
       continue;\r
     }\r
-    \r
+\r
     //\r
     // Record the root bridge io protocol\r
     //\r
     //\r
     // Record the root bridge io protocol\r
     //\r
@@ -1922,7 +1909,7 @@ Returns:
               );\r
 \r
     if (!EFI_ERROR (Status)) {\r
               );\r
 \r
     if (!EFI_ERROR (Status)) {\r
-      \r
+\r
       //\r
       // Remove those PCI devices which are rejected when full enumeration\r
       //\r
       //\r
       // Remove those PCI devices which are rejected when full enumeration\r
       //\r
@@ -1975,9 +1962,9 @@ Arguments:
   MinBus          - The min bus.\r
   MaxBus          - The max bus.\r
   BusRange        - The bus range.\r
   MinBus          - The min bus.\r
   MaxBus          - The max bus.\r
   BusRange        - The bus range.\r
-  \r
+\r
 Returns:\r
 Returns:\r
-  \r
+\r
   Status Code.\r
 \r
 --*/\r
   Status Code.\r
 \r
 --*/\r
@@ -2129,11 +2116,11 @@ Returns:
     }\r
 \r
     if (TestValue & 0x01) {\r
     }\r
 \r
     if (TestValue & 0x01) {\r
-      \r
+\r
       //\r
       // IO Bar\r
       //\r
       //\r
       // IO Bar\r
       //\r
-      \r
+\r
       Mask      = 0xFFFFFFFC;\r
       TestValue = TestValue & Mask;\r
       if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {\r
       Mask      = 0xFFFFFFFC;\r
       TestValue = TestValue & Mask;\r
       if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {\r
@@ -2141,26 +2128,26 @@ Returns:
       }\r
 \r
     } else {\r
       }\r
 \r
     } else {\r
-      \r
+\r
       //\r
       // Mem Bar\r
       //\r
       //\r
       // Mem Bar\r
       //\r
-      \r
+\r
       Mask      = 0xFFFFFFF0;\r
       TestValue = TestValue & Mask;\r
 \r
       if ((TestValue & 0x07) == 0x04) {\r
       Mask      = 0xFFFFFFF0;\r
       TestValue = TestValue & Mask;\r
 \r
       if ((TestValue & 0x07) == 0x04) {\r
-        \r
+\r
         //\r
         // Mem64 or PMem64\r
         //\r
         BarOffset += sizeof (UINT32);\r
         if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {\r
         //\r
         // Mem64 or PMem64\r
         //\r
         BarOffset += sizeof (UINT32);\r
         if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {\r
-          \r
+\r
           //\r
           // Test its high 32-Bit BAR\r
           //\r
           //\r
           // Test its high 32-Bit BAR\r
           //\r
-          \r
+\r
           Status = BarExisted (PciIoDevice, BarOffset, &TestValue, &OldValue);\r
           if (TestValue == OldValue) {\r
             return TRUE;\r
           Status = BarExisted (PciIoDevice, BarOffset, &TestValue, &OldValue);\r
           if (TestValue == OldValue) {\r
             return TRUE;\r
@@ -2168,7 +2155,7 @@ Returns:
         }\r
 \r
       } else {\r
         }\r
 \r
       } else {\r
-        \r
+\r
         //\r
         // Mem32 or PMem32\r
         //\r
         //\r
         // Mem32 or PMem32\r
         //\r
@@ -2207,7 +2194,7 @@ Returns:
   EFI_STATUS                      Status;\r
   PCI_TYPE00                      Pci;\r
   UINT8                           Device;\r
   EFI_STATUS                      Status;\r
   PCI_TYPE00                      Pci;\r
   UINT8                           Device;\r
-  UINT32                          Register;  \r
+  UINT32                          Register;\r
   UINT8                           Func;\r
   UINT64                          Address;\r
   EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;\r
   UINT8                           Func;\r
   UINT64                          Address;\r
   EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;\r
@@ -2231,9 +2218,10 @@ Returns:
       if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci))) {\r
         Register  = 0;\r
         Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);\r
       if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci))) {\r
         Register  = 0;\r
         Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);\r
-        Status   = PciRootBridgeIo->Pci.Read (\r
+        Status   = PciRootBridgeIoRead (\r
                                         PciRootBridgeIo,\r
                                         PciRootBridgeIo,\r
-                                        EfiPciWidthUint32, \r
+                                        &Pci,\r
+                                        EfiPciWidthUint32,\r
                                         Address,\r
                                         1,\r
                                         &Register\r
                                         Address,\r
                                         1,\r
                                         &Register\r
@@ -2242,9 +2230,10 @@ Returns:
         // Reset register 18h, 19h, 1Ah on PCI Bridge\r
         //\r
         Register &= 0xFF000000;\r
         // Reset register 18h, 19h, 1Ah on PCI Bridge\r
         //\r
         Register &= 0xFF000000;\r
-        Status = PciRootBridgeIo->Pci.Write (\r
+        Status = PciRootBridgeIoWrite (\r
                                         PciRootBridgeIo,\r
                                         PciRootBridgeIo,\r
-                                        EfiPciWidthUint32, \r
+                                        &Pci,\r
+                                        EfiPciWidthUint32,\r
                                         Address,\r
                                         1,\r
                                         &Register\r
                                         Address,\r
                                         1,\r
                                         &Register\r
index c9c46b3adfb9e5aaa5a2930c0bdccbb9a2eb7339..fb6f21fe9d02b34bd48289e09dd4b14503d4acf9 100644 (file)
@@ -1,22 +1,22 @@
 /*++\r
 \r
 /*++\r
 \r
-Copyright (c) 2006, 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
+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
 \r
 Module Name:\r
 \r
-  PciLib.c \r
-  \r
+  PciLib.c\r
+\r
 Abstract:\r
 \r
   PCI Bus Driver Lib file\r
 Abstract:\r
 \r
   PCI Bus Driver Lib file\r
-  It abstracts some functions that can be different \r
+  It abstracts some functions that can be different\r
   between light PCI bus driver and full PCI bus driver\r
 \r
 Revision History\r
   between light PCI bus driver and full PCI bus driver\r
 \r
 Revision History\r
@@ -175,7 +175,7 @@ Returns:
   if (!gFullEnumeration) {\r
 \r
     Address = 0;\r
   if (!gFullEnumeration) {\r
 \r
     Address = 0;\r
-    PciIoDevice->PciIo.Pci.Read (\r
+    PciIoRead (\r
                             &(PciIoDevice->PciIo),\r
                             EfiPciIoWidthUint32,\r
                             0x1c,\r
                             &(PciIoDevice->PciIo),\r
                             EfiPciIoWidthUint32,\r
                             0x1c,\r
@@ -188,7 +188,7 @@ Returns:
     (PciIoDevice->PciBar)[P2C_MEM_1].BarType      = PciBarTypeMem32;\r
 \r
     Address = 0;\r
     (PciIoDevice->PciBar)[P2C_MEM_1].BarType      = PciBarTypeMem32;\r
 \r
     Address = 0;\r
-    PciIoDevice->PciIo.Pci.Read (\r
+    PciIoRead (\r
                             &(PciIoDevice->PciIo),\r
                             EfiPciIoWidthUint32,\r
                             0x20,\r
                             &(PciIoDevice->PciIo),\r
                             EfiPciIoWidthUint32,\r
                             0x20,\r
@@ -200,7 +200,7 @@ Returns:
     (PciIoDevice->PciBar)[P2C_MEM_2].BarType      = PciBarTypePMem32;\r
 \r
     Address = 0;\r
     (PciIoDevice->PciBar)[P2C_MEM_2].BarType      = PciBarTypePMem32;\r
 \r
     Address = 0;\r
-    PciIoDevice->PciIo.Pci.Read (\r
+    PciIoRead (\r
                             &(PciIoDevice->PciIo),\r
                             EfiPciIoWidthUint32,\r
                             0x2c,\r
                             &(PciIoDevice->PciIo),\r
                             EfiPciIoWidthUint32,\r
                             0x2c,\r
@@ -212,7 +212,7 @@ Returns:
     (PciIoDevice->PciBar)[P2C_IO_1].BarType     = PciBarTypeIo16;\r
 \r
     Address = 0;\r
     (PciIoDevice->PciBar)[P2C_IO_1].BarType     = PciBarTypeIo16;\r
 \r
     Address = 0;\r
-    PciIoDevice->PciIo.Pci.Read (\r
+    PciIoRead (\r
                             &(PciIoDevice->PciIo),\r
                             EfiPciIoWidthUint32,\r
                             0x34,\r
                             &(PciIoDevice->PciIo),\r
                             EfiPciIoWidthUint32,\r
                             0x34,\r
@@ -276,19 +276,19 @@ Returns:
       // Skip rejection for all PPBs, while detect rejection for others\r
       //\r
       if (IsPciDeviceRejected (Temp)) {\r
       // Skip rejection for all PPBs, while detect rejection for others\r
       //\r
       if (IsPciDeviceRejected (Temp)) {\r
-                \r
+\r
         //\r
         // For P2C, remove all devices on it\r
         //\r
         //\r
         // For P2C, remove all devices on it\r
         //\r
-                \r
+\r
         if (!IsListEmpty (&Temp->ChildList)) {\r
           RemoveAllPciDeviceOnBridge (RootBridgeHandle, Temp);\r
         }\r
         if (!IsListEmpty (&Temp->ChildList)) {\r
           RemoveAllPciDeviceOnBridge (RootBridgeHandle, Temp);\r
         }\r
-        \r
+\r
         //\r
         // Finally remove itself\r
         //\r
         //\r
         // Finally remove itself\r
         //\r
-        \r
+\r
         LastLink = CurrentLink->BackLink;\r
         RemoveEntryList (CurrentLink);\r
         FreePciDevice (Temp);\r
         LastLink = CurrentLink->BackLink;\r
         RemoveEntryList (CurrentLink);\r
         FreePciDevice (Temp);\r
@@ -316,7 +316,7 @@ PciHostBridgeResourceAllocator (
     return PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (\r
              PciResAlloc\r
              );\r
     return PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (\r
              PciResAlloc\r
              );\r
-  }  \r
+  }\r
 }\r
 \r
 \r
 }\r
 \r
 \r
@@ -366,7 +366,7 @@ Returns:
   //\r
   // Initialize resource pool\r
   //\r
   //\r
   // Initialize resource pool\r
   //\r
-  \r
+\r
   InitializeResourcePool (&IoPool, PciBarTypeIo16);\r
   InitializeResourcePool (&Mem32Pool, PciBarTypeMem32);\r
   InitializeResourcePool (&PMem32Pool, PciBarTypePMem32);\r
   InitializeResourcePool (&IoPool, PciBarTypeIo16);\r
   InitializeResourcePool (&Mem32Pool, PciBarTypeMem32);\r
   InitializeResourcePool (&PMem32Pool, PciBarTypePMem32);\r
@@ -479,7 +479,7 @@ Returns:
         Mem32Bridge->Alignment = MaxOptionRomSize - 1;\r
       }\r
     }\r
         Mem32Bridge->Alignment = MaxOptionRomSize - 1;\r
       }\r
     }\r
-    \r
+\r
     //\r
     // Based on the all the resource tree, contruct ACPI resource node to\r
     // submit the resource aperture to pci host bridge protocol\r
     //\r
     // Based on the all the resource tree, contruct ACPI resource node to\r
     // submit the resource aperture to pci host bridge protocol\r
@@ -516,8 +516,8 @@ Returns:
     //\r
     // Free acpi resource node\r
     //\r
     //\r
     // Free acpi resource node\r
     //\r
-    if (AcpiConfig) {\r
-      gBS->FreePool (AcpiConfig);\r
+    if (AcpiConfig != NULL) {\r
+      FreePool (AcpiConfig);\r
     }\r
 \r
     if (EFI_ERROR (Status)) {\r
     }\r
 \r
     if (EFI_ERROR (Status)) {\r
@@ -575,7 +575,7 @@ Returns:
     if (RootBridgeDev == NULL) {\r
       return EFI_NOT_FOUND;\r
     }\r
     if (RootBridgeDev == NULL) {\r
       return EFI_NOT_FOUND;\r
     }\r
-    \r
+\r
     //\r
     // Get acpi resource node for all the resource types\r
     //\r
     //\r
     // Get acpi resource node for all the resource types\r
     //\r
@@ -671,7 +671,7 @@ Returns:
       );\r
 \r
     if (AcpiConfig != NULL) {\r
       );\r
 \r
     if (AcpiConfig != NULL) {\r
-      gBS->FreePool (AcpiConfig);\r
+      FreePool (AcpiConfig);\r
     }\r
   }\r
 \r
     }\r
   }\r
 \r
@@ -758,7 +758,7 @@ Returns:
 \r
     //\r
     // Initialize resource pool\r
 \r
     //\r
     // Initialize resource pool\r
-    //    \r
+    //\r
     InitializeResourcePool (&IoPool, PciBarTypeIo16);\r
     InitializeResourcePool (&Mem32Pool, PciBarTypeMem32);\r
     InitializeResourcePool (&PMem32Pool, PciBarTypePMem32);\r
     InitializeResourcePool (&IoPool, PciBarTypeIo16);\r
     InitializeResourcePool (&Mem32Pool, PciBarTypeMem32);\r
     InitializeResourcePool (&PMem32Pool, PciBarTypePMem32);\r
@@ -871,8 +871,8 @@ Returns:
             Mem32Bridge->Alignment = MaxOptionRomSize - 1;\r
           }\r
         }\r
             Mem32Bridge->Alignment = MaxOptionRomSize - 1;\r
           }\r
         }\r
-      }    \r
-      \r
+      }\r
+\r
       //\r
       // Based on the all the resource tree, contruct ACPI resource node to\r
       // submit the resource aperture to pci host bridge protocol\r
       //\r
       // Based on the all the resource tree, contruct ACPI resource node to\r
       // submit the resource aperture to pci host bridge protocol\r
@@ -911,7 +911,7 @@ Returns:
       // Free acpi resource node\r
       //\r
       if (AcpiConfig != NULL) {\r
       // Free acpi resource node\r
       //\r
       if (AcpiConfig != NULL) {\r
-        gBS->FreePool (AcpiConfig);\r
+        FreePool (AcpiConfig);\r
       }\r
 \r
       if (EFI_ERROR (Status)) {\r
       }\r
 \r
       if (EFI_ERROR (Status)) {\r
@@ -930,7 +930,7 @@ Returns:
     //\r
     // Notify pci bus driver starts to program the resource\r
     //\r
     //\r
     // Notify pci bus driver starts to program the resource\r
     //\r
-   \r
+\r
     Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeAllocateResources);\r
 \r
     if (!EFI_ERROR (Status)) {\r
     Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeAllocateResources);\r
 \r
     if (!EFI_ERROR (Status)) {\r
@@ -939,11 +939,11 @@ Returns:
       //\r
       break;\r
     }\r
       //\r
       break;\r
     }\r
-      \r
+\r
     //\r
     // If the resource allocation is unsuccessful, free resources on bridge\r
     //\r
     //\r
     // If the resource allocation is unsuccessful, free resources on bridge\r
     //\r
-            \r
+\r
     RootBridgeDev     = NULL;\r
     RootBridgeHandle  = 0;\r
 \r
     RootBridgeDev     = NULL;\r
     RootBridgeHandle  = 0;\r
 \r
@@ -961,7 +961,7 @@ Returns:
       if (RootBridgeDev == NULL) {\r
         return EFI_NOT_FOUND;\r
       }\r
       if (RootBridgeDev == NULL) {\r
         return EFI_NOT_FOUND;\r
       }\r
\r
+\r
       //\r
       // Get host bridge handle for status report\r
       //\r
       //\r
       // Get host bridge handle for status report\r
       //\r
@@ -994,7 +994,7 @@ Returns:
           &Mem64ResStatus,\r
           &PMem64ResStatus\r
           );\r
           &Mem64ResStatus,\r
           &PMem64ResStatus\r
           );\r
-        gBS->FreePool (AcpiConfig);\r
+        FreePool (AcpiConfig);\r
       }\r
     }\r
     //\r
       }\r
     }\r
     //\r
@@ -1081,7 +1081,7 @@ Returns:
     if (RootBridgeDev == NULL) {\r
       return EFI_NOT_FOUND;\r
     }\r
     if (RootBridgeDev == NULL) {\r
       return EFI_NOT_FOUND;\r
     }\r
-    \r
+\r
     //\r
     // Get acpi resource node for all the resource types\r
     //\r
     //\r
     // Get acpi resource node for all the resource types\r
     //\r
@@ -1209,16 +1209,16 @@ PciScanBus (
 {\r
   if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {\r
     return PciScanBus_WithHotPlugDeviceSupport (\r
 {\r
   if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {\r
     return PciScanBus_WithHotPlugDeviceSupport (\r
-      Bridge, \r
-      StartBusNumber, \r
-      SubBusNumber, \r
+      Bridge,\r
+      StartBusNumber,\r
+      SubBusNumber,\r
       PaddedBusRange\r
       );\r
   } else {\r
     return PciScanBus_WithoutHotPlugDeviceSupport (\r
       PaddedBusRange\r
       );\r
   } else {\r
     return PciScanBus_WithoutHotPlugDeviceSupport (\r
-      Bridge, \r
-      StartBusNumber, \r
-      SubBusNumber, \r
+      Bridge,\r
+      StartBusNumber,\r
+      SubBusNumber,\r
       PaddedBusRange\r
       );\r
   }\r
       PaddedBusRange\r
       );\r
   }\r
@@ -1282,7 +1282,7 @@ Returns:
                 Func\r
                 );\r
 \r
                 Func\r
                 );\r
 \r
-      if (!EFI_ERROR (Status)   && \r
+      if (!EFI_ERROR (Status)   &&\r
           (IS_PCI_BRIDGE (&Pci) ||\r
           IS_CARDBUS_BRIDGE (&Pci))) {\r
 \r
           (IS_PCI_BRIDGE (&Pci) ||\r
           IS_CARDBUS_BRIDGE (&Pci))) {\r
 \r
@@ -1310,8 +1310,9 @@ Returns:
 \r
         Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);\r
 \r
 \r
         Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);\r
 \r
-        Status = PciRootBridgeIo->Pci.Write (\r
+        Status = PciRootBridgeIoWrite (\r
                                         PciRootBridgeIo,\r
                                         PciRootBridgeIo,\r
+                                        &Pci,\r
                                         EfiPciWidthUint16,\r
                                         Address,\r
                                         1,\r
                                         EfiPciWidthUint16,\r
                                         Address,\r
                                         1,\r
@@ -1322,8 +1323,9 @@ Returns:
         // Initialize SubBusNumber to SecondBus\r
         //\r
         Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
         // Initialize SubBusNumber to SecondBus\r
         //\r
         Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
-        Status = PciRootBridgeIo->Pci.Write (\r
+        Status = PciRootBridgeIoWrite (\r
                                         PciRootBridgeIo,\r
                                         PciRootBridgeIo,\r
+                                        &Pci,\r
                                         EfiPciWidthUint8,\r
                                         Address,\r
                                         1,\r
                                         EfiPciWidthUint8,\r
                                         Address,\r
                                         1,\r
@@ -1339,8 +1341,9 @@ Returns:
           //\r
           Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
           Register  = 0xFF;\r
           //\r
           Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
           Register  = 0xFF;\r
-          Status = PciRootBridgeIo->Pci.Write (\r
+          Status = PciRootBridgeIoWrite (\r
                                           PciRootBridgeIo,\r
                                           PciRootBridgeIo,\r
+                                          &Pci,\r
                                           EfiPciWidthUint8,\r
                                           Address,\r
                                           1,\r
                                           EfiPciWidthUint8,\r
                                           Address,\r
                                           1,\r
@@ -1373,8 +1376,9 @@ Returns:
 \r
         Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
 \r
 \r
         Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
 \r
-        Status = PciRootBridgeIo->Pci.Write (\r
+        Status = PciRootBridgeIoWrite (\r
                                         PciRootBridgeIo,\r
                                         PciRootBridgeIo,\r
+                                        &Pci,\r
                                         EfiPciWidthUint8,\r
                                         Address,\r
                                         1,\r
                                         EfiPciWidthUint8,\r
                                         Address,\r
                                         1,\r
@@ -1476,7 +1480,7 @@ Returns:
 \r
         continue;\r
       }\r
 \r
         continue;\r
       }\r
-      \r
+\r
       //\r
       // Get the PCI device information\r
       //\r
       //\r
       // Get the PCI device information\r
       //\r
@@ -1507,7 +1511,7 @@ Returns:
             EfiPciBeforeChildBusEnumeration\r
             );\r
       }\r
             EfiPciBeforeChildBusEnumeration\r
             );\r
       }\r
-      \r
+\r
       //\r
       // For Pci Hotplug controller devcie only\r
       //\r
       //\r
       // For Pci Hotplug controller devcie only\r
       //\r
@@ -1530,14 +1534,14 @@ Returns:
                                         Event,\r
                                         &State\r
                                         );\r
                                         Event,\r
                                         &State\r
                                         );\r
-                                        \r
+\r
             PreprocessController (\r
               PciDevice,\r
               PciDevice->BusNumber,\r
               PciDevice->DeviceNumber,\r
               PciDevice->FunctionNumber,\r
               EfiPciBeforeChildBusEnumeration\r
             PreprocessController (\r
               PciDevice,\r
               PciDevice->BusNumber,\r
               PciDevice->DeviceNumber,\r
               PciDevice->FunctionNumber,\r
               EfiPciBeforeChildBusEnumeration\r
-            );                                        \r
+            );\r
             continue;\r
           }\r
         }\r
             continue;\r
           }\r
         }\r
@@ -1552,7 +1556,7 @@ Returns:
         if (gPciHotPlugInit != NULL) {\r
 \r
           if (IsRootPciHotPlugBus (PciDevice->DevicePath, &HpIndex)) {\r
         if (gPciHotPlugInit != NULL) {\r
 \r
           if (IsRootPciHotPlugBus (PciDevice->DevicePath, &HpIndex)) {\r
-          \r
+\r
             //\r
             // If it is initialized, get the padded bus range\r
             //\r
             //\r
             // If it is initialized, get the padded bus range\r
             //\r
@@ -1593,8 +1597,9 @@ Returns:
         Register  = (UINT16) ((SecondBus << 8) | (UINT16) StartBusNumber);\r
         Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);\r
 \r
         Register  = (UINT16) ((SecondBus << 8) | (UINT16) StartBusNumber);\r
         Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);\r
 \r
-        Status = PciRootBridgeIo->Pci.Write (\r
+        Status = PciRootBridgeIoWrite (\r
                                         PciRootBridgeIo,\r
                                         PciRootBridgeIo,\r
+                                        &Pci,\r
                                         EfiPciWidthUint16,\r
                                         Address,\r
                                         1,\r
                                         EfiPciWidthUint16,\r
                                         Address,\r
                                         1,\r
@@ -1606,14 +1611,15 @@ Returns:
         // If it is PPB, resursively search down this bridge\r
         //\r
         if (IS_PCI_BRIDGE (&Pci)) {\r
         // If it is PPB, resursively search down this bridge\r
         //\r
         if (IS_PCI_BRIDGE (&Pci)) {\r
-          \r
+\r
           //\r
           // Initialize SubBusNumber to Maximum bus number\r
           //\r
           Register  = 0xFF;\r
           Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
           //\r
           // Initialize SubBusNumber to Maximum bus number\r
           //\r
           Register  = 0xFF;\r
           Address   = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
-          Status = PciRootBridgeIo->Pci.Write (\r
+          Status = PciRootBridgeIoWrite (\r
                                           PciRootBridgeIo,\r
                                           PciRootBridgeIo,\r
+                                          &Pci,\r
                                           EfiPciWidthUint8,\r
                                           Address,\r
                                           1,\r
                                           EfiPciWidthUint8,\r
                                           Address,\r
                                           1,\r
@@ -1661,8 +1667,9 @@ Returns:
         //\r
         Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
 \r
         //\r
         Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);\r
 \r
-        Status = PciRootBridgeIo->Pci.Write (\r
+        Status = PciRootBridgeIoWrite (\r
                                         PciRootBridgeIo,\r
                                         PciRootBridgeIo,\r
+                                        &Pci,\r
                                         EfiPciWidthUint8,\r
                                         Address,\r
                                         1,\r
                                         EfiPciWidthUint8,\r
                                         Address,\r
                                         1,\r
@@ -1691,7 +1698,7 @@ PciRootBridgeP2CProcess (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
     Process Option Rom on this host bridge\r
 \r
 Arguments:\r
     Process Option Rom on this host bridge\r
 \r
 Arguments:\r
@@ -1719,7 +1726,7 @@ Returns:
     if (IS_CARDBUS_BRIDGE (&Temp->Pci)) {\r
 \r
       if (gPciHotPlugInit && Temp->Allocated) {\r
     if (IS_CARDBUS_BRIDGE (&Temp->Pci)) {\r
 \r
       if (gPciHotPlugInit && Temp->Allocated) {\r
-        \r
+\r
         //\r
         // Raise the EFI_IOB_PCI_HPC_INIT status code\r
         //\r
         //\r
         // Raise the EFI_IOB_PCI_HPC_INIT status code\r
         //\r
@@ -1769,7 +1776,7 @@ PciHostBridgeP2CProcess (
 /*++\r
 \r
 Routine Description:\r
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
 Arguments:\r
 \r
 Returns:\r
 Arguments:\r
 \r
 Returns:\r
@@ -1821,7 +1828,7 @@ PciHostBridgeEnumerator (
 \r
 Routine Description:\r
 \r
 \r
 Routine Description:\r
 \r
-  This function is used to enumerate the entire host bridge \r
+  This function is used to enumerate the entire host bridge\r
   in a given platform\r
 \r
 Arguments:\r
   in a given platform\r
 \r
 Arguments:\r
@@ -1887,12 +1894,12 @@ Returns:
 \r
   if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {\r
 \r
 \r
   if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {\r
 \r
-    //                                                            \r
+    //\r
     // Notify the bus allocation phase is finished for the first time\r
     // Notify the bus allocation phase is finished for the first time\r
-    //                                                            \r
+    //\r
     NotifyPhase (PciResAlloc, EfiPciHostBridgeEndBusAllocation);\r
     NotifyPhase (PciResAlloc, EfiPciHostBridgeEndBusAllocation);\r
-      \r
-                    \r
+\r
+\r
     if (gPciHotPlugInit != NULL) {\r
       //\r
       // Wait for all HPC initialized\r
     if (gPciHotPlugInit != NULL) {\r
       //\r
       // Wait for all HPC initialized\r
@@ -1907,7 +1914,7 @@ Returns:
       // Notify the bus allocation phase is about to start for the 2nd time\r
       //\r
       NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);\r
       // Notify the bus allocation phase is about to start for the 2nd time\r
       //\r
       NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);\r
-    \r
+\r
       RootBridgeHandle = NULL;\r
       while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {\r
 \r
       RootBridgeHandle = NULL;\r
       while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {\r
 \r
@@ -1935,7 +1942,7 @@ Returns:
           return Status;\r
         }\r
       }\r
           return Status;\r
         }\r
       }\r
-        \r
+\r
       //\r
       // Notify the bus allocation phase is to end\r
       //\r
       //\r
       // Notify the bus allocation phase is to end\r
       //\r
@@ -2018,3 +2025,873 @@ Returns:
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
   return EFI_SUCCESS;\r
 }\r
+\r
+/**\r
+  Read PCI device configuration register by specified address.\r
+\r
+  This function check the incompatiblilites on PCI device. Return the register\r
+  value.\r
+\r
+  @param  PciRootBridgeIo     A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  PciIo               A pointer to EFI_PCI_PROTOCOL.\r
+  @param  PciDeviceInfo       A pointer to EFI_PCI_DEVICE_INFO.\r
+  @param  Width               Signifies the width of the memory operations.\r
+  @Param  Address             The address within the PCI configuration space for the PCI controller.\r
+  @param  Buffer              For read operations, the destination buffer to store the results. For\r
+                              write operations, the source buffer to write data from.\r
+\r
+   @retval EFI_SUCCESS            The data was read from or written to the PCI root bridge.\r
+   @retval EFI_INVALID_PARAMETER  Width is invalid for this PCI root bridge.\r
+   @retval EFI_INVALID_PARAMETER  Buffer is NULL.\r
+   @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+\r
+**/\r
+STATIC\r
+EFI_STATUS\r
+ReadConfigData (\r
+  IN       EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL        *PciRootBridgeIo,  OPTIONAL\r
+  IN       EFI_PCI_IO_PROTOCOL                    *PciIo,            OPTIONAL\r
+  IN       EFI_PCI_DEVICE_INFO                    *PciDeviceInfo,\r
+  IN       UINT64                                 Width,\r
+  IN       UINT64                                 Address,\r
+  IN OUT   VOID                                   *Buffer\r
+  )\r
+{\r
+  EFI_STATUS                    Status;\r
+  UINT64                        AccessWidth;\r
+  EFI_PCI_REGISTER_ACCESS_DATA  *PciRegisterAccessData;\r
+  UINT64                        AccessAddress;\r
+  UINTN                         Stride;\r
+  UINT64                        TempBuffer;\r
+  UINT8                         *Pointer;\r
+\r
+  ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));\r
+\r
+  if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACCESS_WIDTH_SUPPORT) {\r
+    //\r
+    // check access compatibility at first time\r
+    //\r
+    Status = PciRegisterAccessCheck (PciDeviceInfo, PCI_REGISTER_READ, Address & 0xff, Width, &PciRegisterAccessData);\r
+\r
+    if (Status == EFI_SUCCESS) {\r
+      //\r
+      // there exist incompatibility on this operation\r
+      //\r
+      AccessWidth = Width;\r
+\r
+      if (PciRegisterAccessData->Width != VALUE_NOCARE) {\r
+        AccessWidth = PciRegisterAccessData->Width;\r
+      }\r
+\r
+      AccessAddress = Address & ~((1 << AccessWidth) - 1);\r
+\r
+      TempBuffer    = 0;\r
+      Stride        = 0;\r
+      Pointer       = (UINT8 *) &TempBuffer;\r
+\r
+      while (1) {\r
+\r
+        if (PciRootBridgeIo != NULL) {\r
+          Status = PciRootBridgeIo->Pci.Read (\r
+                         PciRootBridgeIo,\r
+                         (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) AccessWidth,\r
+                         AccessAddress,\r
+                         1,\r
+                         Pointer\r
+                         );\r
+        } else if (PciIo != NULL) {\r
+          Status = PciIo->Pci.Read (\r
+                         PciIo,\r
+                         (EFI_PCI_IO_PROTOCOL_WIDTH) AccessWidth,\r
+                         (UINT32) AccessAddress,\r
+                         1,\r
+                         Pointer\r
+                         );\r
+        }\r
+\r
+        if (Status != EFI_SUCCESS) {\r
+          return Status;\r
+        }\r
+\r
+        Stride = 1 << AccessWidth;\r
+        AccessAddress += Stride;\r
+        if (AccessAddress >= (Address + (1 << Width))) {\r
+          //\r
+          // if all datas have been read, exist\r
+          //\r
+          break;\r
+        }\r
+\r
+        Pointer += Stride;\r
+\r
+        if ((AccessAddress & 0xff) < PciRegisterAccessData->EndOffset) {\r
+          //\r
+          // if current offset doesn't reach the end\r
+          //\r
+          continue;\r
+        }\r
+\r
+        FreePool (PciRegisterAccessData);\r
+\r
+        //\r
+        // continue checking access incompatibility\r
+        //\r
+        Status = PciRegisterAccessCheck (PciDeviceInfo, PCI_REGISTER_READ, AccessAddress & 0xff, AccessWidth, &PciRegisterAccessData);\r
+        if (Status == EFI_SUCCESS) {\r
+          if (PciRegisterAccessData->Width != VALUE_NOCARE) {\r
+            AccessWidth = PciRegisterAccessData->Width;\r
+          }\r
+        }\r
+      }\r
+\r
+      FreePool (PciRegisterAccessData);\r
+\r
+      switch (Width) {\r
+      case EfiPciWidthUint8:\r
+        * (UINT8 *) Buffer = (UINT8) TempBuffer;\r
+        break;\r
+      case EfiPciWidthUint16:\r
+        * (UINT16 *) Buffer = (UINT16) TempBuffer;\r
+        break;\r
+      case EfiPciWidthUint32:\r
+        * (UINT32 *) Buffer = (UINT32) TempBuffer;\r
+        break;\r
+      default:\r
+        return EFI_UNSUPPORTED;\r
+      }\r
+\r
+      return Status;\r
+    }\r
+  }\r
+  //\r
+  // AccessWidth incompatible check not supportted\r
+  // or, there doesn't exist incompatibility on this operation\r
+  //\r
+  if (PciRootBridgeIo != NULL) {\r
+    Status = PciRootBridgeIo->Pci.Read (\r
+                     PciRootBridgeIo,\r
+                     (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r
+                     Address,\r
+                     1,\r
+                     Buffer\r
+                     );\r
+\r
+  } else {\r
+    Status = PciIo->Pci.Read (\r
+                     PciIo,\r
+                     (EFI_PCI_IO_PROTOCOL_WIDTH) Width,\r
+                     (UINT32) Address,\r
+                     1,\r
+                     Buffer\r
+                     );\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+/**\r
+  Update register value by checking PCI device incompatibility.\r
+\r
+  This function check register value incompatibilites on PCI device. Return the register\r
+  value.\r
+\r
+  @param  PciDeviceInfo       A pointer to EFI_PCI_DEVICE_INFO.\r
+  @param  AccessType          Access type, READ or WRITE.\r
+  @Param  Address             The address within the PCI configuration space.\r
+  @param  Buffer              Store the register data.\r
+\r
+  @retval EFI_SUCCESS         The data has been updated.\r
+\r
+**/\r
+STATIC\r
+EFI_STATUS\r
+UpdateConfigData (\r
+  IN       EFI_PCI_DEVICE_INFO                    *PciDeviceInfo,\r
+  IN       UINT64                                 AccessType,\r
+  IN       UINT64                                 Width,\r
+  IN       UINT64                                 Address,\r
+  IN OUT   VOID                                   *Buffer\r
+)\r
+{\r
+  EFI_STATUS                    Status;\r
+  EFI_PCI_REGISTER_VALUE_DATA   *PciRegisterData;\r
+  UINT64                        AndValue;\r
+  UINT64                        OrValue;\r
+  UINT32                        TempValue;\r
+\r
+  //\r
+  // check register value incompatibility\r
+  //\r
+  Status = PciRegisterUpdateCheck (PciDeviceInfo, AccessType, Address & 0xff, &PciRegisterData);\r
+\r
+  if (Status == EFI_SUCCESS) {\r
+\r
+    AndValue = (PciRegisterData->AndValue) >> ((Address & 0x3) * 8);\r
+    OrValue  = (PciRegisterData->OrValue)  >> ((Address & 0x3) * 8);\r
+\r
+    TempValue = * (UINT32 *) Buffer;\r
+\r
+    if (PciRegisterData->AndValue != VALUE_NOCARE) {\r
+      TempValue &= (UINT32) AndValue;\r
+    }\r
+    if (PciRegisterData->OrValue != VALUE_NOCARE) {\r
+      TempValue |= (UINT32) OrValue;\r
+    }\r
+\r
+    switch (Width) {\r
+    case EfiPciWidthUint8:\r
+      *(UINT32 *)Buffer = *(UINT32 *)Buffer & 0xffffff00 + (UINT8)TempValue;\r
+      break;\r
+\r
+    case EfiPciWidthUint16:\r
+      *(UINT32 *)Buffer = *(UINT32 *)Buffer & 0xffff0000 + (UINT16)TempValue;\r
+      break;\r
+    case EfiPciWidthUint32:\r
+      *(UINT32 *)Buffer = TempValue;\r
+      break;\r
+\r
+    default:\r
+      return EFI_UNSUPPORTED;\r
+    }\r
+\r
+    FreePool (PciRegisterData);\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+/**\r
+  Write PCI device configuration register by specified address.\r
+\r
+  This function check the incompatiblilites on PCI device, and write date\r
+  into register.\r
+\r
+  @param  PciRootBridgeIo     A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  PciIo               A pointer to EFI_PCI_PROTOCOL.\r
+  @param  PciDeviceInfo       A pointer to EFI_PCI_DEVICE_INFO.\r
+  @param  Width               Signifies the width of the memory operations.\r
+  @Param  Address             The address within the PCI configuration space for the PCI controller.\r
+  @param  Buffer              For read operations, the destination buffer to store the results. For\r
+                              write operations, the source buffer to write data from.\r
+\r
+   @retval EFI_SUCCESS            The data was read from or written to the PCI root bridge.\r
+   @retval EFI_INVALID_PARAMETER  Width is invalid for this PCI root bridge.\r
+   @retval EFI_INVALID_PARAMETER  Buffer is NULL.\r
+   @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+\r
+**/\r
+STATIC\r
+EFI_STATUS\r
+WriteConfigData (\r
+  IN       EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL        *PciRootBridgeIo,  OPTIONAL\r
+  IN       EFI_PCI_IO_PROTOCOL                    *PciIo,            OPTIONAL\r
+  IN       EFI_PCI_DEVICE_INFO                    *PciDeviceInfo,\r
+  IN       UINT64                                 Width,\r
+  IN       UINT64                                 Address,\r
+  IN       VOID                                   *Buffer\r
+  )\r
+{\r
+  EFI_STATUS                    Status;\r
+  UINT64                        AccessWidth;\r
+  EFI_PCI_REGISTER_ACCESS_DATA  *PciRegisterAccessData;\r
+  UINT64                        AccessAddress;\r
+  UINTN                         Stride;\r
+  UINT8                         *Pointer;\r
+  UINT64                        Data;\r
+  UINTN                         Shift;\r
+\r
+  ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));\r
+\r
+  if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACCESS_WIDTH_SUPPORT) {\r
+    //\r
+    // check access compatibility at first time\r
+    //\r
+    Status = PciRegisterAccessCheck (PciDeviceInfo, PCI_REGISTER_WRITE, Address & 0xff, Width, &PciRegisterAccessData);\r
+\r
+    if (Status == EFI_SUCCESS) {\r
+      //\r
+      // there exist incompatibility on this operation\r
+      //\r
+      AccessWidth = Width;\r
+\r
+      if (PciRegisterAccessData->Width != VALUE_NOCARE) {\r
+        AccessWidth = PciRegisterAccessData->Width;\r
+      }\r
+\r
+      AccessAddress = Address & ~((1 << AccessWidth) - 1);\r
+\r
+      Stride        = 0;\r
+      Pointer       = (UINT8 *) &Buffer;\r
+      Data          = * (UINT64 *) Buffer;\r
+\r
+      while (1) {\r
+\r
+        if (AccessWidth > Width) {\r
+          //\r
+          // if actual access width is larger than orignal one, additional data need to be read back firstly\r
+          //\r
+          Status = ReadConfigData (PciRootBridgeIo, PciIo, PciDeviceInfo, AccessWidth, AccessAddress, &Data);\r
+          if (Status != EFI_SUCCESS) {\r
+            return Status;\r
+          }\r
+\r
+          //\r
+          // check data read incompatibility\r
+          //\r
+          UpdateConfigData (PciDeviceInfo, PCI_REGISTER_READ, AccessWidth, AccessAddress & 0xff, &Data);\r
+\r
+          Shift = (Address - AccessAddress) * 8;\r
+          switch (Width) {\r
+          case EfiPciWidthUint8:\r
+            Data = (* (UINT8 *) Buffer) << Shift | (Data & ~(0xff << Shift));\r
+            break;\r
+\r
+          case EfiPciWidthUint16:\r
+            Data = (* (UINT16 *) Buffer) << Shift | (Data & ~(0xffff << Shift));\r
+            break;\r
+          }\r
+\r
+          //\r
+          // check data write incompatibility\r
+          //\r
+          UpdateConfigData (PciDeviceInfo, PCI_REGISTER_WRITE, AccessWidth, AccessAddress * 0xff, &Data);\r
+        }\r
+\r
+        if (PciRootBridgeIo != NULL) {\r
+          Status = PciRootBridgeIo->Pci.Write (\r
+                         PciRootBridgeIo,\r
+                         (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) AccessWidth,\r
+                         AccessAddress,\r
+                         1,\r
+                         &Data\r
+                         );\r
+        } else {\r
+          Status = PciIo->Pci.Write (\r
+                         PciIo,\r
+                         (EFI_PCI_IO_PROTOCOL_WIDTH) AccessWidth,\r
+                         (UINT32) AccessAddress,\r
+                         1,\r
+                         &Data\r
+                         );\r
+        }\r
+\r
+        if (Status != EFI_SUCCESS) {\r
+          return Status;\r
+        }\r
+\r
+        Data = Data >> ((1 << AccessWidth) * 8);\r
+\r
+        Stride = 1 << AccessWidth;\r
+        AccessAddress += Stride;\r
+        if (AccessAddress >= (Address + (1 << Width))) {\r
+          //\r
+          // if all datas have been written, exist\r
+          //\r
+          break;\r
+        }\r
+\r
+        Pointer += Stride;\r
+\r
+        if ((AccessAddress & 0xff) < PciRegisterAccessData->EndOffset) {\r
+          //\r
+          // if current offset doesn't reach the end\r
+          //\r
+          continue;\r
+        }\r
+\r
+        FreePool (PciRegisterAccessData);\r
+\r
+        //\r
+        // continue checking access incompatibility\r
+        //\r
+        Status = PciRegisterAccessCheck (PciDeviceInfo, PCI_REGISTER_WRITE, AccessAddress & 0xff, AccessWidth, &PciRegisterAccessData);\r
+        if (Status == EFI_SUCCESS) {\r
+          if (PciRegisterAccessData->Width != VALUE_NOCARE) {\r
+            AccessWidth = PciRegisterAccessData->Width;\r
+          }\r
+        }\r
+      };\r
+\r
+      FreePool (PciRegisterAccessData);\r
+\r
+      return Status;\r
+    }\r
+\r
+  }\r
+  //\r
+  // AccessWidth incompatible check not supportted\r
+  // or, there doesn't exist incompatibility on this operation\r
+  //\r
+  if (PciRootBridgeIo != NULL) {\r
+    Status = PciRootBridgeIo->Pci.Write (\r
+                     PciRootBridgeIo,\r
+                     (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r
+                     Address,\r
+                     1,\r
+                     Buffer\r
+                     );\r
+  } else {\r
+    Status = PciIo->Pci.Write (\r
+                   PciIo,\r
+                   (EFI_PCI_IO_PROTOCOL_WIDTH) Width,\r
+                   (UINT32) Address,\r
+                   1,\r
+                   Buffer\r
+                   );\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+/**\r
+  Abstract PCI device device information.\r
+\r
+  @param  PciRootBridgeIo     A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  PciIo               A pointer to EFI_PCI_PROTOCOL.\r
+  @param  Pci                 A pointer to PCI_TYPE00.\r
+  @Param  Address             The address within the PCI configuration space for the PCI controller.\r
+  @param  PciDeviceInfo       A pointer to EFI_PCI_DEVICE_INFO.\r
+\r
+  @retval EFI_SUCCESS         Pci device device information has been abstracted.\r
+\r
+**/\r
+STATIC\r
+EFI_STATUS\r
+GetPciDeviceDeviceInfo (\r
+  IN       EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL        *PciRootBridgeIo,  OPTIONAL\r
+  IN       EFI_PCI_IO_PROTOCOL                    *PciIo,            OPTIONAL\r
+  IN       PCI_TYPE00                             *Pci,              OPTIONAL\r
+  IN       UINT64                                 Address,           OPTIONAL\r
+  OUT      EFI_PCI_DEVICE_INFO                    *PciDeviceInfo\r
+)\r
+{\r
+  EFI_STATUS                    Status;\r
+  UINT64                        PciAddress;\r
+  UINT32                        PciConfigData;\r
+  PCI_IO_DEVICE                 *PciIoDevice;\r
+\r
+  ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));\r
+\r
+  if (PciIo != NULL) {\r
+    PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (PciIo);\r
+\r
+    //\r
+    // get pointer to PCI_TYPE00 from PciIoDevice\r
+    //\r
+    Pci = &PciIoDevice->Pci;\r
+  }\r
+\r
+  if (Pci == NULL) {\r
+    //\r
+    // while PCI_TYPE00 hasn't been gotten, read PCI device device information directly\r
+    //\r
+    PciAddress = Address & 0xffffffffffffff00ULL;\r
+    Status = PciRootBridgeIo->Pci.Read (\r
+                                    PciRootBridgeIo,\r
+                                    EfiPciWidthUint32,\r
+                                    PciAddress,\r
+                                    1,\r
+                                    &PciConfigData\r
+                                    );\r
+\r
+    if (EFI_ERROR (Status)) {\r
+      return Status;\r
+    }\r
+\r
+    if ((PciConfigData & 0xffff) == 0xffff) {\r
+      return EFI_NOT_FOUND;\r
+    }\r
+\r
+    PciDeviceInfo->VendorID = PciConfigData & 0xffff;\r
+    PciDeviceInfo->DeviceID = PciConfigData >> 16;\r
+\r
+    Status = PciRootBridgeIo->Pci.Read (\r
+                                    PciRootBridgeIo,\r
+                                    EfiPciWidthUint32,\r
+                                    PciAddress + 8,\r
+                                    1,\r
+                                    &PciConfigData\r
+                                    );\r
+    if (EFI_ERROR (Status)) {\r
+      return Status;\r
+    }\r
+\r
+    PciDeviceInfo->RevisionID = PciConfigData & 0xf;\r
+\r
+    Status = PciRootBridgeIo->Pci.Read (\r
+                                    PciRootBridgeIo,\r
+                                    EfiPciWidthUint32,\r
+                                    PciAddress + 0x2c,\r
+                                    1,\r
+                                    &PciConfigData\r
+                                    );\r
+\r
+    if (EFI_ERROR (Status)) {\r
+      return Status;\r
+    }\r
+\r
+    PciDeviceInfo->SubsystemVendorID = PciConfigData & 0xffff;\r
+    PciDeviceInfo->SubsystemID = PciConfigData >> 16;\r
+\r
+  } else {\r
+    PciDeviceInfo->VendorID          = Pci->Hdr.VendorId;\r
+    PciDeviceInfo->DeviceID          = Pci->Hdr.DeviceId;\r
+    PciDeviceInfo->RevisionID        = Pci->Hdr.RevisionID;\r
+    PciDeviceInfo->SubsystemVendorID = Pci->Device.SubsystemVendorID;\r
+    PciDeviceInfo->SubsystemID       = Pci->Device.SubsystemID;\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Read PCI configuration space with incompatibility check.\r
+\r
+  @param  PciRootBridgeIo     A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  PciIo               A pointer to the EFI_PCI_IO_PROTOCOL.\r
+  @param  Pci                 A pointer to PCI_TYPE00.\r
+  @param  Width               Signifies the width of the memory operations.\r
+  @Param  Address             The address within the PCI configuration space for the PCI controller.\r
+  @param  Buffer              For read operations, the destination buffer to store the results. For\r
+                              write operations, the source buffer to write data from.\r
+\r
+  @retval EFI_SUCCESS            The data was read from or written to the PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Width is invalid for this PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Buffer is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+\r
+**/\r
+STATIC\r
+EFI_STATUS\r
+PciIncompatibilityCheckRead (\r
+  IN       EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL        *PciRootBridgeIo,   OPTIONAL\r
+  IN       EFI_PCI_IO_PROTOCOL                    *PciIo,             OPTIONAL\r
+  IN       PCI_TYPE00                             *Pci,               OPTIONAL\r
+  IN       UINTN                                  Width,\r
+  IN       UINT64                                 Address,\r
+  IN       UINTN                                  Count,\r
+  IN OUT   VOID                                   *Buffer\r
+)\r
+{\r
+  EFI_STATUS                    Status;\r
+  EFI_PCI_DEVICE_INFO           PciDeviceInfo;\r
+  UINT32                        Stride;\r
+\r
+  ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));\r
+\r
+  //\r
+  // get PCI device device information\r
+  //\r
+  Status = GetPciDeviceDeviceInfo (PciRootBridgeIo, PciIo, Pci, Address, &PciDeviceInfo);\r
+  if (Status != EFI_SUCCESS) {\r
+    return Status;\r
+  }\r
+\r
+  Stride = 1 << Width;\r
+\r
+  for (; Count > 0; Count--, Address += Stride, Buffer = (UINT8 *)Buffer + Stride) {\r
+\r
+    //\r
+    // read configuration register\r
+    //\r
+    Status = ReadConfigData (PciRootBridgeIo, PciIo, &PciDeviceInfo, (UINT64) Width, Address, Buffer);\r
+\r
+    if (Status != EFI_SUCCESS) {\r
+      return Status;\r
+    }\r
+\r
+    //\r
+    // update the data read from configuration register\r
+    //\r
+    if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_REGISTER_UPDATE_SUPPORT) {\r
+      UpdateConfigData (&PciDeviceInfo, PCI_REGISTER_READ, Width, Address & 0xff, Buffer);\r
+    }\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Write PCI configuration space with incompatibility check.\r
+\r
+  @param  PciRootBridgeIo     A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  PciIo               A pointer to the EFI_PCI_IO_PROTOCOL.\r
+  @param  Pci                 A pointer to PCI_TYPE00.\r
+  @param  Width               Signifies the width of the memory operations.\r
+  @Param  Address             The address within the PCI configuration space for the PCI controller.\r
+  @param  Buffer              For read operations, the destination buffer to store the results. For\r
+                              write operations, the source buffer to write data from.\r
+\r
+  @retval EFI_SUCCESS            The data was read from or written to the PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Width is invalid for this PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Buffer is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+\r
+**/\r
+STATIC\r
+EFI_STATUS\r
+PciIncompatibilityCheckWrite (\r
+  IN       EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL        *PciRootBridgeIo,   OPTIONAL\r
+  IN       EFI_PCI_IO_PROTOCOL                    *PciIo,             OPTIONAL\r
+  IN       PCI_TYPE00                             *Pci,               OPTIONAL\r
+  IN       UINTN                                  Width,\r
+  IN       UINT64                                 Address,\r
+  IN       UINTN                                  Count,\r
+  IN OUT   VOID                                   *Buffer\r
+)\r
+{\r
+  EFI_STATUS                    Status;\r
+  EFI_PCI_DEVICE_INFO           PciDeviceInfo;\r
+  UINT32                        Stride;\r
+  UINT64                        Data;\r
+\r
+  ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));\r
+\r
+  //\r
+  // get PCI device device information\r
+  //\r
+  Status = GetPciDeviceDeviceInfo (PciRootBridgeIo, PciIo, Pci, Address, &PciDeviceInfo);\r
+  if (Status != EFI_SUCCESS) {\r
+    return Status;\r
+  }\r
+\r
+  Stride = 1 << Width;\r
+\r
+  for (; Count > 0; Count--, Address += Stride, Buffer = (UINT8 *) Buffer + Stride) {\r
+\r
+    Data = 0;\r
+\r
+    switch (Width) {\r
+    case EfiPciWidthUint8:\r
+      Data = * (UINT8 *) Buffer;\r
+      break;\r
+    case EfiPciWidthUint16:\r
+      Data = * (UINT16 *) Buffer;\r
+      break;\r
+\r
+    case EfiPciWidthUint32:\r
+      Data = * (UINT32 *) Buffer;\r
+      break;\r
+\r
+    default:\r
+      return EFI_UNSUPPORTED;\r
+    }\r
+\r
+    //\r
+    // update the data writen into configuration register\r
+    //\r
+    if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_REGISTER_UPDATE_SUPPORT) {\r
+      UpdateConfigData (&PciDeviceInfo, PCI_REGISTER_WRITE, Width, Address & 0xff, &Data);\r
+    }\r
+\r
+    //\r
+    // write configuration register\r
+    //\r
+    Status = WriteConfigData (PciRootBridgeIo, PciIo, &PciDeviceInfo, Width, Address, &Data);\r
+\r
+    if (Status != EFI_SUCCESS) {\r
+      return Status;\r
+    }\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Read PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+\r
+  @param  PciRootBridgeIo     A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  Pci                 A pointer to PCI_TYPE00.\r
+  @param  Width               Signifies the width of the memory operations.\r
+  @Param  Address             The address within the PCI configuration space for the PCI controller.\r
+  @param  Buffer              For read operations, the destination buffer to store the results. For\r
+                              write operations, the source buffer to write data from.\r
+\r
+  @retval EFI_SUCCESS            The data was read from or written to the PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Width is invalid for this PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Buffer is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+\r
+**/\r
+EFI_STATUS\r
+PciRootBridgeIoRead (\r
+  IN       EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL        *PciRootBridgeIo,\r
+  IN       PCI_TYPE00                             *Pci,            OPTIONAL\r
+  IN       EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,\r
+  IN       UINT64                                 Address,\r
+  IN       UINTN                                  Count,\r
+  IN OUT   VOID                                   *Buffer\r
+  )\r
+{\r
+  if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_READ_SUPPORT) {\r
+    //\r
+    // if PCI incompatibility check enabled\r
+    //\r
+    return PciIncompatibilityCheckRead (\r
+                   PciRootBridgeIo,\r
+                   NULL,\r
+                   Pci,\r
+                   (UINTN) Width,\r
+                   Address,\r
+                   Count,\r
+                   Buffer\r
+                   );\r
+  } else {\r
+    return PciRootBridgeIo->Pci.Read (\r
+                   PciRootBridgeIo,\r
+                   Width,\r
+                   Address,\r
+                   Count,\r
+                   Buffer\r
+                   );\r
+  }\r
+}\r
+\r
+/**\r
+  Write PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+\r
+  @param  PciRootBridgeIo     A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  Pci                 A pointer to PCI_TYPE00.\r
+  @param  Width               Signifies the width of the memory operations.\r
+  @Param  Address             The address within the PCI configuration space for the PCI controller.\r
+  @param  Buffer              For read operations, the destination buffer to store the results. For\r
+                              write operations, the source buffer to write data from.\r
+\r
+  @retval EFI_SUCCESS            The data was read from or written to the PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Width is invalid for this PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Buffer is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+\r
+**/\r
+EFI_STATUS\r
+PciRootBridgeIoWrite (\r
+  IN       EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL        *PciRootBridgeIo,\r
+  IN       PCI_TYPE00                             *Pci,\r
+  IN       EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,\r
+  IN       UINT64                                 Address,\r
+  IN       UINTN                                  Count,\r
+  IN OUT   VOID                                   *Buffer\r
+  )\r
+{\r
+  if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_WRITE_SUPPORT) {\r
+    //\r
+    // if PCI incompatibility check enabled\r
+    //\r
+    return  PciIncompatibilityCheckWrite (\r
+                   PciRootBridgeIo,\r
+                   NULL,\r
+                   Pci,\r
+                   Width,\r
+                   Address,\r
+                   Count,\r
+                   Buffer\r
+                   );\r
+\r
+  } else {\r
+    return  PciRootBridgeIo->Pci.Write (\r
+                   PciRootBridgeIo,\r
+                   Width,\r
+                   Address,\r
+                   Count,\r
+                   Buffer\r
+                   );\r
+  }\r
+}\r
+\r
+/**\r
+  Read PCI configuration space through EFI_PCI_IO_PROTOCOL.\r
+\r
+  @param  PciIo               A pointer to the EFI_PCI_O_PROTOCOL.\r
+  @param  Width               Signifies the width of the memory operations.\r
+  @Param  Address             The address within the PCI configuration space for the PCI controller.\r
+  @param  Buffer              For read operations, the destination buffer to store the results. For\r
+                              write operations, the source buffer to write data from.\r
+\r
+  @retval EFI_SUCCESS            The data was read from or written to the PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Width is invalid for this PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Buffer is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+\r
+**/\r
+EFI_STATUS\r
+PciIoRead (\r
+  IN       EFI_PCI_IO_PROTOCOL                    *PciIo,\r
+  IN       EFI_PCI_IO_PROTOCOL_WIDTH              Width,\r
+  IN       UINT32                                 Address,\r
+  IN       UINTN                                  Count,\r
+  IN OUT   VOID                                   *Buffer\r
+  )\r
+{\r
+  if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_READ_SUPPORT) {\r
+    //\r
+    // if PCI incompatibility check enabled\r
+    //\r
+    return PciIncompatibilityCheckRead (\r
+                   NULL,\r
+                   PciIo,\r
+                   NULL,\r
+                   (UINTN) Width,\r
+                   Address,\r
+                   Count,\r
+                   Buffer\r
+                   );\r
+  } else {\r
+    return PciIo->Pci.Read (\r
+                   PciIo,\r
+                   Width,\r
+                   Address,\r
+                   Count,\r
+                   Buffer\r
+                   );\r
+  }\r
+}\r
+\r
+/**\r
+  Write PCI configuration space through EFI_PCI_IO_PROTOCOL.\r
+\r
+  @param  PciIo               A pointer to the EFI_PCI_O_PROTOCOL.\r
+  @param  Width               Signifies the width of the memory operations.\r
+  @Param  Address             The address within the PCI configuration space for the PCI controller.\r
+  @param  Buffer              For read operations, the destination buffer to store the results. For\r
+                              write operations, the source buffer to write data from.\r
+\r
+  @retval EFI_SUCCESS            The data was read from or written to the PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Width is invalid for this PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Buffer is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+\r
+**/\r
+EFI_STATUS\r
+PciIoWrite (\r
+  IN       EFI_PCI_IO_PROTOCOL                    *PciIo,\r
+  IN       EFI_PCI_IO_PROTOCOL_WIDTH              Width,\r
+  IN       UINT32                                 Address,\r
+  IN       UINTN                                  Count,\r
+  IN OUT   VOID                                   *Buffer\r
+  )\r
+{\r
+  if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_WRITE_SUPPORT) {\r
+\r
+    //\r
+    // if PCI incompatibility check enabled\r
+    //\r
+    return  PciIncompatibilityCheckWrite (\r
+                   NULL,\r
+                   PciIo,\r
+                   NULL,\r
+                   Width,\r
+                   Address,\r
+                   Count,\r
+                   Buffer\r
+                   );\r
+\r
+  } else {\r
+    return PciIo->Pci.Write (\r
+                   PciIo,\r
+                   Width,\r
+                   Address,\r
+                   Count,\r
+                   Buffer\r
+                   );\r
+  }\r
+}\r
index f8e88375d7a50a64c9d555de3d02c94823aebfae..17e3587cb03290c2424fa47d92ee65096d596974 100644 (file)
@@ -1,18 +1,18 @@
 /*++\r
 \r
 /*++\r
 \r
-Copyright (c) 2006, 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
+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
   PciLib.h\r
 \r
 Module Name:\r
 \r
   PciLib.h\r
-  \r
+\r
 Abstract:\r
 \r
   PCI Bus Driver Lib header file.\r
 Abstract:\r
 \r
   PCI Bus Driver Lib header file.\r
@@ -26,6 +26,15 @@ Revision History
 #ifndef _EFI_PCI_LIB_H\r
 #define _EFI_PCI_LIB_H\r
 \r
 #ifndef _EFI_PCI_LIB_H\r
 #define _EFI_PCI_LIB_H\r
 \r
+//\r
+// Mask definistions for PCD PcdPciIncompatibleDeviceSupportMask\r
+//\r
+#define PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT         0x01\r
+#define PCI_INCOMPATIBLE_READ_SUPPORT                  0x02\r
+#define PCI_INCOMPATIBLE_WRITE_SUPPORT                 0x04\r
+#define PCI_INCOMPATIBLE_REGISTER_UPDATE_SUPPORT       0x08\r
+#define PCI_INCOMPATIBLE_ACCESS_WIDTH_SUPPORT          0x0a\r
+\r
 VOID\r
 InstallHotPlugRequestProtocol (\r
   IN  EFI_STATUS                    *Status\r
 VOID\r
 InstallHotPlugRequestProtocol (\r
   IN  EFI_STATUS                    *Status\r
@@ -274,4 +283,103 @@ Returns:
 --*/\r
 ;\r
 \r
 --*/\r
 ;\r
 \r
+/**\r
+  Read PCI configuration space through EFI_PCI_IO_PROTOCOL.\r
+\r
+  @param  PciIo               A pointer to the EFI_PCI_O_PROTOCOL.\r
+  @param  Width               Signifies the width of the memory operations.\r
+  @Param  Address             The address within the PCI configuration space for the PCI controller.\r
+  @param  Buffer              For read operations, the destination buffer to store the results. For\r
+                              write operations, the source buffer to write data from.\r
+\r
+  @retval EFI_SUCCESS            The data was read from or written to the PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Width is invalid for this PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Buffer is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+\r
+**/\r
+EFI_STATUS\r
+PciIoRead (\r
+  IN       EFI_PCI_IO_PROTOCOL                    *PciIo,\r
+  IN       EFI_PCI_IO_PROTOCOL_WIDTH              Width,\r
+  IN       UINT32                                 Address,\r
+  IN       UINTN                                  Count,\r
+  IN OUT   VOID                                   *Buffer\r
+  );\r
+\r
+/**\r
+  Write PCI configuration space through EFI_PCI_IO_PROTOCOL.\r
+\r
+  @param  PciIo               A pointer to the EFI_PCI_O_PROTOCOL.\r
+  @param  Width               Signifies the width of the memory operations.\r
+  @Param  Address             The address within the PCI configuration space for the PCI controller.\r
+  @param  Buffer              For read operations, the destination buffer to store the results. For\r
+                              write operations, the source buffer to write data from.\r
+\r
+  @retval EFI_SUCCESS            The data was read from or written to the PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Width is invalid for this PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Buffer is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+\r
+**/\r
+EFI_STATUS\r
+PciIoWrite (\r
+  IN       EFI_PCI_IO_PROTOCOL                    *PciIo,\r
+  IN       EFI_PCI_IO_PROTOCOL_WIDTH              Width,\r
+  IN       UINT32                                 Address,\r
+  IN       UINTN                                  Count,\r
+  IN OUT   VOID                                   *Buffer\r
+  );\r
+\r
+/**\r
+  Write PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+\r
+  @param  PciRootBridgeIo     A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  Pci                 A pointer to PCI_TYPE00.\r
+  @param  Width               Signifies the width of the memory operations.\r
+  @Param  Address             The address within the PCI configuration space for the PCI controller.\r
+  @param  Buffer              For read operations, the destination buffer to store the results. For\r
+                              write operations, the source buffer to write data from.\r
+\r
+  @retval EFI_SUCCESS            The data was read from or written to the PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Width is invalid for this PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Buffer is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+\r
+**/\r
+EFI_STATUS\r
+PciRootBridgeIoWrite (\r
+  IN       EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL        *PciRootBridgeIo,\r
+  IN       PCI_TYPE00                             *Pci,\r
+  IN       EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,\r
+  IN       UINT64                                 Address,\r
+  IN       UINTN                                  Count,\r
+  IN OUT   VOID                                   *Buffer\r
+  );\r
+\r
+/**\r
+  Read PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+\r
+  @param  PciRootBridgeIo     A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  Pci                 A pointer to PCI_TYPE00.\r
+  @param  Width               Signifies the width of the memory operations.\r
+  @Param  Address             The address within the PCI configuration space for the PCI controller.\r
+  @param  Buffer              For read operations, the destination buffer to store the results. For\r
+                              write operations, the source buffer to write data from.\r
+\r
+  @retval EFI_SUCCESS            The data was read from or written to the PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Width is invalid for this PCI root bridge.\r
+  @retval EFI_INVALID_PARAMETER  Buffer is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+\r
+**/\r
+EFI_STATUS\r
+PciRootBridgeIoRead (\r
+  IN       EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL        *PciRootBridgeIo,\r
+  IN       PCI_TYPE00                             *Pci,\r
+  IN       EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,\r
+  IN       UINT64                                 Address,\r
+  IN       UINTN                                  Count,\r
+  IN OUT   VOID                                   *Buffer\r
+  );\r
 #endif\r
 #endif\r
index 2ced4acb0b9ed36577015f665f4aa36d7d56785d..f6b371f8a508532dc4afa63531ecc196eb2ed2da 100644 (file)
@@ -1,18 +1,18 @@
 /*++\r
 \r
 /*++\r
 \r
-Copyright (c) 2006, 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
+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
   PciOptionRomSupport.c\r
 \r
 Module Name:\r
 \r
   PciOptionRomSupport.c\r
-  \r
+\r
 Abstract:\r
 \r
   PCI Bus Driver\r
 Abstract:\r
 \r
   PCI Bus Driver\r
@@ -88,8 +88,9 @@ Returns:
   AllOnes = 0xfffffffe;\r
   Address = EFI_PCI_ADDRESS (Bus, Device, Function, RomBarIndex);\r
 \r
   AllOnes = 0xfffffffe;\r
   Address = EFI_PCI_ADDRESS (Bus, Device, Function, RomBarIndex);\r
 \r
-  Status = PciRootBridgeIo->Pci.Write (\r
+  Status = PciRootBridgeIoWrite (\r
                                   PciRootBridgeIo,\r
                                   PciRootBridgeIo,\r
+                                  &PciIoDevice->Pci,\r
                                   EfiPciWidthUint32,\r
                                   Address,\r
                                   1,\r
                                   EfiPciWidthUint32,\r
                                   Address,\r
                                   1,\r
@@ -98,12 +99,13 @@ Returns:
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
   //\r
   // read back\r
   //\r
   //\r
   // read back\r
   //\r
-  Status = PciRootBridgeIo->Pci.Read (\r
+  Status = PciRootBridgeIoRead (\r
                                   PciRootBridgeIo,\r
                                   PciRootBridgeIo,\r
+                                  &PciIoDevice->Pci,\r
                                   EfiPciWidthUint32,\r
                                   Address,\r
                                   1,\r
                                   EfiPciWidthUint32,\r
                                   Address,\r
                                   1,\r
@@ -334,7 +336,7 @@ Returns:
     // Clear all bars\r
     //\r
     for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {\r
     // Clear all bars\r
     //\r
     for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {\r
-      PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllZero);\r
+      PciIoWrite (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllZero);\r
     }\r
     \r
     //\r
     }\r
     \r
     //\r
@@ -342,7 +344,7 @@ Returns:
     // enable its decoder\r
     //\r
     Value32 = RomBar | 0x1;\r
     // enable its decoder\r
     //\r
     Value32 = RomBar | 0x1;\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 (EFI_PCI_IO_PROTOCOL_WIDTH) EfiPciWidthUint32,\r
                 RomBarIndex,\r
                 PciIo,\r
                 (EFI_PCI_IO_PROTOCOL_WIDTH) EfiPciWidthUint32,\r
                 RomBarIndex,\r
@@ -376,7 +378,7 @@ Returns:
     // disable rom decode\r
     //\r
     Value32 = 0xFFFFFFFE;\r
     // disable rom decode\r
     //\r
     Value32 = 0xFFFFFFFE;\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 (EFI_PCI_IO_PROTOCOL_WIDTH) EfiPciWidthUint32,\r
                 RomBarIndex,\r
                 PciIo,\r
                 (EFI_PCI_IO_PROTOCOL_WIDTH) EfiPciWidthUint32,\r
                 RomBarIndex,\r
index f871c8681c5f6112972f7e37f11b7176db044736..4584198a9cb01adba53a521e1cbd17e1b4de5faf 100644 (file)
@@ -1,18 +1,18 @@
 /*++\r
 \r
 /*++\r
 \r
-Copyright (c) 2006, 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
+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
   PciPowerManagement.c\r
 \r
 Module Name:\r
 \r
   PciPowerManagement.c\r
-  \r
+\r
 Abstract:\r
 \r
   PCI Bus Driver\r
 Abstract:\r
 \r
   PCI Bus Driver\r
@@ -71,13 +71,13 @@ Returns:
   //\r
   // Write PMCSR\r
   //\r
   //\r
   // Write PMCSR\r
   //\r
-  PciIoDevice->PciIo.Pci.Write (\r
-                          &PciIoDevice->PciIo,\r
-                          EfiPciIoWidthUint16,\r
-                          PowerManagementRegBlock + 4,\r
-                          1,\r
-                          &PMCSR\r
-                          );\r
+  PciIoWrite (\r
+               &PciIoDevice->PciIo,\r
+               EfiPciIoWidthUint16,\r
+               PowerManagementRegBlock + 4,\r
+               1,\r
+               &PMCSR\r
+             );\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
   return EFI_SUCCESS;\r
 }\r
index 482ddc92741c88d040b54d37ea0e5ee2f21c6625..cd781841a1f10d32070560cae299863c9586a131 100644 (file)
@@ -1,18 +1,18 @@
 /*++\r
 \r
 /*++\r
 \r
-Copyright (c) 2006, 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
+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
   PciResourceSupport.c\r
 \r
 Module Name:\r
 \r
   PciResourceSupport.c\r
-  \r
+\r
 Abstract:\r
 \r
   PCI Bus Driver\r
 Abstract:\r
 \r
   PCI Bus Driver\r
@@ -1222,7 +1222,7 @@ Returns:
   case PciBarTypeMem32:\r
   case PciBarTypePMem32:\r
 \r
   case PciBarTypeMem32:\r
   case PciBarTypePMem32:\r
 \r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 (Node->PciDev->PciBar[Node->Bar]).Offset,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 (Node->PciDev->PciBar[Node->Bar]).Offset,\r
@@ -1239,7 +1239,7 @@ Returns:
 \r
     Address32 = (UINT32) (Address & 0x00000000FFFFFFFF);\r
 \r
 \r
     Address32 = (UINT32) (Address & 0x00000000FFFFFFFF);\r
 \r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 (Node->PciDev->PciBar[Node->Bar]).Offset,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 (Node->PciDev->PciBar[Node->Bar]).Offset,\r
@@ -1249,7 +1249,7 @@ Returns:
 \r
     Address32 = (UINT32) RShiftU64 (Address, 32);\r
 \r
 \r
     Address32 = (UINT32) RShiftU64 (Address, 32);\r
 \r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 (UINT8) ((Node->PciDev->PciBar[Node->Bar]).Offset + 4),\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 (UINT8) ((Node->PciDev->PciBar[Node->Bar]).Offset + 4),\r
@@ -1317,7 +1317,7 @@ Returns:
 \r
   case PPB_BAR_0:\r
   case PPB_BAR_1:\r
 \r
   case PPB_BAR_0:\r
   case PPB_BAR_1:\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 (Node->PciDev->PciBar[Node->Bar]).Offset,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 (Node->PciDev->PciBar[Node->Bar]).Offset,\r
@@ -1333,7 +1333,7 @@ Returns:
   case PPB_IO_RANGE:\r
 \r
     Address32 = ((UINT32) (Address)) >> 8;\r
   case PPB_IO_RANGE:\r
 \r
     Address32 = ((UINT32) (Address)) >> 8;\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint8,\r
                 0x1C,\r
                 PciIo,\r
                 EfiPciIoWidthUint8,\r
                 0x1C,\r
@@ -1342,7 +1342,7 @@ Returns:
                 );\r
 \r
     Address32 >>= 8;\r
                 );\r
 \r
     Address32 >>= 8;\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint16,\r
                 0x30,\r
                 PciIo,\r
                 EfiPciIoWidthUint16,\r
                 0x30,\r
@@ -1352,7 +1352,7 @@ Returns:
 \r
     Address32 = (UINT32) (Address + Node->Length - 1);\r
     Address32 = ((UINT32) (Address32)) >> 8;\r
 \r
     Address32 = (UINT32) (Address + Node->Length - 1);\r
     Address32 = ((UINT32) (Address32)) >> 8;\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint8,\r
                 0x1D,\r
                 PciIo,\r
                 EfiPciIoWidthUint8,\r
                 0x1D,\r
@@ -1361,7 +1361,7 @@ Returns:
                 );\r
 \r
     Address32 >>= 8;\r
                 );\r
 \r
     Address32 >>= 8;\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint16,\r
                 0x32,\r
                 PciIo,\r
                 EfiPciIoWidthUint16,\r
                 0x32,\r
@@ -1376,7 +1376,7 @@ Returns:
   case PPB_MEM32_RANGE:\r
 \r
     Address32 = ((UINT32) (Address)) >> 16;\r
   case PPB_MEM32_RANGE:\r
 \r
     Address32 = ((UINT32) (Address)) >> 16;\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint16,\r
                 0x20,\r
                 PciIo,\r
                 EfiPciIoWidthUint16,\r
                 0x20,\r
@@ -1386,7 +1386,7 @@ Returns:
 \r
     Address32 = (UINT32) (Address + Node->Length - 1);\r
     Address32 = ((UINT32) (Address32)) >> 16;\r
 \r
     Address32 = (UINT32) (Address + Node->Length - 1);\r
     Address32 = ((UINT32) (Address32)) >> 16;\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint16,\r
                 0x22,\r
                 PciIo,\r
                 EfiPciIoWidthUint16,\r
                 0x22,\r
@@ -1402,7 +1402,7 @@ Returns:
   case PPB_PMEM64_RANGE:\r
 \r
     Address32 = ((UINT32) (Address)) >> 16;\r
   case PPB_PMEM64_RANGE:\r
 \r
     Address32 = ((UINT32) (Address)) >> 16;\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint16,\r
                 0x24,\r
                 PciIo,\r
                 EfiPciIoWidthUint16,\r
                 0x24,\r
@@ -1412,7 +1412,7 @@ Returns:
 \r
     Address32 = (UINT32) (Address + Node->Length - 1);\r
     Address32 = ((UINT32) (Address32)) >> 16;\r
 \r
     Address32 = (UINT32) (Address + Node->Length - 1);\r
     Address32 = ((UINT32) (Address32)) >> 16;\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint16,\r
                 0x26,\r
                 PciIo,\r
                 EfiPciIoWidthUint16,\r
                 0x26,\r
@@ -1421,7 +1421,7 @@ Returns:
                 );\r
 \r
     Address32 = (UINT32) RShiftU64 (Address, 32);\r
                 );\r
 \r
     Address32 = (UINT32) RShiftU64 (Address, 32);\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x28,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x28,\r
@@ -1430,7 +1430,7 @@ Returns:
                 );\r
 \r
     Address32 = (UINT32) RShiftU64 ((Address + Node->Length - 1), 32);\r
                 );\r
 \r
     Address32 = (UINT32) RShiftU64 ((Address + Node->Length - 1), 32);\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x2C,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x2C,\r
@@ -1915,7 +1915,7 @@ Returns:
   switch (Node->Bar) {\r
 \r
   case P2C_BAR_0:\r
   switch (Node->Bar) {\r
 \r
   case P2C_BAR_0:\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 (Node->PciDev->PciBar[Node->Bar]).Offset,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 (Node->PciDev->PciBar[Node->Bar]).Offset,\r
@@ -1928,7 +1928,7 @@ Returns:
     break;\r
 \r
   case P2C_MEM_1:\r
     break;\r
 \r
   case P2C_MEM_1:\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x1c,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x1c,\r
@@ -1937,7 +1937,7 @@ Returns:
                 );\r
 \r
     TempAddress = Address + Node->Length - 1;\r
                 );\r
 \r
     TempAddress = Address + Node->Length - 1;\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x20,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x20,\r
@@ -1950,7 +1950,7 @@ Returns:
       //\r
       // Set non-prefetchable bit\r
       //\r
       //\r
       // Set non-prefetchable bit\r
       //\r
-      PciIo->Pci.Read (\r
+      PciIoRead (\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
@@ -1959,7 +1959,7 @@ Returns:
                   );\r
 \r
       BridgeControl &= 0xfeff;\r
                   );\r
 \r
       BridgeControl &= 0xfeff;\r
-      PciIo->Pci.Write (\r
+      PciIoWrite (\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
@@ -1972,7 +1972,7 @@ Returns:
       //\r
       // Set pre-fetchable bit\r
       //\r
       //\r
       // Set pre-fetchable bit\r
       //\r
-      PciIo->Pci.Read (\r
+      PciIoRead (\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
@@ -1981,7 +1981,7 @@ Returns:
                   );\r
 \r
       BridgeControl |= 0x0100;\r
                   );\r
 \r
       BridgeControl |= 0x0100;\r
-      PciIo->Pci.Write (\r
+      PciIoWrite (\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
@@ -1997,7 +1997,7 @@ Returns:
     break;\r
 \r
   case P2C_MEM_2:\r
     break;\r
 \r
   case P2C_MEM_2:\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x24,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x24,\r
@@ -2007,7 +2007,7 @@ Returns:
 \r
     TempAddress = Address + Node->Length - 1;\r
 \r
 \r
     TempAddress = Address + Node->Length - 1;\r
 \r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x28,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x28,\r
@@ -2020,7 +2020,7 @@ Returns:
       //\r
       // Set non-prefetchable bit\r
       //\r
       //\r
       // Set non-prefetchable bit\r
       //\r
-      PciIo->Pci.Read (\r
+      PciIoRead (\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
@@ -2029,7 +2029,7 @@ Returns:
                   );\r
 \r
       BridgeControl &= 0xfdff;\r
                   );\r
 \r
       BridgeControl &= 0xfdff;\r
-      PciIo->Pci.Write (\r
+      PciIoWrite (\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
@@ -2041,7 +2041,7 @@ Returns:
       //\r
       // Set pre-fetchable bit\r
       //\r
       //\r
       // Set pre-fetchable bit\r
       //\r
-      PciIo->Pci.Read (\r
+      PciIoRead (\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
@@ -2050,7 +2050,7 @@ Returns:
                   );\r
 \r
       BridgeControl |= 0x0200;\r
                   );\r
 \r
       BridgeControl |= 0x0200;\r
-      PciIo->Pci.Write (\r
+      PciIoWrite (\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
                   PciIo,\r
                   EfiPciIoWidthUint16,\r
                   0x3e,\r
@@ -2065,7 +2065,7 @@ Returns:
     break;\r
 \r
   case P2C_IO_1:\r
     break;\r
 \r
   case P2C_IO_1:\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x2c,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x2c,\r
@@ -2073,7 +2073,7 @@ Returns:
                 &Address\r
                 );\r
     TempAddress = Address + Node->Length - 1;\r
                 &Address\r
                 );\r
     TempAddress = Address + Node->Length - 1;\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x30,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x30,\r
@@ -2088,7 +2088,7 @@ Returns:
     break;\r
 \r
   case P2C_IO_2:\r
     break;\r
 \r
   case P2C_IO_2:\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x34,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x34,\r
@@ -2097,7 +2097,7 @@ Returns:
                 );\r
 \r
     TempAddress = Address + Node->Length - 1;\r
                 );\r
 \r
     TempAddress = Address + Node->Length - 1;\r
-    PciIo->Pci.Write (\r
+    PciIoWrite (\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x38,\r
                 PciIo,\r
                 EfiPciIoWidthUint32,\r
                 0x38,\r
index eb6713f4dd1eb0645289954b957f3afd9cbc1d20..a874b8a85cec54c690a1c1644e20f5ef1cef0c29 100644 (file)
@@ -1,24 +1,24 @@
 /*++\r
 \r
 /*++\r
 \r
-Copyright (c) 2006, 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
+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
 Module Name:\r
 \r
   PciBus.c\r
-  \r
+\r
 Abstract:\r
 \r
   PCI Bus Driver\r
 \r
 Revision History\r
 Abstract:\r
 \r
   PCI Bus Driver\r
 \r
 Revision History\r
\r
+\r
 --*/\r
 \r
 #include "pcibus.h"\r
 --*/\r
 \r
 #include "pcibus.h"\r
@@ -36,7 +36,6 @@ EFI_DRIVER_BINDING_PROTOCOL                   gPciBusDriverBinding = {
   NULL\r
 };\r
 \r
   NULL\r
 };\r
 \r
-EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL  *gEfiIncompatiblePciDeviceSupport = NULL;\r
 EFI_HANDLE                                    gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];\r
 UINTN                                         gPciHostBridgeNumber;\r
 BOOLEAN                                       gFullEnumeration;\r
 EFI_HANDLE                                    gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];\r
 UINTN                                         gPciHostBridgeNumber;\r
 BOOLEAN                                       gFullEnumeration;\r
@@ -68,8 +67,8 @@ Arguments:
 \r
 Returns:\r
 \r
 \r
 Returns:\r
 \r
-  EFI_SUCCESS \r
-  EFI_DEVICE_ERROR \r
+  EFI_SUCCESS\r
+  EFI_DEVICE_ERROR\r
 \r
 --*/\r
 // TODO:    ImageHandle - add argument and description to function comment\r
 \r
 --*/\r
 // TODO:    ImageHandle - add argument and description to function comment\r
@@ -101,7 +100,7 @@ Routine Description:
   Check to see if pci bus driver supports the given controller\r
 \r
 Arguments:\r
   Check to see if pci bus driver supports the given controller\r
 \r
 Arguments:\r
-  \r
+\r
   IN EFI_DRIVER_BINDING_PROTOCOL    *This,\r
   IN EFI_HANDLE                     Controller,\r
   IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
   IN EFI_DRIVER_BINDING_PROTOCOL    *This,\r
   IN EFI_HANDLE                     Controller,\r
   IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
@@ -195,13 +194,13 @@ Routine Description:
   Start to management the controller passed in\r
 \r
 Arguments:\r
   Start to management the controller passed in\r
 \r
 Arguments:\r
-  \r
+\r
   IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
   IN EFI_HANDLE                   Controller,\r
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
 \r
 Returns:\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
 --*/\r
 // TODO:    This - add argument and description to function comment\r
 \r
 --*/\r
 // TODO:    This - add argument and description to function comment\r
@@ -211,12 +210,6 @@ Returns:
 {\r
   EFI_STATUS  Status;\r
 \r
 {\r
   EFI_STATUS  Status;\r
 \r
-  Status = gBS->LocateProtocol (\r
-                  &gEfiIncompatiblePciDeviceSupportProtocolGuid,\r
-                  NULL,\r
-                  (VOID **) &gEfiIncompatiblePciDeviceSupport\r
-                  );\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
   // If PCI Platform protocol is available, get it now.\r
   // If the platform implements this, it must be installed before BDS phase\r
@@ -240,12 +233,12 @@ Returns:
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\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
   // Enable PCI device specified by remaining device path. BDS or other driver can call the\r
   // start more than once.\r
   //\r
-  \r
+\r
   StartPciDevices (Controller, RemainingDevicePath);\r
 \r
   return EFI_SUCCESS;\r
   StartPciDevices (Controller, RemainingDevicePath);\r
 \r
   return EFI_SUCCESS;\r
@@ -267,7 +260,7 @@ Routine Description:
   if all the the children get closed, close the protocol\r
 \r
 Arguments:\r
   if all the the children get closed, close the protocol\r
 \r
 Arguments:\r
-  \r
+\r
   IN  EFI_DRIVER_BINDING_PROTOCOL   *This,\r
   IN  EFI_HANDLE                    Controller,\r
   IN  UINTN                         NumberOfChildren,\r
   IN  EFI_DRIVER_BINDING_PROTOCOL   *This,\r
   IN  EFI_HANDLE                    Controller,\r
   IN  UINTN                         NumberOfChildren,\r
@@ -275,7 +268,7 @@ Arguments:
 \r
 Returns:\r
 \r
 \r
 Returns:\r
 \r
-  \r
+\r
 --*/\r
 // TODO:    This - add argument and description to function comment\r
 // TODO:    Controller - add argument and description to function comment\r
 --*/\r
 // TODO:    This - add argument and description to function comment\r
 // TODO:    Controller - add argument and description to function comment\r
index cd34d8742e8e27526088519c25d56a29bf508544..1cc957503b5ac7cece3d176d48bce27507e7c64e 100644 (file)
@@ -1,18 +1,18 @@
 /*++\r
 \r
 /*++\r
 \r
-Copyright (c) 2006, 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
+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.h\r
 \r
 Module Name:\r
 \r
   pcibus.h\r
-  \r
+\r
 Abstract:\r
 \r
   PCI Bus Driver\r
 Abstract:\r
 \r
   PCI Bus Driver\r
@@ -216,7 +216,6 @@ typedef struct _PCI_IO_DEVICE {
 //\r
 // Global Variables\r
 //\r
 //\r
 // Global Variables\r
 //\r
-extern EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL *gEfiIncompatiblePciDeviceSupport;\r
 extern EFI_DRIVER_BINDING_PROTOCOL                  gPciBusDriverBinding;\r
 extern EFI_COMPONENT_NAME_PROTOCOL                  gPciBusComponentName;\r
 extern LIST_ENTRY                                   gPciDevicePool;\r
 extern EFI_DRIVER_BINDING_PROTOCOL                  gPciBusDriverBinding;\r
 extern EFI_COMPONENT_NAME_PROTOCOL                  gPciBusComponentName;\r
 extern LIST_ENTRY                                   gPciDevicePool;\r
index 2e7e9344d8bb6867b2aa68cacc06961c2aacb271..c7b481d792eb237f2c8168f6ac819de1b9b4adac 100644 (file)
         <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <!--Pkg: EdkModulePkg Mod: EdkDxePciIncompatibleDeviceSuppportLib Path: EdkModulePkg\Library\EdkDxePciIncompatibleDeviceSupportLib\EdkDxePciIncompatibleDeviceSupportLib.msa-->\r
+        <Instance ModuleGuid="1ca1c1f9-5baf-4204-b6e5-5e24109a4e4e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>\r
       </Libraries>\r
       <PcdBuildDefinition>\r
         <PcdData ItemType="FIXED_AT_BUILD">\r
       </Libraries>\r
       <PcdBuildDefinition>\r
         <PcdData ItemType="FIXED_AT_BUILD">\r
           <MaxDatumSize>4</MaxDatumSize>\r
           <Value>320</Value>\r
         </PcdData>\r
           <MaxDatumSize>4</MaxDatumSize>\r
           <Value>320</Value>\r
         </PcdData>\r
+        <PcdData ItemType="FIXED_AT_BUILD">\r
+          <C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>\r
+          <Token>0x0001003f</Token>\r
+          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>UINT8</DatumType>\r
+          <MaxDatumSize>1</MaxDatumSize>\r
+          <Value>0x0</Value>\r
+        </PcdData>\r
       </PcdBuildDefinition>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>NULL</FvBinding>\r
       </PcdBuildDefinition>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>NULL</FvBinding>\r
         <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <!--Pkg: EdkModulePkg Mod: EdkDxePciIncompatibleDeviceSuppportLib Path: EdkModulePkg\Library\EdkDxePciIncompatibleDeviceSupportLib\EdkDxePciIncompatibleDeviceSupportLib.msa-->\r
+        <Instance ModuleGuid="1ca1c1f9-5baf-4204-b6e5-5e24109a4e4e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>\r
       </Libraries>\r
       <PcdBuildDefinition>\r
         <PcdData ItemType="FIXED_AT_BUILD">\r
       </Libraries>\r
       <PcdBuildDefinition>\r
         <PcdData ItemType="FIXED_AT_BUILD">\r
           <MaxDatumSize>4</MaxDatumSize>\r
           <Value>320</Value>\r
         </PcdData>\r
           <MaxDatumSize>4</MaxDatumSize>\r
           <Value>320</Value>\r
         </PcdData>\r
+        <PcdData ItemType="FIXED_AT_BUILD">\r
+          <C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>\r
+          <Token>0x0001003f</Token>\r
+          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>UINT8</DatumType>\r
+          <MaxDatumSize>1</MaxDatumSize>\r
+          <Value>0x0</Value>\r
+        </PcdData>\r
       </PcdBuildDefinition>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>NULL</FvBinding>\r
       </PcdBuildDefinition>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>NULL</FvBinding>\r
         <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <!--Pkg: EdkModulePkg Mod: EdkDxePciIncompatibleDeviceSuppportLib Path: EdkModulePkg\Library\EdkDxePciIncompatibleDeviceSupportLib\EdkDxePciIncompatibleDeviceSupportLib.msa-->\r
+        <Instance ModuleGuid="1ca1c1f9-5baf-4204-b6e5-5e24109a4e4e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>\r
       </Libraries>\r
       <PcdBuildDefinition>\r
         <PcdData ItemType="FIXED_AT_BUILD">\r
       </Libraries>\r
       <PcdBuildDefinition>\r
         <PcdData ItemType="FIXED_AT_BUILD">\r
           <MaxDatumSize>4</MaxDatumSize>\r
           <Value>320</Value>\r
         </PcdData>\r
           <MaxDatumSize>4</MaxDatumSize>\r
           <Value>320</Value>\r
         </PcdData>\r
+        <PcdData ItemType="FIXED_AT_BUILD">\r
+          <C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>\r
+          <Token>0x0001003f</Token>\r
+          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>UINT8</DatumType>\r
+          <MaxDatumSize>1</MaxDatumSize>\r
+          <Value>0x0</Value>\r
+        </PcdData>\r
       </PcdBuildDefinition>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>NULL</FvBinding>\r
       </PcdBuildDefinition>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>NULL</FvBinding>\r
         <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <!--Pkg: EdkModulePkg Mod: EdkDxePciIncompatibleDeviceSuppportLib Path: EdkModulePkg\Library\EdkDxePciIncompatibleDeviceSupportLib\EdkDxePciIncompatibleDeviceSupportLib.msa-->\r
+        <Instance ModuleGuid="1ca1c1f9-5baf-4204-b6e5-5e24109a4e4e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>\r
       </Libraries>\r
       <PcdBuildDefinition>\r
         <PcdData ItemType="FIXED_AT_BUILD">\r
       </Libraries>\r
       <PcdBuildDefinition>\r
         <PcdData ItemType="FIXED_AT_BUILD">\r
           <MaxDatumSize>4</MaxDatumSize>\r
           <Value>320</Value>\r
         </PcdData>\r
           <MaxDatumSize>4</MaxDatumSize>\r
           <Value>320</Value>\r
         </PcdData>\r
+        <PcdData ItemType="FIXED_AT_BUILD">\r
+          <C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>\r
+          <Token>0x0001003f</Token>\r
+          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>UINT8</DatumType>\r
+          <MaxDatumSize>1</MaxDatumSize>\r
+          <Value>0x0</Value>\r
+        </PcdData>\r
       </PcdBuildDefinition>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>NULL</FvBinding>\r
       </PcdBuildDefinition>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>NULL</FvBinding>\r
index fe9b69630405f8c8ea790fbc059c4cbc5e388fc0..6aef854ed53b7c343039fd4d9a8796161f4924b2 100644 (file)
@@ -8,7 +8,7 @@
     <Description>This Module provides standard reference information for EFI/Tiano implementations.</Description>\r
     <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>\r
     <License>All rights reserved.
     <Description>This Module provides standard reference information for EFI/Tiano implementations.</Description>\r
     <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>\r
     <License>All rights reserved.
-      This program and the accompanying materials are licensed and made available 
+      This program and the accompanying materials are licensed and made available
       under the terms and conditions of the BSD License which accompanies this distribution.
       The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
       THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES
       under the terms and conditions of the BSD License which accompanies this distribution.
       The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
       THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES
       <IncludeHeader>Include/Library/EdkGenericPlatformBdsLib.h</IncludeHeader>\r
       <HelpText>Generic Platform Bds library</HelpText>\r
     </LibraryClass>\r
       <IncludeHeader>Include/Library/EdkGenericPlatformBdsLib.h</IncludeHeader>\r
       <HelpText>Generic Platform Bds library</HelpText>\r
     </LibraryClass>\r
+    <LibraryClass Name="PciIncompatibleDeviceSupportLib">\r
+      <IncludeHeader>Include/Library/PciIncompatibleDeviceSupportLib.h</IncludeHeader>\r
+      <HelpText>This library includes the PCI incompatible devices list.</HelpText>\r
+    </LibraryClass>\r
   </LibraryClassDeclarations>\r
   <IndustryStdIncludes>\r
     <IndustryStdHeader Name="CapsuleName">\r
   </LibraryClassDeclarations>\r
   <IndustryStdIncludes>\r
     <IndustryStdHeader Name="CapsuleName">\r
     <Filename>Library/EdkOemHookStatusCodeLibNull/EdkOemHookStatusCodeLibNull.msa</Filename>\r
     <Filename>Library/EdkGenericBdsLib/EdkGenericBdsLib.msa</Filename>\r
     <Filename>Library/EdkGenericPlatformBdsLib/EdkGenericPlatformBdsLib.msa</Filename>\r
     <Filename>Library/EdkOemHookStatusCodeLibNull/EdkOemHookStatusCodeLibNull.msa</Filename>\r
     <Filename>Library/EdkGenericBdsLib/EdkGenericBdsLib.msa</Filename>\r
     <Filename>Library/EdkGenericPlatformBdsLib/EdkGenericPlatformBdsLib.msa</Filename>\r
+    <Filename>Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.msa</Filename>\r
     <Filename>Universal/Console/ConSplitter/Dxe/ConSplitter.msa</Filename>\r
     <Filename>Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.msa</Filename>\r
     <Filename>Universal/Console/Terminal/Dxe/Terminal.msa</Filename>\r
     <Filename>Universal/Console/ConSplitter/Dxe/ConSplitter.msa</Filename>\r
     <Filename>Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.msa</Filename>\r
     <Filename>Universal/Console/Terminal/Dxe/Terminal.msa</Filename>\r
       <DatumType>UINT32</DatumType>\r
       <ValidUsage>FIXED_AT_BUILD</ValidUsage>\r
       <DefaultValue>0x08</DefaultValue>\r
       <DatumType>UINT32</DatumType>\r
       <ValidUsage>FIXED_AT_BUILD</ValidUsage>\r
       <DefaultValue>0x08</DefaultValue>\r
-      <HelpText>The maximum number of callback function, which will be triggered when 
+      <HelpText>The maximum number of callback function, which will be triggered when
         a PCD entry is been set, can be registered for a single PCD entry in PEI phase.</HelpText>\r
     </PcdEntry>\r
     <PcdEntry>\r
         a PCD entry is been set, can be registered for a single PCD entry in PEI phase.</HelpText>\r
     </PcdEntry>\r
     <PcdEntry>\r
       <DatumType>UINT32</DatumType>\r
       <ValidUsage>FIXED_AT_BUILD</ValidUsage>\r
       <DefaultValue>0x0</DefaultValue>\r
       <DatumType>UINT32</DatumType>\r
       <ValidUsage>FIXED_AT_BUILD</ValidUsage>\r
       <DefaultValue>0x0</DefaultValue>\r
-      <HelpText>The base address of the VPD (Vital Product Data) region. It is 
+      <HelpText>The base address of the VPD (Vital Product Data) region. It is
         normally a region reserved on flash.</HelpText>\r
     </PcdEntry>\r
     <PcdEntry>\r
         normally a region reserved on flash.</HelpText>\r
     </PcdEntry>\r
     <PcdEntry>\r
       <DatumType>BOOLEAN</DatumType>\r
       <ValidUsage>FEATURE_FLAG</ValidUsage>\r
       <DefaultValue>TRUE</DefaultValue>\r
       <DatumType>BOOLEAN</DatumType>\r
       <ValidUsage>FEATURE_FLAG</ValidUsage>\r
       <DefaultValue>TRUE</DefaultValue>\r
-      <HelpText>This feature flag can be used to enable or disable the Pcd PEIM database 
+      <HelpText>This feature flag can be used to enable or disable the Pcd PEIM database
         traverse capability. Disable it can reduce the size of final image generated.</HelpText>\r
     </PcdEntry>\r
     <PcdEntry>\r
         traverse capability. Disable it can reduce the size of final image generated.</HelpText>\r
     </PcdEntry>\r
     <PcdEntry>\r
       <DatumType>BOOLEAN</DatumType>\r
       <ValidUsage>FEATURE_FLAG</ValidUsage>\r
       <DefaultValue>TRUE</DefaultValue>\r
       <DatumType>BOOLEAN</DatumType>\r
       <ValidUsage>FEATURE_FLAG</ValidUsage>\r
       <DefaultValue>TRUE</DefaultValue>\r
-      <HelpText>This feature flag can be used to enable or disable the Pcd DXE database 
+      <HelpText>This feature flag can be used to enable or disable the Pcd DXE database
         traverse capability. Disable it can reduce the size of final image generated.</HelpText>\r
     </PcdEntry>\r
     <PcdEntry>\r
         traverse capability. Disable it can reduce the size of final image generated.</HelpText>\r
     </PcdEntry>\r
     <PcdEntry>\r
       <DefaultValue>FALSE</DefaultValue>\r
       <HelpText>If this PCD is set as TRUE, NT emulator will be endabled.</HelpText>\r
     </PcdEntry>\r
       <DefaultValue>FALSE</DefaultValue>\r
       <HelpText>If this PCD is set as TRUE, NT emulator will be endabled.</HelpText>\r
     </PcdEntry>\r
+    <PcdEntry>\r
+      <C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>\r
+      <Token>0x0001003f</Token>\r
+      <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+      <DatumType>UINT8</DatumType>\r
+      <ValidUsage>FIXED_AT_BUILD</ValidUsage>\r
+      <DefaultValue>0x0</DefaultValue>\r
+      <HelpText>The PCD masks for PCI incompatible devices support.\r
+        Acpi_Resource_Update_Support   :1;\r
+        Register_Read_Support          :1;\r
+        Register_Write_Support         :1;\r
+        Register_Update_Support        :1;\r
+        Register_Access_Width_Support  :1;\r
+        Reserved                       :3;</HelpText>\r
+    </PcdEntry>\r
   </PcdDeclarations>\r
 </PackageSurfaceArea>
\ No newline at end of file
   </PcdDeclarations>\r
 </PackageSurfaceArea>
\ No newline at end of file
diff --git a/EdkModulePkg/Include/Library/PciIncompatibleDeviceSupportLib.h b/EdkModulePkg/Include/Library/PciIncompatibleDeviceSupportLib.h
new file mode 100644 (file)
index 0000000..527a704
--- /dev/null
@@ -0,0 +1,134 @@
+/** @file\r
+  PCI Incompatible device support Libary.\r
+\r
+Copyright (c) 2007 Intel Corporation. All rights reserved. <BR>\r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+**/\r
+\r
+#define PCI_REGISTER_READ    0xfffffffffffffff1ULL\r
+#define PCI_REGISTER_WRITE   0xfffffffffffffff2ULL\r
+#define VALUE_NOCARE         0xffffffffffffffffULL\r
+\r
+//\r
+// PCI device device information\r
+//\r
+typedef struct {\r
+  UINT64              VendorID;\r
+  UINT64              DeviceID;\r
+  UINT64              RevisionID;\r
+  UINT64              SubsystemVendorID;\r
+  UINT64              SubsystemID;\r
+} EFI_PCI_DEVICE_INFO;\r
+\r
+\r
+//\r
+// store hardcode value of resgister\r
+//\r
+typedef struct {\r
+  UINT64              AndValue;\r
+  UINT64              OrValue;\r
+} EFI_PCI_REGISTER_VALUE_DATA;\r
+\r
+//\r
+// store access width information\r
+//\r
+typedef struct {\r
+  UINT64              StartOffset;\r
+  UINT64              EndOffset;\r
+  UINT64              Width;\r
+} EFI_PCI_REGISTER_ACCESS_DATA;\r
+\r
+\r
+//\r
+// ACPI resource descriptor\r
+//\r
+typedef struct {\r
+  UINT64  ResType;\r
+  UINT64  GenFlag;\r
+  UINT64  SpecificFlag;\r
+  UINT64  AddrSpaceGranularity;\r
+  UINT64  AddrRangeMin;\r
+  UINT64  AddrRangeMax;\r
+  UINT64  AddrTranslationOffset;\r
+  UINT64  AddrLen;\r
+} EFI_PCI_RESOUCE_DESCRIPTOR;\r
+\r
+/**\r
+  Checks the incompatible device list for ACPI resource update and return\r
+  the configuration.\r
+\r
+  This function searches the incompatible device list according to request\r
+  information. If the PCI device belongs to the devices list, corresponding\r
+  configuration informtion will be returned, in the meantime return EFI_SUCCESS.\r
+\r
+  @param  PciDeviceInfo       A pointer to PCI device information.\r
+  @param  Configuration       Returned information.\r
+\r
+  @retval returns EFI_SUCCESS if check incompatible device ok.\r
+          Otherwise return EFI_UNSUPPORTED.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+PciResourceUpdateCheck (\r
+  IN  EFI_PCI_DEVICE_INFO           *PciDeviceInfo,\r
+  OUT VOID                          *Configuration\r
+  );\r
+\r
+/**\r
+  Checks the incompatible device list and return configuration register mask values.\r
+\r
+  This function searches the incompatible device list according to request\r
+  information. If the PCI device belongs to the devices list, corresponding\r
+  configuration informtion will be returned, in the meantime return EFI_SUCCESS.\r
+\r
+  @param  PciDeviceInfo       A pointer to EFI_PCI_DEVICE_INFO.\r
+  @param  AccessType          Access Type, READ or WRITE.\r
+  @param  Offset              The address within the PCI configuration space.\r
+  @param  Configuration       Returned information.\r
+\r
+  @retval returns EFI_SUCCESS if check incompatible device ok.\r
+          Otherwise return EFI_UNSUPPORTED.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+PciRegisterUpdateCheck (\r
+  IN  EFI_PCI_DEVICE_INFO           *PciDeviceInfo,\r
+  IN  UINT64                        AccessType,\r
+  IN  UINT64                        Offset,\r
+  OUT VOID                          *Configuration\r
+  );\r
+\r
+/**\r
+  Checks the incompatible device list for access width incompatibility and\r
+  return the configuration\r
+\r
+  This function searches the incompatible device list for access width\r
+  incompatibility according to request information. If the PCI device\r
+  belongs to the devices list, corresponding configuration informtion\r
+  will be returned, in the meantime return EFI_SUCCESS.\r
+\r
+  @param  PciDeviceInfo       A pointer to PCI device information.\r
+  @param  AccessType          Access type, READ or WRITE.\r
+  @param  Offset              The address within the PCI configuration space.\r
+  @param  AccessWidth         Access width needs to check incompatibility.\r
+  @param  Configuration       Returned information.\r
+\r
+  @retval returns EFI_SUCCESS if check incompatible device ok.\r
+          Otherwise return EFI_UNSUPPORTED.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+PciRegisterAccessCheck (\r
+  IN  EFI_PCI_DEVICE_INFO           *PciDeviceInfo,\r
+  IN  UINT64                        AccessType,\r
+  IN  UINT64                        Offset,\r
+  IN  UINT64                        AccessWidth,\r
+  OUT VOID                          *Configuration\r
+  );\r
diff --git a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.c b/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.c
new file mode 100644 (file)
index 0000000..f6638c1
--- /dev/null
@@ -0,0 +1,388 @@
+/** @file\r
+  The implementation of PCI incompatible device support libary.\r
+\r
+Copyright (c) 2007 Intel Corporation. All rights reserved. <BR>\r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+**/\r
+\r
+#include "IncompatiblePciDeviceList.h"\r
+\r
+/**\r
+  Check whether two PCI devices matched\r
+\r
+  @param  PciDeviceInfo       A pointer to EFI_PCI_DEVICE_INFO.\r
+  @param  Header              A pointer to EFI_PCI_DEVICE_INFO.\r
+\r
+  @retval returns EFI_SUCCESS if two PCI device matched.\r
+**/\r
+STATIC\r
+EFI_STATUS\r
+DeviceCheck (\r
+  IN  EFI_PCI_DEVICE_INFO      *PciDeviceInfo,\r
+  IN  EFI_PCI_DEVICE_INFO      *Header\r
+  )\r
+{\r
+  //\r
+  // See if the Header matches the parameters passed in\r
+  //\r
+  if (Header->VendorID != DEVICE_ID_NOCARE) {\r
+    if (PciDeviceInfo->VendorID != Header->VendorID) {\r
+      return EFI_UNSUPPORTED;\r
+    }\r
+  }\r
+\r
+  if (Header->DeviceID != DEVICE_ID_NOCARE) {\r
+    if (PciDeviceInfo->DeviceID != Header->DeviceID) {\r
+      return EFI_UNSUPPORTED;\r
+    }\r
+  }\r
+\r
+  if (Header->RevisionID != DEVICE_ID_NOCARE) {\r
+    if (PciDeviceInfo->RevisionID != Header->RevisionID) {\r
+      return EFI_UNSUPPORTED;\r
+    }\r
+  }\r
+\r
+  if (Header->SubsystemVendorID != DEVICE_ID_NOCARE) {\r
+    if (PciDeviceInfo->SubsystemVendorID != Header->SubsystemVendorID) {\r
+      return EFI_UNSUPPORTED;\r
+    }\r
+  }\r
+\r
+  if (Header->SubsystemID != DEVICE_ID_NOCARE) {\r
+    if (PciDeviceInfo->SubsystemID != Header->SubsystemID) {\r
+      return EFI_UNSUPPORTED;\r
+    }\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+\r
+/**\r
+  Check the incompatible device list for ACPI resource update and return\r
+  the configuration\r
+\r
+  This function searches the incompatible device list according to request\r
+  information. If the PCI device belongs to the devices list, corresponding\r
+  configuration informtion will be returned, in the meantime return EFI_SUCCESS.\r
+\r
+  @param  PciDeviceInfo       A pointer to PCI device information.\r
+  @param  Configuration       Returned information.\r
+\r
+  @retval returns EFI_SUCCESS if check incompatible device ok.\r
+          Otherwise return EFI_UNSUPPORTED.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+PciResourceUpdateCheck (\r
+  IN  EFI_PCI_DEVICE_INFO           *PciDeviceInfo,\r
+  OUT VOID                          *Configuration\r
+  )\r
+{\r
+  UINT64                            Tag;\r
+  UINT64                            *ListPtr;\r
+  UINT64                            *TempListPtr;\r
+  EFI_PCI_DEVICE_INFO               *Header;\r
+  EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *AcpiPtr;\r
+  EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *OldAcpiPtr;\r
+  EFI_PCI_RESOUCE_DESCRIPTOR        *Dsc;\r
+  EFI_ACPI_END_TAG_DESCRIPTOR       *PtrEnd;\r
+  UINTN                             Index;\r
+\r
+  ASSERT (PciDeviceInfo != NULL);\r
+\r
+  //\r
+  // Initialize the return value to NULL\r
+  //\r
+  * (VOID **) Configuration = NULL;\r
+\r
+  ListPtr                   = IncompatiblePciDeviceListForResource;\r
+  while (*ListPtr != LIST_END_TAG) {\r
+\r
+    Tag = *ListPtr;\r
+\r
+    switch (Tag) {\r
+    case DEVICE_INF_TAG:\r
+      Header  = (EFI_PCI_DEVICE_INFO *) (ListPtr + 1);\r
+      ListPtr = ListPtr + 1 + sizeof (EFI_PCI_DEVICE_INFO) / sizeof (UINT64);\r
+\r
+      if (DeviceCheck (PciDeviceInfo, Header) != EFI_SUCCESS) {\r
+        continue;\r
+      }\r
+\r
+      //\r
+      // Matched an item, so construct the ACPI descriptor for the resource.\r
+      //\r
+      //\r
+      // Count the resource items so that to allocate space\r
+      //\r
+      for (Index = 0, TempListPtr = ListPtr; *TempListPtr == DEVICE_RES_TAG; Index++) {\r
+        TempListPtr = TempListPtr + 1 + ((sizeof (EFI_PCI_RESOUCE_DESCRIPTOR)) / sizeof (UINT64));\r
+      }\r
+      //\r
+      // If there is at least one type of resource request,\r
+      // allocate a acpi resource node\r
+      //\r
+      if (Index == 0) {\r
+        return EFI_ABORTED;\r
+      }\r
+\r
+      AcpiPtr = AllocateZeroPool (\r
+                  sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * Index + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR)\r
+                );\r
+\r
+      OldAcpiPtr = AcpiPtr;\r
+\r
+      //\r
+      //   Fill the EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR structure\r
+      //   according to the EFI_PCI_RESOUCE_DESCRIPTOR structure\r
+      //\r
+      for (; *ListPtr == DEVICE_RES_TAG;) {\r
+\r
+        Dsc = (EFI_PCI_RESOUCE_DESCRIPTOR *) (ListPtr + 1);\r
+\r
+        AcpiPtr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;\r
+        AcpiPtr->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);\r
+        AcpiPtr->ResType = (UINT8) Dsc->ResType;\r
+        AcpiPtr->GenFlag = (UINT8) Dsc->GenFlag;\r
+        AcpiPtr->SpecificFlag = (UINT8) Dsc->SpecificFlag;\r
+        AcpiPtr->AddrSpaceGranularity = Dsc->AddrSpaceGranularity;;\r
+        AcpiPtr->AddrRangeMin = Dsc->AddrRangeMin;\r
+        AcpiPtr->AddrRangeMax = Dsc->AddrRangeMax;\r
+        AcpiPtr->AddrTranslationOffset = Dsc->AddrTranslationOffset;\r
+        AcpiPtr->AddrLen = Dsc->AddrLen;\r
+\r
+        ListPtr = ListPtr + 1 + ((sizeof (EFI_PCI_RESOUCE_DESCRIPTOR)) / sizeof (UINT64));\r
+        AcpiPtr++;\r
+      }\r
+      //\r
+      // put the checksum\r
+      //\r
+      PtrEnd                    = (EFI_ACPI_END_TAG_DESCRIPTOR *) (AcpiPtr);\r
+      PtrEnd->Desc              = ACPI_END_TAG_DESCRIPTOR;\r
+      PtrEnd->Checksum          = 0;\r
+\r
+      *(VOID **) Configuration  = OldAcpiPtr;\r
+\r
+      return EFI_SUCCESS;\r
+\r
+    case DEVICE_RES_TAG:\r
+      //\r
+      // Adjust the pointer to the next PCI resource descriptor item\r
+      //\r
+      ListPtr = ListPtr + 1 + ((sizeof (EFI_PCI_RESOUCE_DESCRIPTOR)) / sizeof (UINT64));\r
+      break;\r
+\r
+    default:\r
+      return EFI_UNSUPPORTED;\r
+    }\r
+  }\r
+\r
+  return EFI_UNSUPPORTED;\r
+\r
+}\r
+\r
+/**\r
+  Check the incompatible device list and return configuraton register mask values.\r
+\r
+  This function searches the incompatible device list according to request\r
+  information. If the PCI device belongs to the devices list, corresponding\r
+  configuration informtion will be returned, in the meantime return EFI_SUCCESS.\r
+\r
+  @param  PciDeviceInfo       A pointer to EFI_PCI_DEVICE_INFO.\r
+  @param  AccessType          Access Type, READ or WRITE.\r
+  @param  Offset              The address within the PCI configuration space.\r
+  @param  Configuration       Returned information.\r
+\r
+  @retval returns EFI_SUCCESS if check incompatible device ok.\r
+          Otherwise return EFI_UNSUPPORTED.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+PciRegisterUpdateCheck (\r
+  IN  EFI_PCI_DEVICE_INFO           *PciDeviceInfo,\r
+  IN  UINT64                        AccessType,\r
+  IN  UINT64                        Offset,\r
+  OUT VOID                          *Configuration\r
+  )\r
+{\r
+  EFI_PCI_DEVICE_INFO               *Header;\r
+  UINT64                            Tag;\r
+  UINT64                            *ListPtr;\r
+  EFI_PCI_REGISTER_VALUE_DATA       *RegisterPtr;\r
+  EFI_PCI_REGISTER_VALUE_DATA       *Dsc;\r
+\r
+  ASSERT (PciDeviceInfo != NULL);\r
+\r
+  ListPtr                   = IncompatiblePciDeviceListForRegister;\r
+\r
+  //\r
+  // Initialize the return value to NULL\r
+  //\r
+  * (VOID **) Configuration = NULL;\r
+\r
+  while (*ListPtr != LIST_END_TAG) {\r
+\r
+    Tag = *ListPtr;\r
+\r
+    switch (Tag) {\r
+    case DEVICE_INF_TAG:\r
+      Header  = (EFI_PCI_DEVICE_INFO *) (ListPtr + 1);\r
+      ListPtr = ListPtr + 1 + sizeof (EFI_PCI_DEVICE_INFO) / sizeof (UINT64);\r
+\r
+      //\r
+      // Check whether the PCI device matches the device in the incompatible devices list?\r
+      // If not, ship next\r
+      //\r
+      if (DeviceCheck (PciDeviceInfo, Header) != EFI_SUCCESS) {\r
+        continue;\r
+      }\r
+\r
+      //\r
+      // Matched an item, check whether access matches?\r
+      //\r
+      for (; *ListPtr == DEVICE_RES_TAG;) {\r
+        ListPtr ++;\r
+        if (((EFI_PCI_REGISTER_VALUE_DESCRIPTOR *)ListPtr)->Offset == (Offset & 0xfc)) {\r
+          if (((EFI_PCI_REGISTER_VALUE_DESCRIPTOR *)ListPtr)->AccessType == AccessType) {\r
+\r
+            Dsc = (EFI_PCI_REGISTER_VALUE_DATA *) (ListPtr + 2);\r
+            RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_VALUE_DATA));\r
+\r
+            RegisterPtr->AndValue      = Dsc->AndValue;\r
+            RegisterPtr->OrValue       = Dsc->OrValue;\r
+\r
+            *(VOID **) Configuration   = RegisterPtr;\r
+\r
+            return EFI_SUCCESS;\r
+          }\r
+        }\r
+        ListPtr += sizeof (EFI_PCI_REGISTER_VALUE_DESCRIPTOR) / (sizeof (UINT64));\r
+      }\r
+      return EFI_UNSUPPORTED;\r
+\r
+    case DEVICE_RES_TAG:\r
+      //\r
+      // Adjust the pointer to the next item\r
+      //\r
+      ListPtr = ListPtr + 1 + ((sizeof (EFI_PCI_REGISTER_VALUE_DESCRIPTOR)) / sizeof (UINT64));\r
+      break;\r
+\r
+    default:\r
+      return EFI_UNSUPPORTED;\r
+    }\r
+  }\r
+\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Check the incompatible device list for access width incompatibility and\r
+  return the configuration\r
+\r
+  This function searches the incompatible device list for access width\r
+  incompatibility according to request information. If the PCI device\r
+  belongs to the devices list, corresponding configuration informtion\r
+  will be returned, in the meantime return EFI_SUCCESS.\r
+\r
+  @param  PciDeviceInfo       A pointer to PCI device information.\r
+  @param  AccessType          Access type, READ or WRITE.\r
+  @param  Offset              The address within the PCI configuration space.\r
+  @param  AccessWidth         Access width needs to check incompatibility.\r
+  @param  Configuration       Returned information.\r
+\r
+  @retval returns EFI_SUCCESS if check incompatible device ok.\r
+          Otherwise return EFI_UNSUPPORTED.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+PciRegisterAccessCheck (\r
+  IN  EFI_PCI_DEVICE_INFO           *PciDeviceInfo,\r
+  IN  UINT64                        AccessType,\r
+  IN  UINT64                        Offset,\r
+  IN  UINT64                        AccessWidth,\r
+  OUT VOID                          *Configuration\r
+  )\r
+{\r
+  EFI_PCI_DEVICE_INFO                *Header;\r
+  UINT64                             Tag;\r
+  UINT64                             *ListPtr;\r
+  EFI_PCI_REGISTER_ACCESS_DATA       *RegisterPtr;\r
+  EFI_PCI_REGISTER_ACCESS_DATA       *Dsc;\r
+\r
+  ASSERT (PciDeviceInfo != NULL);\r
+\r
+  ListPtr                   = DeviceListForAccessWidth;\r
+\r
+  //\r
+  // Initialize the return value to NULL\r
+  //\r
+  * (VOID **) Configuration = NULL;\r
+\r
+  while (*ListPtr != LIST_END_TAG) {\r
+\r
+    Tag = *ListPtr;\r
+\r
+    switch (Tag) {\r
+    case DEVICE_INF_TAG:\r
+      Header  = (EFI_PCI_DEVICE_INFO *) (ListPtr + 1);\r
+      ListPtr = ListPtr + 1 + sizeof (EFI_PCI_DEVICE_INFO) / sizeof (UINT64);\r
+\r
+      //\r
+      // Check whether the PCI device matches the device in the incompatible devices list?\r
+      // If not, ship next\r
+      //\r
+      if (DeviceCheck (PciDeviceInfo, Header) != EFI_SUCCESS) {\r
+        continue;\r
+      }\r
+\r
+      //\r
+      // Matched an item, check whether access matches?\r
+      //\r
+      for (; *ListPtr == DEVICE_RES_TAG;) {\r
+        ListPtr ++;\r
+        if (((EFI_PCI_REGISTER_ACCESS_DESCRIPTOR *) ListPtr)->AccessType == AccessType &&\r
+            ((EFI_PCI_REGISTER_ACCESS_DESCRIPTOR *) ListPtr)->AccessWidth == AccessWidth ) {\r
+\r
+          Dsc = (EFI_PCI_REGISTER_ACCESS_DATA *) (ListPtr + 2);\r
+\r
+          if((Dsc->StartOffset <= Offset) && (Dsc->EndOffset > Offset)) {\r
+\r
+            RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_ACCESS_DATA));\r
+\r
+            RegisterPtr->StartOffset      = Dsc->StartOffset;\r
+            RegisterPtr->EndOffset        = Dsc->EndOffset;\r
+            RegisterPtr->Width            = Dsc->Width;\r
+\r
+            *(VOID **) Configuration  = RegisterPtr;\r
+\r
+            return EFI_SUCCESS;\r
+          }\r
+        }\r
+        ListPtr += sizeof (EFI_PCI_REGISTER_ACCESS_DESCRIPTOR) / (sizeof (UINT64));\r
+      }\r
+      return EFI_UNSUPPORTED;\r
+\r
+    case DEVICE_RES_TAG:\r
+      //\r
+      // Adjust the pointer to the next item\r
+      //\r
+      ListPtr = ListPtr + 1 + ((sizeof (EFI_PCI_REGISTER_ACCESS_DESCRIPTOR)) / sizeof (UINT64));\r
+      break;\r
+\r
+    default:\r
+      return EFI_UNSUPPORTED;\r
+    }\r
+  }\r
+\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
diff --git a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.msa b/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.msa
new file mode 100644 (file)
index 0000000..e7b8529
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+  <MsaHeader>\r
+    <ModuleName>EdkPciIncompatibleDeviceSuppportLib</ModuleName>\r
+    <ModuleType>DXE_DRIVER</ModuleType>\r
+    <GuidValue>1ca1c1f9-5baf-4204-b6e5-5e24109a4e4e</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>PCI Incompatible device support Library</Abstract>\r
+    <Description>Check PCI incompatible devices and set necessary configuration</Description>\r
+    <Copyright>Copyright (c) 2007, Intel Corporation.</Copyright>\r
+    <License>All rights reserved. This program and the accompanying materials
+      are licensed and made available under the terms and conditions of the BSD License
+      which accompanies this distribution.  The full text of the license may be found at
+      http://opensource.org/licenses/bsd-license.php
+      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
+    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>\r
+  </MsaHeader>\r
+  <ModuleDefinitions>\r
+    <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>EdkPciIncompatibleDeviceSupportLib</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_PRODUCED">\r
+      <Keyword>PciIncompatibleDeviceSupportLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>MemoryAllocationLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>EdkPciIncompatibleDeviceSupportLib.c</Filename>\r
+    <Filename>IncompatiblePciDeviceList.h</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+  </PackageDependencies>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h b/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h
new file mode 100644 (file)
index 0000000..a00c614
--- /dev/null
@@ -0,0 +1,209 @@
+/** @file\r
+  The incompatible PCI device list\r
+\r
+Copyright (c) 2007 Intel Corporation. All rights reserved. <BR>\r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+**/\r
+\r
+#ifndef _EFI_INCOMPATIBLE_PCI_DEVICE_LIST_H\r
+#define _EFI_INCOMPATIBLE_PCI_DEVICE_LIST_H\r
+\r
+#include <IndustryStandard/pci22.h>\r
+#include <IndustryStandard/Acpi.h>\r
+\r
+\r
+#define PCI_DEVICE_ID(VendorId, DeviceId, Revision, SubVendorId, SubDeviceId) \\r
+    VendorId, DeviceId, Revision, SubVendorId, SubDeviceId\r
+\r
+#define PCI_BAR_TYPE_IO   ACPI_ADDRESS_SPACE_TYPE_IO\r
+#define PCI_BAR_TYPE_MEM  ACPI_ADDRESS_SPACE_TYPE_MEM\r
+\r
+#define DEVICE_INF_TAG    0xFFF2\r
+#define DEVICE_RES_TAG    0xFFF1\r
+#define LIST_END_TAG      0x0000\r
+\r
+//\r
+// descriptor for access width of incompatible PCI device\r
+//\r
+typedef struct {\r
+  UINT64                         AccessType;\r
+  UINT64                         AccessWidth;\r
+  EFI_PCI_REGISTER_ACCESS_DATA   PciRegisterAccessData;\r
+} EFI_PCI_REGISTER_ACCESS_DESCRIPTOR;\r
+\r
+//\r
+// descriptor for register value of incompatible PCI device\r
+//\r
+typedef struct {\r
+  UINT64                         AccessType;\r
+  UINT64                         Offset;\r
+  EFI_PCI_REGISTER_VALUE_DATA    PciRegisterValueData;\r
+} EFI_PCI_REGISTER_VALUE_DESCRIPTOR;\r
+\r
+\r
+//\r
+// the incompatible PCI devices list for ACPI resource\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForResource[] = {\r
+  //\r
+  // DEVICE_INF_TAG,\r
+  // PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),\r
+  // DEVICE_RES_TAG,\r
+  // ResType,  GFlag , SFlag,   Granularity,  RangeMin,\r
+  // RangeMax, Offset, AddrLen\r
+  //\r
+  //\r
+  // Device Adaptec 9004\r
+  //\r
+  DEVICE_INF_TAG,\r
+  PCI_DEVICE_ID(0x9004, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),\r
+  DEVICE_RES_TAG,\r
+  PCI_BAR_TYPE_IO,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_BAR_EVEN_ALIGN,\r
+  PCI_BAR_ALL,\r
+  PCI_BAR_NOCHANGE,\r
+  //\r
+  // Device Adaptec 9005\r
+  //\r
+  DEVICE_INF_TAG,\r
+  PCI_DEVICE_ID(0x9005, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),\r
+  DEVICE_RES_TAG,\r
+  PCI_BAR_TYPE_IO,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_BAR_EVEN_ALIGN,\r
+  PCI_BAR_ALL,\r
+  PCI_BAR_NOCHANGE,\r
+  //\r
+  // Device QLogic  1007\r
+  //\r
+  DEVICE_INF_TAG,\r
+  PCI_DEVICE_ID(0x1077, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),\r
+  DEVICE_RES_TAG,\r
+  PCI_BAR_TYPE_IO,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_BAR_EVEN_ALIGN,\r
+  PCI_BAR_ALL,\r
+  PCI_BAR_NOCHANGE,\r
+  //\r
+  // Device Agilent 103C\r
+  //\r
+  DEVICE_INF_TAG,\r
+  PCI_DEVICE_ID(0x103C, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),\r
+  DEVICE_RES_TAG,\r
+  PCI_BAR_TYPE_IO,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_BAR_EVEN_ALIGN,\r
+  PCI_BAR_ALL,\r
+  PCI_BAR_NOCHANGE,\r
+  //\r
+  // Device Agilent 15BC\r
+  //\r
+  DEVICE_INF_TAG,\r
+  PCI_DEVICE_ID(0x15BC, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),\r
+  DEVICE_RES_TAG,\r
+  PCI_BAR_TYPE_IO,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_ACPI_UNUSED,\r
+  PCI_BAR_EVEN_ALIGN,\r
+  PCI_BAR_ALL,\r
+  PCI_BAR_NOCHANGE,\r
+  //\r
+  // The end of the list\r
+  //\r
+  LIST_END_TAG\r
+};\r
+\r
+//\r
+// the incompatible PCI devices list for the values of configuration registers\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForRegister[] = {\r
+  //\r
+  // DEVICE_INF_TAG,\r
+  // PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),\r
+  // PCI_RES_TAG,\r
+  // PCI_ACCESS_TYPE, PCI_CONFIG_ADDRESS,\r
+  // AND_VALUE, OR_VALUE\r
+\r
+  //\r
+  // Device Lava 0x1407, DeviceId 0x0110\r
+  //\r
+  DEVICE_INF_TAG,\r
+  PCI_DEVICE_ID(0x1407, 0x0110, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),\r
+  DEVICE_RES_TAG,\r
+  PCI_REGISTER_READ,\r
+  PCI_CAPBILITY_POINTER_OFFSET,\r
+  0xffffff00,\r
+  VALUE_NOCARE,\r
+\r
+  //\r
+  // Device Lava 0x1407, DeviceId 0x0111\r
+  //\r
+  DEVICE_INF_TAG,\r
+  PCI_DEVICE_ID(0x1407, 0x0111, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),\r
+  DEVICE_RES_TAG,\r
+  PCI_REGISTER_READ,\r
+  PCI_CAPBILITY_POINTER_OFFSET,\r
+  0xffffff00,\r
+  VALUE_NOCARE,\r
+\r
+  //\r
+  // The end of the list\r
+  //\r
+  LIST_END_TAG\r
+};\r
+\r
+//\r
+// the incompatible PCI devices list for the access width of configuration registers\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED UINT64 DeviceListForAccessWidth[] = {\r
+  //\r
+  // DEVICE_INF_TAG,\r
+  // PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),\r
+  // DEVICE_RES_TAG,\r
+  // PCI_ACCESS_TYPE, PCI_ACCESS_WIDTH,\r
+  // START_ADDRESS, END_ADDRESS,\r
+  // ACTUAL_PCI_ACCESS_WIDTH,\r
+  //\r
+\r
+  //\r
+  // Sample Device\r
+  //\r
+  //DEVICE_INF_TAG,\r
+  //PCI_DEVICE_ID(0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),\r
+  //DEVICE_RES_TAG,\r
+  //PCI_REGISTER_READ,\r
+  //EfiPciWidthUint8,\r
+  //0,\r
+  //0xFF,\r
+  //EfiPciWidthUint32,\r
+  //\r
+\r
+  //\r
+  // The end of the list\r
+  //\r
+  LIST_END_TAG\r
+};\r
+\r
+#endif\r