Subversion Repositories Kolibri OS

Rev

Rev 4265 | Rev 4423 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4265 Rev 4287
Line 34... Line 34...
34
        db      0x35, 'MX+'     ; id=5
34
        db      0x35, 'MX+'     ; id=5
35
        db      0x37, 'EX '     ; id=6
35
        db      0x37, 'EX '     ; id=6
36
Vortex86SoCnum = ($ - Vortex86SoClist) / 4      ; Calculate the total number of known Vortex86 CPUs (if id=Vortex86SoCnum+1 --> unknown SoC)
36
Vortex86SoCnum = ($ - Vortex86SoClist) / 4      ; Calculate the total number of known Vortex86 CPUs (if id=Vortex86SoCnum+1 --> unknown SoC)
37
endg
37
endg
Line -... Line 38...
-
 
38
 
-
 
39
; When in debug mode, perform SoC detection regardless of the actual CPU vendor (even for vendors other than DMP)
-
 
40
; When in normal (not debug) mode, check the CPU vendor first, and perform SoC detection only if vendor is 'Vortex86 SoC'
-
 
41
if ~ VORTEX86DEBUG        
-
 
42
        cmp     [cpu_vendor], 'Vort'
-
 
43
        jnz     .Vortex86end            ; If the CPU vendor is not 'Vortex86 SoC', skip the SoC detection
-
 
44
end if        
38
 
45
 
39
        mov     dx, 0xcf8               ; CF8h = Vortex86 PCI Configuration Address port
46
        mov     dx, 0xcf8               ; CF8h = Vortex86 PCI Configuration Address port
40
        mov     eax, 0x80000090         ; 0x80000090 = Starting PCI address to read from (32-bit register - accessed as DWORD)
47
        mov     eax, 0x80000090         ; 0x80000090 = Starting PCI address to read from (32-bit register - accessed as DWORD)
41
        out     dx, eax                 ; Send request to PCI address port to retrieve data from this address
48
        out     dx, eax                 ; Send request to PCI address port to retrieve data from this address
42
        mov     dx, 0xcfc               ; CFCh = Vortex86 PCI Configuration Data port
49
        mov     dx, 0xcfc               ; CFCh = Vortex86 PCI Configuration Data port
Line 43... Line -...
43
        in      eax, dx                 ; Read data (SoC type) from PCI data port
-
 
44
 
50
        in      eax, dx                 ; Read data (SoC type) from PCI data port
45
if VORTEX86DEBUG        
51
 
46
; // Used for debug purposes: testing in emulator and in non-Vortex86 CPU computers
52
if VORTEX86DEBUG                        ; When in debug mode, pretend that we received port output equal to "VORTEX86DEBUGVALUE"
Line 47... Line 53...
47
        mov     eax, VORTEX86DEBUGVALUE
53
        mov     eax, VORTEX86DEBUGVALUE
48
end if        
54
end if        
Line 53... Line 59...
53
        mov     [Vortex86CPUcode], eax
59
        mov     [Vortex86CPUcode], eax
54
        DEBUGF  1, "%x (%s): ", eax, Vortex86CPUcode
60
        DEBUGF  1, "%x (%s): ", eax, Vortex86CPUcode
55
        cmp     ax, 4d44h               ; Check whether it's Vortex86 family (all Vortex86 SoC have ID in form of "0xNN504d44")
61
        cmp     ax, 4d44h               ; Check whether it's Vortex86 family (all Vortex86 SoC have ID in form of "0xNN504d44")
56
        jnz     .notVortex86
62
        jnz     .notVortex86
57
        shr     eax, 16                 ; Discard lower word in EAX which is always 4d44h in Vortex86 family
63
        shr     eax, 16                 ; Discard lower word in EAX which is always 4d44h in Vortex86 family
58
        cmp     al, 50h                 ; The 3rd byte is always 50h in Vortex86 SoC
64
        cmp     al, 50h                 ; The 3rd byte is always 50h in Vortex86 SoC (if this is the case, we need just the highest byte)
59
        jnz     .notVortex86
65
        jnz     .notVortex86
60
        shr     ax, 8                   ; Discard 3rd byte in EAX, the highest byte determines the SoC type
-
 
61
        mov     bl, al                  ; Copy SoC type to BL since EAX (that contains AL) is used implicitly in "LODSD" command below
66
        mov     bl, ah                  ; Copy SoC type to BL since EAX (that includes AH) is used implicitly in "LODSD" command below
62
        mov     esi, Vortex86SoClist    ; ESI points to the start of Vortex86SoClist (used implicitly in "LODSD" command below)
67
        mov     esi, Vortex86SoClist    ; ESI points to the start of Vortex86SoClist (used implicitly in "LODSD" command below)
63
        xor     ecx, ecx                ; Zero ECX (it is used as counter)
68
        xor     ecx, ecx                ; Zero ECX (it is used as counter)
64
        cld                             ; Clears the DF flag in the EFLAGS register (DF=0 --> String operations increment ESI)
69
        cld                             ; Clears the DF flag in the EFLAGS register (DF=0 --> String operations increment ESI)
65
@@:
70
@@:
66
        cmp     ecx, Vortex86SoCnum     ; Check if we iterated Vortex86SoCnum times already (i.e. went over the entire Vortex86SoClist)
71
        cmp     ecx, Vortex86SoCnum     ; Check if we iterated Vortex86SoCnum times already (i.e. went over the entire Vortex86SoClist)
Line 81... Line 86...
81
        DEBUGF  1, "0 (NULL)\n"
86
        DEBUGF  1, "0 (NULL)\n"
82
        jmp     .Vortex86end
87
        jmp     .Vortex86end
Line 83... Line 88...
83
        
88
        
84
.unknownVortex86:
89
.unknownVortex86:
85
        mov     [Vortex86CPUid], cl                 ; Save the CPUid (Vortex86SoCnum+1=Unknown Vortex86)
90
        mov     [Vortex86CPUid], cl                 ; Save the CPUid (Vortex86SoCnum+1=Unknown Vortex86)
86
        DEBUGF  1, "unknown Vortex86 CPU (has id=%d, last known is %d)\n", [Vortex86CPUid]:1, Vortex86SoCnum
91
        DEBUGF  1, "unknown Vortex86 CPU (id=%d, last known is %d)\n", [Vortex86CPUid]:1, Vortex86SoCnum
Line 87... Line 92...
87
        jmp     .Vortex86end
92
        jmp     .Vortex86end
88
        
93