Subversion Repositories Kolibri OS

Rev

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

Rev 4453 Rev 4599
Line 19... Line 19...
19
;;                                                              ;;
19
;;                                                              ;;
20
;;  See file COPYING for details                                ;;
20
;;  See file COPYING for details                                ;;
21
;;                                                              ;;
21
;;                                                              ;;
22
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 23... Line 23...
23
 
23
 
Line 24... Line 24...
24
$Revision: 4453 $
24
$Revision: 4599 $
25
 
25
 
26
;***************************************************************************
26
;***************************************************************************
27
;   Function
27
;   Function
Line 163... Line 163...
163
        mov     esi, eax ; save register size into ESI
163
        mov     esi, eax ; save register size into ESI
164
        and     esi, 3
164
        and     esi, 3
Line 165... Line 165...
165
 
165
 
166
        call    pci_make_config_cmd
166
        call    pci_make_config_cmd
167
        mov     ebx, eax
-
 
168
                ; get current state
167
        mov     ebx, eax
169
        mov     dx, 0xcf8
-
 
170
        in      eax, dx
-
 
171
        push    eax
168
        mov     dx, 0xcf8
172
                ; set up addressing to config data
169
                ; set up addressing to config data
173
        mov     eax, ebx
170
        mov     eax, ebx
174
        and     al, 0xfc; make address dword-aligned
171
        and     al, 0xfc; make address dword-aligned
175
        out     dx, eax
172
        out     dx, eax
Line 192... Line 189...
192
pci_read_word1:
189
pci_read_word1:
193
        in      ax, dx
190
        in      ax, dx
194
        jmp     pci_fin_read1
191
        jmp     pci_fin_read1
195
pci_read_dword1:
192
pci_read_dword1:
196
        in      eax, dx
193
        in      eax, dx
197
        jmp     pci_fin_read1
-
 
198
pci_fin_read1:
194
pci_fin_read1:
199
                ; restore configuration control
-
 
200
        xchg    eax, [esp]
-
 
201
        mov     dx, 0xcf8
-
 
202
        out     dx, eax
-
 
203
 
-
 
204
        pop     eax
-
 
205
        pop     esi ebx
195
        pop     esi ebx
206
        ret
196
        ret
207
pci_read_reg_2:
197
pci_read_reg_2:
Line 208... Line 198...
208
 
198
 
209
        test    bh, 128 ;mech#2 only supports 16 devices per bus
199
        test    bh, 128 ;mech#2 only supports 16 devices per bus
Line 210... Line 200...
210
        jnz     pci_read_reg_err
200
        jnz     pci_read_reg_err
211
 
201
 
Line 212... Line -...
212
        mov     esi, eax ; save register size into ESI
-
 
213
        and     esi, 3
-
 
214
 
202
        mov     esi, eax ; save register size into ESI
215
        push    eax
-
 
216
                ;store current state of config space
-
 
217
        mov     dx, 0xcf8
-
 
218
        in      al, dx
-
 
Line 219... Line -...
219
        mov     ah, al
-
 
220
        mov     dl, 0xfa
203
        and     esi, 3
221
        in      al, dx
204
 
222
 
205
        mov     dx, 0xcfa
223
        xchg    eax, [esp]
206
 
224
                ; out 0xcfa,bus
207
                ; out 0xcfa,bus
Line 247... Line 230...
247
pci_read_word2:
230
pci_read_word2:
248
        in      ax, dx
231
        in      ax, dx
249
        jmp     pci_fin_read2
232
        jmp     pci_fin_read2
250
pci_read_dword2:
233
pci_read_dword2:
251
        in      eax, dx
234
        in      eax, dx
252
;       jmp pci_fin_read2
-
 
253
pci_fin_read2:
235
pci_fin_read2:
Line 254... Line -...
254
 
-
 
255
                ; restore configuration space
-
 
256
        xchg    eax, [esp]
-
 
257
        mov     dx, 0xcfa
-
 
258
        out     dx, al
-
 
259
        mov     dl, 0xf8
-
 
260
        mov     al, ah
-
 
261
        out     dx, al
-
 
262
 
-
 
263
        pop     eax
236
 
264
        pop     esi ebx
237
        pop     esi ebx
Line 265... Line 238...
265
        ret
238
        ret
266
 
239
 
Line 294... Line 267...
294
        mov     esi, eax ; save register size into ESI
267
        mov     esi, eax ; save register size into ESI
295
        and     esi, 3
268
        and     esi, 3
Line 296... Line 269...
296
 
269
 
297
        call    pci_make_config_cmd
270
        call    pci_make_config_cmd
298
        mov     ebx, eax
-
 
299
                ; get current state into ecx
271
        mov     ebx, eax
300
        mov     dx, 0xcf8
-
 
301
        in      eax, dx
-
 
302
        push    eax
272
        mov     dx, 0xcf8
303
                ; set up addressing to config data
273
                ; set up addressing to config data
304
        mov     eax, ebx
274
        mov     eax, ebx
305
        and     al, 0xfc; make address dword-aligned
275
        and     al, 0xfc; make address dword-aligned
306
        out     dx, eax
276
        out     dx, eax
Line 324... Line 294...
324
pci_write_word1:
294
pci_write_word1:
325
        out     dx, ax
295
        out     dx, ax
326
        jmp     pci_fin_write1
296
        jmp     pci_fin_write1
327
pci_write_dword1:
297
pci_write_dword1:
328
        out     dx, eax
298
        out     dx, eax
329
        jmp     pci_fin_write1
-
 
330
pci_fin_write1:
299
pci_fin_write1:
Line 331... Line -...
331
 
-
 
332
                ; restore configuration control
-
 
333
        pop     eax
-
 
334
        mov     dl, 0xf8
-
 
335
        out     dx, eax
-
 
336
 
300
 
337
        xor     eax, eax
301
        xor     eax, eax
Line 338... Line 302...
338
        pop     ebx esi
302
        pop     ebx esi
339
 
303
 
Line 345... Line 309...
345
 
309
 
346
 
310
 
Line 347... Line -...
347
        mov     esi, eax ; save register size into ESI
-
 
348
        and     esi, 3
-
 
349
 
311
        mov     esi, eax ; save register size into ESI
350
        push    eax
-
 
351
                ;store current state of config space
-
 
352
        mov     dx, 0xcf8
-
 
353
        in      al, dx
-
 
354
        mov     ah, al
-
 
355
        mov     dl, 0xfa
312
        and     esi, 3
356
        in      al, dx
313
 
357
        xchg    eax, [esp]
314
        mov     dx, 0xcfa
358
                ; out 0xcfa,bus
315
                ; out 0xcfa,bus
359
        mov     al, ah
316
        mov     al, ah
Line 383... Line 340...
383
pci_write_word2:
340
pci_write_word2:
384
        out     dx, ax
341
        out     dx, ax
385
        jmp     pci_fin_write2
342
        jmp     pci_fin_write2
386
pci_write_dword2:
343
pci_write_dword2:
387
        out     dx, eax
344
        out     dx, eax
388
        jmp     pci_fin_write2
-
 
389
pci_fin_write2:
345
pci_fin_write2:
390
                ; restore configuration space
-
 
391
        pop     eax
-
 
392
        mov     dx, 0xcfa
-
 
393
        out     dx, al
-
 
394
        mov     dl, 0xf8
-
 
395
        mov     al, ah
-
 
396
        out     dx, al
-
 
Line 397... Line 346...
397
 
346
 
398
        xor     eax, eax
347
        xor     eax, eax
399
        pop     ebx esi
348
        pop     ebx esi