Changeset db42c079 in rtems for c/src/lib/libcpu/arm


Ignore:
Timestamp:
May 31, 2013, 11:59:47 AM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
94c17af
Parents:
f2f211c5
git-author:
Sebastian Huber <sebastian.huber@…> (05/31/13 11:59:47)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/31/13 13:20:33)
Message:

bsps/arm: Add SMP support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/arm/shared/include/arm-cp15.h

    rf2f211c5 rdb42c079  
    843843}
    844844
     845static inline uint32_t arm_cp15_get_multiprocessor_affinity(void)
     846{
     847  ARM_SWITCH_REGISTERS;
     848  uint32_t mpidr;
     849
     850  __asm__ volatile (
     851    ARM_SWITCH_TO_ARM
     852          "mrc p15, 0, %[mpidr], c0, c0, 5\n"
     853    ARM_SWITCH_BACK
     854    : [mpidr] "=&r" (mpidr) ARM_SWITCH_ADDITIONAL_OUTPUT
     855  );
     856
     857  return mpidr & 0xff;
     858}
     859
     860static inline uint32_t arm_cortex_a9_get_multiprocessor_cpu_id(void)
     861{
     862  return arm_cp15_get_multiprocessor_affinity() & 0xff;
     863}
     864
     865#define ARM_CORTEX_A9_ACTL_FW (1U << 0)
     866#define ARM_CORTEX_A9_ACTL_L2_PREFETCH_HINT_ENABLE (1U << 1)
     867#define ARM_CORTEX_A9_ACTL_L1_PREFETCH_ENABLE (1U << 2)
     868#define ARM_CORTEX_A9_ACTL_WRITE_FULL_LINE_OF_ZEROS_MODE (1U << 3)
     869#define ARM_CORTEX_A9_ACTL_SMP (1U << 6)
     870#define ARM_CORTEX_A9_ACTL_EXCL (1U << 7)
     871#define ARM_CORTEX_A9_ACTL_ALLOC_IN_ONE_WAY (1U << 8)
     872#define ARM_CORTEX_A9_ACTL_PARITY_ON (1U << 9)
     873
     874static inline uint32_t arm_cp15_get_auxiliary_control(void)
     875{
     876  ARM_SWITCH_REGISTERS;
     877  uint32_t val;
     878
     879  __asm__ volatile (
     880    ARM_SWITCH_TO_ARM
     881    "mrc p15, 0, %[val], c1, c0, 1\n"
     882    ARM_SWITCH_BACK
     883    : [val] "=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
     884  );
     885
     886  return val;
     887}
     888
     889static inline void arm_cp15_set_auxiliary_control(uint32_t val)
     890{
     891  ARM_SWITCH_REGISTERS;
     892
     893  __asm__ volatile (
     894    ARM_SWITCH_TO_ARM
     895    "mcr p15, 0, %[val], c1, c0, 1\n"
     896    ARM_SWITCH_BACK
     897    : ARM_SWITCH_OUTPUT
     898    : [val] "r" (val)
     899  );
     900}
     901
    845902/**
    846903 * @brief Sets the @a section_flags for the address range [@a begin, @a end).
Note: See TracChangeset for help on using the changeset viewer.