summaryrefslogtreecommitdiff
path: root/Kernel/Storage/NVMe
diff options
context:
space:
mode:
authorEvan Smal <evan.smal@hotmail.com>2022-12-28 17:55:04 -0500
committerJelle Raaijmakers <jelle@gmta.nl>2023-01-05 01:44:19 +0100
commit288a73ea0e21ab1f98dba68e6b71d37da87b5591 (patch)
tree5d0d6e511155b5e23face6f3440a1a8aaec75f19 /Kernel/Storage/NVMe
parent6a5be5f1c555fa880822d988e52058b50a3eea84 (diff)
downloadserenity-288a73ea0e21ab1f98dba68e6b71d37da87b5591.zip
Kernel: Add dmesgln_pci logging for Kernel::PCI
A virtual method named device_name() was added to Kernel::PCI to support logging the PCI::Device name and address using dmesgln_pci. Previously, PCI::Device did not store the device name. All devices inheriting from PCI::Device now use dmesgln_pci where they previously used dmesgln.
Diffstat (limited to 'Kernel/Storage/NVMe')
-rw-r--r--Kernel/Storage/NVMe/NVMeController.cpp8
-rw-r--r--Kernel/Storage/NVMe/NVMeController.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/Kernel/Storage/NVMe/NVMeController.cpp b/Kernel/Storage/NVMe/NVMeController.cpp
index e03ae9e809..e1151f5725 100644
--- a/Kernel/Storage/NVMe/NVMeController.cpp
+++ b/Kernel/Storage/NVMe/NVMeController.cpp
@@ -169,7 +169,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::identify_and_init_namespaces()
sub.identify.cns = NVMe_CNS_ID_ACTIVE_NS & 0xff;
status = submit_admin_command(sub, true);
if (status) {
- dmesgln("Failed to identify active namespace command");
+ dmesgln_pci(*this, "Failed to identify active namespace command");
return EFAULT;
}
if (void* fault_at; !safe_memcpy(active_namespace_list, prp_dma_region->vaddr().as_ptr(), NVMe_IDENTIFY_SIZE, fault_at)) {
@@ -192,7 +192,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::identify_and_init_namespaces()
sub.identify.nsid = nsid;
status = submit_admin_command(sub, true);
if (status) {
- dmesgln("Failed identify namespace with nsid {}", nsid);
+ dmesgln_pci(*this, "Failed identify namespace with nsid {}", nsid);
return EFAULT;
}
static_assert(sizeof(IdentifyNamespace) == NVMe_IDENTIFY_SIZE);
@@ -263,7 +263,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::create_admin_queue(Optional<u8> i
auto cq_size = round_up_to_power_of_two(CQ_SIZE(qdepth), 4096);
auto sq_size = round_up_to_power_of_two(SQ_SIZE(qdepth), 4096);
if (!reset_controller()) {
- dmesgln("Failed to reset the NVMe controller");
+ dmesgln_pci(*this, "Failed to reset the NVMe controller");
return EFAULT;
}
{
@@ -285,7 +285,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::create_admin_queue(Optional<u8> i
m_controller_regs->asq = reinterpret_cast<u64>(AK::convert_between_host_and_little_endian(sq_dma_pages.first().paddr().as_ptr()));
if (!start_controller()) {
- dmesgln("Failed to restart the NVMe controller");
+ dmesgln_pci(*this, "Failed to restart the NVMe controller");
return EFAULT;
}
set_admin_queue_ready_flag();
diff --git a/Kernel/Storage/NVMe/NVMeController.h b/Kernel/Storage/NVMe/NVMeController.h
index d260c72572..39087dc527 100644
--- a/Kernel/Storage/NVMe/NVMeController.h
+++ b/Kernel/Storage/NVMe/NVMeController.h
@@ -30,6 +30,7 @@ public:
ErrorOr<void> initialize(bool is_queue_polled);
LockRefPtr<StorageDevice> device(u32 index) const override;
size_t devices_count() const override;
+ virtual StringView device_name() const override { return "NVMeController"sv; }
protected:
bool reset() override;