Commit Graph
73 Commits
Author SHA1 Message Date
joevt fd9899ae87 dbdma: xfer_quad improvements and fixes.
- 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.
2026-07-15 07:52:16 -07:00
joevt ff911cc056 dbdma: Add is_active to more methods. 2026-07-15 07:11:18 -07:00
joevt 7af1235b8e dbdma: Flush only applies to INPUT commands. 2026-07-14 20:25:11 -07:00
joevt 06ea4a844e dbdma: Add is_active. 2026-07-14 20:23:41 -07:00
joevt 813350f14a dbdma: Remove superfluous update_irq method. 2026-07-14 19:57:37 -07:00
joevt 4bcd96e6b1 dbdma: Save current dbdma cmd host address.
Use the saved address for finish_cmd.
2026-07-14 19:24:03 -07:00
joevt 83775309e9 dbdma: Set res_count at beginning of command.
Don't need to reset it at the end of a command.
2026-07-14 18:52:22 -07:00
joevt 2a3b6d9cb7 dmacore: Rename is_ready.
So that it is not confused with other contexts.
2026-07-14 18:48:10 -07:00
joevt fce52eacfb dbdma: Remove interpret_cmd result. 2026-07-14 07:59:22 -07:00
dingusdev e5b8ff49e4 Restore clearing CH_STAT_FLUSH
This is still required so that the MacTest Pro (Nov. 99) CD can boot up.
2026-07-13 08:30:35 -07:00
Mihai Parparita 36420c55b9 dbdma: Report residual descriptor byte counts
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`).
2026-07-07 11:06:55 +02:00
joevt 37da4d3162 dmacore: Add DmaPushResult. 2026-07-02 08:10:04 -07:00
joevt 3e9397c478 dbdma: Set queue_len after all other fields.
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.
2026-07-02 08:07:54 -07:00
joevt dd5ba1dcfc dbdma: Fix setting of gp channel control bits. 2026-06-18 20:06:44 -07:00
joevt d3483523d6 dbdma: Fix spelling. 2026-06-18 20:06:35 -07:00
joevt 67418b07b0 dbdma: Maintain and report res_count. 2026-06-18 20:06:12 -07:00
joevt cbe840ff3f dbdma: Set flush status when doing flush command. 2026-06-18 19:43:52 -07:00
joevt 290c575503 dbdma: Fix indenting of flush handler. 2026-06-18 19:43:30 -07:00
Maxim Poliakovski 0e2ffa7863 Move endianswap.h to core/* 2026-06-07 21:10:51 +02:00
Maxim Poliakovski 0e03cac082 Move memaccess.h to core/* 2026-06-07 20:32:46 +02:00
Maxim Poliakovski 0f14a075cc dbdma: fix pausing/resuming of channel execution.
Suspend execution only if the ACTIVE bit is set.
Resume execution only if the channel was previously suspended.
2026-06-02 02:47:47 +02:00
Maxim Poliakovski 767811b952 dbdma: send notification messages to devices. 2026-05-29 23:36:24 +02:00
Maxim Poliakovski 30d95e1409 dmacore: add support for several channels per device. 2026-05-29 23:22:16 +02:00
Maxim Poliakovski 4138074789 dbdma: rewrite CH_STAT update logic. 2026-05-29 23:16:07 +02:00
Maxim Poliakovski 0f4b4c0f67 dbdma.cpp: fix CommandPtrLo update.
Some Apple docs state that the CommandPtrLo can be written
if both the run and active bits are cleared.
Later docs say that only the active bit needs to be cleared.
Fix the code to conform to the logic of the latter.
2026-05-18 22:01:41 +02:00
Maxim Poliakovski ab1f9c59bc dbdma: fix endianness for STORE_QUAD targeting MMIO. 2026-05-16 00:13:16 +02:00
joevt f7b5a440e8 dbdma: Use saved_cmd_bits. 2026-04-04 17:17:13 -07:00
Copilotandjarz 798af27514 dbdma: Fix update_irq bug in finish_cmd.
Co-authored-by: jarz <90255+jarz@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-04-04 17:16:52 -07:00
dingusdev 213dd4c16e Update copyright info further 2026-01-30 08:12:04 -07:00
Maxim Poliakovski e75ee8d32a Update copyright year. 2026-01-30 12:15:00 +01:00
dingusdev b813a080da Add additional registers to read for DMAReg 2025-12-04 06:52:48 -07:00
Maxim Poliakovski ee776e41cf dbdma: warn for unexpected amount of data in xfer_from_device. 2025-09-21 00:24:33 +02:00
Maxim Poliakovski c742beb623 sc53c94: return actual number of bytes transferred
in xfer_to and xfer_from methods.
2025-04-01 04:02:51 +02:00
Maxim Poliakovski 2d61e4c604 dbdma: implement new DmaChannel methods. 2025-04-01 04:01:26 +02:00
Maxim Poliakovski 5057792d4d dbdma: implement xfer_to_device method. 2024-12-03 11:37:18 +01:00
Maxim Poliakovski 04899d6528 dbdma: prevent STOP from updating xferStatus. 2024-11-30 12:12:32 +01:00
dingusdev d279ada718 Revert "dbdma: Schedule interpret_cmd."
This reverts commit e1849a2bfd.
2024-11-17 06:49:43 -07:00
joevt e1849a2bfd dbdma: Schedule interpret_cmd.
Have the entire dbdma program executed by scheduling each iteration in the CPU loop.
This is done only for devices that use the dbdma program to drive data input/output (has_data_callbacks) rather than have the device drive the dbdma program.
2024-11-16 10:30:20 -07:00
joevt fc89fec3e6 dbdma: Do interrupt after setting resCount and xferStatus. 2024-11-10 06:24:24 -07:00
joevt 15986a4e4f dbdma: Allow clearing only control bits.
Only control bits can be set and cleared by software.
Command bits and status bits cannot be cleared.
2024-11-10 06:23:35 -07:00
joevt d56520d22a dbdma: Set active only when wake is set. 2024-11-10 06:22:38 -07:00
joevt f415a63b76 dbdma: Allow Stop command to set xferStatus.
Some software may check the status flags of a Stop DBDMA descriptor.
2024-11-09 21:05:32 -07:00
joevt 50e661f804 dbdma: Resume should continue DBDMA program.
Just like Start does.
2024-11-09 21:05:27 -07:00
joevt 7ffafdc007 dbdma: Implement branch taken flag. 2024-11-09 20:31:54 -07:00
joevt 96875a1278 dbdma: Clear active flag if paused flag is set.
The active flag is cleared when the pause flag is set, so why shouldn't the active flag be cleared when the start flag is set with the pause flag is already set?
2024-11-09 19:59:52 -07:00
Maxim Poliakovski 86ce9b0bb1 dbdma: support for non-DWORD register reads. 2024-11-03 15:10:33 +01:00
Maxim Poliakovski babd8d974f dbdma: fix cmd.resCount update. 2024-07-22 17:45:48 +02:00
Maxim Poliakovski 4a425c4ecf dbdma: introduce new DMA API. 2024-07-15 02:09:15 +02:00
Maxim Poliakovski 293e869acb dbdma: break long lines. 2024-07-15 02:09:15 +02:00
joevt 11d61359c1 dbdma: Add data callbacks.
Allow the dbdma program to initiate reading/writing by adding in and out callbacks.
Support the DBDMA flush command by adding a flush callback. If the transfer completes, then clear the flush flag, otherwise leave it unchanged.
Clear the flush flag after it is copied to the xferStatus of the DBDMA command.
2024-04-24 07:09:56 -07:00