FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_sge_init_cqcntxt - initialize an SGE completion queue context
 *	@adapter: the adapter to configure
 *	@id: the context id
 *	@base_addr: base address of queue
 *	@size: number of queue entries
 *	@rspq: response queue for async notifications
 *	@ovfl_mode: CQ overflow mode
 *	@credits: completion queue credits
 *	@credit_thres: the credit threshold
 *
 *	Initialize an SGE completion queue context and make it ready for use.
 *	The caller is responsible for ensuring only one context operation
 *	occurs at a time.
 */


Initialize an SGE completion queue context and make it ready for use.
The caller is responsible for ensuring only one context operation
occurs at a time.
Initialize an SGE completion queue context and make it ready for use . The caller is responsible for ensuring only one context operation occurs at a time .
int t3_sge_init_cqcntxt(adapter_t *adapter, unsigned int id, u64 base_addr,
			unsigned int size, int rspq, int ovfl_mode,
			unsigned int credits, unsigned int credit_thres)
{
	if (base_addr & 0xfff)     
		return -EINVAL;
	if (t3_read_reg(adapter, A_SG_CONTEXT_CMD) & F_CONTEXT_CMD_BUSY)
		return -EBUSY;
	base_addr >>= 12;
	t3_write_reg(adapter, A_SG_CONTEXT_DATA0, V_CQ_SIZE(size));
	t3_write_reg(adapter, A_SG_CONTEXT_DATA1, (u32)base_addr);
	base_addr >>= 32;
	t3_write_reg(adapter, A_SG_CONTEXT_DATA2,
		     V_CQ_BASE_HI((u32)base_addr) | V_CQ_RSPQ(rspq) |
		     V_CQ_GEN(1) | V_CQ_OVERFLOW_MODE(ovfl_mode) |
		     V_CQ_ERR(ovfl_mode));
	t3_write_reg(adapter, A_SG_CONTEXT_DATA3, V_CQ_CREDITS(credits) |
		     V_CQ_CREDIT_THRES(credit_thres));
	return t3_sge_write_context(adapter, id, F_CQ);
}
int t3_sge_init_cqcntxt ( adapter_t * adapter , unsigned int id , u64 base_addr , unsigned int size , int rspq , int ovfl_mode , unsigned int credits , unsigned int credit_thres ) { if ( base_addr & 0xfff ) return - EINVAL ; if ( t3_read_reg ( adapter , A_SG_CONTEXT_CMD ) & F_CONTEXT_CMD_BUSY ) return - EBUSY ; base_addr >>= 12 ; t3_write_reg ( adapter , A_SG_CONTEXT_DATA0 , V_CQ_SIZE ( size ) ) ; t3_write_reg ( adapter , A_SG_CONTEXT_DATA1 , ( u32 ) base_addr ) ; base_addr >>= 32 ; t3_write_reg ( adapter , A_SG_CONTEXT_DATA2 , V_CQ_BASE_HI ( ( u32 ) base_addr ) | V_CQ_RSPQ ( rspq ) | V_CQ_GEN ( 1 ) | V_CQ_OVERFLOW_MODE ( ovfl_mode ) | V_CQ_ERR ( ovfl_mode ) ) ; t3_write_reg ( adapter , A_SG_CONTEXT_DATA3 , V_CQ_CREDITS ( credits ) | V_CQ_CREDIT_THRES ( credit_thres ) ) ; return t3_sge_write_context ( adapter , id , F_CQ ) ; }
t3_sge_init_cqcntxt - initialize an SGE completion queue context
      @adapter: the adapter to configure
      @id: the context id
      @base_addr: base address of queue
      @size: number of queue entries
      @rspq: response queue for async notifications
      @ovfl_mode: CQ overflow mode
      @credits: completion queue credits
      @credit_thres: the credit threshold
t3_sge_init_cqcntxt - initialize an SGE completion queue context @adapter : the adapter to configure @id : the context id @base_addr : base address of queue @size : number of queue entries @rspq : response queue for async notifications @ovfl_mode : CQ overflow mode @credits : completion queue credits @credit_thres : the credit threshold
/* must be 4K aligned */