Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/atari/isa Fix silent hang during config_console() (...



details:   https://anonhg.NetBSD.org/src/rev/002d70cebfd2
branches:  trunk
changeset: 358869:002d70cebfd2
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jan 20 18:01:53 2018 +0000

description:
Fix silent hang during config_console() (before consinit()) on Milan.

config_console() was a dirty hack used by ancient m68k ports
to probe and initialize console devices before "real" configure(9),
using subset of configure(9) functions.

In that case, most device specific data (except I/O access method)
are not initialized so we must not access device specific device_t and
softc structures in config_console() cases.

diffstat:

 sys/arch/atari/isa/isa_machdep.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r 7c309f222a02 -r 002d70cebfd2 sys/arch/atari/isa/isa_machdep.c
--- a/sys/arch/atari/isa/isa_machdep.c  Sat Jan 20 17:37:15 2018 +0000
+++ b/sys/arch/atari/isa/isa_machdep.c  Sat Jan 20 18:01:53 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: isa_machdep.c,v 1.40 2012/10/13 17:58:54 jdc Exp $     */
+/*     $NetBSD: isa_machdep.c,v 1.41 2018/01/20 18:01:53 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1997 Leo Weppelman.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.40 2012/10/13 17:58:54 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.41 2018/01/20 18:01:53 tsutsui Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -111,17 +111,14 @@
 void
 isabusattach(device_t parent, device_t self, void *aux)
 {
-       struct isabus_softc *sc = device_private(self);
+       struct isabus_softc *sc;
        struct isabus_attach_args       iba;
        extern struct atari_bus_dma_tag isa_bus_dma_tag;
        extern void isa_bus_init(void);
 
-       sc->sc_dev = self;
-
        iba.iba_dmat    = &isa_bus_dma_tag;
        iba.iba_iot     = leb_alloc_bus_space_tag(&bs_storage[0]);
        iba.iba_memt    = leb_alloc_bus_space_tag(&bs_storage[1]);
-       iba.iba_ic      = &sc->sc_chipset;
        if ((iba.iba_iot == NULL) || (iba.iba_memt == NULL)) {
                printf("leb_alloc_bus_space_tag failed!\n");
                return;
@@ -139,6 +136,10 @@
                return;
        }
 
+       sc = device_private(self);
+       sc->sc_dev = self;
+       iba.iba_ic = &sc->sc_chipset;
+
        printf("\n");
        config_found_ia(self, "isabus", &iba, atariisabusprint);
 }



Home | Main Index | Thread Index | Old Index