Use prom_getoption() and drop home-grown string-to-integer conversion code.
This commit is contained in:
parent
7489a68403
commit
9166dfe50b
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kd.c,v 1.30 2003/08/27 01:37:39 uwe Exp $ */
|
||||
/* $NetBSD: kd.c,v 1.31 2004/03/16 22:47:10 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.30 2003/08/27 01:37:39 uwe Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.31 2004/03/16 22:47:10 pk Exp $");
|
||||
|
||||
#include "opt_kgdb.h"
|
||||
#include "fb.h"
|
||||
|
@ -145,7 +145,7 @@ kd_init(kd)
|
|||
|
||||
/* else, consult the PROM */
|
||||
switch (prom_version()) {
|
||||
char *prop;
|
||||
char prop[6+1]; /* Enough for six digits */
|
||||
struct eeprom *ep;
|
||||
case PROM_OLDMON:
|
||||
if ((ep = (struct eeprom *)eeprom_va) == NULL)
|
||||
|
@ -155,27 +155,19 @@ kd_init(kd)
|
|||
if (kd->cols == 0)
|
||||
kd->cols = (u_short)ep->eeTtyCols;
|
||||
break;
|
||||
|
||||
case PROM_OBP_V0:
|
||||
case PROM_OBP_V2:
|
||||
case PROM_OBP_V3:
|
||||
case PROM_OPENFIRM:
|
||||
|
||||
if (kd->rows == 0 &&
|
||||
(prop = PROM_getpropstring(optionsnode, "screen-#rows"))) {
|
||||
int i = 0;
|
||||
prom_getoption("screen-#rows", prop, sizeof prop) == 0)
|
||||
kd->rows = strtoul(prop, NULL, 10);
|
||||
|
||||
while (*prop != '\0')
|
||||
i = i * 10 + *prop++ - '0';
|
||||
kd->rows = (unsigned short)i;
|
||||
}
|
||||
if (kd->cols == 0 &&
|
||||
(prop = PROM_getpropstring(optionsnode, "screen-#columns"))) {
|
||||
int i = 0;
|
||||
prom_getoption("screen-#columns", prop, sizeof prop) == 0)
|
||||
kd->cols = strtoul(prop, NULL, 10);
|
||||
|
||||
while (*prop != '\0')
|
||||
i = i * 10 + *prop++ - '0';
|
||||
kd->cols = (unsigned short)i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fb.c,v 1.15 2003/08/25 17:50:30 uwe Exp $ */
|
||||
/* $NetBSD: fb.c,v 1.16 2004/03/16 22:47:10 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -46,7 +46,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fb.c,v 1.15 2003/08/25 17:50:30 uwe Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fb.c,v 1.16 2004/03/16 22:47:10 pk Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -346,24 +346,6 @@ fb_setsize_eeprom(fb, depth, def_width, def_height)
|
|||
|
||||
static void fb_bell __P((int));
|
||||
|
||||
#if !defined(RASTERCONS_FULLSCREEN)
|
||||
static int a2int __P((char *, int));
|
||||
|
||||
static int
|
||||
a2int(cp, deflt)
|
||||
register char *cp;
|
||||
register int deflt;
|
||||
{
|
||||
register int i = 0;
|
||||
|
||||
if (*cp == '\0')
|
||||
return (deflt);
|
||||
while (*cp != '\0')
|
||||
i = i * 10 + *cp++ - '0';
|
||||
return (i);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
fb_bell(on)
|
||||
int on;
|
||||
|
@ -409,10 +391,13 @@ fbrcons_init(fb)
|
|||
}
|
||||
#endif /* !SUN4U */
|
||||
if (!CPU_ISSUN4) {
|
||||
maxcol =
|
||||
a2int(PROM_getpropstring(optionsnode, "screen-#columns"), 80);
|
||||
maxrow =
|
||||
a2int(PROM_getpropstring(optionsnode, "screen-#rows"), 34);
|
||||
char buf[6+1]; /* Enough for six digits */
|
||||
if (prom_getoption("screen-#columns", buf, sizeof buf) != 0)
|
||||
maxcol = 80;
|
||||
maxcol = strtoul(buf, NULL, 10);
|
||||
if (prom_getoption("screen-#rows", buf, sizeof buf) != 0)
|
||||
maxrow = 34;
|
||||
maxrow = strtoul(buf, NULL, 10);
|
||||
}
|
||||
#endif /* !RASTERCONS_FULLSCREEN */
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue