Subject: Re: Need help with understanding the emuxki driver
To: Mark Kirby <mark@coris.org.uk>
From: None <cube@cubidou.net>
List: tech-kern
Date: 11/27/2004 23:30:23
--X1bOJ3K7DJ5YkBrT
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=
tach=20
> an mpu(4) driver to my device. The problem i'm having is in mapping some=
=20
> iospace for the mpu device.
>=20
> As far as i can see (from looking at other pci sound drivers which have m=
pu=20
> support) i can do it two ways.
>=20
> The 1st way is to add something like=20
>=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;
>=20
> or i can do=20
>=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");
>=20
>=20
> The problem with the 1st approach is that i don't know the value of the m=
pu=20
> 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=
es,=20
> to me at least, that thats not the way to go about it.=20
>=20
> The problem with the second one is i don't no what values i need to put i=
n=20
> place of the 0x68 and 4.
>=20
> 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.

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"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.

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQaj//9goQloHrPnoAQK5hQgAuTj/WrInnZbdJ3fetfSihrq9JcBaaW6E
j6Pa857O0nXuJFSp4UgOXqt+WqqVley6RShmN5GyJ5IjIZVIar3x6Sxin//0bYOp
gfG7D5EQ1mjSMbQyVkwKMiMP+W6jAgMeKKpYtvWF5wfR5wrBZeQoNvQrjsE4pIVu
tVgilTCcO3l0RYYCYS71uQHOaPW9D3X4jKyf3DtzUr7qxc71QeTUsxFGRwjy/x8r
6RyHyf5UL8UWVEEUYzyt+VstSPupdl0GILnVu3DG28+x4oKpERM8RHLIHpx+6qq4
ErpH38gKyR0vxRhH351qjlQe6w5HeFs6nG5SfYNOV3BPo08sFjsPcw==
=IQrK
-----END PGP SIGNATURE-----

--X1bOJ3K7DJ5YkBrT--