From nobody Sat May 4 23:53:12 2024 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+69335+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+69335+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1608568670; cv=none; d=zohomail.com; s=zohoarc; b=gxeL164F8G9txdXqOguzP9Gt9LSsXoRennXetc8QzYMmXaiLQrYYZ8gdj1uzOGn+vE3MJdYNrxdd5K7txGt8gie2PNueFIxZfxhheNS3ILZopKyKJdffY1MtLTnyq2F7Sudxh2gKexoOk0t3l3CVWpeDbasVhl5gMuHpQsxJTAE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608568670; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=f+2Pt0Q6xb05WQPOwoMd8+PAelNgSnb8rFH050QFPBY=; b=bcSBM+YjzzoZzpZMBzLDC9/QwVqAoKjLEr2tP2kngpaWOVI2wG+NNigngTCBsUo29E57Oi6nYuZU/52EIOjAt0opVd9MmaN4LsvN31sFrygTAE+e9gct38W8E8NhGSaDPvMQtXAcVg3O5zD+2Irl/jiJae3Lj3o08O0dWrKNT/Q= 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+69335+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1608568670047727.6591099035129; Mon, 21 Dec 2020 08:37:50 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6ASNYY1788612xOUkfYoW5ml; Mon, 21 Dec 2020 08:37:49 -0800 X-Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by mx.groups.io with SMTP id smtpd.web09.2392.1608568668538229169 for ; Mon, 21 Dec 2020 08:37:48 -0800 X-Received: by mail-lf1-f47.google.com with SMTP id x20so25070150lfe.12 for ; Mon, 21 Dec 2020 08:37:48 -0800 (PST) X-Gm-Message-State: lfOddkr34glwEWGI7pwEuan2x1787277AA= X-Google-Smtp-Source: ABdhPJwiDYkSjM6s3dRlBvAXMQ0yiM/ZiQwnNj8Fz5dIDyv5DRGSMSIOk+6gHKTTWSnZ4uarYaW/wQ== X-Received: by 2002:a2e:a377:: with SMTP id i23mr8241770ljn.103.1608568666372; Mon, 21 Dec 2020 08:37:46 -0800 (PST) X-Received: from gilgamesh.semihalf.com (193-106-246-138.noc.fibertech.net.pl. [193.106.246.138]) by smtp.gmail.com with ESMTPSA id t3sm2123196lfc.69.2020.12.21.08.37.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2020 08:37:45 -0800 (PST) From: "Marcin Wojtas" To: devel@edk2.groups.io Cc: leif@nuviainc.com, ard.biesheuvel@arm.com, mw@semihalf.com, jaz@semihalf.com, kostap@marvell.com Subject: [edk2-devel] [edk2-platforms PATCH] Marvell/RealTimeClockLib: Allow only Unix Epoch in LibSetWakeupTime Date: Mon, 21 Dec 2020 17:37:10 +0100 Message-Id: <20201221163710.19729-1-mw@semihalf.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,mw@semihalf.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1608568669; bh=JzqgBUuPIAVuWieDjOAjCV+w7rdZZ1J+FN+iEZqXaXA=; h=Cc:Date:From:Reply-To:Subject:To; b=XUrndPNXSii+ga3uiGni1zoePcXr+wCVF/7jnjvnAmKezL5FIzaJOypiXWGzKyB/qQG WGNcmEYXD4ZaLDblpLMcVMtvRRKt0W/BR/ciJb+iimmgbAzmG9eGvNUHw52cHnT8htnUt 3NXFLIphhepzwHqLxrBDLCoQS5xoq6PQbS4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Because the Armada RTC uses a 32-bit counter for 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. The issue emerged during ACS test case, which does not pass Unix Epoch-relative time and caused EfiTimeToEpoch to assert. Signed-off-by: Marcin Wojtas Reviewed-by: Laszlo Ersek --- Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c | 1= 0 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeCl= ockLib.c b/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeCloc= kLib.c index a811fd368e..40ab01ed41 100644 --- a/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c +++ b/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c @@ -179,6 +179,16 @@ LibSetWakeupTime ( { UINTN WakeupSeconds; =20 + // + // Because the Armada RTC uses a 32-bit counter for 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)) { + return EFI_UNSUPPORTED; + } + // Convert time to raw seconds WakeupSeconds =3D EfiTimeToEpoch (Time); if (WakeupSeconds > MAX_UINT32) { --=20 2.29.0 -=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 (#69335): https://edk2.groups.io/g/devel/message/69335 Mute This Topic: https://groups.io/mt/79129320/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-