Changeset cfc4231d in rtems
- Timestamp:
- 08/27/18 08:36:35 (6 years ago)
- Branches:
- 5, master
- Children:
- d8bc0730
- Parents:
- 77d374f5
- git-author:
- Sebastian Huber <sebastian.huber@…> (08/27/18 08:36:35)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (09/10/18 08:38:45)
- Files:
-
- 6 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/headers.am
r77d374f5 rcfc4231d 376 376 include_rtems_score_HEADERS += include/rtems/score/onceimpl.h 377 377 include_rtems_score_HEADERS += include/rtems/score/percpu.h 378 include_rtems_score_HEADERS += include/rtems/score/percpudata.h 378 379 include_rtems_score_HEADERS += include/rtems/score/priority.h 379 380 include_rtems_score_HEADERS += include/rtems/score/prioritybitmap.h -
cpukit/include/rtems/score/percpu.h
r77d374f5 rcfc4231d 10 10 * On-Line Applications Research Corporation (OAR). 11 11 * 12 * Copyright (c) 2012, 201 6embedded brains GmbH12 * Copyright (c) 2012, 2018 embedded brains GmbH 13 13 * 14 14 * The license and distribution terms for this file may be … … 478 478 479 479 /** 480 * @brief Begin of the per-CPU data area. 481 * 482 * Contains items defined via PER_CPU_DATA_ITEM(). 483 */ 484 char *data; 485 486 /** 480 487 * @brief Indicates the current state of the CPU. 481 488 * -
cpukit/score/src/wkspace.c
r77d374f5 rcfc4231d 20 20 21 21 #include <rtems/score/wkspace.h> 22 #include <rtems/score/assert.h> 22 23 #include <rtems/score/heapimpl.h> 23 24 #include <rtems/score/interr.h> 25 #include <rtems/score/percpudata.h> 24 26 #include <rtems/score/threadimpl.h> 25 27 #include <rtems/score/tls.h> 26 28 #include <rtems/config.h> 27 29 28 #include <string.h> /* for memset */30 #include <string.h> 29 31 30 32 /* #define DEBUG_WORKSPACE */ … … 33 35 #endif 34 36 37 RTEMS_LINKER_RWSET( 38 _Per_CPU_Data, 39 RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) char 40 ); 41 35 42 Heap_Control _Workspace_Area; 36 43 37 static uint32_t _Get_maximum_thread_count(void) 38 { 39 uint32_t thread_count = 0; 40 44 static uint32_t _Workspace_Get_maximum_thread_count( void ) 45 { 46 uint32_t thread_count; 47 48 thread_count = 0; 41 49 thread_count += _Thread_Get_maximum_internal_threads(); 42 50 … … 54 62 } 55 63 56 void _Workspace_Handler_initialization( 57 Heap_Area *areas, 58 size_t area_count, 59 Heap_Initialization_or_extend_handler extend 60 ) 61 { 62 Heap_Initialization_or_extend_handler init_or_extend = _Heap_Initialize; 63 uintptr_t remaining = rtems_configuration_get_work_space_size(); 64 bool do_zero = rtems_configuration_get_do_zero_of_workspace(); 65 bool unified = rtems_configuration_get_unified_work_area(); 66 uintptr_t page_size = CPU_HEAP_ALIGNMENT; 67 uintptr_t overhead = _Heap_Area_overhead( page_size ); 68 uintptr_t tls_size = _TLS_Get_size(); 69 size_t i; 64 static uintptr_t _Workspace_Space_for_TLS( uintptr_t page_size ) 65 { 66 uintptr_t tls_size; 67 uintptr_t space; 68 69 tls_size = _TLS_Get_size(); 70 70 71 71 /* … … 86 86 * size. 87 87 */ 88 remaining += _Heap_Min_block_size( page_size );89 90 remaining +=_Get_maximum_thread_count()88 space = _Heap_Min_block_size( page_size ); 89 90 space += _Workspace_Get_maximum_thread_count() 91 91 * _Heap_Size_with_overhead( page_size, tls_alloc, tls_align ); 92 } 93 94 for (i = 0; i < area_count; ++i) { 95 Heap_Area *area = &areas [i]; 92 } else { 93 space = 0; 94 } 95 96 return space; 97 } 98 99 static uintptr_t _Workspace_Space_for_per_CPU_data( uintptr_t page_size ) 100 { 101 uintptr_t space; 102 103 #ifdef RTEMS_SMP 104 uintptr_t size; 105 106 size = RTEMS_LINKER_SET_SIZE( _Per_CPU_Data ); 107 _Assert( size % CPU_CACHE_LINE_BYTES == 0 ); 108 109 if ( size > 0 ) { 110 /* 111 * Memory allocated with an alignment constraint is allocated from the end of 112 * a free block. The last allocation may need one free block of minimum 113 * size. 114 */ 115 space = _Heap_Min_block_size( page_size ); 116 117 space += ( rtems_configuration_get_maximum_processors() - 1 ) 118 * _Heap_Size_with_overhead( page_size, size, CPU_CACHE_LINE_BYTES ); 119 } else { 120 space = 0; 121 } 122 #else 123 space = 0; 124 #endif 125 126 return space; 127 } 128 129 static void _Workspace_Allocate_per_CPU_data( void ) 130 { 131 #ifdef RTEMS_SMP 132 Per_CPU_Control *cpu; 133 uintptr_t size; 134 uint32_t cpu_index; 135 uint32_t cpu_max; 136 137 cpu = _Per_CPU_Get_by_index( 0 ); 138 cpu->data = RTEMS_LINKER_SET_BEGIN( _Per_CPU_Data ); 139 140 size = RTEMS_LINKER_SET_SIZE( _Per_CPU_Data ); 141 cpu_max = rtems_configuration_get_maximum_processors(); 142 143 for ( cpu_index = 1 ; cpu_index < cpu_max ; ++cpu_index ) { 144 cpu = _Per_CPU_Get_by_index( cpu_index ); 145 cpu->data = _Workspace_Allocate_aligned( size, CPU_CACHE_LINE_BYTES ); 146 _Assert( cpu->data != NULL ); 147 memcpy( cpu->data, RTEMS_LINKER_SET_BEGIN( _Per_CPU_Data ), size); 148 } 149 #endif 150 } 151 152 void _Workspace_Handler_initialization( 153 Heap_Area *areas, 154 size_t area_count, 155 Heap_Initialization_or_extend_handler extend 156 ) 157 { 158 Heap_Initialization_or_extend_handler init_or_extend; 159 uintptr_t remaining; 160 bool do_zero; 161 bool unified; 162 uintptr_t page_size; 163 uintptr_t overhead; 164 size_t i; 165 166 page_size = CPU_HEAP_ALIGNMENT; 167 168 remaining = rtems_configuration_get_work_space_size(); 169 remaining += _Workspace_Space_for_TLS( page_size ); 170 remaining += _Workspace_Space_for_per_CPU_data( page_size ); 171 172 init_or_extend = _Heap_Initialize; 173 do_zero = rtems_configuration_get_do_zero_of_workspace(); 174 unified = rtems_configuration_get_unified_work_area(); 175 overhead = _Heap_Area_overhead( page_size ); 176 177 for ( i = 0; i < area_count; ++i ) { 178 Heap_Area *area; 179 180 area = &areas[ i ]; 96 181 97 182 if ( do_zero ) { … … 114 199 } 115 200 116 space_available = ( *init_or_extend)(201 space_available = ( *init_or_extend )( 117 202 &_Workspace_Area, 118 203 area->begin, … … 139 224 140 225 _Heap_Protection_set_delayed_free_fraction( &_Workspace_Area, 1 ); 226 _Workspace_Allocate_per_CPU_data(); 141 227 } 142 228 -
testsuites/sptests/Makefile.am
r77d374f5 rcfc4231d 1595 1595 endif 1596 1596 1597 if TEST_sppercpudata01 1598 sp_tests += sppercpudata01 1599 sp_screens += sppercpudata01/sppercpudata01.scn 1600 sp_docs += sppercpudata01/sppercpudata01.doc 1601 sppercpudata01_SOURCES = sppercpudata01/init.c sppercpudata01/item.c 1602 sppercpudata01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_sppercpudata01) \ 1603 $(support_includes) 1604 endif 1605 1597 1606 if TEST_spport_err01 1598 1607 sp_tests += spport_err01 -
testsuites/sptests/configure.ac
r77d374f5 rcfc4231d 206 206 RTEMS_TEST_CHECK([sppagesize]) 207 207 RTEMS_TEST_CHECK([sppartition_err01]) 208 RTEMS_TEST_CHECK([sppercpudata01]) 208 209 RTEMS_TEST_CHECK([spport_err01]) 209 210 RTEMS_TEST_CHECK([spprintk])
Note: See TracChangeset
for help on using the changeset viewer.