lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y7xtf4BEd3On42FJ@google.com>
Date:   Mon, 9 Jan 2023 11:39:43 -0800
From:   Benson Leung <bleung@...gle.com>
To:     Prashant Malani <pmalani@...omium.org>
Cc:     linux-kernel@...r.kernel.org, chrome-platform@...ts.linux.dev,
        heikki.krogerus@...ux.intel.com,
        Benson Leung <bleung@...omium.org>,
        Daisuke Nojiri <dnojiri@...omium.org>,
        "Dustin L. Howett" <dustin@...ett.net>,
        Evan Green <evgreen@...omium.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Guenter Roeck <groeck@...omium.org>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Kees Cook <keescook@...omium.org>,
        Lee Jones <lee.jones@...aro.org>, Lee Jones <lee@...nel.org>,
        Sebastian Reichel <sebastian.reichel@...labora.com>,
        Stephen Boyd <swboyd@...omium.org>,
        Tinghan Shen <tinghan.shen@...iatek.com>,
        Tzung-Bi Shih <tzungbi@...nel.org>,
        Xiang wangx <wangxiang@...rlc.com>
Subject: Re: [PATCH 10/10] platform/chrome: cros_typec_vdm: Add VDM send
 support

On Wed, Dec 28, 2022 at 12:45:13AM +0000, Prashant Malani wrote:
> Add support to send generic VDM messages from the alt mode driver to the
> partner (via the ChromeOS EC). The function introduced here is intended
> to be called by the alt mode driver (via the Type-C bus logic).
> 
> Cc: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> Signed-off-by: Prashant Malani <pmalani@...omium.org>

Reviewed-by: Benson Leung <bleung@...omium.org>

> ---
>  drivers/platform/chrome/cros_typec_vdm.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/platform/chrome/cros_typec_vdm.c b/drivers/platform/chrome/cros_typec_vdm.c
> index fc7b602ceb37..aca9d337118e 100644
> --- a/drivers/platform/chrome/cros_typec_vdm.c
> +++ b/drivers/platform/chrome/cros_typec_vdm.c
> @@ -77,6 +77,30 @@ static int cros_typec_port_amode_enter(struct typec_altmode *amode, u32 *vdo)
>  			   sizeof(req), NULL, 0);
>  }
>  
> +static int cros_typec_port_amode_vdm(struct typec_altmode *amode, const u32 hdr,
> +				     const u32 *vdo, int cnt)
> +{
> +	struct cros_typec_port *port = typec_altmode_get_drvdata(amode);
> +	struct ec_params_typec_control req = {
> +		.port = port->port_num,
> +		.command = TYPEC_CONTROL_COMMAND_SEND_VDM_REQ,
> +	};
> +	struct typec_vdm_req vdm_req = {};
> +
> +	vdm_req.vdm_data[0] = hdr;
> +	vdm_req.vdm_data_objects = cnt;
> +	memcpy(&vdm_req.vdm_data[1], vdo, cnt - 1);
> +	vdm_req.partner_type = TYPEC_PARTNER_SOP;
> +	req.vdm_req_params = vdm_req;
> +
> +	dev_dbg(port->typec_data->dev, "Sending VDM, hdr: %x, num_objects: %d, port: %d\n",
> +		hdr, cnt, port->port_num);
> +
> +	return cros_ec_cmd(port->typec_data->ec, 0, EC_CMD_TYPEC_CONTROL, &req,
> +			   sizeof(req), NULL, 0);
> +}
> +
>  struct typec_altmode_ops port_amode_ops = {
>  	.enter = cros_typec_port_amode_enter,
> +	.vdm = cros_typec_port_amode_vdm,
>  };
> -- 
> 2.39.0.314.g84b9a713c41-goog
> 
> 

-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@...gle.com
Chromium OS Project
bleung@...omium.org

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ