From 3d78c020d22023d35d27b48817d73ff31a361ac7 Mon Sep 17 00:00:00 2001 From: rsun3 Date: Tue, 28 Aug 2012 06:48:28 +0000 Subject: [PATCH] Fix comparisons of enumerated types which may cause warnings for some compilers. Signed-off-by: Sun Rui Reviewed-by: Gao Liming git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13686 6f19259b-4bc3-4df7-8a09-765794883524 --- DuetPkg/PciBusNoEnumerationDxe/PciIo.c | 22 +++++++++---------- .../PciRootBridgeNoEnumerationDxe/DeviceIo.c | 10 ++++----- .../Ia32/PcatIo.c | 2 +- .../Ipf/PcatIo.c | 4 ++-- .../PcatPciRootBridgeIo.c | 14 ++++++------ .../X64/PcatIo.c | 2 +- .../DeviceIoOnPciRootBridgeIoThunk.c | 10 ++++----- EmulatorPkg/EmuGopDxe/GopScreen.c | 4 ++-- .../Bus/Isa/IsaBusDxe/IsaIo.c | 9 ++++---- .../Bus/Isa/IsaIoDxe/IsaIo.c | 9 ++++---- .../Universal/CpuIoDxe/CpuIo.c | 4 ++-- MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c | 22 +++++++++---------- MdeModulePkg/Core/Dxe/Event/Timer.c | 2 +- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 8 +++---- MdeModulePkg/Core/Dxe/Mem/Page.c | 14 ++++++------ MdeModulePkg/Core/Dxe/Mem/Pool.c | 4 ++-- .../CirrusLogic5430GraphicsOutput.c | 4 ++-- .../CirrusLogic5430UgaDraw.c | 4 ++-- .../8259InterruptControllerDxe/8259.c | 10 ++++----- .../PciHostBridgeDxe/PciHostBridge.c | 4 ++-- .../PciHostBridgeDxe/PciRootBridgeIo.c | 12 +++++----- UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.c | 4 ++-- UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c | 4 ++-- UefiCpuPkg/CpuIoPei/CpuIoPei.c | 4 ++-- 24 files changed, 92 insertions(+), 94 deletions(-) diff --git a/DuetPkg/PciBusNoEnumerationDxe/PciIo.c b/DuetPkg/PciBusNoEnumerationDxe/PciIo.c index 61b0870b1a..ffaaaf342b 100644 --- a/DuetPkg/PciBusNoEnumerationDxe/PciIo.c +++ b/DuetPkg/PciBusNoEnumerationDxe/PciIo.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2012, 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 @@ -343,7 +343,7 @@ Returns: --*/ { - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -404,7 +404,7 @@ Returns: { UINT64 ExtendOffset; - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -465,7 +465,7 @@ Returns: PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -521,7 +521,7 @@ Returns: PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width > EfiPciIoWidthUint64) { + if ((UINT32)Width > EfiPciIoWidthUint64) { return EFI_INVALID_PARAMETER; } @@ -576,7 +576,7 @@ Returns: PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -629,7 +629,7 @@ Returns: PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -682,7 +682,7 @@ Returns: PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -735,7 +735,7 @@ Returns: PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -877,7 +877,7 @@ Returns: PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -942,7 +942,7 @@ Returns: PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Operation < 0 || Operation >= EfiPciIoOperationMaximum) { + if ((UINT32)Operation >= EfiPciIoOperationMaximum) { return EFI_INVALID_PARAMETER; } diff --git a/DuetPkg/PciRootBridgeNoEnumerationDxe/DeviceIo.c b/DuetPkg/PciRootBridgeNoEnumerationDxe/DeviceIo.c index 20098d94eb..b9cae2b2ce 100644 --- a/DuetPkg/PciRootBridgeNoEnumerationDxe/DeviceIo.c +++ b/DuetPkg/PciRootBridgeNoEnumerationDxe/DeviceIo.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, 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 @@ -363,7 +363,7 @@ Returns: 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; } @@ -415,7 +415,7 @@ Returns: 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; } @@ -648,7 +648,7 @@ Returns: Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This); - if (Operation < 0 || Operation > EfiBusMasterCommonBuffer) { + if ((UINT32)Operation > EfiBusMasterCommonBuffer) { return EFI_INVALID_PARAMETER; } @@ -748,7 +748,7 @@ Returns: return EFI_INVALID_PARAMETER; } - if ((Type >= MaxAllocateType) || (Type < AllocateAnyPages)) { + if ((UINT32)Type >= MaxAllocateType) { return EFI_INVALID_PARAMETER; } diff --git a/DuetPkg/PciRootBridgeNoEnumerationDxe/Ia32/PcatIo.c b/DuetPkg/PciRootBridgeNoEnumerationDxe/Ia32/PcatIo.c index fbfc2fadef..d479e7f9fc 100644 --- a/DuetPkg/PciRootBridgeNoEnumerationDxe/Ia32/PcatIo.c +++ b/DuetPkg/PciRootBridgeNoEnumerationDxe/Ia32/PcatIo.c @@ -102,7 +102,7 @@ PcatRootBridgeIoPciRW ( UINT64 PciExpressRegAddr; BOOLEAN UsePciExpressAccess; - if (Width < 0 || Width >= EfiPciWidthMaximum) { + if ((UINT32)Width >= EfiPciWidthMaximum) { return EFI_INVALID_PARAMETER; } diff --git a/DuetPkg/PciRootBridgeNoEnumerationDxe/Ipf/PcatIo.c b/DuetPkg/PciRootBridgeNoEnumerationDxe/Ipf/PcatIo.c index 3ba870e6f9..97857c2981 100644 --- a/DuetPkg/PciRootBridgeNoEnumerationDxe/Ipf/PcatIo.c +++ b/DuetPkg/PciRootBridgeNoEnumerationDxe/Ipf/PcatIo.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2012, 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 @@ -81,7 +81,7 @@ PcatRootBridgeIoIoRead ( return EFI_INVALID_PARAMETER; } - if (Width < 0 || Width >= EfiPciWidthMaximum) { + if ((UINT32)Width >= EfiPciWidthMaximum) { return EFI_INVALID_PARAMETER; } diff --git a/DuetPkg/PciRootBridgeNoEnumerationDxe/PcatPciRootBridgeIo.c b/DuetPkg/PciRootBridgeNoEnumerationDxe/PcatPciRootBridgeIo.c index bfa3363490..d5d79aee2e 100644 --- a/DuetPkg/PciRootBridgeNoEnumerationDxe/PcatPciRootBridgeIo.c +++ b/DuetPkg/PciRootBridgeNoEnumerationDxe/PcatPciRootBridgeIo.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2012, 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 @@ -256,7 +256,7 @@ PcatRootBridgeIoPollMem ( } - if (Width < 0 || Width > EfiPciWidthUint64) { + if ((UINT32)Width > EfiPciWidthUint64) { return EFI_INVALID_PARAMETER; } // @@ -319,7 +319,7 @@ PcatRootBridgeIoPollIo ( return EFI_INVALID_PARAMETER; } - if (Width < 0 || Width > EfiPciWidthUint64) { + if ((UINT32)Width > EfiPciWidthUint64) { return EFI_INVALID_PARAMETER; } // @@ -412,7 +412,7 @@ PcatRootBridgeIoMemRead ( In.buf = Buffer; Out.buf = (VOID *)(UINTN) Address; - if (Width >= EfiPciWidthUint8 && Width <= EfiPciWidthUint64) { + if ((UINT32)Width <= EfiPciWidthUint64) { return PcatRootBridgeIoMemRW (Width, Count, TRUE, In, TRUE, Out); } if (Width >= EfiPciWidthFifoUint8 && Width <= EfiPciWidthFifoUint64) { @@ -459,7 +459,7 @@ PcatRootBridgeIoMemWrite ( In.buf = (VOID *)(UINTN) Address; Out.buf = Buffer; - if (Width >= EfiPciWidthUint8 && Width <= EfiPciWidthUint64) { + if ((UINT32)Width <= EfiPciWidthUint64) { return PcatRootBridgeIoMemRW (Width, Count, TRUE, In, TRUE, Out); } if (Width >= EfiPciWidthFifoUint8 && Width <= EfiPciWidthFifoUint64) { @@ -489,7 +489,7 @@ PcatRootBridgeIoCopyMem ( UINTN Index; UINT64 Result; - if (Width < 0 || Width > EfiPciWidthUint64) { + if ((UINT32)Width > EfiPciWidthUint64) { return EFI_INVALID_PARAMETER; } @@ -609,7 +609,7 @@ PcatRootBridgeIoMap ( // // Make sure that Operation is valid // - if (Operation < 0 || Operation >= EfiPciOperationMaximum) { + if ((UINT32)Operation >= EfiPciOperationMaximum) { return EFI_INVALID_PARAMETER; } diff --git a/DuetPkg/PciRootBridgeNoEnumerationDxe/X64/PcatIo.c b/DuetPkg/PciRootBridgeNoEnumerationDxe/X64/PcatIo.c index 1e4c218032..179df3d5a7 100644 --- a/DuetPkg/PciRootBridgeNoEnumerationDxe/X64/PcatIo.c +++ b/DuetPkg/PciRootBridgeNoEnumerationDxe/X64/PcatIo.c @@ -102,7 +102,7 @@ PcatRootBridgeIoPciRW ( UINT64 PciExpressRegAddr; BOOLEAN UsePciExpressAccess; - if (Width < 0 || Width >= EfiPciWidthMaximum) { + if ((UINT32)Width >= EfiPciWidthMaximum) { return EFI_INVALID_PARAMETER; } diff --git a/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.c b/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.c index 5171a66b0a..da55e12178 100644 --- a/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.c +++ b/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.c @@ -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 applications that consume Device I/O -Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2008 - 2012, 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 @@ -758,7 +758,7 @@ DeviceIoPciRead ( 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; } @@ -805,7 +805,7 @@ DeviceIoPciWrite ( 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; } @@ -1029,7 +1029,7 @@ DeviceIoMap ( Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This); - if (Operation < 0 || Operation > EfiBusMasterCommonBuffer) { + if ((UINT32)Operation > EfiBusMasterCommonBuffer) { return EFI_INVALID_PARAMETER; } @@ -1123,7 +1123,7 @@ DeviceIoAllocateBuffer ( return EFI_INVALID_PARAMETER; } - if ((Type >= MaxAllocateType) || (Type < AllocateAnyPages)) { + if ((UINT32)Type >= MaxAllocateType) { return EFI_INVALID_PARAMETER; } diff --git a/EmulatorPkg/EmuGopDxe/GopScreen.c b/EmulatorPkg/EmuGopDxe/GopScreen.c index 34ee6a5d52..aa21fa68de 100644 --- a/EmulatorPkg/EmuGopDxe/GopScreen.c +++ b/EmulatorPkg/EmuGopDxe/GopScreen.c @@ -1,6 +1,6 @@ /*++ @file -Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved. This program and the accompanying materials 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); - if ((BltOperation < 0) || (BltOperation >= EfiGraphicsOutputBltOperationMax)) { + if ((UINT32)BltOperation >= EfiGraphicsOutputBltOperationMax) { return EFI_INVALID_PARAMETER; } diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaIo.c b/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaIo.c index e4715383ea..6f1cd1b8b1 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaIo.c +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaIo.c @@ -1,7 +1,7 @@ /** @file The implementation for EFI_ISA_IO_PROTOCOL. -Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, 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 @@ -439,8 +439,7 @@ IsaIoVerifyAccess ( EFI_ISA_ACPI_RESOURCE *Item; EFI_STATUS Status; - if (Width < EfiIsaIoWidthUint8 || - Width >= EfiIsaIoWidthMaximum || + if ((UINT32)Width >= EfiIsaIoWidthMaximum || Width == EfiIsaIoWidthReserved || Width == EfiIsaIoWidthFifoReserved || Width == EfiIsaIoWidthFillReserved @@ -1000,7 +999,7 @@ IsaIoMapFullSupport ( // // Make sure the Operation parameter is valid // - if (Operation < 0 || Operation >= EfiIsaIoOperationMaximum) { + if ((UINT32)Operation >= EfiIsaIoOperationMaximum) { return EFI_INVALID_PARAMETER; } @@ -1378,7 +1377,7 @@ IsaIoAllocateBuffer ( return EFI_INVALID_PARAMETER; } - if (Type < AllocateAnyPages || Type >= MaxAllocateType) { + if ((UINT32)Type >= MaxAllocateType) { return EFI_INVALID_PARAMETER; } // diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaIoDxe/IsaIo.c b/IntelFrameworkModulePkg/Bus/Isa/IsaIoDxe/IsaIo.c index ab2a9a5f92..2e4361fc0d 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaIoDxe/IsaIo.c +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaIoDxe/IsaIo.c @@ -1,7 +1,7 @@ /** @file The implementation for EFI_ISA_IO_PROTOCOL. -Copyright (c) 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2012, 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,8 +105,7 @@ IsaIoVerifyAccess ( EFI_ISA_ACPI_RESOURCE *Item; EFI_STATUS Status; - if (Width < EfiIsaIoWidthUint8 || - Width >= EfiIsaIoWidthMaximum || + if ((UINT32)Width >= EfiIsaIoWidthMaximum || Width == EfiIsaIoWidthReserved || Width == EfiIsaIoWidthFifoReserved || Width == EfiIsaIoWidthFillReserved @@ -1340,7 +1339,7 @@ IsaIoMapFullSupport ( // // Make sure the Operation parameter is valid // - if (Operation < 0 || Operation >= EfiIsaIoOperationMaximum) { + if ((UINT32)Operation >= EfiIsaIoOperationMaximum) { return EFI_INVALID_PARAMETER; } @@ -1718,7 +1717,7 @@ IsaIoAllocateBuffer ( return EFI_INVALID_PARAMETER; } - if (Type < AllocateAnyPages || Type >= MaxAllocateType) { + if ((UINT32)Type >= MaxAllocateType) { return EFI_INVALID_PARAMETER; } // diff --git a/IntelFrameworkModulePkg/Universal/CpuIoDxe/CpuIo.c b/IntelFrameworkModulePkg/Universal/CpuIoDxe/CpuIo.c index 3865a7cfe0..e48b6382ff 100644 --- a/IntelFrameworkModulePkg/Universal/CpuIoDxe/CpuIo.c +++ b/IntelFrameworkModulePkg/Universal/CpuIoDxe/CpuIo.c @@ -1,7 +1,7 @@ /** @file Uses the services of the I/O Library to produce the CPU I/O Protocol -Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2012, 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 @@ -116,7 +116,7 @@ CpuIoCheckParameter ( // // Check to see if Width is in the valid range // - if (Width < 0 || Width >= EfiCpuIoWidthMaximum) { + if ((UINT32)Width >= EfiCpuIoWidthMaximum) { return EFI_INVALID_PARAMETER; } diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c index 08ecaa4d10..12f6997ac5 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c @@ -1,7 +1,7 @@ /** @file EFI PCI IO protocol functions implementation for PCI Bus module. -Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, 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 @@ -85,7 +85,7 @@ PciIoVerifyBarAccess ( IN UINT64 *Offset ) { - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -146,7 +146,7 @@ PciIoVerifyConfigAccess ( { UINT64 ExtendOffset; - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -215,7 +215,7 @@ PciIoPollMem ( PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -322,7 +322,7 @@ PciIoPollIo ( PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width > EfiPciIoWidthUint64) { + if ((UINT32)Width > EfiPciIoWidthUint64) { return EFI_INVALID_PARAMETER; } @@ -421,7 +421,7 @@ PciIoMemRead ( PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -500,7 +500,7 @@ PciIoMemWrite ( PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -578,7 +578,7 @@ PciIoIoRead ( PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -656,7 +656,7 @@ PciIoIoWrite ( PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -881,7 +881,7 @@ PciIoCopyMem ( PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -970,7 +970,7 @@ PciIoMap ( PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Operation < 0 || Operation >= EfiPciIoOperationMaximum) { + if ((UINT32)Operation >= EfiPciIoOperationMaximum) { return EFI_INVALID_PARAMETER; } diff --git a/MdeModulePkg/Core/Dxe/Event/Timer.c b/MdeModulePkg/Core/Dxe/Event/Timer.c index 1b20e327cd..3b17ae917c 100644 --- a/MdeModulePkg/Core/Dxe/Event/Timer.c +++ b/MdeModulePkg/Core/Dxe/Event/Timer.c @@ -261,7 +261,7 @@ CoreSetTimer ( 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; } diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index 49697ae89c..c351d215dc 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -3,7 +3,7 @@ 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. -Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, 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 @@ -1012,15 +1012,15 @@ CoreAllocateSpace ( // // Make sure parameters are valid // - if (GcdAllocateType < 0 || GcdAllocateType >= EfiGcdMaxAllocateType) { + if ((UINT32)GcdAllocateType >= EfiGcdMaxAllocateType) { DEBUG ((DEBUG_GCD, " Status = %r\n", 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)); return EFI_INVALID_PARAMETER; } - if (GcdIoType < 0 || GcdIoType >= EfiGcdIoTypeMaximum) { + if ((UINT32)GcdIoType >= EfiGcdIoTypeMaximum) { DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER)); return EFI_INVALID_PARAMETER; } diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index b4a62b9f0c..6d5a259eb6 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -557,7 +557,7 @@ CoreAddMemoryDescriptor ( // Make sure the memory type in the gMemoryTypeInformation[] array is valid // Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[Index].Type); - if (Type < 0 || Type > EfiMaxMemoryType) { + if ((UINT32)Type > EfiMaxMemoryType) { continue; } if (gMemoryTypeInformation[Index].NumberOfPages != 0) { @@ -581,7 +581,7 @@ CoreAddMemoryDescriptor ( // Make sure the memory type in the gMemoryTypeInformation[] array is valid // Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[FreeIndex].Type); - if (Type < 0 || Type > EfiMaxMemoryType) { + if ((UINT32)Type > EfiMaxMemoryType) { continue; } @@ -624,7 +624,7 @@ CoreAddMemoryDescriptor ( // Make sure the memory type in the gMemoryTypeInformation[] array is valid // Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[Index].Type); - if (Type < 0 || Type > EfiMaxMemoryType) { + if ((UINT32)Type > EfiMaxMemoryType) { continue; } if (gMemoryTypeInformation[Index].NumberOfPages != 0) { @@ -747,7 +747,7 @@ CoreConvertPages ( // // 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) || (Start >= mDefaultBaseAddress && Start <= mDefaultMaximumAddress) ) { 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) || (Start >= mDefaultBaseAddress && Start <= mDefaultMaximumAddress) ) { mMemoryTypeStatistics[NewType].CurrentNumberOfPages += NumberOfPages; @@ -1011,7 +1011,7 @@ FindFreePages ( // // 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 ( mMemoryTypeStatistics[NewType].MaximumAddress, mMemoryTypeStatistics[NewType].BaseAddress, @@ -1094,7 +1094,7 @@ CoreAllocatePages ( UINT64 MaxAddress; UINTN Alignment; - if (Type < AllocateAnyPages || Type >= (UINTN) MaxAllocateType) { + if ((UINT32)Type >= MaxAllocateType) { return EFI_INVALID_PARAMETER; } diff --git a/MdeModulePkg/Core/Dxe/Mem/Pool.c b/MdeModulePkg/Core/Dxe/Mem/Pool.c index cdf3f8f095..e0f0869e53 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Pool.c +++ b/MdeModulePkg/Core/Dxe/Mem/Pool.c @@ -120,7 +120,7 @@ LookupPoolHead ( POOL *Pool; UINTN Index; - if (MemoryType >= 0 && MemoryType < EfiMaxMemoryType) { + if ((UINT32)MemoryType < EfiMaxMemoryType) { return &mPoolHead[MemoryType]; } @@ -550,7 +550,7 @@ CoreFreePoolI ( // portion of that memory type has been freed. If it has, then free the // list entry for that memory type // - if (Pool->MemoryType < 0 && Pool->Used == 0) { + if ((INT32)Pool->MemoryType < 0 && Pool->Used == 0) { RemoveEntryList (&Pool->Link); CoreFreePoolI (Pool); } diff --git a/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430GraphicsOutput.c b/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430GraphicsOutput.c index d4b3eafb27..4550b25010 100644 --- a/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430GraphicsOutput.c +++ b/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430GraphicsOutput.c @@ -1,5 +1,5 @@ /** @file -Copyright (c) 2007, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2012, 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 @@ -240,7 +240,7 @@ Returns: Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This); - if ((BltOperation < 0) || (BltOperation >= EfiGraphicsOutputBltOperationMax)) { + if ((UINT32)BltOperation >= EfiGraphicsOutputBltOperationMax) { return EFI_INVALID_PARAMETER; } diff --git a/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c b/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c index a1c14130d9..0f208815ea 100644 --- a/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c +++ b/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c @@ -3,7 +3,7 @@ CirrusLogic5430.c file which deals with the EFI 1.1 driver model. This file just does graphics. - Copyright (c) 2006, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, 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 @@ -136,7 +136,7 @@ CirrusLogic5430UgaDrawBlt ( Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This); - if ((BltOperation < 0) || (BltOperation >= EfiUgaBltMax)) { + if ((UINT32)BltOperation >= EfiUgaBltMax) { return EFI_INVALID_PARAMETER; } diff --git a/PcAtChipsetPkg/8259InterruptControllerDxe/8259.c b/PcAtChipsetPkg/8259InterruptControllerDxe/8259.c index 5a862d13b8..447106afe9 100644 --- a/PcAtChipsetPkg/8259InterruptControllerDxe/8259.c +++ b/PcAtChipsetPkg/8259InterruptControllerDxe/8259.c @@ -1,7 +1,7 @@ /** @file This contains the installation function for the driver. -Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2012, 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 @@ -413,7 +413,7 @@ Interrupt8259GetVector ( OUT UINT8 *Vector ) { - if (Irq < Efi8259Irq0 || Irq > Efi8259Irq15) { + if ((UINT32)Irq > Efi8259Irq15) { return EFI_INVALID_PARAMETER; } @@ -445,7 +445,7 @@ Interrupt8259EnableIrq ( IN BOOLEAN LevelTriggered ) { - if (Irq < Efi8259Irq0 || Irq > Efi8259Irq15) { + if ((UINT32)Irq > Efi8259Irq15) { return EFI_INVALID_PARAMETER; } @@ -478,7 +478,7 @@ Interrupt8259DisableIrq ( IN EFI_8259_IRQ Irq ) { - if (Irq < Efi8259Irq0 || Irq > Efi8259Irq15) { + if ((UINT32)Irq > Efi8259Irq15) { return EFI_INVALID_PARAMETER; } @@ -555,7 +555,7 @@ Interrupt8259EndOfInterrupt ( IN EFI_8259_IRQ Irq ) { - if (Irq < Efi8259Irq0 || Irq > Efi8259Irq15) { + if ((UINT32)Irq > Efi8259Irq15) { return EFI_INVALID_PARAMETER; } diff --git a/PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridge.c b/PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridge.c index a6c1d130ab..994bfeb604 100644 --- a/PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridge.c +++ b/PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridge.c @@ -1,7 +1,7 @@ /** @file Provides the basic interfaces to abstract a PCI Host Bridge Resource Allocation -Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2008 - 2012, 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 @@ -1180,7 +1180,7 @@ PreprocessController ( return EFI_INVALID_PARAMETER; } - if (Phase < EfiPciBeforeChildBusEnumeration || Phase > EfiPciBeforeResourceCollection) { + if ((UINT32)Phase > EfiPciBeforeResourceCollection) { return EFI_INVALID_PARAMETER; } diff --git a/PcAtChipsetPkg/PciHostBridgeDxe/PciRootBridgeIo.c b/PcAtChipsetPkg/PciHostBridgeDxe/PciRootBridgeIo.c index b4da52eefe..7946324d9f 100644 --- a/PcAtChipsetPkg/PciHostBridgeDxe/PciRootBridgeIo.c +++ b/PcAtChipsetPkg/PciHostBridgeDxe/PciRootBridgeIo.c @@ -1,7 +1,7 @@ /** @file PCI Root Bridge Io Protocol implementation -Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2008 - 2012, 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 @@ -770,7 +770,7 @@ RootBridgeIoCheckParameter ( // // Check to see if Width is in the valid range // - if (Width < EfiPciWidthUint8 || Width >= EfiPciWidthMaximum) { + if ((UINT32)Width >= EfiPciWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -1233,7 +1233,7 @@ RootBridgeIoPollMem ( return EFI_INVALID_PARAMETER; } - if (Width < 0 || Width > EfiPciWidthUint64) { + if ((UINT32)Width > EfiPciWidthUint64) { return EFI_INVALID_PARAMETER; } @@ -1340,7 +1340,7 @@ RootBridgeIoPollIo ( return EFI_INVALID_PARAMETER; } - if (Width < 0 || Width > EfiPciWidthUint64) { + if ((UINT32)Width > EfiPciWidthUint64) { return EFI_INVALID_PARAMETER; } @@ -1561,7 +1561,7 @@ RootBridgeIoCopyMem ( UINTN Index; UINT64 Result; - if (Width < 0 || Width > EfiPciWidthUint64) { + if ((UINT32)Width > EfiPciWidthUint64) { return EFI_INVALID_PARAMETER; } @@ -1735,7 +1735,7 @@ RootBridgeIoMap ( // // Make sure that Operation is valid // - if (Operation < 0 || Operation >= EfiPciOperationMaximum) { + if ((UINT32)Operation >= EfiPciOperationMaximum) { return EFI_INVALID_PARAMETER; } diff --git a/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.c b/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.c index 802342caae..3d8a799230 100644 --- a/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.c +++ b/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.c @@ -1,7 +1,7 @@ /** @file Produces the CPU I/O 2 Protocol. -Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2012, 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 @@ -116,7 +116,7 @@ CpuIoCheckParameter ( // // Check to see if Width is in the valid range // - if (Width < 0 || Width >= EfiCpuIoWidthMaximum) { + if ((UINT32)Width >= EfiCpuIoWidthMaximum) { return EFI_INVALID_PARAMETER; } diff --git a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c b/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c index 1c172a096c..7b1ad37515 100644 --- a/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c +++ b/UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c @@ -1,7 +1,7 @@ /** @file Produces the SMM CPU I/O Protocol. -Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2012, 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 @@ -82,7 +82,7 @@ CpuIoCheckParameter ( // // 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; } diff --git a/UefiCpuPkg/CpuIoPei/CpuIoPei.c b/UefiCpuPkg/CpuIoPei/CpuIoPei.c index 67b7905393..3c5c8a74b3 100644 --- a/UefiCpuPkg/CpuIoPei/CpuIoPei.c +++ b/UefiCpuPkg/CpuIoPei/CpuIoPei.c @@ -1,7 +1,7 @@ /** @file Produces the CPU I/O PPI. -Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2012, 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 @@ -127,7 +127,7 @@ CpuIoCheckParameter ( // // Check to see if Width is in the valid range // - if (Width < 0 || Width >= EfiPeiCpuIoWidthMaximum) { + if ((UINT32)Width >= EfiPeiCpuIoWidthMaximum) { return EFI_INVALID_PARAMETER; } -- 2.39.2