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=0142e2c9bd=gilbert.chen@hpe.com) Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by groups.io with SMTP; Mon, 26 Aug 2019 23:26:38 -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 x7R6QbPB015594 for ; Tue, 27 Aug 2019 06:26:37 GMT Received: from g2t2352.austin.hpe.com (g2t2352.austin.hpe.com [15.233.44.25]) by mx0b-002e3701.pphosted.com with ESMTP id 2umhqwd6gh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 27 Aug 2019 06:26:01 +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 g2t2352.austin.hpe.com (Postfix) with ESMTPS id D3595B3 for ; Tue, 27 Aug 2019 06:26:00 +0000 (UTC) Received: from G9W8667.americas.hpqcorp.net (16.220.49.26) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 27 Aug 2019 06:26:00 +0000 Received: from G1W8106.americas.hpqcorp.net (16.193.72.61) by G9W8667.americas.hpqcorp.net (16.220.49.26) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 27 Aug 2019 06:26:00 +0000 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (15.241.52.13) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Tue, 27 Aug 2019 06:26:00 +0000 Received: from TU4PR8401MB1056.NAMPRD84.PROD.OUTLOOK.COM (10.169.47.148) by TU4PR8401MB0624.NAMPRD84.PROD.OUTLOOK.COM (10.169.44.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Tue, 27 Aug 2019 06:25:58 +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.2199.021; Tue, 27 Aug 2019 06:25:58 +0000 From: "Chen, Gilbert" To: "devel@edk2.groups.io" CC: "Chen, Gilbert" Subject: [PATCH 05/15] [platforms/devel-riscv]: RiscV/Library: Initial version of libraries introduced in RISC-V platform package Thread-Topic: [PATCH 05/15] [platforms/devel-riscv]: RiscV/Library: Initial version of libraries introduced in RISC-V platform package Thread-Index: AdVcoEi+7A/11MO/RCCMyw+3FLsODA== Date: Tue, 27 Aug 2019 06:25:58 +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: ddaff937-7784-47dc-8ec6-08d72ab76c9e 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:TU4PR8401MB0624; x-ms-traffictypediagnostic: TU4PR8401MB0624: x-ms-exchange-purlcount: 1 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0142F22657 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(366004)(136003)(376002)(396003)(346002)(199004)(189003)(86362001)(316002)(6436002)(2351001)(2501003)(7736002)(6306002)(478600001)(30864003)(55016002)(102836004)(3846002)(9686003)(6116002)(476003)(53936002)(26005)(256004)(53946003)(76116006)(486006)(14444005)(2906002)(66946007)(64756008)(5640700003)(66476007)(5660300002)(66446008)(66556008)(186003)(71200400001)(71190400001)(966005)(16799955002)(8936002)(66066001)(14454004)(6916009)(53376002)(52536014)(74316002)(8676002)(1730700003)(81166006)(81156014)(25786009)(6506007)(305945005)(15188155005)(99286004)(33656002)(4326008)(7696005)(44824005);DIR:OUT;SFP:1102;SCL:1;SRVR:TU4PR8401MB0624;H:TU4PR8401MB1056.NAMPRD84.PROD.OUTLOOK.COM;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: H6gdoaIjRSTkRg19W1VxVDswIVaAse3+xwYbX1+6TqFdIFt/QyxjoXZJVl56VCLHL9sFb6bxSifSSDLQ6/lCIlhrcLPXuUvBiM4NPgw27ojXr8bRSh2wISUsNuGh7vFfPSJ+Q0M8v1r1lB7KHBqvV1A14lSRZxjlWLdCoQbav8q3AmWWA11DvJvXJqmlXM9uZo9q7HdLr8O1ryf3GjzpanwhnMfljo1qcDlftKc+83i/7OgcjcOzQGMrEfbP+E/7UNbB4pUxdaX/rS8ssmALmXbADw3weV7HAxy1YMyloPQ4a5dEzwgW97uShJhL+51LRv/e5/433GgJJzM0rqz9jSh3YF5FEL865pKIEjMJoyXgF1NHoqg8KiGPm7jKCZ+Npyw2C8J6heKzkBTV+V8JB7FWr2oVhy7Q/H2aSnFhuyY= arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IkhbaQMlaI7QqC8qcXkb16NvBdzrEtCTfshh19UgND86yc/4DpM2IorRVa0BCB9NGivnDE0g9SDkzqUORCwUI9jgPR4tGQZj37bxEOFOBueyEm2NyTfijnZYxyTnp5EJOGOSHE9nBZrlqpJjbQdnOm3Yh4WMGD4S7jUeE86SOI2tuyO9I8paPM6OFJG7Pbye7Z1yhsKL/OAUHG/tL+s7xzVDEqz42deJ2oVgUBGbLBdlS1vPL39UnjWfucb62qIm/TErvK/vBWMW0XCz57drXVeoSL45DRkc7ARKChqvLF4ZE3uRYVag0gZjtFAc+TvwQpVMuOlvt0QtLFoWr/+SVw== 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=s31AVLEJudeLA85k8ep+lerBJKy6+p9cMM7f1ED/qDM=; b=i6dRwSZlpvMiMZiZWWJ7A6ajg8wTB+y7yf1H+zekBpP9OQpnX3gmUU3X4m6gEEFtcHSP44Cw9+gRY2HMcb743lhbLw0SwB+dnJVHXo1bBYEREHY/jk9j6xwoLMf08LG3lsS+WnaXi4wg5zsnZA1oXFhfx3fj/y00Sj0/hZ96iXlJ7i7EYuB2+wCIaSKr2PgpcUJoqrNNKca1DQbsyQVX6fRT+4nNenB5jvQp13mD+mwwC4Zc+fpbtc9DHGdGfArY/BiA6gtrM+l7uQojO+IFQCTlN0PKPPqgl5pbc4iAVwa4065JpBkiqGs/2wqoKjCc7HCuepHakzWLKEG1qlFqTw== 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: ddaff937-7784-47dc-8ec6-08d72ab76c9e x-ms-exchange-crosstenant-originalarrivaltime: 27 Aug 2019 06:25:58.4497 (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: ++7CDsBj8xXc4UrMKZHvYV4cXwMF1ikg1vrDEFp576qy0Z9BbkoHZd2NXHPST5zMseCkHmCvOCocGcO4zP8Myg== x-ms-exchange-transport-crosstenantheadersstamped: TU4PR8401MB0624 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:5.22.84,1.0.8 definitions=2019-08-26_08:2019-08-26,2019-08-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 adultscore=0 mlxscore=0 malwarescore=0 impostorscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 spamscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1906280000 definitions=main-1908270071 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