From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web12.11593.1632821324450311338 for ; Tue, 28 Sep 2021 02:28:44 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=FQ1DE66B; spf=temperror, err=temporary DNS error (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=0905a85297=abner.chang@hpe.com) Received: from pps.filterd (m0134425.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18S8224Z001521; Tue, 28 Sep 2021 09:28:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pps0720; bh=GkSlPq38ocZgfTyw4uG89oglZFgyD1j+y8W7qCX+xR0=; b=FQ1DE66B8ymdh1bK5d0LMBbKUQYGgfhJrKqzUHUx4Ubu2K5v+MjIfoR8dz/gLKeEYDT8 /3Jmg24EY7m2+dJoZLyvJEAX/uPNruqR8Clo4lQKrzdP11NLfJ6fYa+l9PIEOlotrD7n HzuT7aoKuSi5/12TFmSziB7hgGmK7maIM/11Nml3kVURU7uyDi4lJ3U61wAzSujLyw0J MJkpr4FE/IOWWRevp2CADDEk82+Z8P7gZdiEth0Mx3frJnMUOmmP/TczWs3gH8S6XnO/ a0Oars078/gpZU7zr/PWHzBYmu1gziPIiDLNRgrNMJgOATnrIKWe/D42U+YXB3zCX7iR rA== Received: from g9t5008.houston.hpe.com (g9t5008.houston.hpe.com [15.241.48.72]) by mx0b-002e3701.pphosted.com with ESMTP id 3bbt89tvda-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Sep 2021 09:28:40 +0000 Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g9t5008.houston.hpe.com (Postfix) with ESMTP id 81E6059; Tue, 28 Sep 2021 09:28:39 +0000 (UTC) Received: from abner-virtual-machine.asiapacific.hpqcorp.net (abner-virtual-machine.asiapacific.hpqcorp.net [15.119.210.153]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id 9F48955; Tue, 28 Sep 2021 09:28:37 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Jiewen Yao , Jordan Justen , Gerd Hoffmann , Daniel Schaefer , Sunil V L Subject: [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg Date: Tue, 28 Sep 2021 16:31:04 +0800 Message-Id: <20210928083107.7418-7-abner.chang@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210928083107.7418-1-abner.chang@hpe.com> References: <20210928083107.7418-1-abner.chang@hpe.com> X-Proofpoint-GUID: QXke78eg34J3-uWof0kRFrC7sWmW67ma X-Proofpoint-ORIG-GUID: QXke78eg34J3-uWof0kRFrC7sWmW67ma X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-28_05,2021-09-28_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 impostorscore=0 mlxscore=0 bulkscore=0 spamscore=0 phishscore=0 adultscore=0 priorityscore=1501 mlxlogscore=905 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2109280056 Relocate QemuFwCfgLib to OvmfPkg/Library/QemuFwCfgLib and rename it to QemuFwCfgLibMMIO, this library is leverage by both ARM and RISC-V archs. Signed-off-by: Abner Chang Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Sami Mujawar Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Cc: Daniel Schaefer Cc: Sunil V L --- ArmVirtPkg/ArmVirtQemu.dsc | 2 +- ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 +- .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf | 5 ++--- .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c | 7 ++++--- 4 files changed, 8 insertions(+), 8 deletions(-) rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf => OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf (87%) rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c => OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c (93%) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 07f9699c79..6c949fd559 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -59,7 +59,7 @@ # Virtio Support VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf - QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf + QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc index cf7a2b4463..64035a948d 100644 --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc @@ -57,7 +57,7 @@ # Virtio Support VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf - QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf + QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf similarity index 87% rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf index f3cc827907..8101fac03f 100644 --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf @@ -23,17 +23,16 @@ # The following information is for reference only and not required by the build # tools. # -# VALID_ARCHITECTURES = ARM AARCH64 +# VALID_ARCHITECTURES = ARM AARCH64 RISCV64 # [Sources] - QemuFwCfgLib.c + QemuFwCfgLibMMIO.c [Packages] MdePkg/MdePkg.dec OvmfPkg/OvmfPkg.dec EmbeddedPkg/EmbeddedPkg.dec - ArmVirtPkg/ArmVirtPkg.dec [LibraryClasses] BaseLib diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c similarity index 93% rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c index e2ac4108d1..b953f2eb6c 100644 --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c @@ -4,6 +4,7 @@ Copyright (C) 2013 - 2014, Red Hat, Inc. Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.
+ (C) Copyright 2021 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -239,7 +240,7 @@ MmioReadBytes ( UINT8 *Ptr; UINT8 *End; -#ifdef MDE_CPU_AARCH64 +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64) Left = Size & 7; #else Left = Size & 3; @@ -249,7 +250,7 @@ MmioReadBytes ( Ptr = Buffer; End = Ptr + Size; -#ifdef MDE_CPU_AARCH64 +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64) while (Ptr < End) { *(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress); Ptr += 8; @@ -322,7 +323,7 @@ DmaTransferBytes ( // // This will fire off the transfer. // -#ifdef MDE_CPU_AARCH64 +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64) MmioWrite64 (mFwCfgDmaAddress, SwapBytes64 ((UINT64)&Access)); #else MmioWrite32 ((UINT32)(mFwCfgDmaAddress + 4), SwapBytes32 ((UINT32)&Access)); -- 2.17.1