esp.c: untangle MESSAGE OUT and COMMAND phase logic in esp_do_nodma()
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>
This commit is contained in:
parent
9e60cf788c
commit
79a6c7c610
@ -801,6 +801,23 @@ static void esp_do_nodma(ESPState *s)
|
|||||||
|
|
||||||
switch (esp_get_phase(s)) {
|
switch (esp_get_phase(s)) {
|
||||||
case STAT_MO:
|
case STAT_MO:
|
||||||
|
/* Copy FIFO into cmdfifo */
|
||||||
|
n = esp_fifo_pop_buf(&s->fifo, buf, fifo8_num_used(&s->fifo));
|
||||||
|
n = MIN(fifo8_num_free(&s->cmdfifo), n);
|
||||||
|
fifo8_push_all(&s->cmdfifo, buf, n);
|
||||||
|
s->cmdfifo_cdb_offset += n;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Extra message out bytes received: update cmdfifo_cdb_offset
|
||||||
|
* and then switch to command phase
|
||||||
|
*/
|
||||||
|
s->cmdfifo_cdb_offset = fifo8_num_used(&s->cmdfifo);
|
||||||
|
esp_set_phase(s, STAT_CD);
|
||||||
|
s->rregs[ESP_RSEQ] = SEQ_CD;
|
||||||
|
s->rregs[ESP_RINTR] |= INTR_BS;
|
||||||
|
esp_raise_irq(s);
|
||||||
|
break;
|
||||||
|
|
||||||
case STAT_CD:
|
case STAT_CD:
|
||||||
/* Copy FIFO into cmdfifo */
|
/* Copy FIFO into cmdfifo */
|
||||||
n = esp_fifo_pop_buf(&s->fifo, buf, fifo8_num_used(&s->fifo));
|
n = esp_fifo_pop_buf(&s->fifo, buf, fifo8_num_used(&s->fifo));
|
||||||
@ -810,25 +827,14 @@ static void esp_do_nodma(ESPState *s)
|
|||||||
cmdlen = fifo8_num_used(&s->cmdfifo);
|
cmdlen = fifo8_num_used(&s->cmdfifo);
|
||||||
trace_esp_handle_ti_cmd(cmdlen);
|
trace_esp_handle_ti_cmd(cmdlen);
|
||||||
s->ti_size = 0;
|
s->ti_size = 0;
|
||||||
if (esp_get_phase(s) == STAT_CD) {
|
|
||||||
/* No command received */
|
|
||||||
if (s->cmdfifo_cdb_offset == fifo8_num_used(&s->cmdfifo)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Command has been received */
|
/* No command received */
|
||||||
do_cmd(s);
|
if (s->cmdfifo_cdb_offset == fifo8_num_used(&s->cmdfifo)) {
|
||||||
} else {
|
return;
|
||||||
/*
|
|
||||||
* Extra message out bytes received: update cmdfifo_cdb_offset
|
|
||||||
* and then switch to command phase
|
|
||||||
*/
|
|
||||||
s->cmdfifo_cdb_offset = fifo8_num_used(&s->cmdfifo);
|
|
||||||
esp_set_phase(s, STAT_CD);
|
|
||||||
s->rregs[ESP_RSEQ] = SEQ_CD;
|
|
||||||
s->rregs[ESP_RINTR] |= INTR_BS;
|
|
||||||
esp_raise_irq(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Command has been received */
|
||||||
|
do_cmd(s);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STAT_DO:
|
case STAT_DO:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user