From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=0151623386=gilbert.chen@hpe.com) Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by groups.io with SMTP; Wed, 04 Sep 2019 18:24:44 -0700 Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x851LS63027032 for ; Thu, 5 Sep 2019 01:24:43 GMT Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0b-002e3701.pphosted.com with ESMTP id 2utm9jsf2b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 05 Sep 2019 01:24:43 +0000 Received: from G9W8455.americas.hpqcorp.net (exchangepmrr1.us.hpecorp.net [16.216.161.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id E993C4E for ; Thu, 5 Sep 2019 01:24:42 +0000 (UTC) Received: from G1W8108.americas.hpqcorp.net (2002:10c1:483c::10c1:483c) by G9W8455.americas.hpqcorp.net (2002:10d8:a15e::10d8:a15e) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Sep 2019 01:24:42 +0000 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (15.241.52.12) by G1W8108.americas.hpqcorp.net (16.193.72.60) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 5 Sep 2019 01:24:42 +0000 Received: from TU4PR8401MB1056.NAMPRD84.PROD.OUTLOOK.COM (10.169.47.148) by TU4PR8401MB1294.NAMPRD84.PROD.OUTLOOK.COM (10.169.48.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.21; Thu, 5 Sep 2019 01:24:41 +0000 Received: from TU4PR8401MB1056.NAMPRD84.PROD.OUTLOOK.COM ([fe80::cc02:a574:b9e3:cf1e]) by TU4PR8401MB1056.NAMPRD84.PROD.OUTLOOK.COM ([fe80::cc02:a574:b9e3:cf1e%8]) with mapi id 15.20.2220.022; Thu, 5 Sep 2019 01:24:41 +0000 From: "Gilbert Chen" To: "devel@edk2.groups.io" Subject: [PATCH 05/15] [platforms/devel-riscv-v2]: RiscV/Library: Initial version of libraries introduced in RISC-V platform package Thread-Topic: [PATCH 05/15] [platforms/devel-riscv-v2]: RiscV/Library: Initial version of libraries introduced in RISC-V platform package Thread-Index: AdVjiK+SnPX98TntSPmmdcxD+fcAgQ== Date: Thu, 5 Sep 2019 01:24:40 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [16.242.247.133] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8f2b984a-9f51-4308-5364-08d7319fd359 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:TU4PR8401MB1294; x-ms-traffictypediagnostic: TU4PR8401MB1294: x-ms-exchange-purlcount: 1 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 015114592F x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(136003)(376002)(39860400002)(396003)(366004)(189003)(199004)(53376002)(55016002)(2501003)(52536014)(305945005)(7736002)(53946003)(14444005)(256004)(486006)(478600001)(9686003)(53936002)(16799955002)(66556008)(25786009)(66446008)(5640700003)(64756008)(99286004)(66476007)(5660300002)(316002)(66946007)(6306002)(6436002)(8936002)(74316002)(81166006)(1730700003)(966005)(76116006)(81156014)(186003)(30864003)(6506007)(15188155005)(3846002)(6116002)(102836004)(476003)(8676002)(2906002)(33656002)(66066001)(14454004)(26005)(71200400001)(6916009)(7696005)(2351001)(71190400001)(86362001)(44824005);DIR:OUT;SFP:1102;SCL:1;SRVR:TU4PR8401MB1294;H:TU4PR8401MB1056.NAMPRD84.PROD.OUTLOOK.COM;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 32V/sll6TC5narYgtlIPFTWj7CbSQ6s7/mIotGAezeYVIbM5AStbO/Xp1jQBYJE/dWGgFvP6ni8O1j4kW1wZzXHAEHRfoc/RkFfbE1umOQgA+3X9kV68uVxhmJqdLBnY7JHSQhFfjf3f+KnYVdMHrwxPxiiM8MHkrBcdxakTMCbluVgCy9RFqgJbLKw8j9GGR51FwOXYdLl3KhQQwCA7IXQ3Uhr9kN5UL0BJRVOBMC45JwhaidCpYF7uSUdfgwVnD7DXtzLxgkIv6tFxORVIWw6veBxTgttC7XfNq57HlQZKqxbU0TShw1iBQjcronbAv6V33C3UNsXhXMXJw0X/dWHLfegK3vNVQ4Ekz1uqMhjklP/GEXIIEsTX9aWh8wQZLdzrOrh7hYOIiJ7eMQ4QYbFUA9EsLy7yobdssQ+wft8= x-ms-exchange-transport-forked: True arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nu/+0R4GLL1PRQla2c0312HQYAmuuSU13LU+9TBFw7hzgiN9fI7PlI8bgR9ZOmcIjn9JkzgqxKKl/zXNaEUDZ8ZGQ8a3XQJgDXk9dQVh/BbyQi57l/Y9ZP5Uuk+/3qsWK6D35feNl10Nb9nkCNVbxzTBtDmRJO8ogJ491ho/0nH486aUmThLqH5ofIlSjUJa+u0atKBaRiSVQGv9OXpeETFsSksPZ9WmctCkfviJ2bR4kwuuuCHJn9qLGXdEtPpVbWsGbI0puhQi12H0os6/WcNQCynT9UzgvwUqUlr2faf0Yj/Gb3hJsSD4srmfnHi3wkuUNft1W4AL3CZmrzoh4Q== 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=Aqk7W7agCCidwjZfKGSGx56Cz7+Ilfz4z0eOlz2t+kw=; b=JDL7SwfLJXuhJ4T5hXviUq8Q1fjAPLGI92exYCZGl6clzZvqoalZIyJ+vFNJfRIcPgd+OXjFuwUfHPydkRKfnX5NGyhxmdMC6k37qnANxlgr3x7n5tu5vVsRcuL+AmX83Bqz6dYMiBNu1Ae/0kqNua9FfLn9XDMwp8La0JFsTnDTscdUtAoIVrY/VF57gzCXG0DbyUwx8s2C8EUXdoj2TosRz7BKTCVMe3Qvt7Vu8EaZZrUo/7pBo0a0W0x8O2637vIpDdTqcpcu+lMZxAPedDhHkwpy4YzAwgIU/xKzkL1fbbcN0p7QUgT25cNs5Py5e9dKTkUg+zCOAkX1xOyD7A== 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 x-ms-exchange-crosstenant-network-message-id: 8f2b984a-9f51-4308-5364-08d7319fd359 x-ms-exchange-crosstenant-originalarrivaltime: 05 Sep 2019 01:24:41.0032 (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: 2d+EWbiTu3vo5bnpZSLGBHHw49BrgMpIKysztmRxZ37mICftb7T/qj2Ntva81qb40zWP6JaUyGNo/DyDmVP7/g== x-ms-exchange-transport-crosstenantheadersstamped: TU4PR8401MB1294 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.70,1.0.8 definitions=2019-09-05_01:2019-09-04,2019-09-05 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 spamscore=0 mlxscore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1906280000 definitions=main-1909050012 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable FirmwareContextProcessorSpecificLib - Common library to consume EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC and bu= ild up processor specific data HOB. RealTimClockLibNull - NULL instance of Real Time Clock library. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gilbert Chen --- .../FirmwareContextProcessorSpecificLib.c | 88 +++++++++ .../FirmwareContextProcessorSpecificLib.inf | 39 ++++ .../RealTimeClockLibNull/RealTimeClockLibNull.c | 212 +++++++++++++++++= ++++ .../RealTimeClockLibNull/RealTimeClockLibNull.inf | 36 ++++ 4 files changed, 375 insertions(+) create mode 100644 Platform/RiscV/Library/FirmwareContextProcessorSpecific= Lib/FirmwareContextProcessorSpecificLib.c create mode 100644 Platform/RiscV/Library/FirmwareContextProcessorSpecific= Lib/FirmwareContextProcessorSpecificLib.inf create mode 100644 Platform/RiscV/Library/RealTimeClockLibNull/RealTimeClo= ckLibNull.c create mode 100644 Platform/RiscV/Library/RealTimeClockLibNull/RealTimeClo= ckLibNull.inf diff --git a/Platform/RiscV/Library/FirmwareContextProcessorSpecificLib/Fir= mwareContextProcessorSpecificLib.c b/Platform/RiscV/Library/FirmwareContext= ProcessorSpecificLib/FirmwareContextProcessorSpecificLib.c new file mode 100644 index 0000000..0ce2570 --- /dev/null +++ b/Platform/RiscV/Library/FirmwareContextProcessorSpecificLib/FirmwareCo= ntextProcessorSpecificLib.c @@ -0,0 +1,88 @@ +/**@file + Common library to build upfirmware context processor-specific information + + Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All right= s reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + +**/ + +// +// The package level header files this module uses +// +#include + +// +// The Library classes this module consumes +// +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/** + Build up common firmware context processor-specific information + + @param FirmwareContextHartSpecific Pointer to EFI_RISCV_FIRMWARE_CONTE= XT_HART_SPECIFIC + @param ParentProcessorGuid Pointer to GUID of Processor which = contains this core + @param ParentProcessorUid Unique ID of pysical processor whic= h owns this core. + @param CoreGuid Pointer to GUID of core + @param HartId Hart ID of this core. + @param IsBootHart This is boot hart or not + @param ProcessorSpecDataHob Pointer to RISC_V_PROCESSOR_SPECIFI= C_DATA_HOB + + @return EFI_STATUS + +**/ +EFI_STATUS +EFIAPI +CommonFirmwareContextHartSpecificInfo ( + EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *FirmwareContextHartSpecific, + EFI_GUID *ParentProcessorGuid, + UINTN ParentProcessorUid, + EFI_GUID *CoreGuid, + UINTN HartId, + BOOLEAN IsBootHart, + RISC_V_PROCESSOR_SPECIFIC_DATA_HOB *ProcessorSpecDataHob + ) +{ + // + // Build up RISC_V_PROCESSOR_SPECIFIC_DATA_HOB. + // + CopyGuid (&ProcessorSpecDataHob->ParentPrcessorGuid, ParentProcessorGuid= ); + ProcessorSpecDataHob->ParentProcessorUid =3D ParentProcessorUid; + CopyGuid (&ProcessorSpecDataHob->CoreGuid, CoreGuid); + ProcessorSpecDataHob->Context =3D NULL; + ProcessorSpecDataHob->ProcessorSpecificData.Revision =3D SMBIOS_= RISC_V_PROCESSOR_SPECIFIC_DATA_REVISION; + ProcessorSpecDataHob->ProcessorSpecificData.Length =3D sizeof = (SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA); + ProcessorSpecDataHob->ProcessorSpecificData.HartId.Value64_L =3D (UINT64= )HartId; + ProcessorSpecDataHob->ProcessorSpecificData.HartId.Value64_H =3D 0; + ProcessorSpecDataHob->ProcessorSpecificData.BootHartId =3D (UINT8)= IsBootHart; + ProcessorSpecDataHob->ProcessorSpecificData.InstSetSupported =3D Firmwar= eContextHartSpecific->IsaExtensionSupported; + ProcessorSpecDataHob->ProcessorSpecificData.PrivilegeModeSupported =3D= SMBIOS_RISC_V_PSD_MACHINE_MODE_SUPPORTED; + if ((ProcessorSpecDataHob->ProcessorSpecificData.InstSetSupported & RISC= _V_ISA_SUPERVISOR_MODE_IMPLEMENTED) !=3D 0) { + ProcessorSpecDataHob->ProcessorSpecificData.PrivilegeModeSupported |= =3D SMBIOS_RISC_V_PSD_SUPERVISOR_MODE_SUPPORTED; + } + if ((ProcessorSpecDataHob->ProcessorSpecificData.InstSetSupported & RISC= _V_ISA_USER_MODE_IMPLEMENTED) !=3D 0) { + ProcessorSpecDataHob->ProcessorSpecificData.PrivilegeModeSupported |= =3D SMBIOS_RISC_V_PSD_USER_MODE_SUPPORTED; + } + ProcessorSpecDataHob->ProcessorSpecificData.MachineVendorId.Value64_L = =3D FirmwareContextHartSpecific->MachineVendorId.Value64_L; + ProcessorSpecDataHob->ProcessorSpecificData.MachineVendorId.Value64_H = =3D FirmwareContextHartSpecific->MachineVendorId.Value64_H; + ProcessorSpecDataHob->ProcessorSpecificData.MachineArchId.Value64_L =3D = FirmwareContextHartSpecific->MachineArchId.Value64_L; + ProcessorSpecDataHob->ProcessorSpecificData.MachineArchId.Value64_H =3D = FirmwareContextHartSpecific->MachineArchId.Value64_H; + ProcessorSpecDataHob->ProcessorSpecificData.MachineImplId.Value64_L =3D = FirmwareContextHartSpecific->MachineImplId.Value64_L; + ProcessorSpecDataHob->ProcessorSpecificData.MachineImplId.Value64_H =3D = FirmwareContextHartSpecific->MachineImplId.Value64_H; + return EFI_SUCCESS; +} diff --git a/Platform/RiscV/Library/FirmwareContextProcessorSpecificLib/Fir= mwareContextProcessorSpecificLib.inf b/Platform/RiscV/Library/FirmwareConte= xtProcessorSpecificLib/FirmwareContextProcessorSpecificLib.inf new file mode 100644 index 0000000..8cda31f --- /dev/null +++ b/Platform/RiscV/Library/FirmwareContextProcessorSpecificLib/FirmwareCo= ntextProcessorSpecificLib.inf @@ -0,0 +1,39 @@ +#/** @file +# +# Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD License +# which accompanies this distribution. The full text of the license may b= e 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 IM= PLIED. +# +# +#**/ + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D FirmwareContextProcessorSpecificLib + FILE_GUID =3D 8BEC9FD7-C554-403A-94F1-0EBBFD81A242 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D FirmwareContextProcessorSpecificLib + +[Sources.common] + FirmwareContextProcessorSpecificLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + RiscVPkg/RiscVPkg.dec + Silicon/SiFive/SiFive.dec + +[LibraryClasses] + BaseLib + PcdLib + MemoryAllocationLib + PrintLib + +[Pcd] + diff --git a/Platform/RiscV/Library/RealTimeClockLibNull/RealTimeClockLibNu= ll.c b/Platform/RiscV/Library/RealTimeClockLibNull/RealTimeClockLibNull.c new file mode 100644 index 0000000..4de7b68 --- /dev/null +++ b/Platform/RiscV/Library/RealTimeClockLibNull/RealTimeClockLibNull.c @@ -0,0 +1,212 @@ +/** @file + EFI RealTimeClock NULL library + + Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All right= s reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + + Based on the files under ArmPlatformPkg/Library/PL031RealTimeClockLib/PL= 031RealTimeClockLib.inf + +**/ + +#include +#include +#include +#include +#include +// Use EfiAtRuntime to check stage +#include +#include +#include +#include + + +/** + Returns the current time and date information, and the time-keeping capa= bilities + of the hardware platform. + + @param Time A pointer to storage to receive a snapsho= t of the current time. + @param Capabilities An optional pointer to a buffer to receiv= e the real time clock + device's capabilities. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER Time is NULL. + @retval EFI_DEVICE_ERROR The time could not be retrieved due to ha= rdware error. + @retval EFI_SECURITY_VIOLATION The time could not be retrieved due to an= authentication failure. +**/ +EFI_STATUS +EFIAPI +LibGetTime ( + OUT EFI_TIME *Time, + OUT EFI_TIME_CAPABILITIES *Capabilities + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + + return Status; + +} + + +/** + Sets the current local time and date information. + + @param Time A pointer to the current time. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER A time field is out of range. + @retval EFI_DEVICE_ERROR The time could not be set due due to hardw= are error. + +**/ +EFI_STATUS +EFIAPI +LibSetTime ( + IN EFI_TIME *Time + ) +{ + + EFI_STATUS Status =3D EFI_SUCCESS; + + + return Status; +} + + +/** + Returns the current wakeup alarm clock setting. + + @param Enabled Indicates if the alarm is currently enable= d or disabled. + @param Pending Indicates if the alarm signal is pending a= nd requires acknowledgement. + @param Time The current alarm setting. + + @retval EFI_SUCCESS The alarm settings were returned. + @retval EFI_INVALID_PARAMETER Any parameter is NULL. + @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due= to a hardware error. + +**/ +EFI_STATUS +EFIAPI +LibGetWakeupTime ( + OUT BOOLEAN *Enabled, + OUT BOOLEAN *Pending, + OUT EFI_TIME *Time + ) +{ + // Not a required feature + return EFI_UNSUPPORTED; +} + + +/** + Sets the system wakeup alarm clock time. + + @param Enabled Enable or disable the wakeup alarm. + @param Time If Enable is TRUE, the time to set the wak= eup alarm for. + + @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm w= as enabled. If + Enable is FALSE, then the wakeup alarm was= disabled. + @retval EFI_INVALID_PARAMETER A time field is out of range. + @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a = hardware error. + @retval EFI_UNSUPPORTED A wakeup timer is not supported on this pl= atform. + +**/ +EFI_STATUS +EFIAPI +LibSetWakeupTime ( + IN BOOLEAN Enabled, + OUT EFI_TIME *Time + ) +{ + // Not a required feature + return EFI_UNSUPPORTED; +} + + + +/** + This is the declaration of an EFI image entry point. This can be the ent= ry point to an application + written to this specification, an EFI boot service driver, or an EFI run= time driver. + + @param ImageHandle Handle that identifies the loaded image. + @param SystemTable System Table for this image. + + @retval EFI_SUCCESS The operation completed successfully. + +**/ +EFI_STATUS +EFIAPI +LibRtcInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HANDLE Handle; + + + EFI_TIME EfiTime; + + // Setup the setters and getters + gRT->GetTime =3D LibGetTime; + gRT->SetTime =3D LibSetTime; + gRT->GetWakeupTime =3D LibGetWakeupTime; + gRT->SetWakeupTime =3D LibSetWakeupTime; + + + (VOID)gRT->GetTime (&EfiTime, NULL); + if((EfiTime.Year < 2015) || (EfiTime.Year > 2099)){ + EfiTime.Year =3D 2015; + EfiTime.Month =3D 1; + EfiTime.Day =3D 1; + EfiTime.Hour =3D 0; + EfiTime.Minute =3D 0; + EfiTime.Second =3D 0; + EfiTime.Nanosecond =3D 0; + Status =3D gRT->SetTime(&EfiTime); + if (EFI_ERROR(Status)) + { + DEBUG((EFI_D_ERROR, "[%a]:[%dL] Status : %r\n", __FUNCTION__, __LI= NE__, Status)); + } + } + + // Install the protocol + Handle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEfiRealTimeClockArchProtocolGuid, NULL, + NULL + ); + + return Status; +} + + +/** + Fixup internal data so that EFI can be call in virtual mode. + Call the passed in Child Notify event and convert any pointers in + lib to virtual mode. + + @param[in] Event The Event that is being processed + @param[in] Context Event Context +**/ +VOID +EFIAPI +LibRtcVirtualNotifyEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + // + // Only needed if you are going to support the OS calling RTC functions = in virtual mode. + // You will need to call EfiConvertPointer (). To convert any stored phy= sical addresses + // to virtual address. After the OS transitions to calling in virtual mo= de, all future + // runtime calls will be made in virtual mode. + // + return; +} diff --git a/Platform/RiscV/Library/RealTimeClockLibNull/RealTimeClockLibNu= ll.inf b/Platform/RiscV/Library/RealTimeClockLibNull/RealTimeClockLibNull.i= nf new file mode 100644 index 0000000..4556c17 --- /dev/null +++ b/Platform/RiscV/Library/RealTimeClockLibNull/RealTimeClockLibNull.inf @@ -0,0 +1,36 @@ +#/** @file +# +# Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD License +# which accompanies this distribution. The full text of the license may b= e 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 IM= PLIED. +# +# +#**/ + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D RealTimeClockLibNull + FILE_GUID =3D BFC3E25A-8AD0-4201-8A75-F00DE7964370 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D RealTimeClockLib + +[Sources.common] + RealTimeClockLibNull.c + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + UefiLib + DebugLib +# Use EFiAtRuntime to check stage + UefiRuntimeLib + +[Pcd] + -- 2.7.4