ATAPI devices should NOT implement ATA IDENTIFY DRIVE
command (ECh) to avoid their false identification as ATA
drives. They should implement ATAPI IDENTIFY DEVICE
command (A1h) instead.
This reverts commit da7c8a4579.
- Make the method call less confusing.
- Use cur_host instead of passing cmd_struct.
- Pass a boolean to differentiate LOAD_QUAD and STORE_QUAD.
- Use xfer_size instead of req_count for res_count.
- Don't LOAD_QUAD to read-only DBDMA command.
Happened to notice that we were not marking the framebuffer as dirty
when doing this update. Liekly not an issue in practice since there are
usually other updates, but might as well be correct.
Implement the accelerated same-format source-copy operation (used by the
Mac OS X Public Beta when dragging windows).
Supports raw 8, 15, 16, and 32 bpp copies. Rejects unsupported mixes,
format conversions, partial write masks, color comparison, and source
trajectory modes.
Implement push_data in AtaBaseDevice using the device transfer buffer and
post-transfer callback.
Advance the read data pointer across DMA pulls so a transfer can span
multiple DBDMA descriptors, and clear the DMA state when transfers finish.
We were reading the entire disk image into a stringstream for
deterministic mode, which is slow and memory-intensive. Instead on POSIX
hosts we can use `mmap` to lazily map the disk image into memory, allowing
it to be streamed in as the guest actually needs data from it.
Helps with iteration speed when debugging via deterministic mode.
Mac OS X Public Beta commonly drives one ATA DMA transfer through
multiple DBDMA descriptors, so a single ATA pull can be smaller or larger
than the current descriptor request without indicating an error.
Reduce the logging level to avoid logspam during boot.
We were treating resCount as a "result" count, but it's actually a "residual"
count that reports how many bytes from a descriptor were not transferred
when processing a command. We now correctly handle partial descriptors.
This ended up being necessary for the 10.0 public beta bringup too (the
`AppleUltra66ATA::stopDma` implementation in xnu-103 computes the number
of bytes transferred by subtracting `resCount` from `reqCount`).
Followup to #186 - select `MSR[POW]` handling mode once during CPU
initialization instead of treating every processor as `HID0`-gated.
We match documented (and QEMU) behavior:
- 603/7xx CPUs require `HID0` doze, nap, or sleep bits before we enter
the emulator sleep loop
- 604-family CPUs use just for `POW` directly
- 601 does not support `POW` at all
If queue_len is a flag to determine when data is queued, then it
probably should be set last so that the other fields are valid when
another thread decides to act on the queued data.
xnu-123.5 and similar vintage kernls enter the PowerPC 750 powersave mode
when the scheduler has no runnable work. `machine_idle_ppc` selects HID0
doze or nap, records a nap timestamp, then executes mtmsr with MSR[POW]
set. It stays in a loop there (in case the power saving had no effect
immediately) - it expects execution to resume at the `machine_idle_ret`
label (when an interrupt occurs), which ends up returning from the
function.
We model this state explicitly:
- When mtmsr sets MSR[POW] with the HID0 doze/nap/sleep flags, set a new
EXEF_SLEEP flag.
- When EXEF_SLEEP is set, keep processing host events without advancing
the guest PC.
Towards getting the 10.0 public beta to boot (#154) - before this we
would enter the DPPC debugger shortly after this instruction (due to a
bogus MSR LE flag eventually being set). Now we make more progress and
end up in a "Still waiting for root device" loop (presumably something
at the ATA layer)