From nobody Mon Feb 9 19:05:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109547+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109547+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697101811; cv=none; d=zohomail.com; s=zohoarc; b=cHot/8W7g5PVB8VaLBzUlpjnpyki410zLW1YeuhJ/+w4kyvYYGFNZW7FsI0WueDleqLEhtu7vkE5VsPHxWa2HYremU252CDbWDt5G3LiljimY1yVgGxhSobtS3NEXDn+ki8c4UYcGtOBvUJ7e00icz3OKWPcvd+0xCcsx2N/tbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697101811; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=tOregMBqO23W72BpkfKJTH4xS/JDBtwiSHOjYzmVEYY=; b=iI7qGOVhykbJ6oKEj1dXr8LHARQYybPRfEjutqcOkCRJSJej8glrA0FQobAEdMavM9vjWBOkNvPuFNBz6MiXp+xt77qOUBcFRzs1RE4z5TeeyjKIUEyBewlkgyRlqKR/9NEDe/Mmrvr4Ds92rgOKLtYwGsHcFKpswi0wpR1AbBw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109547+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697101811801146.0065957096183; Thu, 12 Oct 2023 02:10:11 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=tOregMBqO23W72BpkfKJTH4xS/JDBtwiSHOjYzmVEYY=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1697101811; v=1; b=KPkV4lInqNoWQ73Xg46fefdEnaNrcF0WDAetmgDyLScXwoshVCXYMcG5a2lv62ZWO1maTJl+ dZxksTXR/9/oyM1UY1WN1CQoPyrvpnnzE2oLiFAYFFN3k93/zaW3nIdSxcl9ecnsxarN/kuiSgk ww3qWYdC7DhtqdYiySUTzgtY= X-Received: by 127.0.0.2 with SMTP id tGbyYY1788612xd12qZ494hU; Thu, 12 Oct 2023 02:10:11 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.7079.1697101810794388665 for ; Thu, 12 Oct 2023 02:10:11 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-619-HQmQ7Tz2MVygbDfUHnbuzg-1; Thu, 12 Oct 2023 05:10:05 -0400 X-MC-Unique: HQmQ7Tz2MVygbDfUHnbuzg-1 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7D4A2811E7B; Thu, 12 Oct 2023 09:10:05 +0000 (UTC) X-Received: from lacos-laptop-9.usersys.redhat.com (unknown [10.39.192.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E7B540C6F79; Thu, 12 Oct 2023 09:10:04 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Ard Biesheuvel , Leif Lindholm , Wenyi Xie Subject: [edk2-devel] [edk2-platforms PATCH 09/19] Hisilicon: drop unused VirtualRealTimeClockLib instance Date: Thu, 12 Oct 2023 11:09:40 +0200 Message-Id: <20231012090950.108577-10-lersek@redhat.com> In-Reply-To: <20231012090950.108577-1-lersek@redhat.com> References: <687bbaf5-3c2b-6d27-44a5-d19541ce97bd@redhat.com> <20231012090950.108577-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 9hfx3GMntf1By53q7yYPdo12x1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697101813549100004 Content-Type: text/plain; charset="utf-8"; x-default="true" VirtualRealTimeClockLib is not used in either edk2-platforms or edk2-non-osi, and there never has been a reference to it -- even the initial code drop that added it to edk2-platforms [*] contained zero references to it. Remove it. [*] commit 600081b52deb ("Platform,Silicon: Import Hisilicon D02,D03,D05 and HiKey", 2017-08-03) Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Wenyi Xie Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4564 Signed-off-by: Laszlo Ersek --- Silicon/Hisilicon/Library/VirtualRealTimeClockLib/RealTimeClockLib.inf | = 41 -- Silicon/Hisilicon/Library/VirtualRealTimeClockLib/RealTimeClockLib.c | 4= 23 -------------------- 2 files changed, 464 deletions(-) diff --git a/Silicon/Hisilicon/Library/VirtualRealTimeClockLib/RealTimeCloc= kLib.inf b/Silicon/Hisilicon/Library/VirtualRealTimeClockLib/RealTimeClockL= ib.inf deleted file mode 100644 index 8029dda436db..000000000000 --- a/Silicon/Hisilicon/Library/VirtualRealTimeClockLib/RealTimeClockLib.inf +++ /dev/null @@ -1,41 +0,0 @@ -#/** @file -# -# Copyright (c) 2015, Hisilicon Limited. All rights reserved. -# Copyright (c) 2015, Linaro Limited. All rights reserved. -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -#**/ - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D RealTimeClockLibVirtual - FILE_GUID =3D 432B35C1-A0CC-4720-A4B9-1EFD70050107 - MODULE_TYPE =3D BASE - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D RealTimeClockLib - -[Sources.common] - RealTimeClockLib.c - -[Packages] - MdePkg/MdePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - ArmPkg/ArmPkg.dec - OpenPlatformPkg/OpenPlatformPkg.dec - -[LibraryClasses] - IoLib - UefiLib - DebugLib - PcdLib - DxeServicesTableLib - TimeBaseLib - UefiRuntimeLib - ArmLib - -[Guids] - gEfiEventVirtualAddressChangeGuid - -[Pcd] - gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz diff --git a/Silicon/Hisilicon/Library/VirtualRealTimeClockLib/RealTimeCloc= kLib.c b/Silicon/Hisilicon/Library/VirtualRealTimeClockLib/RealTimeClockLib= .c deleted file mode 100644 index 60edbce0f158..000000000000 --- a/Silicon/Hisilicon/Library/VirtualRealTimeClockLib/RealTimeClockLib.c +++ /dev/null @@ -1,423 +0,0 @@ -/** @file - Implement EFI RealTimeClock runtime services via RTC Lib. - - Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
- Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
- Copyright (c) 2015, Hisilicon Limited. All rights reserved.
- Copyright (c) 2015, Linaro Limited. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - - Based on the files under ArmPlatformPkg/Library/PL031RealTimeClockLib/PL= 031RealTimeClockLib.inf - -**/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include - -STATIC CONST CHAR16 mTimeZoneVariableName[] =3D L"PV660VirtualRt= cTimeZone"; -STATIC CONST CHAR16 mDaylightVariableName[] =3D L"PV660VirtualRt= cDaylight"; -STATIC EFI_EVENT mRtcVirtualAddrChangeEvent; -STATIC EFI_RUNTIME_SERVICES *mRT; - - -STATIC INTN mEpochDiff =3D 0; - -/** - 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; - UINT64 Temp; - UINT32 EpochSeconds; - INT16 TimeZone =3D 0; - UINT8 Daylight =3D 0; - UINTN Size; - - // Ensure Time is a valid pointer - if (Time =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } - - ArmArchTimerReadReg(CntPct,&Temp); - - // UINT32 force convertion for PC-LINT - EpochSeconds =3D mEpochDiff + Temp / (UINT32) PcdGet32(PcdArmArchTimerFr= eqInHz); - - // Get the current time zone information from non-volatile storage - Size =3D sizeof (TimeZone); - Status =3D mRT->GetVariable ( - (CHAR16 *)mTimeZoneVariableName, - &gEfiCallerIdGuid, - NULL, - &Size, - (VOID *)&TimeZone - ); - - if (EFI_ERROR (Status)) { - ASSERT(Status !=3D EFI_INVALID_PARAMETER); - ASSERT(Status !=3D EFI_BUFFER_TOO_SMALL); - - if (Status !=3D EFI_NOT_FOUND) - goto EXIT; - - // The time zone variable does not exist in non-volatile storage, so c= reate it. - Time->TimeZone =3D EFI_UNSPECIFIED_TIMEZONE; - // Store it - Status =3D mRT->SetVariable ( - (CHAR16 *)mTimeZoneVariableName, - &gEfiCallerIdGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_A= CCESS | EFI_VARIABLE_RUNTIME_ACCESS, - Size, - (VOID *)&(Time->TimeZone) - ); - if (EFI_ERROR (Status)) { - DEBUG (( - EFI_D_ERROR, - "LibGetTime: Failed to save %s variable to non-volatile storage, S= tatus =3D %r\n", - mTimeZoneVariableName, - Status - )); - goto EXIT; - } - } else { - // Got the time zone - Time->TimeZone =3D TimeZone; - - // Check TimeZone bounds: -1440 to 1440 or 2047 - if (((Time->TimeZone < -1440) || (Time->TimeZone > 1440)) - && (Time->TimeZone !=3D EFI_UNSPECIFIED_TIMEZONE)) { - Time->TimeZone =3D EFI_UNSPECIFIED_TIMEZONE; - } - - // Adjust for the correct time zone - if (Time->TimeZone !=3D EFI_UNSPECIFIED_TIMEZONE) { - EpochSeconds +=3D Time->TimeZone * SEC_PER_MIN; - } - } - - // Get the current daylight information from non-volatile storage - Size =3D sizeof (Daylight); - Status =3D mRT->GetVariable ( - (CHAR16 *)mDaylightVariableName, - &gEfiCallerIdGuid, - NULL, - &Size, - (VOID *)&Daylight - ); - - if (EFI_ERROR (Status)) { - ASSERT(Status !=3D EFI_INVALID_PARAMETER); - ASSERT(Status !=3D EFI_BUFFER_TOO_SMALL); - - if (Status !=3D EFI_NOT_FOUND) - goto EXIT; - - // The daylight variable does not exist in non-volatile storage, so cr= eate it. - Time->Daylight =3D 0; - // Store it - Status =3D mRT->SetVariable ( - (CHAR16 *)mDaylightVariableName, - &gEfiCallerIdGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_A= CCESS | EFI_VARIABLE_RUNTIME_ACCESS, - Size, - (VOID *)&(Time->Daylight) - ); - if (EFI_ERROR (Status)) { - DEBUG (( - EFI_D_ERROR, - "LibGetTime: Failed to save %s variable to non-volatile storage, S= tatus =3D %r\n", - mDaylightVariableName, - Status - )); - goto EXIT; - } - } else { - // Got the daylight information - Time->Daylight =3D Daylight; - - // Adjust for the correct period - if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) =3D=3D EFI_TIME_IN_DAYLIGH= T) { - // Convert to adjusted time, i.e. spring forwards one hour - EpochSeconds +=3D SEC_PER_HOUR; - } - } - - // Convert from internal 32-bit time to UEFI time - EpochToEfiTime (EpochSeconds, Time); - - // Update the Capabilities info - if (Capabilities !=3D NULL) { - Capabilities->Resolution =3D 1; - // Accuracy in ppm multiplied by 1,000,000, e.g. for 50ppm set 50,000,= 000 - - Capabilities->Accuracy =3D PcdGet32 (PcdArmArchTimerFreqInHz); - // FALSE: Setting the time does not clear the values below the resolut= ion level - Capabilities->SetsToZero =3D FALSE; - } - - EXIT: - 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; - UINTN EpochSeconds; - UINTN Temp; - - // Check the input parameters are within the range specified by UEFI - if (!IsTimeValid (Time)) { - Status =3D EFI_INVALID_PARAMETER; - goto EXIT; - } - - // Because the PL031 is a 32-bit counter counting seconds, - // the maximum time span is just over 136 years. - // Time is stored in Unix Epoch format, so it starts in 1970, - // Therefore it can not exceed the year 2106. - if ((Time->Year < 1970) || (Time->Year >=3D 2106)) { - Status =3D EFI_UNSUPPORTED; - goto EXIT; - } - - EpochSeconds =3D EfiTimeToEpoch (Time); - - // Adjust for the correct time zone, i.e. convert to UTC time zone - if (Time->TimeZone !=3D EFI_UNSPECIFIED_TIMEZONE) { - EpochSeconds -=3D Time->TimeZone * SEC_PER_MIN; - } - - // TODO: Automatic Daylight activation - - // Adjust for the correct period - if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) =3D=3D EFI_TIME_IN_DAYLIGHT)= { - // Convert to un-adjusted time, i.e. fall back one hour - EpochSeconds -=3D SEC_PER_HOUR; - } - - ArmArchTimerReadReg(CntPct,&Temp); - - // UINT32 force convertion for PC-LINT - mEpochDiff =3D EpochSeconds - Temp / (UINT32) PcdGet32(PcdArmArchTimerFr= eqInHz); - - // The accesses to Variable Services can be very slow, because we may be= writing to Flash. - // Do this after having set the RTC. - - // Save the current time zone information into non-volatile storage - Status =3D mRT->SetVariable ( - (CHAR16 *)mTimeZoneVariableName, - &gEfiCallerIdGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACC= ESS | EFI_VARIABLE_RUNTIME_ACCESS, - sizeof (Time->TimeZone), - (VOID *)&(Time->TimeZone) - ); - if (EFI_ERROR (Status)) { - DEBUG (( - EFI_D_ERROR, - "LibSetTime: Failed to save %s variable to non-volatile storage, S= tatus =3D %r\n", - mTimeZoneVariableName, - Status - )); - goto EXIT; - } - - // Save the current daylight information into non-volatile storage - Status =3D mRT->SetVariable ( - (CHAR16 *)mDaylightVariableName, - &gEfiCallerIdGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACC= ESS | EFI_VARIABLE_RUNTIME_ACCESS, - sizeof(Time->Daylight), - (VOID *)&(Time->Daylight) - ); - if (EFI_ERROR (Status)) { - DEBUG (( - EFI_D_ERROR, - "LibSetTime: Failed to save %s variable to non-volatile storage, Sta= tus =3D %r\n", - mDaylightVariableName, - Status - )); - goto EXIT; - } - - EXIT: - 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; -} - -/** - 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. - // - EfiConvertPointer (0x0, (VOID**)&mRT); - return; -} - -/** - 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; - - // Setup the setters and getters - gRT->GetTime =3D LibGetTime; - gRT->SetTime =3D LibSetTime; - gRT->GetWakeupTime =3D LibGetWakeupTime; - gRT->SetWakeupTime =3D LibSetWakeupTime; - - mRT =3D gRT; - - // Install the protocol - Handle =3D NULL; - Status =3D gBS->InstallMultipleProtocolInterfaces ( - &Handle, - &gEfiRealTimeClockArchProtocolGuid, NULL, - NULL - ); - ASSERT_EFI_ERROR (Status); - - // - // Register for the virtual address change event - // - Status =3D gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - LibRtcVirtualNotifyEvent, - NULL, - &gEfiEventVirtualAddressChangeGuid, - &mRtcVirtualAddrChangeEvent - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109547): https://edk2.groups.io/g/devel/message/109547 Mute This Topic: https://groups.io/mt/101914656/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-