]> git.proxmox.com Git - mirror_edk2.git/commitdiff
fixed ECC and Klocwork issues.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 9 Jun 2009 03:47:29 +0000 (03:47 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 9 Jun 2009 03:47:29 +0000 (03:47 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8501 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.h
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.h
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c

index 8f2e29c16e1020db597294ab9ebb88a2c2784806..4e206ff3b11b2c33fdcba42bc93ff9628b65dab2 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006, Intel Corporation\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
@@ -128,7 +128,9 @@ typedef struct {
 #define EFI_SET_SUPPORTS    0\r
 #define EFI_SET_ATTRIBUTES  1\r
 \r
-typedef struct _PCI_IO_DEVICE {\r
+typedef struct _PCI_IO_DEVICE              PCI_IO_DEVICE;\r
+\r
+struct _PCI_IO_DEVICE {\r
   UINT32                                    Signature;\r
   EFI_HANDLE                                Handle;\r
   EFI_PCI_IO_PROTOCOL                       PciIo;\r
@@ -159,7 +161,7 @@ typedef struct _PCI_IO_DEVICE {
   //\r
   // The bridge device this pci device is subject to\r
   //\r
-  struct _PCI_IO_DEVICE                     *Parent;\r
+  PCI_IO_DEVICE                             *Parent;\r
 \r
   //\r
   // A linked list for children Pci Device if it is bridge device\r
@@ -227,7 +229,7 @@ typedef struct _PCI_IO_DEVICE {
 \r
   BOOLEAN                                   IsPciExp;\r
 \r
-} PCI_IO_DEVICE;\r
+};\r
 \r
 \r
 #define PCI_IO_DEVICE_FROM_PCI_IO_THIS(a) \\r
index bf66552185f0456877da23de51290a111f4e664f..101bce18d5eceeaa26b8d688e490abbd05df7375 100644 (file)
@@ -97,8 +97,7 @@
   gEfiPciRootBridgeIoProtocolGuid               # PROTOCOL TO_START\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL TO_START\r
   gEfiIncompatiblePciDeviceSupportProtocolGuid  # PROTOCOL TO_START\r
-  gEfiUgaIoProtocolGuid                         # ALWAYS_CONSUMED     System Table\r
-  gEfiLoadFile2ProtocolGuid                                            # SOMETIMES_CONSUMED\r
+  gEfiLoadFile2ProtocolGuid                                                      # SOMETIMES_CONSUMED\r
 \r
 [FeaturePcd.common]\r
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciVgaEnable\r
index 43e7cb062ef0d48f76833258f44359d299ce0b67..687e007b5a3252c6bbc42aae55d93c4c53bffcd5 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation                                                         \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
@@ -1005,7 +1005,7 @@ PciHostBridgeAdjustAllocation (
   @param PMem32Node       Pointer to instance of 32-bit Pmemory resource node\r
   @param Mem64Node        Pointer to instance of 64-bit memory resource node\r
   @param PMem64Node       Pointer to instance of 64-bit Pmemory resource node\r
-  @param pConfig          outof buffer holding new constructed APCI resource requestor\r
+  @param Config           Output buffer holding new constructed APCI resource requestor\r
 **/\r
 EFI_STATUS\r
 ConstructAcpiResourceRequestor (\r
@@ -1015,7 +1015,7 @@ ConstructAcpiResourceRequestor (
   IN PCI_RESOURCE_NODE  *PMem32Node,\r
   IN PCI_RESOURCE_NODE  *Mem64Node,\r
   IN PCI_RESOURCE_NODE  *PMem64Node,\r
-  OUT VOID              **pConfig\r
+  OUT VOID              **Config\r
   )\r
 {\r
   UINT8                             NumConfig;\r
@@ -1027,7 +1027,7 @@ ConstructAcpiResourceRequestor (
   NumConfig = 0;\r
   Aperture  = 0;\r
 \r
-  *pConfig  = NULL;\r
+  *Config  = NULL;\r
 \r
   //\r
   // if there is io request, add to the io aperture\r
@@ -1228,26 +1228,27 @@ ConstructAcpiResourceRequestor (
     PtrEnd->Checksum  = 0;\r
   }\r
 \r
-  *pConfig = Configuration;\r
+  *Config = Configuration;\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
-  Get resource base from a acpi configuration descriptor.\r
+  Get resource base from an acpi configuration descriptor.\r
   \r
-  @param pConfig      an acpi configuration descriptor.\r
+  @param Config       an acpi configuration descriptor.\r
   @param IoBase       output of I/O resource base address.\r
   @param Mem32Base    output of 32-bit memory base address.\r
   @param PMem32Base   output of 32-bit pmemory base address.\r
   @param Mem64Base    output of 64-bit memory base address.\r
   @param PMem64Base   output of 64-bit pmemory base address.\r
   \r
-  @return EFI_SUCCESS  Success operation.\r
+  @return EFI_SUCCESS    Get resource base address successfully.\r
+\r
 **/\r
 EFI_STATUS\r
 GetResourceBase (\r
-  IN VOID     *pConfig,\r
+  IN VOID     *Config,\r
   OUT UINT64  *IoBase,\r
   OUT UINT64  *Mem32Base,\r
   OUT UINT64  *PMem32Base,\r
@@ -1259,13 +1260,15 @@ GetResourceBase (
   EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;\r
   UINT64                            ResStatus;\r
 \r
+  ASSERT (Config != NULL);\r
+\r
   *IoBase     = 0xFFFFFFFFFFFFFFFFULL;\r
   *Mem32Base  = 0xFFFFFFFFFFFFFFFFULL;\r
   *PMem32Base = 0xFFFFFFFFFFFFFFFFULL;\r
   *Mem64Base  = 0xFFFFFFFFFFFFFFFFULL;\r
   *PMem64Base = 0xFFFFFFFFFFFFFFFFULL;\r
 \r
-  Temp        = (UINT8 *) pConfig;\r
+  Temp        = (UINT8 *) Config;\r
 \r
   while (*Temp == ACPI_ADDRESS_SPACE_DESCRIPTOR) {\r
 \r
index fe3d2afa84d8fd5ed2d93a09fe962bd8e17e3b20..2c0eec7d34a77b3328e978f1a43ab1da2bde6947 100644 (file)
@@ -231,7 +231,7 @@ PciHostBridgeAdjustAllocation (
   @param PMem32Node       Pointer to instance of 32-bit Pmemory resource node.\r
   @param Mem64Node        Pointer to instance of 64-bit memory resource node.\r
   @param PMem64Node       Pointer to instance of 64-bit Pmemory resource node.\r
-  @param pConfig          outof buffer holding new constructed APCI resource requestor.\r
+  @param Config           Output buffer holding new constructed APCI resource requestor.\r
 **/\r
 EFI_STATUS\r
 ConstructAcpiResourceRequestor (\r
@@ -241,24 +241,25 @@ ConstructAcpiResourceRequestor (
   IN PCI_RESOURCE_NODE  *PMem32Node,\r
   IN PCI_RESOURCE_NODE  *Mem64Node,\r
   IN PCI_RESOURCE_NODE  *PMem64Node,\r
-  OUT VOID              **pConfig\r
+  OUT VOID              **Config\r
   );\r
 \r
 /**\r
-  Get resource base from a acpi configuration descriptor.\r
+  Get resource base from an acpi configuration descriptor.\r
   \r
-  @param pConfig      an acpi configuration descriptor.\r
+  @param Config       an acpi configuration descriptor.\r
   @param IoBase       output of I/O resource base address.\r
   @param Mem32Base    output of 32-bit memory base address.\r
   @param PMem32Base   output of 32-bit pmemory base address.\r
   @param Mem64Base    output of 64-bit memory base address.\r
   @param PMem64Base   output of 64-bit pmemory base address.\r
   \r
-  @return EFI_SUCCESS  Success operation.\r
+  @return EFI_SUCCESS    Get resource base address successfully.\r
+\r
 **/\r
 EFI_STATUS\r
 GetResourceBase (\r
-  IN VOID     *pConfig,\r
+  IN VOID     *Config,\r
   OUT UINT64  *IoBase,\r
   OUT UINT64  *Mem32Base,\r
   OUT UINT64  *PMem32Base,\r
index ae5b7db8da8105797f8f4332c060a6df9ff4f13a..99e7a0b11dd377e8841efacd30b17b52ee3a1420 100644 (file)
@@ -362,7 +362,7 @@ GatherDeviceInfo (
   //\r
   // Start to parse the bars\r
   //\r
-  for (Offset = 0x10, BarIndex = 0; Offset <= 0x24; BarIndex++) {\r
+  for (Offset = 0x10, BarIndex = 0; Offset <= 0x24 && BarIndex < PCI_MAX_BAR; BarIndex++) {\r
     Offset = PciParseBar (PciIoDevice, Offset, BarIndex);\r
   }\r
 \r
@@ -1147,7 +1147,7 @@ UpdatePciInfo (
     }\r
   }\r
 \r
-  if (EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status) || Configuration == NULL ) {\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
index 7a870090cce63cca478b30f93b45bdcc8a54eb4d..486e318fca070644bf1ab6b09f1f589dc22d5835 100644 (file)
@@ -466,7 +466,6 @@ PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
                             RootBridgeDev->Handle,\r
                             &AcpiConfig\r
                             );\r
-\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
@@ -551,9 +550,7 @@ PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
       PMem64Bridge\r
       );\r
 \r
-    if (AcpiConfig != NULL) {\r
-      FreePool (AcpiConfig);\r
-    }\r
+    FreePool (AcpiConfig);\r
   }\r
 \r
   //\r
@@ -1044,9 +1041,7 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
       PMem64Bridge\r
       );\r
 \r
-    if (AcpiConfig != NULL) {\r
-      gBS->FreePool (AcpiConfig);\r
-    }\r
+    FreePool (AcpiConfig);\r
   }\r
 \r
   //\r
index e30277301aba4270b8b4f6aea69473162ab4b18c..a674cadea0088b6e54ca9b482368c6c68c309188 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation\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
@@ -153,9 +153,9 @@ LocalLoadFile2 (
 }\r
 \r
 /**\r
-  Initialize a PCI LoadFile2 instance\r
+  Initialize a PCI LoadFile2 instance.\r
   \r
-  @param PciIoDevice - PCI IO Device\r
+  @param PciIoDevice   PCI IO Device.\r
 \r
 **/\r
 VOID\r
index d245f3e0f13703339c26baff4b280cc40a85a463..60b7adcb85dc042ff4ac68caafc007c06153c5fa 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \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
@@ -17,9 +17,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/LoadFile2.h>\r
 \r
 /**\r
-  Initialize a PCI LoadFile2 instance\r
+  Initialize a PCI LoadFile2 instance.\r
   \r
-  @param PciIoDevice - PCI IO Device\r
+  @param PciIoDevice   PCI IO Device.\r
 \r
 **/\r
 VOID\r
@@ -38,7 +38,7 @@ InitializePciLoadFile2 (
                      On output with a return code of EFI_BUFFER_TOO_SMALL, \r
                      the size of Buffer required to retrieve the requested file. \r
   @param Buffer      The memory buffer to transfer the file to. If Buffer is NULL, \r
-                    then no the size of the requested file is returned in BufferSize.\r
+                     then no the size of the requested file is returned in BufferSize.\r
 \r
   @retval EFI_SUCCESS           The file was loaded. \r
   @retval EFI_UNSUPPORTED       BootPolicy is TRUE.\r
index d761832bf6b93c8092acaee3300838b2fa69ed1c..e7e40012c3b5dd9237c7c70ec704227edd93542b 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation\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
@@ -105,6 +105,9 @@ InsertResourceNode (
   UINT64            ResNodeAlignRest;\r
   UINT64            TempAlignRest;\r
 \r
+  ASSERT (Bridge  != NULL);\r
+  ASSERT (ResNode != NULL);\r
+\r
   InsertHeadList (&Bridge->ChildList, &ResNode->Link);\r
 \r
   CurrentLink = Bridge->ChildList.ForwardLink->ForwardLink;\r
@@ -160,6 +163,9 @@ MergeResourceTree (
   LIST_ENTRY        *CurrentLink;\r
   PCI_RESOURCE_NODE *Temp;\r
 \r
+  ASSERT (Dst != NULL);\r
+  ASSERT (Res != NULL);\r
+\r
   while (!IsListEmpty (&Res->ChildList)) {\r
     CurrentLink = Res->ChildList.ForwardLink;\r
 \r
@@ -1112,6 +1118,7 @@ ProgramBar (
   //\r
   Node->PciDev->Allocated = TRUE;\r
 \r
+  ASSERT (Node->Bar < PCI_MAX_BAR);\r
   switch ((Node->PciDev->PciBar[Node->Bar]).BarType) {\r
 \r
   case PciBarTypeIo16:\r