Date: Sun, 20 Feb 2005 21:03:37 GMT From: John-Mark Gurney <jmg@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 71410 for review Message-ID: <200502202103.j1KL3btO063320@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=71410 Change 71410 by jmg@jmg_carbon on 2005/02/20 21:03:16 change the irq interface slightly... remove arm_get_irqnb, and replace with arm_get_next_irq that returns the next unmask irq that is pending.. we no longer mask/unmask/enable interrupts in executing/dispatching the interrupt handlers... change the interface for arm_(un)?mask_irq to take a number instead of a mask to support >32 irq systems... also fix probing of the ep93xx devices, make the child device eparm, and probe/attach the devices... Submitted by: cognet (the probing/attaching) Affected files ... .. //depot/projects/arm/src/sys/arm/arm/intr.c#2 edit .. //depot/projects/arm/src/sys/arm/ep93xx/ep93xx.c#3 edit .. //depot/projects/arm/src/sys/arm/include/intr.h#2 edit Differences ... ==== //depot/projects/arm/src/sys/arm/arm/intr.c#2 (text+ko) ==== @@ -67,7 +67,7 @@ struct arm_intr *intr = (struct arm_intr *)arg; intr->handler(intr->arg); - arm_unmask_irqs(1 << intr->irq); + arm_unmask_irqs(intr->irq); } void arm_handler_execute(void *, int); @@ -127,14 +127,8 @@ struct thread *td = curthread; td->td_intr_nesting_level++; - if (irqnb == 0) - irqnb = arm_get_irqnb(frame); - arm_mask_irqs(irqnb); - enable_interrupts(I32_bit|F32_bit); - while (irqnb != 0) { - i = ffs(irqnb) - 1; + while ((i = arm_get_next_irq()) != -1) { intrcnt[intrcnt_tab[i]]++; - irqnb &= ~(1U << i); ithd = ithreads[i]; if (!ithd) continue; @@ -148,7 +142,6 @@ arm_unmask_irqs(1 << i); } else if (ih) ithread_schedule(ithd); - irqnb |= arm_get_irqnb(frame); } td->td_intr_nesting_level--; } ==== //depot/projects/arm/src/sys/arm/ep93xx/ep93xx.c#3 (text+ko) ==== @@ -80,45 +80,47 @@ void -arm_unmask_irqs(int irqmask) +arm_unmask_irqs(int irq) { - int irq; + KASSERT(irq < VIC_NIRQ * 2, ("irq %d is greater than max", irq)); - while ((irq = ffs(irqmask) - 1)) { - if (irq < VIC_NIRQ) { - vic1_intr_enabled |= (1U << irq); - VIC1REG(EP93XX_VIC_IntEnable) = (1U << irq); - } else { - vic2_intr_enabled |= (1U << (irq - VIC_NIRQ)); - VIC2REG(EP93XX_VIC_IntEnable) = - (1U << (irq - VIC_NIRQ)); - } + if (irq < VIC_NIRQ) { + vic1_intr_enabled |= (1U << irq); + VIC1REG(EP93XX_VIC_IntEnable) = (1U << irq); + } else { + vic2_intr_enabled |= (1U << (irq - VIC_NIRQ)); + VIC2REG(EP93XX_VIC_IntEnable) = + (1U << (irq - VIC_NIRQ)); } } void -arm_mask_irqs(int irqmask) +arm_mask_irqs(int irq) { - int irq; + KASSERT(irq < VIC_NIRQ * 2, ("irq %d is greater than max", irq)); - while ((irq = ffs(irqmask) - 1)) { - if (irq < VIC_NIRQ) { - vic1_intr_enabled &= ~(1U << irq); - VIC1REG(EP93XX_VIC_IntEnClear) = (1U << irq); - } else { - vic2_intr_enabled &= ~(1U << (irq - VIC_NIRQ)); - VIC2REG(EP93XX_VIC_IntEnClear) = - (1U << (irq - VIC_NIRQ)); - } + if (irq < VIC_NIRQ) { + vic1_intr_enabled &= ~(1U << irq); + VIC1REG(EP93XX_VIC_IntEnClear) = (1U << irq); + } else { + vic2_intr_enabled &= ~(1U << (irq - VIC_NIRQ)); + VIC2REG(EP93XX_VIC_IntEnClear) = + (1U << (irq - VIC_NIRQ)); } } int -arm_get_irqnb(void *unused) +arm_get_next_irq() { - - return (VIC1REG(EP93XX_VIC_IRQStatus) | - VIC2REG(EP93XX_VIC_IRQStatus)); + int reg; + + if ((reg = VIC1REG(EP93XX_VIC_IRQStatus) & vic1_intr_enabled)) { + return ffs(reg) - 1; + } else if ((reg = VIC2REG(EP93XX_VIC_IRQStatus) & vic2_intr_enabled)) { + return ffs(reg) - 1 + 32; + } + + return -1; } static void @@ -152,7 +154,7 @@ ep93xx_identify(driver_t *driver, device_t parent) { - BUS_ADD_CHILD(parent, 0, "ep", 0); + BUS_ADD_CHILD(parent, 0, "eparm", 0); } struct arm32_dma_range * @@ -176,6 +178,11 @@ ep93xx_intr_init(); device_add_child(dev, "uart", 0); device_add_child(dev, "epclk", 0); + + /* kick these off */ + bus_generic_probe(dev); + bus_generic_attach(dev); + return (0); } @@ -224,9 +231,10 @@ struct resource *ires, int flags, driver_intr_t *intr, void *arg, void **cookiep) { + BUS_SETUP_INTR(device_get_parent(dev), child, ires, flags, intr, arg, cookiep); - arm_unmask_irqs(1 << ires->r_start); + arm_unmask_irqs(ires->r_start); return (0); } ==== //depot/projects/arm/src/sys/arm/include/intr.h#2 (text+ko) ==== @@ -47,10 +47,11 @@ #include <machine/psl.h> -int arm_get_irqnb(void *); +int arm_get_next_irq(void); void arm_mask_irqs(int); void arm_unmask_irqs(int); void set_splmasks(void); void arm_setup_irqhandler(const char *, void (*)(void*), void *, int, int, void **); + #endif /* _MACHINE_INTR_H */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502202103.j1KL3btO063320>