Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbppc/explora/dev Avoid doubly bus_space_map(9) wh...



details:   https://anonhg.NetBSD.org/src/rev/4042df62c4a4
branches:  trunk
changeset: 953295:4042df62c4a4
user:      rin <rin%NetBSD.org@localhost>
date:      Fri Mar 05 06:17:02 2021 +0000

description:
Avoid doubly bus_space_map(9) when pckbc(4) is already attached as console.

diffstat:

 sys/arch/evbppc/explora/dev/pckbc_elb.c |  22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diffs (49 lines):

diff -r add5b0161143 -r 4042df62c4a4 sys/arch/evbppc/explora/dev/pckbc_elb.c
--- a/sys/arch/evbppc/explora/dev/pckbc_elb.c   Fri Mar 05 06:14:47 2021 +0000
+++ b/sys/arch/evbppc/explora/dev/pckbc_elb.c   Fri Mar 05 06:17:02 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pckbc_elb.c,v 1.11 2021/03/05 06:14:47 rin Exp $       */
+/*     $NetBSD: pckbc_elb.c,v 1.12 2021/03/05 06:17:02 rin Exp $       */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pckbc_elb.c,v 1.11 2021/03/05 06:14:47 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_elb.c,v 1.12 2021/03/05 06:17:02 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -84,19 +84,23 @@
        msc->sc_irq = eaa->elb_irq;
        sc->intr_establish = pckbc_elb_intr_establish;
 
-       if (pckbc_is_console(eaa->elb_bt, eaa->elb_base)) {
+       if (pckbc_is_console(eaa->elb_bt,
+           _BUS_SPACE_UNSTRIDE(eaa->elb_bt, eaa->elb_base))) {
                t = &pckbc_consdata;
                pckbc_console_attached = 1;
        } else {
                t = kmem_zalloc(sizeof(struct pckbc_internal), KM_SLEEP);
+
+               t->t_iot = eaa->elb_bt;
+               bus_space_map(eaa->elb_bt,
+                   _BUS_SPACE_UNSTRIDE(eaa->elb_bt, eaa->elb_base), 1, 0,
+                   &t->t_ioh_d);
+               bus_space_map(eaa->elb_bt,
+                   _BUS_SPACE_UNSTRIDE(eaa->elb_bt, eaa->elb_base2), 1, 0,
+                   &t->t_ioh_c);
+               t->t_addr = eaa->elb_base;
        }
 
-       t->t_iot = eaa->elb_bt;
-       bus_space_map(eaa->elb_bt,
-           _BUS_SPACE_UNSTRIDE(eaa->elb_bt, eaa->elb_base), 1, 0, &t->t_ioh_d);
-       bus_space_map(eaa->elb_bt,
-           _BUS_SPACE_UNSTRIDE(eaa->elb_bt, eaa->elb_base2), 1, 0, &t->t_ioh_c);
-       t->t_addr = eaa->elb_base;
        t->t_sc = sc;
        sc->id = t;
 



Home | Main Index | Thread Index | Old Index