Skip to content

Commit

Permalink
xtensa: inline up_cpu_index
Browse files Browse the repository at this point in the history
Signed-off-by: chenxiaoyi <[email protected]>
  • Loading branch information
chirping78 authored and xiaoxiang781216 committed Jan 23, 2025
1 parent d9270f9 commit de55f64
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 113 deletions.
17 changes: 17 additions & 0 deletions arch/xtensa/include/esp32/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,23 @@ static inline_function int esp32_irq_gpio(int cpu)
#endif
#endif

#ifdef CONFIG_ARCH_HAVE_MULTICPU
noinstrument_function
static inline_function int xtensa_cpu_index(void)
{
int index;

__asm__ __volatile__
(
"rsr.prid %0\n"
"extui %0,%0,13,1\n"
: "=r"(index)
);

return index;
}
#endif /* CONFIG_ARCH_HAVE_MULTICPU */

/****************************************************************************
* Public Data
****************************************************************************/
Expand Down
17 changes: 17 additions & 0 deletions arch/xtensa/include/esp32s3/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,23 @@
* Inline functions
****************************************************************************/

#ifdef CONFIG_ARCH_HAVE_MULTICPU
noinstrument_function
static inline_function int xtensa_cpu_index(void)
{
int index;

__asm__ __volatile__
(
"rsr.prid %0\n"
"extui %0,%0,13,1\n"
: "=r"(index)
);

return index;
}
#endif /* CONFIG_ARCH_HAVE_MULTICPU */

/****************************************************************************
* Public Data
****************************************************************************/
Expand Down
6 changes: 5 additions & 1 deletion arch/xtensa/include/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,11 @@ irqstate_t xtensa_disable_interrupts(irqstate_t mask);
****************************************************************************/

#ifdef CONFIG_ARCH_HAVE_MULTICPU
int up_cpu_index(void) noinstrument_function;
noinstrument_function
static inline_function int up_cpu_index(void)
{
return xtensa_cpu_index();
}
#endif /* CONFIG_ARCH_HAVE_MULTICPU */

/****************************************************************************
Expand Down
4 changes: 0 additions & 4 deletions arch/xtensa/src/esp32/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ ifeq ($(CONFIG_SMP),y)
CHIP_CSRCS += esp32_cpuidlestack.c esp32_cpustart.c esp32_intercpu_interrupt.c
endif

ifeq ($(CONFIG_ARCH_HAVE_MULTICPU),y)
CHIP_ASRCS = esp32_cpuindex.S
endif

ifeq ($(CONFIG_ESP32_UART),y)
CHIP_CSRCS += esp32_serial.c
endif
Expand Down
52 changes: 0 additions & 52 deletions arch/xtensa/src/esp32/esp32_cpuindex.S

This file was deleted.

4 changes: 0 additions & 4 deletions arch/xtensa/src/esp32s3/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ ifeq ($(CONFIG_SMP),y)
CHIP_CSRCS += esp32s3_cpuidlestack.c esp32s3_cpustart.c esp32s3_intercpu_interrupt.c
endif

ifeq ($(CONFIG_ARCH_HAVE_MULTICPU),y)
CHIP_ASRCS = esp32s3_cpuindex.S
endif

ifeq ($(CONFIG_ESP32S3_EFUSE),y)
CHIP_CSRCS += esp32s3_efuse.c
CHIP_CSRCS += esp32s3_efuse_table.c
Expand Down
52 changes: 0 additions & 52 deletions arch/xtensa/src/esp32s3/esp32s3_cpuindex.S

This file was deleted.

0 comments on commit de55f64

Please sign in to comment.