Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/****************************************************************************
* arch/arm/src/armv7-a/cp15.h
* arch/arm/include/armv7-a/cp15.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
Expand Down
22 changes: 5 additions & 17 deletions arch/arm/include/armv7-a/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
# include <stdint.h>
#endif

#include <arch/armv7-a/cp15.h>

/****************************************************************************
* Pre-processor Prototypes
****************************************************************************/
Expand Down Expand Up @@ -457,11 +459,7 @@ static inline_function int up_cpu_index(void)

/* Read the Multiprocessor Affinity Register (MPIDR) */

__asm__ __volatile__
(
"mrc " "p15, " "0" ", %0, " "c0" ", " "c0" ", " "5" "\n"
: "=r"(mpidr)
);
mpidr = CP15_GET(MPIDR);

/* And return the CPU ID field */

Expand Down Expand Up @@ -500,23 +498,13 @@ static inline_function uint32_t up_getsp(void)
noinstrument_function
static inline_function uint32_t *up_current_regs(void)
{
uint32_t *regs;
__asm__ __volatile__
(
"mrc " "p15, " "0" ", %0, " "c13" ", " "c0" ", " "4" "\n"
: "=r"(regs)
);
return regs;
return (uint32_t *)CP15_GET(TPIDRPRW);
}

noinstrument_function
static inline_function void up_set_current_regs(uint32_t *regs)
{
__asm__ __volatile__
(
"mcr " "p15, " "0" ", %0, " "c13" ", " "c0" ", " "4" "\n"
:: "r"(regs)
);
CP15_SET(TPIDRPRW, regs);
}

noinstrument_function
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/****************************************************************************
* arch/arm/src/armv7-r/cp15.h
* arch/arm/include/armv7-r/cp15.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
Expand Down
39 changes: 20 additions & 19 deletions arch/arm/include/armv7-r/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
# include <stdint.h>
#endif

#include <arch/armv7-r/cp15.h>

/****************************************************************************
* Pre-processor Prototypes
****************************************************************************/
Expand Down Expand Up @@ -357,7 +359,7 @@ static inline irqstate_t irqstate(void)

/* Disable IRQs and return the previous IRQ state */

static inline irqstate_t up_irq_save(void)
noinstrument_function static inline irqstate_t up_irq_save(void)
{
unsigned int cpsr;

Expand Down Expand Up @@ -417,7 +419,7 @@ static inline irqstate_t up_irq_disable(void)

/* Restore saved IRQ & FIQ state */

static inline void up_irq_restore(irqstate_t flags)
noinstrument_function static inline void up_irq_restore(irqstate_t flags)
{
__asm__ __volatile__
(
Expand Down Expand Up @@ -452,11 +454,7 @@ static inline_function int up_cpu_index(void)

/* Read the Multiprocessor Affinity Register (MPIDR) */

__asm__ __volatile__
(
"mrc " "p15, " "0" ", %0, " "c0" ", " "c0" ", " "5" "\n"
: "=r"(mpidr)
);
mpidr = CP15_GET(MPIDR);

/* And return the CPU ID field */

Expand All @@ -479,26 +477,29 @@ static inline_function uint32_t up_getsp(void)
return sp;
}

/****************************************************************************
* Name:
* up_current_regs/up_set_current_regs
*
* Description:
* We use the following code to manipulate the TPIDRPRW register,
* which exists uniquely for each CPU and is primarily designed to store
* current thread information. Currently, we leverage it to store interrupt
* information, with plans to further optimize its use for storing both
* thread and interrupt information in the future.
*
****************************************************************************/

noinstrument_function
static inline_function uint32_t *up_current_regs(void)
{
uint32_t *regs;
__asm__ __volatile__
(
"mrc " "p15, " "0" ", %0, " "c13" ", " "c0" ", " "4" "\n"
: "=r"(regs)
);
return regs;
return (uint32_t *)CP15_GET(TPIDRPRW);
}

noinstrument_function
static inline_function void up_set_current_regs(uint32_t *regs)
{
__asm__ __volatile__
(
"mcr " "p15, " "0" ", %0, " "c13" ", " "c0" ", " "4" "\n"
:: "r"(regs)
);
CP15_SET(TPIDRPRW, regs);
}

noinstrument_function
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/****************************************************************************
* arch/arm/src/armv8-r/cp15.h
* arch/arm/include/armv8-r/cp15.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
Expand Down
39 changes: 20 additions & 19 deletions arch/arm/include/armv8-r/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
# include <stdint.h>
#endif

#include <arch/armv8-r/cp15.h>

/****************************************************************************
* Pre-processor Prototypes
****************************************************************************/
Expand Down Expand Up @@ -357,7 +359,7 @@ static inline irqstate_t irqstate(void)

/* Disable IRQs and return the previous IRQ state */

static inline irqstate_t up_irq_save(void)
noinstrument_function static inline irqstate_t up_irq_save(void)
{
unsigned int cpsr;

Expand Down Expand Up @@ -417,7 +419,7 @@ static inline irqstate_t up_irq_disable(void)

/* Restore saved IRQ & FIQ state */

static inline void up_irq_restore(irqstate_t flags)
noinstrument_function static inline void up_irq_restore(irqstate_t flags)
{
__asm__ __volatile__
(
Expand Down Expand Up @@ -452,11 +454,7 @@ static inline_function int up_cpu_index(void)

/* Read the Multiprocessor Affinity Register (MPIDR) */

__asm__ __volatile__
(
"mrc " "p15, " "0" ", %0, " "c0" ", " "c0" ", " "5" "\n"
: "=r"(mpidr)
);
mpidr = CP15_GET(MPIDR);

/* And return the CPU ID field */

Expand All @@ -479,26 +477,29 @@ static inline_function uint32_t up_getsp(void)
return sp;
}

/****************************************************************************
* Name:
* up_current_regs/up_set_current_regs
*
* Description:
* We use the following code to manipulate the TPIDRPRW register,
* which exists uniquely for each CPU and is primarily designed to store
* current thread information. Currently, we leverage it to store interrupt
* information, with plans to further optimize its use for storing both
* thread and interrupt information in the future.
*
****************************************************************************/

noinstrument_function
static inline_function uint32_t *up_current_regs(void)
{
uint32_t *regs;
__asm__ __volatile__
(
"mrc " "p15, " "0" ", %0, " "c13" ", " "c0" ", " "4" "\n"
: "=r"(regs)
);
return regs;
return (uint32_t *)CP15_GET(TPIDRPRW);
}

noinstrument_function
static inline_function void up_set_current_regs(uint32_t *regs)
{
__asm__ __volatile__
(
"mcr " "p15, " "0" ", %0, " "c13" ", " "c0" ", " "4" "\n"
:: "r"(regs)
);
CP15_SET(TPIDRPRW, regs);
}

noinstrument_function
Expand Down
1 change: 0 additions & 1 deletion arch/arm/src/armv7-a/arm_cpuhead.S
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <arch/irq.h>

#include "arm.h"
#include "cp15.h"
#include "sctlr.h"
#include "mmu.h"
#include "smp.h"
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/armv7-a/arm_cpuinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
#include <nuttx/config.h>
#include <nuttx/fs/procfs.h>

#include <arch/irq.h>

#include "arm_internal.h"
#include "hwcap.h"
#include "cp15.h"

#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_CPUINFO)

Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/armv7-a/arm_fpuconfig.S
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
****************************************************************************/

#include <nuttx/config.h>
#include "cp15.h"

#include <arch/irq.h>

#ifdef CONFIG_ARCH_FPU

Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/armv7-a/arm_head.S
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@

#include <nuttx/config.h>

#include <arch/irq.h>

#include "arm.h"
#include "cp15.h"
#include "sctlr.h"
#include "mmu.h"
#include "chip.h"
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/armv7-a/arm_pghead.S
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
#include <nuttx/config.h>
#include <nuttx/page.h>

#include <arch/irq.h>

#include "arm.h"
#include "cp15.h"
#include "sctlr.h"
#include "mmu.h"
#include "chip.h"
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/armv7-a/arm_scu.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@

#include <stdint.h>

#include <arch/irq.h>

#include "arm_internal.h"
#include "cp15_cacheops.h"
#include "barriers.h"
#include "sctlr.h"
#include "scu.h"
#include "cp15.h"

/****************************************************************************
* Public Functions
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/armv7-a/arm_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
#include <nuttx/irq.h>
#include <nuttx/kmalloc.h>

#include <arch/irq.h>

#include "arm_timer.h"
#include "barriers.h"
#include "gic.h"
#include "cp15.h"

/****************************************************************************
* Pre-processor Definitions
Expand Down
1 change: 0 additions & 1 deletion arch/arm/src/armv7-a/arm_vectors.S
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <nuttx/irq.h>

#include "arm.h"
#include "cp15.h"
#include "chip.h"

.file "arm_vectors.S"
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/armv7-a/sctlr.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
* Included Files
****************************************************************************/

#include <arch/irq.h>

#include "barriers.h"
#include "cp15.h"

/****************************************************************************
* Pre-processor Definitions
Expand Down
1 change: 0 additions & 1 deletion arch/arm/src/armv7-r/arm_cpuhead.S
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <arch/irq.h>

#include "arm.h"
#include "cp15.h"
#include "sctlr.h"
#include "smp.h"
#include "chip.h"
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/armv7-r/arm_cpuinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
#include <nuttx/config.h>
#include <nuttx/fs/procfs.h>

#include <arch/irq.h>

#include "arm_internal.h"
#include "hwcap.h"
#include "cp15.h"

#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_CPUINFO)

Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/armv7-r/arm_fpuconfig.S
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
****************************************************************************/

#include <nuttx/config.h>
#include "cp15.h"

#include <arch/irq.h>

#ifdef CONFIG_ARCH_FPU

Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/armv7-r/arm_head.S
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@

#include <nuttx/config.h>

#include <arch/irq.h>

#include "arm.h"
#include "cp15.h"
#include "sctlr.h"
#include "arm_internal.h"

Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/armv7-r/arm_scu.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@

#include <stdint.h>

#include <arch/irq.h>

#include "arm_internal.h"
#include "cp15_cacheops.h"
#include "barriers.h"
#include "sctlr.h"
#include "scu.h"
#include "cp15.h"

/****************************************************************************
* Public Functions
Expand Down
1 change: 0 additions & 1 deletion arch/arm/src/armv7-r/arm_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "arm_timer.h"
#include "barriers.h"
#include "gic.h"
#include "cp15.h"

/****************************************************************************
* Pre-processor Definitions
Expand Down
Loading