Kernel: Set interval and average trb length on configure endpoint

Real controllers seem to require this while spec 4.8.2.4 says that they
should be left as zero.
This commit is contained in:
2024-07-15 11:46:28 +03:00
parent 86e9d92ecb
commit 75875d3a8f
4 changed files with 72 additions and 12 deletions

View File

@@ -10,13 +10,20 @@ namespace Kernel
{
enum class SpeedClass
{
None,
LowSpeed,
FullSpeed,
HighSpeed,
SuperSpeed,
};
enum class EndpointType
{
Control = 0b00,
Isochronous = 0b01,
Bulk = 0b10,
Interrupt = 0b11,
};
enum class DeviceBaseClass : uint8_t
{
CommunicationAndCDCControl = 0x02,

View File

@@ -53,7 +53,9 @@ namespace Kernel
};
public:
USBDevice() = default;
USBDevice(USB::SpeedClass speed_class)
: m_speed_class(speed_class)
{}
virtual ~USBDevice() = default;
BAN::ErrorOr<void> initialize();
@@ -72,6 +74,9 @@ namespace Kernel
private:
BAN::ErrorOr<ConfigurationDescriptor> parse_configuration(size_t index);
protected:
const USB::SpeedClass m_speed_class;
private:
DeviceDescriptor m_descriptor;
BAN::UniqPtr<DMARegion> m_dma_buffer;

View File

@@ -43,11 +43,7 @@ namespace Kernel
BAN::ErrorOr<void> initialize_control_endpoint() override;
private:
XHCIDevice(XHCIController& controller, uint32_t port_id, uint32_t slot_id)
: m_controller(controller)
, m_port_id(port_id)
, m_slot_id(slot_id)
{}
XHCIDevice(XHCIController& controller, uint32_t port_id, uint32_t slot_id);
~XHCIDevice();
BAN::ErrorOr<void> update_actual_max_packet_size();
@@ -55,6 +51,8 @@ namespace Kernel
void advance_endpoint_enqueue(Endpoint&, bool chain);
static uint64_t calculate_port_bits_per_second(XHCIController&, uint32_t port_id);
private:
static constexpr uint32_t m_transfer_ring_trb_count = PAGE_SIZE / sizeof(XHCI::TRB);