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 | #include "tmacros.h" |
---|
20 | |
---|
21 | #include <rtems.h> |
---|
22 | #include <rtems/score/smpimpl.h> |
---|
23 | |
---|
24 | #include <bsp.h> |
---|
25 | #include <bsp/bootcard.h> |
---|
26 | |
---|
27 | #include <assert.h> |
---|
28 | #include <stdlib.h> |
---|
29 | |
---|
30 | const char rtems_test_name[] = "SMPFATAL 8"; |
---|
31 | |
---|
32 | /* |
---|
33 | * This test is a hack since there is no easy way to test this fatal error path |
---|
34 | * without BSP support. |
---|
35 | */ |
---|
36 | |
---|
37 | void bsp_start_on_secondary_processor(struct Per_CPU_Control *cpu_self) |
---|
38 | { |
---|
39 | /* Provided to avoid multiple definitions of the CPU SMP support functions */ |
---|
40 | (void) cpu_self; |
---|
41 | /* Block secondary cpus if they are running to avoid clobbering output */ |
---|
42 | (void) _CPU_Thread_Idle_body( 0 ); |
---|
43 | } |
---|
44 | |
---|
45 | #if QORIQ_THREAD_COUNT > 1 |
---|
46 | void qoriq_start_thread(Per_CPU_Control *cpu_self) |
---|
47 | { |
---|
48 | /* Provided to avoid multiple definitions of the CPU SMP support functions */ |
---|
49 | (void) cpu_self; |
---|
50 | } |
---|
51 | #endif |
---|
52 | |
---|
53 | uint32_t _CPU_SMP_Initialize(void) |
---|
54 | { |
---|
55 | return 2; |
---|
56 | } |
---|
57 | |
---|
58 | bool _CPU_SMP_Start_processor(uint32_t cpu_index) |
---|
59 | { |
---|
60 | (void) cpu_index; |
---|
61 | |
---|
62 | return false; |
---|
63 | } |
---|
64 | |
---|
65 | void _CPU_SMP_Finalize_initialization(uint32_t cpu_count) |
---|
66 | { |
---|
67 | (void) cpu_count; |
---|
68 | |
---|
69 | assert(0); |
---|
70 | } |
---|
71 | |
---|
72 | void _CPU_SMP_Prepare_start_multitasking(void) |
---|
73 | { |
---|
74 | assert(0); |
---|
75 | } |
---|
76 | |
---|
77 | #if defined(RTEMS_PARAVIRT) \ |
---|
78 | || (!defined(__leon__) && !defined(__PPC__) \ |
---|
79 | && !defined(__arm__) && !defined(__riscv) && !defined(__aarch64__)) |
---|
80 | uint32_t _CPU_SMP_Get_current_processor(void) |
---|
81 | { |
---|
82 | return 0; |
---|
83 | } |
---|
84 | #endif |
---|
85 | |
---|
86 | void _CPU_SMP_Send_interrupt(uint32_t target_processor_index) |
---|
87 | { |
---|
88 | (void) target_processor_index; |
---|
89 | } |
---|
90 | |
---|
91 | static void Init(rtems_task_argument arg) |
---|
92 | { |
---|
93 | assert(0); |
---|
94 | } |
---|
95 | |
---|
96 | static void fatal_extension( |
---|
97 | rtems_fatal_source source, |
---|
98 | bool always_set_to_false, |
---|
99 | rtems_fatal_code code |
---|
100 | ) |
---|
101 | { |
---|
102 | TEST_BEGIN(); |
---|
103 | |
---|
104 | if ( |
---|
105 | source == RTEMS_FATAL_SOURCE_SMP |
---|
106 | && !always_set_to_false |
---|
107 | && code == SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED |
---|
108 | ) { |
---|
109 | TEST_END(); |
---|
110 | } |
---|
111 | } |
---|
112 | |
---|
113 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
114 | #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER |
---|
115 | |
---|
116 | #define CONFIGURE_INITIAL_EXTENSIONS \ |
---|
117 | { .fatal = fatal_extension }, \ |
---|
118 | RTEMS_TEST_INITIAL_EXTENSION |
---|
119 | |
---|
120 | #define CONFIGURE_MAXIMUM_PROCESSORS 2 |
---|
121 | |
---|
122 | #define CONFIGURE_SCHEDULER_SIMPLE_SMP |
---|
123 | |
---|
124 | #include <rtems/scheduler.h> |
---|
125 | |
---|
126 | RTEMS_SCHEDULER_SIMPLE_SMP(a); |
---|
127 | |
---|
128 | #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ |
---|
129 | RTEMS_SCHEDULER_TABLE_SIMPLE_SMP(a, rtems_build_name('S', 'I', 'M', 'P')) |
---|
130 | |
---|
131 | #define CONFIGURE_SCHEDULER_ASSIGNMENTS \ |
---|
132 | RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \ |
---|
133 | RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY) |
---|
134 | |
---|
135 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
136 | |
---|
137 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
138 | |
---|
139 | #define CONFIGURE_INIT |
---|
140 | |
---|
141 | #include <rtems/confdefs.h> |
---|