Changeset 409a996 in mainline


Ignore:
Timestamp:
2013-04-03T16:49:52Z (11 years ago)
Author:
Beniamino Galvani <b.galvani@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f22f679
Parents:
44b2b78
Message:

bcm2835: improve interrupt handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/include/genarch/drivers/bcm2835/irc.h

    r44b2b78 r409a996  
    5151#define BCM2835_UART_IRQ        MAKE_IRQ(BANK_GPU1, 25)
    5252#define BCM2835_TIMER1_IRQ      MAKE_IRQ(BANK_GPU0,  1)
     53
     54#define IRQ_PEND_ARM_M          0xFF
     55#define IRQ_PEND_GPU0_M         (1 << 8)
     56#define IRQ_PEND_GPU1_M         (1 << 9)
     57#define IRQ_PEND_SHORT_M        0x1FFC00
     58#define IRQ_PEND_SHORT_S        10
     59
     60unsigned shortcut_inums[] = {7, 9, 10, 18, 19, 53, 54, 55, 56, 57, 62};
    5361
    5462typedef struct {
     
    111119{
    112120        uint32_t pending;
    113 
    114         /* TODO: use 'shortcut' bits in basic pending register */
     121        int inum = -1;
    115122
    116123        pending = regs->irq_basic_pending;
    117         if (pending & 0xff)
    118                 return MAKE_IRQ(BANK_ARM, ffs(pending & 0xFF) - 1);
    119124
    120         pending = regs->irq_pending1;
    121         if (pending)
    122                 return MAKE_IRQ(BANK_GPU0, ffs(pending) - 1);
     125        /*
     126         * The basic pending register shows interrupts pending from ARM
     127         * peripherals and it also contains, in order to speed up processing,
     128         * additional information about pending GPU interrupts:
     129         *
     130         *  - bits 0-7 are associated to ARM peripherals
     131         *  - bit 8 is 1 when at least one bit is set in pending register 1
     132         *  - bit 9 is 1 when at least one bit is set in pending register 2
     133         *  - bits 10-20 indicate pending status of selected GPU peripherals
     134         *
     135         *  Reference: BCM2835 ARM Peripherals, p.113
     136         */
    123137
    124         pending = regs->irq_pending2;
    125         if (pending)
    126                 return MAKE_IRQ(BANK_GPU1, ffs(pending) - 1);
     138        if (pending & IRQ_PEND_ARM_M) {
     139                inum = MAKE_IRQ(BANK_ARM, ffs(pending & IRQ_PEND_ARM_M) - 1);
     140        } else if (pending & IRQ_PEND_SHORT_M) {
     141                int pos = (pending & IRQ_PEND_SHORT_M) >> IRQ_PEND_SHORT_S;
     142                inum = shortcut_inums[ffs(pos) - 1];
     143        } else if (pending & IRQ_PEND_GPU0_M) {
     144                inum = MAKE_IRQ(BANK_GPU0, ffs(regs->irq_pending1) - 1);
     145        } else if (pending & IRQ_PEND_GPU1_M) {
     146                inum = MAKE_IRQ(BANK_GPU1, ffs(regs->irq_pending2) - 1);
     147        }
    127148
    128         printf("Spurious interrupt!\n");
    129         bcm2835_irc_dump(regs);
    130         return 0;
     149        if (inum < 0) {
     150                printf("Spurious interrupt!\n");
     151                bcm2835_irc_dump(regs);
     152                inum = 0;
     153        }
     154
     155        return inum;
    131156}
    132157
Note: See TracChangeset for help on using the changeset viewer.