Changeset ad56361 in rtems


Ignore:
Timestamp:
Feb 13, 2014, 12:00:00 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
e644155a
Parents:
945853b7
git-author:
Sebastian Huber <sebastian.huber@…> (02/13/14 12:00:00)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/14/14 09:28:30)
Message:

sparc: Add LEON3_ASR17_PROCESSOR_INDEX_SHIFT

Add _LEON3_Get_current_processor().

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/leon3/include/leon.h

    r945853b7 rad56361  
    124124
    125125/* LEON3 CPU Index of boot CPU */
    126 extern int LEON3_Cpu_Index;
     126extern uint32_t LEON3_Cpu_Index;
    127127
    128128/* The external IRQ number, -1 if not external interrupts */
  • c/src/lib/libbsp/sparc/leon3/smp/getcpuid.c

    r945853b7 rad56361  
    1818uint32_t _CPU_SMP_Get_current_processor( void )
    1919{
    20   uint32_t id;
    21   __asm__ __volatile__( "rd     %%asr17,%0\n\t" : "=r" (id) : );
    22 
    23   return ((id >> 28) & 0xff);
     20  return _LEON3_Get_current_processor();
    2421}
    2522
  • c/src/lib/libbsp/sparc/leon3/startup/bspstart.c

    r945853b7 rad56361  
    2828
    2929/* Index of CPU, in an AMP system CPU-index may be non-zero */
    30 int LEON3_Cpu_Index = 0;
     30uint32_t LEON3_Cpu_Index = 0;
    3131
    3232extern void amba_initialize(void);
     
    5151}
    5252
    53 /* ASM-function used to get the CPU-Index on calling LEON3 CPUs */
    54 static inline unsigned int get_asr17(void)
    55 {
    56   unsigned int reg;
    57   __asm__ (" mov %%asr17, %0 " : "=r"(reg) :);
    58   return reg;
    59 }
    60 
    6153/*
    6254 *  bsp_start
     
    7365   * systems
    7466   */
    75   LEON3_Cpu_Index = (get_asr17() >> 28) & 3;
     67  LEON3_Cpu_Index = _LEON3_Get_current_processor();
    7668
    7769  /* Scan AMBA Plug&Play and parse it into a RAM description (ambapp_plb),
  • c/src/lib/libbsp/sparc/shared/irq_asm.S

    r945853b7 rad56361  
    3232        /* LEON3 SMP support */
    3333        rd       %asr17, \TMP
    34         srl      \TMP, 28, \TMP /* CPU number is upper 4 bits so shift */
     34        srl      \TMP, LEON3_ASR17_PROCESSOR_INDEX_SHIFT, \TMP
    3535#else
    3636        mov      0, \TMP
  • c/src/lib/libbsp/sparc/shared/start/start.S

    r945853b7 rad56361  
    225225#if defined(START_LEON3_ENABLE_SMP)
    226226        rd      %asr17, %o0             ! get CPU identifier
    227         srl     %o0, 28, %o0            ! CPU index is upper 4 bits so shift
     227        srl     %o0, LEON3_ASR17_PROCESSOR_INDEX_SHIFT, %o0
    228228
    229229        cmp     %o0, 0
  • cpukit/score/cpu/sparc/rtems/score/sparc.h

    r945853b7 rad56361  
    148148#define SPARC_PSR_IMPL_BIT_POSITION 28   /* bits 28 - 31 */
    149149
     150#define LEON3_ASR17_PROCESSOR_INDEX_SHIFT 28
     151
    150152#ifndef ASM
    151153
     
    293295  } while ( 0 )
    294296
     297static inline uint32_t _LEON3_Get_current_processor( void )
     298{
     299  uint32_t asr17;
     300
     301  __asm__ (
     302    "rd %%asr17, %0"
     303    : "=&r" (asr17)
     304  );
     305
     306  return asr17 >> LEON3_ASR17_PROCESSOR_INDEX_SHIFT;
     307}
     308
    295309#endif
    296310
Note: See TracChangeset for help on using the changeset viewer.