FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 * 	t3_sge_read_context - read an SGE context
 * 	@type: the context type
 * 	@adapter: the adapter
 * 	@id: the context id
 * 	@data: holds the retrieved context
 *
 * 	Read an SGE egress context.  The caller is responsible for ensuring
 * 	only one context operation occurs at a time.
 */
read an SGE context
@type: the context type
@adapter: the adapter
@id: the context id
@data: holds the retrieved context

Read an SGE egress context.  The caller is responsible for ensuring
only one context operation occurs at a time.
read an SGE context @type : the context type @adapter : the adapter @id : the context id @data : holds the retrieved context Read an SGE egress context . The caller is responsible for ensuring only one context operation occurs at a time .
static int t3_sge_read_context(unsigned int type, adapter_t *adapter,
			       unsigned int id, u32 data[4])
{
	if (t3_read_reg(adapter, A_SG_CONTEXT_CMD) & F_CONTEXT_CMD_BUSY)
		return -EBUSY;
	t3_write_reg(adapter, A_SG_CONTEXT_CMD,
		     V_CONTEXT_CMD_OPCODE(0) | type | V_CONTEXT(id));
	if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, 0,
			    SG_CONTEXT_CMD_ATTEMPTS, 1))
		return -EIO;
	data[0] = t3_read_reg(adapter, A_SG_CONTEXT_DATA0);
	data[1] = t3_read_reg(adapter, A_SG_CONTEXT_DATA1);
	data[2] = t3_read_reg(adapter, A_SG_CONTEXT_DATA2);
	data[3] = t3_read_reg(adapter, A_SG_CONTEXT_DATA3);
	return 0;
}
static int t3_sge_read_context ( unsigned int type , adapter_t * adapter , unsigned int id , u32 data [ 4 ] ) { if ( t3_read_reg ( adapter , A_SG_CONTEXT_CMD ) & F_CONTEXT_CMD_BUSY ) return - EBUSY ; t3_write_reg ( adapter , A_SG_CONTEXT_CMD , V_CONTEXT_CMD_OPCODE ( 0 ) | type | V_CONTEXT ( id ) ) ; if ( t3_wait_op_done ( adapter , A_SG_CONTEXT_CMD , F_CONTEXT_CMD_BUSY , 0 , SG_CONTEXT_CMD_ATTEMPTS , 1 ) ) return - EIO ; data [ 0 ] = t3_read_reg ( adapter , A_SG_CONTEXT_DATA0 ) ; data [ 1 ] = t3_read_reg ( adapter , A_SG_CONTEXT_DATA1 ) ; data [ 2 ] = t3_read_reg ( adapter , A_SG_CONTEXT_DATA2 ) ; data [ 3 ] = t3_read_reg ( adapter , A_SG_CONTEXT_DATA3 ) ; return 0 ; }
t3_sge_read_context - read an SGE context
      @type: the context type
      @adapter: the adapter
      @id: the context id
      @data: holds the retrieved context
t3_sge_read_context - read an SGE context @type : the context type @adapter : the adapter @id : the context id @data : holds the retrieved context