FreeBSD/sys/dev/vnic/nicvf_queues.c
/* Poll a register for a specific value */
Poll a register for a specific value
Poll a register for a specific value
static int nicvf_poll_reg(struct nicvf *nic, int qidx,
			  uint64_t reg, int bit_pos, int bits, int val)
{
	uint64_t bit_mask;
	uint64_t reg_val;
	int timeout = 10;
	bit_mask = (1UL << bits) - 1;
	bit_mask = (bit_mask << bit_pos);
	while (timeout) {
		reg_val = nicvf_queue_reg_read(nic, reg, qidx);
		if (((reg_val & bit_mask) >> bit_pos) == val)
			return (0);
		DELAY(1000);
		timeout--;
	}
	device_printf(nic->dev, "Poll on reg 0x%lx failed\n", reg);
	return (ETIMEDOUT);
}
static int nicvf_poll_reg ( struct nicvf * nic , int qidx , uint64_t reg , int bit_pos , int bits , int val ) { uint64_t bit_mask ; uint64_t reg_val ; int timeout = 10 ; bit_mask = ( 1UL << bits ) - 1 ; bit_mask = ( bit_mask << bit_pos ) ; while ( timeout ) { reg_val = nicvf_queue_reg_read ( nic , reg , qidx ) ; if ( ( ( reg_val & bit_mask ) >> bit_pos ) == val ) return ( 0 ) ; DELAY ( 1000 ) ; timeout -- ; } device_printf ( nic -> dev , " \n " , reg ) ; return ( ETIMEDOUT ) ; }
Poll a register for a specific value
Poll a register for a specific value