X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FPeiIoLibCpuIo%2FIoHighLevel.c;h=6fb5ca6e4ec0005841a884ab7211245427dbf8e8;hp=0d8d0de8f402c26c9547598497bc1a533dea6ad2;hb=62991af27f84e5f20e55dee6e1f90eb77ec5325e;hpb=0ffa12863e9e60cfd1900e3a83b21f32f89afdf2 diff --git a/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c b/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c index 0d8d0de8f4..6fb5ca6e4e 100644 --- a/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c +++ b/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c @@ -13,21 +13,21 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - Module Name: IoHighLevel.c +**/ - The following IoLib instances share the same version of this file: - BaseIoLibIntrinsic - DxeIoLibCpuIo - PeiIoLibCpuIo +#include -**/ +#include +#include +#include +#include /** - Reads an 8-bit I/O port, performs a bitwise inclusive OR, and writes the + Reads an 8-bit I/O port, performs a bitwise OR, and writes the result back to the 8-bit I/O port. - Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR + Reads the 8-bit I/O port specified by Port, performs a bitwise OR between the read result and the value specified by OrData, and writes the result to the 8-bit I/O port specified by Port. The value written to the I/O port is returned. This function must guarantee that all I/O read and write @@ -48,7 +48,7 @@ IoOr8 ( IN UINT8 OrData ) { - return IoWrite8 (Port, IoRead8 (Port) | OrData); + return IoWrite8 (Port, (UINT8) (IoRead8 (Port) | OrData)); } /** @@ -76,12 +76,12 @@ IoAnd8 ( IN UINT8 AndData ) { - return IoWrite8 (Port, IoRead8 (Port) & AndData); + return IoWrite8 (Port, (UINT8) (IoRead8 (Port) & AndData)); } /** - Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 8-bit I/O port. + Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise + OR, and writes the result back to the 8-bit I/O port. Reads the 8-bit I/O port specified by Port, performs a bitwise AND between the read result and the value specified by AndData, performs a bitwise OR @@ -107,7 +107,7 @@ IoAndThenOr8 ( IN UINT8 OrData ) { - return IoWrite8 (Port, (IoRead8 (Port) & AndData) | OrData); + return IoWrite8 (Port, (UINT8) ((IoRead8 (Port) & AndData) | OrData)); } /** @@ -127,7 +127,7 @@ IoAndThenOr8 ( @param EndBit The ordinal of the most significant bit in the bit field. Range 0..7. - @return The value read. + @return The value read from Port. **/ UINT8 @@ -146,8 +146,7 @@ IoBitFieldRead8 ( Writes Value to the bit field of the I/O register. The bit field is specified by the StartBit and the EndBit. All other bits in the destination I/O - register are preserved. The value written to the I/O port is returned. Extra - left bits in Value are stripped. + register are preserved. The value written to the I/O port is returned. If 8-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). @@ -183,7 +182,7 @@ IoBitFieldWrite8 ( Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the result back to the bit field in the 8-bit port. - Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR + Reads the 8-bit I/O port specified by Port, performs a bitwise OR between the read result and the value specified by OrData, and writes the result to the 8-bit I/O port specified by Port. The value written to the I/O port is returned. This function must guarantee that all I/O read and write @@ -261,11 +260,11 @@ IoBitFieldAnd8 ( /** Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise inclusive OR, and writes the result back to the bit field in the + bitwise OR, and writes the result back to the bit field in the 8-bit port. Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise inclusive OR between the read result and the value specified by + by a bitwise OR between the read result and the value specified by AndData, and writes the result to the 8-bit I/O port specified by Port. The value written to the I/O port is returned. This function must guarantee that all I/O read and write operations are serialized. Extra left bits in both @@ -304,10 +303,10 @@ IoBitFieldAndThenOr8 ( } /** - Reads a 16-bit I/O port, performs a bitwise inclusive OR, and writes the + Reads a 16-bit I/O port, performs a bitwise OR, and writes the result back to the 16-bit I/O port. - Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR + Reads the 16-bit I/O port specified by Port, performs a bitwise OR between the read result and the value specified by OrData, and writes the result to the 16-bit I/O port specified by Port. The value written to the I/O port is returned. This function must guarantee that all I/O read and write @@ -328,7 +327,7 @@ IoOr16 ( IN UINT16 OrData ) { - return IoWrite16 (Port, IoRead16 (Port) | OrData); + return IoWrite16 (Port, (UINT16) (IoRead16 (Port) | OrData)); } /** @@ -356,12 +355,12 @@ IoAnd16 ( IN UINT16 AndData ) { - return IoWrite16 (Port, IoRead16 (Port) & AndData); + return IoWrite16 (Port, (UINT16) (IoRead16 (Port) & AndData)); } /** - Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 16-bit I/O port. + Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise + OR, and writes the result back to the 16-bit I/O port. Reads the 16-bit I/O port specified by Port, performs a bitwise AND between the read result and the value specified by AndData, performs a bitwise OR @@ -387,7 +386,7 @@ IoAndThenOr16 ( IN UINT16 OrData ) { - return IoWrite16 (Port, (IoRead16 (Port) & AndData) | OrData); + return IoWrite16 (Port, (UINT16) ((IoRead16 (Port) & AndData) | OrData)); } /** @@ -407,7 +406,7 @@ IoAndThenOr16 ( @param EndBit The ordinal of the most significant bit in the bit field. Range 0..15. - @return The value read. + @return The value read from Port. **/ UINT16 @@ -463,7 +462,7 @@ IoBitFieldWrite16 ( Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the result back to the bit field in the 16-bit port. - Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR + Reads the 16-bit I/O port specified by Port, performs a bitwise OR between the read result and the value specified by OrData, and writes the result to the 16-bit I/O port specified by Port. The value written to the I/O port is returned. This function must guarantee that all I/O read and write @@ -541,11 +540,11 @@ IoBitFieldAnd16 ( /** Reads a bit field in a 16-bit port, performs a bitwise AND followed by a - bitwise inclusive OR, and writes the result back to the bit field in the + bitwise OR, and writes the result back to the bit field in the 16-bit port. Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise inclusive OR between the read result and the value specified by + by a bitwise OR between the read result and the value specified by AndData, and writes the result to the 16-bit I/O port specified by Port. The value written to the I/O port is returned. This function must guarantee that all I/O read and write operations are serialized. Extra left bits in both @@ -584,10 +583,10 @@ IoBitFieldAndThenOr16 ( } /** - Reads a 32-bit I/O port, performs a bitwise inclusive OR, and writes the + Reads a 32-bit I/O port, performs a bitwise OR, and writes the result back to the 32-bit I/O port. - Reads the 32-bit I/O port specified by Port, performs a bitwise inclusive OR + Reads the 32-bit I/O port specified by Port, performs a bitwise OR between the read result and the value specified by OrData, and writes the result to the 32-bit I/O port specified by Port. The value written to the I/O port is returned. This function must guarantee that all I/O read and write @@ -640,8 +639,8 @@ IoAnd32 ( } /** - Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 32-bit I/O port. + Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise + OR, and writes the result back to the 32-bit I/O port. Reads the 32-bit I/O port specified by Port, performs a bitwise AND between the read result and the value specified by AndData, performs a bitwise OR @@ -687,7 +686,7 @@ IoAndThenOr32 ( @param EndBit The ordinal of the most significant bit in the bit field. Range 0..31. - @return The value read. + @return The value read from Port. **/ UINT32 @@ -743,7 +742,7 @@ IoBitFieldWrite32 ( Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the result back to the bit field in the 32-bit port. - Reads the 32-bit I/O port specified by Port, performs a bitwise inclusive OR + Reads the 32-bit I/O port specified by Port, performs a bitwise OR between the read result and the value specified by OrData, and writes the result to the 32-bit I/O port specified by Port. The value written to the I/O port is returned. This function must guarantee that all I/O read and write @@ -821,11 +820,11 @@ IoBitFieldAnd32 ( /** Reads a bit field in a 32-bit port, performs a bitwise AND followed by a - bitwise inclusive OR, and writes the result back to the bit field in the + bitwise OR, and writes the result back to the bit field in the 32-bit port. Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise inclusive OR between the read result and the value specified by + by a bitwise OR between the read result and the value specified by AndData, and writes the result to the 32-bit I/O port specified by Port. The value written to the I/O port is returned. This function must guarantee that all I/O read and write operations are serialized. Extra left bits in both @@ -864,10 +863,10 @@ IoBitFieldAndThenOr32 ( } /** - Reads a 64-bit I/O port, performs a bitwise inclusive OR, and writes the + Reads a 64-bit I/O port, performs a bitwise OR, and writes the result back to the 64-bit I/O port. - Reads the 64-bit I/O port specified by Port, performs a bitwise inclusive OR + Reads the 64-bit I/O port specified by Port, performs a bitwise OR between the read result and the value specified by OrData, and writes the result to the 64-bit I/O port specified by Port. The value written to the I/O port is returned. This function must guarantee that all I/O read and write @@ -920,8 +919,8 @@ IoAnd64 ( } /** - Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 64-bit I/O port. + Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise + OR, and writes the result back to the 64-bit I/O port. Reads the 64-bit I/O port specified by Port, performs a bitwise AND between the read result and the value specified by AndData, performs a bitwise OR @@ -1023,7 +1022,7 @@ IoBitFieldWrite64 ( Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the result back to the bit field in the 64-bit port. - Reads the 64-bit I/O port specified by Port, performs a bitwise inclusive OR + Reads the 64-bit I/O port specified by Port, performs a bitwise OR between the read result and the value specified by OrData, and writes the result to the 64-bit I/O port specified by Port. The value written to the I/O port is returned. This function must guarantee that all I/O read and write @@ -1101,11 +1100,11 @@ IoBitFieldAnd64 ( /** Reads a bit field in a 64-bit port, performs a bitwise AND followed by a - bitwise inclusive OR, and writes the result back to the bit field in the + bitwise OR, and writes the result back to the bit field in the 64-bit port. Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed - by a bitwise inclusive OR between the read result and the value specified by + by a bitwise OR between the read result and the value specified by AndData, and writes the result to the 64-bit I/O port specified by Port. The value written to the I/O port is returned. This function must guarantee that all I/O read and write operations are serialized. Extra left bits in both @@ -1144,11 +1143,11 @@ IoBitFieldAndThenOr64 ( } /** - Reads an 8-bit MMIO register, performs a bitwise inclusive OR, and writes the + Reads an 8-bit MMIO register, performs a bitwise OR, and writes the result back to the 8-bit MMIO register. - Reads the 8-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and + Reads the 8-bit MMIO register specified by Address, performs a bitwise + OR between the read result and the value specified by OrData, and writes the result to the 8-bit MMIO register specified by Address. The value written to the MMIO register is returned. This function must guarantee that all MMIO read and write operations are serialized. @@ -1168,7 +1167,7 @@ MmioOr8 ( IN UINT8 OrData ) { - return MmioWrite8 (Address, MmioRead8 (Address) | OrData); + return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) | OrData)); } /** @@ -1196,12 +1195,12 @@ MmioAnd8 ( IN UINT8 AndData ) { - return MmioWrite8 (Address, MmioRead8 (Address) & AndData); + return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) & AndData)); } /** - Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 8-bit MMIO register. + Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise + OR, and writes the result back to the 8-bit MMIO register. Reads the 8-bit MMIO register specified by Address, performs a bitwise AND between the read result and the value specified by AndData, performs a @@ -1228,7 +1227,7 @@ MmioAndThenOr8 ( IN UINT8 OrData ) { - return MmioWrite8 (Address, (MmioRead8 (Address) & AndData) | OrData); + return MmioWrite8 (Address, (UINT8) ((MmioRead8 (Address) & AndData) | OrData)); } /** @@ -1303,8 +1302,8 @@ MmioBitFieldWrite8 ( Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and writes the result back to the bit field in the 8-bit MMIO register. - Reads the 8-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and + Reads the 8-bit MMIO register specified by Address, performs a bitwise + OR between the read result and the value specified by OrData, and writes the result to the 8-bit MMIO register specified by Address. The value written to the MMIO register is returned. This function must guarantee that all MMIO read and write operations are serialized. Extra left bits in OrData @@ -1383,11 +1382,11 @@ MmioBitFieldAnd8 ( /** Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed - by a bitwise inclusive OR, and writes the result back to the bit field in the + by a bitwise OR, and writes the result back to the bit field in the 8-bit MMIO register. Reads the 8-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise inclusive OR between the read result and the value + followed by a bitwise OR between the read result and the value specified by AndData, and writes the result to the 8-bit MMIO register specified by Address. The value written to the MMIO register is returned. This function must guarantee that all MMIO read and write operations are @@ -1426,11 +1425,11 @@ MmioBitFieldAndThenOr8 ( } /** - Reads a 16-bit MMIO register, performs a bitwise inclusive OR, and writes the + Reads a 16-bit MMIO register, performs a bitwise OR, and writes the result back to the 16-bit MMIO register. - Reads the 16-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and + Reads the 16-bit MMIO register specified by Address, performs a bitwise + OR between the read result and the value specified by OrData, and writes the result to the 16-bit MMIO register specified by Address. The value written to the MMIO register is returned. This function must guarantee that all MMIO read and write operations are serialized. @@ -1450,7 +1449,7 @@ MmioOr16 ( IN UINT16 OrData ) { - return MmioWrite16 (Address, MmioRead16 (Address) | OrData); + return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) | OrData)); } /** @@ -1478,12 +1477,12 @@ MmioAnd16 ( IN UINT16 AndData ) { - return MmioWrite16 (Address, MmioRead16 (Address) & AndData); + return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) & AndData)); } /** - Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 16-bit MMIO register. + Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise + OR, and writes the result back to the 16-bit MMIO register. Reads the 16-bit MMIO register specified by Address, performs a bitwise AND between the read result and the value specified by AndData, performs a @@ -1510,7 +1509,7 @@ MmioAndThenOr16 ( IN UINT16 OrData ) { - return MmioWrite16 (Address, (MmioRead16 (Address) & AndData) | OrData); + return MmioWrite16 (Address, (UINT16) ((MmioRead16 (Address) & AndData) | OrData)); } /** @@ -1530,7 +1529,7 @@ MmioAndThenOr16 ( @param EndBit The ordinal of the most significant bit in the bit field. Range 0..15. - @return The value read. + @return The value read from Address. **/ UINT16 @@ -1585,8 +1584,8 @@ MmioBitFieldWrite16 ( Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and writes the result back to the bit field in the 16-bit MMIO register. - Reads the 16-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and + Reads the 16-bit MMIO register specified by Address, performs a bitwise + OR between the read result and the value specified by OrData, and writes the result to the 16-bit MMIO register specified by Address. The value written to the MMIO register is returned. This function must guarantee that all MMIO read and write operations are serialized. Extra left bits in OrData @@ -1665,11 +1664,11 @@ MmioBitFieldAnd16 ( /** Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed - by a bitwise inclusive OR, and writes the result back to the bit field in the + by a bitwise OR, and writes the result back to the bit field in the 16-bit MMIO register. Reads the 16-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise inclusive OR between the read result and the value + followed by a bitwise OR between the read result and the value specified by AndData, and writes the result to the 16-bit MMIO register specified by Address. The value written to the MMIO register is returned. This function must guarantee that all MMIO read and write operations are @@ -1708,11 +1707,11 @@ MmioBitFieldAndThenOr16 ( } /** - Reads a 32-bit MMIO register, performs a bitwise inclusive OR, and writes the + Reads a 32-bit MMIO register, performs a bitwise OR, and writes the result back to the 32-bit MMIO register. - Reads the 32-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and + Reads the 32-bit MMIO register specified by Address, performs a bitwise + OR between the read result and the value specified by OrData, and writes the result to the 32-bit MMIO register specified by Address. The value written to the MMIO register is returned. This function must guarantee that all MMIO read and write operations are serialized. @@ -1764,8 +1763,8 @@ MmioAnd32 ( } /** - Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 32-bit MMIO register. + Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise + OR, and writes the result back to the 32-bit MMIO register. Reads the 32-bit MMIO register specified by Address, performs a bitwise AND between the read result and the value specified by AndData, performs a @@ -1867,8 +1866,8 @@ MmioBitFieldWrite32 ( Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and writes the result back to the bit field in the 32-bit MMIO register. - Reads the 32-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and + Reads the 32-bit MMIO register specified by Address, performs a bitwise + OR between the read result and the value specified by OrData, and writes the result to the 32-bit MMIO register specified by Address. The value written to the MMIO register is returned. This function must guarantee that all MMIO read and write operations are serialized. Extra left bits in OrData @@ -1947,11 +1946,11 @@ MmioBitFieldAnd32 ( /** Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed - by a bitwise inclusive OR, and writes the result back to the bit field in the + by a bitwise OR, and writes the result back to the bit field in the 32-bit MMIO register. Reads the 32-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise inclusive OR between the read result and the value + followed by a bitwise OR between the read result and the value specified by AndData, and writes the result to the 32-bit MMIO register specified by Address. The value written to the MMIO register is returned. This function must guarantee that all MMIO read and write operations are @@ -1990,11 +1989,11 @@ MmioBitFieldAndThenOr32 ( } /** - Reads a 64-bit MMIO register, performs a bitwise inclusive OR, and writes the + Reads a 64-bit MMIO register, performs a bitwise OR, and writes the result back to the 64-bit MMIO register. - Reads the 64-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and + Reads the 64-bit MMIO register specified by Address, performs a bitwise + OR between the read result and the value specified by OrData, and writes the result to the 64-bit MMIO register specified by Address. The value written to the MMIO register is returned. This function must guarantee that all MMIO read and write operations are serialized. @@ -2046,8 +2045,8 @@ MmioAnd64 ( } /** - Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise - inclusive OR, and writes the result back to the 64-bit MMIO register. + Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise + OR, and writes the result back to the 64-bit MMIO register. Reads the 64-bit MMIO register specified by Address, performs a bitwise AND between the read result and the value specified by AndData, performs a @@ -2149,8 +2148,8 @@ MmioBitFieldWrite64 ( Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and writes the result back to the bit field in the 64-bit MMIO register. - Reads the 64-bit MMIO register specified by Address, performs a bitwise - inclusive OR between the read result and the value specified by OrData, and + Reads the 64-bit MMIO register specified by Address, performs a bitwise + OR between the read result and the value specified by OrData, and writes the result to the 64-bit MMIO register specified by Address. The value written to the MMIO register is returned. This function must guarantee that all MMIO read and write operations are serialized. Extra left bits in OrData @@ -2229,11 +2228,11 @@ MmioBitFieldAnd64 ( /** Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed - by a bitwise inclusive OR, and writes the result back to the bit field in the + by a bitwise OR, and writes the result back to the bit field in the 64-bit MMIO register. Reads the 64-bit MMIO register specified by Address, performs a bitwise AND - followed by a bitwise inclusive OR between the read result and the value + followed by a bitwise OR between the read result and the value specified by AndData, and writes the result to the 64-bit MMIO register specified by Address. The value written to the MMIO register is returned. This function must guarantee that all MMIO read and write operations are