This changes a BX_INFO to a BX_DEBUG. It does not needed to be a
BX_INFO.
Second, this adds (very) minimal support for SCSI command 0xAC.
When emulating a .iso image via USB CD-ROM on Win10, without this
command, the emulation freezes when trying to access the CD-ROM. I don't
know if it is Bochs or Win10. I think Win10 expects the command to work,
or Bochs is not failing correctly.
This PR simply adds code to acknowledge the command and returns a zero
length report. This SCSI (MMC) specification states that a zero length
report is allowed.
The 8 byte header is returned, but the header indicates a zero byte
return: No report segments returned.
This seems to keep Win10 from freezing at USB CD-ROM device access time.
The code also BX_DEBUG's the command sent to the "controller", for
future use when adding the actual support of the command.
This PR allows larger VHD image files. The size in question doesn't
necessarily mean the size of the VHD file on disk. The size is the total
size of the image emulated. This total size is in question.
Without this patch, the total size allowed is 65535 * 16 * 255, or
roughly 32gig.
With this patch, the total size is calculated by who the creator of the
image is, what the CHS values are, and possibly a total size of up to a
limit of 2TB.
Since the original code was ported from QEMU, I ported an updated QEMU
code snippet.
https://gitlab.com/qemu-project/qemu/-/blob/master/block/vpc.c?ref_type=heads#L305
This PR now allows VHD image files with a total size emulated less than
or equal to 2TB.
This improves the detection of the default speed of a device when given
in bochsrc.
It will first get the max speed of the port given. For example, uhci and
ohci will return FULL, ehci will return HIGH.
xHCI will return SUPER if the port is a super-speed port, else it will
return HIGH.
Then it will compare this with the max speed allowed for that device,
returning the highest common speed.
Of course, if the speed option is given, the above is overwritten by the
specified speed.
Both checks are still performed on the result.
1) does device allow the result speed?
2) does the controller allow the result speed?
This adds three additional checks to make sure the Guest is working
correctly.
- checks that the guest allocated the Scratchpad Area. If left zero
(NULL) the controller may access low memory.
- checks that the guest uses correct segment sizes in the interrupter
ring(s)
- checks the burst size value given to be within normal range
This also adds an internal register value for the HcCrcr (Command Ring
Control) register. Since this register reads zero by the Guest, we keep
an internal value so that the emulation can read the value, internally.
This is for features soon to be released.
Minor other syntax/comment changes (misspelled word, etc)
Checked with WinXP, Win7, and Win10
This fixes zero length packet handling.
See the following example that requests 128 bytes:
```
SETUP(8)
IN(64)
IN(64)
STATUS(0)
```
The current code erroneously assumes that there are no more IN packets
after the first two 64-byte packets.
However, what happens with the following:
```
SETUP(8)
IN(64)
IN(64)
IN(64) <--- current code assumes this will be, and expects a STATUS packet
STATUS(0)
```
Currently, the third IN(64) above will result in a coding error because
the code is expecting the STATUS packet, not another IN packet.
The "controller" must allow for more packets than expected, returning a
short packet detect on the third IN(64) packet shown above, actually
returning zero bytes, hence the Short Packet Detect.
This patch was tested on WinXP, Win7, and Win10.
The check for the amount of byte transferred in one frame time was done
before the update of the vertical pointer in the current Queue of the
last executed TD. Therefore, on the next frame time, the last executed
TD was being "executed" again. The check has now been moved to the top
of the loop.
This adds over-current signaling to the USBs four host controllers.
To signal an OC, use the runtime configuration and set the checkbox (GUI) or text config's parameter to 1.
This pull request also adds USB documentation to user.dbk.
The 'd.pcap_image_t pcapture' in usb_common.h called its constructor and set 'fd' to -1. However, in the usb_device_c() constructor, we then cleared all of 'd', resetting pcapture.fd back to zero. Then on Bochs exit, the pcap_image_t destructor tried to close the file since 'fd' was zero instead of -1. To fix this, I removed the pcap_image_t constructor and now call pcap_image_init() within the usb_device_c constructor.
Added examples for new options.
- xhci: model= option
- xhci: allow the user to select number of ports
- usb disk: proto= option (bbb or uasp)
Added xhci primary stream support.
(Secondary stream support is not included)
Added (experimental) usb disk protocol UASP for super- and high-speed usb disk devices.
(high-speed uasp support is not thoroughly tested)
xhci: fixed "change event" function
scsi: fixed bug in command 0x25
scsi: added command 9E/10
Minor:
Check speed indicator in the Transfer Descriptor matching the device speed.
Max packet size check, checking that the amount requested/sent is within limits.
Checking that the first packet sent is the GetDescriptor Request with a length equal to or less than the max packet size.
Checking the command length in the USB SCSI emulation.
Checking command parameters within various emulations (SCSI (BBB), etc.)
Implemented "Boot Protocol" for the (HID) Mouse emulation.
Fixed wheel mouse HID report (along with the other HID reports)
Added the Over Current bits to the UHCI code
Added the monitoring of the toggle bit in the TDs
Major:
Re-wrote the UHCI stack processing so that control and bulk reclamation can be used.
(This made it so Windows 7 now works)
Adding function to the USB SCSI emulation.
Enhanced the xHCI emulation to further check for errors in a driver.