Commit 4f17664a authored by Max Filippov's avatar Max Filippov

xtensa: separate SMP and XIP support

There's no real dependency between SMP and XIP, allow them to be
selected together. Always define 2- and 4-argument SECTION_VECTOR
macros, always use 4-argument macro for the secondary reset vector and
always define relocation entry for it.
Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
parent 50722f0b
...@@ -54,8 +54,7 @@ jiffies = jiffies_64; ...@@ -54,8 +54,7 @@ jiffies = jiffies_64;
* to description recorded in the corresponding RELOCATE_ENTRY. * to description recorded in the corresponding RELOCATE_ENTRY.
*/ */
#ifdef CONFIG_VECTORS_OFFSET #define SECTION_VECTOR4(sym, section, addr, prevsec) \
#define SECTION_VECTOR(sym, section, addr, prevsec) \
section addr : AT(((LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \ section addr : AT(((LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
{ \ { \
. = ALIGN(4); \ . = ALIGN(4); \
...@@ -63,11 +62,10 @@ jiffies = jiffies_64; ...@@ -63,11 +62,10 @@ jiffies = jiffies_64;
*(section) \ *(section) \
sym ## _end = ABSOLUTE(.); \ sym ## _end = ABSOLUTE(.); \
} }
#else
#define SECTION_VECTOR(section, addr) \ #define SECTION_VECTOR2(section, addr) \
. = addr; \ . = addr; \
*(section) *(section)
#endif
/* /*
* Mapping of input sections to output sections when linking. * Mapping of input sections to output sections when linking.
...@@ -87,31 +85,31 @@ SECTIONS ...@@ -87,31 +85,31 @@ SECTIONS
HEAD_TEXT HEAD_TEXT
#ifndef CONFIG_VECTORS_OFFSET #ifndef CONFIG_VECTORS_OFFSET
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
_vecbase = .; _vecbase = .;
SECTION_VECTOR (.WindowVectors.text, WINDOW_VECTORS_VADDR) SECTION_VECTOR2 (.WindowVectors.text, WINDOW_VECTORS_VADDR)
#if XCHAL_EXCM_LEVEL >= 2 #if XCHAL_EXCM_LEVEL >= 2
SECTION_VECTOR (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR) SECTION_VECTOR2 (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR)
#endif #endif
#if XCHAL_EXCM_LEVEL >= 3 #if XCHAL_EXCM_LEVEL >= 3
SECTION_VECTOR (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR) SECTION_VECTOR2 (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR)
#endif #endif
#if XCHAL_EXCM_LEVEL >= 4 #if XCHAL_EXCM_LEVEL >= 4
SECTION_VECTOR (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR) SECTION_VECTOR2 (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR)
#endif #endif
#if XCHAL_EXCM_LEVEL >= 5 #if XCHAL_EXCM_LEVEL >= 5
SECTION_VECTOR (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR) SECTION_VECTOR2 (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR)
#endif #endif
#if XCHAL_EXCM_LEVEL >= 6 #if XCHAL_EXCM_LEVEL >= 6
SECTION_VECTOR (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR) SECTION_VECTOR2 (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR)
#endif #endif
SECTION_VECTOR (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR) SECTION_VECTOR2 (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR)
SECTION_VECTOR (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR) SECTION_VECTOR2 (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR)
SECTION_VECTOR (.UserExceptionVector.text, USER_VECTOR_VADDR) SECTION_VECTOR2 (.UserExceptionVector.text, USER_VECTOR_VADDR)
SECTION_VECTOR (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR) SECTION_VECTOR2 (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR)
*(.exception.text) *(.exception.text)
#endif #endif
IRQENTRY_TEXT IRQENTRY_TEXT
...@@ -198,11 +196,10 @@ SECTIONS ...@@ -198,11 +196,10 @@ SECTIONS
#ifdef CONFIG_XIP_KERNEL #ifdef CONFIG_XIP_KERNEL
RELOCATE_ENTRY(_xip_data, .data); RELOCATE_ENTRY(_xip_data, .data);
RELOCATE_ENTRY(_xip_init_data, .init.data); RELOCATE_ENTRY(_xip_init_data, .init.data);
#else #endif
#if defined(CONFIG_SMP) #if defined(CONFIG_SMP)
RELOCATE_ENTRY(_SecondaryResetVector_text, RELOCATE_ENTRY(_SecondaryResetVector_text,
.SecondaryResetVector.text); .SecondaryResetVector.text);
#endif
#endif #endif
__boot_reloc_table_end = ABSOLUTE(.) ; __boot_reloc_table_end = ABSOLUTE(.) ;
...@@ -220,21 +217,24 @@ SECTIONS ...@@ -220,21 +217,24 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.dummy : { LONG(0) } .dummy : { LONG(0) }
#undef LAST
#define LAST .dummy
#ifdef CONFIG_VECTORS_OFFSET #ifdef CONFIG_VECTORS_OFFSET
/* The vectors are relocated to the real position at startup time */ /* The vectors are relocated to the real position at startup time */
SECTION_VECTOR (_WindowVectors_text, SECTION_VECTOR4 (_WindowVectors_text,
.WindowVectors.text, .WindowVectors.text,
WINDOW_VECTORS_VADDR, WINDOW_VECTORS_VADDR,
.dummy) .dummy)
SECTION_VECTOR (_DebugInterruptVector_text, SECTION_VECTOR4 (_DebugInterruptVector_text,
.DebugInterruptVector.text, .DebugInterruptVector.text,
DEBUG_VECTOR_VADDR, DEBUG_VECTOR_VADDR,
.WindowVectors.text) .WindowVectors.text)
#undef LAST #undef LAST
#define LAST .DebugInterruptVector.text #define LAST .DebugInterruptVector.text
#if XCHAL_EXCM_LEVEL >= 2 #if XCHAL_EXCM_LEVEL >= 2
SECTION_VECTOR (_Level2InterruptVector_text, SECTION_VECTOR4 (_Level2InterruptVector_text,
.Level2InterruptVector.text, .Level2InterruptVector.text,
INTLEVEL2_VECTOR_VADDR, INTLEVEL2_VECTOR_VADDR,
LAST) LAST)
...@@ -242,7 +242,7 @@ SECTIONS ...@@ -242,7 +242,7 @@ SECTIONS
# define LAST .Level2InterruptVector.text # define LAST .Level2InterruptVector.text
#endif #endif
#if XCHAL_EXCM_LEVEL >= 3 #if XCHAL_EXCM_LEVEL >= 3
SECTION_VECTOR (_Level3InterruptVector_text, SECTION_VECTOR4 (_Level3InterruptVector_text,
.Level3InterruptVector.text, .Level3InterruptVector.text,
INTLEVEL3_VECTOR_VADDR, INTLEVEL3_VECTOR_VADDR,
LAST) LAST)
...@@ -250,7 +250,7 @@ SECTIONS ...@@ -250,7 +250,7 @@ SECTIONS
# define LAST .Level3InterruptVector.text # define LAST .Level3InterruptVector.text
#endif #endif
#if XCHAL_EXCM_LEVEL >= 4 #if XCHAL_EXCM_LEVEL >= 4
SECTION_VECTOR (_Level4InterruptVector_text, SECTION_VECTOR4 (_Level4InterruptVector_text,
.Level4InterruptVector.text, .Level4InterruptVector.text,
INTLEVEL4_VECTOR_VADDR, INTLEVEL4_VECTOR_VADDR,
LAST) LAST)
...@@ -258,7 +258,7 @@ SECTIONS ...@@ -258,7 +258,7 @@ SECTIONS
# define LAST .Level4InterruptVector.text # define LAST .Level4InterruptVector.text
#endif #endif
#if XCHAL_EXCM_LEVEL >= 5 #if XCHAL_EXCM_LEVEL >= 5
SECTION_VECTOR (_Level5InterruptVector_text, SECTION_VECTOR4 (_Level5InterruptVector_text,
.Level5InterruptVector.text, .Level5InterruptVector.text,
INTLEVEL5_VECTOR_VADDR, INTLEVEL5_VECTOR_VADDR,
LAST) LAST)
...@@ -266,41 +266,41 @@ SECTIONS ...@@ -266,41 +266,41 @@ SECTIONS
# define LAST .Level5InterruptVector.text # define LAST .Level5InterruptVector.text
#endif #endif
#if XCHAL_EXCM_LEVEL >= 6 #if XCHAL_EXCM_LEVEL >= 6
SECTION_VECTOR (_Level6InterruptVector_text, SECTION_VECTOR4 (_Level6InterruptVector_text,
.Level6InterruptVector.text, .Level6InterruptVector.text,
INTLEVEL6_VECTOR_VADDR, INTLEVEL6_VECTOR_VADDR,
LAST) LAST)
# undef LAST # undef LAST
# define LAST .Level6InterruptVector.text # define LAST .Level6InterruptVector.text
#endif #endif
SECTION_VECTOR (_KernelExceptionVector_text, SECTION_VECTOR4 (_KernelExceptionVector_text,
.KernelExceptionVector.text, .KernelExceptionVector.text,
KERNEL_VECTOR_VADDR, KERNEL_VECTOR_VADDR,
LAST) LAST)
#undef LAST #undef LAST
SECTION_VECTOR (_UserExceptionVector_text, SECTION_VECTOR4 (_UserExceptionVector_text,
.UserExceptionVector.text, .UserExceptionVector.text,
USER_VECTOR_VADDR, USER_VECTOR_VADDR,
.KernelExceptionVector.text) .KernelExceptionVector.text)
SECTION_VECTOR (_DoubleExceptionVector_text, SECTION_VECTOR4 (_DoubleExceptionVector_text,
.DoubleExceptionVector.text, .DoubleExceptionVector.text,
DOUBLEEXC_VECTOR_VADDR, DOUBLEEXC_VECTOR_VADDR,
.UserExceptionVector.text) .UserExceptionVector.text)
#define LAST .DoubleExceptionVector.text #define LAST .DoubleExceptionVector.text
#endif #endif
#if !defined(CONFIG_XIP_KERNEL) && defined(CONFIG_SMP) #if defined(CONFIG_SMP)
SECTION_VECTOR (_SecondaryResetVector_text, SECTION_VECTOR4 (_SecondaryResetVector_text,
.SecondaryResetVector.text, .SecondaryResetVector.text,
RESET_VECTOR1_VADDR, RESET_VECTOR1_VADDR,
.DoubleExceptionVector.text) LAST)
#undef LAST #undef LAST
#define LAST .SecondaryResetVector.text #define LAST .SecondaryResetVector.text
#endif #endif
#ifdef CONFIG_VECTORS_OFFSET #ifdef CONFIG_VECTORS_OFFSET
SECTION_VECTOR (_exception_text, SECTION_VECTOR4 (_exception_text,
.exception.text, .exception.text,
, ,
LAST) LAST)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment