Subversion Repositories Kolibri OS

Rev

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

Rev 5363 Rev 5544
Line 86... Line 86...
86
 
86
 
Line 87... Line 87...
87
endp
87
endp
88
 
88
 
89
align 4
-
 
90
proc detect
-
 
91
           locals
-
 
Line 92... Line 89...
92
            last_bus dd ?
89
align 4
93
           endl
90
proc detect
Line 94... Line 91...
94
 
91
 
95
        mov     esi, msgSearch
92
        mov     esi, msgSearch
96
        invoke  SysMsgBoardStr
-
 
97
 
-
 
98
        xor     eax, eax
-
 
99
        mov     [bus], eax
-
 
100
        inc     eax
-
 
101
        invoke  PciApi          ; get last bus
93
        invoke  SysMsgBoardStr
102
        cmp     eax, -1
94
 
103
        je      .error
95
        invoke  GetPCIList
104
        mov     [last_bus], eax
-
 
105
 
-
 
106
  .next_bus:
96
        mov     edx, eax
107
        and     [devfn], 0
97
 
108
  .next_dev:
98
  .loop:
109
        invoke  PciRead16, [bus], [devfn], PCI_header.subclass  ; subclass/vendor
99
        mov     ebx, [eax + PCIDEV.class]
110
        cmp     ax, 0x0300      ; display controller - vga compatable controller
100
        cmp     bx, 0x0300      ; display controller - vga compatible controller
111
        je      .found
101
        je      .found
Line 112... Line 102...
112
        cmp     ax, 0x0302      ; display controller - 3d controller
102
        cmp     bx, 0x0302      ; display controller - 3d controller
113
        je      .found
-
 
114
        cmp     ax, 0x0380      ; display controller - other display controller
-
 
115
        je      .found
-
 
116
 
103
        je      .found
117
  .next:
-
 
118
        inc     [devfn]
104
        cmp     bx, 0x0380      ; display controller - other display controller
119
        cmp     [devfn], 256
-
 
120
        jb      .next_dev
105
        je      .found
Line 121... Line -...
121
        mov     eax, [bus]
-
 
122
        inc     eax
106
 
123
        mov     [bus], eax
107
  .next:
Line 124... Line 108...
124
        cmp     eax, [last_bus]
108
        mov     eax, [eax + PCIDEV.fd]
125
        jna     .next_bus
-
 
126
 
109
        cmp     eax, edx
Line 127... Line 110...
127
  .error:
110
        jne     .loop
-
 
111
 
-
 
112
        mov     esi, msgDone
-
 
113
        invoke  SysMsgBoardStr
-
 
114
 
-
 
115
        or      eax, -1
128
        mov     esi, msgFail
116
        ret
129
        invoke  SysMsgBoardStr
117
 
130
 
118
  .found:
Line 131... Line 119...
131
        xor     eax, eax
119
        push    eax edx
132
        inc     eax
120
        movzx   ebx, [eax + PCIDEV.bus]
Line -... Line 121...
-
 
121
        mov     [bus], ebx
133
        ret
122
        movzx   ebx, [eax + PCIDEV.devfn]
Line 134... Line 123...
134
 
123
        mov     [devfn], ebx
135
  .found:
124
        invoke  PciRead8, [bus], [devfn], PCI_header00.prog_if
136
        invoke  PciRead8, [bus], [devfn], PCI_header00.prog_if
125
        test    al, 1 shl 4                             ; got capabilities list?
Line 174... Line 163...
174
        test    al, 100b
163
        test    al, 100b
175
        jnz     .100b
164
        jnz     .100b
176
        test    al, 10b
165
        test    al, 10b
177
        jnz     .010b
166
        jnz     .010b
178
        test    al, 1b
167
        test    al, 1b
-
 
168
 
-
 
169
        pop     edx eax
179
        jz      .error
170
        jz      .next
Line 180... Line 171...
180
 
171
 
181
  .001b:
172
  .001b:
182
        mov     [cmd], 001b
173
        mov     [cmd], 001b
183
        mov     esi, msg1
174
        mov     esi, msg1
Line 245... Line 236...
245
        invoke  PciWrite32, [bus], [devfn], edi, eax    ; write AGP cmd
236
        invoke  PciWrite32, [bus], [devfn], edi, eax    ; write AGP cmd
Line 246... Line 237...
246
 
237
 
247
        mov     esi, msgOK
238
        mov     esi, msgOK
Line -... Line 239...
-
 
239
        invoke  SysMsgBoardStr
248
        invoke  SysMsgBoardStr
240
 
Line 249... Line 241...
249
 
241
        pop     edx eax
Line 250... Line 242...
250
        ret
242
        jmp     .next
Line 261... Line 253...
261
 
253
 
Line 262... Line 254...
262
my_service      db 'AGP', 0                             ; max 16 chars include zero
254
my_service      db 'AGP', 0                             ; max 16 chars include zero
263
 
255
 
264
msgInit         db 'AGP driver loaded.', 13, 10, 0
256
msgInit         db 'AGP driver loaded.', 13, 10, 0
265
msgSearch       db 'Searching for AGP card...', 13, 10, 0
257
msgSearch       db 'Searching for AGP card...', 13, 10, 0
266
msgFail         db 'device not found', 13, 10, 0
258
msgDone         db 'Done', 13, 10, 0
267
msgOK           db 'AGP device enabled', 13, 10, 0
259
msgOK           db 'AGP device enabled', 13, 10, 0
268
msgAGP2         db 'AGP2 device found', 13, 10, 0
260
msgAGP2         db 'AGP2 device found', 13, 10, 0
269
msgAGP3         db 'AGP3 device found', 13, 10, 0
261
msgAGP3         db 'AGP3 device found', 13, 10, 0