Subject: Cardbus BAR Mapping questions/PCI differences
To: None <>
From: Phil Quinton <>
List: tech-kern
Date: 03/14/2006 18:04:53

 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 

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 

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,

 * 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
		(*ct->ct_cf->cardbus_mem_open)(cc, 0, adr, adr+csc->
		csc->sc_bar_val = adr | CARDBUS_MAPREG_TYPE_MEM;

	else {
		printf("%s: unable to map device registers\n",

... later on ....

	/* Program the BAR. */
	cardbus_conf_write(cc, cf, csc->sc_tag, ATH_PCI_MMBA,