summaryrefslogtreecommitdiff
path: root/MdePkg/Library/PeiIoLibCpuIo
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-04 13:08:25 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-04 13:08:25 +0000
commit9a462b415d8c9636bfb29a2cfb141e69c3c092b7 (patch)
tree1f8b1a82190a60a8d00919ab0349a2deab9f2ce3 /MdePkg/Library/PeiIoLibCpuIo
parent8840ad589e758e0aa57982f5b7acfa898c63c409 (diff)
downloadedk2-platforms-9a462b415d8c9636bfb29a2cfb141e69c3c092b7.tar.xz
UefiLib:
Add two new interfaces of EfiCreateEventLegacyBootEx & EfiCreateEventReadyToBootEx Fix a bug in EfiCreateEventLegacyBoot & EfiCreateEventReadyToBoot. (#51) PciLib: Add missing ASSERT()s in PciReadBuffer() & PciWriteBuffer() (#70) IoLib Add ASSERT()s to check alignment. MemoryAllocationLib: For AllocateXXXCopyBuffer(). Add ASSERT()s for cases when allocations fails. BaseLib: Change the return type of InternalMathModU64x32 from UINT64 to UINT32 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@416 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/PeiIoLibCpuIo')
-rw-r--r--MdePkg/Library/PeiIoLibCpuIo/IoLib.c76
1 files changed, 48 insertions, 28 deletions
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;
}