2 * Copyright (c) KATO Takenori, 1997, 1998.
4 * All rights reserved. Unpublished rights reserved under the copyright
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer as
13 * the first lines of this file unmodified.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include <sys/cdefs.h>
31 __FBSDID("$FreeBSD$");
35 #include <sys/param.h>
36 #include <sys/kernel.h>
37 #include <sys/systm.h>
38 #include <sys/sysctl.h>
40 #include <machine/cputypes.h>
41 #include <machine/md_var.h>
42 #include <machine/specialreg.h>
47 #if !defined(CPU_DISABLE_SSE) && defined(I686_CPU)
48 #define CPU_ENABLE_SSE
52 static void init_5x86(void);
53 static void init_bluelightning(void);
54 static void init_486dlc(void);
55 static void init_cy486dx(void);
56 #ifdef CPU_I486_ON_386
57 static void init_i486_on_386(void);
59 static void init_6x86(void);
62 #if defined(I586_CPU) && defined(CPU_WT_ALLOC)
63 static void enable_K5_wt_alloc(void);
64 static void enable_K6_wt_alloc(void);
65 static void enable_K6_2_wt_alloc(void);
69 static void init_6x86MX(void);
70 static void init_ppro(void);
71 static void init_mendocino(void);
74 static int hw_instruction_sse;
75 SYSCTL_INT(_hw, OID_AUTO, instruction_sse, CTLFLAG_RD,
76 &hw_instruction_sse, 0, "SIMD/MMX2 instructions available in CPU");
78 * -1: automatic (default)
79 * 0: keep enable CLFLUSH
80 * 1: force disable CLFLUSH
82 static int hw_clflush_disable = -1;
84 u_int cyrix_did; /* Device ID of Cyrix CPU */
91 init_bluelightning(void)
95 saveintr = intr_disable();
97 load_cr0(rcr0() | CR0_CD | CR0_NW);
100 #ifdef CPU_BLUELIGHTNING_FPU_OP_CACHE
101 wrmsr(0x1000, 0x9c92LL); /* FP operand can be cacheable on Cyrix FPU */
103 wrmsr(0x1000, 0x1c92LL); /* Intel FPU */
105 /* Enables 13MB and 0-640KB cache. */
106 wrmsr(0x1001, (0xd0LL << 32) | 0x3ff);
107 #ifdef CPU_BLUELIGHTNING_3X
108 wrmsr(0x1002, 0x04000000LL); /* Enables triple-clock mode. */
110 wrmsr(0x1002, 0x03000000LL); /* Enables double-clock mode. */
113 /* Enable caching in CR0. */
114 load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); /* CD = 0 and NW = 0 */
116 intr_restore(saveintr);
120 * Cyrix 486SLC/DLC/SR/DR series
128 saveintr = intr_disable();
131 ccr0 = read_cyrix_reg(CCR0);
132 #ifndef CYRIX_CACHE_WORKS
133 ccr0 |= CCR0_NC1 | CCR0_BARB;
134 write_cyrix_reg(CCR0, ccr0);
138 #ifndef CYRIX_CACHE_REALLY_WORKS
139 ccr0 |= CCR0_NC1 | CCR0_BARB;
143 #ifdef CPU_DIRECT_MAPPED_CACHE
144 ccr0 |= CCR0_CO; /* Direct mapped mode. */
146 write_cyrix_reg(CCR0, ccr0);
148 /* Clear non-cacheable region. */
149 write_cyrix_reg(NCR1+2, NCR_SIZE_0K);
150 write_cyrix_reg(NCR2+2, NCR_SIZE_0K);
151 write_cyrix_reg(NCR3+2, NCR_SIZE_0K);
152 write_cyrix_reg(NCR4+2, NCR_SIZE_0K);
154 write_cyrix_reg(0, 0); /* dummy write */
156 /* Enable caching in CR0. */
157 load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); /* CD = 0 and NW = 0 */
159 #endif /* !CYRIX_CACHE_WORKS */
160 intr_restore(saveintr);
165 * Cyrix 486S/DX series
173 saveintr = intr_disable();
176 ccr2 = read_cyrix_reg(CCR2);
178 ccr2 |= CCR2_SUSP_HLT;
181 write_cyrix_reg(CCR2, ccr2);
182 intr_restore(saveintr);
193 u_char ccr2, ccr3, ccr4, pcr0;
195 saveintr = intr_disable();
197 load_cr0(rcr0() | CR0_CD | CR0_NW);
200 (void)read_cyrix_reg(CCR3); /* dummy */
202 /* Initialize CCR2. */
203 ccr2 = read_cyrix_reg(CCR2);
206 ccr2 |= CCR2_SUSP_HLT;
208 ccr2 &= ~CCR2_SUSP_HLT;
211 write_cyrix_reg(CCR2, ccr2);
213 /* Initialize CCR4. */
214 ccr3 = read_cyrix_reg(CCR3);
215 write_cyrix_reg(CCR3, CCR3_MAPEN0);
217 ccr4 = read_cyrix_reg(CCR4);
220 #ifdef CPU_FASTER_5X86_FPU
221 ccr4 |= CCR4_FASTFPE;
223 ccr4 &= ~CCR4_FASTFPE;
225 ccr4 &= ~CCR4_IOMASK;
226 /********************************************************************
227 * WARNING: The "BIOS Writers Guide" mentions that I/O recovery time
228 * should be 0 for errata fix.
229 ********************************************************************/
231 ccr4 |= CPU_IORT & CCR4_IOMASK;
233 write_cyrix_reg(CCR4, ccr4);
235 /* Initialize PCR0. */
236 /****************************************************************
237 * WARNING: RSTK_EN and LOOP_EN could make your system unstable.
238 * BTB_EN might make your system unstable.
239 ****************************************************************/
240 pcr0 = read_cyrix_reg(PCR0);
257 /****************************************************************
258 * WARNING: if you use a memory mapped I/O device, don't use
259 * DISABLE_5X86_LSSER option, which may reorder memory mapped
261 * IF YOUR MOTHERBOARD HAS PCI BUS, DON'T DISABLE LSSER.
262 ****************************************************************/
263 #ifdef CPU_DISABLE_5X86_LSSER
268 write_cyrix_reg(PCR0, pcr0);
271 write_cyrix_reg(CCR3, ccr3);
273 (void)read_cyrix_reg(0x80); /* dummy */
275 /* Unlock NW bit in CR0. */
276 write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) & ~CCR2_LOCK_NW);
277 load_cr0((rcr0() & ~CR0_CD) | CR0_NW); /* CD = 0, NW = 1 */
278 /* Lock NW bit in CR0. */
279 write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_LOCK_NW);
281 intr_restore(saveintr);
284 #ifdef CPU_I486_ON_386
286 * There are i486 based upgrade products for i386 machines.
287 * In this case, BIOS doesn't enable CPU cache.
290 init_i486_on_386(void)
294 saveintr = intr_disable();
296 load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); /* CD = 0, NW = 0 */
298 intr_restore(saveintr);
305 * XXX - What should I do here? Please let me know.
313 saveintr = intr_disable();
315 load_cr0(rcr0() | CR0_CD | CR0_NW);
318 /* Initialize CCR0. */
319 write_cyrix_reg(CCR0, read_cyrix_reg(CCR0) | CCR0_NC1);
321 /* Initialize CCR1. */
322 #ifdef CPU_CYRIX_NO_LOCK
323 write_cyrix_reg(CCR1, read_cyrix_reg(CCR1) | CCR1_NO_LOCK);
325 write_cyrix_reg(CCR1, read_cyrix_reg(CCR1) & ~CCR1_NO_LOCK);
328 /* Initialize CCR2. */
330 write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_SUSP_HLT);
332 write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) & ~CCR2_SUSP_HLT);
335 ccr3 = read_cyrix_reg(CCR3);
336 write_cyrix_reg(CCR3, CCR3_MAPEN0);
338 /* Initialize CCR4. */
339 ccr4 = read_cyrix_reg(CCR4);
341 ccr4 &= ~CCR4_IOMASK;
343 write_cyrix_reg(CCR4, ccr4 | (CPU_IORT & CCR4_IOMASK));
345 write_cyrix_reg(CCR4, ccr4 | 7);
348 /* Initialize CCR5. */
350 write_cyrix_reg(CCR5, read_cyrix_reg(CCR5) | CCR5_WT_ALLOC);
354 write_cyrix_reg(CCR3, ccr3);
356 /* Unlock NW bit in CR0. */
357 write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) & ~CCR2_LOCK_NW);
360 * Earlier revision of the 6x86 CPU could crash the system if
361 * L1 cache is in write-back mode.
363 if ((cyrix_did & 0xff00) > 0x1600)
364 load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); /* CD = 0 and NW = 0 */
366 /* Revision 2.6 and lower. */
367 #ifdef CYRIX_CACHE_REALLY_WORKS
368 load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); /* CD = 0 and NW = 0 */
370 load_cr0((rcr0() & ~CR0_CD) | CR0_NW); /* CD = 0 and NW = 1 */
374 /* Lock NW bit in CR0. */
375 write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_LOCK_NW);
377 intr_restore(saveintr);
379 #endif /* I486_CPU */
390 * The CMPXCHG8B instruction is always available but hidden.
392 cpu_feature |= CPUID_CX8;
396 * IDT WinChip C6/2/2A/2B/3
398 * http://www.centtech.com/winchip_bios_writers_guide_v4_0.pdf
409 * Set ECX8, DSMC, DTLOCK/EDCTLB, EMMX, and ERETSTK and clear DPDC.
411 fcr |= (1 << 1) | (1 << 7) | (1 << 8) | (1 << 9) | (1 << 16);
412 fcr &= ~(1ULL << 11);
415 * Additionally, set EBRPRED, E2MMX and EAMD3D for WinChip 2 and 3.
417 if (CPUID_TO_MODEL(cpu_id) >= 8)
418 fcr |= (1 << 12) | (1 << 19) | (1 << 20);
422 cpu_feature = regs[3];
428 * Cyrix 6x86MX (code-named M2)
430 * XXX - What should I do here? Please let me know.
438 saveintr = intr_disable();
440 load_cr0(rcr0() | CR0_CD | CR0_NW);
443 /* Initialize CCR0. */
444 write_cyrix_reg(CCR0, read_cyrix_reg(CCR0) | CCR0_NC1);
446 /* Initialize CCR1. */
447 #ifdef CPU_CYRIX_NO_LOCK
448 write_cyrix_reg(CCR1, read_cyrix_reg(CCR1) | CCR1_NO_LOCK);
450 write_cyrix_reg(CCR1, read_cyrix_reg(CCR1) & ~CCR1_NO_LOCK);
453 /* Initialize CCR2. */
455 write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_SUSP_HLT);
457 write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) & ~CCR2_SUSP_HLT);
460 ccr3 = read_cyrix_reg(CCR3);
461 write_cyrix_reg(CCR3, CCR3_MAPEN0);
463 /* Initialize CCR4. */
464 ccr4 = read_cyrix_reg(CCR4);
465 ccr4 &= ~CCR4_IOMASK;
467 write_cyrix_reg(CCR4, ccr4 | (CPU_IORT & CCR4_IOMASK));
469 write_cyrix_reg(CCR4, ccr4 | 7);
472 /* Initialize CCR5. */
474 write_cyrix_reg(CCR5, read_cyrix_reg(CCR5) | CCR5_WT_ALLOC);
478 write_cyrix_reg(CCR3, ccr3);
480 /* Unlock NW bit in CR0. */
481 write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) & ~CCR2_LOCK_NW);
483 load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); /* CD = 0 and NW = 0 */
485 /* Lock NW bit in CR0. */
486 write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_LOCK_NW);
488 intr_restore(saveintr);
491 static int ppro_apic_used = -1;
499 * Local APIC should be disabled if it is not going to be used.
501 if (ppro_apic_used != 1) {
502 apicbase = rdmsr(MSR_APICBASE);
503 apicbase &= ~APICBASE_ENABLED;
504 wrmsr(MSR_APICBASE, apicbase);
510 * If the local APIC is going to be used after being disabled above,
511 * re-enable it and don't disable it in the future.
514 ppro_reenable_apic(void)
518 if (ppro_apic_used == 0) {
519 apicbase = rdmsr(MSR_APICBASE);
520 apicbase |= APICBASE_ENABLED;
521 wrmsr(MSR_APICBASE, apicbase);
527 * Initialize BBL_CR_CTL3 (Control register 3: used to configure the
533 #ifdef CPU_PPRO2CELERON
535 u_int64_t bbl_cr_ctl3;
537 saveintr = intr_disable();
539 load_cr0(rcr0() | CR0_CD | CR0_NW);
542 bbl_cr_ctl3 = rdmsr(MSR_BBL_CR_CTL3);
544 /* If the L2 cache is configured, do nothing. */
545 if (!(bbl_cr_ctl3 & 1)) {
546 bbl_cr_ctl3 = 0x134052bLL;
548 /* Set L2 Cache Latency (Default: 5). */
549 #ifdef CPU_CELERON_L2_LATENCY
550 #if CPU_L2_LATENCY > 15
551 #error invalid CPU_L2_LATENCY.
553 bbl_cr_ctl3 |= CPU_L2_LATENCY << 1;
555 bbl_cr_ctl3 |= 5 << 1;
557 wrmsr(MSR_BBL_CR_CTL3, bbl_cr_ctl3);
560 load_cr0(rcr0() & ~(CR0_CD | CR0_NW));
561 intr_restore(saveintr);
562 #endif /* CPU_PPRO2CELERON */
566 * Initialize special VIA features
575 * Explicitly enable CX8 and PGE on C3.
577 * http://www.via.com.tw/download/mainboards/6/13/VIA_C3_EBGA%20datasheet110.pdf
579 if (CPUID_TO_MODEL(cpu_id) <= 9)
580 fcr = (1 << 1) | (1 << 7);
585 * Check extended CPUID for PadLock features.
587 * http://www.via.com.tw/en/downloads/whitepapers/initiatives/padlock/programming_guide.pdf
589 do_cpuid(0xc0000000, regs);
590 if (regs[0] >= 0xc0000001) {
591 do_cpuid(0xc0000001, regs);
596 /* Enable RNG if present. */
597 if ((val & VIA_CPUID_HAS_RNG) != 0) {
598 via_feature_rng = VIA_HAS_RNG;
599 wrmsr(0x110B, rdmsr(0x110B) | VIA_CPUID_DO_RNG);
602 /* Enable PadLock if present. */
603 if ((val & VIA_CPUID_HAS_ACE) != 0)
604 via_feature_xcrypt |= VIA_HAS_AES;
605 if ((val & VIA_CPUID_HAS_ACE2) != 0)
606 via_feature_xcrypt |= VIA_HAS_AESCTR;
607 if ((val & VIA_CPUID_HAS_PHE) != 0)
608 via_feature_xcrypt |= VIA_HAS_SHA;
609 if ((val & VIA_CPUID_HAS_PMM) != 0)
610 via_feature_xcrypt |= VIA_HAS_MM;
611 if (via_feature_xcrypt != 0)
614 wrmsr(0x1107, rdmsr(0x1107) | fcr);
617 #endif /* I686_CPU */
619 #if defined(I586_CPU) || defined(I686_CPU)
625 /* Expose all hidden features. */
626 wrmsr(0x80860004, rdmsr(0x80860004) | ~0UL);
628 cpu_feature = regs[3];
632 extern int elf32_nxstack;
641 init_bluelightning();
652 #ifdef CPU_I486_ON_386
660 #endif /* I486_CPU */
663 switch (cpu_vendor_id) {
666 if (((cpu_id & 0x0f0) > 0) &&
667 ((cpu_id & 0x0f0) < 0x60) &&
668 ((cpu_id & 0x00f) > 3))
669 enable_K5_wt_alloc();
670 else if (((cpu_id & 0x0f0) > 0x80) ||
671 (((cpu_id & 0x0f0) == 0x80) &&
672 (cpu_id & 0x00f) > 0x07))
673 enable_K6_2_wt_alloc();
674 else if ((cpu_id & 0x0f0) > 0x50)
675 enable_K6_wt_alloc();
677 if ((cpu_id & 0xf0) == 0xa0)
679 * Make sure the TSC runs through
680 * suspension, otherwise we can't use
683 wrmsr(0x1900, rdmsr(0x1900) | 0x20ULL);
685 case CPU_VENDOR_CENTAUR:
688 case CPU_VENDOR_TRANSMETA:
691 case CPU_VENDOR_RISE:
702 switch (cpu_vendor_id) {
703 case CPU_VENDOR_INTEL:
704 switch (cpu_id & 0xff0) {
713 #ifdef CPU_ATHLON_SSE_HACK
716 * Sometimes the BIOS doesn't enable SSE instructions.
717 * According to AMD document 20734, the mobile
718 * Duron, the (mobile) Athlon 4 and the Athlon MP
719 * support SSE. These correspond to cpu_id 0x66X
722 if ((cpu_feature & CPUID_XMM) == 0 &&
723 ((cpu_id & ~0xf) == 0x660 ||
724 (cpu_id & ~0xf) == 0x670 ||
725 (cpu_id & ~0xf) == 0x680)) {
727 wrmsr(MSR_HWCR, rdmsr(MSR_HWCR) & ~0x08000);
729 cpu_feature = regs[3];
733 case CPU_VENDOR_CENTAUR:
736 case CPU_VENDOR_TRANSMETA:
745 #if defined(CPU_ENABLE_SSE)
746 if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) {
747 load_cr4(rcr4() | CR4_FXSR | CR4_XMM);
748 cpu_fxsr = hw_instruction_sse = 1;
751 #if defined(PAE) || defined(PAE_TABLES)
752 if ((amd_feature & AMDID_NX) != 0) {
755 msr = rdmsr(MSR_EFER) | EFER_NXE;
756 wrmsr(MSR_EFER, msr);
764 initializecpucache(void)
768 * CPUID with %eax = 1, %ebx returns
769 * Bits 15-8: CLFLUSH line size
770 * (Value * 8 = cache line size in bytes)
772 if ((cpu_feature & CPUID_CLFSH) != 0)
773 cpu_clflush_line_size = ((cpu_procinfo >> 8) & 0xff) * 8;
775 * XXXKIB: (temporary) hack to work around traps generated
776 * when CLFLUSHing APIC register window under virtualization
777 * environments. These environments tend to disable the
778 * CPUID_SS feature even though the native CPU supports it.
780 TUNABLE_INT_FETCH("hw.clflush_disable", &hw_clflush_disable);
781 if (vm_guest != VM_GUEST_NO && hw_clflush_disable == -1) {
782 cpu_feature &= ~CPUID_CLFSH;
783 cpu_stdext_feature &= ~CPUID_STDEXT_CLFLUSHOPT;
786 * The kernel's use of CLFLUSH{,OPT} can be disabled manually
787 * by setting the hw.clflush_disable tunable.
789 if (hw_clflush_disable == 1) {
790 cpu_feature &= ~CPUID_CLFSH;
791 cpu_stdext_feature &= ~CPUID_STDEXT_CLFLUSHOPT;
795 #if defined(I586_CPU) && defined(CPU_WT_ALLOC)
797 * Enable write allocate feature of AMD processors.
798 * Following two functions require the Maxmem variable being set.
801 enable_K5_wt_alloc(void)
807 * Write allocate is supported only on models 1, 2, and 3, with
808 * a stepping of 4 or greater.
810 if (((cpu_id & 0xf0) > 0) && ((cpu_id & 0x0f) > 3)) {
811 saveintr = intr_disable();
812 msr = rdmsr(0x83); /* HWCR */
813 wrmsr(0x83, msr & !(0x10));
816 * We have to tell the chip where the top of memory is,
817 * since video cards could have frame bufferes there,
818 * memory-mapped I/O could be there, etc.
824 msr |= AMD_WT_ALLOC_TME | AMD_WT_ALLOC_FRE;
827 * There is no way to know wheter 15-16M hole exists or not.
828 * Therefore, we disable write allocate for this range.
830 wrmsr(0x86, 0x0ff00f0);
831 msr |= AMD_WT_ALLOC_PRE;
835 wrmsr(0x83, msr|0x10); /* enable write allocate */
836 intr_restore(saveintr);
841 enable_K6_wt_alloc(void)
847 saveintr = intr_disable();
850 #ifdef CPU_DISABLE_CACHE
852 * Certain K6-2 box becomes unstable when write allocation is
856 * The AMD-K6 processer provides the 64-bit Test Register 12(TR12),
857 * but only the Cache Inhibit(CI) (bit 3 of TR12) is suppported.
858 * All other bits in TR12 have no effect on the processer's operation.
859 * The I/O Trap Restart function (bit 9 of TR12) is always enabled
862 wrmsr(0x0000000e, (u_int64_t)0x0008);
864 /* Don't assume that memory size is aligned with 4M. */
866 size = ((Maxmem >> 8) + 3) >> 2;
870 /* Limit is 508M bytes. */
873 whcr = (rdmsr(0xc0000082) & ~(0x7fLL << 1)) | (size << 1);
875 #if defined(NO_MEMORY_HOLE)
876 if (whcr & (0x7fLL << 1))
880 * There is no way to know wheter 15-16M hole exists or not.
881 * Therefore, we disable write allocate for this range.
885 wrmsr(0x0c0000082, whcr);
887 intr_restore(saveintr);
891 enable_K6_2_wt_alloc(void)
897 saveintr = intr_disable();
900 #ifdef CPU_DISABLE_CACHE
902 * Certain K6-2 box becomes unstable when write allocation is
906 * The AMD-K6 processer provides the 64-bit Test Register 12(TR12),
907 * but only the Cache Inhibit(CI) (bit 3 of TR12) is suppported.
908 * All other bits in TR12 have no effect on the processer's operation.
909 * The I/O Trap Restart function (bit 9 of TR12) is always enabled
912 wrmsr(0x0000000e, (u_int64_t)0x0008);
914 /* Don't assume that memory size is aligned with 4M. */
916 size = ((Maxmem >> 8) + 3) >> 2;
920 /* Limit is 4092M bytes. */
923 whcr = (rdmsr(0xc0000082) & ~(0x3ffLL << 22)) | (size << 22);
925 #if defined(NO_MEMORY_HOLE)
926 if (whcr & (0x3ffLL << 22))
930 * There is no way to know wheter 15-16M hole exists or not.
931 * Therefore, we disable write allocate for this range.
933 whcr &= ~(1LL << 16);
935 wrmsr(0x0c0000082, whcr);
937 intr_restore(saveintr);
939 #endif /* I585_CPU && CPU_WT_ALLOC */
945 DB_SHOW_COMMAND(cyrixreg, cyrixreg)
949 u_char ccr1, ccr2, ccr3;
950 u_char ccr0 = 0, ccr4 = 0, ccr5 = 0, pcr0 = 0;
953 if (cpu_vendor_id == CPU_VENDOR_CYRIX) {
954 saveintr = intr_disable();
957 if ((cpu != CPU_M1SC) && (cpu != CPU_CY486DX)) {
958 ccr0 = read_cyrix_reg(CCR0);
960 ccr1 = read_cyrix_reg(CCR1);
961 ccr2 = read_cyrix_reg(CCR2);
962 ccr3 = read_cyrix_reg(CCR3);
963 if ((cpu == CPU_M1SC) || (cpu == CPU_M1) || (cpu == CPU_M2)) {
964 write_cyrix_reg(CCR3, CCR3_MAPEN0);
965 ccr4 = read_cyrix_reg(CCR4);
966 if ((cpu == CPU_M1) || (cpu == CPU_M2))
967 ccr5 = read_cyrix_reg(CCR5);
969 pcr0 = read_cyrix_reg(PCR0);
970 write_cyrix_reg(CCR3, ccr3); /* Restore CCR3. */
972 intr_restore(saveintr);
974 if ((cpu != CPU_M1SC) && (cpu != CPU_CY486DX))
975 printf("CCR0=%x, ", (u_int)ccr0);
977 printf("CCR1=%x, CCR2=%x, CCR3=%x",
978 (u_int)ccr1, (u_int)ccr2, (u_int)ccr3);
979 if ((cpu == CPU_M1SC) || (cpu == CPU_M1) || (cpu == CPU_M2)) {
980 printf(", CCR4=%x, ", (u_int)ccr4);
982 printf("PCR0=%x\n", pcr0);
984 printf("CCR5=%x\n", ccr5);
987 printf("CR0=%x\n", cr0);