summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1999-07-11 13:42:37 +0000
committerdfr <dfr@FreeBSD.org>1999-07-11 13:42:37 +0000
commit064ed23661dd3f474ef0062c7a164c42189638be (patch)
tree763d88b395ddb0fe28d67daab0f1128ffd1ad61c
parent417022436a9def8a12b8f29ad4f21c07cdea4116 (diff)
downloadFreeBSD-src-064ed23661dd3f474ef0062c7a164c42189638be.zip
FreeBSD-src-064ed23661dd3f474ef0062c7a164c42189638be.tar.gz
Add a hook for a bus to detect child devices which didn't find drivers.
This allows the bus to print an informative message about unknown devices. Submitted by: Matthew N. Dodd <winter@jurai.net>
-rw-r--r--sys/dev/eisa/eisaconf.c23
-rw-r--r--sys/i386/eisa/eisaconf.c23
-rw-r--r--sys/kern/bus_if.m12
-rw-r--r--sys/kern/subr_bus.c4
4 files changed, 56 insertions, 6 deletions
diff --git a/sys/dev/eisa/eisaconf.c b/sys/dev/eisa/eisaconf.c
index 483c6e7..5fa1113 100644
--- a/sys/dev/eisa/eisaconf.c
+++ b/sys/dev/eisa/eisaconf.c
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: eisaconf.c,v 1.45 1999/05/24 03:08:46 peter Exp $
+ * $Id: eisaconf.c,v 1.46 1999/06/22 09:44:00 peter Exp $
*/
#include "opt_eisa.h"
@@ -104,7 +104,7 @@ mainboard_probe(device_t dev)
if (idstring == NULL) {
panic("Eisa probe unable to malloc");
}
- sprintf(idstring, "%c%c%c%x%x (System Board)",
+ sprintf(idstring, "%c%c%c%03x%01x (System Board)",
EISA_MFCTR_CHAR0(id),
EISA_MFCTR_CHAR1(id),
EISA_MFCTR_CHAR2(id),
@@ -195,6 +195,24 @@ eisa_probe(device_t dev)
}
static void
+eisa_probe_nomatch(device_t dev, device_t child)
+{
+ u_int32_t eisa_id = eisa_get_id(child);
+ u_int8_t slot = eisa_get_slot(child);
+
+ device_printf(dev, "unknown card %c%c%c%03x%01x (0x%08x) at slot %d\n",
+ EISA_MFCTR_CHAR0(eisa_id),
+ EISA_MFCTR_CHAR1(eisa_id),
+ EISA_MFCTR_CHAR2(eisa_id),
+ EISA_PRODUCT_ID(eisa_id),
+ EISA_REVISION_ID(eisa_id),
+ eisa_id,
+ slot);
+
+ return;
+}
+
+static void
eisa_print_child(device_t dev, device_t child)
{
/* XXX print resource descriptions? */
@@ -476,6 +494,7 @@ static device_method_t eisa_methods[] = {
/* Bus interface */
DEVMETHOD(bus_print_child, eisa_print_child),
+ DEVMETHOD(bus_probe_nomatch, eisa_probe_nomatch),
DEVMETHOD(bus_read_ivar, eisa_read_ivar),
DEVMETHOD(bus_write_ivar, eisa_write_ivar),
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
diff --git a/sys/i386/eisa/eisaconf.c b/sys/i386/eisa/eisaconf.c
index 483c6e7..5fa1113 100644
--- a/sys/i386/eisa/eisaconf.c
+++ b/sys/i386/eisa/eisaconf.c
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: eisaconf.c,v 1.45 1999/05/24 03:08:46 peter Exp $
+ * $Id: eisaconf.c,v 1.46 1999/06/22 09:44:00 peter Exp $
*/
#include "opt_eisa.h"
@@ -104,7 +104,7 @@ mainboard_probe(device_t dev)
if (idstring == NULL) {
panic("Eisa probe unable to malloc");
}
- sprintf(idstring, "%c%c%c%x%x (System Board)",
+ sprintf(idstring, "%c%c%c%03x%01x (System Board)",
EISA_MFCTR_CHAR0(id),
EISA_MFCTR_CHAR1(id),
EISA_MFCTR_CHAR2(id),
@@ -195,6 +195,24 @@ eisa_probe(device_t dev)
}
static void
+eisa_probe_nomatch(device_t dev, device_t child)
+{
+ u_int32_t eisa_id = eisa_get_id(child);
+ u_int8_t slot = eisa_get_slot(child);
+
+ device_printf(dev, "unknown card %c%c%c%03x%01x (0x%08x) at slot %d\n",
+ EISA_MFCTR_CHAR0(eisa_id),
+ EISA_MFCTR_CHAR1(eisa_id),
+ EISA_MFCTR_CHAR2(eisa_id),
+ EISA_PRODUCT_ID(eisa_id),
+ EISA_REVISION_ID(eisa_id),
+ eisa_id,
+ slot);
+
+ return;
+}
+
+static void
eisa_print_child(device_t dev, device_t child)
{
/* XXX print resource descriptions? */
@@ -476,6 +494,7 @@ static device_method_t eisa_methods[] = {
/* Bus interface */
DEVMETHOD(bus_print_child, eisa_print_child),
+ DEVMETHOD(bus_probe_nomatch, eisa_probe_nomatch),
DEVMETHOD(bus_read_ivar, eisa_read_ivar),
DEVMETHOD(bus_write_ivar, eisa_write_ivar),
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m
index 6311601..8cc6e5e 100644
--- a/sys/kern/bus_if.m
+++ b/sys/kern/bus_if.m
@@ -23,7 +23,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $Id: bus_if.m,v 1.10 1999/05/14 11:22:39 dfr Exp $
+# $Id: bus_if.m,v 1.11 1999/05/28 09:25:08 dfr Exp $
#
INTERFACE bus;
@@ -53,6 +53,16 @@ METHOD void print_child {
device_t child;
};
+#
+# Called for each child device that
+# did not succeed in probing for a
+# driver.
+#
+METHOD void probe_nomatch {
+ device_t dev;
+ device_t child;
+};
+
#
# These two methods manage a bus specific set of instance variables of
# a child device. The intention is that each different type of bus
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index e3a601f..d4819bf 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: subr_bus.c,v 1.28 1999/05/28 09:25:10 dfr Exp $
+ * $Id: subr_bus.c,v 1.29 1999/05/30 10:27:11 dfr Exp $
*/
#include <sys/param.h>
@@ -1104,6 +1104,8 @@ device_probe_and_attach(device_t dev)
device_set_driver(dev, NULL);
dev->state = DS_NOTPRESENT;
}
+ } else {
+ BUS_PROBE_NOMATCH(bus, dev);
}
} else {
device_print_prettyname(dev);
OpenPOWER on IntegriCloud