Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jun 2018 12:33:47 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335056 - head/sys/dev/psci
Message-ID:  <201806131233.w5DCXldN008477@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Wed Jun 13 12:33:47 2018
New Revision: 335056
URL: https://svnweb.freebsd.org/changeset/base/335056

Log:
  Add a handler for the PSCI_FEATURES function. This needs PSCI 1.0, so
  check for this, returning an error if the version is too old.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/dev/psci/psci.c
  head/sys/dev/psci/psci.h

Modified: head/sys/dev/psci/psci.c
==============================================================================
--- head/sys/dev/psci/psci.c	Wed Jun 13 12:32:04 2018	(r335055)
+++ head/sys/dev/psci/psci.c	Wed Jun 13 12:33:47 2018	(r335056)
@@ -414,6 +414,20 @@ psci_find_callfn(psci_callfn_t *callfn)
 	return (PSCI_RETVAL_SUCCESS);
 }
 
+int32_t
+psci_features(uint32_t psci_func_id)
+{
+
+	if (psci_softc == NULL)
+		return (PSCI_RETVAL_NOT_SUPPORTED);
+
+	/* The feature flags were added to PSCI 1.0 */
+	if (PSCI_VER_MAJOR(psci_softc->psci_version) < 1)
+		return (PSCI_RETVAL_NOT_SUPPORTED);
+
+	return (psci_call(PSCI_FNID_FEATURES, psci_func_id, 0, 0));
+}
+
 int
 psci_cpu_on(unsigned long cpu, unsigned long entry, unsigned long context_id)
 {

Modified: head/sys/dev/psci/psci.h
==============================================================================
--- head/sys/dev/psci/psci.h	Wed Jun 13 12:32:04 2018	(r335055)
+++ head/sys/dev/psci/psci.h	Wed Jun 13 12:33:47 2018	(r335056)
@@ -36,12 +36,15 @@ typedef int (*psci_callfn_t)(register_t, register_t, r
 
 extern int psci_present;
 
-void	psci_reset(void);
 int	psci_cpu_on(unsigned long, unsigned long, unsigned long);
+void	psci_reset(void);
+int32_t	psci_features(uint32_t);
+int	psci_get_version(void);
+
+/* One of these handlers will be selected during the boot */
 int	psci_hvc_despatch(register_t, register_t, register_t, register_t);
 int	psci_smc_despatch(register_t, register_t, register_t, register_t);
 
-int	psci_get_version(void);
 
 /*
  * PSCI return codes.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806131233.w5DCXldN008477>