arm: PSCI: Add a function to return the PSCI conduit.

This commit is contained in:
jmcneill 2021-08-07 21:20:14 +00:00
parent bd4d5bc042
commit 82ca5e363e
2 changed files with 29 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: psci.c,v 1.6 2021/08/06 19:38:53 jmcneill Exp $ */
/* $NetBSD: psci.c,v 1.7 2021/08/07 21:20:14 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.6 2021/08/06 19:38:53 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.7 2021/08/07 21:20:14 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -68,6 +68,18 @@ psci_call(register_t fid, register_t arg1, register_t arg2, register_t arg3)
return psci_call_fn(fid, arg1, arg2, arg3);
}
enum psci_conduit
psci_conduit(void)
{
if (psci_call_fn == psci_call_smc) {
return PSCI_CONDUIT_SMC;
} else if (psci_call_fn == psci_call_hvc) {
return PSCI_CONDUIT_HVC;
} else {
return PSCI_CONDUIT_NONE;
}
}
uint32_t
psci_version(void)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: psci.h,v 1.3 2021/08/06 19:38:53 jmcneill Exp $ */
/* $NetBSD: psci.h,v 1.4 2021/08/07 21:20:14 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@ -41,6 +41,15 @@ enum psci_function {
PSCI_FUNC_MAX
};
/*
* Possible PSCI conduits.
*/
enum psci_conduit {
PSCI_CONDUIT_NONE,
PSCI_CONDUIT_SMC,
PSCI_CONDUIT_HVC,
};
/*
* PSCI error codes
*/
@ -70,6 +79,11 @@ void psci_init(psci_fn);
*/
bool psci_available(void);
/*
* Return the PSCI conduit type.
*/
enum psci_conduit psci_conduit(void);
/*
* PSCI call methods, implemented in psci.S
*/