FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_set_proto_sram - set the contents of the protocol sram
 *	@adapter: the adapter
 *	@data: the protocol image
 *
 *	Write the contents of the protocol SRAM.
 */
set the contents of the protocol sram
@adapter: the adapter
@data: the protocol image

Write the contents of the protocol SRAM.
set the contents of the protocol sram @adapter : the adapter @data : the protocol image Write the contents of the protocol SRAM .
int t3_set_proto_sram(adapter_t *adap, const u8 *data)
{
	int i;
	const u32 *buf = (const u32 *)data;
	for (i = 0; i < PROTO_SRAM_LINES; i++) {
		t3_write_reg(adap, A_TP_EMBED_OP_FIELD5, cpu_to_be32(*buf++));
		t3_write_reg(adap, A_TP_EMBED_OP_FIELD4, cpu_to_be32(*buf++));
		t3_write_reg(adap, A_TP_EMBED_OP_FIELD3, cpu_to_be32(*buf++));
		t3_write_reg(adap, A_TP_EMBED_OP_FIELD2, cpu_to_be32(*buf++));
		t3_write_reg(adap, A_TP_EMBED_OP_FIELD1, cpu_to_be32(*buf++));
		t3_write_reg(adap, A_TP_EMBED_OP_FIELD0, i << 1 | 1 << 31);
		if (t3_wait_op_done(adap, A_TP_EMBED_OP_FIELD0, 1, 1, 5, 1))
			return -EIO;
	}
	return 0;
}
int t3_set_proto_sram ( adapter_t * adap , const u8 * data ) { int i ; const u32 * buf = ( const u32 * ) data ; for ( i = 0 ; i < PROTO_SRAM_LINES ; i ++ ) { t3_write_reg ( adap , A_TP_EMBED_OP_FIELD5 , cpu_to_be32 ( * buf ++ ) ) ; t3_write_reg ( adap , A_TP_EMBED_OP_FIELD4 , cpu_to_be32 ( * buf ++ ) ) ; t3_write_reg ( adap , A_TP_EMBED_OP_FIELD3 , cpu_to_be32 ( * buf ++ ) ) ; t3_write_reg ( adap , A_TP_EMBED_OP_FIELD2 , cpu_to_be32 ( * buf ++ ) ) ; t3_write_reg ( adap , A_TP_EMBED_OP_FIELD1 , cpu_to_be32 ( * buf ++ ) ) ; t3_write_reg ( adap , A_TP_EMBED_OP_FIELD0 , i << 1 | 1 << 31 ) ; if ( t3_wait_op_done ( adap , A_TP_EMBED_OP_FIELD0 , 1 , 1 , 5 , 1 ) ) return - EIO ; } return 0 ; }
t3_set_proto_sram - set the contents of the protocol sram
      @adapter: the adapter
      @data: the protocol image
t3_set_proto_sram - set the contents of the protocol sram @adapter : the adapter @data : the protocol image