Split device_t/softc for mpu(4) and its attachments, plus other
related cosmetic changes. Reviewed by cube@.
This commit is contained in:
parent
e410e26f27
commit
0ab2da71ce
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpu_acpi.c,v 1.7 2007/10/19 11:59:35 ad Exp $ */
|
||||
/* $NetBSD: mpu_acpi.c,v 1.8 2008/03/27 10:22:00 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Jared D. McNeill <jmcneill@invisible.ca>
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_acpi.c,v 1.7 2007/10/19 11:59:35 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_acpi.c,v 1.8 2008/03/27 10:22:00 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -51,14 +51,14 @@ __KERNEL_RCSID(0, "$NetBSD: mpu_acpi.c,v 1.7 2007/10/19 11:59:35 ad Exp $");
|
|||
|
||||
#include <dev/ic/mpuvar.h>
|
||||
|
||||
static int mpu_acpi_match(struct device *, struct cfdata *, void *);
|
||||
static void mpu_acpi_attach(struct device *, struct device *, void *);
|
||||
static int mpu_acpi_match(device_t, cfdata_t, void *);
|
||||
static void mpu_acpi_attach(device_t, device_t, void *);
|
||||
|
||||
struct mpu_acpi_softc {
|
||||
struct mpu_softc sc_mpu;
|
||||
};
|
||||
|
||||
CFATTACH_DECL(mpu_acpi, sizeof(struct mpu_acpi_softc), mpu_acpi_match,
|
||||
CFATTACH_DECL_NEW(mpu_acpi, sizeof(struct mpu_acpi_softc), mpu_acpi_match,
|
||||
mpu_acpi_attach, NULL, NULL);
|
||||
|
||||
/*
|
||||
|
@ -74,8 +74,7 @@ static const char * const mpu_acpi_ids[] = {
|
|||
* mpu_acpi_match: autoconf(9) match routine
|
||||
*/
|
||||
static int
|
||||
mpu_acpi_match(struct device *parent, struct cfdata *match,
|
||||
void *aux)
|
||||
mpu_acpi_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct acpi_attach_args *aa = aux;
|
||||
|
||||
|
@ -89,9 +88,9 @@ mpu_acpi_match(struct device *parent, struct cfdata *match,
|
|||
* mpu_acpi_attach: autoconf(9) attach routine
|
||||
*/
|
||||
static void
|
||||
mpu_acpi_attach(struct device *parent, struct device *self, void *aux)
|
||||
mpu_acpi_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct mpu_acpi_softc *asc = (struct mpu_acpi_softc *)self;
|
||||
struct mpu_acpi_softc *asc = device_private(self);
|
||||
struct mpu_softc *sc = &asc->sc_mpu;
|
||||
struct acpi_attach_args *aa = aux;
|
||||
struct acpi_resources res;
|
||||
|
@ -103,7 +102,7 @@ mpu_acpi_attach(struct device *parent, struct device *self, void *aux)
|
|||
aprint_normal("\n");
|
||||
|
||||
/* parse resources */
|
||||
rv = acpi_resource_parse(&sc->sc_dev, aa->aa_node->ad_handle, "_CRS",
|
||||
rv = acpi_resource_parse(self, aa->aa_node->ad_handle, "_CRS",
|
||||
&res, &acpi_resource_parse_ops_default);
|
||||
if (ACPI_FAILURE(rv))
|
||||
return;
|
||||
|
@ -111,26 +110,26 @@ mpu_acpi_attach(struct device *parent, struct device *self, void *aux)
|
|||
/* find our i/o registers */
|
||||
io = acpi_res_io(&res, 0);
|
||||
if (io == NULL) {
|
||||
aprint_error("%s: unable to find i/o register resource\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error_dev(self,
|
||||
"unable to find i/o register resource\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* find our IRQ */
|
||||
irq = acpi_res_irq(&res, 0);
|
||||
if (irq == NULL) {
|
||||
aprint_error("%s: unable to find irq resource\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error_dev(self, "unable to find irq resource\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
sc->iot = aa->aa_iot;
|
||||
if (bus_space_map(sc->iot, io->ar_base, io->ar_length, 0, &sc->ioh)) {
|
||||
aprint_error("%s: can't map i/o space\n", sc->sc_dev.dv_xname);
|
||||
aprint_error_dev(self, "can't map i/o space\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
sc->model = "Roland MPU-401 MIDI UART";
|
||||
sc->sc_dev = self;
|
||||
mpu_attach(sc);
|
||||
|
||||
sc->arg = isa_intr_establish(aa->aa_ic, irq->ar_irq,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpu.c,v 1.15 2007/10/19 11:59:57 ad Exp $ */
|
||||
/* $NetBSD: mpu.c,v 1.16 2008/03/27 10:22:01 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu.c,v 1.15 2007/10/19 11:59:57 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu.c,v 1.16 2008/03/27 10:22:01 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -78,16 +78,16 @@ int mpudebug = 0;
|
|||
|
||||
#define MPU_GETSTATUS(iot, ioh) (bus_space_read_1(iot, ioh, MPU_STATUS))
|
||||
|
||||
int mpu_reset(struct mpu_softc *);
|
||||
static int mpu_reset(struct mpu_softc *);
|
||||
static inline int mpu_waitready(struct mpu_softc *);
|
||||
void mpu_readinput(struct mpu_softc *);
|
||||
static void mpu_readinput(struct mpu_softc *);
|
||||
|
||||
int mpu_open(void *, int,
|
||||
static int mpu_open(void *, int,
|
||||
void (*iintr)(void *, int),
|
||||
void (*ointr)(void *), void *arg);
|
||||
void mpu_close(void *);
|
||||
int mpu_output(void *, int);
|
||||
void mpu_getinfo(void *, struct midi_info *);
|
||||
static void mpu_close(void *);
|
||||
static int mpu_output(void *, int);
|
||||
static void mpu_getinfo(void *, struct midi_info *);
|
||||
|
||||
const struct midi_hw_if mpu_midi_hw_if = {
|
||||
mpu_open,
|
||||
|
@ -98,11 +98,10 @@ const struct midi_hw_if mpu_midi_hw_if = {
|
|||
};
|
||||
|
||||
int
|
||||
mpu_find(sc)
|
||||
struct mpu_softc *sc;
|
||||
mpu_find(struct mpu_softc *sc)
|
||||
{
|
||||
if (MPU_GETSTATUS(sc->iot, sc->ioh) == 0xff) {
|
||||
DPRINTF(("mpu_find: No status\n"));
|
||||
DPRINTF(("%s: No status\n", __func__));
|
||||
goto bad;
|
||||
}
|
||||
sc->open = 0;
|
||||
|
@ -114,15 +113,13 @@ bad:
|
|||
}
|
||||
|
||||
void
|
||||
mpu_attach(sc)
|
||||
struct mpu_softc *sc;
|
||||
mpu_attach(struct mpu_softc *sc)
|
||||
{
|
||||
midi_attach_mi(&mpu_midi_hw_if, sc, &sc->sc_dev);
|
||||
midi_attach_mi(&mpu_midi_hw_if, sc, sc->sc_dev);
|
||||
}
|
||||
|
||||
static inline int
|
||||
mpu_waitready(sc)
|
||||
struct mpu_softc *sc;
|
||||
mpu_waitready(struct mpu_softc *sc)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -134,9 +131,8 @@ mpu_waitready(sc)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
mpu_reset(sc)
|
||||
struct mpu_softc *sc;
|
||||
static int
|
||||
mpu_reset(struct mpu_softc *sc)
|
||||
{
|
||||
bus_space_tag_t iot = sc->iot;
|
||||
bus_space_handle_t ioh = sc->ioh;
|
||||
|
@ -144,7 +140,7 @@ mpu_reset(sc)
|
|||
int s;
|
||||
|
||||
if (mpu_waitready(sc)) {
|
||||
DPRINTF(("mpu_reset: not ready\n"));
|
||||
DPRINTF(("%s: not ready\n", __func__));
|
||||
return EIO;
|
||||
}
|
||||
s = splaudio(); /* Don't let the interrupt get our ACK. */
|
||||
|
@ -157,17 +153,17 @@ mpu_reset(sc)
|
|||
}
|
||||
}
|
||||
splx(s);
|
||||
DPRINTF(("mpu_reset: No ACK\n"));
|
||||
DPRINTF(("%s: No ACK\n", __func__));
|
||||
return EIO;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
mpu_open(void *addr, int flags, void (*iintr)(void *, int),
|
||||
void (*ointr)(void *), void *arg)
|
||||
{
|
||||
struct mpu_softc *sc = addr;
|
||||
|
||||
DPRINTF(("mpu_open: sc=%p\n", sc));
|
||||
DPRINTF(("%s: sc=%p\n", __func__, sc));
|
||||
|
||||
if (sc->open)
|
||||
return EBUSY;
|
||||
|
@ -190,13 +186,12 @@ mpu_open(void *addr, int flags, void (*iintr)(void *, int),
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
mpu_close(addr)
|
||||
void *addr;
|
||||
static void
|
||||
mpu_close(void *addr)
|
||||
{
|
||||
struct mpu_softc *sc = addr;
|
||||
|
||||
DPRINTF(("mpu_close: sc=%p\n", sc));
|
||||
DPRINTF(("%s: sc=%p\n", __func__, sc));
|
||||
|
||||
sc->open = 0;
|
||||
sc->intr = 0;
|
||||
|
@ -208,9 +203,8 @@ mpu_close(addr)
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
mpu_readinput(sc)
|
||||
struct mpu_softc *sc;
|
||||
static void
|
||||
mpu_readinput(struct mpu_softc *sc)
|
||||
{
|
||||
bus_space_tag_t iot = sc->iot;
|
||||
bus_space_handle_t ioh = sc->ioh;
|
||||
|
@ -218,38 +212,34 @@ mpu_readinput(sc)
|
|||
|
||||
while(!(MPU_GETSTATUS(iot, ioh) & MPU_INPUT_EMPTY)) {
|
||||
data = bus_space_read_1(iot, ioh, MPU_DATA);
|
||||
DPRINTFN(3, ("mpu_rea: sc=%p 0x%02x\n", sc, data));
|
||||
DPRINTFN(3, ("%s: sc=%p 0x%02x\n", __func__, sc, data));
|
||||
if (sc->intr)
|
||||
sc->intr(sc->arg, data);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
mpu_output(addr, d)
|
||||
void *addr;
|
||||
int d;
|
||||
static int
|
||||
mpu_output(void *addr, int d)
|
||||
{
|
||||
struct mpu_softc *sc = addr;
|
||||
int s;
|
||||
|
||||
DPRINTFN(3, ("mpu_output: sc=%p 0x%02x\n", sc, d));
|
||||
DPRINTFN(3, ("%s: sc=%p 0x%02x\n", __func__, sc, d));
|
||||
if (!(MPU_GETSTATUS(sc->iot, sc->ioh) & MPU_INPUT_EMPTY)) {
|
||||
s = splaudio();
|
||||
mpu_readinput(sc);
|
||||
splx(s);
|
||||
}
|
||||
if (mpu_waitready(sc)) {
|
||||
DPRINTF(("mpu_output: not ready\n"));
|
||||
DPRINTF(("%s:: not ready\n", __func__));
|
||||
return EIO;
|
||||
}
|
||||
bus_space_write_1(sc->iot, sc->ioh, MPU_DATA, d);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
mpu_getinfo(addr, mi)
|
||||
void *addr;
|
||||
struct midi_info *mi;
|
||||
static void
|
||||
mpu_getinfo(void *addr, struct midi_info *mi)
|
||||
{
|
||||
struct mpu_softc *sc = addr;
|
||||
|
||||
|
@ -258,16 +248,15 @@ mpu_getinfo(addr, mi)
|
|||
}
|
||||
|
||||
int
|
||||
mpu_intr(addr)
|
||||
void *addr;
|
||||
mpu_intr(void *addr)
|
||||
{
|
||||
struct mpu_softc *sc = addr;
|
||||
|
||||
if (MPU_GETSTATUS(sc->iot, sc->ioh) & MPU_INPUT_EMPTY) {
|
||||
DPRINTF(("mpu_intr: no data\n"));
|
||||
return (0);
|
||||
DPRINTF(("%s: no data\n", __func__));
|
||||
return 0;
|
||||
} else {
|
||||
mpu_readinput(sc);
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpuvar.h,v 1.8 2005/12/11 12:21:28 christos Exp $ */
|
||||
/* $NetBSD: mpuvar.h,v 1.9 2008/03/27 10:22:01 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
struct mpu_softc {
|
||||
struct device sc_dev; /* base device */
|
||||
device_t sc_dev; /* base device */
|
||||
bus_space_tag_t iot; /* tag */
|
||||
bus_space_handle_t ioh; /* handle */
|
||||
const char *model;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpu_isa.c,v 1.17 2007/10/19 12:00:21 ad Exp $ */
|
||||
/* $NetBSD: mpu_isa.c,v 1.18 2008/03/27 10:22:01 xtraeme Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_isa.c,v 1.17 2007/10/19 12:00:21 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_isa.c,v 1.18 2008/03/27 10:22:01 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -56,42 +56,42 @@ __KERNEL_RCSID(0, "$NetBSD: mpu_isa.c,v 1.17 2007/10/19 12:00:21 ad Exp $");
|
|||
#include <dev/ic/mpuvar.h>
|
||||
|
||||
struct mpu_isa_softc {
|
||||
device_t sc_dev;
|
||||
struct mpu_softc sc_mpu; /* generic part */
|
||||
void *sc_ih; /* ISA interrupt handler */
|
||||
};
|
||||
|
||||
int mpu_isa_match(struct device *, struct cfdata *, void *);
|
||||
void mpu_isa_attach(struct device *, struct device *, void *);
|
||||
static int mpu_isa_match(device_t, cfdata_t, void *);
|
||||
static void mpu_isa_attach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(mpu_isa, sizeof(struct mpu_isa_softc),
|
||||
CFATTACH_DECL_NEW(mpu_isa, sizeof(struct mpu_isa_softc),
|
||||
mpu_isa_match, mpu_isa_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
mpu_isa_match(struct device *parent, struct cfdata *match,
|
||||
void *aux)
|
||||
static int
|
||||
mpu_isa_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct isa_attach_args *ia = aux;
|
||||
struct mpu_isa_softc sc;
|
||||
int r;
|
||||
|
||||
if (ia->ia_nio < 1)
|
||||
return (0);
|
||||
return 0;
|
||||
if (ia->ia_nirq < 1)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (ISA_DIRECT_CONFIG(ia))
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (ia->ia_io[0].ir_addr == ISA_UNKNOWN_PORT)
|
||||
return (0);
|
||||
return 0;
|
||||
if (ia->ia_irq[0].ir_irq == ISA_UNKNOWN_IRQ)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
memset(&sc, 0, sizeof sc);
|
||||
sc.sc_mpu.iot = ia->ia_iot;
|
||||
if (bus_space_map(sc.sc_mpu.iot, ia->ia_io[0].ir_addr, MPU401_NPORT, 0,
|
||||
&sc.sc_mpu.ioh))
|
||||
return (0);
|
||||
return 0;
|
||||
r = mpu_find(&sc.sc_mpu);
|
||||
bus_space_unmap(sc.sc_mpu.iot, sc.sc_mpu.ioh, MPU401_NPORT);
|
||||
if (r) {
|
||||
|
@ -103,16 +103,16 @@ mpu_isa_match(struct device *parent, struct cfdata *match,
|
|||
ia->ia_niomem = 0;
|
||||
ia->ia_ndrq = 0;
|
||||
}
|
||||
return (r);
|
||||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
mpu_isa_attach(struct device *parent, struct device *self, void *aux)
|
||||
static void
|
||||
mpu_isa_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct mpu_isa_softc *sc = (struct mpu_isa_softc *)self;
|
||||
struct mpu_isa_softc *sc = device_private(self);
|
||||
struct isa_attach_args *ia = aux;
|
||||
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
if (bus_space_map(sc->sc_mpu.iot, ia->ia_io[0].ir_addr, MPU401_NPORT,
|
||||
0, &sc->sc_mpu.ioh)) {
|
||||
|
@ -124,5 +124,6 @@ mpu_isa_attach(struct device *parent, struct device *self, void *aux)
|
|||
IST_EDGE, IPL_AUDIO, mpu_intr, sc);
|
||||
|
||||
sc->sc_mpu.model = "Roland MPU-401 MIDI UART";
|
||||
sc->sc_dev = self;
|
||||
mpu_attach(&sc->sc_mpu);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpu_sb.c,v 1.13 2008/03/15 21:09:02 cube Exp $ */
|
||||
/* $NetBSD: mpu_sb.c,v 1.14 2008/03/27 10:22:01 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_sb.c,v 1.13 2008/03/15 21:09:02 cube Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_sb.c,v 1.14 2008/03/27 10:22:01 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -57,28 +57,28 @@ __KERNEL_RCSID(0, "$NetBSD: mpu_sb.c,v 1.13 2008/03/15 21:09:02 cube Exp $");
|
|||
#include <dev/isa/isavar.h>
|
||||
#include <dev/isa/sbdspvar.h>
|
||||
|
||||
int mpu_sb_match(device_t, cfdata_t, void *);
|
||||
void mpu_sb_attach(device_t, device_t, void *);
|
||||
static int mpu_sb_match(device_t, cfdata_t, void *);
|
||||
static void mpu_sb_attach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(mpu_sb, sizeof(struct mpu_softc),
|
||||
CFATTACH_DECL_NEW(mpu_sb, sizeof(struct mpu_softc),
|
||||
mpu_sb_match, mpu_sb_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
static int
|
||||
mpu_sb_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct audio_attach_args *aa = (struct audio_attach_args *)aux;
|
||||
struct audio_attach_args *aa = aux;
|
||||
struct sbdsp_softc *ssc = device_private(parent);
|
||||
struct mpu_softc sc;
|
||||
|
||||
if (aa->type != AUDIODEV_TYPE_MPU)
|
||||
return (0);
|
||||
return 0;
|
||||
memset(&sc, 0, sizeof sc);
|
||||
sc.ioh = ssc->sc_mpu_ioh;
|
||||
sc.iot = ssc->sc_mpu_iot;
|
||||
return (mpu_find(&sc));
|
||||
return mpu_find(&sc);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
mpu_sb_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct sbdsp_softc *ssc = device_private(parent);
|
||||
|
@ -89,6 +89,7 @@ mpu_sb_attach(device_t parent, device_t self, void *aux)
|
|||
sc->ioh = ssc->sc_mpu_ioh;
|
||||
sc->iot = ssc->sc_mpu_iot;
|
||||
sc->model = "SB MPU-401 MIDI UART";
|
||||
sc->sc_dev = self;
|
||||
|
||||
mpu_attach(sc);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpu_ym.c,v 1.13 2007/10/19 12:00:21 ad Exp $ */
|
||||
/* $NetBSD: mpu_ym.c,v 1.14 2008/03/27 10:22:01 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_ym.c,v 1.13 2007/10/19 12:00:21 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_ym.c,v 1.14 2008/03/27 10:22:01 xtraeme Exp $");
|
||||
|
||||
#define NMPU_YM 1
|
||||
|
||||
|
@ -62,20 +62,20 @@ __KERNEL_RCSID(0, "$NetBSD: mpu_ym.c,v 1.13 2007/10/19 12:00:21 ad Exp $");
|
|||
#include <dev/isa/ymvar.h>
|
||||
#include <dev/ic/mpuvar.h>
|
||||
|
||||
int mpu_ym_match(struct device *, struct cfdata *, void *);
|
||||
void mpu_ym_attach(struct device *, struct device *, void *);
|
||||
static int mpu_ym_match(device_t, cfdata_t, void *);
|
||||
static void mpu_ym_attach(device_t, device_t, void *);
|
||||
#ifndef AUDIO_NO_POWER_CTL
|
||||
int mpu_ym_power_ctl(void *, int);
|
||||
static int mpu_ym_power_ctl(void *, int);
|
||||
#endif
|
||||
|
||||
CFATTACH_DECL(mpu_ym, sizeof(struct mpu_softc),
|
||||
CFATTACH_DECL_NEW(mpu_ym, sizeof(struct mpu_softc),
|
||||
mpu_ym_match, mpu_ym_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
mpu_ym_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
static int
|
||||
mpu_ym_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct audio_attach_args *aa = (struct audio_attach_args *)aux;
|
||||
struct ym_softc *ssc = (struct ym_softc *)parent;
|
||||
struct audio_attach_args *aa = aux;
|
||||
struct ym_softc *ssc = device_private(parent);
|
||||
struct mpu_softc sc;
|
||||
|
||||
if (aa->type != AUDIODEV_TYPE_MPU || ssc->sc_mpu_ioh == 0)
|
||||
|
@ -83,16 +83,16 @@ mpu_ym_match(struct device *parent, struct cfdata *match, void *aux)
|
|||
memset(&sc, 0, sizeof sc);
|
||||
sc.ioh = ssc->sc_mpu_ioh;
|
||||
sc.iot = ssc->sc_iot;
|
||||
return (mpu_find(&sc));
|
||||
return mpu_find(&sc);
|
||||
}
|
||||
|
||||
void
|
||||
mpu_ym_attach(struct device *parent, struct device *self, void *aux)
|
||||
static void
|
||||
mpu_ym_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct ym_softc *ssc = (struct ym_softc *)parent;
|
||||
struct mpu_softc *sc = (struct mpu_softc *)self;
|
||||
struct ym_softc *ssc = device_private(parent);
|
||||
struct mpu_softc *sc = device_private(self);
|
||||
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
sc->ioh = ssc->sc_mpu_ioh;
|
||||
sc->iot = ssc->sc_iot;
|
||||
|
@ -102,15 +102,14 @@ mpu_ym_attach(struct device *parent, struct device *self, void *aux)
|
|||
#endif
|
||||
sc->model = YM_IS_SA3(ssc) ?
|
||||
"OPL3-SA3 MPU-401 MIDI UART" : "OPL3-SA2 MPU-401 MIDI UART";
|
||||
sc->sc_dev = self;
|
||||
|
||||
mpu_attach(sc);
|
||||
}
|
||||
|
||||
#ifndef AUDIO_NO_POWER_CTL
|
||||
int
|
||||
mpu_ym_power_ctl(arg, onoff)
|
||||
void *arg;
|
||||
int onoff;
|
||||
static int
|
||||
mpu_ym_power_ctl(void *arg, int onoff)
|
||||
{
|
||||
struct ym_softc *ssc = arg;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $NetBSD: mpu_isapnp.c,v 1.16 2007/10/19 12:00:33 ad Exp $ */
|
||||
/* $NetBSD: mpu_isapnp.c,v 1.17 2008/03/27 10:22:01 xtraeme Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_isapnp.c,v 1.16 2007/10/19 12:00:33 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_isapnp.c,v 1.17 2008/03/27 10:22:01 xtraeme Exp $");
|
||||
|
||||
#include "midi.h"
|
||||
|
||||
|
@ -29,43 +29,39 @@ __KERNEL_RCSID(0, "$NetBSD: mpu_isapnp.c,v 1.16 2007/10/19 12:00:33 ad Exp $");
|
|||
|
||||
#include <dev/ic/mpuvar.h>
|
||||
|
||||
int mpu_isapnp_match(struct device *, struct cfdata *, void *);
|
||||
void mpu_isapnp_attach(struct device *, struct device *, void *);
|
||||
static int mpu_isapnp_match(device_t, cfdata_t, void *);
|
||||
static void mpu_isapnp_attach(device_t, device_t, void *);
|
||||
|
||||
struct mpu_isapnp_softc {
|
||||
struct device sc_dev;
|
||||
void *sc_ih;
|
||||
|
||||
struct mpu_softc sc_mpu;
|
||||
};
|
||||
|
||||
CFATTACH_DECL(mpu_isapnp, sizeof(struct mpu_isapnp_softc),
|
||||
CFATTACH_DECL_NEW(mpu_isapnp, sizeof(struct mpu_isapnp_softc),
|
||||
mpu_isapnp_match, mpu_isapnp_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
mpu_isapnp_match(struct device *parent, struct cfdata *match,
|
||||
void *aux)
|
||||
static int
|
||||
mpu_isapnp_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
int pri, variant;
|
||||
|
||||
pri = isapnp_devmatch(aux, &isapnp_mpu_devinfo, &variant);
|
||||
if (pri && variant > 0)
|
||||
pri = 0;
|
||||
return (pri);
|
||||
return pri;
|
||||
}
|
||||
|
||||
void
|
||||
mpu_isapnp_attach(struct device *parent, struct device *self,
|
||||
void *aux)
|
||||
static void
|
||||
mpu_isapnp_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct mpu_isapnp_softc *sc = device_private(self);
|
||||
struct isapnp_attach_args *ipa = aux;
|
||||
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
if (isapnp_config(ipa->ipa_iot, ipa->ipa_memt, ipa)) {
|
||||
printf("%s: error in region allocation\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error_dev(self, "error in region allocation\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -73,16 +69,16 @@ mpu_isapnp_attach(struct device *parent, struct device *self,
|
|||
sc->sc_mpu.ioh = ipa->ipa_io[0].h;
|
||||
|
||||
if (!mpu_find(&sc->sc_mpu)) {
|
||||
printf("%s: find failed\n", sc->sc_dev.dv_xname);
|
||||
aprint_error_dev(self, "find failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("%s: %s %s\n", sc->sc_dev.dv_xname, ipa->ipa_devident,
|
||||
aprint_normal_dev(self, "%s %s\n", ipa->ipa_devident,
|
||||
ipa->ipa_devclass);
|
||||
|
||||
sc->sc_mpu.model = "Roland MPU-401 MIDI UART";
|
||||
|
||||
midi_attach_mi(&mpu_midi_hw_if, &sc->sc_mpu, &sc->sc_dev);
|
||||
midi_attach_mi(&mpu_midi_hw_if, &sc->sc_mpu, self);
|
||||
|
||||
sc->sc_ih = isa_intr_establish(ipa->ipa_ic, ipa->ipa_irq[0].num,
|
||||
ipa->ipa_irq[0].type, IPL_AUDIO, mpu_intr, &sc->sc_mpu);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpu_cmpci.c,v 1.13 2007/10/19 12:00:52 ad Exp $ */
|
||||
/* $NetBSD: mpu_cmpci.c,v 1.14 2008/03/27 10:22:01 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_cmpci.c,v 1.13 2007/10/19 12:00:52 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_cmpci.c,v 1.14 2008/03/27 10:22:01 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -60,34 +60,35 @@ __KERNEL_RCSID(0, "$NetBSD: mpu_cmpci.c,v 1.13 2007/10/19 12:00:52 ad Exp $");
|
|||
#include <dev/pci/cmpcivar.h>
|
||||
|
||||
static int
|
||||
mpu_cmpci_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
mpu_cmpci_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct audio_attach_args *aa = (struct audio_attach_args *)aux;
|
||||
struct cmpci_softc *ysc = (struct cmpci_softc *)parent;
|
||||
struct audio_attach_args *aa = aux;
|
||||
struct cmpci_softc *ysc = device_private(parent);
|
||||
struct mpu_softc sc;
|
||||
|
||||
if (aa->type != AUDIODEV_TYPE_MPU)
|
||||
return (0);
|
||||
return 0;
|
||||
memset(&sc, 0, sizeof sc);
|
||||
sc.iot = ysc->sc_iot;
|
||||
sc.ioh = ysc->sc_mpu_ioh;
|
||||
return (mpu_find(&sc));
|
||||
return mpu_find(&sc);
|
||||
}
|
||||
|
||||
static void
|
||||
mpu_cmpci_attach(struct device *parent, struct device *self, void *aux)
|
||||
mpu_cmpci_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct cmpci_softc *ysc = (struct cmpci_softc *)parent;
|
||||
struct mpu_softc *sc = (struct mpu_softc *)self;
|
||||
struct cmpci_softc *ysc = device_private(parent);
|
||||
struct mpu_softc *sc = device_private(self);
|
||||
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
sc->iot = ysc->sc_iot;
|
||||
sc->ioh = ysc->sc_mpu_ioh;
|
||||
sc->model = "CMPCI MPU-401 MIDI UART";
|
||||
sc->sc_dev = self;
|
||||
|
||||
mpu_attach(sc);
|
||||
}
|
||||
|
||||
CFATTACH_DECL(mpu_cmpci, sizeof (struct mpu_softc),
|
||||
CFATTACH_DECL_NEW(mpu_cmpci, sizeof (struct mpu_softc),
|
||||
mpu_cmpci_match, mpu_cmpci_attach, NULL, NULL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpu_eso.c,v 1.14 2007/10/19 12:00:52 ad Exp $ */
|
||||
/* $NetBSD: mpu_eso.c,v 1.15 2008/03/27 10:22:01 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_eso.c,v 1.14 2007/10/19 12:00:52 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_eso.c,v 1.15 2008/03/27 10:22:01 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -61,34 +61,35 @@ __KERNEL_RCSID(0, "$NetBSD: mpu_eso.c,v 1.14 2007/10/19 12:00:52 ad Exp $");
|
|||
#include <dev/pci/esovar.h>
|
||||
|
||||
static int
|
||||
mpu_eso_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
mpu_eso_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct audio_attach_args *aa = (struct audio_attach_args *)aux;
|
||||
struct eso_softc *esc = (struct eso_softc *)parent;
|
||||
struct audio_attach_args *aa = aux;
|
||||
struct eso_softc *esc = device_private(parent);
|
||||
struct mpu_softc sc;
|
||||
|
||||
if (aa->type != AUDIODEV_TYPE_MPU)
|
||||
return (0);
|
||||
return 0;
|
||||
memset(&sc, 0, sizeof sc);
|
||||
sc.ioh = esc->sc_mpu_ioh;
|
||||
sc.iot = esc->sc_mpu_iot;
|
||||
return (mpu_find(&sc));
|
||||
return mpu_find(&sc);
|
||||
}
|
||||
|
||||
static void
|
||||
mpu_eso_attach(struct device *parent, struct device *self, void *aux)
|
||||
mpu_eso_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct eso_softc *esc = (struct eso_softc *)parent;
|
||||
struct mpu_softc *sc = (struct mpu_softc *)self;
|
||||
struct eso_softc *esc = device_private(parent);
|
||||
struct mpu_softc *sc = device_private(self);
|
||||
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
sc->ioh = esc->sc_mpu_ioh;
|
||||
sc->iot = esc->sc_mpu_iot;
|
||||
sc->model = "ESO MPU-401 MIDI UART";
|
||||
sc->sc_dev = self;
|
||||
|
||||
mpu_attach(sc);
|
||||
}
|
||||
|
||||
CFATTACH_DECL(mpu_eso, sizeof (struct mpu_softc),
|
||||
CFATTACH_DECL_NEW(mpu_eso, sizeof (struct mpu_softc),
|
||||
mpu_eso_match, mpu_eso_attach, NULL, NULL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpu_fms.c,v 1.14 2007/10/19 12:00:52 ad Exp $ */
|
||||
/* $NetBSD: mpu_fms.c,v 1.15 2008/03/27 10:22:01 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_fms.c,v 1.14 2007/10/19 12:00:52 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_fms.c,v 1.15 2008/03/27 10:22:01 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -62,34 +62,35 @@ __KERNEL_RCSID(0, "$NetBSD: mpu_fms.c,v 1.14 2007/10/19 12:00:52 ad Exp $");
|
|||
#include <dev/pci/fmsvar.h>
|
||||
|
||||
static int
|
||||
mpu_fms_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
mpu_fms_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct audio_attach_args *aa = (struct audio_attach_args *)aux;
|
||||
struct fms_softc *ssc = (struct fms_softc *)parent;
|
||||
struct audio_attach_args *aa = aux;
|
||||
struct fms_softc *ssc = device_private(parent);
|
||||
struct mpu_softc sc;
|
||||
|
||||
if (aa->type != AUDIODEV_TYPE_MPU)
|
||||
return (0);
|
||||
return 0;
|
||||
memset(&sc, 0, sizeof sc);
|
||||
sc.ioh = ssc->sc_mpu_ioh;
|
||||
sc.iot = ssc->sc_iot;
|
||||
return (mpu_find(&sc));
|
||||
return mpu_find(&sc);
|
||||
}
|
||||
|
||||
static void
|
||||
mpu_fms_attach(struct device *parent, struct device *self, void *aux)
|
||||
mpu_fms_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct fms_softc *ssc = (struct fms_softc *)parent;
|
||||
struct mpu_softc *sc = (struct mpu_softc *)self;
|
||||
struct fms_softc *ssc = device_private(parent);
|
||||
struct mpu_softc *sc = device_private(self);
|
||||
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
sc->ioh = ssc->sc_mpu_ioh;
|
||||
sc->iot = ssc->sc_iot;
|
||||
sc->model = "FM801 MPU-401 MIDI UART";
|
||||
sc->sc_dev = self;
|
||||
|
||||
mpu_attach(sc);
|
||||
}
|
||||
|
||||
CFATTACH_DECL(mpu_fms, sizeof (struct mpu_softc),
|
||||
CFATTACH_DECL_NEW(mpu_fms, sizeof (struct mpu_softc),
|
||||
mpu_fms_match, mpu_fms_attach, NULL, NULL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpu_yds.c,v 1.13 2007/10/19 12:00:52 ad Exp $ */
|
||||
/* $NetBSD: mpu_yds.c,v 1.14 2008/03/27 10:22:01 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_yds.c,v 1.13 2007/10/19 12:00:52 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mpu_yds.c,v 1.14 2008/03/27 10:22:01 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -63,27 +63,27 @@ __KERNEL_RCSID(0, "$NetBSD: mpu_yds.c,v 1.13 2007/10/19 12:00:52 ad Exp $");
|
|||
#include <dev/pci/ydsvar.h>
|
||||
|
||||
static int
|
||||
mpu_yds_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
mpu_yds_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct audio_attach_args *aa = (struct audio_attach_args *)aux;
|
||||
struct yds_softc *ysc = (struct yds_softc *)parent;
|
||||
struct audio_attach_args *aa = aux;
|
||||
struct yds_softc *ysc = device_private(parent);
|
||||
struct mpu_softc sc;
|
||||
|
||||
if (aa->type != AUDIODEV_TYPE_MPU)
|
||||
return (0);
|
||||
return 0;
|
||||
memset(&sc, 0, sizeof sc);
|
||||
sc.ioh = ysc->sc_mpu_ioh;
|
||||
sc.iot = ysc->sc_mpu_iot;
|
||||
return (mpu_find(&sc));
|
||||
return mpu_find(&sc);
|
||||
}
|
||||
|
||||
static void
|
||||
mpu_yds_attach(struct device *parent, struct device *self, void *aux)
|
||||
mpu_yds_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct yds_softc *ysc = (struct yds_softc *)parent;
|
||||
struct mpu_softc *sc = (struct mpu_softc *)self;
|
||||
struct yds_softc *ysc = device_private(parent);
|
||||
struct mpu_softc *sc = device_private(self);
|
||||
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
sc->ioh = ysc->sc_mpu_ioh;
|
||||
sc->iot = ysc->sc_mpu_iot;
|
||||
|
@ -91,9 +91,10 @@ mpu_yds_attach(struct device *parent, struct device *self, void *aux)
|
|||
#ifndef AUDIO_NO_POWER_CTL
|
||||
sc->powerctl = 0;
|
||||
#endif
|
||||
sc->sc_dev = self;
|
||||
|
||||
mpu_attach(sc);
|
||||
}
|
||||
|
||||
CFATTACH_DECL(mpu_yds, sizeof (struct mpu_softc),
|
||||
CFATTACH_DECL_NEW(mpu_yds, sizeof (struct mpu_softc),
|
||||
mpu_yds_match, mpu_yds_attach, NULL, NULL);
|
||||
|
|
Loading…
Reference in New Issue