drm/rockchip: vop2: Fix the windows switch between different layers
[drm/drm-misc.git] / arch / mips / include / asm / mach-loongson64 / cpucfg-emul.h
blobd64af19c210d8e6e554067ef3a25f0522fc5d226
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_MACH_LOONGSON64_CPUCFG_EMUL_H_
3 #define _ASM_MACH_LOONGSON64_CPUCFG_EMUL_H_
5 #include <asm/cpu-info.h>
7 #ifdef CONFIG_CPU_LOONGSON3_CPUCFG_EMULATION
9 #include <loongson_regs.h>
11 #define LOONGSON_FPREV_MASK 0x7
13 void loongson3_cpucfg_synthesize_data(struct cpuinfo_mips *c);
15 static inline bool loongson3_cpucfg_emulation_enabled(struct cpuinfo_mips *c)
17 /* All supported cores have non-zero LOONGSON_CFG1 data. */
18 return c->loongson3_cpucfg_data[0] != 0;
21 static inline u32 loongson3_cpucfg_read_synthesized(struct cpuinfo_mips *c,
22 __u64 sel)
24 switch (sel) {
25 case LOONGSON_CFG0:
26 return c->processor_id;
27 case LOONGSON_CFG1:
28 case LOONGSON_CFG2:
29 case LOONGSON_CFG3:
30 return c->loongson3_cpucfg_data[sel - 1];
31 case LOONGSON_CFG4:
32 case LOONGSON_CFG5:
33 /* CPUCFG selects 4 and 5 are related to the input clock
34 * signal.
36 * Unimplemented for now.
38 return 0;
39 case LOONGSON_CFG6:
40 /* CPUCFG select 6 is for the undocumented Safe Extension. */
41 return 0;
42 case LOONGSON_CFG7:
43 /* CPUCFG select 7 is for the virtualization extension.
44 * We don't know if the two currently known features are
45 * supported on older cores according to the public
46 * documentation, so leave this at zero.
48 return 0;
52 * Return 0 for unrecognized CPUCFG selects, which is real hardware
53 * behavior observed on Loongson 3A R4.
55 return 0;
57 #else
58 static inline void loongson3_cpucfg_synthesize_data(struct cpuinfo_mips *c)
62 static inline bool loongson3_cpucfg_emulation_enabled(struct cpuinfo_mips *c)
64 return false;
67 static inline u32 loongson3_cpucfg_read_synthesized(struct cpuinfo_mips *c,
68 __u64 sel)
70 return 0;
72 #endif
74 #endif /* _ASM_MACH_LOONGSON64_CPUCFG_EMUL_H_ */