0001
0002 #ifndef _ASM_MACH_LOONGSON64_CPUCFG_EMUL_H_
0003 #define _ASM_MACH_LOONGSON64_CPUCFG_EMUL_H_
0004
0005 #include <asm/cpu-info.h>
0006
0007 #ifdef CONFIG_CPU_LOONGSON3_CPUCFG_EMULATION
0008
0009 #include <loongson_regs.h>
0010
0011 #define LOONGSON_FPREV_MASK 0x7
0012
0013 void loongson3_cpucfg_synthesize_data(struct cpuinfo_mips *c);
0014
0015 static inline bool loongson3_cpucfg_emulation_enabled(struct cpuinfo_mips *c)
0016 {
0017
0018 return c->loongson3_cpucfg_data[0] != 0;
0019 }
0020
0021 static inline u32 loongson3_cpucfg_read_synthesized(struct cpuinfo_mips *c,
0022 __u64 sel)
0023 {
0024 switch (sel) {
0025 case LOONGSON_CFG0:
0026 return c->processor_id;
0027 case LOONGSON_CFG1:
0028 case LOONGSON_CFG2:
0029 case LOONGSON_CFG3:
0030 return c->loongson3_cpucfg_data[sel - 1];
0031 case LOONGSON_CFG4:
0032 case LOONGSON_CFG5:
0033
0034
0035
0036
0037
0038 return 0;
0039 case LOONGSON_CFG6:
0040
0041 return 0;
0042 case LOONGSON_CFG7:
0043
0044
0045
0046
0047
0048 return 0;
0049 }
0050
0051
0052
0053
0054
0055 return 0;
0056 }
0057 #else
0058 static inline void loongson3_cpucfg_synthesize_data(struct cpuinfo_mips *c)
0059 {
0060 }
0061
0062 static inline bool loongson3_cpucfg_emulation_enabled(struct cpuinfo_mips *c)
0063 {
0064 return false;
0065 }
0066
0067 static inline u32 loongson3_cpucfg_read_synthesized(struct cpuinfo_mips *c,
0068 __u64 sel)
0069 {
0070 return 0;
0071 }
0072 #endif
0073
0074 #endif