[SeaBIOS] [PATCH] esp-scsi: indicate acceptance of MESSAGE IN phase data

Mark Cave-Ayland posted 1 patch 1 month, 1 week ago
src/hw/esp-scsi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[SeaBIOS] [PATCH] esp-scsi: indicate acceptance of MESSAGE IN phase data
Posted by Mark Cave-Ayland 1 month, 1 week ago
When the target has sent its MESSAGE IN phase data to the initiator, it waits
for the initiator to release the ACK signal before disconnecting from the bus.

Send a MSG_ACC command to the ESP so that the initiator releases the ACK signal
to allow the target to disconnect, and also return the ASC back to the
disconnected state.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 src/hw/esp-scsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

[MCA: this is required for an upcoming QEMU ESP patch series which enforces
the commands that can be executed in each internal ESP state. Without this
fix SeaBIOS doesn't return the ESP back to its disconnected state after the
SCSI transfer, causing subsequent ESP commands to fail.] 

diff --git a/src/hw/esp-scsi.c b/src/hw/esp-scsi.c
index 8612069f..e1bee545 100644
--- a/src/hw/esp-scsi.c
+++ b/src/hw/esp-scsi.c
@@ -50,6 +50,7 @@
 #define ESP_CMD_RESET    0x02
 #define ESP_CMD_TI       0x10
 #define ESP_CMD_ICCS     0x11
+#define ESP_CMD_MSGACC   0x12
 #define ESP_CMD_SELATN   0x42
 
 #define ESP_STAT_DI      0x01
@@ -159,11 +160,12 @@ esp_scsi_process_op(struct disk_op_s *op)
             continue;
         }
 
-        /* Finally read data from the message in phase.  */
+        /* Finally read data from the message in phase and accept.  */
         if (state == 3 && (stat & ESP_STAT_MSG)) {
             state++;
             status = inb(iobase + ESP_FIFO);
             inb(iobase + ESP_FIFO);
+            outb(ESP_CMD_MSGACC, iobase + ESP_CMD);
             break;
         }
         usleep(5);
-- 
2.39.2

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] esp-scsi: indicate acceptance of MESSAGE IN phase data
Posted by Gerd Hoffmann 1 month, 1 week ago
On Thu, Aug 29, 2024 at 12:58:46PM GMT, Mark Cave-Ayland wrote:
> When the target has sent its MESSAGE IN phase data to the initiator, it waits
> for the initiator to release the ACK signal before disconnecting from the bus.
> 
> Send a MSG_ACC command to the ESP so that the initiator releases the ACK signal
> to allow the target to disconnect, and also return the ASC back to the
> disconnected state.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Patch applied.

thanks,
  Gerd

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org