summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BaseIoLibIntrinsic
diff options
context:
space:
mode:
authorbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-09 06:38:30 +0000
committerbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-09 06:38:30 +0000
commitcea9bda05aa33664166ac1388cfa1889f50ffa51 (patch)
tree1e85def2c0b6c6889e677312f14deb790498c2d4 /MdePkg/Library/BaseIoLibIntrinsic
parentdd70a8c4e6c8c439dfcc7c94c478c76ab8fda1ec (diff)
downloadedk2-platforms-cea9bda05aa33664166ac1388cfa1889f50ffa51.tar.xz
1. Added ReadWriteBarrier() before and after each I/O read/write function.
2. Removed all ReadWriteBarrier() function calls in all MMIO functions. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1224 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BaseIoLibIntrinsic')
-rw-r--r--MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c70
1 files changed, 46 insertions, 24 deletions
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c
index cfe5ddff43..d05a7fcace 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c
@@ -46,8 +46,8 @@ void _ReadWriteBarrier (void);
//
// _ReadWriteBarrier() forces memory reads and writes to complete at the point
// in the call. This is only a hint to the compiler and does emit code.
-// In past versions of the compiler, _ReadWriteBarrier was enforced only
-// locally and did not affect functions up the call tree. In Visual C++
+// In past versions of the compiler, _ReadWriteBarrier was enforced only
+// locally and did not affect functions up the call tree. In Visual C++
// 2005, _ReadWriteBarrier is enforced all the way up the call tree.
//
@@ -71,8 +71,12 @@ IoRead8 (
IN UINTN Port
)
{
+ UINT8 Value;
+
+ _ReadWriteBarrier ();
+ Value = (UINT8)_inp ((UINT16)Port);
_ReadWriteBarrier ();
- return (UINT8)_inp ((UINT16)Port);
+ return Value;
}
/**
@@ -98,7 +102,9 @@ IoWrite8 (
)
{
_ReadWriteBarrier ();
- return (UINT8)_outp ((UINT16)Port, Value);
+ (UINT8)_outp ((UINT16)Port, Value);
+ _ReadWriteBarrier ();
+ return Value;
}
/**
@@ -121,9 +127,13 @@ IoRead16 (
IN UINTN Port
)
{
+ UINT16 Value;
+
ASSERT ((Port & 1) == 0);
_ReadWriteBarrier ();
- return _inpw((UINT16)Port);
+ Value = _inpw ((UINT16)Port);
+ _ReadWriteBarrier ();
+ return Value;
}
/**
@@ -150,7 +160,9 @@ IoWrite16 (
{
ASSERT ((Port & 1) == 0);
_ReadWriteBarrier ();
- return _outpw ((UINT16)Port, Value);
+ _outpw ((UINT16)Port, Value);
+ _ReadWriteBarrier ();
+ return Value;
}
/**
@@ -173,9 +185,13 @@ IoRead32 (
IN UINTN Port
)
{
+ UINT32 Value;
+
ASSERT ((Port & 3) == 0);
_ReadWriteBarrier ();
- return _inpd((UINT16)Port);
+ Value = _inpd ((UINT16)Port);
+ _ReadWriteBarrier ();
+ return Value;
}
/**
@@ -202,7 +218,9 @@ IoWrite32 (
{
ASSERT ((Port & 3) == 0);
_ReadWriteBarrier ();
- return _outpd ((UINT16)Port, Value);
+ _outpd ((UINT16)Port, Value);
+ _ReadWriteBarrier ();
+ return Value;
}
@@ -226,8 +244,10 @@ MmioRead8 (
IN UINTN Address
)
{
- _ReadWriteBarrier ();
- return *(volatile UINT8 *)Address;
+ UINT8 Value;
+
+ Value = *(volatile UINT8*)Address;
+ return Value;
}
/**
@@ -250,8 +270,7 @@ MmioWrite8 (
IN UINT8 Value
)
{
- _ReadWriteBarrier ();
- return *(volatile UINT8 *)Address = Value;
+ return *(volatile UINT8*)Address = Value;
}
/**
@@ -274,9 +293,11 @@ MmioRead16 (
IN UINTN Address
)
{
+ UINT16 Value;
+
ASSERT ((Address & 1) == 0);
- _ReadWriteBarrier ();
- return *(volatile UINT16 *)Address;
+ Value = *(volatile UINT16*)Address;
+ return Value;
}
/**
@@ -300,8 +321,7 @@ MmioWrite16 (
)
{
ASSERT ((Address & 1) == 0);
- _ReadWriteBarrier ();
- return *(volatile UINT16 *)Address = Value;
+ return *(volatile UINT16*)Address = Value;
}
/**
@@ -324,9 +344,11 @@ MmioRead32 (
IN UINTN Address
)
{
+ UINT32 Value;
+
ASSERT ((Address & 3) == 0);
- _ReadWriteBarrier ();
- return *(volatile UINT32 *)Address;
+ Value = *(volatile UINT32*)Address;
+ return Value;
}
/**
@@ -350,8 +372,7 @@ MmioWrite32 (
)
{
ASSERT ((Address & 3) == 0);
- _ReadWriteBarrier ();
- return *(volatile UINT32 *)Address = Value;
+ return *(volatile UINT32*)Address = Value;
}
/**
@@ -374,9 +395,11 @@ MmioRead64 (
IN UINTN Address
)
{
+ UINT64 Value;
+
ASSERT ((Address & 7) == 0);
- _ReadWriteBarrier ();
- return *(volatile UINT64 *)Address;
+ Value = *(volatile UINT64*)Address;
+ return Value;
}
/**
@@ -400,8 +423,7 @@ MmioWrite64 (
)
{
ASSERT ((Address & 7) == 0);
- _ReadWriteBarrier ();
- return *(volatile UINT64 *)Address = Value;
+ return *(volatile UINT64*)Address = Value;
}
#endif