]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.c
Code scrub for PCI Bus module and PciIncompatibleDeviceSupportLib module.
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / PciIncompatibleDeviceSupportLib / PciIncompatibleDeviceSupportLib.c
index 61a936de1291e9aec6cd7b41fcdf0ae4e463544c..4934d4e2c1d0ff7e42c6349616e9d923425c473c 100644 (file)
@@ -1,26 +1,32 @@
 /** @file\r
-  The implementation of PCI incompatible device support libary.\r
+  The template of PCI incompatible device support libary.\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 - 2009, 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
 **/\r
 \r
 #include "IncompatiblePciDeviceList.h"\r
 \r
+EFI_PCI_REGISTER_ACCESS_DATA mPciRegisterAccessData = {0, 0, 0}; \r
+EFI_PCI_REGISTER_VALUE_DATA  mPciRegisterValueData  = {0, 0};\r
\r
+\r
 /**\r
-  Check whether two PCI devices matched\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
+  @param  PciDeviceInfo      A pointer to EFI_PCI_DEVICE_INFO.\r
+  @param  Header             A pointer to EFI_PCI_DEVICE_INFO.\r
+\r
+  @retval EFI_SUCCESS        Two PCI devices matched.\r
+  @retval EFI_UNSUPPORTED    Two PCI devices don't match.\r
 \r
-  @retval returns EFI_SUCCESS if two PCI device matched.\r
 **/\r
 EFI_STATUS\r
 DeviceCheck (\r
@@ -67,19 +73,22 @@ DeviceCheck (
 \r
 /**\r
   Check the incompatible device list for ACPI resource update and return\r
-  the configuration\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
+  @param  PciDeviceInfo        A pointer to PCI device information.\r
+  @param  Configuration        Returned information.\r
+\r
+  @retval EFI_SUCCESS          If check incompatible device successfully.\r
+  @retval EFI_ABORTED          No any resource type.\r
+  @retval EFI_OUT_OF_RESOURCES No memory available.\r
+  @retval EFI_UNSUPPORTED      Invalid Tag encounted.\r
 \r
-  @retval returns EFI_SUCCESS if check incompatible device ok.\r
-          Otherwise return EFI_UNSUPPORTED.\r
 **/\r
-RETURN_STATUS\r
+EFI_STATUS\r
 EFIAPI\r
 PciResourceUpdateCheck (\r
   IN  EFI_PCI_DEVICE_INFO           *PciDeviceInfo,\r
@@ -103,7 +112,7 @@ PciResourceUpdateCheck (
   //\r
   * (VOID **) Configuration = NULL;\r
 \r
-  ListPtr                   = IncompatiblePciDeviceListForResource;\r
+  ListPtr                   = gIncompatiblePciDeviceListForResource;\r
   while (*ListPtr != LIST_END_TAG) {\r
 \r
     Tag = *ListPtr;\r
@@ -136,7 +145,7 @@ PciResourceUpdateCheck (
 \r
       AcpiPtr = AllocateZeroPool (\r
                   sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * Index + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR)\r
-                );\r
+                  );\r
       if (AcpiPtr == NULL) {\r
         return EFI_OUT_OF_RESOURCES;\r
       }\r
@@ -204,10 +213,11 @@ PciResourceUpdateCheck (
   @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
+  @retval EFI_SUCCESS         If check incompatible device successfully.\r
+  @retval EFI_UNSUPPORTED     Failed to check incompatibility device.\r
+\r
 **/\r
-RETURN_STATUS\r
+EFI_STATUS\r
 EFIAPI\r
 PciRegisterUpdateCheck (\r
   IN  EFI_PCI_DEVICE_INFO           *PciDeviceInfo,\r
@@ -224,7 +234,7 @@ PciRegisterUpdateCheck (
 \r
   ASSERT (PciDeviceInfo != NULL);\r
 \r
-  ListPtr                   = IncompatiblePciDeviceListForRegister;\r
+  ListPtr                   = gIncompatiblePciDeviceListForRegister;\r
 \r
   //\r
   // Initialize the return value to NULL\r
@@ -257,10 +267,8 @@ PciRegisterUpdateCheck (
           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
-            if (RegisterPtr == NULL) {\r
-              return EFI_SUCCESS;\r
-            }\r
\r
+            RegisterPtr = &mPciRegisterValueData;\r
 \r
             RegisterPtr->AndValue      = Dsc->AndValue;\r
             RegisterPtr->OrValue       = Dsc->OrValue;\r
@@ -304,10 +312,11 @@ PciRegisterUpdateCheck (
   @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
+  @retval EFI_SUCCESS         If check incompatible device successfully.\r
+  @retval EFI_UNSUPPORTED     Failed to check incompatibility device.\r
+\r
 **/\r
-RETURN_STATUS\r
+EFI_STATUS\r
 EFIAPI\r
 PciRegisterAccessCheck (\r
   IN  EFI_PCI_DEVICE_INFO           *PciDeviceInfo,\r
@@ -325,7 +334,7 @@ PciRegisterAccessCheck (
 \r
   ASSERT (PciDeviceInfo != NULL);\r
 \r
-  ListPtr                   = DeviceListForAccessWidth;\r
+  ListPtr                   = gDeviceListForAccessWidth;\r
 \r
   //\r
   // Initialize the return value to NULL\r
@@ -361,10 +370,7 @@ PciRegisterAccessCheck (
 \r
           if((Dsc->StartOffset <= Offset) && (Dsc->EndOffset > Offset)) {\r
 \r
-            RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_ACCESS_DATA));\r
-            if (RegisterPtr == NULL) {\r
-              return EFI_OUT_OF_RESOURCES;\r
-            }\r
+            RegisterPtr = &mPciRegisterAccessData;\r
 \r
             RegisterPtr->StartOffset      = Dsc->StartOffset;\r
             RegisterPtr->EndOffset        = Dsc->EndOffset;\r