Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Loongson: Add Loongson-3A R2 basic support

Loongson-3 CPU family:

Code-name Brand-name PRId
Loongson-3A R1 Loongson-3A1000 0x6305
Loongson-3A R2 Loongson-3A2000 0x6308
Loongson-3B R1 Loongson-3B1000 0x6306
Loongson-3B R2 Loongson-3B1500 0x6307

Features of R2 revision of Loongson-3A:

- Primary cache includes I-Cache, D-Cache and V-Cache (Victim Cache).
- I-Cache, D-Cache and V-Cache are 16-way set-associative, linesize is
64 bytes.
- 64 entries of VTLB (classic TLB), 1024 entries of FTLB (8-way
set-associative).
- Supports DSP/DSPv2 instructions, UserLocal register and Read-Inhibit/
Execute-Inhibit.

[ralf@linux-mips.org: Resolved merge conflicts.]

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Steven J . Hill <sjhill@realitydiluted.com>
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/12751/
Patchwork: https://patchwork.linux-mips.org/patch/13136/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Huacai Chen and committed by
Ralf Baechle
b2edcfc8 24653515

+201 -32
+2
arch/mips/Kconfig
··· 1354 1354 select CPU_SUPPORTS_HUGEPAGES 1355 1355 select WEAK_ORDERING 1356 1356 select WEAK_REORDERING_BEYOND_LLSC 1357 + select MIPS_PGD_C0_CONTEXT 1357 1358 select ARCH_REQUIRE_GPIOLIB 1358 1359 help 1359 1360 The Loongson 3 processor implements the MIPS64R2 instruction ··· 1824 1823 config SYS_HAS_CPU_LOONGSON3 1825 1824 bool 1826 1825 select CPU_SUPPORTS_CPUFREQ 1826 + select CPU_HAS_RIXI 1827 1827 1828 1828 config SYS_HAS_CPU_LOONGSON2E 1829 1829 bool
+6
arch/mips/include/asm/cacheops.h
··· 21 21 #define Cache_I 0x00 22 22 #define Cache_D 0x01 23 23 #define Cache_T 0x02 24 + #define Cache_V 0x02 /* Loongson-3 */ 24 25 #define Cache_S 0x03 25 26 26 27 #define Index_Writeback_Inv 0x00 ··· 107 106 * Loongson2-specific cacheops 108 107 */ 109 108 #define Hit_Invalidate_I_Loongson2 (Cache_I | 0x00) 109 + 110 + /* 111 + * Loongson3-specific cacheops 112 + */ 113 + #define Index_Writeback_Inv_V (Cache_V | Index_Writeback_Inv) 110 114 111 115 #endif /* __ASM_CACHEOPS_H */
+1
arch/mips/include/asm/cpu-info.h
··· 60 60 int tlbsizeftlbways; 61 61 struct cache_desc icache; /* Primary I-cache */ 62 62 struct cache_desc dcache; /* Primary D or combined I/D cache */ 63 + struct cache_desc vcache; /* Victim cache, between pcache and scache */ 63 64 struct cache_desc scache; /* Secondary cache */ 64 65 struct cache_desc tcache; /* Tertiary/split secondary cache */ 65 66 int srsets; /* Shadow register sets */
+3 -1
arch/mips/include/asm/cpu.h
··· 42 42 #define PRID_COMP_LEXRA 0x0b0000 43 43 #define PRID_COMP_NETLOGIC 0x0c0000 44 44 #define PRID_COMP_CAVIUM 0x0d0000 45 + #define PRID_COMP_LOONGSON 0x140000 45 46 #define PRID_COMP_INGENIC_D0 0xd00000 /* JZ4740, JZ4750 */ 46 47 #define PRID_COMP_INGENIC_D1 0xd10000 /* JZ4770, JZ4775 */ 47 48 #define PRID_COMP_INGENIC_E1 0xe10000 /* JZ4780 */ ··· 242 241 #define PRID_REV_LOONGSON1B 0x0020 243 242 #define PRID_REV_LOONGSON2E 0x0002 244 243 #define PRID_REV_LOONGSON2F 0x0003 245 - #define PRID_REV_LOONGSON3A 0x0005 244 + #define PRID_REV_LOONGSON3A_R1 0x0005 246 245 #define PRID_REV_LOONGSON3B_R1 0x0006 247 246 #define PRID_REV_LOONGSON3B_R2 0x0007 247 + #define PRID_REV_LOONGSON3A_R2 0x0008 248 248 249 249 /* 250 250 * Older processors used to encode processor version and revision in two
+5 -13
arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h
··· 16 16 #ifndef __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H 17 17 #define __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H 18 18 19 - #define cpu_dcache_line_size() 32 20 - #define cpu_icache_line_size() 32 21 - #define cpu_scache_line_size() 32 22 - 23 - 24 19 #define cpu_has_32fpr 1 25 20 #define cpu_has_3k_cache 0 26 21 #define cpu_has_4k_cache 1 ··· 26 31 #define cpu_has_counter 1 27 32 #define cpu_has_dc_aliases (PAGE_SIZE < 0x4000) 28 33 #define cpu_has_divec 0 29 - #define cpu_has_dsp 0 30 - #define cpu_has_dsp2 0 31 34 #define cpu_has_ejtag 0 32 - #define cpu_has_ic_fills_f_dc 0 33 35 #define cpu_has_inclusive_pcaches 1 34 36 #define cpu_has_llsc 1 35 37 #define cpu_has_mcheck 0 36 38 #define cpu_has_mdmx 0 37 39 #define cpu_has_mips16 0 38 - #define cpu_has_mips32r2 0 39 40 #define cpu_has_mips3d 0 40 - #define cpu_has_mips64r2 0 41 41 #define cpu_has_mipsmt 0 42 - #define cpu_has_prefetch 0 43 42 #define cpu_has_smartmips 0 44 43 #define cpu_has_tlb 1 45 44 #define cpu_has_tx39_cache 0 46 - #define cpu_has_userlocal 0 47 45 #define cpu_has_vce 0 48 46 #define cpu_has_veic 0 49 47 #define cpu_has_vint 0 ··· 44 56 #define cpu_has_watch 1 45 57 #define cpu_has_local_ebase 0 46 58 47 - #define cpu_has_wsbh IS_ENABLED(CONFIG_CPU_LOONGSON3) 59 + #ifdef CONFIG_CPU_LOONGSON3 60 + #define cpu_has_wsbh 1 61 + #define cpu_has_ic_fills_f_dc 1 62 + #define cpu_hwrena_impl_bits 0xc0000000 63 + #endif 48 64 49 65 #endif /* __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H */
+4 -2
arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
··· 23 23 or t0, (0x1 << 7) 24 24 mtc0 t0, $16, 3 25 25 /* Set ELPA on LOONGSON3 pagegrain */ 26 - li t0, (0x1 << 29) 26 + mfc0 t0, $5, 1 27 + or t0, (0x1 << 29) 27 28 mtc0 t0, $5, 1 28 29 _ehb 29 30 .set pop ··· 43 42 or t0, (0x1 << 7) 44 43 mtc0 t0, $16, 3 45 44 /* Set ELPA on LOONGSON3 pagegrain */ 46 - li t0, (0x1 << 29) 45 + mfc0 t0, $5, 1 46 + or t0, (0x1 << 29) 47 47 mtc0 t0, $5, 1 48 48 _ehb 49 49 .set pop
+2
arch/mips/include/asm/mipsregs.h
··· 636 636 #define MIPS_CONF6_SYND (_ULCAST_(1) << 13) 637 637 /* proAptiv FTLB on/off bit */ 638 638 #define MIPS_CONF6_FTLBEN (_ULCAST_(1) << 15) 639 + /* Loongson-3 FTLB on/off bit */ 640 + #define MIPS_CONF6_FTLBDIS (_ULCAST_(1) << 22) 639 641 /* FTLB probability bits */ 640 642 #define MIPS_CONF6_FTLBP_SHIFT (16) 641 643
+2 -2
arch/mips/include/asm/pgtable.h
··· 384 384 static inline pte_t pte_mkyoung(pte_t pte) 385 385 { 386 386 pte_val(pte) |= _PAGE_ACCESSED; 387 - #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) 387 + #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) || defined(CONFIG_CPU_LOONGSON3) 388 388 if (!(pte_val(pte) & _PAGE_NO_READ)) 389 389 pte_val(pte) |= _PAGE_SILENT_READ; 390 390 else ··· 570 570 { 571 571 pmd_val(pmd) |= _PAGE_ACCESSED; 572 572 573 - #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) 573 + #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) || defined(CONFIG_CPU_LOONGSON3) 574 574 if (!(pmd_val(pmd) & _PAGE_NO_READ)) 575 575 pmd_val(pmd) |= _PAGE_SILENT_READ; 576 576 else
+37 -1
arch/mips/kernel/cpu-probe.c
··· 562 562 write_c0_config7(config | (calculate_ftlb_probability(c) 563 563 << MIPS_CONF7_FTLBP_SHIFT)); 564 564 break; 565 + case CPU_LOONGSON3: 566 + /* Loongson-3 cores use Config6 to enable the FTLB */ 567 + config = read_c0_config6(); 568 + if (enable) 569 + /* Enable FTLB */ 570 + write_c0_config6(config & ~MIPS_CONF6_FTLBDIS); 571 + else 572 + /* Disable FTLB */ 573 + write_c0_config6(config | MIPS_CONF6_FTLBDIS); 574 + break; 565 575 default: 566 576 return 1; 567 577 } ··· 1188 1178 set_isa(c, MIPS_CPU_ISA_III); 1189 1179 c->fpu_msk31 |= FPU_CSR_CONDX; 1190 1180 break; 1191 - case PRID_REV_LOONGSON3A: 1181 + case PRID_REV_LOONGSON3A_R1: 1192 1182 c->cputype = CPU_LOONGSON3; 1193 1183 __cpu_name[cpu] = "ICT Loongson-3"; 1194 1184 set_elf_platform(cpu, "loongson3a"); ··· 1522 1512 } 1523 1513 } 1524 1514 1515 + static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu) 1516 + { 1517 + switch (c->processor_id & PRID_IMP_MASK) { 1518 + case PRID_IMP_LOONGSON_64: /* Loongson-2/3 */ 1519 + switch (c->processor_id & PRID_REV_MASK) { 1520 + case PRID_REV_LOONGSON3A_R2: 1521 + c->cputype = CPU_LOONGSON3; 1522 + __cpu_name[cpu] = "ICT Loongson-3"; 1523 + set_elf_platform(cpu, "loongson3a"); 1524 + set_isa(c, MIPS_CPU_ISA_M64R2); 1525 + break; 1526 + } 1527 + 1528 + decode_configs(c); 1529 + c->options |= MIPS_CPU_TLBINV; 1530 + c->writecombine = _CACHE_UNCACHED_ACCELERATED; 1531 + break; 1532 + default: 1533 + panic("Unknown Loongson Processor ID!"); 1534 + break; 1535 + } 1536 + } 1537 + 1525 1538 static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu) 1526 1539 { 1527 1540 decode_configs(c); ··· 1691 1658 break; 1692 1659 case PRID_COMP_CAVIUM: 1693 1660 cpu_probe_cavium(c, cpu); 1661 + break; 1662 + case PRID_COMP_LOONGSON: 1663 + cpu_probe_loongson(c, cpu); 1694 1664 break; 1695 1665 case PRID_COMP_INGENIC_D0: 1696 1666 case PRID_COMP_INGENIC_D1:
+5
arch/mips/kernel/idle.c
··· 181 181 case CPU_XLP: 182 182 cpu_wait = r4k_wait; 183 183 break; 184 + case CPU_LOONGSON3: 185 + if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_LOONGSON3A_R2) 186 + cpu_wait = r4k_wait; 187 + break; 188 + 184 189 case CPU_BMIPS5000: 185 190 cpu_wait = r4k_wait_irqoff; 186 191 break;
+2 -1
arch/mips/kernel/traps.c
··· 1772 1772 1773 1773 /* For the moment, report the problem and hang. */ 1774 1774 if ((cpu_has_mips_r2_r6) && 1775 - ((current_cpu_data.processor_id & 0xff0000) == PRID_COMP_MIPS)) { 1775 + (((current_cpu_data.processor_id & 0xff0000) == PRID_COMP_MIPS) || 1776 + ((current_cpu_data.processor_id & 0xff0000) == PRID_COMP_LOONGSON))) { 1776 1777 pr_err("FTLB error exception, cp0_ecc=0x%08x:\n", 1777 1778 read_c0_ecc()); 1778 1779 pr_err("cp0_errorepc == %0*lx\n", field, read_c0_errorepc());
+6 -1
arch/mips/loongson64/common/env.c
··· 105 105 loongson_chiptemp[1] = 0x900010001fe0019c; 106 106 loongson_chiptemp[2] = 0x900020001fe0019c; 107 107 loongson_chiptemp[3] = 0x900030001fe0019c; 108 + loongson_freqctrl[0] = 0x900000001fe001d0; 109 + loongson_freqctrl[1] = 0x900010001fe001d0; 110 + loongson_freqctrl[2] = 0x900020001fe001d0; 111 + loongson_freqctrl[3] = 0x900030001fe001d0; 108 112 loongson_sysconf.ht_control_base = 0x90000EFDFB000000; 109 113 loongson_sysconf.workarounds = WORKAROUND_CPUFREQ; 110 114 } else if (ecpu->cputype == Loongson_3B) { ··· 191 187 case PRID_REV_LOONGSON2F: 192 188 cpu_clock_freq = 797000000; 193 189 break; 194 - case PRID_REV_LOONGSON3A: 190 + case PRID_REV_LOONGSON3A_R1: 191 + case PRID_REV_LOONGSON3A_R2: 195 192 cpu_clock_freq = 900000000; 196 193 break; 197 194 case PRID_REV_LOONGSON3B_R1:
+97 -9
arch/mips/loongson64/loongson-3/smp.c
··· 439 439 * flush all L1 entries at first. Then, another core (usually Core 0) can 440 440 * safely disable the clock of the target core. loongson3_play_dead() is 441 441 * called via CKSEG1 (uncached and unmmaped) */ 442 - static void loongson3a_play_dead(int *state_addr) 442 + static void loongson3a_r1_play_dead(int *state_addr) 443 443 { 444 444 register int val; 445 445 register long cpuid, core, node, count; ··· 468 468 : [addr] "=&r" (addr), [val] "=&r" (val) 469 469 : [state_addr] "r" (state_addr), 470 470 [sets] "r" (cpu_data[smp_processor_id()].dcache.sets)); 471 + 472 + __asm__ __volatile__( 473 + " .set push \n" 474 + " .set noreorder \n" 475 + " .set mips64 \n" 476 + " mfc0 %[cpuid], $15, 1 \n" 477 + " andi %[cpuid], 0x3ff \n" 478 + " dli %[base], 0x900000003ff01000 \n" 479 + " andi %[core], %[cpuid], 0x3 \n" 480 + " sll %[core], 8 \n" /* get core id */ 481 + " or %[base], %[base], %[core] \n" 482 + " andi %[node], %[cpuid], 0xc \n" 483 + " dsll %[node], 42 \n" /* get node id */ 484 + " or %[base], %[base], %[node] \n" 485 + "1: li %[count], 0x100 \n" /* wait for init loop */ 486 + "2: bnez %[count], 2b \n" /* limit mailbox access */ 487 + " addiu %[count], -1 \n" 488 + " ld %[initfunc], 0x20(%[base]) \n" /* get PC via mailbox */ 489 + " beqz %[initfunc], 1b \n" 490 + " nop \n" 491 + " ld $sp, 0x28(%[base]) \n" /* get SP via mailbox */ 492 + " ld $gp, 0x30(%[base]) \n" /* get GP via mailbox */ 493 + " ld $a1, 0x38(%[base]) \n" 494 + " jr %[initfunc] \n" /* jump to initial PC */ 495 + " nop \n" 496 + " .set pop \n" 497 + : [core] "=&r" (core), [node] "=&r" (node), 498 + [base] "=&r" (base), [cpuid] "=&r" (cpuid), 499 + [count] "=&r" (count), [initfunc] "=&r" (initfunc) 500 + : /* No Input */ 501 + : "a1"); 502 + } 503 + 504 + static void loongson3a_r2_play_dead(int *state_addr) 505 + { 506 + register int val; 507 + register long cpuid, core, node, count; 508 + register void *addr, *base, *initfunc; 509 + 510 + __asm__ __volatile__( 511 + " .set push \n" 512 + " .set noreorder \n" 513 + " li %[addr], 0x80000000 \n" /* KSEG0 */ 514 + "1: cache 0, 0(%[addr]) \n" /* flush L1 ICache */ 515 + " cache 0, 1(%[addr]) \n" 516 + " cache 0, 2(%[addr]) \n" 517 + " cache 0, 3(%[addr]) \n" 518 + " cache 1, 0(%[addr]) \n" /* flush L1 DCache */ 519 + " cache 1, 1(%[addr]) \n" 520 + " cache 1, 2(%[addr]) \n" 521 + " cache 1, 3(%[addr]) \n" 522 + " addiu %[sets], %[sets], -1 \n" 523 + " bnez %[sets], 1b \n" 524 + " addiu %[addr], %[addr], 0x40 \n" 525 + " li %[addr], 0x80000000 \n" /* KSEG0 */ 526 + "2: cache 2, 0(%[addr]) \n" /* flush L1 VCache */ 527 + " cache 2, 1(%[addr]) \n" 528 + " cache 2, 2(%[addr]) \n" 529 + " cache 2, 3(%[addr]) \n" 530 + " cache 2, 4(%[addr]) \n" 531 + " cache 2, 5(%[addr]) \n" 532 + " cache 2, 6(%[addr]) \n" 533 + " cache 2, 7(%[addr]) \n" 534 + " cache 2, 8(%[addr]) \n" 535 + " cache 2, 9(%[addr]) \n" 536 + " cache 2, 10(%[addr]) \n" 537 + " cache 2, 11(%[addr]) \n" 538 + " cache 2, 12(%[addr]) \n" 539 + " cache 2, 13(%[addr]) \n" 540 + " cache 2, 14(%[addr]) \n" 541 + " cache 2, 15(%[addr]) \n" 542 + " addiu %[vsets], %[vsets], -1 \n" 543 + " bnez %[vsets], 2b \n" 544 + " addiu %[addr], %[addr], 0x40 \n" 545 + " li %[val], 0x7 \n" /* *state_addr = CPU_DEAD; */ 546 + " sw %[val], (%[state_addr]) \n" 547 + " sync \n" 548 + " cache 21, (%[state_addr]) \n" /* flush entry of *state_addr */ 549 + " .set pop \n" 550 + : [addr] "=&r" (addr), [val] "=&r" (val) 551 + : [state_addr] "r" (state_addr), 552 + [sets] "r" (cpu_data[smp_processor_id()].dcache.sets), 553 + [vsets] "r" (cpu_data[smp_processor_id()].vcache.sets)); 471 554 472 555 __asm__ __volatile__( 473 556 " .set push \n" ··· 655 572 void (*play_dead_at_ckseg1)(int *); 656 573 657 574 idle_task_exit(); 658 - switch (loongson_sysconf.cputype) { 659 - case Loongson_3A: 575 + switch (read_c0_prid() & PRID_REV_MASK) { 576 + case PRID_REV_LOONGSON3A_R1: 660 577 default: 661 578 play_dead_at_ckseg1 = 662 - (void *)CKSEG1ADDR((unsigned long)loongson3a_play_dead); 579 + (void *)CKSEG1ADDR((unsigned long)loongson3a_r1_play_dead); 663 580 break; 664 - case Loongson_3B: 581 + case PRID_REV_LOONGSON3A_R2: 582 + play_dead_at_ckseg1 = 583 + (void *)CKSEG1ADDR((unsigned long)loongson3a_r2_play_dead); 584 + break; 585 + case PRID_REV_LOONGSON3B_R1: 586 + case PRID_REV_LOONGSON3B_R2: 665 587 play_dead_at_ckseg1 = 666 588 (void *)CKSEG1ADDR((unsigned long)loongson3b_play_dead); 667 589 break; ··· 681 593 uint64_t core_id = cpu_data[cpu].core; 682 594 uint64_t package_id = cpu_data[cpu].package; 683 595 684 - if (loongson_sysconf.cputype == Loongson_3A) { 596 + if ((read_c0_prid() & PRID_REV_MASK) == PRID_REV_LOONGSON3A_R1) { 685 597 LOONGSON_CHIPCFG(package_id) &= ~(1 << (12 + core_id)); 686 - } else if (loongson_sysconf.cputype == Loongson_3B) { 598 + } else { 687 599 if (!(loongson_sysconf.workarounds & WORKAROUND_CPUHOTPLUG)) 688 600 LOONGSON_FREQCTRL(package_id) &= ~(1 << (core_id * 4 + 3)); 689 601 } ··· 694 606 uint64_t core_id = cpu_data[cpu].core; 695 607 uint64_t package_id = cpu_data[cpu].package; 696 608 697 - if (loongson_sysconf.cputype == Loongson_3A) { 609 + if ((read_c0_prid() & PRID_REV_MASK) == PRID_REV_LOONGSON3A_R1) { 698 610 LOONGSON_CHIPCFG(package_id) |= 1 << (12 + core_id); 699 - } else if (loongson_sysconf.cputype == Loongson_3B) { 611 + } else { 700 612 if (!(loongson_sysconf.workarounds & WORKAROUND_CPUHOTPLUG)) 701 613 LOONGSON_FREQCTRL(package_id) |= 1 << (core_id * 4 + 3); 702 614 }
+27
arch/mips/mm/c-r4k.c
··· 77 77 */ 78 78 static unsigned long icache_size __read_mostly; 79 79 static unsigned long dcache_size __read_mostly; 80 + static unsigned long vcache_size __read_mostly; 80 81 static unsigned long scache_size __read_mostly; 81 82 82 83 /* ··· 1350 1349 c->dcache.linesz); 1351 1350 } 1352 1351 1352 + static void probe_vcache(void) 1353 + { 1354 + struct cpuinfo_mips *c = &current_cpu_data; 1355 + unsigned int config2, lsize; 1356 + 1357 + if (current_cpu_type() != CPU_LOONGSON3) 1358 + return; 1359 + 1360 + config2 = read_c0_config2(); 1361 + if ((lsize = ((config2 >> 20) & 15))) 1362 + c->vcache.linesz = 2 << lsize; 1363 + else 1364 + c->vcache.linesz = lsize; 1365 + 1366 + c->vcache.sets = 64 << ((config2 >> 24) & 15); 1367 + c->vcache.ways = 1 + ((config2 >> 16) & 15); 1368 + 1369 + vcache_size = c->vcache.sets * c->vcache.ways * c->vcache.linesz; 1370 + 1371 + c->vcache.waybit = 0; 1372 + 1373 + pr_info("Unified victim cache %ldkB %s, linesize %d bytes.\n", 1374 + vcache_size >> 10, way_string[c->vcache.ways], c->vcache.linesz); 1375 + } 1376 + 1353 1377 /* 1354 1378 * If you even _breathe_ on this function, look at the gcc output and make sure 1355 1379 * it does not pop things on and off the stack for the cache sizing loop that ··· 1697 1671 struct cpuinfo_mips *c = &current_cpu_data; 1698 1672 1699 1673 probe_pcache(); 1674 + probe_vcache(); 1700 1675 setup_scache(); 1701 1676 1702 1677 r4k_blast_dcache_page_setup();
+2 -2
drivers/platform/mips/cpu_hwmon.c
··· 20 20 u32 reg; 21 21 22 22 reg = LOONGSON_CHIPTEMP(cpu); 23 - if (loongson_sysconf.cputype == Loongson_3A) 23 + if ((read_c0_prid() & PRID_REV_MASK) == PRID_REV_LOONGSON3A_R1) 24 24 reg = (reg >> 8) & 0xff; 25 - else if (loongson_sysconf.cputype == Loongson_3B) 25 + else 26 26 reg = ((reg >> 8) & 0xff) - 100; 27 27 28 28 return (int)reg * 1000;