From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Simon Glass <sjg@chromium.org>
Cc: trini@konsulko.com, etienne.carriere@st.com, u-boot@lists.denx.de
Subject: Re: [PATCH 01/10] firmware: scmi: implement SCMI base protocol
Date: Mon, 3 Jul 2023 09:37:20 +0900 [thread overview]
Message-ID: <ZKIYQP1l9T5yNG2g@laputa> (raw)
In-Reply-To: <CAPnjgZ2yKcB8fSzgdUTQomE1BaCKA4UeKJXk+sUukLDu3WbDEQ@mail.gmail.com>
On Thu, Jun 29, 2023 at 08:09:45PM +0100, Simon Glass wrote:
> Hi AKASHI,
>
> On Wed, 28 Jun 2023 at 01:49, AKASHI Takahiro
> <takahiro.akashi@linaro.org> wrote:
> >
> > SCMI base protocol is mandatory according to the SCMI specification.
> >
> > With this patch, SCMI base protocol can be accessed via SCMI transport
> > layers. All the commands, except SCMI_BASE_NOTIFY_ERRORS, are supported.
> > This is because U-Boot doesn't support interrupts and the current transport
> > layers are not able to handle asynchronous messages properly.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> > drivers/firmware/scmi/Makefile | 1 +
> > drivers/firmware/scmi/base.c | 517 +++++++++++++++++++++++++++++++++
> > include/dm/uclass-id.h | 1 +
> > include/scmi_protocols.h | 201 ++++++++++++-
> > 4 files changed, 718 insertions(+), 2 deletions(-)
> > create mode 100644 drivers/firmware/scmi/base.c
> >
> > diff --git a/drivers/firmware/scmi/Makefile b/drivers/firmware/scmi/Makefile
> > index b2ff483c75a1..1a23d4981709 100644
> > --- a/drivers/firmware/scmi/Makefile
> > +++ b/drivers/firmware/scmi/Makefile
> > @@ -1,4 +1,5 @@
> > obj-y += scmi_agent-uclass.o
> > +obj-y += base.o
> > obj-y += smt.o
> > obj-$(CONFIG_SCMI_AGENT_SMCCC) += smccc_agent.o
> > obj-$(CONFIG_SCMI_AGENT_MAILBOX) += mailbox_agent.o
>
> [..]
>
> > diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
> > index 307ad6931ca7..f7a110852321 100644
> > --- a/include/dm/uclass-id.h
> > +++ b/include/dm/uclass-id.h
> > @@ -116,6 +116,7 @@ enum uclass_id {
> > UCLASS_RNG, /* Random Number Generator */
> > UCLASS_RTC, /* Real time clock device */
> > UCLASS_SCMI_AGENT, /* Interface with an SCMI server */
> > + UCLASS_SCMI_BASE, /* Interface for SCMI Base protocol */
> > UCLASS_SCSI, /* SCSI device */
> > UCLASS_SERIAL, /* Serial UART */
> > UCLASS_SIMPLE_BUS, /* Bus with child devices */
> > diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h
> > index a220cb2a91ad..769041654534 100644
> > --- a/include/scmi_protocols.h
> > +++ b/include/scmi_protocols.h
> > @@ -15,6 +15,8 @@
> > * https://developer.arm.com/docs/den0056/b
> > */
> >
> > +#define SCMI_BASE_NAME_LENGTH_MAX 16
> > +
> > enum scmi_std_protocol {
> > SCMI_PROTOCOL_ID_BASE = 0x10,
> > SCMI_PROTOCOL_ID_POWER_DOMAIN = 0x11,
> > @@ -41,12 +43,207 @@ enum scmi_status_code {
> > };
> >
> > /*
> > - * Generic message IDs
> > + * SCMI Base Protocol
> > */
> > -enum scmi_discovery_id {
> > +#define SCMI_BASE_PROTOCOL_VERSION 0x20000
> > +
> > +enum scmi_base_message_id {
> > SCMI_PROTOCOL_VERSION = 0x0,
> > SCMI_PROTOCOL_ATTRIBUTES = 0x1,
> > SCMI_PROTOCOL_MESSAGE_ATTRIBUTES = 0x2,
> > + SCMI_BASE_DISCOVER_VENDOR = 0x3,
> > + SCMI_BASE_DISCOVER_SUB_VENDOR = 0x4,
> > + SCMI_BASE_DISCOVER_IMPL_VERSION = 0x5,
> > + SCMI_BASE_DISCOVER_LIST_PROTOCOLS = 0x6,
> > + SCMI_BASE_DISCOVER_AGENT = 0x7,
> > + SCMI_BASE_NOTIFY_ERRORS = 0x8,
> > + SCMI_BASE_SET_DEVICE_PERMISSIONS = 0x9,
> > + SCMI_BASE_SET_PROTOCOL_PERMISSIONS = 0xa,
> > + SCMI_BASE_RESET_AGENT_CONFIGURATION = 0xb,
> > +};
> > +
> > +/**
> > + * struct scmi_protocol_version_out - Response for SCMI_PROTOCOL_VERSION
> > + * command
> > + * @status: SCMI command status
> > + * @version: Protocol version
> > + */
> > +struct scmi_protocol_version_out {
> > + s32 status;
> > + u32 version;
> > +};
> > +
> > +/**
> > + * struct scmi_protocol_attrs_out - Response for SCMI_PROTOCOL_ATTRIBUTES
> > + * command
> > + * @status: SCMI command status
> > + * @attributes: Protocol attributes or implementation details
> > + */
> > +struct scmi_protocol_attrs_out {
> > + s32 status;
> > + u32 attributes;
> > +};
> > +
> > +#define SCMI_PROTOCOL_ATTRS_NUM_AGENTS(attributes) \
> > + (((attributes) & GENMASK(15, 8)) >> 8)
> > +#define SCMI_PROTOCOL_ATTRS_NUM_PROTOCOLS(attributes) \
> > + ((attributes) & GENMASK(7, 0))
> > +
> > +/**
> > + * struct scmi_protocol_msg_attrs_out - Response for
> > + * SCMI_PROTOCOL_MESSAGE_ATTRIBUTES command
> > + * @status: SCMI command status
> > + * @attributes: Message-specific attributes
> > + */
> > +struct scmi_protocol_msg_attrs_out {
> > + s32 status;
> > + u32 attributes;
> > +};
> > +
> > +/**
> > + * struct scmi_base_discover_vendor_out - Response for
> > + * SCMI_BASE_DISCOVER_VENDOR or
> > + * SCMI_BASE_DISCOVER_SUB_VENDOR command
> > + * @status: SCMI command status
> > + * @vendor_identifier: Identifier of vendor or sub-vendor in string
> > + */
> > +struct scmi_base_discover_vendor_out {
> > + s32 status;
> > + u8 vendor_identifier[SCMI_BASE_NAME_LENGTH_MAX];
> > +};
> > +
> > +/**
> > + * struct scmi_base_discover_impl_version_out - Response for
> > + * SCMI_BASE_DISCOVER_IMPL_VERSION command
> > + * @status: SCMI command status
> > + * @impl_version: Vendor-specific implementation version
> > + */
> > +struct scmi_base_discover_impl_version_out {
> > + s32 status;
> > + u32 impl_version;
> > +};
> > +
> > +/**
> > + * struct scmi_base_discover_list_protocols_out - Response for
> > + * SCMI_BASE_DISCOVER_LIST_PROTOCOLS command
> > + * @status: SCMI command status
> > + * @num_protocols: Number of protocols in @protocol
> > + * @protocols: Array of packed protocol ID's
> > + */
> > +struct scmi_base_discover_list_protocols_out {
> > + s32 status;
> > + u32 num_protocols;
> > + u32 protocols[3];
> > +};
> > +
> > +/**
> > + * struct scmi_base_discover_agent_out - Response for
> > + * SCMI_BASE_DISCOVER_AGENT command
> > + * @status: SCMI command status
> > + * @agent_id: Identifier of agent
> > + * @name: Name of agent in string
> > + */
> > +struct scmi_base_discover_agent_out {
> > + s32 status;
> > + u32 agent_id;
> > + u8 name[SCMI_BASE_NAME_LENGTH_MAX];
> > +};
> > +
> > +#define SCMI_BASE_NOTIFY_ERRORS_ENABLE BIT(0)
> > +
> > +/**
> > + * struct scmi_base_set_device_permissions_in - Parameters for
> > + * SCMI_BASE_SET_DEVICE_PERMISSIONS command
> > + * @agent_id: Identifier of agent
> > + * @device_id: Identifier of device
> > + * @flags: A set of flags
> > + */
> > +struct scmi_base_set_device_permissions_in {
> > + u32 agent_id;
> > + u32 device_id;
> > + u32 flags;
> > +};
> > +
> > +#define SCMI_BASE_SET_DEVICE_PERMISSIONS_ACCESS BIT(0)
> > +
> > +/**
> > + * struct scmi_base_set_protocol_permissions_in - Parameters for
> > + * SCMI_BASE_SET_PROTOCOL_PERMISSIONS command
> > + * @agent_id: Identifier of agent
> > + * @device_id: Identifier of device
> > + * @command_id: Identifier of command
> > + * @flags: A set of flags
> > + */
> > +struct scmi_base_set_protocol_permissions_in {
> > + u32 agent_id;
> > + u32 device_id;
> > + u32 command_id;
> > + u32 flags;
> > +};
> > +
> > +#define SCMI_BASE_SET_PROTOCOL_PERMISSIONS_COMMAND GENMASK(7, 0)
> > +#define SCMI_BASE_SET_PROTOCOL_PERMISSIONS_ACCESS BIT(0)
> > +
> > +/**
> > + * struct scmi_base_reset_agent_configuration_in - Parameters for
> > + * SCMI_BASE_RESET_AGENT_CONFIGURATION command
> > + * @agent_id: Identifier of agent
> > + * @flags: A set of flags
> > + */
> > +struct scmi_base_reset_agent_configuration_in {
> > + u32 agent_id;
> > + u32 flags;
> > +};
> > +
> > +#define SCMI_BASE_RESET_ALL_ACCESS_PERMISSIONS BIT(0)
> > +
> > +/**
> > + * struct scmi_base_ops - SCMI base protocol interfaces
> > + * @protocol_version: Function pointer for
> > + * PROTOCOL_VERSION
> > + * @protocol_attrs: Function pointer for
> > + * PROTOCOL_ATTRIBUTES
> > + * @protocol_message_attrs: Function pointer for
> > + * PROTOCOL_MESSAGE_ATTRIBUTES
> > + * @base_discover_vendor: Function pointer for
> > + * BASE_DISCOVER_VENDOR
> > + * @base_discover_sub_vendor: Function pointer for
> > + * BASE_DISCOVER_SUB_VENDOR
> > + * @base_discover_impl_version: Function pointer for
> > + * BASE_DISCOVER_IMPLEMENTATION_VERSION
> > + * @base_discover_list_protocols: Function pointer for
> > + * BASE_DISCOVER_LIST_PROTOCOLS
> > + * @base_discover_agent: Function pointer for
> > + * BASE_DISCOVER_AGENT
> > + * @base_notify_errors: Function pointer for
> > + * BASE_NOTIFY_ERRORS
> > + * @base_set_device_permissions: Function pointer for
> > + * BASE_SET_DEVICE_PROTOCOLS
> > + * @base_set_protocol_permissions: Function pointer for
> > + * BASE_SET_PROTOCOL_PERMISSIONS
> > + * @base_reset_agent_configuration: Function pointer for
> > + * BASE_RESET_AGENT_CONFIGURATION
> > + */
> > +struct scmi_base_ops {
> > + int (*protocol_version)(struct udevice *dev, u32 *version);
> > + int (*protocol_attrs)(struct udevice *dev, u32 *num_agents,
> > + u32 *num_protocols);
> > + int (*protocol_message_attrs)(struct udevice *dev, u32 message_id,
> > + u32 *attributes);
> > + int (*base_discover_vendor)(struct udevice *dev, u8 *vendor);
> > + int (*base_discover_sub_vendor)(struct udevice *dev, u8 *sub_vendor);
> > + int (*base_discover_impl_version)(struct udevice *dev, u32 *impl_version);
> > + int (*base_discover_list_protocols)(struct udevice *dev, u8 **protocols);
> > + int (*base_discover_agent)(struct udevice *dev, u32 agent_id,
> > + u32 *ret_agent_id, u8 *name);
> > + int (*base_notify_errors)(struct udevice *dev, u32 enable);
> > + int (*base_set_device_permissions)(struct udevice *dev, u32 agent_id,
> > + u32 device_id, u32 flags);
> > + int (*base_set_protocol_permissions)(struct udevice *dev, u32 agent_id,
> > + u32 device_id, u32 command_id,
> > + u32 flags);
> > + int (*base_reset_agent_configuration)(struct udevice *dev, u32 agent_id,
> > + u32 flags);
>
> Please can you add full function comments for each of these?
Yes, I will.
Thanks,
-Takahiro Akashi
> > };
> >
> > /*
> > --
> > 2.41.0
> >
>
> Regards,
> Simon
next prev parent reply other threads:[~2023-07-03 0:37 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 0:48 [PATCH 00/10] firmware: scmi: add SCMI base protocol support AKASHI Takahiro
2023-06-28 0:48 ` [PATCH 01/10] firmware: scmi: implement SCMI base protocol AKASHI Takahiro
2023-06-29 19:09 ` Simon Glass
2023-07-03 0:37 ` AKASHI Takahiro [this message]
2023-06-28 0:48 ` [PATCH 02/10] firmware: scmi: framework for installing additional protocols AKASHI Takahiro
2023-06-28 0:48 ` [PATCH 03/10] firmware: scmi: install base protocol to SCMI agent AKASHI Takahiro
2023-06-28 0:48 ` [PATCH 04/10] sandbox: remove SCMI base node definition from test.dts AKASHI Takahiro
2023-06-29 19:10 ` Simon Glass
2023-06-28 0:48 ` [PATCH 05/10] firmware: scmi: fake base protocol commands on sandbox AKASHI Takahiro
2023-06-29 19:09 ` Simon Glass
2023-06-28 0:48 ` [PATCH 06/10] test: dm: simplify SCMI unit test " AKASHI Takahiro
2023-06-29 19:09 ` Simon Glass
2023-06-28 0:48 ` [PATCH 07/10] test: dm: add SCMI base protocol test AKASHI Takahiro
2023-06-29 19:09 ` Simon Glass
2023-07-03 0:57 ` AKASHI Takahiro
2023-07-03 13:30 ` Simon Glass
2023-07-04 2:35 ` AKASHI Takahiro
2023-07-07 17:35 ` Simon Glass
2023-07-10 2:04 ` AKASHI Takahiro
2023-07-10 19:45 ` Simon Glass
2023-07-11 1:02 ` AKASHI Takahiro
[not found] ` <CAPnjgZ3HyYBRU0nQmauC1KBd-krOOJAORmbSRUki=KUHc+=TMw@mail.gmail.com>
2023-07-14 0:41 ` AKASHI Takahiro
2023-07-15 23:40 ` Simon Glass
2023-06-28 0:48 ` [PATCH 08/10] cmd: add scmi command for SCMI firmware AKASHI Takahiro
2023-06-29 19:10 ` Simon Glass
2023-07-03 0:55 ` AKASHI Takahiro
2023-07-03 13:30 ` Simon Glass
2023-07-04 1:26 ` AKASHI Takahiro
2023-07-07 17:35 ` Simon Glass
2023-07-10 1:46 ` AKASHI Takahiro
2023-06-28 0:48 ` [PATCH 09/10] doc: cmd: add documentation for scmi AKASHI Takahiro
2023-06-29 19:10 ` Simon Glass
2023-07-03 1:19 ` AKASHI Takahiro
2023-07-03 13:30 ` Simon Glass
2023-07-04 2:05 ` AKASHI Takahiro
2023-07-07 17:35 ` Simon Glass
2023-06-28 0:48 ` [PATCH 10/10] test: dm: add scmi command test AKASHI Takahiro
2023-06-29 19:10 ` Simon Glass
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-all 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=ZKIYQP1l9T5yNG2g@laputa \
--to=takahiro.akashi@linaro.org \
--cc=etienne.carriere@st.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.