diff --git a/kernel/include/kernel/PCI.h b/kernel/include/kernel/PCI.h index 790980963c..0ca2d4d2e8 100644 --- a/kernel/include/kernel/PCI.h +++ b/kernel/include/kernel/PCI.h @@ -75,6 +75,9 @@ namespace Kernel::PCI uint8_t header_type() const { return m_header_type; } + uint16_t vendor_id() const { return m_vendor_id; } + uint16_t device_id() const { return m_device_id; } + BAN::ErrorOr get_irq(); BAN::ErrorOr> allocate_bar_region(uint8_t bar_num); @@ -107,6 +110,8 @@ namespace Kernel::PCI uint8_t m_prog_if; uint8_t m_header_type; + uint16_t m_vendor_id; + uint16_t m_device_id; BAN::Optional m_offset_msi; BAN::Optional m_offset_msi_x; diff --git a/kernel/kernel/PCI.cpp b/kernel/kernel/PCI.cpp index 3100ca0962..3c69bd4885 100644 --- a/kernel/kernel/PCI.cpp +++ b/kernel/kernel/PCI.cpp @@ -337,6 +337,15 @@ namespace Kernel::PCI m_prog_if = read_byte(0x09); m_header_type = read_byte(0x0E); + uint32_t device = read_dword(0x00); + m_vendor_id = device & 0xFFFF; + m_device_id = device >> 16; + + dprintln("PCI {2H}:{2H}.{2H} has {2H}.{2H}.{2H}", + m_bus, m_dev, m_func, + m_class_code, m_subclass, m_prog_if + ); + enumerate_capabilites(); }