src/dpdk/drivers/net/cxgbe/base/t4vf_hw.c
int t4vf_prep_adapter(struct adapter *adapter)
{
	u32 pl_vf_rev;
	int ret, ver;

	ret = t4vf_wait_dev_ready(adapter);
	if (ret < 0)
		return ret;

	/*
	 * Default port and clock for debugging in case we can't reach
	 * firmware.
	 */
	adapter->params.nports = 1;
	adapter->params.vfres.pmask = 1;
	adapter->params.vpd.cclk = 50000;

	pl_vf_rev = G_REV(t4_read_reg(adapter, A_PL_VF_REV));
	adapter->params.pci.device_id = adapter->pdev->id.device_id;
	adapter->params.pci.vendor_id = adapter->pdev->id.vendor_id;

	/*
	 * WE DON'T NEED adapter->params.chip CODE ONCE PL_REV CONTAINS
	 * ADAPTER (VERSION << 4 | REVISION)
	 */
	ver = CHELSIO_PCI_ID_VER(adapter->params.pci.device_id);
	adapter->params.chip = 0;
	switch (ver) {
	case CHELSIO_T5:
		adapter->params.chip |= CHELSIO_CHIP_CODE(CHELSIO_T5,
							  pl_vf_rev);
		adapter->params.arch.sge_fl_db = F_DBPRIO | F_DBTYPE;
		adapter->params.arch.mps_tcam_size =
			NUM_MPS_T5_CLS_SRAM_L_INSTANCES;
		break;
	case CHELSIO_T6:
		adapter->params.chip |= CHELSIO_CHIP_CODE(CHELSIO_T6,
							  pl_vf_rev);
		adapter->params.arch.sge_fl_db = 0;
		adapter->params.arch.mps_tcam_size =
			NUM_MPS_T5_CLS_SRAM_L_INSTANCES;
		break;
	default:
		dev_err(adapter, "%s: Device %d is not supported\n",
			__func__, adapter->params.pci.device_id);
		return -EINVAL;
	}
	return 0;
}
/**
 * t4vf_prep_adapter - prepare SW and HW for operation
 * @adapter: the adapter
 *
 * Initialize adapter SW state for the various HW modules, set initial
 * values for some adapter tunables, take PHYs out of reset, and
 * initialize the MDIO interface.
 */
prepare SW and HW for operation
@adapter: the adapter

Initialize adapter SW state for the various HW modules, set initial
values for some adapter tunables, take PHYs out of reset, and
initialize the MDIO interface.
prepare SW and HW for operation @adapter : the adapter Initialize adapter SW state for the various HW modules set initial values for some adapter tunables take PHYs out of reset and initialize the MDIO interface .
int t4vf_prep_adapter(struct adapter *adapter)
{
	u32 pl_vf_rev;
	int ret, ver;
	ret = t4vf_wait_dev_ready(adapter);
	if (ret < 0)
		return ret;
	adapter->params.nports = 1;
	adapter->params.vfres.pmask = 1;
	adapter->params.vpd.cclk = 50000;
	pl_vf_rev = G_REV(t4_read_reg(adapter, A_PL_VF_REV));
	adapter->params.pci.device_id = adapter->pdev->id.device_id;
	adapter->params.pci.vendor_id = adapter->pdev->id.vendor_id;
	ver = CHELSIO_PCI_ID_VER(adapter->params.pci.device_id);
	adapter->params.chip = 0;
	switch (ver) {
	case CHELSIO_T5:
		adapter->params.chip |= CHELSIO_CHIP_CODE(CHELSIO_T5,
							  pl_vf_rev);
		adapter->params.arch.sge_fl_db = F_DBPRIO | F_DBTYPE;
		adapter->params.arch.mps_tcam_size =
			NUM_MPS_T5_CLS_SRAM_L_INSTANCES;
		break;
	case CHELSIO_T6:
		adapter->params.chip |= CHELSIO_CHIP_CODE(CHELSIO_T6,
							  pl_vf_rev);
		adapter->params.arch.sge_fl_db = 0;
		adapter->params.arch.mps_tcam_size =
			NUM_MPS_T5_CLS_SRAM_L_INSTANCES;
		break;
	default:
		dev_err(adapter, "%s: Device %d is not supported\n",
			__func__, adapter->params.pci.device_id);
		return -EINVAL;
	}
	return 0;
}
int t4vf_prep_adapter ( struct adapter * adapter ) { u32 pl_vf_rev ; int ret , ver ; ret = t4vf_wait_dev_ready ( adapter ) ; if ( ret < 0 ) return ret ; adapter -> params . nports = 1 ; adapter -> params . vfres . pmask = 1 ; adapter -> params . vpd . cclk = 50000 ; pl_vf_rev = G_REV ( t4_read_reg ( adapter , A_PL_VF_REV ) ) ; adapter -> params . pci . device_id = adapter -> pdev -> id . device_id ; adapter -> params . pci . vendor_id = adapter -> pdev -> id . vendor_id ; ver = CHELSIO_PCI_ID_VER ( adapter -> params . pci . device_id ) ; adapter -> params . chip = 0 ; switch ( ver ) { case CHELSIO_T5 : adapter -> params . chip |= CHELSIO_CHIP_CODE ( CHELSIO_T5 , pl_vf_rev ) ; adapter -> params . arch . sge_fl_db = F_DBPRIO | F_DBTYPE ; adapter -> params . arch . mps_tcam_size = NUM_MPS_T5_CLS_SRAM_L_INSTANCES ; break ; case CHELSIO_T6 : adapter -> params . chip |= CHELSIO_CHIP_CODE ( CHELSIO_T6 , pl_vf_rev ) ; adapter -> params . arch . sge_fl_db = 0 ; adapter -> params . arch . mps_tcam_size = NUM_MPS_T5_CLS_SRAM_L_INSTANCES ; break ; default : dev_err ( adapter , " \n " , __func__ , adapter -> params . pci . device_id ) ; return - EINVAL ; } return 0 ; }
t4vf_prep_adapter - prepare SW and HW for operation
 @adapter: the adapter
t4vf_prep_adapter - prepare SW and HW for operation @adapter : the adapter
/*
	 * Default port and clock for debugging in case we can't reach
	 * firmware.
	 */ /*
	 * WE DON'T NEED adapter->params.chip CODE ONCE PL_REV CONTAINS
	 * ADAPTER (VERSION << 4 | REVISION)
	 */