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.
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to