MdePkg: Expand BaseIoLibIntrinsic (IoLib class) library
The UefiCpuPkg/CpuIo2Dxe driver and the QemuCfgLib library have duplicate implementations of I/O Fifo routines. This patch clones the I/O Fifo routines into the BaseIoLibIntrinsic library and expands the IoLib class to include the ported I/O Fifo routines. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Signed-off-by: Leo Duran <leo.duran@amd.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
@ -2,6 +2,8 @@
|
|||||||
Provide services to access I/O Ports and MMIO registers.
|
Provide services to access I/O Ports and MMIO registers.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
|
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -75,6 +77,56 @@ IoWrite8 (
|
|||||||
IN UINT8 Value
|
IN UINT8 Value
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads an 8-bit I/O port fifo into a block of memory.
|
||||||
|
|
||||||
|
Reads the 8-bit I/O fifo port specified by Port.
|
||||||
|
The port is read Count times, and the read data is
|
||||||
|
stored in the provided Buffer.
|
||||||
|
|
||||||
|
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.
|
||||||
|
@param Count The number of times to read I/O port.
|
||||||
|
@param Buffer The buffer to store the read data into.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoReadFifo8 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
OUT VOID *Buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes a block of memory into an 8-bit I/O port fifo.
|
||||||
|
|
||||||
|
Writes the 8-bit I/O fifo port specified by Port.
|
||||||
|
The port is written Count times, and the write data is
|
||||||
|
retrieved from the provided Buffer.
|
||||||
|
|
||||||
|
This function must guarantee that all I/O write 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 Count The number of times to write I/O port.
|
||||||
|
@param Buffer The buffer to retrieve the write data from.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoWriteFifo8 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
IN VOID *Buffer
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads an 8-bit I/O port, performs a bitwise 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.
|
result back to the 8-bit I/O port.
|
||||||
@ -367,6 +419,56 @@ IoWrite16 (
|
|||||||
IN UINT16 Value
|
IN UINT16 Value
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a 16-bit I/O port fifo into a block of memory.
|
||||||
|
|
||||||
|
Reads the 16-bit I/O fifo port specified by Port.
|
||||||
|
The port is read Count times, and the read data is
|
||||||
|
stored in the provided Buffer.
|
||||||
|
|
||||||
|
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().
|
||||||
|
|
||||||
|
@param Port The I/O port to read.
|
||||||
|
@param Count The number of times to read I/O port.
|
||||||
|
@param Buffer The buffer to store the read data into.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoReadFifo16 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
OUT VOID *Buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes a block of memory into a 16-bit I/O port fifo.
|
||||||
|
|
||||||
|
Writes the 16-bit I/O fifo port specified by Port.
|
||||||
|
The port is written Count times, and the write data is
|
||||||
|
retrieved from the provided Buffer.
|
||||||
|
|
||||||
|
This function must guarantee that all I/O write and write operations are
|
||||||
|
serialized.
|
||||||
|
|
||||||
|
If 16-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
|
@param Port The I/O port to write.
|
||||||
|
@param Count The number of times to write I/O port.
|
||||||
|
@param Buffer The buffer to retrieve the write data from.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoWriteFifo16 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
IN VOID *Buffer
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads a 16-bit I/O port, performs a bitwise 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.
|
result back to the 16-bit I/O port.
|
||||||
@ -668,6 +770,56 @@ IoWrite32 (
|
|||||||
IN UINT32 Value
|
IN UINT32 Value
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a 32-bit I/O port fifo into a block of memory.
|
||||||
|
|
||||||
|
Reads the 32-bit I/O fifo port specified by Port.
|
||||||
|
The port is read Count times, and the read data is
|
||||||
|
stored in the provided Buffer.
|
||||||
|
|
||||||
|
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().
|
||||||
|
|
||||||
|
@param Port The I/O port to read.
|
||||||
|
@param Count The number of times to read I/O port.
|
||||||
|
@param Buffer The buffer to store the read data into.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoReadFifo32 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
OUT VOID *Buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes a block of memory into a 32-bit I/O port fifo.
|
||||||
|
|
||||||
|
Writes the 32-bit I/O fifo port specified by Port.
|
||||||
|
The port is written Count times, and the write data is
|
||||||
|
retrieved from the provided Buffer.
|
||||||
|
|
||||||
|
This function must guarantee that all I/O write and write operations are
|
||||||
|
serialized.
|
||||||
|
|
||||||
|
If 32-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
|
@param Port The I/O port to write.
|
||||||
|
@param Count The number of times to write I/O port.
|
||||||
|
@param Buffer The buffer to retrieve the write data from.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoWriteFifo32 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
IN VOID *Buffer
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads a 32-bit I/O port, performs a bitwise 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.
|
result back to the 32-bit I/O port.
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||||
|
# Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -16,7 +17,6 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
##
|
##
|
||||||
|
|
||||||
[Defines]
|
[Defines]
|
||||||
@ -43,12 +43,16 @@
|
|||||||
IoLibMsc.c | MSFT
|
IoLibMsc.c | MSFT
|
||||||
IoLibIcc.c | INTEL
|
IoLibIcc.c | INTEL
|
||||||
IoLib.c
|
IoLib.c
|
||||||
|
Ia32/IoFifo.nasm
|
||||||
|
Ia32/IoFifo.asm
|
||||||
|
|
||||||
[Sources.X64]
|
[Sources.X64]
|
||||||
IoLibGcc.c | GCC
|
IoLibGcc.c | GCC
|
||||||
IoLibMsc.c | MSFT
|
IoLibMsc.c | MSFT
|
||||||
IoLibIcc.c | INTEL
|
IoLibIcc.c | INTEL
|
||||||
IoLib.c
|
IoLib.c
|
||||||
|
X64/IoFifo.nasm
|
||||||
|
X64/IoFifo.asm
|
||||||
|
|
||||||
[Sources.EBC]
|
[Sources.EBC]
|
||||||
IoLibEbc.c
|
IoLibEbc.c
|
||||||
|
141
MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm
Normal file
141
MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
|
; Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||||
|
;
|
||||||
|
; 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.
|
||||||
|
;
|
||||||
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.586P
|
||||||
|
.model flat,C
|
||||||
|
.code
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoReadFifo8 (
|
||||||
|
; IN UINTN Port,
|
||||||
|
; IN UINTN Size,
|
||||||
|
; OUT VOID *Buffer
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
IoReadFifo8 PROC
|
||||||
|
push edi
|
||||||
|
cld
|
||||||
|
mov dx, [esp + 8]
|
||||||
|
mov ecx, [esp + 12]
|
||||||
|
mov edi, [esp + 16]
|
||||||
|
rep insb
|
||||||
|
pop edi
|
||||||
|
ret
|
||||||
|
IoReadFifo8 ENDP
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoReadFifo16 (
|
||||||
|
; IN UINTN Port,
|
||||||
|
; IN UINTN Size,
|
||||||
|
; OUT VOID *Buffer
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
IoReadFifo16 PROC
|
||||||
|
push edi
|
||||||
|
cld
|
||||||
|
mov dx, [esp + 8]
|
||||||
|
mov ecx, [esp + 12]
|
||||||
|
mov edi, [esp + 16]
|
||||||
|
rep insw
|
||||||
|
pop edi
|
||||||
|
ret
|
||||||
|
IoReadFifo16 ENDP
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoReadFifo32 (
|
||||||
|
; IN UINTN Port,
|
||||||
|
; IN UINTN Size,
|
||||||
|
; OUT VOID *Buffer
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
IoReadFifo32 PROC
|
||||||
|
push edi
|
||||||
|
cld
|
||||||
|
mov dx, [esp + 8]
|
||||||
|
mov ecx, [esp + 12]
|
||||||
|
mov edi, [esp + 16]
|
||||||
|
rep insd
|
||||||
|
pop edi
|
||||||
|
ret
|
||||||
|
IoReadFifo32 ENDP
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoWriteFifo8 (
|
||||||
|
; IN UINTN Port,
|
||||||
|
; IN UINTN Size,
|
||||||
|
; IN VOID *Buffer
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
IoWriteFifo8 PROC
|
||||||
|
push esi
|
||||||
|
cld
|
||||||
|
mov dx, [esp + 8]
|
||||||
|
mov ecx, [esp + 12]
|
||||||
|
mov esi, [esp + 16]
|
||||||
|
rep outsb
|
||||||
|
pop esi
|
||||||
|
ret
|
||||||
|
IoWriteFifo8 ENDP
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoWriteFifo16 (
|
||||||
|
; IN UINTN Port,
|
||||||
|
; IN UINTN Size,
|
||||||
|
; IN VOID *Buffer
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
IoWriteFifo16 PROC
|
||||||
|
push esi
|
||||||
|
cld
|
||||||
|
mov dx, [esp + 8]
|
||||||
|
mov ecx, [esp + 12]
|
||||||
|
mov esi, [esp + 16]
|
||||||
|
rep outsw
|
||||||
|
pop esi
|
||||||
|
ret
|
||||||
|
IoWriteFifo16 ENDP
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoWriteFifo32 (
|
||||||
|
; IN UINTN Port,
|
||||||
|
; IN UINTN Size,
|
||||||
|
; IN VOID *Buffer
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
IoWriteFifo32 PROC
|
||||||
|
push esi
|
||||||
|
cld
|
||||||
|
mov dx, [esp + 8]
|
||||||
|
mov ecx, [esp + 12]
|
||||||
|
mov esi, [esp + 16]
|
||||||
|
rep outsd
|
||||||
|
pop esi
|
||||||
|
ret
|
||||||
|
IoWriteFifo32 ENDP
|
||||||
|
|
||||||
|
END
|
||||||
|
|
137
MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm
Normal file
137
MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
|
; Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||||
|
;
|
||||||
|
; 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.
|
||||||
|
;
|
||||||
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
SECTION .text
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoReadFifo8 (
|
||||||
|
; IN UINTN Port,
|
||||||
|
; IN UINTN Size,
|
||||||
|
; OUT VOID *Buffer
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
global ASM_PFX(IoReadFifo8)
|
||||||
|
ASM_PFX(IoReadFifo8):
|
||||||
|
push edi
|
||||||
|
cld
|
||||||
|
mov dx, [esp + 8]
|
||||||
|
mov ecx, [esp + 12]
|
||||||
|
mov edi, [esp + 16]
|
||||||
|
rep insb
|
||||||
|
pop edi
|
||||||
|
ret
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoReadFifo16 (
|
||||||
|
; IN UINTN Port,
|
||||||
|
; IN UINTN Size,
|
||||||
|
; OUT VOID *Buffer
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
global ASM_PFX(IoReadFifo16)
|
||||||
|
ASM_PFX(IoReadFifo16):
|
||||||
|
push edi
|
||||||
|
cld
|
||||||
|
mov dx, [esp + 8]
|
||||||
|
mov ecx, [esp + 12]
|
||||||
|
mov edi, [esp + 16]
|
||||||
|
rep insw
|
||||||
|
pop edi
|
||||||
|
ret
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoReadFifo32 (
|
||||||
|
; IN UINTN Port,
|
||||||
|
; IN UINTN Size,
|
||||||
|
; OUT VOID *Buffer
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
global ASM_PFX(IoReadFifo32)
|
||||||
|
ASM_PFX(IoReadFifo32):
|
||||||
|
push edi
|
||||||
|
cld
|
||||||
|
mov dx, [esp + 8]
|
||||||
|
mov ecx, [esp + 12]
|
||||||
|
mov edi, [esp + 16]
|
||||||
|
rep insd
|
||||||
|
pop edi
|
||||||
|
ret
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoWriteFifo8 (
|
||||||
|
; IN UINTN Port,
|
||||||
|
; IN UINTN Size,
|
||||||
|
; IN VOID *Buffer
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
global ASM_PFX(IoWriteFifo8)
|
||||||
|
ASM_PFX(IoWriteFifo8):
|
||||||
|
push esi
|
||||||
|
cld
|
||||||
|
mov dx, [esp + 8]
|
||||||
|
mov ecx, [esp + 12]
|
||||||
|
mov esi, [esp + 16]
|
||||||
|
rep outsb
|
||||||
|
pop esi
|
||||||
|
ret
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoWriteFifo16 (
|
||||||
|
; IN UINTN Port,
|
||||||
|
; IN UINTN Size,
|
||||||
|
; IN VOID *Buffer
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
global ASM_PFX(IoWriteFifo16)
|
||||||
|
ASM_PFX(IoWriteFifo16):
|
||||||
|
push esi
|
||||||
|
cld
|
||||||
|
mov dx, [esp + 8]
|
||||||
|
mov ecx, [esp + 12]
|
||||||
|
mov esi, [esp + 16]
|
||||||
|
rep outsw
|
||||||
|
pop esi
|
||||||
|
ret
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoWriteFifo32 (
|
||||||
|
; IN UINTN Port,
|
||||||
|
; IN UINTN Size,
|
||||||
|
; IN VOID *Buffer
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
global ASM_PFX(IoWriteFifo32)
|
||||||
|
ASM_PFX(IoWriteFifo32):
|
||||||
|
push esi
|
||||||
|
cld
|
||||||
|
mov dx, [esp + 8]
|
||||||
|
mov ecx, [esp + 12]
|
||||||
|
mov esi, [esp + 16]
|
||||||
|
rep outsd
|
||||||
|
pop esi
|
||||||
|
ret
|
||||||
|
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||||
|
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -221,6 +223,173 @@ IoWrite64 (
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads an 8-bit I/O port fifo into a block of memory.
|
||||||
|
|
||||||
|
Reads the 8-bit I/O fifo port specified by Port.
|
||||||
|
The port is read Count times, and the read data is
|
||||||
|
stored in the provided Buffer.
|
||||||
|
|
||||||
|
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.
|
||||||
|
@param Count The number of times to read I/O port.
|
||||||
|
@param Buffer The buffer to store the read data into.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoReadFifo8 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
OUT VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes a block of memory into an 8-bit I/O port fifo.
|
||||||
|
|
||||||
|
Writes the 8-bit I/O fifo port specified by Port.
|
||||||
|
The port is written Count times, and the write data is
|
||||||
|
retrieved from the provided Buffer.
|
||||||
|
|
||||||
|
This function must guarantee that all I/O write 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 Count The number of times to write I/O port.
|
||||||
|
@param Buffer The buffer to retrieve the write data from.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoWriteFifo8 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
IN VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a 16-bit I/O port fifo into a block of memory.
|
||||||
|
|
||||||
|
Reads the 16-bit I/O fifo port specified by Port.
|
||||||
|
The port is read Count times, and the read data is
|
||||||
|
stored in the provided Buffer.
|
||||||
|
|
||||||
|
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().
|
||||||
|
|
||||||
|
@param Port The I/O port to read.
|
||||||
|
@param Count The number of times to read I/O port.
|
||||||
|
@param Buffer The buffer to store the read data into.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoReadFifo16 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
OUT VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes a block of memory into a 16-bit I/O port fifo.
|
||||||
|
|
||||||
|
Writes the 16-bit I/O fifo port specified by Port.
|
||||||
|
The port is written Count times, and the write data is
|
||||||
|
retrieved from the provided Buffer.
|
||||||
|
|
||||||
|
This function must guarantee that all I/O write and write operations are
|
||||||
|
serialized.
|
||||||
|
|
||||||
|
If 16-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
|
@param Port The I/O port to write.
|
||||||
|
@param Count The number of times to write I/O port.
|
||||||
|
@param Buffer The buffer to retrieve the write data from.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoWriteFifo16 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
IN VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a 32-bit I/O port fifo into a block of memory.
|
||||||
|
|
||||||
|
Reads the 32-bit I/O fifo port specified by Port.
|
||||||
|
The port is read Count times, and the read data is
|
||||||
|
stored in the provided Buffer.
|
||||||
|
|
||||||
|
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().
|
||||||
|
|
||||||
|
@param Port The I/O port to read.
|
||||||
|
@param Count The number of times to read I/O port.
|
||||||
|
@param Buffer The buffer to store the read data into.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoReadFifo32 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
OUT VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes a block of memory into a 32-bit I/O port fifo.
|
||||||
|
|
||||||
|
Writes the 32-bit I/O fifo port specified by Port.
|
||||||
|
The port is written Count times, and the write data is
|
||||||
|
retrieved from the provided Buffer.
|
||||||
|
|
||||||
|
This function must guarantee that all I/O write and write operations are
|
||||||
|
serialized.
|
||||||
|
|
||||||
|
If 32-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
|
@param Port The I/O port to write.
|
||||||
|
@param Count The number of times to write I/O port.
|
||||||
|
@param Buffer The buffer to retrieve the write data from.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoWriteFifo32 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
IN VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads an 8-bit MMIO register.
|
Reads an 8-bit MMIO register.
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
EBC does not support port I/O. All APIs in this file ASSERT().
|
EBC does not support port I/O. All APIs in this file ASSERT().
|
||||||
|
|
||||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
|
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -169,3 +171,172 @@ IoWrite32 (
|
|||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads an 8-bit I/O port fifo into a block of memory.
|
||||||
|
|
||||||
|
Reads the 8-bit I/O fifo port specified by Port.
|
||||||
|
The port is read Count times, and the read data is
|
||||||
|
stored in the provided Buffer.
|
||||||
|
|
||||||
|
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.
|
||||||
|
@param Count The number of times to read I/O port.
|
||||||
|
@param Buffer The buffer to store the read data into.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoReadFifo8 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
OUT VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes a block of memory into an 8-bit I/O port fifo.
|
||||||
|
|
||||||
|
Writes the 8-bit I/O fifo port specified by Port.
|
||||||
|
The port is written Count times, and the write data is
|
||||||
|
retrieved from the provided Buffer.
|
||||||
|
|
||||||
|
This function must guarantee that all I/O write 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 Count The number of times to write I/O port.
|
||||||
|
@param Buffer The buffer to retrieve the write data from.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoWriteFifo8 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
IN VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a 16-bit I/O port fifo into a block of memory.
|
||||||
|
|
||||||
|
Reads the 16-bit I/O fifo port specified by Port.
|
||||||
|
The port is read Count times, and the read data is
|
||||||
|
stored in the provided Buffer.
|
||||||
|
|
||||||
|
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().
|
||||||
|
|
||||||
|
@param Port The I/O port to read.
|
||||||
|
@param Count The number of times to read I/O port.
|
||||||
|
@param Buffer The buffer to store the read data into.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoReadFifo16 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
OUT VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes a block of memory into a 16-bit I/O port fifo.
|
||||||
|
|
||||||
|
Writes the 16-bit I/O fifo port specified by Port.
|
||||||
|
The port is written Count times, and the write data is
|
||||||
|
retrieved from the provided Buffer.
|
||||||
|
|
||||||
|
This function must guarantee that all I/O write and write operations are
|
||||||
|
serialized.
|
||||||
|
|
||||||
|
If 16-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
|
@param Port The I/O port to write.
|
||||||
|
@param Count The number of times to write I/O port.
|
||||||
|
@param Buffer The buffer to retrieve the write data from.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoWriteFifo16 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
IN VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a 32-bit I/O port fifo into a block of memory.
|
||||||
|
|
||||||
|
Reads the 32-bit I/O fifo port specified by Port.
|
||||||
|
The port is read Count times, and the read data is
|
||||||
|
stored in the provided Buffer.
|
||||||
|
|
||||||
|
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().
|
||||||
|
|
||||||
|
@param Port The I/O port to read.
|
||||||
|
@param Count The number of times to read I/O port.
|
||||||
|
@param Buffer The buffer to store the read data into.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoReadFifo32 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
OUT VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes a block of memory into a 32-bit I/O port fifo.
|
||||||
|
|
||||||
|
Writes the 32-bit I/O fifo port specified by Port.
|
||||||
|
The port is written Count times, and the write data is
|
||||||
|
retrieved from the provided Buffer.
|
||||||
|
|
||||||
|
This function must guarantee that all I/O write and write operations are
|
||||||
|
serialized.
|
||||||
|
|
||||||
|
If 32-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
|
@param Port The I/O port to write.
|
||||||
|
@param Count The number of times to write I/O port.
|
||||||
|
@param Buffer The buffer to retrieve the write data from.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoWriteFifo32 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
IN VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
Common I/O Library routines.
|
Common I/O Library routines.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||||
|
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -147,6 +149,7 @@ IoRead64 (
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes an 8-bit I/O port.
|
Writes an 8-bit I/O port.
|
||||||
|
|
||||||
@ -251,6 +254,204 @@ IoWrite64 (
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads an 8-bit I/O port fifo into a block of memory.
|
||||||
|
|
||||||
|
Reads the 8-bit I/O fifo port specified by Port.
|
||||||
|
The port is read Count times, and the read data is
|
||||||
|
stored in the provided Buffer.
|
||||||
|
|
||||||
|
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.
|
||||||
|
@param Count The number of times to read I/O port.
|
||||||
|
@param Buffer The buffer to store the read data into.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoReadFifo8 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
OUT VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT8 *Buffer8;
|
||||||
|
|
||||||
|
Buffer8 = (UINT8 *)Buffer;
|
||||||
|
while (Count--) {
|
||||||
|
*Buffer8++ = IoRead8 (Port);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a 16-bit I/O port fifo into a block of memory.
|
||||||
|
|
||||||
|
Reads the 16-bit I/O fifo port specified by Port.
|
||||||
|
The port is read Count times, and the read data is
|
||||||
|
stored in the provided Buffer.
|
||||||
|
|
||||||
|
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().
|
||||||
|
|
||||||
|
@param Port The I/O port to read.
|
||||||
|
@param Count The number of times to read I/O port.
|
||||||
|
@param Buffer The buffer to store the read data into.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoReadFifo16 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
OUT VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT16 *Buffer16;
|
||||||
|
|
||||||
|
Buffer16 = (UINT16 *)Buffer;
|
||||||
|
while (Count--) {
|
||||||
|
*Buffer16++ = IoRead16 (Port);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a 32-bit I/O port fifo into a block of memory.
|
||||||
|
|
||||||
|
Reads the 32-bit I/O fifo port specified by Port.
|
||||||
|
The port is read Count times, and the read data is
|
||||||
|
stored in the provided Buffer.
|
||||||
|
|
||||||
|
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().
|
||||||
|
|
||||||
|
@param Port The I/O port to read.
|
||||||
|
@param Count The number of times to read I/O port.
|
||||||
|
@param Buffer The buffer to store the read data into.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoReadFifo32 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
OUT VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT32 *Buffer32;
|
||||||
|
|
||||||
|
Buffer32 = (UINT32 *)Buffer;
|
||||||
|
while (Count--) {
|
||||||
|
*Buffer32++ = IoRead32 (Port);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes a block of memory into an 8-bit I/O port fifo.
|
||||||
|
|
||||||
|
Writes the 8-bit I/O fifo port specified by Port.
|
||||||
|
The port is written Count times, and the write data is
|
||||||
|
retrieved from the provided Buffer.
|
||||||
|
|
||||||
|
This function must guarantee that all I/O write 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 Count The number of times to write I/O port.
|
||||||
|
@param Buffer The buffer to retrieve the write data from.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoWriteFifo8 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
IN VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT8 *Buffer8;
|
||||||
|
|
||||||
|
Buffer8 = (UINT8 *)Buffer;
|
||||||
|
while (Count--) {
|
||||||
|
IoWrite8 (Port, *Buffer8++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes a block of memory into a 16-bit I/O port fifo.
|
||||||
|
|
||||||
|
Writes the 16-bit I/O fifo port specified by Port.
|
||||||
|
The port is written Count times, and the write data is
|
||||||
|
retrieved from the provided Buffer.
|
||||||
|
|
||||||
|
This function must guarantee that all I/O write and write operations are
|
||||||
|
serialized.
|
||||||
|
|
||||||
|
If 16-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
|
@param Port The I/O port to write.
|
||||||
|
@param Count The number of times to write I/O port.
|
||||||
|
@param Buffer The buffer to retrieve the write data from.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoWriteFifo16 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
IN VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT16 *Buffer16;
|
||||||
|
|
||||||
|
Buffer16 = (UINT16 *)Buffer;
|
||||||
|
while (Count--) {
|
||||||
|
IoWrite16 (Port, *Buffer16++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes a block of memory into a 32-bit I/O port fifo.
|
||||||
|
|
||||||
|
Writes the 32-bit I/O fifo port specified by Port.
|
||||||
|
The port is written Count times, and the write data is
|
||||||
|
retrieved from the provided Buffer.
|
||||||
|
|
||||||
|
This function must guarantee that all I/O write and write operations are
|
||||||
|
serialized.
|
||||||
|
|
||||||
|
If 32-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
|
@param Port The I/O port to write.
|
||||||
|
@param Count The number of times to write I/O port.
|
||||||
|
@param Buffer The buffer to retrieve the write data from.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
IoWriteFifo32 (
|
||||||
|
IN UINTN Port,
|
||||||
|
IN UINTN Count,
|
||||||
|
IN VOID *Buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT32 *Buffer32;
|
||||||
|
|
||||||
|
Buffer32 = (UINT32 *)Buffer;
|
||||||
|
while (Count--) {
|
||||||
|
IoWrite32 (Port, *Buffer32++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads an 8-bit MMIO register.
|
Reads an 8-bit MMIO register.
|
||||||
|
|
||||||
|
127
MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm
Normal file
127
MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
|
; Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||||
|
;
|
||||||
|
; 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.
|
||||||
|
;
|
||||||
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoReadFifo8 (
|
||||||
|
; IN UINTN Port, // rcx
|
||||||
|
; IN UINTN Size, // rdx
|
||||||
|
; OUT VOID *Buffer // r8
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
IoReadFifo8 PROC
|
||||||
|
cld
|
||||||
|
xchg rcx, rdx
|
||||||
|
xchg rdi, r8 ; rdi: buffer address; r8: save rdi
|
||||||
|
rep insb
|
||||||
|
mov rdi, r8 ; restore rdi
|
||||||
|
ret
|
||||||
|
IoReadFifo8 ENDP
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoReadFifo16 (
|
||||||
|
; IN UINTN Port, // rcx
|
||||||
|
; IN UINTN Size, // rdx
|
||||||
|
; OUT VOID *Buffer // r8
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
IoReadFifo16 PROC
|
||||||
|
cld
|
||||||
|
xchg rcx, rdx
|
||||||
|
xchg rdi, r8 ; rdi: buffer address; r8: save rdi
|
||||||
|
rep insw
|
||||||
|
mov rdi, r8 ; restore rdi
|
||||||
|
ret
|
||||||
|
IoReadFifo16 ENDP
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoReadFifo32 (
|
||||||
|
; IN UINTN Port, // rcx
|
||||||
|
; IN UINTN Size, // rdx
|
||||||
|
; OUT VOID *Buffer // r8
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
IoReadFifo32 PROC
|
||||||
|
cld
|
||||||
|
xchg rcx, rdx
|
||||||
|
xchg rdi, r8 ; rdi: buffer address; r8: save rdi
|
||||||
|
rep insd
|
||||||
|
mov rdi, r8 ; restore rdi
|
||||||
|
ret
|
||||||
|
IoReadFifo32 ENDP
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoWriteFifo8 (
|
||||||
|
; IN UINTN Port, // rcx
|
||||||
|
; IN UINTN Size, // rdx
|
||||||
|
; IN VOID *Buffer // r8
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
IoWriteFifo8 PROC
|
||||||
|
cld
|
||||||
|
xchg rcx, rdx
|
||||||
|
xchg rsi, r8 ; rsi: buffer address; r8: save rsi
|
||||||
|
rep outsb
|
||||||
|
mov rsi, r8 ; restore rsi
|
||||||
|
ret
|
||||||
|
IoWriteFifo8 ENDP
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoWriteFifo16 (
|
||||||
|
; IN UINTN Port, // rcx
|
||||||
|
; IN UINTN Size, // rdx
|
||||||
|
; IN VOID *Buffer // r8
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
IoWriteFifo16 PROC
|
||||||
|
cld
|
||||||
|
xchg rcx, rdx
|
||||||
|
xchg rsi, r8 ; rsi: buffer address; r8: save rsi
|
||||||
|
rep outsw
|
||||||
|
mov rsi, r8 ; restore rsi
|
||||||
|
ret
|
||||||
|
IoWriteFifo16 ENDP
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoWriteFifo32 (
|
||||||
|
; IN UINTN Port, // rcx
|
||||||
|
; IN UINTN Size, // rdx
|
||||||
|
; IN VOID *Buffer // r8
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
IoWriteFifo32 PROC
|
||||||
|
cld
|
||||||
|
xchg rcx, rdx
|
||||||
|
xchg rsi, r8 ; rsi: buffer address; r8: save rsi
|
||||||
|
rep outsd
|
||||||
|
mov rsi, r8 ; restore rsi
|
||||||
|
ret
|
||||||
|
IoWriteFifo32 ENDP
|
||||||
|
|
||||||
|
END
|
||||||
|
|
126
MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm
Normal file
126
MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
|
; Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||||
|
;
|
||||||
|
; 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.
|
||||||
|
;
|
||||||
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
DEFAULT REL
|
||||||
|
SECTION .text
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoReadFifo8 (
|
||||||
|
; IN UINTN Port, // rcx
|
||||||
|
; IN UINTN Size, // rdx
|
||||||
|
; OUT VOID *Buffer // r8
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
global ASM_PFX(IoReadFifo8)
|
||||||
|
ASM_PFX(IoReadFifo8):
|
||||||
|
cld
|
||||||
|
xchg rcx, rdx
|
||||||
|
xchg rdi, r8 ; rdi: buffer address; r8: save rdi
|
||||||
|
rep insb
|
||||||
|
mov rdi, r8 ; restore rdi
|
||||||
|
ret
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoReadFifo16 (
|
||||||
|
; IN UINTN Port, // rcx
|
||||||
|
; IN UINTN Size, // rdx
|
||||||
|
; OUT VOID *Buffer // r8
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
global ASM_PFX(IoReadFifo16)
|
||||||
|
ASM_PFX(IoReadFifo16):
|
||||||
|
cld
|
||||||
|
xchg rcx, rdx
|
||||||
|
xchg rdi, r8 ; rdi: buffer address; r8: save rdi
|
||||||
|
rep insw
|
||||||
|
mov rdi, r8 ; restore rdi
|
||||||
|
ret
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoReadFifo32 (
|
||||||
|
; IN UINTN Port, // rcx
|
||||||
|
; IN UINTN Size, // rdx
|
||||||
|
; OUT VOID *Buffer // r8
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
global ASM_PFX(IoReadFifo32)
|
||||||
|
ASM_PFX(IoReadFifo32):
|
||||||
|
cld
|
||||||
|
xchg rcx, rdx
|
||||||
|
xchg rdi, r8 ; rdi: buffer address; r8: save rdi
|
||||||
|
rep insd
|
||||||
|
mov rdi, r8 ; restore rdi
|
||||||
|
ret
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoWriteFifo8 (
|
||||||
|
; IN UINTN Port, // rcx
|
||||||
|
; IN UINTN Size, // rdx
|
||||||
|
; IN VOID *Buffer // r8
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
global ASM_PFX(IoWriteFifo8)
|
||||||
|
ASM_PFX(IoWriteFifo8):
|
||||||
|
cld
|
||||||
|
xchg rcx, rdx
|
||||||
|
xchg rsi, r8 ; rsi: buffer address; r8: save rsi
|
||||||
|
rep outsb
|
||||||
|
mov rsi, r8 ; restore rsi
|
||||||
|
ret
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoWriteFifo16 (
|
||||||
|
; IN UINTN Port, // rcx
|
||||||
|
; IN UINTN Size, // rdx
|
||||||
|
; IN VOID *Buffer // r8
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
global ASM_PFX(IoWriteFifo16)
|
||||||
|
ASM_PFX(IoWriteFifo16):
|
||||||
|
cld
|
||||||
|
xchg rcx, rdx
|
||||||
|
xchg rsi, r8 ; rsi: buffer address; r8: save rsi
|
||||||
|
rep outsw
|
||||||
|
mov rsi, r8 ; restore rsi
|
||||||
|
ret
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; EFIAPI
|
||||||
|
; IoWriteFifo32 (
|
||||||
|
; IN UINTN Port, // rcx
|
||||||
|
; IN UINTN Size, // rdx
|
||||||
|
; IN VOID *Buffer // r8
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
global ASM_PFX(IoWriteFifo32)
|
||||||
|
ASM_PFX(IoWriteFifo32):
|
||||||
|
cld
|
||||||
|
xchg rcx, rdx
|
||||||
|
xchg rsi, r8 ; rsi: buffer address; r8: save rsi
|
||||||
|
rep outsd
|
||||||
|
mov rsi, r8 ; restore rsi
|
||||||
|
ret
|
||||||
|
|
Reference in New Issue
Block a user