From nobody Mon Feb 9 19:05:44 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+109559+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+109559+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697101831; cv=none; d=zohomail.com; s=zohoarc; b=DUC9bzlpmwPH6qBUNw6vCmKgBhNUE1+43CVSVmIyRKhOkQFKS+eMPCBIWPi1996Pz7Sx3mlBJx7luY2AKqjJAQsxksQgkOo8EQupOaTEf7OJd840XiXYz9ygGNMFA6ONUGiLj1x2C1wcYV1SrImN1Xq9UXUvaNMMuNvmxjjK69Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697101831; 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=EPOeLxNWXamRn9zIvYFvgMHcHX0K8hKUUQ72cwFiE7o=; b=FqOegWuijSAtNNBRhY1oJNDUfYC3IvwM3AYlqz+i9FCspladKFeeo0HIVQKLRnl6tUmEHzSq0LcQf8rk8mR0eBpytm25+aI8vdYM4S9DjtEL5GWIXhA9m62hiw6LSYAMSZGfTuMyUy3PMexJGejWMLAKxGTTExXhOf5ykJasOdM= 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+109559+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 1697101831892652.3112344046101; Thu, 12 Oct 2023 02:10:31 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=EPOeLxNWXamRn9zIvYFvgMHcHX0K8hKUUQ72cwFiE7o=; 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=1697101831; v=1; b=XaumCp3sDAvCLuW1pZiluwn3BOY0B6pVSCkCKUZB28W0MbnyKodYic5UGkv7Zpv8jMPJCeS7 QRtXHneYmGsIm1D/JC5g5MCcBECua9RnKDi36+MGITmhPacCB7SsBkPt+NQeSt+X/av4tblwZ01 2ArCq/Y8EqD+X0m5Ss6bY8BA= X-Received: by 127.0.0.2 with SMTP id 0DwmYY1788612xM5pRVnKWKB; Thu, 12 Oct 2023 02:10:31 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.7101.1697101830760793659 for ; Thu, 12 Oct 2023 02:10:30 -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-338-IR5yf3OfNxeD7asevwIdNw-1; Thu, 12 Oct 2023 05:10:04 -0400 X-MC-Unique: IR5yf3OfNxeD7asevwIdNw-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 5BF59811E91; Thu, 12 Oct 2023 09:10:04 +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 7C01D40C6F79; Thu, 12 Oct 2023 09:10:03 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Ard Biesheuvel , Leif Lindholm , Wenyi Xie Subject: [edk2-devel] [edk2-platforms PATCH 08/19] Hisilicon: drop unused DS3231RealTimeClockLib instance Date: Thu, 12 Oct 2023 11:09:39 +0200 Message-Id: <20231012090950.108577-9-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: HoGzniJYMjbjFYhpVf0X9qxqx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697101833601100003 Content-Type: text/plain; charset="utf-8"; x-default="true" Edk2-platforms contains two DS3231RealTimeClockLib instances: - Silicon/Hisilicon/Library/DS3231RealTimeClockLib - Platform/Hisilicon/D03/Library/DS3231RealTimeClockLib The latter is still used (by the D03 and D05 platforms), but the former has not been referenced since commit 478282ea28c7 ("Hisilicon/D02: Remove D02 platform", 2018-08-08). Remove the unused library instance. (There's no reference in edk2-non-osi either.) 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/DS3231RealTimeClockLib/DS3231RealTimeClockLib.in= f | 43 -- Silicon/Hisilicon/Library/DS3231RealTimeClockLib/DS3231RealTimeClock.h = | 172 -------- Silicon/Hisilicon/Library/DS3231RealTimeClockLib/DS3231RealTimeClockLib.c = | 427 -------------------- 3 files changed, 642 deletions(-) diff --git a/Silicon/Hisilicon/Library/DS3231RealTimeClockLib/DS3231RealTim= eClockLib.inf b/Silicon/Hisilicon/Library/DS3231RealTimeClockLib/DS3231Real= TimeClockLib.inf deleted file mode 100644 index 35042e07ed1f..000000000000 --- a/Silicon/Hisilicon/Library/DS3231RealTimeClockLib/DS3231RealTimeClockL= ib.inf +++ /dev/null @@ -1,43 +0,0 @@ -#/** @file -# -# Copyright (c) 2006, Intel Corporation. All rights reserved.
-# Copyright (c) 2011-2013, 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/P= L031RealTimeClockLib.inf -# -#**/ - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D DS3231RealTimeClockLib - FILE_GUID =3D 5FD8127D-11E1-488F-8CF1-A143157D6BF0 - MODULE_TYPE =3D BASE - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D RealTimeClockLib - -[Sources.common] - DS3231RealTimeClockLib.c - -[Packages] - MdePkg/MdePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - Silicon/Hisilicon/HisiPkg.dec - -[LibraryClasses] - IoLib - UefiLib - DebugLib - PcdLib - I2CLib - TimeBaseLib - TimerLib -# Use EFiAtRuntime to check stage - UefiRuntimeLib - -[Pcd] - diff --git a/Silicon/Hisilicon/Library/DS3231RealTimeClockLib/DS3231RealTim= eClock.h b/Silicon/Hisilicon/Library/DS3231RealTimeClockLib/DS3231RealTimeC= lock.h deleted file mode 100644 index da18d0f5589e..000000000000 --- a/Silicon/Hisilicon/Library/DS3231RealTimeClockLib/DS3231RealTimeClock.h +++ /dev/null @@ -1,172 +0,0 @@ -/** @file -* -* Copyright (c) 2011, ARM Limited. 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/P= L031RealTimeClockLib.inf -**/ - - -#ifndef __DS3231_REAL_TIME_CLOCK_H__ -#define __DS3231_REAL_TIME_CLOCK_H__ - -#define DS3231_REGADDR_SECONDS 0x00 -#define DS3231_REGADDR_MIUTES 0x01 -#define DS3231_REGADDR_HOURS 0x02 -#define DS3231_REGADDR_DAY 0x03 -#define DS3231_REGADDR_DATE 0x04 -#define DS3231_REGADDR_MONTH 0x05 -#define DS3231_REGADDR_YEAR 0x06 -#define DS3231_REGADDR_ALARM1SEC 0x07 -#define DS3231_REGADDR_ALARM1MIN 0x08 -#define DS3231_REGADDR_ALARM1HOUR 0x09 -#define DS3231_REGADDR_ALARM1DAY 0x0A -#define DS3231_REGADDR_ALARM2MIN 0x0B -#define DS3231_REGADDR_ALARM2HOUR 0x0C -#define DS3231_REGADDR_ALARM2DAY 0x0D -#define DS3231_REGADDR_CONTROL 0x0E -#define DS3231_REGADDR_STATUS 0x0F -#define DS3231_REGADDR_AGOFFSET 0x10 -#define DS3231_REGADDR_TEMPMSB 0x11 -#define DS3231_REGADDR_TEMPLSB 0x12 - - -typedef union { - struct{ - UINT8 A1IE:1; - UINT8 A2IE:1; - UINT8 INTCN:1; - UINT8 RSV:2; - UINT8 CONV:1; - UINT8 BBSQW:1; - UINT8 EOSC_N:1; - }bits; - UINT8 u8; -}RTC_DS3231_CONTROL; - -typedef union { - struct{ - UINT8 A1F:1; - UINT8 A2F:1; - UINT8 BSY:1; - UINT8 EN32KHZ:2; - UINT8 Rsv:3; - UINT8 OSF:1; - }bits; - UINT8 u8; -}RTC_DS3231_STATUS; - - -typedef union { - struct{ - UINT8 Data:7; - UINT8 Sign:1; - }bits; - UINT8 u8; -}RTC_DS3231_AGOFFSET; - -typedef union { - struct{ - UINT8 Data:7; - UINT8 Sign:1; - }bits; - UINT8 u8; -}RTC_DS3231_TEMPMSB; - - -typedef union { - struct{ - UINT8 Rsv:6; - UINT8 Data:2; - }bits; - UINT8 u8; -}RTC_DS3231_TEMPLSB; - -typedef union { - struct{ - UINT8 Seconds:4; - UINT8 Seconds10:3; - UINT8 Rsv:1; - }bits; - UINT8 u8; -}RTC_DS3231_SECONDS; - -typedef union { - struct{ - UINT8 Minutes:4; - UINT8 Minutes10:3; - UINT8 Rsv:1; - }bits; - UINT8 u8; -}RTC_DS3231_MINUTES; - -typedef union { - struct{ - UINT8 Hour:4; - UINT8 Hours10:1; - UINT8 PM_20Hours:1; - UINT8 Hour24_n:1; - UINT8 Rsv:1; - }bits; - UINT8 u8; -}RTC_DS3231_HOURS; - -typedef union { - struct{ - UINT8 Day:3; - UINT8 Rsv:5; - }bits; - UINT8 u8; -}RTC_DS3231_DAY; - -typedef union { - struct{ - UINT8 Month:4; - UINT8 Month10:1; - UINT8 Rsv:2; - UINT8 Century:1; - }bits; - UINT8 u8; -}RTC_DS3231_MONTH; - -typedef union { - struct{ - UINT8 Year:4; - UINT8 Year10:4; - }bits; - UINT8 u8; -}RTC_DS3231_YEAR; - -typedef union { - struct{ - UINT8 Seconds:4; - UINT8 Seconds10:3; - UINT8 A1M1:1; - }bits; - UINT8 u8; -}RTC_DS3231_ALARM1SEC; - -typedef union { - struct{ - UINT8 Minutes:4; - UINT8 Minutes10:3; - UINT8 A1M2:1; - }bits; - UINT8 u8; -}RTC_DS3231_ALARM1MIN; - -typedef union { - struct{ - UINT8 Hour:4; - UINT8 Hours10:1; - UINT8 PM_20Hours:1; - UINT8 Hours24:1; - UINT8 A1M3:1; - }bits; - UINT8 u8; -}RTC_DS3231_ALARM1HOUR; - -#endif diff --git a/Silicon/Hisilicon/Library/DS3231RealTimeClockLib/DS3231RealTim= eClockLib.c b/Silicon/Hisilicon/Library/DS3231RealTimeClockLib/DS3231RealTi= meClockLib.c deleted file mode 100644 index 30dc86414232..000000000000 --- a/Silicon/Hisilicon/Library/DS3231RealTimeClockLib/DS3231RealTimeClockL= ib.c +++ /dev/null @@ -1,427 +0,0 @@ -/** @file - Implement EFI RealTimeClock runtime services via RTC Lib. - - Currently this driver does not support runtime virtual calling. - - Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
- Copyright (c) 2011-2013, 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 -// Use EfiAtRuntime to check stage -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "DS3231RealTimeClock.h" - -extern I2C_DEVICE gRtcDevice; - -STATIC BOOLEAN mDS3231Initialized =3D FALSE; - -EFI_STATUS -IdentifyDS3231 ( - VOID - ) -{ - EFI_STATUS Status; - - Status =3D EFI_SUCCESS; - return Status; -} - -EFI_STATUS -InitializeDS3231 ( - VOID - ) -{ - EFI_STATUS Status; - I2C_DEVICE Dev; - RTC_DS3231_CONTROL Temp; - RTC_DS3231_HOURS Hours; - - // Prepare the hardware - (VOID)IdentifyDS3231(); - - (VOID)CopyMem (&Dev, &gRtcDevice, sizeof (Dev)); - - Status =3D I2CInit(Dev.Socket,Dev.Port,Normal); - if (EFI_ERROR (Status)) { - goto EXIT; - } - // Ensure interrupts are masked. We do not want RTC interrupts in UEFI - Status =3D I2CRead(&Dev,DS3231_REGADDR_CONTROL,1,&Temp.u8); - if (EFI_ERROR (Status)) { - goto EXIT; - } - Temp.bits.INTCN =3D 0; - Status =3D I2CWrite(&Dev,DS3231_REGADDR_CONTROL,1,&Temp.u8); - if (EFI_ERROR (Status)) { - goto EXIT; - } - - MicroSecondDelay(2000); - Status =3D I2CRead(&Dev,DS3231_REGADDR_HOURS,1,&Hours.u8); - if (EFI_ERROR (Status)) { - goto EXIT; - } - Hours.bits.Hour24_n =3D 0; - Status =3D I2CWrite(&Dev,DS3231_REGADDR_HOURS,1,&Hours.u8); - if (EFI_ERROR (Status)) { - goto EXIT; - } - - - mDS3231Initialized =3D TRUE; - - EXIT: - return Status; -} - - -/** - 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; - UINT8 Temp; - UINT8 BaseHour =3D 0; - UINT16 BaseYear =3D 1900; - - I2C_DEVICE Dev; - - // Ensure Time is a valid pointer - if (NULL =3D=3D Time) { - return EFI_INVALID_PARAMETER; - } - - // Initialize the hardware if not already done - if (!mDS3231Initialized) { - Status =3D InitializeDS3231 (); - if (EFI_ERROR (Status)) { - return EFI_NOT_READY; - } - } - - (VOID)CopyMem (&Dev, &gRtcDevice, sizeof (Dev)); - - - Status |=3D I2CRead(&Dev,DS3231_REGADDR_MONTH,1,&Temp); - - Time->Month =3D ((Temp>>4)&1)*10+(Temp&0x0F); - - - if(Temp&0x80){ - BaseYear =3D 2000; - } - - Status |=3D I2CRead(&Dev,DS3231_REGADDR_YEAR,1,&Temp); - - Time->Year =3D BaseYear+(Temp>>4) *10 + (Temp&0x0F); - - - Status |=3D I2CRead(&Dev,DS3231_REGADDR_DATE,1,&Temp); - - Time->Day =3D ((Temp>>4)&3) *10 + (Temp&0x0F); - - - Status |=3D I2CRead(&Dev,DS3231_REGADDR_HOURS,1,&Temp); - - BaseHour =3D 0; - if((Temp&0x30) =3D=3D 0x30){ - return EFI_DEVICE_ERROR; - }else if(Temp&0x20){ - BaseHour =3D 20; - }else if(Temp&0x10){ - BaseHour =3D 10; - } - Time->Hour =3D BaseHour + (Temp&0x0F); - - - Status |=3D I2CRead(&Dev,DS3231_REGADDR_MIUTES,1,&Temp); - - Time->Minute =3D ((Temp>>4)&7) * 10 + (Temp&0x0F); - - - Status |=3D I2CRead(&Dev,DS3231_REGADDR_SECONDS,1,&Temp); - - Time->Second =3D (Temp>>4) * 10 + (Temp&0x0F); - - Time->Nanosecond =3D 0; - Time->Daylight =3D 0; - Time->TimeZone =3D EFI_UNSPECIFIED_TIMEZONE; - - if((EFI_ERROR(Status)) || (!IsTimeValid(Time)) || ((Time->Year - BaseYea= r) > 99)) { - return EFI_DEVICE_ERROR; - } - - return EFI_SUCCESS; -} - - -/** - 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; - I2C_DEVICE Dev; - UINT8 Temp; - UINT16 BaseYear =3D 1900; - - // Check the input parameters are within the range specified by UEFI - if(!IsTimeValid(Time)){ - return EFI_INVALID_PARAMETER; - } - - // Initialize the hardware if not already done - if (!mDS3231Initialized) { - Status =3D InitializeDS3231 (); - if (EFI_ERROR (Status)) { - goto EXIT; - } - } - - (VOID)CopyMem (&Dev, &gRtcDevice, sizeof (Dev)); - - Temp =3D ((Time->Second/10)<<4) | (Time->Second%10); - MicroSecondDelay(1000); - Status =3D I2CWrite(&Dev,DS3231_REGADDR_SECONDS,1,&Temp); - if(EFI_ERROR (Status)){ - goto EXIT; - } - - Temp =3D ((Time->Minute/10)<<4) | (Time->Minute%10); - MicroSecondDelay(1000); - Status =3D I2CWrite(&Dev,DS3231_REGADDR_MIUTES,1,&Temp); - if(EFI_ERROR (Status)){ - goto EXIT; - } - - Temp =3D 0; - if(Time->Hour > 19){ - Temp =3D 2; - } else if(Time->Hour > 9){ - Temp =3D 1; - } - Temp =3D (Temp << 4) | (Time->Hour%10); - MicroSecondDelay(1000); - Status =3D I2CWrite(&Dev,DS3231_REGADDR_HOURS,1,&Temp); - if(EFI_ERROR (Status)){ - goto EXIT; - } - - Temp =3D ((Time->Day/10)<<4) | (Time->Day%10); - MicroSecondDelay(1000); - Status =3D I2CWrite(&Dev,DS3231_REGADDR_DATE,1,&Temp); - if(EFI_ERROR (Status)){ - goto EXIT; - } - - Temp =3D 0; - if(Time->Year >=3D 2000){ - Temp =3D 0x8; - BaseYear =3D 2000; - } - - if(Time->Month > 9){ - Temp |=3D 0x1; - } - Temp =3D (Temp<<4) | (Time->Month%10); - MicroSecondDelay(1000); - Status =3D I2CWrite(&Dev,DS3231_REGADDR_MONTH,1,&Temp); - if(EFI_ERROR (Status)){ - goto EXIT; - } - - Temp =3D (((Time->Year-BaseYear)/10)<<4) | (Time->Year%10); - MicroSecondDelay(1000); - Status =3D I2CWrite(&Dev,DS3231_REGADDR_YEAR,1,&Temp); - if(EFI_ERROR (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; -} - - - -/** - 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; - - Status =3D gRT->GetTime (&EfiTime, NULL); - if(EFI_ERROR (Status) || (EfiTime.Year < 2000) || (EfiTime.Year > 2099)){ - EfiTime.Year =3D 2000; - EfiTime.Month =3D 1; - EfiTime.Day =3D 1; - EfiTime.Hour =3D 0; - EfiTime.Minute =3D 0; - EfiTime.Second =3D 0; - EfiTime.Nanosecond =3D 0; - EfiTime.Daylight =3D 0; - EfiTime.TimeZone =3D EFI_UNSPECIFIED_TIMEZONE; - - 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; -} -=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 (#109559): https://edk2.groups.io/g/devel/message/109559 Mute This Topic: https://groups.io/mt/101914671/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-