Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <asm/sfp-machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <math-emu/soft-fp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <math-emu/double.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <math-emu/single.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) lfs(void *frD, void *ea)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	FP_DECL_D(R);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	FP_DECL_S(A);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	FP_DECL_EX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	float f;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #ifdef DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	printk("%s: D %p, ea %p\n", __func__, frD, ea);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	if (copy_from_user(&f, ea, sizeof(float)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 		return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	FP_UNPACK_S(A, f);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #ifdef DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	printk("A: %ld %lu %ld (%ld) [%08lx]\n", A_s, A_f, A_e, A_c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	       *(unsigned long *)&f);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	FP_CONV(D, S, 2, 1, R, A);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #ifdef DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	if (R_c == FP_CLS_NAN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 		R_e = _FP_EXPMAX_D;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 		_FP_PACK_RAW_2_P(D, frD, R);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 		__FP_PACK_D(frD, R);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) }