fixed ECC and Klocwork issues.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8501 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2009-06-09 03:47:29 +00:00
parent 261c3596a3
commit c72216a627
9 changed files with 46 additions and 39 deletions

View File

@ -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) \

View File

@ -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

View File

@ -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) {

View File

@ -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,

View File

@ -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;
}

View File

@ -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);
}
//

View File

@ -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

View File

@ -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.

View File

@ -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: