FreeBSD/sys/dev/bhnd/bhndb/bhndb_pci.c
/**
 * A siba(4) and bcma(4)-compatible bhndb_set_window_addr implementation.
 * 
 * On siba(4) devices, it's possible that writing a PCI window register may
 * not succeed; it's necessary to immediately read the configuration register
 * and retry if not set to the desired value.
 * 
 * This is not necessary on bcma(4) devices, but other than the overhead of
 * validating the register, there's no harm in performing the verification.
 */


On siba(4) devices, it's possible that writing a PCI window register may
not succeed; it's necessary to immediately read the configuration register
and retry if not set to the desired value.

This is not necessary on bcma(4) devices, but other than the overhead of
validating the register, there's no harm in performing the verification.
On siba ( 4 ) devices it ' s possible that writing a PCI window register may not succeed ; it ' s necessary to immediately read the configuration register and retry if not set to the desired value . This is not necessary on bcma ( 4 ) devices but other than the overhead of validating the register there ' s no harm in performing the verification .
static int
bhndb_pci_compat_setregwin(struct bhndb_pci_softc *sc,
    const struct bhndb_regwin *rw, bhnd_addr_t addr)
{
	int		error;
	int		reg;
	if (rw->win_type != BHNDB_REGWIN_T_DYN)
		return (ENODEV);
	reg = rw->d.dyn.cfg_offset;
	for (u_int i = 0; i < BHNDB_PCI_BARCTRL_WRITE_RETRY; i++) {
		if ((error = bhndb_pci_fast_setregwin(sc, rw, addr)))
			return (error);
		if (pci_read_config(sc->parent, reg, 4) == addr)
			return (0);
		DELAY(10);
	}
	return (ENODEV);
}
static int bhndb_pci_compat_setregwin ( struct bhndb_pci_softc * sc , const struct bhndb_regwin * rw , bhnd_addr_t addr ) { int error ; int reg ; if ( rw -> win_type != BHNDB_REGWIN_T_DYN ) return ( ENODEV ) ; reg = rw -> d . dyn . cfg_offset ; for ( u_int i = 0 ; i < BHNDB_PCI_BARCTRL_WRITE_RETRY ; i ++ ) { if ( ( error = bhndb_pci_fast_setregwin ( sc , rw , addr ) ) ) return ( error ) ; if ( pci_read_config ( sc -> parent , reg , 4 ) == addr ) return ( 0 ) ; DELAY ( 10 ) ; } return ( ENODEV ) ; }
A siba(4) and bcma(4)-compatible bhndb_set_window_addr implementation.
A siba ( 4 ) and bcma ( 4 ) - compatible bhndb_set_window_addr implementation .
/* Unable to set window */