Use PCI list instead of manually re-scanning PCI bus.

git-svn-id: svn://kolibrios.org@5173 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2014-11-05 17:45:10 +00:00
parent a91af11f0f
commit 4ef97c812c

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -200,54 +200,27 @@ locals
devfn dd ? devfn dd ?
endl endl
xor eax, eax invoke GetPCIList
mov [bus], eax mov edx, eax
inc eax
invoke PciApi
cmp eax, -1
je .no_pci
mov [last_bus], eax
.next_bus:
and [devfn], 0
.next_dev:
invoke PciRead32, [bus], [devfn], PCI_header.vendor_id
test eax, eax
jz .next
cmp eax, -1
je .next
.loop:
mov ecx, [eax + PCIDEV.vendor_device_id]
mov edi, devices mov edi, devices
@@: @@:
mov ebx, [edi] mov ebx, [edi]
test ebx, ebx test ebx, ebx
jz .next jz .next
cmp eax, ebx cmp ecx, ebx
je .found je .found
add edi, 8 add edi, 8
jmp @B jmp @b
.next: .next:
test [devfn], 7 mov eax, [eax + PCIDEV.fd]
jnz .next_fn cmp eax, edx
invoke PciRead8, [bus], [devfn], PCI_header.header_type jne .loop
test al, al
js .next_fn
or [devfn], 7
.next_fn:
inc [devfn]
cmp [devfn], 256
jb .next_dev
mov eax, [bus]
inc eax
mov [bus], eax
cmp eax, [last_bus]
jna .next_bus
.no_pci:
if DEBUG if DEBUG
mov esi, msgFail mov esi, msgFail
invoke SysMsgBoardStr invoke SysMsgBoardStr