git: 0600af1ff160 - main - Make SMCCC usable by device drivers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 29 Jan 2023 14:59:53 UTC
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=0600af1ff16041f15633b2263a8ad9525eecd2f1 commit 0600af1ff16041f15633b2263a8ad9525eecd2f1 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2022-06-04 11:13:51 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2023-01-29 14:58:24 +0000 Make SMCCC usable by device drivers To allow device drivers to call into SMCCC we need to initialise it earlier. As it depends on PSCI, and that is detected via ACPI or FDT move the call to smccc_init to the PSCI driver. Add a function for drivers to read the smccc version, or 0 if smccc is not present. --- sys/dev/psci/psci.c | 2 ++ sys/dev/psci/smccc.c | 11 ++++++++--- sys/dev/psci/smccc.h | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/dev/psci/psci.c b/sys/dev/psci/psci.c index d7c89bf058f8..41a48e36dec9 100644 --- a/sys/dev/psci/psci.c +++ b/sys/dev/psci/psci.c @@ -344,6 +344,8 @@ psci_attach(device_t dev, psci_initfn_t psci_init, int default_version) if (psci_init(dev, default_version)) return (ENXIO); + smccc_init(); + psci_softc = sc; return (0); diff --git a/sys/dev/psci/smccc.c b/sys/dev/psci/smccc.c index 54673d431d4c..64732d58e2d4 100644 --- a/sys/dev/psci/smccc.c +++ b/sys/dev/psci/smccc.c @@ -47,8 +47,8 @@ __FBSDID("$FreeBSD$"); /* Assume 1.0 until we detect a later version */ static uint32_t smccc_version = SMCCC_VERSION_1_0; -static void -smccc_init(void *dummy) +void +smccc_init(void) { int32_t features; uint32_t ret; @@ -67,7 +67,12 @@ smccc_init(void *dummy) SMCCC_VERSION_MINOR(smccc_version)); } } -SYSINIT(smccc_start, SI_SUB_CONFIGURE, SI_ORDER_ANY, smccc_init, NULL); + +uint32_t +smccc_get_version(void) +{ + return (smccc_version); +} int32_t smccc_arch_features(uint32_t smccc_func_id) diff --git a/sys/dev/psci/smccc.h b/sys/dev/psci/smccc.h index 4dc4c089df65..58b976029a3c 100644 --- a/sys/dev/psci/smccc.h +++ b/sys/dev/psci/smccc.h @@ -82,6 +82,8 @@ struct arm_smccc_res { #define SMCCC_RET_NOT_SUPPORTED -1 #define SMCCC_RET_NOT_REQUIRED -2 +void smccc_init(void); +uint32_t smccc_get_version(void); int32_t smccc_arch_features(uint32_t); int smccc_arch_workaround_1(void); int smccc_arch_workaround_2(int);