Subject: Cardbus BAR Mapping questions/PCI differences
To: None <tech-kern@netbsd.org>
From: Phil Quinton <pquinton@softhome.net>
List: tech-kern
Date: 03/14/2006 18:04:53
Hi,
Just a couple of questions.
I'm having another bash at porting the satalink driver to cardbus and
I've noticed a couple of diffences that I could do with being cleared
up...
Below is a code snippet from dev/cardbus/if_ath_cardbus.c. My question
is this:
When the BAR (ATH_PCI_MMBA) is mapped, the &adr is OR'd with
CARDBUS_MAPREG_TYPE_MEM and the written back with a Cardbus_conf_write
later on.
Why? And does this need to be done with ALL BAR's that need to be
mapped?
The reason I ask is the satalink driver maps BAR5 for it's chipset and
BAR4 is mapped later on for the IDE portion and the drivers in
drv/cardbus only seem to need to map one BAR.
Thanks in advance,
Phil.
---SNIP---
/*
* Map the device.
*/
if (Cardbus_mapreg_map(ct, ATH_PCI_MMBA, CARDBUS_MAPREG_TYPE_MEM, 0,
&sc->sc_st, &sc->sc_sh, &adr, &csc->sc_mapsize) == 0) {
#if rbus
#else
(*ct->ct_cf->cardbus_mem_open)(cc, 0, adr, adr+csc->
sc_mapsize);
#endif
csc->sc_bar_val = adr | CARDBUS_MAPREG_TYPE_MEM;
}
else {
printf("%s: unable to map device registers\n",
sc->sc_dev.dv_xname);
return;
}
---SNIP---
... later on ....
---SNIP---
/* Program the BAR. */
cardbus_conf_write(cc, cf, csc->sc_tag, ATH_PCI_MMBA,
csc->sc_bar_val);
---SNIP---