X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FLibrary%2FBaseIoLibIntrinsic%2FIoLibIpf.c;h=6b0bf6ab470c31782a1268103415e9c22221f952;hb=35a171541199329108aa8c5417386d7afce9ddbf;hp=23ca5c68ed3d83c44a5ab74f6e61c355f318ae9d;hpb=8fd567c6f1f0619eaa15830f4725598f5ced61f5;p=mirror_edk2.git
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c
index 23ca5c68ed..6b0bf6ab47 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c
@@ -1,21 +1,20 @@
/** @file
Common I/O Library routines.
- Copyright (c) 2006 - 2007, Intel Corporation
- All rights reserved. This program and the accompanying materials
+ Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+ This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
+ http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-//
-// Include common header file for this module.
-//
+
#include "BaseIoLibIntrinsicInternal.h"
+#include
#define MAP_PORT_BASE_TO_MEM(_Port) \
((((_Port) & 0xfffc) << 10) | ((_Port) & 0x0fff))
@@ -53,12 +52,14 @@ InternalGetMemoryMapAddress (
}
/**
- Reads a 8-bit I/O port.
+ Reads an 8-bit I/O port.
Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
This function must guarantee that all I/O read and write operations are
serialized.
+ If 8-bit I/O port operations are not supported, then ASSERT().
+
@param Port The I/O port to read.
@return The value read.
@@ -67,7 +68,7 @@ InternalGetMemoryMapAddress (
UINT8
EFIAPI
IoRead8 (
- IN UINT64 Port
+ IN UINTN Port
)
{
return MmioRead8 (InternalGetMemoryMapAddress (Port));
@@ -80,6 +81,9 @@ IoRead8 (
This function must guarantee that all I/O read and write operations are
serialized.
+ If 16-bit I/O port operations are not supported, then ASSERT().
+ If Port is not aligned on a 16-bit boundary, then ASSERT().
+
@param Port The I/O port to read.
@return The value read.
@@ -88,7 +92,7 @@ IoRead8 (
UINT16
EFIAPI
IoRead16 (
- IN UINT64 Port
+ IN UINTN Port
)
{
return MmioRead16 (InternalGetMemoryMapAddress (Port));
@@ -101,6 +105,9 @@ IoRead16 (
This function must guarantee that all I/O read and write operations are
serialized.
+ If 32-bit I/O port operations are not supported, then ASSERT().
+ If Port is not aligned on a 32-bit boundary, then ASSERT().
+
@param Port The I/O port to read.
@return The value read.
@@ -109,7 +116,7 @@ IoRead16 (
UINT32
EFIAPI
IoRead32 (
- IN UINT64 Port
+ IN UINTN Port
)
{
return MmioRead32 (InternalGetMemoryMapAddress (Port));
@@ -123,6 +130,7 @@ IoRead32 (
serialized.
If 64-bit I/O port operations are not supported, then ASSERT().
+ If Port is not aligned on a 64-bit boundary, then ASSERT().
@param Port The I/O port to read.
@@ -140,12 +148,14 @@ IoRead64 (
}
/**
- Writes a 8-bit I/O port.
+ Writes an 8-bit I/O port.
Writes the 8-bit I/O port specified by Port with the value specified by Value
and returns Value. This function must guarantee that all I/O read and write
operations are serialized.
+ If 8-bit I/O port operations are not supported, then ASSERT().
+
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@@ -155,11 +165,11 @@ IoRead64 (
UINT8
EFIAPI
IoWrite8 (
- IN UINT64 Port,
- IN UINT8 Data
+ IN UINTN Port,
+ IN UINT8 Value
)
{
- return MmioWrite8 (InternalGetMemoryMapAddress (Port), Data);
+ return MmioWrite8 (InternalGetMemoryMapAddress (Port), Value);
}
/**
@@ -169,6 +179,9 @@ IoWrite8 (
and returns Value. This function must guarantee that all I/O read and write
operations are serialized.
+ If 16-bit I/O port operations are not supported, then ASSERT().
+ If Port is not aligned on a 16-bit boundary, then ASSERT().
+
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@@ -178,11 +191,11 @@ IoWrite8 (
UINT16
EFIAPI
IoWrite16 (
- IN UINT64 Port,
- IN UINT16 Data
+ IN UINTN Port,
+ IN UINT16 Value
)
{
- return MmioWrite16 (InternalGetMemoryMapAddress (Port), Data);
+ return MmioWrite16 (InternalGetMemoryMapAddress (Port), Value);
}
/**
@@ -192,6 +205,9 @@ IoWrite16 (
and returns Value. This function must guarantee that all I/O read and write
operations are serialized.
+ If 32-bit I/O port operations are not supported, then ASSERT().
+ If Port is not aligned on a 32-bit boundary, then ASSERT().
+
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@@ -201,11 +217,11 @@ IoWrite16 (
UINT32
EFIAPI
IoWrite32 (
- IN UINT64 Port,
- IN UINT32 Data
+ IN UINTN Port,
+ IN UINT32 Value
)
{
- return MmioWrite32 (InternalGetMemoryMapAddress (Port), Data);
+ return MmioWrite32 (InternalGetMemoryMapAddress (Port), Value);
}
/**
@@ -216,6 +232,7 @@ IoWrite32 (
operations are serialized.
If 64-bit I/O port operations are not supported, then ASSERT().
+ If Port is not aligned on a 64-bit boundary, then ASSERT().
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@@ -235,12 +252,14 @@ IoWrite64 (
}
/**
- Reads a 8-bit MMIO register.
+ Reads an 8-bit MMIO register.
Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
returned. This function must guarantee that all MMIO read and write
operations are serialized.
+ If 8-bit MMIO register operations are not supported, then ASSERT().
+
@param Address The MMIO register to read.
@return The value read.
@@ -249,7 +268,7 @@ IoWrite64 (
UINT8
EFIAPI
MmioRead8 (
- IN UINT64 Address
+ IN UINTN Address
)
{
UINT8 Data;
@@ -270,6 +289,9 @@ MmioRead8 (
returned. This function must guarantee that all MMIO read and write
operations are serialized.
+ If 16-bit MMIO register operations are not supported, then ASSERT().
+ If Address is not aligned on a 16-bit boundary, then ASSERT().
+
@param Address The MMIO register to read.
@return The value read.
@@ -278,7 +300,7 @@ MmioRead8 (
UINT16
EFIAPI
MmioRead16 (
- IN UINT64 Address
+ IN UINTN Address
)
{
UINT16 Data;
@@ -304,6 +326,9 @@ MmioRead16 (
returned. This function must guarantee that all MMIO read and write
operations are serialized.
+ If 32-bit MMIO register operations are not supported, then ASSERT().
+ If Address is not aligned on a 32-bit boundary, then ASSERT().
+
@param Address The MMIO register to read.
@return The value read.
@@ -312,7 +337,7 @@ MmioRead16 (
UINT32
EFIAPI
MmioRead32 (
- IN UINT64 Address
+ IN UINTN Address
)
{
UINT32 Data;
@@ -338,6 +363,9 @@ MmioRead32 (
returned. This function must guarantee that all MMIO read and write
operations are serialized.
+ If 64-bit MMIO register operations are not supported, then ASSERT().
+ If Address is not aligned on a 64-bit boundary, then ASSERT().
+
@param Address The MMIO register to read.
@return The value read.
@@ -346,7 +374,7 @@ MmioRead32 (
UINT64
EFIAPI
MmioRead64 (
- IN UINT64 Address
+ IN UINTN Address
)
{
UINT64 Data;
@@ -367,32 +395,34 @@ MmioRead64 (
}
/**
- Writes a 8-bit MMIO register.
+ Writes an 8-bit MMIO register.
Writes the 8-bit MMIO register specified by Address with the value specified
by Value and returns Value. This function must guarantee that all MMIO read
and write operations are serialized.
- @param Address The MMIO register to write.
- @param Data The value to write to the MMIO register.
+ If 8-bit MMIO register operations are not supported, then ASSERT().
- @return The value written the memory address.
+ @param Address The MMIO register to write.
+ @param Value The value to write to the MMIO register.
+
+ @return Value.
**/
UINT8
EFIAPI
MmioWrite8 (
- IN UINT64 Address,
- IN UINT8 Data
+ IN UINTN Address,
+ IN UINT8 Value
)
{
Address |= BIT63;
MemoryFence ();
- *((volatile UINT8 *) Address) = Data;
+ *((volatile UINT8 *) Address) = Value;
MemoryFence ();
- return Data;
+ return Value;
}
/**
@@ -402,17 +432,20 @@ MmioWrite8 (
by Value and returns Value. This function must guarantee that all MMIO read
and write operations are serialized.
- @param Address The MMIO register to write.
- @param Data The value to write to the MMIO register.
+ If 16-bit MMIO register operations are not supported, then ASSERT().
+ If Address is not aligned on a 16-bit boundary, then ASSERT().
- @return The value written the memory address.
+ @param Address The MMIO register to write.
+ @param Value The value to write to the MMIO register.
+
+ @return Value.
**/
UINT16
EFIAPI
MmioWrite16 (
- IN UINT64 Address,
- IN UINT16 Data
+ IN UINTN Address,
+ IN UINT16 Value
)
{
//
@@ -423,10 +456,10 @@ MmioWrite16 (
Address |= BIT63;
MemoryFence ();
- *((volatile UINT16 *) Address) = Data;
+ *((volatile UINT16 *) Address) = Value;
MemoryFence ();
- return Data;
+ return Value;
}
/**
@@ -436,17 +469,20 @@ MmioWrite16 (
by Value and returns Value. This function must guarantee that all MMIO read
and write operations are serialized.
- @param Address The MMIO register to write.
- @param Data The value to write to the MMIO register.
+ If 32-bit MMIO register operations are not supported, then ASSERT().
+ If Address is not aligned on a 32-bit boundary, then ASSERT().
- @return The value written the memory address.
+ @param Address The MMIO register to write.
+ @param Value The value to write to the MMIO register.
+
+ @return Value.
**/
UINT32
EFIAPI
MmioWrite32 (
- IN UINT64 Address,
- IN UINT32 Data
+ IN UINTN Address,
+ IN UINT32 Value
)
{
//
@@ -457,10 +493,10 @@ MmioWrite32 (
Address |= BIT63;
MemoryFence ();
- *((volatile UINT32 *) Address) = Data;
+ *((volatile UINT32 *) Address) = Value;
MemoryFence ();
- return Data;
+ return Value;
}
/**
@@ -470,17 +506,18 @@ MmioWrite32 (
by Value and returns Value. This function must guarantee that all MMIO read
and write operations are serialized.
- @param Address The MMIO register to write.
- @param Data The value to write to the MMIO register.
+ If 64-bit MMIO register operations are not supported, then ASSERT().
+ If Address is not aligned on a 64-bit boundary, then ASSERT().
- @return The value written the memory address.
+ @param Address The MMIO register to write.
+ @param Value The value to write to the MMIO register.
**/
UINT64
EFIAPI
MmioWrite64 (
- IN UINT64 Address,
- IN UINT64 Data
+ IN UINTN Address,
+ IN UINT64 Value
)
{
//
@@ -491,8 +528,8 @@ MmioWrite64 (
Address |= BIT63;
MemoryFence ();
- *((volatile UINT64 *) Address) = Data;
+ *((volatile UINT64 *) Address) = Value;
MemoryFence ();
- return Data;
+ return Value;
}