diff options
Diffstat (limited to 'hw/intc/sh_intc.c')
-rw-r--r-- | hw/intc/sh_intc.c | 220 |
1 files changed, 110 insertions, 110 deletions
diff --git a/hw/intc/sh_intc.c b/hw/intc/sh_intc.c index 72a55e32dd..a269b8fbd4 100644 --- a/hw/intc/sh_intc.c +++ b/hw/intc/sh_intc.c @@ -20,7 +20,7 @@ #define INTC_A7(x) ((x) & 0x1fffffff) void sh_intc_toggle_source(struct intc_source *source, - int enable_adj, int assert_adj) + int enable_adj, int assert_adj) { int enable_changed = 0; int pending_changed = 0; @@ -54,22 +54,22 @@ void sh_intc_toggle_source(struct intc_source *source, if (source->parent->pending == 0) { cpu_reset_interrupt(first_cpu, CPU_INTERRUPT_HARD); } - } + } } if (enable_changed || assert_adj || pending_changed) { #ifdef DEBUG_INTC_SOURCES printf("sh_intc: (%d/%d/%d/%d) interrupt source 0x%x %s%s%s\n", - source->parent->pending, - source->asserted, - source->enable_count, - source->enable_max, - source->vect, - source->asserted ? "asserted " : - assert_adj ? "deasserted" : "", - enable_changed == 1 ? "enabled " : - enable_changed == -1 ? "disabled " : "", - source->pending ? "pending" : ""); + source->parent->pending, + source->asserted, + source->enable_count, + source->enable_max, + source->vect, + source->asserted ? "asserted " : + assert_adj ? "deasserted" : "", + enable_changed == 1 ? "enabled " : + enable_changed == -1 ? "disabled " : "", + source->pending ? "pending" : ""); #endif } } @@ -99,13 +99,13 @@ int sh_intc_get_pending_vector(struct intc_desc *desc, int imask) for (i = 0; i < desc->nr_sources; i++) { struct intc_source *source = desc->sources + i; - if (source->pending) { + if (source->pending) { #ifdef DEBUG_INTC_SOURCES printf("sh_intc: (%d) returning interrupt source 0x%x\n", - desc->pending, source->vect); + desc->pending, source->vect); #endif return source->vect; - } + } } abort(); @@ -119,16 +119,16 @@ int sh_intc_get_pending_vector(struct intc_desc *desc, int imask) #define INTC_MODE_IS_PRIO 8 static unsigned int sh_intc_mode(unsigned long address, - unsigned long set_reg, unsigned long clr_reg) + unsigned long set_reg, unsigned long clr_reg) { if ((address != INTC_A7(set_reg)) && - (address != INTC_A7(clr_reg))) + (address != INTC_A7(clr_reg))) return INTC_MODE_NONE; if (set_reg && clr_reg) { if (address == INTC_A7(set_reg)) return INTC_MODE_DUAL_SET; - else + else return INTC_MODE_DUAL_CLR; } @@ -139,12 +139,12 @@ static unsigned int sh_intc_mode(unsigned long address, } static void sh_intc_locate(struct intc_desc *desc, - unsigned long address, - unsigned long **datap, - intc_enum **enums, - unsigned int *first, - unsigned int *width, - unsigned int *modep) + unsigned long address, + unsigned long **datap, + intc_enum **enums, + unsigned int *first, + unsigned int *width, + unsigned int *modep) { unsigned int i, mode; @@ -152,54 +152,54 @@ static void sh_intc_locate(struct intc_desc *desc, if (desc->mask_regs) { for (i = 0; i < desc->nr_mask_regs; i++) { - struct intc_mask_reg *mr = desc->mask_regs + i; + struct intc_mask_reg *mr = desc->mask_regs + i; - mode = sh_intc_mode(address, mr->set_reg, mr->clr_reg); - if (mode == INTC_MODE_NONE) + mode = sh_intc_mode(address, mr->set_reg, mr->clr_reg); + if (mode == INTC_MODE_NONE) continue; - *modep = mode; - *datap = &mr->value; - *enums = mr->enum_ids; - *first = mr->reg_width - 1; - *width = 1; - return; - } + *modep = mode; + *datap = &mr->value; + *enums = mr->enum_ids; + *first = mr->reg_width - 1; + *width = 1; + return; + } } if (desc->prio_regs) { for (i = 0; i < desc->nr_prio_regs; i++) { - struct intc_prio_reg *pr = desc->prio_regs + i; + struct intc_prio_reg *pr = desc->prio_regs + i; - mode = sh_intc_mode(address, pr->set_reg, pr->clr_reg); - if (mode == INTC_MODE_NONE) + mode = sh_intc_mode(address, pr->set_reg, pr->clr_reg); + if (mode == INTC_MODE_NONE) continue; - *modep = mode | INTC_MODE_IS_PRIO; - *datap = &pr->value; - *enums = pr->enum_ids; - *first = (pr->reg_width / pr->field_width) - 1; - *width = pr->field_width; - return; - } + *modep = mode | INTC_MODE_IS_PRIO; + *datap = &pr->value; + *enums = pr->enum_ids; + *first = (pr->reg_width / pr->field_width) - 1; + *width = pr->field_width; + return; + } } abort(); } static void sh_intc_toggle_mask(struct intc_desc *desc, intc_enum id, - int enable, int is_group) + int enable, int is_group) { struct intc_source *source = desc->sources + id; if (!id) - return; + return; if (!source->next_enum_id && (!source->enable_max || !source->vect)) { #ifdef DEBUG_INTC_SOURCES printf("sh_intc: reserved interrupt source %d modified\n", id); #endif - return; + return; } if (source->vect) @@ -237,7 +237,7 @@ static uint64_t sh_intc_read(void *opaque, hwaddr offset, #endif sh_intc_locate(desc, (unsigned long)offset, &valuep, - &enum_ids, &first, &width, &mode); + &enum_ids, &first, &width, &mode); return *valuep; } @@ -258,7 +258,7 @@ static void sh_intc_write(void *opaque, hwaddr offset, #endif sh_intc_locate(desc, (unsigned long)offset, &valuep, - &enum_ids, &first, &width, &mode); + &enum_ids, &first, &width, &mode); switch (mode) { case INTC_MODE_ENABLE_REG | INTC_MODE_IS_PRIO: break; @@ -270,11 +270,11 @@ static void sh_intc_write(void *opaque, hwaddr offset, for (k = 0; k <= first; k++) { mask = ((1 << width) - 1) << ((first - k) * width); - if ((*valuep & mask) == (value & mask)) + if ((*valuep & mask) == (value & mask)) continue; #if 0 - printf("k = %d, first = %d, enum = %d, mask = 0x%08x\n", - k, first, enum_ids[k], (unsigned int)mask); + printf("k = %d, first = %d, enum = %d, mask = 0x%08x\n", + k, first, enum_ids[k], (unsigned int)mask); #endif sh_intc_toggle_mask(desc, enum_ids[k], value & mask, 0); } @@ -301,11 +301,11 @@ struct intc_source *sh_intc_source(struct intc_desc *desc, intc_enum id) } static unsigned int sh_intc_register(MemoryRegion *sysmem, - struct intc_desc *desc, - const unsigned long address, - const char *type, - const char *action, - const unsigned int index) + struct intc_desc *desc, + const unsigned long address, + const char *type, + const char *action, + const unsigned int index) { char name[60]; MemoryRegion *iomem, *iomem_p4, *iomem_a7; @@ -333,74 +333,74 @@ static unsigned int sh_intc_register(MemoryRegion *sysmem, } static void sh_intc_register_source(struct intc_desc *desc, - intc_enum source, - struct intc_group *groups, - int nr_groups) + intc_enum source, + struct intc_group *groups, + int nr_groups) { unsigned int i, k; struct intc_source *s; if (desc->mask_regs) { for (i = 0; i < desc->nr_mask_regs; i++) { - struct intc_mask_reg *mr = desc->mask_regs + i; + struct intc_mask_reg *mr = desc->mask_regs + i; - for (k = 0; k < ARRAY_SIZE(mr->enum_ids); k++) { + for (k = 0; k < ARRAY_SIZE(mr->enum_ids); k++) { if (mr->enum_ids[k] != source) continue; - s = sh_intc_source(desc, mr->enum_ids[k]); - if (s) + s = sh_intc_source(desc, mr->enum_ids[k]); + if (s) s->enable_max++; - } - } + } + } } if (desc->prio_regs) { for (i = 0; i < desc->nr_prio_regs; i++) { - struct intc_prio_reg *pr = desc->prio_regs + i; + struct intc_prio_reg *pr = desc->prio_regs + i; - for (k = 0; k < ARRAY_SIZE(pr->enum_ids); k++) { + for (k = 0; k < ARRAY_SIZE(pr->enum_ids); k++) { if (pr->enum_ids[k] != source) continue; - s = sh_intc_source(desc, pr->enum_ids[k]); - if (s) + s = sh_intc_source(desc, pr->enum_ids[k]); + if (s) s->enable_max++; - } - } + } + } } if (groups) { for (i = 0; i < nr_groups; i++) { - struct intc_group *gr = groups + i; + struct intc_group *gr = groups + i; - for (k = 0; k < ARRAY_SIZE(gr->enum_ids); k++) { + for (k = 0; k < ARRAY_SIZE(gr->enum_ids); k++) { if (gr->enum_ids[k] != source) continue; - s = sh_intc_source(desc, gr->enum_ids[k]); - if (s) + s = sh_intc_source(desc, gr->enum_ids[k]); + if (s) s->enable_max++; - } - } + } + } } } void sh_intc_register_sources(struct intc_desc *desc, - struct intc_vect *vectors, - int nr_vectors, - struct intc_group *groups, - int nr_groups) + struct intc_vect *vectors, + int nr_vectors, + struct intc_group *groups, + int nr_groups) { unsigned int i, k; struct intc_source *s; for (i = 0; i < nr_vectors; i++) { - struct intc_vect *vect = vectors + i; + struct intc_vect *vect = vectors + i; - sh_intc_register_source(desc, vect->enum_id, groups, nr_groups); - s = sh_intc_source(desc, vect->enum_id); + sh_intc_register_source(desc, vect->enum_id, groups, nr_groups); + s = sh_intc_source(desc, vect->enum_id); if (s) { s->vect = vect->vect; @@ -413,34 +413,34 @@ void sh_intc_register_sources(struct intc_desc *desc, if (groups) { for (i = 0; i < nr_groups; i++) { - struct intc_group *gr = groups + i; + struct intc_group *gr = groups + i; - s = sh_intc_source(desc, gr->enum_id); - s->next_enum_id = gr->enum_ids[0]; + s = sh_intc_source(desc, gr->enum_id); + s->next_enum_id = gr->enum_ids[0]; - for (k = 1; k < ARRAY_SIZE(gr->enum_ids); k++) { + for (k = 1; k < ARRAY_SIZE(gr->enum_ids); k++) { if (!gr->enum_ids[k]) continue; - s = sh_intc_source(desc, gr->enum_ids[k - 1]); - s->next_enum_id = gr->enum_ids[k]; - } + s = sh_intc_source(desc, gr->enum_ids[k - 1]); + s->next_enum_id = gr->enum_ids[k]; + } #ifdef DEBUG_INTC_SOURCES - printf("sh_intc: registered group %d (%d/%d)\n", - gr->enum_id, s->enable_count, s->enable_max); + printf("sh_intc: registered group %d (%d/%d)\n", + gr->enum_id, s->enable_count, s->enable_max); #endif - } + } } } int sh_intc_init(MemoryRegion *sysmem, - struct intc_desc *desc, - int nr_sources, - struct intc_mask_reg *mask_regs, - int nr_mask_regs, - struct intc_prio_reg *prio_regs, - int nr_prio_regs) + struct intc_desc *desc, + int nr_sources, + struct intc_mask_reg *mask_regs, + int nr_mask_regs, + struct intc_prio_reg *prio_regs, + int nr_prio_regs) { unsigned int i, j; @@ -474,24 +474,24 @@ int sh_intc_init(MemoryRegion *sysmem, reg_struct->action##_reg, #type, #action, j if (desc->mask_regs) { for (i = 0; i < desc->nr_mask_regs; i++) { - struct intc_mask_reg *mr = desc->mask_regs + i; + struct intc_mask_reg *mr = desc->mask_regs + i; j += sh_intc_register(sysmem, desc, INT_REG_PARAMS(mr, mask, set, j)); j += sh_intc_register(sysmem, desc, INT_REG_PARAMS(mr, mask, clr, j)); - } + } } if (desc->prio_regs) { for (i = 0; i < desc->nr_prio_regs; i++) { - struct intc_prio_reg *pr = desc->prio_regs + i; + struct intc_prio_reg *pr = desc->prio_regs + i; j += sh_intc_register(sysmem, desc, INT_REG_PARAMS(pr, prio, set, j)); j += sh_intc_register(sysmem, desc, INT_REG_PARAMS(pr, prio, clr, j)); - } + } } #undef INT_REG_PARAMS @@ -505,10 +505,10 @@ void sh_intc_set_irl(void *opaque, int n, int level) struct intc_source *s = opaque; int i, irl = level ^ 15; for (i = 0; (s = sh_intc_source(s->parent, s->next_enum_id)); i++) { - if (i == irl) - sh_intc_toggle_source(s, s->enable_count?0:1, s->asserted?0:1); - else - if (s->asserted) - sh_intc_toggle_source(s, 0, -1); + if (i == irl) + sh_intc_toggle_source(s, s->enable_count?0:1, s->asserted?0:1); + else + if (s->asserted) + sh_intc_toggle_source(s, 0, -1); } } |