From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) by mx.groups.io with SMTP id smtpd.web09.17700.1630896962652316389 for ; Sun, 05 Sep 2021 19:56:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=m64TV+PL; spf=pass (domain: gmail.com, ip: 209.85.222.177, mailfrom: benjamin.doron00@gmail.com) Received: by mail-qk1-f177.google.com with SMTP id p4so5637142qki.3 for ; Sun, 05 Sep 2021 19:56: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=dC41/6kNIBMWD42jp9plf2BGc7mmvzuzAmnPAYwW+a8=; b=m64TV+PLq8QKv1j6dBVDsqbwo84FdltfXXzWXD4h8Sd1cLnZr6BWt7Kbbro/I25qkq tbV+1anLU3zAIE+Dyctlhe4Lv6rBbiy9Te/GAUvwdRL5rmSONWVP0vShr6v0kUJGkN0R pJ002BtPwMruOwcLEW8Or/HmwBXEFAd0kBvOHtHSvSvNQs4b4EnD6lKB9mdfei3xhfh8 fowvM5/FvZWTiCfiTm8XLmlXxLdj5tkBRH3BL8cSvwvmaBfTxCkjlanlhyAM+DEzg65z ZQujVJNJgv6TKQ+Q5zW+a5tTa6pqUOJSH7q+b0qKSkeZRdg4PmZfjJQRZZVuo5mmqwIt jQHQ== 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=r8AfO+82YLZR/HnCz9vRANUvaqTbIj7/mcahAGgX0wljonDZ5UtjY3GnGWoxyrXixX KAtp3HC1C4Nz3NoMF7fPkGxP2Xmxge1YH8b0VBYQMjLjNLwBgl4COryW5pwutP9wZcul FU2ZBcXsDgSD83AoX7WYniyQkiOnbezINfCFiUcRpy7htFzLPR4udk0C2x9wIFFuDV2Y Hae5knEkgUbJqEqlSg4jIfy6nRIe37kebGEwEX5YsuOtCt2RqUl4f+3COUQQgZnXFjNX cq51mxAynpHT1BNtOa3Os12G5KezlW5n2Q58Ak7qmuyEG2dZNV3TUpfaYfvjYsn5qJe4 u5Xg== X-Gm-Message-State: AOAM5305n/rGVv3Gb+3Gxx+BKLVXn4TWFAiKQT7kKM0o5fUisMIIV7kh CGHlwqqh6mF7JZrIAt9IH6yt7fI2VgA= X-Google-Smtp-Source: ABdhPJzjTJrqqJMBAc6JSlRkTvDZM1n36fcPlRwhFPw3VljCKcRCFHhvuTW9ZJDPCFR52hExUB0rGw== X-Received: by 2002:a37:f706:: with SMTP id q6mr9157150qkj.519.1630896961696; Sun, 05 Sep 2021 19:56:01 -0700 (PDT) Return-Path: Received: from benjamind-benjamindomain.. ([2607:f2c0:e98c:24:66ff:37fc:7e9f:d3f7]) by smtp.gmail.com with ESMTPSA id c4sm5810398qkf.122.2021.09.05.19.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Sep 2021 19:56:01 -0700 (PDT) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone Subject: [edk2-platforms][PATCH v4 2/2] KabylakeOpenBoardPkg/AspireVn7Dash572G/DxeBoardInitLib: Fix byte shift Date: Sun, 5 Sep 2021 22:55:30 -0400 Message-Id: <20210906025530.279219-2-benjamin.doron00@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210906025530.279219-1-benjamin.doron00@gmail.com> References: <20210906025530.279219-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