Index: OvmfPkg/XenBusDxe/EventChannel.c
===================================================================
--- OvmfPkg/XenBusDxe/EventChannel.c	(revision 16323)
+++ OvmfPkg/XenBusDxe/EventChannel.c	(working copy)
@@ -29,7 +29,7 @@ XenEventChannelNotify (
 
   Send.port = Port;
   ReturnCode = XenHypercallEventChannelOp (Dev, EVTCHNOP_send, &Send);
-  return ReturnCode;
+  return (UINT32)ReturnCode;
 }
 
 UINT32
@@ -48,7 +48,7 @@ XenBusEventChannelAllocate (
 
   Parameter.dom = DOMID_SELF;
   Parameter.remote_dom = DomainId;
-  ReturnCode = XenHypercallEventChannelOp (Private->Dev,
+  ReturnCode = (UINT32)XenHypercallEventChannelOp (Private->Dev,
                                    EVTCHNOP_alloc_unbound,
                                    &Parameter);
   if (ReturnCode != 0) {
@@ -84,5 +84,5 @@ XenBusEventChannelClose (
 
   Private = XENBUS_PRIVATE_DATA_FROM_THIS (This);
   Close.port = Port;
-  return XenHypercallEventChannelOp (Private->Dev, EVTCHNOP_close, &Close);
+  return (UINT32)XenHypercallEventChannelOp (Private->Dev, EVTCHNOP_close, &Close);
 }
Index: OvmfPkg/XenBusDxe/GrantTable.c
===================================================================
--- OvmfPkg/XenBusDxe/GrantTable.c	(revision 16323)
+++ OvmfPkg/XenBusDxe/GrantTable.c	(working copy)
@@ -85,7 +85,7 @@ XenGrantTableGetFreeEntry (
   GrantInUseList[Ref] = TRUE;
 #endif
   EfiReleaseLock (&mGrantListLock);
-  return Ref;
+  return (grant_ref_t)Ref;
 }
 
 STATIC
@@ -101,7 +101,7 @@ XenGrantTableGrantAccess (
 
   ASSERT (GrantTable != NULL);
   Ref = XenGrantTableGetFreeEntry ();
-  GrantTable[Ref].frame = Frame;
+  GrantTable[Ref].frame = (UINT32)Frame;
   GrantTable[Ref].domid = DomainId;
   MemoryFence ();
   Flags = GTF_permit_access;
@@ -108,7 +108,7 @@ XenGrantTableGrantAccess (
   if (ReadOnly) {
     Flags |= GTF_readonly;
   }
-  GrantTable[Ref].flags = Flags;
+  GrantTable[Ref].flags = (UINT16)Flags;
 
   return Ref;
 }
@@ -152,7 +152,7 @@ XenGrantTableInit (
 #endif
   EfiInitializeLock (&mGrantListLock, TPL_NOTIFY);
   for (Index = NR_RESERVED_ENTRIES; Index < NR_GRANT_ENTRIES; Index++) {
-    XenGrantTablePutFreeEntry (Index);
+    XenGrantTablePutFreeEntry ((grant_ref_t)Index);
   }
 
   GrantTable = (VOID*)(UINTN) MmioAddr;
Index: OvmfPkg/XenBusDxe/XenBus.c
===================================================================
--- OvmfPkg/XenBusDxe/XenBus.c	(revision 16323)
+++ OvmfPkg/XenBusDxe/XenBus.c	(working copy)
@@ -182,7 +182,7 @@ XenBusAddDevice (
     Private->XenBusIo.Type = AsciiStrDup (Type);
     Private->XenBusIo.Node = AsciiStrDup (DevicePath);
     Private->XenBusIo.Backend = BackendPath;
-    Private->XenBusIo.DeviceId = AsciiStrDecimalToUintn (Id);
+    Private->XenBusIo.DeviceId = (UINT16)AsciiStrDecimalToUintn (Id);
     Private->Dev = Dev;
 
     TempXenBusPath = AllocateCopyPool (sizeof (XENBUS_DEVICE_PATH),
@@ -274,7 +274,7 @@ XenBusEnumerateDeviceType (
     XenBusAddDevice (Dev, Type, Directory[Index]);
   }
 
-  FreePool (Directory);
+  FreePool ((VOID*)Directory);
 }
 
 
@@ -310,7 +310,7 @@ XenBusEnumerateBus (
     XenBusEnumerateDeviceType (Dev, Types[Index]);
   }
 
-  FreePool (Types);
+  FreePool ((VOID*)Types);
 
   return XENSTORE_STATUS_SUCCESS;
 }
Index: OvmfPkg/XenBusDxe/XenHypercall.c
===================================================================
--- OvmfPkg/XenBusDxe/XenHypercall.c	(revision 16323)
+++ OvmfPkg/XenBusDxe/XenHypercall.c	(working copy)
@@ -52,8 +52,8 @@ XenHypercallHvmGetParam (
   ASSERT (Dev->Hyperpage != NULL);
 
   Parameter.domid = DOMID_SELF;
-  Parameter.index = Index;
-  Error = XenHypercall2 (Dev->Hyperpage + __HYPERVISOR_hvm_op * 32,
+  Parameter.index = (UINT32)Index;
+  Error = XenHypercall2 ((UINT8*)Dev->Hyperpage + __HYPERVISOR_hvm_op * 32,
                          HVMOP_get_param, (INTN) &Parameter);
   if (Error != 0) {
     DEBUG ((EFI_D_ERROR,
@@ -72,7 +72,7 @@ XenHypercallMemoryOp (
   )
 {
   ASSERT (Dev->Hyperpage != NULL);
-  return XenHypercall2 (Dev->Hyperpage + __HYPERVISOR_memory_op * 32,
+  return XenHypercall2 ((UINT8*)Dev->Hyperpage + __HYPERVISOR_memory_op * 32,
                         Operation, (INTN) Arguments);
 }
 
@@ -84,7 +84,7 @@ XenHypercallEventChannelOp (
   )
 {
   ASSERT (Dev->Hyperpage != NULL);
-  return XenHypercall2 (Dev->Hyperpage + __HYPERVISOR_event_channel_op * 32,
+  return XenHypercall2 ((UINT8*)Dev->Hyperpage + __HYPERVISOR_event_channel_op * 32,
                         Operation, (INTN) Arguments);
 }
 
Index: OvmfPkg/XenBusDxe/XenStore.c
===================================================================
--- OvmfPkg/XenBusDxe/XenStore.c	(revision 16323)
+++ OvmfPkg/XenBusDxe/XenStore.c	(working copy)
@@ -248,7 +248,7 @@ Split (
 
   /* Transfer to one big alloc for easy freeing by the caller. */
   Dst = AllocatePool (*NumPtr * sizeof (CHAR8 *) + Len);
-  CopyMem (&Dst[*NumPtr], Strings, Len);
+  CopyMem ((VOID*)&Dst[*NumPtr], Strings, Len);
   FreePool (Strings);
 
   /* Extract pointers to newly allocated array. */
@@ -493,7 +493,7 @@ XenStoreWriteStore (
 
     Dest = XenStoreGetOutputChunk (Cons, Prod, xs.XenStore->req, &Available);
     if (Available > Len) {
-      Available = Len;
+      Available = (UINT32)Len;
     }
 
     CopyMem (Dest, Data, Available);
@@ -572,7 +572,7 @@ XenStoreReadStore (
 
     Src = XenStoreGetInputChunk (Cons, Prod, xs.XenStore->rsp, &Available);
     if (Available > Len) {
-      Available = Len;
+      Available = (UINT32)Len;
     }
 
     /*
@@ -660,7 +660,7 @@ XenStoreProcessMessage (
     } else {
       DEBUG ((EFI_D_WARN, "XenStore: Watch handle %a not found\n",
               Message->u.Watch.Vector[XS_WATCH_TOKEN]));
-      FreePool(Message->u.Watch.Vector);
+      FreePool((VOID*)Message->u.Watch.Vector);
       FreePool(Message);
     }
     EfiReleaseLock (&xs.RegisteredWatchesLock);
@@ -812,7 +812,7 @@ XenStoreTalkv (
   Message.type = RequestType;
   Message.len = 0;
   for (Index = 0; Index < NumRequests; Index++) {
-    Message.len += WriteRequest[Index].Len;
+    Message.len += (UINT32)WriteRequest[Index].Len;
   }
 
   Status = XenStoreWriteStore (&Message, sizeof (Message));
@@ -829,7 +829,7 @@ XenStoreTalkv (
     }
   }
 
-  Status = XenStoreReadReply (&Message.type, LenPtr, &Return);
+  Status = XenStoreReadReply ((enum xsd_sockmsg_type *)&Message.type, LenPtr, &Return);
 
 Error:
   if (Status != XENSTORE_STATUS_SUCCESS) {
@@ -843,7 +843,7 @@ Error:
   }
 
   /* Reply is either error or an echo of our request message type. */
-  ASSERT (Message.type == RequestType);
+  ASSERT ((enum xsd_sockmsg_type)Message.type == RequestType);
 
   if (ResultPtr) {
     *ResultPtr = Return;
@@ -975,7 +975,7 @@ XenStoreWaitWatch (
       if (Message->u.Watch.Handle == Token) {
         RemoveEntryList (Entry);
         EfiReleaseLock (&xs.WatchEventsLock);
-        FreePool(Message->u.Watch.Vector);
+        FreePool((VOID*)Message->u.Watch.Vector);
         FreePool(Message);
         return XENSTORE_STATUS_SUCCESS;
       }
@@ -1057,8 +1057,8 @@ XenStoreInit (
 
   xs.Dev = Dev;
 
-  xs.EventChannel = XenHypercallHvmGetParam (Dev, HVM_PARAM_STORE_EVTCHN);
-  XenStoreGpfn = XenHypercallHvmGetParam (Dev, HVM_PARAM_STORE_PFN);
+  xs.EventChannel = (evtchn_port_t)XenHypercallHvmGetParam (Dev, HVM_PARAM_STORE_EVTCHN);
+  XenStoreGpfn = (UINTN)XenHypercallHvmGetParam (Dev, HVM_PARAM_STORE_PFN);
   xs.XenStore = (VOID *) (XenStoreGpfn << EFI_PAGE_SHIFT);
   DEBUG ((EFI_D_INFO, "XenBusInit: XenBus rings @%p, event channel %x\n",
           xs.XenStore, xs.EventChannel));
@@ -1115,7 +1115,7 @@ XenStoreDeinit (
       XENSTORE_MESSAGE *Message = XENSTORE_MESSAGE_FROM_LINK (Entry);
       Entry = GetNextNode (&xs.WatchEvents, Entry);
       RemoveEntryList (&Message->Link);
-      FreePool (Message->u.Watch.Vector);
+      FreePool ((VOID*)Message->u.Watch.Vector);
       FreePool (Message);
     }
   }
@@ -1202,7 +1202,7 @@ XenStorePathExists (
   if (Status != XENSTORE_STATUS_SUCCESS) {
     return FALSE;
   }
-  FreePool (TempStr);
+  FreePool ((VOID*)TempStr);
   return TRUE;
 }
 
@@ -1283,7 +1283,7 @@ XenStoreTransactionStart (
   Status = XenStoreSingle (XST_NIL, XS_TRANSACTION_START, "", NULL,
                            (VOID **) &IdStr);
   if (Status == XENSTORE_STATUS_SUCCESS) {
-    Transaction->Id = AsciiStrDecimalToUintn (IdStr);
+    Transaction->Id = (UINT32)AsciiStrDecimalToUintn (IdStr);
     FreePool (IdStr);
   }
 
@@ -1419,7 +1419,7 @@ XenStoreUnregisterWatch (
     Entry = GetNextNode (&xs.WatchEvents, Entry);
     if (Message->u.Watch.Handle == Watch) {
       RemoveEntryList (&Message->Link);
-      FreePool (Message->u.Watch.Vector);
+      FreePool ((VOID*)Message->u.Watch.Vector);
       FreePool (Message);
     }
   }
Index: OvmfPkg/XenPvBlkDxe/BlockFront.c
===================================================================
--- OvmfPkg/XenPvBlkDxe/BlockFront.c	(revision 16323)
+++ OvmfPkg/XenPvBlkDxe/BlockFront.c	(working copy)
@@ -196,7 +196,7 @@ XenPvBlockFrontInitialization (
             Status));
     goto Error;
   }
-  Dev->DomainId = Value;
+  Dev->DomainId = (domid_t)Value;
   XenBusIo->EventChannelAllocate (XenBusIo, Dev->DomainId, &Dev->EventChannel);
 
   SharedRing = (blkif_sring_t*) AllocatePages (1);
@@ -262,7 +262,7 @@ Again:
   if (Status != XENSTORE_STATUS_SUCCESS || Value > UINT32_MAX) {
     goto Error2;
   }
-  Dev->MediaInfo.VDiskInfo = Value;
+  Dev->MediaInfo.VDiskInfo = (UINT32)Value;
   if (Dev->MediaInfo.VDiskInfo & VDISK_READONLY) {
     Dev->MediaInfo.ReadWrite = FALSE;
   } else {
@@ -278,7 +278,7 @@ Again:
   if (Status != XENSTORE_STATUS_SUCCESS || Value > UINT32_MAX) {
     goto Error2;
   }
-  if (Value % 512 != 0) {
+  if ((UINT32)Value % 512 != 0) {
     //
     // This is not supported by the driver.
     //
@@ -286,7 +286,7 @@ Again:
             "it must be a multiple of 512\n", Value));
     goto Error2;
   }
-  Dev->MediaInfo.SectorSize = Value;
+  Dev->MediaInfo.SectorSize = (UINT32)Value;
 
   // Default value
   Value = 0;
@@ -443,7 +443,7 @@ XenPvBlockAsyncIo (
 
   Start = (UINTN) IoData->Buffer & ~EFI_PAGE_MASK;
   End = ((UINTN) IoData->Buffer + IoData->Size + EFI_PAGE_SIZE - 1) & ~EFI_PAGE_MASK;
-  IoData->NumRef = NumSegments = (End - Start) / EFI_PAGE_SIZE;
+  IoData->NumRef = NumSegments = (INT32)((End - Start) / EFI_PAGE_SIZE);
 
   ASSERT (NumSegments <= BLKIF_MAX_SEGMENTS_PER_REQUEST);
 
@@ -452,7 +452,7 @@ XenPvBlockAsyncIo (
   Request = RING_GET_REQUEST (&Dev->Ring, RingIndex);
 
   Request->operation = IsWrite ? BLKIF_OP_WRITE : BLKIF_OP_READ;
-  Request->nr_segments = NumSegments;
+  Request->nr_segments = (UINT8)NumSegments;
   Request->handle = Dev->DeviceId;
   Request->id = (UINTN) IoData;
   Request->sector_number = IoData->Sector;
@@ -461,9 +461,9 @@ XenPvBlockAsyncIo (
     Request->seg[Index].first_sect = 0;
     Request->seg[Index].last_sect = EFI_PAGE_SIZE / 512 - 1;
   }
-  Request->seg[0].first_sect = ((UINTN) IoData->Buffer & EFI_PAGE_MASK) / 512;
-  Request->seg[NumSegments - 1].last_sect =
-      (((UINTN) IoData->Buffer + IoData->Size - 1) & EFI_PAGE_MASK) / 512;
+  Request->seg[0].first_sect = (UINT8)(((UINTN) IoData->Buffer & EFI_PAGE_MASK) / 512);
+  Request->seg[NumSegments - 1].last_sect = (UINT8)
+      ((((UINTN) IoData->Buffer + IoData->Size - 1) & EFI_PAGE_MASK) / 512);
   for (Index = 0; Index < NumSegments; Index++) {
     UINTN Data = Start + Index * EFI_PAGE_SIZE;
     XenBusIo->GrantAccess (XenBusIo, Dev->DomainId,
Index: OvmfPkg/XenPvBlkDxe/BlockIo.c
===================================================================
--- OvmfPkg/XenPvBlkDxe/BlockIo.c	(revision 16323)
+++ OvmfPkg/XenPvBlkDxe/BlockIo.c	(working copy)
@@ -136,7 +136,7 @@ XenPvBlkDxeBlockIoReadWriteBlocks (
   }
 
   IoData.Dev = XEN_BLOCK_FRONT_FROM_BLOCK_IO (This);
-  Sector = Lba * (Media->BlockSize / 512);
+  Sector = (UINTN)MultU64x32 (Lba, Media->BlockSize / 512);
 
   while (BufferSize > 0) {
     if (((UINTN)Buffer & EFI_PAGE_MASK) == 0) {
