aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-02-13esp.c: don't use get_cmd() for CMD_SEL DMA commandsMark Cave-Ayland1-12/+10
This can now be done using the existing logic in esp_do_dma() and do_dma_pdma_cb(). Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-52-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: move CMD_TI end of message phase detection to esp_do_dma() and ↵Mark Cave-Ayland1-14/+18
do_dma_pdma_cb() The existing check for TC == 0 is only valid during a TI command. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-51-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: move CMD_SELATN end of message phase detection to esp_do_dma() and ↵Mark Cave-Ayland2-33/+43
do_dma_pdma_cb() The special logic in satn_pdma_cb() is now no longer required since esp_do_dma() can be used as a direct replacement. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-50-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: untangle MESSAGE OUT and COMMAND phase logic in esp_do_nodma()Mark Cave-Ayland1-17/+23
This makes it clearer that ATN is asserted until the end of the next TI command in the MESSAGE OUT phase. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-49-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: untangle MESSAGE OUT and COMMAND phase logic in do_dma_pdma_cb()Mark Cave-Ayland1-24/+42
This makes it clearer that ATN is asserted until the end of the next TI command in the MESSAGE OUT phase. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-48-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: untangle MESSAGE OUT and COMMAND phase logic in esp_do_dma()Mark Cave-Ayland1-22/+26
This makes it clearer that ATN is asserted until the end of the next TI command in the MESSAGE OUT phase. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-47-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove do_cmd from ESPStateMark Cave-Ayland1-13/+0
Now that the accumulation of the CDB is handled by SCSI phase, there is no need for a separate variable to control it. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-46-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: convert esp_reg_write() do_cmd path to check for SCSI phase insteadMark Cave-Ayland1-1/+1
Currently do_cmd is used to determine whether MESSAGE OUT and COMMAND phase data is being accumulated in cmdfifo. Update esp_do_dma() to check directly for these two SCSI phases instead. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-45-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: convert esp_do_nodma() do_cmd path to check for SCSI phase insteadMark Cave-Ayland1-4/+4
Currently do_cmd is used to determine whether MESSAGE OUT and COMMAND phase data is being accumulated in cmdfifo. Update esp_do_dma() to check directly for these two SCSI phases instead. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-44-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: convert do_dma_pdma_cb() do_cmd path to check for SCSI phase insteadMark Cave-Ayland1-4/+4
Currently do_cmd is used to determine whether MESSAGE OUT and COMMAND phase data is being accumulated in cmdfifo. Update esp_do_dma() to check directly for these two SCSI phases instead. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-43-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: convert esp_do_dma() do_cmd path to check for SCSI phase insteadMark Cave-Ayland1-8/+5
Currently do_cmd is used to determine whether MESSAGE OUT and COMMAND phase data is being accumulated in cmdfifo. Update esp_do_dma() to check directly for these two SCSI phases instead. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-42-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: convert esp_do_nodma() to switch statement based upon SCSI phaseMark Cave-Ayland1-19/+35
Currently only the DATA IN and DATA OUT phases are supported. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-41-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: convert do_dma_pdma_db() to switch statement based upon SCSI phaseMark Cave-Ayland1-7/+12
Currently only the DATA IN and DATA OUT phases are supported. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-40-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: convert esp_do_dma() to switch statement based upon SCSI phaseMark Cave-Ayland1-13/+27
Currently only the DATA IN and DATA OUT phases are supported. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-39-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: introduce esp_get_phase() functionMark Cave-Ayland1-9/+14
Make use of this new function in all places where the SCSI phase bits are manually masked from the ESP_RSTAT register. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20240112125420.514425-38-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove s_without_satn_pdma_cb() PDMA callbackMark Cave-Ayland2-22/+1
This can now be handled by the existing do_dma_pdma_cb() function. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-37-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: move end of SCSI transfer check after TC adjustment in do_dma_pdma_cb()Mark Cave-Ayland1-9/+9
Now it is possible to move the end of SCSI transfer check to after the TC adjustment in do_dma_pdma_cb() when transferring data from the device without triggering an assert() in the SCSI code. This brings this check in line with all the others in esp_do_dma() and do_dma_pdma_cb(). Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-36-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: update esp_do_dma() bypass if async_len is zero to include non-zero ↵Mark Cave-Ayland1-1/+1
transfer check In the PDMA case the last transfer from the device to the FIFO has occurred (async_len is zero) but esp_do_dma() is still being called to drain the remaining FIFO contents. The additional non-zero transfer check ensures that we still defer the SCSI layer in the case where we are waiting for data for a TI command or a DMA enable signal. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-35-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: copy logic for do_cmd transfers from do_dma_pdma_cb() to esp_do_dma()Mark Cave-Ayland1-1/+10
This is so that PDMA transfers can be performend by esp_do_dma() as well as do_dma_pdma_cb(). Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-34-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: copy PDMA logic for transfers to device from do_dma_pdma_cb() to ↵Mark Cave-Ayland1-0/+9
esp_do_dma() This is so that PDMA transfers can be performend by esp_do_dma() as well as do_dma_pdma_cb(). Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-33-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: rename esp_dma_done() to esp_dma_ti_check()Mark Cave-Ayland1-9/+9
This is because a single DMA request can be transferred using multiple TI commands, and so a TC equal to zero may not represent the completion of the SCSI DMA command. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-32-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: move TC and FIFO check logic into esp_dma_done()Mark Cave-Ayland1-28/+11
This helps simplify the existing implementation. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-31-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: fix premature end of phase logic esp_command_completeMark Cave-Ayland1-5/+17
There are two cases here: the first is when the TI command underflows, in which case we raise INTR_BS to indicate an early change of phase, and the second is when the TI command overflows because the host requested a transfer for more data than is available. In the latter case force TC to zero so that the TI completion logic executes correctly. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-30-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: consolidate async_len and TC == 0 checks in do_dma_pdma_cb() and ↵Mark Cave-Ayland1-13/+31
esp_do_dma() Ensure that the async_len checks for requesting data from the SCSI layer and the TC == 0 checks to detect the end of the DMA transfer are consistent in both do_dma_pdma_cb() and esp_do_dma(). In particular this involves adding the check to see if the FIFO is at its low threshold since PDMA and mixed DMA and non-DMA requests can leave data remaining in the FIFO. At the same time update all the comments so that they are also consistent between all similar code paths. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-29-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: update end of transfer logic at the end of esp_transfer_data()Mark Cave-Ayland1-10/+4
Since esp_dma_done() is called in both cases, and ti_size cannot be zero (otherwise esp_command_complete() would have been called instead), replace the conditional logic with a single call to esp_dma_done(). Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-28-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove unneeded if() check in esp_transfer_data()Mark Cave-Ayland1-10/+7
The following ti_cmd checks ensure that only DMA and non-DMA TI commmands will can call into the esp_do_dma() and esp_do_nodma() callbacks. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-27-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove unaligned adjustment in do_dma_pdma_cb() to device pathMark Cave-Ayland1-9/+0
With the latest changes this condition cannot occur anymore and so the logic can be completely removed. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-26-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove TC adjustment in esp_do_dma() from device pathMark Cave-Ayland1-5/+0
Now that the TC is updated for each PDMA access (rather than once the FIFO is full) there is no need to adjust the TC at start of each DMA transfer if the FIFO is not empty. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-25-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: don't immediately raise INTR_BS if SCSI data needed in esp_do_dma()Mark Cave-Ayland1-0/+1
In the case when more data is requested from the SCSI layer during a DMA data transfer from a device, don't immediately fall through to the TC check logic. Otherwise when TC is zero INTR_BS will be raised immediately rather than when the next set of SCSI data is ready. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-24-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: ensure that the PDMA callback is called for every device readMark Cave-Ayland1-5/+3
Rather than wait for the FIFO to fill up before calling the PDMA callback, push that logic directly into the from_device logic in do_dma_pdma_cb(). Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-23-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: update condition for esp_dma_done() in esp_do_dma() to device pathMark Cave-Ayland1-3/+5
Ensure that esp_dma_done() is only called when TC is zero, which is currently always the case for DMA transfers. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-22-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: update condition for esp_dma_done() in esp_do_dma() from device pathMark Cave-Ayland1-11/+5
No change to the condition itself, other than to clarify that esp_dma_done() must be called when TC is zero. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-21-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove zero transfer size check from esp_do_dma()Mark Cave-Ayland1-1/+1
The TI end of transfer interrupt only occurs when the TC reaches zero and is not related to the SCSI layer transfer. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-20-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: don't clear RFLAGS register when DMA is completeMark Cave-Ayland1-1/+0
The internal state of the ESP sequencer is not affected when raising an interrupt to indicate the end of a DMA transfer. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-19-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: don't reset the TC and ESP_RSEQ state when executing a SCSI commandMark Cave-Ayland1-3/+0
There is no need to manually reset these values as the ESP emulation now correctly handles them within its existing logic. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-18-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove MacOS TI workaround that pads FIFO transfers to ESP_FIFO_SZMark Cave-Ayland1-12/+0
This workaround is no longer required with the current code and so can be removed. [Note: whilst MacOS itself can boot correctly, removing this hack prevents a bootable EMILE CDROM from working. This is caused by a separate bug which will be fixed by a subsequent patch] Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-17-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove another set of manual STAT_TC updatesMark Cave-Ayland1-10/+0
Following on from the recent changes to when the TC is updated, it is now possible to remove another set of manual STAT_TC updates so that its state is now managed within esp_set_tc(). Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-16-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: introduce esp_set_phase() helper functionMark Cave-Ayland2-16/+36
This function is used to set the current SCSI bus phase in the ESP_RSTAT register without affecting any of flag bits. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-15-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: decrement the TC during MESSAGE OUT and COMMAND phasesMark Cave-Ayland1-0/+2
This is to ensure that STAT_TC is triggered during the right parts of the transfer when it is controlled exclusively by the TC. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-14-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: don't accumulate directly into cmdfifoMark Cave-Ayland1-7/+42
Instead accumulate in the real FIFO as done in real hardware, and then transfer to cmdfifo when we're ready to process the MESSAGE OUT and COMMAND phase data. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-13-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove unused case from esp_pdma_read()Mark Cave-Ayland1-6/+1
The do_cmd variable is only set for the MESSAGE OUT and COMMAND phases i.e. those which involve transfers from the host to the SCSI bus, and so the unused case can be removed. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-12-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: move buffer and TC logic into separate to/from device paths in ↵Mark Cave-Ayland1-25/+40
esp_do_dma() The ultimate aim is to for esp_do_dma() behaviour to be determined by the SCSI bus phase, in which case it is necessary to have separate to/from device paths. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-11-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: update TC check logic in do_dma_pdma_cb() to check for TC == 0Mark Cave-Ayland1-13/+11
Invert the logic so that the end of DMA transfer check becomes one that checks for TC == 0 in the from device path in do_dma_pdma_cb(). Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-10-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: move command execution logic to new esp_run_cmd() functionMark Cave-Ayland1-85/+92
This helps to simplify esp_reg_write() and potentially allows for a 2-level deep FIFO to be implemented in future. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-9-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: start removal of manual STAT_TC setting when transfer counter reaches ↵Mark Cave-Ayland1-9/+2
zero This should be exclusively managed by esp_set_tc() rather than being manually set in multiple places. Start by removing the occurrences exclusive to PDMA and command completion which are those that can be currently removed without affecting any test images. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-8-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: update esp_set_tc() to set STAT_TC flagMark Cave-Ayland1-0/+6
This flag is set once the transfer counter counts down to zero. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-7-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: move esp_select() to ESP selection commands from get_cmd()Mark Cave-Ayland1-7/+18
Since the DREQ value depends upon the result of the selection process, add a workaround to each esp_select() to manually assert DREQ durring the MESSAGE OUT and COMMAND phases. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-6-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove FIFO clear from esp_select()Mark Cave-Ayland1-1/+0
The FIFO contents should not be affected by performing SCSI target selection. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-5-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: add FIFO wraparound support to esp_fifo_pop_buf()Mark Cave-Ayland1-2/+15
The fifo8_pop_buf() function returns a pointer to the FIFO buffer up to the specified length. Since the FIFO buffer is modelled as an array then once the FIFO wraps around, only the continuous portion of the buffer can be returned. In future the use of continuous and unaligned accesses will advance the internal FIFO head pointer, so modify esp_fifo_pop_buf() to ensure that any wraparound content is also returned up to the requested length. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-4-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: move existing request cancel check into esp_select()Mark Cave-Ayland1-5/+5
Since get_cmd() can be called multiple times during a mixed FIFO/DMA request, move the existing request cancel check into esp_select() which always occurs at the start of new SCSI request. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240112125420.514425-3-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>