Rev 1353 | Rev 1358 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1353 | Rev 1354 | ||
---|---|---|---|
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: 1353 $ |
24 | $Revision: 1354 $ |
25 | 25 | ||
26 | ;*************************************************************************** |
26 | ;*************************************************************************** |
27 | ; Function |
27 | ; Function |
Line 72... | Line 72... | ||
72 | cmp al,9 |
72 | cmp al,9 |
73 | jz pci_write_reg ;word |
73 | jz pci_write_reg ;word |
74 | cmp al,10 |
74 | cmp al,10 |
75 | jz pci_write_reg ;dword |
75 | jz pci_write_reg ;dword |
Line -... | Line 76... | ||
- | 76 | ||
76 | 77 | if defined mmio_pci_addr |
|
77 | cmp al,11 ; <<< user-level MMIO functions <<< NEW! |
78 | cmp al,11 ; <<< user-level MMIO functions <<< NEW! |
78 | jz pci_mmio_init |
79 | jz pci_mmio_init |
79 | cmp al,12 |
80 | cmp al,12 |
80 | jz pci_mmio_map |
81 | jz pci_mmio_map |
81 | cmp al,13 |
82 | cmp al,13 |
82 | jz pci_mmio_unmap |
83 | jz pci_mmio_unmap |
Line 83... | Line 84... | ||
83 | 84 | end if |
|
Line 84... | Line 85... | ||
84 | 85 | ||
Line 372... | Line 373... | ||
372 | pci_write_reg_err: |
373 | pci_write_reg_err: |
373 | xor eax,eax |
374 | xor eax,eax |
374 | dec eax |
375 | dec eax |
375 | ret |
376 | ret |
Line -... | Line 377... | ||
- | 377 | ||
376 | 378 | if defined mmio_pci_addr |
|
377 | ;*************************************************************************** |
379 | ;*************************************************************************** |
378 | ; Function |
380 | ; Function |
379 | ; pci_mmio_init ; NEW! |
381 | ; pci_mmio_init ; NEW! |
380 | ; |
382 | ; |
Line 384... | Line 386... | ||
384 | ; Error codes |
386 | ; Error codes |
385 | ; eax = -1 : PCI user access blocked, |
387 | ; eax = -1 : PCI user access blocked, |
386 | ; eax = -2 : device not registered for uMMIO service |
388 | ; eax = -2 : device not registered for uMMIO service |
387 | ; eax = -3 : user heap initialization failure |
389 | ; eax = -3 : user heap initialization failure |
388 | ;*************************************************************************** |
390 | ;*************************************************************************** |
389 | align 4 |
- | |
390 | pci_mmio_init: |
391 | pci_mmio_init: |
391 | cmp bx, word [mmio_pci_addr] ; must be set in kernel/data32.inc |
392 | cmp bx, mmio_pci_addr ; must be set in kernel/data32.inc |
392 | jz @f |
393 | jz @f |
393 | mov eax,-2 |
394 | mov eax,-2 |
394 | ret |
395 | ret |
395 | @@: |
396 | @@: |
396 | call init_heap ; (if not initialized yet) |
397 | call init_heap ; (if not initialized yet) |
Line 425... | Line 426... | ||
425 | ; eax = -3 : no i/o space on that BAR |
426 | ; eax = -3 : no i/o space on that BAR |
426 | ; eax = -4 : a port i/o BAR register referred |
427 | ; eax = -4 : a port i/o BAR register referred |
427 | ; eax = -5 : dynamic userspace allocation problem |
428 | ; eax = -5 : dynamic userspace allocation problem |
428 | ;*************************************************************************** |
429 | ;*************************************************************************** |
Line 429... | Line -... | ||
429 | - | ||
430 | align 4 |
430 | |
431 | pci_mmio_map: |
431 | pci_mmio_map: |
432 | and edx,0x0ffff |
432 | and edx,0x0ffff |
433 | cmp ah,6 |
433 | cmp ah,6 |
434 | jc .bar_0_5 |
434 | jc .bar_0_5 |
Line 444... | Line 444... | ||
444 | push ebx |
444 | push ebx |
445 | mov bl, ah ; bl = BAR# (0..5), however bl=8 for BAR6 |
445 | mov bl, ah ; bl = BAR# (0..5), however bl=8 for BAR6 |
446 | shl bl, 1 |
446 | shl bl, 1 |
447 | shl bl, 1 |
447 | shl bl, 1 |
448 | add bl, 0x10 ; now bl = BAR offset in PCI config. space |
448 | add bl, 0x10 ; now bl = BAR offset in PCI config. space |
449 | mov ax,word [mmio_pci_addr] |
449 | mov ax, mmio_pci_addr |
450 | mov bh, al ; bh = dddddfff |
450 | mov bh, al ; bh = dddddfff |
451 | mov al, 2 ; al : DW to read |
451 | mov al, 2 ; al : DW to read |
452 | call pci_read_reg |
452 | call pci_read_reg |
453 | or eax, eax |
453 | or eax, eax |
454 | jnz @f |
454 | jnz @f |
Line 502... | Line 502... | ||
502 | ; Error codes |
502 | ; Error codes |
503 | ; eax = -1 if no user PCI access allowed, |
503 | ; eax = -1 if no user PCI access allowed, |
504 | ; eax = 0 if unmapping failed |
504 | ; eax = 0 if unmapping failed |
505 | ;*************************************************************************** |
505 | ;*************************************************************************** |
Line 506... | Line -... | ||
506 | - | ||
507 | align 4 |
506 | |
508 | pci_mmio_unmap: |
507 | pci_mmio_unmap: |
509 | stdcall user_free, ebx |
508 | stdcall user_free, ebx |
Line -... | Line 509... | ||
- | 509 | ret |
|
Line 510... | Line 510... | ||
510 | ret |
510 | |
Line 511... | Line 511... | ||
511 | 511 | end if |
|
512 | 512 |