aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi
AgeCommit message (Collapse)AuthorFilesLines
2024-02-13esp.c: keep track of the DRQ state during DMAMark Cave-Ayland1-4/+11
Currently the DRQ IRQ is updated every time DMA data is sent/received which is both inefficient and causes excessive logging of the DRQ state. Add a new drq_state bool that only updates the DRQ IRQ if its state changes. This commit adds the new drq_state bool to the migration state: since the version number has already been increased earlier in the series, there is no need to repeat it again here. The DRQ IRQ is (currently) only used for PDMA transfers which already have a migration break in this series so there are no problems setting its value post-load. 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-87-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: rename irq_data IRQ to drq_irqMark Cave-Ayland1-4/+4
The IRQ represented by irq_data is actually the DRQ (DMA request) line so rename it accordingly. 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-86-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: implement DMA Transfer Pad command for DATA phasesMark Cave-Ayland1-28/+69
The Transfer Pad command is used to either drop incoming FIFO data during the DATA IN phase or generate a series of zero bytes in the FIFO during the DATA OUT phase. Implement the DMA Transfer Pad command for the DATA phases which is used by the NeXTCube firmware in the DATA IN phase to ignore part of the incoming SCSI data as it is copied into memory. 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-85-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: replace n variable with len in esp_do_nodma()Mark Cave-Ayland1-20/+20
This brings esp_do_nodma() in line with esp_do_dma(). 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-84-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: consolidate DMA and PDMA logic in STATUS and MESSAGE IN phasesMark Cave-Ayland1-4/+3
This allows the removal of duplicate logic shared between the two implementations. Note that we restrict esp_raise_drq() to PDMA to help reduce the log verbosity for normal DMA. 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-83-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove redundant n variable in PDMA COMMAND phaseMark Cave-Ayland1-5/+3
This variable can be replaced by the existing len variable. 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-82-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: consolidate DMA and PDMA logic in MESSAGE OUT phaseMark Cave-Ayland1-7/+5
This allows the removal of duplicate logic shared between the two implementations. Note that we restrict esp_raise_drq() to PDMA to help reduce the log verbosity for normal DMA. 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-81-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: consolidate DMA and PDMA logic in DATA IN phaseMark Cave-Ayland1-34/+17
This allows the removal of duplicate logic shared between the two implementations. Note that we restrict esp_raise_drq() to PDMA to help reduce the log verbosity for normal DMA. 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-80-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: consolidate DMA and PDMA logic in DATA OUT phaseMark Cave-Ayland1-23/+12
This allows the removal of duplicate logic shared between the two implementations. Note that we restrict esp_raise_drq() to PDMA to help reduce the log verbosity for normal DMA. 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-79-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: only transfer non-DMA MESSAGE OUT phase data for specific commandsMark Cave-Ayland1-6/+15
The contents of the FIFO should only be copied to cmdfifo for ESP commands that are sending data to the SCSI bus, which are the SEL_* commands and the TI command. Otherwise any incoming data should be held in the FIFO as normal. This fixes booting of NetBSD m68k under the Q800 machine once again. 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-78-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: only transfer non-DMA COMMAND phase data for specific commandsMark Cave-Ayland1-6/+15
The contents of the FIFO should only be copied to cmdfifo for ESP commands that are sending data to the SCSI bus, which are the SEL_* commands and the TI command. Otherwise any incoming data should be held in the FIFO as normal. This fixes booting of really old 32-bit SPARC Linux kernels such as Aurelien's debian_etch_sparc_small.qcow2 test image. 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-77-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: improve ESP_RSEQ logic consolidationMark Cave-Ayland1-6/+8
The ESP_RSEQ logic is scattered in a few places throughout the ESP state machine which is mainly because the ESP_RSEQ register isn't always reset when executing an ESP select command. Once this is done, the ESP_RSEQ register only needs to be updated at the point where the sequencer command completes. 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-76-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: handle non-DMA FIFO writes used to terminate DMA commandsMark Cave-Ayland1-0/+10
Certain versions of MacOS send the first 5 bytes of the CDB using DMA and then send the last byte of the CDB by writing to the FIFO. Update the non-DMA state machine to detect the end of the CDB and execute the SCSI command using similar logic as that which already exists for transferring the remainder of the CDB using the ESP 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-75-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove restriction on FIFO read access when DMA memory routines definedMark Cave-Ayland1-8/+1
The latest state machines can handle mixing DMA and non-DMA FIFO access for all SCSI phases except DATA IN and DATA OUT. For DATA IN and DATA OUT phases, the transfer is complete when TC == 0 and the updated logic will now handle TC underflow correctly, which makes it just about impossible to manually manipulate the FIFO during a DMA transfer. Remove the restriction on FIFO read access when DMA memory routines are defined which also allows the NeXTCube machine to pass its self-test. 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-74-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: handle TC underflow for DMA SCSI requestsMark Cave-Ayland1-1/+24
Detect the case where the guest underflows TC by requesting a DMA transfer which is larger than the available data. If this case is detected, immediately complete the SCSI request and handle any remaining FIFO accesses in the STATUS phase by raising INTR_BS once the FIFO is below the threshold. Note that handling the premature SCSI bus phase change in the case of TC underflow fixes booting EMILE on m68k once again. 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-73-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 the SCSI phase when reading ESP_RINTRMark Cave-Ayland1-1/+1
According to the documentation ESP_RSTAT is cleared (except the STAT_TC bit) when ESP_RINTR is read. This should not include the SCSI bus phase bits which are currently live from the SCSI bus, otherwise the current SCSI phase is lost when clearing an end-of-transfer interrupt. 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-72-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: ensure that STAT_INT is cleared when reading ESP_RINTRMark Cave-Ayland1-1/+1
Both esp_raise_irq() and esp_lower_irq() check the STAT_INT bit in ESP_RSTAT to ensure that the IRQ is raised or lowered if its state changes. When reading ESP_RINTR, esp_lower_irq() was being called *after* ESP_RSTAT had been cleared meaning that STAT_INT was already clear, and so if STAT_INT was asserted beforehand then the esp_lower_irq() would have no effect. 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-71-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: consolidate end of command sequence after ICCS commandMark Cave-Ayland1-4/+3
The end of command sequences for the ICCS command are currently different between the DMA and non-DMA versions, and also different from the description in the datasheet. Update the sequence so that only INTR_FC is asserted in both cases, and keep all the logic in esp_do_dma() and esp_do_nodma() rather than having some of it within esp_run_cmd(). 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-70-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: move write_response() non-DMA logic to esp_do_nodma()Mark Cave-Ayland1-9/+23
This moves the remaining non-DMA STATUS and MESSAGE IN phase logic from write_response() to esp_do_nodma(). Note that we can also now drop the extra fifo_reset() which is no longer required. 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-69-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: replace get_cmd() with esp_do_nodma()Mark Cave-Ayland1-50/+4
Now that the esp_do_nodma() state machine correctly handles incoming FIFO data, all remaining users of get_cmd() can be replaced with esp_do_nodma() and the get_cmd() function removed completely. 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-68-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: process non-DMA FIFO writes in esp_do_nodma()Mark Cave-Ayland1-35/+86
Currently any write to the ESP FIFO in the MESSAGE OUT or COMMAND phases will manually raise the bus service interrupt. Instead of duplicating the interrupt logic in esp_reg_write(), update esp_do_nodma() to correctly process incoming FIFO data during the MESSAGE OUT and COMMAND phases. Part of this change is to call esp_nodma_ti_dataout() from handle_ti() to ensure that the DATA OUT phase FIFO transfer only occurs when executing a non-DMA TI command instead of for each byte entering the FIFO. One slight complication is that NextSTEP uses multiple TI commands to transfer the CDB one byte at a time (as opposed to loading the FIFO and using a single TI command), so it is necessary to determine the expected length of the SCSI CDB being received. This is handled by the introduction of a new esp_cdb_length() function which returns the expected SCSI CDB length based upon the first command byte. 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-67-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: move non-DMA TI logic to separate esp_nodma_ti_dataout() functionMark Cave-Ayland1-22/+29
This is to allow the logic to be moved during the next commit. 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-66-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: don't raise INTR_BS interrupt in DATA IN phase until TI command issuedMark Cave-Ayland1-0/+5
In the case where a SCSI command with a DATA IN phase has been issued, the host may preload the FIFO with unaligned bytes before issuing the main DMA transfer. When accumulating data in the FIFO don't raise the INTR_BS interrupt until the TI command is issued, otherwise the unexpected interrupt can confuse the host. In particular this is needed to prevent the MacOS Disk Utility from failing when switching non-DMA transfers to use esp_do_nodma(). 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-65-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove unneeded ti_cmd fieldMark Cave-Ayland1-6/+13
According to the datasheet the previous ESP command remains in the ESP_CMD register, which caused a problem when consecutive TI commands were issued as it becomes impossible for the state machine to know when the first TI command finishes. This was the original reason for introducing the ti_cmd field which kept track of the last written command for this purpose. However closer reading of the datasheet shows that a TI command that terminates due to a change of SCSI target phase resets the ESP_CMD register to zero which solves this problem. Now that this has been fixed in the previous commit, remove the unneeded ti_cmd field and access the ESP_CMD register directly instead. Bump the vmstate_esp version to indicate that the ti_cmd field is no longer included. 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-64-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: zero command register when TI command terminates due to phase changeMark Cave-Ayland1-0/+8
This is the behaviour documented in the datasheet and allows the state machine to correctly process multiple consecutive TI commands. 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-63-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove DATA IN phase logic when reading from FIFOMark Cave-Ayland1-11/+0
Whilst the FIFO is used a storage buffer for both DMA and non-DMA requests, the loading and unloading is managed directly issuing commands to the ESP. As a result there is no need to manually invoke the non-DMA command handler. 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-62-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: use deferred interrupts for both DATA IN and DATA OUT phasesMark Cave-Ayland1-17/+18
This brings DATA OUT transfers in line with DATA IN transfers by ensuring that the guest visible function complete interrupt is only set once the SCSI layer has returned. 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-61-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: separate logic based upon ESP command in esp_transfer_data()Mark Cave-Ayland1-6/+26
The handling of the INTR_FC and INTR_BS bits is different depending upon the last command executed by the ESP. Note that currently INTR_FC is managed elsewhere, but that will change soon. 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-60-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: separate logic based upon ESP command in esp_command_complete()Mark Cave-Ayland1-14/+16
The handling of the INTR_FC and INTR_BS bits is different depending upon the last command executed by the ESP. Note that currently INTR_FC is managed elsewhere, but that will change soon. 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-59-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: rename data_in_ready to to data_readyMark Cave-Ayland1-4/+4
This field is currently used to handle deferred interrupts for the DATA IN phase but the code will soon be updated to do the same for the DATA 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-58-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: remove unused PDMA callback implementationMark Cave-Ayland1-50/+5
Note that this is a migration break for the q800 machine because the extra PDMA information is no longer included. 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-57-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: always use esp_do_dma() in pdma_cb()Mark Cave-Ayland1-7/+1
There is now only a single implementation contained within esp_do_dma() so call it directly. 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-56-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: move CMD_ICCS command logic to esp_do_dma()Mark Cave-Ayland1-25/+57
The special logic in write_response_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-55-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: replace do_dma_pdma_cb() with esp_do_dma()Mark Cave-Ayland1-137/+1
Now that the DMA logic is identical between do_dma_pdma_cb() and esp_do_dma() we can replace do_dma_pdma_cb() with esp_do_dma(). 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-54-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2024-02-13esp.c: move CMD_SELATNS end of command logic to esp_do_dma() and ↵Mark Cave-Ayland1-41/+41
do_dma_pdma_cb() The special logic in satn_stop_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-53-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
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-Ayland1-32/+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>