From nobody Fri Dec 27 18:27:14 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502460604242112.32870120262669; Fri, 11 Aug 2017 07:10:04 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D8FF821E2571B; Fri, 11 Aug 2017 07:07:38 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2CB602095DE50 for ; Fri, 11 Aug 2017 07:07:37 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Aug 2017 07:09:57 -0700 Received: from jyao1-mobl.ccr.corp.intel.com ([10.254.211.254]) by orsmga005.jf.intel.com with ESMTP; 11 Aug 2017 07:09:56 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,358,1498546800"; d="scan'208";a="136371828" From: Jiewen Yao To: edk2-devel@lists.01.org Date: Fri, 11 Aug 2017 22:09:49 +0800 Message-Id: <1502460591-14428-3-git-send-email-jiewen.yao@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 In-Reply-To: <1502460591-14428-1-git-send-email-jiewen.yao@intel.com> References: <1502460591-14428-1-git-send-email-jiewen.yao@intel.com> Subject: [edk2] [PATCH 2/4] MdePkg/BaseCpuLib: Add CacheLineFlush function. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Star Zeng , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This function will be used by IntelVTd driver. Cc: Liming Gao Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao --- MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 5 ++- MdePkg/Library/BaseCpuLib/Ebc/CpuSleepFlushTlb.c | 16 ++++++++- MdePkg/Library/BaseCpuLib/Ia32/CacheLineFlush.nasm | 37 ++++++++++++++++++= ++ MdePkg/Library/BaseCpuLib/X64/CacheLineFlush.nasm | 37 ++++++++++++++++++= ++ 4 files changed, 93 insertions(+), 2 deletions(-) diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf b/MdePkg/Library/Base= CpuLib/BaseCpuLib.inf index 637a3c5..b43b393 100644 --- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf +++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf @@ -4,7 +4,7 @@ # CPU Library implemented using ASM functions for IA-32 and X64, # PAL CALLs for IPF, and empty functions for EBC. # -# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
# @@ -33,6 +33,8 @@ # =20 [Sources.IA32] + Ia32/CacheLineFlush.nasm + Ia32/CpuSleep.c | MSFT=20 Ia32/CpuFlushTlb.c | MSFT=20 =20 @@ -45,6 +47,7 @@ Ia32/CpuFlushTlbGcc.c | GCC=20 =20 [Sources.X64] + X64/CacheLineFlush.nasm X64/CpuFlushTlb.nasm X64/CpuFlushTlb.asm=20 X64/CpuSleep.nasm diff --git a/MdePkg/Library/BaseCpuLib/Ebc/CpuSleepFlushTlb.c b/MdePkg/Libr= ary/BaseCpuLib/Ebc/CpuSleepFlushTlb.c index de63d63..0c554c2 100644 --- a/MdePkg/Library/BaseCpuLib/Ebc/CpuSleepFlushTlb.c +++ b/MdePkg/Library/BaseCpuLib/Ebc/CpuSleepFlushTlb.c @@ -1,7 +1,7 @@ /** @file Base Library CPU Functions for EBC =20 - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -15,6 +15,20 @@ #include =20 /** + Flushes one cache line. + + Flushes one cache line. The size of cache line can be got by CPU registe= r. +**/ +VOID +EFIAPI +CacheLineFlush ( + IN UINTN Address + ) +{ + ASSERT (FALSE); +} + +/** Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. =20 Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CacheLineFlush.nasm b/MdePkg/Li= brary/BaseCpuLib/Ia32/CacheLineFlush.nasm new file mode 100644 index 0000000..a2557ab --- /dev/null +++ b/MdePkg/Library/BaseCpuLib/Ia32/CacheLineFlush.nasm @@ -0,0 +1,37 @@ +;-------------------------------------------------------------------------= ----- ; +; Copyright (c) 2017, Intel Corporation. All rights reserved.
+; This program and the accompanying materials +; are licensed and made available under the terms and conditions of the BS= D License +; which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. +; +; Module Name: +; +; CacheLineFlush.Asm +; +; Abstract: +; +; CacheLineFlush function +; +; Notes: +; +;-------------------------------------------------------------------------= ----- + + SECTION .text + +;-------------------------------------------------------------------------= ----- +; VOID +; EFIAPI +; CacheLineFlush ( +; IN UINTN Address +; ); +;-------------------------------------------------------------------------= ----- +global ASM_PFX(CacheLineFlush) +ASM_PFX(CacheLineFlush): + mov eax, [esp + 4] + clflush [eax] + ret + diff --git a/MdePkg/Library/BaseCpuLib/X64/CacheLineFlush.nasm b/MdePkg/Lib= rary/BaseCpuLib/X64/CacheLineFlush.nasm new file mode 100644 index 0000000..7cf736e --- /dev/null +++ b/MdePkg/Library/BaseCpuLib/X64/CacheLineFlush.nasm @@ -0,0 +1,37 @@ +;-------------------------------------------------------------------------= ----- ; +; Copyright (c) 2017, Intel Corporation. All rights reserved.
+; This program and the accompanying materials +; are licensed and made available under the terms and conditions of the BS= D License +; which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. +; +; Module Name: +; +; CacheLineFlush.Asm +; +; Abstract: +; +; CacheLineFlush function +; +; Notes: +; +;-------------------------------------------------------------------------= ----- + + DEFAULT REL + SECTION .text + +;-------------------------------------------------------------------------= ----- +; VOID +; EFIAPI +; CacheLineFlush ( +; IN UINTN Address +; ); +;-------------------------------------------------------------------------= ----- +global ASM_PFX(CacheLineFlush) +ASM_PFX(CacheLineFlush): + clflush [rcx] + ret + --=20 2.7.4.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel