From e0e7f80cc31b625fe45be1ec48d48fd60b613c77 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Mon, 28 Nov 2011 06:19:36 +0000 Subject: Update code to pass build on VS2008 with /Od compiler option. Signed-off-by: lgao4 Reviewed-by: rsun3 Reviewed-by: ftian git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12792 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c | 8 ++++---- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 6 +++--- MdeModulePkg/Core/PiSmmCore/Dispatcher.c | 4 ++-- MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 4 ++-- MdeModulePkg/Library/PiDxeS3BootScriptLib/InternalBootScriptLib.h | 5 ++++- 5 files changed, 15 insertions(+), 12 deletions(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c index cfd2d807c3..5a6a3d7d0f 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c @@ -503,12 +503,12 @@ AhciBuildCommand ( IN UINT8 AtapiCommandLength, IN UINT8 CommandSlotNumber, IN OUT VOID *DataPhysicalAddr, - IN UINT64 DataLength + IN UINT32 DataLength ) { UINT64 BaseAddr; - UINT64 PrdtNumber; - UINT64 PrdtIndex; + UINT32 PrdtNumber; + UINT32 PrdtIndex; UINTN RemainedData; UINTN MemAddr; DATA_64 Data64; @@ -557,7 +557,7 @@ AhciBuildCommand ( RemainedData = (UINTN) DataLength; MemAddr = (UINTN) DataPhysicalAddr; - CommandList->AhciCmdPrdtl = (UINT32)PrdtNumber; + CommandList->AhciCmdPrdtl = PrdtNumber; for (PrdtIndex = 0; PrdtIndex < PrdtNumber; PrdtIndex++) { if (RemainedData < EFI_AHCI_MAX_DATA_PER_PRDT) { diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c index d0b616582e..6d4044a09b 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -781,7 +781,7 @@ XhcFreeEventRing ( // for (Index = 0; Index < ERST_NUMBER; Index++) { EventRingPtr = TablePtr + Index; - RingBuf = (VOID *)(UINTN)(EventRingPtr->PtrLo | ((UINT64)EventRingPtr->PtrHi << 32)); + RingBuf = (VOID *)(UINTN)(EventRingPtr->PtrLo | LShiftU64 ((UINT64)EventRingPtr->PtrHi, 32)); if(RingBuf != NULL) { FreePages (RingBuf, EFI_SIZE_TO_PAGES (sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMBER)); @@ -922,7 +922,7 @@ XhcCheckUrbResult ( continue; } - TRBPtr = (TRB_TEMPLATE *)(UINTN)(EvtTrb->TRBPtrLo | (UINT64) EvtTrb->TRBPtrHi << 32); + TRBPtr = (TRB_TEMPLATE *)(UINTN)(EvtTrb->TRBPtrLo | LShiftU64 ((UINT64) EvtTrb->TRBPtrHi, 32)); if (IsTransferRingTrb (Urb->Ring, TRBPtr)) { switch (EvtTrb->Completecode) { case TRB_COMPLETION_STALL_ERROR: @@ -1537,7 +1537,7 @@ XhcSyncTrsRing ( // Toggle PCS maintained by software // TrsRing->RingPCS = (TrsRing->RingPCS & BIT0) ? 0 : 1; - TrsTrb = (TRB_TEMPLATE *)(UINTN)((TrsTrb->Parameter1 | ((UINT64)TrsTrb->Parameter2 << 32)) & ~0x0F); + TrsTrb = (TRB_TEMPLATE *)(UINTN)((TrsTrb->Parameter1 | LShiftU64 ((UINT64)TrsTrb->Parameter2, 32)) & ~0x0F); } } diff --git a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c index 53eedbbf61..833df5b297 100644 --- a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c +++ b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c @@ -448,7 +448,7 @@ SmmLoadImage ( // // allocate the memory to load the SMM driver // - PageCount = (UINTN)EFI_SIZE_TO_PAGES(ImageContext.ImageSize + ImageContext.SectionAlignment); + PageCount = (UINTN)EFI_SIZE_TO_PAGES((UINTN)ImageContext.ImageSize + ImageContext.SectionAlignment); DstBuffer = (UINTN)(-1); Status = SmmAllocatePages ( @@ -466,7 +466,7 @@ SmmLoadImage ( ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)DstBuffer; } } else { - PageCount = (UINTN)EFI_SIZE_TO_PAGES(ImageContext.ImageSize + ImageContext.SectionAlignment); + PageCount = (UINTN)EFI_SIZE_TO_PAGES((UINTN)ImageContext.ImageSize + ImageContext.SectionAlignment); DstBuffer = (UINTN)(-1); Status = SmmAllocatePages ( diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c index b0c43f6f19..84b9f73ecb 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c @@ -913,7 +913,7 @@ ExecuteSmmCoreFromSmram ( // Allocate memory for the image being loaded from the EFI_SRAM_DESCRIPTOR // specified by SmramRange // - PageCount = (UINTN)EFI_SIZE_TO_PAGES(ImageContext.ImageSize + ImageContext.SectionAlignment); + PageCount = (UINTN)EFI_SIZE_TO_PAGES((UINTN)ImageContext.ImageSize + ImageContext.SectionAlignment); ASSERT ((SmramRange->PhysicalSize & EFI_PAGE_MASK) == 0); ASSERT (SmramRange->PhysicalSize > EFI_PAGES_TO_SIZE (PageCount)); @@ -931,7 +931,7 @@ ExecuteSmmCoreFromSmram ( // Allocate memory for the image being loaded from the EFI_SRAM_DESCRIPTOR // specified by SmramRange // - PageCount = (UINTN)EFI_SIZE_TO_PAGES(ImageContext.ImageSize + ImageContext.SectionAlignment); + PageCount = (UINTN)EFI_SIZE_TO_PAGES((UINTN)ImageContext.ImageSize + ImageContext.SectionAlignment); ASSERT ((SmramRange->PhysicalSize & EFI_PAGE_MASK) == 0); ASSERT (SmramRange->PhysicalSize > EFI_PAGES_TO_SIZE (PageCount)); diff --git a/MdeModulePkg/Library/PiDxeS3BootScriptLib/InternalBootScriptLib.h b/MdeModulePkg/Library/PiDxeS3BootScriptLib/InternalBootScriptLib.h index babd12e43c..3e2a0d2bac 100644 --- a/MdeModulePkg/Library/PiDxeS3BootScriptLib/InternalBootScriptLib.h +++ b/MdeModulePkg/Library/PiDxeS3BootScriptLib/InternalBootScriptLib.h @@ -42,8 +42,11 @@ #define MAX_IO_ADDRESS 0xFFFF +// +// Macro to convert a UEFI PCI address to a PCI Library PCI address +// #define PCI_ADDRESS_ENCODE(A) (UINTN)PCI_LIB_ADDRESS( \ - (((A)& 0xff000000) >> 24), (((A) &0x00ff0000) >> 16), (((A) & 0xff00) >> 8), ((RShiftU64 ((A), 32) & 0xfff) | ((A)& 0xff)) \ + ((((UINTN)(A))& 0xff000000) >> 24), ((((UINTN)(A)) &0x00ff0000) >> 16), ((((UINTN)(A)) & 0xff00) >> 8), ((RShiftU64 ((A), 32) & 0xfff) | ((A)& 0xff)) \ ) -- cgit v1.2.3