Changeset 36e5eb3 in mainline


Ignore:
Timestamp:
2012-11-24T20:09:36Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
65871bb
Parents:
435c33b
Message:

arm32: Fix fpu detection on older arms.

mvfr0 is not available unless vfp version is ≥ 3
setup handling routines only once, use fpu_setup instead of fpu_init
Be more verbose about detected FPU hw.

Location:
kernel/arch/arm32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/include/fpu_context.h

    r435c33b r36e5eb3  
    5252} fpu_context_t;
    5353
     54void fpu_setup(void);
     55
    5456#endif
    5557
  • kernel/arch/arm32/src/cpu/cpu.c

    r435c33b r36e5eb3  
    134134        );
    135135#endif
     136        fpu_setup();
    136137}
    137138
  • kernel/arch/arm32/src/fpu_context.c

    r435c33b r36e5eb3  
    143143void fpu_init(void)
    144144{
     145}
     146
     147void fpu_setup(void)
     148{
    145149        uint32_t fpsid = 0;
    146         uint32_t mvfr0 = 0;
    147150        asm volatile (
    148151                "vmrs %0,fpsid\n"
    149                 "vmrs %1,mvfr0\n"
    150                 :"=r"(fpsid), "=r"(mvfr0)::
    151         );
    152         //TODO: Identify FPU unit
    153         //and set correct functions to save/restore ctx
     152                :"=r"(fpsid)::
     153        );
    154154        switch (FPSID_SUBACHITECTURE(fpsid))
    155155        {
    156156        case FPU_VFPv1:
     157                printf("Detected VFPv1\n");
    157158                save_context = fpu_context_save_s32;
    158159                restore_context = fpu_context_restore_s32;
    159160                break;
    160161        case FPU_VFPv2_COMMONv1:
     162                printf("Detected VFPv2\n");
    161163                save_context = fpu_context_save_d16;
    162164                restore_context = fpu_context_restore_d16;
     
    164166        case FPU_VFPv3_COMMONv2:
    165167        case FPU_VFPv3_NOTRAP:
    166         case FPU_VFPv3:
     168        case FPU_VFPv3: {
     169                uint32_t mvfr0 = 0;
     170                asm volatile (
     171                        "vmrs %0,mvfr0\n"
     172                        :"=r"(mvfr0)::
     173                );
    167174                /* See page B4-1637 */
    168175                if ((mvfr0 & 0xf) == 0x1) {
     176                        printf("Detected VFPv3+ with 32 regs\n");
    169177                        save_context = fpu_context_save_d32;
    170178                        restore_context = fpu_context_restore_d32;
    171179                } else {
     180                        printf("Detected VFPv3+ with 16 regs\n");
    172181                        save_context = fpu_context_save_d16;
    173182                        restore_context = fpu_context_restore_d16;
    174183                }
    175184                break;
     185        }
    176186
    177187        }
Note: See TracChangeset for help on using the changeset viewer.