fixed find_mmio32 in pci.inc

git-svn-id: svn://kolibrios.org@2922 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2012-08-15 10:50:36 +00:00
parent 85ca6be824
commit 70c292f418

View File

@ -50,40 +50,44 @@ macro find_io bus, dev, io {
jz .inc jz .inc
and eax, PCI_BASE_ADDRESS_IO_MASK and eax, PCI_BASE_ADDRESS_IO_MASK
mov io , eax
jmp .got jmp .got
.inc: .inc:
add esi, 4 add esi, 4
cmp esi, PCI_BASE_ADDRESS_5 cmp esi, PCI_BASE_ADDRESS_5
jle .check jbe .check
xor eax, eax
.got: .got:
mov io, eax
} }
macro find_mmio32 bus, dev, mmio32 { macro find_mmio32 bus, dev, io {
local .check, .got local .check, .inc, .got
xor eax, eax
mov esi, PCI_BASE_ADDRESS_0 mov esi, PCI_BASE_ADDRESS_0
movzx ecx, bus
movzx edx, dev
.check: .check:
stdcall PciRead32, ecx ,edx ,esi stdcall PciRead32, bus, dev, esi
test eax, not PCI_BASE_ADDRESS_IO_MASK test eax, PCI_BASE_ADDRESS_SPACE_IO ; mmio address?
jz .got jnz .inc
test eax, 100b ; 64 bit?
jnz .inc
and eax, not 1111b
jmp .got
.inc:
add esi, 4 add esi, 4
cmp esi, PCI_BASE_ADDRESS_5 cmp esi, PCI_BASE_ADDRESS_5
jle .check jbe .check
xor eax, eax xor eax, eax
.got: .got:
mov mmio32, eax mov io, eax
} }