diff options
author | Andreas Kling <kling@serenityos.org> | 2021-03-12 14:12:12 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-12 15:22:35 +0100 |
commit | 4c7f486f3910cdb5ae644c57b84c9dca83ea2033 (patch) | |
tree | 2a7053a3b056cc81d6a38ee5d6eb300684d863cf | |
parent | f432f104fcc22f03989895bcdb842a609b4706da (diff) | |
download | serenity-4c7f486f3910cdb5ae644c57b84c9dca83ea2033.zip |
Kernel: Convert klog() => AK::Format in UHCIController
-rw-r--r-- | Kernel/Devices/USB/UHCIController.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/Kernel/Devices/USB/UHCIController.cpp b/Kernel/Devices/USB/UHCIController.cpp index 96488e6eef..b225ad4ba6 100644 --- a/Kernel/Devices/USB/UHCIController.cpp +++ b/Kernel/Devices/USB/UHCIController.cpp @@ -141,8 +141,8 @@ void UHCIController::reset() // Let's allocate the physical page for the Frame List (which is 4KiB aligned) auto framelist_vmobj = ContiguousVMObject::create_with_size(PAGE_SIZE); m_framelist = MemoryManager::the().allocate_kernel_region_with_vmobject(*framelist_vmobj, PAGE_SIZE, "UHCI Framelist", Region::Access::Write); - klog() << "UHCI: Allocated framelist at physical address " << m_framelist->physical_page(0)->paddr(); - klog() << "UHCI: Framelist is at virtual address " << m_framelist->vaddr(); + dbgln("UHCI: Allocated framelist at physical address {}", m_framelist->physical_page(0)->paddr()); + dbgln("UHCI: Framelist is at virtual address {}", m_framelist->vaddr()); write_sofmod(64); // 1mS frame time create_structures(); @@ -153,7 +153,7 @@ void UHCIController::reset() // Enable all interrupt types write_frnum(UHCI_USBINTR_TIMEOUT_CRC_ENABLE | UHCI_USBINTR_RESUME_INTR_ENABLE | UHCI_USBINTR_IOC_ENABLE | UHCI_USBINTR_SHORT_PACKET_INTR_ENABLE); - klog() << "UHCI: Reset completed!"; + dbgln("UHCI: Reset completed"); } UNMAP_AFTER_INIT void UHCIController::create_structures() @@ -222,11 +222,11 @@ UNMAP_AFTER_INIT void UHCIController::create_structures() # endif } -# if UHCI_DEBUG - klog() << "UHCI: Pool information:"; - klog() << "\tqh_pool: " << PhysicalAddress(m_qh_pool->physical_page(0)->paddr()) << ", length: " << m_qh_pool->range().size(); - klog() << "\ttd_pool: " << PhysicalAddress(m_td_pool->physical_page(0)->paddr()) << ", length: " << m_td_pool->range().size(); -# endif + if constexpr (UHCI_DEBUG) { + dbgln("UHCI: Pool information:"); + dbgln(" qh_pool: {}, length: {}", PhysicalAddress(m_qh_pool->physical_page(0)->paddr()), m_qh_pool->range().size()); + dbgln(" td_pool: {}, length: {}", PhysicalAddress(m_td_pool->physical_page(0)->paddr()), m_td_pool->range().size()); + } } UNMAP_AFTER_INIT void UHCIController::setup_schedule() @@ -279,7 +279,6 @@ UNMAP_AFTER_INIT void UHCIController::setup_schedule() for (int frame = 0; frame < UHCI_NUMBER_OF_FRAMES; frame++) { // Each frame pointer points to iso_td % NUM_ISO_TDS framelist[frame] = m_iso_td_list.at(frame % UHCI_NUMBER_OF_ISOCHRONOUS_TDS)->paddr(); - // klog() << PhysicalAddress(framelist[frame]); } m_interrupt_transfer_queue->print(); @@ -294,9 +293,7 @@ QueueHead* UHCIController::allocate_queue_head() const for (QueueHead* queue_head : m_free_qh_pool) { if (!queue_head->in_use()) { queue_head->set_in_use(true); -# if UHCI_DEBUG - klog() << "UHCI: Allocated a new Queue Head! Located @ " << VirtualAddress(queue_head) << "(" << PhysicalAddress(queue_head->paddr()) << ")"; -# endif + dbgln_if(UHCI_DEBUG, "UHCI: Allocated a new Queue Head! Located @ {} ({})", VirtualAddress(queue_head), PhysicalAddress(queue_head->paddr())); return queue_head; } } @@ -310,9 +307,7 @@ TransferDescriptor* UHCIController::allocate_transfer_descriptor() const for (TransferDescriptor* transfer_descriptor : m_free_td_pool) { if (!transfer_descriptor->in_use()) { transfer_descriptor->set_in_use(true); -# if UHCI_DEBUG - klog() << "UHCI: Allocated a new Transfer Descriptor! Located @ " << VirtualAddress(transfer_descriptor) << "(" << PhysicalAddress(transfer_descriptor->paddr()) << ")"; -# endif + dbgln_if(UHCI_DEBUG, "UHCI: Allocated a new Transfer Descriptor! Located @ {} ({})", VirtualAddress(transfer_descriptor), PhysicalAddress(transfer_descriptor->paddr())); return transfer_descriptor; } } @@ -339,7 +334,7 @@ void UHCIController::start() if (!(read_usbsts() & UHCI_USBSTS_HOST_CONTROLLER_HALTED)) break; } - klog() << "UHCI: Started!"; + dbgln("UHCI: Started"); } struct setup_packet { @@ -352,7 +347,7 @@ struct setup_packet { void UHCIController::do_debug_transfer() { - klog() << "UHCI: Attempting a dummy transfer..."; + dbgln("UHCI: Attempting a dummy transfer..."); // Okay, let's set up the buffer so we can write some data auto vmobj = ContiguousVMObject::create_with_size(PAGE_SIZE); |