diff --git a/Kernel/Devices/USB/UHCIController.cpp b/Kernel/Devices/USB/UHCIController.cpp index b225ad4ba6..f6e490ba43 100644 --- a/Kernel/Devices/USB/UHCIController.cpp +++ b/Kernel/Devices/USB/UHCIController.cpp @@ -27,18 +27,15 @@ #include -// FIXME: This should not be i386-specific. -#if ARCH(I386) +#include +#include +#include +#include +#include +#include +#include -# include -# include -# include -# include -# include -# include -# include - -# define UHCI_ENABLED 1 +#define UHCI_ENABLED 1 static constexpr u8 MAXIMUM_NUMBER_OF_TDS = 128; // Upper pool limit. This consumes the second page we have allocated static constexpr u8 MAXIMUM_NUMBER_OF_QHS = 64; @@ -93,9 +90,9 @@ UHCIController& UHCIController::the() UNMAP_AFTER_INIT void UHCIController::detect() { -# if !UHCI_ENABLED +#if !UHCI_ENABLED return; -# endif +#endif PCI::enumerate([&](const PCI::Address& address, PCI::ID id) { if (address.is_null()) return; @@ -200,9 +197,9 @@ UNMAP_AFTER_INIT void UHCIController::create_structures() transfer_descriptor->set_isochronous(); transfer_descriptor->link_queue_head(m_interrupt_transfer_queue->paddr()); -# if UHCI_VERBOSE_DEBUG +#if UHCI_VERBOSE_DEBUG transfer_descriptor->print(); -# endif +#endif } m_free_td_pool.resize(MAXIMUM_NUMBER_OF_TDS); @@ -216,10 +213,10 @@ UNMAP_AFTER_INIT void UHCIController::create_structures() // access the raw descriptor (that we later send to the controller) m_free_td_pool.at(i) = new (placement_addr) Kernel::USB::TransferDescriptor(paddr); -# if UHCI_VERBOSE_DEBUG +#if UHCI_VERBOSE_DEBUG auto transfer_descriptor = m_free_td_pool.at(i); transfer_descriptor->print(); -# endif +#endif } if constexpr (UHCI_DEBUG) { @@ -464,5 +461,3 @@ void UHCIController::handle_irq(const RegisterState&) } } - -#endif diff --git a/Kernel/Devices/USB/UHCIController.h b/Kernel/Devices/USB/UHCIController.h index 02ab96f212..da50d4f4f1 100644 --- a/Kernel/Devices/USB/UHCIController.h +++ b/Kernel/Devices/USB/UHCIController.h @@ -29,16 +29,13 @@ #include -// FIXME: This should not be i386-specific. -#if ARCH(I386) - -# include -# include -# include -# include -# include -# include -# include +#include +#include +#include +#include +#include +#include +#include namespace Kernel::USB { @@ -105,4 +102,3 @@ private: }; } -#endif diff --git a/Kernel/Devices/USB/UHCIDescriptorTypes.h b/Kernel/Devices/USB/UHCIDescriptorTypes.h index cbdba0ab25..61fe133aad 100644 --- a/Kernel/Devices/USB/UHCIDescriptorTypes.h +++ b/Kernel/Devices/USB/UHCIDescriptorTypes.h @@ -27,6 +27,7 @@ #pragma once #include +#include #include namespace Kernel::USB { @@ -183,10 +184,10 @@ private: u32 m_buffer_ptr; // Points to a data buffer for this transaction (i.e what we want to send or recv) // These values will be ignored by the controller, but we can use them for configuration/bookkeeping - u32 m_paddr; // Physical address where this TransferDescriptor is located - TransferDescriptor* m_next_td; // Pointer to first TD - TransferDescriptor* m_prev_td; // Pointer to first TD - bool m_in_use; // Has this TD been allocated (and therefore in use)? + u32 m_paddr; // Physical address where this TransferDescriptor is located + Ptr32 m_next_td { nullptr }; // Pointer to first TD + Ptr32 m_prev_td { nullptr }; // Pointer to first TD + bool m_in_use; // Has this TD been allocated (and therefore in use)? }; static_assert(sizeof(TransferDescriptor) == 32); // Transfer Descriptor is always 8 Dwords @@ -273,11 +274,11 @@ private: // These values will be ignored by the controller, but we can use them for configuration/bookkeeping // Any addresses besides `paddr` are assumed virtual and can be dereferenced - u32 m_paddr { 0 }; // Physical address where this QueueHead is located - QueueHead* m_next_qh { nullptr }; // Next QH - QueueHead* m_prev_qh { nullptr }; // Previous QH - TransferDescriptor* m_first_td { nullptr }; // Pointer to first TD - bool m_in_use { false }; // Is this QH currently in use? + u32 m_paddr { 0 }; // Physical address where this QueueHead is located + Ptr32 m_next_qh { nullptr }; // Next QH + Ptr32 m_prev_qh { nullptr }; // Previous QH + Ptr32 m_first_td { nullptr }; // Pointer to first TD + bool m_in_use { false }; // Is this QH currently in use? }; static_assert(sizeof(QueueHead) == 32); // Queue Head is always 8 Dwords diff --git a/Kernel/init.cpp b/Kernel/init.cpp index 23d90cb7fa..a5d24a3c06 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -274,9 +274,7 @@ void init_stage2(void*) } // FIXME: This should not be i386-specific. -#if ARCH(I386) USB::UHCIController::detect(); -#endif DMIExpose::initialize();