1 | /* |
---|
2 | * Copyright (c) 2014 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Dornierstr. 4 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <rtems@embedded-brains.de> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.org/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #ifdef HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #define TESTS_USE_PRINTK |
---|
20 | #include "tmacros.h" |
---|
21 | |
---|
22 | #include <rtems.h> |
---|
23 | #include <rtems/score/smpimpl.h> |
---|
24 | |
---|
25 | #include <bsp.h> |
---|
26 | #include <bsp/bootcard.h> |
---|
27 | |
---|
28 | #include <assert.h> |
---|
29 | #include <stdlib.h> |
---|
30 | |
---|
31 | const char rtems_test_name[] = "SMPFATAL 8"; |
---|
32 | |
---|
33 | /* |
---|
34 | * This test is a hack since there is no easy way to test this fatal error path |
---|
35 | * without BSP support. |
---|
36 | */ |
---|
37 | |
---|
38 | void bsp_start_on_secondary_processor(void) |
---|
39 | { |
---|
40 | /* Provided to avoid multiple definitions of the CPU SMP support functions */ |
---|
41 | } |
---|
42 | |
---|
43 | #if QORIQ_THREAD_COUNT > 1 |
---|
44 | void qoriq_start_thread(void) |
---|
45 | { |
---|
46 | /* Provided to avoid multiple definitions of the CPU SMP support functions */ |
---|
47 | } |
---|
48 | #endif |
---|
49 | |
---|
50 | uint32_t _CPU_SMP_Initialize(void) |
---|
51 | { |
---|
52 | return 2; |
---|
53 | } |
---|
54 | |
---|
55 | bool _CPU_SMP_Start_processor(uint32_t cpu_index) |
---|
56 | { |
---|
57 | (void) cpu_index; |
---|
58 | |
---|
59 | return false; |
---|
60 | } |
---|
61 | |
---|
62 | void _CPU_SMP_Finalize_initialization(uint32_t cpu_count) |
---|
63 | { |
---|
64 | (void) cpu_count; |
---|
65 | |
---|
66 | assert(0); |
---|
67 | } |
---|
68 | |
---|
69 | void _CPU_SMP_Prepare_start_multitasking(void) |
---|
70 | { |
---|
71 | assert(0); |
---|
72 | } |
---|
73 | |
---|
74 | #if defined(RTEMS_PARAVIRT) \ |
---|
75 | || (!defined(__leon__) && !defined(__PPC__) && !defined(__arm__)) |
---|
76 | uint32_t _CPU_SMP_Get_current_processor(void) |
---|
77 | { |
---|
78 | return 0; |
---|
79 | } |
---|
80 | #endif |
---|
81 | |
---|
82 | void _CPU_SMP_Send_interrupt(uint32_t target_processor_index) |
---|
83 | { |
---|
84 | (void) target_processor_index; |
---|
85 | } |
---|
86 | |
---|
87 | static void Init(rtems_task_argument arg) |
---|
88 | { |
---|
89 | assert(0); |
---|
90 | } |
---|
91 | |
---|
92 | static void fatal_extension( |
---|
93 | rtems_fatal_source source, |
---|
94 | bool always_set_to_false, |
---|
95 | rtems_fatal_code code |
---|
96 | ) |
---|
97 | { |
---|
98 | TEST_BEGIN(); |
---|
99 | |
---|
100 | if ( |
---|
101 | source == RTEMS_FATAL_SOURCE_SMP |
---|
102 | && !always_set_to_false |
---|
103 | && code == SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED |
---|
104 | ) { |
---|
105 | TEST_END(); |
---|
106 | } |
---|
107 | } |
---|
108 | |
---|
109 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
110 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
111 | |
---|
112 | #define CONFIGURE_INITIAL_EXTENSIONS \ |
---|
113 | { .fatal = fatal_extension }, \ |
---|
114 | RTEMS_TEST_INITIAL_EXTENSION |
---|
115 | |
---|
116 | #define CONFIGURE_SMP_MAXIMUM_PROCESSORS 2 |
---|
117 | |
---|
118 | #define CONFIGURE_SCHEDULER_SIMPLE_SMP |
---|
119 | |
---|
120 | #include <rtems/scheduler.h> |
---|
121 | |
---|
122 | RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(a); |
---|
123 | |
---|
124 | #define CONFIGURE_SCHEDULER_CONTROLS \ |
---|
125 | RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(a, rtems_build_name('S', 'I', 'M', 'P')) |
---|
126 | |
---|
127 | #define CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS \ |
---|
128 | RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \ |
---|
129 | RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY) |
---|
130 | |
---|
131 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
132 | |
---|
133 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
134 | |
---|
135 | #define CONFIGURE_INIT |
---|
136 | |
---|
137 | #include <rtems/confdefs.h> |
---|