X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FBaseIoLibIntrinsic%2FIoLibIcc.c;h=3036084f0caf9603f3b8a96959d3936f90876fab;hp=d12ce3de90b8530a27fd99e3eb375f3721b130bd;hb=9095d37b8fe5bfc3d02adad6ba7fd7359ebc0107;hpb=d074a8e1a25a05cb77d9185e0e4e5a5363c80871 diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c index d12ce3de90..3036084f0c 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c @@ -2,214 +2,19 @@ I/O Library. This file has compiler specifics for ICC as there is no ANSI C standard for doing IO. - Copyright (c) 2006 - 2007, Intel Corporation
All rights - reserved. This program and the accompanying materials are + Copyright (c) 2006 - 2018, 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" -/** - 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. - -**/ -UINT8 -EFIAPI -MmioRead8 ( - IN UINTN Address - ) -{ - return *(volatile UINT8*)Address; -} - -/** - 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. - - If 8-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT8 -EFIAPI -MmioWrite8 ( - IN UINTN Address, - IN UINT8 Value - ) -{ - return *(volatile UINT8*)Address = Value; -} - -/** - Reads a 16-bit MMIO register. - - Reads the 16-bit MMIO register specified by Address. The 16-bit read value is - 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(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT16 -EFIAPI -MmioRead16 ( - IN UINTN Address - ) -{ - ASSERT ((Address & 1) == 0); - return *(volatile UINT16*)Address; -} - -/** - Writes a 16-bit MMIO register. - - Writes the 16-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. - - If 16-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT16 -EFIAPI -MmioWrite16 ( - IN UINTN Address, - IN UINT16 Value - ) -{ - ASSERT ((Address & 1) == 0); - return *(volatile UINT16*)Address = Value; -} - -/** - Reads a 32-bit MMIO register. - - Reads the 32-bit MMIO register specified by Address. The 32-bit read value is - 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(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT32 -EFIAPI -MmioRead32 ( - IN UINTN Address - ) -{ - ASSERT ((Address & 3) == 0); - return *(volatile UINT32*)Address; -} - -/** - Writes a 32-bit MMIO register. - - Writes the 32-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. - - If 32-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT32 -EFIAPI -MmioWrite32 ( - IN UINTN Address, - IN UINT32 Value - ) -{ - ASSERT ((Address & 3) == 0); - return *(volatile UINT32*)Address = Value; -} - -/** - Reads a 64-bit MMIO register. - - Reads the 64-bit MMIO register specified by Address. The 64-bit read value is - 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(). - - @param Address The MMIO register to read. - - @return The value read. - -**/ -UINT64 -EFIAPI -MmioRead64 ( - IN UINTN Address - ) -{ - ASSERT ((Address & 7) == 0); - return *(volatile UINT64*)Address; -} - -/** - Writes a 64-bit MMIO register. - - Writes the 64-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. - - If 64-bit MMIO register operations are not supported, then ASSERT(). - - @param Address The MMIO register to write. - @param Value The value to write to the MMIO register. - -**/ -UINT64 -EFIAPI -MmioWrite64 ( - IN UINTN Address, - IN UINT64 Value - ) -{ - ASSERT ((Address & 7) == 0); - return *(volatile UINT64*)Address = Value; -} - - - /** Reads an 8-bit I/O port. @@ -268,7 +73,7 @@ IoWrite8 ( mov dx, word ptr [Port] out dx, al } - return Value; + return Value; } /** @@ -279,6 +84,7 @@ IoWrite8 ( 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. @@ -312,6 +118,7 @@ IoRead16 ( 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. @@ -334,9 +141,6 @@ IoWrite16 ( out dx, ax } - // - // Never reached return statement. - // return Value; } @@ -348,6 +152,7 @@ IoWrite16 ( 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. @@ -369,7 +174,7 @@ IoRead32 ( in eax, dx mov dword ptr [Data], eax } - + return Data; } @@ -381,6 +186,7 @@ IoRead32 ( 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. @@ -391,12 +197,12 @@ IoRead32 ( UINT32 EFIAPI IoWrite32 ( - IN UINTN Port, - IN UINT32 Value + IN UINTN Port, + IN UINT32 Value ) { ASSERT ((Port & 3) == 0); - + __asm { mov eax, dword ptr [Value] mov dx, word ptr [Port]