Il 24/09/2014 23:09, Jordan Justen ha scritto:
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen <[email protected]>
> ---
> OvmfPkg/Library/LoadLinuxLib/Linux.c | 6 +++---
> OvmfPkg/PlatformPei/MemDetect.c | 2 +-
> OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c | 5 +++--
> OvmfPkg/VirtioBlkDxe/VirtioBlk.c | 6 +++---
> OvmfPkg/VirtioNetDxe/DriverBinding.c | 4 ++--
> OvmfPkg/VirtioNetDxe/SnpGetStatus.c | 5 +++--
> OvmfPkg/VirtioScsiDxe/VirtioScsi.c | 4 ++--
> 7 files changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/OvmfPkg/Library/LoadLinuxLib/Linux.c
> b/OvmfPkg/Library/LoadLinuxLib/Linux.c
> index 37b14f5..353990b 100644
> --- a/OvmfPkg/Library/LoadLinuxLib/Linux.c
> +++ b/OvmfPkg/Library/LoadLinuxLib/Linux.c
> @@ -1,6 +1,6 @@
> /** @file
>
> - Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD
> License
> @@ -384,8 +384,8 @@ SetupLinuxMemmap (
> #ifdef MDE_CPU_IA32
> Efi->efi_loader_signature = SIGNATURE_32 ('E', 'L', '3', '2');
> #else
> - Efi->efi_systab_hi = ((UINT64)(UINTN) gST) >> 32;
> - Efi->efi_memmap_hi = ((UINT64)(UINTN) MemoryMapPtr) >> 32;
> + Efi->efi_systab_hi = (UINT32) (((UINT64)(UINTN) gST) >> 32);
> + Efi->efi_memmap_hi = (UINT32) (((UINT64)(UINTN) MemoryMapPtr) >> 32);
Do you really need this?
Since you are inside the #ifdef, you know that UINTN is 64-bit, and you
can just use
(UINT32) (((UINTN) gST) >> 32);
Similarly for MemoryMapPtr.
> Efi->efi_loader_signature = SIGNATURE_32 ('E', 'L', '6', '4');
> #endif
>
> diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
> index 4c22679..bd7bb02 100644
> --- a/OvmfPkg/PlatformPei/MemDetect.c
> +++ b/OvmfPkg/PlatformPei/MemDetect.c
> @@ -56,7 +56,7 @@ GetSystemMemorySizeBelow4gb (
> Cmos0x34 = (UINT8) CmosRead8 (0x34);
> Cmos0x35 = (UINT8) CmosRead8 (0x35);
>
> - return (((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB);
> + return (UINT32) (((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB);
Here the inside UINTN cast is unnecessary, since math is being done
anyway in 32-bit ints.
> }
>
>
> diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c
> b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c
> index 7827b72..b56ece3 100644
> --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c
> +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c
> @@ -1,6 +1,6 @@
> /**@file
>
> -Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
> 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
> @@ -880,7 +880,8 @@ Returns:
> if (Checksum != 0) {
> UINT16 Expected;
>
> - Expected = ((UINTN) FwVolHeader->Checksum + 0x10000 - Checksum) & 0xffff;
> + Expected =
> + (UINT16) (((UINTN) FwVolHeader->Checksum + 0x10000 - Checksum) &
> 0xffff);
Same here. Just
Expected = (UINT16) (FwVolHeader->Checksum - Checksum);
or (perhaps more readable)
Expected = (UINT16) ((FwVolHeader->Checksum - Checksum) & 0xffff);
will do.
> DEBUG ((EFI_D_INFO, "FV@%p Checksum is 0x%x, expected 0x%x\n",
> FwVolHeader, FwVolHeader->Checksum, Expected));
> diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
> b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
> index 35fc88e..862957c 100644
> --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
> +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
> @@ -11,7 +11,7 @@
> synchronous requests and EFI_BLOCK_IO_PROTOCOL for now.
>
> Copyright (C) 2012, Red Hat, Inc.
> - Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> @@ -770,8 +770,8 @@ VirtioBlkInit (
> Dev->BlockIoMedia.RemovableMedia = FALSE;
> Dev->BlockIoMedia.MediaPresent = TRUE;
> Dev->BlockIoMedia.LogicalPartition = FALSE;
> - Dev->BlockIoMedia.ReadOnly = !!(Features & VIRTIO_BLK_F_RO);
> - Dev->BlockIoMedia.WriteCaching = !!(Features & VIRTIO_BLK_F_FLUSH);
> + Dev->BlockIoMedia.ReadOnly = (BOOLEAN) ((Features &
> VIRTIO_BLK_F_RO) != 0);
> + Dev->BlockIoMedia.WriteCaching = (BOOLEAN) ((Features &
> VIRTIO_BLK_F_FLUSH) != 0);
> Dev->BlockIoMedia.BlockSize = BlockSize;
> Dev->BlockIoMedia.IoAlign = 0;
> Dev->BlockIoMedia.LastBlock = DivU64x32 (NumSectors,
> diff --git a/OvmfPkg/VirtioNetDxe/DriverBinding.c
> b/OvmfPkg/VirtioNetDxe/DriverBinding.c
> index 93995c6..0ad39cf 100644
> --- a/OvmfPkg/VirtioNetDxe/DriverBinding.c
> +++ b/OvmfPkg/VirtioNetDxe/DriverBinding.c
> @@ -3,7 +3,7 @@
> Driver Binding code and its private helpers for the virtio-net driver.
>
> Copyright (C) 2013, Red Hat, Inc.
> - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> @@ -129,7 +129,7 @@ VirtioNetGetFeatures (
> if (EFI_ERROR (Status)) {
> goto YieldDevice;
> }
> - *MediaPresent = !!(LinkStatus & VIRTIO_NET_S_LINK_UP);
> + *MediaPresent = (BOOLEAN) ((LinkStatus & VIRTIO_NET_S_LINK_UP) != 0);
> }
>
> YieldDevice:
> diff --git a/OvmfPkg/VirtioNetDxe/SnpGetStatus.c
> b/OvmfPkg/VirtioNetDxe/SnpGetStatus.c
> index 4393d24..694940e 100644
> --- a/OvmfPkg/VirtioNetDxe/SnpGetStatus.c
> +++ b/OvmfPkg/VirtioNetDxe/SnpGetStatus.c
> @@ -4,7 +4,7 @@
> any.
>
> Copyright (C) 2013, Red Hat, Inc.
> - Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> @@ -94,7 +94,8 @@ VirtioNetGetStatus (
> if (EFI_ERROR (Status)) {
> goto Exit;
> }
> - Dev->Snm.MediaPresent = !!(LinkStatus & VIRTIO_NET_S_LINK_UP);
> + Dev->Snm.MediaPresent =
> + (BOOLEAN) ((LinkStatus & VIRTIO_NET_S_LINK_UP) != 0);
> }
>
> //
> diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
> b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
> index e6154cd..6b8ea60 100644
> --- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
> +++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
> @@ -26,7 +26,7 @@
> unreasonable for now.
>
> Copyright (C) 2012, Red Hat, Inc.
> - Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> @@ -748,7 +748,7 @@ VirtioScsiInit (
> if (EFI_ERROR (Status)) {
> goto Failed;
> }
> - Dev->InOutSupported = !!(Features & VIRTIO_SCSI_F_INOUT);
> + Dev->InOutSupported = (BOOLEAN) ((Features & VIRTIO_SCSI_F_INOUT) != 0);
>
> Status = VIRTIO_CFG_READ (Dev, MaxChannel, &MaxChannel);
> if (EFI_ERROR (Status)) {
>
------------------------------------------------------------------------------
Slashdot TV. Videos for Nerds. Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel