From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) by mx.groups.io with SMTP id smtpd.web11.534.1630646402801698031 for ; Thu, 02 Sep 2021 22:20:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RqqHxJmk; spf=pass (domain: gmail.com, ip: 209.85.222.180, mailfrom: benjamin.doron00@gmail.com) Received: by mail-qk1-f180.google.com with SMTP id m21so4682174qkm.13 for ; Thu, 02 Sep 2021 22:20:02 -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=P0ZuCfNH57e1RE27H550WDy8q/1Jh1NIwKptO4e6pHM=; b=RqqHxJmkR+AeBigzEMHKDxAowWJgc3qms8Alg5ej5i/0pL/Rfs3ef+UX4aYe4GCmg3 +6veeqtuYB0JG+GET9BA2zbm+VneGFBb8eObbLOO9JXjR32mV9+3U85BZP5fIxLjfc2u vcEyqYuTSm7jQNYn8556n3ir5WYsvxeEIfOYB921TbAFe+Et0c9pdYcD5MDmwKRxat48 +BtH2zl/wf98qlsNgD7UnwHeKX/uUDAyR1ly5dHAuqgwjY04Z17vAajP5K8pY+6fk09y pSZ6voSeVNo6Ck8KoAj5VgP8hdVqRVgR3ttYLRFocHaC1f9z0XJ+ZxKDr3K8jkDYZM5E mwOw== 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=P0ZuCfNH57e1RE27H550WDy8q/1Jh1NIwKptO4e6pHM=; b=FomBdKIfrMoiKXlyuBfvUBw9/FOxsMdkjribMSk7WWACzmiB695FJ+6eD7irHm59qJ cdEpRZS9mzS4DdUkIBJR9sSOHkLiTC3y+45tOddQA9l98Kj4KdCpO8L/oF12VpCfYJC/ UKzzqJD204SICXfoqlqJ2SPesDJ6H8U1EN3mTjOzo+9FnrfJqDMJP2dGS2zS2lm1eAHN 4PC+EUEgO0SNoQmRE4Kie8kkBDzkiZbZWLHmv9Eq8WYAALECe1MRj+cPcgoTLNtpdedj UakTFCxh+BgEqQ1OyJOg9aj3bJdjaj6E6vnlZqsYVcQEulYBwytPzYyjBT7iOBfMSyWB q8Ig== X-Gm-Message-State: AOAM531+ObHpOguMdZb8FQO841Dbuy4+PZFaW6PmG3uM+VD1UB3fUqkz k8Vao8G/vEf+NDGttIScRjavw6087sc= X-Google-Smtp-Source: ABdhPJwrnxvfNrF6xcsTARtKKSjN81qhD7vhVr8pClw1Y0zJPSwEde3kaG9w+l6SxnE0Q+KRtRAMtA== X-Received: by 2002:a05:620a:2147:: with SMTP id m7mr1752866qkm.117.1630646401763; Thu, 02 Sep 2021 22:20:01 -0700 (PDT) Return-Path: Received: from benjamind-benjamindomain.. ([2607:f2c0:e98c:24:56bd:6598:f34d:ffdf]) by smtp.gmail.com with ESMTPSA id 90sm2528742qte.89.2021.09.02.22.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 22:20:01 -0700 (PDT) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone Subject: [edk2-platforms][PATCH v2 2/2] KabylakeOpenBoardPkg/AspireVn7Dash572G/DxeBoardInitLib: Fix byte shift Date: Fri, 3 Sep 2021 01:19:30 -0400 Message-Id: <20210903051930.21649-2-benjamin.doron00@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210903051930.21649-1-benjamin.doron00@gmail.com> References: <20210903051930.21649-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..d87cb006bf6f 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 RtKbcDriver when *CommonServic= e protocol=0D + * is installed. Effectively, this code could execute from the entrypoin= t */=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