Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/isa Provide some defaults. From Felix Deichmann.



details:   https://anonhg.NetBSD.org/src/rev/106d83f0902a
branches:  trunk
changeset: 816335:106d83f0902a
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Jun 30 20:39:54 2016 +0000

description:
Provide some defaults.  From Felix Deichmann.

diffstat:

 sys/dev/isa/slhci_isa.c |  33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)

diffs (71 lines):

diff -r db8a68399626 -r 106d83f0902a sys/dev/isa/slhci_isa.c
--- a/sys/dev/isa/slhci_isa.c   Thu Jun 30 18:43:43 2016 +0000
+++ b/sys/dev/isa/slhci_isa.c   Thu Jun 30 20:39:54 2016 +0000
@@ -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 @@
        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 @@
        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 @@
        }
 
        /* 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;



Home | Main Index | Thread Index | Old Index