[USBEHCI_NEW]

- Initialize the MemoryManager only after allocating a CommonBuffer to pass to it.
- Create a QueueHead to put into the AsyncList Register.


svn path=/branches/usb-bringup/; revision=51402
This commit is contained in:
Michael Martin 2011-04-19 15:06:26 +00:00
parent 775c4ce80d
commit 9b8bc8512c
2 changed files with 33 additions and 14 deletions

View file

@ -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();
}

View file

@ -93,9 +93,6 @@ CUSBQueue::Initialize(
//
KeInitializeSpinLock(&m_Lock);
//
// FIXME: Need to set AsyncRegister with a QUEUEHEAD
//
return Status;
}