ff35d3b57074042d1eaf51d3147ecd9e2c532036
[coreboot.git] / src / cpu / amd / model_gx2 / cpu_setup.inc
1 /*
2     freebios/src/northbridge/nsc/gx1/cpu_setup.inc
3
4     Copyright (c) 2002 Christer Weinigel <wingel@hack.org>
5
6     Initialize the GX1 CPU configuration registers
7 */
8
9 /* copied for gx2 for ron minnich, as a placeholder */
10
11 /* USES: esi, ecx, eax */
12
13 #include <cpu/amd/gx2def.h>
14
15         movl %eax, %ebp /* preserve bist */
16
17 cpu_setup_start:
18         leal    cpu_setup_table, %esi
19         movl    $cpu_setup_len, %ecx
20
21 cpu_setup_loop:
22         movw    (%esi), %ax
23         addl    $2, %esi
24         outb    %al, $0x22
25         movb    %ah, %al
26         outb    %al, $0x23
27         loop    cpu_setup_loop
28
29         movb    $0xff, %al              /* DIR1 -- Identification Register 1 */
30         outb    %al, $0x22
31         inb     $0x23, %al
32         cmpb    $0x63, %al              /* Revision for GXLV rev 3 */
33         jbe     cpu_no_ccr4
34
35         movb    $0xe8, %al              /* CCR4 */
36         outb    %al, $0x22
37         inb     $0x23, %al
38         orb     $0x20, %al              /* Enable FPU Fast Mode */
39         outb    %al, $0x23
40
41         movb    $0xf0, %al              /* PCR1 --- Performace Control  */
42         outb    %al, $0x22
43         inb     $0x23, %al
44         orb     $0x02, %al              /* Incrementor on, whatever that is */
45         outb    %al, $0x23
46
47         movb    $0x20, %al              /* PCR0 --- Performace Control  */
48         outb    %al, $0x22
49         inb     $0x23, %al
50         orb     $0x20, %al              /* Must be 1 according to data book */
51         orb     $0x04, %al              /* Incrementor Margin 10 */
52         outb    %al, $0x23
53 cpu_no_ccr4:
54
55         jmp     cpu_setup_end
56
57 cpu_setup_table:
58         .byte   0xc1, 0x00              /* NO SMIs */
59         .byte   0xc3, 0x14              /* Enable CPU config register */
60         .byte   0x20, 0x00
61         .byte   0xb8, GX_BASE>>30       /* Enable GXBASE address */
62         .byte   0xc2, 0x00
63         .byte   0xe8, 0x98
64         .byte   0xc3, 0xf8              /* Enable CPU config register */
65 cpu_setup_len = (.-cpu_setup_table)/2
66
67 cpu_setup_end:
68         nop
69
70         movl %ebp, %eax /* Restore bist */