From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 2CC327803CF for ; Fri, 27 Oct 2023 05:43:47 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Q8QKuM34nVCpieMcPBBR5IEVXhgXoOtE2GW0dECf3MU=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1698385426; v=1; b=SdkrBYwoehTk14aKE1UhucaOb65d0YQSnB08IVOErtukcJfJgB1X8pTqUa+UauQqD9/GxwVu G2FGptRzuSkG77+topzCZ5QBACREKKfRRqEWU1xdIEVfrWfBLQALyVwfM0d3S4vc3xTOc+rcNvM 8fao3KNykG99RpidnWU3sh48= X-Received: by 127.0.0.2 with SMTP id waVpYY7687511x8fVPQRrvEK; Thu, 26 Oct 2023 22:43:46 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.931.1698385420739806443 for ; Thu, 26 Oct 2023 22:43:46 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="391587870" X-IronPort-AV: E=Sophos;i="6.03,255,1694761200"; d="scan'208";a="391587870" X-Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 22:43:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="763089509" X-IronPort-AV: E=Sophos;i="6.03,255,1694761200"; d="scan'208";a="763089509" X-Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.55.43]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 22:43:44 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu , Ray Ni Subject: [edk2-devel] [PATCH 7/7] MdePkg:remove BaseIoLibIntrinsicSev related code Date: Fri, 27 Oct 2023 13:43:00 +0800 Message-Id: <20231027054300.1382-8-dun.tan@intel.com> In-Reply-To: <20231027054300.1382-1-dun.tan@intel.com> References: <20231027054300.1382-1-dun.tan@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,dun.tan@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: uSC9H7NPN5CmPG2YokQ63Fcvx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=SdkrBYwo; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Remove BaseIoLibIntrinsicSev related code in MdePkg. Signed-off-by: Dun Tan Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: Ray Ni --- MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf | 61 ------------------------------------------------------------- MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm | 131 ----------------------------------------------------------------------------------------------------------------------------------- MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifoSev.nasm | 293 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c | 1 - MdePkg/Library/BaseIoLibIntrinsic/IoLibSev.h | 166 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm | 120 ------------------------------------------------------------------------------------------------------------------------ MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm | 282 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ MdePkg/MdePkg.dsc | 1 - 8 files changed, 1055 deletions(-) diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf deleted file mode 100644 index e1b8298ac4..0000000000 --- a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf +++ /dev/null @@ -1,61 +0,0 @@ -## @file -# Instance of I/O Library using compiler intrinsics. -# -# I/O Library that uses compiler intrinsics to perform IN and OUT instructions -# for IA-32 and x64. -# -# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.
-# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Copyright (c) 2017, AMD Incorporated. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseIoLibIntrinsicSev - MODULE_UNI_FILE = BaseIoLibIntrinsic.uni - FILE_GUID = 93742f95-6e71-4581-b600-8e1da443f95a - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = IoLib - - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - IoLibMmioBuffer.c - BaseIoLibIntrinsicInternal.h - IoHighLevel.c - IoLibTdx.h - IoLibSev.h - -[Sources.IA32] - IoLibGcc.c | GCC - IoLibMsc.c | MSFT - IoLib.c - IoLibInternalTdxNull.c - Ia32/IoFifoSev.nasm - -[Sources.X64] - IoLibGcc.c | GCC - IoLibMsc.c | MSFT - IoLib.c - IoLibInternalTdx.c - IoLibFifo.c - X64/IoFifoSev.nasm - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - DebugLib - BaseLib - RegisterFilterLib - CcProbeLib - -[LibraryClasses.X64] - TdxLib diff --git a/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm b/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm deleted file mode 100644 index a4ae1a0053..0000000000 --- a/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm +++ /dev/null @@ -1,131 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
-; Copyright (c) 2017, AMD Incorporated. All rights reserved.
-; -; SPDX-License-Identifier: BSD-2-Clause-Patent -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo8 ( -; IN UINTN Port, -; IN UINTN Size, -; OUT VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo8) -ASM_PFX(IoReadFifo8): - push edi - cld - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov edi, [esp + 16] -rep insb - pop edi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo16 ( -; IN UINTN Port, -; IN UINTN Size, -; OUT VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo16) -ASM_PFX(IoReadFifo16): - push edi - cld - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov edi, [esp + 16] -rep insw - pop edi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo32 ( -; IN UINTN Port, -; IN UINTN Size, -; OUT VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo32) -ASM_PFX(IoReadFifo32): - push edi - cld - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov edi, [esp + 16] -rep insd - pop edi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo8 ( -; IN UINTN Port, -; IN UINTN Size, -; IN VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo8) -ASM_PFX(IoWriteFifo8): - push esi - cld - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov esi, [esp + 16] -rep outsb - pop esi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo16 ( -; IN UINTN Port, -; IN UINTN Size, -; IN VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo16) -ASM_PFX(IoWriteFifo16): - push esi - cld - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov esi, [esp + 16] -rep outsw - pop esi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo32 ( -; IN UINTN Port, -; IN UINTN Size, -; IN VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo32) -ASM_PFX(IoWriteFifo32): - push esi - cld - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov esi, [esp + 16] -rep outsd - pop esi - ret - diff --git a/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifoSev.nasm b/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifoSev.nasm deleted file mode 100644 index 63a4771d3c..0000000000 --- a/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifoSev.nasm +++ /dev/null @@ -1,293 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
-; Copyright (c) 2017, AMD Incorporated. All rights reserved.
-; -; SPDX-License-Identifier: BSD-2-Clause-Patent -; -;------------------------------------------------------------------------------ - - SECTION .text - -;------------------------------------------------------------------------------ -; Check whether we need to unroll the String I/O under SEV guest -; -; Return // eax (1 - unroll, 0 - no unroll) -;------------------------------------------------------------------------------ -global ASM_PFX(SevNoRepIo) -ASM_PFX(SevNoRepIo): - - ; CPUID clobbers ebx, ecx and edx - push ebx - push ecx - push edx - - ; Check if we are running under hypervisor - ; CPUID(1).ECX Bit 31 - mov eax, 1 - cpuid - bt ecx, 31 - jnc @UseRepIo - - ; Check if we have Memory encryption CPUID leaf - mov eax, 0x80000000 - cpuid - cmp eax, 0x8000001f - jl @UseRepIo - - ; Check for memory encryption feature: - ; CPUID Fn8000_001F[EAX] - Bit 1 - ; - mov eax, 0x8000001f - cpuid - bt eax, 1 - jnc @UseRepIo - - ; Check if memory encryption is enabled - ; MSR_0xC0010131 - Bit 0 (SEV enabled) - ; MSR_0xC0010131 - Bit 1 (SEV-ES enabled) - mov ecx, 0xc0010131 - rdmsr - - ; Check for (SevEsEnabled == 0 && SevEnabled == 1) - and eax, 3 - cmp eax, 1 - je @SevNoRepIo_Done - -@UseRepIo: - xor eax, eax - -@SevNoRepIo_Done: - pop edx - pop ecx - pop ebx - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo8 ( -; IN UINTN Port, -; IN UINTN Size, -; OUT VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo8) -ASM_PFX(IoReadFifo8): - push edi - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov edi, [esp + 16] - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoReadFifo8_NoRep - - cld - rep insb - jmp @IoReadFifo8_Done - -@IoReadFifo8_NoRep: - jecxz @IoReadFifo8_Done - -@IoReadFifo8_Loop: - in al, dx - mov byte [edi], al - inc edi - loop @IoReadFifo8_Loop - -@IoReadFifo8_Done: - pop edi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo16 ( -; IN UINTN Port, -; IN UINTN Size, -; OUT VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo16) -ASM_PFX(IoReadFifo16): - push edi - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov edi, [esp + 16] - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoReadFifo16_NoRep - - cld - rep insw - jmp @IoReadFifo16_Done - -@IoReadFifo16_NoRep: - jecxz @IoReadFifo16_Done - -@IoReadFifo16_Loop: - in ax, dx - mov word [edi], ax - add edi, 2 - loop @IoReadFifo16_Loop - -@IoReadFifo16_Done: - pop edi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo32 ( -; IN UINTN Port, -; IN UINTN Size, -; OUT VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo32) -ASM_PFX(IoReadFifo32): - push edi - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov edi, [esp + 16] - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoReadFifo32_NoRep - - cld - rep insd - jmp @IoReadFifo32_Done - -@IoReadFifo32_NoRep: - jecxz @IoReadFifo32_Done - -@IoReadFifo32_Loop: - in eax, dx - mov dword [edi], eax - add edi, 4 - loop @IoReadFifo32_Loop - -@IoReadFifo32_Done: - pop edi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo8 ( -; IN UINTN Port, -; IN UINTN Size, -; IN VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo8) -ASM_PFX(IoWriteFifo8): - push esi - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov esi, [esp + 16] - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoWriteFifo8_NoRep - - cld - rep outsb - jmp @IoWriteFifo8_Done - -@IoWriteFifo8_NoRep: - jecxz @IoWriteFifo8_Done - -@IoWriteFifo8_Loop: - mov al, byte [esi] - out dx, al - inc esi - loop @IoWriteFifo8_Loop - -@IoWriteFifo8_Done: - pop esi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo16 ( -; IN UINTN Port, -; IN UINTN Size, -; IN VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo16) -ASM_PFX(IoWriteFifo16): - push esi - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov esi, [esp + 16] - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoWriteFifo16_NoRep - - cld - rep outsw - jmp @IoWriteFifo16_Done - -@IoWriteFifo16_NoRep: - jecxz @IoWriteFifo16_Done - -@IoWriteFifo16_Loop: - mov ax, word [esi] - out dx, ax - add esi, 2 - loop @IoWriteFifo16_Loop - -@IoWriteFifo16_Done: - pop esi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo32 ( -; IN UINTN Port, -; IN UINTN Size, -; IN VOID *Buffer -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo32) -ASM_PFX(IoWriteFifo32): - push esi - mov dx, [esp + 8] - mov ecx, [esp + 12] - mov esi, [esp + 16] - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoWriteFifo32_NoRep - - cld - rep outsd - jmp @IoWriteFifo32_Done - -@IoWriteFifo32_NoRep: - jecxz @IoWriteFifo32_Done - -@IoWriteFifo32_Loop: - mov eax, dword [esi] - out dx, eax - add esi, 4 - loop @IoWriteFifo32_Loop - -@IoWriteFifo32_Done: - pop esi - ret - diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c index adce1040f6..91c0637c7d 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c @@ -7,7 +7,6 @@ **/ #include "BaseIoLibIntrinsicInternal.h" -#include "IoLibSev.h" #include "IoLibTdx.h" #include #include diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibSev.h b/MdePkg/Library/BaseIoLibIntrinsic/IoLibSev.h deleted file mode 100644 index 6d7cafcff2..0000000000 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibSev.h +++ /dev/null @@ -1,166 +0,0 @@ -/** @file - Header file for SEV IO library. - - Copyright (c) 2021, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent -**/ - -#ifndef IOLIB_SEV_H_ -#define IOLIB_SEV_H_ - -#include - -#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(). - - @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 -SevIoReadFifo8 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ); - -/** - Writes a block of memory into an 8-bit I/O port fifo. - - Writes the 8-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -SevIoWriteFifo8 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ); - -/** - 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 -SevIoReadFifo16 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ); - -/** - Writes a block of memory into an 8-bit I/O port fifo. - - Writes the 8-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -SevIoWriteFifo16 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ); - -/** - 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 -SevIoReadFifo32 ( - IN UINTN Port, - IN UINTN Count, - OUT VOID *Buffer - ); - -/** - Writes a block of memory into an 8-bit I/O port fifo. - - Writes the 8-bit I/O fifo port specified by Port. - The port is written Count times, and the write data is - retrieved from the provided Buffer. - - This function must guarantee that all I/O write and write operations are - serialized. - - If 8-bit I/O port operations are not supported, then ASSERT(). - - @param Port The I/O port to write. - @param Count The number of times to write I/O port. - @param Buffer The buffer to retrieve the write data from. - -**/ -VOID -EFIAPI -SevIoWriteFifo32 ( - IN UINTN Port, - IN UINTN Count, - IN VOID *Buffer - ); - -#endif diff --git a/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm b/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm deleted file mode 100644 index d459072f6e..0000000000 --- a/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm +++ /dev/null @@ -1,120 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
-; Copyright (c) 2017, AMD Incorporated. All rights reserved.
-; -; SPDX-License-Identifier: BSD-2-Clause-Patent -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo8 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; OUT VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo8) -ASM_PFX(IoReadFifo8): - cld - xchg rcx, rdx - xchg rdi, r8 ; rdi: buffer address; r8: save rdi -rep insb - mov rdi, r8 ; restore rdi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo16 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; OUT VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo16) -ASM_PFX(IoReadFifo16): - cld - xchg rcx, rdx - xchg rdi, r8 ; rdi: buffer address; r8: save rdi -rep insw - mov rdi, r8 ; restore rdi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoReadFifo32 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; OUT VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoReadFifo32) -ASM_PFX(IoReadFifo32): - cld - xchg rcx, rdx - xchg rdi, r8 ; rdi: buffer address; r8: save rdi -rep insd - mov rdi, r8 ; restore rdi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo8 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; IN VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo8) -ASM_PFX(IoWriteFifo8): - cld - xchg rcx, rdx - xchg rsi, r8 ; rsi: buffer address; r8: save rsi -rep outsb - mov rsi, r8 ; restore rsi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo16 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; IN VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo16) -ASM_PFX(IoWriteFifo16): - cld - xchg rcx, rdx - xchg rsi, r8 ; rsi: buffer address; r8: save rsi -rep outsw - mov rsi, r8 ; restore rsi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo32 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; IN VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(IoWriteFifo32) -ASM_PFX(IoWriteFifo32): - cld - xchg rcx, rdx - xchg rsi, r8 ; rsi: buffer address; r8: save rsi -rep outsd - mov rsi, r8 ; restore rsi - ret - diff --git a/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm b/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm deleted file mode 100644 index d02286b4d5..0000000000 --- a/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifoSev.nasm +++ /dev/null @@ -1,282 +0,0 @@ -;------------------------------------------------------------------------------ -; -; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
-; Copyright (c) 2017, AMD Incorporated. All rights reserved.
-; -; SPDX-License-Identifier: BSD-2-Clause-Patent -; -;------------------------------------------------------------------------------ - - DEFAULT REL - SECTION .text - -;------------------------------------------------------------------------------ -; Check whether we need to unroll the String I/O in SEV guest -; -; Return // eax (1 - unroll, 0 - no unroll) -;------------------------------------------------------------------------------ -global ASM_PFX(SevNoRepIo) -ASM_PFX(SevNoRepIo): - - ; CPUID clobbers ebx, ecx and edx - push rbx - push rcx - push rdx - - ; Check if we are runing under hypervisor - ; CPUID(1).ECX Bit 31 - mov eax, 1 - cpuid - bt ecx, 31 - jnc @UseRepIo - - ; Check if we have Memory encryption CPUID leaf - mov eax, 0x80000000 - cpuid - cmp eax, 0x8000001f - jl @UseRepIo - - ; Check for memory encryption feature: - ; CPUID Fn8000_001F[EAX] - Bit 1 - ; - mov eax, 0x8000001f - cpuid - bt eax, 1 - jnc @UseRepIo - - ; Check if memory encryption is enabled - ; MSR_0xC0010131 - Bit 0 (SEV enabled) - ; MSR_0xC0010131 - Bit 1 (SEV-ES enabled) - mov ecx, 0xc0010131 - rdmsr - - ; Check for (SevEsEnabled == 0 && SevEnabled == 1) - and eax, 3 - cmp eax, 1 - je @SevNoRepIo_Done - -@UseRepIo: - xor eax, eax - -@SevNoRepIo_Done: - pop rdx - pop rcx - pop rbx - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; SevIoReadFifo8 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; OUT VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(SevIoReadFifo8) -ASM_PFX(SevIoReadFifo8): - xchg rcx, rdx - xchg rdi, r8 ; rdi: buffer address; r8: save rdi - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoReadFifo8_NoRep - - cld - rep insb - jmp @IoReadFifo8_Done - -@IoReadFifo8_NoRep: - jrcxz @IoReadFifo8_Done - -@IoReadFifo8_Loop: - in al, dx - mov byte [rdi], al - inc rdi - loop @IoReadFifo8_Loop - -@IoReadFifo8_Done: - mov rdi, r8 ; restore rdi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; SevIoReadFifo16 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; OUT VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(SevIoReadFifo16) -ASM_PFX(SevIoReadFifo16): - xchg rcx, rdx - xchg rdi, r8 ; rdi: buffer address; r8: save rdi - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoReadFifo16_NoRep - - cld - rep insw - jmp @IoReadFifo16_Done - -@IoReadFifo16_NoRep: - jrcxz @IoReadFifo16_Done - -@IoReadFifo16_Loop: - in ax, dx - mov word [rdi], ax - add rdi, 2 - loop @IoReadFifo16_Loop - -@IoReadFifo16_Done: - mov rdi, r8 ; restore rdi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; SevIoReadFifo32 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; OUT VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(SevIoReadFifo32) -ASM_PFX(SevIoReadFifo32): - xchg rcx, rdx - xchg rdi, r8 ; rdi: buffer address; r8: save rdi - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoReadFifo32_NoRep - - cld - rep insd - jmp @IoReadFifo32_Done - -@IoReadFifo32_NoRep: - jrcxz @IoReadFifo32_Done - -@IoReadFifo32_Loop: - in eax, dx - mov dword [rdi], eax - add rdi, 4 - loop @IoReadFifo32_Loop - -@IoReadFifo32_Done: - mov rdi, r8 ; restore rdi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; IoWriteFifo8 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; IN VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(SevIoWriteFifo8) -ASM_PFX(SevIoWriteFifo8): - xchg rcx, rdx - xchg rsi, r8 ; rsi: buffer address; r8: save rsi - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoWriteFifo8_NoRep - - cld - rep outsb - jmp @IoWriteFifo8_Done - -@IoWriteFifo8_NoRep: - jrcxz @IoWriteFifo8_Done - -@IoWriteFifo8_Loop: - mov al, byte [rsi] - out dx, al - inc rsi - loop @IoWriteFifo8_Loop - -@IoWriteFifo8_Done: - mov rsi, r8 ; restore rsi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; SevIoWriteFifo16 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; IN VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(SevIoWriteFifo16) -ASM_PFX(SevIoWriteFifo16): - xchg rcx, rdx - xchg rsi, r8 ; rsi: buffer address; r8: save rsi - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoWriteFifo16_NoRep - - cld - rep outsw - jmp @IoWriteFifo16_Done - -@IoWriteFifo16_NoRep: - jrcxz @IoWriteFifo16_Done - -@IoWriteFifo16_Loop: - mov ax, word [rsi] - out dx, ax - add rsi, 2 - loop @IoWriteFifo16_Loop - -@IoWriteFifo16_Done: - mov rsi, r8 ; restore rsi - ret - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; SevIoWriteFifo32 ( -; IN UINTN Port, // rcx -; IN UINTN Size, // rdx -; IN VOID *Buffer // r8 -; ); -;------------------------------------------------------------------------------ -global ASM_PFX(SevIoWriteFifo32) -ASM_PFX(SevIoWriteFifo32): - xchg rcx, rdx - xchg rsi, r8 ; rsi: buffer address; r8: save rsi - - ; Check if we need to unroll String I/O - call ASM_PFX(SevNoRepIo) - test eax, eax - jnz @IoWriteFifo32_NoRep - - cld - rep outsd - jmp @IoWriteFifo32_Done - -@IoWriteFifo32_NoRep: - jrcxz @IoWriteFifo32_Done - -@IoWriteFifo32_Loop: - mov eax, dword [rsi] - out dx, eax - add rsi, 4 - loop @IoWriteFifo32_Loop - -@IoWriteFifo32_Done: - mov rsi, r8 ; restore rsi - ret - diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc index a1be123d80..87c7045f63 100644 --- a/MdePkg/MdePkg.dsc +++ b/MdePkg/MdePkg.dsc @@ -158,7 +158,6 @@ [Components.IA32, Components.X64] MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf - MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf -- 2.31.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110188): https://edk2.groups.io/g/devel/message/110188 Mute This Topic: https://groups.io/mt/102215669/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-