1 #ifndef KERNEL_VFP_H 2 #define KERNEL_VFP_H 3 4 #include <types_ext.h> 5 6 #define VFP_NUM_REGS 32 7 8 struct vfp_state { 9 uint32_t fpexc; 10 uint32_t fpscr; 11 uint64_t reg[VFP_NUM_REGS]; 12 }; 13 14 bool vfp_is_enabled(void); 15 void vfp_enable(void); 16 void vfp_disable(void); 17 18 /* 19 * vfp_lazy_save_state_init() - Saves FPEXC and disables VFP 20 * @state: VFP state structure to initialize 21 */ 22 void vfp_lazy_save_state_init(struct vfp_state *state); 23 24 /* 25 * vfp_lazy_save_state_final() - Saves rest of VFP state 26 * @state: VFP state to save in 27 * 28 * If VFP was enabled in the previously saved FPEXC save rest of FVP state. 29 */ 30 void vfp_lazy_save_state_final(struct vfp_state *state); 31 32 /* 33 * vfp_lazy_restore_state() - Lazy restore VFP state 34 * @state: VFP state to restore 35 * 36 * Restores FPEXC and also restores rest of VFP state if 37 * vfp_lazy_save_state_final() was called on this state. 38 */ 39 void vfp_lazy_restore_state(struct vfp_state *state, bool full_state); 40 41 #define FPEXC_EN (1 << 30) 42 43 /* 44 * These functions can't be implemented in inline assembly when compiling 45 * for thumb mode, to make it easy always implement then in ARM assembly as 46 * ordinary functions. 47 */ 48 void vfp_write_fpexc(uint32_t fpexc); 49 uint32_t vfp_read_fpexc(void); 50 void vfp_write_fpscr(uint32_t fpscr); 51 uint32_t vfp_read_fpscr(void); 52 53 #endif /*KERNEL_VFP_H*/ 54