From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web08.20494.1629091970973859400 for ; Sun, 15 Aug 2021 22:32:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=JlxOlpmu; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: nathaniel.l.desimone@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10077"; a="215826921" X-IronPort-AV: E=Sophos;i="5.84,324,1620716400"; d="scan'208";a="215826921" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2021 22:32:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,324,1620716400"; d="scan'208";a="448331654" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga007.fm.intel.com with ESMTP; 15 Aug 2021 22:32:41 -0700 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Sun, 15 Aug 2021 22:32:41 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Sun, 15 Aug 2021 22:32:41 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.108) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Sun, 15 Aug 2021 22:32:41 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G3amt8xFvChfpEyguTtUiIcuOGyb9XFGMEpmU+fQsufS2Jg0JM6esiz1maGyQrQ05tJ7TrWTzYHnWF4j5gcIbOcy/XKssgidDkyUTBcYZNJRDqZkamWikypD+2djEa68KvPRxJd6fFEE4GGu/EAqdgqBmxv6ejzZkOEWY4o3zfE+Vbq/3UiOe/pdtQPBtpW/hi7i1KPw9uzsAqWFso1w6mrELFkTljA0I2MKcu4uHFt1G8PhhB0XV2v1NyhCCVa8PGIiqtLPu1iEjj39MUdMJJ/IDVTAEUZwCeSDF+B4RYPLI156MIRWN+soj5dYNK7YaGMNDyRCBmkl9x5e5CCn+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PnCoNI2OAaszNCDZJ7XzTiSsw1OttpGT6UC0YfLTSqQ=; b=BvwceQq++D9uUKMo1id6PSr0GD6wWaVlUPiE2unMQR7SAygrJoQHAGTpyjzy35kRP823d2278NgLx+7ErY3UfpSsPuEs9zpvXaIGXVbJ/mWEz59M3pmRLJjQEUXB0kOqfchQ/ezuo/y4UiY72etdsxNg5PXrRnTSxyzFoodpKiRQ9waw02i1zjfQo9Yk3N3BG3FBJ9+IC5ZRTVirwFYz633ySt27j4yLSxiaUG7+VqVbo/CTNfoSEJbP6WtbhauRl2TfRzFBLp5Dc/l3piA3iAk/M1SfsQpc9cj+tiPumXmH1fSrhFP4ZDkDyTh7luh1nHaHyWWA7/ZYkVpcSuWUog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PnCoNI2OAaszNCDZJ7XzTiSsw1OttpGT6UC0YfLTSqQ=; b=JlxOlpmuXk2DGrkyJZMtCX2lB5oFeEarfvurv7KkSn/sFS5NrH56es4GZTE034x8SVBMKK9x25/qGyfN9EJngQZ4hpAW2PAJn4s84zIhF9iNtzt/jb6EbSgaezmRCPy3SvQfUkZGpKxn65zc/vOsSBPnsI9NaxmDG1kS0ERfhmw= Received: from MWHPR1101MB2160.namprd11.prod.outlook.com (2603:10b6:301:5b::12) by MWHPR1101MB2255.namprd11.prod.outlook.com (2603:10b6:301:5b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.22; Mon, 16 Aug 2021 05:32:39 +0000 Received: from MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::546c:f20e:35d2:65a7]) by MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::546c:f20e:35d2:65a7%5]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 05:32:39 +0000 From: "Nate DeSimone" To: "devel@edk2.groups.io" , "benjamin.doron00@gmail.com" CC: "Chiu, Chasel" , Michael Kubacki Subject: Re: [edk2-devel] [edk2-platforms][PATCH v2 1/5] KabylakeOpenBoardPkg/BaseEcLib: Add some common EC commands Thread-Topic: [edk2-devel] [edk2-platforms][PATCH v2 1/5] KabylakeOpenBoardPkg/BaseEcLib: Add some common EC commands Thread-Index: AQHXkKLbkfTMFRQncEmwskOVeyDIAKt1nAfw Date: Mon, 16 Aug 2021 05:32:39 +0000 Message-ID: References: <20210804203630.7080-1-benjamin.doron00@gmail.com> <20210814002445.10084-1-benjamin.doron00@gmail.com> <20210814002445.10084-2-benjamin.doron00@gmail.com> In-Reply-To: <20210814002445.10084-2-benjamin.doron00@gmail.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cb0b351f-bcac-48f4-49d7-08d960774353 x-ms-traffictypediagnostic: MWHPR1101MB2255: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3276; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: DA8ogh2OYNaA/2Dq/r5VbyE0AY1N6zBXu9seJlDL0Z0m3yUTuOg+Ekq7CtPhHaqGSgazJQMly9yXx9dza5tbbA1RbEgPlVhpCYKfqJf3N/Qj5roG/7A3n5WPcvoTC8Mkrhk/KsqMfYC1gDhwLhCkuZonRLT0FEOPafyVh7zgGcfuZ/c+6jehpR2Hm1w5Xdwh8OOFcG4CFIR1pP3jl0RlwktpoWm6a3kIwR/zWj0C1C+dONhjrIz7tTk2tAtVAlBHxrft9xm3XpqSEbothxXA/F6DB8NXRqmjaMibkbgx/XZFT23bWtUD0kV7Wr+E1hdptr/Fb+MW2rJR8ZHs2UGaapEm0uHxe7TLiE312P58Cfm/5hG+Gk7pDjjCWIQkHcCtzSJNFXolHhNhpz/XtStvvq/IXh9muwkAWmqYiM0ayhOrz/GxcU+73xVaYktJAxzZafCiVl7ldC0FgfGrSvsmzrlfKyIjtOv+SyujIOnvD4hLN8PfTsOLK5YvjzWOttb2SMVZJd6edyNd91LoMoruvBuS3dxmR3bmIfB00CxoYTjivzRF8bHx+9RFQdGTLBWWepBKvr3QisXgxV4cA6cQFGhAmX84CUhhI/3s3trL/KLrgrk+n/muEE1VjKSPWK4E1mYDlu3T1eEKk0+YdBEej4iRTWMZvjyRE9Po8j7DIszXswYcL9QNHokS7yrrCBYQ8tPIE6qK6EPcgA2DVTKDc2gpWBLj2C9P/w0UDRUzkaHh9etGR9eP48/HcrfShk4qthsKYZi7ozwONsWgE8qYh4FNWaVev7PAGvKYmX9mluV6UvXlswDEgGiPgx/rvtnH9VQ2Xc4DBB7YzObrKLgAHw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1101MB2160.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(346002)(39860400002)(366004)(136003)(396003)(376002)(5660300002)(38100700002)(122000001)(66476007)(66556008)(64756008)(66446008)(76116006)(9686003)(66946007)(71200400001)(33656002)(54906003)(52536014)(110136005)(55016002)(316002)(7696005)(38070700005)(966005)(478600001)(53546011)(6506007)(26005)(4326008)(8676002)(8936002)(186003)(83380400001)(2906002)(86362001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?PJB6+rb4apzK81zX5Aouj2SsW26gMdy8hSK7TDCDUo/a89UFoLGPtV5oiJoj?= =?us-ascii?Q?D9eJTQezpB+2Sj4n2CBhieY4/jIOSoZc8BXYjire6feTEihTDXaBTXcZa4PW?= =?us-ascii?Q?7BXO5lICMTephJSOT8DN/ySbxBXdZHY/hsNers59I4amMAq3v1by18RCAPLq?= =?us-ascii?Q?aSzZwvXyGdzJj1YudMLPD36KpOjMjqhUCbD08oCMvVJGlOYG1JtYotDDnrl/?= =?us-ascii?Q?uoeK+9j1u0A51D8LUSKqjgqISm4vwfGinFTlUQAYAkF0usJn5bn+bhU0XYdM?= =?us-ascii?Q?oEAKy4C2jY7NJazjpyaLXz3VdlVwlgIxe2TRtnA5jB0OKai1ngCL3y1jP6OP?= =?us-ascii?Q?ulRLPSURPQDMXv0qUaUN/++M01OZhWsFnchYovwVvUfoGJtPaUtOfq12U1m6?= =?us-ascii?Q?8KPvvleQKJMXzZEjM4MHvxl0o8h93dS2wNXHWV7CUGXTB/eg7SvHLkgkb0Zo?= =?us-ascii?Q?/TB+nOWoG2mrURCW+n+s7482avEnSua+x6ghStTLph7e4ETbxLcWGuPnzMT/?= =?us-ascii?Q?tRUvZJWfTY02T1m9zXfbPWAifXjAMqPkRxfP2La2Ahu47ODaZPqXN0p9Fryg?= =?us-ascii?Q?xedZQOS+IhzU729Q98lcU+olpRbCpcUvYMC1LelH0n25gS0LE9LvI2yCKr7V?= =?us-ascii?Q?O0JjI9CkfXwZbw+IiNaaIjRX4c7cM9Rws+R62h84mZerP+YQdqSSGZHDNNk/?= =?us-ascii?Q?/rmuKHFY/OYklOjkg6BIpMqB1mnyn4CedrjhSwvRWxQDkRl2J4a0bL9e/+tT?= =?us-ascii?Q?dqloY6dsQGS2udPLTUMUK727GY3ehYUugvz5rkE3P2YGQkUAQ4fLeeNsKfK4?= =?us-ascii?Q?M0SjTDQHxPspzfEwm9admtOuic4m4i3vMIh5s8RShtQM4sfDGpPGemdB+9mB?= =?us-ascii?Q?sRlb8tDf5DTmqLuvbP2CNqNB65wYYUXY3Lx5aAPMn4kyB7n0+0NRs6uKBl+N?= =?us-ascii?Q?yhq0SpF0E5lfYuBCR2A+M/le2arUJCE6mvgt81ZF7XwchM6gdqMGDF98Nfh9?= =?us-ascii?Q?Bj1DO6waDu1MnnwaDFzGe1W4T2CcTBLCbDzqlSOejL1A03ujE/4vTZ4Vq/ix?= =?us-ascii?Q?B90LbrzFgOKZaGo486/Pl3eQuQEpeTdcim5v4ijbXD8A2AQ5fh6ae3H1RJJU?= =?us-ascii?Q?ImQcha7mnY4Az8rWLfTKRnOq/V9xewoHPaHExsEjk5eg6cJq5tmXlmeWdWyG?= =?us-ascii?Q?0xIWVRxwYej8tOtZScri61kO8n9PXOExWr2ArGYugjRS6jLc/CYF4WO+F6nI?= =?us-ascii?Q?viANmDoUEPdedgAhEgbsabSJOpeQbOlpm2CfED9eJM5Tp7Kez5wp3zIvt6kx?= =?us-ascii?Q?bJqlsuZvONW/Gt9QIZIx8woL?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR1101MB2160.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb0b351f-bcac-48f4-49d7-08d960774353 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Aug 2021 05:32:39.5223 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: UDuazGLtrMqNlAa9zG2uC13m7RsgwJSy86IDfR6MwjcFiHwmdKYEGqsetHI3fQz1bvB9G77p56OBPPqVOfzmjj6fxdGmw3xxK4bgSzCEtr0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1101MB2255 Return-Path: nathaniel.l.desimone@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Nate DeSimone > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of > Benjamin Doron > Sent: Friday, August 13, 2021 5:25 PM > To: devel@edk2.groups.io > Cc: Chiu, Chasel ; Desimone, Nathaniel L > ; Michael Kubacki > > Subject: [edk2-devel] [edk2-platforms][PATCH v2 1/5] > KabylakeOpenBoardPkg/BaseEcLib: Add some common EC commands >=20 > Add EC read (0x80) and write (0x81) commands, as defined by ACPI. >=20 > Cc: Chasel Chiu > Cc: Nate DeSimone > Cc: Michael Kubacki > Signed-off-by: Benjamin Doron > --- > Platform/Intel/KabylakeOpenBoardPkg/Include/Library/EcLib.h | = 32 > +++++++++ >=20 > Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/EcCommands > .h | 2 + > Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/BaseEcLib.c | = 4 > +- > Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/BaseEcLib.inf | = 1 > + > Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/EcCommands.c > | 76 ++++++++++++++++++++ > 5 files changed, 114 insertions(+), 1 deletion(-) >=20 > diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Include/Library/EcLib.h > b/Platform/Intel/KabylakeOpenBoardPkg/Include/Library/EcLib.h > index 04ce076f91b7..7c58e592d965 100644 > --- a/Platform/Intel/KabylakeOpenBoardPkg/Include/Library/EcLib.h > +++ b/Platform/Intel/KabylakeOpenBoardPkg/Include/Library/EcLib.h > @@ -103,4 +103,36 @@ LpcEcInterface ( > IN OUT UINT8 *DataBuffer ); +/**+ Read a byte of EC= RAM.++ > @param[in] Address Address to read+ @param[out] Data = Data > received++ @retval EFI_SUCCESS Command success+ @retval > EFI_DEVICE_ERROR Command error+ @retval EFI_TIMEOUT Command > timeout+**/+EFI_STATUS+EcRead (+ IN UINT8 Address,+ O= UT > UINT8 *Data+ );++/**+ Write a byte of EC RAM.++ @para= m[in] > Address Address to write+ @param[in] Data Data to= write++ > @retval EFI_SUCCESS Command success+ @retval EFI_DEVICE_ERRO= R > Command error+ @retval EFI_TIMEOUT Command > timeout+**/+EFI_STATUS+EcWrite (+ IN UINT8 Address,+ = IN > UINT8 Data+ );+ #endifdiff --git > a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/EcComman > ds.h > b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/EcComman > ds.h > index be56d134edc7..a4ab192d8ce1 100644 > --- > a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/EcComman > ds.h > +++ > b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/EcComman > d > +++ s.h > @@ -40,5 +40,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > // Data read from the EC data port is valid only when OBF=3D1. // #defin= e > EC_C_FAB_ID 0x0D // Get the board fab ID in the low= er 3 > bits+#define EC_C_ACPI_READ 0x80 // Read a byte of EC > RAM+#define EC_C_ACPI_WRITE 0x81 // Write a byte of EC = RAM > #endif // EC_COMMANDS_H_diff --git > a/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/BaseEcLib.c > b/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/BaseEcLib.c > index eda6f7d2e142..66bd478906fb 100644 > --- a/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/BaseEcLib.c > +++ b/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/BaseEcLib.c > @@ -32,7 +32,9 @@ typedef struct { > } EC_COMMAND_TABLE; EC_COMMAND_TABLE mEcCommand[] =3D {- > {EC_C_FAB_ID , 0, 2, TRUE} // Get the board fab ID in= the lower 3 > bits+ {EC_C_FAB_ID , 0, 2, TRUE}, // Get the board fa= b ID in the > lower 3 bits+ {EC_C_ACPI_READ , 1, 1, TRUE}, // Read a b= yte of EC > RAM+ {EC_C_ACPI_WRITE , 2, 0, TRUE} // Write a byte of E= C RAM }; > //diff --git > a/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/BaseEcLib.inf > b/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/BaseEcLib.inf > index c7de77d80f3d..f0b4c67fffc2 100644 > --- a/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/BaseEcLib.inf > +++ > b/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/BaseEcLib.in > +++ f > @@ -27,3 +27,4 @@ > [Sources] BaseEcLib.c+ EcCommands.cdiff --git > a/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/EcCommands.c > b/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/EcCommands.c > new file mode 100644 > index 000000000000..d14edb75de36 > --- /dev/null > +++ > b/Platform/Intel/KabylakeOpenBoardPkg/Library/BaseEcLib/EcCommands.c > @@ -0,0 +1,76 @@ > +/** @file+ Common EC commands.++Copyright (c) 2019, Intel Corporation. > All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause- > Patent++**/++#include +#include +#include > ++/**+ Read a byte of EC RAM.++ @param[in] Address > Address to read+ @param[out] Data Data received++ @retval > EFI_SUCCESS Command success+ @retval EFI_DEVICE_ERROR > Command error+ @retval EFI_TIMEOUT Command > timeout+**/+EFI_STATUS+EcRead (+ IN UINT8 Address,+ O= UT > UINT8 *Data+ )+{+ UINT8 DataSize;= + UINT8 > DataBuffer[1];+ EFI_STATUS Status;++ if (Data =3D=3D NU= LL) {+ return > EFI_INVALID_PARAMETER;+ }++ // Prepare arguments for LpcEcInterface()+ > DataSize =3D 1;+ DataBuffer[0] =3D Address;++ Status =3D LpcEcInterface > (EC_C_ACPI_READ, &DataSize, DataBuffer);+ if (EFI_ERROR(Status)) {+ > return Status;+ }++ // Write caller's pointer from returned data and re= turn > success+ *Data =3D DataBuffer[0];+ return EFI_SUCCESS;+}++/**+ Write a > byte of EC RAM.++ @param[in] Address Address to write+ @param= [in] > Data Data to write++ @retval EFI_SUCCESS Command s= uccess+ > @retval EFI_DEVICE_ERROR Command error+ @retval EFI_TIMEOUT > Command timeout+**/+EFI_STATUS+EcWrite (+ IN UINT8 > Address,+ IN UINT8 Data+ )+{+ UINT8 = DataSize;+ UINT8 > DataBuffer[2];++ // Prepare arguments for LpcEcInterface()+ DataSize = =3D 2;+ > DataBuffer[0] =3D Address;+ DataBuffer[1] =3D Data;++ return LpcEcInter= face > (EC_C_ACPI_WRITE, &DataSize, DataBuffer);+}-- > 2.31.1 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#79296): https://edk2.groups.io/g/devel/message/79296 > Mute This Topic: https://groups.io/mt/84876363/1767664 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub > [nathaniel.l.desimone@intel.com] -=3D-=3D-=3D-=3D-=3D-=3D >=20