diff options
Diffstat (limited to 'MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c')
-rw-r--r-- | MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c | 96 |
1 files changed, 65 insertions, 31 deletions
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c index d2bc5f527c..9f225a6b5d 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c @@ -13,21 +13,49 @@ **/
-
-
#include "BaseIoLibIntrinsicInternal.h"
//
// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
//
-int _inp (unsigned short port);
-unsigned short _inpw (unsigned short port);
-unsigned long _inpd (unsigned short port);
-int _outp (unsigned short port, int databyte );
-unsigned short _outpw (unsigned short port, unsigned short dataword );
-unsigned long _outpd (unsigned short port, unsigned long dataword );
-void _ReadWriteBarrier (void);
+int
+_inp (
+ unsigned short port
+ );
+
+unsigned short
+_inpw (
+ unsigned short port
+ );
+
+unsigned long
+_inpd (
+ unsigned short port
+ );
+
+int
+_outp (
+ unsigned short port,
+ int databyte
+ );
+
+unsigned short
+_outpw (
+ unsigned short port,
+ unsigned short dataword
+ );
+
+unsigned long
+_outpd (
+ unsigned short port,
+ unsigned long dataword
+ );
+
+void
+_ReadWriteBarrier (
+ void
+ );
#pragma intrinsic(_inp)
#pragma intrinsic(_inpw)
@@ -62,11 +90,11 @@ void _ReadWriteBarrier (void); UINT8
EFIAPI
IoRead8 (
- IN UINTN Port
+ IN UINTN Port
)
{
- UINT8 Value;
- BOOLEAN Flag;
+ UINT8 Value;
+ BOOLEAN Flag;
Flag = FilterBeforeIoRead (FilterWidth8, Port, &Value);
if (Flag) {
@@ -74,6 +102,7 @@ IoRead8 ( Value = (UINT8)_inp ((UINT16)Port);
_ReadWriteBarrier ();
}
+
FilterAfterIoRead (FilterWidth8, Port, &Value);
return Value;
@@ -97,18 +126,19 @@ IoRead8 ( UINT8
EFIAPI
IoWrite8 (
- IN UINTN Port,
- IN UINT8 Value
+ IN UINTN Port,
+ IN UINT8 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
- Flag = FilterBeforeIoWrite(FilterWidth8, Port, &Value);
+ Flag = FilterBeforeIoWrite (FilterWidth8, Port, &Value);
if (Flag) {
_ReadWriteBarrier ();
(UINT8)_outp ((UINT16)Port, Value);
_ReadWriteBarrier ();
}
+
FilterAfterIoWrite (FilterWidth8, Port, &Value);
return Value;
@@ -132,11 +162,11 @@ IoWrite8 ( UINT16
EFIAPI
IoRead16 (
- IN UINTN Port
+ IN UINTN Port
)
{
- UINT16 Value;
- BOOLEAN Flag;
+ UINT16 Value;
+ BOOLEAN Flag;
ASSERT ((Port & 1) == 0);
@@ -146,6 +176,7 @@ IoRead16 ( Value = _inpw ((UINT16)Port);
_ReadWriteBarrier ();
}
+
FilterBeforeIoRead (FilterWidth16, Port, &Value);
return Value;
@@ -170,20 +201,21 @@ IoRead16 ( UINT16
EFIAPI
IoWrite16 (
- IN UINTN Port,
- IN UINT16 Value
+ IN UINTN Port,
+ IN UINT16 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Port & 1) == 0);
- Flag = FilterBeforeIoWrite(FilterWidth16, Port, &Value);
+ Flag = FilterBeforeIoWrite (FilterWidth16, Port, &Value);
if (Flag) {
_ReadWriteBarrier ();
_outpw ((UINT16)Port, Value);
_ReadWriteBarrier ();
}
+
FilterAfterIoWrite (FilterWidth16, Port, &Value);
return Value;
@@ -207,20 +239,21 @@ IoWrite16 ( UINT32
EFIAPI
IoRead32 (
- IN UINTN Port
+ IN UINTN Port
)
{
- UINT32 Value;
- BOOLEAN Flag;
+ UINT32 Value;
+ BOOLEAN Flag;
ASSERT ((Port & 3) == 0);
- Flag = FilterBeforeIoRead(FilterWidth32, Port, &Value);
+ Flag = FilterBeforeIoRead (FilterWidth32, Port, &Value);
if (Flag) {
_ReadWriteBarrier ();
Value = _inpd ((UINT16)Port);
_ReadWriteBarrier ();
}
+
FilterAfterIoRead (FilterWidth32, Port, &Value);
return Value;
@@ -245,20 +278,21 @@ IoRead32 ( UINT32
EFIAPI
IoWrite32 (
- IN UINTN Port,
- IN UINT32 Value
+ IN UINTN Port,
+ IN UINT32 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
ASSERT ((Port & 3) == 0);
- Flag = FilterBeforeIoWrite(FilterWidth32, Port, &Value);
+ Flag = FilterBeforeIoWrite (FilterWidth32, Port, &Value);
if (Flag) {
_ReadWriteBarrier ();
_outpd ((UINT16)Port, Value);
_ReadWriteBarrier ();
}
+
FilterAfterIoWrite (FilterWidth32, Port, &Value);
return Value;
|