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.web08.6544.1632966209893729656 for ; Wed, 29 Sep 2021 18:43:32 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=JsuSLftt; spf=temperror, err=temporary DNS error (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=0907617d9a=abner.chang@hpe.com) Received: from pps.filterd (m0134424.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18TMW2Ze021053; Thu, 30 Sep 2021 01:43:29 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=mT3+rmgi8gBGbpjygIFjj25hVV6N1CpGRgH2Jz7A6wA=; b=JsuSLfttwIx9O8QchurP4uYCyk/xLVP9UGOzmwHO8ORQkVqqleEBf6Ip44g9xt8GE7Ci GUF1xih2Vve14IKOaYeWOhbeAm4UOu4gPIxowtsKGETxbjyPwwMjzVtuOGlgQUNk+Cm4 CI2SrZZhz3Em3BtpxRvDC/O1ncJgYdugCQa4SWv/AKUWUu7KBufUXSVlJO7PS8S0uE+V N+VHl6jyRgCRqdYHP3Nll1RMJIp3fJDoJ9Uo/2fOcC7x67i2/00o1lbT5nYxALgi+99k rwlsYbd92jQFj7Lhdyg1u696qp387bVpzR3esgiGcRiGDsnPrt1KOZR6S0PBkU9Tupjw PQ== Received: from g2t2352.austin.hpe.com (g2t2352.austin.hpe.com [15.233.44.25]) by mx0b-002e3701.pphosted.com with ESMTP id 3bcmr8frjj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Sep 2021 01:43:28 +0000 Received: from g2t2360.austin.hpecorp.net (g2t2360.austin.hpecorp.net [16.196.225.135]) by g2t2352.austin.hpe.com (Postfix) with ESMTP id 4CA0F63; Thu, 30 Sep 2021 01:43:28 +0000 (UTC) Received: from abner-virtual-machine.asiapacific.hpqcorp.net (abner-virtual-machine.asiapacific.hpqcorp.net [15.119.210.153]) by g2t2360.austin.hpecorp.net (Postfix) with ESMTP id BB6E336; Thu, 30 Sep 2021 01:43:26 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann , Daniel Schaefer , Sunil V L Subject: [PATCH V3 08/12] OvmfPkg/QemuFwCfgLibMMIO: Add RISC-V arch support Date: Thu, 30 Sep 2021 08:45:44 +0800 Message-Id: <20210930004548.3033-9-abner.chang@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210930004548.3033-1-abner.chang@hpe.com> References: <20210930004548.3033-1-abner.chang@hpe.com> X-Proofpoint-ORIG-GUID: cPQZCxWXGyzNHrNvWGfAHsVGZp5K0OnG X-Proofpoint-GUID: cPQZCxWXGyzNHrNvWGfAHsVGZp5K0OnG 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-29_09,2021-09-29_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=946 priorityscore=1501 adultscore=0 lowpriorityscore=0 impostorscore=0 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2109300007 Signed-off-by: Abner Chang Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Cc: Daniel Schaefer Cc: Sunil V L --- OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf | 2 +- OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf index 67531517b7..4b0dfbcb0d 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf @@ -23,7 +23,7 @@ # The following information is for reference only and not required by the build # tools. # -# VALID_ARCHITECTURES = ARM AARCH64 +# VALID_ARCHITECTURES = ARM AARCH64 RISCV64 # [Sources] diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c index e2ac4108d1..b953f2eb6c 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.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