From 3c73532a8a789eea671a1cf782ea3829bc488cb6 Mon Sep 17 00:00:00 2001 From: Dun Tan Date: Wed, 8 Nov 2023 18:49:57 -0800 Subject: MdePkg: Change IoLibFifo.c to IoLibFifoCc.c Change IoLibFifo.c to IoLibFifoCc.c since the file is for Tdx and SEV in BaseIoLibIntrinsicSev. It's also to distinguish with a new incoming IoLibFifo.c for BaseIoLibIntrinsic. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: Ray Ni Signed-off-by: Dun Tan Reviewed-by: Ray Ni Acked-by: Michael D Kinney Acked-by: Laszlo Ersek --- .../BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf | 2 +- MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c | 217 --------------------- MdePkg/Library/BaseIoLibIntrinsic/IoLibFifoCc.c | 217 +++++++++++++++++++++ 3 files changed, 218 insertions(+), 218 deletions(-) delete mode 100644 MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c create mode 100644 MdePkg/Library/BaseIoLibIntrinsic/IoLibFifoCc.c diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf index e1b8298ac4..8b62bd4e2a 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf +++ b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf @@ -45,7 +45,7 @@ IoLibMsc.c | MSFT IoLib.c IoLibInternalTdx.c - IoLibFifo.c + IoLibFifoCc.c X64/IoFifoSev.nasm [Packages] diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c deleted file mode 100644 index 9a94bc6a05..0000000000 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c +++ /dev/null @@ -1,217 +0,0 @@ -/** @file - IoFifo read/write routines. - - Copyright (c) 2021, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "BaseIoLibIntrinsicInternal.h" -#include "IoLibSev.h" -#include "IoLibTdx.h" -#include -#include - -/** - 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(). - - In TDX a serial of TdIoRead8 is invoked to read the I/O port fifo. - - @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 - ) -{ - if (IsTdxGuest ()) { - TdIoReadFifo8 (Port, Count, Buffer); - } else { - SevIoReadFifo8 (Port, Count, 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(). - - In TDX a serial of TdIoWrite8 is invoked to write data to the I/O port. - - @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 - ) -{ - if (IsTdxGuest ()) { - TdIoWriteFifo8 (Port, Count, Buffer); - } else { - SevIoWriteFifo8 (Port, Count, 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(). - - In TDX a serial of TdIoRead16 is invoked to read data from the I/O port. - - @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 - ) -{ - if (IsTdxGuest ()) { - TdIoReadFifo16 (Port, Count, Buffer); - } else { - SevIoReadFifo16 (Port, Count, 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(). - - In TDX a serial of TdIoWrite16 is invoked to write data to the I/O port. - - @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 - ) -{ - if (IsTdxGuest ()) { - TdIoWriteFifo16 (Port, Count, Buffer); - } else { - SevIoWriteFifo16 (Port, Count, 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(). - - In TDX a serial of TdIoRead32 is invoked to read data from the I/O port. - - @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 - ) -{ - if (IsTdxGuest ()) { - TdIoReadFifo32 (Port, Count, Buffer); - } else { - SevIoReadFifo32 (Port, Count, 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(). - - In TDX a serial of TdIoWrite32 is invoked to write data to the I/O port. - - @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 - ) -{ - if (IsTdxGuest ()) { - TdIoWriteFifo32 (Port, Count, Buffer); - } else { - SevIoWriteFifo32 (Port, Count, Buffer); - } -} diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifoCc.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifoCc.c new file mode 100644 index 0000000000..0c85cf9426 --- /dev/null +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifoCc.c @@ -0,0 +1,217 @@ +/** @file + IoFifo read/write routines. + + Copyright (c) 2021 - 2023, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "BaseIoLibIntrinsicInternal.h" +#include "IoLibSev.h" +#include "IoLibTdx.h" +#include +#include + +/** + 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(). + + In TDX a serial of TdIoRead8 is invoked to read the I/O port fifo. + + @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 + ) +{ + if (IsTdxGuest ()) { + TdIoReadFifo8 (Port, Count, Buffer); + } else { + SevIoReadFifo8 (Port, Count, 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(). + + In TDX a serial of TdIoWrite8 is invoked to write data to the I/O port. + + @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 + ) +{ + if (IsTdxGuest ()) { + TdIoWriteFifo8 (Port, Count, Buffer); + } else { + SevIoWriteFifo8 (Port, Count, 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(). + + In TDX a serial of TdIoRead16 is invoked to read data from the I/O port. + + @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 + ) +{ + if (IsTdxGuest ()) { + TdIoReadFifo16 (Port, Count, Buffer); + } else { + SevIoReadFifo16 (Port, Count, 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(). + + In TDX a serial of TdIoWrite16 is invoked to write data to the I/O port. + + @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 + ) +{ + if (IsTdxGuest ()) { + TdIoWriteFifo16 (Port, Count, Buffer); + } else { + SevIoWriteFifo16 (Port, Count, 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(). + + In TDX a serial of TdIoRead32 is invoked to read data from the I/O port. + + @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 + ) +{ + if (IsTdxGuest ()) { + TdIoReadFifo32 (Port, Count, Buffer); + } else { + SevIoReadFifo32 (Port, Count, 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(). + + In TDX a serial of TdIoWrite32 is invoked to write data to the I/O port. + + @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 + ) +{ + if (IsTdxGuest ()) { + TdIoWriteFifo32 (Port, Count, Buffer); + } else { + SevIoWriteFifo32 (Port, Count, Buffer); + } +} -- cgit