FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_reinit_adapter - prepare HW for operation again
 *	@adapter: the adapter
 *
 *	Put HW in the same state as @t3_prep_adapter without any changes to
 *	SW state.  This is a cut down version of @t3_prep_adapter intended
 *	to be used after events that wipe out HW state but preserve SW state,
 *	e.g., EEH.  The device must be reset before calling this.
 */
prepare HW for operation again
@adapter: the adapter

Put HW in the same state as @t3_prep_adapter without any changes to
SW state.  This is a cut down version of @t3_prep_adapter intended
to be used after events that wipe out HW state but preserve SW state,
e.g., EEH.  The device must be reset before calling this.
prepare HW for operation again @adapter : the adapter Put HW in the same state as @t3_prep_adapter without any changes to SW state . This is a cut down version of @t3_prep_adapter intended to be used after events that wipe out HW state but preserve SW state e . g . EEH . The device must be reset before calling this .
int t3_reinit_adapter(adapter_t *adap)
{
	unsigned int i;
	int ret, j = 0;
	early_hw_init(adap, adap->params.info);
	ret = init_parity(adap);
	if (ret)
		return ret;
	if (adap->params.nports > 2 &&
	    (ret = t3_vsc7323_init(adap, adap->params.nports)))
		return ret;
	for_each_port(adap, i) {
		const struct port_type_info *pti;
		struct port_info *p = adap2pinfo(adap, i);
		for (;;) {
			unsigned port_type = adap->params.vpd.port_type[j];
			if (port_type) {
				if (port_type < ARRAY_SIZE(port_types)) {
					pti = &port_types[port_type];
					break;
				} else
					return -EINVAL;
			}
			j++;
			if (j >= ARRAY_SIZE(adap->params.vpd.port_type))
				return -EINVAL;
		}
		ret = pti->phy_prep(p, p->phy.addr, NULL);
		if (ret)
			return ret;
		p->phy.ops->power_down(&p->phy, 1);
	}
	return 0;
}
int t3_reinit_adapter ( adapter_t * adap ) { unsigned int i ; int ret , j = 0 ; early_hw_init ( adap , adap -> params . info ) ; ret = init_parity ( adap ) ; if ( ret ) return ret ; if ( adap -> params . nports > 2 && ( ret = t3_vsc7323_init ( adap , adap -> params . nports ) ) ) return ret ; for_each_port ( adap , i ) { const struct port_type_info * pti ; struct port_info * p = adap2pinfo ( adap , i ) ; for ( ; ; ) { unsigned port_type = adap -> params . vpd . port_type [ j ] ; if ( port_type ) { if ( port_type < ARRAY_SIZE ( port_types ) ) { pti = & port_types [ port_type ] ; break ; } else return - EINVAL ; } j ++ ; if ( j >= ARRAY_SIZE ( adap -> params . vpd . port_type ) ) return - EINVAL ; } ret = pti -> phy_prep ( p , p -> phy . addr , NULL ) ; if ( ret ) return ret ; p -> phy . ops -> power_down ( & p -> phy , 1 ) ; } return 0 ; }
t3_reinit_adapter - prepare HW for operation again
      @adapter: the adapter
t3_reinit_adapter - prepare HW for operation again @adapter : the adapter