If console is on an ite, make sure the HIL is initialized enough for

the keyboard to work.  Fixes a bug where booting with `-d' worked
only on systems using a serial console.

While I'm here, eliminate some redundancy in the ite console intialization
code.
This commit is contained in:
thorpej 1996-10-05 05:22:04 +00:00
parent fb2727b7e6
commit 2793eb282e
9 changed files with 132 additions and 72 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf_dv.c,v 1.7 1996/03/03 16:48:56 thorpej Exp $ */
/* $NetBSD: grf_dv.c,v 1.8 1996/10/05 05:22:04 thorpej Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
@ -618,7 +618,6 @@ void
dvboxcninit(cp)
struct consdev *cp;
{
struct ite_data *ip = &ite_cn;
struct grf_data *gp = &grf_cn;
/*
@ -634,15 +633,9 @@ dvboxcninit(cp)
gp->g_flags = GF_ALIVE;
/*
* Set up required ite data and initialize ite.
* Initialize the terminal emulator.
*/
ip->isw = &dvbox_itesw;
ip->grf = gp;
ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
ip->attrbuf = console_attributes;
iteinit(ip);
kbd_ite = ip; /* XXX */
itecninit(gp, &dvbox_itesw);
}
#endif /* NITE > 0 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf_gb.c,v 1.7 1996/03/03 16:48:58 thorpej Exp $ */
/* $NetBSD: grf_gb.c,v 1.8 1996/10/05 05:22:05 thorpej Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
@ -568,7 +568,6 @@ void
gboxcninit(cp)
struct consdev *cp;
{
struct ite_data *ip = &ite_cn;
struct grf_data *gp = &grf_cn;
/*
@ -584,15 +583,9 @@ gboxcninit(cp)
gp->g_flags = GF_ALIVE;
/*
* Set up required ite data and initialize ite.
* Initialize the terminal emulator.
*/
ip->isw = &gbox_itesw;
ip->grf = gp;
ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
ip->attrbuf = console_attributes;
iteinit(ip);
kbd_ite = ip; /* XXX */
itecninit(gp, &gbox_itesw);
}
#endif /* NITE > 0 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf_hy.c,v 1.5 1996/03/03 16:49:00 thorpej Exp $ */
/* $NetBSD: grf_hy.c,v 1.6 1996/10/05 05:22:06 thorpej Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
@ -764,7 +764,6 @@ void
hypercninit(cp)
struct consdev *cp;
{
struct ite_data *ip = &ite_cn;
struct grf_data *gp = &grf_cn;
/*
@ -780,15 +779,9 @@ hypercninit(cp)
gp->g_flags = GF_ALIVE;
/*
* Set up required ite data and initialize ite.
* Initialize the terminal emulator.
*/
ip->isw = &hyper_itesw;
ip->grf = gp;
ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
ip->attrbuf = console_attributes;
iteinit(ip);
kbd_ite = ip; /* XXX */
itecninit(gp, &hyper_itesw);
}
#endif /* NITE > 0 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf_rb.c,v 1.7 1996/03/03 16:49:02 thorpej Exp $ */
/* $NetBSD: grf_rb.c,v 1.8 1996/10/05 05:22:07 thorpej Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
@ -565,7 +565,6 @@ void
rboxcninit(cp)
struct consdev *cp;
{
struct ite_data *ip = &ite_cn;
struct grf_data *gp = &grf_cn;
/*
@ -581,15 +580,9 @@ rboxcninit(cp)
gp->g_flags = GF_ALIVE;
/*
* Set up required ite data and initialize ite.
* Initialize the terminal emulator.
*/
ip->isw = &rbox_itesw;
ip->grf = gp;
ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
ip->attrbuf = console_attributes;
iteinit(ip);
kbd_ite = ip; /* XXX */
itecninit(gp, &rbox_itesw);
}
#endif /* NITE > 0 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf_tc.c,v 1.7 1996/03/03 16:49:04 thorpej Exp $ */
/* $NetBSD: grf_tc.c,v 1.8 1996/10/05 05:22:08 thorpej Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
@ -626,7 +626,6 @@ void
topcatcninit(cp)
struct consdev *cp;
{
struct ite_data *ip = &ite_cn;
struct grf_data *gp = &grf_cn;
struct grfreg *grf = (struct grfreg *)conaddr;
@ -663,15 +662,9 @@ topcatcninit(cp)
gp->g_flags = GF_ALIVE;
/*
* Set up required ite data and initialize ite.
* Initialize the terminal emulator.
*/
ip->isw = &topcat_itesw;
ip->grf = gp;
ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
ip->attrbuf = console_attributes;
iteinit(ip);
kbd_ite = ip; /* XXX */
itecninit(gp, &topcat_itesw);
}
#endif /* NITE > 0 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: hil.c,v 1.25 1996/10/04 22:22:15 thorpej Exp $ */
/* $NetBSD: hil.c,v 1.26 1996/10/05 05:22:09 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -94,6 +94,13 @@ int hildebug = 0;
extern struct emul emul_hpux;
#endif
/* XXX ITE interface */
char *kbd_keymap;
char *kbd_shiftmap;
char *kbd_ctrlmap;
char *kbd_ctrlshiftmap;
char **kbd_stringmap;
/* symbolic sleep message strings */
char hilin[] = "hilin";
@ -1114,28 +1121,86 @@ kbddisable(unit)
{
}
/*
* The following chunk of code implements HIL console keyboard
* support.
*/
struct hil_dev *hilkbd_cn_device;
char *kbd_cn_keymap;
char *kbd_cn_shiftmap;
char *kbd_cn_ctrlmap;
/*
* XXX: read keyboard directly and return code.
* Used by console getchar routine. Could really screw up anybody
* reading from the keyboard in the normal, interrupt driven fashion.
*/
kbdgetc(unit, statp)
int unit, *statp;
int
kbdgetc(statp)
int *statp;
{
struct hil_softc *hilp = &hil_softc[unit];
register struct hil_dev *hildevice = hilp->hl_addr;
register int c, stat;
int s;
if (hilkbd_cn_device == NULL)
return (0);
/*
* XXX needs to be splraise because we could be called
* XXX at splhigh, e.g. in DDB.
*/
s = splhil();
while (((stat = READHILSTAT(hildevice)) & HIL_DATA_RDY) == 0)
while (((stat = READHILSTAT(hilkbd_cn_device)) & HIL_DATA_RDY) == 0)
;
c = READHILDATA(hildevice);
c = READHILDATA(hilkbd_cn_device);
splx(s);
*statp = stat;
return(c);
return (c);
}
/*
* Perform basic initialization of the HIL keyboard, suitable
* for early console use.
*/
void
kbdcninit()
{
struct hil_dev *h = HILADDR; /* == VA (see hilreg.h) */
struct kbdmap *km;
u_char lang;
/* XXX from hil_keymaps.c */
extern char *us_keymap, *us_shiftmap, *us_ctrlmap;
hilkbd_cn_device = h;
/* Default to US-ASCII keyboard. */
kbd_cn_keymap = us_keymap;
kbd_cn_shiftmap = us_shiftmap;
kbd_cn_ctrlmap = us_ctrlmap;
HILWAIT(h);
WRITEHILCMD(h, HIL_SETARR);
HILWAIT(h);
WRITEHILDATA(h, ar_format(KBD_ARR));
HILWAIT(h);
WRITEHILCMD(h, HIL_READKBDLANG);
HILDATAWAIT(h);
lang = READHILDATA(h);
for (km = kbd_map; km->kbd_code; km++) {
if (km->kbd_code == lang) {
kbd_cn_keymap = km->kbd_keymap;
kbd_cn_shiftmap = km->kbd_shiftmap;
kbd_cn_ctrlmap = km->kbd_ctrlmap;
}
}
HILWAIT(h);
WRITEHILCMD(h, HIL_INTON);
}
/* End of HIL console keyboard code. */
/*
* Recoginize and clear keyboard generated NMIs.
* Returns 1 if it was ours, 0 otherwise. Note that we cannot use

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.30 1996/06/06 15:36:13 thorpej Exp $ */
/* $NetBSD: ite.c,v 1.31 1996/10/05 05:22:10 thorpej Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
@ -116,7 +116,7 @@ void itestart __P((struct tty *));
* found. Secondary displays alloc the attribute buffer as needed.
* Size is based on a 68x128 display, which is currently our largest.
*/
u_char console_attributes[0x2200];
u_char ite_console_attributes[0x2200];
#define ite_erasecursor(ip, sp) { \
if ((ip)->flags & ITE_CURSORON) \
@ -937,6 +937,31 @@ ite_major()
* framebuffer drivers.
*/
void
itecninit(gp, isw)
struct grf_data *gp;
struct itesw *isw;
{
extern void kbdcninit __P((void)); /* XXX */
struct ite_data *ip = &ite_cn;
/*
* Set up required ite data and initialize ite.
*/
ip->isw = isw;
ip->grf = gp;
ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS;
ip->attrbuf = ite_console_attributes;
iteinit(ip);
/*
* Initialize the console keyboard.
*/
kbdcninit();
kbd_ite = ip; /* XXX */
}
/*ARGSUSED*/
int
itecngetc(dev)
@ -945,16 +970,16 @@ itecngetc(dev)
register int c;
int stat;
c = kbdgetc(0, &stat); /* XXX always read from keyboard 0 for now */
c = kbdgetc(&stat);
switch ((stat >> KBD_SSHIFT) & KBD_SMASK) {
case KBD_SHIFT:
c = kbd_shiftmap[c & KBD_CHARMASK];
c = kbd_cn_shiftmap[c & KBD_CHARMASK];
break;
case KBD_CTRL:
c = kbd_ctrlmap[c & KBD_CHARMASK];
c = kbd_cn_ctrlmap[c & KBD_CHARMASK];
break;
case KBD_KEY:
c = kbd_keymap[c & KBD_CHARMASK];
c = kbd_cn_keymap[c & KBD_CHARMASK];
break;
default:
c = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: itevar.h,v 1.9 1996/02/24 00:55:31 thorpej Exp $ */
/* $NetBSD: itevar.h,v 1.10 1996/10/05 05:22:11 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -192,7 +192,6 @@ extern struct ite_data ite_cn; /* ite_data for console device */
extern struct ite_data *kbd_ite; /* XXX */
extern struct ite_softc ite_softc[];
extern struct itesw itesw[];
extern u_char console_attributes[];
extern int nitesw;
/* ite.c prototypes */
@ -200,6 +199,7 @@ void ite_attach_grf __P((int, int));
int iteon __P((struct ite_data *, int));
void iteoff __P((struct ite_data *, int));
void itefilter __P((char, char));
void itecninit __P((struct grf_data *, struct itesw *));
int ite_major __P((void));
/* ite_subr.c prototypes */

View File

@ -1,4 +1,4 @@
/* $NetBSD: kbdmap.h,v 1.6 1995/12/06 22:13:26 thorpej Exp $ */
/* $NetBSD: kbdmap.h,v 1.7 1996/10/05 05:22:11 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@ -58,11 +58,16 @@ struct kbdmap {
#ifdef _KERNEL
/* XXX: ITE interface */
char *kbd_keymap;
char *kbd_shiftmap;
char *kbd_ctrlmap;
char *kbd_ctrlshiftmap;
char **kbd_stringmap;
extern char *kbd_keymap;
extern char *kbd_shiftmap;
extern char *kbd_ctrlmap;
extern char *kbd_ctrlshiftmap;
extern char **kbd_stringmap;
/* XXX: itecngetc() interface */
extern char *kbd_cn_keymap;
extern char *kbd_cn_shiftmap;
extern char *kbd_cn_ctrlmap;
extern struct kbdmap kbd_map[];
#endif