firmware: psci: bind arm smccc features when discovered

Use PSCI device to query Arm SMCCC v1.1 support from secure monitor
and if so, bind drivers for the SMCCC features that monitor supports.

Drivers willing to be bound from Arm SMCCC features discovery can use
macro ARM_SMCCC_FEATURE_DRIVER() to register to smccc feature discovery,
providing target driver name and a callback function that returns
whether or not the SMCCC feature is supported by the system.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
This commit is contained in:
Etienne Carriere 2022-06-01 10:27:33 +02:00 committed by Tom Rini
parent b1ff399c6e
commit 2fbe47b7e7
4 changed files with 118 additions and 1 deletions

View file

@ -83,6 +83,22 @@ struct arm_smccc_quirk {
} state;
};
/**
* struct arm_smccc_feature - Driver registration data for discoverable feature
* @driver_name: name of the driver relate to the SMCCC feature
* @is_supported: callback to test if SMCCC feature is supported
*/
struct arm_smccc_feature {
const char *driver_name;
bool (*is_supported)(void (*invoke_fn)(unsigned long a0, unsigned long a1, unsigned long a2,
unsigned long a3, unsigned long a4, unsigned long a5,
unsigned long a6, unsigned long a7,
struct arm_smccc_res *res));
};
#define ARM_SMCCC_FEATURE_DRIVER(__name) \
ll_entry_declare(struct arm_smccc_feature, __name, arm_smccc_feature)
/**
* __arm_smccc_smc() - make SMC calls
* @a0-a7: arguments passed in registers 0 to 7