Author: andrew
Date: Tue Jan  9 15:57:09 2018
New Revision: 327728
URL: https://svnweb.freebsd.org/changeset/base/327728

Log:
  Add a function to find the PSCI version the firmware implements from
  outside the PSCI driver.
  
  MFC after:    1 week
  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    Tue Jan  9 14:33:05 2018        (r327727)
+++ head/sys/dev/psci/psci.c    Tue Jan  9 15:57:09 2018        (r327728)
@@ -314,7 +314,7 @@ psci_attach(device_t dev, psci_initfn_t psci_init)
 }
 
 static int
-psci_get_version(struct psci_softc *sc)
+_psci_get_version(struct psci_softc *sc)
 {
        uint32_t fnid;
 
@@ -326,6 +326,15 @@ psci_get_version(struct psci_softc *sc)
        return (PSCI_RETVAL_NOT_SUPPORTED);
 }
 
+int
+psci_get_version(void)
+{
+
+       if (psci_softc == NULL)
+               return (PSCI_RETVAL_NOT_SUPPORTED);
+       return (_psci_get_version(psci_softc));
+}
+
 #ifdef FDT
 static int
 psci_fdt_callfn(psci_callfn_t *callfn)
@@ -487,7 +496,7 @@ psci_v0_2_init(device_t dev)
        sc->psci_fnids[PSCI_FN_SYSTEM_OFF]          = PSCI_FNID_SYSTEM_OFF;
        sc->psci_fnids[PSCI_FN_SYSTEM_RESET]        = PSCI_FNID_SYSTEM_RESET;
 
-       version = psci_get_version(sc);
+       version = _psci_get_version(sc);
 
        if (version == PSCI_RETVAL_NOT_SUPPORTED)
                return (1);

Modified: head/sys/dev/psci/psci.h
==============================================================================
--- head/sys/dev/psci/psci.h    Tue Jan  9 14:33:05 2018        (r327727)
+++ head/sys/dev/psci/psci.h    Tue Jan  9 15:57:09 2018        (r327728)
@@ -41,6 +41,7 @@ int   psci_cpu_on(unsigned long, unsigned long, unsigned
 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.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to