gen_isr_tables: apply offset to irq parameter

The interrupts would be placed at incorrect offsets on systems where
some interrupt vectors are reserved for exceptions, such as ARC.

Change-Id: I5b1f00eb9e8aecb84ae66e3d0461a734ffb5fbe6
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2017-02-13 09:56:25 -08:00
commit 3944d8313e
3 changed files with 24 additions and 11 deletions

View file

@ -58,7 +58,7 @@ def read_intlist(intlist_path):
prefix = endian_prefix()
intlist_header_fmt = prefix + "IIII"
intlist_header_fmt = prefix + "IIIII"
intlist_entry_fmt = prefix + "iiII"
with open(intlist_path, "rb") as fp:
@ -72,8 +72,9 @@ def read_intlist(intlist_path):
intlist["spurious_handler"] = header[0]
intlist["sw_irq_handler"] = header[1]
intlist["num_isrs"] = header[2]
intlist["num_vectors"] = header[3]
intlist["num_vectors"] = header[2]
intlist["offset"] = header[3]
intlist["num_isrs"] = header[4]
debug("spurious handler: %s" % hex(header[0]))
@ -148,6 +149,7 @@ def main():
intlist = read_intlist(args.intlist)
nvec = intlist["num_vectors"]
offset = intlist["offset"]
prefix = endian_prefix()
# Set default entries in both tables
@ -173,14 +175,14 @@ def main():
if (param != 0):
error("Direct irq %d declared, but has non-NULL parameter"
% irq)
vt[irq] = func
vt[irq - offset] = func
else:
# Regular interrupt
if not swt:
error("Regular Interrupt %d declared with parameter 0x%x "
"but no SW ISR_TABLE in use"
% (irq, param))
swt[irq] = (param, func)
swt[irq - offset] = (param, func)
with open(args.output_source, "w") as fp:
write_source_file(fp, vt, swt, intlist)

View file

@ -15,13 +15,26 @@
#define ISR_WRAPPER NULL
#endif
/* There is an additional member at the end populated by the linker script
* which indicates the number of interrupts specified
*/
struct int_list_header {
void *spurious_ptr;
void *handler_ptr;
uint32_t table_size;
uint32_t offset;
};
/* These values are not included in the resulting binary, but instead form the
* header of the initList section, which is used by gen_isr_tables.py to create
* the vector and sw isr tables,
*/
_GENERIC_SECTION(.irq.spurious) void *_irq_spurious_ptr = &_irq_spurious;
_GENERIC_SECTION(.irq.handler) void *_irq_handler_ptr = ISR_WRAPPER;
_GENERIC_SECTION(.irq.tablesize) uint32_t _irq_table_size = IRQ_TABLE_SIZE;
_GENERIC_SECTION(.irq_info) struct int_list_header _iheader = {
.spurious_ptr = &_irq_spurious,
.handler_ptr = ISR_WRAPPER,
.table_size = IRQ_TABLE_SIZE,
.offset = CONFIG_GEN_IRQ_START_VECTOR,
};
/* These are placeholder tables. They will be replaced by the real tables
* generated by gen_isr_tables.py.

View file

@ -42,10 +42,8 @@
SECTION_PROLOGUE(.intList,,)
{
KEEP(*(.irq.spurious))
KEEP(*(.irq.handler))
KEEP(*(.irq_info))
LONG((__INT_LIST_END__ - __INT_LIST_START__) / __ISR_LIST_SIZEOF)
KEEP(*(.irq.tablesize))
__INT_LIST_START__ = .;
KEEP(*(.intList))
__INT_LIST_END__ = .;