quark se arc: irq static initialization support.

Adds static irq support for the Quark SE platform for the ARC core.

New linker sections and sw isr table initialization is needed to support
static IRQ.

Change-Id: I82af98a189f5a156e7f1018f3ecdbfa73ad3e6ef
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
This commit is contained in:
Juan Manuel Cruz 2015-11-24 17:17:43 -06:00 committed by Anas Nashif
commit b51b3da133
3 changed files with 77 additions and 46 deletions

View file

@ -0,0 +1,64 @@
/* sw_isr_table.S - ISR table for static ISR declarations for ARC */
/*
* Copyright (c) 2015 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define _ASMLANGUAGE
#include <toolchain.h>
#include <sections.h>
#include <arch/cpu.h>
/*
* enable proprocessor features, such
* as %expr - evaluate the expression and use it as a string
*/
.altmacro
/*
* Define an ISR table entry
* Define symbol as weak and give the section .gnu.linkonce
* prefix. This allows linker overload the symbol and the
* whole section by the one defined by a device driver
*/
.macro _isr_table_entry_declare index
WDATA(_isr_irq\index)
.section .gnu.linkonce.isr_irq\index
_isr_irq\index: .word 0xABAD1DEA, _irq_spurious
.endm
/*
* Declare the ISR table
* Macro is recursive
*/
.macro _isr_table_declare from, to
_isr_table_entry_declare \from
.if \to-\from
_isr_table_declare %(\from + 1), \to
.endif
.endm
GTEXT(_irq_spurious)
GDATA(_sw_isr_table)
.section .isr_irq16
.align
_sw_isr_table:
/*In ARC architecture, IRQ 0-15 are reserved for the system and are not
assignable by the user, for that reason the isr table linker section
start at IRQ 16*/
_isr_table_declare 16 CONFIG_NUM_IRQS+15

View file

@ -1,46 +0,0 @@
/* sw_isr_table.c - Software ISR table for quark_se_ss BSP */
/*
* Copyright (c) 2014 Wind River Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This contains the ISR table meant to be used for ISRs that take a parameter.
* It is also used when ISRs are to be connected at runtime, and in this case
* provides a table that is filled with _SpuriousIRQ bindings.
*/
#include <toolchain.h>
#include <sections.h>
#include <sw_isr_table.h>
extern void _irq_spurious(void *arg);
#if defined(CONFIG_SW_ISR_TABLE_DYNAMIC)
_IsrTableEntry_t __isr_table_section _sw_isr_table[CONFIG_NUM_IRQS] = {
[0 ...(CONFIG_NUM_IRQS - 1)].arg = (void *)0xABAD1DEA,
[0 ...(CONFIG_NUM_IRQS - 1)].isr = _irq_spurious
};
#else
#if defined(CONFIG_SW_ISR_TABLE)
#if !defined(CONFIG_SW_ISR_TABLE_STATIC_CUSTOM)
/* placeholders: fill with real ISRs */
#endif
#endif
#endif

View file

@ -123,6 +123,19 @@ SECTIONS {
__data_ram_start = .;
*(.data)
*(".data.*")
KEEP(*(.isr_irq*))
/*The following sections maps the location of the different rows for
the _sw_isr_table. Each row maps to an IRQ entry (handler, argument).*/
/*In ARC architecture, IRQ 0-15 are reserved for the system and are not
assignable by the user, for that reason the linker sections start
on IRQ 16*/
/* sections for IRQ16-19 */
KEEP(*(SORT(.gnu.linkonce.isr_irq[1][6-9])))
/* sections for IRQ20-99 */
KEEP(*(SORT(.gnu.linkonce.isr_irq[2-9][0-9])))
/* sections for IRQ100-999 */
KEEP(*(SORT(.gnu.linkonce.isr_irq[1-9][0-9][0-9])))
} GROUP_LINK_IN(RAMABLE_REGION)
SECTION_PROLOGUE(initlevel, (OPTIONAL),)