コード例 #1
0
ファイル: evtchn.c プロジェクト: AhmadTux/freebsd
int 
bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain,
    unsigned int remote_port, const char *devname,
    driver_intr_t handler, void *arg, unsigned long irqflags,
    unsigned int *irqp)
{
	unsigned int irq;
	int port = -1;
	int error;

	irq = bind_interdomain_evtchn_to_irq(remote_domain, remote_port, &port);
	intr_register_source(&xp->xp_pins[irq].xp_intsrc);
	error = intr_add_handler(devname, irq, NULL, handler, arg,
	    irqflags, &xp->xp_pins[irq].xp_cookie);
	if (error) {
		unbind_from_irq(irq);
		return (error);
	}
	if (port != -1)
		unmask_evtchn(port);

	if (irqp)
		*irqp = irq;
	return (0);
}
コード例 #2
0
ファイル: atpic.c プロジェクト: FreeBSDFoundation/freebsd
static void
atpic_register_sources(struct pic *pic)
{
	struct atpic *ap = (struct atpic *)pic;
	struct atpic_intsrc *ai;
	int i;

	/*
	 * If any of the ISA IRQs have an interrupt source already, then
	 * assume that the I/O APICs are being used and don't register any
	 * of our interrupt sources.  This makes sure we don't accidentally
	 * use mixed mode.  The "accidental" use could otherwise occur on
	 * machines that route the ACPI SCI interrupt to a different ISA
	 * IRQ (at least one machine routes it to IRQ 13) thus disabling
	 * that APIC ISA routing and allowing the ATPIC source for that IRQ
	 * to leak through.  We used to depend on this feature for routing
	 * IRQ0 via mixed mode, but now we don't use mixed mode at all.
	 *
	 * To avoid the slave not register sources after the master
	 * registers its sources, register all IRQs when this function is
	 * called on the master.
	 */
	if (ap != &atpics[MASTER])
		return;
	for (i = 0; i < NUM_ISA_IRQS; i++)
		if (intr_lookup_source(i) != NULL)
			return;

	/* Loop through all interrupt sources and add them. */
	for (i = 0, ai = atintrs; i < NUM_ISA_IRQS; i++, ai++) {
		if (i == ICU_SLAVEID)
			continue;
		intr_register_source(&ai->at_intsrc);
	}
}
コード例 #3
0
int 
bind_ipi_to_irqhandler(unsigned int ipi, unsigned int cpu,
    const char *devname, driver_filter_t filter,
    unsigned long irqflags, unsigned int *irqp)
{
	unsigned int irq;
	int error;
	
	irq = bind_ipi_to_irq(ipi, cpu);
	intr_register_source(&xp->xp_pins[irq].xp_intsrc);
	error = intr_add_handler(devname, irq, filter, NULL,
	    NULL, irqflags, &xp->xp_pins[irq].xp_cookie);
	if (error) {
		unbind_from_irq(irq);
		return (error);
	}

	if (irqp)
		*irqp = irq;
	return (0);
}
コード例 #4
0
ファイル: msi.c プロジェクト: FelixHaller/libuinet
static void
msi_create_source(void)
{
	struct msi_intsrc *msi;
	u_int irq;

	mtx_lock(&msi_lock);
	if (msi_last_irq >= NUM_MSI_INTS) {
		mtx_unlock(&msi_lock);
		return;
	}
	irq = msi_last_irq + FIRST_MSI_INT;
	msi_last_irq++;
	mtx_unlock(&msi_lock);

	msi = malloc(sizeof(struct msi_intsrc), M_MSI, M_WAITOK | M_ZERO);
	msi->msi_intsrc.is_pic = &msi_pic;
	msi->msi_irq = irq;
	intr_register_source(&msi->msi_intsrc);
	nexus_add_irq(irq);
}
コード例 #5
0
int 
bind_caller_port_to_irqhandler(unsigned int caller_port,
    const char *devname, driver_intr_t handler, void *arg,
    unsigned long irqflags, unsigned int *irqp)
{
	unsigned int irq;
	int error;

	irq = bind_caller_port_to_irq(caller_port);
	intr_register_source(&xp->xp_pins[irq].xp_intsrc);
	error = intr_add_handler(devname, irq, NULL, handler, arg, irqflags,
	    &xp->xp_pins[irq].xp_cookie);

	if (error) {
		unbind_from_irq(irq);
		return (error);
	}

	if (irqp)
		*irqp = irq;

	return (0);
}
コード例 #6
0
ファイル: evtchn.c プロジェクト: AhmadTux/freebsd
int 
bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu,
    const char *devname, driver_filter_t filter, driver_intr_t handler,
    void *arg, unsigned long irqflags, unsigned int *irqp)
{
	unsigned int irq;
	int port = -1;
	int error;

	irq = bind_virq_to_irq(virq, cpu, &port);
	intr_register_source(&xp->xp_pins[irq].xp_intsrc);
	error = intr_add_handler(devname, irq, filter, handler,
	    arg, irqflags, &xp->xp_pins[irq].xp_cookie);
	if (error) {
		unbind_from_irq(irq);
		return (error);
	}
	if (port != -1)
		unmask_evtchn(port);

	if (irqp)
		*irqp = irq;
	return (0);
}