From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by mx.groups.io with SMTP id smtpd.web12.213.1630643454472497441 for ; Thu, 02 Sep 2021 21:30:54 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Z3S1EBvJ; spf=pass (domain: gmail.com, ip: 209.85.160.182, mailfrom: benjamin.doron00@gmail.com) Received: by mail-qt1-f182.google.com with SMTP id s32so3569160qtc.12 for ; Thu, 02 Sep 2021 21:30:54 -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=Z3S1EBvJymD3O+TXy/zqV3NcH6/ilrD6hXfZyzZxWi8sXTQfs8HJ6oOuwG7oS/6+BG nrjqgDPhUhpI6pDzs04uITIkhuIFrUth3+HeENDHjt2dLCftIIkAjIfYpamX+2fFKhGH TeUJa2yO5/iAioNJ6noHZOUQnM78tamwvWBKMabIcXwozE2JJnJ3BUPwYNasWFsR6DRE zrYnpOe50xc4sOLAEsBeNO7abooQ4kjFmRrAeyVfqooY7mdFshAOX2ABdwQ79pJXNyoB MSaU+8TRGmtTSXk0UleWWPx2J+IqoJepISy/Wy0rA0I99GSVGiiMFUGE3sfLKAZemYxc 40gg== 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=RrRTsizq8W0PfFnHr1oFp2GGq724JOrEcWipxZAt1Tjs5FY1dB0GymrEP/H68S2xT0 dIhjNcltKL4HuRRaf+fBIgloUCaTj0MCR/RaLrPJ2P1T7XT6dg9rARQEHIMP7rJeVxC7 ELVl/G+HxclIfHKM2jiiYijoJDVjcZcq4WjpjGxcCBCQI7IFZAvlikkSde7bnrbGkHi8 YUjUOztY0s5oe1Xjgj1llQSoEtWF5qexE5nRXv2te2bQYeSHflAFsjZquGEKoPdAjUZz W+ndCLdQDLhBGayicn1jfszGzIxbKsmed1/6xfY3eM8WtXyLxtZ5j2KAMCvGRlIZb6Um XT6Q== X-Gm-Message-State: AOAM5309k5gjgwkIGGrdO3xR2WtXWfqXQz2mq4pa4UnCEgf/oGiqqfA4 8F8ybmstVcH+tFE1DgTlu/sfalM0Xyc= X-Google-Smtp-Source: ABdhPJzPLZNmMPN/qVnOyNlrXUApY9GeQ8LWJF9vZMnQVowOt48ld1GacHL+4BQ32efuoEfSDpwp7Q== X-Received: by 2002:ac8:5d51:: with SMTP id g17mr1964164qtx.139.1630643453522; Thu, 02 Sep 2021 21:30:53 -0700 (PDT) Return-Path: Received: from benjamind-benjamindomain.. ([2607:f2c0:e98c:24:56bd:6598:f34d:ffdf]) by smtp.gmail.com with ESMTPSA id i16sm2411418qtw.15.2021.09.02.21.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 21:30:53 -0700 (PDT) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone Subject: [edk2-platforms][PATCH v1 2/2] KabylakeOpenBoardPkg/AspireVn7Dash572G/DxeBoardInitLib: Fix byte shift Date: Fri, 3 Sep 2021 00:30:20 -0400 Message-Id: <20210903043020.20233-2-benjamin.doron00@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210903043020.20233-1-benjamin.doron00@gmail.com> References: <20210903043020.20233-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