summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2006-07-08 17:06:15 +0000
committerimp <imp@FreeBSD.org>2006-07-08 17:06:15 +0000
commitf7c9fd2027eb791acb31a33df08af462cc6322a4 (patch)
tree6dacdab168aa26da6a9fdc1e7c9243c8f60795ad /sys/kern
parentb79f12507fe68f54430e300706187fd1e0c37d7f (diff)
downloadFreeBSD-src-f7c9fd2027eb791acb31a33df08af462cc6322a4.zip
FreeBSD-src-f7c9fd2027eb791acb31a33df08af462cc6322a4.tar.gz
Create bus_enumerate_hinted_children. This routine will allow drivers
to use the hinted child system. Bus drivers that use this need to implmenet the bus_hinted_child method, where they actually add the child to their bus, as they see fit. The bus is repsonsible for getting the attribtues for the child, adding it in the right order, etc. ISA hinting will be updated to use this method. MFC After: 3 days
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/bus_if.m22
-rw-r--r--sys/kern/subr_bus.c34
2 files changed, 56 insertions, 0 deletions
diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m
index b6fc624..05aad09 100644
--- a/sys/kern/bus_if.m
+++ b/sys/kern/bus_if.m
@@ -507,3 +507,25 @@ METHOD int config_intr {
enum intr_trigger _trig;
enum intr_polarity _pol;
} DEFAULT bus_generic_config_intr;
+
+/**
+ * @brief Notify a (bus) driver about a child that the hints mechanism
+ * believes it has discovered.
+ *
+ * The bus is responsible for then adding the child in the right order
+ * and discovering other things about the child. The bus driver is
+ * free to ignore this hint, to do special things, etc. It is all up
+ * to the bus driver to interpret.
+ *
+ * This method is only called in response to the parent bus asking for
+ * hinted devices to be enumerated.
+ *
+ * @param _dev the bus device
+ * @param _dname the name of the device w/o unit numbers
+ * @param _dunit the unit number of the device
+ */
+METHOD void hinted_child {
+ device_t _dev;
+ const char * _dname;
+ int _dunit;
+};
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 44dcd47..2338e60 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -3800,6 +3800,40 @@ driver_module_handler(module_t mod, int what, void *arg)
return (error);
}
+/**
+ * @brief Enumerate all hinted devices for this bus.
+ *
+ * Walks throught he hints for this bus and calls the bus_hinted_child
+ * routine for each one it fines. It searches first for the specific
+ * bus that's being probed for hinted children (eg isa0), and then for
+ * generic children (eg isa).
+ *
+ * @param dev bus device to enumerate
+ */
+void
+bus_enumerate_hinted_children(device_t bus)
+{
+ int i;
+ const char *dname, *busname;
+ int dunit;
+
+ /*
+ * enumerate all devices on the specific bus
+ */
+ busname = device_get_nameunit(bus);
+ i = 0;
+ while (resource_find_match(&i, &dname, &dunit, "at", busname) == 0)
+ BUS_HINTED_CHILD(bus, dname, dunit);
+
+ /*
+ * and all the generic ones.
+ */
+ busname = device_get_name(bus);
+ i = 0;
+ while (resource_find_match(&i, &dname, &dunit, "at", busname) == 0)
+ BUS_HINTED_CHILD(bus, dname, dunit);
+}
+
#ifdef BUS_DEBUG
/* the _short versions avoid iteration by not calling anything that prints
OpenPOWER on IntegriCloud