Add cn_halt and cn_flush entries to consdevs. (needed for dma-only console

devices).
This commit is contained in:
matt 2003-03-06 00:38:26 +00:00
parent 40543d7e0e
commit 7109fe9012
5 changed files with 56 additions and 56 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cons.c,v 1.45 2002/10/23 09:13:01 jdolecek Exp $ */
/* $NetBSD: cons.c,v 1.46 2003/03/06 00:38:26 matt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.45 2002/10/23 09:13:01 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.46 2003/03/06 00:38:26 matt Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -76,10 +76,7 @@ struct consdev *cn_tab; /* physical console device info */
struct vnode *cn_devvp; /* vnode for underlying device. */
int
cnopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
struct proc *p;
cnopen(dev_t dev, int flag, int mode, struct proc *p)
{
const struct cdevsw *cdev;
dev_t cndev;
@ -122,10 +119,7 @@ cnopen(dev, flag, mode, p)
}
int
cnclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
struct proc *p;
cnclose(dev_t dev, int flag, int mode, struct proc *p)
{
const struct cdevsw *cdev;
struct vnode *vp;
@ -153,10 +147,7 @@ cnclose(dev, flag, mode, p)
}
int
cnread(dev, uio, flag)
dev_t dev;
struct uio *uio;
int flag;
cnread(dev_t dev, struct uio *uio, int flag)
{
const struct cdevsw *cdev;
@ -180,10 +171,7 @@ cnread(dev, uio, flag)
}
int
cnwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
int flag;
cnwrite(dev_t dev, struct uio *uio, int flag)
{
const struct cdevsw *cdev;
@ -204,12 +192,7 @@ cnwrite(dev, uio, flag)
}
int
cnioctl(dev, cmd, data, flag, p)
dev_t dev;
u_long cmd;
caddr_t data;
int flag;
struct proc *p;
cnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
{
const struct cdevsw *cdev;
int error;
@ -246,10 +229,7 @@ cnioctl(dev, cmd, data, flag, p)
/*ARGSUSED*/
int
cnpoll(dev, events, p)
dev_t dev;
int events;
struct proc *p;
cnpoll(dev_t dev, int events, struct proc *p)
{
const struct cdevsw *cdev;
@ -272,9 +252,7 @@ cnpoll(dev, events, p)
/*ARGSUSED*/
int
cnkqfilter(dev, kn)
dev_t dev;
struct knote *kn;
cnkqfilter(dev_t dev, struct knote *kn)
{
const struct cdevsw *cdev;
@ -296,18 +274,15 @@ cnkqfilter(dev, kn)
}
int
cngetc()
cngetc(void)
{
if (cn_tab == NULL)
return (0);
return ((*cn_tab->cn_getc)(cn_tab->cn_dev));
}
int
cngetsn(cp, size)
char *cp;
int size;
cngetsn(char *cp, int size)
{
char *lp;
int c, len;
@ -353,8 +328,7 @@ cngetsn(cp, size)
}
void
cnputc(c)
int c;
cnputc(int c)
{
if (cn_tab == NULL)
@ -368,8 +342,7 @@ cnputc(c)
}
void
cnpollc(on)
int on;
cnpollc(int on)
{
static int refcount = 0;
@ -384,19 +357,32 @@ cnpollc(on)
}
void
nullcnpollc(dev, on)
dev_t dev;
int on;
nullcnpollc(dev_t dev, int on)
{
}
void
cnbell(pitch, period, volume)
u_int pitch, period, volume;
cnbell(u_int pitch, u_int period, u_int volume)
{
if (cn_tab == NULL || cn_tab->cn_bell == NULL)
return;
(*cn_tab->cn_bell)(cn_tab->cn_dev, pitch, period, volume);
}
void
cnflush(void)
{
if (cn_tab == NULL || cn_tab->cn_flush == NULL)
return;
(*cn_tab->cn_flush)(cn_tab->cn_dev);
}
void
cnhalt(void)
{
if (cn_tab == NULL || cn_tab->cn_halt == NULL)
return;
(*cn_tab->cn_halt)(cn_tab->cn_dev);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cons.h,v 1.19 2002/09/06 13:18:43 gehenna Exp $ */
/* $NetBSD: cons.h,v 1.20 2003/03/06 00:38:26 matt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -58,6 +58,10 @@ struct consdev {
__P((dev_t, int));
void (*cn_bell) /* ring bell */
__P((dev_t, u_int, u_int, u_int));
void (*cn_halt) /* stop device */
__P((dev_t));
void (*cn_flush) /* flush output */
__P((dev_t));
dev_t cn_dev; /* major/minor of device */
int cn_pri; /* pecking order; the higher the better */
};
@ -79,6 +83,8 @@ int cngetsn __P((char *, int));
void cnputc __P((int));
void cnpollc __P((int));
void cnbell __P((u_int, u_int, u_int));
void cnflush __P((void));
void cnhalt __P((void));
void cnrint __P((void));
void nullcnpollc __P((dev_t, int));
@ -89,13 +95,16 @@ void nullcnpollc __P((dev_t, int));
#define dev_type_cnputc(n) void n __P((dev_t, int))
#define dev_type_cnpollc(n) void n __P((dev_t, int))
#define dev_type_cnbell(n) void n __P((dev_t, u_int, u_int, u_int));
#define dev_type_cnhalt(n) void n __P((dev_t))
#define dev_type_cnflush(n) void n __P((dev_t))
#define dev_decl(n,t) __CONCAT(dev_type_,t)(__CONCAT(n,t))
#define dev_init(n,t) __CONCAT(n,t)
#define cons_decl(n) \
dev_decl(n,cnprobe); dev_decl(n,cninit); dev_decl(n,cngetc); \
dev_decl(n,cnputc); dev_decl(n,cnpollc); dev_decl(n,cnbell);
dev_decl(n,cnputc); dev_decl(n,cnpollc); dev_decl(n,cnbell); \
dev_decl(n,cnflush); dev_decl(n,cnhalt);
#define cons_init(n) { \
dev_init(n,cnprobe), dev_init(n,cninit), dev_init(n,cngetc), \
@ -105,6 +114,11 @@ void nullcnpollc __P((dev_t, int));
dev_init(n,cnprobe), dev_init(n,cninit), dev_init(n,cngetc), \
dev_init(n,cnputc), dev_init(n,cnpollc), dev_init(n,cnbell) }
#define cons_init_halt(n) { \
dev_init(n,cnprobe), dev_init(n,cninit), dev_init(n,cngetc), \
dev_init(n,cnputc), dev_init(n,cnpollc), 0, \
dev_init(n,cnhalt) }
#endif
#endif /* _SYS_DEV_CONS_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: com.c,v 1.202 2003/01/31 00:26:28 thorpej Exp $ */
/* $NetBSD: com.c,v 1.203 2003/03/06 00:38:27 matt Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.202 2003/01/31 00:26:28 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.203 2003/03/06 00:38:27 matt Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@ -2320,7 +2320,7 @@ cominit(bus_space_tag_t iot, bus_addr_t iobase, int rate, int frequency,
* Following are all routines needed for COM to act as console
*/
struct consdev comcons = {
NULL, NULL, comcngetc, comcnputc, comcnpollc, NULL,
NULL, NULL, comcngetc, comcnputc, comcnpollc, NULL, NULL, NULL,
NODEV, CN_NORMAL
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: zs_ioasic.c,v 1.20 2003/01/01 00:10:25 thorpej Exp $ */
/* $NetBSD: zs_ioasic.c,v 1.21 2003/03/06 00:38:28 matt Exp $ */
/*-
* Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: zs_ioasic.c,v 1.20 2003/01/01 00:10:25 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: zs_ioasic.c,v 1.21 2003/03/06 00:38:28 matt Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -97,7 +97,7 @@ void zs_ioasic_cnpollc __P((dev_t, int));
struct consdev zs_ioasic_cons = {
NULL, NULL, zs_ioasic_cngetc, zs_ioasic_cnputc,
zs_ioasic_cnpollc, NULL, NODEV, CN_NORMAL,
zs_ioasic_cnpollc, NULL, NULL, NULL, NODEV, CN_NORMAL,
};
tc_offset_t zs_ioasic_console_offset;

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsdisplay.c,v 1.72 2003/01/20 02:16:55 simonb Exp $ */
/* $NetBSD: wsdisplay.c,v 1.73 2003/03/06 00:38:28 matt Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.72 2003/01/20 02:16:55 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.73 2003/03/06 00:38:28 matt Exp $");
#include "opt_wsdisplay_compat.h"
#include "opt_compat_netbsd.h"
@ -206,7 +206,7 @@ static void (*wsdisplay_cons_kbd_pollc)(dev_t, int);
static struct consdev wsdisplay_cons = {
NULL, NULL, wsdisplay_getc_dummy, wsdisplay_cnputc,
wsdisplay_pollc, NULL, NODEV, CN_NORMAL
wsdisplay_pollc, NULL, NULL, NULL, NODEV, CN_NORMAL
};
#ifndef WSDISPLAY_DEFAULTSCREENS