X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=DuetPkg%2FPciRootBridgeNoEnumerationDxe%2FPcatPciRootBridgeIo.c;h=d5d79aee2e9f9b551bf0aeab366069efb3c8bf0e;hb=5a39f404f3b870fd27d0127b864d82c90704fde6;hp=9c5ae3c400364ba49b32c4babfe74629e04118b5;hpb=8e53d24672edba2361b05e6e9046358b199f10b5;p=mirror_edk2.git diff --git a/DuetPkg/PciRootBridgeNoEnumerationDxe/PcatPciRootBridgeIo.c b/DuetPkg/PciRootBridgeNoEnumerationDxe/PcatPciRootBridgeIo.c index 9c5ae3c400..d5d79aee2e 100644 --- a/DuetPkg/PciRootBridgeNoEnumerationDxe/PcatPciRootBridgeIo.c +++ b/DuetPkg/PciRootBridgeNoEnumerationDxe/PcatPciRootBridgeIo.c @@ -1,7 +1,7 @@ /*++ -Copyright (c) 2005 - 2008, 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 @@ -69,26 +69,6 @@ PcatRootBridgeIoMemWrite ( IN OUT VOID *Buffer ); -EFI_STATUS -EFIAPI -PcatRootBridgeIoIoRead ( - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, - IN UINT64 UserAddress, - IN UINTN Count, - IN OUT VOID *UserBuffer - ); - -EFI_STATUS -EFIAPI -PcatRootBridgeIoIoWrite ( - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, - IN UINT64 UserAddress, - IN UINTN Count, - IN OUT VOID *UserBuffer - ); - EFI_STATUS EFIAPI PcatRootBridgeIoCopyMem ( @@ -202,7 +182,7 @@ PcatRootBridgeIoMemRW ( EFI_STATUS PcatRootBridgeIoConstructor ( - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *Protocol, + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *Protocol, IN UINTN SegmentNumber ) /*++ @@ -276,7 +256,7 @@ PcatRootBridgeIoPollMem ( } - if (Width < 0 || Width > EfiPciWidthUint64) { + if ((UINT32)Width > EfiPciWidthUint64) { return EFI_INVALID_PARAMETER; } // @@ -290,7 +270,9 @@ PcatRootBridgeIoPollMem ( return EFI_SUCCESS; } - if ( Delay != 0 ) { + if (Delay == 0) { + return EFI_SUCCESS; + } else { NumberOfTicks = DivU64x32Remainder (Delay, 100, &Remainder); if ( Remainder !=0 ) { @@ -337,7 +319,7 @@ PcatRootBridgeIoPollIo ( return EFI_INVALID_PARAMETER; } - if (Width < 0 || Width > EfiPciWidthUint64) { + if ((UINT32)Width > EfiPciWidthUint64) { return EFI_INVALID_PARAMETER; } // @@ -351,7 +333,9 @@ PcatRootBridgeIoPollIo ( return EFI_SUCCESS; } - if (Delay != 0) { + if (Delay == 0) { + return EFI_SUCCESS; + } else { NumberOfTicks = DivU64x32Remainder (Delay, 100, &Remainder); if ( Remainder !=0 ) { @@ -428,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) { @@ -475,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) { @@ -505,7 +489,7 @@ PcatRootBridgeIoCopyMem ( UINTN Index; UINT64 Result; - if (Width < 0 || Width > EfiPciWidthUint64) { + if ((UINT32)Width > EfiPciWidthUint64) { return EFI_INVALID_PARAMETER; } @@ -625,7 +609,7 @@ PcatRootBridgeIoMap ( // // Make sure that Operation is valid // - if (Operation < 0 || Operation >= EfiPciOperationMaximum) { + if ((UINT32)Operation >= EfiPciOperationMaximum) { return EFI_INVALID_PARAMETER; } @@ -703,7 +687,7 @@ PcatRootBridgeIoMap ( } - Status =gBS->AllocatePool ( + Status =gBS->AllocatePool ( EfiBootServicesData, sizeof(MAP_INFO_INSTANCE), (VOID **)&MapInstance @@ -719,7 +703,7 @@ PcatRootBridgeIoMap ( PrivateData = DRIVER_INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS(This); InsertTailList(&PrivateData->MapInfo,&MapInstance->Link); - // + // // The DeviceAddress is the address of the maped buffer below 4GB // *DeviceAddress = MapInfo->MappedHostAddress; @@ -766,14 +750,14 @@ PcatRootBridgeIoUnmap ( // MapInfo = (MAP_INFO *)Mapping; - for (Link = PrivateData->MapInfo.ForwardLink; Link != &PrivateData->MapInfo; Link = Link->ForwardLink) { - if (((MAP_INFO_INSTANCE*)Link)->Map == MapInfo) - break; + for (Link = PrivateData->MapInfo.ForwardLink; Link != &PrivateData->MapInfo; Link = Link->ForwardLink) { + if (((MAP_INFO_INSTANCE*)Link)->Map == MapInfo) + break; } if (Link == &PrivateData->MapInfo) { - return EFI_INVALID_PARAMETER; - } + return EFI_INVALID_PARAMETER; + } RemoveEntryList(Link); ((MAP_INFO_INSTANCE*)Link)->Map = NULL; @@ -868,7 +852,7 @@ PcatRootBridgeIoFreeBuffer ( { if( HostAddress == NULL ){ - return EFI_INVALID_PARAMETER; + return EFI_INVALID_PARAMETER; } return gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)HostAddress, Pages); } @@ -1013,7 +997,7 @@ Returns: UINTN OutStride; - Width = Width & 0x03; + Width = (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) (Width & 0x03); Stride = (UINTN)1 << Width; InStride = InStrideFlag ? Stride : 0; OutStride = OutStrideFlag ? Stride : 0;