Use the promlib I/O routines.
This commit is contained in:
parent
b865f2441c
commit
05a2b2300b
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: com_ebus.c,v 1.20 2003/07/15 03:36:04 lukem Exp $ */
|
||||
/* $NetBSD: com_ebus.c,v 1.21 2004/03/21 15:08:24 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2000 Matthew R. Green
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_ebus.c,v 1.20 2003/07/15 03:36:04 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_ebus.c,v 1.21 2004/03/21 15:08:24 pk Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -77,21 +77,18 @@ com_ebus_match(parent, match, aux)
|
||||
struct ebus_attach_args *ea = aux;
|
||||
int i;
|
||||
|
||||
for (i=0; com_names[i]; i++)
|
||||
for (i = 0; com_names[i]; i++)
|
||||
if (strcmp(ea->ea_name, com_names[i]) == 0)
|
||||
return (1);
|
||||
|
||||
if (strcmp(ea->ea_name, "serial") == 0) {
|
||||
char compat[80];
|
||||
char *compat;
|
||||
|
||||
/* Could be anything. */
|
||||
if ((i = OF_getproplen(ea->ea_node, "compatible")) &&
|
||||
OF_getprop(ea->ea_node, "compatible", compat,
|
||||
sizeof(compat)) == i) {
|
||||
if (strcmp(compat, "su16550") == 0 ||
|
||||
strcmp(compat, "su") == 0) {
|
||||
return (1);
|
||||
}
|
||||
compat = prom_getpropstring(ea->ea_node, "compatible");
|
||||
if (strcmp(compat, "su16550") == 0 ||
|
||||
strcmp(compat, "su") == 0) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
@ -147,8 +144,8 @@ com_ebus_attach(parent, self, aux)
|
||||
kma.kmta_consdev = NULL;
|
||||
|
||||
/* Figure out if we're the console. */
|
||||
com_is_input = (ea->ea_node == OF_instance_to_package(OF_stdin()));
|
||||
com_is_output = (ea->ea_node == OF_instance_to_package(OF_stdout()));
|
||||
com_is_input = (ea->ea_node == prom_instance_to_package(prom_stdin()));
|
||||
com_is_output = (ea->ea_node == prom_instance_to_package(prom_stdout()));
|
||||
|
||||
if (com_is_input || com_is_output) {
|
||||
extern struct consdev comcons;
|
||||
@ -192,13 +189,13 @@ com_ebus_attach(parent, self, aux)
|
||||
/* Attach 'em if we got 'em. */
|
||||
#if (NKBD > 0)
|
||||
kma.kmta_name = "keyboard";
|
||||
if (OF_getproplen(ea->ea_node, kma.kmta_name) == 0) {
|
||||
if (prom_getproplen(ea->ea_node, kma.kmta_name) == 0) {
|
||||
config_found(self, (void *)&kma, NULL);
|
||||
}
|
||||
#endif
|
||||
#if (NMS > 0)
|
||||
kma.kmta_name = "mouse";
|
||||
if (OF_getproplen(ea->ea_node, kma.kmta_name) == 0) {
|
||||
if (prom_getproplen(ea->ea_node, kma.kmta_name) == 0) {
|
||||
config_found(self, (void *)&kma, NULL);
|
||||
}
|
||||
#endif
|
||||
@ -213,4 +210,3 @@ com_ebus_attach(parent, self, aux)
|
||||
cn_tab = kma.kmta_consdev;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: consinit.c,v 1.16 2004/03/19 21:10:31 petrov Exp $ */
|
||||
/* $NetBSD: consinit.c,v 1.17 2004/03/21 15:08:24 pk Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 Eduardo E. Horvath
|
||||
@ -29,7 +29,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.16 2004/03/19 21:10:31 petrov Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.17 2004/03/21 15:08:24 pk Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "pcons.h"
|
||||
@ -66,8 +66,6 @@ static void prom_cnputc __P((dev_t, int));
|
||||
static void prom_cnpollc __P((dev_t, int));
|
||||
static void prom_cnputc __P((dev_t, int));
|
||||
|
||||
int stdin = 0, stdout = 0;
|
||||
|
||||
/*
|
||||
* The console is set to this one initially,
|
||||
* which lets us use the PROM until consinit()
|
||||
@ -113,7 +111,7 @@ prom_cngetc(dev)
|
||||
static int nplus = 0;
|
||||
#endif
|
||||
|
||||
while ((l = OF_read(stdin, &ch, 1)) != 1)
|
||||
while ((l = prom_read(prom_stdin(), &ch, 1)) != 1)
|
||||
/* void */;
|
||||
#ifdef DDB
|
||||
if (ch == '+') {
|
||||
@ -129,8 +127,6 @@ static void
|
||||
prom_cninit(cn)
|
||||
struct consdev *cn;
|
||||
{
|
||||
if (!stdin) stdin = OF_stdin();
|
||||
if (!stdout) stdout = OF_stdout();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -144,11 +140,8 @@ prom_cnputc(dev, c)
|
||||
int s;
|
||||
char c0 = (c & 0x7f);
|
||||
|
||||
#if 0
|
||||
if (!stdout) stdout = OF_stdout();
|
||||
#endif
|
||||
s = splhigh();
|
||||
OF_write(stdout, &c0, 1);
|
||||
prom_write(prom_stdout(), &c0, 1);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
@ -198,38 +191,27 @@ consinit()
|
||||
if (cn_tab != &consdev_prom)
|
||||
return;
|
||||
|
||||
chosen = OF_finddevice("/chosen");
|
||||
chosen = prom_finddevice("/chosen");
|
||||
|
||||
DBPRINT(("setting up stdin\r\n"));
|
||||
DBPRINT(("chosen = %x, stdin @ %p\r\n", chosen, &stdin));
|
||||
OF_getprop(chosen, "stdin", &stdin, sizeof(stdin));
|
||||
DBPRINT(("stdin instance = %x\r\n", stdin));
|
||||
|
||||
if ((prom_stdin_node = OF_instance_to_package(stdin)) == 0) {
|
||||
if ((prom_stdin_node = prom_instance_to_package(prom_stdin())) == 0) {
|
||||
printf("WARNING: no PROM stdin\n");
|
||||
}
|
||||
|
||||
DBPRINT(("stdin node = %x\r\n", prom_stdin_node));
|
||||
|
||||
DBPRINT(("setting up stdout\r\n"));
|
||||
OF_getprop(chosen, "stdout", &stdout, sizeof(stdout));
|
||||
DBPRINT(("stdout instance = %x\r\n", stdout));
|
||||
|
||||
if ((prom_stdout_node = OF_instance_to_package(stdout)) == 0)
|
||||
if ((prom_stdout_node = prom_instance_to_package(prom_stdout())) == 0)
|
||||
printf("WARNING: no PROM stdout\n");
|
||||
|
||||
DBPRINT(("stdout package = %x\r\n", prom_stdout_node));
|
||||
|
||||
DBPRINT(("buffer @ %p\r\n", buffer));
|
||||
|
||||
if (prom_stdin_node != 0 &&
|
||||
(OF_getproplen(prom_stdin_node, "keyboard") >= 0)) {
|
||||
(prom_getproplen(prom_stdin_node, "keyboard") >= 0)) {
|
||||
#if NKBD > 0
|
||||
printf("cninit: kdb/display not configured\n");
|
||||
#endif
|
||||
consname = "keyboard/display";
|
||||
} else if (prom_stdout_node != 0 &&
|
||||
(OF_instance_to_path(stdin, buffer, sizeof(buffer)) >= 0)) {
|
||||
(OF_instance_to_path(prom_stdin(), buffer, sizeof(buffer)) >= 0)) {
|
||||
consname = buffer;
|
||||
}
|
||||
printf("console is %s\n", consname);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kd.c,v 1.31 2004/03/17 14:03:22 pk Exp $ */
|
||||
/* $NetBSD: kd.c,v 1.32 2004/03/21 15:08:24 pk Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -46,7 +46,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.31 2004/03/17 14:03:22 pk Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.32 2004/03/21 15:08:24 pk Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
@ -436,7 +436,7 @@ kd_putfb(tp)
|
||||
while (p < end)
|
||||
*p++ &= 0x7f;
|
||||
/* Now let the PROM print it. */
|
||||
OF_write(OF_stdout(), buf, len);
|
||||
prom_write(prom_stdout(), buf, len);
|
||||
}
|
||||
}
|
||||
|
||||
@ -644,7 +644,7 @@ kdcnputc(dev, c)
|
||||
char c0 = (c & 0x7f);
|
||||
|
||||
s = splhigh();
|
||||
OF_write(OF_stdout(), &c0, 1);
|
||||
prom_write(prom_stdout(), &c0, 1);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pcons.c,v 1.17 2003/07/15 03:36:06 lukem Exp $ */
|
||||
/* $NetBSD: pcons.c,v 1.18 2004/03/21 15:08:24 pk Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Eduardo E. Horvath
|
||||
@ -34,7 +34,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pcons.c,v 1.17 2003/07/15 03:36:06 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pcons.c,v 1.18 2004/03/21 15:08:24 pk Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
@ -258,7 +258,7 @@ pconsstart(tp)
|
||||
splx(s);
|
||||
cl = &tp->t_outq;
|
||||
len = q_to_b(cl, buf, OFBURSTLEN);
|
||||
OF_write(stdout, buf, len);
|
||||
prom_write(prom_stdout(), buf, len);
|
||||
s = spltty();
|
||||
tp->t_state &= ~TS_BUSY;
|
||||
if (cl->c_cc) {
|
||||
@ -294,7 +294,7 @@ pcons_poll(aux)
|
||||
struct tty *tp = sc->of_tty;
|
||||
char ch;
|
||||
|
||||
while (OF_read(stdin, &ch, 1) > 0) {
|
||||
while (prom_read(prom_stdin(), &ch, 1) > 0) {
|
||||
cn_check_magic(tp->t_dev, ch, pcons_cnm_state);
|
||||
if (tp && (tp->t_state & TS_ISOPEN))
|
||||
(*tp->t_linesw->l_rint)(ch, tp);
|
||||
@ -305,10 +305,8 @@ pcons_poll(aux)
|
||||
int
|
||||
pconsprobe()
|
||||
{
|
||||
if (!stdin) stdin = OF_stdin();
|
||||
if (!stdout) stdout = OF_stdout();
|
||||
|
||||
return (stdin && stdout);
|
||||
return (prom_stdin() && prom_stdout());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sab.c,v 1.15 2004/03/17 17:04:59 pk Exp $ */
|
||||
/* $NetBSD: sab.c,v 1.16 2004/03/21 15:08:24 pk Exp $ */
|
||||
/* $OpenBSD: sab.c,v 1.7 2002/04/08 17:49:42 jason Exp $ */
|
||||
|
||||
/*
|
||||
@ -42,7 +42,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sab.c,v 1.15 2004/03/17 17:04:59 pk Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sab.c,v 1.16 2004/03/21 15:08:24 pk Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -1301,23 +1301,18 @@ sabtty_console_flags(sc)
|
||||
struct sabtty_softc *sc;
|
||||
{
|
||||
int node, channel, cookie;
|
||||
u_int options;
|
||||
char buf[255];
|
||||
|
||||
node = sc->sc_parent->sc_node;
|
||||
channel = sc->sc_portno;
|
||||
|
||||
options = OF_finddevice("/options");
|
||||
|
||||
/* Default to channel 0 if there are no explicit prom args */
|
||||
cookie = 0;
|
||||
|
||||
if (node == OF_instance_to_package(OF_stdin())) {
|
||||
if (OF_getprop(options, "input-device", buf,
|
||||
sizeof(buf)) != -1) {
|
||||
if (strcmp("ttyb", buf) == 0)
|
||||
if (node == prom_instance_to_package(prom_stdin())) {
|
||||
if (prom_getoption("input-device", buf, sizeof buf) == 0 &&
|
||||
strcmp("ttyb", buf) == 0)
|
||||
cookie = 1;
|
||||
}
|
||||
|
||||
if (channel == cookie)
|
||||
sc->sc_flags |= SABTTYF_CONS_IN;
|
||||
@ -1325,12 +1320,10 @@ sabtty_console_flags(sc)
|
||||
|
||||
/* Default to same channel if there are no explicit prom args */
|
||||
|
||||
if (node == OF_instance_to_package(OF_stdout())) {
|
||||
if (OF_getprop(options, "output-device", buf,
|
||||
sizeof(buf)) != -1) {
|
||||
if (strcmp("ttyb", buf) == 0)
|
||||
if (node == prom_instance_to_package(prom_stdout())) {
|
||||
if (prom_getoption("output-device", buf, sizeof buf) == 0 &&
|
||||
strcmp("ttyb", buf) == 0)
|
||||
cookie = 1;
|
||||
}
|
||||
|
||||
if (channel == cookie)
|
||||
sc->sc_flags |= SABTTYF_CONS_OUT;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: zs.c,v 1.53 2004/03/19 15:42:46 pk Exp $ */
|
||||
/* $NetBSD: zs.c,v 1.54 2004/03/21 15:08:24 pk Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -45,7 +45,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.53 2004/03/19 15:42:46 pk Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.54 2004/03/21 15:08:24 pk Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
@ -838,7 +838,7 @@ zs_console_flags(promunit, node, channel)
|
||||
|
||||
/* Default to channel 0 if there are no explicit prom args */
|
||||
cookie = 0;
|
||||
if (node == OF_instance_to_package(OF_stdin())) {
|
||||
if (node == prom_instance_to_package(prom_stdin())) {
|
||||
if (prom_getoption("input-device", buf, sizeof buf) != 0 &&
|
||||
strcmp("ttyb", buf) == 0)
|
||||
cookie = 1;
|
||||
@ -847,7 +847,7 @@ zs_console_flags(promunit, node, channel)
|
||||
flags |= ZS_HWFLAG_CONSOLE_INPUT;
|
||||
}
|
||||
|
||||
if (node == OF_instance_to_package(OF_stdout())) {
|
||||
if (node == prom_instance_to_package(prom_stdout())) {
|
||||
if (prom_getoption("output-device", buf, sizeof buf) != 0 &&
|
||||
strcmp("ttyb", buf) == 0)
|
||||
cookie = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user