Rev 4294 | Rev 5363 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4294 | Rev 4310 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | 7 | ||
8 | ; 20/11/2013 yogev_ezra: Initial version (Vortex86 SoC type detection) |
8 | ; 20/11/2013 yogev_ezra: Initial version (Vortex86 SoC type detection) |
9 | ; 26/11/2013 yogev_ezra: Added CPU speed modifier and MMX support flag detection |
9 | ; 26/11/2013 yogev_ezra: Added CPU speed modifier and MMX support flag detection |
Line 10... | Line 10... | ||
10 | ; Thanks for help to: dunkaist, eAndrew, hidnplayr, Mario |
10 | ; Thanks for help to: dunkaist, eAndrew, hidnplayr, Mario |
Line 11... | Line 11... | ||
11 | 11 | ||
12 | $Revision: 4294 $ |
12 | $Revision: 4310 $ |
- | 13 | ||
- | 14 | VORTEX86DEBUG = 0 ; For testing in emulators and in non-Vortex86 CPU computers, set this to 1 |
|
Line 13... | Line 15... | ||
13 | 15 | VORTEX86DEBUGVALUE = 0x35504d44 ; FAKE port output = used for testing |
|
14 | VORTEX86DEBUG = 0 ; For testing in emulators and in non-Vortex86 CPU computers, set this to 1 |
16 | NORTH_BRIDGE = 0x80000000 ; Base address of Vortex86 PCI North Bridge |
15 | VORTEX86DEBUGVALUE = 0x35504d44 ; FAKE port output = used for testing |
17 | SOUTH_BRIDGE = 0x80003800 ; Base address of Vortex86 PCI South Bridge |
16 | 18 | ||
Line 42... | Line 44... | ||
42 | if ~ VORTEX86DEBUG |
44 | if ~ VORTEX86DEBUG |
43 | cmp [cpu_vendor], 'Vort' |
45 | cmp [cpu_vendor], 'Vort' |
44 | jnz .Vortex86end ; If the CPU vendor is not 'Vortex86 SoC', skip the SoC detection |
46 | jnz .Vortex86end ; If the CPU vendor is not 'Vortex86 SoC', skip the SoC detection |
45 | end if |
47 | end if |
Line 46... | Line 48... | ||
46 | 48 | ||
47 | mov eax, OS_BASE+0x90 ; 0x80000090 = Starting PCI address to read from (32-bit register - accessed as DWORD) |
49 | mov eax, NORTH_BRIDGE+0x90 ; 0x80000090 = PCI Configuration Address Register to read from (32-bit register - accessed as DWORD) |
Line 48... | Line 50... | ||
48 | call .Vortex86PCIreg ; Get the CPU code from Vortex86 SoC PCI register (Register Offset: 93H~90H) |
50 | call .Vortex86PCIreg ; Get the CPU code from Vortex86 SoC North Bridge PCI register (Register Offset: 93H~90H) |
49 | 51 | ||
50 | if VORTEX86DEBUG ; When in debug mode, pretend that we received port output equal to "VORTEX86DEBUGVALUE" |
52 | if VORTEX86DEBUG ; When in debug mode, pretend that we received port output equal to "VORTEX86DEBUGVALUE" |
Line 89... | Line 91... | ||
89 | 91 | ||
90 | .unknownVortex86: ; It is Vortex86 CPU, but it's not in the list above |
92 | .unknownVortex86: ; It is Vortex86 CPU, but it's not in the list above |
Line 91... | Line 93... | ||
91 | DEBUGF 1, "unknown Vortex86 CPU (id=%d)\n", [Vortex86CPUid]:1 ; Inform the user that the CPU is Vortex86 but name is unknown |
93 | DEBUGF 1, "unknown Vortex86 CPU (id=%d)\n", [Vortex86CPUid]:1 ; Inform the user that the CPU is Vortex86 but name is unknown |
- | 94 | ||
- | 95 | .Vortex86: |
|
- | 96 | mov eax, NORTH_BRIDGE+0x60 ; 0x80000060 = PCI Configuration Address Register to read from (32-bit register - accessed as DWORD) |
|
- | 97 | call .Vortex86PCIreg ; Get current flags of Vortex86SoC North Bridge STRAP Register (Register Offset: 63h~60h) |
|
- | 98 | DEBUGF 1, "K : Vortex86 STRAP Register (63h~60h) returned 0x%x\n",eax |
|
- | 99 | ||
- | 100 | mov eax, SOUTH_BRIDGE+0xC0 ; 0x800038C0 = PCI Configuration Address Register to read from (32-bit register - accessed as DWORD) |
|
- | 101 | call .Vortex86PCIreg ; Flags of Vortex86 South Bridge Internal Peripheral Feature Control Register (Register Offset: C3h~C0h) |
|
- | 102 | DEBUGF 1, "K : Vortex86 Internal Peripheral Feature Control Register (C3h~C0h) returned 0x%x\n",eax |
|
- | 103 | ||
- | 104 | mov eax, SOUTH_BRIDGE+0xCC ; 0x800038CC = PCI Configuration Address Register to read from (8-bit register - accessed as BYTE) |
|
- | 105 | call .Vortex86PCIreg ; Flags of Vortex86 South Bridge Internal Peripheral Feature Control Register III (Register Offset: CCh) |
|
92 | 106 | DEBUGF 1, "K : Vortex86 Internal Peripheral Feature Control Register III (CCh) returned 0x%x\n",al |
|
93 | .Vortex86: |
107 | |
94 | mov eax, OS_BASE+0xA0 ; 0x800000A0 = Starting PCI address to read from (32-bit register - accessed as DWORD) |
108 | mov eax, NORTH_BRIDGE+0xA0 ; 0x800000A0 = PCI Configuration Address Register to read from (32-bit register - accessed as DWORD) |
95 | call .Vortex86PCIreg ; Get current flags of Vortex86SoC Host Control Register (Register Offset: A3h~A0h) |
109 | call .Vortex86PCIreg ; Get current flags of Vortex86SoC North Bridge Host Control Register (Register Offset: A3h~A0h) |
96 | DEBUGF 1, "K : Vortex86 Host Control Register (A3h~A0h) returned 0x%x: CPU speed is ",eax |
110 | DEBUGF 1, "K : Vortex86 Host Control Register (A3h~A0h) returned 0x%x: CPU speed is ",eax |
97 | mov bl, al ; The lower byte of Vortex86 Host Control Register contains CPU speed modifier and MMX support status |
111 | mov bl, al ; The lower byte of Vortex86 Host Control Register contains CPU speed modifier and MMX support status |
98 | mov bh, al ; Backup the current AL value, so later we can test whether the value has changed |
112 | mov bh, al ; Backup the current AL value, so later we can test whether the value has changed |
99 | and bl, 00000111b ; CPU speed modifier is stored in bits 0-2. Value=0 means MAX speed, other values - speed reduction |
113 | and bl, 00000111b ; CPU speed modifier is stored in bits 0-2. Value=0 means MAX speed, other values - speed reduction |
100 | jz .Vortex86CPUspeedMAX ; 0s in bits 0-2: CPU is at MAX speed (no need to modify) |
114 | jz .Vortex86CPUspeedMAX ; 0s in bits 0-2: CPU is at MAX speed (no need to modify) |
101 | inc bl ; The actual value is 1 less than 'Divide by' setting (value '001' means 'Divide by 2', etc.) |
115 | inc ebx ; The actual value is 1 less than 'Divide by' setting (value '001' means 'Divide by 2', etc.) |
102 | DEBUGF 1, "reduced (divide by %d).\nK : Vortex86 changing CPU speed to ", bl ; Print the current CPU speed modifier to the log |
116 | DEBUGF 1, "reduced (divide by %d).\nK : Vortex86 changing CPU speed to ", bl ; Print the current CPU speed modifier to the log |
103 | and al, 11111000b ; At least one of the bits 0-2 contains 1: CPU is at reduced speed. Set bits 0-2 to 0s to change to MAX |
117 | and al, 11111000b ; At least one of the bits 0-2 contains 1: CPU is at reduced speed. Set bits 0-2 to 0s to change to MAX |