From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 634D6EB64DC for ; Mon, 10 Jul 2023 01:47:12 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CBD9085F2B; Mon, 10 Jul 2023 03:47:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="VJrzUS4S"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 855D9857A3; Mon, 10 Jul 2023 03:47:07 +0200 (CEST) Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 121B9820F2 for ; Mon, 10 Jul 2023 03:47:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-676cc97ca74so897788b3a.1 for ; Sun, 09 Jul 2023 18:47:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688953622; x=1691545622; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=K/fO04sXGUIwxnZrSgoR8JQJCsqF3VJeGHMfKbmCUdI=; b=VJrzUS4SA+aemI5YCkfOj9wLnv6clZZPYUgPodoTsTp2Q0a7B7oOa1YAvHwTO3vsRk HW0I8cyxYBRGHrOWsgCacY1PJIb3GQWlf9r3O1YGHSG1igR5rFimju6INEZPAb+1oR9d d1DvDXz5foqgMtvAS/uKGK3xJgSo6HX6RP43LgMuJKrFshXAHsH6CCqBhQPs5TaEdV7f eeRbosb9lJk7b2ThaAovO03u02lodmTypMs91qaRsdyL+IB1N9Cg+5MXIMOx9Kei3Mkw 4GT0s22Yxhn6U2yGc0ZsBhL9ouQ6vY8KJrSe0qjxxDXCusdx+jAAzkttLijFA/GqWt1Y MXcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688953622; x=1691545622; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=K/fO04sXGUIwxnZrSgoR8JQJCsqF3VJeGHMfKbmCUdI=; b=WuKiRMPduluTwlB00Wwb868t6jq2i/iiZIB22+Uf4oLBqMavangvaxIdATK877UrHv AWrtVsPX85LmW/qr/gw+uLS2w1LvqCJORLlMlnfXFomQ/oMB3Ox78yJ6RXFvxLVQq5xs TX8e6asOopeMFnSlfiTbAKeinQJMWyVI2Yh8KSN0fjB1o9uBdlEyI44Sw90o3m85mWbp xWUv3ofXC+b94ABF27lU1MkGi0Dd5OTTf7D4E2ot6oz1k+J63aX7VMkQA9y7lswIsr01 yjB5duY7HfwOoQo2icwt/U9sutP55hJ6ryd7oaMt/arCSx7BOohoCvywQ4yJ8ICnGfda jD9A== X-Gm-Message-State: ABy/qLYdWAl3rRAyYnQfL54Csh5L9Dm0UBSBaO/HHxQegC0ybjQq9j+r GCTlMDbCxusqRvR8DgSM4DRX1g== X-Google-Smtp-Source: APBJJlGQPfn7Qqngas7o/AXbIBCIM9oa7bTTmWjIOe0jcvq2DBm3j5WfLVioLWx6x8GKJyiFqNKlpQ== X-Received: by 2002:a17:902:f683:b0:1b8:95fc:cfe with SMTP id l3-20020a170902f68300b001b895fc0cfemr15040176plg.3.1688953622215; Sun, 09 Jul 2023 18:47:02 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:dcbb:ee54:813e:ed94]) by smtp.gmail.com with ESMTPSA id i6-20020a170902c94600b001b8b1f6619asm6899238pla.75.2023.07.09.18.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 18:47:01 -0700 (PDT) Date: Mon, 10 Jul 2023 10:46:58 +0900 From: AKASHI Takahiro To: Simon Glass Cc: trini@konsulko.com, etienne.carriere@st.com, u-boot@lists.denx.de Subject: Re: [PATCH 08/10] cmd: add scmi command for SCMI firmware Message-ID: Mail-Followup-To: AKASHI Takahiro , Simon Glass , trini@konsulko.com, etienne.carriere@st.com, u-boot@lists.denx.de References: <20230628004841.21774-1-takahiro.akashi@linaro.org> <20230628004841.21774-9-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On Fri, Jul 07, 2023 at 11:35:52AM -0600, Simon Glass wrote: > Hi, > > On Tue, 4 Jul 2023 at 02:26, AKASHI Takahiro wrote: > > > > On Mon, Jul 03, 2023 at 02:30:54PM +0100, Simon Glass wrote: > > > Hi, > > > > > > On Mon, 3 Jul 2023 at 01:55, AKASHI Takahiro wrote: > > > > > > > > On Thu, Jun 29, 2023 at 08:10:00PM +0100, Simon Glass wrote: > > > > > Hi AKASHI, > > > > > > > > > > On Wed, 28 Jun 2023 at 01:49, AKASHI Takahiro > > > > > wrote: > > > > > > > > > > > > This command, "scmi", provides a command line interface to various SCMI > > > > > > protocols. It supports at least initially SCMI base protocol with the sub > > > > > > command, "base", and is intended mainly for debug purpose. > > > > > > > > > > > > Signed-off-by: AKASHI Takahiro > > > > > > --- > > > > > > cmd/Kconfig | 8 ++ > > > > > > cmd/Makefile | 1 + > > > > > > cmd/scmi.c | 373 +++++++++++++++++++++++++++++++++++++++++++++++++++ > > > > > > 3 files changed, 382 insertions(+) > > > > > > create mode 100644 cmd/scmi.c > > > > > > > > > > > > diff --git a/cmd/Kconfig b/cmd/Kconfig > > > > > > index 02e54f1e50fe..065470a76295 100644 > > > > > > --- a/cmd/Kconfig > > > > > > +++ b/cmd/Kconfig > > > > > > @@ -2504,6 +2504,14 @@ config CMD_CROS_EC > > > > > > a number of sub-commands for performing EC tasks such as > > > > > > updating its flash, accessing a small saved context area > > > > > > and talking to the I2C bus behind the EC (if there is one). > > > > > > + > > > > > > +config CMD_SCMI > > > > > > + bool "Enable scmi command" > > > > > > + depends on SCMI_FIRMWARE > > > > > > + default n > > > > > > + help > > > > > > + This command provides user interfaces to several SCMI protocols, > > > > > > + including Base protocol. > > > > > > > > > > Please mention what is SCMI > > > > > > > > I will give a full spelling. > > > > > > > > > > endmenu > > > > > > > > > > > > menu "Filesystem commands" > > > > > > diff --git a/cmd/Makefile b/cmd/Makefile > > > > > > index 6c37521b4e2b..826e0b74b587 100644 > > > > > > --- a/cmd/Makefile > > > > > > +++ b/cmd/Makefile > > > > > > @@ -156,6 +156,7 @@ obj-$(CONFIG_CMD_SATA) += sata.o > > > > > > obj-$(CONFIG_CMD_NVME) += nvme.o > > > > > > obj-$(CONFIG_SANDBOX) += sb.o > > > > > > obj-$(CONFIG_CMD_SF) += sf.o > > > > > > +obj-$(CONFIG_CMD_SCMI) += scmi.o > > > > > > obj-$(CONFIG_CMD_SCSI) += scsi.o disk.o > > > > > > obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o > > > > > > obj-$(CONFIG_CMD_SEAMA) += seama.o > > > > > > diff --git a/cmd/scmi.c b/cmd/scmi.c > > > > > > new file mode 100644 > > > > > > index 000000000000..c97f77e97d95 > > > > > > --- /dev/null > > > > > > +++ b/cmd/scmi.c > > > > > > @@ -0,0 +1,373 @@ > > > > > > +// SPDX-License-Identifier: GPL-2.0+ > > > > > > +/* > > > > > > + * SCMI utility command > > > > > > + * > > > > > > + * Copyright (c) 2023 Linaro Limited > > > > > > + * Author: AKASHI Takahiro > > > > > > + */ > > > > > > + > > > > > > +#include > > > > > > +#include > > > > > > +#include > > > > > > +#include /* uclass_get_device */ > > > > > > > > > > Goes before linux/bitfield.h > > > > > > > > Can you tell me why? > > > > > > It is just a convention: > > > https://u-boot.readthedocs.io/en/latest/develop/codingstyle.html#include-files > > > > Okay. > > > > > > > > > > > > +#include > > > > > > +#include > > > > > > +#include > > > > > > +#include > > > > > > +#include > > > > > > +#include > > > > > > + > > > > > > +static struct udevice *agent; > > > > > > +static struct udevice *base_proto; > > > > > > +static const struct scmi_base_ops *ops; > > > > > > + > > > > > > +struct { > > > > > > + enum scmi_std_protocol id; > > > > > > + const char *name; > > > > > > +} protocol_name[] = { > > > > > > + {SCMI_PROTOCOL_ID_BASE, "Base"}, > > > > > > + {SCMI_PROTOCOL_ID_POWER_DOMAIN, "Power domain management"}, > > > > > > + {SCMI_PROTOCOL_ID_SYSTEM, "System power management"}, > > > > > > + {SCMI_PROTOCOL_ID_PERF, "Performance domain management"}, > > > > > > + {SCMI_PROTOCOL_ID_CLOCK, "Clock management"}, > > > > > > + {SCMI_PROTOCOL_ID_SENSOR, "Sensor management"}, > > > > > > + {SCMI_PROTOCOL_ID_RESET_DOMAIN, "Reset domain management"}, > > > > > > + {SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN, "Voltage domain management"}, > > > > > > +}; > > > > > > + > > > > > > +/** > > > > > > + * scmi_convert_id_to_string() - get the name of SCMI protocol > > > > > > + * > > > > > > + * @id: Protocol ID > > > > > > + * > > > > > > + * Get the printable name of the protocol, @id > > > > > > + * > > > > > > + * Return: Name string on success, NULL on failure > > > > > > + */ > > > > > > +static const char *scmi_convert_id_to_string(enum scmi_std_protocol id) > > > > > > > > > > scmi_lookup_id? > > > > > > > > Not sure your intention. > > > > The name above gives us exactly what this function does for pretty printing > > > > instead of a number. > > > > I think that 'lookup' implies we try to determine if the id exists or not. > > > > > > I am just trying to avoid the code turning into Java :-) > > > > Java? > > Long names like stories Well, recent software specification likes long names anyway. (i.e. UEFI) > > > > > How about scmi_get_name() ? > > > > Well, more specifically scmi_get_protocol_name()? > > Perhaps get_prot_name() since it is static? Anyway, please make it short-ish. Okay as far as this function is contained in this file. -Takahiro Akashi > We really need some limits on identifier names. > > Regards, > Simon