From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web08.279.1632754888273793924 for ; Mon, 27 Sep 2021 08:01:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=IOE7Rqje; spf=temperror, err=temporary DNS error (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=09042b363a=abner.chang@hpe.com) Received: from pps.filterd (m0150241.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18R8W0p2030956; Mon, 27 Sep 2021 15:01:25 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=qpvFT3ZzK+IOJW0mhpKh7TwzWDxkN0FaTqdn8sbRIC0=; b=IOE7RqjexrVWU+FevHzEd2LUKSiF3HaH6eyHt7IYqBK+igc3KDwQPY5STheFQvJeLrot 0jRvK1NqlwpczybAtGgg1wNm+a1gi/GYglvA3I4Bi0eTZv6BMsoz87P7DyhXAKSp5f9w J7/d/donm/6eWVowYx0AgOiFIlNzdImn6JwDF+Xiq9sbogkHqol2XFh9g8J/3WWGihB1 JSC/J+5D6iCubS29abi7QoeWpC728D0FGLWbODntvvUR18hz/+uUeeWZzehYpZhv1zcw TRHVlgXps5J2COntbzn7Qn85d2ipquOzJpVkZPY1TGbQ3c7swNl0DgRRc5i20kpcitpy jQ== Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0a-002e3701.pphosted.com with ESMTP id 3bb2dpx47q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Sep 2021 15:01:24 +0000 Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g4t3426.houston.hpe.com (Postfix) with ESMTP id C8F834E; Mon, 27 Sep 2021 15:01:23 +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 E196F45; Mon, 27 Sep 2021 15:01:21 +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 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg Date: Mon, 27 Sep 2021 22:03:48 +0800 Message-Id: <20210927140351.29577-7-abner.chang@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927140351.29577-1-abner.chang@hpe.com> References: <20210927140351.29577-1-abner.chang@hpe.com> X-Proofpoint-ORIG-GUID: nwcwdS1uA4NesVYpUKASkfHkqg-zY1KU X-Proofpoint-GUID: nwcwdS1uA4NesVYpUKASkfHkqg-zY1KU 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-27_06,2021-09-24_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 adultscore=0 clxscore=1015 impostorscore=0 spamscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 mlxlogscore=907 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2109270103 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 (88%) rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c => OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c (93%) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index e2d3d10997..cde55af64c 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -60,7 +60,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 fa63978f24..4ae5ef3172 100644 --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc @@ -58,7 +58,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 88% rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf index 74db3b01f4..f92dcf10b7 100644 --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf @@ -24,17 +24,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