From 77050b83e5d362bab217ac088765257a9e573ddb Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 11 Oct 2022 00:04:04 +0300 Subject: [PATCH] Trace PCI devices on kernel framebuffer --- Kernel.cpp | 9 +++++++++ include/pci.hpp | 1 + 2 files changed, 10 insertions(+) diff --git a/Kernel.cpp b/Kernel.cpp index 00f4423..f3caa2e 100644 --- a/Kernel.cpp +++ b/Kernel.cpp @@ -58,6 +58,15 @@ EXTERNC void Entry(BootInfo *Info) PowerManager = new Power::Power; KPrint("Initializing PCI Manager"); PCIManager = new PCI::PCI; + foreach (auto hdr in PCIManager->GetDevices()) + { + KPrint("Found PCI device: %s / %s / %s / %s / %s", + PCI::Descriptors::GetVendorName(hdr->VendorID), + PCI::Descriptors::GetDeviceName(hdr->VendorID, hdr->DeviceID), + PCI::Descriptors::DeviceClasses[hdr->Class], + PCI::Descriptors::GetSubclassName(hdr->Class, hdr->Subclass), + PCI::Descriptors::GetProgIFName(hdr->Class, hdr->Subclass, hdr->ProgIF)); + } while (1) CPU::Halt(); } diff --git a/include/pci.hpp b/include/pci.hpp index a808457..b6ccbdb 100644 --- a/include/pci.hpp +++ b/include/pci.hpp @@ -142,6 +142,7 @@ namespace PCI Vector Devices; public: + Vector &GetDevices() { return Devices; } void EnumerateFunction(uint64_t DeviceAddress, uint64_t Function); void EnumerateDevice(uint64_t BusAddress, uint64_t Device); void EnumerateBus(uint64_t BaseAddress, uint64_t Bus);