From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web08.489.1636388540584161016 for ; Mon, 08 Nov 2021 08:22:21 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: michael.d.kinney@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="219456472" X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="219456472" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2021 08:22:19 -0800 X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="491275628" Received: from mdkinney-mobl2.amr.corp.intel.com ([10.212.220.127]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2021 08:22:19 -0800 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Anthony Perard , Julien Grall , Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann Subject: [Patch 1/1] OvmfPkg/Xen: Fix VS2019 build issues Date: Mon, 8 Nov 2021 08:22:08 -0800 Message-Id: <20211108162208.15028-1-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.32.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3722 Fix VS2019 NOOPT build issues related to converting a larger integer value to a smaller integer value. Cc: Anthony Perard Cc: Julien Grall Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Signed-off-by: Michael D Kinney --- .../Library/XenRealTimeClockLib/XenRealTimeClockLib.c | 10 +++++----- OvmfPkg/XenPlatformPei/MemDetect.c | 2 +- OvmfPkg/XenTimerDxe/XenTimerDxe.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.c b/OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.c index e113bc89bd75..72e0aaa8798c 100644 --- a/OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.c +++ b/OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.c @@ -53,9 +53,9 @@ EpochToEfiTime ( m = (((da * 5) + 308) / 153) - 2; d = da - (((m + 4) * 153) / 5) + 122; - Time->Year = y - 4800 + ((m + 2) / 12); + Time->Year = (UINT16)(y - 4800 + ((m + 2) / 12)); Time->Month = ((m + 2) % 12) + 1; - Time->Day = d + 1; + Time->Day = (UINT8)(d + 1); ss = EpochSeconds % 60; a = (EpochSeconds - ss) / 60; @@ -63,9 +63,9 @@ EpochToEfiTime ( b = (a - mm) / 60; hh = b % 24; - Time->Hour = hh; - Time->Minute = mm; - Time->Second = ss; + Time->Hour = (UINT8)hh; + Time->Minute = (UINT8)mm; + Time->Second = (UINT8)ss; Time->Nanosecond = 0; } diff --git a/OvmfPkg/XenPlatformPei/MemDetect.c b/OvmfPkg/XenPlatformPei/MemDetect.c index 1970b631c94d..fa1be888d6ba 100644 --- a/OvmfPkg/XenPlatformPei/MemDetect.c +++ b/OvmfPkg/XenPlatformPei/MemDetect.c @@ -154,7 +154,7 @@ GetSystemMemorySizeBelow4gb ( HighestAddress = GetHighestSystemMemoryAddress (TRUE); ASSERT (HighestAddress > 0 && HighestAddress <= BASE_4GB); - return HighestAddress; + return (UINT32)HighestAddress; } // diff --git a/OvmfPkg/XenTimerDxe/XenTimerDxe.c b/OvmfPkg/XenTimerDxe/XenTimerDxe.c index 0bec59382b0a..19fa17a29fb4 100644 --- a/OvmfPkg/XenTimerDxe/XenTimerDxe.c +++ b/OvmfPkg/XenTimerDxe/XenTimerDxe.c @@ -165,7 +165,7 @@ TimerDriverSetTimerPeriod ( { UINT64 TimerCount; UINT32 TimerFrequency; - UINTN DivideValue = 1; + UINT32 DivideValue = 1; if (TimerPeriod == 0) { // @@ -193,7 +193,7 @@ TimerDriverSetTimerPeriod ( // // Program the timer with the new count value // - InitializeApicTimer(DivideValue, TimerCount, TRUE, LOCAL_APIC_TIMER_VECTOR); + InitializeApicTimer(DivideValue, (UINT32)TimerCount, TRUE, LOCAL_APIC_TIMER_VECTOR); // // Enable timer interrupt -- 2.32.0.windows.1