summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2005-01-15 22:02:01 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2005-01-15 22:02:01 +0000
commitcfff5d54585f53c45c33efa22b494968a96dc65f (patch)
treec44adc0c244c8d52b116fd3f7da9636b88ae9ab0
parent2d36344d6f6b3dda84d6da3a18033bd27c53bcbf (diff)
A better diagnostic when we encounter extra scodes used by an unsupported
devices for which diodevs has the wrong span value. Before this, we would get: tiger display at dio0 scode 157 not configured internal HP-IB at dio0 scode 158 not configured internal HP-IB at dio0 scode 159 not configured Now, we will get: tiger display at dio0 scode 157 not configured dio0: warning: select code 158 is likely a span of a previous unsupported device dio0: warning: select code 159 is likely a span of a previous unsupported device
-rw-r--r--sys/arch/hp300/dev/dio.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/arch/hp300/dev/dio.c b/sys/arch/hp300/dev/dio.c
index c71340be620..705a1b08d7a 100644
--- a/sys/arch/hp300/dev/dio.c
+++ b/sys/arch/hp300/dev/dio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dio.c,v 1.10 2004/12/26 21:41:32 miod Exp $ */
+/* $OpenBSD: dio.c,v 1.11 2005/01/15 22:02:00 miod Exp $ */
/* $NetBSD: dio.c,v 1.7 1997/05/05 21:00:32 thorpej Exp $ */
/*-
@@ -148,8 +148,25 @@ dioattach(parent, self, aux)
da.da_scode = scode;
if (scode == 7 && internalhpib)
da.da_id = DIO_DEVICE_ID_IHPIB;
- else
+ else {
da.da_id = DIO_ID(va);
+ /*
+ * If we probe an unknown device, we do not necessarily
+ * know how many scodes it will span.
+ * Extra scodes will usually report an id of zero,
+ * which would match ihpib!
+ * Check for this, warn the user, and skip that scode.
+ */
+ if (da.da_id == 0) {
+ if (didmap)
+ iounmap(va, NBPG);
+ printf("%s: warning: select code %d is likely "
+ "a span of a previous unsupported device\n",
+ self->dv_xname, scode);
+ scode++;
+ continue;
+ }
+ }
if (DIO_ISFRAMEBUFFER(da.da_id))
da.da_secid = DIO_SECID(va);