Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Identifying VFPs by architecture bits



Hi,

Currently, for identifying a VFP, we require a full match of the FPSID 
register, except for the revision bits.

I think we can avoid maintaining an individual list of FPSID by identifying 
them just by the architecture bits. Something like the attached patch should 
do the trick,

The only think I'm not sure about, is this entry for MV88SV58XX:

#define FPU_VFP_MV88SV58XX      0x56022090

This should match VFPv3 subarch v2, just like Cortex-A5 and Cortex-A7, but for 
some reason, is given a different treatment in vfp_init.c:vfp_attach. Is this 
some kind of rare beast for which is not safe to check for NEON support?

Sergio.




diff --git a/sys/arch/arm/vfp/vfp_init.c b/sys/arch/arm/vfp/vfp_init.c
index c5ee1f7..c7e8048 100644
--- a/sys/arch/arm/vfp/vfp_init.c
+++ b/sys/arch/arm/vfp/vfp_init.c
@@ -88,16 +88,11 @@ load_vfpregs(const struct vfpreg *fregs)
 	load_vfpregs_lo(fregs->vfp_regs);
 #ifdef CPU_CORTEX
 #ifdef CPU_ARM11
-	switch (curcpu()->ci_vfp_id) {
-	case FPU_VFP_CORTEXA5:
-	case FPU_VFP_CORTEXA7:
-	case FPU_VFP_CORTEXA8:
-	case FPU_VFP_CORTEXA9:
-	case FPU_VFP_CORTEXA15:
+	const uint32_t vfparch = curcpu()->ci_vfp_id & VFP_FPSID_ARCH_MSK;
+	if (vfparch >= VFP_FPSID_ARCH_V3_2) {
 #endif
 		load_vfpregs_hi(fregs->vfp_regs);
 #ifdef CPU_ARM11
-		break;
 	}
 #endif
 #endif
@@ -109,16 +104,11 @@ save_vfpregs(struct vfpreg *fregs)
 	save_vfpregs_lo(fregs->vfp_regs);
 #ifdef CPU_CORTEX
 #ifdef CPU_ARM11
-	switch (curcpu()->ci_vfp_id) {
-	case FPU_VFP_CORTEXA5:
-	case FPU_VFP_CORTEXA7:
-	case FPU_VFP_CORTEXA8:
-	case FPU_VFP_CORTEXA9:
-	case FPU_VFP_CORTEXA15:
+	const uint32_t vfparch = curcpu()->ci_vfp_id & VFP_FPSID_ARCH_MSK;
+	if (vfparch >= VFP_FPSID_ARCH_V3_2) {
 #endif
 		save_vfpregs_hi(fregs->vfp_regs);
 #ifdef CPU_ARM11
-		break;
 	}
 #endif
 #endif
@@ -297,23 +287,18 @@ vfp_attach(struct cpu_info *ci)
 	}
 
 	ci->ci_vfp_id = fpsid;
-	switch (fpsid & ~ VFP_FPSID_REV_MSK) {
-	case FPU_VFP10_ARM10E:
-		model = "VFP10 R1";
-		break;
-	case FPU_VFP11_ARM11:
-		model = "VFP11";
+	switch (fpsid & VFP_FPSID_ARCH_MSK) {
+	case VFP_FPSID_ARCH_V1:
+		model = "VFPv1";
 		break;
-	case FPU_VFP_MV88SV58XX:
-		model = "VFP3";
+	case VFP_FPSID_ARCH_V2:
+		model = "VFPv2";
 		break;
-	case FPU_VFP_CORTEXA5:
-	case FPU_VFP_CORTEXA7:
-	case FPU_VFP_CORTEXA8:
-	case FPU_VFP_CORTEXA9:
-	case FPU_VFP_CORTEXA15:
+	case VFP_FPSID_ARCH_V3_2:
+	case VFP_FPSID_ARCH_V3:
+	case VFP_FPSID_ARCH_V3_3:
 		if (armreg_cpacr_read() & CPACR_V7_ASEDIS) {
-			model = "VFP 4.0+";
+			model = "VFP 3.0+";
 		} else {
 			model = "NEON MPE (VFP 3.0+)";
 			cpu_neon_present = 1;


Home | Main Index | Thread Index | Old Index