svn commit: r266470 - head/sys/arm/broadcom/bcm2835
Hans Petter Selasky
hselasky at FreeBSD.org
Tue May 20 15:03:24 UTC 2014
Author: hselasky
Date: Tue May 20 15:03:23 2014
New Revision: 266470
URL: http://svnweb.freebsd.org/changeset/base/266470
Log:
Optimise reading of pending interrupt registers. If there are no
pending interrupt bits, skip the bit iteration loop.
Reviewed by: ian @
Modified:
head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_intr.c Tue May 20 14:52:56 2014 (r266469)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_intr.c Tue May 20 15:03:23 2014 (r266470)
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
#define BANK1_END (BANK1_START + 32 - 1)
#define BANK2_START (BANK1_START + 32)
#define BANK2_END (BANK2_START + 32 - 1)
+#define BANK3_START (BANK2_START + 32)
#define IS_IRQ_BASIC(n) (((n) >= 0) && ((n) < BANK1_START))
#define IS_IRQ_BANK1(n) (((n) >= BANK1_START) && ((n) <= BANK1_END))
@@ -150,29 +151,36 @@ arm_get_next_irq(int last_irq)
/* Sanity check */
if (irq < 0)
irq = 0;
-
+
/* TODO: should we mask last_irq? */
- pending = intc_read_4(INTC_PENDING_BASIC);
- while (irq < BANK1_START) {
- if (pending & (1 << irq))
- return irq;
- irq++;
+ if (irq < BANK1_START) {
+ pending = intc_read_4(INTC_PENDING_BASIC);
+ if ((pending & 0xFF) == 0) {
+ irq = BANK1_START; /* skip to next bank */
+ } else do {
+ if (pending & (1 << irq))
+ return irq;
+ irq++;
+ } while (irq < BANK1_START);
}
-
- pending = intc_read_4(INTC_PENDING_BANK1);
- while (irq < BANK2_START) {
- if (pending & (1 << IRQ_BANK1(irq)))
- return irq;
- irq++;
+ if (irq < BANK2_START) {
+ pending = intc_read_4(INTC_PENDING_BANK1);
+ if (pending == 0) {
+ irq = BANK2_START; /* skip to next bank */
+ } else do {
+ if (pending & (1 << IRQ_BANK1(irq)))
+ return irq;
+ irq++;
+ } while (irq < BANK2_START);
}
-
- pending = intc_read_4(INTC_PENDING_BANK2);
- while (irq <= BANK2_END) {
- if (pending & (1 << IRQ_BANK2(irq)))
- return irq;
- irq++;
+ if (irq < BANK3_START) {
+ pending = intc_read_4(INTC_PENDING_BANK2);
+ if (pending != 0) do {
+ if (pending & (1 << IRQ_BANK2(irq)))
+ return irq;
+ irq++;
+ } while (irq < BANK3_START);
}
-
return (-1);
}
More information about the svn-src-all
mailing list