Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5544 → Rev 5543

/drivers/unfinished/agp.asm
88,39 → 88,51
 
align 4
proc detect
locals
last_bus dd ?
endl
 
mov esi, msgSearch
invoke SysMsgBoardStr
 
invoke GetPCIList
mov edx, eax
xor eax, eax
mov [bus], eax
inc eax
invoke PciApi ; get last bus
cmp eax, -1
je .error
mov [last_bus], eax
 
.loop:
mov ebx, [eax + PCIDEV.class]
cmp bx, 0x0300 ; display controller - vga compatible controller
.next_bus:
and [devfn], 0
.next_dev:
invoke PciRead16, [bus], [devfn], PCI_header.subclass ; subclass/vendor
cmp ax, 0x0300 ; display controller - vga compatable controller
je .found
cmp bx, 0x0302 ; display controller - 3d controller
cmp ax, 0x0302 ; display controller - 3d controller
je .found
cmp bx, 0x0380 ; display controller - other display controller
cmp ax, 0x0380 ; display controller - other display controller
je .found
 
.next:
mov eax, [eax + PCIDEV.fd]
cmp eax, edx
jne .loop
inc [devfn]
cmp [devfn], 256
jb .next_dev
mov eax, [bus]
inc eax
mov [bus], eax
cmp eax, [last_bus]
jna .next_bus
 
mov esi, msgDone
.error:
mov esi, msgFail
invoke SysMsgBoardStr
 
or eax, -1
xor eax, eax
inc eax
ret
 
.found:
push eax edx
movzx ebx, [eax + PCIDEV.bus]
mov [bus], ebx
movzx ebx, [eax + PCIDEV.devfn]
mov [devfn], ebx
invoke PciRead8, [bus], [devfn], PCI_header00.prog_if
test al, 1 shl 4 ; got capabilities list?
jnz .got_capabilities_list
128,7 → 140,6
; TODO: Do it the old way: detect device and check with a list of known capabilities
; stupid pre PCI 2.2 board....
 
pop edx eax
jmp .next
 
.got_capabilities_list:
165,10 → 176,8
test al, 10b
jnz .010b
test al, 1b
jz .error
 
pop edx eax
jz .next
 
.001b:
mov [cmd], 001b
mov esi, msg1
238,8 → 247,7
mov esi, msgOK
invoke SysMsgBoardStr
 
pop edx eax
jmp .next
ret
 
endp
 
255,7 → 263,7
 
msgInit db 'AGP driver loaded.', 13, 10, 0
msgSearch db 'Searching for AGP card...', 13, 10, 0
msgDone db 'Done', 13, 10, 0
msgFail db 'device not found', 13, 10, 0
msgOK db 'AGP device enabled', 13, 10, 0
msgAGP2 db 'AGP2 device found', 13, 10, 0
msgAGP3 db 'AGP3 device found', 13, 10, 0