Module Name:    src
Committed By:   skrll
Date:           Thu Jun 30 20:39:54 UTC 2016

Modified Files:
        src/sys/dev/isa: slhci_isa.c

Log Message:
Provide some defaults.  From Felix Deichmann.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/isa/slhci_isa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/isa/slhci_isa.c
diff -u src/sys/dev/isa/slhci_isa.c:1.13 src/sys/dev/isa/slhci_isa.c:1.14
--- src/sys/dev/isa/slhci_isa.c:1.13	Sat Apr 23 10:15:31 2016
+++ src/sys/dev/isa/slhci_isa.c	Thu Jun 30 20:39:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: slhci_isa.c,v 1.13 2016/04/23 10:15:31 skrll Exp $	*/
+/*	$NetBSD: slhci_isa.c,v 1.14 2016/06/30 20:39:54 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Kiyoshi Ikehara. All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: slhci_isa.c,v 1.13 2016/04/23 10:15:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: slhci_isa.c,v 1.14 2016/06/30 20:39:54 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -74,6 +74,22 @@ slhci_isa_match(device_t parent, cfdata_
 	int result = 0;
 	uint8_t sltype;
 
+	if (ia->ia_nio < 1)
+		goto out;
+	if (ia->ia_nirq < 1)
+		goto out;
+
+	if (ISA_DIRECT_CONFIG(ia))
+		goto out;
+
+	/* Disallow wildcarded i/o address. */
+	if (ia->ia_io[0].ir_addr == ISA_UNKNOWN_PORT)
+		goto out;
+
+	/* Don't allow wildcarded IRQ. */
+	if (ia->ia_irq[0].ir_irq == ISA_UNKNOWN_IRQ)
+		goto out;
+
 	if (bus_space_map(iot, ia->ia_io[0].ir_addr, SL11_PORTSIZE, 0, &ioh))
 		goto out;
 
@@ -85,6 +101,15 @@ slhci_isa_match(device_t parent, cfdata_
 	bus_space_unmap(iot, ioh, SL11_PORTSIZE);
 
  out:
+	if (result) {
+		ia->ia_nio = 1;
+		ia->ia_io[0].ir_size = SL11_PORTSIZE;
+
+		ia->ia_nirq = 1;
+
+		ia->ia_niomem = 0;
+		ia->ia_ndrq = 0;
+	}
 	return (result);
 }
 
@@ -109,11 +134,11 @@ slhci_isa_attach(device_t parent, device
 	}
 
 	/* Initialize sc XXX power value unconfirmed */
-	slhci_preinit(sc, NULL, iot, ioh, 30, SL11_IDX_DATA);
+	slhci_preinit(sc, NULL, iot, ioh, 500, SL11_IDX_DATA);
 
 	/* Establish the interrupt handler */
 	isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq,
-					IST_EDGE, IPL_USB, slhci_intr, sc);
+	    IST_EDGE, IPL_USB, slhci_intr, sc);
 	if (isc->sc_ih == NULL) {
 		printf("%s: can't establish interrupt\n", SC_NAME(sc));
 		return;

Reply via email to