Exemplo n.º 1
0
static int
obio_teardown_intr(device_t dev, device_t child, struct resource *ires,
    void *cookie)
{
	struct obio_softc *sc = device_get_softc(dev);
	int irq, result;
	uint32_t mask_register, mask, ip_bit;

	irq = rman_get_start(ires);
	if (irq >= NIRQS)
		panic("%s: bad irq %d", __func__, irq);

	if (sc->sc_eventstab[irq] == NULL)
		panic("Trying to teardown unoccupied IRQ");

	/* mask IRQ */
	mask_register = ICU_IRQ_MASK_REG(irq);
	ip_bit = ICU_IP_BIT(irq);

	mask = ICU_REG_READ(mask_register);
	ICU_REG_WRITE(mask_register, mask | ip_bit);

	result = intr_event_remove_handler(cookie);
	if (!result)
		sc->sc_eventstab[irq] = NULL;

	return (result);
}
Exemplo n.º 2
0
static int
obio_teardown_intr(device_t dev, device_t child, struct resource *ires,
    void *cookie)
{
	struct obio_softc *sc = device_get_softc(dev);
	int irq, result, priority;
	uint32_t irqmask;

	irq = rman_get_start(ires);
	if (irq >= NIRQS)
		panic("%s: bad irq %d", __func__, irq);

	if (sc->sc_eventstab[irq] == NULL)
		panic("Trying to teardown unoccupied IRQ");

	irqmask = (1 << irq);
	priority = irq_priorities[irq];

	if (priority == INTR_FIQ)
		REG_WRITE(ICU_MODE_REG, REG_READ(ICU_MODE_REG) & ~irqmask);
	else
		REG_WRITE(ICU_MODE_REG, REG_READ(ICU_MODE_REG) | irqmask);

	/* disable */
	irqmask = REG_READ(ICU_ENABLE_REG);
	irqmask &= ~(1 << irq);
	REG_WRITE(ICU_ENABLE_REG, irqmask);

	result = intr_event_remove_handler(cookie);
	if (!result) {
		sc->sc_eventstab[irq] = NULL;
	}

	return (result);
}
Exemplo n.º 3
0
static int
obio_teardown_intr(device_t dev, device_t child, struct resource *ires,
    void *cookie)
{
	struct obio_softc *sc = device_get_softc(dev);
	int irq, result;
	uint32_t irqmask;

	irq = rman_get_start(ires);
	if (irq >= NIRQS)
		panic("%s: bad irq %d", __func__, irq);

	if (sc->sc_eventstab[irq] == NULL)
		panic("Trying to teardown unoccupied IRQ");

	irqmask = 1 << irq;     /* only used as a mask from here on */

	/* disable this irq in HW */
	REG_WRITE(ICU_DISABLE_REG, irqmask);

	result = intr_event_remove_handler(cookie);
	if (!result) {
		sc->sc_eventstab[irq] = NULL;
	}

	return (result);
}
Exemplo n.º 4
0
static int
obio_teardown_intr(device_t dev, device_t child, struct resource *ires,
    void *cookie)
{
	struct obio_softc *sc = device_get_softc(dev);
	int irq, result, priority;
	uint32_t irqmask;

	irq = rman_get_start(ires);
	if (irq >= NIRQS)
		panic("%s: bad irq %d", __func__, irq);

	if (sc->sc_eventstab[irq] == NULL)
		panic("Trying to teardown unoccupied IRQ");

	irqmask = (1 << irq);
	priority = irq_priorities[irq];

	if (priority == INTR_FIQ)
		rt305x_ic_set(IC_INTTYPE, rt305x_ic_get(IC_INTTYPE) & ~irqmask);
	else
		rt305x_ic_set(IC_INTTYPE, rt305x_ic_get(IC_INTTYPE) | irqmask);

	/* disable */
	obio_mask_irq((void*)irq);

	result = intr_event_remove_handler(cookie);
	if (!result) {
		sc->sc_eventstab[irq] = NULL;
	}

	return (result);
}
Exemplo n.º 5
0
static int
apb_teardown_intr(device_t dev, device_t child, struct resource *ires,
    void *cookie)
{
#ifdef INTRNG
	 return (intr_teardown_irq(child, ires, cookie));
#else
	struct apb_softc *sc = device_get_softc(dev);
	int irq, result;

	irq = rman_get_start(ires);
	if (irq > APB_IRQ_END)
		panic("%s: bad irq %d", __func__, irq);

	if (sc->sc_eventstab[irq] == NULL)
		panic("Trying to teardown unoccupied IRQ");

	apb_mask_irq((void*)irq);

	result = intr_event_remove_handler(cookie);
	if (!result)
		sc->sc_eventstab[irq] = NULL;

	return (result);
#endif
}
Exemplo n.º 6
0
Arquivo: ciu.c Projeto: coyizumi/cs111
static int
ciu_teardown_intr(device_t bus, device_t child, struct resource *res,
		  void *cookie)
{
	int error;

	error = intr_event_remove_handler(cookie);
	if (error != 0)
		return (error);

	return (0);
}
Exemplo n.º 7
0
int
arm_remove_irqhandler(int irq, void *cookie)
{
	struct intr_event *event;
	int error;

	event = intr_events[irq];
	arm_mask_irq(irq);

	error = intr_event_remove_handler(cookie);

	if (!CK_SLIST_EMPTY(&event->ie_handlers))
		arm_unmask_irq(irq);
	return (error);
}
Exemplo n.º 8
0
static int
ti_gpio_teardown_intr(device_t dev, device_t child, struct resource *ires,
	void *cookie)
{
	struct ti_gpio_softc *sc;
	int pin, err;

	sc = device_get_softc(dev);
	pin = rman_get_start(ires);
	if (ti_gpio_valid_pin(sc, pin) != 0)
		panic("%s: bad pin %d", __func__, pin);
	if (sc->sc_events[pin] == NULL)
		panic("Trying to teardown unoccupied IRQ");
	err = intr_event_remove_handler(cookie);
	if (!err)
		sc->sc_events[pin] = NULL;

	return (err);
}