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.6430.1614221089214693434 for ; Wed, 24 Feb 2021 18:44:49 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=fPwUb5Bu; spf=pass (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=0690489a7f=abner.chang@hpe.com) Received: from pps.filterd (m0134424.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11P2hlZM029673; Thu, 25 Feb 2021 02:44:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pps0720; bh=Xb4awWg1oEQNrxqfpIQZV7/RGgf7dz0tE9uJu6kbo/w=; b=fPwUb5Bu08KyqSa/JY2Sm68Tx4GqfkbnQGu7sGG3tYTUOo0WUrishOb98vddNMc6zBHm YTpfWVMmFtw+UzjY5fmXNgpW/HU/evnKax05X1hIuNuue7TVZ9QdWVMvkgEBPhFn1xyl btpWIwrddPorzF6HaJ6HsZjvqwizkYGBoQclPmJLURp1l/rvFtXHLMMcCSvHOn1Mnl4Q g558NvW+gsVwwVoXybcb8UmqJ+Hv2Vo434muT8b4+eGyMYldHuvlZDZkzrYupcc6IdQ3 qjE5xgFb0y+ZB+Saakn8oszMWpccOauLimYlFoj1a6R8G1m9WtGLqBFKXq7boXSsjzZi qA== Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0b-002e3701.pphosted.com with ESMTP id 36w2fyf2dk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Feb 2021 02:44:26 +0000 Received: from G1W8107.americas.hpqcorp.net (g1w8107.austin.hp.com [16.193.72.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id 630CF5A; Thu, 25 Feb 2021 02:44:24 +0000 (UTC) Received: from G9W8456.americas.hpqcorp.net (2002:10d8:a15f::10d8:a15f) by G1W8107.americas.hpqcorp.net (2002:10c1:483b::10c1:483b) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 25 Feb 2021 02:44:24 +0000 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (15.241.52.13) by G9W8456.americas.hpqcorp.net (16.216.161.95) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Thu, 25 Feb 2021 02:44:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ekoqud9qv/UNZTwOm+CMhdnBVOONE5Sio6LBgckkM4lyXpQ/yRR0PO4MLTrKadiY0l6pAloqSDsmV18lRtkzcLYdPsFrDbCcvHUZ1nAx3yALkVe6aChUR5zL4kqbS37GeZ6NuWrc5HcQJnoFdWt14leyXYGGaW+XkMeUOnxFr5SaOVMxtqq9ueCHjl3ntEn3vhzItR4WcarBI/q4jN2YTJDfSyra34/NVdJ+kTiSmAGzGDQ6+ICYr4zfnCfwf7aFsbOvoVcEEVR/2HQBQ5kCZIf6Ac57C0l7O9HLyacDpZI4m4FgihuJd18s730ZA63o8gcER5TlAtAreyKMxkSDyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V6ODL/df8lKe/6/bS0lWXb+xkqroKKgi1Ay6tFNVnVA=; b=C27N/G5t2cACQdb3qUU0w/82NqvCYRU1tlUJ5WiDYuxqZ3qxvumDygg603FH6PdhdElbGIu2ixbLFNbm0uCLBIGHYZ3n88PrBpNl4cSEbghI+Pe876L32uJXK/OfrFYZJ3fFeTCtrUnSqPHvQehGn72A2yyDWSwl9bil5XkUYXZt6jNrgjrhwFV/Xx1onPOuF3vhQCKyb6iwCDWPVmVsAg3Js0hmfvNpRGVRTMz6Zb2jQGsgZizVTB+jrJhLgIQP33zL/7nQMkgb+mT5YGyjmIg7eMhAnfuUCGncFUVnOfkM880iJjFbIG/Gm8HcPfkzFXuv0vca1BioJ3Wnr1K1Ww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hpe.com; dmarc=pass action=none header.from=hpe.com; dkim=pass header.d=hpe.com; arc=none Received: from CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM (10.169.13.16) by CS1PR8401MB1189.NAMPRD84.PROD.OUTLOOK.COM (10.169.97.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Thu, 25 Feb 2021 02:44:21 +0000 Received: from CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM ([fe80::adb6:a875:93ca:b54a]) by CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM ([fe80::adb6:a875:93ca:b54a%12]) with mapi id 15.20.3890.020; Thu, 25 Feb 2021 02:44:21 +0000 From: "Abner Chang" To: "Schaefer, Daniel" , "devel@edk2.groups.io" CC: G Edhaya Chandran , Barton Gao , Samer El-Haj-Mahmoud , Eric Jin , Arvin Chen , "Leif Lindholm" , Heinrich Schuchardt Subject: Re: [edk2-test PATCHv2 1/5] SctPkg: Add RISCV64 support by using Aarch64 sources Thread-Topic: [edk2-test PATCHv2 1/5] SctPkg: Add RISCV64 support by using Aarch64 sources Thread-Index: AQHW/vpriVW/3mr2jUKJafegSaxZoKpoQesg Date: Thu, 25 Feb 2021 02:44:21 +0000 Message-ID: References: <20210209154354.30234-1-daniel.schaefer@hpe.com> <20210209154354.30234-2-daniel.schaefer@hpe.com> In-Reply-To: <20210209154354.30234-2-daniel.schaefer@hpe.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: hpe.com; dkim=none (message not signed) header.d=none;hpe.com; dmarc=none action=none header.from=hpe.com; x-originating-ip: [16.242.247.131] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: fec7f6c5-c158-409b-3baf-08d8d9374160 x-ms-traffictypediagnostic: CS1PR8401MB1189: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LIdOV9J0xdy/xOc2/c2Mg98T9X6fC1CUz4k2sjfi1l2MWGoFwvV/uBcLlQYA8NKsXUaFo/zDly/LHqu8rrDEMays5W2oVzfEbHw25UcFktFBco0EqpZb7AFPE+4xfu/wWDdrGiM3N2W0VmUqhIwsy0suO6QmD6qzloMO2hQwBjHUudibPcMIrT6BPCht6f9EpL1fqejVPEZTKpiIvn2FovyEhXBg3QEJpPsZqiorIVv/JMKpKgMujkOyd99LwBge6rs1z5zOwh+9gig7OvOp83bX3qYRmbls82NCgz+gzHxZeLQGqnfVISnKCgoTBW1aTLx/XAi58vO4wxPTYvGNcuaZsIop4Fm0sK3okqq5qs8KnPYt0uZtzVkENW8d4Erd13i6E/BpUWGsBkM1gqB7ZkuprY7Lx3XoTsnlJxOSLfiK6L6mlu5JfoPXjCaNOzX8jlk/XWRENjRaLxaR0Zie5J05A/2G+L6ZM9oP/iQt6/Up5KEraGHf5eln03JDIBvim3MvwWTr5Y2EYh3ZvvL4UJvqFdgzoS6usTMmXZtdYCehI/5kgH3DMTJjdSqR8/vfa6sCMw/1TaJzStoTWA5J9VHySjp465+E1IlWbYJuR+0= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(376002)(366004)(186003)(83380400001)(16799955002)(4326008)(53546011)(86362001)(110136005)(966005)(478600001)(54906003)(71200400001)(30864003)(316002)(6506007)(9686003)(8676002)(76116006)(66556008)(19627235002)(33656002)(8936002)(26005)(55016002)(64756008)(66446008)(7696005)(66946007)(52536014)(5660300002)(15188155005)(2906002)(66476007)(559001)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?1Dvv2LhjeS9FAarl+cOYefPcakaS/+rzep0iNs1VNC+v+qGmlUbWYeZ4lFb9?= =?us-ascii?Q?gdbAlUz9gsI/qabXLm1kbITzg7eT/VfAE6m69d0eZ5uvTsd6UEAz+TudLFPj?= =?us-ascii?Q?qijsIFFiGZGaso7XOAiA+gyrA/sOh3eouIfpG0kGegIC5GDdpAhFCG9kGk8y?= =?us-ascii?Q?6k30cl2fSlbjMojfty3ODTz1e9lMQTEVRaUYddTaZPLWTRxJnrM/S8aCix7m?= =?us-ascii?Q?EYlOcAuSl7jVg5OgvI/Nja1hP46FyWPMmXGnJJ0LIVieiAgS5UwtfwbZkY/Y?= =?us-ascii?Q?vWBDPCz+P058YTqUzHo3CoK1BJs86u2hTcqiNYUpGwc2iqCb7W2Aun4sEpCZ?= =?us-ascii?Q?RF1OrD0BWbZ4HgsTtSybwSQpJEgxmcGUdt96ElenAl0KIRpYSLIL9oElLvq/?= =?us-ascii?Q?lD3bFOVsDaCIpSuCjKjxestdNG+XTRh8zQ05sHIQmGwxwbCfW84KA6CxGE9T?= =?us-ascii?Q?GjldZWvNnOPUqMUl807wmWhyYvdgu40drE87LB+0W4rKc9UuPNkLzz+OA2X5?= =?us-ascii?Q?ZuoCPFjxpSOycxO7lH7J98+KQUNgeEaMp6kT72+1UpcWIdI+NXxySYeigKP1?= =?us-ascii?Q?fvePL6tg+t+hZuesxQBVjYZP7sLwWMaBo2Bv+RGQM8qXet7FJd0HkZqZXJ6+?= =?us-ascii?Q?JUQnd8U7fadvfAnDHXDircI1qijZ6CQj2BllmZT8GqIMLydbGpOtZtAmFwzs?= =?us-ascii?Q?bKy5cdiC8RN9VLKKgoeBsNOcop2DOMTMOc3caxP0W7vVnBrwk0+2hmKQ3ydh?= =?us-ascii?Q?fMY/ctN3FAq59c7B4ltBdxfJisEzcwK0Y8pPpfkizDSYgmIPrUCWbeFxTUxB?= =?us-ascii?Q?mSK60is0VtE8kBRQHZSg7VKTbXi0aa1fbDnnfYJy5UlD/BRXnOeA1YzHBmf7?= =?us-ascii?Q?v2dxsvvSTPywZul29uTkGA51ZCGZWRYm2TBbJkKVMpmVjVTGzHcHpnAvzba/?= =?us-ascii?Q?+RPkPYP/shoDG5FTlRIDrQ1NJWktqncAa2oAKv5YAbxQrJOYtToMQSY2o+IE?= =?us-ascii?Q?6y+FJyupkYblUfBi5jN2eWUsjLsiOU3xqxb91dbFEdhW7HqX3cmKibvtQENM?= =?us-ascii?Q?B6jJNRAkJeee+f8JzTfhYwGa+AYPxtkkanZ7JvatXCozDulCkspjZp/Zker7?= =?us-ascii?Q?zNJ9Ql8ZugECRqI4sq0bZiK0GdkLUnV57tgb3b5QgvhPkK07m1kIdwh3kkBD?= =?us-ascii?Q?LpaWq6ggbNrgSQk+qQITZAw3FVolPcYotiSkoCAZB7tt1+v9mCZaVTFy3hLx?= =?us-ascii?Q?OzTUnoeaesHGKfVHxnQLRhruJL5976TJmGe7tmRAhRDxq1WlDdyWGX/ltQVw?= =?us-ascii?Q?Wp9ox9jkK12xVedtGTSQi1xU?= X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: fec7f6c5-c158-409b-3baf-08d8d9374160 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Feb 2021 02:44:21.4720 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: j2XCXu8Sedj+U7XTmRl0KGkEFFEOn8uBdM5a9Mf0S9psyfp03A3QxCBQfGe+7gsKSBmcoSsO+meklF5lcgJRHw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB1189 X-OriginatorOrg: hpe.com X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-02-24_13:2021-02-24,2021-02-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 priorityscore=1501 mlxscore=0 phishscore=0 bulkscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102250021 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Abner Chang > -----Original Message----- > From: Schaefer, Daniel > Sent: Tuesday, February 9, 2021 11:44 PM > To: devel@edk2.groups.io > Cc: G Edhaya Chandran ; Barton Gao > ; Samer El-Haj-Mahmoud Mahmoud@arm.com>; Eric Jin ; Arvin Chen > ; Leif Lindholm ; Heinrich > Schuchardt ; Chang, Abner (HPS SW/FW Technologist) > > Subject: [edk2-test PATCHv2 1/5] SctPkg: Add RISCV64 support by using > Aarch64 sources >=20 > The sources were copied from Aarch64. Follow-up commit will adapt them > for Riscv64. >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3042 >=20 > Cc: G Edhaya Chandran > Cc: Barton Gao > Cc: Samer El-Haj-Mahmoud > Cc: Eric Jin > Cc: Arvin Chen > Cc: Leif Lindholm > Cc: Heinrich Schuchardt > Cc: Abner Chang > Signed-off-by: Daniel Schaefer > --- > uefi-sct/SctPkg/Library/SctLib/Riscv64/SctLibPlat.h > | 32 +++ > uefi-sct/SctPkg/Library/SctLib/Riscv64/initplat.c > | 45 ++++ > uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S > | 44 ++++ > uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/VirtualMemory.c > | 182 +++++++++++++ > uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Debug.c > | 88 +++++++ > uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Dump.c > | 68 +++++ > uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.c > | 134 ++++++++++ > uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.h > | 48 ++++ > uefi- > sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64 > /DebugSupportBBTestCacheFunction.c | 137 ++++++++++ > uefi- > sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64 > /DebugSupportBBTestExceptionCallbackFunction.c | 276 > ++++++++++++++++++++ > uefi- > sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64 > /PlatformIsa.c | 30 +++ > uefi- > sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/EntsLib > Plat.h | 55 ++++ > uefi- > sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/InitPlat. > c | 55 ++++ > 13 files changed, 1194 insertions(+) >=20 > diff --git a/uefi-sct/SctPkg/Library/SctLib/Riscv64/SctLibPlat.h b/uefi- > sct/SctPkg/Library/SctLib/Riscv64/SctLibPlat.h > new file mode 100644 > index 00000000..ee7c656b > --- /dev/null > +++ b/uefi-sct/SctPkg/Library/SctLib/Riscv64/SctLibPlat.h > @@ -0,0 +1,32 @@ > +/** @file++ Copyright 2006 - 2012 Unified EFI, Inc.
+ Copyright > +(c) 2011 - 2012, ARM Ltd. All rights reserved.
++ This program and > +the accompanying materials+ are licensed and made available under the > +terms and conditions of the BSD License+ which accompanies this > +distribution. The full text of the license may be 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 > IMPLIED.+ > ++**/+/*++++Module Name:++ SctLibPlat.h++Abstract:++ AArch64 specific > +defines++--*/++#ifndef _EFI_LIB_PLAT_H_+#define > +_EFI_LIB_PLAT_H_++#define MIN_ALIGNMENT_SIZE 8++#endifdiff --git > +a/uefi-sct/SctPkg/Library/SctLib/Riscv64/initplat.c > +b/uefi-sct/SctPkg/Library/SctLib/Riscv64/initplat.c > new file mode 100644 > index 00000000..a48bb2f3 > --- /dev/null > +++ b/uefi-sct/SctPkg/Library/SctLib/Riscv64/initplat.c > @@ -0,0 +1,45 @@ > +/** @file++ Copyright 2006 - 2012 Unified EFI, Inc.
+ Copyright (c)= 2011 > - 2012, ARM Ltd. All rights reserved.
++ This program and the > accompanying materials+ are licensed and made available under the terms > and conditions of the BSD License+ which accompanies this distribution. = The > full text of the license may be 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 > IMPLIED.+ +**/+/*++++Module Name:++ initplat.c++Abstract:++ Math > routines for compatibility with native EFI library routines.++--*/++#incl= ude > "SctLibInternal.h"++VOID+InitializeLibPlatform (+ IN EFI_HANDLE > ImageHandle,+ IN EFI_SYSTEM_TABLE *SystemTable+ )++{+ // No > platform-specific initializations+}++UINT64+SctReadTsc (+ VOID+ )+{+ > return 0;+}diff --git a/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S > b/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S > new file mode 100644 > index 00000000..d223b36b > --- /dev/null > +++ b/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S > @@ -0,0 +1,44 @@ > +## @file+#+# Copyright 2010 - 2012 Unified EFI, Inc.
+# Copyright (= c) > 2012, ARM Ltd. All rights reserved.
+#+# This program and the > accompanying materials+# are licensed and made available under the terms > and conditions of the BSD License+# which accompanies this distribution. > The full text of the license may be 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 > IMPLIED.+# +##+#+#+#/*+++#+# Module Name:+#+# GoVirtual.S+#+#-- > */+#start of the code section+.text+/* FIXME: Should alignment be differe= nt > on Aarch64? */+.align 3++.global JumpToTestFunc+.type JumpToTestFunc, > %function++#-------------------------------------------------------------= --------------- > --+# VOID+# JumpToTestFunc (+# IN UINTN FuncPointer,+# IN UNITN > ConfigInfo+# )+#+JumpToTestFunc:+ mov x2, x0+ mov x0, x1++ // > Jump to Virtual function+ blr x2diff --git a/uefi- > sct/SctPkg/SCRT/SCRTApp/Riscv64/VirtualMemory.c b/uefi- > sct/SctPkg/SCRT/SCRTApp/Riscv64/VirtualMemory.c > new file mode 100644 > index 00000000..397b3514 > --- /dev/null > +++ b/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/VirtualMemory.c > @@ -0,0 +1,182 @@ > +/** @file++ Copyright 2006 - 2012 Unified EFI, Inc.
+ Copyright (c)= 2012, > ARM Ltd. All rights reserved.
++ This program and the accompanying > materials+ are licensed and made available under the terms and conditions > of the BSD License+ which accompanies this distribution. The full text = of the > license may be 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 IMPLIED.+ +**/+/*++++Module Name:++ VirtualMemory.c++-- > */++#include "SCRTApp.h"++#define VIRT_TO_PHYS_OFFSET > (0x80000000) //2G++BOOLEAN HighAddress =3D FALSE;+UINTN > PageTable =3D 0;+++VOID+ConvertRuntimeFuncPtr (+ IN OUT UINTN > *VirtualFunc+ )+/*++++Routine Description:++ Change RuntimeTestFunc > physical address to virtual address++Arguments:++ VirtualFunc - On inpu= t, > RuntimeTestFunc physical address.+ On output, RuntimeTest= virtual > address.++Returns:++ NONE++--*/+{+ /*Note: It is presumed that > on ARM v5, V6 and V7 architectures+ * the MMU is configured and > enabled in PEI phase. As VirtualFunc+ * is already mapped to virtual > memory, don't have to do anything here.+ */+ /* FIXME: Is it the same > on ARM v8? */+}+++EFI_STATUS+DoMemoryAllocation (+ IN UINTN > PhysicalFunc+ )+/*++++Routine Description:++ Allocate memory and create > the PageTable to set up physical-virtual map.++Arguments:++ PhysicalFunc= - > Physical address where RuntimeTestFunc locates.++Returns:++ > EFI_STATUS++--*/+{+ EFI_STATUS Status;+ > EFI_PHYSICAL_ADDRESS AllocateMemory;++ //create new page tables or > use existing page tables.+ //+ // Allocate PageTable memory close to th= is > Application image location in+ // the system memory. In this way, it is = safe > for page table memory.+ //+ AllocateMemory =3D PhysicalFunc;++ Status = =3D > tBS->AllocatePages (+ AllocateMaxAddress,+ > EfiRuntimeServicesData,+ 1,+ > &AllocateMemory+ );++ if (EFI_ERROR(Status)) {+ retu= rn > Status;+ }++ PageTable =3D (UINTN)AllocateMemory;+ return > EFI_SUCCESS;+}+++VOID+PrepareVirtualAddressMap (+ IN UINTN > MemoryMapSize,+ IN UINTN DescriptorSize,+ IN > EFI_MEMORY_DESCRIPTOR *MemoryMap,+ IN > EFI_MEMORY_DESCRIPTOR *VirtualMemoryMap,+ IN OUT UINTN > *VirtualMapSize+ )+/*++++Routine Description:++ Construct > VirtualAddressMap from physical address to virtual address++Arguments:++ > MemoryMapSize - The size, in bytes, of the MemoryMap buffer+ > DescriptorSize - The size, in bytes, of an individual > EFI_MEMORY_DESCRIPTOR+ MemoryMap - A pointer to the current > memory map+ VirtualMemoryMap - A pointer to the modified virtual > memory map+ VirtualMapSize - A pointer to the size, in bytes, of the > VirtualMemoryMap buffer++Returns:++ NONE++--*/+{+ UINTN Index;+ > *VirtualMapSize =3D 0;++ //+ // Copy entries that need runtime m= apping > to construct virtualMemoryMap+ //+ for (Index =3D 0; Index < > (MemoryMapSize / DescriptorSize); Index++) {+ if ((MemoryMap- > >Attribute & EFI_MEMORY_RUNTIME) =3D=3D EFI_MEMORY_RUNTIME) {+ > SctCopyMem ((VOID *) VirtualMemoryMap, (VOID *) MemoryMap, > DescriptorSize);+ VirtualMemoryMap->VirtualStart =3D VirtualMemoryM= ap- > >PhysicalStart;+ *VirtualMapSize +=3D DescriptorSize;+ > VirtualMemoryMap =3D NextMemoryDescriptor (VirtualMemoryMap, > DescriptorSize);+ }++ MemoryMap =3D NextMemoryDescriptor > (MemoryMap, DescriptorSize);+ }+}++++VOID+JumpVirtualMode(+ IN > UINTN VirtualFunc,+ IN UINTN HandOffAddr+ )+/*++++Routine > Description:++ Enable virtual addressing mode, and jump to > RuntimeTestFunc in virtual address++Arguments:++ VirtualFunc - > RuntimeTestFunc virtual address+ HandOffAddr - Configuration Data > Address++Returns:++ NONE++--*/+{+ //+ // Note: It is assumed that the > MMU and page tables are configured on ARM platforms+ // based on ARM > v5 v6 and v7 architecture.+ //+ /* FIXME: Is it the same on ARM v8? */+ > JumpToTestFunc(VirtualFunc, HandOffAddr);+}diff --git a/uefi- > sct/SctPkg/SCRT/SCRTDriver/Riscv64/Debug.c b/uefi- > sct/SctPkg/SCRT/SCRTDriver/Riscv64/Debug.c > new file mode 100644 > index 00000000..6161d596 > --- /dev/null > +++ b/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Debug.c > @@ -0,0 +1,88 @@ > +/** @file++ Copyright 2006 - 2012 Unified EFI, Inc.
+ Copyright (c)= 2011 > - 2012 ARM Ltd. All rights reserved.
++ This program and the > accompanying materials+ are licensed and made available under the terms > and conditions of the BSD License+ which accompanies this distribution. = The > full text of the license may be 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 > IMPLIED.+ +**/++/*++++Module Name:++ Debug.c++--*/++#include > "SCRTDriver.h"++UINTN mHandOffPtr =3D > 0;+EFI_PHYSICAL_ADDRESS mIoPortSpaceAddress =3D > 0;+++EFI_STATUS+ConsumeHandOff (+ IN UINTN HandOffAddr,+ OUT > CONF_INFO *ConfigData+ )+{+ RUNTIME_HANDOFF *HandOffPtr;+ //+ > // First fix the memory address of hand off data.+ //+ > FixAddress(&HandOffAddr);+ mHandOffPtr =3D HandOffAddr;+ HandOffPtr > =3D (RUNTIME_HANDOFF*)mHandOffPtr;+ *ConfigData =3D HandOffPtr- > >ConfigureInfo;++ if (!HandOffPtr->DebuggerInfo.MmioFlag){+ //+ = // If > debug port is I/O mapped, fix IoBase Address.+ //+ > FixAddress(&HandOffPtr->DebuggerInfo.IoBase);+ mIoPortSpaceAddress > =3D HandOffPtr->DebuggerInfo.IoBase;+ } else {+ //+ // If debug= port is > MMIO, fix MmioBase Address.+ //+ FixAddress(&HandOffPtr- > >DebuggerInfo.MmioBase);+ }++ return > EFI_SUCCESS;+}+++EFI_STATUS+Send2UART (+ CHAR8 *String+ = )+{+ > //+ // TODO: On ARM platforms use platform specific functions to+ // wr= ite > the data to UART.+ //+ return > EFI_SUCCESS;+}++++EFI_STATUS+DebugWorker (+ IN CHAR8 > *String+ )+{+ EFI_STATUS Status;++ //+ // Send text message to > registered UART.+ //+ Status =3D Send2UART(String);+ return Status;+}d= iff -- > git a/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Dump.c b/uefi- > sct/SctPkg/SCRT/SCRTDriver/Riscv64/Dump.c > new file mode 100644 > index 00000000..cc8d9869 > --- /dev/null > +++ b/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Dump.c > @@ -0,0 +1,68 @@ > +/** @file++ Copyright 2006 - 2012 Unified EFI, Inc.
+ Copyright (c)= 2011 > - 2012 ARM Ltd. All rights reserved.
++ This program and the > accompanying materials+ are licensed and made available under the terms > and conditions of the BSD License+ which accompanies this distribution. = The > full text of the license may be 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 > IMPLIED.+ +**/++/*++++Module Name:++ Dump.c++--*/++#include > "SCRTDriver.h"++VOID+DumpRuntimeTable()+{+ SctAPrint > ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DDump Runtime Table=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");+ > SctAPrint ("Header Signature =3D 0x%x\n", VRT->Hdr.Signature);++ SctAPri= nt > ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DGetTime Service=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");+ SctAPrint > ("GetTime @ 0x%x\n", VRT->GetTime);++ SctAPrint > ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DSetTime Service=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");+ SctAPrint > ("SetTime @ 0x%x\n", VRT->SetTime);++ SctAPrint > ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DGetWakeupTime Service= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");+ > SctAPrint ("GetWakeupTime @ 0x%x\n", VRT->GetWakeupTime);++ > SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DSetWakeupTi= me > Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");+ SctAPrint ("SetW= akeupTime @ 0x%x\n", > VRT->SetWakeupTime);++ SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3DGetVariable > Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");+ SctAPrint ("GetV= ariable @ 0x%x\n", VRT- > >GetVariable);++ SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3DGetNextVariableName > Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");+ SctAPrint ("GetN= extVariableName @ > 0x%x\n", VRT->GetNextVariableName);++ SctAPrint > ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DSetVariable Service= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");+ > SctAPrint ("SetVariable @ 0x%x\n", VRT->SetVariable);++ SctAPrint > ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DGetNextHighMonotonicC= ount > Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");+ SctAPrint ("GetN= extHighMonotonicCount @ > 0x%x\n", VRT->GetNextHighMonotonicCount);++ SctAPrint > ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DResetSystem Service= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");+ > SctAPrint ("ResetSystem @ 0x%x\n", VRT->ResetSystem);+#if 0+ SctAPrint > ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DUpdateCapsule Service= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");+ > SctAPrint ("UpdateCapsule @ 0x%x\n", VRT->UpdateCapsule);++ SctAPrint > ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DQueryCapsuleCapabilit= ies > Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");+ SctAPrint ("Quer= yCapsuleCapabilities @ > 0x%x\n", VRT->QueryCapsuleCapabilities);++ SctAPrint > ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DQueryVariableInfo Ser= vice=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");+ > SctAPrint ("QueryVariableInfo @ 0x%x\n", VRT- > >QueryVariableInfo);+#endif+}diff --git a/uefi- > sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.c b/uefi- > sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.c > new file mode 100644 > index 00000000..b925e151 > --- /dev/null > +++ b/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.c > @@ -0,0 +1,134 @@ > +/** @file++ Copyright 2006 - 2012 Unified EFI, Inc.
+ Copyright (c)= 2011 > - 2012 ARM Ltd. All rights reserved.
++ This program and the > accompanying materials+ are licensed and made available under the terms > and conditions of the BSD License+ which accompanies this distribution. = The > full text of the license may be 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 > IMPLIED.+ +**/++/*++++Module Name:++ Io.c++--*/++#include > "Io.h"++EFI_STATUS+EFIAPI+CpuIoServiceWrite (+ IN > EFI_PEI_CPU_IO_PPI_WIDTH Width,+ IN UINT64 UserAddr= ess,+ > IN UINTN Count,+ IN VOID > *UserBuffer+ )+/*++++Routine Description:++ Perform the port I/O write > service++Arguments:++ Width - Width of the port I/O operation+ Address > - Base address of the port I/O operation+ Count - Count of the number = of > accesses to perform+ Buffer - Pointer to the source buffer from which to > write data++Returns:++ EFI_SUCCESS - The data was written.+ > EFI_INVALID_PARAMETER - Width is invalid.+ EFI_INVALID_PARAMETER - > Buffer is NULL.+ EFI_UNSUPPORTED - The Buffer is not aligned for t= he > given Width.+ EFI_UNSUPPORTED - The address range specified by > Address, Width,+ and Count is not valid.++--*/+{= + return > EFI_UNSUPPORTED;+}+++EFI_STATUS+EfiIoWrite (+ IN > EFI_PEI_CPU_IO_PPI_WIDTH Width,+ IN UINT64 Addr= ess,+ IN > UINTN Count,+ IN OUT VOID > *Buffer+ )+/*++++Routine Description:+ Perform an IO write into > Buffer.++Arguments:+ Width - Width of write transaction, and repeat > operation to use+ Address - IO address to write+ Count - Number of ti= mes > to write the IO address.+ Buffer - Buffer to write data from. size is W= idth * > Count++Returns:+ Status code++--*/+{+ return CpuIoServiceWrite(Width, > Address, Count, Buffer);+}+++EFI_STATUS+EfiIoRead (+ IN > EFI_PEI_CPU_IO_PPI_WIDTH Width,+ IN UINT64 Addr= ess,+ IN > UINTN Count,+ IN OUT VOID > *Buffer+ )+/*++++Routine Description:+ Perform an IO read into > Buffer.++Arguments:+ Width - Width of read transaction, and repeat > operation to use+ Address - IO address to read+ Count - Number of tim= es > to read the IO address.+ Buffer - Buffer to read data into. size is Wid= th * > Count++Returns:+ Status code++--*/+{+ return > EFI_UNSUPPORTED;+}+++VOID+FixAddress (+ IN UINTN > *PhyAddress+ )+{+ //+ //Note: On ARM platforms > don't have to do this as all the functions are virtually mapped.+ > //+}++// Quick port to ARM++VOID+Port80 (+ UINT8 Number+ )+{+ > //EFI_SCT_DEBUG ((EFI_SCT_D_ERROR, L"Port80 %02x", Number));+}diff -- > git a/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.h b/uefi- > sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.h > new file mode 100644 > index 00000000..1e78b3e4 > --- /dev/null > +++ b/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Io.h > @@ -0,0 +1,48 @@ > +/** @file++ Copyright 2006 - 2012 Unified EFI, Inc.
+ Copyright (c)= 2011 > - 2012 ARM Ltd. All rights reserved.
++ This program and the > accompanying materials+ are licensed and made available under the terms > and conditions of the BSD License+ which accompanies this distribution. = The > full text of the license may be 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 > IMPLIED.+ +**/++/*++++Module Name:++ Debug.h++--*/++#ifndef > _IA32_IO_ACCESS_H+#define _IA32_IO_ACCESS_H++#include > "SCRTDriver.h"++#define IA32_MAX_IO_ADDRESS 0xFFFF++#define > IA32API+++typedef union {+ UINT8 VOLATILE *buf;+ UINT8 VOLATILE > *ui8;+ UINT16 VOLATILE *ui16;+ UINT32 VOLATILE *ui32;+ UINT64 > VOLATILE *ui64;+ UINTN VOLATILE ui;+} PTR;++// This address is assumi= ng > a pure PC architecture. Not required?+#define VIRT_TO_PHYS_OFFSET > (0x80000000) //2G++++#endifdiff --git a/uefi- > sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64 > /DebugSupportBBTestCacheFunction.c b/uefi- > sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64 > /DebugSupportBBTestCacheFunction.c > new file mode 100644 > index 00000000..96ee7b57 > --- /dev/null > +++ b/uefi- > sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTe > +++ st/Riscv64/DebugSupportBBTestCacheFunction.c > @@ -0,0 +1,137 @@ > +/** @file++ Copyright 2006 - 2016 Unified EFI, Inc.
+ Copyright (c)= 2011 > - 2016, ARM Ltd. All rights reserved.
++ This program and the > accompanying materials+ are licensed and made available under the terms > and conditions of the BSD License+ which accompanies this distribution. = The > full text of the license may be 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 > IMPLIED.+ +**/+/*++++Module Name:++ > DebugSupportBBTestCacheFunction.c++Abstract:++ Interface Function Test > Cases of Debug Support Protocol++--*/+++#include > "DebugSupportBBTestMain.h"++/**+ * Entrypoint for > EFI_DEBUG_SUPPORT_PROTOCOL.InvalidateInstructionCache() Function > Test.+ * @param This a pointer of EFI_BB_TEST_PROTOCOL.+ * @param > ClientInterface a pointer to the interface to be tested.+ * @param TestL= evel > test "thoroughness" control.+ * @param SupportHandle a handle containing > protocols required.+ * @return EFI_SUCCESS Finish the test successfully.+ > */+//+// TDS > 3.5+//+EFI_STATUS+BBTestInvalidateInstructionCacheFunctionAutoTest (+ > IN EFI_BB_TEST_PROTOCOL *This,+ IN VOID *Cli= entInterface,+ > IN EFI_TEST_LEVEL TestLevel,+ IN EFI_HANDLE > SupportHandle+ )+{+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL > *StandardLib;+ EFI_STATUS Status;+ > EFI_DEBUG_SUPPORT_PROTOCOL *DebugSupport;+ > EFI_TEST_ASSERTION AssertionType;+ UINT64 > Start;+ UINT64 Length;+ UINTN > MaxProcessorIndex;+ UINTN ProcessorIndex;= ++ //+ // Get > the Standard Library Interface+ //+ Status =3D gtBS->HandleProtocol (+ > SupportHandle,+ &gEfiStandardTestLibraryGuid,+ = (VOID **) > &StandardLib+ );++ if (EFI_ERROR(Status)) {+ Standa= rdLib- > >RecordAssertion (+ StandardLib,+ > EFI_TEST_ASSERTION_FAILED,+ gTestGenericFailureGuid,+ > L"BS.HandleProtocol - Handle standard test library",+ > L"%a:%d:Status - %r",+ __FILE__,+ (UI= NTN)__LINE__,+ > Status+ );+ return Status;+ }++ DebugSupport =3D > (EFI_DEBUG_SUPPORT_PROTOCOL *)ClientInterface;++ if (DebugSupport- > >Isa !=3D PlatformIsa) {+ return EFI_SUCCESS;+ }++ Status =3D DebugS= upport- > >GetMaximumProcessorIndex (DebugSupport, &MaxProcessorIndex);+ if > (EFI_ERROR(Status)) {+ StandardLib->RecordAssertion (+ > StandardLib,+ EFI_TEST_ASSERTION_FAILED,+ > gTestGenericFailureGuid,+ > L"EFI_DEBUG_SUPPORT_PROTOCOL.GetMaximumProcessorIndex",+ > L"%a:%d:Status - %r",+ __FILE__,+ (UI= NTN)__LINE__,+ > Status+ );+ return Status;+ }++ for (ProcessorInde= x =3D 0; > ProcessorIndex <=3D MaxProcessorIndex; ProcessorIndex++) {++ //+ // > Assertion Point 3.5.2.1+ // Invoke InvalidateInstructionCache and veri= fy > interface correctness.+ //++ // The Physical base of the memory ran= ge to > be invalidated.+ Start =3D 0x0;++ // The minimum number of bytes i= n the > processor's instruction cache to be invalidated.+ Length =3D 0x0;++ = Status =3D > DebugSupport->InvalidateInstructionCache (DebugSupport, ProcessorIndex, > (VOID*)&Start, Length);++ if (EFI_ERROR(Status)) {+ AssertionType= =3D > EFI_TEST_ASSERTION_FAILED;+ } else {+ AssertionType =3D > EFI_TEST_ASSERTION_PASSED;+ }++ StandardLib->RecordAssertion (+ > StandardLib,+ AssertionType,+ > gDebugSupportBBTestFunctionAssertionGuid015,+ > L"EFI_DEBUG_SUPPORT_PROTOCOL.InvalidateInstructionCache - Invoke this > function and verify interface correctness",+ L"%a:%d:Stat= us - %r",+ > __FILE__,+ (UINTN)__LINE__,+ Status+ = );+ }++ > return EFI_SUCCESS;+}+diff --git a/uefi- > sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64 > /DebugSupportBBTestExceptionCallbackFunction.c b/uefi- > sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64 > /DebugSupportBBTestExceptionCallbackFunction.c > new file mode 100644 > index 00000000..c27c0c0c > --- /dev/null > +++ b/uefi- > sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTe > +++ st/Riscv64/DebugSupportBBTestExceptionCallbackFunction.c > @@ -0,0 +1,276 @@ > +/** @file++ Copyright 2006 - 2016 Unified EFI, Inc.
+ Copyright (c)= 2011 > - 2016, ARM Ltd. All rights reserved.
++ This program and the > accompanying materials+ are licensed and made available under the terms > and conditions of the BSD License+ which accompanies this distribution. = The > full text of the license may be 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 > IMPLIED.+ +**/+/*++++Module Name:++ > DebugSupportBBExceptionCallbackFunction.c++Abstract:++ Interface > Function Test Cases of Debug Support Protocol++--*/+++#include > "DebugSupportBBTestMain.h"++extern volatile UINTN > InvokedExceptionCallback;+extern volatile UINTN > InvokedPeriodicCallback;++extern EFI_INSTRUCTION_SET_ARCHITECTURE > PlatformIsa;++void+SoftwareBreak (+ void+ )+{+ // Not ported to ARM > yet+ ASSERT (FALSE);+}++/**+ * Entrypoint for > EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback() Function > Test.+ * @param This a pointer of EFI_BB_TEST_PROTOCOL.+ * @param > ClientInterface a pointer to the interface to be tested.+ * @param TestL= evel > test "thoroughness" control.+ * @param SupportHandle a handle containing > protocols required.+ * @return EFI_SUCCESS Finish the test successfully.+ > */+//+// TDS > 3.4+//+EFI_STATUS+BBTestRegisterExceptionCallbackFunctionManualTest (+ > IN EFI_BB_TEST_PROTOCOL *This,+ IN VOID *Cli= entInterface,+ > IN EFI_TEST_LEVEL TestLevel,+ IN EFI_HANDLE > SupportHandle+ )+{+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL > *StandardLib;+ EFI_STATUS Status;+ > EFI_DEBUG_SUPPORT_PROTOCOL *DebugSupport;+ > EFI_TEST_ASSERTION AssertionType;++ DebugSupport =3D > (EFI_DEBUG_SUPPORT_PROTOCOL *)ClientInterface;++ if (DebugSupport- > >Isa !=3D PlatformIsa) {+ return EFI_SUCCESS;+ }++ //+ // Get the S= tandard > Library Interface+ //+ Status =3D gtBS->HandleProtocol (+ > SupportHandle,+ &gEfiStandardTestLibraryGuid,+ = (VOID **) > &StandardLib+ );++ if (EFI_ERROR(Status)) {+ Standa= rdLib- > >RecordAssertion (+ StandardLib,+ > EFI_TEST_ASSERTION_FAILED,+ gTestGenericFailureGuid,+ > L"BS.HandleProtocol - Handle standard test library",+ > L"%a:%d:Status - %r",+ __FILE__,+ (UI= NTN)__LINE__,+ > Status+ );+ return Status;+ }++ //+ // Assertion = Point 3.4.2.1+ // > Invoke RegisterExceptionCallback() to install an interrupt handler functi= on.+ > //+ InvokedExceptionCallback =3D FALSE;+ // FIXME: Is it normal that we= use > EXCEPT_IA32_BREAKPOINT here?+ // Shouldn't we define proper constants > for ARM exceptions in DebugSupportProtocol.h file?+ Status =3D > DebugSupport->RegisterExceptionCallback (DebugSupport, 0, > ExceptionCallback, EXCEPT_IA32_BREAKPOINT);++ if ((Status =3D=3D > EFI_SUCCESS) || (Status =3D=3D EFI_ALREADY_STARTED)) {+ AssertionType = =3D > EFI_TEST_ASSERTION_PASSED;+ } else {+ AssertionType =3D > EFI_TEST_ASSERTION_FAILED;+ }++ StandardLib->RecordAssertion (+ > StandardLib,+ AssertionType,+ > gDebugSupportBBTestFunctionAssertionGuid009,+ > L"EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback - Invoke this > function and verify interface correctness",+ L"%a:%d:Stat= us - %r",+ > __FILE__,+ (UINTN)__LINE__,+ Status+ = );++ //+ // If > the callback function is already registed, return+ //+ if (EFI_ERROR(St= atus)) > {+ return EFI_SUCCESS;+ }++ //+ // Test the callback function regis= ted.+ > //++ //+ // Call SoftwareBreak to invoke the interrupt handler function= .+ > //+ SoftwareBreak ();++ if (InvokedExceptionCallback =3D=3D FALSE) {+ > AssertionType =3D EFI_TEST_ASSERTION_FAILED;+ } else {+ AssertionType= =3D > EFI_TEST_ASSERTION_PASSED;+ }++ StandardLib->RecordAssertion (+ > StandardLib,+ AssertionType,+ > gDebugSupportBBTestFunctionAssertionGuid010,+ > L"EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback - Verify the > callback function was invoked.",+ L"%a:%d:Status - %r",+ > __FILE__,+ (UINTN)__LINE__,+ Status+ = );++ //+ // > Assertion Point 3.4.2.2+ // Invoke RegisterPeriodicCallback() to install= the > Periodic interrupt handler function.+ // Verify the two callback functio= ns can > be both invoked.+ //+ InvokedExceptionCallback =3D FALSE;+ > InvokedPeriodicCallback =3D FALSE;++ Status =3D DebugSupport- > >RegisterPeriodicCallback (DebugSupport, 0, PeriodicCallback);+ if > (EFI_ERROR(Status)) {+ return Status;+ }++ //+ // Wait the > PeriodicCallback to be invoked.+ //+ gtBS->Stall (500000);++ //+ // C= all > SoftwareBreak to invoke the interrupt handler function.+ //+ > SoftwareBreak ();++ if ((InvokedExceptionCallback =3D=3D TRUE) && > (InvokedPeriodicCallback =3D=3D TRUE)) {+ AssertionType =3D > EFI_TEST_ASSERTION_PASSED;+ } else {+ AssertionType =3D > EFI_TEST_ASSERTION_FAILED;+ }++ StandardLib->RecordAssertion (+ > StandardLib,+ AssertionType,+ > gDebugSupportBBTestFunctionAssertionGuid011,+ > L"EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback - Verify the > two callback functions can be both invoked.",+ L"%a:%d:St= atus - > %r",+ __FILE__,+ (UINTN)__LINE__,+ > Status+ );++ //+ // Uninstall the Periodic callback fun= ction.+ //+ > Status =3D DebugSupport->RegisterPeriodicCallback (DebugSupport, 0, NULL)= ;+ > if (EFI_ERROR(Status)) {+ return Status;+ }++ //+ // Assertion Point > 3.4.2.3+ // Invoke RegisterExceptionCallback() to install another interr= upt > handler function.+ //+ Status =3D DebugSupport->RegisterExceptionCallba= ck > (DebugSupport, 0, ExceptionCallback1, EXCEPT_IA32_BREAKPOINT);++ if > (Status !=3D EFI_ALREADY_STARTED) {+ AssertionType =3D > EFI_TEST_ASSERTION_FAILED;+ } else {+ AssertionType =3D > EFI_TEST_ASSERTION_PASSED;+ }++ StandardLib->RecordAssertion (+ > StandardLib,+ AssertionType,+ > gDebugSupportBBTestFunctionAssertionGuid012,+ > L"EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback - Register > another callback function.",+ L"%a:%d:Status - %r",+ > __FILE__,+ (UINTN)__LINE__,+ Status+ = );++ //+ // > Assertion Point 3.4.2.4+ // Invoke RegisterExceptionCallback() to unstal= l the > interrupt handler function.+ //+ Status =3D DebugSupport- > >RegisterExceptionCallback (DebugSupport, 0, NULL, > EXCEPT_IA32_BREAKPOINT);++ if (EFI_ERROR(Status)) {+ AssertionType =3D > EFI_TEST_ASSERTION_FAILED;+ } else {+ AssertionType =3D > EFI_TEST_ASSERTION_PASSED;+ }++ StandardLib->RecordAssertion (+ > StandardLib,+ AssertionType,+ > gDebugSupportBBTestFunctionAssertionGuid013,+ > L"EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback - Invoke this > function to uninstall the interrupt handler function",+ > L"%a:%d:Status - %r",+ __FILE__,+ (UINTN)= __LINE__,+ > Status+ );++ InvokedExceptionCallback =3D FALSE;++ //+ = // Call > SoftwareBreak to invoke the interrupt handler function.+ //+ > SoftwareBreak ();++ if (InvokedExceptionCallback !=3D FALSE) {+ > AssertionType =3D EFI_TEST_ASSERTION_FAILED;+ } else {+ AssertionType= =3D > EFI_TEST_ASSERTION_PASSED;+ }++ StandardLib->RecordAssertion (+ > StandardLib,+ AssertionType,+ > gDebugSupportBBTestFunctionAssertionGuid014,+ > L"EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback - Verify the > callback function wasn't invoked",+ L"%a:%d:Status - %r",+ > __FILE__,+ (UINTN)__LINE__,+ Status+ = );++ return > EFI_SUCCESS;+}+diff --git a/uefi- > sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64 > /PlatformIsa.c b/uefi- > sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64 > /PlatformIsa.c > new file mode 100644 > index 00000000..8334f601 > --- /dev/null > +++ b/uefi- > sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTe > +++ st/Riscv64/PlatformIsa.c > @@ -0,0 +1,30 @@ > +/** @file++ Copyright 2006 - 2012 Unified EFI, Inc.
+ Copyright > +(c) 2011 - 2012, ARM Ltd. All rights reserved.
++ This program and > +the accompanying materials+ are licensed and made available under the > +terms and conditions of the BSD License+ which accompanies this > +distribution. The full text of the license may be 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 > IMPLIED.+ > ++**/+/*++++Module Name:++ PlatformIsa.c++Abstract:++ Platform > related > +Isa definition.++--*/++#include > +"DebugSupportBBTestMain.h"++EFI_INSTRUCTION_SET_ARCHITECTURE > +PlatformIsa =3D IsaAArch64;+diff --git > +a/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/ > +EntsLibPlat.h > +b/uefi- > sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/ > +EntsLibPlat.h > new file mode 100644 > index 00000000..ff781aee > --- /dev/null > +++ b/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv > +++ 64/EntsLibPlat.h > @@ -0,0 +1,55 @@ > +/** @file++ Copyright 2006 - 2012 Unified EFI, Inc.
+ Copyright (c)= 2010 > - 2012, ARM Ltd. All rights reserved.
++ This program and the > accompanying materials+ are licensed and made available under the terms > and conditions of the BSD License+ which accompanies this distribution. = The > full text of the license may be 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 > IMPLIED.+ +**/+/*++++Module Name:++ EntsLibPlat.h++Abstract:++ > AArch64 specific defines++--*/++#ifndef _EFI_LIB_PLAT_H_+#define > _EFI_LIB_PLAT_H_++#define MIN_ALIGNMENT_SIZE > 8++VOID+EntsInitializeLibPlatform (+ IN EFI_HANDLE ImageHandle= ,+ IN > EFI_SYSTEM_TABLE *SystemTable+ )+/*++++Routine Description:++ > Initialize platform.++Arguments:++ ImageHandle - The image han= dle.+ > SystemTable - The system table.++Returns:++ None.++-- > */+;++#endifdiff --git a/uefi- > sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/InitPlat. > c b/uefi- > sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/InitPlat. > c > new file mode 100644 > index 00000000..70a509a4 > --- /dev/null > +++ b/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv > +++ 64/InitPlat.c > @@ -0,0 +1,55 @@ > +/** @file++ Copyright 2006 - 2012 Unified EFI, Inc.
+ Copyright (c)= 2010 > - 2012, ARM Ltd. All rights reserved.
++ This program and the > accompanying materials+ are licensed and made available under the terms > and conditions of the BSD License+ which accompanies this distribution. = The > full text of the license may be 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 > IMPLIED.+ +**/+/*++++Module Name:++ InitPlat.c++Abstract:++ Math > routines for compatibility with native EFI library routines.++--*/++#incl= ude > "Efi.h"+#include "EntsLibPlat.h"++VOID+EntsInitializeLibPlatform (+ IN > EFI_HANDLE ImageHandle,+ IN EFI_SYSTEM_TABLE > *SystemTable+ )+/*++++Routine Description:++ Initialize > platform.++Arguments:++ ImageHandle - The image handle.+ > SystemTable - The system table.++Returns:++ None.++--*/+{+ //= + // > No platform-specific initializations+ //+}-- > 2.30.0