FreeBSD/sys/x86/xen/xen_intr.c
/**
 * Perform configuration of an interrupt source.
 *
 * \param isrc  The interrupt source to configure.
 * \param trig  Edge or level.
 * \param pol   Active high or low.
 *
 * \returns  0 if no events are pending, otherwise non-zero.
 */
Perform configuration of an interrupt source.
\param isrc  The interrupt source to configure.
\param trig  Edge or level.
\param pol   Active high or low.

\returns  0 if no events are pending, otherwise non-zero.
Perform configuration of an interrupt source . \ param isrc The interrupt source to configure . \ param trig Edge or level . \ param pol Active high or low . \ returns 0 if no events are pending otherwise non - zero .
static int
xen_intr_pirq_config_intr(struct intsrc *base_isrc, enum intr_trigger trig,
    enum intr_polarity pol)
{
	struct xenisrc *isrc = (struct xenisrc *)base_isrc;
	struct physdev_setup_gsi setup_gsi;
	int error;
	KASSERT(!(trig == INTR_TRIGGER_CONFORM || pol == INTR_POLARITY_CONFORM),
	    ("%s: Conforming trigger or polarity\n", __func__));
	setup_gsi.gsi = isrc->xi_pirq;
	setup_gsi.triggering = trig == INTR_TRIGGER_EDGE ? 0 : 1;
	setup_gsi.polarity = pol == INTR_POLARITY_HIGH ? 0 : 1;
	error = HYPERVISOR_physdev_op(PHYSDEVOP_setup_gsi, &setup_gsi);
	if (error == -XEN_EEXIST) {
		if ((isrc->xi_edgetrigger && (trig != INTR_TRIGGER_EDGE)) ||
		    (isrc->xi_activehi && (pol != INTR_POLARITY_HIGH)))
			panic("unable to reconfigure interrupt IRQ#%d",
			    isrc->xi_pirq);
		error = 0;
	}
	if (error)
		panic("unable to configure IRQ#%d\n", isrc->xi_pirq);
	isrc->xi_activehi = pol == INTR_POLARITY_HIGH ? 1 : 0;
	isrc->xi_edgetrigger = trig == INTR_TRIGGER_EDGE ? 1 : 0;
	return (0);
}
static int xen_intr_pirq_config_intr ( struct intsrc * base_isrc , enum intr_trigger trig , enum intr_polarity pol ) { struct xenisrc * isrc = ( struct xenisrc * ) base_isrc ; struct physdev_setup_gsi setup_gsi ; int error ; KASSERT ( ! ( trig == INTR_TRIGGER_CONFORM || pol == INTR_POLARITY_CONFORM ) , ( " \n " , __func__ ) ) ; setup_gsi . gsi = isrc -> xi_pirq ; setup_gsi . triggering = trig == INTR_TRIGGER_EDGE ? 0 : 1 ; setup_gsi . polarity = pol == INTR_POLARITY_HIGH ? 0 : 1 ; error = HYPERVISOR_physdev_op ( PHYSDEVOP_setup_gsi , & setup_gsi ) ; if ( error == - XEN_EEXIST ) { if ( ( isrc -> xi_edgetrigger && ( trig != INTR_TRIGGER_EDGE ) ) || ( isrc -> xi_activehi && ( pol != INTR_POLARITY_HIGH ) ) ) panic ( " " , isrc -> xi_pirq ) ; error = 0 ; } if ( error ) panic ( " \n " , isrc -> xi_pirq ) ; isrc -> xi_activehi = pol == INTR_POLARITY_HIGH ? 1 : 0 ; isrc -> xi_edgetrigger = trig == INTR_TRIGGER_EDGE ? 1 : 0 ; return ( 0 ) ; }
Perform configuration of an interrupt source.
Perform configuration of an interrupt source .