@@ -82,6 +82,7 @@ size_t length64=sizeof(value64);
8282#define CPU_AMPERE1 25
8383// Apple
8484#define CPU_VORTEX 13
85+ #define CPU_VORTEXM4 26
8586// Fujitsu
8687#define CPU_A64FX 15
8788// Phytium
@@ -113,7 +114,8 @@ static char *cpuname[] = {
113114 "FT2000" ,
114115 "CORTEXA76" ,
115116 "NEOVERSEV2" ,
116- "AMPERE1"
117+ "AMPERE1" ,
118+ "VORTEXM4" ,
117119};
118120
119121static char * cpuname_lower [] = {
@@ -143,7 +145,7 @@ static char *cpuname_lower[] = {
143145 "cortexa76" ,
144146 "neoversev2" ,
145147 "ampere1" ,
146- "ampere1a "
148+ "vortexm4 "
147149};
148150
149151static int cpulowperf = 0 ;
@@ -400,7 +402,7 @@ int detect(void)
400402 if (value64 == 131287967 || value64 == 458787763 ) return CPU_VORTEX ; //A12/M1
401403 if (value64 == 3660830781 ) return CPU_VORTEX ; //A15/M2
402404 if (value64 == 2271604202 ) return CPU_VORTEX ; //A16/M3
403- if (value64 == 1867590060 ) return CPU_VORTEX ; //M4
405+ if (value64 == 1867590060 ) return CPU_VORTEXM4 ; //M4
404406#else
405407#ifdef OS_WINDOWS
406408 HKEY reghandle ;
@@ -740,6 +742,27 @@ void get_cpuconfig(void)
740742 length64 = sizeof (value64 );
741743 sysctlbyname ("hw.l2cachesize" ,& value64 ,& length64 ,NULL ,0 );
742744 printf ("#define L2_SIZE %lld \n" ,value64 );
745+ #endif
746+ printf ("#define DTB_DEFAULT_ENTRIES 64 \n" );
747+ printf ("#define DTB_SIZE 4096 \n" );
748+ break ;
749+ case CPU_VORTEXM4 :
750+ printf ("#define VORTEXM4 \n" );
751+ printf ("#define HAVE_SME 1 \n" );
752+ #ifdef __APPLE__
753+ length64 = sizeof (value64 );
754+ sysctlbyname ("hw.l1icachesize" ,& value64 ,& length64 ,NULL ,0 );
755+ printf ("#define L1_CODE_SIZE %lld \n" ,value64 );
756+ length64 = sizeof (value64 );
757+ sysctlbyname ("hw.cachelinesize" ,& value64 ,& length64 ,NULL ,0 );
758+ printf ("#define L1_CODE_LINESIZE %lld \n" ,value64 );
759+ printf ("#define L1_DATA_LINESIZE %lld \n" ,value64 );
760+ length64 = sizeof (value64 );
761+ sysctlbyname ("hw.l1dcachesize" ,& value64 ,& length64 ,NULL ,0 );
762+ printf ("#define L1_DATA_SIZE %lld \n" ,value64 );
763+ length64 = sizeof (value64 );
764+ sysctlbyname ("hw.l2cachesize" ,& value64 ,& length64 ,NULL ,0 );
765+ printf ("#define L2_SIZE %lld \n" ,value64 );
743766#endif
744767 printf ("#define DTB_DEFAULT_ENTRIES 64 \n" );
745768 printf ("#define DTB_SIZE 4096 \n" );
0 commit comments