FreeBSD/sys/dev/cxgbe/common/t4_hw.c
/*
 * Read a 32-bit PCI Configuration Space register via the PCI-E backdoor
 * mechanism.  This guarantees that we get the real value even if we're
 * operating within a Virtual Machine and the Hypervisor is trapping our
 * Configuration Space accesses.
 *
 * N.B. This routine should only be used as a last resort: the firmware uses
 *      the backdoor registers on a regular basis and we can end up
 *      conflicting with it's uses!
 */
Read a 32-bit PCI Configuration Space register via the PCI-E backdoor
mechanism.  This guarantees that we get the real value even if we're
operating within a Virtual Machine and the Hypervisor is trapping our
Configuration Space accesses.


Read a 32 - bit PCI Configuration Space register via the PCI - E backdoor mechanism . This guarantees that we get the real value even if we ' re operating within a Virtual Machine and the Hypervisor is trapping our Configuration Space accesses .
u32 t4_hw_pci_read_cfg4(adapter_t *adap, int reg)
{
	u32 req = V_FUNCTION(adap->pf) | V_REGISTER(reg);
	u32 val;
	if (chip_id(adap) <= CHELSIO_T5)
		req |= F_ENABLE;
	else
		req |= F_T6_ENABLE;
	if (is_t4(adap))
		req |= F_LOCALCFG;
	t4_write_reg(adap, A_PCIE_CFG_SPACE_REQ, req);
	val = t4_read_reg(adap, A_PCIE_CFG_SPACE_DATA);
	t4_write_reg(adap, A_PCIE_CFG_SPACE_REQ, 0);
	return val;
}
u32 t4_hw_pci_read_cfg4 ( adapter_t * adap , int reg ) { u32 req = V_FUNCTION ( adap -> pf ) | V_REGISTER ( reg ) ; u32 val ; if ( chip_id ( adap ) <= CHELSIO_T5 ) req |= F_ENABLE ; else req |= F_T6_ENABLE ; if ( is_t4 ( adap ) ) req |= F_LOCALCFG ; t4_write_reg ( adap , A_PCIE_CFG_SPACE_REQ , req ) ; val = t4_read_reg ( adap , A_PCIE_CFG_SPACE_DATA ) ; t4_write_reg ( adap , A_PCIE_CFG_SPACE_REQ , 0 ) ; return val ; }
Read a 32-bit PCI Configuration Space register via the PCI-E backdoor
 mechanism.
Read a 32 - bit PCI Configuration Space register via the PCI - E backdoor mechanism .
/*
	 * Reset F_ENABLE to 0 so reads of PCIE_CFG_SPACE_DATA won't cause a
	 * Configuration Space read.  (None of the other fields matter when
	 * F_ENABLE is 0 so a simple register write is easier than a
	 * read-modify-write via t4_set_reg_field().)
	 */