Subject: Re: Need help with understanding the emuxki driver
To: Mark Kirby <>
From: None <>
List: tech-kern
Date: 11/27/2004 23:30:23
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Nov 27, 2004 at 03:53:52PM +0000, Mark Kirby wrote:
> I'm trying to add mpu support to the emuxki driver. I have mannaged to at=
> an mpu(4) driver to my device. The problem i'm having is in mapping some=
> iospace for the mpu device.
> As far as i can see (from looking at other pci sound drivers which have m=
> support) i can do it two ways.
> The 1st way is to add something like=20
> if (pci_mapreg_map(pa, EMUXKi_PCI_BAR_MPU, PCI_MAPREG_TYPE_IO, 0,
>      &sc->sc_mpu_iot, &sc->sc_mpu_ioh, NULL, NULL)) {
>   aprint_error("%s: can't map MPU I/O space\n",
>       sc->sc_dev.dv_xname);
>   return;
> or i can do=20
> if (bus_space_subregion(sc->sc_iot, sc->sc_ioh, 0x68, 4,
>     &sc->sc_opl_ioh))
>   panic("fms_attach: can't get opl subregion handle");
> The problem with the 1st approach is that i don't know the value of the m=
> base address register. It's not listed in emuxkireg.h or emuxkivar.h, als=
o i=20
> can't find any reference to it in the latest linux drivers. So that impli=
> to me at least, that thats not the way to go about it.=20
> The problem with the second one is i don't no what values i need to put i=
> place of the 0x68 and 4.
> Does anyone have any information on how mpu support was intended to be=20
> implemented for the emuxki driver, or can offer me any general advice.

There is no dedicated register space for the MIDI interface on the emuxki.
At least on non-audigy devices, not sure for the rest.  That means you
just can't map a BAR, because there is no such one.  That means you have
to go the bus_space_subregion way.

I don't know if you've already done that part, but the bus_space_tag and
the bus_space_handle parameters will have to come from the corresponding
space of the emuxki parent driver.  That means you have to pass them to
the mpu at emuxki driver through attachment args, just like when you get
PCI device IDs from the pci_attach_args structure.

Then, as for the subregion to map, well, I guess it's the set of registers
for the MIDI interface.  If my reading of the Linux header is correct
("reading correctly Linux sources" is not something you can guarantee),
it consists of two 8-bit registers at offset 0x18 of the parent register
space (emuxki only maps one, AFAICT).

So you want to map at address 0x18, at least 2 byte-long.  You might have
to map a 32-bit aligned region, I'm not sure of that.

Quentin Garnier - -
"Commala-come-five! / Even when the shadows rise!
To see the world and walk the world / Makes ya glad to be alive."
Susannah's Song, The Dark Tower VI, Stephen King, 2004.

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.6 (NetBSD)