Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/arm arm: PSCI: Add a function to return the PSC...



details:   https://anonhg.NetBSD.org/src/rev/2a88331bcde2
branches:  trunk
changeset: 985083:2a88331bcde2
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Aug 07 21:20:14 2021 +0000

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

diffstat:

 sys/arch/arm/arm/psci.c |  16 ++++++++++++++--
 sys/arch/arm/arm/psci.h |  16 +++++++++++++++-
 2 files changed, 29 insertions(+), 3 deletions(-)

diffs (74 lines):

diff -r bb56b06f58f3 -r 2a88331bcde2 sys/arch/arm/arm/psci.c
--- a/sys/arch/arm/arm/psci.c   Sat Aug 07 21:19:15 2021 +0000
+++ b/sys/arch/arm/arm/psci.c   Sat Aug 07 21:20:14 2021 +0000
@@ -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@localhost>
@@ -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 @@
        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)
 {
diff -r bb56b06f58f3 -r 2a88331bcde2 sys/arch/arm/arm/psci.h
--- a/sys/arch/arm/arm/psci.h   Sat Aug 07 21:19:15 2021 +0000
+++ b/sys/arch/arm/arm/psci.h   Sat Aug 07 21:20:14 2021 +0000
@@ -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@localhost>
@@ -42,6 +42,15 @@
 };
 
 /*
+ * Possible PSCI conduits.
+ */
+enum psci_conduit {
+       PSCI_CONDUIT_NONE,
+       PSCI_CONDUIT_SMC,
+       PSCI_CONDUIT_HVC,
+};
+
+/*
  * PSCI error codes
  */
 #define        PSCI_SUCCESS            0
@@ -71,6 +80,11 @@
 bool   psci_available(void);
 
 /*
+ * Return the PSCI conduit type.
+ */
+enum psci_conduit psci_conduit(void);
+
+/*
  * PSCI call methods, implemented in psci.S
  */
 int    psci_call_smc(register_t, register_t, register_t, register_t);



Home | Main Index | Thread Index | Old Index