summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Bus/Pci
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-09 03:47:29 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-09 03:47:29 +0000
commitc72216a6274deaaee46ebf58e3ae84f119a94b7f (patch)
tree6192c5e157fa844fa2d4a90d823f8abec7e54ef8 /IntelFrameworkModulePkg/Bus/Pci
parent261c3596a30b92539109894541f17d5f6b7c985a (diff)
downloadedk2-platforms-c72216a6274deaaee46ebf58e3ae84f119a94b7f.tar.xz
fixed ECC and Klocwork issues.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8501 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Bus/Pci')
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h10
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf3
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c23
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.h13
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c4
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.c9
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c6
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.h8
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c9
9 files changed, 46 insertions, 39 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h
index 8f2e29c16e..4e206ff3b1 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
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
@@ -128,7 +128,9 @@ typedef struct {
#define EFI_SET_SUPPORTS 0
#define EFI_SET_ATTRIBUTES 1
-typedef struct _PCI_IO_DEVICE {
+typedef struct _PCI_IO_DEVICE PCI_IO_DEVICE;
+
+struct _PCI_IO_DEVICE {
UINT32 Signature;
EFI_HANDLE Handle;
EFI_PCI_IO_PROTOCOL PciIo;
@@ -159,7 +161,7 @@ typedef struct _PCI_IO_DEVICE {
//
// The bridge device this pci device is subject to
//
- struct _PCI_IO_DEVICE *Parent;
+ PCI_IO_DEVICE *Parent;
//
// A linked list for children Pci Device if it is bridge device
@@ -227,7 +229,7 @@ typedef struct _PCI_IO_DEVICE {
BOOLEAN IsPciExp;
-} PCI_IO_DEVICE;
+};
#define PCI_IO_DEVICE_FROM_PCI_IO_THIS(a) \
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
index bf66552185..101bce18d5 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
@@ -97,8 +97,7 @@
gEfiPciRootBridgeIoProtocolGuid # PROTOCOL TO_START
gEfiDevicePathProtocolGuid # PROTOCOL TO_START
gEfiIncompatiblePciDeviceSupportProtocolGuid # PROTOCOL TO_START
- gEfiUgaIoProtocolGuid # ALWAYS_CONSUMED System Table
- gEfiLoadFile2ProtocolGuid # SOMETIMES_CONSUMED
+ gEfiLoadFile2ProtocolGuid # SOMETIMES_CONSUMED
[FeaturePcd.common]
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciVgaEnable
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
index 43e7cb062e..687e007b5a 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006 - 2008, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
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
@@ -1005,7 +1005,7 @@ PciHostBridgeAdjustAllocation (
@param PMem32Node Pointer to instance of 32-bit Pmemory resource node
@param Mem64Node Pointer to instance of 64-bit memory resource node
@param PMem64Node Pointer to instance of 64-bit Pmemory resource node
- @param pConfig outof buffer holding new constructed APCI resource requestor
+ @param Config Output buffer holding new constructed APCI resource requestor
**/
EFI_STATUS
ConstructAcpiResourceRequestor (
@@ -1015,7 +1015,7 @@ ConstructAcpiResourceRequestor (
IN PCI_RESOURCE_NODE *PMem32Node,
IN PCI_RESOURCE_NODE *Mem64Node,
IN PCI_RESOURCE_NODE *PMem64Node,
- OUT VOID **pConfig
+ OUT VOID **Config
)
{
UINT8 NumConfig;
@@ -1027,7 +1027,7 @@ ConstructAcpiResourceRequestor (
NumConfig = 0;
Aperture = 0;
- *pConfig = NULL;
+ *Config = NULL;
//
// if there is io request, add to the io aperture
@@ -1228,26 +1228,27 @@ ConstructAcpiResourceRequestor (
PtrEnd->Checksum = 0;
}
- *pConfig = Configuration;
+ *Config = Configuration;
return EFI_SUCCESS;
}
/**
- Get resource base from a acpi configuration descriptor.
+ Get resource base from an acpi configuration descriptor.
- @param pConfig an acpi configuration descriptor.
+ @param Config an acpi configuration descriptor.
@param IoBase output of I/O resource base address.
@param Mem32Base output of 32-bit memory base address.
@param PMem32Base output of 32-bit pmemory base address.
@param Mem64Base output of 64-bit memory base address.
@param PMem64Base output of 64-bit pmemory base address.
- @return EFI_SUCCESS Success operation.
+ @return EFI_SUCCESS Get resource base address successfully.
+
**/
EFI_STATUS
GetResourceBase (
- IN VOID *pConfig,
+ IN VOID *Config,
OUT UINT64 *IoBase,
OUT UINT64 *Mem32Base,
OUT UINT64 *PMem32Base,
@@ -1259,13 +1260,15 @@ GetResourceBase (
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
UINT64 ResStatus;
+ ASSERT (Config != NULL);
+
*IoBase = 0xFFFFFFFFFFFFFFFFULL;
*Mem32Base = 0xFFFFFFFFFFFFFFFFULL;
*PMem32Base = 0xFFFFFFFFFFFFFFFFULL;
*Mem64Base = 0xFFFFFFFFFFFFFFFFULL;
*PMem64Base = 0xFFFFFFFFFFFFFFFFULL;
- Temp = (UINT8 *) pConfig;
+ Temp = (UINT8 *) Config;
while (*Temp == ACPI_ADDRESS_SPACE_DESCRIPTOR) {
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.h
index fe3d2afa84..2c0eec7d34 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.h
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.h
@@ -231,7 +231,7 @@ PciHostBridgeAdjustAllocation (
@param PMem32Node Pointer to instance of 32-bit Pmemory resource node.
@param Mem64Node Pointer to instance of 64-bit memory resource node.
@param PMem64Node Pointer to instance of 64-bit Pmemory resource node.
- @param pConfig outof buffer holding new constructed APCI resource requestor.
+ @param Config Output buffer holding new constructed APCI resource requestor.
**/
EFI_STATUS
ConstructAcpiResourceRequestor (
@@ -241,24 +241,25 @@ ConstructAcpiResourceRequestor (
IN PCI_RESOURCE_NODE *PMem32Node,
IN PCI_RESOURCE_NODE *Mem64Node,
IN PCI_RESOURCE_NODE *PMem64Node,
- OUT VOID **pConfig
+ OUT VOID **Config
);
/**
- Get resource base from a acpi configuration descriptor.
+ Get resource base from an acpi configuration descriptor.
- @param pConfig an acpi configuration descriptor.
+ @param Config an acpi configuration descriptor.
@param IoBase output of I/O resource base address.
@param Mem32Base output of 32-bit memory base address.
@param PMem32Base output of 32-bit pmemory base address.
@param Mem64Base output of 64-bit memory base address.
@param PMem64Base output of 64-bit pmemory base address.
- @return EFI_SUCCESS Success operation.
+ @return EFI_SUCCESS Get resource base address successfully.
+
**/
EFI_STATUS
GetResourceBase (
- IN VOID *pConfig,
+ IN VOID *Config,
OUT UINT64 *IoBase,
OUT UINT64 *Mem32Base,
OUT UINT64 *PMem32Base,
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index ae5b7db8da..99e7a0b11d 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -362,7 +362,7 @@ GatherDeviceInfo (
//
// Start to parse the bars
//
- for (Offset = 0x10, BarIndex = 0; Offset <= 0x24; BarIndex++) {
+ for (Offset = 0x10, BarIndex = 0; Offset <= 0x24 && BarIndex < PCI_MAX_BAR; BarIndex++) {
Offset = PciParseBar (PciIoDevice, Offset, BarIndex);
}
@@ -1147,7 +1147,7 @@ UpdatePciInfo (
}
}
- if (EFI_ERROR (Status)) {
+ if (EFI_ERROR (Status) || Configuration == NULL ) {
return EFI_UNSUPPORTED;
}
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.c
index 7a870090cc..486e318fca 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.c
@@ -466,7 +466,6 @@ PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
RootBridgeDev->Handle,
&AcpiConfig
);
-
if (EFI_ERROR (Status)) {
return Status;
}
@@ -551,9 +550,7 @@ PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
PMem64Bridge
);
- if (AcpiConfig != NULL) {
- FreePool (AcpiConfig);
- }
+ FreePool (AcpiConfig);
}
//
@@ -1044,9 +1041,7 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
PMem64Bridge
);
- if (AcpiConfig != NULL) {
- gBS->FreePool (AcpiConfig);
- }
+ FreePool (AcpiConfig);
}
//
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
index e30277301a..a674cadea0 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006 - 2008, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
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
@@ -153,9 +153,9 @@ LocalLoadFile2 (
}
/**
- Initialize a PCI LoadFile2 instance
+ Initialize a PCI LoadFile2 instance.
- @param PciIoDevice - PCI IO Device
+ @param PciIoDevice PCI IO Device.
**/
VOID
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.h
index d245f3e0f1..60b7adcb85 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.h
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.h
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
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
@@ -17,9 +17,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/LoadFile2.h>
/**
- Initialize a PCI LoadFile2 instance
+ Initialize a PCI LoadFile2 instance.
- @param PciIoDevice - PCI IO Device
+ @param PciIoDevice PCI IO Device.
**/
VOID
@@ -38,7 +38,7 @@ InitializePciLoadFile2 (
On output with a return code of EFI_BUFFER_TOO_SMALL,
the size of Buffer required to retrieve the requested file.
@param Buffer The memory buffer to transfer the file to. If Buffer is NULL,
- then no the size of the requested file is returned in BufferSize.
+ then no the size of the requested file is returned in BufferSize.
@retval EFI_SUCCESS The file was loaded.
@retval EFI_UNSUPPORTED BootPolicy is TRUE.
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c
index d761832bf6..e7e40012c3 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006 - 2008, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
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
@@ -105,6 +105,9 @@ InsertResourceNode (
UINT64 ResNodeAlignRest;
UINT64 TempAlignRest;
+ ASSERT (Bridge != NULL);
+ ASSERT (ResNode != NULL);
+
InsertHeadList (&Bridge->ChildList, &ResNode->Link);
CurrentLink = Bridge->ChildList.ForwardLink->ForwardLink;
@@ -160,6 +163,9 @@ MergeResourceTree (
LIST_ENTRY *CurrentLink;
PCI_RESOURCE_NODE *Temp;
+ ASSERT (Dst != NULL);
+ ASSERT (Res != NULL);
+
while (!IsListEmpty (&Res->ChildList)) {
CurrentLink = Res->ChildList.ForwardLink;
@@ -1112,6 +1118,7 @@ ProgramBar (
//
Node->PciDev->Allocated = TRUE;
+ ASSERT (Node->Bar < PCI_MAX_BAR);
switch ((Node->PciDev->PciBar[Node->Bar]).BarType) {
case PciBarTypeIo16: