mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-08 06:04:34 +00:00
358599efd8
This change introduces SCMI agent uclass to interact with a firmware using the SCMI protocols [1]. SCMI agent uclass currently supports a single method to request processing of the SCMI message by an identified server. A SCMI message is made of a byte payload associated to a protocol ID and a message ID, all defined by the SCMI specification [1]. On return from process_msg() method, the caller gets the service response. SCMI agent uclass defines a post bind generic sequence for all devices. The sequence binds all the SCMI protocols listed in the FDT for that SCMI agent device. Currently none, but later change will introduce protocols. This change implements a simple sandbox device for the SCMI agent uclass. The sandbox nicely answers SCMI_NOT_SUPPORTED to SCMI messages. To prepare for further test support, the sandbox exposes a architecture function for test application to read the sandbox emulated devices state. Currently supports 2 SCMI agents, identified by an ID in the FDT device name. The simplistic DM test does nothing yet. SCMI agent uclass is designed for platforms that embed a SCMI server in a firmware hosted somewhere, for example in a companion co-processor or in the secure world of the executing processor. SCMI protocols allow an SCMI agent to discover and access external resources as clock, reset controllers and more. SCMI agent and server communicate following the SCMI specification [1]. This SCMI agent implementation complies with the DT bindings defined in the Linux kernel source tree regarding SCMI agent description since v5.8. Links: [1] https://developer.arm.com/architectures/system-architectures/software-standards/scmi Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Cc: Simon Glass <sjg@chromium.org> Cc: Peng Fan <peng.fan@nxp.com> Cc: Sudeep Holla <sudeep.holla@arm.com> Reviewed-by: Simon Glass <sjg@chromium.org>
38 lines
1.1 KiB
C
38 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (C) 2020, Linaro Limited
|
|
*
|
|
* Tests scmi_agent uclass and the SCMI drivers implemented in other
|
|
* uclass devices probe when a SCMI server exposes resources.
|
|
*
|
|
* Note in test.dts the protocol@10 node in agent 1. Protocol 0x10 is not
|
|
* implemented in U-Boot SCMI components but the implementation is exepected
|
|
* to not complain on unknown protocol IDs, as long as it is not used. Note
|
|
* in test.dts tests that SCMI drivers probing does not fail for such an
|
|
* unknown SCMI protocol ID.
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <asm/scmi_test.h>
|
|
#include <dm/device-internal.h>
|
|
#include <dm/test.h>
|
|
#include <test/ut.h>
|
|
|
|
/*
|
|
* Test SCMI states when loading and releasing resources
|
|
* related to SCMI drivers.
|
|
*/
|
|
static int dm_test_scmi_sandbox_agent(struct unit_test_state *uts)
|
|
{
|
|
struct sandbox_scmi_service *scmi_ctx = sandbox_scmi_service_ctx();
|
|
|
|
ut_assertnonnull(scmi_ctx);
|
|
ut_asserteq(2, scmi_ctx->agent_count);
|
|
ut_assertnull(scmi_ctx->agent[0]);
|
|
ut_assertnull(scmi_ctx->agent[1]);
|
|
|
|
return 0;
|
|
}
|
|
|
|
DM_TEST(dm_test_scmi_sandbox_agent, UT_TESTF_SCAN_FDT);
|