git: a2228dc70153 - stable/13 - Allow psci.h to be used by userspace
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 25 Sep 2023 11:00:41 UTC
The branch stable/13 has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=a2228dc7015344b4d8d532f75c3eb175c56ac513
commit a2228dc7015344b4d8d532f75c3eb175c56ac513
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-03-16 12:08:32 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-09-25 08:41:15 +0000
Allow psci.h to be used by userspace
Wrap parts of psci.h that aren't usable by userspace in _KERNEL checks.
This allows it to be used to implement PSCI and SMCCC by bhyve in
userspace.
Sponsored by: Arm Ltd
Sponsored by: Innovate UK
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 473ab212dc1f72c1765f112568237d229d4e0441)
---
sys/dev/psci/psci.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys/dev/psci/psci.h b/sys/dev/psci/psci.h
index 6eeab8ab6071..c34b5d0b104f 100644
--- a/sys/dev/psci/psci.h
+++ b/sys/dev/psci/psci.h
@@ -30,6 +30,7 @@
#include <sys/types.h>
#include <dev/psci/smccc.h>
+#ifdef _KERNEL
typedef int (*psci_initfn_t)(device_t dev, int default_version);
typedef int (*psci_callfn_t)(register_t, register_t, register_t, register_t,
register_t, register_t, register_t, register_t,
@@ -50,6 +51,7 @@ psci_call(register_t a, register_t b, register_t c, register_t d)
return (psci_callfn(a, b, c, d, 0, 0, 0, 0, NULL));
}
+#endif
/*
* PSCI return codes.
@@ -100,6 +102,7 @@ psci_call(register_t a, register_t b, register_t c, register_t d)
#define PSCI_VER_MAJOR(v) (((v) >> 16) & 0xFF)
#define PSCI_VER_MINOR(v) ((v) & 0xFF)
+#ifdef _KERNEL
enum psci_fn {
PSCI_FN_VERSION,
PSCI_FN_CPU_SUSPEND,
@@ -113,5 +116,6 @@ enum psci_fn {
PSCI_FN_SYSTEM_RESET,
PSCI_FN_MAX
};
+#endif
#endif /* _MACHINE_PSCI_H_ */