summaryrefslogtreecommitdiff
path: root/Kernel/Bus/PCI
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Bus/PCI')
-rw-r--r--Kernel/Bus/PCI/Device.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/Kernel/Bus/PCI/Device.h b/Kernel/Bus/PCI/Device.h
index f167e192e1..9c1d1fa92e 100644
--- a/Kernel/Bus/PCI/Device.h
+++ b/Kernel/Bus/PCI/Device.h
@@ -6,6 +6,8 @@
#pragma once
+#include <AK/Format.h>
+#include <AK/StringBuilder.h>
#include <AK/Types.h>
#include <Kernel/Bus/PCI/Definitions.h>
@@ -16,6 +18,9 @@ public:
Address pci_address() const { return m_pci_address; };
virtual ~Device() = default;
+
+ virtual StringView device_name() const = 0;
+
void enable_pin_based_interrupts() const;
void disable_pin_based_interrupts() const;
@@ -35,4 +40,16 @@ private:
Address m_pci_address;
};
+template<typename... Parameters>
+void dmesgln_pci(Device const& device, AK::CheckedFormatString<Parameters...>&& fmt, Parameters const&... parameters)
+{
+ AK::StringBuilder builder;
+ if (builder.try_append("{}: {}: "sv).is_error())
+ return;
+ if (builder.try_append(fmt.view()).is_error())
+ return;
+ AK::VariadicFormatParams variadic_format_params { device.device_name(), device.pci_address(), parameters... };
+ vdmesgln(builder.string_view(), variadic_format_params);
+}
+
}