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

4.115
Last change on this file since f7f1d77 was f7f1d77, checked in by Alex Ivanov <alexivanov97@…>, on 11/28/12 at 14:11:31

score misc: Clean up Doxygen (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.
https://google-melange.appspot.com/gci/task/view/google/gci2012/7978208

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