Split device_t/softc, and misc cosmetic changes.
This commit is contained in:
parent
58561d05b5
commit
440f7c7b53
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ct.c,v 1.52 2008/01/02 11:48:24 ad Exp $ */
|
||||
/* $NetBSD: ct.c,v 1.53 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -82,7 +82,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.52 2008/01/02 11:48:24 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.53 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -105,7 +105,7 @@ __KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.52 2008/01/02 11:48:24 ad Exp $");
|
||||
#define EOFS 128
|
||||
|
||||
struct ct_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
int sc_slave; /* HP-IB slave ID */
|
||||
int sc_punit; /* physical unit */
|
||||
struct ct_iocmd sc_ioc;
|
||||
@ -146,10 +146,10 @@ struct ct_softc {
|
||||
#define CTF_CANSTREAM 0x200
|
||||
#define CTF_WRTTN 0x400
|
||||
|
||||
static int ctmatch(struct device *, struct cfdata *, void *);
|
||||
static void ctattach(struct device *, struct device *, void *);
|
||||
static int ctmatch(device_t, cfdata_t, void *);
|
||||
static void ctattach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(ct, sizeof(struct ct_softc),
|
||||
CFATTACH_DECL_NEW(ct, sizeof(struct ct_softc),
|
||||
ctmatch, ctattach, NULL, NULL);
|
||||
|
||||
static dev_type_open(ctopen);
|
||||
@ -168,7 +168,7 @@ const struct cdevsw ct_cdevsw = {
|
||||
nostop, notty, nopoll, nommap, nokqfilter, D_TAPE
|
||||
};
|
||||
|
||||
static int ctident(struct device *, struct ct_softc *,
|
||||
static int ctident(device_t, struct ct_softc *,
|
||||
struct hpibbus_attach_args *);
|
||||
|
||||
static void ctreset(struct ct_softc *);
|
||||
@ -195,7 +195,7 @@ static const struct ctinfo {
|
||||
{ CT9145ID, 0, "9145" },
|
||||
{ CT35401ID, 0, "35401A"},
|
||||
};
|
||||
static const int nctinfo = sizeof(ctinfo) / sizeof(ctinfo[0]);
|
||||
static const int nctinfo = __arraycount(ctinfo);
|
||||
|
||||
#define CT_NOREW 4
|
||||
#define CT_STREAM 8
|
||||
@ -209,7 +209,7 @@ int ctdebug = 0;
|
||||
#endif
|
||||
|
||||
static int
|
||||
ctmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
ctmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct hpibbus_attach_args *ha = aux;
|
||||
|
||||
@ -217,14 +217,14 @@ ctmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
ctattach(struct device *parent, struct device *self, void *aux)
|
||||
ctattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct ct_softc *sc = (struct ct_softc *)self;
|
||||
struct ct_softc *sc = device_private(self);
|
||||
struct hpibbus_attach_args *ha = aux;
|
||||
|
||||
sc->sc_dev = self;
|
||||
if (ctident(parent, sc, ha) == 0) {
|
||||
printf("\n%s: didn't respond to describe command!\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error(": didn't respond to describe command!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -245,8 +245,7 @@ ctattach(struct device *parent, struct device *self, void *aux)
|
||||
}
|
||||
|
||||
static int
|
||||
ctident(struct device *parent, struct ct_softc *sc,
|
||||
struct hpibbus_attach_args *ha)
|
||||
ctident(device_t parent, struct ct_softc *sc, struct hpibbus_attach_args *ha)
|
||||
{
|
||||
struct ct_describe desc;
|
||||
u_char stat, cmd[3];
|
||||
@ -310,7 +309,7 @@ ctident(struct device *parent, struct ct_softc *sc,
|
||||
if (sc != NULL) {
|
||||
sc->sc_type = type;
|
||||
sc->sc_flags = canstream ? CTF_CANSTREAM : 0;
|
||||
printf(": %s %stape\n", ctinfo[id].desc,
|
||||
aprint_normal(": %s %stape\n", ctinfo[id].desc,
|
||||
canstream ? "streaming " : "");
|
||||
}
|
||||
|
||||
@ -321,9 +320,9 @@ static void
|
||||
ctreset(struct ct_softc *sc)
|
||||
{
|
||||
int ctlr, slave;
|
||||
u_char stat;
|
||||
uint8_t stat;
|
||||
|
||||
ctlr = device_unit(device_parent(&sc->sc_dev));
|
||||
ctlr = device_unit(device_parent(sc->sc_dev));
|
||||
slave = sc->sc_slave;
|
||||
|
||||
sc->sc_clear.unit = C_SUNIT(sc->sc_punit);
|
||||
@ -364,18 +363,18 @@ static int
|
||||
ctopen(dev_t dev, int flag, int type, struct lwp *l)
|
||||
{
|
||||
struct ct_softc *sc;
|
||||
u_char stat;
|
||||
uint8_t stat;
|
||||
int cc, ctlr, slave;
|
||||
|
||||
if (UNIT(dev) >= ct_cd.cd_ndevs ||
|
||||
(sc = ct_cd.cd_devs[UNIT(dev)]) == NULL ||
|
||||
(sc = device_private(ct_cd.cd_devs[UNIT(dev)])) == NULL ||
|
||||
(sc->sc_flags & CTF_ALIVE) == 0)
|
||||
return ENXIO;
|
||||
|
||||
if (sc->sc_flags & CTF_OPEN)
|
||||
return EBUSY;
|
||||
|
||||
ctlr = device_unit(device_parent(&sc->sc_dev));
|
||||
ctlr = device_unit(device_parent(sc->sc_dev));
|
||||
slave = sc->sc_slave;
|
||||
|
||||
sc->sc_soptc.unit = C_SUNIT(sc->sc_punit);
|
||||
@ -409,7 +408,7 @@ ctopen(dev_t dev, int flag, int type, struct lwp *l)
|
||||
static int
|
||||
ctclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
{
|
||||
struct ct_softc *sc = ct_cd.cd_devs[UNIT(dev)];
|
||||
struct ct_softc *sc = device_private(ct_cd.cd_devs[UNIT(dev)]);
|
||||
|
||||
if ((sc->sc_flags & (CTF_WRT|CTF_WRTTN)) == (CTF_WRT|CTF_WRTTN) &&
|
||||
(sc->sc_flags & CTF_EOT) == 0 ) { /* XXX return error if EOT ?? */
|
||||
@ -422,8 +421,8 @@ ctclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
#ifdef DEBUG
|
||||
if(ctdebug & CT_BSF)
|
||||
printf("%s: ctclose backup eofs prt %d blk %d\n",
|
||||
sc->sc_dev.dv_xname, sc->sc_eofp,
|
||||
sc->sc_eofs[sc->sc_eofp]);
|
||||
device_xname(sc->sc_dev), sc->sc_eofp,
|
||||
sc->sc_eofs[sc->sc_eofp]);
|
||||
#endif
|
||||
}
|
||||
if ((minor(dev) & CT_NOREW) == 0)
|
||||
@ -440,7 +439,7 @@ ctclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
static void
|
||||
ctcommand(dev_t dev, int cmd, int cnt)
|
||||
{
|
||||
struct ct_softc *sc = ct_cd.cd_devs[UNIT(dev)];
|
||||
struct ct_softc *sc = device_private(ct_cd.cd_devs[UNIT(dev)]);
|
||||
struct buf *bp = &sc->sc_bufstore;
|
||||
struct buf *nbp = 0;
|
||||
|
||||
@ -475,7 +474,7 @@ ctcommand(dev_t dev, int cmd, int cnt)
|
||||
#ifdef DEBUG
|
||||
if (ctdebug & CT_BSF)
|
||||
printf("%s: backup eof pos %d blk %d\n",
|
||||
sc->sc_dev.dv_xname, sc->sc_eofp,
|
||||
device_xname(sc->sc_dev), sc->sc_eofp,
|
||||
sc->sc_eofs[sc->sc_eofp]);
|
||||
#endif
|
||||
}
|
||||
@ -495,7 +494,7 @@ ctstrategy(struct buf *bp)
|
||||
struct ct_softc *sc;
|
||||
|
||||
unit = UNIT(bp->b_dev);
|
||||
sc = ct_cd.cd_devs[unit];
|
||||
sc = device_private(ct_cd.cd_devs[unit]);
|
||||
|
||||
s = splbio();
|
||||
BUFQ_PUT(sc->sc_tab, bp);
|
||||
@ -514,7 +513,7 @@ ctustart(struct ct_softc *sc)
|
||||
bp = BUFQ_PEEK(sc->sc_tab);
|
||||
sc->sc_addr = bp->b_data;
|
||||
sc->sc_resid = bp->b_bcount;
|
||||
if (hpibreq(device_parent(&sc->sc_dev), &sc->sc_hq))
|
||||
if (hpibreq(device_parent(sc->sc_dev), &sc->sc_hq))
|
||||
ctstart(sc);
|
||||
}
|
||||
|
||||
@ -525,7 +524,7 @@ ctstart(void *arg)
|
||||
struct buf *bp;
|
||||
int i, ctlr, slave;
|
||||
|
||||
ctlr = device_unit(device_parent(&sc->sc_dev));
|
||||
ctlr = device_unit(device_parent(sc->sc_dev));
|
||||
slave = sc->sc_slave;
|
||||
|
||||
bp = BUFQ_PEEK(sc->sc_tab);
|
||||
@ -569,7 +568,7 @@ ctstart(void *arg)
|
||||
#ifdef DEBUG
|
||||
if(ctdebug & CT_BSF)
|
||||
printf("%s: clearing eofs\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
#endif
|
||||
for (i=0; i<EOFS; i++)
|
||||
sc->sc_eofs[i] = 0;
|
||||
@ -640,7 +639,7 @@ ctgo(void *arg)
|
||||
|
||||
bp = BUFQ_PEEK(sc->sc_tab);
|
||||
rw = bp->b_flags & B_READ;
|
||||
hpibgo(device_unit(device_parent(&sc->sc_dev)), sc->sc_slave, C_EXEC,
|
||||
hpibgo(device_unit(device_parent(sc->sc_dev)), sc->sc_slave, C_EXEC,
|
||||
sc->sc_addr, sc->sc_resid, rw, rw != 0);
|
||||
}
|
||||
|
||||
@ -723,16 +722,16 @@ ctintr(void *arg)
|
||||
{
|
||||
struct ct_softc *sc = arg;
|
||||
struct buf *bp;
|
||||
u_char stat;
|
||||
uint8_t stat;
|
||||
int ctlr, slave, unit;
|
||||
|
||||
ctlr = device_unit(device_parent(&sc->sc_dev));
|
||||
ctlr = device_unit(device_parent(sc->sc_dev));
|
||||
slave = sc->sc_slave;
|
||||
unit = device_unit(&sc->sc_dev);
|
||||
unit = device_unit(sc->sc_dev);
|
||||
|
||||
bp = BUFQ_PEEK(sc->sc_tab);
|
||||
if (bp == NULL) {
|
||||
printf("%s: bp == NULL\n", sc->sc_dev.dv_xname);
|
||||
printf("%s: bp == NULL\n", device_xname(sc->sc_dev));
|
||||
return;
|
||||
}
|
||||
if (sc->sc_flags & CTF_IO) {
|
||||
@ -785,21 +784,21 @@ ctintr(void *arg)
|
||||
if (sc->sc_stat.c_aef & 0x5800) {
|
||||
if (sc->sc_stat.c_aef & 0x4000)
|
||||
tprintf(sc->sc_tpr,
|
||||
"%s: uninitialized media\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
"%s: uninitialized media\n",
|
||||
device_xname(sc->sc_dev));
|
||||
if (sc->sc_stat.c_aef & 0x1000)
|
||||
tprintf(sc->sc_tpr,
|
||||
"%s: not ready\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
"%s: not ready\n",
|
||||
device_xname(sc->sc_dev));
|
||||
if (sc->sc_stat.c_aef & 0x0800)
|
||||
tprintf(sc->sc_tpr,
|
||||
"%s: write protect\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
"%s: write protect\n",
|
||||
device_xname(sc->sc_dev));
|
||||
} else {
|
||||
printf("%s err: v%d u%d ru%d bn%ld, ",
|
||||
sc->sc_dev.dv_xname,
|
||||
(sc->sc_stat.c_vu>>4)&0xF,
|
||||
sc->sc_stat.c_vu&0xF,
|
||||
device_xname(sc->sc_dev),
|
||||
(sc->sc_stat.c_vu >> 4) & 0xF,
|
||||
sc->sc_stat.c_vu & 0xF,
|
||||
sc->sc_stat.c_pend,
|
||||
sc->sc_stat.c_blk);
|
||||
printf("R0x%x F0x%x A0x%x I0x%x\n",
|
||||
@ -810,7 +809,7 @@ ctintr(void *arg)
|
||||
}
|
||||
} else
|
||||
printf("%s: request status failed\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
bp->b_error = EIO;
|
||||
goto done;
|
||||
} else
|
||||
@ -866,7 +865,7 @@ ctdone(struct ct_softc *sc, struct buf *bp)
|
||||
|
||||
(void)BUFQ_GET(sc->sc_tab);
|
||||
biodone(bp);
|
||||
hpibfree(device_parent(&sc->sc_dev), &sc->sc_hq);
|
||||
hpibfree(device_parent(sc->sc_dev), &sc->sc_hq);
|
||||
if (BUFQ_PEEK(sc->sc_tab) == NULL) {
|
||||
sc->sc_active = 0;
|
||||
return;
|
||||
@ -947,7 +946,7 @@ ctaddeof(struct ct_softc *sc)
|
||||
#ifdef DEBUG
|
||||
if (ctdebug & CT_BSF)
|
||||
printf("%s: add eof pos %d blk %d\n",
|
||||
sc->sc_dev.dv_xname, sc->sc_eofp,
|
||||
device_xname(sc->sc_dev), sc->sc_eofp,
|
||||
sc->sc_eofs[sc->sc_eofp]);
|
||||
#endif
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dcm.c,v 1.78 2007/11/19 18:51:39 ad Exp $ */
|
||||
/* $NetBSD: dcm.c,v 1.79 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -123,7 +123,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dcm.c,v 1.78 2007/11/19 18:51:39 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dcm.c,v 1.79 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include "opt_kgdb.h"
|
||||
|
||||
@ -282,7 +282,7 @@ static const char iconv[16] = {
|
||||
#define NDCMPORT 4
|
||||
|
||||
struct dcm_softc {
|
||||
struct device sc_dev; /* generic device glue */
|
||||
device_t sc_dev; /* generic device glue */
|
||||
|
||||
bus_space_tag_t sc_bst;
|
||||
bus_space_handle_t sc_bsh;
|
||||
@ -334,10 +334,10 @@ static void dcmcnputc(dev_t, int);
|
||||
|
||||
int dcmcnattach(bus_space_tag_t, bus_addr_t, int);
|
||||
|
||||
static int dcmmatch(struct device *, struct cfdata *, void *);
|
||||
static void dcmattach(struct device *, struct device *, void *);
|
||||
static int dcmmatch(device_t, cfdata_t, void *);
|
||||
static void dcmattach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(dcm, sizeof(struct dcm_softc),
|
||||
CFATTACH_DECL_NEW(dcm, sizeof(struct dcm_softc),
|
||||
dcmmatch, dcmattach, NULL, NULL);
|
||||
|
||||
/*
|
||||
@ -346,7 +346,9 @@ CFATTACH_DECL(dcm, sizeof(struct dcm_softc),
|
||||
*/
|
||||
static struct dcmdevice *dcm_cn = NULL; /* pointer to hardware */
|
||||
static int dcmconsinit; /* has been initialized */
|
||||
/* static int dcm_lastcnpri = CN_DEAD; */ /* XXX last priority */
|
||||
#if 0
|
||||
static int dcm_lastcnpri = CN_DEAD; /* XXX last priority */
|
||||
#endif
|
||||
|
||||
static struct consdev dcm_cons = {
|
||||
NULL,
|
||||
@ -379,7 +381,7 @@ const struct cdevsw dcm_cdevsw = {
|
||||
};
|
||||
|
||||
static int
|
||||
dcmmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
dcmmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct dio_attach_args *da = aux;
|
||||
|
||||
@ -393,15 +395,16 @@ dcmmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
dcmattach(struct device *parent, struct device *self, void *aux)
|
||||
dcmattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct dcm_softc *sc = (struct dcm_softc *)self;
|
||||
struct dcm_softc *sc = device_private(self);
|
||||
struct dio_attach_args *da = aux;
|
||||
struct dcmdevice *dcm;
|
||||
int brd = device_unit(self);
|
||||
int scode = da->da_scode;
|
||||
int i, mbits, code;
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_flags = 0;
|
||||
|
||||
if (scode == dcmconscode) {
|
||||
@ -414,17 +417,15 @@ dcmattach(struct device *parent, struct device *self, void *aux)
|
||||
* Note that we always assume port 1 on the board.
|
||||
*/
|
||||
cn_tab->cn_dev = makedev(cdevsw_lookup_major(&dcm_cdevsw),
|
||||
(brd << 2) | DCMCONSPORT);
|
||||
(brd << 2) | DCMCONSPORT);
|
||||
} else {
|
||||
sc->sc_bst = da->da_bst;
|
||||
if (bus_space_map(sc->sc_bst, da->da_addr, da->da_size,
|
||||
BUS_SPACE_MAP_LINEAR, &sc->sc_bsh)) {
|
||||
printf("\n%s: can't map registers\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error(": can't map registers\n");
|
||||
return;
|
||||
}
|
||||
dcm = (struct dcmdevice *)bus_space_vaddr(sc->sc_bst,
|
||||
sc->sc_bsh);
|
||||
dcm = bus_space_vaddr(sc->sc_bst, sc->sc_bsh);
|
||||
}
|
||||
|
||||
sc->sc_dcm = dcm;
|
||||
@ -434,7 +435,8 @@ dcmattach(struct device *parent, struct device *self, void *aux)
|
||||
* autoconfig messages.
|
||||
*/
|
||||
if ((sc->sc_flags & DCM_ISCONSOLE) && dcmselftest(sc)) {
|
||||
printf("\n%s: self-test failed\n", sc->sc_dev.dv_xname);
|
||||
aprint_normal("\n");
|
||||
aprint_error_dev(self, "self-test failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -446,7 +448,7 @@ dcmattach(struct device *parent, struct device *self, void *aux)
|
||||
sc->sc_flags |= DCM_ACTIVE;
|
||||
|
||||
/* Establish the interrupt handler. */
|
||||
(void) dio_intr_establish(dcmintr, sc, da->da_ipl, IPL_TTY);
|
||||
(void)dio_intr_establish(dcmintr, sc, da->da_ipl, IPL_TTY);
|
||||
|
||||
if (dcmistype == DIS_TIMER)
|
||||
dcmsetischeme(brd, DIS_RESET|DIS_TIMER);
|
||||
@ -488,9 +490,9 @@ dcmattach(struct device *parent, struct device *self, void *aux)
|
||||
if (sc->sc_flags & DCM_ISCONSOLE) {
|
||||
dcmconsinit = 0;
|
||||
sc->sc_softCAR |= (1 << DCMCONSPORT);
|
||||
printf(": console on port %d\n", DCMCONSPORT);
|
||||
aprint_normal(": console on port %d\n", DCMCONSPORT);
|
||||
} else
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
#ifdef KGDB
|
||||
if (cdevsw_lookup(kgdb_dev) == &dcm_cdevsw &&
|
||||
@ -506,12 +508,12 @@ dcmattach(struct device *parent, struct device *self, void *aux)
|
||||
dcminit(dcm, DCMPORT(DCMUNIT(kgdb_dev)),
|
||||
kgdb_rate);
|
||||
if (kgdb_debug_init) {
|
||||
printf("%s port %d: ", sc->sc_dev.dv_xname,
|
||||
aprint_normal_dev(self, "port %d: ",
|
||||
DCMPORT(DCMUNIT(kgdb_dev)));
|
||||
kgdb_connect(1);
|
||||
} else
|
||||
printf("%s port %d: kgdb enabled\n",
|
||||
sc->sc_dev.dv_xname,
|
||||
aprint_normal_dev(self,
|
||||
"port %d: kgdb enabled\n",
|
||||
DCMPORT(DCMUNIT(kgdb_dev)));
|
||||
}
|
||||
/* end could be replaced */
|
||||
@ -534,7 +536,7 @@ dcmopen(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
port = DCMPORT(unit);
|
||||
|
||||
if (brd >= dcm_cd.cd_ndevs || port >= NDCMPORT ||
|
||||
(sc = dcm_cd.cd_devs[brd]) == NULL)
|
||||
(sc = device_private(dcm_cd.cd_devs[brd])) == NULL)
|
||||
return ENXIO;
|
||||
|
||||
if ((sc->sc_flags & DCM_ACTIVE) == 0)
|
||||
@ -591,8 +593,8 @@ dcmopen(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & DDB_MODEM)
|
||||
printf("%s: dcmopen port %d softcarr %c\n",
|
||||
sc->sc_dev.dv_xname, port,
|
||||
(tp->t_state & TS_CARR_ON) ? '1' : '0');
|
||||
device_xname(sc->sc_dev), port,
|
||||
(tp->t_state & TS_CARR_ON) ? '1' : '0');
|
||||
#endif
|
||||
|
||||
error = ttyopen(tp, DCMDIALOUT(dev), (flag & O_NONBLOCK));
|
||||
@ -602,7 +604,7 @@ dcmopen(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & DDB_OPENCLOSE)
|
||||
printf("%s port %d: dcmopen: st %x fl %x\n",
|
||||
sc->sc_dev.dv_xname, port, tp->t_state, tp->t_flags);
|
||||
device_xname(sc->sc_dev), port, tp->t_state, tp->t_flags);
|
||||
#endif
|
||||
error = (*tp->t_linesw->l_open)(dev, tp);
|
||||
|
||||
@ -622,7 +624,7 @@ dcmclose(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
board = DCMBOARD(unit);
|
||||
port = DCMPORT(unit);
|
||||
|
||||
sc = dcm_cd.cd_devs[board];
|
||||
sc = device_private(dcm_cd.cd_devs[board]);
|
||||
tp = sc->sc_tty[port];
|
||||
|
||||
(*tp->t_linesw->l_close)(tp, flag);
|
||||
@ -635,7 +637,7 @@ dcmclose(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & DDB_OPENCLOSE)
|
||||
printf("%s port %d: dcmclose: st %x fl %x\n",
|
||||
sc->sc_dev.dv_xname, port, tp->t_state, tp->t_flags);
|
||||
device_xname(sc->sc_dev), port, tp->t_state, tp->t_flags);
|
||||
#endif
|
||||
splx(s);
|
||||
ttyclose(tp);
|
||||
@ -658,7 +660,7 @@ dcmread(dev_t dev, struct uio *uio, int flag)
|
||||
board = DCMBOARD(unit);
|
||||
port = DCMPORT(unit);
|
||||
|
||||
sc = dcm_cd.cd_devs[board];
|
||||
sc = device_private(dcm_cd.cd_devs[board]);
|
||||
tp = sc->sc_tty[port];
|
||||
|
||||
return (*tp->t_linesw->l_read)(tp, uio, flag);
|
||||
@ -675,7 +677,7 @@ dcmwrite(dev_t dev, struct uio *uio, int flag)
|
||||
board = DCMBOARD(unit);
|
||||
port = DCMPORT(unit);
|
||||
|
||||
sc = dcm_cd.cd_devs[board];
|
||||
sc = device_private(dcm_cd.cd_devs[board]);
|
||||
tp = sc->sc_tty[port];
|
||||
|
||||
return (*tp->t_linesw->l_write)(tp, uio, flag);
|
||||
@ -692,7 +694,7 @@ dcmpoll(dev_t dev, int events, struct lwp *l)
|
||||
board = DCMBOARD(unit);
|
||||
port = DCMPORT(unit);
|
||||
|
||||
sc = dcm_cd.cd_devs[board];
|
||||
sc = device_private(dcm_cd.cd_devs[board]);
|
||||
tp = sc->sc_tty[port];
|
||||
|
||||
return (*tp->t_linesw->l_poll)(tp, events, l);
|
||||
@ -708,7 +710,7 @@ dcmtty(dev_t dev)
|
||||
board = DCMBOARD(unit);
|
||||
port = DCMPORT(unit);
|
||||
|
||||
sc = dcm_cd.cd_devs[board];
|
||||
sc = device_private(dcm_cd.cd_devs[board]);
|
||||
|
||||
return sc->sc_tty[port];
|
||||
}
|
||||
@ -719,7 +721,7 @@ dcmintr(void *arg)
|
||||
struct dcm_softc *sc = arg;
|
||||
struct dcmdevice *dcm = sc->sc_dcm;
|
||||
struct dcmischeme *dis = &sc->sc_scheme;
|
||||
int brd = device_unit(&sc->sc_dev);
|
||||
int brd = device_unit(sc->sc_dev);
|
||||
int code, i;
|
||||
int pcnd[4], mcode, mcnd[4];
|
||||
|
||||
@ -749,10 +751,10 @@ dcmintr(void *arg)
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & DDB_INTR) {
|
||||
printf("%s: dcmintr: iir %x pc %x/%x/%x/%x ",
|
||||
sc->sc_dev.dv_xname, code, pcnd[0], pcnd[1],
|
||||
pcnd[2], pcnd[3]);
|
||||
device_xname(sc->sc_dev), code, pcnd[0], pcnd[1],
|
||||
pcnd[2], pcnd[3]);
|
||||
printf("miir %x mc %x/%x/%x/%x\n",
|
||||
mcode, mcnd[0], mcnd[1], mcnd[2], mcnd[3]);
|
||||
mcode, mcnd[0], mcnd[1], mcnd[2], mcnd[3]);
|
||||
}
|
||||
#endif
|
||||
if (code & IIR_TIMEO)
|
||||
@ -896,10 +898,11 @@ dcmreadbuf(struct dcm_softc *sc, int port)
|
||||
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & DDB_INPUT)
|
||||
printf("%s port %d: dcmreadbuf: c%x('%c') s%x f%x h%x t%x\n",
|
||||
sc->sc_dev.dv_xname, port,
|
||||
c&0xFF, c, stat&0xFF,
|
||||
tp->t_flags, head, pp->r_tail);
|
||||
printf("%s port %d: "
|
||||
"dcmreadbuf: c%x('%c') s%x f%x h%x t%x\n",
|
||||
device_xname(sc->sc_dev), port,
|
||||
c&0xFF, c, stat&0xFF,
|
||||
tp->t_flags, head, pp->r_tail);
|
||||
#endif
|
||||
/*
|
||||
* Check for and handle errors
|
||||
@ -907,9 +910,10 @@ dcmreadbuf(struct dcm_softc *sc, int port)
|
||||
if (stat & RD_MASK) {
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & (DDB_INPUT|DDB_SIOERR))
|
||||
printf("%s port %d: dcmreadbuf: err: c%x('%c') s%x\n",
|
||||
sc->sc_dev.dv_xname, port,
|
||||
stat, c&0xFF, c);
|
||||
printf("%s port %d: "
|
||||
"dcmreadbuf: err: c%x('%c') s%x\n",
|
||||
device_xname(sc->sc_dev), port,
|
||||
stat, c&0xFF, c);
|
||||
#endif
|
||||
if (stat & (RD_BD | RD_FE))
|
||||
c |= TTY_FE;
|
||||
@ -918,11 +922,11 @@ dcmreadbuf(struct dcm_softc *sc, int port)
|
||||
else if (stat & RD_OVF)
|
||||
log(LOG_WARNING,
|
||||
"%s port %d: silo overflow\n",
|
||||
sc->sc_dev.dv_xname, port);
|
||||
device_xname(sc->sc_dev), port);
|
||||
else if (stat & RD_OE)
|
||||
log(LOG_WARNING,
|
||||
"%s port %d: uart overflow\n",
|
||||
sc->sc_dev.dv_xname, port);
|
||||
device_xname(sc->sc_dev), port);
|
||||
}
|
||||
(*tp->t_linesw->l_rint)(c, tp);
|
||||
}
|
||||
@ -962,7 +966,8 @@ dcmmint(struct dcm_softc *sc, int port, int mcnd)
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & DDB_MODEM)
|
||||
printf("%s port %d: dcmmint: mcnd %x mcndlast %x\n",
|
||||
sc->sc_dev.dv_xname, port, mcnd, sc->sc_mcndlast[port]);
|
||||
device_xname(sc->sc_dev), port, mcnd,
|
||||
sc->sc_mcndlast[port]);
|
||||
#endif
|
||||
delta = mcnd ^ sc->sc_mcndlast[port];
|
||||
sc->sc_mcndlast[port] = mcnd;
|
||||
@ -1005,14 +1010,14 @@ dcmioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
|
||||
port = DCMPORT(unit);
|
||||
board = DCMBOARD(unit);
|
||||
|
||||
sc = dcm_cd.cd_devs[board];
|
||||
sc = device_private(dcm_cd.cd_devs[board]);
|
||||
dcm = sc->sc_dcm;
|
||||
tp = sc->sc_tty[port];
|
||||
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & DDB_IOCTL)
|
||||
printf("%s port %d: dcmioctl: cmd %lx data %x flag %x\n",
|
||||
sc->sc_dev.dv_xname, port, cmd, *data, flag);
|
||||
device_xname(sc->sc_dev), port, cmd, *(int *)data, flag);
|
||||
#endif
|
||||
|
||||
error = (*tp->t_linesw->l_ioctl)(tp, cmd, data, flag, l);
|
||||
@ -1120,7 +1125,7 @@ dcmparam(struct tty *tp, struct termios *t)
|
||||
board = DCMBOARD(unit);
|
||||
port = DCMPORT(unit);
|
||||
|
||||
sc = dcm_cd.cd_devs[board];
|
||||
sc = device_private(dcm_cd.cd_devs[board]);
|
||||
dcm = sc->sc_dcm;
|
||||
|
||||
/* check requested parameters */
|
||||
@ -1158,9 +1163,10 @@ dcmparam(struct tty *tp, struct termios *t)
|
||||
mode |= LC_1STOP;
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & DDB_PARAM)
|
||||
printf("%s port %d: dcmparam: cflag %x mode %x speed %d uperch %d\n",
|
||||
sc->sc_dev.dv_xname, port, cflag, mode, tp->t_ospeed,
|
||||
DCM_USPERCH(tp->t_ospeed));
|
||||
printf("%s port %d: "
|
||||
"dcmparam: cflag %x mode %x speed %d uperch %d\n",
|
||||
device_xname(sc->sc_dev), port, cflag, mode, tp->t_ospeed,
|
||||
DCM_USPERCH(tp->t_ospeed));
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -1206,7 +1212,7 @@ dcmstart(struct tty *tp)
|
||||
board = DCMBOARD(unit);
|
||||
port = DCMPORT(unit);
|
||||
|
||||
sc = dcm_cd.cd_devs[board];
|
||||
sc = device_private(dcm_cd.cd_devs[board]);
|
||||
dcm = sc->sc_dcm;
|
||||
|
||||
s = spltty();
|
||||
@ -1216,8 +1222,8 @@ dcmstart(struct tty *tp)
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & DDB_OUTPUT)
|
||||
printf("%s port %d: dcmstart: state %x flags %x outcc %d\n",
|
||||
sc->sc_dev.dv_xname, port, tp->t_state, tp->t_flags,
|
||||
tp->t_outq.c_cc);
|
||||
device_xname(sc->sc_dev), port, tp->t_state, tp->t_flags,
|
||||
tp->t_outq.c_cc);
|
||||
#endif
|
||||
if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
|
||||
goto out;
|
||||
@ -1291,7 +1297,8 @@ again:
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & DDB_INTR)
|
||||
printf("%s port %d: dcmstart: head %x tail %x outqcc %d\n",
|
||||
sc->sc_dev.dv_xname, port, head, tail, tp->t_outq.c_cc);
|
||||
device_xname(sc->sc_dev), port, head, tail,
|
||||
tp->t_outq.c_cc);
|
||||
#endif
|
||||
out:
|
||||
#ifdef DCMSTATS
|
||||
@ -1335,13 +1342,13 @@ dcmmctl(dev_t dev, int bits, int how)
|
||||
brd = DCMBOARD(unit);
|
||||
port = DCMPORT(unit);
|
||||
|
||||
sc = dcm_cd.cd_devs[brd];
|
||||
sc = device_private(dcm_cd.cd_devs[brd]);
|
||||
dcm = sc->sc_dcm;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & DDB_MODEM)
|
||||
printf("%s port %d: dcmmctl: bits 0x%x how %x\n",
|
||||
sc->sc_dev.dv_xname, port, bits, how);
|
||||
device_xname(sc->sc_dev), port, bits, how);
|
||||
#endif
|
||||
|
||||
s = spltty();
|
||||
@ -1385,7 +1392,7 @@ dcmmctl(dev_t dev, int bits, int how)
|
||||
static void
|
||||
dcmsetischeme(int brd, int flags)
|
||||
{
|
||||
struct dcm_softc *sc = dcm_cd.cd_devs[brd];
|
||||
struct dcm_softc *sc = device_private(dcm_cd.cd_devs[brd]);
|
||||
struct dcmdevice *dcm = sc->sc_dcm;
|
||||
struct dcmischeme *dis = &sc->sc_scheme;
|
||||
int i;
|
||||
@ -1395,11 +1402,11 @@ dcmsetischeme(int brd, int flags)
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & DDB_INTSCHM)
|
||||
printf("%s: dcmsetischeme(%d): cur %d, ints %d, chars %d\n",
|
||||
sc->sc_dev.dv_xname, perchar, dis->dis_perchar,
|
||||
dis->dis_intr, dis->dis_char);
|
||||
device_xname(sc->sc_dev), perchar, dis->dis_perchar,
|
||||
dis->dis_intr, dis->dis_char);
|
||||
if ((flags & DIS_RESET) == 0 && perchar == dis->dis_perchar) {
|
||||
printf("%s: dcmsetischeme: redundent request %d\n",
|
||||
sc->sc_dev.dv_xname, perchar);
|
||||
device_xname(sc->sc_dev), perchar);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -1512,8 +1519,8 @@ dcmselftest(struct dcm_softc *sc)
|
||||
if (dcm->dcm_stcon != ST_OK) {
|
||||
#if 0
|
||||
if (hd->hp_args->hw_sc != conscode)
|
||||
printf("dcm%d: self test failed: %x\n",
|
||||
brd, dcm->dcm_stcon);
|
||||
aprint_error_dev(sc->sc_dev, "self test failed: %x\n",
|
||||
dcm->dcm_stcon);
|
||||
#endif
|
||||
goto out;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dio.c,v 1.35 2007/03/04 05:59:47 christos Exp $ */
|
||||
/* $NetBSD: dio.c,v 1.36 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dio.c,v 1.35 2007/03/04 05:59:47 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dio.c,v 1.36 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#define _HP300_INTR_H_PRIVATE
|
||||
|
||||
@ -70,23 +70,23 @@ __KERNEL_RCSID(0, "$NetBSD: dio.c,v 1.35 2007/03/04 05:59:47 christos Exp $");
|
||||
#define diocf_scode cf_loc[DIOCF_SCODE]
|
||||
|
||||
struct dio_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
struct bus_space_tag sc_tag;
|
||||
};
|
||||
|
||||
static int dio_scodesize(struct dio_attach_args *);
|
||||
static const char *dio_devinfo(struct dio_attach_args *, char *, size_t);
|
||||
|
||||
static int diomatch(struct device *, struct cfdata *, void *);
|
||||
static void dioattach(struct device *, struct device *, void *);
|
||||
static int diomatch(device_t, cfdata_t, void *);
|
||||
static void dioattach(device_t, device_t, void *);
|
||||
static int dioprint(void *, const char *);
|
||||
static int diosubmatch(struct device *, struct cfdata *, const int *, void *);
|
||||
static int diosubmatch(device_t, cfdata_t, const int *, void *);
|
||||
|
||||
CFATTACH_DECL(dio, sizeof(struct dio_softc),
|
||||
CFATTACH_DECL_NEW(dio, sizeof(struct dio_softc),
|
||||
diomatch, dioattach, NULL, NULL);
|
||||
|
||||
static int
|
||||
diomatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
diomatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
static int dio_matched = 0;
|
||||
|
||||
@ -99,9 +99,9 @@ diomatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
dioattach(struct device *parent, struct device *self, void *aux)
|
||||
dioattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct dio_softc *sc = (struct dio_softc *)self;
|
||||
struct dio_softc *sc = device_private(self);
|
||||
struct dio_attach_args da;
|
||||
bus_addr_t pa;
|
||||
void *va;
|
||||
@ -109,7 +109,8 @@ dioattach(struct device *parent, struct device *self, void *aux)
|
||||
bus_space_handle_t bsh;
|
||||
int scode, scmax, scodesize;
|
||||
|
||||
printf("\n");
|
||||
sc->sc_dev = self;
|
||||
aprint_normal("\n");
|
||||
|
||||
memset(bst, 0, sizeof(struct bus_space_tag));
|
||||
bst->bustype = HP300_BUS_SPACE_DIO;
|
||||
@ -128,8 +129,7 @@ dioattach(struct device *parent, struct device *self, void *aux)
|
||||
*/
|
||||
pa = (bus_addr_t)dio_scodetopa(scode);
|
||||
if (bus_space_map(bst, pa, PAGE_SIZE, 0, &bsh)) {
|
||||
printf("%s: can't map scode %d\n",
|
||||
self->dv_xname, scode);
|
||||
aprint_error_dev(self, "can't map scode %d\n", scode);
|
||||
scode++;
|
||||
continue;
|
||||
}
|
||||
@ -162,14 +162,13 @@ dioattach(struct device *parent, struct device *self, void *aux)
|
||||
|
||||
/* Attach matching device. */
|
||||
config_found_sm_loc(self, "dio", NULL, &da, dioprint,
|
||||
diosubmatch);
|
||||
diosubmatch);
|
||||
scode += scodesize;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
diosubmatch(struct device *parent, struct cfdata *cf,
|
||||
const int *ldesc, void *aux)
|
||||
diosubmatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
|
||||
{
|
||||
struct dio_attach_args *da = aux;
|
||||
|
||||
@ -231,7 +230,7 @@ dio_scodesize(struct dio_attach_args *da)
|
||||
goto foundit;
|
||||
}
|
||||
} else {
|
||||
foundit:
|
||||
foundit:
|
||||
return dio_devdatas[i].dd_nscode;
|
||||
}
|
||||
}
|
||||
@ -240,7 +239,8 @@ dio_scodesize(struct dio_attach_args *da)
|
||||
/*
|
||||
* Device is unknown. Print a warning and assume a default.
|
||||
*/
|
||||
printf("WARNING: select code size unknown for id = 0x%x secid = 0x%x\n",
|
||||
aprint_error("WARNING: select code size unknown "
|
||||
"for id = 0x%x secid = 0x%x\n",
|
||||
da->da_id, da->da_secid);
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dma.c,v 1.38 2007/12/05 12:03:08 tsutsui Exp $ */
|
||||
/* $NetBSD: dma.c,v 1.39 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -72,7 +72,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dma.c,v 1.38 2007/12/05 12:03:08 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dma.c,v 1.39 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include <machine/hp300spu.h> /* XXX param.h includes cpu.h */
|
||||
|
||||
@ -118,7 +118,7 @@ struct dma_channel {
|
||||
};
|
||||
|
||||
struct dma_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
bus_space_tag_t sc_bst;
|
||||
bus_space_handle_t sc_bsh;
|
||||
|
||||
@ -140,10 +140,10 @@ struct dma_softc {
|
||||
#define DMAF_VCFLUSH 0x02
|
||||
#define DMAF_NOINTR 0x04
|
||||
|
||||
static int dmamatch(struct device *, struct cfdata *, void *);
|
||||
static void dmaattach(struct device *, struct device *, void *);
|
||||
static int dmamatch(device_t, cfdata_t, void *);
|
||||
static void dmaattach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(dma, sizeof(struct dma_softc),
|
||||
CFATTACH_DECL_NEW(dma, sizeof(struct dma_softc),
|
||||
dmamatch, dmaattach, NULL, NULL);
|
||||
|
||||
static int dmaintr(void *);
|
||||
@ -168,7 +168,7 @@ long dmalword[NDMACHAN];
|
||||
static struct dma_softc *dma_softc;
|
||||
|
||||
static int
|
||||
dmamatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
dmamatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct intio_attach_args *ia = aux;
|
||||
static int dmafound = 0; /* can only have one */
|
||||
@ -181,26 +181,28 @@ dmamatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
dmaattach(struct device *parent, struct device *self, void *aux)
|
||||
dmaattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct dma_softc *sc = (struct dma_softc *)self;
|
||||
struct dma_softc *sc = device_private(self);
|
||||
struct intio_attach_args *ia = aux;
|
||||
struct dma_channel *dc;
|
||||
struct dmareg *dma;
|
||||
int i;
|
||||
char rev;
|
||||
|
||||
sc->sc_dev = self;
|
||||
|
||||
/* There's just one. */
|
||||
dma_softc = sc;
|
||||
|
||||
sc->sc_bst = ia->ia_bst;
|
||||
if (bus_space_map(sc->sc_bst, ia->ia_iobase, INTIO_DEVSIZE, 0,
|
||||
&sc->sc_bsh)) {
|
||||
printf("%s: can't map registers\n", sc->sc_dev.dv_xname);
|
||||
aprint_error(": can't map registers\n");
|
||||
return;
|
||||
}
|
||||
|
||||
dma = (struct dmareg *)bus_space_vaddr(sc->sc_bst, sc->sc_bsh);
|
||||
dma = bus_space_vaddr(sc->sc_bst, sc->sc_bsh);
|
||||
sc->sc_dmareg = dma;
|
||||
|
||||
/*
|
||||
@ -214,7 +216,8 @@ dmaattach(struct device *parent, struct device *self, void *aux)
|
||||
if (hp300_bus_space_probe(sc->sc_bst, sc->sc_bsh, DMA_ID2, 1) == 0) {
|
||||
rev = 'B';
|
||||
#if !defined(HP320)
|
||||
panic("dmainit: DMA card requires hp320 support");
|
||||
aprint_normal("\n");
|
||||
panic("%s: DMA card requires hp320 support", __func__);
|
||||
#endif
|
||||
} else
|
||||
rev = dma->dma_id[2];
|
||||
@ -239,7 +242,8 @@ dmaattach(struct device *parent, struct device *self, void *aux)
|
||||
break;
|
||||
|
||||
default:
|
||||
panic("dmainit: more than 2 channels?");
|
||||
aprint_normal("\n");
|
||||
panic("%s: more than 2 channels?", __func__);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
}
|
||||
@ -249,7 +253,7 @@ dmaattach(struct device *parent, struct device *self, void *aux)
|
||||
callout_reset(&sc->sc_debug_ch, 30 * hz, dmatimeout, sc);
|
||||
#endif
|
||||
|
||||
printf(": 98620%c, 2 channels, %d-bit DMA\n",
|
||||
aprint_normal(": 98620%c, 2 channels, %d-bit DMA\n",
|
||||
rev, (rev == 'B') ? 16 : 32);
|
||||
|
||||
/*
|
||||
@ -523,7 +527,7 @@ dmago(int unit, char *addr, int count, int flags)
|
||||
if (((dmadebug&DDB_WORD) && (dc->dm_cmd&DMA_WORD)) ||
|
||||
((dmadebug&DDB_LWORD) && (dc->dm_cmd&DMA_LWORD))) {
|
||||
printf("dmago: cmd %x, flags %x\n",
|
||||
dc->dm_cmd, dc->dm_flags);
|
||||
dc->dm_cmd, dc->dm_flags);
|
||||
for (seg = 0; seg <= dc->dm_last; seg++)
|
||||
printf(" %d: %d@%p\n", seg,
|
||||
dc->dm_chain[seg].dc_count,
|
||||
@ -602,8 +606,9 @@ dmaintr(void *arg)
|
||||
if (dmadebug & DDB_IO) {
|
||||
if (((dmadebug&DDB_WORD) && (dc->dm_cmd&DMA_WORD)) ||
|
||||
((dmadebug&DDB_LWORD) && (dc->dm_cmd&DMA_LWORD)))
|
||||
printf("dmaintr: flags %x unit %d stat %x next %d\n",
|
||||
dc->dm_flags, i, stat, dc->dm_cur + 1);
|
||||
printf("dmaintr: flags %x unit %d stat %x "
|
||||
"next %d\n",
|
||||
dc->dm_flags, i, stat, dc->dm_cur + 1);
|
||||
}
|
||||
if (stat & DMA_ARMED)
|
||||
printf("dma channel %d: intr when armed\n", i);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fhpib.c,v 1.37 2007/12/05 12:03:08 tsutsui Exp $ */
|
||||
/* $NetBSD: fhpib.c,v 1.38 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -72,7 +72,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fhpib.c,v 1.37 2007/12/05 12:03:08 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fhpib.c,v 1.38 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -141,7 +141,7 @@ static struct hpib_controller fhpib_controller = {
|
||||
};
|
||||
|
||||
struct fhpib_softc {
|
||||
struct device sc_dev; /* generic device glue */
|
||||
device_t sc_dev; /* generic device glue */
|
||||
struct fhpibdevice *sc_regs; /* device registers */
|
||||
int sc_cmd;
|
||||
struct hpibbus_softc *sc_hpibbus; /* XXX */
|
||||
@ -149,14 +149,14 @@ struct fhpib_softc {
|
||||
struct callout sc_ppwatch_ch;
|
||||
};
|
||||
|
||||
static int fhpibmatch(struct device *, struct cfdata *, void *);
|
||||
static void fhpibattach(struct device *, struct device *, void *);
|
||||
static int fhpibmatch(device_t, cfdata_t, void *);
|
||||
static void fhpibattach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(fhpib, sizeof(struct fhpib_softc),
|
||||
CFATTACH_DECL_NEW(fhpib, sizeof(struct fhpib_softc),
|
||||
fhpibmatch, fhpibattach, NULL, NULL);
|
||||
|
||||
static int
|
||||
fhpibmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
fhpibmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct dio_attach_args *da = aux;
|
||||
|
||||
@ -167,20 +167,21 @@ fhpibmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
fhpibattach(struct device *parent, struct device *self, void *aux)
|
||||
fhpibattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct fhpib_softc *sc = (struct fhpib_softc *)self;
|
||||
struct fhpib_softc *sc = device_private(self);
|
||||
struct dio_attach_args *da = aux;
|
||||
struct hpibdev_attach_args ha;
|
||||
bus_space_handle_t bsh;
|
||||
|
||||
sc->sc_dev = self;
|
||||
if (bus_space_map(da->da_bst, da->da_addr, da->da_size, 0, &bsh)) {
|
||||
printf("\n%s: can't map registers\n", self->dv_xname);
|
||||
aprint_error(": can't map registers\n");
|
||||
return;
|
||||
}
|
||||
sc->sc_regs = bus_space_vaddr(da->da_bst, bsh);
|
||||
|
||||
printf(": %s\n", DIO_DEVICE_DESC_FHPIB);
|
||||
aprint_normal(": %s\n", DIO_DEVICE_DESC_FHPIB);
|
||||
|
||||
/* Establish the interrupt handler. */
|
||||
(void)dio_intr_establish(fhpibintr, sc, da->da_ipl, IPL_BIO);
|
||||
@ -198,8 +199,7 @@ fhpibattach(struct device *parent, struct device *self, void *aux)
|
||||
static void
|
||||
fhpibreset(struct hpibbus_softc *hs)
|
||||
{
|
||||
struct fhpib_softc *sc =
|
||||
(struct fhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct fhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
struct fhpibdevice *hd = sc->sc_regs;
|
||||
|
||||
hd->hpib_cid = 0xFF;
|
||||
@ -221,7 +221,7 @@ fhpibreset(struct hpibbus_softc *hs)
|
||||
#ifdef DEBUG
|
||||
if (fhpibdebug & FDB_DMA)
|
||||
printf("fhpibtype: %s has word DMA\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -241,8 +241,7 @@ fhpibifc(struct fhpibdevice *hd)
|
||||
static int
|
||||
fhpibsend(struct hpibbus_softc *hs, int slave, int sec, void *ptr, int origcnt)
|
||||
{
|
||||
struct fhpib_softc *sc =
|
||||
(struct fhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct fhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
struct fhpibdevice *hd = sc->sc_regs;
|
||||
int cnt = origcnt;
|
||||
int timo;
|
||||
@ -293,7 +292,7 @@ senderr:
|
||||
#ifdef DEBUG
|
||||
if (fhpibdebug & FDB_FAIL) {
|
||||
printf("%s: fhpibsend failed: slave %d, sec %x, ",
|
||||
sc->sc_dev.dv_xname, slave, sec);
|
||||
device_xname(sc->sc_dev), slave, sec);
|
||||
printf("sent %d of %d bytes\n", origcnt-cnt-1, origcnt);
|
||||
}
|
||||
#endif
|
||||
@ -303,8 +302,7 @@ senderr:
|
||||
static int
|
||||
fhpibrecv(struct hpibbus_softc *hs, int slave, int sec, void *ptr, int origcnt)
|
||||
{
|
||||
struct fhpib_softc *sc =
|
||||
(struct fhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct fhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
struct fhpibdevice *hd = sc->sc_regs;
|
||||
int cnt = origcnt;
|
||||
int timo;
|
||||
@ -355,7 +353,7 @@ recvbyteserror:
|
||||
#ifdef DEBUG
|
||||
if (fhpibdebug & FDB_FAIL) {
|
||||
printf("%s: fhpibrecv failed: slave %d, sec %x, ",
|
||||
sc->sc_dev.dv_xname, slave, sec);
|
||||
device_xname(sc->sc_dev), slave, sec);
|
||||
printf("got %d of %d bytes\n", origcnt-cnt-1, origcnt);
|
||||
}
|
||||
#endif
|
||||
@ -366,8 +364,7 @@ static void
|
||||
fhpibgo(struct hpibbus_softc *hs, int slave, int sec, void *ptr, int count,
|
||||
int rw, int timo)
|
||||
{
|
||||
struct fhpib_softc *sc =
|
||||
(struct fhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct fhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
struct fhpibdevice *hd = sc->sc_regs;
|
||||
int i;
|
||||
char *addr = ptr;
|
||||
@ -380,7 +377,7 @@ fhpibgo(struct hpibbus_softc *hs, int slave, int sec, void *ptr, int count,
|
||||
hs->sc_flags |= HPIBF_READ;
|
||||
#ifdef DEBUG
|
||||
else if (hs->sc_flags & HPIBF_READ) {
|
||||
printf("fhpibgo: HPIBF_READ still set\n");
|
||||
printf("%s: HPIBF_READ still set\n", __func__);
|
||||
hs->sc_flags &= ~HPIBF_READ;
|
||||
}
|
||||
#endif
|
||||
@ -411,9 +408,9 @@ fhpibgo(struct hpibbus_softc *hs, int slave, int sec, void *ptr, int count,
|
||||
dmago(hs->sc_dq->dq_chan, addr, count, flags|DMAGO_READ);
|
||||
if (fhpibrecv(hs, slave, sec, 0, 0) < 0) {
|
||||
#ifdef DEBUG
|
||||
printf("fhpibgo: recv failed, retrying...\n");
|
||||
printf("%s: recv failed, retrying...\n", __func__);
|
||||
#endif
|
||||
(void) fhpibrecv(hs, slave, sec, 0, 0);
|
||||
(void)fhpibrecv(hs, slave, sec, 0, 0);
|
||||
}
|
||||
i = hd->hpib_cmd;
|
||||
hd->hpib_cmd = sc->sc_cmd;
|
||||
@ -438,9 +435,9 @@ fhpibgo(struct hpibbus_softc *hs, int slave, int sec, void *ptr, int count,
|
||||
dmago(hs->sc_dq->dq_chan, addr, count, flags);
|
||||
if (fhpibsend(hs, slave, sec, 0, 0) < 0) {
|
||||
#ifdef DEBUG
|
||||
printf("fhpibgo: send failed, retrying...\n");
|
||||
printf("%s: send failed, retrying...\n", __func__);
|
||||
#endif
|
||||
(void) fhpibsend(hs, slave, sec, 0, 0);
|
||||
(void)fhpibsend(hs, slave, sec, 0, 0);
|
||||
}
|
||||
i = hd->hpib_cmd;
|
||||
hd->hpib_cmd = sc->sc_cmd;
|
||||
@ -458,8 +455,7 @@ static void
|
||||
fhpibdmadone(void *arg)
|
||||
{
|
||||
struct hpibbus_softc *hs = arg;
|
||||
struct fhpib_softc *sc =
|
||||
(struct fhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct fhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
int s = splbio();
|
||||
|
||||
if (hs->sc_flags & HPIBF_IO) {
|
||||
@ -485,8 +481,7 @@ fhpibdmadone(void *arg)
|
||||
static void
|
||||
fhpibdone(struct hpibbus_softc *hs)
|
||||
{
|
||||
struct fhpib_softc *sc =
|
||||
(struct fhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct fhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
struct fhpibdevice *hd = sc->sc_regs;
|
||||
char *addr;
|
||||
int cnt;
|
||||
@ -496,9 +491,9 @@ fhpibdone(struct hpibbus_softc *hs)
|
||||
hs->sc_count -= cnt;
|
||||
#ifdef DEBUG
|
||||
if ((fhpibdebug & FDB_DMA) &&
|
||||
fhpibdebugunit == device_unit(&sc->sc_dev))
|
||||
printf("fhpibdone: addr %p cnt %d\n",
|
||||
hs->sc_addr, hs->sc_count);
|
||||
fhpibdebugunit == device_unit(sc->sc_dev))
|
||||
printf("%s: addr %p cnt %d\n",
|
||||
__func__, hs->sc_addr, hs->sc_count);
|
||||
#endif
|
||||
if (hs->sc_flags & HPIBF_READ) {
|
||||
hd->hpib_imask = IM_IDLE | IM_BYTE;
|
||||
@ -541,7 +536,7 @@ fhpibintr(void *arg)
|
||||
if ((fhpibdebug & FDB_FAIL) && (stat0 & IDS_IR) &&
|
||||
(hs->sc_flags & (HPIBF_IO|HPIBF_DONE)) != HPIBF_IO)
|
||||
printf("%s: fhpibintr: bad status %x\n",
|
||||
sc->sc_dev.dv_xname, stat0);
|
||||
device_xname(sc->sc_dev), stat0);
|
||||
/* fhpibbadint[0]++; XXX */
|
||||
#endif
|
||||
return 0;
|
||||
@ -554,8 +549,8 @@ fhpibintr(void *arg)
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if ((fhpibdebug & FDB_DMA) &&
|
||||
fhpibdebugunit == device_unit(&sc->sc_dev))
|
||||
printf("fhpibintr: flags %x\n", hs->sc_flags);
|
||||
fhpibdebugunit == device_unit(sc->sc_dev))
|
||||
printf("%s: flags %x\n", __func__, hs->sc_flags);
|
||||
#endif
|
||||
hq = TAILQ_FIRST(&hs->sc_queue);
|
||||
if (hs->sc_flags & HPIBF_IO) {
|
||||
@ -576,15 +571,15 @@ fhpibintr(void *arg)
|
||||
if ((fhpibdebug & FDB_FAIL) &&
|
||||
doppollint && (stat0 & IM_PPRESP) == 0)
|
||||
printf("%s: fhpibintr: bad intr reg %x\n",
|
||||
sc->sc_dev.dv_xname, stat0);
|
||||
device_xname(sc->sc_dev), stat0);
|
||||
#endif
|
||||
hd->hpib_stat = 0;
|
||||
hd->hpib_imask = 0;
|
||||
#ifdef DEBUG
|
||||
stat0 = fhpibppoll(hs);
|
||||
if ((fhpibdebug & FDB_PPOLL) &&
|
||||
fhpibdebugunit == device_unit(&sc->sc_dev))
|
||||
printf("fhpibintr: got PPOLL status %x\n", stat0);
|
||||
fhpibdebugunit == device_unit(sc->sc_dev))
|
||||
printf("%s: got PPOLL status %x\n", __func__, stat0);
|
||||
if ((stat0 & (0x80 >> hq->hq_slave)) == 0) {
|
||||
/*
|
||||
* XXX give it another shot (68040)
|
||||
@ -594,10 +589,10 @@ fhpibintr(void *arg)
|
||||
stat0 = fhpibppoll(hs);
|
||||
if ((stat0 & (0x80 >> hq->hq_slave)) == 0 &&
|
||||
(fhpibdebug & FDB_PPOLL) &&
|
||||
fhpibdebugunit == device_unit(&sc->sc_dev))
|
||||
printf("fhpibintr: PPOLL: unit %d slave %d stat %x\n",
|
||||
device_unit(&sc->sc_dev), hq->hq_slave,
|
||||
stat0);
|
||||
fhpibdebugunit == device_unit(sc->sc_dev))
|
||||
printf("%s: PPOLL: unit %d slave %d stat %x\n",
|
||||
__func__, device_unit(sc->sc_dev),
|
||||
hq->hq_slave, stat0);
|
||||
}
|
||||
#endif
|
||||
hs->sc_flags &= ~HPIBF_PPOLL;
|
||||
@ -609,8 +604,7 @@ fhpibintr(void *arg)
|
||||
static int
|
||||
fhpibppoll(struct hpibbus_softc *hs)
|
||||
{
|
||||
struct fhpib_softc *sc =
|
||||
(struct fhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct fhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
struct fhpibdevice *hd = sc->sc_regs;
|
||||
int ppoll;
|
||||
|
||||
@ -639,7 +633,7 @@ fhpibwait(struct fhpibdevice *hd, int x)
|
||||
if (timo == 0) {
|
||||
#ifdef DEBUG
|
||||
if (fhpibdebug & FDB_FAIL)
|
||||
printf("fhpibwait(%p, %x) timeout\n", hd, x);
|
||||
printf("%s(%p, %x) timeout\n", __func__, hd, x);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
@ -654,8 +648,7 @@ static void
|
||||
fhpibppwatch(void *arg)
|
||||
{
|
||||
struct hpibbus_softc *hs = arg;
|
||||
struct fhpib_softc *sc =
|
||||
(struct fhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct fhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
struct fhpibdevice *hd = sc->sc_regs;
|
||||
int slave;
|
||||
|
||||
@ -672,9 +665,9 @@ fhpibppwatch(void *arg)
|
||||
return;
|
||||
}
|
||||
if ((fhpibdebug & FDB_PPOLL) &&
|
||||
device_unit(&sc->sc_dev) == fhpibdebugunit)
|
||||
printf("fhpibppwatch: sense request on %s\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_unit(sc->sc_dev) == fhpibdebugunit)
|
||||
printf("%s: sense request on %s\n",
|
||||
__func__, device_xname(sc->sc_dev));
|
||||
#endif
|
||||
hd->hpib_psense = ~slave;
|
||||
hd->hpib_pmask = slave;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: frodo.c,v 1.27 2007/03/04 05:59:47 christos Exp $ */
|
||||
/* $NetBSD: frodo.c,v 1.28 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
|
||||
@ -68,7 +68,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: frodo.c,v 1.27 2007/03/04 05:59:47 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: frodo.c,v 1.28 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#define _HP300_INTR_H_PRIVATE
|
||||
|
||||
@ -98,7 +98,7 @@ struct frodo_interhand {
|
||||
};
|
||||
|
||||
struct frodo_softc {
|
||||
struct device sc_dev; /* generic device glue */
|
||||
device_t sc_dev; /* generic device glue */
|
||||
volatile uint8_t *sc_regs; /* register base */
|
||||
struct frodo_interhand sc_intr[FRODO_NINTR]; /* interrupt handlers */
|
||||
int sc_ipl;
|
||||
@ -107,17 +107,17 @@ struct frodo_softc {
|
||||
struct bus_space_tag sc_tag; /* bus space tag */
|
||||
};
|
||||
|
||||
static int frodomatch(struct device *, struct cfdata *, void *);
|
||||
static void frodoattach(struct device *, struct device *, void *);
|
||||
static int frodomatch(device_t, cfdata_t, void *);
|
||||
static void frodoattach(device_t, device_t, void *);
|
||||
|
||||
static int frodoprint(void *, const char *);
|
||||
static int frodosubmatch(struct device *, struct cfdata *, const int *, void *);
|
||||
static int frodosubmatch(device_t, cfdata_t, const int *, void *);
|
||||
|
||||
static int frodointr(void *);
|
||||
|
||||
static void frodo_imask(struct frodo_softc *, uint16_t, uint16_t);
|
||||
|
||||
CFATTACH_DECL(frodo, sizeof(struct frodo_softc),
|
||||
CFATTACH_DECL_NEW(frodo, sizeof(struct frodo_softc),
|
||||
frodomatch, frodoattach, NULL, NULL);
|
||||
|
||||
static const struct frodo_device frodo_subdevs[] = {
|
||||
@ -129,7 +129,7 @@ static const struct frodo_device frodo_subdevs[] = {
|
||||
};
|
||||
|
||||
static int
|
||||
frodomatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
frodomatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct intio_attach_args *ia = aux;
|
||||
static int frodo_matched = 0;
|
||||
@ -149,20 +149,21 @@ frodomatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
frodoattach(struct device *parent, struct device *self, void *aux)
|
||||
frodoattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct frodo_softc *sc = (struct frodo_softc *)self;
|
||||
struct frodo_softc *sc = device_private(self);
|
||||
struct intio_attach_args *ia = aux;
|
||||
bus_space_tag_t bst = &sc->sc_tag;
|
||||
const struct frodo_device *fd;
|
||||
struct frodo_attach_args fa;
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_regs = (volatile uint8_t *)ia->ia_addr;
|
||||
sc->sc_ipl = ia->ia_ipl;
|
||||
|
||||
if ((FRODO_READ(sc, FRODO_IISR) & FRODO_IISR_SERVICE) == 0)
|
||||
printf(": service mode enabled");
|
||||
printf("\n");
|
||||
aprint_error(": service mode enabled");
|
||||
aprint_normal("\n");
|
||||
|
||||
/* Initialize bus_space_tag_t for frodo */
|
||||
frodo_init_bus_space(bst);
|
||||
@ -214,8 +215,7 @@ frodoattach(struct device *parent, struct device *self, void *aux)
|
||||
}
|
||||
|
||||
static int
|
||||
frodosubmatch(struct device *parent, struct cfdata *cf,
|
||||
const int *ldesc, void *aux)
|
||||
frodosubmatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
|
||||
{
|
||||
struct frodo_attach_args *fa = aux;
|
||||
|
||||
@ -238,20 +238,19 @@ frodoprint(void *aux, const char *pnp)
|
||||
}
|
||||
|
||||
void
|
||||
frodo_intr_establish(struct device *frdev, int (*func)(void *), void *arg,
|
||||
frodo_intr_establish(device_t frdev, int (*func)(void *), void *arg,
|
||||
int line, int priority)
|
||||
{
|
||||
struct frodo_softc *sc = (struct frodo_softc *)frdev;
|
||||
struct frodo_softc *sc = device_private(frdev);
|
||||
struct hp300_intrhand *ih = sc->sc_ih;
|
||||
|
||||
if (line < 0 || line >= FRODO_NINTR) {
|
||||
printf("%s: bad interrupt line %d\n",
|
||||
sc->sc_dev.dv_xname, line);
|
||||
aprint_error_dev(frdev, "bad interrupt line %d\n", line);
|
||||
goto lose;
|
||||
}
|
||||
if (sc->sc_intr[line].ih_fn != NULL) {
|
||||
printf("%s: interrupt line %d already used\n",
|
||||
sc->sc_dev.dv_xname, line);
|
||||
aprint_error_dev(frdev, "interrupt line %d already used\n",
|
||||
line);
|
||||
goto lose;
|
||||
}
|
||||
|
||||
@ -281,15 +280,15 @@ frodo_intr_establish(struct device *frdev, int (*func)(void *), void *arg,
|
||||
}
|
||||
|
||||
void
|
||||
frodo_intr_disestablish(struct device *frdev, int line)
|
||||
frodo_intr_disestablish(device_t frdev, int line)
|
||||
{
|
||||
struct frodo_softc *sc = (struct frodo_softc *)frdev;
|
||||
struct frodo_softc *sc = device_private(frdev);
|
||||
struct hp300_intrhand *ih = sc->sc_ih;
|
||||
int newpri;
|
||||
|
||||
if (sc->sc_intr[line].ih_fn == NULL) {
|
||||
printf("%s: no handler for line %d\n",
|
||||
sc->sc_dev.dv_xname, line);
|
||||
device_xname(sc->sc_dev), line);
|
||||
panic("frodo_intr_disestablish");
|
||||
}
|
||||
|
||||
@ -334,7 +333,7 @@ frodointr(void *arg)
|
||||
if (fih->ih_fn == NULL ||
|
||||
(*fih->ih_fn)(fih->ih_arg) == 0)
|
||||
printf("%s: spurious interrupt on line %d\n",
|
||||
sc->sc_dev.dv_xname, line);
|
||||
device_xname(sc->sc_dev), line);
|
||||
if (taken++ > 100)
|
||||
panic("frodointr: looping!");
|
||||
} while (FRODO_GETPEND(sc) != 0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: frodovar.h,v 1.7 2005/12/11 12:17:13 christos Exp $ */
|
||||
/* $NetBSD: frodovar.h,v 1.8 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -90,7 +90,6 @@ struct frodo_device {
|
||||
#define frodocf_offset cf_loc[FRODOCF_OFFSET]
|
||||
#define FRODO_UNKNOWN_OFFSET FRODOCF_OFFSET_DEFAULT
|
||||
|
||||
void frodo_intr_establish(struct device *, int (*func)(void *),
|
||||
void *, int, int);
|
||||
void frodo_intr_disestablish(struct device *, int);
|
||||
void frodo_intr_establish(device_t, int (*func)(void *), void *, int, int);
|
||||
void frodo_intr_disestablish(device_t, int);
|
||||
void frodo_init_bus_space(bus_space_tag_t);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: grf.c,v 1.63 2008/01/25 20:21:44 oster Exp $ */
|
||||
/* $NetBSD: grf.c,v 1.64 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -83,7 +83,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.63 2008/01/25 20:21:44 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.64 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -120,10 +120,10 @@ __KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.63 2008/01/25 20:21:44 oster Exp $");
|
||||
|
||||
#include "ioconf.h"
|
||||
|
||||
static int grfmatch(struct device *, struct cfdata *, void *);
|
||||
static void grfattach(struct device *, struct device *, void *);
|
||||
static int grfmatch(device_t, cfdata_t, void *);
|
||||
static void grfattach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(grf, sizeof(struct grf_softc),
|
||||
CFATTACH_DECL_NEW(grf, sizeof(struct grf_softc),
|
||||
grfmatch, grfattach, NULL, NULL);
|
||||
|
||||
static dev_type_open(grfopen);
|
||||
@ -153,19 +153,20 @@ int grfdebug = 0;
|
||||
#endif
|
||||
|
||||
static int
|
||||
grfmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
grfmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
grfattach(struct device *parent, struct device *self, void *aux)
|
||||
grfattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct grf_softc *sc = (struct grf_softc *)self;
|
||||
struct grf_softc *sc = device_private(self);
|
||||
struct grfdev_attach_args *ga = aux;
|
||||
|
||||
printf("\n");
|
||||
sc->sc_dev = self;
|
||||
aprint_normal("\n");
|
||||
|
||||
sc->sc_data = ga->ga_data;
|
||||
sc->sc_scode = ga->ga_scode; /* XXX */
|
||||
@ -195,7 +196,7 @@ grfopen(dev_t dev, int flags, int mode, struct lwp *l)
|
||||
int error = 0;
|
||||
|
||||
if (unit >= grf_cd.cd_ndevs ||
|
||||
(sc = grf_cd.cd_devs[unit]) == NULL)
|
||||
(sc = device_private(grf_cd.cd_devs[unit])) == NULL)
|
||||
return ENXIO;
|
||||
|
||||
gp = sc->sc_data;
|
||||
@ -225,7 +226,7 @@ grfclose(dev_t dev, int flags, int mode, struct lwp *l)
|
||||
struct grf_softc *sc;
|
||||
struct grf_data *gp;
|
||||
|
||||
sc = grf_cd.cd_devs[unit];
|
||||
sc = device_private(grf_cd.cd_devs[unit]);
|
||||
|
||||
gp = sc->sc_data;
|
||||
|
||||
@ -245,7 +246,7 @@ grfioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
|
||||
struct grf_data *gp;
|
||||
int error, unit = GRFUNIT(dev);
|
||||
|
||||
sc = grf_cd.cd_devs[unit];
|
||||
sc = device_private(grf_cd.cd_devs[unit]);
|
||||
|
||||
gp = sc->sc_data;
|
||||
|
||||
@ -287,7 +288,7 @@ grfioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
|
||||
static paddr_t
|
||||
grfmmap(dev_t dev, off_t off, int prot)
|
||||
{
|
||||
struct grf_softc *sc = grf_cd.cd_devs[GRFUNIT(dev)];
|
||||
struct grf_softc *sc = device_private(grf_cd.cd_devs[GRFUNIT(dev)]);
|
||||
|
||||
return grfaddr(sc, off);
|
||||
}
|
||||
@ -299,7 +300,7 @@ grfon(dev_t dev/*XXX*/)
|
||||
struct grf_softc *sc;
|
||||
struct grf_data *gp;
|
||||
|
||||
sc = grf_cd.cd_devs[unit];
|
||||
sc = device_private(grf_cd.cd_devs[unit]);
|
||||
gp = sc->sc_data;
|
||||
|
||||
/*
|
||||
@ -320,7 +321,7 @@ grfoff(dev_t dev/*XXX*/)
|
||||
struct grf_data *gp;
|
||||
int error;
|
||||
|
||||
sc = grf_cd.cd_devs[unit];
|
||||
sc = device_private(grf_cd.cd_devs[unit]);
|
||||
gp = sc->sc_data;
|
||||
|
||||
(void) grfunmap(dev, (void *)0, curproc);
|
||||
@ -354,7 +355,7 @@ grfaddr(struct grf_softc *sc, off_t off)
|
||||
int
|
||||
grfmap(dev_t dev, void **addrp, struct proc *p)
|
||||
{
|
||||
struct grf_softc *sc = grf_cd.cd_devs[GRFUNIT(dev)];
|
||||
struct grf_softc *sc = device_private(grf_cd.cd_devs[GRFUNIT(dev)]);
|
||||
struct grf_data *gp = sc->sc_data;
|
||||
int len, error;
|
||||
struct vnode vn;
|
||||
@ -386,7 +387,7 @@ grfmap(dev_t dev, void **addrp, struct proc *p)
|
||||
int
|
||||
grfunmap(dev_t dev, void *addr, struct proc *p)
|
||||
{
|
||||
struct grf_softc *sc = grf_cd.cd_devs[GRFUNIT(dev)];
|
||||
struct grf_softc *sc = device_private(grf_cd.cd_devs[GRFUNIT(dev)]);
|
||||
struct grf_data *gp = sc->sc_data;
|
||||
vsize_t size;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: grf_dv.c,v 1.38 2007/12/31 13:38:48 ad Exp $ */
|
||||
/* $NetBSD: grf_dv.c,v 1.39 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -117,7 +117,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_dv.c,v 1.38 2007/12/31 13:38:48 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_dv.c,v 1.39 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -154,18 +154,18 @@ static int dv_init(struct grf_data *, int, uint8_t *);
|
||||
static int dv_mode(struct grf_data *, int, void *);
|
||||
static void dv_reset(struct dvboxfb *);
|
||||
|
||||
static int dvbox_intio_match(struct device *, struct cfdata *, void *);
|
||||
static void dvbox_intio_attach(struct device *, struct device *, void *);
|
||||
static int dvbox_intio_match(device_t, cfdata_t, void *);
|
||||
static void dvbox_intio_attach(device_t, device_t, void *);
|
||||
|
||||
static int dvbox_dio_match(struct device *, struct cfdata *, void *);
|
||||
static void dvbox_dio_attach(struct device *, struct device *, void *);
|
||||
static int dvbox_dio_match(device_t, cfdata_t, void *);
|
||||
static void dvbox_dio_attach(device_t, device_t, void *);
|
||||
|
||||
int dvboxcnattach(bus_space_tag_t, bus_addr_t, int);
|
||||
|
||||
CFATTACH_DECL(dvbox_intio, sizeof(struct grfdev_softc),
|
||||
CFATTACH_DECL_NEW(dvbox_intio, sizeof(struct grfdev_softc),
|
||||
dvbox_intio_match, dvbox_intio_attach, NULL, NULL);
|
||||
|
||||
CFATTACH_DECL(dvbox_dio, sizeof(struct grfdev_softc),
|
||||
CFATTACH_DECL_NEW(dvbox_dio, sizeof(struct grfdev_softc),
|
||||
dvbox_dio_match, dvbox_dio_attach, NULL, NULL);
|
||||
|
||||
/* DaVinci grf switch */
|
||||
@ -194,7 +194,7 @@ static struct itesw dvbox_itesw = {
|
||||
#endif /* NITE > 0 */
|
||||
|
||||
static int
|
||||
dvbox_intio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
dvbox_intio_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct intio_attach_args *ia = aux;
|
||||
struct grfreg *grf;
|
||||
@ -216,12 +216,14 @@ dvbox_intio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
dvbox_intio_attach(struct device *parent, struct device *self, void *aux)
|
||||
dvbox_intio_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct grfdev_softc *sc = (struct grfdev_softc *)self;
|
||||
struct grfdev_softc *sc = device_private(self);
|
||||
struct intio_attach_args *ia = aux;
|
||||
void *grf;
|
||||
|
||||
sc->sc_dev = self;
|
||||
|
||||
grf = (void *)ia->ia_addr;
|
||||
sc->sc_scode = -1; /* XXX internal i/o */
|
||||
|
||||
@ -230,7 +232,7 @@ dvbox_intio_attach(struct device *parent, struct device *self, void *aux)
|
||||
}
|
||||
|
||||
static int
|
||||
dvbox_dio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
dvbox_dio_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct dio_attach_args *da = aux;
|
||||
|
||||
@ -242,21 +244,21 @@ dvbox_dio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
dvbox_dio_attach(struct device *parent, struct device *self, void *aux)
|
||||
dvbox_dio_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct grfdev_softc *sc = (struct grfdev_softc *)self;
|
||||
struct grfdev_softc *sc = device_private(self);
|
||||
struct dio_attach_args *da = aux;
|
||||
bus_space_handle_t bsh;
|
||||
void *grf;
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_scode = da->da_scode;
|
||||
if (sc->sc_scode == dvconscode)
|
||||
grf = dvconaddr;
|
||||
else {
|
||||
if (bus_space_map(da->da_bst, da->da_addr, da->da_size,
|
||||
0, &bsh)) {
|
||||
printf("%s: can't map framebuffer\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error(": can't map framebuffer\n");
|
||||
return;
|
||||
}
|
||||
grf = bus_space_vaddr(da->da_bst, bsh);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: grf_gb.c,v 1.37 2007/12/31 13:38:48 ad Exp $ */
|
||||
/* $NetBSD: grf_gb.c,v 1.38 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -121,7 +121,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_gb.c,v 1.37 2007/12/31 13:38:48 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_gb.c,v 1.38 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -155,7 +155,7 @@ __KERNEL_RCSID(0, "$NetBSD: grf_gb.c,v 1.37 2007/12/31 13:38:48 ad Exp $");
|
||||
#include "ite.h"
|
||||
|
||||
#define CRTC_DATA_LENGTH 0x0e
|
||||
static u_char crtc_init_data[CRTC_DATA_LENGTH] = {
|
||||
static uint8_t crtc_init_data[CRTC_DATA_LENGTH] = {
|
||||
0x29, 0x20, 0x23, 0x04, 0x30, 0x0b, 0x30,
|
||||
0x30, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
@ -164,18 +164,18 @@ static int gb_init(struct grf_data *gp, int, uint8_t *);
|
||||
static int gb_mode(struct grf_data *gp, int, void *);
|
||||
static void gb_microcode(struct gboxfb *);
|
||||
|
||||
static int gbox_intio_match(struct device *, struct cfdata *, void *);
|
||||
static void gbox_intio_attach(struct device *, struct device *, void *);
|
||||
static int gbox_intio_match(device_t, cfdata_t, void *);
|
||||
static void gbox_intio_attach(device_t, device_t, void *);
|
||||
|
||||
static int gbox_dio_match(struct device *, struct cfdata *, void *);
|
||||
static void gbox_dio_attach(struct device *, struct device *, void *);
|
||||
static int gbox_dio_match(device_t, cfdata_t, void *);
|
||||
static void gbox_dio_attach(device_t, device_t, void *);
|
||||
|
||||
int gboxcnattach(bus_space_tag_t, bus_addr_t, int);
|
||||
|
||||
CFATTACH_DECL(gbox_intio, sizeof(struct grfdev_softc),
|
||||
CFATTACH_DECL_NEW(gbox_intio, sizeof(struct grfdev_softc),
|
||||
gbox_intio_match, gbox_intio_attach, NULL, NULL);
|
||||
|
||||
CFATTACH_DECL(gbox_dio, sizeof(struct grfdev_softc),
|
||||
CFATTACH_DECL_NEW(gbox_dio, sizeof(struct grfdev_softc),
|
||||
gbox_dio_match, gbox_dio_attach, NULL, NULL);
|
||||
|
||||
/* Gatorbox grf switch */
|
||||
@ -204,7 +204,7 @@ static struct itesw gbox_itesw = {
|
||||
#endif /* NITE > 0 */
|
||||
|
||||
static int
|
||||
gbox_intio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
gbox_intio_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct intio_attach_args *ia = aux;
|
||||
struct grfreg *grf;
|
||||
@ -226,12 +226,14 @@ gbox_intio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
gbox_intio_attach(struct device *parent, struct device *self, void *aux)
|
||||
gbox_intio_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct grfdev_softc *sc = (struct grfdev_softc *)self;
|
||||
struct grfdev_softc *sc = device_private(self);
|
||||
struct intio_attach_args *ia = aux;
|
||||
void *grf;
|
||||
|
||||
sc->sc_dev = self;
|
||||
|
||||
grf = (void *)ia->ia_addr;
|
||||
sc->sc_scode = -1; /* XXX internal i/o */
|
||||
|
||||
@ -240,7 +242,7 @@ gbox_intio_attach(struct device *parent, struct device *self, void *aux)
|
||||
}
|
||||
|
||||
static int
|
||||
gbox_dio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
gbox_dio_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct dio_attach_args *da = aux;
|
||||
|
||||
@ -252,21 +254,21 @@ gbox_dio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
gbox_dio_attach(struct device *parent, struct device *self, void *aux)
|
||||
gbox_dio_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct grfdev_softc *sc = (struct grfdev_softc *)self;
|
||||
struct grfdev_softc *sc = device_private(self);
|
||||
struct dio_attach_args *da = aux;
|
||||
bus_space_handle_t bsh;
|
||||
void *grf;
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_scode = da->da_scode;
|
||||
if (sc->sc_scode == gbconscode)
|
||||
grf = gbconaddr;
|
||||
else {
|
||||
if (bus_space_map(da->da_bst, da->da_addr, da->da_size,
|
||||
0, &bsh)) {
|
||||
printf("%s: can't map framebuffer\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error(": can't map framebuffer\n");
|
||||
return;
|
||||
}
|
||||
grf = bus_space_vaddr(da->da_bst, bsh);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: grf_hy.c,v 1.35 2007/12/31 13:38:49 ad Exp $ */
|
||||
/* $NetBSD: grf_hy.c,v 1.36 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -120,7 +120,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_hy.c,v 1.35 2007/12/31 13:38:49 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_hy.c,v 1.36 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -157,12 +157,12 @@ __KERNEL_RCSID(0, "$NetBSD: grf_hy.c,v 1.35 2007/12/31 13:38:49 ad Exp $");
|
||||
static int hy_init(struct grf_data *gp, int, uint8_t *);
|
||||
static int hy_mode(struct grf_data *gp, int, void *);
|
||||
|
||||
static int hyper_dio_match(struct device *, struct cfdata *, void *);
|
||||
static void hyper_dio_attach(struct device *, struct device *, void *);
|
||||
static int hyper_dio_match(device_t, cfdata_t, void *);
|
||||
static void hyper_dio_attach(device_t, device_t, void *);
|
||||
|
||||
int hypercnattach(bus_space_tag_t, bus_addr_t, int);
|
||||
|
||||
CFATTACH_DECL(hyper_dio, sizeof(struct grfdev_softc),
|
||||
CFATTACH_DECL_NEW(hyper_dio, sizeof(struct grfdev_softc),
|
||||
hyper_dio_match, hyper_dio_attach, NULL, NULL);
|
||||
|
||||
/* Hyperion grf switch */
|
||||
@ -192,7 +192,7 @@ static struct itesw hyper_itesw = {
|
||||
#endif /* NITE > 0 */
|
||||
|
||||
static int
|
||||
hyper_dio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
hyper_dio_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct dio_attach_args *da = aux;
|
||||
|
||||
@ -204,21 +204,21 @@ hyper_dio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
hyper_dio_attach(struct device *parent, struct device *self, void *aux)
|
||||
hyper_dio_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct grfdev_softc *sc = (struct grfdev_softc *)self;
|
||||
struct grfdev_softc *sc = device_private(self);
|
||||
struct dio_attach_args *da = aux;
|
||||
bus_space_handle_t bsh;
|
||||
void *grf;
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_scode = da->da_scode;
|
||||
if (sc->sc_scode == hyperconscode)
|
||||
grf = hyperconaddr;
|
||||
else {
|
||||
if (bus_space_map(da->da_bst, da->da_addr, da->da_size,
|
||||
0, &bsh)) {
|
||||
printf("%s: can't map framebuffer\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error(": can't map framebuffer\n");
|
||||
return;
|
||||
}
|
||||
grf = bus_space_vaddr(da->da_bst, bsh);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: grf_rb.c,v 1.38 2007/12/31 13:38:49 ad Exp $ */
|
||||
/* $NetBSD: grf_rb.c,v 1.39 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -117,7 +117,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_rb.c,v 1.38 2007/12/31 13:38:49 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_rb.c,v 1.39 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -153,18 +153,18 @@ __KERNEL_RCSID(0, "$NetBSD: grf_rb.c,v 1.38 2007/12/31 13:38:49 ad Exp $");
|
||||
static int rb_init(struct grf_data *gp, int, uint8_t *);
|
||||
static int rb_mode(struct grf_data *gp, int, void *);
|
||||
|
||||
static int rbox_intio_match(struct device *, struct cfdata *, void *);
|
||||
static void rbox_intio_attach(struct device *, struct device *, void *);
|
||||
static int rbox_intio_match(device_t, cfdata_t, void *);
|
||||
static void rbox_intio_attach(device_t, device_t, void *);
|
||||
|
||||
static int rbox_dio_match(struct device *, struct cfdata *, void *);
|
||||
static void rbox_dio_attach(struct device *, struct device *, void *);
|
||||
static int rbox_dio_match(device_t, cfdata_t, void *);
|
||||
static void rbox_dio_attach(device_t, device_t, void *);
|
||||
|
||||
int rboxcnattach(bus_space_tag_t, bus_addr_t, int);
|
||||
|
||||
CFATTACH_DECL(rbox_intio, sizeof(struct grfdev_softc),
|
||||
CFATTACH_DECL_NEW(rbox_intio, sizeof(struct grfdev_softc),
|
||||
rbox_intio_match, rbox_intio_attach, NULL, NULL);
|
||||
|
||||
CFATTACH_DECL(rbox_dio, sizeof(struct grfdev_softc),
|
||||
CFATTACH_DECL_NEW(rbox_dio, sizeof(struct grfdev_softc),
|
||||
rbox_dio_match, rbox_dio_attach, NULL, NULL);
|
||||
|
||||
/* Renaissance grf switch */
|
||||
@ -193,7 +193,7 @@ static struct itesw rbox_itesw = {
|
||||
#endif /* NITE > 0 */
|
||||
|
||||
static int
|
||||
rbox_intio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
rbox_intio_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct intio_attach_args *ia = aux;
|
||||
struct grfreg *grf;
|
||||
@ -215,12 +215,14 @@ rbox_intio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
rbox_intio_attach(struct device *parent, struct device *self, void *aux)
|
||||
rbox_intio_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct grfdev_softc *sc = (struct grfdev_softc *)self;
|
||||
struct grfdev_softc *sc = device_private(self);
|
||||
struct intio_attach_args *ia = aux;
|
||||
void *grf;
|
||||
|
||||
sc->sc_dev = self;
|
||||
|
||||
grf = (void *)ia->ia_addr;
|
||||
sc->sc_scode = -1; /* XXX internal i/o */
|
||||
|
||||
@ -229,7 +231,7 @@ rbox_intio_attach(struct device *parent, struct device *self, void *aux)
|
||||
}
|
||||
|
||||
static int
|
||||
rbox_dio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
rbox_dio_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct dio_attach_args *da = aux;
|
||||
|
||||
@ -241,21 +243,21 @@ rbox_dio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
rbox_dio_attach(struct device *parent, struct device *self, void *aux)
|
||||
rbox_dio_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct grfdev_softc *sc = (struct grfdev_softc *)self;
|
||||
struct grfdev_softc *sc = device_private(self);
|
||||
struct dio_attach_args *da = aux;
|
||||
bus_space_handle_t bsh;
|
||||
void *grf;
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_scode = da->da_scode;
|
||||
if (sc->sc_scode == rbconscode)
|
||||
grf = rbconaddr;
|
||||
else {
|
||||
if (bus_space_map(da->da_bst, da->da_addr, da->da_size,
|
||||
0, &bsh)) {
|
||||
printf("%s: can't map framebuffer\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error(": can't map framebuffer\n");
|
||||
return;
|
||||
}
|
||||
grf = bus_space_vaddr(da->da_bst, bsh);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: grf_subr.c,v 1.15 2007/03/04 11:53:21 tsutsui Exp $ */
|
||||
/* $NetBSD: grf_subr.c,v 1.16 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_subr.c,v 1.15 2007/03/04 11:53:21 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_subr.c,v 1.16 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -70,15 +70,13 @@ grfdev_attach(struct grfdev_softc *sc,
|
||||
sc->sc_data = malloc(sizeof(struct grf_data),
|
||||
M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (sc->sc_data == NULL) {
|
||||
printf("\n%s: can't allocate grf data\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error(": can't allocate grf data\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize the framebuffer hardware. */
|
||||
if ((*init)(sc->sc_data, sc->sc_scode, regs) == 0) {
|
||||
printf("\n%s: init failed\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error(": init failed\n");
|
||||
free(sc->sc_data, M_DEVBUF);
|
||||
return;
|
||||
}
|
||||
@ -102,7 +100,7 @@ grfdev_attach(struct grfdev_softc *sc,
|
||||
ga.ga_scode = sc->sc_scode; /* XXX */
|
||||
ga.ga_isconsole = sc->sc_isconsole;
|
||||
ga.ga_data = (void *)sc->sc_data;
|
||||
(void)config_found(&sc->sc_dev, &ga, grfdevprint);
|
||||
(void)config_found(sc->sc_dev, &ga, grfdevprint);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: grf_tc.c,v 1.40 2007/12/31 13:38:49 ad Exp $ */
|
||||
/* $NetBSD: grf_tc.c,v 1.41 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -117,7 +117,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_tc.c,v 1.40 2007/12/31 13:38:49 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: grf_tc.c,v 1.41 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
@ -155,18 +155,18 @@ static int tc_mode(struct grf_data *, int, void *);
|
||||
|
||||
static void topcat_common_attach(struct grfdev_softc *, void *, uint8_t);
|
||||
|
||||
static int topcat_intio_match(struct device *, struct cfdata *, void *);
|
||||
static void topcat_intio_attach(struct device *, struct device *, void *);
|
||||
static int topcat_intio_match(device_t, cfdata_t, void *);
|
||||
static void topcat_intio_attach(device_t, device_t, void *);
|
||||
|
||||
static int topcat_dio_match(struct device *, struct cfdata *, void *);
|
||||
static void topcat_dio_attach(struct device *, struct device *, void *);
|
||||
static int topcat_dio_match(device_t, cfdata_t, void *);
|
||||
static void topcat_dio_attach(device_t, device_t, void *);
|
||||
|
||||
int topcatcnattach(bus_space_tag_t, bus_addr_t, int);
|
||||
|
||||
CFATTACH_DECL(topcat_intio, sizeof(struct grfdev_softc),
|
||||
CFATTACH_DECL_NEW(topcat_intio, sizeof(struct grfdev_softc),
|
||||
topcat_intio_match, topcat_intio_attach, NULL, NULL);
|
||||
|
||||
CFATTACH_DECL(topcat_dio, sizeof(struct grfdev_softc),
|
||||
CFATTACH_DECL_NEW(topcat_dio, sizeof(struct grfdev_softc),
|
||||
topcat_dio_match, topcat_dio_attach, NULL, NULL);
|
||||
|
||||
/* Topcat (bobcat) grf switch */
|
||||
@ -210,7 +210,7 @@ static struct itesw topcat_itesw = {
|
||||
#endif /* NITE > 0 */
|
||||
|
||||
static int
|
||||
topcat_intio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
topcat_intio_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct intio_attach_args *ia = aux;
|
||||
struct grfreg *grf;
|
||||
@ -240,12 +240,14 @@ topcat_intio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
topcat_intio_attach(struct device *parent, struct device *self, void *aux)
|
||||
topcat_intio_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct grfdev_softc *sc = device_private(self);
|
||||
struct intio_attach_args *ia = aux;
|
||||
struct grfdev_softc *sc = (struct grfdev_softc *)self;
|
||||
struct grfreg *grf;
|
||||
|
||||
sc->sc_dev = self;
|
||||
|
||||
grf = (struct grfreg *)ia->ia_addr;
|
||||
sc->sc_scode = -1; /* XXX internal i/o */
|
||||
|
||||
@ -254,7 +256,7 @@ topcat_intio_attach(struct device *parent, struct device *self, void *aux)
|
||||
}
|
||||
|
||||
static int
|
||||
topcat_dio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
topcat_dio_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct dio_attach_args *da = aux;
|
||||
|
||||
@ -275,21 +277,21 @@ topcat_dio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
topcat_dio_attach(struct device *parent, struct device *self, void *aux)
|
||||
topcat_dio_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct grfdev_softc *sc = (struct grfdev_softc *)self;
|
||||
struct grfdev_softc *sc = device_private(self);
|
||||
struct dio_attach_args *da = aux;
|
||||
void *grf;
|
||||
bus_space_handle_t bsh;
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_scode = da->da_scode;
|
||||
if (sc->sc_scode == tcconscode)
|
||||
grf = tcconaddr;
|
||||
else {
|
||||
if (bus_space_map(da->da_bst, da->da_addr, da->da_size, 0,
|
||||
&bsh)) {
|
||||
printf("%s: can't map framebuffer\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error(": can't map framebuffer\n");
|
||||
return;
|
||||
}
|
||||
grf = bus_space_vaddr(da->da_bst, bsh);
|
||||
@ -325,9 +327,8 @@ topcat_common_attach(struct grfdev_softc *sc, void *grf, uint8_t secid)
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
printf("%s: unknown device 0x%x\n",
|
||||
sc->sc_dev.dv_xname, secid);
|
||||
panic("topcat_common_attach");
|
||||
aprint_error(": unknown device 0x%x\n", secid);
|
||||
panic("%s: unknown topcat", __func__);
|
||||
}
|
||||
|
||||
sc->sc_isconsole = (sc->sc_scode == tcconscode);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: grfvar.h,v 1.23 2007/12/31 13:38:49 ad Exp $ */
|
||||
/* $NetBSD: grfvar.h,v 1.24 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -111,14 +111,14 @@ struct grfsw {
|
||||
};
|
||||
|
||||
struct grf_softc {
|
||||
struct device sc_dev; /* generic device info */
|
||||
device_t sc_dev; /* generic device info */
|
||||
int sc_scode; /* select code; for grfdevno() */
|
||||
struct grf_data *sc_data; /* display state information */
|
||||
struct ite_softc *sc_ite; /* pointer to ite; may be NULL */
|
||||
};
|
||||
|
||||
struct grfdev_softc {
|
||||
struct device sc_dev; /* generic device info */
|
||||
device_t sc_dev; /* generic device info */
|
||||
struct grf_data *sc_data; /* generic grf data */
|
||||
int sc_scode; /* select code, -1 for intio */
|
||||
int sc_isconsole; /* device is the console */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hilvar.h,v 1.24 2007/12/31 13:38:49 ad Exp $ */
|
||||
/* $NetBSD: hilvar.h,v 1.25 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -125,22 +125,22 @@ 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; /* */
|
||||
u_char hl_actdev; /* current input device */
|
||||
u_char hl_cmddev; /* device to perform command on */
|
||||
u_char hl_pollbuf[HILBUFSIZE]; /* interrupt time input buffer */
|
||||
u_char hl_cmdbuf[HILBUFSIZE]; /* */
|
||||
u_char *hl_pollbp; /* pointer into hl_pollbuf */
|
||||
u_char *hl_cmdbp; /* pointer into hl_cmdbuf */
|
||||
struct hiliqueue hl_queue[NHILQ]; /* input queues */
|
||||
struct hilloopdev hl_device[NHILD]; /* device data */
|
||||
u_char hl_maxdev; /* number of devices on loop */
|
||||
u_char hl_kbddev; /* keyboard device on loop */
|
||||
u_char hl_kbdlang; /* keyboard language */
|
||||
u_char hl_kbdflags; /* keyboard state */
|
||||
device_t sc_dev;
|
||||
struct hil_dev *sc_addr; /* base of hardware registers */
|
||||
uint8_t sc_cmddone; /* */
|
||||
uint8_t sc_cmdending; /* */
|
||||
uint8_t sc_actdev; /* current input device */
|
||||
uint8_t sc_cmddev; /* device to perform command on */
|
||||
uint8_t sc_pollbuf[HILBUFSIZE]; /* interrupt time input buffer */
|
||||
uint8_t sc_cmdbuf[HILBUFSIZE]; /* */
|
||||
uint8_t *sc_pollbp; /* pointer into hl_pollbuf */
|
||||
uint8_t *sc_cmdbp; /* pointer into hl_cmdbuf */
|
||||
struct hiliqueue sc_queue[NHILQ]; /* input queues */
|
||||
struct hilloopdev sc_device[NHILD]; /* device data */
|
||||
uint8_t sc_maxdev; /* number of devices on loop */
|
||||
uint8_t sc_kbddev; /* keyboard device on loop */
|
||||
uint8_t sc_kbdlang; /* keyboard language */
|
||||
uint8_t sc_kbdflags; /* keyboard state */
|
||||
#if NRND > 0
|
||||
rndsource_element_t rnd_source;
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hpib.c,v 1.35 2007/12/05 12:03:08 tsutsui Exp $ */
|
||||
/* $NetBSD: hpib.c,v 1.36 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -72,7 +72,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: hpib.c,v 1.35 2007/12/05 12:03:08 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: hpib.c,v 1.36 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -89,15 +89,14 @@ __KERNEL_RCSID(0, "$NetBSD: hpib.c,v 1.35 2007/12/05 12:03:08 tsutsui Exp $");
|
||||
|
||||
#include "ioconf.h"
|
||||
|
||||
static int hpibbusmatch(struct device *, struct cfdata *, void *);
|
||||
static void hpibbusattach(struct device *, struct device *, void *);
|
||||
static int hpibbusmatch(device_t, cfdata_t, void *);
|
||||
static void hpibbusattach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(hpibbus, sizeof(struct hpibbus_softc),
|
||||
CFATTACH_DECL_NEW(hpibbus, sizeof(struct hpibbus_softc),
|
||||
hpibbusmatch, hpibbusattach, NULL, NULL);
|
||||
|
||||
static void hpibbus_attach_children(struct hpibbus_softc *);
|
||||
static int hpibbussearch(struct device *, struct cfdata *,
|
||||
const int *, void *);
|
||||
static int hpibbussearch(device_t, cfdata_t, const int *, void *);
|
||||
static int hpibbusprint(void *, const char *);
|
||||
|
||||
static int hpibbus_alloc(struct hpibbus_softc *, int, int);
|
||||
@ -143,19 +142,20 @@ int hpibdmathresh = 3; /* byte count beyond which to attempt dma */
|
||||
*/
|
||||
|
||||
static int
|
||||
hpibbusmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
hpibbusmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
hpibbusattach(struct device *parent, struct device *self, void *aux)
|
||||
hpibbusattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct hpibbus_softc *sc = (struct hpibbus_softc *)self;
|
||||
struct hpibbus_softc *sc = device_private(self);
|
||||
struct hpibdev_attach_args *ha = aux;
|
||||
|
||||
printf("\n");
|
||||
sc->sc_dev = self;
|
||||
aprint_normal("\n");
|
||||
|
||||
/* Get the operations vector for the controller. */
|
||||
sc->sc_ops = ha->ha_ops;
|
||||
@ -170,7 +170,7 @@ hpibbusattach(struct device *parent, struct device *self, void *aux)
|
||||
*/
|
||||
sc->sc_dq = malloc(sizeof(struct dmaqueue), M_DEVBUF, M_NOWAIT);
|
||||
if (sc->sc_dq == NULL) {
|
||||
printf("%s: can't allocate DMA queue entry\n", self->dv_xname);
|
||||
aprint_error_dev(self, "can't allocate DMA queue entry\n");
|
||||
return;
|
||||
}
|
||||
sc->sc_dq->dq_softc = sc;
|
||||
@ -196,7 +196,7 @@ hpibbus_attach_children(struct hpibbus_softc *sc)
|
||||
* Plotters won't identify themselves, and
|
||||
* get the same value as non-existent devices.
|
||||
*/
|
||||
ha.ha_id = hpibid(device_unit(&sc->sc_dev), slave);
|
||||
ha.ha_id = hpibid(device_unit(sc->sc_dev), slave);
|
||||
|
||||
ha.ha_slave = slave; /* not to be modified by children */
|
||||
ha.ha_punit = 0; /* children modify this */
|
||||
@ -204,15 +204,14 @@ hpibbus_attach_children(struct hpibbus_softc *sc)
|
||||
/*
|
||||
* Search though all configured children for this bus.
|
||||
*/
|
||||
config_search_ia(hpibbussearch, &sc->sc_dev, "hpibbus", &ha);
|
||||
config_search_ia(hpibbussearch, sc->sc_dev, "hpibbus", &ha);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
hpibbussearch(struct device *parent, struct cfdata *cf,
|
||||
const int *ldesc, void *aux)
|
||||
hpibbussearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
|
||||
{
|
||||
struct hpibbus_softc *sc = (struct hpibbus_softc *)parent;
|
||||
struct hpibbus_softc *sc = device_private(parent);
|
||||
struct hpibbus_attach_args *ha = aux;
|
||||
|
||||
/* Make sure this is in a consistent state. */
|
||||
@ -269,7 +268,7 @@ hpibdevprint(void *aux, const char *pnp)
|
||||
void
|
||||
hpibreset(int unit)
|
||||
{
|
||||
struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
|
||||
struct hpibbus_softc *sc = device_private(hpibbus_cd.cd_devs[unit]);
|
||||
|
||||
(*sc->sc_ops->hpib_reset)(sc);
|
||||
}
|
||||
@ -277,7 +276,7 @@ hpibreset(int unit)
|
||||
int
|
||||
hpibreq(struct device *pdev, struct hpibqueue *hq)
|
||||
{
|
||||
struct hpibbus_softc *sc = (struct hpibbus_softc *)pdev;
|
||||
struct hpibbus_softc *sc = device_private(pdev);
|
||||
int s;
|
||||
|
||||
s = splhigh(); /* XXXthorpej */
|
||||
@ -293,7 +292,7 @@ hpibreq(struct device *pdev, struct hpibqueue *hq)
|
||||
void
|
||||
hpibfree(struct device *pdev, struct hpibqueue *hq)
|
||||
{
|
||||
struct hpibbus_softc *sc = (struct hpibbus_softc *)pdev;
|
||||
struct hpibbus_softc *sc = device_private(pdev);
|
||||
int s;
|
||||
|
||||
s = splhigh(); /* XXXthorpej */
|
||||
@ -325,7 +324,7 @@ hpibid(int unit, int slave)
|
||||
int
|
||||
hpibsend(int unit, int slave, int sec, void *addr, int cnt)
|
||||
{
|
||||
struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
|
||||
struct hpibbus_softc *sc = device_private(hpibbus_cd.cd_devs[unit]);
|
||||
|
||||
return (*sc->sc_ops->hpib_send)(sc, slave, sec, addr, cnt);
|
||||
}
|
||||
@ -333,7 +332,7 @@ hpibsend(int unit, int slave, int sec, void *addr, int cnt)
|
||||
int
|
||||
hpibrecv(int unit, int slave, int sec, void *addr, int cnt)
|
||||
{
|
||||
struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
|
||||
struct hpibbus_softc *sc = device_private(hpibbus_cd.cd_devs[unit]);
|
||||
|
||||
return (*sc->sc_ops->hpib_recv)(sc, slave, sec, addr, cnt);
|
||||
}
|
||||
@ -341,7 +340,7 @@ hpibrecv(int unit, int slave, int sec, void *addr, int cnt)
|
||||
int
|
||||
hpibpptest(int unit, int slave)
|
||||
{
|
||||
struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
|
||||
struct hpibbus_softc *sc = device_private(hpibbus_cd.cd_devs[unit]);
|
||||
|
||||
return (*sc->sc_ops->hpib_ppoll)(sc) & (0x80 >> slave);
|
||||
}
|
||||
@ -349,7 +348,7 @@ hpibpptest(int unit, int slave)
|
||||
void
|
||||
hpibppclear(int unit)
|
||||
{
|
||||
struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
|
||||
struct hpibbus_softc *sc = device_private(hpibbus_cd.cd_devs[unit]);
|
||||
|
||||
sc->sc_flags &= ~HPIBF_PPOLL;
|
||||
}
|
||||
@ -357,7 +356,7 @@ hpibppclear(int unit)
|
||||
void
|
||||
hpibawait(int unit)
|
||||
{
|
||||
struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
|
||||
struct hpibbus_softc *sc = device_private(hpibbus_cd.cd_devs[unit]);
|
||||
|
||||
sc->sc_flags |= HPIBF_PPOLL;
|
||||
(*sc->sc_ops->hpib_ppwatch)(sc);
|
||||
@ -366,7 +365,7 @@ hpibawait(int unit)
|
||||
int
|
||||
hpibswait(int unit, int slave)
|
||||
{
|
||||
struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
|
||||
struct hpibbus_softc *sc = device_private(hpibbus_cd.cd_devs[unit]);
|
||||
int timo = hpibtimeout;
|
||||
int mask, (*ppoll)(struct hpibbus_softc *);
|
||||
|
||||
@ -374,7 +373,7 @@ hpibswait(int unit, int slave)
|
||||
mask = 0x80 >> slave;
|
||||
while (((*ppoll)(sc) & mask) == 0) {
|
||||
if (--timo == 0) {
|
||||
printf("%s: swait timeout\n", sc->sc_dev.dv_xname);
|
||||
printf("%s: swait timeout\n", device_xname(sc->sc_dev));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -384,7 +383,7 @@ hpibswait(int unit, int slave)
|
||||
int
|
||||
hpibustart(int unit)
|
||||
{
|
||||
struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
|
||||
struct hpibbus_softc *sc = device_private(hpibbus_cd.cd_devs[unit]);
|
||||
|
||||
if (sc->sc_type == HPIBA)
|
||||
sc->sc_dq->dq_chan = DMA0;
|
||||
@ -408,7 +407,7 @@ hpibstart(void *arg)
|
||||
void
|
||||
hpibgo(int unit, int slave, int sec, void *vbuf, int count, int rw, int timo)
|
||||
{
|
||||
struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
|
||||
struct hpibbus_softc *sc = device_private(hpibbus_cd.cd_devs[unit]);
|
||||
|
||||
(*sc->sc_ops->hpib_go)(sc, slave, sec, vbuf, count, rw, timo);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hpibvar.h,v 1.18 2007/03/04 05:59:48 christos Exp $ */
|
||||
/* $NetBSD: hpibvar.h,v 1.19 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -171,7 +171,7 @@ struct dmaqueue;
|
||||
* Software state per HP-IB bus.
|
||||
*/
|
||||
struct hpibbus_softc {
|
||||
struct device sc_dev; /* generic device glue */
|
||||
device_t sc_dev; /* generic device glue */
|
||||
struct hpib_controller *sc_ops; /* controller ops vector */
|
||||
volatile int sc_flags; /* misc flags */
|
||||
struct dmaqueue *sc_dq;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: intio.c,v 1.26 2007/03/04 05:59:48 christos Exp $ */
|
||||
/* $NetBSD: intio.c,v 1.27 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1998, 2001 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.26 2007/03/04 05:59:48 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.27 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -53,15 +53,15 @@ __KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.26 2007/03/04 05:59:48 christos Exp $");
|
||||
#include <hp300/dev/intiovar.h>
|
||||
|
||||
struct intio_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
struct bus_space_tag sc_tag;
|
||||
};
|
||||
|
||||
static int intiomatch(struct device *, struct cfdata *, void *);
|
||||
static void intioattach(struct device *, struct device *, void *);
|
||||
static int intiomatch(device_t, cfdata_t, void *);
|
||||
static void intioattach(device_t, device_t, void *);
|
||||
static int intioprint(void *, const char *);
|
||||
|
||||
CFATTACH_DECL(intio, sizeof(struct intio_softc),
|
||||
CFATTACH_DECL_NEW(intio, sizeof(struct intio_softc),
|
||||
intiomatch, intioattach, NULL, NULL);
|
||||
|
||||
#if defined(HP320) || defined(HP330) || defined(HP340) || defined(HP345) || \
|
||||
@ -103,8 +103,9 @@ static int intio_matched = 0;
|
||||
extern void *internalhpib;
|
||||
|
||||
static int
|
||||
intiomatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
intiomatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
|
||||
/* Allow only one instance. */
|
||||
if (intio_matched)
|
||||
return 0;
|
||||
@ -114,16 +115,17 @@ intiomatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
intioattach(struct device *parent, struct device *self, void *aux)
|
||||
intioattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct intio_softc *sc = (struct intio_softc *)self;
|
||||
struct intio_softc *sc = device_private(self);
|
||||
struct intio_attach_args ia;
|
||||
const struct intio_builtins *ib;
|
||||
bus_space_tag_t bst = &sc->sc_tag;
|
||||
int ndevs;
|
||||
int i;
|
||||
|
||||
printf("\n");
|
||||
sc->sc_dev = self;
|
||||
aprint_normal("\n");
|
||||
|
||||
memset(bst, 0, sizeof(struct bus_space_tag));
|
||||
bst->bustype = HP300_BUS_SPACE_INTIO;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ite.c,v 1.79 2007/11/19 18:51:40 ad Exp $ */
|
||||
/* $NetBSD: ite.c,v 1.80 2008/03/29 06:47:07 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -119,7 +119,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.79 2007/11/19 18:51:40 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.80 2008/03/29 06:47:07 tsutsui Exp $");
|
||||
|
||||
#include "hil.h"
|
||||
|
||||
@ -158,10 +158,10 @@ __KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.79 2007/11/19 18:51:40 ad Exp $");
|
||||
*/
|
||||
int iteburst = 64;
|
||||
|
||||
static int itematch(struct device *, struct cfdata *, void *);
|
||||
static void iteattach(struct device *, struct device *, void *);
|
||||
static int itematch(device_t, cfdata_t, void *);
|
||||
static void iteattach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(ite, sizeof(struct ite_softc),
|
||||
CFATTACH_DECL_NEW(ite, sizeof(struct ite_softc),
|
||||
itematch, iteattach, NULL, NULL);
|
||||
|
||||
/* XXX this has always been global, but shouldn't be */
|
||||
@ -238,36 +238,38 @@ static u_char ite_console_attributes[0x2200];
|
||||
}
|
||||
|
||||
static int
|
||||
itematch(struct device *parent, struct cfdata *match, void *aux)
|
||||
itematch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
iteattach(struct device *parent, struct device *self, void *aux)
|
||||
iteattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct ite_softc *ite = (struct ite_softc *)self;
|
||||
struct grf_softc *grf = (struct grf_softc *)parent;
|
||||
struct ite_softc *ite = device_private(self);
|
||||
struct grf_softc *grf = device_private(parent);
|
||||
struct grfdev_attach_args *ga = aux;
|
||||
|
||||
ite->sc_dev = self;
|
||||
|
||||
/* Allocate the ite_data. */
|
||||
if (ga->ga_isconsole) {
|
||||
ite->sc_data = &ite_cn;
|
||||
printf(": console");
|
||||
aprint_normal(": console");
|
||||
|
||||
/*
|
||||
* We didn't know which unit this would be during
|
||||
* the console probe, so we have to fixup cn_dev here.
|
||||
*/
|
||||
cn_tab->cn_dev = makedev(cdevsw_lookup_major(&ite_cdevsw),
|
||||
device_unit(self));
|
||||
device_unit(self));
|
||||
} else {
|
||||
ite->sc_data = malloc(sizeof(struct ite_data), M_DEVBUF,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (ite->sc_data == NULL) {
|
||||
printf("\n%s: malloc for ite_data failed\n",
|
||||
ite->sc_dev.dv_xname);
|
||||
aprint_normal("\n");
|
||||
aprint_error_dev(self, "malloc for ite_data failed\n");
|
||||
return;
|
||||
}
|
||||
ite->sc_data->flags = ITE_ALIVE;
|
||||
@ -279,7 +281,7 @@ iteattach(struct device *parent, struct device *self, void *aux)
|
||||
ite->sc_grf = grf;
|
||||
grf->sc_ite = ite;
|
||||
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
}
|
||||
|
||||
void
|
||||
@ -391,7 +393,7 @@ iteopen(dev_t dev, int mode, int devtype, struct lwp *l)
|
||||
int first = 0;
|
||||
|
||||
if (unit >= ite_cd.cd_ndevs ||
|
||||
(sc = ite_cd.cd_devs[unit]) == NULL)
|
||||
(sc = device_private(ite_cd.cd_devs[unit])) == NULL)
|
||||
return ENXIO;
|
||||
ip = sc->sc_data;
|
||||
|
||||
@ -434,7 +436,7 @@ iteopen(dev_t dev, int mode, int devtype, struct lwp *l)
|
||||
static int
|
||||
iteclose(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
{
|
||||
struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
|
||||
struct ite_softc *sc = device_private(ite_cd.cd_devs[ITEUNIT(dev)]);
|
||||
struct ite_data *ip = sc->sc_data;
|
||||
struct tty *tp = ip->tty;
|
||||
|
||||
@ -452,7 +454,7 @@ iteclose(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
static int
|
||||
iteread(dev_t dev, struct uio *uio, int flag)
|
||||
{
|
||||
struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
|
||||
struct ite_softc *sc = device_private(ite_cd.cd_devs[ITEUNIT(dev)]);
|
||||
struct tty *tp = sc->sc_data->tty;
|
||||
|
||||
return (*tp->t_linesw->l_read)(tp, uio, flag);
|
||||
@ -461,7 +463,7 @@ iteread(dev_t dev, struct uio *uio, int flag)
|
||||
int
|
||||
itewrite(dev_t dev, struct uio *uio, int flag)
|
||||
{
|
||||
struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
|
||||
struct ite_softc *sc = device_private(ite_cd.cd_devs[ITEUNIT(dev)]);
|
||||
struct tty *tp = sc->sc_data->tty;
|
||||
|
||||
return (*tp->t_linesw->l_write)(tp, uio, flag);
|
||||
@ -470,7 +472,7 @@ itewrite(dev_t dev, struct uio *uio, int flag)
|
||||
int
|
||||
itepoll(dev_t dev, int events, struct lwp *l)
|
||||
{
|
||||
struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
|
||||
struct ite_softc *sc = device_private(ite_cd.cd_devs[ITEUNIT(dev)]);
|
||||
struct tty *tp = sc->sc_data->tty;
|
||||
|
||||
return (*tp->t_linesw->l_poll)(tp, events, l);
|
||||
@ -479,7 +481,7 @@ itepoll(dev_t dev, int events, struct lwp *l)
|
||||
struct tty *
|
||||
itetty(dev_t dev)
|
||||
{
|
||||
struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
|
||||
struct ite_softc *sc = device_private(ite_cd.cd_devs[ITEUNIT(dev)]);
|
||||
|
||||
return sc->sc_data->tty;
|
||||
}
|
||||
@ -487,7 +489,7 @@ itetty(dev_t dev)
|
||||
int
|
||||
iteioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
|
||||
{
|
||||
struct ite_softc *sc = ite_cd.cd_devs[ITEUNIT(dev)];
|
||||
struct ite_softc *sc = device_private(ite_cd.cd_devs[ITEUNIT(dev)]);
|
||||
struct ite_data *ip = sc->sc_data;
|
||||
struct tty *tp = ip->tty;
|
||||
int error;
|
||||
@ -506,7 +508,7 @@ itestart(struct tty *tp)
|
||||
struct ite_softc *sc;
|
||||
struct ite_data *ip;
|
||||
|
||||
sc = ite_cd.cd_devs[ITEUNIT(tp->t_dev)];
|
||||
sc = device_private(ite_cd.cd_devs[ITEUNIT(tp->t_dev)]);
|
||||
ip = sc->sc_data;
|
||||
|
||||
s = splkbd();
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: itevar.h,v 1.26 2007/03/04 11:53:22 tsutsui Exp $ */
|
||||
/* $NetBSD: itevar.h,v 1.27 2008/03/29 06:47:08 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -123,7 +123,7 @@ struct itesw {
|
||||
};
|
||||
|
||||
struct ite_softc {
|
||||
struct device sc_dev; /* generic device info */
|
||||
device_t sc_dev; /* generic device info */
|
||||
struct ite_data *sc_data; /* terminal state info */
|
||||
struct grf_softc *sc_grf; /* pointer to framebuffer */
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mt.c,v 1.41 2008/01/02 11:48:25 ad Exp $ */
|
||||
/* $NetBSD: mt.c,v 1.42 2008/03/29 06:47:08 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -67,7 +67,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.41 2008/01/02 11:48:25 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.42 2008/03/29 06:47:08 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -104,7 +104,7 @@ static const struct mtinfo {
|
||||
static const int nmtinfo = sizeof(mtinfo) / sizeof(mtinfo[0]);
|
||||
|
||||
struct mt_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
struct callout sc_start_ch;
|
||||
struct callout sc_intr_ch;
|
||||
int sc_hpibno; /* logical HPIB this slave it attached to */
|
||||
@ -136,10 +136,10 @@ int mtdebug = 0;
|
||||
#define B_CMD B_DEVPRIVATE /* command buf instead of data */
|
||||
#define b_cmd b_blkno /* blkno holds cmd when B_CMD */
|
||||
|
||||
static int mtmatch(struct device *, struct cfdata *, void *);
|
||||
static void mtattach(struct device *, struct device *, void *);
|
||||
static int mtmatch(device_t, cfdata_t, void *);
|
||||
static void mtattach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(mt, sizeof(struct mt_softc),
|
||||
CFATTACH_DECL_NEW(mt, sizeof(struct mt_softc),
|
||||
mtmatch, mtattach, NULL, NULL);
|
||||
|
||||
static dev_type_open(mtopen);
|
||||
@ -170,7 +170,7 @@ static void mtgo(void *);
|
||||
static void mtintr(void *);
|
||||
|
||||
static int
|
||||
mtmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
mtmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct hpibbus_attach_args *ha = aux;
|
||||
|
||||
@ -178,14 +178,15 @@ mtmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
mtattach(struct device *parent, struct device *self, void *aux)
|
||||
mtattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct mt_softc *sc = (struct mt_softc *)self;
|
||||
struct mt_softc *sc = device_private(self);
|
||||
struct hpibbus_attach_args *ha = aux;
|
||||
int unit, hpibno, slave;
|
||||
|
||||
sc->sc_dev = self;
|
||||
if (mtident(sc, ha) == 0) {
|
||||
printf("\n%s: impossible!\n", sc->sc_dev.dv_xname);
|
||||
aprint_error(": impossible!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -218,7 +219,7 @@ mtident(struct mt_softc *sc, struct hpibbus_attach_args *ha)
|
||||
if (ha->ha_id == mtinfo[i].hwid) {
|
||||
if (sc != NULL) {
|
||||
sc->sc_type = mtinfo[i].hwid;
|
||||
printf(": %s tape\n", mtinfo[i].desc);
|
||||
aprint_normal(": %s tape\n", mtinfo[i].desc);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -245,7 +246,7 @@ mtreaddsj(struct mt_softc *sc, int ecmd)
|
||||
sc->sc_flags &= ~MTF_DSJTIMEO;
|
||||
if (retval != 1) {
|
||||
dlog(LOG_DEBUG, "%s can't hpibrecv DSJ",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
if (sc->sc_recvtimeo == 0)
|
||||
sc->sc_recvtimeo = hz;
|
||||
if (--sc->sc_recvtimeo == 0)
|
||||
@ -256,7 +257,7 @@ mtreaddsj(struct mt_softc *sc, int ecmd)
|
||||
}
|
||||
sc->sc_recvtimeo = 0;
|
||||
sc->sc_statindex = 0;
|
||||
dlog(LOG_DEBUG, "%s readdsj: 0x%x", sc->sc_dev.dv_xname,
|
||||
dlog(LOG_DEBUG, "%s readdsj: 0x%x", device_xname(sc->sc_dev),
|
||||
sc->sc_lastdsj);
|
||||
sc->sc_lastecmd = ecmd;
|
||||
switch (sc->sc_lastdsj) {
|
||||
@ -271,7 +272,7 @@ mtreaddsj(struct mt_softc *sc, int ecmd)
|
||||
break;
|
||||
|
||||
default:
|
||||
log(LOG_ERR, "%s readdsj: DSJ 0x%x\n", sc->sc_dev.dv_xname,
|
||||
log(LOG_ERR, "%s readdsj: DSJ 0x%x\n", device_xname(sc->sc_dev),
|
||||
sc->sc_lastdsj);
|
||||
return -1;
|
||||
}
|
||||
@ -293,13 +294,13 @@ mtreaddsj(struct mt_softc *sc, int ecmd)
|
||||
return -2;
|
||||
}
|
||||
log(LOG_ERR, "%s readdsj: can't read status",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
return -1;
|
||||
}
|
||||
sc->sc_recvtimeo = 0;
|
||||
sc->sc_statindex = 0;
|
||||
dlog(LOG_DEBUG, "%s readdsj: status is %x %x %x %x %x %x",
|
||||
sc->sc_dev.dv_xname,
|
||||
device_xname(sc->sc_dev),
|
||||
sc->sc_stat1, sc->sc_stat2, sc->sc_stat3,
|
||||
sc->sc_stat4, sc->sc_stat5, sc->sc_stat6);
|
||||
if (sc->sc_lastecmd)
|
||||
@ -317,11 +318,11 @@ mtopen(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
int error;
|
||||
|
||||
if (unit >= mt_cd.cd_ndevs ||
|
||||
(sc = mt_cd.cd_devs[unit]) == NULL ||
|
||||
(sc = device_private(mt_cd.cd_devs[unit])) == NULL ||
|
||||
(sc->sc_flags & MTF_EXISTS) == 0)
|
||||
return ENXIO;
|
||||
|
||||
dlog(LOG_DEBUG, "%s open: flags 0x%x", sc->sc_dev.dv_xname,
|
||||
dlog(LOG_DEBUG, "%s open: flags 0x%x", device_xname(sc->sc_dev),
|
||||
sc->sc_flags);
|
||||
if (sc->sc_flags & MTF_OPEN)
|
||||
return EBUSY;
|
||||
@ -350,7 +351,7 @@ mtopen(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
goto errout;
|
||||
}
|
||||
if (!(sc->sc_stat1 & SR1_ONLINE)) {
|
||||
uprintf("%s: not online\n", sc->sc_dev.dv_xname);
|
||||
uprintf("%s: not online\n", device_xname(sc->sc_dev));
|
||||
error = EIO;
|
||||
goto errout;
|
||||
}
|
||||
@ -388,7 +389,7 @@ mtopen(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
if (!(sc->sc_stat1 & SR1_BOT)) {
|
||||
if (sc->sc_density != req_den) {
|
||||
uprintf("%s: can't change density mid-tape\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
error = EIO;
|
||||
goto errout;
|
||||
}
|
||||
@ -414,7 +415,7 @@ errout:
|
||||
static int
|
||||
mtclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
{
|
||||
struct mt_softc *sc = mt_cd.cd_devs[UNIT(dev)];
|
||||
struct mt_softc *sc = device_private(mt_cd.cd_devs[UNIT(dev)]);
|
||||
|
||||
if (sc->sc_flags & MTF_WRT) {
|
||||
(void) mtcommand(dev, MTWEOF, 2);
|
||||
@ -430,7 +431,7 @@ mtclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
static int
|
||||
mtcommand(dev_t dev, int cmd, int cnt)
|
||||
{
|
||||
struct mt_softc *sc = mt_cd.cd_devs[UNIT(dev)];
|
||||
struct mt_softc *sc = device_private(mt_cd.cd_devs[UNIT(dev)]);
|
||||
struct buf *bp = &sc->sc_bufstore;
|
||||
int error = 0;
|
||||
|
||||
@ -469,15 +470,15 @@ mtstrategy(struct buf *bp)
|
||||
int s;
|
||||
|
||||
unit = UNIT(bp->b_dev);
|
||||
sc = mt_cd.cd_devs[unit];
|
||||
dlog(LOG_DEBUG, "%s strategy", sc->sc_dev.dv_xname);
|
||||
sc = device_private(mt_cd.cd_devs[unit]);
|
||||
dlog(LOG_DEBUG, "%s strategy", device_xname(sc->sc_dev));
|
||||
if ((bp->b_flags & (B_CMD | B_READ)) == 0) {
|
||||
#define WRITE_BITS_IGNORED 8
|
||||
#if 0
|
||||
if (bp->b_bcount & ((1 << WRITE_BITS_IGNORED) - 1)) {
|
||||
tprintf(sc->sc_ttyp,
|
||||
"%s: write record must be multiple of %d\n",
|
||||
sc->sc_dev.dv_xname, 1 << WRITE_BITS_IGNORED);
|
||||
"%s: write record must be multiple of %d\n",
|
||||
device_xname(sc->sc_dev), 1 << WRITE_BITS_IGNORED);
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
@ -496,8 +497,8 @@ mtstrategy(struct buf *bp)
|
||||
}
|
||||
if (bp->b_bcount > s) {
|
||||
tprintf(sc->sc_ttyp,
|
||||
"%s: write record (%d) too big: limit (%d)\n",
|
||||
sc->sc_dev.dv_xname, bp->b_bcount, s);
|
||||
"%s: write record (%d) too big: limit (%d)\n",
|
||||
device_xname(sc->sc_dev), bp->b_bcount, s);
|
||||
#if 0 /* XXX see above */
|
||||
error:
|
||||
#endif
|
||||
@ -519,8 +520,8 @@ static void
|
||||
mtustart(struct mt_softc *sc)
|
||||
{
|
||||
|
||||
dlog(LOG_DEBUG, "%s ustart", sc->sc_dev.dv_xname);
|
||||
if (hpibreq(device_parent(&sc->sc_dev), &sc->sc_hq))
|
||||
dlog(LOG_DEBUG, "%s ustart", device_xname(sc->sc_dev));
|
||||
if (hpibreq(device_parent(sc->sc_dev), &sc->sc_hq))
|
||||
mtstart(sc);
|
||||
}
|
||||
|
||||
@ -552,7 +553,7 @@ mtstart(void *arg)
|
||||
short cmdcount = 1;
|
||||
u_char cmdbuf[2];
|
||||
|
||||
dlog(LOG_DEBUG, "%s start", sc->sc_dev.dv_xname);
|
||||
dlog(LOG_DEBUG, "%s start", device_xname(sc->sc_dev));
|
||||
sc->sc_flags &= ~MTF_WRT;
|
||||
bp = BUFQ_PEEK(sc->sc_tab);
|
||||
if ((sc->sc_flags & MTF_ALIVE) == 0 &&
|
||||
@ -678,7 +679,7 @@ mtstart(void *arg)
|
||||
*/
|
||||
if (hpibsend(sc->sc_hpibno, sc->sc_slave, -2, NULL, 0)){
|
||||
log(LOG_ERR, "%s can't reset",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
goto fatalerror;
|
||||
}
|
||||
callout_reset(&sc->sc_intr_ch, 4 * hz, spl_mtintr, sc);
|
||||
@ -735,7 +736,7 @@ done:
|
||||
sc->sc_flags &= ~(MTF_HITEOF | MTF_HITBOF);
|
||||
(void)BUFQ_GET(sc->sc_tab);
|
||||
biodone(bp);
|
||||
hpibfree(device_parent(&sc->sc_dev), &sc->sc_hq);
|
||||
hpibfree(device_parent(sc->sc_dev), &sc->sc_hq);
|
||||
if ((bp = BUFQ_PEEK(sc->sc_tab)) == NULL)
|
||||
sc->sc_active = 0;
|
||||
else
|
||||
@ -754,7 +755,7 @@ mtgo(void *arg)
|
||||
struct buf *bp;
|
||||
int rw;
|
||||
|
||||
dlog(LOG_DEBUG, "%s go", sc->sc_dev.dv_xname);
|
||||
dlog(LOG_DEBUG, "%s go", device_xname(sc->sc_dev));
|
||||
bp = BUFQ_PEEK(sc->sc_tab);
|
||||
rw = bp->b_flags & B_READ;
|
||||
hpibgo(sc->sc_hpibno, sc->sc_slave, rw ? MTT_READ : MTL_WRITE,
|
||||
@ -771,11 +772,11 @@ mtintr(void *arg)
|
||||
|
||||
bp = BUFQ_PEEK(sc->sc_tab);
|
||||
if (bp == NULL) {
|
||||
log(LOG_ERR, "%s intr: bp == NULL", sc->sc_dev.dv_xname);
|
||||
log(LOG_ERR, "%s intr: bp == NULL", device_xname(sc->sc_dev));
|
||||
return;
|
||||
}
|
||||
|
||||
dlog(LOG_DEBUG, "%s intr", sc->sc_dev.dv_xname);
|
||||
dlog(LOG_DEBUG, "%s intr", device_xname(sc->sc_dev));
|
||||
|
||||
/*
|
||||
* Some operation completed. Read status bytes and report errors.
|
||||
@ -817,13 +818,13 @@ mtintr(void *arg)
|
||||
|
||||
default:
|
||||
log(LOG_ERR, "%s intr: can't get drive stat",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
goto error;
|
||||
}
|
||||
if (sc->sc_stat1 & (SR1_ERR | SR1_REJECT)) {
|
||||
i = sc->sc_stat4 & SR4_ERCLMASK;
|
||||
log(LOG_ERR, "%s: %s error, retry %d, SR2/3 %x/%x, code %d",
|
||||
sc->sc_dev.dv_xname, i == SR4_DEVICE ? "device" :
|
||||
device_xname(sc->sc_dev), i == SR4_DEVICE ? "device" :
|
||||
(i == SR4_PROTOCOL ? "protocol" :
|
||||
(i == SR4_SELFTEST ? "selftest" : "unknown")),
|
||||
sc->sc_stat4 & SR4_RETRYMASK, sc->sc_stat2,
|
||||
@ -840,7 +841,7 @@ mtintr(void *arg)
|
||||
*/
|
||||
if (sc->sc_stat1 & SR1_SOFTERR) {
|
||||
log(LOG_WARNING, "%s: soft error, retry %d\n",
|
||||
sc->sc_dev.dv_xname, sc->sc_stat4 & SR4_RETRYMASK);
|
||||
device_xname(sc->sc_dev), sc->sc_stat4 & SR4_RETRYMASK);
|
||||
sc->sc_stat1 &= ~SR1_SOFTERR;
|
||||
}
|
||||
/*
|
||||
@ -888,7 +889,7 @@ mtintr(void *arg)
|
||||
i = hpibrecv(sc->sc_hpibno, sc->sc_slave, MTT_BCNT, cmdbuf, 2);
|
||||
if (i != 2) {
|
||||
log(LOG_ERR, "%s intr: can't get xfer length\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
goto error;
|
||||
}
|
||||
i = (int) *((u_short *) cmdbuf);
|
||||
@ -897,11 +898,12 @@ mtintr(void *arg)
|
||||
sc->sc_flags |= MTF_HITEOF;
|
||||
bp->b_resid = bp->b_bcount - i;
|
||||
dlog(LOG_DEBUG, "%s intr: bcount %d, resid %d",
|
||||
sc->sc_dev.dv_xname, bp->b_bcount, bp->b_resid);
|
||||
device_xname(sc->sc_dev), bp->b_bcount,
|
||||
bp->b_resid);
|
||||
} else {
|
||||
tprintf(sc->sc_ttyp,
|
||||
"%s: record (%d) larger than wanted (%d)\n",
|
||||
sc->sc_dev.dv_xname, i, bp->b_bcount);
|
||||
device_xname(sc->sc_dev), i, bp->b_bcount);
|
||||
error:
|
||||
sc->sc_flags &= ~MTF_IO;
|
||||
bp->b_error = EIO;
|
||||
@ -916,7 +918,7 @@ mtintr(void *arg)
|
||||
bp->b_flags &= ~B_CMD;
|
||||
(void)BUFQ_GET(sc->sc_tab);
|
||||
biodone(bp);
|
||||
hpibfree(device_parent(&sc->sc_dev), &sc->sc_hq);
|
||||
hpibfree(device_parent(sc->sc_dev), &sc->sc_hq);
|
||||
if (BUFQ_PEEK(sc->sc_tab) == NULL)
|
||||
sc->sc_active = 0;
|
||||
else
|
||||
@ -926,7 +928,7 @@ mtintr(void *arg)
|
||||
static int
|
||||
mtread(dev_t dev, struct uio *uio, int flags)
|
||||
{
|
||||
struct mt_softc *sc = mt_cd.cd_devs[UNIT(dev)];
|
||||
struct mt_softc *sc = device_private(mt_cd.cd_devs[UNIT(dev)]);
|
||||
|
||||
return physio(mtstrategy, &sc->sc_bufstore,
|
||||
dev, B_READ, minphys, uio);
|
||||
@ -935,7 +937,7 @@ mtread(dev_t dev, struct uio *uio, int flags)
|
||||
static int
|
||||
mtwrite(dev_t dev, struct uio *uio, int flags)
|
||||
{
|
||||
struct mt_softc *sc = mt_cd.cd_devs[UNIT(dev)];
|
||||
struct mt_softc *sc = device_private(mt_cd.cd_devs[UNIT(dev)]);
|
||||
|
||||
return physio(mtstrategy, &sc->sc_bufstore,
|
||||
dev, B_WRITE, minphys, uio);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nhpib.c,v 1.38 2007/12/05 12:03:08 tsutsui Exp $ */
|
||||
/* $NetBSD: nhpib.c,v 1.39 2008/03/29 06:47:08 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -72,7 +72,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nhpib.c,v 1.38 2007/12/05 12:03:08 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nhpib.c,v 1.39 2008/03/29 06:47:08 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -143,7 +143,7 @@ static struct hpib_controller nhpib_controller = {
|
||||
};
|
||||
|
||||
struct nhpib_softc {
|
||||
struct device sc_dev; /* generic device glue */
|
||||
device_t sc_dev; /* generic device glue */
|
||||
|
||||
bus_space_tag_t sc_bst;
|
||||
bus_space_handle_t sc_bsh;
|
||||
@ -158,21 +158,21 @@ struct nhpib_softc {
|
||||
struct callout sc_ppwatch_ch;
|
||||
};
|
||||
|
||||
static int nhpib_dio_match(struct device *, struct cfdata *, void *);
|
||||
static void nhpib_dio_attach(struct device *, struct device *, void *);
|
||||
static int nhpib_intio_match(struct device *, struct cfdata *, void *);
|
||||
static void nhpib_intio_attach(struct device *, struct device *, void *);
|
||||
static int nhpib_dio_match(device_t, cfdata_t, void *);
|
||||
static void nhpib_dio_attach(device_t, device_t, void *);
|
||||
static int nhpib_intio_match(device_t, cfdata_t, void *);
|
||||
static void nhpib_intio_attach(device_t, device_t, void *);
|
||||
|
||||
static void nhpib_common_attach(struct nhpib_softc *, const char *);
|
||||
|
||||
CFATTACH_DECL(nhpib_dio, sizeof(struct nhpib_softc),
|
||||
CFATTACH_DECL_NEW(nhpib_dio, sizeof(struct nhpib_softc),
|
||||
nhpib_dio_match, nhpib_dio_attach, NULL, NULL);
|
||||
|
||||
CFATTACH_DECL(nhpib_intio, sizeof(struct nhpib_softc),
|
||||
CFATTACH_DECL_NEW(nhpib_intio, sizeof(struct nhpib_softc),
|
||||
nhpib_intio_match, nhpib_intio_attach, NULL, NULL);
|
||||
|
||||
static int
|
||||
nhpib_intio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
nhpib_intio_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct intio_attach_args *ia = aux;
|
||||
|
||||
@ -183,7 +183,7 @@ nhpib_intio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static int
|
||||
nhpib_dio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
nhpib_dio_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct dio_attach_args *da = aux;
|
||||
|
||||
@ -194,15 +194,16 @@ nhpib_dio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
nhpib_intio_attach(struct device *parent, struct device *self, void *aux)
|
||||
nhpib_intio_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct nhpib_softc *sc = (struct nhpib_softc *)self;
|
||||
struct nhpib_softc *sc = device_private(self);
|
||||
struct intio_attach_args *ia = aux;
|
||||
bus_space_tag_t bst = ia->ia_bst;
|
||||
const char *desc = "internal HP-IB";
|
||||
|
||||
sc->sc_dev = self;
|
||||
if (bus_space_map(bst, ia->ia_iobase, INTIO_DEVSIZE, 0, &sc->sc_bsh)) {
|
||||
printf(": can't map registers\n");
|
||||
aprint_error(": can't map registers\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -217,18 +218,20 @@ nhpib_intio_attach(struct device *parent, struct device *self, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
nhpib_dio_attach(struct device *parent, struct device *self, void *aux)
|
||||
nhpib_dio_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct nhpib_softc *sc = (struct nhpib_softc *)self;
|
||||
struct nhpib_softc *sc = device_private(self);
|
||||
struct dio_attach_args *da = aux;
|
||||
bus_space_tag_t bst = da->da_bst;
|
||||
const char *desc = DIO_DEVICE_DESC_NHPIB;
|
||||
|
||||
sc->sc_dev = self;
|
||||
if (bus_space_map(bst, da->da_addr, da->da_size, 0, &sc->sc_bsh)) {
|
||||
printf(": can't map registers\n");
|
||||
aprint_error(": can't map registers\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_bst = bst;
|
||||
/* read address off switches */
|
||||
sc->sc_myaddr = bus_space_read_1(sc->sc_bst, sc->sc_bsh, 5);
|
||||
@ -245,10 +248,9 @@ nhpib_common_attach(struct nhpib_softc *sc, const char *desc)
|
||||
{
|
||||
struct hpibdev_attach_args ha;
|
||||
|
||||
printf(": %s\n", desc);
|
||||
aprint_normal(": %s\n", desc);
|
||||
|
||||
sc->sc_regs = (struct nhpibdevice *)bus_space_vaddr(sc->sc_bst,
|
||||
sc->sc_bsh);
|
||||
sc->sc_regs = bus_space_vaddr(sc->sc_bst, sc->sc_bsh);
|
||||
|
||||
callout_init(&sc->sc_read_ch, 0);
|
||||
callout_init(&sc->sc_ppwatch_ch, 0);
|
||||
@ -257,14 +259,13 @@ nhpib_common_attach(struct nhpib_softc *sc, const char *desc)
|
||||
ha.ha_type = sc->sc_type; /* XXX */
|
||||
ha.ha_ba = sc->sc_myaddr;
|
||||
ha.ha_softcpp = &sc->sc_hpibbus; /* XXX */
|
||||
(void)config_found((void *)sc, &ha, hpibdevprint);
|
||||
(void)config_found(sc->sc_dev, &ha, hpibdevprint);
|
||||
}
|
||||
|
||||
static void
|
||||
nhpibreset(struct hpibbus_softc *hs)
|
||||
{
|
||||
struct nhpib_softc *sc =
|
||||
(struct nhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct nhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
struct nhpibdevice *hd = sc->sc_regs;
|
||||
|
||||
hd->hpib_acr = AUX_SSWRST;
|
||||
@ -301,8 +302,7 @@ nhpibifc(struct nhpibdevice *hd)
|
||||
static int
|
||||
nhpibsend(struct hpibbus_softc *hs, int slave, int sec, void *ptr, int origcnt)
|
||||
{
|
||||
struct nhpib_softc *sc =
|
||||
(struct nhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct nhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
struct nhpibdevice *hd = sc->sc_regs;
|
||||
int cnt = origcnt;
|
||||
char *addr = ptr;
|
||||
@ -357,8 +357,7 @@ senderror:
|
||||
static int
|
||||
nhpibrecv(struct hpibbus_softc *hs, int slave, int sec, void *ptr, int origcnt)
|
||||
{
|
||||
struct nhpib_softc *sc =
|
||||
(struct nhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct nhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
struct nhpibdevice *hd = sc->sc_regs;
|
||||
int cnt = origcnt;
|
||||
char *addr = ptr;
|
||||
@ -409,8 +408,7 @@ static void
|
||||
nhpibgo(struct hpibbus_softc *hs, int slave, int sec, void *ptr, int count,
|
||||
int rw, int timo)
|
||||
{
|
||||
struct nhpib_softc *sc =
|
||||
(struct nhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct nhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
struct nhpibdevice *hd = sc->sc_regs;
|
||||
char *addr = ptr;
|
||||
|
||||
@ -458,8 +456,7 @@ static void
|
||||
nhpibreadtimo(void *arg)
|
||||
{
|
||||
struct hpibbus_softc *hs = arg;
|
||||
struct nhpib_softc *sc =
|
||||
(struct nhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct nhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
int s = splbio();
|
||||
|
||||
if (hs->sc_flags & HPIBF_IO) {
|
||||
@ -480,8 +477,7 @@ nhpibreadtimo(void *arg)
|
||||
static void
|
||||
nhpibdone(struct hpibbus_softc *hs)
|
||||
{
|
||||
struct nhpib_softc *sc =
|
||||
(struct nhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct nhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
struct nhpibdevice *hd = sc->sc_regs;
|
||||
int cnt;
|
||||
|
||||
@ -552,7 +548,7 @@ nhpibintr(void *arg)
|
||||
#ifdef DEBUG
|
||||
else
|
||||
printf("%s: PPOLL intr bad status %x\n",
|
||||
hs->sc_dev.dv_xname, stat0);
|
||||
device_xname(hs->sc_dev), stat0);
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
@ -561,8 +557,7 @@ nhpibintr(void *arg)
|
||||
static int
|
||||
nhpibppoll(struct hpibbus_softc *hs)
|
||||
{
|
||||
struct nhpib_softc *sc =
|
||||
(struct nhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct nhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
struct nhpibdevice *hd = sc->sc_regs;
|
||||
int ppoll;
|
||||
|
||||
@ -598,8 +593,7 @@ static void
|
||||
nhpibppwatch(void *arg)
|
||||
{
|
||||
struct hpibbus_softc *hs = arg;
|
||||
struct nhpib_softc *sc =
|
||||
(struct nhpib_softc *)device_parent(&hs->sc_dev);
|
||||
struct nhpib_softc *sc = device_private(device_parent(hs->sc_dev));
|
||||
|
||||
if ((hs->sc_flags & HPIBF_PPOLL) == 0)
|
||||
return;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ppi.c,v 1.38 2007/10/17 19:54:23 garbled Exp $ */
|
||||
/* $NetBSD: ppi.c,v 1.39 2008/03/29 06:47:08 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -72,7 +72,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ppi.c,v 1.38 2007/10/17 19:54:23 garbled Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ppi.c,v 1.39 2008/03/29 06:47:08 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -91,7 +91,7 @@ __KERNEL_RCSID(0, "$NetBSD: ppi.c,v 1.38 2007/10/17 19:54:23 garbled Exp $");
|
||||
#include "ioconf.h"
|
||||
|
||||
struct ppi_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
int sc_flags;
|
||||
struct hpibqueue sc_hq; /* HP-IB job queue entry */
|
||||
struct ppiparam sc_param;
|
||||
@ -111,10 +111,10 @@ struct ppi_softc {
|
||||
#define PPIF_TIMO 0x08
|
||||
#define PPIF_DELAY 0x10
|
||||
|
||||
static int ppimatch(struct device *, struct cfdata *, void *);
|
||||
static void ppiattach(struct device *, struct device *, void *);
|
||||
static int ppimatch(device_t, cfdata_t, void *);
|
||||
static void ppiattach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(ppi, sizeof(struct ppi_softc),
|
||||
CFATTACH_DECL_NEW(ppi, sizeof(struct ppi_softc),
|
||||
ppimatch, ppiattach, NULL, NULL);
|
||||
|
||||
static dev_type_open(ppiopen);
|
||||
@ -146,7 +146,7 @@ int ppidebug = 0x80;
|
||||
#endif
|
||||
|
||||
static int
|
||||
ppimatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
ppimatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct hpibbus_attach_args *ha = aux;
|
||||
|
||||
@ -162,20 +162,21 @@ ppimatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
* To prevent matching all unused slots on the bus, we
|
||||
* don't allow wildcarded locators.
|
||||
*/
|
||||
if (match->hpibbuscf_slave == HPIBBUSCF_SLAVE_DEFAULT ||
|
||||
match->hpibbuscf_punit == HPIBBUSCF_PUNIT_DEFAULT)
|
||||
if (cf->hpibbuscf_slave == HPIBBUSCF_SLAVE_DEFAULT ||
|
||||
cf->hpibbuscf_punit == HPIBBUSCF_PUNIT_DEFAULT)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
ppiattach(struct device *parent, struct device *self, void *aux)
|
||||
ppiattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct ppi_softc *sc = (struct ppi_softc *)self;
|
||||
struct ppi_softc *sc = device_private(self);
|
||||
struct hpibbus_attach_args *ha = aux;
|
||||
|
||||
printf("\n");
|
||||
sc->sc_dev = self;
|
||||
aprint_normal("\n");
|
||||
|
||||
sc->sc_slave = ha->ha_slave;
|
||||
|
||||
@ -205,7 +206,7 @@ ppiopen(dev_t dev, int flags, int fmt, struct lwp *l)
|
||||
struct ppi_softc *sc;
|
||||
|
||||
if (unit >= ppi_cd.cd_ndevs ||
|
||||
(sc = ppi_cd.cd_devs[unit]) == NULL ||
|
||||
(sc = device_private(ppi_cd.cd_devs[unit])) == NULL ||
|
||||
(sc->sc_flags & PPIF_ALIVE) == 0)
|
||||
return ENXIO;
|
||||
|
||||
@ -228,7 +229,7 @@ static int
|
||||
ppiclose(dev_t dev, int flags, int fmt, struct lwp *l)
|
||||
{
|
||||
int unit = UNIT(dev);
|
||||
struct ppi_softc *sc = ppi_cd.cd_devs[unit];
|
||||
struct ppi_softc *sc = device_private(ppi_cd.cd_devs[unit]);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (ppidebug & PDB_FOLLOW)
|
||||
@ -246,7 +247,7 @@ ppistart(void *arg)
|
||||
|
||||
#ifdef DEBUG
|
||||
if (ppidebug & PDB_FOLLOW)
|
||||
printf("ppistart(%x)\n", device_unit(&sc->sc_dev));
|
||||
printf("ppistart(%x)\n", device_unit(sc->sc_dev));
|
||||
#endif
|
||||
sc->sc_flags &= ~PPIF_DELAY;
|
||||
wakeup(sc);
|
||||
@ -259,7 +260,7 @@ ppitimo(void *arg)
|
||||
|
||||
#ifdef DEBUG
|
||||
if (ppidebug & PDB_FOLLOW)
|
||||
printf("ppitimo(%x)\n", device_unit(&sc->sc_dev));
|
||||
printf("ppitimo(%x)\n", device_unit(sc->sc_dev));
|
||||
#endif
|
||||
sc->sc_flags &= ~(PPIF_UIO|PPIF_TIMO);
|
||||
wakeup(sc);
|
||||
@ -291,7 +292,7 @@ static int
|
||||
ppirw(dev_t dev, struct uio *uio)
|
||||
{
|
||||
int unit = UNIT(dev);
|
||||
struct ppi_softc *sc = ppi_cd.cd_devs[unit];
|
||||
struct ppi_softc *sc = device_private(ppi_cd.cd_devs[unit]);
|
||||
int s, s2, len, cnt;
|
||||
char *cp;
|
||||
int error = 0, gotdata = 0;
|
||||
@ -301,7 +302,7 @@ ppirw(dev_t dev, struct uio *uio)
|
||||
if (uio->uio_resid == 0)
|
||||
return 0;
|
||||
|
||||
ctlr = device_unit(device_parent(&sc->sc_dev));
|
||||
ctlr = device_unit(device_parent(sc->sc_dev));
|
||||
slave = sc->sc_slave;
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -330,7 +331,7 @@ again:
|
||||
s = splsoftclock();
|
||||
s2 = splbio();
|
||||
if ((sc->sc_flags & PPIF_UIO) &&
|
||||
hpibreq(device_parent(&sc->sc_dev), &sc->sc_hq) == 0)
|
||||
hpibreq(device_parent(sc->sc_dev), &sc->sc_hq) == 0)
|
||||
(void) tsleep(sc, PRIBIO + 1, "ppirw", 0);
|
||||
/*
|
||||
* Check if we timed out during sleep or uiomove
|
||||
@ -358,7 +359,7 @@ again:
|
||||
else
|
||||
cnt = hpibrecv(ctlr, slave, sc->sc_sec, cp, len);
|
||||
s = splbio();
|
||||
hpibfree(device_parent(&sc->sc_dev), &sc->sc_hq);
|
||||
hpibfree(device_parent(sc->sc_dev), &sc->sc_hq);
|
||||
#ifdef DEBUG
|
||||
if (ppidebug & PDB_IO)
|
||||
printf("ppirw: %s(%d, %d, %x, %p, %d) -> %d\n",
|
||||
@ -449,7 +450,7 @@ again:
|
||||
static int
|
||||
ppiioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
|
||||
{
|
||||
struct ppi_softc *sc = ppi_cd.cd_devs[UNIT(dev)];
|
||||
struct ppi_softc *sc = device_private(ppi_cd.cd_devs[UNIT(dev)]);
|
||||
struct ppiparam *pp, *upp;
|
||||
int error = 0;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rd.c,v 1.84 2007/10/17 19:54:23 garbled Exp $ */
|
||||
/* $NetBSD: rd.c,v 1.85 2008/03/29 06:47:08 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -117,7 +117,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.84 2007/10/17 19:54:23 garbled Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.85 2008/03/29 06:47:08 tsutsui Exp $");
|
||||
|
||||
#include "opt_useleds.h"
|
||||
#include "rnd.h"
|
||||
@ -291,7 +291,7 @@ static const struct rdidentinfo rdidentinfo[] = {
|
||||
{ RD2203AID, 0, "2203A", NRD2203ABPT,
|
||||
NRD2203ATRK, 1449, 1309896 }
|
||||
};
|
||||
static const int numrdidentinfo = sizeof(rdidentinfo) / sizeof(rdidentinfo[0]);
|
||||
static const int numrdidentinfo = __arraycount(rdidentinfo);
|
||||
|
||||
static int rdident(struct device *, struct rd_softc *,
|
||||
struct hpibbus_attach_args *);
|
||||
@ -314,10 +314,10 @@ static int rderror(int);
|
||||
static void rdprinterr(const char *, short, const char **);
|
||||
#endif
|
||||
|
||||
static int rdmatch(struct device *, struct cfdata *, void *);
|
||||
static void rdattach(struct device *, struct device *, void *);
|
||||
static int rdmatch(device_t, cfdata_t, void *);
|
||||
static void rdattach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(rd, sizeof(struct rd_softc),
|
||||
CFATTACH_DECL_NEW(rd, sizeof(struct rd_softc),
|
||||
rdmatch, rdattach, NULL, NULL);
|
||||
|
||||
static dev_type_open(rdopen);
|
||||
@ -339,7 +339,7 @@ const struct cdevsw rd_cdevsw = {
|
||||
};
|
||||
|
||||
static int
|
||||
rdmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
rdmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct hpibbus_attach_args *ha = aux;
|
||||
|
||||
@ -347,9 +347,9 @@ rdmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
* Set punit if operator specified one in the kernel
|
||||
* configuration file.
|
||||
*/
|
||||
if (match->hpibbuscf_punit != HPIBBUSCF_PUNIT_DEFAULT &&
|
||||
match->hpibbuscf_punit < HPIB_NPUNITS)
|
||||
ha->ha_punit = match->hpibbuscf_punit;
|
||||
if (cf->hpibbuscf_punit != HPIBBUSCF_PUNIT_DEFAULT &&
|
||||
cf->hpibbuscf_punit < HPIB_NPUNITS)
|
||||
ha->ha_punit = cf->hpibbuscf_punit;
|
||||
|
||||
if (rdident(parent, NULL, ha) == 0) {
|
||||
/*
|
||||
@ -365,16 +365,16 @@ rdmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
rdattach(struct device *parent, struct device *self, void *aux)
|
||||
rdattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct rd_softc *sc = (struct rd_softc *)self;
|
||||
struct rd_softc *sc = device_private(self);
|
||||
struct hpibbus_attach_args *ha = aux;
|
||||
|
||||
sc->sc_dev = self;
|
||||
bufq_alloc(&sc->sc_tab, "disksort", BUFQ_SORT_RAWBLOCK);
|
||||
|
||||
if (rdident(parent, sc, ha) == 0) {
|
||||
printf("\n%s: didn't respond to describe command!\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error(": didn't respond to describe command!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -382,7 +382,7 @@ rdattach(struct device *parent, struct device *self, void *aux)
|
||||
* Initialize and attach the disk structure.
|
||||
*/
|
||||
memset(&sc->sc_dkdev, 0, sizeof(sc->sc_dkdev));
|
||||
disk_init(&sc->sc_dkdev, sc->sc_dev.dv_xname, NULL);
|
||||
disk_init(&sc->sc_dkdev, device_xname(sc->sc_dev), NULL);
|
||||
disk_attach(&sc->sc_dkdev);
|
||||
|
||||
sc->sc_slave = ha->ha_slave;
|
||||
@ -407,14 +407,13 @@ rdattach(struct device *parent, struct device *self, void *aux)
|
||||
/*
|
||||
* attach the device into the random source list
|
||||
*/
|
||||
rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
|
||||
rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
|
||||
RND_TYPE_DISK, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
rdident(struct device *parent, struct rd_softc *sc,
|
||||
struct hpibbus_attach_args *ha)
|
||||
rdident(device_t parent, struct rd_softc *sc, struct hpibbus_attach_args *ha)
|
||||
{
|
||||
struct rd_describe *desc = sc != NULL ? &sc->sc_rddesc : NULL;
|
||||
u_char stat, cmd[3];
|
||||
@ -463,20 +462,24 @@ rdident(struct device *parent, struct rd_softc *sc,
|
||||
|
||||
#ifdef DEBUG
|
||||
if (rddebug & RDB_IDENT) {
|
||||
printf("\n%s: name: %x ('%s')\n",
|
||||
sc->sc_dev.dv_xname, desc->d_name, name);
|
||||
printf(" iuw %x, maxxfr %d, ctype %d\n",
|
||||
aprint_debug("\n");
|
||||
aprint_debug_dev(sc->sc_dev, "name: %x ('%s')\n",
|
||||
desc->d_name, name);
|
||||
aprint_debug(" iuw %x, maxxfr %d, ctype %d\n",
|
||||
desc->d_iuw, desc->d_cmaxxfr, desc->d_ctype);
|
||||
printf(" utype %d, bps %d, blkbuf %d, burst %d, blktime %d\n",
|
||||
aprint_debug(" utype %d, bps %d, blkbuf %d, burst %d,"
|
||||
" blktime %d\n",
|
||||
desc->d_utype, desc->d_sectsize,
|
||||
desc->d_blkbuf, desc->d_burstsize, desc->d_blocktime);
|
||||
printf(" avxfr %d, ort %d, atp %d, maxint %d, fv %x, rv %x\n",
|
||||
aprint_debug(" avxfr %d, ort %d, atp %d, maxint %d, fv %x"
|
||||
", rv %x\n",
|
||||
desc->d_uavexfr, desc->d_retry, desc->d_access,
|
||||
desc->d_maxint, desc->d_fvbyte, desc->d_rvbyte);
|
||||
printf(" maxcyl/head/sect %d/%d/%d, maxvsect %d, inter %d\n",
|
||||
aprint_debug(" maxcyl/head/sect %d/%d/%d, maxvsect %d,"
|
||||
" inter %d\n",
|
||||
desc->d_maxcyl, desc->d_maxhead, desc->d_maxsect,
|
||||
desc->d_maxvsectl, desc->d_interleave);
|
||||
printf("%s", sc->sc_dev.dv_xname);
|
||||
aprint_normal("%s", device_xname(sc->sc_dev));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -516,9 +519,10 @@ rdident(struct device *parent, struct rd_softc *sc,
|
||||
* XXX off the driver because all of this code assumes 512 byte
|
||||
* XXX blocks. ICK!
|
||||
*/
|
||||
printf(": %s\n", rdidentinfo[id].ri_desc);
|
||||
printf("%s: %d cylinders, %d heads, %d blocks, %d bytes/block\n",
|
||||
sc->sc_dev.dv_xname, rdidentinfo[id].ri_ncyl,
|
||||
aprint_normal(": %s\n", rdidentinfo[id].ri_desc);
|
||||
aprint_normal_dev(sc->sc_dev, "%d cylinders, %d heads, %d blocks,"
|
||||
" %d bytes/block\n",
|
||||
rdidentinfo[id].ri_ncyl,
|
||||
rdidentinfo[id].ri_ntpc, rdidentinfo[id].ri_nblocks,
|
||||
DEV_BSIZE);
|
||||
|
||||
@ -526,37 +530,37 @@ rdident(struct device *parent, struct rd_softc *sc,
|
||||
}
|
||||
|
||||
static void
|
||||
rdreset(struct rd_softc *rs)
|
||||
rdreset(struct rd_softc *sc)
|
||||
{
|
||||
int ctlr = device_unit(device_parent(&rs->sc_dev));
|
||||
int slave = rs->sc_slave;
|
||||
int ctlr = device_unit(device_parent(sc->sc_dev));
|
||||
int slave = sc->sc_slave;
|
||||
u_char stat;
|
||||
|
||||
rs->sc_clear.c_unit = C_SUNIT(rs->sc_punit);
|
||||
rs->sc_clear.c_cmd = C_CLEAR;
|
||||
hpibsend(ctlr, slave, C_TCMD, &rs->sc_clear, sizeof(rs->sc_clear));
|
||||
sc->sc_clear.c_unit = C_SUNIT(sc->sc_punit);
|
||||
sc->sc_clear.c_cmd = C_CLEAR;
|
||||
hpibsend(ctlr, slave, C_TCMD, &sc->sc_clear, sizeof(sc->sc_clear));
|
||||
hpibswait(ctlr, slave);
|
||||
hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
|
||||
|
||||
rs->sc_src.c_unit = C_SUNIT(RDCTLR);
|
||||
rs->sc_src.c_nop = C_NOP;
|
||||
rs->sc_src.c_cmd = C_SREL;
|
||||
rs->sc_src.c_param = C_REL;
|
||||
hpibsend(ctlr, slave, C_CMD, &rs->sc_src, sizeof(rs->sc_src));
|
||||
sc->sc_src.c_unit = C_SUNIT(RDCTLR);
|
||||
sc->sc_src.c_nop = C_NOP;
|
||||
sc->sc_src.c_cmd = C_SREL;
|
||||
sc->sc_src.c_param = C_REL;
|
||||
hpibsend(ctlr, slave, C_CMD, &sc->sc_src, sizeof(sc->sc_src));
|
||||
hpibswait(ctlr, slave);
|
||||
hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
|
||||
|
||||
rs->sc_ssmc.c_unit = C_SUNIT(rs->sc_punit);
|
||||
rs->sc_ssmc.c_cmd = C_SSM;
|
||||
rs->sc_ssmc.c_refm = REF_MASK;
|
||||
rs->sc_ssmc.c_fefm = FEF_MASK;
|
||||
rs->sc_ssmc.c_aefm = AEF_MASK;
|
||||
rs->sc_ssmc.c_iefm = IEF_MASK;
|
||||
hpibsend(ctlr, slave, C_CMD, &rs->sc_ssmc, sizeof(rs->sc_ssmc));
|
||||
sc->sc_ssmc.c_unit = C_SUNIT(sc->sc_punit);
|
||||
sc->sc_ssmc.c_cmd = C_SSM;
|
||||
sc->sc_ssmc.c_refm = REF_MASK;
|
||||
sc->sc_ssmc.c_fefm = FEF_MASK;
|
||||
sc->sc_ssmc.c_aefm = AEF_MASK;
|
||||
sc->sc_ssmc.c_iefm = IEF_MASK;
|
||||
hpibsend(ctlr, slave, C_CMD, &sc->sc_ssmc, sizeof(sc->sc_ssmc));
|
||||
hpibswait(ctlr, slave);
|
||||
hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
|
||||
#ifdef DEBUG
|
||||
rs->sc_stats.rdresets++;
|
||||
sc->sc_stats.rdresets++;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -567,8 +571,8 @@ static int
|
||||
rdgetinfo(dev_t dev)
|
||||
{
|
||||
int unit = rdunit(dev);
|
||||
struct rd_softc *rs = rd_cd.cd_devs[unit];
|
||||
struct disklabel *lp = rs->sc_dkdev.dk_label;
|
||||
struct rd_softc *sc = device_private(rd_cd.cd_devs[unit]);
|
||||
struct disklabel *lp = sc->sc_dkdev.dk_label;
|
||||
struct partition *pi;
|
||||
const char *msg;
|
||||
|
||||
@ -577,7 +581,7 @@ rdgetinfo(dev_t dev)
|
||||
* or to use if there isn't a label.
|
||||
*/
|
||||
memset((void *)lp, 0, sizeof *lp);
|
||||
rdgetdefaultlabel(rs, lp);
|
||||
rdgetdefaultlabel(sc, lp);
|
||||
|
||||
/*
|
||||
* Now try to read the disklabel
|
||||
@ -587,9 +591,9 @@ rdgetinfo(dev_t dev)
|
||||
return 0;
|
||||
|
||||
pi = lp->d_partitions;
|
||||
printf("%s: WARNING: %s\n", rs->sc_dev.dv_xname, msg);
|
||||
printf("%s: WARNING: %s\n", device_xname(sc->sc_dev), msg);
|
||||
|
||||
pi[2].p_size = rdidentinfo[rs->sc_type].ri_nblocks;
|
||||
pi[2].p_size = rdidentinfo[sc->sc_type].ri_nblocks;
|
||||
/* XXX reset other info since readdisklabel screws with it */
|
||||
lp->d_npartitions = 3;
|
||||
pi[0].p_size = 0;
|
||||
@ -601,30 +605,30 @@ static int
|
||||
rdopen(dev_t dev, int flags, int mode, struct lwp *l)
|
||||
{
|
||||
int unit = rdunit(dev);
|
||||
struct rd_softc *rs;
|
||||
struct rd_softc *sc;
|
||||
int error, mask, part;
|
||||
|
||||
if (unit >= rd_cd.cd_ndevs ||
|
||||
(rs = rd_cd.cd_devs[unit]) == NULL ||
|
||||
(rs->sc_flags & RDF_ALIVE) == 0)
|
||||
(sc = device_private(rd_cd.cd_devs[unit])) == NULL ||
|
||||
(sc->sc_flags & RDF_ALIVE) == 0)
|
||||
return ENXIO;
|
||||
|
||||
/*
|
||||
* Wait for any pending opens/closes to complete
|
||||
*/
|
||||
while (rs->sc_flags & (RDF_OPENING|RDF_CLOSING))
|
||||
(void) tsleep(rs, PRIBIO, "rdopen", 0);
|
||||
while (sc->sc_flags & (RDF_OPENING|RDF_CLOSING))
|
||||
(void) tsleep(sc, PRIBIO, "rdopen", 0);
|
||||
|
||||
/*
|
||||
* On first open, get label and partition info.
|
||||
* We may block reading the label, so be careful
|
||||
* to stop any other opens.
|
||||
*/
|
||||
if (rs->sc_dkdev.dk_openmask == 0) {
|
||||
rs->sc_flags |= RDF_OPENING;
|
||||
if (sc->sc_dkdev.dk_openmask == 0) {
|
||||
sc->sc_flags |= RDF_OPENING;
|
||||
error = rdgetinfo(dev);
|
||||
rs->sc_flags &= ~RDF_OPENING;
|
||||
wakeup((void *)rs);
|
||||
sc->sc_flags &= ~RDF_OPENING;
|
||||
wakeup((void *)sc);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
@ -634,21 +638,21 @@ rdopen(dev_t dev, int flags, int mode, struct lwp *l)
|
||||
|
||||
/* Check that the partition exists. */
|
||||
if (part != RAW_PART &&
|
||||
(part > rs->sc_dkdev.dk_label->d_npartitions ||
|
||||
rs->sc_dkdev.dk_label->d_partitions[part].p_fstype == FS_UNUSED))
|
||||
(part > sc->sc_dkdev.dk_label->d_npartitions ||
|
||||
sc->sc_dkdev.dk_label->d_partitions[part].p_fstype == FS_UNUSED))
|
||||
return ENXIO;
|
||||
|
||||
/* Ensure only one open at a time. */
|
||||
switch (mode) {
|
||||
case S_IFCHR:
|
||||
rs->sc_dkdev.dk_copenmask |= mask;
|
||||
sc->sc_dkdev.dk_copenmask |= mask;
|
||||
break;
|
||||
case S_IFBLK:
|
||||
rs->sc_dkdev.dk_bopenmask |= mask;
|
||||
sc->sc_dkdev.dk_bopenmask |= mask;
|
||||
break;
|
||||
}
|
||||
rs->sc_dkdev.dk_openmask =
|
||||
rs->sc_dkdev.dk_copenmask | rs->sc_dkdev.dk_bopenmask;
|
||||
sc->sc_dkdev.dk_openmask =
|
||||
sc->sc_dkdev.dk_copenmask | sc->sc_dkdev.dk_bopenmask;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -657,8 +661,8 @@ static int
|
||||
rdclose(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
{
|
||||
int unit = rdunit(dev);
|
||||
struct rd_softc *rs = rd_cd.cd_devs[unit];
|
||||
struct disk *dk = &rs->sc_dkdev;
|
||||
struct rd_softc *sc = device_private(rd_cd.cd_devs[unit]);
|
||||
struct disk *dk = &sc->sc_dkdev;
|
||||
int mask, s;
|
||||
|
||||
mask = 1 << rdpart(dev);
|
||||
@ -675,15 +679,15 @@ rdclose(dev_t dev, int flag, int mode, struct lwp *l)
|
||||
* we are the last one.
|
||||
*/
|
||||
if (dk->dk_openmask == 0) {
|
||||
rs->sc_flags |= RDF_CLOSING;
|
||||
sc->sc_flags |= RDF_CLOSING;
|
||||
s = splbio();
|
||||
while (rs->sc_active) {
|
||||
rs->sc_flags |= RDF_WANTED;
|
||||
(void) tsleep(&rs->sc_tab, PRIBIO, "rdclose", 0);
|
||||
while (sc->sc_active) {
|
||||
sc->sc_flags |= RDF_WANTED;
|
||||
(void) tsleep(&sc->sc_tab, PRIBIO, "rdclose", 0);
|
||||
}
|
||||
splx(s);
|
||||
rs->sc_flags &= ~(RDF_CLOSING|RDF_WLABEL);
|
||||
wakeup((void *)rs);
|
||||
sc->sc_flags &= ~(RDF_CLOSING|RDF_WLABEL);
|
||||
wakeup((void *)sc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -692,7 +696,7 @@ static void
|
||||
rdstrategy(struct buf *bp)
|
||||
{
|
||||
int unit = rdunit(bp->b_dev);
|
||||
struct rd_softc *rs = rd_cd.cd_devs[unit];
|
||||
struct rd_softc *sc = device_private(rd_cd.cd_devs[unit]);
|
||||
struct partition *pinfo;
|
||||
daddr_t bn;
|
||||
int sz, s;
|
||||
@ -706,7 +710,7 @@ rdstrategy(struct buf *bp)
|
||||
#endif
|
||||
bn = bp->b_blkno;
|
||||
sz = howmany(bp->b_bcount, DEV_BSIZE);
|
||||
pinfo = &rs->sc_dkdev.dk_label->d_partitions[rdpart(bp->b_dev)];
|
||||
pinfo = &sc->sc_dkdev.dk_label->d_partitions[rdpart(bp->b_dev)];
|
||||
|
||||
/* Don't perform partition translation on RAW_PART. */
|
||||
offset = (rdpart(bp->b_dev) == RAW_PART) ? 0 : pinfo->p_offset;
|
||||
@ -736,17 +740,17 @@ rdstrategy(struct buf *bp)
|
||||
#if LABELSECTOR != 0
|
||||
bn + offset + sz > LABELSECTOR &&
|
||||
#endif
|
||||
!(bp->b_flags & B_READ) && !(rs->sc_flags & RDF_WLABEL)) {
|
||||
!(bp->b_flags & B_READ) && !(sc->sc_flags & RDF_WLABEL)) {
|
||||
bp->b_error = EROFS;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
bp->b_rawblkno = bn + offset;
|
||||
s = splbio();
|
||||
BUFQ_PUT(rs->sc_tab, bp);
|
||||
if (rs->sc_active == 0) {
|
||||
rs->sc_active = 1;
|
||||
rdustart(rs);
|
||||
BUFQ_PUT(sc->sc_tab, bp);
|
||||
if (sc->sc_active == 0) {
|
||||
sc->sc_active = 1;
|
||||
rdustart(sc);
|
||||
}
|
||||
splx(s);
|
||||
return;
|
||||
@ -766,32 +770,32 @@ rdrestart(void *arg)
|
||||
}
|
||||
|
||||
static void
|
||||
rdustart(struct rd_softc *rs)
|
||||
rdustart(struct rd_softc *sc)
|
||||
{
|
||||
struct buf *bp;
|
||||
|
||||
bp = BUFQ_PEEK(rs->sc_tab);
|
||||
rs->sc_addr = bp->b_data;
|
||||
rs->sc_resid = bp->b_bcount;
|
||||
if (hpibreq(device_parent(&rs->sc_dev), &rs->sc_hq))
|
||||
rdstart(rs);
|
||||
bp = BUFQ_PEEK(sc->sc_tab);
|
||||
sc->sc_addr = bp->b_data;
|
||||
sc->sc_resid = bp->b_bcount;
|
||||
if (hpibreq(device_parent(sc->sc_dev), &sc->sc_hq))
|
||||
rdstart(sc);
|
||||
}
|
||||
|
||||
static struct buf *
|
||||
rdfinish(struct rd_softc *rs, struct buf *bp)
|
||||
rdfinish(struct rd_softc *sc, struct buf *bp)
|
||||
{
|
||||
|
||||
rs->sc_errcnt = 0;
|
||||
(void)BUFQ_GET(rs->sc_tab);
|
||||
sc->sc_errcnt = 0;
|
||||
(void)BUFQ_GET(sc->sc_tab);
|
||||
bp->b_resid = 0;
|
||||
biodone(bp);
|
||||
hpibfree(device_parent(&rs->sc_dev), &rs->sc_hq);
|
||||
if ((bp = BUFQ_PEEK(rs->sc_tab)) != NULL)
|
||||
hpibfree(device_parent(sc->sc_dev), &sc->sc_hq);
|
||||
if ((bp = BUFQ_PEEK(sc->sc_tab)) != NULL)
|
||||
return bp;
|
||||
rs->sc_active = 0;
|
||||
if (rs->sc_flags & RDF_WANTED) {
|
||||
rs->sc_flags &= ~RDF_WANTED;
|
||||
wakeup((void *)&rs->sc_tab);
|
||||
sc->sc_active = 0;
|
||||
if (sc->sc_flags & RDF_WANTED) {
|
||||
sc->sc_flags &= ~RDF_WANTED;
|
||||
wakeup((void *)&sc->sc_tab);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -799,42 +803,42 @@ rdfinish(struct rd_softc *rs, struct buf *bp)
|
||||
static void
|
||||
rdstart(void *arg)
|
||||
{
|
||||
struct rd_softc *rs = arg;
|
||||
struct buf *bp = BUFQ_PEEK(rs->sc_tab);
|
||||
struct rd_softc *sc = arg;
|
||||
struct buf *bp = BUFQ_PEEK(sc->sc_tab);
|
||||
int part, ctlr, slave;
|
||||
|
||||
ctlr = device_unit(device_parent(&rs->sc_dev));
|
||||
slave = rs->sc_slave;
|
||||
ctlr = device_unit(device_parent(sc->sc_dev));
|
||||
slave = sc->sc_slave;
|
||||
|
||||
again:
|
||||
#ifdef DEBUG
|
||||
if (rddebug & RDB_FOLLOW)
|
||||
printf("rdstart(%s): bp %p, %c\n", rs->sc_dev.dv_xname, bp,
|
||||
(bp->b_flags & B_READ) ? 'R' : 'W');
|
||||
printf("rdstart(%s): bp %p, %c\n", device_xname(sc->sc_dev), bp,
|
||||
(bp->b_flags & B_READ) ? 'R' : 'W');
|
||||
#endif
|
||||
part = rdpart(bp->b_dev);
|
||||
rs->sc_flags |= RDF_SEEK;
|
||||
rs->sc_ioc.c_unit = C_SUNIT(rs->sc_punit);
|
||||
rs->sc_ioc.c_volume = C_SVOL(0);
|
||||
rs->sc_ioc.c_saddr = C_SADDR;
|
||||
rs->sc_ioc.c_hiaddr = 0;
|
||||
rs->sc_ioc.c_addr = RDBTOS(bp->b_rawblkno);
|
||||
rs->sc_ioc.c_nop2 = C_NOP;
|
||||
rs->sc_ioc.c_slen = C_SLEN;
|
||||
rs->sc_ioc.c_len = rs->sc_resid;
|
||||
rs->sc_ioc.c_cmd = bp->b_flags & B_READ ? C_READ : C_WRITE;
|
||||
sc->sc_flags |= RDF_SEEK;
|
||||
sc->sc_ioc.c_unit = C_SUNIT(sc->sc_punit);
|
||||
sc->sc_ioc.c_volume = C_SVOL(0);
|
||||
sc->sc_ioc.c_saddr = C_SADDR;
|
||||
sc->sc_ioc.c_hiaddr = 0;
|
||||
sc->sc_ioc.c_addr = RDBTOS(bp->b_rawblkno);
|
||||
sc->sc_ioc.c_nop2 = C_NOP;
|
||||
sc->sc_ioc.c_slen = C_SLEN;
|
||||
sc->sc_ioc.c_len = sc->sc_resid;
|
||||
sc->sc_ioc.c_cmd = bp->b_flags & B_READ ? C_READ : C_WRITE;
|
||||
#ifdef DEBUG
|
||||
if (rddebug & RDB_IO)
|
||||
printf("rdstart: hpibsend(%x, %x, %x, %p, %x)\n",
|
||||
ctlr, slave, C_CMD,
|
||||
&rs->sc_ioc.c_unit, sizeof(rs->sc_ioc)-2);
|
||||
&sc->sc_ioc.c_unit, sizeof(sc->sc_ioc) - 2);
|
||||
#endif
|
||||
if (hpibsend(ctlr, slave, C_CMD, &rs->sc_ioc.c_unit,
|
||||
sizeof(rs->sc_ioc)-2) == sizeof(rs->sc_ioc)-2) {
|
||||
if (hpibsend(ctlr, slave, C_CMD, &sc->sc_ioc.c_unit,
|
||||
sizeof(sc->sc_ioc) - 2) == sizeof(sc->sc_ioc) - 2) {
|
||||
|
||||
/* Instrumentation. */
|
||||
disk_busy(&rs->sc_dkdev);
|
||||
iostat_seek(rs->sc_dkdev.dk_stats);
|
||||
disk_busy(&sc->sc_dkdev);
|
||||
iostat_seek(sc->sc_dkdev.dk_stats);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (rddebug & RDB_IO)
|
||||
@ -852,23 +856,24 @@ again:
|
||||
#ifdef DEBUG
|
||||
if (rddebug & RDB_ERROR)
|
||||
printf("%s: rdstart: cmd %x adr %lx blk %lld len %d ecnt %d\n",
|
||||
rs->sc_dev.dv_xname, rs->sc_ioc.c_cmd, rs->sc_ioc.c_addr,
|
||||
bp->b_blkno, rs->sc_resid, rs->sc_errcnt);
|
||||
rs->sc_stats.rdretries++;
|
||||
device_xname(sc->sc_dev),
|
||||
sc->sc_ioc.c_cmd, sc->sc_ioc.c_addr,
|
||||
bp->b_blkno, sc->sc_resid, sc->sc_errcnt);
|
||||
sc->sc_stats.rdretries++;
|
||||
#endif
|
||||
rs->sc_flags &= ~RDF_SEEK;
|
||||
rdreset(rs);
|
||||
if (rs->sc_errcnt++ < RDRETRY)
|
||||
sc->sc_flags &= ~RDF_SEEK;
|
||||
rdreset(sc);
|
||||
if (sc->sc_errcnt++ < RDRETRY)
|
||||
goto again;
|
||||
printf("%s: rdstart err: cmd 0x%x sect %ld blk %" PRId64 " len %d\n",
|
||||
rs->sc_dev.dv_xname, rs->sc_ioc.c_cmd, rs->sc_ioc.c_addr,
|
||||
bp->b_blkno, rs->sc_resid);
|
||||
device_xname(sc->sc_dev), sc->sc_ioc.c_cmd, sc->sc_ioc.c_addr,
|
||||
bp->b_blkno, sc->sc_resid);
|
||||
bp->b_error = EIO;
|
||||
bp = rdfinish(rs, bp);
|
||||
bp = rdfinish(sc, bp);
|
||||
if (bp) {
|
||||
rs->sc_addr = bp->b_data;
|
||||
rs->sc_resid = bp->b_bcount;
|
||||
if (hpibreq(device_parent(&rs->sc_dev), &rs->sc_hq))
|
||||
sc->sc_addr = bp->b_data;
|
||||
sc->sc_resid = bp->b_bcount;
|
||||
if (hpibreq(device_parent(sc->sc_dev), &sc->sc_hq))
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
@ -876,72 +881,72 @@ again:
|
||||
static void
|
||||
rdgo(void *arg)
|
||||
{
|
||||
struct rd_softc *rs = arg;
|
||||
struct buf *bp = BUFQ_PEEK(rs->sc_tab);
|
||||
struct rd_softc *sc = arg;
|
||||
struct buf *bp = BUFQ_PEEK(sc->sc_tab);
|
||||
int rw, ctlr, slave;
|
||||
|
||||
ctlr = device_unit(device_parent(&rs->sc_dev));
|
||||
slave = rs->sc_slave;
|
||||
ctlr = device_unit(device_parent(sc->sc_dev));
|
||||
slave = sc->sc_slave;
|
||||
|
||||
rw = bp->b_flags & B_READ;
|
||||
|
||||
/* Instrumentation. */
|
||||
disk_busy(&rs->sc_dkdev);
|
||||
disk_busy(&sc->sc_dkdev);
|
||||
|
||||
#ifdef USELEDS
|
||||
ledcontrol(0, 0, LED_DISK);
|
||||
#endif
|
||||
hpibgo(ctlr, slave, C_EXEC, rs->sc_addr, rs->sc_resid, rw, rw != 0);
|
||||
hpibgo(ctlr, slave, C_EXEC, sc->sc_addr, sc->sc_resid, rw, rw != 0);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
rdintr(void *arg)
|
||||
{
|
||||
struct rd_softc *rs = arg;
|
||||
int unit = device_unit(&rs->sc_dev);
|
||||
struct buf *bp = BUFQ_PEEK(rs->sc_tab);
|
||||
struct rd_softc *sc = arg;
|
||||
int unit = device_unit(sc->sc_dev);
|
||||
struct buf *bp = BUFQ_PEEK(sc->sc_tab);
|
||||
u_char stat = 13; /* in case hpibrecv fails */
|
||||
int rv, restart, ctlr, slave;
|
||||
|
||||
ctlr = device_unit(device_parent(&rs->sc_dev));
|
||||
slave = rs->sc_slave;
|
||||
ctlr = device_unit(device_parent(sc->sc_dev));
|
||||
slave = sc->sc_slave;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (rddebug & RDB_FOLLOW)
|
||||
printf("rdintr(%d): bp %p, %c, flags %x\n", unit, bp,
|
||||
(bp->b_flags & B_READ) ? 'R' : 'W', rs->sc_flags);
|
||||
(bp->b_flags & B_READ) ? 'R' : 'W', sc->sc_flags);
|
||||
if (bp == NULL) {
|
||||
printf("%s: bp == NULL\n", rs->sc_dev.dv_xname);
|
||||
printf("%s: bp == NULL\n", device_xname(sc->sc_dev));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
disk_unbusy(&rs->sc_dkdev, (bp->b_bcount - bp->b_resid),
|
||||
disk_unbusy(&sc->sc_dkdev, (bp->b_bcount - bp->b_resid),
|
||||
(bp->b_flags & B_READ));
|
||||
|
||||
if (rs->sc_flags & RDF_SEEK) {
|
||||
rs->sc_flags &= ~RDF_SEEK;
|
||||
if (sc->sc_flags & RDF_SEEK) {
|
||||
sc->sc_flags &= ~RDF_SEEK;
|
||||
if (hpibustart(ctlr))
|
||||
rdgo(rs);
|
||||
rdgo(sc);
|
||||
return;
|
||||
}
|
||||
if ((rs->sc_flags & RDF_SWAIT) == 0) {
|
||||
if ((sc->sc_flags & RDF_SWAIT) == 0) {
|
||||
#ifdef DEBUG
|
||||
rs->sc_stats.rdpolltries++;
|
||||
sc->sc_stats.rdpolltries++;
|
||||
#endif
|
||||
if (hpibpptest(ctlr, slave) == 0) {
|
||||
#ifdef DEBUG
|
||||
rs->sc_stats.rdpollwaits++;
|
||||
sc->sc_stats.rdpollwaits++;
|
||||
#endif
|
||||
|
||||
/* Instrumentation. */
|
||||
disk_busy(&rs->sc_dkdev);
|
||||
rs->sc_flags |= RDF_SWAIT;
|
||||
disk_busy(&sc->sc_dkdev);
|
||||
sc->sc_flags |= RDF_SWAIT;
|
||||
hpibawait(ctlr);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
rs->sc_flags &= ~RDF_SWAIT;
|
||||
sc->sc_flags &= ~RDF_SWAIT;
|
||||
rv = hpibrecv(ctlr, slave, C_QSTAT, &stat, 1);
|
||||
if (rv != 1 || stat) {
|
||||
#ifdef DEBUG
|
||||
@ -950,51 +955,51 @@ rdintr(void *arg)
|
||||
#endif
|
||||
restart = rderror(unit);
|
||||
#ifdef DEBUG
|
||||
rs->sc_stats.rdretries++;
|
||||
sc->sc_stats.rdretries++;
|
||||
#endif
|
||||
if (rs->sc_errcnt++ < RDRETRY) {
|
||||
if (sc->sc_errcnt++ < RDRETRY) {
|
||||
if (restart)
|
||||
rdstart(rs);
|
||||
rdstart(sc);
|
||||
return;
|
||||
}
|
||||
bp->b_error = EIO;
|
||||
}
|
||||
if (rdfinish(rs, bp))
|
||||
rdustart(rs);
|
||||
if (rdfinish(sc, bp))
|
||||
rdustart(sc);
|
||||
#if NRND > 0
|
||||
rnd_add_uint32(&rs->rnd_source, bp->b_blkno);
|
||||
rnd_add_uint32(&sc->rnd_source, bp->b_blkno);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
rdstatus(struct rd_softc *rs)
|
||||
rdstatus(struct rd_softc *sc)
|
||||
{
|
||||
int c, s;
|
||||
u_char stat;
|
||||
int rv;
|
||||
|
||||
c = device_unit(device_parent(&rs->sc_dev));
|
||||
s = rs->sc_slave;
|
||||
rs->sc_rsc.c_unit = C_SUNIT(rs->sc_punit);
|
||||
rs->sc_rsc.c_sram = C_SRAM;
|
||||
rs->sc_rsc.c_ram = C_RAM;
|
||||
rs->sc_rsc.c_cmd = C_STATUS;
|
||||
memset((void *)&rs->sc_stat, 0, sizeof(rs->sc_stat));
|
||||
rv = hpibsend(c, s, C_CMD, &rs->sc_rsc, sizeof(rs->sc_rsc));
|
||||
if (rv != sizeof(rs->sc_rsc)) {
|
||||
c = device_unit(device_parent(sc->sc_dev));
|
||||
s = sc->sc_slave;
|
||||
sc->sc_rsc.c_unit = C_SUNIT(sc->sc_punit);
|
||||
sc->sc_rsc.c_sram = C_SRAM;
|
||||
sc->sc_rsc.c_ram = C_RAM;
|
||||
sc->sc_rsc.c_cmd = C_STATUS;
|
||||
memset((void *)&sc->sc_stat, 0, sizeof(sc->sc_stat));
|
||||
rv = hpibsend(c, s, C_CMD, &sc->sc_rsc, sizeof(sc->sc_rsc));
|
||||
if (rv != sizeof(sc->sc_rsc)) {
|
||||
#ifdef DEBUG
|
||||
if (rddebug & RDB_STATUS)
|
||||
printf("rdstatus: send C_CMD failed %d != %d\n",
|
||||
rv, sizeof(rs->sc_rsc));
|
||||
rv, sizeof(sc->sc_rsc));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
rv = hpibrecv(c, s, C_EXEC, &rs->sc_stat, sizeof(rs->sc_stat));
|
||||
if (rv != sizeof(rs->sc_stat)) {
|
||||
rv = hpibrecv(c, s, C_EXEC, &sc->sc_stat, sizeof(sc->sc_stat));
|
||||
if (rv != sizeof(sc->sc_stat)) {
|
||||
#ifdef DEBUG
|
||||
if (rddebug & RDB_STATUS)
|
||||
printf("rdstatus: send C_EXEC failed %d != %d\n",
|
||||
rv, sizeof(rs->sc_stat));
|
||||
rv, sizeof(sc->sc_stat));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@ -1018,24 +1023,24 @@ rdstatus(struct rd_softc *rs)
|
||||
static int
|
||||
rderror(int unit)
|
||||
{
|
||||
struct rd_softc *rs = rd_cd.cd_devs[unit];
|
||||
struct rd_softc *sc = device_private(rd_cd.cd_devs[unit]);
|
||||
struct rd_stat *sp;
|
||||
struct buf *bp;
|
||||
daddr_t hwbn, pbn;
|
||||
char *hexstr(int, int); /* XXX */
|
||||
|
||||
if (rdstatus(rs)) {
|
||||
if (rdstatus(sc)) {
|
||||
#ifdef DEBUG
|
||||
printf("%s: couldn't get status\n", rs->sc_dev.dv_xname);
|
||||
printf("%s: couldn't get status\n", device_xname(sc->sc_dev));
|
||||
#endif
|
||||
rdreset(rs);
|
||||
rdreset(sc);
|
||||
return 1;
|
||||
}
|
||||
sp = &rs->sc_stat;
|
||||
sp = &sc->sc_stat;
|
||||
if (sp->c_fef & FEF_REXMT)
|
||||
return 1;
|
||||
if (sp->c_fef & FEF_PF) {
|
||||
rdreset(rs);
|
||||
rdreset(sc);
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
@ -1047,14 +1052,14 @@ rderror(int unit)
|
||||
*/
|
||||
if (sp->c_fef & FEF_IMR) {
|
||||
extern int hz;
|
||||
int rdtimo = RDWAITC << rs->sc_errcnt;
|
||||
int rdtimo = RDWAITC << sc->sc_errcnt;
|
||||
#ifdef DEBUG
|
||||
printf("%s: internal maintenance, %d second timeout\n",
|
||||
rs->sc_dev.dv_xname, rdtimo);
|
||||
rs->sc_stats.rdtimeouts++;
|
||||
device_xname(sc->sc_dev), rdtimo);
|
||||
sc->sc_stats.rdtimeouts++;
|
||||
#endif
|
||||
hpibfree(device_parent(&rs->sc_dev), &rs->sc_hq);
|
||||
callout_reset(&rs->sc_restart_ch, rdtimo * hz, rdrestart, rs);
|
||||
hpibfree(device_parent(sc->sc_dev), &sc->sc_hq);
|
||||
callout_reset(&sc->sc_restart_ch, rdtimo * hz, rdrestart, sc);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
@ -1062,7 +1067,7 @@ rderror(int unit)
|
||||
* threshhold. By default, this will only report after the
|
||||
* retry limit has been exceeded.
|
||||
*/
|
||||
if (rs->sc_errcnt < rderrthresh)
|
||||
if (sc->sc_errcnt < rderrthresh)
|
||||
return 1;
|
||||
|
||||
/*
|
||||
@ -1070,8 +1075,8 @@ rderror(int unit)
|
||||
* Note that not all errors report a block number, in that case
|
||||
* we just use b_blkno.
|
||||
*/
|
||||
bp = BUFQ_PEEK(rs->sc_tab);
|
||||
pbn = rs->sc_dkdev.dk_label->d_partitions[rdpart(bp->b_dev)].p_offset;
|
||||
bp = BUFQ_PEEK(sc->sc_tab);
|
||||
pbn = sc->sc_dkdev.dk_label->d_partitions[rdpart(bp->b_dev)].p_offset;
|
||||
if ((sp->c_fef & FEF_CU) || (sp->c_fef & FEF_DR) ||
|
||||
(sp->c_ief & IEF_RRMASK)) {
|
||||
hwbn = RDBTOS(pbn + bp->b_blkno);
|
||||
@ -1086,13 +1091,13 @@ rderror(int unit)
|
||||
* out b_blkno which is just the beginning block number
|
||||
* of the transfer, not necessary where the error occurred.
|
||||
*/
|
||||
printf("%s%c: hard error sn%" PRId64 "\n", rs->sc_dev.dv_xname,
|
||||
printf("%s%c: hard error sn%" PRId64 "\n", device_xname(sc->sc_dev),
|
||||
'a'+rdpart(bp->b_dev), pbn);
|
||||
/*
|
||||
* Now report the status as returned by the hardware with
|
||||
* attempt at interpretation (unless debugging).
|
||||
*/
|
||||
printf("%s %s error:", rs->sc_dev.dv_xname,
|
||||
printf("%s %s error:", device_xname(sc->sc_dev),
|
||||
(bp->b_flags & B_READ) ? "read" : "write");
|
||||
#ifdef DEBUG
|
||||
if (rddebug & RDB_ERROR) {
|
||||
@ -1109,12 +1114,12 @@ rderror(int unit)
|
||||
printf("0x%x\n", *(u_short *)&sp->c_raw[8]);
|
||||
/* command */
|
||||
printf(" ioc: ");
|
||||
printf("0x%x", *(u_int *)&rs->sc_ioc.c_pad);
|
||||
printf("0x%x", *(u_short *)&rs->sc_ioc.c_hiaddr);
|
||||
printf("0x%x", *(u_int *)&rs->sc_ioc.c_addr);
|
||||
printf("0x%x", *(u_short *)&rs->sc_ioc.c_nop2);
|
||||
printf("0x%x", *(u_int *)&rs->sc_ioc.c_len);
|
||||
printf("0x%x\n", *(u_short *)&rs->sc_ioc.c_cmd);
|
||||
printf("0x%x", *(u_int *)&sc->sc_ioc.c_pad);
|
||||
printf("0x%x", *(u_short *)&sc->sc_ioc.c_hiaddr);
|
||||
printf("0x%x", *(u_int *)&sc->sc_ioc.c_addr);
|
||||
printf("0x%x", *(u_short *)&sc->sc_ioc.c_nop2);
|
||||
printf("0x%x", *(u_int *)&sc->sc_ioc.c_len);
|
||||
printf("0x%x\n", *(u_short *)&sc->sc_ioc.c_cmd);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@ -1146,7 +1151,7 @@ static int
|
||||
rdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
|
||||
{
|
||||
int unit = rdunit(dev);
|
||||
struct rd_softc *sc = rd_cd.cd_devs[unit];
|
||||
struct rd_softc *sc = device_private(rd_cd.cd_devs[unit]);
|
||||
struct disklabel *lp = sc->sc_dkdev.dk_label;
|
||||
int error, flags;
|
||||
|
||||
@ -1235,12 +1240,12 @@ int
|
||||
rdsize(dev_t dev)
|
||||
{
|
||||
int unit = rdunit(dev);
|
||||
struct rd_softc *rs;
|
||||
struct rd_softc *sc;
|
||||
int psize, didopen = 0;
|
||||
|
||||
if (unit >= rd_cd.cd_ndevs ||
|
||||
(rs = rd_cd.cd_devs[unit]) == NULL ||
|
||||
(rs->sc_flags & RDF_ALIVE) == 0)
|
||||
(sc = device_private(rd_cd.cd_devs[unit])) == NULL ||
|
||||
(sc->sc_flags & RDF_ALIVE) == 0)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
@ -1248,13 +1253,13 @@ rdsize(dev_t dev)
|
||||
* without the device being open so we may need
|
||||
* to handle it here.
|
||||
*/
|
||||
if (rs->sc_dkdev.dk_openmask == 0) {
|
||||
if (sc->sc_dkdev.dk_openmask == 0) {
|
||||
if (rdopen(dev, FREAD|FWRITE, S_IFBLK, NULL))
|
||||
return -1;
|
||||
didopen = 1;
|
||||
}
|
||||
psize = rs->sc_dkdev.dk_label->d_partitions[rdpart(dev)].p_size *
|
||||
(rs->sc_dkdev.dk_label->d_secsize / DEV_BSIZE);
|
||||
psize = sc->sc_dkdev.dk_label->d_partitions[rdpart(dev)].p_size *
|
||||
(sc->sc_dkdev.dk_label->d_secsize / DEV_BSIZE);
|
||||
if (didopen)
|
||||
(void)rdclose(dev, FREAD|FWRITE, S_IFBLK, NULL);
|
||||
return psize;
|
||||
@ -1293,7 +1298,7 @@ rddump(dev_t dev, daddr_t blkno, void *va, size_t size)
|
||||
int nwrt; /* current number of sectors to write */
|
||||
int unit, part;
|
||||
int ctlr, slave;
|
||||
struct rd_softc *rs;
|
||||
struct rd_softc *sc;
|
||||
struct disklabel *lp;
|
||||
char stat;
|
||||
|
||||
@ -1308,17 +1313,17 @@ rddump(dev_t dev, daddr_t blkno, void *va, size_t size)
|
||||
|
||||
/* Make sure dump device is ok. */
|
||||
if (unit >= rd_cd.cd_ndevs ||
|
||||
(rs = rd_cd.cd_devs[unit]) == NULL ||
|
||||
(rs->sc_flags & RDF_ALIVE) == 0)
|
||||
(sc = device_private(rd_cd.cd_devs[unit])) == NULL ||
|
||||
(sc->sc_flags & RDF_ALIVE) == 0)
|
||||
return ENXIO;
|
||||
|
||||
ctlr = device_unit(device_parent(&rs->sc_dev));
|
||||
slave = rs->sc_slave;
|
||||
ctlr = device_unit(device_parent(sc->sc_dev));
|
||||
slave = sc->sc_slave;
|
||||
|
||||
/*
|
||||
* Convert to disk sectors. Request must be a multiple of size.
|
||||
*/
|
||||
lp = rs->sc_dkdev.dk_label;
|
||||
lp = sc->sc_dkdev.dk_label;
|
||||
sectorsize = lp->d_secsize;
|
||||
if ((size % sectorsize) != 0)
|
||||
return EFAULT;
|
||||
@ -1341,17 +1346,17 @@ rddump(dev_t dev, daddr_t blkno, void *va, size_t size)
|
||||
/*
|
||||
* Fill out and send HPIB command.
|
||||
*/
|
||||
rs->sc_ioc.c_unit = C_SUNIT(rs->sc_punit);
|
||||
rs->sc_ioc.c_volume = C_SVOL(0);
|
||||
rs->sc_ioc.c_saddr = C_SADDR;
|
||||
rs->sc_ioc.c_hiaddr = 0;
|
||||
rs->sc_ioc.c_addr = RDBTOS(blkno);
|
||||
rs->sc_ioc.c_nop2 = C_NOP;
|
||||
rs->sc_ioc.c_slen = C_SLEN;
|
||||
rs->sc_ioc.c_len = nwrt * sectorsize;
|
||||
rs->sc_ioc.c_cmd = C_WRITE;
|
||||
hpibsend(ctlr, slave, C_CMD, &rs->sc_ioc.c_unit,
|
||||
sizeof(rs->sc_ioc)-2);
|
||||
sc->sc_ioc.c_unit = C_SUNIT(sc->sc_punit);
|
||||
sc->sc_ioc.c_volume = C_SVOL(0);
|
||||
sc->sc_ioc.c_saddr = C_SADDR;
|
||||
sc->sc_ioc.c_hiaddr = 0;
|
||||
sc->sc_ioc.c_addr = RDBTOS(blkno);
|
||||
sc->sc_ioc.c_nop2 = C_NOP;
|
||||
sc->sc_ioc.c_slen = C_SLEN;
|
||||
sc->sc_ioc.c_len = nwrt * sectorsize;
|
||||
sc->sc_ioc.c_cmd = C_WRITE;
|
||||
hpibsend(ctlr, slave, C_CMD, &sc->sc_ioc.c_unit,
|
||||
sizeof(sc->sc_ioc) - 2);
|
||||
if (hpibswait(ctlr, slave))
|
||||
return EIO;
|
||||
|
||||
@ -1365,7 +1370,7 @@ rddump(dev_t dev, daddr_t blkno, void *va, size_t size)
|
||||
return EIO;
|
||||
#else /* RD_DUMP_NOT_TRUSTED */
|
||||
/* Let's just talk about this first... */
|
||||
printf("%s: dump addr %p, blk %d\n", sc->sc_dev.dv_xname,
|
||||
printf("%s: dump addr %p, blk %d\n", device_xname(sc->sc_dev),
|
||||
va, blkno);
|
||||
delay(500 * 1000); /* half a second */
|
||||
#endif /* RD_DUMP_NOT_TRUSTED */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rdvar.h,v 1.17 2005/12/11 12:17:14 christos Exp $ */
|
||||
/* $NetBSD: rdvar.h,v 1.18 2008/03/29 06:47:08 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1990, 1993
|
||||
@ -97,7 +97,7 @@ struct rdstats {
|
||||
};
|
||||
|
||||
struct rd_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
struct disk sc_dkdev;
|
||||
struct callout sc_restart_ch;
|
||||
int sc_slave; /* HP-IB slave */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rtc.c,v 1.18 2007/02/22 14:04:01 tsutsui Exp $ */
|
||||
/* $NetBSD: rtc.c,v 1.19 2008/03/29 06:47:08 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1990, 1993
|
||||
@ -81,7 +81,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.18 2007/02/22 14:04:01 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.19 2008/03/29 06:47:08 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -94,16 +94,16 @@ __KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.18 2007/02/22 14:04:01 tsutsui Exp $");
|
||||
#include <dev/clock_subr.h>
|
||||
|
||||
struct rtc_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
bus_space_tag_t sc_bst;
|
||||
bus_space_handle_t sc_bsh;
|
||||
struct todr_chip_handle sc_handle;
|
||||
};
|
||||
|
||||
static int rtcmatch(struct device *, struct cfdata *, void *);
|
||||
static void rtcattach(struct device *, struct device *, void *aux);
|
||||
static int rtcmatch(device_t, cfdata_t, void *);
|
||||
static void rtcattach(device_t, device_t, void *aux);
|
||||
|
||||
CFATTACH_DECL(rtc, sizeof (struct rtc_softc),
|
||||
CFATTACH_DECL_NEW(rtc, sizeof(struct rtc_softc),
|
||||
rtcmatch, rtcattach, NULL, NULL);
|
||||
|
||||
static int rtc_gettime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
|
||||
@ -113,7 +113,7 @@ static uint8_t rtc_writereg(struct rtc_softc *, int, uint8_t);
|
||||
|
||||
|
||||
static int
|
||||
rtcmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
rtcmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct intio_attach_args *ia = aux;
|
||||
|
||||
@ -124,22 +124,22 @@ rtcmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
rtcattach(struct device *parent, struct device *self, void *aux)
|
||||
rtcattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct rtc_softc *sc = device_private(self);
|
||||
struct intio_attach_args *ia = aux;
|
||||
struct rtc_softc *sc = (struct rtc_softc *)self;
|
||||
struct todr_chip_handle *todr_handle;
|
||||
bus_space_tag_t bst = ia->ia_bst;
|
||||
|
||||
printf("\n");
|
||||
|
||||
sc->sc_dev = self;
|
||||
if (bus_space_map(bst, ia->ia_iobase, INTIO_DEVSIZE, 0,
|
||||
&sc->sc_bsh)) {
|
||||
printf("%s: can't map registers\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error(": can't map registers\n");
|
||||
return;
|
||||
}
|
||||
|
||||
aprint_normal("\n");
|
||||
|
||||
sc->sc_bst = bst;
|
||||
|
||||
todr_handle = &sc->sc_handle;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.88 2007/12/05 12:03:09 tsutsui Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.89 2008/03/29 06:47:08 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 2002 The NetBSD Foundation, Inc.
|
||||
@ -143,7 +143,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.88 2007/12/05 12:03:09 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.89 2008/03/29 06:47:08 tsutsui Exp $");
|
||||
|
||||
#include "hil.h"
|
||||
#include "dvbox.h"
|
||||
@ -285,16 +285,15 @@ static void setbootdev(void);
|
||||
static struct dev_data *dev_data_lookup(struct device *);
|
||||
static void dev_data_insert(struct dev_data *, ddlist_t *);
|
||||
|
||||
static int mainbusmatch(struct device *, struct cfdata *, void *);
|
||||
static void mainbusattach(struct device *, struct device *, void *);
|
||||
static int mainbussearch(struct device *, struct cfdata *,
|
||||
const int *, void *);
|
||||
static int mainbusmatch(device_t, cfdata_t, void *);
|
||||
static void mainbusattach(device_t, device_t, void *);
|
||||
static int mainbussearch(device_t, cfdata_t, const int *, void *);
|
||||
|
||||
CFATTACH_DECL(mainbus, sizeof(struct device),
|
||||
CFATTACH_DECL_NEW(mainbus, 0,
|
||||
mainbusmatch, mainbusattach, NULL, NULL);
|
||||
|
||||
static int
|
||||
mainbusmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
mainbusmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
static int mainbus_matched = 0;
|
||||
|
||||
@ -307,18 +306,17 @@ mainbusmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
}
|
||||
|
||||
static void
|
||||
mainbusattach(struct device *parent, struct device *self, void *aux)
|
||||
mainbusattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
/* Search for and attach children. */
|
||||
config_search_ia(mainbussearch, self, "mainbus", NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
mainbussearch(struct device *parent, struct cfdata *cf, const int *ldesc,
|
||||
void *aux)
|
||||
mainbussearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
|
||||
{
|
||||
|
||||
if (config_match(parent, cf, NULL) > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user