public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/4] *** BaseIoFifoLib ***
@ 2017-01-04 23:07 Leo Duran
  2017-01-04 23:07 ` [PATCH 1/4] MdePkg: Add BaseIoFifoLib library Leo Duran
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Leo Duran @ 2017-01-04 23:07 UTC (permalink / raw)
  To: edk2-devel
  Cc: brijesh.singh, lersek, liming.gao, michael.d.kinney, jeff.fan,
	Leo Duran

The UefiCpuPkg/CpuIo2Dxe driver and the QemuCfgLib library have duplicate
implementations of I/O Fifo routines. The patch series moves the I/O Fifo
routines into a common BaseIofifoLib library supporting IA32 and X64
architectures under MdePkg.

The intent of this patch series is twofold:
1) Consolidate I/O Fifo routines into a common BaseIofifoLib library.
2) Allow override of BaseIofifoLib for specific platform implementations.
For example, the OVMF package can provide its own version of BaseIoFifoLib
to support Secure Encrypted Virtualization (SEV) guests, since SEV does not
support string I/O instructions (rep ins/outs), and requires unrolled loops
of single in/out instructions.

Leo Duran (4):
  MdePkg: Add BaseIoFifoLib library
  Modify .DSC files that include UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
  Modify UefiCpuPkg/CpuIo2Dxe to use new BaseIoFifoLib library.
  Modify QemuFwCfgLib to use new BaseIoFifoLib library.

 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc     |   1 +
 CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc  |   1 +
 DuetPkg/DuetPkgIa32.dsc                           |   1 +
 DuetPkg/DuetPkgX64.dsc                            |   1 +
 MdePkg/Include/Library/IoFifoLib.h                | 175 ++++++++++++++++++++++
 MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf    |  45 ++++++
 MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.asm      | 139 +++++++++++++++++
 MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.nasm     | 135 +++++++++++++++++
 MdePkg/Library/BaseIoFifoLib/X64/IoFifo.asm       | 125 ++++++++++++++++
 MdePkg/Library/BaseIoFifoLib/X64/IoFifo.nasm      | 124 +++++++++++++++
 MdePkg/MdePkg.dec                                 |   3 +
 MdePkg/MdePkg.dsc                                 |   1 +
 OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm |  55 -------
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c       |   1 +
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf     |   7 +-
 OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm  |  52 -------
 OvmfPkg/OvmfPkgIa32.dsc                           |   1 +
 OvmfPkg/OvmfPkgIa32X64.dsc                        |   1 +
 OvmfPkg/OvmfPkgX64.dsc                            |   1 +
 QuarkPlatformPkg/Quark.dsc                        |   1 +
 QuarkPlatformPkg/QuarkMin.dsc                     |   1 +
 UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.c                  |   1 -
 UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.h                  |   1 +
 UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf                |  10 +-
 UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.asm              | 140 -----------------
 UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.nasm             | 136 -----------------
 UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.asm               | 126 ----------------
 UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.nasm              | 125 ----------------
 UefiCpuPkg/UefiCpuPkg.dsc                         |   1 +
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc           |   1 +
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc             |   1 +
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc              |   1 +
 32 files changed, 764 insertions(+), 650 deletions(-)
 create mode 100644 MdePkg/Include/Library/IoFifoLib.h
 create mode 100644 MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
 create mode 100644 MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.asm
 create mode 100644 MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.nasm
 create mode 100644 MdePkg/Library/BaseIoFifoLib/X64/IoFifo.asm
 create mode 100644 MdePkg/Library/BaseIoFifoLib/X64/IoFifo.nasm
 delete mode 100644 OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm
 delete mode 100644 OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm
 delete mode 100644 UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.asm
 delete mode 100644 UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.nasm
 delete mode 100644 UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.asm
 delete mode 100644 UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.nasm

-- 
1.9.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] MdePkg: Add BaseIoFifoLib library
  2017-01-04 23:07 [PATCH 0/4] *** BaseIoFifoLib *** Leo Duran
@ 2017-01-04 23:07 ` Leo Duran
  2017-01-04 23:07 ` [PATCH 2/4] Modify .DSC files that include UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf Leo Duran
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Leo Duran @ 2017-01-04 23:07 UTC (permalink / raw)
  To: edk2-devel
  Cc: brijesh.singh, lersek, liming.gao, michael.d.kinney, jeff.fan,
	Leo Duran

The UefiCpuPkg/CpuIo2Dxe driver and the QemuCfgLib library have duplicate
implementations of I/O Fifo routines. The patch moves the I/O Fifo
routines into a common BaseIofifoLib library supporting IA32 and X64
architectures under MdePkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Leo Duran  <leo.duran@amd.com>
---
 MdePkg/Include/Library/IoFifoLib.h             | 175 +++++++++++++++++++++++++
 MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf |  45 +++++++
 MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.asm   | 139 ++++++++++++++++++++
 MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.nasm  | 135 +++++++++++++++++++
 MdePkg/Library/BaseIoFifoLib/X64/IoFifo.asm    | 125 ++++++++++++++++++
 MdePkg/Library/BaseIoFifoLib/X64/IoFifo.nasm   | 124 ++++++++++++++++++
 MdePkg/MdePkg.dec                              |   3 +
 MdePkg/MdePkg.dsc                              |   1 +
 8 files changed, 747 insertions(+)
 create mode 100644 MdePkg/Include/Library/IoFifoLib.h
 create mode 100644 MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
 create mode 100644 MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.asm
 create mode 100644 MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.nasm
 create mode 100644 MdePkg/Library/BaseIoFifoLib/X64/IoFifo.asm
 create mode 100644 MdePkg/Library/BaseIoFifoLib/X64/IoFifo.nasm

diff --git a/MdePkg/Include/Library/IoFifoLib.h b/MdePkg/Include/Library/IoFifoLib.h
new file mode 100644
index 0000000..eed8be1
--- /dev/null
+++ b/MdePkg/Include/Library/IoFifoLib.h
@@ -0,0 +1,175 @@
+/** @file
+  I/O FIFO routines
+
+  Copyright (c) 2008 - 2012, Intel Corporation. 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.
+
+**/
+
+#ifndef _IO_FIFO_H_INCLUDED_
+#define _IO_FIFO_H_INCLUDED_
+
+/**
+  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
+  );
+
+/**
+  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
+  );
+
+/**
+  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 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 store the write data into.
+
+**/
+VOID
+EFIAPI
+IoWriteFifo8 (
+  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 store the write data into.
+
+**/
+VOID
+EFIAPI
+IoWriteFifo16 (
+  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 store the write data into.
+
+**/
+VOID
+EFIAPI
+IoWriteFifo32 (
+  IN      UINTN                     Port,
+  IN      UINTN                     Count,
+  OUT     VOID                      *Buffer
+  );
+
+#endif
diff --git a/MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf b/MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
new file mode 100644
index 0000000..63202b3
--- /dev/null
+++ b/MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
@@ -0,0 +1,45 @@
+## @file
+#  Base I/O FiFo Library using REP string instructions.
+#
+#  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2017, AMD Inc. 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.
+#
+#  Derived from:
+#   UefiCpuPkg/CpuIo2Dxe
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = BaseIoFifoLib
+  FILE_GUID                      = 5591c2ef-cb95-4b56-a907-f057b1b96a3d
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = IoFifoLib
+
+#
+#  VALID_ARCHITECTURES           = IA32 X64
+#
+
+[Sources.IA32]
+  Ia32/IoFifo.nasm
+  Ia32/IoFifo.asm
+
+[Sources.X64]
+  X64/IoFifo.nasm
+  X64/IoFifo.asm
+
+[Packages]
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  DebugLib
+  IoLib
diff --git a/MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.asm b/MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.asm
new file mode 100644
index 0000000..da8a1f2
--- /dev/null
+++ b/MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.asm
@@ -0,0 +1,139 @@
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006 - 2012, Intel Corporation. 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,
+;    IN 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,
+;    IN 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,
+;    IN 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
diff --git a/MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.nasm b/MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.nasm
new file mode 100644
index 0000000..8f6dd0d
--- /dev/null
+++ b/MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.nasm
@@ -0,0 +1,135 @@
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006 - 2012, Intel Corporation. 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,
+;    IN 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,
+;    IN 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,
+;    IN 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
diff --git a/MdePkg/Library/BaseIoFifoLib/X64/IoFifo.asm b/MdePkg/Library/BaseIoFifoLib/X64/IoFifo.asm
new file mode 100644
index 0000000..8714174
--- /dev/null
+++ b/MdePkg/Library/BaseIoFifoLib/X64/IoFifo.asm
@@ -0,0 +1,125 @@
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006 - 2012, Intel Corporation. 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
+;    IN 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
+;    IN 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
+;    IN 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
diff --git a/MdePkg/Library/BaseIoFifoLib/X64/IoFifo.nasm b/MdePkg/Library/BaseIoFifoLib/X64/IoFifo.nasm
new file mode 100644
index 0000000..ef83f0e
--- /dev/null
+++ b/MdePkg/Library/BaseIoFifoLib/X64/IoFifo.nasm
@@ -0,0 +1,124 @@
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006 - 2012, Intel Corporation. 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
+;    IN 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
+;    IN 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
+;    IN 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
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index f2bdb30..2e3a23b 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -254,6 +254,9 @@
   #
   RngLib|Include/Library/RngLib.h
 
+  ##  @libraryclass  Provide services to access I/O Fifo Ports
+  IoFifoLib|Include/Library/IoFifoLib.h
+
 [LibraryClasses.IPF]
   ##  @libraryclass  The SAL Library provides a service to make a SAL CALL.
   SalLib|Include/Library/SalLib.h
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index b4575cd..ec1c847 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -155,6 +155,7 @@
   MdePkg/Library/SmmMemLib/SmmMemLib.inf
   MdePkg/Library/BaseRngLib/BaseRngLib.inf
   MdePkg/Library/SmmPciExpressLib/SmmPciExpressLib.inf
+  MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
 
 [Components.IPF]
   MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] Modify .DSC files that include UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
  2017-01-04 23:07 [PATCH 0/4] *** BaseIoFifoLib *** Leo Duran
  2017-01-04 23:07 ` [PATCH 1/4] MdePkg: Add BaseIoFifoLib library Leo Duran
@ 2017-01-04 23:07 ` Leo Duran
  2017-01-05 17:08   ` Laszlo Ersek
  2017-01-04 23:07 ` [PATCH 3/4] Modify UefiCpuPkg/CpuIo2Dxe to use new BaseIoFifoLib library Leo Duran
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Leo Duran @ 2017-01-04 23:07 UTC (permalink / raw)
  To: edk2-devel
  Cc: brijesh.singh, lersek, liming.gao, michael.d.kinney, jeff.fan,
	Leo Duran

This patch adds the new BaseIoFifoLib (IoFifoLib class) library
consumed by the UefiCpuPkg/CpuIo2Dxe driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Leo Duran  <leo.duran@amd.com>
---
 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc    | 1 +
 CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc | 1 +
 DuetPkg/DuetPkgIa32.dsc                          | 1 +
 DuetPkg/DuetPkgX64.dsc                           | 1 +
 OvmfPkg/OvmfPkgIa32.dsc                          | 1 +
 OvmfPkg/OvmfPkgIa32X64.dsc                       | 1 +
 OvmfPkg/OvmfPkgX64.dsc                           | 1 +
 QuarkPlatformPkg/Quark.dsc                       | 1 +
 QuarkPlatformPkg/QuarkMin.dsc                    | 1 +
 UefiCpuPkg/UefiCpuPkg.dsc                        | 1 +
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc          | 1 +
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc            | 1 +
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc             | 1 +
 13 files changed, 13 insertions(+)

diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
index cdfcb75..6fe785a 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
+++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
@@ -129,6 +129,7 @@
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  IoFifoLib|MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
 !if $(PCIE_BASE) == 0
   PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
   PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc b/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
index c35f261..3afb8b3 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
+++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
@@ -131,6 +131,7 @@
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  IoFifoLib|MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
 !if $(PCIE_BASE) == 0
   PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
   PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
diff --git a/DuetPkg/DuetPkgIa32.dsc b/DuetPkg/DuetPkgIa32.dsc
index 7dd963b..6130aa8 100644
--- a/DuetPkg/DuetPkgIa32.dsc
+++ b/DuetPkg/DuetPkgIa32.dsc
@@ -59,6 +59,7 @@
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  IoFifoLib|MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
   PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
   PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
   PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
diff --git a/DuetPkg/DuetPkgX64.dsc b/DuetPkg/DuetPkgX64.dsc
index 1b08a95..5c880b0 100644
--- a/DuetPkg/DuetPkgX64.dsc
+++ b/DuetPkg/DuetPkgX64.dsc
@@ -59,6 +59,7 @@
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  IoFifoLib|MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
   PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
   PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
   PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 81f7521..9b164a2 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -101,6 +101,7 @@
   PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
   PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  IoFifoLib|MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
   OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
   SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
   MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index f7855b6..f9c3934 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -106,6 +106,7 @@
   PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
   PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  IoFifoLib|MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
   OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
   SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
   MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index e933a41..b3c661a 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -106,6 +106,7 @@
   PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
   PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  IoFifoLib|MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
   OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
   SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
   MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
diff --git a/QuarkPlatformPkg/Quark.dsc b/QuarkPlatformPkg/Quark.dsc
index d36fd6e..b0e51bb 100644
--- a/QuarkPlatformPkg/Quark.dsc
+++ b/QuarkPlatformPkg/Quark.dsc
@@ -94,6 +94,7 @@
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  IoFifoLib|MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
   PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
   PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
   PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
diff --git a/QuarkPlatformPkg/QuarkMin.dsc b/QuarkPlatformPkg/QuarkMin.dsc
index be85e3f..e00b192 100644
--- a/QuarkPlatformPkg/QuarkMin.dsc
+++ b/QuarkPlatformPkg/QuarkMin.dsc
@@ -82,6 +82,7 @@
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  IoFifoLib|MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
   PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
   PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
   PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index 3922f2d..f7e185f 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -37,6 +37,7 @@
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  IoFifoLib|MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
   MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index cdde337..6f498b2 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -118,6 +118,7 @@
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  IoFifoLib|MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
   PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
   PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
   PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index ed519bd..06f9cea 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -118,6 +118,7 @@
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  IoFifoLib|MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
   PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
   PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
   PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index 91f018a..1ba6054 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -118,6 +118,7 @@
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  IoFifoLib|MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
   PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
   PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
   PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] Modify UefiCpuPkg/CpuIo2Dxe to use new BaseIoFifoLib library.
  2017-01-04 23:07 [PATCH 0/4] *** BaseIoFifoLib *** Leo Duran
  2017-01-04 23:07 ` [PATCH 1/4] MdePkg: Add BaseIoFifoLib library Leo Duran
  2017-01-04 23:07 ` [PATCH 2/4] Modify .DSC files that include UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf Leo Duran
@ 2017-01-04 23:07 ` Leo Duran
  2017-01-04 23:07 ` [PATCH 4/4] Modify QemuFwCfgLib " Leo Duran
  2017-01-05 17:24 ` [PATCH 0/4] *** BaseIoFifoLib *** Laszlo Ersek
  4 siblings, 0 replies; 9+ messages in thread
From: Leo Duran @ 2017-01-04 23:07 UTC (permalink / raw)
  To: edk2-devel
  Cc: brijesh.singh, lersek, liming.gao, michael.d.kinney, jeff.fan,
	Leo Duran

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Leo Duran  <leo.duran@amd.com>
---
 UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.c      |   1 -
 UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.h      |   1 +
 UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf    |  10 +--
 UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.asm  | 140 ----------------------------------
 UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.nasm | 136 ---------------------------------
 UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.asm   | 126 ------------------------------
 UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.nasm  | 125 ------------------------------
 7 files changed, 2 insertions(+), 537 deletions(-)
 delete mode 100644 UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.asm
 delete mode 100644 UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.nasm
 delete mode 100644 UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.asm
 delete mode 100644 UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.nasm

diff --git a/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.c b/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.c
index 6ccfc40..dfeb497 100644
--- a/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.c
+++ b/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.c
@@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/
 
 #include "CpuIo2Dxe.h"
-#include "IoFifo.h"
 
 //
 // Handle for the CPU I/O 2 Protocol
diff --git a/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.h b/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.h
index 7d00da1..9ea24db 100644
--- a/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.h
+++ b/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.h
@@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/BaseLib.h>
 #include <Library/DebugLib.h>
 #include <Library/IoLib.h>
+#include <Library/IoFifoLib.h>
 #include <Library/UefiBootServicesTableLib.h>
 
 #define MAX_IO_PORT_ADDRESS   0xFFFF
diff --git a/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf b/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
index 920ede7..b3db712 100644
--- a/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
+++ b/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
@@ -30,15 +30,6 @@
 [Sources]
   CpuIo2Dxe.c
   CpuIo2Dxe.h
-  IoFifo.h
-  
-[Sources.IA32]
-  Ia32/IoFifo.nasm
-  Ia32/IoFifo.asm
-
-[Sources.X64]
-  X64/IoFifo.nasm
-  X64/IoFifo.asm
 
 [Packages]
   MdePkg/MdePkg.dec
@@ -48,6 +39,7 @@
   BaseLib
   DebugLib
   IoLib
+  IoFifoLib
   UefiBootServicesTableLib
 
 [Protocols]
diff --git a/UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.asm b/UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.asm
deleted file mode 100644
index b1cc25e..0000000
--- a/UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.asm
+++ /dev/null
@@ -1,140 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2012, Intel Corporation. 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,
-;    IN 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,
-;    IN 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,
-;    IN 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
-
diff --git a/UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.nasm b/UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.nasm
deleted file mode 100644
index daa90a9..0000000
--- a/UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.nasm
+++ /dev/null
@@ -1,136 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2012, Intel Corporation. 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,
-;    IN 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,
-;    IN 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,
-;    IN 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
-
diff --git a/UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.asm b/UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.asm
deleted file mode 100644
index 1a3f0ef..0000000
--- a/UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.asm
+++ /dev/null
@@ -1,126 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2012, Intel Corporation. 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
-;    IN 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
-;    IN 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
-;    IN 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
-
diff --git a/UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.nasm b/UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.nasm
deleted file mode 100644
index bb3d1da..0000000
--- a/UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.nasm
+++ /dev/null
@@ -1,125 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2012, Intel Corporation. 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
-;    IN 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
-;    IN 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
-;    IN 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
-
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] Modify QemuFwCfgLib to use new BaseIoFifoLib library.
  2017-01-04 23:07 [PATCH 0/4] *** BaseIoFifoLib *** Leo Duran
                   ` (2 preceding siblings ...)
  2017-01-04 23:07 ` [PATCH 3/4] Modify UefiCpuPkg/CpuIo2Dxe to use new BaseIoFifoLib library Leo Duran
@ 2017-01-04 23:07 ` Leo Duran
  2017-01-05 17:12   ` Laszlo Ersek
  2017-01-05 17:24 ` [PATCH 0/4] *** BaseIoFifoLib *** Laszlo Ersek
  4 siblings, 1 reply; 9+ messages in thread
From: Leo Duran @ 2017-01-04 23:07 UTC (permalink / raw)
  To: edk2-devel
  Cc: brijesh.singh, lersek, liming.gao, michael.d.kinney, jeff.fan,
	Leo Duran

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Leo Duran  <leo.duran@amd.com>
---
 OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm | 55 -----------------------
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c       |  1 +
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf     |  7 +--
 OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm  | 52 ---------------------
 4 files changed, 2 insertions(+), 113 deletions(-)
 delete mode 100644 OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm
 delete mode 100644 OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm

diff --git a/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm b/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm
deleted file mode 100644
index faa22e9..0000000
--- a/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm
+++ /dev/null
@@ -1,55 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2013, Intel Corporation. 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,
-;    IN VOID                   *Buffer
-;    );
-;------------------------------------------------------------------------------
-global ASM_PFX(IoReadFifo8)
-ASM_PFX(IoReadFifo8):
-
-    mov     dx, [esp + 4]
-    mov     ecx, [esp + 8]
-    push    edi
-    mov     edi, [esp + 16]
-rep insb
-    pop     edi
-    ret
-
-;------------------------------------------------------------------------------
-;  VOID
-;  EFIAPI
-;  IoWriteFifo8 (
-;    IN UINTN                  Port,
-;    IN UINTN                  Size,
-;    IN VOID                   *Buffer
-;    );
-;------------------------------------------------------------------------------
-global ASM_PFX(IoWriteFifo8)
-ASM_PFX(IoWriteFifo8):
-
-    mov     dx, [esp + 4]
-    mov     ecx, [esp + 8]
-    push    esi
-    mov     esi, [esp + 16]
-rep outsb
-    pop     esi
-    ret
-
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
index 0bbf121..ea59bc5 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
@@ -18,6 +18,7 @@
 #include <Library/BaseMemoryLib.h>
 #include <Library/DebugLib.h>
 #include <Library/IoLib.h>
+#include <Library/IoFifoLib.h>
 #include <Library/QemuFwCfgLib.h>
 #include <Library/MemoryAllocationLib.h>
 #include <Library/UefiBootServicesTableLib.h>
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
index 66ac778..6fbb702 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
@@ -36,12 +36,6 @@
   QemuFwCfgLib.c
   QemuFwCfgPeiDxe.c
 
-[Sources.IA32]
-  Ia32/IoLibExAsm.nasm
-
-[Sources.X64]
-  X64/IoLibExAsm.nasm
-
 [Packages]
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
@@ -51,5 +45,6 @@
   BaseMemoryLib
   DebugLib
   IoLib
+  IoFifoLib
   MemoryAllocationLib
 
diff --git a/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm b/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm
deleted file mode 100644
index f1078f2..0000000
--- a/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm
+++ /dev/null
@@ -1,52 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006 - 2013, Intel Corporation. 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
-;    IN VOID                   *Buffer            // r8
-;    );
-;------------------------------------------------------------------------------
-global ASM_PFX(IoReadFifo8)
-ASM_PFX(IoReadFifo8):
-
-    xchg    rcx, rdx
-    xchg    rdi, r8             ; rdi: buffer address; r8: save rdi
-rep insb
-    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):
-
-    xchg    rcx, rdx
-    xchg    rsi, r8             ; rdi: buffer address; r8: save rdi
-rep outsb
-    mov     rsi, r8             ; restore rdi
-    ret
-
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] Modify .DSC files that include UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
  2017-01-04 23:07 ` [PATCH 2/4] Modify .DSC files that include UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf Leo Duran
@ 2017-01-05 17:08   ` Laszlo Ersek
  0 siblings, 0 replies; 9+ messages in thread
From: Laszlo Ersek @ 2017-01-05 17:08 UTC (permalink / raw)
  To: Leo Duran, edk2-devel
  Cc: brijesh.singh, liming.gao, michael.d.kinney, jeff.fan

On 01/05/17 00:07, Leo Duran wrote:
> This patch adds the new BaseIoFifoLib (IoFifoLib class) library
> consumed by the UefiCpuPkg/CpuIo2Dxe driver.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> Reviewed-by: Leo Duran  <leo.duran@amd.com>
> ---
>  CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc    | 1 +
>  CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc | 1 +
>  DuetPkg/DuetPkgIa32.dsc                          | 1 +
>  DuetPkg/DuetPkgX64.dsc                           | 1 +
>  OvmfPkg/OvmfPkgIa32.dsc                          | 1 +
>  OvmfPkg/OvmfPkgIa32X64.dsc                       | 1 +
>  OvmfPkg/OvmfPkgX64.dsc                           | 1 +
>  QuarkPlatformPkg/Quark.dsc                       | 1 +
>  QuarkPlatformPkg/QuarkMin.dsc                    | 1 +
>  UefiCpuPkg/UefiCpuPkg.dsc                        | 1 +
>  Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc          | 1 +
>  Vlv2TbltDevicePkg/PlatformPkgIA32.dsc            | 1 +
>  Vlv2TbltDevicePkg/PlatformPkgX64.dsc             | 1 +
>  13 files changed, 13 insertions(+)

Please split this patch per top level Pkg directory, and CC the
appropriate Pkg maintainers.

Also, please format the series such that the @@ diff hunk headers
display the DSC sections being modified. You can read about this more
here (look for "xfuncname"):

https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers#contrib-05

https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers#contrib-09

Thanks!
Laszlo


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] Modify QemuFwCfgLib to use new BaseIoFifoLib library.
  2017-01-04 23:07 ` [PATCH 4/4] Modify QemuFwCfgLib " Leo Duran
@ 2017-01-05 17:12   ` Laszlo Ersek
  0 siblings, 0 replies; 9+ messages in thread
From: Laszlo Ersek @ 2017-01-05 17:12 UTC (permalink / raw)
  To: Leo Duran, edk2-devel
  Cc: brijesh.singh, liming.gao, michael.d.kinney, jeff.fan

On 01/05/17 00:07, Leo Duran wrote:
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> Reviewed-by: Leo Duran  <leo.duran@amd.com>
> ---
>  OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm | 55 -----------------------
>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c       |  1 +
>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf     |  7 +--
>  OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm  | 52 ---------------------
>  4 files changed, 2 insertions(+), 113 deletions(-)
>  delete mode 100644 OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm
>  delete mode 100644 OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm

Please also remove the function prototypes in "QemuFwCfgLib.c" that are
no longer necessary (because now they come from the IoFifoLib class header).

The patch looks reasonable otherwise.

Thanks!
Laszlo

> diff --git a/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm b/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm
> deleted file mode 100644
> index faa22e9..0000000
> --- a/OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm
> +++ /dev/null
> @@ -1,55 +0,0 @@
> -;------------------------------------------------------------------------------
> -;
> -; Copyright (c) 2006 - 2013, Intel Corporation. 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,
> -;    IN VOID                   *Buffer
> -;    );
> -;------------------------------------------------------------------------------
> -global ASM_PFX(IoReadFifo8)
> -ASM_PFX(IoReadFifo8):
> -
> -    mov     dx, [esp + 4]
> -    mov     ecx, [esp + 8]
> -    push    edi
> -    mov     edi, [esp + 16]
> -rep insb
> -    pop     edi
> -    ret
> -
> -;------------------------------------------------------------------------------
> -;  VOID
> -;  EFIAPI
> -;  IoWriteFifo8 (
> -;    IN UINTN                  Port,
> -;    IN UINTN                  Size,
> -;    IN VOID                   *Buffer
> -;    );
> -;------------------------------------------------------------------------------
> -global ASM_PFX(IoWriteFifo8)
> -ASM_PFX(IoWriteFifo8):
> -
> -    mov     dx, [esp + 4]
> -    mov     ecx, [esp + 8]
> -    push    esi
> -    mov     esi, [esp + 16]
> -rep outsb
> -    pop     esi
> -    ret
> -
> diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
> index 0bbf121..ea59bc5 100644
> --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
> @@ -18,6 +18,7 @@
>  #include <Library/BaseMemoryLib.h>
>  #include <Library/DebugLib.h>
>  #include <Library/IoLib.h>
> +#include <Library/IoFifoLib.h>
>  #include <Library/QemuFwCfgLib.h>
>  #include <Library/MemoryAllocationLib.h>
>  #include <Library/UefiBootServicesTableLib.h>
> diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
> index 66ac778..6fbb702 100644
> --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
> @@ -36,12 +36,6 @@
>    QemuFwCfgLib.c
>    QemuFwCfgPeiDxe.c
>  
> -[Sources.IA32]
> -  Ia32/IoLibExAsm.nasm
> -
> -[Sources.X64]
> -  X64/IoLibExAsm.nasm
> -
>  [Packages]
>    MdePkg/MdePkg.dec
>    OvmfPkg/OvmfPkg.dec
> @@ -51,5 +45,6 @@
>    BaseMemoryLib
>    DebugLib
>    IoLib
> +  IoFifoLib
>    MemoryAllocationLib
>  
> diff --git a/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm b/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm
> deleted file mode 100644
> index f1078f2..0000000
> --- a/OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm
> +++ /dev/null
> @@ -1,52 +0,0 @@
> -;------------------------------------------------------------------------------
> -;
> -; Copyright (c) 2006 - 2013, Intel Corporation. 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
> -;    IN VOID                   *Buffer            // r8
> -;    );
> -;------------------------------------------------------------------------------
> -global ASM_PFX(IoReadFifo8)
> -ASM_PFX(IoReadFifo8):
> -
> -    xchg    rcx, rdx
> -    xchg    rdi, r8             ; rdi: buffer address; r8: save rdi
> -rep insb
> -    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):
> -
> -    xchg    rcx, rdx
> -    xchg    rsi, r8             ; rdi: buffer address; r8: save rdi
> -rep outsb
> -    mov     rsi, r8             ; restore rdi
> -    ret
> -
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/4] *** BaseIoFifoLib ***
  2017-01-04 23:07 [PATCH 0/4] *** BaseIoFifoLib *** Leo Duran
                   ` (3 preceding siblings ...)
  2017-01-04 23:07 ` [PATCH 4/4] Modify QemuFwCfgLib " Leo Duran
@ 2017-01-05 17:24 ` Laszlo Ersek
  2017-01-05 20:47   ` Duran, Leo
  4 siblings, 1 reply; 9+ messages in thread
From: Laszlo Ersek @ 2017-01-05 17:24 UTC (permalink / raw)
  To: Leo Duran, edk2-devel
  Cc: brijesh.singh, liming.gao, michael.d.kinney, jeff.fan

On 01/05/17 00:07, Leo Duran wrote:
> The UefiCpuPkg/CpuIo2Dxe driver and the QemuCfgLib library have duplicate
> implementations of I/O Fifo routines. The patch series moves the I/O Fifo
> routines into a common BaseIofifoLib library supporting IA32 and X64
> architectures under MdePkg.
> 
> The intent of this patch series is twofold:
> 1) Consolidate I/O Fifo routines into a common BaseIofifoLib library.
> 2) Allow override of BaseIofifoLib for specific platform implementations.
> For example, the OVMF package can provide its own version of BaseIoFifoLib
> to support Secure Encrypted Virtualization (SEV) guests, since SEV does not
> support string I/O instructions (rep ins/outs), and requires unrolled loops
> of single in/out instructions.

General comments:

(1) Please rebase the series, picking "edit" for each patch, and
re-commit each patch (without any code changes) with:

  git commit --amend --author='Brijesh Singh <brijesh.singh@amd.com>'

This will cause the formatted patch emails to start with

From: Brijesh Singh <brijesh.singh@amd.com>

and Brijesh's authorship will be then correctly reflected in git
metadata after applying the patches with "git am".

(I'm basing this on the Signed-off-by tags.)

(2) I think your S-o-b should also be present, at the bottom.

(3) If you updated the patches after getting them from Brijesh (i.e.,
you aren't merely forwarding them), then I believe you should drop your
Reviewed-by.

(4) The new files shouldn't carry just Intel's copyright notice -- they
are new files, so they should get AMD's too. (Some of the new files do
this, some don't.)

Comments related to virt:

(5) OVMF now supports (and prefers) the DMA-like interface of fw_cfg
(available in newer QEMU releases), which doesn't use port IO at all; so
in practice the REPs should cause problems under SEV, when used in
QemuFwCfgLib.

Nonetheless, I do agree that code deduplication is a good thing!

(6) Single IO port instructions in CpuIo2Dxe will slow down emulated IDE
transfers considerably. (I'm not holding this against the lib class
extraction or SEV in general. We should simply acknowledge this as
another reason to default to virtio-blk or virtio-scsi in VM configs.)

Thanks!
Laszlo


> 
> Leo Duran (4):
>   MdePkg: Add BaseIoFifoLib library
>   Modify .DSC files that include UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
>   Modify UefiCpuPkg/CpuIo2Dxe to use new BaseIoFifoLib library.
>   Modify QemuFwCfgLib to use new BaseIoFifoLib library.
> 
>  CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc     |   1 +
>  CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc  |   1 +
>  DuetPkg/DuetPkgIa32.dsc                           |   1 +
>  DuetPkg/DuetPkgX64.dsc                            |   1 +
>  MdePkg/Include/Library/IoFifoLib.h                | 175 ++++++++++++++++++++++
>  MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf    |  45 ++++++
>  MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.asm      | 139 +++++++++++++++++
>  MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.nasm     | 135 +++++++++++++++++
>  MdePkg/Library/BaseIoFifoLib/X64/IoFifo.asm       | 125 ++++++++++++++++
>  MdePkg/Library/BaseIoFifoLib/X64/IoFifo.nasm      | 124 +++++++++++++++
>  MdePkg/MdePkg.dec                                 |   3 +
>  MdePkg/MdePkg.dsc                                 |   1 +
>  OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm |  55 -------
>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c       |   1 +
>  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf     |   7 +-
>  OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm  |  52 -------
>  OvmfPkg/OvmfPkgIa32.dsc                           |   1 +
>  OvmfPkg/OvmfPkgIa32X64.dsc                        |   1 +
>  OvmfPkg/OvmfPkgX64.dsc                            |   1 +
>  QuarkPlatformPkg/Quark.dsc                        |   1 +
>  QuarkPlatformPkg/QuarkMin.dsc                     |   1 +
>  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.c                  |   1 -
>  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.h                  |   1 +
>  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf                |  10 +-
>  UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.asm              | 140 -----------------
>  UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.nasm             | 136 -----------------
>  UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.asm               | 126 ----------------
>  UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.nasm              | 125 ----------------
>  UefiCpuPkg/UefiCpuPkg.dsc                         |   1 +
>  Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc           |   1 +
>  Vlv2TbltDevicePkg/PlatformPkgIA32.dsc             |   1 +
>  Vlv2TbltDevicePkg/PlatformPkgX64.dsc              |   1 +
>  32 files changed, 764 insertions(+), 650 deletions(-)
>  create mode 100644 MdePkg/Include/Library/IoFifoLib.h
>  create mode 100644 MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
>  create mode 100644 MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.asm
>  create mode 100644 MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.nasm
>  create mode 100644 MdePkg/Library/BaseIoFifoLib/X64/IoFifo.asm
>  create mode 100644 MdePkg/Library/BaseIoFifoLib/X64/IoFifo.nasm
>  delete mode 100644 OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm
>  delete mode 100644 OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm
>  delete mode 100644 UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.asm
>  delete mode 100644 UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.nasm
>  delete mode 100644 UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.asm
>  delete mode 100644 UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.nasm
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/4] *** BaseIoFifoLib ***
  2017-01-05 17:24 ` [PATCH 0/4] *** BaseIoFifoLib *** Laszlo Ersek
@ 2017-01-05 20:47   ` Duran, Leo
  0 siblings, 0 replies; 9+ messages in thread
From: Duran, Leo @ 2017-01-05 20:47 UTC (permalink / raw)
  To: 'Laszlo Ersek', edk2-devel@ml01.01.org
  Cc: Singh, Brijesh, liming.gao@intel.com, michael.d.kinney@intel.com,
	jeff.fan@intel.com

Lazlo,
Thanks for the thorough feedback... I just sent out v2.
Leo.

> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Thursday, January 05, 2017 11:25 AM
> To: Duran, Leo <leo.duran@amd.com>; edk2-devel@ml01.01.org
> Cc: Singh, Brijesh <brijesh.singh@amd.com>; liming.gao@intel.com;
> michael.d.kinney@intel.com; jeff.fan@intel.com
> Subject: Re: [edk2] [PATCH 0/4] *** BaseIoFifoLib ***
> 
> On 01/05/17 00:07, Leo Duran wrote:
> > The UefiCpuPkg/CpuIo2Dxe driver and the QemuCfgLib library have
> > duplicate implementations of I/O Fifo routines. The patch series moves
> > the I/O Fifo routines into a common BaseIofifoLib library supporting
> > IA32 and X64 architectures under MdePkg.
> >
> > The intent of this patch series is twofold:
> > 1) Consolidate I/O Fifo routines into a common BaseIofifoLib library.
> > 2) Allow override of BaseIofifoLib for specific platform implementations.
> > For example, the OVMF package can provide its own version of
> > BaseIoFifoLib to support Secure Encrypted Virtualization (SEV) guests,
> > since SEV does not support string I/O instructions (rep ins/outs), and
> > requires unrolled loops of single in/out instructions.
> 
> General comments:
> 
> (1) Please rebase the series, picking "edit" for each patch, and re-commit
> each patch (without any code changes) with:
> 
>   git commit --amend --author='Brijesh Singh <brijesh.singh@amd.com>'
> 
> This will cause the formatted patch emails to start with
> 
> From: Brijesh Singh <brijesh.singh@amd.com>
> 
> and Brijesh's authorship will be then correctly reflected in git metadata after
> applying the patches with "git am".
> 
> (I'm basing this on the Signed-off-by tags.)
> 
> (2) I think your S-o-b should also be present, at the bottom.
> 
> (3) If you updated the patches after getting them from Brijesh (i.e., you
> aren't merely forwarding them), then I believe you should drop your
> Reviewed-by.
> 
> (4) The new files shouldn't carry just Intel's copyright notice -- they are new
> files, so they should get AMD's too. (Some of the new files do this, some
> don't.)
> 
> Comments related to virt:
> 
> (5) OVMF now supports (and prefers) the DMA-like interface of fw_cfg
> (available in newer QEMU releases), which doesn't use port IO at all; so in
> practice the REPs should cause problems under SEV, when used in
> QemuFwCfgLib.
> 
> Nonetheless, I do agree that code deduplication is a good thing!
> 
> (6) Single IO port instructions in CpuIo2Dxe will slow down emulated IDE
> transfers considerably. (I'm not holding this against the lib class extraction or
> SEV in general. We should simply acknowledge this as another reason to
> default to virtio-blk or virtio-scsi in VM configs.)
> 
> Thanks!
> Laszlo
> 
> 
> >
> > Leo Duran (4):
> >   MdePkg: Add BaseIoFifoLib library
> >   Modify .DSC files that include UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
> >   Modify UefiCpuPkg/CpuIo2Dxe to use new BaseIoFifoLib library.
> >   Modify QemuFwCfgLib to use new BaseIoFifoLib library.
> >
> >  CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc     |   1 +
> >  CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc  |   1 +
> >  DuetPkg/DuetPkgIa32.dsc                           |   1 +
> >  DuetPkg/DuetPkgX64.dsc                            |   1 +
> >  MdePkg/Include/Library/IoFifoLib.h                | 175
> ++++++++++++++++++++++
> >  MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf    |  45 ++++++
> >  MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.asm      | 139
> +++++++++++++++++
> >  MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.nasm     | 135
> +++++++++++++++++
> >  MdePkg/Library/BaseIoFifoLib/X64/IoFifo.asm       | 125
> ++++++++++++++++
> >  MdePkg/Library/BaseIoFifoLib/X64/IoFifo.nasm      | 124
> +++++++++++++++
> >  MdePkg/MdePkg.dec                                 |   3 +
> >  MdePkg/MdePkg.dsc                                 |   1 +
> >  OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm |  55 -------
> >  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c       |   1 +
> >  OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf     |   7 +-
> >  OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm  |  52 -------
> >  OvmfPkg/OvmfPkgIa32.dsc                           |   1 +
> >  OvmfPkg/OvmfPkgIa32X64.dsc                        |   1 +
> >  OvmfPkg/OvmfPkgX64.dsc                            |   1 +
> >  QuarkPlatformPkg/Quark.dsc                        |   1 +
> >  QuarkPlatformPkg/QuarkMin.dsc                     |   1 +
> >  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.c                  |   1 -
> >  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.h                  |   1 +
> >  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf                |  10 +-
> >  UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.asm              | 140 -----------------
> >  UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.nasm             | 136 -----------------
> >  UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.asm               | 126 ----------------
> >  UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.nasm              | 125 ----------------
> >  UefiCpuPkg/UefiCpuPkg.dsc                         |   1 +
> >  Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc           |   1 +
> >  Vlv2TbltDevicePkg/PlatformPkgIA32.dsc             |   1 +
> >  Vlv2TbltDevicePkg/PlatformPkgX64.dsc              |   1 +
> >  32 files changed, 764 insertions(+), 650 deletions(-)  create mode
> > 100644 MdePkg/Include/Library/IoFifoLib.h
> >  create mode 100644 MdePkg/Library/BaseIoFifoLib/BaseIoFifoLib.inf
> >  create mode 100644 MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.asm
> >  create mode 100644 MdePkg/Library/BaseIoFifoLib/Ia32/IoFifo.nasm
> >  create mode 100644 MdePkg/Library/BaseIoFifoLib/X64/IoFifo.asm
> >  create mode 100644 MdePkg/Library/BaseIoFifoLib/X64/IoFifo.nasm
> >  delete mode 100644
> OvmfPkg/Library/QemuFwCfgLib/Ia32/IoLibExAsm.nasm
> >  delete mode 100644
> OvmfPkg/Library/QemuFwCfgLib/X64/IoLibExAsm.nasm
> >  delete mode 100644 UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.asm
> >  delete mode 100644 UefiCpuPkg/CpuIo2Dxe/Ia32/IoFifo.nasm
> >  delete mode 100644 UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.asm
> >  delete mode 100644 UefiCpuPkg/CpuIo2Dxe/X64/IoFifo.nasm
> >



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-01-05 20:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-04 23:07 [PATCH 0/4] *** BaseIoFifoLib *** Leo Duran
2017-01-04 23:07 ` [PATCH 1/4] MdePkg: Add BaseIoFifoLib library Leo Duran
2017-01-04 23:07 ` [PATCH 2/4] Modify .DSC files that include UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf Leo Duran
2017-01-05 17:08   ` Laszlo Ersek
2017-01-04 23:07 ` [PATCH 3/4] Modify UefiCpuPkg/CpuIo2Dxe to use new BaseIoFifoLib library Leo Duran
2017-01-04 23:07 ` [PATCH 4/4] Modify QemuFwCfgLib " Leo Duran
2017-01-05 17:12   ` Laszlo Ersek
2017-01-05 17:24 ` [PATCH 0/4] *** BaseIoFifoLib *** Laszlo Ersek
2017-01-05 20:47   ` Duran, Leo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox