Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/atari/dev Split device_t/softc. Also rename some s...
details: https://anonhg.NetBSD.org/src/rev/ce1b630ed6dc
branches: trunk
changeset: 765771:ce1b630ed6dc
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Jun 05 16:25:12 2011 +0000
description:
Split device_t/softc. Also rename some softc variables. Tested on TT030.
XXX: old ugly config_console() hack should go away...
diffstat:
sys/arch/atari/dev/grfvar.h | 4 +-
sys/arch/atari/dev/ite.c | 1072 +++++++++++++++++++++---------------------
sys/arch/atari/dev/ite_cc.c | 94 ++-
sys/arch/atari/dev/ite_et.c | 95 ++-
sys/arch/atari/dev/itevar.h | 4 +-
5 files changed, 641 insertions(+), 628 deletions(-)
diffs (truncated from 2548 to 300 lines):
diff -r f81e052d05e8 -r ce1b630ed6dc sys/arch/atari/dev/grfvar.h
--- a/sys/arch/atari/dev/grfvar.h Sun Jun 05 16:22:00 2011 +0000
+++ b/sys/arch/atari/dev/grfvar.h Sun Jun 05 16:25:12 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: grfvar.h,v 1.12 2011/02/08 20:20:10 rmind Exp $ */
+/* $NetBSD: grfvar.h,v 1.13 2011/06/05 16:25:12 tsutsui Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -55,7 +55,7 @@
* uses it...
*/
struct grf_softc {
- struct device g_device; /* config sets this up. */
+ device_t g_device; /* config sets this up. */
struct grfinfo g_display; /* hardware descr. (for ioctl) */
int g_flags; /* software flags */
int g_unit; /* grf unit we want/have */
diff -r f81e052d05e8 -r ce1b630ed6dc sys/arch/atari/dev/ite.c
--- a/sys/arch/atari/dev/ite.c Sun Jun 05 16:22:00 2011 +0000
+++ b/sys/arch/atari/dev/ite.c Sun Jun 05 16:25:12 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ite.c,v 1.70 2011/04/24 16:26:54 rmind Exp $ */
+/* $NetBSD: ite.c,v 1.71 2011/06/05 16:25:12 tsutsui Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.70 2011/04/24 16:26:54 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.71 2011/06/05 16:25:12 tsutsui Exp $");
#include "opt_ddb.h"
@@ -81,12 +81,12 @@
#define ITEUNIT(dev) (minor(dev))
-#define SUBR_INIT(ip) (ip)->grf->g_iteinit(ip)
-#define SUBR_DEINIT(ip) (ip)->grf->g_itedeinit(ip)
-#define SUBR_PUTC(ip,c,dy,dx,m) (ip)->grf->g_iteputc(ip,c,dy,dx,m)
-#define SUBR_CURSOR(ip,flg) (ip)->grf->g_itecursor(ip,flg)
-#define SUBR_CLEAR(ip,sy,sx,h,w) (ip)->grf->g_iteclear(ip,sy,sx,h,w)
-#define SUBR_SCROLL(ip,sy,sx,cnt,dir) (ip)->grf->g_itescroll(ip,sy,sx,cnt,dir)
+#define SUBR_INIT(sc) (sc)->grf->g_iteinit(sc)
+#define SUBR_DEINIT(sc) (sc)->grf->g_itedeinit(sc)
+#define SUBR_PUTC(sc,c,dy,dx,m) (sc)->grf->g_iteputc(sc,c,dy,dx,m)
+#define SUBR_CURSOR(sc,flg) (sc)->grf->g_itecursor(sc,flg)
+#define SUBR_CLEAR(sc,sy,sx,h,w) (sc)->grf->g_iteclear(sc,sy,sx,h,w)
+#define SUBR_SCROLL(sc,sy,sx,cnt,dir) (sc)->grf->g_itescroll(sc,sy,sx,cnt,dir)
int start_repeat_timeo = 30; /* first repeat after x s/100 */
int next_repeat_timeo = 10; /* next repeat after x s/100 */
@@ -135,10 +135,10 @@
static void ite_switch(int);
static void repeat_handler(void *);
-void iteputchar(int c, struct ite_softc *ip);
+void iteputchar(int c, struct ite_softc *sc);
void ite_putstr(const u_char * s, int len, dev_t dev);
-void iteattach(struct device *, struct device *, void *);
-int itematch(struct device *, struct cfdata *, void *);
+void iteattach(device_t, device_t, void *);
+int itematch(device_t, cfdata_t, void *);
/*
* Console specific types.
@@ -148,7 +148,7 @@
dev_type_cngetc(itecngetc);
dev_type_cnputc(itecnputc);
-CFATTACH_DECL(ite, sizeof(struct ite_softc),
+CFATTACH_DECL_NEW(ite, sizeof(struct ite_softc),
itematch, iteattach, NULL, NULL);
dev_type_open(iteopen);
@@ -171,7 +171,7 @@
static int cons_ite = -1;
int
-itematch(struct device *pdp, struct cfdata *cfp, void *auxp)
+itematch(device_t parent, cfdata_t cf, void *aux)
{
/*
@@ -181,59 +181,59 @@
if (atari_realconfig == 0) {
if (cons_ite >= 0)
return 0;
- cons_ite = cfp->cf_unit;
+ cons_ite = cf->cf_unit;
return 1;
}
return 1;
}
void
-iteattach(struct device *pdp, struct device *dp, void *auxp)
+iteattach(device_t parent, device_t self, void *aux)
{
- struct grf_softc *gp;
- struct ite_softc *ip;
+ struct grf_softc *gsc;
+ struct ite_softc *sc;
int s;
int maj, unit;
- gp = (struct grf_softc *)auxp;
- ip = (struct ite_softc *)dp;
+ gsc = device_private(parent);
+ sc = device_private(self);
maj = cdevsw_lookup_major(&ite_cdevsw);
- unit = (dp != NULL) ? device_unit(&ip->device) : cons_ite;
- gp->g_itedev = makedev(maj, unit);
+ unit = (self != NULL) ? device_unit(self) : cons_ite;
+ gsc->g_itedev = makedev(maj, unit);
- if (dp) {
+ if (self != NULL) {
s = spltty();
if (con_itesoftc.grf != NULL &&
- con_itesoftc.grf->g_unit == gp->g_unit) {
+ con_itesoftc.grf->g_unit == gsc->g_unit) {
/*
* console reinit copy params over.
* and console always gets keyboard
*/
- memcpy(&ip->grf, &con_itesoftc.grf,
- (char *)&ip[1] - (char *)&ip->grf);
+ memcpy(&sc->grf, &con_itesoftc.grf,
+ (char *)&sc[1] - (char *)&sc->grf);
con_itesoftc.grf = NULL;
- kbd_ite = ip;
+ kbd_ite = sc;
}
- ip->grf = gp;
+ sc->grf = gsc;
splx(s);
- iteinit(gp->g_itedev);
- printf(": %dx%d", ip->rows, ip->cols);
+ iteinit(gsc->g_itedev);
+ printf(": %dx%d", sc->rows, sc->cols);
printf(" repeat at (%d/100)s next at (%d/100)s",
start_repeat_timeo, next_repeat_timeo);
if (kbd_ite == NULL)
- kbd_ite = ip;
- if (kbd_ite == ip)
+ kbd_ite = sc;
+ if (kbd_ite == sc)
printf(" has keyboard");
printf("\n");
- ip->flags |= ITE_ATTACHED;
+ sc->flags |= ITE_ATTACHED;
} else {
if (con_itesoftc.grf != NULL &&
- con_itesoftc.grf->g_conpri > gp->g_conpri)
+ con_itesoftc.grf->g_conpri > gsc->g_conpri)
return;
- con_itesoftc.grf = gp;
+ con_itesoftc.grf = gsc;
con_itesoftc.tabs = cons_tabs;
}
}
@@ -276,12 +276,12 @@
void
itecninit(struct consdev *cd)
{
- struct ite_softc *ip;
+ struct ite_softc *sc;
- ip = getitesp(cd->cn_dev);
- ip->flags |= ITE_ISCONS;
+ sc = getitesp(cd->cn_dev);
+ sc->flags |= ITE_ISCONS;
iteinit(cd->cn_dev);
- ip->flags |= ITE_ACTIVE | ITE_ISCONS;
+ sc->flags |= ITE_ACTIVE | ITE_ISCONS;
}
/*
@@ -290,7 +290,7 @@
* up this ite now that the system is more functional.
*/
void
-ite_cnfinish(struct ite_softc *ip)
+ite_cnfinish(struct ite_softc *sc)
{
static int done;
@@ -315,20 +315,20 @@
itecnputc(dev_t dev, int c)
{
static int paniced;
- struct ite_softc *ip;
+ struct ite_softc *sc;
char ch;
- ip = getitesp(dev);
+ sc = getitesp(dev);
ch = c;
if (panicstr && !paniced &&
- (ip->flags & (ITE_ACTIVE | ITE_INGRF)) != ITE_ACTIVE) {
+ (sc->flags & (ITE_ACTIVE | ITE_INGRF)) != ITE_ACTIVE) {
ite_on(dev, 3);
paniced = 1;
}
- SUBR_CURSOR(ip, START_CURSOROPT);
- iteputchar(ch, ip);
- SUBR_CURSOR(ip, END_CURSOROPT);
+ SUBR_CURSOR(sc, START_CURSOROPT);
+ iteputchar(ch, sc);
+ SUBR_CURSOR(sc, END_CURSOROPT);
}
/*
@@ -343,34 +343,34 @@
void
iteinit(dev_t dev)
{
- struct ite_softc *ip;
+ struct ite_softc *sc;
- ip = getitesp(dev);
- if (ip->flags & ITE_INITED)
+ sc = getitesp(dev);
+ if (sc->flags & ITE_INITED)
return;
if (atari_realconfig) {
- if (ip->kbdmap && ip->kbdmap != &ascii_kbdmap)
- free(ip->kbdmap, M_DEVBUF);
- ip->kbdmap = malloc(sizeof(struct kbdmap), M_DEVBUF, M_WAITOK);
- memcpy(ip->kbdmap, &ascii_kbdmap, sizeof(struct kbdmap));
+ if (sc->kbdmap && sc->kbdmap != &ascii_kbdmap)
+ free(sc->kbdmap, M_DEVBUF);
+ sc->kbdmap = malloc(sizeof(struct kbdmap), M_DEVBUF, M_WAITOK);
+ memcpy(sc->kbdmap, &ascii_kbdmap, sizeof(struct kbdmap));
}
else
- ip->kbdmap = &ascii_kbdmap;
+ sc->kbdmap = &ascii_kbdmap;
- ip->cursorx = 0;
- ip->cursory = 0;
- SUBR_INIT(ip);
- SUBR_CURSOR(ip, DRAW_CURSOR);
- if (ip->tabs == NULL)
- ip->tabs = malloc(MAX_TABS * sizeof(u_char),M_DEVBUF,M_WAITOK);
- ite_reset(ip);
- ip->flags |= ITE_INITED;
+ sc->cursorx = 0;
+ sc->cursory = 0;
+ SUBR_INIT(sc);
+ SUBR_CURSOR(sc, DRAW_CURSOR);
+ if (sc->tabs == NULL)
+ sc->tabs = malloc(MAX_TABS * sizeof(u_char),M_DEVBUF,M_WAITOK);
+ ite_reset(sc);
+ sc->flags |= ITE_INITED;
}
int
iteopen(dev_t dev, int mode, int devtype, struct lwp *l)
{
- struct ite_softc *ip;
+ struct ite_softc *sc;
struct tty *tp;
int error, first, unit;
@@ -379,23 +379,23 @@
return ENXIO;
first = 0;
- ip = getitesp(dev);
- if (ip == NULL)
+ sc = getitesp(dev);
+ if (sc == NULL)
return ENXIO;
- if ((ip->flags & ITE_ATTACHED) == 0)
+ if ((sc->flags & ITE_ATTACHED) == 0)
return (ENXIO);
- if (ip->tp == NULL) {
- tp = ip->tp = tty_alloc();
+ if (sc->tp == NULL) {
+ tp = sc->tp = tty_alloc();
tty_attach(tp);
}
else
- tp = ip->tp;
+ tp = sc->tp;
if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN, tp))
return (EBUSY);
- if ((ip->flags & ITE_ACTIVE) == 0) {
Home |
Main Index |
Thread Index |
Old Index