Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68221
b: refs/heads/master
c: 3d37d94
h: refs/heads/master
i:
  68219: d216091
v: v3
  • Loading branch information
Magnus Damm authored and Paul Mundt committed Sep 21, 2007
1 parent 6471352 commit e7b2cb3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5c37e025352b993d8726b0207ff2270b2f2bc7d6
refs/heads/master: 3d37d94e5aab669f5a492bb3cda67bbbbbca50b8
33 changes: 28 additions & 5 deletions trunk/arch/sh/kernel/cpu/irq/intc.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,18 @@ static struct intc_handle_int *intc_find_irq(struct intc_handle_int *hp,
{
int i;

/* this doesn't scale well, but...
*
* this function should only be used for cerain uncommon
* operations such as intc_set_priority() and intc_set_sense()
* and in those rare cases performance doesn't matter that much.
* keeping the memory footprint low is more important.
*
* one rather simple way to speed this up and still keep the
* memory footprint down is to make sure the array is sorted
* and then perform a bisect to lookup the irq.
*/

for (i = 0; i < nr_hp; i++) {
if ((hp + i)->irq != irq)
continue;
Expand All @@ -226,7 +238,7 @@ int intc_set_priority(unsigned int irq, unsigned int prio)

ihp = intc_find_irq(d->prio, d->nr_prio, irq);
if (ihp) {
if (prio >= ((1 << _INTC_WIDTH(ihp->handle)) - 1))
if (prio >= (1 << _INTC_WIDTH(ihp->handle)))
return -EINVAL;

intc_prio_level[irq] = prio;
Expand All @@ -237,7 +249,7 @@ int intc_set_priority(unsigned int irq, unsigned int prio)
* priority level will be set during next enable()
*/

if (ihp->handle)
if (_INTC_FN(ihp->handle) != REG_FN_ERR)
_intc_enable(irq, ihp->handle);
}
return 0;
Expand Down Expand Up @@ -457,6 +469,7 @@ static void __init intc_register_irq(struct intc_desc *desc,
intc_enum enum_id,
unsigned int irq)
{
struct intc_handle_int *hp;
unsigned int data[2], primary;

/* Prefer single interrupt source bitmap over other combinations:
Expand Down Expand Up @@ -495,9 +508,19 @@ static void __init intc_register_irq(struct intc_desc *desc,

/* add irq to d->prio list if priority is available */
if (data[1]) {
(d->prio + d->nr_prio)->irq = irq;
if (!primary) /* only secondary priority can access regs */
(d->prio + d->nr_prio)->handle = data[1];
hp = d->prio + d->nr_prio;
hp->irq = irq;
hp->handle = data[1];

if (primary) {
/*
* only secondary priority should access registers, so
* set _INTC_FN(h) = REG_FN_ERR for intc_set_priority()
*/

hp->handle &= ~_INTC_MK(0x0f, 0, 0, 0, 0, 0);
hp->handle |= _INTC_MK(REG_FN_ERR, 0, 0, 0, 0, 0);
}
d->nr_prio++;
}

Expand Down
1 change: 1 addition & 0 deletions trunk/include/asm-sh/hw_irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct intc_desc symbol __initdata = { \
}

void __init register_intc_controller(struct intc_desc *desc);
int intc_set_priority(unsigned int irq, unsigned int prio);

void __init plat_irq_setup(void);

Expand Down

0 comments on commit e7b2cb3

Please sign in to comment.