mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
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.
This commit is contained in:
parent
6a5be5f1c5
commit
288a73ea0e
24 changed files with 90 additions and 52 deletions
|
@ -27,7 +27,7 @@ UNMAP_AFTER_INIT NonnullLockRefPtr<AHCIController> AHCIController::initialize(PC
|
|||
|
||||
bool AHCIController::reset()
|
||||
{
|
||||
dmesgln("{}: AHCI controller reset", pci_address());
|
||||
dmesgln_pci(*this, "{}: AHCI controller reset", pci_address());
|
||||
{
|
||||
SpinlockLocker locker(m_hba_control_lock);
|
||||
hba().control_regs.ghc = 1;
|
||||
|
|
|
@ -27,6 +27,8 @@ public:
|
|||
static NonnullLockRefPtr<AHCIController> initialize(PCI::DeviceIdentifier const& pci_device_identifier);
|
||||
virtual ~AHCIController() override;
|
||||
|
||||
virtual StringView device_name() const override { return "AHCI"sv; }
|
||||
|
||||
virtual LockRefPtr<StorageDevice> device(u32 index) const override;
|
||||
virtual bool reset() override;
|
||||
virtual bool shutdown() override;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue