From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by mx.groups.io with SMTP id smtpd.web09.535.1630647190674686923 for ; Thu, 02 Sep 2021 22:33:10 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hLsRVXel; spf=pass (domain: gmail.com, ip: 209.85.222.179, mailfrom: benjamin.doron00@gmail.com) Received: by mail-qk1-f179.google.com with SMTP id ay33so4722777qkb.10 for ; Thu, 02 Sep 2021 22:33:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dC41/6kNIBMWD42jp9plf2BGc7mmvzuzAmnPAYwW+a8=; b=hLsRVXelGrNutSgGOGl8/26nE4C6CoTGUAyqt+biMGr+0oHr6cCenJF4HR2SLzR3gg zdIAmZa9qtpF67NaXLOxHftUI+kqR1LhEzhGL+3w/yHLsF4KijbLODcx8UlKoSUqnYyp wuS30oKCTSmHTwLgqPtfmtsJhnwKUg1eGfWuYstisvbVYVDd9JIDK6FpnlEzdthQjJ7h ZSOPPlZIZQTYZAuvlvk59eAbWcLFaEEiQzSJK3ZerfSrk29TdoVkmycXoNyhC2/LHtMb H+3VZQSVb3XHKrnQItxRwL1wcrY20WIjAvJtXbI6UeJUxJhbbum46dflxAuZIywtEy92 aBCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dC41/6kNIBMWD42jp9plf2BGc7mmvzuzAmnPAYwW+a8=; b=CpoVJRKAvt6kP0K0aCf0E9NF6LsKHeK+o6fhHDiIRPJxN7D95tbClegZPWJ2AmMBLt amXE/QPsSDSmGyiMSNgvHF1aPqoiGaM8KT1VUjb93lPf3ed0ZIzFM8JHr8o6hxxDlspU LqbrJWOWN4ayepQE1ga4fO7yPIVJ39bl28kcC9sT11uLTr3rxhbVzgUio1z5ptnwtVyK SYLvT6vs38oBGNKg0Zrx0DN4plqHynI8OJF72KuleS+d/GsbaC4MsYRf9HpEzVJM+7ts U/TLIP7ol0Dp9cAHfiAoQaHmB1NEaTDgt9V8ZXvSKg2UL4x61MIr7Wid4B+DIwYlJRTm IqHw== X-Gm-Message-State: AOAM532u9364WGKezCod8wsgVweON6E/G6aF+ih8TKx0hp9/sIIOIjow i+Qk9AZXGNQdtMkj1RS+iYVsueOUoLk= X-Google-Smtp-Source: ABdhPJyINdzkRRHrilykH6eReIEiSJ9dahT2vu5J3hAjhasUztlLR7mOXNyyWazytYVfDB7y/jlF6g== X-Received: by 2002:a37:a88a:: with SMTP id r132mr1744382qke.212.1630647189444; Thu, 02 Sep 2021 22:33:09 -0700 (PDT) Return-Path: Received: from benjamind-benjamindomain.. ([2607:f2c0:e98c:24:56bd:6598:f34d:ffdf]) by smtp.gmail.com with ESMTPSA id y19sm2439020qtv.21.2021.09.02.22.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 22:33:09 -0700 (PDT) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone Subject: [edk2-platforms][PATCH v3 2/2] KabylakeOpenBoardPkg/AspireVn7Dash572G/DxeBoardInitLib: Fix byte shift Date: Fri, 3 Sep 2021 01:32:41 -0400 Message-Id: <20210903053241.22928-2-benjamin.doron00@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210903053241.22928-1-benjamin.doron00@gmail.com> References: <20210903051930.21649-1-benjamin.doron00@gmail.com> <20210903053241.22928-1-benjamin.doron00@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Since the time is sent to the EC byte-by-byte, perform shift by a byte multiple of bits. Also update some comments. Cc: Chasel Chiu Cc: Nate DeSimone Signed-off-by: Benjamin Doron --- Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib= /DxeBoardInitLib.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/DxeBoardInitLib.c b/Platform/Intel/KabylakeOpenBoardPkg/Aspire= Vn7Dash572G/Library/BoardInitLib/DxeBoardInitLib.c index 906b2d265092..4bce51886e3a 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardInitLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardInitLib.c @@ -24,7 +24,7 @@ EcSendTime ( {=0D EFI_STATUS Status;=0D EFI_TIME EfiTime;=0D - // TODO: Confirm this is really INTN and not UINTN=0D + // Time could be negative (before 2016)=0D INTN EcTime;=0D UINT8 EcTimeByte;=0D INTN Index;=0D @@ -36,7 +36,7 @@ EcSendTime ( return;=0D }=0D =0D - // Time since year of release?=0D + // Time since year of release. Note that "century" is ignored.=0D EcTime =3D ((EfiTime.Year << 26) + (EfiTime.Month << 22) + (EfiTime.Day = << 17)=0D + (EfiTime.Hour << 12) + (EfiTime.Minute << 6) + (EfiTime.Second)= =0D /* 16 years */=0D @@ -45,7 +45,8 @@ EcSendTime ( DEBUG ((DEBUG_INFO, "EC: reporting present time 0x%x\n", EcTime));=0D SendEcCommand (0xE0);=0D for (Index =3D 0; Index < 4; Index++) {=0D - EcTimeByte =3D EcTime >> Index;=0D + // Shift bytes=0D + EcTimeByte =3D EcTime >> Index*8;=0D DEBUG ((DEBUG_INFO, "EC: Sending 0x%x (iteration %d)\n", EcTimeByte, I= ndex));=0D SendEcData (EcTimeByte);=0D }=0D @@ -61,13 +62,14 @@ EcSendTime ( =0D **/=0D VOID=0D -EcInit (=0D +EcRequestsTime (=0D VOID=0D )=0D {=0D UINT8 Dat;=0D =0D - /* Vendor's UEFI modules "notify" this protocol in RtKbcDriver */=0D + /* This is executed as protocol notify in vendor's RtKbcDriver when *Com= monService=0D + * protocol is installed. Effectively, this code could execute from the = entrypoint */=0D EcCmd90Read (0x79, &Dat);=0D if (Dat & BIT0) {=0D EcSendTime ();=0D @@ -86,7 +88,7 @@ BoardInitAfterPciEnumeration ( VOID=0D )=0D {=0D - EcInit ();=0D + EcRequestsTime ();=0D return EFI_SUCCESS;=0D }=0D =0D --=20 2.31.1