Commit Graph

12267 Commits

Author SHA1 Message Date
Ralf Kirchner
17864a4ae9 bsp/arm: Avoid warning 2014-03-13 16:10:52 +01:00
Sebastian Huber
dedc1393f3 bsps/powerpc: Fix GET_INTERRUPT_MASK macro
Use _PPC_INTERRUPT_DISABLE_MASK introduced with
801b5d8032.
2014-03-12 16:40:49 +01:00
Sebastian Huber
d50acdbb6c score: Add local context to SMP lock API
Add a local context structure to the SMP lock API for acquire and
release pairs.  This context can be used to store the ISR level and
profiling information.  It may be later used to enable more
sophisticated lock algorithms, e.g. MCS locks.

There is only one lock that cannot be used with a local context.  This
is the per-CPU lock since here we would have to transfer the local
context through a context switch which is very complicated.
2014-03-11 10:58:09 +01:00
Sebastian Huber
ae88aa7927 sapi: Use one SMP lock for all chains
This partially reverts commit 1215fd4d94.

In order to support profiling of SMP locks and provide a future
compatible SMP locks API it is necessary to add an SMP lock destroy
function.  Since the commit above adds an SMP lock to each chain control
we would have to add a rtems_chain_destroy() function as well.  This
complicates the chain usage dramatically.  Thus revert the patch above.
A global SMP lock for all chains is used to implement the protected
chain operations.

Advantages:

* The SAPI chain API is now identical on SMP and non-SMP
  configurations.

* The size of the chain control is reduced and is then equal to the
  Score chains.

* The protected chain operations work correctly on SMP.

Disadvantage:

* Applications using many different chains and the protected operations
  may notice lock contention.

The chain control size drop is a huge benefit (SAPI chain controls are
66% larger than the Score chain controls).  The only disadvantage is not
really a problem since these applications can use specific interrupt
locks and unprotected chain operations to avoid this issue.
2014-03-11 10:58:09 +01:00
Sebastian Huber
6b115b3008 bsp/leon3: Use interrupt timestamping counter
Use the interrupt controller timestamping counter for the CPU counter if
available since it runs with a high frequency.
2014-03-10 08:03:46 +01:00
Sebastian Huber
ba15b92370 bsps/sparc: Add missing IRQMP registers 2014-03-10 08:03:46 +01:00
Sebastian Huber
f4accfd466 bsps/sparc: Remove fix for ERC32 with FPU rev. B/C 2014-03-10 08:03:45 +01:00
Sebastian Huber
718124e4e5 rtems: Add RTEMS_INTERRUPT_REPLACE
A new option RTEMS_INTERRUPT_REPLACE is introduced that permits updating
the first interrupt handler for the registered interrupt vector and
matching argument.  If no match is found, the install function fails
with RTEMS_UNSATISFIED.

The Interrupt Manager Extension offers interrupt handlers with an
argument pointer.  It is impossible to update two words (handler and
argument) atomically on most architectures.  In order to avoid an SMP
lock in bsp_interrupt_handler_dispatch() which would degrade the
interrupt response time an alternative must be provided that makes it
possible to tear-down interrupt sources without an SMP lock.

Add RTEMS_INTERRUPT_REPLACE option to Interrupt Manager Extension.  This
enables a clean tear-down of interrupt sources on SMP configurations.
Instead of an interrupt handler removal a replacement handler can be
installed to silence an interrupt source.  This can be used in contexts
that allow no sophisticated synchronization (e.g. in atexit() or fatal
handlers).
2014-03-06 09:43:59 +01:00
Sebastian Huber
e0609ac745 bsps: SMP support for generic interrupt support 2014-03-06 09:43:58 +01:00
Daniel Hellstrom
7fe0561526 bsp/leon3: Unmask IPI only on secondary processor 2014-03-06 09:43:57 +01:00
Sebastian Huber
9ec4a48dde bsp/leon3: Add L2 cache support 2014-02-28 09:06:19 +01:00
Sebastian Huber
c5b1e208c5 bsp/leon3: Add L2C registers 2014-02-28 09:06:19 +01:00
Sebastian Huber
64f4ac28a6 bsp/leon3: Add new cache manager implementation
The previous implementation used an instruction cache line size of 0,
this is a bogus value.  Use a instruction cache line size of 64 since
the L2 cache may have a line size of 32 or 64.  A greater value should
cause no harm.

Use a FLUSH operation for _CPU_cache_invalidate_instruction_range().

This is a preperation step to support the L2 cache.
2014-02-28 09:06:19 +01:00
Sebastian Huber
80186ca8f4 bsp/leon3: Add and use cache register functions 2014-02-28 09:06:19 +01:00
Sebastian Huber
e1d7bf002e rtems: Add cache size functions
Add rtems_cache_get_data_cache_size() and
rtems_cache_get_instruction_cache_size().
2014-02-28 09:06:16 +01:00
Sebastian Huber
e7549ff4a1 rtems: Use size_t for cache line size
A cache line cannot have a negative size.
2014-02-28 08:59:02 +01:00
Sebastian Huber
0a2096b7e3 bsp/leon3: Use ambapp_freq_get() for CPU counter 2014-02-28 08:59:01 +01:00
Sebastian Huber
dce7bba732 bsps: Delete LEON3_FATAL_CPU_COUNTER_INIT 2014-02-28 08:59:01 +01:00
Sebastian Huber
6faf789314 bsps: Fix empty interrupt handler entry
The vector number of spurious interrupts was wrong after the interrupt
handler removal on SMP configurations.
2014-02-28 08:59:01 +01:00
Sebastian Huber
a4bc90af4e sparc: Fix CPU counter support
The SPARC processors supported by RTEMS have no built-in CPU counter
support.  We have to use some hardware counter module for this purpose.
The BSP must provide a 32-bit register which contains the current CPU
counter value and a function for the difference calculation.  It can use
for example the GPTIMER instance used for the clock driver.
2014-02-24 16:12:02 +01:00
Sebastian Huber
0b9fd991a7 bsps: Add empty cache manager
This is necessary to add tests that use the cache manager.  For example
to get better estimates of worst-case timings.
2014-02-24 12:49:45 +01:00
Sebastian Huber
0fe0718b72 bsps/powerpc: Use System V small-data area
The 32-bit ABIs for thread-local storage (TLS) and EABI read-only
small-data area have a conflicting register (r2) usage.  Use the System
V small-data instead (here r2 is system reserved).
2014-02-24 12:49:42 +01:00
Sebastian Huber
07713db65b bsp/leon3: Add bsp_reset() for SMP configuration 2014-02-21 09:38:56 +01:00
Sebastian Huber
7ec8d95a1e bsp/leon3: Add and use leon3_get_cpu_count() 2014-02-21 09:38:56 +01:00
Sebastian Huber
4fe6759e2a bsp/leon3: Add leon3_power_down_loop() 2014-02-21 09:38:56 +01:00
Sebastian Huber
c8c877f8cb bsps/sparc: Delete unused file 2014-02-21 09:38:56 +01:00
Sebastian Huber
1be15db1ff bsp/score603e: Remove unused BSP_fatal_return() 2014-02-21 09:38:55 +01:00
Sebastian Huber
2cb0877f3a bsp/leon3: Add and use LEON3_IrqCtrl_Lock
Disabling of interrupts is not enough to ensure mutual exclusion on SMP
configurations.
2014-02-19 10:25:47 +01:00
Sebastian Huber
a171e0a867 bsp/leon3: Declare LEON3_IrqCtrl_EIrq only once 2014-02-19 09:59:41 +01:00
Sebastian Huber
f71f3d3196 bsp/leon3: Declare leon3_ext_irq_init() in header 2014-02-19 09:59:41 +01:00
Sebastian Huber
4d9bd56d29 score: Rename rtems_smp_process_interrupt()
Rename rtems_smp_process_interrupt() into
_SMP_Inter_processor_interrupt_handler().  Delete unused header file
<rtems/bspsmp.h>.
2014-02-19 09:59:41 +01:00
Sebastian Huber
911b1d228b score: Rename rtems_smp_secondary_cpu_initialize()
Rename rtems_smp_secondary_cpu_initialize() into
_SMP_Start_multitasking_on_secondary_processor().  Move declaration to
<rtems/score/smpimpl.h>.
2014-02-19 09:59:41 +01:00
Sebastian Huber
f8ff2a011c score: Delete bsp_smp_broadcast_interrupt()
Since the per-CPU SMP lock must be acquired and released to send the
message a single interrupt broadcast operations offers no benefits.  If
synchronization is required, then a SMP barrier must be used anyway.
2014-02-19 09:59:41 +01:00
Sebastian Huber
4627fcdab1 score: Rename bsp_smp_initialize()
Rename bsp_smp_initialize() into _CPU_SMP_Initialize() since every CPU
port must supply this function.
2014-02-19 09:59:40 +01:00
Sebastian Huber
46d7fa5cd3 bsp/leon3: Add and use fatal codes 2014-02-19 09:59:40 +01:00
Sebastian Huber
33cb8bf64d score: Add RTEMS_FATAL_SOURCE_BSP
Merge RTEMS_FATAL_SOURCE_BSP_GENERIC and RTEMS_FATAL_SOURCE_BSP_SPECIFIC
into new fatal source RTEMS_FATAL_SOURCE_BSP.  This makes it easier to
figure out the code position given a fatal source and code.
2014-02-19 09:59:39 +01:00
Sebastian Huber
801b5d8032 powerpc: Change interrupt disable implemetation
Instead of SPRG0 (= special purpose register 272) use the new global
symbol _PPC_INTERRUPT_DISABLE_MASK to store the interrupt disable mask.
The benefit is that it is now possible to disable interrupts without
further run-time initialization in boot_card().

At least on Freescale e500 cores this leads also to a faster execution
since the mfmsr and mfspr instruction require four cycles to complete.
The instructions to load the mask value can execute while the mfmsr is
in progress.
2014-02-19 09:59:38 +01:00
Sebastian Huber
88ef740ea8 bsp/leon3: Declare amba_initialize() 2014-02-14 10:28:31 +01:00
Sebastian Huber
e644155afa bsp/leon3: Do not define RTEMS_DEBUG
Move vital code out of debug section.  Harmonize variable names with
other implementations.
2014-02-14 10:28:30 +01:00
Sebastian Huber
ad563618ca sparc: Add LEON3_ASR17_PROCESSOR_INDEX_SHIFT
Add _LEON3_Get_current_processor().
2014-02-14 10:28:30 +01:00
Sebastian Huber
24bf11eca1 score: Add CPU counter support
Add a CPU counter interface to allow access to a free-running counter.
It is useful to measure short time intervals.  This can be used for
example to enable profiling of critical low-level functions.

Add two busy wait functions rtems_counter_delay_ticks() and
rtems_counter_delay_nanoseconds() implemented via the CPU counter.
2014-02-14 10:28:29 +01:00
Sebastian Huber
382ea27b6a bsps/arm: Fix Cortex-A9 MPCore nanoseconds handler 2014-02-13 10:05:14 +01:00
Sebastian Huber
bab16de267 score: Change debug helper functions
Rename rtems_internal_error_description() to
rtems_internal_error_text().  Rename rtems_fatal_source_description() to
rtems_fatal_source_text().  Rename rtems_status_code_description() to
rtems_status_text().  Remove previous implementation of
rtems_status_text().
2014-02-12 09:18:00 +01:00
Sebastian Huber
97cf623d4a sparc: Save/restore only non-volatile context
The _CPU_Context_switch() is a normal function call.  The following
registers are volatile (the caller must assume that the register
contents are destroyed by the callee) according to "SYSTEM V APPLICATION
BINARY INTERFACE - SPARC Processor Supplement", Third Edition: g1, o0,
o1, o2, o3, o4, o5.  Drop these registers from the context.

Ensure that offset defines match the structure offsets.
2014-02-12 09:18:00 +01:00
Sebastian Huber
62c5c4a564 bsps/sparc: Fix ambapp_find_by_idx()
The expression "*pi++" post-increments the pointer (not the value).
2014-02-11 12:54:24 +01:00
Sebastian Huber
0df8d7f20d bsps/arm: Use Global Timer for Cortex-A9 MPCore
Use the Global Timer for the Cortex-A9 MPCore clock driver instead of
the Private Timer.  This enables a consistent nanoseconds since last
context switch value across all processors.
2014-02-10 16:58:03 +01:00
Sebastian Huber
069e10c392 bsps/arm: Include missing header file 2014-02-10 16:58:03 +01:00
Sebastian Huber
847fc79da1 Revert "bsp/leon3: New BSP variant leon3_qemu"
This reverts commit 7579e25512.

Improve QEMU to support AMBA plug and play instead.
2014-02-07 09:32:31 +01:00
Sebastian Huber
7579e25512 bsp/leon3: New BSP variant leon3_qemu 2014-02-06 08:47:03 +01:00
Sebastian Huber
224b88805e bsp/leon3: Declare bsp_debug_uart_init() in header
Do not return a status.
2014-02-06 08:47:03 +01:00