1/* 2 * Copyright 2017, Data61 3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4 * ABN 41 687 119 230. 5 * 6 * This software may be distributed and modified according to the terms of 7 * the GNU General Public License version 2. Note that NO WARRANTY is provided. 8 * See "LICENSE_GPLv2.txt" for details. 9 * 10 * @TAG(DATA61_GPL) 11 */ 12 13#include <mode/machine.h> 14#include <arch/machine/fpu.h> 15#include <mode/model/statedata.h> 16 17bool_t isFPUEnabledCached[CONFIG_MAX_NUM_NODES]; 18 19#ifdef CONFIG_HAVE_FPU 20/* Initialise the FP/SIMD for this machine. */ 21BOOT_CODE bool_t 22fpsimd_init(void) 23{ 24 /* Set the FPU to lazy switch mode */ 25 disableFpu(); 26 if (config_set(CONFIG_ARM_HYPERVISOR_SUPPORT)) { 27 enableFpuEL01(); 28 } 29 30 return true; 31} 32#endif /* CONFIG_HAVE_FPU */ 33 34BOOT_CODE bool_t 35fpsimd_HWCapTest(void) 36{ 37 word_t id_aa64pfr0; 38 39 /* Check if the hardware has FP and ASIMD support... */ 40 MRS("id_aa64pfr0_el1", id_aa64pfr0); 41 if ((id_aa64pfr0 >> ID_AA64PFR0_EL1_FP) & MASK(4) || 42 (id_aa64pfr0 >> ID_AA64PFR0_EL1_ASIMD) & MASK(4)) { 43 return false; 44 } 45 46 return true; 47} 48