diff options
-rw-r--r-- | cpukit/include/rtems/confdefs.h | 16 | ||||
-rw-r--r-- | cpukit/include/rtems/record.h | 19 | ||||
-rw-r--r-- | cpukit/include/rtems/sysinit.h | 10 | ||||
-rw-r--r-- | cpukit/libtrace/record/record-server.c | 2 | ||||
-rw-r--r-- | cpukit/libtrace/record/record-sysinit.c | 14 | ||||
-rw-r--r-- | testsuites/libtests/record01/init.c | 4 |
6 files changed, 35 insertions, 30 deletions
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h index 45a75f0c6f..085df2444c 100644 --- a/cpukit/include/rtems/confdefs.h +++ b/cpukit/include/rtems/confdefs.h @@ -2942,14 +2942,18 @@ struct _reent *__getreent(void) #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be at least 16" #endif - const unsigned int _Record_Item_count = CONFIGURE_RECORD_PER_PROCESSOR_ITEMS; - - struct Record_Configured_control { - Record_Control Control; + typedef struct { + RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) Record_Control Control; rtems_record_item Items[ CONFIGURE_RECORD_PER_PROCESSOR_ITEMS ]; - }; + } Record_Configured_control; - PER_CPU_DATA_ITEM( Record_Configured_control, _Record_Per_CPU ); + static Record_Configured_control _Record_Controls[ _CONFIGURE_MAXIMUM_PROCESSORS ]; + + const Record_Configuration _Record_Configuration = { + CONFIGURE_RECORD_PER_PROCESSOR_ITEMS, + sizeof( Record_Configured_control ), + &_Record_Controls[ 0 ].Control + }; RTEMS_SYSINIT_ITEM( _Record_Initialize, diff --git a/cpukit/include/rtems/record.h b/cpukit/include/rtems/record.h index cfadae79d6..1f83b2995d 100644 --- a/cpukit/include/rtems/record.h +++ b/cpukit/include/rtems/record.h @@ -32,7 +32,7 @@ #include <rtems/score/atomic.h> #include <rtems/score/cpu.h> -#include <rtems/score/percpudata.h> +#include <rtems/score/percpu.h> #include <rtems/score/watchdog.h> #include <rtems/rtems/intr.h> #include <rtems/rtems/tasks.h> @@ -42,19 +42,20 @@ extern "C" { #endif /* __cplusplus */ -struct Record_Control { +typedef struct Record_Control { Atomic_Uint head; unsigned int tail; unsigned int mask; Watchdog_Control Watchdog; rtems_record_item Header[ 3 ]; rtems_record_item Items[ RTEMS_ZERO_LENGTH_ARRAY ]; -}; +} Record_Control; -typedef struct Record_Control Record_Control; - -typedef RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) - struct Record_Configured_control Record_Configured_control; +typedef struct { + unsigned int item_count; + size_t control_size; + Record_Control *controls; +} Record_Configuration; typedef struct { Record_Control *control; @@ -63,9 +64,7 @@ typedef struct { rtems_interrupt_level level; } rtems_record_context; -PER_CPU_DATA_ITEM_DECLARE( Record_Configured_control, _Record_Per_CPU ); - -extern const unsigned int _Record_Item_count; +extern const Record_Configuration _Record_Configuration; void _Record_Initialize( void ); diff --git a/cpukit/include/rtems/sysinit.h b/cpukit/include/rtems/sysinit.h index 60fd9ddf41..4e6010b927 100644 --- a/cpukit/include/rtems/sysinit.h +++ b/cpukit/include/rtems/sysinit.h @@ -29,11 +29,11 @@ extern "C" { #define RTEMS_SYSINIT_BSP_WORK_AREAS 000100 #define RTEMS_SYSINIT_BSP_START 000200 #define RTEMS_SYSINIT_CPU_COUNTER 000300 -#define RTEMS_SYSINIT_INITIAL_EXTENSIONS 000400 -#define RTEMS_SYSINIT_MP_EARLY 000500 -#define RTEMS_SYSINIT_DATA_STRUCTURES 000600 -#define RTEMS_SYSINIT_MP 000700 -#define RTEMS_SYSINIT_RECORD 000800 +#define RTEMS_SYSINIT_RECORD 000400 +#define RTEMS_SYSINIT_INITIAL_EXTENSIONS 000500 +#define RTEMS_SYSINIT_MP_EARLY 000600 +#define RTEMS_SYSINIT_DATA_STRUCTURES 000700 +#define RTEMS_SYSINIT_MP 000800 #define RTEMS_SYSINIT_USER_EXTENSIONS 000900 #define RTEMS_SYSINIT_CLASSIC_TASKS 000a00 #define RTEMS_SYSINIT_CLASSIC_TIMER 000b00 diff --git a/cpukit/libtrace/record/record-server.c b/cpukit/libtrace/record/record-server.c index 991aef2fb4..d1f299dbdb 100644 --- a/cpukit/libtrace/record/record-server.c +++ b/cpukit/libtrace/record/record-server.c @@ -151,7 +151,7 @@ void _Record_Stream_header_initialize( Record_Stream_header *header ) header->Processor_maximum.data = rtems_scheduler_get_processor_maximum() - 1; header->Count.event = RTEMS_RECORD_TIME_EVENT( 0, RTEMS_RECORD_PER_CPU_COUNT ); - header->Count.data = _Record_Item_count; + header->Count.data = _Record_Configuration.item_count; header->Frequency.event = RTEMS_RECORD_TIME_EVENT( 0, RTEMS_RECORD_FREQUENCY ); diff --git a/cpukit/libtrace/record/record-sysinit.c b/cpukit/libtrace/record/record-sysinit.c index 59bd97346f..afb887cd2f 100644 --- a/cpukit/libtrace/record/record-sysinit.c +++ b/cpukit/libtrace/record/record-sysinit.c @@ -39,21 +39,21 @@ static Watchdog_Interval _Record_Tick_interval; void _Record_Initialize( void ) { - uint32_t cpu_max; - uint32_t cpu_index; - uintptr_t offset; + Record_Control *control; + uint32_t cpu_max; + uint32_t cpu_index; + control = _Record_Configuration.controls; cpu_max = rtems_configuration_get_maximum_processors(); - offset = PER_CPU_DATA_OFFSET( _Record_Per_CPU ); for ( cpu_index = 0; cpu_index < cpu_max; ++cpu_index ) { Per_CPU_Control *cpu; - Record_Control *control; cpu = _Per_CPU_Get_by_index( cpu_index ); - control = PER_CPU_DATA_GET_BY_OFFSET( cpu, Record_Control, offset ); - control->mask = _Record_Item_count - 1U; + control->mask = _Record_Configuration.item_count - 1U; cpu->record = control; + control = (Record_Control *) + ( (char *) control + _Record_Configuration.control_size ); } } diff --git a/testsuites/libtests/record01/init.c b/testsuites/libtests/record01/init.c index 86255437f3..cb4cf451c9 100644 --- a/testsuites/libtests/record01/init.c +++ b/testsuites/libtests/record01/init.c @@ -59,7 +59,9 @@ typedef struct { static test_context test_instance; -const unsigned int _Record_Item_count = ITEM_COUNT; +const Record_Configuration _Record_Configuration = { + .item_count = ITEM_COUNT +}; #define UE(user) RTEMS_RECORD_USER(user) |