dde_kit: enable pci lookup by device_class

Instead of trying all PCI devices by a specific PCI driver, now the device or
the device class can be limited to the one actually supported by the specific
driver.
This commit is contained in:
Alexander Boettcher
2013-02-20 11:44:12 +01:00
committed by Norman Feske
parent ce075c05b9
commit be0fa1f63a
7 changed files with 48 additions and 23 deletions

View File

@@ -30,14 +30,18 @@ class Driver
{
private:
enum { MAX_DRIVER = 10 };
enum {
MAX_DRIVER = 10,
PCI_CLASS_MASK = 0xff0000,
PCI_CLASS_MULTIMEDIA = 0x40000, /* class multimedia */
};
oss_driver *_drivers[MAX_DRIVER + 1]; /* registered drivers */
Driver()
{
Genode::memset(_drivers, 0, sizeof(oss_driver *) * (MAX_DRIVER + 1));
dde_kit_pci_init();
dde_kit_pci_init(PCI_CLASS_MULTIMEDIA, PCI_CLASS_MASK);
}
/**
@@ -81,19 +85,13 @@ class Driver
Pci::Device_capability _scan_pci(Pci::Device_capability const &prev,
Pci::Connection &pci)
{
/* check for audio device class */
enum {
CLASS_MASK = 0xff0000,
CLASS_MULTIMEDIA = 0x40000, /* class multimedia */
};
/*
* Just test for multimedia class, since some devices (e.g., Intel
* hda) do set the subclass to something different then audio (0x1).
*/
Pci::Device_capability cap;
cap = pci.next_device(prev, CLASS_MULTIMEDIA, CLASS_MASK);
cap = pci.next_device(prev, PCI_CLASS_MULTIMEDIA, PCI_CLASS_MASK);
if (prev.valid())
pci.release_device(prev);
return cap;