Fix USB CD-ROM hang on old UHCI hosts + read-ahead cache for USB 1.1 performance#199
Open
iTechMedic wants to merge 2 commits into
Open
Fix USB CD-ROM hang on old UHCI hosts + read-ahead cache for USB 1.1 performance#199iTechMedic wants to merge 2 commits into
iTechMedic wants to merge 2 commits into
Conversation
DOS USBASPI on Intel PIIX4 UHCI (e.g. Gateway G6-233/440LX) pauses the bus schedule between enumeration steps. After >3ms of silence the DWC2 core reports a USB suspend, but the gadget driver had no resume path: every EP interrupt while suspended (including SETUP_DONE) was acknowledged and dropped, and only a bus reset could revive it. USBASPI resumes the bus without resetting, so its SETUP was silently discarded and it waited forever at "Scanning USB Devices...". Confirmed via debug log: USB reset -> enum done -> suspend -> total silence, repeating. Windows never hits this because its UHCI driver doesn't pause SOFs mid-enumeration. Adds HandleUSBResume(), unmasks DWHCI_CORE_INT_MASK_WKUP_INTR, and tracks m_StateBeforeSuspend so EP activity received while suspended (implicit resume, no reset) restores state and is processed instead of dropped. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Implements a 128KB sector read-ahead cache in CCueBinFileDevice to reduce SD card latency visible on the low-bandwidth USB 1.1 link. Seek() now just records the logical position; Read() checks the cache first and on a miss reads a larger window so sequential reads (the common case for game data and Redbook audio streaming) become cache hits instead of incurring fresh SD card round-trips. Improves perceived smoothness of loading and audio playback on Full Speed USB without changing the bandwidth ceiling (still ~1MB/s realistic throughput).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two complementary fixes for USB 1.1 compatibility and performance:
Fix USB CD-ROM enumeration hang on old UHCI hosts — DOS USBASPI on Intel PIIX4 (e.g. Gateway 440LX) pauses the
bus schedule between enumeration steps. The DWC2 gadget core reported suspend, but Circle's gadget driver had no
resume path: every EP interrupt while suspended was dropped, making USBASPI wait forever at "Scanning USB
Devices...". Now handles the wakeup interrupt and restores state on implicit resume (no reset), so USBASPI's resumed
traffic is processed instead of dropped.
Add read-ahead cache to CUE/BIN image reader — Reduces SD card latency on USB 1.1's low-bandwidth link. Seek()
records position lazily; Read() checks a 128KB cache first and reads a larger window on miss, so sequential reads
(game data, Redbook audio) become cache hits instead of fresh SD card accesses. Improves perceived smoothness without
changing the ~1MB/s throughput ceiling.
Tested on Gateway G6-233 (440LX/PIIX4) with USBASPI 2.27 + USBCD + MSCDEX.
Test plan