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.web12.12203.1612885472637222912 for ; Tue, 09 Feb 2021 07:44:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=PeAhP/ca; spf=pass (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=0674d93a3b=daniel.schaefer@hpe.com) Received: from pps.filterd (m0134421.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 119Fc3K8010056; Tue, 9 Feb 2021 15:44:17 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 : content-type : content-transfer-encoding : mime-version; s=pps0720; bh=QQzoRuQUQJY5Z9/djxRR4/oHB+bnvZB4zfCdqLj2k1Q=; b=PeAhP/ca864osZcBHKzcCEHBQ1xUlhhmTSWLyqi3jgQdumdk6JBtR0Mxo5+GLRznJc3D QU9aqdc0MUyjBGvHW1Y5sEeTLdaoyo/R0M/7fQsv9u4yl3S958oPnWpxpo6OOY0tSjyg IRQ7bt6Ee2cewYVHacfsPdswWGn/RVdZwuX1LYcjerXegFQuK8yjzyDmW+ykW5RUMKC1 oRHsy8xYc/V0BS7FheV4fdCFVdR6+ieBEbi5w7RpwbJXtQPRCgBTnb4TkMGaeEXbSdCL Mfb2dJiCSBnj9yLib029BnO2Tna0t8rgVP5uyYt0LcFznKuaGaoOclhfcalyIW6WL8O2 ow== Received: from g2t2353.austin.hpe.com (g2t2353.austin.hpe.com [15.233.44.26]) by mx0b-002e3701.pphosted.com with ESMTP id 36kmy9v1wp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 15:44:16 +0000 Received: from G9W8453.americas.hpqcorp.net (exchangepmrr1.us.hpecorp.net [16.216.160.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2353.austin.hpe.com (Postfix) with ESMTPS id 169DC84; Tue, 9 Feb 2021 15:44:16 +0000 (UTC) Received: from G4W9119.americas.hpqcorp.net (2002:10d2:14d6::10d2:14d6) by G9W8453.americas.hpqcorp.net (2002:10d8:a0d3::10d8:a0d3) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 9 Feb 2021 15:44:15 +0000 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (15.241.52.10) by G4W9119.americas.hpqcorp.net (16.210.20.214) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Tue, 9 Feb 2021 15:44:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ps8Fr1QkpXkRI3sPwqJksyakKhnzYkVzlOJuTuO+djgdRzrLQVn76IYfwCV6V9GjdhdCPDkkfoLoNLEXCaVgwQrffXzzaLlS9AYXJFlyroXHvfaizqjC83RiTvQAc33RkJQMkTrgVTpKJntTYDdWL6jai6j7h1pxfuhUP+6kusbDnsdhLDO6KfaTJT/B1UvWeADOogxRCIB5dlFFHN2TpbkwN858O96nNZOW8uuSibrqdffj3E/FJq5gga8CWEHjctPUHiRH2d/LLgVRxJ1i1ePuf02QZ/91esdEQYqjMngOZywKypMxbEXxMhLWrf9LpYK3UzYby96LsiVqwflVnA== 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=QQzoRuQUQJY5Z9/djxRR4/oHB+bnvZB4zfCdqLj2k1Q=; b=JWRO8Hl+VX5x01s6rdvJQqnaKhz7UacBGfq3ZR6pCvD75dxLmmujwNuRXQZwwsVvchzSJKhEngO5jtqHKnqmwUzQKKJhzDNajYNu32R5VGqYZ/e08XGdHhelduOPfm17tcoSTzoxa2RLGkbm9xRUF/1I/2vxbV9mye6mHV7dYaDFXIlk3oDO4oiA5nmHTq0r5n3kHB/mOtqxcDHqQuiTcxqw/bYD1SCg8IgJgIKn59VUmrNwt7y+H+MmS3F9RPs5sdp3k0BZmOyXIy8c5JYCz6meDfyYNFH1mqp31/MWpIsczc1QaS2XTcx2JRZThRVmXNcX4xLkrn3CcVJ83C+xaQ== 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 Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=hpe.com; Received: from DF4PR8401MB0444.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760d::23) by DF4PR8401MB0508.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.20; Tue, 9 Feb 2021 15:44:13 +0000 Received: from DF4PR8401MB0444.NAMPRD84.PROD.OUTLOOK.COM ([fe80::45f0:20e7:1e33:e2a0]) by DF4PR8401MB0444.NAMPRD84.PROD.OUTLOOK.COM ([fe80::45f0:20e7:1e33:e2a0%9]) with mapi id 15.20.3825.030; Tue, 9 Feb 2021 15:44:13 +0000 From: "Daniel Schaefer" To: CC: G Edhaya Chandran , Barton Gao , Samer El-Haj-Mahmoud , Eric Jin , Arvin Chen , Leif Lindholm , Heinrich Schuchardt , Abner Chang Subject: [edk2-test PATCHv2 1/5] SctPkg: Add RISCV64 support by using Aarch64 sources Date: Tue, 9 Feb 2021 23:43:50 +0800 Message-ID: <20210209154354.30234-2-daniel.schaefer@hpe.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210209154354.30234-1-daniel.schaefer@hpe.com> References: <20210209154354.30234-1-daniel.schaefer@hpe.com> X-Originating-IP: [123.193.51.23] X-ClientProxiedBy: HK0PR03CA0116.apcprd03.prod.outlook.com (2603:1096:203:b0::32) To DF4PR8401MB0444.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760d::23) X-MS-Exchange-MessageSentRepresentingType: 1 Received: from x360-nix.hitronhub.home (123.193.51.23) by HK0PR03CA0116.apcprd03.prod.outlook.com (2603:1096:203:b0::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.23 via Frontend Transport; Tue, 9 Feb 2021 15:44:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d90dbbce-48da-45ca-9da8-08d8cd118cc9 X-MS-TrafficTypeDiagnostic: DF4PR8401MB0508: 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: CBQVJRJq9EHBthzp+VUS4XHaw8JoXutBh4wj7pm1oIeLy/ko5KYyTgQk260JBKNdlGcc1UqqY16vLGlQPGcwBecaIHPZZh4j/AwZWFIN3+U4W3HBOyR7nLKMDv3gsZnomoN7El60DKu71wG2wl1YJjlnSGZyrMViwlnOF96yZixNlZ0JZgpLjy7ILmkh5wBut0Q+s+z9IEQREViKrO4APSApuuIBaXeHC91rKmMuVC9rx1vUljIZ+S1tZ1zvxXxRDU/IOk3npEIzhiI+61toTP13j0M625EFBoYs/+KYrywRaPsUxv+Pa7s+Vd8u7uwUrTg2YPUVV59LEkytjGQ0QYISCBHidQpuMlLYeIOJtarwii2oVz9+a12hBaOm/xDQjLINKz9nFaLxaBayaIi6Pv+RJWcSDofwwMaMJj8q3Sy8y2uJHIdyINvueXj+Hwbv+mxIzaXyOm5XPStsmm6SyYzoc5RPtnqeXQBnqGOs6WTv6T3PxQqo6xuJ33dYF7vndwHG/K5RQgzv0vxckWl7lKoOgqdw3YYE+5I4obk7GBSQ8gbHe3S79i0EX1l6Pum2QbkM+3Jxu2JPXK+EdyXqDtw/mvv+X9V/Y+TfOZSNwQ0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DF4PR8401MB0444.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(396003)(136003)(366004)(346002)(376002)(39860400002)(6512007)(1076003)(66556008)(26005)(6506007)(66946007)(8936002)(30864003)(86362001)(16526019)(2906002)(4326008)(966005)(15188155005)(5660300002)(66476007)(8676002)(19627235002)(478600001)(6666004)(6916009)(44832011)(6486002)(186003)(16799955002)(2616005)(316002)(54906003)(52116002)(956004)(36756003)(83380400001)(579004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?Lz2wNEltknB4poVA1WTdHEnx654qM4LWSbPisWC6U/cUz0yi6gPj7xo0OjaG?= =?us-ascii?Q?eDdPISMgpIrOHuyJTIwPda+XaOi7ys46Gp+3mVU7jLe7J/165x8qquQ/xnDy?= =?us-ascii?Q?XQ2H7l2YiFu+ZBRtH2yDfU3m97XDLhG3whhk7T79ttK2YDo966SrKIfPX9SW?= =?us-ascii?Q?p/ot2x511QZY2iO9fz4aNBbpR1gAUc9RXtIC3CVRZ+1PX8YnIvtFIV81oiFU?= =?us-ascii?Q?Bk47/AXMQ76MA/kAYad/C51cIijiNzYsRv1re68W3z4kJN5Hwp75ADfHrabQ?= =?us-ascii?Q?iRQ3ij/Im5oNG7ps9jKPrbSYu9Aq36UR/TmQ1nRs7NJqqGWXv+Ha6MgUEWvu?= =?us-ascii?Q?mhAwlLpCm7uVb5slt/LEVRmhiLkeQm2z/cnghDo7YQ60mh7z2J8+4rrLcmXX?= =?us-ascii?Q?Ru1XTMK7KEPU7TffYeREZHJxmQPBS8G262hJtY+UGZD2b7TkQ4JmK95XN8kA?= =?us-ascii?Q?pE5VIAyGOBZ3fY6k84jCOZlPgRAO86lwdridHiqyBg79P4haiiUAk3zakly0?= =?us-ascii?Q?7jTcisCvlHlg47cuiB59jpZbhQmhGYUXzKfl9AoeSyDAGTMLbndH80tRc+J1?= =?us-ascii?Q?7GuT/Gv13SrB+0KzVFH0JkGzrJUX0V87azyQpsp8BHWra3YjXbppwbl5wyQ2?= =?us-ascii?Q?UbEMijaVd3p73QnRk3ObDx5HCFeh4CHB1cGQ59w3o0jgRkBehb8Sxsw0VMm/?= =?us-ascii?Q?l8a5m/1t1o9EaY+yHkVPXBD5tM4ORTfl6KIBbRu61C0x84k7zVPCB0nMCakO?= =?us-ascii?Q?EbbxgJlD4KIhCvo3XE4J8DcdIFNPB8CYq4P2ioajG0dveWJ2/tvzNhjpEInN?= =?us-ascii?Q?uKFvrAyLsHgRdKP45o952+JMZNG8QyvfYsLbZQDck5HSdqfBSITfIzJpwm6H?= =?us-ascii?Q?gqXiT3WhJtiQIvjjlJsgq4yi5TG6XTjn1kW3lUBGpBzdupm9fSKmZMWtwVj0?= =?us-ascii?Q?JVe+0owI0k1HvXGdG02zocDQ/cFDOQU8GWxot0x8JCyngZPCxGRyDNhJXW8Y?= =?us-ascii?Q?F1Wl50Jt1uLeuDVucB+HQRdM7SQq6b7Dk/6h9/3PXUmmyBj5rBYHj0KSiOeD?= =?us-ascii?Q?KVOyF8evD8D1XN6TTGhjfeDm26qNDXtf6KDzE7HQpTAw6gKnmxs+4msTWMRv?= =?us-ascii?Q?zZxh9QgndLuSe5lZb5Uzlu03uOuN9lISLvt5w7aXHwPWg8R2fMf/srxPpjw6?= =?us-ascii?Q?uDpHOtgQUcUYgX6xznppkth3gYB9PQhKFVG9PI8rCfgZTjz2DS7/pwoWKaB8?= =?us-ascii?Q?VCsQhEfId8uWzLIunugsbDi9MHS8F4YrVtoNJ2vIhvIRTnA9G9T5YlZQQJco?= =?us-ascii?Q?NhiBzr91mN9YKf52sCj4McEt?= X-MS-Exchange-CrossTenant-Network-Message-Id: d90dbbce-48da-45ca-9da8-08d8cd118cc9 X-MS-Exchange-CrossTenant-AuthSource: DF4PR8401MB0444.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2021 15:44:13.6924 (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: I1Q19gpltQmAeaKXgpyjF1gFWib0y/MTDTqBEbW16cJNaw3qwWYYJ3hVfWmX18qmC/PhBnAtl7N5aRUxob7Nnw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB0508 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.737 definitions=2021-02-09_03:2021-02-09,2021-02-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 mlxscore=0 priorityscore=1501 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102090081 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable The sources were copied from Aarch64. Follow-up commit will adapt them for Riscv64. REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3042 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/Riscv= 64/DebugSupportBBTestCacheFunction.c | 137 ++++++++++ uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv= 64/DebugSupportBBTestExceptionCallbackFunction.c | 276 ++++++++++++++++++++ uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv= 64/PlatformIsa.c | 30 +++ uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/EntsL= ibPlat.h | 55 ++++ uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/InitP= lat.c | 55 ++++ 13 files changed, 1194 insertions(+) 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=0D +=0D + Copyright 2006 - 2012 Unified EFI, Inc.
=0D + Copyright (c) 2011 - 2012, ARM Ltd. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at =0D + http://opensource.org/licenses/bsd-license.php=0D + =0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D + =0D +**/=0D +/*++=0D +=0D +Module Name:=0D +=0D + SctLibPlat.h=0D +=0D +Abstract:=0D +=0D + AArch64 specific defines=0D +=0D +--*/=0D +=0D +#ifndef _EFI_LIB_PLAT_H_=0D +#define _EFI_LIB_PLAT_H_=0D +=0D +#define MIN_ALIGNMENT_SIZE 8=0D +=0D +#endif=0D diff --git a/uefi-sct/SctPkg/Library/SctLib/Riscv64/initplat.c b/uefi-sct/S= ctPkg/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=0D +=0D + Copyright 2006 - 2012 Unified EFI, Inc.
=0D + Copyright (c) 2011 - 2012, ARM Ltd. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at =0D + http://opensource.org/licenses/bsd-license.php=0D + =0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D + =0D +**/=0D +/*++=0D +=0D +Module Name:=0D +=0D + initplat.c=0D +=0D +Abstract:=0D +=0D + Math routines for compatibility with native EFI library routines.=0D +=0D +--*/=0D +=0D +#include "SctLibInternal.h"=0D +=0D +VOID=0D +InitializeLibPlatform (=0D + IN EFI_HANDLE ImageHandle,=0D + IN EFI_SYSTEM_TABLE *SystemTable=0D + )=0D +=0D +{=0D + // No platform-specific initializations=0D +}=0D +=0D +UINT64=0D +SctReadTsc (=0D + VOID=0D + )=0D +{=0D + return 0;=0D +}=0D diff --git a/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S b/uefi-sct/Sc= tPkg/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=0D +#=0D +# Copyright 2010 - 2012 Unified EFI, Inc.
=0D +# Copyright (c) 2012, ARM Ltd. All rights reserved.
=0D +#=0D +# This program and the accompanying materials=0D +# are licensed and made available under the terms and conditions of the B= SD License=0D +# which accompanies this distribution. The full text of the license may = be found at =0D +# http://opensource.org/licenses/bsd-license.php=0D +# =0D +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED.=0D +# =0D +##=0D +#=0D +#=0D +#/*++=0D +#=0D +# Module Name:=0D +#=0D +# GoVirtual.S=0D +#=0D +#--*/=0D +#start of the code section=0D +.text=0D +/* FIXME: Should alignment be different on Aarch64? */=0D +.align 3=0D +=0D +.global JumpToTestFunc=0D +.type JumpToTestFunc, %function=0D +=0D +#-------------------------------------------------------------------------= -----=0D +# VOID=0D +# JumpToTestFunc (=0D +# IN UINTN FuncPointer,=0D +# IN UNITN ConfigInfo=0D +# )=0D +#=0D +JumpToTestFunc:=0D + mov x2, x0=0D + mov x0, x1=0D +=0D + // Jump to Virtual function=0D + blr x2=0D diff --git a/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/VirtualMemory.c b/uefi-sc= t/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=0D +=0D + Copyright 2006 - 2012 Unified EFI, Inc.
=0D + Copyright (c) 2012, ARM Ltd. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at =0D + http://opensource.org/licenses/bsd-license.php=0D + =0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D + =0D +**/=0D +/*++=0D +=0D +Module Name:=0D +=0D + VirtualMemory.c=0D +=0D +--*/=0D +=0D +#include "SCRTApp.h"=0D +=0D +#define VIRT_TO_PHYS_OFFSET (0x80000000) //2G=0D +=0D +BOOLEAN HighAddress =3D FALSE;=0D +UINTN PageTable =3D 0;=0D +=0D +=0D +VOID=0D +ConvertRuntimeFuncPtr (=0D + IN OUT UINTN *VirtualFunc=0D + )=0D +/*++=0D +=0D +Routine Description:=0D +=0D + Change RuntimeTestFunc physical address to virtual address=0D +=0D +Arguments:=0D +=0D + VirtualFunc - On input, RuntimeTestFunc physical address.=0D + On output, RuntimeTest virtual address.=0D +=0D +Returns:=0D +=0D + NONE=0D +=0D +--*/=0D +{=0D + /*Note: It is presumed that on ARM v5, V6 and V7 architectures=0D + * the MMU is configured and enabled in PEI phase. As VirtualFunc=0D + * is already mapped to virtual memory, don't have to do anything here.=0D + */=0D + /* FIXME: Is it the same on ARM v8? */=0D +}=0D +=0D +=0D +EFI_STATUS=0D +DoMemoryAllocation (=0D + IN UINTN PhysicalFunc=0D + )=0D +/*++=0D +=0D +Routine Description:=0D +=0D + Allocate memory and create the PageTable to set up physical-virtual map.= =0D +=0D +Arguments:=0D +=0D + PhysicalFunc - Physical address where RuntimeTestFunc locates.=0D +=0D +Returns:=0D +=0D + EFI_STATUS=0D +=0D +--*/=0D +{=0D + EFI_STATUS Status;=0D + EFI_PHYSICAL_ADDRESS AllocateMemory;=0D +=0D + //create new page tables or use existing page tables.=0D + //=0D + // Allocate PageTable memory close to this Application image location in= =0D + // the system memory. In this way, it is safe for page table memory.=0D + //=0D + AllocateMemory =3D PhysicalFunc;=0D +=0D + Status =3D tBS->AllocatePages (=0D + AllocateMaxAddress,=0D + EfiRuntimeServicesData,=0D + 1,=0D + &AllocateMemory=0D + );=0D +=0D + if (EFI_ERROR(Status)) {=0D + return Status;=0D + }=0D +=0D + PageTable =3D (UINTN)AllocateMemory;=0D + return EFI_SUCCESS;=0D +}=0D +=0D +=0D +VOID=0D +PrepareVirtualAddressMap (=0D + IN UINTN MemoryMapSize,=0D + IN UINTN DescriptorSize,=0D + IN EFI_MEMORY_DESCRIPTOR *MemoryMap,=0D + IN EFI_MEMORY_DESCRIPTOR *VirtualMemoryMap,=0D + IN OUT UINTN *VirtualMapSize=0D + )=0D +/*++=0D +=0D +Routine Description:=0D +=0D + Construct VirtualAddressMap from physical address to virtual address=0D +=0D +Arguments:=0D +=0D + MemoryMapSize - The size, in bytes, of the MemoryMap buffer=0D + DescriptorSize - The size, in bytes, of an individual EFI_MEMORY_DESC= RIPTOR=0D + MemoryMap - A pointer to the current memory map=0D + VirtualMemoryMap - A pointer to the modified virtual memory map=0D + VirtualMapSize - A pointer to the size, in bytes, of the VirtualMemor= yMap buffer=0D +=0D +Returns:=0D +=0D + NONE=0D +=0D +--*/=0D +{=0D + UINTN Index;=0D + *VirtualMapSize =3D 0;=0D +=0D + //=0D + // Copy entries that need runtime mapping to construct virtualMemoryMap= =0D + //=0D + for (Index =3D 0; Index < (MemoryMapSize / DescriptorSize); Index++) {=0D + if ((MemoryMap->Attribute & EFI_MEMORY_RUNTIME) =3D=3D EFI_MEMORY_RUNT= IME) {=0D + SctCopyMem ((VOID *) VirtualMemoryMap, (VOID *) MemoryMap, Descripto= rSize);=0D + VirtualMemoryMap->VirtualStart =3D VirtualMemoryMap->PhysicalStart;= =0D + *VirtualMapSize +=3D DescriptorSize;=0D + VirtualMemoryMap =3D NextMemoryDescriptor (VirtualMemoryMap, Descrip= torSize);=0D + }=0D +=0D + MemoryMap =3D NextMemoryDescriptor (MemoryMap, DescriptorSize);=0D + }=0D +}=0D +=0D +=0D +=0D +VOID=0D +JumpVirtualMode(=0D + IN UINTN VirtualFunc,=0D + IN UINTN HandOffAddr=0D + )=0D +/*++=0D +=0D +Routine Description:=0D +=0D + Enable virtual addressing mode, and jump to RuntimeTestFunc in virtual a= ddress=0D +=0D +Arguments:=0D +=0D + VirtualFunc - RuntimeTestFunc virtual address=0D + HandOffAddr - Configuration Data Address=0D +=0D +Returns:=0D +=0D + NONE=0D +=0D +--*/=0D +{=0D + //=0D + // Note: It is assumed that the MMU and page tables are configured on AR= M platforms=0D + // based on ARM v5 v6 and v7 architecture.=0D + //=0D + /* FIXME: Is it the same on ARM v8? */=0D + JumpToTestFunc(VirtualFunc, HandOffAddr);=0D +}=0D diff --git a/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Debug.c b/uefi-sct/Sct= Pkg/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=0D +=0D + Copyright 2006 - 2012 Unified EFI, Inc.
=0D + Copyright (c) 2011 - 2012 ARM Ltd. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at =0D + http://opensource.org/licenses/bsd-license.php=0D + =0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D + =0D +**/=0D +=0D +/*++=0D +=0D +Module Name:=0D +=0D + Debug.c=0D +=0D +--*/=0D +=0D +#include "SCRTDriver.h"=0D +=0D +UINTN mHandOffPtr =3D 0;=0D +EFI_PHYSICAL_ADDRESS mIoPortSpaceAddress =3D 0;=0D +=0D +=0D +EFI_STATUS=0D +ConsumeHandOff (=0D + IN UINTN HandOffAddr,=0D + OUT CONF_INFO *ConfigData=0D + )=0D +{=0D + RUNTIME_HANDOFF *HandOffPtr;=0D + //=0D + // First fix the memory address of hand off data.=0D + //=0D + FixAddress(&HandOffAddr);=0D + mHandOffPtr =3D HandOffAddr;=0D + HandOffPtr =3D (RUNTIME_HANDOFF*)mHandOffPtr;=0D + *ConfigData =3D HandOffPtr->ConfigureInfo;=0D +=0D + if (!HandOffPtr->DebuggerInfo.MmioFlag){=0D + //=0D + // If debug port is I/O mapped, fix IoBase Address.=0D + //=0D + FixAddress(&HandOffPtr->DebuggerInfo.IoBase);=0D + mIoPortSpaceAddress =3D HandOffPtr->DebuggerInfo.IoBase;=0D + } else {=0D + //=0D + // If debug port is MMIO, fix MmioBase Address.=0D + //=0D + FixAddress(&HandOffPtr->DebuggerInfo.MmioBase);=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +=0D +EFI_STATUS=0D +Send2UART (=0D + CHAR8 *String=0D + )=0D +{=0D + //=0D + // TODO: On ARM platforms use platform specific functions to=0D + // write the data to UART.=0D + //=0D + return EFI_SUCCESS;=0D +}=0D +=0D +=0D +=0D +EFI_STATUS=0D +DebugWorker (=0D + IN CHAR8 *String=0D + )=0D +{=0D + EFI_STATUS Status;=0D +=0D + //=0D + // Send text message to registered UART.=0D + //=0D + Status =3D Send2UART(String);=0D + return Status;=0D +}=0D diff --git a/uefi-sct/SctPkg/SCRT/SCRTDriver/Riscv64/Dump.c b/uefi-sct/SctP= kg/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=0D +=0D + Copyright 2006 - 2012 Unified EFI, Inc.
=0D + Copyright (c) 2011 - 2012 ARM Ltd. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at =0D + http://opensource.org/licenses/bsd-license.php=0D + =0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D + =0D +**/=0D +=0D +/*++=0D +=0D +Module Name:=0D +=0D + Dump.c=0D +=0D +--*/=0D +=0D +#include "SCRTDriver.h"=0D +=0D +VOID=0D +DumpRuntimeTable()=0D +{=0D + SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DDump Runti= me Table=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");=0D + SctAPrint ("Header Signature =3D 0x%x\n", VRT->Hdr.Signature);=0D +=0D + SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DGetTime Se= rvice=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");=0D + SctAPrint ("GetTime @ 0x%x\n", VRT->GetTime);=0D +=0D + SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DSetTime Se= rvice=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");=0D + SctAPrint ("SetTime @ 0x%x\n", VRT->SetTime);=0D +=0D + SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DGetWakeupT= ime Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");=0D + SctAPrint ("GetWakeupTime @ 0x%x\n", VRT->GetWakeupTime);=0D +=0D + SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DSetWakeupT= ime Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");=0D + SctAPrint ("SetWakeupTime @ 0x%x\n", VRT->SetWakeupTime);=0D +=0D + SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DGetVariabl= e Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");=0D + SctAPrint ("GetVariable @ 0x%x\n", VRT->GetVariable);=0D +=0D + SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DGetNextVar= iableName Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");=0D + SctAPrint ("GetNextVariableName @ 0x%x\n", VRT->GetNextVariableName);=0D +=0D + SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DSetVariabl= e Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");=0D + SctAPrint ("SetVariable @ 0x%x\n", VRT->SetVariable);=0D +=0D + SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DGetNextHig= hMonotonicCount Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");=0D + SctAPrint ("GetNextHighMonotonicCount @ 0x%x\n", VRT->GetNextHighMonoton= icCount);=0D +=0D + SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DResetSyste= m Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");=0D + SctAPrint ("ResetSystem @ 0x%x\n", VRT->ResetSystem);=0D +#if 0=0D + SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DUpdateCaps= ule Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");=0D + SctAPrint ("UpdateCapsule @ 0x%x\n", VRT->UpdateCapsule);=0D +=0D + SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DQueryCapsu= leCapabilities Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");=0D + SctAPrint ("QueryCapsuleCapabilities @ 0x%x\n", VRT->QueryCapsuleCapabil= ities);=0D +=0D + SctAPrint ("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DQueryVaria= bleInfo Service=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n");=0D + SctAPrint ("QueryVariableInfo @ 0x%x\n", VRT->QueryVariableInfo);=0D +#endif=0D +}=0D 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=0D +=0D + Copyright 2006 - 2012 Unified EFI, Inc.
=0D + Copyright (c) 2011 - 2012 ARM Ltd. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at =0D + http://opensource.org/licenses/bsd-license.php=0D + =0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D + =0D +**/=0D +=0D +/*++=0D +=0D +Module Name:=0D +=0D + Io.c=0D +=0D +--*/=0D +=0D +#include "Io.h"=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +CpuIoServiceWrite (=0D + IN EFI_PEI_CPU_IO_PPI_WIDTH Width,=0D + IN UINT64 UserAddress,=0D + IN UINTN Count,=0D + IN VOID *UserBuffer=0D + )=0D +/*++=0D +=0D +Routine Description:=0D +=0D + Perform the port I/O write service=0D +=0D +Arguments:=0D +=0D + Width - Width of the port I/O operation=0D + Address - Base address of the port I/O operation=0D + Count - Count of the number of accesses to perform=0D + Buffer - Pointer to the source buffer from which to write data=0D +=0D +Returns:=0D +=0D + EFI_SUCCESS - The data was written.=0D + EFI_INVALID_PARAMETER - Width is invalid.=0D + EFI_INVALID_PARAMETER - Buffer is NULL.=0D + EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.=0D + EFI_UNSUPPORTED - The address range specified by Address, Width,=0D + and Count is not valid.=0D +=0D +--*/=0D +{=0D + return EFI_UNSUPPORTED;=0D +}=0D +=0D +=0D +EFI_STATUS=0D +EfiIoWrite (=0D + IN EFI_PEI_CPU_IO_PPI_WIDTH Width,=0D + IN UINT64 Address,=0D + IN UINTN Count,=0D + IN OUT VOID *Buffer=0D + )=0D +/*++=0D +=0D +Routine Description:=0D + Perform an IO write into Buffer.=0D +=0D +Arguments:=0D + Width - Width of write transaction, and repeat operation to use=0D + Address - IO address to write=0D + Count - Number of times to write the IO address.=0D + Buffer - Buffer to write data from. size is Width * Count=0D +=0D +Returns:=0D + Status code=0D +=0D +--*/=0D +{=0D + return CpuIoServiceWrite(Width, Address, Count, Buffer);=0D +}=0D +=0D +=0D +EFI_STATUS=0D +EfiIoRead (=0D + IN EFI_PEI_CPU_IO_PPI_WIDTH Width,=0D + IN UINT64 Address,=0D + IN UINTN Count,=0D + IN OUT VOID *Buffer=0D + )=0D +/*++=0D +=0D +Routine Description:=0D + Perform an IO read into Buffer.=0D +=0D +Arguments:=0D + Width - Width of read transaction, and repeat operation to use=0D + Address - IO address to read=0D + Count - Number of times to read the IO address.=0D + Buffer - Buffer to read data into. size is Width * Count=0D +=0D +Returns:=0D + Status code=0D +=0D +--*/=0D +{=0D + return EFI_UNSUPPORTED;=0D +}=0D +=0D +=0D +VOID=0D +FixAddress (=0D + IN UINTN *PhyAddress=0D + )=0D +{=0D + //=0D + //Note: On ARM platforms don't have to do this as all the functions are = virtually mapped.=0D + //=0D +}=0D +=0D +// Quick port to ARM=0D +=0D +VOID=0D +Port80 (=0D + UINT8 Number=0D + )=0D +{=0D + //EFI_SCT_DEBUG ((EFI_SCT_D_ERROR, L"Port80 %02x", Number));=0D +}=0D 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=0D +=0D + Copyright 2006 - 2012 Unified EFI, Inc.
=0D + Copyright (c) 2011 - 2012 ARM Ltd. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at =0D + http://opensource.org/licenses/bsd-license.php=0D + =0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D + =0D +**/=0D +=0D +/*++=0D +=0D +Module Name:=0D +=0D + Debug.h=0D +=0D +--*/=0D +=0D +#ifndef _IA32_IO_ACCESS_H=0D +#define _IA32_IO_ACCESS_H=0D +=0D +#include "SCRTDriver.h"=0D +=0D +#define IA32_MAX_IO_ADDRESS 0xFFFF=0D +=0D +#define IA32API=0D +=0D +=0D +typedef union {=0D + UINT8 VOLATILE *buf;=0D + UINT8 VOLATILE *ui8;=0D + UINT16 VOLATILE *ui16;=0D + UINT32 VOLATILE *ui32;=0D + UINT64 VOLATILE *ui64;=0D + UINTN VOLATILE ui;=0D +} PTR;=0D +=0D +// This address is assuming a pure PC architecture. Not required?=0D +#define VIRT_TO_PHYS_OFFSET (0x80000000) //2G=0D +=0D +=0D +=0D +#endif=0D diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackB= oxTest/Riscv64/DebugSupportBBTestCacheFunction.c b/uefi-sct/SctPkg/TestCase= /UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/DebugSupportBBTestCach= eFunction.c new file mode 100644 index 00000000..96ee7b57 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/= Riscv64/DebugSupportBBTestCacheFunction.c @@ -0,0 +1,137 @@ +/** @file=0D +=0D + Copyright 2006 - 2016 Unified EFI, Inc.
=0D + Copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at =0D + http://opensource.org/licenses/bsd-license.php=0D + =0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D + =0D +**/=0D +/*++=0D +=0D +Module Name:=0D +=0D + DebugSupportBBTestCacheFunction.c=0D +=0D +Abstract:=0D +=0D + Interface Function Test Cases of Debug Support Protocol=0D +=0D +--*/=0D +=0D +=0D +#include "DebugSupportBBTestMain.h"=0D +=0D +/**=0D + * Entrypoint for EFI_DEBUG_SUPPORT_PROTOCOL.InvalidateInstructionCache()= Function Test.=0D + * @param This a pointer of EFI_BB_TEST_PROTOCOL.=0D + * @param ClientInterface a pointer to the interface to be tested.=0D + * @param TestLevel test "thoroughness" control.=0D + * @param SupportHandle a handle containing protocols required.=0D + * @return EFI_SUCCESS Finish the test successfully.=0D + */=0D +//=0D +// TDS 3.5=0D +//=0D +EFI_STATUS=0D +BBTestInvalidateInstructionCacheFunctionAutoTest (=0D + IN EFI_BB_TEST_PROTOCOL *This,=0D + IN VOID *ClientInterface,=0D + IN EFI_TEST_LEVEL TestLevel,=0D + IN EFI_HANDLE SupportHandle=0D + )=0D +{=0D + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;=0D + EFI_STATUS Status;=0D + EFI_DEBUG_SUPPORT_PROTOCOL *DebugSupport;=0D + EFI_TEST_ASSERTION AssertionType;=0D + UINT64 Start;=0D + UINT64 Length;=0D + UINTN MaxProcessorIndex;=0D + UINTN ProcessorIndex;=0D +=0D + //=0D + // Get the Standard Library Interface=0D + //=0D + Status =3D gtBS->HandleProtocol (=0D + SupportHandle,=0D + &gEfiStandardTestLibraryGuid,=0D + (VOID **) &StandardLib=0D + );=0D +=0D + if (EFI_ERROR(Status)) {=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + EFI_TEST_ASSERTION_FAILED,=0D + gTestGenericFailureGuid,=0D + L"BS.HandleProtocol - Handle standard test library",=0D + L"%a:%d:Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D + return Status;=0D + }=0D +=0D + DebugSupport =3D (EFI_DEBUG_SUPPORT_PROTOCOL *)ClientInterface;=0D +=0D + if (DebugSupport->Isa !=3D PlatformIsa) {=0D + return EFI_SUCCESS;=0D + }=0D +=0D + Status =3D DebugSupport->GetMaximumProcessorIndex (DebugSupport, &MaxPro= cessorIndex);=0D + if (EFI_ERROR(Status)) {=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + EFI_TEST_ASSERTION_FAILED,=0D + gTestGenericFailureGuid,=0D + L"EFI_DEBUG_SUPPORT_PROTOCOL.GetMaximumProcessorIndex",= =0D + L"%a:%d:Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D + return Status;=0D + }=0D +=0D + for (ProcessorIndex =3D 0; ProcessorIndex <=3D MaxProcessorIndex; Proces= sorIndex++) {=0D +=0D + //=0D + // Assertion Point 3.5.2.1=0D + // Invoke InvalidateInstructionCache and verify interface correctness.= =0D + //=0D +=0D + // The Physical base of the memory range to be invalidated.=0D + Start =3D 0x0;=0D +=0D + // The minimum number of bytes in the processor's instruction cache to= be invalidated.=0D + Length =3D 0x0;=0D +=0D + Status =3D DebugSupport->InvalidateInstructionCache (DebugSupport, Pro= cessorIndex, (VOID*)&Start, Length);=0D +=0D + if (EFI_ERROR(Status)) {=0D + AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D + } else {=0D + AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D + }=0D +=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + AssertionType,=0D + gDebugSupportBBTestFunctionAssertionGuid015,=0D + L"EFI_DEBUG_SUPPORT_PROTOCOL.InvalidateInstructionCache -= Invoke this function and verify interface correctness",=0D + L"%a:%d:Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackB= oxTest/Riscv64/DebugSupportBBTestExceptionCallbackFunction.c b/uefi-sct/Sct= Pkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/Riscv64/DebugSuppo= rtBBTestExceptionCallbackFunction.c new file mode 100644 index 00000000..c27c0c0c --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/= Riscv64/DebugSupportBBTestExceptionCallbackFunction.c @@ -0,0 +1,276 @@ +/** @file=0D +=0D + Copyright 2006 - 2016 Unified EFI, Inc.
=0D + Copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at =0D + http://opensource.org/licenses/bsd-license.php=0D + =0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D + =0D +**/=0D +/*++=0D +=0D +Module Name:=0D +=0D + DebugSupportBBExceptionCallbackFunction.c=0D +=0D +Abstract:=0D +=0D + Interface Function Test Cases of Debug Support Protocol=0D +=0D +--*/=0D +=0D +=0D +#include "DebugSupportBBTestMain.h"=0D +=0D +extern volatile UINTN InvokedExceptionCallback;=0D +extern volatile UINTN InvokedPeriodicCallback;=0D +=0D +extern EFI_INSTRUCTION_SET_ARCHITECTURE PlatformIsa;=0D +=0D +void=0D +SoftwareBreak (=0D + void=0D + )=0D +{=0D + // Not ported to ARM yet=0D + ASSERT (FALSE);=0D +}=0D +=0D +/**=0D + * Entrypoint for EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback() = Function Test.=0D + * @param This a pointer of EFI_BB_TEST_PROTOCOL.=0D + * @param ClientInterface a pointer to the interface to be tested.=0D + * @param TestLevel test "thoroughness" control.=0D + * @param SupportHandle a handle containing protocols required.=0D + * @return EFI_SUCCESS Finish the test successfully.=0D + */=0D +//=0D +// TDS 3.4=0D +//=0D +EFI_STATUS=0D +BBTestRegisterExceptionCallbackFunctionManualTest (=0D + IN EFI_BB_TEST_PROTOCOL *This,=0D + IN VOID *ClientInterface,=0D + IN EFI_TEST_LEVEL TestLevel,=0D + IN EFI_HANDLE SupportHandle=0D + )=0D +{=0D + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;=0D + EFI_STATUS Status;=0D + EFI_DEBUG_SUPPORT_PROTOCOL *DebugSupport;=0D + EFI_TEST_ASSERTION AssertionType;=0D +=0D + DebugSupport =3D (EFI_DEBUG_SUPPORT_PROTOCOL *)ClientInterface;=0D +=0D + if (DebugSupport->Isa !=3D PlatformIsa) {=0D + return EFI_SUCCESS;=0D + }=0D +=0D + //=0D + // Get the Standard Library Interface=0D + //=0D + Status =3D gtBS->HandleProtocol (=0D + SupportHandle,=0D + &gEfiStandardTestLibraryGuid,=0D + (VOID **) &StandardLib=0D + );=0D +=0D + if (EFI_ERROR(Status)) {=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + EFI_TEST_ASSERTION_FAILED,=0D + gTestGenericFailureGuid,=0D + L"BS.HandleProtocol - Handle standard test library",=0D + L"%a:%d:Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D + return Status;=0D + }=0D +=0D + //=0D + // Assertion Point 3.4.2.1=0D + // Invoke RegisterExceptionCallback() to install an interrupt handler fu= nction.=0D + //=0D + InvokedExceptionCallback =3D FALSE;=0D + // FIXME: Is it normal that we use EXCEPT_IA32_BREAKPOINT here?=0D + // Shouldn't we define proper constants for ARM exceptions in DebugSuppo= rtProtocol.h file?=0D + Status =3D DebugSupport->RegisterExceptionCallback (DebugSupport, 0, Exc= eptionCallback, EXCEPT_IA32_BREAKPOINT);=0D +=0D + if ((Status =3D=3D EFI_SUCCESS) || (Status =3D=3D EFI_ALREADY_STARTED)) = {=0D + AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D + } else {=0D + AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D + }=0D +=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + AssertionType,=0D + gDebugSupportBBTestFunctionAssertionGuid009,=0D + L"EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback - = Invoke this function and verify interface correctness",=0D + L"%a:%d:Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D +=0D + //=0D + // If the callback function is already registed, return=0D + //=0D + if (EFI_ERROR(Status)) {=0D + return EFI_SUCCESS;=0D + }=0D +=0D + //=0D + // Test the callback function registed.=0D + //=0D +=0D + //=0D + // Call SoftwareBreak to invoke the interrupt handler function.=0D + //=0D + SoftwareBreak ();=0D +=0D + if (InvokedExceptionCallback =3D=3D FALSE) {=0D + AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D + } else {=0D + AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D + }=0D +=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + AssertionType,=0D + gDebugSupportBBTestFunctionAssertionGuid010,=0D + L"EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback - = Verify the callback function was invoked.",=0D + L"%a:%d:Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D +=0D + //=0D + // Assertion Point 3.4.2.2=0D + // Invoke RegisterPeriodicCallback() to install the Periodic interrupt h= andler function.=0D + // Verify the two callback functions can be both invoked.=0D + //=0D + InvokedExceptionCallback =3D FALSE;=0D + InvokedPeriodicCallback =3D FALSE;=0D +=0D + Status =3D DebugSupport->RegisterPeriodicCallback (DebugSupport, 0, Peri= odicCallback);=0D + if (EFI_ERROR(Status)) {=0D + return Status;=0D + }=0D +=0D + //=0D + // Wait the PeriodicCallback to be invoked.=0D + //=0D + gtBS->Stall (500000);=0D +=0D + //=0D + // Call SoftwareBreak to invoke the interrupt handler function.=0D + //=0D + SoftwareBreak ();=0D +=0D + if ((InvokedExceptionCallback =3D=3D TRUE) && (InvokedPeriodicCallback = =3D=3D TRUE)) {=0D + AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D + } else {=0D + AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D + }=0D +=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + AssertionType,=0D + gDebugSupportBBTestFunctionAssertionGuid011,=0D + L"EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback - = Verify the two callback functions can be both invoked.",=0D + L"%a:%d:Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D +=0D + //=0D + // Uninstall the Periodic callback function.=0D + //=0D + Status =3D DebugSupport->RegisterPeriodicCallback (DebugSupport, 0, NULL= );=0D + if (EFI_ERROR(Status)) {=0D + return Status;=0D + }=0D +=0D + //=0D + // Assertion Point 3.4.2.3=0D + // Invoke RegisterExceptionCallback() to install another interrupt handl= er function.=0D + //=0D + Status =3D DebugSupport->RegisterExceptionCallback (DebugSupport, 0, Exc= eptionCallback1, EXCEPT_IA32_BREAKPOINT);=0D +=0D + if (Status !=3D EFI_ALREADY_STARTED) {=0D + AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D + } else {=0D + AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D + }=0D +=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + AssertionType,=0D + gDebugSupportBBTestFunctionAssertionGuid012,=0D + L"EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback - = Register another callback function.",=0D + L"%a:%d:Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D +=0D + //=0D + // Assertion Point 3.4.2.4=0D + // Invoke RegisterExceptionCallback() to unstall the interrupt handler f= unction.=0D + //=0D + Status =3D DebugSupport->RegisterExceptionCallback (DebugSupport, 0, NUL= L, EXCEPT_IA32_BREAKPOINT);=0D +=0D + if (EFI_ERROR(Status)) {=0D + AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D + } else {=0D + AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D + }=0D +=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + AssertionType,=0D + gDebugSupportBBTestFunctionAssertionGuid013,=0D + L"EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback - = Invoke this function to uninstall the interrupt handler function",=0D + L"%a:%d:Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D +=0D + InvokedExceptionCallback =3D FALSE;=0D +=0D + //=0D + // Call SoftwareBreak to invoke the interrupt handler function.=0D + //=0D + SoftwareBreak ();=0D +=0D + if (InvokedExceptionCallback !=3D FALSE) {=0D + AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D + } else {=0D + AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D + }=0D +=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + AssertionType,=0D + gDebugSupportBBTestFunctionAssertionGuid014,=0D + L"EFI_DEBUG_SUPPORT_PROTOCOL.RegisterExceptionCallback - = Verify the callback function wasn't invoked",=0D + L"%a:%d:Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackB= oxTest/Riscv64/PlatformIsa.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/D= ebugSupport/BlackBoxTest/Riscv64/PlatformIsa.c new file mode 100644 index 00000000..8334f601 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DebugSupport/BlackBoxTest/= Riscv64/PlatformIsa.c @@ -0,0 +1,30 @@ +/** @file=0D +=0D + Copyright 2006 - 2012 Unified EFI, Inc.
=0D + Copyright (c) 2011 - 2012, ARM Ltd. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at =0D + http://opensource.org/licenses/bsd-license.php=0D + =0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D + =0D +**/=0D +/*++=0D +=0D +Module Name:=0D +=0D + PlatformIsa.c=0D +=0D +Abstract:=0D +=0D + Platform related Isa definition.=0D +=0D +--*/=0D +=0D +#include "DebugSupportBBTestMain.h"=0D +=0D +EFI_INSTRUCTION_SET_ARCHITECTURE PlatformIsa =3D IsaAArch64;=0D +=0D diff --git a/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/R= iscv64/EntsLibPlat.h b/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENT= S/EasLib/Riscv64/EntsLibPlat.h new file mode 100644 index 00000000..ff781aee --- /dev/null +++ b/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/= EntsLibPlat.h @@ -0,0 +1,55 @@ +/** @file=0D +=0D + Copyright 2006 - 2012 Unified EFI, Inc.
=0D + Copyright (c) 2010 - 2012, ARM Ltd. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at =0D + http://opensource.org/licenses/bsd-license.php=0D + =0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D + =0D +**/=0D +/*++=0D +=0D +Module Name:=0D +=0D + EntsLibPlat.h=0D +=0D +Abstract:=0D +=0D + AArch64 specific defines=0D +=0D +--*/=0D +=0D +#ifndef _EFI_LIB_PLAT_H_=0D +#define _EFI_LIB_PLAT_H_=0D +=0D +#define MIN_ALIGNMENT_SIZE 8=0D +=0D +VOID=0D +EntsInitializeLibPlatform (=0D + IN EFI_HANDLE ImageHandle,=0D + IN EFI_SYSTEM_TABLE *SystemTable=0D + )=0D +/*++=0D +=0D +Routine Description:=0D +=0D + Initialize platform.=0D +=0D +Arguments:=0D +=0D + ImageHandle - The image handle.=0D + SystemTable - The system table.=0D +=0D +Returns:=0D +=0D + None.=0D +=0D +--*/=0D +;=0D +=0D +#endif=0D diff --git a/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/R= iscv64/InitPlat.c b/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/E= asLib/Riscv64/InitPlat.c new file mode 100644 index 00000000..70a509a4 --- /dev/null +++ b/uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/= InitPlat.c @@ -0,0 +1,55 @@ +/** @file=0D +=0D + Copyright 2006 - 2012 Unified EFI, Inc.
=0D + Copyright (c) 2010 - 2012, ARM Ltd. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at =0D + http://opensource.org/licenses/bsd-license.php=0D + =0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D + =0D +**/=0D +/*++=0D +=0D +Module Name:=0D +=0D + InitPlat.c=0D +=0D +Abstract:=0D +=0D + Math routines for compatibility with native EFI library routines.=0D +=0D +--*/=0D +=0D +#include "Efi.h"=0D +#include "EntsLibPlat.h"=0D +=0D +VOID=0D +EntsInitializeLibPlatform (=0D + IN EFI_HANDLE ImageHandle,=0D + IN EFI_SYSTEM_TABLE *SystemTable=0D + )=0D +/*++=0D +=0D +Routine Description:=0D +=0D + Initialize platform.=0D +=0D +Arguments:=0D +=0D + ImageHandle - The image handle.=0D + SystemTable - The system table.=0D +=0D +Returns:=0D +=0D + None.=0D +=0D +--*/=0D +{=0D + //=0D + // No platform-specific initializations=0D + //=0D +}=0D --=20 2.30.0