source: rtems/cpukit/score/src/percpu.c @ e79093a

4.115
Last change on this file since e79093a was e79093a, checked in by Joel Sherrill <joel.sherrill@…>, on 04/04/11 at 16:40:00

2011-04-04 Joel Sherrill <joel.sherrilL@…>

PR 1773/cpukit

  • sapi/include/confdefs.h, sapi/src/exinit.c, score/include/rtems/bspsmp.h, score/src/percpu.c, score/src/thread.c: Rename rtems_smp_maximum_processor to rtems_configuration_smp_maximum_processor. Eliminate printk().
  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <rtems/system.h>
17#include <rtems/score/thread.h>
18#include <rtems/score/percpu.h>
19#include <rtems/score/wkspace.h>
20#include <rtems/score/wkspace.h>
21#include <rtems/config.h>
22#include <rtems/bspsmp.h>
23#include <string.h>
24
25#if defined(RTEMS_SMP)
26  void _SMP_Handler_initialize(void)
27  {
28    int         cpu;
29    size_t      size;
30    uintptr_t   ptr;
31
32    /*
33     *  Initialize per CPU structures.
34     */
35    size = (_SMP_Processor_count) * sizeof(Per_CPU_Control);
36    memset( _Per_CPU_Information, '\0', size );
37
38    /*
39     *  Initialize per cpu pointer table
40     */
41    size = Configuration.interrupt_stack_size;
42    _Per_CPU_Information_p[0] = &_Per_CPU_Information[0];
43    for (cpu=1 ; cpu < rtems_configuration_smp_maximum_processors; cpu++ ) {
44
45      Per_CPU_Control *p = &_Per_CPU_Information[cpu];
46
47      _Per_CPU_Information_p[cpu] = p;
48
49      p->interrupt_stack_low = _Workspace_Allocate_or_fatal_error( size );
50
51      ptr = (uintptr_t) _Addresses_Add_offset( p->interrupt_stack_low, size );
52      ptr &= ~CPU_STACK_ALIGNMENT;
53      p->interrupt_stack_high = (void *)ptr;
54      p->state = RTEMS_BSP_SMP_CPU_INITIAL_STATE;
55      RTEMS_COMPILER_MEMORY_BARRIER();
56    }
57  }
58#else
59  /*
60   * On single core systems, we can efficiently directly access a single
61   * statically allocated per cpu structure.  And the fields are initialized
62   * as individual elements just like it has always been done.
63   */
64  Per_CPU_Control _Per_CPU_Information[1];
65#endif
Note: See TracBrowser for help on using the repository browser.