Commit graph

78 commits

Author SHA1 Message Date
Johannes Anderwald 5573560a44 [USBSTOR]
- Implement SCSI mode sense

svn path=/branches/usb-bringup/; revision=51609
2011-05-06 17:23:19 +00:00
Johannes Anderwald ff67bee091 [USBSTOR]
- Implement retrieving drive capacity
- Use constant from scsi.h instead of defining own format
- Don't reset returned parameters length to zero, as ioctl handler might set it


svn path=/branches/usb-bringup/; revision=51608
2011-05-06 16:25:01 +00:00
Johannes Anderwald 5c9e645604 [USBSTOR]
- Implement retrieving adapter descriptor (IOCTL_STORAGE_QUERY_PROPERTY)
- Implement retrieving device descriptor (IOCTL_STORAGE_QUERY_PROPERTY)
- Next Function to implement is SRB_FUNCTION_EXECUTE_SCSI

svn path=/branches/usb-bringup/; revision=51607
2011-05-06 13:29:27 +00:00
Johannes Anderwald c5af801a10 [USBSTOR]
- Rename common device extension, it conflicts with classpnp.h header structures
- Start implementing disk ioctls
- Implement SRB_FUNCTION_CLAIM_DEVICE, SRB_FUNCTION_RELEASE_DEVICE

svn path=/branches/usb-bringup/; revision=51585
2011-05-05 00:39:00 +00:00
Johannes Anderwald dd5249b4b6 [USBEHCI_NEW]
- Silence debug flood

svn path=/branches/usb-bringup/; revision=51584
2011-05-05 00:35:56 +00:00
Johannes Anderwald c071ae0f59 [USBSTOR]
- Make DeviceId generation to match ms usbstor
- Don't hardcode the device type in USBSTOR_PdoHandleQueryHardwareId
- Don't hardcode device type in USBSTOR_PdoHandleQueryCompatibleId
- Hackfix generation of instance id
- Add comments
- Cleanup code
- Usbstor now receives ioctl from disk.sys

svn path=/branches/usb-bringup/; revision=51582
2011-05-04 23:14:32 +00:00
Michael Martin e84208fd18 [USBHUB_NEW]
- Add UsbDeviceHandle to child device extensions structure to be passed with URB requests.
- Reimplement the Worker Thread DeviceStatusChangeThread called on SCE completion. Each SetFeature and ClearFeature resend SCE request.
Only create the usb child device if the PortStatusChange member of the device extensions was modified.
- Implement CreateUsbChildDeviceObject used for creating a deviceobject for the USB device and initializing it.
- Implement GetUsbStringDescriptor for getting DeviceId, TextDescription and InstanceId from USB Device.
- Move the initial QueryStatusChangeEndpoint to after the hub device receives start pnp.
- USBHUB driver is now back to the same functionality of previous version. Showing the device wizard for connected devices.

svn path=/branches/usb-bringup/; revision=51581
2011-05-04 21:45:55 +00:00
Johannes Anderwald 8d93646c2d [USBSTOR]
- Rewrite hardware id / instance id matching
- Implement support for compatible id
- UsbStor still not attached to disk.sys, needs more research on how to get this done

svn path=/branches/usb-bringup/; revision=51580
2011-05-04 20:19:33 +00:00
Michael Martin 0fe38c839b [USBHUB_NEW]
- Change parameter name for DeviceObject in functions to clearify which device object is to received IRPs.
- Fix a typo in GetPortStatusAndChange that caused the function to return nothing for status and change.
- Call QueryStatusChangeEndpoint to send the first SCE request in Query Bus Releations.
- Complete implementation of StatusChangeEndpointCompletion. Queue a work item for DeviceStatusChangeThread, which will be used to initialize the usb device and create related device objects.



svn path=/branches/usb-bringup/; revision=51576
2011-05-04 12:58:42 +00:00
Johannes Anderwald 062111f2e1 [USBSTOR]
- Don't free device descriptor if it failed to acquire it
- Don't move out of usb configuration array. Found by special pool
- Fix bug when storing interface information which lead to a overwrite
- Implement retrieving generic type for device
- Fix bugs in QueryDeviceId
- Implement querying hardware ids
- Implement querying instance ids
- With these changes, usbstor now initializes and create pdo, which is also enumerated
- Needs more code / fixes so that disk.sys attaches to usbstor
- WIP

svn path=/branches/usb-bringup/; revision=51575
2011-05-04 12:33:01 +00:00
Johannes Anderwald 11ca3bd492 [USBEHCI_NEW]
- Fix warnings
- Fix mingw build

svn path=/branches/usb-bringup/; revision=51573
2011-05-04 12:09:07 +00:00
Johannes Anderwald c2b34a98be [USBEHCI_NEW]
- Invoke status change callback at passive level
- Fill out usb descriptor struct instead passing everything in char array
- Use 1 byte interrupt endpoint packet size for hub for now
- Fill in interface information when SelectConfiguration request is passed. Fixes sce callback and pool corruptions
- Return device descriptor in USBHI_QueryDeviceInformation
- Tested in WinXP with special pool enabled & overrun support

svn path=/branches/usb-bringup/; revision=51572
2011-05-04 11:49:00 +00:00
Michael Martin 9cbc4f8f60 [USBHUB_NEW]
- Add UsbHub_New to build.



svn path=/branches/usb-bringup/; revision=51570
2011-05-04 01:08:37 +00:00
Michael Martin af70a910fb [USBHUB_NEW]
- Start work on reimplementing UsbHub driver.
- Implement SubmitRequestToRootHub, QueryStatusChangeEndpoint, QueryInterface, GetPortStatusAndChange, SetPortFeature and ClearPortFeature.Handle QueryBusRelations.
- Partially implement PNP handling for FDO. When starting the device get all the information about the RootHub the driver will need and enable Power on all ports.
- Partially implement PNP handling for PDO, QueryId and QueryDeviceText.
- WIP



svn path=/branches/usb-bringup/; revision=51569
2011-05-04 01:07:21 +00:00
Johannes Anderwald 7821a805ef [USBSTOR]
- Implement retrieving string device type from SCSI device type
- Handle BusQueryDeviceId
- Implement support routines for sending CBW / CSW / Data
- Implement retrieving device type (SCSI inquiry request)
- WIP

svn path=/branches/usb-bringup/; revision=51567
2011-05-03 19:40:03 +00:00
Johannes Anderwald 991d02daa5 [USBEHCI_NEW]
- Remove function declaration
[USBSTOR]
- Start on usbstor driver (USB Mass Storage Driver)
- Implement reading device descriptor / configuration descriptor
- Implement scanning of configuration descriptor for bulk in / bulk out endpoints
- Implement selecting configuration and interface and verify selected interface
- Implement reading max lun and create child device object for each lun
- Handle PnP requests for functional device object
- Implement support routines to send urb's to lower device object (usbhub)
- Start implementing PDO routines

svn path=/branches/usb-bringup/; revision=51563
2011-05-03 00:15:23 +00:00
Johannes Anderwald bca978808b [USBEHCI_NEW]
- Silence usb bulk control traces

svn path=/branches/usb-bringup/; revision=51507
2011-04-30 18:46:10 +00:00
Johannes Anderwald 6321f84f30 [USBEHCI_NEW]
- Store number of bytes transferred in the transfer descriptors
- Perform queue head completion when the door bell ring has been acknowledged. Fixes race condition between multiple irps in the async list
- Fix calculation of transfer length when the request is an bulk in operation
- Use EndPointDescriptor member to access transfer type / pid direction
- Use MmGetSystemAddressForMdlSafe to retrieve system address for urb buffer
- Fix check if first transfer buffer finishes on first size if the size is of page_size
- With these changes and little luck and good weather, usb mass storage devices have been seen to  work in Windows XP SP3 
- Code inspired of mjmartin usbehci driver and Haiku's usb stack


svn path=/branches/usb-bringup/; revision=51506
2011-04-30 17:44:43 +00:00
Johannes Anderwald 547ea14508 [USBEHCI_NEW]
- Port URB_FUNCTION_CLASS_INTERFACE from mjmartin usbehci driver
- Fix typo in interface declaration
- Disable assert for now
- Return irp status pending when irp is added to the queue
- Fix bug in InternalGetPidDirection
- More work on the bulk transfers, not yet working

svn path=/branches/usb-bringup/; revision=51501
2011-04-30 08:04:35 +00:00
Michael Martin bdfaf318b8 [USBEHCI_NEW]
- Fix a type causing CommitIrp to fail.
- Add a sanity check in StatusChangeEndpointCallBack to check that a pending SCE irp is queued.
- Start Implementing Bulk Transfers. Needs more work.



svn path=/branches/usb-bringup/; revision=51493
2011-04-29 13:16:03 +00:00
Michael Martin 07dbb71da0 [USBEHCI_NEW]
- Set the NakCountReload to 0 in the QueueHead that is set in the Async register, as this is a dead QueueHead marked as halted and does not need it.
- Set the Async register in StartController. Note: The Async and Periodic registers can only be modified when the controller is stopped. 
- Driver now works in Qemu.

svn path=/branches/usb-bringup/; revision=51491
2011-04-29 06:14:44 +00:00
Johannes Anderwald 20a1892864 [USBEHCI_NEW]
- Fix SelectConfiguration / SelectInterface
- By mjmartin

svn path=/branches/usb-bringup/; revision=51490
2011-04-29 03:17:57 +00:00
Johannes Anderwald 3b6ba2f1d8 [USBEHCI_NEW]
- Implement SelectInterface / SelectConfiguration based on mjmartin usbehci driver
- Initialization runs untill SelectInterface request
- Tested with WinXP SP2

svn path=/branches/usb-bringup/; revision=51489
2011-04-29 02:46:04 +00:00
Michael Martin f48754e09b [USBEHCI_NEW]
- hub_controller.cpp: Change RtlSetBit and RtlClearBit to RtlSetBtis and RtlClearBits for Win2k compatibility.

svn path=/branches/usb-bringup/; revision=51488
2011-04-29 02:19:10 +00:00
Johannes Anderwald e8cf4c5591 [USBEHCI_NEW]
- Remove assert for unknown clear feature
- Implement retrieving string descriptors, based on mjmartin usbehci driver
- Start implementing USBHI_RestoreUsbDevice
- Fixup device stack in USBHI_SetDeviceHandleData. Needs more investigation

svn path=/branches/usb-bringup/; revision=51487
2011-04-28 23:59:53 +00:00
Johannes Anderwald 823176506d [USBEHCI_NEW]
- Implement retrieving device / configuration descriptor for usb devices
- Based on mjmartin usbehci driver
- Mass storage device found wizard now pops up (fails to install - WIP)

svn path=/branches/usb-bringup/; revision=51478
2011-04-28 17:45:32 +00:00
Johannes Anderwald a3f701378c [USBEHCI_NEW]
- Move error checking if controller reported an error inside the door bell ring check block
- Extend interface of IUSBRequest to include DeviceAddress, which is needed to retrieve configuration descriptor of newly set address
- Allocate CtrlSetup from nonpaged pool
- Release setup packet on cleanup
- Devices now receive an device address
- Currently asserts while retrieving configuration descriptor as this code path is not yet existant
*** Assertion failed: Urb->UrbHeader.UsbdDeviceHandle == NULL
***   Source File: d:\usb-bringup\drivers\usb\usbehci_new\hub_controller.cpp, line 1118

svn path=/branches/usb-bringup/; revision=51477
2011-04-28 16:40:07 +00:00
Johannes Anderwald ede1d48da4 [USBEHCI_NEW]
- Change interface to return real async queue head
- Set the async queue head register after the controller has been started
- Enable async queue in StartController
- Port DumpDeviceDescriptor from mjmartin usbehci driver
- Remove pseudo queue head from usb queue, instead use the real async queue head exported from IUSBHardwareDevice 
- Get physical address for transfer data in BuildControlTransferQueueHead
- Retrieving device descriptor now ~works, currently stops at setting device address (needs more work)

svn path=/branches/usb-bringup/; revision=51476
2011-04-28 15:16:33 +00:00
Johannes Anderwald 8df637b778 [USBEHCI_NEW]
- Check if the current request type is supported (currently only control is supported, bulk will be implemented soon)
- Fix bug in IUSBRequest::CreateQueueHead
- Code runs now until first device descriptor get request (async / periodic queue not yet enabled)
- mjmartin usbehci status not yet reached
- Let the fun now begin ;)

svn path=/branches/usb-bringup/; revision=51474
2011-04-28 13:13:13 +00:00
Johannes Anderwald ede324a063 [USBEHCI_NEW]
- Cache port status & port change settings because it appears that some ehci controllers do not store the status reset register bit correctly
- This commit is a temporary solutions, needs to be reworked
- Return correct status from HandleClassOther
- Handle IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION to return status success

svn path=/branches/usb-bringup/; revision=51473
2011-04-28 12:41:16 +00:00
Johannes Anderwald 591cffee7c [USBEHCI_NEW]
- Return the physical address of the async queue head in CUSBHardwareDevice::GetAsyncListRegister
- Remove superflous entries from queue head structure, they are processed within IUSBRequest class
- Remove USBHI_GetPortHackFlags, this function has been deprecated
- Add interface functions for IUSBRequest / IUSBQueue
- Callback into IUSBQueue when a hardware interrupt arrives
- Implement callback function to check for completed queue heads / free completed queue head depending on the Async Advance interrupt bit

svn path=/branches/usb-bringup/; revision=51466
2011-04-27 16:23:42 +00:00
Johannes Anderwald 346a95197f [USBEHCI_NEW]
- Fix build 
- Implement retrieving configuration descriptor (USBHI_GetUsbDescriptors)
- Implement function to build a setup packet from urb (taken from mjmartin usbehci driver)

svn path=/branches/usb-bringup/; revision=51443
2011-04-24 09:26:22 +00:00
Johannes Anderwald 982eb59ba0 [USBEHCI_NEW]
- Create member for storing the request object
- Add interface function which is invoked when the queue head should be freed
- Add support functions which deal with completed queue heads

svn path=/branches/usb-bringup/; revision=51440
2011-04-23 19:36:23 +00:00
Michael Martin 4dff45da57 [USBEHCI_NEW]
hub_controller: 
- Implement  StatusChangeEndpointCallBack called by HardwareDevice class when port status has changed on controller.
- Move Status Change Endpoint query code to IQueryStatusChageEndpoint as it is also needed by StatusChangeEndpointCallBack.
usb_request: 
- Implement InternalCreateUsbRequest.
usb_queue:
- Implement  CreateUsbRequest and AddUsbRequest
hardware:
- Implement GetAsyncListRegister and GetPeriodicListRegister.
- Implement SetStatusChangeEndpointCallBack for setting callback and context. Call the callback when a port status changes.
- Initialize the UsbQueue after creating the AsyncQueueHead, as the UsbQueue calls will call back with GetAsyncListRegister.



svn path=/branches/usb-bringup/; revision=51407
2011-04-20 04:30:22 +00:00
Johannes Anderwald d4f7a44a18 [USBEHCI_NEW]
- Fix warning because comparing signed vs unsigned
- Implement function for retrieving the device descriptor
- Implement function for retrieving a configuration descriptor (including contained interface descriptor and endpoint descriptor)
- Cleanup interface for IUSBRequest:
- When caller initializes IUSBRequest with an IRP, then the operation mode is asynchronously. Therefore when the request is completed, IUSBRequest::ShouldReleaseRequestAfterCompletion will return true, which makes IUSBQueue call Release on IUSBRequest
- When the caller initializes IUSBRequest with an setup packet, the operation mode is synchronously. After submitting the IUSBRequest to queue, the caller should call IUSBRequest::GetResultStatus. This function will then block untill the operation has been completed. However, the caller needs to call Release() as those requests are not cleaned up by the IUSBQueue


svn path=/branches/usb-bringup/; revision=51406
2011-04-19 18:35:40 +00:00
Michael Martin 9b8bc8512c [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
2011-04-19 15:06:26 +00:00
Michael Martin 775c4ce80d [USBEHCI_NEW]
- hub_controller: Implement Status Change Endpoint for RootHub. 
Handling the URB can return STATUS_PENDING, as in the new SCE code. Check for this before completing the Irp.
Uncomment calls to PortStatus, SetPortFeature, and ClearPortStatus now that they are implemented.
- For function receiving a port number check that its not larger than the actual number of ports on the controller.

svn path=/branches/usb-bringup/; revision=51401
2011-04-19 13:57:32 +00:00
Michael Martin 40e499c2d4 [USBEHCI_NEW]
- Forgotten changes in r51397.

svn path=/branches/usb-bringup/; revision=51398
2011-04-19 07:36:44 +00:00
Michael Martin c3d1d6fda9 [USBEHCI_NEW]
- Move USB_REQUEST_SET_FEATURE / USB_REQUEST_GET_FEATURE flags to header file.
- Remove QueueHead and Descriptor creation as its in UsbRequest.
- Move DMACommon Buffer allocation back to UsbHardwareDevice class.
- Implement Port Handling functions GetPortStatus, ClearPortStatus and SetPortFeature.
- Implement GetUSBQueue for returning pointer to UsbQueue and GetDMA to return DMAMemoryManager.
- Fix a typo in one of the defines for Port Register Flags.

svn path=/branches/usb-bringup/; revision=51397
2011-04-19 06:56:30 +00:00
Johannes Anderwald 3ac2c07f55 [USBEHCI_NEW]
- Null terminate buffer from IOCTL_USB_GET_ROOT_HUB_NAME, fixes usbview problems
- Implement URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER, IUSBHardware needs more work
- Silence debug traces
- Start implementing IUSBRequest interfaces
- Complete unhandled major irp with status success

svn path=/branches/usb-bringup/; revision=51396
2011-04-19 01:21:10 +00:00
Michael Martin d3e13a4ada [USBEHCI_NEW]
- Use PQUEUE_HEAD as the Head of pending list  and Async (Active) list vice using PLIST_ENTRY.
- Implement linking/unlinking a QueueHead to these Head QueueHeads.
- Implement chain linking/unlinking of QueueHeads. Thr plan being to used these functions during DMA operations to pull a number of QueueHeads from the pending list to place into the Async list for execution. 
- Will look for optimization in these functions later.

svn path=/branches/usb-bringup/; revision=51390
2011-04-18 11:34:02 +00:00
Michael Martin 9067f34e6f [USBEHCI_NEW]
- Use LIST_ENTRY in QueueHeads and Descriptors vice Next and Previous Pointers.
- Add functions to interface for setting AsyncListRegister and PeriodicListRegister.
- USBHardwareDevice: Initialize USBQueue when handling PNPStart.
- USBQueue: Allocate Common Buffer and use it to Create and Initialize DmaMemoryManager object.
- USBQueue: Implement CreateQueueHead and CreateDescriptor.

svn path=/branches/usb-bringup/; revision=51388
2011-04-18 00:06:37 +00:00
Johannes Anderwald a2b99febfa [USBEHCI_NEW]
- Add interface function GetHubControllerSymbolicLink
- Implement IOCTL_USB_GET_ROOT_HUB_NAME for usbview

svn path=/branches/usb-bringup/; revision=51387
2011-04-17 22:38:32 +00:00
Michael Martin bbad937d99 [USBEHCI_NEW]
- Update interfaces with new methods needed for UsbHardWare class.
- Remove GetDmaMemoryManager as the DmaMemory will only be needed by UsbQueue class.
- GetDeviceDetails: Only fill in a parameter if its not null.
- Start implementing UsbQueue class.

svn path=/branches/usb-bringup/; revision=51386
2011-04-17 22:06:20 +00:00
Johannes Anderwald d8b732ed43 [USBEHCI_NEW]
- Implement IRP_MN_QUERY_DEVICE_RELATIONS for hub controller object
- Implement stub handler for URB_FUNCTION_CLASS_OTHER, URB_FUNCTION_SELECT_CONFIGURATION
- Partly implement URB_FUNCTION_GET_STATUS_FROM_DEVICE
- Return success from unimplemented USBHI_Initialize20Hub routine
- based on mjmartin usbehci driver
- Tested in Windows XP SP2

svn path=/branches/usb-bringup/; revision=51385
2011-04-17 21:35:25 +00:00
Johannes Anderwald 5290479c41 [USBEHCI_NEW]
- Setup a default device descriptor for the root hub and initialize it with vendor & product id
- Partly implement URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE, URB_FUNCTION_CLASS_DEVICE
- based on mjmartin usbehci 

svn path=/branches/usb-bringup/; revision=51384
2011-04-17 19:23:13 +00:00
Johannes Anderwald 79bfd697d0 [USBEHCI_NEW]
- Fix bug in CDMAMemoryManager initialization, which calculated the bitmap length wrong
- Create interface IUSBDevice, which will be used to abstract connected usb devices
- Implement support functions for the device interface. 
- Implement USBHI_CreateUsbDevice, USBHI_InitializeUsbDevice, USBHI_GetUsbDescriptors, USBHI_RemoveUsbDevice, USBHI_GetExtendedHubInformation, USBHI_RootHubInitNotification, USBHI_SetDeviceHandleData, USBDI_GetUSBDIVersion, USBDI_IsDeviceHighSpeed
- Partly implement USBHI_QueryDeviceInformation
- Based on mjmartin usbehci 

svn path=/branches/usb-bringup/; revision=51372
2011-04-17 08:20:40 +00:00
Johannes Anderwald e06b7ac5cc [USBEHCI_NEW]
- Implement IDMAMemoryManager interface, with IDMAMemoryManager::Allocate, IDMAMemoryManager::Free
- Fix interface of IDMAMemoryManager
- Will be used by IUSBHardwareDevice

svn path=/branches/usb-bringup/; revision=51369
2011-04-16 12:26:06 +00:00
Johannes Anderwald 767daa4af0 [USBEHCI_NEW]
- Add reference count when the hub controller is created. Necessary to prevent the controller from getting deleted when the hub driver performs interface reference removes
- Implement IRP_MN_QUERY_ID, based on mjmartin ehci driver
- Fix bug in IRP_MN_QUERY_BUS_INFORMATION, it is supposed to return a PNP_BUS_INFORMATION not a simple guid
- Implement IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE, IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO, IOCTL_INTERNAL_USB_GET_HUB_COUNT based on mjmartin ehci driver
- Add interfaces for communicating with the hub driver
- Dispatch internal device requests not wmi requests (EHCI_Dispatch)

svn path=/branches/usb-bringup/; revision=51368
2011-04-16 09:47:43 +00:00
Michael Martin b8c05840fb [USBEHCI_NEW]
- Change VendorId and DeviceId to the same size as PciConfig members, PUSHORT.
- Add support function GetBusInterface.
- Implement GetDeviceDetails and ResetPort.

svn path=/branches/usb-bringup/; revision=51367
2011-04-16 06:59:45 +00:00