FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	sf1_read - read data from the serial flash
 *	@adapter: the adapter
 *	@byte_cnt: number of bytes to read
 *	@cont: whether another operation will be chained
 *	@valp: where to store the read data
 *
 *	Reads up to 4 bytes of data from the serial flash.  The location of
 *	the read needs to be specified prior to calling this by issuing the
 *	appropriate commands to the serial flash.
 */
read data from the serial flash
@adapter: the adapter
@byte_cnt: number of bytes to read
@cont: whether another operation will be chained
@valp: where to store the read data

Reads up to 4 bytes of data from the serial flash.  The location of
the read needs to be specified prior to calling this by issuing the
appropriate commands to the serial flash.
read data from the serial flash @adapter : the adapter @byte_cnt : number of bytes to read @cont : whether another operation will be chained @valp : where to store the read data Reads up to 4 bytes of data from the serial flash . The location of the read needs to be specified prior to calling this by issuing the appropriate commands to the serial flash .
static int sf1_read(adapter_t *adapter, unsigned int byte_cnt, int cont,
		    u32 *valp)
{
	int ret;
	if (!byte_cnt || byte_cnt > 4)
		return -EINVAL;
	if (t3_read_reg(adapter, A_SF_OP) & F_BUSY)
		return -EBUSY;
	t3_write_reg(adapter, A_SF_OP, V_CONT(cont) | V_BYTECNT(byte_cnt - 1));
	ret = t3_wait_op_done(adapter, A_SF_OP, F_BUSY, 0, SF_ATTEMPTS, 10);
	if (!ret)
		*valp = t3_read_reg(adapter, A_SF_DATA);
	return ret;
}
static int sf1_read ( adapter_t * adapter , unsigned int byte_cnt , int cont , u32 * valp ) { int ret ; if ( ! byte_cnt || byte_cnt > 4 ) return - EINVAL ; if ( t3_read_reg ( adapter , A_SF_OP ) & F_BUSY ) return - EBUSY ; t3_write_reg ( adapter , A_SF_OP , V_CONT ( cont ) | V_BYTECNT ( byte_cnt - 1 ) ) ; ret = t3_wait_op_done ( adapter , A_SF_OP , F_BUSY , 0 , SF_ATTEMPTS , 10 ) ; if ( ! ret ) * valp = t3_read_reg ( adapter , A_SF_DATA ) ; return ret ; }
sf1_read - read data from the serial flash
      @adapter: the adapter
      @byte_cnt: number of bytes to read
      @cont: whether another operation will be chained
      @valp: where to store the read data
sf1_read - read data from the serial flash @adapter : the adapter @byte_cnt : number of bytes to read @cont : whether another operation will be chained @valp : where to store the read data