forked from KolibriOS/kolibrios
AGP driver: use PCI list from kernel.
git-svn-id: svn://kolibrios.org@5544 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
4094e1f523
commit
c1f96ec4d4
@ -88,51 +88,39 @@ endp
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc detect
|
proc detect
|
||||||
locals
|
|
||||||
last_bus dd ?
|
|
||||||
endl
|
|
||||||
|
|
||||||
mov esi, msgSearch
|
mov esi, msgSearch
|
||||||
invoke SysMsgBoardStr
|
invoke SysMsgBoardStr
|
||||||
|
|
||||||
xor eax, eax
|
invoke GetPCIList
|
||||||
mov [bus], eax
|
mov edx, eax
|
||||||
inc eax
|
|
||||||
invoke PciApi ; get last bus
|
|
||||||
cmp eax, -1
|
|
||||||
je .error
|
|
||||||
mov [last_bus], eax
|
|
||||||
|
|
||||||
.next_bus:
|
.loop:
|
||||||
and [devfn], 0
|
mov ebx, [eax + PCIDEV.class]
|
||||||
.next_dev:
|
cmp bx, 0x0300 ; display controller - vga compatible controller
|
||||||
invoke PciRead16, [bus], [devfn], PCI_header.subclass ; subclass/vendor
|
|
||||||
cmp ax, 0x0300 ; display controller - vga compatable controller
|
|
||||||
je .found
|
je .found
|
||||||
cmp ax, 0x0302 ; display controller - 3d controller
|
cmp bx, 0x0302 ; display controller - 3d controller
|
||||||
je .found
|
je .found
|
||||||
cmp ax, 0x0380 ; display controller - other display controller
|
cmp bx, 0x0380 ; display controller - other display controller
|
||||||
je .found
|
je .found
|
||||||
|
|
||||||
.next:
|
.next:
|
||||||
inc [devfn]
|
mov eax, [eax + PCIDEV.fd]
|
||||||
cmp [devfn], 256
|
cmp eax, edx
|
||||||
jb .next_dev
|
jne .loop
|
||||||
mov eax, [bus]
|
|
||||||
inc eax
|
|
||||||
mov [bus], eax
|
|
||||||
cmp eax, [last_bus]
|
|
||||||
jna .next_bus
|
|
||||||
|
|
||||||
.error:
|
mov esi, msgDone
|
||||||
mov esi, msgFail
|
|
||||||
invoke SysMsgBoardStr
|
invoke SysMsgBoardStr
|
||||||
|
|
||||||
xor eax, eax
|
or eax, -1
|
||||||
inc eax
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.found:
|
.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
|
invoke PciRead8, [bus], [devfn], PCI_header00.prog_if
|
||||||
test al, 1 shl 4 ; got capabilities list?
|
test al, 1 shl 4 ; got capabilities list?
|
||||||
jnz .got_capabilities_list
|
jnz .got_capabilities_list
|
||||||
@ -140,6 +128,7 @@ proc detect
|
|||||||
; TODO: Do it the old way: detect device and check with a list of known capabilities
|
; TODO: Do it the old way: detect device and check with a list of known capabilities
|
||||||
; stupid pre PCI 2.2 board....
|
; stupid pre PCI 2.2 board....
|
||||||
|
|
||||||
|
pop edx eax
|
||||||
jmp .next
|
jmp .next
|
||||||
|
|
||||||
.got_capabilities_list:
|
.got_capabilities_list:
|
||||||
@ -176,7 +165,9 @@ proc detect
|
|||||||
test al, 10b
|
test al, 10b
|
||||||
jnz .010b
|
jnz .010b
|
||||||
test al, 1b
|
test al, 1b
|
||||||
jz .error
|
|
||||||
|
pop edx eax
|
||||||
|
jz .next
|
||||||
|
|
||||||
.001b:
|
.001b:
|
||||||
mov [cmd], 001b
|
mov [cmd], 001b
|
||||||
@ -247,7 +238,8 @@ end if
|
|||||||
mov esi, msgOK
|
mov esi, msgOK
|
||||||
invoke SysMsgBoardStr
|
invoke SysMsgBoardStr
|
||||||
|
|
||||||
ret
|
pop edx eax
|
||||||
|
jmp .next
|
||||||
|
|
||||||
endp
|
endp
|
||||||
|
|
||||||
@ -263,7 +255,7 @@ my_service db 'AGP', 0 ; max 16 chars include z
|
|||||||
|
|
||||||
msgInit db 'AGP driver loaded.', 13, 10, 0
|
msgInit db 'AGP driver loaded.', 13, 10, 0
|
||||||
msgSearch db 'Searching for AGP card...', 13, 10, 0
|
msgSearch db 'Searching for AGP card...', 13, 10, 0
|
||||||
msgFail db 'device not found', 13, 10, 0
|
msgDone db 'Done', 13, 10, 0
|
||||||
msgOK db 'AGP device enabled', 13, 10, 0
|
msgOK db 'AGP device enabled', 13, 10, 0
|
||||||
msgAGP2 db 'AGP2 device found', 13, 10, 0
|
msgAGP2 db 'AGP2 device found', 13, 10, 0
|
||||||
msgAGP3 db 'AGP3 device found', 13, 10, 0
|
msgAGP3 db 'AGP3 device found', 13, 10, 0
|
||||||
|
Loading…
Reference in New Issue
Block a user