From 9a462b415d8c9636bfb29a2cfb141e69c3c092b7 Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Sun, 4 Jun 2006 13:08:25 +0000 Subject: =?UTF-8?q?UefiLib:=20Add=20two=20new=20interfaces=20of=20EfiCreat?= =?UTF-8?q?eEventLegacyBootEx=20&=E3=80=80EfiCreateEventReadyToBootEx=20Fi?= =?UTF-8?q?x=20a=20bug=20in=20EfiCreateEventLegacyBoot=20&=20EfiCreateEven?= =?UTF-8?q?tReadyToBoot.=20(#51)=20PciLib:=20Add=20missing=20ASSERT()s=20i?= =?UTF-8?q?n=20PciReadBuffer()=20&=20PciWriteBuffer()=20(#70)=20IoLib=20Ad?= =?UTF-8?q?d=20ASSERT()s=20to=20check=20alignment.=20MemoryAllocationLib:?= =?UTF-8?q?=20For=20AllocateXXXCopyBuffer().=20Add=20ASSERT()s=20for=20cas?= =?UTF-8?q?es=20when=20allocations=20fails.=20BaseLib:=20Change=20the=20re?= =?UTF-8?q?turn=20type=20of=20InternalMathModU64x32=20from=20UINT64=20to?= =?UTF-8?q?=20UINT32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@416 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/PeiIoLibCpuIo/IoLib.c | 76 +++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 28 deletions(-) (limited to 'MdePkg/Library/PeiIoLibCpuIo') diff --git a/MdePkg/Library/PeiIoLibCpuIo/IoLib.c b/MdePkg/Library/PeiIoLibCpuIo/IoLib.c index 2156f6b480..1da0203b5c 100644 --- a/MdePkg/Library/PeiIoLibCpuIo/IoLib.c +++ b/MdePkg/Library/PeiIoLibCpuIo/IoLib.c @@ -39,7 +39,6 @@ IoRead8 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); return CpuIo->IoRead8 (PeiServices, CpuIo, (UINT64) Port); @@ -72,7 +71,6 @@ IoWrite8 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); CpuIo->IoWrite8 (PeiServices, CpuIo, (UINT64) Port, Value); @@ -104,9 +102,11 @@ IoRead16 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - + // + // Make sure Port is aligned on a 16-bit boundary. + // + ASSERT ((Port & 1) == 0); return CpuIo->IoRead16 (PeiServices, CpuIo, (UINT64) Port); } @@ -137,9 +137,11 @@ IoWrite16 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - + // + // Make sure Port is aligned on a 16-bit boundary. + // + ASSERT ((Port & 1) == 0); CpuIo->IoWrite16 (PeiServices, CpuIo, (UINT64) Port, Value); return Value; } @@ -169,9 +171,11 @@ IoRead32 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - + // + // Make sure Port is aligned on a 32-bit boundary. + // + ASSERT ((Port & 3) == 0); return CpuIo->IoRead32 (PeiServices, CpuIo, (UINT64) Port); } @@ -202,9 +206,11 @@ IoWrite32 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - + // + // Make sure Port is aligned on a 32-bit boundary. + // + ASSERT ((Port & 3) == 0); CpuIo->IoWrite32 (PeiServices, CpuIo, (UINT64) Port, Value); return Value; } @@ -234,9 +240,11 @@ IoRead64 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - + // + // Make sure Port is aligned on a 64-bit boundary. + // + ASSERT ((Port & 7) == 0); return CpuIo->IoRead64 (PeiServices, CpuIo, (UINT64) Port); } @@ -267,9 +275,11 @@ IoWrite64 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - + // + // Make sure Port is aligned on a 64-bit boundary. + // + ASSERT ((Port & 7) == 0); CpuIo->IoWrite64 (PeiServices, CpuIo, (UINT64) Port, Value); return Value;; } @@ -299,7 +309,6 @@ MmioRead8 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); return CpuIo->MemRead8 (PeiServices, CpuIo, (UINT64) Address); @@ -330,7 +339,6 @@ MmioWrite8 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); CpuIo->MemWrite8 (PeiServices, CpuIo, (UINT64) Address, Value); @@ -362,9 +370,11 @@ MmioRead16 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - + // + // Make sure Address is aligned on a 16-bit boundary. + // + ASSERT ((Address & 1) == 0); return CpuIo->MemRead16 (PeiServices, CpuIo, (UINT64) Address); } @@ -394,9 +404,11 @@ MmioWrite16 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - + // + // Make sure Address is aligned on a 16-bit boundary. + // + ASSERT ((Address & 1) == 0); CpuIo->MemWrite16 (PeiServices, CpuIo, (UINT64) Address, Value); return Value; } @@ -426,9 +438,11 @@ MmioRead32 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - + // + // Make sure Address is aligned on a 32-bit boundary. + // + ASSERT ((Address & 3) == 0); return CpuIo->MemRead32 (PeiServices, CpuIo, (UINT64) Address); } @@ -458,9 +472,11 @@ MmioWrite32 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - + // + // Make sure Address is aligned on a 32-bit boundary. + // + ASSERT ((Address & 3) == 0); CpuIo->MemWrite32 (PeiServices, CpuIo, (UINT64) Address, Value); return Value; } @@ -490,9 +506,11 @@ MmioRead64 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - + // + // Make sure Address is aligned on a 64-bit boundary. + // + ASSERT ((Address & 7) == 0); return CpuIo->MemRead64 (PeiServices, CpuIo, (UINT64) Address); } @@ -522,9 +540,11 @@ MmioWrite64 ( PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; - ASSERT (CpuIo != NULL); - + // + // Make sure Address is aligned on a 64-bit boundary. + // + ASSERT ((Address & 7) == 0); CpuIo->MemWrite64 (PeiServices, CpuIo, (UINT64) Address, Value); return Value; } -- cgit v1.2.3