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:
parent
5c335ce55f
commit
3944d8313e
3 changed files with 24 additions and 11 deletions
|
@ -58,7 +58,7 @@ def read_intlist(intlist_path):
|
||||||
|
|
||||||
prefix = endian_prefix()
|
prefix = endian_prefix()
|
||||||
|
|
||||||
intlist_header_fmt = prefix + "IIII"
|
intlist_header_fmt = prefix + "IIIII"
|
||||||
intlist_entry_fmt = prefix + "iiII"
|
intlist_entry_fmt = prefix + "iiII"
|
||||||
|
|
||||||
with open(intlist_path, "rb") as fp:
|
with open(intlist_path, "rb") as fp:
|
||||||
|
@ -72,8 +72,9 @@ def read_intlist(intlist_path):
|
||||||
|
|
||||||
intlist["spurious_handler"] = header[0]
|
intlist["spurious_handler"] = header[0]
|
||||||
intlist["sw_irq_handler"] = header[1]
|
intlist["sw_irq_handler"] = header[1]
|
||||||
intlist["num_isrs"] = header[2]
|
intlist["num_vectors"] = header[2]
|
||||||
intlist["num_vectors"] = header[3]
|
intlist["offset"] = header[3]
|
||||||
|
intlist["num_isrs"] = header[4]
|
||||||
|
|
||||||
debug("spurious handler: %s" % hex(header[0]))
|
debug("spurious handler: %s" % hex(header[0]))
|
||||||
|
|
||||||
|
@ -148,6 +149,7 @@ def main():
|
||||||
|
|
||||||
intlist = read_intlist(args.intlist)
|
intlist = read_intlist(args.intlist)
|
||||||
nvec = intlist["num_vectors"]
|
nvec = intlist["num_vectors"]
|
||||||
|
offset = intlist["offset"]
|
||||||
prefix = endian_prefix()
|
prefix = endian_prefix()
|
||||||
|
|
||||||
# Set default entries in both tables
|
# Set default entries in both tables
|
||||||
|
@ -173,14 +175,14 @@ def main():
|
||||||
if (param != 0):
|
if (param != 0):
|
||||||
error("Direct irq %d declared, but has non-NULL parameter"
|
error("Direct irq %d declared, but has non-NULL parameter"
|
||||||
% irq)
|
% irq)
|
||||||
vt[irq] = func
|
vt[irq - offset] = func
|
||||||
else:
|
else:
|
||||||
# Regular interrupt
|
# Regular interrupt
|
||||||
if not swt:
|
if not swt:
|
||||||
error("Regular Interrupt %d declared with parameter 0x%x "
|
error("Regular Interrupt %d declared with parameter 0x%x "
|
||||||
"but no SW ISR_TABLE in use"
|
"but no SW ISR_TABLE in use"
|
||||||
% (irq, param))
|
% (irq, param))
|
||||||
swt[irq] = (param, func)
|
swt[irq - offset] = (param, func)
|
||||||
|
|
||||||
with open(args.output_source, "w") as fp:
|
with open(args.output_source, "w") as fp:
|
||||||
write_source_file(fp, vt, swt, intlist)
|
write_source_file(fp, vt, swt, intlist)
|
||||||
|
|
|
@ -15,13 +15,26 @@
|
||||||
#define ISR_WRAPPER NULL
|
#define ISR_WRAPPER NULL
|
||||||
#endif
|
#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
|
/* 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
|
* header of the initList section, which is used by gen_isr_tables.py to create
|
||||||
* the vector and sw isr tables,
|
* the vector and sw isr tables,
|
||||||
*/
|
*/
|
||||||
_GENERIC_SECTION(.irq.spurious) void *_irq_spurious_ptr = &_irq_spurious;
|
_GENERIC_SECTION(.irq_info) struct int_list_header _iheader = {
|
||||||
_GENERIC_SECTION(.irq.handler) void *_irq_handler_ptr = ISR_WRAPPER;
|
.spurious_ptr = &_irq_spurious,
|
||||||
_GENERIC_SECTION(.irq.tablesize) uint32_t _irq_table_size = IRQ_TABLE_SIZE;
|
.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
|
/* These are placeholder tables. They will be replaced by the real tables
|
||||||
* generated by gen_isr_tables.py.
|
* generated by gen_isr_tables.py.
|
||||||
|
|
|
@ -42,10 +42,8 @@
|
||||||
|
|
||||||
SECTION_PROLOGUE(.intList,,)
|
SECTION_PROLOGUE(.intList,,)
|
||||||
{
|
{
|
||||||
KEEP(*(.irq.spurious))
|
KEEP(*(.irq_info))
|
||||||
KEEP(*(.irq.handler))
|
|
||||||
LONG((__INT_LIST_END__ - __INT_LIST_START__) / __ISR_LIST_SIZEOF)
|
LONG((__INT_LIST_END__ - __INT_LIST_START__) / __ISR_LIST_SIZEOF)
|
||||||
KEEP(*(.irq.tablesize))
|
|
||||||
__INT_LIST_START__ = .;
|
__INT_LIST_START__ = .;
|
||||||
KEEP(*(.intList))
|
KEEP(*(.intList))
|
||||||
__INT_LIST_END__ = .;
|
__INT_LIST_END__ = .;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue