X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=DuetPkg%2FPciBusNoEnumerationDxe%2FPciIo.c;h=ffaaaf342beece2e5728333c2e13b20b0e6a6501;hp=55d16b64cbd36d8b54e61ea872fd0ccd487edb6b;hb=3d78c020d22023d35d27b48817d73ff31a361ac7;hpb=d4f59c13fb89ef9d679be640ff3c6b19393829b0 diff --git a/DuetPkg/PciBusNoEnumerationDxe/PciIo.c b/DuetPkg/PciBusNoEnumerationDxe/PciIo.c index 55d16b64cb..ffaaaf342b 100644 --- a/DuetPkg/PciBusNoEnumerationDxe/PciIo.c +++ b/DuetPkg/PciBusNoEnumerationDxe/PciIo.c @@ -1,7 +1,7 @@ /*++ -Copyright (c) 2005 - 2007, Intel Corporation -All rights reserved. This program and the accompanying materials +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 http://opensource.org/licenses/bsd-license.php @@ -343,7 +343,7 @@ Returns: --*/ { - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -366,11 +366,11 @@ Returns: // If Width is EfiPciIoWidthFifoUintX then convert to EfiPciIoWidthUintX // If Width is EfiPciIoWidthFillUintX then convert to EfiPciIoWidthUintX // - if (Width >= EfiPciWidthFifoUint8 && Width <= EfiPciWidthFifoUint64) { + if (Width >= EfiPciIoWidthFifoUint8 && Width <= EfiPciIoWidthFifoUint64) { Count = 1; } - Width &= 0x03; + Width = (EFI_PCI_IO_PROTOCOL_WIDTH) (Width & 0x03); if ((*Offset + Count * ((UINTN)1 << Width)) - 1 >= PciIoDevice->PciBar[BarIndex].Length) { return EFI_INVALID_PARAMETER; @@ -404,7 +404,7 @@ Returns: { UINT64 ExtendOffset; - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -412,7 +412,7 @@ Returns: // If Width is EfiPciIoWidthFifoUintX then convert to EfiPciIoWidthUintX // If Width is EfiPciIoWidthFillUintX then convert to EfiPciIoWidthUintX // - Width &= 0x03; + Width = (EFI_PCI_IO_PROTOCOL_WIDTH) (Width & 0x03); if (PciIoDevice->IsPciExp) { if ((*Offset + Count * ((UINTN)1 << Width)) - 1 >= PCI_EXP_MAX_CONFIG_OFFSET) { @@ -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; } @@ -571,12 +571,12 @@ Returns: PCI_IO_DEVICE *PciIoDevice; if (Buffer == NULL){ - return EFI_INVALID_PARAMETER; + return EFI_INVALID_PARAMETER; } PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -624,12 +624,12 @@ Returns: PCI_IO_DEVICE *PciIoDevice; if (Buffer == NULL){ - return EFI_INVALID_PARAMETER; + return EFI_INVALID_PARAMETER; } PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -677,12 +677,12 @@ Returns: PCI_IO_DEVICE *PciIoDevice; if (Buffer == NULL){ - return EFI_INVALID_PARAMETER; + return EFI_INVALID_PARAMETER; } PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if ((UINT32)Width >= EfiPciIoWidthMaximum) { return EFI_INVALID_PARAMETER; } @@ -730,12 +730,12 @@ Returns: PCI_IO_DEVICE *PciIoDevice; if (Buffer == NULL){ - return EFI_INVALID_PARAMETER; + return EFI_INVALID_PARAMETER; } 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; } @@ -951,7 +951,7 @@ Returns: } if (PciIoDevice->Attributes & EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE) { - Operation = Operation + EfiPciOperationBusMasterRead64; + Operation = (EFI_PCI_IO_PROTOCOL_OPERATION) (Operation + EfiPciOperationBusMasterRead64); } Status = PciIoDevice->PciRootBridgeIo->Map ( @@ -1074,7 +1074,7 @@ Returns: PCI_IO_DEVICE *PciIoDevice; if( HostAddress == NULL ){ - return EFI_INVALID_PARAMETER; + return EFI_INVALID_PARAMETER; } PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); @@ -1282,21 +1282,21 @@ Returns: return EFI_SUCCESS; case EfiPciIoAttributeOperationEnable: - if(Attributes & ~(PciIoDevice->Supports)) { - return EFI_UNSUPPORTED; - } - NewAttributes = PciIoDevice->Attributes | Attributes; + if(Attributes & ~(PciIoDevice->Supports)) { + return EFI_UNSUPPORTED; + } + NewAttributes = PciIoDevice->Attributes | Attributes; break; case EfiPciIoAttributeOperationDisable: - if(Attributes & ~(PciIoDevice->Supports)) { - return EFI_UNSUPPORTED; - } + if(Attributes & ~(PciIoDevice->Supports)) { + return EFI_UNSUPPORTED; + } NewAttributes = PciIoDevice->Attributes & (~Attributes); break; case EfiPciIoAttributeOperationSet: - if(Attributes & ~(PciIoDevice->Supports)) { - return EFI_UNSUPPORTED; - } + if(Attributes & ~(PciIoDevice->Supports)) { + return EFI_UNSUPPORTED; + } NewAttributes = Attributes; break; default: @@ -1865,5 +1865,5 @@ Returns: return TRUE; } - return (PciDeviceExisted (PciDevice1->Parent, PciDevice2)|| PciDeviceExisted (PciDevice2->Parent, PciDevice1)); + return (BOOLEAN) ((PciDeviceExisted (PciDevice1->Parent, PciDevice2)|| PciDeviceExisted (PciDevice2->Parent, PciDevice1))); }