public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nate DeSimone" <nathaniel.l.desimone@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"benjamin.doron00@gmail.com" <benjamin.doron00@gmail.com>
Cc: "Chiu, Chasel" <chasel.chiu@intel.com>,
	Michael Kubacki <michael.kubacki@microsoft.com>
Subject: Re: [edk2-devel] [edk2-platforms][PATCH v2 1/5] KabylakeOpenBoardPkg/BaseEcLib: Add some common EC commands
Date: Mon, 16 Aug 2021 05:32:39 +0000	[thread overview]
Message-ID: <MWHPR1101MB2160A483EAB34DB138779C3FCDFD9@MWHPR1101MB2160.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210814002445.10084-2-benjamin.doron00@gmail.com>

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <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 <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Michael Kubacki
> <michael.kubacki@microsoft.com>
> Subject: [edk2-devel] [edk2-platforms][PATCH v2 1/5]
> KabylakeOpenBoardPkg/BaseEcLib: Add some common EC commands
> 
> Add EC read (0x80) and write (0x81) commands, as defined by ACPI.
> 
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Michael Kubacki <michael.kubacki@microsoft.com>
> Signed-off-by: Benjamin Doron <benjamin.doron00@gmail.com>
> ---
>  Platform/Intel/KabylakeOpenBoardPkg/Include/Library/EcLib.h           | 32
> +++++++++
> 
> 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(-)
> 
> 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,+  OUT
> UINT8                  *Data+  );++/**+  Write a byte of EC RAM.++  @param[in]
> Address           Address to write+  @param[in] Data              Data to write++
> @retval    EFI_SUCCESS       Command success+  @retval    EFI_DEVICE_ERROR
> 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=1. // #define
> EC_C_FAB_ID                    0x0D    // Get the board fab ID in the lower 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[] = {-
> {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 fab ID in the
> lower 3 bits+  {EC_C_ACPI_READ                , 1, 1, TRUE},  // Read a byte of EC
> RAM+  {EC_C_ACPI_WRITE               , 2, 0, TRUE}   // Write a byte of EC 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.<BR>+SPDX-License-Identifier: BSD-2-Clause-
> Patent++**/++#include <Base.h>+#include <Uefi.h>+#include
> <Library/EcLib.h>++/**+  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,+  OUT
> UINT8                  *Data+  )+{+  UINT8                      DataSize;+  UINT8
> DataBuffer[1];+  EFI_STATUS                 Status;++  if (Data == NULL) {+    return
> EFI_INVALID_PARAMETER;+  }++  // Prepare arguments for LpcEcInterface()+
> DataSize = 1;+  DataBuffer[0] = Address;++  Status = LpcEcInterface
> (EC_C_ACPI_READ, &DataSize, DataBuffer);+  if (EFI_ERROR(Status)) {+
> return Status;+  }++  // Write caller's pointer from returned data and return
> success+  *Data = 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 success+
> @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 = 2;+
> DataBuffer[0] = Address;+  DataBuffer[1] = Data;++  return LpcEcInterface
> (EC_C_ACPI_WRITE, &DataSize, DataBuffer);+}--
> 2.31.1
> 
> 
> 
> -=-=-=-=-=-=
> 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] -=-=-=-=-=-=
> 


  reply	other threads:[~2021-08-16  5:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04 20:36 [edk2-platforms][PATCH v1 0/4] KabylakeOpenBoardPkg: Add AspireVn7Dash572G Benjamin Doron
2021-08-04 20:36 ` [edk2-platforms][PATCH v1 1/4] KabylakeOpenBoardPkg/AspireVn7Dash572G: Duplicate KabylakeRvp3 directory Benjamin Doron
2021-08-04 20:36 ` [edk2-platforms][PATCH v1 2/4] KabylakeOpenBoardPkg/AspireVn7Dash572G: Rename KabylakeRvp3 files Benjamin Doron
2021-08-04 20:36 ` [edk2-platforms][PATCH v1 3/4] Platform/Intel: Early hook-up Acer Aspire VN7-572G Benjamin Doron
2021-08-04 20:36 ` [edk2-platforms][PATCH v1 4/4] KabylakeOpenBoardPkg/AspireVn7Dash572G: Add initial support Benjamin Doron
2021-08-14  0:24 ` [edk2-platforms][PATCH v2 0/5] KabylakeOpenBoardPkg: Add AspireVn7Dash572G Benjamin Doron
2021-08-14  0:24   ` [edk2-platforms][PATCH v2 1/5] KabylakeOpenBoardPkg/BaseEcLib: Add some common EC commands Benjamin Doron
2021-08-16  5:32     ` Nate DeSimone [this message]
2021-08-16 15:50     ` [edk2-devel] " Michael Kubacki
2021-08-14  0:24   ` [edk2-platforms][PATCH v2 2/5] KabylakeOpenBoardPkg/AspireVn7Dash572G: Duplicate KabylakeRvp3 directory Benjamin Doron
2021-08-16  5:32     ` Nate DeSimone
2021-08-16 15:50     ` [edk2-devel] " Michael Kubacki
2021-08-14  0:24   ` [edk2-platforms][PATCH v2 3/5] KabylakeOpenBoardPkg/AspireVn7Dash572G: Rename KabylakeRvp3 files Benjamin Doron
2021-08-16  5:32     ` Nate DeSimone
2021-08-16 15:50     ` [edk2-devel] " Michael Kubacki
2021-08-14  0:24   ` [edk2-platforms][PATCH v2 4/5] Platform/Intel: Early hook-up Acer Aspire VN7-572G Benjamin Doron
2021-08-16  5:32     ` Nate DeSimone
2021-08-16 15:51     ` [edk2-devel] " Michael Kubacki
2021-08-14  0:24   ` [edk2-platforms][PATCH v2 5/5] KabylakeOpenBoardPkg/AspireVn7Dash572G: Add initial support Benjamin Doron
2021-08-16  5:21     ` Nate DeSimone
2021-08-16 15:49       ` [edk2-devel] " Michael Kubacki
2021-08-18 20:17         ` Benjamin Doron
2021-08-16  5:22   ` [edk2-devel] [edk2-platforms][PATCH v2 0/5] KabylakeOpenBoardPkg: Add AspireVn7Dash572G Nate DeSimone
2021-08-18 20:05     ` Benjamin Doron
     [not found]   ` <169BB1F1F47FC595.23238@groups.io>
2021-08-16  5:31     ` Nate DeSimone
2021-08-18 20:31       ` Benjamin Doron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR1101MB2160A483EAB34DB138779C3FCDFD9@MWHPR1101MB2160.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox