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.web09.36376.1612796989321622987 for ; Mon, 08 Feb 2021 07:09:49 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=BfZzWZZz; spf=pass (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=0673351e1b=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 118F853K030663; Mon, 8 Feb 2021 15:09:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pps0720; bh=5BoZRVdwEMZBsWyaVplRL+mhbQX1EPNM7jZ7RXaqTpM=; b=BfZzWZZzU3GFFNSRHmAGM5xxDEVNRt3who5atMELv1MGDN5cjccn2s9qhfOCMhxSKoeJ 5yjcKE+D4nHxxbEuVcuDSB+SY5fWCvBsVXqR/CG7nfL0Onb9qeroDSfcDNxz2lXdTi4h NG+AQMHe6MbhUCSzS5iG9ZJxCdWPA4fTkmCZ487VWZaektNQtDs4PUOoOCwo/gh7wk5m ASc/mafH9TCrSvUA+zgWB2iFu9eAsc+s/LhFpuw4eJtpcVjM5LGe9hQqArwDbvw2wa1W WWdrKQSUDAJuEVC5y4s805xCZPXGJFB5FySIT6mVnsZFrVnPsKO0YXWCN9jUjSRHQ/7f VQ== Received: from g9t5008.houston.hpe.com (g9t5008.houston.hpe.com [15.241.48.72]) by mx0b-002e3701.pphosted.com with ESMTP id 36k4ks1qxu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Feb 2021 15:09:23 +0000 Received: from G1W8106.americas.hpqcorp.net (g1w8106.austin.hp.com [16.193.72.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g9t5008.houston.hpe.com (Postfix) with ESMTPS id E48D457; Mon, 8 Feb 2021 15:09:22 +0000 (UTC) Received: from G4W9336.americas.hpqcorp.net (16.208.33.86) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 8 Feb 2021 15:09:22 +0000 Received: from G9W9210.americas.hpqcorp.net (2002:10dc:429b::10dc:429b) by G4W9336.americas.hpqcorp.net (2002:10d0:2156::10d0:2156) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 8 Feb 2021 15:09:21 +0000 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (15.241.52.11) by G9W9210.americas.hpqcorp.net (16.220.66.155) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 8 Feb 2021 15:09:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NZU+ILKJfCMhMLpSmrjLM/8FXC2iTMDwLNZqa3xTkG5VUIEDiOG/AZup/iXxlUYz/7VoLLIeEetp0guWAHuPqE0KT385EiMT/c54O/AZAznEj//4GbYxmzC6j4OkXSzQI7AULDFQmECyU0Hica2jEK919DcAWShALvTZcvI6gz6RqLlKjlhXwXTg8OoFLcJpUY1X9sFfHQhvu5b8XCxlDSgqHKVjLMZM8yjaPc2g5P5QF8mGgtwXuAjhyhUWC+MrpvpJWEBxzxd+NGrwTyk4mBhkh9m3I9JpE0636Xsshscove0LOp3hcM9oZ1wSE84NitFIVPGWSfLrJS5/xkOrXQ== 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=xCZAc2OLFuyPDu4w1OYsMTVDauuyrdqYmL2ibcwbM4U=; b=baFac08/IAci4eCBRzpOIm5fJpGTLIDOw+buajU1jDIoJFr9pnwwhJ49mwpnheNIQn8kSUqcATKF1PUJsDaPI7L6TiPeHuco8cKYbRPHSFx/QxZ7eKuHZr2xuVID/u0gCDpK4WNWCnzQkUrRvSB3Nn49N0CKXdz6FT+PymnsZQqmRIdJnIZomjIIDaQ+IYESiU9abReFDRPGr9Sn2DHRkLJ6qdeaXE4Azmt4+LAmx9UQXHTqvXGpevB8NeDaCiDqKmrHv24Bb+V8jDvIJ5w1KaKX9eUXZwwcitFSbAo/StdPitO9+aWMetUxqN7sZpoUjwsdCcJiR7m8a8ccjJU5xQ== 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: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=hpe.com; Received: from DF4PR8401MB0444.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760d::23) by DF4PR8401MB0953.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17; Mon, 8 Feb 2021 15:09:20 +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; Mon, 8 Feb 2021 15:09:19 +0000 Subject: Re: [edk2-devel] [edk2-test PATCH v1 2/2] SctPkg: Enable RISCV64 support using AARCH64 sources To: Leif Lindholm , CC: Heinrich Schuchardt , Abner Chang , Gilbert Chen , Eric Jin , G Edhaya Chandran , Barton Gao , Samer El-Haj-Mahmoud References: <20201201161752.23734-1-daniel.schaefer@hpe.com> <20201201161752.23734-3-daniel.schaefer@hpe.com> <20201202120436.GE1664@vanye> From: "Daniel Schaefer" Message-ID: Date: Mon, 8 Feb 2021 23:09:08 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 In-Reply-To: <20201202120436.GE1664@vanye> X-Originating-IP: [123.193.51.23] X-ClientProxiedBy: HK2PR02CA0211.apcprd02.prod.outlook.com (2603:1096:201:20::23) To DF4PR8401MB0444.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760d::23) X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.21] (123.193.51.23) by HK2PR02CA0211.apcprd02.prod.outlook.com (2603:1096:201:20::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.20 via Frontend Transport; Mon, 8 Feb 2021 15:09:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 126a4a03-0b94-4207-e2be-08d8cc438257 X-MS-TrafficTypeDiagnostic: DF4PR8401MB0953: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mxRW3q6TZPsjgqDBgC5q+UJBkW5NToGzOBk5r0XSkHCtEv9oyteFaBlK0Atb+QaQOkdgkmJGUZ1hMLTovUQdIICZLI0erN7AqLhdOTquUgDegmlvE0GTgw6bY4uOpbMkayxgcARU2CQsH2uF0HAZMIWFJMVLeiFlHWPxt8gaBXsWVxes0z//EhmnlHR9nxuIiQs8hNHKhgQv6yOOyFsHR48tVv6tjSKmA4OD8udkG/hkiHibt3ZMiO1IotI0vbkbsdQPuZENluTOIHmkiD/wABRdksMhRP4gJ/bvP3468N/nLa0JvnIqxS/rtMk7LkKFxHROKzdm2JYL3u2qVYghvgP2Q4SSx1+q1rA2Vbo5lA1ZlLS+UOuAtgRjidIAX4sSdEP2dJnrRgyngL3RxZe/VD3+iFF5oZB/BNfdCZKpJ3jIlSPqPByP5X9JXtnXR91Rne7YS0o6Tb+crU6VpdDsS/+57NpLgHEnfFv740uX8jx6ZfNY2w0jzzI+QNIpgh6h+enc6qVoL+nAMWKLGZJTVZGSiuduozlKKctVblbZeJXnhycpkYI9dn9S1O/KERw2svElbcxcI5oga6clrOgu+4dD+QYjXql4Dakna2JJMbKuPi2EY76vPEMQ4WsJRoobFrO0Ml3OPcQEoYep6adG1ICLxbrho8kR9C8wNfhFY2YcSHwZhv9u117Ir5sIhwuH 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:(366004)(396003)(346002)(39860400002)(136003)(376002)(36756003)(8936002)(6486002)(52116002)(31686004)(19627235002)(31696002)(53546011)(4326008)(16526019)(186003)(6666004)(8676002)(30864003)(16799955002)(83380400001)(66476007)(316002)(26005)(16576012)(44832011)(2906002)(478600001)(66946007)(966005)(956004)(54906003)(2616005)(66556008)(5660300002)(86362001)(43740500002)(45980500001)(559001)(579004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?U05wNHVzckREOTk5RkdKZDNDRDRQZVR1NXVxZ01saHErc25CRi9pWjIyNExj?= =?utf-8?B?MkFoTXZlSWhaRG5WN2dZRWNUOWpxckQ5NmY4TDQxZ0VZL29pbWVxNzAwYXdx?= =?utf-8?B?OStSalVXb2tXZVpwaUZTYmRpSzVZeDBCdmRTeWRqNGFKNmhkR3c4YktBajZw?= =?utf-8?B?RSsySTNjdVMySnBGNEw1SURwMWE2U0hRWVhTQ2hsNWY0VDBoRVJsNmxJaW1h?= =?utf-8?B?OU5BOXVJU3JiU21iNjJtaFBONUFqTFRhYjIrM090QVBUNmtITnArckZyQkUx?= =?utf-8?B?aWJSU0hCbTV6d1E5TFZIbWlTS1ZFeHE0dnhNcHMrSHdoOTJwWDVPekVoZU1m?= =?utf-8?B?bTdmNjcvbUxldHlXQWVoZHhmbGxXZDZVTCtQUUl5bWdidk9MZnE0M3Y5K3Vr?= =?utf-8?B?SkZnU0ZPc0hvWVZudGozbDhXY3E1WU9JUll6L2IrTVQ3UlBGekptSXFicUJl?= =?utf-8?B?a2p5NUtsb255Vy9SOXd0VmtKMWtIemhqOVNpMHlONS9VbjJWMU5NVFhFTWdU?= =?utf-8?B?SVJvMERja1hrT05nQzFZdzQ1U2JTdUZ5TkZkZ0NkNmo1WkNrNXBJenlUd09z?= =?utf-8?B?UnpUSE0zTFBRVEphN3VPTHA5REdJWVYrcXVQd3ltMkNFZy93QmxKb3BXQU93?= =?utf-8?B?SFZVaHduNUViVW1oRUdHSFQrcWswR2VVclJqVFQvU2JsVzdxRXQra0dxblNs?= =?utf-8?B?bTA4Yk8rcTI3SUtFYlhibkxnVExBYURXdmV3TW95dEJHdmNpajFFcDg1cEhV?= =?utf-8?B?aVZYQlZZUURDN3dNVzJzMGIwMlF4Mk15dVdwUXNybE5CNktDZ2poU2Z2QmtH?= =?utf-8?B?MDRjeG5XdmJmdEZpSzArMGVFS2lWMnpRZU5HaHZaMHl3NkN3MGp1TGUrS3Za?= =?utf-8?B?NGdPTUMrLys3aisrcjZrWHBUUFlrdUN2d2VhcFZtSHBVOVFoMHd1OFVGMnB4?= =?utf-8?B?TmswV3JjUC9NbmpOMGx1UlJvSGdlOTY2WEd3QnFGRTkxU044bURPbTBaMTBU?= =?utf-8?B?R2VqajVFUldUYng3aG55SE5WaWxnUk1mMDUvejhQdVpkaHQyRzNJZDRMejRz?= =?utf-8?B?UG1VQ2QrL0VRbnRwOUhsNjRIbHB3M1BMb3gvZU0yck9GWndzNVYyTS9XNUY2?= =?utf-8?B?dC9oOVo1Zmd6NHFXQTZaTHpzR2IvN3pEVlF1OTVRTVM4dTB0VlNqMDdCTVZY?= =?utf-8?B?UEpxQXR0c3psNUZXWDYxZ1o1dUhHcVNOWVVycFA4ekpRRFpIUFlrOHFJZVZV?= =?utf-8?B?ZnhLZi93VG9RWUFJNE9pU2M5aG5uOURGMlBTWkpQTzl4NDFzU0g0Rlczblpa?= =?utf-8?B?L2tOTDJ3L1ZVWTNzUWJ0ZEdBM1E1M3RGdi8wMEFMLzc5K3cvb1hyT2lHSUpq?= =?utf-8?B?WTlPSWttcm5LT3BPMkRkU1poVDQ4SkxlcEQ3QVhIQk9RMGpVZUtscVJiOEpv?= =?utf-8?B?cHlFVzAxOFA2NUdDOUErNlFvTVRzcS80dmprcG9IQ0pzSWxBNjFUd1N3Q2k1?= =?utf-8?B?SUdyR085Q3dlT0lWQXhDQklZcVBRbmcvK3hjVEpHQ2xNaU15VmdIcTZlOGNz?= =?utf-8?B?aHZpMDQ4OXNLbUlhaTYrWUJhdlNEbU5FRzlGMk5qL0NncTFqRWRraDVLMDZC?= =?utf-8?B?WjEwL0h5SUxvZ1d5Ui8wOGFCeXJzelhMV1AyQTI5cXd4TWRIcVdHcDVHZzZC?= =?utf-8?B?ZVZBUnNyNUc4VEY3MFFKUHdaMGp3ZWphUXMxaEFqTERmQzgzc1lGSFdkbnhn?= =?utf-8?Q?i1kaLf6Tu5cqoYjuctSnQFxTTqrW9nJXDBu1amG?= X-MS-Exchange-CrossTenant-Network-Message-Id: 126a4a03-0b94-4207-e2be-08d8cc438257 X-MS-Exchange-CrossTenant-AuthSource: DF4PR8401MB0444.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2021 15:09:19.8416 (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: jBo56HmzZuuEKX2VsKB0WkSempWUbozNYlkPLsF6lUnoMT5psbF33az78mcLRQNZfwELN6iqxAwcWGfRK1jKjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB0953 X-OriginatorOrg: hpe.com X-Proofpoint-UnRewURL: 18 URL's were 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-08_09:2021-02-08,2021-02-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 suspectscore=0 adultscore=0 spamscore=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102080104 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Hi Leif, thanks very much for the review! I've cleaned up the patchset and addressed the issues. I'll send out another set soon. See comments below. Thanks, Daniel On 12/2/20 8:04 PM, Leif Lindholm wrote: > On Wed, Dec 02, 2020 at 00:17:52 +0800, Daniel Schaefer wrote: >> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3042 >> >> TODO: Need to check whether we can avoid copying Aarch64 sources. >> >> Cc: Leif Lindholm >> Cc: Heinrich Schuchardt >> Cc: Abner Chang >> Cc: Gilbert Chen >> Cc: Eric Jin >> Cc: G Edhaya Chandran >> Cc: Barton Gao >> Cc: Samer El-Haj-Mahmoud >> 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 | 45 ++++ >> 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/TestCase/UEFI/EFI/Protocol/UsbHc/BlackBoxTest/Riscv64/TimerInterrupt.c | 51 ++++ >> uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/EntsLibPlat.h | 55 ++++ >> uefi-sct/SctPkg/TestInfrastructure/SCT/Framework/ENTS/EasLib/Riscv64/InitPlat.c | 55 ++++ >> 14 files changed, 1246 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 >> + >> + 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 > > *cough* For the next patch series I went through everything and made sure that there's no Aarch64 or ARM anymore. >> + >> +--*/ >> + >> +#ifndef _EFI_LIB_PLAT_H_ >> +#define _EFI_LIB_PLAT_H_ > > No leading _ in macros. This is a common pattern in the code. Even in EDK2. >> + >> +#define MIN_ALIGNMENT_SIZE 8 >> + >> +#endif >> diff --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. >> + >> +--*/ >> + >> +#include "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..8bc2c624 >> --- /dev/null >> +++ b/uefi-sct/SctPkg/SCRT/SCRTApp/Riscv64/GoVirtual.S >> @@ -0,0 +1,45 @@ >> +## @file >> +# >> +# Copyright 2010 - 2012 Unified EFI, Inc.
>> +# Copyright (c) 2012, ARM Ltd. All rights reserved.
>> +# Copyright (c) 2020, Hewlett Packard Enterprise Development LP.
>> +# >> +# 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 different on Aarch64? */ > > 1) FIXME > 2) Aarch64. I have no idea why the alignment would be 3 on other platforms, so I don't know how to fix it. If anyone knows more, please let me know. I'll just change the comment to say Riscv64. >> +.align 3 >> + >> +.global JumpToTestFunc >> +.type JumpToTestFunc, %function >> + >> +#------------------------------------------------------------------------------ >> +# VOID >> +# JumpToTestFunc ( >> +# IN UINTN FuncPointer, >> +# IN UNITN ConfigInfo >> +# ) >> +# TODO: Make sure this code is correct > > No TODO. > Should this set really be called an RFC? Yes, sorry, it's more of an RFC. I wanted to get it out before Heinrich's talk at OSFC, so he could mention it. The code works as confirmed by Heinrich, I just hadn't cleaned it up yet. >> +JumpToTestFunc: >> + mv x2, x0 >> + mv x0, x1 >> + >> + // Jump to Virtual function >> + jalr x2 >> diff --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 = FALSE; >> +UINTN PageTable = 0; >> + >> + >> +VOID >> +ConvertRuntimeFuncPtr ( >> + IN OUT UINTN *VirtualFunc >> + ) >> +/*++ >> + >> +Routine Description: >> + >> + Change RuntimeTestFunc physical address to virtual address >> + >> +Arguments: >> + >> + VirtualFunc - On input, 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? */ > > FIXME? > (Even if it's copied, it's wrong :) > ARM in general. Fixed. Even in Riscv64 we enabled identity mapped MMU before PEI. >> +} >> + >> + >> +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 this Application image location in >> + // the system memory. In this way, it is safe for page table memory. >> + // >> + AllocateMemory = PhysicalFunc; >> + >> + Status = tBS->AllocatePages ( >> + AllocateMaxAddress, >> + EfiRuntimeServicesData, >> + 1, >> + &AllocateMemory >> + ); >> + >> + if (EFI_ERROR(Status)) { >> + return Status; >> + } >> + >> + PageTable = (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 = 0; >> + >> + // >> + // Copy entries that need runtime mapping to construct virtualMemoryMap >> + // >> + for (Index = 0; Index < (MemoryMapSize / DescriptorSize); Index++) { >> + if ((MemoryMap->Attribute & EFI_MEMORY_RUNTIME) == EFI_MEMORY_RUNTIME) { >> + SctCopyMem ((VOID *) VirtualMemoryMap, (VOID *) MemoryMap, DescriptorSize); >> + VirtualMemoryMap->VirtualStart = VirtualMemoryMap->PhysicalStart; >> + *VirtualMapSize += DescriptorSize; >> + VirtualMemoryMap = NextMemoryDescriptor (VirtualMemoryMap, DescriptorSize); >> + } >> + >> + MemoryMap = 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); > > Again. Same. >> +} >> 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 = 0; >> +EFI_PHYSICAL_ADDRESS mIoPortSpaceAddress = 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 = HandOffAddr; >> + HandOffPtr = (RUNTIME_HANDOFF*)mHandOffPtr; >> + *ConfigData = HandOffPtr->ConfigureInfo; >> + >> + if (!HandOffPtr->DebuggerInfo.MmioFlag){ >> + // >> + // If debug port is I/O mapped, fix IoBase Address. >> + // >> + FixAddress(&HandOffPtr->DebuggerInfo.IoBase); >> + mIoPortSpaceAddress = HandOffPtr->DebuggerInfo.IoBase; > > Looks redundant on !x86 > >> + } 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 >> + // write the data to UART. >> + // > > Ye gods... Reminder that this is copied from the ARM sources. In this case I'll just replace ARM by RISC-V. >> + return EFI_SUCCESS; >> +} >> + >> + >> + >> +EFI_STATUS >> +DebugWorker ( >> + IN CHAR8 *String >> + ) >> +{ >> + EFI_STATUS Status; >> + >> + // >> + // Send text message to registered UART. >> + // >> + Status = Send2UART(String); >> + return Status; >> +} >> diff --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================Dump Runtime Table===============\n"); >> + SctAPrint ("Header Signature = 0x%x\n", VRT->Hdr.Signature); >> + >> + SctAPrint ("\n================GetTime Service==============\n"); >> + SctAPrint ("GetTime @ 0x%x\n", VRT->GetTime); >> + >> + SctAPrint ("\n================SetTime Service==============\n"); >> + SctAPrint ("SetTime @ 0x%x\n", VRT->SetTime); >> + >> + SctAPrint ("\n================GetWakeupTime Service==============\n"); >> + SctAPrint ("GetWakeupTime @ 0x%x\n", VRT->GetWakeupTime); >> + >> + SctAPrint ("\n================SetWakeupTime Service==============\n"); >> + SctAPrint ("SetWakeupTime @ 0x%x\n", VRT->SetWakeupTime); >> + >> + SctAPrint ("\n================GetVariable Service==============\n"); >> + SctAPrint ("GetVariable @ 0x%x\n", VRT->GetVariable); >> + >> + SctAPrint ("\n================GetNextVariableName Service==============\n"); >> + SctAPrint ("GetNextVariableName @ 0x%x\n", VRT->GetNextVariableName); >> + >> + SctAPrint ("\n================SetVariable Service==============\n"); >> + SctAPrint ("SetVariable @ 0x%x\n", VRT->SetVariable); >> + >> + SctAPrint ("\n================GetNextHighMonotonicCount Service==============\n"); >> + SctAPrint ("GetNextHighMonotonicCount @ 0x%x\n", VRT->GetNextHighMonotonicCount); >> + >> + SctAPrint ("\n================ResetSystem Service==============\n"); >> + SctAPrint ("ResetSystem @ 0x%x\n", VRT->ResetSystem); >> +#if 0 > > Better to delete if not usable, but why disabled for AArch64 in the > first place? Not sure. It's also commented out in the X86 and IPF source files. I'll keep it. I think it would be more confusing if RISC-V was the only platform that didn't have this. >> + SctAPrint ("\n================UpdateCapsule Service==============\n"); >> + SctAPrint ("UpdateCapsule @ 0x%x\n", VRT->UpdateCapsule); >> + >> + SctAPrint ("\n================QueryCapsuleCapabilities Service==============\n"); >> + SctAPrint ("QueryCapsuleCapabilities @ 0x%x\n", VRT->QueryCapsuleCapabilities); >> + >> + SctAPrint ("\n================QueryVariableInfo Service==============\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.
> > More trailing spaces than usual in line above. > (The below block has 3 of them in every copy.) This pattern is present in almost all files in the repo. Should we follow up with a second patch series to fix that? In this repo there are tons of things to clean up... Some files have CRLF and an additional LF at the end of every line. >> + >> + 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 UserAddress, >> + 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 the 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 Address, >> + 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 times to write the IO address. >> + Buffer - Buffer to write data from. size is Width * Count >> + >> +Returns: >> + Status code >> + >> +--*/ >> +{ >> + return CpuIoServiceWrite(Width, Address, Count, Buffer); >> +} >> + >> + >> +EFI_STATUS >> +EfiIoRead ( >> + IN EFI_PEI_CPU_IO_PPI_WIDTH Width, >> + IN UINT64 Address, >> + 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 times to read the IO address. >> + Buffer - Buffer to read data into. size is Width * 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. >> + // > > ARM > >> +} >> + >> +// Quick port to ARM >> + >> +VOID >> +Port80 ( >> + UINT8 Number >> + ) >> +{ >> + //EFI_SCT_DEBUG ((EFI_SCT_D_ERROR, L"Port80 %02x", Number)); > > Eew. That function is used in some tests, that's why it's here and in both ARMs. >> +} >> 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. >> + > > Trailing spaces. > >> +**/ >> + >> +/*++ >> + >> +Module Name: >> + >> + Debug.h >> + >> +--*/ >> + >> +#ifndef _IA32_IO_ACCESS_H >> +#define _IA32_IO_ACCESS_H > > Srsly? Reminder again, that this is a file that I copied ;) This header wasn't necessary so I removed in in my next patch series. >> + >> +#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 assuming a pure PC architecture. Not required? >> +#define VIRT_TO_PHYS_OFFSET (0x80000000) //2G >> + >> + >> + >> +#endif >> diff --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/BlackBoxTest/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 TestLevel 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 *ClientInterface, >> + 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 = gtBS->HandleProtocol ( >> + SupportHandle, >> + &gEfiStandardTestLibraryGuid, >> + (VOID **) &StandardLib >> + ); >> + >> + if (EFI_ERROR(Status)) { >> + StandardLib->RecordAssertion ( >> + StandardLib, >> + EFI_TEST_ASSERTION_FAILED, >> + gTestGenericFailureGuid, >> + L"BS.HandleProtocol - Handle standard test library", >> + L"%a:%d:Status - %r", >> + __FILE__, >> + (UINTN)__LINE__, >> + Status >> + ); >> + return Status; >> + } >> + >> + DebugSupport = (EFI_DEBUG_SUPPORT_PROTOCOL *)ClientInterface; >> + >> + if (DebugSupport->Isa != PlatformIsa) { >> + return EFI_SUCCESS; >> + } >> + >> + Status = DebugSupport->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__, >> + (UINTN)__LINE__, >> + Status >> + ); >> + return Status; >> + } >> + >> + for (ProcessorIndex = 0; ProcessorIndex <= MaxProcessorIndex; ProcessorIndex++) { >> + >> + // >> + // Assertion Point 3.5.2.1 >> + // Invoke InvalidateInstructionCache and verify interface correctness. >> + // >> + >> + // The Physical base of the memory range to be invalidated. >> + Start = 0x0; >> + >> + // The minimum number of bytes in the processor's instruction cache to be invalidated. >> + Length = 0x0; >> + >> + Status = DebugSupport->InvalidateInstructionCache (DebugSupport, ProcessorIndex, (VOID*)&Start, Length); >> + >> + if (EFI_ERROR(Status)) { >> + AssertionType = EFI_TEST_ASSERTION_FAILED; >> + } else { >> + AssertionType = 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:Status - %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/BlackBoxTest/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 > > Eew. > >> + 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 TestLevel 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 *ClientInterface, >> + 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 = (EFI_DEBUG_SUPPORT_PROTOCOL *)ClientInterface; >> + >> + if (DebugSupport->Isa != PlatformIsa) { >> + return EFI_SUCCESS; >> + } >> + >> + // >> + // Get the Standard Library Interface >> + // >> + Status = gtBS->HandleProtocol ( >> + SupportHandle, >> + &gEfiStandardTestLibraryGuid, >> + (VOID **) &StandardLib >> + ); >> + >> + if (EFI_ERROR(Status)) { >> + StandardLib->RecordAssertion ( >> + StandardLib, >> + EFI_TEST_ASSERTION_FAILED, >> + gTestGenericFailureGuid, >> + L"BS.HandleProtocol - Handle standard test library", >> + L"%a:%d:Status - %r", >> + __FILE__, >> + (UINTN)__LINE__, >> + Status >> + ); >> + return Status; >> + } >> + >> + // >> + // Assertion Point 3.4.2.1 >> + // Invoke RegisterExceptionCallback() to install an interrupt handler function. >> + // >> + InvokedExceptionCallback = 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 = DebugSupport->RegisterExceptionCallback (DebugSupport, 0, ExceptionCallback, EXCEPT_IA32_BREAKPOINT); >> + >> + if ((Status == EFI_SUCCESS) || (Status == EFI_ALREADY_STARTED)) { >> + AssertionType = EFI_TEST_ASSERTION_PASSED; >> + } else { >> + AssertionType = 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:Status - %r", >> + __FILE__, >> + (UINTN)__LINE__, >> + Status >> + ); >> + >> + // >> + // If the callback function is already registed, return >> + // >> + if (EFI_ERROR(Status)) { >> + return EFI_SUCCESS; >> + } >> + >> + // >> + // Test the callback function registed. >> + // >> + >> + // >> + // Call SoftwareBreak to invoke the interrupt handler function. >> + // >> + SoftwareBreak (); >> + >> + if (InvokedExceptionCallback == FALSE) { >> + AssertionType = EFI_TEST_ASSERTION_FAILED; >> + } else { >> + AssertionType = 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 functions can be both invoked. >> + // >> + InvokedExceptionCallback = FALSE; >> + InvokedPeriodicCallback = FALSE; >> + >> + Status = DebugSupport->RegisterPeriodicCallback (DebugSupport, 0, PeriodicCallback); >> + if (EFI_ERROR(Status)) { >> + return Status; >> + } >> + >> + // >> + // Wait the PeriodicCallback to be invoked. >> + // >> + gtBS->Stall (500000); >> + >> + // >> + // Call SoftwareBreak to invoke the interrupt handler function. >> + // >> + SoftwareBreak (); >> + >> + if ((InvokedExceptionCallback == TRUE) && (InvokedPeriodicCallback == TRUE)) { >> + AssertionType = EFI_TEST_ASSERTION_PASSED; >> + } else { >> + AssertionType = 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:Status - %r", >> + __FILE__, >> + (UINTN)__LINE__, >> + Status >> + ); >> + >> + // >> + // Uninstall the Periodic callback function. >> + // >> + Status = DebugSupport->RegisterPeriodicCallback (DebugSupport, 0, NULL); >> + if (EFI_ERROR(Status)) { >> + return Status; >> + } >> + >> + // >> + // Assertion Point 3.4.2.3 >> + // Invoke RegisterExceptionCallback() to install another interrupt handler function. >> + // >> + Status = DebugSupport->RegisterExceptionCallback (DebugSupport, 0, ExceptionCallback1, EXCEPT_IA32_BREAKPOINT); >> + >> + if (Status != EFI_ALREADY_STARTED) { >> + AssertionType = EFI_TEST_ASSERTION_FAILED; >> + } else { >> + AssertionType = 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 unstall the interrupt handler function. >> + // >> + Status = DebugSupport->RegisterExceptionCallback (DebugSupport, 0, NULL, EXCEPT_IA32_BREAKPOINT); >> + >> + if (EFI_ERROR(Status)) { >> + AssertionType = EFI_TEST_ASSERTION_FAILED; >> + } else { >> + AssertionType = 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 = FALSE; >> + >> + // >> + // Call SoftwareBreak to invoke the interrupt handler function. >> + // >> + SoftwareBreak (); >> + >> + if (InvokedExceptionCallback != FALSE) { >> + AssertionType = EFI_TEST_ASSERTION_FAILED; >> + } else { >> + AssertionType = 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/BlackBoxTest/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 = IsaAArch64; >> + >> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UsbHc/BlackBoxTest/Riscv64/TimerInterrupt.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UsbHc/BlackBoxTest/Riscv64/TimerInterrupt.c >> new file mode 100644 >> index 00000000..1c1940e5 >> --- /dev/null >> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UsbHc/BlackBoxTest/Riscv64/TimerInterrupt.c >> @@ -0,0 +1,51 @@ >> +/** @file >> + >> + Copyright 2006 - 2010 Unified EFI, Inc.
>> + Copyright (c) 2010, Intel Corporation. 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. >> + >> +**/ >> +/** >> + * Ipf Source file for Mask/Unmask TimerInterrupt. >> + */ >> +/*++ >> + >> +Module Name: >> + TimerInterrupt.c >> + >> +Abstract: >> + Ipf Source file for Mask/Unmask TimerInterrupt. >> + >> +Author(s): >> + >> + >> +References: >> + EFI Specification 1.10 >> + EFI/Tiano DXE Test Case Writer's Guide >> + >> +Revision History: >> + Initial 10-20-2002 >> + Version 0.01 >> + >> +--*/ >> + >> +#include "UsbHcTest.h" >> + >> +VOID MaskTimerInterrupt() >> +{ >> + // TBD >> + return; >> +} >> + >> +VOID UnmaskTimerInterrupt() >> +{ >> + // TBD >> + return; >> +} >> 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/Riscv64/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_ > > No leading _. > > / > Leif > >> + >> +#define MIN_ALIGNMENT_SIZE 8 >> + >> +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. >> + >> +--*/ >> +; >> + >> +#endif >> diff --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/Riscv64/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. >> + >> +--*/ >> + >> +#include "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.28.0 >> >> >> >> >> >>