Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133172817
D46988.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D46988.id.diff
View Options
diff --git a/sys/dev/psci/psci.c b/sys/dev/psci/psci.c
--- a/sys/dev/psci/psci.c
+++ b/sys/dev/psci/psci.c
@@ -71,6 +71,7 @@
struct psci_softc {
device_t dev;
+ device_t smccc_dev;
uint32_t psci_version;
uint32_t psci_fnids[PSCI_FN_MAX];
@@ -341,11 +342,16 @@
if (psci_init(dev, default_version))
return (ENXIO);
+ psci_softc = sc;
+
#ifdef __aarch64__
smccc_init();
-#endif
+ sc->smccc_dev = device_add_child(dev, "smccc", DEVICE_UNIT_ANY);
+ if (sc->smccc_dev == NULL)
+ device_printf(dev, "Unable to add SMCCC device\n");
- psci_softc = sc;
+ bus_generic_attach(dev);
+#endif
return (0);
}
diff --git a/sys/dev/psci/smccc.c b/sys/dev/psci/smccc.c
--- a/sys/dev/psci/smccc.c
+++ b/sys/dev/psci/smccc.c
@@ -34,7 +34,9 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <dev/psci/psci.h>
#include <dev/psci/smccc.h>
@@ -66,6 +68,32 @@
}
}
+static int
+smccc_probe(device_t dev)
+{
+ int32_t version;
+
+ /*
+ * If the version is not implemented then we treat it as SMCCC 1.0
+ */
+ if (psci_features(SMCCC_VERSION) == PSCI_RETVAL_NOT_SUPPORTED ||
+ (version = arm_smccc_invoke(SMCCC_VERSION, NULL)) <= 0) {
+ device_set_desc(dev, "ARM SMCCC v1.0");
+ return (0);
+ }
+
+ device_set_descf(dev, "ARM SMCCC v%d.%d", SMCCC_VERSION_MAJOR(version),
+ SMCCC_VERSION_MINOR(version));
+
+ return (0);
+}
+
+static int
+smccc_attach(device_t dev)
+{
+ return (bus_generic_attach(dev));
+}
+
uint32_t
smccc_get_version(void)
{
@@ -107,3 +135,21 @@
("SMCCC arch workaround 2 called with an invalid SMCCC interface"));
return (arm_smccc_invoke(SMCCC_ARCH_WORKAROUND_2, enable, NULL));
}
+
+static device_method_t smccc_methods[] = {
+ DEVMETHOD(device_probe, smccc_probe),
+ DEVMETHOD(device_attach, smccc_attach),
+
+ DEVMETHOD(bus_add_child, bus_generic_add_child),
+
+ DEVMETHOD_END
+};
+
+static driver_t smccc_driver = {
+ "smccc",
+ smccc_methods,
+ 0,
+};
+
+EARLY_DRIVER_MODULE(smccc, psci, smccc_driver, 0, 0,
+ BUS_PASS_CPU + BUS_PASS_ORDER_FIRST);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 24, 4:01 PM (10 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24124533
Default Alt Text
D46988.id.diff (2 KB)
Attached To
Mode
D46988: dev/psci: Make SMCCC into a real driver
Attached
Detach File
Event Timeline
Log In to Comment