Subject: Re: Claiming Hardware Resources
To: Alan Ritter <rittera@cc.wwu.edu>
From: Quentin Garnier <cube@cubidou.net>
List: tech-kern
Date: 07/07/2005 00:30:39
--ZOudaV4lSIjFTlHv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jul 06, 2005 at 09:44:51PM +0000, Alan Ritter wrote:
> Hi all, I'm trying to port FreeBSD's NDIS driver to NetBSD for Google's
> "Summer of Code".
>=20
> Anyway, as there isn't a specific piece of hardware this driver is being
> written for, I need to find a way to detect which hardware resources to
> claim. It seems like pci_mapreg_info() (man 9 pci) might work for this, b=
ut
> I'm not totally sure.
[...]
> I get the same base address and size when using pci_mapreg_info() on BAR
> 0x10, so I'm figuring this is the only register that needs to get mapped =
in
> this case.  In general should I just test all these BAR's, and map those
> for which pci_mapreg_info doesn't fail?

I think you'll have to call pci_mapreg_type() on each BAR, because you'll
need the type information when doing the actual mapping.

I don't know what the NDIS driver will ask for, but once you have the list
of the BARs and their type, you can either call pci_mapreg_info() if the
NDIS driver asks for an address to map, but you're more likely to not have
to do that, and only call pci_mapreg_map() when asked by the NDIS driver.

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.

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

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

iQEVAwUBQsxbjtgoQloHrPnoAQJoFwgAvMG6FFgcpPCI6BChF53nZPr7Un1w49Jq
QzeyIq2rKf8H92He7ZrwJdjuhlz2csx3F4FgN3kBADw8PxJqzRvwH6mdMXb8jQp1
d27Bgy0ELGrckYjGLMerwUzkvA6AXVNDHwONoHKNhM+yckQjM5ku0uwVMxOxDF8j
mGA4INkl+2WsRrdXnfahwnoX3VauzaIIpmUmGC5MnAIhcxQFSChgpwy4lUlJjS9S
+3b0YppQaJMiKv8Q1cyTKTL35eVUaAOS2lAK7/mVVvOE48wj9WYDcwtkVJnyjxB7
rWWTLPR6Hfoxt+mQ6mFEgjMwRFAq3287VUBlxAc/6JZv0NBxE+zeVA==
=7ToC
-----END PGP SIGNATURE-----

--ZOudaV4lSIjFTlHv--