git: 473ab212dc1f - main - Allow psci.h to be used by userspace
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Mar 2023 13:17:10 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=473ab212dc1f72c1765f112568237d229d4e0441
commit 473ab212dc1f72c1765f112568237d229d4e0441
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-03-16 12:08:32 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-03-16 13:08:00 +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
---
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 8004498426c5..be5f55f49115 100644
--- a/sys/dev/psci/psci.h
+++ b/sys/dev/psci/psci.h
@@ -32,6 +32,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,
@@ -52,6 +53,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.
@@ -102,6 +104,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,
@@ -115,5 +118,6 @@ enum psci_fn {
PSCI_FN_SYSTEM_RESET,
PSCI_FN_MAX
};
+#endif
#endif /* _MACHINE_PSCI_H_ */