Sync with sparc: rename

stdinnode => prom_stdin_node,
	fbnode => prom_stdout_node.
This commit is contained in:
pk 2004-03-19 15:21:42 +00:00
parent b2c52e1175
commit 6c02638ef2
2 changed files with 44 additions and 27 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cons.h,v 1.3 2000/05/19 05:26:17 eeh Exp $ */ /* $NetBSD: cons.h,v 1.4 2004/03/19 15:21:42 pk Exp $ */
/*- /*-
* Copyright (c) 2000 Eduardo E. Horvath * Copyright (c) 2000 Eduardo E. Horvath
@ -66,3 +66,13 @@ zs_get_chan_addr __P((int zsc_unit, int channel));
void zs_kgdb_init __P((void)); void zs_kgdb_init __P((void));
void zskgdb __P((struct zs_chanstate *)); void zskgdb __P((struct zs_chanstate *));
#endif #endif
/*
* PROM I/O nodes and arguments are prepared by consinit().
* Drivers can examine these when looking for a console device match.
*/
extern int prom_stdin_node;
extern int prom_stdout_node;
extern char prom_stdin_args[]; /* not used on sun4u */
extern char prom_stdout_args[]; /* not used on sun4u */

View File

@ -1,4 +1,4 @@
/* $NetBSD: consinit.c,v 1.14 2003/10/21 08:20:15 petrov Exp $ */ /* $NetBSD: consinit.c,v 1.15 2004/03/19 15:21:42 pk Exp $ */
/*- /*-
* Copyright (c) 1999 Eduardo E. Horvath * Copyright (c) 1999 Eduardo E. Horvath
@ -29,7 +29,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.14 2003/10/21 08:20:15 petrov Exp $"); __KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.15 2004/03/19 15:21:42 pk Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
#include "pcons.h" #include "pcons.h"
@ -112,7 +112,7 @@ prom_cngetc(dev)
#ifdef DDB #ifdef DDB
static int nplus = 0; static int nplus = 0;
#endif #endif
while ((l = OF_read(stdin, &ch, 1)) != 1) while ((l = OF_read(stdin, &ch, 1)) != 1)
/* void */; /* void */;
#ifdef DDB #ifdef DDB
@ -161,13 +161,13 @@ prom_cnpollc(dev, on)
/* Entering debugger. */ /* Entering debugger. */
#if NFB > 0 #if NFB > 0
fb_unblank(); fb_unblank();
#endif #endif
} else { } else {
/* Resuming kernel. */ /* Resuming kernel. */
} }
#if NPCONS > 0 #if NPCONS > 0
pcons_cnpollc(dev, on); pcons_cnpollc(dev, on);
#endif #endif
} }
/*****************************************************************/ /*****************************************************************/
@ -178,6 +178,9 @@ prom_cnpollc(dev, on)
#define DBPRINT(x) #define DBPRINT(x)
#endif #endif
int prom_stdin_node;
int prom_stdout_node;
/* /*
* This function replaces sys/dev/cninit.c * This function replaces sys/dev/cninit.c
* Determine which device is the console using * Determine which device is the console using
@ -186,47 +189,51 @@ prom_cnpollc(dev, on)
void void
consinit() consinit()
{ {
register int chosen; int chosen;
char buffer[128]; char buffer[128];
extern int stdinnode, fbnode;
char *consname = "unknown"; char *consname = "unknown";
DBPRINT(("consinit()\r\n")); DBPRINT(("consinit()\r\n"));
if (cn_tab != &consdev_prom) return;
if (cn_tab != &consdev_prom)
DBPRINT(("setting up stdin\r\n")); return;
chosen = OF_finddevice("/chosen"); chosen = OF_finddevice("/chosen");
DBPRINT(("setting up stdin\r\n"));
DBPRINT(("chosen = %x, stdin @ %p\r\n", chosen, &stdin)); DBPRINT(("chosen = %x, stdin @ %p\r\n", chosen, &stdin));
OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)); OF_getprop(chosen, "stdin", &stdin, sizeof(stdin));
DBPRINT(("stdin instance = %x\r\n", stdin)); DBPRINT(("stdin instance = %x\r\n", stdin));
if ((stdinnode = OF_instance_to_package(stdin)) == 0) { if ((prom_stdin_node = OF_instance_to_package(stdin)) == 0) {
printf("WARNING: no PROM stdin\n"); printf("WARNING: no PROM stdin\n");
} }
DBPRINT(("stdin node = %x\r\n", stdinnode)); DBPRINT(("stdin node = %x\r\n", prom_stdin_node));
DBPRINT(("setting up stdout\r\n")); DBPRINT(("setting up stdout\r\n"));
OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)); OF_getprop(chosen, "stdout", &stdout, sizeof(stdout));
DBPRINT(("stdout instance = %x\r\n", stdout)); DBPRINT(("stdout instance = %x\r\n", stdout));
if ((fbnode = OF_instance_to_package(stdout)) == 0) if ((prom_stdout_node = OF_instance_to_package(stdout)) == 0)
printf("WARNING: no PROM stdout\n"); printf("WARNING: no PROM stdout\n");
DBPRINT(("stdout package = %x\r\n", fbnode)); DBPRINT(("stdout package = %x\r\n", fbnode));
DBPRINT(("buffer @ %p\r\n", buffer)); DBPRINT(("buffer @ %p\r\n", buffer));
if (stdinnode && (OF_getproplen(stdinnode,"keyboard") >= 0)) { if (prom_stdin_node != 0 &&
#if NKBD > 0 (OF_getproplen(prom_stdin_node, "keyboard") >= 0)) {
#if NKBD > 0
printf("cninit: kdb/display not configured\n"); printf("cninit: kdb/display not configured\n");
#endif #endif
consname = "keyboard/display"; consname = "keyboard/display";
} else if (fbnode && } else if (prom_stdout_node != 0 &&
(OF_instance_to_path(stdin, buffer, sizeof(buffer)) >= 0)) { (OF_instance_to_path(stdin, buffer, sizeof(buffer)) >= 0)) {
consname = buffer; consname = buffer;
} }
printf("console is %s\n", consname); printf("console is %s\n", consname);
/* Initialize PROM console */ /* Initialize PROM console */
(*cn_tab->cn_probe)(cn_tab); (*cn_tab->cn_probe)(cn_tab);
(*cn_tab->cn_init)(cn_tab); (*cn_tab->cn_init)(cn_tab);