ANSIfy, KNF
This commit is contained in:
parent
0e9d73c741
commit
b095a0d0c5
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: gdrom.c,v 1.7 2002/03/24 18:21:23 uch Exp $ */
|
||||
/* $NetBSD: gdrom.c,v 1.8 2002/03/25 18:59:39 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Marcus Comstedt
|
||||
@ -48,16 +48,16 @@
|
||||
|
||||
#include <machine/sysasicvar.h>
|
||||
|
||||
int gdrommatch __P((struct device *, struct cfdata *, void *));
|
||||
void gdromattach __P((struct device *, struct device *, void *));
|
||||
int gdromopen __P((dev_t, int, int, struct proc *));
|
||||
int gdromclose __P((dev_t, int, int, struct proc *));
|
||||
void gdromstrategy __P((struct buf *));
|
||||
int gdromioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
|
||||
int gdromdump __P((dev_t, daddr_t, caddr_t, size_t));
|
||||
int gdromsize __P((dev_t));
|
||||
int gdromread __P((dev_t, struct uio *, int));
|
||||
int gdromwrite __P((dev_t, struct uio *, int));
|
||||
int gdrommatch(struct device *, struct cfdata *, void *);
|
||||
void gdromattach(struct device *, struct device *, void *);
|
||||
int gdromopen(dev_t, int, int, struct proc *);
|
||||
int gdromclose(dev_t, int, int, struct proc *);
|
||||
void gdromstrategy(struct buf *);
|
||||
int gdromioctl(dev_t, u_long, caddr_t, int, struct proc *);
|
||||
int gdromdump(dev_t, daddr_t, caddr_t, size_t);
|
||||
int gdromsize(dev_t);
|
||||
int gdromread(dev_t, struct uio *, int);
|
||||
int gdromwrite(dev_t, struct uio *, int);
|
||||
|
||||
struct gdrom_softc {
|
||||
struct device sc_dv; /* generic device info; must come first */
|
||||
@ -85,59 +85,58 @@ extern struct cfdriver gdrom_cd;
|
||||
|
||||
|
||||
struct gd_toc {
|
||||
unsigned int entry[99];
|
||||
unsigned int first, last;
|
||||
unsigned int leadout;
|
||||
unsigned int entry[99];
|
||||
unsigned int first, last;
|
||||
unsigned int leadout;
|
||||
};
|
||||
|
||||
#define TOC_LBA(n) ((n)&0xffffff00)
|
||||
#define TOC_ADR(n) ((n)&0x0f)
|
||||
#define TOC_CTRL(n) (((n)&0xf0)>>4)
|
||||
#define TOC_TRACK(n) (((n)&0x0000ff00)>>8)
|
||||
#define TOC_LBA(n) ((n) & 0xffffff00)
|
||||
#define TOC_ADR(n) ((n) & 0x0f)
|
||||
#define TOC_CTRL(n) (((n) & 0xf0) >> 4)
|
||||
#define TOC_TRACK(n) (((n) & 0x0000ff00) >> 8)
|
||||
|
||||
#define GDROM(o) (*(volatile unsigned char *)(0xa05f7000 + (o)))
|
||||
|
||||
#define GDROM(o) (*(volatile unsigned char *)(0xa05f7000+(o)))
|
||||
#define GDSTATSTAT(n) ((n) & 0xf)
|
||||
#define GDSTATDISK(n) (((n) >> 4) & 0xf)
|
||||
|
||||
#define GDSTATSTAT(n) ((n)&0xf)
|
||||
#define GDSTATDISK(n) (((n)>>4)&0xf)
|
||||
|
||||
#define GDROM_BUSY GDROM(0x18)
|
||||
#define GDROM_DATA (*(volatile short *)&GDROM(0x80))
|
||||
#define GDROM_REGX GDROM(0x84)
|
||||
#define GDROM_STAT GDROM(0x8c)
|
||||
#define GDROM_CNTLO GDROM(0x90)
|
||||
#define GDROM_CNTHI GDROM(0x94)
|
||||
#define GDROM_COND GDROM(0x9c)
|
||||
|
||||
int gdrom_getstat __P((void));
|
||||
int gdrom_do_command __P((struct gdrom_softc *sc, void *req, void *buf, unsigned int nbyt));
|
||||
int gdrom_command_sense __P((struct gdrom_softc *sc, void *req, void *buf, unsigned int nbyt));
|
||||
int gdrom_read_toc __P((struct gdrom_softc *sc, struct gd_toc *toc));
|
||||
int gdrom_read_sectors __P((struct gdrom_softc *sc, void *buf, int sector, int cnt));
|
||||
int gdrom_mount_disk __P((struct gdrom_softc *sc));
|
||||
int gdrom_intr __P((void* arg));
|
||||
#define GDROM_BUSY GDROM(0x18)
|
||||
#define GDROM_DATA (*(volatile short *) & GDROM(0x80))
|
||||
#define GDROM_REGX GDROM(0x84)
|
||||
#define GDROM_STAT GDROM(0x8c)
|
||||
#define GDROM_CNTLO GDROM(0x90)
|
||||
#define GDROM_CNTHI GDROM(0x94)
|
||||
#define GDROM_COND GDROM(0x9c)
|
||||
|
||||
int gdrom_getstat(void);
|
||||
int gdrom_do_command(struct gdrom_softc *, void *, void *, unsigned int);
|
||||
int gdrom_command_sense(struct gdrom_softc *, void *, void *, unsigned int);
|
||||
int gdrom_read_toc(struct gdrom_softc *, struct gd_toc *);
|
||||
int gdrom_read_sectors(struct gdrom_softc *, void *, int, int);
|
||||
int gdrom_mount_disk(struct gdrom_softc *);
|
||||
int gdrom_intr(void *);
|
||||
|
||||
int gdrom_getstat()
|
||||
{
|
||||
int s1, s2, s3;
|
||||
|
||||
if(GDROM_BUSY & 0x80) return -1;
|
||||
if (GDROM_BUSY & 0x80)
|
||||
return (-1);
|
||||
s1 = GDROM_STAT;
|
||||
s2 = GDROM_STAT;
|
||||
s3 = GDROM_STAT;
|
||||
if(GDROM_BUSY & 0x80) return -1;
|
||||
if(GDROM_BUSY & 0x80)
|
||||
return (-1);
|
||||
if(s1 == s2)
|
||||
return s1;
|
||||
return (s1);
|
||||
else if(s2 == s3)
|
||||
return s2;
|
||||
return (s2);
|
||||
else
|
||||
return -1;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
int
|
||||
gdrom_intr(arg)
|
||||
void *arg;
|
||||
gdrom_intr(void *arg)
|
||||
{
|
||||
struct gdrom_softc *sc = arg;
|
||||
int s, cond;
|
||||
@ -149,122 +148,120 @@ gdrom_intr(arg)
|
||||
#endif
|
||||
if(!sc->cmd_active) {
|
||||
#ifdef GDROMDEBUG
|
||||
printf("GDROM: inactive IRQ!?\n");
|
||||
printf("GDROM: inactive IRQ!?\n");
|
||||
#endif
|
||||
splx(s);
|
||||
return 0;
|
||||
splx(s);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if((cond & 8)) {
|
||||
int cnt = (GDROM_CNTHI<<8) | GDROM_CNTLO;
|
||||
int cnt = (GDROM_CNTHI << 8) | GDROM_CNTLO;
|
||||
#ifdef GDROMDEBUG
|
||||
printf("GDROM: cnt = %d\n", cnt);
|
||||
#endif
|
||||
sc->cmd_actual += cnt;
|
||||
if(cnt > 0 && sc->cmd_result_size > 0) {
|
||||
int subcnt = (cnt > sc->cmd_result_size?
|
||||
sc->cmd_result_size : cnt);
|
||||
int subcnt = (cnt > sc->cmd_result_size ?
|
||||
sc->cmd_result_size : cnt);
|
||||
int16_t *ptr = sc->cmd_result_buf;
|
||||
sc->cmd_result_buf = ((char *)sc->cmd_result_buf)+subcnt;
|
||||
sc->cmd_result_buf = ((char *)sc->cmd_result_buf) +
|
||||
subcnt;
|
||||
sc->cmd_result_size -= subcnt;
|
||||
cnt -= subcnt;
|
||||
while(subcnt > 0) {
|
||||
*ptr++ = GDROM_DATA;
|
||||
subcnt -= 2;
|
||||
while (subcnt > 0) {
|
||||
*ptr++ = GDROM_DATA;
|
||||
subcnt -= 2;
|
||||
}
|
||||
}
|
||||
while(cnt > 0) {
|
||||
__volatile int16_t tmp;
|
||||
tmp = GDROM_DATA;
|
||||
cnt -= 2;
|
||||
while (cnt > 0) {
|
||||
__volatile int16_t tmp;
|
||||
tmp = GDROM_DATA;
|
||||
cnt -= 2;
|
||||
}
|
||||
}
|
||||
while( GDROM_BUSY & 0x80 );
|
||||
while (GDROM_BUSY & 0x80);
|
||||
|
||||
if(!(cond & 8)) {
|
||||
if ((cond & 8) == 0) {
|
||||
sc->cmd_cond = cond;
|
||||
sc->cmd_active = 0;
|
||||
wakeup(&sc->cmd_active);
|
||||
}
|
||||
|
||||
splx(s);
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
int gdrom_do_command(sc, req, buf, nbyt)
|
||||
struct gdrom_softc *sc;
|
||||
void *req;
|
||||
void *buf;
|
||||
unsigned int nbyt;
|
||||
int gdrom_do_command(struct gdrom_softc *sc, void *req, void *buf,
|
||||
unsigned int nbyt)
|
||||
{
|
||||
int i, s;
|
||||
short *ptr = req;
|
||||
|
||||
while( GDROM_BUSY & 0x88 ) ;
|
||||
if(buf != NULL) {
|
||||
GDROM_CNTLO = nbyt & 0xff;
|
||||
GDROM_CNTHI = (nbyt >> 8) & 0xff;
|
||||
GDROM_REGX = 0;
|
||||
while (GDROM_BUSY & 0x88)
|
||||
;
|
||||
if (buf != NULL) {
|
||||
GDROM_CNTLO = nbyt & 0xff;
|
||||
GDROM_CNTHI = (nbyt >> 8) & 0xff;
|
||||
GDROM_REGX = 0;
|
||||
}
|
||||
sc->cmd_result_buf = buf;
|
||||
sc->cmd_result_size = nbyt;
|
||||
|
||||
if(GDSTATSTAT(GDROM_STAT) == 6)
|
||||
return (-1);
|
||||
if (GDSTATSTAT(GDROM_STAT) == 6)
|
||||
return (-1);
|
||||
|
||||
GDROM_COND = 0xa0;
|
||||
for(i = 0; i < 64; i++) ;
|
||||
while( (GDROM_BUSY & 0x88) != 8 ) ;
|
||||
for (i = 0; i < 64; i++)
|
||||
;
|
||||
while ((GDROM_BUSY & 0x88) != 8)
|
||||
;
|
||||
|
||||
s = splbio();
|
||||
|
||||
sc->cmd_actual = 0;
|
||||
sc->cmd_active = 1;
|
||||
|
||||
for(i = 0; i< 6; i++)
|
||||
GDROM_DATA = ptr[i];
|
||||
for (i = 0; i< 6; i++)
|
||||
GDROM_DATA = ptr[i];
|
||||
|
||||
while(sc->cmd_active)
|
||||
tsleep(&sc->cmd_active, PRIBIO, "gdrom", 0);
|
||||
while (sc->cmd_active)
|
||||
tsleep(&sc->cmd_active, PRIBIO, "gdrom", 0);
|
||||
|
||||
splx(s);
|
||||
|
||||
return sc->cmd_cond;
|
||||
return (sc->cmd_cond);
|
||||
}
|
||||
|
||||
|
||||
int gdrom_command_sense(sc, req, buf, nbyt)
|
||||
struct gdrom_softc *sc;
|
||||
void *req;
|
||||
void *buf;
|
||||
unsigned int nbyt;
|
||||
int gdrom_command_sense(struct gdrom_softc *sc, void *req, void *buf,
|
||||
unsigned int nbyt)
|
||||
{
|
||||
/* 76543210 76543210
|
||||
0 0x13 -
|
||||
2 - bufsz(hi)
|
||||
4 bufsz(lo) -
|
||||
6 - -
|
||||
8 - -
|
||||
10 - - */
|
||||
0 0x13 -
|
||||
2 - bufsz(hi)
|
||||
4 bufsz(lo) -
|
||||
6 - -
|
||||
8 - -
|
||||
10 - - */
|
||||
unsigned short sense_data[5];
|
||||
unsigned char cmd[12];
|
||||
int sense_key, sense_specific;
|
||||
|
||||
int cond = gdrom_do_command(sc, req, buf, nbyt);
|
||||
|
||||
if(cond < 0) {
|
||||
if (cond < 0) {
|
||||
#ifdef GDROMDEBUG
|
||||
printf("GDROM: not ready (2:58)\n");
|
||||
printf("GDROM: not ready (2:58)\n");
|
||||
#endif
|
||||
return EIO;
|
||||
return (EIO);
|
||||
}
|
||||
|
||||
if(!(cond & 1)) {
|
||||
if ((cond & 1) == 0) {
|
||||
#ifdef GDROMDEBUG
|
||||
printf("GDROM: no sense. 0:0\n");
|
||||
printf("GDROM: no sense. 0:0\n");
|
||||
#endif
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
memset(cmd, 0, sizeof(cmd));
|
||||
@ -276,11 +273,11 @@ int gdrom_command_sense(sc, req, buf, nbyt)
|
||||
|
||||
sense_key = sense_data[1] & 0xf;
|
||||
sense_specific = sense_data[4];
|
||||
if(sense_key == 11 && sense_specific == 0) {
|
||||
if (sense_key == 11 && sense_specific == 0) {
|
||||
#ifdef GDROMDEBUG
|
||||
printf("GDROM: aborted (ignored). 0:0\n");
|
||||
printf("GDROM: aborted (ignored). 0:0\n");
|
||||
#endif
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef GDROMDEBUG
|
||||
@ -288,44 +285,38 @@ int gdrom_command_sense(sc, req, buf, nbyt)
|
||||
printf("GDROM: %d\n", sense_specific);
|
||||
#endif
|
||||
|
||||
return (sense_key==0? 0 : EIO);
|
||||
return (sense_key == 0 ? 0 : EIO);
|
||||
}
|
||||
|
||||
int gdrom_read_toc(sc, toc)
|
||||
struct gdrom_softc *sc;
|
||||
struct gd_toc *toc;
|
||||
int gdrom_read_toc(struct gdrom_softc *sc, struct gd_toc *toc)
|
||||
{
|
||||
/* 76543210 76543210
|
||||
0 0x14 -
|
||||
2 - bufsz(hi)
|
||||
4 bufsz(lo) -
|
||||
6 - -
|
||||
8 - -
|
||||
10 - - */
|
||||
0 0x14 -
|
||||
2 - bufsz(hi)
|
||||
4 bufsz(lo) -
|
||||
6 - -
|
||||
8 - -
|
||||
10 - - */
|
||||
unsigned char cmd[12];
|
||||
|
||||
memset(cmd, 0, sizeof(cmd));
|
||||
|
||||
cmd[0] = 0x14;
|
||||
cmd[3] = sizeof(struct gd_toc)>>8;
|
||||
cmd[4] = sizeof(struct gd_toc)&0xff;
|
||||
cmd[3] = sizeof(struct gd_toc) >> 8;
|
||||
cmd[4] = sizeof(struct gd_toc) & 0xff;
|
||||
|
||||
return gdrom_command_sense( sc, cmd, toc, sizeof(struct gd_toc) );
|
||||
return (gdrom_command_sense(sc, cmd, toc, sizeof(struct gd_toc)));
|
||||
}
|
||||
|
||||
int gdrom_read_sectors(sc, buf, sector, cnt)
|
||||
struct gdrom_softc *sc;
|
||||
void *buf;
|
||||
int sector;
|
||||
int cnt;
|
||||
int gdrom_read_sectors(struct gdrom_softc *sc, void *buf, int sector, int cnt)
|
||||
{
|
||||
/* 76543210 76543210
|
||||
0 0x30 datafmt
|
||||
2 sec(hi) sec(mid)
|
||||
4 sec(lo) -
|
||||
6 - -
|
||||
8 cnt(hi) cnt(mid)
|
||||
10 cnt(lo) - */
|
||||
0 0x30 datafmt
|
||||
2 sec(hi) sec(mid)
|
||||
4 sec(lo) -
|
||||
6 - -
|
||||
8 cnt(hi) cnt(mid)
|
||||
10 cnt(lo) - */
|
||||
unsigned char cmd[12];
|
||||
|
||||
memset(cmd, 0, sizeof(cmd));
|
||||
@ -339,19 +330,18 @@ int gdrom_read_sectors(sc, buf, sector, cnt)
|
||||
cmd[9] = cnt>>8;
|
||||
cmd[10] = cnt;
|
||||
|
||||
return gdrom_command_sense( sc, cmd, buf, cnt<<11 );
|
||||
return (gdrom_command_sense(sc, cmd, buf, cnt << 11));
|
||||
}
|
||||
|
||||
int gdrom_mount_disk(sc)
|
||||
struct gdrom_softc *sc;
|
||||
int gdrom_mount_disk(struct gdrom_softc *sc)
|
||||
{
|
||||
/* 76543210 76543210
|
||||
0 0x70 -
|
||||
2 0x1f -
|
||||
4 - -
|
||||
6 - -
|
||||
8 - -
|
||||
10 - - */
|
||||
0 0x70 -
|
||||
2 0x1f -
|
||||
4 - -
|
||||
6 - -
|
||||
8 - -
|
||||
10 - - */
|
||||
unsigned char cmd[12];
|
||||
|
||||
memset(cmd, 0, sizeof(cmd));
|
||||
@ -359,36 +349,29 @@ int gdrom_mount_disk(sc)
|
||||
cmd[0] = 0x70;
|
||||
cmd[1] = 0x1f;
|
||||
|
||||
return gdrom_command_sense( sc, cmd, NULL, 0 );
|
||||
return (gdrom_command_sense(sc, cmd, NULL, 0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
gdrommatch(pdp, cfp, auxp)
|
||||
struct device *pdp;
|
||||
struct cfdata *cfp;
|
||||
void *auxp;
|
||||
gdrommatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
static int gdrom_matched = 0;
|
||||
|
||||
/* Allow only once instance. */
|
||||
if (strcmp("gdrom", cfp->cf_driver->cd_name) || gdrom_matched)
|
||||
return(0);
|
||||
if (strcmp("gdrom", cf->cf_driver->cd_name) || gdrom_matched)
|
||||
return (0);
|
||||
gdrom_matched = 1;
|
||||
|
||||
return(1);
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
gdromattach(pdp, dp, auxp)
|
||||
struct device *pdp, *dp;
|
||||
void *auxp;
|
||||
gdromattach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct gdrom_softc *sc;
|
||||
u_int32_t p, x;
|
||||
|
||||
sc = (struct gdrom_softc *)dp;
|
||||
sc = (struct gdrom_softc *)self;
|
||||
|
||||
BUFQ_INIT(&sc->bufq);
|
||||
|
||||
@ -404,22 +387,15 @@ gdromattach(pdp, dp, auxp)
|
||||
/*
|
||||
* reenable disabled drive
|
||||
*/
|
||||
{
|
||||
register u_int32_t p, x;
|
||||
|
||||
*((volatile u_int32_t *)0xa05f74e4) = 0x1fffff;
|
||||
for(p=0; p<0x200000/4; p++)
|
||||
x = ((volatile u_int32_t *)0xa0000000)[p];
|
||||
}
|
||||
*((__volatile u_int32_t *)0xa05f74e4) = 0x1fffff;
|
||||
for (p = 0; p < 0x200000 / 4; p++)
|
||||
x = ((__volatile u_int32_t *)0xa0000000)[p];
|
||||
|
||||
sysasic_intr_establish(SYSASIC_EVENT_GDROM, gdrom_intr, sc);
|
||||
}
|
||||
|
||||
int
|
||||
gdromopen(dev, flags, devtype, p)
|
||||
dev_t dev;
|
||||
int flags, devtype;
|
||||
struct proc *p;
|
||||
gdromopen(dev_t dev, int flags, int devtype, struct proc *p)
|
||||
{
|
||||
struct gdrom_softc *sc;
|
||||
int s, error, unit, cnt;
|
||||
@ -442,13 +418,13 @@ gdromopen(dev, flags, devtype, p)
|
||||
|
||||
s = splbio();
|
||||
while(sc->is_busy)
|
||||
tsleep(&sc->is_busy, PRIBIO, "gdbusy", 0);
|
||||
tsleep(&sc->is_busy, PRIBIO, "gdbusy", 0);
|
||||
sc->is_busy = 1;
|
||||
splx(s);
|
||||
|
||||
for (cnt = 0; cnt < 5; cnt++)
|
||||
if ((error = gdrom_mount_disk(sc)) == 0)
|
||||
break;
|
||||
if ((error = gdrom_mount_disk(sc)) == 0)
|
||||
break;
|
||||
|
||||
if (!error)
|
||||
error = gdrom_read_toc(sc, &toc);
|
||||
@ -469,10 +445,7 @@ gdromopen(dev, flags, devtype, p)
|
||||
}
|
||||
|
||||
int
|
||||
gdromclose(dev, flags, devtype, p)
|
||||
dev_t dev;
|
||||
int flags, devtype;
|
||||
struct proc *p;
|
||||
gdromclose(dev_t dev, int flags, int devtype, struct proc *p)
|
||||
{
|
||||
struct gdrom_softc *sc;
|
||||
int unit;
|
||||
@ -488,8 +461,7 @@ gdromclose(dev, flags, devtype, p)
|
||||
}
|
||||
|
||||
void
|
||||
gdromstrategy(bp)
|
||||
struct buf *bp;
|
||||
gdromstrategy(struct buf *bp)
|
||||
{
|
||||
struct gdrom_softc *sc;
|
||||
int s, unit, error;
|
||||
@ -501,42 +473,37 @@ gdromstrategy(bp)
|
||||
sc = gdrom_cd.cd_devs[unit];
|
||||
|
||||
if (bp->b_bcount == 0)
|
||||
goto done;
|
||||
goto done;
|
||||
|
||||
bp->b_rawblkno = bp->b_blkno / (2048 / DEV_BSIZE) + sc->openpart_start;
|
||||
|
||||
#ifdef GDROMDEBUG
|
||||
printf("GDROM: read_sectors(%p, %d, %ld) [%ld bytes]\n",
|
||||
bp->b_data, bp->b_rawblkno,
|
||||
bp->b_bcount>>11, bp->b_bcount);
|
||||
bp->b_data, bp->b_rawblkno,
|
||||
bp->b_bcount>>11, bp->b_bcount);
|
||||
#endif
|
||||
s = splbio();
|
||||
while(sc->is_busy)
|
||||
tsleep(&sc->is_busy, PRIBIO, "gdbusy", 0);
|
||||
while (sc->is_busy)
|
||||
tsleep(&sc->is_busy, PRIBIO, "gdbusy", 0);
|
||||
sc->is_busy = 1;
|
||||
splx(s);
|
||||
|
||||
if ((error = gdrom_read_sectors(sc, bp->b_data, bp->b_rawblkno,
|
||||
bp->b_bcount>>11))) {
|
||||
bp->b_error = error;
|
||||
bp->b_flags |= B_ERROR;
|
||||
bp->b_bcount >> 11))) {
|
||||
bp->b_error = error;
|
||||
bp->b_flags |= B_ERROR;
|
||||
}
|
||||
|
||||
sc->is_busy = 0;
|
||||
wakeup(&sc->is_busy);
|
||||
|
||||
done:
|
||||
done:
|
||||
bp->b_resid = bp->b_bcount;
|
||||
biodone(bp);
|
||||
}
|
||||
|
||||
int
|
||||
gdromioctl(dev, cmd, addr, flag, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t addr;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
gdromioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
|
||||
{
|
||||
struct gdrom_softc *sc;
|
||||
int unit, error;
|
||||
@ -549,15 +516,15 @@ gdromioctl(dev, cmd, addr, flag, p)
|
||||
|
||||
switch (cmd) {
|
||||
case CDIOREADMSADDR: {
|
||||
int s, track, sessno = *(int*)addr;
|
||||
int s, track, sessno = *(int *)addr;
|
||||
struct gd_toc toc;
|
||||
|
||||
if (sessno != 0)
|
||||
return (EINVAL);
|
||||
|
||||
s = splbio();
|
||||
while(sc->is_busy)
|
||||
tsleep(&sc->is_busy, PRIBIO, "gdbusy", 0);
|
||||
while (sc->is_busy)
|
||||
tsleep(&sc->is_busy, PRIBIO, "gdbusy", 0);
|
||||
sc->is_busy = 1;
|
||||
splx(s);
|
||||
|
||||
@ -567,24 +534,24 @@ gdromioctl(dev, cmd, addr, flag, p)
|
||||
wakeup(&sc->is_busy);
|
||||
|
||||
if (error)
|
||||
return error;
|
||||
return error;
|
||||
|
||||
for (track = TOC_TRACK(toc.last);
|
||||
track >= TOC_TRACK(toc.first);
|
||||
--track)
|
||||
if (TOC_CTRL(toc.entry[track-1]))
|
||||
break;
|
||||
track >= TOC_TRACK(toc.first);
|
||||
--track)
|
||||
if (TOC_CTRL(toc.entry[track-1]))
|
||||
break;
|
||||
|
||||
if (track < TOC_TRACK(toc.first) || track > 100)
|
||||
return (ENXIO);
|
||||
return (ENXIO);
|
||||
|
||||
*(int*)addr = htonl(TOC_LBA(toc.entry[track-1])) -
|
||||
sc->openpart_start;
|
||||
*(int *)addr = htonl(TOC_LBA(toc.entry[track-1])) -
|
||||
sc->openpart_start;
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
default:
|
||||
return (EINVAL);
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
@ -597,27 +564,21 @@ gdromioctl(dev, cmd, addr, flag, p)
|
||||
* Can't dump to CD; read only media...
|
||||
*/
|
||||
int
|
||||
gdromdump(dev, blkno, va, size)
|
||||
dev_t dev;
|
||||
daddr_t blkno;
|
||||
caddr_t va;
|
||||
size_t size;
|
||||
gdromdump(dev_t dev, daddr_t blkno, caddr_t va, size_t size)
|
||||
{
|
||||
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
int
|
||||
gdromsize(dev)
|
||||
dev_t dev;
|
||||
gdromsize(dev_t dev)
|
||||
{
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
int
|
||||
gdromread(dev, uio, flags)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flags;
|
||||
gdromread(dev_t dev, struct uio *uio, int flags)
|
||||
{
|
||||
#ifdef GDROMDEBUG
|
||||
printf("GDROM: read\n");
|
||||
@ -626,11 +587,8 @@ gdromread(dev, uio, flags)
|
||||
}
|
||||
|
||||
int
|
||||
gdromwrite(dev, uio, flags)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flags;
|
||||
gdromwrite(dev_t dev, struct uio *uio, int flags)
|
||||
{
|
||||
|
||||
return (EROFS);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: maple.c,v 1.11 2002/03/24 18:21:25 uch Exp $ */
|
||||
/* $NetBSD: maple.c,v 1.12 2002/03/25 18:59:40 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Marcus Comstedt
|
||||
@ -66,29 +66,28 @@
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
static int maplematch __P((struct device *, struct cfdata *, void *));
|
||||
static void mapleattach __P((struct device *, struct device *, void *));
|
||||
static int mapleprint __P((void *, const char *));
|
||||
static int maplesubmatch __P((struct device *, struct cfdata *, void *));
|
||||
static void maple_attach_dev __P((struct maple_softc *, int, int));
|
||||
static void maple_begin_txbuf __P((struct maple_softc *));
|
||||
static int maple_end_txbuf __P((struct maple_softc *));
|
||||
static void maple_write_command __P((struct maple_softc *, int, int,
|
||||
int, int, void *));
|
||||
static void maple_scanbus __P((struct maple_softc *));
|
||||
static void maple_callout __P((void *));
|
||||
static void maple_send_commands __P((struct maple_softc *));
|
||||
static void maple_check_responses __P((struct maple_softc *));
|
||||
|
||||
int maple_alloc_dma __P((size_t, vaddr_t *, paddr_t *));
|
||||
void maple_free_dma __P((paddr_t, size_t));
|
||||
|
||||
int mapleopen __P((dev_t, int, int, struct proc *));
|
||||
int mapleclose __P((dev_t, int, int, struct proc *));
|
||||
int maple_internal_ioctl __P((struct maple_softc *, int, int, u_long, caddr_t, int, struct proc *));
|
||||
int mapleioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
|
||||
static int maplematch(struct device *, struct cfdata *, void *);
|
||||
static void mapleattach(struct device *, struct device *, void *);
|
||||
static int mapleprint(void *, const char *);
|
||||
static int maplesubmatch(struct device *, struct cfdata *, void *);
|
||||
static void maple_attach_dev(struct maple_softc *, int, int);
|
||||
static void maple_begin_txbuf(struct maple_softc *);
|
||||
static int maple_end_txbuf(struct maple_softc *);
|
||||
static void maple_write_command(struct maple_softc *, int, int,
|
||||
int, int, void *);
|
||||
static void maple_scanbus(struct maple_softc *);
|
||||
static void maple_callout(void *);
|
||||
static void maple_send_commands(struct maple_softc *);
|
||||
static void maple_check_responses(struct maple_softc *);
|
||||
|
||||
int maple_alloc_dma(size_t, vaddr_t *, paddr_t *);
|
||||
void maple_free_dma(paddr_t, size_t);
|
||||
|
||||
int mapleopen(dev_t, int, int, struct proc *);
|
||||
int mapleclose(dev_t, int, int, struct proc *);
|
||||
int maple_internal_ioctl(struct maple_softc *, int, int, u_long, caddr_t,
|
||||
int, struct proc *);
|
||||
int mapleioctl(dev_t, u_long, caddr_t, int, struct proc *);
|
||||
|
||||
/*
|
||||
* Global variables.
|
||||
@ -105,23 +104,17 @@ struct cfattach maple_ca = {
|
||||
extern struct cfdriver maple_cd;
|
||||
|
||||
static int
|
||||
maplematch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
maplematch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
|
||||
if (strcmp("maple", cf->cf_driver->cd_name))
|
||||
return (0);
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
maple_attach_dev(sc, port, subunit)
|
||||
struct maple_softc *sc;
|
||||
int port;
|
||||
int subunit;
|
||||
maple_attach_dev(struct maple_softc *sc, int port, int subunit)
|
||||
{
|
||||
struct maple_attach_args ma;
|
||||
u_int32_t func;
|
||||
@ -138,30 +131,30 @@ maple_attach_dev(sc, port, subunit)
|
||||
printf("\n");
|
||||
strcpy(oldxname, sc->sc_dev.dv_xname);
|
||||
sprintf(sc->sc_dev.dv_xname, "maple%c", port+'A');
|
||||
if(subunit)
|
||||
sprintf(sc->sc_dev.dv_xname+6, "%d", subunit);
|
||||
for(f=0; f<32; f++, ma.ma_function<<=1)
|
||||
if(func & ma.ma_function)
|
||||
(void) config_found_sm(&sc->sc_dev, &ma,
|
||||
NULL, maplesubmatch);
|
||||
if (subunit)
|
||||
sprintf(sc->sc_dev.dv_xname+6, "%d", subunit);
|
||||
|
||||
for (f = 0; f < 32; f++, ma.ma_function <<= 1)
|
||||
if (func & ma.ma_function)
|
||||
(void)config_found_sm(&sc->sc_dev, &ma,
|
||||
NULL, maplesubmatch);
|
||||
strcpy(sc->sc_dev.dv_xname, oldxname);
|
||||
}
|
||||
|
||||
static void
|
||||
maple_begin_txbuf(sc)
|
||||
struct maple_softc *sc;
|
||||
maple_begin_txbuf(struct maple_softc *sc)
|
||||
{
|
||||
|
||||
sc->sc_txlink = sc->sc_txpos = sc->sc_txbuf;
|
||||
}
|
||||
|
||||
static int
|
||||
maple_end_txbuf(sc)
|
||||
struct maple_softc *sc;
|
||||
maple_end_txbuf(struct maple_softc *sc)
|
||||
{
|
||||
/* if no frame have been written, we can't mark the
|
||||
list end, and so the DMA must not be activated */
|
||||
if (sc->sc_txpos == sc->sc_txbuf)
|
||||
return (0);
|
||||
return (0);
|
||||
|
||||
*sc->sc_txlink |= 0x80000000;
|
||||
|
||||
@ -171,30 +164,25 @@ maple_end_txbuf(sc)
|
||||
static int8_t subunit_code[] = { 0x20, 0x01, 0x02, 0x04, 0x08, 0x10 };
|
||||
|
||||
static void
|
||||
maple_write_command(sc, port, subunit, command, datalen, dataaddr)
|
||||
struct maple_softc *sc;
|
||||
int port;
|
||||
int subunit;
|
||||
int command;
|
||||
int datalen;
|
||||
void *dataaddr;
|
||||
maple_write_command(struct maple_softc *sc, int port, int subunit, int command,
|
||||
int datalen, void *dataaddr)
|
||||
{
|
||||
int to, from;
|
||||
u_int32_t *p = sc->sc_txpos;
|
||||
|
||||
if ((port & ~(MAPLE_PORTS-1)) != 0 ||
|
||||
subunit < 0 || subunit >= MAPLE_SUBUNITS)
|
||||
return;
|
||||
return;
|
||||
|
||||
/* Compute sender and recipient address */
|
||||
from = port << 6;
|
||||
to = from | subunit_code[subunit];
|
||||
|
||||
/* Max data length = 255 longs = 1020 bytes */
|
||||
if(datalen > 255)
|
||||
datalen = 255;
|
||||
else if(datalen < 0)
|
||||
datalen = 0;
|
||||
if (datalen > 255)
|
||||
datalen = 255;
|
||||
else if (datalen < 0)
|
||||
datalen = 0;
|
||||
|
||||
sc->sc_txlink = p;
|
||||
|
||||
@ -211,18 +199,17 @@ maple_write_command(sc, port, subunit, command, datalen, dataaddr)
|
||||
|
||||
/* Copy parameter data, if any */
|
||||
if (datalen > 0) {
|
||||
u_int32_t *param = dataaddr;
|
||||
int i;
|
||||
for (i = 0; i < datalen; i++)
|
||||
*p++ = *param++;
|
||||
u_int32_t *param = dataaddr;
|
||||
int i;
|
||||
for (i = 0; i < datalen; i++)
|
||||
*p++ = *param++;
|
||||
}
|
||||
|
||||
sc->sc_txpos = p;
|
||||
}
|
||||
|
||||
static void
|
||||
maple_scanbus(sc)
|
||||
struct maple_softc *sc;
|
||||
maple_scanbus(struct maple_softc *sc)
|
||||
{
|
||||
int p, s;
|
||||
|
||||
@ -231,71 +218,80 @@ maple_scanbus(sc)
|
||||
maple_begin_txbuf(sc);
|
||||
|
||||
for (p = 0; p < MAPLE_PORTS; p++) {
|
||||
maple_write_command(sc, p, 0, MAPLE_COMMAND_DEVINFO, 0, NULL);
|
||||
maple_write_command(sc, p, 0, MAPLE_COMMAND_DEVINFO, 0, NULL);
|
||||
}
|
||||
|
||||
if (maple_end_txbuf(sc)) {
|
||||
|
||||
MAPLE_DMAADDR = sc->sc_txbuf_phys;
|
||||
MAPLE_STATE = 1;
|
||||
while (MAPLE_STATE != 0)
|
||||
;
|
||||
MAPLE_DMAADDR = sc->sc_txbuf_phys;
|
||||
MAPLE_STATE = 1;
|
||||
while (MAPLE_STATE != 0)
|
||||
;
|
||||
|
||||
for (p = 0; p < MAPLE_PORTS; p++)
|
||||
if ((sc->sc_rxbuf[p][0][0] & 0xff) == MAPLE_RESPONSE_DEVINFO)
|
||||
|
||||
sc->sc_port_units[p] = ((sc->sc_rxbuf[p][0][0]>>15)&0x3e)|1;
|
||||
|
||||
else
|
||||
|
||||
sc->sc_port_units[p] = 0;
|
||||
for (p = 0; p < MAPLE_PORTS; p++)
|
||||
if ((sc->sc_rxbuf[p][0][0] & 0xff) ==
|
||||
MAPLE_RESPONSE_DEVINFO)
|
||||
sc->sc_port_units[p] =
|
||||
((sc->sc_rxbuf[p][0][0] >> 15) & 0x3e) | 1;
|
||||
else
|
||||
sc->sc_port_units[p] = 0;
|
||||
|
||||
|
||||
maple_begin_txbuf(sc);
|
||||
maple_begin_txbuf(sc);
|
||||
|
||||
for (p = 0; p < MAPLE_PORTS; p++) {
|
||||
for (s = 0; s < MAPLE_SUBUNITS; s++) {
|
||||
if (sc->sc_port_units[p] & (1<<s))
|
||||
maple_write_command(sc, p, s, MAPLE_COMMAND_DEVINFO, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (maple_end_txbuf(sc)) {
|
||||
|
||||
MAPLE_DMAADDR = sc->sc_txbuf_phys;
|
||||
MAPLE_STATE = 1;
|
||||
while (MAPLE_STATE != 0)
|
||||
;
|
||||
|
||||
for (p = 0; p < MAPLE_PORTS; p++)
|
||||
for (s = 0; s < MAPLE_SUBUNITS; s++)
|
||||
if (sc->sc_port_units[p] & (1<<s)) {
|
||||
|
||||
if ((sc->sc_rxbuf[p][s][0] & 0xff) ==
|
||||
MAPLE_RESPONSE_DEVINFO) {
|
||||
|
||||
u_int32_t *to_swap;
|
||||
int i;
|
||||
|
||||
memcpy((to_swap = &sc->sc_unit[p][s].devinfo.di_func),
|
||||
sc->sc_rxbuf[p][s]+1, sizeof(struct maple_devinfo));
|
||||
|
||||
for (i = 0; i < 4; i++, to_swap++)
|
||||
*to_swap = ntohl(*to_swap);
|
||||
|
||||
maple_attach_dev(sc, p, s);
|
||||
|
||||
} else {
|
||||
|
||||
printf("%s: no response from port %d subunit %d\n",
|
||||
sc->sc_dev.dv_xname, p, s);
|
||||
|
||||
sc->sc_port_units[p] &= ~(1<<s);
|
||||
|
||||
}
|
||||
for (p = 0; p < MAPLE_PORTS; p++) {
|
||||
for (s = 0; s < MAPLE_SUBUNITS; s++) {
|
||||
if (sc->sc_port_units[p] & (1 << s))
|
||||
maple_write_command(sc, p, s,
|
||||
MAPLE_COMMAND_DEVINFO, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (maple_end_txbuf(sc)) {
|
||||
MAPLE_DMAADDR = sc->sc_txbuf_phys;
|
||||
MAPLE_STATE = 1;
|
||||
while (MAPLE_STATE != 0)
|
||||
;
|
||||
|
||||
for (p = 0; p < MAPLE_PORTS; p++)
|
||||
for (s = 0; s < MAPLE_SUBUNITS; s++)
|
||||
if (sc->sc_port_units[p] & (1 << s)) {
|
||||
|
||||
if ((sc->sc_rxbuf[p][s][0] &
|
||||
0xff) ==
|
||||
MAPLE_RESPONSE_DEVINFO) {
|
||||
|
||||
u_int32_t *to_swap;
|
||||
int i;
|
||||
|
||||
memcpy((to_swap =
|
||||
&sc->sc_unit[p][s].
|
||||
devinfo.di_func),
|
||||
sc->sc_rxbuf[p][s] +
|
||||
1,
|
||||
sizeof(struct
|
||||
maple_devinfo));
|
||||
|
||||
for (i = 0; i < 4; i++,
|
||||
to_swap++)
|
||||
*to_swap =
|
||||
ntohl
|
||||
(*to_swap);
|
||||
maple_attach_dev(sc, p,
|
||||
s);
|
||||
} else {
|
||||
|
||||
printf("%s: no response"
|
||||
" from port %d "
|
||||
" subunit %d\n",
|
||||
sc->sc_dev.dv_xname,
|
||||
p, s);
|
||||
sc->sc_port_units[p] &=
|
||||
~(1 << s);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -304,34 +300,29 @@ maple_scanbus(sc)
|
||||
}
|
||||
|
||||
static void
|
||||
maple_send_commands(sc)
|
||||
struct maple_softc *sc;
|
||||
maple_send_commands(struct maple_softc *sc)
|
||||
{
|
||||
int p, s;
|
||||
|
||||
if (sc->maple_commands_pending || MAPLE_STATE != 0)
|
||||
return;
|
||||
return;
|
||||
|
||||
maple_begin_txbuf(sc);
|
||||
|
||||
for (p = 0; p < MAPLE_PORTS; p++) {
|
||||
|
||||
for (s = 0; s < MAPLE_SUBUNITS; s++) {
|
||||
|
||||
if (sc->sc_unit[p][s].getcond_callback != NULL) {
|
||||
|
||||
u_int32_t func = ntohl(sc->sc_unit[p][s].getcond_func);
|
||||
for (s = 0; s < MAPLE_SUBUNITS; s++) {
|
||||
if (sc->sc_unit[p][s].getcond_callback != NULL) {
|
||||
u_int32_t func =
|
||||
ntohl(sc->sc_unit[p][s].getcond_func);
|
||||
|
||||
maple_write_command(sc, p, s, MAPLE_COMMAND_GETCOND, 1, &func);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
maple_write_command(sc, p, s,
|
||||
MAPLE_COMMAND_GETCOND, 1, &func);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!maple_end_txbuf(sc))
|
||||
return;
|
||||
return;
|
||||
|
||||
MAPLE_DMAADDR = sc->sc_txbuf_phys;
|
||||
MAPLE_STATE = 1;
|
||||
@ -340,58 +331,52 @@ maple_send_commands(sc)
|
||||
}
|
||||
|
||||
static void
|
||||
maple_check_responses(sc)
|
||||
struct maple_softc *sc;
|
||||
maple_check_responses(struct maple_softc *sc)
|
||||
{
|
||||
int p, s;
|
||||
|
||||
if (!sc->maple_commands_pending || MAPLE_STATE != 0)
|
||||
return;
|
||||
return;
|
||||
|
||||
for (p = 0; p < MAPLE_PORTS; p++) {
|
||||
for (s = 0; s < MAPLE_SUBUNITS; s++) {
|
||||
struct maple_unit * u = &sc->sc_unit[p][s];
|
||||
if (u->getcond_callback != NULL &&
|
||||
(sc->sc_rxbuf[p][s][0] & 0xff) == MAPLE_RESPONSE_DATATRF &&
|
||||
(sc->sc_rxbuf[p][s][0]>>24) >= 1 &&
|
||||
htonl(sc->sc_rxbuf[p][s][1]) == u->getcond_func) {
|
||||
(*u->getcond_callback)(u->getcond_data,
|
||||
(void *)(sc->sc_rxbuf[p][s]+2),
|
||||
((sc->sc_rxbuf[p][s][0]>>22)&1020)-4);
|
||||
}
|
||||
}
|
||||
for (s = 0; s < MAPLE_SUBUNITS; s++) {
|
||||
struct maple_unit *u = &sc->sc_unit[p][s];
|
||||
if (u->getcond_callback != NULL &&
|
||||
(sc->sc_rxbuf[p][s][0] & 0xff) ==
|
||||
MAPLE_RESPONSE_DATATRF &&
|
||||
(sc->sc_rxbuf[p][s][0] >> 24) >= 1 &&
|
||||
htonl(sc->sc_rxbuf[p][s][1]) == u->getcond_func) {
|
||||
(*u->getcond_callback)(u->getcond_data,
|
||||
(void *)(sc->sc_rxbuf[p][s] + 2),
|
||||
((sc->sc_rxbuf[p][s][0] >> 22) & 1020) - 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sc->maple_commands_pending = 0;
|
||||
}
|
||||
|
||||
void
|
||||
maple_run_polling(dev)
|
||||
struct device *dev;
|
||||
maple_run_polling(struct device *dev)
|
||||
{
|
||||
struct maple_softc *sc;
|
||||
|
||||
sc = (struct maple_softc *)dev;
|
||||
|
||||
if (MAPLE_STATE != 0)
|
||||
return;
|
||||
return;
|
||||
|
||||
maple_send_commands(sc);
|
||||
|
||||
while (MAPLE_STATE != 0)
|
||||
;
|
||||
;
|
||||
|
||||
maple_check_responses(sc);
|
||||
}
|
||||
|
||||
void
|
||||
maple_set_condition_callback(dev, port, subunit, func, callback, data)
|
||||
struct device *dev;
|
||||
int port;
|
||||
int subunit;
|
||||
u_int32_t func;
|
||||
void (*callback)(void *, void *, int);
|
||||
void *data;
|
||||
maple_set_condition_callback(struct device *dev, int port, int subunit,
|
||||
u_int32_t func, void (*callback)(void *, void *, int), void *data)
|
||||
{
|
||||
struct maple_softc *sc;
|
||||
|
||||
@ -399,7 +384,7 @@ maple_set_condition_callback(dev, port, subunit, func, callback, data)
|
||||
|
||||
if ((port & ~(MAPLE_PORTS-1)) != 0 ||
|
||||
subunit < 0 || subunit >= MAPLE_SUBUNITS)
|
||||
return;
|
||||
return;
|
||||
|
||||
sc->sc_unit[port][subunit].getcond_func = func;
|
||||
sc->sc_unit[port][subunit].getcond_callback = callback;
|
||||
@ -407,31 +392,23 @@ maple_set_condition_callback(dev, port, subunit, func, callback, data)
|
||||
}
|
||||
|
||||
static void
|
||||
maple_callout(ctx)
|
||||
void *ctx;
|
||||
maple_callout(void *ctx)
|
||||
{
|
||||
struct maple_softc *sc = ctx;
|
||||
|
||||
if(!maple_polling) {
|
||||
|
||||
maple_check_responses(sc);
|
||||
|
||||
maple_send_commands(sc);
|
||||
|
||||
if (!maple_polling) {
|
||||
maple_check_responses(sc);
|
||||
maple_send_commands(sc);
|
||||
}
|
||||
|
||||
callout_reset(&sc->maple_callout_ch, MAPLE_CALLOUT_TICKS,
|
||||
(void *)maple_callout, sc);
|
||||
(void *)maple_callout, sc);
|
||||
}
|
||||
|
||||
int
|
||||
maple_alloc_dma(size, vap, pap)
|
||||
size_t size;
|
||||
vaddr_t *vap;
|
||||
paddr_t *pap;
|
||||
maple_alloc_dma(size_t size, vaddr_t *vap, paddr_t *pap)
|
||||
{
|
||||
extern paddr_t avail_start, avail_end; /* from pmap.c */
|
||||
|
||||
struct pglist mlist;
|
||||
struct vm_page *m;
|
||||
int error;
|
||||
@ -452,9 +429,7 @@ maple_alloc_dma(size, vap, pap)
|
||||
}
|
||||
|
||||
void
|
||||
maple_free_dma(paddr, size)
|
||||
paddr_t paddr;
|
||||
size_t size;
|
||||
maple_free_dma(paddr_t paddr, size_t size)
|
||||
{
|
||||
struct pglist mlist;
|
||||
struct vm_page *m;
|
||||
@ -469,9 +444,7 @@ maple_free_dma(paddr, size)
|
||||
}
|
||||
|
||||
static void
|
||||
mapleattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
mapleattach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct maple_softc *sc;
|
||||
vaddr_t dmabuffer;
|
||||
@ -484,20 +457,19 @@ mapleattach(parent, self, aux)
|
||||
printf("\n");
|
||||
|
||||
if (maple_alloc_dma(MAPLE_DMABUF_SIZE, &dmabuffer, &dmabuffer_phys)) {
|
||||
printf("%s: unable to allocate DMA buffers.\n", sc->sc_dev.dv_xname);
|
||||
return;
|
||||
printf("%s: unable to allocate DMA buffers.\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
p = (u_int32_t *) dmabuffer;
|
||||
p = (u_int32_t *)dmabuffer;
|
||||
|
||||
for (i = 0; i < MAPLE_PORTS; i++)
|
||||
for (j = 0; j < MAPLE_SUBUNITS; j++) {
|
||||
|
||||
sc->sc_rxbuf[i][j] = p;
|
||||
sc->sc_rxbuf_phys[i][j] = SH3_P2SEG_TO_PHYS(p);
|
||||
p += 256;
|
||||
|
||||
}
|
||||
for (j = 0; j < MAPLE_SUBUNITS; j++) {
|
||||
sc->sc_rxbuf[i][j] = p;
|
||||
sc->sc_rxbuf_phys[i][j] = SH3_P2SEG_TO_PHYS(p);
|
||||
p += 256;
|
||||
}
|
||||
|
||||
sc->sc_txbuf = p;
|
||||
sc->sc_txbuf_phys = SH3_P2SEG_TO_PHYS(p);
|
||||
@ -516,13 +488,11 @@ mapleattach(parent, self, aux)
|
||||
memset(&sc->maple_callout_ch, 0, sizeof(sc->maple_callout_ch));
|
||||
|
||||
callout_reset(&sc->maple_callout_ch, MAPLE_CALLOUT_TICKS,
|
||||
(void *)maple_callout, sc);
|
||||
(void *)maple_callout, sc);
|
||||
}
|
||||
|
||||
int
|
||||
mapleprint(aux, pnp)
|
||||
void *aux;
|
||||
const char *pnp;
|
||||
mapleprint(void *aux, const char *pnp)
|
||||
{
|
||||
struct maple_attach_args *ma = aux;
|
||||
|
||||
@ -539,17 +509,14 @@ mapleprint(aux, pnp)
|
||||
printf(" subunit %d", ma->ma_subunit);
|
||||
|
||||
printf(": %.*s",
|
||||
(int)sizeof(ma->ma_devinfo->di_product_name),
|
||||
ma->ma_devinfo->di_product_name);
|
||||
(int)sizeof(ma->ma_devinfo->di_product_name),
|
||||
ma->ma_devinfo->di_product_name);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
maplesubmatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
maplesubmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct maple_attach_args *ma = aux;
|
||||
|
||||
@ -565,30 +532,26 @@ maplesubmatch(parent, match, aux)
|
||||
}
|
||||
|
||||
u_int32_t
|
||||
maple_get_function_data(devinfo, function_code)
|
||||
struct maple_devinfo *devinfo;
|
||||
u_int32_t function_code;
|
||||
maple_get_function_data(struct maple_devinfo *devinfo, u_int32_t function_code)
|
||||
{
|
||||
int i, p = 0;
|
||||
|
||||
for (i = 31; i >= 0; --i)
|
||||
if (devinfo->di_func & (1U<<i)) {
|
||||
if (function_code & (1U<<i))
|
||||
return devinfo->di_function_data[p];
|
||||
else
|
||||
if (++p >= 3)
|
||||
break;
|
||||
}
|
||||
if (devinfo->di_func & (1U << i)) {
|
||||
if (function_code & (1U << i))
|
||||
return devinfo->di_function_data[p];
|
||||
else
|
||||
if (++p >= 3)
|
||||
break;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Generic maple device interface */
|
||||
|
||||
int
|
||||
mapleopen(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag, mode;
|
||||
struct proc *p;
|
||||
mapleopen(dev_t dev, int flag, int mode, struct proc *p)
|
||||
{
|
||||
struct maple_softc *sc;
|
||||
|
||||
@ -602,42 +565,33 @@ mapleopen(dev, flag, mode, p)
|
||||
if (MAPLESUBUNIT(dev) >= MAPLE_SUBUNITS)
|
||||
return (ENXIO);
|
||||
|
||||
if(!(sc->sc_port_units[MAPLEPORT(dev)] & (1<<MAPLESUBUNIT(dev))))
|
||||
if (!(sc->sc_port_units[MAPLEPORT(dev)] & (1 << MAPLESUBUNIT(dev))))
|
||||
return (ENXIO);
|
||||
|
||||
sc->sc_port_units_open[MAPLEPORT(dev)] |= 1<<MAPLESUBUNIT(dev);
|
||||
sc->sc_port_units_open[MAPLEPORT(dev)] |= 1 << MAPLESUBUNIT(dev);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
mapleclose(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag, mode;
|
||||
struct proc *p;
|
||||
mapleclose(dev_t dev, int flag, int mode, struct proc *p)
|
||||
{
|
||||
struct maple_softc *sc;
|
||||
|
||||
sc = device_lookup(&maple_cd, MAPLEBUSUNIT(dev));
|
||||
|
||||
sc->sc_port_units_open[MAPLEPORT(dev)] &= ~(1<<MAPLESUBUNIT(dev));
|
||||
sc->sc_port_units_open[MAPLEPORT(dev)] &= ~(1 << MAPLESUBUNIT(dev));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
maple_internal_ioctl(sc, port, subunit, cmd, data, flag, p)
|
||||
struct maple_softc *sc;
|
||||
int port;
|
||||
int subunit;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
maple_internal_ioctl(struct maple_softc *sc, int port, int subunit, u_long cmd,
|
||||
caddr_t data, int flag, struct proc *p)
|
||||
{
|
||||
struct maple_unit *u = &sc->sc_unit[port][subunit];
|
||||
|
||||
if(!(sc->sc_port_units[port] & (1<<subunit)))
|
||||
if (!(sc->sc_port_units[port] & (1 << subunit)))
|
||||
return (ENXIO);
|
||||
|
||||
switch(cmd) {
|
||||
@ -650,17 +604,12 @@ maple_internal_ioctl(sc, port, subunit, cmd, data, flag, p)
|
||||
}
|
||||
|
||||
int
|
||||
mapleioctl(dev, cmd, data, flag, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
mapleioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
{
|
||||
struct maple_softc *sc;
|
||||
|
||||
sc = device_lookup(&maple_cd, MAPLEBUSUNIT(dev));
|
||||
|
||||
return maple_internal_ioctl(sc, MAPLEPORT(dev), MAPLESUBUNIT(dev),
|
||||
cmd, data, flag, p);
|
||||
return (maple_internal_ioctl(sc, MAPLEPORT(dev), MAPLESUBUNIT(dev),
|
||||
cmd, data, flag, p));
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: maple.h,v 1.3 2001/05/26 19:04:39 marcus Exp $ */
|
||||
/* $NetBSD: maple.h,v 1.4 2002/03/25 18:59:40 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Marcus Comstedt
|
||||
* All rights reserved.
|
||||
@ -94,9 +95,10 @@ struct maple_unit {
|
||||
struct maple_devinfo devinfo;
|
||||
};
|
||||
|
||||
extern void maple_set_condition_callback __P((struct device *, int, int, u_int32_t, void (*)(void *, void *, int), void *));
|
||||
extern u_int32_t maple_get_function_data __P((struct maple_devinfo *, u_int32_t));
|
||||
extern void maple_run_polling __P((struct device *));
|
||||
extern void maple_set_condition_callback(struct device *, int, int,
|
||||
u_int32_t, void (*)(void *, void *, int), void *);
|
||||
extern u_int32_t maple_get_function_data(struct maple_devinfo *, u_int32_t);
|
||||
extern void maple_run_polling(struct device *);
|
||||
|
||||
#endif /* _DREAMCAST_DEV_MAPLE_MAPLE_H_ */
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: mapleconf.h,v 1.3 2001/05/26 19:04:39 marcus Exp $ */
|
||||
/* $NetBSD: mapleconf.h,v 1.4 2002/03/25 18:59:40 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Marcus Comstedt
|
||||
* All rights reserved.
|
||||
@ -32,7 +33,7 @@
|
||||
*/
|
||||
|
||||
struct maple_attach_args {
|
||||
int ma_port, ma_subunit;
|
||||
u_int32_t ma_function;
|
||||
struct maple_devinfo *ma_devinfo;
|
||||
int ma_port, ma_subunit;
|
||||
u_int32_t ma_function;
|
||||
struct maple_devinfo *ma_devinfo;
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: maplereg.h,v 1.2 2001/01/21 22:45:58 marcus Exp $ */
|
||||
/* $NetBSD: maplereg.h,v 1.3 2002/03/25 18:59:40 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Marcus Comstedt
|
||||
@ -32,7 +32,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define MAPLE_DMAADDR (*(volatile paddr_t *) 0xa05f6c04)
|
||||
#define MAPLE_DMAADDR (*(volatile paddr_t *) 0xa05f6c04)
|
||||
#define MAPLE_RESET2 (*(volatile u_int32_t *) 0xa05f6c10)
|
||||
#define MAPLE_ENABLE (*(volatile u_int32_t *) 0xa05f6c14)
|
||||
#define MAPLE_STATE (*(volatile u_int32_t *) 0xa05f6c18)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mkbd.c,v 1.12 2002/03/17 19:40:37 atatat Exp $ */
|
||||
/* $NetBSD: mkbd.c,v 1.13 2002/03/25 18:59:40 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Marcus Comstedt
|
||||
@ -56,16 +56,15 @@
|
||||
#include <dreamcast/dev/maple/mkbdvar.h>
|
||||
#include <dreamcast/dev/maple/mkbdmap.h>
|
||||
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
static int mkbdmatch __P((struct device *, struct cfdata *, void *));
|
||||
static void mkbdattach __P((struct device *, struct device *, void *));
|
||||
static int mkbdmatch(struct device *, struct cfdata *, void *);
|
||||
static void mkbdattach(struct device *, struct device *, void *);
|
||||
|
||||
int mkbd_enable __P((void *, int));
|
||||
void mkbd_set_leds __P((void *, int));
|
||||
int mkbd_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
|
||||
int mkbd_enable(void *, int);
|
||||
void mkbd_set_leds(void *, int);
|
||||
int mkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
|
||||
|
||||
struct wskbd_accessops mkbd_accessops = {
|
||||
mkbd_enable,
|
||||
@ -73,11 +72,11 @@ struct wskbd_accessops mkbd_accessops = {
|
||||
mkbd_ioctl,
|
||||
};
|
||||
|
||||
static void mkbd_intr __P((struct mkbd_softc *, struct mkbd_condition *, int));
|
||||
static void mkbd_intr(struct mkbd_softc *, struct mkbd_condition *, int);
|
||||
|
||||
void mkbd_cngetc __P((void *, u_int *, int *));
|
||||
void mkbd_cnpollc __P((void *, int));
|
||||
int mkbd_cnattach __P((void));
|
||||
void mkbd_cngetc(void *, u_int *, int *);
|
||||
void mkbd_cnpollc(void *, int);
|
||||
int mkbd_cnattach(void);
|
||||
|
||||
struct wskbd_consops mkbd_consops = {
|
||||
mkbd_cngetc,
|
||||
@ -99,20 +98,15 @@ struct cfattach mkbd_ca = {
|
||||
};
|
||||
|
||||
static int
|
||||
mkbdmatch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
mkbdmatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct maple_attach_args *ma = aux;
|
||||
|
||||
return (ma->ma_function & MAPLE_FUNC_KEYBOARD) != 0;
|
||||
return ((ma->ma_function & MAPLE_FUNC_KEYBOARD) != 0);
|
||||
}
|
||||
|
||||
static void
|
||||
mkbdattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
mkbdattach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct mkbd_softc *sc = (struct mkbd_softc *) self;
|
||||
struct maple_attach_args *ma = aux;
|
||||
@ -157,56 +151,44 @@ mkbdattach(parent, self, aux)
|
||||
#endif
|
||||
|
||||
maple_set_condition_callback(parent, sc->sc_port, sc->sc_subunit,
|
||||
MAPLE_FUNC_KEYBOARD,
|
||||
(void (*) (void *, void *, int)) mkbd_intr,
|
||||
sc);
|
||||
MAPLE_FUNC_KEYBOARD,(void (*) (void *, void *, int)) mkbd_intr, sc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
mkbd_enable(v, on)
|
||||
void *v;
|
||||
int on;
|
||||
mkbd_enable(void *v, int on)
|
||||
{
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
mkbd_set_leds(v, on)
|
||||
void *v;
|
||||
int on;
|
||||
mkbd_set_leds(void *v, int on)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
mkbd_ioctl(v, cmd, data, flag, p)
|
||||
void *v;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
mkbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
{
|
||||
|
||||
switch (cmd) {
|
||||
case WSKBDIO_GTYPE:
|
||||
*(int *) data = WSKBD_TYPE_USB; /* XXX */
|
||||
return 0;
|
||||
return (0);
|
||||
case WSKBDIO_SETLEDS:
|
||||
return 0;
|
||||
return (0);
|
||||
case WSKBDIO_GETLEDS:
|
||||
*(int *) data = 0;
|
||||
return 0;
|
||||
return (0);
|
||||
case WSKBDIO_BELL:
|
||||
case WSKBDIO_COMPLEXBELL:
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
return EPASSTHROUGH;
|
||||
return (EPASSTHROUGH);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mkbd_cnattach()
|
||||
{
|
||||
@ -214,7 +196,7 @@ mkbd_cnattach()
|
||||
wskbd_cnattach(&mkbd_consops, NULL, &mkbd_keymapdata);
|
||||
mkbd_console_initted = 1;
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int polledkey;
|
||||
@ -223,28 +205,25 @@ extern int maple_polling;
|
||||
#define SHIFT_KEYCODE_BASE 0xe0
|
||||
#define UP_KEYCODE_FLAG 0x1000
|
||||
|
||||
#define KEY_UP(n) do { \
|
||||
if (maple_polling) \
|
||||
polledkey = (n)|UP_KEYCODE_FLAG; \
|
||||
else \
|
||||
wskbd_input(sc->sc_wskbddev, WSCONS_EVENT_KEY_UP, (n)); \
|
||||
} while (0)
|
||||
#define KEY_UP(n) do { \
|
||||
if (maple_polling) \
|
||||
polledkey = (n)|UP_KEYCODE_FLAG; \
|
||||
else \
|
||||
wskbd_input(sc->sc_wskbddev, WSCONS_EVENT_KEY_UP, (n)); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define KEY_DOWN(n) do { \
|
||||
if (maple_polling) \
|
||||
polledkey = (n); \
|
||||
else \
|
||||
#define KEY_DOWN(n) do { \
|
||||
if (maple_polling) \
|
||||
polledkey = (n); \
|
||||
else \
|
||||
wskbd_input(sc->sc_wskbddev, WSCONS_EVENT_KEY_DOWN, (n)); \
|
||||
} while (0)
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define SHIFT_UP(n) KEY_UP((n)|SHIFT_KEYCODE_BASE)
|
||||
#define SHIFT_DOWN(n) KEY_DOWN((n)|SHIFT_KEYCODE_BASE)
|
||||
#define SHIFT_UP(n) KEY_UP((n) | SHIFT_KEYCODE_BASE)
|
||||
#define SHIFT_DOWN(n) KEY_DOWN((n) | SHIFT_KEYCODE_BASE)
|
||||
|
||||
static void
|
||||
mkbd_intr(sc, kbddata, sz)
|
||||
struct mkbd_softc *sc;
|
||||
struct mkbd_condition *kbddata;
|
||||
int sz;
|
||||
mkbd_intr(struct mkbd_softc *sc, struct mkbd_condition *kbddata, int sz)
|
||||
{
|
||||
|
||||
if (sz >= sizeof(struct mkbd_condition)) {
|
||||
@ -282,10 +261,7 @@ mkbd_intr(sc, kbddata, sz)
|
||||
}
|
||||
|
||||
void
|
||||
mkbd_cngetc(v, type, data)
|
||||
void *v;
|
||||
u_int *type;
|
||||
int *data;
|
||||
mkbd_cngetc(void *v, u_int *type,int *data)
|
||||
{
|
||||
int key;
|
||||
|
||||
@ -308,8 +284,6 @@ mkbd_cngetc(v, type, data)
|
||||
}
|
||||
|
||||
void
|
||||
mkbd_cnpollc(v, on)
|
||||
void *v;
|
||||
int on;
|
||||
mkbd_cnpollc(void *v, int on)
|
||||
{
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mkbdvar.h,v 1.2 2001/01/21 22:45:58 marcus Exp $ */
|
||||
/* $NetBSD: mkbdvar.h,v 1.3 2002/03/25 18:59:40 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Marcus Comstedt
|
||||
@ -50,5 +50,5 @@ struct mkbd_softc {
|
||||
struct mkbd_condition sc_condition;
|
||||
};
|
||||
|
||||
int mkbd_cnattach __P((void));
|
||||
int mkbd_cnattach(void);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bus.h,v 1.5 2001/07/19 15:32:13 thorpej Exp $ */
|
||||
/* $NetBSD: bus.h,v 1.6 2002/03/25 18:59:40 uch Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 2000, 2001 The NetBSD Foundation, Inc.
|
||||
@ -505,33 +505,33 @@ struct dreamcast_bus_dma_tag {
|
||||
/*
|
||||
* DMA mapping methods.
|
||||
*/
|
||||
int (*_dmamap_create) __P((bus_dma_tag_t, bus_size_t, int,
|
||||
bus_size_t, bus_size_t, int, bus_dmamap_t *));
|
||||
void (*_dmamap_destroy) __P((bus_dma_tag_t, bus_dmamap_t));
|
||||
int (*_dmamap_load) __P((bus_dma_tag_t, bus_dmamap_t, void *,
|
||||
bus_size_t, struct proc *, int));
|
||||
int (*_dmamap_load_mbuf) __P((bus_dma_tag_t, bus_dmamap_t,
|
||||
struct mbuf *, int));
|
||||
int (*_dmamap_load_uio) __P((bus_dma_tag_t, bus_dmamap_t,
|
||||
struct uio *, int));
|
||||
int (*_dmamap_load_raw) __P((bus_dma_tag_t, bus_dmamap_t,
|
||||
bus_dma_segment_t *, int, bus_size_t, int));
|
||||
void (*_dmamap_unload) __P((bus_dma_tag_t, bus_dmamap_t));
|
||||
void (*_dmamap_sync) __P((bus_dma_tag_t, bus_dmamap_t,
|
||||
bus_addr_t, bus_size_t, int));
|
||||
int (*_dmamap_create)(bus_dma_tag_t, bus_size_t, int,
|
||||
bus_size_t, bus_size_t, int, bus_dmamap_t *);
|
||||
void (*_dmamap_destroy)(bus_dma_tag_t, bus_dmamap_t);
|
||||
int (*_dmamap_load)(bus_dma_tag_t, bus_dmamap_t, void *,
|
||||
bus_size_t, struct proc *, int);
|
||||
int (*_dmamap_load_mbuf)(bus_dma_tag_t, bus_dmamap_t,
|
||||
struct mbuf *, int);
|
||||
int (*_dmamap_load_uio)(bus_dma_tag_t, bus_dmamap_t,
|
||||
struct uio *, int);
|
||||
int (*_dmamap_load_raw)(bus_dma_tag_t, bus_dmamap_t,
|
||||
bus_dma_segment_t *, int, bus_size_t, int);
|
||||
void (*_dmamap_unload)(bus_dma_tag_t, bus_dmamap_t);
|
||||
void (*_dmamap_sync)(bus_dma_tag_t, bus_dmamap_t,
|
||||
bus_addr_t, bus_size_t, int);
|
||||
|
||||
/*
|
||||
* DMA memory utility functions.
|
||||
*/
|
||||
int (*_dmamem_alloc) __P((bus_dma_tag_t, bus_size_t, bus_size_t,
|
||||
bus_size_t, bus_dma_segment_t *, int, int *, int));
|
||||
void (*_dmamem_free) __P((bus_dma_tag_t,
|
||||
bus_dma_segment_t *, int));
|
||||
int (*_dmamem_map) __P((bus_dma_tag_t, bus_dma_segment_t *,
|
||||
int, size_t, caddr_t *, int));
|
||||
void (*_dmamem_unmap) __P((bus_dma_tag_t, caddr_t, size_t));
|
||||
paddr_t (*_dmamem_mmap) __P((bus_dma_tag_t, bus_dma_segment_t *,
|
||||
int, off_t, int, int));
|
||||
int (*_dmamem_alloc)(bus_dma_tag_t, bus_size_t, bus_size_t,
|
||||
bus_size_t, bus_dma_segment_t *, int, int *, int);
|
||||
void (*_dmamem_free)(bus_dma_tag_t,
|
||||
bus_dma_segment_t *, int);
|
||||
int (*_dmamem_map)(bus_dma_tag_t, bus_dma_segment_t *,
|
||||
int, size_t, caddr_t *, int);
|
||||
void (*_dmamem_unmap)(bus_dma_tag_t, caddr_t, size_t);
|
||||
paddr_t (*_dmamem_mmap)(bus_dma_tag_t, bus_dma_segment_t *,
|
||||
int, off_t, int, int);
|
||||
};
|
||||
|
||||
#define bus_dmamap_create(t, s, n, m, b, f, p) \
|
||||
|
Loading…
Reference in New Issue
Block a user