Changeset 9165349d in rtems


Ignore:
Timestamp:
Jan 12, 2021, 6:13:08 AM (4 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
19acb3b
Parents:
c968b27
git-author:
Sebastian Huber <sebastian.huber@…> (01/12/21 06:13:08)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/01/21 05:26:18)
Message:

nios2: Use Per_CPU_Control::isr_dispatch_disable

Location:
cpukit/score/cpu/nios2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/cpu/nios2/include/rtems/score/cpu.h

    rc968b27 r9165349d  
    107107 * There is no need to save the global pointer (gp) since it is a system wide
    108108 * constant and set-up with the C runtime environment.
    109  *
    110  * The @a thread_dispatch_disabled field is used for the external interrupt
    111  * controller (EIC) support.
    112  *
    113  * @see _Nios2_Thread_dispatch_disabled
    114109 */
    115110typedef struct {
     
    126121  uint32_t sp;
    127122  uint32_t ra;
    128   uint32_t thread_dispatch_disabled;
     123
     124  /**
     125   * @brief This member is used for the external interrupt controller (EIC) support.
     126   *
     127   * It corresponds to Per_CPU_Control::isr_dispatch_disable.
     128   */
     129  uint32_t isr_dispatch_disable;
     130
    129131  uint32_t stack_mpubase;
    130132  uint32_t stack_mpuacc;
  • cpukit/score/cpu/nios2/include/rtems/score/nios2-utility.h

    rc968b27 r9165349d  
    4848#define NIOS2_CONTEXT_OFFSET_SP 40
    4949#define NIOS2_CONTEXT_OFFSET_RA 44
    50 #define NIOS2_CONTEXT_OFFSET_THREAD_DISPATCH_DISABLED 48
     50#define NIOS2_CONTEXT_OFFSET_ISR_DISPATCH_DISABLE 48
    5151#define NIOS2_CONTEXT_OFFSET_STACK_MPUBASE 52
    5252#define NIOS2_CONTEXT_OFFSET_STACK_MPUACC 56
     
    145145
    146146/**
    147  * @brief Nios II specific thread dispatch disabled indicator.
    148  *
    149  * This global variable is used by the interrupt dispatch support for the
    150  * external interrupt controller (EIC) with shadow registers.  This makes it
    151  * possible to do the thread dispatch after an interrupt without disabled
    152  * interrupts and thus probably reduce the maximum interrupt latency.  Its
    153  * purpose is to prevent unbounded stack usage of the interrupted thread.
    154  */
    155 extern uint32_t _Nios2_Thread_dispatch_disabled;
    156 
    157 /**
    158147 * @brief This global symbol specifies the status register mask used to disable
    159148 * interrupts.
  • cpukit/score/cpu/nios2/nios2-context-switch.S

    rc968b27 r9165349d  
    1616#endif
    1717
    18 #include <rtems/score/cpu.h>
     18#include <rtems/score/percpu.h>
    1919#include <rtems/score/nios2-utility.h>
    2020
    21         .extern _Nios2_Thread_dispatch_disabled
     21        .extern _Per_CPU_Information
    2222
    2323        .globl  _CPU_Context_switch
     
    2626_CPU_Context_switch:
    2727
    28         ldw     r9, %gprel(_Nios2_Thread_dispatch_disabled)(gp)
     28        ldw     r9, %gprel(_Per_CPU_Information + PER_CPU_ISR_DISPATCH_DISABLE)(gp)
    2929        rdctl   r8, status
    3030        stw     r16, NIOS2_CONTEXT_OFFSET_R16(r4)
     
    4040        stw     sp, NIOS2_CONTEXT_OFFSET_SP(r4)
    4141        stw     ra, NIOS2_CONTEXT_OFFSET_RA(r4)
    42         stw     r9, NIOS2_CONTEXT_OFFSET_THREAD_DISPATCH_DISABLED(r4)
     42        stw     r9, NIOS2_CONTEXT_OFFSET_ISR_DISPATCH_DISABLE(r4)
    4343
    4444restore:
    4545
    46         ldw     r10, NIOS2_CONTEXT_OFFSET_THREAD_DISPATCH_DISABLED(r5)
     46        ldw     r10, NIOS2_CONTEXT_OFFSET_ISR_DISPATCH_DISABLE(r5)
    4747        ldw     r16, NIOS2_CONTEXT_OFFSET_R16(r5)
    4848        ldw     r17, NIOS2_CONTEXT_OFFSET_R17(r5)
     
    5454        ldw     r23, NIOS2_CONTEXT_OFFSET_R23(r5)
    5555        ldw     fp, NIOS2_CONTEXT_OFFSET_FP(r5)
    56         stw     r10, %gprel(_Nios2_Thread_dispatch_disabled)(gp)
     56        stw     r10, %gprel(_Per_CPU_Information + PER_CPU_ISR_DISPATCH_DISABLE)(gp)
    5757        ldw     r11, NIOS2_CONTEXT_OFFSET_STATUS(r5)
    5858        ldw     sp, NIOS2_CONTEXT_OFFSET_SP(r5)
  • cpukit/score/cpu/nios2/nios2-eic-il-low-level.S

    rc968b27 r9165349d  
    4242
    4343        .extern _Per_CPU_Information
    44         .extern _Nios2_Thread_dispatch_disabled
    4544        .extern _Nios2_ISR_Status_interrupts_disabled
    4645
     
    6665        ldb     r12, %gprel(_Per_CPU_Information + PER_CPU_DISPATCH_NEEDED)(gp)
    6766
    68         /* Load Nios II specific thread dispatch disabled */
    69         ldw     r13, %gprel(_Nios2_Thread_dispatch_disabled)(gp)
     67        /* Load thread dispatch after ISR disable indicator */
     68        ldw     r13, %gprel(_Per_CPU_Information + PER_CPU_ISR_DISPATCH_DISABLE)(gp)
    7069
    7170        /* Read status */
     
    9392        bne     r14, zero, no_thread_dispatch
    9493
    95         /* Is Nios II specific thread dispatch allowed? */
     94        /* Is thread dispatch after ISR allowed? */
    9695        bne     r13, zero, no_thread_dispatch
    9796
     
    9998        rdprs   r15, sp, -FRAME_SIZE
    10099
    101         /* Disable Nios II specific thread dispatch */
    102         stw     r12, %gprel(_Nios2_Thread_dispatch_disabled)(gp)
     100        /* Disable thread dispatch after ISR */
     101        stw     r12, %gprel(_Per_CPU_Information + PER_CPU_ISR_DISPATCH_DISABLE)(gp)
    103102
    104103        /* Save context */
     
    185184        bne     r13, zero, enable_interrupts_before_thread_dispatch
    186185
    187         /* Enable Nios II specific thread dispatch */
    188         stw     zero, %gprel(_Nios2_Thread_dispatch_disabled)(gp)
     186        /* Enable thread dispatch after ISR */
     187        stw     zero, %gprel(_Per_CPU_Information + PER_CPU_ISR_DISPATCH_DISABLE)(gp)
    189188
    190189        /* Restore remaining volatile register */
  • cpukit/score/cpu/nios2/nios2-thread-dispatch-disabled.c

    rc968b27 r9165349d  
    4444NIOS2_ASSERT_OFFSET(sp, SP);
    4545NIOS2_ASSERT_OFFSET(ra, RA);
    46 NIOS2_ASSERT_OFFSET(thread_dispatch_disabled, THREAD_DISPATCH_DISABLED);
     46NIOS2_ASSERT_OFFSET(isr_dispatch_disable, ISR_DISPATCH_DISABLE);
    4747NIOS2_ASSERT_OFFSET(stack_mpubase, STACK_MPUBASE);
    4848NIOS2_ASSERT_OFFSET(stack_mpuacc, STACK_MPUACC);
    49 
    50 uint32_t _Nios2_Thread_dispatch_disabled;
Note: See TracChangeset for help on using the changeset viewer.