Ticket #2009: 0005-LEON3-CPU-index-intialization-_HEAD.patch

File 0005-LEON3-CPU-index-intialization-_HEAD.patch, 2.3 KB (added by Daniel Hellstrom, on 02/02/12 at 15:21:28)

patch for HEAD

  • c/src/lib/libbsp/sparc/leon3/amba/amba.c

    diff --git a/c/src/lib/libbsp/sparc/leon3/amba/amba.c b/c/src/lib/libbsp/sparc/leon3/amba/amba.c
    index 1932cee..b0a43f9 100644
    a b amba_confarea_type amba_conf; 
    2121/* Pointers to Interrupt Controller configuration registers */
    2222volatile LEON3_IrqCtrl_Regs_Map *LEON3_IrqCtrl_Regs;
    2323
    24 int LEON3_Cpu_Index = 0;
    25 
    2624/*
    2725 *  amba_initialize
    2826 *
    int LEON3_Cpu_Index = 0; 
    3331 *  amba_ahb_masters, amba_ahb_slaves and amba.
    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
    4836void amba_initialize(void)
    void amba_initialize(void) 
    5846  if ( i > 0 ){
    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
    6951  /* find GP Timer */
  • c/src/lib/libbsp/sparc/leon3/startup/bspstart.c

    diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c b/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
    index a4b9ffa..82054e8 100644
    a b  
    2727 */
    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
    3235/*
    static inline int set_snooping(void) 
    4851  return (tmp >> 27) & 1;
    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
    5364 *
    void bsp_start( void ) 
    5768{
    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();
    6280}