source: rtems/cpukit/score/include/rtems/bspsmp.h @ 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: 6.4 KB
Line 
1/**
2 *  @file  rtems/bspsmp.h
3 *
4 *  This include file defines the interface between RTEMS and an
5 *  SMP aware BSP.  These methods will only be used when RTEMS
6 *  is configured with SMP support enabled.
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2011.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 *
17 *  $Id$
18 */
19
20#ifndef _RTEMS_BSPSMP_H
21#define _RTEMS_BSPSMP_H
22
23#if defined (RTEMS_SMP)
24#include <rtems/score/percpu.h>
25
26/**
27 *  @defgroup RTEMS BSP SMP Interface
28 *
29 *  This defines the interface between RTEMS and the BSP for
30 *  SMP support.  The interface uses the term primary
31 *  to refer to the "boot" processor and secondary to refer
32 *  to the "application" processors.  Different architectures
33 *  use different terminology.
34 *
35 *  It is assumed that when the processor is reset and thus
36 *  when RTEMS is initialized, that the primary processor is
37 *  the only one executing.  The others are assumed to be in
38 *  a quiescent or reset state awaiting a command to come online.
39 */
40
41/**@{*/
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47/**
48 *  This defines the bit which indicates the interprocessor interrupt
49 *  has been requested so that RTEMS will reschedule on this CPU
50 *  because the currently executing thread needs to be switched out.
51 */
52#define RTEMS_BSP_SMP_CONTEXT_SWITCH_NECESSARY  0x01
53
54/**
55 *  This defines the bit which indicates the interprocessor interrupt
56 *  has been requested so that RTEMS will reschedule on this CPU
57 *  because the currently executing thread has been sent a signal.
58 */
59#define RTEMS_BSP_SMP_SIGNAL_TO_SELF            0x02
60
61/**
62 *  This defines the bit which indicates the interprocessor interrupt
63 *  has been requested so that this CPU will be shutdown.  This is done
64 *  as part of rtems_executive_shutdown().
65 */
66#define RTEMS_BSP_SMP_SHUTDOWN                  0x04
67
68/**
69 *  This defines the bit which indicates the interprocessor interrupt
70 *  has been requested that the receiving CPU needs to perform a context
71 *  switch to the first task.
72 */
73#define RTEMS_BSP_SMP_FIRST_TASK                0x08
74
75#ifndef ASM
76/**
77 *  @brief Number of CPUs in SMP System
78 *
79 *  This variable is set during the SMP initialization sequence to
80 *  indicate the number of CPUs in this system.
81 */
82SCORE_EXTERN uint32_t _SMP_Processor_count;
83
84/**
85 *  @brief Maximum Number of CPUs in SMP System
86 *
87 *  This variable is set during the SMP initialization sequence to
88 *  indicate the Maximum number of CPUs in this system.
89 */
90extern uint32_t rtems_configuration_smp_maximum_processors;
91 
92/**
93 *  @brief Initialize Secondary CPUs
94 *
95 *  This method is invoked by RTEMS during initialization to bring the
96 *  secondary CPUs out of reset.
97 *
98 *  @param [in] maximum is the maximum number of CPU cores that RTEMS
99 *              can handle
100 *
101 *  @return This method returns the number of cores available in the
102 *          system.
103 */
104int bsp_smp_initialize(
105  int maximum
106);
107
108/**
109 *  @brief Obtain Current CPU Index
110 *
111 *  This method is invoked by RTEMS when it needs to know the index
112 *  of the CPU it is executing on.
113 *
114 *  @return This method returns the current CPU index.
115 */
116int bsp_smp_processor_id(void) RTEMS_COMPILER_PURE_ATTRIBUTE;
117
118/**
119 *  @brief Make Request of Another CPU
120 *
121 *  This method is invoked by RTEMS when it needs to make a request
122 *  of another CPU.  It should be implemented using some type of
123 *  interprocessor interrupt.
124 *
125 *  @param [in] cpu is the target CPU for this request.
126 *  @param [in] message is message to send
127 */
128void bsp_smp_send_message(
129  int       cpu,
130  uint32_t  message
131);
132
133/**
134 *  @brief Make Request of Others CPUs
135 *
136 *  This method is invoked by RTEMS when it needs to make a request
137 *  of the other CPUs.  It should be implemented using some type of
138 *  interprocessor interrupt. CPUs not including the originating
139 *  CPU should receive the message.
140 *
141 *  @param [in] message is message to send
142 */
143void bsp_smp_broadcast_message(
144  uint32_t  message
145);
146
147/**
148 *  @brief Generate a Interprocessor Broadcast Interrupt
149 *
150 *  This method is invoked when RTEMS wants to let all of the other
151 *  CPUs know that it has sent them message.  CPUs not including
152 *  the originating CPU should receive the interrupt.
153
154 *
155 *  @note On CPUs without the capability to generate a broadcast
156 *        to all other CPUs interrupt, this can be implemented by
157 *        a loop of sending interrupts to specific CPUs.
158 */
159void bsp_smp_broadcast_interrupt(void);
160
161/**
162 *  @brief Generate a Interprocessor Interrupt
163 *
164 *  This method is invoked by RTEMS to let @a cpu know that it
165 *  has sent it a message.
166 *
167 *  @param [in] cpu is the recipient CPU
168 */
169void bsp_smp_interrupt_cpu(
170  int cpu
171);
172
173/**
174 *  @brief Obtain CPU Core Number
175 *
176 *  This method is invoked by RTEMS when it needs to know which core
177 *  number it is executing on.  This is used when it needs to perform
178 *  some action or bookkeeping and needs to distinguish itself from
179 *  the other cores.  For example, it may need to realize it needs to
180 *  preempt a thread on another node.
181 *
182 *  @return This method returns the Id of the current CPU core.
183 */
184int   bsp_smp_processor_id( void );
185
186/**
187 *  This method is invoked by @ref rtems_smp_secondary_cpu_initialize
188 *  to allow the BSP to perform some intialization.  The @a cpu
189 *  parameter indicates the secondary CPU that the code is executing on
190 *  and is currently being initialized.
191 *
192 *  @note This is called by @ref rtems_smp_secondary_cpu_initialize.
193 */
194void bsp_smp_secondary_cpu_initialize(int cpu);
195
196/**
197 *  This method is the C entry point which secondary CPUs should
198 *  arrange to call.  It performs OS initialization for the secondary
199 *  CPU and coordinates bring it to a useful state.
200 *
201 *  @note This is provided by RTEMS.
202 */
203void rtems_smp_secondary_cpu_initialize(void);
204 
205/**
206 *  This method is invoked by the BSP to initialize the per CPU structure
207 *  for the specified @a cpu while it is bringing the secondary CPUs
208 *  out of their reset state and into a useful state.
209 *
210 *  @param [in] cpu indicates the CPU whose per cpu structure is to
211 *              be initialized.
212 */
213void rtems_smp_initialize_per_cpu(int cpu);
214
215/**
216 *  This is the method called by the BSP's interrupt handler
217 *  to process the incoming interprocessor request.
218 */
219void rtems_smp_process_interrupt(void);
220
221#endif
222
223#ifdef __cplusplus
224}
225#endif
226
227#else
228  #define bsp_smp_processor_id()  0
229#endif
230
231#endif
232
233/* end of include file */
Note: See TracBrowser for help on using the repository browser.