Changeset 5265eea4 in mainline for kernel/arch/arm32/src/cpu/cpu.c


Ignore:
Timestamp:
2015-10-28T18:17:27Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77a194c, ff381a7
Parents:
0328987 (diff), 5783d10 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge various ARM fixes from lp:~jakub/helenos/arm

Fix GTA02 uspace/kernel memory corruption caused by wrong TLB
invalidation. ARM920T does not have a unified TLB, so it is necessary
to purge the instruction and data TLBs separately.

Fix RaspberryPi support. Make RaspberryPi use non-shared memory
(eliminating thus a weird special case for ARMv6) and invalidate the
entire D-cache before it is re-enabled in the kernel.

Make the CP15 cache-related macros non-ARMv7-centric for ARMv6-. Define
only macros that are supported by the given CPU/architecture (partially).

Be more careful and do not assume ARMv7 features. This relates to
enabling branch predictors, prefetch buffer and various control bits
in some registers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/src/cpu/cpu.c

    r0328987 r5265eea4  
    130130{
    131131        uint32_t control_reg = SCTLR_read();
    132        
     132
     133        dcache_invalidate();
     134        read_barrier();
     135
    133136        /* Turn off tex remap, RAZ/WI prior to armv7 */
    134137        control_reg &= ~SCTLR_TEX_REMAP_EN_FLAG;
     
    322325void icache_invalidate(void)
    323326{
     327#if defined(PROCESSOR_ARCH_armv7_a)
    324328        ICIALLU_write(0);
     329#else
     330        ICIALL_write(0);
     331#endif
     332}
     333
     334#if !defined(PROCESSOR_ARCH_armv7_a)
     335static bool cache_is_unified(void)
     336{
     337        if (MIDR_read() != CTR_read()) {
     338                /* We have the CTR register */
     339                return (CTR_read() & CTR_SEP_FLAG) != CTR_SEP_FLAG;
     340        } else {
     341                panic("Unknown cache type");
     342        }
     343}
     344#endif
     345
     346void dcache_invalidate(void)
     347{
     348#if defined(PROCESSOR_ARCH_armv7_a)
     349        dcache_flush_invalidate();
     350#else
     351        if (cache_is_unified())
     352                CIALL_write(0);
     353        else
     354                DCIALL_write(0);
     355#endif
     356}
     357
     358void dcache_clean_mva_pou(uintptr_t mva)
     359{
     360#if defined(PROCESSOR_ARCH_armv7_a)
     361        DCCMVAU_write(mva);
     362#else
     363        if (cache_is_unified())
     364                CCMVA_write(mva);
     365        else
     366                DCCMVA_write(mva);
     367#endif
    325368}
    326369
Note: See TracChangeset for help on using the changeset viewer.