Changeset 45eaf8c in rtems


Ignore:
Timestamp:
Feb 2, 2012, 5:22:19 PM (7 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10
Children:
9591970
Parents:
954099e
Message:

LEON3: CPU index intialization moved to bspstart.c

2009/bsps

All LEON3/4 systems have a CPU-id, if on a single-CPU system the
ID is always zero. On a multicore system it ranges from 0 to 15.

The CPU index should always by updated even in a non-MP RTEMS OS
since the CPU running RTEMS may not always be CPU0. For example
when RTEMS runs on CPU1 and Linux on CPU0 in a mixed ASMP system.

The old code executed within the IRQ controller initialization code
makes no sense since the ASR register is a CPU register, it has
nothing to do with AMBA initialization either.

Signed-off-by: Daniel Hellstrom <daniel@…>

Location:
c/src/lib/libbsp/sparc/leon3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/leon3/amba/amba.c

    r954099e r45eaf8c  
    2222volatile LEON3_IrqCtrl_Regs_Map *LEON3_IrqCtrl_Regs;
    2323
    24 int LEON3_Cpu_Index = 0;
    25 
    2624/*
    2725 *  amba_initialize
     
    3432 */
    3533
    36 unsigned int getasr17(void);
    37 
    38 asm(" .text  \n"
    39     "getasr17:   \n"
    40     "retl \n"
    41     "mov %asr17, %o0\n"
    42 );
    43 
    44 
    45 extern rtems_configuration_table Configuration;
    4634extern int scan_uarts(void);
    4735
     
    5947    /* Found APB IRQ_MP Interrupt Controller */
    6048    LEON3_IrqCtrl_Regs = (volatile LEON3_IrqCtrl_Regs_Map *) dev.start;
    61 #if defined(RTEMS_MULTIPROCESSING)
    62       if (rtems_configuration_get_user_multiprocessing_table() != NULL) {
    63         unsigned int tmp = getasr17();
    64         LEON3_Cpu_Index = (tmp >> 28) & 3;
    65       }
    66 #endif
    6749  }
    6850
  • c/src/lib/libbsp/sparc/leon3/startup/bspstart.c

    r954099e r45eaf8c  
    2828int CPU_SPARC_HAS_SNOOPING;
    2929
     30/* Index of CPU, in an AMP system CPU-index may be non-zero */
     31int LEON3_Cpu_Index = 0;
     32
    3033extern void amba_initialize(void);
    3134
     
    4952}
    5053
     54/* ASM-function used to get the CPU-Index on calling LEON3 CPUs */
     55static inline unsigned int get_asr17(void)
     56{
     57  unsigned int reg;
     58  __asm__ (" mov %%asr17, %0 " : "=r"(reg) :);
     59  return reg;
     60}
     61
    5162/*
    5263 *  bsp_start
     
    5869  CPU_SPARC_HAS_SNOOPING = set_snooping();
    5970
     71  /* Get the LEON3 CPU index, normally 0, but for MP systems we do
     72   * _not_ assume that this is CPU0. One may run another OS on CPU0
     73   * and RTEMS on this CPU, and AMP system with mixed operating
     74   * systems
     75   */
     76  LEON3_Cpu_Index = (get_asr17() >> 28) & 3;
     77
    6078  /* Find UARTs */
    6179  amba_initialize();
Note: See TracChangeset for help on using the changeset viewer.