diff --git a/drivers/usb/usbehci_new/hardware.cpp b/drivers/usb/usbehci_new/hardware.cpp index 4a104c9c8f1..3dfece4c9df 100644 --- a/drivers/usb/usbehci_new/hardware.cpp +++ b/drivers/usb/usbehci_new/hardware.cpp @@ -97,8 +97,10 @@ protected: EHCI_CAPS m_Capabilities; USHORT m_VendorID; USHORT m_DeviceID; + PQUEUE_HEAD AsyncQueueHead; PUSBQUEUE m_UsbQueue; PDMAMEMORYMANAGER m_MemoryManager; + VOID SetCommandRegister(PEHCI_USBCMD_CONTENT UsbCmd); VOID GetCommandRegister(PEHCI_USBCMD_CONTENT UsbCmd); ULONG EHCI_READ_REGISTER_ULONG(ULONG Offset); @@ -158,16 +160,6 @@ CUSBHardwareDevice::Initialize( return Status; } - // - // Initialize the DMAMemoryManager - // - Status = m_MemoryManager->Initialize(this, &m_Lock, PAGE_SIZE * 4, VirtualBase, PhysicalAddress, 32); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to initialize the DMAMemoryManager\n"); - return Status; - } - // // store device objects // @@ -250,6 +242,7 @@ CUSBHardwareDevice::PnpStart( ULONG Index, Count; PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor; DEVICE_DESCRIPTION DeviceDescription; + PHYSICAL_ADDRESS AsyncPhysicalAddress; PVOID ResourceBase; NTSTATUS Status; @@ -382,6 +375,16 @@ CUSBHardwareDevice::PnpStart( if (!NT_SUCCESS(Status)) return Status; + // + // Initialize the DMAMemoryManager + // + Status = m_MemoryManager->Initialize(this, &m_Lock, PAGE_SIZE * 4, VirtualBase, PhysicalAddress, 32); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to initialize the DMAMemoryManager\n"); + return Status; + } + // // Initialize the UsbQueue now that we have an AdapterObject. // @@ -392,10 +395,29 @@ CUSBHardwareDevice::PnpStart( return Status; } + // + // Create a queuehead for the Async Register + // + m_MemoryManager->Allocate(sizeof(QUEUE_HEAD), (PVOID*)&AsyncQueueHead, &AsyncPhysicalAddress); + + AsyncQueueHead->AlternateNextPointer = TERMINATE_POINTER; + AsyncQueueHead->NextPointer = TERMINATE_POINTER; + AsyncQueueHead->PhysicalAddr = AsyncPhysicalAddress.LowPart; + AsyncQueueHead->HorizontalLinkPointer = AsyncQueueHead->PhysicalAddr | QH_TYPE_QH; + AsyncQueueHead->EndPointCharacteristics.QEDTDataToggleControl = FALSE; + AsyncQueueHead->Token.Bits.InterruptOnComplete = FALSE; + AsyncQueueHead->EndPointCharacteristics.HeadOfReclamation = TRUE; + AsyncQueueHead->Token.Bits.Halted = TRUE; + AsyncQueueHead->EndPointCharacteristics.MaximumPacketLength = 64; + AsyncQueueHead->EndPointCharacteristics.NakCountReload = 0xF; + AsyncQueueHead->EndPointCharacteristics.EndPointSpeed = QH_ENDPOINT_HIGHSPEED; + AsyncQueueHead->EndPointCapabilities.NumberOfTransactionPerFrame = 0x03; + + SetAsyncListRegister(AsyncQueueHead->PhysicalAddr); + // // Start the controller // - DPRINT1("Starting Controller\n"); return StartController(); } diff --git a/drivers/usb/usbehci_new/usb_queue.cpp b/drivers/usb/usbehci_new/usb_queue.cpp index 5cc3eb599d0..94dc91672df 100644 --- a/drivers/usb/usbehci_new/usb_queue.cpp +++ b/drivers/usb/usbehci_new/usb_queue.cpp @@ -93,9 +93,6 @@ CUSBQueue::Initialize( // KeInitializeSpinLock(&m_Lock); - // - // FIXME: Need to set AsyncRegister with a QUEUEHEAD - // return Status; }