source: rtems/cpukit/score/include/rtems/score/smp.h @ 2f6108f9

4.115
Last change on this file since 2f6108f9 was 2f6108f9, checked in by Sebastian Huber <sebastian.huber@…>, on 05/28/13 at 08:58:19

smp: Simplify SMP initialization sequence

Delete bsp_smp_wait_for(). Other parts of the system work without
timeout, e.g. the spinlocks. Using a timeout here does not make the
system more robust.

Delete bsp_smp_cpu_state and replace it with Per_CPU_State. The
Per_CPU_State follows the Score naming conventions. Add
_Per_CPU_Change_state() and _Per_CPU_Wait_for_state() functions to
change and observe states.

Use Per_CPU_State in Per_CPU_Control instead of the anonymous integer.

Add _CPU_Processor_event_broadcast() and _CPU_Processor_event_receive()
functions provided by the CPU port. Use these functions in
_Per_CPU_Change_state() and _Per_CPU_Wait_for_state().

Add prototype for _SMP_Send_message().

Delete RTEMS_BSP_SMP_FIRST_TASK message. The first context switch is
now performed in rtems_smp_secondary_cpu_initialize(). Issuing the
first context switch in the context of the inter-processor interrupt is
not possible on systems with a modern interrupt controller. Such an
interrupt controler usually requires a handshake protocol with interrupt
acknowledge and end of interrupt signals. A direct context switch in an
interrupt handler circumvents the interrupt processing epilogue and may
leave the system in an inconsistent state.

Release lock in rtems_smp_process_interrupt() even if no message was
delivered. This prevents deadlock of the system.

Simplify and format _SMP_Send_message(),
_SMP_Request_other_cores_to_perform_first_context_switch(),
_SMP_Request_other_cores_to_dispatch() and
_SMP_Request_other_cores_to_shutdown().

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/**
2 *  @file  rtems/score/smp.h
3 *
4 *  @brief Interface to the SuperCore SMP Support used Internally to RTEMS
5 *
6 *  This include file defines the interface to the SuperCore
7 *  SMP support that is used internally to RTEMS.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2011.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 */
18
19#ifndef _RTEMS_SCORE_SMP_H
20#define _RTEMS_SCORE_SMP_H
21
22#if defined (RTEMS_SMP)
23#include <rtems/score/percpu.h>
24
25/**
26 *  @defgroup SuperCoreSMP SMP Support
27 *
28 *  @ingroup Score
29 *
30 *  This defines the interface of the SuperCore support
31 *  code for SMP support.
32 */
33
34/**@{*/
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/**
41 *  This defines the bit which indicates the interprocessor interrupt
42 *  has been requested so that RTEMS will reschedule on this CPU
43 *  because the currently executing thread needs to be switched out.
44 */
45#define RTEMS_BSP_SMP_CONTEXT_SWITCH_NECESSARY  0x01
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 has been sent a signal.
51 */
52#define RTEMS_BSP_SMP_SIGNAL_TO_SELF            0x02
53
54/**
55 *  This defines the bit which indicates the interprocessor interrupt
56 *  has been requested so that this CPU will be shutdown.  This is done
57 *  as part of rtems_executive_shutdown().
58 */
59#define RTEMS_BSP_SMP_SHUTDOWN                  0x04
60
61#ifndef ASM
62/**
63 *  @brief Number of CPUs in a SMP system.
64 *
65 *  This variable is set during the SMP initialization sequence to
66 *  indicate the number of CPUs in this system.
67 */
68SCORE_EXTERN uint32_t _SMP_Processor_count;
69
70/**
71 *  @brief Sends a SMP message to a processor.
72 *
73 *  The target processor may be the sending processor.
74 *
75 *  @param[in] cpu The target processor of the message.
76 *  @param[in] message The message.
77 */
78void _SMP_Send_message( int cpu, uint32_t message );
79
80/**
81 *  @brief Request of others CPUs.
82 *
83 *  This method is invoked by RTEMS when it needs to make a request
84 *  of the other CPUs.  It should be implemented using some type of
85 *  interprocessor interrupt. CPUs not including the originating
86 *  CPU should receive the message.
87 *
88 *  @param [in] message is message to send
89 */
90void _SMP_Broadcast_message(
91  uint32_t  message
92);
93
94/**
95 *  @brief Request other cores to perform first context switch.
96 *
97 *  Send message to other cores requesting them to perform
98 *  their first context switch operation.
99 */
100void _SMP_Request_other_cores_to_perform_first_context_switch(void);
101
102/**
103 *  @brief Request dispatch on other cores.
104 *
105 *  Send message to other cores requesting them to perform
106 *  a thread dispatch operation.
107 */
108void _SMP_Request_other_cores_to_dispatch(void);
109
110/**
111 *  @brief Request other cores to shutdown.
112 *
113 *  Send message to other cores requesting them to shutdown.
114 */
115void _SMP_Request_other_cores_to_shutdown(void);
116
117#endif
118
119#ifdef __cplusplus
120}
121#endif
122
123#endif
124
125/**@}*/
126#endif
127/* end of include file */
Note: See TracBrowser for help on using the repository browser.