summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Buhagiar <jooster669@gmail.com>2021-01-03 16:44:48 +1100
committerAndreas Kling <kling@serenityos.org>2021-01-09 13:48:15 +0100
commit3fb7e98e42601d683b6f70336f10a1dd08555fa2 (patch)
treed54aa79ef9edda1c38befdb5599012c60f464afe
parentff4afe17beee74d9130b5eae6fe407559fc5c90b (diff)
downloadserenity-3fb7e98e42601d683b6f70336f10a1dd08555fa2.zip
Kernel/USB: Simplify schedule
It seems like Haiku and Grub do this, so let's not bother with any fancy timing stuff for now (to at least get _something_ working...)
-rw-r--r--Kernel/Devices/USB/UHCIController.cpp24
-rw-r--r--Kernel/Devices/USB/UHCIController.h1
2 files changed, 3 insertions, 22 deletions
diff --git a/Kernel/Devices/USB/UHCIController.cpp b/Kernel/Devices/USB/UHCIController.cpp
index dd6a95ab6c..0b57631811 100644
--- a/Kernel/Devices/USB/UHCIController.cpp
+++ b/Kernel/Devices/USB/UHCIController.cpp
@@ -142,10 +142,6 @@ void UHCIController::reset()
create_structures();
setup_schedule();
- // Let's set each of the frame values to TERMINATE so that the controller ignores them
- for (auto frame = 0; frame < 1024; frame++) {
- }
-
write_flbaseadd(m_framelist->physical_page(0)->paddr().get()); // Frame list (physical) address
write_frnum(0); // Set the initial frame number
@@ -168,29 +164,15 @@ void UHCIController::create_structures()
auto placement_addr = reinterpret_cast<void*>(m_qh_pool->vaddr().get() + (i * sizeof(QueueHead)));
auto paddr = static_cast<u32>(m_qh_pool->physical_page(0)->paddr().get() + (i * sizeof(QueueHead)));
m_free_qh_pool.at(i) = new (placement_addr) QueueHead(paddr);
-
- //auto& queue_head = m_free_qh_pool.at(i);
}
- // Create the Interrupt Transfer, Full Speed/Low Speed Control and Bulk Queue Heads
+ // Create the Full Speed, Low Speed Control and Bulk Queue Heads
m_interrupt_transfer_queue = allocate_queue_head();
m_lowspeed_control_qh = allocate_queue_head();
m_fullspeed_control_qh = allocate_queue_head();
m_bulk_qh = allocate_queue_head();
m_dummy_qh = allocate_queue_head();
- // Now let's create the interrupt Queue Heads
- m_interrupt_qh_list.resize(UHCI_NUMBER_OF_INTERRUPT_QHS);
- for (size_t i = 0; i < m_interrupt_qh_list.size(); i++) {
- m_interrupt_qh_list.at(i) = reinterpret_cast<QueueHead*>(m_qh_pool->vaddr().get() + (i * sizeof(QueueHead)));
-
- auto& queue_head = m_interrupt_qh_list.at(i);
- queue_head->paddr = static_cast<u32>(m_qh_pool->physical_page(0)->paddr().get() + (i * sizeof(QueueHead)));
- queue_head->in_use = true;
- queue_head->link_ptr = m_lowspeed_control_qh->paddr; // Link to the low-speed control queue head
- queue_head->element_link_ptr = QueueHead::Terminate; // No elements attached to this queue head
- }
-
// Now the Transfer Descriptor pool
auto td_pool_vmobject = ContiguousVMObject::create_with_size(2 * PAGE_SIZE);
m_td_pool = MemoryManager::the().allocate_kernel_region_with_vmobject(*td_pool_vmobject, 2 * PAGE_SIZE, "UHCI Transfer Descriptor Pool", Region::Access::Write);
@@ -226,8 +208,8 @@ void UHCIController::create_structures()
// that we store in `paddr`, meaning our member functions directly
// access the raw descriptor (that we later send to the controller)
m_free_td_pool.at(i) = new (placement_addr) Kernel::USB::TransferDescriptor(paddr);
- //auto transfer_descriptor = m_free_td_pool.at(i);
- //transfer_descriptor->print();
+ auto transfer_descriptor = m_free_td_pool.at(i);
+ transfer_descriptor->print();
}
#ifdef UHCI_DEBUG
diff --git a/Kernel/Devices/USB/UHCIController.h b/Kernel/Devices/USB/UHCIController.h
index 6d721f5c8e..133a4abab1 100644
--- a/Kernel/Devices/USB/UHCIController.h
+++ b/Kernel/Devices/USB/UHCIController.h
@@ -84,7 +84,6 @@ private:
Vector<QueueHead*> m_free_qh_pool;
Vector<TransferDescriptor*> m_free_td_pool;
Vector<TransferDescriptor*> m_iso_td_list;
- Vector<QueueHead*> m_interrupt_qh_list;
QueueHead* m_interrupt_transfer_queue;
QueueHead* m_lowspeed_control_qh;