Dont try to scan multiple functions on a single function device.

git-svn-id: svn://kolibrios.org@5172 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2014-11-05 16:11:45 +00:00
parent 3a4ecad384
commit a91af11f0f

View File

@ -121,17 +121,25 @@ proc detect
.next_bus: .next_bus:
and [devfn], 0 and [devfn], 0
.next_dev: .next_dev:
invoke PciRead32, [bus], [devfn], PCI_header02.vendor_id invoke PciRead32, [bus], [devfn], PCI_header.vendor_id
test eax, eax test eax, eax
jz .next jz .next
cmp eax, -1 cmp eax, -1
je .next je .next
invoke PciRead16, [bus], [devfn], 0x0a ; class & subclass invoke PciRead16, [bus], [devfn], PCI_header.subclass ; class & subclass
cmp ax, 0x0607 cmp ax, 0x0607
je .found je .found
.next: .next:
test [devfn], 7
jnz .next_fn
invoke PciRead8, [bus], [devfn], PCI_header.header_type
test al, al
js .next_fn
or [devfn], 7
.next_fn:
inc [devfn] inc [devfn]
cmp [devfn], 256 cmp [devfn], 256
jb .next_dev jb .next_dev
@ -150,6 +158,7 @@ proc detect
DEBUGF 1, "Found cardbus bridge: bus=0x%x, dev=0x%x\n", [bus], [devfn] DEBUGF 1, "Found cardbus bridge: bus=0x%x, dev=0x%x\n", [bus], [devfn]
invoke PciRead8, [bus], [devfn], PCI_header.header_type invoke PciRead8, [bus], [devfn], PCI_header.header_type
and al, not 0x80 ; Mask the multifunction device bit
DEBUGF 1, "Header type=0x%x\n", eax:2 DEBUGF 1, "Header type=0x%x\n", eax:2
cmp al, 2 cmp al, 2
jne .next jne .next