Move cn_tab initialization from late cpu_startup(9) to

early _bootstrap() in locore2.c.
Tested on TME emulating 2/120.
This commit is contained in:
tsutsui 2012-08-10 14:52:26 +00:00
parent 63748965b8
commit 254bb11f96
3 changed files with 15 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: consinit.c,v 1.8 2012/07/30 17:27:20 christos Exp $ */
/* $NetBSD: consinit.c,v 1.9 2012/08/10 14:52:26 tsutsui Exp $ */
/*-
* Copyright (c) 2001 Matthew Fredette
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.8 2012/07/30 17:27:20 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.9 2012/08/10 14:52:26 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -95,16 +95,6 @@ struct consdev consdev_prom = {
NULL,
};
/*
* The console table pointer is statically initialized
* to point to the PROM (output only) table, so that
* early calls to printf will work. This has been moved
* to cpu_startup()
*/
#if 0
struct consdev *cn_tab = &consdev_prom;
#endif
void
prom_cnprobe(struct consdev *cd)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore2.c,v 1.25 2011/07/17 20:54:48 joerg Exp $ */
/* $NetBSD: locore2.c,v 1.26 2012/08/10 14:52:26 tsutsui Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: locore2.c,v 1.25 2011/07/17 20:54:48 joerg Exp $");
__KERNEL_RCSID(0, "$NetBSD: locore2.c,v 1.26 2012/08/10 14:52:26 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_modular.h"
@ -44,6 +44,8 @@ __KERNEL_RCSID(0, "$NetBSD: locore2.c,v 1.25 2011/07/17 20:54:48 joerg Exp $");
#include <uvm/uvm_extern.h>
#include <dev/cons.h>
#include <machine/cpu.h>
#include <machine/db_machdep.h>
#include <machine/dvma.h>
@ -255,6 +257,7 @@ _verify_hardware(void)
void
_bootstrap(void)
{
extern struct consdev consdev_prom; /* XXX */
vaddr_t va;
/* First, Clear BSS. */
@ -263,6 +266,12 @@ _bootstrap(void)
/* Initialize the PROM. */
prom_init();
/*
* Initialize console to point to the PROM (output only) table
* for early printf calls.
*/
cn_tab = &consdev_prom;
/* Copy the IDPROM from control space. */
idprom_init();

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.75 2012/07/30 17:27:20 christos Exp $ */
/* $NetBSD: machdep.c,v 1.76 2012/08/10 14:52:26 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -149,7 +149,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.75 2012/07/30 17:27:20 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.76 2012/08/10 14:52:26 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -258,7 +258,6 @@ static vaddr_t dumppage;
static void identifycpu(void);
static void initcpu(void);
extern struct consdev *cn_tab, consdev_prom;
/*
* cpu_startup: allocate memory for variable-sized tables,
@ -275,7 +274,6 @@ cpu_startup(void)
vaddr_t minaddr, maxaddr;
char pbuf[9];
cn_tab = &consdev_prom;
/*
* Initialize message buffer (for kernel printf).
* This is put in physical pages four through seven