Merge pull request #1543 from martin-frbg/mips32
Fix MIPS32 build and add MIPS 1004K cpu (MT7621 SOC)
This commit is contained in:
commit
dbafe6357b
|
@ -17,6 +17,10 @@ ifdef CPUIDEMU
|
||||||
EXFLAGS = -DCPUIDEMU -DVENDOR=99
|
EXFLAGS = -DCPUIDEMU -DVENDOR=99
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET), 1004K)
|
||||||
|
TARGET_FLAGS = -mips32r2
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET), P5600)
|
ifeq ($(TARGET), P5600)
|
||||||
TARGET_FLAGS = -mips32r5
|
TARGET_FLAGS = -mips32r5
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -564,6 +564,11 @@ CCOMMON_OPT += -march=mips64
|
||||||
FCOMMON_OPT += -march=mips64
|
FCOMMON_OPT += -march=mips64
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CORE), 1004K)
|
||||||
|
CCOMMON_OPT += -mips32r2 $(MSA_FLAGS)
|
||||||
|
FCOMMON_OPT += -mips32r2 $(MSA_FLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CORE), P5600)
|
ifeq ($(CORE), P5600)
|
||||||
CCOMMON_OPT += -mips32r5 -mnan=2008 -mtune=p5600 $(MSA_FLAGS)
|
CCOMMON_OPT += -mips32r5 -mnan=2008 -mtune=p5600 $(MSA_FLAGS)
|
||||||
FCOMMON_OPT += -mips32r5 -mnan=2008 -mtune=p5600 $(MSA_FLAGS)
|
FCOMMON_OPT += -mips32r5 -mnan=2008 -mtune=p5600 $(MSA_FLAGS)
|
||||||
|
|
|
@ -56,6 +56,7 @@ CELL
|
||||||
|
|
||||||
3.MIPS CPU:
|
3.MIPS CPU:
|
||||||
P5600
|
P5600
|
||||||
|
1004K
|
||||||
|
|
||||||
4.MIPS64 CPU:
|
4.MIPS64 CPU:
|
||||||
SICORTEX
|
SICORTEX
|
||||||
|
|
58
cpuid_mips.c
58
cpuid_mips.c
|
@ -72,10 +72,12 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#define CPU_UNKNOWN 0
|
#define CPU_UNKNOWN 0
|
||||||
#define CPU_P5600 1
|
#define CPU_P5600 1
|
||||||
|
#define CPU_1004K 2
|
||||||
|
|
||||||
static char *cpuname[] = {
|
static char *cpuname[] = {
|
||||||
"UNKOWN",
|
"UNKOWN",
|
||||||
"P5600"
|
"P5600",
|
||||||
|
"1004K"
|
||||||
};
|
};
|
||||||
|
|
||||||
int detect(void){
|
int detect(void){
|
||||||
|
@ -90,7 +92,7 @@ int detect(void){
|
||||||
if (!strncmp("cpu", buffer, 3)){
|
if (!strncmp("cpu", buffer, 3)){
|
||||||
p = strchr(buffer, ':') + 2;
|
p = strchr(buffer, ':') + 2;
|
||||||
#if 0
|
#if 0
|
||||||
fprintf(stderr, "%s\n", p);
|
fprintf(stderr, "%s \n", p);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -99,43 +101,13 @@ int detect(void){
|
||||||
fclose(infile);
|
fclose(infile);
|
||||||
|
|
||||||
if(p != NULL){
|
if(p != NULL){
|
||||||
if (strstr(p, "Loongson-3A")){
|
if (strstr(p, "5600")) {
|
||||||
return CPU_LOONGSON3A;
|
return CPU_P5600;
|
||||||
}else if(strstr(p, "Loongson-3B")){
|
} else if (strstr(p, "1004K")) {
|
||||||
return CPU_LOONGSON3B;
|
return CPU_1004K;
|
||||||
}else if (strstr(p, "Loongson-3")){
|
} else
|
||||||
infile = fopen("/proc/cpuinfo", "r");
|
|
||||||
p = (char *)NULL;
|
|
||||||
while (fgets(buffer, sizeof(buffer), infile)){
|
|
||||||
if (!strncmp("system type", buffer, 11)){
|
|
||||||
p = strchr(buffer, ':') + 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(infile);
|
|
||||||
if (strstr(p, "loongson3a"))
|
|
||||||
return CPU_LOONGSON3A;
|
|
||||||
}else{
|
|
||||||
return CPU_UNKNOWN;
|
return CPU_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//Check model name for Loongson3
|
|
||||||
infile = fopen("/proc/cpuinfo", "r");
|
|
||||||
p = (char *)NULL;
|
|
||||||
while (fgets(buffer, sizeof(buffer), infile)){
|
|
||||||
if (!strncmp("model name", buffer, 10)){
|
|
||||||
p = strchr(buffer, ':') + 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(infile);
|
|
||||||
if(p != NULL){
|
|
||||||
if (strstr(p, "Loongson-3A")){
|
|
||||||
return CPU_LOONGSON3A;
|
|
||||||
}else if(strstr(p, "Loongson-3B")){
|
|
||||||
return CPU_LOONGSON3B;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return CPU_UNKNOWN;
|
return CPU_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +121,7 @@ void get_architecture(void){
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_subarchitecture(void){
|
void get_subarchitecture(void){
|
||||||
if(detect()==CPU_P5600){
|
if(detect()==CPU_P5600|| detect()==CPU_1004K){
|
||||||
printf("P5600");
|
printf("P5600");
|
||||||
}else{
|
}else{
|
||||||
printf("UNKNOWN");
|
printf("UNKNOWN");
|
||||||
|
@ -170,6 +142,14 @@ void get_cpuconfig(void){
|
||||||
printf("#define DTB_DEFAULT_ENTRIES 64\n");
|
printf("#define DTB_DEFAULT_ENTRIES 64\n");
|
||||||
printf("#define DTB_SIZE 4096\n");
|
printf("#define DTB_SIZE 4096\n");
|
||||||
printf("#define L2_ASSOCIATIVE 8\n");
|
printf("#define L2_ASSOCIATIVE 8\n");
|
||||||
|
} else if (detect()==CPU_1004K) {
|
||||||
|
printf("#define MIPS1004K\n");
|
||||||
|
printf("#define L1_DATA_SIZE 32768\n");
|
||||||
|
printf("#define L1_DATA_LINESIZE 32\n");
|
||||||
|
printf("#define L2_SIZE 26144\n");
|
||||||
|
printf("#define DTB_DEFAULT_ENTRIES 8\n");
|
||||||
|
printf("#define DTB_SIZE 4096\n");
|
||||||
|
printf("#define L2_ASSOCIATIVE 4\n");
|
||||||
}else{
|
}else{
|
||||||
printf("#define UNKNOWN\n");
|
printf("#define UNKNOWN\n");
|
||||||
}
|
}
|
||||||
|
@ -178,6 +158,8 @@ void get_cpuconfig(void){
|
||||||
void get_libname(void){
|
void get_libname(void){
|
||||||
if(detect()==CPU_P5600) {
|
if(detect()==CPU_P5600) {
|
||||||
printf("p5600\n");
|
printf("p5600\n");
|
||||||
|
} else if (detect()==CPU_1004K) {
|
||||||
|
printf("1004K\n");
|
||||||
}else{
|
}else{
|
||||||
printf("mips\n");
|
printf("mips\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,10 @@ ifeq ($(ARCH), arm64)
|
||||||
USE_TRMM = 1
|
USE_TRMM = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ARCH), mips)
|
||||||
|
USE_TRMM = 1
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET), LOONGSON3B)
|
ifeq ($(TARGET), LOONGSON3B)
|
||||||
USE_TRMM = 1
|
USE_TRMM = 1
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
include $(KERNELDIR)/KERNEL.P5600
|
2
param.h
2
param.h
|
@ -2291,7 +2291,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define SYMV_P 16
|
#define SYMV_P 16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(P5600) || defined(I6400) || defined(P6600) || defined(I6500)
|
#if defined(P5600) || defined(MIPS1004K) || defined(I6400) || defined(P6600) || defined(I6500)
|
||||||
#define SNUMOPT 2
|
#define SNUMOPT 2
|
||||||
#define DNUMOPT 2
|
#define DNUMOPT 2
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue