summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2001-12-05 05:38:29 +0000
committerJason Wright <jason@cvs.openbsd.org>2001-12-05 05:38:29 +0000
commitb11b165dc71c7b5e87d94a0ddbf7292cd7c86237 (patch)
treeb1b7009e2aa2b8a2a03ad5ad5031aac13c5f876b
parent7a26c6ccfef21b4a0f7fddf59b9c2c6fe24a4bd0 (diff)
Same stuff as cgthree:
- fix initialization so that the cursor is initialized to be in the same place the prom left it. - remove some trial and error #if 0 stuff - fix copyo's in a2int() - ditch *_romcursoraddr for a direct call to romgetcursoraddr() - allow this to attach (without panic()) if it is not the console.
-rw-r--r--sys/dev/sbus/cgsix.c57
1 files changed, 16 insertions, 41 deletions
diff --git a/sys/dev/sbus/cgsix.c b/sys/dev/sbus/cgsix.c
index 810a89e42a7..dafc090e68f 100644
--- a/sys/dev/sbus/cgsix.c
+++ b/sys/dev/sbus/cgsix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgsix.c,v 1.1 2001/12/04 20:07:06 jason Exp $ */
+/* $OpenBSD: cgsix.c,v 1.2 2001/12/05 05:38:28 jason Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -108,7 +108,6 @@ void cgsix_free_screen __P((void *, void *));
int cgsix_show_screen __P((void *, void *, int,
void (*cb) __P((void *, int, int)), void *));
paddr_t cgsix_mmap __P((void *, off_t, int));
-int cgsix_romcursoraddr __P((int **, int **));
int cgsix_is_console __P((int));
static int a2int __P((char *, int));
@@ -220,45 +219,36 @@ cgsixattach(parent, self, aux)
sc->sc_raster.linelongs = sc->sc_linebytes / 4;
sc->sc_raster.pixels = (void *)sc->sc_vid_regs;
- sc->sc_rcons.rc_crow = sc->sc_rcons.rc_ccol = -1;
- if (cgsix_romcursoraddr(&sc->sc_rcons.rc_crowp, &sc->sc_rcons.rc_ccolp)) {
+ if (console == 0 ||
+ romgetcursoraddr(&sc->sc_rcons.rc_crowp, &sc->sc_rcons.rc_ccolp)) {
+ sc->sc_rcons.rc_crow = sc->sc_rcons.rc_ccol = -1;
sc->sc_rcons.rc_crowp = &sc->sc_rcons.rc_crow;
sc->sc_rcons.rc_ccolp = &sc->sc_rcons.rc_ccol;
}
-#if 0
- sc->sc_rcons.rc_font = &console_font;
- sc->sc_rcons.rc_maxcol =
- sc->sc_raster.width / sc->sc_rcons.rc_font->width;
- sc->sc_rcons.rc_maxrow =
- sc->sc_raster.height / sc->sc_rcons.rc_font->height;
- sc->sc_rcons.rc_maxcol = min(sc->sc_rcons.rc_maxcol,
- a2int(getpropstring(optionsnode, "screen-#columns"), 80));
- sc->sc_rcons.rc_maxrow = min(sc->sc_rcons.rc_maxrow,
- a2int(getpropstring(optionsnode, "screen-#rows"), 34));
-#else
sc->sc_rcons.rc_maxcol =
a2int(getpropstring(optionsnode, "screen-#columns"), 80);
sc->sc_rcons.rc_maxrow =
a2int(getpropstring(optionsnode, "screen-#rows"), 34);
-#endif
- rcons_init(&sc->sc_rcons, 160, 160);
+ rcons_init(&sc->sc_rcons,
+ sc->sc_rcons.rc_maxrow, sc->sc_rcons.rc_maxcol);
cgsix_stdscreen.nrows = sc->sc_rcons.rc_maxrow;
cgsix_stdscreen.ncols = sc->sc_rcons.rc_maxcol;
cgsix_stdscreen.textops = &cgsix_emulops;
rcons_alloc_attr(&sc->sc_rcons, 0, 0, 0, &defattr);
+ printf("\n");
+
+ if (console)
+ wsdisplay_cnattach(&cgsix_stdscreen, &sc->sc_rcons,
+ *sc->sc_rcons.rc_ccolp, *sc->sc_rcons.rc_crowp, defattr);
+
waa.console = console;
waa.scrdata = &cgsix_screenlist;
waa.accessops = &cgsix_accessops;
waa.accesscookie = sc;
-
- printf("\n");
-
- wsdisplay_cnattach(&cgsix_stdscreen, &sc->sc_rcons, 0, 0, defattr);
-
config_found(self, &waa, wsemuldisplaydevprint);
return;
@@ -334,7 +324,8 @@ cgsix_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
return (ENOMEM);
*cookiep = &sc->sc_rcons;
- *curxp = *curyp = 0;
+ *curyp = *sc->sc_rcons.rc_crowp;
+ *curxp = *sc->sc_rcons.rc_ccolp;
rcons_alloc_attr(&sc->sc_rcons, 0, 0, 0, attrp);
sc->sc_nscreens++;
return (0);
@@ -379,32 +370,16 @@ cgsix_mmap(v, offset, prot)
static int
a2int(char *cp, int deflt)
{
- int i;
+ int i = 0;
if (*cp == '\0')
return (deflt);
while (*cp != '\0')
- i = i * 10 + *cp++ - '\0';
+ i = i * 10 + *cp++ - '0';
return (i);
}
int
-cgsix_romcursoraddr(rowp, colp)
- int **rowp, **colp;
-{
- int rx, cx;
-
- return (1);
- /*
- * XXX these calls crash the machine... OF_interpret appears to
- * be broken.
- */
- OF_interpret("addr line#", 1, &rx);
- OF_interpret("addr column#", 1, &cx);
- return (0);
-}
-
-int
cgsix_is_console(node)
int node;
{