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