FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_handle_intr_status - table driven interrupt handler
 *	@adapter: the adapter that generated the interrupt
 *	@reg: the interrupt status register to process
 *	@mask: a mask to apply to the interrupt status
 *	@acts: table of interrupt actions
 *	@stats: statistics counters tracking interrupt occurrences
 *
 *	A table driven interrupt handler that applies a set of masks to an
 *	interrupt status word and performs the corresponding actions if the
 *	interrupts described by the mask have occurred.  The actions include
 *	optionally printing a warning or alert message, and optionally
 *	incrementing a stat counter.  The table is terminated by an entry
 *	specifying mask 0.  Returns the number of fatal interrupt conditions.
 */


A table driven interrupt handler that applies a set of masks to an
interrupt status word and performs the corresponding actions if the
interrupts described by the mask have occurred.  The actions include
optionally printing a warning or alert message, and optionally
incrementing a stat counter.  The table is terminated by an entry
specifying mask 0.  Returns the number of fatal interrupt conditions.
A table driven interrupt handler that applies a set of masks to an interrupt status word and performs the corresponding actions if the interrupts described by the mask have occurred . The actions include optionally printing a warning or alert message and optionally incrementing a stat counter . The table is terminated by an entry specifying mask 0 . Returns the number of fatal interrupt conditions .
static int t3_handle_intr_status(adapter_t *adapter, unsigned int reg,
				 unsigned int mask,
				 const struct intr_info *acts,
				 unsigned long *stats)
{
	int fatal = 0;
	unsigned int status = t3_read_reg(adapter, reg) & mask;
	for ( ; acts->mask; ++acts) {
		if (!(status & acts->mask)) continue;
		if (acts->fatal) {
			fatal++;
			CH_ALERT(adapter, "%s (0x%x)\n",
				 acts->msg, status & acts->mask);
			status &= ~acts->mask;
		} else if (acts->msg)
			CH_WARN(adapter, "%s (0x%x)\n",
				acts->msg, status & acts->mask);
		if (acts->stat_idx >= 0)
			stats[acts->stat_idx]++;
	}
	if (status)                           
		t3_write_reg(adapter, reg, status);
	return fatal;
}
static int t3_handle_intr_status ( adapter_t * adapter , unsigned int reg , unsigned int mask , const struct intr_info * acts , unsigned long * stats ) { int fatal = 0 ; unsigned int status = t3_read_reg ( adapter , reg ) & mask ; for ( ; acts -> mask ; ++ acts ) { if ( ! ( status & acts -> mask ) ) continue ; if ( acts -> fatal ) { fatal ++ ; CH_ALERT ( adapter , " \n " , acts -> msg , status & acts -> mask ) ; status &= ~ acts -> mask ; } else if ( acts -> msg ) CH_WARN ( adapter , " \n " , acts -> msg , status & acts -> mask ) ; if ( acts -> stat_idx >= 0 ) stats [ acts -> stat_idx ] ++ ; } if ( status ) t3_write_reg ( adapter , reg , status ) ; return fatal ; }
t3_handle_intr_status - table driven interrupt handler
      @adapter: the adapter that generated the interrupt
      @reg: the interrupt status register to process
      @mask: a mask to apply to the interrupt status
      @acts: table of interrupt actions
      @stats: statistics counters tracking interrupt occurrences
t3_handle_intr_status - table driven interrupt handler @adapter : the adapter that generated the interrupt @reg : the interrupt status register to process @mask : a mask to apply to the interrupt status @acts : table of interrupt actions @stats : statistics counters tracking interrupt occurrences
/* clear processed interrupts */