Kernel: PCIDevice stores its vendor id and device id
This commit is contained in:
parent
29db8d0d40
commit
73b9c28457
|
@ -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<uint8_t> get_irq();
|
||||
|
||||
BAN::ErrorOr<BAN::UniqPtr<BarRegion>> 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<uint8_t> m_offset_msi;
|
||||
BAN::Optional<uint8_t> m_offset_msi_x;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue