Convert hil to standard device attachment.
This commit is contained in:
parent
4d380420ae
commit
8efcc1d46b
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hil.c,v 1.42 2001/04/12 18:22:55 thorpej Exp $ */
|
||||
/* $NetBSD: hil.c,v 1.43 2001/11/17 23:53:37 gmcgarry Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -62,6 +62,8 @@
|
|||
#include <sys/rnd.h>
|
||||
#endif
|
||||
|
||||
#include <hp300/dev/intiovar.h>
|
||||
|
||||
#include <hp300/dev/hilreg.h>
|
||||
#include <hp300/dev/hilioctl.h>
|
||||
#include <hp300/dev/hilvar.h>
|
||||
|
@ -70,17 +72,14 @@
|
|||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#ifdef hp300
|
||||
#define NHIL 1 /* XXX */
|
||||
#else
|
||||
#include "hil.h"
|
||||
#endif
|
||||
int hilmatch __P((struct device *, struct cfdata *, void *));
|
||||
void hilattach __P((struct device *, struct device *, void *));
|
||||
|
||||
const struct cfattach hil_ca = {
|
||||
sizeof(struct hil_softc), hilmatch, hilattach,
|
||||
};
|
||||
|
||||
struct hil_softc hil_softc[NHIL];
|
||||
struct _hilbell default_bell = { BELLDUR, BELLFREQ };
|
||||
#ifdef hp800
|
||||
int hilspl;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
int hildebug = 0;
|
||||
|
@ -108,14 +107,17 @@ char **kbd_stringmap;
|
|||
char hilin[] = "hilin";
|
||||
|
||||
cdev_decl(hil);
|
||||
extern struct cfdriver hil_cd;
|
||||
|
||||
void hilinfo __P((int));
|
||||
void hilattach_deferred __P((struct device *));
|
||||
|
||||
void hilinfo __P((struct hil_softc *));
|
||||
void hilconfig __P((struct hil_softc *));
|
||||
void hilreset __P((struct hil_softc *));
|
||||
void hilbeep __P((struct hil_softc *, struct _hilbell *));
|
||||
int hiliddev __P((struct hil_softc *));
|
||||
|
||||
void hilint __P((int));
|
||||
int hilint __P((void *));
|
||||
void hil_process_int __P((struct hil_softc *, u_char, u_char));
|
||||
void hilevent __P((struct hil_softc *));
|
||||
void hpuxhilevent __P((struct hil_softc *, struct hilloopdev *));
|
||||
|
@ -131,26 +133,43 @@ void printhilcmdbuf __P((struct hil_softc *));
|
|||
void hilreport __P((struct hil_softc *));
|
||||
#endif /* DEBUG */
|
||||
|
||||
void
|
||||
hilsoftinit(unit, hilbase)
|
||||
int unit;
|
||||
struct hil_dev *hilbase;
|
||||
int
|
||||
hilmatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct hil_softc *hilp = &hil_softc[unit];
|
||||
struct intio_attach_args *ia = aux;
|
||||
|
||||
if (strcmp("hil ", ia->ia_modname) != 0)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
hilattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct hil_softc *hilp = (struct hil_softc *)self;
|
||||
struct intio_attach_args *ia = aux;
|
||||
int i;
|
||||
|
||||
/* XXX ITE interface */
|
||||
extern char us_keymap[], us_shiftmap[], us_ctrlmap[],
|
||||
us_ctrlshiftmap[], *us_stringmap[];
|
||||
|
||||
printf("\n");
|
||||
|
||||
#ifdef DEBUG
|
||||
if (hildebug & HDB_FOLLOW)
|
||||
printf("hilsoftinit(%d, %p)\n", unit, hilbase);
|
||||
printf("hilsoftinit(%p, %p)\n", hilp, (void *)ia->ia_addr);
|
||||
#endif
|
||||
/*
|
||||
* Initialize loop information
|
||||
*/
|
||||
hilp->hl_addr = hilbase;
|
||||
hilp->hl_addr = (struct hil_dev *)ia->ia_addr;
|
||||
hilp->hl_cmdending = FALSE;
|
||||
hilp->hl_actdev = hilp->hl_cmddev = 0;
|
||||
hilp->hl_cmddone = FALSE;
|
||||
|
@ -181,30 +200,29 @@ hilsoftinit(unit, hilbase)
|
|||
kbd_ctrlmap = us_ctrlmap; /* XXX */
|
||||
kbd_ctrlshiftmap = us_ctrlshiftmap; /* XXX */
|
||||
kbd_stringmap = us_stringmap; /* XXX */
|
||||
|
||||
(void) intio_intr_establish(hilint, hilp, ia->ia_ipl, IPL_TTY);
|
||||
|
||||
config_interrupts(self, hilattach_deferred);
|
||||
}
|
||||
|
||||
void
|
||||
hilinit(unit, hilbase)
|
||||
int unit;
|
||||
struct hil_dev *hilbase;
|
||||
hilattach_deferred(self)
|
||||
struct device *self;
|
||||
{
|
||||
struct hil_softc *hilp = &hil_softc[unit];
|
||||
struct hil_softc *hilp = (struct hil_softc *)self;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (hildebug & HDB_FOLLOW)
|
||||
printf("hilinit(%d, %p)\n", unit, hilbase);
|
||||
printf("hilinit(%p, %p)\n", hilp, hilp->hl_addr);
|
||||
#endif
|
||||
/*
|
||||
* Initialize software (if not already done).
|
||||
*/
|
||||
if ((hilp->hl_device[HILLOOPDEV].hd_flags & HIL_ALIVE) == 0)
|
||||
hilsoftinit(unit, hilbase);
|
||||
/*
|
||||
* Initialize hardware.
|
||||
* Reset the loop hardware, and collect keyboard/id info
|
||||
*/
|
||||
hilreset(hilp);
|
||||
hilinfo(unit);
|
||||
kbdenable(unit);
|
||||
hilinfo(hilp);
|
||||
kbdenable(hilp);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
|
@ -214,21 +232,22 @@ hilopen(dev, flags, mode, p)
|
|||
int flags, mode;
|
||||
struct proc *p;
|
||||
{
|
||||
struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
|
||||
struct hil_softc *hilp;
|
||||
struct hilloopdev *dptr;
|
||||
u_char device = HILUNIT(dev);
|
||||
int s;
|
||||
|
||||
hilp = device_lookup(&hil_cd, HILLOOP(dev));
|
||||
|
||||
#ifdef DEBUG
|
||||
if (hildebug & HDB_FOLLOW)
|
||||
printf("hilopen(%d): loop %x device %x\n",
|
||||
p->p_pid, HILLOOP(dev), device);
|
||||
p->p_pid, HILLOOP(dev), HILUNIT(dev));
|
||||
#endif
|
||||
|
||||
if ((hilp->hl_device[HILLOOPDEV].hd_flags & HIL_ALIVE) == 0)
|
||||
return(ENXIO);
|
||||
|
||||
dptr = &hilp->hl_device[device];
|
||||
dptr = &hilp->hl_device[HILUNIT(dev)];
|
||||
if ((dptr->hd_flags & HIL_ALIVE) == 0)
|
||||
return(ENODEV);
|
||||
|
||||
|
@ -274,7 +293,7 @@ hilopen(dev, flags, mode, p)
|
|||
* Opened the keyboard, put in raw mode.
|
||||
*/
|
||||
s = splhil();
|
||||
if (device == hilp->hl_kbddev) {
|
||||
if (HILUNIT(dev) == hilp->hl_kbddev) {
|
||||
u_char mask = 0;
|
||||
send_hil_cmd(hilp->hl_addr, HIL_WRITEKBDSADR, &mask, 1, NULL);
|
||||
hilp->hl_kbdflags |= KBD_RAW;
|
||||
|
@ -294,21 +313,22 @@ hilclose(dev, flags, mode, p)
|
|||
int flags, mode;
|
||||
struct proc *p;
|
||||
{
|
||||
struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
|
||||
struct hil_softc *hilp;
|
||||
struct hilloopdev *dptr;
|
||||
int i;
|
||||
u_char device = HILUNIT(dev);
|
||||
char mask, lpctrl;
|
||||
int s;
|
||||
extern struct emul emul_netbsd;
|
||||
|
||||
hilp = device_lookup(&hil_cd, HILLOOP(dev));
|
||||
|
||||
#ifdef DEBUG
|
||||
if (hildebug & HDB_FOLLOW)
|
||||
printf("hilclose(%d): device %x\n", p->p_pid, device);
|
||||
printf("hilclose(%d): device %x\n", p->p_pid, HILUNIT(dev));
|
||||
#endif
|
||||
|
||||
dptr = &hilp->hl_device[device];
|
||||
if (device && (dptr->hd_flags & HIL_PSEUDO))
|
||||
dptr = &hilp->hl_device[HILUNIT(dev)];
|
||||
if (HILUNIT(dev) && (dptr->hd_flags & HIL_PSEUDO))
|
||||
return (0);
|
||||
|
||||
if (p && p->p_emul == &emul_netbsd) {
|
||||
|
@ -316,12 +336,12 @@ hilclose(dev, flags, mode, p)
|
|||
* If this is the loop device,
|
||||
* free up all queues belonging to this process.
|
||||
*/
|
||||
if (device == 0) {
|
||||
if (HILUNIT(dev) == 0) {
|
||||
for (i = 0; i < NHILQ; i++)
|
||||
if (hilp->hl_queue[i].hq_procp == p)
|
||||
(void) hilqfree(hilp, i, p);
|
||||
} else {
|
||||
mask = ~hildevmask(device);
|
||||
mask = ~hildevmask(HILUNIT(dev));
|
||||
s = splhil();
|
||||
for (i = 0; i < NHILQ; i++)
|
||||
if (hilp->hl_queue[i].hq_procp == p) {
|
||||
|
@ -340,7 +360,7 @@ hilclose(dev, flags, mode, p)
|
|||
* Set keyboard back to cooked mode when closed.
|
||||
*/
|
||||
s = splhil();
|
||||
if (device && device == hilp->hl_kbddev) {
|
||||
if (HILUNIT(dev) && HILUNIT(dev) == hilp->hl_kbddev) {
|
||||
mask = 1 << (hilp->hl_kbddev - 1);
|
||||
send_hil_cmd(hilp->hl_addr, HIL_WRITEKBDSADR, &mask, 1, NULL);
|
||||
hilp->hl_kbdflags &= ~(KBD_RAW|KBD_AR1|KBD_AR2);
|
||||
|
@ -363,7 +383,7 @@ hilclose(dev, flags, mode, p)
|
|||
printf("hilclose: keyboard %d cooked\n",
|
||||
hilp->hl_kbddev);
|
||||
#endif
|
||||
kbdenable(HILLOOP(dev));
|
||||
kbdenable(hilp);
|
||||
}
|
||||
splx(s);
|
||||
return (0);
|
||||
|
@ -379,13 +399,14 @@ hilread(dev, uio, flag)
|
|||
struct uio *uio;
|
||||
int flag;
|
||||
{
|
||||
struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
|
||||
struct hil_softc *hilp;
|
||||
struct hilloopdev *dptr;
|
||||
int cc;
|
||||
u_char device = HILUNIT(dev);
|
||||
u_char buf[HILBUFSIZE];
|
||||
int error, s;
|
||||
|
||||
hilp = device_lookup(&hil_cd, HILLOOP(dev));
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* XXX: Don't do this since HP-UX doesn't.
|
||||
|
@ -393,11 +414,11 @@ hilread(dev, uio, flag)
|
|||
* Check device number.
|
||||
* This check is necessary since loop can reconfigure.
|
||||
*/
|
||||
if (device > hilp->hl_maxdev)
|
||||
if (HILUNIT(dev) > hilp->hl_maxdev)
|
||||
return(ENODEV);
|
||||
#endif
|
||||
|
||||
dptr = &hilp->hl_device[device];
|
||||
dptr = &hilp->hl_device[HILUNIT(dev)];
|
||||
if ((dptr->hd_flags & HIL_READIN) == 0)
|
||||
return(ENODEV);
|
||||
|
||||
|
@ -435,20 +456,21 @@ hilioctl(dev, cmd, data, flag, p)
|
|||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
|
||||
char device = HILUNIT(dev);
|
||||
struct hil_softc *hilp;
|
||||
struct hilloopdev *dptr;
|
||||
int i;
|
||||
u_char hold;
|
||||
int error;
|
||||
|
||||
hilp = device_lookup(&hil_cd, HILLOOP(dev));
|
||||
|
||||
#ifdef DEBUG
|
||||
if (hildebug & HDB_FOLLOW)
|
||||
printf("hilioctl(%d): dev %x cmd %lx\n",
|
||||
p->p_pid, device, cmd);
|
||||
p->p_pid, HILUNIT(dev), cmd);
|
||||
#endif
|
||||
|
||||
dptr = &hilp->hl_device[(int)device];
|
||||
dptr = &hilp->hl_device[HILUNIT(dev)];
|
||||
if ((dptr->hd_flags & HIL_ALIVE) == 0)
|
||||
return (ENODEV);
|
||||
|
||||
|
@ -490,7 +512,7 @@ hilioctl(dev, cmd, data, flag, p)
|
|||
|
||||
hilp->hl_cmdbp = hilp->hl_cmdbuf;
|
||||
bzero((caddr_t)hilp->hl_cmdbuf, HILBUFSIZE);
|
||||
hilp->hl_cmddev = device;
|
||||
hilp->hl_cmddev = HILUNIT(dev);
|
||||
error = 0;
|
||||
switch (cmd) {
|
||||
|
||||
|
@ -527,7 +549,7 @@ hilioctl(dev, cmd, data, flag, p)
|
|||
case HILIOCRN:
|
||||
case HILIOCRS:
|
||||
case HILIOCED:
|
||||
send_hildev_cmd(hilp, device, (cmd & 0xFF));
|
||||
send_hildev_cmd(hilp, HILUNIT(dev), (cmd & 0xFF));
|
||||
bcopy(hilp->hl_cmdbuf, data, hilp->hl_cmdbp-hilp->hl_cmdbuf);
|
||||
break;
|
||||
|
||||
|
@ -550,7 +572,7 @@ hilioctl(dev, cmd, data, flag, p)
|
|||
break;
|
||||
|
||||
case FIONBIO:
|
||||
dptr = &hilp->hl_device[(int)device];
|
||||
dptr = &hilp->hl_device[HILUNIT(dev)];
|
||||
if (*(int *)data)
|
||||
dptr->hd_flags |= HIL_NOBLOCK;
|
||||
else
|
||||
|
@ -573,15 +595,15 @@ hilioctl(dev, cmd, data, flag, p)
|
|||
break;
|
||||
|
||||
case HILIOCMAPQ:
|
||||
error = hilqmap(hilp, *(int *)data, device, p);
|
||||
error = hilqmap(hilp, *(int *)data, HILUNIT(dev), p);
|
||||
break;
|
||||
|
||||
case HILIOCUNMAPQ:
|
||||
error = hilqunmap(hilp, *(int *)data, device, p);
|
||||
error = hilqunmap(hilp, *(int *)data, HILUNIT(dev), p);
|
||||
break;
|
||||
|
||||
case HILIOCHPUX:
|
||||
dptr = &hilp->hl_device[(int)device];
|
||||
dptr = &hilp->hl_device[HILUNIT(dev)];
|
||||
dptr->hd_flags |= HIL_READIN;
|
||||
dptr->hd_flags &= ~HIL_QUEUEIN;
|
||||
break;
|
||||
|
@ -613,15 +635,16 @@ hpuxhilioctl(dev, cmd, data, flag)
|
|||
int cmd, flag;
|
||||
caddr_t data;
|
||||
{
|
||||
struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
|
||||
char device = HILUNIT(dev);
|
||||
struct hil_softc *hilp;
|
||||
struct hilloopdev *dptr;
|
||||
int i;
|
||||
u_char hold;
|
||||
|
||||
hilp = device_lookup(&hil_cd, HILLOOP(dev));
|
||||
|
||||
hilp->hl_cmdbp = hilp->hl_cmdbuf;
|
||||
bzero((caddr_t)hilp->hl_cmdbuf, HILBUFSIZE);
|
||||
hilp->hl_cmddev = device;
|
||||
hilp->hl_cmddev = HILUNIT(dev);
|
||||
switch (cmd) {
|
||||
|
||||
case HILSC:
|
||||
|
@ -645,7 +668,7 @@ hpuxhilioctl(dev, cmd, data, flag)
|
|||
case HILA6:
|
||||
case HILA7:
|
||||
case HILA:
|
||||
send_hildev_cmd(hilp, device, (cmd & 0xFF));
|
||||
send_hildev_cmd(hilp, HILUNIT(dev), (cmd & 0xFF));
|
||||
bcopy(hilp->hl_cmdbuf, data, hilp->hl_cmdbp-hilp->hl_cmdbuf);
|
||||
break;
|
||||
|
||||
|
@ -715,7 +738,7 @@ hpuxhilioctl(dev, cmd, data, flag)
|
|||
break;
|
||||
|
||||
case FIONBIO:
|
||||
dptr = &hilp->hl_device[(int)device];
|
||||
dptr = &hilp->hl_device[HILUNIT(dev)];
|
||||
if (*(int *)data)
|
||||
dptr->hd_flags |= HIL_NOBLOCK;
|
||||
else
|
||||
|
@ -751,11 +774,13 @@ hilpoll(dev, events, p)
|
|||
int events;
|
||||
struct proc *p;
|
||||
{
|
||||
struct hil_softc *hilp = &hil_softc[HILLOOP(dev)];
|
||||
struct hil_softc *hilp;
|
||||
struct hilloopdev *dptr;
|
||||
struct hiliqueue *qp;
|
||||
int mask;
|
||||
int s, device, revents;
|
||||
int s, revents;
|
||||
|
||||
hilp = device_lookup(&hil_cd, HILLOOP(dev));
|
||||
|
||||
revents = events & (POLLOUT | POLLWRNORM);
|
||||
|
||||
|
@ -763,13 +788,11 @@ hilpoll(dev, events, p)
|
|||
if ((events & (POLLIN | POLLRDNORM)) == 0)
|
||||
return (revents);
|
||||
|
||||
device = HILUNIT(dev);
|
||||
|
||||
/*
|
||||
* Read interface.
|
||||
* Return 1 if there is something in the queue, 0 ow.
|
||||
*/
|
||||
dptr = &hilp->hl_device[device];
|
||||
dptr = &hilp->hl_device[HILUNIT(dev)];
|
||||
if (dptr->hd_flags & HIL_READIN) {
|
||||
s = splhil();
|
||||
if (dptr->hd_queue.c_cc > 0)
|
||||
|
@ -785,7 +808,8 @@ hilpoll(dev, events, p)
|
|||
* Note that we do not do this for the read interface.
|
||||
* This is primarily to be consistant with HP-UX.
|
||||
*/
|
||||
if (device && (dptr->hd_flags & (HIL_ALIVE|HIL_PSEUDO)) != HIL_ALIVE)
|
||||
if (HILUNIT(dev) &&
|
||||
(dptr->hd_flags & (HIL_ALIVE|HIL_PSEUDO)) != HIL_ALIVE)
|
||||
return (revents | (events & (POLLIN | POLLRDNORM)));
|
||||
|
||||
/*
|
||||
|
@ -793,10 +817,10 @@ hilpoll(dev, events, p)
|
|||
* Check to see if there are any data for any loop device
|
||||
* provided it is associated with a queue belonging to this user.
|
||||
*/
|
||||
if (device == 0)
|
||||
if (HILUNIT(dev) == 0)
|
||||
mask = -1;
|
||||
else
|
||||
mask = hildevmask(device);
|
||||
mask = hildevmask(HILUNIT(dev));
|
||||
/*
|
||||
* Must check everybody with interrupts blocked to prevent races.
|
||||
*/
|
||||
|
@ -815,15 +839,11 @@ hilpoll(dev, events, p)
|
|||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
hilint(unit)
|
||||
int unit;
|
||||
int
|
||||
hilint(v)
|
||||
void *v;
|
||||
{
|
||||
#ifdef hp300
|
||||
struct hil_softc *hilp = &hil_softc[0]; /* XXX how do we know on 300? */
|
||||
#else
|
||||
struct hil_softc *hilp = &hil_softc[unit];
|
||||
#endif
|
||||
struct hil_softc *hilp = v;
|
||||
struct hil_dev *hildevice = hilp->hl_addr;
|
||||
u_char c, stat;
|
||||
|
||||
|
@ -833,6 +853,7 @@ hilint(unit)
|
|||
#if NRND > 0
|
||||
rnd_add_uint32(&hilp->rnd_source, (stat<<8)|c);
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
#include "ite.h"
|
||||
|
@ -905,6 +926,7 @@ hil_process_int(hilp, stat, c)
|
|||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1160,22 +1182,24 @@ hilqunmap(hilp, qnum, device, p)
|
|||
*/
|
||||
|
||||
void
|
||||
kbdbell(unit)
|
||||
int unit;
|
||||
kbdbell(hilp)
|
||||
struct hil_softc *hilp;
|
||||
{
|
||||
struct hil_softc *hilp = &hil_softc[unit];
|
||||
|
||||
hilbeep(hilp, &default_bell);
|
||||
}
|
||||
|
||||
void
|
||||
kbdenable(unit)
|
||||
int unit;
|
||||
kbdenable(hilp)
|
||||
struct hil_softc *hilp;
|
||||
{
|
||||
struct hil_softc *hilp = &hil_softc[unit];
|
||||
struct hil_dev *hildevice = hilp->hl_addr;
|
||||
struct hil_dev *hildevice;
|
||||
char db;
|
||||
|
||||
if (hilp == NULL)
|
||||
hildevice = HILADDR; /* XXX */
|
||||
else
|
||||
hildevice = hilp->hl_addr;
|
||||
|
||||
/* Set the autorepeat rate */
|
||||
db = ar_format(KBD_ARR);
|
||||
send_hil_cmd(hildevice, HIL_SETARR, &db, 1, NULL);
|
||||
|
@ -1189,8 +1213,8 @@ kbdenable(unit)
|
|||
}
|
||||
|
||||
void
|
||||
kbddisable(unit)
|
||||
int unit;
|
||||
kbddisable(hilp)
|
||||
struct hil_softc *hilp;
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1286,16 +1310,16 @@ kbdcninit()
|
|||
int
|
||||
kbdnmi()
|
||||
{
|
||||
struct hil_softc *hilp = &hil_softc[0]; /* XXX how do we know on 300? */
|
||||
struct hil_dev *hl_addr = HILADDR;
|
||||
|
||||
if ((*KBDNMISTAT & KBDNMI) == 0)
|
||||
return(0);
|
||||
|
||||
HILWAIT(hilp->hl_addr);
|
||||
WRITEHILCMD(hilp->hl_addr, HIL_CNMT);
|
||||
HILWAIT(hilp->hl_addr);
|
||||
WRITEHILCMD(hilp->hl_addr, HIL_CNMT);
|
||||
HILWAIT(hilp->hl_addr);
|
||||
HILWAIT(hl_addr);
|
||||
WRITEHILCMD(hl_addr, HIL_CNMT);
|
||||
HILWAIT(hl_addr);
|
||||
WRITEHILCMD(hl_addr, HIL_CNMT);
|
||||
HILWAIT(hl_addr);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -1307,10 +1331,9 @@ kbdnmi()
|
|||
* Called at boot time to print out info about interesting devices
|
||||
*/
|
||||
void
|
||||
hilinfo(unit)
|
||||
int unit;
|
||||
hilinfo(hilp)
|
||||
struct hil_softc *hilp;
|
||||
{
|
||||
struct hil_softc *hilp = &hil_softc[unit];
|
||||
int id, len;
|
||||
struct kbdmap *km;
|
||||
|
||||
|
@ -1318,7 +1341,7 @@ hilinfo(unit)
|
|||
* Keyboard info.
|
||||
*/
|
||||
if (hilp->hl_kbddev) {
|
||||
printf("hil%d: ", hilp->hl_kbddev);
|
||||
printf("%s:%d: ", hilp->hl_dev.dv_xname, hilp->hl_kbddev);
|
||||
for (km = kbd_map; km->kbd_code; km++)
|
||||
if (km->kbd_code == hilp->hl_kbdlang) {
|
||||
printf("%s ", km->kbd_desc);
|
||||
|
@ -1353,7 +1376,7 @@ hilinfo(unit)
|
|||
*/
|
||||
if (!id) {
|
||||
char buf[10];
|
||||
sprintf(buf, "hil%d", unit);
|
||||
sprintf(buf, "%s", hilp->hl_dev.dv_xname);
|
||||
rnd_attach_source(&hilp->rnd_source, buf, RND_TYPE_TTY, 0);
|
||||
}
|
||||
#endif
|
||||
|
@ -1536,11 +1559,15 @@ hilbeep(hilp, bp)
|
|||
struct hil_softc *hilp;
|
||||
struct _hilbell *bp;
|
||||
{
|
||||
struct hil_dev *hl_addr = HILADDR;
|
||||
u_char buf[2];
|
||||
|
||||
if (hilp != NULL)
|
||||
hl_addr = hilp->hl_addr;
|
||||
|
||||
buf[0] = ~((bp->duration - 10) / 10);
|
||||
buf[1] = bp->frequency;
|
||||
send_hil_cmd(hilp->hl_addr, HIL_SETTONE, buf, 2, NULL);
|
||||
send_hil_cmd(hl_addr, HIL_SETTONE, buf, 2, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hilvar.h,v 1.16 2000/10/10 19:58:43 he Exp $ */
|
||||
/* $NetBSD: hilvar.h,v 1.17 2001/11/17 23:53:37 gmcgarry Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -96,6 +96,7 @@ struct hilloopdev {
|
|||
#define HIL_DERROR 0x80 /* loop has reconfigured, reality altered */
|
||||
|
||||
struct hil_softc {
|
||||
struct device hl_dev;
|
||||
struct hil_dev *hl_addr; /* base of hardware registers */
|
||||
u_char hl_cmddone; /* */
|
||||
u_char hl_cmdending; /* */
|
||||
|
@ -122,9 +123,9 @@ struct hil_softc {
|
|||
#define KBD_AR2 0x04 /* keyboard auto-repeat rate 2 */
|
||||
|
||||
#ifdef _KERNEL
|
||||
void kbdbell __P((int));
|
||||
void kbdenable __P((int));
|
||||
void kbddisable __P((int));
|
||||
void kbdbell __P((struct hil_softc *));
|
||||
void kbdenable __P((struct hil_softc *));
|
||||
void kbddisable __P((struct hil_softc *));
|
||||
int kbdgetc __P((int *));
|
||||
void kbdcninit __P((void));
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ite.c,v 1.47 2001/05/02 10:32:16 scw Exp $ */
|
||||
/* $NetBSD: ite.c,v 1.48 2001/11/17 23:53:37 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -84,6 +84,8 @@
|
|||
* the hardware dependent routines.
|
||||
*/
|
||||
|
||||
#include "hil.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/proc.h>
|
||||
|
@ -248,7 +250,9 @@ iteon(ip, flag)
|
|||
|
||||
if (kbd_ite == NULL || kbd_ite == ip) {
|
||||
kbd_ite = ip;
|
||||
#if NHIL > 0
|
||||
kbdenable(0); /* XXX */
|
||||
#endif
|
||||
}
|
||||
|
||||
iteinit(ip);
|
||||
|
@ -535,6 +539,7 @@ void
|
|||
itefilter(stat, c)
|
||||
char stat, c;
|
||||
{
|
||||
#if NHIL >0
|
||||
static int capsmode = 0;
|
||||
static int metamode = 0;
|
||||
char code, *str;
|
||||
|
@ -592,6 +597,7 @@ itefilter(stat, c)
|
|||
code |= 0x80;
|
||||
(*kbd_tty->t_linesw->l_rint)(code, kbd_tty);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -840,7 +846,9 @@ ignore:
|
|||
|
||||
case CTRL('G'):
|
||||
if (ip == kbd_ite)
|
||||
#if NHIL > 0
|
||||
kbdbell(0); /* XXX */
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ESC:
|
||||
|
@ -1005,7 +1013,9 @@ itecninit(gp, isw)
|
|||
/*
|
||||
* Initialize the console keyboard.
|
||||
*/
|
||||
#if NHIL > 0
|
||||
kbdcninit();
|
||||
#endif
|
||||
|
||||
kbd_ite = ip; /* XXX */
|
||||
}
|
||||
|
@ -1015,7 +1025,8 @@ int
|
|||
itecngetc(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
int c;
|
||||
int c = 0;
|
||||
#if NHIL > 0
|
||||
int stat;
|
||||
|
||||
c = kbdgetc(&stat);
|
||||
|
@ -1033,6 +1044,7 @@ itecngetc(dev)
|
|||
c = 0;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return(c);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: autoconf.c,v 1.49 1999/09/17 19:59:42 thorpej Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.50 2001/11/17 23:53:38 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -261,19 +261,6 @@ cpu_configure()
|
|||
LIST_INIT(&dev_data_list_hpib);
|
||||
LIST_INIT(&dev_data_list_scsi);
|
||||
|
||||
/*
|
||||
* XXX In order for the HIL to configure, interrupts need to be
|
||||
* XXX enabled. However, we need to initialize the HIL driver's
|
||||
* XXX software state prior to that, since a pending interrupt
|
||||
* XXX might cause the HIL's interrupt handler to be run in an
|
||||
* XXX uninitialized environment otherwise.
|
||||
*
|
||||
* XXX These should be consolidated into some kind of table.
|
||||
*/
|
||||
hilsoftinit(0, HILADDR);
|
||||
(void)spl0();
|
||||
hilinit(0, HILADDR);
|
||||
|
||||
(void)splhigh();
|
||||
if (config_rootfound("mainbus", "mainbus") == NULL)
|
||||
panic("no mainbus found");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: conf.c,v 1.47 2001/11/08 06:27:45 gmcgarry Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.48 2001/11/17 23:53:39 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
|
@ -122,7 +122,7 @@ cdev_decl(dca);
|
|||
cdev_decl(apci);
|
||||
#include "ite.h"
|
||||
cdev_decl(ite);
|
||||
/* XXX shouldn't this be optional? */
|
||||
#include "hil.h"
|
||||
cdev_decl(hil);
|
||||
#include "dcm.h"
|
||||
cdev_decl(dcm);
|
||||
|
@ -164,7 +164,7 @@ struct cdevsw cdevsw[] =
|
|||
cdev_ppi_init(NPPI,ppi), /* 11: printer/plotter interface */
|
||||
cdev_tty_init(NDCA,dca), /* 12: built-in single-port serial */
|
||||
cdev_tty_init(NITE,ite), /* 13: console terminal emulator */
|
||||
cdev_hil_init(1,hil), /* 14: human interface loop */
|
||||
cdev_hil_init(NHIL,hil), /* 14: human interface loop */
|
||||
cdev_tty_init(NDCM,dcm), /* 15: 4-port serial */
|
||||
cdev_tape_init(NMT,mt), /* 16: magnetic reel tape */
|
||||
cdev_disk_init(NCCD,ccd), /* 17: concatenated disk */
|
||||
|
@ -343,7 +343,7 @@ cons_decl(dcm);
|
|||
#include "topcat.h"
|
||||
|
||||
struct consdev constab[] = {
|
||||
#if NITE > 0
|
||||
#if (NITE > 0) && (NHIL > 0)
|
||||
#if NDVBOX > 0
|
||||
cons_init(dvbox),
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.149 2001/09/16 16:34:29 wiz Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.150 2001/11/17 23:53:39 gmcgarry Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -45,6 +45,7 @@
|
|||
#include "opt_ddb.h"
|
||||
#include "opt_compat_hpux.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "hil.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -1138,6 +1139,7 @@ nmihand(frame)
|
|||
return;
|
||||
innmihand = 1;
|
||||
|
||||
#if NHIL > 0
|
||||
/* Check for keyboard <CRTL>+<SHIFT>+<RESET>. */
|
||||
if (kbdnmi()) {
|
||||
printf("Got a keyboard NMI");
|
||||
|
@ -1175,14 +1177,17 @@ nmihand(frame)
|
|||
|
||||
goto nmihand_out; /* no more work to do */
|
||||
}
|
||||
#endif
|
||||
|
||||
if (parityerror(&frame))
|
||||
return;
|
||||
/* panic?? */
|
||||
printf("unexpected level 7 interrupt ignored\n");
|
||||
|
||||
nmihand_out:
|
||||
#if NHIL > 0
|
||||
nmihand_out:
|
||||
innmihand = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue