Fix comparisons of enumerated types which may cause warnings for some compilers.

Signed-off-by: Sun Rui <rui.sun@intel.com>
Reviewed-by: Gao Liming <liming.gao@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13686 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
rsun3 2012-08-28 06:48:28 +00:00
parent 055c829c42
commit 3d78c020d2
24 changed files with 92 additions and 94 deletions

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.<BR> Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -343,7 +343,7 @@ Returns:
--*/ --*/
{ {
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -404,7 +404,7 @@ Returns:
{ {
UINT64 ExtendOffset; UINT64 ExtendOffset;
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -465,7 +465,7 @@ Returns:
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -521,7 +521,7 @@ Returns:
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width > EfiPciIoWidthUint64) { if ((UINT32)Width > EfiPciIoWidthUint64) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -576,7 +576,7 @@ Returns:
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -629,7 +629,7 @@ Returns:
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -682,7 +682,7 @@ Returns:
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -735,7 +735,7 @@ Returns:
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -877,7 +877,7 @@ Returns:
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -942,7 +942,7 @@ Returns:
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Operation < 0 || Operation >= EfiPciIoOperationMaximum) { if ((UINT32)Operation >= EfiPciIoOperationMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -363,7 +363,7 @@ Returns:
Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This); Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
if (Width < 0 || Width >= MMIO_COPY_UINT8) { if ((UINT32)Width >= MMIO_COPY_UINT8) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -415,7 +415,7 @@ Returns:
Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This); Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
if (Width < 0 || Width >= MMIO_COPY_UINT8) { if ((UINT32)Width >= MMIO_COPY_UINT8) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -648,7 +648,7 @@ Returns:
Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This); Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
if (Operation < 0 || Operation > EfiBusMasterCommonBuffer) { if ((UINT32)Operation > EfiBusMasterCommonBuffer) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -748,7 +748,7 @@ Returns:
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if ((Type >= MaxAllocateType) || (Type < AllocateAnyPages)) { if ((UINT32)Type >= MaxAllocateType) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -102,7 +102,7 @@ PcatRootBridgeIoPciRW (
UINT64 PciExpressRegAddr; UINT64 PciExpressRegAddr;
BOOLEAN UsePciExpressAccess; BOOLEAN UsePciExpressAccess;
if (Width < 0 || Width >= EfiPciWidthMaximum) { if ((UINT32)Width >= EfiPciWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.<BR> Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -81,7 +81,7 @@ PcatRootBridgeIoIoRead (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (Width < 0 || Width >= EfiPciWidthMaximum) { if ((UINT32)Width >= EfiPciWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.<BR> Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -256,7 +256,7 @@ PcatRootBridgeIoPollMem (
} }
if (Width < 0 || Width > EfiPciWidthUint64) { if ((UINT32)Width > EfiPciWidthUint64) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// //
@ -319,7 +319,7 @@ PcatRootBridgeIoPollIo (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (Width < 0 || Width > EfiPciWidthUint64) { if ((UINT32)Width > EfiPciWidthUint64) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// //
@ -412,7 +412,7 @@ PcatRootBridgeIoMemRead (
In.buf = Buffer; In.buf = Buffer;
Out.buf = (VOID *)(UINTN) Address; Out.buf = (VOID *)(UINTN) Address;
if (Width >= EfiPciWidthUint8 && Width <= EfiPciWidthUint64) { if ((UINT32)Width <= EfiPciWidthUint64) {
return PcatRootBridgeIoMemRW (Width, Count, TRUE, In, TRUE, Out); return PcatRootBridgeIoMemRW (Width, Count, TRUE, In, TRUE, Out);
} }
if (Width >= EfiPciWidthFifoUint8 && Width <= EfiPciWidthFifoUint64) { if (Width >= EfiPciWidthFifoUint8 && Width <= EfiPciWidthFifoUint64) {
@ -459,7 +459,7 @@ PcatRootBridgeIoMemWrite (
In.buf = (VOID *)(UINTN) Address; In.buf = (VOID *)(UINTN) Address;
Out.buf = Buffer; Out.buf = Buffer;
if (Width >= EfiPciWidthUint8 && Width <= EfiPciWidthUint64) { if ((UINT32)Width <= EfiPciWidthUint64) {
return PcatRootBridgeIoMemRW (Width, Count, TRUE, In, TRUE, Out); return PcatRootBridgeIoMemRW (Width, Count, TRUE, In, TRUE, Out);
} }
if (Width >= EfiPciWidthFifoUint8 && Width <= EfiPciWidthFifoUint64) { if (Width >= EfiPciWidthFifoUint8 && Width <= EfiPciWidthFifoUint64) {
@ -489,7 +489,7 @@ PcatRootBridgeIoCopyMem (
UINTN Index; UINTN Index;
UINT64 Result; UINT64 Result;
if (Width < 0 || Width > EfiPciWidthUint64) { if ((UINT32)Width > EfiPciWidthUint64) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -609,7 +609,7 @@ PcatRootBridgeIoMap (
// //
// Make sure that Operation is valid // Make sure that Operation is valid
// //
if (Operation < 0 || Operation >= EfiPciOperationMaximum) { if ((UINT32)Operation >= EfiPciOperationMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -102,7 +102,7 @@ PcatRootBridgeIoPciRW (
UINT64 PciExpressRegAddr; UINT64 PciExpressRegAddr;
BOOLEAN UsePciExpressAccess; BOOLEAN UsePciExpressAccess;
if (Width < 0 || Width >= EfiPciWidthMaximum) { if ((UINT32)Width >= EfiPciWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -12,7 +12,7 @@ This module module layers Device I/O on top of PCI Root Bridge I/O (Segment 0)
Platform required to support EFI drivers that consume Device I/O Platform required to support EFI drivers that consume Device I/O
Platform required to support EFI applications that consume Device I/O Platform required to support EFI applications that consume Device I/O
Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -758,7 +758,7 @@ DeviceIoPciRead (
Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This); Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
if (Width < 0 || Width >= MMIO_COPY_UINT8) { if ((UINT32)Width >= MMIO_COPY_UINT8) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -805,7 +805,7 @@ DeviceIoPciWrite (
Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This); Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
if (Width < 0 || Width >= MMIO_COPY_UINT8) { if ((UINT32)Width >= MMIO_COPY_UINT8) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1029,7 +1029,7 @@ DeviceIoMap (
Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This); Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
if (Operation < 0 || Operation > EfiBusMasterCommonBuffer) { if ((UINT32)Operation > EfiBusMasterCommonBuffer) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1123,7 +1123,7 @@ DeviceIoAllocateBuffer (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if ((Type >= MaxAllocateType) || (Type < AllocateAnyPages)) { if ((UINT32)Type >= MaxAllocateType) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -1,6 +1,6 @@
/*++ @file /*++ @file
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved. Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -208,7 +208,7 @@ EmuGopBlt (
Private = GOP_PRIVATE_DATA_FROM_THIS (This); Private = GOP_PRIVATE_DATA_FROM_THIS (This);
if ((BltOperation < 0) || (BltOperation >= EfiGraphicsOutputBltOperationMax)) { if ((UINT32)BltOperation >= EfiGraphicsOutputBltOperationMax) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
The implementation for EFI_ISA_IO_PROTOCOL. The implementation for EFI_ISA_IO_PROTOCOL.
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -439,8 +439,7 @@ IsaIoVerifyAccess (
EFI_ISA_ACPI_RESOURCE *Item; EFI_ISA_ACPI_RESOURCE *Item;
EFI_STATUS Status; EFI_STATUS Status;
if (Width < EfiIsaIoWidthUint8 || if ((UINT32)Width >= EfiIsaIoWidthMaximum ||
Width >= EfiIsaIoWidthMaximum ||
Width == EfiIsaIoWidthReserved || Width == EfiIsaIoWidthReserved ||
Width == EfiIsaIoWidthFifoReserved || Width == EfiIsaIoWidthFifoReserved ||
Width == EfiIsaIoWidthFillReserved Width == EfiIsaIoWidthFillReserved
@ -1000,7 +999,7 @@ IsaIoMapFullSupport (
// //
// Make sure the Operation parameter is valid // Make sure the Operation parameter is valid
// //
if (Operation < 0 || Operation >= EfiIsaIoOperationMaximum) { if ((UINT32)Operation >= EfiIsaIoOperationMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1378,7 +1377,7 @@ IsaIoAllocateBuffer (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (Type < AllocateAnyPages || Type >= MaxAllocateType) { if ((UINT32)Type >= MaxAllocateType) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// //

View File

@ -1,7 +1,7 @@
/** @file /** @file
The implementation for EFI_ISA_IO_PROTOCOL. The implementation for EFI_ISA_IO_PROTOCOL.
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -105,8 +105,7 @@ IsaIoVerifyAccess (
EFI_ISA_ACPI_RESOURCE *Item; EFI_ISA_ACPI_RESOURCE *Item;
EFI_STATUS Status; EFI_STATUS Status;
if (Width < EfiIsaIoWidthUint8 || if ((UINT32)Width >= EfiIsaIoWidthMaximum ||
Width >= EfiIsaIoWidthMaximum ||
Width == EfiIsaIoWidthReserved || Width == EfiIsaIoWidthReserved ||
Width == EfiIsaIoWidthFifoReserved || Width == EfiIsaIoWidthFifoReserved ||
Width == EfiIsaIoWidthFillReserved Width == EfiIsaIoWidthFillReserved
@ -1340,7 +1339,7 @@ IsaIoMapFullSupport (
// //
// Make sure the Operation parameter is valid // Make sure the Operation parameter is valid
// //
if (Operation < 0 || Operation >= EfiIsaIoOperationMaximum) { if ((UINT32)Operation >= EfiIsaIoOperationMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1718,7 +1717,7 @@ IsaIoAllocateBuffer (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (Type < AllocateAnyPages || Type >= MaxAllocateType) { if ((UINT32)Type >= MaxAllocateType) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// //

View File

@ -1,7 +1,7 @@
/** @file /** @file
Uses the services of the I/O Library to produce the CPU I/O Protocol Uses the services of the I/O Library to produce the CPU I/O Protocol
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -116,7 +116,7 @@ CpuIoCheckParameter (
// //
// Check to see if Width is in the valid range // Check to see if Width is in the valid range
// //
if (Width < 0 || Width >= EfiCpuIoWidthMaximum) { if ((UINT32)Width >= EfiCpuIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
EFI PCI IO protocol functions implementation for PCI Bus module. EFI PCI IO protocol functions implementation for PCI Bus module.
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -85,7 +85,7 @@ PciIoVerifyBarAccess (
IN UINT64 *Offset IN UINT64 *Offset
) )
{ {
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -146,7 +146,7 @@ PciIoVerifyConfigAccess (
{ {
UINT64 ExtendOffset; UINT64 ExtendOffset;
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -215,7 +215,7 @@ PciIoPollMem (
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -322,7 +322,7 @@ PciIoPollIo (
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width > EfiPciIoWidthUint64) { if ((UINT32)Width > EfiPciIoWidthUint64) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -421,7 +421,7 @@ PciIoMemRead (
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -500,7 +500,7 @@ PciIoMemWrite (
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -578,7 +578,7 @@ PciIoIoRead (
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -656,7 +656,7 @@ PciIoIoWrite (
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -881,7 +881,7 @@ PciIoCopyMem (
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Width < 0 || Width >= EfiPciIoWidthMaximum) { if ((UINT32)Width >= EfiPciIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -970,7 +970,7 @@ PciIoMap (
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if (Operation < 0 || Operation >= EfiPciIoOperationMaximum) { if ((UINT32)Operation >= EfiPciIoOperationMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -261,7 +261,7 @@ CoreSetTimer (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (Type < 0 || Type > TimerRelative || (Event->Type & EVT_TIMER) == 0) { if ((UINT32)Type > TimerRelative || (Event->Type & EVT_TIMER) == 0) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -3,7 +3,7 @@
The GCD services are used to manage the memory and I/O regions that The GCD services are used to manage the memory and I/O regions that
are accessible to the CPU that is executing the DXE core. are accessible to the CPU that is executing the DXE core.
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -1012,15 +1012,15 @@ CoreAllocateSpace (
// //
// Make sure parameters are valid // Make sure parameters are valid
// //
if (GcdAllocateType < 0 || GcdAllocateType >= EfiGcdMaxAllocateType) { if ((UINT32)GcdAllocateType >= EfiGcdMaxAllocateType) {
DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER)); DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (GcdMemoryType < 0 || GcdMemoryType >= EfiGcdMemoryTypeMaximum) { if ((UINT32)GcdMemoryType >= EfiGcdMemoryTypeMaximum) {
DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER)); DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (GcdIoType < 0 || GcdIoType >= EfiGcdIoTypeMaximum) { if ((UINT32)GcdIoType >= EfiGcdIoTypeMaximum) {
DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER)); DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -557,7 +557,7 @@ CoreAddMemoryDescriptor (
// Make sure the memory type in the gMemoryTypeInformation[] array is valid // Make sure the memory type in the gMemoryTypeInformation[] array is valid
// //
Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[Index].Type); Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[Index].Type);
if (Type < 0 || Type > EfiMaxMemoryType) { if ((UINT32)Type > EfiMaxMemoryType) {
continue; continue;
} }
if (gMemoryTypeInformation[Index].NumberOfPages != 0) { if (gMemoryTypeInformation[Index].NumberOfPages != 0) {
@ -581,7 +581,7 @@ CoreAddMemoryDescriptor (
// Make sure the memory type in the gMemoryTypeInformation[] array is valid // Make sure the memory type in the gMemoryTypeInformation[] array is valid
// //
Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[FreeIndex].Type); Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[FreeIndex].Type);
if (Type < 0 || Type > EfiMaxMemoryType) { if ((UINT32)Type > EfiMaxMemoryType) {
continue; continue;
} }
@ -624,7 +624,7 @@ CoreAddMemoryDescriptor (
// Make sure the memory type in the gMemoryTypeInformation[] array is valid // Make sure the memory type in the gMemoryTypeInformation[] array is valid
// //
Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[Index].Type); Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[Index].Type);
if (Type < 0 || Type > EfiMaxMemoryType) { if ((UINT32)Type > EfiMaxMemoryType) {
continue; continue;
} }
if (gMemoryTypeInformation[Index].NumberOfPages != 0) { if (gMemoryTypeInformation[Index].NumberOfPages != 0) {
@ -747,7 +747,7 @@ CoreConvertPages (
// //
// Update counters for the number of pages allocated to each memory type // Update counters for the number of pages allocated to each memory type
// //
if (Entry->Type >= 0 && Entry->Type < EfiMaxMemoryType) { if ((UINT32)Entry->Type < EfiMaxMemoryType) {
if ((Start >= mMemoryTypeStatistics[Entry->Type].BaseAddress && Start <= mMemoryTypeStatistics[Entry->Type].MaximumAddress) || if ((Start >= mMemoryTypeStatistics[Entry->Type].BaseAddress && Start <= mMemoryTypeStatistics[Entry->Type].MaximumAddress) ||
(Start >= mDefaultBaseAddress && Start <= mDefaultMaximumAddress) ) { (Start >= mDefaultBaseAddress && Start <= mDefaultMaximumAddress) ) {
if (NumberOfPages > mMemoryTypeStatistics[Entry->Type].CurrentNumberOfPages) { if (NumberOfPages > mMemoryTypeStatistics[Entry->Type].CurrentNumberOfPages) {
@ -758,7 +758,7 @@ CoreConvertPages (
} }
} }
if (NewType >= 0 && NewType < EfiMaxMemoryType) { if ((UINT32)NewType < EfiMaxMemoryType) {
if ((Start >= mMemoryTypeStatistics[NewType].BaseAddress && Start <= mMemoryTypeStatistics[NewType].MaximumAddress) || if ((Start >= mMemoryTypeStatistics[NewType].BaseAddress && Start <= mMemoryTypeStatistics[NewType].MaximumAddress) ||
(Start >= mDefaultBaseAddress && Start <= mDefaultMaximumAddress) ) { (Start >= mDefaultBaseAddress && Start <= mDefaultMaximumAddress) ) {
mMemoryTypeStatistics[NewType].CurrentNumberOfPages += NumberOfPages; mMemoryTypeStatistics[NewType].CurrentNumberOfPages += NumberOfPages;
@ -1011,7 +1011,7 @@ FindFreePages (
// //
// Attempt to find free pages in the preferred bin based on the requested memory type // Attempt to find free pages in the preferred bin based on the requested memory type
// //
if (NewType >= 0 && NewType < EfiMaxMemoryType && MaxAddress >= mMemoryTypeStatistics[NewType].MaximumAddress) { if ((UINT32)NewType < EfiMaxMemoryType && MaxAddress >= mMemoryTypeStatistics[NewType].MaximumAddress) {
Start = CoreFindFreePagesI ( Start = CoreFindFreePagesI (
mMemoryTypeStatistics[NewType].MaximumAddress, mMemoryTypeStatistics[NewType].MaximumAddress,
mMemoryTypeStatistics[NewType].BaseAddress, mMemoryTypeStatistics[NewType].BaseAddress,
@ -1094,7 +1094,7 @@ CoreAllocatePages (
UINT64 MaxAddress; UINT64 MaxAddress;
UINTN Alignment; UINTN Alignment;
if (Type < AllocateAnyPages || Type >= (UINTN) MaxAllocateType) { if ((UINT32)Type >= MaxAllocateType) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -120,7 +120,7 @@ LookupPoolHead (
POOL *Pool; POOL *Pool;
UINTN Index; UINTN Index;
if (MemoryType >= 0 && MemoryType < EfiMaxMemoryType) { if ((UINT32)MemoryType < EfiMaxMemoryType) {
return &mPoolHead[MemoryType]; return &mPoolHead[MemoryType];
} }
@ -550,7 +550,7 @@ CoreFreePoolI (
// portion of that memory type has been freed. If it has, then free the // portion of that memory type has been freed. If it has, then free the
// list entry for that memory type // list entry for that memory type
// //
if (Pool->MemoryType < 0 && Pool->Used == 0) { if ((INT32)Pool->MemoryType < 0 && Pool->Used == 0) {
RemoveEntryList (&Pool->Link); RemoveEntryList (&Pool->Link);
CoreFreePoolI (Pool); CoreFreePoolI (Pool);
} }

View File

@ -1,5 +1,5 @@
/** @file /** @file
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR> Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -240,7 +240,7 @@ Returns:
Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This); Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This);
if ((BltOperation < 0) || (BltOperation >= EfiGraphicsOutputBltOperationMax)) { if ((UINT32)BltOperation >= EfiGraphicsOutputBltOperationMax) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -3,7 +3,7 @@
CirrusLogic5430.c file which deals with the EFI 1.1 driver model. CirrusLogic5430.c file which deals with the EFI 1.1 driver model.
This file just does graphics. This file just does graphics.
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -136,7 +136,7 @@ CirrusLogic5430UgaDrawBlt (
Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This); Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This);
if ((BltOperation < 0) || (BltOperation >= EfiUgaBltMax)) { if ((UINT32)BltOperation >= EfiUgaBltMax) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
This contains the installation function for the driver. This contains the installation function for the driver.
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -413,7 +413,7 @@ Interrupt8259GetVector (
OUT UINT8 *Vector OUT UINT8 *Vector
) )
{ {
if (Irq < Efi8259Irq0 || Irq > Efi8259Irq15) { if ((UINT32)Irq > Efi8259Irq15) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -445,7 +445,7 @@ Interrupt8259EnableIrq (
IN BOOLEAN LevelTriggered IN BOOLEAN LevelTriggered
) )
{ {
if (Irq < Efi8259Irq0 || Irq > Efi8259Irq15) { if ((UINT32)Irq > Efi8259Irq15) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -478,7 +478,7 @@ Interrupt8259DisableIrq (
IN EFI_8259_IRQ Irq IN EFI_8259_IRQ Irq
) )
{ {
if (Irq < Efi8259Irq0 || Irq > Efi8259Irq15) { if ((UINT32)Irq > Efi8259Irq15) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -555,7 +555,7 @@ Interrupt8259EndOfInterrupt (
IN EFI_8259_IRQ Irq IN EFI_8259_IRQ Irq
) )
{ {
if (Irq < Efi8259Irq0 || Irq > Efi8259Irq15) { if ((UINT32)Irq > Efi8259Irq15) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Provides the basic interfaces to abstract a PCI Host Bridge Resource Allocation Provides the basic interfaces to abstract a PCI Host Bridge Resource Allocation
Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are This program and the accompanying materials are
licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -1180,7 +1180,7 @@ PreprocessController (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (Phase < EfiPciBeforeChildBusEnumeration || Phase > EfiPciBeforeResourceCollection) { if ((UINT32)Phase > EfiPciBeforeResourceCollection) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
PCI Root Bridge Io Protocol implementation PCI Root Bridge Io Protocol implementation
Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are This program and the accompanying materials are
licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -770,7 +770,7 @@ RootBridgeIoCheckParameter (
// //
// Check to see if Width is in the valid range // Check to see if Width is in the valid range
// //
if (Width < EfiPciWidthUint8 || Width >= EfiPciWidthMaximum) { if ((UINT32)Width >= EfiPciWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1233,7 +1233,7 @@ RootBridgeIoPollMem (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (Width < 0 || Width > EfiPciWidthUint64) { if ((UINT32)Width > EfiPciWidthUint64) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1340,7 +1340,7 @@ RootBridgeIoPollIo (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (Width < 0 || Width > EfiPciWidthUint64) { if ((UINT32)Width > EfiPciWidthUint64) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1561,7 +1561,7 @@ RootBridgeIoCopyMem (
UINTN Index; UINTN Index;
UINT64 Result; UINT64 Result;
if (Width < 0 || Width > EfiPciWidthUint64) { if ((UINT32)Width > EfiPciWidthUint64) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1735,7 +1735,7 @@ RootBridgeIoMap (
// //
// Make sure that Operation is valid // Make sure that Operation is valid
// //
if (Operation < 0 || Operation >= EfiPciOperationMaximum) { if ((UINT32)Operation >= EfiPciOperationMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Produces the CPU I/O 2 Protocol. Produces the CPU I/O 2 Protocol.
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -116,7 +116,7 @@ CpuIoCheckParameter (
// //
// Check to see if Width is in the valid range // Check to see if Width is in the valid range
// //
if (Width < 0 || Width >= EfiCpuIoWidthMaximum) { if ((UINT32)Width >= EfiCpuIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Produces the SMM CPU I/O Protocol. Produces the SMM CPU I/O Protocol.
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -82,7 +82,7 @@ CpuIoCheckParameter (
// //
// Check to see if Width is in the valid range // Check to see if Width is in the valid range
// //
if (Width < 0 || Width > SMM_IO_UINT64) { if ((UINT32)Width > SMM_IO_UINT64) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Produces the CPU I/O PPI. Produces the CPU I/O PPI.
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -127,7 +127,7 @@ CpuIoCheckParameter (
// //
// Check to see if Width is in the valid range // Check to see if Width is in the valid range
// //
if (Width < 0 || Width >= EfiPeiCpuIoWidthMaximum) { if ((UINT32)Width >= EfiPeiCpuIoWidthMaximum) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }