Re: Usb troubles with MSD (scsi reads)
Posted: Fri Nov 24, 2017 12:22 am
Erm, I'm looking at the code now and I'm wondering what the hell I'm reading. The interrupt firing early is the least of your problems. There are quite a few things here that are fundamentally wrong, such as:
- There is no such thing as a "stack" of queues! If the Link Pointer of a Queue Head has the T bit set, it marks the end of the frame. To avoid an infinite loop if the HCD makes use of bandwidth reclamation, the time taken for each transfer must be counted up, and processing must stop once the time spent exceeds the allowed maximum.
- If a packet does not complete successfully, Bochs happily advances the queue anyway.
- If the device handler returns USB_RET_ASYNC, the NAK bit is not set as it ought to be.
- If the device handler returns USB_RET_NAK, the ActLen field is set to 0x7fd.
- If a short packet is detected, all further queues will become stuck if a packet completes successfully.
- There is no such thing as a "stack" of queues! If the Link Pointer of a Queue Head has the T bit set, it marks the end of the frame. To avoid an infinite loop if the HCD makes use of bandwidth reclamation, the time taken for each transfer must be counted up, and processing must stop once the time spent exceeds the allowed maximum.
- If a packet does not complete successfully, Bochs happily advances the queue anyway.
- If the device handler returns USB_RET_ASYNC, the NAK bit is not set as it ought to be.
- If the device handler returns USB_RET_NAK, the ActLen field is set to 0x7fd.
- If a short packet is detected, all further queues will become stuck if a packet completes successfully.