Page MenuHomeFreeBSD

D26402.id.diff
No OneTemporary

D26402.id.diff

Index: sys/dev/extres/syscon/syscon_generic.h
===================================================================
--- sys/dev/extres/syscon/syscon_generic.h
+++ sys/dev/extres/syscon/syscon_generic.h
@@ -29,7 +29,10 @@
#ifndef DEV_SYSCON_GENERIC_H
#define DEV_SYSCON_GENERIC_H
+#include <dev/fdt/simplebus.h>
+
struct syscon_generic_softc {
+ struct simplebus_softc sc_simplebus;
device_t dev;
struct syscon *syscon;
struct resource *mem_res;
Index: sys/dev/extres/syscon/syscon_generic.c
===================================================================
--- sys/dev/extres/syscon/syscon_generic.c
+++ sys/dev/extres/syscon/syscon_generic.c
@@ -46,6 +46,8 @@
#include <machine/bus.h>
+#include <dev/fdt/simplebus.h>
+
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -60,6 +62,7 @@
uint32_t val);
static int syscon_generic_modify_4(struct syscon *syscon, bus_size_t offset,
uint32_t clear_bits, uint32_t set_bits);
+static int syscon_generic_get_handle(device_t dev, struct syscon **syscon);
/*
* Generic syscon driver (FDT)
@@ -84,8 +87,8 @@
SYSCONMETHOD_END
};
-DEFINE_CLASS_1(syscon_generic, syscon_generic_class, syscon_generic_methods,
- 0, syscon_class);
+DEFINE_CLASS_1(syscon_generic_syscon, syscon_generic_class,
+ syscon_generic_methods, 0, syscon_class);
static uint32_t
syscon_generic_read_4(struct syscon *syscon, bus_size_t offset)
@@ -133,6 +136,19 @@
}
static int
+syscon_generic_get_handle(device_t dev, struct syscon **syscon)
+{
+ struct syscon_generic_softc *sc;
+
+ sc = device_get_softc(dev);
+ *syscon = sc->syscon;
+ if (*syscon == NULL)
+ return (ENODEV);
+
+ return (0);
+}
+
+static int
syscon_generic_probe(device_t dev)
{
@@ -145,6 +161,9 @@
if (!bootverbose)
device_quiet(dev);
+ if (ofw_bus_is_compatible(dev, "simple-bus")) {
+ return (BUS_PROBE_DEFAULT);
+ }
return (BUS_PROBE_GENERIC);
}
@@ -172,6 +191,10 @@
device_printf(dev, "Failed to create/register syscon\n");
return (ENXIO);
}
+
+ if (ofw_bus_is_compatible(dev, "simple-bus"))
+ simplebus_attach(sc->dev);
+
return (0);
}
@@ -186,6 +209,9 @@
free(sc->syscon, M_SYSCON);
}
+ if (ofw_bus_is_compatible(dev, "simple-bus"))
+ simplebus_detach(sc->dev);
+
SYSCON_LOCK_DESTROY(sc);
if (sc->mem_res != NULL)
@@ -199,13 +225,16 @@
DEVMETHOD(device_attach, syscon_generic_attach),
DEVMETHOD(device_detach, syscon_generic_detach),
+ DEVMETHOD(syscon_get_handle, syscon_generic_get_handle),
+
DEVMETHOD_END
};
-DEFINE_CLASS_0(syscon_generic, syscon_generic_driver, syscon_generic_dmethods,
- sizeof(struct syscon_generic_softc));
+DEFINE_CLASS_1(syscon_generic, syscon_generic_driver, syscon_generic_dmethods,
+ sizeof(struct syscon_generic_softc), simplebus_driver);
static devclass_t syscon_generic_devclass;
EARLY_DRIVER_MODULE(syscon_generic, simplebus, syscon_generic_driver,
- syscon_generic_devclass, 0, 0, BUS_PASS_DEFAULT);
+ syscon_generic_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE);
MODULE_VERSION(syscon_generic, 1);
+

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 23, 12:21 PM (11 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35401783
Default Alt Text
D26402.id.diff (3 KB)

Event Timeline