From 4ef97c812c4fe3fddb07a383d01ca2ee850b2025 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Wed, 5 Nov 2014 17:45:10 +0000 Subject: [PATCH] Use PCI list instead of manually re-scanning PCI bus. git-svn-id: svn://kolibrios.org@5173 a494cfbc-eb01-0410-851d-a64ba20cac60 --- drivers/audio/sound.asm | 47 +++++++++-------------------------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/drivers/audio/sound.asm b/drivers/audio/sound.asm index 13b3135b1c..43e64f3e7e 100644 --- a/drivers/audio/sound.asm +++ b/drivers/audio/sound.asm @@ -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 ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -200,54 +200,27 @@ locals devfn dd ? endl - xor eax, eax - mov [bus], 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 + invoke GetPCIList + mov edx, eax + .loop: + mov ecx, [eax + PCIDEV.vendor_device_id] mov edi, devices @@: mov ebx, [edi] test ebx, ebx jz .next - cmp eax, ebx + cmp ecx, ebx je .found add edi, 8 - jmp @B + jmp @b .next: - test [devfn], 7 - jnz .next_fn - invoke PciRead8, [bus], [devfn], PCI_header.header_type - test al, al - js .next_fn - or [devfn], 7 + mov eax, [eax + PCIDEV.fd] + cmp eax, edx + jne .loop - .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 mov esi, msgFail invoke SysMsgBoardStr