uhci.c: 770 : 	HalAssignSlotResources is passed a wrong slot number which cause
				the function to crash. This param must be the same as the one
				that succeeds the call to the previous HalGetBusData.
								2002.10.13-19:00

uhci.c: 805 :   HalTranslateBusAddress returns BOOLEAN rather than NTSTATUS. The
				mistake cause the control always fall into the error processing.
								2002.10.14-8:30

uhci.c: 526 :  	uhci_delete_device did not initalize symb_name before it is used
				to IoDeleteSymbolicLink.
								2002.10.14-21:00

td.c:	248 :   IsEmptyList should return TRUE when about to return. a mistake.
								2002.10.14-21:25

uhci.c: 1119:   uhci_init_schedule is passed an uninitialized uhci->pdev_ext which
				cause the BLUE SCREEN.
								2002.10.14-22:45
								
uhci.c: 878 :   pci interrupt is always level sensitive, so IoConnectInterrupt
				will not succeed with latched.
								2002.10.15-23:05

hub.c: 1064 :  	hub's interface should be of class USB_CLASS_HUB, not USB_DT_HUB,
			    which cause blue screen.
								2002.10.16-23:30

td.h:  726  :   ListNext will fall into endless loop when no comparison with the
				head pointer, so does ListPrev
								2002.10.16-23:55
								
hub.c and uhci.c : 
				the thread synchronization method is change to the standard way.
				use pointer to thread rather than thread handle to wait the
				thread to quit.

problems    :   currently there are following problems:

				1. 	do not know how event wont work properly, that is, when it is
				   	initally set to signaled, all the following wait call will
				   	succeed.

				2. 	seems timer dpc for root hub does not work which may results in
					the ref_count for the dev is always 1, and no decrement.

				3.  dev_mgr_destroy will cause crash
								2002.10.17-10:35

hub.c: 547  :	the event should be initialized to SynchronizationEvent, or we have
				to manually reset the event.

hub.c: 806  :   the timer svc was inserted to the templist and then RemoveEntryList
				is called, wrong order.
								2002.10.17-12:00

hub.c: 1686 : 	the if compares return code against USB_STATUS_PENDING while
				uhci_rh_submit_urb returns STATUS_PENDING, that causes the urb is
				freed before it is actually completed.
								2002.10.18-9:00

uhci.c: 821 :   the address space should be I/O space instead of memory space. the
				latter one won't produce correct address for reg io
								2002.10.18-9:00
								
uhci.c: 3111:   wPortChange and wPortStatus is ORed with wrong value, that should be
				used only as feature selector. the port change and status flag bits
				are like USB_PORT_STAT_XXX, and not USB_PORT_FEAT_XXX.
								2002.10.19-12:00

hub.c: 			Port index is started from 1, so its last valid idx is equal to port
				count. There are many occurances of this kind of mistakes in hub.c
								2002-10-19 12:47:03

hub.c:	443 : 	psq_enqueue was wrong by enqueue wPortChange in one status element,
				and wPortStatus in another status element.
								2002-10-19 12:49:11
								
hub.c: 1123 :   rh_driver_init missed to initialize status queue for port 2.
							 	2002-10-19 17:14:56
								
hub.h:  207 :	the l-shift operator is mistakenly wrote to be a less operator.
								2002-10-19 17:23:21
								
hub.c:  476 :	psq_outqueue should return the status dword rather than true or false.
								2002-10-19 18:36:32

hub.c:  327 :   init_timer_svc_pool mistakenly add the first element in event array 
				MAX_EVENTS times, which cause only one element in the event-list at
				any time.
								2002-10-19 22:00:46

uhci.c: 526 : 	dev_mgr was previously assign a wrong address that overlap area of
				uhci, and cause odd crash.
								2002-10-21 21:34:25

uhci.c: 890 : 	uhci->urb_list is not initialized, a potential mistake.
								2002-10-21 22:25:04

uhci.c: 3204:   uhci's register of status change should be written 1 to clear the
				relative bit, but not zero.
								2002-10-21 23:01:02

hub.c:  2681:   pnext_event is not tested with zero before it is used.
								2002-10-22 22:32:33

hub.c:			rh_timer_svc_reset_port_completion and rh_timer_svc_int_completion
				are modified, since the previous design won't raise a reset port
				sequence when the device plugged in the root hub, that the 
				int_data_buf was not updated to indicate the root hub's reset 
				change. the newer version will treat rh_timer_reset_port_completion
				the same role as hub_start_reset_port_completion. and it will 
				change some bit flags in int_data_buf and port_status in hub_ext.
								2002-10-23 00:15:04

hub.c: 2934:    if( hub_ext->child_dev[ port_idx ] ) is a mistake when the
				child_dev[ port_idx ] is zero.
								2002-10-23 00:17:49

uhci.c: 2196:   if( pqh = NULL ), an obvious error.
								2002-10-23 23:08:41
								
uhci.c: 2117:   when the dev is reset, it has no addr, at this time, the control
				transfer should not use pdev->dev_addr but zero instead.
								2002-10-24 00:48:14
								
uhci.c: 2181:   the last td should have an ioc flag set to enable the interrupt.
								2002-10-24 00:49:18

uhci.c: 1682: 	the uhci_dpc_callback did not release fsbr when no ctrl or bulk
				transfer active, which would cause the performance drop 
				drastically.

hub.c:  3167:   this bug cost too much. I can not move forward for more than one
				week: set address with the root hub's address. cause the subsequent
				control request fail to respond. To fix this bug, too many bugs were
				killed. One is in uhci_internal_submit_ctrl, the token field of the
				TD is not generated correctly cause the wrong max length. Also, since
				the device default pipe may have its max packet size greater than 8,
				it results in babble if we blindly get the full device desc at the
				first time. The correct approach is to get the partial descriptor
				within which the max packet size for default pipe is returned. and 
				use this packet size to get to full desc. And one improvement is that
				all the root hub port reset ops are now moved to 
				rh_timer_svc_reset_port_completion. And one frequency measure routine
				is added, since KeQuerySystemTime or KeQueryTicks can only update
				every 10 ms that won't satisfy our requirement for more accurate 
				timing while KeQueryPerformanceCounter can not be called frequently 
				for performance reason. And these days i went to bed after 0:30.
								2002-11-05 22:54:37

hub.c:  1482:   pconfig may be null if the dev is not configured. cause crash when
				disconnecting.
								2002-11-06 23:31:41

hub.c:  3492: 	at this point we are not about to build the usb_config structure.
				which will be done when client driver requests. the error is that
				we try to assign the purb->data_buffer to 
				pdev->usb_config->pusb_dev_desc that is far from initialized.
								2002-11-06 23:35:33

hub.c:  3167: 	we add the new dev to the dev list here, seems nowhere to do this
				else, that will fail the usb_query_and_lock_dev.
								2002-11-09 08:22:31

usb.c:   110: 	miss a break when the dev is found. cause infinite loop
								2002-11-09 08:24:11

usb.h:   166:  	the inner block definition of psetup block the outter psetup, and
				the wValue is not assigned.

hub.c:  2369:   the error condition of port change is odd for root hub. the
				ENABLE_CHANGE of root hub is set during new dev is connected. don't
				know why.
								2002-11-11 08:37:42

hub.c:  1783: 	purb is now invalid if it is finished. so pendp not purb->pendp should
				be used.
								2002-11-14 07:43:28

summury:		currently the driver can react normally to some extreme condition
				and can be unloaded successfully. a great progress.Seems it works
				good now.
								2002-11-17 14:08:16

summury:		from last night, i started to change the driver to be multiple-
				controller capable, the changes in data structures are:

				1. dev manager is now a global variable instead of one part of
				the device extension. 

				2. dev manager is added a host controller device registry and
				a couter. 
				
				3. root_hub is removed from dev manager. And it is now put in host
				controller's structure( uhci, ohci, or ehci ), pdev_ext is also
				removed from dev_mgr.
	
				4. dev_mgr in USB_DEV is now replaced by pointer to HCD, hcd from
				which dev_mgr can be retrieved.

				5. uhci is now added a hcd structure, an interface exported to 
				dev manager.

				6. currently dev manager will take two kinds of task, managing host
				controller and usb dev.
				
				7. dev_extension for uhci will not allocate room for dev_mgr any
				more.

				8. dev_mgr is removed from pdev_ext( DEVICE_EXTENSION ).	
				
				9. the initialization process is changed a little:
					a. dev manager is zeroed in DriverEntry, that means it is still
					left to initialize but dev manager's registry part is ready.

					b. each controller after initialized must register with dev
					manager. and dev manager will return a controller id for them.

					c. all the root hub will be initialized when rh_driver_init is
					called and all destroyed when rh_destroy is executed.
					
					d. now code that needs access to dev manager from dev should use
					dev_mgr_from_dev to get a pointer to it. and uhci_submit_urb 
					no longer exists in dev mgr's functions, instead, hcd->xxx(hcd,...)
					take the place.

								2002-11-24 14:56:46
change summary:
				now a structure is added at the beginning of DeviceExtension of uhci's
				device object. It will be put to every devobj's extension which needs
				external access to the device object. Accordingly, the dispatch routine
				of the driver is now generic_dispatch_routine, which will invoke the
				dispatch for the specific device object if exists.
								2002-11-29 23:39:49

change summary:
				now cbi and bulkonly transfer protocol is added to the built-in mass-
				storage driver. the next target to let the driver to show something
				to application in user mode.
								2002-12-11 23:44:34

change summary:
				now the umss module is complied and need further debug.
								2002-12-14 18:09:03

usb.c:  576:	reduce the condition that once is_composite_dev( pdev ) is called to
				determine if the driver is an interface driver, that is not correct.
								2002-12-15 10:36:06

change summary: 
				now umss module can config the device, and create the device object for
				the device.
								2002-12-15 14:56:23

uhci.c:  3648 : uhci_release can not be called directly if more than one hcd is created.
				Since uhci_unload won't provide the device pointer of the specific hcd,
				( only a device link ). We release each hcd by walking through the hcd
				registry in dev_mgr. Additionally, other device object than hcd, created
				by this driver seems still be present in the device-chain in driver-object,
				if it is deleted immediately before the hcd's IoDeleteDevice is called with
				no context switch.  Don't know why.
								2002-12-20 08:21:37

change summary:
				We are about to make the usb driver composite device capable. The big 
				change would be that the interface driver won't have one seperate USB_DEV,
				and instead, it operates on the dev that contains the interface.
				Accordingly, the pif_dev in USB_INTERFACE is changed to pif_drv. And the
				driver can access the fields if_ext and if_ext_size. The parameter sent to
				dev_connect, dev_stop and dev_disconnect has a bit change in its sementic
				, dev_handle, which should be interpret as a interface handle. the if driver
				is get connected by its parent driver composit device driver, which in its
				dev_connect and dev_stop and dev_disconnect calls relative interface driver
				to act respectively. So, all interface stuff are now responsibility of
				composite device driver.
				
				Currently, we have the following tasks:

				1. debug IOCTL_SUBMIT_URB_XXX.
				2. make the driver interface-capable.
			 	3. debug bulk transfer.
				4. make the umss module an interface driver
								2002-12-27 23:59:36

change summary:
				if driver design guide:
				1. 	driver description packet should be:
						a. the flag has USB_DRIVER_FLAG_IF_CAPABLE set.
						b. dev_class, dev_sub_class, dev_protocol are ignored
						c. if_class, if_sub_class, if_protocol are counted
						d. other info are only for reference
				2. 	can directly modify pdev->usb_config->interf[ x ].if_ext
					and pdev->usb_config->interf[ x ].if_ext_size;
					[ to be continued ]
								2002-12-28 11:55:24

change summary:
				error code are now changed all to STATUS_XXX. and USB_STATUS_XXX
				is set only for usb specific error code.
								2002-12-29 17:05:02
								
change summary:
				we now make the driver irp cancellable to some extent. Any driver that has
				irp in processing, should register the irp with the dev_mgr, that irp will
				be set a cancel routine dev_mgr_cancel_irp. Only irp that needs usb traffic
				should be registered. when calling dev_mgr_remove_irp, the caller must
				guarantee that the urb associated with the irp are still valid in memory.
				currently, we can not cancel the irp in all conditions. If the urb is sent
				to reset the pipe, the irp can not be canceled during that operation. If
				the irp is frozen, the only way is to unplug the device.
								2003-01-05 14:18:10

change summary:
				currently we made a lot of modification in uhci, fixed many bugs, mainly in
				bulk-transfer and uhci_process_pending_endp. the return value of
				uhci_internal_submit_xxx are changed to NTSTATUS from the previous BOOL.
				and thus, urbs error in submit can be aborted rather than leave it hanging
				alone in the heap. CBW should be 1f in size not 2f in size which cause the
				disk won't work.
								2003-01-10 00:32:21

change summary:
				we find a bug in code uhci_remove_urb_schedule when the urb is an int request.
				that is simply a comparison wrongly typed to be an asignment. That cause
				uhci halt when it is restarted with a hub connected.
								2003-01-11 23:40:20
								
change summary:
				we change the time to wait dev stable to 200ms. Since Tansun's idisk won't
				work well. And stable period for low speed is extended to 500ms. And usb
				tree app is now ready to use.
								2003-01-12 23:29:49

change summary:
				we have tried to make the umss's irp queued in system managed queue. And
				thus, add DriverStartIo entry in Driver's dispatch table. This cause several
				modification in the files. The dev_ext_hdr in DeviceExtension is now added
				one fields "start_io", generic_start_io in uhci.c will dispatch the start_io
				request to each device-specic start_io if it has. Another change is the 
				cancel mechanism. This is a very troublesome problem. Currently we solved it
				but not perfect. the defect is that irp-list may use up and the following irp
				can not be tracked and then can not be canceled. the mechanism is astoundingly
				complicated. Both windows NT and my own code contribute a lot to this plight.
								2003-01-23 13:32:41

current task:  	1. 	add get sense key to class driver, the class driver choose to
					fetch sense key from device.
				2. 	create a device object for upper class driver to hook to
					umss driver, and also a data structure for upper class
					driver to hand to umss driver.
				3.  find out the way to manage the device objects for the class
					driver to adapt to pnp message.
				4.  add support to IOCTL_SUBMIT_SRB_XXX to umss driver to make
					it like a port driver. To be more detailed, the following might be
					supported:
				5.  find ways to support time-out ( retry is implemented in class driver )
					for the srb request.
							
				6.  the class driver may support the following ioctl code:	
							a. IOCTL_SCSI_PASS_THROUGH: mandatory
							b. IOCTL_SCSI_MINIPORT: not supported, we have no miniport yet
							c. IOCTL_SCSI_GET_INQUIRY_DATA: mandatory
							d. IOCTL_SCSI_GET_CAPABILITIES: mandatory
							e. IOCTL_SCSI_PASS_THROUGH_DIRECT: mandatory
							f. IOCTL_SCSI_GET_ADDRESS: simulated
							g. IOCTL_SCSI_RESCAN_BUS: simulated
							h. IOCTL_SCSI_GET_DUMP_POINTERS: optional

								2003-01-27 17:27:55

change summary: 1.  dev_connect has its first param changed from PUSB_DEV_MANAGER to
					PDEV_CONN_INIT_PARAM, which add one new member pdriver to hand a
					POINTER to the driver.

				2.  currently we delegate the responsibility to set pdev->dev_driver
					to the dev drivers, and so does the interface driver. the reason is
					that, dev_connect usually can not determine whether the driver
					initialization succeed if it must interact with the device and 
					the request is completed in the callback. So it is proper the driver
					determine the time to set the driver when its initialization
					succeeds, and the set_driver should be done within the dev_lock
					after the dev_state comparison passed. if that is not met, just
					fail the initialization. So it must be REMEMBERED that before the
					dev_driver finish its initialization process, it must call
					dev_mgr_set_driver/dev_mgr_set_if_driver to set the driver fields in
					pdev.
								2003-01-29 12:09:57

change summary:     previously, we call the driver's dev_connect in dev_mgr_connect_to_dev,
					a work-item launched in dev_mgr_event_select_driver. Currently we change
					to directly call the dev_mgr_connect_to_dev in the 
					dev_mgr_event_select_driver. The advantage is simplicity and reduce the
					risk when the work_item is scheduled while the driver is unloading.
								2003-02-02 17:01:11

change summary: 1. fixed two bugs: 
						a. umss_if_connect allocate buffer of sizeof( 512 ) that is 4bytes
						   obviously a mistake. cause undetermined crash.

						b. hub_reset_pipe_completion as the usb_reset_pipe definition, should
						   not free the urb in its control path. the bug occurs when the int
						   pipe is reset, and cause undetermined crash.

				2. currently, seems little error with bulkonly transfer. the loaddrv can run
				   happily.
						        2003-02-05 13:37:10

change summary: 	now, we are engaging in umss driver and the class driver. seems we are 
					expected to do small work to migrate the ddk's scsi sample.
					umss is added support of srb request.
								2003-02-09 23:47:09

change summary:		now, we change the add_device's parameter and pnp_dispach's parameter.
					the first parameter is replaced to pdo instead fdo, class driver is
					responsible to find the proper fdo associated with the pdo.

					add pnp functions in disk.c in scsi class driver.
								2003-02-17 09:42:37

change summary: 	class driver may contains potential bug like this: we asssume the
					hard disk's partition 0 is not mounted by any filesystem.
					another bugs may exist in irp cancel process. we did not test this function
					till now.
								2003-02-24 22:48:23

change summary:		now, the disk can show itself in the explorer and can plug and play
					fixed bugs include:
					1. cbw for auto sense is not initialized in bulkonly.c
					2. open a door to read partition table
					it seems still many bugs exist in the driver
					one obvious bug is that:
					   the file system did not update its data when the content on the disk
					changed from other computer.
								2003-03-05 08:27:57

change summary:     now, we branched to ehci. we have a new mechanism for layered urb processing.
					urb stack. it is described below:
					   	1. it is used only for ctrl transfer. other transfer type won't used it.
					      and the relevant fields has the same initialization as the uhci driver.

						2. for control transfers, that does not use urb stack, ctrl_stack_count
						  is always zero.

                        3. it can be initialized by any driver on the path down to the usb line.
					      and the lower level driver, if has completion, will set it on urb stack
						  too. If no need of completion, pass it down with no increment on urb
						  stack. if no completion, no stack increment allowed.

                        4. the completion on the top of the stack is called first when the transfer
						  finished. the requirement for each completion is that it must call the
						  completion on stack next to its own. The completion on the bottom call the
						  completion from urb->completion if there is one.

						5. if the stack is full, the the current driver needs to have interception
						  on the completion, it must allocate its own urb, with a stack size that
						  it think enough to send down to the bus. Its completion has to call the 
						  completion on the parent urb when it has done. If it needs no stack, it
						  simply not initialize the urb stack and use urb->completion directly. And
						  urb->ctrl_req_context.ctrl_req_flags ORed with CTRL_PARENT_URB_VALID.
						  The completion must check this field to determine where the completion is.
						  The allocator of the urb must deallocate it in its completion. If the urb
						  won't use the stack, it is not allowed to setup a new urb with its 
						  parent_urb pointing back to it.

						6. if urb->completion is zero, it is not allowed to use urb stack. don't
						touch any field in the urb unless it knows what it is doing( filter ).

						7. the urb_completion will touch only certain fields in URB. such as pdev,
						  pendp, data_buffer, data_length. and its stack data.  

						8. max stack size is 0x10

						9. some restrictions is commented at usb_call_ctrl_completion
								Mon 14 Jul 2003.

change summary: 	1. for clients that set interface, they must care the data fields they managed
						such as pif->if_ext and pif->if_ext_size

					2. ?and the clients must guarantee no outstanding request pending on any
					endpoint belonging to the interface before the request returns.

change summary:		1. removal on complete: 
						control/bulk: remove from the schedule, and wait for doorbell.
						int: remove from schedule directly.
						isochronous: remove from schedule directly.

					2. removal on error:
						control/bulk: deactivate the rest td, set doorbell, then wait for qh
						inactive, and then, to remove them from schedule, if active, wait on.

						int: remove from the schedule directly.
						isochronous: if not the last one, continue, else remove from the
						schedule directly.

					3. removal on cancel request:
						control/bulk: same as error removal
						int: deactivate the qtd, remove from the schedule. and wait for doorbell.
						isochronous: N/A.
								Tue 29 Jul 2003 11:49:50 AM CST

change summary: 	schedule for int:
					1. 	for the requests of interval less than 8 uframe( including 8 ), double
					   	links are used to track the request. And, the qhs in the chain are sorted
					   	in descending order of intervals. for those of the same intervals, the
					   	qhs are sorted by the start-uframes( < interval ). If both the parameters
					   	are equal, they are in the order of fifo.

                    2. 	from the int8 request up to the frame_list( leaf dir ), the qhs are linked
						in single list.
								Tue 19 Aug 2003 04:00:55 PM CST

change summmary:    user dpc needs to scan the trasac_list to find the error if any.
								Wed 20 Aug 2003 06:11:36 PM CST

change summary: 	the urb to cancel can only be in URB_FLAG_STATE_IN_PROCESS
					the urb.status is the td's status when the urb is off the urb-list
					iso transfer errors can only be acquired by scanning through the td list
								Fri 22 Aug 2003 04:58:19 PM CST

change summary: 	if the request can not acquire the tt for the split transaction, all the
					subsequent requests is aborted.

					note: hub port index is started from 1.

change summary:		if ehci_claim_bandwidth failed, the request is aborted and returned
					immediately( previously, it is queued to try later )
								Wed 17 Sep 2003 04:30:34 PM CST

change summary:     split iso IN has a limitation: the last byte may be dirty in the last
					iso_frame_desc. it is because the sitd is scheduled across frame boundary.
								Wed 17 Sep 2003 06:17:41 PM CST

change summary:		high speed iso has a limitiation on requests at 1 interval. Its 
					iso_packet_desc.offset is ignored. and only length when passed down
					is used. because we can only accept a single buffer with contigous
					data sequence.
								Thu 18 Sep 2003 03:25:38 PM CST

change summary:		add a union in urb, parallel with setup_packet for iso_max_packet_size
					the pipe_content's max_packet_size for iso transfer( either high/full )
					is not true.
					add a mult_count in urb->pipe since for iso/int endpoint.	
								Fri 19 Sep 2003 03:31:33 PM CST

change summary:		we now add a type flag to elem_head_link->phys_part's lower five bits.
					and there is a bug: the last sitd for case 2a,2b with reduant sstart is
					not budgeted with bandwidth claimation.
								Fri 19 Sep 2003 03:34:15 PM CST

change summary:     FSTN is not counted in urb->td_count
